text:
Q: Center Aligning the Google charts I am trying to center align my google chart but have been unsuccessful in doing so. I have played with padding to move it to the center but I don't want to sit there and play with firebug for long time and figure out the correct position. Is there any simpler such as aligning text text-align: center. Obviously it doesn't work with google charts. (I am new to all of this)
var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));

...some code ...

although I did this padding-left: 140px but is there any better way like align: center

A: I have been facing the same issue with a google gauge. Checking the code generated I realized that the next thing inside the
 is a table with margin 0 set as inline style.
So in order to override it I used the following css:
div.chart_div table {
    width: auto;
    margin: 0 auto !important;
}

And this worked.

A: The accepted answer is broken; you have to use display: inline-block to center align your chart.

A: Give the chart_div:  display: block and margin: 0 auto;

A: Since width is fixed, try setting margin-left and margin-right to auto. It should work assuming that the position is relative.

A: Any of these answers doesn't work for me so i did that:

.chart_box {
  width: 900px;
  margin: 0 auto;
}

You need to use same width for chart_div and chart_box.

A: You could also do
 This worked for me, although now my chart hovering function isn't working. Anyone else get this problem? I'm talking about when you hover the mouse over a point on the graph. It usually shows the point such as Jan Sales 440. Anyone know of a fix?

A: Set chart_div to following properties:

#chart_div{
  display: inline-block;
  margin: 0 auto;
}

A: Notice: when you remove the side menu ("legend: 'none'") the width should be altered.
This happens mostly when you go "legend: 'none'" because it leaves the side space that was there to hold that menu, not adjusting the width automatically. You need to re set the width and NARROW it, to manipulate its alignment:
var options = {
          title: 'center alignment',
          width:  350,
          height: 350,
          legend: 'none'
        };

A: I combined a few of the answers here, as follows:
Create a css class:
.customChartStyle{
    border:1px solid #eee;
    text-align:center !important;
}

and add it to the table's cells by adding the following to my table.draw() call:
'allowHtml': true, 'cssClassNames': {'tableCell': 'customChartStyle'}}

I'm new to google charts but the key for me was adding !important to the text-align style (thanks thanassis). For my case I needed the border style because overriding the tableCell style removed that otherwise. Also I prefer defining the class and letting the charts api apply it instead of overriding the styles generated by the api.

A: Subscribe to the ready event to modify the CSS with JavaScript.  Something like below will do the trick.
google.charts.load('current', {
  'packages': ['gauge']
});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {

  var data = google.visualization.arrayToDataTable([
    ['Label', 'Value'],
    ['Memory', 80],
    ['CPU', 55],
    ['Network', 68]
  ]);

  var guageOptions = {
    width: 400,
    height: 120,
    redFrom: 90,
    redTo: 100,
    yellowFrom: 75,
    yellowTo: 90,
    minorTicks: 5
  };

  var guage = new google.visualization.Gauge(document.getElementById('my-div'));

  // HERE'S HOW TO SUBSCRIBE TO THE EVENT
  google.visualization.events.addListener(guage, 'ready', resetTableStyle);

  guage.draw(data, guageOptions);

  // HERE'S THE JAVASCRIPT TO SET YOUR CSS
  // NOTE TOGGLING A CSS CLASS HERE IS PROBABLY CLEANEST
  function resetTableStyle(){
    var myDiv = document.getElementById('my-div');
    var myTable = myDiv.getElementsByTagName('table')[0];
    myTable.style.margin = 'auto';
  }

A: Below code works for me:
width:fit-content;
margin:0 auto;

A: By implementing a class to my div, it can now be centered.
HTML

CSS
.chart_hum {
    margin: 0 auto;
    display: inline-block;
}


text:
Q: Getting unable to upload iApp Hosted Content "
I am trying to upload iApp Hosted content via Application Loader.The current version of my live app is 3.0.The version of Hosting Content  is 1.0 ,which i want to deliver with a new INApp Purchase for my application's new version which will(4.0).
After export content from Xcode ,when i tried to deliver content from Application Loader ,validation got successful,but after validation i am getting following error.
ERROR ITMS-2000: "Version '3.0', Locale 'pt-BR': keywords cannot be edited in the current state" at Software/SoftwareMetadata/SoftwareVersion
        ERROR ITMS-2000: "Version '3.0', Locale 'zh-Hans': keywords cannot be edited in the current state" at Software/SoftwareMetadata/SoftwareVersion
Please help me to solve the problem
"

A: Check if the keywords of your app in iTunes Connect has comma(,) at the end of keyword string.
For Instance:
"key1,key2,key3,key4,key5,"
Image: keyword in iTC
That comma next to "key5" cause the error.
We denote the iTunes Connect as iTC below.
To avoid this error, please try as follows:
1) Create newer bundle version in iTC
(we assume it to be 3.1 here).
2) Edit key word to "key1,key2,key3,key4,key5" then save. (We removed comma next to key5)
3) Start the Application Loader, and select IAP-box.
4) Select your App.
5) In the management screen, select the new IAP item,
   and set the content package (.pkg file)
6) Application Loader's File menu -> Save (Command+S) this project to some .itmsp file, and quit Application Loader.
7) In the finder, right crick on that .itmsp file or control+crick on it.
8) Select "show package content" in the displayed menu.
9) You can see "metadata.xml" in the Finder.
   Open it with text editor you like.
10) You can find that there is the structure as below:
Image: version elements in xml
11) Remove the area marked with red box.
12) Save the file and quit text editor.
13) Open the .itmsp file with Application Loader.
14) Try delivery.
This metadata.xml includes the information about not only IAP meta data but also your app's meta data. And the problem comes from mismatch between the metadata in xml and that in iTC. That is the keywords in the xml has only 5 in "key1,...,key5,", but iTC recognize there are 6 keywords.
Keywords are written inside the keywords-tag in the xml.
I was sorry about the language in screen shots are Japanese language.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can you 'join an ideology'? Obviously the verb join refers conventionally to a group of people, but what about ideologies? Can you 'join veganism'? Or 'join communism?'
A quick search showed me that this collocation is far from common, but is it outright wrong? The justification I can think of is that an ideology metonymically refers to the people who believe in it. Dictionaries don't seem to answer the question.

A: The word ideology is defined by Merrriam Webster as:

1
a : a manner or the content of thinking characteristic of an individual, group, or culture

b : the integrated assertions, theories and aims that constitute a sociopolitical program

c : a systematic body of concepts especially about human life or culture

2 : visionary theorizing

None of these definitions describes a group of people or a movement which makes the idea of 'joining and ideology' not 'wrong' but meaningless.
One can subscibe to or adopt an ideology or join an ideological group or a movement which promotes a given ideology but there is no sense in which one can join an ideology any more than one can join a set of religious beliefs or political theories. One can join a religion or a political party but not its defining concepts. The same thing applies to ideologies, they are abstract conceopts not groups of people.

A: "Join communism" is found, but it is clear that people had rather use this verb according to its usual meaning ; this is shown in the ngram.

(SOED) join III Come into contact, contiguity, company or union. 14 v.tr. & i. Become a member of (a society, an organization, etc.).

This pattern repeats itself for « fascism/the fascists », except that the new usage is comparatively stronger.

There seems to exist no definition of « join » that is compatible with the concept of ideology, doctrine, idea, etc.
The expression « join a religion » is used, as religion has the meaning "religious order" which connotes that of "organization". However the following are not found.

*

*join a doctrine, join an ideology, join christianism,join veganism,join naturism,join nudism,join militarism, masonism, isolationism, Maoism, Trotskyism, Leninism,

It appears that there has been in the last century  the coming into being of a new meaning for "join" which has not yet been acknowledged by lexicographers, and perhaps will never be.
The idea of more or less gradually becoming a supporter of an idea, doctrine, ideology, political line of thinking, or religion is rendered faithfully and generally enough by the following  verbal expression.

*

*become a convert to (became a convert to, examples)

became a convert to communism (examples)


text:
Q: how to recreate CURL command in Powershell or HttpWebRequest I have curl command, how execute it on PowerShell?
curl -v -H "Content-Type: application/pkcs7-mime" -k --cert C:\certnew.cer --key C:\private.key --pass 123123 --request POST "mysite.com" --data "RequestBodyTemplate"

I could not find in PowerShell how to sign a request with two certificates
--cert C:\certnew.cer --key C:\private.key --pass 123123

It's my powershell script, and it's not works!
$certPath = "C:\certnew.cer"
$keyPath = "C:\private.key"
$keyPass = "123123"
$url = "https://localhost.com:80/webservice"
$data = "-----BEGIN PKCS7-----
         MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAaCA
         JIAEgYY8P3htbCB2ZXJzaW9uPSIxLjAiIGVuY29kaW5nPSJVVEYtOCI/Pg0KPHRl
         -----END PKCS7-----"

$CURLEXE = 'C:\curl\bin\curl.exe'
$CurlArgument = '-v', '-H', 'Content-Type: application/pkcs7-mime',
                '-k', '--cert', $certPath,
                '--key', $keyPath, '--pass', $keyPass
                '--request', 'POST', "$url",
                '--data', $data
& $CURLEXE @CurlArgument

I get an error:
curl.exe : curl: no URL specified!


text:
Q: Best way to regulate 9/12v down to 5v and 3.3v If my source is 9 or 12v should I first us a linear regulator to step it down to 5v and from the 5v use another linear regulator to step it down to 3.3v? The 3.3v will be going to a micro-controller while the 5v will drive some 5v sensors/relays.
Current is under 500mA total, probably closer to 300. The power source for the loads (relay etc) are coming from a separate power source.

A: If those sensors/relays are external to your device, there's a fair chance that the 5V supply can get shorted and shut down. If you wish your microcontroller to work through such an event, it'd be necessary to have a separate buck converter for both 5V and 3.3V - if you care about power efficiency. If you don't mind some heat, it'd be OK to use a separate linear regulator for 5V and 3.3V, fed straight from the input source. That way it'd be easier to prevent relay transients from upsetting the microcontroller, too.
Efficiency-wise, when you use linear regulators it doesn't matter how you stack things up: cascaded or independent, all of the current consumed at any regulated voltage has to flow from the input supply. So if you consume 200mA @ 5V and 50mA @ 3.3V, it's still 250mA from the 9-12V supply.
With switching regulators, you have to take each regulator's efficiency at its actual load current and compare the independent-vs-cascaded variants. Of course for the microcontroller to stay ON in spite of control (5V) shorts, you need the regulators to be independent.
I have plenty of 3.3V microcontrollers running from linear regulators fed from 12V - sometimes it's the cheapest option when you have a powerful supply available.

A: A linear regulator will dissipate power but if the current in the load is small this power loss may be acceptable. If this power loss is not acceptable then use two switching regulators.
Generally having a linear regulator fed from a higher voltage linear regulator is OK but the higher voltage regulator may overheat if too much current is taken by the lower voltage regulator.


text:
Q: ReactJS: How to pass variable through nested 'anything()(Component)'? First of all: I don't know how const result = anything()(Component) is called, so I didn't find usable info in my search. The title of this post has to get edited...
But this is my problem:
This is how I add data via react-apollo to my Component:
const result = withData(
  graphql(
    gql`
      query Content($id: ID!, $language: String!) {
        article(id: $id) {
          title,
          intro(language: $language)
          }
        }
      }
    `, {
      options: (props) => ({
        variables: {
          id: props.id,
          language: language
        }
      })
    }
  )(Component)
)

As you can see, I have to use the variables $id and $language. Now I need to add i18n support to my component, which I have to do with translate()(Component):
const result = translate(['common'], { i18n, wait: process.browser })(
  withData(
  graphql(
    gql`
      query Content($id: ID!, $language: String!) {
        article(id: $id) {
          title,
          intro(language: $language)
          }
        }
      }
    `, {
      options: (props) => ({
        variables: {
          id: props.id,
          language: language
        }
      })
    }
  )(Component)
  )
)

The translation is working, but I do get the error Unhandled (in react-apollo) Error: GraphQL error: Variable "$id" of required type "ID!" was not provided.
What am I doing wrong as it seems the id value doesn't get to the query...

A: Try the following:
import { compose } from 'react-apollo';

...

export default compose(
  graphql(`query { ... }`),
  translate(['common'], { i18n, wait: process.browser })
)(Component);


text:
Q: Unexpected DNS queries I see lots of DNS queries in my dnsserver (dnsmasq)
 query[A] cdn.switchadhub.com from xxx
 query[A] delivery.g.switchadhub.com from xxx
 query[A] delivery.swid.switchadhub.com from xxx

What are those sites?
When I recorded those queries, no browser was running on the system. The DNS server is listening in a localhost interface. That makes me think that there is a process running in the system doing those queries.
How can I find out which process is sending those requests?
I am on Ubuntu 18.04.01.
UPDATE
Stopping and restarting the dns server got rid of the strange queries. It seems there was some kind of recursion at play?


text:
Q: Calculate $\lim _{x\to 0^+}\frac{\left(e^x-e^{-x}\right)}{\sin x}$ ***How to find the this limit without using L'Hopital's Rule.
$\lim _{x\to 0^+}\frac{\left(e^x-e^{-x}\right)}{\sin x}$

A: Hint:

*

*Use maclaurin series for $e^x$ and $e^{-x}$

*then apply $$\lim_{x\to 0} \dfrac{\sin x}{x}=1$$

A: Two famous limits give it as$$\lim_{x\to0^+}\frac{x}{\sin x}\left(\frac{e^x-1}{x}+\frac{e^{-x}-1}{-x}\right)=1(1+1)=2.$$


text:
Q: Create a second css transition before next page loads Im using css transitions to show animated lines on pageload. To initiate the lines Im using a jquery script to change class on the line elements.
I would like to reverse the CSS transitions when I load the next page. On pageload the lines draw up - for next page I want them to draw out before the next page draw them in again. I guess  I would need to Load the pages with something like ajax to get a seamless transition between pages to start with?
Demo: https://d157rqmxrxj6ey.cloudfront.net/jerryskate/8667/
HTML:

 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">

 <link rel="stylesheet" href="style.css">

page1

page2

page3

page4

page5

page6

CSS:
.h-line {
 position: absolute;
 z-index: -1;
 width: 0%;
 height: 5px;
 right: 0;
 background-color: #EDEDED;
 transition: right 1.5s linear;
 }
.h-line--1 {
 top: 400px;
 transition-delay: 2s;
 }
 .h-line--2 {
 top: 800px;
 transition-delay: 3s;
 }
 .h-line--3 {
 top: 600px;
 transition-delay: 4s;
 }
.h-line--4 {
 top: 1600px;
 transition-delay: 4s;
 }
 .h-line--5 {
  top: 1800px;
  transition-delay: 4s;
 }
 .h-line--6 {
 top: 2200px;
 transition-delay: 4s;
 }
 .v-line {
 position: fixed;
 z-index: -1;
 width: 5px;
 height: 0%;
 background-color: #EDEDED;
 bottom: 100%;
 transition: bottom 1.5s linear;
 }
.page-ready .v-line { bottom: 0 }
.v-line--left {
 left: 58%;
 transition-delay: 1s;
 }
.v-line--middle {
 left: 84%;
 transition-delay: 2s;
 }
.v-line--right {
 left: 95%;
 transition-delay: 2.4s;
 }
.h-line {
 width: 0!important;
 transition: width 1.5s linear!important;
 }
.h-line.h-line--2.ready { transition: width 3s linear!important }
 span.h-line.h-line--2.ready{
 width: 100%!important;
 transition: width 1.5s linear!important;
 left: 0!important;
 right: initial!important;
 }
.h-line.ready { width: 100%!important }
span.v-line.v-line--left.ready {
height: 100%!important;
transition: height 1.5s linear!important;
bottom: 0!important;
top: initial!important;
}

span.h-line.h-line--1.ready {
width: 100%!important;
transition: width 1.5s linear!important;
}
span.v-line.v-line--middle.ready {
  height: 100%!important;
  transition: height 1.5s linear!important;
  bottom: 0!important;
  top: initial!important;
 }
span.v-line.v-line--right.ready {
  height: 100%!important;
  transition: height 1.5s linear!important;
  bottom: 0!important;
  top: initial!important;
  }

 span.v-line.v-line--left.ready {
 height: 100%!important;
 transition: height 1.5s linear!important;
  bottom: 0!important;
  top: initial!important;
  }
  span.h-line.h-line--3.ready {
  width: 100%!important;
  transition: width 1.5s linear!important;
   left: 0!important;
   right: initial!important;
   }
  .h-line.h-line--3.ready {
  transition: width 3s linear!important;
  }

Script:
$(function () {
$('.v-line, .h-line').addClass('ready');
});

A: You can use the transitionend event, there is fired when a CSS transition has completed.
You have also to prevent the navigation when clicking on the link.
//Add listener on  nodes
$('a').click(function(e){
    //cancel the navigation.
    e.preventDefault();

    //take a reference of the clicked link
    var linkNode = this;

    $('.v-line, .h-line')
        //remove the classe (you have also to add reverse transition)
        .removeClass('ready')

        //add the "transitionend" event.
        .one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend',
            function(e) {
                //navigate to the href on clicked link.
                document.location.replace( linkNode.href );
            }
        );
);

About a seamless transition, yes you couldn't avoid it if you load a new page,
ajax is a good way to update the needed content of your page without a complete reload.

A: This solution uses Event Delegation. In this case Jquery captures the click on the element then removes the CSS class.
If you use the code below when the user clicks, the animation will play in reverse and the page will change. Although the page change interrupts the animation.
Goto your page, paste the code below into the browser console and then click a link to see it work.
$("body").on("click","a",function( event ){
$('.v-line, .h-line').removeClass('ready');});

In order for you to allow the whole CSS animation to complete before changing pages you may need to use Event Prevent Default. This function stops the original click from occurring. This means you'll need to fire the event manually after the animation is complete.
Goto your page, paste the code below into the browser console and then click a link to see it work.
Please note since the default behaviour is prevented the page does not change, but the animation now has enough time to complete.
$( "body" ).on( "click", "a", function( event ) {
event.preventDefault();
$('.v-line, .h-line').removeClass('ready');});


text:
Q: how to change apache superset's chart's background color? Per How to Change Apache Superset Template from the Superset User Interface? , I was able to change the CSS template for Superset dashboard. But the charts inside the dashboard are not affected. e.g. most of the charts have white colored background(e.g. Piechart) and some people dislike it. How to change the chart background color? I mean change it for all charts or for one chart.

A: Disclaimer: This should work, but is a bit hacky and could have long-term support implications:
I've been fiddling with a "dark mode" dashboard just to kick the tires on this. Here's a screenshot just for fun:

So... what did I do?

*

*Click "Edit Dashboard" in the top right of your screenshot

*When in edit mode, the top right menu has an option to "Edit CSS"

*Use your browser's inspector to hack away! That said, here are a couple of key ingredients:

*

*.dashboard-component{ background: whatever} - sets the main background of each viz card, but you'll still see many components still have white backgrounds within these wrappers.

*.slice_container  svg{
background-color: transparent !important;
} - this overrides the white background of the components I ran into (including Pie charts!).

If viz components use SVG you can get pretty clever with inspecting/overriding various bits. A couple of gotchas with the above:

*

*If a viz component contains multiple SVG elements, this may have side effects.

*If a viz uses canvas instead of svg you will run into more trouble

In the worst case scenario, you may need to check out the superset-ui-plugins repo and make tweaks. This dev process isn't super straightforward, but some of us are working to improve that.

A: Easiest solution for me is using dark reader extension.


text:
Q: Conjugacy Classes of $D_{12}$ I am trying to find the conjugacy classes of the Dihedral group $D_{12}=\{e,a,a^2,a^3,a^4,a^5,b,ba,ba^2,ba^3,ba^4,ba^5\}$
where $a^6=b^2=e$ and $ab=ba^5$.
I know that one of the conjugacy classes will be $C_e=\{e\}$ but I don't understand how you find the others. All help appreciated.

A: What is the Dihedral group?
The dihedral group $D_{2n}$ consists of symmetries of some $n$-gon. The elements are thus some combination of rotations and reflections. In particular, the group $D_{12}$ is the group of symmetries for a hexagon. The group operation is the composition of two transformations that leave the hexagon fixed. For example, $a$ is a rotation by $\frac{2\pi}{6}$, or a one sixth turn. Thus, $a^{k}$ is a $\frac{2 \pi k}{6}$ turn, which is why $a^6=e$. Similarly, pick some line that goes through two vertices of the hexagon and call the reflection about it $b$. Then reflecting twice is $b^2$, which is just identity, since we have done nothing to the hexagon. Reflections about other lines can be expressed by first rotating, and then reflecting our hexagon. Thus, all reflections are given by $ba^{k}$ for $0 \leq k  \leq 5$. So, we have $6$ reflections and $6$ rotations, which are all symmetries, giving us a group of order $12$. Note that "inverses" for rotation are just rotating in the opposite direction. In particular, $a^{-1}$ is a rotation clockwise, which is the same thing as $a^5$ (draw a picture.) Finally, note that reflecting, then rotating, and reflecting back is the same thing as rotating once in the clockwise (backward) direction, so $bab=a^{-1}$. A different way of writing this is:
$$D_{12}:= \langle a,b \mid a^6=e=b^2,\,\, bab=a^{-1} \rangle$$
What is Conjugacy?
The basic heuristic for conjugacy is that two elements are conjugate if they have the same "type" in the sense that for example, reflecting about two different lines can often be seen as being "of the same type," while rotating once is sincerely different from rotating this twice. The group theoretic way of making this intuition precise is as follows:
\textbf{definition:} $a \in G$ is conjugate to $b \in G$ if there exists some $g \in G$ so that $a=gbg^{-1}$. If we interpret groups as symmetries of some object, this says there is some symmetry $g$ so that doing it, applying $b$ and undoing $g$ is the same thing as doing $a$.
The main trouble with applying this intuition for an even $n$-gon, is that there are extra axes of symmetry that go through two sides of a polygon, so conjugacy classes of reflections break into essentially two different types. Rotations, however will still only be conjugate to their inverses

Claim: The conjugacy classes for $D_{12}$ are
$$\{e\}, \{a^{3}\},\{a^{\pm 1}\}, \{a^{\pm 2}\}$$
$$\{a^2 b,b,a^{4}b\}$$
$$\{ab,a^{5}b\}$$
where odd $a$ reflections correspond to reflections about a line that goes through two sides, and even $a$ reflections go through two vertices.
To see this in a more algebraic way:
Conjugating a rotation: $(a^ib)(a^k)(a^ib)^{-1}=a^ib(a^k)ba^{-i}=a^{-k}$, and similarly, since rotations commute with rotations, we see that conjugating by a rotation is again just a rotation.
You can do similar things for conjugating a reflection, just using the equations provided by the presentation of the group I have in the first section.

I found a very detailed reference here, that goes through the intuition with all the proofs and many pictures.


text:
Q: FreeBSD & Jails: Send mail through Postfix in Jail I have FreeBSD 10.2 and I'm using several Jails, one of them has Postfix installed.
I want my other jails and my host system to use the local Postfix installation in the Jail. They should use sendmail to submit their mails to the Postfix Jail.
What would be the proper setup in the other Jails and the Host?
I already can send mails from within the Postfix jail and the host.
In the Host I have set in /etc/mail/mailertable:
xxx.yy  smtp:mail.xxx.yy
*.xxx.yy    smtp:mail.xxx.yy

I also have a /etc/mail/sendmail.mc (which I'm not sure if I will really need it and if it's correct though) in the host:
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
OSTYPE(freebsd6)dnl
DOMAIN(generic)dnl
FEATURE(access_db, `hash -o -T<TMPF> /etc/mail/access')dnl
FEATURE(blacklist_recipients)dnl
FEATURE(local_lmtp)dnl
FEATURE(mailertable, `hash -o /etc/mail/mailertable')dnl
FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')dnl
define(`SMART_HOST', `[10.0.0.3]')dnl
define(`MAIL_HUB', `[10.0.0.3]')dnl
MASQUERADE_AS(`xxx.yy')dnl
FEATURE(`masquerade_envelope')dnl
GENERICS_DOMAIN(host.xxx.yy HOST)dnl
FEATURE(genericstable)dnl
define(`confCW_FILE', `-o /etc/mail/local-host-names')dnl
DAEMON_OPTIONS(`Name=IPv4, Family=inet')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
define(`confNO_RCPT_ACTION', `add-to-undisclosed')dnl
define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')dnl
define(`confDONT_PROBE_INTERFACES',`True')dnl
define(`confDEF_CHAR_SET',`ISO-8859-1')dnl
MAILER(local)dnl
MAILER(smtp)dml

In the jails I have set sendmail_enable="NO" in rc.conf
However, when I try to send an email from a jail I get:
Jan  5 12:54:52 push sendmail[83676]: u05BsqB6083676: from=root, size=55, class=0, nrcpts=1, msgid=<201601051154.u05BsqB6083676@push.xxx.yy>, relay=root@localhost
Jan  5 12:54:52 push sm-mta[83677]: STARTTLS=server, relay=push [10.0.0.12], version=TLSv1/SSLv3, verify=NO, cipher=DHE-RSA-AES256-GCM-SHA384, bits=256/256
Jan  5 12:54:52 push sendmail[83676]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-GCM-SHA384, bits=256/256
Jan  5 12:54:52 push sm-mta[83677]: u05Bsq42083677: from=<root@push.xxx.yy>, size=404, class=0, nrcpts=1, msgid=<201601051154.u05BsqB6083676@push.xxx.yy>, proto=ESMTP, daemon=Daemon0, relay=push [10.0.0.12]
Jan  5 12:54:52 push sendmail[83676]: u05BsqB6083676: to=mail@xxx.yy, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30055, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u05Bsq42083677 Message accepted for delivery)
Jan  5 12:54:52 push sm-mta[83679]: u05Bsq42083677: to=<mail@xxx.yy>, ctladdr=<root@push.xxx.yy> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30404, relay=mail.xxx.yy. [XX.XX.XX.XX], dsn=4.0.0, stat=Deferred: Connection refused by mail.xxx.yy.

In the Postfix jail I don't get any logs about this.

A: Fix your Postfix jail. Not having logs is an error in itself.
Also your log says Connection refused by mail.xxx.yy -- so your relay setup seems to be working but you cannot connect to Postfix. Maybe it does not bind to the right IP?

A: In your postfix jail, use sockstat to verify that postfix is listening where you expect it to be:
[root@postfix /]# sockstat | grep :25
root     master     1947  13 tcp4   172.16.15.58:25       *:*

In this case, you can see that postfix in this jail is listening on IP address 172.16.15.58, port 25. Now you just need to configure the host and other jails to forward their messages to postfix.
Sendmail is overkill for such as task, use ssmtp instead. Configuration is very easy:
# cat /usr/local/etc/ssmtp/ssmtp.conf | grep -v ^#
root=matt@example.com
mailhub=172.16.15.58

and then disable sendmail entirely:
sysrc sendmail_enable=NONE


text:
Q: Flask doesn't stream on Lambda I have a small Flask app, which streams back some data
def start(self):
    for website in self.websites:
        yield self._do_something(website)

Which I call in app.py with return Response(foo.start()). Locally content will stream as expected, but on dev instance (Zappa + AWS Lambda) it will return all data at once, which is not desired.
I can't recreate this locally, why is this happening?

A: If I understand your question correctly, the issue is related to the design of the services -- specifically, the interfaces they expose.
Both API Gateway and AWS Lambda use an en bloc request-response model for their interactions.
API Gateway parses the HTTP request, then generates a Lambda Invoke request, signs it, and passes it to Lambda... all at once.
Lambda runs your code, which either fails and generates an error response, or succeeds and generates a successful response, and passes it back to API Gateway... all at once.
API Gateway generates the final HTTP response, and passes it back to the browser... all at once.
Obviously the references to things happening "all at once" do not refer to the network layer, since all of the interactions occur over TCP... but at the higher layers, everything is discrete and complete.  There is no mechanism for anything other than returning the data all at once.


text:
Q: Powershell BitsTransfer (https) with invalid certificate authority I'm trying to automate the weekly download of a text file from an https site with a ps1 script. My simple attempts to connect look like this -
Start-BitsTransfer `
-source https://url.com/file `
-destination d:\test.txt

I get the error "The certificate authority is invalid or incorrect". Is there a way to override this CA check?
This Powershell (3.0) script is running on Windows Server 2008R2 and the https://url.com/ SSL cert is issued by Entrust CA. I've tried to add Entrust as a "Trusted Root Certificate Authority" to the "Certificate Store" through IE8. No joy.

A: This really racked my brain for quite some time. I finally figured out you need to enter the number in decimal not in binary or hex.
C:>bitsadmin /SetSecurityFlags myJob 8
The 8 will make the "Ignore invalid certificate authority in server certificate :true"

A: http://technet.microsoft.com/en-us/library/cc753211(v=ws.10).aspx
C:\>bitsadmin /SetSecurityFlags myJob 0x011110

A: I believe I needed to update my Root CA list on the server with a MS Security Update.
And bitstransfer can not override a CA check.


text:
Q: unixODBC C++ documentation...? I cannot find any.
All I found is this: http://libodbcxx.sourceforge.net/ but this is not the right documentation for me. I got a UnixODBC library for C++, and cannot find any docs
I have this in the headers:
/*!
 * \file
 *
 * \author  Peter Harvey
 * \author  \sa AUTHORS file
 * \version 2
 * \date    2007
 * \license Copyright unixODBC-CPP Project 2003-2009, LGPL
 */
But the documentation in sourceforge is totally different - the macro-s (or whatever are the things like SQL_SUCCEEDED ) are the same, but the classes are named different, For example, the class in ODBCStatement.h is ODBCStatement, not odbc::Statement, also odbc::ErrorHandler is ODBCHandle, etc. I have some strange member functions in class ODBCStatement like: doBindParameter, doPrepare, doExecute, etc and google knows nothing about them...........
Any ideas?
P.S. I'm maintaining a product, where the code is not written by me.

A: There is NO such documentation. I contacted Peter Harvey, he advised (what I thought at the beginning) just to watch what his wrapper does in each function and watch the documentation for unixODBC - the C version.
The other option is to rewrite the software, using the sourceforge wrapper, as it seems to be well-documented.


text:
Q: how can I replace Jquery plugin calls which uses 'on'? I have a project which uses many plugins.  However, some are reliant on older versions of JQuery . The plugin I intend to use is dependent on JQuery 1.7 as it uses 'on' for event binding.
How can I modify the plugin so that it will work with JQuery 1.6? If I upgrade to JQuery 1.7 it will break other parts of my project that are dependant on the plugins.  Or is there a better way to deal with this scenario?

A:
As of jQuery 1.7, .delegate() has been superseded by the .on() method. For earlier versions, however, it remains the most effective means to use event delegation. More information on event binding and delegation is in the .on() method.

http://api.jquery.com/delegate/
I would try to alter the older plugins to work with 1.7+ though. Seems more rewarding.

A: Well you have to look at  each call to be sure, but you can easily replace on() calls with delegate() (expecially when on() is used for newly added elements
 .delegate( selector, eventType, handler(eventObject) )

 .on( events [, selector], handler(eventObject) )

basically you have to switch the first two arguments. Otherwise you could load jQuery 1.7 just for the plugin and use $.noConflict(true)
    $jq = $.noConflict(true);
    //replace all $ in the plugin with $jq


text:
Q: TYPO3 FLUID conditions while looping array I have an array which contains a list of names. In the front end, this has to be listed in a listed way. Using the
 and
 tags.
Half of the list should be displayed under one
 tag and the other half under another
 tag.
like this:

One

Two

Three

Four

Five

Six

Now the problem is in FLUID I did not find a way to end the
 tags when the array loops half of the elements.
I want to do something like this
<f:for each="{my_array}" as="item">

{item}

</f:for>

A: I think you should get the id in PHP for the element in the middle and then you can use a simple if, like this:
It is a bit extended version of f:for. Here you can check the iteration property. When you use the iteration.index it is the current index of elements. However an elementLimit you have to set.
It is several properties for iteration : isFirst,isLast, isEven, isOdd, total, cycle, index.
Here is an article about it.
UPDATED example:
<f:for each="{my_array}" as="item" iteration="itemIterator">

{item}

    <f:if condition="{itemIterator.index} = {elementLimit}">

    </f:if>
</f:for>

A: This should work. The only problem is when there is an odd amount of menu entries.
<f:for each="{my_array}" as="item" iteration="itemIterator">

{item}

        <f:if condition="{itemIterator.iterator}%({itemIterator.total}/2) == 0">

        </f:if>

</f:for>


text:
Q: Android webgl concept? is it possible to develop the webgl applications in android?which version of android is supporting this means which version of mobile browser is doing?

A: Just to update this, Firefox mobile, aka Fennec, now runs on high-end android phones and supports webgl. Some of the demos will run a little slowly... this is the case for most processing.js 3d code since it seems to not use highly optimized webgl. Some of the demos, especially those written in the "thin layer" webgl frameworks like spidergl run pretty well.
Your android device must support arm7 instruction set to run Fennec. This rules out low-end phones, but Evo class, tablets, etc will run it fine.

A: Looks like none of the Android browsers support it at the moment but it is planned for the Android browser (no eta specified) and also for Firefox Mobile (july 1, 2011).


text:
Q: How do we choose the business logic when building a Jhipster application? When creating a entity with the Jhipster helper, it asks
? Do you want to use separate service class for your business logic? (Use arrow keys)
> No, the REST controller should use the repository directly
  Yes, generate a separate service class
  Yes, generate a separate service interface and implementation

In which case should I use which option?
What are the benefits and flaws of each solution?
Is it possible to change easily the architecture once everything is set?

A: IMHO it depends on how complex your application is going to be and how long you plan on having to maintain it.
If your domain model is quite simple and your REST controllers are straightforward CRUD operations without complex mapping, you can get away without using a separate service layer.
If your domain model or interactions get more complex, you might need a 'Separation of Concerns': your Controller classes should just map REST calls from/to the correct DTO's for the REST API, and business logic and coordination between different entities should go in a service class that does not have anything to do with the REST API. In the long term, that makes it easier to make changes in the REST API separate from changes in the business logic.
Some blog posts to read:
https://www.petrikainulainen.net/software-development/design/understanding-spring-web-application-architecture-the-classic-way/
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
Then about the decision to use interfaces or not. The main advantages of using interfaces used to be that it allowed better testing and avoided coupling modules too close. But since 2010, there has been a lot of discussion whether it's worth the overhead. Maybe start reading the discussion underneath Adam Bien's original post:
https://www.adam-bien.com/roller/abien/entry/service_s_new_serviceimpl_why


text:
Q: php if specific date expires do not echo vars I am trying to figure out how to NOT echo a var if the date has expired.
My PHP below shows:
Match 1 - April 1, 2015
Match 2 - April 8, 2015
So what I need is that, IF the Current date is, April 2, 2015, Match 1 will not echo. If April 30th, nothing will echo.
Here is the php
<?php
$match1 = "Match 1 - April 1, 2015";
$match2 = "Match 2 - April 8, 2015";
?>

<?=$match1?>
<?=$match2?>

I have looked at several codes and tried a few myself, but nothing works. Thanks.

A: Basic idea:
$expiration_date = strtotime("2 April 2015"); //converts your date into a unix timestamp

$time = time(); //current time in unix format

if ($time < $expiration_date){ // if the current time is less than expiration date do something
    echo $match1; // or whatever variable you wanted to echo
} // if the current time is past the expiration date the if statement will evaluate to false and do nothing

A: I wanted to update this for future users.
If you are wanting to have a specific div show/hide depending on an expiration date, you can create the div's on a seperate PHP page and then include them with your php as follows:
Include.php
<?php if (time() < strtotime("1 January 2016")){include('Div1.php');}?>

Div1.php

I want this Div included with Include.php if it is not expired past January 1 2016

Thought it may be helpful to someone.

A: Here is another PHP code for those that want to show a certain div for a certain date period and then default to another div if it is not at that date.
For example, I am using this for a website that prepares taxes (USA).
Tax season starts Jan 1st and ends April 15th. The client needed to show a certain div during tax season showing they prepare taxes, off season, they help with accounting software setup.
**Note - notice the end date is 1 day past 04/15 this is due to you having to add +1 day to your end date to make sure your end date is still active to show.
PHP
<?php
    if ((time() > strtotime("01/01/2015")) && (time() < strtotime("04/16/2015")))
    {include "seasonON.php";}else{include "seasonOFF.php";}
?>

seasonON.php

YES, Tax season is here and we prepare Taxes!

seasonOFF.php

Tax season is over, but we can help you with your accounting software


text:
Q: htaccess rule to consider double slashes as single I am working on a project built using codeigniter. And the mistake I have made is that I have added "/" after the base_url() method in many links(href) I have given on the project files as shown below.
<? echo base_url();?>/about

So the URLS are looking like
http://myproject.com//about

in place of
http://myproject.com/about

And because of that, it is resulting to 404 error.
Now the situation is that the site is ready but I am only allowed to update the .htaccess file of the project to fix this.
So is there any rule I can write in .htaccess file so that it considers the double slashes in the URL as single slash and open the specific page?
Funny thing is, it was already considering double slashes as single slash somehow and opening the "About" page on the development server. But now as the server is changed, I have started facing the 404 issues.

A: You can use this rule as very first rule in your DOCUMENT_ROOT/.htaccess file to remove multiple //:
RewriteEngine On

RewriteCond %{THE_REQUEST} //
RewriteRule ^(.+?)/?$ /$1 [R=302,L,NE]

A: actually you have set the base url as
$config['base_url'] = 'http://myproject.com/';

and when u are using it like this
<? echo base_url();?>/about

it is adding to // so you have to change your page like this
 <? echo base_url();?>about

and if you cant change your path then you can set your htaccess as
RewriteEngine On

RewriteCond %{THE_REQUEST} //
RewriteRule ^(.+?)/?$ /$1 [R=302,L,NE]


text:
Q: How can I highlight XML on the command line? How can I highlight XML from stdin (e.g. piped from xmllint --format) to stdout?
I know how to get highlighting working in nano and view, but is there something that just outputs to stdout and exits?
What I'd link to do is just type something like
xmllint --format xmlfile.xml | some-highlighter

or maybe, for big files
xmllint --format xmlfile.xml | some-highlighter | less

and get pretty output.

A: I found highlight in Homebrew for OSX, and I'm sure it's available in the Ubuntu repository. It does highlighting and output to a number of formats, including terminal output.

A: I use bat:
xmllint --format - | bat -pP

-p removes all decoration (line numbers, etc.), -P disables the pager. Update: use -pp with newer versions of bat.
bat: https://github.com/sharkdp/bat

A: Supercat and grcat (grc) can do piped syntax highlighting. You'll probably have to make or find configuration files for XML. They are both available in the Ubuntu repositories as well as at the links provided.
Pygmentize has XML highlighting included. It's available as "python-pygments" in the Ubuntu repositories or by using easy_install Pygments.
xmllint --format xmlfile.xml | pygmentize -l xml | less

A: This is how you do it using GNU source-highlight and less:

source-highlight -i /tmp/foo.xml -f esc | less -r


text:
Q: How to extract data from database and use in jsp page I'm working on jsp,servlet code . I have LESSON table in my db too which has lesson_id , lesson_name and etc.
Now I want to use "a" tag in my jsp page which link to a servlet page but each tag used in jsp should has a specific lesson_id which has token from my database.
for example data structure has a special id. so if i want to use many "a" tag in my jsp for each lesson that has a specific id, how can i do this?

A: Yes, You can use JSTL & EL. For database access use JSTL SQL Tag library.
JSP: (sample code:)
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<sql:setDataSource var="webappDataSource"
    driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test"
    user="root" password="root" />

<sql:query dataSource="${webappDataSource}"
    sql="select lesson_id, lesson_name from lessons" var="result" />

    <c:forEach var="row" items="${result.rows}">

            ${row.lesson_id}
            ${row.lesson_name}

                  click here

    </c:forEach>

Note: It's better to move the database code in the Servlet. Here is an example


text:
Q: How to specify multipart HTML code so it's downloaded with 1 GET request I want to render a web page using content type Multipart, but my sniffer logs always show multiple GET requests for the images on the web page.
Here is my test code:
<!DOCTYPE html>

    <title>multipart/form-data</title>

Testing multipart/form-data

    <META HTTP-EQUIV="Content-Type" CONTENT="multipart/related; charset=ISO-8859-1"/>

    Text outside the <form> tag.
    <form
        enctype="multipart/form-data"
        method="POST"
        action="/php/showPostGet.php" >

        Text inside the <form> tag.

        <input type="submit" value='TEST'/>

        <form enctype="multipart/text/plain">
            Name1: <input type="text" name="fname" value="ABC">

            Name2: <input type="text" name="lname" value="123">

        </form>

    </form>

When I do a Refresh on this web page, I expect to see a single GET request, but i see multiple GET requests (one for the main page and one for ea image file).
like this:
7 10.738337   163.64.287.173         10.235.5.146          HTTP     GET /mdg/HTML/FileUpload/Andy/multipart-form-data.html HTTP/1.1

9 10.739553   10.235.5.146          163.64.287.173         HTTP     HTTP/1.1 200 OK (text/html)

Content-Type: text/html; charset=ISO-8859-1\r\n

<META HTTP-EQUIV="Content-Type" CONTENT="multipart/form-data; charset=ISO-8859-1"/>

17 12.945487   163.64.287.173         10.225.57.136          HTTP     GET /images/arrow_left.jpg HTTP/1.1

19 12.946704   10.225.57.136          163.64.287.173         HTTP     HTTP/1.1 200 OK (JPEG JFIF image)

Content-Type: image/jpeg\r\n

28 14.816313   163.64.287.173         10.225.57.136          HTTP     GET /images/arrow_right.jpg HTTP/1.1

30 14.817529   10.225.57.136          163.64.287.173         HTTP     HTTP/1.1 200 OK (JPEG JFIF image)

Content-Type: image/jpeg\r\n

41 17.196125   163.64.287.173         10.225.57.136          HTTP     GET /images/arrow_up.jpg HTTP/1.1

43 17.197342   10.235.5.146          163.64.287.173         HTTP     HTTP/1.1 200 OK (JPEG JFIF image)

Content-Type: image/jpeg\r\n

51 19.060141   163.64.287.173         10.225.57.136          HTTP     GET /images/arrow_down.jpg HTTP/1.1

53 19.061358   10.225.57.136          163.64.287.173         HTTP     HTTP/1.1 200 OK (JPEG JFIF image)

Content-Type: image/jpeg\r\n

I expected to see 1 get request followed by several OK/CONTINUATION messages (with 'boundary=' data).
Something like this (from another web site):

    901 15:36:40.100491 10.277.7.10           72.253.197.19          HTTP     GET /app/WT/default.aspx?vtbl=1&debugds=320&vzmw3=vzmw3 HTTP/1.1
903 15:36:40.317813 72.253.197.19          10.277.7.10           HTTP     HTTP/1.1 200 OK

Content-Type: multipart/mixed; boundary=next.part.8412f441-e4ea-4554-8400-9a003df2f78f\r\n

Content-Type: multipart/mixed; boundary=next.part.8412f441-e4ea-4554-8400-9a003df2f78f\r\n

MIME Multipart Media Encapsulation, Type: multipart/mixed, Boundary: "next.part.8412f441-e4ea-4554-8400-9a003df2f78f"

First boundary: --next.part.8412f441-e4ea-4554-8400-9a003df2f78f\r\n

Content-Type: text/html; charset=utf-8\r\n

905 15:36:40.319315 63.64.187.229         97.253.137.46         HTTP     HTTP/1.1 200 OK

Content-Type: multipart/mixed; boundary=next.part.8412f441-e4ea-4554-8400-9a003df2f78f\r\n

Content-Type: multipart/mixed; boundary=next.part.8412f441-e4ea-4554-8400-9a003df2f78f\r\n

906 15:36:40.320116 72.253.197.19          10.247.7.10           HTTP     Continuation

A: You won't be able to do this in HTML. Content-Type: multipart/... is an HTTP header, whereas the HTML tag <meta http-equiv="content-type"> supports very limited values as defined here: http://www.w3.org/TR/html-markup/meta.http-equiv.content-type.html#meta.http-equiv.content-type

A specially formatted string providing a character encoding name. Value: The
  following parts, in exactly the following order:

*

*The literal string "text/html;".

*Optionally, one or more space characters.

*The literal string "charset=".

*One of the following:

*

*For documents in the HTML syntax: A character encoding name.

*For documents in the XML syntax: Any case-insensitive match for the string "UTF-8".

In other words, since this is an HTML document, the only allowed content-type is "text/html".
You want to specify "multipart/mixed" in the HTTP headers on the server side (e.g. using PHP header() or similar). But even then, it looks like the only browsers that support it are/were Firefox/Netscape; see How to download multiple files with one HTTP request?


text:
Q: TensorFlow: Is there a way to convert a list with None type to a Tensor? For my application, I am trying to convert a list with [None, 1, 1, 64] to a tensor using tf.convert_to_tensor([None, 1, 1, 64]), but this gives me the error:
TypeError: Failed to convert object of type <type 'list'> to Tensor. Contents: [None, 1, 1, 64]. Consider casting elements to a supported type.
Ideally, I want None to be the first dimension because it represents the batch_size. Currently, the only way I could avoid this error is to explicitly give the batch_size to the operation, but I am hoping there is a cleaner way to convert such a list to a tensor.

A: Use tf.convert_to_tensor([-1, 1, 1, 64]) instead of None, since you are already specifying 3 out of 4 dimensions, this should be fine.

A: No, because None and 64 have different types, and all tensors are typed: You can't have elements of different types in one tensor.
The closest thing you could do is nan:
tf.convert_to_tensor([np.nan, 1, 1, 64])

although I can't imagine why you'd want that.
You can however create a TensorShape:
tf.TensorShape([None, 1, 1, 64])


text:
Q: Неверная кодировка на хосте При тесте на апаче все норм, а вот на хосте русский текст в виде вопросительных знаков. Во что перекодировать?
A: мой ответ строится на том, что вы хотите указать кодировку utf-8.
1) ваш документ должен быть отредактирован под UTF-8 без BOM (с этим хорошо справляется Notepad++ (контекстное меню кодировки\преобразовать в UTF-8 без BOM))
2) если вас не устраивает кодировка выгрузки из БД
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");
mysql_query("SET SESSION collation_connection = 'utf8_general_ci'");

3) укажите кодировку в самом документе
header('Content-type: text/html; charset=utf-8');

4) есть ещё возможность настройки htacess и php.ini - но уверен, вам и без них будет "ютеэфно" =)
A: Я использую UTF-8 без BOM и другим советую.
Так же я лично не использую данную строку:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

и тому подобные


text:
Q: Make button under image clickable I'm trying to code a little 'card' that has an image, which when you hover in, it fades the image out and shows up a button which I'm trying to make clickable. The problem is that the button cannot be clicked since it's under the image and when you click on it, it registers as a click on the image. I know I could make it so the user can just click the image, but that doesn't work well on mobile since you cannot hover without clicking.
Here's my HTML: (note: this is a basic version of my actual cards)

.center {
  text-align: center;
}

img.rounded-corners {
  border-radius: 30px;
  background-color: rgba(29, 30, 40, 1);
}

.btn btn-primary {
  position: absolute;
  top: 50%;
}

.card {
  //background: #1D1E28;
  background-color: transparent;
  position: relative;
  height: 500px;
  width: 500px;
  margin: 0 auto;
}

.card img {
  position: absolute;
  left: 0;
  opacity: 1;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

.card img:hover {
  opacity: 0;
}

    <button class="btn btn-primary btn-lg manage-btn" target="_blank" role="button">Manage server</button>

A: The solution what i see might be if hover handler will be on the .card:hover img not the .card img:hover. And remove form the image event with pointer-events: none;
.card:hover img {
  opacity: 0;
  pointer-events: none;
}

document.querySelector('button').addEventListener('click', ev => {
  console.log('click');
  ev.target.textContent = 'cliked';
});
.center {
  text-align: center;
}

img.rounded-corners {
  border-radius: 30px;
  background-color: rgba(29, 30, 40, 1);
}

.btn btn-primary {
  position: absolute;
  top: 50%;
}

.card {
  background: #1d1e28;
  background-color: transparent;
  position: relative;
  height: 500px;
  width: 500px;
  margin: 0 auto;
}

.card img {
  position: absolute;
  left: 0;
  opacity: 1;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

.card:hover img {
  opacity: 0;
  pointer-events: none;
}

    <button class="btn btn-primary btn-lg manage-btn" target="_blank" role="button">
          Manage server
        </button>


text:
Q: Why don't we use quick sort on linked list? Quick sort algorithm can be divided into following steps
1) identify pivot.
2) Partition the linked list based on pivot.
3) Divide the linked list recursively into 2 parts.
Now, if I always choose last element as pivot, then identifying pivot element (1st step) takes O(n) time.
After identifying pivot element, we can store it's data and compare it with all other elements to identify correct partition point (2nd step). Each comparison will take O(1) time as we store the pivot data and each swap takes O(1) time. So in total it takes O(n) time for n elements.
So recurrence relation is
T(n) = 2T(n/2) + n which is O(nlogn) which is same as in merge sort with linked list.
So why is merge sort preferred over quick sort for linked list ?

A:
So recurrence relation is ... O(nlogn)

Worst case quicksort on arrays is O(n^2), for example, each level of recursion only reduces the size of the largest partition by 1 or 2 (2 if pivot not included in either partition).

So why is merge sort preferred over quick sort for linked list ?

It's much faster, especially bottom up merge sort which eliminates scanning of lists to split them. Instead it uses a small (26 to 32) internal array of pointers or references to nodes (or small array of lists), merging nodes into the array, then merging the array to create a sorted list. Wiki article includes pseudo-code:
https://en.wikipedia.org/wiki/Merge_sort#Bottom-up_implementation_using_lists

A:
Now, if I always choose last element as pivot, then identifying pivot
  element (1st step) takes O(n) time.

It actually takes O(1) time. But anyway, a common misconception w.r.t. quick-sort is the idea that you may pick a predefined element as a pivot, rather than random. You may not.
Quick-sort works on average in O(N log(N)), but worst-case is O(N^2). Now, when the pivot is chosen randomly and algorithm is performed on large sets - then indeed O(N log(N)) is what you get in practice. However if you pick a predefined pivot, then, depending on the pattern of your data, you can easily hit the worst-case.
Think that the source data is not random, it comes from some source, and exhibits some pattern.
For instance, if you take the last element as the pivot, and your source data just in case is already sorted in reverse order - then you'll definitely get the degenerate case of O(N^2).
Regarding your question why quick-sort isn't used usually for linked lists. The reason (IMHO) is that for lists the merge-sort is a preferred way to go. It guarantees the worst-case performance of O(N log(N)). It's usually not used for arrays, because in case of arrays it needs extra memory allocated, but this is not the case with linked lists.


text:
Q: C#- ArrayList problema con método Estoy intentando hacer un vector de ArrayList y agregándole los ArrayList mediante el método correspondiente, pero parace no funcionar, no sé qué estoy haciendo mal.
Se supone que el método para agregar elemento al ArrayList es Add pero no funciona, por otro lado intenté hacerlo de otra forma, pero en ese caso no puedo acceder a los elementos.
ArrayList lista1 = new ArrayList { "1", "2", "3" };
ArrayList lista2 = new ArrayList { "A", "B", "C" };
ArrayList[] total = new ArrayList [] {  };

total.Add(lista1);
total.Add(lista2);

Segunda forma:
ArrayList lista1 = new ArrayList { "1", "2", "3" };
ArrayList lista2 = new ArrayList { "A", "B", "C" };
ArrayList total = new ArrayList {  };

total.Add(lista1);
total.Add(lista2);

for (int cont = 0; cont < total.Count; cont++)
{
    for (int cont2=0;cont2 < total[cont].Count;cont2++   )
    {

    }
}

A: Puedes hacer uso del método AddRange:
ArrayList lista1 = new ArrayList { "1", "2", "3" };
ArrayList lista2 = new ArrayList { "A", "B", "C" };
ArrayList total = new ArrayList {  };

total.AddRange(lista1);
total.AddRange(lista2);

Aquí puedes ver la demostración de la solución
Actualización:
Dado tu comentario, donde mencionas que tu resultado esperado debería ser {{A,B;C},{1,2,3}}, entonces sugiero que hagas uso de una lista, teniendo como definición List<ArrayList>:
ArrayList lista1 = new ArrayList { "1", "2", "3" };
ArrayList lista2 = new ArrayList { "A", "B", "C" };
List<ArrayList> total = new List<ArrayList>();

total.Add(lista1);
total.Add(lista2);

Console.WriteLine("Total de elementos en la lista: " + total.Count);
Console.WriteLine("Total de elementos en la posición 0: " + total[0].Count);
Console.WriteLine("Total de elementos en la posición 1: " + total[1].Count);

foreach(ArrayList item in total){
    Console.WriteLine("Elementos del ArrayList:");
    for(int i = 0; i < item.Count; i++){
        Console.WriteLine(item[i]);
    }
}

Aquí puedes ver la segunda demostración de la solución
Actualización 2:
Dado a tu segundo comentario, para hacer uso de tu código necesariamente en la segunda forma, es necesario hacer un casteo explícito para ((ArrayList)total[cont]).Count:
ArrayList lista1 = new ArrayList { "1", "2", "3" };
ArrayList lista2 = new ArrayList { "A", "B", "C" };
ArrayList total = new ArrayList { };

total.Add(lista1);
total.Add(lista2);

for (int cont = 0; cont < total.Count; cont++)
{
    for (int cont2 = 0; cont2 < ((ArrayList)total[cont]).Count; cont++)
    {
        Console.WriteLine(((ArrayList)total[cont])[cont2]);
    }
}

Aquí puedes ver la tercer demostración de la solución
O en su caso, puedes utilizar foreach en lugar del for (hasta se ve más limpio el código ¿cierto?):
foreach (var cont in total)
{
    foreach (var cont2 in (ArrayList)cont)
    {
        Console.WriteLine(cont2);
    }
}

A: Si no mal entiendo quiere un arreglo de arreglo. Entonces tienes que asignarle el indice, de la siguiente manera:
ArrayList lista1 = new ArrayList { "1", "2", "3" };
        ArrayList lista2 = new ArrayList { "A", "B", "C" };
        ArrayList[] total = new ArrayList[2];

        total[0] = lista1;
        total[1] =lista2;


text:
Q: Plot only Edges with a specific weight - igraph I have a really large edge list, and I would like to plot only the edges that have a particular weight, how can I do that?
I have so far tried
plot.graph(E(sgdf)[E(sgdf)$weight==3]))

but I always get this error
Error in V(g) : Not a graph object

A: Copy your graph first, remove the edges that you don't need, and plot the rest:
> sgdf.copy <- delete.edges(sgdf, which(E(sgdf)$weight != 3)-1)
> plot(sgdf.copy)

The -1 is needed in delete.edges because igraph uses zero-based edge indices while R uses 1-based indices.
Update: as an anonymous editor (whose edit was sadly rejected) pointed out, igraph uses 1-base edge indices from igraph 0.6 onwards. Therefore, subtract 1 only if you are using igraph 0.5.x or earlier.


text:
Q: Why will the function PrintMaanden() print only the month itself, rather than the string I gave to each month? I want the function PrintMaanden() to print every month with its string, e.g. "1 => January"
Instead the function prints just the month itself, e.g. "January".
What did I do wrong here? Note that for this code I have to use the other function (that does work correctly as it is) PrintMaand() in the function PrintMaanden().
static void Main(string[] args)
{
    Program kalenderMaand = new Program();
    kalenderMaand.Start();
}

void Start()
{
    //New object month of type Month (class Month)
    Maanden maand;
    maand = new Maanden();
    PrintMaanden();
    PrintMaand(maand);

    //Read number of the month
    Console.Write("Typ het nummer van de maand: ");
    string month = Console.ReadLine();
    Maanden monthNumber = (Maanden)int.Parse(month);

    //Display the month based on the number that was typed
    switch (monthNumber)
    {
        case Maanden.Januari:
            Console.WriteLine("1 => Januari");
            break;
        case Maanden.Februari:
            Console.WriteLine("2 => Februari");
            break;
        case Maanden.Maart:
            Console.WriteLine("3 => Maart");
            break;
        case Maanden.April:
            Console.WriteLine("4 => April");
            break;
        case Maanden.Mei:
            Console.WriteLine("5 => Mei");
            break;
        case Maanden.Juni:
            Console.WriteLine("6 => Juni");
            break;
        case Maanden.Juli:
            Console.WriteLine("7 => Juli");
            break;
        case Maanden.Augustus:
            Console.WriteLine("8 => Augustus");
            break;
        case Maanden.September:
            Console.WriteLine("9 => September");
            break;
        case Maanden.Oktober:
            Console.WriteLine("10 => Oktober");
            break;
        case Maanden.November:
            Console.WriteLine("11 => November");
            break;
        case Maanden.December:
            Console.WriteLine("12 => December");
            break;
    }
    Console.ReadKey();
}

void PrintMaand(Maanden maand)
{
    Console.WriteLine(maand);
}

void PrintMaanden()
{
    for (int i = 1; i < 13; i++)
    {
        PrintMaand((Maanden) i);
    }
}

A: The logic to pring both the month index/number as well as the name is not in the  PrintMaanden function. It is in the Start function.

A: Maybe that what youre looking for:
void PrintMaand(Maanden maand)
{
    Console.Write(maand + "\n");
}

void PrintMaanden()
{
    for (int i = 1; i < 13; i++)
    {
        Console.Write($"{i} => ");
        PrintMaand((Maanden) i);

    }
}

I used Write instead of WriteLine because this way you can write on the same line using your PrintMaand() method. And inside the PrintMaand() you have the \n for next line. The PrintMaanden formats the extra info you need for your new print.

A: This may be what you are looking for:
void PrintMaand(Maanden maand)
{
    Console.WriteLine((int) maand + " => " + maand);
}

void PrintMaanden()
{
    for (int i = 1; i < 13; i++)
    {
        PrintMaand((Maanden) i);
    }
}

It's just of matter of formatting the result.

A:     void Start()
    {
        //New object month of type Month (class Month)
        Maanden maand;
        maand = new Maanden();

        //Calling the methods
        PrintMaanden();
        VraagMaand("Typ het nummer van de maand: ");

        Console.ReadKey();
    }

    void PrintMaand(Maanden maand)
    {
        Console.WriteLine(maand);
    }

    void PrintMaanden()
    {
        int teller = 0;
        for (Maanden i = Maanden.Januari; i <= Maanden.December; i++)
        {
            teller = teller + 1;
            Console.WriteLine(string.Format("{0,2}. {1}", teller, i));
        }
    }

    Maanden VraagMaand(string question)
    {
        //Read number of the month
        Console.Write(question);
        string month = Console.ReadLine();
        Maanden monthNumber = (Maanden)int.Parse(month);

        Console.Write("{0} => ", month);
        PrintMaand(monthNumber);
        return monthNumber;
    }
}

}
I figured it out, this was what I was looking for.


text:
Q: Passing additional iteration-dependent inputs to ode45 I'm trying to solve differential equation using the ode45 function. Consider the following code,
[t1,X2] = ode45(@(t,x)fun(t,x,C1,C2,C3,C4),t0,X01);

where parameters C1, C2, C3 and C4 are column vectors, which should be available to the function that ode45 is referring to (fun.m). I want the values to change after every iteration, so for example, at the beginning the entry of C1 I want in is C1(1), in the next iteration it's C1(2), etc.
How can I implement that?

A: You may have noticed that the official docs are not too helpful in this scenario (as they pretty much force you to use global variables - which is doable, but discouraged). Instead, I'll show you how this can be done with classes and function handles. Consider the following:
classdef SimpleQueue < handle
  %SIMPLEQUEUE A simple FIFO data structure.

  properties (Access = private)
    data
    position
  end

  methods (Access = public)
    function obj = SimpleQueue(inputData)
      %SIMPLEQUEUE Construct an instance of this class
      obj.data = inputData;
      rewind(obj);
    end % constructor

    function out = pop(obj, howMany)
      %POP return the next howMany elements.
      if nargin < 2
        howMany = 1; % default amount of values to return
      end
      finalPosition = obj.position + howMany;
      if finalPosition > numel(obj.data)
        error('Too many elements requested!');
      end
      out = obj.data(obj.position + 1 : obj.position + howMany);
      obj.position = finalPosition;
    end % pop

    function [] = rewind(obj)
      %REWIND restarts the element tracking
      % Subsequent calls to pop() shall return elements from the beginning.
      obj.position = 0;
    end % rewind
  end % methods
end % classdef

How to use this? Simple:
C1q = SimpleQueue(C1);
C2q = SimpleQueue(C2);
C3q = SimpleQueue(C3);
C4q = SimpleQueue(C4);

[t1,X2] = ode45(@(t,x)fun(t,x,@C1q.pop,@C2q.pop,@C3q.pop,@C4q.pop),t0,X01);

As you can see, inside fun we use C1q() instead of C1.


text:
Q: Matrix exponential in the time propagation by the free Dirac equation I am trying to evaluate
$$\exp(-ic \alpha pt /\hslash - i\beta mc^2t/\hslash),$$
where
$$ \alpha =
\begin{pmatrix}
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0
\end{pmatrix},
\quad \beta =
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & -1 & 0 \\
0 & 0 & 0 & -1
\end{pmatrix}.
$$
The most basic property of these matrices is, besides $\beta$ being diagonal, is $\alpha^2 = \beta^2 = \mathbb{I}_4$. We also have $\alpha \beta + \beta \alpha = 0$.
This matrix exponential arises in the study of time propagation by the 1-D free Dirac equation in relativistic quantum mechanics, which reads
$$ i\hslash \partial_t \psi(p,t) = (c\alpha p + \beta mc^2) \psi(p,0),$$
where $\psi$ denotes the spinor in momentum space. This leads to the matrix exponential given above such that
$$\psi(p,t) = \exp(-ic \alpha pt /\hslash - i\beta mc^2t/\hslash) \psi(p,0).$$
In the appendix of a publication [1], the solution is directly given by (with $\hslash = 1$)
$$\left( \mathbb{I}_4 cos(Et) - i\frac{c\alpha p + \beta mc^2}{E} sin(Et)\right), \quad E = \sqrt{p^2c^2 + m^2 c^4},$$
which looks fairly simple, and is reminiscent of Euler's formula. However, I was still not able to derive the solution with the few methods I know. For instance, the case $X = A + N$ ,where $A$ is diagonal, $N$ is nilpotent and $AN = NA$ does not apply here because of $\alpha$, which is not nilpotent, and $\alpha$ and $\beta$ do not commute, either.
Can you see it at a glance?
[1] : see equations B.3 and C.3 on pages 39 and 41 in https://arxiv.org/abs/1107.4650 .

A: Taking $a=-cpt/\hbar$ and $b=-mc^2t/\hbar$ for convenience, note that $\exp(ia\alpha+ib\beta)=\sum\limits_{n=0}^{\infty}\frac{1}{n!}(ia\alpha+ib\beta)^n$. But from the fact that $\alpha^2=\beta^2$ is the identity, and $\alpha\beta+\beta\alpha=0$, we have that $(ia\alpha+ib\beta)^{2k}=(-1)^k(a^2+b^2)^k I$ (where $I$ is the identity matrix), and $(ia\alpha+ib\beta)^{2k+1}=(-1)^k i(a^2+b^2)^k(a\alpha+b\beta)$. So, gathering together the even terms yields: $\cosh(\sqrt{-a^2-b^2})I$ and gathering together the odd terms yields: $\frac{i\sinh(\sqrt{-a^2-b^2})}{\sqrt{-a^2-b^2}}(a\alpha+b\beta)$. Note that $a$ and $b$ are real, so we can pull a factor of $i$ from each square root. Recalling that $\cosh(ix)=\cos(x)$ and $\sinh(ix)=i\sin(x)$ and adding the two pieces together then yields the result.


text:
Q: Passing dynamic Variable IN WHERE statement IN SQL I have a WHERE statement where a DateOfService must be bookended between date ranges that could change.  Because of this, I build an IF statement to trap the conditions and build the BETWEEN part of the statement.
Here is a Sample:

IF ISNULL(@TargetStartDate, 'N') = 'N'
    BEGIN
        SET @SubWhere = ' ad.EnrolledDate AND s.DateOfService'
    END ELSE BEGIN
        SET @SubWhere = ' @targetStartDate AND  @TargetEndDate'
    END

When I incorporate into WHERE clause there is no visible error. The error appears on the execution of the ALTER PROC
Here is the snippet from the WHERE clause:

AND s.DateOfService BETWEEN CAST(@SubWhere AS VARCHAR(150))

Any insight as to how to get this to work error free are much appreciated!


text:
Q: Localization of a Dedekind domain. I have a question on localizations of Dedekind rings which I am learning about in an undergraduate class. Let $R$ be a Dedekind ring with quotient field $K$, $\mathfrak p$ a nonzero prime ideal in $R$. Let $R_\mathfrak p$ be the localization of $R$ at $\mathfrak p$.
One assignment question is to show that if $x\in K-R_\mathfrak p$ then $x^{-1}\in R_\mathfrak p$.
If $x=r/s\in K-R_\mathfrak p$ then $r\in R$ and $s\in \mathfrak p$. I don't see how we can deduce $r\notin \mathfrak p$ since we want $s/r\in R_\mathfrak p$.
A hint will be very useful. Thanking you in advance.

A: Let $R = \mathbb{Z}$ and $\mathfrak{p} = (p)$, with $p$ a rational prime. See what happens in this case, and that should indicate how to proceed in the general case.

A: This exercise is asking you to prove that $R_\mathfrak{p}$ is a valuation ring (see the first definition in the Wikipedia entry: http://en.wikipedia.org/wiki/Valuation_ring#Definitions).
My answer to the following question explains this:
Discrete valuation ring associated with a prime ideal of a Dedekind domain


text:
Q: Will a parallel capacitor short a resistor?
In the configuration above, SOL_IN is the rectified output of a solar panel (so dc).
What's more important is R1, which is a low resistance sense resistor used to measure the current from the solar panel. I'm concerned that the capacitor will charge to the voltage at SOL_IN and hence short circuit the resistor since there will be no voltage drop across it.
Is this reasoning correct?
(R1 = 0.15 Ohms, C1 = 1 uF)
EDIT: Line is going to load, not GPIO as originally stated.

A: The GPIO pin of your micro-controller is an high-impedance input. It will allow little to no current to flow through the circuit. On average, the capacitor will not let the current go through either. As drawn, your circuit will only measure the current used to charge or discharge the capacitor, a pulse that will last: $$\tau = R \cdot C = 150 ns$$ (the RC time constant), when the voltage change. To measure the current with M1, you need to add a load to the ground where you connect the GPIO.

A: The capacitor will charge to the voltage you have on the load (including the wiring). The resistor R1 will create an additional voltage drop (that's the whole purpose of a shunt resistor).
So on the right side of the resistor you will have the load voltage \$V_{load} = V_{C1}\$ and on the left side of the resistor you will have \$V_{load} + V_{R1}\$.
This means, that the voltmeter M1 will measure the voltage drop over the resistor \$V_{R1} = R_1 \cdot I_R\$.
You should be aware, that you want to choose your shunt quite small to reduce power losses and heating of the resistor. This will make the voltage drop quite low, so you will need a sensitive voltage measurement.


text:
Q: Python: Extracting Set of Values from JSON I have a set of data I am pulling from an API for stock market history. The history is then stored in a file "history.json". I need to get all recurring sets of the key "4. close". There are between 100 days & 10 years of data in a call. The data is formatted like so:
{
    "Meta Data": {
        "1. Information": "Daily Prices (open, high, low, close) and Volumes",
        "2. Symbol": "SPY",
        "3. Last Refreshed": "2018-01-10",
        "4. Output Size": "Compact",
        "5. Time Zone": "US/Eastern"
    },
    "Time Series (Daily)": {
        "2017-08-18": {
            "1. open": "242.9000",
            "2. high": "244.1900",
            "3. low": "242.2000",
            "4. close": "242.7100",
            "5. volume": "136748000"
        },
        "2017-08-21": {
            "1. open": "242.6400",
            "2. high": "243.2000",
            "3. low": "241.8300",
            "4. close": "242.9000",
            "5. volume": "65469700"
        }

Preferably I would like the output in order as a list with the values excluding the keys as a list. It can be called into memory or converted into another file to open - it does need to retain order as it will be used sequentially in the algorithm. (I try to figure things out on my own, I am new to programming though so if you could simplify things as much as possible I would appreciate it.)

A: Michael
You can ckeck this url https://docs.python.org/2/library/json.html
With the function "loads" you can parse your json and you get a list as return
I hope it helps

A: One can consider this data as nested dictionaries and use it:
outlist = [v["4. close"]   for v in mydict["Time Series (Daily)"].values()]
print(outlist)

Output:
['242.7100', '242.9000']

Data:
mydict = {
    "Meta Data": {
        "1. Information": "Daily Prices (open, high, low, close) and Volumes",
        "2. Symbol": "SPY",
        "3. Last Refreshed": "2018-01-10",
        "4. Output Size": "Compact",
        "5. Time Zone": "US/Eastern"
    },
    "Time Series (Daily)": {
        "2017-08-18": {
            "1. open": "242.9000",
            "2. high": "244.1900",
            "3. low": "242.2000",
            "4. close": "242.7100",
            "5. volume": "136748000"
        },
        "2017-08-21": {
            "1. open": "242.6400",
            "2. high": "243.2000",
            "3. low": "241.8300",
            "4. close": "242.9000",
            "5. volume": "65469700"
        }}}


text:
Q: Outlook add-in to launch when using File Explorer Send to - Mail Recipient I have a Outlook add-in that adds visual things to the email compose window and then catches the send-event, does stuff, and then let Outlook send or cancel it.
Works fine, but if I use the send file option from explorer, without outlook running, it will not start the add-in. The window is missing all the added UI elements. When I click send button it will start the add-in. I get a welcome screen we coded and it starts logging the add-in startup debug messages.
But it will not catch the send event or do anything else for that matter. The last log message shows init was completed. The Outlook process will be left in the task manager. If I open Outlook after that I will see that the email I sent is in outbox. Without any modifications the event handler would have done.
Is there anyway to get add-into run in this use case?

A: Looks like this problem was because I had only run the project in debug mode from Visual studio. I had never installed it from the package.
Once I had ran the installer it begun to start the add-in as soon as I chose "send to mail recipient" thus fixing the problem.


text: Q: I have a multiple print options in a page but i need a diiferent page sizes for each print I am using reactjs, I have a multiple print options in my code but i need a diiferent page sizes for each print, so how can i switch to the different page sizes when i click on that button


text:
Q: How to make a receiver on Android phone? I want to implement an receiver on Android system(android phone/android pad)
I find an app  "CastReceiver" can do this.  so I try to reverse,but the important method its write with c++,on libAirReceiver.so,it's  hard to reverse. I try three days and forgive it.
so, I try to make an app ,step by step. First step, this app register the Googlecast mdns service,but I can't find my devices use chrome on my Mac. but I use "dns-sd -B _googlecast",it show in the list.
code here:
    manager = (NsdManager) getSystemService(Context.NSD_SERVICE);
        String type = "_googlecast._tcp.";
        NsdServiceInfo info = new NsdServiceInfo();
        info.setServiceType(type);
        info.setServiceName("TEST");
        info.setPort(8008);
        String str2 = UUID.randomUUID().toString().replaceAll("-", "");
        info.setAttribute("id", str2);
        info.setAttribute("bs", "C09A71866E39");//MAC
        info.setAttribute("ca", "4101");
        info.setAttribute("cd", str2);
        info.setAttribute("fn", "TEST");
        info.setAttribute("ic", "/setup/icon.png");
        info.setAttribute("md", "Receiver");
        info.setAttribute("nf", "1");
        info.setAttribute("rm", "");
        info.setAttribute("rmodel", "Receiver");
        info.setAttribute("rs", "");
        info.setAttribute("st", "0");
        info.setAttribute("ve", "05");
        manager.registerService(info, PROTOCOL_DNS_SD, getListener());

anyone has idea how to build this app? help~

A: Just in case it helps somehow, libAirReceiver.so works with an AIDL that you can find in same apk:
package com.softmedia.receiver.app;

import com.softmedia.receiver.app.AirReceiverAPICallback;

interface AirReceiverAPI {
    void setOpenDialFriendlyName(String name);
    String getOpenDialFriendlyName();
    void setOpenDialEnable(boolean isEnable);
    boolean isOpenDialEnable();

    void setCastFriendlyName(String name);
    String getCastFriendlyName();
    void setCastEnable(boolean isEnable);
    boolean isCastEnable();

    void setRendererFriendlyName(String name);
    String getRendererFriendlyName();
    void setRendererEnable(boolean isEnable);
    boolean isRendererEnable();

    void setAirPlayDeviceName(String name);
    String getAirPlayDeviceName();
    void setAirPlayEnable(boolean isEnable);
    boolean isAirPlayEnable();
    void setAirPlayPassword(String password);
    String getAirPlayPassword();
    boolean isAirplayBlockNewConnection();
    void setAirplayBlockNewConnection(boolean enable);
    boolean isAirPlayConnected();
    boolean isUsingSystemMediaPlayer();

    void setPlaybackPlayerSetting(int playerSetting);
    int  getPlaybackPlayerSetting();

    void setAirMirrorResolution(int resolution);
    int  getAirMirrorResolution();
    void setAirMirrorOrientation(int orientation);
    int  getAirMirrorOrientation();

    void setAirMirrorRecordEnable(boolean isEnable);
    boolean isAirMirrorRecordEnable();
    void setAirMirrorRecordAudioEnable(boolean isEnable);
    boolean isAirMirrorRecordAudioEnable();
    void setAirMirrorRecordPath(String path);
    String getAirMirrorRecordPath();

    void setAirTunesAudioLatency(int latency);
    int  getAirTunesAudioLatency();
    void setHideAirTunesUI(boolean isEnable);
    boolean isHideAirTunesUI();

    void setUseMediaCodec(boolean isEnable);
    boolean isUseMediaCodec();

    void setHideNotification(boolean isEnable);
    boolean isHideNotification();

    void setCallback(AirReceiverAPICallback callback);
}

And the callback:
package com.softmedia.receiver.app;

interface AirReceiverAPICallback {
    void onCastInvalidSystemTime();
    boolean onCastSessionAccept(String ip);
    void onCastSessionStarted(String ip);
    void onCastSessionEnded();
}

I am actually interested on having an implementation working in a multiplatform way, but a trick should be there that I don't know as looking at internet what I saw out there is that a certificate is needed.. And obviously I don't have it..


text:
Q: AxaptaContainerWrapper Class .net AX 2009 I would like to use AxaptaContainerWrapper object in .net c#. I don't understand documentation on MSDN web site (http://msdn.microsoft.com/en-us/library/cc519742%28v=ax.50%29.aspx).
AxaptaContainerWrapper axCon;
string ret2 = "axCon";

axCon.Insert(1, ret2);

In VS 2008 I get error Use of unassigned local variable axCon
Why?

A: You should use axaptaWrapper.CreateAxaptaObject() method: msdn
AxaptaWrapper aw= SessionManager.GetSession();
AxaptaObjectWrapper aow= ax.CreateAxaptaObject("??");

A: I wrote code below and I haven't any errors. I have to make all report to test it
     AxaptaWrapper ax = SessionManager.GetSession();
    AxaptaObjectWrapper axClass;

    AxaptaContainerWrapper axCon = ax.CreateAxaptaContainer();


text:
Q: Why does the method of undetermined coefficients always work? To put things into perspective I've read some posts with the method of undetermined coefficients in it for differential equations. What I'm talking about is the method to determine a closed formula for a sequence. For those of you who are unfamiliar with it I'll try to explain it.
E.g.:
$$0, 2, 5, 9, 14,\ldots$$
$$2, 3, 4, 5,\ldots$$
$$1, 1, 1,\ldots$$
The $1^{st}$ sequence (it also can be a different sequence of course, this is just an example) is always given in an exemplary exercise (in my case I found it myself, just by the brute-force method). The $2^{nd}$ one is acquired by subtracting the number in the 1^{st}sequence by the following number of that sequence. And one is required to stop this algorithm after it get a constant sequence like in the $3^{rd}$ one.
So now one has performed the algorithm two times. Thus concluding we need a polynomial of degree 2. Now let's take a random polynomial of which we need to determine the coefficients:
$$P(x)= ax{^2} + bx + c$$
We know that $P(0)= 0,P(1)= 2$and $P(2)= 5$ .
So $\begin{cases} c= 0 \\ a + b =2 \\ 4a + 2b =5\\ \end{cases}$ which gives us that $P(x)= \frac 12 x^2 + \frac 32 x  $
To rephrase my question from early on:

Why does the method of coefficients work for every the simpler sequences as stated above? Does there exist a proof of it? Please explain that proof to me?

PS.:
1) I know that it doesn't work for sequences whose solutions aren't reals or if there are multiple solutions of such a P(x). Then you need to work with generating functions.
2) I've chosen this sequence on purpose because it's the sequence to determine number of diagonals of a convex polygon. Just for those who wondered about it.


text:
Q: Flutter Error Message Bottom overloaded by 45 pixels I want to create a login screen using Flutter.
This is my code so far:
Future showInformationDialog(BuildContext context) {
TextEditingController name = TextEditingController();
TextEditingController deadline = TextEditingController();
return showDialog(
    context: context,
    barrierDismissible: false,
    builder: (BuildContext context) {
      return AlertDialog(
        title: SingleChildScrollView(
          physics: NeverScrollableScrollPhysics(),
          child: Form(
            child: Column(
              children: <Widget>[
                TextFormField(
                  controller: name,
                  maxLength: 40,
                  textAlign: TextAlign.left,
                  keyboardType: TextInputType.text,
                  autocorrect: false,
                  decoration: InputDecoration(
                    labelText: 'Name der Klausur: ',
                    border: OutlineInputBorder(),
                  ),
                  // The validator receives the text that the user has entered.
                  validator: (value) {
                    if (value.isEmpty) {
                      return 'Gib den Namen der Klausur ein!';
                     }
                     return null;
                   },
                ),
                SizedBox(height: 20),
                TextFormField(
                  controller: deadline,
                  maxLength: 8,
                  textAlign: TextAlign.left,
                  keyboardType: TextInputType.datetime,
                  autocorrect: false,
                  decoration: InputDecoration(
                    labelText: 'Deadline: ',
                    border: OutlineInputBorder(),
                  ),
                  // The validator receives the text that the user has entered.
                  validator: (value) {
                    if (value.isEmpty) {
                      return 'Gib das Datum der Klausur ein!';
                    }
                    return null;
                  },
                ),
                SizedBox(height: 20),
                DropDownFormField(
                  titleText: 'Priorität',
                  hintText: 'Bitte auswählen',
                  value: '',
                  dataSource: [
                    {
                      "display": "Niedrig",
                      "value": "Niedrig",
                    },
                    {
                      "display": "Mittel",
                      "value": "Mittel",
                    },
                    {
                      "display": "Hoch",
                      "value": "Hoch",
                    },
                  ],
                  textField: 'display',
                  valueField: 'value',
                  ),
                SizedBox(height: 20),
              ],
            ),
          ),
        ),
        actions: <Widget>[
          FlatButton(
            onPressed: () {
              return showDialog(
                context: context,
                builder: (context) {
                  return AlertDialog(
                    content: Text(name.text),

                  );
                }
              );
            },
            child: Text('Save'),
            color: Colors.blue,
          ),
          FlatButton(
            onPressed: () {
              return showDialog(
                context: context,
                builder: (context) {
                  return AlertDialog(
                    content: Text(deadline.text),
                  );
                }
              );
            },
            child: Text('Save'),
            color: Colors.blue,
          ),
        ],
      );
    });
}

When the keyboard opens, it collides with the textfields -> I get an error:
Bottom overflowed by 49 pixels.
What could be the issue?

I have tried everything but I got stuck here.
SingleChildScrollView or resizeToAvoidBottomPadding: false didnt help me. Maybe I don't know how to use them correctly.
For any help I would be happy.

A: Is it me, or can't I find the code for your login screen? The error is thrown because there isn't enough place for your widget on the screen. Are you using a ListView or a Column? With a ListView you can scroll so if there isn't enough room for the content the user can scroll down to see what isn't on the screen.


text:
Q: Problem with jQuery SpinBox Plugin Dynamic Min/Max I am using the jQuery SpinBox plugin (from http://plugins.jquery.com/project/spinbox) on some text boxes on my form. But I have come across a problem. Some of these textboxes need to have their min/max properties set dynamically when the values of other fields are changed. I have tried doing something like this:
$("#tbxDelayEndDate").spinbox({min : $("#tbxDelayStartDate").val()});

But the problem is that clicking the up/down buttons causes erratic behaviour.
How can I change the max and min properties without this happening?
EDIT: Or can anyone give me an example of one spinbox constrained by the value of another?
I don't want to have to use a different plugin.
Thanks.
James

A: Before changing its min/max, you have to call the following statement to unbind/remove all related event/class of the spinner.Therfore, the codes that changed the min will be like this
$("#tbxDelayEndDate").spinbox("destroy");
$("#tbxDelayEndDate").spinbox({min : $("#tbxDelayStartDate").val()});

However, I find out that there is a bug in the source code of the plugin.Therefore you need to do the following first.
Search the follwing text in the source code of the plugin.
// Tidy up when spinbox('destroy') is called:
        if (options && typeof (options) === "String" && options === "destroy")

Replace the above with
 if (options && typeof (options) === "string" && options === "destroy")

"String" should be "string".


text:
Q: Is it possible to write Impala UDAF using existing class implementation I have a C++ implementation of a class for aggregate calculation on a list of items. I need to do the same calculation on a dataset stored in Hadoop using impala. I was planning to write an UDAF to do the calculation. Is it possible to use the existing class implementation to write update and merge functions?
I have seen few examples in here : https://github.com/cloudera/impala-udf-samples/blob/master/uda-sample.cc. However, none of the examples use an object to store intermediate results.


text:
Q: InAppPurchase transactionReceipt environment value in production When I test In App purchases and I decode transactionReceipt from SKPaymentTransaction, I see a field named "environment"
"environment" = "Sandbox";

Can anyone tell me the value from the production?
Thanks a lot!

A: Well as far as i know and based on apple Documentation  .. In Production you will not have this key .. because you are not responsible to do anything with it ,, its just an indication that you are using sandbox when your app will be submitted for production, reviewed and approved, this value will not appear.


text:
Q: ANSI C No-echo keyboard input I've been Googling around with no luck.  I'm looking for a way to do getc() or gets() or whatever that does not echo to the terminal.  I saw kbhit() but this doesn't appear to be part of ANSI.  Ideally, I'd like code that looks like
char s[100];
no_echo_gets(s); /* Won't echo to screen while being typed */
printf("%s\n", s);

Does anybody know a good ANSI compliant way to do this?

A: The getpass command is present in Linux. But you can make a prettier version, the system echo alone doesn't kill the need for an enter command, while knocking down buffering doesn't kill the production of a carraige return after data entry.  Combining the two gives a good approximation of a quiet entry. You can add an asterisk to give a secret entry appearance so here is a combination of two suggestions:
    #include <stdio.h>
    #include <termios.h>
    #include <unistd.h>
    int getche(void);
    int main(int argc, char **argv){
    int i=0;
    char d,c='h',s[6];
    printf("Enter five secret letters\n");
    s[5]='\0'; //Set string terminator for string five letters long
    do{
      d=getche();//Fake getche command silently digests each character
    printf("*");
      s[i++]=d;} while (i<5);
    printf("\nThank you!!\n Now enter one more letter.\n");
    c=getchar();
    printf("You just typed %c,\nbut the last letter of your secret string was %c\n",c,d);
    printf("Your secret string was: %s\n",s);
        return 0;
    }
    /* reads from keypress, echoes */
        int getche(void)
        {
            struct termios oldattr, newattr;
            int ch;
            tcgetattr( STDIN_FILENO, &oldattr );
            newattr = oldattr;
            newattr.c_lflag &= ~( ICANON | ECHO);\\knock down keybuffer
            tcsetattr( STDIN_FILENO, TCSANOW, &newattr );
            system("stty -echo");\\shell out to kill echo
            ch = getchar();
            system("stty echo");
            tcsetattr( STDIN_FILENO, TCSANOW, &oldattr );
            return ch;
        }

A: Maybe you can try like this:
#include<stdio.h>
char s[100];
system("stty -echo");
scanf("%s",s); /* Won't echo to screen while being typed */
system("stty echo");
printf("You have entered:");
printf("%s\n", s);
return 0;
}

In Linux, the system function "stty -echo" is to type in sth without echo. Hope this will help.

A: You can't do it in a cross-platform manner using ANSI C.  You'll have to use some OS-specific code, or use a library such as ncurses.

A: Since your task is fairly basic, if you're lucky your system will have the getpass() function:
char * getpass(const char *prompt);

If you don't want a prompt, just do:
char *s = getpass("");
if (s != NULL)
    printf("Your password was %s!\n", s);

getpass(), like all C functions related to echo and buffering, is non-standard, but present on Mac OS X, probably Linux, and is listed in the GNU C library, so it's probably present on any system using glibc.
The ANSI and ISO standards, as stated previously, do not specify a standard way to read input without echoing, or to read unbuffered input (i.e. on character at a time).

A: For UNIX-like systems you want to play with the ECHO flag...
#include <termios.h>
...
struct termios t;
tcgetattr(fd, &t);
t.c_lflag &= ~ECHO;
tcsetattr(fd, TCSANOW, &t);
...

A: There isn't one; neither ANSI C nor ISO C++ have such a thing.

A: This will depend on your environment, it is not something that the language provides. If you intend to do extensive character mode I/O, you might look into a library like curses. Otherwise, you will have to manipulate the terminal or the windows console manually.

A: ANSI and ISO C do not define this functionality, however most C compilers have getch() or a close variation.
You'll need to do a preprocessor define for each compiler you're using that has a different library and function for this.  It's not difficult, though you might consider it annoying.
-Adam


text:
Q: Query for date groupings? I have a Client table with basic demographics in rows and a date of birth row (DOB) with a DATE data type.
I'm trying to make a query that will take my entries and count how many clients are between the ages of 18-60, 61-79, 80+.  I'm not sure if I'm having a brain-fart, but I can't figure out how to gather that info from my table...
So what I have is:
Last Name   First Name   DOB
Stein      Ethel       1954-01-20
Frank      Sam         1981-05-65
etc...

What I want to have is:
Ages 18-60
6
Ages 61-79
10
Ages 80+
20

Any recommendations to proceed?

A: Using @Alex's suggestion
declare @today datetime
set @today =getdate()

select
 s as [start],
 e as [end],
count(1) as [count]
from Client join
(values (0,17),(18,60),(61,79),(80,9999)) as ranges(s,e)
  on datediff(yy,dob,@today) between s and e
-- where buildingid=1
group by s,e

See demo here


text:
Q: How to fetch top n records for each category I have a table like below, placed at SQL FIDDLE
id  empid proj  file  rating
~~  ~~~~~ ~~~~  ~~~~  ~~~~~~
1   1863   G1   file1    1
2   P4645  G1   file2    1
3   P6682  G1   file3    1
4   P6682  G1   file4    1
5   P4645  G1   file5    1
6   P4645  G1   file6    1
7   1863   G1   file7    1
8   1863   G1   file8    1
9   1863   G1   file19   1
10  P6682  G2   file21   1
11  1863   G2   file55   1
12  P6682  G2   file60   1
13  P4645  G2   file85   1
14  P6682  G2   file91   1
15  P4645  G2   file93   1
16  P4645  G3   file95   1
17  P4645  G3   file100  1
18  P4645  G3   file125  1
19  1863   G3   file131  1
20  1863   G3   file150  1
21  P6682  G3   file193  1
21  P6682  G3   file193  1

I need an SQL to retrieve top n (say top 2) ratings count from the above table for each category (proj)
Desired OP as below
proj  empid  ratings
~~~~  ~~~~~  ~~~~~~~
 G1   1863      4
 G1   P4645     3
 G2   P6682     3
 G2   P4645     2
 G3   P4645     3
 G3   1863      2
 G3   P6682     2

Tried to follow the meathod in this thread but could not achive from the table desing i have.

A: Try this query
select * from
(select @rn:=if(@prv=Proj, @rn+1, 1) as rId,
@prv:=Proj,
empid,
stars
from
(SELECT
          starRatings.Proj
        , starRatings.empid
        , count(*) as stars
    FROM achivement as starRatings
    group by starRatings.Proj,starRatings.empid
order by proj, stars desc)a
join
(select @rn:=0, @prv:='') tmp
)tmp where rid <= 2

SQL FIDDLE
select * from
(select @rn:=if(@prv=Proj, if(@prvv=stars, @rn, @rn+1), 1) as rId,
@prv:=Proj,
empid,
@prvv:=stars
from
(SELECT
          starRatings.Proj
        , starRatings.empid
        , count(*) as stars
    FROM achivement as starRatings
    group by starRatings.Proj,starRatings.empid
    order by proj, stars desc)t
join
(select @rn:=0, @prv:='', @prvv:=0) tmp
)tmp where rid <= 2

SQL FIDDLE:
| RID | @PRV:=PROJ | EMPID | @PRVV:=STARS |
-------------------------------------------
|   1 |         G1 |  1863 |            4 |
|   2 |         G1 | P4645 |            3 |
|   1 |         G2 | P6682 |            3 |
|   2 |         G2 | P4645 |            2 |
|   1 |         G3 | P4645 |            3 |
|   2 |         G3 |  1863 |            2 |
|   2 |         G3 | P6682 |            2 |

A: Use this:-
(
  select proj,empid,rating,count(rating)
  from achivement
  where `proj` =  'G1'
  group by empid
  order by count(rating) desc
  LIMIT 2
)
UNION ALL
(
  select proj,empid,rating,count(rating)
  from achivement
  where `proj` =  'G2'
  group by empid
  order by count(rating) desc
  LIMIT 2
)
UNION ALL
    (
      select proj,empid,rating,count(rating)
      from achivement
      where `proj` =  'G3'
      group by empid
      order by count(rating) desc
      LIMIT 2
    )

SQL FIDDLE
Screenshot


text:
Q: PayPal IPN $_POST['txn_id'] not set I'm using the PayPal sandbox to do a subscribe button and then when I get the IPN response for a subscription or a subscription cancelation $_POST['txn_id'] is never set.
So I don't know how to identify transactions to only accept unique ones
Thanks!
EDIT: for example all the info that I have in POST for a subscr_cancel are : amount1, amount3 , address_status, subscr_date,  payer_id, address_street, mc_amount1, mc_amount3, charset, address_zip, first_name, reattempt, address_country_code, address_name, otify_version
subscr_id
custom
payer_status
business
address_country
address_city
verify_sign
payer_email
btn_id
last_name
address_state
receiver_email
recurring
txn_type
item_name
mc_currency
residence_country
test_ipn
period1
period3
correlation_id

A: According to Table 2. Summary of subscription variables:

For subscription variables, the transaction ID (txn_id) is only available for USD Payment and
  Multi-Currency Payment transaction types (txn_type).

As expected, PayPal will not send the txn_id to your IPN for the transaction type, subscr_cancel, and will only send txn_id if the transaction type is subscr_payment.
For further explanation on which variables are sent to your IPN URL based on your transaction, please check out IPN and PDT Variables.

A: Have you checked $_REQUEST['txn_id'] as this may be sent to your server via GET.