text:
Q: zlib build not configuring properly with cross compiler, ignores AR? I am trying to cross-compile zlib for an ARM processor using crosstool-ng, and its resulting compiler arm-linux-gnueabihf-gcc.  I set the CC variable to use the cross compiler, as well as AR and RANLIB, then I run them with ./configure as follows:
CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar RANLIB=arm-linux-gnueabihf-ranlib LDSHARED="arm-linux-gnueabihf-gcc -shared -Wl,-soname,libz.so.1" ./configure --shared --prefix=/usr

The problem is that it spits out a Makefile without the AR variable I had set, instead it has AR set to libtool, which is for my native Mac machine.  Here is what the Makefile has set:
AR=libtool
ARFLAGS=-o
RANLIB=ranlib

I can manually edit the Makefile and change AR=arm-linux-gnueabihf-ar and ARFLAGS=rcs which fixes the build.  But that is a hack to me.  Here is the configure script:
http://pastebin.com/trmJbPKb
Does anyone see anything wrong with how I run the configure command?

A: Try it with CHOST=arm-linux-gnueabihf instead of setting CC, AR, etc.  That will prefix the commands with that string.


text:
Q: Swift : How to refactor my code using more elegant approach? I wrote a piece of code that creates an array of objects based on the array of dictionaries. The problem is my solution, it's written in very noob way using multiple loops imperatively.
Let's consider the following case. There is a class called "Drug"
class Drug {

var name:String
var dosage:[(dose:String,time:String)]

init(name:String){

    self.name = name
    self.dosage = []
    }
}

I obtain the data as an array of dictionaries, here is the example:
var array = [["drugName":"Amotaks", "time":"17.00", "dose":"5"], ["drugName":"Amotaks", "time":"18.00", "dose":"5"], ["drugName":"Amotaks", "time":"18.00", "dose":"5"], ["drugName":"Amotaks", "time":"17.00", "dose":"5"], ["drugName":"Claritin", "time":"17.00", "dose":"5"], ["drugName":"Claritin", "time":"18.00", "dose":"5"]]

Now is the tricky part, what is the best way to turn this data into an array of Drug objects? I am not glad of my solution because it uses nested loops, additional helper arrays thus it's very inefficient.
The purpose is to create objects without repeating their names and provide each object with an dosage array which consist of (dose, time) tuples)
var DrugArray:[Drug] = []
    var drugs:[String] = []

    for i in array

        {
        if contains(drugs, i["drugName"]! as String){
            continue
            }
        else{

            drugs.append(i["drugName"]!)
            DrugArray.append(Drug(name: i["drugName"]!))

            }

        }

    for a in DrugArray{

        for i in array {
            if i["drugName"]! == a.name
            {
                a.dosage.append(dose: i["dose"]!, time: i["time"]!)

            }

        }}

I believe there is a better way to do that, probably in a few lines of code. I tried to figure out something with basic FP functions such as map or filter but I end up with nothing.
My question is: How to perform the operation coded above in elegant way(probably using more advanced fuctional programming)?

A: So at first, you should restructure your objects little better, so it is easier and more readable, possibly like this:
struct Dosage {

    // Declare variables
    let dose : String
    let time : String

    // Get dosage from drug data
    init(drugData : DrugData) {
        self.dose = drugData["dose"]!
        self.time = drugData["time"]!
    }
}

class Drug {

    let name : String
    var dosage = [Dosage]()

    init(drugData : DrugData) {

        // Assign name
        self.name = drugData["dose"]!

        // Append dosage
        self.appendDosage(drugData)
    }

    func appendDosage(drugData : DrugData) {

        self.dosage.append(Dosage(drugData: drugData))
    }
}

Notice that I am using TypeAlias which masks definition of your dictionary, like this:
typealias DrugData = [String : String]

Define your storage for drugs:
var drugs = [String : Drug]()

Now when you have definitions all sorted out, you can improve your algorithm:
func createDrugs() {

    // Your drug definitions
    var array = [["drugName":"Amotaks", "time":"17.00", "dose":"5"]]

    // Iterate through them
    for drugDefinition in array {

        // Check if there is a name, if yes, get it
        if let name = drugDefinition["drugName"] {

            // If drug exists, just update it, otherwise create it
            if let drug = drugs[name] {
                drug.appendDosage(drugDefinition)
            } else {
                drugs[name] = Drug(drugData: drugDefinition)
            }
        }
    }
}

As you can see, I used dictionary that uses drug name as the key. Searching using key is extremely fast, much faster than iterating through entire array.I believe there is many more possibilities for improvement, but I think that is for you now :) Hope it helps!

A: First, let's make it possible to see how we're doing by making your Drug class printable:
class Drug : CustomStringConvertible {

    var name:String
    var dosage:[(dose:String,time:String)]

    init(name:String){
        self.name = name
        self.dosage = []
    }

    var description:String {
        return "\(name):\(dosage)"
    }
}

Then here's my first attempt:
let array = [["drugName":"Amotaks", "time":"17.00", "dose":"5"], ["drugName":"Amotaks", "time":"18.00", "dose":"5"], ["drugName":"Amotaks", "time":"18.00", "dose":"5"], ["drugName":"Amotaks", "time":"17.00", "dose":"5"], ["drugName":"Claritin", "time":"17.00", "dose":"5"], ["drugName":"Claritin", "time":"18.00", "dose":"5"]]

var d = [String:Drug]()
for drug in array.map ({
    d -> Drug in
    let drug = Drug(name:d["drugName"]!)
    drug.dosage = [(dose:d["dose"]!, time:d["time"]!)]
    return drug
}) {
    let name = drug.name
    if d[name] == nil {
        d[name] = drug
    } else {
        d[name]!.dosage += drug.dosage
    }
}

let result = Array(d.values)
print(result)
// [Claritin:[("5", "17.00"), ("5", "18.00")], Amotaks:[("5", "17.00"), ("5", "18.00"), ("5", "18.00"), ("5", "17.00")]]

redpajama_set_name: RedPajamaStackExchange


text:
Q: Converting JSON string to another format I have a json in the following format, I want to convert this JSON into the format mentioned at the end of the question. I want to use only javascript to do this conversion and not any other tools like Gson or service side Java code. Please let me know how this can be achieved.
 [{
    "innNumber": {
        "id": "0111",
        "idAsLong": 111,
        "idWithoutZero": "111"
    },
    "nightlyRates": [{
        "date": "2017-02-09",
        "nightlyRate": {
            "amount": 155.85,
            "currencyCode": "CAD"
        },
        "points": 0
    }]
}, {
    "innNumber": {
        "id": "0111",
        "idAsLong": 111,
        "idWithoutZero": "111"
    },
    "nightlyRates": [{
        "date": "2017-02-09",
        "nightlyRate": {
            "amount": 155.85,
            "currencyCode": "CAD"
        },
        "points": 0
    }]

}]

JSON Response that is to be in the following required format.
    [{"hotelRoomRate":{
    "innNumber": {
        "id": "0111",
        "idAsLong": 111,
        "idWithoutZero": "111"
    },
    "nightlyRates": [{
        "date": "2017-02-09",
        "nightlyRate": {
            "amount": 155.85,
            "currencyCode": "CAD"
        },
        "points": 0
    }]

  }
},
{"hotelRoomRate":
  {
    "innNumber": {
        "id": "0111",
        "idAsLong": 111,
        "idWithoutZero": "111"
    },
    "nightlyRates": [{
        "date": "2017-02-09",
        "nightlyRate": {
            "amount": 155.85,
            "currencyCode": "CAD"
        },
        "points": 0
    }]

}
}]

A: A simple map() will do it
var res = data.map(function(item){
   return { hotelRoomRate : item};
});

A: This is how I would do it...
    var JsonData = [{
        "innNumber": {
            "id": "0111",
            "idAsLong": 111,
            "idWithoutZero": "111"
        },
        "nightlyRates": [{
            "date": "2017-02-09",
            "nightlyRate": {
                "amount": 155.85,
                "currencyCode": "CAD"
            },
            "points": 0
        }]
    }, {
        "innNumber": {
            "id": "0111",
            "idAsLong": 111,
            "idWithoutZero": "111"
        },
        "nightlyRates": [{
            "date": "2017-02-09",
            "nightlyRate": {
                "amount": 155.85,
                "currencyCode": "CAD"
            },
            "points": 0
        }]

    }]

var newFormat = [];

for(var i =0; i < JsonData.length; i ++){
   newFormat.push({"hotelRoomRate" : JsonData[i]})
}

console.log(newFormat)

Hope this helps


text:
Q: Just use one single math symbol without loading a whole font How can I change the code above to obtain the glyph without loading several fonts?.. If it is possible. :-)
\documentclass[12pt]{article}

% Source: https://tex.stackexchange.com/a/40767/6880
\newcommand{\PrintMathFonts}{%
  \count255=0
  \loop\ifnum\count255<16
    (\the\count255:~\fontname\textfont\count255)

    \advance\count255 by 1
 \repeat}

\DeclareFontFamily{U}{mathb}{}
\DeclareFontShape{U}{mathb}{m}{n}{
  <-5.5> mathb5
  <5.5-6.5> mathb6
  <6.5-7.5> mathb7
  <7.5-8.5> mathb8
  <8.5-9.5> mathb9
  <9.5-11> mathb10
  <11-> mathb12
}{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
\DeclareFontSubstitution{U}{mathb}{m}{n}

\DeclareMathSymbol{\test}{3}{mathb}{"D8}

\begin{document}

\PrintMathFonts

$\test$

\PrintMathFonts
\end{document}

A: You can not load a partial font so the answer to the question in the title is that it can not be done, to access a glyph you have to load the full font.
However, the implied question in the code (and in your related parallel question) is not to avoid loading a font but to keep within the classic tex limit of 16 font families in any given math expression.
When viewed from the position of using up \fam slots the code you show is fairly minimal, it only uses one slot (mathb) which is the least you can do if adding a new math symbol font.
The alternatives are to declare a math alphabet rather than a math symbol font, math alphabets only use a slot if they are actually used not when they are declared so you can declare more than 16 math alphabets as long as you do not use them all.
Or you can (at some cost to the macro complexity and loss of control over the positioning of subscripts and superscripts) use a text font rather than a math font.
So in short "without loading several fonts?" seems to be a misunderstanding. The code you show only uses one math family not several, and that is the count that matters, not that it uses several fonts for different sizes.


text:
Q: Adjust cellsize for fit all screens? I'm trying to fit my app to all screensize, however I can't figure out how to. Is it possible to resize the cell depending on the screen? At the moment I just configure my UICollectionView as followed:
 func numberOfSections(in collectionView: UICollectionView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of items
        return fields.count
    }

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! FieldDistributionCollectionViewCell

        cell.frame.size = CGSize(width: ?, height: ?)
        return cell
    }

Is there a recommended way? Or do I need to determine the version of the phone and set the size manually? On the smaller screen (4, 4s) I only want 2 columns, but 3 columns on the (5, 5s, 6, 6s). I basically just want the cell size to fit the right resolution.

A: Try this Code:
Implement the following functions from collectionView's protocol:
  // cell size
 func collectionView(collectionView: UICollectionView,
    layout collectionViewLayout: UICollectionViewLayout,
    sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {

  // To get 1 column
 return CGSize(width: view.frame.size.width, height: view.frame.size.width)

 // To get 2 column
 //return CGSize(width: view.frame.size.width/2, height: view.frame.size.width/2)

 // To get 3 column
 // return CGSize(width: view.frame.size.width/3, height: view.frame.size.width/3)

 // Toget 4 column
 // return CGSize(width: view.frame.size.width/4, height: view.frame.size.width/4)
  }

...where view is your controller's (super) view
 // inter-spacing

func collectionView(collectionView: UICollectionView,
    layout collectionViewLayout: UICollectionViewLayout,
    minimumInteritemSpacingForSectionAtIndex section: Int) -> CGFloat {
return 2.0
}

// line-spacing

func collectionView(collectionView: UICollectionView, layout
    collectionViewLayout: UICollectionViewLayout,
    minimumLineSpacingForSectionAtIndex section: Int) -> CGFloat {
return 2.0
}

CollectionView layout principle.

A: Drag the collectionViewFlowLayout from the document outline in interface builder into your code to create an outlet.  In ViewDidLayoutSubviews (this when you know your frame width) set the width and height:
    //MARK: IBOutlet
    @IBOutlet weak var collectionViewFlowLayout: UICollectionViewFlowLayout!

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        let width = collectionView.frame.size.width - collectionViewFlowLayout.sectionInset.left - collectionViewFlowLayout.sectionInset.right
        collectionViewFlowLayout.itemSize = CGSize(width: width, height: width)
    }


text:
Q: Mac OSX Snow Leopard FTP So here is the issue. A client of mine is using Mac OSX Snow Leopard as his web server. He has multiple clients, and sites, etc. He also has multiple designers who access the system.
He has a user who he has locked down to certain directories (for sites he only works on). When the user uploads his files, my client has to go in a root to set the owner to _www so that Apache will have permissions to run the files.
What he'd like to know is remove the need to constantly have to go in behind the user to propagate the permissions on the files. In Windows, he is just using Filezilla without a problem since the user isn't integrated into the OS.
Any ideas how to accomplish this?

A: I don't have a mac system handy to verify but...
In Linux, I'd use the SGID bit on the directory and make the directory group the group Apache runs under. All files created in that directory will have the group automatically set to the directory group, and hence will be readable to Apache. No changing of permissions involved.

A: Set the group permissions of the directory to SGID (chmod g+s dirname), and the group of every newly created file or subdirectoy will be inherited to be _www.
But you have to do this for every existing subdirectory, as the SGID bit is not propagated to already existing subdirectories.
chgrp -R _www path/to/userdir
find /path/to/userdir -type d -print0 | xargs -0 chmod g+s


text:
Q: Why django-rest-framework doesn't display OneToOneField data - django I want to set up restful API in my site. I used django-rest-framework.
When I get an object from database, it doesn't show related object.
Below snippet is my first model (parent model):
class Profile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='profile',on_delete=models.CASCADE)
    name = models.CharField(max_length=30)
    family = models.CharField(max_length=50)

and the below snippet is my second model (child model):
class Klass(models.Model):
    title = models.CharField(max_length=50)
    description = models.CharField(max_length=500)
    teacher = models.ForeignKey(Profile,related_name='teacher', on_delete=models.CASCADE)
    university = models.CharField(max_length=50, blank=True, null=True)

as you see in the second snippet, the teacher gets its value from Profile model.
But in django-rest-framework API view, instead of displaying the teahcer's name, it displays the pk.
The below snippets is my serializer and view:
# serializer
class KlassSerializer(serializers.ModelSerializer):

    class Meta:
        model = Klass
        fields = ('id', 'title', 'description', 'teacher')

# view
class KlassView(APIView):

    def get(self, request, pk=None):
        if pk is not None:
            klass = Klass.objects.filter(pk=pk).get()
            serializer = KlassSerializer(klass)
            return Response({'message': 'class get ', 'data': serializer.data,})

and this is the result:
{
    "message": "class get ",
    "data": {
        "id": 13,
        "title": "ُThe First Class",
        "description": "Nothing for now!",
        "teacher": 2
    }
}

How can I solve the problem?
thanks

A: try it, more detaile nested-relationships
class TeacherSerializer(serializers.ModelSerializer):

    class Meta:
        model = Profile
        fields = ('name')

class KlassSerializer(serializers.ModelSerializer):
    teacher = TeacherSerializer(read_only=True)

    class Meta:
        model = Klass
        fields = ('id', 'title', 'description', 'teacher')


text:
Q: Make this seats busy I have 2 tables in my DATABASE. First table is table of seats that consists of row, seat and availability. Second table is table of tickets that consists of purchased seats.
 - CREATE TABLE Seats(
Seat INT,
Row INT,
Availability BIT)
 - INSERT INTO Seats VALUES (1,1,1), (2,1,1), (1,2,1), (2,2,1)
 - CREATE TABLE Purchased(
Seat INT,
Row INT)
- INSERT INTO Purchased VALUES (1,1), (2,2)

I want to change availability to 0 for seat that are in Purchased table without repeating UPDATE ... SET...WHERE several times.
The result need to be
- SEATS = (1,1,0), (2,1,1), (1,2,1), (2,2,0)

A: You can use Update and Join together for this.
For MySql;
update Seats s
inner join Purchased p on s.Seat = p.Seat and s.Row = p.Row
set s.Availability = 0;

For SQL Server;
update s
set s.Availability = 0
from Seats s
inner join Purchased p on s.Seat = p.Seat and s.Row = p.Row


text:
Q: What is the fastest way to compute sum of weighted products between columns? np.random.seed([3, 14])
df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC'))
df

          A         B         C
0 -0.602923 -0.402655  0.302329
1 -0.524349  0.543843  0.013135
2 -0.326498  1.385076 -0.132454
3 -0.407863  1.302895 -0.604236
4 -0.243362 -0.211261 -2.056621

What is the fastest way to compute df.A * 1 + df.B * 2 + df.C * 3?
Essentially, I want, for this dataframe:
0   -0.501247
1    0.602741
2    2.046290
3    0.385219
4   -6.835748

The answer cannot be df.A * 1 + df.B * 2 + df.C * 3 since the number of columns must not be hardcoded. So, I'd want  to compute df.iloc[:, 0] * 1 + df.iloc[:, 1] * 2, .... somehow.
I'd be interested in any numba solutions out there too!

A: I try improve solution - remove reshape and change arrange:
a = df.dot(np.arange(1, len(df.columns)+1))
print (a)
0   -0.501247
1    0.602741
2    2.046290
3    0.385219
4   -6.835748
dtype: float64

Same in numpy:
a = pd.Series(np.dot(df.values, np.arange(1, len(df.columns)+1)), index=df.index)
print (a)
0   -0.501247
1    0.602741
2    2.046290
3    0.385219
4   -6.835748
dtype: float64

A: Option 1
The fastest, to my knowledge, would be using df.dot.
df.dot((np.arange(df.shape[1]) + 1).reshape(-1, 1))

          0
0 -0.501247
1  0.602741
2  2.046290
3  0.385219
4 -6.835748

Option 2
Element wise product and sum along first axis
(df * (np.arange(df.shape[1]) + 1)).sum(1)

0   -0.501246
1    0.602742
2    2.046292
3    0.385219
4   -6.835747

Performance
Small (5 x 3)
10000 loops, best of 3: 131 µs per loop  # dot
1000 loops, best of 3: 531 µs per loop   # element-wise prod + sum

Large (100000 x 1000)
10 loops, best of 3: 36.4 ms per loop   # dot
1 loop, best of 3: 1.18 s per loop      # element-wise prod + sum

For information on the magic behind the implementation of pandas/numpy's dot function, you may look at Why is matrix multiplication faster with numpy than with ctypes in Python?.


text:
Q: Strange JUnit/Google Endpoint test result I have the below test method to test the creation of the Partner entity in Objectify datastore.
I got the DuplicateRecordException as excepted, but when I try to retrieve the entity (any entity in that Class) and I got a null.  Any idea what I missed?
NOTE: I launched the local API explorer to test the createPartner() method and it just fine.
@Test
public void  testCreatePartner(){
    try {
        Partner p = createPartner(instID, displayName, new Text(aboutMe));
        createPartner(instID, displayName, newText(aboutMe));

        assertNull(p);

    } catch (DuplicateRecordException | MissingIDException | FailToSaveRecordException e) {
        //e.printStackTrace();
        log.severe("======> "+e.getMessage());
        Partner q = OfyController.ofy().load().type(Partner.class).first().now();

        if (q!=null) {
            log.info("------>>" + q.getDisplayName());
        }
    }
}

A: Solved it!
I also had this:
new LocalDatastoreServiceTestConfig().setDefaultHighRepJobPolicyUnappliedJobPercentage(100)

I change 100 to 1 and it worked.


text:
Q: git pull -v: up to date but isn't I want to know if my branches are synced with the remote:
git pull -v
From ...
 = [up to date]      master     -> origin/master
 = [up to date]      release    -> origin/release

I read the above output like: OK, release branch is up to date.
But git diff release origin/release shows that there are differences.
Is the output of git pull -v correct?

A: git pull does two things: fetch and merge.
The above output ("up to date") means: The fetch is up to date. But attention: the merge was not done yet.
With git branch -av you get a better output:
git branch -av
  release                4fa0a21 [behind 6] changed version from 2014.10 to 2014.11 in setup.py
  remotes/origin/release 4011230 changed version from 2014.12 to 2014.13 in setup.py


text:
Q: Why Storm supervisors shutting down automatically I have configured Storm cluster of 1 nimbus, 1 zookeeper, 1 supervisor on single node cluster.  My Nimbus and UI are working fine but supervisor is not working as expected and it is showing in UI for only few minutes.
Following are my supervisor logs
[31/10/14 05:46:00:000 IST]  INFO daemon.supervisor: 11f31d37-a7a1-4b91-b014-a49d7a65c9e0 still hasn't started
[31/10/14 05:46:01:001 IST]  INFO daemon.supervisor: 11f31d37-a7a1-4b91-b014-a49d7a65c9e0 still hasn't started
[31/10/14 05:46:01:001 IST]  INFO daemon.supervisor: 11f31d37-a7a1-4b91-b014-a49d7a65c9e0 still hasn't started
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Worker 11f31d37-a7a1-4b91-b014-a49d7a65c9e0 failed to start
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Worker 23cb938b-9295-4aea-b0dc-030afaef737c failed to start
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Worker cd25c3c8-6e0f-4bc5-88d4-687c17de582c failed to start
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Worker e71816a2-0231-4dee-9423-ff02231e6b6f failed to start
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Shutting down and clearing state for id 11f31d37-a7a1-4b91-b014-a49d7a65c9e0. Current supervisor time: 1414757762. State: :not-started, Heartbeat: nil
[31/10/14 05:46:02:002 IST]  INFO daemon.supervisor: Shutting down 4783ca79-02d2-4df5-b196-d83670af60a4:11f31d37-a7a1-4b91-b014-a49d7a65c9e0
ERROR: The process "9000" not found.
[31/10/14 05:46:04:004 IST]  INFO storm.util: Error when trying to kill 9000. Process is probably already dead.
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shut down 4783ca79-02d2-4df5-b196-d83670af60a4:11f31d37-a7a1-4b91-b014-a49d7a65c9e0
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shutting down and clearing state for id 23cb938b-9295-4aea-b0dc-030afaef737c. Current supervisor time: 1414757762. State: :not-started, Heartbeat: nil
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shutting down 4783ca79-02d2-4df5-b196-d83670af60a4:23cb938b-9295-4aea-b0dc-030afaef737c
ERROR: The process "9060" not found.
[31/10/14 05:46:04:004 IST]  INFO storm.util: Error when trying to kill 9060. Process is probably already dead.
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shut down 4783ca79-02d2-4df5-b196-d83670af60a4:23cb938b-9295-4aea-b0dc-030afaef737c
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shutting down and clearing state for id cd25c3c8-6e0f-4bc5-88d4-687c17de582c. Current supervisor time: 1414757762. State: :not-started, Heartbeat: nil
[31/10/14 05:46:04:004 IST]  INFO daemon.supervisor: Shutting down 4783ca79-02d2-4df5-b196-d83670af60a4:cd25c3c8-6e0f-4bc5-88d4-687c17de582c
ERROR: The process "9172" not found.
[31/10/14 05:46:05:005 IST]  INFO storm.util: Error when trying to kill 9172. Process is probably already dead.
[31/10/14 05:46:05:005 IST]  INFO daemon.supervisor: Shut down 4783ca79-02d2-4df5-b196-d83670af60a4:cd25c3c8-6e0f-4bc5-88d4-687c17de582c
[31/10/14 05:46:05:005 IST]  INFO daemon.supervisor: Shutting down and clearing state for id e71816a2-0231-4dee-9423-ff02231e6b6f. Current supervisor time: 1414757762. State: :not-started, Heartbeat: nil
[31/10/14 05:46:05:005 IST]  INFO daemon.supervisor: Shutting down 4783ca79-02d2-4df5-b196-d83670af60a4:e71816a2-0231-4dee-9423-ff02231e6b6f
ERROR: The process "7604" not found.


text:
Q: Real time sum every on change and how to process it with ajax php mysql First of all, i hope u guys would to read it untill the end. I really need help for my problem cuz i've been search for it and still have no idea.

Based on that picture, the first 'Product & Total Product' element is static in add-order.php file. And the second 'Product & Total Product' element is created by clicking the plus button. Here's the code:
let counter = 1;
$("#add-button").click(function () {
    event.preventDefault();
    counter++;
    let newSubjectField =  `

                                        Product
                                        <select class="form-control" name="product_id[]" id="product_id${counter}">
                                            <option value="">Pilih</option>
                                            <?php
                                                $sql = mysqli_query($con, "SELECT * FROM product ORDER BY id ASC");
                                                while($data = mysqli_fetch_array($sql)){
                                            ?>
                                            <option value="<?php echo $data['id']; ?>"><?php echo $data['name']; ?></option>
                                            <?php } ?>
                                        </select>

                                        Total Product
                                        <input type="number" class="form-control total_product${counter}" name="total_product[]" id="total_product${counter}" placeholder="Jumlah" />

`;
    $('#form-products').append(newSubjectField);
});

So, my problem is I couldn't show total price from all product there. In that picture, total price is only show the 1st Product's price * its quantity (Ex: 15000 * 3 = 45000). I want when I type the quantity of second product, the total price is change in real time, shows the total of all products (Ex: (1st Product's price * its quantity) + 2nd Product's price * its quantity).
Anyway, it's not always have two product like the example in that picture. It might have more than it depending on how many plus button clicked. So, i want the Total Price always change its value everytime i choose the next product + its quantity.
Here are what i've did so far:
$('.total_product').on('keyup', function(){
    var data_total = $('#product_id').val();
    var total_product = $('.total_product').val();
    console.log(total_product);
    $.ajax({
        type: 'get',
        url: 'ajax-total.php',
        data: {
            'data_total': data_total,
            'total_product': total_product,
        },
        success: function(data){
            var json = data,
            obj = JSON.parse(json);
            console.log(data);
            $('#total').val(obj.total);
        }
    });
});

<?php
    include '../connection.php';

    $data_total = $_GET['data_total'];
    $total_product = $_GET['total_product'];
    $query = mysqli_query($connection, "SELECT sale_price FROM product WHERE id='$data_total'");
    $row = mysqli_fetch_assoc($query);

    $total = (int)$row['sale_price'] * (int)$total_product;

    $data = array(
            'total'   =>   $total);

     echo json_encode($data);
?>

I hope you guys would to help me for this issue. Thank you so much in advance.

A: You can try to show the price on change of the select box if there are multiple boxes.
like create a method to calculate the pricing, I am assuming you have price column in you table in products.. ---
-- while add the add button try this code ---
let counter = 1;
$("#add-button").click(function () {
    event.preventDefault();
    counter++;
    let newSubjectField =  `

                                        Product
                                        <select class="form-control product-name" name="product_id[]" id="product_id${counter}" onChange="calPrice()">
                                            <option value="">Pilih</option>
                                            <?php
                                                $sql = mysqli_query($con, "SELECT * FROM product ORDER BY id ASC");
                                                while($data = mysqli_fetch_array($sql)){
                                            ?>
                                            <option value="<?php echo $data['id']; ?>" data-price="<?php echo $data['price']; ?>"><?php echo $data['name']; ?></option>
                                            <?php } ?>
                                        </select>

                                        Total Product
                                        <input type="number" class="form-control total_product${counter}" name="total_product[]" id="total_product${counter}" placeholder="Jumlah" />

`;
    $('#form-products').append(newSubjectField);
});

and then use js code to get the price ---
function calPrice(){
  var totalPrice = 0;
$(".product-name").each(function(i,v){
   totalPrice += $(v).find('option:selected').data('price');
});

//then show the price in the box --
$("#total_price").val(totalPrice);
}

Lets check if it works for you....


text:
Q: How to change columns distance?
Possible Duplicate:
Setting the column gap in a twocolumn document

How can I change the distance of two columns in a two-column document?

A: Here is the internal definition of \twocolumn. In this definition you can see all length which are use.
\def \twocolumn {%
  \clearpage
  \global\columnwidth\textwidth
  \global\advance\columnwidth-\columnsep
  \global\divide\columnwidth\tw@
  \global\hsize\columnwidth
  \global\linewidth\columnwidth
  \global\@twocolumntrue
  \global\@firstcolumntrue
  \col@number \tw@
  \@ifnextchar [\@topnewpage\@floatplacement
}

Taken from latex.ltx
You are looking for \columnsep.


text:
Q: Partial implicit differentiation question help - Solved I doing some multivariable calculus work and was struggling with the following question.
Given:
$$
e^{7z} = xyz
$$
The task is to compute the partial derivatives dz/dx and dz/dy using implicit differentiation.
My solution is now as follows:
$$
(dz/dx) 7e^{7z} = yz + (dz/dx)xy
$$
And so,
$$
(dz/dx) (7e^{7z}-xy) = yz
$$
Therefore correct answer is,
$$
\frac{dz}{dx} = \frac{yz}{(7e^{7z}-xy)}
$$

A: Since there are three variables so it will be differentiated by product rule i.e.
$\frac{dz}{dx}7e^{7z}= yz+ \frac{dy}{dx}xz+ \frac{dz}{dx}xy$


text:
Q: Firebase Batch Writes I have a flutter app where I'm fetching a List of names based on a certain condition from a top-level collection called /students and displaying it one of my screens.
Now I want the user to select these names, with a CheckBoxListTile and then confirm to add these selected names into a deeply nested subcollection of /departments/cse/2017/6 B 17/students/, how do I accomplish this in an efficient way?
I basically want to write all the documents at once into the sub-collection from my  List <Student> selectedStudents while maintaining their firebase userId as the docuemntId in that collection of students.

A: In Firestore writes are counted in a way that each document will count as one write.
therefor the objective of not hitting a limit will not happen.


text:
Q: Update Proceduce in MySQL database I am learning about MySQL database and I have writed a update data proceduce like this:
CREATE DEFINER = 'root'@'localhost'
PROCEDURE bbet.Proc_usertable_UpdateUserInfomation(IN account VARCHAR(20),
IN accountMoney float,
IN password VARCHAR(20),
IN phoneNumber VARCHAR(20),
IN email VARCHAR(250),
IN name varchar(20),
IN userID varchar(36))
'
BEGIN
UPDATE usertable u
SET u.AccountMoney = accountMoney,
    u.Email = email,
    u.PhoneNumber = phoneNumber,
    u.Password = password,
    u.Name = name,
    u.ModifiedDate = NOW()
WHERE u.UserID = userID;
END

But I realize, in some case, we dont need to pass all parameter to proceduce because we just need update some infomation.
How can I detect what parameter I have passed and update them?
How can I handle this problem?


text:
Q: Server cant handle Search Results (grails) I have a List which shows Users
<g:form action="listUsers">
   <g:select id="userListe" name="selectedUser" size="10" onchange="this.form.submit()"
             from="${users.idToShow}"
             value="${selectedUser.idToShow}"/>//edit: idToShow, not itToShow
   </g:form>

I implemented a search function with JQuery, this one works so far
$(function() {
   //When user types, start searching
   $('#userSearch').keyup(function() {
      $.post(search_url, { query: this.value  },
         //data stores the found values from server (works)
         function(data) {

            //first, remove all the values from the userList
            $('#userListe').find('option').remove();

            //split userID and Value, not important
            var userArray = data.split(";");
            for (var i = 0; i < userArray.length; i++) {

               //split userID and Value, not important
               var name = userArray[i].split(':')[0]
               var id = userArray[i].split(':')[1]

               /*
                * This Line solves the problem. Now the Server knows it´s a User
                */
                $j('#userListe').append('<option value="'+name+'">'+name+'</option>'
         });
   });
})

The search shows the correct User, but if I click on one (to change values for example), the server doesnt know it's a User, and just shows a null pointer exception.
I know this is kinda interdisciplinary stuff and maybe a bit to large for a support question, but Ill be happy about any small clue.
Thanks a lot, Daniel
method listUsers:
    def listUsers = {

    def foundUsers
    def users

    def selectedUser

    foundUsers = User.list()
    users = User.list(fetch: [User: foundUsers.IdToShow])
    users.sort {it.IdToShow}

    selectedUser = users.get(0)

    if (params.selectedUser) {
        selectedUser = User.findByIdToShow(params.selectedUser)
    }

    [users: users, selectedUser: selectedUser]


text:
Q: push flow relabel algorithm A valid labelling of the vertices in V wrt. a preflow x is a function d[.] : V -> Z satisfying:
d[s] = n ^ d[t] = 0
for all (v,w) belong to E : d[v] <= d[w] + 1
supposed we have 4 verticies including (s and t)
then we have d[s] = 4
according to valid labeling we should have d[v] <= d[w]+1, but for edges which are coming from 's', it is not
valid because 4 <= 1 is false. Is this logic is not only source?
Am I understading it right? Please correct me.
Thanks for your time and help

A: Your definition of a valid labelling is close, but not quite correct.
You claim that d[v] <= d[w] + 1 for all (v,w) belonging to E.
However, this actually only needs to be true for all (v,w) belonging to R, where R is a residual edge.
A residual edge is an edge where the current flow is less than the capacity on the edge.
There is a good explanation at topcoder.
Consider this diagram:

In the labels on the edges (such as 2/3) the first number gives the current flow, and the second number gives the capacity of the edge.
The numbers on the nodes give the height function d for each node.
The green edges are the residual edges because they have spare capacity.
So to check the height constraint we only need to check the S->A edge, and the B->T edge.


text:
Q: npm run Lifecycle scripts included in project: test echo "Error: no test specified" && exit 1 I am trying to develop a springboot/react app and have installed react and created the react project. However when I try to execute:
npm run

I get the following error:
Lifecycle scripts included in project:
  test
    echo "Error: no test specified" && exit 1

I also installed jest I believe and when I go to package.json:
I have changed the test: to "jest"
"scripts": {
 "start": "react-scripts start",
 "build": "react-scripts build",
 "test": "jest",
 "eject": "react-scripts eject"
}

I also tried when it was just "react-scripts test" and that gave me the same error.
Any help would be greatly appreciated, thanks.

A: Try running npm start or npm test.


text:
Q: Can System.Web be used with ASP.Net Core with Full Framework We are running serveral sites based on different .Net versions.
One of the sites is running .Net 4.6 and ASP.Net MVC 5.xx
To use the new syntax for Razor  we want to upgrade this site to use .Net 4.6 and ASP.Net Core
We use FormsAuthentication on our sites, and we will continue using that so user can move between sites. (one of the sites is a SharePoint site running FormsAuthentication)
We understand that ASP.Net Core is not using anything from System.Web but we need to use that from controllers (to create FormsAuthentication cookie during login) and from HttpModule to verify cookie.
I have not been able to find any example how to use system.web from a site running ASP.Net Core with Full framwork. I have not been able to add dependency for system.web in project.json.
Questions.

*

*Is it possible to use system.web from a setup like this?

*How can we add dependency to system.web so System.Web.FormsAuthentication is available from ASP.NET MVC 6. (Controllers/ http module)

A: Using the System.Web dll isn't the same as using System.Web. None of the System.Web pipeline will run for your ASP.NET Core application so you can't do what you are trying to do.

A: That may not work the way you think.  When you use .Net Core MVC against the full framework it's true that the System.Web namespace exists and could technically be called but it won't work like you want.  The reason is that the request pipeline for Asp.Net Core and System.Web are totally different.  So for example when using Asp.Net Core MVC if you check the HttpContext object from when a request comes in it will be populated with all the information you expect but if you check for the current request using System.Web objects you will see that their is no current request.  That's because the current request didn't come in via the System.Web pipeline.  It came in through the .Net Core "pipeline" if you will.  So if you are using .Net Core MVC you will need to stick with the tools and approaches of that framework, not the ones provided in System.Web.
However, It should be possible to reference the System.Web.dll if your really want to.  If you are using VS2015 you will need to get a copy of the System.Web.Dll and wrap it in a nuget package in order to establish a reference to it.  See here .net core 1.0 visual studio referencing external dll  VS2017RC has alpha tooling that should eliminate the need to wrap it in a NuGet package but I've had trouble installing it on my machine so I can't vouch for it personally.  Update: VS2017 now has great tooling for Asp.Net Core and referencing full framework Dlls.


text:
Q: $f$ factors through $q$, where $q$ is the quotient map, and $f$ is a homomorphism.
Let $K$ be a normal subgroup of $G$ and $q:G \to G/K$ be the quotient map.  Let $f:G \to H$ be a homomorphism with $K \subseteq \ker(f)$.  Prove that $f$ factors through $q$, meaning that there exists a homomorphism $\varphi:G/K \to H$ such that $f = \varphi \circ q$.

I am not sure how to begin this problem. My idea was to write $G/K$ as $\bar{G}$, and then to define the map $q$ as $q(a)=\bar{a}$, for some $a\in G$, which means that $q$ is a homomorphism, and then to show that $\varphi:G/K \to H$ is a homomorphism. But I have no strategic map.

A: Hints:

*

*What must be the value of $\varphi(\bar a)$ for $a\in G$ if $\varphi\circ q=f$?

*Show that it gives a well defined map $G/K\to H$.

*Verify that it's a homomorphism.


text:
Q: programmatically create VC, Use integers from UItext field in formula and perform a calculation when UIButton is tapped all,  this code does not throw errors now but the screen is blank.  I am trying to create a simple calculator.  user will input numbers into 3 separate UIText fields, push a button and a UILabel would give answer.  I know i do not have labels yet.  i first built a container to hold text fields but then my "CalculateTapped" could not see the textFields as variables.
Question. 1 why is my screen now black?
Question. 2. why could i not get CalculateTapped to read UIText fields from my lazy var "" view earlier?
If anyone has any input i would greatly appreciate it.  trying to get away from storyboards.
import UIKit
class PitchLineVC: UIViewController {

    override func viewDidLoad() {
            super.viewDidLoad()
        let view = UIView()
            ()
            view.backgroundColor = .white
            view.anchor(top: view.topAnchor, left: view.leftAnchor,bottom: view.bottomAnchor, right: view.rightAnchor);
            configureNavigationBar()

    //        looks for keyboard instance
            NotificationCenter.default.addObserver(self, selector: #selector(PitchLineVC.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
            NotificationCenter.default.addObserver(self, selector: #selector(PitchLineVC.keyboarWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
        }

    //   keeps screen from rotating
    override var shouldAutorotate: Bool {
            return false
    }

//  Add text fields for user input to calculate pitch
    private lazy var areaTxt: UITextField! = {
    let area = UITextField()

    area.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: -100).isActive = true
    area.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -300).isActive = true
    area.placeholder = "Bar Area"
    area.textAlignment = .center
    area.borderStyle = UITextField.BorderStyle.line
    area.backgroundColor = UIColor.white
    area.textColor = UIColor.black
    area.keyboardType = UIKeyboardType.decimalPad
//    view.addSubview(area)
        return(area)
    }()
        private lazy var areaTop: UITextField! = {
        let area = UITextField()

        area.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
        area.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -200).isActive = true
        area.placeholder = "Top Area of Bar"
        area.textAlignment = .center
        area.borderStyle = UITextField.BorderStyle.line
        area.backgroundColor = UIColor.white
        area.textColor = UIColor.black
        area.keyboardType = UIKeyboardType.decimalPad
//        view.addSubview(area)
            return(area)
    }()

        private lazy var lineLength: UITextField! = {
            let line = UITextField()

            line.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: -100).isActive = true
            line.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -300).isActive = true

//            line.anchor(top: view.bottomAnchor, paddingTop: -80,width: 100, height: 35)
            line.placeholder = "Line Length"
            line.textAlignment = .center
            line.borderStyle = UITextField.BorderStyle.line
            line.backgroundColor = UIColor.white
            line.textColor = UIColor.black
            line.keyboardType = UIKeyboardType.decimalPad
//            view.addSubview(line)
            return (line)
        }()

    @objc func CalculateTapped(){
                       print("Button Tapped")
            let AreaTotal = Double(areaTxt.text!)
                let AreaTop = Double(areaTop.text!)
                let Line = Double(lineLength.text!)

                if AreaTotal != nil && AreaTop != nil && Line != nil{

                    let LineMove = -(((AreaTotal! / 2) - AreaTop!) / Line!)

                    movepitchline.text = NSString(format: "%.3f", LineMove) as String
                }

                   }

            func addCalculateButton(){
                   let Calculate = UIButton()

                    Calculate.addTarget(self, action: #selector(CalculateTapped), for: .touchUpInside)
                    Calculate.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: -100).isActive = true
                    Calculate.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: -400).isActive = true
                    Calculate.anchor(top: view.bottomAnchor, paddingTop: -80,
                                           width: 100, height: 35)
                view.addSubview(Calculate)

                   }

    let movepitchline: UILabel = {
        let label = UILabel()
        label.textAlignment = .right
        label.frame = CGRect(x: 10, y: 380, width: 220, height: 35)
        label.text = "Move Pitch:"
        label.font = UIFont.boldSystemFont(ofSize: 23)
        label.textColor = .black
        return label
    }()

//    When keyboard displays the UIView shift up
    @objc func keyboardWillShow(notification: NSNotification) {
        guard let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else {
           // if keyboard size is not available for some reason, dont do anything
           return
        }
      // move the root view up by the distance of keyboard height
      self.view.frame.origin.y = 150 - keyboardSize.height
    }

    @objc func keyboarWillHide(notification: NSNotification){
        self.view.frame.origin.y = 0//\\100 + keyboardSize.height
    }

//    select outside text box to dismiss selection
    @objc func handleDismiss(notification: NSNotification) {
        dismiss(animated: true, completion: nil)
    }

    func configureNavigationBar() {
        navigationController?.navigationBar.barTintColor = .appBlue
        navigationController?.navigationBar.barStyle = .black

        navigationItem.title = "Pass Pitch and Diameters"
        navigationItem.leftBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "Home_2x").withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(handleDismiss))

    }

}

A: import UIKit

class PitchLineVC: UIViewController {

    lazy var pitchlogoView: UIImageView = {
        let iv = UIImageView()
        iv.contentMode = .scaleAspectFit
        iv.clipsToBounds = true
        iv.image = #imageLiteral(resourceName: "PITCH LINE")
        return iv
    }()

    lazy var areaTxt: UITextField! = {
        let tf = UITextField()

        tf.placeholder = "Bar Area"
        tf.textAlignment = .center
        tf.borderStyle = UITextField.BorderStyle.line
        tf.backgroundColor = UIColor.white
        tf.textColor = UIColor.black
        tf.keyboardType = UIKeyboardType.decimalPad
            return(tf)
        }()

    lazy var areaTop: UITextField! = {
            let tf = UITextField()

            tf.placeholder = "Top Area of Bar"
            tf.textAlignment = .center
            tf.borderStyle = UITextField.BorderStyle.line
            tf.backgroundColor = UIColor.white
            tf.textColor = UIColor.black
            tf.keyboardType = UIKeyboardType.decimalPad
                return(tf)
        }()

    lazy var lineLength: UITextField! = {
                let tf = UITextField()

                tf.placeholder = "Line Length"
                tf.textAlignment = .center
                tf.borderStyle = UITextField.BorderStyle.line
                tf.backgroundColor = UIColor.white
                tf.textColor = UIColor.black
                tf.keyboardType = UIKeyboardType.decimalPad
                return (tf)
            }()

    lazy var movepitchline1: UILabel = {
               let lb = UILabel()
               lb.textAlignment = .right
               lb.frame = CGRect(x: 10, y: 380, width: 220, height: 35)
               lb.text = "Move Pitch: + is up, - is down"
               lb.textAlignment = .center
               lb.font = UIFont.boldSystemFont(ofSize: 23)
               lb.textColor = .black
               return (lb)
           }()

    lazy var movepitchline: UILabel = {
        let lb = UILabel()
        lb.textAlignment = .right
        lb.frame = CGRect(x: 10, y: 380, width: 220, height: 35)
        lb.text = ""
        lb.textAlignment = .center

        lb.font = UIFont.boldSystemFont(ofSize: 23)
        lb.textColor = .black
        return (lb)
    }()

    let calculateButton: UIButton = {
        let button = UIButton(type: .system)

        button.backgroundColor = UIColor.init(red: 48/255, green: 173/255, blue: 99/255, alpha: 1)
        button.layer.cornerRadius = 25.0
        button.tintColor = UIColor.white
        button.layer.shadowColor = UIColor.darkGray.cgColor
        button.layer.shadowRadius = 6
        button.layer.shadowOpacity = 0.7
        button.layer.shadowOffset = CGSize(width: 0, height: 0)
        button.setTitle("Calculate", for: .normal)
        button.titleLabel?.font = UIFont(name: "Copperplate", size: 22)
        button.addTarget(self, action: #selector(handleCalculate), for: .touchUpInside)
        return button
    }()

    @objc func handleDismiss(notification: NSNotification) {
        dismiss(animated: true, completion: nil)
    }

    //sets trigger for keyboard dismiss
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        view.endEditing(true)
        super.touchesBegan(touches, with: event)
    }

//    Mark: Init
    override func viewDidLoad() {
            super.viewDidLoad()

        configureNavigationBar()
        configureViewComponent()

    //        looks for keyboard instance
            NotificationCenter.default.addObserver(self, selector: #selector(PitchLineVC.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
            NotificationCenter.default.addObserver(self, selector: #selector(PitchLineVC.keyboarWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
        }

    //   keeps screen from rotating
    override var shouldAutorotate: Bool {
            return false
    }

//    Mark: Selectors

    @objc func handleCalculate()
    {
        print("calculate")
        guard let AreaTotal = Double(areaTxt.text!) else {return}
        guard let AreaTop = Double(areaTop.text!) else {return}
        guard let Line = Double(lineLength.text!) else {return}

        if AreaTotal != 0 && AreaTop != 0 && Line != 0{

            let LineMove = -(((AreaTotal / 2) - AreaTop) / Line)
            print(LineMove)
            movepitchline.text = NSString(format: "%.3f", LineMove) as String

        } else{
            print("Error in fields, please check entry")
        }

    }

    func configureViewComponent(){
        view.backgroundColor = .white

        view.addSubview(pitchlogoView)
        pitchlogoView.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 120, paddingLeft: 0, paddingBottom: 0, paddingRight: 0, width: 250, height: 110)

        view.addSubview(areaTxt)
        areaTxt.anchor(top: pitchlogoView.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 15, paddingLeft: 80, paddingBottom: 0, paddingRight: 80, width: 0, height: 30)

        view.addSubview(areaTop)
        areaTop.anchor(top: areaTxt.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 20, paddingLeft: 80, paddingBottom: 0, paddingRight: 80, width: 0, height: 30)

        view.addSubview(lineLength)
        lineLength.anchor(top: areaTop.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 20, paddingLeft: 80, paddingBottom: 0, paddingRight: 80, width: 0, height: 30)

        view.addSubview(calculateButton)
        calculateButton.anchor(top: lineLength.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 30, paddingLeft: 32, paddingBottom: 0, paddingRight: 32, width: 0, height: 50)

        view.addSubview(movepitchline1)
        movepitchline1.anchor(top: calculateButton.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 10, paddingLeft: 32, paddingBottom: 0, paddingRight: 32, width: 0, height: 40)

        view.addSubview(movepitchline)
        movepitchline.anchor(top: movepitchline1.bottomAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, paddingTop: 10, paddingLeft: 32, paddingBottom: 0, paddingRight: 32, width: 0, height: 40)
        }

//    When keyboard displays the UIView shift up
    @objc func keyboardWillShow(notification: NSNotification) {
        guard let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else {
           // if keyboard size is not available for some reason, dont do anything
           return
        }
      // move the root view up by the distance of keyboard height

      self.view.frame.origin.y = 165 - keyboardSize.height
    }

    @objc func keyboarWillHide(notification: NSNotification){
        self.view.frame.origin.y = 0
    }

//    select outside text box to dismiss selection

    func configureNavigationBar() {
        navigationController?.navigationBar.barTintColor = .appBlue
        navigationController?.navigationBar.barStyle = .black

        navigationItem.title = "Pass Pitch and Diameters"
        navigationItem.leftBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "Home_2x").withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(handleDismiss))

    }

}


text:
Q: How can I append text into detached html It seems like this should be super easy, but I have not yet found a way to do it; What I am trying to do is this:
I have some html that came from a service call. The markup has tags in it like p, strong, etc. I am trying to append() a link into the last paragraph before I send the markup to the page (w angular). I have been using jQuery to attempt to get the markup like I want but so far no gold.
My code looks something like this:
var intro = row['Introduction']; // from the service call
var contents = jQuery(intro).contents().get(); // get the items within
for (var i = contents.length - 1; i > 0; i--) { // start with the last
  if (jQuery(contents[i]).context.nodeType === 3) { // is it text?
    jQuery('Less').appendTo(contents[i]); // append
    break;
  }
}

This doesn't seem to be having any effect though. When I console.log(contents[i]) after appending, it's still the same. What gives?
For clarification, I have this html coming in the service:
console.log(intro);

This is text

This is more text.

And even more here.

And this: jQuery(intro).find('p'); gets 0 results!
What am I missing!?
Also, I don't know if this is relevant, however this code is executed within an AngularJS controller.
For a sanity check I tried this on jsfiddle (to make sure I wasn't going bonkers) https://jsfiddle.net/n094LL3s/ Apparently, find does't work with html strings!... -_-
OK, I found out I need to use $.filter('p') not find to get items that are at the root of the set.

A: In your case instead of .find() you need to use .filter() like this $(text).filter('p').length. If you still want to use .find() you need to modify your HTML string a bit and put it inside
 element (or any other container), for example like this text = '

One

Two

Three

';
And the reason of this behavior you can find in the .find() method description

Description: Get the descendants of each element in the current set of
  matched elements, filtered by a selector, jQuery object, or element.

Check modified fiddle here


text:
Q: Is there a way to execute a SQL command on a ADO.NET connection like the SQLCMD -q option? We have multiple applications writing to our MS SQL 2008 R2 database and there is a need to capture information about these applications during these writes. The database code (triggers, stored procedures etc) are under my control and can be modified but not the application code.
I am leaning towards using CONTEXT_INFO to store application specific information and retrieving it in the  triggers. The 1M$ question is "How can I get the applications to set the CONTEXT_INFO if they are loath to change application code ?".
I DO have access to the connection strings that these applications use as these reside in config files.
I was not able to find any properties on the connection string that I can use to set CONTEXT_INFO (or execute any TSQL at initialization). Basically I was hoping to simulate the behaviour of SQLCMD -q option e.g SQLCMD -q "SET CONTEXT_INFO 0x1244".
Is there any way to simulate this behavior in ADO.NET via configuration ? Or a different way to do this ? Any pointers appreciated.
If there is no way this can be done, I can take the message back and tell "management" that application code has to be changed.


text:
Q: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin We are seeing below issue while analyzing the PR, even we are not spinning any version in the pom file and its failing while analyzing the code.
Even after removing the plugin version its the same issue. Can you please help with this.
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project amap-repo: PUT https://api.bitbucket.org/2.0/repositories/m/amap-common-lib/pullrequests/175/comments/130003966
returned a response status of 404 Not Found ->

[Help 1] 14:22:15
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
  execute goal
  org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar
  (default-cli) on project amap-repo: PUT
  https://api.bitbucket.org/2.0/repositories/mediaiq/amap-common-lib/pullrequests/175/comments/130003966
  returned a response status of 404 Not Found 14:22:15 at
  org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
  14:22:15 at
  org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

A: You can try below command to archive your issue. I was facing the same but below command worked.
- mvn verify sonar:sonar -Dsonar.host.url=http://localhost:Port -Dsonar.login=Token -Dsonar.login=Sonar_username -Dsonar.password=Sonar_password


text:
Q: marklogic api exension post binary I wanted to create a REST service in XQuery who are able to receive zip file with documents.
I try to use the API REST extension, but the input is a document-node and is unable to receive zip file.
Is there a way to do that?
I have to receive a very big number of files, and I want to zip them by 1000 documents to limit the network time.
I use ml-gradle to create my database services

I do an other try :
XQ :
declare function he.insertMedia:put(
$context as map:map,
$params as map:map,
$input as document-node()*
) as document-node()?
{

    let $id := map:get($params,"id")
    let $uri := map:get($params,'uri')
    return ( xdmp:document-insert($uri,$input),
    document { <ok/> }
    )
};

CURL call :
curl --location --request PUT 'http://localhost:8175/LATEST/resources/he.insertMedia?rs:id=TestMarc&rs:uri=/test/testMarc' \
--header 'Content-type: application/xslt+xml' \
--data-binary '@/D:/Travail/3-1-ELS/cep-lss-octo-exampledata/DATA/ACTUEL_ARTICLE/media/000_1wy606.jpg'

Result :
{
    "errorResponse": {
        "statusCode": 400,
        "status": "Bad Request",
        "messageCode": "XDMP-DOCUTF8SEQ",
        "message": "XDMP-DOCUTF8SEQ: xdmp:get-request-body() -- Invalid UTF-8 escape sequence at  line 1 -- document is not UTF-8 encoded"
    }
}

ML version : 10.0-6.1

A: You send binary but tells the server it is XML (XSLT as XML.)  Try the following in cURL:
Content-Type: application/octet-stream


text:
Q: could I call custom javascript file by dart i have a very big javascript file , want to call it by dart /flutter app.
searched a lot,
tried js, and flutter_webview_plugin.
in fact I don't want to create a webview, just have a bit class of js file , want to call it from dart with parameters.

A: It's better If you add more info or explain what you are trying to archive?
Because, The solution may differ depending on the use cases. The WebView commonly use to embed the web based applications.
Anyway, Flutter officially has a package called dart:js to interoperating with JavaScript.
https://api.flutter.dev/flutter/dart-js/dart-js-library.html


text:
Q: Typescript: unexpected reserved word in PHPStorm I´m trying to get a simple TypeScript file working in PHPStorm, but sadly there seem to be some misconfiguration by default as the class keyword is not recognized properly
This is my TypeScript file:
class Test{

}

And this is the error I´m facing:

And this is my FieWatcher configuration of TypeScript

How can I get TypeScript working?

A: The Program options should not be node.exe (that would mean you are trying to typescript code as javascript). It needs to be tsc or node tsc(that means you want to run tsc to compile the file to javascript).
PS: this video might be helpful : https://www.youtube.com/watch?v=RWXGMug_Rmo&hd=1


text:
Q: react native footer icon I like the same style as IOS in android. You can see the in IOS the Icon in the middle is nice, but in android it isn't

The code I use is this one
  <Footer style={{ backgroundColor: "#FFFFFF" }}>
    <FooterTab style={{ backgroundColor: "#FFFFFF" }}>
      <Button onPress={() => { Actions.Startpage();}}>
        <Icon name="search" size={30} color="#3ba936" />
      <Text style={styles.smalltext} numberOfLines={1}>Ontdekken</Text>
      </Button>
      <Button onPress={() => { Actions.ThemasPage();}}>
        <Icon name="id-card" size={30} color="#3ba936" />
      <Text style={styles.smalltext} numberOfLines={1}>Thema's</Text>
      </Button>
      <Button  style={{marginBottom:20, borderRadius:50, height: 90, backgroundColor: '#FFFFFF', overflow: 'visible'}} onPress={() => { Actions.EventPage();}}>
        <Icon name="calendar-plus-o" size={50} color="#3ba936" />
      <Text style={styles.smalltext} numberOfLines={1}>Evenementen</Text>
      </Button>
      <Button onPress={() => { Actions.Wildpage();}}>
        <Icon name="binoculars" size={30} color="#e50040" />
      <Text style={styles.smalltext} numberOfLines={1}>100% Wild</Text>
      </Button>
      <Button onPress={() => { Actions.MenuPage();}}>
        <Icon name="bars" size={30} color="#3ba936" />
      <Text style={styles.smalltext} numberOfLines={1}>Menu</Text>
      </Button>
    </FooterTab>
  </Footer>

A: This is because the button is bigger than the container.
In iOS it will be visible but on android the container will crop any inner element that overflow.
What you can do is to change the height on Footer to be equal to that middle button, and make sure that the other buttons are smaller in height to give you the same effect without any overflow outside parent Component.
And for the gray line you can add a view with height of 1 and full width


text:
Q: Invalid Syntax for PEP-8 I'm receiving a notification that advised the below script is not PEP-8:
example_var = print('whoa')

Output:
[E] invalid syntax.

It's showing that the error is a result of the first parentheses in the print statement, but nothing looks off to me.
example_var = print('whoa')
example_var


text:
Q: Routing onclick event from embedded SVG to higher level I have an HTML file that embeds two different SVG files, like so:
<html>
  <body>
    <object id="svg0" data="histograms.svg" type="image/svg+xml"></object>
    <object id="svg1" data="test.svg" type="image/svg+xml"></object>
  </body>
</html>

Both SVG files are interactive, by adding a javascript function that is triggered by onclick, like such:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ns1="http://www.w3.org/1999/xlink" height="172pt" version="1.1" viewBox="0 0 1209 172" width="1209pt">
 <script type="text/ecmascript">
                function choose(obj) {
                  var values = [0.08,0.77];
                  var names = [ "hist_1", "hist_2", "hist_3", "hist_4", "hist_5", "hist_6", "hist_7", "hist_8", "hist_9", "hist_10", "hist_11" ];
                  for ( var i=0; i<names.length; i++) {
                    var o = document.getElementById( names[i] );
                    o.style['opacity'] = values[0];
                  }
                  obj.style['opacity'] = values[1];
                }
  </script>
  ...
 <g id="figure_1">
  <g id="patch_1">
   <path d=" M0 172.8 L1209.6 172.8 L1209.6 0 L0 0 z " style="fill:#ffffff;" />
  </g>
  <g id="axes_1">
   <g cursor="pointer" id="hist_1" onclick="choose(this)">
    <path d=" M20.835 70.52 L189.696 70.52 L189.696 12.96 L20.835 12.96 z " style="fill:#ffe6cc;" />
   </g>
...

How can I have a click in one SVG file trigger javascript in the other SVG file? (Possibly via top level .html file as intermediate, if necessary?)

A: If you're writing code in test.svg then top gets you the containiner, so
var svg0 = top.document.getElementById("svg0");

would get you the object element from the container document.
Then
obj0Document = svg0.contentDocument;
if (obj0Document && obj0Document.defaultView)
  obj0Window = obj0Document.defaultView;
else if (svg0.window)
  obj0Window  = svg0.window;

gets you the content's document and window.
accessing the SVG document's "window" allows you to access variables and functions defined in scripts in the SVG document.
e.g. obj0Window.choose(something)
Everything must have the same domain for this to work.


text:
Q: Python: Writing into file fails without error - results in empty file I am using Django to handle uploaded file and write it into certain place in my project.
The view, that handles the file upload is:
def add_data(request):
    # If something was posted

    upload_form = DataImportUploadForm(request.POST, request.FILES) if request.method == 'POST' else DataImportUploadForm()

    if request.method == 'POST':
        if upload_form.is_valid():
            upload_form.handle_uploaded_file()
            return HttpResponseRedirect(request, '/path/' )
        else:
            messages.error(request, ugettext(u"Could not import data"))

    return render_to_response('folder/add.html', {'upload_form': upload_form}, context_instance=RequestContext(request))

And the form is:
class DataImportUploadForm(forms.Form):
    file = forms.FileField(label=_(u"File"), required=True)

    def __init__(self, *args, **kwargs):
        super(DataImportUploadForm, self).__init__(*args, **kwargs)
        self.max_upload_size = 1024*1024 #1 MB
        self.fileformat = None
        self.filename = None

    def clean_file(self):
        f = self.cleaned_data.get('file')
        if not f:
            raise forms.ValidationError(_(u"No file uploaded"))

        if f._size > self.max_upload_size:
            raise forms.ValidationError(_(u"Uploaded file is too large ( > 1MB )"))

        try:
            reader = csv.reader(f, csv.get_dialect('excel'))
            reader.next()
            self.fileformat = 'excel'
        except:
            reader = None

        if reader is None:
            try:
                dialect = csv.Sniffer().sniff(f.read(1024))
                f.seek(0)
                reader = csv.reader(f, dialect)
                self.fileformat = 'sniff'
            except:
                reader = None

        if reader is None:
            raise forms.ValidationError(_(u"Unknown data format"))

        self.filename = f._name

        return f

    def handle_uploaded_file(self):
        media_root = settings.MEDIA_ROOT
        file_location = media_root + 'CSV/'
        from core.helpers import ensure_dir
        ensure_dir(file_location)
        f = self.cleaned_data.get('file')
        dest = open(file_location + f._name, 'w+')
        logger.debug(dest)
        for chunk in f.chunks():
            logger.debug(chunk)
            dest.write(chunk)
        logger.debug(dest.closed)
        dest.seek(0)
        logger.debug(dest.read())
        dest.close()

What happens when i upload file is (according to logfile):
DEBUG 2014-01-31 12:04:46,034 POST URL: localhost.dev/path/?csrfmiddlewaretoken=683FesoraFTYLR7HHxfPuu3bb5xuzPYY&task=upload User: [me] Account: [useraccount]
DEBUG 2014-01-31 12:04:46,126 <open file u'/path/to/project/media/CSV/filename.csv', mode 'w+' at 0x54690c0>
DEBUG 2014-01-31 12:04:46,126 <FILE CONTENTS>
DEBUG 2014-01-31 12:04:46,126 False
DEBUG 2014-01-31 12:04:46,126 <FILE CONTENTS>
DEBUG 2014-01-31 12:04:46,817 GET URL: localhost.dev/path/of/next/view/ User: [me] Account: [useraccont]

And what i see is empty file.
at first i thought, that perhaps this is file permissions problems, but the CSV folder has 2777 perms. and all the folders up to media folder (including media) have correct permissions, allowing access to folder. After all the damn script does not fail to generate the actual file.
Can anyone please point out some of the reasons, why this file might end up beeing empty?
(project)alan@alan:/path/to/project/media/CSV$ ls -l
total 0
-rw-rw-rw- 1 alan alan 0 jaan  31 12:19 filename.csv

Django version i am using is 1.4.2, python version is 2.7.5+. Nginx + uwsgi & virutalenv + virtualenvwrapper In ubuntu 13.10.

A: try to flush the internal i/o buffer:
    # … your code …
    with open(file_location + f._name, 'w+') as dest:
        logger.debug(dest)
        for chunk in f.chunks():
            logger.debug(chunk)
            dest.write(chunk)
        dest.flush()

wait… in your log you show that:
    dest.seek(0)
    logger.debug(dest.read())

is actually working? Then the content has been written.
So either:

*

*it gets written to a wrong path because of a typo or some other error

*you're not opening the right file because of a typo or some other error

*or your file gets overwritten by something somewhere else in your code


text:
Q: How to make an image appear on the hover of another image? For a school project we have been assigned to make a website to
showcase a recent stop motion we have made. I am getting along well however i have encountered a problem. I would like to know how to make an image appear on hover of another image. I have placed both selected images in and one of them turns to color when hovering with a webkit transition and have done a fade in with the other. However I would like the image that fades in to be linked in with the other, so that when hovering over the image that turns from grayscale to color the other image fades in with it. Need answers asap. Cheers.

A: If you simply want to hide, here is solution without jQuery, you can check it live here: http://jsfiddle.net/wDVUd/
HTML:

CSS:
#imageToShow
{
    display: none;
}

JS:
document.getElementById('imageToHover').onmouseover = function() {
    document.getElementById('imageToShow').style.display = 'inline';
}

document.getElementById('imageToHover').onmouseout = function() {
   document.getElementById('imageToShow').style.display = 'none';
}

A: you want something like this .. follow link
$('.div1 li').hover(function(){
   var imgID = $(this).find('a').attr('href');
   $(imgID).fadeIn();
});


text:
Q: Using F_RoundToEven FreeAdhocUDF function fails with some numbers I have noticed that when we use F_RoundToEven UDF from FreeAdhocUDF, that it fails to produce a correct result with certain numbers.
For example, the query:
select
  F_RoundToEven(21.145, 2) Correct,
  F_RoundToEven(215.145, 2) Fail
from Rdb$Database

produces the result:
CORRECT FAIL
21.14   215.15

Obviously these two number should both resolve to .14
Has anyone else come across this problem, and perhaps found a way around it?
I am using the latest version of FreeAdhocUDF with Firebird 2.1 and it fails on both Windows 32bit and Linux 64bit.
Thanks.


text:
Q: GameObject activates too soon EDIT
So it's in here, of this I have no doubt, but why? NextOne.active = true; is firing off regardless of whether the action button is being pressed.
if(Input.GetButtonDown("Action") && Op_3 == true)
{
    AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
    Playerhealthscript.panic +=1;
    print("1 works");
    Option_3_SELECTED.active = false;
    Option_4_Unselected.active = false;
    Option_3_Unselected.active = false;
    Option_4_SELECTED.active = false;
    NextOne.active = true;
}
else if(Input.GetButtonDown("Action") && Op_4 == true)
{
    AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
    Playerhealthscript.insanity +=1;
    print("2 works");
    Option_3_SELECTED.active = false;
    Option_4_Unselected.active = false;
    Option_3_Unselected.active = false;
    Option_4_SELECTED.active = false;
    NextOne.active = true;
}

The way that I'm reading this, if action button is pressed AND Opt 3 OR Opt 4 are active then the following should happen:
An audio clip is played Insanity OR Panic are increased by 1 in the Playerhealth script A message is printed in the console Options 3 & 4 are deactivated NextOne is activated.
So what am I not seeing here? Why is NextOne activating with or without action being pressed? Is my syntax wrong?
END EDIT
Let me tell you what my script is supposed to do:
Some text appears. A question with an A/B choice appears. You choose A or B. This activates a GameObject which has a similar script on it. That script immediately disables the script you were just one. You answer another A/B question. (this time from the new script, since the old one has been deactivated) Once you answer the second question (only one on the new script) a third GameOBject activates, with another, similar script again, with the same results. It's a chain. So basically it goes
GameObject 1 is active at start of scene. (Script1) A/B choice is made GameObject 1 is deactivated GameObject 2 is activated(Script2) New A/B choice is made GameObject3 is activated(Script3) and so on.
It should be a simple on / off switch script, but here 's what's happening:
When the player makes the first decision instead of going from GameObject 1 to GameObject 2 the script is bypassing 2 and going straight to 3. Here is the script from 1 to 2:
//boolean variables
var Speaking : boolean = false;
var Entered : boolean = false;
var Speaking2 : boolean = false;
var Entered2 : boolean = false;
var Speaking3 : boolean = false;
var Entered3 : boolean = false;
var Speaking4 : boolean = false;
var Entered4 : boolean = false;

var Op_1 : boolean = false;
var Op_2 : boolean = false;
var Op_3 : boolean = false;
var Op_4 : boolean = false;

//speaking variables
var speakername : String;
var theselines : String;
var theselines2 : String;
var theselines3 : String;
var theselines4 : String;
var theselines5 : String;
var these2lines : String;
var these2lines2 : String;
var these2lines3 : String;
var these2lines4 : String;
var these2lines5 : String;
var these3lines : String;
var these3lines2 : String;
var these3lines3 : String;
var these3lines4 : String;
var these3lines5 : String;
var these4lines : String;
var these4lines2 : String;
var these4lines3 : String;

//other variables
var Background : GameObject;
var Option_1_Unselected : GameObject;
var Option_2_Unselected : GameObject;
var Option_1_SELECTED : GameObject;
var Option_2_SELECTED : GameObject;
var NextOne : GameObject;

var MouseLookScript : MouseLook;
public var guiSkin : GUISkin;
var OptionsSound : AudioClip;
var MoveSound : AudioClip;
var Playerhealthscript : Playerhealth;

function Start () {
    Entered = true;
}

function Continued(){
    yield WaitForSeconds(0.25);
    Entered = false;
    Speaking = false;
    Entered2 = true;
}

function Continued2(){
    yield WaitForSeconds(0.25);
    Entered2 = false;
    Speaking2 = false;
    Entered3 = true;
}

function Continued3(){
    yield WaitForSeconds(0.25);
    Entered3 = false;
    Speaking3 = false;
    Entered4 = true;
}

function OnGUI(){
    if(Entered){
        Background.active = true;
        MouseLookScript.enabled = false;
        Speaking = true;
        GUI.skin = guiSkin;
        GUI.Label(Rect(410,295,400,175), speakername);
        GUI.Label(Rect(500,345,400,175), theselines);
        GUI.Label(Rect(500,380,400,175), theselines2);
        GUI.Label(Rect(500,415,400,175), theselines3);
        GUI.Label(Rect(500,455,400,175), theselines4);
        GUI.Label(Rect(500,495,400,175), theselines5);
        if(Input.GetButtonDown("Action")){
            Continued();
        }
    }

    if(Entered2){
        Speaking2 = true;
        GUI.skin = guiSkin;
        GUI.Label(Rect(410,295,400,175), speakername);
        GUI.Label(Rect(500,345,400,175), these2lines);
        GUI.Label(Rect(500,380,400,175), these2lines2);
        GUI.Label(Rect(500,415,400,175), these2lines3);
        GUI.Label(Rect(500,455,400,175), these2lines4);
        GUI.Label(Rect(500,495,400,175), these2lines5);
        if(Input.GetButtonDown("Action")){
            Continued2();
        }
    }

    if(Entered3){
        Speaking3 = true;
        GUI.skin = guiSkin;
        GUI.Label(Rect(410,295,400,175), speakername);
        GUI.Label(Rect(500,345,400,175), these3lines);
        GUI.Label(Rect(500,380,400,175), these3lines2);
        GUI.Label(Rect(500,415,400,175), these3lines3);
        GUI.Label(Rect(500,455,400,175), these3lines4);
        GUI.Label(Rect(500,495,400,175), these3lines5);
        if(Input.GetButtonDown("Action")){
            Continued3();
        }
    }

    //Question_1
    if(Entered4)
    {
        Speaking4 = true;
        GUI.skin = guiSkin;
        GUI.Label(Rect(410,295,400,175), speakername);
        GUI.Label(Rect(415,345,400,175), these4lines);
        GUI.Label(Rect(415,380,400,175), these4lines2);
        GUI.Label(Rect(415,415,400,175), these4lines3);
        Option_1_SELECTED.active = true;
        Option_2_Unselected.active = true;
        Option_1_Unselected.active = false;
        Option_2_SELECTED.active = false;
        Op_1 = true;
        Op_2 = false;

        if(Input.GetAxis("Vertical") < -.5)
        {
            Option_1_SELECTED.active = false;
            Option_2_Unselected.active = false;
            Option_1_Unselected.active = true;
            Option_2_SELECTED.active = true;
            Op_1 = false;
            Op_2 = true;
            print("this works");
        }

        if(Input.GetButtonDown("Action") && Op_1 == true)
        {
            AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
            Playerhealthscript.panic +=1;
            print("1 works");
            Option_1_SELECTED.active = false;
            Option_2_Unselected.active = false;
            Option_1_Unselected.active = false;
            Option_2_SELECTED.active = false;
            NextOne.active = true;
        }
        else if(Input.GetButtonDown("Action") && Op_2 == true)
        {
            AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
            Playerhealthscript.insanity +=1;
            print("2 works");
            Option_1_SELECTED.active = false;
            Option_2_Unselected.active = false;
            Option_1_Unselected.active = false;
            Option_2_SELECTED.active = false;
            NextOne.active = true;
        }
    }
}

That should do the trick I think, so I believe that the problem resides somewhere in the script for 2 to 3. Below is the script for 2 to 3.
#pragma strict

//boolean variables

var Speaking5 : boolean = false;
var Entered5 : boolean = false;

var Op_3 : boolean = false;
var Op_4 : boolean = false;

//speaking variables
var speakername : String;

var these5lines : String;
var these5lines2 : String;
var these5lines3 : String;

//other variables
var Background : GameObject;
var Option_3_Unselected : GameObject;
var Option_4_Unselected : GameObject;
var Option_3_SELECTED : GameObject;
var Option_4_SELECTED : GameObject;
var OldOne : GameObject;
var NextOne : GameObject;

var MouseLookScript : MouseLook;
public var guiSkin : GUISkin;
var OptionsSound : AudioClip;
var MoveSound : AudioClip;
var Playerhealthscript : Playerhealth;

function Start () {
    OldOne.active = false;
    NextOne.active = false;
    Entered5 = true;
}

function OnGUI(){

    if(Entered5)
    {
        Speaking5 = true;
        GUI.skin = guiSkin;
        GUI.Label(Rect(410,295,400,175), speakername);
        GUI.Label(Rect(415,345,400,175), these5lines);
        GUI.Label(Rect(415,380,400,175), these5lines2);
        GUI.Label(Rect(415,415,400,175), these5lines3);
        Option_3_SELECTED.active = true;
        Option_4_Unselected.active = true;
        Option_3_Unselected.active = false;
        Option_4_SELECTED.active = false;
        Op_3 = true;
        Op_4 = false;

        if(Input.GetAxis("Vertical") < -.5)
        {
            Option_3_SELECTED.active = false;
            Option_4_Unselected.active = false;
            Option_3_Unselected.active = true;
            Option_4_SELECTED.active = true;
            Op_3 = false;
            Op_4 = true;
            print("this works");
        }

        if(Input.GetButtonDown("Action") && Op_3 == true)
        {
            AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
            Playerhealthscript.panic +=1;
            print("1 works");
            Option_3_SELECTED.active = false;
            Option_4_Unselected.active = false;
            Option_3_Unselected.active = false;
            Option_4_SELECTED.active = false;
            NextOne.active = true;
        }
        else if(Input.GetButtonDown("Action") && Op_4 == true)
        {
            AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
            Playerhealthscript.insanity +=1;
            print("2 works");
            Option_3_SELECTED.active = false;
            Option_4_Unselected.active = false;
            Option_3_Unselected.active = false;
            Option_4_SELECTED.active = false;
            NextOne.active = true;
        }
    }
}

A: Got it! My son pointed out that all I needed to do was add an integer every time a question was answered, then make that integer a condition to go on to the next question.

#pragma strict

//boolean variables

var Speaking5 : boolean = false;
var Entered5 : boolean = false;

var Op_3 : boolean = false;
var Op_4 : boolean = false;
var Question : int = 0;

//speaking variables
var speakername : String;
var addhealth : String;
var addhealth2 : String
var these5lines : String;
var these5lines2 : String;
var these5lines3 : String;

//other variables
var Background : GameObject;
var Option_3_Unselected : GameObject;
var Option_4_Unselected : GameObject;
var Option_3_SELECTED : GameObject;
var Option_4_SELECTED : GameObject;
var OldOne : GameObject;
var NextOne : GameObject;

var MouseLookScript : MouseLook;
public var guiSkin : GUISkin;
var OptionsSound : AudioClip;
var MoveSound : AudioClip;
var Playerhealthscript : Playerhealth;

function Update(){
if(Question >= 1)
 {
 NextOne.active = true;
}

}

function Start () {
OldOne.active = false;
//NextOne.active = false;
Entered5 = true;
}

function OnGUI(){

if(Entered5)
{
Speaking5 = true;
GUI.skin = guiSkin;
GUI.Label(Rect(410,295,400,175), speakername);
GUI.Label(Rect(415,345,400,175), these5lines);
GUI.Label(Rect(415,380,400,175), these5lines2);
GUI.Label(Rect(415,415,400,175), these5lines3);
Option_3_SELECTED.active = true;
Option_4_Unselected.active = true;
Option_3_Unselected.active = false;
Option_4_SELECTED.active = false;
Op_3 = true;
Op_4 = false;

if(Input.GetAxis("Vertical") < -.5)
  {
Option_3_SELECTED.active = false;
Option_4_Unselected.active = false;
Option_3_Unselected.active = true;
Option_4_SELECTED.active = true;
Op_3 = false;
Op_4 = true;
  print("this works");

  }
if(Input.GetButtonDown("Action") && Op_3 == true)
{
AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
Playerhealthscript.panic +=1;
print("1 works");
Question += 1;
Option_3_SELECTED.active = false;
Option_4_Unselected.active = false;
Option_3_Unselected.active = false;
Option_4_SELECTED.active = false;

}

else if(Input.GetButtonDown("Action") && Op_4 == true)
{
AudioSource.PlayClipAtPoint(OptionsSound, transform.position);
Playerhealthscript.insanity +=1;
print("2 works");
Question += 1;
Option_3_SELECTED.active = false;
Option_4_Unselected.active = false;
Option_3_Unselected.active = false;
Option_4_SELECTED.active = false;
}
}
}


text:
Q: Escaping piped output between commands I use the below command to delete changed files sometimes when using hg.
hg status -n | xargs rm

I have come across an problem where if the output of
hg status -n

contains any file paths with spaces in the file will not be found. Usually i would quote or escape spaces in file names but im not sure how to do this with piped output. Any help would be great thanks :)

A: Tell both commands to use NUL as the delimiter:
hg status -n0 | xargs -0 rm

Also be careful: the -n option will print even files Mercurial doesn't know about.
Maybe you want this instead?
hg status -mn0 | xargs -0 rm

Also, don't forget about hg revert or hg purge.  Maybe they do what you want, e.g.
hg revert --all --no-backup

or
.hgrc
[extensions]
hgext.purge=

shell
hg purge

A: I don't have hg installed. So I will do it with ls:
$ touch 'file A' 'file B'

$ ls -1
file A
file B

$ ls | xargs rm
rm: cannot remove `file': No such file or directory
rm: cannot remove `A': No such file or directory
rm: cannot remove `file': No such file or directory
rm: cannot remove `B': No such file or directory

$ ls | tr '\n' '\0' | xargs -0 rm

$ ls

A: Let xargs handle that with the -I option:
hg status -n | xargs -I FileName  rm FileName

-I increases the safety, but reduces the efficiency as only one filename at a time will be passed to 'rm'
An example:
$ printf "%s\n" one "2 two" "three 3 3" | xargs printf "%s\n"
one
2
two
three
3
3

$ printf "%s\n" one "2 two" "three 3 3" | xargs -I X printf "%s\n" X
one
2 two
three 3 3

A: Beside -0, newer xargs has option -d which can help you doing such things:
<command returning \n-separated paths> | xargs -d \\n rm -v


text:
Q: CSS not applying to ReactMde I'm building a notes app but I run into a problem, I installed react-mde, react-split, and showdown as dependencies using npm install  but the editor's CSS styling is missing, what could be the problem?
The source code: https://github.com/arturfriedrich/notes-app

A: This is from the Scrimba React course, right?. I was having the exact same problem. Here's how I solved it.
Just put this line of code in your App after all your imports:
import "react-mde/lib/styles/css/react-mde-all.css";

See also the React MDE documenation.


text:
Q: aircraft speed problem An aircraft is flying at a speed of $200 \text{m/s}$. As it is coming in to land the aircraft reduces its speed from $200\text{m/s}$ to $50\text{m/s}$ at a constant rate of $2.5\text{m/s$^2$}$. How many metres does it travel in this time?
So what I did was $200 - 50 = 150$ and $150 / 2.5 = 60\text{s}$, and calculated (meters)
$$\sum_{k=1}^{60}200-2.5k$$
The result of it was $12000 - 4575 = 7425$, however the answer is $7500\text{m}$. I don't know where I went wrong.

A: Hint:
The answer can be obtained directly by just using the formula  $$v_{\text {final}}^2-v_{\text{initial}}^2 =2as $$ where $s $ is the distance travelled. Hope it helps.

A: Let us play your game with seconds:
$$e=\sum_{k=0}^{59}\left(200-2.5k\right)=200\cdot60-2.5\frac{59\cdot60}{2}=7575$$
(this is different from your answer because I am summing from $0$ to $59$).
Then using tenths of a second instead, updating all parameters accordingly:
$$e=\sum_{k=0}^{599}\left(20-0.025k\right)=20\cdot600-0.025\frac{599\cdot600}{2}=7507.5$$
And now with milliseconds:
$$e=\sum_{k=0}^{59999}\left(0.2-0.0000025k\right)=0.2\cdot60000-0.0000025\frac{59999\cdot60000}{2}=7500.075$$
With microseconds, you would obtain $7500.000075$, so where's the truth ?

You can infer that with smaller and smaller units of time, you get a better and better approximation, and eventually the right answer, $7500$.

A: Hint: as long as the speed varies linearly (i.e. with constant acceleration), the distance traveled during an interval of time $t$ is simply $\bar v \cdot t$ where $\bar v$ is the average of the beginning and ending speeds. In this case $\,t=(200-50)/2.5\,$ and $\,\bar v = (200+50)/2\,$.

A: $$
\begin{align}
{\small\text{initial conditions: }}\quad \,v_{\small0}\,\, &= 200\, \,{\small\text{ at }}\, \,t_{\small0}=0\, \,{\small\text{ where }}\, \,s_{\small0}=0\, \\[2mm]
\frac{d^2s}{dt^2} &= \frac{dv}{dt} = a=\color{red}{-2.5}=-\frac52 \\[2mm]
{\small\text{Integrate once: }}\quad \frac{ds}{dt}\, &= v=-\frac52t+C_{\small1} \\[2mm]
{\small\text{Apply initial: }}\quad\,\, v_{\small0}\,\, &= -\frac52t_{\small0}+C_{\small1} \Rightarrow  C_{\small1}=200 \Rightarrow \frac{ds}{dt}=\color{red}{v=-\frac52t+200}\tag{1} \\[2mm]
{\small\text{Integrate again: }}\quad\,\,\, s\,\,\, &= -\frac54t^2+200t+C_{\small2} \\[2mm]
{\small\text{Apply initial: }}\quad\,\, s_{\small0}\,\, &= -\frac54t_{\small0}^2+200t_{\small0}+C_{\small2} \Rightarrow  C_{\small2}=0 \Rightarrow \color{red}{s=-\frac54t^2+200t}\tag{2}\\[2mm]
\end{align}
$$

Use $(1)$ and $(2)$ to calc the system. For instance,
As of the question:
$$ v=50 \,\Rightarrow\, t=\frac{v-200}{-5/2}=60 \,\Rightarrow\, s=-\frac54t^2+200t=7500 $$
When it stops:
$$ v=0 \,\Rightarrow\, t=\frac{v-200}{-5/2}=80 \,\Rightarrow\, s=-\frac54t^2+200t=8000 $$
Assuming minus velocity is backward movement; it should return-back with-in:
$$ s=0 \,\Rightarrow\, -\frac54t^2+200t=0 \rightarrow t=160 \,\Rightarrow\, v=-\frac52t+200=-200 $$

A: $$ s = \dfrac{v^2-u^2}{2 a} =  \dfrac{250\cdot 150}{2\cdot 2.5} = 7500 $$
Integration with infinitely small intervals is reckoned  in calculus.

A: $$S=ut+1/2at^2$$
$$=200 \times 60 + 1/2 \times-2.5\times60^2$$
   $$=12000-4500$$
   $$=7500$$

A: We have
$$
v(t_1) = 200 \, \frac{\text{m}}{\text{s}} \\
v(t_2) = 50 \, \frac{\text{m}}{\text{s}}
$$
and an acceleration of
$$
\dot{v}(t) = -2.5 \, \frac{\text{m}}{\text{s}^2}
$$
Integrating both sides  gives:
$$
\int\limits_{t_1}^{t_2} \dot{v}(t) \, dt
= -2.5 \, \frac{\text{m}}{\text{s}^2}  \int \limits_{t_1}^{t_2} dt \iff \\
v(t_2) - v(t_1) = - 2.5 \, \frac{\text{m}}{\text{s}^2} (t_2-t_1)
$$
so we have
$$
t_2-t_1 = \frac{50 \, \frac{\text{m}}{\text{s}} -200 \, \frac{\text{m}}{\text{s}} }{(- 2.5 \, \frac{\text{m}}{\text{s}^2})}
= 60 \, \text{s}
$$
Integrating
$$
\dot{s}(t) = 200 \, \frac{\text{m}}{\text{s}}  - 2.5 \, \frac{\text{m}}{\text{s}^2} (t-t_1)
$$
gives
\begin{align}
s(t_2) - s(t_1)
&= 200 \, \frac{\text{m}}{\text{s}} (t_2 - t_1) - \frac{5}{4} \, \frac{\text{m}}{\text{s}^2} (t_2-t_1)^2 \\
&= 200 \, \frac{\text{m}}{\text{s}} 60 \, \text{s} - \frac{5}{4} \, \frac{\text{m}}{\text{s}^2} (60 \, \text{s})^2 \\
&= 7500\, \text{m}
\end{align}

A: Let $travel_m = as^2+bs+c$ (s = time, travel_m = travelled distance)
$\frac{\text{d}^2y}{\text{d}s^2} as^2+bs+c$ (The second derivative of distance gives you the acceleration.)
$=2a=-2.5$
$a=-1.25$
$travel_m = -1.25s^2+bs+c$
At first, the travel distance was $0$, $c=0$.
$travel_m = -1.25s^2+bs$
It's speed was $200$, and the time, $s$, was zero.
$\frac{\text{d}y}{\text{d}s}-1.25s^2+bs$ (The first derivative of distance gives you the speed.)
$= -2.5s + b=200$ ($s=0$)
$b = 200$
$travel_m = -1.25s^2 + 200s$
When is the speed 50 m/s? Let's find.
$\frac{\text{d}y}{\text{d}s}-1.25s^2+200s$
$= -2.5s +200 = 50$
$= -2.5s = -150$
$ s = 60$
$-1.25s^2 + 200s$, substitute $s=60$
$= 7500$

*

*Graph of travelled distance:

*

*Graph of speed


text:
Q: Proof that if $\gcd(a,b)=1$, then $\gcd(a^2, b^2)=1$ I realize that there are similar questions to this one which already exist, I want to make sure my argumentation is sound, or if it's not, then perhaps someone can point it out to me.
Since we have that $\gcd(a,b)=1$, this implies that $1\mid a $ $\land$ $1\mid b$ $\implies$ $a=k\cdot 1$ $\land$ $b=m\cdot 1$ for $m,k\in \mathbb{Z}$. Multiplying by $a$ and $b$ respectively on both sides we get that $a^2 = ak\cdot 1$ $\land$ $b^2=bm \cdot 1$. If we let $c=ak$, $l=mb$, then we have that $a^2 = c\cdot 1$ $\land$ $b^2=l\cdot 1$ $\implies$ $1\mid a^2$ $\land$ $1\mid b^2$. This means that there exist integers $x,y$ such that $a^2x+b^2y=1$ $\implies$ $\gcd(a^2,b^2)=1$.
Am I making a leap in logic or doing something that's wrong? Please let me know.

A: It does not work and I'll explain why. First of all, avoid using $\wedge$ to mean "and", it is not easy to read and $\wedge$ is also used to mean $\gcd$ ! : $\gcd(a,b)=a\wedge b$. You did not use the fact that $\gcd(a,b)=1$ but only the fact that $1|a$ and $1|b$ (which is not a strong assumption at all). When you write that there exists $m,k\in\mathbb{Z}$ such that $a=k\cdot1$ and $b=m\cdot 1$, it is a tautology as $k=a$ and $b=m$ works. In fact you only wrote tautologies (same with $a^2=c$ and $b^2=l$ as $c=a^2$, $l=b^2$ obviously work). However, you also made a logic error : $1|a^2$ and $1|b^2$ does not mean that there exists $x,y\in\mathbb{Z}$ such that $a^2x+b^2y=1$, otherwise all integers would be coprime (take $a=b=2$ to see that it can't work). I'll give you a hint : let $d=\gcd(a^2,b^2)$, then $d|a^2$ and $d|b^2$, you can't deduce that $d|a$ and $d|b$ but it would end the proof as you would have $d|\gcd(a,b)$ and thus $d=1$, but it works if $d$ belongs in a special family of numbers.

 take $d$ a prime divisor of $\gcd(a^2,b^2)$, which exists if $\gcd(a^2,b^2)\neq 1$.

A: There are some flaws in your proof, for example, the statement:
$$1|a^2 \land 1|b^2 \implies  a^2x+b^2y=1$$
for some integers, $x$ and $y$ is not valid.
Why don't you look at the prime factorization of $a, a^2, b, b^2$ to see what is going on?