text:
Q: Get list of maven dependencies of org.apache.maven.project.MavenProject I'm trying to get a list of dependencies of some maven artifacts using org.apache.maven.project.MavenProject.
My code is like this.
public List<Dependencies> loadProject() {
    Model mavenModel = new Model();
    mavenModel.setModelVersion("4.0.0");
    mavenModel.setGroupId("org");
    mavenModel.setArtifactId("wso2");
    mavenModel.setVersion("1.0.0");

    addDependency(mavenModel, "com.google.inject", "guice", "4.2.2");
    addDependency(mavenModel, "ch.qos.logback", "logback-classic", "1.2.3");

    MavenProject mavenProject = new MavenProject(mavenModel);

    //******* Need to resolve dependencies of `mavenProject` and *******
    //******* get the list of dependencies of this project.    *******

    return dependencies;
}

private static void addDependency(Model mavenModel, String groupId, String artifactId, String version) {

Dependency dependency = new Dependency();
    dependency.setGroupId(groupId);
    dependency.setArtifactId(artifactId);
    dependency.setVersion(version);
    mavenModel.addDependency(dependency);
}

Basically I'm trying to get the dependency tree results which returns by mvn dependency:tree command as a list by programmatically.
Example
For the artifacts:

*

*com.google.inject:guide:4.2.2

*ch.qos.logback:logback-classic:1.2.3
Dependency list:
List = [
com.google.inject:guice:jar:4.2.2:compile,
javax.inject:javax.inject:jar:1:compile,
aopalliance:aopalliance:jar:1.0:compile,
com.google.guava:guava:jar:25.1-android:compile,
com.google.code.findbugs:jsr305:jar:3.0.2:compile,
org.checkerframework:checker-compat-qual:jar:2.0.0:compile,
com.google.errorprone:error_prone_annotations:jar:2.1.3:compile,
com.google.j2objc:j2objc-annotations:jar:1.1:compile,
org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile,
ch.qos.logback:logback-classic:jar:1.2.3:compile,
ch.qos.logback:logback-core:jar:1.2.3:compile,
org.slf4j:slf4j-api:jar:1.7.25:compile
]

A: You can use the method public Set<Artifact> getArtifacts() of your MavenProject class which returns a set of artifacts representing all dependencies that the project has, including transitive ones.
NB: Contents are lazily populated, so depending on what phases have run dependencies in some scopes won't be included. eg. if only compile phase has run, dependencies with scope test won't be included.
All the information are coming from the documentation that you can find here.


text:
Q: Receiving FlexEvent.SHOW events in a ViewStack's grandchildren The direct children of a ViewStack receive a FlexEvent.SHOW once the respective child view is shown. Unfortunately, the event information is lost at deeper child levels so that the grandchildren of the ViewStack do not receive the SHOW event.
Which approach would be advisable to tap into the SHOW events received by a ViewStack's direct children from a grandchild or grand-grand-child?
Using parent.parent.[...].addEventListener(FlexEvent.SHOW, [...]) would be possible, of course, but is kind of ugly as it will break as soon as the number of hierarchy levels between the two components changes.
Are there other events that are better suited?
The background of my question is that I would like to reload the grandchildren's content when it becomes visible again.

A: You could listen for the ADDED_TO_STAGE event in the grandchild view and find out if you're part of a view stack. If yes, then just listen to the view stack child's show/hide events.
... addedToStage="setMeUpForViewStack()" ...

Which is:
private var vsView:UIComponent = null;

private function setMeUpForViewStack():void
{
  if (vsView) {
    vsView.removeEventListener("show", vsViewShowHideHandler);
    vsView.removeEventListener("hide", vsViewShowHideHandler);
    vsView = null;
  }

  var obj:DisplayObject = this;
  while (obj.parent != obj) {
    if (obj.parent is ViewStack) {
      vsView = obj;
      break;
    }

    obj = obj.parent;
  }

  if (vsView) {
    vsView.addEventListener("show", vsViewShowHideHandler, false, 0, true);
    vsView.addEventListener("hide", vsViewShowHideHandler, false, 0, true);
  }
}

And in your vsViewShowHideHandler you would reload the content (if the view is visible).
Basically this frees your from worrying about the level of nesting. It doesn't work with multiple nested view stacks though.
In the REMOVED_FROM_STAGE event handler you would forget vsView.

A: Although burying down into the viewstack would work I agree this is ugly and potentially can lead to headaches as soon as something changes.
A different approach could be to implement a global event dispatcher.
By having a static event dispatcher in a class, the grandchildren could subscribe to events from the static dispatcher from anwywhere within the application.
When the parent hears the FlexEvent.Show the handler could dispatch a custom event using the global dispatcher?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Send encrypted and signed email using C# I want to send an encrypted and signed mail without using any third-party API.
If I send only the alternate view with the signature, Windows Mail can validate it. If I send only with alternate view with encrypted data, Windows Mail can decipher it. But if I send both, Windows Mail gets 2 attachements. If I sign the encryptedBytes and add those signed bytes to the alternative view it only validates the signature and the message is empty.
Any idea?
MailMessage message = new MailMessage();
message.From = new MailAddress(lblMail.Text);
message.Subject = txtSubject.Text;

string body = "Content-Type: text/plain\r\nContent-Transfer-Encoding: 7Bit\r\n\r\n" + structForm();

byte[] messageData = Encoding.ASCII.GetBytes(body);
ContentInfo content = new ContentInfo(messageData);
EnvelopedCms envelopedCms = new EnvelopedCms(content);

message.To.Add(new MailAddress(provMail));

CmsRecipient recipient = new CmsRecipient(SubjectIdentifierType.SubjectKeyIdentifier, this.certificate);
envelopedCms.Encrypt(recipient);

byte[] encryptedBytes = envelopedCms.Encode();

SignedCms Cms = new SignedCms(new ContentInfo(encryptedBytes));
CmsSigner Signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, new X509Certificate2(@"c:\serv.pfx","123"));

Cms.ComputeSignature(Signer);
byte[] SignedBytes = Cms.Encode();

MemoryStream encryptedStream = new MemoryStream(encryptedBytes);
AlternateView encryptedView = new AlternateView(encryptedStream, "application/pkcs7-mime; smime-type=signed--data;name=smime.p7m");
message.AlternateViews.Add(encryptedView);
MemoryStream signedStream = new MemoryStream(SignedBytes);
AlternateView signedView = new AlternateView(signedStream, "application/pkcs7-mime; smime-type=signed-data;name=sig.p7m");
message.AlternateViews.Add(signedView);

System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("emailaddress@xpto.com", "XXXXXX");
SmtpClient client = new SmtpClient("smtp.xpto.com");

client.UseDefaultCredentials = false;
client.Credentials = SMTPUserInfo;

client.Send(message);

Label2.Text = "Assinado e cifrado!";

A: You should sign first, then encrypt.
While the original CMS and S/MIME specifications allow you to do the operations in either order, later work pointed out that signing a document that you can't read is a really bad idea. The signature should be over the plain-text.

The resulting MIME message should only have a single part, which should be S/MIME enveloped-data. Your message has two parts, and the encrypted part is mis-labeled with a signed-data content-type. Create and sign the SignedCms object. Encode it, and use the encoded value as the content of an EnvelopedCms object. Encrypt that, and use its encoded value as the content of your MailMessage, with a content type of "application/pkcs7-mime; smime-type=enveloped-data".


text:
Q: Best console based text editor not only for programmers I need console based text editor for writing both source codes and human readable texts such as emails.
I need it to be user friendly. It mean for me:

*

*You can use it the same way as the notepad or gedit.

*You can use mouse there.

*If you need your mother of girlfriend or somebody to edit your text they will know what to do, they will not realize it is a console and will have only a feeling it is something like a notepad.

*copy, paste, undo works as usual with usual key combinations (Ctrl-C, Ctrl-V, Ctrl-Z).

*shift and arrows works as usual. They select the text.

And when I return to the computer I want to use the text editor for programming. I expect:

*

*Syntax highliting

*auto indenting

*replacing spaces with tabs

*keyboard shortcuts for compiling

*possibility to configure it to use a debugger

*autocompletions for c#, java, c++ and other languages

*other things I expect from IDE's.

I was working and configuring vim for a few years. But It never fulfilled all of my expectations (but it almost did).
I thing I could get vim configured perfectly if I had few more weeks time for configurating it. Unfortunately I cannot afford to be configuring vim forever.
Is there other alternative? Hopefully some editor I once set up and it will works forever?
What do you use? I often hear people are using emacs. Is it worth learning?

A: Cream is based on Vim, but not for the hard-core users. As it's just a set of vim scripts, it should work in the console, though I've never tried it.

A: I would suggest GNU nano as it is simple and supports syntax highlighting.
Screenshot from nano's Wikipedia page:.


text:
Q: Javascript: Using a function with rows I have a table of data being produced with JavaScript.  At the end of each row is an image, which is clickable.  When clicked, a popup appears containing information based on the row.
I am using the second example on here: http://www.abidibo.net/projects/js/moopopup/demo
Basically, how I have it setup now is this:
The function;
    function popup() {

    var mp_instance = new moopopup({
        overlay: true,
        title: 'Copy server address',
        html_node: 'mynode',
    });
    mp_instance.display();
}

make the popup, appear, using a div which is initially hidden

Content.

The image then uses onclick to make the popup run.
onclick='popup();'

Now this works with static data, however each row has different content I want to put in to the popup.  So i'm confused about how I would make each popup individual to the row, without creating loads of functions with an ID on the end, which basically all do the same thing.
http://www2.lethal-zone.eu/servers/tf2-servers
The image at the end of each row; when clicked shows some extra content...

A: You generally would want to pass some information to the one function as parameters and then use those parameters to choose the content. For example, pass some ID to the function:
onclick="popup(1);"

function popup(id) {
    // do something with id to choose the content
    // snip...
}


text:
Q: How To Count Rows But Based On Another Column? I have this table :
+--------------+-----------------------------+----------------+
| Username     | Message                     | Status         |
+--------------+-----------------------------+----------------+
| jamesbond    | I need some help            | SendingOK      |
| jamesbond    | I need some help            | SendingOK      |
| jamesbond    | I need some help            | SendingFailed  |
| jamesbond    | Mission accomplished        | SendingOK      |
+--------------+-----------------------------+----------------+

produced by this SQL syntax :
SELECT A.Username, A.Message, B.Status
FROM db1.SmsBroadcast as A
INNER JOIN db2.sentitems as B
ON A.MessageSMS1 = B.TextDecoded
WHERE A.Username = 'jamesbond'
GROUP BY Message, Status

now how to have this output?
+--------------+-----------------------------+-----------+---------------+
| Username     | Message                     | SendingOK | SendingFailed |
+--------------+-----------------------------+-----------+---------------+
| jamesbond    | I need some help            | 2         | 1             |
| jamesbond    | Mission accomplished        | 1         | 0             |
+--------------+-----------------------------+-----------+---------------+

SendingOK and SendingFailed column is actually can be calculated using COUNT(*), but I have no idea how to count based on same Message, while those message is executed in same SQL syntax. any idea how to do it?

A: Try this:
SELECT A.Username, A.Message,
   SUM(CASE WHEN B.Status = 'SendingOK' THEN 1 ELSE 0 END) AS SendingOK ,
   SUM(CASE WHEN B.Status = 'SendingFailed' THEN 1 ELSE 0 END) AS SendingFailed,
FROM db1.SmsBroadcast as A
INNER JOIN db2.sentitems as B ON A.MessageSMS1 = B.TextDecoded
WHERE A.Username = 'jamesbond'
GROUP BY A.Username, A.Message

A: If you have a known number of values to turn into columns, then you can hard-code them similar to the other answers. But if you have an unknown number, then you can use prepared statements:
SET @sql = NULL;
SELECT
  GROUP_CONCAT(DISTINCT
    CONCAT(
      'SUM(case when Status = ''',
      Status,
      ''' then 1 else 0 end) AS ',
      Status
    )
  ) INTO @sql
FROM db2.sentitems;

SET @sql = CONCAT('SELECT A.Username, A.Message, ', @sql, '
                  FROM db1.SmsBroadcast A
                  INNER JOIN db2.sentitems B
                    ON A.MessageSMS1 = B.TextDecoded
                  WHERE A.Username = ''jamesbond''
                  GROUP BY A.Username, A.Message');

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

The main difference with this is that it generates the SQL string based on the values in your db2.sentitems so if the values change, then this will automatically adjust without having to alter your code.

A: You can simply use CASE in your SELECT statement and GROUPED them by username and message.
SELECT `UserName`,
        `Message`,
        SUM(CASE WHEN `status` = 'SendingOK' THEN 1 ELSE 0 END) OkStat,
        SUM(CASE WHEN `status` = 'SendingFailed' THEN 1 ELSE 0 END) FailedStat
FROM    db1.SmsBroadcast as A
        JOIN db2.sentitems as B
            ON A.MessageSMS1 = B.TextDecoded
WHERE   A.Username = 'jamesbond'
GROUP BY A.Username, A.Message


text:
Q: Fazer uma ação com clique no js Eu estou a um bom tempo tentando fazer com que eu pudesse iniciar uma animação de sprites após um clique mas já tentei de tudo no js e não consegui, se alguém puder dar um norte já ajudaria muito, estudo por conta própria e ainda não peguei o jeito do js.

('#game-board').hide()

function toggleText() {
  var x = document.getElementById("container1");
  if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display = "none";
  }
}
:root {
  --pixel-size: 2, 9;
}

body {
  background-color: cornsilk;
  height: 100%;
}

* {
  font-family: 'Source Sans Pro', sans-serif;
  letter-spacing: 4px;
  background-color: cornsilk;
}

.container {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  text-align: center;
  min-height: 100vh;
}

.btn-1 {
  width: 300px;
  height: 100px;
  border: none;
  color: #ffff;
  background-color: coral;
  border-radius: 60px;
  box-shadow: inset 0 0 0 0 #4e7fda;
  transition: ease-out 0.3s;
  font-size: 2rem;
  outline: none;
}

.btn-1:hover {
  box-shadow: inset 300px 0 0 0 #123f95;
  cursor: pointer;
  color: #fff;
  border-radius: 60px;
}

.game-board {
  width: 80%;
  height: 920px;
  border: 1px solid #000;
  margin: 0 auto;
  position: relative;
}

.Character {
  right: 70%;
  margin-top: 15%;
  position: absolute;
  width: 50px;
  height: 78px;
  overflow: hidden;
}

.Character_spritesheet:hover {
  -webkit-animation: play 1s steps(2) infinite;
  width: calc(0px * var(--pixel-size));
  position: absolute;
}

.pixelart {
  image-rendering: pixelated;
}

@-webkit-keyframes play {
  from {
    transform: translate3d(1px, 0, 0)
  }
  to {
    transform: translate3d(-100%, 0, 0)
  }
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <link rel="stylesheet" href="style.css">
  <title>PortDig</title>

      <button onclick="toggleText()" class="btn-1">Iniciar</button>

https://jsfiddle.net/dj576q9p/26/#&togetherjs=ltyUJwuUsG

A: Essa função "toggleText()" pelo que to vendo só vai mostrar ou esconder o que tiver contido dentro no conteiner1, no caso, o próprio botão. Porque você referenciou o id dentro da função como "conteiner1".
No caso, imagino que você deseje esconder/mostrar a animação de sprite que está fora do conteiner1, no "game-board".
Creio que deva trocar o id na função para o id do elemento que deseja modificar ao clicar.
Dessa maneira aqui:
function toggleText() {
   var x = document.getElementById('id_da_animação');
   if (x.style.display === "none") {
      x.style.display = "block";
   } else {
      x.style.display = "none";
   }
}

Isso já deve resolver.
Porém mais interessante do que isso, eu sugiro que você adicione um argumento de id à função, assim você poderá reutilizar a mesma função pra mostrar ou esconder em outras coisas.
Ficaria assim:
no JS:
function toggleText(id) {
   var x = document.getElementById(id);
   if (x.style.display === "none") {
      x.style.display = "block";
   } else {
      x.style.display = "none";
   }
}

no HTML
<button onclick="toggleText('id_da_animação')" class="btn-1">Iniciar</button>


text:
Q: Deploying meteor to Heroku serve : Application error As a beginner with those tools, i followed tuto i found on the web to help me starting my app.
Here are the exacts commands i runned on ubuntu to deploy the todos example app from meteor and testthe whole thing.
meteor create --example todos
cd todos
git init
git add .
git commit -m "my first commit"
heroku create test2-push --stack cedar --buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git
heroku config:set BUILDPACK_URL=https://github.com/AdmitHub/meteor-buildpack-horse.git
heroku addons:add mongolab
git remote -v (vérification validité repo)
git push heroku master

But I'm having some trouble,as you can see here : http://test2-push.herokuapp.com
When i look at the logs, this is what kind of report i see :
    2015-04-01T14:29:25.298089+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2015-04-01T14:29:28.779222+00:00 app[web.1]:
2015-04-01T14:29:28.780112+00:00 app[web.1]:                              ^
2015-04-01T14:29:28.785982+00:00 app[web.1]: ReferenceError: Router is not defined
2015-04-01T14:29:28.785988+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:222:10
2015-04-01T14:29:28.785992+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2015-04-01T14:29:28.780101+00:00 app[web.1]:                        throw(ex);
2015-04-01T14:29:28.785993+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:117:5
2015-04-01T14:29:28.785987+00:00 app[web.1]:     at app/lib/router.js:65:3
2015-04-01T14:29:28.785990+00:00 app[web.1]:     at Array.forEach (native)
2015-04-01T14:29:28.785985+00:00 app[web.1]:     at app/lib/router.js:1:36
2015-04-01T14:29:28.779799+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:245
2015-04-01T14:29:29.744095+00:00 heroku[web.1]: Process exited with status 8
2015-04-01T14:29:29.766467+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-01T14:34:38.939853+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=4fb9c97d-b6f4-4056-b2d8-bae03d2db625 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T14:34:40.423408+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=9656f317-a5ca-41ba-86f5-1baf492aaae8 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T14:46:09.239587+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=76bfeefc-8632-4e92-835d-76b923e130fe fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T14:46:07.628681+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=24e7d69c-5392-479e-88c1-517a14e49674 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T15:09:43.185071+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=e3e2e1e3-a1bb-43f9-93b8-b9bbfc4e36e2 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T15:09:44.651505+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=c4db7ce2-5cb6-4bf8-b742-d282743f9c83 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T15:24:01.764681+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=eb8e20f8-fd89-40ec-b3c1-663bb4df3d19 fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T15:24:03.176506+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=1f89a73e-31ff-4c64-aad2-d17c0ac1122a fwd="195.68.112.65" dyno= connect= service= status=503 bytes=
2015-04-01T15:28:06.635282+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-01T15:28:10.577708+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2015-04-01T15:28:13.357353+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:245
2015-04-01T15:28:13.356958+00:00 app[web.1]:
2015-04-01T15:28:13.362147+00:00 app[web.1]:     at app/lib/router.js:65:3
2015-04-01T15:28:13.362149+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:222:10
2015-04-01T15:28:13.362152+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2015-04-01T15:28:13.362153+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:117:5
2015-04-01T15:28:13.362142+00:00 app[web.1]: ReferenceError: Router is not defined
2015-04-01T15:28:13.362150+00:00 app[web.1]:     at Array.forEach (native)
2015-04-01T15:28:13.362146+00:00 app[web.1]:     at app/lib/router.js:1:36
2015-04-01T15:28:13.357583+00:00 app[web.1]:                              ^
2015-04-01T15:28:13.357581+00:00 app[web.1]:                        throw(ex);
2015-04-01T15:28:14.241298+00:00 heroku[web.1]: Process exited with status 8
2015-04-01T15:28:14.261373+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-01T16:55:38.180103+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-01T16:55:41.740295+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2015-04-01T16:55:45.494145+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:245
2015-04-01T16:55:45.493712+00:00 app[web.1]:
2015-04-01T16:55:45.494389+00:00 app[web.1]:                              ^
2015-04-01T16:55:45.500227+00:00 app[web.1]:     at Array.forEach (native)
2015-04-01T16:55:45.500223+00:00 app[web.1]:     at app/lib/router.js:65:3
2015-04-01T16:55:45.500228+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2015-04-01T16:55:45.494367+00:00 app[web.1]:                        throw(ex);
2015-04-01T16:55:45.500218+00:00 app[web.1]: ReferenceError: Router is not defined
2015-04-01T16:55:45.500222+00:00 app[web.1]:     at app/lib/router.js:1:36
2015-04-01T16:55:45.500225+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:222:10
2015-04-01T16:55:45.500230+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:117:5
2015-04-01T16:55:46.333405+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-01T16:55:46.323223+00:00 heroku[web.1]: Process exited with status 8
2015-04-01T18:03:57.467111+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=d3c85c9b-f228-4d24-b429-cef66b57061f fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:04:00.465222+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=8d8bbe21-dffc-4a96-a566-bb4b536c0527 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:23:57.920020+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=5f6edcfa-a39f-43b1-8c29-86abfcccc0d0 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:23:58.666355+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=e9a4dd11-8a38-4fbb-a291-1c483651d476 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:23:58.976873+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=b1dd5f1c-3fdc-4a56-b887-46037596c9df fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:27:20.460565+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=0ff2c2d0-c964-4215-837c-94c4ee13c668 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:27:21.520543+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=544b0710-dbb2-4869-bd67-4e3262a72f4c fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:27:23.130196+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=b43c1cd2-e735-4043-bc25-8eaf46dd4874 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:53:02.827733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=9d81d4e8-cb68-4690-961e-d55876d60eab fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:53:04.616451+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=07b3e91c-3699-41bb-8998-e42b8e25b5af fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T18:53:05.814028+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=c53fe109-d3d3-4b04-b6b6-2e8da78dbdb1 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T19:20:25.110777+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=5c6f7a16-a522-4626-8d27-d9a9a64d3627 fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T19:20:25.954811+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=92731058-5a9f-429a-8092-a14e0c74316f fwd="82.234.60.18" dyno= connect= service= status=503 bytes=
2015-04-01T19:27:30.010755+00:00 heroku[api]: Set ROOT_URL config vars by davidpanart@gmail.com
2015-04-01T19:27:30.010755+00:00 heroku[api]: Release v7 created by davidpanart@gmail.com
2015-04-01T19:27:30.282881+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-01T19:27:32.734761+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2015-04-01T19:27:35.454118+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:245
2015-04-01T19:27:35.453619+00:00 app[web.1]:
2015-04-01T19:27:35.473776+00:00 app[web.1]:     at app/lib/router.js:1:36
2015-04-01T19:27:35.454360+00:00 app[web.1]:                              ^
2015-04-01T19:27:35.473769+00:00 app[web.1]: ReferenceError: Router is not defined
2015-04-01T19:27:35.473783+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:117:5
2015-04-01T19:27:35.473779+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:222:10
2015-04-01T19:27:35.473780+00:00 app[web.1]:     at Array.forEach (native)
2015-04-01T19:27:35.454321+00:00 app[web.1]:                        throw(ex);
2015-04-01T19:27:35.473782+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2015-04-01T19:27:35.473777+00:00 app[web.1]:     at app/lib/router.js:65:3
2015-04-01T19:27:36.303841+00:00 heroku[web.1]: Process exited with status 8
2015-04-01T19:27:36.350695+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-01T19:27:36.351363+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-01T19:27:40.078073+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2015-04-01T19:27:42.795297+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:245
2015-04-01T19:27:42.801101+00:00 app[web.1]:     at Array.forEach (native)
2015-04-01T19:27:42.801098+00:00 app[web.1]:     at app/lib/router.js:65:3
2015-04-01T19:27:42.801103+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2015-04-01T19:27:42.794734+00:00 app[web.1]:
2015-04-01T19:27:42.795670+00:00 app[web.1]:                        throw(ex);
2015-04-01T19:27:42.801093+00:00 app[web.1]: ReferenceError: Router is not defined
2015-04-01T19:27:42.795908+00:00 app[web.1]:                              ^
2015-04-01T19:27:42.801096+00:00 app[web.1]:     at app/lib/router.js:1:36
2015-04-01T19:27:42.801099+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:222:10
2015-04-01T19:27:42.801104+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:117:5
2015-04-01T19:27:43.610749+00:00 heroku[web.1]: Process exited with status 8
2015-04-01T19:27:43.621555+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-01T19:28:07.734024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=8dd496d4-7f43-4e42-a332-89b4c8ab7f23 fwd="88.142.102.169" dyno= connect= service= status=503 bytes=
2015-04-01T19:28:08.550440+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=b3815840-92d9-4bf3-9717-86c79bad5ef4 fwd="88.142.102.169" dyno= connect= service= status=503 bytes=
2015-04-01T19:28:11.358782+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=test2-push.herokuapp.com request_id=3e796eea-53e1-4cc0-b439-9a4a07c4d639 fwd="88.142.102.169" dyno= connect= service= status=503 bytes=
2015-04-01T19:28:12.506991+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=test2-push.herokuapp.com request_id=1fecde7f-27ba-460f-b5da-387eac86e13f fwd="88.142.102.169" dyno= connect= service= status=503 bytes=

It seems that i got several problem with fibers and router, often getting the exit status 8, but i do not understand a lot about that logs, and haven't found yet any explanation on the web.
Would someone have an explanation for me ?
Thanks you.

A: I had possibly the same issue.  I completely fixed mine by setting the buildpack differently:
heroku buildpack:set https://github.com/AdmitHub/meteor-buildpack-horse.git -a YOUR_APPNAME


text:
Q: Safari parent javascript function Im having a strange issue only in safari browser, im calling a parent window's javascript function from within a child iframe.
Initially the iframe's src will be an external site which will redirect to my site after the work is done. The redirect page contains the following three lines of code.
This seems to work in all browsers except safari.
The only call within the iframe is
<script>
self.parent.PARENT_FUNCTION("param");
</script>

Ive tried several other ways instead of self.parent like top.PARENT_FUNCTION,etc but still the main window's location seems to change.
One thing we noticed is that while the redirect is happening within the iframe, im getting a security certificate warning, once I clieck continue, then the browsers location changes to the new redirect url instead of just the iframe's src.
any clues what could the issue be ?.

A: Apparently the issue is with safari browser and invalid security certificate of the site within the iframe.
It basically does a frame busting and changes the main window's url if the site within the iframe is having an invalid ceritificate.


text:
Q: MSBuild command line with C# 6.0 code fails to build I am having an issue getting MSBuild to compile c# 6.0 code, it reports a failure when trying to build expression body syntax, etx.
So I've been creating build project like this for years. I have a powershell script that kicks of an msbuild with some parameters:
msbuild.exe _build\build.proj
        /p:Build_Number=1.2.0
        /p:Configuration=QA
        /p:SolutionName=MPGCS-Api.sln
        /ToolsVersion:14.0

I verified that msbuild.exe is coming from C:\Program Files (x86)\MSBuild\14.0\Bin , i did this by going into that folder and specifying the full physical path to the .proj file. I get the same exact errors.
I have been looking for an example on how to setup a MSBuild project file with C# 6.0 with no luck, so this is my basic setup (this is the build.proj file). If I had to guess I am not importing the correct targets, etc. But I am a little lost. Here is my proj file:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Root>$(MSBuildStartupDirectory)</Root>
    <NugetExe>$(Root)\_build\lib\nuget\nuget.exe</NugetExe>
    <Build_Number>0.0.0</Build_Number>
    <SolutionName></SolutionName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <VisualStudioVersion>14.0</VisualStudioVersion>
  </PropertyGroup>

  <Target Name="Clean">
    <!-- Clean up -->
    <ItemGroup>
      <FilesToDelete Include="$(Root)\_build\Artifacts\**\*.*" />
      <FilesToDelete Include="$(Root)\_build\Published\**\*.*" />
    </ItemGroup>
    <Delete Files="@(FilesToDelete)" ContinueOnError="false" />

    <!-- Ensure directories exists -->
    <MakeDir Directories="$(MSBuildProjectDirectory)\Artifacts" Condition="!Exists('$(MSBuildProjectDirectory)\Artifacts')" />
    <MakeDir Directories="$(MSBuildProjectDirectory)\Published" Condition="!Exists('$(MSBuildProjectDirectory)\Artifacts')" />
  </Target>

  <Target Name="Debug" AfterTargets="Clean">
    <!-- Diagnostics -->
    <Message Text="Diagnostics:"/>
    <Message Text="Build Number:    $(build_number)" />
    <Message Text="Configuration:    $(Configuration)" />
    <Message Text="VisualStudioVersion:    $(VisualStudioVersion)" />
    <Message Text="Project root:    $(Root)" />

    <!-- Restore Nuget Packages -->
    <Message Text="Restoring nuget..."/>
    <Exec Command="$(NugetExe) restore $(Root)\$(SolutionName)" />
  </Target>

  <Target Name="GenerateOctopackAPI" AfterTargets="Debug">
    <ItemGroup>
      <ProjectToBuild Include="$(Root)\MPG.CS.Api\MPG.CS.Api.csproj" />
    </ItemGroup>
    <MSBuild Projects="@(ProjectToBuild)" ContinueOnError="false" Targets="Rebuild" Properties="
      RunOctoPack=true;
      Configuration=$(ProjectBuildMode);
      Platform=AnyCpu;
      TargetFrameworkVersion=$(TargetFrameworkVersion);
      VisualStudioVersion=$(VisualStudioVersion);
      OctoPackPublishPackageToFileShare=$(Root)\_build\Artifacts;
      OctoPackPackageVersion=$(Build_Number);
      OctoPackProjectName=UI;
      OutputPath=bin\$(ProjectBuildMode)" />
    </Target>
</Project>

Here is some info from my "Debug" target, as you can see I am setting the VisualStudioVersion to 14.0 as per some suggestions I read online.
 Diagnostics:
  Build Number:    1.2.0
  Configuration:    QA
  VisualStudioVersion:    14.0
  Project root:    C:\dev\mpg\MPGCS-Api

Here is an example error, it's basically failing on c# 6.0 code, if I were to remove c# 6 code, everything will compile:
TicketType.cs(19,28): error CS1002: ; expected [C:\dev\mpg\MPGCS-Api\MPG.CS.Model\MPG.CS.Model.csproj]
  TicketType.cs(19,44): error CS1519: Invalid token '(' in class, struct, or interface member declaration [C:\dev\mpg\MPGCS-Api\MPG.CS.Model\MPG.CS.Model.cs proj]
  TicketStatus.cs(16,36): error CS1002: ; expected [C:\dev\mpg\MPGCS-Api\MPG.CS.Model\MPG.CS.Model.csproj]
  TicketStatus.cs(16,53): error CS1519: Invalid token '(' in class, struct, or interface member declaration [C:\dev\mpg\MPGCS-Api\MPG.CS.Model\MPG.CS.Model. csproj]
  TicketStatus.cs(16,82): error CS1519: Invalid token '(' in class, struct, or interface member declaration [C:\dev\mpg\MPGCS-Api\MPG.CS.Model\MPG.CS.Model. csproj]

Here is a line it's failing on (C# 6 code):
public bool IsAbbreviated  => (Title.ToLower() == "open" || Title.ToLower() == "closed");

I'm at a loss, I thought just using the proper msbuild.exe will allow me to take advantage of c# 6.0. Any help would be greatly appreciated.

A: If you're running the powershell script on a build server, separate from your dev environment, you will need to make sure that the machine itself can handle C# 6.0.  Since it uses a different compiler all together, it wouldn't work if VS 2015 wasn't installed.   Alternately, you can add the Microsoft.Net.Compilers nuget package as a dependency to allow VS 2012 and VS 2013 to compile it.


text:
Q: Ubuntu Install-creating drive: cannot shrink volume beyond the point where any removable files are located I am trying to dual-boot Ubuntu and Windows 10 on my computer. I currently have Windows 10 installed and am trying to partition(split) my D drive to create a new drive for Ubuntu. My D drive currently has 100GB of free space. However, in Disk Management, only 4.85GB is showing up as "available shrink space." Therefore, I cannot make a new drive big enough to run Ubuntu on. Is there any way of getting around this? It might be helpful to know windows says "cannot shrink volume beyond the point where any removable files are located."
Best, Kevin
edit: The defragment and optimization tool doesn't help, I pressed "optimized" but nothing changes

A: Strictly speaking, this isn't Ubuntu related. But, try this.

*

*Make an Ubuntu Live USB. Skip this step if you have other Ubuntu installation media handy.

*Plug in the media and boot into it. (Use F2, F8, F9, F10 or F12 or Esc to get into boot menu if need be)

*Open Gparted by hitting the Windows key and typing in Gparted.

*Right click the partition you want to resize (be very careful about which you select).

*Chose Resize/Move from the context menu.

*Fill out the parameters or simply drag the sliders.

*Hit apply.

*Rejoice.

NOTE: As with any operation relating to your hard disks, please try and make a backup before proceeding.


text:
Q: Change tinyMCE editor to allow marked content when pasting from Word I'm a big supporter of how WordPress handles pasted text from Word, however for my client I need to change this.
My client is marking text within Word to use as a reminder (background color).
Does anyone know if there is a option/filter, without changing core-code, to make it possible that marked text from Word is not deleted?
I have tried the following but that didn't work. It did made some changes and added buttons like the code tells the editor to do but it doesn't keep the marked text.
function my_format_TinyMCE( $in ) {
$in['remove_linebreaks'] = false;
$in['gecko_spellcheck'] = false;
$in['keep_styles'] = true;
$in['accessibility_focus'] = true;
$in['tabfocus_elements'] = 'major-publishing-actions';
$in['media_strict'] = false;
$in['paste_remove_styles'] = false;
$in['paste_remove_spans'] = false;
$in['paste_strip_class_attributes'] = 'none';
$in['paste_text_use_dialog'] = true;
$in['wpeditimage_disable_captions'] = true;
$in['plugins'] = 'tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';
$in['content_css'] = get_template_directory_uri() . "/editor-style.css";
$in['wpautop'] = true;
$in['apply_source_formatting'] = false;
$in['toolbar1'] = 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv ';
$in['toolbar2'] = 'formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help ';
$in['toolbar3'] = '';
$in['toolbar4'] = '';
return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );


text:
Q: How to play .pls file in android Can anyone give me the sample code for parsing and playing .pls file in android?
[playlist]
 NumberOfEntries=1
 File1=http://stream.radiosai.net:8002/

A: You need to download the .pls file and read it to find the media file inside since pls is a playlist not a format.

A: I've been searching for a solution for 2 days about this issue and I've finally found a radio player which you can implement into your code: https://github.com/iammert/RadioPlayerService that plays .pls files from a radio service link (such as: http://stream.radiosai.net:8002/ ).
However, that url on your question should work on the default MediaPlayer but if anyone ever encounters this problem with urls that contain a .pls file, then they should use a radio player that supports the encoding and format.
 .


text:
Q: How do I solve this optimization question?
A fence 8 feet tall runs parallel to a tall building at a distance of 2 feet from the building. What is the length of the shortest ladder that will reach from the ground over the fence to the wall of the building?

My Work
Let $y$ represent the horizontal distance from the fence to the bottom of the ladder. Let $x$ represent the vertical distance from the building to the top of the fence.
Then, the solution would be the local minimum of the function:
$L = (x+8)^2 + (y+2)^2$
with the constraint:
$$\frac{x+8}{y+2} = \frac{8}{y}$$
Finding the derivative of the function gives:
$L ^\prime = -x^4 - x^3 + 256x + 512$
I am not allowed to use a calculator, so how do I find the shortest length?
Thanks

A: It is clear that the shortest ladder will lean against the fence. Poor fence!
Let  $t$ be the angle the ladder makes with the ground. Then the distance from the foot of the ladder to the bottom of the fence is $8\cot t$. Thus the distance of the foot of the ladder to the building is $2+8\cot t$. It follows that the ladder has length $L(t)=(2+8\cot t)\sec t$. This can be expressed as
$$L(t)=\frac{2}{\cos t} +\frac{8}{\sin t}.$$
Differentiation gives
$$L'(t)=\frac{2\sin t}{\cos^2 t} -\frac{8\cos t}{\sin^2 t}.$$
Set $L'(t)$ equal to $0$, solve. We get $\tan t=\sqrt[3]{4}$. Since $L'(t)\lt 0$ for $t\lt \sqrt[3]{4}$, and positive for $t\gt \sqrt[3]{4}$, we do attain a minimum at $t=\sqrt[3]{4}$.

A: I get the following equations using your approach:
$$L = (x+2)^2+(y+8)^2, \qquad \frac{y+8}{x+2}= \frac8x$$
The similarity constraint quickly gives $y = \dfrac{16}x$.  Using this, we have the square of the ladder length as
$$L = x^2+4x+\frac{256}x + \frac{256}{x^2}+68$$
and we can get $L'$ in a factored form (after identifying the factor $(x+2)$ by inspection,
$$L' = 2 \frac{(x^3-128)(x+2)}{x^3}$$
Now can you see for what value of $x$ we can get a minimum for the ladder length?


text:
Q: How to change the position of an element when I do a click action So I'm designing an application that makes it easy to fetch result from wikipedia. Now What I want to do firstly is that when the search value has been entered into the search bar and I click on the search Icon, I want the search bar to move up and create space for the incoming result. Yes I have some codes but it's not working yet. Also The API call to wikipedia seems not to be working as well, I will also need help with that. Below is the Javascript code:
$(document).ready(function() {

  let searchValue = document.getElementById("#searchString").value;

  $(".sbutton").on("click", function() {
    // code to push the wrap div element and icon up the container
    $(".wrap").animate({
      marginTop: "5px"
    });

    let baseUrl = " https://en.wikipedia.org/w/api.php? ";
    let tailUrl =
      "action=opensearch&format=jsonfm&search=" + searchValue + "&limit=10";
    let wikiLink = baseUrl + tailUrl;

    $.ajax({
      url: wikiLink,
      type: "GET",
      dataType: "json",
      success: function getWikiData(data) {
        let dDiv = document.createElement("div");
        dDiv = "content";
        dDiv.className = "secondDiv";
document.getElementByClassName("container").append(dDiv);
        for (var i = 0; i < data.opensearch.search.length; i++) {
          $("#content").appendChild(
            "<p>" + data.opensearch.search[2].title + "</p>"
          );
        }
      },

      error: function(error) {
        console.log(error);
      }
    });
  });
});

A: One way to do it is to add some css to the element.
$(".wrap").css( "marginTop", "5px" );

read more about the jQuery css here http://api.jquery.com/css/
Make sure that youcalls the jQuery aswell, easiest way is through cdn, here you go:
https://cdnjs.com/libraries/jquery/
here you have working fiddle
https://jsfiddle.net/6txwmh8L/

A: $(".wrap").animate({ marginTop: "+=30px"}, 500 );

will be more smooth


text:
Q: C# WPF Web Browser Control Security Error I'm currently having trouble to nagivate to local file which have the index.html.
I had try to copied the URL link to firefox and google chrome and it worked. But when I'm trying to navigate to the URL link with C# Web Browser Control, it gave me a black screen with

Fatal: loading error (Security Error)

which I feel very weird.
Here is the example link: file://127.0.0.1/c$/Users/Marcus/Desktop/03%20Virtual%20Tour/dataranlang/index.html
Here is my code that used to called for the URL link in C# Web Browser Control:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Reflection;

namespace Perak360
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.WB.Loaded += (s, e) =>
            {
                // get the underlying WebBrowser ActiveX object;
                // this code depends on SHDocVw.dll COM interop assembly,
                // generate SHDocVw.dll: "tlbimp.exe ieframe.dll",
                // and add as a reference to the project

                var activeX = this.WB.GetType().InvokeMember("ActiveXInstance",
                    BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                    null, this.WB, new object[] { }) as SHDocVw.WebBrowser;

                // now we can handle previously inaccessible WB events
                activeX.FileDownload += activeX_FileDownload;
            };

            this.Loaded += (s, e) =>
            {
                try
                {
                    this.WB.Source = new Uri(new System.IO.FileInfo(@"C:\Users\Marcus Tan\Documents\Visual Studio 2013\Projects\Perak360\Perak360\Perakin360 Offline (Final)\index.html").FullName);
                    //this.WB.Navigate(Properties.Settings.Default.WebBrowserPath);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            };

        }

        void activeX_FileDownload(bool ActiveDocument, ref bool Cancel)
        {
            Cancel = true;
        }

        private void CloseWindow(object sender, TouchEventArgs e)
        {
            Application.Current.Shutdown();
        }

    }
}

I know that if i changed the URL link to file://C:/Users/Marcus%20Tan/Desktop/03%20Virtual%20Tour/dataranlang/index.html it may work, but there will be a javascript prompt out which ask user to enable the blocked content which I don't want it to be appear.
Any clue what wrong with my URL link or code which it gave me a black screen without the loading error screen? I had try to search online for solution and try to set the Internet Security setting, but none of it work.
Please guide me through this.


text:
Q: Android Studio 2.3 using emulator from console, "/dev/kvm device: permission denied" for root user I'm trying to start a virtual android device which I created with the avdmanager of Android Studio 2.3 (via command line)
all commands are performed as root user
when i try to start the emulator via $ ~/Android/Sdk/tools/./emulator @Nexus_5X_Api_23_x86 the output is:
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)

I'm using an Ubuntu 16.04 server with 64-Bit, Android Studio is started via  x11 forwarding so my desktop environment is used (which is an ubuntu 16.04, 64-Bit too!)
when i'm typing $ kvm-ok it gives me:
INFO: /dev/kvm exists
KVM acceleration can be used

To proof that the .avd I'm trying to access exists:
$ ~/Android/Sdk/tools/bin/./avdmanager list avd

gives the output:
März 15, 2017 4:30:53 NACHM. sun.util.PropertyResourceBundleCharset$PropertiesFileDecoder decodeLoop
INFO: Invalid or unmappable UTF-8 sequence detected. Switching encoding from UTF-8 to ISO-8859-1
Available Android Virtual Devices:
    Name: Nexus_5X_Api_23_x86
  Device: Nexus 5X (Google)
    Path: /root/.android/avd/Nexus_5X_Api_23_x86.avd
  Target: Google APIs (Google Inc.)
          Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
  Sdcard: 800M

further the permissions for /dev/kvm are:
root@h2627852:~# ls -l /dev/kvm
crwxrwxrwx 1 root kvm 10, 232 Mär 15 10:48 /dev/kvm
root@h2627852:~# groups root
root : root kvm libvirtd libvirt

performing emulator-check gives me:
root@h2627852:~# ~/Android/Sdk/tools/./emulator-check accel hyper-v cpu-info window-mgr desktop-env
accel:
11
This user doesn't have permissions to use KVM (/dev/kvm)
accel
hyper-v:
0
Hyper-V runs only on Windows
hyper-v
cpu-info:
146
Intel CPU|Virtualization is supported|64-bit CPU|
cpu-info
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 36346
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
window-mgr:
0
GNOME Shell
window-mgr
desktop-env:
0
mate
desktop-env

I really don't know what to do anymore, searched all over the forum but didn't found a replicate of this problem for my system, the fixes for the same problem on other systems doesn't worked for me, already tried to completely purge and reinstall all qemu, libvirt, libvirtd and kvm packages without success.
Any help is appreciated!!
edit:
~/Android/Sdk/tools/./emulator @Nexus_5X_Api_23_x86 -verbose givese me,
following output:
emulator:Android emulator version 25.3.0.0 (build_id 3394391)
emulator:Found AVD name 'Nexus_5X_Api_23_x86'
emulator:Found AVD target architecture: x86_64
emulator:argv[0]: '/root/Android/Sdk/tools/./emulator'; program directory: '/root/Android/Sdk/tools'
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:Probing for /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu: file exists
emulator:Auto-config: -engine qemu2 (based on configuration)
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:try dir /root/Android/Sdk/tools
emulator:try dir /root/Android/Sdk/tools/./
emulator:try dir /root/Android/Sdk/emulator
emulator:Found target-specific 64-bit emulator binary: /root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64'
emulator:Adding library search path: '/root/Android/Sdk/emulator/lib64/libstdc++'
emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:  Found directory: /root/Android/Sdk/system-images/android-23/google_apis/x86_64/

emulator:GPU emulation is disabled
emulator: Adding library search path for Qt: '/root/Android/Sdk/emulator/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/root/Android/Sdk/emulator/lib64/qt/plugins
emulator: Running :/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
emulator: qemu backend: argv[00] = "/root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
emulator: qemu backend: argv[01] = "@Nexus_5X_Api_23_x86"
emulator: qemu backend: argv[02] = "-verbose"
emulator: Concatenated backend parameters:
 /root/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 @Nexus_5X_Api_23_x86 -verbose
emulator: Android virtual device file at: /root/.android/avd/Nexus_5X_Api_23_x86.ini
emulator: virtual device content at /root/.android/avd/Nexus_5X_Api_23_x86.avd
emulator: virtual device config file: /root/.android/avd/Nexus_5X_Api_23_x86.avd/config.ini
emulator: using core hw config path: /root/.android/avd/Nexus_5X_Api_23_x86.avd/hardware-qemu.ini
emulator: Found AVD target API level: 23
emulator: Read property file at /root/Android/Sdk/system-images/android-23/google_apis/x86_64//build.prop
emulator: No boot.prop property file found.
emulator: Warning: config.ini contains invalid skin.path entry: (null)
emulator: autoconfig: -skin HVGA
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /root/Android/Sdk/system-images/android-23/google_apis/x86_64//kernel-ranchu
emulator: Target arch = 'x86_64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /root/Android/Sdk/system-images/android-23/google_apis/x86_64//ramdisk.img
emulator: Using initial system image: /root/Android/Sdk/system-images/android-23/google_apis/x86_64//system.img
emulator: autoconfig: -data /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata-qemu.img
emulator: autoconfig: -initdata /root/.android/avd/Nexus_5X_Api_23_x86.avd/userdata.img
emulator: autoconfig: -cache /root/.android/avd/Nexus_5X_Api_23_x86.avd/cache.img
emulator: autoconfig: -sdcard /root/.android/avd/Nexus_5X_Api_23_x86.avd/sdcard.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 0MB is below hardware specified minimum of 256MB,setting it to that value
emulator: System image is read only
emulator: GPU emulation is disabled
emulator: Found 2 DNS servers: 85.214.7.22 81.169.163.106
emulator: skin name 'HVGA' aliased to '320x480'
emulator: found magic skin width=320 height=480 bpp=16

emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn't have permissions to use KVM (/dev/kvm)

A: Simply try this.
this was work for me
$ sudo chown username -R /dev/kvm

sometimes you need to run this code also
$ cd Android/Sdk/emulator/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.bak
$ ln -s /usr/lib64/libstdc++.so.6

A: Assuming that you want to apply this change of ownership using the current OS user, use the following:
sudo chown $(whoami) -R /dev/kvm

A: I solved the problem running
sudo apt install qemu-kvm
sudo chown username -R /dev/kvm

A: Try these steps:
Install qemu-kvm like following
sudo apt install qemu-kvm

Add user to kvm group using the following command:
sudo adduser <username> kvm

If you are getting permission denied, try following command
sudo chown <username> /dev/kvm

It worked for me in Ubuntu 18.04

A: Check nano /etc/group contains a line begins with kvm and ends with your user name. If not then run:
sudo gpasswd -a $USER kvm


text:
Q: referencing VisualBasic methods In VB, I want to assign a (shared) method to a variable
And I'm asking if there is some namespace operator like :: in C++ and Java
Class C
    Public Shared Function m(a as Integer) as Integer
        Return  a * 2
    End Function
End Class

Public Sub Main()

    Dim localM As Func(Of Integer, Integer) = C.m

    Console.WriteLine(localM(5))
End Sub

I know I could use function(a) C.m(a)
but that is not pretty
and I don't want to create a new function every time
and is also sensitive to argument changes
as for why would I do that
I'm actually passing it to function as an argument
(someFunction(3, C::m))

A: You can do this:
Sub Main()
    Dim localM As Func(Of Integer, Integer) = AddressOf C.m
    Console.writeline(localM(5))
End Sub

You can see it work here:

https://dotnetfiddle.net/Uxl0Y7

I didn't change anything in the sample class, except to complete the function so it returns a value (required for the function to compile) and to fix your lousy capitalization.

I'm actually passing it to function as an argument

In that case:
Sub Main()
    Dim localM As Func(Of Integer, Integer) = AddressOf C.m
    Foo(localM)

    ' Or

    Foo(AddressOf C.m)
End Sub

Sub Foo(theMethod As Func(Of Integer, Integer))
    Console.WriteLine(theMethod(5))
End Sub

In either case, the trick is to do two things:

*

*Define either an Action (for a Sub) or Func (for a Function) that matches the signature of the target method. In this case, it's Func(Of Integer, Integer). Any method up to 8 arguments can be mapped this way, but you do have to know the signature in advance.

*Use AddressOf to capture the reference to the method.

A: Is this what you are looking for?
Class C
    Public Shared Add1 As Func(Of Integer, Integer) = Function(value As Integer)
                                                          Return value + 1
                                                      End Function

End Class

to use
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim foo As Integer = C.Add1(3)
    Debug.WriteLine(foo)
End Sub

edit
Class C
    Public Shared Add1 As Func(Of Integer, Integer) = Function(value As Integer)
                                                          Return value + 1
                                                      End Function

    Public Shared DebugStr As Action(Of String, String) = Sub(first As String, second As String)
                                                              Debug.WriteLine("One-{0}  Two-{1}",
                                                                                first, second)
                                                          End Sub

End Class

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim foo As Integer = C.Add1(7)
    Debug.WriteLine(foo)

    C.DebugStr("Quick", "Fox")
End Sub


text:
Q: Remove widget from Gtk.FlowBox I'm trying to remove a Widget from a Gtk.FlowBox by destroying the widget, however there is a gray box left in place. Any idea how I can remove the gray box so that the adjacent widget falls into place after the removal of the widget.
The following is how the widgets are packed:
1- Two Images(from pixbuf) and Label are added to a OverlayImage
2- Overlay Image is added to a EventBox
3- EventBox is added to the FlowBox
I have tried the following methods:
1- Destroy the EventBox
2- Obtain and destroy all children of Overlay Image and then destroy OverLay Image and EventBox
In both case, the widget is removed but a empty area stays in its place which is grey when clicked, but does nothing - see picture.
How do I remove this empty space, so that the next widget automatically falls into the place where the widget was removed and the next widget falls into its place and so on.
The code is available here and the "removeSelectedBooksFromLibrary" is the method which is removing the EventBox selected by the user from the FlowBox
This is the code to add widgets from the FlowBox
https://github.com/babluboy/bookworm/blob/master/src/bookworm.vala#L589
This is the code to remove widgets from the FlowBox
https://github.com/babluboy/bookworm/blob/master/src/bookworm.vala#L512

Thanks in advance
Here is a working example with the solution added, which removes the widget and its parent.
public class FlowBoxIssue : Gtk.Window {

  public static int main (string[] args) {
      Gtk.init (ref args);
      FlowBoxIssue window = new FlowBoxIssue();
      window.show_all ();
      Gtk.main ();
      return 0;
  }

  public FlowBoxIssue () {
      this.title = "FlowBox Issue";
      this.window_position = Gtk.WindowPosition.CENTER;
      this.destroy.connect (Gtk.main_quit);
      this.set_default_size (800, 600);

      Gtk.FlowBox library_flowbox = new Gtk.FlowBox();
      Gtk.Box library_mainbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 20);

      Gtk.ScrolledWindow library_scroll = new Gtk.ScrolledWindow (null, null);
            library_scroll.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
            library_scroll.add (library_flowbox);

      Gtk.Overlay aOverlayImage1 = new Gtk.Overlay();
      Gtk.EventBox aEventBox1 = new Gtk.EventBox();
      Gtk.EventBox aEventBox2 = new Gtk.EventBox();
      Gtk.EventBox aEventBox3 = new Gtk.EventBox();
      try{
        Gdk.Pixbuf aBookCover1 = new Gdk.Pixbuf.from_file_at_scale("cover.png", 200, 250, false);
        Gtk.Image aCoverImage1 = new Gtk.Image.from_pixbuf(aBookCover1);

        aOverlayImage1.add(aCoverImage1);
        Gtk.Label overlayTextLabel1 = new Gtk.Label("Label 1");
        aOverlayImage1.add_overlay(overlayTextLabel1);
        aEventBox1.add(aOverlayImage1);
        library_flowbox.add (aEventBox1);
      }catch(Error e){

      }

      Gtk.Overlay aOverlayImage2 = new Gtk.Overlay();
      try{
        Gdk.Pixbuf aBookCover2 = new Gdk.Pixbuf.from_file_at_scale("cover.png", 200, 250, false);
        Gtk.Image aCoverImage2 = new Gtk.Image.from_pixbuf(aBookCover2);

        aOverlayImage2.add(aCoverImage2);
        Gtk.Label overlayTextLabel2 = new Gtk.Label("Label 2");
        aOverlayImage2.add_overlay(overlayTextLabel2);
        aEventBox2.add(aOverlayImage2);
        library_flowbox.add (aEventBox2);
      }catch(Error e){

      }

      Gtk.Overlay aOverlayImage3 = new Gtk.Overlay();
      try{
        Gdk.Pixbuf aBookCover3 = new Gdk.Pixbuf.from_file_at_scale("cover.png", 200, 250, false);
        Gtk.Image aCoverImage3 = new Gtk.Image.from_pixbuf(aBookCover3);

        aOverlayImage3.add(aCoverImage3);
        Gtk.Label overlayTextLabel3 = new Gtk.Label("Label 3");
        aOverlayImage3.add_overlay(overlayTextLabel3);
        aEventBox3.add(aOverlayImage3);
        library_flowbox.add (aEventBox3);
      }catch(Error e){

      }

      Gtk.Button delete_button = new Gtk.Button.with_label("Delete Pix");
      delete_button.clicked.connect (() => {
          //This is the line which resolved the issue - get the parent of the widget and destroy it and then destroy the widget
          aEventBox2.get_parent().destroy();
                aEventBox2.destroy();
          });

      library_mainbox.pack_start(library_scroll, true, true, 0);
      library_mainbox.pack_end(delete_button, true, false, 0);
      this.add(library_mainbox);
  }

}

A: Every time you add a child widget to a GtkFlowBox, the flow box widget will add an implicit child widget in between, for event handling and styling purposes — as the documentation for GtkFlowBox states:

Although a GtkFlowBox must have only GtkFlowBoxChild children, you can add any kind of widget to it via gtk_container_add(), and a GtkFlowBoxChild widget will automatically be inserted between the box and the widget.

This means that the line:
library_grid.add(aEventBox);

is really equivalent to:
var flowbox_child = new Gtk.FlowBoxChild();
flowbox_child.add(aEventBox);
library_grid.add(flowbox_child);

If you want to remove a widget from a GtkFlowBox and you only keep a reference to the child you added, you will need to retrieve its parent and remove that from the GtkFlowBox:
aEventBox.get_parent().destroy();
// or
library_grid.remove(aEventBox.get_parent());


text:
Q: Как вызвать функцию Django из шаблона? Есть функция synch определённая в views.py, которая внутри себя обращается к функции get_companies, которая в свою очередь делает запрос к API стороннего сервера, и возвращает результат в формате json. Сама synch данный результат обрабатывает и методом update_or_create() заносит в базу.
Вопрос в следующем:
Как вызвать функцию synch из html-шаблона?
Для наглядности прикрепляю uml-схему сего действа.


text:
Q: Execution of XSS inside of  when >< are filtered and cannot escape using ' " I am learning XSS for ethical purposes and I cannot seem to figure this one out on my own. I am trying to use XSS (legally) on a site by appending a  was not found.. The code in chrome dev tools looks like

        "Error 404: The page https://www.###.com/###/ was not found."

When editing as HTML:
Error 404: The page https://www.redditinc.com/press/<script>alert('XSS')</script> was not found.

When I try to break out using ", I get the following:
dev tools:

        "Error 404: The page https://www.###.com/###/" was not found."

HTML:

Error 404: The page https://www.redditinc.com/press/"<script>alert('XSS')</script> was not found.

Same thing goes for '.
I'm new to penetration testing, and XSS. Is there anything I can do?


text:
Q: Bootstrap Button Group with Float I'm trying to create a group some buttons and float them to the right of a div container:

Here is some blurb...

          <button class="btn btn-danger btn-xs"></button>
            <button class="btn btn-success btn-xs"></button>

As you can see from this fiddle the buttons break-out of the div when I apply float-right:
https://jsfiddle.net/xa9wvouc/6/
I could set the caption to have a min0height but that feels like a hack? What is the correct way to achieve this goal.

A: If you're using Bootstrap, wrap the button-group in a row (see code below). From here you can adjust the margin-right on button-group as you see fit.
https://jsfiddle.net/meppiel/ysx7nvk4/1/

        <button class="btn btn-danger btn-xs"></button>
        <button class="btn btn-success btn-xs"></button>

A: Because if you apply pull-right to a button-group, it means that the button-group will be float and the height of its parent div will be collapse. So to avoid collapsing parent div, you need to apply clearfix class to the parent div

Here is some blurb...

        <button class="btn btn-danger btn-xs"></button>
        <button class="btn btn-success btn-xs"></button>


text:
Q: Eigenvalues of such matrix $A^2 = A^T$
Suppose $A$ is a square $n \times n (n \ge2)$ matrix such that $A^2 = A^T$. Prove that if $\lambda$ is a real eigenvalue of $A$ then either $\lambda = 0$ or $\lambda = 1$

Firstly I decided to find the determinant of $A$: $(\det A)^2 = \det A$ hence either $\det A = 0$ or $\det A = 1$. In the first case a zero eigenvalue obviously exists, so assume $\det A = 1$. In this case $A$ is invertible therefore $$AAAA = A^TA^T = (AA)^T = A$$ i.e. $$AAA^T = A$$ hence $$AA^T = I$$ So, $A$ is orthogonal. As I know eigenvalues of an orthogonal matrix can be $\pm1$
Could you please give me any hints how to prove that $\lambda = -1$ isn't possible?
Thanks in advance!

A: $$AA^T=A(A^2)=A^3.$$
$$AA^T=(AA^T)^T=(A^T)^3=A^6.$$
So $0=A^6-A^3=A^3(A^3-1)$. The characteristic equation of $A$ must divide this expression, and hence the eigenvalues of $A$ must be within the set $\{0,1,e^{i\pi/3},e^{2i\pi/3}\}.$

A: If $\lambda$ is an eigenvalue of $A$ then we have$$|\lambda^2I-A^2|=|\lambda I-A||\lambda I+A|=0\\|\lambda I-A^t|=|(\lambda I-A)^t|=|\lambda I-A|=0$$which means that $\lambda$ and $\lambda^2$ are eigenvalues of $A^t$ and $A^2$ respectively. Since $$A^2=A^t$$ we have $$\lambda^2=\lambda$$ or $$\lambda=0\text{ or }1$$


text:
Q: How get value from URL I want to get the value from the URL to choose data from the database by ID. I want the value for the id.
For example, if I were to open www.example.com/index.php?id=12.
I want to get a value whose id = 12 in the database.
If I open www.example.com/index.php?id=7.
I want to get the value whose id = 7 in the database and so on.

A: Website URL:
http://www.example.com/?id=2

Code:
$id = intval($_GET['id']);

A: There are two ways to get variable from URL in PHP:
When your URL is: http://www.example.com/index.php?id=7 you can get this id via $_GET['id'] or $_REQUEST['id'] command and store in $id variable.
Lest's take a look:
// url is www.example.com?id=7

//get id from url via $_GET['id'] command:
$id = $_GET['id']

same will be:
//get id from url via $_REQUEST['id'] command:
$id = $_REQUEST['id']

the difference is that variables can be passed to file via URL or via POST method.
if variable is passed through url, then you can get it with $_GET['variable_name'] or $_REQUEST['variable_name'] but if variable is posted, then you need to you $_POST['variable_name'] or $_REQUEST['variable_name']
So as you see $_REQUEST['variable_name'] can be used in both ways.

A: You can get that value by using the $_GET array. So the id value would be stored in $_GET['id'].
So in your case you could store that value in the $id variable as follows:
$id = $_GET['id'];

A: You can access those values with the global $_GET variable
//www.example.com/index.php?id=7
print $_GET['id']; // prints "7"

You should check all "incoming" user data - so here, that "id" is an INT. Don't use it directly in your SQL (vulnerable to SQL injections).

A: You can also get a query string value as:
$uri =  $_SERVER["REQUEST_URI"]; //it will print full url
$uriArray = explode('/', $uri); //convert string into array with explode
$id = $uriArray[1]; //Print first array value


text:
Q: Why does cancelling a pthread in an IO function of istream / ostream set the badbit? I was looking into libstdc++ code and was surprised that it sets the badbit on a stream when an operator>> or operator<< is interupted by a cancellation point of pthread (which, if I understand correctly, is implemented by throwing a special magic exception object).
Apparently, the C++ Standard requires that an exception escaping to the respective I/O function shall set the badbit. But to my understanding, a pthread cancellation isn't needed to be considered an "exception" in the C++ sense.
Does that mean that when calling pthread_cancel'ing a thread that uses cout and friends, one always has to clear the badbit after the thread doing the I/O exited (to be sure just in case the thread caused the badbit to be set)?

A: The C++ standard doesn't specify any specific behavior for pthread's special exception. However, it specifies that catching any exception results in setting std::ios_base::badbit. The standard would need to be augmented to handle special exceptions special. The interactions between different standards doing things independent from the C++ in the C++ standard are clearly outside the C++ standard.
At one Kona meeting (~2006/2007) cancelling threads via exceptions was discussed at length. It was determined that supporting thread cancellation causes weird problem and that there were too many questions open to support thread cancellation in C++. If you want working thread cancallation support in C++ you'll need to get it integrated with the C++ standard. I wouldn't expect large support for thread cancellation in C++, though.
For more practical matters I can also imagine that throwing from, e.g., read(2) may leave the stream of an unsuspecting I/O stream implementation in an inconsistent state! System functions didn't use to throw. If the start doing so funny things may happen. That is, the stabdard library would need to be aware of this change to the system call behavior. This silent change in behavior was one of the arguments why thread cancellation via exceptions wasn't considered a viable approach: what applies to the standard C++ library implentation applies even more to user code.


text:
Q: Using SftpOutboundGateway to list remote files in spring batch I am using spring batch partitioning and i would like to send a file list to each partition for processing.
I need to know how to invoke SftpOutboundGateway and get the list of remote files names from the spring batch Partitioner.

A: If that's all you need to do, consider just using FtpRemoteFileTemplate.list() or even Session.listNames().


text:
Q: how do i write git commit -am"this is my commit message" using ohmyzsh? Just wondering how I write this using ohmyzsh? I know the shortcuts for most of the git commands, just not sure of this one.

A: gca -m "this is my commit message"

Per https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh


text:
Q: How to maintain the size of image while interpolating in python? I have interpolated my nifti image (mri data) via linear method. but the problem is that field of view in output changes (input is 400*400 but output is 4000*3000 ) I am searching for a way to keep the dimensions while interpolating. Do you may have a solution?
Thank you
t1_ = "name.nii.gz"
img_t1_ = nib.load(t1_)
img_t1_ = np.double(img_t1_.get_fdata())
slice_ = 300
img_t1_ = np.rot90(img_t1_[:,:,slice_,0])
x = np.linspace(0, img_t1_.shape[1],  img_t1_.shape[1])
y = np.linspace(0, img_t1_.shape[0],  img_t1_.shape[0])
X, Y = np.meshgrid(x, y)
Z = img_t1_
x2 = np.linspace(0, img_t1_.shape[1],  9*img_t1_.shape[1])
y2 = np.linspace(0, img_t1_.shape[0],  9*img_t1_.shape[0])
print(x2.shape[0], y2.shape[0])
tmp_z_ = np.zeros((x2.shape[0], y2.shape[0]))
f_linear = interp2d(x, y, Z, kind='linear')
Z2 = f_linear(x2, y2)

A: I assume by keeping the dimensions, you mean keeping the aspect ratio (i.e. input: 400x400 -> output: 4000x4000). Also, I'm not exactly sure what you are trying to achieve with your interpolation. However, depending on the use case, the zoom function in scipy's ndimage module could do the job. If you chose parameter order=1, this corresponds to linear interpolation.
I'm not familiar with the packages you use to import your images. The following example assumes that the image data has been loaded to img_data, a two dimensional float array. Just adapt to your use case.
from scipy.ndimage import zoom
interpolated_img_data = zoom(img_data, 10, order=1)


text:
Q: Custom social sing up form I have a custom Form already working for normal sign in (with email), now i have the problem with the social one.
Following the official documentation
from allauth.socialaccount.forms import SignupForm
class MyCustomSocialSignupForm(SignupForm):

    def save(self):

        # Ensure you call the parent classes save.
        # .save() returns a User object.
        user = super(MyCustomSocialSignupForm, self).save()

        # Add your own processing here.

        # You must return the original result.
        return user

And my code is the following :
settings.py
ACCOUNT_SIGNUP_FORM_CLASS = 'accounts.forms.SignupFormEmail'
SOCIALACCOUNT_FORMS = {'signup': 'accounts.forms.SignupFormSocial'}

forms.py
class SignupFormEmail(forms.Form):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields['localizacion'].label = 'Categorias'

    localidades = Alcance.objects.exclude(pk=1).filter(zona_afectada=Alcance.CONCEJO)

    localizacion = forms.ModelChoiceField(queryset=localidades, label='Concejo',empty_label="Selecciona tu concejo")

    def signup(self, request, user: User):
        self.user=user
        user.residencia.add(self.cleaned_data['localizacion'])
        user.save()

class SignupFormSocial(SignupForm):

    localidades = Alcance.objects.exclude(pk=1).filter(zona_afectada=Alcance.CONCEJO)

    localizacion = forms.ModelChoiceField(queryset=localidades, label='Concejo', empty_label="Selecciona tu concejo")

    def __init__(self, sociallogin=None, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields['localizacion'].label = 'Categorias'

    def save(self,request):
        # Ensure you call the parent classes save.
        # .save() returns a User object.
        user = super(SignupFormSocial, self).save()
        # Add your own processing here.
        user.residencia.add(self.cleaned_data['localizacion'])
        user.save()

        # You must return the original result.
        return user

The problem is that i get the following exception django.core.exceptions.ImproperlyConfigured: Error importing form class accounts.forms: "cannot import name 'BaseSignupForm'"
I also try , inheriting from form.Form and from SignupFormEmail , but none of them work
How can I do this ?
Updated with Installed apps in settings :
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    # Django AllAuth
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.twitter',
    #My apps
    'accounts.apps.AccountsConfig',

A: At the end I found the problem,
all auth It has by default
SOCIALACCOUNT_AUTO_SIGNUP = True

I don't know why , it was interpreting that the attribute localization was given by social account , when it was not.
So the solution was to put it to false and use the normal way to custom the form (more info here)
ACCOUNT_SIGNUP_FORM_CLASS = 'accounts.forms.SignupForm'
SOCIALACCOUNT_AUTO_SIGNUP = False


text:
Q: Set parameter on a do while expressions So I have the following method inside my class:
    public function getBlobs(string $container, int $max) : array
    {
        try {
            $blobMeta = [];
            $blobOptions = new ListBlobsOptions();

            // Set the max results at 5000 (Default: 5000)
            $blobOptions->setMaxResults($max);

            do {
                // Grab the defined container
                $blob_list = $this->connect()->listBlobs($container, $blobOptions);

                // Loop through all the
                foreach ($blob_list->getBlobs() as $blob) {
                    $blobMeta[] = [
                        'name' => $blob->getName(),
                        'url' => $blob->getUrl(),
                    ];
                }
                $blobOptions->setContinuationToken($blob_list->getContinuationToken());

            } while ($blob_list->getContinuationToken());

            return $blobMeta;
        } catch (ServiceException $e) {
            return [];
        }
    }

Then I'm calling it like this:
$blobs = $test2->getBlobs('userpictures', 20);
var_dump($blobs);

Problem:
How would I be able to pass in a parameter so that I can call it like this:
$blobs = $test2->getBlobs('userpictures');
var_dump($blobs);

If I don't pass in a $max param, I'd like to not set a param and it'll be defined as 0 default and the continuousToken will execute on the do while.
$blobs = $test2->getBlobs('userpictures', 20);
var_dump($blobs);

If I pass in a second param, I'd like the continousToken not to execute.

A: There is probably multiple way to do it, I will give you an exemple of how you could achieve this kind of behaviour:
First, the parameters of the method, like any method, can have default value :
public function getBlobs(string $container, int $max = -1) : array

https://www.php.net/manual/en/functions.arguments.php#functions.arguments.default
So you could now call either $test2->getBlobs('userpictures'); or $test2->getBlobs('userpictures', 123);.
Just remember that default parameters have to be at the end (for now).
Then you can just check if the parameter is set to default or to any value to enter or not in your do {} while:
if ($max >= 0) do {}
  while ($blob_list->getContinuationToken());

So the condition would be never true if the second parameter is not set.


text:
Q: JDBC как начать работать Только начал изучать Java. Дошел до JDBC. Но многого не понимаю. Какую IDE использовать? Как должно осуществляться взаимодействие с MySQL? Как вообще сервер запустить?
.

A: Ответ на Ваши вопросы без постановки граничных условий требует отдельного написания нескольких книг. :) Хотя я Вас понимаю, когда-то сам искал хоть какую-то вменяемую зацепку - "с чего начать копать". Главное - начните таки копать, а не оставайтесь на уровне "спрошу-ка я на стеке или хабре, самому копнуть влом".
JDBC, работа с базами - глава 5. Хотя том 1 я тоже рекомендую прочитать и детально проработать, настраивает на нужный ход мыслей. В свое время именно он мне "почерк поставил", да еще, пожалуй, Роберт Мартин с его "Чистым кодом". Помогает независимо от текущего используемого языка, даже в работе с PHP. Кстати, в 1 томе найдете ответ на свой вопрос "Какую IDE использовать?"
Как установить MySQL - выбираете свою ОС, читаете, пробуете.
P.S. Селяви программиста всегда на 99% самообучение. А для этого в первую очередь нужно научиться учиться. И экспериментировать на практике. Удачи!

A: Сервер MySQL нужно установить если нет?
Подойдет любая IDE: NetBeans, Eclipse, IntelliJ IDEA.
Как должно осуществляться взаимодействие с MySQL? - качаешь jar'ник JDBC и по гайдам, обучалкам и/или видео-урокам следуешь шаг за шагом.
Как вообще сервер запустить? - он запускается при старте ОС если она не отключена в службах ОС.


text:
Q: Default directory permissions over NFS I have two servers, client and server in fairly obvious roles: server hosts the NFS share and client has it mounted. There is a shared group among several users on client called shared which also exists on server. My permissions on server for the share look like this:
user@server $ ls -al /export/share/
drwxrwsr-x+ 3 shared shared    4096 Apr 19 01:25 .
drwxr-xr-x  3 root  root       4096 Apr 12 20:10 ..

The goal is pretty clearly displayed, I'd like all members of the shared group to be able to create, write, and delete files in this directory. On client, a ls -la of the mounted directory leads the same results.
The NFS exports file on server looks like this:
/export/share 10.0.0.0/24(rw,nohide,insecure,no_subtree_check,async)

The mount on client in /etc/fstab looks like this:
10.0.0.1:/export/share /mnt/share nfs _netdev,noatime,intr,auto 0 0

The output of mount from client:
10.0.0.1:/export/share on /mnt/streams type nfs (rw,noatime,intr,vers=4,addr=10.0.0.1,clientaddr=10.0.0.2)

However, I still can't seem to be able to create files in that directory using a user in the group.
For instance, a user jack:
user@server $ id jack
uid=1001(jack) gid=1001(jack) groups=1001(jack),1010(shared)

If I try touching a file in the mounted folder on client, permission is denied:
user@client $ sudo -u jack touch /mnt/share/a
touch: cannot touch `/mnt/share/a': Permission denied

Why isn't this working as expected? Shouldn't I be able to create files and folders as jack in this folder since he's a member of the shared group?

A: How are you disseminating the user/group info that's contained in /etc/passwd and /etc/group? You typically need to use NIS, LDAP, or rsync the /etc/passwd /etc/group files to all the machines that are automounting these mounts. Otherwise the clients know nothing of the permissions on the filesystem.
You might want to peruse the NIS Howto.

A: NFS works with "groupid" and "userid", the actual numbers not the names.
Make sure that groups and users have the same id on both server and client.
Check /etc/passwd and /etc/group on both server and client.
An ideal setup is to have all users and groups shared over NIS or LDAP server.


text:
Q: How to get the defined field in sonataadmin query builder? There is the following code
    $form->with('Item')->add('parent', null, array(
                                        'label' => 'Category',
                                        'required' => true,
                                        'query_builder' =>
                                        function($er) use ($id) {
                                            $qb = $er->createQueryBuilder('p');
                                                if ($id){
                                                    $qb->where('p.id <> :id')
                                                       ->setParameter('id', $id);
                                                }
                                            $qb->orderBy('p.root, p.lft', 'ASC');
                                            return $qb;
                                         }
                                       .........

Result is the entity-objects collection which is given to the string (__toString method).
It return name-field.
But I need get the another field - url.
How to get url value instead the name in the select-list form?
The query_builder type return object => how to change this form that it works likewise query_builder?

A: I didn't work with SonataAdminBundle forms, but I think that it works absolutely like symfony forms. All that you need here is to add 'class' and 'property' values to your options list:
$form->with('Item')->add('parent', null, array(
    'class' => 'Acme\DemoBundle\Entity\Category',
    'property' => 'url',
    'label' => 'Category',
    'required' => true,
    'query_builder' =>
    function($er) use ($id) {
        $qb = $er->createQueryBuilder('p');
            if ($id){
                $qb->where('p.id <> :id')
                   ->setParameter('id', $id);
            }
        $qb->orderBy('p.root, p.lft', 'ASC');
        return $qb;
     }

property - is the name of the field in your entity that will represent your Entity's value instead of calling __toString().
But also... If you need always represent your Entity as URL you can simply override __toString() method in the Entity class to something like that:
public function __toString() {
    return $this->url;
}

A: In my case, ->orderBy() used in query_builder worked, but was overwritten for unknown reasons "somewhere" later. Fun fact: when I used extended => true, everything was rendered like sorted in the query_builder. But by using extended => false my <option>s are re-sorted before select2 touched it.
As a workaround I did this:
config/packages/twig.yaml
twig:
    paths:
        '%kernel.project_dir%/templates': '%kernel.project_dir%/templates'
        # This is to prevent a infinite loop when extending the parent template
        'vendor/sonata-project/admin-bundle/src/Resources/views': SonataAdminBundleOriginal

And then I done the sorting I wanted again in twig for the project entity:
templates/bundles/SonataAdminBundle/Form/form_admin_fields.html.twig:
{% extends '@SonataAdminBundleOriginal/Form/form_admin_fields.html.twig' %}

{%- block choice_widget_options -%}
    {% if name == 'project' %}
        {% set options = options|sort((a, b) => a.data.numberSortable <=> b.data.numberSortable)|reverse %}
    {% endif %}

    {{ parent() }}
{%- endblock choice_widget_options -%}

A: Just in case if someone needs to "filter" an entity by a FK (foreign key) just like i needed (and searched for 3 days), here is the solution:
In the __construct you can set/find what you need. In my case i work this "sessions" (year). So i find the session->status=true:
$this->sessionActive = $this->sessionRepository->findOneBy(['status'=>true]);

Then in the QueryBuilder:
protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface
    {
        $rootAlias = current($query->getRootAliases());
        $query
            ->select($rootAlias)
            ->where($rootAlias.'.session = :id')
            ->addOrderBy($rootAlias.'.dateStart', 'ASC')
            ->setParameter('id', $this->sessionActive->getId());
        return $query;
    }

Note: I have always one Session->status set to "true". If you might have null values don't forget to make a condition so that it doesn't give you an error!
Regards.


text:
Q: How to automate creation of elements? There is a task to create several img-elements and add for them a src, that will be immediately displayed.
I wrote this:
var mass_id = new Array();
for (var i = 0; i < links.length; i++) {
    var td = document.createElement('img');
    td.id = 'img'+i;
    td.src = links[i];
    mass_id.push(td);
    document.getElementById(td.id).src = links[i];
}

links is array of links to images.
But without adding in the begining  , i'm getting an error:

"Uncaught TypeError: Cannot set property 'src' of null"

So how can I fix that with avoiding ?

A: The problem is this line:
document.getElementById(td.id).src = links[i];

You're trying to retrieve the element that you have just created from the DOM, but you did not add it to the DOM in the first place. Additionally, there is no need to set src attribute twice. You need to add your virtual element into DOM, as such:
document.getElementsByTagName('body')[0].appendChild(td);

Consider following working snippet.

var mass_id = new Array();
var links = ["http://lorempixel.com/50/50/people/?1", "http://lorempixel.com/50/50/people/?2"]
for (var i = 0; i < links.length; i++) {
var td = document.createElement('img');
td.id = 'img'+i;
td.src = links[i];
mass_id.push(td);
document.getElementsByTagName('body')[0].appendChild(td);
}


text:
Q: Projective transformation between polygons. Extending my earlier question about linear transformations, what's the easiest way to test if there exists a projective linear transformation that takes one polygon to another (in $\mathbb{R}\mathbb{P}^2$)?

A: The answer Tim Gowers and Will Jagy gave you in response to your earlier question can be extended straightforwardly. A homogeneous linear transformation on R^3 has 3x3 - 1 = 4x2 degrees of freedom, so there is a unique projective-linear transformation between any given pair of non-degenerate quadrilaterals. Thus do with quadrilaterals what was done in the previous question with triangles.

A: A hacky way would be, enumerate the points of the two polygons (with adjacent points adjacent in the enumerations), as in $P_1 = [p_{1,1}, p_{1,2}, \ldots, p_{1,n}]$ and $P_2 = [p_{2,1}, \ldots, P_{2,n}]$, build N systems of linear equations, in the form $\forall i, \mathbf{T} p_{1,i} = p_{2,i+j}$ (indexed by $j$). There will be only N such systems, and if any one of them can be satistied (that is, it there is a $\mathbf{T}$ that takes all points $p_{1,i}$ into $p_{2,i+j}$ for some $j$) you have an answer.


text:
Q: SAS: PROC EXPORT adds a "_" in the Excel sheet name but the _ is not there in SAS? I have the following SAS code that exports to an .xls-file. (NB: I need the OLD 1997-2003 format).
I specify the sheet name to be: 'PB Organization'
but when the file is created the sheet name is 'PB_Organization'
An "_" has been added. What is happening?
PS: The file contains the right columns and rows, it is just the sheet name that is wrong.
%let Path_Org = "\\Folder\CurrentMonth - PB Organization";
proc export data=pb_org2
   outfile = &Path_Org
   dbms=xls replace;
   sheet = 'PB Organization';
run;

A: from SAS docs:
SHEET=sheet-name
identifies a particular spreadsheet in an Excel workbook. Use the SHEET= option only when you want to import an entire spreadsheet. If the EXPORT procedure sheet-name contains special characters (such as space) SAS converts it to an underscore.
The space is converted to an underscore. "Employee Information" becomes "Employee_Information"
see also here http://support.sas.com/documentation/cdl/en/acpcref/63184/HTML/default/viewer.htm#a003103761.htm


text:
Q: understanding the proof of Sylvester's law of inertia

This proof comes from Linear Algebra by Friedberg, Spence, Insel. I don't understand the last step in this proof, which I highlight with a purple line.  I understand that $\sum_{j=1}^n a_j^2 H(v_j, v_j) = \sum_{j=p+1}^r  H(v_j, v_j) $ since $a_i = 0$ for $i \le p$ and $H(v_i, v_i) = 0 $ for $i>r$. But, why $b_i =0$ for $i=1, ... , p$?
I appreciate if you give some help, and I apologize to ask you for reading a long proof.

A: The last term should not be $\sum_{j=p+1}^{r} b_j^2 H(w_j,w_j)$ but rather it should be
$\sum_{j=1}^{q} b_j^2 H(w_j,w_j) + \sum_{j=r+1}^{n} b_j^2 H(w_j,w_j)$, which is non-negative.


text:
Q: How to get a rolling_mean for 42 days of S&P 500 using pandas? sp500['42d']=np.round(pd.rolling_mean(sp500['Close'],window=42),2)

~\Anaconda3\lib\site-packages\pandas\__init__.py in __getattr__(name)
    212
    213   return Panel
--> 214 raise AttributeError("module 'pandas' has no attribute '{}'".format(name))
    215
    216

AttributeError: module 'pandas' has no attribute 'rolling_mean'

A: You can use rolling() followed by mean()
import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.randint(0,100, size=(100, 1)), columns=['close_price'])
df['rolling_mean_42d'] = df['close_price'].rolling(window=42).mean()
df

Please change your question title to highlight 'rolling mean in pandas'

A: sp500['42d'] = sp500['Close'].rolling(window=42).mean()


text:
Q: Question about trees and generalizing the Principle of Dependent Choices. One form of the Principle of Dependent Choices is that for any tree $T$ of height $\omega$ such that every node of $T$ has a successor, there is a branch of $T$ of length $\omega$. In this post, I give two different (but equivalent) characterizations for a generalization of the Principle of Dependent Choices. Does anyone know of any characterization of this generalization that is in the form of a theorem about trees?

A: The one you called $\text{DC}_\kappa(2)$ seems to be equivalent to the statement
"every tree of height $\le \kappa$ such that every branch of length $<\kappa$ can be continued has a branch of length $\kappa$."
This is also equivalent to the statement that every tree of height $\le \kappa$ has a maximal branch.
If every tree of height $\le \kappa$ has a maximal branch, and $T$ is a tree of height $\le \kappa$ such that every branch of length $<\kappa$ can be continued, then take a maximal branch.  It can't have length $<\kappa$, so it must have length $\kappa$.
Conversely, if every tree of height $\le \kappa$ such that every branch of length $<\kappa$ can be continued has a branch of length $\kappa$, and $T$ is a tree of height $\le \kappa$, either it has a branch of length $<\kappa$ that can't be continued, or it has a branch of length $\kappa$.  In either case, the branch is maximal.
By "tree of height $\le \kappa$" I mean a poset (with a least element, but this doesn't matter here) such that the set of predecessors of any given element is a well-ordering of length $<\kappa$.  By "branch" I mean a well-ordered (equivalently, linearly ordered) subset that is downward closed.  By "maximal"  I mean "maximal under inclusion."  By "can be continued" I mean "is not maximal."

A:
$\mathbf{DC}_\kappa(3)$. Every tree of height $\kappa$ in which every increasing sequence of $<\kappa$ points has an upper bound not in the sequence has a branch of length $\kappa$.

Note that this assumption implies that every point has a successor.
The assumption $\mathbf{DC}_\kappa(2)$ is implied this version. To see this, consider the $X$ and $R$ as in the requirement of $\mathbf{DC}_\kappa(2)$ and define the following subtree of $X^{<\kappa}$, $$f<_T g\iff \exists\beta<\kappa:g\upharpoonright\beta=f\land f\mathrel{R}g(\beta)$$
This is a tree of height $\kappa$, and if $\langle f_\gamma\mid\gamma<\lambda\rangle$ for some $\lambda<\kappa$ is an increasing sequence in $T$ then $f=\bigcup f_\gamma$ is an upper bound of the sequence, take any $x$ such that $f\mathrel{R} x$ and extend $f$ by one point with $x$, then this extension is an upper bound which is not in the sequence. Therefore there is a branch of length $\kappa$ in the tree. It is easy to see that the branch defines the function from $\kappa$ into $X$.
On the other direction if $\mathbf{DC}_\kappa(2)$ holds and $T$ is a tree of height $\kappa$ in which every short sequence has an upper bound not in the sequence, consider the relation $R$ on $T^{<\kappa}\times T$ defined by $f\mathrel{R} x$ if and only if $f$ is a branch cofinal strictly below $x$ or that $f$ does not define a branch but $x$ is a successor of someone which has no successors in the range of $f$ (or of a cofinal sequence below $x$ in the range of $f$). This is similar to what we did the previous time.
There is $f\colon\kappa\to T$ which we will now show must define a branch. For $0$, $f\upharpoonright 0\mathrel{R} f(0)$ which is to say that $f(0)$ has level zero, so we have a branch of length $1$.
Assume for $\beta<\alpha$ it holds that $f\upharpoonright\beta$ defines a branch below the $\beta+1$-th level. If $\alpha$ is a limit then for all $\beta<\alpha$ we have that $f$ defines a branch below the $\beta$ level, so it must be the same branch, so $f\upharpoonright\alpha$ must also define a branch up to level $\alpha+1$; if $\alpha=\beta+1$ then this is again have to be that we continue this branch.
Therefore $f$ is a branch of length $\kappa$ in $T$ as wanted.