text:
Q: Node MySQL execute multiple queries the fastest possible Which is the fastest method gets the query to MYSQL, and then comes back to output:

console.log('queries finished', results)"

Is there an even better method? Please explain your answer!
Thanks!
Method 1:
var connection = mysql.createConnection({multipleStatements: true});

connection.query('SELECT ?; SELECT ?', [1, 2], function(err, results) {
  if (err) throw err;

  console.log('queries done', results);
});

Method 2:
const Db = mysql.createPool({
    connectionLimit: 7,
    dateStrings: true,
    multipleStatements: true
});

Db.getConnection(function(err, connection) {
    if(err) console.log(err);

    connection.query(`
        SELECT "1" AS "first";
        SELECT "2" AS "second";`, function(err, results) {
            connection.release();

            if(err) console.log(err);
            console.log('queries done', results);
        }

    );

});

Method 3:
const Db = mysql.createPool({
    connectionLimit: 7,
    dateStrings: true,
    multipleStatements: true
});

Db.getConnection(function(err, connection) {
    async.parallel([
        function(callback) {
            connection.query(`
                SELECT "1" AS "first"`, function(err, done) {
                    callback(err, done);
                }
            );
        },

        function(callback) {
            connection.query(`
                SELECT "2" AS "second"`, function(err, done) {
                    callback(err, done);
                }
            );
        }
    ], function(err, results) {
        connection.release();
        if(err) console.log(err);

        console.log('queries finished', results);
    });
});

Method 4:
const Db = mysql.createPool({
    connectionLimit: 7,
    dateStrings: true,
    multipleStatements: true
});

async.parallel([
    function(callback) {
        Db.getConnection(function(err, connection) {
            connection.query(`
                SELECT "1" AS "first"`, function(err, done) {
                    connection.release();
                    callback(err, done);
                }
            );
        });
    },
    function(callback) {
        Db.getConnection(function(err, connection) {
            connection.query(`
                SELECT "2" AS "second"`, function(err, done) {
                    connection.release();
                    callback(err, done);
                }
            );
        });
    }
], function(err, results) {
    if(err) console.log(err);
    console.log('queries finished', results);
});

And I didn't post it, but method 3 and 4 could also be done a without connection pool as well. There's also promises over using the npm module async, what is the fastest and why!? Thanks.

A: Of the four above options using 3 real queries in my app, that each take about 1-3 seconds each to execute, method 3 ended up being the fastest for anyone interested.
Method 1 and 2 were about a full 1/2 second slower, and method 4 was only super slightly slower.
Edit: I did these benchmarks by using the console.time('query') suggestion in the comments above.

A: Method 1 and 2 are similar except that Pool creates a connection if all connections in the pool are used.
To determine which is faster, you need to know the computing power vs network bandwidth between your application server and your database server.
Here's why:
In method 1 and 2, you are using a single connection to execute multiple queries. If the processing power of the database machine is faster than then network bandwidth to send/receive multiple queries, then method 1 and 2 is more efficient. If the processing power of the database machine is slower than the bandwidth(e.g. both application / mysql server resides on the same machine), then method 3 and 4 will theoretically be faster.
Another factor is whether the statements depend on one another. Because step 1 and 2 essentially runs the statements synchronously, the entire set of operation is an atomic / consistent operation. For method 3 and 4, because they run asynchronously although they are triggered in parallel, there can be instances where a later statement complete earlier than an earlier statement. If that happens and there's dependency, method 3 and 4 will corrupt your data.
TL;DR

*

*Fast + Synchronous (insert/update, then select results) =
Method 1, 2 (Use pooling to reduce the need to open new connections)

*Fast + Asynchronous(mass inserts) = Method 3, 4

*Slow connection between application/database server = Method 1,2


text:
Q: Problems with IE 11 when using a Bootstrap carousel together with youtube iframe api I am working on a small wordpress template which should allow the admin to create a bootstrap carousal with youtube videos. The carousal should stop when a video is played and the video playing should stop if the user click to the next slide.
It works well in most browsers I have tested in (chrome,firefox and safari), but I have two problems in IE 11.

*

*When I try to use functions such as player.pauseVideo() I get the error 'object doesn't support property or method 'pauseVideo'.

*The second problem is when the carousal display an iframe for the second time. In this case a black screen with play button is displayed rather than the image displayed before a video is played. When you click the play button the video load as it should.

I am pretty new in this field so I hope someone can help. I have posted the code below.
UPDATE:
I uninstalled the IE 11 update so i am back to IE 10 and now the first problem i gone... So i will try and update againg.
HTML:

        <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
        <div class="video-container darkBlueBorder item <?php if( $the_query->current_post == 0 ):?>active<?php endif; ?>" >
            <div class="musicVideo" id="<?php echo get_post_meta($post->ID, "youtube_url", true) ?>">

<?php the_title(); ?>

        <?php endwhile; endif; ?>
        <?php wp_reset_query(); ?>

JS:
//Start Carousel
jQuery('.carousel').carousel({
    interval: 5000
});

//Start Youtube API
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

var youtubeReady = false;

//Variable for the dynamically created youtube players
var players= new Array();

function onYouTubeIframeAPIReady(){
youtubeReady = true;
//The id of the iframe is the same as the videoId
jQuery(".musicVideo").each(function(i, obj) {
    players[obj.id] = new YT.Player(obj.id, {
        videoId: obj.id,
        playerVars: {
            controls: 0,
            showinfo: 0 ,
            wmode: "opaque"
         },
        events: {
            'onStateChange': onPlayerStateChange
        }
    });
 });
}

jQuery('.carousel').bind('slide.bs.carousel', function (e) {
    if(youtubeReady){
        var iframeID = jQuery(this).find('.active').find('iframe').attr("id");
        window.alert(iframeID);
        players[iframeID].pauseVideo();
        jQuery('.carousel').carousel('cycle');
    }
});

function onPlayerStateChange(event) {
    switch(event.data){
        case 0:
            jQuery('.carousel').carousel('cycle');
            break;
        case 1:
            jQuery('.carousel').carousel('pause');
            break;
        default:
            console.log("otherwise");
            break;
        }
    }
}

A: Update:
I solved the problem with the black preview images by forcing the youtube player to be an html5 player. This also solved some serious framerate issues i had in IE. So I simply added "html5: 1" to the playerVars.

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is ID3D12GraphicsCommandList::DiscardResource? What exactly should I expect to happen when using DiscardResource?
What's the difference between discard and destroying/deleting a resource.
When is a good time/use-case to discard a resource?
Unfortunately Microsoft doesn't seem to say much about it other than it "discards a resource".

A: TL;DR: Is a rarely used function that provides a driver hint related to handling clear compression structures. You are unlikely to use it except based on specific performance advice.
DiscardResource is the DirectX 12 version of the Direct3D 11.1 method. See Microsoft Docs
The primary use of these methods it to optimize the performance of tiled-based deferred rasterizer graphics parts by discarding the render target after present. This is a hint to the driver that the contents of the render target are no longer relevant to the operation of the program, so it can avoid some internal clearing operations on the next use.
For DirectX 11, this is in the DirectX 11 App template to use DiscardView because it makes use of DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:
void DX::DeviceResources::Present()
{
    // The first argument instructs DXGI to block until VSync, putting the application
    // to sleep until the next VSync. This ensures we don't waste any cycles rendering
    // frames that will never be displayed to the screen.
    DXGI_PRESENT_PARAMETERS parameters = { 0 };
    HRESULT hr = m_swapChain->Present1(1, 0, &parameters);

    // Discard the contents of the render target.
    // This is a valid operation only when the existing contents will be entirely
    // overwritten. If dirty or scroll rects are used, this call should be removed.
    m_d3dContext->DiscardView1(m_d3dRenderTargetView.Get(), nullptr, 0);

    // Discard the contents of the depth stencil.
    m_d3dContext->DiscardView1(m_d3dDepthStencilView.Get(), nullptr, 0);

    // If the device was removed either by a disconnection or a driver upgrade, we
    // must recreate all device resources.
    if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
    {
        HandleDeviceLost();
    }
    else
    {
        DX::ThrowIfFailed(hr);
    }
}

The DirectX 12 App template doesn't need those explicit calls because it uses DXGI_SWAP_EFFECT_FLIP_DISCARD.

If you are wondering why the DirectX 11 app doesn't just use DXGI_SWAP_EFFECT_FLIP_DISCARD, it probably should. The DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL swap effect was the only one supported by Windows 8.x for Windows Store apps, which is when DiscardView was introduced. For Windows 10 / DirectX 12 / UWP, it's probably better to always use DXGI_SWAP_EFFECT_FLIP_DISCARD unless you specifically don't want the backbuffer discarded.

It is also useful for multi-GPU SLI / Crossfire configurations since the clearing operation can require synchronization between the GPUs. See this GDC 2015 talk
There are also other scenario-specific usages. For example, if doing deferred rendering for the G-buffer where you know every single pixel will be overwritten, you can use DiscardResource instead of doing ClearRenderTargetView / ClearDepthStencilView.


text:
Q: Using != with counter controlled loops Last question for today all...I will get back with tomorrow..I have a lot to follow up on...
I am looking in Reilly Java text- talking about counter controlled loop patterns..(does not matter what language..)
The author for counter controlled loops (for, while, etc) and with nesting loops...uses the != for test...Now I realize != is used for certain situations with event controlled loops-like sentinel or EOF type of loops- but to me- using it with a counter controlled loop is a bad idea...very prone to errors..
Examples:
x = 0;
while (x != 100) {
   y = 0;
  while (y != 100) {

   ...
   y++;
 }
  x++;
}

Would it be better to just say..using the other relational operators...
x = 0;
while (x < 100) {   //or even better some defined constant...
   y = 0;
  while (y < 100) {

   ...
   y++;
 }
  x++;
}

Which from what I have seen is usually the way presented in texts..classes.etc..
Once again- would all you considered this bad- or just a different way of doing it...
Thanks...

A: I would only use
while (x != 100)

if I wanted the loop to terminate when x was exactly 100.  So in the vast majority of cases I would use
while (x < 100)

which is a lot more common for counter controlled loops.
EDIT: On second thought, I would always use for-syntax in a counter-controlled loop, so that example should be
for(int i=0; i < 100; ++i)

A: You want your loop condition to be the exact inverse of the desired post-condition.
i= 0;
while( i != 100 ) {
    i += 1;
}
assert i == 100;

You can trivially see that the loop post-condition exactly matches the loop termination condition.  No mysteries.
Further, you can prove from the initial condition and the body that it will reach 100 without "somehow" magically skipping a value.
In the case when you have a really complex loop body, that simple parallel structure is essential.
If you use Weakest Precondition techniques for deriving the loop from the post-condition, the loop condition will be the simple matching condition as shown above.
The i < 100 is a bad idea because your loop could have an incorrect body that incremented the variable badly and still "appeared" to work.

A: Using < is more common in Java. Modern C++ uses !=.
!= is more likely to catch errors in your code. In most circumstances this is a good thing. If for some reason the counter has not only reached but gone past the bound (usually on the first iteration), then the body will execute with an illegal value. So long as the body of the loop is not hiding errors, then you'll get an exception. If the body is hiding errors, the loop will execute billions of times and it should be obvious there is a bug.
As an example, an interesting vulnerability was found in the implementation of Adobe Flash last year. A pointer used as array could be caused to be initialised as null. Usually not a problem - the process safely crashes out whenever it is first dereferenced. However, a loop with < was used, allowing the body to never executed which then allows the execution to continue. After that, memory could be written at an attacker specified location. Because the value of null is always 0, the attacker knows exactly which memory locations are being written to. This would not have happened if the loop has used !=.

A: as other answers have shown,
while(i < 100) is safe*,
while(i != 100) is precise**.
As an aside, you may want to try while(i++ < 100) or for(i = 0; i < 100; ++i) instead of the simpler while loop you have shown--forgetting to increment the counter at the end of the loop is a real pain. Note that, if i=0, i++ will equal 0, and then increment i for next time, and ++i will increment i and then equal 1, so for while(i++ < 100), the postfix ++ operator is necessary.
Also note, that if i was 0 when it got tested in the condition, then it will be 1 in the loop body (for the while example), so if i is an index for an array or something, and not just keeping track of loop iterations, you'd be better to stick with just a for loop (which increments i after each iteration).

*: safe here meaning less likely to enter an infinite loop. It is also unsafe in that it can hide potential errors, if the loop isn't trivial
**: precise in that if it doesn't do exactly what you expect it to, it will fail, and you will notice. Some other answers have also described how to protect you from errors even more in this kind of loop.

A: The main advantage of use "!=" over "<" is that is something is going to fail, it should fail big.
For example, if a bug somewhere caused x to enter the loop set to 110, then x < 100 will never enter the loop --- a fact you might miss in debugging.  OTOH, if you use x!=100, it will never exit the loop -- something which could not be missing in debugging.

A: I don't think < necessarily offers you more protection than !=.  If you have a case where i is being incremented in way that is unanticipated by you, you should be throwing an exception, not sweeping it under the rug with a <.
For example, if you're really worried about your while loops messing up, you could do something like this:
x = 0;
while (x != 100)
{
   assert x >= 0;
   assert x < 100;

   y = 0;
   while (y != 100)
   {
     assert y >= 0;
     assert y < 100;

     ...
     y++;
   }
   x++;
}

That way, the moment your loop goes out of bounds, your program dies right away (crash early, crash often) and you know your code is messed up.

A: I suspect this may have something to do with C++ iterators.
If you're using integers or pointers, < has a clearly defined meaning.  If you're using C++ iterators in a loop, < may not be defined, or may be hard to calculate.
For example, in running through a list, the C++ way would be:
for(std::list<foo>::const_iterator i = bar.begin(); i != bar.end(); ++i)

and really the only way to see if i is before bar.end() is to increment i indefinitely and see if it's ever equal to bar.end().
There's a considerable amount of value in doing minor things the same way all the time.

A: I believe they are semantically the same, the only difference being with != numbers above 100 would obviously also meet the condition where as the < will prevent any number larger than 100 from making it through.
However in the case given, both operators will result in the same output. Now, if somehow the x and y variables were being acted on outside that code, the "<" would be a better way to make sure there was a cutoff at 100 even if they entered with a value of 90, and were not able to continue at all if they entered with a value of 4000. Obviously, the intent on what you are doing at the time would dictate which operator you chose, there are usually several methods to achieve the same result and not always one "correct" way.

A: Yes. They are semantically the same.
The second syntax using the "<" operator is the one people in general use in this case and seems more intuitive (as the value of the variable is being incremented in the loop).

A: It's better to use the less than < in the loop.  There is a possibility that an error in the code will cause the counter to increment twice.  This means that the loop will suddenly become an infinite loop ( or until you blow MAXINT ).


text:
Q: to find sum of primes up to 2 million I am trying to find the sum of all prime numbers <=2 million so i used sieve of Eratosthenes TO mark all prime numbers .As i declared the boolean array of size 2 million ,i got this error
             "main" java.lang.ArrayIndexOutOfBoundsException: 2000000

Since the sum can be two large so i used long instead of sum .here is the code in java
public class Summationofprimes {
    static  long[] isprime=new long[2000000];

     static void sieve(){
         Arrays.fill(isprime, 0);//all marked false
         isprime[1]=1;isprime[0]=1;
         for(int i=2;i*i<=2000000;i++){
             if(isprime[i]==0){
                // print(i);
                // sum+=i;
                //print(sum);
                 for(int j = i * i; j <= 2000000 ;j += i){
                     isprime[j]=1;// all multiples marked true
                 }
             }
         }

    }

    public static void main(String[] args) {
        sieve();
        long sum=0;
        System.out.println("sum is :");
        for(int i=2;i<=2000000;i++){
            if(isprime[i]==0){
                sum+=i;

        }
        }
        System.out.println(sum);
        // TODO Auto-generated method stub

    }

}

How do i fix this issue in code ?

A: Here you go :
static  long[] isprime=new long[2000001];

Now it has range from 0 to 2000000


text:
Q: why child class can convert lvalue to rvalue? in c++ perfect forwarding using namespace std;

class Data {
public:
    Data() {}
    ~Data() {}

    Data(const Data& t) { cout << "Copy Constructor" << endl; }
    Data(Data&& t) noexcept { cout << "Move Constructor" << endl; }
    Data& operator=(const Data& t) {
        cout << "Copy =" << endl;
        return *this;
    }
    Data& operator=(Data&& t) noexcept {
        cout << "Move =" << endl;
        return *this;
    }
};

class Data2 : public Data {};

class Test {
public:
    void setData(std::shared_ptr<Data>&& d) { data = std::forward<std::shared_ptr<Data>>(d); }

private:
    std::shared_ptr<Data> data;
};

int main() {
    Test t;
    auto d = std::make_shared<Data>();
    t.setData(d); // error
    t.setData(move(d)); // ok

    auto d1 = std::make_shared<Data2>();
    t.setData(d1); // why ok????????????

    int debug = 0;
}

Why doesn't t.setData(d1) require std::move to convert d1 to an rvalue but t.setData(d) doesn't compile?

A: t.setData(d1) has to convert d1 to std::shared_ptr<Data>, it does this by copying into a temporary value. Temporary values are already rvalues so don't require an explicit std::move.
Note that as d1 is passed via a temporary conversion setData doesn't alter d1, you still need to use std::move for this to happen so that d1 is moved into the temporary rather than being copied. E.g in:
auto d = std::make_shared<Data>();
t.setData(std::move(d));
std::cout << d.get() << "\n";

auto d1 = std::make_shared<Data2>();
t.setData(d1);
std::cout << d1.get() << "\n";

auto d2 = std::make_shared<Data2>();
t.setData(std::move(d2));
std::cout << d2.get() << "\n";

d and d2 will end up as null pointers but d1 will still point to the object.
Note that in std::forward<std::shared_ptr<Data>>(d) as you know the exact type of d std::forward is unnecessary and you could just use std::move(d) instead.


text:
Q: Bootstrap 1 extra px in chrome I am using bootstrap for creating webpage.
I have derived body on two blocks(content and header). Inside the content block i have div with class .container .sameTable and inside it i have div with class .row .sameRow that  derived on two other blocks(left and right). left has class - .col-xs-2, right has class - .col-xs-10 and both of them have class - .sameCol too.
In Opera, FF, IE i have no any problems. But in Chrome on different screen sizes, contents width has less then other blocks on ~1px. I read that i may be caused by percentage width defining, but i cant change bootstrap's classes. How can I avoid it?
image - http://c2n.me/3em6LU4.jpg
Additionally, if i removed float:none from left and right blocks, issue is wanised, but my left block became smaller then i need.
image - http://clip2net.com/clip/m421320/49445-clip-46kb.jpg
.sameTable, .sameRow, .sameCol it's my own classes that looks like:
.sameTable {
    display: table;
    padding: 0;
}

.sameRow {
    display: table-row;
}

.sameCol {
   float: none;
   display: table-cell;
   vertical-align: top;
}

A: It's a rounding problem with the Bootstrap grid. Since Chrome supports sub-pixel rendering, it will exhibit the bug. I wouldn't worry about it.


text:
Q: Xcode seems not to find all 'init' signatures for UIBarButtonItem I am trying to use UIBarButtonItem with the following signature:
init(barButtonSystemItem systemItem: UIBarButtonSystemItem,
              target target: AnyObject?,
              action action: Selector)

But xcode seems not to accept this signature, since it displays this error:

Missing argument for parameter 'style' in call

This is what I am doing:
cell.imageView!.image = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Add, target: self, action: "test")

UIBarButtonItem has other signatures for init, so I guess xcode is not finding the signature above. Am I doing something wrong?
Here is a link for UIBarButtonItem class reference: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIBarButtonItem_Class/index.html#//apple_ref/occ/instm/UIBarButtonItem/initWithBarButtonSystemItem:target:action:


text:
Q: Merge specific rows from two files if number in row file 1 is between two numbers in row in file 2 I'm searching for a couple of hours (actually already two days) but I can't find an answer to my problem yet. I've tried Sed and Awk but I can't get the parameters right.
Essentially, this is what I'm looking for
FOR every line in file_1
IF [value in colum2 in file_1]
   IS EQUAL TO [value in column 4 in some row in file_2]
   OR IS EQUAL TO [value in column 5 in some row in file_2]
   OR IS BETWEEN [value column 4 and value column 5 in some row in file_2]
THAN
    ADD column 3, 6 and 7 of some row of file_2 to column 3, 4 and 5 of file_1
NB: Values that needs to be compared are INTs, values in col 3, 6 and 7 (that only needs to be copied) are STRINGs
And this is the context, but probably not necessary to read:

I've two files with genome data which I want to merge in a specific way (the columns are tab separated)

*

*The first file contains variants (only SNPs for the ones interested) of which, efficiently, only the second column is relevant. This column is a list of numbers (position of that variant on the chromosome)

*I have a structural annotation files that contains the following data:

*

*In column 4 is a begin position of the specific structure and in column 5 is the end position.

*Column 3, 7 and 9 contains information that describes the specific structure (name of a gene etc.)

I would like to annotate the variants in the first file with the data in the annotation file. Therefore, if the number in column 2 of the variants file is equal to column 4 or 5 OR between those values in a specific row, columns 3, 7 and 9 of that specific row in the annotation needs to be added.

Sample File 1
SOME_NON_RELEVANT_STRING    142
SOME_NON_RELEVANT_STRING    182
SOME_NON_RELEVANT_STRING    320
SOME_NON_RELEVANT_STRING    321
SOME_NON_RELEVANT_STRING    322
SOME_NON_RELEVANT_STRING    471
SOME_NON_RELEVANT_STRING    488
SOME_NON_RELEVANT_STRING    497
SOME_NON_RELEVANT_STRING    541
SOME_NON_RELEVANT_STRING    545
SOME_NON_RELEVANT_STRING    548
SOME_NON_RELEVANT_STRING    4105
SOME_NON_RELEVANT_STRING    15879
SOME_NON_RELEVANT_STRING    26534
SOME_NON_RELEVANT_STRING    30000
SOME_NON_RELEVANT_STRING    30001
SOME_NON_RELEVANT_STRING    40001
SOME_NON_RELEVANT_STRING    44752
SOME_NON_RELEVANT_STRING    50587
SOME_NON_RELEVANT_STRING    87512
SOME_NON_RELEVANT_STRING    96541
SOME_NON_RELEVANT_STRING    99541
SOME_NON_RELEVANT_STRING    99871

Sample File 2
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A1  0   38  B1  C1
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A2  40  2100    B2  C2
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A3  2101    9999    B3  C3
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A4  10000   15000   B4  C4
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A5  15001   30000   B5  C5
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A6  30001   40000   B6  C6
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A7  40001   50001   B7  C7
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A8  50001   50587   B8  C8
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A9  50588   83054   B9  C9
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A10 83055   98421   B10 C10
SOME_NON_RELEVANT_STRING    SOME_NON_RELEVANT_STRING    A11 98422   99999   B11 C11

Sample output file
142 A2  B2  C2
182 A2  B2  C2
320 A2  B2  C2
321 A2  B2  C2
322 A2  B2  C2
471 A2  B2  C2
488 A2  B2  C2
497 A2  B2  C2
541 A2  B2  C2
545 A2  B2  C2
548 A2  B2  C2
4105    A3  B3  C3
15879   A5  B5  C5
26534   A5  B5  C5
30000   A5  B5  C5
30001   A6  B6  C6
40001   A7  B7  C7
44752   A7  B7  C7
50587   A8  B8  C8
87512   A10 B10 C10
96541   A10 B10 C10
99541   A11 B11 C11
99871   A11 B11 C1

1

A: As a start, here's how to write the algorithm you posted in awk, assuming when you said "ADD" you meant "append" and assuming all lines in file1 have unique values of the 2nd field (ran against the sample input provided):
awk '
BEGIN{ FS=OFS="\t"; startIdx=1 }
NR==FNR {
    if ($2 in seen) {
         printf "%s on line %d, first seen on line %d\n", $2, NR, seen[$2] | "cat>&2"
    }
    else {
         f2s[++endIdx] = $2
         seen[$2] = NR
    }
    next
}
{
    inBounds = 1
    for (idx=startIdx; (idx<=endIdx) && inBounds; idx++) {
        f2 = f2s[idx]
        if (f2 >= $4) {
            if (f2 <= $5) {
                print f2, $3, $6, $7
            }
            else {
                inBounds = 0
            }
        }
        else {
            startIdx = idx
        }
    }
}
' file1 file2
142     A2      B2      C2
182     A2      B2      C2
320     A2      B2      C2
321     A2      B2      C2
322     A2      B2      C2
471     A2      B2      C2
488     A2      B2      C2
497     A2      B2      C2
541     A2      B2      C2
545     A2      B2      C2
548     A2      B2      C2
4105    A3      B3      C3
15879   A5      B5      C5
26534   A5      B5      C5
30000   A5      B5      C5
30001   A6      B6      C6
40001   A7      B7      C7
44752   A7      B7      C7
50587   A8      B8      C8
87512   A10     B10     C10
96541   A10     B10     C10
99541   A11     B11     C11
99871   A11     B11     C11


text:
Q: How can I access the __reactEventHandlers property of the DOM object? I am trying to access the '__reactEventHandlers' properties in JS. But I am not able to access the attribute in JS.But in developer console I can able see the attribute and i can able to access as well. Kindly help me on this.

A: Using the below mentioned way we can able to access the _reactEventHandler object form the DOM Object.
var abc=document.querySelector('._2LpG3');
var reactHandlerKey=Object.keys(abc).filter(function(item){
   return item.indexOf('__reactEventHandlers')>=0
});
var reactHandler=abc[reactHandlerKey[0]];
console.log(reactHandler) // React Event handler object and Properties

Thanks,
Hariharan S


text:
Q: Elastic(search): How to structure nested queries correctly? I'm currently quite confuse about the structuring of queries in elastic. Let me explain what I mean with the following template that works fine for me:
{
"template" : {
    "query" : {
        "filtered" : {
            "query" : {
                "bool" : {
                    "must" : [
                        { "match" : {
                            "user"  : "{{param_user}}"
                        } },
                        { "match" : {
                            "session" : "{{param_session}}"
                        } },
                        { "range" : {
                            "date" : {
                                "gte" : "{{param_from}}",
                                "lte" : "{{param_to}}"
                            }
                        } }
                    ]
                }
            }
        }
    }
}
}

Ok so I want to get entries of a specific session of a user in a certain time period. Now if you take a llok at this link http://www.elastic.co/guide/en/elasticsearch/guide/current/combining-filters.html you can find the following query:
{
"query" : {
  "filtered" : {
     "filter" : {
        "bool" : {
          "should" : [
             { "term" : {"price" : 20}},
             { "term" : {"productID" : "XHDK-A-1293-#fJ3"}}
          ],
          "must_not" : {
             "term" : {"price" : 30}
          }
       }
     }
  }
}
}

In this example we have right after the "filtered" the "filter" keyword. However if I exchange my second "query" with a "filter" as in the example , my template won't work anymore. This is really counterintuitive and I payed alot of time to figure this out. A̶l̶s̶o̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶u̶n̶d̶e̶r̶s̶t̶a̶n̶d̶ ̶w̶h̶y̶ ̶w̶e̶ ̶n̶e̶e̶d̶ ̶t̶o̶ ̶p̶u̶t̶ ̶e̶v̶e̶r̶y̶ ̶f̶i̶l̶t̶e̶r̶ ̶i̶n̶ ̶s̶e̶p̶a̶r̶a̶t̶e̶ ̶̶{̶ ̶}̶̶ ̶e̶v̶e̶n̶ ̶t̶h̶o̶u̶g̶h̶ ̶t̶h̶e̶y̶ ̶a̶r̶e̶ ̶a̶l̶r̶e̶a̶d̶y̶ ̶s̶e̶p̶a̶r̶a̶t̶e̶d̶ ̶b̶y̶ ̶t̶h̶e̶ ̶a̶r̶r̶a̶y̶ ̶s̶y̶n̶t̶a̶x̶.̶
Another issue I had was that I suggested to match several fields I can just type smth like:
{
"query" : {
    "match" : {
        "user"  : "{{param_user}}",
        "session" : "{{param_session}}"
    }
}
}

but it seemed that I have to use a bool query which I didn't know of, so I searched for 'elastic multi match' but got something completely different.
My question: where can I find how to structure a query properly (smth like a PEG)? The documentation only give basic examples but doesn't state what we can actually do and how.
Best regards,
Jan
Edit: Ok I just found by accident that I cannot exchange "query" with "filter" as "match" is a query and not a filter. But then again what about "range"? It seems to be a query as well as a filter... Is there a summary of keywords specifying in which context they can be used?

A:
Is there a summary of keywords specifying in which context they can be used?

I wouldn't consider that as keywords. It's just there are both queries and filters with the same names (but not all of them).
Here is everything you need. For example there are both range query and filter. All you need is to understand the difference between filters and queries.
For example, if you want to move range section from query to filter, you can do that like shown in the code below (not tested). Since your code already contains filtered type of query, you can just create filter section right after query section.
{
    "template": {
        "query": {
            "filtered": {
                "query": {
                    "bool": {
                        "must": [
                            {
                                "match": {
                                    "user": "{{param_user}}"
                                }
                            },
                            {
                                "match": {
                                    "session": "{{param_session}}"
                                }
                            }
                        ]
                    }
                },
                "filter": {
                    "range": {
                        "date": {
                            "gte": "{{param_from}}",
                            "lte": "{{param_to}}"
                        }
                    }
                }
            }
        }
    }
}

Just remember that you can filter only not analyzed fields.


text:
Q: Display HTML from XML in ANDROID I have small problem..
I have created application that fetches rss feed that is in xml
Everything works perfect until I try to display string from XML as HTML..
    <content:encoded>
<![CDATA[

Boris Petrović, jedan od finalista trenutno najpopularnijeg muzičkog šoua u Srbiji  – Prvog glasa Srbije, nije mogao ni da pretpostavi da će mu samo dan nakon što su mediji u Srbiji preneli  njegovu izjavu "Ako jednog dana skupim pare, možda me Aleksandra Radović primi u njenu školu" – popularna pevačica ostvariti želju. Radovićeva je danas prijatno iznenadila i Borisa i njegove fanove kada mu je na društvenoj mreži Twitter poželela dobrodošlicu u njenu školu pevanja koja važi za jednu od najboljih u Srbiji.

Nakon ispadanja iz takmičenja, popularna pevačica i članica žirija, pozvala je u svoju školu Zorana Stanića koji je te večeri bio Borisov "rival". Postupak je ovog mladog Žitištanina, kako je i sam kasnije izjavljivao, pomalo revoltirao s obzirom da je i on imao želju da radi na svom glasu i dovede ga do savršenstva.

Ostvarila mu se želja – Boris Petrović na sceni

Posle današnjeg prijatnog gesta pevačice, može se očekivati da Borisa tek očekuju sjajne mogućnosti s obzirom da je u Prvom glasu Srbije bio jedan od retkih koji nije prošao ni jedan čas profesionalnog pevanja.

Radovićeva je najavila Borisu da 1. marta – počinju časovi!

]]>

NOw there are images in code and paragraphs strong b ... etc..
How do I get my app to encode CDATA and to display HTML ..
How to make it look nice..
This is my SINGLEITEM activity where I need to display html..
    static final String KEY_TITLE = "title";
    static final String KEY_DESCRIPTION = "description";

    // XML node keys

public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.single_menu_item);

         // getting intent data
            Intent in = getIntent();

            // Get XML values from previous intent
            String title = in.getStringExtra(KEY_TITLE);
            String description = in.getStringExtra(KEY_DESCRIPTION);

            //String link = in.getStringExtra(KEY_LINK);
           // String description = in.getStringExtra(KEY_DESCRIPTION);

            // Displaying all values on the screen
            TextView lblTitle = (TextView) findViewById(R.id.txtTitle);
            //TextView lblLink = (TextView) findViewById(R.id.link_label);
            TextView lblDesc = (TextView) findViewById(R.id.txtDescription);

            lblTitle.setText(title);
            //lblLink.setText(link);
            lblDesc.setText(Html.fromHtml(description));

        }
    }

So what do I need to do now to make this show as HTML...???
Thank you

A: One way would be to change the TextView to a WebView. You can put the WebView below the title TextView.
I have a generic help activity. I create the help files in an HTML editor and load them to raw files. You could use the activity built HTML:
    setContentView(R.layout.helpactivity);
    helpWebView = (WebView) findViewById(R.id.helpWebView);

    Bundle extras = getIntent().getExtras();
    int helpId = extras.getInt(GC.HELP_FILE_ID);

    htmlString = readRawTextFile(getApplicationContext(), helpId);
    helpWebView.loadData(htmlString, "text/html", null);

readRawTextFile is a function that retrieves the appropriate HTML file and loads it into a string. You could change that to
htmlString = in.getStringExtra(KEY_DESCRIPTION);


text:
Q: Wordpress custom search results page not showing excerpt I have a custom content-searchresults.php page. However for some reason its not showing the excerpt, but other amends I make this on this are pulled through so it is using this template.
Below is my code.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <?php if ( has_post_thumbnail() && ! post_password_required() && !is_single() ) : ?>

            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
                <?php the_post_thumbnail('full', array('class' => 'img-responsive'));   ?>

        <?php endif; ?>

                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && CrippsTheme_categorized_blog() ) : ?>

                    <?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'CrippsTheme' ) ); ?>

                <?php
                    endif;

                    if ( is_single() ) :
                        the_title( '
', '
' );
                    else :
                        the_title( '
', '
' );
                    endif;
                ?>

        <?php the_excerpt(); ?>

    <a class="read-more" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
        Read more

A: It wasnt that it wasnt showing the excerpt it was that I had an advanced custom field with the main copy in. To show an advanced custom field excerpt i used the following.
Add to functions.php
function custom_field_excerpt() {
global $post;
$text = get_field('main_copy');
if ( '' != $text ) {
    $text = strip_shortcodes( $text );
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $excerpt_length = 45; // 45 words
    $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
    $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
return apply_filters('the_excerpt', $text);
}

Then add the following to where you would like the excerpt to show:
<?php echo custom_field_excerpt(); ?>


text:
Q: Remove Sidebar for Certain route React I want to remove the sidebar for one route on my react application. i didn't want that sidebar on my particular route called "Visual" any help from you guys would be much appreciated
my code:
import React, { Component } from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Home from "./components/Home";
import SideBar from "./components/Sidebar";

import Apps from './components/login'
import Inference from './components/drop';
import New from './components/new'
import Visual from './components/visual'
class App extends Component {
  render() {
    return (

             <Router>

        <Route exact path="/visual" component={Visual} />
          <SideBar  />

            <Route exact path="/home" component={Home} />

          <Route exact path="/inference" component={Inference} />
          <Route exact path="/" component={Apps} />
          <Route exact path="/new" component={New} />

      </Router>

    );
  }
}

export default App;

A: This is going to be easier to implement if you have a Layout component with the sidebar in it. For example, the layout component would look like
const Layout = ({ children }) => {
  return (

      <Sidebar />
      {children}

  );
}

So routes that require the Sidebar can be wrapped with the Layout component. For example, your Home route would be
class Home extends Component {
  render() {
    return (
      <Layout>
        Home page content/JSX
      </Layout>
    );
  }
}

This way, only routes using the Layout component would have the sidebar.

A: You can get your current path using useLocation hook that react-router-dom provides it. You can watch the routes that you are visiting and while you get to one that you don't want to show something return null instead of the component.
const DummyComponent = () => {
  const { pathname } = useLocation();
  if (pathname === '/somewhere') return null;
  return (

This is my component

  );
}

I think this is going to work for you


text:
Q: Error when trying to compile XCode C++ project: clang: error After trying to compile my xcode project I finally came up to this error. Which I don't fully understand what it means even after reading other stackoverflow posts.
Here's a link to my project on github.. https://github.com/RyanDawkins/EngineBase/tree/sprint_2
Dependencies:
Verison: 1.5 http://www.ambiera.com/irrklang/
Version: 1.11.0 http://glew.sourceforge.net/
Ld /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Products/Debug/EngineBase normal x86_64
    cd "/Users/dawkins/XCode Projects/EngineBase"
    export MACOSX_DEPLOYMENT_TARGET=10.9
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Products/Debug -L/usr/local/lib -L/usr/local/Cellar/glfw3/3.0.4/lib -L/Users/dawkins/Downloads/irrKlang-64bit-1.5.0/bin/macosx-gcc -F/Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Products/Debug -filelist /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/EngineBase.LinkFileList -mmacosx-version-min=10.9 -stdlib=libc++ -weak_library /usr/local/lib/ikpMP3.dylib -lGLEW.1.11.0 -lglfw3.3.0 -lirrklang -framework OpenGL -Xlinker -dependency_info -Xlinker /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/EngineBase_dependency_info.dat -o /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Products/Debug/EngineBase

duplicate symbol __ZNK6json114Json4dumpERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json117staticsEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json1111static_nullEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1Ev in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2Ev in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2EDn in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1EDn in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2Ed in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1Ed in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2Ei in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1Ei in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2Eb in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1Eb in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2EPKc in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1EPKc in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2ERKNSt3__16vectorIS0_NS1_9allocatorIS0_EEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1ERKNSt3__16vectorIS0_NS1_9allocatorIS0_EEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2EONSt3__16vectorIS0_NS1_9allocatorIS0_EEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1EONSt3__16vectorIS0_NS1_9allocatorIS0_EEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2ERKNSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES0_NS1_4lessIS8_EENS6_INS1_4pairIKS8_S0_EEEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1ERKNSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES0_NS1_4lessIS8_EENS6_INS1_4pairIKS8_S0_EEEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES0_NS1_4lessIS8_EENS6_INS1_4pairIKS8_S0_EEEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114JsonC1EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES0_NS1_4lessIS8_EENS6_INS1_4pairIKS8_S0_EEEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json4typeEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json12number_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json9int_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json10bool_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json12string_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json11array_itemsEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json12object_itemsEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114JsonixEm in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114JsonixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue12number_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue9int_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue10bool_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue12string_valueEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue11array_itemsEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValue12object_itemsEv in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValueixEm in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonValueixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json1110JsonObjectixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json119JsonArrayixEm in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114JsoneqERKS0_ in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114JsonltERKS0_ in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114Json5parseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_ in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZN6json114Json11parse_multiERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERS7_ in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZNK6json114Json9has_shapeERKSt16initializer_listINSt3__14pairINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_4TypeEEEERS9_ in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTVN6json1110JsonObjectE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTVN6json119JsonValueE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTVN6json119JsonArrayE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTIN6json119JsonValueE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTSN6json119JsonValueE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTIN6json119JsonArrayE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTSN6json119JsonArrayE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTIN6json1110JsonObjectE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
duplicate symbol __ZTSN6json1110JsonObjectE in:
    /Users/dawkins/Library/Developer/Xcode/DerivedData/EngineBase-fmjhbczrqugvdsaetspmffdamwtq/Build/Intermediates/EngineBase.build/Debug/EngineBase.build/Objects-normal/x86_64/json11-B7F1ED8E4FC87B4A.o
ld: 60 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


text:
Q: Sidekiq worker not getting queued in testing I am using sidekiq to queue a job to validate the input of a field on a model (a link) and visit the link to make sure it doesn't return a 404 if it passes a regex validation.
If the regex validation passes and the link does not return 404 I assign another attribute to the same model but on a different field.
The worker is trigger by calling a method, the method is triggered after an after_commit, on: :update callback
The method only triggers the worker if 'previous_changes['json object I am using to make changes']' is true. This is so the worker won't continue to be called over and over again.
All of this works fine in development, confirmed with multiple use cases by QA'ing it myself
I am trying to write a test in MiniTest to ensure that a worker gets queued when the model's json field is changed but a worker is not being queued and for the life of me I can't figure out why.
I am testing the expectations for the worker being queued with:
assert_difference 'WorkerClass.jobs.size' do
  site = sites(:site_from_fixtures)
  site.attribute_that_triggers_change = { "random" => "json_object" }
  site.save
end

The test returns: "Expected: 1, Actual: 0"
Any input would be greatly appreciated!

A: This issue was fixed by installing the test_after_commit gem.
Apparently after_commit's don't fire in tests unless you either use that gem or specify the necessary changes in a test_helper. I opted for the gem option just to keep things a little easier.


text:
Q: Unit Testing based on JNDI , ejb and spring In my application I am injecting some of services based on EJB with use of Spring IOC through JndiObjectFactoryBean like below mentioned so during run the junit I am getting this exception "java.lang.IllegalArgumentException: This JNDI operation is not implemented by the JNDI provider."
Could some please let me know how I'll configure for Junit.
<bean id="xxxMenuItemService"   class="xxxMenuItemServiceyyy">
    <property name="xxxMenuItemDelegator" ref="xxxMenuItemDelegator" />
</bean>
<bean id="approveMenuItemServiceRemote"
    class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName"
        value="ejb/XXXXXXXX" />

A: have a look at the SimpleNamingContextBuilder from org.springframework.mock as it provides a full context builder where you can bind mock or other objects for use by Spring's JNDI lookup.
One thing to do though is to make sure you build the SimpleNamingContextBuilder in the static @BeforeClass of JUnit 4.  this means that it is all initialized and waiting before the Spring Application Context is started and you won't have any JNDI lookup failures.


text:
Q: Notepad ++ clone each line I have a file that includes such lines
111
112
113

I want to clone the lines and add a seperator between the numbers. Output should be as the following
111#111
112#112
113#113

How can I do it with notepadd++ by using regex replace

A: Find (.+)
Replace \1#\1
This will work


text:
Q: H2 DB supporting IF conditionals from SQL I have a sql native query in JDBC that uses an IF clause (I also tried with CASE WHEN) and it works fine in production, since I use MariaDB. But for my unit tests we use H2, the issue is that H2 does not understand some sql syntax.
I found here DbUnit - JdbcSQLException: Function "*" not found about user-defined SQL functions, I created my alias function for the IF() sql method and it works for one of the cases I need it to work. The first case is as follows IF(table.value = 0, 'yes', 'no'), but the second case uses a nested comparator as follows IF(table.value1 = 0 && table.value2 =0, 'yes', 'no'), in this case it is failing.
This is my IF user-defined SQL function
@SuppressWarnings("unused")
public class H2Function {
    public static String IF(Boolean condition, String ifTrue, String ifFalse) {
        return condition ? ifTrue: ifFalse;
    }
}

Here how I link it in the properties.yaml file
spring:
  datasource:
    url: jdbc:h2:mem:db__PRIMARY__;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE
    driver-class-name: org.h2.Driver
    hikari:
      connection-init-sql: "CREATE ALIAS IF NOT EXISTS IF DETERMINISTIC FOR \"com.package.test.H2Function.IF\";"

And the native query definition
"SELECT user, Coalesce(AVG(value1), 0) AS avg1,"
" Coalesce(AVG(value2), 0) AS avg2, Coalesce(AVG(value3), 0) AS avg3, "
" IF(Coalesce(AVG(value1), 0)=0 && Coalesce(AVG(value2), 0)=0, 'yes', 'no') AS bottom " " FROM table tb ... "

I cannot use internally the avg1 and avg2 due to query aliases not working properly.
Using just IF(Coalesce(AVG(value1), 0)=0, 'yes', 'no') or IF(Coalesce(AVG(value2), 0)=0, 'yes', 'no') works fine with my user-defined sql function, but using both with && fails.
P.D.: All of this is to be able to sort all records that have value1=value2=0 always to the bottom of the list, no matter the sorting order, if you know a way to accomplish this without going into so much trouble, please let me know.

A: Solved it:
Apparently H2 also has problems interpreting the && operator. I changed it to AND, which is interchangeable with && in mySQL, and now H2 interprets it and test passes, and I get the desired result when deployed using MariaDB.
stackoverflow question about AND-&&
doc on operators precedence
mySQL manual on AND,&&


text:
Q: Oracle 11g,12c LOWER TURKISH character problem sql:
select LOWER('I') FROM DUAL

Result:
LOWER('I')
i

select nls_lower('I',nls_sort='xturkish') from dual;

Result:
nls_lower('I')
ı

i want use the lower function of the hibernate, how can I cast that to Oracle's nls_lower ?

A: nls_lower is part of Locale-Dependent SQL Functions with Optional NLS Parameters

All SQL functions whose behavior depends on globalization support conventions allow NLS parameters to be specified. These functions are:

*

*TO_CHAR

*TO_DATE

*TO_NUMBER

*NLS_UPPER

*NLS_LOWER

*NLS_INITCAP

*NLSSORT

So use it instead lower for Turkish support


text:
Q: Custom log4j.properties location for Spring web application Is it possible to provide custom location for the log4j.properties file for the log4j 1.x?
I don't want to include the file in the project's resources folder.

A: configure the org.springframework.web.util.Log4jConfigListener in your web.xml with context-parameter log4jConfigLocation.
<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>file:C:/log4j.properties</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

Log4jConfigListener JavaDoc:

Bootstrap listener for custom log4j initialization in a web environment. Delegates to Log4jWebConfigurer...

Log4jWebConfigurer JavaDoc:

Location of the log4j config file; either a "classpath:" location
  (e.g. "classpath:myLog4j.properties"), an absolute file URL (e.g.
  "file:C:/log4j.properties), or a plain path relative to the web
  application root directory (e.g. "/WEB-INF/log4j.properties"). If not
  specified, default log4j initialization will apply ("log4j.properties"
  or "log4j.xml" in the class path; see the log4j documentation for
  details). "log4jRefreshInterval":


text:
Q: Microsoft Graph API + .NET 6 MAUI / Xamarin Forms I'm trying to read files on sharepoint and I'm using the Graph API. I was able to get all the data I needed using a deamon console, but when I'm moving on Mobile (MAUI or Xamaring.forms) the APIs don't work. I have problems to authanticate myself. I've tried every single way I know but I'm not able to fix it.
Apparently you must use an Authorization Code Flow (PKCE) for mobile application but I'm not able to find any example code how to generate it for Microsoft Graph API.
Any help?


text: Q: how to use a different keyStore for the some account? I have I have an account on the play store  with an application. But when I tried to upload my new application, I used a different keystore, I want to publish the new application but with the new keystore and not the former, because I have already installed the application on multiple tablets but with the new certification. if I use the old keyStore I would have problems of certifications. So how can I use my new KeyStore with my existing account.


text:
Q: Reference : Proving something is a Brownian Motion Given a (standard) Brownian Motion $W_t$ if we do some sort of scaling, inversion or reversal then we also get a Brownian motion.
I have seen proofs but the proofs only seem to rely on showing covariance is the minimum of two given (arbitrary) times and the continuity.
I can't seem to find a theorem or lemma in my book that states this is all that needs to be checked rather than entirely check the 4 parts of the definition of Brownian motion.
Could someone either state or give reference (which I can find online) to this? That is much simpler than having to prove by the definition.

A: Durrett's Probability Theory and Examples gives this equivalent formulation on page 355 and proves it. There is in fact one more (very important!) property that needs to be checked, namely that the process is Gaussian (property (a') in Durrett). But if you are starting with a Brownian motion and doing some transformation to it, this is likely trivial to check.


text:
Q: How to solve integration elegantly using contour integration Solve this integral analytically and prove the answer:
$$
\int_0^{\pi/2}\frac{d\psi}{1-\cos\theta \cdot \cos\psi} = \frac{\pi - \theta}{sin \theta}, \quad \theta \in (0,2\pi)
$$
To see the pic
I have already proved it numerically using Mathematica. But still can't prove it analytically.

A: This is a standard integral:
Let $\cos \theta = a$ (and $-1\leq a \leq 1$):
$$\int\limits_{\psi = 0}^{\pi/2} \frac{1}{1 - a \cos \psi}\ d\psi =\frac{2 \tan ^{-1}\left(\frac{a+1}{\sqrt{1-a^2}}\right)}{\sqrt{1-a^2}}$$


text:
Q: How to show dates in a jFormattedTextField using postgresql I want to show dates in a JformattedTextField, using the partern day/month/year, however, I only can show "yyyy-mm-dd" because this is how the postgresql send to java, How can I transform to the partern I want to use?
The JformattedTextField has this format "##/##/####"
Normally, the database show "yyyy-mm-dd" in the textfield without a mask, that means, the database is sending me a data, but i need to use a mask showing me dd/MM/yyyy and if the mask is on, i get nothing on the jFormattedTextField
I already saw the orther topic about it, but, i could not resolve my problem
            if(rs.next()){

            jFormattedTextFieldCPF.setText(rs.getString("cad_cpf"));
            jTextFieldNOME.setText(rs.getString("cad_nome"));
            jTextFieldIDADE.setText(rs.getString("cad_idade"));
            jTextFieldAPELIDO.setText(rs.getString("cad_apelido"));
            jTextFieldDATA.setText(rs.getString("cad_data"));

        jFormattedTextFieldPROCURAR.setText(""); //deixa o campo vazio
        jFormattedTextFieldCPF.setEnabled(false);
        jTextFieldNOME.setEnabled(true);
        jTextFieldIDADE.setEnabled(true);
        jTextFieldDATA.setEnabled(true);
        jTextFieldAPELIDO.setEnabled(true);
        jButtonExcluir.setEnabled(true);
        jButtonALTERAR.setEnabled(true);
        jButtonSalvar.setEnabled(false);
        jButtonINSERIR.setEnabled(false);

        }

A: Need to convert to date, so, first you need to receive date on the format the database is saved, them, convert to the format you want, in my case dd/MM/yyyy
Here is the solution I'm using for this problem:
                if(rs.next()){

                jFormattedTextFieldCPF.setText(rs.getString("cad_cpf"));
                jTextFieldNOME.setText(rs.getString("cad_nome"));
                jTextFieldIDADE.setText(rs.getString("cad_idade"));
                jTextFieldAPELIDO.setText(rs.getString("cad_apelido"));

                String Date = new SimpleDateFormat("dd-MM-yyyy").format(rs.getDate("cad_data"));
                jFormattedTextFieldDATA.setText(Date);

                jFormattedTextFieldPROCURAR.setText(""); //deixa o campo vazio
                jFormattedTextFieldCPF.setEnabled(false);
                jTextFieldNOME.setEnabled(true);
                jTextFieldIDADE.setEnabled(true);
                jFormattedTextFieldDATA.setEnabled(true);
                jTextFieldAPELIDO.setEnabled(true);
                jButtonExcluir.setEnabled(true);
                jButtonALTERAR.setEnabled(true);
                jButtonSalvar.setEnabled(false);
                jButtonINSERIR.setEnabled(false);


text:
Q: currentUser: The expression doesn't evaluate to a function, so it can't be invoked I need to update this code, not I'm not sure how. Does anyone have a clue?
_initialize() async{
SharedPreferences prefs = await SharedPreferences.getInstance();
bool loggedIn = prefs.getBool(LOGGED_IN) ?? false;
if(!loggedIn){
  _status = Status.Unauthenticated;
}else{
  await auth.currentUser().then((currentUser) async{
    _user = currentUser;
    _status = Status.Authenticated;
    _userModel = await _userServices.getUserById(currentUser.uid);
  });

}
notifyListeners();

}

A: "currentUser" is not a method anymore, it's a property.
_initialize() async{
SharedPreferences prefs = await SharedPreferences.getInstance();
bool loggedIn = prefs.getBool(LOGGED_IN) ?? false;
if(!loggedIn){
  _status = Status.Unauthenticated;
}else{

    _user = auth.currentUser;
    _status = Status.Authenticated;
    _userModel = await _userServices.getUserById(_user.uid);

}
notifyListeners();
}


text:
Q: redirect to https using nodejs and express in Heroku I am hosting my webpage on Heroku and want to redirect to HTTPS. I am using Nodejs and Express.
I tried this code but when I visit the page the following error occurs:
error
I tried so hard to redirect my page to HTTPS but can't manage to do it. I would appreciate your help!
var express        = require("express");
    var app            = express();
    var bodyParser     = require('body-parser');
    var nodemailer     = require("nodemailer");
    var favicon        = require('serve-favicon');
    var path           = require('path');
    var mongoose       = require ('mongoose');
    const sslRedirect = require('heroku-ssl-redirect')

app.all('/*', function (req, res, next) { // eslint-disable-line
  if (/^http$/.test(req.protocol)) {
    const host = req.headers.host.replace(/:[0-9]+$/g, '') // strip the port # if any
    return res.redirect(301, `https://${host}${req.url}`)
  }

  return next()
})
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(express.static('public'));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());

app.set("view engine", "ejs");

app.get("/jobs", function(req, res){
  res.render("jobs");
});

app.get("/", function(req, res){
    res.render("home");
});

app.get("/galerie", function(req, res){
  res.render("gallerie");
});

app.get("/team", function(req, res){
  res.render("team");
});

app.get("/uns", function(req, res){
    res.render("uns");
});

app.get("/contact", function(req, res) {
   res.render("contact");
});

    const port = process.env.PORT || 3000;
    const ip = process.env.IP || "127.0.0.1";
    app.listen(port,function(){
        console.log("Server has started .... at port "+ port+" ip: "+ip);
    });


text:
Q: Can I tell python to put an existing figure in a new figure? Creating a certain plot is a lot of work, so I would like to automate this by create a function f() that returns a figure.
I would like to call this function so that I can put the result in a subplot.  Is there anyway I can do this?  Below is some psuedo code explaining what I mean
figure_of_interest = f()

fig,ax = plt.subplots(nrows = 4,cols = 1)

ax[1].replace_with(figure_of_interest)

A: This was asked before here and here.
Short answer: It is not possible.
But you can always modify the axes instance or use a function to create/modify the current axes:
import matplotlib.pyplot as plt
import numpy as np

def test():
    x = np.linspace(0, 2, 100)

    # With subplots
    fig1, (ax1, ax2) = plt.subplots(2)
    plot(x, x, ax1)
    plot(x, x*x, ax2)

    # Another Figure without using axes
    fig2 = plt.figure()
    plot(x, np.exp(x))

    plt.show()

def plot(x, y, ax=None):
    if ax is None:
        ax = plt.gca()
    line, = ax.plot(x, y)
    return line

test()


text:
Q: Dictionaries and declaring vars I have a variety of vars for different screen sizes:
ST.screen_x_small = 480;
ST.screen_small = 768;
ST.screen_medium = 992;
ST.screen_large = 1200;

I want to declare a number of items to load per var. So for example, if x_small I want to load 10, if small, 20, and so on.
I've put each size in to a dictionary:
ST.content_per_load_dict = {'480' : 10, '768' : 20, '992' : 30, '1200' : 40};

And then:
var pageWidth = $(window).width();

    if(pageWidth < ST.screen_x_small)
    {
        ctx.contentPerLoad = ST.content_per_load_dict[ST.screen_x_small];
    }
    else if(pageWidth < ST.screen_small)
    {
        ctx.contentPerLoad = ST.content_per_load_dict[ST.screen_small];
    }
    else if(pageWidth < ST.screen_medium)
    {
        ctx.contentPerLoad = ST.content_per_load_dict[ST.screen_medium];
    }
    else
    {
        ctx.contentPerLoad = ST.content_per_load_dict[ST.screen_large];
    }

My questions are:

*

*Is there a better way to do this?

*Is there a more efficient way to declare the dictionary? Ideally I would only like to declare 480 in the ST.screen_x_small var but not again in the dictionary.

A: Building upon pax162's answer, you could even further simplify this operation.
// Order matters.
var ST = [ {name: 'x-small', width: 480, items: 10}, {name: 'small', width: 768, items: 20} ];
// ST.sort(function(a,b) { return a.width > b.width } )

ST.some(function (d) {
    if(pageWidth <= d.width) {
        ctx.contentPerLoad = d.items;
        return true;
    }
});

Put your dimensions and associated data into objects within an array, sort if necessary, then iterate over that array, which saves you from having to type out additional conditionals for any new items.

A: You could merge them into a single dictionary, like this:
var ST = {
    screen_x_small: {
        width: 480,
        items:10
    },
    screen_small: {
        width: 768,
        items:20
    },
}

and then:
if(pageWidth < ST.screen_x_small.width)
{
    ctx.contentPerLoad = ST.screen_x_small.items;
}
else if(pageWidth < ST.screen_small.width)
{
    ctx.contentPerLoad = ST.screen_small.items;
}


text:
Q: Using PHP/MYSQL book but get no output from PHP when trying to access the database I'm currently working my way through "PHP and MySQL Web Development." I've successfully created databases and been able to make tables and use the database. I've also successfully completed all the chapters on PHP and have had no problems with PHP not working up to this point. The goal of this page is return search results from a database. It's a pretty simple thing to do but for some reason nothing is being output from the script to the page. I'm getting no errors or anything. It's just blank with the title at the top. Can anyone please help me out with this? Thank you.
Here is the PHP code:

<title>Book-O-Rama Search Results</title>

Book-O-Rama Search Results

<?php
// create short variable names
$searchtype=$_POST['searchtype'];
$searchterm=trim($_POST['searchterm']);

 if (!$searchtype || !$searchterm) {
 echo 'You have not entered search details.  Please go back and try again.';
 exit;
 }

 if (!get_magic_quotes_gpc()){
 $searchtype = addslashes($searchtype);
 $searchterm = addslashes($searchterm);
 }

 @ $db = new mysqli('localhost', 'bookorama', 'bookorama123', 'books');

 if (mysqli_connect_errno()) {
 echo 'Error: Could not connect to database.  Please try again later.';
 exit;
 }

 $query = "select * from books where ".$searchtype." like '%".$searchterm."%'";
 $result = $db->query($query);

 $num_results = $result->num_rows;

 echo "
Number of books found: ".$num_results."
";

 for ($i=0; $i <$num_results; $i++) {
 $row = $result->fetch_assoc();
 echo "
".($i+1).". Title: ";
 echo htmlspecialchars(stripslashes($row['title']));
 echo "
Author: ";
 echo stripslashes($row['author']);
 echo "
ISBN: ";
 echo stripslashes($row['isbn']);
 echo "
Price: ";
 echo stripslashes($row['price']);
 echo "
";
 }

 $result->free();
 $db->close();

 ?>

A: You're supressing the errors from the line:
@ $db = new mysqli('localhost', 'bookorama', 'bookorama123', 'books');

Thats what the @ sign does, remove the @ sign and verify that the connection works properly, it might be that your script fails there.
You shouldn't use that, it's not considered good practice as far as I know.

A: You need to create another php page that sends a post request. Here is a sample one:
Take a look at the fiddle:

<title>Book-O-Rama Search </title>

Book-O-Rama Search

<form id='uploadform' method='post' enctype='multipart/form-data' action='link to your search action php page'>
<legend>Submit form</legend>

    SearchType <input name='searchtype' id='searchtype'/>

    SearchTerm <input name='searchterm' id='searchterm'/>

    <input type="submit" value= "Search" />

</form>

A: It worked for me! no white page! If you work with a editor including ftp sometimes saving the file failes. than you get a blank file. in that case safe your code and reopen the file.
as for the sql injection try this:
 $searchtypes = array('type1','type2');
 if (!in_array($searchtype,$searchtypes) || $searchterm=='') {
      echo 'You have not entered search details.  Please go back and try again.';
      exit;
 }


text:
Q: Elasticsearch aggregation group by using elastic4s I want to query total sum of sales grouped by product name in Elasticsearch
How do I do that using elastic4s?
client.execute {
      search ("sales"/ "sales_type")
        .query {rangeQuery("date") gte "01-01-2018"   lte "31-12-2018" }
          .aggs { termsAgg("s1","product_name")}
             .aggs  (sumAgg("sums","total_sum"))
}

currently my code just sums up all in given date range, not grouping by product name

A: You've probably found an answer by now anyway, but here's my 2p worth for anyone else who comes across this.... you probably want to use a sub-aggregation on product_name rather than a second aggregation on the whole dataset.
Something like this (untested code, but based on a working part of one of my projects):
.query {rangeQuery("date") gte "01-01-2018"   lte "31-12-2018" }
  .aggs { termsAgg("s1","product_name").subAggregations(
             sumAgg("sums","total_sum")
          )
        }

The results come back as a bunch of nested Map[String,Any] which take a bit of sorting through, but some logging/print statements and a bit of trial and error sorted it out for me.
Reference is here: https://github.com/guardian/archivehunter/blob/47372d55d458cfe31e5d9809910cc5d9a4bbb9bf/app/controllers/SearchController.scala#L203, in that case I am processing it down for rendering in a browser frontend with ChartJS.
Apologies for brevity, but I'm on the hop at the moment and haven't got long to post :)


text:
Q: Need the specific command to get a particular value from df command I am running a python script to get few commands to get executed on a remote aix server. The command is to get the size of a file system.
command : df -g | grep -w /
output :
/dev/hd4           0.94      0.87    8%     3865     2% /
I only want 0.87 as output which is the third column of output. I want to extract the value in a variable but grep will give me a scalar value. Please let me know how can I format this command to do what i intend to do.

A: You can use subprocess.check_output with shell=True:
import subprocess

print(subprocess.check_output(["df -g | grep -w /"], shell=True).split()[2])

.split() splits the return into the separate values, and then [2] gets the value that you want.


text:
Q: VBA-Sorting the data in a listbox, sort works but data in listbox not changed A listbox is passed, the data placed in an array, the array is sort and then the data is placed back in the listbox.  The part that does work is putting the data back in the listbox. Its like the listbox is being passed by value instead of by ref.
Here's the sub that does the sort and the line of code that calls the sort sub.
Private Sub SortListBox(ByRef LB As MSForms.ListBox)

Dim First As Integer
Dim Last As Integer
Dim NumItems As Integer
Dim i As Integer
Dim j As Integer
Dim Temp As String
Dim TempArray() As Variant

ReDim TempArray(LB.ListCount)

First = LBound(TempArray)               ' this works correctly
Last = UBound(TempArray) - 1            ' this works correctly

For i = First To Last
    TempArray(i) = LB.List(i)           ' this works correctly
Next i

For i = First To Last
    For j = i + 1 To Last
        If TempArray(i) > TempArray(j) Then
            Temp = TempArray(j)
            TempArray(j) = TempArray(i)
            TempArray(i) = Temp
        End If
    Next j
Next i                               ! data is now sorted

LB.Clear                             ! this doesn't clear the items in the listbox

For i = First To Last
    LB.AddItem TempArray(i)          ! this doesn't work either
Next i

End Sub

Private Sub InitializeForm()

'   There's code here to put data in the list box

Call SortListBox(FieldSelect.CompleteList)

End Sub

Thanks for your help.

A: This works for me on Excel 2003 on a very basic UserForm with a single ListBox called ListBox1:
Private Sub UserForm_Initialize()

ListBox1.AddItem "john"
ListBox1.AddItem "paul"
ListBox1.AddItem "george"
ListBox1.AddItem "ringo"

SortListBox ListBox1

End Sub

and then your SortListBox as written apart from fixing the three comments which start with ! rather than '
The only difference to your initializer is the name (UserForm_Initialize vs InitializeForm). Make sure to use the object and event selectors at the top of the code page for the userform to ensure that the event handlers get named correctly

A: You can't pass objects by value. Since you're not going to return another instance of listbox to the caller, you should declare LP as ByVal. That does not affect the code though. It works and the list gets sorted. I think you omitted some importand details.

A: Here is how I used this, for example, w/ a relational Dictionary and two columns:
Private Sub UserForm_Initialize()

 Call HideTitleBar(Me)

 Set ExtraFiltersDic = CreateObject("scripting.dictionary")
 ExtraFiltersDic.CompareMode = 1
 Set ExtraFiltersDic = GetExtraFiltersDic()

 Dim k
 For Each k In ExtraFiltersDic.Keys
  ListBox1.AddItem k
 Next

 Call SortListBox(ListBox1, ListBox2, ExtraFiltersDic)

End Sub

Public Sub SortListBox(ByRef ListBox As MSForms.ListBox, Optional ByRef ListBox2 As MSForms.ListBox, Optional ByRef RelationalDic As Object)

 Dim First As Integer, Last As Integer, NumItems As Integer
 Dim i As Integer, j As Integer
 Dim TempArray() As Variant, Temp As String

 ReDim TempArray(ListBox.ListCount)

 First = LBound(TempArray)
 Last = UBound(TempArray) - 1
 For i = First To Last
    TempArray(i) = ListBox.List(i)
 Next i

 For i = First To Last
    For j = i + 1 To Last
        If TempArray(i) > TempArray(j) Then
            Temp = TempArray(j)
            TempArray(j) = TempArray(i)
            TempArray(i) = Temp
        End If
    Next j
 Next i

 ListBox.Clear

 If Not ListBox2 Is Nothing And Not RelationalDic Is Nothing Then
  Set KeyValDic = CreateObject("scripting.dictionary")
  Set KeyValDic = RelationalDic
 End If

 For i = First To Last
    ListBox.AddItem TempArray(i)
    If Not ListBox2 Is Nothing And Not RelationalDic Is Nothing Then
     ListBox2.AddItem KeyValDic(TempArray(i))
    End If
 Next i

End Sub

A: I dont know if this would work for you but try it this way.
First, make an array of all the items in the list box
Pass that array to your function
Sort that array
return the array to the main program
clear the listbox
overwrite the listbox items with the new array


text:
Q: Template for average value from const array in c++ I have following template in c++ for compute average value:
template <typename T>
T average(T t[], int n)
{
    T s = t[n - 1];
    for (int i = 0; i < (n-1); i++)
        s += t[i];
    return s / n;
}

But when I try call function with constant array I have an error, for example:
const double array[5] = { 23.4, 523.5, 55.2, 543.2, 6.4 };
double a = average(array,5);

error C3892: 's': you cannot assign to a variable that is const

How to define this template to compute from constant array?

A: Actually, your function takes a pointer, not an array. T t[] in a parameter list is the same as T* t for historical reasons.
Just make it take a pointer to const instead of one to non-const:
template <typename T>
T average(T const* t, int n) {
    T s = t[n - 1];
    for (int i = 0; i < (n-1); i++)
        s += t[i];
    return s / n;
}

Or, even better, take an iterator pair so you can use it with any container and not just C-style arrays:
template <typename It>
auto average(It begin, It end) {
    assert(begin != end);
    auto s = std::accumulate(begin, end, 0.0);
    return s / std::distance(begin, end);
}

const double array[] = { 23.4, 523.5, 55.2, 543.2, 6.4 };
double a = average(std::begin(array), std::end(array));

A: You can use type traits the following way
#include <iostream>
#include <type_traits>

template <typename T>
T average(T t[], int n)
{
    typename std::remove_const<T>::type  s = t[n - 1];
    for (int i = 0; i < (n-1); i++)
        s += t[i];
    return s / n;
}

int main()
{
    const double array[5] = { 23.4, 523.5, 55.2, 543.2, 6.4 };
    double a = average(array,5);
}

Though your function looks strange. Take into account that in general case parameter n can be equal to zero. In this case your function will be invalid.


text:
Q: iOS nested viewcontrollers and interface builder I'm very new to iOS development and i'm trying to get my head around viewControllers and how they're used with storyboards. I've read a lot of the official documentation on viewControllers, Objective-C and i've played around with xCode to familiarise myself with it.
I'm trying to create the following:
Main Window
   - My starting view should contain three "frames" (i'm trying not to use iOS terminology as I don't want to confuse things)

*

*Frame 1) A rectangular area stretching across the screen containing three buttons. Each button when pressed causes frame 2 below to change between different views. This frame kind of acts like a tab view controller but with the tabs at the top and the view being changed in frame 2.

*Frame 2) Contains two columns of scrollable table items. When an item in the first column is selected, it causes the contents in the second column to change.

*Frame 3) A simple scrolling text label.

My thinking was that I could achieve the above as follows:
InitialViewController
    Frame 1) One nested/embedded containerViewController containing 3 buttons
    Frame 2) Two embedded tableViewControllers. I was thinking that TVC 1 could pass the cell selected action up to the mainViewController (via delegation) which would then instruct TVC 2 to change it's contents.
    Frame 3) A scrollable view
I'm trying to create the above in a storyboard and i'm stuck with frame 2, I've created Frame 1 (a containerViewController containing 3 buttons) but when I try to drag a tableViewController onto my main view it's not letting me. Dragging it onto the canvas is fine, it just wont let me drag it onto the main view.
Have I misunderstood how to use viewControllers (and therefore my planned design is wrong) or is it something i'm not doing correctly in the xcode interface designer?
Any help really appreciated!

A: If you don't use the correct terminology, then you probably won't be thinking about your structure correctly. Frame 1, for instance, should be a UIView containing three buttons, not an embedded controller. "Frame 2", could be 2 embedded table view controllers, but I think a 2 component UIPickerView might be more appropriate. As for embedding controllers in another controller's view in the storyboard, you do that by dragging in a container view, and that will give you a new controller automatically.
I think you have misunderstood view controllers. A view controller can have multiple subviews (buttons, a picker view, a label) that it can host, you don't necessarily need to have multiple view controllers to do what you're trying.


text:
Q: Ping FeedBurner in Django App I have a django site, and some of the feeds are published through FeedBurner. I would like to ping FeedBurner whenever I save an instance of a particular model. FeedBurner's website says to use the XML-RPC ping mechanism, but I can't find a lot of documentation on how to implement it.
What's the easiest way to do the XML-RPC ping in django/Python?

A: Use pluggable apps, Luke!
http://github.com/svetlyak40wt/django-pingback/

A: You can use Django's signals feature to get a callback after a model is saved:
import xmlrpclib
from django.db.models.signals import post_save
from app.models import MyModel

def ping_handler(sender, instance=None, **kwargs):
    if instance is None:
        return
    rpc = xmlrpclib.Server('http://ping.feedburner.google.com/')
    rpc.weblogUpdates.ping(instance.title, instance.get_absolute_url())

post_save.connect(ping_handler, sender=MyModel)

Clearly, you should update this with what works for your app and read up on signals in case you want a different event.

A: maybe sth like that:
import xmlrpclib
j = xmlrpclib.Server('http://feedburnerrpc')
reply = j.weblogUpdates.ping('website title','http://urltothenewpost')


text:
Q: hole on a continuous function Say f(x)= x+1.
Now $\lim \limits_{x \to 1}$ f(x), we can see easily that there is no hole in it or it is continuous everywhere. Since it is a straight line.
But when we write the same f(x) as,
f(x) = x+1 = (x+1)(x-1)/(x-1) = $(x^2-1)/(x-1)$.
$$\text{Or say g(x) }= (x^2-1)/(x-1)$$
i.e  $\lim \limits_{x \to 1} g(x)=\lim \limits_{x \to 1}(x^2-1)/(x-1)$
In this site https://www.mathsisfun.com/calculus/limits.html it says g(x) has a hole at x=1. But isn't both f(x) and g(x) are same. Please explain. Thanks.

A: A function isn't just an expression. It also has a domain (and usually a codomain, although that's less important for this discussion). Often when we write a function as an expression, we implicitly assume that the domain is as large as it could possibly be given the expression we have, rather than stating the domain explicitly. This is bad practice, but it is what it is.
With that in mind, the implied domain for $f$ is all of the real number line, while the implied domain for $g$ is the whole number line except $1$. When restricted to the domain of $g$, the two are indeed the same function, but the difference of domains makes them not the same.


text:
Q: Clojure - map-indexed is it possible to start with an index other than 0? Usually map-indexed function maps each list item to a respective index where the first index is 0, the second is 1 etc.
Is it possible to have the index start at another number and proceed from there?

A: map-indexed does not allow this. However, it's easy to write your own version that lets you do it.
(defn map-indexed-from [n f coll]
  (map f (range n Double/POSITIVE_INFINITY) coll))

Example usage:
user> (map-indexed-from 5 vector [:a :b :c])
([5 :a] [6 :b] [7 :c])

A: Easiest way is to just remember that you can pass multiple sequences to map.
(map vector [:a :b :c] (iterate inc 100))

=> ([:a 100] [:b 101] [:c 102])

A: You simply wrap the index with another function in the receiving function
For example if we wanted to start at 1 instead of zero we would simply use inc
(map-indexed (fn [i v] (vector (inc i) v)) ["one" "two" "three"])

Will return
([1 "one"] [2 "two"] [3 "three"])


text:
Q: Formatting Numbers as Strings with point in place of Decimals no matter Culture WinForms, I have a textbox leave event, in the textbox the user is prompted to add a price example:
He needs to provide the price in the textbox let's say he writes 5 only, the textbox leave event should get him 5.00 and it's working but there is a problem on other computers that use other culture for example in that computer that I encountered the problem Point '.' this is treated as comma this ',' and if user prompts 5.43 he will get 543,00 not 5.43 or 5 to get 5.00 he will get comma. I need to get for every computer no matter the culture to work only with Point this '.'
here is my code:
decimal number = 0;
if (Decimal.TryParse(textBox20.Text, out number))
{
   textBox20.Text = Decimal.Parse(textBox20.Text).ToString("0.00");
}
else
{
   textBox20.Text = "0.00";
}

A: Just use the overload of decimal.TryParse which takes an IFormatProvider, and specify the invariant culture. Then use that for formatting, too. (I'm assuming you want it to be treated consistently as "dot for the decimal separator" on both parsing and formatting.)
Oh, and only parse once - why do it twice?
decimal number = 0;
if (Decimal.TryParse(textBox20.Text, NumberStyles.Number,
                     CultureInfo.InvariantCulture, out number))
{
    textBox20.Text = number.ToString("0.00", CultureInfo.InvariantCulture);
}
else
{
    textBox20.Text = "0.00";
}

Given that 0 will be formatted that way as well, you don't even need anything to be conditional:
decimal number;
decimal.TryParse(textBox20.Text, NumberStyles.Number,
                 CultureInfo.InvariantCulture, out number);
textBox20.Text = number.ToString("0.00", CultureInfo.InvariantCulture);

We don't care about the return value of TryParse in this case, because if it fails, number will be 0, which is fine...


text:
Q: How do I call a VBA function through .Net Interop In VBA/VB6 I can call a function or a subroutine like so:
Call myFunction

I am plugging into an Access application from .Net like so:
using MSAccess = Microsoft.Office.Interop.Access.Application;

var access = new MSAccess();
access.OpenCurrentDatabase(@"C:\myDatabase.accdb");

access. //Here I can more or less type my VBA code the same way I can natively

access.CloseCurrentDatabase();
Marshal.ReleaseComObject(access);

What do I put after the dot to call myFunction via MS Access Interop?

A: See if Application.Run does what you want, based on the example given in the link.
EDIT: Also, DoCmd.RunMacro should work.