text:
Q: Loading Data in Increments of Ten Items Per Result Xamarin Forms I'm trying to build a request that will load 10 items at a time from the server for each request. For instance when a user clicks a button, redirecting them to the next page, I want the first 10 items to show first while the requests for the other items are being made in the background. How should I go about doing this? I have an idea of how it could work, on the server side by setting the max number returned and from a starting position on each request, but is this the right way of looking at it?

A: Yes, that sounds like a good way to handle it. This is often called "Pagination" of data.
Have your API handle an offset for which "page" of data you want to receive and a count of the max number of items to return for that page (pagesize). Here is an example of how you could implement this for Forms.
A contract for your ViewModel to implement:

public interface ISupportIncrementalLoading
{
    int PageSize { get; set; }

    bool HasMoreItems { get; set; }

    bool IsLoading { get; }

    Task LoadMoreItemsAsync();
}

An example implementation in a ViewModel:
#region ISupportIncrementalLoading Implementation

public int PageSize { get; set; } = 10;

public bool HasMoreItems { get; set; }

public async Task LoadMoreItemsAsync()
{
    await LoadMoreItemsCommand.ExecuteAsyncTask();
}

//...

#endregion

Example LoadMoreItemsCommand:
LoadMoreItemsCommand = new Command(async () =>
{
    int fetchOffset = Requests.Count;
    int fetchMax = PageSize;

    // "Pagination" of your API request starting at the offset
    // and getting a maximum of the `fetchMax` or "page size"
    Results = await GetRequestsAsync(fetchOffset, fetchMax);
});

To support this automatically in a control like a ListView you can customize a renderer or "effect" to do this. Here is a pruned example:
// Custom ListViewRenderer, iOS example
public class IncrementalListViewRenderer : ListViewRenderer
{
    public IncrementalListViewRenderer()
    {
    }

    protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
    {
        base.OnElementChanged(e);

        if (Control != null)
        {
            // Need to customize the source but not lose existing functionality so
            // we need a copy of it to use
            UITableViewSource defaultSource = Control.Source;
            Control.Source = new IncrementalDataSource(Element as IncrementalListView, defaultSource);
        }
    }

    class IncrementalDataSource : UITableViewSource
    {
        readonly UITableViewSource existingSource;
        readonly IncrementalListView listView;
        readonly ISupportIncrementalLoading incrementalLoading;

        int lastPosition;
        int preloadMargin = 5;

        public IncrementalDataSource(IncrementalListView listView, UITableViewSource existingSource)
        {
            this.listView = listView;
            this.existingSource = existingSource;

            incrementalLoading = listView.BindingContext as ISupportIncrementalLoading;

            lastPosition = 0;

            LoadMoreItems();
        }

        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            int position = indexPath.Row;
            var itemsSource = listView.ItemsSource as IList;

            if (itemsSource != null)
            {
                int preloadIndex = Math.Max(itemsSource.Count - preloadMargin, 0);

                if ((position > lastPosition || (position == itemsSource.Count - 1)) && (position >= preloadIndex))
                {
                    lastPosition = position;

                    if(!incrementalLoading.IsLoading && incrementalLoading.HasMoreItems)
                        LoadMoreItems();
                }
            }

            var cell = existingSource.GetCell(tableView, indexPath);
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            return cell;
        }

        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            existingSource.RowSelected(tableView, indexPath);
        }

        public override nint RowsInSection(UITableView tableview, nint section)
        {
            return existingSource.RowsInSection(tableview, section);
        }

        void LoadMoreItems()
        {
            // Note the use of Nito.AsyncEx lib
            INotifyTaskCompletion taskCompletion = NotifyTaskCompletion.Create(LoadMoreItemsAsync());
        }

        public async Task LoadMoreItemsAsync()
        {
            await incrementalLoading.LoadMoreItemsAsync();
        }
    }
}

This leverages the techniques from this plugin.


text:
Q: copy a file 10 times in jMeter In order to copy an xml-file for my jMeter-test I created this groovy-script within a loop-controller named LC
number = (vars.get("__jm__LC__idx") as int) + 1; // get the current iteration and add 1
target = vars.get("fileName") + number;
cp(vars.get("fileName"), target);

fileName is an env-variable passed to my test as C:/MyDir/Verkehr.xml.
However when executing that test I get the following error:

Response message:javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.cp() is applicable for argument types: (String, String) values: [C:/MyDir/Verkehr.xml, C:/MyDir/Verkehr.xml41]
Possible solutions: any(), grep(), dump(), get(java.lang.String), put(java.lang.String, java.lang.Object), is(java.lang.Object)

What I want is Verkehr.xml1 (actually Verkehr1.xml but that leads too far for this question).

A: I don't know what cp is, if it's some custom function make sure that the class providing this function is in JMeter Classpath
If you don't have this cp implementation - the easiest way would be going for FileUtils.copyFile() function like:
org.apache.commons.io.FileUtils.copyFile(new File(vars.get("fileName")), new File(vars.get("fileName") + number))

More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

redpajama_set_name: RedPajamaStackExchange


text:
Q: Sidney Coleman's argument that a hyperbolically accelerated electron radiates On page 35 of Sidney Coleman's Classical Electron Theory from a Modern Standpoint, he writes:

If we remember that in Maxwellian dynamics, the radiation field is
given by the difference of the advanced and retarded fields, it is
easy to see that the electron radiates.
The figure shows the world line of an electron undergoing hyperbolic
acceleration. The past light cone from the point P does not interact
with the electron worldline, so the retarded potential vanishes; the
future light cone intersects it once, so the advanced potential
doesn't. Thus there is a radiation field at P.

The retarded potential at P is undefined, so how is Coleman able to conclude that it vanishes?

A: Strictly speaking hyperbolic motion exists in infinite past, and thus there is no finite retarded time $t_r$ at $P$. We can stop now and say $t_r$ is meaningless. Or, we can assign it value $-\infty$.
Coleman is closer to the second option. Then retarded field is defined at $P$ and it is zero.
One rationale for this could be as follows. Infinite (in past) hyperbolic motion is (so far) an unrealizable unobserved extreme, obeying some rule for all times in the past. Real motion can approximate it in some finite time window $t_A,t_B$, before which ($t<t_A$) the motion is no longer hyperbolic. For this real motion, at point $P$, retarded time $t_r$ exists and is finite and if acceleration is not too high, retarded potential exists and is finite. If $t_A$ is sufficiently far in the past, then this retarded potential is very small and can be replaced by zero for practical purposes.


text:
Q: How to populate an xml tag conditionally in DataWeave? I want to iterate over this below tag:
      <pur:Schedule>
        <pur:StatusNumber>1</pur:StatusNumber>
        <pur:RequestDate>2023-02-22</pur:RequestDate>
        <pur:Action>CHANGE</pur:Action>
      </pur:Schedule>

I want to populate the above tag when the Mode is equal to CHANGE else if the Mode is equal to CANCEL skip the entire tag.
Input Payload
{"Order": {
    "Reason": "apple",
"Line": [
    {
"Quantity": 30,
"Date": "2023-02-22","Pricing": {
    "Amount": "11.34"},"Details": {
        "Number": "247"}},
         {
"Quantity": 12,
"Date": "2023-02-25","Pricing": {
    "Amount": "11.34"},"Details": {
        "Number": "247"}},
         {
"Quantity": 0,
"Date": "2023-02-21","Pricing": {
    "Amount": "11.34"},"Details": {
        "Number": "247"}}

        ]}}

Used Dataweave Script
%dw 2.0
output text/xml writeDeclaration=false
ns typ http://xmlns.oracle.com/apps/prc/po/editDocument/order/types/
ns pur http://xmlns.oracle.com/apps/prc/po/editDocument/order/
---
{typ#Product: {
    typ#Entry: {
        pur#OrderId: payload.Order.Line.Details.Number[0],
pur#OrderDescription: payload.Order.Reason,pur#EntryLine: payload.Order.Line map {
    pur#productNumber: $.Details.Line_Number,
pur#Qty: $.Ordered_Quantity,
pur#unit: $.Pricing.Amount ,
pur#status: if($.Quantity != 0) "Changed" else "",
pur#Mode: if($.Quantity == 0) "CANCEL" else "CHANGE",pur#Reason: if($.Quantity == 0) "Cancelled" else "",
(pur#Schedule: {
    pur#StatusNumber: "1",
    pur#RequestDate: $.Date,
    pur#Action: "CHANGE"})
    }}}}

Expected Output
<typ:Product xmlns:typ="http://xmlns.oracle.com/apps/prc/po/editDocument/order/types/">
  <typ:Entry>
    <pur:OrderId xmlns:pur="http://xmlns.oracle.com/apps/prc/po/editDocument/order/">247</pur:OrderId>
    <pur:OrderDescription xmlns:pur="http://xmlns.oracle.com/apps/prc/po/editDocument/order/">apple</pur:OrderDescription>
    <pur:EntryLine xmlns:pur="http://xmlns.oracle.com/apps/prc/po/editDocument/order/">
      <pur:productNumber/>
      <pur:Qty/>
      <pur:unit>11.34</pur:unit>
      <pur:status>Changed</pur:status>
      <pur:Mode>CHANGE</pur:Mode>
      <pur:Reason/>
      <pur:Schedule>
        <pur:StatusNumber>1</pur:StatusNumber>
        <pur:RequestDate>2023-02-22</pur:RequestDate>
        <pur:Action>CHANGE</pur:Action>
      </pur:Schedule>
    </pur:EntryLine>
    <pur:EntryLine xmlns:pur="http://xmlns.oracle.com/apps/prc/po/editDocument/order/">
      <pur:productNumber/>
      <pur:Qty/>
      <pur:unit>11.34</pur:unit>
      <pur:status>Changed</pur:status>
      <pur:Mode>CHANGE</pur:Mode>
      <pur:Reason/>
      <pur:Schedule>
        <pur:StatusNumber>1</pur:StatusNumber>
        <pur:RequestDate>2023-02-25</pur:RequestDate>
        <pur:Action>CHANGE</pur:Action>
      </pur:Schedule>
    </pur:EntryLine>
    <pur:EntryLine xmlns:pur="http://xmlns.oracle.com/apps/prc/po/editDocument/order/">
      <pur:productNumber/>
      <pur:Qty/>
      <pur:unit>11.34</pur:unit>
      <pur:status/>
      <pur:Mode>CANCEL</pur:Mode>
      <pur:Reason>Cancelled</pur:Reason>
    </pur:EntryLine>
  </typ:Entry>
</typ:Product>

A: You can add a conditional to the section of the script that generates that key. Note that the output of the script can not be used as part of the script. Avoid that way of expressing the problem. Instead think on terms of how the input generates the output. I reused the condition that generates the element Mode.
        (
          pur#Schedule: {
            pur#StatusNumber: "1",
            pur#RequestDate: $.Date,
            pur#Action: "CHANGE"
          }
        ) if ($.Quantity != 0)


text:
Q: How to create array of Panes in JavaFX(or how to control multiple similar panes) I have a Pane that includes label1, label2, label3 and a icon(pane with image). I duplicated that Pane and now i have 10 Pane 5 at left 5 at right and i named every item different for Pane(like left1label1,left2label1,right2label3)but i don't want to use different method for every single Pane.
I tried to create an array of panes but couldn't figure it out. All i want is easy way to manage this Panes. How should i do it?
public void leftPane1Config()
{

    leftPane1Label1.setText("Object");

    leftPane1Label2.setText("HP:"+ hp);
    leftPane1Label3.setText("EXP:"+ exp);

    Image img= new Image("directory");
    leftPane1Icon.setEffect(new ImageInput(img));
}

public void leftPane2Config()
{

    leftPane2Label1.setText("Object");

    leftPane2Label2.setText("HP:"+ hp);
    leftPane2Label3.setText("EXP:"+ exp);

    Image img= new Image("directory");
    leftPane2Icon.setEffect(new ImageInput(img));
}

.
.And 8 other
.

I have tried to use something like this (trying to create an hierarchy but i couldn't make it :') ) but i couldn't use setText() so it didn't work.
leftPane1.getChildren().add(leftPane1Label1);
leftPane1.getChildren().get(0).setText??

Then i tried to use something like this
Pane[] leftPane= new Pane[5];
leftPane[0]= new Pane();

and again i couldn't figure it out.

A: It's not really clear what you're asking. Typically you would just write a method to create the panes and parameterize the parts the vary, in the usual way you do in any kind of programming.
public Pane createPane(String text1, String text2, String text3, URL image) {
    Image img = new Image(image.toExternalForm());
    // whatever layout you need here
    VBox pane = new VBox(
        new Label(text1),
        new Label(text2),
        new Label(text3),
        new ImageView(img)
    );
    // any other stuff you need to do
    return pane ;
}

And then of course you just call createPane() with the values you need and add the result to your scene graph however you need.


text:
Q: matrix multiplication by column vectors If $A$ is an $n \times n$ matrix, and $x$ and $y$ are column vectors in $R^n,$ show that $(A x)\cdot y=x \cdot (A^t y),$ and then that $(A x) \cdot (A y)= x(A^t A y).$ I tried to take $2 \times 2$ or $3 \times 3$ matrices and it worked but i did not know how to generalize it. thank you

A: hint. here are things you need to know:
(a) $x \cdot y = x^Ty = y^Tx,$
(b) $(Ax)^T = x^TA^T$
(c) $A(BC) = (AB)C$
i will do the first one. $Ax \cdot y = (Ax)^Ty = x^TA^Ty = x.A^Ty$
can you see how to do the second one?

A: Here's a bruteforce way:
Let $A\in\Bbb R^{n\times n}$ and $x,y \in \Bbb R^n$, then we have
$$(Ax)\cdot y = \sum_{i=1}^n (Ax)_iy_i= \sum_{i=1}^n \left( \sum_{j=1}^n A_{i,j}x_j\right)y_i = \sum_{i=1}^n \sum_{j=1}^n A_{i,j}x_jy_i= \sum_{j=1}^n \sum_{i=1}^n A_{i,j}y_ix_j = \sum_{j=1}^n \sum_{i=1}^n A^T_{j,i}y_ix_j = \sum_{j=1}^n \left(\sum_{i=1}^n A^T_{j,i}y_i\right)x_j = \sum_{j=1}^n (A^Ty)_jx_j = (A^Ty)\cdot x $$
Applying this for $(Ax)\cdot z$ with $z = Ay$ we get
$$(Ax)\cdot z = x \cdot A^Tz = x\cdot A^T(Ay)=x\cdot (A^TAy).$$


text:
Q: AngularJS: Cookies disappear when I route to other page I created a feature like a shopping cart using AngularS, when I route to Items page and add new items it works perfectly, I use cookies to persist these items temporarily, but with the items in the cart if I route to another page that is not the same as the one I used to add to the cart the cart cookie variable disappears, and because I initialize the cart cookie to an empty array if it does not exist the count of my cart items become zero. Below are the codes I used.
Cart.js: Bootstraps the Cart application
var app = angular.module('cartApp', ['Resly.CartRepositories', 'Resly.CartControllers']);

 app.run(function($rootScope, $cookieStore){
     $rootScope.cart =  $cookieStore.get('cart') || [];
 });

CartControllers.js: Handles user actions/interactions from the view
var cartControllers = angular.module('Resly.CartControllers', ['ngCookies']);

cartControllers.controller('CartController', function($rootScope, $http ){
    this.addTable = function(tableID){
        var callbackHandler = RestaurantRepository.getTableByID(tableID);
        callbackHandler.then(function successFul(response){
            $rootScope.cart = response.data;
            $cookieStore.put('cart', $rootScope.cart);
            // console.log($cookieStore.get('cart'));

        }, function failure(){
            // console.log('error');
        });
    };
});

CartRepository.js: Handles making API calls to backend
var RestaurantRepositories = angular.module('Resly.CartRepositories', []);
RestaurantRepositories.service('RestaurantRepository', function($http){
    var restaurant = this;
    restaurant.getTableByID = function(tableID){
        return $http.get('/tables/'+tableID+'/get.json');
    };
    return restaurant;
});

On the view I have a button
<body ng-app='cartApp'>
    <div ng-controller='CartController as cartCtrl'>
       <button ng-click='cartCtrl.addTable(13)'>Add to Cart</button>
    </div>
</body>

Please I need help figuring why the data keeps disappearing.

A: You have to add the variable $cookieStore in your controller and your service, like this:
cartControllers.controller('CartController', function($rootScope, $http,RestaurantRepository,$cookieStore ){
...
});
With your example you are not adding the variable to the cookies, then when you change the view continue getting your empty cart from the cookies.


text:
Q: Not sure why my function is is causing a compiler error when all components have been defined I am making a linked list, and my function to insert something at the front of my list is causing a compiler error I am not sure why because all of the variables I am using in my function are defined.
For context, the following code is to sort an input such as
4
plates 100
spoons 200
cups 150
forks 200

InventoryNode.h
#include <iostream>
#include <string>
using namespace std;

class InventoryNode {
private:
    string item;
    int numberOfItems;
    InventoryNode *nextNodeRef;
    string next;

public:
    //Constructor
    InventoryNode() {
        this->item = "";
        this->numberOfItems = 0;
        this->nextNodeRef = NULL;
    }

    //Constructor
    InventoryNode(string itemInit, int numberOfItemsInit) {
        this->item = itemInit;
        this->numberOfItems = numberOfItemsInit;
        this->nextNodeRef = NULL;
    }

    //Constructor
    InventoryNode(string itemInit, int numberOfItemsInit, InventoryNode nextLoc) {
        this->item = itemInit;
        this->numberOfItems = numberOfItemsInit;
        this->nextNodeRef = &nextLoc;
    }

    void InsertAtFront(InventoryNode* head, InventoryNode* currNode) {
          currNode->head;
          head = currNode;
    }

    //Get the next node
    InventoryNode *GetNext() {
        return this->nextNodeRef;
    }

    //Print node data
    void PrintNodeData() {
        cout << this->numberOfItems << " " << this->item << endl;
    }
};

Main.cpp
#include "InventoryNode.h"

int main() {
    int count;
    int numItems;
    string item;

    InventoryNode *headNode = new InventoryNode();
    InventoryNode *currNode;

    // Obtain number of items
    cin >> count;

    // Get each item and number of each
    for (int i = 0; i < count; i++) {
        cin >> item;
        cin >> numItems;
        currNode = new InventoryNode(item, numItems);
        currNode->InsertAtFront(headNode, currNode);
    }

    // Print linked list
    currNode = headNode->GetNext();
    while (currNode != NULL) {
        currNode->PrintNodeData();
        currNode = currNode->GetNext();
    }

    return 0;
}

Thank you so much for any help :)

A:
currNode->head;

Code you provided has no head field.


text:
Q: I have a series of data, and with the data i want to add two rows to go with each row of data that i already have I am currently using pandas to go through the data, I haven't been able to find any code that adds a row to previous data.
My current code:
import os
import tkinter as tk
from tkinter import filedialog
import pandas as pd
import xlrd
import openpyxl
from openpyxl import load_workbook
import datetime
from dataclasses import dataclass
from openpyxl.styles import Font,Color,Alignment,Border,Side,colors
import numpy as np
from xlsxwriter.utility import xl_rowcol_to_cell
import xlwt
from xlwt import Workbook

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 300, bg = 'lightsteelblue')
canvas1.pack()

def getExcel():
    global df

    import_file_path = filedialog.askopenfilename()
    df = pd.read_excel (import_file_path)
    del df['PART CODE']
    del df['SUPPLIER CODE']
    del df['COMPANY OR SUB-CONT']
    del df['SUB-CONT UNIT COST']
    del df['HLR']
    del df['HOURLY MULTIPLIER']
    del df['MATERIAL MULTIPLIER']
    del df ['ROUGH-IN HOURS']
    del df['FINISH HOURS']
    del df['PRELIMINARY TEXT']
    del df['FORMAL TEXT']
    del df['SUBCONT TEXT']
    del df['Part Image Path']
    df.insert(0,'Id','')

    pd.set_option('display.max_rows', df.shape[0]+1)

browseButton_Excel = tk.Button(text='Select Excel File', command=getExcel, bg='green', fg='white', font=('helvetica', 12, 'bold'))
canvas1.create_window(150, 150, window=browseButton_Excel)

root.mainloop()

The data that I currently have comes out as
row1  1  1  1
row2  2  2  2
row3  3  3  3
I want to have the output be
row1  1  1  1
row2
row3
row4  2  2  2
row5
row6
row7  3  3  3
row8
row9
In that new output I added two rows that I could put new data when I am done with my code. Any thoughts?


text:
Q: What is this "Comprehensive LaTeX Artifact Novelty" thing? Today, looking for a package on the CTAN, this window popped up:

Is this for real? Or is it something else?

A: This is not an answer, but I just want to reveal something really, really amusing from this April Fools joke: the text refers to the acquisition of TeX by a company located at Shanghai, China. Now, the symbol portrayed in the right side of the message,

is, not surprisingly, a Chinese symbol for insanity. Clever, isn't it? :)


text:
Q: How to get the exact used RAM percentage in Grafana? AM using collectd to collect the metrics from the system, am using Influxdb as a database to collectd the metrics and Grafana for visualization.
I need only the used RAM memory in percentage to display in grafana....
I need only the used memory value to show up in grafana exclusing the cached and buffered.
As of now i query grafana like
 SELECT mean("value") *-1+100 FROM "memory_value" WHERE ("host" =~ /^$host$/ AND "type" = 'percent' AND "type_instance" = 'free') AND $timeFilter GROUP BY time($__interval),"host"

Which gives the wrong value..
Can anyone pls help me how to display the used RAM percentage


text:
Q: Range.Find() fails I have a requirement which goes like this:

*

*I have two Excel files with data from Columns A to Q

*I iterate through each row in each sheet of one Excel, get the values in column A, and find them in the other Excel for the corresponding sheet.

*If there is a match, I check the values in Column A, G and J match in both Excel. If they don't match they are logged in a Log File (Excel with matrix type representation of where the mismatch is). (Yet to be Implemented)

*If there is no match, I have to log them again. (Yet to be Implemented)

The Code is:
For Each workSheet1 In MainWorkBook.Worksheets
Set MainWorksheet = workSheet1
Set SecondaryWorksheet = workSheet1
MainWorksheet.Activate
Cells.Select
Selection.EntireColumn.Hidden = False
Selection.EntireRow.Hidden = False
rowcount = MainWorksheet.Cells(Rows.count, 1).End(xlUp).Row
For i = 3 To rowcount
    MainCheckName = Trim(MainWorksheet.Cells(i, "A"))
    If (PreviousCheck <> MainCheckName And MainCheckName <> "") Then
        SecondaryWorksheet.Activate
        rowcount = SecondaryWorksheet.Cells(Rows.count, 1).End(xlUp).Row
        SecondaryWorksheet.Range(SecondaryWorksheet.Cells(1, "A"), SecondaryWorksheet.Cells(rowcount, "A")).Select
        Set SecondaryCheckName = Selection.Find(what:=MainCheckName, LookAt:=xlWhole)
        If Not SecondaryCheckName Is Nothing Then
            CheckRow = Selection.Find(what:=MainCheckName, LookAt:=xlWhole).Row
                <further process here>

Next Next

Now, I have a problem with this line:
Set SecondaryCheckName = Selection.Find(what:=MainCheckName, LookAt:=xlWhole)

After processing this activity for some ten sheets, though I have the contents which match in both the worksheets of different workbooks, I get Nothing returned for the Find function.
What is wrong and why is the condition failing here?

A: You have not included the declarations for SecondaryCheckName, but every indication is that it is a string not a Range type variable. You should not Set it to the Range object returned by the Range.Find method; it should be simply assigned to the .Find result's value. Alternately, declare it as a Range type variable so you can Set it to a Range Object for future use.
SecondaryCheckName = Selection.Find(what:=MainCheckName, LookAt:=xlWhole).Value2

That;s the answer to why you are receiving the error. However, I don't think this is the best way of accomplishing your goal. There is a decided lack of error control and you should reduce if not completely avoid the use of .SelectandSelection`.


text:
Q: Have I calculated the Newtonmeter ($Nm$) of torque for my corded drill correctly? The corded drill is rated at:
450watts at 3000rpm
the calculation I have used is:
$$\frac{450}{3000} \times 2 \times \frac{3.14}{60}=0.0157 $$
I feel I have made a basic error somewhere (as the figure is very low) but dont immediately see it.

A: $$P(kW)=\frac{\omega(rpm)\times T(Nm)}{60/2\pi \times 1000}$$
So it comes out to be $T=1.43Nm$ if I am not wrong.


text:
Q: Неправильно отображаются юникод-символы в полях типа VARCHAR С помощью LOAD DATA LOCAL INFILE загрузил в БД список русских слов. Загружал из файла с кодировкой utf8. Теперь русские слова почему-то неправильно отображаются неправильно:

Аналогичная ситуация и в консоли при попытке сделать SELECT * FROM.
Пробовал решить с помощью:
SET NAMES 'utf8';
SET collation_connection='utf8_general_ci;
SET collation_server='utf8_general_ci';
SET character_set_client='utf8';
SET character_set_connection='utf8';
SET character_set_results='utf8';
SET character_set_server='utf8';

A: Собсвенно, пока писал вопрос - нашел ответ. При использовании LOAD DATA нужно указать CHARACTER SET - utf8. Общий синтаксис:
LOAD DATA INFILE 'file'
IGNORE INTO TABLE table
CHARACTER SET UTF8
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'

И в моём случае:
LOAD DATA LOCAL INFILE '/1.txt'
CHARACTER SET UTF8
INTO TABLE words;


text:
Q: Active Admin has_many through table not rendering in form - have tried everything Using Rails 3.2 and having a lot of trouble with Active Admin's has_many :through. The goal is to pull in the has_many :through subcategories through the contents model and create checkboxes for all of the subcategories. I've read the Active Admin documentation, searched other articles on stack, github, etc. Nothing is working. My only guess there could be something with the "form :html => { :enctype => "multipart/form-data" } do |f|" tag, which I need for PaperClip.
*I've tried using accepts_nested_attributes and it doesn't work...
There is a has_many :through table for subcategories and contents.
Here is what it looks likes in the database:
create_table "contents", :force => true do |t|
  t.string   "title"
  t.text     "short_description"
  t.text     "long_description"
  t.datetime "published_date"
  t.datetime "edited_date"
  t.string   "read_length_time"
  t.string   "tag"
  t.integer  "author_id"
  t.integer  "contenttype_id"
  t.string   "collection"
  t.integer  "collection_id"
  t.string   "subcategory"
  t.integer  "subcategory_id"
  t.boolean  "published"
  t.datetime "created_at",               :null => false
  t.datetime "updated_at",               :null => false
  t.string   "image_file_name"
  t.string   "image_content_type"
  t.integer  "image_file_size"
  t.datetime "image_updated_at"
  t.string   "infographic_file_name"
  t.string   "infographic_content_type"
  t.integer  "infographic_file_size"
  t.datetime "infographic_updated_at"
  t.string   "video"
end

create_table "subcategories", :force => true do |t|
  t.string   "title"
  t.integer  "category_id"
  t.string   "content"
  t.integer  "content_id"
  t.datetime "created_at",  :null => false
  t.datetime "updated_at",  :null => false
end

create_table "subcats_contents", :id => false, :force => true do |t|
  t.integer "subcategory_id"
  t.integer "content_id"
end

add_index "subcats_contents", ["content_id"], :name => "index_subcats_contents_on_content_id"
add_index "subcats_contents", ["subcategory_id", "content_id"], :name => "index_subcats_contents_on_subcategory_id_and_content_id"
add_index "subcats_contents", ["subcategory_id"], :name => "index_subcats_contents_on_subcategory_id"

Here are the models:
class Content < ActiveRecord::Base
  attr_accessible :author,
                  :edited_date,
                  :image,
                  :long_description,
                  :published_date,
                  :read_length_time,
                  :short_description,
                  :tag,
                  :title,
                  :type,
                  :collection_id,
                  :collection,
                  :collections_content,
                  :image,
                  :author_id,
                  :contenttype_id,
                  :subcategory,
                  :image_file_name,
                  :image_content_type,
                  :image_file_size,
                  :image_updated_at,
                  :subcats_contents,
                  :published,
                  :infographic_file_name,
                  :infographic_content_type,
                  :infographic_file_size,
                  :infographic_updated_at,
                  :infographic,
                  :video

  has_many :collections_contents
  has_many :collections, :through => :collections_contents

  has_many :subcats_contents
  has_many :subcategories, :through => :subcats_contents

  belongs_to :author
  belongs_to :contenttype

  validates_presence_of :title
  validates_presence_of :author_id
  validates_presence_of :published_date
  validates_presence_of :read_length_time
  validates_presence_of :contenttype
  validates_presence_of :tag
  validates :published, inclusion: [true, false]

  has_attached_file :image, :styles => { :medium => "500x800>", :thumb =>"500x500>" }
  has_attached_file :infographic, :styles => { :medium => "1000x1000>", :thumb =>"300x300>" }

  scope :published, where(:published => true )
  scope :unpublished, where(:published => false )

end

class Subcategory < ActiveRecord::Base
  attr_accessible :category,
                  :category_id,
                  :content,
                  :content_id,
                  :title,
                  :subcats_contents

  has_many :subcats_contents
  has_many :contents, :through => :subcats_contents

  belongs_to :category

end

class SubcatsContent < ActiveRecord::Base
  attr_accessible :subcategory,
                  :content

  belongs_to :subcategory
  belongs_to :content

end

Then in my active admin form I've tried everything... here is the current state:
ActiveAdmin.register Content do
  scope :all, :default => true
  scope :published
  scope :unpublished

  filter :author
  filter :contenttype, :label => "Content Type"
  filter :title
  filter :short_description, :label => "Summary"
  filter :long_description, :label => "Content Body"
  filter :published_date
  filter :tag, :label => "Tags"
  filter :subcategory, :label => "Subcategories"
  filter :image_file_name

  index do
    column :published
    column :title
    column :author
    column :published_date
    column :short_description, :label => "Summary"
    column :long_description, :label => "Content Body"
    column :image_file_name, :label => "Image"
    column :tag
    actions
  end

  form :html => { :enctype => "multipart/form-data" } do |f|
     f.inputs "Contents" do
      f.input :published, :as => :select
      f.input :title
      f.input :short_description, :label => "Summary"
      f.input :long_description, :label => "Content Body"
      f.input :read_length_time, :label => "Estimated Read Length Time"
      f.input :author
      f.input :contenttype, :label => "Type of Content"
      f.input :image, :as => :file
      f.input :infographic, :as => :file
      f.input :video, :label => "Video * Please add the embed code (not just the URL)"
      f.input :tag, :label => "Tags"
      f.input :published_date
      f.input :subcategory, :as => :select, :input_html => { :multiple => true }
    end

    f.has_many :subcatscontents do |app_f|
      app_f.inputs "Subcats Contents" do
      app_f.input :subcategories
     end
    end

  f.buttons
 end
end

Here is the error I get in Active Admin when I go to create a new content:
undefined method `klass' for nil:NilClass
Thanks for any help and I apologize in advance if something isn't semantically up to par - new to this site.

A: The latter answer makes them appear but not save to the database. The solution is as follows:
app/admin/contents.rb - underneath the form loop
filter :subcategories, :label => "Subcategories"

app/models/content.rb
    attr_accessible :subcategory_ids
has_many :subcats
has_many :subcategories, through: :subcats

app/models/subcategory.rb
    has_many :subcats
    has_many :contents, :through => :subcats
Subcats migration
class CreateSubcats < ActiveRecord::Migration
  def up
    create_table :subcats, :id => false do |t|
      t.belongs_to :subcategory
      t.belongs_to :content
      t.timestamps
    end

    add_index :subcats, [:subcategory_id, :content_id]
  end
end

Contents migration
class CreateContents < ActiveRecord::Migration
  def change
    create_table :contents do |t|
      t.string :title
      t.text :short_description
      t.text :long_description
      t.datetime :published_date
      t.datetime :edited_date
      t.string :read_length_time
      t.string :tag
      t.references :author
      t.references :contenttype
      t.string :collection
      t.integer :collection_id
      t.boolean :published

      t.timestamps
    end
  end
end

Subcategory migration
class CreateSubcategories < ActiveRecord::Migration
  def change
    create_table :subcategories do |t|
      t.string :title
      t.references :category
      t.integer :category_id

      t.timestamps
    end
  end
end

It works!

A: I added this to my ActiveAdmin.register Content do page
f.input :subcategory, :as => :check_boxes, :collection => Subcategory.all

Now all of the subcategories are showing in Active Admin page as check boxes. However, if anyone has advice as to how to make them appear as the subcategories names vs. ids, please let me know.
Thank Fivell for the lead!


text:
Q: Why does this imply that $S_n$ is a Cauchy sequence? I have already proven that $S_n(x) :=\sum_{k=1}^n \frac{x^k}{k!}$ is convergent for all real $x>0$. For this I used the Monotone Convergence Theorem. Clearly this implies that $S_n(|x|)$ is convergent for all $x\in\mathbb{R}$.
Now I wish to prove that the sequence $(S_n(x))_{n\in\mathbb{N}}$ is a Cauchy sequence for all $x\in\mathbb{R}$. I have arrived at the following inequality (assuming WLOG $m>n$):
$$|S_m(x) - S_n(x)|\leq|S_m(|x|) - S_n(|x|)|.$$
The lecture notes say that this implies that $(S_n(x))_{n\in\mathbb{N}}$ is a Cauchy sequence. I cannot quite see why this is the case, because I can't see how it implies there exists an $N$ such that with $m,n>N$, we have $|S_m(|x|) - S_n(|x|)|<\epsilon$. Pointers in the right direction would be appreciated.
Edit: To clarify, I have not yet shown that $S_n(x)$ is convergent for all $x$, only $x>0$. The lecture notes show that $S_n(x)$ is convergent for all $x$, by showing that $S_n(x)$ is Cauchy, and uses an already proven result that $S_n(|x|)$ is convergent to do this. I am asking for help in understanding how to show $S_n$ is Cauchy, in particular using this scheme.

A: You already know that $S_n(\lvert x\rvert)$ converges for all $x\in\mathbb R$. Therefore, it is a Cauchy sequence especially.


text:
Q: Is it okay to have duplicates in a array? I'm working on my self project. A project that you will let you input the day and then the program gives you the day of given date.
Here's my array:
String []days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday", "Sunday", "Monday"};

My condition:
if(inputDate <= 6){
                  firstCase = yearsCode[0] + inputDate + 3 - 7;
                  System.out.println("January " + inputDate + " is " + days[firstCase]);}

I put the day Sunday and Monday again because if my input date is 5<7 it gives me the ArrayOutOfBoundsException.
I got the algorithm here #6:

A: Yes it's OK to have duplication in an array but you might find a better way to do this.

A: I read the contents of link. Here is the solution.
Remove both Sunday and monday from last. You should only subtract with multiples of 7( do mod)  if the result is more than 6.
So your code should be
  firstCase = (yearsCode[0] + inputDate + 3)%7;
  System.out.println("January " + inputDate + " is " + days[firstCase]);

A: Arrays don't care what you put in them, you can have several copies of an object in your array if you so desire.
However, to solve your problem more elegantly, you can ensure that the index you calculate never exceeds the number of elements in your array. For this, you can use the modulo operator %

   firstCase = yearsCode[0] + inputDate + 3 - 7;
   firstCase = firstCase % 7;

A: Is it OK to have duplicate values in an array?
new String[]{"yes", "yes", "and", "absolutely", "yes"};


text:
Q: how force a Ruby Sintra app to redirect http to https I have a classic Sinatra app which at some point just stopped redirecting http requests to https. (I'm not sure when it stopped automatically redirecting, perhaps in the last year or so when I upgraded some things including the Sinatra gem to v 2.2)
The Gemfile.lock has:
rack-ssl (1.4.1)

The app initialization contains:
require 'rack/ssl'
use Rack::SSL

None of that has changed in my code.
But currently, if I navigate to http://www.myapp.com it stays on http, instead of redirecting to https like it used to.
I've also tried adding
set :force_ssl, true

But that had no effect.


text: Q: Link Axelor Calendar with my work Calendar I want to link my Axelor Calendar with my work calendar and It doesn't work. I know ho to link Axelor's calendar with google but I want to link it with my work calendar not google.


text:
Q: Semantic HTML: where to place my form buttons? Consider the next form:
<form>

Form

    <fieldset>
        <legend>Simple list with Create/Delete</legend>

        [...]

            <button>Add</button>
            <button>Remove</button>
            <button>Remove all</button>

    </fieldset>

    <fieldset>
        <legend>Single input</legend>

        <input type="file" />

            <button>Save as PDF</button>
            <button>Save as XLS</button>
            <button>Save as SVG</button>

    </fieldset>

    <fieldset>
        <legend>Dynamic wizard</legend>

        [...]

            <button>Next</button>

    </fieldset>

    [...]

        <button>Reset</button>
        <button>Cancel</button>
        <button>Save</button>

</form>

I feel comfortable with the idea of using  inside a <form> or a <fieldset>, but im not sure if it's correct, it looks a bit saturated with footers
I could use
 instead of  but it feels "semantically poor", and <menu> feels awkward when using a single button.
Maybe the solution is to place them directly under <form> or <fieldset>.
<form>

Form

    [...]

    <button>Reset</button>
    <button>Cancel</button>
    <button>Save</button>
</form>

¿What do you guys recommend?

A: You can place your form fields and buttons in separate section blocks.
<form>

        <fieldset>
            <legend>Simple list with Create/Delete</legend>
            ...
        </fieldset>

        <fieldset>
            <legend>Single input</legend>
            ...
        </fieldset>

        <button type="button">Reset</button>
        <button type="button">Cancel</button>
        <button type="submit">Save</button>

</form>


text:
Q: Disproportionate vs. disproportional Which is correct in which contexts?
"My head is disproportional to my body."
"My head is disproportionate to my body."
"My head is disproportional."
"My head is disproportionate."
I have the same question for "proportional/proportionate".

A: Google comes up with 24K results for disproportional vs disproportionate.  Quite a battle seems to have been waged on at Berkeley four years ago (see Sources below).
Both words seem to have been in use from the 14th century.  Despite the subtle differences in meaning, both seem to have been used quite interchangeably.
Based on the sources given below and based on the the three dictionaries that I just went through, it is safe to conclude as follows (at least in American English):

*

*Disproportionate is accepted more than disproportional

*Proportional is accepted more than proportionate

Cambridge Dictionary lists the following meanings:

Disproportionate (UK): too large or too small in comparison to something else , or not deserving its importance or influence

*

*There are a disproportionate number of girls in the class.

*The country's great influence in the world is disproportionate to its relatively small size.

  Disproportionate (US): too great or too small when compared to something else
   - The sheer size of the company gave it disproportionate influence in dealing with the Pentagon and Congress.
   - disproportionately: adverb: Unemployment in Iowa is disproportionately high.
Proportional (UK): If two amounts are proportional, they change at the same rate so that the relationship between them does not change
Proportional (US): in correct relation to
   - The degree of punishment is meant to be proportional to the seriousness of the crime . Weight is proportional to size

Cambridge (online) dictionary does not have entries for disproportional and proportionate.
Sources (other than Dictionaries):

*

*Origin and differences of proportionate and proportional, and the meanings and popularity of disproportionate vs disproportional, are summarized at http://www.grammarphobia.com/blog/2013/08/the-right-proportions.html

*A simple comparison of proportional and proportionate at http://grammarist.com/usage/proportional-proportionate/

*A fairly heated battle on the topic at http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_easy;action=print;num=1282009365

*More votes for disproportionate: https://answers.yahoo.com/question/index?qid=20130720150845AA3CiJJ
PS: Feel free to share your take and vote either way.  If you down-vote, I request that you provide the rationale for it, along with credible sources, for the benefit of the ELU community.

A: The only difference is that "disproportional" is non-standard, meaning that it's not considered standard English (at least not standard American English). This really only matters when you are speaking or writing formally.
Standard English is defined by what the majority of educated speakers consider proper. So use 'disproportional' sparingly if you're concerned what others think of you. If you're not concerned with that, it doesn't matter. People will still undertand you.
It should be that something is disproportionate.
When used as an adverb, it can be spelled disproportionately OR disproportionally. Both are standard.
Please note that there are many non-standard words listed in descriptive dictionaries. Don't believe me? Look up irregardless. Irregardles is found in most English dictionaries, but 90% of English speakers (including me) would tell you that it's not a word, however.
You can see from the links below that 'disproportional' is not found in the Mirriam-Webster Dictionary, not even under disproportion.
http://www.merriam-webster.com/dictionary/disproportion
http://www.merriam-webster.com/dictionary/disproportion?ref=dictionary&word=disproportionate


text:
Q: Placing Wordpress plugin name at the top of the amdin header I have a Wordpress plugin which I've named 'Solve Maths'. I want this plugin name to be displayed only at the Admin header of the Arthur alone for easy access.
I used the admin_head action hook but once I installed the plugin, the system tells me my plugin has generated these number of characters at the header.
<?php function Solve_Maths{ echo  "Solve Maths";} add_action('admin_head','Solve_Maths');?>

The Solve_Maths.php is the name of the main plugin file with the header information. I want this file name in the  tag to be shown at the admin header of the user and should execute the file when the link is linked. Thank you all for your help.

A: This is not the correct way to do it. Please check the WordPress Codex and refer to the function add_node: https://codex.wordpress.org/Function_Reference/add_node
add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );
function toolbar_link_to_mypage( $wp_admin_bar ) {
    $args = array(
        'id'    => 'my_page',
        'title' => 'My Page',
        'href'  => 'http://example.com/my-page/',
        'meta'  => array( 'class' => 'my-toolbar-page' )
    );
    $wp_admin_bar->add_node( $args );
}


text:
Q: Linking errors when compiling c with c++ I'm new to programming, and am having problems with a sample c code for to interface a synclink adapter using serial API.
I am trying to compile a C source file with C++ compiler (Visual Studio C++ 2010). I've changed the settings for the C++ compiler to compile the project as C (under project property pages -> C/C++ -> advanced), and included the additional directory mghdlc.h and link mghdlc.lib (under linker -> additional library directories). The code is as follows:
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <windows.h>
#include <errno.h>

#include <mghdlc.h>

int get_port_id(char *name)
{
unsigned long i, rc, count;
int port_id = 0;
PMGSL_PORT ports;

/* get count of available ports */
rc = MgslEnumeratePorts(NULL, 0, &count);
if (rc != NO_ERROR) {
    printf("MgslEnumeratePorts() error=%d\n", rc);
    return 0;
}

if (!count)
    return 0;

/* allocate memory to hold port information */
ports = malloc(count * sizeof(MGSL_PORT));
if (ports == NULL) {
    printf("memory allocation failed\n");
    return 0;
}

/* get port information */
rc = MgslEnumeratePorts(ports, count * sizeof(MGSL_PORT), &count);
if (rc != NO_ERROR) {
    printf("MgslEnumeratePorts() error=%d\n", rc);
    goto done;
}

/* search for entry with matching name */
for (i=0; i < count; i++) {
    if (!_stricmp(ports[i].DeviceName, name)) {
        port_id = ports[i].PortID;
        break;
    }
}

done:
free(ports);
return port_id;
}

int stop_program = 0;

void sigint_handler(int sigid)
{
stop_program = 1;
}

int main(int argc, char **argv)
{
int port_id;
HANDLE fd;
FILE *fp;
DWORD rc;
int databuf_size;
int count;
int written;
OVERLAPPED ol;
MGSL_RECEIVE_REQUEST *rx_req;
MGSL_PARAMS params;

if (argc < 2) {
    printf("\nYou must specify device name as argument.\n"
           "Examples:\n"
           "C:>receive-raw MGMP4P2  (adapter #4 port #2 of multiport adapter)\n"
           "C:>receive-raw MGHDLC1  (single port adapter adapter #1)\n"
           "Available device names can be viewed in the SyncLink branch\n"
           "of the Windows device manager.\n\n");
    return 1;
}

printf("receive raw data on %s\n", argv[1]);

/* convert device name to port ID */
port_id = get_port_id(argv[1]);
if (port_id == 0) {
    printf("No such port %s\n", argv[1]);
    return 1;
}

/* open device */
rc = MgslOpen(port_id, &fd);
if (rc != NO_ERROR) {
    printf("MgslOpen error=%d\n", rc);
    return rc;
}

/* open file to store received data */
fp = fopen("data", "wb");
if (fp == NULL) {
    printf("fopen error=%d %s\n", errno, strerror(errno));
    return errno;
}

//#define SET_BASE_CLOCK 1
#ifdef SET_BASE_CLOCK
/*
 * Set base clock frequency if custom hardware base clock installed.
 *
 * Use only if a base clock different than the standard 14745600
 * is installed at the factory. The driver uses this value to
 * calculate data clock rates which are derived from the base clock.
 */
rc = MgslSetOption(fd, MGSL_OPT_CLOCK_BASE_FREQ, 25000000);
if (rc != NO_ERROR)
    printf("MgslSetOption(MGSL_OPT_CLOCK_BASE_FREQ) error=%d\n", rc);
#endif

/* get current device parameters */
rc = MgslGetParams(fd, &params);
if (rc != NO_ERROR) {
    printf("MgslGetParams() error=%d\n", rc);
    return rc;
}

/*
 * configure port for raw synchronous mode
 * loopback disabled
 * receiver clock source = RxC clock input
 * transmit clock source = TxC clock input
 * encoding = NRZ
 * output clock on AUXCLK output at 19200 bps
 * disable ITU/CCITT CRC-16 frame checking (not supported in raw mode)
 */
params.Mode = MGSL_MODE_RAW;
params.Loopback = 0;
params.Flags = HDLC_FLAG_RXC_RXCPIN + HDLC_FLAG_TXC_TXCPIN;
params.Encoding = HDLC_ENCODING_NRZ;
params.ClockSpeed = 19200;
params.CrcType = HDLC_CRC_NONE;

/* set current device parameters */
rc = MgslSetParams(fd, &params);
if (rc != NO_ERROR) {
    printf("MgslSetParams() error=%d\n", rc);
    return rc;
}

/* set transmit idle pattern */
rc = MgslSetIdleMode(fd, HDLC_TXIDLE_ONES);
if (rc != NO_ERROR)
    printf("MgslSetIdleMode() error=%d", rc);

printf("Turn on RTS and DTR serial outputs\n");
rc = MgslSetSerialSignals(fd, SerialSignal_RTS + SerialSignal_DTR);
if (rc != NO_ERROR)
    printf("assert DTR/RTS error=%d\n", rc);

/* MgslReceive requires OVERLAPPED structure and event */
ol.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (ol.hEvent == NULL) {
    printf("CreateEvent error = %d\n", GetLastError());
    return 1;
}

/* MgslReceive needs MGSL_RECEIVE_REQUEST structure (header + data buffer) */
databuf_size = 128;
rx_req = malloc(sizeof(MGSL_RECEIVE_REQUEST) + databuf_size);
if (rx_req == NULL) {
    printf("can't allocate receive request structure\n");
    return 1;
}

MgslEnableReceiver(fd, 1); /* enable receiver */

signal(SIGINT, sigint_handler);
printf("press Ctrl-C to stop program\n");

while (!stop_program) {

    /* prepare for MgslReceive call */
    rx_req->DataLength = databuf_size;
    ResetEvent(ol.hEvent);

    rc = MgslReceive(fd, rx_req, &ol);

    if (rc == ERROR_IO_PENDING) {
        printf("wait for received data...");
        while (!stop_program) {
            rc = WaitForSingleObject(ol.hEvent, 100);
            if (rc == WAIT_OBJECT_0)
                break; /* receive request complete */
            if (rc != WAIT_TIMEOUT) {
                printf("WaitForSingleObject error = %d\n",      GetLastError());
                return rc;
            }
        }
        if (stop_program) {
            printf("Ctrl-C pressed, cancel receive request\n");
            MgslCancelReceive(fd);
            break;
        }
    } else if (rc != NO_ERROR) {
        printf("MgslReceive error=%d\n", rc);
        return rc;
    }

    /* process completed receive request */

    if (rx_req->Status == RxStatus_OK) {
        count = rx_req->DataLength;
        printf("received %d bytes\n", count);
        /* write received data to file */
        written = (int)fwrite(rx_req->DataBuffer, sizeof(char), count, fp);
        if (written != count)
            printf("fwrite error=%d %s\n", errno, strerror(errno));
        fflush(fp);
    } else
        printf("receive error, status = %d\n", rx_req->Status);
}

MgslEnableReceiver(fd, 0); /* disable receiver */

printf("Turn off RTS and DTR ser`enter code here`ial outputs\n");
rc = MgslSetSerialSignals(fd, 0);
if (rc != NO_ERROR)
    printf("turn off DTR/RTS error=%d\n", rc);

MgslClose(fd); /* close device */
fclose(fp); /* close output file */

return 0;
}

But i get the following errors:
1>------ Build started: Project: testing, Configuration: Debug Win32 ------
1>  testing.cpp
1>c:\users\jjteo\documents\visual studio    2010\projects\testing\testing\testing.cpp(124): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(234) : see declaration of 'fopen'
1>c:\users\jjteo\documents\visual studio 2010\projects\testing\testing\testing.cpp(126): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(157) : see declaration of 'strerror'
1>c:\users\jjteo\documents\visual studio 2010\projects\testing\testing\testing.cpp(241): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
 1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(157) : see declaration of 'strerror'
 1>testing.obj : error LNK2019: unresolved external symbol _MgslEnumeratePorts@12 referenced in function _get_port_id
 1>testing.obj : error LNK2019: unresolved external symbol _MgslClose@4 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslCancelReceive@4 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslReceive@12 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslEnableReceiver@8 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslSetSerialSignals@8 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslSetIdleMode@8 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslSetParams@8 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslGetParams@8 referenced in function _main
 1>testing.obj : error LNK2019: unresolved external symbol _MgslOpen@8 referenced in function _main
 1>c:\users\jjteo\documents\visual studio 2010\Projects\testing\Debug\testing.exe : fatal error LNK1120: 10 unresolved externals

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Are the problems caused by compiling c code with the C++ compiler? How do I fix this. Thanks.

A: You've obviously got the header file for SyncLink API, but you're not referencing the library file (.LIB) that goes with it.
Check in the API directory for any .LIB files and add them to your compilers link options. If you're using Visual Studio then there will be a section called "Addition Libraries" (I think) in the linker section of the project properties. There are probably some .LIB files listed there already, so try adding the one for SyncLink.

A: Set mghdlc.lib in Linker->Input-> Additional Dependencies, both debug and release version. Or add code "#pragma comment(lib, "mghdlc.lib")" in your source code.
You also have to be sure that your mghdlc.lib file is right int the path that "additional library directories" sets.


text:
Q: Frama-C Gui on mavericks not working Does anyone have installed Frama-C on Mavericks ?
Because i can't install it or do not know how to install it (Gui Version)!
I already installed ocaml on my pc, but for the Gui version i need to install these libraries : Gtk, GtkSourceView, GnomeCanvas and Lablgtk2.
So i saw a previous post and did that :
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
sudo port install opam
opam init
  Y
eval `opam config env`
sudo port install gtksourceview2 lablgtk2 ocaml-ocamlgraph
opam install frama-c

Im' having a problem in making "make" with frama-c which is :
Ocamlc       src/logic/property_status.cmo
File "src/logic/property_status.ml", line 1444, characters 4-2027:
Error: Signature mismatch:
   ...
   Values do not match:
     val vertex_attributes :
       v ->
       [> `Color of int
        | `Label of string
        | `Shape of [> `Box | `Diamond ]
        | `Style of [> `Bold | `Filled ] list
        | `Width of float ]
       list
   is not included in
     val vertex_attributes :
       V.t -> Graph.Graphviz.DotAttributes.vertex list
   File "src/logic/property_status.ml", line 1479, characters 16-33:
     Actual declaration
make: *** [src/logic/property_status.cmo] Error 2

How am i able to solve this ?

A: i've just successfully installed Frama-c neon (with Gui) on maverick, using opam and homebrew.
here's my walkthrough. (Thanks to tips above)
1) Install homebrew
$ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

2) Install opam:
$ brew install opam
$ opam init

(i had to modify .profile instead of .bashrc with f option)
$ eval `opam config env`

3) Install all dependencies
$ brew install gtk+
$ brew install gtksourceview
$ brew install libgnomecanvasmm libgnomecanvas
$ brew install lablgtk

4) Install Frama-c
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ opam install frama-c

If you prefer install dependencies with macports, change the PKG_CONFIG_PATH to /opt/X11/lib/pkgconfig as explained here
Hope this help

A: I have successfully installed frama-c Neon with gui on mavericks using brew to get all the dependencies and using the source code in http://frama-c.com/download.html . If you try to do it using brew, you should install lablgtk from this repository(https://github.com/mht208/homebrew-formal) and only after all the other dependencies so the commands to install with gui would be(in source folder):
  brew install ocaml
  brew install gtk
  brew install gtksourceview
  brew install gnomecanvasmm gnomecanvas
  brew tap mht208/formal
  brew install lmht208/formal/lablgtk -with-gnomecanvas -with-gtksourceview2
  ./configure
  make

You can also install ocamlgraph with opam, and you can compile Zarith and install in your system.

A: Graph.Graphviz is from OCamlGraph. There seems to be an incompatibility between the two latest versions of each.
You'll have to add version contraints on the frama-c library, or change the Style attribute to have a list of the polymorphic variant set.
EDIT -
you don't need to install ocamlgraph via port, you should install that by opam as well.


text:
Q: how to decode xml data into a human readable format I have some xml files which have been used as personal data files in an astrological application.
The appliction does not exists more, but I still need the data. Opening the xml I have the following:
<BirthDate>2442260.7083333</BirthDate>

or
<BirthDate>2436617.0375000</BirthDate>

in this case real date is 17.02.1959. 12:54 (12:54 is the birthtime).
or
<BirthDate>2446904.4652778</BirthDate>

in this case real date is 18.04.1987. 23:10 (23:10 is the birthtime).
Is there a way to decode this and get the date/time in a readable format?

A: The encoding method is indeed based on days (the integer part) and fractions of days (the decimal part), but the epoch is about 6611 years in the past.
The simplest way to decode these dates/times is to use Excel, with an adjustment for the epoch (zero point).  The adjustment is -2415019 days.
Thus if you place the formula
=2436617.0375-2415019

in a cell and format as date/time you get
2/17/59 00:54

For the other value the formula
=2446904.4652778-2415019

gives the date
4/18/87 11:10

so I suspect the value you gave of 23:10 is a typo.
Note that calculating the epoch date (when in the past the zero point was) is meaningless as no modern calendars were in use at the time.  You could extrapolate but you'd have to pick a calendar (Julian vs Gregorian or something else) and whatever you come up with (around 4595 BC) won't be useful for anything.
Here's a screenshot of a sample Excel worksheet

The first column is your values, the second is the value adjusted with the epoch offset, and the third is the second column formatted as a date/time.
Excel uses 12/31/1899 00:00 as its epoch; that is, the value zero renders in Excel as 1/0/1900 (which is itself weird) and the value 1 gives 1/1/1900.  If you want to do the conversion in code you can use this knowledge to adjust the offset for whatever programming library you are using.

A: This isn't actually an XML question, but one of interpreting a weird (and probably undocumented) date representation. The fractional part of the number is 17/24, which indicates that it probably means 5 PM on a given date.
However, when we interpret the part before the decimal point as a day number, it would be based on a date about 6687 years in the past. That does not seem to make much sense...


text:
Q: Problem installing the R package 'RcppEigen' on Mac OS X I tried to install the R package "RcppEigen" I get an error message. I'm not exactly sure how to problem solve the warning it produces. The warning message seems to relate to "../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
        #pragma clang diagnostic pop"
Thank you!! Any help would be much appreciated.
    > install.packages("RcppEigen")

  There is a binary version available but the source version is later:
             binary    source needs_compilation
RcppEigen 0.3.3.3.1 0.3.3.5.0              TRUE

Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package 'RcppEigen'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1595k  100 159 0    05k    0     0  7445k      0 --:--:-- --:--:-- --:--:-- 7455k
* installing *source* package 'RcppEigen' ...
** package 'RcppEigen' successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"  -I../inst/include -fPIC  -Wall -mtune=core2 -g -O2  -c RcppEigen.cpp -o RcppEigen.o
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:1:
In file included from ../inst/include/Eigen/Core:535:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:2:
In file included from ../inst/include/Eigen/LU:47:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:12:
In file included from ../inst/include/Eigen/Jacobi:29:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:4:
In file included from ../inst/include/Eigen/QR:17:
In file included from ../inst/include/Eigen/Householder:27:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:5:
In file included from ../inst/include/Eigen/SVD:48:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppEigen.cpp:22:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:6:
In file included from ../inst/include/Eigen/Geometry:58:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:26:
In file included from ../inst/include/Eigen/SparseCore:66:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:27:
In file included from ../inst/include/Eigen/OrderingMethods:71:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:29:
In file included from ../inst/include/Eigen/SparseCholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:32:
In file included from ../inst/include/Eigen/SparseQR:35:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:33:
In file included from ../inst/include/Eigen/IterativeLinearSolvers:46:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:32:
In file included from ../inst/include/Eigen/CholmodSupport:45:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:35:
In file included from ../inst/include/unsupported/Eigen/KroneckerProduct:34:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:39:
In file included from ../inst/include/unsupported/Eigen/Polynomials:135:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:40:
In file included from ../inst/include/unsupported/Eigen/SparseExtra:51:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
17 warnings generated.
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"  -I../inst/include -fPIC  -Wall -mtune=core2 -g -O2  -c fastLm.cpp -o fastLm.o
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:1:
In file included from ../inst/include/Eigen/Core:535:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:2:
In file included from ../inst/include/Eigen/LU:47:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:12:
In file included from ../inst/include/Eigen/Jacobi:29:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:3:
In file included from ../inst/include/Eigen/Cholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:4:
In file included from ../inst/include/Eigen/QR:17:
In file included from ../inst/include/Eigen/Householder:27:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:5:
In file included from ../inst/include/Eigen/SVD:48:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:6:
In file included from ../inst/include/Eigen/Geometry:58:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:30:
In file included from ../inst/include/Eigen/Dense:7:
In file included from ../inst/include/Eigen/Eigenvalues:58:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:26:
In file included from ../inst/include/Eigen/SparseCore:66:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:27:
In file included from ../inst/include/Eigen/OrderingMethods:71:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:29:
In file included from ../inst/include/Eigen/SparseCholesky:43:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:32:
In file included from ../inst/include/Eigen/SparseQR:35:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:31:
In file included from ../inst/include/Eigen/Sparse:33:
In file included from ../inst/include/Eigen/IterativeLinearSolvers:46:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:32:
In file included from ../inst/include/Eigen/CholmodSupport:45:
../inst/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:35:
In file included from ../inst/include/unsupported/Eigen/KroneckerProduct:34:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:39:
In file included from ../inst/include/unsupported/Eigen/Polynomials:135:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from fastLm.cpp:23:
In file included from ./fastLm.h:25:
In file included from ../inst/include/RcppEigen.h:25:
In file included from ../inst/include/RcppEigenForward.h:40:
In file included from ../inst/include/unsupported/Eigen/SparseExtra:51:
../inst/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
17 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c init.c -o init.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o RcppEigen.so RcppEigen.o RcppExports.o fastLm.o init.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package 'RcppEigen'
* removing '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/RcppEigen'
Warning in install.packages :
  installation of package 'RcppEigen' had non-zero exit status

The downloaded source packages are in
    '/private/var/folders/9_/f0jqcgq13n97m79xtsl57kn40000gn/T/RtmpSiuVuo/downloaded_packages'


text:
Q: if and for loop in one line I am approaching an excel via openpyxl and I need to do elif statment and for loop at the same line of code.
What I want to achive is this:
Check if the value is not None, if not None do a loop in a column in which you are looking for an index of matched value.
If you do not find the value in this column, check the second column, where the value is. I have to create an elif statment, which would guide machine to do similar thing as it is doing in 'else:' statment which I can handle as I can write it in a chain and multiple lines
The code I have:
for each in sheet['G'][1:]:
    indexing_no = int(sheet['G'].index(each)+1)
    indexing_column = int(sheet['G'].index(each))

    if each.value == None:
        pass
    else:
        for search_value in sheet['A'][1:]:
            if each.value == search_value.value:
                index_no = int(sheet['A'].index(search_value) + 1)
                sheet['H{name}'.format(name = indexing_no)].value = sheet['B{name}'.format(name = index_no)].value

A: You could try this:
columns = ("G","A","D") # column letters to search in parallel
values  = ( ((c,v) for v in sheet[c][:1]) for c in columns )
for row,colVal in enumerate(zip(*values),1)
    col,value = next( ((c,v) for c,v in colval if v is not None),("",None))
    if not col: continue # or break when no column has any value
    # ...
    # perform common work on first column that has a non-None value
    # using col as the column letter and value for the value of the cell
    # at sheet[col][row]


text:
Q: Google Cloud Platform DNS: unable to set domain name without www to point to server I am new to GCP. I have configured a computing engine and am trying to set the DNS entries. I have updated the Name Servers on the Registrar DNS settings. On the GCP DNS configuration I have set
(a) the A record
(b) the CNAME records
when I access the site using https://www.hida.app it works but when I try with https://hida.app it does not.
I also notice that when I ping with www.hida.app it pings showing the static IP address in GCP, but when I ping with just hida.app it shows some other address
Here is the screen shot

Thanks

A: TTL (Time To Live) is the expiration time (valid till this time period) for a DNS record. With the TTL value, the DNS serves, inform the recursive server or local resolver how long it should keep this DNS record in its cache. The longer the TTL, the longer the resolver holds that information in its cache. The shorter the TTL, the shorter amount of time the resolver holds that information in its cache.
In your case, you have done the test within the specified TTL time and while the recursive server or local resolver was answering from the cache. Which @John Hanley described in his comment.


text:
Q: After creation of my own account in Uber developer console why i am not getting any confirmation message? I am new to android development while i integrating uber app in my application facing some issues like, After creation of  my own account in Uber developer console not getting any confirmation message?Now how can i get my app ID?

A: Please register to Uber for a Rider account (https://get.uber.com/new-signup) and then with this account sign into the: https://developer.uber.com/dashboard. Create the new application and you are ready to start using Uber API. Once you create the new application - you will see your app listed on the dashboard - by clicking on your app - you will get to the app details - where you can see your application id (it is Client id on the dashboard). Once the new application is created and saved there is no specific "confirmation" - only on the top of the page, you should get "Success! Your changes have been saved." message.
For more info please follow our documentation: https://developer.uber.com/docs/riders/introduction.


text:
Q: Column ambiguously defined Error on Creating a view I'm trying to create a view with below query.
SELECT the_day, t1, t2
  FROM year_days
    LEFT JOIN (SELECT tea_prodcution_date, SUM(quantity) t1
                  FROM TEA_PRODUCTION
                  WHERE field_name like 'T1'
               GROUP BY tea_prodcution_date) ON the_day = tea_prodcution_date
     LEFT JOIN (SELECT tea_prodcution_date, SUM(quantity) t2
                  FROM TEA_PRODUCTION
                  WHERE field_name like 'T2'
               GROUP BY tea_prodcution_date) ON the_day = tea_prodcution_date
 ORDER BY the_day

year_days is a view created with below query.
SELECT add_months(TRUNC(sysdate - (365), 'YYYY'),to_number(to_char(sysdate,'mm'))) + (level - 1) AS the_day
  FROM dual
CONNECT BY level <=
           to_number(TO_CHAR(last_day(add_months(TRUNC(sysdate, 'YYYY'), 11)),
                             'DDD'))

When i'm trying to execute my first query to create a view, i got below error.
ORA-00918: column ambiguously defined
00918. 00000 -  "column ambiguously defined"
*Cause:
*Action:
Error at Line: 10 Column: 58

Error occurs from ON the_day = tea_prodcution_date line.
how could i correct this error and create above view ?

A: I found error with my query. query should correct as below.
SELECT the_day, t1, t2
  FROM year_days
    LEFT JOIN (SELECT tea_prodcution_date, SUM(quantity) t1
                  FROM TEA_PRODUCTION
                  WHERE field_name like 'T1'
               GROUP BY tea_prodcution_date) aa ON the_day = aa.tea_prodcution_date
     LEFT JOIN (SELECT tea_prodcution_date, SUM(quantity) t2
                  FROM TEA_PRODUCTION
                  WHERE field_name like 'T2'
               GROUP BY tea_prodcution_date) bb ON the_day = bb.tea_prodcution_date
 ORDER BY the_day


text:
Q: Как узнать все недостающие зависимости для maven проекта (для работы в частной сегменте) Пытаюсь собрать maven проект в частном сегменте сети. Выхода на maven central нет. Так уж случилось, что нету никаких прокси и зеркал а ля нексус, откуда можно было бы стащить зависимости. В итоге после каждой команды mvn package приходится докидывать по одной зависимости (через почту запароленным архивом). И так уже полдня. Есть ли какой способ узнать все недостающие зависимости, чтобы отправить их пачкой?
mvn dependency: tree -Dverbose не помогает, т.к. опять же не хватает какой-то зависимости, чтобы построить дерево.
mvn help: effective-pom тоже не строится.
mvn dependency: resolve так же выдает только одну недостающую зависимость. Буду рад любой помощи


text:
Q: What is the difference between concatenating with a comma and plus can you please tell me what is the difference between , and + while concatenation?
num=0
print(num,'Hi')
print(num+'Hi')

So just wrote a program that doesn't make any sense.
So I want to know if you use the first option then it prints 0 Hi
but in the 2nd it shows an error.
This was just a meaningless code but when I write codes that involve int and str so when I use the 2nd one it shows cant concatenate str and int but the 1st option gives the right answer.
Can you tell me why in simple language and how using both options can change the output

A: concatenation means you are combining both variables(only strings) into one. But when you use comma it prints both the output separately but you can't see it on the output console. concatenation can only be made between strings.
num=0
print(num+'Hi')
so this code will give you a error like this:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
because concatenation can only be made between two strings

A: You are not really 'concatenating' when you say print(x, y).  You are just printing two strings.  Concatenating is when you add one string to another.  So for example you may want to do something like this (which is concatenation):
answer = "Here is your answer: "
if x = 1:
  answer = answer + "1"
if x = 2:
  answer = answer + "2"

print(answer)

By using the plus sign, you have changed the contents of the string named 'answer'.

A: It's simple. print(num, 'Hi') parses out a tuple and prints each item whereas print(num + 'Hi') attempts to combine an integer and a string, which is not possible.


text:
Q: I need to implement start and stop worker queues functionality in bullmq I need to implement one functionality to start and stop worker queue using bullmq.
The complete scenario is when someone presses the start button on the front-end side. the job will be added to the worker and the queue will start and processing it. in the middle of the worker implementation if one will press the stop button. it needs to get a stop or can say pause the queue job. and then if one will start the job again. it should start again with the same queue job.
I would really appreciate any help, thanks in advance.


text:
Q: Can a missed shot still execute? If you have a weapon which has both a Repeater and a Stock attached to it. Is there any chance that a missed shot will trigger the Repeater?
My assumption is that it will not as the actual shot did not hit, and the Repeater requires a hit in order to trigger, but it's a guess.
Reference: Weapon upgrades

A: After some investigation, it seems Repeater only works on successful shots but if you have Stock then that damage can trigger Repeater bonus and execute the enemy.
Source: https://gfycat.com/PreciousOffbeatArcticwolf
Reddit thread: https://www.reddit.com/r/Xcom/comments/44oxea/stock_repeater_flawless_execution/

A: It used to be possible for Stock+Repeater to trigger a "One-Miss Kill".
However the Alien Hunters patch (May 2016) has removed this possibility. So if your XCOM2 is auto-updating, this is no longer possible.


text:
Q: Writing a function in python with addition and subtraction operators as arguments I'm really confused and I don't know how to solve the following problem.
Imagine that I have written a very long code and I want to transform this long code to a function to prevent repetition. The problem is that I need to give 'add sign' (+) and 'subtraction sign'(-) as function inputs. I mean that I have a very long code that I need to change two signs of add and subtraction for each time and nothing more and finally to get the output according changing these two operators (these two operators are in fact my variables!)
As you know repeating this long function for four different states of changing 'add and subtraction signs', makes my code even longer and longer. I would like to know if there is any way to define just One function that gives these pair of add and subtraction operators as input and give me the output for these four different conditions?
I have made a simple example to clarify the question:
Imagine that I have four similar 'for loops' just different in 'minus sign' and 'plus sign':
edges=set()
a=60; b=40
for i in range(0,300):
    a+=1; b+=1
    if a!=0 and b!=0:
        edges.add((a, b))

a=60; b=40
for i in range(0,300):
    a-=1; b-=1
    if a>=0 and b>=0:
        edges.add((a, b))

a=60; b=40
for i in range(0,300):
    a+=1; b-=1
    if a>=0 and b>=0:
        edges.add((a, b))

a=60; b=40
for i in range(0,300):
    a-=1; b+=1
    if a>=0 and b>=0:
        edges.add((a, b))
print(edges)

As you see, these four 'for loops' are all the same except in 'plus and minus signs'. I want to write just one function instead of these four repeated 'for loops'. Is there any other way to solve this problem? Anyone has any idea?

A: Write the function to accept increments as parameters.
def add_edges(aincr, bincr):
    for i in range(0,300):
        a += aincr; b += bincr
        if a!=0 and b!=0:
            edges.add((a, b))

Then pass in the appropriate increments when calling:
add_edges(1, 1)
add_edges(-1, -1)
add_edges(1, -1)
add_edges(-1, 1)

There is no need to pass the concept of "add" or "subtract", since you can do that numerically. You could (as other answers show), but try not to overcomplicate things.

A: You can create add_1 and minus_1 as functions and pass them as args into another function:
def add_1(x):
    return x + 1

def minus_1(x):
    return x - 1

def do_op(a, b, f1, f2):
    for i in range(0,300):
        a, b = f1(a), f2(b)
        if a>=0 and b>=0:
            edges.add((a, b))

do_op(60, 40, add_1, add_1)
do_op(60, 40, minus_1, minus_1)
do_op(60, 40, add_1, minus_1)
do_op(60, 40, minus_1, add_1)
print(edges)

You can pass in lambdas as well directly:
do_op(60, 40, lambda x:  x + 1, lambda x:  x + 1)
do_op(60, 40, lambda x:  x - 1, lambda x:  x + 1)
do_op(60, 40, lambda x:  x + 1, lambda x:  x - 1)
do_op(60, 40, lambda x:  x - 1, lambda x:  x - 1)

A: import operator
ops = { "+": operator.add, "-": operator.sub } # etc.

def do_math(a, b, s):
    print(ops[s](a, b))

do_math(5, 3, '-')

Disclaimer: I used this post as a reference.

A: Subtracting is the same as adding negative value, so:
def operation(first_val, second_val, add=True):
    second_val = second_val if add else -second_val
    return first_val + second_val

or using += notation:
def increment_decrement(value, add=True):
    step = 1 if add else -1
    value += 1
    return value


text:
Q: Understanding regex lookaround to get desired result I am trying to isolate street address fields that begin with a digit, contain an underscore and end with a comma:
001 ALLAN Witham Ross 13 Every_Street, Welltown Greenkeeper 002 ALLARDYCE Margaret Isabel 49 Bell_Road, Musicville Housewife 003 ALLARDYCE Mervyn George 49 Bell_Road, Musicville Company Mngr

e.g
13 Every_Street, Welltown
49 Bell_Road, Musicville
49 Bell_Road, Musicville

My regex is
(?ms)([0-9]+\s[A-Z][a-z].+(?=,))

But this matches 13 through to the last 'd' of Bell_Road. Which is almost everything. See regex101 example
This matches two commas but not the third? I want it to match up to the next comma. But do it three times :)

A: You don't have to assert the comma to the right if you also want to match it.
If you want to match an underscore before the comma, and the address part itself can not contain a comma:
\b\d+\s+[A-Z][a-z][^_,]*_[^,]+,\s+\S+

Explanation

*

*\b A word boundary

*\d+ Match 1+ digits

*\s+ Match 1+ whitespace chars

*[A-Z][a-z] match an uppercase char A-Z and a lowercase char a-z

*[^_,]*_ Optionally match any char except _ or , and then match _

*[^,]*, Match optional chars except , and then match ,

*\s+\S+ Match 1+ whitespace chars followed by 1+ non whitespace chars

Regex demo

A: This produces your desired matches:
\d+[^,\d]*_[^,]+, \S+
demo
They don't end with a comma, tho.
For that you could just remove  \S+ at the end.


text:
Q: Calculadora ASP.NET Estoy realizando un pequeño ejercicio de operaciones consumiendo un Web Service, pero no encuentro la manera de poder mostrar el resultado en la vista, no estoy usando Model.
controlador
{
    return View();
}

[HttpPost]
public ActionResult Index(int primero, int segundo)
{
    // Creación de un objeto de referencia del servicio web
    ServiceReference1.CalculatorSoapClient multi = new ServiceReference1.CalculatorSoapClient();

    // llama y almacena el resultado del servicio web en la variable
    var multiplicac = multi.Multiply(primero, segundo);
    return View();
}

A: puedes pasar el valor a la vista de la siguiente forma:
public ActionResult NombreView()
{
  ViewData["multiplicac"] = multi.Multiply(primero, segundo);
    return View();
}

y luego en la vista lo puedes usar haciendo:
   @Html.Encode(ViewData["multiplicac"].ToString())


text:
Q: Worklight features are not working in Blackberry 6 I have created a Blackberry 6 project on worklight platform.I used Webwork SDK in order to package the project.But once I tried to run project on Blackberry 6 simulator wlCommonInit()was not being executed.
I packaged my code using command prompt but not with Ripple Emulator.So i didn't packaged the whole code i just packaged native folder of the code.Since Blackberry requires config file and index file to be in the root folder of the zip file I copy pasted the index file outside the default folder and also changed the paths of the script files.
So is it a because of the pasting the index file outside the default folder that I am getting this error or is it because of the config file not defined properly.
NOTE:My project is a single page html
This is my config.xml
<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets"              version="1.0" rim:backButton="exit">

  <name>sampleBlack</name>
    <description>sampleBlack</description>
    <author email="application author's e-mail">application's author</author>
    <feature id="worklightFeature" required="false" version="1.0.0"/>
    <feature id="blackberry.ui.dialog" version="1.0.0"/>
    <feature id="blackberry.ui.menu" version="1.0.0"/>
    <feature id="blackberry.invoke" version="1.0.0"/>
    <feature id="blackberry.invoke.BrowserArguments" version="1.0.0"/>
    <feature id="blackberry.identity" version="1.0.0"/>
    <feature id="blackberry.app" version="1.0.0"/>
    <feature id="blackberry.app.event" version="1.0.0"/>
    <access subdomains="true" uri="*"/>
    <content src="www/skinLoader"/>
    <icon rim:hover="false" src="icon.png"/>
    <rim:loadingScreen backgroundImage="" foregroundImage="splash.png" onLocalPageLoad="false" onFirstLaunch="true"/>
</widget>

This is my index.html file
<!DOCTYPE HTML>

        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <META content="text/html; charset=UTF-8" http-equiv="Content-Type">
        <meta charset="UTF-8">
        <title>index</title>
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" name="viewport">
        <link href="www/default/worklight/worklight.css" rel="stylesheet">
        <link href="www/default/images/favicon.png" rel="shortcut icon">
        <link href="www/default/images/apple-touch-icon.png" rel="apple-touch-icon">
        <link href="www/default/css/common-controls.css" rel="stylesheet">
        <link href="www/default/css/android-controls.css" rel="stylesheet">
        <link href="www/default/css/main.css" rel="stylesheet">
        <link href="www/default/css/style.css" rel="stylesheet">
        <link href="www/default/css/classic.css" id="usertypecss" rel="stylesheet">

</script>

Login

                Personalize

And this is how my folder which I zip to get cod file looks like
http://50.17.252.160/test/Capture.PNG [sorry about uploading it on server i dont have required reputation to add a pic]

I would also appreciate if there are any sample projects available for worklight Blackberry 6 using webWork SDK.

A: No folder structure changes are required in order to get a BlackBerry 6/7 app to work, in either Ripple or BlackBerry Simulator/physical device.
If you have the correct WebWorks SDK for BlackBerry 6/7 installed, Worklight Studio will generate a project template that is ready to be used.
See the instructions in this tutorial: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/hello-world/previewing-application-blackberry-6-7/
To download and setup the BlackBerry enviornment, see this tutorial: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/setting-up-your-development-environment/setting-blackberry-6-7-development-environment/
To further debug your issue, it'd be best to provide any available logs from the simulator/device.