text:
Q: Switching an infinite sum and finite integral Under what conditions is it true that
\begin{equation}\tag{1}\int_a^b\sum_{n=1}^{\infty}f_n(x) \mathrm{d}x =\sum_{n=1}^{\infty}\int_a^b f_n(x) \mathrm{d}x,
\end{equation}
where $a$ and $b$ are finite and $f_n(x)$ is any function (real or complex)? I know that if $\sum_{n=1}^{\infty}f_n(x)$ is absolutely convergent then (1) is true. But, under what other conditions is (1) true?

A: Well to give you a proper answer, I will start from the trivial case.
You can interchange them if they are both in indefinite forms.
$$\int\sum x\ \Delta x\ \text{d}x = \int \frac{x(x-1)}{2} + c\ \text{d}x$$
$$\sum\int x\ \text{d}x\ \Delta x = \sum \frac{x^2}{2} + c\ \Delta x$$
both equal to $\frac{x^3}{6} - \frac{x^2}{4} + C_1x + C_2$
The reason why this holds true is because their representations in differential operators commute, say
What can one do instead, if we have an infinite series for example? Well the point is to look at this:
$$\int_{\Omega}\sum_{n = 0}^{+\infty} f_n(x)\ \text{d}x = \int_{\Omega} \lim_{k\to+\infty} \sum_{n = 0}^k f_n(x)\ \text{d}x$$
and if you can justify exchanging the integral with this limit, then it shall immediately follow that
$$\lim_{k\to+\infty}\int_{\Omega}  \sum_{n = 0}^k f_n(x)\ \text{d}x = \lim_{k\to+\infty} \sum_{n = 0}^k \int_{\Omega} f_n(x)\ \text{d}x$$
Understanding when a sum can be exchanged with an integral is reducible to understanding when a limit can be exchanged with an integral.
There are a variety of classical results from measure theory that allow you to do just that. The two most widely used are the monotone convergence theorem and the dominated convergence theorem
To say, the monotone convergence theorem tells you that if $0 \leq f_n(x) \leq f_{n+1}(x)$ $\forall n$ and $\forall x$, then you have
$$\lim_{n\to +\infty} \int_{\Omega} f_n(x)\ \text{d}x = \int_{\Omega} \lim_{n\to +\infty} f_n(x)\ \text{d}x
$$
Translating into a sum language, you have that if $f_n(x) \geq 0$ $\forall n$ and $\forall x$:
$$\sum_{n = 0}^{+\infty} \int_{\Omega} f_n(x)\ \text{d}x = \int_{\Omega} \sum_{n = 0}^{+\infty} f_n(x)\ \text{d}x$$
The dominated convergence theorem instead states that if $\lim_{n\to +\infty} f_n(x)$ exists for all $x$ and there exist an integrable function $g(x)$ such that $|f(x)| \leq g(x)$, then
$$\lim_{n\to +\infty} \int_{\Omega} f_n(x)\ \text{d}x =\int_{\Omega} \lim_{n\to +\infty} f_n(x)\ \text{d}x$$
And again, translating this into series it means that if $\sum_{n = 0}^{+\infty} f_n(x)$ exists for all $x$, and there is some integrable function $g(x)$ such that $$\bigg|\sum_{n = 0}^k f_n(x)\bigg| \leq g(x)$$ for every $k$, then
$$\sum_{n = 0}^{+\infty} \int_{\Omega} f_n(x)\ \text{d}x = \int_{\Omega} \sum_{n = 0}^{+\infty} f_n(x)\ \text{d}x$$
Eventually, the most common approach to utilize this observation is to note that
\begin{align}
\bigg|\sum_{n = 0}^k f_n(x)\bigg| & \leq \sum_{n = 0}^k f_n(x)
\\\\ & \leq \sum_{n = 0}^k |f_n(x)|
\end{align}
That is: if the sum converges absolutely (to an integrable function), then the integral and the summation can be exchanged.


text:
Q: How to check if the 64 bit version of flash player 10.2.161.23 is installed in the system or not IN C#? I had earlier asked the question in stackoverflow in the followin link-

How to check if a particular version of flash player is installed or not in C#.?

Type type = Type.GetTypeFromProgID("ShockwaveFlash.ShockwaveFlash");
object flashObject = Activator.CreateInstance(type);

    object versionString = flashObject.GetType().InvokeMember("GetVariable", BindingFlags.InvokeMethod,null, flashObject, new object[] {"$version"});

But my code is able to detect the 64 bit version 10.2.161.23, only when, the other 32 bit version 10.1.102.64 is installed on the system.

But when I uninstall the other version
  10.1.102.64, from the system, my code is not detecting the 64 bit version
  10.2.161.23 and the value of "type" varable is "null".

I dont know why that the 64 bit version needs a 32 bit version flash to be present for detecting the presence of 64 bit version, using the above code.
Thanks In Advance.

A: A good solution is this function taken time ago from another site:
    public static bool IsApplictionInstalled(string p_name)
    {
        string displayName;
        RegistryKey key;

        // search in: CurrentUser
        key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
        if (key != null) foreach (String keyName in key.GetSubKeyNames())
        {
            RegistryKey subkey = key.OpenSubKey(keyName);
            displayName = subkey.GetValue("DisplayName") as string;
            if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
            {
                return true;
            }
        }

        // search in: LocalMachine_32
        key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
        if (key != null) foreach (String keyName in key.GetSubKeyNames())
        {
            RegistryKey subkey = key.OpenSubKey(keyName);
            displayName = subkey.GetValue("DisplayName") as string;
            if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
            {
                return true;
            }
        }

        // search in: LocalMachine_64
        key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
        if (key != null) foreach (String keyName in key.GetSubKeyNames())
        {
            RegistryKey subkey = key.OpenSubKey(keyName);
            displayName = subkey.GetValue("DisplayName") as string;
            if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
            {
                return true;
            }
        }
        // NOT FOUND
        return false;
    }

You can try to play with it to perform your search, like subkeys and changing this:
if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)

To this:
if (displayName.Contains(p_name) == true) //"Flash Player" is your case... (untested)

Source: http://mdb-blog.blogspot.com/2010/09/c-check-if-programapplication-is.html

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I customize ads in my app? I'm building an ios app that target special type of people, so I did implement adMob in my app but the problem adMobs shows ads depends on location if user allow.
What I'm looking for is to show ads that is of my app type ?
For example,if my app was a gaming app so I would only show adds for gaming apps or anything related to gaming or if my app is educational i would show only ads related to education.
I hope someone knows the way to do that

A: Hello Guys I found the Answer in their website after long digging
Here it is:
https://support.google.com/admob/answer/3150235?hl=en

A: Google AdMob official document say:

The Mobile Ads SDK is now imported and initialized, and you're ready
  to implement an ad. AdMob offers a number of different ad formats, so
  you can choose the one that best fits your app's user experience.

Implement customize ads to access following link:
https://firebase.google.com/docs/admob/ios/quick-start


text:
Q: Android translate app name I'd like to know if it is possible to translate the actual name of the app that people will search for in the Google Play Store? For example, if the name of my app is "Hello", the same app should be found if one person searches for "Hello" and another one searches for "Hola".

A: Of course you can!
In the Google Play Developer Console you can see all languages for your app.
You just have to set a different title for each language in the "Store Listing" tab.


text:
Q: Monitoring azure storage bandwidth usage for each of my users I have an application that will give SAS tokens to registered users to upload and download directly from Azure storage. What is the best way to monitor the bandwidth for each of my users?
I have taken a look at the logs that Azure provides, and looking at things, a possible way is to bind the SAS token to the user's ip address, and then check the logs for the <requester-ip-address> field. However, this way doesn't seem so concrete as multiple users might have the same ip address.
Also, I see a <request-id-header> field which, according to the documentation, is an opaque value that uniquely identifies the request. However I don't see any way of getting the header value if the user directly communicates with azure storage.
Thanks.

A: A different approach could be:

*

*Using Copy Blob API: create a temporary file with user's username and generate a SAS token for user to download the file

*Remove the file after the expiry of the SAS token

*Check for the analytic logs in the Storage account; whether the blob was accessed, and whether the download was successful, and if not downloaded bytes

*If user failed to download the whole blob; you will see SASNetworkError in the log

*In the event of SASNetworkError; the log will contain the amount of data that was downloaded by the user (https://learn.microsoft.com/en-us/rest/api/storageservices/storage-analytics-log-format response-packet-size). This will tell you the percentage of the download that completed right before the error.

A:
What is the best way to monitor the bandwidth for each of my users?

Based on my experience, we have no suitable way to do that. It seems that we couldn't get the bandwidth value. If you worry about the limition of azure storage, we could get the Azure Storage limitation from the azure official document.

Maximum Request Rate per storage account   Blobs: 20,000 requests per second2 for blobs of any valid size (capped only by the account's ingress/egress limits)
Target throughput for single blob  Up to 60 MB per second, or up to 500 requests per second

Update:
We could according  Azure price calculator to adopt appropriate strategy to limit the cost for user.

Take General-purpose Storage Accounts for example, the cost depends on Storage transactions and Capacity. If we want to limit the cost for the user. On my opinion, we could limit the size*transaction for the user.

*

*Create relationship for SAS tokens and user

*Get the request uri and request-content-length from the log and we also   count the request for user

*Use logic to control the size*transaction for user.
About Storage Analytics Log Format please refer to azure document.
Other related link:
Understanding Windows Azure Storage Billing – Bandwidth, Transactions, and Capacity


text:
Q: Setting Datetime timezone in Rcpp I want to add 30 secs from input R POSIXct object with UTC timezone and output the POISXct object with same timezone in the Rcpp function, but the output timezone is my system timezone(CST).
I don't want to change the locale setting in R environment, but I didn't find the setting about timezone in Rcpp::timezone.
Here is my Rcpp code:
sourceCpp(code = "
#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
Datetime TimeExample(Datetime x) {

     return( x + 30 );

}")

NowTime = as.POSIXct("2017-03-21 13:35:23","%Y-%m-%d %H:%M:%S",tz="UTC")
TimeExample(NowTime)
## > "2017-03-21 21:35:53 CST"

Thanks!

A: You really do not need Rcpp for this, but you can of course use Rcpp for it (maybe as part of a bigger problem).
You generally want the *Vector types, here DatetimeVector, and I recommend the rewritten one you can opt-into now, and which will become the default later this year:
// use new Datetime vector API
#define RCPP_NEW_DATE_DATETIME_VECTORS 1

#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
DatetimeVector TimeExample(DatetimeVector x, std::string tz) {
  DatetimeVector y(x);
  y = y + 30;
  y.attr("tzone") = tz;
  return(y);
}

/*** R
NowTime <- as.POSIXct("2017-03-21 13:35:23","%Y-%m-%d %H:%M:%S",tz="UTC")
TimeExample(NowTime, "America/New_York")
*/

You see that we set the tzone via attr as we would in R.
When I source this I get:
R> Rcpp::sourceCpp("/tmp/robinchen.cpp")

R> NowTime <- as.POSIXct("2017-03-21 13:35:23","%Y-%m-%d %H:%M:%S",tz="UTC")

R> ShiftedTime <- TimeExample(NowTime, "America/New_York")

R> ShiftedTime
[1] "2017-03-21 09:35:53 EDT"
R>

and you see that it comes out as Eastern time as desired (even though I am in Central Time).
You can do all that the R level at basically the same speed with the same number of operations.


text:
Q: Cannot complete installing Google Plugin for eclipse I am trying to install the Google Plugin in eclipse but I get the follwoing error:

Cannot complete the install because one or more required items could not be found.
  Software being installed: Google Plugin for Eclipse 3.6 1.4.2.v201012211742
    (com.google.gdt.eclipse.suite.e36.feature.feature.group 1.4.2.v201012211742)
  Missing requirement: Google Eclipse 3.6 Platform Plugin 1.4.2.v201012211742 (com.google.gdt.eclipse.platform.e36 1.4.2.v201012211742) requires 'bundle org.eclipse.equinox.p2.operations 0.0.0' but it could not be found
  Cannot satisfy dependency:
      From: Google Plugin for Eclipse 3.6 1.4.2.v201012211742 (com.google.gdt.eclipse.suite.e36.feature.feature.group 1.4.2.v201012211742)
  To: com.google.gdt.eclipse.platform.e36 [1.4.2.v201012211742]

Please help

A: Go to About / Install New Software... and enter this URL:  http://download.eclipse.org/mylyn/releases/latest
After the list populates, select MyLyn SDKs and Frameworks  / MyLyn Commons.  Once that plug-in installs, restart Eclipse and then the Google App Engine plug-in should install.

A: The App Engine documentation is old, that is the problem. There are newer releases of the API:

*

*http://dl.google.com/eclipse/plugin/3.3

*http://dl.google.com/eclipse/plugin/3.4

*http://dl.google.com/eclipse/plugin/3.5

*http://dl.google.com/eclipse/plugin/3.6

*http://dl.google.com/eclipse/plugin/3.7

*http://dl.google.com/eclipse/plugin/4.2
Try the one that suits your IDE.

A: When you are on the Available Software screen, after having selected the software you want to install, before you click next, if you check the box "Contact all update sites during install to find required software." then eclipse will automatically resolve and install the needed plugins for you.

A: I had the same problem and finally found the solution. Hope it works for you too.
Follow these steps and then try to install the plugin again.
Select Help > Install New Software...
Select the Helios update site in the Work with dropdown. If it's not there, you can enter the URL directly: http://download.eclipse.org/releases/helios
Install Helios > Web, XML, and Java EE Development > Eclipse Web Developer Tools.

A: I got the same error and looking at the messages indicated that it was due to a conflict between Java EE IDE and Google plugin fo different eclipse runtimes ( 3.6 and 3.5).
So I upgraded the Java EE IDE to the latest version available and that solved the problem.

A: I found out that ADT-Bundle whose version is eclipse 4.2 has this issue of installing google plugin and when I downloaded eclipse and Android SDK separately and connected them together. It solved the problem. Google plugin installation worked super fine then

A: Check to see the "type" of Eclipse you are using. I was using the main version of Luna 4.4.2 and having this problem. I then switched to the "Java EE" type of Eclipse, and installed the Google Plugin and AppEngine with no issues. I believe it is because the "Java EE" type comes with WTP.


text:
Q: String throwing exception I have the following code with two functions which should throw exceptions when condition is satisfied. Unfortunately the second one with string seems not working and I don't have a clue whats wrong
#include "iostream"
#include "stdafx.h"
#include "string"
using namespace std;

struct P
{
    int first;
    string second;
};

void T(P b)
{ if (b.first==0)
throw (b.first);
};

void U(P b)
{ if (b.second == "1, 2, 3, 4, 5, 6, 7, 8, 9" )
throw (b.second);
};

int _tmain(int argc, _TCHAR* argv[])
{
P x;
cin>>x.first;
cin>>x.second;

try
    {
        P x;
        T(x);
    }
    catch (int exception)
    {
        std::cout << exception;
    }

    try{
        U(x);
    }
    catch (const char* exception)
    {
        std::cout << "\n" << exception;
    }

system("pause");
return 0;
}

I have the following input:
0
1, 2, 3, 4, 5, 6, 7, 8, 9

and the output:
0

and I want to get:
0
1, 2, 3, 4, 5, 6, 7, 8, 9

How can I change char for string output?

A: I do not know what you are trying to experiment, but despite being allowed by the language, throwing objects that are not instances of (subclasses of) std::exception should be avoided.
That being said you have a bunch of inconsistencies in your code.
First cin >> x.second; will stop at the first blank character. So in your example you have only "1," in x.second, so you test fails and you code does not throw anything.
You should ignore the newline left by cin >> x.first and use getline to read a full line include spaces:
P x;
cin >> x.first;
cin.ignore();
std::getline(cin, x.second);

The first try block invokes UB, because you are declaring a new x in that block that will hide the one you have just read. It should be:
try
{
    //P x;  // do not hide x from the enclosing function!
    T(x);
}

Finaly, and even it is not an error you should always catch non trivial object by const reference to avoid a copy. Remember that exceptions are expected to be raised in abnormal conditions, and when memory becomes scarce you should avoid copy. But you must catch the exact same object that was thrown. So the second catch should be:
catch (std::string exception)
{
    std::cout << "\n" << exception;
}

or better (avoid a copy):
catch (const std::string& exception)
{
    std::cout << "\n" << exception;
}


text:
Q: How to get a collection with linq but leave out some entities from a nested collection? I have this linq:
List<Group> groups =
   context.Groups.Where(group => group.Station.Id == stationId).ToList();

But i'm getting too many users for the groups.
I want to incorporate this:
group.Users.Where(u => u.Account.IsActive == true)

But I cant fit it anywhere without getting a error.
Help much appreciated after trying so many things without getting it right.
UPDATE:
Its only syntax errors I got from trying the All() and other functions.. I don't seem to have had such complicated quires with linq before..
UPDATE:
 List<Group> groups = context.Groups.Where(group =>
    group.Station.Id == stationId &&
    group.Users.Where(u => u.Account.IsActive == true)).ToList();

The error:

Operator '&&' cannot be applied to operands of type 'bool' and
  'System.Collections.Generic.IEnumerable'

A: List<Group> groups = context.Groups
                            .Where(group => group.Station.Id == stationId
                                            && group.Users.Where(u => u.Account.IsActive == true).Count() > 0).ToList();

You should compare it with count. That was the error.

A: You can't do this. Filtering of related entities is not implemented yet. Related entities can be loaded only all at once.
Thus you cannot remove inactive users from groups or filter them, you should create new groups with only active users. It's not possible to do on server side if you are using Entity Framework (you'll see The entity or complex type 'Group' cannot be constructed in a LINQ to Entities query). But you can return anonymous objects with required data:
var groups = from g in context.Groups
             where g.Station.Id == stationId
             select new {
                Id = g.Id,
                ActiveUsers = g.Users.Where(u => u.Account.IsActive)
             };


text:
Q: How do I use Google's Identify Platform to authenticate against Cloud Endpoints? In our organisation we use the Google Kubernetes Engine (GKE) to implement a micro-service architecture. As we are also G-Suite users, everyone in the organisation is guaranteed to have a Google account. In consequence we would like to use those accounts to manage authentication and authorization of micro services.
We have prototyped login using the angularfire2 client to authenticate against the Google Identity Platform. We also have Google Cloud Endpoints configured to control access to relevant services.
The piece we are missing is how to get from the identity in Google to an access token we can use on our services -- the access token coming back using the Firebase API has no claims in it, and the documentation on custom claims seems to make it quite clear that these go into the identity token.
My expectation would be to have JWTs with the appropriate audience (our backend), containing a sufficient set of claims to implement role based access control within the services. Ideally the infrastructure could validate a claim already -- some of our services are small enough to require only one role, which could be enforced outside the service. Or we could annotate our endpoints (Protobuf) with the required claims.
In the GCP environment, what is the standard process of creating access tokens to be used for accessing GKE services? Is there anything that supports this?

A:
The piece we are missing is how to get from the identity in Google to
  an access token we can use on our services -- the access token coming
  back using the Firebase API has no claims in it, and the documentation
  on custom claims seems to make it quite clear that these go into the
  identity token.

Google OAuth Access Tokens do not have an identity in the sense that you want to use it. Identity is stored in the Identity Token. Add the scope "email" when authenticating the user. Google will return an ID Token. For some frameworks, you can request custom claims for the Identity Token.

In the GCP environment, what is the standard process of creating
  access tokens to be used for accessing GKE services? Is there anything
  that supports this?

There are two types of access excluding methods such as API keys. User Accounts and Service Accounts. Service-to-service typically uses service account Access Tokens (RBAC) or service account Identity Tokens (IBAC). In your case, you want to use Identity Platform which means User Accounts.
If I was designing this system, I would use User Accounts to authenticate with the system - Firebase is great for this purpose. I would look up what roles this identity supports/allows from my database (Firestore) and create a service account Access Token with the required scopes for GCP services. I would then use this Access Token for GCP service-to-service authorization. If I also required custom roles for my own services, I would create a custom Identity Token with my custom roles and include that as a custom HTTP header and include the Google Access Token in the standard HTTP "authorization: bearer" header. I would use the service account private key to sign my custom Identity Token or use a GCP IAM API to sign for me so that the other end can verify with the service account's public key. This method prevents data leakage at the client, no private keys are distributed, scopes/roles are not disclosed, etc.

A: I would suggest you follow this doc of authentication between services by using service account files.


text:
Q: How to implement view holder into array adaptor *Updated *
Hey guys I solved my problem by my own i used the https://github.com/koush/UrlImageViewHelper/blob/master/README.md
and pass UrlImageViewHelper.setUrlDrawable(image,ei.img_url); from my Entryadapter class and it works well.
I want to show Listview with 3 text and one imageview with separator/section in list.
so i follow this tutorial http://bartinger.at/listview-with-sectionsseparators/?
than I face problem to load image (bitmap) so i use file and bitmapfactory to display bitmap on listview by using AsyncTask.
But problem is it loads every time when i scroll up or down.I want to display list once so i am trying to implement view holder for my list but as i am newer to android and Java i dont know how can i implement this to my code.
can anyone help me? I am attaching all code file so this code will help to other student and fresher like me.
here is my Entryadaptor.java
public class EntryAdapter extends ArrayAdapter<Item> {
private Context context;
private ArrayList<Item> items;
private LayoutInflater vi;
Uri myurl;
ImageView image;
public EntryAdapter(Context context,ArrayList<Item> items) {
    super(context,0, items);
    this.context = context;
    this.items = items;
    vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    final Item i = items.get(position);
    if (i != null) {
        if(i.isSection()){
            SectionItem si = (SectionItem)i;
            v = vi.inflate(R.layout.list_item_section, null);
            v.setOnClickListener(null);
            v.setOnLongClickListener(null);
            v.setLongClickable(false);
            final TextView sectionView = (TextView) v.findViewById(R.id.list_item_section_text);
            sectionView.setText(si.getTitle());
        }else
          {
            EntryItem ei = (EntryItem)i;
            v = vi.inflate(R.layout.list_item_entry, null);
            final TextView title = (TextView)v.findViewById(R.id.list_item_entry_title);
            final TextView subtitle = (TextView)v.findViewById(R.id.list_item_entry_summary);
            image = (ImageView)v.findViewById(R.id.showlist_item_entry_drawable);
            if (title != null)
                title.setText(ei.title);
            if(subtitle != null)
                subtitle.setText(ei.subtitle);
                 if(image !=null)
                 {
                 try {
                      URL onLineURL = new URL(ei.img_url);
                       new MyNetworkTask(image).execute(onLineURL);
                      } catch (MalformedURLException e) {
                       e.printStackTrace();
                      }}}}
    return v;
    }
  private class MyNetworkTask extends AsyncTask<URL, Void, Bitmap>{
         ImageView tIV;
         public MyNetworkTask(ImageView iv){
          tIV = iv;
         }
      @Override
      protected Bitmap doInBackground(URL... urls) {
       Bitmap networkBitmap = null;
       URL networkUrl = urls[0]; //Load the first element
       try {
        networkBitmap = BitmapFactory.decodeStream(
          networkUrl.openConnection().getInputStream());
       } catch (IOException e) {
        e.printStackTrace();
       }
       return networkBitmap;
      }
      @Override
      protected void onPostExecute(Bitmap result) {
       tIV.setImageBitmap(result);
      }
        }

}
Here is fragment code
public class ShowsFragment extends SherlockListFragment { ArrayList<Item> items = new ArrayList<Item>();
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
     items.add(new SectionItem("Today"));
        items.add(new EntryItem("Item 1", "This is item 1.2","http://pierre.chachatelier.fr/programmation/images/mozodojo-original-image.jpg"));
        items.add(new EntryItem("Item 2", "This is item 1.3","http://upload.wikimedia.org/wikipedia/commons/8/85/Image-New_Delhi_Lotus.jpg"));
        items.add(new SectionItem("This Week"));
        items.add(new EntryItem("Item 4", "This is item 2.1","https://twimg0-a.akamaihd.net/profile_images/1080041262/VMIX_logo_zoom_bkbg1_normal.png")); EntryAdapter adapter = new EntryAdapter(getActivity(), items);
        setListAdapter(adapter);
    }
    public void onListItemClick(ListView l, View v, int position, long id) {
        if(!items.get(position).isSection()){
            EntryItem item = (EntryItem)items.get(position);
            Toast.makeText(getActivity(), "You clicked " + item.title , Toast.LENGTH_SHORT).show();
        }
        super.onListItemClick(l, v, position, id);
    }
}

sectionItem code
public class SectionItem implements Item{
private final String title;
public SectionItem(String title) {
    this.title = title;
}
public String getTitle(){
    return title;
}
public boolean isSection() {
    return true;
}

}
Entry item class code
public class EntryItem implements Item{
public final String title;
public final String subtitle;
public final String img_url;
public EntryItem(String title, String subtitle,String Image_url) {
    this.title = title;
    this.subtitle = subtitle;
    this.img_url = Image_url;
}
public boolean isSection() {
    return false;
}

}

A: I would suggest to cache the loaded bitmaps somewhere so you can avoid server calls if you scroll up and down (for example using a Map).
Also, since you are loading the bitmaps asynchronously, once you have loaded the data, make sure the view is still the correct one to set the image into, because views are getting recycled in a Listview (hence the name "convertView"). e.g.
    if (item.equals(imageView.getTag())) {
        // only set image if Tag is still valid
        imageView.setImageDrawable(drawable);
    }

A: thumbs up for KoljaTM. it solved simmilar problem of mine. i use thread to speedup in gridview and i had problem that some picture positions are mixed eachother. after adopting KoljaTM's approach, no twist occured. thanks.

A: hey guys Just this lib into your project and pass the image view object and url and done
https://github.com/koush/UrlImageViewHelper/blob/master/README.md


text:
Q: PHP Curl emulate web browser request to Endomondo I have read several posts regarding this issue, but I simply cannot crack this nut.
I'm trying to make PHP Curl emulate this web browser request:
https://www.endomondo.com/embed/user/workouts/?id=747232&measure=0&width=450&height=400&page=0&language=DA
(I have removed all cookies prior to this request)
When I access the URL from a browser I get a status code 200 and everything is fine. However, when I use PHP Curl, I get status code 403, which indicates that the server for some reason denies my request.
Here's my PHP code:
$curl_cookie = tempnam("/tmp", "tmpcookie.txt");
$curl_url = 'https://www.endomondo.com/embed/user/workouts/?' . http_build_query(Array('id' => 747234 , 'measure' => 0 , 'width' => 450 , 'height' => 400 , 'page' => 0, 'language' => 'DA'));
$curl_header = array(
        "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
        "Accept-Encoding: gzip, deflate, br",
        "Accept-Language: en,da;q=0.7,en-US;q=0.3",
        "Cache-Control: max-age=0",
        "Connection: keep-alive",
        "DNT: 1",
        "Upgrade-Insecure-Requests: 1",
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0"
);

$curl_options = array(
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_POST => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_HEADER => true,
    CURLINFO_HEADER_OUT  => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_AUTOREFERER => true,
    CURLOPT_CONNECTTIMEOUT => 120,
    CURLOPT_TIMEOUT => 120,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_URL => $curl_url,
    CURLOPT_HTTPHEADER => $curl_header,
    CURLOPT_COOKIESESSION => true,
    CURLOPT_COOKIEFILE => "",
    CURLOPT_COOKIEJAR => $curl_cookie,
    CURLOPT_VERBOSE => true
);

$ch = curl_init();
    curl_setopt_array( $ch, $curl_options );
    $ch_content = curl_exec($ch);
    $ch_err = curl_errno($ch);
    $ch_errmsg = curl_error($ch);
    $ch_header = curl_getinfo($ch);
curl_close($ch);

echo "ERROR_NO : " .$ch_err;
echo "ERROR_MSG : " .$ch_errmsg;
print_r ($ch_header);
echo $ch_content;

I have compared the web request header to the PHP Curl request header. They are as follows:
HTTP Request Header from web request (copied from Firefox debug mode):
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en,da;q=0.7,en-US;q=0.3
Cache-Control: max-age=0
Connection: keep-alive
DNT: 1
Host: www.endomondo.com
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0)  Gecko/20100101 Firefox/59.0

HTTP Header from PHP Curl Request:
GET /embed/user/workouts/?id=747232&measure=0&width=450&height=400&page=0&language=DA HTTP/1.1
Host: www.endomondo.com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en,da;q=0.7,en-US;q=0.3
Cache-Control: max-age=0
Connection: keep-alive
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

Why does Endomondo reject my request? Can it perhaps block the request based on the IP address of my server, or something like that?

A: yup, must be some kind of IP block (region lock perhaps?). i get a 200 from here. btw, because you send the header Accept-Encoding: gzip, deflate, br, the server opt to gzip-compress the output, and you provide no code to decompress it, thus i get unintelligible binary data in my terminal,
hanshenrik@Deb9DEtestX:~/phptests3$ php foo4.php
ERROR_NO : 0ERROR_MSG : Array
(
    [url] => https://www.endomondo.com/embed/user/workouts/?id=747234&measure=0&width=450&height=400&page=0&language=DA
    [content_type] => text/html;charset=UTF-8
    [http_code] => 200
    [header_size] => 1121
    [request_size] => 454
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.362421
    [namelookup_time] => 0.033952
    [connect_time] => 0.081217
    [pretransfer_time] => 0.162576
    [size_upload] => 0
    [size_download] => 1977
    [speed_download] => 5461
    [speed_upload] => 0
    [download_content_length] => 1977
    [upload_content_length] => -1
    [starttransfer_time] => 0.362295
    [redirect_time] => 0
    [redirect_url] =>
    [primary_ip] => 13.33.44.67
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => 192.168.1.69
    [local_port] => 40324
    [request_header] => GET /embed/user/workouts/?id=747234&measure=0&width=450&height=400&page=0&language=DA HTTP/1.1
Host: www.endomondo.com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en,da;q=0.7,en-US;q=0.3
Cache-Control: max-age=0
Connection: keep-alive
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

)
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Content-Length: 1977
Connection: keep-alive
Cache-Control: no-cache, max-age=0, must-revalidate, no-store
Content-Encoding: gzip
Content-Language: en
Date: Wed, 02 May 2018 15:21:56 GMT
P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
Pragma: no-cache
Server: Apache-Coyote/1.1
Set-Cookie: CSRF_TOKEN=6av0q6psn49etvdt3d4iqvj2uc; Path=/; Secure
Set-Cookie: JSESSIONID=34366B7693B2AB99E53203712CF4E96E; Domain=www.endomondo.com; Path=/; HttpOnly
Set-Cookie: AWSELB=13FDC17D1C2B68745BCB41EBB6BDDC3DB8274D93D632CEC9302FDAE832678AB6A3EFA1E6D580B2D673C8844CEA83A618537653BF381452F4DA3B7D27994EE9DB3B34D0802A11DD898C909C58E6B350BCF9DB0F4312;PATH=/;DOMAIN=www.endomondo.com;HTTPONLY
Strict-Transport-Security: max-age=15768000
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Endo-ID: NOT_SET
X-UA-Compatible: IE=9
X-XSS-Protection: 1; mode=block
X-Cache: Miss from cloudfront
Via: 1.1 123c1b8455da8ecd4abd0715a42e881e.cloudfront.net (CloudFront)
X-Amz-Cf-Id: QDjQfo8-aHVuRjup3_Ap9XSDDzsNVdyOR1zFNRd8Aipvvz5AesT3aQ==

�ZYs��}���R�J�uk��b�c�jxI   ��m����珥Y
                                             ����LD

-�>������[�?���i�NY�u�ިҹ�Rt�a&\�aj���>t(X�0T��ƶ���Ի4E[7
                                                          �^�
                                                             k���&3�3��/��������,�X�o�����xQ�B7PQ���4娞Y����]H�o�ST��A�uO�]�l��.�%�W(\�h]d-vm]�Uj��G�K{U��������M�hJ;�h�b��0h��F�F^�)fߍc{ <<capped binary gibberish>>

however, if i cut the crap, and make the code
$ch = curl_init ();
curl_setopt_array ( $ch, array (
        CURLOPT_URL => 'https://www.endomondo.com/embed/user/workouts/?' . http_build_query ( Array (
                'id' => 747234,
                'measure' => 0,
                'width' => 450,
                'height' => 400,
                'page' => 0,
                'language' => 'DA'
        ) ),
        CURLOPT_VERBOSE => 1,
        CURLOPT_ENCODING => ''
) );
curl_exec($ch);

, i get:
hanshenrik@Deb9DEtestX:~/phptests3$ php foo4.php
*   Trying 13.33.44.62...
* TCP_NODELAY set
* Connected to www.endomondo.com (13.33.44.62) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=DK; ST=Copenhagen; L=Copenhagen; O=ENDOMONDO ApS; CN=*.endomondo.com
*  start date: Jun 20 00:00:00 2016 GMT
*  expire date: Aug 24 12:00:00 2018 GMT
*  subjectAltName: host "www.endomondo.com" matched cert's "*.endomondo.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
> GET /embed/user/workouts/?id=747234&measure=0&width=450&height=400&page=0&language=DA HTTP/1.1
Host: www.endomondo.com
Accept: */*
Accept-Encoding: deflate, gzip

< HTTP/1.1 200 OK
< Content-Type: text/html;charset=UTF-8
< Content-Length: 1979
< Connection: keep-alive
< Cache-Control: no-cache, max-age=0, must-revalidate, no-store
< Content-Encoding: gzip
< Content-Language: en
< Date: Wed, 02 May 2018 15:25:23 GMT
< P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
< Pragma: no-cache
< Server: Apache-Coyote/1.1
< Set-Cookie: CSRF_TOKEN=4695uqd37dv2j2l54jh9a2rn0d; Path=/; Secure
< Set-Cookie: JSESSIONID=13898023D4D521726B524285E5B72C1F; Domain=www.endomondo.com; Path=/; HttpOnly
< Set-Cookie: AWSELB=13FDC17D1C2B68745BCB41EBB6BDDC3DB8274D93D615A7D975F2F390D054A556F773DC326FE5ED00DBCF12BF71655D1BB4061D616B1452F4DA3B7D27994EE9DB3B34D0802A11DD898C909C58E6B350BCF9DB0F4312;PATH=/;DOMAIN=www.endomondo.com;HTTPONLY
< Strict-Transport-Security: max-age=15768000
< Vary: Accept-Encoding
< X-Content-Type-Options: nosniff
< X-Endo-ID: NOT_SET
< X-UA-Compatible: IE=9
< X-XSS-Protection: 1; mode=block
< X-Cache: Miss from cloudfront
< Via: 1.1 f9fdb36a35b271b2043714f4c4655495.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: chGCj7ws8YYSOYMQyEQ4OeQ1sitYnu1ffomtAs0ve65-ky-wnE2nmA==
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Endomondo Workout Overview</title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <link rel="SHORTCUT ICON" href="http://www.endomondo.com/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../../css/reset-fbea64300020d6b01efc0eb9652c4aff.css" />
<link rel="stylesheet" type="text/css" href="../../../css/AbstractWidgetPage-753381f932c1912e802955160f06b654.css" />
<link rel="stylesheet" type="text/css" href="../../../css/WorkoutListWidgetPage-50c2bd86823816770781e894496dc3c0.css" />

Kasper Vork Steffensen

            Date
            Sport
            Distance
            Duration

            01-05-2018
            Vandring
            5.97 km
            1t:11m:40s

            29-04-2018
            Løb
            2.23 km
            13m:37s

            25-04-2018
            Løb
            2.16 km
            12m:52s

            18-04-2018
            Løb
            1.73 km
            10m:41s

            15-04-2018
            Cykling (sport)
            18.87 km
            57m:12s

            15-04-2018
            Cykling (sport)
            3.21 km
            9m:20s

            09-04-2018
            Vandring
            2.91 km
            35m:23s

            08-04-2018
            Løb
            4.04 km
            24m:08s

            08-04-2018
            Cykling (sport)
            1.32 km
            3m:54s

            08-04-2018
            Cykling (sport)
            1.15 km
            3m:43s

            04-04-2018
            Vandring
            0.21 km
            2m:08s

            04-04-2018
            Løb
            4.01 km
            23m:26s

            31-03-2018
            Løb
            5.18 km
            29m:55s

    «

         1

         2

         3

         4

         5

         6

         7

         8

         9

         10

    »

Join us on www.endomondo.com

* Connection #0 to host www.endomondo.com left intact

(ps, note how i used CURLOPT_ENCODING, to make curl offer gzip compression, and automatically decompress it for me),


text:
Q: exe with pytz-2018.3.dist not working. raises UnknownTimeZoneError I'm having a problem when building an exe from my scripts that use the pytz lib. I'm constantly getting the error:
File "pytz\__init__.pyc", line 180, in timezone UnknownTimeZoneError: 'Europe\Ljubljana'

No matter how I build the exe I get this error. Running the script works. I tried all suggestions that were posted here and on other sites.
My setup.py file:
from distutils.core import setup
import os.path
try:
    import py2exe
    has_py2exe = True
except ImportError, e:
    has_py2exe = False

myScript=__import__("myScript")

options = {'py2exe': {'packages': ['pytz']}}

options['py2exe'] = {'dist_dir': 'dist'}
setup(
    name="myScript",
    version=myScript.CONST_VERSION,
    console=[{
        'script': 'myScript.py',
        'copyright': 'None',
        'company_name': 'None'
    }],
    options=options,
)

if has_py2exe:
    import zipfile
    zipfile_path = os.path.join(options['py2exe']['dist_dir'], 'library.zip')
    z = zipfile.ZipFile(zipfile_path, 'a')

    import pytz
    assert (pytz.__file__.endswith('__init__.pyc') or pytz.__file__.endswith('__init__.py')), pytz.__file__
    zoneinfo_dir = os.path.join(os.path.dirname(pytz.__file__), 'zoneinfo')
    disk_basedir = os.path.dirname(os.path.dirname(pytz.__file__))
    for absdir, directories, filenames in os.walk(zoneinfo_dir):
        assert absdir.startswith(disk_basedir), (absdir, disk_basedir)
        zip_dir = absdir[len(disk_basedir):]
        for f in filenames:
            z.write(os.path.join(absdir, f), os.path.join(zip_dir, f))
    z.close()

This builds the exe and includes the zoneinfo dir and all timezone files to library.zip.
I only use the pytz in one function where I convert the CEST timestamp to UTC timestamp to store on the server.
The function:
from datetime import datetime
import pytz

def date_time_utc(date_str):
    date_tz = pytz.timezone("Europe/Ljubljana")

    fmt = '%Y-%m-%d %H:%M:%S'
    date_str_dt_object = datetime.strptime(date_str, fmt)

    date_str_dt_object = date_tz.localize(date_str_dt_object)
    date_utc = date_str_dt_object.astimezone(pytz.timezone('UTC'))

    return date_utc.strftime(fmt)

The setup script for the pytz is from here. All other things like this script and any other suggested fixes raised the exactly same error.
Has any one figured out how to get this working?


text:
Q: Using OpenStreetMap tiles in ArcMap I was hoping to use ESRI's ArcGIS Editor for OpenStreetMap to view OpenStreetMap data in ArcMap, but my organization hasn't upgraded to version 10 yet.
I also know about ArcBruTile, but I prefer not to use that software because of the potential TOS violations with Google, Bing, etc.
Does anyone know of another way to bring OpenStreetMap tiles into ArcGIS 9.3.1?

A: OSM Layers for ArcGIS
http://www.arcgis.com/home/webmap/viewer.html?webmap=b834a68d7a484c5fb473d4ba90d35e71
Alternatively *http://osm.wheregroup.com/ have a WMS OSM Server (Europe)
    Data Type: WMS Service
WMS Server: http://osm.wheregroup.com/cgi-bin/osm_basic.xml?SERVICE=WMS&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=Grenzen&format=image/png&STYLE=default&
Service Name: OSM_Basic

Default Coordinate System:
GCS_WGS_1984
Datum: D_WGS_1984
Prime Meridian: 0

A: Arc2Earth claims to be able to import OpenStreetMap (as well as Google imagery and maps) into ArcGIS. Unlike ArcBruTile which is buggy and barely legal (if legal at all), it is my understanding that Arc2Earth is completely legit but not free.
Scratch that, there is a free version; In terms of just trying out the OpenStreetMap tiles there is a "Free" version but as it indicates on the site the map tiles will be watermarked.
Separate "Data Service" is required if you want Google Imagery capabilities within ArcGIS.
http://www.arc2earth.com/products/desktop/

A: Looking at
"Adding Openstreetmap to ArcGis 9.3.1" and "Can you use OpenStreetMap tiles in ArcGIS 9.3.1?" topics, the only solution easy to use seems to be ArcBruTile but not free (25 euros) otherwise you should consumes WMS services build with OpenStreetMap data (some in the second provided topic). There is a mention of an Arc2Earth product but the company has been closed.


text:
Q: Directory API returns 403 forbidden i'm trying to use the directory API by using a service account that I've enabled his Domain-wide Delegation and off course also authorized this service from the admin console using the json file credetials downloaded when creating the service account.
I've also enabled the admin sdk from the google developers console
and i'm using the googleapi library
in order to get access token for the service account
import * as  google from 'googleapis';//google sdk for api+Oauth
//creating JWT auth client for service account:

const jwtClient = new google.auth.JWT(
  client_email,
  null,
  private_key,
  scope, // (included the   "https://www.googleapis.com/auth/admin.directory.user" scope)
  null,
);

      let tokens
      jwtClient.authorize( (err, tokens)=> {
        if (err) {
          console.log(err);
          return;
        } else {
          tokens = tokens
        }
        // Make an authorized request to list of domain users.

        let url = `https://www.googleapis.com/admin/directory/v1/users?domain=mydomain`;
        let headers = {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${tokens.access_token}`
        }

        request.get({
          url: url,
          json: true,
          headers: headers,
        }, (err, res, body: {}) => {
          this.handleResponse(err, res, body, resolve, reject);
        });
      });

    })
  }

the tokens are retrived succefully but when sending the users list request i'm receiving 403 "Not Authorized to access this resource/api"
on the other hand when using the google explorer api with the same params it work's

A: Looks like you didn't provide a subject when constructing the JWT object (in the line after scope, in your code). You should provide the email address of an admin there, so that you get a token impersonating that admin. Otherwise, you're acting as the service account itself, that doesn't have access to your domain's directory (and can never have access - that's why you must impersonate an admin).


text:
Q: What  means in template arguments I've found this code in the project I'm working:
template<typename T>
class SomeClass
{
};
typedef SomeClass<void(void)> SomeType;

What means <void(void)> construction? Can you please explain in a simple sample how a construction like this one may be used?

A: It means that the type parameter is a function type (note, not a function pointer, but a function type) that takes no parameters, and returns no value.
You can even define function parameters in such a way:
void f (void(void));

That will decay to a function pointer when passed (just like an array parameter decays to a pointer).

A: T here is a type of function that returns nothing and takes no arguments.


text:
Q: Defining the Vision Through Business Requirements How to write a vision [generally] for some business ? Is it have some template ? any example ?
Business about online ticket services .

A: What is a 'vision'?
It's such a nebulous objective... I don't see how there could be a template. Unlike requirements specifications, functional specifications etc, there is no accepted understanding of what a 'vision' actually is...
I'd speak to the person who commissioned you to write the 'vision', and ask them what exactly they are trying to achieve and what their expectations are.

A: Here is a nice article on the Vision. Note that it doesn't have to be a heavyweight document (spend as little time as possible but as much as required). For more formal templates, RUP has some for the Vision artifact.

A: Karl Wiegers' book, Software Requirements, has an excellent template. I've used in for several projects.  It seems a bit formulaic at first, but over the subsequent days and months, really helps a team keep focus.
http://www.amazon.com/exec/obidos/ASIN/0735618798/processimpact
http://www.processimpact.com/books.shtml

A: The Business Motivation Model is a great source. They define what a business vision is, relate this concept to other relevant concepts in the organisation, and give good examples.
If you are interested in how business requirements are refined into user requirements and how, eventually, they determine what a software system does, you may want to have a look at the OPEN/Metis white paper.

A: First i warn you : Do not be a template  zombie...
Secondly to give you just an idea OpenUP  has a nice -non commercial Vision Template...
Check my answer how you can get it : RUP (Rational Unified Process)


text:
Q: No vertical scrollbar in react-tabulator, even the height is set to fixed value I'm using tabulator in a plain HTML/Javascript website with thousands of rows. The virtual DOM ist great and as I have set the height of the table, I have the vertical scrollbar inside the table.
Now I want to redesign the website using React. From the documentation I've found the React component of tabulator but there is no vertical scrollbar, even when I set the height (as descriped in documentation).
Here is the code of my minimal working example (see it on Codesandbox):
import React from "react";
import { render } from "react-dom";

import "react-tabulator/lib/styles.css"; // default theme
import "react-tabulator/css/bootstrap/tabulator_bootstrap.min.css"; // use Theme(s)
import { ReactTabulator } from "react-tabulator";

const columns = [{ title: "Name", field: "name" }];
const data = ["A", "B", "C", "D", "E", "F", "G"].map((e) => {
  return { name: e };
});
const options = {
  height: 150
};

const BasicExample = () => {
  return (
    <div>
      <ReactTabulator columns={columns} data={data} options={options} />
    </div>
  );
};

render(<BasicExample />, document.getElementById("root"));

I've tried to set the height of parent div element or using style attribute. I've also changed  data or options to redraw the table -> but no vertical scrollbar :-/
Any ideas?


text:
Q: How to Make A Chevron Arrow Using CSS? Ok, so everyone knows you can make a triangle using this:
#triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
}

And that produces a solid, filled in triangle. But how would you make a hollow-type arrow-like triangle, like this?

A: This can be solved much easier than the other suggestions.
Simply draw a square and apply a border property to just 2 joining sides.
Then rotate the square according to the direction you want the arrow to point, for exaple: transform: rotate(<your degree here>)

.triangle {
    border-right: 10px solid;
    border-bottom: 10px solid;
    height: 30px;
    width: 30px;
    transform: rotate(-45deg);
}

A: An other approach using borders and no CSS3 properties :

div, div:after{
    border-width: 80px 0 80px 80px;
    border-color: transparent transparent transparent #000;
    border-style:solid;
    position:relative;
}
div:after{
    content:'';
    position:absolute;
    left:-115px; top:-80px;
    border-left-color:#fff;
}

A: Responsive Chevrons / arrows
they resize automatically with your text and are colored the same color. Plug and play :)
jsBin demo playground

body{
  font-size: 25px; /* Change font and  see the magic! */
  color: #f07;     /* Change color and see the magic! */
}

/* RESPONSIVE ARROWS */
[class^=arr-]{
  border:       solid currentColor;
  border-width: 0 .2em .2em 0;
  display:      inline-block;
  padding:      .20em;
}
.arr-right {transform:rotate(-45deg);}
.arr-left  {transform:rotate(135deg);}
.arr-up    {transform:rotate(-135deg);}
.arr-down  {transform:rotate(45deg);}
This is  .arr-right

This is  .arr-left

This is  .arr-up

This is  .arr-down

A: > itself is very wonderful arrow! Just prepend a div with it and style it.

div{
  font-size:50px;
}
div::before{
  content:">";
  font: 50px 'Consolas';
  font-weight:900;
}

Hatz!

A: Left Right Arrow with hover effect using Roko C. Buljan box-shadow trick

.arr {
  display: inline-block;
  padding: 1.2em;
  box-shadow: 8px 8px 0 2px #777 inset;
}
.arr.left {
  transform: rotate(-45deg);
}
.arr.right {
  transform: rotate(135deg);
}
.arr:hover {
  box-shadow: 8px 8px 0 2px #000 inset
}

A: Here's a different approach:
1) Use the multiplication character: × ×
2) Hide half of it with overflow:hidden
3) Then add a triangle as a pseudo element for the tip.
The advantage here is that no transforms are necessary. (It will work in IE8+)
FIDDLE

.arrow {
  position: relative;
}
.arrow:before {
  content: '×';
  display: inline-block;
  position: absolute;
  font-size: 240px;
  font-weight: bold;
  font-family: verdana;
  width: 103px;
  height: 151px;
  overflow: hidden;
  line-height: 117px;
}
.arrow:after {
  content: '';
  display: inline-block;
  position: absolute;
  left: 101px;
  top: 51px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 25px 0 25px 24px;
  border-color: transparent transparent transparent black;
}

A: Just use before and after Pseudo-elements - CSS

*{box-sizing: border-box; padding: 0; margin: 0}
:root{background: white; transition: background .3s ease-in-out}
:root:hover{background: red }
div{
  margin: 20px auto;
  width: 150px;
  height: 150px;
  position:relative
}

div:before, div:after{
  content: '';
  position: absolute;
  width: 75px;
  height: 20px;
  background: black;
  left: 40px
}

div:before{
  top: 45px;
  transform: rotateZ(45deg)
}

div:after{
  bottom: 45px;
  transform: rotateZ(-45deg)
}

A: You can use the before or after pseudo-element and apply some CSS to it. There are various ways. You can add both before and after, and rotate and position each of them to form one of the bars. An easier solution is adding two borders to just the before element and rotate it using transform: rotate.
Scroll down for a different solution that uses an actual element instead of the pseuso elements
In this case, I've added the arrows as bullets in a list and used em sizes to make them size properly with the font of the list.

ul {
    list-style: none;
}

ul.big {
    list-style: none;
    font-size: 300%
}

li::before {
    position: relative;
    /* top: 3pt; Uncomment this to lower the icons as requested in comments*/
    content: "";
    display: inline-block;
    /* By using an em scale, the arrows will size with the font */
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
    margin-right: 0.5em;
}

/* Change color */
li:hover {
  color: red; /* For the text */
}
li:hover::before {
  border-color: red; /* For the arrow (which is a border) */
}

Item1

Item2

Item3

Item4

Item1

Item2

Item3

Item4

Of course you don't need to use before or after, you can apply the same trick to a normal element as well. For the list above it is convenient, because you don't need additional markup. But sometimes you may want (or need) the markup anyway. You can use a div or span for that, and I've even seen people even recycle the i element for 'icons'. So that markup could look like below. Whether using  for this is right is debatable, but you can use span for this as well to be on the safe side.

/* Default icon formatting */
i {
  display: inline-block;
  font-style: normal;
  position: relative;
}

/* Additional formatting for arrow icon */
i.arrow {
    /* top: 2pt; Uncomment this to lower the icons as requested in comments*/
    width: 0.4em;
    height: 0.4em;
    border-right: 0.2em solid black;
    border-top: 0.2em solid black;
    transform: rotate(45deg);
}
And so you can have an  in your text.
This arrow is  used to be deliberately lowered slightly on request.
I removed that for the general public  but you can uncomment the line with 'top'  to restore that effect.

If you seek more inspiration, make sure to check out this awesome library of pure CSS icons by Nicolas Gallagher. :)

A: I needed to change an input to an arrow in my project. Below is final work.

#in_submit {
  background-color: white;
  border-left: #B4C8E9;
  border-top: #B4C8E9;
  border-right: 3px solid black;
  border-bottom: 3px solid black;
  width: 15px;
  height: 15px;
  transform: rotate(-45deg);
  margin-top: 4px;
  margin-left: 4px;
  position: absolute;
  cursor: pointer;
}
<input id="in_submit" type="button" class="convert_btn">

Here Fiddle

A:

.arrow {
  display : inline-block;
  font-size: 10px; /* adjust size */
  line-height: 1em; /* adjust vertical positioning */
  border: 3px solid #000000;
  border-left: transparent;
  border-bottom: transparent;
  width: 1em; /* use font-size to change overall size */
  height: 1em; /* use font-size to change overall size */
}

.arrow:before {
  content: "\00a0"; /* needed to hook line-height to "something" */
}

.arrow.left {
  margin-left: 0.5em;
  -webkit-transform: rotate(225deg);
  -moz-transform: rotate(225deg);
  -o-transform: rotate(225deg);
  -ms-transform: rotate(225deg);
  transform: rotate(225deg);
}

.arrow.right {
  margin-right: 0.5em;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.arrow.top {
  line-height: 0.5em; /* use this to adjust vertical positioning */
  margin-left: 0.5em;
  margin-right: 0.5em;
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

.arrow.bottom {
  line-height: 2em;
  /* use this to adjust vertical positioning */
  margin-left: 0.5em;
  margin-right: 0.5em;
  -webkit-transform: rotate(135deg);
  -moz-transform: rotate(135deg);
  -o-transform: rotate(135deg);
  -ms-transform: rotate(135deg);
  transform: rotate(135deg);
}

  here are some arrows

 space

 space

 space

 space with proper spacing?

Similar to Roko C, but a little more control over size and placement.


text:
Q: How to insert bulk data with same name field in php mysql I had tried to insert bulk data with same name field contains multiple rows. But only single row is inserted.
How to insert bulk data as different values to insert into the database.
INSERT INTO table_name (username, luck_number, test, tester) VALUES (('$username', '$luck_number', '$test', '$tester').

    1
    <input type="hidden" name="username" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number" value="" />

        <input type="text" name="big" value="" />

        <input type="text" name="test" value="" />

        <input type="text" name="tester" value="" />

    2
    <input type="hidden" name="username" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number" value="" />

        <input type="text" name="big" value="" />

        <input type="text" name="test" value="" />

        <input type="text" name="tester" value="" />

    3
    <input type="hidden" name="username" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number" value="" />

        <input type="text" name="big" value="" />

        <input type="text" name="test" value="" />

        <input type="text" name="tester" value="" />

A: **Note:**you can worry about the security issue letter. read the answer with the comment.
Store them in array by adding [ ] this in your input field

1
<form action="" method="POST">
<input type="hidden" name="username" value="<?php echo  $login_session; ?>"/>
<input type="text" name="luck_number[]" value=""/>
<input type="text" name="big[]" value=""/>
<input type="text" name="test[]" value=""/>
<input type="text" name="tester[]" value=""/>

2
<input type="hidden" name="username" value="<?php echo  $login_session; ?>"/>
<input type="text" name="luck_number[]" value=""/>
<input type="text" name="big[]" value=""/>
<input type="text" name="test[]" value=""/>
<input type="text" name="tester[]" value=""/>

3
<input type="hidden" name="username" value="<?php echo  $login_session; ?>"/>
<input type="text" name="luck_number[]" value=""/>
<input type="text" name="big[]" value=""/>
<input type="text" name="test[]" value=""/>
<input type="text" name="tester[]" value=""/>

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

</form>

<?php
//connect with your database
for($i=0;$i<count($_POST['luck_number']);$i++)

{
    //set the value for variable
    $luck_number=$_POST['luck_number'][$i];
    $test=$_POST['test'][$i];
    $tester=$_POST['tester'][$i];

    //run your query
    //INSERT INTO table_name (username, luck_number, test, tester) VALUES (('$username', '$luck_number', '$test', '$tester').
}

A: @nisha,In your scenario only single row is inserted because variables are same name so it's overridden, Please try below code, It will give you array of fields so you can easily create for-loop & do multiple insert with your query.
<form method="post" name="userdata">

        1
        <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

            <input type="text" name="luck_number[]" value="" />

            <input type="text" name="big[]" value="" />

            <input type="text" name="test[]" value="" />

            <input type="text" name="tester[]" value="" />

        2
        <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

            <input type="text" name="luck_number[]" value="" />

            <input type="text" name="big[]" value="" />

            <input type="text" name="test[]" value="" />

            <input type="text" name="tester[]" value="" />

        3
        <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

            <input type="text" name="luck_number[]" value="" />

            <input type="text" name="big[]" value="" />

            <input type="text" name="test[]" value="" />

            <input type="text" name="tester[]" value="" />

    <input type="submit" name="submit">
</form>

A: First of all change all field names by adding [] at the end.
Second step, to parsing all values you may use something like this
for($i=0; $i < $count($_GET['username']); $i++)
{
    $username = $_GET['username'][$i];
    $luck_number= $_GET['luck_number'][$i];
    $big= $_GET['big'][$i];
    $test= $_GET['test'][$i];
    $tester= $_GET['tester'][$i];
    // insert into database
}

A: The reason of inserting single row instead of multiple rows is your input field name. You are using same name in different input field so when the server gets the reply it replace the duplicate name and the last occurrence is outputted.
The thing you have to do is to use array. If you use known number of rows then you can simply use a for loop to insert data.

    1
    <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number[]" value="" />

        <input type="text" name="big[]" value="" />

        <input type="text" name="test[]" value="" />

        <input type="text" name="tester[]" value="" />

    2
    <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number[]" value="" />

        <input type="text" name="big[]" value="" />

        <input type="text" name="test[]" value="" />

        <input type="text" name="tester[]" value="" />

    3
    <input type="hidden" name="username[]" value="<?php echo  $login_session; ?>" />

        <input type="text" name="luck_number[]" value="" />

        <input type="text" name="big[]" value="" />

        <input type="text" name="test[]" value="" />

        <input type="text" name="tester[]" value="" />

<?php
for ($i=0; $i<count($_POST['username']); $i++)
{
    mysql_query("INSERT INTO table_name (`username`, `luck_number`, `test`, `tester`) VALUES (('".$_POST['username'][$i]."', '".$_POST['luck_number'][$i]."', '".$_POST['test'][$i]."', '".$_POST['tester'][$i]."')");
}
?>

Note: Sanitizing variable is always been a good practice and strongly recommended.


text:
Q: How to configure postfix to throw away all email to one domain and relay all other email? I need to set up postfix in a development/test environment to filter e-mails so we don't spam our customers. In our test environments we scrub all our user data so that e-mail addresses are changed to @localhost, although some addresses might get changed to valid e-mail addresses at a later point for testing purposes. We relay all our email through a third party provider for delivery, so what I'd like to do is set up postfix to:

*

*Throw out any e-mail sent to localhost

*Relay all remaining e-mail to our third party provider.

Being relatively new to postfix, what would be the easiest way to set this up?

A: Well I seem to have managed to figure this out with a bit of searching & testing.  Here's what I had to do:

*

*In /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:<relayhost username>:<relayhost password>
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
start_tls = yes

*In /etc/postfix/transport:

localhost discard:
localhost.localdomain discard:
* relay:[smtp.relayhost.com]:587

Relaying apparently also bypasses the alias_maps directive, so for aliases to continue working I had to comment out both alias_maps and alias_database, and replace them with virtual_alias_maps.  The format of the virutal_alias_map is identical to alias_maps, so that was an easy change to make.
With these changes in place just restart postfix and also run "postmap /etc/postfix/transport" to build transport.db.  Now everything addressed to @localhost or @localhost.localdomain is discarded while everything else is relayed through the specified host.


text:
Q: How bridge method works? I am new to java.I still feel I have to understand a lot so if this question seems stupid forgive me.
Now I was going through http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html
Here I found a lot of confusion .
public class Node<T> {

    public T data;

    public Node(T data) {
        this.data = data;
    }

    public void setData(T data) {
        System.out.println("Node.setData");
        this.data = data;
    }
}

public class MyNode extends Node<Integer> {
    public MyNode(Integer data) {
        super(data);
    }

    public void setData(Integer data) {
        System.out.println("MyNode.setData");
        super.setData(data);
    }

    public static void main(String[] args) {
        MyNode mn = new MyNode(5);
        Node n = mn; // A raw type - compiler throws an unchecked warning
        n.setData("Hello"); // Causes a ClassCastException to be thrown.
        Integer x = mn.data;

    }
}

When I ran this code I got below error
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at MyNode.setData(MyNode.java:1)
at MyNode.main(MyNode.java:14)

Below are the confusions
1) Why is it showing line number 1
2) If you read through the blog they say that the type erasure will replace type parameter will replace above code as below
public class Node {

    private Object data;

    public Node(Object data) { this.data = data; }

    public void setData(Object data) {
        System.out.println("Node.setData");
        this.data = data;
    }
}

public class MyNode extends Node {

    public MyNode(Integer data) { super(data); }

    public void setData(Integer data) {
        System.out.println(data);
        super.setData(data);
    }

    public static void main(String[] args) {
        MyNode mn = new MyNode(5);
        Node n = mn;            // A raw type - compiler throws an unchecked warning
        n.setData("Hello");     // Causes a ClassCastException to be thrown.
        //Integer x = mn.data

    }
}

when I run the above code I get no error , code runs fine
from the documentation both r same ? why this different in behavior
now other most important question on oop is when we extend one class and when we call super constructor though super object is not created then what is the use of calling super.  Please explain.

A:
from the documentation both r same ? why this different in behavior

The reason there is different behavior between the two code samples is because when you replaced the generic T with Object, you indirectly caused setData() to no longer override setData() in the super class.  Since the parameter types are different, you are simply overloading it in the second example.  So in the second example you are calling the super class directly which takes Object.  In the first example you are calling the subclass which takes Integer.

when we call super constructor though super object is not created then what is the use of calling super

The super class and the sub-class are the same object (with its code split between two classes).  So the super class constructor is called to initialize any fields defined in the super class.  In your example, if you never called super(data) then this.data would never have been set.

A:
If you read through the blog they say that the type erasure will replace type parameter will replace above code as below

Yes, it is right. And that is when bridge method comes into action. What happens is, with that type erasure, the setData() method in the subclass is no longer an override-equivalent for superclass setData() method. So, the behaviour at compile time does not persist till runtime. To preserve the behaviour, the compiler internally generates a bridge method.
Bridge method is often generated by the compiler, when a type extends or implements a parameterized class or interface and type erasure changes the signature of any inherited method.
And here is how it works. The compiler generates the following method in the subclass:
// Bridge method
public void setData(Object data) {
    setData((Integer) data);
}

Now, this method overrides the setData(Object) method of super class. And as you notice, this method internally invokes the original method only, casting the data to Integer. This is where you get ClassCastException. The data is really of String type, which cannot be cast to Integer.

when I run the above code I get no error , code runs fine

As I said above, after type erasure, the setData() method in subclass doesn't overrides the one in super class method. So, when you invoke the method on Node reference, it will call the Node class method only, whose signature is:
public void setData(Object data) {
    System.out.println("Node.setData");
    this.data = data;
}

And there won't be issue with this, because you are not casting anything. You are storing the String type data to an Object type reference. That is fine.

when we call super constructor though super object is not created then what is the use of calling super.

Well, that should have been a separate question altogether. Anyways, the point is, an object's state comprises of the data members declared in that class, and all it's super classes. A constructor in that particular class, will only initialize the state in that class. To initialize the state of the object in super class, you must chain the super class constructor.
Further Read:

*

*Object Creation Process

A: In the second version MyNode.setData doesn't override Node.setData since it has a different signature. Therefore in your second example no dynamic dispatching happens and Node.setData gets called, which can handle the String just fine.
In the first example MyNode.setData does override Node.setData, so it gets called, but it can't handle Strings, it can only handle Integers so you get the ClassCastException.
So if the blog claims this is exactly what happens internally, it is wrong. What they probably mean: It works like this, if MyNode.setData would still override Node.setData in the second example.


text:
Q: Support ProgressDialog in a Static Context I can do this:
 ((Activity) mContext).setProgressBarIndeterminateVisibility(true);

But not this:
 ((Activity) mContext).setSupportProgressBarIndeterminateVisibility(true);

It says this method is undefined for the type Activity
Can anyone tell me how to properly use the support version of this?

A: For casting the Context object, use your "Activity name"(where you are calling this function) instead of using Activity. Supposing your activity name is MyAcivity, do something like:
((MyActivity) mContext).setSupportProgressBarIndeterminateVisibility(true);


text:
Q: Passing a string between view controllers in I'm trying to pass a string between view controllers. When I pass a string to the text of a UIButton through prepareForSegue it works, but when I try to pass it to a string declared as "id: String!", it remains nil. I think it's cause the variable isn't initialized yet when I call prepareForSegue, but I'm not sure how to resolve it.
Sorry, here's my code:
class signUpViewController: UIViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "toSignUp" {
        if let destinationVC = segue.destinationViewController as? signUpViewController {
            destinationVC.firstNameField.text = self.firstName
            destinationVC.lastNameField.text = self.lastName
            destinationVC.emailField.text = self.email
            destinationVC.facebookID = self.facebookID
        }
    }
}

class signUpViewController: UIViewController {
    @IBOutlet weak var firstNameField: UITextField!
    @IBOutlet weak var lastNameField: UITextField!
    @IBOutlet weak var emailField: UITextField!
    var facebookID: String!
    viewDidLoad() {
        print(facebookID)
    }
}

Still couldn't resolve this issue. I printed firstNameField.text in viewDidLoad and it was also nil, but the text field in the view had the string from the previous view and when I press the submit button and perform my submitForm function, the fields pass the desired strings. I temporarily solved this by storing it in NSUserDefaults, but I'm still curious about this.

A: You were right your variables are not yet initialized, try this:
class signUpViewController: UIViewController {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "toSignUp" {
        if let destinationVC = segue.destinationViewController as? signUpViewController {
            //pass the values to the strings that are initialized with the object
            destinationVC._firstNameField = self.firstName
            destinationVC._lastNameField = self.lastName
            destinationVC._emailField = self.email
            destinationVC.facebookID = self.facebookID
        }
    }
}

class signUpViewController: UIViewController {
    @IBOutlet weak var firstNameField: UITextField!
    @IBOutlet weak var lastNameField: UITextField!
    @IBOutlet weak var emailField: UITextField!
    //Create and initialize strings
    var _sfirstNameField = String()
    var _slastNameField = String()
    var _semailField = String()
    var facebookID = String()
    viewDidLoad() {
        //pass the values from the strings to the now initialized UITextField
        firstNameField.text = _firstNameField
        lastNameField.text = _lastNameField
        emailField.text = _emailField
        print(facebookID)
    }
}


text:
Q: How to compare Years in Linq for Date Fields? I am using the below code to compare the Year of two Dates:
public string GetResultWbyYears()
    {
        using (var context = new DbEntity())
        {
            int yeat = DateTime.Now.Year;
            var holidays = (from rl in context.HolidayMasters
                            where rl.Isactive == true && rl.Isdelete == false //&& rl.HolidayDate.Year == yeat
                            orderby rl.HolidayDate ascending
                            select new HolidayEntity
                            {
                                HolidayDesc = rl.HolidayDesc,
                                HolidayDate = rl.HolidayDate,
                                HolidayId = rl.HolidayId

                            }).ToList().AsEnumerable().Select(x => new HolidayEntity()
            {
                HolidayDesc = x.HolidayDesc,
                HolidayDate = x.HolidayDate,
                Isactive = x.Isactive,
                Isdelete = x.Isdelete,
                HolidayId = x.HolidayId,
                Zones = GetZonesWithSelectedForHolidays(x.HolidayId)
            }).ToList();

            holidays = holidays.Where(n => n.HolidayDate.Year == yeat).ToList();
        }

Not Getting why the above is not working.. Please help me how can i get the result by year.
I have searched on google and found some articles doing the same thing i have done above,but this is not working for me. that's why i have posted the question.

A: You select IEnumerable<HolidayEntity>, then convert it to List, losing Isactive and Isdelete values as they will be default, then select IEnumerable<HolidayEntity> again.
There is actually no need in this.
Your LINQ can look much prettier:
public string GetResultWbyYears()
{
    int year = DateTime.Now.Year;
    using (var context = new DbEntity())
    {
        var result = context.HolidayMasters
            .Where(hm => hm.Isactive && !hm.Isdelete && hm.HolidayDate.Year == year)
            .OrderBy(hm => hm.HolidayDate)
            .ToList();

        foreach (var item in result)
            item.Zones = GetZonesWithSelectedForHolidays(item.HolidayId);
    }
}

or in another way:
public string GetResultWbyYears()
{
    int year = DateTime.Now.Year;
    using (var context = new DbEntity())
    {
        var result = (from hm in dbSet
            where hm.Isactive && !hm.Isdelete && hm.HolidayDate.Year == 2015
            orderby hm.HolidayDate ascending
            select hm).ToList();

        foreach (var item in result)
            item.Zones = GetZonesWithSelectedForHolidays(item.HolidayId);
    }
}

I suppose that your context.HolidayMasters is of type DbSet<HolidayEntity, since it has all properties with the same names. Otherwise, use one Select:
public string GetResultWbyYears()
{
    int year = DateTime.Now.Year;
    using (var context = new DbEntity())
    {
        var result = (from hm in dbSet
            where hm.Isactive && !hm.Isdelete && hm.HolidayDate.Year == 2015
            orderby hm.HolidayDate ascending
            select new HolidayEntity {
                HolidayDesc = x.HolidayDesc,
                HolidayDate = x.HolidayDate,
                Isactive = x.Isactive,
                Isdelete = x.Isdelete,
                HolidayId = x.HolidayId,
                Zones = GetZonesWithSelectedForHolidays(x.HolidayId)
            }).ToList();
    }
}


text:
Q: Python Headless Browser for GAE I'm trying to use Angular.js client-side with webapp2 on Google Appengine.
In order to solve the SEO issues the idea was to use a headless browser to run the javascript server-side and serve the resulting html to the crawlers.
Is there any headless browser for python that runs on google app engine?

A: That's a super meta idea. A web request being fulfilled by a web server using a headless web browser to render a page and return the result. phew.
Take a look at the following answer on headless browsers paying special attention to the Python based ones.
headless browser question: headless internet browser?
Looks like the ones that support Javascript all use WebKit and require PyQt or Pyside.  Meaning that you're not going to be able to run them up on App Engine due to the runtime restrictions that are in place.
I would suggest for SEO purposes you do some sort of user agent detection and emit a super scaled down version of your page using Jinja2 templates or something. You'd probably get better performance that way anyway.

A: This can now be done on App Engine Flex with a custom runtime, so I'm adding this answer since this question is the first thing to popup in google.
I based this custom runtime off of my other GAE flex microservice which uses the pre-built python runtime
Project Structure:
webdrivers/
- geckodriver
app.yaml
Dockerfile
main.py
requirements.txt

app.yaml:
service: my-app-engine-service-name
runtime: custom
env: flex
entrypoint: gunicorn -b :$PORT main:app --timeout 180

Dockerfile:
FROM gcr.io/google-appengine/python
RUN apt-get update
RUN apt-get install -y xvfb
RUN apt-get install -y firefox
LABEL python_version=python
RUN virtualenv --no-download /env -p python
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/
RUN pip install -r requirements.txt
ADD . /app/
CMD exec gunicorn -b :$PORT main:app --timeout 180

requirements.txt:
Flask==0.12.2
gunicorn==19.7.1
selenium==3.13.0
pyvirtualdisplay==0.2.1

main.py
import os
import traceback

from flask import Flask, jsonify, Response
from selenium import webdriver
from pyvirtualdisplay import Display

app = Flask(__name__)

# Add the webdrivers to the path
os.environ['PATH'] += ':'+os.path.dirname(os.path.realpath(__file__))+"/webdrivers"

@app.route('/')
def hello():
    return 'Hello!!'

@app.route('/test/', methods=['GET'])
def go_headless():
    try:
        display = Display(visible=0, size=(1024, 768))
        display.start()
        d = webdriver.Firefox()
        d.get("http://www.python.org")
        page_source = d.page_source.encode("utf-8")
        d.close()
        display.stop()
        return jsonify({'success': True, "result": page_source[:500]})
    except Exception as e:
        print traceback.format_exc()
        return jsonify({'success': False, 'msg': str(e)})

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8080, debug=True)

Download geckodriver from here (linux 64):
https://github.com/mozilla/geckodriver/releases
Other notes:

*

*Be mindful of the versions of geckodriver, firefox & selenium you are using as it can be finnickey, giving this error WebDriverException: Message: Can't load the profile. Possible firefox version mismatch. You must use GeckoDriver instead for Firefox 48+. Profile Dir: /tmp/tmp 48P If you specified a log_file in the FirefoxBinary constructor, check it for details.

*Unless you are using legacy geckodriver/firefox, do not set DesiredCapabilities().FIREFOX["marionette"] = False https://github.com/SeleniumHQ/selenium/issues/5106

*display = Display(visible=0, size=(1024, 768)) is needed to fix this error: How to fix Selenium WebDriverException: The browser appears to have exited before we could connect?
To test locally:
docker build . -t my-docker-image-tag
docker run -p 8080:8080 --name=my-docker-container-name my-docker-image-tag

To deploy to app engine:
gcloud app deploy app.yaml --version dev --project my-app-engine-project-id


text:
Q: Rails - Show matching records How do I execute a Rails query to show all Exams where a match exists in StudentExam? I have 3 tables, Student, Exam and StudentExam. The first two are self descriptive. The StudentExam tables has 3 fields: student_id, exam_id and status. I want to search StudentExam for a specific user ID (say 1) and show all matching Exams for this student.

A: select se.*, e.*
  from studentexam se
  join exam e
    on se.exam_id = e.id
 where se.student_id = 'X'

Replace "e.id" above with whatever field on the EXAM table indicates the exam id associated with the EXAM_ID field of the EXAM table.
Replace 'X' with the student_id of interest.
Change e.* in the select list if you want to select some but not all of the columns from the EXAM table.

A: So you have a join table then, a has_and_belongs_to_many or something? In this case
@user = User.find(1)
@exams = @user.exams

or if that's not the case and the third table is based off a model then the preferred way
@exams = Exam.joins(:student_exams).where("student_exams.student_id = ?" 1)

also
@exams = StudentExam.where(student_id: 1).each.collect { |row| row.exam }

Edit
To collect them both, probably something like
@exams = StudentExam.where(student_id: 1).each.collect { |row| [row, row.exam] }


text:
Q: Powershell parameters and function I use function and parameters, but without result, if I used only code, who start on Invoke, I get result to satisfaction to me.
my code:
function Test-RegistryValue {

param (

 [parameter(position=0, Mandatory=$true)]
 [ValidateNotNullOrEmpty()]$pcs,

 [parameter(position=1, Mandatory=$true)]
 [ValidateNotNullOrEmpty()]$PathTAG

 [parameter(position=2, Mandatory=$true, ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]$PathUNIN

)

{
Invoke-Command -ComputerName $PCs  -ScriptBlock {

If (Get-ItemProperty -Path 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$PathTAG ) {

    Write-host "$env:computername Value TAG exists" -ForegroundColor green

} Else {

    Write-host "$env:computername Value TAG DOES NOT exist"  -ForegroundColor red

}

If (Get-ItemProperty -Path $PathUNIN -ErrorAction SilentlyContinue  ) {

    Write-host "$env:computername Value Uninstall exists" -ForegroundColor green

} Else {

    Write-Host "$env:computername Value uninstal DOES NOT exist"  -ForegroundColor red

}

 }
  }
  }

after entering value, it doesn't get the expected result. Can anyone help?

A: Try this one:
function Test-RegistryValue {

    param (

    [parameter(position=0, Mandatory=$true)]
    [ValidateNotNullOrEmpty()]$pcs,

    [parameter(position=1, Mandatory=$true)]
    [ValidateNotNullOrEmpty()]$PathTAG,

    [parameter(position=2, Mandatory=$true, ValueFromPipelineByPropertyName = $true)]
    [ValidateNotNullOrEmpty()]$PathUNIN

    )

Invoke-Command -ComputerName $PCs  -ScriptBlock {

    param(  $pcs,
            $PathTAG,
            $PathUNIN )

    if (Get-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$PathTAG" ) {

        Write-host "$env:computername Value TAG exists" -ForegroundColor green }

    else {

        Write-host "$env:computername Value TAG DOES NOT exist"  -ForegroundColor red
    }

    if (Get-ItemProperty -Path $PathUNIN -ErrorAction SilentlyContinue  ) {

        Write-host "$env:computername Value Uninstall exists" -ForegroundColor green }

    else {

        Write-Host "$env:computername Value uninstal DOES NOT exist"  -ForegroundColor red

    }

 } -ArgumentList $pcs, $PathTAG, $PathUNIN

 }


text:
Q: Paypal shipment details I am using PayPal Adaptive payments (chained payments).
If I set:
1. CREATE payment
2. In the SetPaymentOptions -> Requires shipping address selection = true
3. When I redirect user for the https://www.sandbox.paypal.com/webscr&cmd=_ap-payment&paykey=[PA KEY] user after authentication is not shown any prompt for shipping address
why?
Accordingly to the
https://www.x.com/developers/paypal/documentation-tools/api/pay-api-operation
when using CREATE I should do: CREATE – Use this option to set up the payment instructions with SetPaymentOptions and then execute the payment at a later time with the ExecutePayment.
But as soon as I try to run ExecutePayment I get the following information:

This payment request must be authorized by the sender

How can I set additional payment options then?

A: Did the sender actually authorize the payment?
The flow should be like:

*

*Call Pay API operation with actionType as CREATE

*If paymentExecStatus=CREATED and ack=SUCCESS, obtain payKey (here, keep detailLevel=ReturnAll in RequestEnvelope field of your Pay API request)

*Redirect user to Paypal https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=YOUR_PAYKEY_ABOVE

*If user approves payment, you will be redirected to your returnURL sent as a part of Pay API request

*Verify approval status using PaymentDetails API operation

*Later you can execute the payment thus setup in step 4 using ExecutePayment API operation. Send the same payKey you obtained in step 2.

You have got error code 550001 since the user approval seems to be not yet done successfully. It may be due to:
The application did not redirect user/sender to Paypal for authorization
OR
The user did not enter correct login details
OR
There were not sufficient funds available
etc.

A: The ExecutePayment call would only be used if you're utilizing delayed chained payments.  Otherwise, the payment still happens as soon as the buyer logs in and approves it, so there is no need for ExecutePayment.  Calling it at that point results in the error you're getting, that the paykey was already used.


text:
Q: Example of a random variable that is not iid What is an example of a random variable that is not i.i.d? The usual ones (coin flips, rolling of a dice) are all i.i.d, so I am trying to understand what is an example of a  random variable that is not i.i.d?

A: A sequence of random variables (we need at least two!) can fail to be iid (independent and identically distributed) in three different ways:

*

*The
random variables are not independent but they are identically distributed,

*The random variables are independent but are not identically distributed,

*The random variables are neither independent nor identically distributed.

For an example of 1., consider the "sampling without replacement" method
described in this answer. Or
consider an experiment in which we have a  bag containing two coins with
different probabilities $p_1$ and $p_2$ of turning up Heads. We choose one of the coins
at random and toss the chosen coin $n$ times. Let $X_i$ be the indicator
function of Heads on the $i$-th toss. Then, the law of total probability tells
us that
$$P\{X_i = 1\} = P\{X_i = 1\mid ~\text{coin #1}\}\times \frac 12
+ P\{X_i = 1\mid ~\text{coin #2}\}\times \frac 12 = \frac{p_1+p_2}{2}.$$
Thus, the $X_i$'s are identically distributed Bernoulli random variables
with parameter $\frac{p_1+p_2}{2}$. However, they are not independent
random variables since
the law of total probability gives us that
$$P\{X_i=1, X_j=1\}=\frac{P\{X_i=1, X_j=1 \mid~\text{#1}\}
+ P\{X_i=1, X_j=1 \mid~\text{#2}\}}{2}
= \frac{p_1^2+p_2^2}{2}$$
which does not equal
$P\{X_i=1\}P\{X_j=1\} = \left(\frac{p_1+p_2}{2}\right)^2$.
For an example of 2., consider a similar experiment in which the
the $i$-th (independent toss) is of a coin that has probability $p_i$
different from $p_1, p_2, \ldots, p_{i-1}$. (Let $p_i = e^{-i}$ if
you need an explicit example). Then the $X_i$ are independent
Bernoulli random variables (by assumption)
but they are not identically distributed
since they all have different parameters.
I will leave the exercise of coming up with an example of 3. to you.

A: A classic example would be a Markov chain.  As a simple example - imagine this process to generate variables.
xi+1 = xi + 1 with 50% chance and xi - 1 with 50% chance
The probability distribution for the value of x at any given iteration of the process is different and dependent on the history of the process - therefore the variable output by the process (or the Markov Chain) are random, but not i.i.d.


text:
Q: Setting ggplot margins automatically to include geom_text Suppose I drew the following plot using the code below:

data = data.frame(x = 1:5, y = 1:5)
ggplot(data, aes(x = x, y = y)) +
  geom_point() +
  geom_text(x = 5, y = 5, label = "aaaaaaaaaaaaaaa", hjust = 0) +
  theme_classic() +
  theme(plot.margin = unit(c(1, 1, 1, 1), "cm")) +
  coord_cartesian(clip = "off")

To keep the "aaaaaaaaaaa" inside the plot, I can manually change the plot margin, replacing the "c(1, 1, 1, 1)" with "c(1, 3, 1, 1)."
But is there a way to set margins automatically so that the "aaaaaaaaa" will be within the plot?
For example, if "aaaaaaaa..." were instead 100 characters long, I'd have to change margins again.  I'm wondering if there is some way to write the code / use a package such that the plot margins will automatically adjust to always include all geom_text objects.

A: This question seems to be answered already, where ggplot2 has added new options for vjust and hjust.  You can simply use "inward" to ensure your text does not get clipped:
data = data.frame(x = 1:5, y = 1:5)
ggplot(data, aes(x = x, y = y)) +
  geom_point() +
  geom_text(x = 5, y = 5, label = "aaaaaaaaaaaaaaa", hjust = 0) +
  theme_classic() +
  theme(plot.margin = unit(c(1, 1, 1, 1), "cm")) +
  coord_cartesian(clip = "off")


text:
Q: Javascript file import works just one time I've got a problem with my website, I use javascript to display a customized videoplayer. I load a couple of videos from a database and show them in a row, the problem is, that the javascript just works for the first video. I know that I would have to change for example the variable names to let the script work multiple times, but is there another way to load the same script for each videoelement?
Here is my code to get a better understanding:
        while ($row = mysqli_fetch_assoc($result))
            {
            $location = "../" . $row['pfad'] . $row['video'];
            $id = $row['id'];
            ?>

<?php echo "$row[titel]"; ?>

                    <video id="video" class="video" src="<?php echo "$location"; ?>"></video>

                            <button id="skip-back" class="skip-back" data-skip="-10"></button>
                            <button id="play-pause"></button>
                            <button id="skip-front" class="skip-front" data-skip="10"></button>
                             /
                            <button id="sound" class="highSound"></button>
                            <input type="range" name="volume" class="volume-slider" id="volume-slider" min="0" max="1" value="1" step="0.05">
                            <button id="fullscreen" class="fullscreen"></button>

            <a href="index.php?section=editVideo&login=success&id=<?php echo "$id"; ?>" class="btn btn-warning">Video bearbeiten

            <a href="index.php?section=deleteVideo&login=success&id=<?php echo "$id"; ?>" class="btn btn-danger">Video löschen

            <?php
            }

A: I think your best option here is to change how your JavaScript addresses the video player components-- one script can't be loaded multiple times without shenanigans, and doing so can cause conflicts and errors.
I don't know how you currently do it, but as a broad overview, what you can do in your JavaScript is initialize all the players with a single script that creates multiple instances of your video player code. Something like this:
// assuming you have jQuery, since that makes this example more concise
class VideoPlayer {
  constructor(container) {
     // find all the subcomponents
     this.video = $(container).find('video').first()
     this.processBar = $(container).find('div.process-bar').first()
     this.buttons = $(container).find('div.buttons').first()

     // ... etc, do that for all things here, bind click handlers, etc
  }
}

// wait for the page to load so all video-container elements are on the page
// so find them, and create a new VideoPlayer for each.
window.addEventListener('load', () => {
  const allVideos = []
  $('div.video-container').each(function () {
    allVideos.push(new VideoPlayer(this))
  })
})

This code searches for all divs with the video-container class, then creates a new VideoPlayer with that container element. The VideoPlayer then searches within itself to find and use its child elements.
Then you can put this script tag into your document's head instead of embedding it into the video player component:


text:
Q: Add image to background of plot with Seaborn & Matplotlib I am trying to create a Control Variability Grid Analysis in Python. This analysis requires plotting min and max blood glucose values (in this case, my own) per day on a scatterplot, with a background image that helps classify the overall glucose control. See here.
I have found other threads that address this question, but I cannot seem to get it to work for my application. I need the axes to be a specific range, and I think that is interfering with the image. The code I have tried so far, based on this page and this page, is as follows:
img = plt.imread('CVGA.png')
fig, ax = plt.subplots(figsize = (12,6))
sns.scatterplot(data=min_max_day,x=min_max_day['Glucose Value (mg/dL)']['amin'],
            y=min_max_day['Glucose Value (mg/dL)']['amax'], zorder=1)
plt.xlim(110,40)
plt.ylim(110,400)
ax.imshow(img);

And the output looks like this:

With the line "ax.imshow(img)" removed, the output looks like this:

Additional details:

*

*the image I'm using is 1200x1200:

*

*Maybe there is a problem with the fact that the scale I'm using isn't a perfect square? Not sure if that makes sense, but clearly 110 to 400 on the Y axis and 100 to 40 on the X axis would not make a perfect square? I am unsure what to do about that.

Any advice or help would be greatly appreciated. Thanks a lot.

A: *

*Use the extent parameter as shown in Change values on matplotlib imshow() graph axis, but you must also use aspect='auto' and set figsize = (12, 12) (or (6, 6), etc.).

*

*See all parameters at matplotlib.pyplot.imshow

*sns.scatterplot from the OP is commented out because no data was provided.

*Tested in python 3.8, matplotlib 3.4.2, and seaborn 0.11.1
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np  # sample data

img = plt.imread('CVGA.png')
fig, ax = plt.subplots(figsize=(6, 6))
# sns.scatterplot(data=min_max_day, x=min_max_day['Glucose Value (mg/dL)']['amin'], y=min_max_day['Glucose Value (mg/dL)']['amax'], zorder=1)

sns.scatterplot(x=np.linspace(110, 41, 10), y=np.linspace(110, 401, 10), ax=ax)
plt.xlim(110, 40)
plt.ylim(110, 400)

ax.imshow(img, extent=[110, 40, 110, 400], aspect='auto')


text:
Q: STM32H7 Threadx USB CDC fails after a while - semaphore not returned, device sends CANCEL I have a nucleo h743 that bridges between several G4 boards and a PC. connection between the G4  and the H7 is CAN-FD. connection to the PC is USB-CDC.
after a while the connection fails - the sw hangs waiting for the semaphore in _ux_dcd_stm32_transfer_request(...)
I tried to relax the sending - sending a message once in 4 millisec, but to no avail.
when loading the CAN interface, the disconnection is much faster.
pcap recording of th failurestrong text