text:
Q: turn on automatic scrollbar I have a linear layout containing a tablelayout and a relative layout
The relative layout is set as a footer
Inside the table layout I position several other components (textviews, editboxes, buttons)
and I would like this table layout to have a scrollbar
I set its property to have a vertical scrollbar already but it doesn't work
Here is my layout
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:scrollbarStyle="insideOverlay"
    android:scrollbars="vertical"
    tools:context="com.teo.cuteoeditor.PreferenceActivity$PlaceholderFragment" xmlns:android="http://schemas.android.com/apk/res/android">

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbarStyle="insideOverlay"
        android:scrollbars="vertical" >

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp" >

            <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/pref_title_layout"
                android:scrollbarStyle="insideOverlay"
                android:scrollbars="vertical" />

            </TableRow>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#42424242" />

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" >

            <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/pref_desc_layout"
                android:scrollbars="vertical" />

            </TableRow>
        <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="1px"
        android:background="#42424242" />

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" >

            <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/pref_location_layout"
                android:scrollbarStyle="insideOverlay" />

            </TableRow>
        <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="1px"
        android:background="#42424242" />

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" >

            <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/pref_time_to_from" />
        </TableRow>
        <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="1px"
        android:background="#42424242" />

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" >

            <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/pref_reminder" />
        </TableRow>
    </TableLayout>
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="1px"
        android:background="#42424242" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom|center_vertical|center_horizontal" >

        <Button
            android:id="@+id/pref_save_btn"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="100dp"
            android:layout_height="35dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_centerInParent="false"
            android:text="@string/pref_cancel" />

        <Button
            android:id="@+id/pref_cancel_btn"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="100dp"
            android:layout_height="35dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="false"
            android:layout_centerInParent="false"
            android:layout_centerVertical="false"
            android:layout_marginRight="10dp"
            android:text="@string/pref_save" />

    </RelativeLayout>

</LinearLayout>

Look at the 3 editbox, if this activity resource is called, and my cursor focuses on the third editbox, android automatic keyboard shows up and it covers my 3rd editbox . the screen should pull up itself to let me know where my cursor is such that I can input in the box, right ?

A: Encase the whole thing in:
<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars="none"
        android:layout_weight="1">
        <LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical">

       </LinearLayout>
     </ScrollView>

Also Check out:: How to scroll table layout in horizontal and vertical in android


text:
Q: Window 7 commands not running Specifically trying attrib, but I believe all commands in System32 don't work. I had an issue with a path variable, which I believe is fixed now, since C:\Windows\System32 is showing at the end of my %path% variable. BUT attrib still doesn't work:
Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft
Corporation.  All rights reserved.

C:\Users\tri-eng>echo %path%
C:\oracle\x86;C:\oracle\iqms\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;c:\Program Files (x86)\AMD
APP\bin\x 86_64;c:\Program Files (x86)\AMD
APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;
%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Prog
ram Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI
Technologies\ATI. ACE\Core-Static;C:\Program Files\Dell\Dell Data
Protection\Access\Advanced\Wave\ Gemalto\Access Client\v5\;C:\Program
Files (x86)\NTRU Cryptosystems\NTRU TCG Sof tware
Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software
Stack\bin " ;C:\Users\tri-eng\Documents\nodejs\;C:\Windows\System32;

C:\Users\tri-eng>attrib
// DOESN'T WORK!
'attrib' is not recognized as an internal or
external command, operable program or batch file.

C:\Users\tri-eng>C:\Windows\System32\attrib A
// WORKS!
// ...(output of attrib command)...

C:\Users\tri-eng>

Maybe something with the registry?

A: The problem was that the %PATH% environment variable wasn't automatically expanded, i.e. the %systemroot% value wasn't expanded to C:\Windows\System32.
This was caused by a bad re-write of my %PATH% environment variable during a software install.
To fix it, I replaced the %PATH% registry entry as follows:
In Windows 7:

*

*Search for regedit.exe and run it. GUI opens.

*Navigate down to HKEY_LOCAL_MACHINE > SYSTEM > ControlSet > Control > Session Manager > Environment

*Check to see the Type of the PATH variable. If it's REG_SZ, this fix may work.

*Copy contents of PATH variable to notepad for safekeeping

*Delete PATH variable

*Right click > New > Expandable String Variable

*Set name as PATH

*Set contents to value copied in step 4

*REBOOT IS REQUIRED TO TAKE EFFECT

redpajama_set_name: RedPajamaStackExchange


text:
Q: Single Sign on Sharepoint and ASP.net I have
1.) Sharepoint 2010 web applications with Default windows authentication.
2.) ASP.Net Application with custom authentication against Same  AD.
Now I have requirement to implement SSO among these applications.
At this point I don't want to change the Authentication mode or provider in Sharepoint web application.
In browser, If I logged in with Sharepoint web application then Asp.net application should not ask authentication and vice versa.
How can I achieve this?

A: There are MANY ways to accomplish this.  You could write your own SSO SAML provider, use a third-party, etc.  However, Microsoft seems to finally be on the ball with this in the new Windows Server 2012 R2.  2012 R2 comes with a service called the "Web Application Gateway".  With this, you would setup a new 2012 R2 server that acts as a gateway to your other web applications.  You can handle your authentication at the gateway and have it passed to each published web application.


text:
Q: PHP Excel import I have used the following code for excel import in php
$filename=$_FILES["file"]["tmp_name"];
$this->load->library("PHPExcel");
$inputFileType = PHPExcel_IOFactory::identify($filename);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($filename);
//$objPHPExcel = PHPExcel_IOFactory::load($file);
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$arrayCount = count($allDataInSheet);

while uploading some xls file getting the error,

Fatal error: Call to undefined method
  PHPExcel_Shared_ZipArchive::statName() in
  D:\xampp\htdocs\folder\application\third_party\PHPExcel\Reader\OOCalc.php
  on line 80 .

I have also used the line
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

but getting the same error. pls help me resolve the error.

A: Try something in this fashion:
$filename = $_FILES["file"]["tmp_name"];;
//load the excel library
$this->load->library('PHPExcel');
//read file from path
$objPHPExcel = PHPExcel_IOFactory::load($filename );
//get only the Cell Collection
$cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
//extract to a PHP readable array format
foreach ($cell_collection as $cell) {
    $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
    $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
    $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
    //header will/should be in row 1 only. of course this can be modified to suit your need.
    if ($row == 1) {
        $header[$row][$column] = $data_value;
    } else {
        $arr_data[$row][$column] = $data_value;
    }
}
//send the data in an array format
$data['header'] = $header;
$data['values'] = $arr_data;

A: I was able to upload only xlsx file and not able to add csv, xls and other format files.
I removed this line from controller:
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);

It works for me, now I'm able to upload all excel formats.


text:
Q: How to get revision number of latest commit in master branch I am trying to find a command which can help me find the "revision" number of origin/master. the command should be able to find the revision from any branch which is currently checked out.
Assuming that i am in git rev-list --max-count=1 HEAD --remotes=master. But it didn't give me "Correct" revision number. It gave me a revision number which was 3-4 commits behind. So not sure if it fetched that from master or from local.

A: You mean, revision id?
git rev-parse HEAD

A: Not sure about a git command, but cat .git/refs/remotes/origin/master will get you commit hash of origin/master.
Per Ulysse BN's comment, the corresponding git command would be git rev-parse origin/master
You can show additional information with git show origin/master or git log -1 origin/master


text:
Q: SQL to filter multiple records based on a column I have a table which contains records a follows:
Column_1  Column_2  Column_3

CA        123       EN

CA        123       SP

CA        789       EN

My output should be as follows:
Column_1  Column_2  Column_3

CA         123       SP

CA         789       EN

I know this sql is not complicated to write, but I have tried for couple of hours already and still not got a satisfactory result. Any suggestions?

A: A query that gives you that result would be:
select Column_1, Column_2, Column_3
from TheTable
where
  (Column_2 = 123 and Column_3 = 'SP')
  or
  (Column_2 = 789 and Column_3 = 'EN')

A: I thought you were looking for a group by.
select Column_1, Column_2, Column_3 from table_name group by Column_2, Column_3

The above query works in MySQL but not in many other SQL implementations as pointed out in the comments, and I don't think it does what you actually want. Returns 3 rows, not 2.
Again, just guessing, but as I understand, maybe this is what you are looking for:
select Column_1, Column_2,
  (select Column_3 from test_table t2
   where t2.Column_1=t1.Column_1 and t2.Column_2=t1.Column_2
   order by Column_0 desc limit 1) as Column_3
from test_table t1
group by Column_1, Column_2

This works in MySQL, didn't test in any other. Returns exactly the 2 rows as requested.
You can see an extra Column_0 there - that should be a primary [integer] key in your table. I presumed you have it already. If not, you need to add it, otherwise you wouldn't know which is the last row inserted in your table in order to return it when you have duplicates for Column_2.
Also, limit 1 is specific to MySQL. The equivalent in MSSQL is select top 1 ..., for Firebird select first 1 ..., etc. You didn't specify th rdbms you are using.


text:
Q: Logic behind normal line in expressing plane why do we consider normal line in expressing a plane,say in $R^3$, of the form $ ax + by + cz = d $? What is the logic behind this normal line selection? Plz provide intuitive explanations.Thanks

A: For me the most intuitive explanation has been as follows, say you have a point on a plain T0 (x0, y0, z0). Then a vector between any point (x, y, z) on the plane and T0 and the normal vector (a,b, c) should have their scalar product equal to 0. Then
(x-x0)a + (y-y0)b + (z-z0)c=0,
Defining d= ax0+by0+cz0, completes the explanation


text:
Q: Deserialize YAML to JAVA I have a YAML File with following data and i want to Deserialize that into java Object.
connector:
  provider: ABCD
  nodes:
  -  1.1.2.1
  -  1.2.2.8
  maxconnection: 1
  minconnection: 1

1.First i created a class called Connector where i have defined all the variable like Provider, Nodes, maxconnections, Minconnections.
2.Then i created a class called group and call the Connector class.
3.then in the main function tried to load the yaml file and call it.
But i got Null pointer exception Error
#Connector Class
public static class connector {

            private String provider;

            private String[]  nodes;

            private int max_connections;

            private int min_connections;

            public String getprovider() {
                return provider;
            }
            public void setprovider(String provider) {
                this.provider = provider;
            }
           public String[] getnodes() {
              return nodes;
            }
            public void setnodes( String[] nodes) {
              this.nodes = nodes;
            }
            public int getmax_connections() {
              return max_connections;
            }
            public void setmax_connections(int max_connections) {
              this.max_connections = max_connections;
            }
            public int getmin_connections() {
              return min_connections;
            }
            public void setmin_connections(int min_connections) {
              this.min_connections = min_connections;
            }

            @Override
            public String toString() {
                return "connector: {provider: " + this.provider + ", nodes: " + this.nodes + ",max_connections: " + this.max_connections +",min_connections: " + this.min_connections +"}";
            }

#Group class

        public static class Group {
            private ArrayList<connector> connector;

            public ArrayList<connector> getconnector() {
                return connector;
            }

            public void setconnector(ArrayList<connector> connector) {
                this.connector = connector;
            }
        }

#main Class

public static void main(String[] args) {

            final URL resource = YamlConf.class.getResource("demo.yaml");
            final Constructor peopleContructor = new Constructor(Group.class);
            final TypeDescription peopleDescription = new TypeDescription(connector.class);
            peopleDescription.putMapPropertyType("connector", connector.class, Object.class);
            peopleContructor.addTypeDescription(peopleDescription);

            final Yaml yaml = new Yaml(peopleContructor);
            try {
                final Group group = (Group) yaml.load(resource.openStream());
                for (final connector connector : group.getconnector()) {
                    System.out.println(connector);
                }

            } catch (IOException e) {
                e.printStackTrace();
            }
        }

A: As you are using Jackson, you could use ObjectMapper with the YAMLFactory. Under the hood, it will use the SnakeYAML library. For the required dependencies, refer to the jackson-dataformats-text project documentation.
You could define your classes as follows:
@Getter
@Setter
@NoArgsConstructor
public class Content {

    private Connector connector;
}

@Getter
@Setter
@NoArgsConstructor
public class Connector {

    private String provider;

    private List<String> nodes;

    @JsonProperty("maxconnection")
    private Integer maxConnections;

    @JsonProperty("minconnection")
    private Integer minConnections;
}

The @Getter, @Setter and @NoArgsConstructor annotations are from the Lombok project. They will generate getters, setters and the default constructor for your. If you don't want to use Lombok, simply implement those methods.
Then read your YAML file:
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
Content content = mapper.readValue(yamlFile, Content.class);

Depending on your needs, you could consider a Map<String, Object> to hold the values:
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
TypeReference<Map<String, Object>> type = new TypeReference<Map<String, Object>>() {};
Map<String, Object> content = mapper.readValue(yamlFile, type);


text:
Q: Ways to stop access to a SQL express database I have a SQL express database and was wondering what options I have for securing it?
More specifically it is a replicated database using merge replication. I want to stop a user with a replicated copy of the database opening the database, modifying it and running queries against it.
UPDATE:
Just wondering though, what happens if I have a database which is secured, but I then take it offline, copy the database, and attach it to a different database server. Does the security go with it, and can I not break into it like that?

A: There is no way you can secure a SQL Express database against access from a computer administrator. In the typical SQL Express scenario this means that the user of your application (which is usually a also local administrator) can see everything in the database and it can also modify anything, no matter what grants or permissions you establish.
If you want to protect the IP in the database (which is the usual reasoning behind this ever repeating question) you need to prevent access to the physical database which you can only do by no releasing the database to start with. In other words, use a web service instead (hosted by you), or a cloud based database like SQL Azure.

A: You need to utilize appropriate security principals.  Create server logins and database users (and database roles for grouping permissions [and server roles if you are using SQL Server 2012]), and grant these principals the necessary permissions to do only what they need to do and nothing more.
Securing an instance/database is a very long topic, but a great place to start is Books Online.  See this link at the bottom to view all the possible securables you can GRANT, DENY, and REVOKE permissions on.
You will most likely be concerned with Database Permissions with your described scenario (that doesn't mean you can ignore server permissions, but CONNECT may be all these aforementioned users need on the instance-level).
If all you want to do is allow the user to query data in a certain schema (for example), you'd simply do the following:
grant select
on schema::YourDbSchema
to YourDbUser

Note: It is best practice to create roles to house applicable permissions and then add users to roles instead of individual rights to users.  It will become a management nightmare if you do the latter.


text:
Q: C++ pointers and arithmetics #include <iostream>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
    int a[10]={0,1,2,3,4,5,6,7,8,9};
    int *aptr;
    aptr = &a[0];
    a[2] = a[2] + 3;
    a[3] = a[5] + a[4];
    aptr++;
    (*aptr)--;
    (*(++aptr))++;
    cout << a[1] << a[2] << a[3] << a[4] << *aptr << endl;
}

The problem at hand is that assuming the above code compiles, I'm supposed to get an output of 06946. Can anyone sort of go through the code for me? I don't quite understand how the code arrives at the output?

A: int main(int argc, _TCHAR* argv[])
{
    int a[10]={0,1,2,3,4,5,6,7,8,9};
    // a is an array of 10 ints.
    int *aptr;
    // aptr is a pointer to int.
    aptr = &a[0];
    // aptr points to the 1st element of a array. i.e. a[0]
    a[2] = a[2] + 3;
    // You add 3 to a[2], i.e. third element of array to get '5' and put it back in a[2].
    // So 'a' will be {0,1,5,3,4,5,6,7,8,9}
    a[3] = a[5] + a[4];
    // You take 6th and 5th elements, add them and put it in 4th element.
    // So 'a' will be {0,1,5,9,4,5,6,7,8,9}
    aptr++;
    // aptr pointer is incremented so now it points to 2nd element of a array i.e a[1].
    (*aptr)--;
    // aptr pointer is first dereferenced to get a[1], which is then decremented.
    // So 'a' will be {0,0,5,9,4,5,6,7,8,9}
    (*(++aptr))++;
    // aptr pointer is incremented first so now it points to 3rd element i.e. a[2].
    // aptr pointer is then dereferenced to get a[2], which is then incremented.
    // So 'a' will be {0,0,6,9,4,5,6,7,8,9} and aptr points to a[2]
    cout << a[1] << a[2] << a[3] << a[4] << *aptr << endl;
   // So it should print 06946
}

A: Let's go over each step in the code:
int a[10]={0,1,2,3,4,5,6,7,8,9}; //initial state of your array
int *aptr;
aptr = &a[0]; //pointer on the first element
a[2] = a[2] + 3; //a[2]=5 now
a[3] = a[5] + a[4]; //a[3]=9 now
aptr++; //pointer on the second element
(*aptr)--; //decrement the value pointed by the pointer: a[1]=0 now
(*(++aptr))++;
//first increment the pointer the increments the value pointed by the new pointer so a[2]=6 now

Note that the last line might have a different behavior since it contains a postfix and prefix incrementation but since they are on two different values it should be safe.

A: int a[10]={0,1,2,3,4,5,6,7,8,9};
int *aptr;
aptr = &a[0];

aptr is referencing a[0]
a[2] = a[2] + 3;
//  a[2] == 5
a[3] = a[5] + a[4];
// a[3] == 9
aptr++;

moving aptr's reference to a[1]
(*aptr)--;

The * before aptr now means you are modifying whatever it is referencing to's VALUE. So aptr is POINTING to a[1], and we will decrease its VALUE by 1.  Therefore a[1] equals to 0.
(*(++aptr))++;

Lets break this down. (++aptr)  means lets move the pointer from a[1] to a[2].  (*(++aptr)) now says lets focus on aptr's VALUE. We know now a[2] == 5.  Finally (*(++aptr))++ says lets increment that value by 1.  So a[2] == 6.  Keep in mind *aptr NOW also equals 6 as a result of this.
cout << a[1] << a[2] << a[3] << a[4] << *aptr << endl;

So we established that a[1]'s value has been changed to 0.
We determined why a[2] == 6, a[3] is 9 because of simple math
and finally *aptr == 6 because that is the final operation we performed on our pointer.
I do hope this will help you make sense of your exercise.


text:
Q: Scala - null (?) as default value for named Int parameter I'd like to do in Scala something I would do in Java like this:
public void recv(String from) {
    recv(from, null);
}
public void recv(String from, Integer key) {
    /* if key defined do some preliminary work */
    /* do real work */
}

// case 1
recv("/x/y/z");
// case 2
recv("/x/y/z", 1);

In Scala I could do:
def recv(from: String,
         key: Int = null.asInstanceOf[Int]) {
    /* ... */
}

but it looks ugly. Or I could do:
def recv(from: String,
         key: Option[Int] = None) {
    /* ... */
}

but now call with key looks ugly:
// case 2
recv("/x/y/z", Some(1));

What's the proper Scala way? Thank you.

A: Option really does sound like the right solution to your problem - you really do want to have an "optional" Int.
If you're worried about callers having to use Some, why not:
def recv(from: String) {
  recv(from, None)
}

def recv(from: String, key: Int) {
  recv(from, Some(key))
}

def recv(from: String, key: Option[Int]) {
  ...
}

A: The proper way is, of course, to use Option. If you have problems with how it looks, you can always resort to what you did in Java: use java.lang.Integer.

A: The Option way is the Scala way. You can make the user code a little nicer by providing helper methods.
private def recv(from: String, key: Option[Int]) {
  /* ... */
}

def recv(from: String, key: Int) {
  recv(from, Some(key))
}

def recv(from: String) {
  recv(from, None)
}

null.asInstanceOf[Int] evaluates to 0 by the way.


text:
Q: How do I access the output on "Lookup Activity" in the Azure Data Factory? I'm returning a simple query using Azure Data Factory's Lookup Activity.
I'm trying to access the result of that query and then send the result by email.
I'd like to access full output but have failed to do so.
So far, I've tried using the following solutions:

*

*@activity('Lookup1').output (not sending/receiving email)

*@activity('Lookup1').output.count (works but only returns "2")

*@activity('Lookup1').output.value (returns nothing)

Every time I run this script, it debugs successfully, I.E: there is no error message.
This is the output I'm getting:
{
  "count": 2,
  "value": [
    {
      "company_name": "ABC",
      "folder_name": "Folder1"
    }, {
      "company_name": "DEF",
      "folder_name": "Folder2"
    }
  ],
  "effectiveIntegrationRuntime": "DefaultIntegrationRuntime (Japan East)"
}

What I should do to returning full output?

A: Here you have to wrap output to string by
@string(activity('Lookup1').output)

A: I already solved it. Actually my output is json object , so all i had to do is convert full output into string.


text:
Q: Remove prefix in taghelper-generated input tag With a partial view containing this line
<input asp-for="Form.FirstName" asp- class="form-control" />

I get the following output
<input id="Form_FirstName" name="Form.FirstName" <!-- more stuff --> >

which means I need to account for that "Form" prefix in my action's definition using a Bind attribute like so
public async Task<IActionResult> SendContactForm([Bind(Prefix = "Form")] ContactFormViewModel model)

I don't really like using the Bind attribute, I think it is very verbose and, being text-base, hard to maintain. I would much rather be able to tell the netcore2 input tag helper to simply omit the prefix when generating the HTML but I couldn't find any built-in solution but I might have missed it ...
I looked for inline tag helper attributes as well as attributes to add to my model but couldn't find anything ...
Is there any trick to remove this prefix or am I stuck with this (ugly) Bind ?

A: In this situation one option is to use a <partial> that contains your form and use the model attribute to pass your model in.
In your view this would be something like this.
<partial name="PartialName" model="@Model.Form">

In your partial, you would no longer need the prefix in your asp-for expressions.
<input asp-for="FirstName" class="form-control" />


text:
Q: MapView not reloading annotations unless you zoom in or move map I am using the following for loop to manage/find out the five nearest annotations to the user location, and then set them as the mapView's annotations.
for (int i = 0; i <= 5; i++) {
            //NSLog(@"Stores Count For Loop: %i", [storesLessThan100KAway count]);
            if ([storesLessThan100KAway count] > 5) {
                NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"distanceToTarget" ascending:YES];
                NSArray *newArray = [storesLessThan100KAway sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
                [mapView addAnnotation:[newArray objectAtIndex:i]];
                if ([[mapView annotations] count] > 4) {
                    [descriptor release];
                    [dict release];
                    [currentlocation release];
                    [usrlocation release];
                    [annotation release];
                    [paul drain];
                    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
                    return;
                }
            }

However the annotations added to the map will not be shown until the map is zoomed in or moved. Is there anyway that I could stop this?

A: MKMapView is a subclass of UIView -- You could try calling [mapView setNeedsDisplay]?
If that doesn't work:
// Force update of map view.
CLLocationCoordinate2D center = [mapView centerCoordinate];
[mapView setCenterCoordinate:center];

A: Try to put these lines in a Timer and stop it after you finish adding annotations
static float deltaX=.1;
CLLocation *location = [[[CLLocation alloc] initWithLatitude:self.mapView.centerCoordinate.latitude longitude:self.mapView.centerCoordinate.longitude] autorelease];

MKCoordinateRegion region;
region.center = location.coordinate;
MKCoordinateSpan span;

span.latitudeDelta = self.mapView.region.span.latitudeDelta+deltaX;
span.longitudeDelta = self.mapView.region.span.longitudeDelta+deltaX;
deltaX+=.1;
deltaX*=-1;
region.span = span; // Set the region's span to the new span.
[self.mapView setRegion:region animated:0];


text:
Q: Select the xsl element using xsl:value of I am not able to select the value of locale using the xsl:value-of. It doesn't seem to read the Upsert tag, but reads it if I change the Upsert tag to just .Also, how do I select just the Question tags? I am completely new to xslt so it's taking time for me to wrap my head around it. Why is the xmlns attribute making a difference there?
This is my xml
<Upsert xmlns="http://talemetry.com/">
      <Locale>fr</Locale>
      <LanguageAware>true</LanguageAware>
      <Question active="true" question_id="NOV22-Question" read_only="false" show_on_profile="true" type="multiple_choice_multi_answer">
        <QuestionText>Please select your list of Achievements</QuestionText>
        <RegEx>[0-9]+</RegEx>
        <Answers sort_by="text">
          <Answer answer_id="BOD" is_correct="true" seq="#">
            <AnswerText>Board of Directors Appointment</AnswerText>
          </Answer>
          <Answer answer_id="CMT" is_correct="true">
            <AnswerText>Certificate of Merit Award</AnswerText>
          </Answer>
          <Answer answer_id="CSS" is_correct="true">
            <AnswerText>Community Service Award</AnswerText>
          </Answer>
          <Answer answer_id="DCN" is_correct="true">
            <AnswerText>Dale Carnegie</AnswerText>
          </Answer>
          <Answer answer_id="DEA" is_correct="true">
            <AnswerText>Dean's Award</AnswerText>
          </Answer>
          <Answer answer_id="DLA" is_correct="true">
            <AnswerText>Distinguished Lectureship Awrd</AnswerText>
          </Answer>
          <Answer answer_id="EDU" is_correct="true">
            <AnswerText>Education Award</AnswerText>
          </Answer>
          <Answer answer_id="HDD" is_correct="true">
            <AnswerText>Honorary Doctorate Degree</AnswerText>
          </Answer>
          <Answer answer_id="MBE" is_correct="true">
            <AnswerText>Member of the British Empire</AnswerText>
          </Answer>
          <Answer answer_id="NMS" is_correct="true">
            <AnswerText>National Merit Scholarship</AnswerText>
          </Answer>
          <Answer answer_id="OBE" is_correct="true">
            <AnswerText>Order of the British Empire</AnswerText>
          </Answer>
          <Answer answer_id="OCA" is_correct="true">
            <AnswerText>Outstanding Contributor Award</AnswerText>
          </Answer>
          <Answer answer_id="PRE" is_correct="true">
            <AnswerText>President's Award</AnswerText>
          </Answer>
          <Answer answer_id="PUB" is_correct="true">
            <AnswerText>Publication Award</AnswerText>
          </Answer>
          <Answer answer_id="RPG" is_correct="true">
            <AnswerText>Research & Publications Grant</AnswerText>
          </Answer>
          <Answer answer_id="RYA" is_correct="true">
            <AnswerText>Retiree of the Year Award</AnswerText>
          </Answer>
          <Answer answer_id="SCL" is_correct="true">
            <AnswerText>Sales Excellence Club</AnswerText>
          </Answer>
          <Answer answer_id="SER" is_correct="true">
            <AnswerText>Service Award</AnswerText>
          </Answer>
          <Answer answer_id="SFT" is_correct="true">
            <AnswerText>Safety Prevention Award</AnswerText>
          </Answer>
          <Answer answer_id="SPY" is_correct="true">
            <AnswerText>Sales Person of the Year</AnswerText>
          </Answer>
          <Answer answer_id="TECHY" is_correct="true">
            <AnswerText>Techy Gold Award</AnswerText>
          </Answer>
          <Answer answer_id="TST" is_correct="true">
            <AnswerText>Toastmasters</AnswerText>
          </Answer>
          <Answer answer_id="VYA" is_correct="true">
            <AnswerText>Volunteer of the Year Award</AnswerText>
          </Answer>
        </Answers>
      </Question>
<Question active="true" question_id="EEO_CommunityNI" read_only="false" show_on_profile="false" type="multiple_choice_single_answer">
        <QuestionText>What is your Community Religion (NI)?</QuestionText>
        <Answers sort_by="text">
          <Answer answer_id="CA" is_correct="true">
            <AnswerText>Catholic</AnswerText>
          </Answer>
          <Answer answer_id="PR" is_correct="true">
            <AnswerText>Protestant</AnswerText>
          </Answer>
          <Answer answer_id="UD" is_correct="true">
            <AnswerText>Undetermined/Other</AnswerText>
          </Answer>
        </Answers>
      </Question>
    </Upsert>

And this is my xsl
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://ns.hr-xml.org/2007-04-15"
    xmlns:hr="http://ns.hr-xml.org/2007-04-15">
    <xsl:template match="/">
        <SOAP-ENV:Envelope xmlns=""
            xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <SOAP-ENV:Header>
                <AuthHeader xmlns="http://talemetry.com/">
                    <Username>${param_cred_api_client_id}</Username>
                    <Password>${param_cred_api_client_secret}</Password>
                </AuthHeader>
            </SOAP-ENV:Header>
            <SOAP-ENV:Body>
            <Delete xmlns="http://talemetry.com/">
                <Locale>
                 <xsl:value-of select="Upsert/Locale"/>
                </Locale>
            </Delete>
            </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>
    </xsl:template>
</xsl:stylesheet>

I want the output to look like this
<?xml version="1.0"?>
<soap:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hr="http://ns.hr-xml.org" xmlns:m="http://peoplesoft.com/HCM/Schema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Header>
    <AuthHeader xmlns="http://talemetry.com/">
      <Username>blah-blah</Username>
      <Password>blah-blah</Password>
    </AuthHeader>
  </soap:Header>
  <soap:Body>
    <Delete xmlns="http://talemetry.com/">
      <Locale>fr</Locale>
      <LanguageAware>true</LanguageAware>
      <Question active="true" question_id="NOV22-Question" read_only="false" show_on_profile="true" type="multiple_choice_multi_answer">
<Question active="true" question_id="EEO_CommunityNI" read_only="false" show_on_profile="false" type="multiple_choice_single_answer">
</Delete>
  </soap:Body>
</soap:Envelope>


text:
Q: Custom font works in Safari, IE. Fails in Chrome, FF and Opera I've got two custom fonts. Both fonts are working fine on Safari (OSX and IOS) And Chrome and firefox on iOS and IE11. Font 'Underwood' fails on Chrome, Firefox and Opera on OSX with error "Failed to decode downloaded font". Font 'Avenir' works on every browser.
Font is hosted locally. I have tried both a relative and a absolute path. I have downloaded an alternative 'underwood' and converted ttf to otf. All to no avail.
Anybody a solution?
@font-face {
font-family: 'Avenir';
font-style: normal;
font-weight: normal;
src: url('fonts/Avenir/avenir-light.woff') format('woff'),
     url('fonts/Avenir/avenir-light.ttf') format('truetype');
}

@font-face {
font-family: 'Underwood';
font-style: normal;
font-weight: normal;
src: url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.eot');
src: url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.woff') format('woff'),
     url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.ttf') format('truetype'),
     url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.otf') format('opentype'),
     url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.eot?#iefix') format('embedded-opentype'),
     url('//www.dekipgallery.nl/includes/fonts/Underwood/Underwood.svg#my_underwoodregular') format('svg');
}


text:
Q: How to print two column dataset from csv files in python ubuntu I have csv data files which contain 13 column. I want to split two column values and another to add one more column.
def rowfilter(col1, col2):
    try:
        csv_read = csv.reader(open('items.csv'), delimiter=',')
        for row in csv_read:
        print(row[int(cols[0]):int(cols[1])])
    except FileNotFoundError:
        print("File not found")

    inputrows = input("Enter columns in the format: col1 col2 ")

    rowfilter(inputrows.split()))

A: To work with csvs, usually the easiest way is to use the pandas module. It offers easy to use I/O, selection and manipulation interfaces.
def rowfilter(col1, col2):
    try:
        df = pd.read_csv('items.csv')

        print(df[[col1, col2]])
    except FileNotFoundError:
        print("File not found")

    inputrows = input("Enter columns in the format: col1 col2 ")

    rowfilter(inputrows.split()))

This will print the columns.


text:
Q: Is it possible to set the event created_at time with Prooph? I'm evaluating if Proof is a good fit for this project. I read through the docs but they do not cover this case and I'm unsure how to use it like this, or if what I want to do even makes sense with respect to event sourcing.
I have a system that fetches data every 5 to 10 minutes, but within that data is an array of metrics taken within that time. (simplified example)
[
  {"time": "2021-11-08 10:21:00", "setting": "on"},
  {"time": "2021-11-08 10:22:00", "setting": "on"},
  {"time": "2021-11-08 10:23:00", "setting": "off"},
  {"time": "2021-11-08 10:24:00", "setting": "off"},
  {"time": "2021-11-08 10:25:00", "setting": "off"},
]

If I were processing this realtime, an "OFF" event would be sent at 10:23.
The data is delayed however but I still want to store the event as if it occurred at 10:23, even though I may be sending it into the event store at 10:30.
Is this possible with Prooph? if not, is there a more proper way to handle recording delayed data like this?

A: prooph/event-store works with prooph/common which is a set of interfaces and basic implementations for messaging. You're free to implement the interfaces for message factory and message converter the way you need it. But your case is already covered, see FQCNMessageFactory


text:
Q: Linux Mint: ALERT! "UUID" does not exist. Dropping to a shell! I am trying to duel boot Linux Mint with ChromeOS from an SD card. I installed it from a bootable usb and when I run it from the SD card, it stays on the boot up screen for a few minutes, then this happens:
[        1.148939] cros_ec_lpcs GOOG0004:00: IRQ index 0 not found
[        1.227155] genirq: Flags mismatch irq 0. 0000080 (i801_smbus) vs 00015a00
(timer)
[        1.227155] i801_smbus 0000:00:1f.1: Failed to allocate irq 0: -16
Gave up waiting for root file system device. Common problems:
-  Boot argos (cat /proc/cmdline)
        -  Check rootdelay= (did the system wait long enough?)
-  Missing modules (cat /proc/modules; ls /dev)
ALERT! UUID=247d6725-7cdc-407f-bc9f-42ae6aba6bb2 does not exist. Droppint to a shell!

BusyBox v1.30.1 (Ubuntu 1:1.30.1-4ubuntu6.3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs) [  3115.015452] elants_i2c i2c-ELAN0001:00: unknown packet ff ff ff ff

(initramfs)

I have tried to find as much information as I can regarding the issue and none of the solutions worked.

A: Sadly I don't have an actual solution, but what I do have is a hypothesis: I think that means your SD card is "disappearing"/losing power/otherwise shutting off. Couple things off the top of my head that can cause that: USB/PCI power management (dunno if you can turn that off in the BIOS of a Chromebook, but if you can, you might want to try; perhaps there are kernel parameters you could change if you can't do it via the BIOS?), driver issues (could try a bleeding edge distro or an older version of Mint to see if it gives the same issue), or a dodgy SD card.


text:
Q: DOMPDF image is not displayed on the server I have encountered a very common error that the image is not displayed on the server, on the local server, the image still displays well, I have actually looked at a lot of answers and tried A lot of ways but it still doesn't work, please take a look at my code.
require_once("./vendor/dompdf_new/autoload.inc.php");
use Dompdf\Dompdf; //v0.8.3

class Pdfgenerator {

public function generate($html, $filename='', $stream=TRUE, $paper = 'A4', $orientation = "portrait")
{

    $dompdf = new DOMPDF();
    $contxt = stream_context_create([
        'ssl' => [
            'verify_peer' => FALSE,
            'verify_peer_name' => FALSE,
            'allow_self_signed'=> TRUE
        ]
    ]);
    $dompdf->setHttpContext($contxt);
    $dompdf->loadHtml($html);
    $dompdf->set_option('isRemoteEnabled', true);
    $dompdf->set_option('isHtml5ParserEnabled', true);
    $dompdf->set_option('debugKeepTemp', TRUE);
    $dompdf->setPaper($paper, $orientation);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf", array("Attachment" => 0));
    } else {
        return $dompdf->output();
    }
}
}

// Using other file =========================================================
public function index()
{
    // $this->load->library('pdfgenerator');
    // $path = 'https://xxxxx.xx/images/logo.png';
    // $type = pathinfo($path, PATHINFO_EXTENSION);
    // $data = file_get_contents($path);
    // $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
    // $html = '
text
';
    // $this->pdfgenerator->generate($html,'filename');

    $html = '
text
';
    $this->pdfgenerator->generate($html,'filename');

}

A: Try to change the path to the image to a relative one like "/images/logo.png" or "../images/logo.png", see if that works out for you.


text:
Q: Basic (local) HTML not loading Image or js but loading css I've been working with the web for years, but today I started a basic Angular app for something super simple and I'm just using the angular files and a single html file for my base.
Before doing all the angular stuff, I'm basically just getting the skeleton going and I noticed the browser couldn't find the relative path to the app.js file. It can find the .css files, but not the .js.
So I put an image in to test and it can't find that either! Here's my code below:
<!DOCTYPE html>

        <title>Client Services Support | Elite Chat</title>
        <link rel="stylesheet" href="public/stylesheets/foundation.min.css">
        <link rel="stylesheet" href="public/stylesheets/main.css">
        <base href="/">

        TEST

Here's my folder structure:
project
    > index.html
    > app_client
        > app.js
    > public
        > images
            > clock.jpg
        > stylesheets
            > main.css

I can use an absolute path of the image (system path, IE c:\user\blah\folder\project\public\images\clock.jpg) and it will display. But obviously a system path is completely stupid and unacceptable to use.
Any ideas why I cannot do something as simple as display an image? I even put the image in the same location as the index.html file a tried  and it still wouldn't display image.

A: So the moral of this story is going to be when doing anything more complex than a static HTML site, use a web server of some kind.
If you look at the HTML in the original question, you'll see in the  section this: <base href="/">. When editing the files locally and not using a web server (e.g. node.js or xampp or whatever you wish) then the base path (url in the browser) is something like
file:///C:/Users/person/folder/project/index.html#/

and therefore the browser will try to load files after that <base> tag based (haha, pun) on the crazy file path. That's why at that point the following is true:
not working

working

Important:
Now, if I wanted to fix this, I could either run a node.js server and toss these files in or upload to the web to test/view the desired output with the relative src attribute. Otherwise, I'd have to use the system file path.


text:
Q: Set localstorage for a function which caches color values I need to cache the the hex value/color of each input which is set by calling a function.
I have tried caching each color by rewriting duplicate functions for caching on-load, but was wondering if it could be done using a single function.
  function boardNames(color){
        for (var i = 0; i < document.getElementsByClassName('topname').length; i++) {
            document.getElementsByClassName('topname')[i].style.color = color
        }
  }
function leaderboardMass(color){
    for (var i = 0; i < document.getElementsByClassName('topmass').length; i++) {
        document.getElementsByClassName('topmass')[i].style.color = color
    }
 }

     $('.demo').minicolors({
        change: function(value) {
          if(this.id === 'bn-theme-e'){boardNames(value)}
          if(this.id === 'lm-theme-e'){leaderboardMass(value)}

        }
    });

A: You can store a stringified object inside of localStorage. This way you can use and index multiple different colors. In my example, I use the element class names to store index the color values.
// Color all items that have been set
boardNames = () => {
  let colors = JSON.parse(localStorage.getItem('nc'));
  if (colors) {
    Object.entries(colors).forEach(([k, v]) => {
      Array.from(document.getElementsByClassName(k)).forEach(c => {
        c.style.color = v;
      });
    });
  }
  localStorage.setItem('nc', JSON.stringify(colors));
}

// Set the className with new color value
setBoardColor = (className, color) => {
  let colors = JSON.parse(localStorage.getItem('nc'));
  colors[className] = color;
  localStorage.setItem('nc', JSON.stringify(colors));
}


text:
Q: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD I am writting junit for my project using HSQLBD + Mybatis + Spring.
I have sql script for create and insert.
All fields in select are present in create script still I am facing below error.
What might be the reason?
  org.springframework.jdbc.BadSqlGrammarException:
    ### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
    ### The error may exist in cTbl.xml
    ### The error may involve x.getyzOrders
    ### The error occurred while executing a query
    ### SQL: SELECT     fields              FROM              Table        WHERE field1 IN             (?,?,?,?,?,?)                        ORDER BY FIELD(field1 ,               ? , ? , ? , ? , ? , ? )
    ### Cause: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD
    ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: FIELD

A: The SQL statement is incorrect.
If the table is called FIELDS and the columns are called FIELD1, FIELD2 etc., then a SELECT statement should look like this:
SELECT fields.* FROM fields WHERE field1 IN (?,?,?,?,?,?) ORDER BY field1, field2, field3, field4, field5

You cannot use the question symbol AFTER ORDER BY


text:
Q: How to pass more than one argument to Process? I would like to start a function with multiple arguments as a new Process using the multiprocess module:
 def f(*args):
    x= args[0]
    y= args[1]
    return x+y

p = Process(target=f,args=??)

I would like to know how I can pass the multiple arguments; the documentation as far as I know doesn't mention that.

A: Using separate arguments:
def f(x,y):
    return x+y

if __name__ == '__main__':
    p = Process(target=f,args=(1,2,))
    p.start()
    p.join()

Using *args syntax:
def f(*args):
    x = args[0]
    y = args[1]
    return x+y

if __name__ == '__main__':
    p = Process(target=f,args=(1,2,))
    p.start()
    p.join()


text:
Q: Issue with ParameterizedTypeReference with WebClient. Expected List>; found capture> I am using RestTemplate and am now refactoring to using WebClient. Now, I am writing a wrapper around WebClient and am facing this issue. First let me show you how I have the wrapper written around resttemplate.
/**
* Build the local map of HttpClientParamRefType as key to the ParameterizedTypeReference as value
*/
private final static Map<HttpClientParamRefType,ParameterizedTypeReference> paramTypeRefMap = new HashMap<>() ;
static {
  paramTypeRefMap.put(HttpClientParamRefType.DATA_RESOURCE, new ParameterizedTypeReference<List<DataResource>>(){} );
  paramTypeRefMap.put(HttpClientParamRefType.GENERIC, new ParameterizedTypeReference<String>(){} );
}

.
.
.

public ResponseEntity doGet (uri, HttpClientParamRefType type){
  try{
    return restTemplate.exchange(uri, HttpMethod.GET, httpEntity, paramTypeRefMap.get(httpClientParamRefType) );
  }catch(HttpServerErrorException e){
    // Handling errors
  }
}

The above piece of code works fine. I am trying to do the same thing with WebClient. I am not able to pass the ParameterizedTypeReference from the map to bodyToMono(). It works only if I pass it directly.
public List<DataResource> getLens(HttpClientParamRefType httpClientParamRefType){

  // dlClient is initialized, nothing too special; just setting json
  return this.dlClient.get()
          .uri(datalensControlplaneUrl + "/resource?resourceType=" + SchemaType.DRUID.getName())
          .retrieve()
          .bodyToMono(paramTypeRefMap.get(httpClientParamRefType))
//        .bodyToMono(new ParameterizedTypeReference<List<DataResource>>(){})  // <----- This works!
          .block();

}

Any idea how to make it work? The exact error I get is this -
Error:(54, 23) java: incompatible types: capture#1 of ? cannot be converted to java.util.List<x.x.x.x.x.DataResource>


text:
Q: Visual Studio 2013 Report Viewer - The report definition has an invalid target namespace I am getting the following error in my recently upgraded project:
The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded.
If I start fresh and add a new report, I still get this error.  This is a local report running inside a Web Form.  The website is compiled as .NET 4.5.  I get this error whether I am using the ReportView version 9, 10, or 11.
Web Form contains:
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

Web.config contains:
<assemblies>
    <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>

<httpHandlers>
      <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </httpHandlers>

Report tag in the .rdlc:
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

A: Here is a fix that I found that worked.  Upgrade the report to be version 10 for the report viewer, so using all version 10 assemblies and references.
then in the web.config add the following to system.webServer:
<handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd"
           type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>

After doing this, my report worked.


text:
Q: Using scrapy they scrape incomplete data I have an script done by myself that is not getting all data. If the pages have a total of 870 items, it's getting about 700, I think it´s something relates to the user agent or delay of rendering...I attached the script so u can see it. what the problem they give me incomplete data Thank in advance
import scrapy
from scrapy_splash import SplashRequest
from concurrent.futures import process
from scrapy.crawler import CrawlerProcess
from datetime import datetime
import os
from scrapy.utils.response import open_in_browser
from scrapy.linkextractors import LinkExtractor
import random
import logging

script = """
    function main(splash)
        assert(splash:go(splash.args.url))
        splash:wait(0.5)
        local title = splash:evaljs('document.title')
        return {title=title}
    end
"""

if os.path.exists('jfs_hombre.csv'):
    os.remove('jfs_hombre.csv')
    print("The file has been deleted successfully")
else:
    print("The file does not exist!")

class JfsSpider_hombre(scrapy.Spider):
    name = 'jfs_hombre'
    start_urls = ["https://www.justforsport.com.ar/hombre?page=1"]

    def parse(self,response):

        #total_products=int(int(response.css('div.vtex-search-result-3-x-totalProducts--layout.pv5.ph9.bn-ns.bt-s.b--muted-5.tc-s.tl.t-action--small span::text').get())/32) + 1
        total_products=30
        for count in range(1, total_products):
            yield SplashRequest(url=f'https://www.justforsport.com.ar/hombre?page={count}',
            callback=self.parse_links, endpoint='render.html', args={'wait': 2.5, 'lua_source': script},
            headers={'User-Agent': 'Googlebot/2.1 (+http://www.google.com/bot.html)',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'})

   #Extrae links de cada pagina de la seccion
    def parse_links(self,response):
        links=response.css('a.vtex-product-summary-2-x-clearLink.vtex-product-summary-2-x-clearLink--shelf-product.h-100.flex.flex-column::attr(href)').getall()
        for link in links:
            yield SplashRequest(response.urljoin('https://www.justforsport.com.ar' + link),
            self.parse_article_detail,endpoint='render.html', args={'wait': 2.5, 'lua_source': script},
            headers={'User-Agent': 'Googlebot/2.1 (+http://www.google.com/bot.html)',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'})

    def parse_article_detail(self, response):
        #precio0=response.css('span.vtex-product-price-1-x-currencyContainer.vtex-product-price-1-x-currencyContainer--product')[0]
        yield {
            'Casa':'Just_For_Sports',
            'Sku' :response.css('span.vtex-product-identifier-0-x-product-identifier__value::text').get(),
            'Name':response.css('span.vtex-store-components-3-x-productBrand::text').get() ,
            'precio': response.xpath('//meta[@property="product:price:amount"]/@content').get(),
            #'precio':''.join(precio0.css('span.vtex-product-price-1-x-currencyInteger.vtex-product-price-1-x-currencyInteger--product::text').getall()),
            'Link':response.url,
            'Date':datetime.today().strftime('%Y-%m-%d')
                 }


text:
Q: WEBrick won't start after using Vagrant I had a new Rails app up and running with Vagrant, with the forward port set to 3000 like this in the Vagrant file
config.vm.forward_port 3000, 3000

After I shut down the server and exited vagrant I got this output `Connection to 127.0.0.1 closed,' however when I tried to start my Rails app without using Vagrant it's telling me
[2013-07-30 12:18:41] INFO  WEBrick 1.3.1
[2013-07-30 12:18:41] INFO  ruby 2.0.0 (2013-05-14) [x86_64-darwin12.4.0]
[2013-07-30 12:18:41] WARN  TCPServer Error: Address already in use - bind(2)
Exiting

    /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `new'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `block in create_listeners'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:82:in `each'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:82:in `create_listeners'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/server.rb:132:in `listen'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/server.rb:113:in `initialize'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/httpserver.rb:45:in `initialize'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `new'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `run'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:84:in `start'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
        from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

A google search told me that I should do this
ps ax | grep ruby

and then kill the process but I was told there wasn't process with the number returned by grep.
michael$ ps ax | grep ruby
 3604 s001  R+     0:00.00 grep ruby
michael$ kill -9 3604
-bash: kill: (3604) - No such process

If this is connected to my use of Vagrant, any idea how I can fix the problem?
Update
Trying the command lsof -wni tcp:3000 found at this SO answer TCPServer Error: Address already in use - bind(2) also failed to kill the process
michael$ lsof -wni tcp:3000
COMMAND   PID                USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
VBoxHeadl 601 mm   22u  IPv4 0x888bec8d3960ddb1      0t0  TCP *:hbci (LISTEN)
michael$ kill -9 PID
-bash: kill: PID: arguments must be process or job IDs


text:
Q: HTML/CSS Making a textbox with text that is grayed out, and disappears when I click to enter info, how? How do I make a textbox that has a grayed out content, and when I click on it to enter text, the grayed out portion, it disappears and allows me to enter the desired text?
Example:
A "First Name" text box.  The words "First Name" are inside the text box grayed out, when I click, those words disappear and I write my name in it.

A: If you're targeting HTML5 only you can use:
<input type="text" id="firstname" placeholder="First Name:" />

For non HTML5 browsers, I would build upon Floern's answer by using jQuery and make the javascript non-obtrusive.  I would also use a class to define the blurred properties.
$(document).ready(function () {

    //Set the initial blur (unless its highlighted by default)
    inputBlur($('#Comments'));

    $('#Comments').blur(function () {
        inputBlur(this);
    });
    $('#Comments').focus(function () {
        inputFocus(this);
    });

})

Functions:
function inputFocus(i) {
    if (i.value == i.defaultValue) {
        i.value = "";
        $(i).removeClass("blurredDefaultText");
    }
}
function inputBlur(i) {
    if (i.value == "" || i.value == i.defaultValue) {
        i.value = i.defaultValue;
        $(i).addClass("blurredDefaultText");
    }
}

CSS:
.blurredDefaultText {
    color:#888 !important;
}

A: This answer illustrates a pre-HTML5 approach. Please take a look at Psytronic's answer for a modern solution using the placeholder attribute.

HTML:
<input type="text" name="firstname" title="First Name" style="color:#888;"
    value="First Name" onfocus="inputFocus(this)" onblur="inputBlur(this)" />

JavaScript:
function inputFocus(i) {
    if (i.value == i.defaultValue) { i.value = ""; i.style.color = "#000"; }
}
function inputBlur(i) {
    if (i.value == "") { i.value = i.defaultValue; i.style.color = "#888"; }
}

A: The shortest way is to directly add the below code as additional attributes in the input type that you want to change.
onfocus="if(this.value=='Search')this.value=''"
onblur="if(this.value=='')this.value='Search'"

Please note: Change the text "Search" to "go" or any other text to suit your requirements.

A: This works:
<input type="text" id="firstname" placeholder="First Name" />

Note: You can change the placeholder, id and type value to "email" or whatever suits your need.
More details by W3Schools at:http://www.w3schools.com/tags/att_input_placeholder.asp
But by far the best solutions are by Floern and Vivek Mhatre ( edited by j0k )
I have a code snippet below, that is a typical web page.

.Submit {
    background-color: #008CBA;
    border: 3px;
    color: white;
    padding: 8px 26px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
}
div {
  background-color: yellow;
  }

Some functions may not work, such as the css ect.

First Name:<input type="text" id="firstname" placeholder="John" />

Surname:<input type="text" id="surname" placeholder="Doe" />

Email:<input type="email" id="email" placeholder="john.doe@example.com" />

Password:<input type="email" id="email" placeholder="john.doe@example.com" />

<button class="submit">Submit</button>

A: This is an elaborate version, to help you understand
function setVolatileBehavior(elem, onColor, offColor, promptText){ //changed spelling of function name to be the same as name used at invocation below
elem.addEventListener("change", function(){
    if (document.activeElement == elem && elem.value==promptText){
        elem.value='';
        elem.style.color = onColor;
    }
    else if (elem.value==''){
        elem.value=promptText;
        elem.style.color = offColor;
    }
});
elem.addEventListener("blur", function(){
    if (document.activeElement == elem && elem.value==promptText){
        elem.value='';
        elem.style.color = onColor;
    }
    else if (elem.value==''){
        elem.value=promptText;
        elem.style.color = offColor;
    }
});
elem.addEventListener("focus", function(){
    if (document.activeElement == elem && elem.value==promptText){
        elem.value='';
        elem.style.color = onColor;
    }
    else if (elem.value==''){
        elem.value=promptText;
        elem.style.color = offColor;
    }
});
elem.value=promptText;
elem.style.color=offColor;
}

Use like this:
setVolatileBehavior(document.getElementById('yourElementID'),'black','gray','Name');

A: With HTML5, you can do this natively with: <input name="first_name" placeholder="First Name">
This is not supported with all browsers though (IE)
This may work:
<input type="first_name" value="First Name" onfocus="this.value==this.defaultValue?this.value='':null">

Otherwise, if you are using jQuery, you can use .focus and .css to change the color.

A: Chrome, Firefox, IE10 and Safari support the html5 placeholder attribute
<input type="text" placeholder="First Name:" />
In order to get a more cross browser solution you'll need to use some javascript, there are plenty of pre-made solutions out there, though I don't know any off the top of my head.
http://www.w3schools.com/tags/att_input_placeholder.asp

A: You can use Floern's solution.  You may also want to disable the input while you set the color to gray.  http://www.w3schools.com/tags/att_input_disabled.asp

A: Here's a one-liner slim way for layering text on top of an input in jQuery using ES6 syntax.

$('.input-group > input').focus(e => $(e.currentTarget).parent().find('.placeholder').hide()).blur(e => { if (!$(e.currentTarget).val()) $(e.currentTarget).parent().find('.placeholder').show(); });
* {
  font-family: sans-serif;
}

.input-group {
  position: relative;
}

.input-group > input {
  width: 150px;
  padding: 10px 0px 10px 25px;
}

.input-group > .placeholder {
  position: absolute;
  top: 50%;
  left: 25px;
  transform: translateY(-50%);
  color: #929292;
}

  Username
  <input>


text:
Q: How to create JOB in AS400? I'm new to AS400 DB2 , I have 3 procedures in AS400, now those procedure should be execute by calling single job in AS400.
Can you tell me please how to create a job and execute job in AS400 DB2 Mainframe ?

A: *

*You're probably not using an AS/400 running OS/400; they have been obsolete for 10 years.  You're probably using a POWER server running IBM i.

*POWER servers are not mainframes, they are mid-range systems.

On the IBM i, a job is how the operating system organizes, tracks, and processes work.  On other platforms, you'd call it a process.
Jobs are the basis of work management
When you sign onto a 5250 session, the system starts an "interactive job" to service your requests.  You can't call procedures directly, but you can call a program that then calls the procedures.
There are plenty of common jobs tasks.  Including the use of Submit Job (SBMJOB) command to submit a job to run in batch.

A: From what I understand, you want to run 3 programs in by invoking a single command. Is that it?
In OS/400 (haven't used it in over a decade) you put the commands for the programs into a CL source and compile it. Unlike .bat files on Windows, CL isn't going to run without compilation.
Refer to https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rbam6/creat.htm for how to create a CL program.


text:
Q: application.cfc and page handling/propagation Is it possible to render a different page when the requested page does not exist using the OnRequestStart event handler?
function onRequestStart( string targetPage ) {
    // handle another page
}

if(FileExists(cgi.script_name)){
    include cgi.script_name;
}else{
    // render another page
}

if I use the include directly instead of passing it through onRequestStart, I get an error about missing SESSION
If I don't abort the execution, I get the File not found error. Is there a way to skip trying to find the file and use the onRequestStart event to render a different page?

A: If you are trying to prevent a 404 of a coldFusion page (e.g. /index2.cfm) where the cfm template doesn't exists you can use onMissingTemplate() in your application.cfc
If the template that causes the 404 isn't something handled by CF (i.e .htm,.html) then you will have to catch it in the webserver using a custom 404 page or possibly a url rewite

A: Try this insted
OnError()

This fires if an exception gets thrown and is not caught by the controlling code.

Check this article
Ben Nadel on application.cfc


text:
Q: Why doesn't this time conversion from UTC to local code work?         let dateFormatter = DateFormatter()
        let dateFormatter2 = DateFormatter()

        dateFormatter.timeZone = TimeZone(abbreviation: "UTC")

        dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"

        let date = dateFormatter.date(from: event!)

        dateFormatter2.timeZone = TimeZone.current
        let dateString = dateFormatter2.string(from: date!)

        let finalDate = dateFormatter2.date(from: dateString)
        return finalDate!

I have sports events that give me string dates in UTC which I am trying to convert into local time. This code is similar to the dozens of examples given in this site when asked this question, yet it doesn't work.

A: This is the iso8601 formatter :
static let iso8601: DateFormatter = {
    let formatter = DateFormatter()
    formatter.calendar = Calendar(identifier: .iso8601)
    formatter.locale = Locale(identifier: "en_US_POSIX")
    formatter.timeZone = TimeZone(secondsFromGMT: 0)
    formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
    return formatter
}()

This turns your string into a Date.
You will need to add the time difference, most likely through TimeZone.autoupdatingCurrent


text:
Q: Why doesn't it put the element on a string of a new list? I have a list of list of strings, and I want to get some strings from it to store them in a new list of list of strings. Here's the code:
    List<List<String>> colectieTotala = new ArrayList<>();
    List<List<String>> dePusInRaport = new ArrayList<>();
    List<String> listaPentruTest = new ArrayList<>();
    int i = 0;

    dePusInRaport.add(listaPentruTest);

for (int y = 0; y < colectieTotala.size(); y++)
    {
        String categorie;
        String categorieCurenta = "";
        char spatiu = ' ';
        int h = 0;
        List<String> toateCategoriileCurente = new ArrayList<>();
        colectieTotala.get(y).get(0);
        categorie = colectieTotala.get(y).get(1);
        colectieTotala.get(y).get(4);

        if (categorie.contains(" "))
        {
            for (int k = 0; k < categorie.length(); k++)
            {
                for (int p = 0; p < dePusInRaport.size(); p++)
                {
                if ((categorie.charAt(k)) == spatiu)
                {
                    categorieCurenta = categorie.substring(h, k);
                    h = k+1;
                    dePusInRaport.get(p).add(categorieCurenta);
                }

                if (k == categorie.lastIndexOf(spatiu))
                {
                    categorieCurenta = categorie.substring(k+1, categorie.length());
                    dePusInRaport.get(p).add(categorieCurenta);

                }

            }
            }

        }

    }
    System.out.println("dePusInRaport -> " + dePusInRaport);

The problem is that this code adds the strings from colectieTotala only on the first list of strings from from dePusInRaport, and what I want is getting the strings from colectieTotala and store them, each on a new List of Strings, of dePusInRaport. If you need further information, please ask for it. I'm not that good at explaining.
So, what System.out.println("dePusInRaport -> " + dePusInRaport); prints in the end is this:

[[Drama, Mystery, Crime, Drama, Mystery, SF, Drama, SF, Psihologic]]

but I want something like this:

[[Drama] [Mystery] [Crime] [Drama] [Mystery] [SF] [Drama] [SF] [Psihologic]]

I think there's a bad for in there, either I just forgot to add one...

A: Not able to explain pefectly as unable to understand your native language ,
but what you want to achieve can be done this way .
Suppose you have
List<List<String>> mainList=new ArrayList<List<String>>();// in this you add

List<String> myList=Arrays.asList("ABC","PQR","XYZ");// Input List
    for(String s:myList)
    {
          mainList.add(Arrays.asList(s));
    }
System.out.println(mainList);

Output
[[ABC], [PQR], [XYZ]]

Click here for Live Demo
If you want to remove comma , then I suggest you to override toString method and return in whichever style you want .


text:
Q: How to retrieve image from a web server url path to angularJS I am trying to retrieve images from my web server (on port 9100) to display on my angularJS page.
I wanted to display the image in the particular cell in my table.
Example like: "04080b363fb9d8fe825c7c664bb7a38d.png" image will be shown on the "04080b363fb9d8fe825c7c664bb7a38d.png" table when I click on the "view" button.
My folder from web server apache:

My GUI using angularJS:

My HTML code:
<!DOCTYPE html>

<title>Image viewers</title>

Search:

<select ng-model="searchBox.cameraid" style="width:25%">
  <option ng-repeat="x in records | unique:'cameraid'" value=" {{x.cameraid}}">{{x.cameraid}}</option>
  </select>

        CamID
        Timestamp
        View Image

        {{record.cameraid}}
        {{record.timestamp}}
         {{record.filename}}
        <button ng-click="toggleCustom()" onclick="myFunction()">View</button>

My js file:
var camListApp = angular.module('camListApp', []);
camListApp.filter('unique', function() {
    return function(input, key) {
        var unique = {};
        var uniqueList = [];
        for(var i = 0; i < input.length; i++){
            if(typeof unique[input[i][key]] == "undefined"){
                unique[input[i][key]] = "";
                uniqueList.push(input[i]);
            }
        }
        return uniqueList;
    };
  });
  camListApp.controller('Hello', ['$scope', '$http', function($scope, $http){

  $scope.custom = true;
  $scope.toggleCustom = function() {
   $scope.custom = ! $scope.custom;

 };
 $http.get('http://localhost:8081/camera/list').then(function(response) {
     console.log(response);
        $scope.records= response.data;
    });
  }]);

Can anybody help me with this?

A: To achieve the expected result, i have used few sample images with the assumption that the data from the backend will be in the format as below
 $scope.records=[{"id":23,"cameraid":"001","timestamp":"2016/06/15 17:27","filename":"http://www.w3schools.com/css/img_fjords.jpg"},

{"id":24,"cameraid":"002","timestamp":"2016/06/15 17:28","filename":"http://www.w3schools.com/css/img_forest.jpg"},
{"id":25,"cameraid":"003","timestamp":"2016/06/15 17:28","filename":"http://www.w3schools.com/css/img_lights.jpg"},
{"id":26,"cameraid":"003","timestamp":"2016/06/15 17:28","filename":"http://www.w3schools.com/css/img_mountains.jpg"}]
Codepen URL - http://codepen.io/nagasai/pen/jrMboq for reference.
Hope this works for you :)


text:
Q: Away3D with Starling I have an Away3D 4.0 application with UI made in old flash display API, which can be only partly hardware accelerated.
On PC works fine, but the frame rate of UI on mobile devices is too low, hence I am porting it to Starling.
So I tried using both Away3D and Starling, but they don't work together (it compiles but there are run-time errors). What do I have to change? Specifically or generally for maybe another 2D library such as ND2D. Are there libraries that support this out of the box?
Edit: First I add an Away3D content and there are no errors. When initialising Starling, the error is in Starling.as (a library class) on line 249. I also tried this as someone suggested, but didn't make any difference (also information is 3 months old and libraries are being updated).
Edit 2: The error was caused by having a different enableDepthAndStencil value as is in Away3D, which is hardcoded in Sparling as false, because it doesn't really need it. Well, after "fixing" this there are no runtime errors: Away 3D content displays, but then I add Starling and the canvas becomes black. I guess I will have to dive into the Away3D source.

A: You can view the source of the starling library on their github repository.
Here is a link to the Starling.as file>
https://github.com/PrimaryFeather/Starling-Framework/blob/master/starling/src/starling/core/Starling.as
the Starling method that is throwing an error is this:
        private function updateViewPort():void
        {
            if (mContext)
                mContext.configureBackBuffer(mViewPort.width, mViewPort.height, mAntiAliasing, false);

            mStage3D.x = mViewPort.x;
            mStage3D.y = mViewPort.y;
        }

From the look of that you should be able to remove this code for mobile, since your use will not be able to resize the viewport.
To do this, download the library from the github repository, instead of using the swc onthe starling site.
https://github.com/PrimaryFeather/Starling-Framework
Then you can customize your starling build for compatibility with Away3D.

A: I got it working by following instructions in this comment and the one afterwards (additionally only had to change enableDepthAndStencil to true in Starling.as in updateViewPort()).


text:
Q: Applying the divergence theorem to find a trapping region I want to check if my reasoning is correct. The problem is to show that the system
\begin{cases}
\dot x=x-y-x^3 \\
\dot y=x+y-y^3
\end{cases}
has a periodic solution.
In order to apply the Poincaré-Bendixson theorem, I need to find a trapping region.
I've already shown that the only fixed point is the origin. So, at this point my idea is to look for an annulus centered on the origin such that the flux of the vector field is positive through the smaller circle and negative through the larger one.
By integrating the divergence in a circle (say C) of radius r I get, after a few computations
\begin{gather*}
\iint_C [2-3(x^2+y^2)]\,dx\,dy=2\pi r^2(1-\frac{3}{4}r^2)
\end{gather*}
which is positive for $r<\frac{2}{\sqrt{3}}$ and negative for $r>\frac{2}{\sqrt{3}}$. Does this mean that I can take as a trapping region whatever annulus centered at the origin with radiuses that respectively smaller and greater than $\frac{2}{\sqrt{3}}$? Is this kind of reasoning correct?

A: It is better to note that
$$
\frac12(x^2+y^2)'=xx'+yy'=x^2+y^2-(x^4+y^4)
$$
is positive for very small $\|(x,y)\|$ and negative for very large $\|(x,y)\|$.


text:
Q: SELECT Query speed varies heavily with different inputs? I have this stored procedure in my database:
ALTER PROCEDURE [dbo].[sp_FTSearchLocation]
     @SearchFor nvarchar(200) = null
     ,@StartRow int
     ,@EndRow int
AS
BEGIN
SET NOCOUNT ON;

SELECT * FROM (
    SELECT TOP (@EndRow)
        *, ROW_NUMBER() OVER (ORDER BY Recommendations DESC, CompanyName) AS num
    FROM
        dbo.cachedSearchTable
    WHERE
        (
               (@SearchFor IS NULL)
            OR (CompanyName like '%' + @SearchFor + '%')
            OR (Handle like '%' + @SearchFor + '%')
            OR (Activity like '%' + @SearchFor + '%')
        )
    ) As a
    WHERE num > @StartRow

    OPTION (RECOMPILE)
END

dbo.cachedSearchTable has a clustered index with the columns Recommendations DESC, CompanyName. There are no other indexes. I think it is safe to use * because the table cachedSearchTable is constructed to only have columns that are relevant to this query.
For some search strings, this procedure runs very fast. For instance, searching for accountants returns in less than a second. However, others run very slowly: When @SearchFor is set to soup it takes about 6 seconds to return.
The execution plans for each of these look the same:
For Accountants:
ClusteredIndexScan (85%) ->
Segment (15%) ->
ComputeScalar (0%) ->
SequenceProject (0%) ->
Top (0%) ->
Filter (0%) ->
Select (0%).

For Soup:
ClusteredIndexScan (95%) ->
Parallelism (Gather Streams) (5%) ->
Segment (0%) ->
ComputeScalar (0%) ->
SequenceProject (0%) ->
Top (0%) ->
Filter (0%) ->
Select (0%).

However, for accountants, the ClusteredIndexScan has an estimated operator cost of 0.57, while for soup it has a cost of 25.34.
I tried putting 3 non-clustered indexes on the table - one for each of the searched columns - but this did not help.
There are lots of accountants in my database (~4000) and very few with 'soup' in their name (~50). In general, it seems that the query runs fastest when there are lots of possible results to chose from, and slowest when there are very few results to return.
How can I speed up this query? Slowing down the write speed to the table does not matter, but applying more indexes does not seem to help. Can you suggest anything?

A: Searching on LIKE %something will not benefit from a B-tree index. The fact that only 4000 rows take seconds (instead of milliseconds) to search is an additional hint this is the case. Don't get confused by the ClusteredIndexScan in your query plan - this is simply a clustered equivalent of a full table scan.
So, why the difference? Since there are many more accountants then soups, and you are only searching for TOP N rows, the first query will tend to find the N rows earlier than the second one, i.e. by scanning the lesser portion of the table.
You'll either need to rewrite your query to use LIKE something%, or (if possible) use the full-text indexing.


text:
Q: Can't add library from jitpack in Gradle I am trying to use the following library:
https://github.com/lguipeng/AnimCheckBox
I have added maven { url "https://jitpack.io" } like so:
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
        maven { url "https://jitpack.io" }
    }
}

But when I try to build my project I get the following error:

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:10:9-36
      is also present at [com.github.lguipeng:AnimCheckBox:1.0.1] AndroidManifest.xml:12:9-35 value=(true).
      Suggestion: add 'tools:replace="android:allowBackup"' to  element at AndroidManifest.xml:9:5-46:19 to override.

I'd rather not allow my app to be backed up, is there an alternative way to resolve this error then the one suggested in the above message?

A: Your issue is that the library has defined "allowBackup=true", while your own app defines it as "allowBackup=false".
To tell Gradle that it should use YOUR definition and not the one from the library, then you need to add the following attribute to the application tag of your manifest:
tools:replace="android:allowBackup"


text:
Q: What are some authoritative/respected "best known implementation" websites/resources? EDIT:
Wow, the initial response to this question was quite negative. I think I might have triggered some pretty strong emotions by using the word "best"; it seems like a few people latched onto that word and decided to dismiss my question right away.
Obviously, there are many, many situations in which no single approach is "best", or at least, what ends up being the best solution to one problem will often not be the best solution for other, even similar, problems. I get that. But now let me try to elaborate on the reasoning behind what I'm actually asking.
I tend to find it easiest to explain myself using analogies, so here goes. In my current job I work almost exclusively in .NET. .NET has a lot of functionality built into the framework. A prime example is the System.Collections.Generic namespace, which has a bunch of collection classes that (almost) no .NET developer in his/her right mind would bother re-developing from scratch, because very good implementations are already there. If I am working on a problem that requires a doubly linked list, I'm not going to decide, "Okay, time to write a doubly linked list class"; I'm just going to use the LinkedList<T> that's already there, or, at most, extend it or wrap it with my own class that adds some extra functionality.
Am I saying the "best" version of a doubly linked list is LinkedList<T> from .NET? Of course not. That would be absurd. But I highly doubt .NET's implementation of LinkedList<T> is drastically different from most other established libraries' implementations of collections that are intended to serve the same purpose (that of a doubly linked list). On the other hand, I am relatively confident that if I were to write my own implementation from scratch, there'd be a considerable number of issues with it, in terms of robustness, performance, flexibility, etc. for one simple reason: not that I'm stupid, or lazy, or don't care about good code--simply that I'm one person, and I'm not an expert on linked lists, and I haven't thought of everything that needs to be taken into consideration when designing one.
But I happen to be a developer who does take an interest in how things are implemented internally. And so it would be nice if I could check out a page where some variant of a well thought-out design for a linked list--or for any fairly established concept for which robust, efficient implementations have been written--were available to view. (By the way, yes I am aware that the source code for .NET's LinkedList<T> is available. I'm just using that as an example; really I am talking about all problems with solutions for which good, working implementations exist.)
Now, I talked about this being something that is open; let me elaborate on that. I am not talking about sites like SourceForge.net, or CodePlex, or Google Code. These are all sites for hosting projects, i.e., applications or libraries tailored for some specific industry or field or otherwise categorizable purpose. What I'm talking about is something like this:
http://en.wikibooks.org/wiki/Category:Algorithms_and_data_structures
Maybe I should have just provided that link in the first place, as it probably illustrates what I'm getting at better than anything I've written so far. But I think the main point that differentiates what I'm asking about from any other site I've seen is that I was specifically wondering if there could be some way to work on a new problem--so, something for which there aren't necessarily any well-known, established implementations, again as in my linked list example--collaboratively, in a wiki-esque fashion, but not tied to any specific open-source project.
So, as a conclusion of sorts, I was kind of envisioning a situation like the following: I find myself faced with a new problem. Maybe it isn't common enough to be something that is addressed in a framework like .NET. But it's common enough that some developers here and there are independently working on it. If a website exists like what I'm imagining, maybe at some point one of those developers working on the problem could post an idea on that website, and over time others might discover it and suggest improvements/modifications, and given enough time and participation, a pretty darn good implementation might result from all this collaboration. And from there, eventually, something like this implementation might be considered fairly "standard", just like a linked list implementation, or a quicksort implementation, or, I don't know, some well-known pseudo-random number generator.
Does this make any more sense to anyone now? I feel quite confident that what I'm talking about is not absurd, but hey, if that's what people think, then maybe it is.

Open source projects are very popular. Some of these are libraries suited for specific purposes, the best of which include some very well-written code.
However, if you're interested in contributing to an open source project, finding a project that is well-suited to your skills can be quite a task. At the same time, if you're interesting in using an open source project in your own work, finding a project that is well-suited to your needs can also be difficult, especially when, for example, open-source library X has a lot of functionality you could use, as does library Y, and these two libraries' capabilities overlap so that integrating both into your code could be messy.
We've all seen questions, here on Stack Overflow and elsewhere on the web, posted by one developer: "How would I implement this idea?" and answered by others, often accompanied by a plethora of example code. Sometimes these answers link to an open source project/library that provides functionality similar to what the poster is asking about.
My question is: are there any well-known websites or other sources that are open in nature and provide "best-known implementations" for common (or even not-so-common) programming problems, but not associated with any particular open source project?
As a generic example, suppose I have a need for some algorithm that does X. I post a question on SO or some other site requesting ideas, asking for suggestions on how best to implement it. One person points me to project P1, which contains some code that performs something very similar to this algorithm. Another person points me to project P2. Someone else writes some sample code and says, "maybe you could do it like this."
It seems to me, if there are all these different versions of this idea floating around out in the world, it would make sense for there to be a site, somewhat in the vein of Wikipedia, where a quasi-"official" implementation ("official" is not the right word; I'm just having trouble thinking of a better one right now) could be published and modified as improvements are developed/discovered.
I feel like I have stumbled across a few different sites like this in the past, but I'm interested to know if anyone else has found any resources like what I'm describing.

A: The very idea is absurd.  It means that there's one, single opinion on "best-known implementations" with no changes based on other people having better ideas.
It implies a that best practices are static and can be accumulated into a single repository.
If they could be collected, then Google would have them and would simply charge for access.
Interestingly, they don't have all the best practices.  Interestingly, they have to expend mountains of computing power looking for more information.  Then people (like you) have to read and think and judge and decide.
The read-think-judge-decide is really hard to eliminate.  Unless, of course, you want someone to think for you.  In which case, there are many companies who have a single solution that requires less thinking.  Call Microsoft or Oracle or IBM.  They have solutions that are all in one place, unified best practices, no reading, no thinking, no judging, no deciding required.
Open -- by definition -- means it's impossible to have a single authoritative source.

A: Here is something, maybe not the best implementations. But a book called Design Patterns contains what is considered by many programmers some of the best patterns to follow!


text:
Q: Longest Loop in Graph Please consider the following graph:

Is there a formal definition for the longest nonrepeating sequence of vertices which form a loop in a graph? (A, G, B, C, D, E, F)
And how about the longest loop without shortcuts? (A, B, C, D)
The closest I'm aware of is the Graph Diameter, but that's obviously very different.

A: What you call "loop" is more commonly known as a cycle, and there doesn't seem to be any common term other than "longest cycle".
Your "loop without shortcuts" appears to be a chordless cycle. Again, I don't think there's a commonly used nicer term than "longest chordless cycle".


text:
Q: Can CSS alter an input element's SRC attribute? Is it possible, via CSS to remove or change the src reference in the markup below?
The easy thing to do would be to change the markup, however, this code is in the wild and I need to deal with it as it is, so I'm trying to remove the image and use a background image instead.
<input type="image" src="wp-content/uploads/image.png" name="submit" class="submit" value="Submit" />

A: You can experiment with setting height and width to 0, add a padding and set the background image. You will have to make it display: block or display: inline-block for the height to take effect.
Here's an example - http://jsfiddle.net/zBgHd/1/

A: Actually, I just figured it out.
.submit {width:0;height:28px;background:url(go.png) no-repeat; padding-left:28px;}
My replacement image is 28x28. By specifying a left padding equal to that, and a width of zero, it effectively pushes the image off the viewable area of the box, leaving the background image to show.

A: Although that is specifically about the img src attribute, it still holds true for input src.  This question pretty much answers it for you - How to change an input button image using CSS?
Another related question: Define an <img>'s src attribute in CSS

A: No, to answer your question.  Not in any version of any browser (AFAIK).
Any solution will involve a workaround.  I'm testing out one right now, where you use a :before rule to create a background image on top of it.
Update... Well, for what it's worth, :before is not respected on input elements, whereas @Chetan's fiddle does work when I change the img tag to input.  So, kudos.