text:
Q: Ruby On Rails - Grape - ActiveRecord from JSON body What is the correct way to create a new ActiveRecord from json using grape? Do I use attr_accessible in my User model to avoid ActiveModel::ForbiddenAttributesError or how does it work?
I'm using Rails 4.0.4 and ruby 1.9.3p545.
Model
class User < ActiveRecord::Base
  #maybe attr_accessible??
end

POST Body
{
  "first_name": "John",
  "last_name": "Doe"
}

Grape
version :v1, :format => :json
...
post do
  #what goes here?
  user = User.new params
  user.save!
end

A: The recommended way would be not to use mass-assignment, and go through assigning each of the params piecemeal. Like it's done in the Grape README examples.
If you feel strongly about using mass-assignment, you could use the protected_attributes gem to get the attr_accessible functionality.
But if you have so many params that you're tempted to use mass-assignment, that could be a smell that you need to refactor the resource being created.


text:
Q: c# wsdl The signature or decryption was invalid We have a third party client that has a web service that we call from our software after a certain transaction. They already provided us the url as well as the certificate for validation. Unfortunately every time we call the URL it gives us this error

System.ServiceModel.FaultException: The signature or decryption was invalid

This is my firstime integrating with soap and I don't know if the error is coming from our end. I hope you can give incites what I've missed. I already googled for 3 for an answer but no luck.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do you rename a folder in git and hide it with an interactive rebase? I have a project and during the course of the project I realized I don't like the name of a directory.
In GIT, we can rename the directory and then commit, but the history will still show the older folders.
I would like to rebase the name change as an earlier commit. So what I would normally do is:
git rebase -i origin/master

Then shift the folder rename commit to the top.
However, as expected git will yield a lot of conflicts that need to be resolved.
Is there a more automated way of doing this?

A: If it is something you haven't shared with anyone yet, which I infer that it is since you are trying to rebase it anyway, I would remove the commit that contains the renaming, and do a filter-branch.
Assuming that foo contains the first occurrence of the bad directory, and your rename is the latest commit:
git reset --hard HEAD^ # removes the rename commit
git filter-branch --tree-filter "mv bad good" foo^..HEAD

This will rename the bad directory to good.


text:
Q: How to separate a column The first column of my dataframe is a factor that contains two sets of information: the type of activation works (A1-4) and the month when it was carried out (about 50 observations in YYMM format). A simplified version could look like this:
A = data.frame(type.month=c("A1.1605", "A2.1605", "A1.1604", "A2.1604"), value=sample(1:4))

> A
  type.month value
1    A1.1605     2
2    A2.1605     4
3    A1.1604     1
4    A2.1604     3

I would like to get the types into one column and the months into another and I read that normally this could be done with the reshape2 package when the variables are neatly separated (say e.g. the first half is only A1 and the second half is only A2). However, mine alternate (A1,A2,A1...) and contain two information (type and month). Is reshape2 still a good tool in this case or I should think about something else?
My point is to keep the four type of activation works and months in one dataframe so that I do not have to store them in four different files.

A: This separates the string using tidyr function separate:
A = data.frame(type.month=c("A1.1605", "A2.1605", "A1.1604", "A2.1604"), value=sample(1:4))

library(dplyr)
library(tidyr)
A %>% separate(type.month, c('type','month')) %>% arrange(type, desc(month))

gives
type  month      value
A1    1605       4
A1    1604       2
A2    1605       1
A2    1604       3

A: Drat, I forgot to mention regular expressions. You'll have to escape out the period like this:
library(stringr)
str_split_fixed(A$type.month, "\\.", 2)


text:
Q: AWS S3 transferutility UploadAsync succeeds but does not create file I got to upload file & streams to S3 periodically and the file size usually under 50MB. What am seeing is TransferUtility.UploadAsync method returns success but the file was never created. This occurs sporadically. Below is the code we use. Any suggestions around this?
public TransferUtilityUploadRequest CreateRequest(string bucket, string path)
    {
        var request = new TransferUtilityUploadRequest
        {
            BucketName = bucket,
            StorageClass = S3StorageClass.Standard,
            Key = path,
            AutoCloseStream = true,
            CannedACL = S3CannedACL.AuthenticatedRead,
            ServerSideEncryptionMethod = ServerSideEncryptionMethod.AES256
        };

        return request;
    }

    public async Task CreateS3ObjectFromStreamAsync(MemoryStream memeoryStream, string bucket, string filePath)
    {
                var ftu = new TransferUtility(client);
                var request = CreateRequest(bucket, filePath);
                request.InputStream = memeoryStream;
                await ftu.UploadAsync(request);

    }

    public async Task CreateS3ObjectFromFileAsync(string sourceFilePath, string bucketName, string destpath)
    {
                var request = CreateRequest(bucketName, destpath);
                request.FilePath = sourceFilePath;
                var ftu = new TransferUtility(client);
                await ftu.UploadAsync(request);
    }

A: Please use Upload or UploadAsync.Wait. It worked for me!


text:
Q: Why do i get the following error while running a java web application? I am following this tutorial
http://netbeans.org/kb/docs/web/quickstart-webapps.html
and as mentioned i have created two jsp pages.My index.jsp page looks like this
%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

        Name<form name="Name Input Form" action="response.jsp">
            <input type="text" name="name" value="" />
            <input type="submit" value="OK" />
        </form>

and my response.jsp looks like this
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

        <jsp:useBean id="useBean" scope="session" class="abc.NameHandler" />

        <jsp:setProperty name="myBean" property="name" />
Hello

        <jsp:getProperty name="myBean" property="name" />

and i have created a package named abc where i ave defined a class named NameHandler.
package abc;

public class NameHandler
{

    private String name;

    public NameHandler()
    {
        name =null;

    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }
}

when i run the project index.jsp is displayed correctly and it commands to enter a name and it has a submit button.Now when i press the submit button i get the following error.
HTTP Status 500 -

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.NullPointerException

root cause

java.lang.NullPointerException

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1 logs.
GlassFish Server Open Source Edition 3.1

ANd i have no idea why i get this error.Could anyone please explain?
[UPDATE]
What does this error means?
WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
    at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:368)
    at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:354)
    at org.apache.jsp.response_jsp._jspService(response_jsp.java from :68)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:619)

A: Id and name of bean in jsp:useBean and jsp:setProperty / jsp:getProperty should match:
   <jsp:useBean id="myBean" scope="session" class="abc.NameHandler" />

   <jsp:setProperty name="myBean" property="name" />
Hello

   <jsp:getProperty name="myBean" property="name" />


text:
Q: New motor only rotates clockwise I stared out with the 28byj-48 motor and got it to rotate one direction with one button and the other direction with the other button using Arduino pins 2 and 4, respectfully. When the new motor, pictured, is plugged in, I can only get it to rotate one way and it's made to go both ways. Pin 4 no longer responds when using this new motor.
How do I get the new motor to turn both ways?
Do I need to reorganize the 5 wires in the new motor and use a multimeter to determine the correct order or is the issue with some other part of this project?
I'm using the uln2003 driver board.
Thank you!

A: Looks like the blue and yellow wires are going to the motor and the other wires are an encoder? 5K pot for position sensing? Looks like that was used as limited rotation servo. Component on the back of the motor looks like a filter capacitor to try to keep commutator noise out of the control circuit. Use a full Bridge motor driver to control the motor on the blue and yellow wires. Red wire to the Arduino Vcc and black to GND, white to an analog input. Make sure you don't drive that pot too far, 270 degrees or so is all it's likely to take before it breaks. You'll probably need to rewrite some code to make that work if you were using a stepper previously and just counting the steps in open loop mode to track the position. With this new setup, you'll need to run closed loop to prevent driving the servo mechanism too far.


text:
Q: Get SPUser object I am trying this code to get SPUser object but it keeps throwing exception of user not found even when it returns true for DoesUserHavePermissions(..., does anyone know any fix or way around ?
if (web.Site.RootWeb.DoesUserHavePermissions("UserLoginName", SPBasePermissions.Open))
{
   SPUser user = web.Site.RootWeb.Users["UserLoginName"];
}

Can't use web.Ensure

A: According to MSDN:

*

*SPWeb.Users contains user objects that are explicitly assigned permissions in the website.

*SPWeb.AllUsers contains user objects that represents all users who are either members of the site or who have browsed to the site as authenticated members of a domain group in the site.

So use AllUsers collection
 SPUser user = web.Site.RootWeb.AllUsers["UserLoginName"];


text:
Q: How to determine a match between 2 JSONs? I have two data sources, and both of them return JSONs.
I want to ensure that there is some percentage of match (overlap of data, if you will) in the two JSONs, so as to collate them and store in a single record.
Is comparing the entropy of the two strings the best way? Are there any other solutions? I use Java, and could also use scala for the same.

A: You can convert them to xml and then use xdiff algorithm, or put every json record to a single line, and use unix diff. Or convert it to an internal tree representation, and apply parallel tree difference algorithm. That depends on what kind of difference are you looking for and doesn't depend on the implementation language.


text:
Q: I have query which insert rows in table, this table have add trigger, when I run this query this trigger raise error as follows: Error

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Error Number:       512
  Error Severity:      16
  Error State:          1
Error Procedure: AddBookingSlots

Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[AddDoctorBookingSlots]
ON [dbo].[BookingDay]
AFTER INSERT AS
BEGIN
    DECLARE @starttime AS DATETIME = (SELECT MyDateTime1 = CAST([Day] AS DATETIME) + CAST(DayFrom AS DATETIME)
                                      FROM INSERTED)
    DECLARE @endtime AS DATETIME = (SELECT MyDateTime1 = CAST([Day] AS DATETIME) + CAST(DayTo AS DATETIME)
                                      FROM INSERTED)
    DECLARE @waitingtime AS INT = (SELECT WaitingTime FROM INSERTED)

    WHILE (@starttime <= @endtime)
    BEGIN
        INSERT INTO [dbo].[Booking] ([DoctorID], [Day], [Time], [Fees], [Valid],
                                     [PatientPhone], [BookingDayID],[PatientName], [PatientEmail],
                                     [NoShow], [PackageID], [IsFree],[IsEditable],
                                     [Shift], [CancelledByDoctor],[CancelledByUser],
                                     [UserId], [UpdatedBy])
        VALUES ((SELECT DoctorID FROM INSERTED),
                (SELECT [Day] FROM INSERTED),
                (SELECT CONVERT(CHAR(5), @starttime, 108)),
                (SELECT ExaminationFees FROM Doctor
                 WHERE DoctorID = (SELECT DoctorID FROM INSERTED)), 1, NULL,
                (SELECT BookingDayID FROM INSERTED), NULL, NULL, 0,
                (SELECT [SubscribtionPackage] FROM Doctor
                 WHERE DoctorID = (SELECT DoctorID FROM INSERTED)), 0, 0,
                (SELECT [Shift] FROM INSERTED), 0, 0,
                (SELECT UserId FROM INSERTED),
                (SELECT UpdatedBy FROM INSERTED))

        SET @starttime = DATEADD(minute, @waitingtime, @starttime)
    END
END

A: Inserted may contain many rows - which is the cause of the error. You should probably ditch the values insert method and replace with the select insert method possibly like this
SELECT I.DoctorID
           ,i.[Day]
            , convert(char(5), @starttime, 108)
           ,d.ExaminationFees
           ,1
           ,null
           ,i.BookingDayID
           ,null
           ,null
           ,0
           ,d.[SubscribtionPackage]
           ,0
           ,0
           ,i.[Shift]
           ,0,0,
           i.UserId,
           i.UpdatedBy
From INSERTED i
join doctor d on d.DoctorID=i.doctorid

I have no way of telling how doctor relates to inserted so you may need to adjust to your needs.


text:
Q: "He was made to feel guilty."
He was made to feel guilty.

or

He is made to be felt guilty.

What is the difference between these two sentences. I'b appreciated if someone could explain me how to use "made to be..." phrase.

A: The phrase make somebody feel guilty can indeed be put in the passive:

He was made to feel guilty.

But it's only the matrix verb (make) that can be made passive. The embedded verb feel [guilty] is intransitive (in this sense), and so does not have a passive: be felt guilty is not grammatical.


text:
Q: Flutter AppBar IconSize Invalid Constant Value? CustomAppBar(PreferredSize Widget Size.FromHeight(60))
I'm trying to make a custom appbar and using in leading IconButton,
when I try to IconButton in icon size I got an invalid constant value error
This is my circle icon back button code:
class CircleBackButton extends StatelessWidget {
  CircleBackButton({
    Key? key,
    this.width,
    this.height,
    this.iconSize
  }) : super(key: key);

  double? width = 35;
  double? height = 35;
  final double? iconSize;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: width,
      decoration: BoxDecoration(
          shape: BoxShape.circle,
          border: Border.all(color: secondary.withOpacity(0.2))),
      child: const Center(
        child: Icon(
          Icons.arrow_back_ios_new,
          size: **iconSize**,
          color: secondary,
        ),
      ),
    );
  }
}

What am I doing wrong, I don't understand.

A: You need to remove the constkeyword before your Center widget, like so:
class CircleBackButton extends StatelessWidget {
  CircleBackButton({
    Key? key,
    this.width,
    this.height,
    this.iconSize
  }) : super(key: key);

  double? width = 35;
  double? height = 35;
  final double? iconSize;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: width,
      decoration: BoxDecoration(
          shape: BoxShape.circle,
          border: Border.all(color: secondary.withOpacity(0.2))),
      child: Center( // <-- no const here
        child: Icon(
          Icons.arrow_back_ios_new,
          size: iconSize,
          color: secondary,
        ),
      ),
    );
  }
}

Your Center widget is not constant (as the const keyword would imply) since the size of its child depends on iconSize which is not a compile time constant.

A: Remove const from Center because it is reading it data on runtime.
child: Center(
  child: Icon(
    Icons.arrow_back_ios_new,
    size: iconSize,


text:
Q: Special case of Green's imprimitivity theorem and related question Consider a locally compact group $G$ and a closed subgroup $H$ of $G$, and let $G$ act on $G/H$ by left translation. Green's imprimitivity theorem implies that the crossed product $C_0(G/H)\rtimes G$ is Morita equivalent to $C^*(H)$. With more work, one shows that the crossed product is isomorphic to $C^*(H)\otimes K(L^2(G/H))$.
Is there a simpler direct proof of the above for the reduced crossed product in the case where $G$ is discrete? I can do the case of $G$ acting on itself by left translation, but can I transfer the idea to the case above?
Maybe computing an explicit example may help me. So I considered $\mathbb{Z}_4$ acting on $\mathbb{Z}_4/\mathbb{Z}_2$, and the above tells me that I should be getting $M_2(\mathbb{C})\otimes \mathbb{C}^2$. My intuition tells me that this is because 2 acts the same way as 0, while 3 acts the same way as 1. I've been trying to write down an explicit isomorphism but I haven't been able to do so.
Also, suppose $K$ is a finite subgroup of a discrete group $G$, and $S$ is a $K$-space. Let $K$ act on $G\times S$ by $k(g,s)=(gk^{-1},ks)$, and let $G\times_KS$ be the orbit space. $G$ acts on $G\times_KS$ by $g[h,s]=[gh,s]$. When $G$ acts properly on some locally compact Hausdorff space $X$, every point in $X$ has a $G$-invariant open neighborhood that is $G$-homeomorphic to one of these ''twisted products''.
How do we describe the (reduced) crossed product of $G\times_KS$ by $G$ up to isomorphism or Morita equivalence? It seems to me that the action of $G$ on $G\times_KS$ looks very much like the action of $G$ on $G/K$ so it should be somehow related to the result above.


text:
Q: OpenID login (steam) with AngularJS, socket.io and node.js using JWT I am wondering what is the safe way to login using OpenID in my AngularJS app, with a Node.js backend and socket.io for the real-time.
The thing is that OpenID forces me to use a new window for the redirection dance, so my setup is:

*

*Angularjs renders a view with a button. (this remains open)

*The button opens a new window and loads my backend, /auth/openid/
where I set the afterlogin url and redirect to openid site

*The openid site redirects to my afterlogin backend
/auth/afteropenid/ where I handle the user data and create a
JsonWebToken.

My problem is that I dont really know what is the best way to continue.
I have to send somehow the JWT to the AngularJS.
One of the ways I see is passing in the query to AngularJS, here I could do everything in the same window, angular > openidsite > angular(with token in querystring). I would configure AngularJS to handle a route and work with the token. I dont know how safe if this, putting the JWT in the querystring seems like a bad idea.
The other way I see is using socket.io, my app already uses this, I am not including it just for the openID login.

*

*When I open the new window, I put the ID of the open socket,
/auth/openid?socketID=XXXXXX

*Then, after the openID site redirects back to the backend,
/auth/afteropenid?socketID=XXXXXX  , I create the JWT and I send it
using the socket.io to the AngularJS open socket.

In similar questions I see that there is way of doing this by setting a cookie with the token and then making a redirect to the angularJS.
I think my approach would work and has less redirects but I am new to this and maybe I am not thinking in everything, I dont know how could this be exploited since the server only pass user info using the socket. The caveat is that the original angularJS window should remain open but that is acceptable in my situation.


text:
Q: What does the "atta" mean in "attaboy" and "attagirl"? What does the prefix atta mean? What is it trying to abbreviate? What a? Wiktionary claims that it stands for that's a or that's the, but I do not see the resemblance to atta.

A: It comes from "That's a good boy," through a series of shortenings.

*

*That's a good boy.

*That's a boy. (or, "That's the boy")

*'at's a boy.

*atta boy.

A: First of all, Etymonline agrees:

1909, from common pronunciation of "that's the boy!" a cheer of encouragement or approval.

Merriam-Webster throws in a "probably" for good measure:

probably alteration of that's the boy
First Known Use: 1909

The most extended discussion I was able to find is in the Dictionary of Slang and Unconventional English by Eric Partridge:

attaboy! Go it!: US (— 1917); anglicised in 1918. (F. & G.) The OED and Collinson
  derive it from that's the boy!, but possibly it represents at her, boy!, where
  her is sexless; probably, however, it is a corruption of the exclamatory US staboy
  recorded by Thornton. Dr Douglas Leechman, that eminent anthropologist and notable contributor
  to the Dictionary of Canadian English, wrote to me in 1969: 'Everybody, except the pundits,
  knows that this is "That's the boy"—"'at's a boy"—"atta boy".'—2. Hence, an approbatory
  exclam. from ca. 1931, as in D.L. Sayers, Murder Must Advertise, 1933, '"Picture of
  nice girl bending down to put the cushion in the corner of the [railway] carriage. And
  the headline [of the advertistement]? 'Don't let them pinch your seat.'" "Attaboy!"
  said Mr Bredon [Lord Peter Wimsey].'—3. (As Attaboy) an Air Transport Auxiliary
  'plane or member: WW2, then nostalgic. (Jackson.) Suggested by the intitials and punning
  on senses 1 and 2. See Ancient and Tattered Airmen or Aviators.


text:
Q: A deployment problem of Firebase cloud functions I've created my Firebase cloud functions as follows:
index.js: -----------------------------------
const _test1 = require('./testfunc');
exports.test1 = _test1.test1;

const _test2 = require('./testfunc');
exports.test2 = _test2.test2;

testfunc.js: -----------------------------------
const functions = require('firebase-functions');
const common = require('./testCommon');

exports.test1 = functions.https.onRequest((req, res) => {
    res.send(common.coreWork());
});

exports.test2 = functions.https.onRequest((req, res) => {
    res.send(common.coreWork());
});

testCommon.js -----------------------
exports.coreWork = function () {
    return 'My name is John';
}

Then I deployed the functions:
firebase deploy --only functions: test1
firebase deploy --only functions: test2

First test result:
Result of test1 => 'My name is John'
Result of test2 => 'My name is John'

Then I made a modification (John -> Peter) in the common function:
exports.coreWork = function () {
    return 'My name is Peter';
}

Then, I just deployed function test1 again.
firebase deploy --only functions: test1

Second test result:
Result of test1 => 'My name is Peter'
Result of test2 => 'My name is John'  ('Peter' was expected, but in fact it is still 'John')

The problem:
My original thought is that since the common function will be updated when function test1 is updated, function test2 should be following the update implicitly as well. But in fact, it doesn't work. If I want function test2 to be updated, I have to explicitly do the deployment (for test2) again.
So if I want the functions to be updated the way I originally expected, what should I do? Thanks.

A: The behavior you're observe is working as expected. Each function deployment is completely isolated from each other - each one has its own copy of the code.  Deploying a function will never alter the way another function works.
If you want test2 to behave differently after modifying your code, you will have to deploy it again.


text:
Q: Fully-qualified macro is undefined I'm just experimenting with macros. I've this:
src/entry.rs
#[macro_export]
macro_rules! initialize {
    ($lambda_exp:expr) => {
        fn main() {
            $lambda_exp();
        }
    };
}

I want to use that to wrap the program entry point. I can basically do this:
src/main.rs
mod entry;

#[macro_use]
use entry::*;

initialize!(|| {
    println!("Hello!");
});

However I'd like to omit that use directive and fully qualify the macro:
src/main.rs
mod entry;

entry::initialize!(|| {
    println!("Hello!");
});

The compiler tells entry::initialize is undefined. What am I missing?


text:
Q: Sql query to join two table for the final output Below are the two tables, customer and department. I am struggling very hard to get the output.
I want to write the query which shows only the department name which have maximum number of employees.

Answer should be like this ...

Please help me to write the query.

A: I would suggest using a sub-query, and then selecting from that query. With the outer select, you order by the number of employees and then limit it to 1. This will give you the top department, but also has the flexibility to be modified to give you a list of the x-number of top departments.
SELECT Dep_Name FROM (
    SELECT
        d.Dep_Name, COUNT(*) AS `count`
    FROM
        Departments d
        JOIN Employees e ON e.Dep_id = d.Dep_id
    GROUP BY
        d.Dep_id
) AS q

ORDER BY `count` DESC
LIMIT 1

UPDATE
Per a comment by @Dems, you can actually handle this without a sub-query:
SELECT
    d.Dep_Name
FROM
    Departments d
    JOIN Employees e ON e.Dep_id = d.Dep_id
GROUP BY
    d.Dep_id
ORDER BY
    COUNT(*) DESC
LIMIT 1

A:             SELECT *
            FROM
            (
                SELECT
                  d.dep_id,
                  d.dep_name,
                  count(c.cus_id) cusCount
                FROM
                  cus c,
                  dep d
                WHERE
                  c.dep_id = d.dep_id
                GROUP BY
                  d.dep_id,d.dep_name
                ORDER BY
                  cusCount desc)
            WHERE
              ROWNUM = 1;

A: I created cus  & dep tables in Oracle 10g database and tested my code successfully.
What database are you using, and could you post you code.
There error message shows that your "Order by" clause is wrong.


text:
Q: Any clue from the console output after a jvm crash? Just after a brutal crash of java 8 rcp app i had the message bellow, i looked into the pid file but nothing conclusive.
Does the output console message bellow give any clue to identify the cause of the crash?
 # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode windows-amd64 compressed oops)
    # Problematic frame:
    # C  0x000000005a3004fa
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\Users\Desktop\eclipse\hs_err_pid2388.log
    Compiled method (nm)  824447 8663     n 0       org.eclipse.swt.internal.win32.OS::HeapAlloc (native)
     total in heap  [0x0000000004417490,0x0000000004417808] = 888
     relocation     [0x00000000044175b0,0x00000000044175f8] = 72
     main code      [0x0000000004417600,0x0000000004417800] = 512
     oops           [0x0000000004417800,0x0000000004417808] = 8
    #
    # If you would like to submit a bug report, please visit:
    #   http://bugreport.java.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #

and bellow the history of Garbage Collection and other details from the pid file, is there any obvious or suspicions event?
Heap:  par new generation   total 94592K, used 13799K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   8% used [0x0000000700000000, 0x00000007006e2490, 0x0000000705220000)   from space 10496K,  64% used [0x0000000705c60000, 0x00000007062f79e0, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 324024K, used 201417K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150371K, capacity 165839K, committed 165976K, reserved 1191936K   class space    used 18545K, capacity 22644K, committed 22672K, reserved 1048576K

Card table byte_map: [0x00000000124c0000,0x0000000012ad0000] byte_map_base: 0x000000000ecc0000

Marking Bits: (CMSBitMap*) 0x0000000002314478  Bits: [0x0000000013250000, 0x0000000015d1d000)

Mod Union Table: (CMSBitMap*) 0x0000000002314538  Bits: [0x0000000001cc0000, 0x0000000001d6b340)

Polling page: 0x0000000000440000

CodeCache: size=245760Kb used=83671Kb max_used=83671Kb free=162088Kb  bounds [0x00000000029a0000, 0x0000000007be0000, 0x00000000119a0000]  total_blobs=23005 nmethods=21421 adapters=1495  compilation: enabled

Compilation events (10 events): Event: 824.132 Thread 0x0000000018dac800 28876   !   3       java.awt.Container::clearMostRecentFocusOwnerOnHide (117 bytes) Event:
824.133 Thread 0x0000000018dac800 nmethod 28876 0x0000000007bc7f10 code [0x0000000007bc81a0, 0x0000000007bc9968] Event: 824.133 Thread 0x0000000018dac800 28878       3       sun.util.locale.provider.TimeZoneNameUtility::retrieveDisplayNamesImpl (205 bytes) Event: 824.135 Thread 0x0000000018dac800 nmethod 28878 0x0000000007bca450 code [0x0000000007bca760, 0x0000000007bcc5b8] Event: 824.135 Thread 0x0000000018dac800 28877       3       sun.util.locale.provider.TimeZoneNameUtility::retrieveDisplayName (32 bytes) Event: 824.135 Thread 0x0000000018dac800 nmethod 28877 0x0000000007bc4a10 code [0x0000000007bc4b80, 0x0000000007bc4ea8] Event: 824.176 Thread 0x0000000018dac800 28879       3       com.klg.jclass.chart.JCStyle::setChanged (17 bytes) Event: 824.176 Thread 0x0000000018dac800 nmethod 28879 0x0000000007bbf790 code [0x0000000007bbf900, 0x0000000007bbfae8] Event: 824.198 Thread 0x0000000018dac800 28880       3       org.jscience.physics.units.Unit::getTransform (205 bytes) Event:
824.200 Thread 0x0000000018dac800 nmethod 28880 0x0000000007bcd390 code [0x0000000007bcd7c0, 0x0000000007bd0198]

GC Heap History (10 events): Event: 807.831 GC heap before {Heap before GC invocations=124 (full 6):  par new generation   total 94592K, used 90429K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K, 100% used [0x0000000700000000, 0x0000000705220000, 0x0000000705220000)   from space 10496K,  60% used [0x0000000705220000, 0x000000070584f688, 0x0000000705c60000)   to   space 10496K,   0% used [0x0000000705c60000, 0x0000000705c60000, 0x00000007066a0000)  concurrent mark-sweep generation total 270020K, used 247786K [0x0000000714cc0000, 0x0000000725471000, 0x00000007c0000000)  Metaspace       used 149979K, capacity 165215K, committed 165464K, reserved 1191936K   class space    used 18533K, capacity 22636K, committed 22672K, reserved 1048576K Event: 807.840 GC heap after Heap after GC invocations=125 (full 6):  par new generation   total 94592K, used 8645K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   0% used [0x0000000700000000, 0x0000000700000000, 0x0000000705220000)   from space 10496K,  82% used [0x0000000705c60000, 0x00000007064d1448, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 270020K, used 248545K [0x0000000714cc0000, 0x0000000725471000, 0x00000007c0000000)  Metaspace       used 149979K, capacity 165215K, committed 165464K, reserved 1191936K   class space    used 18533K, capacity 22636K, committed 22672K, reserved 1048576K } Event: 813.547 GC heap before {Heap before GC invocations=125 (full 7):  par new generation   total 94592K, used 92741K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K, 100% used [0x0000000700000000, 0x0000000705220000, 0x0000000705220000)   from space 10496K,  82% used [0x0000000705c60000, 0x00000007064d1448, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 324024K, used 194412K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150128K, capacity 165443K, committed 165720K, reserved 1191936K   class space    used 18536K, capacity 22642K, committed 22672K, reserved 1048576K Event: 813.556 GC heap after Heap after GC invocations=126 (full 7):  par new generation   total 94592K, used 10496K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   0% used [0x0000000700000000, 0x0000000700000000, 0x0000000705220000)   from space 10496K, 100% used [0x0000000705220000, 0x0000000705c60000, 0x0000000705c60000)   to   space 10496K,   0% used [0x0000000705c60000, 0x0000000705c60000, 0x00000007066a0000)  concurrent mark-sweep generation total 324024K, used 195226K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150128K, capacity 165443K, committed 165720K, reserved 1191936K   class space    used 18536K, capacity 22642K, committed 22672K, reserved 1048576K } Event: 818.730 GC heap before {Heap before GC invocations=126 (full 7):  par new generation   total 94592K, used 94592K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K, 100% used [0x0000000700000000, 0x0000000705220000, 0x0000000705220000)   from space 10496K, 100% used [0x0000000705220000, 0x0000000705c60000, 0x0000000705c60000)   to   space 10496K,   0% used [0x0000000705c60000, 0x0000000705c60000, 0x00000007066a0000)  concurrent mark-sweep generation total 324024K, used 195226K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150229K, capacity 165635K, committed 165720K, reserved 1191936K   class space    used 18543K, capacity 22642K, committed 22672K, reserved 1048576K Event: 818.745 GC heap after Heap after GC invocations=127 (full 7):  par new generation   total 94592K, used 9407K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   0% used [0x0000000700000000, 0x0000000700000000, 0x0000000705220000)   from space 10496K,  89% used [0x0000000705c60000, 0x000000070658fec0, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 324024K, used 199782K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150229K, capacity 165635K, committed 165720K, reserved 1191936K   class space    used 18543K, capacity 22642K, committed 22672K, reserved 1048576K } Event: 821.350 GC heap before {Heap before GC invocations=127 (full 7):  par new generation   total 94592K, used 93503K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K, 100% used [0x0000000700000000, 0x0000000705220000, 0x0000000705220000)   from space 10496K,  89% used [0x0000000705c60000, 0x000000070658fec0, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 324024K, used 199782K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150301K, capacity 165763K, committed 165976K, reserved 1191936K   class space    used 18544K, capacity 22642K, committed 22672K, reserved 1048576K Event: 821.359 GC heap after Heap after GC invocations=128 (full 7):  par new generation   total 94592K, used 6812K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   0% used [0x0000000700000000, 0x0000000700000000, 0x0000000705220000)   from space 10496K,  64% used [0x0000000705220000, 0x00000007058c7280, 0x0000000705c60000)   to   space 10496K,   0% used [0x0000000705c60000, 0x0000000705c60000, 0x00000007066a0000)  concurrent mark-sweep generation total 324024K, used 199782K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150301K, capacity 165763K, committed 165976K, reserved 1191936K   class space    used 18544K, capacity 22642K, committed 22672K, reserved 1048576K } Event: 823.902 GC heap before {Heap before GC invocations=128 (full 7):  par new generation   total 94592K, used 90908K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K, 100% used [0x0000000700000000, 0x0000000705220000, 0x0000000705220000)   from space 10496K,  64% used [0x0000000705220000, 0x00000007058c7280, 0x0000000705c60000)   to   space 10496K,   0% used [0x0000000705c60000, 0x0000000705c60000, 0x00000007066a0000)  concurrent mark-sweep generation total 324024K, used 199782K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150360K, capacity 165839K, committed 165976K, reserved 1191936K   class space    used 18545K, capacity 22644K, committed 22672K, reserved 1048576K Event: 823.911 GC heap after Heap after GC invocations=129 (full 7):  par new generation   total 94592K, used 6750K [0x0000000700000000, 0x00000007066a0000, 0x0000000714cc0000)   eden space 84096K,   0% used [0x0000000700000000, 0x0000000700000000, 0x0000000705220000)   from space 10496K,  64% used [0x0000000705c60000, 0x00000007062f79e0, 0x00000007066a0000)   to   space 10496K,   0% used [0x0000000705220000, 0x0000000705220000, 0x0000000705c60000)  concurrent mark-sweep generation total 324024K, used 201417K [0x0000000714cc0000, 0x000000072892e000, 0x00000007c0000000)  Metaspace       used 150360K, capacity 165839K, committed 165976K, reserved 1191936K   class space    used 18545K, capacity 22644K, committed 22672K, reserved 1048576K }

Deoptimization events (10 events): Event: 822.271 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000034d9238 method=java.lang.Class.getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; @ 61 Event: 822.271 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000034d9238 method=java.lang.Class.getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; @ 61 Event: 822.271 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000034d9238 method=java.lang.Class.getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; @ 61 Event: 822.438 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.532 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.534 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.536 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.537 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.539 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127 Event: 822.547 Thread 0x00000000022b8800 Uncommon trap: reason=unhandled action=none pc=0x00000000039b2068 method=org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(Ljava/lang/String;Ljava/util/List;)Ljava/lang/Class; @ 127

Internal exceptions (10 events): Event: 788.016 Thread 0x00000000022b8800 Implicit null exception at 0x000000000691bb5d to 0x000000000691bd81 Event: 789.196 Thread 0x00000000022b8800 Implicit null exception at 0x00000000045b3bf8 to 0x00000000045b5d7d Event:
789.466 Thread 0x00000000022b8800 Implicit null exception at 0x0000000002be87d3 to 0x0000000002be88c5 Event: 790.315 Thread 0x00000000022b8800 Implicit null exception at 0x0000000006b095b4 to 0x0000000006b0a5dd Event: 790.336 Thread 0x00000000022b8800 Implicit null exception at 0x0000000002b6a929 to 0x0000000002b6aa10 Event:
806.346 Thread 0x00000000022b8800 Implicit null exception at 0x00000000047b464e to 0x00000000047bc63d Event: 806.368 Thread 0x00000000022b8800 Implicit null exception at 0x0000000004ed19c6 to 0x0000000004edf009 Event: 817.328 Thread 0x0000000022a30000 Exception <a 'java/net/ConnectException': Connection refused: connect> (0x0000000701640640) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\src\share\vm\prims\jni.cpp, line 735] Event: 818.693 Thread 0x00000000022b8800 Implicit null exception at 0x0000000004d5a9d4 to 0x0000000004d5ab26 Event: 821.145 Thread 0x000000001b0fa000 Exception <a 'java/lang/InterruptedException': sleep interrupted> (0x00000007037b5bd8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u102\7268\hotspot\src\share\vm\prims\jvm.cpp, line 3215]

Events (10 events): Event: 823.709 Executing VM operation: RevokeBias done Event: 823.853 Executing VM operation: RevokeBias Event: 823.853 Executing VM operation: RevokeBias done Event: 823.901 Executing VM operation: GenCollectForAllocation Event: 823.911 Executing VM operation: GenCollectForAllocation done Event: 824.021 Executing VM operation: RevokeBias Event: 824.022 Executing VM operation: RevokeBias done Event: 824.054 Thread 0x000000001d5b4800 Thread added: 0x000000001d5b4800 Event: 824.176 Executing VM operation: RevokeBias Event: 824.176 Executing VM operation: RevokeBias done

Dynamic libraries: 0x000000013fb40000 - 0x000000013fb77000  C:\Program Files\Java\jre1.8.0_102\bin\javaw.exe 0x00000000777b0000 - 0x000000007795a000    C:\windows\SYSTEM32\ntdll.dll 0x0000000077690000 - 0x00000000777af000   C:\windows\system32\kernel32.dll 0x000007fefd5d0000 - 0x000007fefd63a000    C:\windows\system32\KERNELBASE.dll 0x000007feff8e0000 - 0x000007feff9bb000  C:\windows\system32\ADVAPI32.dll 0x000007feff570000 - 0x000007feff60f000    C:\windows\system32\msvcrt.dll 0x000007feff640000 - 0x000007feff65f000  C:\windows\SYSTEM32\sechost.dll 0x000007fefef00000
- 0x000007feff02d000    C:\windows\system32\RPCRT4.dll 0x0000000077590000 - 0x000000007768a000  C:\windows\system32\USER32.dll 0x000007feff2b0000 - 0x000007feff317000  C:\windows\system32\GDI32.dll 0x000007fefeed0000 - 0x000007fefeede000   C:\windows\system32\LPK.dll 0x000007fefd8b0000 - 0x000007fefd97a000     C:\windows\system32\USP10.dll 0x000007fefb710000 - 0x000007fefb904000   C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll 0x000007feffa40000 - 0x000007feffab1000    C:\windows\system32\SHLWAPI.dll 0x000007feff610000 - 0x000007feff63e000     C:\windows\system32\IMM32.DLL 0x000007feff380000 - 0x000007feff489000   C:\windows\system32\MSCTF.dll 0x0000000075230000 - 0x0000000075269000   C:\PROGRA~2\Sophos\SOPHOS~1\SOPHOS~2.DLL 0x0000000077980000 - 0x0000000077987000    C:\windows\system32\PSAPI.DLL 0x00000000648b0000 - 0x0000000064981000   C:\Program Files\Java\jre1.8.0_102\bin\msvcr100.dll 0x00000000619f0000 - 0x000000006228a000     C:\Program Files\Java\jre1.8.0_102\bin\server\jvm.dll 0x000007fef91c0000 - 0x000007fef91c9000   C:\windows\system32\WSOCK32.dll 0x000007feff030000
- 0x000007feff07d000    C:\windows\system32\WS2_32.dll 0x000007fefd8a0000 - 0x000007fefd8a8000  C:\windows\system32\NSI.dll 0x000007fefaf10000 - 0x000007fefaf4b000     C:\windows\system32\WINMM.dll 0x000007fefc720000 - 0x000007fefc72c000   C:\windows\system32\VERSION.dll 0x00000000660d0000 - 0x00000000660df000     C:\Program Files\Java\jre1.8.0_102\bin\verify.dll 0x0000000064c60000 - 0x0000000064c89000   C:\Program Files\Java\jre1.8.0_102\bin\java.dll 0x0000000064c20000 - 0x0000000064c55000     C:\Program Files\Java\jre1.8.0_102\bin\jdwp.dll 0x0000000064c10000 - 0x0000000064c18000     C:\Program Files\Java\jre1.8.0_102\bin\npt.dll 0x0000000064bf0000 - 0x0000000064c06000  C:\Program Files\Java\jre1.8.0_102\bin\zip.dll 0x000007fefe140000 - 0x000007fefeec9000  C:\windows\system32\SHELL32.dll 0x000007fefdc60000 - 0x000007fefde63000     C:\windows\system32\ole32.dll 0x000007fefd4f0000 - 0x000007fefd4ff000   C:\windows\system32\profapi.dll 0x00000000648a0000
- 0x00000000648a9000    C:\Program Files\Java\jre1.8.0_102\bin\dt_socket.dll 0x000007fefb2d0000 - 0x000007fefb2e5000    C:\windows\system32\NLAapi.dll 0x000007fef9850000
- 0x000007fef9865000    C:\windows\system32\napinsp.dll 0x000007fef9830000 - 0x000007fef9849000     C:\windows\system32\pnrpnsp.dll 0x000007fefcc80000 - 0x000007fefccd5000     C:\windows\System32\mswsock.dll 0x000007fefcb00000
- 0x000007fefcb5b000    C:\windows\system32\DNSAPI.dll 0x000007fef9870000 - 0x000007fef987b000  C:\windows\System32\winrnr.dll 0x000007fefbe60000 - 0x000007fefbe87000  C:\windows\system32\IPHLPAPI.DLL 0x000007fefc310000 - 0x000007fefc31b000    C:\windows\system32\WINNSI.DLL 0x000007fef9cf0000 - 0x000007fef9d43000  C:\windows\System32\fwpuclnt.dll 0x000007fef9880000 - 0x000007fef9888000    C:\windows\system32\rasadhlp.dll 0x000007fefc320000 - 0x000007fefc350000    C:\ProgramData\Sophos\Web Intelligence\swi_ifslsp_64.dll 0x000007fefc300000 - 0x000007fefc307000    C:\windows\System32\wshtcpip.dll 0x000007fefcd20000 - 0x000007fefcd38000    C:\windows\system32\CRYPTSP.dll 0x000007fefc9e0000
- 0x000007fefca27000    C:\windows\system32\rsaenh.dll 0x000007fefd5a0000 - 0x000007fefd5be000  C:\windows\system32\USERENV.dll 0x000007fefd380000 - 0x000007fefd38f000     C:\windows\system32\CRYPTBASE.dll 0x0000000064880000 - 0x000000006489a000   C:\Program Files\Java\jre1.8.0_102\bin\net.dll 0x000007fefcc70000 - 0x000007fefcc77000  C:\windows\System32\wship6.dll 0x000007fef9da0000
- 0x000007fef9db1000    C:\windows\system32\dhcpcsvc6.DLL 0x000007fef9d80000 - 0x000007fef9d98000   C:\windows\system32\dhcpcsvc.DLL 0x0000000064860000 - 0x0000000064871000    C:\Program Files\Java\jre1.8.0_102\bin\nio.dll 0x0000000072000000 - 0x0000000072012000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\.bundle_pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316\eclipse_1608.dll 0x000007fefbc30000 - 0x000007fefbc86000   C:\windows\system32\uxtheme.dll 0x000007fef2b20000 - 0x000007fef2d98000     C:\Program Files\NVIDIA Corporation\nview\nview64.dll 0x000007fefa440000 - 0x000007fefa447000   C:\windows\system32\MSIMG32.dll 0x000007fefc730000 - 0x000007fefc741000     C:\windows\system32\WTSAPI32.dll 0x000007feff490000 - 0x000007feff56a000    C:\windows\system32\OLEAUT32.dll 0x000007fefbbf0000 - 0x000007fefbc1c000    C:\windows\system32\POWRPROF.dll 0x000007feff660000 - 0x000007feff837000    C:\windows\system32\SETUPAPI.dll 0x000007fefd560000 - 0x000007fefd596000    C:\windows\system32\CFGMGR32.dll 0x000007fefd510000 - 0x000007fefd52a000    C:\windows\system32\DEVOBJ.dll 0x000007fefc210000 - 0x000007fefc23d000  C:\windows\system32\ntmarta.dll 0x000007feff320000
- 0x000007feff372000    C:\windows\system32\WLDAP32.dll 0x0000000070f30000 - 0x0000000070f7e000     C:\Program Files\NVIDIA Corporation\nview\NVWRSFR.DLL 0x000007feff840000 - 0x000007feff8d9000   C:\windows\system32\CLBCatQ.DLL 0x0000000019ca0000 - 0x0000000019d48000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\OpenFlowSuite_Win64\org.eclipse.osgi\664\0\.cp\swt-win32-4430.dll 0x000007feff080000 - 0x000007feff117000  C:\windows\system32\comdlg32.dll 0x000007fef9eb0000 - 0x000007fef9f21000    C:\windows\system32\WINSPOOL.DRV 0x000007fefd980000 - 0x000007fefdc52000    C:\windows\system32\WININET.dll 0x000007fefd500000 - 0x000007fefd504000     C:\windows\system32\api-ms-win-downlevel-user32-l1-1-0.dll 0x000007fefd530000 - 0x000007fefd534000  C:\windows\system32\api-ms-win-downlevel-shlwapi-l1-1-0.dll 0x000007fefd640000 - 0x000007fefd644000     C:\windows\system32\api-ms-win-downlevel-version-l1-1-0.dll 0x000007fefd550000 - 0x000007fefd553000     C:\windows\system32\api-ms-win-downlevel-normaliz-l1-1-0.dll 0x0000000077970000 - 0x0000000077973000    C:\windows\system32\normaliz.DLL 0x000007fefde70000 - 0x000007fefe13a000    C:\windows\system32\iertutil.dll 0x000007fefd540000 - 0x000007fefd545000    C:\windows\system32\api-ms-win-downlevel-advapi32-l1-1-0.dll 0x000007fefd650000 - 0x000007fefd7bd000    C:\windows\system32\CRYPT32.dll 0x000007fefd4e0000 - 0x000007fefd4ef000     C:\windows\system32\MSASN1.dll 0x000007fefae20000
- 0x000007fefae38000    C:\windows\system32\dwmapi.dll 0x000007fefb910000 - 0x000007fefba3c000  C:\windows\system32\propsys.dll 0x0000000002620000 - 0x000000000263e000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\OpenFlowSuite_Win64\org.eclipse.osgi\664\0\.cp\swt-gdip-win32-4430.dll 0x000007fefb050000 - 0x000007fefb266000     C:\windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23545_none_14599ab28b920323\gdiplus.dll 0x000000006d650000 - 0x000000006d7e8000     C:\Program Files\Java\jre1.8.0_102\bin\awt.dll 0x0000000180000000 - 0x0000000180012000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\OpenFlowSuite_Win64\org.eclipse.osgi\549\0\.cp\os\win32\x86_64\localfile_1_0_0.dll 0x000007fefac70000 - 0x000007fefadd1000     C:\windows\system32\WindowsCodecs.dll 0x0000000070800000 - 0x00000000708d2000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\msvcr100.dll 0x00000000725a0000 - 0x0000000072638000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\msvcp100.dll 0x0000000070ef0000 - 0x0000000070f01000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\vcomp100.dll 0x000007feec250000 - 0x000007feec377000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorBase.dll 0x000007fef9270000 - 0x000007fef9395000   C:\windows\system32\dbghelp.dll 0x000007feec3b0000 - 0x000007feec4a7000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorGL.dll 0x000007fef29f0000 - 0x000007fef2a1d000     C:\windows\system32\GLU32.dll 0x000007fee8b10000 - 0x000007fee8c2d000   C:\windows\system32\OPENGL32.dll 0x000007fee8a10000 - 0x000007fee8b01000    C:\windows\system32\DDRAW.dll 0x000007fef50e0000 - 0x000007fef50e8000   C:\windows\system32\DCIMAN32.dll 0x000007fee88f0000 - 0x000007fee8a0e000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorImage.dll 0x000007fef3fd0000 - 0x000007fef3fef000  C:\windows\system32\AVIFIL32.dll 0x000007fef2e50000 - 0x000007fef2e68000    C:\windows\system32\MSACM32.dll 0x000007fef2aa0000
- 0x000007fef2ac9000    C:\windows\system32\MSVFW32.dll 0x000007fef29d0000 - 0x000007fef29e7000     C:\windows\system32\AVICAP32.dll 0x000007fee7e70000 - 0x000007fee88ec000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\fei.ImageAccess.dll 0x000007fefeee0000 - 0x000007fefeef9000    C:\windows\system32\imagehlp.dll 0x000007fee7140000 - 0x000007fee7e6c000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\Inventor.dll 0x000007feea5e0000 - 0x000007feea641000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\complex1.6.dll 0x000007fee7030000 - 0x000007fee713b000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\ScaleViz.dll 0x000007fee6c60000 - 0x000007fee7024000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\MeshViz.dll 0x000007feed160000 - 0x000007feed1c5000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\HardCopy.dll 0x000007fef2850000 - 0x000007fef287f000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorAlgorithms.dll 0x000007fee6a40000 - 0x000007fee6c5b000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\LDM.dll 0x000007fee67c0000 - 0x000007fee6a37000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\VolumeViz.dll 0x000007fee66c0000 - 0x000007fee67b5000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\TerrainViz.dll 0x000007feec200000 - 0x000007feec243000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\DirectViz.dll 0x000007feea2c0000 - 0x000007feea330000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\SolidViz.dll 0x000007fef16b0000 - 0x000007fef16d8000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\FXViz.dll 0x000007fee6630000 - 0x000007fee66b6000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\ScaleVizRemote.dll 0x000007feeedc0000 - 0x000007feeedd6000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\IvDLZlib.dll 0x000007fee6240000 - 0x000007fee6621000   C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\RemoteVizServices.dll 0x000007fee61d0000 - 0x000007fee623d000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorGui.dll 0x000007fee60b0000 - 0x000007fee61ca000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\InventorWin.dll 0x000007feeed50000 - 0x000007feeed8c000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\MeshVizWin.dll 0x000000006d3d0000 - 0x000000006d64d000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\QtCore4.dll 0x000000006caa0000 - 0x000000006d3cf000    C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\QtGui4.dll 0x000000006c9f0000 - 0x000000006ca9e000     C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\QtOpenGL4.dll 0x0000000070790000 - 0x00000000707f7000  C:\Users\zaraidi\Desktop\Workspace_Anas_2017\OpenFlowPlatform\Bundles\com.openinventor.win64\QtXml4.dll

VM Arguments: jvm_args:
-agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:58474 -Xms307m -Xmx3071m -XX:-UseGCOverheadLimit -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts -Dfile.encoding=Cp1252  java_command: org.eclipse.equinox.launcher.Main -launcher C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\.bundle_pool\eclipse.exe -name Eclipse -showsplash 600 -product fr.ifp.openflowsuite.welcome.OFSFeature -data C:\Users\zaraidi\Desktop\Workspace_Anas_2017/../runtime-OpenFlowSuiteProduct.product
-configuration file:C:/Users/zaraidi/Desktop/Workspace_Anas_2017/.metadata/.plugins/org.eclipse.pde.core/OpenFlowSuite_Win64/
-dev file:C:/Users/zaraidi/Desktop/Workspace_Anas_2017/.metadata/.plugins/org.eclipse.pde.core/OpenFlowSuite_Win64/dev.properties
-os win32 -ws win32 -arch x86_64 -nl en_GB -consoleLog java_class_path (initial): C:\Users\zaraidi\Desktop\Workspace_Anas_2017\.metadata\.plugins\org.eclipse.pde.core\.bundle_pool\plugins\org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar Launcher Type: SUN_STANDARD

A: There is native crash indicated by the problematic frame
Problematic frame:
# C  0x000000005a3004fa

More details about the crash can be found in hs_error file which is generated in the location C:\Users\Desktop\eclipse\hs_err_pid2388.log
Regarding how the hs_error file will be structured and how it can be used for decoding information can be found here - http://www.oracle.com/technetwork/java/javase/crashes-137240.html#gbyzj


text:
Q: Are there problems with calling JavaScript constructors as functions(without new?) Recently, I have got into a habit of calling things like RegExp, String, Number, Object, TypeError, etc without "new".
e.g:
throw (TypeError("Error"));
var regex = RegExp('^word$');

I know that this is bad for cases when "this" context is needed, since without "new", "this" wreaks havoc on your global scope unless you wrap your code in 'use strict', in which case it raises an error that you are trying to mutate 'undefined'. (I am not sure that this works in very very old browsers).
e.g:
var constructor = function() {
    // 'use strict'; /* uncomment this line to avoid the behavior and be warned */
    this.state = 'working as intended';
};

var foo = constructor();
console.log(foo.state); // undefined
console.log(window.state); // we just polluted our global scope.

whereas
var constructor = function() {
    this.state = 'working as intended';
};

var foo = new constructor;
console.log(foo.state); // "working as intended"
console.log(window.state); // we are clean.

But in cases like the ones above, is it okay to do this, or are there problems I am setting myself up for if I get into a habit of doing this?
Thanks ahead of time.

A: Be aware the result can be different.
For example, the Number constructor creates Number objects, but when called as a function it only does type coercion to primitive Number.
new Number(123); // Number { 123 }
Number(123); // 123

But yes, there are lots of the cases in which it doesn't matter whether you use new or not. They exist because of backwards compatibility, but with recently introduced constructors like Set or Map do require new.
In general, I would recommend using new when you want to create a new object. Then,

*

*If you only want to do type coercion, you must call Boolean, Number or String without new.

*For the same reason, if you want coerce to Object type, I wouldn't use new, but it doesn't matter.

*If you want to create a primitive which doesn't have literal syntax, you must call Symbol without new.

*If you want to create an object wrapper of a primitive value, you must call Boolean, Number, String or Symbol with new.

*If you want to instantiate an old constructor like Array, Object, RegExp, Error, etc., I would use new, but it doesn't matter.

*If you want to instantiate a recently introduced constructor like Set, Map, WeakSet, WeakMap, typed arrays, etc., you must call it with new.

For the old constructors that it doesn't matter, it's like they call themselves with new if you omit it. For example, for RegExp,

When RegExp is called as a function rather than as a constructor, it
  creates and initializes a new RegExp object. Thus the function call
  RegExp(…) is equivalent to the object creation expression
  new RegExp(…) with the same arguments.

A: As documented in another answer, some built in constructors are written to be able to be called as functions. So as long as you aren't polluting your global namespace, I believe you should be fine with the example you listed.
That being said, in most cases, I wouldn't get used to this habit; the new operator adds to code clarity, which is more important than brevity. The ability to use native constructors without the new operator is also inconsistently applied across constructors.


text:
Q: Strange Invalid connection handle when adding in "proxy shared lib"? I am doing some C code on a Solaris SPARC system and am scratching my head at an "inconsistency" I have found in my integration testing.
I am doing some tests into an SAP system and am using the SAP RFCSDK, but SAP is not my question here at all.....I am wondering if I am missing some compile options etc
Let me try explain:
Client code -> Shared lib(custom) -> Shared Lib (SAP) -> SAP    === works 100%
Client code -> Shared lib(custom PROXY)-> Shared lib(custom) -> Shared Lib (SAP) -> SAP ==INVALID handle
So without going into too much detail have you ever heard of any "handle" becoming invalid just because another shared lib was "inbetween" the client and "destination shared lib"?
The PROXY shared lib that is causing the issue with the INVALID HANDLE does nothing special, just a "pass through"
#include <stdio.h>
#include <stdlib.h>
#include "saprfc_receiver_proxy.h"
#include "saprfc_receiver.h"

int saprfc_receiver_proxy_initialize(char *sap_hostname, char *sap_client,
       int sap_sysnbr, char *sap_language, char *sap_user, char *sap_password,
       int sap_rfctrace){
    return saprfc_receiver_initialize(sap_hostname, sap_client, sap_sysnbr,
               sap_language, sap_user, sap_password, sap_rfctrace);
}

int saprfc_receiver_proxy_beginTransaction(char *tid){
    return saprfc_receiver_beginTransaction(tid);
}

int saprfc_receiver_proxy_commitTransaction(char *tid){
    return saprfc_receiver_commitTransaction(tid);
}

int saprfc_receiver_proxy_rollbackTransaction(char *tid){
    return saprfc_receiver_rollbackTransaction(tid);
}

int saprfc_receiver_proxy_writeMessage(char *tid, char *buffer){
    return saprfc_receiver_writeMessage(tid, buffer);
}

int saprfc_receiver_proxy_openConnection(){
    return saprfc_receiver_openConnection();
}

int saprfc_receiver_proxy_closeConnection(){
    return saprfc_receiver_closeConnection();
}

The compilation is very straightforward, here is the shared lib compile that calls the SAP shared libs directly:
/usr/sfw/bin/gcc -m64 -R/usr/sfw/lib/64 -c -fPIC -I../include \
    -I../rfcsdk/include saprfc_receiver.c -o saprfc_receiver.o
/usr/sfw/bin/gcc -m64 -R/usr/sfw/lib/64 -shared -L../rfcsdk/lib/ \
    -o libsaprfc_receiver.so saprfc_receiver.o -lrfccm -lrfc

And here is the proxy shared lib compile:
/usr/sfw/bin/gcc -m64 -R/usr/sfw/lib/64 -c -fPIC -I../include \
    saprfc_receiver_proxy.c -o saprfc_receiver_proxy.o
/usr/sfw/bin/gcc -m64 -R/usr/sfw/lib/64 -shared -L../lib \
    -o libsaprfc_receiver_proxy.so saprfc_receiver_proxy.o -lsaprfc_receiver

So is there any "golden rule" when using C to make sure that "shared libs in between" do not influence the state at all?
Sorry if my explaining is bad, I will try edit this post later with more detail....
The bottom line is that if the client calls the shared lib (custom) directly then it works, the moment I add a SIMPLE proxy in between the SAP handle goes bad.


text:
Q: Xcode Ui-automation - Test not running on physical device Is there any specific configuration if I want to run a test on a physical device?
-my physical device is running ios 9.0
-I have a provisioned profile (the app is running on the device)
-I already enabled UI automation (settings->developer)
-My active scheme is my target, and I selected the physical device
But when I run a test (UI test), there is a message "test succeeded " (nothing happens on the device, the app doesn't open at all, there is no error messages at all), and when I go to the report navigator, there is no info related with the test, that I just run.
if I run this test on the simulator it will run without problem.
Seems like xcode is not running the test at all, but it's showing the "test succeeded" message
Thanks !

A: It seems like there are various reasons why this "Test Succeeded" message can occur. In my case, if I open the Mac OS X Console program, I see:

12/25/15 10:46:51.940 AM Xcode[42471]: _connect_to_port (thread
  0x7000004ac000): USBMuxConnectByPort failed to connect to the device
  [snip] on port 43234: Connection refused

Experiments:
a) Unplugging the device from the USB cable, and plugging it in: No effect.
b) Restart Xcode and remove Derived Data: No effect.
c) Restart the device (iPhone in this case): That worked!

A: The provision profile needs to be correct, I just added an updated provisioned profile and it worked


text:
Q: Forward function in tensorflow I'm learning about neural network and reading a piece of code to train the neural network with mnist data set.
In the test part of it, it defines the output variable: y = mnist_forward.forward(x, None) in the test function:
def test(mnist):
    with tf.Graph().as_default() as g:
        x = tf.placeholder(tf.float32, [None, mnist_forward.INPUT_NODE])
        y_ = tf.placeholder(tf.float32, [None, mnist_forward.OUTPUT_NODE])
        y = mnist_forward.forward(x, None)

        saver = tf.train.Saver()
        correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
        accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

        while True:
            with tf.Session() as sess:
                tf.initialize_all_variables().run()
                ckpt = tf.train.get_checkpoint_state(mnist_backward.MODEL_SAVE_PATH)
                if ckpt and ckpt.model_checkpoint_path:
                    saver.restore(sess, ckpt.model_checkpoint_path)
                    global_step = ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1]
                    accuracy_score = sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels})
                    print("After %s train steps, test accuracy = %g" % (global_step, accuracy_score))
                else:
                    print('No checkpoint file found')
                    return
            time.sleep(TEST_INTERVAL_SECS)

However, the function mnist_forward.forward is defined as:
def forward(x, regularizer):
    w1 = get_weight([INPUT_NODE, LAYER1_NODE], regularizer)
    b1 = get_bias([LAYER1_NODE])
    y1 = tf.nn.relu(tf.matmul(x, w1) + b1)

    w2 = get_weight([LAYER1_NODE, OUTPUT_NODE], regularizer)
    b2 = get_bias([OUTPUT_NODE])
    y = tf.matmul(y1, w2) + b2
    return y

The function get_weight and get_bias are used to generate the parameters randomly. It seems that each time the forward function is called(to predict), the parameters will be regenerated.
I just cannot understand why the function call to generate parameters should be written inside the forward function(rather than outside) and how it truly works in the prediction process of the model?

A:
It seems that each time the forward function is called(to predict), the parameters will be regenerated.

That is the big difference between Tensorflow and standard programming and can be quite puzzling at first: Tensorflow is graph based, so in this case the 'forward' function is only called ONCE to define the graph.
Then Tensorflow automatically figure out which node in the graph are needed to compute some other nodes, but it NEVER call the forward function again.
The important lines in your code to really understand what's happening inside are the following ones:
# Define the graph: create all variables, how to initialize them
# and how to compute the output depending on the input
# CAUTION: VARIABLE TENSORS CURRENTLY HOLD NO VALUES THEY ARE ONLY DEFINED
y = mnist_forward.forward(x, None)

...

# Add operations to the graph to compute the accuracy metric
correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

...

# Initialize all variables using the initializers defined previously
tf.initialize_all_variables().run()

...

# Restore all variables to saved values
# CAUTION: REPLACES ALL INITIALIZED VALUES TO THESE STORED ONES
saver.restore(sess, ckpt.model_checkpoint_path)

...

# Runs the graph
accuracy_score = sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels})

I just cannot understand why the function call to generate parameters ...

As you can see on the comments, what generates parameters is the 'tf.initialize_all_variables().run()' call, the 'forward' function simply defines HOW to initialize.


text:
Q: Effect on photocurrent due to stopping potential There are two diagrams for photoelectric experiment. One in which emission is done from the electrode that is connected to positive terminal of cell and one in which emission is due the electrode that is connected to negative terminal of the cell.
However, the graphs of photoelectric current against stopping potential vary too much in each condition. In one a saturation current is obtained whereas in another current doesn't get saturated.
Can somebody please explain the discrepancy in the graphs?
Edit
Is this graph wrong for circuit in which emitting electrode is connected to positive terminal ?

A: Usually we look at just one graph - current as a function of voltage. When the voltage is positive, a certain amount of energy is needed in each incident photon to give the electron enough energy to escape. However, since the velocity of the electron is random, it may or may not have sufficient momentum perpendicular to the surface to escape. The lower the potential, the less energy is needed - and therefore the greater the probability of escape.
Once the potential is positive, the chances of an electron escaping tend to be independent of this initial direction and thus the current is only determined by the number of electrons knocked out of the conductor - and this number is independent of the voltage.
In summary: same number of electrons is knocked out per unit time. Voltage determines whether they will escape or return to the plate.


text:
Q: Help identify weird mount One of the entry when I use the df command is the following... What is it?
/dev/loop2                    2944       2944          0 100% /snap/pulseaudio/9

there is this as well:
/dev/loop0                   83456      83456          0 100% /snap/core/2898
/dev/loop1                   83456      83456          0 100% /snap/core/2844

A: Those mounts points are used by Ubuntu's Snap Packaging system.
That is how a snap is loaded / operates.

https://www.ubuntu.com/desktop/snappy
Snaps work on any distribution or device. Snaps are faster to install,
easier to create, safer to run, and they update automatically and
transactionally so your app is always fresh and never broken.
The public collection of snaps includes the latest and best apps from
GitHub and beyond, so you have the whole world of Linux apps at your
fingertips.


text:
Q: How to write a Movie Booking application codes for netbeans Design a Movie Booking application that

*

*Allows user to browse movie listing (of at least 10 movies) with image and description;

*When user selects a movie, show him the seats available;

*User may choose the seats by clicking on them;

*User may de-select a seat by clicking on a selected seat;

*When user clicks a "Book" button, display his booking info and total price;

*When user clicks "OK", update the record and the seats will not be available to subsequent user.

A: From your requirements I deduce that you're project is just a simple database application with a graphical user interface.
For that purpose I recommend the following.

*

*Learn about databases and SQL, how to define tables, select data, store and retrieve photos, etc. Put and special emphasis on JDBC, since this would be done in java. You're first step could very well be to define a database squema.

*Learn about Swing, how to define your GUI, how to react to GUI events, such as clicking a button, etc. Here is a good begginers toturial, that will help you to get the GUI part of your project ready.

A: Do the interface first. I wouldn't even bother with the DB to begin with.  I would simply have a simple array with the movie title and the start times.
The DB would be the last thing I would recommend attempting.
Really though if you are attempting this part of the course already and you don't know the basics of Java & Swing then you should make sure you turn up to lectures first!


text:
Q: Periodically update label in Tkinter I read through many of solutions of this problem already, but I still can't make this simple program work. I know it's probably really simple, but I can't find out what am I missing.
I have this simple program:
from Tkinter import *
import subprocess

def run():
    process=subprocess.Popen(some_script, shell=True, stdout=subprocess.PIPE)
    while True:
        nextline = process.stdout.readline()
        if not nextline:
            break
        output.set(nextline)
        root.update_idletasks()

root = Tk()
output = StringVar()

label1 = Label(root, textvariable=output)
label1.pack()

button1 = Button(root, text="Go", command=run)
button1.pack()

root.mainloop()

So when I click the button, some_script is executed. I want the label to periodically update with the output of the script, but it doesn't. What am I doing wrong?

A: I'm guessing the GUI becomes unresponsive when you run this. If so, then you're blocking Tkinter's main loop. You'll need to run the subprocess bit in a Thread and use whatever Tkinter's thread-safe methods are to update your GUI. I found this old article that sounds very similar to what you're doing: http://effbot.org/zone/tkinter-threads.htm
There's also this handy recipe: http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/


text:
Q: Is there any alternate way to make this (--incremental lastmodified) work with --hive-imports I am trying to create a sqoop job for incremental import in hive.
sqoop job --create user_rating_import --meta-connect \
jdbc:hsqldb:hsql://192.168.225.129:16000/sqoop \
-- import --connect jdbc:postgresql://192.168.148.1:5432/movielens --username anm \
--table ratings -m 8  --target-dir /user/hive/warehouse/user_rating --incremental lastmodified --fields-terminated-by ',' \
--check-column rated_at --append --as-parquetfile --hive-import \
--hive-table user_rating_fact
Generating this:
19/12/03 21:39:23 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
--incremental lastmodified option for hive imports is not supported. Please remove the parameter --incremental lastmodified.

A: Please try this:
sqoop job --create user_rating_import --meta-connect \ jdbc:hsqldb:hsql://192.168.225.129:16000/sqoop \ -- import --connect jdbc:postgresql://192.168.148.1:5432/movielens --driver com.mysql.jdbc.Driver --username anm --table ratings -m 8 --hive-import --target-dir "/user/hive/warehouse/user_rating" --fields-terminated-by ',' --check-column rated_at --append --as-parquetfile--hive-table "user_rating_fact"


text:
Q: 3D position prediction of a drone I have data on the position of the drone from a tracker, as well as estimates of velocity and acceleration based on that data from a Kalman filter variant that seem reasonably good.
I am looking to predict (/give a reasonable guess of) the position of the drone multiple seconds in the future, and I am uncertain if the best tactic is to keep estimating jerk, snap, crackle & pop and include them in the computation, or if there is a better method that I am missing.
Any help appreciated.

A: If you have estimated velocity and position, then pass it to your kalman filter. Then pass the output of kalman filter back to it and in this way loop it over again and again. See what happens. I used this method for 2D prediction and my predicted path improved with increasing number of datasets. Also you may need to tweak your control matrix.


text:
Q: Making a word into a sentinel value in C# I am currently working on a program that is a loop with a sentinel value that asks the user to enter a number or enter -99 to end the program and it runs perfectly. If I were to change that -99 to just the word "Quit" is there a certain parameter that I would have to put? For example, if I want to use a letter, I know that I could use:
char (undefined parameter) = 'A'

But how would I do this with a word? When I simply try to change the value of -99 to Quit, I receive an error as expected.
using System;

class Program {
  public static void Main (string[] args) {
    int sum = 0;
    int counter = 0;
    int max = Int32.MinValue;
    int min = Int32.MaxValue;
    bool keepGoing = true;
    while(keepGoing) {
      Console.WriteLine("Please enter a number or enter -99 to stop the program:");
      int number = Convert.ToInt32(Console.ReadLine());
      if (number == -99){
        keepGoing = false;
      } else {
         counter++;
        sum += number;
        if (number >= max) {
          max = number;
        }
        if (number <= min) {
          min = number;
        }
      }
    }
  double average = (double) sum / counter;
  Console.WriteLine($"{counter} numbers were entered.");
  Console.WriteLine("The average is:"  + average);
  Console.WriteLine("The sum is:"  + sum);
  Console.WriteLine("The maximum value is:"  + max);
  Console.WriteLine("The minimum value is:"  + min);
  }
}

A: It's difficult to store "Quit" in an int, so the root of your problem is that you have no separation between pulling the string from the console and converting it to an int:
  int number = Convert.ToInt32(Console.ReadLine());
  if (number == -99){
    keepGoing = false;
  } else {
     counter++;

If you did have a separation, it becomes possible:
  string input = Console.ReadLine();
  if (input == "Quit"){
    keepGoing = false;
  } else {
     int number = Convert.ToInt32(input);
     counter++;


text:
Q: Change the value of a character entered in a textfield For example, I've got the below code where I'm trying to interpret just any character entered into the textfield as the first element from  my arrayOfCharacters. This sort of works however on entering a second character, doesn't function. I was wondering if anyone's got an idea as to why this isn't working. Thanks!
let arrayOfCharacters = ["'¯¯٭٭¯¯(▫▫)¯¯٭٭¯¯", "=^..^="]

document.getElementById("input-area").onkeypress = function(evt) {
  let val = this.value
  //Transform the typed characters
  this.value = val + arrayOfCharacters[0]
}

A: This works:
var arrayOfCharacters = ["'¯¯٭٭¯¯(▫▫)¯¯٭٭¯¯", "=^..^="]
var totalValues = 0;
document.getElementById("input-area").onkeypress = function(evt) {
  evt.preventDefault();
  var val = this.value
  //Transform the typed characters

  // notice totalValues variable
  this.value += arrayOfCharacters[totalValues];
  totalValues++;
}

Example:
https://jsfiddle.net/pn8h4rqt/


text:
Q: IIS6 SSL Config - Have to log in twice (once for :80, once for :443) I have a virtual folder containing an administration application, like
https://www.mysite.com/alpha

which requires SSL. In the IIS manager properties for the folder, under "Authentication and access control", Anonymous Access is disabled and "Authenticated Access" is set to "Integrated Windows authentication."
When I connect to the site in Chrome, I receive two login boxes. The first is from mysite.com/alpha:443, and the second is from mysite.com/alpha:80. Firefox appears to re-send my credentials for the second box so it is never shown.
Any ideas why I'd be required to log in twice?

A: If you require SSL for authenticated users on your website (for any reason), then the best solution is to always have your "Login" page on https://.  That way when they log in, they are instantly secure. The reason for this is because of the native design of SSL. It separates/secures it's self from the non secure version by not passing authentication states between http and https.
you will also have to write some logic to redirect returning authenticated visitors to the secure page (IE: visitors who can return authenticated from a cookie).
EDIT:
Since your using windows authentication, it's probably easiest to simply redirect ALL incoming http traffic to https. This means your entire site will be over SSL and will be inaccessible via http (other than to redirect to https)
I wrote a Blog Post on forcing a website to use WWW in the web address, but it can also be ported to forcing https.

A: Yep,
The one uses SSL, the other not.
therefore, you are not allowed to share the credential cache from a Secure session, with the one of the unsecure session.
if you require SSL, then directly redirect the users to the SSL website.


text:
Q: Firebird and stored procedures: if exists then else I'm trying to create a stored procedure for firebird 2.1 (this is the version which is to be used)
But am getting a bit stuck, so any help is appreciated.
The final version should compare 4 values agains the table, and retreive either the primaryid if the value exists, or create the new entry in the table, and return the new primaryid.
But I get stuck with only one value lookup, and it's not even using the variable yet.
SET TERM ^ ;

CREATE PROCEDURE TESTSP
 ( A Varchar(64) )
RETURNS
 ( RESULT Integer )
AS

BEGIN
IF (EXISTS (SELECT PRIMARYID FROM TABLENAME WHERE FIELD = 'Some string')) then
    SELECT PRIMARYID FROM TABLENAME WHERE FIELD = 'Some string' into :primaryid;
    result = PRIMARYID;
ELSE
    INSERT INTO TABLENAME (FIELD) VALUES ('Some string');
    result = gen_id(GEN_TABLEID, 0);
END^

SET TERM ; ^

I get a "Token unknown" for the Else command.
Update after responses:
Now I want to use the 4 variables and return the 4 results.
I think I need a for loop to do so, but with firebird, the for function means something else.
So what would be the way to go?
SET TERM ^ ;

CREATE PROCEDURE TESTSP
 ( value1 Varchar(64) )
RETURNS
 ( RESULT1 Integer )
AS

BEGIN
    IF (EXISTS (SELECT PRIMARYID FROM TABLENAME WHERE FIELD = :value1)) then
        SELECT PRIMARYID FROM TABLENAME WHERE FIELD = value1 into :result1;
    ELSE BEGIN
        result1 = gen_id(GEN_TABLEID, 1);
        INSERT INTO TABLENAME (PRIMARYID, FIELD) VALUES (:result1, :value1);
    END
    suspend;
END^

SET TERM ; ^

A: If you have multiple instruction for then and/ or else clause you must use BEGIN ... END-block!
SET TERM ^ ;

CREATE PROCEDURE TESTSP
 ( A Varchar(64) )
RETURNS
 ( RESULT Integer )
AS

BEGIN
IF (EXISTS (SELECT PRIMARYID FROM TABLENAME WHERE FIELD = 'Some string')) then
  BEGIN
    SELECT PRIMARYID FROM TABLENAME WHERE FIELD = 'Some string' into :primaryid;
    result = PRIMARYID;
  END
ELSE
  BEGIN
    INSERT INTO TABLENAME (FIELD) VALUES ('Some string');
    result = gen_id(GEN_TABLEID, 0);
  END
END^

SET TERM ; ^

A: As Tico already answered you have to use begin / end to group multiple statements in then / else part. The error abut column PRIMARYID being unknown is because you reference to it without having declared a local variable for it. Try this:
CREATE PROCEDURE TESTSP ( A Varchar(64) )
RETURNS ( RESULT Integer )
AS
BEGIN
  -- initialize the result
  Result = NULL;
  -- check is the string already in table
  SELECT PRIMARYID FROM TABLENAME WHERE FIELD = 'Some string' into :Result;
  IF (Result is NULL) then
    INSERT INTO TABLENAME(PRIMARYID, FIELD) VALUES(gen_id(GEN_TABLEID, 1), 'Some string') RETURNING PRIMARYID INTO :Result;
END^

A: I think your stored procedure should look like this:
SET TERM ^ ;
CREATE PROCEDURE TESTSP
  ( A Varchar(64) )
  RETURNS ( result Integer )
AS
BEGIN
  IF (EXISTS (SELECT PRIMARYID
              FROM TABLENAME
              WHERE FIELD = 'Some string')) then
     SELECT PRIMARYID
       FROM TABLENAME
       WHERE FIELD = 'Some string'
       into :result;
  ELSE BEGIN
     result = gen_id(GEN_TABLEID, 1);
     INSERT INTO TABLENAME
       (PRIMARYID, FIELD)
       VALUES (:result,  'Some string');
  END
END^
SET TERM ; ^


text:
Q: New Messaging System API for non developer accounts According to this blog post the new messaging system should be accessible via the API (fql/graph) for non developer account as of end of November. It still gives OAuthException with message "You must be a developer of the application".
I was unable to find any updates on this issue from Facebook or other sources. Anyone knows what is going on with this and when will it be accessible?
There was a bug opened on the subject, anyone who has interest in this might consider promoting it.

A: Going to answer my own question, according to the response on the bug seems like the official answer is:
"We said it would be published but it wasn't, so just wait until we say it will be published again".

A: Are you trying to read messages or send them? It's still not possible to send them but reading them should work for any app now


text:
Q: JSON parsing retrofit2 In my retrofit call, something goes wrong.I created 3 list for parsing below json naming as StudentAssignmentList(main list),AssignmentDataList(data array listing) and AssignmentDetailsList(assignment array listing) .In AssignmentDataList I have a method as getAssignment.But it returns null after getting response.-->response.body().getAssignment()
{
    "result": true,
    "data": [
        {
           "date":"12/10/2019",
            "assignment": [
                {
                    "subject_name": "English",
                    "id": 1,
                    "date": "2019-08-03",
                    "created_date": "2019-08-03"
                }
            ]
        },

        {
           "date":"13/10/2019",
            "assignment": [
                {
                    "subject_name": "English",
                    "id": 1,
                    "date": "2019-08-09",
                    "created_date": "2019-08-08"
                }
            ]
        },
        {
           "date":"14/10/2019",
            "assignment": [
                {
                    "subject_name": "English",
                    "id": 1,
                    "date": "2019-08-09",
                    "created_date": "2019-08-09"
                }
            ]
        }
    ],
    "total_pages": 1
}

A: Use websites like http://www.jsonschema2pojo.org/ if you don't know how to generate model.
Here is model generated in your case:
Assignment
    public class Assignment {

@SerializedName("subject_name")
@Expose
private String subjectName;
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("date")
@Expose
private String date;
@SerializedName("created_date")
@Expose
private String createdDate;

public String getSubjectName() {
return subjectName;
}

public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public String getCreatedDate() {
return createdDate;
}

public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}

}

Datum
public class Datum {

@SerializedName("date")
@Expose
private String date;
@SerializedName("assignment")
@Expose
private List<Assignment> assignment = null;

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public List<Assignment> getAssignment() {
return assignment;
}

public void setAssignment(List<Assignment> assignment) {
this.assignment = assignment;
}

}

Main model
public class Example {

@SerializedName("result")
@Expose
private Boolean result;
@SerializedName("data")
@Expose
private List<Datum> data = null;
@SerializedName("total_pages")
@Expose
private Integer totalPages;

public Boolean getResult() {
return result;
}

public void setResult(Boolean result) {
this.result = result;
}

public List<Datum> getData() {
return data;
}

public void setData(List<Datum> data) {
this.data = data;
}

public Integer getTotalPages() {
return totalPages;
}

public void setTotalPages(Integer totalPages) {
this.totalPages = totalPages;
}

}


text:
Q: quebrar lista por tamanho python Hoje me deparei com a necessidade de quebrar uma lista de mais de 100 valores em uma lista de listas com no máximo 100 valores.
pesquisei muito, e no final acabei montando a função:
remove_list=[[]]
    n=0
    for i in remove_alarms:
        remove_list[n].append(i)
        if len(remove_list[n])>99:
            n=n+1
            remove_list.append([])

No caso estou recebendo uma lista com nomes de alarmes que devem ser removidos da Amazon e passando como parâmetro para a api que processa no máximo 100 valores.
A questão é que depois de demorar muito saiu essa linguiçona queria alguma dica de como melhorar ou utilizar algum função embutida do Python.

A: Esse é um caso típico onde é bacana usar a funcionalidade de "generators" do Python -
generators se caracterizam por responder ao "iterator protocol" - e como tais,  objetos que podem ser usados num comando for do Python.
Uma das formas de criar generators é escrever funções que tem a palavra chave yield no corpo. A expressão usada no yield é passada como valor para uma interação do for. Nesse caso, você pode criar um generator que recebe a lista grande como parâmetro, e gera como resultados fatias de 100 elementos:
def slice(biglist, slice_size=100):
    for i in range(0, len(biglist), slice_size):
        yield biglist[i: i + slice_size]

e para usar isso:
for list_slice in slice(biglist):
    # código para usar a sublista com 100 elementos
    ...

O que são os geradores:
A ideia é a seguinte: uma função normal sempre é chamada, recebe parâmetros, cria suas variáveis locais, executa seu código (que pode ou não chamar utras funções), e retorna um valor - quando encontra o comando return (Funções sem um return em Python retornam None de forma implícita).
No momento de um return, todas as variáveis locais criadas pela função são destruídas. Inclusive os parâmetros que recebeu. Se for chamada de novo, a execução volta para a primeira linha da função, e ela tem que refazer todos os cálculos que já tenha feito de novo. Em termos de programação, se diz que uma função não tem "estado" - isso é, toda vez que é chamada com os mesmos parâmetros, vai refazer tudo, e retornar os mesmos resultados (claro, se ela mesma não fier outras chamadas que retornem fatores variáveis, tais como leituras de arquivo, aquisição de ddos da internet, ou de dados digitados pelo usuário (com input)).
Quando falamos de programação orientada a objetos, uma das grandes mudanças que acontecem é que objetos podem ter atributos - ou seja, entre uma chamada de um método e outra de um mesmo objeto, seu estado pode mudar.
Então, nesse caso, por exemplo - nos queremos ter algo que "se lembre da lista grande, completa", e que se "lembre" de qual foi a última "fatia" da lista que foi utilizada,  e que possa gerar a próxima fatia, e sinalizar quando a lista grande terminar.
Em orientação a objeto normal, sem as melhorias dos "geradores" que Python incorpora, isso poderia ser escrito assim:
Sentinela = None

class Fatia:
    def __init__(self, listagrande, tam_fatia=100):
         self.listagrande = listagrande
         self.tam_fatia = tam_fatia
         self.indice = 0

    def proximo(self):
         if self.indice >= len(self.listagrande):
              return Sentinela
         resultado = lista_grande[self.indice: self.indice + self.tam_fatia]
         self.indice += self.tam_fatia
         return resultado

E essa classe poderia ser usada para fatiar a lista, de forma parecida com o que fiz no primeiro exemplo, mas de forma mais "manual":
fatiador = Fatia(listagrande)
while True:
     pedaco = fatiador.proximo()
     if pedaco is Sentinela:
         # sai do while
         break
     # Codigo para usar a essa sublista
     ....

Agora, o for em Python, sendo um comando que ja sabe percorrer sequências ou iteradores, sabe "fazer uso" de objetos parecidos com o definido nessa classe. Sempre que fazemos um for numero in sequencia: no Python, ele pega o objeto na expressão depois da palavra chave in (nesse caso, a variável "sequência"), e chama o método __iter__ desse objeto. (Se o objeto não tiver um método __iter__ o comando  for tem um "plano B" usando o comprimento do objeto e índices numéricos, mas não vem ao caso agora).
O valor retornado por esse método __iter__, ele mesmo tem que ser um objeto que tenha o método __next__. Se tiver, então o comando for vai chamar esse método __next__ uma vez pra cada iteração - e o valor retornado pelo método é usado na variável do for. Quando o __next__ não tiver mais objetos pra retornar, ele levanta uma execeção do tipo StopIteration. Ao contrário das exceções que estamos mais acostumados a ver, como ValueError e TypeError, o StopIteration não indica um erro - e sim, é um sinal justamente usado pelo for para saber que aquele iterador não tem mais resultados. O comando for então acaba, e a execução continua na primeira linha depois do for.
Então, por exemplo, podemos adaptar a classe acima para funcionar com for, apenas um método __iter__ e renomeando o método proximo:
class Fatia:
    def __init__(self, listagrande, tam_fatia=100):
         self.listagrande = listagrande
         self.tam_fatia = tam_fatia
         self.indice = 0

    def __iter__(self):e
        # Como essa propria classe contem
        # um metodo __next__ apropriado,
        # basta retornar o proprio objeto
        return self

    def __next__(self):
         if self.indice >= len(self.listagrande):
              raise StopIteration()
         resultado = lista_grande[self.indice: self.indice + self.tam_fatia]
         self.indice += self.tam_fatia
         return resultado

Pronto, com essa simples mudança - antes era retornada uma variável de sentinela, cujo valor era comparado num if que tinha que ser escrito manualmente, e agora ele causa a exceção StopIteration. Objetos dessa classe podem ser usados como no primeiro exemplo da resposta:
for list_slice in Fatia(biglist):
    # código para usar a sublista com 100 elementos
    ...

Então, os mantenedores da linguagem, notando que esse era um padrão de uso comum, criaram a palavra chave yield. Sempre que ela aparece no corpo de uma função, a função deixa de ser uma função comum, e passa a ser o que chamamos de "gerador": internamente, ela funciona como a classe acima, e o Python  - quando chamamos uma função dessas, a linguagem já executa o equivalente ao __iter__, mas não executa nem uma linha dentro da função, e sim,  devolve um objeto que tem o método __next__. Quando chamamos o __next__ (ou melhor, o comando for fa essa chamada internamente). aí sim, o código do corpo da função é executado, até o ponto onde encontra o primeiro yield. Nesse ponto, o valor dado ao yield é retornado como o resultado da chamada ao __next__. Quando o __next__ for chamado da próxima vez, a funçãoc continua sendo executada na linha seguinte ao yield; todas as variáveis locais são "lembradas" - o yield funciona como uma "pausa" na função. Isso torna o código interno bem mais eficiente do que uma chamada "real" de função como a que acontece nos exemplos com classes, em que variáveis locais são criadas, etc...
Então, revisitando nosso gerador pra entender melhor:
def slice(biglist, slice_size=100):
    for i in range(0, len(biglist), slice_size):
        yield biglist[i: i + slice_size]

quando o Python encontra  for fatia in slice(minhalista): a mágica acontece - o Python primeiro cria um objeto "generator" com os parâmetros passados, e em seguida chama o __next__ lá dentro - isso executa a linha com o for dentro da função slice - a variável "i" é inicializada, etc... na linha seguinte, a fatia da lista de "i" até "i + 100" é retornada, e é usada "fora da função", no corpo do for externo. As variáveis locais da função funcionam como se fossem atributos de uma classe, preservando o "estado interno" do gerador. (com a notável diferença de que, ao contrário de atributos de objetos no Python, essas variáveis internas não são públicas, e até podem ser lidas, mas não podem ser escritas por código fora da função geradora).
Você pode usar o gerador "manualmente" sem usar o for da seguinte forma:
fatiador = slice(biglist)
while True:
    try:
         fatia = next(fatiador)
    except StopIteration:
         break
    # código para lidar com a fatia aqui
    ...