text:
Q: How to create CNAME record using SoftLayer_Dns_Domain_ResourceRecord::createObject I am trying to create a CNAME record in softlayer

dns_record_create() {
  local rest="https://api.softlayer.com/rest/v3/SoftLayer_Dns_Domain_ResourceRecord/createObject.json" # REST API for creating DNS record
  # silence mode. sleep 3 secs and retry one time if a transient error is returned
  curl -g --retry 1 --retry-delay 3 --user "${auth}" -X POST -d '{"parameters":[{"domainId":"'${zone_id}'","host":"'${newhost}'","type":"'${record_type}'","data":"'${oldhost}'","ttl":"'900'"}]}' "${rest}"
}

oldhost="prod-staging-txndr-flex"
newhost="prod-staging-txndr-flex-ros"

i get back a response, but when i do nslookup on the alias it doesn't return  anything
how to create a CNAME resource to an existing hostname in dns


text:
Q: Why is my grapher printing multiple instances of the function? C++ I have this program that graphs simple parametric equations on a board of a defined length and width by me. It compiles fine but prints multiple instances of the function in different positions of the graph. If someone could please help me figure out why I am getting this output, I would greatly appreciate it. I included comments throughout the code to help understand what is going on.
I do not have enough reputation to post a picture of the output but if you compile and execute it you will see what I am talking about.
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <time.h>
#include <cmath>
using namespace std;

#define N 25
#define M 60

/*
  This function prints the board each time it is called and places an *
  in the place corresponding to the value of the function.
*/
void print_board(char p[M][N]) {
    int i, j;
    for (i=0; i<=N; i++) {
        for (j=0; j<=M; j++)
                 if (i==0)      cout << '=';
            else if (j==0)      cout << '|';
            else if (i==N)      cout << '=';
            else if (j==M)      cout << '|';
            else if (p[i][j]== '*') cout << '*';
            else            cout << ' ';
        cout << endl;
    }
}
/*
  These functions accepts an integer for time and computes a value for x and y
  for the parametirc equations given and returns each.
*/
int fx(int t) {

    int x = t;

    return x;
}

int fy(int t) {

    //int y = 5 * sin(0.2 * t) + 15;
    int y = (pow(t,2)/60) - t + 25;

    return y;
}

/*
  This function copies the old board and comoputes what the new board is.
*/
void next_board(char p[M][N], int t) {
    int i, j;

    //copies the old board
    int q[M][N];
    for (i=0; i<=N; i++) {
        for (j=0; j<=M; j++) {
            q[i][j] = p[i][j];
        }
    }

    //creates the new board
    int x, y;
    for (i=0; i<=N; i++) {
        for (j=0; j<=M; j++) {
            x = fx(t);
            y = fy(t);

            if (i == y && j == x) {
                p[i][j] = '*';  //stores an * for the values of x and y
            }
        }
    }

}

int main() {

    char p[M][N];

    print_board(p);

    int t = 0;
    while(t <= M) {
        cout << string(80, '\n');

        next_board(p , t);
        print_board(p);
        usleep(20000);

        t++;
    }

    return 0;
}

Please help and thank you for all who try!

A: everywhere in your program where you have
char p[M][N]

change them to
char p[N][M]

and you should get the results that youd expect, your mixing axes in your program
heres the whole working code if youd like
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <time.h>
#include <cmath>
#include <string>
using namespace std;

#define N 25
#define M 60

/*
This function prints the board each time it is called and places an *
in the place corresponding to the value of the function.
*/
void print_board(char p[N][M]) {
    int i, j;
    for (i = 0; i <= N; i++) {
        for (j = 0; j <= M; j++)
            if (i == 0)      cout << '=';
            else if (j == 0)      cout << '|';
            else if (i == N)      cout << '=';
            else if (j == M)      cout << '|';
            else if (p[i][j] == '*') cout << '*';
            else            cout << ' ';
            cout << endl;
    }
}
/*
These functions accepts an integer for time and computes a value for x and y
for the parametirc equations given and returns each.
*/
int fx(int t) {

    int x = t;

    return x;
}

int fy(int t) {

    //int y = 5 * sin(0.2 * t) + 15;
    int y = (pow(t, 2) / 60) - t + 25;

    return y;
}

/*
This function copies the old board and comoputes what the new board is.
*/
void next_board(char p[N][M], int t) {
    int i, j;

    //copies the old board
    int q[M][N];
    for (i = 0; i <= N; i++) {
        for (j = 0; j <= M; j++) {
            q[i][j] = p[i][j];
        }
    }

    //creates the new board
    int x, y;

    for (i = 0; i <= N; i++) {

        for (j = 0; j <= M; j++) {
            x = fx(t);
            y = fy(t);

            if (i == y && j == x) {
                p[i][j] = '*';  //stores an * for the values of x and y
            }
        }
    }

}

int main() {

    char p[N][M];

    print_board(p);

    int t = 0;
    while (t <= M) {
        cout << string(80, '\n');

        next_board(p, t);
        print_board(p);
        usleep(20000);

        t++;
    }

    return 0;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Using a jar library compiled with a higher version of javac Let's say I'm using an older version of java (pre java 8) in a project. Can I use a jar library which was compiled using java 8 in this project? What complications could arise if I try to do that? How can I resolve them?

A: An Older Java runtime environment will not understand Java 8 specific features, so running your Java 8 code on Older Java JRE is not going to work.
If you tried to use the JAR compiled in JAVA 8 in your older JAVA version, then you will come across the "Major-Minor Version" issue.
If the jar was compiled using -target 1.7 (or lower) then the Java 7 JRE will be able to use it, but then the author of the jar cannot use language features that only work on Java 8 or newer.


text:
Q: AngularJS hiding #! with rewriting Lets say we have a website build on AngularJS. We figure out how to hide not pretty /#!/ characters from url by setting HTML5mode on true. But we have a problem when visitor came to the website with old url link including /#!/ i.e. www.example.com/#!/products/ it redirect him to homepage www.example.com which of course we didn't meant we expected to redirect him to www.example.com/products/ so we tried write many rewrite rules which says, that if you go to website through old link with /#!/ than it should redirect you to the new link without  /#!/. But this doesn't work for us and we are sure rewrites rules has been OK.
Can be there some problem with AngularJS setting?
Thanks for your time and advices!

A: Fragment identifiers are never sent to the server, so you can't deal with them using server side code (including rewriting). You have to process them with client side code.

A: I solved this problem, but I´m not 100% sure how does it work and I would like to know it. All I need to do was add hashPrefix('!') behind setting of html5Mode.
$locationProvider.html5Mode(true).hashPrefix('!');

Now it works as we wanted, but what hashPrefix('!') actually do? I just found from documentation that it "Configure existing providers" but why hiding of #! works without this?
Please can you explain me my last two questions about this topic. Thank you


text:
Q: TokenMismatch ONLY Certain Browsers - Laravel 5 Fresh/Production One example browser:
IE 11: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Session started at 22:46:56. Fills out form. Submits form at 22:53:18, gets TokenMismatchException. So only 6 minutes later.
Session Started:
Apr 02 22:46:56 production.INFO: Session {"start":1428040016,"id":"8040cc779df0330855f8fa30483af63557aaf9c4","token":"L3nU4ehseV5w1iXy86g18FsgnVs6sAcDNjTUZ5QV","ip":"74.XX","method":"GET","url":"https://sub.domain.com/place-st","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"} []

User submits form 6 minutes later:
Apr 02 22:53:18 production.DEBUG: REQUEST SESSION token: 8L3pba9ALBVBcrvIPM5wnTl7bP0slSIrjCAkfWzh [] []
Apr 02 22:53:18 production.DEBUG: REQUEST INPUT _token: L3nU4ehseV5w1iXy86g18FsgnVs6sAcDNjTUZ5QV [] []
Apr 02 22:53:18 production.DEBUG: REQUEST HEADER X-CSRF-TOKEN:  [] []
Apr 02 22:53:18 production.DEBUG: REQUEST HEADER X-XSRF-TOKEN:  [] []
Apr 02 22:53:18 production.DEBUG: REQUEST URL: https://sub.domain.com/requests/post [] []

Server Vars:
Apr 02 22:53:18 production.DEBUG: array (   'USER' => 'forge',   'HOME' => '/home/forge',   'FCGI_ROLE' => 'RESPONDER',   'APP_ENV' => 'production',   'QUERY_STRING' => '',   'REQUEST_METHOD' => 'POST',   'CONTENT_TYPE' => 'application/x-www-form-urlencoded',   'CONTENT_LENGTH' => '867',   'SCRIPT_FILENAME' => '/home/forge/doamin.com/public/index.php',   'SCRIPT_NAME' => '/index.php',   'REQUEST_URI' => '/requests/post',   'DOCUMENT_URI' => '/index.php',   'DOCUMENT_ROOT' => '/home/forge/doamin.com/public',   'SERVER_PROTOCOL' => 'HTTP/1.1',   'GATEWAY_INTERFACE' => 'CGI/1.1',   'SERVER_SOFTWARE' => 'nginx/1.6.2',   'REMOTE_ADDR' => '74.XX',   'REMOTE_PORT' => '56563',   'SERVER_ADDR' => '104.XX',   'SERVER_PORT' => '443',   'SERVER_NAME' => 'doamin.com',   'HTTPS' => 'on',   'REDIRECT_STATUS' => '200',   'HTTP_ACCEPT' => 'text/html, application/xhtml+xml, */*',   'HTTP_REFERER' => 'https://sub.domain.com/place-st',   'HTTP_ACCEPT_LANGUAGE' => 'en-US',   'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko',   'HTTP_CONTENT_TYPE' => 'application/x-www-form-urlencoded',   'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',   'HTTP_HOST' => 'sub.domain.com',   'HTTP_CONTENT_LENGTH' => '867',   'HTTP_CONNECTION' => 'Keep-Alive',   'HTTP_CACHE_CONTROL' => 'no-cache',   'PHP_SELF' => '/index.php',   'REQUEST_TIME_FLOAT' => 1428040398.7879851,   'REQUEST_TIME' => 1428040398, ) [] []

Session/Cookie
Apr 02 22:53:18 production.DEBUG: REQUEST PATH: requests/post [] []
Apr 02 22:53:18 production.DEBUG: COOKIE: array ( ) [] []
Apr 02 22:53:18 production.DEBUG: SESSION: array (   '_token' => '8L3pba9ALBVBcrvIPM5wnTl7bP0slSIrjCAkfWzh', ) [] []

HTTP Request:
Apr 02 22:53:18 production.DEBUG: POST /requests/post HTTP/1.1 Accept:          text/html, application/xhtml+xml, */* Accept-Encoding: gzip, deflate Accept-Language: en-US Cache-Control:   no-cache Connection:      Keep-Alive Content-Length:  867 Content-Type:    application/x-www-form-urlencoded Host:            sub.domain.com Referer:         https://sub.domain.com/place-st User-Agent:      Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko  _token=L3nU4ehseV5w1iXy86g18FsgnVs6sAcDNjTUZ5QV&var=value&var2=value2&etc... [] []

A: This sounds alot like this known issue with Laravel: https://github.com/laravel/framework/issues/8172
The cause is not yet known, and it has been going on for a while. There are a lot of smart people looking into it - but the apparent randomness of the issue is making it difficult to debug.
I suggest you contribute your information to that ticket and keep an eye there for further information. Specifically we need as much information about your server config and app config as possible - so we can try to replicate the issue. So far the exact method to replicate is not known, making a fix difficult.

A: Most likely the issue is not related to browsers. I believe that there are some people who wait too long and the session expires. After submitting form with expired session the TokenMismatchException happens.
For debugging you can save to log when each of the session is created to see if it was supposed to be expired and you can also play with session lifetime in session.php

A: It could be a long shot but the source of the problem could be compatibility mode of IE and different sessions of those modes using.
Can you try it with adding this line on top of the get and post pages:
header("X-UA-Compatible: IE=Edge");


text:
Q: Is my API response good enough? I'm making an API to allow others to integrate our services into their own systems.
Finding the best way to formulate a response is not easy - I've seen so many different ways of doing it. Many times it is done quite poorly and myself and others have a hard time using it.
This is how I've done it:
<xml>
    <HttpResponse>200</HttpResponse>
    <data>
        <report>
            <id>200</id>
            <date>07.03.2013 11:13:00</date>
            <title>Fake report 1</title>
            <content>Lorem ipsum dolor sit amet.</content>
        </report>
        <report>
            <id>448</id>
            <date>10.04.2013 12:13:34</date>
            <title>Fake report 2</title>
            <content>Lorem ipsum dolor sit amet.</content>
        </report>
        <report>
            <id>927</id>
            <date>25.10.2013 11:49:34</date>
            <title>Fake report 3</title>
            <content>Lorem ipsum dolor sit amet.</content>
        </report>
    </data>
</xml>

If there is an error, then the HttpResponse will give the proper code to signalize this and the data will contain a descprition of the error, like this:
<xml>
    <HttpResponse>418</HttpResponse>
    <data>
        <error>
            AB43   /* <<-- this code says what I can search for in the code to find the exact process/line where it failed */
            <description>You are the one who messed up!!!</description>
        </error>
    </data>
</xml>

My questions are simply: does this response make any sense?
Is there a scenario that I'm not taking into consideration?
Will people have problems retrieving data from a response like this?
How else can I do this?
BTW: I will not use JSON, end of discussion!

A: New way of showing errors based on comments.
I don't want move error up and replace "data", because I want to keep the possibility of having multiple errors. Instead I changed "data" to "errors".
<xml>
    <HttpResponse>418</HttpResponse>
    <errors>
        <error>
            AB43
            <title>document_title_too_long</title>
            <description>The title is limited to 64 characters, yours was 73. </description>
        </error>
        <error>
            AC85
            <title>document_no_category</title>
            <description>You must select a category to save the document. </description>
        </error>
    </errors>
</xml>


text:
Q: Vaadin with JasperReports? I'm looking for a solution to create reports using JasperReports for my application. I found some examples but still could not make it work. I'm using Vaadin7
I'm trying this
public class Report {

public Report(){
    createShowReport();
}

private void createShowReport(){
    final Map map = new HashMap();

    StreamResource.StreamSource source = new StreamResource.StreamSource() {
        public InputStream getStream() {
            byte[] b = null;
            try {
                b = JasperRunManager.runReportToPdf(getClass().getClassLoader().getResourceAsStream("br/ind/ibg/reports/report3.jasper"), map, new JREmptyDataSource());
            } catch (JRException ex) {
               ex.printStackTrace();
            }

            return new ByteArrayInputStream(b);
        }
    };

    StreamResource resource = new StreamResource(source, "report3.pdf");
    resource.setMIMEType("application/pdf");

    VerticalLayout v = new VerticalLayout();
    Embedded e = new Embedded("", resource);
    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);
    v.addComponent(e);

    Window w = getWindow();
    w.setContent(v);
    UI.getCurrent().addWindow(w);
}

private Window getWindow(){
    Window w = new Window();
    w.setSizeFull();
    w.center();
    return w;
}

}
Any idea ?

A: Problem seems to be on the JasperPrint printer = JasperFillManager.fillReport(file, parametros,dados); line.
Make sure that your report is found (file is not null).
In order to show the report, what I usually do is put the resulted pdf in a stream, then create a streamResource with mimeType='application\pdf' and use window.open(resource) to show it.
Example:
StreamResource.StreamSource source = new StreamResource.StreamSource() {

                public InputStream getStream() {
                    byte[] b = null;
                    try {
                        b = JasperRunManager.runReportToPdf(getClass().getClassLoader().getResourceAsStream("reports/report3.jasper"), map, con);
                    } catch (JRException ex) {
                       ex.printStackTrace();
                    }

                    return new ByteArrayInputStream(b);
                }
            };

            StreamResource resource = new StreamResource(source, "report3.pdf", getApplication());
            resource.setMIMEType("application/pdf");

            getApplication().getMainWindow().open(resource, "_new");


text:
Q: jQuery Mobile Store data locally and sync when internet is available I am beginner in jQuery Mobile.
I have a simple form which has 10 fields.
My requirement is, when user submit this form check for internet connection if it's available then store the data in DB else store data locally. Whenever internet connection is available sync those data  and upload to server.
how can i achieve this? Please guide me.
Thanks

A: One way to implement this is to use a standard jQuery ajax call to the database.
If it returns an error (which would, among other things, indicate that an internet connection may not be available) copy or move the data (depending on what you need) to an array specifically used as a pending upload queue.
Then have a function running via setInterval to check if there is data in the pending upload queue, if there is try to upload it, if it succeeds remove the uploaded data from the queue. If it fails leave the data for the next try.


text:
Q: Joomla Temporary URL images forbidden 403 I have setup a development server for an issue(see No Input File Specified - Joomla), all is working correct now on the development server apart from no images on the site or inside the administration menu are loading.
When I try to look at them individually they are 403 forbidden.
http://37.26.108.168/~arbersho/

All directories are 755, all files are 644 and the owner is the correct one.
Is this because of the temporary URL and will this be fixed by pointing the domain over?
Thanks again

A: This was a htaccess issue which is fixed.


text:
Q: Callback in React Native onPress for a Method I would like to make a callback after a method in onPress
I learned how to do this :
this.setState({someState: 'value'}, () => alert('I'm a callback'));

Now I would like to do like this :
<TouchableOpacity onPress={this.myMethod() // And then have a callback here} />

How can I do

A: The best way to do this is to pass the callback as an argument
myMethod=(callback)=>{
  //logic of mymethod
  if(callback)
  {
    callback();
  }
}

//inside render
<TouchableOpacity onPress={()=>this.myMethod(callback)} />

This way the callback would be executed once the logic of myMethod is completed.


text:
Q: How to configure Sharepoint site for intranet? I am basically a windows developer and very new to Sharepoint. I have Designed a small site in sharepoint on my virtual PC environment.
I want to access it from out side of VPC environment and also from other local LAN machines [like intranet].
How do i configure (IIS/Sharepoint Adm) to make my site as an intranet site?
I googled it, but not able to get desired information.  I don't have much knowledge in ISS setting also, kindly provide any help in layman style.

A: You need to configure Virtual PC to use Virtual Networking:

In this case a virtual machine acts as
  an independent computer in a network
  with the host computer. If there is a
  DHCP server in the network (Dynamic
  Host Configuration Protocol) to assign
  IP addresses, a virtual machine will
  get it and will work as an independent
  system in the network (otherwise, you
  will have to specify an external IP
  manually)

This is actually the default option in Virtual PC. You should be able to access the VM on the network as you would your own machine. Of course this means the VM's network settings must be valid for your network.
You shouldn't have to reconfigure anything is IIS/Sharepoint Adm to get this to work.


text:
Q: Which function is loaded first in custom class Swift? Which function is loaded first in custom class Swift? When I have a class that is linked to a view controller we have the viewdidload function.
But if you have a custom class? What is loaded than?
import Foundation
import StoreKit

class iap: NSObject, SKProductsRequestDelegate,SKPaymentTransactionObserver {

    override init(){
        if(SKPaymentQueue.canMakePayments()) {
            print("IAP is enabled, loading")
            let productID:NSSet = NSSet(objects: "seemu.iap.test", "seemu.iap.removeads")
            let request: SKProductsRequest = SKProductsRequest(productIdentifiers: productID as! Set<String>)

            request.delegate = self
            request.start()
        } else {
            print("please enable IAPS")
        }
}

I have this construction, but is this right?
And there is an error on the request.delegate = self: 'self' used before super.init call. So I think the init method is not right for this case?


text:
Q: Haskell for Robotics I am looking up on web about Haskell and its applications. Basically i trying to learn functional programming language and i see Haskell is very famous among them. What i want to know is, is it possible to use Haskel as substitute for c in robotics? Can i use Haskell for embedded system programming and getting data from sensors, moving the motors, implementing mathematical model that is used to design the robot and its behaviour and if possible apply machine learning algorithms?
I am just starting off in this field so if the question is naive enough, please answer like you would answer any newbie.
Update: If the Question is too broad, i would like to know the specifics. Do people compile down the haskell to the embedded hardware or use haskell as a remote control in most of the cases? Which one is more approachable using haskell? What is the general way of using haskell in hardware embedded programming? If it is only used as a remote control, how to implement genetic algorithms and machine learning algorithms using haskell? I know its too broad but i would just like to know the general usage if my requirement is such.


text:
Q: Truecrypt read only Ubuntu So i have an issue with Truecrypt after moving across from my Mac OSX. Treucrypt file container created in MacOSX, now living in my Ubuntu home folder.
Now when I mount my Truecrypt volume (asks for TC & Ubuntu administrator password) and tried to write anything to or within it it comes up as an error that the destination is read-only. Can read the files as normal.
I've checked the volume properties in Truecrypt, - it was NOT created as a read-only volume.
When I mount the volume in Truecrypt for each session the 'Mount as read-only' option is NOT ticked.
I've a feeling this is an Ubuntu permissions issue or step that I'm missing. I've been mounting from the GUI.
Can anyone please enlighten me as to how to get write priveleges with the mounted container?
Thanks in advance

A: Depending on the file system used, this might help:
$ cd /media/truecrypt1
$ sudo chown -R $USER .

It sets the ownership of all files inside the encrypted file system to the currently logged in user.

A: I my case, I had to disable journaling on the Volume first. (I was mounting a fully-encrypted external hard-disk created on a Mac.)
On the Mac I did as described here:
diskutil disableJournal /Volumes/myVolume

Afterwards I did what pcworld said. chown. Then it worked.


text:
Q: How to overlap images in a beamer slide? I'm creating a beamer presentation. I want to make one frame that has a couple of images overlapped, like a stack of photos. Actually, I want something like this:
.-----.
| AAA |
| AAA |
'-----'

Then, the next slide shows:
.-----.
| AAA |
| AA.-----.
'---| BBB |
    | BBB |
    '-----'

And then, the next one shows:
.-----.
| AAA |
| AA.-----.
'.-----.B |
 | CCC |B |
 | CCC |--'
 '-----'

The idea is to control the position of each image and allow them to overlap. I have no idea about how to do this in beamer.
I think the best solution is to have all images inside the same frame, but put a \pause command between them.

A: A TikZ example:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}
\begin{center}
\begin{tikzpicture}
  \node (img1) {\includegraphics[height=3cm]{img1}};
  \pause
  \node (img2) at (img1.south east) {\includegraphics[height=3cm]{img2}};
  \pause
  \node (img3) at (img2.south west) [yshift=1cm] {\includegraphics[height=3cm]{img3}};
\end{tikzpicture}
\end{center}
\end{frame}

\end{document}

The second and third images are placed on a corner of the previous image, the third also shifted a little upward, the reason being that with the images I used there was some whitespace between them. You could of course place the images at specific coordinates, and not relative to each other like here.

A: Can be done with the simple LaTeX command \put without any additional package. The units are in pt, but if you prefer other units then you can set it by for example: \unitlength=1cm. The values are always measured from the current point. In my example from the beginning of the line
\PassOptionsToPackage{demo}{graphicx}%% Only for demo here
\documentclass{beamer}
\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}
\begin{document}

\begin{frame}
\includegraphics[height=3cm]{img1}\pause

\Put(10,50){\color{blue}\includegraphics[height=3cm]{img2}}\pause

\Put(100,30){\color{red}\includegraphics[height=3cm]{img3}}
\end{frame}

\end{document}

A: You can place all three images at absolute positions using the textpos package (see also Absolute positioning in beamer). A further method would be to use TikZ to place the three images in own coordinate system inside a tikzpicture. Both pacakges should work very well with beamer. The animation can be added using \pause or another overlay macro of beamer.


text:
Q: Vertical Align Text After Font Icon

Free wifi

How can I display h4 element on the right of the icon and vertically aligned? Should I float left the span?

A: One of the ways would be to use inline-block display and middle align it - see demo below:

.wrapper > * {
  display: inline-block;
  vertical-align: middle;
}
.blue {
  color: blue;
}
.white {
  color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

Free wifi

A: Use CSS Flexbox. Make a parent
 that wraps icon and text into it (in my case its icon-holder) and make it a flexbox container using display: flex.
Have a look at the snippet below:

.icon-holder {
  display: flex; /* Flex Container */
  align-items: center; /* Vertically Align Content */
}

.blue {
  color: #33b5e5;
}

span {
  color: #fff;
}

h4 {
  padding-left: 5px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>

Free wifi

Hope this helps!

A: You can use display: flex and can do something like below :

*

*

.col-md-4 {
  display: flex;
  align-items: center;
}

.blue {
  color: blue
}

.white {
  color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

Free wifi


text:
Q: Additional tab separated column while Compressing Decompressing Hdfs File through Mapreduce I am compressing  a text file on Hdfs in Bzip2 format using
FileOutputFormat.setCompressOutput(jobConf, true);
FileOutputFormat.setOutputCompressorClass(jobConf,BZip2Codec.class);

and decompressing it using mapreduce
TextInputFormat.setInputPaths(jobConf,"//Bizip file Path");
FileOutputFormat.setOutputPath(jobConf, new Path(outputFilePath));

but the output contain additional tab    separated column
Input - 1,XYZ
        2,ABC
Output- 0 -> 1,XYZ
        11-> 2,ABC

Although, while using unix command bzip2 -k /filename.txt
and bunzip2 /filename.bz2 no additional data is getting added.

A: 0,11 are line offset. f you don't need that set your output key as NullWritable in BZip2Codec.class.


text:
Q: Is it legal to use variables in a closure before declaring them with let or const in an outer scope? A piece of code like the one below runs flawlessly both in Firefox and Chrome.
function A() {
    console.log(message);
}

let B = function () {
    console.log(message);
};

let message = 'Hello, World!';

A();
B();

Anyway, JSHint complains about the message variable being used before declaration.

'message' was used before it was declared, which is illegal for 'let' variables.

Is it really illegal to use a variable declared with let or const in an outer scope inside a closure when the declaration follows the closure block, or is JSHint going nuts?

A: Here in your case using a variable defined by using let is fine. But in other cases it causes problem. For example,
console.log(x); let x = 10;

Will throw you a reference error. Because x got created but not initialized. This is not like a normal variable definition which uses var. let declarations will not be initialized until the the statement with let got executed. Hence JSHint complains you about your code in a generic way.


text:
Q: Default Values of mq_attr structure We are setting the message queue attributes using
int mq_setattr(mqd_t mqdes, struct mq_attr *newattr,
                        struct mq_attr *oldattr);

where mq_attr is consisting of following fields :
struct mq_attr {
               long mq_flags;       /* Flags: 0 or O_NONBLOCK */
               long mq_maxmsg;      /* Max. # of messages on queue */
               long mq_msgsize;     /* Max. message size (bytes) */
               long mq_curmsgs;     /* # of messages currently in queue */
           };

My question at the time of creation if we have not set the attributes then what are values inside  mq_attr (default values) ?

A: If you do not initialize your struct mq_attr, but supply it when you do mq_open, the variables will have unspecified content. Meaning the mq_attr could have random values.
So
struct mq_attr attr; //Will be uninitialized -> bad thing
q = mq_open("/mqtest",O_RDWR|O_CREAT,0660,&attr);

As always, in C, you need to initialize variables before using them.
You can pass NULL for the attribute to mq_open() to get the system defaults though.
You can learn the system defaults yourself. They're system dependent, and defaults might be tunable via sysctls, resource limits or similar.
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <mqueue.h>

int main(int argc, char *argv[])
{
    struct mq_attr attr;
    /*
    struct rlimit limit;
    if(getrlimit(RLIMIT_MSGQUEUE,&limit) == -1) {
        perror("getrlimit");
        return 1;
    }
    printf("RLIMIT_MSGQUEUE cur = %ld,max = %ld\n",(long)limit.rlim_cur,(long)limit.rlim_max);
    */

    mqd_t q = mq_open("/mqtest",O_RDWR|O_CREAT,0660,NULL);
    if(q == -1) {
        perror("mq_open");
        return 1;
    }
    if (mq_getattr(q, &attr) == -1) {
        perror("mq_getattr");
        return 1;
    }
    printf("mq_flags %ld\n",  attr.mq_flags);
    printf("mq_maxmsg %ld\n", attr.mq_maxmsg);
    printf("mq_msgsize %ld\n",attr.mq_msgsize);
    printf("mq_curmsgs %ld\n",attr.mq_curmsgs);
    mq_close(q);
    mq_unlink("/mqtest");
    return 0;
}

The commented out part can give you the rlimit for the max bytes in a queue on linux, set with e.g. the ulimit command.

A: It depends by the compiler. However in C there are no default values for variables unlike Java or other languages so you can't have any expectation from what there are in your variables.


text:
Q: Handle Enter Key on website When I press enter in my loginform, my search form at the top of the website runs instead. I'm trying to handle the enter key but I keep getting a missingmemberexception.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim getButton As New findbuttonControl
        Dim vButton As Object
        Dim getPassword As New findChildControl
        Dim vPassword As Object

        vButton = getButton.getGrandChildValue(Me.LoginView1.Controls, "Login1", "LoginButton")
        vPassword = getPassword.getGrandChildValue(Me.LoginView1.Controls, "Login1", "Password")

        vPassword.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + vButton + "').click();return false;}} else {return true}; ")
End Sub

A: Have a look at the new ASP.Net 2.0 DefaultButton Property.


text:
Q: Extjs Set dirty false for form after saving I need to reset the form's dirty status to false after saving the form.
Form is configured for trackresetonload so that not set dirty for setvalue function.
I tried calling reset() but it resets the data in the form fields to its previous state(ie initial value).
Is there a way to do this,
Thanks.

A: formpanel.setValues(formpanel.getValues());

Aafter you call this, the form has not longer the dirty status


text:
Q: static variables duplicate in defined template class usage from DLL i have the following code in a DLL, in a header file called TemplateT:
#pragma once

template<class T>
class __declspec(dllexport) TemplateT {
public:
    static int number;
    TemplateT(int num) {
        number = num;
    }
    int getNumber() {
        return number;
    }

};
template<class T>
int TemplateT<T>::number;

and on another header file called Exported.h
#pragma once
#include "TemplateT.h"

#define EXPORTED __declspec(dllexport)

extern EXPORTED TemplateT<int> exported;

and on Exported.cpp i have:
#include "Exporter.h"

TemplateT<int> exported(5);

As you can see, im initiating the static member "number" to the value of 5.
but as i access the variable from another project like this:
#include <iostream>
#include "Exporter.h"

int main()
{
    int a = exported.getNumber();
    int b = 0;
}

i see the value of number as 0.
Ill be happy if you could explain to me this behavior.
EDIT
both are used with visual studio 2019. the dll is compiled with vs19 and the other project with vs10
I found a question about the same situation, but the answers there did not fix it for me
two instances of static member

A: [SO]: DLL-Exporting static members of template base class provides an answer. Your class (and exported variable) has 2 instances of the static member:

*

*In the .dll (Exporter.cpp) - initialized (explicitly) to 5

*In the .exe (main.cpp) - initialized (default) to 0 (this is the one you're actually seeing)

I replicated your code with minor changes - the most important one is the extra (regular .dll export) file
Export.h:
#pragma once

#if defined(_WIN32)
#  if defined(DLL0_STATIC)
#    define DLL0_EXPORT_API
#  else
#    if defined(DLL0_EXPORTS)
#      define DLL0_EXPORT_API __declspec(dllexport)
#    else
#      define DLL0_EXPORT_API __declspec(dllimport)
#    endif
#  endif
#else
#  define DLL0_EXPORT_API
#endif

Below are 2 screenshots took during debugging:

*

*Constructor

*Getter

Looking at the number member address (red boxed), it's different in the 2 pictures (note that the instance address (this) is the same), so there's the proof.
Now, looking at the bigger picture, this seems like an XY Problem. I don't see any scenario (except for curiosity purposes only) where this design would fit, because
the static member is set to the constructor argument, meaning that a new instance will overwrite whatever previous ones have set, so at a point in time, the member will contain the argument that was passed to the last instance constructor.

A: The #include instruction really means include. It effectively inserts the content of the included header file into the source file(.c/.cpp) (recursively).
So, when you (directly or indirectly) include your template.h in multiple source files, every source file will allocate it's own static number filed. If these source files are compiled into one target file, there will be a link error. But if they are compiled into difference DLL/EXEs, they will keep their own copy of that static filed.
This is similar to global varibles, in which you generally have to use extern keyword to tell the compiler this is just a declaration, not a definition.


text:
Q: issue with calendar_date_select gem my error, my usage was based on this link (form builder tab): http://electronicholas.com/calendar
ArgumentError in Sales#new

Showing app/views/sales/new.html.erb where line #14 raised:

wrong number of arguments (5 for 4)

Extracted source (around line #14):

11:   <%= f.text_area :description %>

12:

13:   <%= f.label :startdate %>:
14:   <%= f.calendar_date_select :startdate, :embedded => true %>

15:
16:
17:

A: Which version of CalendarDateSelect are you using? I have version 1.15. I found something similar in the bug tracker. Maybe you have an old version and if you update it will be fixed?
I have tried in my app using CalendarDateSelect in a form builder with embedding and it works.
<% form_for @project do |form| -%>
  <%= form.calendar_date_select :starts_on, :embedded => true  %>
<% end -%>

I get this on the page
<input id="project_starts_on" name="project[starts_on]" type="hidden" />

Make sure you put the includes at the top of your page/layout
<%= calendar_date_select_includes -%>

A: I suspect you should have used calendar_date_select_tag there, instead of calendar_date_select.


text:
Q: Problems while installing StanfordCoreNLP in OSX: How to set up the environment variables for jupyter/pycharm? I downloaded and installed the StanfordCoreNLP as follows:
$ cd
$ wget http://nlp.stanford.edu/software/stanford-ner-2015-12-09.zip
$ unzip stanford-ner-2015-12-09.zip
$ ls stanford-ner-2015-12-09/
build.xml    LICENSE.txt   ner-gui.bat      ner.sh                 sample.ner.txt     stanford-ner-3.6.0.jar          stanford-ner.jar
classifiers  ner.bat       ner-gui.command  README.txt             sample.txt         stanford-ner-3.6.0-javadoc.jar
lib          NERDemo.java  ner-gui.sh       sample-conll-file.txt  sample-w-time.txt  stanford-ner-3.6.0-sources.jar
$ export STANFORDTOOLSDIR=$HOME
$ export CLASSPATH=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/stanford-ner.jar
$ export STANFORD_MODELS=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/classifiers

Then let's try if it actually worked:
$ python3
>>>import nltk
>>> nltk.__version__
'3.1'
>>> from nltk.tag import StanfordNERTagger
>>> st = StanfordNERTagger('english.all.3class.distsim.crf.ser.gz')
>>> st.tag('Rami Eid is studying at Stony Brook University in NY'.split())

[('Rami', 'PERSON'), ('Eid', 'PERSON'), ('is', 'O'), ('studying', 'O'), ('at', 'O'), ('Stony', 'ORGANIZATION'), ('Brook', 'ORGANIZATION'), ('University', 'ORGANIZATION'), ('in', 'O'), ('NY', 'O')]

So, upon here everything works perfect. The problem is when I close the terminal and start working in the jupyter notebook (or pycharm):
In:
from nltk.tag import StanfordNERTagger
st = StanfordNERTagger('english.all.3class.distsim.crf.ser.gz')
st.tag('Rami Eid is studying at Stony Brook University in NY'.split())

Out:
---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
<ipython-input-2-118c7edca797> in <module>()
      1 from nltk.tag import StanfordNERTagger
----> 2 st = StanfordNERTagger('english.all.3class.distsim.crf.ser.gz')
      3 st.tag('Rami Eid is studying at Stony Brook University in NY'.split())

/usr/local/lib/python3.5/site-packages/nltk/tag/stanford.py in __init__(self, *args, **kwargs)
    166
    167     def __init__(self, *args, **kwargs):
--> 168         super(StanfordNERTagger, self).__init__(*args, **kwargs)
    169
    170     @property

/usr/local/lib/python3.5/site-packages/nltk/tag/stanford.py in __init__(self, model_filename, path_to_jar, encoding, verbose, java_options)
     51                 self._JAR, path_to_jar,
     52                 searchpath=(), url=_stanford_url,
---> 53                 verbose=verbose)
     54
     55         self._stanford_model = find_file(model_filename,

/usr/local/lib/python3.5/site-packages/nltk/__init__.py in find_jar(name_pattern, path_to_jar, env_vars, searchpath, url, verbose, is_regex)
    717         searchpath=(), url=None, verbose=True, is_regex=False):
    718     return next(find_jar_iter(name_pattern, path_to_jar, env_vars,
--> 719                          searchpath, url, verbose, is_regex))
    720
    721

/usr/local/lib/python3.5/site-packages/nltk/__init__.py in find_jar_iter(name_pattern, path_to_jar, env_vars, searchpath, url, verbose, is_regex)
    712                     (name_pattern, url))
    713         div = '='*75
--> 714         raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
    715
    716 def find_jar(name_pattern, path_to_jar=None, env_vars=(),

LookupError:

===========================================================================
  NLTK was unable to find stanford-ner.jar! Set the CLASSPATH
  environment variable.

  For more information, on stanford-ner.jar, see:
    <http://nlp.stanford.edu/software>
===========================================================================

So, my question is how to set the environment variables correctly?, I also tried to add this to my bash profile:
#StanfordCORENLP
export STANFORDTOOLSDIR=$HOME
export CLASSPATH=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/stanford-ner.jar
export STANFORD_MODELS=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/classifiers

Update
Based on @alexis answer, this is what I tried:
user@MacBook-Pro:~$ % jupyter notebook /Users/user/Jupyter/Project1/Version1 &
-bash: bg: %: no such job
-bash: bg: jupyter: no such job
-bash: bg: notebook: no such job
-bash: bg: /Users/user/Jupyter/Project1/Version1: no such job

And this:
user@MacBook-Pro-de-User:~$ sudo mate /etc/launchd.conf
Password:
path::entries: scandir("/Applications/TextMate.app/Contents/Resources/PrivilegedTool"): Not a directory

Then:
user@MacBook-Pro-de-User:~$ sudo mate /etc/launchd.conf
Password:
path::entries: scandir("/Applications/TextMate.app/Contents/Resources/PrivilegedTool"): Not a directory

Then in the text editor:
#StanfordCORENLP
setenv export STANFORDTOOLSDIR=$HOME
setenv export CLASSPATH=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/stanford-ner.jar
setenv export STANFORD_MODELS=$STANFORDTOOLSDIR/stanford-ner-2015-12-09/classifiers

Update2
I tried the following:
user@MacBook-Pro-de-User:~$ jupyter notebook /Users/user/Jupyter/Project1/Version1 & /Users/user/stanford-ner-2015-12-09

Then:
---------------------------------------------------------------------------
LookupError                               Traceback (most recent call last)
<ipython-input-1-215fd2418c10> in <module>()
      1 from nltk.tag import StanfordNERTagger
----> 2 st = StanfordNERTagger('english.all.3class.distsim.crf.ser.gz')
      3 #st = StanfordNERTagger('/home/me/stanford/stanford-postagger-full-2015-04-20/classifier/tagger.ser.gz',\
      4                            #'/home/me/stanford/stanford-spanish-corenlp-2015-01-08-models.jar')
      5 st.tag('Rami Eid is studying at Stony Brook University in NY'.split())

/usr/local/lib/python3.5/site-packages/nltk/tag/stanford.py in __init__(self, *args, **kwargs)
    166
    167     def __init__(self, *args, **kwargs):
--> 168         super(StanfordNERTagger, self).__init__(*args, **kwargs)
    169
    170     @property

/usr/local/lib/python3.5/site-packages/nltk/tag/stanford.py in __init__(self, model_filename, path_to_jar, encoding, verbose, java_options)
     51                 self._JAR, path_to_jar,
     52                 searchpath=(), url=_stanford_url,
---> 53                 verbose=verbose)
     54
     55         self._stanford_model = find_file(model_filename,

/usr/local/lib/python3.5/site-packages/nltk/__init__.py in find_jar(name_pattern, path_to_jar, env_vars, searchpath, url, verbose, is_regex)
    717         searchpath=(), url=None, verbose=True, is_regex=False):
    718     return next(find_jar_iter(name_pattern, path_to_jar, env_vars,
--> 719                          searchpath, url, verbose, is_regex))
    720
    721

/usr/local/lib/python3.5/site-packages/nltk/__init__.py in find_jar_iter(name_pattern, path_to_jar, env_vars, searchpath, url, verbose, is_regex)
    712                     (name_pattern, url))
    713         div = '='*75
--> 714         raise LookupError('\n\n%s\n%s\n%s' % (div, msg, div))
    715
    716 def find_jar(name_pattern, path_to_jar=None, env_vars=(),

LookupError:

===========================================================================
  NLTK was unable to find stanford-ner.jar! Set the CLASSPATH
  environment variable.

  For more information, on stanford-ner.jar, see:
    <http://nlp.stanford.edu/software>
===========================================================================

A: Look like you're starting the notebook server from the GUI. The problem is that in OS X, the GUI does not inherit the environment of the shell. You can immediately get it to work by starting the notebook server from the terminal:
jupyter notebook <path-to-notebook-folder> &

This should let you run with the same environment that your successful python3 invocation used.
There are ways to modify the environment of applications launched by the GUI; if you don't mind setting CLASSPATH system-wide, you can set it in /etc/launchd.conf as described here. (Log out or restart your system after editing launchd.conf). You could also try this (not sure if it'll still work), or google around for other alternatives.


text:
Q: Using DrawableComponent correctly I wanted to extend this class for a GUI layer on top of my game. I can't find much information on actually using the IComponent, IDrawable series of interfaces. It seems that most of the examples I've looked at, the developer is handling all of this on their own.
What is the appropriate way to use these interfaces?

A: Once you add the component to the list of components, the xna game framework takes care of calling all of the appropriate methods for you.  In practice, no one ever really implements the interfaces directly, they just use one of the built in components like DrawableGameComponent (As @Peter pointed out).
Here is an example/tutorial on how to use it :-)

A: As noted before, you should derive your class from DrawableGameComponent. Then you should implement
    public override void Update(GameTime gameTime)
    {
        // TODO: Add your update code here

        base.Update(gameTime);
    }

    public override void Draw(GameTime gameTime)
    {
        // TODO: Add your update code here

        base.Draw(gameTime);
    }

It's important to create your DrawableGameComponent in its container's (typically your Game1 class) constructor and add to Game.Components in the same place, otherwise your components methods might not get called correctly.
If you manage your components this way, Initialize, Update and Draw will be called automatically by the framework.
The same goes for GameComponents, but obviously without the Draw method.


text:
Q: Help explaining "Where am I?" vs "...where I am" I would like to explain to a non-native girlfriend that it's correct to say "Where am I?" on its own as a question, but if you want to say "Can you guess where I am?" or "Do you know where I am?" or "I don't know where I am" then the word order is flipped around.
Although I am native I don't have any idea why this grammar is what it is, so I'd really appreciate any help explaining it.

A: The cause lies in the different syntax of both examples:

Where am I?

This is a simple main clause which comes in the form of a question. Therefore its word order differs from that of normal positive sentences: the predicate is moved in front of the subject to mark the sentence as a question.

Positive statement: You_[Subject] are_[Predicate] here_[Prepositional Object].
Question: Where_[Question word] am_[Predicate] I_[Subject]?

Now let's come to your second example, which is yet another question. Again, let's compare it to a positive statement like above:

Positive statement: I know where I am.
Question: Do you know where I am?

This time, we have a main clause and an (interrogative) clause, which is highlighted in bold print. As you can see, the subject-predicate-inversion to mark the question only happens in the main clause while the subordinate clause remains unchanged:

Positive statement: I_[Subject] know_[Predicate] where I am_[Object].
Question: Do_[Predicate1] you_[Subject] know_[Predicate2] where I am?_[Object]

So there you have it: Example 1 is just a main clause, which is why the word order is changed when forming a question. Example 2 is a combination of main clause and subordinate clause, so the word order only changes in the main clause to mark the sentence as a question.

A:
[1] Where am I?
[2] Do you know [where I am]?

With main clause interrogatives like [1], the interrogative phrase usually occupies initial position and, if it is not the subject, its placement triggers subject-auxiliary inversion. But in subordinate interrogative clauses like the bracketed one in [2], there is normally no inversion.
Main clause interrogatives ask questions, but subordinate interrogative clauses (embedded questions) express questions, but do not themselves ask them.
Usually (but not always) the construction can be glossed with the formula "the answer to the question". The meaning of [2] is "Do you know the answer to the question 'Where am I?'"
You other examples fit the same pattern as [2].

A: The subject and auxiliary verb are normally switched order in a question. This process is called a subject-auxiliary inversion. That's why the auxliary verb precedes the subject in your first example.

Where am I?(NOT where I am? )

However, when the question is embedded in a sentence(or inside another clause) this process does not occur.

Can you guess [Where I am]? (NOT Can you guess where am I?)

A: For those who don't want a strict grammatical approach, this is how I'd explain (native English speaker to learner)
"Where am I" is a question. That's signalled by the reversal of "am" and "I".
"Can you guess [X]" is also a  question, whatever [X] might be. A statement would be "You can guess [X]", without the reversal.
in "Can you guess where I am", [X] is "where I am". If I remember my grammar right, it's a noun phrase, and the object of the verb "guess" (but I'm not completely certain I do remember right ).

A: Where am I -> The place were you are |
 Where I am -> Were YOU are
They can mean the pretty much think, but they are used in differend ocasions, basicly
You can, for example say:
The place were I am is beutiful;
but you cant say
The place were am I is beutiful;
You can say:
Were am I from?
And you can also say
Were I am from. (but when you say this u are expected toadd more info to your phrase, like, Thats were I am from, or smthing like that)


text:
Q: Ubuntu live CD upgrade option grayed out (13.10) I currently have windows 7 and ubuntu 13.04 on the same HD. I would like to upgrade ubuntu 13.04 to 13.10 without using the internet.
So I inserted the USB drive and it detects my windows 7  and my ubuntu 13.04 installation perfectly. But the first choice in the list which is:
"Upgrade Ubuntu 13.04 to Ubuntu 13.10
Documents, music and other personal files will be kept. Installed software will be kept where possible. System wide settings will be cleared."
It is completely grayed out. But that is the option I would like to chose and I don't know why it is disabled.
What must I do to enable that option?
Else can I upgrade my installation by booting the live CD?

A: you need to have an internet connection in order for the "upgrade" option to be enabled. Else you can only reinstall from scratch.
source and credit: comment from @larienna


text:
Q: [VHDL]Using signal to drive output ports,why are the output ports not visible? in reference to this post How to write to two output ports from inside architecture in VHDL? I made a VHDL module using the same concept as decribed in one of its answers.
His code:
entity HIER is
port (
    IN1 : in bit;
    OUT1, OUT2 : out bit);
end hier;

architecture HIER_IMPL of HIER is
   signal temp : bit;
   component BUF1 is
      port (a : in bit; o : out bit);
   end component;
begin
   BUF2 : BUF1 port map (a => IN1, o => temp);
   OUT1 <= temp;
   OUT2 <= temp;

end HIER_IMPL;

His generated RTL(using xilinx 9.1i)

I made a D flip flop using the same concept of signal to drive output ports
my code:
entity dfff is
    Port ( D : in  STD_LOGIC;
           clk : in  STD_LOGIC;
           Q : out  STD_LOGIC;
           Qbar : out  STD_LOGIC);
end dfff;

architecture Behavioral of dfff is
component nand_2 is
port(A:in std_logic;
        B:in std_logic;
        C:out std_logic);
end component;
component not_1 is
port(A:in std_logic;
                B:out std_logic);
                end component;
signal Z : std_logic_vector(4 downto 0);
begin
n1 : not_1 port map (D,z(0));
n2 : nand_2 port map(D,clk,z(1));
n3 : nand_2 port map(z(0),clk,z(2));
n4 : nand_2 port map(z(1),z(3),z(4));
n5 : nand_2 port map(z(2),z(4),z(3));
Q<=z(4);
Qbar<=z(3);
end Behavioral;

my generated RTL(using xilinx 9.1i):

Now MY question is that why My output ports Q and Qbar not visible in the RTL while his OUT1 and OUT2 are?
I am a beginner in this field.

A: Works fine in ISE14.4. I remember old versions of RTL Viewer being practically unusable.

A: When I first started writing VHDL I also tried writing a FF in discrete gates, AFAIR it didn't go too well.
You should be writing to your platform (in this case probably some Xilinx chip), knowing what it is and does.
This will also help you when you get on in your training, FPGAs and CPLDs are not great arrays of AND and OR gates, they are great arrays of lookup tables, so the chance of an implementation of a FF in an FPGA turning out well is slim to none.
Regarding your actual question, I'd first make sure I actually have my outputs set to go somewhere. The synthesizer tries very hard not to include superfluous circuitry, so if your result doesn't end in anything, it might get optimized away (even though that should surely also optimize away the circuitry that you did get).
Also as mentioned, try updating your tools, 14.7 is a far stretch newer than 9.1 and that is even from October 2013.


text:
Q: How make the react component read or edit based on HOC function in navigation? I want to make components read or edit based on the authorization. Example
const auth = "read" || "edit"

if auth is read users can only allow read the component. If auth is edit the user can allow to edit the component.
How to wrap all the component to global HOC function and based on the auth how to navigate.
navigationContainer

<Stack.Navigator initialRouteName="LoginComponent">
      <Stack.Screen
        name="LoginScreen"
        component={LoginComponent}
        options={{
          headerShown: false,
          gestureEnabled: false,
        }}
      />
 <Stack.Screen
        name="Upload"
        component={Uploadcompoenent}
        options={{
          headerShown: false,
          gestureEnabled: false,
        }}
      />
</Stack.Navigator>

condition
1.let consider if the user supervisor then the user can do upload the new image. 2.if the user is an assistant supervisor the user can only read the screen. for the assistant supervisor upload option is disabled.
I want to put all the components into one HOC function based on the auth user can read or upload the image.
Thanks,
Any leads will be appreciated :)

A: Considering a component <Stack.Navigator/> as HOC which will render a couple of child elements.
Inside Stack.Navigator component you will have your auth value which can be passed to all the child components using React.Children.map in this way:
export default function ParentComp(props) {
  const auth = 'edit';

  return React.Children.map(props.children, (child, i) => {
    let el = React.cloneElement(child, {
      auth
    });
    return el;
  });
}

So, your Child components will accept your auth state as props which would be used to block certain events on your child component.
export default function ChildComp(props) {
  return (
    <div>
      component is only {props.auth} {props.test}
    </div>
  );
}


text:
Q: How to use JSON.net to serial objects but not strings I am looking for this code: https://dotnetfiddle.net/80dz3V
using System;
using Newtonsoft.Json;
public class Program
{

    public class Product
    {
        public string Name {get; set;}
        public DateTime Expiry {get; set;}
        public string[] Sizes {get; set;}
    }

    public void Main()
    {
        Product product = new Product();
        product.Name = "Apple";
        product.Expiry = new DateTime(2008, 12, 28);
        product.Sizes = new string[] { "Small" };

        string json = JsonConvert.SerializeObject(product);
        Console.WriteLine(json);

        object str = "test";

        json = JsonConvert.SerializeObject(str);
        Console.WriteLine(json);
    }
}

To correctly handle Product but to return just test and not "test"
Output:
{"Name":"Apple","Expiry":"2008-12-28T00:00:00","Sizes":["Small"]}
"test"

Wanted Output
{"Name":"Apple","Expiry":"2008-12-28T00:00:00","Sizes":["Small"]}
test

I understand I could just use a wrapper and check for as but I am curious on what if any JSON.net options are available that can accomplish this?

A: Well if your product is a viewModel maybe you can use automapper to return it like Json or you can use the following method with newtonsoft
var jsonObject = new JObject
    {
         {"Property1", Obj.Prop1},
         {"Property2", Obj.Prop1 },
         {"Property3", Obj.Prop1 },
         {"Property4", Obj.Prop1 }
    };

For example the result would be:
{"Property1": "Test", "Property2": 1, "Property3": "ABC123", "Property4": 123.21 }


text:
Q: Factoring and expanding $1-x^8$ It's been a while since I've studied factoring, and I need it for a question. How did this go from $1-x^8$ to $(1-x^4)(1+x^4)$ and then to $(1-x)(1+x+...+x^7)$? I remember studying this a few years go but unfortunately I don't remember.
$$1-x^8=(1-x^4)(1+x^4)=(1-x)(1+x+\dots + x^7)$$

A: You may remember $$(a+b)(a-b) = a^2 - b^2.$$  To see this, just multiply out.  You get $a^2 + ba - ab - b^2$, and the middle terms cancel, leaving you with $a^2-b^2$.
Then if you take $a=1, b=x^4$, you get $$(1+x^4)(1-x^4) = 1-x^8.$$  That's your first identity.
You may also remember $$(1+x+x^2+\ldots+x^n)(x-1) = x^{n+1}-1.$$  It's possible that you remember the formula for the sum of a geometric series:  $$1+x+x^2+\ldots+x^n = \frac{x^{n+1}-1}{x-1}$$
but if not, just do the multiplication: distribute the right-hand factor $x-1$ over the left-hand factor:
$$\begin{align}
(1+x+x^2+\ldots+x^n)(x-1)
& = (x-1) + x(x-1) + x^2(x-1) + \ldots + x^n(x-1) \\
& = (\color{darkgreen}{x} - 1)  + (\color{maroon}{x^2}-\color{darkgreen}{x}) + (\color{darkblue}{x^3}-\color{maroon}{x^2}) + \ldots + (x^{n+1}-x^n)  \tag{$\star$}\\
& = x^{n+1} -1
\end{align}$$
Notice that in line $(\star)$ the two $\color{darkgreen}{x}$ terms cancel, the two $\color{maroon}{x^2}$ terms cancel, and so on, leaving only $-1$ and $x^{n+1}$.  Taking $n=7$ we get $$(1+x+x^2+\ldots+x^7)(x-1) = x^8-1.$$
Does this help?

A: Taking your question, "How did this go from $1-x^8$ to $(1-x^4)(1+x^4)$ and then to..." literally, it involves repeated applications of the identity $1-z^2=(1-z)(1+z)$: $$\begin{align} 1+x^8 &= (1-x^4)(1+x^4) \\ &= (1-x^2)(1+x^2)(1+x^4) \\ &= (1-x)(1+x)(1+x^2)(1+x^4) \\ &= (1-x)(1+x^2+x^3+x^4+x^5+x^6+x^7). \end{align}$$


text:
Q: mongodb cronjobs with node.js I want to build something like this :
every morning 9:00 there will be some trigger to my node app where it pull randomly any document from the db and pass it to the view. What should I look into? Cronjob in node?
Sorry I'm new to mongodb


text:
Q: Type of element variable I am currently reading a book called "The Web Game Developer's Cookbook". In this book, there are many references to creating a new variable and storing or making an element as its value.
For example-
var image = document.createElement('img');

It says that you can also change many values and attributes of the image like so-
image.src = 'image.jpg';

So I don't really know whether the variable type is an object, array, or just a reference. So I tried doing this on a jsfiddle.
var typeOfImage = typeof image;
typeOfImage = typeOfImage.toString();
console.log(typeOfImage);

For some reason, this code does not work. Can someone please help me understand what the data type of an element variable is?
Thanks!

A: It will be of type object and there will be no need to add toString because typeof returns a string
var image = document.createElement('img');
var type = typeof image; // "object"

createElement returns an DOM element object.


text:
Q: Put many function inside function in Javascript I'm newbie in Javascript and wanna learn function to make own plugin.
So first i'm learn about this:
(function() {
      // Define our constructor
      this.Cms = function(){
        this.Test = function()
        {
            return "Halo there";
        }
      };
    }());
var md = new Cms();

With that, I can access md variable and Test method successfully in browser console.
> md.Test()
< "Halo there"

I wanna make many function inside Cms, so I trying this:
(function() {
      // Define our constructor
      this.Cms = function(){
        this.Test = function()
        {
            return "Halo there";
        }

        this.TestAgain = function()
        {
            this.Helpme = function()
            {
                return "Heya";
            }
        }
      };
    }());

And execute var md = new Cms.TestAgain() in console, that returning error:
Uncaught TypeError: Cms.TestAgain is not a constructor at <anonymous>:1:10

My goal is make many function and each function can called in variable. For example I can declare var md = new Cms.TestAgain() and run function md.Helpme() that can return value Heya. Also I can declare var md = new Cms() and run function md.TestAgain.Helpme() with same return value Heya.
It's possible? Help me guys :)
Thanks.

A: First of all, the function is called Anonymous self executing function.
Secondly, it is better to define your function the following way as the very well known library jQuery does:
(function(window) {
    // Define your function here
    var Cms = function () {
         // Function body
    };

    // Add the function to the window scope so that it can be accessed anywhere
   window.Cms = Cms;
})(window);

When you define functions like this:
var Cms = function () {
    this.test = function () {
        console.log("Hello");
    };

    this.testAgain = function() {
        console.log("Hello again");
    };
};

You have to call it like this:
// First create an object of Cms
var md = new Cms();

// Then call the methods
md.test(); // Hello
md.testAgain(); // Hello again

If you want another function in testAgain, you can do this way:
var Cms = function () {
    ...
    this.testAgain = function() {
        this.help = function() {
            console.log("help");
        };
    };
};

// Create object of Cms
var md = new Cms();

// Create object of testAgain
var x = new md.testAgain();

// Now call the function
x.help();

Here is the entire code snippet:
(function(window) {
    var Cms = function () {
         this.test = function () {
             console.log("Hello");
         };
         this.testAgain = function () {
             this.help = function() {
                 console.log("Help");
             };
         };
    };
    window.Cms = Cms;
})(window);

// Create the object
var md = new Cms();
// Call the function test
md.test(); // Hello

// Create the object of testAgain using object of Cms
var x = new md.testAgain(); // Hello again

// Call the function help
x.help(); // Help

If you don't want to create objects and directly want to call Cms.test(), you can use JavaScript objects like this:
// Create a object
var Cms = {};
Cms.test = function() {
    console.log("Hello");
};

// Create a nested objects here
Cms.testAgain = {};

Cms.testAgain.help = () {
    console.log("Help");
};

And then call it directly as:
Cms.test(); // Hello
Cms.testAgain.help(); // Help

Notice that here you don't need the new operator.
Here is the entire code snippet:
(function(window) {
     var Cms = {};
     Cms.test = function () {
          console.log("Hello");
     };
     Cms.testAgain = {};
     Cms.testAgain.help = function () {
          console.log("Hello again");
     };

     window.Cms = Cms;
})(window);

// Directly call the functions
Cms.test(); // Hello
Cms.testAgain.help(); // Help

Above code is same as doing this:
(function(window) {
     var Cms = {
         test: function () {
             console.log("Hello");
         },
         testAgain: {
             help: function () {
                 console.log("Hello again");
             },
         },
     };

     window.Cms = Cms;
})(window);

// Directly call the functions
Cms.test(); // Hello
Cms.testAgain.help(); // Help

Hope this helps.

A: In your functional code
(function() {
  // Define our constructor
  this.Cms = function() {
    this.Test = function() {
      return "Halo there";
    }
    this.TestAgain = function() {
      this.Helpme = function() {
        return "Heya";
      }
    }
  };
}());

every time when you create instance or object using new keyword it give access within function limit
For example on instance of Cms give you access on Test and TestAgain
var md = new Cms()

But for access Helpme you need to object of TestAgain which depend on Cms
which is
const testAgain = new md.TestAgain()

Now you can freely call Helpme function on instance of testAgain
console.log(testAgain.Helpme())

A: The new keyword is intented to be used in conjunction with a class (a template for objects) like so:

function Person (firstname, lastname) {
  this.firstname = firstname;
  this.lastname = lastname;
}

donald = new Person("Donald", "Trump");
barack = new Person("Barack", "Obama");
console.dir(donald);
console.dir(barack);

You don't need it here. Instead you could just write:
var cms = {
  testAgain: {
    helpme: function () { return "Heya"; }
  }
};

And later write:
cms.testAgain.helpme();


text:
Q: Data from SQL view in entity collection are not sorted I have a simple SQL view with 2 columns. First is the primary key, which is an nvarchar, and the second is an int. View is ordered by the int column. When I load data using EF, data is not sorted how is specified in SQL. What do I need to do to receive correctly sorted data?

A: ORDER BY is effectively ignored in a view. You need to specify ORDER BY in the actual query you use against the view. See the following for an explanation.
https://dba.stackexchange.com/questions/66353/why-is-the-order-by-clause-in-a-view-ignored-as-soon-as-its-called-with-a-where


text:
Q: Table has no rows - Google Pie Chart using PHP and AJAX I am getting "Table has no columns" error. Please see the below link.
http://admin.millionkidstoschool.org/index.php/
What can be causing this problem?
On the provided link you can see the JSON Output under XHR.
Is it possible to draw multiple charts (pie, bar) using the same JSON output but a different set of data?
View:
 google.charts.load('current', {'packages':['corechart']});
        google.charts.setOnLoadCallback(filter_data);

       function filter_data(){
           $('#filter_data').html("

");
           var action = 'fetch_data';
           //var minimum_price = $('#hidden_minimum_price').val();
           //var maximum_price = $('#hidden_maximum_price').val();
           var reporting_period = get_filter('reporting_period');
           var category = get_filter('category');
           var region = get_filter('region');
           var partner = get_filter('partner');

           var mapData = $.ajax({
               url:"http://admin.millionkidstoschool.org/index.php/enrollments/fetch_data",
               type:"POST",
               dataType:"JSON",
               data:{action:action, reporting_period:reporting_period, category:category, region:region, partner:partner},

                /*success:function(data){
                   $('.filter_data').html(data.enrollments);
                   /*$('#pagination_link').html(data.pagination_link);
               }*/
           }).responseText;

           // Create our data table out of JSON data loaded from server.
            var data = new google.visualization.DataTable(mapData);

            // Instantiate and draw our chart, passing in some options.
            var chart = new google.visualization.PieChart(document.getElementById('filter_data'));
            chart.draw(data, {width: 900, height: 500});

       }

Controller:
        $data = $this->db->query($query);

        $result = '';
        $total_ex_nf = '0';
        $total_new_nf = '0';
        $total_formal='0';
        if($data->num_rows() > 0)
        {
            foreach($data->result_array() as $row)
            {
                if($row['category']=='Ex-Non-Formal'){
                    $total_ex_nf += $row['total_enrolled'];
                    //$result .= $total_ex_nf;
                }
                if($row['category']=='New-Non-Formal'){
                    $total_new_nf += $row['total_enrolled'];
                    //$result .= $total_new_nf;
                }
                if($row['category']=='Formal'){
                    $total_formal += $row['total_enrolled'];
                    //$result .= $total_formal;
                }

                $result .= '

Total Enrollments : '. $row['total_enrolled'].'

                  Partner : '. $row['partner'] .'

                  Reporting Period : '. $row['reporting_period'] .'

                  Category : '. $row['category'] .'

                  Region : '. $row['region'] .'

                ';
            }

            $result .= '

            Total Formal: '.$total_ex_nf.'

            Total Ex-Non-Formal: '.$total_new_nf.'

            Total New-Non-Formal: '.$total_formal.'

';

            $output = array('enrollments' => $result);
        }
        else
        {
            $result = '
No Data Found
';
        }

    $categoryType1 = "Fromal";
    $categoryType2 = "Ex-Non-Fromal";
    $categoryType3 = "New-Non-Fromal";

   $responce->cols[] = array(
        "id" => "",
        "label" => "Category",
        "pattern" => "",
        "type" => "string"
    );
    $responce->cols[] = array(
        "id" => "",
        "label" => "Total Enrolled",
        "pattern" => "",
        "type" => "number"
    );

        $responce->rows[0]["c"] = array(
            array(
                "v" => "$categoryType1",
                "f" => null
            ) ,
            array(
                "v" => (int)$total_formal,
                "f" => null
            )
        );

        $responce->rows[1]["c"] = array(
            array(
                "v" => "$categoryType2",
                "f" => null
            ) ,
            array(
                "v" => (int)$total_ex_nf,
                "f" => null
            )
        );

        $responce->rows[2]["c"] = array(
            array(
                "v" => "$categoryType3",
                "f" => null
            ) ,
            array(
                "v" => (int)$total_new_nf,
                "f" => null
            )
        );

    echo json_encode($responce);
 }

A: The jquery ajax function has a .done() function that gets triggered when the request is finished and get passed the data. Your way of accessing the data results in you passing the google charts a jqXHR object. For more information look here: http://api.jquery.com/jQuery.ajax/.
You can try something like this:
 google.charts.load('current', {'packages':['corechart']});
        google.charts.setOnLoadCallback(filter_data);

       function filter_data(){
           $('#filter_data').html("

");
           var action = 'fetch_data';
           //var minimum_price = $('#hidden_minimum_price').val();
           //var maximum_price = $('#hidden_maximum_price').val();
           var reporting_period = get_filter('reporting_period');
           var category = get_filter('category');
           var region = get_filter('region');
           var partner = get_filter('partner');

           var mapData = $.ajax({
               url:"http://admin.millionkidstoschool.org/index.php/enrollments/fetch_data",
               type:"POST",
               dataType:"JSON",
               data:{action:action, reporting_period:reporting_period, category:category, region:region, partner:partner},

                /*success:function(data){
                   $('.filter_data').html(data.enrollments);
                   /*$('#pagination_link').html(data.pagination_link);
               }*/
           }).done(function (mapData) {
               // Create our data table out of JSON data loaded from server.
               var data = new google.visualization.DataTable(mapData);

               // Instantiate and draw our chart, passing in some options.
              var chart = new google.visualization.PieChart(document.getElementById('filter_data'));
              chart.draw(data, {width: 900, height: 500});
           });

       }

(This code is not tested, it should you give a hint in the right direction)


text:
Q: Blazor Inheritance with ChildContent RenderFragments? Say we have a basic component ParentComponent.razor:

@ChildContent

@code {
    [Parameter] public RenderFragment ChildContent {get;set;}
}

This can be used like this:
<ParentComponent>

content

</ParentComponent>

Which would render:

content

But say we want a ChildComponent.razor to inherit from ParentComponent.razor:
@inherits ParentComponent

@ChildContent

@code {
    [Parameter] public RenderFragment ChildContent {get;set;}
}

Is there any way of populating ParentComponent's @ChildContent RenderFragment from the ChildComponent?
<ChildComponent>
    child content
</ChildComponent>

To produce this:

child content

Don't know if I'm missing something obvious but been messing around with it for a while and have not been able to find any answers on the internet.
Edit - Alternative Solution
I've found another way of doing this that doesn't rely on using overriding the BuildRenderTree methods directly and allows you to use html/razor markup, although it does mean going around the houses. Also unsure if this is safe or performant, but putting it here for completeness sake.
ParentElement.razor
@using Microsoft.AspNetCore.Components.Rendering;

@if (!HasRendered()) {
    SetRenderedStatus();

        RenderChild(__builder);

}

@code {
    protected bool _hasBaseRendered = false;

    protected bool HasRendered() {
        return _hasBaseRendered;
    }

    protected void SetRenderedStatus() {
         _hasBaseRendered = true;
    }

    protected virtual void RenderChild(RenderTreeBuilder __builder) { }
}

ChildElement.razor
@using Microsoft.AspNetCore.Components.Rendering
@inherits ParentElement

@if (HasRendered()) {

         @ChildContent

}
@{
    base.BuildRenderTree(__builder);
}

@code {
    [Parameter] public RenderFragment ChildContent { get; set; }

    protected override void RenderChild(RenderTreeBuilder __builder) {
        this.BuildRenderTree(__builder);
    }
}

So quick explanation, the features in the IDE/Compiler clearly compile the razor/html markup portion of the code down into BuildRenderTree methods behind the scenes, which is why you can't override those methods within a .razor component.
The above code compiles down to:
ChildElement.razor
protected override void BuildRenderTree(RenderTreeBuilder __builder)
{
    if (HasRendered())
    {
        __builder.AddContent(0, "    ");
        __builder.OpenElement(1, "div");
        __builder.AddAttribute(2, "id", "ChildComponent");
        __builder.AddMarkupContent(3, "\r\n        ");
        __builder.AddContent(4, ChildContent);
        __builder.AddMarkupContent(5, "\r\n    ");
        __builder.CloseElement();
        __builder.AddMarkupContent(6, "\r\n");
    }
    base.BuildRenderTree(__builder);
}

So the ChildContent is ignored while HasRendered is false and it is directed to call the base.BuildRenderTree on the parent class.
ParentElement.razor
protected override void BuildRenderTree(RenderTreeBuilder __builder)
{
    if (!HasRendered())
    {
        SetRenderedStatus();
        __builder.AddContent(0, "        ");
        __builder.OpenElement(1, "div");
        __builder.AddAttribute(2, "id", "ParentComponent");
        __builder.AddMarkupContent(3, "\r\n");
        RenderChild(__builder);
        __builder.AddContent(4, "        ");
        __builder.CloseElement();
        __builder.AddMarkupContent(5, "\r\n");
    }
}

It renders the parents markup and midway is directed to RenderChild which is overriden on the child, that takes the flow back up a level to the child, where its BuildRenderTree is then called, the HasRendered check will ensure an infinite loop is avoided and it then renders the childs portion of the markup before returning back down to the parent to complete.
This could probably be refactored, just my current working copy experiment.

A: Copy and test...
ParentComponent.cs
public partial class ParentComponent : ComponentBase
{
    [Parameter] public RenderFragment ChildContent { get; set; }

    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        builder.OpenElement(0, "div");
        builder.AddAttribute(1, "id", "ParentComponent");
        builder.AddContent(2, ChildContent);
        builder.CloseElement();

        base.BuildRenderTree(builder);
    }
}

ChildComponent.cs
public partial class ChildComponent : ParentComponent
{
    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        builder.OpenComponent<ParentComponent>(0);
        builder.AddAttribute(1, "ChildContent", (RenderFragment)((builder2) =>
       {
            builder2.OpenElement(1, "div");
            builder2.AddAttribute(2, "id", "ChildComponent");
            builder2.AddContent(3, ChildContent);
            builder2.CloseElement();
        } ));

        builder.CloseComponent();

    }
}

Index.razor
@page "/"

<ChildComponent>child content</ChildComponent>

A: I just tested this on 5.0 rc2.
@inherits ParentComponent

@ParentRenderFragment

@code {

    RenderFragment ParentRenderFragment => builder =>
    {
        builder.OpenComponent<ParentComponent>(1);
        builder.AddAttribute(2, "ChildContent", this.ChildContent);
        // Additional inherited parameter's here
        builder.CloseComponent();
    };

}

Produced this:

Note:
The id's are incorrect as they are passed as part of the renderfragment. If you do not have access to edit the child component this may require dom manipulation to fix as you need to capture the attributes or pass the id as a parameter.
However this is showing how the get the parents original render into the child.


text:
Q: What is required for publishers to write code that hooks into events in amp-story? For example, HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document.
Events are normally used in combination with functions, and the function will not be executed before the event occurs (such as when a user clicks a button).
benefits

Although there's a lack of good documentation, adding a function that takes parameters (i.e. Function_Name(Parameter)) to one of JavaScript's standard 'On' events (i.e. 'OnClick' or 'onKeyDown') is relatively simple for JavaScript coders. Advanced programmers might refer to this as dynamic runtime event assignment with functions using parameters passed.
Let's say we have a text area field on a web page, and we want to execute some function every time they make a keystroke inside that field. In our real world example, we wanted to count the number of characters, so we could let the user know how close they were to the limit, and warn them when they exceed the limit. To capture keystrokes, we need to hook into JavaScript's 'onKeyUp' and 'onKeyDown' events.
Experienced JavaScript developers know that the easiest way to add these hooks is to include them in the HTML for the textarea, like so:

A: It is not currently valid AMP to author pages with JavaScript.  See How AMP works, specifically:

AMP pages can't include any author-written JavaScript. Instead of using JavaScript, interactive page features are handled in custom AMP elements. The custom AMP elements may have JavaScript under the hood, but they're carefully designed to make sure they don't cause performance degradation.

The next paragraph goes on to say:

While third-party JS is allowed in iframes, it cannot block rendering. For example, if third-party JS uses the super-bad-for-performance document.write API, it does not block rendering the main page.

However, amp-story specifically does not allow author-specified iframes.
As such, I do not believe that what you are requesting here is possible in amp-story's current state.


text:
Q: How to determine authorization rights after a login via SAML SSO First of all I do not have any experience with SAML (version 2).
I was asked to investigate how we can make an existing site, which has a normal login page with a username and password page, ready for SSO with SAML.
There are some tools around which we can use in order to do this.
So I think it is not so difficult to implement the SSO part.
But however it is not clear to me how the authorization is managed.
The system (web site) is using authorization rights in order to determine if the user is able do access certain parts and if he does, the right type he has (view, create or edit).
These rights are assigned to each user by an administrator in the system itself.
When a user logs in the system by specifying his credentials (without SAML/SSO) his rights are also retrieved.
How is this done when a person logs into the site by using SSO?
Is there a mapping of the userId which is know by the IdP (Identity Provider) to the userId which is know by our system?
And is this send in the SAML response from the IdP?
Or is this done in another way?
Thanks in advance

A: SAML is mainly a authentication protocol but there are still many ways to solve this. SAML supports sending authorization infromation in AuthzDecisionStatement in the assertion.
Another alternative is to extend SAML using XACML which is a big framework for transferring Authz information.
However the support for these are limited in many SAML providers.
The simpler solution and probably the best in your case, if it is just one access right per user, is to send it as an attribute in the SAML assertion. This can usualy be mapped against for user properties.


text:
Q: Unable to fetch inapp products for Xamarin Android using Plugin.InAppBilling package I'm having trouble retrieving my in-app products for my Android Xamarin app. I'm using the Plugin.InAppBilling nuget package (version 4.0.1-beta) to implement the billing functionality. To begin, I following the documentation which states the following:
Android Testing:
- You MUST use a physical device. Emulators do not work.
- Ensure you have app in Alpha/Beta with the NuGet installed. This will add "com.android.vending.BILLING" permission for you
- Create an IAB product, make sure it is published and active
- Add a test account to the app, ensure it is the main account on device, and that account is opted-in as tester
- Validated your version code and number in your development environment match what is in the Play store.
- You MUST sign the APK even in debug mode.

Therefore I have the following specified in my Android csproj:

This is my aab package in the Play Console in Internal Testing with 2 testers:

Here are the testers also added as Licensed Testers:

However, using the following code doesn't return any products from the call to GetProductInfoAsync:
private partial async Task FetchProductDetails(bool isAdsDisabled)
{
    var billing = CrossInAppBilling.Current;

    try
    {
        //You must connect
        var connected = await billing.ConnectAsync();

        if (!connected)
        {
            //Couldn't connect
            return;
        }

        var products = await billing.GetProductInfoAsync(ItemType.InAppPurchase, productIds);

        .
        .
        .
    }
    catch (Exception ex)
    {
        ...
    }
    finally
    {
        await billing.DisconnectAsync();
    }
}

Anyone know if I missed a step? Something missing?

A: License Response. You have Licensed. I've always used RESPOND_NORMALLY.
I'm not using the plug in as I wrote my own using xamarin.android.google.billingclient\3.0.0. All working here.
Well, what happens when you debug GetProductInfoAsync?

A: As mentioned in the documentation, you need an app in Alpha/Beta. Internal testing will not work.


text:
Q: Using preprocessor definitions in iOS App info.plist I have an iOS app that uses SSO with Facebook as part of getting your app to work with Facebook's SSO you have to specify the FacebookAppId and callback url in the info.plist. I have 2 different Facebook groups one for testing and one for production. I want to be able to have the values of the two keys specified above set based on preprocessor directives.
In my MessageBomb-Prefix.pch i have the following, which works fine:
#ifdef TEST
    //Development environments
    #define PARSE_APP_ID "dev parse app id"
    #define PARSE_CLIENT_ID "dev parse client id"
    #define FB_APP_ID "dev facebook id"
#else
    //Production environments
    #define PARSE_APP_ID "prod parse app id"
    #define PARSE_CLIENT_ID "prod parse client id"
    #define FB_APP_ID "prod facebook id"
#endif

However in my info.plist i have done the below, but it doesn't seem to work:
<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb${FB_APP_ID}</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>${FB_APP_ID}</string>

Is it even possible to do what i'm trying to do. I've set the project to preprocess the info.plist.
Thanks
Peter

A: To access in plist:
Create a new variable

Define it

Use it in your info plist

A: The Info.plist preprocessor will let you use build settings in your Info.plist, not #defines. So you can define FB_APP_ID as a custom user build setting in your target (and give it overrides for different schemes), and this value will then be available to Info.plist. However, user build settings don't get exposed to your code. That is, unless you muck with your Preprocessor Definitions build setting and add an entry that looks like
FB_APP_ID=@\"$(FB_APP_ID)\"

(the backslashes are required to get the double-quotes past the shell invocation)
If your app ID may contain spaces, then you'll need to add quotes to get past the shell invocation:
FB_APP_ID="@\"$(FB_APP_ID)\""

In the end, you'll have build settings that looks something like this:

A: If you go into Build Settings you can set Preprocess Info.plist File to YES and then set Info.plist Preprocessor Prefix File to a .h file you've placed in your project with #define directives.
So for example if I add a key to my Info.plist file: testKey with the value TEST_VALUE. Then I place test.h in my project with:
#define TEST_VALUE hello_world

And then I set Preprocess Info.plist File to YES and Info.plist Preprocessor Prefix File to test.h
The value of that key, when retrieved is now "hello_world". If you change the value of the macro a lot you may find you need to do Product/Clean to see changes because XCode seems to cache the compiled value.


text:
Q: How to convert SVG path into .svg file and link dynamic images with coordinates I'm designing a web page with a really big SVG of a world map, really huge. My issue is that I can import it into the HTML directly using <path> but this causes page loading errors on some devices due to it being so huge. I then decided to try and find a way to compress this into some smaller code.
I tried saving the whole  as a file file.svg and load it directly into my html using <img src="{% static 'PNG/file.svg' %}" /> , but it doesn't load the dynamic images i've added to specific coordinates.
So how can I convert my SVG path to a .svg file and keep the dynamic images with their respective coordinates?
My current code that works but is way to large:
<svg style="fill: #142236; overflow-x: hidden;" class="Map" viewBox="0 -213 1766.961 874.341">
                    <path>Longdata......</path>
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="100" x="300" y="10" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="600" x="230" y="-70" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="300" x="900" y="-60" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="400" x="1050" y="-120" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="500"  x="1150" y="20" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="1200"  x="1250" y="-140" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="200" x="580" y="-280" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="700" x="900" y="300" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="800" x="820" y="100" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="900" x="490" y="280" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="1000" x="1420" y="330" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                    <image data-aos="fade-down" data-aos-duration="203" data-aos-delay="1100"  x="1300" y="0" width="80" height="290" xlink:href="{% static 'PNG/golem.png' %}" />
                  </svg>

Whole SVG code:
https://pastebin.com/rU3GeTvU

A: If it is the length of path that is the problem, then you can just split the path wherever there is an "M" command.
ie. change:
<path id="Map" d="M 895.4368896484375 152.4791412353516 C 893.6979370117188 151.6047668457031 890.8810424804688 153.2721557617188 891.3057250976563 154.4424896240234 C 891.5921020507813 155.2454223632813 892.7576293945313 156.2630462646484 896.3822021484375 157.2088317871094 C 900.0067138671875 158.1550140380859 900.4414672851563 160.6248321533203 901.9644775390625 160.7012634277344 C 903.4885864257813 160.7730712890625 903.6312866210938 159.3158416748047 903.2685546875 157.3520812988281 C 902.90576171875 155.388671875 905.0786743164063 153.1334381103516 905.2980346679688 152.7705841064453 C 905.5126953125 152.4073181152344 904.357421875 151.8244171142578 901.3822631835938 152.4791412353516 C 898.4069213867188 153.1334381103516 897.179931640625 153.35302734375 895.4368896484375 152.4791412353516 Z M 871.577880859375 143.1622314453125 C 870.9236450195313 146.0003814697266 871.9405517578125 149.5692443847656 873.6073608398438 147.892333984375 C 875.2791137695313 146.2249298095703 876.0765991210938 147.0228576660156 877.0173950195313 145.7853088378906 C 877.9577026367188 144.5480499267578 877.1605834960938 139.9660949707031 877.81494140625 137.7823944091797 C 878.4688720703125 135.5990142822266 874.9110107421875 134.576904296875 873.3161010742188 135.9573516845703 C 871.7259521484375 137.3431549072266 870.40771484375 135.7184753417969 869.7676391601563 136.8317565917969 C 868.9657592773438 138.2175750732422 872.2321166992188 140.3245391845703 871.577880859375 143.1622314453125 Z M 1351.581298828125 368.0840759277344 C...

to
<g id="Map">
  <path d="M 895.4368896484375 152.4791412353516 C 893.6979370117188 151.6047668457031 890.8810424804688 153.2721557617188 891.3057250976563 154.4424896240234 C 891.5921020507813 155.2454223632813 892.7576293945313 156.2630462646484 896.3822021484375 157.2088317871094 C 900.0067138671875 158.1550140380859 900.4414672851563 160.6248321533203 901.9644775390625 160.7012634277344 C 903.4885864257813 160.7730712890625 903.6312866210938 159.3158416748047 903.2685546875 157.3520812988281 C 902.90576171875 155.388671875 905.0786743164063 153.1334381103516 905.2980346679688 152.7705841064453 C 905.5126953125 152.4073181152344 904.357421875 151.8244171142578 901.3822631835938 152.4791412353516 C 898.4069213867188 153.1334381103516 897.179931640625 153.35302734375 895.4368896484375 152.4791412353516 Z"/>
  <path d="M 871.577880859375 143.1622314453125 C 870.9236450195313 146.0003814697266 871.9405517578125 149.5692443847656 873.6073608398438 147.892333984375 C 875.2791137695313 146.2249298095703 876.0765991210938 147.0228576660156 877.0173950195313 145.7853088378906 C 877.9577026367188 144.5480499267578 877.1605834960938 139.9660949707031 877.81494140625 137.7823944091797 C 878.4688720703125 135.5990142822266 874.9110107421875 134.576904296875 873.3161010742188 135.9573516845703 C 871.7259521484375 137.3431549072266 870.40771484375 135.7184753417969 869.7676391601563 136.8317565917969 C 868.9657592773438 138.2175750732422 872.2321166992188 140.3245391845703 871.577880859375 143.1622314453125 Z"/>
  <path d="M 1351.581298828125 368.0840759277344 C...
  ...etc...
</g>

You don't have to split at every M.  Just make each path small enough to not be too long.
Note also be careful to keep lakes and inland seas in the same path as the country they belong with.
But ultimately, it might be easier for you to just find a version of the world map that doesn't have everything in one path.  There are many free SVG world maps available on the web.


text:
Q: Adding code comments to a module What is the best way to comment a long Module?
For linear flowing calculations that need not be organised in modules, I usually mix text and math. But how can I do that inside a module, or block, or any other scoping construct?

A: Not sure it's good practice, but in a notebook you can format the text inside the (* *) comment designators to your liking. Here's an example module with "Text" style used with inline comments:

Additionally, it's possible to disable evaluation for individual cells (from the menu: "Cell"-->"Cell Properties"-->"Evaluatable"), and one can use Inactive to prevent evaluation of whole blocks or modules.
Also, as @Mr.Wizard mentioned in his comment, it is often better practice to refactor your modules into more manageable pieces--subfunctions that work together. These smaller pieces are easier to document with explanatory text and divisions in the notebook interface, and short inline comments.


text:
Q: symfony2 class and repos architetture I'm building an application in symfony2 just to better understand how it works. My problem is I'm undecided on where to put some classes, for example:
I have a category entity and a category repository, and a controller to manage categories where I query the repos (how explained in the cookbook) using
$category = $this->getDoctrine()->getRepository()

now I'm working on a blog controller, I want to display a form (for example in edit mode), so I have to query the blog repos, but I also need to query again the category repos to permit to choose a category.
I don't think it could be a good idea to query 2 different repos in the controller, can anyone suggest me how to organize this classes just to avoid to instantiate all the repository in all the actions I need them?
any other useful suggestion on how to organize the code?
thanks

A: There is nothing wrong with calling methods of 2 (or more) repositories in a single controller.
But in the scenario you describe the Form Component will take case of querying for categories to choose from. I suggest you dive a litter deeper in that documentation. Hint: the Entity Field Type .
Some advice
You probably know what "spaghetti code" is, but there's also something called "lasagna code" which is the opposite: you get pillars of classes that don't really work together.
You could have a pillar for users (UserEntity, UserRepository, UserService and UserController) and another for blog-posts (BlogPostEntity, BlogPostRepository, BlogPostService and BlogPostController), etc...
This is also something you rather not create, so a good mix between spaghetti and lasagna would be advisable ;)
Try to have services represent your business needs / the business world (or Domain). Controllers are nothing more than connectors between clients (browsers, etc) and your services. And repositories are just technical details (not your points of focus).
PS: Little correction
You should change this:
$category = $this->getDoctrine()->getRepository();

to this:
$categoryRepository = $this->getDoctrine()->getRepository('Category');

It will be less confusing for you in the long run. Example:
$categoryRepository = $this->getDoctrine()->getRepository('Category');
$category = $categoryRepository->find(123);