text:
Q: Every time i make some changes android lint error comes...why so? I am using robotium tool in eclipse to create test cases.
My doubt is every time i make any changes in any of the file i get error like
Call requires API level 3 (current min is 1)... Android Lint Problem

and when i do right click on project and then android tools->clear lint markers
all those errors goes.But i am not getting why such lint errors comes on making any changes in the file?What is the reason for these lint errors.

A: You are using functionalities only available in newer API-levels than is your set minimum in android manifest file.
If you set <uses-sdk android:minSdkVersion="1" /> , you should not use any classes that were introduced in API-level 3.

A: I was having the same issue with Robotium and the lint markers.  Instead of modifying any manifest files, I suggest disabling the minSDK lint check for your project that is using Robotium.
"Clear Lint Markers" removed the error temporarily, but it kept coming back every time I saved a file in the affected project.
Here's what worked for me:

Right click project -> Properties -> Android Lint Preferences
Search for "minSdk" in the search box
Click on "UsesMinSdkAttributes"
Click the "Ignore All" button at the bottom. Clean and rebuild the
  project, and Eclipse/ADT will no longer run the lint check for minSdk
  on your project.

A: Please refer this link. As it says,
Android Lint is a new tool introduced in ADT 16 (and Tools 16) which scans Android project sources for potential bugs. It is available both as a command line tool, as well as integrated with Eclipse (described below), and IntelliJ (details). The architecture is deliberately IDE independent so it will hopefully be integrated with other IDEs, with other build tools and with continuous integration systems as well.


text:
Q: How can I configure a Spring Boot app to use two message properties files? I have a Spring Boot app that pulls messages from messages.properties and its language-specific partners (e.g. messages_fr.properties for French users).  I'd like to add a second set of messages files, for messages that are shared across several of my organization's applications.  Let's call it commonmessages.properties (and commonmessages_fr.properties etc.).
How can I tell Spring Boot to use both files for messages?

A: As seen in an example in this Spring Boot "features" overview, you can set the property spring.messages.basename in application.properties or application.yml to a comma-separated string.
In this case:
spring.messages.basename=messages,commonmessages
EDIT: I did a bit of testing and it seems like the entry listed first has precedence, i.e., if messages of the same name are found in both files, the app will use the one from messages and not the one from commonmessages.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to left pad a 2 dimensional byte array with leading zeros in C# I have a 2 dimensional byte array of a bitmap pixel data that I need to send to a thermal printer using ESC/POS via comport. I can do this successfully. However, I need to shift the printed image to the right. Center justify, Right justify, HT, and all other ESC/POS commands have no effect due to the command used to print the bitmap (DC2 * r n [d1.....dn]).
I wish to left pad the array of bytes containing the bitmap in order to shift the printed image to the right. Below are my code lines to print bitmap
    private void Print_Bipmap()
    {
        int x;
        int y;
        int i;
        int RowBytes;
        byte n;
        Color Pixels;
        byte[,] ImageArray = new byte[bitmap.Width, bitmap.Height];

        // Calculate output size
        RowBytes = (bitmap.Width + 7) / 8;

        // Generate body of array
        for (y = 0; y < bitmap.Height; y++)
        { // Each row...
            for (x = 0; x < (bitmap.Width / 8); x++)
            { // Each 8-pixel block within row...
                ImageArray[x, y] = 0;
                for (n = 0; n < 8; n++)
                { // Each pixel within block...
                    Pixels = bitmap.GetPixel(x * 8 + n, y);
                    if (Pixels.GetBrightness() < 0.5)
                    {
                        ImageArray[x, y] += (byte)(1 << (7 - n));
                    }
                }
            }
        }

        comport_writeByte(18); //DC2
        comport_writeByte(42); //*
        comport_writeByte((byte)bitmap.Height); //r
        comport_writeByte((byte)RowBytes); //n

        for (y = 0; y < bitmap.Height; y++)
        {
            for (x = 0; x < RowBytes; x++)
            {
              comport_writeByte(ImageArray[x, y]); //[d1 ..... dn]
            }
        }
    }

How do I left pad the 2 dimensional array (ImageArray[x, y])?
Many thanks in advance.


text:
Q: Knockoutjs likertscale maximum number of points What im trying to achieve is the following. Within a list of twenty points a user can select 3 times a 5, 4 times a 4, 5 times a 3 etc.
How can I achieve this with knockout?
I currently have a list with a name, and a observablevar named rating.
Whoe can help me with this?
Example snippet

            <input type="radio" value="nvt" data-bind="checked: rating">
            <input type="radio" value="1" data-bind="checked: rating">
            <input type="radio" value="2" data-bind="checked: rating">
            <input type="radio" value="3" data-bind="checked: rating">
            <input type="radio" value="4" data-bind="checked: rating">
            <input type="radio" value="5" data-bind="checked: rating">

A: You can use a writable computed observable for validation, only writing to the backing field if the validation passes. In your case you would check all the ratings to see if the counts are ok. I've made a simplified example fiddle which only checks if the user does not select "nvt" after choosing some other value.
Fiddle: http://jsfiddle.net/pe8hg0v6/2/
Javascript:
var viewModel;

document.addEventListener("DOMContentLoaded", function(event) {
    var list = [];
    viewModel = {};
    viewModel.isValid = function(value){
        //TODO; your actual validation logic
        return value !== "nvt";
    };

    for(var i=0; i < 5; i++){
        var createObj = function(){
            var obj = {};
            obj.name = "test";
            obj.rating = ko.observable("nvt");
            obj.validatedRating = ko.computed({
                    read: function(){return obj.rating()},
                    write: function(value){if(viewModel.isValid(value)) obj.rating(value);}
                });
            return obj;
        };
        list.push(createObj());
    }

    viewModel.rateableList = list;
    ko.applyBindings(viewModel);
});

A: I did it in a different way like the following.
In the table reference for the radio buttons I added a check if the rating is 5 or the count of rates listed marked as 5.
<input type="radio" value="5" data-bind="checked: rating, enable : $root.chosenValueCount()['5'] < 3 || rating() == '5'" />

And the JS
self.chosenValueCount = ko.computed(function() {
    var result = { 1 : 0, 2 : 0, 3 : 0, 4 : 0, 5 : 0 };
    ko.utils.arrayForEach(self.rateableList, function(item) {
        if (!result[item.rating()]) result[item.rating()] = 1;
        else result[item.rating()]++;
    });
    return result;
});

You can see a working example at:
http://jsfiddle.net/x7q1gxxf/2/


text:
Q: Using Same Rails View for Many Products via Link I'm a rails newbie building my first application.  I've been learning a lot so far, but I'm hung up on the issue of trying to use the same view and populate it with information from my database when a particular product link is clicked.
So far I have a database of products.  On the front page of my site I list all products.  On this list, the name of each product is a link to the product details page.
The problem is there are many products, and they all have the same details, so I want to use a single view for the details page no matter which product link was clicked.  Basically, I need a way to tell my "productdetails" controller which link was clicked so it can retrieve the correct info from the product database via the model and pass it to the view...I can't seem to find a way to do this and I've been looking for several days.
Essentially, I have many links that I want to go to the same page, but have that page display differently depending on which link brought you there.  If you click the "Product 1" link you go to a page with "Product 1" at the top and details for that product.  If you click "Product 2" you go to an identical page with the title and details for Product 2, etc.
I realize I could just create a view and route for each link, but that seems silly, especially if I had 10,000 products!
Advice is greatly appreciated, thanks!
Relevant code is below.
Page Controller:
class PagesController < ApplicationController
  def welcome
  end

  def front
    @securities = Security.find_securities
  end

  def userdetail
  end

  def securitydetail
    @securitynumber = params[:id]
  end
end

The Front Page view, where products are listed and links are made to detail pages...

FRONT PAGE

<%= link_to "logout", :action => "welcome"-%>

listing of available securities

<% for security in @securities -%>

<%= h link_to security.name, :action => "securitydetail" %>

        <%= h security.description %>

            <%= h security.shares %> Shares

<% end -%>

The Product Details view, where I'm just trying to display a single unique ID for each product for the time being.  The variable comes from the page controller securitydetail action.

<%= @securitynumber -%>

Finally, here is the routing between the front page and the details page:
MarketVer2Apr2014::Application.routes.draw do
  get "listing/index"
  resources :securities

  get "pages/welcome"
  get "pages/front"
  #get "pages/userdetail"
  get "pages/securitydetail"

  root 'pages#welcome'
  get 'pages/front' => 'pages#front'
  #get 'pages/userdetail' => 'pages#userdetail'
  get 'pages/securitydetail' => 'pages#securitydetail'

I get all the routing, but need to get the information of what link was clicked into my controller...

A: Your products should have their own product model, controllers, and views.  Your products controller with seven golden restful actions.  The show controller contains the info to render a single product
class ProductsController < ApplicationController
  def new
  end

  def create
  end

  def show
      @product = Product.find(params[:id])
  end

  def edit
  end

  def update
  end

  def index
  end

  def destroy
  end

end

Then you can have a view in views/products/show.html.erb with whatever info you want to show such as the name of the product.  Rails will render the same view for each product.

   <%= product.name %>

You should check out the Rails Routing Guide: http://guides.rubyonrails.org/routing.html


text:
Q: How to properly setup VS2008 for x64 programing? On x64 win7, I installed VS2008 and x64 compile tools. I was testing it with a simple "hello world" console program. Both x86 and x64 versions were compiled flawless. Both Debug and Release subversions of the x86 version works fine. The release x64 version works fine too. However, the Debug x64 version always raises the side-by-side error. It seems like the debug runtime cannot be found.
Someone suggest to install the Debug runtime redist. That surprises me: does the x64 debug runtime should already come with the VS2008 installation as the x86 version?
Thanks a lot!
@sj1900 "Some of the x64 compiler components are optional on a VS installation. It's worth checking that they have all been installed."
here is the screenshots:

I did not see any further options here. There is no amd64_microsoft.vc90.debugcrt in the winSxS at all. Strange problem.

A: Some of the x64 compiler components are optional on a VS installation.  It's worth checking that they have all been installed.

A: After hours of head scratching and testing, I finally reckon that is a VS2008 installer bug, confirmed by several online references.
If one installed the vs2008 without the x64 compiler tool at the first time but installed the x64 tools later via the modification feature of the installer, the bug will show up: all the x64 debug runtimes and the nodebug openMP runtime will be missing. Reinstall will not fix this problem.
I tried lots of methods suggested all over the internet: install all the hotfixes, ATL updates, update to SP1 or install the VCredist ... Nothing works.
I figured out there are two ways to fix this:

*

*uninstall the VS2008 completely then install the VS2008 again as fresh with the x64 tools selected.

*this will be annoying for some person who installed lots of hotfixes. The most straightforward way is to build a installer to install all those missing runtimes: create porject->other projects->setup project. Then add&Merge Module -> select all the missing runtimes: Microsoft_VC90_OpenMP_x86_x64.msm , Microsoft_VC90_DebugOpenMP_x86_x64.msm and Microsoft_VC90_DebugCRT_x86_x64.msm.
Build and release the solution, run the installer, then go to %windir%\winsxs, you should happily see all those runtime folders. Then you can start to debug your x64 programs.
If u are using VS2008SP1, then u probably get another error about the runtime version. To avoid this, install the ATL update for SP1 before u start to create the installer.
PS: there are lots of other annoying but not fatal bugs in VS2008 which the M$ never bother to fix. Thus stay away from VS2008 and try VS2010, unless your projects have the special need that forces you to stick to VC9.


text:
Q: On solution for the simple equation $e^{-x}=x$ I am wondering if it is possible to work out the solution for the equation $\large{e^{-x}=x}$ directly.
The obvious way to get the answer is to plot the two figures and find the intersection, but is it possible to get the solution analytically without the help of plotting? Do you have any ideas on this?
Thanks a lot in advance.

A: $e^x=x$ has no real root.
The root of $e^{-x}=x$ or $xe^x=1$ is $x=W(1)\simeq 0.567143$
$W(X)$ is the Lambert W function, which express the root(s) of $We^{W}=X$ where $W$ is the unknown. The function $W(X)$ is multivaluated in $-e^{-1}<X<0$ , as it appears on the figure below :

From p.15 in : https://fr.scribd.com/doc/34977341/Sophomore-s-Dream-Function
Example :
$$e^{-x}x^a=b$$
$$e^{-\frac{x}{a}}x=b^{\frac{1}{a}}$$
$$xe^{-\frac{x}{a}}=b^{\frac{1}{a}}$$
$$(-\frac{x}{a})e^{-\frac{x}{a}} =(-\frac{1}{a})b^{\frac{1}{a}}$$
With $y=-\frac{x}{a}$ and $X=-\frac{b^{\frac{1}{a}}}{a}$
$$ye^y =X $$
$$y=W(X)$$
$$-\frac{x}{a}=W\left(-\frac{b^{\frac{1}{a}}}{a}\right)$$
$$x=-aW\left(-\frac{b^{\frac{1}{a}}}{a}\right)$$

A: The solution cannot be expressed with elementary functions.
It can be rewritten as $-1 = (-x)e^{(-x)}$, and the solution of this equation is given/defined by the Lambert W function :
https://en.wikipedia.org/wiki/Lambert_W_function

A: The Newton iteration for the equation $e^{-x}=x$, rewritten in the form $e^{-x}-x=0$, is
$$x_{k+1}=x_k-\frac{e^{-x_k}-x_k}{-e^{-x_k}-1}.$$
Simplify a bit for convenience:
$$x_{k+1}=x_k+\frac{e^{-x_k}-x_k}{e^{-x_k}+1}=\frac{e^{-x_k}-x_k+x_ke^{-x_k}+x_k}{e^{-x_k}+1}=\frac{e^{-x_k}+x_k e^{-x_k}}{e^{-x_k}+1} = \frac{x_k+1}{e^{x_k}+1}.$$
Using the graph we make the naive guess $x_0=0$. Then $x_1=\frac{1}{2}$, $x_2=\frac{3}{2e^{1/2}+2} \approx 0.5663$. The error is already less than $10^{-3}$. The number of correct digits roughly doubles at each subsequent step from this point on, so you get floating point accuracy in three or four more steps.


text:
Q: How to handle late arriving dimension and NULL business key in Kimball Data Mart? I'm trying to implement Kimball data mart which uses -1 and -2 rows in dimension table for late arriving dimension and for NULL business key. I have an example code below which creates one staging table for fact and dimension data, two dimension tables and one fact table for data mart. Here is my example code with data in SQL:
--drop table stg_sales
--go
CREATE TABLE dbo.stg_sales
  (
     stg_sales_id       INT IDENTITY(1, 1) NOT NULL,
     sales_number       INT NOT NULL,
     sales_amt          INT NULL,
     cust_number        INT NULL,
     cust_firstname     NVARCHAR(50) NULL,
     cust_lastname      NVARCHAR(100) NULL,
     cust_address       NVARCHAR(500) NULL,
     salesperson_number INT NULL,
     CONSTRAINT pk_stg_sales PRIMARY KEY (stg_sales_id)
  )

go

INSERT stg_sales
       (sales_number,
        sales_amt,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        salesperson_number)
VALUES (123,
        434,
        2342,
        'Jim',
        'Moriaty',
        'something',
        23)

INSERT stg_sales
       (sales_number,
        sales_amt,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        salesperson_number)
VALUES (124,
        234,
        2342,
        'Jim',
        'Moriaty',
        'something',
        23)

INSERT stg_sales
       (sales_number,
        sales_amt,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        salesperson_number)
VALUES (125,
        434,
        4545,
        'Joe',
        'Esk',
        'someother',
        24)

INSERT stg_sales
       (sales_number,
        sales_amt,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        salesperson_number)
VALUES (126,
        434,
        5555,
        'Daniel',
        'Hart',
        'Someaddr',
        NULL) --salesperson_number business key missing here

INSERT stg_sales
       (sales_number,
        sales_amt,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        salesperson_number)
VALUES (127,
        333,
        4444,
        'Pat',
        'Smith',
        'Someaddr',
        30)

SELECT *
FROM   stg_sales

--create a dimension and fact tables
--drop table dbo.dim_customer
--go
CREATE TABLE dbo.dim_customer
  (
     customer_wid   INT IDENTITY(1, 1) NOT NULL,
     cust_number    INT NULL,
     cust_firstname NVARCHAR(50) NULL,
     cust_lastname  NVARCHAR(100) NULL,
     cust_address   NVARCHAR(500) NULL,
     date_insert    DATETIME2 NOT NULL DEFAULT (Getdate()),
     date_update    DATETIME2 NULL,
     is_current     BIT NOT NULL
     CONSTRAINT pk_dim_customer PRIMARY KEY (customer_wid)
     CONSTRAINT chk_is_current CHECK (is_current IN (0, 1))
  )

go

SET IDENTITY_INSERT dbo.dim_customer ON

INSERT dbo.dim_customer
       (customer_wid,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        date_insert,
        date_update,
        is_current)
VALUES (-1,
        -1,
        'unknown',
        'unknown',
        'unknown',
        Getdate(),
        Getdate(),
        1)

INSERT dbo.dim_customer
       (customer_wid,
        cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        date_insert,
        date_update,
        is_current)
VALUES (-2,
        -2,
        'Error',
        'Error',
        'Error',
        Getdate(),
        Getdate(),
        1)

SET IDENTITY_INSERT dbo.dim_customer OFF

--insert data into dimension table
INSERT dbo.dim_customer
       (cust_number,
        cust_firstname,
        cust_lastname,
        cust_address,
        is_current)
SELECT DISTINCT cust_number,
                cust_firstname,
                cust_lastname,
                cust_address,
                1 AS is_current
FROM   dbo.stg_sales
WHERE  cust_number <> 4444 --left one record off to simulate the situation where you don't have corrensponding row in dim table (late arriving dimension)
SELECT *
FROM   dbo.dim_customer

DROP TABLE dbo.dim_salesperson

--create salesperson table
CREATE TABLE dbo.dim_salesperson
  (
     salesperson_wid       INT IDENTITY(1, 1) NOT NULL,
     salesperson_number    INT NULL,
     salesperson_firstname NVARCHAR(50) NULL,
     salesperson_lastname  NVARCHAR(100) NULL,
     salesperson_address   NVARCHAR(500) NULL,
     date_insert           DATETIME2 NOT NULL DEFAULT (Getdate()),
     date_update           DATETIME2 NULL,
     is_current            BIT NOT NULL
     CONSTRAINT pk_dim_salesperson PRIMARY KEY (salesperson_wid)
     CONSTRAINT chk_dim_salesperson_is_current CHECK (is_current IN (0, 1))
  )

go

SET IDENTITY_INSERT dbo.dim_salesperson ON

INSERT dbo.dim_salesperson
       (salesperson_wid,
        salesperson_number,
        salesperson_firstname,
        salesperson_lastname,
        salesperson_address,
        date_insert,
        date_update,
        is_current)
VALUES (-1,
        -1,
        'Not available',
        'Not available',
        'Not available',
        Getdate(),
        Getdate(),
        1)

INSERT dbo.dim_salesperson
       (salesperson_wid,
        salesperson_number,
        salesperson_firstname,
        salesperson_lastname,
        salesperson_address,
        date_insert,
        date_update,
        is_current)
VALUES (-2,
        -2,
        'Error',
        'Error',
        'Error',
        Getdate(),
        Getdate(),
        1)

SET IDENTITY_INSERT dbo.dim_salesperson OFF

--insert data into salesperson
INSERT dbo.dim_salesperson
       (salesperson_number,
        salesperson_firstname,
        salesperson_lastname,
        salesperson_address,
        is_current)
VALUES (23,
        'John',
        'Fox',
        'something',
        1)

INSERT dbo.dim_salesperson
       (salesperson_number,
        salesperson_firstname,
        salesperson_lastname,
        salesperson_address,
        is_current)
VALUES (24,
        'Hadley',
        'Fox',
        'something',
        1)

INSERT dbo.dim_salesperson
       (salesperson_number,
        salesperson_firstname,
        salesperson_lastname,
        salesperson_address,
        is_current)
VALUES (30,
        'Ashley',
        'Fox',
        'something',
        1)

SELECT *
FROM   dbo.dim_salesperson

SELECT *
FROM   dbo.stg_sales

--create and populate the fact table
--drop table dbo.f_sales
--go
CREATE TABLE dbo.f_sales
  (
     sales_number    INT NOT NULL,
     customer_wid    INT NOT NULL,
     salesperson_wid INT NOT NULL,
     sales_amt       INT NULL
     CONSTRAINT pk_f_sales PRIMARY KEY (sales_number)
     CONSTRAINT fk_customer_wid FOREIGN KEY (customer_wid) REFERENCES
     dbo.dim_customer(customer_wid),
     CONSTRAINT fk_salesperson_wid FOREIGN KEY (salesperson_wid) REFERENCES
     dbo.dim_salesperson(salesperson_wid)
  )

--populate the fact table
INSERT dbo.f_sales
       (sales_number,
        customer_wid,
        salesperson_wid,
        sales_amt)
SELECT stg.sales_number,
       Isnull(dimcust.customer_wid, -1)  AS customer_wid,
       --this is maybe correct way to assign -1 foreign key when there is no corresponding dimension row in the dim table
       Isnull(dimsp.salesperson_wid, -2) AS salesperson_wid,
       --NOT CORRECT, how to assign -2 foreign key when the business key is NULL in the source?
       stg.sales_amt
FROM   dbo.stg_sales AS stg
       LEFT JOIN dbo.dim_customer AS dimcust
              ON stg.cust_number = dimcust.cust_number
       LEFT JOIN dbo.dim_salesperson AS dimsp
              ON stg.salesperson_number = dimsp.salesperson_number

SELECT *
FROM   dbo.f_sales

How can I assign -2 for the rows in which the business key is missing in the source system. You can read more about the theory behind this implementation from Kimball:

*

*Kimball Design tip 128

*Kimball Design tip 78
This is basically what I'm trying to achieve:
Handling NULL in dimensions and measures
Edit:
I think I can use a COALESCE or ISNULL in the left join, it seems to produce the correct result:
INSERT dbo.f_sales
       (sales_number,
        customer_wid,
        salesperson_wid,
        sales_amt)
SELECT stg.sales_number,
       Isnull(dimcust.customer_wid, -1)  AS customer_wid,
       --this is maybe correct way to assign -1 foreign key when there is no corresponding dimension row in the dim table
       dimsp.salesperson_wid,
       stg.sales_amt
FROM   dbo.stg_sales AS stg
       LEFT JOIN dbo.dim_customer AS dimcust
              ON COALESCE(stg.cust_number, -2) = dimcust.cust_number
       LEFT JOIN dbo.dim_salesperson AS dimsp
              ON COALESCE(stg.salesperson_number, -2) = dimsp.salesperson_number

A: Purely as a lookup technique
-- add nullable keys to the staging table
alter table dbo.stg_sales ADD
  sales_person_wid integer null
, customer_wid     integer null
;

-- insert to staging table here (as in your example)

-- lookup sales person key
update dbo.stg_sales
 set sales_person_wid = p.sales_person_wid
from dbo.stg_sales as s , dbo.dim_salesperson as p
where s.salesperson_number =  p.salesperson_number ;

-- decide what to do with missing business keys
update dbo.stg_sales
 set sales_person_wid = -2
where sales_person_wid is null ;

-- do similar for customer

-- now all keys in staging table are not null

-- load to fact table

However, usual technique is to assign special (unknown, n/a, error) business keys to transactions during extraction or maybe cleaning. In other words that special Error business key could have been assigned before the record landed into the staging table.
And in final note, late arriving dimension means that business key (salesperson_number) is known to the operational system, but the transaction (sale fact) made it to warehouse before the dimension's data. So, salesperson_number would be not null, but would not exist in the dimenson table. You than have to save this transaction somewhere and try to update the FK (salesperson_wid) once the record arrives in the dimension; a day later or so.

A: I thought a late arriving fact was where a dimension related to the fact is slowly changing, and facts were late.  Say you have a sales system, and there is a product called 'Opal Fruit' and the product changes the name to 'Starburst'.  The company wants to track whether the change in name affects the sales, so they set up a type 2 slowly changing dimension (SCD).  In the SCD, they track the product name, so each time the product name changes, they issue a new record for that product, with the same business(natural) key but a different surrogate key, and they record the valid from and to dates for that name.  So, say 'Opal Fruit' has a valid from date of 1/1/1970 and a valid to date 28/3/1995.  The version with product name 'Opal Fruit' has a valid from of '29/3/1995 and the valid to is null, as it is still valid.
Now, say on 1/4/1995, one day after the name change, they get some sales transactions whose transaction date is 1/4/1995 and some whose transaction date is 27/3/1995.  Late arriving means that the transactions for a given dimension arrive after the product dimension changed.  So, the transaction that arrived on 27/3/1995 need to have the surrogate key for the product dimension whose product name is 'Opal Fruitt' while those that arrived on 1/4/1995 need the surroagte key of the product dimension where the name is 'Starburst'.  What you have to do is work out which version of the 'Opal Fruit / Starburst' product was current at the transaction date, and assign that product surrogate key to the transaction when it goes into the sale fact.
That is my understanding of late arriving facts.  Fact that arrive before the dimensions elements to handle them have arrive are surely early arriving facts, not late.  Maybe it's just a terminology thing.


text:
Q: error using np.buffer - TypeError: only integer scalar arrays can be converted to a scalar index I'm using the following tool in order to parse some data:
https://github.com/shuspieler/Athero-CSI-tool-Python-RemoteReceive-Liveview-AmplitudeScaled
Now I'm getting an error using numpy.buffer "TypeError: only integer scalar arrays can be converted to a scalar index"
This points to this line in the code:
 csi_buf = np.frombuffer(stream, np.uint8, csi_len, cur)
The complaint is that csi-length is not an integer as expected. When I print the value of csi_length, I get an integer. So if it is already an integer, why  do I get the error  complaining it isn't one?
I tried to manually input an integer into the function and I got the error:
"ValueError: buffer is smaller than requested size"


text:
Q: Project Euler #3 Java: Why count up to square root when finding the largest prime factor, rather than counting down from square root? I'm trying to solve problem 3 of project Euler and I have written the following code which gives me the correct answer
public class LargestPrimeFactor {
public static boolean isPrime(int p) {
    boolean isPrime = true;
    for (int i = 2; i < p / 2; i++) {
        if (p % i == 0) {
            return false;
        }
    }
    return isPrime;
}

public static double largestPrimeFactor(long n) {
    double factor = 0;

    for (int j=1; j<Math.sqrt(n); j++) {
        System.out.println("j is : "+ j);
        if (n % j == 0 && isPrime(j)) {
        factor = j;
        }
    }
    return factor;
}

public static void main(String args[]) {
    long limit = 600851475143L;
    System.out.println(largestPrimeFactor(limit));

}}

I was wondering wether it is a good idea to start at 1 and increase towards the square root, when we are looking for the largest factor. So I tried to change the for loop in the largestPrimeFactor(long n) method to start from the square root of n and count down. However now I get an incorrect answer. What is the reason for this?
public class LargestPrimeFactor {

public static boolean isPrime(int p) {
    boolean isPrime = true;
    for (int i = 2; i < p / 2; i++) {
        if (p % i == 0) {
            return false;
        }
    }
    return isPrime;
}

public static double largestPrimeFactor(long n) {
    double factor = 0;

    for (int j=(int)Math.sqrt(n); 1<j; j--) {
        System.out.println("j is : "+ j);

        if (n % j == 0 && isPrime(j)) {
            factor = j;
        }

    }
    return factor;
}

public static void main(String args[]) {
    long limit = 600851475143L;
    System.out.println(largestPrimeFactor(limit));

}}

A: You don't have a break after finding the first prime factor - the first you find is the largest and you shouldn't search any further. For that you should return the first correct value you find like this
public static double largestPrimeFactor(long n) {
    double factor = 0;

    for (int j=(int)Math.sqrt(n); 1<j; j--) {
        if (n % j == 0 && isPrime(j)) {
            return j; // Changed this line
        }

    }
    return factor;
}


text:
Q: Synchronization of onclick function from different devices The code I have is at http://www.lesha.wemakesites.ru/
What it does is givng out reversed string and counting times the servise was used.
What I wanna do is that once the page is opened and somebody runs the code on any other device I can see the total number changed without reloading the page.
To do so I'm using 2 ajax-requests of following view:
var ajax_result = $.ajax({
        url: 'count.php',
        method: 'post',
        success: function () {}
    })

    var ajax_write = $.ajax({
        url: 'count.txt',
        success: function (data) {
            document.getElementById("total_global").style.display = ("none");
            document.getElementById("global").style.display = ("inline");
            document.getElementById("global").style.color = ("red");
            document.getElementById("global").innerHTML = data;

        }

In count.php I have:
<?php
    $file = 'count.txt';
    $file_open = file_get_contents($file);
    $file_open = (int)$file_open;
    $file_open = $file_open + 1;
    file_put_contents($file, $file_open);
    echo($file_open);
    ?>

and after I dynamically show the result with js.
Nevertheless I don't see changes when I run it from my phone until I reload the page at my PC.


text:
Q: Stop sharing localStorage among servers behind a reverse-proxy (same-origin passes for all) Consider two backend servers:
https://server1.example.com
https://server2.example.com

When accessing these servers directly, they naturally have independent localStorage objects, since their origins are different; in this case the hostnames differ.
When I place these servers behind a reverse-proxy, they are accessed as follows:
https://proxy.example.com/server1
https://proxy.example.com/server2

To slightly complicate the picture, I have a front-end page on the
  proxy:
https://proxy.example.com

This front-end page lists the servers as hotlinks using HTML
  similar to:
Server1
Server2

Now, each of the servers proxy, server1 and server2 all pass the same-origin test, since they each have origin=https://proxy.example.com:443.  Consequently, the localStorage object is shared among them and this sharing is confusing the apps on server1 and server2.
Is there a way to disable sharing of localStorage between proxy, server1, and server2 in this configuration?
If not, are there methods in Javascript that will disable sharing between these entities?

A: There's no way as far as I know to have the browser segment localStorage based on anything other than the origin, and there's no way to change the origin other than changing the URL.
If your goal is to segment your stored data by site to avoid conflicts, you'll have to do that manually by assigning each site some unique key under which it can store it's data.
If your goal is to prevent server1 from reading/writing to server2's storage, that won't be possible without changing the server's origins.


text:
Q: jit assembler in C++, using C functions I'm developing a simple JIT Assembly system in C++, but, I whant to call C functions in this jit system, so, what I have thinked... I need the pointer of the command... but, I don't know how I can get this...
That is my code
#include <cstdio>
#include <vector>
#include <windows.h>

int Execute(std::vector<unsigned char> code)
{
    int eaxRegister;

    unsigned char* func = (unsigned char*)VirtualAlloc( 0, code.size() + 1, 0x1000, 0x40 );

    memcpy( func, code.data(), code.size() );
    func[code.size()] = 0xC3; // add the ret to the final of code final

    CallWindowProc( (WNDPROC)func, 0, 0, 0, 0 );

    _asm mov eaxRegister, eax;

    VirtualFree( func, code.size() + 1, 0x4000 );

    return eaxRegister;
}

int main()
{
    std::vector<unsigned char> code;

    //mov eax, 10
    code.push_back( 0xc7 );
    code.push_back( 0xc0 );
    code.push_back( 0xa );
    code.push_back( 0x0 );
    code.push_back( 0x0 );
    code.push_back( 0x0 );

    //mov ecx, 10
    code.push_back( 0xc7 );
    code.push_back( 0xc1 );
    code.push_back( 0xa );
    code.push_back( 0x0 );
    code.push_back( 0x0 );
    code.push_back( 0x0 );

    //add eax, ecx
    code.push_back( 0x3 );
    code.push_back( 0xc1 );

    // push MESSAGE
    const char* ohi = "HI";
    code.push_back( 0x69 );
    code.push_back( *ohi );

    // call prinf ?????
    code.push_back( 0xe8 );
    code.push_back( 0xfff/* offset of printf */ ) ;

    // add esp, 4
    code.push_back( 0x83 );
    code.push_back( 0xc4 );
    code.push_back( 0x04 );
    code.push_back( 0x0 );
    code.push_back( 0x0 );
    code.push_back( 0x0 );

    int exec = Execute( code );
    printf("SUM = %d", exec);

    return 0;
}

So, my problem is, how I can get the offset of printf command to use in JIT, or, how I can use the C function using the JIT ???
Thanks
Alexandre

A: printf (without parens) will evaluate to the address of the function printf, so you'd apparently want code.push_back(printf);
Edit: Of course, since you've defined code as a simple vector`, that won't work as-is. You'll need to push back the individual bytes of the address one at a time. Here's a quick demo, showing pushing it back, then printing out the results and showing that it's pretty much the same as you get by passing the address to printf and converting with %p:
#include <vector>
#include <stdio.h>
#include <iostream>

int main() {
    std::vector<unsigned char> code;

    auto a = printf;
    char *p = (char *) &a;

    printf("%p\n", printf);

    for (int i=0; i<sizeof(a); i++)
        code.push_back(*p++);

    for (int i=0; i<code.size(); i++)
        std::cout << std::hex << (unsigned int)code[i] << " ";
    return 0;
}

As you can see, %p shows the entire pointer together, whereas this shows one byte at a time. On Windows (little-endian hardware) this will result in the byte being in reverse order.

A: As Jerry notes, you can get the address of an extern "C" function by just using the name of the function.  The problem is, just putting that in your code stream does you no good -- you need to generate an actual CALL instruction.  To make matters worse, the normal CALL instruction on x86 (0xe8) uses PC-relative addressing, which you can't readily use, as you don't know what address your code will end up at (the value the eventual call to VirtualAlloc will return).  You can get around that by not using a PC-relative addressing mode:
void gen_call(std::vector<unsigned char> &code, void *address) {
    // mov eax,address
    code.push_back(0xb8);
    code.push_back((uint32_t)address & 0xff);
    code.push_back(((uint32_t)address >> 8) & 0xff);
    code.push_back(((uint32_t)address >> 16) & 0xff);
    code.push_back(((uint32_t)address >> 24) & 0xff);
    // call eax
    code.push_back(0xff);
    code.push_back(0xd0);
}

Also, your "push MESSAGE" code is wrong -- you're pushing the first character of the message, but what you really want is to push the address of the string.

A: I have solved the questio, I passed to use the reinterpret_cast
here my solution:
#include <cstdio>
#include <vector>
#include <windows.h>

using namespace std;

class Buffer: public vector<unsigned char>
{
public:
    void push_dword(DWORD dw)
    {
        push_back(dw);
        push_back(dw >> 8);
        push_back(dw >> 16);
        push_back(dw >> 24);
    }

    void push_ptr(const void *p)
    {
        push_dword(reinterpret_cast<DWORD>(p));
    }

    int Execute()
    {
        char *func = reinterpret_cast<char *>(VirtualAlloc(
            0, size() + 1, MEM_COMMIT, PAGE_EXECUTE_READWRITE ));

        memcpy( func, data(), size() );
        func[size()] = 0xC3; // add the ret to the final of code final

        int ret = (*reinterpret_cast<int(*)()>(func))();

        VirtualFree( func, 0, MEM_RELEASE );

        return ret;
    }
};

int main()
{
    Buffer code;

    // push MESSAGE
    const char* ohi = "HI\n";
    code.push_back( 0x68 );
    code.push_ptr( ohi );

    // mov eax, printf
    code.push_back( 0xb8 );
    code.push_ptr( reinterpret_cast<void *>(&printf) );

    // call eax
    code.push_back( 0xff );
    code.push_back( 0xd0 );

    // add esp, 4
    code.push_back( 0x83 );
    code.push_back( 0xc4 );
    code.push_back( 0x04 );

    int exec = code.Execute();
    printf("SUM = %d\n", exec);

    return 0;
}


text:
Q: Newtonsoft Json parse with different object names Currently, I am trying to parse some JSON I receive from an API. Here are some results I get back:
{
    "2": {
        "id": 2,
        "name": "Cannonball",
        "members": true,
        "sp": 5,
        "buy_average": 152,
        "buy_quantity": 358914,
        "sell_average": 151,
        "sell_quantity": 778131,
        "overall_average": 152,
        "overall_quantity": 1137045
    },
    "6": {
        "id": 6,
        "name": "Cannon base",
        "members": true,
        "sp": 187500,
        "buy_average": 184833,
        "buy_quantity": 9,
        "sell_average": 180518,
        "sell_quantity": 10,
        "overall_average": 182562,
        "overall_quantity": 19
    }
}

I need to parse it to a C# class. I tried copying the JSON and with paste special converting it to a class, but then it creates an class for every JSON object.
Does someone have any tips on how I can parse it so it's only 1 class? The properties are always the same, it is just the object "2": that is the problem.

A: The trick here is to deserialise to a Dictionary of your class type. For example:
public class Thing
{
    public int Id { get; set; }
    public string Name { get; set; }
    public bool Members { get; set; }
    // etc...
}

And now you would deserialise like this:
var result = JsonConvert.DeserializeObject<Dictionary<string, Thing>>(json);

Note: you could probably use Dictionary<int, Thing> here if it's guaranteed to be numbers.

A: The JSON you provided consists of two objects, not one. You can parse it into a Dictionary with JsonConvert.DeserializeObject<Dictionary<int, YourClass>>(jsonString). You will then have a dictionary with two entries, with keys 2 and 6.


text:
Q: onActivityResult() is not working in fragment " OUTPUT: You haven't picked Image " This is my code and when i run the code then output will be "**you haven't picked images"**
sdk which i use currently in this app
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.letsget.humanitysavior"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Here is the manifests permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Here is the fragment code
public class NewPostPublicFragment extends Fragment {

    public NewPostPublicFragment() {
        // Required empty public constructor
    }

    private int PICK_IMAGE_MULTIPLE = 3;
    String imageEncoded;
    List<String> imagesEncodedList;
    private GridView gvGallery;
    private NewPostImagesAdapter galleryAdapter;
    CarouselView carouselView;

    private ArrayList<Uri> mArrayUri;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_new_post_public, container, false);

        gvGallery = view.findViewById(R.id.gridview);
        ImageView selectimgicon = view.findViewById(R.id.selectimgicon);
        ImageView selectvideoicon = view.findViewById(R.id.selectvideoicon);
        ImageView selectcameraicon = view.findViewById(R.id.selectcameraicon);
        carouselView = view.findViewById(R.id.carouselview);
        final TextInputEditText postcategories = view.findViewById(R.id.postcategories);

        //carouselView.setPageCount(mThumbIds.length);
        //carouselView.setImageListener(imageListener);

        //for image selection
        selectimgicon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //LOGIC FOR PROFILE PICTURE
                selectImagesFromGallery();
            }
        });

        postcategories.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                final CharSequence[] items = { "Book", "Cloth", "Electronic", "Furniture", "Bag", "Social Post", "Other" };

                AlertDialog.Builder postCategoryBuilder = new AlertDialog.Builder(v.getContext(),AlertDialog.THEME_HOLO_LIGHT);
                postCategoryBuilder.setTitle("Select Post Category");
                postCategoryBuilder.setIcon(R.mipmap.categoryicon);
                postCategoryBuilder.setItems(items, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // the user clicked on colors[which]
                        postcategories.setText(items[which]);
                    }
                });
                postCategoryBuilder.show();
            }
        });

        return view;
    }

    ImageListener imageListener = new ImageListener() {
        @Override
        public void setImageForPosition(int position, ImageView imageView) {
            //imageView.setImageResource(mThumbIds[position]);
            imageView.setImageURI(mArrayUri.get(position));
        }
    };

    private void selectImagesFromGallery() {

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Image"), PICK_IMAGE_MULTIPLE);

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        try {

            Log.v(TAG, "requestCode=" + requestCode + ", resultCode = "+ resultCode + ", data = " + data);
            // When an Image is picked
            if (requestCode == PICK_IMAGE_MULTIPLE && resultCode == RESULT_OK && data != null) {
                // Get the Image from data

                String[] filePathColumn = { MediaStore.Images.Media.DATA };
                imagesEncodedList = new ArrayList<String>();
                if(data.getData()!=null){

                    Uri mImageUri = data.getData();

                    // Get the cursor
                    Cursor cursor = getActivity().getContentResolver().query(mImageUri,
                            filePathColumn, null, null, null);
                    // Move to first row
                    cursor.moveToFirst();

                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    imageEncoded  = cursor.getString(columnIndex);
                    cursor.close();

                    ArrayList<Uri> mArrayUri = new ArrayList<Uri>();
                    mArrayUri.add(mImageUri);
                    galleryAdapter = new NewPostImagesAdapter(getActivity().getApplicationContext(),mArrayUri);
                    gvGallery.setAdapter(galleryAdapter);
                    gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing());
                    ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery
                            .getLayoutParams();
                    mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);

                    carouselView.setPageCount(mArrayUri.size());
                    carouselView.setImageListener(imageListener);

                } else {
                    if (data.getClipData() != null) {
                        ClipData mClipData = data.getClipData();
                        ArrayList<Uri> mArrayUri = new ArrayList<Uri>();
                        for (int i = 0; i < mClipData.getItemCount(); i++) {

                            ClipData.Item item = mClipData.getItemAt(i);
                            Uri uri = item.getUri();
                            mArrayUri.add(uri);
                            // Get the cursor
                            Cursor cursor = getActivity().getContentResolver().query(uri, filePathColumn, null, null, null);
                            // Move to first row
                            cursor.moveToFirst();

                            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                            imageEncoded  = cursor.getString(columnIndex);
                            imagesEncodedList.add(imageEncoded);
                            cursor.close();

                            galleryAdapter = new NewPostImagesAdapter(getActivity().getApplicationContext(),mArrayUri);
                            gvGallery.setAdapter(galleryAdapter);
                            gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing());
                            ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery
                                    .getLayoutParams();
                            mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);

                        }
                        Log.v("LOG_TAG", "Selected Images" + mArrayUri.size());
                    }
                }
            } else {
                Toast.makeText(getContext(), "You haven't picked Image",
                        Toast.LENGTH_LONG).show();
            }
        } catch (Exception e) {
            Toast.makeText(getContext(), "Something went wrong", Toast.LENGTH_LONG)
                    .show();
        }
    }
}

when I run this app and tap on image button then it open the gallery and select the images after that when i press the done button then it's not display images it just display toast message you haven't picked images

A: Check these Steps:

*

*Give permission to use camera in AndroidManifest.xml

*Use this code to get image properly
  String RequestCode=123;

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
     {
         super.onActivityResult(requestCode, resultCode, data);

     if(requestCode == RequestCode && resultCode== RESULT.OK){
          //Here get your image code
     }

  }

*Also Check Toast in your OnActivityResult() method and check if condition is true or false. Probably your if condition is false that's why image is not received from gallery.


text:
Q: dot42 - http POST request with parameters I try to send POST request with parameters with this code:
 var uri = new Uri("http://127.0.0.1:81/login/login");
 var client = new DefaultHttpClient();
 var par = new BasicHttpParams();
 par.SetParameter("username", "admin")
 par.SetParameter("password", "****");
 var request = new HttpPost(uri);
 request.SetParams(par);
 var response = client.Execute(request);

But ASP.NET MVC  server do not receive this parameters in action method.

A: Adapt to this snippet: http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient
    var httpclient = new DefaultHttpClient();
    var nameValuePairs = new ArrayList<INameValuePair>(2);
    nameValuePairs.Add(new BasicNameValuePair("username", "admin"));
    nameValuePairs.Add(new BasicNameValuePair("password", "***"));

    var ent = new UrlEncodedFormEntity(nameValuePairs);
    httppost.SetEntity(ent);
    var response = httpclient.Execute(httppost);


text:
Q: how to get multiple input values with same id I have a tag plugin which creates hidden input value as the user enter desired name in the input
for e.g
If i enter hello then plugin will create this hidden input
<input id="nameinput" name="tag[27]" value="63" data-tag-id="63" type="hidden">

& if i enter hello1
<input id="nameinput" name="tag[61]" value="22" data-tag-id="22" type="hidden">

now i want to get their value only and want to submit through jquery ajax
by comma separated like this-> 63, 22 as the user can enter maximum 8 tags
i tried using
$("#nameinput").val(); but it didn't work

A: You can select them by custom attribute this way:
var tags = []
$('[data-tag-id]').each(function () {
    tags.push($(this).val())
})
alert(tags.join(','))}

But it's bad to have multiple elements with same id.


text:
Q: Can I protect a single Worksheet in excel to make it unviewable for other? I have a shift planner and it can be seen/used by anyone in order to mark down their shifts. I now have created a new Worksheet that calculates how many vacation days each employee has left in order to have a better overview. Since it is law that it should not be viewed by other employees,
I thought of giving that sheet a Password. When I set the Password however, anyone can still see the contents of the sheet.
How can I set it up, so that the sheet cannot be viewed as long as the Password is not correct?

A: You can make that sheet "very hidden".
Steps to do:

*

*save document as xlsm (with macros)

*open the vba-editor (ALT + F11)

*set the sheet to very hidden - "very hidden" means that it is not possible to unhide the sheet via the Excel-GUI (like a hidden sheet) - but only via the VBE-GUI.

To prevent users from unhiding via the VBA-Editor:

*

*Select Extras - VBA Project properties (Eigenschaften von VBA-Projekt)

*Go to the protection tab and choose to lock project plus add password.

(This protection only works if the file is stored as xlsm.)
Please be aware that there are lots of sources that explain how to crack the VBE-password. If someone wants to see the sheet he or she will be able to. An Excel-file will never be 100 % safe.


text:
Q: Advice on DB structure I am trying to make a database, but everytime I look at what I need and how to do it I think a different solution is better. I will describe my situation below and would like to know what would be the best way to go about and why:
I currently have an excel file with my requirements, it contains a list of categories, sub categories and respective questions that need filling in and the people they need to relate to. This would normally be a simple case of storing the category, subcategory in a table, linking it to a question table and then having an answer table that refers to the question and person table.
as such:
Person:
personID: int identifier
personName: nvarchar(50)

Info:
infoID: int identifier
infoCat: nvarchar(50)
infoSubCat: nvarchar(50)

Question
questionID: int identifier
questionText: nvarchar(100)
questionInfo: FK relating to infoID

Answer:
answerID: int identifier
answerQuestion: FK relating to questionID
answerPerson: FK relating to PersonID
answerNumber: int

The problem I'm facing here though, is that the answer is not always going to be a number. There are some questions that require me to store a bit or a text value.
The other solution I could think of is denormalising the question, having a table with Info and Question merged, and then a Answers table:
Answers:
AnswersID: int identifier
AnswersPerson: FK relating to PersonId
Answer1: int
Answer2: bit
Answer3: int
etc..

And finally I can also make the answer column have nvarchar instead of int, and just store numerical and boolean values in it as required. (This seems like the simplest solution, but I need to regulary back up the answers to a different DB where I have no control over, so I must ensure the values are transferable)
I am looking to find out what would be the best method for me, if it is one of the ones I have mentioned or one that I could not think of myself.
Thanks in advance.

A: You can serialize and desalinize any value to string and from string. And you can store value type to second field.
For example:
answerValueType: int
answerValue: nvarchar(255)

A: To resolve my problem, I used dasblinkenlight's suggestion of using sql_variant as type for my answer column. This result s in my answer table looking  like:
Answer:
answerID: int identifier
answerQuestion: FK relating to questionID
answerPerson: FK relating to PersonID
answerNumber: sql_variant

And it is working very well for my purpose.


text:
Q: phonegap file transfer with space in the file name I'm using Cordova 1.9.0 for an Android App. The same code, on IOS works fine.
On Android, i find a problem for the file trasfert from remote location to local.
The problem is on the file name: someone has space. I try to do
.replace(" ","%20")

but doesn't work. It gives me the following error
07-03 12:06:32.503: E/FileTransfer(337): java.io.FileNotFoundException: http://www.mydomain.com/sa02 -.jpg

A: There was a bug in FileTransfer upload which a fix was checked in for 1.9.0.
https://issues.apache.org/jira/browse/CB-978

A: PhoneGap 1.9.0 and 2.0.0 break fileTransfer.download() for names with spaces.
The workaround for now until PhoneGap 2.1.0 comes out is
var source = encodeURI(file path here);
source = source.replace(/%/g,"%25");

A: url = url.replace(/ /g,"%20");


text:
Q: How to get VBA Function to store cell address values instead of values at these cell address I know this is a very unusual question, it will probably not make sense to you why I want to do this but...
This happens if the value in cell A1 is 5:
Myfunction(A1): outputs 5
In vba module:
Function Test(array As String)
   Test=array
End function

Examples of what I want:
Myfunction(A1): outputs string "A1"
Or
Myfunction(A1:B3): outputs string "A1:B3"
Or
Myfunction(A1:B3 & B5:B9): outputs string "A1:B3 & B5:B9"
How do I get the vba function to do this. Basically I want the function to store the cell address as a string and not the values located at the cell address locations. I know you can use "A1:A4" when you enter the values into the function or something along those lines but that's not what I'm looking for. Also this is for a function not a sub.

A: ParamArray
Understanding parameter arrays

*

*In Excel, to select a multiarea range, select the first range, then hold down CTRL while selecting the next ranges.

*In Excel use e.g. =RangeAddress(A1:A5,C3:C7,Z11:Z75).

The Code
Option Explicit

Function RangeAddress( _
    ParamArray rg() As Variant) _
As String
    Dim arg As Variant
    If UBound(rg) = 0 Then
        RangeAddress = rg(0).Address(0, 0)
    Else
        Dim n As Long
        For Each arg In rg
            RangeAddress = RangeAddress & arg.Address(0, 0) & " & "
        Next arg
        RangeAddress = Left(RangeAddress, Len(RangeAddress) - 3)
    End If
End Function

A: Not sure if this is what you're looking for, but you can try something like this:
Function MyFunction(rng as range) as string
   MyFunction = cstr(rng.address)
end function

Go to your sheet, select any cell or cells.
In your immediate window, type: ?MyFunction(selection)


text:
Q: Rx() missing argument - Flutter / GetX While using a GetxController on a class, and using Rx to get a FirebaseUser, I'm being shown an error, that I'm missing a positional argument
class AuthController extends GetxController {
  FirebaseAuth _auth = FirebaseAuth.instance;
  Rx<User> _firebaseUser = Rx<User>();
  User get user => _firebaseUser.value;

Here on this Rx<User>() which is from package:firebase_auth/firebase_auth.dart, I get the error :
1 positional argument(s) expected, but 0 found.
Try adding the missing arguments.dartnot_enough_positional_arguments
After launching the emulator, I get this more detailed error :
lib/core/controllers/auth_controller.dart:9:36: Error: Too few positional arguments: 1 required, 0 given.
Rx _firebaseUser = Rx();
../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.1.3/lib/get_rx/src/rx_types/rx_core/rx_impl.dart:324:3: Context: Found this candidate, but the arguments don't match.
Rx(T initial) : super(initial);
I can't find what I'm supposed to add here, and every tutorial I saw, didn't specify any argument here.
Anyone knows the problem ?

A: If you run with null safety, try it
 Rxn<User> firebaseUser = Rxn<User>();

https://pub.dev/documentation/get/latest/get_rx/get_rx-library.html

A: This may have something to do with how you're creating a custom observable object. If you check out the GetX docs, this is the suggested way to do what you're doing. Search for "model" on that page.
class AuthController extends GetxController {
  FirebaseAuth _auth = FirebaseAuth.instance;
  final firebaseUser = User().obs;
}

Also be aware that using getters and setter here is of no value. See this link for an explanation as to why
If that doesn't fix it, then try sharing your User class, and the rest of the Getx class, and how you're trying to access the firebaseUser from outside.

A: i was facing this issue but i changed getx package to 3.26.0  solved the issue


text:
Q: Python AttributeError: 'module' object has no attribute 'Goslate' I am trying Goslate: Free Google Translate API. I installed goslate using sudo pip install goslate
I wrote a simple program and executed it using python getbn.py command in my terminal.
Here is the code inside getbn.py:
import goslate
gs = goslate.Goslate()
print(gs.translate('hello world', 'bn'))

After executing the command python getbn.py I got the following errors:
Traceback (most recent call last):
  File "getbn.py", line 1, in <module>
    import goslate
  File "/home/ubuntu/Desktop/goslate.py", line 2, in <module>
    # -*- coding: utf-8 -*-
AttributeError: 'module' object has no attribute 'Goslate'

Then I tried to run the program by executing python3 getbn.pycommand, and I found the following errors:
Traceback (most recent call last):
  File "getbn.py", line 1, in <module>
    import goslate
ImportError: bad magic number in 'goslate': b'\x03\xf3\r\n'

How do I fix it? And why are there two different types of erros?

A: You have a file called goslate.py in your Desktop folder
File "/home/ubuntu/Desktop/goslate.py", line 2, in <module>
      ^^^^^^^^^^^^^^^^^^^^

This is not the module you installed using pip and it's getting in the way of the import.

A: You May have simple installed goslate, but you may be using different virtual env. Try to switch to that virtual env, and then run again.


text:
Q: Global variable not behaving as expected
That is the problem I'm trying to solve. (Given a 2n length string of distinct characters I have to divide it in 2 parts in all possible ways without repeating groups).
The method I used is:

*

*Generate all permutations of string.

*Store acceptable permutations (I am generating "hauy" and "hayu" both but only storing one of them).

*Check newly generated permutations against stored ones to filter out duplicates.

*Print

(I realize that there might be better ways of doing this)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

char *b[100000000];
int bSize = 0;
void print(char *a)
{
    int k = strlen(a);
    printf("M: ");
    for(int i=0 ; i<k/2 ; i++)
    {
        printf("%c ", a[i]);
    }
    printf("| B: ");
    for(int i=0 ; i<k/2 ; i++)
    {
        printf("%c ", a[k/2 + i]);
    }
    printf("\n");
}
void check(char *a)
{
    int k = strlen(a);
    for(int i=0 ; i<bSize ; i++)
    {
        int c = 0;
        for(int j=0 ; j<k/2 ; j++)
        {
            for(int m=0 ; m<k/2 ; m++)
            {
                if(a[m] == b[i][j])
                {
                    c++;
                    break;
                }
            }
        }
        for(int j=0 ; j<k/2 ; j++)
        {
            for(int m=0 ; m<k/2 ; m++)
            {
                if(a[m + k/2] == b[i][j + k/2])
                {
                    c++;
                    break;
                }
            }
        }
        if(c == k)
        {
            break;
        }
        else
        {
            b[bSize] = a;
            bSize++;
            print(a);
        }
    }
}
void swap(char *a, char *b)
{
    char temp = *a;
    *a = *b;
    *b = temp;
}
void permute(char *a, int start, int end)
{
    if(start == end)
        if(bSize == 0)
        {
            print(a);
            b[bSize] = a;
            bSize++;
        }
        else
            check(a);
    else
    {
        for(int i=start ; i<=end ; i++)
        {
            swap((a+start), (a+i));
            permute(a, start+1, end);
            swap((a+start), (a+i));
        }
    }
}
int main()
{
    int n;
    scanf("%d", &n);
    char f;
    scanf("%c", &f);
    char A[n];
    for(int i=0 ; i<n-2 ; i++)
    {
        char c;
        scanf("%c", &c);
        if(c == ' ' || c == 'M' || c == 'B')
            i--;
        else
            A[i] = c;
    }
    A[n-2] = '\0';
    permute(A, 0, n-3);
    return 0;
}

When I run this only 1 line is given as output. I think the error is with b[]. In the check function b[0] and a always turn out to be equal. And bSize never goes beyond 1. I am unable to understand why.

A: b[bSize] = a; stores the value of a in b[bSize]. a is a pointer to the first element of the array A defined in main. So you are not storing individual strings, just a pointer to A, and that pointer never changes.
To use this algorithm, you must copy each string. That requires changes to how b is defined and how strings are compared. (You cannot compare strings with ==.)
(There is however, a much better algorithm for this task that does not require generating all permutations.)


text:
Q: Oracle Virtual Box Appliance import I am running Ubuntu 16.04 LTS. I am trying to use Oracle VM to load a Kali Linux operating system and get an error that I see is quite common with a lot of other people online. The thing is that most people run Windows and the solutions end up irrelevant to my case. I will include a screenshot of the exact issue I am getting. I have tried to update, uninstall and install again. Still, the very same issue persists. Any assistance would be greatly appreciated since I do not know what else to do.
Thank you in advance.

A: The screenshot indicates that the download is probably corrupted. You can verify the checksum of the downloaded OVA file by running the following command in the terminal
sha256sum kali-linux-2019.3-vbox-amd64.ova

The generated checksum should match with what is published on the page from where you downloaded this image. If the checksum does not match, then you will need to download the image again.


text:
Q: Chargify how can get total transactions of between two dates? Currently, i am getting only 20 transactions per pages and can be extends only 200 but i need all transaction between that dates no paging.
Or if it possible to get count of transactions.?
How can i archive?
Thanks

A: I would use the following to retrieve all transactions for a subscription:
bool isFinished = false;
int counter = 1;
var results = new Dictionary<int, ITransaction>();
while (!isFinished)
{
    // Get results
    var transactions = chargify.GetTransactionsForSubscription(activeSubscription.SubscriptionID, counter++, 20);

    // Check condition
    if (transactions.Count == 0) { isFinished = true; continue; }

    // Merge results
    transactions.ToList().ForEach(x => results.Add(x.Key, x.Value));
}

That should get all the transactions and merge them all into the single dictionary. :) If need to use dates, then just switch the data retrieval line to something like this:
var transactions = chargify.GetTransactionsForSubscription(activeSubscription.SubscriptionID, counter++, 20, null, int.MinValue, int.MinValue, DateTime.Today, DateTime.Now); (just switch to your dates).


text:
Q: How to bring the text of a textfield to the front of gradient background in swift I'm rather new to swift.
I have three UItextFields  with gradient backgrounds. Because the background was not fixed to the size of field, I had to put the gradientSet in a  viewDidLayoutSubviews function. it was like that:

 Now size of background is almost ok, but another problem raised. The thing is when I'm typing inside the field, it does not show the text until I go to next field. How should I fix that? Additionally, please tell me what is wrong with the background of smallest field??

Part of my code is :
class phoneverify: UIViewController , UITextFieldDelegate{

@IBOutlet weak var studentNo: UITextField!

@IBOutlet weak var phoneNo: UITextField!
@IBOutlet weak var codeNo: UITextField!

 override func viewDidLoad() {
        super.viewDidLoad()

        let textfieldBorderColor = UIColor(red: 141/255, green: 231/255, blue: 201/255, alpha: 1)
        let barColor = UIColor(red: 73/255, green: 132/255, blue: 109/255, alpha: 1)

        phoneNo.layer.borderWidth = 3
        phoneNo.layer.borderColor = textfieldBorderColor.cgColor
        phoneNo.layer.cornerRadius = 6

        codeNo.layer.borderWidth = 3
        codeNo.layer.cornerRadius = 6
        codeNo.layer.borderColor = textfieldBorderColor.cgColor
        codeNo.isUserInteractionEnabled = false

        studentNo.layer.borderWidth = 3
        studentNo.layer.borderColor = textfieldBorderColor.cgColor
        studentNo.layer.cornerRadius = 6

        self.phoneNo.delegate = self
        self.studentNo.delegate = self
    }

    override func viewDidLayoutSubviews() {
        codeNo.setGradient(startColor:UIColor.gray, endColor: UIColor.white)
        phoneNo.setGradient(startColor:UIColor.gray, endColor: UIColor.white)
        studentNo.setGradient(startColor:UIColor.gray, endColor: UIColor.white)
    }
extension UITextField {
    func setGradient(startColor:UIColor,endColor:UIColor) {
        let gradient:CAGradientLayer = CAGradientLayer()
        gradient.colors = [startColor.cgColor, endColor.cgColor]
        gradient.frame = self.bounds
        gradient.cornerRadius = 6
        self.layer.addSublayer(gradient)
    }
}

Thanks in advance.

A: The gradient hides the text because you are adding the CAGradientLayer on top of all the other layers of the UITextField when you call addSublayer. It might work when using insertSublayer(_:at:) (docs) to insert the layer below all other layers.
extension UITextField {
    func setGradient(startColor:UIColor,endColor:UIColor) {
        let gradient:CAGradientLayer = CAGradientLayer()
        gradient.colors = [startColor.cgColor, endColor.cgColor]
        gradient.frame = self.bounds
        gradient.cornerRadius = 6
        self.layer.insertSublayer(gradient, at: 0)
    }
}

The gradient extending outside of the text fields is because they do no automatically resize when the text field frame updates. Also, you are now adding a new gradient layer when the subviews are laid out.
To solve this, you can create a subclass of UITextField, override layoutSubviews, insert the gradient layer there if needed, and then adjust its size to match the bounds.


text:
Q: Connection refused [Tarantool + java client] When i'm trying to connect to tarantool server i get the following error:

Exception in thread "main" java.net.ConnectException: Connection
  refused: connect  at java.net.DualStackPlainSocketImpl.connect0(Native
  Method)   at
  java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at
  java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at
  java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at
  java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)   at
  java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)    at
  java.net.Socket.connect(Socket.java:589)  at
  java.net.Socket.connect(Socket.java:538)  at
  java.net.Socket.(Socket.java:434)   at
  java.net.Socket.(Socket.java:211)   at
  TarantoolKt.main(Tarantool.kt:37)

My code:
class Tarantool {
    val client: TarantoolClient

    init {
        val config: TarantoolClientConfig = TarantoolClientConfig()
        config.apply {
            username = "test"
            password = "test"
        }

        val socketChannelProvider: SocketChannelProvider = SocketChannelProvider { _, p1 ->
            when(p1) {
                null -> {
                    println("Trying to connect . . .")
                    SocketChannel.open(InetSocketAddress("192.168.1.254", 3301)) // <- error
                }
                else -> {
                    p1.printStackTrace(System.out)
                    null!!
                }
            }
        }

        client = TarantoolClientImpl(socketChannelProvider, config)
    }
}

fun main(args: Array<String>): Unit {
    val client: Tarantool = Tarantool()
    println(client.client.isAlive)
}

I get the same error when i'm trying to use different ip
It's the same as in tutorial here: https://github.com/tarantool/tarantool-java/
I'd also created the test user using this commands:
box.schema.user.create('test', { password = 'test' })
box.schema.user.grant('test', 'execute,read,write', 'universe')

I use docker for tarantool and i tried to ping IPs from windows 7 cmd and it works.
Thank you!
SOLVED


text:
Q: React native method is undefined I'm trying to call signInWithFacebook method inside AccessToken.getCurrentAccessToken() but getting signInWithFacebook is undefined. The method works fine if I call it outside the LoginManager.logInWithReadPermissions function. I cannot seem to able to call any method inside the LoginManager.logInWithReadPermissions
I'm new to react native please help. Thanks.

const FBSDK = require('react-native-fbsdk');
const {
  LoginManager,
  AccessToken,
} = FBSDK;
import React from 'react';
import { Text, View, TouchableOpacity, Image } from 'react-native';

import { connect } from 'react-redux';

import { firebaseActions as auth } from "../actions";
const { signInWithFacebook } = auth;

class FacebookLogin extends React.Component {
  constructor() {
    super();

    this.onSuccess = this.onSuccess.bind(this);
    this.onError = this.onError.bind(this);
    this.onSignInWithFacebook = this.onSignInWithFacebook.bind(this);
  }

  async onSignInWithFacebook() {

    LoginManager.logInWithReadPermissions(["public_profile"]).then(
      function (result) {
        if (result.isCancelled) {
          console.log("Login was Cancelled");
        } else {

          AccessToken.getCurrentAccessToken().then(
            (data) => {
              this.props.signInWithFacebook(data.accessToken, this.onSuccess, this.onError);
            }
          );
        }
      },
      function (error) {
        console.log("An error has occured" + error);
      }
    );

  }

  onSuccess({ exists, user }) {
    console.log(
      "Login Success"
    );

  }

  onError(error) {
    console.log(error.message);
  }

  render() {
    return (
      <View>
        <TouchableOpacity
          onPress={this.onSignInWithFacebook}
        >
          <Text>Login</Text>
        </TouchableOpacity>
      </View>
    );
  }
}

export default connect(null, { signInWithFacebook })(FacebookLogin);

A: for this only add one line to your code as:--
async onSignInWithFacebook() {
    const _this = this;
    LoginManager.logInWithReadPermissions(["public_profile"]).then(
      function (result) {
        if (result.isCancelled) {
          console.log("Login was Cancelled");
        } else {

          AccessToken.getCurrentAccessToken().then(
            (data) => {
              _this.props.signInWithFacebook(data.accessToken, this.onSuccess, this.onError);
            }
          );
        }
      },
      function (error) {
        console.log("An error has occured" + error);
      }
    );

  }

In your code LoginManager emitting a event so your this scope is changed and you got undefined  signInWithFacebook..
notes:--
When attaching a function using addEventListener() the value of this is changed...

A: Things changed in the last versions.
logInWithReadPermissions is a method from old react-native-fbsdk version 0.8.0.
logInWithPermissions should be used since react-native-fbsdk version 0.10.0.


text:
Q: Loading multiple SpatiaLite layers into a single database I have many SpatiaLite layers, each in a separate database. I want to load all these SpatiaLite layers into a single database. How can this be done?

A: If they are SpatiaLite layers, they are already in a database. If you meant that they are in different databases (which you did not stated in your original question), you can use the DB Manager plugin, just expand your SpatiaLite connections in the Tree and drag & drop the SpatiaLite layers you want to import from each DB to your target DB.


text:
Q: Inline functions in C#? How do you do "inline functions" in C#? I don't think I understand the concept. Are they like anonymous methods? Like lambda functions?
Note: The answers almost entirely deal with the ability to inline functions, i.e. "a manual or compiler optimization that replaces a function call site with the body of the callee." If you are interested in anonymous (a.k.a. lambda) functions, see @jalf's answer or What is this 'Lambda' everyone keeps speaking of?.

A: Inline methods are simply a compiler optimization where the code of a function is rolled into the caller.
There's no mechanism by which to do this in C#, and they're to be used sparingly in languages where they are supported -- if you don't know why they should be used somewhere, they shouldn't be.
Edit: To clarify, there are two major reasons they need to be used sparingly:

*

*It's easy to make massive binaries by using inline in cases where it's not necessary

*The compiler tends to know better than you do when something should, from a performance standpoint, be inlined

It's best to leave things alone and let the compiler do its work, then profile and figure out if inline is the best solution for you.  Of course, some things just make sense to be inlined (mathematical operators particularly), but letting the compiler handle it is typically the best practice.

A: Yes Exactly, the only distinction is the fact it returns a value.
Simplification (not using expressions):
List<T>.ForEach Takes an action, it doesn't expect a return result.
So an Action<T> delegate would suffice.. say:
List<T>.ForEach(param => Console.WriteLine(param));

is the same as saying:
List<T>.ForEach(delegate(T param) { Console.WriteLine(param); });

the difference is that the param type and delegate decleration are inferred by usage and the braces aren't required on a simple inline method.
Where as
List<T>.Where Takes a function, expecting a result.
So an Function<T, bool> would be expected:
List<T>.Where(param => param.Value == SomeExpectedComparison);

which is the same as:
List<T>.Where(delegate(T param) { return param.Value == SomeExpectedComparison; });

You can also declare these methods inline and asign them to variables IE:
Action myAction = () => Console.WriteLine("I'm doing something Nifty!");

myAction();

or
Function<object, string> myFunction = theObject => theObject.ToString();

string myString = myFunction(someObject);

I hope this helps.

A: Update: Per konrad.kruczynski's answer, the following is true for versions of .NET up to and including 4.0.
You can use the MethodImplAttribute class to prevent a method from being inlined...
[MethodImpl(MethodImplOptions.NoInlining)]
void SomeMethod()
{
    // ...
}

...but there is no way to do the opposite and force it to be inlined.

A: Finally in .NET 4.5, the CLR allows one to hint/suggest1 method inlining using MethodImplOptions.AggressiveInlining value. It is also available in the Mono's trunk (committed today).
// The full attribute usage is in mscorlib.dll,
// so should not need to include extra references
using System.Runtime.CompilerServices;

...

[MethodImpl(MethodImplOptions.AggressiveInlining)]
void MyMethod(...)

1. Previously "force" was used here. I'll try to clarify the term. As in the comments and the documentation, The method should be inlined if possible. Especially considering Mono (which is open), there are some mono-specific technical limitations considering inlining or more general one (like virtual functions). Overall, yes, this is a hint to compiler, but I guess that is what was asked for.

A: The statement "its best to leave these things alone and let the compiler do the work.."   (Cody Brocious)  is complete rubish.  I have been programming high performance game code for 20 years, and I have yet to come across a compiler that is 'smart enough' to know which code should be inlined (functions) or not.   It would be useful to have a "inline" statement in c#, truth is that the compiler just doesnt have all the information it needs to determine which function should be always inlined or not without the "inline" hint.  Sure if the function is small (accessor) then it might be automatically inlined, but what if it is a few lines of code?   Nonesense, the compiler has no way of knowing, you cant just leave that up to the compiler for optimized code (beyond algorithims).

A: You're mixing up two separate concepts. Function inlining is a compiler optimization which has no impact on the semantics. A function behaves the same whether it's inlined or not.
On the other hand, lambda functions are purely a semantic concept. There is no requirement on how they should be implemented or executed, as long as they follow the behavior set out in the language spec. They can be inlined if the JIT compiler feels like it, or not if it doesn't.
There is no inline keyword in C#, because it's an optimization that can usually be left to the compiler, especially in JIT'ed languages. The JIT compiler has access to runtime statistics which enables it to decide what to inline much more efficiently than you can when writing the code. A function will be inlined if the compiler decides to, and there's nothing you can do about it either way. :)

A: There are occasions where I do wish to force code to be in-lined.
For example if I have a complex routine where there are a large number of decisions made within a highly iterative block and those decisions result in similar but slightly differing actions to be carried out. Consider for example, a complex (non DB driven) sort comparer where the sorting algorythm sorts the elements according to a number of different unrelated criteria such as one might do if they were sorting words according to gramatical as well as semantic criteria for a fast language recognition system.  I would tend to write helper functions to handle those actions in order to maintain the readability and modularity of the source code.
I know that those helper functions should be in-lined because that is the way that the code would be written if it never had to be understood by a human. I would certainly want to ensure in this case that there were no function calling overhead.

A: Cody has it right, but I want to provide an example of what an inline function is.
Let's say you have this code:
private void OutputItem(string x)
{
    Console.WriteLine(x);

    //maybe encapsulate additional logic to decide
    // whether to also write the message to Trace or a log file
}

public IList<string> BuildListAndOutput(IEnumerable<string> x)
{  // let's pretend IEnumerable<T>.ToList() doesn't exist for the moment
    IList<string> result = new List<string>();

    foreach(string y in x)
    {
        result.Add(y);
        OutputItem(y);
    }
    return result;
}

The compilerJust-In-Time optimizer could choose to alter the code to avoid repeatedly placing a call to OutputItem() on the stack, so that it would be as if you had written the code like this instead:
public IList<string> BuildListAndOutput(IEnumerable<string> x)
{
    IList<string> result = new List<string>();

    foreach(string y in x)
    {
        result.Add(y);

        // full OutputItem() implementation is placed here
        Console.WriteLine(y);
    }

    return result;
}

In this case, we would say the OutputItem() function was inlined.  Note that it might do this even if the OutputItem() is called from other places as well.
Edited to show a scenario more-likely to be inlined.

A: Do you mean inline functions in the C++ sense?  In which the contents of a normal function are automatically copied inline into the callsite?  The end effect being that no function call actually happens when calling a function.
Example:
inline int Add(int left, int right) { return left + right; }

If so then no, there is no C# equivalent to this.
Or Do you mean functions that are declared within another function?  If so then yes, C# supports this via anonymous methods or lambda expressions.
Example:
static void Example() {
  Func<int,int,int> add = (x,y) => x + y;
  var result = add(4,6);  // 10
}

A: I know this question is about C#. However, you can write inline functions in .NET with F#. see: Use of `inline` in F#

A: No, there is no such construct in C#, but the .NET JIT compiler could decide to do inline function calls on JIT time. But i actually don't know if it is really doing such optimizations.
(I think it should :-))

A: In case your assemblies will be ngen-ed, you might want to take a look at TargetedPatchingOptOut. This will help ngen decide whether to inline methods. MSDN reference
It is still only a declarative hint to optimize though, not an imperative command.

A: Lambda expressions are inline functions! I think, that C# doesn`t have a extra attribute like inline or something like that!


text:
Q: Highlight only current on single pages Goodmorning,
I tried to highlight the childs also in the navigation. I came up with this code. It works, but it will highlight all menu items in a row. What do I wrong or forget to add:
function add_custom_class($classes=array(), $menu_item=false) {
    if ( !is_page() == $menu_item->title &&
            !in_array( 'current-menu-item', $classes ) ) {
        $classes[] = 'current-menu-item';
    }
    return $classes;
}
add_filter('nav_menu_css_class', 'add_custom_class', 100, 2);