text:
Q: In the new canon what do we actually know about Darth Plagueis? I read and loved Darth Plagueis but with all the recent changes to what is and isn't canon I'm losing track.
There's a common theory that Supreme Leader Snoke is Darth Plagueis, most are discounted because Plagueis is a Muun. But where does that information come from? What current canon information do we have about Plagueis that disproves this theory and what has been marked as Legends?

A: Just an addition to the other answers, Darth Plagueis is also mentioned in Star Wars: The Rise of Skywalker: Expanded Edition.

"His (Emperor) very own apprentice (Vader) had turned against him, the way he himself had turned against Plagueis…whose secret to immortality he had stolen."

Also

"Plagueis had not acted fast enough in his own moment of death. But Sidious, sensing the flickering light in his apprentice, had been ready for years. So the falling, dying Emperor called on all the dark power of the Force to thrust his consciousness far, far away, to a secret place he had been preparing. His body was dead, an empty vessel, long before it found the bottom of the shaft, and his mind jolted to new awareness in a new body — a painful one, a temporary one."

A: From the prequel trilogy we have this.

Darth Plagueis was a Dark Lord of the Sith so powerful and so wise, he could use the Force to influence the midi-chlorians to create life. He had such a knowledge of the dark side, he could even keep the ones he cared about from dying.
―Palpatine

(of course Palpatine wasn't always 100% truthful so this could even be disputed)
There is the 'Cannon' Page on star wars wiki for him.
Apparently he is mentioned in the 'Tarkin' novel (written by the same author as Plagueis), I don't have that to expand on what is said there.

A: The character of Darth Plagueis is only mentioned in two canon sources: Episode III and the novel Tarkin.
The only information from Episode III is that

Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the midi-chlorians to create life ... He had such a knowledge of the dark side that he could even keep the ones he cared about from dying.
...
He became so powerful ... the only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep.
Darth Sidious/Palpatine (source)

A little more information about Plagueis is given in Tarkin. Perhaps most important is the fact that Plagueis was indeed Sidious' master.

Save for Sidious, no sentient being in close to five thousand years had set foot in the shrine [under the former Jedi Temple]. The room's excavation and restoration had been carried out by machines under the supervision of 11-4D. Even Vader was unaware of the shrine's existence. But it was here that they would one day work together the way Sidious and Plagueis had to coax from the dark side its final secrets. In the intervening years he had actually come to appreciate Plagueis for the planner and prophet he had been. Such perilous machinations required two Sith, one to serve as bait for the dark side, the other to be the vessel. Success would grant them the power to harness the full powers of the dark side, and allow them to rule for ten thousand years.
p. 101

Elsewhere it is mentioned that the droid 11-4D was owned by Plagueis.
Plagueis was still alive by the time Sidious became Naboo's senator, which is consistent with the Legends novel Darth Plagueis:

[Sidious and Tarkin] had met several years after Sidious -- still an apprentice of Darth Plagueis at the time -- had been appointed Naboo's representative to the Republic Senate.
p. 102

Plagueis on the Force:

Darth Plagueis had once remarked that "the Force can strike back." The death of a star didn't necessarily curtail its light, and indeed Sidious could see evidence of that sometimes even in Vader—the barest flicker of persistent light.
p. 102

Plagueis disdained "trivial" political matters and did not foresee that Sidious would rise to become Emperor:

The Emperor spent a long moment studying Ison and Rancit, stretching out with his powers to discern alignments, configurations, some syzygy of events. Then his thoughts turned to Vader and Tarkin. He appreciated how well they were working together, but he began to wonder if they were perhaps too close to the details of the dissidents' scheme to recognize their ultimate objective. One needed to have a safe remove, as he felt he had, gazing into the 3-D representation of the galaxy he had made his own. How Plagueis would have mocked him for allowing himself to become personally involved in such a seemingly trivial matter; but then his Master had never foreseen that his onetime apprentice would become Emperor.
p. 103

That's it. That's all we know about Plagueis strictly from canon. We don't know Plagueis' species. The main proof that Plagueis is not Snoke comes out-of-universe, from Pable Hidalgo. In-universe, the best evidence is that Plagueis needs to have died in order for the prophecy of the Chosen One to be true (the Chosen One was supposed to destroy the Sith); Anakin is the Chosen One, so he couldn't have destroyed the Sith if Snoke is Plagueis.


text:
Q: python urllib2 HTTPSHandler error I just installed openSuse 12.3 server onto my server and I have been loading everything onto it from the old server(CentOS 6.2) and I use python as my programming language and I tried to use pip to install things but pip is throwing a global error(it throws it no matter what) that urllib2 HTTPSHandler is not there or can not be imported... opensuse comes with openssl so where am I going wrong here? Anyone have any insight?

A: It seems that opensuse installed the very minimum of python with the text server installation which means that you have to install python from yast or zypper or wherever you wish to, to get ssl and HTTPS working... (most annoying)
Solution:
sudo zypper install python
and choose solution 1 (deinstallation of patterns-openSUSE-minimal_base-conflicts)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Logic - What does ∴ mean in a truth table? I see the symbol used, and I've never seen it logically defined. In words, It's defined as a symbol meaning 'therefore'. Because of a lack of definition, I have no idea why this is false:
A
B
∴C

For me, this statemnet could mean one of two things.

*

*'If A and B thus C':
(A^B) -> C
i.e same as conditional

*That ∴ is the same as the conditional, only without a truth value for when the premises is false (conclusions cannot draw upon a false premise)
'A thus B', perhaps? I've read that a valid argument is only so if it is (logically/symbolically/algebraically) impossible that the conclusion be false, given that premise is true.
I am not certain on that, and any correction would be appreciated. However, regardless, I still can't find a strict, logical definition or equivalent of ∴, and it's not that I haven't looked, the ∴ only ever seems to be talked about, never strictly defined.

A: The symbol means "therefore".  In common usage, "therefore" is a stronger statement than "if/then".  When we say "$p$ therefore $q$", we mean both "if $p$ then $q$" and "$p$ is true".  Thus we assure that $q$ is true, which the "if/then" statement alone does not.  Mathematically:
$p \therefore q \equiv ((p\rightarrow q) \land p)$

A: It is a semantic statement rather than a syntactic one.  Syntax is the level of propositional calculus in which $A,B, A\wedge B$ live.  Semantics is at a higher level, where we assign truth values to propositions based on interpreting them in a larger universe.
Your (1),  $(A\wedge B) \to C$, is a proposition.  It may be true or false.  However $(A\wedge B) \therefore C$ cannot be false.  It can be a valid proof, or invalid, which is again at a a semantic level rather than a syntactic one.
For example, if $P$ holds then $\neg(\neg P)$ must hold.  We have $P \therefore \neg(\neg P)$.  This is a different meaning than $P\to \neg(\neg P)$, which is a proposition that happens to be always true (a tautology).  Asserting that $P\to \neg(\neg P)$ is logically equivalent to a tautology, is equivalent to $P \therefore \neg(\neg P)$.


text:
Q: Objective C - Uninterrupted timer using Singleton My app consists of 3 ViewControllers. ViewController1 consists of a few labels and buttons where the user tries to solve a problem and presses a button. The button takes them to ViewController 2, where they are shown their stats (accuracy, time, etc.). The app then automatically navigates the user back to the game after 2 seconds. This process goes on for 2 minutes. After the 2 minutes is up, I want the app to navigate to a ViewController 3 (Main Menu).
I'm trying to implement a timer that that keeps going even when switching between view controllers. I've implemented (with the help of stackoverflow) a singleton class that has a timer property. However, it's not functioning as required. I've tried printing out values(commented in the code) to see what's going on, but no luck.
Here's my code:
ApplicationManager.m
    //
    //  ApplicationManager.m

    #import <Foundation/Foundation.h>

    #import "ApplicationManager.h"

    @implementation ApplicationManager

    static ApplicationManager* appMgr = nil;

    +(ApplicationManager*)instance{
        @synchronized ([ApplicationManager class]){
            if (!appMgr) {
                appMgr = [[self alloc]init];
            }

            return appMgr;

        }

        return nil;

    }

    +(id) alloc{

        @synchronized([ApplicationManager class]){
            NSAssert((appMgr == nil), @"Only one instance of singleton class may be instantiated");
            appMgr = [super alloc];
            return appMgr;

        }
    }

    +(id) init{
        if (!(self == [super init])) {
            return nil;
        }
        return self;
    }

    @end

ApplicationManager.h
    @interface ApplicationManager : NSObject
    +(ApplicationManager*) instance;

    @property(weak, nonatomic) NSTimer* timer;
    @property(weak, nonatomic) NSDate* startDate;

    @end

ViewController.m
#import "ViewController.h"

#import "ApplicationManager.h"

NSString* const MAXTRIALTIME = @"00:50.000"; //50 Seconds just for testing purposes

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [[ApplicationManager instance]setstartDate:[NSDate date]];

    [self startTimer];

//other functionalities

}

-(void)startTimer{

    [[ApplicationManager instance] setTimer:[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES]];

}

-(void) resetTimer{
    [[[ApplicationManager instance] timer]invalidate];
}

-(void)updateTimer{
    NSDate *currentTime = [NSDate date];
    NSLog(@"Start Date2: %@", [[ApplicationManager instance]startDate]); //PRINTS (null)

    NSTimeInterval timerInterval = [currentTime timeIntervalSinceDate:[[ApplicationManager instance]startDate]];

    NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timerInterval];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"mm:ss.SSS"];

    [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];

    self.finalTime = [dateFormatter stringFromDate:timerDate];

    NSLog(@"Time: %@\n",self.finalTime); //PRINTS random numbers

    if ([self.finalTime isEqualToString:MAXTRIALTIME]) {
        [self resetTimer];
       //move to a different view controller

    }

}

@end

ViewController.h
extern NSString* const MAXTRIALTIME;
@property (strong, nonatomic) NSString *finalTime;
//other declarations

A: In your ApplicationController singleton class you are making a call to self in the instance method. Any methods that instantiate a class (i.e. Methods that begin with a +) should never reference self as self will not exist at that point.
You need to do:
if (!appMgr) {
    appMgr = [[ApplicationManager alloc] init];
}

This is the reason you are getting NULL when you print the startDate property.
Also, the ApplicationManager singleton is the owner of its timer property so that needs to be (strong). Weak properties are for references to objects that are owned by other classes. Check out ARC stuff.
Lastly the init method should be a - method not a + one and You don't need to override the alloc method as long as you only use the instance method to access your ApplicationManager. If I were you I'd get rid of the alloc and init methods altogether and just use the instance one.


text:
Q: DbContext.SaveChanges() without any auto transaction handling Is there a way to execute the DbContext.SaveChanges() without invoke its internal auto transaction handling?
I'm working to handle the transaction (DbTransaction) myself, but when I invoking it's Commit, I getting error "SqlConnection does not support parallel transactions"
I believe this is due to SaveChanges is doing its own internal transaction work, which I want to suppress it.
.NET 4.5, EntityFramework.dll ver 5.
googling shows few approaches, but the code are not compatible.
Some showing SaveChanges can accept a Boolean, which it is not in this ver. and then invoking AcceptAllChanges() which method also not exist.
While some is using System.Transaction.TransactionScope, but its different with this System.Data.Common.DbTransaction.

A: after many PITA efforts digging over the EF thing. the only way I found out to have proper transaction control over it is best to use ObjectContext, instead of DbContext.
http://sqlanywhere-forum.sap.com/questions/11320/entity-framework-savechanges-closes-connection
this hinted the ObjectContext
DbContext codebase is genereated if your EDMX code generation strategy is set to None.
link: Is ObjectContext deprecated in .NET 4.5?
by changing it to Default, you will get ObjectContext code base gen.
the diff of them so far of what I found out, using DbContext, whenever you invoke its SaveChanges(), it will AUTO close the underneath connection, and your next db task will have a new connection, which basically break the transaction control of what I seek.
you need to run the whole db tasks without the conx being close or recreate within the transaction.
by using ObjectContext, SaveChanges() will not auto close the connection if I setup the transaction and connection codes properly before it.


text:
Q: Not been able to update status on linkedIn on iphone I am using following code
 - (void)linkedInEngineAccessToken:(RDLinkedInEngine *)engine setAccessToken:(OAToken *)token {
        if( token ) {
            [token rd_storeInUserDefaultsWithServiceProviderName:@"LinkedIn" prefix:@"My app name"];
        }
        else {
            [OAToken rd_clearUserDefaultsUsingServiceProviderName:@"LinkedIn" prefix:@"My App name"];

        }
    }

    - (OAToken *)linkedInEngineAccessToken:(RDLinkedInEngine *)engine {
        return [OAToken rd_tokenWithUserDefaultsUsingServiceProviderName:@"LinkedIn" prefix:@"My app name"];
    }

    - (void)linkedInEngine:(RDLinkedInEngine *)engine requestSucceeded:(RDLinkedInConnectionID *)identifier withResults:(id)results {
        NSLog(@"++ LinkedIn engine reports success for connection %@\n%@", identifier, results);
        if( identifier == self.fetchConnection ) {
        //    NSDictionary* profile = results;

        }
    }

    - (void)linkedInEngine:(RDLinkedInEngine *)engine requestFailed:(RDLinkedInConnectionID *)identifier withError:(NSError *)error {
        NSLog(@"++ LinkedIn engine reports failure for connection %@\n%@", identifier, [error localizedDescription]);
    }

    - (void)fetchProfile {
        self.fetchConnection = [self.engine profileForCurrentUser];
        [self.engine updateStatus:@"Download app from the #Apple #AppStore and #Android #GooglePlay market."];
        [self dismissModalViewControllerAnimated:YES];
    }

    #pragma mark - RDLinkedInAuthorizationControllerDelegate

    - (void)linkedInAuthorizationControllerSucceeded:(RDLinkedInAuthorizationController *)controller {
        [self fetchProfile];
    }

    - (void)linkedInAuthorizationControllerFailed:(RDLinkedInAuthorizationController *)controller {

    }

    - (void)linkedInAuthorizationControllerCanceled:(RDLinkedInAuthorizationController *)controller {

    }

    @end

I have set up things correctly. It takes me to linkedIn login page and after login to give permissions I get this error

Failed to load page Error Domain=NSURLErrorDomain Code=-1003 "A
  server with the specified hostname could not be found."
  UserInfo=0x81e2250
  {NSErrorFailingURLStringKey=http://www.devbee.ca/?oauth_token=MY_TOKEN&oauth_verifier=VERIFIER,
  NSErrorFailingURLKey=MY_REDIRECT_URL/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_VERIFIER,
  NSLocalizedDescription=A server with the specified hostname could not
  be found., NSUnderlyingError=0x810ddc0 "A server with the specified
  hostname could not be found."}

What is wrong?
Is it because of
- (OAToken *)linkedInEngineAccessToken:(RDLinkedInEngine *)engine {
            return [OAToken rd_tokenWithUserDefaultsUsingServiceProviderName:@"LinkedIn" prefix:@"My app name"];
        }

A: The problem is coming from the fact that http://www.devbee.ca is not up and running. I don't know what point in your code or configuration you are referring to http://www.devbee.ca, but that's where there error lies.
I am guessing that in the configuration for your LinkedIn App, you have set the OAuth Accept Redirect URL to http://www.devbee.ca, which is a non-existant URL. But that's just a guess, you need to dig around to figure out why LinkedIn is redirecting you to http://www.devbee.ca.
Update
It seems that you need to set this OAuth Accept Redirect URL to http://linkedin_oauth/success in your app's configuration. It states this in the How To on the GitHub project:

Most importantly, the OAuth Redirect URL must be set to:
  http://linkedin_oauth/success for the web view's delegate to be
  notified

A: Due to URL connection error it is a problem with your redirect url.
Look, the error says: "A server with the specified hostname could not be found". That means that you haven't got internet connection or your server hostname is not found in DNS list of your provider or your server url is wrong.
What you could try. The error specifies the error url: "NSErrorFailingURLKey=MY_REDIRECT_URL/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_VERIFIER". You could try to open in Safari/Chrome/etc on your Mac the specified url "MY_REDIRECT_URL/?oauth_token=MY_OAUTH_TOKEN&oauth_verifier=MY_VERIFIER" and look what will happen. If you see the same error that you should double check your redirect URL. If it successfully is opened that there is a problem with iOS app.


text:
Q: Cant figure how to implement following jQuery plugin into my webpage I've been looking for something that will authorize a textbox when user types something and I found this ideal plugin:
http://james.padolsey.com/javascript/jquery-plugin-autoresize/
It seems prety straight forward, but for some reason I can't implement it on my website >.< do you guys have any ideas on how to do it? (read the post)
Thank You )))
Here is what I tried, but it doesn't work
HTML
<head>
<script type="text/javascript" src="js/jquery-1.6.js"></script>
<script type="text/javascript" src="js/autoresize.jquery.js"></script>
<script type="text/javascript">

$('textarea.mainStatusTxt').autoResize({
// On resize:
onResize : function() {
$(this).css({opacity:0.8});
},
// After resize:
animateCallback : function() {
$(this).css({opacity:1});
},
// Quite slow animation:
animateDuration : 300,
// More extra space:
extraSpace : 40
});

</script>
</head>

<body>
<textarea class="mainStatusTxt" placeholder="Comment" style="display:block;"></textarea>
</body>

A: Either wrap your script with:
$(document).ready(function() {
  //YOUR CODE
});

or move the entire <script> tag to the end of the document (or at least, after the <textarea>).


text:
Q: How to implement QML ListModel like get method for an QAbstractListModel derived model I want to use an QAbstractListModel derived model in QML. Binding the model to views already works great.
The next thing I want achieve is the ability to access specific items and their role like it is possible with a QML ListModel
grid.model.get(index).DisplayRole

But I have no idea how to implement this get method in my QAbstractListModel derived model.
Any hints?

A: You can add an Q_INVOKABLE function to the QAbstractItemModel derived class like this:
...

Q_INVOKABLE QVariantMap get(int row);

...

QVariantMap get(int row) {
    QHash<int,QByteArray> names = roleNames();
    QHashIterator<int, QByteArray> i(names);
    QVariantMap res;
    while (i.hasNext()) {
        i.next();
        QModelIndex idx = index(row, 0);
        QVariant data = idx.data(i.key());
        res[i.value()] = data;
        //cout << i.key() << ": " << i.value() << endl;
    }
    return res;
}

This will return something like { "bookTitle" : QVariant("Bible"), "year" : QVariant(-2000) } so you could use .bookTitle on it

A: This took me a very long time to find, as there are many incorrect solutions on Stackoverflow.
I've posted the reply here:
How to access ListView's current item from qml
This works for all models, whether derived from QAbstractItemModel or built directly in QML, and even allows access to tree-shaped models.

A: An alternative approach to do this would be to directly use the built-in functions of QAbstractItemModel, e.g. via
grid.model.data(grid.model.index(index, 0), 0 /*== Qt::DisplayRole*/)

This technically works, but requires the user to know the numerical codes for the roles, instead of the designating strings. The main problem here is that there is at best only built-in functionality to determine roleNames(). For a proper mapping of the name strings to the according numerical values one would need to either implement an inverting function and expose it using Q_INVOKABLE or process the QHash resulting from roleNames() in QML manually.

A: if you want to use the classic approach for roles in list models you don't have to do anything special in the c++ side, you have your model like always and it should implement the data method:
QVariant QAbstractItemModel::data(const QModelIndex & index, int role = Qt::DisplayRole) const

to access the different roles from QML the model attached property can be used in your ListView delegate:
model.display // model.data(index, Qt::DisplayRole) in c++
model.decoration // Qt::DecorationRole
model.edit // Qt::EditRole
model.toolTip // Qt::ToolTipRole
// ... same for the other roles

I don't think that is anywhere documented in the Qt doc (yet), but to find out what properties you can access form QML just start the app in debug mode and put a breakpoint in the delegate or print all properties to the console. Btw the model property inside the delegate is of type QQmlDMAbstractItemModelData, so there is some "Qt magic" happening in the background, looks like some wrapper around the list model data, still I could not find anything official in the Qt documentation about that (I figured that out by myself with the QML debugger and stuff).
If you need to access the model data from outside of the delegate I don't think there is any build in functionality for that, so you have to do that yourself.
I did an example for a custom QAbstractListModel class which exposes a count property and get-function similar to the default QML ListModel:
mylistmodel.h
class MyListModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY(int count READ rowCount NOTIFY countChanged)

public:
    explicit MyListModel(QObject *parent = 0);

    int rowCount(const QModelIndex & = QModelIndex()) const override { return m_data.count(); }
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

    Q_INVOKABLE int get(int index) const { return m_data.at(index); }

signals:
    void countChanged(int c);

private:
    QList<int> m_data;
};

mylistmodel.cpp
MyListModel::MyListModel(QObject *parent) :
    QAbstractListModel(parent)
{
    m_data << 1 << 2 << 3 << 4 << 5; // test data
    emit countChanged(rowCount());
}

QVariant MyListModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || index.row() < 0 || index.row() >= rowCount())
        return QVariant();

    int val = m_data.at(index.row());

    switch (role) {
    case Qt::DisplayRole:
        return QString("data = %1").arg(val);
        break;
    case Qt::DecorationRole:
        return QColor(val & 0x1 ? Qt::red : Qt::green);
        break;
    case Qt::EditRole:
        return QString::number(val);
        break;
    default:
        return QVariant();
    }
}

Since it is pretty easy to expose properties and functions to QML I guess this a good way to do it for know.
For completeness here an example ListView using my custom model:
ListView {
    anchors.fill: parent
    model: MyListModel { id: myModel }
    delegate: Text {
        text: model.display
    }

    Component.onCompleted: {
        console.log(myModel.count) // 5
        console.log(myModel.get(0)) // 1
    }
}

A: My approach is to expose objects' properties directly to QML. Here is its implementation -https://stackoverflow.com/a/14424517/1059494


text:
Q: Send latitude-longitude argument to Google Maps I have the following code:
function initialize(lat, lng) {
                    window.open("https://maps.google.com/?q=<lat>,<lng>");
                }

Can anyone tell me how to send the lat/lng arguments to Google Maps in the URL?
EDIT - Right now, the values being sent to Maps are "lat" and "lng", NOT their actual values such as 5 and 10. Can someone tell me how to send their actual values in the call to Maps?

A: Example
HTML:
<a href="#" class="map-btn" data-lat="41.8911684" data-lng="12.507724100000019"> Show Map </a>

JavaScript:
$(function(){
    $('.map-btn').click(function(event) {
      var lat = $(this).data('lat');
      var lng = $(this).data('lng');
      showMap(lat,lng);
    });
});

function showMap(lat,lng){
   var url = "https://maps.google.com/?q=" + lat + "," + lng;
   window.open(url);
}

JSFiddle


text:
Q: Layer Definition Query - Subqueries Background:
I want to track the movement of icebergs in ArcGIS. In my FileGeodatabase I have a single Iceberg layer. What I have thought of is to create an ID field for each object; each ArcGIS object that's the same iceberg will have the same ID. They also have a Date field to indicate when they've been observed.
Question:
I would like to only show the latest observation of each object (in ArcGIS terms, for each ID, show the OBJECTID with the latest date).
Using definition query, I've set the where clause to:
SELECT * FROM Icebergs WHERE:
Date = (SELECT MAX(Date) FROM Icebergs m WHERE m.ID = ID)

However no results are returned. Clicking verify shows that the query is syntactically correct. Is this subquery too complex for ArcGIS? Is Definition Query is the correct approach? If not, please point me in the right direction. Later I plan to do this using the Esri JS API, but am using ArcMap to debug the query itself.


text:
Q: Unable to make an APFS volume within an APFS container I'm using diskutil eraseDisk JHFS+ dummy /dev/disk0 and diskutil apfs create /dev/disk0s2 DiskSpace to create an APFS volume called DiskSpace within disk 0. However, I run into this error: error: -69624: Unable to add a new APFS Volume to an APFS Container. The end result in diskutil list is an APFS container with no APFS volumes. When I try to remake the volume, it usually crashes at the part where it creates a new volume. The APFS container is properly made, but the APFS volume never appears. Is there a reason why?

A: If you have an apfs container, the right terminal command to create a volume inside is
diskutil ap addvolume diskX apfs DiskSpace

Where diskX must be replaced by the container-id value diskX given in the diskutil list command.


text:
Q: How to copy a dynamic range of cell from another workbook, paste it to another one? I need to update my main file every time a third party sends me an updated version of his input.
Therefore, I need to copy-paste the range of this new input in a saved workbook on my computer. The range needs to include all columns and all rows if the value in column A is greater than 0.For example, in the picture below, from A1 to A45.

I found a way to select the rows and stop at the first zero. I've put a sumprodcut formula on the side that I call in my code i.
For now, I have this code:
I have an error on line wb1.Sheets("Accounts_latest").Range("A1:BW & i").Copy, I can't fix it... do you have any idea?
Let me know :)
Antoine
Sub CopyPaste()

    Dim wb1 As Workbook
    Dim wb2 As Workbook

    'Open Workbook from Pepper

    Set wb1 = Workbooks.Open("G:\Shared drives\Reporting\Power BI Source Files- DO NOT TOUCH\Pepper Automation\Accounts latest\Accounts updated\Accounts_latest.xlsx")

    'Copy Range (Column A to BW - all filled rows)
    Dim i As Integer
    i = Sheets("Accounts_latest").Range("CA1").Value
    wb1.Sheets("Accounts_latest").Range("A1:BW & i").Copy

    'Paste to worksheet in workbook2:
    Set wb2 = Workbooks("20200403 Selina - Loanbook V2.09 (1).xls")
    wb2.Activate
    wb2.Sheets("Pepper Accounts RAW").Range("A1:BW").PasteSpecial Paste:=xlPasteValues
    Range("A1").Select

    'Close workbook
    wb1.Close savechanges:=True
    Application.DisplayAlerts = True

End Sub

A: try this:
 wb1.Sheets("Accounts_latest").Range("A1:BW" & i).Copy

or
 wb1.Sheets("Accounts_latest").Range("A1","BW" & i).Copy

And
wb2.Sheets("Pepper Accounts RAW").Range("A1").PasteSpecial Paste:=xlPasteValues

Or
wb2.Sheets("Pepper Accounts RAW").Range("A1:BW" & i).PasteSpecial Paste:=xlPasteValues

or
wb2.Sheets("Pepper Accounts RAW").Range("A1").Resize(i,1).PasteSpecial Paste:=xlPasteValues


text:
Q: hamachi intranet connection I have a intranet website shared on my local network which displays tables from a sql database. I want to expand this to certain people who are not on my local network. Is it to use Hamachi to enable them to connect to my website? If not what is another way to make this possible?

A: Basicaly yes.
As soon as your Hamachi did create a working VPN they should be able to access your local webserver.
Another way would be to use an SSH tunnel to tunnel your local webserver port (80 by default) to the remote PCs (see here for Win, or here for Linux).
Or open/configure your firewall/router to redirect a special external port to your web server port (which would be the easiest to use, because no external configuration is necessary).


text:
Q: Firebase encrypt a push key to de-identify the relationship of 2 collections I want to de-identify my users from their other "records". What I have done so far is put the personal identifiable information in one collection and encrypt it's push key or uid using a secret-key (using crypto) to remove the pointer to the user's "records".
However, what I want to make sure that only the user could access his data. How do I do that with crypto?
User
users:{
    key1:{
       // personal identifiable info
    }
}

Encrypt key1 using a secret = some_hash
Other records
foo:{
    some_hash:{
        // other data
    }
}

If the user wants his data the server (nodejs) will again encrypt his key1 using the secret to create some_hash and use it to get the path to his data.
Is this secure enough? Thanks.


text:
Q: Catch Html5 video src on click play button My goal is to catch Html5 video src when i click on play button of that html5 video frame.How it possible in jquery?
<video src="video.ogv">
 video not supported
</video>

<script>
var video = document.getElementsByTagName('video')[0];
 video.onended = function(e) {
  /*Do things here!*/
};

$('video source').each(function(num,val){
console.log($(this).attr('src'));        // i am not getting this..
strSrc = $(this).attr('src');
strPath = strSrc.substring(0, strSrc.lastIndexOf('/'));
strExtenion = strSrc.substring(strSrc.lastIndexOf('.'));
$(this).attr('src', strPath + "/" + "newFileName" + strExtenion );
alert($(this).attr('src'));

})

A: Something  like :
   <video id='vids' src="video.ogv">
       video not supported
   </video>

   <input id='plyvid' type='button'  />

 <script>
$('#plyvid').click(function(){
 var vid = $('#vids');
 vid.get(0).play();
  var vidSrc =  vid.attr('src'); //Here you get the SRC

 });
  var video = document.getElementsByTagName('video')[0];
  video.onended = function(e) {

  alert($(video).attr('src')) ;// I am not tested this ..may it works for you.

  };
    </script>


text:
Q: Minimum bids in first-price auction Suppose there are two bidders $i=1,2$ who may either have a low valuation $V_L$ or a high valuation $V_H.$ Bidders do not know others' valuations. In a first-price auction, where ties are broken by coin-flip, what is the the minimum bids (i.e. the lowest bid in the support $\underline{b_i}$ in $[\underline{b_i},\overline{b_i}]$ for $i=1,2$) for the $V_L$ type bidder?

In these auctions, strategies are some probability over the domain $[\underline{b_i},\overline{b_i}]$ (i.e. a mixed strategy). My guess is that the support for both the $V_L$ type player is $0$, i.e. that $$[\underline{b_i},\overline{b_i}]=(0,V_L].$$ Furthermore, the probability of bidding close to $0$ is quite trivial, since the bidder's chance of winning is also close to $0$. However, my lecturer argues that the support $\underline{b_i}=V_L$ for both players, but this would not make bidding worthwhile for the $V_L$ type, since she would receive $0$ surplus.

A: Did you learn game theory? with a mixed strategy, all strategy must yield the same expected unity. If the strategy of lower type is over $[0,v_l]$, no one will bid $v_l$ since bidding $v_l$ will give 0, but bidding lower than $v_l$ gives more than 0 in expectation. In this way, you can show that any interval $[0,x < v_l] $cannot be the support. Only a single point can be a support. now any singel point less than $v_l$ cannot be a support. so $v_l$ is the only support.


text:
Q: Q React boilerplate how to remove .bin extension from the emitted .htaccess.bin file I'm using react boilerplate and when I run the build script "npm run build" npm executes the following command
webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout
This builds the application and emits all the files to the build folder.
I have an .htaccess file in my source now when the the app is build somewhere in the build process the .htaccess file gets a .bin extension and it is emitted as .htaccess.bin
how can I prevent the build process adding the .bin extension to the .htaccess file?

A: This answer was provided in github issue of react boilerplate. This issue has been fixed in the latest build of react-boilerplate.
Anyways, if you want to fix the issue, change the import of .htaccess in app.js to as follows

import 'file-loader?name=.htaccess!./.htaccess';

See the fixed app.js file in github repo of react boilerplate


text:
Q: Mysql with PHP - returning values from a database? Im following a video tutorial on mysql and php, and a certain line of code has me a bit confused:
    <?php

            $result = mysql_query("SELECT * FROM subjects", $connection);
                if(!$result){
                die("Database query failed: " .mysql_error());
                    }

                while($row = mysql_fetch_array($result)){
                echo $row["Menu_Name"]." ".$row["position"]."<br/>";
                    }
                    ?>

I want to really understand what this code is doing, so let me see if i got it straight. Basically, what it does on my screen is return the various items store in my table subjects and displays them in their position. It does this by returning them in two arrays, one is the [menu-name] which stores the text for each item and the other is [position] which stores the order in which they come out. So, my while loop goes through this array and outputs. But that's what I dont get. What does $row do and how does it manage to go though and loop through. I may be way off here and was hoping someone could shed some light on this.

A: mysql_query sends a MySQL query. mysql_query() sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified. mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
mysql_fetch_array fetches a result row as an associative array, a numeric array, or both. Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows.
One last thing if you want to know what's happening with a function try referring the documentation. It helps most of the time.
According to the question you have asked I guess you should go through the basic MYSQL and PHP lessons.

A: Those are not two arrays. That is one array which is Multi dimensional
while($row = mysql_fetch_array($result)){

When you run that line of code then it grabs one complete row from the list of your results and assigns it to an array named $row.  You can then give your Index names to get data from it just like you wrote
$row["Menu_Name"]

So Menu_Name is an index of an array $row containing some value which came from your database. Since this statement is present in a loop, it will loop through all the rows of your returned result and do the same for each of them

A: this line is retrieving table records, line by line. This is actually an array representing a table record.
    $row = mysql_fetch_array($result)

Now, this array in indexed by the table field names. Because your query is 'select *', it means that its retrieving all fields.
So,
$row["Menu_Name"]

has the value of the field 'Menu_Name' of the table 'subjects', for the current row.

A: SEE tutorial example http://www.devmanuals.com/tutorials/php/phpmysql/php-mysql-fetch-array-example.html.It may clear your doubt


text:
Q: How to store images in an array when image is on load I'm still new to Javascript. I have this array of images and all I want is to store it to a new array when it is onload. If it's not(onerror), it will not be stored to that new array. I already have this code wherein it shows new array that has thesame image values.
var myarray=[];

for (var i=0; i < imagesarray.length; i++) {

    var image = new Image();
    image.onload = function () {
        console.log("Image loaded !");
        myarray.push(image.src);
    }
    image.onerror = function () {

        console.log("Cannot load image");
    }
    image.src = imagesarray[i].photo;
}

console.log(myarray);

Please help. Thank you. :)

A: Thanks to Maurice Perry.
let image= new Image() works!
This solves my problem.


text:
Q: how to install flac support (flac libraries) to sox in Windows when I try to work on flac files I got
"no handler for file extension flac"
error. is there any way to solve this problem in windows.

A: This answer may be a bit late, but you want version 14.4.1a (available here). FLAC was disabled accidentally in 14.4.1 which is still the default on SourceForge.


text:
Q: What chipset options are available for engineering a new Android IoT device with long term support? I'm interested in modern chipsets for use in developing a custom IoT device that can run Android. There are many chipsets and SoC's available, but they seem to be targeting smartphone development. That means they typically are only available for a short time until they reach end of life.
My question is, are there any chipsets or SoC's out there that are meant to be around for a long time and run Android?
It must support these components, as an important consideration:

*

*Touch screen

*Cellular, WiFi and BT capabilities

*2x cameras

*Microphone

*Processing power sufficient to support a video call

*Run Android, minimum version 9.0


text:
Q: table attributes are not correct with bootstrap I created a table using the bootstrap table , but the fields are not correct
How can i fix them ?
Only the first one is correct

A:

"""<ngb-tab>
      <ng-template ngbTabTitle>
        Jahresplanung
      </ng-template>
      <ng-template ngbTabContent>

                        #

                    AT

                          EPL Pakete pm
                         ...

                            EPL DF
                            ...

                            EPL Stopps pm
                            ...

                            EPL Pakete pd

                            ...

                            EPL Stopps pm

                          ...

                            APL Pakete pm
                            <input size="3">
                            ...

                            APL KDF
                            <input size="3">
                            ...

                            APL Stopps pm
                           ...

                            APL Pakete pd

                            ...

                            APL Stopps pm
                           ...

                            Fahrzeuge
                            ...
                            <input size="3">

                            EPL Pakete pro FZG

                            ...

                            EPL Stopps pro FZG

                            ...

                            APL Pakete pro FZG

                           ...

                            APL Stopps pro FZG

                          ...

      </ng-template>
    </ngb-tab>


text:
Q: Replace specific elements (unique or duplicates) from a string in JS My code automatically search the string for /d+d/d+ elements (roll dices) and adds random number suffixes and stores them as elements in an array.
I want to create a new string with the new modified elements of my array.
(I don't want to split string in Array, replace the same elements with the other array in a brand new one and then join it to a string. I need to modify it and save it in a new string)
Example:
String changes through user input so if i have:
str = ' I roll 1d3 and 2d4+3 and 1d3 also 1d8 and 1d8 dice ';

then mydice(str) finds all dice names and produces a new array like that:
array = [ "1d3:[2]=2" , "2d4:[1,2]+3=6" , "1d3:[1]=1", "1d8:[7]=7", "1d8:[5]=5"] ;

Desired Output:
str = ' I roll 1d3:[2]=2 and 2d4:[1,2]+3=6 and 1d3:[1]=1 also 1d8:[7]=7 and 1d8:[5]=5 ';

A: Using only the two items you provide as input (the string and the array with ndn=(n) kind of words), you can proceed as follows:

let str = ' I roll 1d3 and 2d4+3 and 1d3 also 1d8 and 1d8 dice ';
let array = [ "1d3:[2]=2" , "2d4:[1,2]+3=6" , "1d3:[1]=1", "1d8:[7]=7", "1d8:[5]=5"];

let i = 0;
for (let item of array) {
    let find = item.replace(/:.*\]|=.*/g, "");
    i = str.indexOf(find, i);
    str = str.slice(0, i) + item + str.slice(i + find.length);
    i += item.length;
}

console.log(str);

It is assumed that the array is well-formed, i.e. that indeed those items were derived correctly from the string and all the string-parts before the equal sign (like "1d3") occur in the string.
Note that strings are immutable, so you cannot really mutate a string. The only way is to create a new string and assign it back to the same variable. But that is not mutation; that is assignment of a new string.

A: If I understood your requirements, I think your solution is overcomplicated. I'd suggest something like this:

const roll = dice => {
  const [num, max] = dice.split('d');
  let r = 0;
  for (let i = 0; i < num; i++) {
    r += Math.floor(Math.random() * max) + 1;
  }
  return r;
}

let output = input = 'I roll 1d3 and 2d4 and 1d3 also 1d8 and 1d8 dice';
const matches = input.match(/\d+d\d+/g);
const rolls = matches.map(dice => `${dice}=(${roll(dice)})`);

rolls.forEach(roll => {
  const [dice] = roll.split('=');
  output = output.replace(new RegExp(` ${dice} `), ` ${roll} `);
});

console.log('IN:', input)
console.log('OUT:', output);


text:
Q: Django CMS installer fails creating database I followed the tutorial presented in http://docs.django-cms.org/en/latest/introduction/install.html and it goes well until I want to create a project using djangocms -f -p . mysite then it is followed by these errors:
(venv) C:\Users\Akbar\Desktop\djangocmsTest\tutorial-project>djangocms -f -p . mysite
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
Dependencies installed
Creating the project
The installation has failed.

*****************************************************************

Check documentation at https://djangocms-installer.readthedocs.io

*****************************************************************

Traceback (most recent call last):
  File "c:\python\python37\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python\python37\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Akbar\Desktop\djangocmsTest\venv\Scripts\djangocms.exe\__main__.py", line 9, in <module>
  File "c:\users\akbar\desktop\djangocmstest\venv\lib\site-packages\djangocms_installer\main.py", line 44, in execute
    django.setup_database(config_data)
  File "c:\users\akbar\desktop\djangocmstest\venv\lib\site-packages\djangocms_installer\django\__init__.py", line 407, in setup_database
    command, env=env, stderr=subprocess.STDOUT
  File "c:\python\python37\Lib\subprocess.py", line 376, in check_output
    **kwargs).stdout
  File "c:\python\python37\Lib\subprocess.py", line 468, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['c:\\users\\akbar\\desktop\\djangocmstest\\venv\\scripts\\python.exe', '-W', 'ignore', 'manage.py', 'migrate']' returned non-zero exit status 1.

And as you see there is no questions to respond.


text:
Q: Stata: Use pwcompare after runmlwin I am running a multi-level model with interaction.
melogit outcome i.var1##i.var2 ||lev2:, or

I also tried using runmlwin as it is a lot faster.
runmlwin outcome i.var1##i.var2 cons,level2(lev2: cons) level1(_n:) nopause or  discrete(distribution(binomial) link(logit) denominator(cons))

The estimates are pretty much similar.
The problem is that I want to use pwcompare afterrunmlwin similar to the way I can use after melogit.
It is throwing an error. How can I achieve pairwise comparison?
Edited:
I was able to calculate contrast manually from e(b) table. However, I have an issue calculating confidence intervals. For a fixed-effect model, I can use e(V) to get a variance which can be used to get confidence bounds. However, if it's a random intercept model, I am unable to calculate variance. e.g. In the following example, I am trying to SE for (urban#1) vs (urban#0) similar to the output in pwcompare but to no avail.
. webuse bangladesh, clear
(Bangladesh Fertility Survey, 1989)

.
. gen children1 = 0 if inlist(children ,0,1)
(1,050 missing values generated)

.
. replace children1 = 1 if inlist(children ,2,3)
(1,050 real changes made)

.
. melogit c_use i.urban##i.children1  || district:

Fitting fixed-effects model:

Iteration 0:   log likelihood = -1258.2413
Iteration 1:   log likelihood = -1256.5543
Iteration 2:   log likelihood = -1256.5533
Iteration 3:   log likelihood = -1256.5533

Refining starting values:

Grid node 0:   log likelihood = -1248.2739

Fitting full model:

Iteration 0:   log likelihood = -1248.2739  (not concave)
Iteration 1:   log likelihood = -1236.1736
Iteration 2:   log likelihood = -1235.4412
Iteration 3:   log likelihood = -1235.4296
Iteration 4:   log likelihood = -1235.4296

Mixed-effects logistic regression               Number of obs     =      1,934
Group variable:        district                 Number of groups  =         60

                                                Obs per group:
                                                              min =          2
                                                              avg =       32.2
                                                              max =        118

Integration method: mvaghermite                 Integration pts.  =          7

                                                Wald chi2(3)      =      61.28
Log likelihood = -1235.4296                     Prob > chi2       =     0.0000
---------------------------------------------------------------------------------
          c_use |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
          urban |
         urban  |   .7510512   .1632623     4.60   0.000     .4310631    1.071039
    1.children1 |   .5938377   .1216843     4.88   0.000     .3553409    .8323344
                |
urban#children1 |
       urban#1  |  -.1030926   .2136775    -0.48   0.629    -.5218927    .3157076
                |
          _cons |  -1.049338    .114393    -9.17   0.000    -1.273545   -.8251322
----------------+----------------------------------------------------------------
district        |
      var(_cons)|   .2063726   .0705496                      .1056001    .4033108
---------------------------------------------------------------------------------
LR test vs. logistic model: chibar2(01) = 42.25       Prob >= chibar2 = 0.0000

.
. pwcompare i.urban##i.children1

Pairwise comparisons of marginal linear predictions

Margins      : asbalanced

-------------------------------------------------------------------------
                        |                                 Unadjusted
                        |   Contrast   Std. Err.     [95% Conf. Interval]
------------------------+------------------------------------------------
c_use                   |
                  urban |
        urban vs rural  |   .6995049   .1172543      .4696907    .9293191
                        |
              children1 |
                1 vs 0  |   .5422914   .1075603       .331477    .7531058
                        |
        urban#children1 |
(rural#1) vs (rural#0)  |   .5938377   .1216843      .3553409    .8323344
(urban#0) vs (rural#0)  |   .7510512   .1632623      .4310631    1.071039
(urban#1) vs (rural#0)  |   1.241796   .1639783      .9204047    1.563188
(urban#0) vs (rural#1)  |   .1572135   .1540996     -.1448162    .4592432
(urban#1) vs (rural#1)  |   .6479586   .1538558      .3464068    .9495104
(urban#1) vs (urban#0)  |   .4907451   .1765231      .1447661    .8367241
-------------------------------------------------------------------------

.
. mat list e(V)

symmetric e(V)[10,10]
                       c_use:         c_use:         c_use:         c_use:         c_use:         c_use:         c_use:         c_use:         c_use:             /:
                          0b.             1.            0b.             1.      0b.urban#      0b.urban#      1o.urban#       1.urban#                         var(
                       urban          urban      children1      children1   0b.children1   1o.children1   0b.children1    1.children1          _cons  _cons[dis~t])
        c_use:
     0b.urban              0
      1.urban              0      .02665456
 0b.children1              0              0              0
  1.children1              0      .00885747              0      .01480706
     0b.urban#
 0b.children1              0              0              0              0              0
     0b.urban#
 1o.children1              0              0              0              0              0              0
     1o.urban#
 0b.children1              0              0              0              0              0              0              0
      1.urban#
  1.children1              0     -.02432051              0     -.01465235              0              0              0      .04565806
        _cons              0     -.00890614              0     -.00901114              0              0              0      .00873016      .01308577
            /:
          var(
_cons[dis~t])              0     -.00073136              0       .0003903              0              0              0      .00039822      -.0009874      .00497724

.


text:
Q: Update only after all the checks are passed I want to update array of object only after all the checks are passed. I have array of object representing all the articles and other array of object all the available stock.
I want to check the if all the articles are in stock then only I want to update the stock array. Here is my code:
const articles = [{
    "id": "1",
    "quantity": "4"
}, {
    "id": "2",
    "quantity": "8"
}, {
    "id": "4",
    "quantity": "1"
}];

let stock = [
    {
      "id": "1",
      "stock": "6"
    },
    {
      "id": "2",
      "stock": "6"
    },
    {
      "id": "3",
      "stock": "2"
    },
    {
      "id": "4",
      "stock": "2"
    }
  ];

articles.map(article => {
  stock.map(item => {
    if(item.id === article.id){
      if(article.quantity <= item.stock){
        item.stock = item.stock - article.quantity;
      } else {
             console.log('error');
             throw error;
      }
    }
   });
 });

Problem with this solution is that it updates stock for id = 1 even though id = 2 is not enough. I am trying to check if all the articles are in stock are in enough quantity and update(minus) them in stock array. So in this case code will update stock array like this:
stock = [
    {
      "id": "1",
      "stock": "2"
    },
    {
      "id": "2",
      "stock": "6"
    },
    {
      "id": "3",
      "stock": "2"
    },
    {
      "id": "4",
      "stock": "2"
    }
  ];

Can someone suggest how can I fix this?

A: You can use Array.prototype.find(). Note: The snippet assumes that all articles have an "id" property, it doesn't check for "art_id".

const articles = [{
  "id": "1",
  "quantity": "4"
}, {
  "id": "2",
  "quantity": "8"
}, {
  "id": "4",
  "quantity": "1"
}];

let stock = [{
    "id": "1",
    "stock": "6"
  },
  {
    "id": "2",
    "stock": "6"
  },
  {
    "id": "3",
    "stock": "2"
  },
  {
    "id": "4",
    "stock": "2"
  }
];

// Use Array.prototype.some() to check for items that don't have enough stock
const haveEnough = !articles.some(article =>
  // Turns "1" into 1
  parseInt(
    // Find the stock with the same id as the article
    stock.find(stock => stock.id === article.id).stock
  ) <
  parseInt(article.quantity))

console.log(haveEnough)

You can then update the stock in
if (haveEnough) {
 // Do something
}

A: I am assuming that the art_id key in the articles array should be id.
Unfortunately you can't do it all in one loop and you will instead have to loop through all the articles first to find out if their stock is enough and then loop though them again to change the existing stock:
const articles = [
  {
    id: '1',
    quantity: '4',
  },
  {
    id: '2',
    quantity: '5',
  },
  {
    id: '4',
    quantity: '1',
  },
];

let stock = [
  {
    id: '1',
    stock: '6',
  },
  {
    id: '2',
    stock: '6',
  },
  {
    id: '3',
    stock: '2',
  },
  {
    id: '4',
    stock: '2',
  },
];

// Are there any articles that do not have enough stock
const outOfStockArticles = articles.find((article) => {
  const articleStock = stock.find((stock) => stock.id === article.id);
  return Number.parseInt(article.quantity) > Number.parseInt(articleStock.stock);
});

// If there are no out of stock articles - change existing stock values
if (!outOfStockArticles) {
  articles.forEach((article) => {
    const articleStock = stock.find((stock) => stock.id === article.id);
    articleStock.stock = Number.parseInt(articleStock.stock) - Number.parseInt(article.quantity);
  });
}

A: There is an inconsistency in your articles array, I suppose that every articles has an "art_id", and not some an "id" and some an "art_id".
You can simply find your article using the Array.prototype.find function, and then by the isAvailable function check that an article is present in the right quantity in the stock list.
Now you can use the Array.prototype.every function that do exactly what you want! It will return true only if every element of the array satisfy the condition, in our case the isAvailable function.
Here a simple fiddle:

const articles = [{
  "art_id": "1",
  "quantity": "4"
}, {
  "art_id": "2",
  "quantity": "8"
}, {
  "art_id": "4",
  "quantity": "1"
}];

const stock = [{
    "id": "1",
    "stock": "6"
  },
  {
    "id": "2",
    "stock": "6"
  },
  {
    "id": "3",
    "stock": "2"
  },
  {
    "id": "4",
    "stock": "2"
  }
];

const isAvaiable = (article) => {
  return stock.find(element => element.id === article.art_id).stock >= article.quantity;
}

if (articles.every(isAvaiable)) {
  console.log("I can update")
} else {
  console.log("I cannot update")
}


text:
Q: Help searching MYSQL database with a JOIN - possible self JOIN? In a View i have a table of users combining data from multiple database tables. The important tables are Users and Invitations. Im performing a join
LEFT JOIN invitations ON (users.id = invitations.invitee_id)

which gives me access to users.invitee_id, but i also have dynamic search parameters in my query and i cant search for an inviter by email because the inviter email is determined by using the invitee_id joined with the users table on user id.
How can search for the inviter by email?
heres the entire query
    ["SELECT users.id, users.login, users.email, invitations.inviter_id, FROM users
      LEFT JOIN invitations ON (users.id = invitations.invitee_id)
      WHERE (users.email LIKE ? OR users.id LIKE ? OR users.login LIKE ?)",
      "%#{params[:search]}%","%#{params[:search]}%","%#{params[:search]}%"]

schema
USERS: id, login, email
INVITATIONS: id, inviter_id, invitee_id

A: Join Users one more time
 .... LEFT JOIN users u2 ON (invitations.inviter_id = u2.user_id)
 WHERE ... AND u2.user_name =[your condition]


text:
Q: How to show week list for the specific date and week start from sunday I have week list dates logic from the specific date which returns following results.
12/05/2016 Monday
12/06/2016 Tuesday
12/07/2016 Wednesday
12/08/2016 Thursday
12/09/2016 Friday
12/10/2016 Saturday
12/11/2016 Sunday

Logic:
// set current date
$date = '12/08/2016';
// parse about any English textual datetime description into a Unix timestamp
$ts = strtotime($date);
// calculate the number of days since Monday
$dow = date('w', $ts);
$offset = $dow - 1;
if ($offset < 0) {
    $offset = 6;
}
// calculate timestamp for the Monday
$ts = $ts - $offset*86400;
// loop from Monday till Sunday
for ($i = 0; $i < 7; $i++, $ts += 86400){
    print date("m/d/Y l", $ts) . "\n";
    echo "<br>";
}

Currently getting days from Monday to Sunday but don't know how to start a week from Sunday?

A: Replace "1" with "0".
$offset = $dow - 0;


text:
Q: Why am I getting error 1118 here? In the code below I have several MovieClips that are all TheBeetle(). They are in another MovieClip called gamelevel and also pushed in an array called bArray. previously I have indexed them in the gamelevel but after the event listener is called I cannot index them anymore and receive the error "1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.". As the user clicks them, they die (and change the frame) and the dead body goes under other alive bodies, thats the reason I need to index them to 1 as they die. I understand what the error says but how can i do what i need to do?
The code works just fine but it wouldn't in the two lines i've mentioned in it, so take a look please:
public function clicked (event:MouseEvent)
    {
        if (event.target is TheBeetle && event.target.currentFrame <= 2)
        {
            var mc:Object = event.target

            // TheBeetle is actually a MovieClip but i cannot write: var mc:MovieClip = event.target, if i do i receive 1118

                if (mc.currentFrame == 1)
                {
                    mc.gotoAndStop (Math.floor(Math.random() * 3 + 4));
                }
                else
                {
                    mc.gotoAndStop (3);
                }
                mc.filters = null;

                // Here i need to index the TheBeetle as i did before like gamelevel.setChildIndex(mc,1) but i'd receive 1118!

                bArray.splice (bArray.indexOf(mc),1);

                if (bArray.length == 0)
                {
                    removeEventListener (Event.ENTER_FRAME,frameHandler);
                    waveTimer.removeEventListener (TimerEvent.TIMER_COMPLETE, changeLocation);
                }
        }
    }

A: You need to explicitly cast target to the MovieClip Class:
var mc:MovieClip = MovieClip(event.target);

You may need to do this BEFORE the line that checks target's currentFrame, as 'Object' doesn't have a currentFrame method.

A: I would recommend to use soft casting when you work with events and targets. By soft casting, if you have catched wrong target, you will not have problems - cast process simply returns null.
public function clicked (e:MouseEvent){
    var beetle: TheBeetle = e.target as TheBeetle;
    if(beetle != null && beetle.currentFrame <= 2){
        //Work with beetle as you want
    }
}


text:
Q: No 'post' object available in Octopress I just installed octopress as a blogging system and built my own little theme.
Everything works fine but there's one thing which isn't working yet.
Within a single post view, I don't seem to have a 'post' object. Which means that:

{{post.title}}

Generates an empty string. The blog index and the single post view are using the same article header. It's only the single post view where it doesn't work. The blog index works fine.
Does anybody of you know, which object is available for me in a single post view, or how I can access just the title of a post in a single post view?

A: The post object is created by the post loop and only available inside of the loop.

{% for post in paginator.posts %}

{{ post.title }}

{% endfor %}

When it comes to generating the page itself, you'll access page data with teh page object.

{{ page.title }}

That will get the title for the page currently being generated which is probably what you want to be doing.

A:
{{post.title}}
 is part of custom section?
If you want to add a section to your sidebar, create a new file in source/_includes/custom/asides/.
Whenever you add a section to the sidebar, follow this pattern, with a
 block and an
 for a title. To add it to the sidebar, edit the _config.yml and add it to the list of asides.
More info


text:
Q: JavaScript setAttribute dynamically I am trying to apply an event to a element dynamically to my application.
When I used onclick I get an alert to pop:
el.setAttribute('onclick', 'alert("hi")',0);

When I try to use the onkeypress nothing happens:
el.setAttribute('onkeypress', 'alert("Hi");',0);

I really need to have the onkeypress available.  Is there something that I'm doing incorrectly?  Is setAttribute not the best way to achieve what I'm doing?  If so what are my alternatives to dynamically setting an event on a specific element?
UPDATE:
To answer a few of the questions below when I do:
el.setAttribute('onkeypress','numericOverride(this)',0);

When I look at the source in Firebug I see the following:

4000.00

However, when I change the value of the text I get now output from this function:
function numericOverride(val){
        console.log('hello');
}

When I attempt to do the following:
el.onchange = function() { numericOverride(this) }

Nothing gets added to the div and I get no result from the function.

A: What is the type of element that you are trying to attach the event handler to? The onkeypress event is only supported by the following tags:
, <acronym>, <address>, <area>, , <bdo>, <big>,
, , <button>,

, , ,
, , <dfn>,
,
, , <fieldset>, <form>,

 to
,
, , <input>, , , <legend>,
, <map>, <object>,
,

,
, <q>, <samp>, <select>, , , , , ,
,

, , <textarea>,
, ,
,
, <tt>,
, <var>

http://www.w3schools.com/jsref/event_onkeypress.asp

A: Try this (its cross browser):
function keyPressHandler() { alert("Hi"); };

if (el.addEventListener) {
   el.addEventListener("keypress", keyPressHandler, true);
}
else if (el.attachEvent) {
   el.attachEvent("onkeypress", keyPressHandler);
}
else {
   el.onkeypress = keyPressHandler;
}

Demo (note jsfiddle doesn't play well in IE 7): http://jsfiddle.net/mrchief/BQxWp/2/
Tested in Chrome, FF5, IE7 (after retrying couple of times) and IE9.

A: you should set the event listener in the proper manner:
el.onkeypress = function() { alert("HI") }

A: Have you considered using event listeners ?
target.addEventListener("click", function() { alert("Hi"); })


text:
Q: Search for forbidden words in string I would like to detect a vulgar word in a string. I have a database of indecent words stored in .txt file. This file I put into my .py file.
Example bad word:
words = "word, something, dog, cat ...."

input data string are for example:
input = "xxxxdogxxx" or "dogxxxx" or "xxxdog" or "dog" "ok_word" # xxx == any word

and I want, when input contains the word in word return is False
def check(input):
    word = "something, something, ..."
    x = ???? # I do not know how to do it, probably using regular expressions: re.match?
    if x:
        return False
    else:
        return True

A: You actually do not need Regex for this.  You can use all and a generator expression:
def check(input):
    return all(x not in input for x in bad_words)

To make your string of words into a list, use str.split:
>>> words = "word, something, dog, cat"
>>> words.split(', ')
['word', 'something', 'dog', 'cat']
>>>

You might also want to call set() on the list to improve lookup times.  Sets have O(1) (constant) complexity with the in and not in operators while lists have O(n) (linear).  So, it is faster to find things in a set than it is with a list.


text:
Q: How do i use translate in the Controller using Zend? Usually i user translation in View with this code :
<?php echo $this->translate("hello"); ?>

How do i get a translation in the Controller?

A: If you're creating the zend_translate object in the bootstrap, you can set it in the Zend_Registry for later use:
Zend_Registry::set('translate', $translate);

and then use it in the controller:
$translate = Zend_Registry::get('translate');
$translate->translate("hello");

As far as I know, Zend_Controller doesn't include built-in support for zend_translate.

A: To use translation in the controller:
$this->view->translate('Something to translate');

Or create a translation action helper if you want to keep everything clean and pretty (although I don't think it's worth the trouble in this case).

A: Or using the service locator (ZF2):
$translator = $this->getServiceLocator()->get('translator');
$feed->setTitle($translator->translate('My RSS Feed'));


text:
Q: Angular firebase image saving before record saving to the database using concat I'm having issue in implementing the logic of saving image to firebase, getting back the url to the form img value and save the form value in the database, the issue is that while I get the form url updated correctly inside the firebase saving subscription, I get the same form url empty in the response of the second saving sub!
code:

  upload(): void {
    const file = this.selectedFiles.item(0);
    this.selectedFiles = undefined;
    let currentFileUpload = new FileUpload(file);

    this.pushedFile$ = this.service.pushFileToStorage(currentFileUpload).pipe(
      map(url => {
        this.service.form.patchValue({ img: url });
        console.log("inside upload:", this.service.form.value)
      })
    );
  }

  onSubmit() {

    this.upload();

    let save$ = this.service.save(this.service.form.value).pipe(map(data => console.log("save data: ", data) ));

    concat(this.pushedFile$, save$).subscribe((data => console.log("subscription: ", data)));
  }

  pushFileToStorage(fileUpload: FileUpload): Observable<any> {
    const filePath = `${this.basePath}/${fileUpload.file.name}`;
    const storageRef = this.firebaseStorage.ref(filePath);
    const uploadTask = this.firebaseStorage.upload(filePath, fileUpload.file);

    return <Observable<any>>uploadTask.snapshotChanges().pipe(
      last(),
      mergeMap(() => {
        return storageRef.getDownloadURL().pipe(
          map((url) => url)
        )
      })
    );
}

inspector output:
licons/v109/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2
abstract-form.component.ts:43 inside upload: {id: null, name: 'Sudan', nameAr: null, quantityPerUnit: null, img: 'https://firebasestorage.googleapis.com/v0/b/pos-ad…=media&token=960e9251-6ef8-4e01-8efa-a54745f9906f', …}averageCost: nullbarcode: nullcategory: nulldiscount: nullid: nullimg: "https://firebasestorage.googleapis.com/v0/b/pos-admin-f8a9f.appspot.com/o/products%2Fmaryam.jpg?alt=media&token=960e9251-6ef8-4e01-8efa-a54745f9906f"name: "Sudan"nameAr: nullquantity: nullquantityPerUnit: nullsellPrice: 11supplier: nullvatPercentage: nullvatValue: null[[Prototype]]: Object
abstract-form.component.ts:54 subscription:  undefined
abstract-form.component.ts:52 save data:  {id: 132, name: 'Sudan', nameAr: null, img: null, barcode: null, …}averageCost: nullbarcode: nullcategory: nulldepreciation: nulldiscount: nullid: 132img: nullname: "Sudan"nameAr: nullquantity: nullquantityPerUnit: nullsellPrice: 11supplier: nullvatPercentage: nullvatValue: null[[Prototype]]: Object
abstract-form.component.ts:54 subscription:  undefined

A: I managed to get it working using concatAll()
let pushedFile$ = this.service.pushFileToStorage(currentFileUpload).pipe(map(url => item["img"] = url));

let combined$ = of(pushedFile$, save$);

combined$.pipe(concatAll()).subscribe();


text:
Q: kafka consumer error - unable to connect to zookeeper I am trying to setup kafka for messaging service.
I am using kafka_2.9.2-0.8.1.1 version, I have started zookeeper, kafka and created a topic with no partition and replication factor.
Once I start my consumer, I get the following error
./kafka-console-consumer.sh --zookeeper localhost:9092 --topic test --from-beginning
Exception in thread "main" org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
    at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:880)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
    at kafka.consumer.ZookeeperConsumerConnector.connectZk(ZookeeperConsumerConnector.scala:156)
    at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:114)
    at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:128)
    at kafka.consumer.Consumer$.create(ConsumerConnector.scala:89)
    at kafka.consumer.console Consumer$.main(ConsoleConsumer.scala:178)
    at kafka.consumer.ConsoleConsumer.main(ConsoleConsumer.scala)

My zookeeper is running, I have ensured that by netstat command!!
Not sure what is going wrong here. Any inputs on this will be helpful

A: it should be --bootstrap-server and not --zookeeper

A: I have reinstalled the latest version of kafka which solved the issue. As per above comments i have tried every thing but no luck!!
I suspect the package was not downloaded properly!!
I will update the answer if i get to know the exact reason for the error.


text:
Q: Locally scoped CSS (child components) Is there a way to have locally scoped CSS where I don't need to add a tag to every sub-component?
For example, using css modules, I want to do something like:
import style from "./MyStyles.module.scss";

And then:

Where MyStyles.module.scss looks like:
.componentA {
    display: flex;
    flex-direction: column;

    img {
      width: 50px;
      height: 100px;
    }
}

While that works for .componentA, the styles aren't propogating to the img components. Is there a way to do this without having to add something like className={style.myImage} to every img component?


text: Q: Is it possible to write 0 into a variable in format string attack? I know that %n should be used when we try to overwrite the value of a variable in format string attack. Now I'm wondering whether 0 can be written into a variable in a similar manner. Can anyone give me some suggestions? Thanks.


text:
Q: Is it correct to say the "smooth curve fitted by LOESS"? I use the package scatter.smooth in R, and I want to have a figure text describing the line in the scatterplot for my report.
Is is okay to say "the line is a Smooth Curve Fitted by LOESS (a reference to the package)" or need I explain it more? (It's a software engineering master thesis)
Otherwise, how can I describe what the line is in one short sentence?

A: If you just say "loess" people probably won't know what you mean. Perhaps "locally weighted regression" is better? The R help description of loess in stats is

Fit a polynomial surface determined by one or more numerical
  predictors, using local fitting.

A: In a master's thesis, you should probably explain a bit what the method does. In addition, you should somewhere give the details (package, version, function name, parameters). This may be all in the text, or shortly in the text and full details in an appendix.
In papers, where text needs to be shorter, I e.g. say

Data analysis was performed in R [1] ... smoothing interpolation by function loess ...

*

*"smoothing interpolation" is closer to how I use loess mainly - for you locally weighted regession may be the better explanation.

*stats is one of the core R packages, so I don't spell it out. Other packages I give with citation.


text:
Q: ResourceEditor LWUIT NoClassDefFoundError: com/app/XMLMidlet: com/sun/lwuit/events/ActionListener I have developed  Rss App LWUIT Project using ResourceEditor.
I opened the project in Netbeans IDE, I followed the link at developers Nokia site Generating the NetBeans project in the Resource Editor - Adding GUI resource file manually into your project.
While running my application, I am facing Uncaught exception
 java/lang/NoClassDefFoundError: com/app/XMLMidlet: com/sun/lwuit/events/ActionListener

Could I do any extra thing?

A: copy the res file to your package folder,
then,
Display.init(this);
    try {
        Resources r = Resources.open("/resource.res");

        UIManager.getInstance().setThemeProps(r.getTheme(
            r.getThemeResourceNames()[0])
        );
    } catch (java.io.IOException e) {
    }


text:
Q: Conditional continuous probability on a fixed point I was asked to show the following statement:
Let $X, Y$ both be equally distributed random variables on $[0,1]$, we define
$$ P(\{Y \leq y\}|\{X=x\}) = \lim_{h \downarrow 0} P(\{Y \leq y\}|\{x \leq X \leq x+h \}).  $$
Show that
$$ P(\{Y \leq g(X) \}|\{X=x\}) = g(x)$$.
$$----$$
We haven't covered joint probability distribution functions yet. In the end I got stuck at evaluating
$$ P(\{Y \leq g(X)\} \cap \{x\leq X \leq x+h\})$$
Thanks!

A: When $X$ and $Y$ are independent and uniformly distributed on$[0,1]$, the probability of an event involving $X$ and $Y$ is the area of the region described by that event. If you draw out the region described by the event $\{Y \leq g(X)\} \cap \{x\leq X \leq x+h\}$, we see it is the area below the curve $y=g(x)$ between $x$ and $x+h$. Using the fact that that area is given by a certain integral, we get
$$
P(\{Y \leq g(X)\} \cap \{x\leq X \leq x+h\})=\int_x^{x+h}g(t)\,\mathrm dt\tag1
$$
Therefore,
$$
\lim_{h \downarrow 0} P(\{Y \leq y\}|\{x \leq X \leq x+h \})=\lim_{h\downarrow 0} \frac{P(\{Y \leq g(X)\} \cap \{x\leq X \leq x+h\})}{P(x\le X\le x+h)}=\frac1h\int_x^{x+h}g(t)\,\mathrm dt
$$
This fact that this limit equals $g(x)$ is a consequence of the fundamental theorem of calculus.

The only place where my argument lacks rigor is when I stated $(1)$. I am not sure how you are expected to justify this; it is a pretty low-level measure theoretic result.

A: For $x \in [0, 1]$, we have
$$P(Y \leq g(X) \mid X = x) = P(Y \leq g(x) \mid X = x).$$
Assuming $X$ and $Y$ are independent, we can say further that $P(Y \leq g(x) \mid X = x) = P(Y \leq g(x))$, so
$$P(Y \leq g(X) \mid X = x) = P(Y \leq g(x)).$$
Now, assuming that $Y$ is uniformly distributed on $[0, 1]$, we get
$$P(Y \leq g(X) \mid X = x) = P(Y \leq g(x)) = g(x).$$
Edit: Here is the approach computing the limit $\lim_{h \to 0}P(Y \leq g(X) \mid x_0 \leq X \leq x_0 + h)$ directly:
\begin{align}
P(Y \leq g(X), x_0 \leq X \leq x_0 + h) &= \int_{0}^{1}\int_{0}^{1}I(y \leq g(x), x_0 \leq x \leq x_0 + h)\,dy\,dx \\
&= \int_{x_0}^{x_0 + h}\int_{0}^{1}I(y \leq g(x))\,dy\,dx \\
&= \int_{x_0}^{x_0 + h}g(x)\,dx,
\end{align}
and
$$P(x_0 \leq X \leq x_0 + h) = h.$$
So
$$\lim_{h \to 0}P(Y \leq g(X) \mid x_0 \leq X \leq x_0 + h) = \lim_{h \to 0}\frac{1}{h}\int_{x_0}^{x_0 + h}g(x)\,dx = g(x_0)$$
assuming $g$ is continuous at $x_0$.


text:
Q: Cursor near object detection I have the following html:

The menu-wrapper's height is +20px, that's the extra space I'm 'detecting' the motion on.
Goal: Menu has to show up when cursor is near the menu (not over it).
Problem: Everything is working great, except I can't click/interact with the content that is under the menu-container (the extra 20px space).
Any suggestions? Thanks!

A: You can achieve the same without javascript by doing the following:
#menu-container {
  width: 100%;
  height: 40px;
  padding: 20px;
}

#menu-container:hover .menu {
  margin-top: 0px; // visible
}

.menu{
  border: 1px solid black;
  width: 300px;
  height: 20px;

  margin-top: -100px; // hidden
}

Preview here: http://codepen.io/anon/pen/KwRJoQ


text:
Q: CSS max-width text sizing issues I have an accordion style header which I need to align an absolute positioned icon next too. I can easily do this currently by setting the icon to absolute and the H3 title to relative and aligning it negative to the right.
The issue I am having is that my text has a max-width on mobile to stop it hitting the button aligned to the right leaving room for the icon. When the text hits this icon it spans 2 lines but the max-wisth means that my icon is no longer aligned with the text. Does anyone know any workarounds for this to align it neatly to the text
Example
See the image below for how the multiline header spans 2 lines and the max width puts the icon at the very end

annotated image

Code
CSS
h3 {
    margin-bottom: 0;
    display: inline-block;
    padding: 0;
    font-weight: 800 !important;
    color: #211850 !important;
    font-size: 17px !important;
    line-height: 25px;
    font-size: 15px;
    max-width: calc(50% - 19px);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.fa-question-circle-o {
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%);
    margin-left: 0;
}

HTML

    {{ agreement.sectionName }}

A: One way of handling this is to use width: min-content which will set the width to the minimum required to display all the content.
(Note: in the snippet, I had to add quite a bit of HTML and CSS to make it look like your screenshots; it would have been better if you'd have posted a Minimal, Complete, and Verifiable example).

section {
  width: 290px;
  height: 61px;
  position: relative;
  background: #eaeaea;
  border-radius: .5em;
  margin: .5em;
}

h3 {
  margin: 0;
  display: inline-block;
  padding: 0;
  font-weight: 800 !important;
  color: #211850 !important;
  font-size: 17px !important;
  line-height: 25px;
  font-size: 15px;
  max-width: calc(50% - 19px);
  position: absolute;
  left:0; top: 50%;
  transform: translateY(-50%);
  /* debug */
  outline: 2px solid red;
  /* solution */
  width: min-intrinsic;         /* old Safari */
  width: -moz-min-content;      /* Firefox */
  width: -webkit-min-content;   /* old Chrome */
  width: min-content;           /* modern browsers */
}

.fa-question-circle-o {
  position: absolute;
  top: 50%;
  right: -25px;
  transform: translateY(-50%);
  margin-left: 2px;
}

/* emulate FA */
.fa-question-circle-o::after {
  font-style: normal;
  content: '?';
  border: 2px solid;
  border-radius: 100%;
  display: inline-block;
  width: 1em;
  line-height: 1em;
  text-align: center;
  color:#969696;
}

    Test

    Testing

    Testing multiline

Warnings:

*

*This doesn't work in IE and Edge. If you need to support those, this solution is out

*The width of the h3 will become the minimum required to display all the content; which may not be what you want. Change the content of the first one from "Test" to "X Y Z" to see what I mean.


text:
Q: What control is Apple using here? (screenshot included) UIButton? UITableViewCell? Something else? This is a really stupid but very simple question. I know it is. Please don't tell me that I should have googled first. I did, a lot. I just need someone to point me in the right direction and I can take it from there. Ok, with that out of the way...
What control is Apple using in its Settings, Contacts and Calendar app that looks like a Round Rect button (and you can click on it), but has text aligned to the left (but not all the way to the left; there is a margin) and text aligned to the right at the same time? In most cases it also has a little arrow (or greather than symbol) on the right side, signifying that it will slide in another ViewController from the right when you click it. Is it a UIBUtton? A clickable UITableViewCell? (If so, what is the UITableViewCell hosted in?) It's so ubiquitous in Apple's built-in apps that I'm really astounded that I can't find an example of how to reproduce it. I'm trying to not re-invent the wheel here; there must be some tutorial/example out there that I just haven't been able to find. Or maybe it's a separate control that's right there in XCode and I'm just overlooking it. A link with a very brief conceptual overview would be greatly appreciated.

A: Yes, I am pretty sure it's a table view set to grouped. Check out the following related stack-overflow question:
How to create a iPhone Settings-like view
The main thing to do is setting the table to grouped by the looks of things.

A: It is a grouped UITableView. You can see a description of this table style in the following Apple page: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html#//apple_ref/doc/uid/TP40007451-CH3-SW1

A: These are UITableViewCells of a Grouped Tableview that have been customized as per the need. There are some sample codes available for making similar cells as used in iPhone settings :

*

*InAppSettings

*InAppSettingsKit
Hope it helps you.


text:
Q: AWS Lambda resetting the whole script after a few API calls I have deployed an AWS Lambda package which interprets trading alerts from tradingview.com.
These alerts are sent to the server at intervals ranging from subhour to a few hours inbetween.
I have a trade log in my application which keeps track of state and other pieces of data.
This trade log gets reset after period of time and i do not know why. My guess is that this happens because the whole script gets reset.
Why is this happening?

A: Your lambda function runs in a temporary environment when its invoked:

When a Lambda function is invoked, AWS Lambda launches an execution context based on the configuration settings you provide. The execution context is a temporary runtime environment that initializes any external dependencies of your Lambda function code, such as database connections or HTTP endpoints.

What's more, the lambda will keep your temporary environment for some time. It is often not reset after each invitation:

After a Lambda function is executed, AWS Lambda maintains the execution context for some time in anticipation of another Lambda function invocation.

Most importantly,you can't rely on it for keeping persistent data between invocation:

When you write your Lambda function code, do not assume that AWS Lambda automatically reuses the execution context for subsequent function invocations.

For persistent storage of data, such as your trade logs, you have to use external data store. Often, for this DynamoDB is used, but can be ElastiCache, RDS, S3 and more.


text:
Q: CodenameOne Changing font size (lumia) The following code doesn't give an exception under iOS, however it gives a nullpointer exception under the Lumia skin. I am wondering how I can change the fontsize under Windows Phone.
    score = new Label("Score");
    score.getStyle().getFont().derive(50, 0);

A: The code doesn't really do anything. Font can be null so you will get that exception, however since derive just generates a new font object which you aren't putting anywhere this won't do anything.
You are also using getStyle() which will work in the case of Label but you should normally use getUnselectedStyle()/getSelectedStyle().
To increase font size define a TTF file in the designer and define its size for a specific UIID then use the setUIID method to define the style for the component.


text:
Q: Box of Grade A's? On an episode of Seinfeld, Kramer says
"they ambushed me with a box of grade A's".

What is that?
I was unable to find a translation to that.

A: This is explained by a line later in the episode:
Kramer: Well, that's odd, 'cause I feel perfectly at peace with the world- uh! eggs! you! Serenity now, serenity now, serenity now.
Someone threw eggs at Kramer. Eggs are often labeled "Grade A" as an indication that they are high quality.

A: To ambush someone is to attack them from a concealed position, to trap, to surprise.
Grade A describes something of the highest quality.
What was in the box was of good quality, and it probably made the ambush better.


text:
Q: Trigger GitHub Actions workflow on all branches except when identical (after merge)? How can I setup a GitHub Actions workflow to trigger when all branches are pushed, but only execute once if two branches are identical?
I have a git-flow-like workflow in my repo where there's a develop branch and release-specific branches. When I'm finished with a release, I merge it into develop and master
user@buskill:~repo$ git branch -l
  dev
  master
* v1.0.0
user@buskill:~repo$ git commit -am 'finished'
user@buskill:~repo$ git checkout develop
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
user@buskill:~repo$ git merge v1.0.0
...
user@buskill:~repo$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
user@buskill:~repo$ git merge v1.0.0
...
user@buskill:~repo$ git push

If I setup my app build CI process to trigger on pushes to all branches (which is what I want)
name: build

on:
  push
...

Then the above push results in three distinct jobs being executed. This, in fact, is wasteful since the merge means that all three branches are exactly the same so the builds will all produce exactly the same results.
Is it possible to setup a github workflow to trigger on pushes for all branches, except only execute once when pushing to multiple branches with identical contents?


text:
Q: fixed menu width - items distribution I have list menu

item1

item2

longitem3

menu css
ul{
width:500px;
}
li {
float:left;
}

i would like to automatically distribute my items in menu so they would have the same space between them like this
{menu}{item}{space}{item}{space}{item}{menu}
is it possible to do this using only html and css, not javascript? Thanks

A: I would use a css class rather than affecting all the
, like this:

As for the css:
.menuItem {
    float: left;
    margin-right: <some number of px>;
}
.menuItem:last-child {
    margin-right: 0;
}

The ':last-child' selector overrides the previous definition and removes the right space for the last menu item.

A: You can add a margin to the right side of your li's
li { float:left; margin-right: 5px}

A: Just add some padding to the right of each li item, e.g.
li {
float:left;
padding-right:20px;
}

A: ul {
    text-align: center;
}

li {
    display: inline-block;
}


text:
Q: Which software should be installed as root and which shouldn't? Currently I install everything as root,but just for fun.
What's the standard for doing this in linux environment?

A: The vast majority of the linux software is installed in directories such as /usr/bin and /etc where only root has (and should have!) write permission. Users can install (some) applications in the own home directory and run them from there. These applications are not autmatically added to the path of other users, and therefor not directly availible

A: Everything that should be available to all users or installs to a public place should be installed by root. Everything else can be installed by a normal user.

A: Most applications are designed to run as a non-root user anyway, so it is not really a requirement to install everything as root. In fact there are very few technical reasons why something should be installed by root. It is mostly convenience and traditions. As others said, most packages install in places like /usr, /lib or other restricted places.
It is probably easy to create an "installer" user that can run a handful of commands via sudo to manage most installations.


text:
Q: How do I set up Robolectric in IntelliJ? I know there are instructions here, but they are not clear to me at all. I have an existing project that's built using ANT, so I'm not Mavenized, and I'm not starting from scratch. An awesome tutorial with screenshots would be great, as I'm sure I'm not the only one who has had problems with this.

A: The only thing you can really do is to look at Pivotal's AndroidIntelliJStarter project, and mimick what they are doing. This is what I had to do to get my project setup.


text:
Q: Get the value between <> with dynamic number inside it I am working on a text summarization method ,for test my method i have a benchmark called doc 2007 ,inside this benchmark i have a lot of xml file ,i should clear that file .
for example i have a xml file like this:
<sentence id='s0'>
 The nature of the proceeding

1 The principal issue in this proceeding is whether the Victorian Arts Centre falls within the category of 'premises of State Government Departments and Instrumentalities', for the purposes of provisions in industrial awards relating to rates of payment for persons employed in cleaning those premises.</sentence>

<sentence id='s1'>In turn, this depends upon whether the Victorian Arts Centre Trust, a statutory corporation established by the Victorian Arts Centre Act 1979 (Vic) ('the VAC Act'), is properly described as a State Government department or instrumentality, for the purposes of the award provisions.</sentence>
;

I should extract the string between <sentence id='s0'></sentence> and <sentence id='s1'></sentence> I mean the result should be like this :
The nature of the proceeding

     1 The principal issue in this proceeding is whether the Victorian Arts Centre falls within the category of 'premises of State Government Departments and Instrumentalities', for the purposes of provisions in industrial awards relating to rates of payment for persons employed in cleaning those premises.

In turn, this depends upon whether the Victorian Arts Centre Trust, a statutory corporation established by the Victorian Arts Centre Act 1979 (Vic) ('the VAC Act'), is properly described as a State Government department or instrumentality, for the purposes of the award provisions.

I found some thing like this :
Regex.Match("User name (sales)", @"\(([^)]*)\)").Groups[1].Value

using Regex,but it doesn't work .could you please give me a fast solution to do that?

A: Using LINQ to XML should be easier:
var res = XElement.Parse(xml)
                  .Descendants("sentence").Where(e => e.Attribute("id").Value == "s0")
                  .FirstOrDefault().Value;

or, as Yeldar suggested, the cleaner way would be:
var s0 = XElement.Parse(xml)
                 .Descendants("sentence").FirstOrDefault(e => e.Attribute("id").Value == "s0")
                 .Value;

A: XElment.Parse only use in String with single root node. The instance you wrote have two nodes '' without one root node.
You can add a root node like below:
xml = "<root>" + xml + "</root>";


text:
Q: android - recycle adapter not appearing in the view pager I have a tablayout in ProfileActivity. And one of the tablayout will display recycleview of userlist that I retrieve from database using asynctask. I use getter method to return the userlist from asynctask class
My recycleview is in activity_user_view.xml and I set the adapter in the class that extends the fragments. I got no error however the tablayout doesn't appear in the view pager.
Here is my code
FragmentFriends.java (class that extends fragment)
public class FragmentFriends extends Fragment {
ArrayList<UserList> aList = new ArrayList<>();
RecyclerView recyclerView;
RecyclerView.Adapter adapter;
RecyclerView.LayoutManager layoutManager;
@Nullable
@Override

public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootview = inflater.inflate(R.layout.activity_user_view,container,false);// The activity that contains recyclerview

    PHPUserList phpUserList = new PHPUserList(getActivity());
    phpUserList.execute();
    aList = phpUserList.getArrayList();
    recyclerView = (RecyclerView) rootview.findViewById(R.id.RVUserList);
    layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    adapter = new RecyclerAdapter(aList);
    recyclerView.setAdapter(adapter);

    return rootview;
}

}

PHPUserList.java (asynctask class)
public class PHPUserList extends AsyncTask<Void,UserList,Void> {

private Context context;
ArrayList<UserList> arrayList = new ArrayList<>();

PHPUserList(Context ctx){

    this.context = ctx;
}
@Override
protected Void doInBackground(Void... params) {
    try {
        URL url = new URL("http://njtwicomp.pe.hu/listuser.php");
        HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
        InputStream inputStream = httpURLConnection.getInputStream();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        StringBuilder stringBuilder = new StringBuilder();
        String line;

        while ((line = bufferedReader.readLine())!=null)
        {
            stringBuilder.append(line+"\n");
        }

        httpURLConnection.disconnect();
        String json_string = stringBuilder.toString().trim();
        JSONObject jsonObject = new JSONObject(json_string);
        JSONArray jsonArray = jsonObject.getJSONArray("server_response");
        int count = 0;
        while(count<jsonArray.length()){
            JSONObject JO = jsonArray.getJSONObject(count);
            count++;
            UserList userList = new UserList(JO.getString("Name"),JO.getString("Username"));
            publishProgress(userList);
        }
        Log.d("JSON STRING", json_string);

    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
}

@Override
protected void onPreExecute() {
    super.onPreExecute();
}

@Override
protected void onProgressUpdate(UserList... values) {
    arrayList.add(values[0]);
}

@Override
protected void onPostExecute(Void aVoid) {
    super.onPostExecute(aVoid);
}

public ArrayList<UserList> getArrayList() {
    return arrayList;
}
}

Please help me

A: When items are added to a recycler view or a list view you need to notify the adapter that these changes have occurred which you aren't doing.
In onProgressUpdate you'd want to call adapter.notifyItemInserted(position) to tell the RecyclerView to refresh. To do this you'd need a callback or a listener in your AsyncTask because it doesn't have a reference to your adapter, and it shouldn't.
See here for all the notify calls you have the ability to use: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html


text:
Q: vuejs doesn't load images in the path like /somepage/id In my app i have several routes like:

*

*/

*/login

*/event/id

On login page i have the image that loads well -

all my images are in public/img folder.
On Event/id page i have the image that isn't loaded -
In devtools i get a strange url for this image : http://localhost:8080/event/img/event-img.jpg
but the correct path should be http://localhost:8080/img/event-img.jpg.
I don't know why but vuejs adds /event/ string in the path.  But for Login page VueJs doesn't do that.
Please give an advice.

A: To further elabourate on my comment, you simply need to use the root URL, i.e. starting with a / character. So, your src attribute should be updated as such:

The reason why this works is because when you're building your Vue CLI app, everything in the public folder is accessible via the root URL. Therefore, a URL relative to the root, instead of to the current page URL, is needed.