text:
Q: is this possible to only show list view holding for some specific child value of real time Firebase database I have created this database enter image description here and want to show the list specifically for the child availability: "Available" item.  I have nearly reached to the goal by this code
public class Homeuser extends AppCompatActivity {

SharedPreferences preferences;
SharedPreferences.Editor editor;
ListView lv;

FirebaseListAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_homeuser);

    final Vibrator vibeuser = (Vibrator) Homeuser.this.getSystemService(Context.VIBRATOR_SERVICE);

    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    editor = preferences.edit();

    Query query = FirebaseDatabase.getInstance().getReference().child("food");
    lv = findViewById(R.id.list_item);
    FirebaseListOptions<food> options = new FirebaseListOptions.Builder<food>()
            .setLayout(R.layout.list_items).setLifecycleOwner(Homeuser.this)
            .setQuery(query,food.class).build();

    adapter = new FirebaseListAdapter(options)
    {
        @Override
        protected void populateView(View v, Object model, int position) {
            TextView itemname, itemprice, avail;

            itemname = v.findViewById(R.id.itemname);
            itemprice = v.findViewById(R.id.itemprice);
            avail = v.findViewById(R.id.avail);

            food itemFood = (food) model;

            if(itemFood.getAvailability().toString().equals("Available")){
            itemname.setText(itemFood.getFooditemname().toString());
            itemprice.setText(itemFood.getFooditemprice().toString());
            avail.setText(itemFood.getAvailability().toString());}
        }

    };}}

But faces a problem like this:
enter image description here how to get rid of this? Thank you.

A: If you want to filter Firebase database records, you should use a query along with a whereEqual() call and not an if statement inside your populateView() method. So to solve this, please change the following line of code:
Query query = FirebaseDatabase.getInstance().getReference().child("food");

to
Query query = FirebaseDatabase.getInstance().getReference()
    .child("food")
    .orderByChild("availability")
    .equalTo("Available");

And remove the if statement.


text:
Q: Is there an official LUIS API that returns the total number of Utterances for each intent? I noticed the LUIS portal (www.luis.ai) shows Intents with the total number of Utterances for each.  I'm looking to build a similar page in my application, although Microsoft's published APIs don't have a method that returns the total utterances per intent.
We noticed the LUIS dashboard is using this API to pull the data, but the method is not published in their docs:
https://westus.api.cognitive.microsoft.com/luis/webapi/v2.0/apps/{appId}/versions/{version}/stats/labelsperintent
Does anyone know whether this is an official API that can be used?  We don't want to use it and then Microsoft makes changes to it later which could break our code.

A: The endpoint you discovered is not an official API. Notice that it's luis/webapi/v2.0 instead of luis/api/v2.0. You can use it, but like you said you run the risk of it changing later.
I recommend using the example utterances - Review labeled examples API: https://[location].api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/examples[?skip][&take]. You would just need to query the data yourself to see the utterance count for each intent.

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL multiple condition on same table I have table "Transaction" with column

*

*ID(primary)

*Type (A or B)

*Status (0 or 1)

I want to execute "SELECT * from Transaction WHERE type = 'B' and status = 0", BUT this query can only return result if there is no Type "A" with status = 0. Is that possible to do that with one sql query?

A: You can use not exists:
SELECT *
FROM Transaction t
WHERE type = 'B' and status = 0 AND
      NOT EXISTS (SELECT 1
                  FROM Transaction t2
                  WHERE type = 'A' AND status = 0
                 );

Note:  Normally there would be a correlation clause which would connect to the subquery to the outer query.


text:
Q: Trigger each div independently using same script I'm trying to get each blue div (

) to fire independently.
Right now, if you hover/click over the first one, both fire simultaneously, and if you hover/click over the second one, neither fires.
This is a common question and has been addressed elsewhere, but I've tried to implement several different versions and apply it to this particular code, and it's not working. I was hoping someone could provide some explanation to help me learn, and I can compare to the other posts I've tried out to understand what the difference is.

$('.rectangle1').hide();
  $('#rectangle').on('click', function() {
    clicked = !clicked;
  });

  $('#rectangle').hover(function() {
    $('.rectangle1').slideDown()
  },function() {
    if (!clicked) {
      $('.rectangle1').slideUp()
    }
  });
});

http://jsfiddle.net/Q5cRU/99/

A: One problem is that you're using id="rectangle" for two elements. According to MDN:

The id global attribute defines a unique identifier (ID) which must be unique in the whole document.

jQuery is only adding the event listeners to the first element with that ID.

A: Well in HTML, the id attribute must be unique per element. See this. The class attribute can be shared by multiple elements to have the same style effect or same purpose. So the first and second div can't have the same id - "rectangle". To fire event independently you can assign different id for them.

A: HTML:

CSS:
.rectangle {
   width: 140px;
   height: 80px;
   background: #037CA9;
  margin-bottom:10px;
}

.rectangle-hover {
   width: 140px;
   height: 150px;
   background: red;
}

Javascript:
$(function(){

    var clicked = false;

    $('.rectangle-hover').hide();

    $('.rectangle').hover(
        function(){
            $(this).parent().find('.rectangle-hover').slideDown();
        },
        function(){
            if (!clicked) {
                $('.rectangle-hover').slideUp()
            }
        }
    );

});

A: The answer is simple: The event listener was only applied to the first #rectangle. jQuery does not select more than one #ID'd element. With that being said it is not semantic to use the same id on more than one element.
Here's what you are looking for: http://jsfiddle.net/Q5cRU/116/
$(document).ready(function() {

    $('.rectangle1').hide();

    $('.rectangle').data( 'clicked', false).click(function() {

       $(this).data( 'clicked', !$(this).data('clicked'));

    }).hover(
      function() {

        $(this).next('.rectangle1').slideDown();

      },
      function() {

          if (!$(this).data('clicked')) {

             $(this).next('.rectangle1').slideUp();

          }
      }
    );
});

$("div.rectangle1").mouseover(function() {
  $(this).stop(true, true).show();
});


text:
Q: Append DIV (specified by class) inside other DIV (specified by other class) I have HTML sheets "A" and "B".
(HTML sheet "B" is read into html sheet "A". "A" works as a "template" for the very varying content in "B".)
I have this div in HTML sheet "A".

I add this div to HTML sheet "B":

          hello

This is my required outcome:

              hello

The div class="productsheet" should be hidden from its original position. So only be visible inside div class="productsheet-container".
If anyone could help me here, I'd be forever grateful!
What JavaScript do I use exactly? Note! I'm a COMPLETE NEWB to JavaScript, haven't written one single line in my life! So, to me, the answers I've found googling seem insufficient.
I've, for example, tried:
$( ".productsheet-container" ).append( $( "
" ) );

But shouldn't I write something before and/or after too?

A: USE this:
$(".productsheet-container" ).append("

");

.append() documentation
WORKING FIDDLE
I would suggest you to learn plain javascript first,and then get on jQuery.

A: You could solve this with just CSS:
.productsheet{
    display:none;
}
.productsheet-container .productsheet{
    display:block;
}

Demo here
To do the second part you can use this:
$(".productsheet-container").append($('.productsheet'));

Demo here

A: Create the div as template and hidden from view using style="display:none"

   hello

In your Javascript, clone the template, set display:block and append to .productsheet-container whenever you need.
$( ".productsheet-container" ).append( $("#template").clone().css("display","block" ));


text:
Q: Cannot convert value of Unsafe pointer? to expected argument type xcode 8 With Xcode8, I've been upgrading to Swift 3. However I'm getting this error:

Cannot convert value of Unsafe pointer? to expected argument type 'String'

With this line of code:
let queue = DispatchQueue(label: (name as NSString).utf8String, attributes: [])

What does this mean and how do I resolve that?

A: DispatchQueue(label:) takes a regular Swift string, so you can simply use name. Also, the attributes parameter has a default value of [], so you can simply write
let queue = DispatchQueue(label: name)


text:
Q: cannot parse VideoView.setVideoURI I'm try to make VideoView as below.
MediaController mediaController = new MediaController(this);
        mVideoView.setMediaController(mediaController);
        mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.1429313800506));

but it shows Syntax error on token ".1429313800506", delete this token.
I don't know what's wrong in that syntax;
1429313800506.3gp is located in /res/raw/
It didn't get problem before.

A: Capital letters,Numbers and some symbols are not allowed to be in the name of the file .You should use small letter instead 1429313800506

A: 1429313800506 is not a valid java identifier. Variables have to start with a letter the _ or $, and since the content of res/ is translated in java identifiers at compile time, you have to rename the file's name to be compliant to the java conventions/rules


text:
Q: Stuck on react routing from side bar I am new to react and working on react-routing and i am stuck. I created a component and added a   Link to = "/" which is working fine when this component is rendered. but the same link is not working in the sidebar component. It only changes the route but dont render the home component.
Any help will be appreciated.
so for example,
my app.js file consists of routes such as this
Route   path="/home" component={Home}/>
which is rendered fine when i am calling home component from any other component via link to="/home" but when i am using the same link to="/home" from sidebar component. it just changes the routes and doesn't render the home component.
my sidebar component is just like any other component.
i am not sure why it is happening.
Please help.

A: React Router provides a <Switch> component which is useful when you have multiple routes.
You can wrap your <Route>s in a <Switch> inside the router.
A simple example is:

<BrowserRouter>
  <Switch>
    <Route path="/home" component={() => "Home"} />
    <Route path="/messages" component={() => "Messages"} />
    <Route path="/another" component={() => "Another"} />
  </Switch>
</BrowserRouter>

Reference article: https://reacttraining.com/react-router/web/api/Switch


text:
Q: Is sum of tail probability always less than integral of tail probability? I'm working through some Probability and Measure Theory, and frequently we have been using the fact that for $X_i$  iid
$\sum\limits_{k = 1}^{\infty} P(|X_1| > k) \leq \int\limits_0^{\infty}P(|X_1| >t)dt$
Intuitively this makes sense but other than seeing a graph, I haven't been able to convince myself why this is always true, nor have I been able to come up with a counter example. Any insights on how to prove/disprove for a generic iid r.v?
Thanks!

A: If you have two events, $|X|>k_1$ and $|X|>k_2\geq k_1$, The second event includes the first, so $P(|X| > k_1) \leq P(|X| > k_2)$
In particular, $P(|X|>k) \leq \int_k^{k+1} P(|X| > k) dt$ for any natural number $k$.

A: You have $\int_0^1 P(X_1\gt t) dt \ge \int_0^1 P(X_1\gt 1)dt=P(X_1 \gt 1)$ and similarly  $\int_n^{n+1}1 P(X_1\gt t) dt \ge \int_0^1 P(X_1\gt n)dt=P(X_1 \gt n)$, so each interval in the integral dominates the element in the sum at the end.

A: Actually the inequality goes the other way round:
$$\sum_{n=0}^\infty \Bbb P(|X|>n) ≥ \int_0^\infty \Bbb P(|X|>t)dt$$
Here's a quick sketch of a proof:
Let p and q be natural numbers s.t. p ≥ q.
Then, for any random variable X, it is easier for |X| to be larger than q than to be larger than p, since q is smaller.
So if |X| is larger than p, then a fortiori |X| is larger than q, hence the event {|X|>p} is included in the event {|X|>p}.
(i.e. the set of outcomes that make |X| bigger than p also make |X| bigger than q)
Thus we find the inequality
(1) $ \Bbb P(|X|>p) ≤ \Bbb P(|X|>q)$
It now follows that
(2) $ \Bbb P(|X|>n) ≥ \int_n^{n+1} \Bbb P(|X|>t)dt $
Hence by taking the sum over all natural numbers on both sides of the last inequality, we find
(3) $\sum_{n=0}^\infty \Bbb P(|X|>n) ≥ \sum_{n=0}^\infty \int_n^{n+1} \Bbb P(|X|>n) = \int_0^\infty \Bbb P(|X|>t)dt$
and the claim follows.
In addition, it is sometimes useful in this context to know that the following result holds:
(4) "The sum $\sum \Bbb P(|X|>p)$ and the integral $\int \Bbb P(|X|>p)$ are of the same kind"
in the sense that
$\sum \Bbb P(|X|>p)$ is finite iff $\int \Bbb P(|X|>p)$ is finite, and
$\sum \Bbb P(|X|>p)$ is infinite iff $\int \Bbb P(|X|>p)$ is infinite
Note the the lower bound of summation/integration plays no role in the finiteness of these sums/integrals, as long as we sum/integrate up to infinity.
To see that (4) holds, consider equation (2) with the following additional lower bound:
(5) $\Bbb P(|X|>n) ≥ \int_n^{n+1} \Bbb P(|X|>t)dt ≥ \Bbb P(|X|>n+1)$
which follows directly from our preliminary observations.
By taking the infinite sum over all natural n in (5) one finds
(6) $\sum_{n=0}^\infty \Bbb P(|X|>n) ≥ \int_0^\infty \Bbb P(|X|>t)dt ≥ \sum_{n=0}^\infty \Bbb P(|X|>n+1)  = \sum_{n=1}^\infty \Bbb P(|X|>n)$
The right and left most sum only differ by the single term $\Bbb P(|X|>0)$ which is an element of $[0,1]$ and thus in particular finite. Therefore either both sums are finite or infinite.
Hence any of the two sums is finite if the integral is finite (using the second inequality), and the sums are infinite if the integral is infinite (using the first inequality).
This shows the claim in (4).


text:
Q: Duplicate Stack-Layout with diferent parameters I have this project where I have 3 stack layouts (in the picture I refer each one as "turno"). Each one of then refers to a period of the day.
What I'm trying to do is:
Sometimes There is more then one "turno" per period, so I need to duplicate the stack layout refering to that "turno" (each "turno" have a set of collors and images inside).
If anyone have any ideia of how to do this, using xaml to build the StackLayout I appreciate it.
The result:

The code:
 <StackLayout Padding="10">
    <!--turno 1-->
    <StackLayout Orientation="Horizontal"  BackgroundColor="#ebc183"
                 IsVisible="{Binding turno_um}"
                 BindableLayout.ItemsSource="{Binding obs_turno}">
        <StackLayout.GestureRecognizers>
            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
        </StackLayout.GestureRecognizers>
        <Image Source="turno_um.png"
               WidthRequest="100"
               Margin="5" />
        <StackLayout HorizontalOptions="CenterAndExpand">
            <Label Text="{Binding dia_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Center"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding frota_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding data_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
        </StackLayout>
    </StackLayout>
    <!--turno 2-->
    <StackLayout Orientation="Horizontal"  BackgroundColor="#f2d061"
                 IsVisible="{Binding turno_dois}"
                 BindableLayout.ItemsSource="{Binding obs_turno}">
        <StackLayout.GestureRecognizers>
            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
        </StackLayout.GestureRecognizers>
        <Image Source="turno_dois.png"
               WidthRequest="100"
               Margin="5" />
        <StackLayout HorizontalOptions="CenterAndExpand">
            <Label Text="{Binding dia_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Center"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding frota_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding data_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
        </StackLayout>
    </StackLayout>
    <!--turno 3-->
    <StackLayout Orientation="Horizontal"  BackgroundColor="#438fb2"
                 IsVisible="{Binding turno_tres}"
                 BindableLayout.ItemsSource="{Binding obs_turno}">
        <StackLayout.GestureRecognizers>
            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
        </StackLayout.GestureRecognizers>
        <Image Source="turno_tres.png"
               WidthRequest="100"
               Margin="5" />
        <StackLayout HorizontalOptions="CenterAndExpand">
            <Label Text="{Binding dia_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Center"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding frota_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
            <Label Text="{Binding data_turno}"
               FontAttributes="Bold"
               HorizontalOptions="CenterAndExpand"
               VerticalOptions="Start"
               MinimumHeightRequest="100"
               FontSize="25" />
        </StackLayout>
    </StackLayout>
</StackLayout>

A: You should use a ListView to show a list of "turnos" and use a Selector to select its template according its "turno".
First, create a model and add a Type property:
 public class Turno
{
    public string Name{ get; set; }
    ...
    public TurnoType Type { get; set; }
}

In your XAML code:
xmlns:selectors="clr-namespace:YourNamespace.App.Helpers"

<ContentPage.Resources>
    <ResourceDictionary>
        <templates:Tuno1ItemTemplate x:Key="Turno1ItemTemplate" />
        <templates:Turno2ItemTemplate x:Key="Turno2ItemTemplate" />
        <templates:Turno3ItemTemplate x:Key="Turno3ItemTemplate" />

        <selectors:TurnoDataTemplateSelector x:Key="TurnoDataTemplateSelector"
                                       Turno1Template="{StaticResource Turno1ItemTemplate}"
                                       Turno2Template="{StaticResource Turno2ItemTemplate}"
                                       Turno3Template="{StaticResource Turno3ItemTemplate}" />
    </ResourceDictionary>
</ContentPage.Resources>

<ListView
    ItemsSource="{Binding Turnos}"
    ItemTemplate="{StaticResource TurnoDataTemplateSelector}">
</ListView>

And create a Selector like this:
public class TurnoDataTemplateSelector : DataTemplateSelector
{
    public DataTemplate Turno1Template{ get; set; }
    public DataTemplate Turno2Template{ get; set; }
    public DataTemplate Turno2Template{ get; set; }

    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
    {
        TurnoType type = ((Turno)item).Type;
        switch (type)
        {
            case TurnoType.One:
                return Turno1Template;

            case TurnoType.Two:
                return Turno2Template;

            case TurnoType.Three:
                return Turno3Template;

            default:
                return null;
        }
    }
}

Now your Selector will select a ItemTemplate according its "turno"


text:
Q: Max number (not max digits) in HTML pattern I'd like to have a simple html-input, which validates the edition-number of a magazine via HTML5 (no worry, it's re-checked server-sided anyway).
The format shall be EDITIONNUMBER/YEAR. The magazine appears monthly, so beside the max-digit of 2 (correct is 1/2019 and 12/2018) it should have a maximal number of 12 (13/2018 never exists). So my problem is not to find out, how to set up the max digit number, but a maximum number in a pattern for HTML5.
Everything >=1 and <=12 should be correct before /YYYY.
So far I use this one, which at least checks for 0/0000 or 00/0000. In my case it's not necessary to check the correct date format, because that's also validated with php checkdate, but the number of the edition should be right in the first step.
<input type="text" pattern="[0-9]{1,2}/[0-9]{4}">

Any ideas?

A: You may try using the pattern:
([1-9]|1[0-2])/[0-9]{4}

The above pattern uses an alternation for the edition number to either match 1-9 (on the left side), or 10-12 (on the right side).  This can then be followed by any 4 digit year.
In your code:
<input type="text" pattern="([1-9]|1[0-2])/[0-9]{4}">


text:
Q: Showing pagination links based on total number of records So i am using rails and want to proceed with either will_paginate or kaminari for pagination. Here is my below requirement.

*

* I have lets say 900 records and want to show 10 records per page. So in total i want to show 90 links in pagination like >. So just based on records count i want to perform this.

So my question is, Though i have overall 900 records, my end point only gives me 10 records at the start. But I want to show links for 900 records (10 records per page). Using pagination later i want to load dynamically whenever user has clicked random page.

A: I go with Ojash answer. you can use kaminari and specify the window.
<%= paginate @users, :outer_window => 3 %>


text:
Q: Cascading-Hadoop: isSafe() in Operation
Returns true if this Operation instance can safely execute on the same
  'record' multiple times, false otherwise. That is, this Operation is
  safe if it has no side-effects, or if it does, they are idempotent.
If seeing the same 'record' more than once can cause errors
  (internally or externally), this method must return false.
  http://docs.cascading.org/cascading/2.0/javadoc/cascading/operation/Operation.html#isSafe()

What is the meaning of can safely execute on the same 'record' multiple times?
At first I thought the meaning is it's a pure function. But is it? What is the meaning of idempotent?
What is the example of unsafe operation? The description told about safely execute on the same record. What kind of operation that can't operate safely on same record?


text:
Q: How to parse xml element using attribute value How to parse xml element using attribute value. i am using Dom for parsing XML file. i am not sure for parsing xml element only having attribute value. is this possible in DOM..??

A: The following XPath expression will select all elements that have given attibute/attribute-value pair:
//*[@foo="bar"]

Example:
<root>
 <grand foo="bar">    <!-- selected -->
   <child foo="nobar"/>
 </grand>
 <grand foo="nobar">
   <child foo="bar"/> <!-- selected -->
 </grand>
</root>

Here's a tutorial for the Java XPath API (jaxp). It has some snippets that show how to use it.


text:
Q: Forwarding with Exim routers and transports I wrote 2 routers to take care of forwarding in one of my mail server:
virtual_aliases_nostar:
  driver = redirect
  allow_defer
  allow_fail
  require_files = "+/var/auth/valiases/$domain"
  data = ${lookup{$local_part@$domain}lsearch{/var/auth/valiases/$domain}}
  file_transport = address_file
  group = mail
  pipe_transport = virtual_address_pipe
  retry_use_local_part
  unseen

virtual_aliases:
    driver = redirect
    allow_defer
    allow_fail
    require_files = "+/var/auth/valiases/$domain"
    data = ${lookup{*}lsearch{/var/auth/valiases/$domain}}
    file_transport = address_file
    group = mail
    pipe_transport = virtual_address_pipe
    unseen

Which call for this transport:
virtual_address_pipe:
  driver = pipe
  group = some_user
  return_output
  user = some_user

In case there is a valiases/somedomain.com file like the one below, it will resolve the first email and forward it but will stop there.
user1@domain.com: user1@forwardomain.com
user1@domain.com: user3@forwardomain.com
user1@domain.com: user4@forwardomain.com
user1@domain.com: user9@forwardomain.com
user1@domain.com: user111@forwardomain.com
user1@domain.com: user12@forwardomain.com
user1@domain.com: user11@forwardomain.com

Basically user1@domain.com will be forwarded to user1@forwardomain.com only and stop there.
Any idea why it happens? thanks.

A: What are you expecting it to do?  You seem to expect the virtual_address_pipe transport to be called, but the aliasfile example you give doesn't have any pipe aliases in them...
omigosh...  I just reread your question for the 20th time.  I got distracted by the fact that what you are describing doesn't quite gel with your example, since a redirect to another email address wouldn't trigger a pipe_transport.  I'm going to assume your real alias file redirects to actual pipes and it got lost in translation when you tried to clean up for an example instead of posting the real config and alias file you are having problems with.
Anyway, ignoring that, I think the answer to your question is as simple as putting all the targets on a single line:
user1@domain.com: user1@forwardomain.com, user3@forwardomain.com, user4@forwardomain.com, user9@forwardomain.com, user111@forwardomain.com, user12@forwardomain.com, user11@forwardomain.com

You only ever do one lookup per local_part in a router like that.  Pu all the targets on a single line and Exim will handle re-routing/transporting/etc all the targets that are looked up.  This works for email address, files, and pipes:
 user1@domain.com: /path/to/file, |/path/to/pipe, user1@forwardomain.com

Hope that helps.


text:
Q: Upload clickonce to SharePoint I'm following this tutorial to upload a clickonce application to SharePoint. This is my Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyClickonce" Path="MyClickonce20110815152200">
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\AvalonDock.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/AvalonDock.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\AvalonDock.Themes.Aero.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/AvalonDock.Themes.Aero.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Catel.MVVM.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Catel.MVVM.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\IntelliSense.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/IntelliSense.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Microsoft.SharePoint.Client.Runtime.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Microsoft.SharePoint.Client.Runtime.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Microsoft.VisualStudio.Activities.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Microsoft.VisualStudio.Activities.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Microsoft.Visualstudio.Activities.HostView.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Microsoft.Visualstudio.Activities.HostView.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Microsoft.Windows.Design.Extensibility.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Microsoft.Windows.Design.Extensibility.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\Microsoft.Windows.Shell.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/Microsoft.Windows.Shell.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\PATOneRule_Builder.application" Url="Application Files/PATOneRule_Builder_1_0_0_271/PATOneRule_Builder.application" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\PATOneRule_Builder.exe.config.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/PATOneRule_Builder.exe.config.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\PATOneRule_Builder.exe.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/PATOneRule_Builder.exe.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\PATOneRule_Builder.exe.manifest" Url="Application Files/PATOneRule_Builder_1_0_0_271/PATOneRule_Builder.exe.manifest" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\RibbonControlsLibrary.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/RibbonControlsLibrary.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\rule.ico.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/rule.ico.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\RulesDll.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/RulesDll.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\RunWorkflow.exe.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/RunWorkflow.exe.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\de\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/de/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\de\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/de/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\de\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/de/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\en\Microsoft.IdentityModel.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/en/Microsoft.IdentityModel.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\es\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/es/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\es\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/es/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\es\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/es/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\fr\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/fr/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\fr\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/fr/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\fr\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/fr/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\it\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/it/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\it\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/it/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\it\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/it/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ja\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ja/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ja\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ja/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ja\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ja/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ko\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ko/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ko\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ko/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ko\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ko/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ru\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ru/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ru\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ru/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\ru\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/ru/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\WorkflowTemplate\EmptyWorkflow.xaml.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/WorkflowTemplate/EmptyWorkflow.xaml.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\WorkflowTemplate\SchemaCountryConcentration.xaml.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/WorkflowTemplate/SchemaCountryConcentration.xaml.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\WorkflowTemplate\SchemaCurrencyConcentration.xaml.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/WorkflowTemplate/SchemaCurrencyConcentration.xaml.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\WorkflowTemplate\SchemaIssuerConcentration.xaml.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/WorkflowTemplate/SchemaIssuerConcentration.xaml.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hans\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hans/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hans\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hans/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hans\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hans/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hant\Microsoft.Data.Edm.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hant/Microsoft.Data.Edm.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hant\Microsoft.Data.OData.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hant/Microsoft.Data.OData.resources.dll.deploy" />
   <File Path="MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\zh-Hant\System.Spatial.resources.dll.deploy" Url="Application Files/PATOneRule_Builder_1_0_0_271/zh-Hant/System.Spatial.resources.dll.deploy" />
   <File Path="MyClickonce\PATOneRule_Builder.application" Url="PATOneRule_Builder.application" />
  </Module>
</Elements>

I think that the error is in the first line:
 <Module Name="MyClickonce" Path="MyClickonce20110815152200">

Because when i delete attribute path i can do the deployment. Do Anyone know what can be the reason?
ERROR when deploy:
 Error  68  Error occurred in deployment step 'Activate Features': Failed to instantiate file "Application Files/PATOneRule_Builder_1_0_0_271/AvalonDock.dll.deploy" from module "MyClickonce": Source path "Features\MyClickonceDeployment_Feature1\MyClickonce20110815152200\MyClickonce\Application Files\PATOneRule_Builder_1_0_0_271\AvalonDock.dll.deploy" not found.
    0   0   MyClickonceDeployment

PD: If I deploy the solution without path attribute, when I try to open the clickonce application i get the following error message:
ERROR DETAILS
Following errors were detected during this operation.
* [3/18/2013 12:53:10 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
    - Downloading http://ofe-11/Application Files/PATOneRule_Builder_1_0_0_271/Application Files/PATOneRule_Builder_1_0_0_271/PATOneRule_Builder.exe.manifest did not succeed.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
        at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
        at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
        at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
        at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
        at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath)
        at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
        at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
        at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
        at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
    --- Inner Exception ---
    System.Net.WebException
    - The remote server returned an error: (404) Not Found.
    - Source: System
    - Stack trace:
        at System.Net.HttpWebRequest.GetResponse()
        at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.


text:
Q: Text on horizontal table line in html How can I get below effect?

|--- Hello World ---|
|My data            |
|-------------------|

I cannot do it in html.
For example I have code:

Nabywca:

Test test

And I want text "Nabywca:" set like this image:

It couldn't be in JS, because I want get It into iText HTML parser to generate PDF from HTML.

A: Try this:

            Hello World

            My data

fiddle: http://jsfiddle.net/4aZHX/1/
** UPDATE **
Based upon your comment, what you are looking for is a Fieldset, not a table.  Try:
<fieldset>
  <legend>
     Nabywca
  </legend>
  My Data
</fieldset>

New fiddle: http://jsfiddle.net/4aZHX/2/


text:
Q: How to bypass the Walmart.com.mx block using Selenium Webdriver in C# I'm trying to scrape at walmart.com.mx but after the first test it starts to block access and I get a kind of captcha.
I already tried adding proxy and it happens the same.
Could you help me?
    string PROXY = "94.23.1.178:3128";
    //string PROXY = "169.55.89.6:8123";

    public void inicializarChrome()
    {
        var driverService = ChromeDriverService.CreateDefaultService();
        options.AddExcludedArgument("--enable-automation");
        options.AddArgument("--incognito");
        options.AddArgument("--disable-blink-features=AutomationControlled");
        //options.AddArguments($"--proxy-server={PROXY}");
        options.AddArgument("--start-maximized");
        driverService.HideCommandPromptWindow = true;
        driver = new ChromeDriver(driverService, options);
        try { driver.Manage().Window.Maximize(); } catch { }
        //driver.Navigate().GoToUrl(dictionaryIni["Juguetes"]);
        driver.Navigate().GoToUrl(dictionaryIni["Juguetes"]);

        //driver.Quit();

    }

I leave you my code


text:
Q: How to use trained tensorflow model in flutter? I have trained a tensorflow model to predict the next word for an input text. I saved it as an .h5 file.
I can use that model in another python code to predict word as follows:
import numpy as np
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from keras.models import load_model

model = load_model('model.h5')
model.compile(
    loss = "categorical_crossentropy",
    optimizer = "adam",
    metrics = ["accuracy"]
)

data = open("dataset.txt").read()
corpus = data.lower().split("\n")
tokenizer = Tokenizer()
tokenizer.fit_on_texts(corpus)

seed_text = input()

sequence_text = tokenizer.texts_to_sequences([seed_text])[0]
padded_sequence = np.array(pad_sequences([sequence_text], maxlen = 11 -1))
predicted = np.argmax(model.predict(padded_sequence))

Is there a way through which I can directly use that model inside
flutter, where I can take input from TextField() and by pressing the
button, display the predicted word??

A: Steps

*

*Convert the Model into a .tflite model.

# https://www.tensorflow.org/lite/convert/#convert_a_savedmodel_recommended_

import tensorflow as tf

# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) # path to the SavedModel directory
tflite_model = converter.convert()

# Save the model.
with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

*Add the tflite Model to the App directory. I usually add the model in a assets/ directory.

android/
assets/
    model.tflite
ios/
lib/

*Add tflite as a dependency to pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  tflite: ^1.0.5
  .
  .

*Run Inference in your dart script. For example, the following code snippet is an example script on how to run Inference on an Image where labels.txt is a text file containing the classes:

import 'package:tflite/tflite.dart';
.
.
.

class _MyAppState extends State<MyApp> {
  . . .
  @override
  void initState() {
    super.initState();
    _loading = true;

    loadModel().then((value) {
      setState(() {
        _loading = false;
      });
    });
  }

  classifyImage(File image) async {
    var output = await Tflite.runModelOnImage(
      path: image.path,
      numResults: 2,
      threshold: 0.5,
      imageMean: 127.5,
      imageStd: 127.5,
    );
    setState(() {
      _loading = false;
      _outputs = output;
    });
  }

  loadModel() async {
    await Tflite.loadModel(
      model: "assets/model_unquant.tflite",
      labels: "assets/labels.txt",
    );
  }
  @override
  void dispose() {
    Tflite.close();
    super.dispose();
  }
 . . .
}

SideNote
The tflite plugin doesn't support Text Classification AFAIK, if you want to specifically do Text Classification I'd recommend using the tflite_flutter plugin. Below is the link for a article using the plugin for Text Classification.
Text Classification using TensorFlow Lite Plugin for Flutter

A: You cannot use a .h5 file directly in Flutter.
You will need to either convert it into a .tflite file and use that or create a REST API.
Converting it to a .tflite file is the easiest.
You can check the following article for more details:
https://medium.com/analytics-vidhya/run-cnn-model-in-flutter-10c944cadcba
If you want to create a REST API, checkout this article:
https://medium.com/analytics-vidhya/deploy-ml-models-using-flask-as-rest-api-and-access-via-flutter-app-7ce63d5c1f3b


text:
Q: Constructing a sequence with the following property Let $\beta_m\searrow 0$ be strictly decreasing, but with the rate and gaps arbitrary. Now I want to construct a sequence $\eta_m$ which also strictly decreases to $0$, with the following properties:

*

*$\beta_m=O(\eta_m)$.

*$m\eta_m\leq (m+1)\eta_{m+1}$, for all $m\ge 1$.

*$\eta_m-\eta_{m+1}\geq \eta_{m+1}-\eta_{m+2}$, for all $m\geq 1$.

This seems rather technical, but let me include an example here: the sequence $2^{-m}$ satisfies 3 but not 2; the sequence $1/m$ satisfies both 2 and 3.
What I tried is the following:
Let $\eta_1=\beta_1$, $\eta_2=\max\{\beta_2,\eta_1/2\}$ so that $2\eta_2\geq 1\eta_1$ and $\eta_2\geq \beta_2$. For $m\geq 3$, we define
    \begin{equation*}
\eta_m=\max\left\{\beta_m,\frac{m-1}m \eta_{m-1},2\eta_{m-1}-\eta_{m-2}\right\}.
\end{equation*}
Then 1,2,3 and that $\eta_m$ is strictly decreasing are easy to verify, but I cannot show that $\eta_m\to 0$. Is there another way of doing so? Or it is impossible for some ill-defined sequence $\beta_m$?


text:
Q: Bootstrap popover takes two clicks to open the popover I have multiple popovers that I have on Table view .After 2 clicks only it open.
$(document).on('click','.reason_pop',function(e){
        var id = $(this).attr('data-val');

        setTimeout(function(){
          $('#reason_'+id).focus();
        },300);

        $("#reason_popover_"+id).popover({
            content: '

×

<input type="text" value="Answer" class="pop input_field" data-attr="'+id+'"  name="reason" id="reason_'+id+'" required>Reason *

',
            html: true
        });

 });

A: Try using popover('toggle') and sanitize: false

$(document).on('click', '.reason_pop', function(e) {
  var id = $(this).attr('data-val');

  $("#reason_popover_" + id).popover({
    content: '

×

<input type="text" value="Answer" class="pop input_field" data-attr="' + id + '"  name="reason" id="reason_' + id + '" required>Reason *

',
    html: true,
    sanitize: false
  }).popover('toggle')

});
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

popover

<button class="reason_pop" data-val="1">pop</button>


text:
Q: How to find direct parent with specific text using jquery? I have requirement where I wanted to find the amount fields like $412,341.40 from document.
I tried $("div:contains($)").css("background-color","yellow") but it returning parent div's also, and i just wanted color the child ones.
for e.g see the below image, the above jquery coloring both div's parent and child.
How can i color child div only? I am trying find all div's which contains string like $123,55.60.
Any help is greatly appreciated.

A: This will give your the direct parent.
$('div>:contains("$")').last().css("background-color","yellow")

JSFIDDLE DEMO
EDIT: The above will work great for only one occurrence of $. For multiple occurrences of text, use below code. This makes use .each() and looks for a closing </div> tag each time.
var divs = $('div>:contains("$")');
divs.each(function() {
    var htmlinner = $(this).html();
    if(htmlinner.indexOf('</div>') == -1) {
        $(this).css("background-color", "yellow");
    }
});

JSFIDDLE DEMO[2] for multiple occurrences

A: use:
$("div:contains('$')").find('div').css("background-color","yellow")


text:
Q: What are the basic questions to ask a person who wants his Medium sized website done? I wanted to know the basic question that a person needs to ask if someone wants his web app done??
It can be UI,platform,crux of the applications and many other things...Please post what one needs to know before starting to work on a app.

A: There are also process questions that may be worth asking intially.
What kind of progress reports would he want to see as you work along on this project?  This leads into the whole communication component that is big, IMO.
Would he like to see prototypes and offer feedback at various stages of development in an Agile fashion or is it just a big black box that you deliver when it is done?
Legal requirements, including does the application have a "Terms of Service" or "End-User License Agreement?" as well as what license is this supposed to be built using?  Does he want everything built off an open source stack or is it a "just along as it works" scenario?
Scale would also be something as in what are we calling "medium" in terms of its production environment? A medium size webfarm from Amazon, Microsoft or Google would probably contain thousands of machines given the company's size while others may view having more than a handful to be medium sized.
Last but not least, nail down the requirements.  This falls into the legal requirements in a sense as you build it for $x and he wants an application that does a,b, and c.

A: Some of these are similar to Mr. Brendel, but hopefully I added value. In no particular order:

*

*Why are you building this application? (Describe what the "happy endpoint" for this web application looks like.)

*Are we carving new processes/modules/functions, or simply automating existing processes/modules/functions? (The latter is easier than the former.)

*What are the processes/modules/functions in scope for this application? Who defines them?

*What is the overall business model of the client? Where are the touchpoints between the application and that model? How much is being affected?

*What value is being delivered? How will it be measured? (Closely related to the first question...)

*Who's going to use the web application? (The web app needs to be designed with the end-users in mind.)

*Who are the "stakeholders"? (IOW, who's going to benefit or lose directly from the project? Of course, it won't, but what if the dealine must slip? Who's the person(s) that this will reflect on?)

*What's your budget, if any?

*What's the dealine/go-live drop-dead date, if any?

*Do you have any rules/process for interacting with external/internal developers? (Ex: reporting needs, coding standards, etc...)

*Is it technically integrated with anything else or stand-alone?

*Is it visually integrated with anything else or stand-alone? What characteristics/attributes/attitude should the site convey to users?

*Is it replacing anything? If so, what and why?

*What "server stack" will it be deployed on? What technologies must be used, if any?

*What are the "hard metrics" that must met, if any? (Ex: Must be able to field 1000 requests/min.)

*What are the project's security needs?

*Who will test/validate the prototype? What are their needs/expectations for performing testing/validation?

*Who will maintain the web application? What are their needs/expectations for performing maintenance?

*Who will maintain any static content? What are their needs/expectations for performing maintenance?

*Who will train users? What are their needs/expectations for performing training?

Now, be careful. First, interview stakeholders both individually and in groups. Interview multiple times, if possible, because your first interview will possibly precipitate ideas that you'd pick up in a second interview.
It's best not to mash all of this in one interview with all stakeholders and end-users in the room at once. Divide it into two parts, at least: the "current and future business" part, and the "exact solution" part? Don't mix conversations about the business-side of the problem with the other conversation you should have on pet features, functionality, content, search engine optimization, etc. The latter will tend to obscure the former, but the former is where a good developer can really catalyze a business.
Hope this helps. Requirements gathering is pretty much an art, not a science...

A: Ask them to provide you some links to sites which have similar functionality or layouts. This will really speed up communications (especially the creative process) and set expectations on both ends.
This is the easiest way to establish a starting set of requirements.

A: What is your budget? Make sure everyone's expectations are realistic. High quality work requires higher prices. If they aren't willing to accept that, walk away. I'm assuming your work will meet high standards. This is still an important question even if your work is sub par, but walking away is less of an option.
What is your time frame for completion? In other words, do he expect you to write Facebook for his company in a week? If so, walk away. The difference between this question and the previous question is that you should walk away regardless of the quality of your work. Unreasonable time frames always end badly. Always.
What is the purpose of the website you are asking me to build? This is, surprisingly enough, often overlooked. Small to medium size businesses often take the approach of 1) make website, 2) ????, 3) profit! Make sure they have a plan to integrate the website into their business. A static, stale website full of useless information is almost worse than no website at all.
How technical are your users? This has wide ranging implications. For example, less technical users will cause a higher IE6 market share, so you'll have to design accordingly. Older users may require larger font sizes. The list goes on. Knowing your users is very, very important. For example, Stack Overflow uses "markdown" syntax because its users are technical and can grok it.
Will your site need internationalization? This depends entirely on the company, but in markets where there are large numbers of <insert non-English language> speakers, internationalization can be key to driving business to the site.
Are you willing to rely on my expertise? This is important, because more often than not, business owners think <blink> is just uber cool. Make sure you are in the driver's seat. Listen to their suggestions and accommodate them, but only where it makes sense. Don't compromise your design sense for their benefit, because this site will be in your portfolio and will therefore reflect on you.
Do you have any existing infrastructure I need to know about? This doesn't apply in all cases, but knowing ahead of time that you need to integrate their web application with an Active Directory environment can make a big difference in the technology you choose.
Learn their product inside and out. Not a question, but excellent advice. This will increase the quality of the overall product you are delivering (the website).
Do you have a color scheme in mind? Many times the company will have a color scheme incorporated into their logo, but if not, it would be nice to ask them if they have anything in mind. If it's not too outrageous (e.g., vomit green clashing with bright orange), try to use it as a starting point.

In response to the comments: The UI is really your dominion. Aside from basic things like color scheme preferences, you're the expert. Remember, the business owner is not a web designer and probably won't be able to tell you "I want the login form here and the date/time picker here".
The best approach is to work through some common use cases for the website. This, of course, relies on the business owner knowing what his customers will want to accomplish while using his website. This will determine both the UI flow and the core functionality of the website. Everything flows from use cases. They can be tedious to investigate and document, but the work is well worth it.
The UI and core functionality are unique to every website, so addressing them in the general case is difficult. Working through use cases is common practice in projects of all sizes and of all types, and it's a skill you will need moving forward. Sorry to give you such general advice, but it's really the soundest advice I can think of. Good luck!


text:
Q: Inserting current Database date time via Entity framework We want to put the current datetime into a database column.
We have a web farm where the time on the web servers can vary, we therefore need to use the datetime on the database server.
We have a database with a Not Null datetime column. This column has a default datetime of current time.
This works fine when we insert data using a SQL statement that does not include the datetime column.
From Entity Framework:

*

*If we define the datetime as not null, the datetime is set to low date, and low date is inserted into the database.

*If we define the datetime as null, we get an exception on the insert that the value cannot be null.

We could fix this using a database trigger that changed the datetime to current datetime if the insert value is low date.
Does anyone have a better solution?

A: As the column has a default value set by the database you can simply mark the datetime column as computed:
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
property DateTime Date { get; set; }

or in fluent mapping
this.Property(t => t.Date)
    .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);

in a EntityTypeConfiguration class, or
modelBuilder.Entity<MyClass>().Property(t => t.Date)
    .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);

in an OnModelCreating override.
This will cause EntityFramework to read the value of the column at each read, insert or update of a record, but it will never set it.

A: One way is to use UTC dateTime so in C# you can use
DateTime.UtcNow

You could also set
DateTime dateTime = new DateTime();
dateTime = SqlDateTime.MinValue.Value;

You can even create extension method :
public static class DateExtension
    {
        public static DateTime SqlValidDateTime(this DateTime d)
        {
            return SqlDateTime.MinValue.Value;
        }
    }

Also for:

If we define the datetime as null, we get an exception on the insert
  that the value cannot be null.

You should pass instead of null ->
DbNull.Value

and then insert should pass.


text:
Q: How can I use Drush 9 (instead of Drush 10) in my Drupal 8 DDEV-Local project? Using ddev I created a webserver locally and I have a Drupal 8 project with drush 10, but I need drush 9.
How can I change the version of drush in the project?
Thanks so much

A: As @leymannx says in the comments, this isn't really a ddev question, it's a composer question, but it's easy.
ddev composer require "drush/drush:^9" will get the most recent Drush 9 version.
But I should mention that it's unlikely that you actually need Drush 9, Drush 10 is what most people are using with Drupal 8 and 9.


text:
Q: What is the theoretical memory limit for 32-bits apps running through WoW64? Windows 32 bits can address a maximum of 3 GB of RAM, no matter how much more there is installed in the machine. So, even though 32-bits applications could theoretically address as much as 4 GB of memory, they're capped to 3 GB by the OS (and even then, there are certain memory pages that are reserved, and other programs run at the same moment, so this maximum can probably never be reached).
However, when running the 64 bits version of Windows, the OS cap is blown away. Does that mean 32-bits applications running through WoW64 can now theoretically access their whole 4 GB address space?

A: To be more precise, Win32 can address up to 64GB in total.
However, programs are limited to 2GB by default (other 2GB is reserved for the system), or 3GB (with 1GB reserved for the system) which is a special case which need to be enabled by OS configuration and supported by program (specific compilation).
But YES, such large address aware programs have access not just to 3, but to the whole 4GB space in WOW64.

A: I think people are mentioning misleading things here, so I thought I'd clear it up:
32-bit mode (whether on a 32-bit OS or on WOW64) can only address up to 4 GiB of memory. In Windows, the maximum is either 2 GiB or 3 GiB for user-mode data.
Memory addressing and physical memory are separate topics, though.
This doesn't mean they can't store more information in RAM. Because of virtual memory, the can only address using 32 bits, but they can map and unmap different views of physical memory using AWE, allowing them to use more physical memory than virtual memory. That's unrelated to the addressing issue, though -- there's still only 4 GiB of virtual addressing at any one time, and the program can only use more physical memory if it's specifically written to do that (which most programs aren't).
As for PAE, it doesn't affect any individual program -- it's only useful in that it lets multiple programs take up more than 4 GiB of RAM total, although each one is still limited by the 4-GiB barrier.


text:
Q: Highchart fillColor linearGradient in area chart I am trying Highchart area.
and having problem in Filcolor linearGradient.
When - if set yAxis min:0 then its work perfect.
but if set yAxis min in minimum of my data value then its totally displaying One red color not other layer like light red.
This is what i am doing for linerGradient
plotOptions: {
            area: {
                fillColor: {
                    linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
                    stops: [
                        [0, '#ff0000'],
                        [1, '#f4f4f4']
                    ]
                },
                lineWidth: 1,
                marker: {
                    enabled: false
                },
                shadow: false,
                states: {
                    hover: {
                        lineWidth: 1
                    }
                },
                threshold: null
            }
        },

Want but min: minimum value of data like 5898.87
current
Thanks
Javid

A: try this
$(function () {
        $('#container').highcharts({
           chart: {
                zoomType: 'x',
                type:'area',
                plotBackgroundColor: '#fff',
                backgroundColor:'transparent',
            },
            credits: {
                enabled: false
            },
            title: {
                text: 'chartTitle',
                align: 'left',
                margin: 30,
                style:{
                    fontFamily:'VegurRegular',
                    fontSize:'21px'
                }
            },
            subtitle: {
                text:'subTitle',
                align: 'left',
                x: 20,
                style: {
                    color: '#282828',
                    fontFamily:'VegurRegular'
                }
            },
            xAxis: {
                title: {
                    text: ''
                },
                type: 'datetime',
                labels : {
                    formatter: function() {
                        var myDate = new Date(this.value);
                        var newDateMs = Date.UTC(myDate.getUTCFullYear(),myDate.getUTCMonth()-1,myDate.getUTCDate());
                        return Highcharts.dateFormat('%b %e %y',newDateMs);
                    },
                    style:{
                        fontFamily:'VegurRegular'
                    }
                 }
            },
            yAxis: {
                opposite:true,
                title: {
                    text: ''
                },
                tickInterval: 200,
                min: 0,
                minRange: 0.1,
                labels: {
                    formatter: function() {
                        return [this.value];
                    },
                    style:{
                        fontFamily:'VegurRegular'
                    }

                },
            },
            tooltip: {
                shared: true,
                formatter: function() {
                    var xDate = new Date(this.x);

                    var day = daysArray[ xDate.getDay() ];
                    var month = monthsArray [ xDate.getMonth() ];
                    var date = xDate.getDate();
                    var year = xDate.getFullYear();

                    return day+', '+month+' '+date+', '+year+'
' + ''+ this.series.name +': '+ $.number(this.y,2) +''+ispersign+'';
                 },
            },
            legend: {
                enabled: false
            },
            plotOptions: {
                area: {
                    fillColor: {
                        linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1},
                        stops: [
                            [0, '#ff0000'],
                            [1, '#f4f4f4']
                        ]
                    },
                    lineWidth: 1,
                    marker: {
                        enabled: false
                    },
                    shadow: false,
                    states: {
                        hover: {
                            lineWidth: 1
                        }
                    },
                    threshold: null
                }
            },
            series: [{
                type: 'area',
                name: 'USD to EUR',
                data:  [[1420070400000, 6656.37], [1420156800000, 6742.1], [1420243200000, 6716.63], [1420329600000, 6679.37], [1420416000000, 6742.84], [1420675200000, 6672.15], [1420761600000, 6529.47], [1420848000000, 6500.04], [1420934400000, 6461.7], [1421020800000, 6300.63], [1421280000000, 6182.72], [1421366400000, 6331.83], [1421452800000, 6336.48], [1421539200000, 6466], [1421625600000, 6545.27], [1421884800000, 6576.74], [1421971200000, 6598.18], [1422057600000, 6609.93], [1422489600000, 6633.51], [1422576000000, 6547], [1422662400000, 6566.09], [1422835200000, 6547.8], [1423094400000, 6417.16], [1423180800000, 6366.51], [1423267200000, 6419.83], [1423353600000, 6569.96], [1423440000000, 6501.14], [1423699200000, 6501.42], [1423785600000, 6542.2], [1423872000000, 6388.46], [1423958400000, 6498.78], [1424044800000, 6550.27], [1424304000000, 6585.53], [1424390400000, 6620.1], [1424476800000, 6728.04], [1424563200000, 6798.33], [1424649600000, 6832.83], [1424908800000, 6852.4], [1424995200000, 6811.61], [1425081600000, 6825.94], [1425168000000, 6810.6], [1425254400000, 6749.4], [1425254400000, 6782.55], [1425340800000, 6871.8], [1425427200000, 6860.02], [1425513600000, 6865.93], [1425600000000, 6853.44], [1425859200000, 6837.15], [1425945600000, 6829.12], [1426032000000, 6818.17], [1426118400000, 6828.11], [1426204800000, 6873.52], [1426464000000, 6857.05], [1426550400000, 6898.13], [1426636800000, 6898.08], [1426723200000, 6888.9], [1426809600000, 6915.2], [1427068800000, 6912.16], [1427155200000, 6949.63], [1427241600000, 6935.38], [1427328000000, 6949.73], [1427414400000, 6946.66], [1427932800000, 6940.64], [1428019200000, 6889.13], [1428105600000, 6919.24], [1428192000000, 6961.14], [1428278400000, 6911.8], [1428537600000, 6876.47], [1428624000000, 6702.84], [1428710400000, 6721.51], [1428796800000, 6761.07], [1428883200000, 6740.58], [1429142400000, 6804.08], [1429228800000, 6837.61], [1429315200000, 6945.2], [1429401600000, 6962.32], [1429488000000, 7022.51], [1429747200000, 7037.67], [1429833600000, 7019.68], [1429920000000, 6990.97], [1430006400000, 6895.33], [1430092800000, 6855.02], [1430352000000, 6891.43], [1430438400000, 6773.04], [1430438400000, 6809.5], [1430524800000, 6833.46], [1430956800000, 6961.77], [1431043200000, 6937.41], [1431129600000, 7015.36], [1431216000000, 7089.77], [1431475200000, 7064.3], [1431561600000, 7075.26], [1431648000000, 7096.78], [1431734400000, 7060.45], [1431820800000, 6994.63], [1432080000000, 7052.13], [1432166400000, 7062.93], [1432252800000, 7028.24], [1432339200000, 7053.67], [1432425600000, 7070.7], [1432684800000, 7103.98], [1432771200000, 7030.53], [1432857600000, 6946.28], [1432944000000, 6960.63], [1433116800000, 6985.95], [1433462400000, 6927.58], [1433548800000, 6933.74], [1433635200000, 6886.95], [1433721600000, 7046.82], [1433980800000, 7029.85], [1434067200000, 6933.8], [1434153600000, 6949.63], [1434240000000, 6973.04], [1434326400000, 6960.49], [1434585600000, 6968.87], [1434672000000, 6995.1], [1434758400000, 7007.26], [1434844800000, 7013.47], [1434931200000, 7031.72], [1435276800000, 6948.99], [1435363200000, 7033.33], [1435449600000, 7040.92], [1435536000000, 6984.43], [1435708800000, 6953.58], [1435795200000, 6928.27], [1435881600000, 6950.46], [1435968000000, 6859.24], [1436054400000, 6804.6], [1436313600000, 6790.04], [1436400000000, 6753.8], [1436486400000, 6830.27], [1436572800000, 6846.74], [1436659200000, 6784.92], [1436918400000, 6710.52], [1437004800000, 6710.1], [1437091200000, 6680.55], [1437177600000, 6707.88], [1437264000000, 6710.45], [1437523200000, 6825.67], [1437609600000, 6834.87], [1437696000000, 6844.8], [1437782400000, 6807.82], [1437868800000, 6753.7], [1438128000000, 6620.48], [1438214400000, 6520.98], [1438387200000, 6608.59], [1438473600000, 6630.47], [1438560000000, 6585.78], [1438819200000, 6535.68], [1438905600000, 6432.21], [1438992000000, 6490.7], [1439078400000, 6581.63], [1439164800000, 6673.38], [1439424000000, 6737.95], [1439510400000, 6753.75], [1439596800000, 6753.75], [1439683200000, 6796.45], [1439769600000, 6775.08], [1440028800000, 6788.69], [1440115200000, 6769.07], [1440201600000, 6667.34], [1440288000000, 6655.01], [1440374400000, 6579.81], [1440633600000, 6505.13], [1440720000000, 6555.28], [1440806400000, 6631], [1440892800000, 6668.87], [1440979200000, 6696.28], [1441238400000, 6688.62], [1441324800000, 6686.57], [1441411200000, 6752.41], [1441497600000, 6747.09], [1441584000000, 6718.49], [1441843200000, 6736.22], [1441929600000, 6664.54], [1442016000000, 6571.19], [1442102400000, 6568.33], [1442188800000, 6550.74], [1442448000000, 6550.3], [1442534400000, 6526.29], [1442620800000, 6403.45], [1442707200000, 6367.89], [1442793600000, 6187.65], [1443052800000, 5898.87], [1443139200000, 6081.34], [1443225600000, 5979.2], [1443312000000, 6192.03], [1443398400000, 6247.94], [1443657600000, 6058.54], [1443744000000, 6083.31], [1443830400000, 6194.1], [1443916800000, 6042.92], [1444176000000, 6074.52], [1444262400000, 6146.1], [1444348800000, 6229.01], [1444435200000, 6155.81], [1444521600000, 6117.76], [1444780800000, 6084.59], [1444867200000, 6137.6], [1444953600000, 6229.21], [1445040000000, 6186.99], [1445126400000, 6104.11], [1445385600000, 6108.71], [1445472000000, 5935.84], [1445558400000, 6032.24], [1445644800000, 5961.49], [1445731200000, 6109.01], [1445990400000, 5958.86], [1446076800000, 5909.24], [1446163200000, 6061.61], [1446336000000, 6072.47], [1446422400000, 6129.98], [1446681600000, 6298.92], [1446768000000, 6326.16], [1446854400000, 6336.35], [1446940800000, 6374.82], [1447027200000, 6416.16], [1447286400000, 6371.18], [1447372800000, 6342.28], [1447459200000, 6269.61], [1447545600000, 6338.67], [1447632000000, 6378.04], [1447891200000, 6352.33], [1447977600000, 6345.13], [1448064000000, 6348.42], [1448150400000, 6376.28], [1448928000000, 0]]
            }]
        });
    });


text:
Q: PHP 7 - ReflectionParameter::getType() and gettype() not returning the same for certain types I have a series of classes for a restful web service which should run some business logic by accepting a method taken from the URI and a JSON from input, in this form:
URI: https://my-ws.local/person/dosomething

Payload:

    {
        "name": "John Doe",
        "age": 30,
        "customer": true,
        "interests": ["movies", "rumba", "soccer"]
    }

Before running into any business logic I want to do some method availability and parameters checking so I can quickly return a 400ish error if any inconsistence was found at this stage.
As I might end up with so many classes and methods, I thought it would be a nice idea to abstract this in sort of an entry point method -let's call it run()- which will then validate and call the proper business logic methods.
run() would use the reflection class in order to take the functions' signature as a parameter count and type validation rule and then make the proper call if everything was ok.
For simplicity, let's bundle all this together in a single mockup class like the following:
class Person
{
 public function run(string $method, string $args){

  // Load json into an array.
  $arrArgs = json_decode($args, true);

  // Initialize a valid arguments array.
  $validArgs = array();

  // Check if method parameters are fulfilled.
  $reflector = new ReflectionClass($this);
  foreach ($reflector->getMethod($method)->getParameters() as $param){

   // Parameter missing, cannot continue
   if(!array_key_exists($param->name, $arrArgs))
   {
    die("400 Bad Request, parameters missing!");
   }

   // Check if parameter is the correct type.
   if($param->getType() <> gettype($arrArgs[$param->name])){
    die("400 Bad Request, type mismatch!");
   }

    // Parameter OK, add it to the valid arguments array.
    $validArgs[$param->name] = $arrArgs[$param->name];

  }
  // Checks passed, call the method.
  call_user_func_array(array($this, $method), $validArgs);
 }

 private function doSomething(string $name, int $age, bool $customer, array $interests)
 {
  echo 'Hi, ' . $name . '. You are ' . $age . ' years old, you are ' . ($customer ? "" : "not ") . 'a customer and your interests include ' . implode(", ", $interests) .'!';
 }
}

So roughly, the call would then be sort of:
$myPerson = new Person();

$json = '
    {
        "name": "John Doe",
        "age": 30,
        "customer": true,
        "interests": ["movies", "rumba", "soccer"]
    }
';

$myPerson->run('doSomething', $json);

Well, I got this working with strings and arrays, but it looks like ReflectionParameter::getType() and gettype() are not returning the same results for a given type, as I'm getting, respectively:
string - string // OK
int - integer // Type mismatch
bool - boolean // Type mismatch
array - array // OK

I didn't even test it with the remaining types.
¿Is there a better way to do this?
Thanks!


text:
Q: NSURLRequest HTTPS problems - iphone I am creating an NSURLMutableRequest and setting HTTP methods and content-types and such. All was working fine until my last compile. I now get this in the Console, but the app doesn't crash:
CODE:
Internal error.
Exception from other package:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found

and then the program continues. Code can be posted if you need it. The URL I am contacting is:
https://apps.quickbooks.com/j/AppGateway
This is VERISIGN not some Joe Blow make-your-own SSL cert.
Thanks guys!

A: Should have researched. QBOE XML processor is down.


text:
Q: BigQuery : how to make a MERGE operation fail on some conditions? I want to update a target table (target) according to rows in a source table (source). For that, I use the MERGE statement. However, I would like the whole MERGE operation fails on some conditions, but cannot figure how to do.
Example
The target table contains :
id
==
1
2

The source table contains :
id | operation
==============
3  | ADD
4  | DELETE

Expected target table after MERGE (I don't want any update here because 4 corresponds to DELETE operation, and since there is no 4 line in target table, this is considered as an error and MERGE should fail atomically) :
id
==
1
2

As of now, I use the following request :
MERGE `target` target
USING `source` source
ON target.id = source.id
WHEN not matched AND source.operation = "ADD" THEN
  INSERT (id)
  VALUES (source.id)

But obviously, I got :
id
==
1
2
3

Is it possible to add in my query a clause like :
WHEN not matched AND source.operation = "DELETE" THEN ERROR("...")

This does not work (ERROR is unexpected) :

Syntax error: Expected keyword DELETE or keyword INSERT or keyword UPDATE but got identifier "ERROR"

If this is not possible with MERGE query, is there a way to rewrite it to a similar query to update atomically my target table as I expect?

A: You could generate an error yourself.  Something like:
WHEN not matched AND source.operation = 'DELETE' THEN
    INSERT (id)
       VALUES ( CAST(source.operation as int64) )

I haven't intentionally tried to generate errors in BigQuery, but I don't think there is a function that automatically does so.
As proposed by @norbjd:
WHEN not matched AND source.operation = 'DELETE' THEN
    INSERT (id)
       VALUES ( ERROR('ERROR:  DELETE operation encountered') )


text:
Q: Continuity in argument of minimization Let
$$g(c) = \min_{Ax=c} f(x),$$
where $x$, $c$ are vector-valued, $A$ is a matrix and $f$ is a smooth convex function. Under what conditions can we say $g(c)$ is continuous in $c$?

A: If $A$ is a bijection, then this is trivial, because you only changed coordinates with an affine transformation.
Otherwise, the map $Ax=c$ defines a continuous sequence of "slices" (a linear foliation of space) parameterized by $c$: $X=\{x,Ax=c\}$ is the preimage of $A$ (returns a vector subspace of the dimensionality of the kernel of $A$, with the requirement that $c$ is in the image of $A$, which restricts the domain of $g(c)$).
If $c$ is a scalar ($A$ is of rank $1$, $X$ is a hyperplane of dimension $n-1$), you proceed as such:
When the path of the minimum $\vec{x}(c)$ (where $g(c)=f(\vec{x}(c))$) itself is continuous, there is no problem, because the value of a continuous function on a continuous subdomain is also continuous.
Another possibility would be that two local minima exchange in which is the global minimum. In this case, consider two "trajectories" of local minima:
$$g(c)=\min(f(\vec{x}_1(c)),f(\vec{x}_2(c)))$$
Because on both trajectories, the function is continuous, and they interchange, they must have an intersection (there is $c$ where the values are equal). So, $g(c)$ is also continuous in this case.
Moreover, this cannot happen if $f$ is convex: on a hyperplane $X$, which slices the entire space, $f$ is also convex. Therefore, it can only have one extremum, and there is always only one trajectory $\vec{x}(c)$ which is both local and global minimum for a given $c$. Moreover, convexity ensures that the function is bounded from below, so the minimum always exists.
In conclusion, $g(c)$ is continuous if $c$ is a scalar and f is a smooth convex function.
For ranks $r>1$, continuity can be checked line-wise: for every subdomain $\vec{c}=\vec{c}_0+\vec{s}t$ for $t\in \mathbb{R}$, $g(\vec{c}_0+\vec{s}t)$ is continuous for the reasons above. Therefore, it is continuous as a whole (if no "cut" has a jump, the entire thing has no jumps).


text:
Q: String.format does not deliver the correct format for sizes larger than one hour I would like to convert 3600000 milliseconds to the 01:00:00 format (means 01 hours: 00 minutes: 00 seconds). Unfortunately it gives me 2: 120: 00. At 60,000 milliseconds, he gives me 00:10:00, which is the correct result. Until 00:59:00 he outputs the numbers formatted, but everything larger than an hour no longer outputs it in the correct format
public static String formattedTime(long time) {
    int hours = (int) (time / 1000) / 60 / 60;
    int minutes = (int) (time / 1000) / 60;
    int seconds = (int) (time / 1000) % 60;
    return String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, minutes, seconds);

}

A: Do it as follows:
import java.util.Locale;

public class Main {
    public static void main(String[] args) {
        // Tests
        System.out.println(formattedTime(3600000));
        System.out.println(formattedTime(4580000));
    }

    public static String formattedTime(long time) {
        // Convert time in milliseconds to seconds
        int milliToSec = (int) (time / 1000);

        // Get hours from total seconds
        int hours = milliToSec / 3600;

        // Get minutes from total seconds
        int minutes = (milliToSec / 60) % 60;

        // Get remaining seconds from total seconds
        int seconds = milliToSec % 60;

        // Return formatted string
        return String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, minutes, seconds);
    }
}

Output:
01:00:00
01:16:20


text:
Q: Compare two files by first column. Keep rows if matching Hi,
I have two csv files:
File1 (appx 18800 rows):
            p1  p10 p16 p19 p25 p3  p5  p6  p8  p9
    A3      567 0   3   0   18  17  8   4   6   7
    B23     490 7   6   2   23  26  20  14  12  29
    A56     737 1   4   1   6   4   1   4   8   5
    Z56     145 6   4   0   11  17  5   9   22  11
    D89     68  0   0   34  4   0   0   0   0   0
    A12     46  0   0   8   0   0   0   0   0   0
    A15     72  0   0   8   0   1   0   0   0   0
    D4      40  0   0   0   0   1   5   18  0   0
    Z6       7  0   1   0   1   1   10  1   2   0
    X3      49  0   0   125 0   0   0   0   0   0

File2 (appx. 400 rows)
        name    tax price class order

        B23      kat 35    2      1
        Z56      mat 26    3      2
        D4       kat 26    4      1

Now I would like to compare those two files by first column. If the value in the the second file is present in the first file I would like to keep entire matching row. Below an example of an output:
            p1  p10 p16 p19 p25 p3  p5  p6  p8  p9
    B23     490 7   6   2   23  26  20  14  12  29
    Z56     145 6   4   0   11  17  5   9   22  11
    D4      40  0   0   0   0   1   5   18  0   0

Edit:
File1 cat
    "","p1","p10","p16","p19","p25","p3","p5","p6","p8","p9"
"p1_1_length_2509_cov_19.337112",567,0,3,0,18,17,8,4,6,7
"p1_10_length_1072_cov_559.052910",4900,7,6,2,23,26,20,14,12,29
"p1_11_length_1032_cov_5800.211050",73784,1,4,1,6,4,1,4,8,5
"p1_12_length_1022_cov_10156.344134",145873,6,4,0,11,17,5,9,22,11
"p1_13_length_946_cov_7.164835",77,17936,61876,5257,6085,196,8383,24956,4656,14687
"p1_14_length_921_cov_15.662469",68,0,0,34,4,0,0,0,0,0
"p1_16_length_800_cov_7.126300",46,0,0,8,0,0,0,0,0,0
"p1_17_length_758_cov_12.328051",72,0,0,8,0,1,0,0,0,0
"p1_19_length_722_cov_5.621849",40,0,0,0,0,1,5,18,0,0

File2 cat:
name,superkingdom,phylum,class,order,family,genus,species
p10_1003_length_529_cov_12.940299,Viruses,,,,Poxviridae,Alphaentomopoxvirus,Anomala cuprea entomopoxvirus
p10_1021_length_525_cov_6.801508,Viruses,,,Herpesvirales,Alloherpesviridae,Batrachovirus,Ranid herpesvirus 1
p10_1047_length_521_cov_4.852792,Viruses,,,,,,Hudisavirus sp.
p10_1152_length_501_cov_22.430481,Viruses,,,,Mimiviridae,Cafeteriavirus,Cafeteria roenbergensis virus
p10_139_length_1152_cov_892.463415,Viruses,,,,,,Hudisavirus sp.
p10_149_length_1130_cov_7.540379,Viruses,,,Picornavirales,Picornaviridae,Enterovirus,Enterovirus C

A: You want to extract all lines in your first file whose first column correspond to a column in your second file.
Since the first file seems to only contain text in its first column (and the rest is numbers), we could simply use grep for this.
In bash or any other shell that understands process substitutions, this would be a matter of
grep -F -f <( awk -F, 'NR > 1 { print $1 }' <file2 ) file1 >newfile

In other shells you would first write the output of the awk command to a temporary file and then use that with grep -f.
The awk would generate output like
p10_1003_length_529_cov_12.940299
p10_1021_length_525_cov_6.801508
p10_1047_length_521_cov_4.852792
p10_1152_length_501_cov_22.430481
p10_139_length_1152_cov_892.463415
p10_149_length_1130_cov_7.540379

and the grep would use these as fixed string patterns to match against each line in your first file.
You could do it all in awk too, which would include reading in the first column of the second file first, as keys in an associative array, and then testing the first column of the first file against these keys:
awk -F, 'NR==FNR && FNR>1 { keys[sprintf("\"%s\"", $1)] }
         NR!=FNR && FNR>1 && ($1 in keys)' file2 file1

The strange sprintf() is there because the first column in file1 is double quoted. It just adds double quotes to the data read from file2.
The FNR>1 skips the headers of both files while NR==FNR is true if we're reading from file2.

A: This is a job best suited for a programming language rather than a scripting language, because you're not just working with one stream. One basic algorithm would be:

*

*Read first file line by line. Construct a list of all first elements. (Depending on the language you use, a hash or dict might be most efficient.)

*Read the second file line by line. If the first element exists in your list from #1, save it to your output file.


text:
Q: algorithm: find count of numbers within a given range given an unsorted number array where there can be duplicates, pre-process the array so that to find the count of numbers within a given range, the time is O(1).
For example, 7,2,3,2,4,1,4,6. The count of numbers both >= 2 and <= 5 is 5. (2,2,3,4,4).

A: Sort the array. For each element in the sorted array, insert that element into a hash table, with the value of the element as the key, and its position in the array as the associated value. Any values that are skipped, you'll need to insert as well.
To find the number of items in a range, look up the position of the value at each end of the range in the hash table, and subtract the lower from the upper to find the size of the range.

A: This sounds suspiciously like one of those clever interview questions some interviewers like to ask, which is usually associated with hints along the way to see how you think.
Regardless... one possible way of implementing this is to make a list of the counts of numbers equal to or less than the list index.
For example, from your list above, generate the list: 0, 1, 3, 4, 6, 6, 7, 8. Then you can count the numbers between 2 and 5 by subtracting list[1] from list[5].

A: Since we need to access in O(1), the data structure needed would be memory-intensive.
With Hash Table, in worst case access would take O(n)
My Solution:
Build a 2D matrix.
array = {2,3,2,4,1,4,6} Range of numbers = 0 to 6 so n = 7
So we've to create nxn matrix.
array[i][i] represents total count of element = i
so array[4][4] = 2  (since 4 appears 2 times in array)
array[5][5] = 0
array[5][2] = count of numbers both >= 2 and <= 5 = 5
//preprocessing stage 1: Would populate a[i][i] with total count of element = i
a[n][n]={0};
for(i=0;i<=n;i++){
  a[i][i]++;
}

//stage 2
for(i=1;i<=n;i++)
  for(j=0;j<i;j++)
     a[i][j] = a[i-1][j] + a[i][i];
//we are just adding count of element=i to each value in i-1th row and we get ith row.

Now (5,2) would query for a[5][2] and would give answer in O(1)

A: int main()
{
    int arr[8]={7,2,3,2,4,1,4,6};
    int count[9];
    int total=0;

    memset(count,0, sizeof(count));

    for(int i=0;i<8;i++)
        count[arr[i]]++;

    for(int k=0;k<9;k++)
    {
        if(k>=2 && k<=5 && count[k]>0 )
        {
            total= total+count[k] ;
        }
    }

    printf("%d:",total);
    return 0;
}


text:
Q: what does this mean? Type mismatch: cannot convert from List&Serializable> to List" When I delete Object> in the Array.Object>asList(1, 2.89, "three").
  List<Object> objs = Arrays.asList(1, 2.89, "three");

It reminds me

Type mismatch: cannot convert from List object&Comparable&Serializable> to List Object>

public class WildcardCopyTest {
    public static void main(String[] args) {
        List<String> str1 = Arrays.asList("abc", "xyz");
        List<String> str2 = Arrays.asList("11");
        LowerAndUpperBound.copy(str1, str2);

        System.out.println(str1);

        List<Object> objs = Arrays.<Object>asList(1, 2.89, "three");
        List<Integer>  ints = Arrays.asList(100);
        LowerAndUpperBound.copy(objs, ints);

        System.out.println(objs);

        List<Item> items = Arrays.asList(new Item("Java"), new Item("JSPS"));

        List<Book2> books = Arrays.asList(new Book2("J2EE", 100.89));
        LowerAndUpperBound.copy(items, books);

        System.out.println(items);
    }
}

My copy method:
  public static <T> void copy(List<? super T> dest, List<? extends T> src) {
      for (int i = 0; i < src.size(); i++) {
          dest.set(i, src.get(i));
      }


text:
Q: why php-fpm (nginx) takes much RAM memory? My server detail is in screenshot which is best dedicated server from AWS Amazon EC2.

But one thing i notice that php-fpm take memory 10.9 GB which is 70% of total. it shouldn't be take much memory like that. am i doing some thing wrong in nginx.conf file ?
user  nginx;
worker_processes  8;
worker_rlimit_nofile 100000;
pid        /var/run/nginx.pid;

events {
    worker_connections  3000;
    use epoll;
    multi_accept on;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    include /etc/nginx/fastcgi.conf;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    open_file_cache max=20000 inactive=30s;
    open_file_cache_valid 60s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;
    tcp_nodelay on;
    # keepalive_requests 300;
    # reset_timedout_connection on;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  30;
    gzip  on;
    gzip_min_length 256;
    gzip_comp_level 3;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    include /etc/nginx/conf.d/*.conf;

}

A: One way I found to make it a little bit down, Change the value of pm = dynamic to pm=ondemand in the php-fpm config file. For php 7 the path is /etc/php-fpm.d/www.conf. Don't forget to restart php-fpm after change.


text:
Q: gnome password prompt takes ages to appear after screen has been locked Using ubuntu 12.04 with gnome. After the screen has been locked (manually, or after resuming from suspend), it takes more then 60 seconds for the password prompt to appear. This happens with gnome and gnome classic.
It might be related to gnome-screensaver-dialog, at least this is a process running while I can't log in.
I am a bit clueless on how to debug this, as I am not sure how to monitor this. Any solution or debugging tips would be appreciated.
Oddly enough, right now, after reboot, this problem does not arise. I still don't consider it solved, as this problem has been appearing and disappearing. I have been booting befor (number one tipp for strange problems ;)), but that did not solve the problem, so I guess booting is not the answer.
Update: After a new boot, the problem is there again.

A: It sounds like the delay may be caused by sleeping hard disks. When the machine sleeps, your hard drives may be set to turn off after a little while. It takes some time after waking it up for the disks to spin up again.