text:
Q: Actionbarsherlock - Title not displaying I've seen a few posts about getting the title to show in actionbarsherlock along with the icon. The icon is displaying fine, but the title does not show beside it.
Currently it shows the home icon with all the tabs beside it. What I am looking for is the home icon, then title, and below all this have the tabs show. Here is my code.
ACTIVITY
public class MainActivity extends SherlockFragmentActivity {

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mJsonHandler = JsonHandler.getInstance(this);
    }

 @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();

        ActionBar ab = getSupportActionBar();

        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowTitleEnabled(true);
        ab.setDisplayShowHomeEnabled(true);
        ab.setDisplayUseLogoEnabled(true);

        ab.setTitle("TITLE TO SHOW");

        inflater.inflate(R.menu.activity_main, menu);

        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        switch(item.getItemId()) {
        case R.id.menu_item0:

            break;
        case R.id.menu_item1:

            break;
        case R.id.menu_item2:

            break;
        case R.id.menu_item3:

            break;
        case R.id.menu_item4:

            break;
        case R.id.menu_item5:

            break;
        default:
            this.onBackPressed();
            break;
        }
        return false;
    }
}

activity_main.xml (for menu)
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
    android:id="@+id/menu_item0"
    android:orderInCategory="1"
    android:showAsAction="always"
    android:title="@string/menu_item0"/>

<item
    android:id="@+id/menu_item1"
    android:orderInCategory="2"
    android:showAsAction="always"
    android:title="@string/menu_item1"/>

<item
    android:id="@+id/menu_item2"
    android:orderInCategory="3"
    android:showAsAction="always"
    android:title="@string/menu_item2"/>

<item
    android:id="@+id/menu_item3"
    android:orderInCategory="4"
    android:showAsAction="always"
    android:title="@string/menu_item3"/>

<item
    android:id="@+id/menu_item4"
    android:orderInCategory="5"
    android:showAsAction="always"
    android:title="@string/menu_item4"/>

 <item
    android:id="@+id/menu_item5"
    android:orderInCategory="6"
    android:showAsAction="always"
    android:title="@string/menu_item5"/>

Manifest

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Sherlock.Theme" >
    <activity
        android:name=".activities.MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  </application>

</manifest>

Sherlock Theme
<style name="Sherlock.Theme" parent="Theme.Sherlock.Light.DarkActionBar">
</style>

A: You're setting too many menu items to always show in the ActionBar. You should only set the most important ones to do so. You should read through the Android Design Guidelines on the appropriate way to set up the ActionBar
Android Design Guidelines - Action Bar organization
Also, you should set up the ActionBar in onCreate and leave onCreateOptionsMenu for only inflating your menu(s). This is just a general tip and goes towards better, more professional code formatting.


text:
Q: Difficulty with OpenGraph for Facebook embedded video I am having some difficulty implementing a solution that I found via my research here (the actual accepted answer is not helpful and has been downvoted to Bolivian).
Problem:  Facebook doesn't seem to recognize the OpenGraph meta tags that I have added to my Header.
What I know (or think I know): It is my understanding that by adding some appropriate opengraph meta tags, the content, such as YouTube video, should appear in the body of the "post" on Facebook.
What I have tried so far:  Referring to the solution linked above, I have tried to implement this method.

In my examples, I'm embedding this video
  https://www.youtube.com/v/BQBjVr1iHH4 in the following page
  https://www.keithandthegirl.com/vip/bonus/episode/9/40/this-is-40 I
  would like Facebook to show the YouTube video whenever anyone shares
  my page on Facebook.
Option 1: setting the og:video to https://www.youtube.com/v/YOUTUBECODE
The meta tag will look like
<meta property='og:video' content='https://www.youtube.com/v/BQBjVr1iHH4' />

Further, I have attempted to disable plugins which may conflict with this -- any plugins which appear to add OG meta tags.
On the code side: I have hard-coded the following meta tags in the Header (this will eventually become a PHP function or something, but not until/unless I can make it work on a single post):
    <meta property='og:image' content='http://agnarchy.com/wp-content/uploads/2014/11/2014-11-01-22.02.37.jpg' />
    <meta property='og:video' content='https://www.youtube.com/v/dt6pPdz5eqg' />
    <meta property="og:video:height" content="854" />
    <meta property="og:video:width" content="510" />
    <meta property="og:type" content="video">

Observed behavior:
All I see is the post's featured image. When I schedule or submit this link to my facebook page, Facebook does not recognize the OpenGraph tags and does not render the embedded video as part of the content of this Facebook post:

Desired behavior:
This is at odds with the suggested method, which if I use the URL provided in that answer, I can see the embedded video player:

redpajama_set_name: RedPajamaStackExchange


text:
Q: Let X be topological space and let $Y\subset X$ have subspace topology if A is closed in Y and Y is Closed in X then A is closed in X I'm trying to prove this problem
First
Suppose A is closed in Y the A Contain all limit point of Y.
But I'm stuck since I don't know what condition that gaurantee A will still contain all limit point when in X
Then I use different method
Suppose A is closed I Y then complement of A is open in Y
Now consider X since X is topological space,then it's open
and consider X-A since X is open and
A is closed X-A is open
therefore the complement of A in X is open then A is closed in X
Is the second method is valid proof ?

A: In order to prove this limit points can be left out.
Just realize that $A\subseteq Y$ is closed in $Y$ iff there is a set $F$ closed in original $X$ such that $A=Y\cap F$.
(If this is new for you then realize that $Y-A$ is open in $Y$ which means exactly that $Y-A=Y\cap U$ for a set $U$ that is open in $X$. Now note that $A=Y\cap F$ for the closed set $F=U^{\complement}$).
Now if $Y$ is also closed in the original $X$ then $Y\cap F$ can be recognized as a binary intersection of closed sets. The collection of closed sets is by definition closed under the formation of finite intersections, so we conclude immediately that $A=Y\cap F$ is a closed set in $X$.

A: What you did is not correct, because you assume the very thing that you want to prove: that $A$ is closed in $X$.
Consider the set $X\setminus A$. You want to prove that it is an open subset of $X$. But $$X\setminus A=(X\setminus Y)\cup(Y\setminus A).\tag1$$Since $Y$ is closed in $X$, $X\setminus Y$ is open in $X$. And, since $A$ is closed in $Y$, $Y\setminus A$ is open in $A$. And since $Y\setminus A$ is open in $Y$ and $Y$ is open in $X$, $Y\setminus A$ is open in $X$. So, it follows from $(1)$ that $X\setminus A$ is open in $X$.


text:
Q: Prevent binary data in text area? in admin panel user post new news and in content of news user can copy image from word and this image will be store directly into database as binary data. so database size will increase too much.
I wanna prevent user from input binary data , I mean I wanna let users just input string and nothing more.
how to implement that ?
( I use ASP.NET MVC 2 and used [AllowHtml] attribute for content property of news entity)
TNX in forward :)


text:
Q: Projectile Path Farther Away From Earth I was hoping to get help with both a specific example and a general idea of how to do the problem.
Here's my current understanding, which may or may not be correct:
When objects are thrown from a moving object, they have the speed of the object they are moving at, as well as the speed they were thrown with, which can be combined with vectors. Assuming no other forces besides gravity act upon the object, this means that an object thrown straight up will land exactly where it was thrown from.
Here's the parts I don't understand:
This idea seems to break down at higher altitudes. At a sufficiently high altitude, well into space, an object's orbital circumference would be much greater than the circumference than Earth. Going by the logic that the object was previously on Earth, and therefore had a velocity that traveled one times the circumference of the Earth per day (let's use 1670 km/h, since that's what it is at the equator), it would then stand to reason that when this object was thrown directly up, it would be still traveling 1670 km/h (if we're ignoring upwards and downwards motion). Therefore, if we say it comes down to Earth one day after it was thrown, it would have failed to complete one full orbit around the Earth (with it being at a larger circle (the orbit) (and with that, a larger circumference) yet traveling at 1670 km/h.), yet the Earth would have completed one full rotation. With the object not completing a full revolution around the Earth, and the Earth completed a full revolution around it's axis, it seems like the object would land in a different place than it was thrown.
For example, let's say that an object was thrown up, and for simplicity's sake, teleports to an orbit exactly twice the circumference of Earth and will come directly down after one day. Moving at the speed of Earth's rotation, it should complete half its orbit, since the orbit has twice the circumference of Earth. In the same time, the Earth completes a full rotation. It seems like when the object comes down, it will come down at the exact opposite side of the world from where it's launched.
This only gets more confusing when we add the projectile's variable height in: objects can't teleport as in the above example, so if an object traveled normally to an orbit twice the circumference of Earth and immediately started falling after it reached that altitude (all governed by the formula $ h(t) = -1/2 g * t + vt + h$, assuming no other propulsion and that h = 0), constantly changing heights would mean anyone trying to calculate the path that the object was taking relative to Earth would have to calculate circumferences for every height between the upper and lower bounds, as well as how much the object traveled those circumferences, which seems like quite the task.
The general question was for a way to solve the problem above: how can one figure out where a projectile will land given the upwards velocity launched from Earth, when the projectile will fly substantial distances from the Earth? Drag and other affecting forces besides gravity need not be accounted for.
The more specific question is this: a projectile is being fired at a variable direction at a speed of eight miles per second. The projectile needs to land five miles from the point of launch (with precision to +- one mile), and come down at least 48 hours (but preferably not more than a month) later. What angle should the projectile be fired at? Is 8 miles a second fast enough to leave the projectile suspended for 48 hours, and if not, what speed would be applicable? (Note: I was informed that an object fired at 8 miles a second will leave Earth's orbit. What speed, then, would be applicable to accomplish this objective?) Like above, drag and any force besides gravity does not need be be added.

A: Even supposing a constant downwards gravitation acceleration if you do the math of your problem you get a four degree polynomial (parabola-circumference intersection): Suppose you are on a latitude with the radius $r$ to the rotation axis, and $\omega$ earth angular speed. You throw the corp vertically with speed $v$. We consider an inertial system with center on earth axis and same latitude, y axis in the vertical direction the corp is thrown and x toward the tangent speed $r\omega$. The corp motion law in this system is $y(t)=-\frac 12gt^2+vt+r$, $ x(t)=\omega rt$ so if you want to know where it lands you have to impose that it is on the circumference: $(-\frac 12gt^2+vt+r)^2+ \omega^2r^2=r^2$, which is a 4 grade equation. Suppose $\lambda_0$ to be the root we are interested in, then you can find the landing position relative to the starting one in radiant $\Delta\theta=\tan^{-1}\frac{y(\lambda_0)}{x(\lambda_0)}-\omega\lambda_0$.
If you consider very long distance you should even consider the change in the direction of the gravitational force, so even more complex (supposing this can be done without escaping earth gravitational field).


text:
Q: EXC_BAD_ACCESS bug I am studying the CUDD package but crashed into the EXC_BAD_ACCESS bug in the function Cudd_DumpDot (the first line below). What happened?
retval = fprintf(fp,"digraph \"DD\" {\n");
if (retval == EOF) return(0);
retval = fprintf(fp,"size = \"7.5,10\"\ncenter = true;\nedge [dir = none];\n");
if (retval == EOF) return(0);


text:
Q: Grouping , sorting and sum based on XML attribute I have XML like below and want ouput like .
How to write the powershell script to get desired output
<onds>
  <ond oc="AF" o="DXB" dc="GB"  ds="London Heathrow" dfs="london-heathrow" tp="0" />
  <ond oc="AE" o="DXB" dc="KW"  ds="Kuwait" dfs="kuwait" tp="619730" />
  <ond oc="AE" o="DXB" dc="PK"  ds="Karachi" dfs="karachi" tp="1" />
  <ond oc="AE" o="DXB" dc="IN"  ds="Mumbai" dfs="mumbai" tp="465861" />
  <ond oc="AE" o="DXB" dc="LB"  ds="Beirut" dfs="beirut" tp="366572" />
  <ond oc="AU" o="ADL" dc="GB"  ds="London Heathrow" dfs="london-heathrow" tp="0" />
  <ond oc="AU" o="ADL" dc="GB"  ds="Manchester" dfs="manchester" tp="2" />
  <ond oc="AU" o="ADL" dc="IT"  ds="Rome" dfs="rome" tp="11978" />
  <ond oc="AU" o="ADL" dc="FR"  ds="Paris" dfs="paris" tp="10878" />
  <ond oc="AU" o="ADL" dc="GB"  ds="London Gatwick" dfs="london-gatwick" tp="1" />
  <ond oc="AU" o="ADL" dc="IE"  ds="Dublin" dfs="dublin" tp="8544" />
  <ond oc="AU" o="ADL" dc="NL"  ds="Amsterdam " dfs="amsterdam" tp="839000" />
  <ond oc="AU" o="ADL" dc="GR"  ds="Athens" dfs="athens" tp="7807" />
  <ond oc="AU" o="ADL" dc="GB"  ds="Glasgow" dfs="glasgow" tp="6998" />
  <ond oc="AU" o="ADL" dc="AE"  ds="Dubai" dfs="dubai" tp="6986" />
  <ond oc="AU" o="ADL" dc="ES"  ds="Barcelona" dfs="barcelona" tp="6231" />
  <ond oc="AU" o="ADL" dc="GB"  ds="Birmingham" dfs="birmingham" tp="6104" />
  <ond oc="AU" o="ADL" dc="DE"  ds="Frankfurt" dfs="frankfurt" tp="5122" />
  <ond oc="AU" o="ADL" dc="IT"  ds="Milan" dfs="milan" tp="4952" />
  <ond oc="AU" o="ADL" dc="IT"  ds="Venice" dfs="venice" tp="4357" />
  <ond oc="AU" o="ADL" dc="DK"  ds="Copenhagen" dfs="copenhagen" tp="4323" />
</onds>

Output should be like Group by "dc" attribute with-in same "oc" i.e AU attribute and then sum the tp based on "dc" parameter and sort in descending in Powershell
In case of oc="AU".

*

*All data should be group based on "dc" and added the tp value and then sort the whole data based on tp value

*like we have 4 dc="GB" inside the all oc="AU" , need single record with sum of based on tp value then sorting.

A: You have to know how to convert that XML into something usable for your use case.
Here is a good post on converting XML to PSOject so you can work with it.

Convert XML to PSObject
I'm having trouble figuring out the dot notation or XPath query to
extract the  attributes/elements and convert $b back to the original
PSObject.
Convert XML to PSObject

Once you get past all the conversion, it's just using the normal grouping features built into PowerShell.
See this write up

Use the PowerShell Group-Object Cmdlet to Display Data
One of the things about learning to use Windows PowerShell is that
Windows PowerShell can slice-and-dice data so easily. It becomes a
quick data analysis tool that allows network administrators, analysts,
and others to parse data to quickly discover and remediate issues. It
can also be used to audit baseline information, or even to spelunk
through reams of statistical data.
One cmdlet that allows this analysis is the Group-Object cmdlet. In
its most basic form, the Group-Object cmdlet accepts a property from
objects in a pipeline, and it gathers up groups that match that
property and displays the results. For example, to check on the status
of services on a system, pipe the results from the Get-Service cmdlet
to the Group-Object cmdlet and use the Status property. The command is
shown here.
Get-Service | Group-Object -Property status
https://blogs.technet.microsoft.com/heyscriptingguy/2012/01/11/use-the-powershell-group-object-cmdlet-to-display-data


text:
Q: How to get NMEA from the GPS Device? im trying to read the current position of GPS Device...using N95 from Nokia.
I read tht i will need my device to return the NMEA lines to the serialport and then i will parse/split it to get things I want but all along I dont know what to write to the serialport to make device return the NMEA ?
Like There are other commands of AT for messaging etc...Is there any specific command to send to serialport to get NMEA ???

A: I found this site site which seems to guide you through everything you need to do.

A: I am not sure how it works in the N95, but in my HTC phone you cannot send commands to the GPS device to have it behave in a certain manner. Once I am connected to the serial port that the GPS device uses I can read a stream of data coming from it, which happens to be NMEA data. There is no way that I have found to send commands to the device to tell it how to behave.

A: I haven't used that specific GPS device before, but for mine, I just have to open the port and I start receiving the NMEA data immediately.

A: I have an N82, and as far as I know it doesn't speak NMEA directly. I use a script from this page - specifically one the titled "# Turn your S60 phone with an internal GPS (eg your N95) into a Bluetooth GPS" - to get NMEA strings.

A: Ahh oki so I need to run some script.Oki I think i should buy a specific GPS Device for it.
Which device will do my job in cheapest manner ?

A: I've never worked specifically with the N95, but most GPS devices will just start spitting out NMEA as soon as they're powered up, regardless of whether or not they have a lock. I don't know how the N95 is designed, but I'll bet it probably wasn't designed to give you access to the raw NMEA data from the GPS. You'll probably need some pretty fancy trickery to get it to do that.
If you don't need to use the N95, you might find it easier to just get a GPS module and use that instead. I've always purchased mine from SparkFun. They have some good evaluation boards boards and tutorials to help you get started.

A: A great way of doing this in Java ME is to use JSR 179: the Location API.  Your app needs to create an implementation of LocationListener, then set it on the default LocationProvider.  When your listener's locationUpdated method gets called, call:
location.getExtraInfo("application/X-jsr179-location-nmea");

This will provide access to the NMEA sentences.
You can send this over a serial port by using the Java ME commports mechanism (use:
System.getProperty("microedition.commports");

as described here).
Hope this helps,
funkybro


text: Q: How to push selected users in search div box I have some users list and one search input box. When I choose users, the selected users have to pushed into search input box like in gmail, we enter To mail id, once we entered the mail-id will show within same input box in left. How can I implement that in javascript.


text:
Q: Why does this c++ boolean return false I was trying to write a loop that loops from back to forth in a string. But the loop doesn't work and it turns out one of the comparison does not work correctly.
int main(int argc, char **argv) {
    string a = "12";
    int i = 0;
    int index = a.size() - i - 1;

    std::cout << (a.size() - i - 1 > -1) << std::endl;
    std::cout << (index > -1) << std::endl;

    return 0;
}

The first print was 0 and the second print was 1. Why does the first print printed a false?


text:
Q: Can't use of Font class in my App I want use of Font class in my Android app,I add JRE system Library in my project(every thing is ok),but when I run,in log cat show this Error:

java.lang.NoClassDefFoundError: java.awt.Font

A: You cannot use AWT in Android.
The correct way to use a custom font is to instantiate a Typeface.
For example:
Typeface customTypeface = Typeface.createFromFile(assets, "fonts/CustomFont.ttf");
myTextView.setTypeface(customTypeface);

Typeface.createFromFile(AssetManager, String)
You can also use a third party library like Calligraphy to do the dirty work for you. This even allows you to set the typeface from your xml layouts and styles


text:
Q: React-Native Spotify SDK iOS: Dismiss auth window I have been developing a react-native application using the following module:
https://github.com/viestat/react-native-spotify
Currently, the application opens the authentication window to login to spotify. I do get a return of success but i'm confused as to how i now get rid of the window that popped up to login with. I understand it should redirect back to my application but it just stays on the same window with logout/ my account buttons.
Any ideas how i would dismiss this window on a returned success message?
SpotifyAuth.setClientID('*****','*****', ['streaming', 'playlist-read-private'], (error)=>{
          if(error){
            console.log(error);
          } else {
            console.log('success');
          }
        });

A: If you take a look at the code, the login screen (SpotifyLoginViewController to be exact), dismisses the screen at this line of code. According to the logic here, if the redirectURL that you've passed to the setClientID API doesn't match to the redirect URI that you defined in your Spotify developer account (see their authorization guide) - the screen will not be dismissed.
I suggest the you put a break-point in this function before it's checking the url scheme and see what's going on there. Either your account is not configured properly, or a wrong URL (or a URL which is not at the expected format by this package) is being sent to this API.

A: It seems that your Redirect URL is configured incorrectly.

*

*Make sure your URI is entered in the Spotify My Applications Dashboard.

*Make sure your URI conforms to the following:

*

*All characters in the URI should be lowercase.

*Your URI's prefix (the part before the first colon) must be unique to your application. It cannot be a general prefix like http.
Your URI's prefix must only be used by your application for authenticating Spotify. If you already have a URL scheme handled by your application for other uses, you shouldn't recycle it.

*It's a good convention to have the name of your application in there.

*You should also have a path component to your URI (the part after the first set of forward slashes, something like your-app://callback)


text:
Q: Apex Class Creation to use in trigger How can I make a separate Apex class and method using this trigger?
Trigger contactFromAccounts on Account (after update) {
  Set<Id> accountIds = new Set<Id>();
    for (account a : trigger.new) {
        account old = trigger.oldMap.get(a.Id);
        if (a.billingstreet != old.billingstreet|| a.billingcity !=old.billingcity || a.billingstate !=old.billingstate || a.billingcountry != old.billingcountry) {
            accountIds.add(a.Id);
        }
    }
    if (accountIds.size() > 0) {
        contact[] updates = [select Id, accountId from contact where accountId in :accountIds];
        for (contact c : updates) {
            account a = trigger.newmap.get(c.accountId);
            c.mailingStreet = a.billingStreet;
            c.mailingcity = a.billingcity;
            c.mailingstate = a.billingstate;
            c.mailingpostalcode = a.billingpostalcode;
            c.mailingcountry = a.billingcountry;
                    }
        update updates;
    }
}

A: Technically, you can drop what you have into a separate class method and it will work as written, since Trigger context variables are accessible from any context (they will just be null outside a trigger):
public class AccountTriggerHandler
{
    public static void updateContactAddresses()
    {
        Set<Id> accountIds = new Set<Id>();
            for (account a : trigger.new) {
                account old = trigger.oldMap.get(a.Id);
                if (a.billingstreet != old.billingstreet|| a.billingcity !=old.billingcity || a.billingstate !=old.billingstate || a.billingcountry != old.billingcountry) {
                    accountIds.add(a.Id);
                }
            }
            if (accountIds.size() > 0) {
                contact[] updates = [select Id, accountId from contact where accountId in :accountIds];
                for (contact c : updates) {
                    account a = trigger.newmap.get(c.accountId);
                    c.mailingStreet = a.billingStreet;
                    c.mailingcity = a.billingcity;
                    c.mailingstate = a.billingstate;
                    c.mailingpostalcode = a.billingpostalcode;
                    c.mailingcountry = a.billingcountry;
                    }
        update updates;
    }
}

Trigger contactFromAccounts on Account (after update) {
    AccountTriggerHandler.updateContactAddresses();
}

However, it makes it much easier to test your methods if they do not rely on the trigger context variables, so a better version would look like this:
public class AccountTriggerHandler
{
    public static void updateContactAddresses(Map<ID, Account> updatedAccounts, Map<ID, Account> oldAccounts)
    {
        Set<Id> accountIds = new Set<Id>();
        for (account a : updatedAccounts.values()) {
            account old = oldAccounts.get(a.Id);
            if (a.billingstreet != old.billingstreet|| a.billingcity !=old.billingcity || a.billingstate !=old.billingstate || a.billingcountry != old.billingcountry) {
                accountIds.add(a.Id);
            }
        }
        if (accountIds.size() > 0) {
            contact[] updates = [select Id, accountId from contact where accountId in :accountIds];
            for (contact c : updates) {
                account a = updatedAccounts.get(c.accountId);
                c.mailingStreet = a.billingStreet;
                c.mailingcity = a.billingcity;
                c.mailingstate = a.billingstate;
                c.mailingpostalcode = a.billingpostalcode;
                c.mailingcountry = a.billingcountry;
                }
            update updates;
      }
}

Trigger contactFromAccounts on Account (after update) {
    AccountTriggerHandler.updateContactAddresses(Trigger.NewMap, Trigger.OldMap);
}


text:
Q: Unable to serialize the session state? We have reasonably large scale application and recently experiencing issues with random logouts. Upon investigation we've found app pool is recycling after physical memory limit of (1GB)is reached. I m now trying to save session state in out of process as below
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="20"/>

After changing the session state mode to "StateServer" and running the asp.net state service on server. I m getting the following error message
"Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode."
Apparently i have to mark session related objects with [Serializable] attribute but the application is quite big. Is there a way around this issue?
thanks

A:
Is there a way around this issue?

No, you have to analyze all the objects that are participating in the object graph that you are storing into the session and decorate them with the [Serializable] attribute.
The alternative's not gonna like you: write a custom session state provider where you will have control over the serialization of your session state objects but that's usually an overkill.


text:
Q: Using a variable when setting a range I have created a variable loop to check a column for a value. If that column has a value I want to use that variable to set a range B & variable to F33.
So sArea is the variable
how do I replace this:
Sheets("DEVELOPMENT CONTROL").ScrollArea = "B1:F33"

To something like this:
Sheets("DEVELOPMENT CONTROL").ScrollArea = "B & sArea : G38"

which doesn't work

A: This should work:
Sheets("DEVELOPMENT CONTROL").ScrollArea = "B" & sArea & ":G38"

You need to pass sArea as a variable instead of text, like above.


text:
Q: How do I make a method in my Java class return findViewById? I gave my layout file every single element an ID, and in my java class I have a method called locate(). What I'm going to return is:
return findViewById(R.id.star);

But it says cannot resolve symbol findViewById. Also I don't know what should I declare as return type for the method.So here's what my code look like.
public class Tank {
    public int x;
    public int y;
    public String face;

    public Tank(int xPos,int yPos){
        x=xPos;
        y=yPos;
    }

    public RETURNTYPE locate(){
        return findViewById(R.id.star);
    }
}

I don't know what should be the return type, and findViewById cannot be resolved. I created this class manually(not auto generated).

A: findViewById is a method of a View, as well of an Activity, hence you'll need an instance of View or of Activity to call it.
Probably it works for you now because you're inside an Activity or a View, but once you move it somewhere else, you'll need to call it on said activity or view, i.e.:
View locate(Activity activity) {
  return activity.findViewById(R.id.star);
}

View locate(View view) {
  return view.findViewById(R.id.star);
}

Notice I'm returning View as the return type? Although this is not incorrect, it's actually not the best and we can make it better.
If you notice, finViewById returns a generic type that extends View. In other words, a concrete view and therefore we could rewrite the methods above like:
<T extends View> T locate(Activity activity) {
  return activity.findViewById(R.id.star);
}

<T extends View> T locate(View view) {
  return view.findViewById(R.id.star);
}

Why is this better? Because you won't have to cast it to the right thing. Without generics you would have to call it like:
TextView t = (TextView) locate();

With generics the code becomes more clean:
TextView t = locate();

PS: Back some time ago, findViewById actually returned View and we were all casting the return type. Nowadays, Google changed it for generics and we don't need to.

A: You need proper context when using the findViewById() like so:
public <T extends View> T locate(Activity ctx){
    return ctx.findViewById(R.id.star);
}

A: No need to take Activity or Context for finding the View. As every view which you will locate by findViewById() will be a child of any ViewGroup. So just make it
public <T extends View> T locate(View parentView){
    return parentView.findViewById(R.id.star);
}


text:
Q: What's the best PHP library to develop GUI programme? php-gtk and JeCat ?
Is there a better choice?
Further more,what's the current most pupular way to develop GUI programmes with PHP?
What's the procedures and related software utilities?

A: php-gtk will give you the least hassle, however any choice comes with a bit of a learning curve. I'm now using php-gtk + the Roadsend PHP compiler to compile PHP desktop applications into native 32 bit ELF executables.
I should also add, it was not my choice to use PHP for such a task, I would much rather write desktop apps using C or Python. In the above case, I inherited something that was prototyped using PHP, which never got re-written. It was faster to just get it to compile than it was anything else.
I don't want to kick off a flame fest on the merits of using PHP as a prototyping tool .. in essence, any dynamically typed language could be used as such, depending on what had to be prototyped.
I would, however, encourage you to keep going on your self-study, once you grasp the concepts of the gtk bits that PHP exposes, consider looking into Python if you want to create applications that will be released to the wild.

A: TitaniumApp. It allows you to design your GUI using Javascript, CSS and HTML5 (Runs a reasonably up to date version of webkit) and allows your code logic to be in PHP, Python, Ruby or Javascript. Produces executables for Linux, OSX and Windows.

A: There's also PHP-Qt

A: If Windows-only is enough for you I've used miniPHP successfully for a real-world project.


text:
Q: Showing an equality with sequences and sets Let $a,b$ be two real numbers and $(a_n) \subset \mathbb{Q}$ be a decreasing sequence of rationals such that $a_n \to a $. Also, take a strictly increasing sequence $(b_n) \subset \mathbb{Q} $ such that $b_n \to b $. Does it follow that
$$ \bigcup_{n \geq 1} (a_n, b_n] = (a,b) $$
???
$$ Attempt $$
If $x \notin \bigcup (a_n, b_n ]$, then for all $n$ wither $x \leq a_n$ or $x >b_n $. Passing to the limit, we obtain that $x \leq a $ or $x \geq b $ and so $x \notin (a,b)$. Hence, $(a,b) \subset \bigcup (a_n, b_n] $
Conversely, let $x \in \bigcup(a_n,b_n] $. We can find $n_0 $ so that $ a_{n_0} < x \leq b_{n_0} $. since $(a_n)$ is decreasing $a \leq a_{n_0} $ and since $(b_n) $ is increasing $b_{n_0} < b $ hence, $x \in (a,b)$
Is this a valid argument?


text:
Q: I am not able to get spring in the simulation I am simulating spring-mass system. This is the code.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
k = 1
m = 1
def f(x, u, t):
    return -k/m*x

x_graph = []
t_graph = []
u_graph = []
y_graph = []

def func(x_0, u_0, t_0, h):
    for i in range(1, 1000):
        m1 = h*u_0
        k1 = h*f(x_0, u_0, t_0)
        m2 = h*(u_0 + 0.5*k1)
        k2 = h*f(x_0+0.5*m1, u_0+0.5*k1, t_0+0.5*h)
        m3 = h*(u_0 + 0.5*k2)
        k3 = h*f(x_0+0.5*m2, u_0+0.5*k2, t_0+0.5*h)
        m4 = h*(u_0 + k3)
        k4 = h*f(x_0+m3, u_0+k3, t_0+h)
        x_0 += (m1 + 2*m2 + 2*m3 + m4)/6
        u_0 += (k1 + 2*k2 + 2*k3 + k4)/6
        t_0 += h
        x_graph.append(x_0)
        t_graph.append(t_0)
        u_graph.append(u_0)
        y_graph.append(0)
    return x_0

print(func(0, 5, np.pi, 0.01))

fig, ax = plt.subplots()

ax.set(xlim=(-5.1, 5.1), ylim=(-0.05,1))
# ax.grid()
def animate(i):
    l1.set_data(x_graph[:i],y_graph[:i])
    return l1,

l1, = ax.plot([],[], 'o-',markevery=[-1])

ani = animation.FuncAnimation(fig, animate,frames=len(t_graph),interval =5, blit=True)
# plt.show()
ani.save('pandemic.gif', writer='ffmpeg')

I want to have a spring at point (-5,0) which changes its position as the block moves. My current output is this
Edit1:- I have added code which includes data for x_graph, y_graph and t_graph.

A: I think you are trying to simulate a mass osculating around a point.
This small edit should work

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
k = 1
m = 1
def f(x, u, t):
    return -k/m*x

def func(x_0, u_0, t_0, h):
    x_graph = []
    t_graph = []
    u_graph = []
    y_graph = []
    for i in range(1, 1000):
        m1 = h*u_0
        k1 = h*f(x_0, u_0, t_0)
        m2 = h*(u_0 + 0.5*k1)
        k2 = h*f(x_0+0.5*m1, u_0+0.5*k1, t_0+0.5*h)
        m3 = h*(u_0 + 0.5*k2)
        k3 = h*f(x_0+0.5*m2, u_0+0.5*k2, t_0+0.5*h)
        m4 = h*(u_0 + k3)
        k4 = h*f(x_0+m3, u_0+k3, t_0+h)
        x_0 += (m1 + 2*m2 + 2*m3 + m4)/6
        u_0 += (k1 + 2*k2 + 2*k3 + k4)/6
        t_0 += h
        x_graph.append(x_0)
        t_graph.append(t_0)
        u_graph.append(u_0)
        y_graph.append(0)
    return  t_graph, x_graph, y_graph, u_graph

t, x, y, u = func(0, 5, np.pi, 0.01)

fig, ax = plt.subplots()

ax.set(xlim=(-5.1, 5.1), ylim=(-0.05,1))
# ax.grid()
def animate(i):
    i, j = [0, x[i]], [0, y[i]]
    l1.set_data(i, j)
    return l1,

l1, = ax.plot([],[], 'o-',markevery=[-1])
l2, = ax.plot([],[], 'o-',markevery=[-1])
l3, = ax.plot([],[], 'o-',markevery=[-1])

ani = animation.FuncAnimation(fig, animate,frames=len(t),interval =5, blit=True)
fig.show()
ani.save('pandemic.mp4', writer='ffmpeg')

A: Correct answer has already been provided. I am adding a different solution. This solution will suit if the spring is attached on the left to a rigid wall and the ball is moving. The spring stretches and compresses based on the distance between the wall and the ball. This looks like below.

I changed your code very slightly to do this. Please beware that some of the values are hard coded so one has to change them to suit the requirement. It is very easy to change them depending on the x_lim values.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

k = 1
m = 1
def f(x, u, t):
    return -k/m*x

x_graph = []
t_graph = []
u_graph = []
y_graph = []

def func(x_0, u_0, t_0, h):
    for i in range(1, 1000):
        m1 = h*u_0
        k1 = h*f(x_0, u_0, t_0)
        m2 = h*(u_0 + 0.5*k1)
        k2 = h*f(x_0+0.5*m1, u_0+0.5*k1, t_0+0.5*h)
        m3 = h*(u_0 + 0.5*k2)
        k3 = h*f(x_0+0.5*m2, u_0+0.5*k2, t_0+0.5*h)
        m4 = h*(u_0 + k3)
        k4 = h*f(x_0+m3, u_0+k3, t_0+h)
        x_0 += (m1 + 2*m2 + 2*m3 + m4)/6
        u_0 += (k1 + 2*k2 + 2*k3 + k4)/6
        t_0 += h
        x_graph.append(x_0)
        t_graph.append(t_0)
        u_graph.append(u_0)
        y_graph.append(0)
    return x_0

print(func(0, 5, np.pi, 0.01))

fig, ax = plt.subplots()

ax.set(xlim=(-5.1, 5.1), ylim=(-1,1))
# ax.grid()
def animate(i):
    l1.set_data(x_graph[:i],y_graph[:i])
    sin_x = []
    sin_y = []
    for j in np.linspace(-5,x_graph[i],250):
        sin_x.append(j)
        sin_y.append(0.15*np.sin((j+5)*(2*np.pi)*10/(x_graph[i]+5)))
    l2.set_data(sin_x, sin_y)
    return l1,l2,

l1, = ax.plot([],[], 'o',markevery=[-1])
l2, = ax.plot([],[], '-')

ani = animation.FuncAnimation(fig, animate, frames=len(t_graph),interval =0.5, blit=True)
# plt.show()
ani.save('pandemic.gif', writer='imagemagic')


text:
Q: Using XeLaTeX instead of pdfLaTeX I would like to give XeLaTeX a try.  I've been using pdflatex to process the following:
\listfiles

\documentclass{article}

\usepackage[backend=biber]{biblatex}

\usepackage{filecontents}

\AtEveryBibitem{\clearfield{eprintclass}}
\AtEveryBibitem{\clearfield{doiclass}}

\begin{filecontents}{\jobname.bib}

@Article{Aubert:2007sea,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Evidence for b ---> d gamma Transitions From a Sum of
              Exclusive Final States in the Hadronic Final State Mass
              Range 1.0-GeV/c**2 < M(X(d)) < 1.8-GeV/c**2}",
 year      = "2007",
 eprint    = "0708.1652",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0708.1652;%%"
}

@Article{:2010ip,
 author    = "del Amo Sanchez, P. and others",
 collaboration = "BABAR",
 title     = "{Dalitz-plot Analysis of B0 --> D0bar pi+ pi-}",
 journal   = "PoS",
 volume    = "ICHEP2010",
 year      = "2010",
 pages     = "250",
 eprint    = "1007.4464",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 1007.4464;%%"
}

@Article{delAmoSanchez:2010rq,
 author    = "del Amo Sanchez, P. and others",
 collaboration = "BABAR",
 title     = "{Evidence for direct CP violation in the measurement of the
              Cabibbo-Kobayashi-Maskawa angle gamma with B-+ --> D(*)
              K(*)-+ decays}",
 journal   = "Phys. Rev. Lett.",
 volume    = "105",
 year      = "2010",
 pages     = "121801",
 eprint    = "1005.1096",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.105.121801",
 SLACcitation  = "%%CITATION = 1005.1096;%%"
}

@Article{:2008ii,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of $|V_cb|$ and the form-factor slope for
              $\bar{B} \to D \ell^- \bar{\nu}_\ell$ decays on the recoil
              of fully reconstructed $B$ mesons}",
 year      = "2008",
 eprint    = "0807.4978",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4978;%%"
}

@Article{:2008if,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurements of ${\cal B}(\bar{B}^0 \to \Lambda_{c}^{+}
              \bar{p})$ and ${\cal B}(B^- \to \Lambda_{c}^{+} \bar{p}
              \pi^-)$ and Studies of $\Lambda_{c}^{+}\pi^-$ Resonances}",
 journal   = "Phys. Rev.",
 volume    = "D78",
 year      = "2008",
 pages     = "112003",
 eprint    = "0807.4974",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevD.78.112003",
 SLACcitation  = "%%CITATION = 0807.4974;%%"
}

@Article{Aubert:2008zh,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of D0 - anti-D0 mixing from a time-dependent
              amplitude analysis of D0 ---> K+ pi- pi0 decays}",
 journal   = "Phys. Rev. Lett.",
 volume    = "103",
 year      = "2009",
 pages     = "211801",
 eprint    = "0807.4544",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.103.211801",
 SLACcitation  = "%%CITATION = 0807.4544;%%"
}

@Article{Aubert:2008sb,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of CP Asymmetries and Branching Fractions in
              B0 -> ---> pi+ pi-, B0 ---> K+ pi-, B0 ---> pi0 pi0, B0 ---
              > K0 pi0 and Isospin Analysis of B ---> pi pi Decays}",
 year      = "2008",
 eprint    = "0807.4226",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4226;%%"
}

@Article{Aubert:2008ri,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Search for B+ ---> mu+ nu mu with inclusive reconstruction
              at BaBar}",
 year      = "2008",
 eprint    = "0807.4187",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4187;%%"
}

@Article{Aubert:2008ps,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Direct CP, Lepton Flavor and Isospin Asymmetries in the
              Decays B ---> K(*) l+ l-}",
 journal   = "Phys. Rev. Lett.",
 volume    = "102",
 year      = "2009",
 pages     = "091803",
 eprint    = "0807.4119",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.102.091803",
 SLACcitation  = "%%CITATION = 0807.4119;%%"
}

@Article{Aubert:2008fq,
 author    = "Aubert, Bernard and others",
 collaboration = "BaBar",
 title     = "{Searches for B meson decays to phiphi, phirho,
              phifzero(980), and fzero(980)fzero(980) final states}",
 journal   = "Phys. Rev. Lett.",
 volume    = "101",
 year      = "2008",
 pages     = "201801",
 eprint    = "0807.3935",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.101.201801",
 SLACcitation  = "%%CITATION = 0807.3935;%%"
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}

\printbibliography

\end{document}

I have been using this message as a reference Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX.  Ideally I'm looking for methods to preserve UTF-8 after the document has been processed (see my previous thread: Error message when using biber) .  Could anyone give me a skeleton that I could use to fully implement the xelatex packages described in the first link?
Also, I've been getting a lot of "—¿" in my finished pdf.  Any idea what could be the culprit?

A: There's very little that you need to change to transition from pdflatex to xelatex. There are four main things to remember:

*

*Your input file must be UTF-8 encoded

*You must not load the inputenc package.

*You use the fontspec package to load fonts.

*You can use any font installed on your system.

Other than that, most things work similarly.
In general, characters that you might have used LaTeX commands to input (e.g. accented characters) can be entered directly into your source.
The fontspec package allows you to do automatic substitution for the common TeX shorthands (--, ---, ``...'', etc) by using the option [Ligatures=TeX].  Here's a sample document:
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Linux Libertine O} % or any font on your system
\setsansfont{Linux Biolinum O} % or any font on your system
\begin{document}
This is some text.
\end{document}


text:
Q: Prove that an associative operation* is a structural property First off how does one prove that an operation $\ast$ is a structural property and how is this different from just proving an isomorphism?
My main question is: how can I prove that $\ast$ on a binary structure is a structural property.
So far I have said:
Let $\langle S,\ast\rangle$ and $\langle T,\sharp\rangle$ be two arbitrary binary structures preserved by an isomorphism $f: S\to T$.
Assume $\ast$ is associative
Then we have that $f((a\ast b)\ast c)=f(a\ast b)\sharp c$ for all $a,b$ in $S$
Due to associativity we have that $f(a\ast (b\ast c))=f(a)\sharp f(b\ast c) \ldots$.
And I don't know if I can reach any end from here.
How should I continue? Or restart?

A: According to your description of "structural property", you seem to have started out correctly.  What you need to show is that, if $\langle S,\ast\rangle$ and $\langle T,\sharp\rangle$ are two binary structures and $f:S\to T$ is an isomorphism between them, then $\langle S,\ast\rangle$ is associative if, and only if, $\langle T,\sharp\rangle$ is associative.  By symmetry, it suffices to assume that $\langle S,\ast\rangle$ is associative, and show that $\langle T,\sharp\rangle$ is associative.
Suppose then that $x,y,z\in T$; we need to show that $(x\sharp y)\sharp z = x\sharp(y\sharp z)$.  Since $f$ is an isomorphism, it has an inverse map $f^{-1}$ that is also an isomorphism. Therefore, there exist $a,b,c\in S$ for which $x = f(a)$, $y = f(b)$ and $z = f(c)$. Then
$$(x\sharp y)\sharp z = (f(a)\sharp f(b))\sharp f(c) = f(a\ast b)\sharp f(c) = f((a\ast b)\ast c),$$
since $f$ is a homomorphism. But, since $\ast$ is associative, the argument $(a\ast b)\ast c$ of $f$ is equal to $a\ast(b\ast c)$, so you can unravel the right hand side to eventually get $x\sharp (y\sharp z)$.  (I'll leave this for you.)  That proves that $\langle T,\sharp\rangle$ is associative as well.


text:
Q: Why does my CPU fan race when running videos or virtual machines? I have:

*

*Windows Vista Home 32-Bit SP1

*Intel Celeron CPU 3.06 GHz

*2 GB RAM

I installed the operating system about a year ago, has been working fine.
However about 3 months ago, the CPU fan has started to intermittently race at a high-pitched tone, especially during or after viewing Youtube videos, or being on a web site with Flash, or running a virtual machine. Also Thunderbird and Tweetdeck seem to kick the fan into high-speed mode as well.
However, sometimes I can run these applications with no CPU-fan racing, it seems to vary.
Vacuuming the fan to clear all the dust actually improves the situation but it seems it is just getting worse and even after a vacuum and a reboot, it isn't but 10 minutes of computer use that the fan starts screaming again:
Just as an example, I started a youtube video and a virtual machine at the same time, but the fan remained quiet:

However, after this, I started Thunderbird and the fan started racing again:

It is not a 1-to-1 cause-and-effect, it just starts racing about every 10 minutes. It never used to do this.
What can I do to improve this situation other than a full reinstall of the operating system?

*

*get 4 GB of RAM?

*install windows 7?

*new video card?

*is there some way I can monitor my CPU fan with software?

Anyone have experience with this?

A: I'd have a go with Speedfan to see if the fan speed has anything to do with the temperature of the CPU. If your CPU is getting too hot, then it's natural for the fan speed to increase.
If so, then getting a new high performance or low noise fan might be your best option.
If you're feeling adventurous, you could also give your fan's bearings an oiling, although that's a slightly harder option.

A: I would be leaning towards what everyone else is saying your CPU is proberbly getting hot.

1) Try doing the same, but with the case open.
2) If the fan is broken, replacing it is most likely the only solution. You can get realy good fans that have a much lower noice then what computers normaly ship with ( But make sure there is room in your case).

A: Update the BIOS on your motherboard if possible, it may simply be that there's an error in the code for controlling the fan depending on temperature.

A: I would try just getting a new fan.  It could be that it was always racing at high CPU load, but you just started noticing (hearing) it now because the bearings are starting to go bad.

A: Are you sure it's your CPU fan?
The fans on graphics cards can also be very noisy, they are traditionally small, cheap and naff. I've had more noisy graphics cards than I've had CPU fans.
The graphics card driver is usually responsible for managing the fan speed, when the graphics card is idling it will be slow, but when you start watching a video or stress the graphics the graphics card gets hot and it will increase the speed which sounds much like what you are noticing.
It's very possible theirs dust/damage to that fan, it's also possible that a recent Windows update caused the driver to be changed and the way it controls the fan may have changed with it being on more or something which might account for the recent change you are experiencing. A windows update for my nvidea Gforce 9 caused movies to play stuttery and place more load on the graphics card – it was noticeable that the fan was on more often (I updated to the latest driver which fixed that).
If it is your graphics card fan try using an air duster (when it's cool) to remove the dust but I don't think you can replace the fan.  I've had graphics cards before where the fan would squeal at times and just tinkering with it and the angle of the graphics card would make all the difference.
However if it's your CPU theirs a good chance you could buy another 40/60/80mm fan and replace the old one as they are fairly standard or if you are feeling brave (and know what your doing) replace the whole heat sink + fan.
Not a suggestion but when I have a noisy fan I find something to gently press against the centre of the fan to slow it down which helps to find out which can is making the noise – be careful as it hurts (trust me on this) if that something is your finger and you miss the centre of the fan!!!


text:
Q: Calculate Sales By Sales Person I have a table with below format.
Sample table and data
declare @sales table
(productid int, TransDate date,SalesPerson varchar(100),Amount bigint)

insert into @sales
values
(1 ,         20150101,      50  ,         'S1'),
(1 ,         20150201,      50  ,         'S1'),
(1 ,         20150301,      50  ,         'S1'),
(1 ,         20150401,      50  ,         'S1'),
(1 ,         20150501,      50  ,         'S1'),
(1 ,         20150601,      50  ,         'S2'),
(1 ,         20150701,      50  ,         'S2'),

Now, I need to calculate the total sales of each rep and the related sales(sales performed by all sales persons other than than the main sales person)
For example,
For Sales Person S1, his sales are 250 and related agents(S2) sales(who also involved in the sales serviced by S1 for products 1) will be 100.
The output should be:
SalesPerson  Date         MySalesAmount  RelatedSalesPersonSalesAmount
S1           20150101     50             0
S1           20150201     50             0
S1           20150301     50             0
S1           20150401     50             0
S1           20150501     50             0
S1           20150601     0              50
S1           20150701     0              50
S2           20150101     0              50
S2           20150201     0              50
S2           20150301     0              50
S2           20150401     0              50
S2           20150501     0              50
S2           20150601     50             0
S2           20150701     50             0

Can anyone help on this to achieve above output with a query?

A: This seems complicated.  Obviously, the sales person's amount is easy enough:
select salesperson, sum(salesamt)
from t
group by salesperson;

For the related amount, we need sales amounts for other sales people who have sold the same products.
I think a self join comes to the rescue:
select t.salesperson,
       sum(case when t.salesperson = t2.salesperson then t.salesamnt end) as mysales,
       sum(case when t.salesperson <> t2.salesperson then t.salesamnt end) as othersales
from t join
     t t2
     on t.product = t2.product
group by t.salesperson

A: Try this -
declare @sales table
(productid int, transDate date, amount bigint, salesperson varchar(100))

insert into @sales
values
(1 ,         '20150101',      50  ,         'S1'),
(1 ,         '20150201',      50  ,         'S1'),
(1 ,         '20150301',      50  ,         'S1'),
(1 ,         '20150401',      50  ,         'S1'),
(1 ,         '20150501',      50  ,         'S1'),
(1 ,         '20150601',      50  ,         'S2'),
(1 ,         '20150701',      50  ,         'S2')

;with cteSales as
(select s.salesperson, productid, sum(amount) amount
from @sales s
group by s.salesperson, productid)
select s1.salesperson, s1.productid,
       sum(case when s1.salesperson = s2.salesperson  then s1.amount else 0 end) as mysales,
       sum(case when s1.salesperson <> s2.salesperson   then s2.amount else 0 end) as othersales
 from cteSales s1 inner join cteSales s2
on s1.productid = s2.productid
group by s1.salesperson, s1.productid

A: Check the following query:
declare @sales table
(productid int, TransDate date,SalesPerson varchar(100),Amount bigint);

insert into @sales(productid, TransDate, Amount, SalesPerson)
values
(1, '20150101', 50, 'S1'),
(1, '20150201', 50, 'S1'),
(1, '20150301', 50, 'S1'),
(1, '20150401', 50, 'S1'),
(1, '20150501', 50, 'S1'),
(1, '20150601', 50, 'S2'),
(1, '20150701', 50, 'S2'),
(1, '20150601', 10, 'S3'),
(1, '20150701', 10, 'S3');

select distinct
  SalesPerson,
  sum(Amount) over (partition by productid, SalesPerson) as MySalesAmount,
  sum(Amount) over (partition by productid) -
    sum(Amount) over (partition by productid, SalesPerson) as RelatedSalesPersonSalesAmount
from @sales;

Output:
+-------------+---------------+-------------------------------+
| SalesPerson | MySalesAmount | RelatedSalesPersonSalesAmount |
+-------------+---------------+-------------------------------+
| S1          |           250 |                           120 |
| S2          |           100 |                           270 |
| S3          |            20 |                           350 |
+-------------+---------------+-------------------------------+

Test it online with rextester.
Update:
select
  x.productid,
  x.SalesPerson,
  y.TransDate as [Date],
  iif(x.SalesPerson = y.SalesPerson, y.Amount, 0) as MySalesAmount,
  iif(x.SalesPerson = y.SalesPerson, 0, y.Amount) as RelatedSalesPersonSalesAmount
from (select distinct productid, SalesPerson from @sales) as x
join @sales as y
  on x.productid = y.productid
order by x.productid, x.SalesPerson;

Output:
+-----------+-------------+---------------------+---------------+-------------------------------+
| productid | SalesPerson |        Date         | MySalesAmount | RelatedSalesPersonSalesAmount |
+-----------+-------------+---------------------+---------------+-------------------------------+
|         1 | S1          | 01.01.2015 00:00:00 |            50 |                             0 |
|         1 | S1          | 01.02.2015 00:00:00 |            50 |                             0 |
|         1 | S1          | 01.03.2015 00:00:00 |            50 |                             0 |
|         1 | S1          | 01.04.2015 00:00:00 |            50 |                             0 |
|         1 | S1          | 01.05.2015 00:00:00 |            50 |                             0 |
|         1 | S1          | 01.06.2015 00:00:00 |             0 |                            50 |
|         1 | S1          | 01.07.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.01.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.02.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.03.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.04.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.05.2015 00:00:00 |             0 |                            50 |
|         1 | S2          | 01.06.2015 00:00:00 |            50 |                             0 |
|         1 | S2          | 01.07.2015 00:00:00 |            50 |                             0 |
+-----------+-------------+---------------------+---------------+-------------------------------+

A: declare @sales table
(productid int, SalesAmt int , SalesPerson varchar(100))

insert into @sales
values
(1 ,         50  ,         'S1'),
(2  ,        50   ,        'S2'),
(1  ,        100 ,         'S2'),
(3,         100 ,         'S1'),
(3 ,         150 ,         'S3'),
(2 ,         100  ,        'S3')

select t.salesperson, sum(SalesAmt) [Person Sale],
   (select sum(SalesAmt) from  @sales s where s.SalesPerson <> t.salesperson
) [Total Sale]
from @sales t
group by t.salesperson

enter image description here


text:
Q: for loop django template logic - how can I do this? I am trying to output 2 items for each row. I have 4 items coming from db.

{% for item in items %}

  {{item.name}},{{item.size}}

{% endfor %}

this is giving me
name1, 23m^2 | name2,20m^2 | name3,15m^2 | name4,10m^2

but i need
name1, 23m^2 | name2,20m^2
name3,15m^2 | name4,10m^2

each row being contained in separate
. I am stuck how to break the loop and assign new row..

A: Just switch the
 and forloop, and also use forloop.counter and divisibleby
Something like this:
{% if items %}

{% for item in items %}
     {{item.name}},{{item.size}}
     {% if forloop.counter|divisibleby:2 %}

     {% endif %}
{% endfor %}

{% endif %}

A: You forgot to close  tag.

{% for item in items %}

  {{item.name}},{{item.size}}

{% endfor %}


text:
Q: Excel VBA - SSL issue I'm trying to make connection to a clients iSeries machine that uses SSL and am receiving error 25202 - Unable to open the key file.  Either the path was specified incorrectly or the file permissions did not allow the file to be opened.  I have been working with out network team and they have verified I'm using the correct port and that the port is open for traffic.  They also verified I have access to the file.  They asked me to research providing the key manager path in my connection string, but I can't find anything about that.  I'm looking for any help from anyone who may know something about this and/or experienced it and what the resolution was.  How do I troubleshoot finding the correct key manager path?  My current connection string is as follows...
"Driver=IBM i Access ODBC Driver;System=MySystem;User ID=MyID;Password=MyPassword;SSL=1;"


text:
Q: Rsync from macOS to a system running an older version of macOS I am having a hard time creating an Automator app to sync my music library from one Mac (new macOS) to my Mac mini server (different, older OS). I installed the current version of rsync with Homebrew.
Current progress:
rsync --rsync-path=/usr/local/bin/rsync --exclude=.DS_Store --iconv=utf-8-mac,utf-8-mac --update --delete --progress --recursive --perms --times --rsh=ssh /Users/jonas/Music/ /Volumes/jonas/Music

I need the iconv so that umlauts are treated correctly.
If I run it from the terminal everything works fine. But if I call a shell script from the Automator app it uses the rsync version macOS is shipped with (2.6.9) which does not support iconv.
Is there a way to force the system to use the new rsync version or to update the system-embedded rsync version to the current one?

A: I figured it out!
Just call the rsync version like this:
/usr/local/Cellar/rsync/3.2.3/bin/rsync --exclude=.DS_Store --iconv=utf-8-mac,utf-8-mac --update --delete --progress --recursive --perms --times --log-file=/Users/jonas/Desktop/rsynclog.txt --rsh=ssh /Users/jonas/Music/ /Volumes/jonas/Music


text:
Q: How to generate Crystal Report in PDF format while passing Multiple Parameters? I want to generate crystal report in pdf format. I had done the same thing by passing one parameter. But this time I want to pass 10 parameter. I followed the same thing what I did for passing one parameter.
But now I got the Error Message "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
Anyone please give suggestions. Thanks in advance.
Please modify my Code according to generate Crystal Report in PDF format.
In the Button Click Event I have written the following code.
try
    {
        CrystalDecisions.CrystalReports.Engine.ReportDocument rpt =
                        new CrystalDecisions.CrystalReports.Engine.ReportDocument();

        string conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
        string[] str = conn.Split(';');
        string server = str[0].Substring(str[0].IndexOf(" = ") + 3);
        string database = str[1].Substring(str[1].IndexOf(" = ") + 3);
        string userid = str[2].Substring(str[2].IndexOf(" = ") + 3);
        string password = "Welc0me";

        rpt.Load(Server.MapPath("~/Reports/Marketing/JobOrdersList.rpt"));

        for (int i = 0; i < rpt.DataSourceConnections.Count; i++)
            rpt.DataSourceConnections[i].SetConnection(server, database, userid, password);
        rpt.SetParameterValue(0, DateTime.ParseExact(dcfromdate.DateString.ToString(), DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None));
        rpt.SetParameterValue(1, DateTime.ParseExact(dcTodate.DateString.ToString(), DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None));
        rpt.SetParameterValue(2, ddlCompany.SelectedValue);
        rpt.SetParameterValue(3, ddlUnit.SelectedValue);
        rpt.SetParameterValue(4, ddlCustomer.SelectedValue);
        rpt.SetParameterValue(5, ddlProduct.SelectedValue);
        rpt.SetParameterValue(6, ddlScope.SelectedValue);
        rpt.SetParameterValue(7, ddlStatus.SelectedValue);
        rpt.SetParameterValue(8, ddlGroupBy.SelectedValue);
        rpt.SetParameterValue(9, (ChkPrint.Checked == true ? "True" : "False"));
        rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, "JobOrderList Report");

    }
    catch (Exception ex)
    {
        return ex.Message.ToString();
    }

A: //To generate PDF dynamically

using System;
    using System.Windows.Forms;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;

    namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            ReportDocument cryRpt;

            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                cryRpt = new ReportDocument();
                cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }

            private void button2_Click(object sender, EventArgs e)
            {
                try
                {
                    ExportOptions CrExportOptions ;
                    DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                    PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
                    CrDiskFileDestinationOptions.DiskFileName = "c:\\csharp.net-informations.pdf";
                    CrExportOptions = cryRpt.ExportOptions;
                    {
                        CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                        CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                        CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
                        CrExportOptions.FormatOptions = CrFormatTypeOptions;
                    }
                    cryRpt.Export();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
    }


text:
Q: How would you pass the user's username and password for SSH in a Web Application (asp.net) I understand that this isn't necessarily the best style question for stackoverflow but with that said I have made a lot of questions regarding this question, but I want to know how you would handle it.
I am creating a web application in asp.net and I need to connect to a UNIX server to run remote perl scripts. I am currently doing this
Removed code for personal reasons

If I hardcode my username and password this works fine, but I am trying to create a modal window to pass the values through which may not be the most secure.
So, how would you accomplish this - this is subjective and I can close this question if need be...
EDIT:
I forgot to say, I will be connecting to many different servers, so a public/private key isn't the best option. Suggestions?

A: just run your site on https i.e install SSL certificate . this will encrypt the transmitted data. nothing will be transmitted as plain text.


text:
Q: Seat allocation in python I have a set of groups with a fixed number of people for each groups:
Group1: 10
Group2: 20
Group3: 18
Group4: 10
and a set of free seat per Room where each indivisible group could sit down:
Room1: 10
Room2: 38
Room3: 10
The output should be a potential assignment of the groups in the rooms considering the number of people in each group not splittable.
output: For instance:
Group1->Room1
Group2->Room2
Group3->Room2
Group4->Room3

How may I solve this problem in python? there is some code that could be adopted for this scenario?
of course my problem is more complicated than the one represented (it has been described as simple case just to have an idea)
Thank you

A: I think the most important part is to start with formulating a mathematical model of the problem. Here is my version:

This is basically a variation on the standard assignment problem.
This can be implemented easily with any Mixed-Integer Programming (MIP) or Constraint Programming (CP) solver.
Showing code is not as useful as the above model, but just as an illustration, here is an implementation using a simple CP solver (https://pypi.org/project/python-constraint/).
from constraint import *

#
# data
# group sizes and room capacities
#
groups = {"Group1": 10, "Group2": 20, "Group3": 18, "Group4": 10}
rooms = {"Room1": 10, "Room2": 38, "Room3": 10}

#
# constraint problem
#
# variables:
#      x[i,j] = 1 if group i is assigned to room j
#               0 otherwise
# constraints:
#     sum(j, x[i,j]) = 1                     for all i   assign each group to exactly one room
#     sum(i, size[i]*x[i,j]) <= capacity[j]  for all j   capacity constraint
#
problem = Problem()
problem.addVariables(["x_%s_%s" %(i,j) for i in groups for j in rooms],[0,1])
for i in groups:
  problem.addConstraint(ExactSumConstraint(1),["x_%s_%s" %(i,j) for j in rooms])
groupSizes = [groups[i] for i in groups]
for j in rooms:
  problem.addConstraint(MaxSumConstraint(rooms[j],groupSizes),["x_%s_%s" %(i,j) for i in groups])

S = problem.getSolutions()

Here all feasible solutions are printed. There are two of them:
[{'x_Group1_Room1': 1,
  'x_Group1_Room2': 0,
  'x_Group1_Room3': 0,
  'x_Group2_Room1': 0,
  'x_Group2_Room2': 1,
  'x_Group2_Room3': 0,
  'x_Group3_Room1': 0,
  'x_Group3_Room2': 1,
  'x_Group3_Room3': 0,
  'x_Group4_Room1': 0,
  'x_Group4_Room2': 0,
  'x_Group4_Room3': 1},
 {'x_Group1_Room1': 0,
  'x_Group1_Room2': 0,
  'x_Group1_Room3': 1,
  'x_Group2_Room1': 0,
  'x_Group2_Room2': 1,
  'x_Group2_Room3': 0,
  'x_Group3_Room1': 0,
  'x_Group3_Room2': 1,
  'x_Group3_Room3': 0,
  'x_Group4_Room1': 1,
  'x_Group4_Room2': 0,
  'x_Group4_Room3': 0}]


text:
Q: 'No Module named Tensorflow' error while running 'sh local_test.sh' command while running the deeplab code I am trying to install Deeplab and run it on my machine. I am following this
I am able to run the initial test 'python3 deeplab/model_test.py' but I am getting

No module named Tensorflow

error while running the next step, sh local_test.sh
Tensorflow is installed on the machine and I have tried with different versions of tensorflow to verify any incompatibility issues. Please suggest on where have I gone wrong and what needs to be done to run it successfully.
This is the error message:
Traceback (most recent call last):
  File "/home/ssindhu/models/research/deeplab/model_test.py", line 18, in <module>
    import tensorflow as tf
ImportError: No module named tensorflow

But tensorflow is installed on the machine:
pip show tensorflow has given me the below output.
Name: tensorflow
Version: 1.13.1
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/ssindhu/.local/lib/python3.6/site-packages
Requires: six, astor, numpy, protobuf, tensorboard, tensorflow-estimator, termcolor, grpcio, wheel, keras-applications, gast, absl-py, keras-preprocessing
Required-by:

A: First of all, create a virtual environment
pip install virtualenv
pip3 install virtualenv

Now make a new directory name it enviornments:
sudo mkdir enviornmrnts

Go into this directory (cd enviornments) and activate the environment
virtualenv project1_env
source project1_env/bin/activate

now do this:
pip3 install -U --user pip six numpy wheel setuptools mock
pip3 install -U --user keras_applications==1.0.6 --no-deps
pip3 install -U --user keras_preprocessing==1.0.5 --no-deps

wget "https://github.com/bazelbuild/bazel/releases/download/0.24.0/bazel-0.24.0-installer-darwin-x86_64.sh"

chmod +x bazel-0.24.0-installer-darwin-x86_64.sh
./bazel-0.24.0-installer-darwin-x86_64.sh --user

export PATH="$PATH:$HOME/bin"

check the bazel version by
bazel version

******************************** Installing Tensorflow******************************"
git clone https://github.com/tensorflow/tensorflow.git
git clone https://github.com/tensorflow/models.git

After this:
pip3 install -U tensorflow==1.8.0

To check your installation use this:
cd models/research
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
cd object_detection/
python3 builders/model_builder_test.py


text:
Q: ERR_EMPTY_RESPONSE with Ghost 0.7.5, Nginx 1.9, HTTPS and HTTP/2 Problem
When I hit kevinsuttle.com, I get
"No data received ERR_EMPTY_RESPONSE".

When I hit https://kevinsuttle.com, I get the site.
ghost 0.7.5
nginx 1.4 => 1.9.9
letsencrypt 0.2.0
Digital Ocean: Ubuntu 14.04 Ghost 1-click droplet
Under Networking > Domains, I have both kevinsuttle.com and www.kevinsuttle.com as A records pointing to the server's IP address (@).
DNSimple records

| Type  | Name                  | TTL               | Content                   |
|------ |---------------------  |---------------    |------------------------   |
| URL   | www.kevinsuttle.com   | 3600 (1 hour)     | http://kevinsuttle.com    |

The only modified portion in Ghost's config.js is my domain.
url: 'http://kevinsuttle.com',

Nginx 1.9
nginx 1.9 doesn't create the following directories by default:
/etc/nginx/sites-available
/etc/nginx/sites-enabled
and the usual default conf isn't created in either of those directories.
Instead, there is a etc/nginx/conf.d/default.conf and the important one, etc/nginx/conf.d/nginx.conf. You'll see a lot of tutorials telling you to delete the default.conf, which seems to be fine, but whatever you do, do NOT delete nginx.conf.
Also, you should move/create your ghost.conf into the /etc/nginx/conf.d/ directory. That's what fixed one of my problems, because the last line in etc/nginx/conf.d/nginx.conf looks in the /conf.d/ directory an includes any files there: include /etc/nginx/conf.d/*.conf;
Here's my /etc/nginx/conf.d/ghost.conf file:
  server {
  root /usr/share/nginx/html;
  index index.html index.htm;

  listen 443 ssl http2;

  server_name kevinsuttle.com www.kevinsuttle.com;
    ssl_certificate /etc/letsencrypt/live/kevinsuttle.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/kevinsuttle.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

  location ~ /.well-known {
      allow all;
      root /var/www/;
  }

  location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
        root /var/www/;
    }
      location /.well-known/ {
        root /var/www/;
    }
}

server {
    listen 80 ssl http2;
    server_name kevinsuttle.com;
    return 301 https://$host$request_uri;
}

Now, I had this all working fine, and tried to upgrade nginx to 1.9+, in order to serve via http/2. DigitalOcean's 1-click Ghost droplet defaults to using nginx 1.4.
Long story short, I kept getting this error:
dpkg: error processing archive /var/cache/apt/archives/nginx_1.9.9-1~trusty_amd64.deb (--unpack):

and the only solution I found was
apt-get purge nginx nginx-common

I was then able to install nginx 1.9, by adding the following lines to my /etc/apt/source.list file.
deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx

Now I simply added listen 80 ssl http2; and listen 443 ssl http2;, and http/2 works fine. But only when the https:// URL is explicitly entered.
I found some evidence that points to the fact that express doesn't support http/2, but I'm not 100% on that.
Any ideas would be much appreciated.

A: I don't think this is a problem with Ghost, nor with the DNS.
You can exclude the DNS because both www and not-www are resolving to the configured IP.
➜  ~  dig kevinsuttle.com +short
162.243.4.120
➜  ~  dig www.kevinsuttle.com +short
162.243.4.120

The DNS protocol works at lowel level than HTTP and it doesn't care about the HTTP version or whether you use HTTP vs HTTPS. Therefore we can exclude the DNS and move to examine the higher level protocols.
I also exclude the issue is Ghost/Express, because I can send an HTTP/2 request to your blog when I use HTTPS.
➜  ~  curl --http2 -I https://kevinsuttle.com/
HTTP/2.0 200
server:nginx/1.9.9
date:Sun, 24 Jan 2016 19:34:30 GMT
content-type:text/html; charset=utf-8
content-length:13594
x-powered-by:Express
cache-control:public, max-age=0
etag:W/"351a-fflrj9kHHJyvRRSahEc8JQ"
vary:Accept-Encoding

I can also fallback to HTTP 1.1, as long as I use the HTTP version of the site.
➜  ~  curl -I https://kevinsuttle.com/
HTTP/1.1 200 OK
Server: nginx/1.9.9
Date: Sun, 24 Jan 2016 19:35:36 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 13594
Connection: keep-alive
X-Powered-By: Express
Cache-Control: public, max-age=0
ETag: W/"351a-fflrj9kHHJyvRRSahEc8JQ"
Vary: Accept-Encoding

Hence, the problem is the Nginx configuration. Specifically, the problem is the Nginx configuration for the HTTP-only block.
I can't try it right now, but personally I believe the problem is this line:
listen 80 ssl http2;

it should be
listen 80;

The ssl directive is used to enforce the listening socket to understand ssl. However, in your case it doesn't make sense to have the socket listening on 80 to use HTTPS. Moreover, the socket that uses ssl must have an associated SSL configuration declared (aka at least a valid certificate and key).
Generally, you use ssl to configure a single server that handles both HTTP and HTTPS requests:
server {
    listen              80;
    listen              443 ssl;
    server_name         www.example.com;
    ssl_certificate     www.example.com.crt;
    ssl_certificate_key www.example.com.key;
    ...
}

Also note that as explained in the Nginx documentation

The use of the ssl directive in modern versions is thus discouraged.

The use of http2 in combination with a non-https socket can also be the cause of trouble.
Quoting this article:

While the spec doesn't force anyone to implement HTTP/2 over TLS but allows you to do it over clear text TCP, representatives from both the Firefox and the Chrome development teams have expressed their intents to only implement HTTP/2 over TLS. This means HTTPS:// URLs are the only ones that will enable HTTP/2 for these browsers.

Therefore, assuming it would be possible, serving the non-https site via HTTP/2 may not be useful. Actually, I doubt it's even possible as of today, given the issue described in this ticket which seems to match your issue.
To summarize, simply change
server {
    listen 80 ssl http2;
    server_name kevinsuttle.com;
    return 301 https://$host$request_uri;
}

to
server {
    listen 80;
    server_name kevinsuttle.com;
    return 301 https://$host$request_uri;
}


text:
Q: Scroll listview to bottom as fast as possible, but without skipping any items being viewed I need to make the listview scroll as fast as possible over all of its items, without skipping any of them.
I've found out that the smoothScrollToPositionFromTop(int,int,int) is very good, but it works only on API11+, and i wish to target at least API8.
I've also tried to use setOnScrollListener and similar solutions (setSelection, for example), but they either didn't work or they are too slow and doesn't reflect what an end user can do (fast fling over the listview). How do i achieve this?

A: Take a look at the ListView source in API11+ and copy/paste it into a class that you extend from ListView.
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/widget/AbsListView.java


text:
Q: Always syntax error using query builder - QGIS3 I have a problem with QGIS 3.4.12. As you can see in the image below, it's not possible to execute queries using query builder, because there's always a syntax error. This only happens using this layer ("benigeo"). How can I solve this issue?

EDIT: I need to select the list of some attributes, for this reason I don't need a WHERE clause. To be more clear, I attach another screenshot where you can see what I need. In this layer ("waterways") I'm able to SELECT the waterways type list. Instead, in the other layer I have always that error.

A: You dont need to input the SELECT * FROM benigeo as it's implicit in the context of the provider filter query builder. But you need to add a WHERE clause (without actually inputting the WHERE, only the condition) to select something.
EDIT
It seem that you are misusing the provider filter query builder, it's purpose is to filter a layer (ie. only fetching a subset from the provider) based on a WHERE close on the attribute. (as the query are evaluated by the provider you may get different result with different provider, that could explain why some of your test work while other dont)
If you want to use more advanced SQL query (as in your exemple) you probably should use a virtual layer (Layer > Add Layer > Add/Edit Virtual Layer..., use the import button to load your layer and type your query (in full this time) in the query box) as this rely on SQlite/Spatialite you should get more consistant result.


text:
Q: R: How to use rvest or any R package to extract certain elements from tag's attribute? I have used the xml2::read_html function to read the below string (simplified from real example).

<tobody>

hello

</tobody>

rvest::html_table(x) is able to create a table from it that looks like
if I set x to be the above HTML as a string/characters
x1
hello

But I wish to extract the URL which is part of the  tag's href attribute.
But rvest::html_attrs(x) doesn't seem to work. What's the way to extract attributes from tags using rvest of any other R package?

A: To extract the links from the nodes, one must first obtain a vector of nodes and then pass the vector to html_attr() with the appropriate tag identified.
library(rvest)
library(dplyr)

page<- read_html("

<tobody>

hello

</tobody>

")

#create a vector of nodes with the links
linknodes <- page %>% html_nodes("a")
#extract the href attribute.
answer <-linknodes %>% html_attr("href")
answer
#[1] "JavaScript:gibo_load('http://something.com/XYZW');"

In this example the "JavaScript:..." was a part of the href attribute.
If you are only interested in the "http:..." part then you will need to use gsub or str_extract to obtain the final result.


text:
Q: Object property name changes when parsing it to node js I have an object:
{"description":"Κλείσε τις βάνες","closeValves":["13/21","12/31","13/12","12/32"]}
and when i am sending it to node js with ajax the moment it gets into the router.post it transforms into this
{"description":"Κλείσε τις βάνες","closeValves[]":["13/21","12/31","13/12","12/32"]} ..
Any ideas why this is happening? in the node script where i have the router.post i am requiring this
let express = require('express');
 let router = express.Router();
Update at comment:
the call the function:
formEvent(json,'events/entry',valvescallback);

and the function AJAX:
function formEvent(data,module,next,e){//the request function
    e=e||false;

    console.log("form:",data)
    if( e ){e.preventDefault();}
    var url = './'+module; // the script where you handle the form input.

    $.ajax({
        type: "POST",
        url: url,
        data: data,
        dataType:'json',
        success: function (data) {
            next(data);
        },
        error:function (data) {
            next(data)
        }
   });
}

Update at comment 2:
No the data come from postgress SQL in a text type column like this
{"description":"Κλείσε τις βάνες","closeValves":["13/21","12/31","13/12","12/32"]}
and i am using this to transform it into json and parse it:
var json = jQuery.parseJSON(data.task);
json.action = 'getValves';
json.test = json.closeValves;//test to see if it also changes name

I can see that it transformes any property that is an array like this
name:[1,2,3] --> name[]:[1,2,3]
the odd is that when I am console.log the data inside the AJAX function the are in the right form but inside the post they change..

A: I found it!! the answer is at the definition of the body-parser npm usage:
app.use(bodyParser.urlencoded({ extended: false}));
you just need to make the extended property true and the array name will not change.. so the answer is
app.use(bodyParser.urlencoded({ extended: true}));


text:
Q: SQL query to fetch top record if the desired column value is duplicated In below Table the Primary Key is: Id, ClientId, CertificateId. The column AccountId is duplicated because AccountId may have different client and clients may have different certificates.
Below script for table and data to manipulate.
SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[TableB](
        [Id] [int] NOT NULL,
        [ClientId] [int] NOT NULL,
        [CertificateId] [int] NOT NULL,
        [AccountId] [int] NOT NULL,
        [Status] [bit] NULL,
     CONSTRAINT [PK_TableB] PRIMARY KEY CLUSTERED
    (
        [Id] ASC,
        [ClientId] ASC,
        [CertificateId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (1, 5, 34, 1, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (2, 8, 34, 1, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (3, 7, 36, 2, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (4, 9, 37, 3, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (5, 10, 35, 4, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (6, 4, 37, 4, 0)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (7, 61, 34, 4, 1)
    INSERT [dbo].[TableB] ([Id], [ClientId], [CertificateId], [AccountId], [Status]) VALUES (8, 45, 35, 5, 1)

    GO

When I execute this query: SELECT * FROM TableB WHERE [Status]=1 I get the following results
Id  |  ClientId |  CertificateId  | AccountId | Status
1   |   5       |      34         |     1     |   1
2   |   8       |      34         |     1     |   1
3   |   7       |      36         |     2     |   1
4   |   9       |      37         |     3     |   1
5   |   10      |      35         |     4     |   1
7   |   61      |      34         |     4     |   1
8   |   45      |      35         |     5     |   1

Please help me to get below result, means if any AccountId is repeated then select top 1 and output should like this
Id  |  ClientId |  CertificateId  | AccountId | Status
1   |   5       |      34         |     1     |   1
3   |   7       |      36         |     2     |   1
4   |   9       |      37         |     3     |   1
5   |   10      |      35         |     4     |   1
8   |   45      |      35         |     5     |   1

A: Take a look at below query. Please note that I used Partitioning in order to get grouped row_numbers (rn) , then filtered query by using rn
WITH t AS
(
   SELECT *,
         ROW_NUMBER() OVER (PARTITION BY AccountId ORDER BY Id Asc) AS rn
   FROM TableB WHERE [Status]=1
)
SELECT *
FROM t
WHERE rn = 1

A: Often the fastest method uses a correlated subquery:
SELECT b.*
FROM TableB b
WHERE b.id = (SELECT MIN(b2.id)
              FROM tableB b2
              WHERE b2.Status = 1 AND
                    b2.AccountId = b.AccountId
             );

You want an index on tableB(AccountId, status, id) for performance.

A: Looks like you want one record per account and then the minimum values for the other fields.  If so, just group by account like so:
SELECT
Min(Id) Id,
Min(ClientId) ClientId,
Min(CertificateId) CertificateId,
AccountId,
Status
FROM TableB
WHERE Status=1
GROUP BY AccountId, Status


text:
Q: run regular python project (.py) in google colab as notebook (.ipynb) A project I built with python, I have code in python with (.py) scripts in a folder called "MY_PROJECT", is it possible to run the code in the "MY_PROJECT" folder, in google colab?
I want to run my code in google colab, but it is not in notebook format (.ipynb).
I copied my project to Drive, but I don't see a way to run in colab, Google colab search only for notebook format.
Is it possible to do this, to run a python project in colab?


text:
Q: repo manifest and branches in git repository I copied the android repositories to local pc with repo init and repo sync, the branch is ics_rb7.
In manifest.xml file, revision is ics_rb7.2, that's supposed to mean the branch in each project, right? However, the branch ics_rb7.2 doesn't exist on all projects in the repository. How do we know which branch in the projects is the default cloned one? Thanks,

A: The branch that you specify in your repo init is the branch to use for the manifest repository only. You can find this repository in .repo/manifests. This branch is not necessarily (or even usually) the same branch that will be used for the individual projects.
The manifest.xml file in .repo is actually a symbolic link to the specific manifest within the manifests repository (use ls -l to see which one). It is created when you do a repo init, using the branch (-b) and manifest (-m) flags that you specified to determine which one to use, or using the defaults (e.g. master and default.xml) if you didn't specify these flags.
The manifest file specifies the default revision for projects using the  element, but the individual  elements can override this and specify a different revision. This may explain why some of your projects do not have the ics_rb7.2 branch.
If you want to work out what the manifest branch is for a given project, you can either look at the manifest.xml file, or do a git branch -a and look for a branch that looks like this:
remotes/m/my_manifest_branch


text:
Q: OSError: [WinError 193] %1 is not a valid Win32 application while automating through Selenium ChromeDriver and Chrome in Python Code block:
import time
from selenium import webdriver

browser = webdriver.Chrome('C:/Users/Cypher/Downloads/chromedriver_win32.zip')
browser.maximize_window()
browser.get('https://www.google.com/gmail/')
email_field = browser.find_element_by_id('identifierId')
email_field.clear()
email_field.send_keys('My mail')
email_next_button = browser.find_element_by_id('identifierNext')
email_next_button.click()
time.sleep(1)
password_field = browser.find_element_by_name('password')
password_field.clear()
password_field.send_keys('My password')
password_next_button = browser.find_element_by_id('passwordNext')
password_next_button.click()
time.sleep(100)
browser.quit()

Error:
Traceback (most recent call last):
  File "C:/Users/Cypher/PycharmProjects/untitled5/login_gmail.py", line 4, in <module>
    driver = webdriver.Chrome('C:/Users/Cypher/Downloads/chromedriver_win32.zip')
  File "C:\Users\Cypher\PycharmProjects\untitled5\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\Cypher\PycharmProjects\untitled5\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    stdin=PIPE)
  File "C:\Users\Cypher\Miniconda3\lib\subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Cypher\Miniconda3\lib\subprocess.py", line 1155, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

A: Just extract the chromedriver you have downloaded... chromedriver_win32.zip make sure you have the chromedriver.exe file in the downloads...
browser = webdriver.Chrome('C:/Users/Cypher/Downloads/chromedriver.exe')

Hope this helps you!

A: This error message...
OSError: [WinError 193] %1 is not a valid Win32 application

...implies that the argument which you have passed to initialize Chrome was not in the valid format.
You need to consider a couple of facts as follows:

*

*When you simply pass the absolute location of the ChromeDriver by default it is considered as the Value for the argument executable_path which accepts a value of an executable binary

*As you are on Windows OS you need to extract the chromedriver.exe from chromedriver_win32.zip and place it anywhere within your system.

*Next you need to pass the absolute location of the chromedriver.exe along with the argument executable_path.

*The argument executable_path must be supported with a Value as either of the following:

*

*r'C:\path\to\chromedriver.exe'

*"C:/python/chromedriver.exe"

*"C:\\python\\chromedriver.exe"

*The working line of code will be:
from selenium import webdriver

browser = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')


text:
Q: Track down process that has notty I have a Linux server (Red Hat 2.6 kernel) which had a spike in load due to an Rsync process which seems to have forked many times, but the process was run by rsyncuser@notty I didnt see any cron job scheduled for that time with an rsync that is run under that name, and I assume if there were it would have a tty.  How do I track down what the actual command which caused these processes was?

A: Starting with the assumption is probably too restrictive. You should generate a list of possible causes of the spike and try to invalidate them based on whether their prerequisites are met and/or resulting effects are available or not.
Without knowing your exact setup there seem to be at least the following possibilities that might have caused them

*

*the cause was local, in which case you should search for entries in the log files. You did not see a cron job scheduled, not in the Logs? Or did you look at rsyncuser's crontab? Or also at the daily/hourly etc cron jobs. root's cron.

*the cause was external. To check if that is possible, check if the that user happens to run the rsync daemon (if you have it, via /the init mechanism). Or if someone could remotely login to the account and try and start copying files (which should also have left traces in the log files).
I would probably also investigate whether the rsyncuser account has a password and/or ssh public keys to see if someone could login to that account. And if anybody with root access could have started these.

A: OK you have a problem
Step 1
WEBSITE: they have access logs and Error logs
did a hacker activate a request that directly impacted
the database Backend ?
Not a WEBSITE:
run wireshark to observe traffic related to rsync
On 1 site I noticed that the time server was a little more
than 15 ms out. (because some "duffus" decided to remove the
hardware that ran the time service 1 system at a time until
the last time server was decom'd.
The database system's thought they were out of sync and that
mandated a resend for backups and each system backed up to
ALL the other databases - because they backed up each other.
           I once saw a system backup fail because the MTU was too big
           for the network. a Solaris system with internal connections
           using 9k packet size tried to do backups to an outside backup
           and it was so slow, eventually they made the MTU less than
           512 bytes (512 -32) I think was the solution. The network in
           question was a link out to a service organisation that swore
           there would be no problems with backups. Apparently that was
           just in the 1 case where the outside client had (512 - 32) as
           the MTU value. Basically the main issue was the internal
           Manager - never checked things out prior to making the
           contract and paying heaps for a slow service.

There are other issues, to consider but ... there are many other issues.


text:
Q: Intersection, having some problem solving for Y? Do I have to solve for Y? $3y=\frac{x}{x-y}$
$x+4y=2x$
The top equation is the problem. But I think I've solved it correctly for x
$\frac{1}{3y} = \frac{x}{x}-\frac{y}{x}$
$\frac{1}{3y} = 1-\frac{y}{x}$
$\frac{y}{x} = 1-\frac{1}{3y}$
$\frac{X}{Y} = 1-3y$
$x = y-3y^2$
Put the X equal to eachother and solve for Y?
$y-3y^2 = 4y$
$-3y^2-3y=0$
That gives Y values $-1$ and $0$, which is not correct. So do I have to solve for Y first and find X-values or did I do a mistake somewhere?
http://www.wolframalpha.com/input/?i=3y%3Dx%2F%28x-y%29%2C+x%2B4y%3D2x

A: $\frac{y}{x} = 1-\frac{1}{3y}$  implies $\frac{x}{y} = \frac{1}{1-\frac{1}{3y}}$ , not $\frac{x}{y} = 1-3y$.

A: $3y=\frac{x}{x-y} /(x-y) $ multiply by $(x-y) $ both sides so we get
$3y(x-y)=x$
From the second equation we may conclude that $x=4y$   ,If we substitute $x$ with $4y$ at the first equation we may write
$3y(4y-y)=4y \Rightarrow 9y^2-4y=0 \Rightarrow y(9y-4)=0$ , so: $y_1=0$ and $y_2=\frac{4}{9}$  which means that $x_1=0$ and $x_2=\frac{16}{9}$   ,Since $x-y\neq0$ only solution is $(x_2,y_2)=(\frac{16}{9},\frac{4}{9})$


text:
Q: Difference between "Discriminant", "Discriminative" and "Discriminating" Let us assume I am writing some technical CS stuff, and I want to talk about "features" of something that discriminate something else.
Translating from my native language (French), I would use the word + adjective:

Discriminant features

However, I have stumbled in reads upon the word "Discriminative" and "Discriminating".
According to Wiktionary, we have:

Discriminant (Adj.): Serving to discriminate.
Discriminative (Adj.): Which has the ability to discriminate between things; or which imparts such ability
Discriminating (Adj.): Able to perceive fine distinctions between similar things; perceptive

So if I understand this correctly, Discriminating does not have the same meaning as the other two, i.e. discriminating is an adjective for someone/something that perceives the differences, instead of caracterizing them.
However it is not clear, with regards to the definition of Wiktionary, whether Discriminative and Discriminant are perfect synonyms, or if one is more used in some context than an other, or if they don't exactly mean the same thing, etc.

A: Almost right;
His comments about the attack discriminated against those people

or possibly
His comments about the attack were discriminating against those people who weren't involved.

Back to the question; discriminant and discriminative are pretty much obscure and obsolete. Discriminate is almost exclusively used in its verbal form.
Discriminant is a noun describing a property that discriminates.
The discriminant between red squirrels and grey is their colour

Discriminative is an adjective and applies to the object but is not the same as discriminating = prejudice.
He was discriminative, disliking red sweets and liking green ones

A: Discriminating is used to describe something that a subject is doing. It is not an adverb because it does not describe a verb directly.
His comments about the attack was discriminating to those people who aren't involved.

As you can see in the example sentence. Discriminating was used to describe an action or something that he did. It was discriminating.
He is Discriminative when it comes to attacks. He always thinks it was everyone else's fault.

As you can see Discriminative is used to describe somone. He is Discriminative when it comes to attacks.