text:
Q: Apply CSS for a specific field on Formstack I was trying to span the checkbox field in 3 columns on this form - https://learningcurve.formstack.com/forms/list_of_banks\
So, I wrote
.fsBody .fsForm .fsFieldCell {
    column-count:3;
}

But it spans all the similar fields into 3 columns. I need to span only one specific field to span to 3 columns. I believe that is something to do with the field id. How do I implement it?

A: I looked at the example you have linked and it seems you changed the wrong element to 3 columns.
Try this code instead and see if it works for your issue.
.fsBody .fsForm .fsFieldCell .fieldset-content{
  column-count:3;
}


text:
Q: How MySQL replicate the rows in a table ? and in which order I have a master server and slave db setup for replication.
I'm trying to pull the rows from a table in a slave db and some rows are being missed. Example scenario given below:
Say Current time 12:00:00
I pull the rows from 11:00:00 to 12:00:00 from the table in slave db based on timestamp based column. (update constraint -modified datetime of the row)
Lets say I got a count of 100 and MAX of modified date as 11:45:00 (replication lag of 15 mins, PS : rows are being inserted every second continuously in master) from the resultset.
Say at 12:45, when there is no replication lag,  if I run the count of rows from 11:00:00 to 11:45:00 I get a count of 150 in the slave db.
Question:
How does MYSQL replicate the rows in a table? IN what order?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Two separate outputs appearing when using console.log once When I'm using console.log to display that my app has initialized I'm getting two outputs with the same value but one is from VM66 main.js:34 and the other is from just main.js:34. This really wouldn't be an issue, however, when I'm using console.log to output another value such as the length of an array the values are completely different. VM66 is saying that my array is empty and my main file says that it has a length of one; which is true, my array has a length of one.
I'm using webpack-stream with gulp and the htmlWebpackPlugin. Below is my webpack.config.js file
module.exports =
{
entry: "./src/editor/js/main.js",
    output: {
      path: __dirname + "./devBuild/editor/js",
      filename: "bundle.js"
    },
    module: {
      rules: [
      {
        test: /\.(js)$/,
        exclude: /(node_modules)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      }
      ]
    },
      mode: "development",
      plugins: [
          new HtmlWebpackPlugin({
              title: "Developer version" ,
              template: __dirname + "/src/editor/index.html",
              filename: __dirname + './devBuild/editor/index.html'
          })
     ]
  }

If you require anymore information please let me know, and thank you in advance.

A: The issue was that I had included <script src="./js/bundle.js"></script> already in my template html file. So when the htmlWebpackPlugin compiled my code it inserted another <script src="./js/bundle.js"></script> resulting in my code running twice.


text:
Q: GeoServer Exception: No such operation WMS 1.1.0 GetFeature I'm using GeoExt, OpenLayers and GeoServer. I've added a checkbox to my layer tree which, when clicked, activates a "select feature" control such that when a user clicks on the map, the feature clicked on is highlighted. My code is:
'checkchange': function(node, checked) {
                if (checked === true) {
                    app.mapPanel.map.addLayer(node.attributes.layer);
                    mySelectLayer = new OpenLayers.Layer.Vector("Selection", {
                        styleMap: new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
                    });
                    app.mapPanel.map.addLayer(mySelectLayer);

                    myLayerCtrl = new OpenLayers.Control.GetFeature({
                        protocol: OpenLayers.Protocol.WFS.fromWMSLayer(node.attributes.layer),
                        box: true,
                        multipleKey: "shiftKey",
                        toggleKey: "ctrlKey"
                    });
                    myLayerCtrl.events.register("featureselected", this, function(e){
                        mySelectLayer.addFeatures([e.feature]);
                    });
                    app.mapPanel.map.addControl(myLayerCtrl);
                    myLayerCtrl.activate();

                } else {
                    app.mapPanel.map.removeLayer(node.attributes.layer);
                    app.mapPanel.map.removeLayer(mySelectLayer);
                    myLayerCtrl.deactivate();
                }
            }

However, when a user clicks on the map the following exception is thrown by GeoServer:
org.geoserver.platform.ServiceException: No such operation WMS 1.1.0 GetFeature

I've found a number of posts on this, but no solutions. Any idea about what is causing this problem? Thanks in advance.
UPDATE: I've read that this error is as a result of the request being sent to WMS, as opposed to WFS service. My assumption, however, is that it should be possible for OpenLayers to deduce the WFS service. From the OpenLayers documentation here, the protocol parameter kind of takes care of ensuring WFS, and not WMS, is used, in my opinion. Any idea is welcome.

A:
GeoServer Exception: No such operation WMS 1.1.0 GetFeature

That's correct there is no WMS operation called GetFeature.  There is a WMS operation called GetFeatureInfo, and there is a WFS operation called GetFeature.

A: You are using a wrong url in your protocol; the function
OpenLayers.Protocol.WFS.fromWMSLayer

doesn't change the url to the geoserver's wfs service (OpenLayers doesn't know that there is Geoserver),  which is /wfs. Try to do something like
var protocol = OpenLayers.Protocol.WFS.fromWMSLayer(node.attributes.layer);
protocol.url = '/wfs';   // Add your geoserver base url


text:
Q: I don't get this joke "Massive Attack On Pentagon Page 14 News", can anybody explain me its meaning? I was reading an article about the first issue published by the satiric magazine 'The Onion' after the 9/11 attacks. One of the headlines of that issue was

Massive Attack On Pentagon Page 14 News

I simply don't get the meaning of the sentence and I'm especially confused about the last part, "Page 14 News". I find that part unrelated to the rest of the sentence.

A: "Front page news" is a synonym for the important or notable story.  It's the news that's important enough to put on the cover of the newspaper.
So, page 14 news would be, in comparison, very unimportant, or not at all noteworthy, novel or interesting.
The irony is that a massive attack on the Pentagon would be expected to be all of those.  Unless of course, it is happening often.  Or perhaps if the Pentagon had ceased to be seen as important.
Edit: I was half-asleep when I originally wrote this, and hadn't spotted the fact that the item in the Onion was a contemporaneous report on 9/11.  So the irony is that so many massive attacks have happened that an attack on the Pentagon is being "buried" on page 14.

A: In addition to the satirical content as explained by Euan M, the grammatical meaning may not be immediately obvious because it's written in headlinese. There's implicitly an "is" between "Pentagon" and "Page", so in plain English the headline would be "[A] Massive Attack On [The] Pentagon [Is] Page 14 News". This example could be especially confusing since it's a headline about a headline, which isn't very common.
Here's the headline in context (see the left sidebar):

A: There is (in fact) a good amount of speculation here about grammar, headlines,  insinuation and what my dad used to call "maybe...if". That is all "well and good" (enough)... maybe.
Insight might be gained into the "deeper meaning" of the headlines, sarcasm (Onion, was it?) to review the events of the day as well as the one before.
Rumsfeld reported 2.3 trillion missing from the Pentagon Budget on the day before: September 10th. On September 11th the Pentagon was INDEED hit... in the financial office. This might be a good reason to either bury news of this on page 14 (deliberately, if in fact, it was really done) or (Onion) sarcastically. For some folks, "connecting the dots" is not easy at all in the case of things with which they are not familiar or areas which may not be their expertise.
Following the link sends me to a Newsweek article, from early October, 2001. It's an interview with Onion writer who says they took a week off from writing ANYTHING. He is listing things they thought they WOULDN'T be able to write, because ANY sarcasm just wouldn't have been "fitting".
How differently these things are viewed today.


text:
Q: reStructuredText: README.rst not working on PyPI I have created a package on github django-joyride, after publishing it to pypi it is not showing the README.rst properly. I have checked my syntax here on an online viewer and you can see it works fine. What could be the issue?

A: I had the same problem when uploading my python module to pypi .
Later I checked the README.rst for errors using rst-lint which showed that my readme file was right. You can also use restructuredtext_link package for python to check the rst file for any errors or warnings .
I found that the problem was not in the README file but in setup.py itself.
Follow the below points while writing Readme and setup.py

*

*DO NOT WRITE MULTI LINE python strings for description or summary or anything that goes into the setup( ) arguments .

*Don't use relative links in the README file .(like ./path1/path2 ).

*Make sure the rst syntax is all right using a checking tool like rst-lint.

*If you have a markdown file , you can convert it to Restructured text using pandoc easily.

Also do not use any new docutils syntax since Pypi doesn't use the latest version as Github does.

A: It could be that pypi gets confused because you have both a README.md and a README.rst file. Try to delete the .md one; github can handle README.rst fine.


text:
Q: android phonegap plugin ActionBar wrapper I'm trying to add an iOS "TabBar" style navigation using android native controls - so ActionBar - to my PhoneGap application. I'd like my JavaScript to receive callbacks when the tabs are changed, and ideally I'd like the ActionBar to be completely dynamically populated by the JavaScript as well (like iOS Native TabBar in PhoneGap). I know I can do this in the JS/CSS/HTML layer but I'd like to have a serious go at using native controls before I do that.
I've successfully added an ActionBar to my android phonegap app by modifying the onCreate to contain:
public void onCreate(Bundle savedInstanceState) {
    this.setBooleanProperty("showTitle", true);

    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

    ActionBar bar = getActionBar();

    bar.setDisplayShowTitleEnabled(false);
    bar.setDisplayShowHomeEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    Tab tab = bar.newTab()
        .setText("Test")
        .setTabListener(new TestListener());

    bar.addTab(tab);
    bar.show();

    super.loadUrl("file:///android_asset/www/index.html");
}

I've been trying to make this prettier by creating a plugin around it, using very similar to iOS NativeControls mechanisms:
public PluginResult execute(String action, JSONArray data, String callbackId) {
    PluginResult.Status status = PluginResult.Status.OK;
    String result = "";

    if(INIT.equals(action)) {
        ActionBar bar = cordova.getActivity().getActionBar();
        Tab tab = bar.newTab()
            .setText("Test")
            .setTabListener(new TestListener());

        // CRASHES HERE
        bar.addTab(tab);
        bar.show();
    }

    return new PluginResult(status, result);
}

I understand that this is a non-starter because the ActionBar must be set-up during the onCreate. So then I left the creation in onCreate and was just trying to have the javascript set a callback to be hit when the tab is clicked, but what I can't figure out is how to actually call an arbitrary callback from java into the JavaScript - at any time. I can do it just fine with the "success" callback using the keepCallback function. I need it to be a callback that is specified as an argument to the java, like so:
MyActionBar.prototype.setCallback = function(tabIndex, callback) {
    cordova.exec(function () {
            console.log("Set callback succeeded");
    },
    function() {
            console.log("SetCallback failed");
    },
    "MyActionBar",
    "setCallback", [tabIndex, callback // <--- Calls THIS callback on click
    ]);
};

So several questions:

*

*Is the ActionBar strategy I'm employing viable/correct?

*Is it possible to dynamically alter the contents of an ActionBar to arbitrarily add/remove items?

*How can I call an arbitrary callback specified by the JavaScript from my Java plugin?


text:
Q: Getting notification when HTTP Fails (Azure Logic App) I'm new to Azure, i searched but didn't find something reliable for me.I have an azure app which is sending some HTTP requests to my API. Is there any chance to get an email notification if the HTTP request fails ?

A: You could try to create an alert rule for your logic app, navigate to the logic app in the portal -> Alerts -> New alert rule. Specify the parameters, action group. You need to create a new action group first, use the Action Type with Email/SMS/Push/Voice, set the emails address, etc.
For more details, you could refer to this link.

A: you can take advantage of exceptional handling technique provided by the azure logic app
Add a trigger after the HTTP call as you want to send email add send email action
Click on the setting  top right corner of the action
Click on configure run after
Select is failed or skipped
So this action will only if the previous action is failed


text:
Q: Currency value to text representation - C# I am looking for a way to convert a currency value I have (in UK pounds) into it's plain text representation. For example, I'd need to be able to convert this:
£399,994.71
To
Three Hundred and Ninety Nine Thousand, Nine Hundred and Ninety Four Pounds and Seventy One Pence
Is there anything in .NET that can do this for me? Or perhaps any existing code for doing this?
Thanks!

A: I created this Gist, check it out:
https://gist.github.com/h22/5244967


text:
Q: Why PreDestroy method doesn't work I have a basic spring project with simple configuration. This is bean
public class GreetingServiceImpl implements GreetingService {
    private final Log log = LogFactory.getLog(getClass());

    @Override
    public String hello() {
        return "Hello";
    }

    private void init() {
        log.info("GreetingServiceImpl INIT");
    }

    private void destroy() {
        log.info("GreetingServiceImpl DESTROY");
    }
}

configuration:
<bean id="greetingService"
      class="com.example.hello.GreetingServiceImpl"
      init-method="init"
      destroy-method="destroy">

And this is my test code:
@Test
public void greeting() {
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("applicationConfig.xml");
    GreetingService greetingService = context.getBean(GreetingService.class);

    Assert.assertEquals("Hello", greetingService.hello());
    context.close();
}

When I run this code I don't see destroy method in logs as well as context closing.
org.springframework.context.support.AbstractApplicationContext prepareRefresh
Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2be94b0f
org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
Loading XML bean definitions from class path resource [applicationConfig.xml]
com.example.hello.GreetingServiceImpl init
GreetingServiceImpl INIT

Process finished with exit code 0

I tried to call registerShutdownHook and refresh but result was the same.

A: not quite sure, haven't tested it, but have you tried making your destroy method public?
For testing I would suggest you use the spring testing annotations: https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#integration-testing-annotations
and then inject your application context or inject the corresponding bean


text:
Q: create a database in pyspark using Python API's only I'm unable to locate any API to create a database in pyspark. All I can find is SQL based approach.
catalog doesn't mention a python method to create a database.
Is this even possible? I am trying to avoid using SQL.

A: I guess it might be a suboptimal solution, but you can call a CREATE DATABASE statement using SparkSession's sql method to create a database, like this:
spark.sql("CREATE DATABASE IF EXISTS test_db")

It's not pure PySpark API, but this way you don't have to switch context to SQL completely, to create a database :)


text:
Q: Replace values in one column, depending on values in another column import pandas as pd

dict = {
    '1': 'Alb',
    '2': 'Bnk',
    '3': 'Cd'
}

df = pd.DataFrame(
    {
        'col1': {
            0: 20,
            1: 2,
            2: 10,
            3: 2,
            4: 44
        },
        'col2': {
            0:'a',
            1:'b',
            2:'c',
            3:'b',
            4:20
        }
     }
)

I want to replace col1 value 2 with 'Bnk' if col2 value == 'b'
How can this be done?
Thanks

A: There are several ways to do this but for clarity you can use apply:
import pandas as pd

dict = {
    1: 'Alb',
    2: 'Bnk',
    3: 'Cd'
}

df = pd.DataFrame(
    {
        'col1': {
            0: 20,
            1: 2,
            2: 10,
            3: 2,
            4: 44
        },
        'col2': {
            0:'a',
            1:'b',
            2:'c',
            3:'b',
            4:20
        }
     }
)

def change(data, col2val, dict):
    if data['col2'] == col2val:
        data['col1'] = dict[data['col1']]

    return data

new_df = df.apply(change, axis = 1, col2val = 'b', dict = dict)

print(new_df)

I also modified the dict to have integer keys for simplicity.
Output:
  col1 col2
0   20    a
1  Bnk    b
2   10    c
3  Bnk    b
4   44   20


text:
Q: Elucidating the nature of infinite dedekind finite subsets in the reals Criteria for "constructive" in this question: Given a formal system and all the models that satisfy the axiomatic systems of interest (e.g. all models of ZF without choice), any object being constructed can be proved to exist/not exist and the proof is written only in terms of the sequence of axioms (and theorems derived from them) being used, and rejecting the law of excluded middle.
In ZF set theory where axiom of choice is absent, it is consistent that there exists amorphous and infinite dedekind finite sets, although we cannot prove them because we can construct models where they exist and models where they don't.

$S$ is infinite dedekind finite, or strictly dedekind finite if it does not biject with any initial section of the naturals (not of finite cardinality) and there exists no map that can inject $S$ into any of its subsets.

In particular, it is consistent that there can exist infinite dedekind finite subsets $S$ of the reals.
After discussing in the chat, it was found that $S \subsetneq \Bbb{R\setminus Q}$ and that $S$ consists of both a countable subset and another infinite dedekind finite set.
But that raised a question: It is known that any irrational $r$ is a rational distance away from some other irrationals $s$, therefore this will mean for any subset of irrationals, there always exists a nonzero rational $q$, not necessary unique, such that $s=r+q$ for any pairs of $r,s \in S$. Since $\Bbb{Q}$ is countable regardless of choice, it seems $\{s : s=r+q\}$ will always form a countable subset for any candidate $S$, thus leading to the conclusion that there cannot be any such $S$.

*

*What is an explicit example of an infinite dedekind finite subset of the reals in models of ZF where they can be proved to exist. More generally, what well known models of ZF will allow the existence of such sets be provable and also constructible explcitly via an algorithm or procedure?

*How to show that objects defined using both axiom of choice or its negation can never be constructive, is there a well known reference for such proof?

A: As far as constructivity, Arnie Miller has a proof that it is consistent to have a Borel set which is [infinite] Dedekind-finite.

Miller, Arnold W., A Dedekind finite Borel set, Arch. Math. Logic 50, No. 1-2, 1-17 (2011). ZBL1225.03061.

In fact this Borel set is relatively low in the hierarchy, it is an $F_{\sigma\delta}$ set.
As far as "constructive", I guess this is more or less the best you can get. In the same paper he shows that it's impossible to get it from a lower stage of the Borel hierarchy.
If this answer does not satisfy you, then I'm afraid that there isn't much more we can say. Let me explain why by answering the second answer.
Suppose that $\varphi(x)$ is some formula which defines a set. And now you want to ask if the set it defines is provably such and such. For example, is it provably a finite set of ordinals, or provably a set of reals (for some canonical coding of the reals into sets).
Some formulas define things like that. Like the set of rational numbers, or the set of reals which are constructible in Gödel's sense.
But now we run into independence. In some models, we can show that no formula defines a Dedekind-finite set (or some other set whose existence defies the axiom of choice). Simply because in those models the axiom of choice holds, or sufficient fragment of it holds. And in some models we can prove that a certain set with a certain property does in fact exist.
This means that it is impossible, without the axiom of choice, to prove or disprove that $\varphi(x)$ defines a set with a certain property.
And it can get worse. Just assuming the failure of the axiom of choice, we can prove that Zorn's lemma fails. But we cannot point at a specific example, since the axiom of choice consistently holds up to some rank in the universe, and only fails very high. So anything you might want to define and prove that it "has to be a counterexample to Zorn's lemma" is going to fail.
In other words, the definitions "$\alpha$ is the least such that $V_\alpha$ is not well-orderable" and "$\alpha$ is the least ordinal such that $\mathcal P(\alpha)$ is not well-orderable" might be such that just assuming choice fails ensures that this $\alpha$ exists; but there is no algorithm for finding it, because we can always find models where choice fails above this $\alpha$. And the same is true for many other definitions of this sort.


text:
Q: mongoengine - Do i need to create form for a model ? How to validate ListField(ImageField()) either by form or directly i am using mongodb for django using mongoengine .
Usually for normal models, we write forms and the after submisson of the input data(html form), we populate the django form which validates the data . If form is valid, we just save the data in django form to the model .  Do I need to follow the same process for mongoengine also ?   If yes, how can i validate an image field.   My image field is like this :
 images = ListField(ImageField())

Also, how should I ask the user to enter a list of images in the html page that can be saved into the above field . Will provide more information if necessary
Thanks.

A: When adding a new image to the ListField if you want to validate you can call Model.validate() to ensure its valid.
ImageFields take the actual image file - you can see some examples of their usage here:
https://github.com/MongoEngine/mongoengine/blob/master/tests/test_fields.py#L1880-1968
One caveat - I havent tried an ImageField within a ListField so let me know how it goes :)


text:
Q: ListView cannot scroll I have tried to scroll the ListView up when the event item is more than the space of the ListView but it fails. I would like to know if I can make the ListView scrollable without adding any listener. Thank you.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:clickable="true"
android:focusableInTouchMode="true"
tools:context="com.example.ssycorpapp.SecondActivity" >

<TabHost
    android:id="@+id/tabhost2"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
        </TabWidget>

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <RelativeLayout
            android:id="@+id/events"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

               <SearchView
                    android:id="@+id/search"
                    android:queryHint="@string/hint"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
                </SearchView>

                <RelativeLayout
                    android:id="@+id/titleBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="20dp"
                    android:layout_below="@id/search" >

                    <TextView
                        android:id="@+id/resultName"
                        android:layout_width="180dp"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:text="@string/event"
                        android:textAppearance="?android:attr/textAppearanceMedium" />

                    <TextView
                        android:id="@+id/resultDate"
                        android:layout_width="80dp"
                        android:layout_height="wrap_content"
                        android:layout_toLeftOf="@+id/resultTime"
                        android:layout_toStartOf="@+id/resultTime"
                        android:text="@string/eventDate"
                        android:textAppearance="?android:attr/textAppearanceMedium" />

                    <TextView
                        android:id="@id/resultTime"
                        android:layout_width="40dp"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true"
                        android:text="@string/eventTime"
                        android:textAppearance="?android:attr/textAppearanceMedium" />

                </RelativeLayout>

                <ListView
                    android:id="@+id/event_list"
                    android:scrollbars="vertical"
                    android:fastScrollEnabled="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_below="@id/titleBar"
                    android:layout_above="@+id/DelAll" />

                <Button
                    android:id="@+id/DelAll"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:layout_marginStart="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_alignParentBottom="true"
                    android:text="@string/DelAll" />

            </RelativeLayout>

            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <LinearLayout
                    android:id="@+id/set"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical" >

                    <TextView
                        android:id="@+id/EventName"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/event" />

                    <EditText
                        android:id="@+id/eveName"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:inputType="text" >
                    </EditText>

                    <TextView
                        android:id="@+id/EventDate"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/eventDate" />

                    <DatePicker
                        android:id="@+id/datePicker1"
                        android:layout_width="match_parent"
                        android:layout_height="158dp" />

                    <TextView
                        android:id="@+id/EventTime"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/eventTime" />

                    <TimePicker
                        android:id="@+id/timePicker1"
                        android:layout_width="match_parent"
                        android:layout_height="109dp" />

                    <Button
                        android:id="@+id/Tim"
                        style="?android:attr/buttonStyleSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/Set" />

                </LinearLayout>

            </ScrollView>

        </FrameLayout>

    </LinearLayout>

</TabHost>

</LinearLayout>

A: If you don't want to use any listener then you can simply use a custom ListView like this,
public class CustomListView extends ListView implements View.OnTouchListener, AbsListView.OnScrollListener {

    private static final int MAXIMUM_LIST_ITEMS_VIEWABLE = 99;
    private int listViewTouchAction;

    public CustomListView (Context context, AttributeSet attrs) {
        super(context, attrs);
        listViewTouchAction = -1;
        setOnScrollListener(this);
        setOnTouchListener(this);
    }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem,
                         int visibleItemCount, int totalItemCount) {
        if (getAdapter() != null && getAdapter().getCount() > MAXIMUM_LIST_ITEMS_VIEWABLE) {
            if (listViewTouchAction == MotionEvent.ACTION_MOVE) {
                scrollBy(0, -1);
            }
        }
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        int newHeight = 0;
        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
        if (heightMode != MeasureSpec.EXACTLY) {
            ListAdapter listAdapter = getAdapter();
            if (listAdapter != null && !listAdapter.isEmpty()) {
                int listPosition = 0;
                for (listPosition = 0; listPosition < listAdapter.getCount()
                        && listPosition < MAXIMUM_LIST_ITEMS_VIEWABLE; listPosition++) {
                    View listItem = listAdapter.getView(listPosition, null, this);
                    //now it will not throw a NPE if listItem is a ViewGroup instance
                    if (listItem instanceof ViewGroup) {
                        listItem.setLayoutParams(new LayoutParams(
                                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                    }
                    listItem.measure(widthMeasureSpec, heightMeasureSpec);
                    newHeight += listItem.getMeasuredHeight();
                }
                newHeight += getDividerHeight() * listPosition;
            }
            if ((heightMode == MeasureSpec.AT_MOST) && (newHeight > heightSize)) {
                if (newHeight > heightSize) {
                    newHeight = heightSize;
                }
            }
        } else {
            newHeight = getMeasuredHeight();
        }
        setMeasuredDimension(getMeasuredWidth(), newHeight);
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (getAdapter() != null && getAdapter().getCount() > MAXIMUM_LIST_ITEMS_VIEWABLE) {
            if (listViewTouchAction == MotionEvent.ACTION_MOVE) {
                scrollBy(0, 1);
            }
        }
        return false;
    }
}

Then use in your layout,
 <CustomListView
  android:id="@+id/event_list"
  android:scrollbars="vertical"
  android:fastScrollEnabled="true"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_marginLeft="20dp"
  android:layout_marginRight="20dp"
  android:layout_below="@id/titleBar"
  android:layout_above="@+id/DelAll" />


text:
Q: Ignore HTML tags by specified name I have small function that returns me html path
getDomPath = function(el) {
  var count, element, path, selector;
  count = void 0;
  element = void 0;
  path = void 0;
  selector = void 0;
  element = el;
  if (!(el instanceof Element)) {
    return;
  }
  path = [];
  while (el.nodeType === Node.ELEMENT_NODE && el.id !== "jobs") {
    selector = el.nodeName.toLowerCase();
    if (el.id) {
      selector += "#" + el.id;
    } else if (el.className) {
      selector += "." + el.className;
    } else {
      count = $(el).prevAll().length + 1;
      selector += ":nth-child(" + count + ")";
    }
    path.unshift(selector);
    el = el.parentNode;
  }
  return path.join(" > ");
};

It works well, but sometimes i have in my code tags like


text:
Q: How can I make Microsoft Management Console high-DPI aware in Windows 8.1? Since Windows 8.1 doesn't allow system-wide "Windows XP style" high DPI support, how can I make the Microsoft Management Console apps (mmc.exe) high-DPI aware? There is no "Troubleshoot compatibility" context menu item for it.

A: On Windows 10 you can achieve the same effect by doing:
1: Depending which build you have (to find it, hit Windows+R, type "winver", press Enter) either:

*

*before build 15019: open Control Panel, Display, Change size of items, set a custom scaling level

*build 15019 or later: open Settings, System, Display, Custom scaling

Enter the scaling level manually, even if it's one that's available in the dropdown. You'll know you've done it correctly if you're prompted to sign out for the setting to take effect.
2: Save the following to a .reg file on your desktop and double click it to add the contents to your registry:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001

3: Save the following file as c:\windows\system32\mmc.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"  xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
<assemblyIdentity
    processorArchitecture="x86"
    version="5.1.0.0"
    name="Microsoft.Windows.MMC"
    type="win32"
/>
<description>Microsoft Management Console</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel
                level="highestAvailable"
                uiAccess="false"
            />
        </requestedPrivileges>
    </security>
</trustInfo>
<asmv3:application>
   <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
        <dpiAware>True/PM</dpiAware>
   </asmv3:windowsSettings>
</asmv3:application>
</assembly>

4: Open any MMC windows (Services, Device Manager, etc.) and they will now be bigger and sharper

A: The Compatibility tab is hidden for system files, so to replicate the functionality of the "Disable display scaling on high DPI settings" checkbox you would add the following to the registry:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Windows\\System32\\mmc.exe"="~ HIGHDPIAWARE"

This has the added benefit of making all MMC snap-ins like Group Policy Editor also use native scaling instead of the blurry rasterized version.
You can save that as .reg file and import it, or use paste the following command into the Run dialog:
reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\System32\mmc.exe" /f /t REG_SZ /d "~ HIGHDPIAWARE"
If you find yourself using that workaround often you may want to add it to the right click context menu for .exe files. You can also add it to .msi files since the Compatibility tab is missing for those files as well:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\exefile\shell\disabledpi]

[HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
@="Disable DP&I Scaling"

[HKEY_CLASSES_ROOT\exefile\shell\disabledpi\command]
@="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
"IsolatedCommand"="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"

[-HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]

[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
@="Disable DP&I Scaling"

[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi\command]
@="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"
"IsolatedCommand"="cmd /c @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\">nul"

Since the "Run as Administrator" and "Disable DPI scaling" settings are stored together, invoking that command on a file already set to run as admin will clear that flag and set the DPI scaling flag instead. That only affects files you've manually checked the box for, not those with the correct requestedExecutionLevel in their manifest.
Just for reference, when both are checked the string is "~ RUNASADMIN HIGHDPIAWARE" but I wouldn't put that into a context menu option since it's already available for one-time use on the context menu and it's not a good idea to make the administrator token necessary so easily.
If you want the option to disable DPI scaling for executable and installer files in a specific folder you can use the following .reg import:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\disabledpi]

[HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
@="Disable DP&I Scaling"

[HKEY_CLASSES_ROOT\Directory\shell\disabledpi\command]
@="cmd /c @start /min cmd /c for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="cmd /c @start /min cmd /c for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""

Using that option on a root-level folder like Program Files is a bad idea because you'll create hundreds of registry entries. But for some cases it's essential, particularly for Process Explorer and the rest of the Sysinternals utilities, or the Nirsoft utilities, all of which run great with DPI scaling disabled but don't have the option explicitly specified in their manifests.
The last batch of code uses the internal start command to get the command prompt window out of the way as quickly as possible and keep it minimized as it parses the contents of the folder. The @ symbol is used to prevent echoing back the command in the output, and nul redirection is used to hide the output "The operation completed successfully." for each entry since it never changes.
If you happen to have the excellent nircmd tool you can hide the brief flash of the command prompt window entirely:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\exefile\shell\disabledpi]

[HKEY_CLASSES_ROOT\exefile\shell\disabledpi]
@="Disable DP&I scaling"

[HKEY_CLASSES_ROOT\exefile\shell\disabledpi\command]
@="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""

[-HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]

[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi]
@="Disable DP&I scaling"

[HKEY_CLASSES_ROOT\Msi.Package\shell\disabledpi\command]
@="nircmd.exe execmd reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%1\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""

[-HKEY_CLASSES_ROOT\Directory\shell\disabledpi]

[HKEY_CLASSES_ROOT\Directory\shell\disabledpi]
@="Disable DP&I scaling"

[HKEY_CLASSES_ROOT\Directory\shell\disabledpi\command]
@="nircmd.exe execmd for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""
"IsolatedCommand"="nircmd.exe execmd for /f \"usebackq delims=\" %%i in (`dir /b /s \"%1\\*.exe\" \"%1\\*.msi\"`) do @reg add \"HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers\" /v \"%%i\" /f /t REG_SZ /d \"~ HIGHDPIAWARE\""

If nircmd.exe is not in your path you can either add its location above or add its folder to your path in the System Environment Variables dialog. To bring up that window you can use the command rundll32 sysdm.cpl,EditEnvironmentVariables
The argument could be made that it would be more elegant to add the registry keys by creating a .reg file at runtime and importing it silently with the undocumented reg import /s option. But in my experience, writing any files at runtime raises all sorts of alarms with security products like COMODO Internet Securita, its equivalent versions from Panda, Norton, etc. and anything based on a HIPS model. I don't see a need to do that when the above works just fine, especially if you're using this on multiple computers or sharing it and don't want to create a false alarm for someone else.
However if you're already using nircmd, it would make sense to use its regsetval command instead of reg add for the .exe and .msi shell extensions. The folder option would still need to iterate over the directory listing to add each entry so it won't work for those. PowerShell and VBScript are options but their availability depends on the version of Windows and a host of other variables. From a security standpoint, VBScript has a reputation as an exploit vector particularly when downloaded from the internet or shared on a network, and PS1 scripts won't run at all without explicitly setting PowerShell's execution policy to allow remote signed scripts.
Let me know if you notice anything odd when using that code as it's still a work in progress. That being said it should make configuring Windows 8.1's DPI settings much easier.


text:
Q: Displaying List TEXT not VALUE when using DisplayFor in HTML Helper I have an almost complete solution but I am stuck at the last hurdle!
Here is my DropDownList helper
    // DropDown helper
    public static MvcHtmlString DropDownInputFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> ListValues, string DefaultText, object HTMLAttributes, bool CanEdit)
    {
        if (CanEdit == true)
        {
            // return a dropdown
            return htmlHelper.DropDownListFor(expression, ListValues, DefaultText, HTMLAttributes);
        }
        else
        {
            // just return the text (no editor)
            return htmlHelper.DisplayFor(expression);
        }
    }

As you can see I am returning the helper depending on if the user can edit or not. In this case, if they can edit then we return the DropDownList and if they cannot edit we just return the DisplayFor.
The issue with this however is that the DisplayFor shows the 'value' (foreign key) as opposed to the text of the DropDown.
Any suggestions on how to Display the text not the value?

A: I understand that if CanEdit is false, you want just to show the text coresponding to the value in your ListValues. For that you can try something like:
// DropDown helper
        public static MvcHtmlString DropDownInputFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> ListValues, string DefaultText, object HTMLAttributes, bool CanEdit)
        {
            if (CanEdit == true)
            {
                // return a dropdown
                return htmlHelper.DropDownListFor(expression, ListValues, DefaultText, HTMLAttributes);
            }
            else
            {
                // just return the text (no editor)
                //but first make sure you have a valid value in your list and show it
                var selected = ListValues.FirstOrDefault(item => item.Selected == true);
                if (selected != null)
                    return htmlHelper.DisplayName(selected.Text);
                else
                    //here you can just put the default selected item if no valid value is found
                    return htmlHelper.DisplayName(ExpressionHelper.GetExpressionText(expression));//or whatever defaultvalue you want
            }
        }

The thing is that the text is included in your ListValues, and the selected item should match your expression value.


text:
Q: SQL Server Data Import Wizard using query from another server I have a SQL Server 2005 instance, into which I am trying to import data from a SQL Server 2008 instance using an SQL Query. I am using the 2008 management studio, and the import/export data wizard.
If I run the select query separately in the management studio, it correctly returns the ~88k rows that are required. The query returns the data with the exact column names and types required by the destination table.
When I run the import wizard, the sql query parses correctly, and the 'Preview' button correctly shows the data. There are no errors or warnings in the conversion section. The task is set to fail if there are any failures in conversion.
When I run the task, no errors are displayed. However, it shows '0 rows transferred' and no data is imported.
Any ideas why?
edit: tried importing to a table created on import in a fresh new db, and still the same result. I'm wondering if the direction of movement from 2008 to 2005 is important (i.e. 2005 can't handle a 2008 feed correctly).

A: If you have "USE [database]" as part of your query, then this single line is all that gets executed during the import/export.
The solution is to remove the "USE" statement as part of your query.

A: I've never had much luck with the SQL server management studio's import features under 2005/8.
Lately, I do one of two things.
Either I just use it to import the data into a brand new table on the target server (not even a table of the exact same structure) then run an insert statement to transfer from that newly created table into the destination.
Or I use a tool like Visual Studio for Database Professional (or Redgate) to transfer the data.

A: I've used the import successfully.   Chris has a good suggestion (this is the process I typically follow) though on using a middle table or file.  That gives you the ability to do some simple transforms using queries rather than SQL's transform tool.  It also gives you a buffer in case things go wrong or you need to isolate issues.

A: I had a similar problem using the import utility for 2008. We had Oracle native SQL that ran fine in TOAD but imported with 0 rows using the SQL Server import utility. The culprit ended up being related to Oracle's date format. The SQL referred to dates such as '03-JUN-2013'. Once I changed them to use the TO_DATE function such as TO_DATE('06/03/2013','MM/DD/YYYY') we had a successfully execution and import.


text:
Q: Google map to display many markers dynamically using php and jquery I have a Google map that I want to link to a database to display many markers dynamically using PHP and MySQL.
My code below
<?php
//This creates an array from the database and allows us to use it later in the jquery
//CREATE SQL STATEMENT
$sql_locations = "SELECT * FROM tbllocations";

//CONNECT TO MYSQL SERVER
require('test-connection.php');

//EXECUTE SQL STATEMENT
$rs_locations = mysqli_query($vconnection, $sql_locations);

//CREATE AN ASSOCIATIVE ARRAY
$rs_locations_rows = mysqli_fetch_assoc($rs_locations);
$place = $rs_location_rows['place'];
$city = $rs_location_rows['city'];
$long = $rs_location_rows['long'];
$lat = $rs_location_rows['lat'];
?>

The problem is that I get all of the markers variables from the associative array in php and they display if I echo them. However as I pass them through the jquery function in a do while loop, it only displays two of the markers on the map instead of all of the markers.
My theory is that I have not written my for loop inside my jquery correctly and this is causing the code to only display two markers.

A: I would guess, the problem is that you define the variables $place, $city, $long once and you never override it.
So maybe you have more than two markers but all except ['Palace of Westminster, London', 51.499633, -0.124755] are the same markers.
UPDATE: working example, commented out your sql stuff, and wrote some coordinates in the marker array. You have to adjust your infoWindowContentif you have this information in your Database you can also add this to the php $markerarray or create a new one like the $markerin this example.
Result: I get all of the defined markers. If this works try to remove the comment //from the stuff you need, If you still have problems, try this in your foreach for debugging:
foreach( $rs_locations as $rs_location ) {
  var_dump( $rs_location );
  ......

Working example:
//This creates an array from the database and allows us to use it later in the jquery
//CREATE SQL STATEMENT
$sql_locations = "SELECT * FROM tbllocations";

//CONNECT TO MYSQL SERVER
//<---------   require('test-connection.php');
//EXECUTE SQL STATEMENT
//<---------   $rs_locations = mysqli_query($vconnection, $sql_locations);

$markers = array(
    // your example['Palace of Westminster, London', 51.499633,-0.124755]
    array(
        'Palace of Westminster, London',
        51.499633,
        -0.124755
    ),
    array(
        'Westminster Abbey, London',
        51.4992453,
        -0.1272561
    ),
    array(
        'QEII Centre, London',
        51.4997296,
        -0.128683
    ),
    array(
        'Winston Churchill Statue, London',
        51.5004308,
        -0.1275243
    ),
    array(
        'Fitzroy Lodge Amature Boxing Club, London',
        51.4954215,
        -0.1154758
    ),
    array(
        'Balham Boxing Club, London',
        51.4419539,
        -0.1336075
    )
);

// use this for your code
//foreach( $rs_locations as $rs_location ) {
//  $markers[] = array(
//      "{$rs_location['place']}, {$rs_location['city']}",
//      $rs_location['long'],
//      $rs_location['lat']
//  );
//}
?>

EDIT: removed duplicate div

 from my example


text:
Q: Magento 1 - Fatal Error Helper I was in the process of following a tutorial showing how to make a module on my dev machine. The module didn't work for me so I decided to remove all files relating to it.
Now i'm getting the following error:
Still scratching my head over this as I can't find anything relating to it!
Any ideas please?
Fatal error:  Class 'Mage_Newslettersubscribe_Helper_Data' not found in C:\xampp\htdocs\magento\app\Mage.php on line 547

A: The problem most probably resides in your layout xml for the update or for a translation of a string in your template. The module Mage_Newslettersubscribe seems not to exists with 1.9 (I am checking on my machine but I am almost sure). If it does not exists either on yours, then try to look for the module that implements this helper and remove it. You can use debug_print_backtrace(2) in Mage.php line 547 to see where is that called. The option for debug_print_backtrace is really important has a lot of data can be passed as arguments.
To go further :

*

*Magento first tries to find the helper defined like that in any of the configuration of modules (first in local, then in community, then in core). The normal way is to call helpers like mycompany/mymodule but some does not follow this rule. In some cases the fallback goes to magento modules themselves and if it still does not exists, it crashes.

*The problem can also occurs using the $this->__('translation of string') in a template. Magento will try to find out what this stands for using the previously described fallback system. For example, if you have a block called newslettersuscrbe/typeofblock.

*Eventually, it can happen to be a windows naming problem as it looks like that you use windows. Windows is not case sensitive by default therefore it can work on your machine but not on the server (it is not your case at the moment but I tell that it happens)


text:
Q: "Generalised Isotropy" Let $G\subseteq S_N$ be a finite permutation group and $\mathcal{P}=\bigsqcup_{i=1}^nX_i$ a partition of $\{1,\dots,N\}$.
We can define a subgroup $G_{\mathcal{P}}\subseteq G$ by:
$$G_{\mathcal{P}}:=\{\sigma\in G\,\colon\,\sigma(X_i)=X_i\}.$$
In particular, the isotropy subgroup $G_i$ is given by $G_{\mathcal{P}_i}$ where $\mathcal{P}_i:=\{i\}\sqcup(\{1,\dots,N\}\backslash \{i\})$.

Question: has such a construction $G_{\mathcal{P}}\subseteq G$ got a name in the literature? If not known, can be come up with a better name than "generalised isotropy". Perhaps something with "orbits"

I see the same construction here.

A: It's the stabilizer subgroup of $P$, with respect to the action of $G$ on (edit: ordered / labeled) partitions.


text:
Q: Windows phone emulator not being started I am facing a strange issue with Windows Phone Emulators for last a few days. When I try to run any windows phone application from Visual Studio 2013/2012, it initially starts the emulator and then stops with an error displayed in the error window inside visual studio:
Error : DEP6100 : The following unexpected error occurred during boostrapping stage 'Connecting to the device':
SmartDeviceException - App deployment failed. Please try again.

I have been trying many solutions in order to fix this issue but nothing helped. At last I re-installed the whole windows 8.1 and then visual studio 2013. Then I created a windows phone 8 application and run it smoothly in windows phone emulator.
Then I installed all windows updates including windows 8.1 update 1. After that I installed the visual studio 2013 update 2. Now if I run any new/existing windows phone 8/8.1 project I get the same error again. Seems like there is something wrong with windows 8.1 updates or visual studio 2013 update 2.
Any help?

A: *

*Open network and sharing center

*Change adapter settings

*Check if vEthernet  [Windows phone emulator internal switch is enabled)

*Try deploying it to the emulator now

If above does not work

*

*Delete the virtual switch(s) if any and do a deployment

*If it still does not work, connect to the internet via a LAN

*Keep you'r wifi on

*do a deployment to the emulator

Most cases above method worked !

A: I had the same error when i tried switching the target OS version of my app from Windows Phone 8 to 8.1. With 8.1 you get a new manifest file and if, for app or publisher identification string, you have different values in one manifest file than in the other, it will output that exact error when trying to start the app in the emulator. However after searching the web back when i had that error, this error seems to have quite a bunch of possible sources, this being only one among many other, but be sure to check it.

A: Uninstalling the symantec antivirus fixed my issue.


text:
Q: Windows XP domain user's first-time login repeats initial desktop setup ad nauseam Here's the scenario:

*

*Login to Windows XP. Let's say it is a member of domain foo. ("It is a member of domain foo.")

*You login with a valid username/password on domain foo.

*You authenticate, and then Windows starts setting up your desktop for the first time.

*You logout ... then you login again ... and Windows starts setting up your desktop all over again!

*Rinse and repeat ad nauseam.

"Wha happen?"

A: Ah-ha! Found the culprit.
This account used to be used only on a Windows 2000 system. Now they're on XP.
Now, it's true that I set them up to be in Power Users on the PC in question. However, they're a member of "Domain Guests" vs. "Domain Users" (or a more specific group) according to Windows Server 2003's AD.
I switched them to "Domain Users" and set that as the primary group. No more repeated pzn. :)
Thanks to all for the clues/advisement!

A: I've seen this happen in Vista when the users profile was corrupted causing it to build a temporary profile every login. Just removing the profile folder from the Users folder corrected the issue on the next login when it created a new user profile correctly.
Might also be caused by GPO writing the profile to an alternate profile location.
Have you tried any troubleshooting on it?

A: Look in the C:\Documents and Settings\ folder to see if the new users profile directory is being created or might be duplicating with a number in the directory name or is it duplicating with a .machine/domain extension. Knowing what is or isn't happening in the profile directory should help in determining what the problem is.
Just as a brief overview... When a new user logs in, Windows first looks to see if they have a roaming profile to copy locally. If not found it then builds the users initial profile by copying a default profile from one of two locations; first it looks in the directory "%LOGONSERVER%\NETLOGON\Default Profile" if this is not found it then uses the local default profile "C:\Documents and Settings\Default User". Once the directory is copied, it then runs through a task list that various applications may have added to, stored in the registry, for tasks that need to be done to a new account. The Internet Explorer setup wizard is an example of this. When the new user process is complete the logon continues as normal. If this is a roaming account, when the user logs off Windows will synchronize the remote directory with any local changes.

A: Have you tried getting the user in question to log on to another machine to see if the problem is replicated there?  This is the FIRST thing I always do when troubleshooting issues like this, and it will tell you if the problem is with the user account or with the machine.
No point in trying to troubleshoot the one if the cause of the issue lies with the other...


text:
Q: I'm trying to create function to fetch data I'm trying to create function to fetch data with multiple arguments but i dont know how to get them in combination.Its fetching first argument then second and so on not combined
function GetProductByIng(...$ingridients) {
    global $db;
    $ings = implode(',',$ingridients);
    $querys = $db->query("SELECT DISTINCT p.prod_id, p.prod_name, ig.name
                          FROM products p
                            LEFT JOIN product_ingridients pi ON ( p.prod_id = pi.prod_id)
                            LEFT JOIN ingridients ig ON (pi.ing_id = ig.id)
                          WHERE pi.ing_id IN ($ings)");

    $result = $querys->fetch_all();

    return $result;
}

if anyone can help me to edit it and get combination
product_ingredients
id |   prod_id   | ing_id
---+-------------+--------
1  |      1      | 1
2  |      2      | 5
3  |      1      | 5
4  |      2      | 1
5  |      3      | 1
6  |      3      | 7


text:
Q: Can I get the Emprise shards without killing this dragon? One of my runs through Dragon Age Inquisition is getting pretty high-level, and nearing the end of the game. As such, one of the things I'd like to do is complete all the Shard collection quests, and pick up the resistance boosts that result, to make later dragon hunting a lot easier. Unfortunately, while trying to gather all the shards in the Emprise Du Lion, I came across this Ocularum:

As you can see, even though I'm invisible and not engaged in combat, because the dragon is a boss fight, its health bar is still up. Because of this, I can't seem to get my character to activate the Ocularum, and find the shards; I'm considered in-combat despite having put my weapons away, which is normally enough when around regular enemies.
Is there any way at all to activate it without having to go through the trouble of killing the dragon?

A: Sort of complicated, but stand next to the ocularum, activate an ability, and hit the tactical camera while in the animation.  You can then click to interact despite being in combat.  Unpause the game and you should enter ocularum mode.

A: So, in spite of this being months later, I just encountered this problem. If you stand in front of the ocularum, save there, then reload, the game will let you activate it. It worked for me, anyway. I found the last seven shards on that map then hightailed it out of there so I could fight the dragon later.
Cheers.


text:
Q: Jruby 1.6.8 tomcat deployment issue (org.jruby.rack.rails.RailsServletContextListener) I'm trying to deploy a JoR application with a war file built using warbler-0.9.14 to Tomcat 7. However when I try and start the app, I get the following error

Jul 09, 2016 3:48:13 PM org.apache.catalina.core.StandardContext listenerStop
  SEVERE: Exception sending context destroyed event to listener instance of class org.jruby.rack.rails.RailsServletContextListener
  java.lang.NullPointerException
      at org.jruby.rack.SharedRackApplicationFactory.destroy(SharedRackApplicationFactory.java:58)
      at org.jruby.rack.RackServletContextListener.contextDestroyed(RackServletContextListener.java:50)
      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5146)
      at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5810)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
      at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1312)
      at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:690)
      at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:216)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)

:
I just don't know enough about Java/jruby to know what I'm missing. Any help or reference to any docs would be very appreciated. The codebase is very old and there is no documentation. I've determined that it's using jruby-1.6.8 and rails 2.3.5.
Here's the web.xml

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

  <context-param>
    <param-name>rails.env</param-name>
    <param-value>development</param-value>
  </context-param>

  <context-param>
    <param-name>public.root</param-name>
    <param-value>/</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.min.runtimes</param-name>
    <param-value>2</param-value>
  </context-param>

  <context-param>
    <param-name>jruby.max.runtimes</param-name>
    <param-value>4</param-value>
  </context-param>

  <listener>
    <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>Rails</servlet-name>
    <servlet-class>org.jruby.rack.RackServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Rails</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <servlet>
      <servlet-name>ImageServlet</servlet-name>
      <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
  </servlet>

  <servlet-mapping>
      <servlet-name>ImageServlet</servlet-name>
      <url-pattern>/servlets/image</url-pattern>
  </servlet-mapping>

  <security-constraint>
      <web-resource-collection>
          <web-resource-name>Forbidden</web-resource-name>
          <url-pattern>/*</url-pattern>
          <http-method>DELETE</http-method>
          <http-method>TRACE</http-method>
          <http-method>OPTIONS</http-method>
      </web-resource-collection>
      <auth-constraint />
  </security-constraint>

</web-app>

A: Looks like jruby-rack was the problem. The version of warbler I was using was really old, so I ended up upgrading to 1.4.9 which upgraded jruby-rack to jruby-rack-1.1.20.jar.


text:
Q: EditText Height Issue I am trying to set smaller height of EditText but still have not managed it. Here is my source:
<EditText android:layout_width="150dp" android:layout_height="20dp"
      android:singleLine="true" android:textSize="10dp" />

This code cuts out text and a white rectangular shape appears around EditText control. I have also tried maxHeight/minHeight properties, but did not worked either. If anybody have solved this issue, please help.
Or is this is the bug in the android? I can not even resize Spinner, same happens as with EditText.
Thanks
Irfan

A: You are probably seeing bizarre orange rectangular shapes within the field when testing in the emulator ?
If so then I have managed to work out some basic rule-of-thumb on size settings. Your textSize needs to be a little bigger. Try 30dp.
With some experimentation I have found that if you use "dp" and apply this rule of thumb, it should work for EditText fields.
textSize x 3= layout_height
I say rule of thumb because the minimum height before the field "breaks" again is about 29dp. So, for example if you have textSize="10dp", then layout_height="30dp", or textSize="12dp", then layout_height="36dp". You can have smaller textSizes, but it becomes illegible lower than 9dp. I found this works well in relative_layouts with default fonts.


text:
Q: What is nedeed to prove that the tangent space on a manifold is a vector space? I am currently working with the definition of tangent vectors being equivalence classes of curves. So $v =[\gamma]$ and $w=[\sigma]$ where $v,w$ are the vectors. I want to prove that the sum of this two equivalence class is also a equivalence class to give it the vector space structure.  We define the sum as:
$v+w= [\phi^{-1} \circ (\phi \circ \gamma + \phi \circ \sigma)]$
where $\phi$ is a chart. I understand that the curves can not be added when they belong to the manifold, that's why we first map then into the reals where that can be performed. So now that the sum is defined, how can I prove that is another class at the point $p$ on $M$. Is it enough to make sure that the map passes by $p$? The same questions goes for the multiplication by the scalar. Thanks

A: Having read your post more carefully, here's a one-sentence summary of your mistake: you're trying to add (and scalar multiply) the curves in $\Bbb{R}^n$, rather than their velocities. As you observed, adding the curves messes up things with the base points.

As a set, we have $T_pM$ is the set of equivalence classes of smooth curves, $[\gamma]$, where $\gamma$ is defined on some open interval containing $0$ such that $\gamma(0)=p$. Now, for any chart $(U,\phi)$ about the point $p$, consider the function $F_{\phi,p}:T_pM \to \Bbb{R}^n$ defined as
\begin{align}
F_{\phi,p}([\gamma]):= (\phi\circ \gamma)'(0).
\end{align}
This function is well-defined because of how the equivalence relation is defined. Notice the intuitive meaning: $\gamma$ is a curve with values in the manifold $M$, so if we use a chart, we can get a corresponding curve $\phi\circ \gamma$ with values in the Banach space (i.e a normed vector space) $\Bbb{R}^n$, and we know how calculus works in the setting of vector spaces. So, all this map $F_{\phi,p}$ does is it takes a curve $[\gamma]$ and maps it to the "velocity vector" $(\phi\circ \gamma)'(0)$. I hope this is intuitive (otherwise, just draw a few pictures to see where each object is).
Now, it is also easy to verify that $F_{\phi,p}$ is a bijective function; I leave it to you to verify that $G_{\phi,p}:\Bbb{R}^n\to T_pM$ defined as
\begin{align}
G_{\phi,p}(v):= [t\mapsto \phi^{-1}(\phi(p)+tv)]
\end{align}
is the inverse function. In words, what we're doing is we're taking a vector $v\in\Bbb{R}^n$, and considering the straight line $t\mapsto \phi(p)+tv$. This is a curve based at the point $\phi(p)$, in the direction $v$. Since $\phi$ is a homeomorphism, it follows that for small enough values of $t$, we have $\phi(p)+tv\in \phi(U)=\text{domain}(\phi^{-1})$, hence we can consider the equivalence class of the curve $t\mapsto \phi^{-1}(\phi(p)+tv)$.

So, what has all this extra notation yielded? Well, we have a bijective function $F_{\phi,p}:T_pM\to \Bbb{R}^n$, and of course, $\Bbb{R}^n$ is a vector space, so by basic linear algebra, we can "pull back" the vector space structure of $\Bbb{R}^n$ so as to make $F_{\phi,p}$ a linear isomorphism. Explicitly, what I mean is that we can define addition and scalar multiplication $+_{\phi}$ and $\cdot_{\phi}$ (I put the subscript because everything is chart-dependent so far) as follows:
\begin{align}
\begin{cases}
[\gamma_1]+_{\phi} [\gamma_2]&:= F_{\phi,p}^{-1}\bigg(F_{\phi,p}([\gamma_1])+
F_{\phi,p}([\gamma_2])\bigg)\\
c\cdot_{\phi}[\gamma]&:= F_{\phi,p}^{-1}\bigg(c\cdot F_{\phi,p}([\gamma])\bigg)
\end{cases}
\end{align}
If you unwind all the definitions, then
\begin{align}
c\cdot_{\phi}[\gamma_1]+_{\cdot}[\gamma_2]= [t\mapsto \phi^{-1}\left(\phi(p) + t(c\cdot (\phi\circ \gamma_1)'(0)+(\phi\circ \gamma_2)'(0))\right)]
\end{align}
Hopefully, the idea is clear enough: you have a bijection, so you just push everything forward, do the computations in $\Bbb{R}^n$, then bring everything back to $T_pM$, and that's how addition and scalar multiplication is defined. I leave it to you that all the vector space axioms are satisfied and that $F_{\phi,p}$ is a linear isomorphism etc.
One final thing to note is that so far the addition and scalar multiplication have been defined using a particular chart $(U,\phi)$, but actually, it is a simple chain rule exercise to verify that if you have a different chart $(V,\psi)$, then $+_{\phi}=+_{\psi}$ and $\cdot_{\phi}=\cdot_{\psi}$, so the vector space structure on $T_pM$ is actually chart-independent, hence we just denote it as $+$ and $\cdot$ as usual. I leave it to you to unwind definitions, use chain rule etc to verify this. If you have trouble, let me know, maybe I can elaborate more.


text:
Q: sendmsg or sendmmsg for pure L2 packets I want to send pure L2 packets using RAW sockets.
As i wish to send multiple packet in single SEND system call, i am intended use sendmmsg.
I understand how to allocate buffer and fill struct msghdr and struct iovec.
But I always get error from sendmmsg   "No such device or address"
Do i have to update any other members of this structure, apart from iov and iovlen
struct msghdr
{
    void    *msg_name;
    socklen_t    msg_namelen;
    struct iovec    *msg_iov;
    size_t    msg_iovlen;
    void    *msg_control;
    size_t    msg_controllen;
    int    msg_flags;
};

Do i have to update my interface index or SRC MAC  or Destination MAC in this struct msghdr explicitly.
Data that I assign in iov_base is compete L2 frame (with src and dest MAC etc..)
Could some help me here ............

A: Raw sockets allow to send L3 packets, i.e IP layer packets bypassing the L4 transport layer.
Ex. ICMP protocol uses RAW sockets.
If you need to send an L2 packet, you need to have kernel module which allocates an skb(socket buffer) and populates with all the details for ex, SOURCE mac, DESTINATION mac, protocol type, outgoing interface and hand it to the driver for transmission over the appropriate interface.
You also may need to have a communication channel(netlink socket or simple char driver) for communication between your user level application and kernel module.
Socket calls like send, sendmsg don't help to do what you are trying.


text:
Q: Does Future work on App Engine? Does the Future library works on App Engine? If not, what is a good alternative library that does work on top of GAE?

A: You cannot use threading on App Engine.  See Are there any third-party libraries not supported by Google App Engine?, which includes the bullet point "Threading is not available".
You might be able to accomplish what you need to accomplish via the Task Queue api.  See Python Threads (or their equivalent) on Google App Engine for (slightly) more info.


text:
Q: Draw polygons in the position of the mouse click I'm trying to draw some polygons in a stack panel. They should be centered where I click with the mouse. They are created, but they are always centered in the middle of the Border Panel, and not where I click. Can someone find the error? (Sorry if there are some italian words, and sorry also for my bad english).
public class Prova2 extends Application{
StackPane tavola = new StackPane();
@Override
public void start(Stage stage){
    stage.setTitle("Peace!");
    stage.setHeight(600);
    stage.setWidth(600);

    BorderPane layout = new BorderPane();

//LEFT
    Label lb = new Label("DRAW");
    VBox container = new VBox();
    final ComboBox disegna = new ComboBox();
    disegna.getItems().addAll(
            "CIRCLE",
            "TRIANGLE",
            "SQUARE");
    disegna.setValue("Choose");
    final ColorPicker colorPicker = new ColorPicker(Color.BLACK);
    TextField input = new TextField("");

    container.getChildren().addAll(lb, disegna, colorPicker, input);

    layout.setLeft(container);
    BorderPane.setAlignment(container, Pos.CENTER);

    //CENTER

    tavola.setStyle("-fx-border-color: black;");
    layout.setCenter(tavola);

    //RIGHT
    Button cancella = new Button("DELETE");
    layout.setRight(cancella);
    BorderPane.setAlignment(cancella, Pos.CENTER);

    //AZIONI COMBOBOX
    tavola.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent arg0) {
            double x = arg0.getX();
            double y = arg0.getY();
            System.out.println("X:Y "+x+":"+y+"\n");
            double m;
            if(input.getText().isEmpty()){
                m = 30;
            }
            else{
                m=Double.parseDouble(input.getText());
            }
            if(disegna.getValue().equals("CIRCLE")){
                Circle c = new Circle();
                c.setCenterX(x);
                c.setCenterY(y);
                c.setRadius(m);
                c.setOpacity(1);
                c.setFill(colorPicker.getValue());
                c.setStroke(Color.BLACK);

                tavola.getChildren().add(c);
            }
            if(disegna.getValue().equals("TRIANGLE")){
                Polygon t = new Polygon();
                m=1.73*m;
                t.setLayoutX(x);
                t.setLayoutY(y);
                t.getPoints().add(50.0);
                t.getPoints().add(0.0);
                t.getPoints().add(100.0);
                t.getPoints().add(100.0);
                t.getPoints().add(0.0);
                t.getPoints().add(100.0);
                t.setOpacity(1);
                t.setFill(colorPicker.getValue());
                t.setStroke(Color.BLACK);
                tavola.getChildren().add(t);
            }
            if(disegna.getValue().equals("SQUARE")){
                m=1.41*m;
                Rectangle q = new Rectangle();
                q.setX(x);
                q.setY(y);
                q.setHeight(m);
                q.setWidth(m);
                q.setOpacity(1);
                q.setFill(colorPicker.getValue());
                q.setStroke(Color.BLACK);
                tavola.getChildren().add(q);
            }
        }
    });

    cancella.setOnMouseClicked(new EventHandler<MouseEvent>(){
                @Override
                public void handle(MouseEvent arg0) {
                    tavola.getChildren().removeAll(tavola.getChildren());
                }
    });

    Scene scene = new Scene(layout);
    stage.setScene(scene);
    stage.show();

}

public static void main(String[] args) {
    Application.launch(args);
}

}

A: The reason is, you are using a StackPane as DrawPanel. By default a StackPane sets its added elements in the center of the Pane, if the new child could not be sized to fill it as described in the javadoc:

The stackpane will attempt to resize each child to fill its content
  area. If the child could not be sized to fill the stackpane (either
  because it was not resizable or its max size prevented it) then it
  will be aligned within the area using the alignment property, which
  defaults to Pos.CENTER.

For drawing purposes I usually tend to use an AnchorPane. You might wonna give it a try unless you have reasons for using a StackPane.


text:
Q: Network protocol internals Is there any good book about networks and network protocols?  One question I currently have is: How does the operating system determine the IP address of the router in a LAN?
I want to understand those basics. I know that I can look up most of the common protocols by searching for their respective RFC, but I don't even know which protocols are used for which purpose.

A: The operating system knows the ip address of the first router (default gateway), because someone told it - either manually when configuring the TCP/IP settings or dynamically via DHCP, BOOTP or similar.
There are plenty of good book suggestions in the closed question "What are good books on computer networks"

A: http://www.pearsonhighered.com/kurose-ross/
http://books.google.co.in/books/about/Computer_Networks.html?id=Pd-z64SJRBAC
Both are good books. Enjoy !!


text:
Q: Advanced Search - Need ideas I use c# MVC(LINQ) to build some system,
I need to search data from one of the tables,
The table contains millions of rows, and in each search I get back thousands results, to prevent this I "take"(LINQ) only 100 every time and "skip"(LINQ) the number of page * 100.
I also allow to order(orderBy - LINQ) the results by the table rows(so the skip and take affected by this).
At the moment for simple search I wrote 10 function for 10 columns, and in every function I  wrote a lot of code so it work properly with the "order by"(10 columns).
Now I need to allow  Advanced Search(search on more than one column) and I have no idea of how to do so,
I'm sure that there is better way for do what I want.
I only need an idea of how to do advanced search using LINQ without actually write the SQL query.


text:
Q: WPF - synchronous UI update If I understand correctly changing any control in WPF (eg. text of a Label) enqueues an update in Dispatcher. Dispatcher waits for my code to finish and when it has time it processes the whole queue.
For this, calling
double  current = 0;
ReportProgress (0d, "ProcessingStarted");
foreach (var item in collection)
{
        item.Process(); //takes about 10s
        current++;
        ReportProgress (current / (double)collection.Count, "Processing item No. " + current.ToString () + " finished");
}
ReportProgress (1d, "Finished");

where ReportProgress invokes an event with this event handler
private void handlerProgressMade (object sender, ProgressEventArgs e)
{
    pbProgress.Value = pbProgress.Maximum * e.Percent;
    lbProgressMessage.Content = e.Message;
}

ends up with full progressbar and message "Finished" displayed, but the intersteps are not shown.
I am aware that it could be done by calling the function in different thread and updating UI asynchronously (and it is going to happen at some point), but for now adding threads seems like unnecessary complication.
How to force the Dispatcher to update and redraw immediately?

A: if you dont want to use background thread, then before and after you set the progress bar value, old hack of Application.DoEvents() might help as it will wait to clear all message queue that got piled up in the GUI Message Bus


text:
Q: Inserting rows of one matrix into rows of another matrix sequentially I have two matrices M1 and M2. Both have same number of columns but different number of rows. I want to make a new matrix M which should have 1st row form M1, second row form M2, third row form M1, fourth row from m2 and so on. For example,
M1 = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
M2 = {{10, 11, 12}, {13, 14, 15}, {16, 17, 18}, {19, 20, 21}, {22, 23, 24}};

and my final matrix should be
M = {{1, 2, 3}, {10, 11, 12}, {4, 5, 6}, {13, 14, 15}, {7, 8, 9}, {16, 17, 18}, {19, 20, 21}, {22, 23, 24}};

Please note length of each matrix is over 1000. Thank you for your help.

A: Join @@ Flatten[{M1, M2}, {{2}, {1}}]
(* {{1, 2, 3}, {10, 11, 12}, {4, 5, 6}, {13, 14, 15}, {7, 8, 9}, {16, 17,
   18}, {19, 20, 21}, {22, 23, 24}} *)

Reference for using the second argument of Flatten to transpose a ragged array.

Update: even shorter (big praise to Flatten):
Flatten[{M1, M2}, {2, 1}]

A: Another method is with Riffle:
If[Length[M1] > Length[M2],
 Riffle[M1, M2, {2, 2 Length@M2, 2}],
 Riffle[M2, M1, {1, 2 Length@M1, 2}]
]

but the Flatten method is nicer, since it doesn't need the length-comparison logic.
Edited to reflect kguler's nice use of the third Riffle option.


text:
Q: How to turn off key handling on BasicTreeUI BasicTreeUI (in JDK 1.5) handles key events on JTree by navigating to an item on the tree that starts with that letter. What is the most straight forward way to turn that behavior off?

A: I think the most straightforward way is to override the createKeyListener method:
tree.setUI(
        new BasicTreeUI(){
            protected KeyListener createKeyListener(){ return null; }
        }
    );

A: Don't know much about JTree, but it provides a method you can customize:
JTree tree = new JTree(...)
{
    public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias)
    {
        return getLeadSelectionPath();
    }
};


text:
Q: Need location of image for preference pane "PREF" icon I have a stack in my Dock with aliases to my most-used preference panes. In the past, the icons that appear in the grid when I click on the stack have been the large descriptive icons shown in Finder. Since upgrading to Lion, instead, I'm getting new icons. The descriptive icon is small, surrounded by a gear, and the word PREF is under it. At a glance, it's no longer possible to tell which preference pane is which.
Finder doesn't show these large "gear/PREF" icons; the stack and QuickLook do.
Where might I find the image for this icon so I can start figuring out how to replace it? It's nowhere inside the packages for the individual preference panes, System Preferences.app, or Dock.app.

A: You lift the the icon of any prefpane by the "get info trick"
http://support.apple.com/kb/ht2493
Also I'm seeing icons in the prefpane bundles in Contents/Resource/xxxx.icns


text:
Q: WM_NCHITTEST not changing mouse cursor I have a Layered Window (WS_EX_LAYERED) that implements a custom NCHITTEST and NCCALCSIZE to make the client rect of my window the same as the window rect.  My window sizes and paints correctly; I can return HTBOTTOM from WM_NCHITTEST when the cursor is near the bottom edge of my window to cause a vertical-resize-window-from-the-bottom type action.  However, I am not getting the vertical resize cursor.   Is there way a do fix this without having to implement WM_SETCURSOR and test the pointer's position vs the edges of the windows?
Here's a snippet of my code:
case WM_NCCALCSIZE:
    // Bypass DefWindowProc, so the Window Rect == Client Rect
    return 0;
case WM_NCHITTEST:  {
    RECT w;
    ::GetWindowRect(hwnd, &w);
    // Compare the mouse X/Y vs the rect of the window to detect
    // resizing from the bottom edges
    int r = HTCLIENT;
    int x = GET_X_LPARAM(lParam);
    int y = GET_Y_LPARAM(lParam);
    if (w.bottom - y < 10) {
         // If I was not using NCHITTEST, I should get a verticle resize pointer here
        if (x - w.left < 10)
            r = HTBOTTOMLEFT;
        else if (w.right - x < 10)
            r = HTBOTTOMRIGHT;
        else
            r = HTBOTTOM;
    }
    return r;
    }

A: You need to handle the WM_SETCURSOR message - the low-order word of lParam specifies the hit-test code.
For instance,
case WM_SETCURSOR:
    switch (LOWORD(lParam))
    {
        case HTBOTTOM:
            SetCursor(LoadCursor(0, IDC_SIZENS));
            return 0;
            }
        }
    }
    return DefWindowProc(hWnd, uMsg, wParam, lParam);


text:
Q: why is this backgroundworker code causing this error: Parameter count mismatch what is wrong with this code below?  The conn_PageDeleted is coming from a background thread and i am trying to update a label every time i get a call back.  I get an error stating
Parameter count mismatch.
Here is the code:
    private void cmdDeletePage_Click(object sender, EventArgs e)
    {
         worker = new BackgroundWorker();
         worker.DoWork += new DoWorkEventHandler(worker_DoWork);
         worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
         worker.RunWorkerAsync();
    }

    void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
    {
        lblDeleteStatus.Text = "";
        MessageBox.Show("Complete");
    }

    void worker_DoWork(object sender, DoWorkEventArgs e)
    {
        Connecter conn = new Connecter("a", "m");
        conn.PageDeleted += new Connecter.PageDeletedHandler(conn_PageDeleted);
        bool success = conn.DeletePage(txtPageToDelete.Text, chkRecursive.Checked);
    }

    public delegate  void UpdateLabelHandler(object sender, string name);

    void conn_PageDeleted(object sender, string name)
    {
        if (this.InvokeRequired)
        {
            this.BeginInvoke(new UpdateLabelHandler(UpdateMe));
        }
        else
        {
            lblDeleteStatus.Text = name;
        }
    }

    private void UpdateMe(object sender_, string name_)
    {
        lblDeleteStatus.Text = name_;
    }

A: You should pass the parameters to the UpdateMe method, try this:
void conn_PageDeleted(object sender, string name)
    {
        if (this.InvokeRequired)
        {
            this.BeginInvoke(new UpdateLabelHandler(UpdateMe), new object[] {sender, name}); //<-- the update goes here
        }
        else
        {
            lblDeleteStatus.Text = name;
        }
    }

A: Your delegate has to match the signature of the event handler, something like this:

public delegate void UpdateLabelHandler(object sender, string strArgs);

Edit: Since you have edited the code to include this ... I will amend this accordingly....
Looking at your edited code, I have to question this:

    void worker_DoWork(object sender, DoWorkEventArgs e)
    {
        Connecter conn = new Connecter("a", "m");
        conn.PageDeleted += new Connecter.PageDeletedHandler(conn_PageDeleted);
        bool success = conn.DeletePage(txtPageToDelete.Text, chkRecursive.Checked);
    }

You are wiring up a 'PageDeleted' event handler....and call 'DeletePage' method after it, I presume that in turn invokes the event handler 'conn_PageDeleted' within the 'DoWork' body, it goes out of scope when the 'BackgroundWorker' thread is finished...and since 'conn' is in local scope of the 'worker_DoWork' method, that gets destroyed, and somehow your event handler gets messed up! Can you confirm this?
Hope this helps,
Best regards,
Tom.


text:
Q: QTreeWidgetItemIterator with a "subtree" I am trying to iterate over a part of a QTreeWidget. So I use a QTreeWidgetItemIterator and the constructor with a QTreeWidgetItem.
But the iterator does not visit only the item and its children but "ascend" and continue after the given item.
QTreeWidgetItem *root = topLevelItem(0);
QTreeWidgetItemIterator it(root);

while (*it)
{
   qDebug() << (*it)->text(0);
   ++it;
}

So I obtain this instead of having only 1x nodes.
node1
    node11
    node12
node2
    node21

Is it normal ? Is it possible to use this iterator to iterate on a node ?
Thanks.

A: Not very familiar with QTreeWidget, but I rerun something similar, and it seems that their iterator iterates from the starting node to the end of the tree. In this case this should do the job (although a little bit ugly):
QTreeWidgetItem *root = topLevelItem(0);
QTreeWidgetItemIterator it(root);
int nodesCount = 1; //for root, each visited child will update the count

for (int i = 0; i < nodesCount; ++i)
{
   qDebug() << (*it)->text(0);
   nodesCount += (*it)->childCount; //update the count for this node children
   ++it;
}


text:
Q: publishing wsdl with gSOAP stand-alone server? Now, I developed a gSOAP stand-alone server on 8080 port and it's working for SOAP RPC.
But I want to return wsdl content of a wsdl file in my file system when clients request for getting wsdl on the 8080 port.
what I can do to return wsdl to clients?

A: I used xd tool to generate a embbed version of my wsdl and store it a wsdl.h file with this command line (I`m doing this in my CMakeList.txt):
${GSOAP_ROOT_DIR}/bin/win32/xd -dwsdl ${CMAKE_CURRENT_BINARY_DIR}/${SOAP_NAME_SERVICE}.wsdl > ${CMAKE_CURRENT_BINARY_DIR}/wsdl.h

After that, I implemented this function, that can be better to lead with parameters in GET request:
int http_get(struct soap *soap)
{
  soap_response(soap, SOAP_HTML); // HTTP response header with text/html
  soap_send(soap, (const char*)wsdl);
  soap_end_send(soap);
  return SOAP_OK;
}

So, I configure this function to lead with all GET commands received by gSoap:
.
.
.
struct soap soap;
soap_init(&soap);
soap.fget = http_get;
.
.
.

Then, when your server receive a HTTP/GET request, your function will be called and send  the wsdl file. If you want, you can read WSDL file at runtime and send in soap_send() instead to embbed WSDL in your code like I did.


text:
Q: $\int_{0}^1 \ln^2 (x) / (x+1)^2 dx$ using contour integration? I am not even sure if I can apply contour integration over this. But I tired
and saw that $(z+1)^2$ gets cancelled in the denominator giving me no real part and only $-2i \pi$.

A: In this answer it's shown using contour integration that
$$
\int_0^{\infty} \frac{\ln^2(x)}{(1+x)^2}\, dx  = \frac{\pi^2}{3}
$$
Now just notice that
\begin{align}
\int_0^{\infty} \frac{\ln^2(x)}{(1+x)^2}\, dx  &=\int_0^{1} \frac{\ln^2(x)}{(1+x)^2}\, dx   + \int_{1}^{\infty} \frac{\ln^2(x)}{(1+x)^2}\, dx\\
& \overset{\color{blue}{u = 1/x}}{=}\int_0^{1} \frac{\ln^2(x)}{(1+x)^2}\, dx + \int_{1}^{0}\frac{\ln^2\left(\frac{1}{u} \right)}{\left(1 + \frac{1}{u^2} \right)} \left( -\frac{1}{u^2}\right) \, du\\
& = 2\int_0^{1} \frac{\ln^2(x)}{(1+x)^2}\, dx
\end{align}
So you can conclude that
$$
\boxed{\int_0^{1} \frac{\log^2{x}}{(1+x)^2}\, dx  = \frac{\pi^2}{6}}
$$

Also, in the same question linked one of the other answers gives a non-contour integration way to get the result using Taylor series. So you can also use that route if you like.


text:
Q: Can't install Windows 7 after CPU upgrade I have been running Windows 7 since release (almost) on an Intel Core 2 Duo E6600 no problem.  I recently upgraded to a Core 2 Quad 8300.  When I tried to boot, Windows did not start and displayed a screen that said the installation was corrupt and could have been caused by a recent hardware change.  So since it had been while anyway, I did a format and reinstall.  Since doing this, I am unable to get Windows 7 to run on my machine.
It installs OK, but on the first time startup, I get a blank screen after the "Starting Windows..." display.  My monitor then goes into stand-by (indicating no video signal).  This has happened every time after multiple retried installs.  If I try and boot in safe-mode, it tells me I cannot run first time setup in safe mode and just restarts.
The strange thing is, I can install my version of Windows Vista that I got with the computer originally just fine.  That boots and works all well and good. I think that it is the hardware change that is the problem, but I have no idea why that would be or what I can do about it.

A: If Vista runs fine on your system, there is no reason that 7 will not.
There is a chance that some of the install files are damaged.
Try to install 7 (with the same CD) on other system if you can, just to make sure that his not the culprit (which I think he is)


text:
Q: Strange/bad assembly output by gcc? I have the following code (minimal example):
#include <iostream>
#include <immintrin.h>

using namespace std;

int main(){
    __m128i a = _mm_set_epi32(rand(),rand(),rand(),rand());
    __m128i b = _mm_set_epi32(rand(),rand(),rand(),rand());
    __m128i c = _mm_add_epi32(a,b);
    int d[4];
    _mm_storeu_si128((__m128i*)d,c);
    cout<<d[0]<<endl;
    cout<<d[1]<<endl;
    cout<<d[2]<<endl;
    cout<<d[3]<<endl;
    return 0;
}

When compiled with g++ -O3 -march=native, it produces some strange/bad/inefficient assembly (https://godbolt.org/z/TQgbim). It stores c once and then it does an aligned load and an extract to do the element accesses (each time). I can see why it needs to store it to memory, and I can see how an aligned load and extract might be efficient, but I don't see why it needs to keep loading the same data back into the xmm register after an extraction. Also, when d is changed so that it is allocated on the heap (https://godbolt.org/z/Pk7qP2), it doesn't even do the aligned loads anymore, it just treats d as a normal array and accesses the elements that way. Could someone please explain why it's doing this and what possible benefit it could bring? Thanks.

A: Yup, that's an amusing missed-optimization.
Looks like it decided to optimize vector store / scalar reload into vector extract, which is normally good.
But it did so without taking into account the calling convention, which has no call-preserved vector registers.  This code would have been fine on Windows x64, where it could use xmm6, for example.
This code would also have been fine if you called functions which inlined, or if you passed all 4 elements as args to the same function.  (e.g. printf).
GCC has multiple passes, and the architecture-neutral middle passes operating on a GIMPLE representation of the program logic sometimes can't take advantage of full details that aren't known until register-allocation time.  Some optimizations are hard for gcc because it just isn't wired to be able to see them.

BTW, if you care about that level of efficiency, use '\n' instead of endl.  You don't need to explicitly flush cout there.