问:
How to subtract cell values from one column with cell values from another column in xlsx files using python
I want to subtract the cell values from one column with cell values from another column and write the sum to a new column in an excel file. Then I want the sum, if not equal to 0, to be added to a list for later use. The data in my excel file are structured like this:

```<code>Name | Number | Name1 | Number1
Name2 | Number2 | Name3 | Number3
....
Namex | Numberx | Namey |Numbery
</code>```

I want to subtract the numbers from each other and then add the sum to a new column like this:

```<code>Name| Number | Name1 | Number1 | Sum of (Number - Number1)
</code>```

I have tried to use openpyxl to do this, but I am really confused because the docs are so different from earlier versions of Python to newer. I am working in Python 3.4. I am happy to get suggestions on which module you would recommend me using.
The code I have so far is giving me errors because I am calling the excelfile as a generator, not a subscriptable. I am not sure how to search and read an excelfile and at the same time make it subscriptable so that it is possible to write to it. Could anyone please help me?

Here is my code:

```<code>from openpyxl import Workbook, load_workbook

def analyzexlsx(filepath):
    numbers = []
    excel_input = load_workbook(filepath)
    filepath = [pth for pth in Path.cwd().iterdir()
                  if pth.suffix == '.xlsx'] #Want to iterate through several excel files in a folder.
    ws = excel_input.active
    cols = tuple(ws.columns)
    col_b = cols[1]
    col_e = cols[4]
    for j, k in zip(col_e, col_b):
        if None:
            print('None')
        equally = (int(j.value) - int(k.value)) #line 13, error. Trying to subtract column cell values.
        if equally != 0: #If the columns sum is not equal to 0, it is to be added to the numbers list.
            numbers.append(j.row)

        else:
            pass

    col1 = []
    col2 = []
    col4 = []
    col5 = []
    col7 = []
    col8 = []

    mainlist = []
    try:
        for row in numbers:
            col1.append(str(ws.cell(row=row, column=1).value))
            col2.append(str(ws.cell(row=row, column=2).value))
            col4.append(ws.cell(row=row, column=4).value)
            col5.append(ws.cell(row=row, column=5).value)
            col7.append(ws.cell(row=row, column=7).value)
            col8.append(ws.cell(row=row, column=8).value)
    finally:
        for i, j, k, l, m, n in zip(col1, col2, col4, col5, col7, col8):
            mainlist.append(i + ", " + j + ", " + k + ", " + l + ", " + m + ", " + n)
    return mainlist

Traceback (most recent call last):
    Line 13, in analyzexlsx
        equally = (int(j.value) - int(k.value))
    TypeError: int() argument must be a string or a number, not 'NoneType
</code>```

I would be really happy for answers as I have worked on this for quite a while and now I am stuck. I am fairly new to Python.

答:
First create DataFrame from excel by read_excel.

Then need substract 2. with 4 columns:

```<code>df = pd.read_excel('file.xlsx')

#select by column name
df['E'] = df['B'] - df['D']
</code>```

```<code>#select by positions, but python count from 0 so for 2. column need 1
df['E'] = df.iloc[:, 1] - df.iloc[:, 3]
</code>```

Maybe also help check documentation.

Body:
I want to subtract the cell values from one column with cell values from another column and write the sum to a new column in an excel file. Then I want the sum, if not equal to 0, to be added to a list for later use. The data in my excel file are structured like this:

Name | Number | Name1 | Number1
Name2 | Number2 | Name3 | Number3
....
Namex | Numberx | Namey |Numbery

I want to subtract the numbers from each other and then add the sum to a new column like this:

Name| Number | Name1 | Number1 | Sum of (Number - Number1)

I have tried to use openpyxl to do this, but I am really confused because the docs are so different from earlier versions of Python to newer. I am working in Python 3.4. I am happy to get suggestions on which module you would recommend me using.
The code I have so far is giving me errors because I am calling the excelfile as a generator, not a subscriptable. I am not sure how to search and read an excelfile and at the same time make it subscriptable so that it is possible to write to it. Could anyone please help me?

Here is my code:

from openpyxl import Workbook, load_workbook

def analyzexlsx(filepath):
    numbers = []
    excel_input = load_workbook(filepath)
    filepath = [pth for pth in Path.cwd().iterdir()
                  if pth.suffix == '.xlsx'] #Want to iterate through several excel files in a folder.
    ws = excel_input.active
    cols = tuple(ws.columns)
    col_b = cols[1]
    col_e = cols[4]
    for j, k in zip(col_e, col_b):
        if None:
            print('None')
        equally = (int(j.value) - int(k.value)) #line 13, error. Trying to subtract column cell values.
        if equally != 0: #If the columns sum is not equal to 0, it is to be added to the numbers list.
            numbers.append(j.row)

        else:
            pass

    col1 = []
    col2 = []
    col4 = []
    col5 = []
    col7 = []
    col8 = []

    mainlist = []
    try:
        for row in numbers:
            col1.append(str(ws.cell(row=row, column=1).value))
            col2.append(str(ws.cell(row=row, column=2).value))
            col4.append(ws.cell(row=row, column=4).value)
            col5.append(ws.cell(row=row, column=5).value)
            col7.append(ws.cell(row=row, column=7).value)
            col8.append(ws.cell(row=row, column=8).value)
    finally:
        for i, j, k, l, m, n in zip(col1, col2, col4, col5, col7, col8):
            mainlist.append(i + ", " + j + ", " + k + ", " + l + ", " + m + ", " + n)
    return mainlist

Traceback (most recent call last):
    Line 13, in analyzexlsx
        equally = (int(j.value) - int(k.value))
    TypeError: int() argument must be a string or a number, not 'NoneType

I would be really happy for answers as I have worked on this for quite a while and now I am stuck. I am fairly new to Python.

Body:
First create DataFrame from excel by read_excel.

Then need substract 2. with 4 columns:

df = pd.read_excel('file.xlsx')

#select by column name
df['E'] = df['B'] - df['D']

#select by positions, but python count from 0 so for 2. column need 1
df['E'] = df.iloc[:, 1] - df.iloc[:, 3]

Maybe also help check documentation.


来源: stackexchange

问:
ASP.Net MVC, Dynamic Property and EditorFor/LabelFor
I am using MVC 3 w/ Razor and using the new dynamic ViewBag property. I would like to use the ViewBag property with the EditorFor/LabelFor Html helpers but can't figure out the syntax.

The View does have a @model set, but the object I am trying to use is not part of that model. I am aware I can create a ViewModel but that is not what I am after.

Can anyone help?

Controller:

```<code>   var myModel= _repo.GetModel(id);
   var newComment = new Comment();

   ViewBag.NewComment = newComment;

   return View(myModel);
</code>```

View:

```<code>@model Models.MyModel

@(Html.EditorFor(ViewBag.NewComment.Comment))
</code>```

答:
Not knowing what your Comment Model looks like, my gut reaction would be to just do:

```<code>@Html.EditorFor(ViewBag.NewComment)
</code>```

However, because ViewBag is dynamic, you may need to cast NewComment before you use it, in order to get the EditorFor magic.

```<code>@Html.EditorFor(ViewBag.NewComment as Comment)
</code>```

Update

Strike that, EditorFor can only accept an Expression as a parameter, and that Expression must return a property of the page model. I don't think EditorFor or EditorForModel are going to be of any use to you if you don't want to use a ViewModel. Have you considered switching the roles of whatever it is you're using the Model for, with that of the ViewBag?

ContentLicense: CC BY-SA 2.5

Body:
I am using MVC 3 w/ Razor and using the new dynamic ViewBag property. I would like to use the ViewBag property with the EditorFor/LabelFor Html helpers but can't figure out the syntax.

The View does have a @model set, but the object I am trying to use is not part of that model. I am aware I can create a ViewModel but that is not what I am after.

Can anyone help?

Controller:

   var myModel= _repo.GetModel(id);
   var newComment = new Comment();

   ViewBag.NewComment = newComment;

   return View(myModel);

View:

@model Models.MyModel

@(Html.EditorFor(ViewBag.NewComment.Comment))

Body:
Not knowing what your Comment Model looks like, my gut reaction would be to just do:

@Html.EditorFor(ViewBag.NewComment)

However, because ViewBag is dynamic, you may need to cast NewComment before you use it, in order to get the EditorFor magic.

@Html.EditorFor(ViewBag.NewComment as Comment)

Update

Strike that, EditorFor can only accept an Expression as a parameter, and that Expression must return a property of the page model. I don't think EditorFor or EditorForModel are going to be of any use to you if you don't want to use a ViewModel. Have you considered switching the roles of whatever it is you're using the Model for, with that of the ViewBag?


问:
Braintree for rails
I want to show the price of a plan I created in Braintree. I'm trying to retrieve the details via the the Braintree api by using this: Braintree::Plan.price

```<code><%= form_tag transactions_path do%>
  <div id="dropin"></div>
  <%=submit_tag "Pay #{Braintree::Plan.price}$", class: "button mt1" %>
</code>```

But I'm getting this error:
undefined method price' for Braintree::Plan:Class

Does someone know how to implement this?

答:
I got it... just had to put params["price"] into the submit tag!!

<%=submit_tag "Pay #{params["price"]}$", class: "button mt1" %>

ContentLicense: CC BY-SA 3.0

Title: Braintree for rails

Body:
I want to show the price of a plan I created in Braintree. I'm trying to retrieve the details via the the Braintree api by using this: Braintree::Plan.price

<%= form_tag transactions_path do%>

  <%=submit_tag "Pay #{Braintree::Plan.price}$", class: "button mt1" %>

But I'm getting this error:
undefined method price' for Braintree::Plan:Class

Does someone know how to implement this?


问:
Php - check if string is not empty or has a first character not equal to
How can I check in php if the string is empty or has a first character not equal to something.
If I do this to an empty string $key = '':

```<code>if ($key != '' || $key[0] != '_')
</code>```

I get:

Uninitialized string offset: 0

答:
Try like this</p>

```<code>if(trim($key)==''||substr( $key, 0, 1)=='_'){
   echo ' string is  empty or start with _';
}else{
    echo 'false';
}
</code>```

Body:
How can I check in php if the string is empty or has a first character not equal to something.
If I do this to an empty string $key = '':

if ($key != '' || $key[0] != '_')

I get:

Uninitialized string offset: 0

Body:
Try like this

if(trim($key)==''||substr( $key, 0, 1)=='_'){
   echo ' string is  empty or start with _';
}else{
    echo 'false';
}


问:
Trigger needs to fire only when column value is today's date
I want to apply the trigger in database when column_value match the particular scenario like

In goal table there are fields like goal, status, start_Date, end_Date

Now I want to change the status of goal. When user enter his/her goal, he/she filled end_Date. Now I want to change the status of goal when end_Date matched to current Date

Example:-

```<code>+------+--------+--------------+-------------+
| GOAL | STATUS | START_DATE   | END_DATE    |
+------+--------+--------------+-------------+
|    1 | Active | 2017-07-03   | 2017-07-09  |
+------+--------+------------+---------------+
</code>```

When END_DATE equals to current Date, then I want to change status 'Active' to 'Finished'

I hope I am able to understand my question.

Thanks in advance!

答:
Body of an oracle table level trigger would look like this...</p>

```<code>BEGIN
  IF INSERTING and (:new.end_date = sysdate) THEN
    :NEW.goal_status := desired_value;
  ELSIF UPDATING AND (:new.end_date = sysdate) then
    :NEW.goal_status := desired_value;
  END IF;
End;
</code>```

Body:
I want to apply the trigger in database when column_value match the particular scenario like

In goal table there are fields like goal, status, start_Date, end_Date

Now I want to change the status of goal. When user enter his/her goal, he/she filled end_Date. Now I want to change the status of goal when end_Date matched to current Date

Example:-

+------+--------+--------------+-------------+
| GOAL | STATUS | START_DATE   | END_DATE    |
+------+--------+--------------+-------------+
|    1 | Active | 2017-07-03   | 2017-07-09  |
+------+--------+------------+---------------+

When END_DATE equals to current Date, then I want to change status 'Active' to 'Finished'

I hope I am able to understand my question.

Thanks in advance!

Body:
Body of an oracle table level trigger would look like this...

BEGIN
  IF INSERTING and (:new.end_date = sysdate) THEN
    :NEW.goal_status := desired_value;
  ELSIF UPDATING AND (:new.end_date = sysdate) then
    :NEW.goal_status := desired_value;
  END IF;
End;


问:
GA: Goals list API: webPropertyId='~all' query returns http 400 "webPropertyId" must be specified
I am looping over Google Analytics account profiles using the management().goals() API and discovering what goals are created for each, to know what I can fetch data for. Having got a valid service instance I can make requests against, the goals().list() fails complaining of missing webPropertyId parameter:

```<code># not including the ServiceAccountCredentials setup here
from apiclient.discovery import build
service = build('analytics', 'v3', http=http)
service.management().goals().list(accountId=account_id, webPropertyId='~all', profileId=profile_id)
</code>```

The last line fails with:

```<code>googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/analytics/v3/management/accounts/nnnnnnnnn/webproperties/%7Eall/profiles/nnnnnnnnn/goals?alt=json returned "webPropertyId must be specified.">
</code>```

[I replaced the account/profile numbers after /accounts/ and /profiles/ with nnnnnnnnn for this post, for privacy; the real error has numbers there]

The relevent bit: webPropertyId must be specified.

I'm definitely supplying the webPropertyId parameter, and if I remove it I get a different error:

```<code>TypeError: Missing required parameter "webPropertyId"
</code>```

I can successfully make requests to pull other metadata and user information and analytics data from the management api. What might be going wrong here? Am I not allowed to use the ~all value here and must be more specific?

答:
Works:

```<code>GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/~all/goals
</code>```

Also works

```<code>GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/73835159/goals
</code>```

Does not work.

```<code>GET https://www.googleapis.com/analytics/v3/management/accounts/41967536/webproperties/~all/profiles/73835159/goals
</code>```

Response:

```<code>{"error":{"errors":[{"domain":"global","reason":"badRequest","message":"webPropertyId must be specified."}],"code":400,"message":"webPropertyId must be specified."}}
</code>```

I am going to call this a bug  Goals with ~all results in an error bug report filed i will bring it up with the team next week.

ContentLicense: CC BY-SA 4.0

Body:
I am looping over Google Analytics account profiles using the management().goals() API and discovering what goals are created for each, to know what I can fetch data for. Having got a valid service instance I can make requests against, the goals().list() fails complaining of missing webPropertyId parameter:

# not including the ServiceAccountCredentials setup here
from apiclient.discovery import build
service = build('analytics', 'v3', http=http)
service.management().goals().list(accountId=account_id, webPropertyId='~all', profileId=profile_id)

The last line fails with:

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/analytics/v3/management/accounts/nnnnnnnnn/webproperties/%7Eall/profiles/nnnnnnnnn/goals?alt=json returned "webPropertyId must be specified.">

[I replaced the account/profile numbers after /accounts/ and /profiles/ with nnnnnnnnn for this post, for privacy; the real error has numbers there]

The relevent bit: webPropertyId must be specified.

I'm definitely supplying the webPropertyId parameter, and if I remove it I get a different error:

TypeError: Missing required parameter "webPropertyId"

I can successfully make requests to pull other metadata and user information and analytics data from the management api. What might be going wrong here? Am I not allowed to use the ~all value here and must be more specific?

Body:
Works:

GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/~all/goals

Also works

GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles/73835159/goals

Does not work.

GET https://www.googleapis.com/analytics/v3/management/accounts/41967536/webproperties/~all/profiles/73835159/goals

Response:

{"error":{"errors":[{"domain":"global","reason":"badRequest","message":"webPropertyId must be specified."}],"code":400,"message":"webPropertyId must be specified."}}

I am going to call this a bug  Goals with ~all results in an error bug report filed i will bring it up with the team next week.


问:
ERROR: function avg(boolean) does not exist
I am trying to know how frequently an event happens, and the occurence of this event in my database is recorded by setting a boolean to 'TRUE' and the non-occurence is setting it to 'FALSE'.

But when I am try to select the value by using the function avg() it returns me this error:
ERROR:  function avg(boolean) does not exist

How can I measure the event frequency and at the some time keep a good performance ?

Thank you.

Joao

答:
If you cast as int you will get an int average, which isnt very useful. Instead try:</p>

```<code>select avg(val::int::float4);
</code>```

Body:
If you cast as int you will get an int average, which isnt very useful. Instead try:

select avg(val::int::float4);


问:
Redirecting the user after completing a survey in Flask doesn't work
TL;DR for admins: Not a duplicate. I'm trying to force redirect the user from the Flask backend after completing survey using Flask, but it doesn't work (though from my understanding it should - it even behaves on console level as though as it did, but the browser doesn't reload). I do not want yet to do it on the ajax, I try to keep it as minimal as possible for now, the survey makes correctly a vanilla ajax POST to "/survey" and I want to keep it that way for now. Also, I want to understand the Flask problem instead of replacing it with another solution that I don't fully comprehend yet

I'm trying to learn some basics of Web development, wanting to make a somewhat interesting web app service using Flask as my backend.

My survey subsite of the project looks a little like this:

```<code>@app.route("/survey", methods=["GET", "POST"])
@login_required
def survey():
    if request.method == "GET":
        return render_template("survey.html")

    if request.method == "POST":
        x = request.get_json(silent=True)
        print(x)
        //todo: manipulate on x and classify a user into a group
        return redirect(url_for("index")) // just for now redirect everybody
</code>```

I'm a complete AJAX/JS newbie, but I know that my SurveyJS survey website ("/survey") after a bit of tinkering is sending the correct JSON to the backend (by printing the vast x variable after completion of the survey).  Sadly, the redirects don't work, even though the server actually tries to do it - I have the standard 200 OK code in the console that I always got for the redirects on other subsides, but the website is not changed (no loading circle or anything). After the completion, I make a POST ajax request and the survey site gives the standard SurveyJS blank website with "Thank you for completing the survey!" (it doesn't load the website or anything)

Console Flask prompts:

```<code>INFO:werkzeug:127.0.0.1 - - [03/Jul/2017 20:06:44] "POST /survey HTTP/1.1" 302 -
INFO:werkzeug:127.0.0.1 - - [03/Jul/2017 20:06:45] "GET / HTTP/1.1" 200 -
</code>```

What can I do to make the redirect work from the Flask level?

答:
I am currently working on a Flask / Vue.js (JavaScript) project, and I ran a quick test to simulate this situation, and I am almost certain that this is what's happening:

Your Flask code is working properly. The problem is with the SurveyJS website. When the SurveyJS website sends the POST request, it is presumably doing it with JavaScript (rather than as an HTML form submission), and their JavaScript code does not have logic set up to handle a redirect response from the server, and so it's effectively ignoring the response from the server.

This is different than when you have a plain-HTML website with a form on it: in that case, my rough understanding is that the browser sends the POST request and handles the response from the server, and it properly handles redirect responses.

Body:
TL;DR for admins: Not a duplicate. I'm trying to force redirect the user from the Flask backend after completing survey using Flask, but it doesn't work (though from my understanding it should - it even behaves on console level as though as it did, but the browser doesn't reload). I do not want yet to do it on the ajax, I try to keep it as minimal as possible for now, the survey makes correctly a vanilla ajax POST to "/survey" and I want to keep it that way for now. Also, I want to understand the Flask problem instead of replacing it with another solution that I don't fully comprehend yet

I'm trying to learn some basics of Web development, wanting to make a somewhat interesting web app service using Flask as my backend.

My survey subsite of the project looks a little like this:

@app.route("/survey", methods=["GET", "POST"])
@login_required
def survey():
    if request.method == "GET":
        return render_template("survey.html")

    if request.method == "POST":
        x = request.get_json(silent=True)
        print(x)
        //todo: manipulate on x and classify a user into a group
        return redirect(url_for("index")) // just for now redirect everybody

I'm a complete AJAX/JS newbie, but I know that my SurveyJS survey website ("/survey") after a bit of tinkering is sending the correct JSON to the backend (by printing the vast x variable after completion of the survey).  Sadly, the redirects don't work, even though the server actually tries to do it - I have the standard 200 OK code in the console that I always got for the redirects on other subsides, but the website is not changed (no loading circle or anything). After the completion, I make a POST ajax request and the survey site gives the standard SurveyJS blank website with "Thank you for completing the survey!" (it doesn't load the website or anything)

Console Flask prompts:

INFO:werkzeug:127.0.0.1 - - [03/Jul/2017 20:06:44] "POST /survey HTTP/1.1" 302 -
INFO:werkzeug:127.0.0.1 - - [03/Jul/2017 20:06:45] "GET / HTTP/1.1" 200 -

What can I do to make the redirect work from the Flask level?


问:
@include a view with controller functionality - Laravel 5.4
I am working on a profile page for my web application. Within this view profile.blade.php I would like to include the view progress/index.blade.php. I have the following structure:

profile.blade.php

```<code><div class="panel panel-default">
        <div class="panel-heading clearfix">
            <h1 class="panel-title pull-left">{{ $user->name }} Progress</h1>
        </div>
        <div class="panel-body">
            @include('client.progress.index')
        </div>
</div>
</code>```

web.php

```<code>Route::group(['middleware' => ['auth', 'client'], 'prefix' => 'client', 'as' => 'client.'], function () {
    Route::get('home', 'Client\HomeController@index')->name('home');
    Route::get('profile', 'Client\UserController@profile')->name('profile');
    Route::get('progress', 'Client\UserController@progress')->name('progress.index');
});
</code>```

UserController@progress

```<code>public function progress(){

        $auth = Auth::user();
        $progressPictures = Picture::select('*')
            ->where('user_id', $auth->id)
            ->get();

        return view('client.progress.index', ['progressPictures' => $progressPictures]);
    }
</code>```

client.progress.index

```<code><p>Progress pictures</p>

@foreach($progressPictures as $progressPicture)
    <img src="/storage/uploads/progress/{{ $progressPicture }}" style="width:150px; height:150px; float:left; border-radius:50%; margin-right:25px;">
@endforeach
</code>```

When I remove the php part from the index.blade.php, the site works. but when i add the foreach loop, $progressPictures is undefined. I am not calling the UserController@progress in some way. Could some one help me with this?

答:
Generally based on my observation, the variable is not making it to the views because you are routing to another while the other view is handled by another controller.

One of the ways you can do that is either to have a trait where you can easily reuse the result of getting progressPictures or because you quickly need it, you might have to duplicate this code as well in the profile method in your UserController so that you can have the progressPictures also in profile page:

So you'll have:

```<code>public function profile()
{
    //codes before or after
    $auth = Auth::user();
    $progressPictures = Picture::select('*')
        ->where('user_id', $auth->id)
        ->get();
    //......
    return view('profile', compact('progressPictures'));
</code>```

Ps: unnecessary code repetition is not generally recommended, but I would do this first then clean up things after.

Body:
I am working on a profile page for my web application. Within this view profile.blade.php I would like to include the view progress/index.blade.php. I have the following structure:

profile.blade.php

{{ $user->name }} Progress

            @include('client.progress.index')

web.php

Route::group(['middleware' => ['auth', 'client'], 'prefix' => 'client', 'as' => 'client.'], function () {
    Route::get('home', 'Client\HomeController@index')->name('home');
    Route::get('profile', 'Client\UserController@profile')->name('profile');
    Route::get('progress', 'Client\UserController@progress')->name('progress.index');
});

UserController@progress

public function progress(){

        $auth = Auth::user();
        $progressPictures = Picture::select('*')
            ->where('user_id', $auth->id)
            ->get();

        return view('client.progress.index', ['progressPictures' => $progressPictures]);
    }

client.progress.index

Progress pictures

@foreach($progressPictures as $progressPicture)

@endforeach

When I remove the php part from the index.blade.php, the site works. but when i add the foreach loop, $progressPictures is undefined. I am not calling the UserController@progress in some way. Could some one help me with this?

Body:
Generally based on my observation, the variable is not making it to the views because you are routing to another while the other view is handled by another controller.

One of the ways you can do that is either to have a trait where you can easily reuse the result of getting progressPictures or because you quickly need it, you might have to duplicate this code as well in the profile method in your UserController so that you can have the progressPictures also in profile page:

So you'll have:

public function profile()
{
    //codes before or after
    $auth = Auth::user();
    $progressPictures = Picture::select('*')
        ->where('user_id', $auth->id)
        ->get();
    //......
    return view('profile', compact('progressPictures'));

Ps: unnecessary code repetition is not generally recommended, but I would do this first then clean up things after.


问:
Named PIPE is stuck on open
I am trying to implement a named PIPE IPC method in which I am sending float values (10) each time the sendToPipe function is being called. Here is the sendToPipe function -

```<code>int fd;
char *fifoPipe = "/tmp/fifoPipe";

void sendToPipe(paTestData *data){

    int readCount   = 10;
    fd      = open(fifoPipe, O_WRONLY);   // Getting stuck here

    // Reading 10 sample float values from a buffer from readFromCB pointer as the initial address on each call to sendToPipe function.
    while(readCount > 0){

        write(fd, &data->sampleValues[data->readFromCB], sizeof(SAMPLE));  // SAMPLE is of float datatype
        data->readFromCB++;
        readCount--;
    }

    close(fd);

    //  Some code here
}
</code>```

And I have initialized the named PIPE in my main here :

```<code>int main(){

    // Some code
    mkfifo(fifoPipe, S_IWUSR | S_IRUSR);

    // Other code
}
</code>```

I am not getting where am I going wrong here. Any help is appreciated. Also let me know if any other information is required.

答:
Thanks to @LPs for pointing out what was going wrong. My each sample after entering the PIPE was waiting to be read. I however wanted an implementation in which my reader thread could read all the 10 samples in one go. Here is my implementation. -</p>

```<code>void pipeData(paTestData *data){

    SAMPLE *tempBuff = (SAMPLE*)malloc(sizeof(SAMPLE)*FRAME_SIZE);
    int readCount   = FRAME_SIZE;

    while(readCount > 0){

        tempBuff[FRAME_SIZE - readCount] = data->sampleValues[data->readFromCB];
        data->readFromCB++;
        readCount--;
    }

    fd = open(fifoPipe, O_WRONLY);

    write(fd, tempBuff, sizeof(tempBuff));
    // Reader thread called here

    close(fd);
}
</code>```

Title: Named PIPE is stuck on open

Body:
I am trying to implement a named PIPE IPC method in which I am sending float values (10) each time the sendToPipe function is being called. Here is the sendToPipe function -

int fd;
char *fifoPipe = "/tmp/fifoPipe";

void sendToPipe(paTestData *data){

    int readCount   = 10;
    fd      = open(fifoPipe, O_WRONLY);   // Getting stuck here

    // Reading 10 sample float values from a buffer from readFromCB pointer as the initial address on each call to sendToPipe function.
    while(readCount > 0){

        write(fd, &data->sampleValues[data->readFromCB], sizeof(SAMPLE));  // SAMPLE is of float datatype
        data->readFromCB++;
        readCount--;
    }

    close(fd);

    //  Some code here
}

And I have initialized the named PIPE in my main here :

int main(){

    // Some code
    mkfifo(fifoPipe, S_IWUSR | S_IRUSR);

    // Other code
}

I am not getting where am I going wrong here. Any help is appreciated. Also let me know if any other information is required.

Body:
Thanks to @LPs for pointing out what was going wrong. My each sample after entering the PIPE was waiting to be read. I however wanted an implementation in which my reader thread could read all the 10 samples in one go. Here is my implementation. -

void pipeData(paTestData *data){

    SAMPLE *tempBuff = (SAMPLE*)malloc(sizeof(SAMPLE)*FRAME_SIZE);
    int readCount   = FRAME_SIZE;

    while(readCount > 0){

        tempBuff[FRAME_SIZE - readCount] = data->sampleValues[data->readFromCB];
        data->readFromCB++;
        readCount--;
    }

    fd = open(fifoPipe, O_WRONLY);

    write(fd, tempBuff, sizeof(tempBuff));
    // Reader thread called here

    close(fd);
}


问:
how to put row onto another one? / CSS
on the image as you can see 'Sezon' and 'Poza sezonem' blocks are on another blocks(ND-CZW, PT-SB)

I'm trying to write html code of this image. how can I put Sezon,poza sezonem blocks on the blocks below?

```<code><div class="parent">
<tr>
<td style="text-align: center;background-color: #E96165;color: #fff">Ilosc
gosci</td>
<td class="baslik1">Sezon</td>
<td class="baslik1">Poza sezonem</td>
<td class="baslik1">Poza sezonem 2</td>
</tr>
<tr>
<td class="baslik2"> </td>
<td class="baslik2">ND-CZW</td>
<td class="baslik2">PT-SB</td>
<td class="baslik2">ND-CZW</td>
</tr>
</div>
</code>```

答:
Your code seems to have some wrong syntax, I tried achieve the same in the fiddle below

http://jsfiddle.net/Parthoghsh820/akhwgg2f/3/

```<code><table>
<thead>
    <tr class="header">
        <th colspan="2">
       <span>Major 1</span>
        </th>
        <th colspan="2">
        <span>Major 2</span>
        </th>
    </tr>
    <tr class="subheader">
        <th>col1</th>
        <th>col2</th>
        <th>col3</th>
        <th>col4</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>data1</td>
        <td>data2</td>
        <td>data3</td>
        <td>data4</td>
    </tr>
</tbody>
</code>```

Title: how to put row onto another one? / CSS

Body:
on the image as you can see 'Sezon' and 'Poza sezonem' blocks are on another blocks(ND-CZW, PT-SB)

I'm trying to write html code of this image. how can I put Sezon,poza sezonem blocks on the blocks below?

Ilosc
gosci
Sezon
Poza sezonem
Poza sezonem 2

ND-CZW
PT-SB
ND-CZW

Body:
Your code seems to have some wrong syntax, I tried achieve the same in the fiddle below

http://jsfiddle.net/Parthoghsh820/akhwgg2f/3/

<table>
<thead>
    <tr class="header">
        <th colspan="2">
       <span>Major 1</span>
        </th>
        <th colspan="2">
        <span>Major 2</span>
        </th>
    </tr>
    <tr class="subheader">
        <th>col1</th>
        <th>col2</th>
        <th>col3</th>
        <th>col4</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>data1</td>
        <td>data2</td>
        <td>data3</td>
        <td>data4</td>
    </tr>
</tbody>


问:
section(overflow:scroll) hides my text next to it
I've created a section and added overflow:scroll aswell as a postion:absolute so that my text that I've put in my lines dont get under but next to my section.

But now i do not know what to do since my text is inside my section,I've been douing a old html page when css wasn't introduced yet, i saw that my text had a width and height position but i would like to not change it and only apply a way to separate them

body {
  background-color: rgba(170, 200, 228, 0.3);
}

section {
  word-wrap: break-word;
  max-width: 400px;
  max-height: 100%;
  overflow: scroll;
  position: absolute;
}

.center {
  vertical-align: top;
  position: absolute;
}

header {
  border: 10px ridge #1173A4;
}

.menu {
  overflow: hidden;
  background-color: #3CA9DF;
  font-family: Arial;
}

.menu a {
  float: left;
  font-size: 16px;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

.information {
  float: left;
  overflow: hidden;
}

.information .informationbtn {
  font-size: 16px;
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
}

.information .informationbtn a {
  padding: 0px 0px;
}

.menu a:hover,
.information:hover .informationbtn {
  background-color: #7FB8D5;
}

.information-content {
  display: none;
  position: absolute;
  background-color: #7FB8D5;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.information-content a {
  float: none;
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.information-content a:hover {
  background-color: #333;
}

.information:hover .information-content {
  display: block;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!doctype html>
<html>

<head>

  <link rel="stylesheet" href="collegecss.css" />
  <title>college sainte marie </title>
</head>

<body>
  <header>
    <img src="../saintemarie.png">
    <h1>
      <titre>Bienvenue dans le site du Lycée Sainte-Marie</titre>
      <h1>
  </header>

  <div class="menu">
    accueil

    <div class="information">
      <button class="informationbtn"> information générale</button>
      <div class="information-content">
        inscription
        historique
        accéder au collège
        horaires
        règlement
        tarifs
      </div>

    </div>
    calendrier
    visite
    pastorale
    vie du collège
  </div>

  <section>
    qdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsf<br /> qdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfq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dfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsf
    <br />

  </section>

  <div align="center">
    <center>
      <font size="5" color="#000080">
        INFORMATIONS GENERALES  <br>
      </font>
      <font size="2" color="#000080">
        <br>
      </font>
      </b><img border="0" src="images/barre.gif" width="600" height="5"></p>

      <table cellpadding="0" cellspacing="0" style="border-collapse: collapse; " id="AutoNumber1" width="900" height="167" border="0">
        <tr>
          <td width="877" height="1" align="center" style="padding:0; " colspan="3"></td>
        </tr>
        <tr>
          <td width="1425" height="1" align="center" style="border-style: none; border-width: medium" valign="middle" colspan="5">
            <b><font size="4">Le collège Sainte Marie c'est :<br>
 </font></b></td>
        </tr>
        <tr>
          <td width="400" height="221" align="left" style="border-style: none; border-width: medium" valign="top">
            <p align="center"><b><font color="#800000">un accompagnement scolaire <br>
    au cœur d'un
    collège ouvert à tous : </font></b></p>
            <ul>
              <li>
                <p style="line-height: 150%">Soutien, approfondissement</li>

              <li>
                <p style="line-height: 150%">Etudes du soir</li>

          </td>
          <td width="40" height="221" align="left" style="border-style: none; border-width: medium" valign="top">
             </td>
          <td width="487" height="221" align="left" style="border-style: none; border-width: medium" valign="top">
            <p align="center">
              <b>
    <font color="#800000">un accompagnement artistique, culturel et sportif dans un
    cadre de verdure agréable en plein centre ville, bien équipé :</font></b></p>
            <ul>
              <li>
                <p style="line-height: 150%">Activités périscolaires (chorale, atelier artistique)</li>
            </ul>
            <p style="line-height: 150%" align="center">
              </font>
              </i>
              <ul>
                <li>
                  <p style="line-height: 150%">Association sportive</li>
                <p style="line-height: 150%" align="center">

                  <li>
                    <p style="line-height: 150%">Voyages scolaires (Espagne, Angleterre...)</li>
              </ul>
          </td>
          <td width="42" height="221" align="left" style="border-style: none; border-width: medium" valign="top">
             </td>
          <td width="404" height="221" align="left" style="border-style: none; border-width: medium" valign="top">
            <p style="line-height: 150%" align="center"><b><font color="#800000">une petite structure qui permet :</font></b></p>
            <ul>
              <li>
                <p style="line-height: 150%">une meilleure connaissance de chacun,</li>
              <li>
                <p style="line-height: 150%">un meilleur suivi</li>
              <li>
                <p style="line-height: 150%">une disponibilité auprès de l'élève et de sa famille
              </li>
              <li>
                <p style="line-height: 150%">un espace d'animation d'écoute et de partage (actions de solidarité, initiation culture et religions, rencontre de témoins ...</li>
            </ul>
            <p style="line-height: 150%">
              <p style="line-height: 150%" align="center">

        </tr>
        <tr>
          <td width="1425" height="57" align="center" style="border-style: none; border-width: medium" valign="middle" colspan="5">
            <b><font size="4">Découvrez notre collège en détail :</font></b></td>
        </tr>
        <tr>
          <td width="266" height="128" align="center" style="border-style: none; border-width: medium" valign="middle">
            <img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#0000FF" size="4">
                Inscriptions</font>
          </td>
          <td width="43" height="128" align="center" style="border-style: none; border-width: medium" valign="middle">
             </td>
          <td width="505" height="128" align="center" style="border-style: none; border-width: medium" valign="middle">
            <img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#800000" size="4">
                Historique</font>
          </td>
          <td width="38" height="128" align="center" style="border-style: none; border-width: medium" valign="middle">
             </td>
          <td width="573" height="128" align="center" style="border-style: none; border-width: medium" valign="middle">
            <img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#000080" size="4">
                Accéder
    au collège</font>
          </td>
        </tr>
        <tr>
          <td width="266" height="101" align="center" style="border-style: none; border-width: medium" valign="middle">
            <img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#000080" size="4">
                Horaires</font>
          </td>
          <td width="43" height="101" align="center" style="border-style: none; border-width: medium" valign="middle"> </td>
          <td width="505" height="101" align="center" style="border-style: none; border-width: medium" valign="middle"><img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#000080" size="4" face="Arial">
                Règlement</font>
          </td>
          <td width="38" height="101" align="center" style="border-style: none; border-width: medium" valign="middle">
             </td>
          <td width="573" height="101" align="center" style="border-style: none; border-width: medium" valign="middle">
            <img border="0" src="images/bouton.bmp" width="80" height="30">
            <p>
              <font color="#000080" size="4">
                Tarifs</font>
          </td>
        </tr>
      </table>
    </center>
  </div>

</body>

</html></code>```

i need to add that i wrote this page in french , so if you need traduction can you ask mee in the comment

答:
Try to put the content in a div and set its width/height.
also try adding some padding to it.

and change the overflow to auto.

```<code>overflow:auto
</code>```

Body:
I've created a section and added overflow:scroll aswell as a postion:absolute so that my text that I've put in my lines dont get under but next to my section.

But now i do not know what to do since my text is inside my section,I've been douing a old html page when css wasn't introduced yet, i saw that my text had a width and height position but i would like to not change it and only apply a way to separate them

body {
  background-color: rgba(170, 200, 228, 0.3);
}

section {
  word-wrap: break-word;
  max-width: 400px;
  max-height: 100%;
  overflow: scroll;
  position: absolute;
}

.center {
  vertical-align: top;
  position: absolute;
}

header {
  border: 10px ridge #1173A4;
}

.menu {
  overflow: hidden;
  background-color: #3CA9DF;
  font-family: Arial;
}

.menu a {
  float: left;
  font-size: 16px;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

.information {
  float: left;
  overflow: hidden;
}

.information .informationbtn {
  font-size: 16px;
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
}

.information .informationbtn a {
  padding: 0px 0px;
}

.menu a:hover,
.information:hover .informationbtn {
  background-color: #7FB8D5;
}

.information-content {
  display: none;
  position: absolute;
  background-color: #7FB8D5;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.information-content a {
  float: none;
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.information-content a:hover {
  background-color: #333;
}

.information:hover .information-content {
  display: block;
}

<!doctype html>

  <link rel="stylesheet" href="collegecss.css" />
  <title>college sainte marie </title>

      <titre>Bienvenue dans le site du Lycée Sainte-Marie</titre>

    accueil

      <button class="informationbtn"> information générale</button>

        inscription
        historique
        accéder au collège
        horaires
        règlement
        tarifs

    calendrier
    visite
    pastorale
    vie du collège

    qdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsf
 qdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsfqsfqsfqsfqsfqdfqfsqfsqfqsf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

        INFORMATIONS GENERALES

            Le collège Sainte Marie c'est :

un accompagnement scolaire

    au cœur d'un
    collège ouvert à tous :

Soutien, approfondissement

Etudes du soir

    un accompagnement artistique, culturel et sportif dans un
    cadre de verdure agréable en plein centre ville, bien équipé :

Activités périscolaires (chorale, atelier artistique)

Association sportive

Voyages scolaires (Espagne, Angleterre...)

une petite structure qui permet :

une meilleure connaissance de chacun,

un meilleur suivi

une disponibilité auprès de l'élève et de sa famille

un espace d'animation d'écoute et de partage (actions de solidarité, initiation culture et religions, rencontre de témoins ...

            Découvrez notre collège en détail :

                Inscriptions

                Historique

                Accéder
    au collège

                Horaires

                Règlement

                Tarifs

i need to add that i wrote this page in french , so if you need traduction can you ask mee in the comment

Body:
Try to put the content in a div and set its width/height.
also try adding some padding to it.

and change the overflow to auto.

overflow:auto


问:
Cannot add element to array
I'm new in Swift and I have issue with adding an element to an Array

I'm trying to store 6 objects from JSON to Array. But the Array is nil.

I see it add to Array when I debug it, I have no idea why it's nil after finished request JSON?

JSON:

```<code>[
    {
        "amount": "20.0",
        "date": "10/07/2016"
    },
    {
        "amount": "21.0",
        "date": "11/07/2016"
    },
    {
        "amount": "16.0",
        "date": "12/07/2016"
    },
    {
        "amount": "30.0",
        "date": "13/07/2016"
    },
    {
        "amount": "50.0",
        "date": "14/07/2016"
    },
    {
        "amount": "33.0",
        "date": "15/07/2016"
    }
]
</code>```

Service:

```<code>    class DownloadService {
    static let instance = DownloadService()
    //static var goldArray = [Gold]()
    var goldArray = [Gold]()
    func getData() {
        Alamofire.request("https://rth-recruitment.herokuapp.com/api/prices/chart_data", headers: headers).responseJSON { response in
            if let objJson = response.result.value as! NSArray?{
                for element in objJson {
                    let data = element as! NSDictionary
                    let amount = data["amount"] as! String
                    let date = data["date"] as! String
                    let gold = Gold(amount: amount, date: date)
                    self.goldArray.append(gold)
                    print(self.goldArray.count)//print 1 to 6
                }
            }
        }
        printGoldArray()
    }

    func printGoldArray(){
        for element in self.goldArray {
            print(element)//print nothing
        }
    }
}
</code>```

Gold class:

```<code>    class Gold{
    let amount:String
    let date: String

    init(amount: String, date: String) {
        self.amount = amount
        self.date = date
    }

}
</code>```

ViewController:

```<code>    class ViewController: UIViewController {
    //var dataArray = [Gold]()
    override func viewDidLoad() {
        super.viewDidLoad()
        DownloadService.instance.getData()

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
</code>```

答:
Here printGoldArray function is being called from outside the closure which means when  printGoldArray is called the goldArray may not be having any values.

Try calling printGoldArray function from inside the closure after adding the values. Try the below code

```<code>func getData() {
    Alamofire.request("https://rth-recruitment.herokuapp.com/api/prices/chart_data", headers: headers).responseJSON { response in
        if let objJson = response.result.value as! NSArray?{
            for element in objJson {
                let data = element as! NSDictionary
                let amount = data["amount"] as! String
                let date = data["date"] as! String
                let gold = Gold(amount: amount, date: date)
                self.goldArray.append(gold)
                print(self.goldArray.count)//print 1 to 6
            }
        }
     printGoldArray()
    }

}
</code>```

Title: Cannot add element to array

Body:
I'm new in Swift and I have issue with adding an element to an Array

I'm trying to store 6 objects from JSON to Array. But the Array is nil.

I see it add to Array when I debug it, I have no idea why it's nil after finished request JSON?

JSON:

[
    {
        "amount": "20.0",
        "date": "10/07/2016"
    },
    {
        "amount": "21.0",
        "date": "11/07/2016"
    },
    {
        "amount": "16.0",
        "date": "12/07/2016"
    },
    {
        "amount": "30.0",
        "date": "13/07/2016"
    },
    {
        "amount": "50.0",
        "date": "14/07/2016"
    },
    {
        "amount": "33.0",
        "date": "15/07/2016"
    }
]

Service:

    class DownloadService {
    static let instance = DownloadService()
    //static var goldArray = [Gold]()
    var goldArray = [Gold]()
    func getData() {
        Alamofire.request("https://rth-recruitment.herokuapp.com/api/prices/chart_data", headers: headers).responseJSON { response in
            if let objJson = response.result.value as! NSArray?{
                for element in objJson {
                    let data = element as! NSDictionary
                    let amount = data["amount"] as! String
                    let date = data["date"] as! String
                    let gold = Gold(amount: amount, date: date)
                    self.goldArray.append(gold)
                    print(self.goldArray.count)//print 1 to 6
                }
            }
        }
        printGoldArray()
    }

    func printGoldArray(){
        for element in self.goldArray {
            print(element)//print nothing
        }
    }
}

Gold class:

    class Gold{
    let amount:String
    let date: String

    init(amount: String, date: String) {
        self.amount = amount
        self.date = date
    }

}

ViewController:

    class ViewController: UIViewController {
    //var dataArray = [Gold]()
    override func viewDidLoad() {
        super.viewDidLoad()
        DownloadService.instance.getData()

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

Body:
Here printGoldArray function is being called from outside the closure which means when  printGoldArray is called the goldArray may not be having any values.

Try calling printGoldArray function from inside the closure after adding the values. Try the below code

func getData() {
    Alamofire.request("https://rth-recruitment.herokuapp.com/api/prices/chart_data", headers: headers).responseJSON { response in
        if let objJson = response.result.value as! NSArray?{
            for element in objJson {
                let data = element as! NSDictionary
                let amount = data["amount"] as! String
                let date = data["date"] as! String
                let gold = Gold(amount: amount, date: date)
                self.goldArray.append(gold)
                print(self.goldArray.count)//print 1 to 6
            }
        }
     printGoldArray()
    }

}


问:
Limit number of connections to instances with AWS ELB
We are using AWS classic ELB for our service and our service can only serve x number of requests at a time. If the number of requests are greater than x then we do not want to route those requests to the instance and neither do we want to lose those requests. We would like to limit the number of connections to the instances registered with the ELB. Is there some ELB setting to configure max connections to instances?

Another solution I could find was to use ELB connection draining but based on the ELB doc [1] , using connection draining will mark the instance as OutofService after serving in-flight requests. Does that mean the instance will be terminated and de-registered from ELB after in-flight requests are served? We do not want to terminate and de-register the instances, we just want to limit the number of connections to the instances. Any solutions?

[1] http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-conn-drain.html

答: AWS ELB is practically no limit to get request. If your application handle only 'N' connection, Please go with multiple servers  behind the ELB and set ELB  health check URL will be your application URL. Once your application not able to respond the request, ELB automatically forward your request to another server which is behind ELB. So that you are not going to miss any request.</p>


答:
You need to parse your JSON data first before getting value out

```<code>do{
    let json = try JSONSerialization.jsonObject(with: response.result.value, options: []) as? [Any]
    let firstObj = json?[0] as! [String: String]
    let amount = firstObj["amount"]
    dump(amount)
}catch let error{

}
</code>```

Then, your HTTP call will not get you the return value until the closure is executed. So to print your array, you need to do it inside your closure. For example, you can do so right after the json parsing, by calling printGoldArray()

Title: Cannot add element to array

Body:
You need to parse your JSON data first before getting value out

do{
    let json = try JSONSerialization.jsonObject(with: response.result.value, options: []) as? [Any]
    let firstObj = json?[0] as! [String: String]
    let amount = firstObj["amount"]
    dump(amount)
}catch let error{

}

Then, your HTTP call will not get you the return value until the closure is executed. So to print your array, you need to do it inside your closure. For example, you can do so right after the json parsing, by calling printGoldArray()


问:
How do you set up an x64 development environment based on gcc and eclipse?
I want to create 64 bit apps for (for example) 64 bit Windows 7. I've searched the web and found some help but couldn't get it to work.

Sorry I've taken so long to respond but I have tried to get the packages suggested to work but they're not easy or else I'm doing something wrong.

Anyway I ran across an environment called pellesc. It consists of a development environment around a compiler which traces is roots back to a 32-bit version that was once (according to Wikipedia) used to develop Quake. From what I've seen so far it's very promising and generates good code too!

答: Honestly, I use cygwin. Its compatable with unix so you can easily move systems and has tons of functionality that is gcc friendly (autoconf, make, makedepends, ...). To use gcc to compile to 64 bit add the -m64 option. To compile for windows use the -mno-cygwin option. Make sure though that you're using gcc 3 and not 4 (then you'd use the mingw compiler series). Otherwise, its all the same as unix which is really useful.</p>


问:
Angular 2 component with multiple views
How can I give an Angular 2 component multiple views\view templates?

Do I have to use ng-content? Which is not exactly the function I want. Maybe a component property that specifies the template url, but then how to change the view\template in the component class?

答:
Not sure if NG2 has built-in way to support this.

It looks like you need two components, but you have one, and you tying to find a fastest way. But the best solution will be split complicated logic into different structures (like services, other modules etc). The best way it to make the structure that will be comfortable to work with. And when you build this structure - you will not need to multiple html to the directive.

Title: Angular 2 component with multiple views


问:
mailer preview not working
My mailer is named send_invoice_mailer.rb (it works in dev and in prod).

I want to be able to preview the send_checkout_invoice function using the mailer preview.

routes.rb :

```<code>scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
  #app routes
end
</code>```

/spec/mailers/previews/send_invoice_preview.rb AND /test/mailers/previews/send_invoice_preview.rb (not sure wich one is the correct one so I symlinked the file)

```<code>class SendInvoicePreview < ActionMailer::Preview

  def send_checkout_invoice
    #initializing foo
    SendInvoice.send_checkout_invoice(foo)
  end
end
</code>```

When I go to  : /rails/mailers/send_invoice/send_checkout_invoice I am redirected to /fr/rails/mailers/send_invoice/send_checkout_invoice with this error:

```<code>No route matches [GET] "/fr/rails/mailers/send_invoice/send_checkout_invoice"
</code>```

EDIT : rails is 4.2 and this is done in dev with passenger. App has been upgraded from previous rails versions multiple times.

EDIT 2 : /rails/mailers also does not work. Is it because of the locale scope?

答: I had a few routes at the end of routes.rb that caught all requests. It works perfectly now.</p>

Title: mailer preview not working

Body:
My mailer is named send_invoice_mailer.rb (it works in dev and in prod).

I want to be able to preview the send_checkout_invoice function using the mailer preview.

routes.rb :

scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
  #app routes
end

/spec/mailers/previews/send_invoice_preview.rb AND /test/mailers/previews/send_invoice_preview.rb (not sure wich one is the correct one so I symlinked the file)

class SendInvoicePreview < ActionMailer::Preview

  def send_checkout_invoice
    #initializing foo
    SendInvoice.send_checkout_invoice(foo)
  end
end

When I go to  : /rails/mailers/send_invoice/send_checkout_invoice I am redirected to /fr/rails/mailers/send_invoice/send_checkout_invoice with this error:

No route matches [GET] "/fr/rails/mailers/send_invoice/send_checkout_invoice"

EDIT : rails is 4.2 and this is done in dev with passenger. App has been upgraded from previous rails versions multiple times.

EDIT 2 : /rails/mailers also does not work. Is it because of the locale scope?


问:
ngFor from object?
I'm using Ionic 2 / Angular, but I realized that the ngFor function can't read objects. Also, I need it to be shown only if the cart is not empty.

Object:

```<code>{
    "48131": {
        "code":"D40905",
        "name":"ДАМСКА ПЛЕТЕНА БЛУЗА КЪС РЪКАВ ЩАМПА REASON",
        "price":"18.99",
        "size":"STANDART",
        "qty":"1"
    },
    "49410": {
        "code":"D41821",
        "name":"ДАМСКА БЛУЗА ТРИКО",
        "price":"44.99",
        "size":"M",
        "qty":"4"
    }
}
</code>```

HTML:

```<code><ion-row *ngFor="let p of cart">
    <ion-col col-3>
        <div><img src="http://example.com/products/small/{{p.code}}-1.jpg" /></div>
    </ion-col>
    <ion-col col-9>
        <ion-row>
            <ion-col col-12>
                <div>{{p.name}}</div>
            </ion-col>
        </ion-row>
        <ion-row>
            <ion-col col-12>
                <div>{{p.qty}} бр ({{p.size}} размер) x <b>{{p.price}} лв</b></div>
            </ion-col>
        </ion-row>
        <ion-row>
            <ion-col col-12>
                <div (click)="deleteCart({{p.id}})">Изтрий <ion-icon name='trash' item-start color="danger"></ion-icon></div>
            </ion-col>
        </ion-row>
    </ion-col>
</ion-row>
</code>```

Can someone help me with this? I've tried so many things...

答:
Your card json is not array. It should be </p>

```<code>[
    "48131": {
        "code":"D40905",
        "name":"ДАМСКА ПЛЕТЕНА БЛУЗА КЪС РЪКАВ ЩАМПА REASON",
        "price":"18.99",
        "size":"STANDART",
        "qty":"1"
    },
    "49410": {
        "code":"D41821",
        "name":"ДАМСКА БЛУЗА ТРИКО",
        "price":"44.99",
        "size":"M",
        "qty":"4"
    }
]
</code>```

Title: ngFor from object?

Body:
I'm using Ionic 2 / Angular, but I realized that the ngFor function can't read objects. Also, I need it to be shown only if the cart is not empty.

Object:

{
    "48131": {
        "code":"D40905",
        "name":"ДАМСКА ПЛЕТЕНА БЛУЗА КЪС РЪКАВ ЩАМПА REASON",
        "price":"18.99",
        "size":"STANDART",
        "qty":"1"
    },
    "49410": {
        "code":"D41821",
        "name":"ДАМСКА БЛУЗА ТРИКО",
        "price":"44.99",
        "size":"M",
        "qty":"4"
    }
}

HTML:

<ion-row *ngFor="let p of cart">
    <ion-col col-3>

    </ion-col>
    <ion-col col-9>
        <ion-row>
            <ion-col col-12>

{{p.name}}

            </ion-col>
        </ion-row>
        <ion-row>
            <ion-col col-12>

{{p.qty}} бр ({{p.size}} размер) x {{p.price}} лв

            </ion-col>
        </ion-row>
        <ion-row>
            <ion-col col-12>

Изтрий <ion-icon name='trash' item-start color="danger"></ion-icon>

            </ion-col>
        </ion-row>
    </ion-col>
</ion-row>

Can someone help me with this? I've tried so many things...

Body:
Your card json is not array. It should be

[
    "48131": {
        "code":"D40905",
        "name":"ДАМСКА ПЛЕТЕНА БЛУЗА КЪС РЪКАВ ЩАМПА REASON",
        "price":"18.99",
        "size":"STANDART",
        "qty":"1"
    },
    "49410": {
        "code":"D41821",
        "name":"ДАМСКА БЛУЗА ТРИКО",
        "price":"44.99",
        "size":"M",
        "qty":"4"
    }
]


问:
LINQ query to create a list of objects where each object contains a list
I have XML describing some data like this:

```<code><People>
    <Person>
        <Name>Alice</Name>
        <Dogs>
            <Dog>Labrador</Dog>
            <Dog>German Shepherd</Dog>
        </Dogs>
    </Person>
    <Person>
        <Name>Bob</Name>
        <Dogs>
            <Dog>Poodle</Dog>
        </Dogs>
    </Person>
</People>
</code>```

And some classes:

```<code>class Person
{
   public string Name { get; set; }
   public List<Dog> Dogs { get; set; }
}

class Dogs
{
    public string Type { get; set; }
}
</code>```

I want to use linq to XML to query this data, so that I can create a set of Person objects with the Dog collection for each populated. How do I do this? Something like:

```<code> var doc = XDocument.Load("Test.xml");
 var enumerableOfPeople = from u in doc.Root.Descendants("Person")
                    select new Person() { Name = u.Element("Name").Value,
                                          Dogs = /* WHAT GOES HERE */ };
</code>```

答:
```<code>var enumerableOfPeople = doc.Root.Descendants("Person")
                        .Select(u => new Person {
                            Name = u.Element("Name").Value,
                            Dogs = u.Descendants().Select(x => new Dog{ Type = x.Value}).ToList()
                        });
</code>```

Body:
I have XML describing some data like this:

<People>
    <Person>
        <Name>Alice</Name>
        <Dogs>
            <Dog>Labrador</Dog>
            <Dog>German Shepherd</Dog>
        </Dogs>
    </Person>
    <Person>
        <Name>Bob</Name>
        <Dogs>
            <Dog>Poodle</Dog>
        </Dogs>
    </Person>
</People>

And some classes:

class Person
{
   public string Name { get; set; }
   public List<Dog> Dogs { get; set; }
}

class Dogs
{
    public string Type { get; set; }
}

I want to use linq to XML to query this data, so that I can create a set of Person objects with the Dog collection for each populated. How do I do this? Something like:

 var doc = XDocument.Load("Test.xml");
 var enumerableOfPeople = from u in doc.Root.Descendants("Person")
                    select new Person() { Name = u.Element("Name").Value,
                                          Dogs = /* WHAT GOES HERE */ };


答:
A lambda approach to getting the people:

```<code>var peeps = doc.Root.Descendants("Person").Select(r => new Person()
{
    Name = r.Element("Name").Value,
    Dogs = r.Element("Dogs").Descendants("Dog").Select(t => new Dog()
    {
        Type = t.Value
    }).ToList()
});
</code>```

Title: LINQ query to create a list of objects where each object contains a list

Body:
A lambda approach to getting the people:

var peeps = doc.Root.Descendants("Person").Select(r => new Person()
{
    Name = r.Element("Name").Value,
    Dogs = r.Element("Dogs").Descendants("Dog").Select(t => new Dog()
    {
        Type = t.Value
    }).ToList()
});


问:
Can't create a table and select from it while in a plsql procedure in oracle
```<code>create or replace procedure sp_test as
begin
CREATE TABLE T AS SELECT col1,col2 FROM t1;
FOR N IN (SELECT * FROM T) LOOP
     UPDATE t1 SET t1.col1='value' where col2='value2';
END LOOP;
drop table T;
end;
/
</code>```

I need to select data into t table from a t1 table in order to apply some modifications, and merge those modifications in t1 table (origin table) before deleting table t.

I m getting this error : PLS-00103

答:
Thanks everybody for your contribution, I tried something that works :
A cursor for update.
Thanks for help :)</p>

Body:
create or replace procedure sp_test as
begin
CREATE TABLE T AS SELECT col1,col2 FROM t1;
FOR N IN (SELECT * FROM T) LOOP
     UPDATE t1 SET t1.col1='value' where col2='value2';
END LOOP;
drop table T;
end;
/

I need to select data into t table from a t1 table in order to apply some modifications, and merge those modifications in t1 table (origin table) before deleting table t.

I m getting this error : PLS-00103


问:
How can I implement a Hierarchical concurrent finite state machine in C (HCFSM)?
I am using a FSM to model the behaviour of an embedded system I am developing. After some initial tests I have a FSM coded in C working quite well. The approach I used to code the FSM was the pointer-to-function table where I define a table with all the functions that takes place in each state.

```<code>void(*state_table[])(void) = {
conection,
Idle,
cal,
bi,
pot,
gal,
eis,
PrepE,
Pret,
Meas,
FS_ch,
Ending,
Error };
</code>```

Now the next step is to modeling some complexities of the requirements that I could not solve with the first approach. In this new model I would like to use some concurrency to model two FSMs that should work at the "same time", and I also used some hierarchy to put those FSMs inside a superstate.

The problem I have now is that I am not sure how to code this concurrency and hierarchy using C. I was taking a look to the QP framework but I think my FSM is not still so complex to begin to use those kind of frameworks.

This is the FSM I designed.

The states 71 and 72 are the concurrent states inside the superstate 7. The execution is acutally independent between them, they doesn't share any variable.

How could I  implement this concurrency and hierarchy using C?

答:
The outer state-machine runs in a continuous loop, while sub-states and sub-state-machines must run to completion. Concurrency in the absence of a preemptive scheduler must be implemented cooperatively - the "concurrent" states must be executed sequentially, but each should perform a deterministic guaranteed-to-complete operation on each invocation - i.e. no indefinite busy-waits or delays or processing that take longer that your real-time constraints allow (this is fundamental to state-machine constraint in any case).

The substate-machines can be implemented identically to the main state machine but without the "big-loop".  For example:

```<code>// Main state machine
static int current_state0 = 0 ;
int main( void )
{
    static const void(*state_table[])(void) =
    {
        conection,
        Idle,
        cal,
        bi,
        pot,
        gal,
        eis,
        PrepE,
        Pret,
        Meas,
        FS_ch,
        Ending,
        Error
    } ;

    // Main loop - execute the current state
    for(;;)
    {
        state_table[current_state0]() ;
    }
}

void superState7()
{
    // Execute concurrent sub-statemachines
    subStateMachine71() ;
    subStateMachine72() ;
}

// Sub-state machine
static int current_state71 = 0 ;
void subStateMachine71()
{
    static const void(*state_table[])(void) =
    {
        state711,
        state712,
        state713,
        state714
    } ;

    // Execute current substate
    state_table[current_state71]() ;
}

...
</code>```

Body:
I am using a FSM to model the behaviour of an embedded system I am developing. After some initial tests I have a FSM coded in C working quite well. The approach I used to code the FSM was the pointer-to-function table where I define a table with all the functions that takes place in each state.

void(*state_table[])(void) = {
conection,
Idle,
cal,
bi,
pot,
gal,
eis,
PrepE,
Pret,
Meas,
FS_ch,
Ending,
Error };

Now the next step is to modeling some complexities of the requirements that I could not solve with the first approach. In this new model I would like to use some concurrency to model two FSMs that should work at the "same time", and I also used some hierarchy to put those FSMs inside a superstate.

The problem I have now is that I am not sure how to code this concurrency and hierarchy using C. I was taking a look to the QP framework but I think my FSM is not still so complex to begin to use those kind of frameworks.

This is the FSM I designed.

The states 71 and 72 are the concurrent states inside the superstate 7. The execution is acutally independent between them, they doesn't share any variable.

How could I  implement this concurrency and hierarchy using C?

Body:
The outer state-machine runs in a continuous loop, while sub-states and sub-state-machines must run to completion. Concurrency in the absence of a preemptive scheduler must be implemented cooperatively - the "concurrent" states must be executed sequentially, but each should perform a deterministic guaranteed-to-complete operation on each invocation - i.e. no indefinite busy-waits or delays or processing that take longer that your real-time constraints allow (this is fundamental to state-machine constraint in any case).

The substate-machines can be implemented identically to the main state machine but without the "big-loop".  For example:

// Main state machine
static int current_state0 = 0 ;
int main( void )
{
    static const void(*state_table[])(void) =
    {
        conection,
        Idle,
        cal,
        bi,
        pot,
        gal,
        eis,
        PrepE,
        Pret,
        Meas,
        FS_ch,
        Ending,
        Error
    } ;

    // Main loop - execute the current state
    for(;;)
    {
        state_table[current_state0]() ;
    }
}

void superState7()
{
    // Execute concurrent sub-statemachines
    subStateMachine71() ;
    subStateMachine72() ;
}

// Sub-state machine
static int current_state71 = 0 ;
void subStateMachine71()
{
    static const void(*state_table[])(void) =
    {
        state711,
        state712,
        state713,
        state714
    } ;

    // Execute current substate
    state_table[current_state71]() ;
}

...


问:
Adjusting the Xcode iPhone simulator scale and size
Is there anyway to make the iOS simulator for iPhone 5 in Xcode, be the actual size of the iPhone 5. I'm getting a huge display and things seemed to be scaled.</p>

答:
With Xcode 9 - Simulator, you can pick & drag any corner of simulator to resize it and set according to your requirement.

Look at this snapshot.

Note: With Xcode 9.1+, Simulator scale options are changed.

Keyboard short-keys:

 According to Xcode 9.1+

```<code>Physical Size       ⌘ 1      command + 1
Pixel Accurate      ⌘ 2      command + 2
</code>```

 According to Xcode 9

```<code>50% Scale           ⌘ 1      command + 1
100% Scale          ⌘ 2      command + 2
200% Scale          ⌘ 3      command + 3
</code>```

Simulator scale options from Xcode Menu:

Xcode 9.1+:

 Menubar  ▶  Window  ▶  "Here, options available change simulator scale" (Physical Size & Pixel Accurate)

Pixel Accurate: Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled.

Tip: rotate simulator ( ⌘ + ←  or  ⌘ + → ), if Pixel Accurate is disabled. It may be enabled (if it fits to screen) in landscape.

Xcode 9.0

Menubar  ▶  Window  ▶  Scale  ▶  "Here, options available change simulator scale"

Tip: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?

Disable 'Optimize Rendering for Window scale' from Debug menu, before you take a screen shot (See here: How to take screenshots in the iOS simulator)

There is an option

Menubar  ▶  Debug  ▶  Disable "Optimize Rendering for Window scale"

Here is Apple's document: Resize a simulator window

Body:
With Xcode 9 - Simulator, you can pick & drag any corner of simulator to resize it and set according to your requirement.

Look at this snapshot.

Note: With Xcode 9.1+, Simulator scale options are changed.

Keyboard short-keys:

 According to Xcode 9.1+

Physical Size       ⌘ 1      command + 1
Pixel Accurate      ⌘ 2      command + 2

 According to Xcode 9

50% Scale           ⌘ 1      command + 1
100% Scale          ⌘ 2      command + 2
200% Scale          ⌘ 3      command + 3

Simulator scale options from Xcode Menu:

Xcode 9.1+:

 Menubar  ▶  Window  ▶  "Here, options available change simulator scale" (Physical Size & Pixel Accurate)

Pixel Accurate: Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled.

Tip: rotate simulator ( ⌘ + ←  or  ⌘ + → ), if Pixel Accurate is disabled. It may be enabled (if it fits to screen) in landscape.

Xcode 9.0

Menubar  ▶  Window  ▶  Scale  ▶  "Here, options available change simulator scale"

Tip: How do you get screen shot with 100% (a scale with actual device size) that can be uploaded on AppStore?

Disable 'Optimize Rendering for Window scale' from Debug menu, before you take a screen shot (See here: How to take screenshots in the iOS simulator)

There is an option

Menubar  ▶  Debug  ▶  Disable "Optimize Rendering for Window scale"

Here is Apple's document: Resize a simulator window


问:
Ordering sub-collections in an EF/LINQ query
I am having trouble figuring out how (and where) to order a subcollection in a LINQ/EF query.

Basically I have a collection of SubscriptionTypes, each having its own collection of Subscriptions. I would like each Subscription in the collection to be ordered by NumberOfMonths.

Here is my current query:

```<code>    public IQueryable<SubscriptionType> SubscriptionTypesByProperty(string propertyCode)
{
    return from a in db.SubscriptionTypes.Include("Subscriptions")
           where a.Subscriptions.Any(x => x.PropertyCode == propertyCode)
           select a;
}
</code>```

I would like the Subscriptions to be ordered by NumberOfMonths. I tried this:

```<code>    public IQueryable<SubscriptionType> SubscriptionTypesByProperty(string propertyCode)
    {
        return from a in db.SubscriptionTypes.Include("Subscriptions")
               where a.Subscriptions.OrderBy(q => q.NumberOfMonths).Any(x => x.PropertyCode == propertyCode)
               select a;
    }
</code>```

.. but that did not order the subscriptions correctly.

Does anybody know of an easy way to do this?

UPDATE: SubscriptionType and Subscription are types generated by the EF designer.

Thanks,
Adam

答:
Change your select part to sth like this </p>

```<code>   select new SubscriptionType{ ?,?,?,
                    Subscriptions = a.Subscription.OrderBy(b=>b.?)}
</code>```

Body:
I am having trouble figuring out how (and where) to order a subcollection in a LINQ/EF query.

Basically I have a collection of SubscriptionTypes, each having its own collection of Subscriptions. I would like each Subscription in the collection to be ordered by NumberOfMonths.

Here is my current query:

    public IQueryable<SubscriptionType> SubscriptionTypesByProperty(string propertyCode)
{
    return from a in db.SubscriptionTypes.Include("Subscriptions")
           where a.Subscriptions.Any(x => x.PropertyCode == propertyCode)
           select a;
}

I would like the Subscriptions to be ordered by NumberOfMonths. I tried this:

    public IQueryable<SubscriptionType> SubscriptionTypesByProperty(string propertyCode)
    {
        return from a in db.SubscriptionTypes.Include("Subscriptions")
               where a.Subscriptions.OrderBy(q => q.NumberOfMonths).Any(x => x.PropertyCode == propertyCode)
               select a;
    }

.. but that did not order the subscriptions correctly.

Does anybody know of an easy way to do this?

UPDATE: SubscriptionType and Subscription are types generated by the EF designer.

Thanks,
Adam

Body:
Change your select part to sth like this

   select new SubscriptionType{ ?,?,?,
                    Subscriptions = a.Subscription.OrderBy(b=>b.?)}