text:
Q: content invisible using footer in Android I am using header, content and footer. but the content part is not visible in fully. some line is invisible. i tried to change the height size in Relative layout also.
here my code
       <?xml version="1.0" encoding="utf-8"?>
        <RelativeLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              >
         <RelativeLayout
          android:id="@+id/rl_bike"
          android:layout_width="fill_parent"
          android:layout_height="40dp"
          android:background="@drawable/head" >

            <TextView android:id="@+id/txtTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="@string/details"
                android:textColor="#fff"
                android:textStyle="bold"
                android:textSize="20dp"/>

                <Button
                    android:id="@+id/btn_back"
                    android:layout_width="80dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="2dp"
                    android:layout_marginTop="3dp"
                    android:background="@drawable/back"
                    android:text="Gebrauchte"
                    android:textColor="#fff" android:textSize="10dp"   android:textStyle="bold">

        </Button>
         </RelativeLayout>

         <ScrollView
               android:id="@+id/scrollView"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:layout_below="@+id/rl_bike">
        <RelativeLayout
              android:id="@+id/r2_bike"
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:layout_below="@+id/rl_bike"
              android:background="#fff">        <RelativeLayout
              android:id="@+id/r3_bike"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"  >
       <TextView
            android:textSize="20dp"
            android:textStyle="bold"
            android:id="@+id/txtBikeTitle"
            android:layout_width="wrap_content"
            android:text="@string/title"
            android:textColor="#000"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="4dp"></TextView>

         <ImageView
              android:id="@+id/image"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="55dp"

               />

             </RelativeLayout>

          <RelativeLayout
              android:id="@+id/r4_bike"
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/r3_bike"
              android:background="#fff">
         <Gallery
              android:id="@+id/Gallery01"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/image"
              android:layout_marginLeft="1dp"
              android:spacing="10dip">
          </Gallery>
          </RelativeLayout>
         <RelativeLayout
              android:id="@+id/r5_bike"
              android:orientation="vertical"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/r4_bike"
              android:background="#fff">

          <TextView
                android:id="@+id/txtErst"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:text="@string/erst"

                android:textColor="#000"
                android:textSize="12dp"
                android:textStyle="bold"
                android:layout_marginLeft="8dp"
                />

                 <TextView
              android:id="@+id/erstValue"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginLeft="100dp"

               />

                <TextView
                android:id="@+id/km"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:text="km-Stand :"
                android:textColor="#000"
                android:textSize="12dp"
                android:textStyle="bold"
                android:layout_marginLeft="8dp"
                android:layout_below="@+id/txtErst">
                </TextView>
                <TextView
              android:id="@+id/kmValue"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginLeft="100dp"
              android:layout_below="@+id/txtErst"
               />

       <View
                android:id="@+id/l1"
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:layout_below="@+id/km"
                android:background="#FF909090" />
       <LinearLayout
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_below="@+id/l1"
           android:id="@+id/ll"
           android:orientation="vertical"
           >
         <TextView
                android:id="@+id/mdata"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:text="Motor -und Getriebedaten "
                android:textColor="#000"
                android:textSize="15dp"
                android:textStyle="bold"
                android:layout_marginLeft="8dp"
                android:layout_below="@+id/l1"
                />

         <TextView
             android:id="@+id/hubraum"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
             android:text="Hubraum :"
             android:textColor="#000"
             android:textSize="12dp"
             android:layout_gravity="left"/>

        <TextView
               android:id="@+id/leistung"

               android:layout_below="@+id/hubValue"/>
                    <TextView
               android:id="@+id/kraftstoff"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Kraftstoff :"
               android:textColor="#000"
               android:textSize="12dp"

               android:layout_marginLeft="8dp"
               android:layout_below="@+id/leistungValue" android:layout_marginTop="5dp"/> <TextView
              android:id="@+id/antrieb"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Antrieb :"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginTop="5dp"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/kraftstoff"/>      <!--<TextView       <TextView
              android:id="@+id/Getriebe"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="getriebe :"
              android:textColor="#000"
              android:textSize="12dp"

              android:layout_marginLeft="8dp"
              android:layout_below="@+id/antriebValue"/>

       </LinearLayout>      <View
              android:id="@+id/l2"
              android:layout_width="fill_parent"
              android:layout_height="1dip"
              android:layout_below="@+id/ll"
              android:background="#FF909090" />
        <TextView
              android:id="@+id/price"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Preis :"
              android:textColor="#000"
              android:textSize="12dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/l2" android:layout_marginTop="2dp"/>
            <TextView
              android:id="@+id/priceValue"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textStyle="bold"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginTop="2dp"
              android:layout_marginLeft="100dp"
              android:layout_below="@+id/l2"
               />

                 <TextView
              android:id="@+id/priceSymbol"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="EUR"
              android:textStyle="bold"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginLeft="170dp"
              android:layout_below="@+id/l2"
               android:layout_marginTop="2dp"/>
       <View
              android:id="@+id/l3"
              android:layout_width="fill_parent"
              android:layout_height="1dip"
              android:layout_below="@+id/price"
              android:background="#FF909090" android:layout_marginTop="2dp"/>
       <TextView
              android:id="@+id/farbe"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="Farbe :"
              android:textColor="#000"
              android:textSize="12dp"
               android:layout_marginTop="2dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/l3"/>
       <TextView
              android:id="@+id/farbeValue"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:textStyle="bold"
              android:textColor="#000"
               android:layout_marginTop="2dp"
              android:textSize="12dp"
              android:layout_marginLeft="100dp"
              android:layout_below="@+id/l3"
               />
       <View
              android:id="@+id/l4"
              android:layout_width="fill_parent"
              android:layout_height="1dip"
              android:layout_below="@+id/farbe"
              android:background="#FF909090" />

              <TextView
              android:id="@+id/txtAbs"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="ABS"
              android:textColor="#000"
              android:textSize="12dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/l4"
              /> <TextView
              android:id="@+id/FID"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="FID"
              android:textColor="#000"
              android:textSize="12dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/heizgriffe"/> <TextView
              android:id="@+id/txt_ohlFrwork"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="Ohliens frwork"
              android:textColor="#000"
              android:textSize="12dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/FID"/>
                  <TextView
              android:id="@+id/bmw_seitencoffer"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:text="BMW-Seitencoffer"
              android:textColor="#000"
              android:textSize="12dp"
              android:textStyle="bold"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/txt_ohlFrwork"/>

    <TextView
              android:id="@+id/bmw_seitencofferValue"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginLeft="8dp"
              android:layout_marginTop="5dp"
              android:layout_below="@+id/bmw_seitencoffer"/>
                 <TextView
              android:id="@+id/beschre"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="#000"
              android:textSize="14dp"
              android:textStyle="bold"
              android:text="Beschreibung"
              android:layout_marginLeft="8dp"
              android:layout_below="@+id/bmw_seitencofferValue"/>
                                                 <TextView
              android:id="@+id/beschreibung"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="#000"
              android:textSize="12dp"
              android:layout_marginLeft="8dp"
              android:layout_marginTop="5dp"
              android:layout_below="@+id/beschre"/>

              </RelativeLayout>
         <RelativeLayout
              android:layout_width="400dp"
              android:layout_height="150dp"
              android:layout_below="@+id/r5_bike"

             >
         <RelativeLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/beschreibung"
              android:background="@drawable/footer"
              android:layout_marginBottom="7dp"
              android:layout_marginTop="5dp"
              android:layout_marginLeft="7dp"
              android:layout_marginRight="7dp">

        <TextView
                android:id="@+id/handle"
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:textStyle="bold"
                android:textSize="12dp"
                android:textColor="#000"
                android:text="Haendlerangebot"
                android:layout_marginLeft="30dp"
               ></TextView>
          <TextView
                android:id="@+id/link"
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:textStyle="bold"
                android:textSize="12dp"
                android:maxLines="1"
                android:singleLine="true"
                android:ellipsize="end"
                android:textColor="#000"
                android:text="website"
                android:layout_marginLeft="140dp"
               ></TextView>

           <TextView
                android:id="@+id/bikeName"
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:textStyle="bold"
                android:textSize="12dp"
                android:textColor="#000"
                android:gravity="center"
                android:layout_centerInParent="true"
                android:text="Zitta"
                android:layout_marginLeft="80dp"
                android:layout_below="@+id/handle">
            </TextView>
            <Button
                 android:id="@+id/btn_footarrow"
                 android:layout_width="30dp"
                 android:layout_height="30dp"
                 android:layout_below="@+id/bikeName"
                 android:layout_marginLeft="260dp"
                 android:background="@drawable/arrow" />
            <TextView
                android:id="@+id/txtWebLand"
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:textStyle="bold"
                android:textSize="10dp"
                android:gravity="center"
                android:textColor="#000"
                android:text=""
                android:layout_centerInParent="true"
                android:layout_below="@+id/bikeName">

              </TextView>
             <TextView
                android:id="@+id/address"
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:textStyle="bold"
                android:textSize="10dp"
                android:gravity="center_vertical"

                android:textColor="#000"
                android:text="@string/address"
                android:layout_centerInParent="true"
                android:layout_below="@+id/txtWebLand">

              </TextView>

               <TextView
                android:id="@+id/telNoName"
                android:layout_width="wrap_content"
                android:layout_height="15dp"
                 android:gravity="center_vertical"
                android:textSize="10dp"
                android:textColor="#000"

                android:text="Tel:"
               android:layout_centerInParent="true"
                android:layout_below="@+id/address"/> <TextView
                android:id="@+id/faxName"
                android:layout_width="wrap_content"
                android:layout_height="15dp"
                 android:gravity="center_vertical"
                android:textSize="10dp"
                android:textColor="#000"
                android:text="Fax :"
                android:layout_centerInParent="true"
                android:layout_below="@+id/telNoName">

              </TextView>

           </RelativeLayout>
                      </RelativeLayout>
    </RelativeLayout>

    </ScrollView>
    <RelativeLayout
        android:id="@+id/rl_footer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#fff">
        <WebView
            android:layout_width="fill_parent"
            android:layout_height="50dp">

        </WebView>
    </RelativeLayout>

 </RelativeLayout>

Last fax no is missing and that rectangle box is not visible in fully. if i am not using the footer view mean its working fine. what's the issue heere?

A: I don't know with your code, I guess either you recopied your xml file more than once, or you have not separated out your xml file. Whatever is the case. Edit your question, and post your question properly.
Apart from that, as far as your answer is concern you can use android:layout_weight="" for separating out your layout and get proper alignment to your screen. Try that out. If any problem let me know.


text:
Q: Apache2 virtual hosts each on other disk is possible? hwo How to? My OS is Linux. I need configure Apache2 with virtual host, but each virtual host I need place on separate disk (first disk no enough space). Is it possible? If yes, please tell me how to do it?
Example:
path httpd.conf DocumentRoot is: /srv/www/htdocs/
first path vhost is: /srv/www/htdocs/www.firstvhost.com.ghi
second vhost path is: /srv/www/htdocs/www.secondvhost.com.ghi
I need:
www.firstvhost.com.ghi - all files on first SSD disk,
www.secondvhost.com.ghi - all files on second HDD disk.
Is it possible? May with symlinks - but I don't know ho to do it, please help and explain.

A: Have you tried just specifying the path you want to use for each virtual host in a VirtualHost section in httpd.conf for each host with a statement like DocumentRoot /mnt/somedirectory/firsthost Do you have a reason for needing to put each one under /srv/www/htdocs/?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Does anyone still hide JS from old browsers? Does anyone still use the old
<!-- hide JS from old browsers -->

trick?
As I recall, this was targeted at people who used Netscape, or IE4.
I just checked out our stats and in the last month we had more people visit the site using "Playstation Portable " (4 visits) as their user agent than we had using Netscape (1 visit).
Is there any point in me even having the "hide" thing in my javascript?

A: No. {insert extra chars here to meet limit for SO}

A: The way I figure it, if you're designing an application with which one of the main selling points is javascript-based interactivity, there's no point in catering to older browsers.
Still, it's important to know the specific goals of your product.  You need to know who you're targeting and make an informed decision as to whether or not it's worth it.
In any case, you should make an attempt to discover whether or not a browser has javascript enabled, and if not, inform them of why your site will not work.

A: No, you no longer need to do that.
Crockford also says...

Do not use the <!-- //--> hack with scripts. It was intended to prevent scripts from showing up as text on the first generation browsers Netscape 1 and Mosaic. It has not been necessary for many years. <!-- //--> is supposed to signal an HTML comment. Comments should be ignored, not compiled and executed. Also, HTML comments are not to include --, so a script that decrements has an HTML error.

A: Yes, and you should, too. Drupal does it this way:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
...
//--><!]]>
</script>


text:
Q: Improve selenium code's speed I'm using Selenium in python to test a data table (not really a html table, combined by multiple divs)
That's what my table looks like:

        20$
        10$

        20$

    ...

There are multiple products, some has discounted price.
This is my script:
products = self.driver.find_elements_by_css_selector('.products > div')
for product in products:
    found_price = True
    try:
        original_price = product.find_element_by_css_selector('.original-price').text
        reduced_price = product.find_element_by_css_selector('.discounted-price').text
    except NoSuchElementException:
        try:
            original_price = product.find_element_by_css_selector('.price').text
            reduced_price = original_price
        except NoSuchElementException:
            found_price = False

    if found_price: check_price(original_price, reduced_price)

But my script runs very slowly. It sends a lot of request "remote_connection" each time the "find_element_by_css_selector" called like this one:
2018-02-27 13:48:08 [selenium.webdriver.remote.remote_connection] DEBUG: POST http://127.0.0.1:62147/session/14902b71a0f812fa74f81524f0eb1386/elements {"using": "css selector", "sessionId": "14902b71a0f812fa74f81524f0eb1386", "value": ".products > div .original-price"}
2018-02-27 13:48:08 [selenium.webdriver.remote.remote_connection] DEBUG: Finished Request

Any ideas to improve its performance ?
Thanks !

A: One of the parameters of the remove WebDriver is keep_alive. As the doc says:
keep_alive - Whether to configure remote_connection.RemoteConnection to use
             HTTP keep-alive. Defaults to False.

Keeping the connection alive would improve the speed as it does not have to connect on every find request.

A: It is still inconslusive why you feel your script runs very slowly. As you mentioned your code sends a lot of request remote_connection each time the find_element_by_css_selector is exactly the way as it is defined in the WebDriver-W3C Candidate Recommendation.
A small test with the Search Box of Google Home Page i.e. https://www.google.co.in with all the major variants of WebDrivers and Web Browsers reveals that :

*

*Each time you search a webelement in the HTML DOM as follows :
product.find_element_by_css_selector('.original-price')

*The following request is generated :
[selenium.webdriver.remote.remote_connection] DEBUG: POST http://127.0.0.1:62147/session/14902b71a0f812fa74f81524f0eb1386/elements {"using": "css selector", "sessionId": "14902b71a0f812fa74f81524f0eb1386", "value": ".products > div .original-price"}
[selenium.webdriver.remote.remote_connection] DEBUG: Finished Request

*On a successful search the following response is sent back from the Web Browser :
webdriver::server   DEBUG   <- 200 OK {"value":{"element-6066-11e4-a52e-4f735466cecf":"6e35faa4-233f-400c-a6c7-6a66b54a69e5"}}

You can find a detailed discussion in Values returned by webdrivers

*

*However there will be some deviation in the performance depending on the Locator Strategy you use.

*There have been quite some experiments and benchmarking about the performance aspects of the locators. You can find some discussions here :

*

*Locator Performance Metrics using Selenium

*Css Vs. X Path

*Css Vs. X Path, Under a Microscope

*Css Vs. X Path, Under a Microscope (Part 2)

*What is the difference between css-selector & Xpath? which is better(according to performance & for cross browser testing)?


text:
Q: how to add a HTML element to a QT WebView I have a desktop c++/qt gui app, that is using QWebview as its central widget.
I am struggling to do something which seems fairly trivial.  I want to add an element to a web page from qt like the following example

When Are You Going To Fix This

to

When Are You Going To Fix This

I am doing it now

I have tried and other variations
//.. Gui set up and url loaded into webview
//  my attempt at adding a new HTML element

QWebFrame * frame   = ui->webView->page()->mainFrame();
QWebElement body   = frame->documentElement().findFirst("BODY");

if(!body.isNull()){
    QWebElement newElem; //create a new element to
    newElem.appendInside("
I am doing it now
");
    newElem.appendInside(body);
}

I have also tried creating a new element and building the desired parts but to no avail
QWebFrame * frame   = ui->webView->page()->mainFrame();
QWebElement body   = frame->documentElement().findFirst("BODY");

if(!body.isNull()){
    QWebElement newElem; //create a new element to
    newElem.setAttribute("TAG", "P");
    newElem.setAttribute("innerHTML", "I am doing it now");
    newElem.appendInside(body);
}

Is it possible to do this with the qt webkit or am I missing something blantly obvious..?

A: I don't know about QWebElements but I'd simply extracted the html as QString with ui->webView()->page()->mainFrame()->toHtml(); then inserted the paragraph to the html and finally loaded the html into QWebView with ui->webView()->setHtml(html);.


text:
Q: Finding max value of each column of 4x4 Array I have the following array in both MatrixForm and List form
0.474042    0.507508    0.4977      0.539773

0.473447    0.50765     0.483809    0.52489

0.46797     0.483669    0.494823    0.516956

0.467079    0.483509    0.478704    0.501286

A = {{ 0.474042, 0.507508, 0.4977,   0.539773},
     { 0.473447, 0.50765,  0.483809, 0.52489 },
     { 0.46797,  0.483669, 0.494823, 0.516956},
     { 0.467079, 0.483509, 0.478704, 0.501286}
    }

I want to get the max value of each column. I've tried the following for the first columns but no help:
Max[A[[All, 1]]]

Any comment will be greatly appreciated.

A: As already recommended by belisarius but once again as complete code to leave no stone unturned:
A = {{0.474042, 0.507508, 0.4977, 0.539773}, {0.473447, 0.50765, 0.483809,
    0.52489}, {0.46797, 0.483669, 0.494823, 0.516956}, {0.467079, 0.483509, 0.478704,
    0.501286}};

A // MatrixForm

$\left(
\begin{array}{cccc}
 0.474042 & 0.507508 & 0.4977 & 0.539773 \\
 0.473447 & 0.50765 & 0.483809 & 0.52489 \\
 0.46797 & 0.483669 & 0.494823 & 0.516956 \\
 0.467079 & 0.483509 & 0.478704 & 0.501286
\end{array}
\right)$
Max /@ Transpose[A]

{0.474042, 0.50765, 0.4977, 0.539773}

Also less efficiently:
MapThread[Max, A]

{0.474042, 0.50765, 0.4977, 0.539773}

A: A = { {0.474042,0.507508,0.4977,0.539773},  {0.473447,0.50765,0.483809,0.52489},
     {0.46797,0.483669,0.494823,0.516956}, {0.467079,0.483509,0.478704,0.501286}}

Try
Max @ A[[All, #]] & /@ Range[4]

Which gives:

{0.474042, 0.50765, 0.4977, 0.539773}

You can also do:
Max @@@ (A\[Transpose])


text:
Q: Error when installing react-native-gesture-handler with npm I am trying to run npm install react-native-gesture-handler but my terminal gives me this error:
SAMETs-MBP:HelloWorld developer$ npm install react-native-gesture-handler
npm ERR! path /Users/developer/HelloWorld/node_modules/react-native-safe-area-view
npm ERR! code EISGIT
npm ERR! git /Users/developer/HelloWorld/node_modules/react-native-safe-area-view: Appears to be a git repo or submodule.
npm ERR! git     /Users/developer/HelloWorld/node_modules/react-native-safe-area-view
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/developer/.npm/_logs/2019-05-14T05_27_08_555Z-debug.log

Can anyone help me on this? I searched online but couldn't find anything.

A: I faced the same issue today. Tried three steps and worked!

*

*Removed the folder 'react-native-safe-area-view' manually

*Removed cache using npm start -- --reset-cache

*Run the command npm --save install react-native-gesture-handler
Update: I also found out deleting git folder inside the node_modules/react-native-safe-area-view will fix this issue. Thanks @ThaJay
Hope it will help!

A: use yarn. using npm gave me an error. I tried with yarn, it didn't give any issue.

A: running rm -rf node_modules/*/.git/  from root folder fixed my issue. reference https://github.com/react-native-community/react-native-safe-area-view/issues/73

A: Just delete the .git folder inside your_project_dir/node_modules/react-native-safe-area-view.
And it worked for me.


text:
Q: Why is the bar construction of a DG algebra a coalgebra? Let $A$ be a differentially graded augmented algebra. Then $\mathbf{B}A$ can be equipped with the structure of a coalgebra. This is proved in, for example, Loday and Vallette's book on Algebraic Operads.
The $n$-lab page https://ncatlab.org/nlab/show/bar+and+cobar+construction points out that the coalgebra structure can be understood as showing all the possible ways to decompose a path of length $n$ into pairs of shorter paths of lengths $(p,q)$ with $p+q=n$. This helps but I still don't really have intuition.
Many books define $\mathbf{B}A$ as follows. First, we can construct the free (conilpotent) coalgebra on $\mathbf{B}A$. Now, define the differential using the universal property of the free coalgebra, and check that it happens to satisfy the law $d^2=0$; so we have a DG coalgebra.
This makes sense, of course. However even if you had no idea that $\mathbf{B}A$ was supposed to be a coalgebra, there's still a very natural differential to put on that chain complex, which comes from applying the Moore normalization to the simplicial object constructed using this process. https://ncatlab.org/nlab/show/two-sided+bar+construction
So my question is, if I look at $\mathbf{B}A$ as the Moore normalization of the two-sided bar construction $B(1,A,1)$ (where $A$ acts on $1$ as a module on both the left and the right) why should we expect this to have a coalgebra structure. Or, alternatively, if you prefer to view $\mathbf{B}A$ as a coalgebra a priori on top of which we can put a unique compatible differential, why does this differential agree with the one given by $B(1,A,1)$?
I think I am either looking for geometric intuition for why this should be true, or ideally kind of nice categorical argument by which we can construct the comultiplication and counit on $B(1,A,1)$.

A: This is the type of question with multiple correct answers, because, as you say, it depends very much on what you think the bar construction "is" initially.
You say you want to think of $\mathbf{B}A$ as $B(1,A,1)$. Well, I don't know what you think $B(X,A,Y)$ "is", but one thing that it "is"  is a specific nice resolution of the derived tensor product $X \otimes_A^{\mathbb{L}} Y$.
From this perspective, your question is a version of: is there a good reason for $1 \otimes_A 1$ to be a coalgebra? In other words, can we produce a map $$1\otimes_A 1 \to (1 \otimes_A 1) \otimes (1 \otimes_A 1)?$$
Yes. The left hand side is equivalent to $1 \otimes_A A \otimes_A 1$, whereas the right hand side is equivalent to $1 \otimes_A 1 \otimes_A 1$. The (augmentation) ring homomorphism $\epsilon: A \to 1$ that you start with is in particular an $A$-bimodule homomorphism, so you do indeed have the map
$$ 1 \otimes_A \epsilon \otimes_A 1 : 1 \otimes_A A \otimes_A 1 \to 1 \otimes_A 1 \otimes_A 1.$$
Then coassociativity is just that you apply $\epsilon$ in "different spots". Oh, and it requires associativity of $\otimes_A$, which I have already suppressed from the notation.
Actually, because $B(-,A,-)$ is a derived tensor product, the associativity of $\otimes_A$ could a priori require lots of coherence data — it could have been merely $\mathsf{A}_\infty$ rather than associative. The result is that you could have concluded that $B(1,A,1)$ was merely a co$\mathsf{A}_\infty$-coalgebra, rather than a coassociative coalgebra. That it is indeed coassociative is a niceness property of the specific resolution that you chose.


text:
Q: Unable to run TortoiseGit + cntlm + proxy server I'm tryng to start using Git on GitHub. Unfortunately I can't manage to get it working, I always receive, when I try to clone the repository, the message "Connection refused". Since I'm behind a proxy server I suppose the problem is there, but I don't know how to fix.

Below what I tryed so far:
I open the account on GitHub  then I generated a key with putty gen:

I saved the private key (2)  on the disk and sent the public(1) into the github place for SSH keys:

Then I used the private key in the clone phase as below:

This did not work for me, so I tryed to authenticate with my proxy using  Cntlm
and setting it to point the enterprise proxy.
Then I changed the tortoisegit configuration as below:

but when I try to clone I'm always facing the "Connection Refused" error.
The Cntlm configuration file looks like:
Username    fpollano
Domain      mydomain
PassLM          93D6A9F56CD43B4571101CC5806411F2
PassNT          5FD9AD7F1504A469D994241648972131
PassNTLMv2      7255AE1CBA2511A751F848FC34087011
#Workstation    netbios_hostname    # Should be auto-guessed

Proxy       192.168.1.5:8080

( I even check with clear password, with same results )
Anyone know a solution ? Alternatively any way to get some of these agents log something somewhere ?
Thanks to all !

A: On windows, it will help if you have the following environment variables defined before any pull/push using https GitHub address:
http_proxy="http://username:password@proxy:port/"
https_proxy="http://username:password@proxy:port/"
HOME=C:\Path\To\HOME

(http_proxy in lowercase)
Your %HOME% (which isn't defined by default on Windows) can be any path, but it must be the parent directory of your .ssh which contains your id_rsa.pub and id_rsa files (your public and private keys)
In your %HOME%, you will also need an _netrc file:
machine github.com
login loginGitHub
password passwordGitHub

From there, you will be able to clone your GitHub repo:
git clone https://github.com/Login/repo

To debug those kind of connection errors, set GIT_CURL_VERBOSE=1, and make sure your CApath is correct.
git config --system http.sslcainfo "C:\path\to\your\git\bin\curl-ca-bundle.crt"

A: I had this issue. Our Sys admin forced Internet traffic to go through a proxy and I was suddenly unable to push/pull to/from GitHub. I tried VonC's answer with no luck.  Fortunately our Sys Admin whitelisted github.com on the Firewall and I was back in business. So it doesn't hurt to ask. :)


text:
Q: Strange "TypeError: Object is not a function" error I am trying to create a mixin using Styled Components which I later use to style multiple components. However, I get this error at run-time:

There is no compile or lint error. I am using:

*

*Typescript: 2.8.3

*react-scripts-ts: 2.15.1

*styled-components: 3.2.6

*React: 16.3.0

What's causing this?

A: I had some error, but since I was upgrade react to ^16.8.3 and degrade styled-components to 4.0.3 - all works fine.
Seems upgrade React quite enought to solve)
It usual way to fix "strange errors", degrade "broken" libs and upgrade system libs.


text:
Q: Snort doesnt appear to be catching all traffic on the network I am using Snort 3 with Ubuntu on a Virtualbox VM hosted on Windows Server. I am using pulledpork 3 for the rules and I also have a local rule of:
alert icmp any any -> any any ( msg:"ICMP Traffic Detected"; sid:10000001; metadata:policy security-ips alert; )

which should alert on any icmp traffic. This works fine if I ping the box specifically but if I ping from another address to another address it does not pick that up.
I have the network adapter tied to a physical dedicated adapter on the host and it is configured as a bridge adapter with Promiscuous mode set to Allow All and Cable Connected is checked on the VM.
I am launching Snort thusly:
sudo snort -c /usr/local/etc/snort/snort.lua -i enp0s3 -A alert_fast -s 65535 -k none --plugin-path "/usr/local/etc/so_rules/"

Is there something I need to do to the physical adapter to allow promiscuous mode also or something?


text:
Q: C++ Strings single chars I've just started learning C++ and im kinda confused about strings.
I first need a input word and save every single char in the certain position of a char-Array.
But strings are basically char-Arrays, aren't they?
But this does not work:
char word[];
cin >> word[];

Whereas this works but I dont know how to fill the chars into an Array.
string s;
cin >> s;

I've tried this so far, but i got an compile error:
string s;
cin >> s;
char word[] = s;

I'm sorry, I've just started programming and I wonder if anyone has some advice for me :)

A: char word[];

You need to give the size of the array. Then, you can take input to it directly. If you wish to copy read the std::string to the character array, then you need to use safe string copy functions like strncpy. For example -
char word[10];
std::string str("Hello");

strncpy(word, str.c_str(), sizeof(word));

However, std::string is recommended in C++ rather than working with character arrays.


text:
Q: How to get back to the current running test on Intellij IDEA? I run unit-tests from Intellij IDEA with "Track running test" option enabled and Filter turned off.
It works fine until I click on some already passed test, after that it stops tracking current running test.
Is there a way to get back to tracking?

A: Try switching Filter on and off. You should end up in currently running test. It works for me.


text:
Q: Setting up more than one MQTT broker with Docker Using Docker, I was able to use eclipse-mosquitto to set up an MQTT broker with my app, which subscribes to messages. I'm learning Docker right now, so wanted to try adding two brokers to Docker-compose with different ports mapped like this:
version: '3'
services:
  myapp:
    ...
    links:
      - mqtt
      - mqtt2
    depends_on:
      - mqtt
      - mqtt2
  mqtt:
    image: eclipse-mosquitto:latest
    container_name: mqtt-iot
    ports:
      - 1883:1883

  mqtt2:
    image: eclipse-mosquitto:latest
    container_name: mqtt2-iot
    ports:
      - 1884:1883

From outside of the myapp container (i.e. from my OS X terminal), both mqtt and mqtt2 are working; I can publish and subscribe to messages as expected.
const mqtt = require('mqtt')
mqtt.connect('mqtt://mqtt', {port: 1883}) // Success
mqtt.connect('mqtt://mqtt2', {port: 1884}) // Success

However, when I'm inside the container of myapp, I can only connect to mqtt. mqtt2 connection fires the offline event right away, and no connection fails. What do I need to do to for myapp to be using both of those brokers properly?

A: Two issues here
links:
  - mqtt
  - mqtt2

Links is deprecated now and is not even required in your compose. Next when you use below
const mqtt = require('mqtt')
mqtt.connect('mqtt://mqtt', {port: 1883}) // Success
mqtt.connect('mqtt://mqtt2', {port: 1884}) // Success

From outside. This is based on the ports on the host. When you do it from app container you should do it like below
const mqtt = require('mqtt')
mqtt.connect('mqtt://mqtt', {port: 1883}) // Success
mqtt.connect('mqtt://mqtt2', {port: 1883}) // Success

The container cannot see mapped port on host. It will see what is inside the network. And in local network both are listen on 1883


text:
Q: Quirks when using overloaded methods with params string[] and inheritance I had a class like this
public class Child
{
    public string ToXml()
    {
        return "Child : ToXml()";
    }

    public string ToXml( params string[] fields )
    {
        return "Child : ToXml(...)";
    }
}

creating an instances of class Child and calling ToXml() returns the first overloaded function which was fine and dandy.
var obj = new Child();
Console.WriteLine( obj.ToXml() );

Output:
Child : ToXml()

But when I added a Parent class and changed the Child class to this :
public class Parent
{
    public virtual string ToXml()
    {
        return "Parent : ToXml()";
    }
}

public class Child : Parent
{
    public override string ToXml()
    {
        return "Child : ToXml()";
    }

    public string ToXml( params string[] fields )
    {
        return "Child : ToXml(...)";
    }
}

The output has changed to this :
Child : ToXml(...)

My question is, why is the behaviour like this? (I'm using VS2010 using .NET 3.5)
I kind of 'fixed' this problem by changing the second overloaded function to this : (I took out the params keyword
public class Child : Parent
{
    public override string ToXml()
    {
        return "Child : ToXml()";
    }

    public string ToXml( string[] fields )
    {
        return "Child : ToXml(...)";
    }
}

Which brings me to my second question (let me know if I should split this to 2 different post), what is the difference between the functions
ToXml( params string[] fields )

and
ToXml( string[] fields )

They both seems to work when I call the functions like so :
var obj = new Child();
Console.WriteLine( obj.ToXml( new [] { "foo", "bar" ) );

A:
why is the behaviour like this?

It is not clear what you mean by "like this", so first off, let's characterize the behaviour correctly. The behaviour you are experiencing is: for the purposes of overload resolution, an applicable candidate method on a derived type is always better than an applicable candidate method on a base type. Moreover, a virtual method is considered to be a method of the type which declares it, not the type which overrides it.
It's also not clear what you mean by "why"? "Why" questions are hard to answer; in one sense the question is already answered: why does the compiler exhibit that behaviour? Because that's the consequence of the specified rules for overload resolution tie breaking.  But you might then say that the question has been begged; the question now is "so why was the specification written that way?"
The specification was written that way because doing so mitigates the brittle base class problem.  The brittle base class problem is the situation where you have two teams, one working on the base class, and one working on the derived class. If the team working on the base class introduces a new method, then doing so should not change the behaviour of code that uses the derived class. If it does, then the base class change has "broken" the derived class behaviour. C# has been carefully designed to mitigate brittle base class problems.
Even leaving the brittle base class problem out of it, it makes sense to prioritize the method on the derived class. The developers of the derived class have more information than the developers of the base class. They know that they've got a Banana in hand; the developers of the base class only know that they have a Fruit. The call should go to the method written by the developers who had more information when possible.
You might then say "well, the question has been begged again; now I want to know why mitigating the brittle base class problem is important". Rather than continue down this infinite regress I'll just leave it at that; if you want to know more, then ask a less vague question.
If the subject of brittle base class failure mitigation interests you, consider reading my lengthy series of articles on it.

what is the difference between the functions

The difference is that one is potentially an applicable candidate in either its expanded form or its normal form, whereas the other one has only one applicable candidate form.

A: For your first question, this is by design:

For example, the set of candidates for a method invocation does not include methods marked override (Section 7.3), and methods in a base class are not candidates if any method in a derived class is applicable (Section 7.5.5.1).

For your second question, a params modifier make that parameter act as a varargs parameter, meaning it can receive multiple parameters comma-separated, and the array is created implicitly by the compiler.

A: Not sure what's happening in your first question, but to answer your second, the params keyword allows the calling code to call the function with a variable number of parameters, not just an array.  So you can do:
obj.ToXml("foo", "bar", "baz");

A: I believe your first question is answered by the ambiguity around calling ToXML with no arguments.  With those 2 definitions, you could be calling either method (due to the params keyword, which also allows you to pass no parameters at all).
I think the reason the ToXml that is being invoked is the Child class's method, is, well, because it is the child class's method, and not one that is inherited by the parent class and then overridden.
Note:  if you had defined the ToXml which takes no arguments, it would be the preferred method to execute.


text:
Q: Display local images in UWP WebView control I need to write the code which will load some HTML (received from external source by other means) into WebView and display images referenced in this HTML. These images will be stored locally somewhere in Windows.Storage.ApplicationData.Current.LocalFolder.
Neither of suggestions at use local image to display in webview for windows phone 8.1 or Use local images in Webbrowser control work for me. If I load such HTML with web.NavigateToString(html):
A  B

I get just A B displayed. I tried slashes and backslashes, double and triple slashes after file:, ms-appx: and relative paths instead of file:, etc. The image never gets displayed. At the same time, if I save this in HTML file and open it outside of my app, it's displayed fine. I also successfully save and read these files (they are actually appeared in that folder because my app created them so unauthorized access is not an issue). package.manifest does include Private networks.
I'd better not use embedding with base64, custom uri resolver and other special techniques because I'm not the actual developer of the application. I make a library which gets HTML and saves images to local storage and now I need to demonstrate an easy to use method to visualize the stored content in WebView like I earlier did for normal .NET framework. I.e. I'm actually writing a sample for developers who are users of my library and these folks will then use my sample to deal with this HTML and images.
As the last resort, I can end up writing base64 or custom resolver for UWP version of my sample (while for other platforms like normal .NET framework the same procedure is much easier). But I want to at least be sure that the direct route of selecting proper URLs for images in the source HTML is not possible and I won't end up with situation where I wrote some quite complicated stuff and then someone experienced in UWP apps reveals that I over-engineered things. I.e. some expert opinion "no, it's not possible in UWP and you MUST use base64 embedding or custom URI resolving" will work for me too.

A: Although NavigateToString supports content with references to external files such as CSS, scripts, images, and fonts. But it only supports content in the app package using the ms-appx-web scheme, and web content using the http and https URI schemes. It can't work with assets located in the apps local folder. So using file:///, ms-appdata:/// or ms-appx:/// scheme won't work here.
To achieve what you want, you can use Base64 encoded images or custom URI resolver. Also I think you can store the html string to a file under the same subfolder that stores these image assets. In the html, you can use relative URI to reference these assets like what in my previous answer. And then use the Navigate method with a Uri that uses the ms-appdata scheme.  For example:
var html = "A  B";

var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("folder", CreationCollisionOption.OpenIfExists);
var file = await folder.CreateFileAsync("html.html", CreationCollisionOption.OpenIfExists);
await FileIO.WriteTextAsync(file, html);

webView.Navigate(new Uri("ms-appdata:///local/folder/html.html"));


text:
Q: How can you tell if a Visual Studio command was triggered by keyboard or menu? Is it possible to know if a Visual Studio command was triggered from the keyboard or a menu? I'd like to write a plugin that monitored VS commands and suggested keyboard shortcuts for any commands chosen from a menu.

A: It is not possible to determine from the Command itself, how it was triggered. Neither can you get this information from the CommandEvent. This is by design, because Commands can be bound to an arbitrary number of triggers of any kind (including explicit invocation in some code).
What you can do, however, is to register yourself as a listener on all CommandBarButton.OnClick and CommandBarComboBox.OnChange in the tree DTE.CommandBars.Controls. Whenever one of the above events occurs, capture the very next CommandEvent. This is the command immediately triggered by the respective CommandBarControl.
I guess this is sufficient for the scenario you describe. Note, however, that you cannot conclude from this that all other commands are triggered by some shortcut, since commands can be triggered implicitly (through other commands). You can approximate this by checking whether or not a key is pressed, when a command occurs, but this is a rather fragile approach... If someone knows a better approach here, adds are welcome!


text:
Q: PHP Mail form does not send I copied the message form and PHP mail from a website. But it doesn't seem to work. It does not send anything or make any reaction. I tried to find the error, but I am not familiar with PHP. I tried editing the $emailFrom =... to $_POST['email']; but that doesn't work either..
HTML:

                <form class="form" id="form1">

                        <input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Naam"/>

                        <input name="email" type="text" class="validate[required,custom[email]] feedback-input" placeholder="E-mail" />

                        <textarea name="text" class="validate[required,length[6,300]] feedback-input" placeholder="Bericht"></textarea>

                        <input type="submit" value="Verstuur" id="button-blue"/>

                </form>

PHP:
    <?php

include 'functions.php';

if (!empty($_POST)){

  $data['success'] = true;
  $_POST  = multiDimensionalArrayMap('cleanEvilTags', $_POST);
  $_POST  = multiDimensionalArrayMap('cleanData', $_POST);

  //your email adress
  $emailTo ="lisa-ederveen@hotmail.com"; //"yourmail@yoursite.com";

  //from email adress
  $emailFrom =$_POST['email']; //"contact@yoursite.com";

  //email subject
  $emailSubject = "Mail from Porta";

  $name = $_POST["name"];
  $email = $_POST["email"];
  $comment = $_POST["comment"];
  if($name == "")
   $data['success'] = false;

 if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))
   $data['success'] = false;

 if($comment == "")
   $data['success'] = false;

 if($data['success'] == true){

  $message = "NAME: $name

  EMAIL: $email

  COMMENT: $comment";

  $headers = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
  $headers .= "From: <$emailFrom>" . "\r\n";
  mail($emailTo, $emailSubject, $message, $headers);

  $data['success'] = true;
  echo json_encode($data);
}
}
?>

A: Your form was incomplete, it missed the method (POST) and action (your php filename)
Try this instead:

                <form action="sendEmail.php" method="POST" class="form" id="form1">

                        <input name="name" type="text" class="validate[required,custom[onlyLetter],length[0,100]] feedback-input" placeholder="Naam"/>

                        <input name="email" type="text" class="validate[required,custom[email]] feedback-input" placeholder="E-mail" />

                        <textarea name="comment" class="validate[required,length[6,300]] feedback-input" placeholder="Bericht"></textarea>

                        <input type="submit" value="Verstuur" id="button-blue"/>

                </form>

sendEmail.php
    <?php

//include 'functions.php';

if (!empty($_POST)){

  $data['success'] = true;
  //$_POST  = multiDimensionalArrayMap('cleanEvilTags', $_POST);
  //$_POST  = multiDimensionalArrayMap('cleanData', $_POST);

  //your email adress
  $emailTo ="lisa-ederveen@hotmail.com"; //"yourmail@yoursite.com";

  //from email adress
  $emailFrom =$_POST['email']; //"contact@yoursite.com";

  //email subject
  $emailSubject = "Mail from Porta";

  $name = $_POST["name"];
  $email = $_POST["email"];
  $comment = $_POST["comment"];
  if($name == "")
   $data['success'] = false;

 if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))
   $data['success'] = false;

 if($comment == "")
   $data['success'] = false;

 if($data['success'] == true){

  $message = "NAME: $name

  EMAIL: $email

  COMMENT: $comment";

  $headers = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html; charset=utf-8" . "\r\n";
  $headers .= "From: <$emailFrom>" . "\r\n";
  mail($emailTo, $emailSubject, $message, $headers);

  $data['success'] = true;
  echo json_encode($data);
}
}
?>

A: Firstly, your form: <form class="form" id="form1">
Forms default to GET if a method isn't specifically instructed.
Use POST like this if your HTML form and PHP are inside the same file:
<form class="form" id="form1" method="post">

since you are using POST arrays.
or
<form class="form" id="form1" method="post" action="your_handler.php">

if using a different file; I used your_handler.php as an example filename.
Also, <textarea name="text"...
that should be <textarea name="comment" as per your $_POST["comment"] array.

*

*Using error reporting would have trigged an Undefined index text... notice.

Add error reporting to the top of your file(s) which will help find errors.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// rest of your code

Sidenote: Error reporting should only be done in staging, and never production.

Footnotes:
I have no idea what multiDimensionalArrayMap('cleanEvilTags' does, so you'll have to check that.
If you're still not receiving mail, check your Spam.
Doing:
if(mail($emailTo, $emailSubject, $message, $headers)){
   echo "Mail sent.";
}

and if it echoes "Mail sent", then mail() would have done its job. Once it goes, it's out of your hands.
You could look into using PHPMailer or Swiftmailer which are better solutions, as is using SMTP mailing.
Now, if (!empty($_POST)){ that isn't a full solution. It is best using a conditional !empty() for all your inputs. Your submit counts as a POST array and should only be relied on using an additional isset() for it.

*

*If you're using this from your own computer, make sure that you've a Webserver installed. We don't know how your script is being used.

If you are using it from your own machine, make sure that PHP is indeed running, properly installed and configured, including any mail-related settings.

Additional notes:
You should also use full and proper bracing for all your conditional statements.
This has none:
if($comment == "")
   $data['success'] = false;

which should read as
if($comment == ""){
   $data['success'] = false;
  }

Same thing for:
if($name == "")
   $data['success'] = false;

*

*Not doing so, could have adverse effects.

"I copied the message form and PHP mail from a website."

Again, about multiDimensionalArrayMap('cleanEvilTags'; if you don't have that function, then you will need to get rid of it and use another filter method for your inputs.
Consult the following on PHP.net for various filter options:

*

*http://php.net/manual/en/filter.filters.php

*http://php.net/manual/en/function.filter-input.php

*http://php.net/manual/en/function.filter-var.php


text:
Q: Django unicode with recursive ForeignKey So i have a class - Deparmtent.
each Department (except for the biggest) has a bigger Department which it belongs to.
my class looks like this :
class Department(models.Model):
    name = models.CharField(max_length=100)
    overDep = models.ForeignKey('self', blank=True, null=True)

I want to make def __unicode__ which will return the department name than '-' and than the biger Department name so in result it could look like : 'BUSS-AEPR-ERPG' as ERPG is the biggest Department which includes AEPR which includes BUSS.
I have no idea how to do it, I tried to return : 'self.name+"-"+self.overDep.name' but it gives an AttributeError - 'NoneType' object has no attribute 'name'
So please show me how to do it right, Thanks.

A: Try this:
def __unicode__(self):
    if self.overDep:
        return u'%s - %s' % (str(self.overDep), self.name)
    else:
        return self.name


text:
Q: Removing all the images in a control group I don't get the option .Image when I apply this code:
foreach(Control b in _SelectionPanel.Controls)
{
    if (b is Button)
    {
       b.Image = null;
    }
}

However, I can get the option 'Visible':
foreach(Control b in _SelectionPanel.Controls)
{
    if (b is Button)
    {
       b.Visible = false;
    }
}

I'm trying to remove all the images from the buttons in a control group. Any ideas?

A: is only checks if the type is Button.
You want to use as to perform the actual cast, hence allowing you to access Button's properties. If the cast is invalid, you will simply get a null reference, so simply perform the as cast, then check if your variable is null before using it.
foreach(Control b in _SelectionPanel.Controls)
{
    Button castB = b as Button;
    if (castB != null)
    {
        castB.Image = null;
    }
}

A: In the context of your loop, b is a control. Even after checking. To get the Image property, you need to cast it to the Button type:
foreach(Control b in _SelectionPanel.Controls)
{
    if (b is Button)
    {
        ((Button)b).Image = null;
        //Alternatively
        (b as Button).Image = null;
    }
}

A: foreach(var b in _SelectionPanel.Controls.OfType<Button>())
{
    ((Button)b).Image = null;
}

You can iterate over controls of type button only and then explicitly cast var to Button.


text:
Q: How to make key-value pair from database I have a table in MySQL database with columns id and name. My question is: how to make key-value pair for possible values in select field on form (this is for practice PHP in NetBeans). When I fetch all from the table, this is print_r (for one):
 [0] => Array
        (
            [id] => 5
            [0] => 5
            [name] => Newest
            [1] => Newest
        )

How to make key-value pair id => name;

A: This might help...
<?php
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "dbName";

    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $conn->prepare('SELECT * FROM tableName');
    $stmt->execute();

    // set the resulting array to associative
    $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);

    print_r($stmt->fetchAll());


text:
Q: Gorm retrive different UUID value from that in the database - MSSQL Model
type Invoice struct {
    ID                uint           `gorm:"primarykey" json:"-"`
    UID               uuid.UUID      `gorm:"type:UNIQUEIDENTIFIER;uniqueIndex:idx_UniqueID" json:"id"`
}

On database value dispalayed as flowws

But When I retriving data from database I get different values from those in db

Is there something wrong on model creation?
handler
func GetInvoices(c *fiber.Ctx) error {
    invoices := []responses.Invoice{}
    var invoicesCount int64

    page, pageSize, searchString, orderBy := handles.Pages(c)
    switch orderBy {
    case "customer_name":
        orderBy = "CustomerName"
    case "currency_id":
        orderBy = "ForeignCurrenycID"
    default:
        orderBy = "ID"
    }

    if err := database.DB.Model(&models.Invoice{}).Select("ID").Where("InvNumber like ? or CustomerName like ? or Tax_Number like ? or Registration like ? or Description like ?", searchString, searchString, searchString, searchString, searchString).Count(&invoicesCount).Error; err != nil {
        logs.ErrorLogger.Println(err.Error())
        return c.Status(400).JSON(fiber.Map{"msg": err.Error()})
    }

    if err := database.DB.Scopes(handles.Paginate(c)).Order(orderBy).Find(&invoices).Where("InvNumber like ? or CustomerName like ? or Tax_Number like ? or Registration like ? or Description like ?", searchString, searchString, searchString, searchString, searchString).Error; err != nil {
        logs.ErrorLogger.Println(err.Error())
        return c.Status(400).JSON(fiber.Map{"msg": err.Error()})
    }
    for _, inv := range invoices{
        fmt.Println(inv.UID)
    }
    totalPages := math.Ceil(float64(invoicesCount) / float64(pageSize))

    return c.Status(200).JSON(fiber.Map{"page": page, "pageSize": pageSize, "totalPages": totalPages, "totalItems": invoicesCount, "data": &invoices})
}

A: I have same issue, my DBA found a quick-fix converting to NVARCHAR the ID in the GORM Select method, you could use:
// ...
    if err := database.DB.Model(&models.Invoice{}).Select("CONVERT(NVARCHAR(36), ID) as ID").Where("InvNumber like ? or CustomerName like ? or Tax_Number like ? or Registration like ? or Description like ?", searchString, searchString, searchString, searchString, searchString).Count(&invoicesCount).Error; err != nil {
        logs.ErrorLogger.Println(err.Error())
        return c.Status(400).JSON(fiber.Map{"msg": err.Error()})
    }
// ...

I know this is not the best way, but it works  ¯\(ツ)/¯


text:
Q: Want to know when UIPickerViewDataSource finished I save the last user selection in the picker view. But when the view is opened again I do not where to use
[pickerView selectRow:lastSelectedRow inComponent:lastSelectedComponent animated:YES];

If I use it in viewDidLoad the problem is UIPickerViewDataSource has not finished yet, so the scrolling is not correct.
I can not find delegate function after UIPickerViewDataSource is finished.
Where can I use the above line of code?

A: You're passing YES in animated argument, thus I assume you want to see it animated -> you should call this method in viewDidAppear, not in viewDidLoad.


text:
Q: Make a css file with php I have an css compiler written in PHP. This compiler ensures that all the css files will be minified.
Eventually it echo all the css code. But I don't want to echo the code but that he makes or update a existing css file with the css code that he compiled.
But how is this possible with PHP?
Here is the compiler that I use.
$cssFiles = array(
   '',
);

$buffer = "";
foreach ($cssFiles as $cssFile) {
    $buffer .= file_get_contents($cssFile);
}

// Remove comments
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
// Remove space after colons
$buffer = str_replace(': ', ':', $buffer);
// Remove whitespace
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
// Enable GZip encoding.
ob_start("ob_gzhandler");
// Enable caching
header('Cache-Control: public');
// Expire in one day
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
// Set the correct MIME type, because Apache won't set it for us
header("Content-type: text/css");
// Write everything out
echo($buffer);

A: you can write the $buffer var in existing css file
$a = fopen("my_css_file_written_with_php.css", 'w');
fwrite($a, $p);
fclose($a);
chmod("my_css_file_written_with_php.css", 0644);


text:
Q: Trying to build shopizer in eclipse using maven When i am trying to build shopizer I m getting this error(Shown in image).
It say that the 2.0.1-snapshot.jar is missing in the maven repositories.But I have the jar at the given location of the project but it has .lastupdated extension (2.0.1-snapshot.jar.lastupdated) and I am getting this error every time.Please help me with that.


text:
Q: Most efficient way of creating a tuple from list of tuples I am currently using a for loop with enumerate to extract from a list of tuples below:
[(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]
What i want is to end up with the following tuple ('handle', 'Firstname', 'Surname', 'Callname', 'Gender')
What would be the most efficient way of accomplishing this without enumerating through them and creating a new tuple or is this the only way?

A: Create a new tuple by enumerating through them:
tuple(t[1] for t in inputlist)

This uses a generator expression to pass each second element from the tuples in inputlist to the tuple() constructor.
If you just need a sequence and a list would do, then use a list comprehension:
[t[1] for t in inputlist]

Lists fit arbitrary-length, ordered, homogenous data sets (such as you have here) better than do tuples, see What's the difference between lists and tuples?
If raw speed is required and readability can be de-emphasised, use map() and operator.itemgetter() to move iteration and extraction to optimised C code:
from operator import itemgetter

labels_tup = tuple(map(itemgetter(1), inputlist))
labels_list = list(map(itemgetter(1), inputlist))

However, I'd avoid doing this unless extracting a bunch of strings out of a list of tuples is on a critical path and / or repeated a lot. Readability counts!

without enumerating through them and creating a new tuple

You can't avoid this. You a) want one element from each tuple in a sequence, and b) need a tuple object as output, an immutable type. While you could write 5 separate statements indexing into inputlist to access each value, doing so would not be efficient, creates needlessly repeated code, and would break the moment your input doesn't have exactly 5 elements.
Demo:
>>> inputlist = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]
>>> tuple(t[1] for t in inputlist)
('handle', 'Firstname', 'Surname', 'Callname', 'Gender')
>>> [t[1] for t in inputlist]
['handle', 'Firstname', 'Surname', 'Callname', 'Gender']

A: You are looking for generator expression.
print(tuple(i[1] for i in inputlist))

Or
t = tuple(i[1] for i in inputlist)
print(t)

Outputs:
('handle', 'Firstname', 'Surname', 'Callname', 'Gender')

A possible solution with for loop (Not recommended):
li = []
for i in inputlist:
    li.append(i[1])
print(tuple(li))

What would be the most efficient way of accomplishing this without enumerating through them and creating a new tuple or is this the only way?

I am not sure why you want to avoid creating tuple but you don't need enumerate. May be the example given below can help:
def getElement(ndx):
    return inputlist[ndx][1]

# Get Second Element
print(getElement(2))

A: >>> from operator import itemgetter
>>> data = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]
>>> tuple(map(itemgetter(1), data))
('handle', 'Firstname', 'Surname', 'Callname', 'Gender')

This seems to be the fastest in raw speed (only slightly however - since it keeps everything in C as much as possible), and I also do like the look of this as well. Of course you are still looping through the elements however.
Timings:
$ python3 -m timeit -s "data = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]; from operator import itemgetter;" "tuple(map(itemgetter(1), data))"
500000 loops, best of 5: 477 nsec per loop
$ python3 -m timeit -s "data = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]; from operator import itemgetter;" "tuple(t[1] for t in data)"
500000 loops, best of 5: 566 nsec per loop
$ python3 -m timeit -s "data = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]*1000; from operator import itemgetter;" "tuple(map(itemgetter(1), data))"
2000 loops, best of 5: 146 usec per loop
$ python3 -m timeit -s "data = [(0, 'handle', 'VARCHAR(50)', 1, None, 1), (1, 'Firstname', 'TEXT', 1, None, 0), (2, 'Surname', 'TEXT', 1, None, 0), (3, 'Callname', 'TEXT', 1, None, 0), (4, 'Gender', 'INTEGER', 1, None, 0)]*1000; from operator import itemgetter;" "tuple(t[1] for t in data)"
1000 loops, best of 5: 212 usec per loop


text:
Q: Exponential generating function question help I have the following formula I am looking to find an explicit formula for the coefficient $ a_n $: here $ a_0 = 1; a_1 = 2 $ for $n\geq2$
$$ a_n = n(a_{n-1} + a_{n-2}) $$
define the exponential generating function:
$$f(x) = \sum_{n\geq0}a_n\frac{x^n}{n!} $$
multiplying by $ \frac{x^n}{n!}$ and summing over the value for n we get:
$$ \sum_{n\geq2}a_n\frac{x^n}{n!} = \sum_{n\geq2}na_{n-1}\frac{x^n}{n!} + \sum_{n\geq2}na_{n-2}\frac{x^n}{n!} $$
this gives:
$$f(x) - 2x - 1 = xf(x) + x^2 \sum_{n\geq2}a_{n-2}\frac{x^{n-2}}{(n-1)!} $$
I have kind of hit a dead end here, how do I make the last term on the RHS to make sense? Any help would be appreciated.

A: If you don't see anything better, it doesn't hurt to gather some data by computing the first few terms $a_n$:
$$\begin{array}{c|cc}
n&0&1&2&3&4&5\\\hline
a_n&1&2&6&24&120&720
\end{array}$$
This strongly suggests the conjecture that $a_n=(n+1)!$. Try it: for $n\ge 0$ let $b_n=(n+1)!$. Then $b_0=1=a_0$, $b_1=2=a_1$, and
$$n(b_{n-1}+b_{n-2})=n\big(n!+(n-1)!\big)=n(n+1)(n-1)!=(n+1)!=b_n\;,$$
so by induction $a_n=b_n=(n+1)!$ for all $n\ge 0$.


text:
Q: D'alembert's approach for boundary value problems I have the following problem
$\left\{\begin{array}{l}
u_{t t}=u_{x x}+2 u, \quad t>0, \quad 0<x<\pi \\
\left.u\right|_{t=0}=0,\left.\quad u_{t}\right|_{t=0}=0 \\
\left.u_{x}\right|_{x=0}=1,\left.u_{x}\right|_{x=\pi}=1
\end{array}\right.$
It is clear that it needs to use D'Alembert's approach:
$u(x, t)=\frac{\varphi(x+a t)+\varphi(x-a t)}{2}+\frac{1}{2 a} \int_{x-a t}^{x+a t} \psi(\alpha) d \alpha$
where
$u(x, 0)=\varphi(x), \quad u_{t}(x, 0)=\psi(x)$
In my case I have $\varphi(x) = \psi(x) = 0$. What id does mean and how to solve the problem in this case? And also, how to treat this term $2u$ in the equation?

A: D'Alembert's solution is hardly adapted to solve the wave equation with an additional term $2u$. Instead, let us use separation of variables. To do so, we need to substract the stationary solution
$$
u^*(x) = \frac{\sin(x\sqrt{2}) - \tan\left(\frac{\pi}{\sqrt{2}}\right) \cos(x\sqrt{2})}{\sqrt{2}}
$$
by introducing $v = u^* + u$. Thus, $v$ satisfies the PDE problem $v_{tt} = v_{xx} + 2 v$ with homogeneous Neumann boundary conditions, and with the initial conditions $v = u^*$ and $v_t = 0$ at $t=0$.
Separation of variables $v(x,t) = X(x)T(t)$ gives
$$
T'' + \lambda T = 0, \qquad  X'' + (\lambda+2)X = 0
$$
where $\lambda$ is the separation constant. For $\lambda >0$, solutions are of the form
\begin{aligned}
T(t) &= A \cos(t\sqrt{\lambda}) + B \sin(t\sqrt{\lambda})\\
X(x) &= C \cos(x\sqrt{\lambda+2}) + D \sin(x\sqrt{\lambda+2})
\end{aligned}
Hope you can take it from here.


text:
Q: Getting error "cannot resolve findViewById(int)' I have a main activity and when I press a button, i am navigated to a swipe Tab view. Now I want to have a Clickable Button in these tabs and present a toast when the button is pressed. Here is the code I use:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class laundry extends Fragment {
Button btn_service;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    return inflater.inflate(R.layout.activity_laundry, container,false);
    btn_service = (Button) findViewById(R.id.btn_service);
    btn_service.setOnClickListener(this);
}

But the findViewById is not a know symbol to this activity. Is there an alternative way to incorporate clickable buttons in fragment activity like above?
Ran the project and I get this error. ( I cant know if the suggested changes worked, my app crashed with the following error) This is a fragment activity and I am trying to generate a toast when a button is clicked.
public class in_room_dining extends Fragment
{
Button btn_order;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState)
{
    // TODO Auto-generated method stub

    btn_order.setOnClickListener(new OnClickListener()
{
 public void onClick(View v)
{
Toast.makeText(getActivity(), "text", Toast.LENGTH_SHORT).show();
}
});
 return inflater.inflate(R.layout.activity_in_room_dining, container, false);
}
}

The error I got is :
11-29 10:57:42.820      938-938/com.appt.shreyabisht.staymax E/AndroidRuntime﹕ FATAL EXCEPTION:     main
Process: com.appt.shreyabisht.staymax, PID: 938
java.lang.NullPointerException
        at com.appt.shreyabisht.staymax.in_room_dining.onCreateView(in_room_dining.java:23)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1504)

(in_room_dining.java:23) is btn_order.setOnClickListener(new OnClickListener()

A: import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class laundry extends Fragment {
Button btn_service;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // TODO Auto-generated method stub
final View rootView = inflater.inflate(R.layout.activity_laundry, container,
                false);

    btn_service = (Button) rootView.findViewById(R.id.btn_service);
    btn_service.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

         //your Code Goes Here
        }
    });
    return rootView;
}

A: In your question you are not defining return statement, before use findViewbyId just use parameter of return statement.
 View abc = inflater.inflate(R.layout.activitys, container,false);
 btn1 = (Button) abc.findViewById(R.id.btns);
 return abc;

A:  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

View V = inflater.inflate(R.layout.activity_laundry, container, false);

btn_service = (Button) v.findViewById(R.id.btn_service);

return V;

}

A: When you use Fragment you have initialize Fragment xml using LayoutInflater in onCreateView :
View view = inflater.inflate(R.layout.activity_laundry, container,false);

After get xml reference using LayoutInflater try initialize Fragment xml all child views :
btn_service = (Button) view.findViewById(R.id.btn_service);
btn_service.setOnClickListener(this);

return Fragment xml reference to onCreateView at last statement :
return view;

Note : In your code you directly return Fragment xml before initialize Button so alwasys try to return Fragment xml reference at last statement of onCreateView().

A: make the following changes...
View myView = inflater.inflate(R.layout.activity_laundry, container,false);
now previx findViewById by myView.findViewById.
This should do the trick.


text:
Q: Proving the Convolution of PDFs gives a PDF I am struggling with a question about the convolution of PDFs, in particular, proving that given two PDFs $f$ and $g$, then their convolution $f*g$, will also be a PDF. Proving non negativity is easy but I am struggling to show that the integrals has value $1$. Here is my proof so far:
Note that all these integrals are evaluated over the reals.
$$\int (f*g)(x)\text{d}x = \iint f(y)g(x-y) \text{d}y  \text{d}x$$
Let $ z = x-y $
\begin{align*}
\iint f(y)g(z)\text{d}y\text{d}z&= \int f(y) \text{d}y \int g(z) \text{d}z\\
&= 1
\end{align*}
I have the answer but I believe I have made an error with the changing of the limits of substitution when I introduce the new variable $z$. Any advice would be much appreciated.

A: You are looking at a final result rather than where the convolution came from. Starting from an earlier point makes the proof easier.
If $X$ and $Y$ are independent random variables with densities
$f$ and $g$ respectively, then
\begin{align}
P\{X+Y \leq z\} &= \int_{-\infty}^\infty P\{X+Y \leq z \mid Y = y\}g(y)\,\mathrm dy & \scriptstyle{\text{law of total probability}}\\
&= \int_{-\infty}^\infty P\{X \leq z-y \mid Y = y\}g(y)\,\mathrm dy\\
&=\int_{-\infty}^\infty P\{X \leq z-y\}g(y)\,\mathrm dy&
\scriptstyle{\text{independence of}~X~\text{and}~Y}\\
P\{X+Y \leq z\} &=\int_{-\infty}^\infty
\left[ \int_{-\infty}^{z-y} f(x)\,\mathrm dx\right]g(y)\,\mathrm dy
\tag{1}
\end{align}
Note that the left side of $(1)$ has limiting value $1$ as
$z \to \infty$; in fact, the value of that double integral
on the right is the CDF of the random variable $Z = X+Y$.
The Fundamental Theorem of Calculus applied to $(1)$
gives us
$$f_{X+Y}(z) = \frac{\mathrm d}{\mathrm dz}P\{X+Y \leq z\}
= \int_{-\infty}^\infty f(z-y)g(y)\,\mathrm dy
= f\star g$$
and so
$\displaystyle \int_{\mathbb R} f\star g = 1$ as you wish to prove.


text:
Q: Springboot application.properties upload file Exception I wrote some code in Springboot application.properties:
spring.http.multipart.max-file-size=1024KB
spring.http.multipart.max-request-size=1024KB

An exception occurs when the uploaded file is larger than the set value:

org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException:the
  request was rejected because.......

I want to capture this exception and display the custom format, what should I do?

A: To catch MultipartException related exceptions and such others, the better approach would be to create a global Exception Controller. This controller will be able to catch given exception and return a human friendly error message to client.
@ControllerAdvice
public class ExceptionController {

    NumberFormat numberFormatter = new DecimalFormat("#0.00");

    @ExceptionHandler(value = Exception.class)
    public ResponseEntity<?> handleException(Exception e) {
        if(e instanceof MultipartException){
            String message = "Invalid form data";
            if(e.getCause() instanceof IllegalStateException){
                if(((MultipartException) e).getRootCause() instanceof SizeException){
                    SizeException sizeException = (SizeException) ((MultipartException) e).getRootCause();
                    if(sizeException instanceof FileSizeLimitExceededException){
                        FileSizeLimitExceededException cause = (FileSizeLimitExceededException) sizeException;
                        message  = "File Size should be less than: " + numberFormatter.format(cause.getPermittedSize()/Math.pow(2F, 20)) + "MB";
                    }
                    else if(sizeException instanceof SizeLimitExceededException){
                        SizeLimitExceededException cause = (SizeLimitExceededException) sizeException;
                        message  = "Request Size should be less than: " + numberFormatter.format(cause.getPermittedSize()/Math.pow(2F, 20)) + "MB";
                    }
                }
            }
            return new ResponseEntity<YourCustomResponseObject>(new
            YourCustomResponseObject(message),
            HttpStatus.ANY_ERROR_CODE_YOU_WANT);
             }
        }
}

Above example will help you to catch exceptions related to both Maximum file size and Maximum Request size exceptions with custom messages.
Updated
In case if you're using a file with very large size, then your browser can become un-responsive. In that case, if you are using embedded-tomcat, add below lines in your configuration file
@Bean
    public TomcatEmbeddedServletContainerFactory tomcatEmbedded() {
        TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
        tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
            if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<?>)) {
                //-1 means unlimited
                ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
            }
        });
        return tomcat;
    }

But if you are using stand-alone tomcat, then change maxSwallowSize property in your server.xml file like
<Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443"
    maxSwallowSize="-1"/>

-1 mean maximum size of a request

A: You can use
@ExceptionHandler(FileUploadBase.SizeLimitExceededException.class)

to catch this exception and do whatever you want. There are two most common ways to use this annotation:

*

*using @ControllerAdvice annotated class

*adding a public method to your class annotated with @ExceptionHandler
Please read carefully attached reference, it describes it quite clearly. I hope it helps.

Reference: http://docs.spring.io/spring-boot/docs/1.5.5.RELEASE/reference/htmlsingle/#boot-features-error-handling


text:
Q: Special considerations for using Python in init.d script? Are there any special considerations for using Python in an 'init.d' script being run through init? (i.e. booting Ubuntu)
From what I understand through googling/testing on Ubuntu, the environment variables provided to an 'init.d' script are scarce and so using "#!/usr/bin/env python" might not work.
Anything else?

A: That just highlights the biggest problem with python in an init.d script -- added complexity.
Python has no specification, and the env doesn't even have to point to cpython. If you upgrade and python breaks, you'll have to bite your tongue. And there is a much greater chance that python will break than sh (the safe bet for init.d scripts). Reason being, simple utility:

ecarroll@x60s:/etc/init.d$ ldd /usr/bin/python
    linux-gate.so.1 =>  (0xb7ff7000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7fc9000)
    libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7fc5000)
    libutil.so.1 => /lib/tls/i686/cmov/libutil.so.1 (0xb7fc0000)
    libz.so.1 => /lib/libz.so.1 (0xb7faa000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f84000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e21000)
    /lib/ld-linux.so.2 (0xb7ff8000)
ecarroll@x60s:/etc/init.d$ ldd /bin/sh
    linux-gate.so.1 =>  (0xb803f000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ec7000)
    /lib/ld-linux.so.2 (0xb8040000)

Python is linking into libpthread, libdl, libutil, libz, libm amongst other things that can possibly break. Python is simply doing more.

-rwxr-xr-x 1 root root  86K 2008-11-05 01:51 /bin/dash
-rwxr-xr-x 1 root root 2.2M 2009-04-18 21:53 /usr/bin/python2.6

You can read up more about what you're specifically talking about with env variables here:
http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.9
The main problem is that the defaults for env can be set in /etc/profile which would only run if the script is being run under a shell that supports reading it.

A: I am assuming this is running some kind of daemon written in python, if not then this may not apply.
You will (probably) want to do the standard unix double fork and redirect file descriptors thing.  This is the one I use (Adapted from an ActiveState code recepie whose url eludes me at the moment).
def daemonize(stdin, stdout, stderr, pidfile):
    if os.path.isfile(pidfile):
        p = open(pidfile, "r")
        oldpid = p.read().strip()
        p.close()
        if os.path.isdir("/proc/%s"%oldpid):
            log.err("Server already running with pid %s"%oldpid)
            sys.exit(1)
    try:
        pid = os.fork()
        if pid > 0:
            sys.exit(0)
    except OSError, e:
        log.err("Fork #1 failed: (%d) %s"%(e.errno, e.strerror))
        sys.exit(1)
    os.chdir("/")
    os.umask(0)
    os.setsid()
    try:
        pid = os.fork()
        if pid > 0:
            if os.getuid() == 0:
                pidfile = open(pidfile, "w+")
                pidfile.write(str(pid))
                pidfile.close()
            sys.exit(0)
    except OSError, e:
        log.err("Fork #2 failed: (%d) %s"%(e.errno, e.strerror))
        sys.exit(1)
    try:
        os.setgid(grp.getgrnam("nogroup").gr_gid)
    except KeyError, e:
        log.err("Failed to get GID: %s"%e)
        sys.exit(1)
    except OSError, e:
        log.err("Failed to set GID: (%s) %s"%(e.errno, e.strerror))
        sys.exit(1)
    try:
        os.setuid(pwd.getpwnam("oracle").pw_uid)
    except KeyError, e:
        log.err("Failed to get UID: %s"%e)
        sys.exit(1)
    except OSError, e:
        log.err("Failed to set UID: (%s) %s"%(e.errno, e.strerror))
        sys.exit(1)
    for f in sys.stdout, sys.stderr:
        f.flush()
    si = open(stdin, "r")
    so = open(stdout, "a+")
    se = open(stderr, "a+", 0)
    os.dup2(si.fileno(), sys.stdin.fileno())
    os.dup2(so.fileno(), sys.stdout.fileno())
    os.dup2(se.fileno(), sys.stderr.fileno())

Just run this before starting up your daemon loop and it will probably do the right thing.
As a side note, I am using #!/usr/bin/env python as the shebang line in a script on ubuntu and it is working fine for me.
You will probably still want to redirect stdout/stderr to a file even if you are not running a daemon to provide debug info.


text:
Q: Drupal - Set 'user/%/edit/uprofile' to default tab on 'user/%/edit' I'm using the content profile module. When a user is on their view profile page and press edit, they expect the profile edit page to show, not account settings as it is now. The path to content profile edit page is 'user/%/edit/uprofile'. Does anyone know how to set the 'user/%/edit/uprofile' to default tab for 'user/%/edit'?

A: Edit 2 (for Content Profile)
This example is for a Content Profile tab. Just change $type to the short name of the content type for the profile. This also shows how to clean up the code for real-world use (my previous examples were really, really verbose):
function mymodule_menu_alter(&$items) {
  // Specify the content profile type you'd like to work with
  $type = 'profile';

  // Make sure the user has a Content Profile to edit
  if (!empty($items['user/%user_category/edit/' . $type])) {
    // Pull out the menu items we want to modify.
    $account  = &$items['user/%user_category/edit/account'];
    $edit     = &$items['user/%user_category/edit'];
    $profile  = &$items['user/%user_category/edit/' . $type];

    // Specify the Edit Account page as just a regular tab.
    // You do not need to change this block: this will always be the same as long
    // as you don't want Edit account to be the default tab.
    $account = array(
      'type' => MENU_LOCAL_TASK,
      'page callback' => $edit['page callback'],
      'page arguments' => $edit['page arguments'],
      'access callback' => $edit['access callback'],
      'access arguments' => $edit['access arguments'],
      'module' => $edit['module'],
      'file' => $edit['file'],
    ) + $account;

    // Change the default action to take when hitting user/<UID>/edit to
    // the content profile
    $edit = array(
      'page callback' => $profile['page callback'],
      'page arguments' => $profile['page arguments'],
      'access callback' => $profile['access callback'],
      'access arguments' => $profile['access arguments'],
      'file' => $profile['file'],
      'file path' => $profile['file path'],
    ) + $edit;

    // Specify the profile page as the default tab and remove settings
    // already set above
    $profile['type'] = MENU_DEFAULT_LOCAL_TASK;
    unset($profile['page callback'],
      $profile['page arguments'],
      $profile['access callback'],
      $profile['access arguments'],
      $profile['file'],
      $profile['file path']);
  }
}

Edit 1 (for Core's Profile module)
I didn't realize you wanted to change the default tabs under Edit. It's the same general principle as I described below, but with some minor modifications. This example will make the Personal tab (at user/<UID>/edit/Personal) default instead of the account tab:
function mymodule_menu_alter(&$items) {
  // Specify the Edit Account page as just a regular tab.
  // You do not need to change this block: this will always be the same as long
  // as you don't want Edit account to be the default tab.
  $items['user/%user_category/edit/account']['type'] = MENU_LOCAL_TASK;
  $items['user/%user_category/edit/account']['page callback'] = $items['user/%user_category/edit']['page callback'];
  $items['user/%user_category/edit/account']['page arguments'] = $items['user/%user_category/edit']['page arguments'];
  $items['user/%user_category/edit/account']['access callback'] = $items['user/%user_category/edit']['access callback'];
  $items['user/%user_category/edit/account']['access arguments'] = $items['user/%user_category/edit']['access arguments'];
  $items['user/%user_category/edit/account']['module'] = $items['user/%user_category/edit']['module'];
  $items['user/%user_category/edit/account']['file'] = $items['user/%user_category/edit']['file'];

  // Change default action to take when hitting user/<UID>/edit to
  // the settings of the page you want to use.
  // -- Custom settings start here --
  $items['user/%user_category/edit']['page callback'] = $items['user/%user_category/edit/Personal']['page callback'];
  $items['user/%user_category/edit']['page arguments'] = $items['user/%user_category/edit/Personal']['page arguments'];
  $items['user/%user_category/edit']['access callback'] = $items['user/%user_category/edit/Personal']['access callback'];
  $items['user/%user_category/edit']['access arguments'] = $items['user/%user_category/edit/Personal']['access arguments'];
  $items['user/%user_category/edit']['module'] = $items['user/%user_category/edit/Personal']['module'];
  $items['user/%user_category/edit']['file'] = $items['user/%user_category/edit/Personal']['file'];

  // When loading a profile tab, user_edit needs two parameters. The second parameter is the name of the profile
  // (i.e. Personal from user/<UID>/edit/Personal).
  $items['user/%user_category/edit']['page arguments'] = array(1, 'Personal');

  // Specify the Personal page as the default tab and remove settings
  // already set above */
  $items['user/%user_category/edit/Personal']['type'] = MENU_DEFAULT_LOCAL_TASK;
  unset($items['user/%user_category/edit/Personal']['page callback']);
  unset($items['user/%user_category/edit/Personal']['page arguments']);
  unset($items['user/%user_category/edit/Personal']['access callback']);
  unset($items['user/%user_category/edit/Personal']['access arguments']);
  unset($items['user/%user_category/edit/Personal']['module']);
  unset($items['user/%user_category/edit/Personal']['file']);
}

Overview and Concept
You can do this with hook_menu_alter and changing the types for specific tabs.
Changing the default tab is a little bit of a harrowing process. Basically, the default tab inherits all the properties of the page without any tabs selected. This allows a user to go to user/UID and get the view page without having to go directly to user/UID/view.
To get a clearer understanding of this, check out the user_menu() hook implementation. Note how $items['user/%user/view'] is pretty empty, and $items['user/%user_uid_optional'] contains all the settings you would've expected to see under $items['user/%user/view'].
So, you're going to first set up the view tab to act as a regular tab: to do this, you're going to have to copy all the settings that are attached to the user/UID menu item and put them into the user/UID/view menu item.
Once you do that, you're going to replace the settings for user/UID with the settings for the tab you want to become the default tab.
Finally, you're going to unset all the menu items for the default tab since it will inherit the settings for user/UID.
Check out this code which makes the Edit tab default:
function mymodule_menu_alter(&$items) {
  // Specify the View page as just a regular tab.
  // You do not need to change this block: this will always be the same as long
  // as you don't want View to be the default tab.
  $items['user/%user/view']['type'] = MENU_LOCAL_TASK;
  $items['user/%user/view']['page callback'] = $items['user/%user_uid_optional']['page callback'];
  $items['user/%user/view']['page arguments'] = $items['user/%user_uid_optional']['page arguments'];
  $items['user/%user/view']['access callback'] = $items['user/%user_uid_optional']['access callback'];
  $items['user/%user/view']['access arguments'] = $items['user/%user_uid_optional']['access arguments'];
  $items['user/%user/view']['file'] = $items['user/%user_uid_optional']['file'];

  // Normal tabs don't have a weight
  unset($items['user/%user/view']['weight']);

  // Change default action to take when hitting user/<UID> to
  // the settings of the page you want to use.
  // -- Custom settings start here --
  $items['user/%user_uid_optional']['page callback'] = $items['user/%user_category/edit']['page callback'];
  $items['user/%user_uid_optional']['page arguments'] = $items['user/%user_category/edit']['page arguments'];
  $items['user/%user_uid_optional']['access callback'] = $items['user/%user_category/edit']['access callback'];
  $items['user/%user_uid_optional']['access arguments'] = $items['user/%user_category/edit']['access arguments'];
  $items['user/%user_uid_optional']['file'] = $items['user/%user_category/edit']['file'];

  // Specify the Edit page as the default tab and remove settings
  // already set above
  $items['user/%user_category/edit']['type'] = MENU_DEFAULT_LOCAL_TASK;
  $items['user/%user_category/edit']['weight'] = -10;
  unset($items['user/%user_category/edit']['page callback']);
  unset($items['user/%user_category/edit']['page arguments']);
  unset($items['user/%user_category/edit']['access callback']);
  unset($items['user/%user_category/edit']['access arguments']);
  unset($items['user/%user_category/edit']['file']);
}

Replace the second part of the function with the settings for your menu item and you should be in good shape. Of course, remember to clear the cache after making any menu changes for them to take effect.

A: There is a module on drupal.org.
Works with profile fields.
See Profile Tools.

A: Here's the code that worked for me with content profile installed and the default content type ('profile'):
function mymodule_menu_alter(&$items) {
  // Save the data from user/%/edit into user/%/edit/account.
  $items['user/%user_category/edit/account'] = $items['user/%user_category/edit'];
  $items['user/%user_category/edit/account']['tab_parent'] = 'user/%/edit';
  $items['user/%user_category/edit/account']['title'] = 'Account';

  // Change the default user/%/edit to user/%/edit/profile.
  $useredit = &$items['user/%user_category/edit'];
  $userprofile = &$items['user/%user_category/edit/profile'];
  $useredit['page callback'] = $userprofile['page callback'];
  $useredit['page arguments'] = $userprofile['page arguments'];
  $useredit['access callback'] = $userprofile['access callback'];
  $useredit['access arguments'] = $userprofile['access arguments'];
  $useredit['file'] = $userprofile['file'];
  $useredit['file path'] = $userprofile['file path'];

  // Make the user/%/edit/profile sub-tab the default and left-most sub-tab.
  $userprofile['type'] = MENU_DEFAULT_LOCAL_TASK;
  $userprofile['weight'] = -10;
}

Change $userprofile = $items['user/%user_category/edit/profile'] to match the content profile path you need (in your case this would be $userprofile = $items['user/%user_category/edit/uprofile']
Also make sure your module runs after the content_profile module (your module must have a 'higher' weight than -1, which is content_profile.module's weight). Modules have a default weight of 0 so you should be fine there.

A: I was searching for a solution but wasn't satisfied with such complexity. I did it like this.
function MYTHEME_menu_link(array $variables) {
    global $user;

    if($variables["element"]["#theme"] == "menu_link__user_menu" && $variables["element"]["#original_link"]["router_path"] == "user") {
        $variables["element"]["#href"] = "user/".$user->uid."/edit";
    }

    return theme_menu_link($variables);
}


text:
Q: unable to map subdomain in local host webserver I am developing a web application using Asp.net mvc framework with concept of  sub domain for community.
I have implement concept of wild card mapping of domain like *.example.com.  To test concept in vs 2008 i edited hosts file and add some sub domain like
127.0.0.1  a.localhost
127.0.0.1  b.localhost
When i request url  http://a.localhost:1760/ i get error
While trying to retrieve the URL: http://a.localhost:1760/
The following error was encountered:
Unable to determine IP address from host name for a.localhost

The dnsserver returned:
Name Error: The domain name does not exist.

This means that:
The cache was not able to resolve the hostname presented in the URL.
 Check if the address is correct.
What i should  do to resolve this error.

A: localhost can't have subdomains - it's a reserved DNS name that simply doesn't support them. You could, instead, use a.myhost.example and b.myhost.example, but be aware that Cassini, the VS development web server doesn't understand host headers.