How can i split an array into a nested array by splitting each element?

Question: My question may not make sense, but after trying all kinds of array_chunk, and explodes, I can't seem to find an easy way to solve my issue.
Ultimately, I have a textarea that I want to be able to enter data like this:
<textarea>
    Song 1 by Artist 1
    Song 2 by Artist 2
    Song 3 by Artist 1
    Song 4 by Artist 3
    Song 5 by Artist 3
</textarea>

I want to ultimately create an array that I can filter and loop out, and grab each song title and artist title, and have a nested array.
So far, I can use explode( "\n", $source) to create a simple array:
array (size=5)
  0 => string 'Song 1 by Artist 1' (length=19)
  1 => string 'Song 2 by Artist 2' (length=19)
  2 => string 'Song 3 by Artist 1' (length=19)
  3 => string 'Song 4 by Artist 3' (length=19)
  4 => string 'Song 5 by Artist 3' (length=18)

But I want to now further create an array inside this for each song title and artist title so it will look like:
array (
  0 => array(
    'title' => 'Song 1',
    'artist' => 'Artist 1
  ),
  1 => array(
    'title' => 'Song 2',
    'artist' => 'Artist 2
  )
  etc.

How can I expand the initial explode function to be able to loop out the final array values as a list?
Comment: Is the user guaranteed to input that exact format every time?
Comment: Yes, this format will always be this. The user will be myself, and a small group of members who I can instruct how to enter. A placeholder on the textarea will also help.
Answer: Here I use  functional in PHP to extract data
$arrays = [
    "Song 1 by Artist 1",
    "Song 2 by Artist 2",
    "Song 3 by Artist 1",
    "Song 4 by Artist 3",
    "Song 5 by Artist 3",
];
$result = [];

array_walk($arrays, function ($data) use (&$result) {
    $fields = explode(' by ', $data);
    $result[] = [
        "title"  => $fields[0],
        "artist" => $fields[1],
    ];
});

print_r($result);

Answer: $songList = explode( "\n", $source);

foreach($songList as &$value) {
    $interim = explode(" by ", $value);
    $value = ['title' => $interim[0], 'artist' => $interim[1]];
}

Answer: Then you need split by $row = explode(' by ', $array) with code
$mainArray = explode("\n", $text);
$list = [];
foreach ($mainArray as $oneRow) {
    $row = explode(' by ', $oneRow);
    $list[] = [
        'artist' => $row[1],
        'title' => $row[0]
    ];
}

Answer: Here you go
$arr = explode("\n", $string);
foreach ($arr as $item) {
    $set = explode(" by ", $item);
    $result[] = array_combine(["title", "artist"], $set);
}
var_dump($result);


Add module .C to linux kernel

Question: good afternoon, I have a problem and I could not solve it, I try to add a .c module to the linux kernel, it's just a .c file called
Stealth.c I have tried to find guides on how to add it step by step but I can not find it by any means, I am not very familiar with the kernel,
thanks for your help
Comment: Stack Overflow neither helps to locate *guides* on other resources nor creates guides (except ones on [SO documentation](http://stackoverflow.com/documentation)). You may start with documentation shipped with kernel sources. E.g. using one at [Documentation/kbuild/makefiles.txt](http://lxr.free-electrons.com/source/Documentation/kbuild/makefiles.txt) you may understand how to add source file into the kernel build process.
Answer: Assuming you put this file is somewhere in your kernel source tree, the directory it's in should have a Makefile. Add the line
obj-y += Stealth.o
If you want to deal with configuration, you'll probably want to add the object file to obj-$(CONFIG_WHATEVER) instead of obj-y, but I won't be going into how to add a configuration here.
If you're looking to compile your file as an external module, a quick google search pops http://www.tldp.org/LDP/lkmpg/2.6/html/x181.html which seems good enough.

Add module .C to linux kernel


How do I make a app in Quickly and play a sound when a button is clicked in the app?

Question: Is there anyway I can make an application in which a button made in Glade can be clicked to play a custom re-definable sound?
Answer: You would need to connect the 'activate' signal of the button  to a handler function that then calls a library to play a sound.  For the sound playing part you can use any of the modules listed here
In glade select the button then choose signals and enter a name for the function handler:

Then in your python code for the window, create the function (on_iconbutton_activate in my example). Here's an example that just makes a system call to ring a bell:
import os
....otherstuff...

def on_iconbutton_activate(self,widget,data=None):
    os.system("/usr/bin/canberra-gtk-play --id='bell'")

EDIT: To make the sound redefinable, you'll need to pull the choice from somewhere. Just use a variable to store the choice (a filename for some module or id for canberra-gtk-play), you can store the variable in something like self.sound and reference it in the function (since you passed self to it), or update the variable from some widget when the button is clicked.


How to check if the git branch is newly created or not?

Question: Is there is a way to check if the git branch is newly created
For example

git checkout master
git checkout -b feature

I have a requirement that I need to identify that a given branch is brand new where there is no new commits on it, just like feature branch created above.
for example: let take bug_fix branch which is created out of master and committed some code into it. Suppose I am not aware of that commits, I should be able to fire some commands and after it, I should be able to know that it has some commits that were made after it was created out of master branch.
Ultimately I need to verify it in .gitlab-ci.yml file, is there predefined variable to check it ?
Any other alternative is also welcome. Thanks in advance for dropping by.
Comment: Is your definition of "brand new" that "it must not have commits on it only available through this branch"?
Comment: I ask because if I create a branch today, on master, and leave it there for one year, never committing anything to that branch. Is that branch still "brand new"?
Comment: Have you tried to look up in the browser ? Or you are searching for some command line (bash style)? https://docs.gitlab.com/ee/user/project/repository/branches/
Comment: @LasseV.Karlsen At the moment when I check it should not contain any new commits, later it can have commits as a usual branch.
Comment: @Danizavtz yes i did, normally i couldn't find as of now
Comment: What I meant was to ask if the "brand new" definition had anything to do with the age of the branch, or whether it was purely based on the fact that it contained commits or not.
Comment: To see if a branch has commits on it that aren't in master you can execute `git log master..branchname`. But if you first create a new branch, check it out, apply 2 commits on it, and then create yet another branch now, the git log command I just showed will tell you that both branches contains commits not on master. It depends on whether you consider the latest branch there "brand new" based on the relationship with master or based on the relationship with any branch. Please think hard and carefully on your exact definition of "brand new".
Answer: In the example you give, the merge-base of master and feature is identical to feature. So that gives you a template for identifying these situations.
Comment: yes you are correct, but how can i verify merge-base though commands. is it possible to check in existing branch as in gitlab i will not be able to checkout on other branch and do some git commands
Comment: I didn't understand any of those words, sorry.
Comment: @AnandKumar can you rephrase the second sentence in your comment? Are you trying to lock something down based on commits existing on a feature branch?
Comment: when the pipeline trigger (via gitlab-ci) it only works on existing branch.. so being on the same branch (git checkout is not an option) can we figure out whether there is any new commits after the branch was created? Also as it is going to be implemented in the gitlab-ci.yml file, verifying commit by looking the logs for parent branch and the feature branch is not an option to me... sorry for my english.. I hope i am able to explain you what i am trying to say.. but thanks for showing interest.
Answer: Gitlab specific:
# First commit of the branch.
- if: $CI_COMMIT_BEFORE_SHA == '0000000000000000000000000000000000000000'
when: on_success

If this is the creation of a new branch the $CI_COMMIT_BEFORE_SHA variable will be what you see above.


Radio buttons clear in angular js

Question: I have 2 radio buttons,

radio1: Male, radio2: Female

When we click on male button, one text box appears and we can write name in it,and also when we click on female new text box appear and we can write name.
But my issue is when I click on male or female buttons, its value does not clear automatically.
How to clear values on click of radio buttons, so that everytime radio is pressed empty text box appears.
Comment: Share some code (what have you tried so far) in order for people to be able to help you.
Comment: Possible duplicate of [Radio button is not working properly](https://stackoverflow.com/questions/19710804/radio-button-is-not-working-properly)
Comment: its not duplicate, jst read what i am trying to tell
Comment: @tom Showing us the current code is pretty much a bare minimum requirement for SO questions.
Answer: If I correctly understand the problem, think this is your answer
<input type="radio" ng-model="value" value="foo" ng-change='clearValue()'>
<input type="text" ng-model="name">

and then, in a controller:
$scope.clearValue = function() {
     $scope.name = '';
}

Comment: yes quiet similar,

two radio buttons, one text box, bt ciking on any radio button, value of text box gonna clear
Comment: What is the difference? why 'quiet'??@tom

Radio buttons clear in angular js


PyCharm crashes on README.md files (on Linux in Docker)

Question: Running PyCharm 2023.1.1 (Community Edition) on Linux in Docker, I get the following error when trying to edit .md files like README.md:
 [0628/172358.898878:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /pycharm-community-2023.1.1/jbr/lib/chrome-sandbox is owned by root and has mode 4755.

Trace/breakpoint trap (core dumped)

Answer: As root in the docker container:
# chown root:root /pycharm-community-2023.1.1/jbr/lib/chrome-sandbox
# chmod 755       /pycharm-community-2023.1.1/jbr/lib/chrome-sandbox
# chmod u+s       /pycharm-community-2023.1.1/jbr/lib/chrome-sandbox


NURBS knot multiplicity

Question: In Splitting of NURBS curves there the answer relied on "maximum knot multiplicity". In order not to mix-up different topics I would like to kindly ask to answer it in another question: what is this "knot multiplicity" all about?
Answer: When you have a curve you can adjust the knots so that they lie on top of each other. This is essentially a bit like having several control points on top of each other, except there's only one point. This is sometimes known as multiplicity or duplicity.
When you have as many knots on top of each other as you have degrees in the curve smoothness, you end up with a cusp, also known as as sharp corner. Once you have a sharp corner you can just go and delete the points on the opposite side as they no longer affect points no the other side of the corner.

Image 1: Curve and control cage (Top) and basis functions (bottom). In this case the curve acts as 2 adjoining bezier curves, The image is using the knot vector [0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2].
If we look at a knot vector then the multiplicity looks like a seqence of n knots that have the same number. Note if you do not add ecactly as many knots on top as there is smoothness then you get a partially sharp corner.

Image 2: Animation with interpolation of knot form [0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2] to  [0, 0, 0, 0, 0.34, 1, 1.66, 2, 2, 2, 2] and back. If you do proper point insertion then the curve does not change. Just talking about what multiplicity is.
Alternatively to changing parametrization you can just add points on top of each other. This is equivalent although slight misuse of resources, but useful in surface modeling. Having many control points on top could also be useful for the uniform nature of the knot distribution.
Comment: When you say "knots lie on top of each other", you mean that their values don't change in the knot vector? So in your example [0, 0, 0, 0], [1, 1 ,1], [2, 2, 2] all "lie on top of each other"?
Comment: @EcirHana yes that is what i mean a more normal parametrisation would be [0, 0, 0, 0, 0.5, 1, 1.5, 2, 2, 2, 2] Ill add a animation
Comment: Just to check: so to split a NURBS curve the main task is to insert knots so that the overall shape remains unchanged, correct?
Comment: Yes, once you have enough knots you can delete whats on the other side.
Comment: There is a different strategy also you can insert one knot and delete the points that nolonger affect the knot you get a slightly different parametrisation though. I prefer this method for most of my own modeling. But nobody else seems to have heard of this.
Comment: Out of curiosity, what kind of modeling software do you use? Or you mean in your own code?
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/27460/discussion-between-joojaa-and-ecir-hana).
Comment: "adjust the knots so that they lie on top of each other. This is essentially a bit like having several control points on top of each other" -- Well maybe it's a bit similar, but not much. Making control points coincident will cause derivative vectors to be zero, which leads to all sorts of problems. Making knots coincident is benign.
Comment: > you end up with a cusp -- you have the *potential* for forming a cusp, but you won't necessarily get a cusp.
Comment: @bubba yes its possible to fit on the other side, and yes if you have multiple knots on top you loose some of the interpolant to no movement, anything outside this area is same.

NURBS knot multiplicity


I can't download/install Ubuntu

Question: I want to download and install the 32 bit version over my desktop running XP.  The file that it downloads is called
      ubuntu-13.10-desktop-i386.iso
It is from ftp.citylink.co.nz, and it is 895 MB.
Windows has no idea what to do with a .iso file, and neither do I.  I certainly can't double click on it and run anything.
Comment: Follow the instructions in the linked Q&A - you need to use burning software to write the  image to DVD or via USB - http://askubuntu.com/questions/16988/how-do-i-install-ubuntu-to-a-usb-key
Answer: You shouldn't download a file from an unknown source. Instead, go to https://www.ubuntu.com to get the download file. (If you're here I assume you trust the .ubuntu.com TLD).

I can't download/install Ubuntu


CSS "height: 100%;" not taking into consideration siblings with height, leading to unnecessary overflow

Question: I have a div of height 100%. Inside that div, there are two children: an  and another
. The child
 also has a height of 100%. I expected setting the child div's height to 100% would make it fill up the remaining height, not copy the height of the parent element and disregard fellow children leading to unintended overflow.
Example: https://codepen.io/gamepro5/pen/Jjpaqva (why is the child class in this example overflowing it's parent with a height of 100%?)

html {
  height: 100%;
}
a {
  display: block;
  text-align: center;
}
body {
  margin:0;
  width:100%;
  height: 100%;
}
.parent {
  width: 75%;
  background-color: red;
  height: 100%;
}
.child{
  height: 100%;
  width: 75%;
  background-color: green;
  /*would need to do a calc of 100% minus whatever the height of the  tag is, but that is annoying to do since the height of the other items can change. */
}
.child p {
  text-align: center;
}

      Daddy Potato (king of all potatoes):

Potatoe

Potatoe

Potato

Potate

Ube

I simply want the child div to fill up the remaining available space with it's height without overflowing.
Comment: `height:100%;` indeed means "same as the entire inner height of the container", regardless of sibling elements - that's how legacy CSS flow works.

If you want a flexible layout that can be aware of the container and siblings and fill gaps in, you would have to use either a flex or a gird layout.
Answer: You can achieve this with flex: Set display: flex and flex-flow: column; on the parent element, and on the child set flex-grow: 1;

html {
  height: 100%;
}
a {
  display: block;
  text-align: center;
}
body {
  margin:0;
  width:100%;
  height: 100%;
}
.parent {
  width: 75%;
  background-color: red;
  display: flex;
  flex-flow: column;

  height: 100%;
}
.child{
  flex-grow: 1;
  width: 75%;
  background-color: green;
}
.child p {
  text-align: center;
}

      Daddy Potato (king of all potatoes):

Potatoe

Potatoe

Potato

Potate

Ube

Comment: If the child div is also a flexbox, when it comes time for that box to start wrapping the elements inside it, it will ignore your fix and use cause the same scrolling issue. It refuses to start wrapping when there is no space left with respect to the sibling. Instead, it only starts wrapping when the window is under 100% the height of it's parent. Any way to fix that if the child div is also display: flex;?
Comment: Simply by adding another wrapper, so your child will have a flex-grow, and the child of the child will have a display: flex;
Comment: This doesn't work when the height of the sibling in question has to be precisely set
Comment: @JohnMiller there is nothing in the question that mentions that the height of the sibling must be precisely set. Running example from the question and running my example with the fix, you can see that everything works as expected for this question.
Comment: You're not wrong, but would it be a more helpful and clearer answer if a disclaimer were put at the top? It's super annoying to spend a chunk of time implementing a solution like this only to find out the hard way, especially when the answer in question doesn't seem to provide an answer to the title of the question, which is the only thing that actually matters (nobody reads the whole content of a long question, the title is enough 95% of the time)


Formating parts of a string in TCL/ Tk tablelist cell

Question: I wonder if it is possible to format part of a text string when using the (example)
 .tbl   cellconfigure $row,$col -text "ThisBoldArial AndThisAsSubscript"

command?
I do know about eg the -font option, but this sets the font of the whole cell. Can I somehow format different parts of the string different?
Answer: I don't think you can do it easily. Looking at the documentation, I can't see any way of indicating index ranges of cell text contents (which you'd need in order to apply a rendering variation to them). I guess you could work around it by embedding a text widget as the cell's renderer window with the -window cell option; the use of a text (or ctext) widget for this purpose is mentioned in passing in documentation of the -windowupdate cell option so it must be possible to fake it that way, but you'd need to figure out the details of how to make it happen right.
This example shows how to do window embedding, albeit with a frame or button instead of a text. You'll need to do some work to get a text widget in there (basically make it borderless, read only and not scrollable at all).

proc createButton {tbl row col w} {
    set key [$tbl getkeys $row]
    button $w -image openImg -highlightthickness 0 -takefocus 0 \
        -command [list viewFile $tbl $key]
}

…
$tbl cellconfigure $row,$column -window createButton

Naturally, you'll want to do more work to make the embedded text widget render as you want. That's potentially its own special set of complexity…
Comment: Thank you Donal for the idea! I've used the createButton proc before, so adapting it to a text widget should not be to difficult..


Finding $\lim_{n\to \infty} \frac {3^{n+1}+3} {3^n}$

Question: Lemma 1: For the sequence $a_n$ defined by $a_n=(\frac 1 {x^n})_{n=1}^\infty$ we have that $\lim_{n\to \infty}a_n=0$. Where $x\in R$ and $x\ne 0$. *This is the limit of a sequence.
Proof: Let $\varepsilon>0$ be a real number. We have to find an $N\ge 1$ such that for al $n> N$ we have that $|\frac {1} {x^n}-0|=|\frac 1 {x^n}|<\varepsilon$. Because $\frac 1 {x^n}$ is positive for all $n\in R$, we can remove the absolute value and take $log_x$ on both sides. $$\frac 1 {x^n} <\varepsilon$$ $$\implies \frac 1 \varepsilon<x^n$$ $$\implies log_x(\frac 1 \varepsilon)<log_x(x^n)$$ $$\implies -log_x(\varepsilon)<n$$
Thus, if we let $N>-log_x(\varepsilon)$, then for all $n> N$ we have that $|\frac 1 {x^n}|<\varepsilon$. This proves that $\lim_{n\to \infty}\frac 1 {x^n} = 0$.

Problem: Find $\lim_{n\to \infty} (\frac {3^{n+1}+3} {3^n})$ and prove the result. *This is the limit of a sequence
Proof: Note that $$\frac {3^{n+1}+3} {3^n}= \frac {3^{n+1}} {3^n} +\frac {3} {3^n}$$ $$=3+\frac 1 {3^{n-1}}$$
Thus, $$\lim_{n\to \infty}\frac {3^{n+1}+3} {3^n}=\lim_{n\to \infty}3+\lim_{n\to\infty}\frac 1 {3^{n-1}}$$ Using lemma $1$ we conclude that $$\lim_{n\to \infty}3+\lim_{n\to \infty} \frac 1 {3^{n-1}}=3$$
Hence, $$\lim_{n\to \infty}\frac {3^{n+1}+3} {3^n}=3$$

Is this whole thing correct?
Edit: Fixed my algebra mistake. Thanks to everyone in the comments for their help!. I will fix lemma $1$, although it is night here so I will fix it tomorrow.
Comment: Lemma 1 only holds for $\lvert x \rvert > 1$. Also if you're assuming $x$ is positive you should make that clear. Besides that the proof works. You may consider proving the claim by writing $x=1+y$ where $y>0$ and using an inequality such as Bernoulli's Inequality to avoid using $\log$.
Comment: Note that $\frac{3}{3^n} = 3^{1 - n} = \frac{1}{3^{n - 1}}$, not $\frac{1}{3^{1 - n}}$.
Comment: Check that you're allowed to use $\log$ in your proof to Lemma $1.$  The $\log$ function is usually defined as a limit, so I'm not sure you can use it in your proof of Lemma $1,$ as then you would be assuming the result and using it in the proof, which is not allowed. Also, I doubt you need to use $\log$ for Lemma $1$; there are probably simpler methods.
Comment: @Newuser Yea definitely. No need to modify the argument though. $n$ need not necessarily start from $1$,  as long as it tends to infinity through the naturals.
Comment: @N.F.Taussig Yeah, I don't know what was I thinking. This proof requires modifications.
Comment: @jcneek Yeah I just realized that, I will tryi to improve and modify the proof.
Comment: @jcneek Come to think about it, I could use lemma $1$ as $\frac 3 {3^n}=\frac 1 {3^{n-1}}$ and thus lemma $1$ holds as long as $n-1\ge 1$. I will need to modify this for when $n-1<1$.
Comment: @AdamRubinson I am not sure if I am allowed to use the log function.  But I will try to prove it as joneek suggested I prove it using Bernoulli's inequality.
Comment: @jcneek Oh yeah, hadn't though about that. I guess apart from using the log function, my algebra mistake and not stating that $|x|>1$, everything else seems to hold!
Answer: This is a bit long so I posted it on the answer section. There is a straightforward  proof of your lemma, avoiding more complicated functions.
When $0\lt a\lt 1$ the sequence $a^n$ is decreasing, since  $\frac{a^{n+1}}{a^n}=a\lt 1$ which is the same as $a^{n+1}\lt a^n$. As the sequence is bounded below, it has a limit, say $l$. Hence, $\lim a^{n+1}= a\lim a^n$, or $l=al$, or $(1-a)l=0$. As $a$ is not equal to $1$, we conclude that $l=0$. From this it also follows that the lemma holds for $-1\lt a \le 0$ as well (check this).
Edit: for your specific example, note that $n\lt 3^n$ so that $0\lt \frac{1}{3^n}\lt \frac{1}{n}$. By the squeeze lemma, $\lim \frac{1}{3^n}=0$.
Comment: I like your proof. Where is the "standard form" you refer to in your comment to my question?
Comment: @AdamRubinson Thanks. Actually in almost all elementary analysis books, the lemma proved in my answer is a standard result, for example before analyzing the convergence of the geometric series. This is the "standard formulation" of the lemma that you proved in your answer
Comment: Sorry I don't get what you mean. We proved the same lemma in different ways. That's all, no?
Comment: As I said, it's a matter of pedagogy. You wouldn't see your formulation of the lemma in any elementary analysis book
Comment: Fair enough....
Answer: The proof to the problem is fine, albeit unnecessarily long. Just write:
Problem: Find $\displaystyle\lim_{n\to \infty} \left(\frac {3^{n+1}+3} {3^n}\right).$
Answer: $$\lim_{n\to\infty} \frac {3^{n+1}+3} {3^n}= \lim_{n\to\infty} (3) + \lim_{n\to\infty} \frac {3} {3^n}$$
$$=3 + \lim_{n\to\infty} \frac 1 {3^{n-1}}$$
$$ = 3 + 0 = 3. $$
For the proof of the Lemma you can use Bernoulli's inequality, but you don't need to. I will re-state this proof presently.
Lemma 1: Let $\vert x\vert> 1.$ For the sequence $a_n$ defined by $a_n=\left(\frac 1 {x^n}\right)_{n=1}^\infty$ we have: $\ \displaystyle\lim_{n\to \infty}a_n=0$.
Proof: Since $0<\alpha<1$, the sequence $\alpha^n$ is strictly decreasing. Moreover, it is bounded below as $\alpha^n$ is positive for all $n\in\Bbb{N}$. Let $S=\{\alpha^n:n\in\Bbb{N}\}$. By the monotone convergence theorem,
$$
\lim_{n \to\infty}\alpha^n=\inf S \, .
$$
All that is left to show is that $0=\inf S\ $. Let $\ (a_n) = \alpha^n.\ $ Then, $\ \frac{a_{n+1}}{a_n} = \alpha\ \implies\ a_{n+1} = \alpha\ a_n.\ $ Now suppose $\ \inf\{S\}=x>0.\ $ Then by definition of convergence towards $\ x,\ \exists i\in\mathbb{N}\ $ such that $\ x\leq a_i< \alpha x,\ $ which implies that $\ a_{i+1}=\alpha\ a_i<x,\ $ contradicting $\ x\ $ being the infimum of $\ S.$
Comment: The lemma that you stated is not of a standard form. But this follows from the standard form, which I'd mentioned in my answer. Pedagogically speaking, it's better to follow standard forms as far as possible
Comment: What do you mean "of a standard form" ?


How to use after() if a function with sleep is called in the GUI?

Question: I have got an external class with a function in which I wait 30 seconds and afterwards increment the temperature.
def incTemperature(incedTempVal, endTemperature):
    tempCurrentTemperature = read_current_Temperature()
    while(True):
        if(round(tempCurrentTemperature,1) < float(endTemperature)):
            tempCurrentTemperature = read_current_Temperature()
            temp = read_fixed_Temperature_of_specific_f(1)

            if(round(tempCurrentTemperature,1) >= float(endTemperature)):
                break

            if(round(tempCurrentTemperature,1) == temp):

                temp = round(temp + float(incedTempVal),1)
                setTemperature(temp)
                print('Erhoehe um 0.1 Grad bis' + endTemperature + ' Grad')
                time.sleep(30)
        else: break

This function is called in my GUI class:
  def startEvent():
            sp.startHeat()
            sp.setTemperature(self.EntryStartEins.get())
            sp.incTemperature(self.EntryTemperatureInc.get(), self.EntryEndTemperature.get())

How can I work with after() in the GUI when my function call in which I let my program sleep for 30 seconds? I guess I have to recode my function to let it work as I want to right? But how can I realise it if I need this timeout in the function?
Update#2, thanks for Mike's advice:
I extended my code with return values
if(round(tempCurrentTemperature,1) == temp):

            temp = round(temp + float(incedTempVal),1)
            setTemperature(temp)
            print('Erhoehe um 0.1 Grad bis' + endTemperature + ' Grad')
            return 1
        else: return 3

so that I can execute after() with 0 delay or with 30 seconds.
            if(returnValueForLoop == 3):
                returnValueForLoop = root.after(0, sp.incTemperature, self.EntryTemperatureInc.get(), self.EntryEndTemperature.get())
            elif(returnValueForLoop == 0):
                print("Stop!")
                return

            if(returnValueForLoop == 1):
                returnValueForLoop = root.after(30000, sp.incTemperature, self.EntryTemperatureInc.get(), self.EntryEndTemperature.get())
            elif(returnValueForLoop == 0):
                print("Stop!")
                return

But it just executes once. So this does not work.
Comment: Do you mean to call after() on a widget? The function works like so: widget.after(miliseconds, function_to_call). You would have to implement it with incTemperature as the function.
Comment: You don't... Do not use `sleep()` in tkinter. Instead rework your functions to use `after()` only.
Answer: Not sure how yoour method doesn't have self argument, but still, your method should call itself every 30 seconds. If your tk.Tk window instance is root:
def incTemperature(incedTempVal, endTemperature, root):
    tempCurrentTemperature = read_current_Temperature()
    if(round(tempCurrentTemperature,1) < float(endTemperature)):
        tempCurrentTemperature = read_current_Temperature()
        temp = read_fixed_Temperature_of_specific_f(1)

        if(round(tempCurrentTemperature,1) >= float(endTemperature)):
            break

        if(round(tempCurrentTemperature,1) == temp):

            temp = round(temp + float(incedTempVal),1)
            setTemperature(temp)
            print('Erhoehe um 0.1 Grad bis' + endTemperature + ' Grad')

    root.after(30000, incTemperature, self.EntryTemperatureInc.get(), self.EntryEndTemperature.get(), root)

Changed start function where you pass the root instance:
def startEvent():
    sp.startHeat()
    sp.setTemperature(self.EntryStartEins.get())
    sp.incTemperature(self.EntryTemperatureInc.get(), self.EntryEndTemperature.get(), root)

Comment: It doesn't matter, replace `root` with any variable you want or pass root instance to function (and repeat it in after call).
Comment: This won't work I guess, because root.after is not known in this class.
It is an external class / function. The Tkinter class in which I call my function is not the same class.
Comment: Okay now it does not freeze anymore, but the main problem now is that every call lasts 30 seconds  It has to be 30 seconds when my last statement is true otherwise my program run in milliseconds to check if the statement got true or not.
Comment: @ebug38 Then write the conditional statement that decides how long `after()` is called for.
Comment: @ipaleka I don't understand your 2nd comment exactly. Maybe I did it wrong. Should I add this line: ```root.after(30000, incTemperature, self.EntryTemperatureInc.get(), self.EntryEndTemperature.get())``` in def incTemperature which is **not** in my tkinter class - if yes - I get an error. Or in my tkinter class? If in tkinter class, I did and I have no solution yet.
Comment: Check my edit, you call incTemperature method initially from your "Tkinter" class and then it calls itself from the inside.
Comment: Thanks for your help, but this does not work for me. The function incTemperature is in the module Serialport, so it shows me errors for self.EntryTemperatureInc.get() and self.EntryEndTemperature.get() with "undefined variable self". If I delete the self keyword the same error for EntryTemperatureInc.
Comment: Create function `get_temperatures` where you get and return those temperatures from within other module. Or other way around, move this incTemperature there and crucial parts in that serialport module. Btw, use correct Python naming, modules and functions are lowercase.


How do I tell what controller this View links to?

Question: Im still struggling a bit with reading routes on a global.asax....I can see that the URL is
funnelweb/admin/login
The routes are:
<code>        // Due to a bug in the .AddServiceRoute<>() method in WCF we have to do this work around.
        // see http://wcf.codeplex.com/workitem/9 for bug description
        // Workaround caches all service route urls, removes the service routes. Adds a constraint to the wiki page route
        // then re-adds the service routes at the end.
        var serviceRoutes = routes
            .OfType<ServiceRoute>()
            .ToList();
        var serviceRoutesUrls = serviceRoutes
            .Select(serviceRoute => serviceRoute.Url.Replace("{*pathInfo}", ""))
            .ToArray();
        var notAService = new NotFromValuesListConstraint(serviceRoutesUrls.ToArray());
        var defaultConstraint = new { page = notAService };
        foreach (var serviceRoute in serviceRoutes)
        {
            routes.Remove(serviceRoute);
        }

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{*allaxd}", new { allaxd = @".*\.axd(/.*)?" });
        routes.IgnoreRoute("pingback");

        if (builder != null)
            AreaRegistration.RegisterAllAreas();

        // Feeds
        routes.MapLowerCaseRoute("feed", new { controller = "Feed", action = "Feed", feedName = (string)null });
        routes.MapLowerCaseRoute("feeds/{*feedName}", new { controller = "Feed", action = "Feed" });
        routes.MapLowerCaseRoute("commentfeed", new { controller = "Feed", action = "CommentFeed" });

        // Upload
        routes.MapLowerCaseRoute("get/{*path}", new { controller = "Upload", action = "Render", area = "Admin" });

        // Resources
        routes.MapLowerCaseRoute("robots", new { controller = "Resource", action = "Render", fileName = "/Content/Resources/Robots.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("robots.txt", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Robots.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("humans.txt", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Humans.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("humans", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Humans.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("favicon", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.ico", fileName2 = "/Content/Resources/favicon.ico", contentType = "image/vnd.microsoft.icon" });
        routes.MapLowerCaseRoute("favicon.ico", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.ico", fileName2 = "/Content/Resources/favicon.ico", contentType = "image/vnd.microsoft.icon" });
        routes.MapLowerCaseRoute("favicon.png", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.png", fileName2 = "/Content/Resources/favicon.png", contentType = "image/png" });
        routes.MapLowerCaseRoute("status", new { controller = "Resource", action = "Render", fileName = "/Content/Resources/Status.html", contentType = "text/html" });

        // Site Map
        routes.MapLowerCaseRoute("sitemap", new { controller = "Wiki", action = "SiteMap" });
        routes.MapLowerCaseRoute("sitemap.xml", new { controller = "Wiki", action = "SiteMap" });

        // Tags
        routes.MapLowerCaseRoute("tag/{*tagName}", new { controller = "Tag", action = "Index" });

        // Tagged Pages
        routes.MapLowerCaseRoute("tagged/{*tag}", new {controller = "Tagged", action = "Index"});

        // Wiki
        routes.MapLowerCaseRoute("blog", new { controller = "Wiki", action = "Recent", pageNumber = "0" });
        routes.MapLowerCaseRoute("blog/{pageNumber}", new { controller = "Wiki", action = "Recent" }, new { pageNumber = "\\d+" });
        routes.MapLowerCaseRoute("", new { controller = "Wiki", action = "Home", pageNumber = "0" });
        routes.MapLowerCaseRoute("{pageNumber}", new { controller = "Wiki", action = "Home" }, new { pageNumber = "\\d+" });
        routes.MapLowerCaseRoute("search", new { controller = "Wiki", action = "Search" });

        routes.MapLowerCaseRoute("unpublished", new { controller = "WikiAdmin", Area = "Admin", action = "Unpublished" });
        routes.MapLowerCaseRoute("admin/new", new { controller = "WikiAdmin", Area = "Admin", action = "Edit", page = "" });
        routes.MapLowerCaseRoute("edit/{*page}", new { controller = "WikiAdmin", Area = "Admin", action = "Edit", page = UrlParameter.Optional });
        routes.MapLowerCaseRoute("revert/{*page}", new { controller = "WikiAdmin", Area = "Admin", action = "Revert" });

        routes.MapLowerCaseRoute("via-feed/{*page}", new { controller = "Resource", action = "Render", fileName = "/Content/Images/Transparent.gif", contentType = "image/gif" });
        routes.MapLowerCaseRoute("history-of/{*page}", new { controller = "Wiki", action = "Revisions" });
        routes.MapLowerCaseRoute("trackbacks-for/{*page}", new { controller = "Wiki", action = "Pingbacks" });

        // Remove .aspx
        routes.Add(new RedirectRoute("(?<page>[a-zA-Z0-9/\\-\\._\\+ ]+)\\.aspx", new MvcRouteHandler()) { ReplacePattern = "/$1" });
        routes.Add(new RedirectRoute("(?<page>rss)$", new MvcRouteHandler()) { ReplacePattern = "feed", ResponseCode = 302});

        routes.MapLowerCaseRoute("{*page}", new { controller = "Wiki", action = "Page" }, defaultConstraint);

        foreach (var serviceRoute in serviceRoutes)
        {
            routes.Add(serviceRoute);
        }
</code>
Just cant see how im meant to work out where it goes. Because nothing seems to match /admin/login...?
Answer: Maybe you have an area where the registration of the route is. Also, have you tried glimpse? Glimpse will show you what routes are used.  http://getglimpse.com/
Answer: Just been trying out FunnelWeb blog too and I found that the route to the admin/login is in
\FunnelWeb\src\FunnelWeb.Web\Areas\Admin\RouteConfig.cs
<code>context.MapRoute(
                "Admin_Login",
                "admin/login/{action}",
                new { controller = "Login", action = "Login" }
                );
</code>


Kotlin use block function is not called on File.printWriter()

Question: I'm new to Kotlin and I'm trying to do a simple task - create and write to a file. For some reason, using use() with a block function on printWriter() doesn't actually write.
    File("test2.txt").printWriter().use { out ->
        {
            println("hmmm")
            out.println("what's up")
            log.info { "finished writing" }
        }
    }

In fact, the block function doesn't seem to be called at all - both "hmmm" and "finished writing" never show up, although the file itself is created (but is totally empty).
The much simpler writeText() works just fine - the file is created and the given text is written to the file.
    File("test3.txt").writeText("testing")

What am I doing wrong in my use() version?
Edit: it seems to be a syntax issue with my block function. Looks like I have an extra pair of brackets? Would love a brief explanation as to why it makes it not work.
Edit 2: I think I understand now. The way I wrote it, I was essentially returning the block function itself rather than running through it.
Comment: Suggestion: now that you solved it, write your own answer.
Answer: So the problem was that the way I was writing the block function caused it to just return the inner block function, and not actually call it.
Here are two ways that work:
    File("test2.txt").printWriter().use {
        println("hmmm")
        it.println("what's up")
        log.info { "finished writing!" }
    }

    File("test2.txt").printWriter().use(fun(out) {
        println("hmmm")
        out.println("what's up")
        log.info { "finished writing!" }
    })

Although, for my purposes writeText() actually works just fine and is much shorter haha.


How to make PHP more Javatized (aka strongly typed, more robust)?

Question: I really love PHP because:
_ easy to develop web applications (you set up LAMP in 10 minutes and you are ready to go)
_ easy to learn
_ easy to deploy (you just need Apache with the PHP module)
I really love Java because:
_ it is strongly typed
I was amazed by developing with Java and Netbeans. Any time there was a type mismatch I was alerted by the IDE while developing and the IDE itself was suggesting the fix.
I think strong typing is a bliss. That's true: PHP arrays that can contain anything speed up your development, but then you have to spend time finding bugs while with a little more work ahead you have the IDE that points out the problems for you.
That makes me feel more confidence also during refactoring.
So, my question is: is it possible to use types in PHP (including for the return value of a method)?
Do you know of a project, a fork, anything that would allow me to do that?
It could be just a pre-parser that checks some comments before the actual PHP parser (i.e. public function /*ConfBuilders[]*/ getConfBuilders(/*int*/ confId)).
Please anything that would introduce a concept of type and, thus, in my opinion, would make a PHP application more robust and, eventually, quicker to implement (right now I think it is quicker to develop software in Java than in PHP, thanks to the IDE's help).
Thanks,
Dan
EDIT:
This is the only thing I have found on the web:
http://cstruter.com/blog/44
but I don't like it, mainly because you can't declare the object properties in a standard way and for sure make the execution of the script slower. I would like a method that works offline, while developing...a sort of compilation.
Comment: You must first divide PHP by "0"
Comment: "easy to develop" is the one of the big reasons, why php is not "strongly typed"
Answer: Find another language.
Weak typing and JiT compilation is part of what makes PHP PHP. If you feel like PHP's characteristics go against your coding philosophy, then by all means, do not use it.
There are other languages such as Ruby which is strong-typed yet JiT compiled like PHP.
Answer: There is a couple of ways of making your code more rigid.

Use type hinting in methods to restrict argument type. This works for classes, interfaces, and arrays only. See example:
class Foo { }
class Bar {
    function quux(Foo $f) { }
}

I use type hinting as much as I can to save myself from silly mistakes like passing null or primitive value whereas object is desired. Return values are unfortunately not strongly typed.

Use access qualifiers: public, protected, private. While public members can be accessed by an outside entity, protected and private can be only accessed by instance of the same (base) class. Also consider using abstract and final qualifiers.
Code against interfaces rather than classes, use composition and aggregation aggressively. Get used to use of dependency injection. Use well known design patterns where appropriate.
Familiarise yourself with elements of Reflection and Aspect Oriented Programming. While there's very little PHP has to offer in AoP area, its reflection subsystem is quite good. You can use @annotations in doc-block comments to take advantage of metaprogramming. I use it a lot to annotate classes with location of unit tests. I also have an implementation of ACLs where controller methods are annotated with (to make long story short) requisite access level:
/**
 * @AclActivity('view-services')
 * @AclActivity('edit-services')
 */
public function editServiceAction() { ... }

Finally, don't restrict yourself to PHP. Read about other languages, not only mainstream ones, but also obscure ones - these are full of brilliant ideas. Check out Lisp, Erlang, Rebol. Find unusual applications for existing languages, like server side JavaScript programming. Write your own language. Yes, it's going to suck, but you will learn a lot.
Comment: "Yes, it's going to suck"
Answer: Have you looked into Eclipse at all? It's a very strong Java and PHP IDE. As well it also allows you to define types within comments. Sure it's not solid... but the code hints do help.
 /**
 * Create a Person
 *
 * @param   string  $name
 * @param   int $age
 * @return  String
 */
function person($name, $age) {
    $this->name = $name;
    $this->age= $age;
    return "Hello ".$name;
}

Comment: The same works for NetBeans which looks like question author is familiar with already. But this unfortunately doesn't cause the IDE to report an error in code as it would with Java.
Comment: Ah, I've never used Netbeans... Need Eclipse for Zend :)
Answer: Almost a decade ago I wrote the post mentioned by the OP, in that post I implemented a very crude solution, which essentially fakes strong typing using magic methods (I agree, not all that great), but in the latest version of PHP things evolved a bit.
PHP won't ever (dare I say) become a strongly typed language, but I do believe that in the near future it might become a gradually typed language (like TypeScript).
As of PHP 7.x it is possible to declare return types of functions and declare/hint scalar types.
class Person
{
    private $age;
    public function __construct(int $age) {
        $this->age = $age;
    }
    public function getAge() : int {
        return $this->age;
    }
}

The only part still missing from this equation (making PHP gradually typed) is the ability to declare property types, this has however been proposed in a recent draft document.
class Person
{
    public int $Age; // Not possible yet
}

Excerpts from http://cstruter.com/blog/410


How to make a PHP and JS backend?

Question: I know that you can use PHP or node.js server-side, but is it possible to use both PHP and JS together, for example PHP calling a JS function?
My goal is to call JS for the more intensive math functions, but I don't want these to be seen on the clientside. I've tried searching many different sites but it seems my question is pretty specific. Thanks
Comment: Please read over https://stackoverflow.com/help/how-to-ask , and its very helpful to attempt https://stackoverflow.com/help/mcve
Comment: @Randall: Many -- most -- questions are code-specific. Not all by any means.
Comment: @Randall: What would an MCVE of this question even look like? The question is quite clear, if a bit broad: Is it possible to call JS **server-side** from PHP and, if so, how?
Comment: I was about to answer this by recommending PHP V8js if you really want to do this.
Comment: Related but not a dupetarget: https://stackoverflow.com/questions/18760984/mix-node-js-and-php (that question is specifically about generating a "page" in PHP then passing it through JavaScript code to amend the page; this question isn't limited in that way).
Comment: @T.J.Crowder I guess I misunderstood the point of stack overflow, being where we help with code attempted. Not broad questions sending people off to external websites or sources. My bad.
Comment: Whats wrong with js templating languages??
Comment: Agree, the question is pretty simple, just rather open-ended (lots of correct ways of doing so)
Comment: I'm in a similar situation because you can't use google cloud platform's free tier while running node. You can use google drive scrip files for your javascript and then call them via api. I'll be giving this a try in the next bit. If you need your scripts to be private though you'd have to use google's oAuth 2 which is far from simple. Apps Script: https://www.google.com/script/start/
API tutorial: https://developers.google.com/apps-script/guides/rest/api I know this isn't the answer your looking for but it's something.
Answer: There are a couple of ways to do this:

Use some kind of bridging technology. The briefest search turned up this one, for instance. Edit: User blues mentions PHP V8js as well.
Have a Node process running and bound only to localhost, and have your PHP code make queries to it (perhaps via HTTP).
Comment: If node was installed on the same server, I guess you wouldn't necessarily need a node http server running. You could just exec node files, right?
Comment: @Don'tPanic: Fair point, absolutely. You'd have the cost of spinning up a process, though, which is fairly costly, as opposed to connecting to an existing process. But yes, quite true. :-)

How to make a PHP and JS backend?


why this deep first search, with a starting vertex of 3, go this way?

Question: Please see the Depth-First Search execution (red line) in the following graph:

My question: Why doesn't it process the node 1 first?
Comment: It could go either way, both executions would yield in correct spanning trees. It all depends on the graph's in memory representation and how the dfs was implemented.
Answer: It depends on how your algorithm was implemented. There isn't a "wrong" way or to perform dfs unless you want it to behave a certain way.


Make errors when installing nodejs on OSX 10.7.4

Question: When trying to build nodejs, I get Build failed: -> task failed (err #2): {task: uv uv.h -> uv.a}
Following these instructions on [github, Building on GNU/Linux and other UNIX][1]
Running:

OSX v10.7.4
GCC-10.7.pkg
XCode 4.3.2 (with Command-line Tools installed)

Build output:
manzi:node coderama$ git checkout -b v0.8.6
Switched to a new branch 'v0.8.6'
manzi:node coderama$ ./configure --prefix=/Users/coderama/sandbox/installs/node/v0.8.6Checking for program g++ or c++          : /usr/bin/g++
Checking for program cpp                 : /usr/bin/cpp
Checking for program ar                  : /usr/bin/ar
Checking for program ranlib              : /usr/bin/ranlib
Checking for g++                         : ok
Checking for program gcc or cc           : /usr/bin/gcc
Checking for gcc                         : ok
Checking for library dl                  : yes
Checking for openssl                     : not found
Checking for function SSL_library_init   : yes
Checking for header openssl/crypto.h     : yes
Checking for library util                : yes
Checking for library rt                  : not found
Checking for fdatasync(2) with c++       : no
'configure' finished successfully (3.653s)
manzi:node coderama$ make
Waf: Entering directory `/Users/coderama/sandbox/node/out'
DEST_OS: darwin
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
[ 1/35] copy: src/node_config.h.in -> out/Release/src/node_config.h
[ 2/35] cc: deps/http_parser/http_parser.c -> out/Release/deps/http_parser/http_parser_3.o
/usr/bin/gcc -rdynamic -pthread -m64 -arch x86_64 -g -O3 -DHAVE_OPENSSL=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -DHAVE_FDATASYNC=0 -DARCH="x64" -DPLATFORM="darwin" -D__POSIX__=1 -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -IRelease/deps/http_parser -I../deps/http_parser ../deps/http_parser/http_parser.c -c -o Release/deps/http_parser/http_parser_3.o
[ 3/35] src/node_natives.h: src/node.js lib/dgram.js lib/console.js lib/buffer.js lib/querystring.js lib/punycode.js lib/http.js lib/net.js lib/stream.js lib/events.js lib/util.js lib/module.js lib/_debugger.js lib/assert.js lib/fs.js lib/child_process.js lib/os.js lib/readline.js lib/vm.js lib/url.js lib/tls.js lib/crypto.js lib/sys.js lib/https.js lib/freelist.js lib/dns.js lib/_linklist.js lib/buffer_ieee754.js lib/tty.js lib/cluster.js lib/repl.js lib/path.js lib/string_decoder.js lib/timers.js lib/zlib.js lib/constants.js -> out/Release/src/node_natives.h
[ 4/35] uv: deps/uv/include/uv.h -> out/Release/deps/uv/uv.a
rm -f src/ares/*.o
rm -f src/unix/ev/*.o
rm -f src/unix/eio/*.o
rm -f src/unix/*.o
rm -rf test/run-tests.dSYM run-benchmarks.dSYM
rm -f -f src/*.o *.a test/run-tests test/run-benchmarks
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/core.c -o src/unix/core.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/dl.c -o src/unix/dl.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/fs.c -o src/unix/fs.o
src/unix/fs.c: In function 'uv_fs_fdatasync':
src/unix/fs.c:459: warning: implicit declaration of function 'fdatasync'
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/cares.c -o src/unix/cares.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/udp.c -o src/unix/udp.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/error.c -o src/unix/error.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/process.c -o src/unix/process.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/tcp.c -o src/unix/tcp.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/pipe.c -o src/unix/pipe.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/tty.c -o src/unix/tty.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/stream.c -o src/unix/stream.o
/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude -Iinclude/uv-private -Isrc/unix/ev -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -Isrc/ares/config_darwin -Isrc  -m64 -arch x86_64 -c src/unix/darwin.c -o src/unix/darwin.o
In file included from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21:19: error: AE/AE.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:25:35: error: CarbonCore/CarbonCore.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:29:35: error: OSServices/OSServices.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:33:43: error: CoreFoundation/CoreFoundation.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:37:33: error: CFNetwork/CFNetwork.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:41:43: error: LaunchServices/LaunchServices.h: No such file or directory
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:30,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:20:35: error: CoreFoundation/CFBase.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:24:34: error: CoreFoundation/CFURL.h: No such file or directory
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:30,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:51: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:67: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:98: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentCreateWithURL'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:116: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentCopyURL'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:157: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentCreate'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentGetSchemeName'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:206: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentGetName'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKDocument.h:230: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentGetParent'
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:34,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:20:37: error: CoreFoundation/CFString.h: No such file or directory
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:34,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKMinTermLength'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:71: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKSubstitutions'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:88: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKStopWords'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:107: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKProximityIndexing'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:127: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKMaximumTerms'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:146: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKTermChars'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:165: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKStartTermChars'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKEndTermChars'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKAnalysis.h:207: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'kSKLanguageTypes'
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:38,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:28:41: error: CoreFoundation/CFDictionary.h: No such file or directory
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:38,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:75: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexDocumentIteratorGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:215: error: expected ')' before 'inURL'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:256: error: expected ')' before 'inURL'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:295: error: expected ')' before 'inData'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:332: error: expected ')' before 'inData'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:368: error: expected ')' before 'inData'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:394: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexFlush'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:411: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:430: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetMaximumBytesBeforeFlush'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:456: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexCompact'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:498: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetAnalysisProperties'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:522: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetDocumentCount'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:543: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:575: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexAddDocumentWithText'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:624: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexAddDocument'

... Similar errors here...
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:888: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexCopyTermIDArrayForDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:905: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetDocumentTermFrequency'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:928: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetMaximumTermID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:943: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetTermDocumentCount'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:963: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexCopyDocumentIDArrayForTermID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:980: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexCopyTermStringForTermID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKIndex.h:1000: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKIndexGetTermIDForTermString'
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:42,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:32:35: error: CoreFoundation/CFDate.h: No such file or directory
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:42,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:79: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:90: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchOptions'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:131: error: expected declaration specifiers or '...' before 'CFStringRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:132: error: expected declaration specifiers or '...' before 'SKSearchOptions'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:195: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchFindMatches'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:238: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:239: error: expected declaration specifiers or '...' before 'SKDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:240: error: expected declaration specifiers or '...' before 'CFStringRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:241: error: expected declaration specifiers or '...' before 'SKDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:272: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:273: error: expected declaration specifiers or '...' before 'SKDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:274: error: expected declaration specifiers or '...' before 'SKDocumentRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:305: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:306: error: expected declaration specifiers or '...' before 'SKDocumentID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:307: error: expected declaration specifiers or '...' before 'CFURLRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:336: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchGroupGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:359: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchResultsGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:411: error: expected declaration specifiers or '...' before 'SKDocumentRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:411: error: 'CALLBACK_API_C' declared as function returning a function
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:435: error: expected ')' before 'inArrayOfInIndexes'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:453: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchGroupCopyIndexes'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:501: error: expected declaration specifiers or '...' before 'CFStringRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:503: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:505: error: expected declaration specifiers or '...' before 'SKSearchResultsFilterCallBack'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:551: error: expected declaration specifiers or '...' before 'CFArrayRef'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:552: error: expected declaration specifiers or '...' before 'CFIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:554: error: expected declaration specifiers or '...' before 'SKSearchResultsFilterCallBack'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:569: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchResultsGetCount'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:618: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchResultsGetInfoInRange'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSearch.h:650: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSearchResultsCopyMatchingTerms'
In file included from /System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SearchKit.h:46,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:69: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryGetTypeID'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:97: error: expected ')' before 'inString'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:117: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryGetSentenceCount'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryGetParagraphCount'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:160: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryCopySentenceAtIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:185: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryCopyParagraphAtIndex'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:211: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryCopySentenceSummaryString'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:237: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryCopyParagraphSummaryString'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:278: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryGetSentenceSummaryInfo'
/System/Library/Frameworks/CoreServices.framework/Frameworks/SearchKit.framework/Headers/SKSummary.h:318: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'SKSummaryGetParagraphSummaryInfo'
In file included from src/unix/darwin.c:28:
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:48:31: error: Metadata/Metadata.h: No such file or directory
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:49:51: error: DictionaryServices/DictionaryServices.h: No such file or directory
src/unix/darwin.c: In function 'uv_hrtime':
src/unix/darwin.c:39: error: 'Nanoseconds' undeclared (first use in this function)
src/unix/darwin.c:39: error: (Each undeclared identifier is reported only once
src/unix/darwin.c:39: error: for each function it appears in.)
src/unix/darwin.c:39: error: expected ';' before 'enano'
src/unix/darwin.c:41: error: 'enano' undeclared (first use in this function)
src/unix/darwin.c:41: warning: implicit declaration of function 'AbsoluteToNanoseconds'
src/unix/darwin.c:41: error: 'AbsoluteTime' undeclared (first use in this function)
src/unix/darwin.c:41: error: expected expression before ')' token
src/unix/darwin.c:43: warning: control reaches end of non-void function
src/unix/darwin.c: In function 'uv_exepath':
src/unix/darwin.c:60: warning: implicit declaration of function 'malloc'
src/unix/darwin.c:60: warning: incompatible implicit declaration of built-in function 'malloc'
src/unix/darwin.c:61: warning: implicit declaration of function 'realpath'
src/unix/darwin.c:61: warning: assignment makes pointer from integer without a cast
src/unix/darwin.c:64: warning: implicit declaration of function 'free'
make[1]: *** [src/unix/darwin.o] Error 1
Waf: Leaving directory `/Users/coderama/sandbox/node/out'
Build failed:  -> task failed (err #2):
    {task: uv uv.h -> uv.a}
make: *** [program] Error 1

Answer: Fixed by installed XCode's Command Line Tools.
This can be done through Preferences -> Downloads -> Command Line Tools


Android: How to record video with a custom audio track?

Question: I've been asked to make a 'dubsmash' alike app, where you record a video but with a music over it.
So the video file needs to have the custom audio track embeded.
Is it possible?
(I'm noob with android :p )
Thanks!
Answer: Although you have not "demonstrated" any effort of your own, so I should not answer this as per rules, but here goes : Yes, it is possible. Read this : http://developer.android.com/reference/android/media/MediaMuxer.html
FYI : The code in the example works perfectly, so please don't ask for any other sample
Comment: Thanks. I've searched for it, but didn't know the name of that class.


GU24 to E26 light socket adapter -- any risks?

Question: I recently moved to a new location where instead of the common E26 light sockets, they have GU24 light sockets. This is a bit of a problem for me, because I like to use edison-style incandescent bulbs, and I find their warm color and low luminescence most palatable for evening indoor lighting.
I checked the GU24 socket, and it says 660 W. But on the light fixtures there is a sticker that says "MAX. 13-watt. Risk of fire". I'm very new to home improvement, and I'm not sure exactly how to interpret this.
If I buy a GU24 to E26 adapter and install a 30- or 60-watt incandescent in it:

Is there a risk of fire because the fixture can't handle the heat produced
by a 14+ watt light bulb?
Is there still a risk if I remove the glass fixture and just screw the light bulb into the adapter?
Would a 14+ watt light bulb potentially cause overheating in the actual electrical wires/their plastic sleeves?

I've added a few pictures to show the fixture and the socket. The "MAX." sticker is attached to a plastic ring that keeps the glass fixture in place.
Comment: Have you tried LEDs on the "warm white" end of the world? (2700K color temp, or so)
Comment: I think I have, and they're too bright for me. Edison-style light bulbs can output 200-400 lumens, they get even warmer than 2700K, and they also have an emission spectrum which is more pleasing to me than that of LEDs. There's emerging research on the relationship between light emission spectra and melatonin production/sleep quality, and the research suggests that low wattage incandescents may be best for the purpose of evening indoor lighting.
Comment: Well, getting a LED setup to spit out 300lm at say 2000K should be manageable, no? (although that's warmer/redder than typical "warm white" binning by a significant margin.)
Answer:
If I buy a GU24 to E26 adapter and install a 30- or 60-watt incandescent in it:

Is there a risk of fire because the fixture can't handle the heat produced by a 14+ watt light bulb?
Is there still a risk if I remove the glass fixture and just screw the light bulb into the adapter?
Would a 14+ watt light bulb potentially cause overheating in the actual electrical wires/their plastic sleeves?

Absolutely a fire risk. Generally things are designed to handle a bit extra, so a 15W bublb probably wouldn't be a problem. But 30W = > 2X - don't do it.
Yes. The rating is based on "everything". You can't guess which parts exactly determine the problem without a lot of engineering calculations.
The wires themselves? No. The wires are typically rated for 15A or 20A - i.e., 1,875W or more. The problem in this situation is the socket and connections.

As I understand it, the GU24 (or similar) has been mandated in some jurisdictions specifically to avoid people (like you!) using it for incandescent bulbs. If they installed E26 fixtures then it would be trivially simple to install a bulb that generated too much heat for the fixture and waste energy.
Take a look at the newest LED bulbs. They are available in quite a variety of CRI and are a far cry from the first CFLs and even the first white LEDs. If you save 25W x 1,000 hrs/year (< 3 hours a day) that's 25 kWh ~ a few dollars a year, more than enough to pay for a high-quality bulb. Plus in the summer you will save double because you won't pay to remove the heat generated by incandescent bulbs.
Seriously, there is a lot of good stuff out there. Many big orange or blue stores have decent lighting departments with samples of a lot of different bulbs so that you can actually see the difference. If that doesn't satisfy you, go to a real lighting store - i.e., one that sells to the trade (but most will sell to the public too) where the only thing they sell is lighting. Hanging an incandescent bulb may have been the best answer in the early days of CFLs, but there are much better choices now with quality LEDs.
Comment: Certainly quite possible that overheating the *fixture* would result in the wiring right near the socket getting toasted before the socket itself. But with a properly designed fixture with a correctly sized bulb, everything should be OK.
Comment: Your #3, are you referring to the house wiring or the light socket wiring?
Comment: House wiring. Socket wiring in this case is rated to at least the 660W of the socket rating.
Comment: Just asking because I've seen a lot of fixture wiring toasted.
Comment: I agree. They were definitely the wrong bulbs.
Comment: I'm still a little confused as to the distinction between overheating the fixture vs. overheating the wiring. If a 30-watt light is installed in a 13-watt fixture, is the idea that the heat generated from the wire will overheat the fixture?
Comment: Not heat from the *wire*, heat from the **bulb**.
Comment: Thanks, I will take your advice very seriously. Roughly how much heat are we talking about here? I still have a hard time seeing how a 30-watt incandescent bulb which is exposed to air and is several inches away from the fixture can produce enough heat to cause an issue.
Comment: Several inches away from the fixture? That would solve the heat problem, but rather ugly, IMHO, to have a hanging bulb from a nice fixture like that.
Comment: That might not even solve the heat problem -- several inches *in air* is a good insulator, but it's still connected by wire, and wire is a very good conductor of heat.
Answer: I get where early LEDs didn't make much of an impression, with their blueness and rather terrible CRI.  That didn't just bother you, it also bothered people in the LED business.  As a direct result, they fixed it.  Very thoroughly.
Of course it's still possible to buy cheap, janky LEDs; in fact it's pretty easy.  All the usual cheap outlets await.  However for the discerning buyer, it's no trouble at all.
Incandescents are a firestarter here
The entire point of a GU24 fixture is to render it impossible to insert incandescent bulbs.  And I know this seems like a big dirty government conspiracy, and I won't deny that energy conservation and pollution control have a slice of the pie. But a big part is manufacturers themselves are happy to be free from the thermal management challenges of building a fixture that takes incandescents.

Is there a risk of fire because the fixture can't handle the heat?

Correct.

What if I remove the glass fixture?
How about the wires / sheath?

We don't know because in this country, we have someone who answers those questions for us: Underwriter's Laboratories or UL.  UL does all this testing on the fixture, and gives definitive answers to all these questions.  However, the UL listing is contingent on the fixture being used according to its labeling and instructions.
(UL has competitors; CSA and ETL are common ones, and expect to see a file number as part of the label. CE is not one; it stands for "Chinese Excrement" and is found on the rubbish from Alibaba/eBay/Amazon.)
Because of that, a UL listing is required for fixtures installed in homes (NEC 110.2).  And you are required to obey the labeling and instructions (NEC 110.3b).  We here have had a lot of experience with the electrical codes (NEC) - and our experience is that every rule in there has a good safety reason for being there.  There's no government conspiracy; it's written by a nonprofit.  So the NEC is something we take seriously, and you should too.
Insurers agree, by the way; they'll refuse a homeowner claim if it's caused by an intentional violation of NEC.
Change the fixture
Fortunately, Home Depot has loads of fixtures with E26/27 sockets and rated for incandescent, that actually do have proper UL/ETL listings with file numbers.  Buy one, put it up, have a field day with your incandescents.
This may violate some other codes, but they're not safety codes, so that's between you and the regulator.
Re-factor your circuit load
Another reason builders use guaranteed-low-power fixtures is it allows them to put more fixtures on a circuit.  So, identify your circuits and re-crunch your numbers to make sure you aren't inadvertently putting 2300 watts of fixture on a 1440 watt circuit.
Comment: While it's true you can't use an incandescent with a GU24, it's also true that they make 50W GU24 halogens, which burn like the sun.
Comment: @Machavity Halogens are incandescent.  Are you sure?  I searched "GU24 halogen" and just got a bunch of raggedy search results like you get when searching for nonexistent things.  Home Depot had 1 hit, but it was a 24-pack of GU10.
Comment: It might be limited, but as I noted in my answer, I bought a fixture several years ago that was all halogen GU24 (it was from Home Depot). They may finally be phased out (found several "Halogen replacement" LEDs), but they were out there for a long time
Answer: Without getting into how these fixtures are rated (you will find out soon) my answer to your three questions is "yes". Sockets will always have a higher rating than the fixtures that use them and it's the fixture rating that counts. Think of it like this: your car can go 100 miles per hour but you're on a winding road with cliffs on each side so the speed limit is 25. I wish I had a dime for every fixture I had to change because people used higher wattage bulbs than they were supposed to. In most cases it was the fixture wiring that failed.
Answer: This is the surest sign of your 13W limit: the GU24 plate here looks plastic

I bought a track light fixture for my previous house that had four GU24 halogen bulbs (50W). Those things got HOT. The socket, however, was ceramic inside a metal housing. It could survive the heat. Plastic here will not handle that.
Comment: The socket is probably telling you the watts the wiring can handle. For instance, Romex wire will tell you it can handle 600V, even though you're probably not going to have more than 240V running down any one given wire.
Comment: Are you 100% sure the size was GU *twenty-four*? There are many GU sizes, it is basically the distance between stud centers in mm.
Comment: I can't be 100% sure (I don't own the house anymore). There's an off-chance it was GU10. Same principle applies, tho. Ceramic base could handle it. This doesn't look ceramic.
Comment: GU10 has studs about 3/8" apart. GU24 is 1" apart.  It's analogous to Candelabra vs Normal Edison.
Comment: This makes sense, but the plate here (where it says "UL LISTED LAMPHOLDER 6G44"), also has 660 W written on it towards the left. Perhaps the 660 W is how much electricity the socket can handle, but it's not a reflection of the wattage of the light bulb to be installed in the socket...?
Comment: Thanks. Also, do you know why the plate says "6G44" instead of "GU24"?
Comment: It's just a different way to say GU24. Searching for that bulb, I found [GU24 bulbs](https://www.walmart.com/ip/13-Watt-Spiral-CFL-60W-Equal-4100K-Cool-White-GU24-Base-TCP-33113SP41K/53427490)
Answer: I just had an electrician in who removed the GU 24 using pliers he broke the shell and reached in with needle nose plies and was able to pull a white tab that released the socked.  I was amazed and could not wait to share.  I will be removing the rest by myself , so easy.
Comment: Have you burned down your house yet?


Using Numeric type-class in LMS (lightweight modular staging)

Question: Following the tutorial at:
https://github.com/julienrf/lms-tutorial/wiki
I have succesfully compiled and understood most of the code. While the concepts and examples are extremely sexy, i immediately wanted to change the code from hard-coding "Double" as the set of scalars into anything implementing the type-class Numeric[T] from the standard library. I was, however, unsuccessful.
I tried things like adding the following code to the LinearAlgebraExp trait:
<code>  override type Scalar = Double
  override type Vector = Seq[Scalar]
  implicit val num:Numeric[Scalar] = implicitly[Numeric[Scalar]]
</code>
Which did not work. My next (probably better idea) was to add implicit numeric arguments to any implementing function (i.e. all actual implementations of vector_scale). I still couldn't quite wrap my head around it due to exotic compile time errors.
Is there any support in LMS currently for using numeric types? Looking in the source of LMS, it seems like it might actually be a mess right now.
Answer: I reached some working code by adding a Manifest to the contextbounds in my program:
<code>import scala.virtualization.lms.common._

trait LinearAlgebra extends Base {

  type Vector[T]
  type Matrix[T]

  def vector_scale[T:Manifest:Numeric](v: Rep[Vector[T]], k: Rep[T]): Rep[Vector[T]]

  // Tensor product between 2 matrices
  def tensor_prod[T:Manifest:Numeric](A:Rep[Matrix[T]],B:Rep[Matrix[T]]):Rep[Matrix[T]]

  // Concrete syntax
  implicit class VectorOps[T:Numeric:Manifest](v: Rep[Vector[T]]) {
    def *(k: Rep[T]):Rep[Vector[T]] = vector_scale[T](v, k)
  }
  implicit class MatrixOps[T:Numeric:Manifest](A:Rep[Matrix[T]]) {
    def |*(B:Rep[Matrix[T]]):Rep[Matrix[T]] = tensor_prod(A,B)
  }

  implicit def any2rep[T:Manifest](t:T) = unit(t)

}

trait Interpreter extends Base {
  override type Rep[+A] = A
  override protected def unit[A: Manifest](a: A) = a
}

trait LinearAlgebraInterpreter extends LinearAlgebra with Interpreter {

  override type Vector[T] = Array[T]
  override type Matrix[T] = Array[Array[T]]
  override def vector_scale[T:Manifest](v: Vector[T], k: T)(implicit num:Numeric[T]):Rep[Vector[T]] =  v map {x => num.times(x,k)}
  def tensor_prod[T:Manifest](A:Matrix[T],B:Matrix[T])(implicit num:Numeric[T]):Matrix[T] = {
    def smm(s:T,m:Matrix[T]) = m.map(_.map(x => num.times(x,s)))
    def concat(A:Matrix[T],B:Matrix[T]) = (A,B).zipped.map(_++_)
    A flatMap (row => row map ( s => smm(s,B)) reduce concat)
  }
}

trait LinearAlgebraExp extends LinearAlgebra with BaseExp {
  // Here we say how a Rep[Vector] will be bound to a Array[Scalar] in regular Scala code
  override type Vector[T] = Array[T]
  type Matrix[T] = Array[Array[T]]

  // Reification of the concept of scaling a vector `v` by a factor `k`
  case class VectorScale[T:Manifest:Numeric](v: Exp[Vector[T]], k: Exp[T]) extends Def[Vector[T]]

  override def vector_scale[T:Manifest:Numeric](v: Exp[Vector[T]], k: Exp[T]) = toAtom(VectorScale(v, k))
  def tensor_prod[T:Manifest:Numeric](A:Rep[Matrix[T]],B:Rep[Matrix[T]]):Rep[Matrix[T]] = ???
}

trait ScalaGenLinearAlgebra extends ScalaGenBase {
  // This code generator works with IR nodes defined by the LinearAlgebraExp trait
  val IR: LinearAlgebraExp
  import IR._

  override def emitNode(sym: Sym[Any], node: Def[Any]): Unit = node match {
    case VectorScale(v, k) => {
      emitValDef(sym, quote(v) + ".map(x => x * " + quote(k) + ")")
    }
    case _ => super.emitNode(sym, node)
  }
}

trait LinearAlgebraExpOpt extends LinearAlgebraExp {
  override def vector_scale[T:Manifest:Numeric](v: Exp[Vector[T]], k: Exp[T]) = k match {
    case Const(1.0) => v
    case _ => super.vector_scale(v, k)
  }
}

trait Prog extends LinearAlgebra {
  def f[T:Manifest](v: Rep[Vector[T]])(implicit num:Numeric[T]): Rep[Vector[T]] = v * unit(num.fromInt(3))
  def g[T:Manifest](v: Rep[Vector[T]])(implicit num:Numeric[T]): Rep[Vector[T]] = v * unit(num.fromInt(1))
  //def h(A:Rep[Matrix],B:Rep[Matrix]):Rep[Matrix] = A |* B

}

object TestLinAlg extends App {

  val interpretedProg = new Prog with LinearAlgebraInterpreter {
    println(g(Array(1.0, 2.0)).mkString(","))
  }

  val optProg = new Prog with LinearAlgebraExpOpt with EffectExp with CompileScala { self =>
    override val codegen = new ScalaGenEffect with ScalaGenLinearAlgebra { val IR: self.type = self }
    codegen.emitSource(g[Double], "optimizedG", new java.io.PrintWriter(System.out))
  }

  val nonOptProg = new Prog with LinearAlgebraExp with EffectExp with CompileScala { self =>
    override val codegen = new ScalaGenEffect with ScalaGenLinearAlgebra { val IR: self.type = self }
    codegen.emitSource(g[Double], "nonOptimizedG", new java.io.PrintWriter(System.out))
  }

  def compareInterpCompiled = {
    val optcomp = optProg.compile(optProg.g[Double])
    val nonOptComp = nonOptProg.compile(nonOptProg.g[Double])
    val a = Array(1.0,2.0)
    optcomp(a).toList == nonOptComp(a).toList
  }

  println(compareInterpCompiled)

}
</code>
My goal was to use the example at https://github.com/julienrf/lms-tutorial/wiki and then modify it to use numeric types instead. I wanted to discover that the overhead from passing the implicit type-class was totally stripped. The (successful) output from the above program is here.
We see that the call to num.times is indeed stripped