text:
Q: How to fix 2 channels dead lock each other I have this piece of Go code. I need to have this ability: write into channels in one place, and read them out in another place(or vice versa):
package main
import "fmt"
var ch1=make(chan int)
var ch2=make(chan int)

func f1() {
    select {
    case <- ch1:fmt.Println("ch1")
    default: fmt.Println("default")
    }
}
func f2() {
    select {
    case <- ch2:fmt.Println("ch2")
    default: fmt.Println("default")
    }
}
func main() {
    go f1()
    go f2()
    ch1<-1
    ch2<-2
}

It always prints sth like this:
default
ch1
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
main.main()
    /tmp/sandbox970110849/prog.go:22 +0xa0

Further more I tried this:
package main
import (
    "fmt"
    "sync"
)
var ch1=make(chan int)
var ch2=make(chan int)

func f1() {
    select {
    case <- ch1:fmt.Println("ch1")
    default: fmt.Println("default")
    }
}
func f2() {
    select {
    case <- ch2:fmt.Println("ch2")
    default: fmt.Println("default")
    }
}

func w1() {
    ch1 <-1
}

func w2() {
    ch2 <-1
}
func main() {
    var wg sync.WaitGroup
    wg.Add(4)
    go f1()
    go f2()
    go w1()
    go w2()
    wg.Wait()
}

Even more errors this time:
default
ch2
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x40e028, 0x0)
    /usr/local/go/src/runtime/sema.go:56 +0x40
sync.(*WaitGroup).Wait(0x40e020, 0x14b720)
    /usr/local/go/src/sync/waitgroup.go:130 +0x60
main.main()
    /tmp/sandbox916639182/prog.go:36 +0x100

goroutine 8 [chan send]:
main.w1()
    /tmp/sandbox916639182/prog.go:23 +0x40
created by main.main
    /tmp/sandbox916639182/prog.go:34 +0xc0

Where did I go wrong and how to fix it?

A: Your main() function tries to send on all channels, and there is only a one-time attempt to read from those channels in separate, concurrent goroutines. It's up to the goroutine scheduler if this will succeed. If the non-blocking receive in f2() is scheduled earlier than the send in main(), then the later send in main() will block forever (no one will attempt to receive from ch2 again).
One way to get rid of the deadlock is to use receive operation instead of the non-blocking receive (try it on the Go Playground):
func f1() {
    <-ch1
    fmt.Println("ch1")
}
func f2() {
    <-ch2
    fmt.Println("ch2")
}

So no matter when main() gets to the point to send values on these channels, there will always be a receiver ready to proceed, so the main() won't get stuck.
Note that when main() returns, the app ends, it does not wait for non-main goroutines to finish. So you might not see ch1 and ch2 printed on your console. For details, see No output from goroutine in Go.
If your intent is to wait for all goroutines to finish their work before your app exists, use sync.WaitGroup for that (try it on the Go Playground):
var ch1 = make(chan int)
var ch2 = make(chan int)

var wg sync.WaitGroup

func f1() {
    defer wg.Done()
    <-ch1
    fmt.Println("ch1")
}

func f2() {
    defer wg.Done()
    <-ch2
    fmt.Println("ch2")
}

func main() {
    wg.Add(1)
    go f1()
    wg.Add(1)
    go f2()

    ch1 <- 1
    ch2 <- 2
    wg.Wait()
}

See more examples here: Solving goroutines deadlock; and Prevent the main() function from terminating before goroutines finish in Golang.
Another option is to give a buffer of 1 to the channels, so the main() can send 1 value on them without a receiver ready to receive from the channels (try this one on the Go Playground):
var ch1 = make(chan int, 1)
var ch2 = make(chan int, 1)

With this the main() can proceed without f1() and f2(), so again, there is no guarantee you will see anything printed.

A:
Channels used here are unbuffered channels.

*

*when main goroutines starts it creates two new goroutine f1 and f2.

*when f1 or f2 is executed it will check whether we have value in the channel else it will print the default message and exit.

*In ideal situation,channels will be published with value first and then it's is received via the goroutine

*Actual situation is that goroutines are exiting by printing the default case but main goroutine is trying to publish value in a channel but since no receiver is there it faces a deadlock situation.

Removed deadlock from first example,
  Refer the link:https://play.golang.org/p/6RuQQwC9JkA

However,if main routine exits all the associated goroutines will be killed automatically.
That's why we can see that value is printed arbitrarily.

Removed deadlock from Second example,
  Refer the link:https://play.golang.org/p/yUmc_jjZMgV

sync.WaitGroup is making main goroutine wait that's why we can observe the output everytime our program executes.


text:
Q: @EnableAutoConfiguration annotation with class prameter is not initializing properties object i  have following @CongfigurationProperties class
//@Component
@ConfigurationProperties
@PropertySource("classpath:typesofcharge.properties")
public class ChargeProperties {
    private HashMap<String,String> charge=new HashMap<>();
    public HashMap<String,String> getCharge()
    {
        return this.charge;
    }

}

And this is my Configuration file
@SpringBootApplication
@ComponentScan({"com.vehiclemanagement.config,com.vehiclemanagement.client,"
        + "com.vehiclemanagement.controller,"
        + "com.vehiclemanagement.exception,"
        + "com.vehiclemanagement.model,"
        + "com.vehiclemanagement.service"})
@EnableConfigurationProperties(ChargeProperties.class)
public class VehicleManagementConfig {

    public static void main(String[] args) {
        SpringApplication.run(VehicleManagementConfig.class, args);
    }

}

If i use @Component annotation in ChargeProperties and remove ChargeProperties.class annotation in Configuration class the charge HashMap is  initialized properly
If i remove @Component and pass ChargeProperties.class as argument  like this
@EnableConfigurationProperties(ChargeProperties.class) like how document says the charge HashMap is empty when i run
I am using spring boot 2.0.2 release .But i am following latest docs. Can anyone explain why this are not working as document suggest
content of property file is as follows
UPDATE the content of property files are as shown
#DO NOT MODIFY THIS FILE
charge.peak=Double_rate;
charge.lateNight=duration_based_charge;
charge.earlyMorning=special_offers;

A: When specifying ChargeProperies.class on the @EnableConfigurationProperties annotation it will be registered as a bean through the EnableConfigurationPropertiesImportSelector class inside @EnableConfigurationProperties.
So in the example, if you have only annotated the ChargeProperties class with @ConfigurationProperties it will create a chargeProperties bean with an empty charge HashMap because it defaulted back to application.properties as the source.
A custom source can be specified by using @PropertySource.

@PropertySource annotation providing a convenient and declarative mechanism for adding
  a PropertySource to Spring's Environment. To be used in conjunction
  with @Configuration classes.

As per documentation above, to use @PropertySource to load the custom source, one has to use the @Configuration annotation.
@Configuration
@PropertySource("classpath:typesofcharge.properties")

Under the hood a @Configuration class is a @Component.
@Target(value=TYPE)
 @Retention(value=RUNTIME)
 @Documented
 @Component
public @interface Configuration

So to your question. By specifying a custom @PropertySource without @Configuration, spring did not load the properties in the @PropertySource annotation and defaulted back to the application.properties.

A: If we use @PropertySource we have to use component otherwise the properties will not be read
since we added the @ComponentScan We don't have to mention @EnableConfiguationProperties annotation at all The propety class object can be autowired as Bean

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Configure Routes of Scaffold Generator in Rails I'm having trouble with configuring the model which is generated by scaffold in my Rails 4 application.
These are my models:
class Contact < ActiveRecord::Base
    belongs_to :user
end

class User < ActiveRecord::Base
    has_one :contact

    after_create :make_contact
    def make_contact
      create_contact(
       :country => "USA",
       :city => "Newyork"
      )
    end
end

As you can see, I'm creating a Profile model instance for each User when they registered for the site.
I generated User model with Devise GEM and generated Contact model with rails scaffold generator.
1) I want my Users to only update or view their profile. I want to prevent them to list all profiles, destroy their profiles or create a new profile. What is the best approach to do this?
2) I want my application to redirect automatically to the users related profile page when they visit /contacts route.
3) User can't be able to see other users profiles by changing the URL like /contacts/1, contacts/2 etc.
How can I do this?
Thanks.

A: User before_filter/before_action in your controller
def UsersController < ApplicationController
 before_filter :restrict_user, :only => [:show, :edit, :update]

 private
 def restrict_user
   redirect_to :root, :alert => "Not authorized" unless params[:id] = current_user.id
 end
end

In your routes, you can specify only the actions that you want
resources :users, :only => [:new, :create, :edit, :update, :show] #index and destroy are not in the list

You can do the same in contacts controller too


text:
Q: printf doubles without trailing zeroes I declare a variable double MyDouble;.
If I then set MyDouble = 1000.0 / 3.0; and then
printf("%g", MyDouble); gives 333.333 so it's lost some precision.
If I use printf("%lf", MyDouble); I get the precision.
The down side is if I now set MyDouble = 5.0 / 2.0; and use printf("%lf", MyDouble); I get 2.500000, so trailing zeroes.
As a general case, how can I have the precision without the trailing zeroes. I could write the double to a string using snprintf and the %lf format and then write a subroutine to strip trailing zeroes, but there must be an easier way.

A: The precision of the g conversion specifier controls the maximum number of significant digits (see C.2011§7.21.6.1¶4). Precision is specified by a number following a decimal point. It seems you want 9 significant digits. So, try:
printf("%.9g", MyDouble);

A: You can try like this to avoid trailing zero.
double a= 5.0;
double b = 2.0;
printf("%.2lf\n", a/b);


text:
Q: How to use MVVM with any fragment? I have a TabLayout on a activity and when user clicks on any tab then a fragment is loaded. One of those fragments contains a NavigationView running inside a DrawerLayout. Now the problem is I have to implement MVVM for the whole app and so for the fragments too, I have done this for Activities but I am having trouble while implementing this for Fragments and how to deal with ItemSelected with MVVM and what to bind and how? I am unable to find a proper working sample of the same. Here's the code:
MoreFragment.java:
package com.abc.Fragments;

import android.arch.lifecycle.ViewModel;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.abc.MainActivity;
import com.abc.MoreFragmentViewModel;
import com.abc.R;

public class MoreFragment extends Fragment {

    private DrawerLayout mDrawerLayout;
    private ListView mDrawerList;
    private ViewModel viewModel;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        viewModel = ViewModelProviders.of(this).get(MoreFragmentViewModel.class);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View fragView =  inflater.inflate(R.layout.fragment_more, container, false);
        return fragView;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mDrawerLayout = getView().findViewById(R.id.drawer_layout);
        mDrawerLayout.openDrawer(Gravity.END);

    }
}

fragment_more.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:background="@color/grey"
        app:navigationItemSelectedListener="@{()-> viewModel.onMyItemSelected()}"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>

MoreFragmentViewModel.java:
package com.abc;
import android.arch.lifecycle.ViewModel;
import android.databinding.BaseObservable;

public class MoreFragmentViewModel extends ViewModel {

    public void onMyItemSelected(){
        System.out.print("Item Clicked");
    }
}

Please do any possible help.

A: Use:
DataBindingUtil.inflate(inflater, layoutId(), container, false)

To inflate your layout.
And don't forget to add:

<data>
    <variable
            name="model"
            type="MoreFragmentViewModel"/>
</data>

To your fragment layout.


text:
Q: Python conflict with keyword "from" in telegram bot I would like to print user information in Python script using python-telegram-bot referring to this page
But when I type
print update.message.from
keyword .from is recognized as internal reserved keyword and I get invalid syntax error.
How can I solve?
Thanks.

A: As explained in the python-telegram-bot code and documentation itself:

*

*In Python from is a reserved word, use from_user instead.

So: print update.message.from_user.

A: Use getattr.
x = getattr(update.message, 'from').id

It's not the name of the key that is a problem, but the attempt to access it using attribute syntax.


text:
Q: How to change language in mapbox I need to change the language of the mapbox in javascript, I only see the below code in the documentation
map.setLayoutProperty('country-label', 'text-field', ['get', 'name_de'])

but this line of code will only change the country names but I need everything ( city, town, ...etc)

A: Based on your mapbox style, there will be different text layers. For dark-v9, these are the available text layers.
country-label
state-label
settlement-label
settlement-subdivision-label
airport-label
poi-label
water-point-label
water-line-label
natural-point-label
natural-line-label
waterway-label
road-label

Using the code snippet that you mentioned in the question on the above layers, you should be able to change the language.
map.setLayoutProperty('country-label', 'text-field', ['get', 'name_de'])

Or you can use mapbox-language-plugin to change the language of all the possible layers.  Here is the working example of the plugin.

<!DOCTYPE html>

    <meta charset='utf-8' />
    <title>Change a map's language</title>
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.css' rel='stylesheet' />

French

Russian

German

Spanish

Ref: https://blog.mapbox.com/how-to-localize-your-maps-in-mapbox-gl-js-da4cc6749f47

A: Here is a code I have found helpful for me from github mapbox here
map.getStyle().layers.forEach(function(thisLayer){
  if(thisLayer.type == 'symbol'){
    map.setLayoutProperty(thisLayer.id, 'text-field', ['get','name_ja'])
  }
})

I have modified it to
map.getStyle().layers.forEach(function(thisLayer){
        console.log(thisLayer);
            if(thisLayer.id.indexOf('-label')>0){
                console.log('change '+thisLayer.id);
                map.setLayoutProperty(thisLayer.id, 'text-field', ['get','name_fr'])
            }
        });

But otherwise you'll have to change the different labels yourself as mentionned by murli-prajapati
Of course, change 'name_xx' by your own language
such as:
map.setLayoutProperty('country-label', 'text-field', ['get','name_fr']);
map.setLayoutProperty('state-label', 'text-field', ['get','name_fr']);
map.setLayoutProperty('settlement-label', 'text-field', ['get','name_fr']);
map.setLayoutProperty('settlement-subdivision-label', 'text-field', ['get','name_fr']);

A: The only thing that helped me is a cycle placed in load event:
map.on('load', function() {
           let labels = [ 'country-label', 'state-label',
           'settlement-label', 'settlement-subdivision-label',
           'airport-label', 'poi-label', 'water-point-label',
           'water-line-label', 'natural-point-label',
           'natural-line-label', 'waterway-label', 'road-label' ];

            labels.forEach(label => {
                    map.setLayoutProperty(label, 'text-field', 'get','name_ru']);
            });
 })

Language plugin and other stuff didn't work.

A: Belatedly, you could use this plugin to change the display language according to the user locale.
https://github.com/mapbox/mapbox-gl-language
For example:
mapboxgl.accessToken = 'YOUR_ACCESS_TOKEN';
const map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v10',
    center: [-77.0259, 38.9010],
    zoom: 9
});

const language = new MapboxLanguage();
map.addControl(language);

A: After trying all the solutions in this thread with streets-v12 I found non of them gave me what I needed.
The plug-in doesn't work at all, and @Mike & @honey59 solutions semi-work, I still found many components not translated.
What did work best for me was to use Mapbox's studio to create custom map and change the language there to all the components & layers (guide: https://docs.mapbox.com/help/troubleshooting/change-language/).
And on my site I know when user is viewing the page on a specific language, so I just needed to map the languages to their custom maps URLs.
I know it's not the most "technical" dynamic solution, but I found it to be the most complete one


text:
Q: Database in Free Pascal I want to have some file database with a lot of text. I know how to create and read file, but in this case, I need to find specific line and then read it. I don't really care for permonace. My first Idea was to create a lot of smaller files and save them in some archive, but I don't even know, if fp support archives.
Thanks for any help.

A: Most Borland style dialects don't allow seeking in TEXTfiles. (the text(file) type in pascal).
There are two possible directions:

*

*file is small ( read in memory, process, write

*Switch to binary (file) mode, so that you can seek() in the file, and keep an index for
fast access.


text:
Q: Chaining calculation on click - problem with multiply and divide Currently i'm working on React calculator. Slowly but surely I'm about to finish this project ,but today I have noticed this Math logic error.
Example

2+2*5 - returns 20 but should return 12 ,because multiplication is of course preferred.

Function which is called after every click on operator button
function operator(e){
let newOperator='';
let oldOperator=number.operator;
let result;

if(number.firstNumber && number.operator && number.secondNumber){
  newOperator = e.target.name;

  if(oldOperator === '+'){
    result = Number(number.firstNumber) + Number(number.secondNumber);
  }

  if(oldOperator === 'x'){
    result = Number(number.firstNumber) * Number(number.secondNumber);
  }

  if(oldOperator === '-'){
    result = Number(number.firstNumber) - Number(number.secondNumber);
  }

  if(oldOperator === '/'){
    result = Number(number.firstNumber) / Number(number.secondNumber);
  }

  setNumber(prevState => ({
    ...prevState,
    firstNumber:result,
    displayed:result,
    operator:newOperator,
    secondNumber:''
  }))

}else{
  let operator = e.target;
  setNumber(prevState => ({
    ...prevState,
    operator:operator.name
  }))
  turnOnOrange(operator);
}

There is nothing bad with this function and it works great, except that logical problem with multiply and probably with division too. I know the problem is every time i press new operator button and condition is fulfilled function make it's calculation a push it to state. So like in the Example above ,function first adds 2+2 and result of that multiplies by 5.
I've tried to fix this by creating specific If conditions ,variables and using prevState of second number ,because after every operation(no matter if + - * or / ) secondNumber state is set to empty, and result is pushed to firstNumber state.because of possibility of chaining.
for example
let oldOperator = number.operator;
let newOperator = event.target.name;
if(oldOperator === '+' && newOperator === 'x'){
    result = Number(number.firstNumber) + Number(number.prevNum) * Number(number.secondNumber);
}

But It also didn't work. I think it is just logical problem with those conditions and I can't figure it out how to write it correct.
Codesandbox link
https://codesandbox.io/s/goofy-cannon-l5kbt?fontsize=14&hidenavigation=1&theme=dark
Thanks

A: You can use the eval() function. This function will do the calculation for you.
Therefore you have to put the whole equation in the eval function.

const equation = "2+2*5"
console.log(eval(equation))


text:
Q: What is req.body in node? I am learning nodejs and express, during my studies I don't understand various uses of req such as:
var id = req.params.id;
var wine = req.body;

With my req object I think am acessing body, params.id, but I do not understand how this works and what result I should expect. Can anyone explain this code in a simpler step by step manner so i can make sense of it ?
Below is some example code where the above is used :
 exports.addDoctor = function(req,res){
        var doctor = req.body;
        console.log(doctor);
            db.collection('doctors',function(err,collection){
            collection.insert(doctor,{safe:true},function(err,result){
                if (err) {
                    res.send({'error':'An error is occured'});
                } else {
                    console.log('Success: ' + JSON.stringify(result[0]));
                    res.send(result[0]);
                }
            });
        });
    }

In the above example console.log(doctor) only returns {}. Why is this and is it because I have missed something else within the code specifically involving 'req'?

A: req is the request object. It's documented here: http://expressjs.com/api.html#req.params

A: req is an object containing information about the HTTP request that raised the event. There is a simular Question (node.js what is res and req in expressjs?), have a look at the answers there.


text:
Q: gradle experimental plugin ndk, stl related problems I am trying to enable ndk support in android studio, and facing issues related to mutex and other headers. I have taken a look at this Can't include C++ headers like vector in Android NDK, but my understanding is that with the experimental plugin, all the settings that were in Android.mk need to be done within app/build.gradle
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :cpp_example_util:generateDebugSources, :cpp_example_util:generateDebugAndroidTestSources, :cpp_example_util:mockableAndroidJar, :cpp_example_util:prepareDebugUnitTestDependencies, :cpp_example_util:compileDebugSources, :cpp_example_util:compileDebugAndroidTestSources, :cpp_example_util:compileDebugUnitTestSources]
/home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/point_cloud_renderer.cc
Information:(17) (Unknown) In file included
/home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/tango-plane-fitting/point_cloud_renderer.h
Error:(20, 17) mutex: No such file or directory
/home/mihai/Projects/tango-ar/tango_client_api/include/tango_client_api.h
Information:(19) (Unknown) In file included
/home/mihai/Projects/tango-ar/third_party/glm/glm/mat2x2.hpp
Information:(31) (Unknown) In file included
/home/mihai/Projects/tango-ar/third_party/glm/glm/detail/type_mat2x2.hpp
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/gabi++/include/cstdint
Information:(37) (Unknown) In file included
/usr/include/stdint.h
Warning:(148) warning: "__INT64_C" redefined
Warning:(149) warning: "__UINT64_C" redefined
Warning:(148) warning: "__INT64_C" redefined
Warning:(149) warning: "__UINT64_C" redefined
Warning:(148) warning: "__INT64_C" redefined
Warning:(149) warning: "__UINT64_C" redefined
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_algobase.h
Information:(720) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_algobase.c
Error:(301, 26) error: 'UCHAR_MAX' was not declared in this scope
Error:(301, 43) error: 'CHAR_BIT' was not declared in this scope
Error:(302, 10) error: '__hints' was not declared in this scope
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_cprolog.h
Information:(18) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_limits.h
Error:(124, 81) error: 'CHAR_BIT' was not declared in this scope
Error:(198, 45) error: 'CHAR_MIN' was not declared in this scope
Error:(198, 55) error: 'CHAR_MAX' was not declared in this scope
Error:(198, 73) error: template argument 2 is invalid
Error:(198, 73) error: template argument 3 is invalid
Error:(204, 52) error: 'SCHAR_MIN' was not declared in this scope
Error:(204, 63) error: 'SCHAR_MAX' was not declared in this scope
Error:(204, 82) error: template argument 2 is invalid
Error:(204, 82) error: template argument 3 is invalid
Error:(210, 57) error: 'UCHAR_MAX' was not declared in this scope
Error:(210, 76) error: template argument 3 is invalid
Error:(224, 46) error: 'SHRT_MIN' was not declared in this scope
Error:(224, 56) error: 'SHRT_MAX' was not declared in this scope
Error:(224, 74) error: template argument 2 is invalid
Error:(224, 74) error: template argument 3 is invalid
Error:(229, 58) error: 'USHRT_MAX' was not declared in this scope
Error:(229, 77) error: template argument 3 is invalid
Error:(239, 44) error: 'INT_MIN' was not declared in this scope
Error:(239, 53) error: 'INT_MAX' was not declared in this scope
Error:(239, 70) error: template argument 2 is invalid
Error:(239, 70) error: template argument 3 is invalid
Error:(244, 56) error: 'UINT_MAX' was not declared in this scope
Error:(244, 74) error: template argument 3 is invalid
Error:(249, 45) error: 'LONG_MIN' was not declared in this scope
Error:(249, 55) error: 'LONG_MAX' was not declared in this scope
Error:(249, 73) error: template argument 2 is invalid
Error:(249, 73) error: template argument 3 is invalid
Error:(254, 57) error: 'ULONG_MAX' was not declared in this scope
Error:(254, 76) error: template argument 3 is invalid
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/config/features.h
Information:(803, 75) in definition of macro '_STLP_STATIC_CONSTANT'
Information:(311, 66) in definition of macro '_STLP_STATIC_ASSERT'
Information:(583, 51) in definition of macro '__STATIC_CAST'
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_num_put.c
Information:(26) (Unknown) In file included
Error:(158, 71) error: 'is_signed' is not a member of 'std::numeric_limits<long int>'
Error:(159, 82) error: 'max' is not a member of 'std::numeric_limits<long int>'
Information:(159, 55) in expansion of macro '__STATIC_CAST'
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_istream.h
Information:(352) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_istream.c
Error:(651, 73) error: 'is_signed' is not a member of 'std::numeric_limits<long int>'
Error:(652, 88) error: 'max' is not a member of 'std::numeric_limits<long int>'
Information:(652, 61) in expansion of macro '__STATIC_CAST'
Error:(865, 11) error: 'max' is not a member of 'std::numeric_limits<long int>'
Error:(1110, 33) error: 'max' is not a member of 'std::numeric_limits<long int>'
Error:(1112, 17) error: 'max' is not a member of 'std::numeric_limits<int>'
Error:(1150, 33) error: 'max' is not a member of 'std::numeric_limits<long int>'
Error:(1152, 17) error: 'max' is not a member of 'std::numeric_limits<int>'
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_algo.c
Information:(34) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_tempbuf.h
Error:(89, 30) error: 'INT_MAX' was not declared in this scope
Information:(160) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_tempbuf.c
Error:(39, 25) error: 'INT_MAX' was not declared in this scope
/usr/local/include/eigen3/Eigen/src/Core/MathFunctions.h
Error:(479, 45) error: 'CHAR_BIT' was not declared in this scope
Error:(522, 61) error: template argument 3 is invalid
Error:(522, 61) error: template argument 4 is invalid
Error:(523, 43) error: 'CHAR_BIT' was not declared in this scope
/usr/local/include/eigen3/Eigen/src/Core/DenseStorage.h
Error:(277, 16) error: 'move' is not a member of 'std'
Error:(278, 16) error: 'move' is not a member of 'std'
Error:(279, 16) error: 'move' is not a member of 'std'
Error:(336, 16) error: 'move' is not a member of 'std'
Error:(337, 16) error: 'move' is not a member of 'std'
Error:(390, 16) error: 'move' is not a member of 'std'
Error:(391, 16) error: 'move' is not a member of 'std'
/usr/local/include/eigen3/Eigen/src/Core/PlainObjectBase.h
Error:(442, 20) error: 'move' is not a member of 'std'
/usr/local/include/eigen3/Eigen/src/Core/Matrix.h
Error:(216, 14) error: 'move' is not a member of 'std'
/usr/local/include/eigen3/Eigen/Core
Information:(259) (Unknown) In file included
Information:(258) (Unknown) In file included
Information:(288) (Unknown) In file included
Information:(293) (Unknown) In file included
Information:(294) (Unknown) In file included
Information:(295) (Unknown) In file included
/usr/local/include/eigen3/Eigen/src/Core/Array.h
Error:(129, 14) error: 'move' is not a member of 'std'
/usr/local/include/boost/smart_ptr/detail/sp_nullptr_t.hpp
Error:(35, 18) error: 'nullptr_t' in namespace 'std' does not name a type
/usr/local/include/boost/shared_ptr.hpp
Information:(17) (Unknown) In file included
/usr/local/include/boost/config.hpp
Information:(61) (Unknown) In file included
/usr/local/include/boost/smart_ptr/shared_ptr.hpp
Information:(31) (Unknown) In file included
Error:(340, 45) error: invalid use of '::'
Error:(340, 45) error: expected ';' at end of member declaration
Error:(340, 47) error: expected unqualified-id before 'noexcept'
Error:(365, 63) error: expected ')' before 'p'
Error:(380, 72) error: expected ')' before 'p'
Error:(604, 57) error: declaration of 'operator=' as non-function
Error:(604, 26) error: expected ';' at end of member declaration
Error:(604, 57) error: ISO C++ forbids declaration of 'sp_nullptr_t' with no type [-fpermissive]
Error:(604, 57) error: invalid use of '::'
Error:(604, 57) error: expected ';' at end of member declaration
Error:(604, 59) error: expected unqualified-id before 'noexcept'
Error:(751, 83) error: 'boost::detail::sp_nullptr_t' has not been declared
Error:(756, 58) error: declaration of 'operator==' as non-function
Error:(756, 43) error: 'sp_nullptr_t' is not a member of 'boost::detail'
Error:(756, 86) error: expected primary-expression before 'const'
Error:(761, 83) error: 'boost::detail::sp_nullptr_t' has not been declared
Error:(766, 58) error: declaration of 'operator!=' as non-function
Error:(766, 43) error: 'sp_nullptr_t' is not a member of 'boost::detail'
Error:(766, 86) error: expected primary-expression before 'const'
/usr/local/include/boost/signals2.hpp
Information:(15) (Unknown) In file included
/usr/local/include/boost/signals2/deconstruct.hpp
Error:(72, 17) error: 'forward' is not a member of 'std'
Error:(72, 34) error: expected primary-expression before '>' token
Error:(299, 22) error: 'forward' is not a member of 'std'
Error:(299, 39) error: expected primary-expression before '>' token
Error:(480, 48) error: 'forward' is not a member of 'std'
Error:(480, 65) error: expected primary-expression before '>' token
/usr/local/include/boost/utility/addressof.hpp
Information:(15) (Unknown) In file included
/usr/local/include/boost/core/addressof.hpp
Error:(58, 18) error: 'nullptr_t' in namespace 'std' does not name a type
Error:(62, 35) error: 'addr_nullptr_t' was not declared in this scope
Error:(62, 50) error: template argument 1 is invalid
Error:(72, 35) error: 'addr_nullptr_t' was not declared in this scope
Error:(72, 56) error: template argument 1 is invalid
Error:(82, 35) error: 'addr_nullptr_t' was not declared in this scope
Error:(82, 59) error: template argument 1 is invalid
Error:(92, 35) error: 'addr_nullptr_t' was not declared in this scope
Error:(92, 65) error: template argument 1 is invalid
/usr/local/include/boost/integer_fwd.hpp
Error:(137, 29) error: 'digits' is not a member of 'std::numeric_limits<unsigned char>'
Error:(137, 29) error: 'digits' is not a member of 'std::numeric_limits<unsigned char>'
Error:(137, 74) error: template argument 1 is invalid
/usr/local/include/boost/integer_traits.hpp
Error:(83, 46) error: 'CHAR_MIN' was not declared in this scope
Error:(83, 56) error: 'CHAR_MAX' was not declared in this scope
Error:(83, 64) error: template argument 2 is invalid
Error:(83, 64) error: template argument 3 is invalid
Error:(89, 53) error: 'SCHAR_MIN' was not declared in this scope
Error:(89, 64) error: 'SCHAR_MAX' was not declared in this scope
Error:(89, 73) error: template argument 2 is invalid
Error:(89, 73) error: template argument 3 is invalid
Error:(95, 58) error: 'UCHAR_MAX' was not declared in this scope
Error:(95, 67) error: template argument 3 is invalid
Error:(131, 47) error: 'SHRT_MIN' was not declared in this scope
Error:(131, 57) error: 'SHRT_MAX' was not declared in this scope
Error:(131, 65) error: template argument 2 is invalid
Error:(131, 65) error: template argument 3 is invalid
Error:(137, 59) error: 'USHRT_MAX' was not declared in this scope
Error:(137, 68) error: template argument 3 is invalid
Error:(143, 45) error: 'INT_MIN' was not declared in this scope
Error:(143, 54) error: 'INT_MAX' was not declared in this scope
Error:(143, 61) error: template argument 2 is invalid
Error:(143, 61) error: template argument 3 is invalid
Error:(149, 57) error: 'UINT_MAX' was not declared in this scope
Error:(149, 65) error: template argument 3 is invalid
Error:(155, 46) error: 'LONG_MIN' was not declared in this scope
Error:(155, 56) error: 'LONG_MAX' was not declared in this scope
Error:(155, 64) error: template argument 2 is invalid
Error:(155, 64) error: template argument 3 is invalid
Error:(161, 58) error: 'ULONG_MAX' was not declared in this scope
Error:(161, 67) error: template argument 3 is invalid
/usr/local/include/boost/function/function_base.hpp
Information:(21) (Unknown) In file included
/usr/local/include/boost/type_traits/type_with_alignment.hpp
Information:(19) (Unknown) In file included
/usr/local/include/boost/integer.hpp
Information:(18) (Unknown) In file included
Information:(20) (Unknown) In file included
Error:(84, 68) error: 'CHAR_BIT' was not declared in this scope
Error:(84, 76) error: template argument 1 is invalid
Error:(85, 72) error: 'CHAR_BIT' was not declared in this scope
Error:(85, 80) error: template argument 1 is invalid
Error:(104, 78) error: 'CHAR_BIT' was not declared in this scope
Error:(104, 86) error: template argument 1 is invalid
Error:(105, 81) error: 'CHAR_BIT' was not declared in this scope
Error:(105, 89) error: template argument 1 is invalid
Error:(117, 7) error: 'CHAR_BIT' was not declared in this scope
Error:(122, 58) error: 'CHAR_BIT' was not declared in this scope
Error:(126, 22) error: 'digits' is not a member of 'std::numeric_limits<long int>'
Error:(127, 22) error: 'digits' is not a member of 'std::numeric_limits<int>'
Error:(128, 22) error: 'digits' is not a member of 'std::numeric_limits<short int>'
Error:(129, 22) error: 'digits' is not a member of 'std::numeric_limits<signed char>'
Error:(130, 9) error: template argument 1 is invalid
Error:(138, 6) error: 'CHAR_BIT' was not declared in this scope
Error:(153, 58) error: 'CHAR_BIT' was not declared in this scope
Error:(157, 20) error: 'digits' is not a member of 'std::numeric_limits<long unsigned int>'
Error:(158, 20) error: 'digits' is not a member of 'std::numeric_limits<unsigned int>'
Error:(159, 20) error: 'digits' is not a member of 'std::numeric_limits<short unsigned int>'
Error:(160, 20) error: 'digits' is not a member of 'std::numeric_limits<unsigned char>'
Error:(161, 9) error: template argument 1 is invalid
Error:(184, 24) error: 'const_max' is not a member of 'boost::integer_traits<long int>'
Error:(185, 24) error: 'const_max' is not a member of 'boost::integer_traits<int>'
Error:(186, 24) error: 'const_max' is not a member of 'boost::integer_traits<short int>'
Error:(187, 24) error: 'const_max' is not a member of 'boost::integer_traits<signed char>'
Error:(188, 9) error: template argument 1 is invalid
Error:(206, 24) error: 'const_min' is not a member of 'boost::integer_traits<long int>'
Error:(207, 24) error: 'const_min' is not a member of 'boost::integer_traits<int>'
Error:(208, 24) error: 'const_min' is not a member of 'boost::integer_traits<short int>'
Error:(209, 24) error: 'const_min' is not a member of 'boost::integer_traits<signed char>'
Error:(210, 9) error: template argument 1 is invalid
Error:(250, 24) error: 'const_max' is not a member of 'boost::integer_traits<long unsigned int>'
Error:(251, 24) error: 'const_max' is not a member of 'boost::integer_traits<unsigned int>'
Error:(252, 24) error: 'const_max' is not a member of 'boost::integer_traits<short unsigned int>'
Error:(253, 24) error: 'const_max' is not a member of 'boost::integer_traits<unsigned char>'
Error:(254, 9) error: template argument 1 is invalid
/usr/local/include/boost/scoped_ptr.hpp
Information:(14) (Unknown) In file included
/usr/local/include/boost/smart_ptr/scoped_ptr.hpp
Error:(121, 83) error: 'boost::detail::sp_nullptr_t' has not been declared
Error:(126, 58) error: declaration of 'operator==' as non-function
Error:(126, 43) error: 'sp_nullptr_t' is not a member of 'boost::detail'
Error:(126, 86) error: expected primary-expression before 'const'
Error:(131, 83) error: 'boost::detail::sp_nullptr_t' has not been declared
Error:(136, 58) error: declaration of 'operator!=' as non-function
Error:(136, 43) error: 'sp_nullptr_t' is not a member of 'boost::detail'
Error:(136, 86) error: expected primary-expression before 'const'
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_vector.h
Information:(729) (Unknown) In file included
/home/mihai/Android/Sdk/ndk-bundle/sources/cxx-stl/stlport/stlport/stl/_bvector.h
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(110, 24) in expansion of macro '_STLP_WORD_BIT'
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(118, 19) in expansion of macro '_STLP_WORD_BIT'
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(133, 19) in expansion of macro '_STLP_WORD_BIT'
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(143, 12) in expansion of macro '_STLP_WORD_BIT'
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(298, 24) in expansion of macro '_STLP_WORD_BIT'
Error:(37, 29) error: 'CHAR_BIT' was not declared in this scope
Information:(404, 47) in expansion of macro '_STLP_WORD_BIT'
/usr/local/include/boost/signals2/signal.hpp
Information:(22) (Unknown) In file included
/usr/local/include/boost/move/utility.hpp
Information:(28) (Unknown) In file included
/usr/local/include/boost/signals2/connection.hpp
Error:(164, 62) error: 'move' is not a member of 'std'
Information:(164, 62) suggested alternatives:
In file included from /usr/local/include/boost/move/move.hpp:32:0,
                 from /usr/local/include/boost/variant/detail/move.hpp:28,
                 from /usr/local/include/boost/variant/detail/initializer.hpp:23,
                 from /usr/local/include/boost/variant/variant.hpp:30,
                 from /usr/local/include/boost/signals2/slot_base.hpp:22,
                 from /usr/local/include/boost/signals2/detail/tracked_objects_visitor.hpp:18,
                 from /usr/local/include/boost/signals2/slot.hpp:22,
                 from /usr/local/include/boost/signals2/connection.hpp:23,
                 from /usr/local/include/boost/signals2/signal.hpp:22,
                 from /usr/local/include/boost/signals2.hpp:19,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/tango-plane-fitting/localisation_interface.hpp:7,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/tango-plane-fitting/Floor.h:9,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/Floor.cpp:5:
/usr/local/include/boost/move/algorithm.hpp:55:6: note:   'boost::move'
Error:(173, 33) error: 'move' is not a member of 'std'
Information:(173, 33) suggested alternatives:
In file included from /usr/local/include/boost/move/move.hpp:32:0,
                 from /usr/local/include/boost/variant/detail/move.hpp:28,
                 from /usr/local/include/boost/variant/detail/initializer.hpp:23,
                 from /usr/local/include/boost/variant/variant.hpp:30,
                 from /usr/local/include/boost/signals2/slot_base.hpp:22,
                 from /usr/local/include/boost/signals2/detail/tracked_objects_visitor.hpp:18,
                 from /usr/local/include/boost/signals2/slot.hpp:22,
                 from /usr/local/include/boost/signals2/connection.hpp:23,
                 from /usr/local/include/boost/signals2/signal.hpp:22,
                 from /usr/local/include/boost/signals2.hpp:19,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/tango-plane-fitting/localisation_interface.hpp:7,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/tango-plane-fitting/Floor.h:9,
                 from /home/mihai/Projects/tango-ar/cpp_plane_fitting_example/app/src/main/jni/Floor.cpp:5:
/usr/local/include/boost/move/algorithm.hpp:55:6: note:   'boost::move'...

This is my app/build.gradle:
apply plugin: 'com.android.model.application'
model {
    android {
        compileSdkVersion 23
        buildToolsVersion "24"

        defaultConfig {
            applicationId "com.projecttango.examples.cpp.planefitting"
            minSdkVersion.apiLevel 19
            targetSdkVersion.apiLevel 19
            versionCode 1
            versionName "1.0"

            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles.add(file("proguard-android.txt"))

                    ndk {
                        debuggable = true
                    }
                }
                debug {
                    debuggable = true
                }
            }
        }

        ndk {
            moduleName "tango-plane-fitting"
            stl "stlport_static"
            cppFlags.add("-I${file("src/main/jni/tango-plane-fitting/")}".toString())
            cppFlags.add("-I${file("/usr/local/include/")}".toString())
            cppFlags.add("-I${file("/usr/include/")}".toString())
            cppFlags.add("-I${file("/usr/include/x86_64-linux-gnu/")}".toString())
            cppFlags.add("-I${file("/usr/local/include/eigen3/")}".toString())
            cppFlags.add("-I${file("../../tango_client_api/include/")}".toString())
            cppFlags.add("-I${file("../../third_party/glm/")}".toString())
            cppFlags.add("-I${file("../../third_party/glm/glm/")}".toString())
            cppFlags.add("-I${file("../../tango_gl/include/")}".toString())
            cppFlags.add("-I${file("../../tango_support_api/include/")}".toString())
            cppFlags.add("-std=c++11")
            cppFlags.add("-fexceptions")
            ldLibs.addAll(['GLESv2', 'log', 'android'])
        }
        sources {
            main {
                java {
                    source {
                        srcDir "src"
                    }
                }
                jni
                {
                    source
                    {
                        include "jni_interface.cc"
                        include "plane_fitting.cc"
                        include "plane_fitting_application.cc"
                        include "point_cloud_renderer.cc"
                        include "../../../tango_gl/bounding_box.cc"
                        include "../../../tango_gl/camera.cc "
                        include "../../../tango_gl/conversions.cc "
                        include "../../../tango_gl/cube.cc "
                        include "../../../tango_gl/drawable_object.cc "
                        include "../../../tango_gl/mesh.cc "
                        include "../../../tango_gl/shaders.cc "
                        include "../../../tango_gl/transform.cc "
                        include "../../../tango_gl/util.cc "
                        include "../../../tango_gl/video_overlay.cc"
                    }
                }
            }
        }
    }
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkBuild
}
task ndkBuild(type: Exec) {
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    def ndkbuild = properties.getProperty('ndk.dir', null)+"/ndk-build"
    commandLine ndkbuild, '-C', file('src/main/jni').absolutePath
}

dependencies {
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.android.volley:volley:1.0.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':cpp_example_util')
}

build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {

    repositories {
        jcenter()
    }

    dependencies {
//        classpath 'com.android.tools.build:gradle:2.2.0-rc1'
        classpath 'com.android.tools.build:gradle-experimental:0.7.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

A: You need to remove these lines:
        cppFlags.add("-I${file("/usr/local/include/")}".toString())
        cppFlags.add("-I${file("/usr/include/")}".toString())
        cppFlags.add("-I${file("/usr/include/x86_64-linux-gnu/")}".toString())
        cppFlags.add("-I${file("/usr/local/include/eigen3/")}".toString())

Those are the headers for your system, not for Android. They are not compatible.
Beyond that, you're trying to use C++11 features but using stlport. Stlport does not support C++11.


text:
Q: Is there any reason to do a solution using a dynamically created
A: I would use eval instead of creating script tags.
Script tags create overhead (they are DOM elements) but more importantly, you will need to use some sort of global variable to access the script in the script tags. If you use eval, you can simply do
var evalFunction = eval("(function(){...})"); // wrap function in () to make it an expression
var result = evalFunction(val);

A: IE8 and below do not allow scripts to be served in data: format. In that regard, eval() is more reliable.
That being said, if you are using AJAX to download a JS file from which you are getting that string, you could just set scriptObject.src = 'path/to/script.js'; The browser will have the file in cache and will therefore load it immediately.

A: eval is easy to write, but it is nearly as easy to add a script element to the head or body and append the js text to the new script element. Some edge cases, like variable hoisting, behave a little oddly when evaling a script.


text:
Q: Type 'System.Web.HttpInputStream' cannot be serialized I have been trying to design a WCF file upload service and am getting the following error
in my web application:

Type 'System.Web.HttpInputStream'
  cannot be serialized. Consider marking
  it with the DataContractAttribute
  attribute, and marking all of its
  members you want serialized with the
  DataMemberAttribute attribute.  See
  the Microsoft .NET Framework
  documentation for other supported
  types.

Based on this error, I have tried re-marking my FileTransfer
class with DataContractAttribute and DataMemberAttribute
but that didn't do anything:
[DataContractAttribute(Namespace = "FileTransfer")]
public class FileTransfer
{
    [DataMemberAttribute]
    public string GetUploadStatus;
    [DataMemberAttribute]
    public Tuple<string, int> DoUpload;
    [DataMemberAttribute]
    public int UploadFile;
    [DataMemberAttribute]
    public FileTransferInfo FileInfo;
    [DataMemberAttribute]
    public Stream FileByteStream;
}

I have tried accessing my Service Trace Log with Service Trace Viewer to
see if I could get some more detail on this error. I found a number of errors
with the following message:

The message with To
  'http://localhost:1242/WebProj/filetransfer.svc/mex/mex'
  cannot be processed at the receiver,
  due to an AddressFilter mismatch at
  the EndpointDispatcher.  Check that
  the sender and receiver's
  EndpointAddresses agree.

Which would have been useful to me but I also found the same error for:

'http://localhost:1242/WebProj/auth.svc/mex/mex'

in the same trace and I was able to authenticate just fine without any errors which made me wonder if this error is something that I should be worrying about (if any body has a suggestion as to why there is a mex/mex at my endpoint, that would be great).
So, why can't 'System.Web.HttpInputStream' be serialized? I have provided the other important aspects of my code below. Maybe somebody out there can see something that I have missed?
[DataContract(Namespace = "FileTransfer")]
public class FileTransferInfo
{
    private string _guid;
    private int _flag;
    private long _fileSize;
    private string _fileName;
    private DateTime _lastUpdate;
    private FileTypeEnum _fileType;

    //REMOVED GETTERS AND SETTERS FOR SPACE

 }

[ServiceContract(Namespace = "FileTransfer")]
public interface IFileTransferService
{
    [OperationContract(Name = "DoUpload")]
    Tuple<string, int> DoUpload(List<FileTransferInfo> request);

    [OperationContract(Action="UploadFile", Name="UploadFile")]
    int UploadFile(FileTransfer request);

}

Here is my UploadFile method that is returning the error.
int IFileTransferService.UploadFile(FileTransfer request)
{

    string uploadFolder = @"C:\TempMultiFileUploads\";
    int errCode = default(int);
    // parameters validation omitted for clarity
   try
   {
        string filename = request.FileInfo.FileName;
        string filePath = Path.Combine(uploadFolder, filename);

        using (FileStream outfile = new FileStream(filePath, FileMode.Create))
        {
            const int bufferSize = 65536; // 64K

            Byte[] buffer = new Byte[bufferSize];
            int bytesRead = request.FileByteStream.Read(buffer, 0, bufferSize);

            while (bytesRead > 0)
            {
                outfile.Write(buffer, 0, bytesRead);
                bytesRead = request.FileByteStream.Read(buffer, 0, bufferSize);
            }
        }
    }
    catch (IOException e)
    {
        //System.IOException
        errCode = 800;
    }

   return errCode;

}
    And, below is the endpoint, binding, and bahavior of my FileTransferService:

<endpoint name="MyFileTransferEP"
          address=""
          binding="basicHttpBinding"
          behaviorConfiguration="BasicHttpEPBehavior"
          bindingConfiguration="httpLargeDataStream"
          contract="FileTransfer.IFileTransferService" />

<binding name="httpLargeDataStream"
               closeTimeout="00:01:00"
               openTimeout="00:01:00"
               receiveTimeout="00:10:00"
               sendTimeout="00:01:00"
               maxBufferSize="65536"
               maxReceivedMessageSize="2147483647"
               messageEncoding="Mtom"
               transferMode="StreamedRequest">

<behavior name="BasicHttpEPBehavior">
    <dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>

Here is the code in my web application that calls the upload method:
FileTransferServiceClient upload = new FileTransferServiceClient();
HttpPostedFile m_objFile = default(HttpPostedFile);
FileTransfer transmit = new FileTransfer();

transmit.FileByteStream = m_objFile.InputStream;
transmit.FileInfo = new FileTransferInfo();
transmit.FileInfo.Guid = Guid.NewGuid().ToString();
transmit.FileInfo.Flag = default(int);
transmit.FileInfo.FileSize = m_objFile.ContentLength;
transmit.FileInfo.FileName = m_objFile.FileName;
transmit.FileInfo.LastUpdate = DateTime.Now;

int retParam = upload.UploadFile(transmit); // THROWS ERROR HERE

Thanks for your help.

A: You cannot define a data contract with a Stream member. You can either take or return a Stream as single parameter or define a message contract which has a single MessageBodyMember of type Stream, but can have multiple MessageHeaders. For more on large data streaming in WCF, please refer to this section of MSDN.


text:
Q: C# - json is not enumerable I am fetching json data that is apparently not enumerable. My json class looks like this:
public class Bids
{
    public int lastUpdateId { get; set; }
    public List<List<object>> bids { get; set; }
    public List<List<object>> asks { get; set; }
}

Fetching data:
var depth = w.DownloadString("https://api.binance.com/api/v1/depth?symbol=BTCUSDT&limit=20");
                   var book = JsonConvert.DeserializeObject<Bids>(depth);

And now I want to loop through 'book' and get the bids. How do I do that in a List>?
Edit;
With @TheGeneral's help I managed to get this out.
6537.76000000
0.34799400
[]

With this loop
foreach (var bid in book.bids){
     foreach (var item in bid)
          Console.WriteLine(item);

How do I get only the first value?

A: var book = JsonConvert.DeserializeObject<Bids>(depth);

foreach(var bid in book.Bids)
   foreach(var item in bid)
      // blah

foreach(var ask in book.Ask)
   foreach(var item in ask)
      // blah

Also, object should probably be double
public List<List<double>> bids { get; set; }
public List<List<double>> asks { get; set; }

How do I get only the first value?

Console.WriteLine(book.Ask.First().First());

Update
foreach(var ask in book.Ask)
   Console.WriteLine(ask.First())


text:
Q: How do I split an indice of an array into two different pices, I.E to validate that neither number is odd/even? I have to check, roomNumber[i], if BOTH numbers (assuming it's two-digit) are not even, and not odd. Only then can I accept the number. Also need to determine if the second digit is not less than double the first. I assume that I need to some how split these into two different ints (a,b), but I'm not sure.

A: If you assume that you have only two-digit numbers, you can go with it this way:
int[] roomNumbers = new int[] { 12, 34, 56, 67, 78 };
for (int num : roomNumbers) {
  int second = num % 10;
  int first = (num - second) / 10;

  System.out.println("first: " + first + " second: " + second);
}

You take the second number using the modulo (%) operator. To get the first number, you need to subtract the second number and divide it by 10.
Now you can process those numbers further.

A: Your questions have nothing to do with arrays. Let's reword them:

How do I test if a number is even?

You can google this and easily find the answer. Hint: use the modulus operator (%).

How do I test if the second digit is not less than double the first digit

Break this into smaller pieces: First you need to separate out the first and second digit. Again, you can google this if you don't know. (Hint: it's very similar to the first question. You can use the % operator and division (/).
Then you have to compare these according to the rule. Try to write something on your own and see what you can come up with.


text:
Q: How is the interior of a path determined when reverse clipping? I'm been playing around with [reverseclip] from How can I invert a 'clip' selection within TikZ?.  It works quite well.  When you apply [reverseclip] it seems to add another part to your path---a clockwise traversal of the current page.  However, I am having trouble understanding how the interior of a multi-part path is determined.  An example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
% A path that follows the edges of the current page, CW
\tikzstyle{reverseclip}=[insert path={(current page.north east) --
  (current page.south east) --
  (current page.south west) --
  (current page.north west) --
  (current page.north east)}
]
\coordinate (A) at (0,0);
\coordinate (B) at (1,0);
\coordinate (C) at (1,1);
\begin{pgfinterruptboundingbox}
   \path [clip] (A) -- (B) -- (C) [reverseclip]; % good, CCW
%  \path [clip] (C) -- (B) -- (A) [reverseclip]; % bad, CW
\end{pgfinterruptboundingbox}
\fill[red!30] (A) circle (3cm);
%\fill[red!30,even odd rule] (A) circle (3cm); % does not make bad good
\end{tikzpicture}
\end{document}

So what happens is that I only get the desired reverse clipping if the orientation of my path is counter-clockwise.  When I make the orientation clockwise, everything is undesirably filled.
In the documentation, Section 15.4.2 Graphic Parameters: Interior Rules, I learned about the nonzero and even odd rules.  I rationalized this behavior by imagining the circle drawn in a CW fashion. Then, the first clip path is CCW and everything should work. With the nonzero rule, it made sense why a CW clip path would not clip anything.  But then, I tried specifying the even odd rule, expecting that this would make the result independent of the orientation of the clip path.  My expectations were wrong.
It seems that the interior rules are not applying in the way I understood they would.

*

*When (reverse) clipping, how is the interior region determined?

*How can I reverse a path saved via \pgfsyssoftpath@getcurrentpath{\mypath}?

*Besides defining [reverseclipCW] and [reverseclipCCW], is there a way to make the reverseclip concept more robust to the orientation of paths?

*What is the orientation of basic shapes (circle, rectangle, etc)?  Clockwise?

A: 1- How to use nonzero rule and even odd rule with paths
The current rule (nonzero rule or even odd rule) is applied operation by operation and path by path.
In the following picture:

*

*on the left column, all circles (inner and outer) are CCW (CCW=counter clockwise),

*on the right column, outer circles are CCW and inner circles are CW (CW=clockwise),

*on the first line, two paths are used to draw each pair of circles,

*on the second line and on the third line, a single path is used to draw each pair of circles,

*on the first line and on the second lines, filling uses the nonzero rule (implicitly).

*on the third line, filling uses the even odd rule.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.style={align=flush left,font=\bfseries}]
  \node at (0,3){Outer circle=CCW\\Inner circle=CCW};
  \node at (4.5,3){Outer circle=CCW\\Inner circle=CW};
  \begin{scope}[yshift=0mm,
    every path/.style={draw=black,fill=cyan}]

    \path (0,0) ++(0:2cm) arc (0:360:2cm);
    \path (0,0) ++(0:1.8cm) arc (0:360:1.4cm);

    \path (4.5,0) ++(0:2cm) arc (0:360:2cm);
    \path (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \node[right] at (7,0) {Each circle=one path};
  \end{scope}
  \begin{scope}[yshift=-4.5cm,
    every path/.style={draw=black,fill=orange}]

    \path (0,0) ++(0:2cm) arc (0:360:2cm)
          (0,0) ++(0:1.8cm) arc (0:360:1.4cm);

    \path (4.5,0) ++(0:2cm) arc (0:360:2cm)
          (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \node[right] at (7,0)
    {Outer and inner circles=single path\\nonzero rule};
  \end{scope}
  \begin{scope}[yshift=-9cm,
    even odd rule,every path/.style={draw=black,fill=lime}]

    \path (0,0) ++(0:2cm) arc (0:360:2cm)
          (0,0) ++(0:1.8cm) arc (0:360:1.4cm);

    \path (4.5,0) ++(0:2cm) arc (0:360:2cm)
          (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \node[right] at (7,0)
    {Outer and inner circles=single path\\even odd rule};
  \end{scope}

\end{tikzpicture}
\end{document}

2- How to use nonzero rule and even odd rule with clipping paths
The even odd rule can't be applied directly to a clipping path (it's a bug).
In the following example, each line shows a filled rectangle. Each rectangle is clipped by four circles in a single path. The first line uses nonzero rule (implicitly), the second line uses a scope to apply even odd rule to the clipping path, and the third line uses the new option clip even odd rule suggested by Andrew Stacey:
\tikzset{clip even odd rule/.code={\pgfseteorule}} % Credit to Andrew Stacey

\documentclass{standalone}
\usepackage{tikz}
\tikzset{clip even odd rule/.code={\pgfseteorule}} % Credit to Andrew Stacey
\begin{document}
\begin{tikzpicture}[every node/.style={align=flush left,font=\bfseries}]
  \node at (2.25,3) {All circles in a single clipping path};
  \node at (0,2){Outer circle=CCW\\Inner circle=CCW};
  \node at (4.5,2){Outer circle=CCW\\Inner circle=CW};
  \begin{scope}[yshift=0mm]
    \node[right] at (7,0) {clipping path with nonzero rule};

    \clip
    (0,0) circle (2cm)
    (0,0) ++(0:1.8cm) arc (0:360:1.4cm)
    (4.5,0) circle (2cm)
    (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \draw[fill=red] (-2,-1) rectangle (7,1);
  \end{scope}

  \begin{scope}[yshift=-4.5cm,even odd rule]
    \node[right] at (7,0) {clipping path with even odd rule\\(via scope)};

    \clip
    (0,0) circle(2cm)
    (0,0) ++(0:1.8cm) arc (0:360:1.4cm)
    (4.5,0) circle(2cm)
    (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \draw[fill=orange] (-2,-1) rectangle (7,1);
  \end{scope}

  \begin{scope}[yshift=-9cm]
    \node[right] at (7,0)
    {clipping path with even odd rule\\(via new \texttt{clip even odd rule} option)};

    \clip[clip even odd rule]
    (0,0) circle(2cm)
    (0,0) ++(0:1.8cm) arc (0:360:1.4cm)
    (4.5,0) circle(2cm)
    (4.5,0) ++(0:1.8cm) arc (360:0:1.4cm);

    \draw[fill=lime] (-2,-1) rectangle (7,1);
  \end{scope}
\end{tikzpicture}
\end{document}

Note on CCW and CW:
In a path:

*

*A circle (or ellipse) operation is always CCW.

*A rectangle operation can be CCW or CW depending on corners provided:
(a) rectangle (b) is equivalent to (a) -| (b) |- (a).


text:
Q: My variable is not being filled, remains empty I have a problem with comparing dates. I pull one date from a database through an API. These dates are stored in an array because one column contains multiple dates and I have to cycle through them to find the next upcoming date. The dates are in the format: 'dd/mm/yy'
$rawDate = $e->calendarsummary;
$filter = preg_replace("/[a-z]/","", $rawDate);
$createArray = explode(',', $filter);
$dates = array_filter(array_map('trim', $createArray));
foreach($dates as $d)
{
     $dateTime = DateTime::createFromFormat('dmy', $d);
     if($dateTime >= $now)
     {
          $finalDate = $dateTime;
          $total = $finalDate->format('l j/m/y');
          break;
     }
}

If I place a var_export of $dateTime after $dateTime = DateTime::createFromFormat('dmy', $d); it returns 'false'. So I'm guessing $dateTime is empty although my array $dates is filled correctly.
a var_export of $dates returns:

array ( 0 => '15/06/13', 1 => '16/06/13', )

and a var export of $now returns todays date: '16/06/13'
So I'm a bit stuck why my variable $DateTime remains empty?
EDIT: Apparantly the return of 'false' means it's an error, so something went wrong when formatting my dates from the array?

A: $dateTime = DateTime::createFromFormat('d/m/y', $d);

not
$dateTime = DateTime::createFromFormat('dmy', $d);

A: Your dates are in format d/m/y, not dmy. Try the following instead:
$dateTime = DateTime::createFromFormat('d/m/y', $d);

When I do that, I get:
class DateTime#1 (3) { public $date => string(19) "2013-06-15 17:17:12" public $timezone_type => int(3) public $timezone => string(3) "UTC" }

... instead of bool(false).

A: If the $dates array contains elements such 15/06/13 so use just use wrong date format. E.g.:
$dateTime = DateTime::createFromFormat('d/m/y', $d);

A: you could use strtotime as a different method.
$now = date('d/m/y');

foreach($dates as $d)
{

if(strtotime($d) >= strtotime($now))
{

       $finalDate = $dateTime;
       $total = date('l j/m/y', strtotime($d));
       break;
    }

}


text:
Q: How to use sudo to delete the contents of a directory I have a legitimate need to empty a directory to which my account does not have access (it is a cache directory used by an application, and is owned by the account that runs the application.)  My account has full sudo privileges (I think), but I can't figure out how to delete the contents of the directory in question.  My account can't cd into the directory, only into the parent directory.
sudo rm directory/*

gives the response
cannot remove `directory/*': no such file or directory

This seems like a problem that should have a simple answer, but I can't find it.
Edit: The directory in question is definitely not empty:
sudo ls directory/

returns over 1000 filenames.

A: You're having problems because your shell is trying to expand * into the list of files, but it can't since you don't have rights to read the directory.
I can think of two things that would work
sudo bash -c "rm directory/*"

In this case, the * isn't expanded by you, but by root, who can read the directory
OR
sudo find directory -type f -exec rm {} \;

The above will only delete files, not directories (otherwise it would delete directory along with it's contents), but feels less error prone to me.
Edit: In the first option, I had accidentally written directory.* instead of directory/*

A: Any time you are going to sudo rm things, you should gravely consider what you are doing if you are not using explicit paths.
sudo rm /explicit/path/to/directory/* should work.  You will still get that error if there are not files in directory; you can suppress that with rm -f (not rm -fr unless you are absolutely certain of what you are doing).


text:
Q: How to set env variables which contain a command using EnvInject plugin of Jenkins I have installed the EnvInject plugin of Jenkins.
I add it in the properties content (In script content also doesn't work: echo's nothing)
I able to set environment variable e.g.:
TEST="hello world"

In shell:
echo ${TEST}
Output: Hello World

But when I try to put the output of a command in my variable it doesn't work:
HOSTNAME=`hostname`

In Shell
echo ${HOSTNAME}
Output: `hostname`

While when I set the environment variable in my shell (without the plugin it works):
In Shell
HOSTNAME=`hostname`
echo ${HOSTNAME}
Output: localhost

A: From job configuration you should use Inject environment variables to the build process / Evaluated Groovy script.
Depending on the configuration you could execute command and save it in map containing environment variables:
return [HOSTNAME: 'hostname'.execute().text]

or run Groovy equivalent:
return [HOSTNAME: java.net.InetAddress.getLocalHost().getHostName()]


text:
Q: How to get bundle from an intent if multiple intents are passed to the service I am passing intent to a service from two different locations in my application. One intent has a bundle from which I want to extract data.But I get NPE when I try run getIntent().getExtras() method.
EDIT:
In one class:
                        basket.putString("KEY1", id[i]);
                        basket.putString("KEY2", message[i]);
                        basket.putString("KEY3", timeFormat[i]);
                        passNotiData = new Intent(getActivity(),
                                CheckService.class);
                        passNotiData.putExtras(basket);
                        startService(passNotiData);

In another class,
Intent myIntent = new Intent(context, AlarmReceiver.class);
    PendingIntent pi = PendingIntent.getBroadcast(context, 0, myIntent, 0);
     context.startService(myIntent);

    mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
            SystemClock.elapsedRealtime() + 60000, PERIOD, pi);

And in service class,
Bundle gotBasket = intent.getExtras();
        oldId = gotBasket.getString("KEY1");
        oldTime = gotBasket.getString("KEY3");

A: //start service from activity or any place
Intent intent = new Intent(this, MyService.class);
            Bundle bundle = new Bundle();
            bundle.putString("TEST", "test got it.");
            intent.putExtras(bundle);
            startService(intent);

//In service class declare override method of service
@Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        // TODO Auto-generated method stub
        if (intent != null && intent.getExtras() != null) {
            String str = intent.getExtras().getString("TEST");
            Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG)
                    .show();
        }
        return START_NOT_STICKY;
    }


text:
Q: Find the max height of skewed subtree in BST Here are my attempts to do it... But it doesn't work, can anyone help me?
I do it postfix (hp, hl - height of right and left subtree), (ok_l, ok_p - variables to controle if until now it was a skewed), when it stops being skewed - I stop increasing the height;
void Spacer (node *d, int *height, int *ok) {
    if(d) {
        int hp = 0;
        int hl = 0;;
        int ok_p = 1;
        int ok_l = 1;;
        if(d->l_syn)   Spacer(d->l_syn, &hl, &ok_l);//postfix
        if(d->p_syn)  Spacer(d->p_syn, &hp, &ok_p);
        printf("%d %d/   ", d->w, *height);
        if((!d->l_syn||!d->p_syn)&&*ok==1)  (*height)++;
        if(d->l_syn&&d->p_syn)   {
            *height = max(hl,hp);
            *ok = 0;
        }
    }
}

int main()
{
    struct node *d = NULL;
    int maximum = 0; //maksymalny rozmiar dotychczasowego poddrzewa cienkiego
    int height = 0;
    int czy_lewy = 0;
    int ok = 1;

    //////// TESTY//////////////
    d = insert (d, 9);
    insert (d, 6);
    insert (d, 8);
    insert (d, 5);
    insert (d, 4);
    insert (d,3);
    //insert (d,6);
    /////////////////////////////

    Spacer(d, &height, &ok);

    printf("%d ",height);

    return 0;
}

A: The logic is not right. height can never get more than 1, as (*height)++; will always be executed on a height that is zero, and by induction that means that max(hl,hp) can also never be more than 1.
The algorithm could be like this:
void Spacer (node *d, int *height, int *ok) {
    *ok = 1; // default (empty tree is skewed)
    *height = -1; // default (empty tree has height -1)
    if (d) {
        // No need to initialise -- they are output parameters
        int hp, hl, ok_p, ok_l;

        // We can recurse also with a NULL child
        Spacer(d->l_syn, &hl, &ok_l);
        Spacer(d->p_syn, &hp, &ok_p);

        // Current node is root of a skewed tree if, and only when:
        // * It does not have two non-null children, AND
        // * Its children represent skewed subtree(s)
        *ok = (!d->l_syn || !d->p_syn) && min(ok_l, ok_p);
        // If OK, we can extend with 1
        *height = max(hl, hp) + *ok;

        printf("%d %d/   ", d->w, *height);
    }
}


text:
Q: Symfony2 and composer issue: "Could not parse version constraint composer.phar..." So I'm having issues trying to get composer to work again after installing the Sonata Admin Bundle on Symfony2.  When using the command php composer.phar ...., I get the following error message: [UnexpectedValueException] Could not parse version constraint composer.phar: Invalid version string "composer.phar"
It doesn't matter what action I do with composer, it always produces that error.  Well, one exception is php composer.phar require --no-update sonata-project/media-bundle says it updated composer.json with no error message, but didn't actually install anything.
So far I have just removed and reinstalled composer.phar with an updated version.  I'm running Symfony 2.2.1-dev on Mac OS 10.7.5 with MAMP and PHP 5.4.4.  Not sure if this is related, but I also cannot clear the cache using php app/console cache:clear anymore either.  I have to delete the cache via Finder.
Here's my composer.json file just in case:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": "composer.phar",
    "symfony/symfony": "2.2.*",
    "doctrine/orm": "2.3.*",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.2.*",
    "symfony/monolog-bundle": "2.2.*",
    "sensio/distribution-bundle": "2.2.*",
    "sensio/framework-extra-bundle": "2.2.*",
    "sensio/generator-bundle": "2.2.*",
    "jms/security-extra-bundle": "1.4.*",
    "jms/di-extra-bundle": "1.3.*",
    "sonata-project/cache-bundle": "dev-master",
    "sonata-project/block-bundle": "dev-master",
    "sonata-project/jquery-bundle": "1.8.*",
    "knplabs/knp-menu-bundle": "1.1.*-dev",
    "sonata-project/exporter": "1.1.*",
    "sonata-project/admin-bundle": "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "doctrine/common": "2.3.x-dev",
    "sonata-project/media-bundle": "dev-master"
},
"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"config": {
    "bin-dir": "bin"
},
"minimum-stability": "dev",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "branch-alias": {
        "dev-master": "2.2-dev"
    }
}

Any help/advice would be great :)

A: Looks like you have some typos in your composer file.
Replace "php": "composer.phar" with "php": ">=5.3.3" and add the missing closing bracket at the end of your file :
{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.2.*",
        "doctrine/orm": "2.3.*",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.2.*",
        "symfony/monolog-bundle": "2.2.*",
        "sensio/distribution-bundle": "2.2.*",
        "sensio/framework-extra-bundle": "2.2.*",
        "sensio/generator-bundle": "2.2.*",
        "jms/security-extra-bundle": "1.4.*",
        "jms/di-extra-bundle": "1.3.*",
        "sonata-project/cache-bundle": "dev-master",
        "sonata-project/block-bundle": "dev-master",
        "sonata-project/jquery-bundle": "1.8.*",
        "knplabs/knp-menu-bundle": "1.1.*-dev",
        "sonata-project/exporter": "1.1.*",
        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "doctrine/common": "2.3.x-dev",
        "sonata-project/media-bundle": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.2-dev"
        }
    }
}


text:
Q: Content Management Systems that comply with WCAG 2.0 I like the look of SIteInifinity by Telerik as a content management system. Unfortunately it is not WCAG 2.0 compliant.
Are there any third party CMS systems that are WCAG 2.0 complaint?

A: There are two sides to your question: the main website as seen by users should be compliant with WCAG 2.0 and the backoffice as used by content producers and administrators should be compliant with ATAG (Authoring Tool Accessibility Guidelines)
A few points:

*

*A lot of CMS which allow template customization can manage a website that conforms to WCAG 2.0 Level A or AA and many aspects or AAA. I work mainly with LAMP CMS so I don't know at all this other world ruled by ASP.NET ;) (a big STOP is adding a form element as a direct child of the body element, for no reason. Good luck with the rest of your code)

*No CMS with untrained content producers can keep this level of accessibility for long

*Few CMS are accessible to their content producers (the Authoring Tool part), and ARIA will help a lot (in a few years)

A: I think DotNetNuke has that and this was added for 4.6.
Please check from this discussion forum
DotNetNukeCommunity

A: The open source CMS TYPO3 can be WCAG 2.0 compliant as long as proper care is taken with the setup and templating.
Here is a PDF that describes the process in TYPO3.
You can find out more about TYPO3 at http://typo3.org

A: Felipe Alsacreations nailed the essence of the problem with this question in his response.
With Drupal 7, things have changed though. At least in terms of the relative accessibility of various CMS's.  Although no CMS meets WCAG 2.0 AA out of the box, Drupal 7 comes the closest at this point.
You don't get much of a sense of it from comparing accessibility statements, but:
http://drupal.org/about/accessibility
As a contributor to Drupal 7's accessibility initiative I know how much accessibility gets inherited because of decisions that were made in Core.  The enhancements to the Core Forms API gives almost any module that extends it a solid basis for meeting accessibility (both for the user side & admin side).
That being said, this is a complex issue.  Keeping up with changes in technology means that it's an up hill battle to keep a site WCAG 2.0 compliant.

A: Drupal is an excellent CMS but I have found not for beginners. I would like to see a discussion around Fully Managed Solution (CMS WEB BUILDERS) like Exai (www.exai.com) that are extremely user friendly and go with the WYSIWYG editor.


text:
Q: Geofencing Extension API - Uploading a New Layer I'm trying to use Postman for upload a WKT layer by the cURL code below.
curl -X POST
  'https://gfe.cit.api.here.com/2/layers/upload.json?layer_id=123&app_id={APP_ID}&app_code={APP_CODE}'
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
  -F 'zipfile=@C:\xampp\htdocs\here\southern.wkt.zip'`

but the response message is
{"issues":[{"message":"Multipart should contain exactly one part"}],"error_id":"2e1e3994-69d6-43bb-8224-2a869b5255ae","response_code":"400 Bad Request"}

Am I doing something wrong?

A: Make sure your WKT file doesn't contain additional indentation(spaces) avoid giving spaces and instead use equal tabs and give proper column names
refer this


text:
Q: Database Design for Order management for multiple sources I would like to know what's the best method for building an order management database where there are multiple shops, each with their own list of products and prices.
My Current Design
Product
------
name
image
price_per_item

Shop
------
name
product_list - Manytomany field

Order
------
order_id    primary key
shop

Order Content
------
order_id    foreign key to Order
product
quantity

The problem I foresee with this is that each shop may have the same item but may sell that item at a different price_per_item.
How exactly do I build a db where Shops can manage to have different price per items and yet have multiple items to sell?

A: You're too worried about the relationships, and not worried enough about the tables.
First, let's build a Shop table.
Shop
----
Shop ID
Shop Number
Shop Name
Shop Address
...

Generally, tables have a singular name and an auto-incrementing integer as the primary key.  This is also called a blind key.  That's why I have a Shop ID and a Shop Number.  The Shop ID is the primary key and the Shop Number is data.  The Shop Number can be changed without changing any of the relationships we're going to build.
Now, let's build a Product table.
Product
-------
Product ID
Product Name
Product Manufacturer ID
...

The Product ID is the primary key.  The Product Manufacturer ID is a foreign key to a Product Manufacturer table.  I'll leave the creation of the Product Manufacturer table as an exercise for you.
Now, a shop can have many products, and a product can be carried in many shops.  This is a many-to-many relationship.  We model this relationship with a junction table.
ShopProduct
-----------
Shop ID
Product ID
Product Cost
Product Price
Product Count
...

The primary key is (Shop ID, Product ID).  You also have a unique index on (Product ID, Shop ID).  The Product Price and Product Count values belong to the many-to-many relationship, not the Shop or the Product.
You can get a list of the products for a shop through the primary key.  You can also get a list of the shops for a product, and the total inventory as well as average price through the unique index.
Now, we can talk about orders.  You have the problem that an order can only go to one manufacturer.  You also want to combine orders from the stores so you can order the correct quantities for all your stores.
Let's build the Order table.
Order
-----
Order ID
Product Manufacturer ID
Order Time Stamp
Order Delivery Date
...

The Order ID is the primary key.  The Product Manufacturer ID is a foreign key.
Next, let's build the OrderItem table.  This is a standard name for the items in a order.
OrderItem
---------
OrderItem ID
Order ID
Store ID
Product ID
...

The OrderItem ID is the primary key.  The Order ID is a foreign key.  The Store ID is a foreign key.  The Product ID is a foreign key.
You get the manufacturer information from the Product Manufacturer ID in the Order table, using the Order ID.
You get the order information from the Order ID
You get the store information from the Store ID.  This information is not necessary for the order.  It is necessary to know where to deliver the products after the manufacturer ships the products.
You get the product information from the Product ID.
I hope this is enough of an explanation to get you started.  First, you model the objects, like Store and Product.  Then, you model the relationships between the objects, like ShopProduct.


text:
Q: Raw characters coming in URL I have a strange problem in codeigniter. All my URLs showing random characters in URL after the page loads up.
For example www.example.com/home#.UhGoaX_8vFk. Characters including # sign (#.UhGoaX_8vFk) automatically comes when any link is clicked.
If anybody has any idea, please share to save my life.
Thanks


text:
Q: T-Test for Research Project (High School Student)? I am completing a research project on how Heart Rate is affected by wearing two different types of shoes during 4 minute trials at VO2 Max (Reaching close to Max HR). One shoe is the Nike Vaporfly Next% (Improves running economy, but gap is whether it also reduces heart rate at the same pace), and the other is their daily training shoe (Shoe they run in every day). I have formed an equation (Representation of BPM/time is a logistic regression because that is what it best emulates):
to determine the total beats over the 4 minute trials. I also calculated percent change or reduction in beats over the trials with the 100*((new-old)/(old)) formula as well. While the change was quite minimal, I am not sure what the threshold would be in order to determine whether or not the data shows enough of a correlation to find any statistical difference. While I am assuming no, I'd like to use the t-test and also delve into confidence intervals. I'm only in high school and don't have experience with either of those two ideas, but based on some research I think that would help strengthen the understanding of my results and ultimately my paper as a whole. I've attached the data from my experiment so far and also some information about the participants. I plan to have 10 participants by the time the experiment is over. Each participant completes 4 trials in each shoe while their heart rate is monitored with an ECG.
HR Result Data so far along with line of best fit on sheet 3 for entirety of particpants: https://docs.google.com/spreadsheets/d/1kg0mwvu058oSpQd3C9KkuP1gIqR7xdSmj77tCV1Z3_8/edit?usp=sharing
Basic information on participants: https://docs.google.com/spreadsheets/d/1mEy1OXyGCzg001tIvCfURXFJhRR4sTbq4UG-o-izliU/edit?usp=sharing


text: Q: Examples of a more general proof being easier to find than the proof itself? Studying an open problem, it has become apparent that generalising and proving a more extensive theorem likely makes the problem simpler.  Are there any well-known theorems where the author's objective is thought to be to prove an open problem and in order to do so, they proved a more general new theorem?  Particularly, where the more specific problem was apparently convoluted, and the more general one not so much.


text:
Q: django deployment with apache and mod_wsgi In order to deploy my django project, i've downloaded httpd and mod_wsgi. To configure this module, I've also downloaded apxs and gcc and I've followed this tutorial :
https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html
And then I've found in the django documentation :
https://docs.djangoproject.com/fr/2.0/howto/deployment/wsgi/modwsgi/
a way to deploy my project.
So I actually have this wigs.py :
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProjetIML.settings")
application = get_wsgi_application()

And this httpd.conf :
WSGIScriptAlias / /home/ninon/ProjetIML/ProjetIML/wsgi.py
WSGIPythonPath /home/ninon/ProjetIML

<Directory /home/ninon/ProjetIML/ProjetIML>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Then I've restart the apache server with "apachectl restart" and when I try to access my site with localhost:80 nothing append. Did I miss something ?
I've seen many posts explaining that they have coded files like "django.wsgi" but I haven't found anything about it in the django documentation.
I've also tried to add a Virtual host like this :
<VirtualHost *:80>
    WSGIScriptAlias / /home/ninon/ProjetIML/ProjetIML/wsgi.py
    WSGIPythonPath /home/ninon/ProjetIML

    <Directory /home/ninon/ProjetIML/ProjetIML>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

But the apache server didn't want to restart.


text:
Q: understand the mysql subquery to write long tail query I have checked several thread of stackoverflow.com about subquery. I also have check in MySQL documentation to understand the subquery. I would like to write long tail query in MySQL. I know there are huge experts who can help me to understand the following operators with an example for each operator and bind them within a long tail query.
=,  >,  <,  >=,  <=,  <>,  !=, ANY, SOME, EXISTS, NOT EXISTS, IN, NOT IN, XOR, OR etc. I have checked the operators meaning at http://dev.mysql.com/doc/refman/5.0/en/non-typed-operators.html
Mainly, I would like to learn the procedure to write a long tail query using above operators with an example.
I want to know the sequence of the syntax, [e.g- In a select query I have to write as follows-
1. select
2. all
3. from
4. tablename
5. where etc.

At the above sequence, I can't write where clause before table name. Isn't it? If you think this question is not written properly, then mention each point in comment, I'll improve immediately.

A: For the Select Statement, the syntax is
    SELECT * FROM table_name
    WHERE condition

(*) means ALL , in place of it you can write column name if u want to retrieve a particular column
For the conditions i will give examples for some
    =, >, <, >=, <=, <>, !=, ANY, SOME, EXISTS, NOT EXISTS, IN, NOT IN, XOR, OR

    SELECT * FROM MyTable
    WHERE Name = 'Tijesunimi'

Retrives all details of the name (Tijesunimi)
    SELECT CustomerID, DateofBirth
    FROM MyTable
    WHERE DateofBirth > '19530212' and CustomerID > '20'

Retrieves the CustomerID and Date of Birth where date of birth higher than 1953-Feb-12th and CustomerID is more than 20 (The same goes for >=,<=,<>)
    SELECT Id FROM MyTable
    WHERE 100 > ANY (SELECT Id, Amount FROM MyTable
                     WHERE Name = 'Tijesunimi')

Retrives id for customer where 100 greater than any value returned in the subquery
    SELECT * FROM MyTable
    WHERE EXISTS (SELECT Name FROM MyTable
                  WHERE Name = 'Tijesunimi)

Retrives all details for details of customer Tijesunimi
    SELECT * FROM MyTable
    WHERE NOT EXISTS (SELECT Name FROM MyTable
                  WHERE Name = 'Tijesunimi)

Retrives details for other customers apart from 'Tijesunimi'
I have explained the ones i know well...
I hope it helps you


text:
Q: Return results where a shared value is shared between two tables and the timestamp is different I have two tables 1 and 2, and I want to return all results where the following are true:

*

*The Values in Column A match in both tables

*The Timestamp in column B is Greater in table 1 than table 2 for entries that match.
I'm running into a problem where my subquery is returning more than 1 value and I'm a bit of a loss on how to structure the second portion of my query. Can anyone provide some guidance?

A: SELECT *
FROM Table1 AS a INNER JOIN Table2 AS b
ON a.ValueA = b.ValueA
WHERE a.ValueB > b.ValueB

Not sure what the exact issue you are having is, but I don't see why this wouldn't work.


text:
Q: Sample space of random sum; Wald's equation I'm reading proof of Wald's equation in Durrett's Probability theory and examples 5th ed, but for me, it's indeed strange the statement itself.
Wald's equation is following:

Let $X_1 , X_2, ...$ be i.i.d. with $E\lvert X_i \rvert < \infty$.
Let N be stopping time with $EN<\infty$, then $ES_N = EX_1EN$

But I have following question: "What is $S_N$?"
Reason that I have confusing is if I write all argument, then it would be $S_{N(\omega)} (\tau)$
Then what will be sample space and probability function?
I think $S_N$ is function from $\Omega \times\Omega$ to $\mathbb{R}$. Hence it will equip probability function $P\times P$, in the sense of product measure.
With this point, meaning of expectation in $S_N$ should be differ to that of $S_n$.
Because $E[S_N] = \int_{\Omega \times \Omega} S_N d(P\times P)$, but $E[S_n] = \int_{\Omega} S_n dP$.
So I think compare expectation of $S_N$ and $S_n$ looks strange for me in Wald's equation.
But proof starts with equation $ES_N = \int S_N dP = \sum_{n=1}^{\infty} \int S_n 1_{\{N=n\}} dP$.
How can I solve this problem?
edit:
I understand second equality in the sense of $S_{N(\omega)}(\tau) = \sum_{n=1}^{\infty} S_n(\tau) 1_{\{\omega: N(\omega) = n\}}(\omega)$, but how first comes? I think first equality should be $ES_N = \int S_N d(P\times P)$


text:
Q: operator>> error: no matching function for call to I'm working with a class Allotjament, that has 5 attributes, 4 of them are from a class called Cadena, which I have finished too, here's is Allotjament.cpp:
#include <iostream>
#include <cstring>
#include "Allotjament.h"

    Allotjament::Allotjament() {
        _nom='\0';
        _pais='\0';
        _localitat='\0';
        _categoria='\0';
        _preu=0;
    }
    Allotjament::Allotjament(Cadena nom, Cadena pais, Cadena localitat, Cadena categoria, float preu) {
        _nom=nom;
        _pais=pais;
        _localitat=localitat;
        _categoria=categoria;
        _preu=preu;
    }

    Cadena Allotjament::getNom() const { return _nom; }
    Cadena Allotjament::getPais() const { return _pais; }
    Cadena Allotjament::getLocalitat() const { return _localitat; }
    Cadena Allotjament::getCategoria() const { return _categoria; }
    float Allotjament::getPreu() const { return _preu; }

    ostream& operator<<(ostream &o, Allotjament a) {
        o << "Nom:" << a._nom << endl;
        o << "Pais:" << a._pais << endl;
        o << "Localitat:" << a._localitat << endl;
        o << "Categoria:" << a._categoria << endl;
        o << "Preu:" << a._preu << endl;
        return o;
    }

    istream& operator>>(istream &i, Allotjament &a){
        getline(i,a._nom);
        getline(i,a._pais);
        getline(i,a._localitat);
        getline(i,a._categoria);
        i >> a._preu;
        cin.ignore();

        return i;
    }

Allotjament.h
#include <iostream>
#ifndef ALLOTJAMENT_H
#define ALLOTJAMENT_H
#include "Cadena.h"

class Allotjament{
    public:
        Allotjament();                    // Constructor de la classe
        Allotjament(Cadena nom, Cadena pais, Cadena localitat, Cadena categoria, float preu);   // Constructor amb parametres
        Cadena getNom() const;            // Retorna el nom de l'Allotjament
        Cadena getPais() const;           // Retorna el pais de l'Allotjament
        Cadena getLocalitat() const;      // Retorna la localitat de l'Allotjament
        Cadena getCategoria() const;      // Retorna la categoria de l'Allotjament
        float getPreu() const;            // Retorna el preu de l'Allotjament

        friend ostream& operator<<(ostream&, Allotjament);
        friend istream& operator>>(istream&, Allotjament&);

    private:
        Cadena _nom;
        Cadena _pais;
        Cadena _localitat;
        Cadena _categoria;
        float _preu;
};

And here I have the operator>> for the class Cadena:
istream& operator>>(istream& i, Cadena& s) {
  delete [] s.c;
  const int l = 256;
  char *t = new char[l];
  i.getline(t,l);
  s.c = t;
  return i;
}

My problem is the following: The compiler g++ tells me I do 4 errors, one in each line of the getline in the operator>> in the class Allotjament. Here's the error:
error: no matching function for call to 'getline(std::istream&, Cadena&)
I have tested the class Cadena and its operators and they work as intended, but don't understand why I'm getting this error. Any ideas?

A: You have already defined an operator >> for Cadena class, so just use it:
  istream& operator>>(istream &i, Allotjament &a){
        i >> a._nom;
        i >> a._pais;
        i >> a._localitat;
        i >> a._categoria;
        i >> a._preu;
        cin.ignore();

        return i;
    }

A: You must pass a std::string to std::getline not a Allotjament.

A: You haven't included <string>.
std::getline is defined in there.
UPDATE:
And, as others have pointed out: std::getline() requires that the second parameter be a string.
SEE HERE:
http://en.cppreference.com/w/cpp/string/basic_string/getline


text:
Q: Drawer with Silver Coin problem's solution clarification I am trying to understand a problem solution but I can't get an answer for my confusion. Also, this question is asked before in another post  . Below is the problem and solution description:
Each of 2 cabinets identical in appearance has 2 drawers. Cabinet A contains a silver coin in each drawer, and cabinet B contains a silver coin in one of its drawers and a gold coin in the other. A cabinet is randomly selected, one of its drawers is opened, and a silver coin is found. What is the probability that there is a silver coin in the other drawer?
The reference solution:
A = the cabinet A is chosen
B = the cabinet B is chosen
S = a silver coin is chosen
$P(A|S) = \frac{P(S|A)P(A)}{(P(S|A)P(A)+P(S|B)P(B)}$
$P(A|S) = \frac{1\times0.5}{1\times0.5 + 0.5\times0.5}$
$P(A|S) = \frac{2}{3}$
My confusion:
As the question stated a cabinet is randomly selected, why the verified solution calculate  the cabinet A is chosen $P(A|S)$ instead of the cabinet B is chosen $P(B|S)$? I am stucked at this point. Is that any reasoning behind?

A: The question asked: what is the probability that there is a silver coin in the other drawer?
The other drawer will have a silver coin if and only if cabinet A was selected.
That is why the solution computed $p(A|S).$