text:
Q: Parallax header effect with RecyclerView I want to change my ListView I currently have over to use RecyclerView so I can make use of StaggeredGridLayoutManager but RecyclerView does not have the ability to add a header like ListView.
Usually with a ListView I set an empty view in the header and put the image below the listview and translate the bottom image with the scrolling of the list to create the Parallax effect.
So with out a header how can I create the same parallax effect with RecyclerView?

A: the easiest way to do it, is using below onScrollListener without relying on any library.
View view = recyclerView.getChildAt(0);
if(view != null && recyclerView.getChildAdapterPosition(view) == 0)  {
     view.setTranslationY(-view.getTop() / 2);// or use view.animate().translateY();
}

make sure your second viewHolder item has a background color to match the drawer/activity background. so the scrolling looks parallax.

A: So today I tried to archive that effect on a RecyclerView. I was able to do it but since the code is too much I will paste here my github project and I will explain some of the key points of the project.
https://github.com/kanytu/android-parallax-recyclerview
First we need to look at getItemViewType on the RecyclerView.Adapter class. This methods defines what type of view we're dealing with. That type will be passed on to onCreateViewHolder and there we can inflate different views. So what I did was: check if the position is the first one. If so then inflate the header, if not inflate a normal row.
I've added also a CustomRelativeLayout that clips the view so we don't have any trouble with the dividers and with the rows getting on top of the header.
From this point you seem to know the rest of the logic behind it.
The final result was:

EDIT:
If you need to insert something in adapter make sure you notify the correct position by adding 1 in the notifyItemChanged/Inserted method. For example:
public void addItem(String item, int position) {
    mData.add(position, item);
    notifyItemInserted(position + 1); //we have to add 1 to the notification position since we don't want to mess with the header
}

Another important edit I've done is the scroll logic. The mCurrentOffset system I was using didn't work with the item insertion since the offset will change if you add an item. So what I did was:
ViewHolder holder = findViewHolderForPosition(0);
if (holder != null)
  ((ParallaxRecyclerAdapter) getAdapter()).translateHeader(-holder.itemView.getTop() * 0.5f);

To test this I added a postDelayed Runnable, started the app, scrolled to the end, add the item in position 0, and scroll up again. The result was:

If anyone is looking for other parallax effects they can check my other repo:
https://github.com/kanytu/android-parallax-listview

A: For kotlin, you may config the recycler view as below
//setting parallax effects
    recyclerView.addOnScrollListener(object :RecyclerView.OnScrollListener(){
        override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
            super.onScrolled(recyclerView, dx, dy)
            val view = recyclerView?.getChildAt(0)
            if (view != null && recyclerView?.getChildAdapterPosition(view) === 0) {
                val imageView = view.findViewById(R.id.parallaxImage)
                imageView.translationY = -view.top / 2f
            }
        }
    })

A: This answer is for those curious about adding a parallax header to a GridLayoutManager or a StaggeredGridLayoutManager
You'll want to add the following code to your adapter in either onBindViewHolder or onCreateViewHolder
StaggeredGridLayoutManager.LayoutParams layoutParams =
                    (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
            layoutParams.setFullSpan(true);


text:
Q: Low-pass filter capacitor configuration for differential output of an amplifier The diagram below shows the output stage of a bipolar diffential DAC amplifier powered from a dual supply (in my case I won't use an LM324 but an OP484):

The amplifier outputs are fully differential (U1A and U1D are inverted.)
I want to make an RC low-pass filter for the output and I am not sure if I need C7. Which capacitors limit the output diffential noise and which CM noise? In practice, is it implemented like that, particularly for a diffential DAC amplifier output?

A:
Which caps limits the output differential noise and which CM noise?

With R9 and R10 as shown, C5 and C6 will attenuate (individually) both common mode and differential signals emanating from op-amps U1A and U1D. However, if C5 and C6 are not accurately matched they can actually convert CM signals into differential signals and this may cause problems.
Because of how C7 is placed it will only attenuate differential signals from U1A and U1D.

And in practice is it implanted like that?

It works but, if you need better CM attenuation you would add a common-mode-choke in series with both op-amp outputs and possibly reduce R9 and R10. CM and differential chokes: -

Image from A Guide to Understanding Common Mode Chokes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ember select2 dropdown option can not be selected Ember select2 dropdown option can not be selected instead it adds a class name "select2-result-unselectable" to the options list.

A: You should not use this component - as said in the repository: https://github.com/iStefo/ember-select-2
There are also tips for using other components.
If you need an answer necessarily, please post the code :)


text:
Q: Access Database - Understand Pass Through I have been given an Access Database that I have to try to decipher what it is doing.
As a start I see that there is a Pass Through query with a command like:
Exec RefreshGLTableLatestEntries
 @sourceDB = 'DB_NAME' ,
 @tablePrefix = 'TableName$' ,
 @logFile = 'C:\logDB.txt'

When I run it I will get something like:
Result
Success... 108 rows inserted with a total amount of $0.000000

What I don't understand is where are the rows being copied from or copied to.
In the MSSQL database I don't see a table, query, standard procedure or function called 'TableName$'. There are quite a few tables & queries called 'TableName$SomethingElse'. Is there a way to see more details on where is the data coming from?
Similarly, how can I see where are the rows being inserted to? I can not find any file named 'logDB.txt' in my hard disk to see the log. I would suspect that it might not say much more that '...108 rows insterted...'
I'm using:

*

*Access 2016 from Office 365, Version 1609

*MS SQL Server Management Studio v17.1

Any ideas on how to get more information on how to get more information on what the Pass Through do?

A: A Pass-Through query in Access is equivalent to running its SQL code in SQL Server Management Studio.
(In the database that is designated by the connection string of the Pass-Through query.)
The SQL is sent as-is to MSSQL and run there.
RefreshGLTableLatestEntries is the stored procedure that is executed here. You need to locate and analyze it in SQL Server.


text:
Q: Is it possible to combine animations? I'm exploring the possibility of combining two animations into a single one for a LottieAnimationView. With this we could ideally create dynamic animations by splitting long animations into sections and building on the fly. Does anyone know if this is possible?

A: why don't you use setminandsetMinAndMaxProgress(0,0.5f) you can call that your first animation and setminandsetMinAndMaxProgress(0.5f,1f) that your second animation


text:
Q: Invalid date of birth while using OSI sabre I have a sabre to sabre api request in which I need to create the passenger name record without using the passport information . But when I do the request it gives the following error
<TYPE>BusinessLogic</TYPE><TIMESTAMP>2018-06-04T11:32:33.948-05:00</TIMESTAMP><SYSTEMSPECIFICRESULTS><MESSAGE><content>INVALID DATE OF BIRTH - USE DDMMMYY</content>ERR.SWS.HOST.ERROR_IN_RESPONSE</MESSAGE></SYSTEMSPECIFICRESULTS>

The date of birth format works fine when I use the passport information while creating the passenger name record . Below is my request sample .
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_3" version="3.3.0" IgnoreOnError="true" HaltOnError="true">
    <PostProcessing IgnoreAfter="true" RedisplayReservation="true">
        <EndTransactionRQ>
            <EndTransaction Ind="true"/>
            <Source ReceivedFrom="Lorem ipsum"/>
        </EndTransactionRQ>
    </PostProcessing>
    <PriceQuoteInfo xmlns="http://services.sabre.com/sp/pd/v3_3">
        <Link NameNumber="1.1" Record="1"/>
        <Link NameNumber="2.1" Record="2"/>
        <Link NameNumber="3.1" Record="3"/>
    </PriceQuoteInfo>
    <SpecialReqDetails xmlns="http://services.sabre.com/sp/pd/v3_3">
        <AddRemarkRQ>
            <RemarkInfo>
                <FOP_Remark Type="CASH"/>
            </RemarkInfo>
        </AddRemarkRQ>
        <SpecialServiceRQ>
            <SpecialServiceInfo>
                <SecureFlight SegmentNumber="A">
                    <PersonName DateOfBirth="1996-02-23" Gender="M" NameNumber="1.1">
                        <GivenName>Edna</GivenName>
                        <Surname>Lindsey</Surname>
                    </PersonName>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </SecureFlight>
                <SecureFlight SegmentNumber="A">
                    <PersonName DateOfBirth="2015-08-14" Gender="F" NameNumber="2.1">
                        <GivenName>Ada</GivenName>
                        <Surname>Hughes</Surname>
                    </PersonName>
                </SecureFlight>
                <SecureFlight SegmentNumber="A">
                    <PersonName DateOfBirth="2017-04-11" Gender="M" NameNumber="3.1">
                        <GivenName>Lena</GivenName>
                        <Surname>Pope</Surname>
                    </PersonName>
                </SecureFlight>
                <Service SegmentNumber="A" SSR_Code="CHLD">
                    <PersonName NameNumber="2.1"/>
                    <Text>Hughes/Ada/14AUG15</Text>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </Service>
                <Service SegmentNumber="A" SSR_Code="INFT">
                    <PersonName NameNumber="1.1"/>
                    <Text>Pope/Lena/11APR17</Text>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </Service>
                <Service SSR_Code="OSI">
                    <PersonName NameNumber="1.1"/>
                    <Text>ID CARD Number 223341</Text>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </Service>
                <Service SSR_Code="OSI">
                    <PersonName NameNumber="2.1"/>
                    <Text>ID CARD Number 2211</Text>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </Service>
                <Service SSR_Code="OSI">
                    <PersonName NameNumber="3.1"/>
                    <Text>ID CARD Number 223343</Text>
                    <VendorPrefs>
                        <Airline Hosted="false"/>
                    </VendorPrefs>
                </Service>
            </SpecialServiceInfo>
        </SpecialServiceRQ>
    </SpecialReqDetails>
    <TravelItineraryAddInfoRQ xmlns="http://services.sabre.com/sp/pd/v3_3">
        <AgencyInfo>
            <Address>
                <AddressLine>HIMAL REISEN</AddressLine>
                <CityName>Kathmandu</CityName>
                <CountryCode>NP</CountryCode>
                <PostalCode>00977</PostalCode>
                <StreetNmbr>12</StreetNmbr>
                <VendorPrefs>
                    <Airline Hosted="false"/>
                </VendorPrefs>
            </Address>
            <Ticketing TicketType="7TAW"/>
        </AgencyInfo>
        <CustomerInfo>
            <ContactNumbers>
                <ContactNumber NameNumber="1.1" Phone="4118125712" PhoneUseType="H"/>
            </ContactNumbers>
            <Email Address="zowo@host.test" NameNumber="1.1"/>
            <PersonName NameNumber="1.1" Infant="false" PassengerType="ADT">
                <GivenName>Edna</GivenName>
                <Surname>Lindsey</Surname>
            </PersonName>
            <PersonName NameNumber="2.1" Infant="false" PassengerType="CNN" NameReference="C02">
                <GivenName>Ada</GivenName>
                <Surname>Hughes</Surname>
            </PersonName>
            <PersonName NameNumber="3.1" Infant="true" PassengerType="INF" NameReference="I13">
                <GivenName>Lena</GivenName>
                <Surname>Pope</Surname>
            </PersonName>
        </CustomerInfo>
    </TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>

Can anyone help me with this problem . Thanks in advance .

A: There are 2 other issues with the request other than the one you've got, all in the SpecialServiceInfo element.
1.The one that you got, INVALID DATE OF BIRTH - USE DDMMMYY, is because the Text element contains information that is not expected for SSR_Code="CHLD". It should only contain the date of birth and not the name, so 14AUG15 instead of Hughes/Ada/14AUG15.
<Service SegmentNumber="A" SSR_Code="CHLD">
    <PersonName NameNumber="2.1"/>
    <Text>Hughes/Ada/14AUG15</Text>
    <VendorPrefs>
        <Airline Hosted="false"/>
    </VendorPrefs>
</Service>

2.Both the SSR_Code="OSI" and SecureFlight cannot be assigned to the infant NameNumber="3.1", they should be assigned to the adult NameNumber="1.1". This would return something like: CANNOT ASSOC TO INFANT NAME
<Service SSR_Code="OSI">
    <PersonName NameNumber="3.1"/>
    <Text>ID CARD Number 223343</Text>
    <VendorPrefs>
        <Airline Hosted="false"/>
    </VendorPrefs>
</Service>

3.For infants, the geneder should be MI and FI, instead of M and F.
<SecureFlight SegmentNumber="A">
    <PersonName DateOfBirth="2017-04-11" Gender="M" NameNumber="3.1">
        <GivenName>Lena</GivenName>
        <Surname>Pope</Surname>
    </PersonName>
</SecureFlight>

You may check format finder for more info:

*

*Child SSR:

*

*https://formatfinder.sabre.com/Content/PassengerNameRecordPNR/PassengerNameRecordFields/SSRandOSIFieldsinPNR/SendanSSR.aspx?ItemID=316450AF736A45EC84616AE0D7A7B43B

*Secure Flight Formats > Format Definitions:

*

*https://formatfinder.sabre.com/Content/PassengerNameRecordPNR/TSAPassengerDocumentationSecureFlightAPISPCTC/SecureFlightTransportationSafetyAdministrationTSADocumentation.aspx?ItemID=d6e613fe6d5c4255beb7c70bd56fb4fe


text:
Q: How to use Flutter hive for creating a mark as fabourite button? I am developing a Quotes app as a beginner Practice project in flutter. I have multiple pages in my app. Right now I want to create an icon button which will perform as a bookmark (Mark as favourite) for the user.And in the app bar there will be a favourite option where the user can find those marked page number.Local databse seems too confusing to me.How can i use Hive for that problem.
class p1 extends StatefulWidget {
 @override
 _p1State createState() => _p1State();
  }

class _p1State extends State<p1> {
bool _isFavorite = true;
@override
Widget build(BuildContext context) {
return MaterialApp(
  home: Scaffold(
   body:Stack(
       children:<Widget>[
       Image(
       image:AssetImage("Image/Chowsun1.jpg"),
       fit:BoxFit.cover,
       width: double.infinity,
       height: double.infinity,
   ),
      Align(alignment: Alignment.center,
          child: Text('  Hello world '
              ,style: TextStyle(fontSize: 35.0,
                  color: Colors.white,
                  fontFamily: "Explora",
                  fontWeight: FontWeight.w900 ) )

      ),
         Align(
           alignment: Alignment.bottomLeft,
           child: const Text('   1 ',
             style: TextStyle(
                 fontSize: 25.0,
                 fontFamily: "MonteCarlo",
                 color: Colors.white,
                 fontWeight: FontWeight.w900),
           ),

         ),
    Align(
        alignment: Alignment.bottomCenter,
        child: FavoriteButton(
          isFavorite: _isFavorite,
          iconSize: 40,
          iconDisabledColor: Colors.red,
          iconColor: Colors.white,
          valueChanged: (isFav) {setState(() { _isFavorite = isFav; });},
        )
    )])

  ),
);

}
}

A: To bookmark or add favorites you need to persist the quotes. For that, you need to add these two packages https://pub.dev/packages/hive and https://pub.dev/packages/hive_flutter. What you are asking is for the whole code so I suggest you go through this easy documentation for hive implementation. https://docs.hivedb.dev/#/README
For a quick overview refer to this code.
After initializing await Hive.initFlutter(); and opening a box await Hive.openBox('testBox'); in main().
Make a box reference in your respective class then add the value box.put('key', 'Value'); Hive stores data in key-value pairs.


text:
Q: FANNJ is crashing when creating an ANN given a list The constructor of FANNJ accepts the way to give a list of layers, but when I try to build a simple ANN with 2 layers the compiler crashes
Layer lhidden1 = new Layer();
lhidden1.create(num_neurons_hidden, ActivationFunction.FANN_SIGMOID_SYMMETRIC_STEPWISE);
Layer loutput = new Layer();
loutput.create(num_neurons_output, ActivationFunction.FANN_SIGMOID_STEPWISE);
List<Layer> list = new ArrayList<Layer>();
list.add(lhidden1);
list.add(loutput);
fann = new Fann(list);

The program stops at "fann = new Fann(list)" command. It sounds to be related to "fann_create_sparse_array" which is pointed as a "Problematic frame":
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0x00007f2f7b3434c6, pid=6926, tid=0x00007f2f992ed700
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libfann.so+0x54c6]  fann_create_sparse_array+0x2ca
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

I've checked about ulimit, but it is only about a dump error configuration, it sounds to do not solve any problem, only is about to allow to know more about the crash. Does anyone knows how to solve it?

A: Just reporting the solution: The method create must be accessed by static way, so the way to solve it should be like this:
List<Layer> list = new ArrayList<Layer>();
list.add(Layer.create(num_neurons_hidden, ActivationFunction.FANN_SIGMOID_SYMMETRIC_STEPWISE));
list.add(Layer.create(num_neurons_output, ActivationFunction.FANN_SIGMOID_STEPWISE));
Fann fann = new Fann(list);


text:
Q: What's wrong with my SQL-EXCEPT-Operator? When I select "BookID" from my tables "Stats" and "Book" I get desired results each like:
MariaDB [db1]> SELECT BookID From Book WHERE Author = 'AuthorX';
+--------+
| BookID |
+--------+
|   1003 |
+--------+

MariaDB [db1]> SELECT BookID From Stats WHERE BookID >= 1000;
+--------+
| BookID |
+--------+
|   1010 |
|   1005 |
|   1003 |
+--------+

But when I try to use the EXCEPT-operator, I get an error
MariaDB [db1]> (SELECT BookID From Stats WHERE BookID >= 1000)
     -> EXCEPT
     -> (SELECT BookID From Book WHERE Author = 'AuthorX');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXCEPT (SELECT BookID From Book WHERE Author = 'AuthorX')' at line 1

What I hoped to be the output:
+--------+
| BookID |
+--------+
|   1010 |
|   1005 |
+--------+

What am I doing wrong?
I tried with and without bracket, but got no idea, what to try next?
EDIT: Try with NOT IN
SELECT BookID From Stats WHERE BookID >= 1000 NOT IN
(SELECT BookID From Book WHERE Author = 'AuthorX');

yields
+--------+
| BookID |
+--------+
|      3 |
|   1010 |
|   1005 |
|   1003 |
+--------+

EDIT2: "AND BookID NOT IN" for EXCEPT works
Still would love to know why EXCEPT doesn't
EDIT3: The Examples from https://mariadb.com/kb/en/library/except/ do work…
EDIT4: MariaDB Vers<10.3 does not have EXCEPT seems to be is the answer.
Still wonder why the examples work…

A: Remove the brackets.
It looks "nicer" on three lines...
SELECT `BookID` From `Stats` WHERE `BookID` >= 1000
EXCEPT
SELECT `BookID` From `Book`  WHERE `Author`  = 'AuthorX'

It's much the same as you may see in UNION ALL...
SELECT BookID From Book WHERE Title LIKE 'Harry Potter%'
UNION ALL
SELECT BookID From Book WHERE Author LIKE '%Toklien%'

EDIT:
Or just try an alternative expression (If on an older version of MariaDB)...
SELECT BookID
  FROM Book
 WHERE BookID >= 1000
   AND BookID NOT IN (SELECT BookID
                        FROM Book
                       WHERE Author = 'AuthorX'
                     )

Or...
SELECT BookID
  FROM Book
 WHERE BookID >= 1000
   AND NOT EXISTS (SELECT *
                     FROM Book  lookup
                    WHERE lookup.Author = 'AuthorX'
                      AND lookup.BookID = Book.BookID
                  )

Or...
SELECT
  *
FROM
(
  SELECT BookID FROM Book WHERE BookID >= 1000
)
  high_id
LEFT JOIN
(
  SELECT BookID FROM Book WHERE Author = 'AuthorX'
)
  target_author
    ON target_author.BookID = high_id.BookID
WHERE
  target_author.BookID IS NULL


text:
Q: :: how to parse KSOAP ARRAYTPE response :: I need some help in understanding how to parse the KSOAP RESPONSE in j2me.
below is the actual ksoap response i get after making a ksoap request.
    <AddressArray>
    <AddressBin>
        <UserSeqID>200</UserSeqID>
        <AddressID>115</AddressID>
        <ZipCode>10005</ZipCode>
        <IsPrimary>false</IsPrimary>
        <State>New York</State>
        <StateID>37</StateID>
        <StateCode>NY</StateCode>
        <City>New York Mills village</City>
        <CityID>11701</CityID>
        <StreetAddress>90 feet rd</StreetAddress>
        <NickName>Gym</NickName>
    </AddressBin>
    <AddressBin>
        <UserSeqID>200</UserSeqID>
        <AddressID>110</AddressID>
        <ZipCode>10002</ZipCode>
        <IsPrimary>false</IsPrimary>
        <State>New York</State>
        <StateID>37</StateID>
        <StateCode>NY</StateCode>
        <City>New York city</City>
        <CityID>11700</CityID>
        <StreetAddress>5th Street</StreetAddress>
        <NickName>Home</NickName>
    </AddressBin>
    <AddressBin>
        <UserSeqID>200</UserSeqID>
        <AddressID>114</AddressID>
        <ZipCode>10002</ZipCode>
        <IsPrimary>true</IsPrimary>
        <State>New York</State>
        <StateID>37</StateID>
        <StateCode>NY</StateCode>
        <City>New York city</City>
        <CityID>11700</CityID>
        <StreetAddress>4th Street</StreetAddress>
        <NickName>Office</NickName>
    </AddressBin>
</AddressArray>

here is the ksoap response template
<AddressArray>
      <AddressBin>
        <UserSeqID>int</UserSeqID>
        <AddressID>int</AddressID>
        <ZipCode>string</ZipCode>
        <IsPrimary>boolean</IsPrimary>
        <State>string</State>
        <StateID>int</StateID>
        <StateCode>string</StateCode>
        <City>string</City>
        <CityID>int</CityID>
        <StreetAddress>string</StreetAddress>
        <NickName>string</NickName>
      </AddressBin>
      <AddressBin>
        <UserSeqID>int</UserSeqID>
        <AddressID>int</AddressID>
        <ZipCode>string</ZipCode>
        <IsPrimary>boolean</IsPrimary>
        <State>string</State>
        <StateID>int</StateID>
        <StateCode>string</StateCode>
        <City>string</City>
        <CityID>int</CityID>
        <StreetAddress>string</StreetAddress>
        <NickName>string</NickName>
      </AddressBin>
    </AddressArray>

please let me know how should i map the soap xml respone to custom java classes ?

A: I don't know how it works in J2ME, but what I did with Android was to run a loop the size of the PropertyCount(which in your case would be the PropertyCount of AddressArray) of the SOAP response, access every individual property of that (your case AddressBin) while in the loop, and then again access every property of that property (your case UserSeqID, AddressID, etc.), put them into a String, parse those to the desired variables and put those variables in a model and put those models in an array.
If you want them to be automatically serialized I can't help you with that because I don't know how that works.
Hope this helps.


text:
Q: Sum values from dataframe with iloc --Edited--
I am following this script found on Kaggle on multilabel-category-prediction : https://www.kaggle.com/rodsaldanha/multilabel-category-prediction
I am currently at the command line 344, which is part of exploratory analysis section :
bar_plot = pd.DataFrame()
bar_plot['cat'] = description_category.columns[1:]
bar_plot['count'] = description_category.iloc[:,1:].sum().values
bar_plot.sort_values(['count'], inplace=True, ascending=False)
bar_plot.reset_index(inplace=True, drop=True)
bar_plot.head()

The output should look like this :
    cat                     count
0   International Movies    1927
1   Dramas                  1623
2   Comedies                1113
3   International TV Shows  1001
4   Documentaries           668

However, I am having this error for that specific part of the command :
  bar_plot['count'] = description_category.iloc[:,1:].sum().values

The error is below
ValueError                                Traceback (most recent call last)
<ipython-input-70-76549b4c5547> in <module>
----> 1 bar_plot['count'] = description_category.iloc[:,1:].sum().values
C:\Anaconda\envs\nlp_course\lib\site-packages\pandas\core\frame.py in __setitem__(self, key, value)
   3117         else:
   3118             # set column
-> 3119             self._set_item(key, value)
   3120
   3121     def _setitem_slice(self, key, value):
C:\Anaconda\envs\nlp_course\lib\site-packages\pandas\core\frame.py in _set_item(self, key, value)
   3192
   3193         self._ensure_valid_index(value)
-> 3194         value = self._sanitize_column(key, value)
   3195         NDFrame._set_item(self, key, value)
   3196
C:\Anaconda\envs\nlp_course\lib\site-packages\pandas\core\frame.py in _sanitize_column(self, key, value, broadcast)
   3389
   3390             # turn me into an ndarray
-> 3391             value = _sanitize_index(value, self.index, copy=False)
   3392             if not isinstance(value, (np.ndarray, Index)):
   3393                 if isinstance(value, list) and len(value) > 0:
C:\Anaconda\envs\nlp_course\lib\site-packages\pandas\core\series.py in _sanitize_index(data, index, copy)
   3999
   4000     if len(data) != len(index):
-> 4001         raise ValueError('Length of values does not match length of ' 'index')
   4002
   4003     if isinstance(data, ABCIndexClass) and not copy:
ValueError: Length of values does not match length of index

How can I fix that? Thanks!

A: My first answer wasn't on point. After looking at it again, I have the suspicion that your dataframe description_category has at least one column over which you can't sum, and therefore .sum() creates a result that doesn't match the requiered length. I think you're running into a scenario like this:
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4], 'C': [5, 6], 'D': [7, '8']})

   A  B  C  D
0  1  3  5  7
1  2  4  6  8

In df you can't sum over column D, here because there are items in it that have types that can't be summed (int and str). In your case there could be other reasons, i.e. a column has elements of a type which isn't summable at all (like dict etc.)
If you look at
print(df.columns[1:])
print(df.iloc[:, 1:].sum().values)

you'll get something like
Index(['B', 'C', 'D'], dtype='object')
[ 7, 11]

two objects of different length! .sum just ignores column D, because it can't sum up it's elements, and doesn't complain about it.
Now if you try something similar to what you were doing
df_new = pd.DataFrame()
df_new['col_1'] = df.columns[1:]
try:
    df_new['col_2'] = df.iloc[:, 1:].sum().values
except ValueError as val_err:
    print(val_err)

you'll get something like
ValueError('Length of values (2) does not match length of index (3)')

which is pretty much the error message that you get.
Remedy: Hard to tell. First look at description_category.columns[1:] and description_category.iloc[:,1:].sum().values to confirm that this is actually happening. Then locate the columns/data in description_category which lead to the problem. Afterwards go back through the data generating process and determine how this came about. Or try directly to transform the columns that cause the problem. The data for the kaggle project don't seem to be available any more: Where are your data from?


text:
Q: In excel how can I select a range of cells below a cell that matches a certain value I have a spreadsheet that contains a bunch of dates with several rows of data beneath the cells containing the dates (new dates & data are appended to the spreadsheet on a weekly basis)

In another spreadsheet I have 7 columns containing the dates of the last 7 days (including the current day). This date information is acquired using "=TODAY()".

How can I search the data spreadsheet (first screenshot) for cells matching the dates in the date spreadsheet and then copy the 10 cells below the matching date cell to the corresponding cells in the date spreadsheet? The end result would be something similar to the following:

The dates spreadsheet would update dynamically, so for instance when the current date changes the data in the dates spreadsheet would update to match the new selection of dates.

A: Use the INDEX MATCH syntax.
for the cell A2 in the sheet with the live dates in, enter
=INDEX(Sheet1!$A$2:$H$10,1,MATCH(Sheet2!A$1,Sheet1!$A$1:$H$1,0))
BUT replace H with the final column in which the original data extends to, and 10 with the final row the data extends to (Both in all instances in the formula). If you then fill down the formula and fill across the formula you should get the desired result.
Feel free to ask if it doesn't work/anymore questions.


text:
Q: Send data to a sql server stored procedure from laravel i have this code in my  sql server stored procedure, this one recive the data and stored it in a table, when i run it manually it works:
ALTER PROCEDURE [dbo].[sp_registrarsalidavehiculo]

    @est_id as int,
    @uni_patente as varchar(10),
    @uni_id as varchar(20),
    @vig_conductor varchar(50),
    @vig_acompanante as varchar(50),
    @vig_destino as varchar(200),
    @vig_salidaKm as numeric(10, 0),
    @vig_observaciones as varchar(200),
    @com_id as int,
    @usu_id_salida as int,
    @vig_tipo as int,
    @vig_dni  as nvarchar(10)

AS
BEGIN

    insert into rrhh.vigilancia(vig_fechaSalida, est_id, uni_patente, uni_id, vig_conductor, vig_acompanante, vig_destino, vig_salidaKm, vig_observaciones, com_id, usu_id_salida, vig_tipo, vig_dni)
    values(Getdate(), @est_id, @uni_patente, @uni_id, @vig_conductor, @vig_acompanante, @vig_destino, @vig_salidaKm, @vig_observaciones, @com_id, @usu_id_salida, @vig_tipo, @vig_dni)

END

when i try to send data through postman to prove my apirest it show me this error

this is the code in my route file "api.php"
Route::resource('vigilancia', 'App\Http\Controllers\Vigilancia\VigilanciaController', ['only'=>['index','store']]);

this is the code in my controller
public function store(Request $request)
    {
        $est_id             =   $request->est_id;
        $uni_patente        =   $request->uni_patente;
        $uni_id             =   $request->uni_id;
        $vig_conductor      =   $request->vig_conductor;
        $vig_acompañante    =   $request->vig_acompañante;
        $vig_destino        =   $request->vig_destino;
        $vig_salidaKm       =   $request->vig_salidaKm;
        $vig_observaciones  =   $request->vig_observaciones;
        $com_id             =   $request->com_id;
        $usu_id_salida      =   $request->usu_id_salida;
        $vig_tipo           =   $request->vig_tipo;
        $vig_dni            =   $request->vig_dni;

        $est_id             =   ($est_id   ==  NULL) ? ($est_id   =   0) :   $est_id;
        $uni_patente        =   ($uni_patente   ==  NULL) ? ($uni_patente   =   '') :   $uni_patente;
        $uni_id             =   ($uni_id   ==  NULL) ? ($uni_id   =   '') :   $uni_id;
        $vig_conductor      =   ($vig_conductor   ==  NULL) ? ($vig_conductor   =   '') :   $vig_conductor;
        $vig_acompañante    =   ($vig_acompañante   ==  NULL) ? ($vig_acompañante   =   '') :   $vig_acompañante;
        $vig_destino        =   ($vig_destino   ==  NULL) ? ($vig_destino   =   '') :   $vig_destino;
        $vig_salidaKm       =   ($vig_salidaKm   ==  NULL) ? ($vig_salidaKm   =   0) :   $vig_salidaKm;
        $vig_observaciones  =   ($vig_observaciones   ==  NULL) ? ($vig_observaciones   =   '') :   $vig_observaciones;
        $com_id             =   ($com_id   ==  NULL) ? ($com_id   =   0) :   $com_id;
        $usu_id_salida      =   ($usu_id_salida   ==  NULL) ? ($usu_id_salida   =   0) :   $usu_id_salida;
        $vig_tipo           =   ($vig_tipo   ==  NULL) ? ($vig_tipo   =   0) :   $vig_tipo;
        $vig_dni            =   ($vig_dni   ==  NULL) ? ($vig_dni   =   0) :   $vig_dni;

DB::select("EXEC sp_registrarsalidavehiculo (". $est_id .", ".$uni_patente.", ".$uni_id.", ".$vig_conductor.", ".$vig_acompañante.", ".$vig_destino.",
                                                             ".$vig_salidaKm.",".$vig_observaciones.", ".$com_id.", ".$usu_id_salida.", ".$vig_tipo.", ".$vig_dni.")");


text:
Q: native typeface cannot be made При замене шрифта Всем привет:
Кто баловался со шрифтами и ставил свои в приложение:
Делаю так:
папка: assets/fonts/mistra.ttf
в классе к которому привязан xml
пишу
TextView tv;
Typeface face;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.a1);
tv = (TextView) findViewById(R.id.eda);
face = Typeface.createFromAsset(getAssets(), "fonts/mistral.ttf");
tv.setTypeface(face);
}

и вижу такую ошибку:
native typeface cannot be made
ссылается на строку
face = Typeface.createFromAsset(getAssets(), "fonts/mistral.ttf");

A: У вас скорее всего идет утечка памяти. Правильно грузить будет вот так Utils.getTypeFace(ctx, "fonts/mistral.ttf")
public class Utils {

private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();

    public static Typeface getTypeFace(Context context, String assetPath) {
            synchronized (cache) {
                if (!cache.containsKey(assetPath)) {
                    try {
                        Typeface typeFace = Typeface.createFromAsset(context.getAssets(), assetPath);
                        cache.put(assetPath, typeFace);
                    } catch (Exception e) {
                        Log.e("TypeFaces", "Typeface not loaded.");
                        return null;
                    }
                }
                return cache.get(assetPath);
            }
        }
}

В этом случае вы защитите свое приложение от утечки, так как шрифт будет загружены 1 раз и на всю сессию приложения.
UPD
tv = (TextView) findViewById(R.id.eda);
face = Utils.getTypeFace(this, "fonts/mistral.ttf");
tv.setTypeface(face);


text:
Q: How to preserve pointers between multiple method calls in C I'm writing a parser for propositional logic (doesn't matter what that is, main point is I'm parsing a simple language) and initially started out with functions of the following form:
int formula() {
    int store = step;
    if(compound())
        return TRUE;
    else {
        if(atom())
            return TRUE;
        else if(negation() && formula())
            return TRUE;
        else {
            step = store;
            return FALSE;
        }
    }
}

int compound() {
    int store = step;
    if(open() && formula() && binary_operator() && formula() && close())
        return TRUE;
    else {
        step = store;
        return FALSE;
    }
}

The functions above not mentioned are base cases - these are the important parts. Formulas can have sub-formulas, and these sub-formulas in turn can be compound formulas, which contain sub-formulas, and so on.
Instead of ints though, I'm trying to return char sequences of 1s and 0s (true and false). If you return a sequence, it means that the input can generate a sequence (it must be valid). Otherwise, return null.
The issue is that every time I've tried the pointers keep getting lost - I understand this is to do with the stack(?) and the pointer sort of 'dies' when the function returns whatever. I've not tried arrays because I have been told that arrays work best statically, whereas the size of these arrays would be dynamic (size is determined by number of variables, which is only found at runtime).
Is there any way this approach can be done? I can't malloc anything because I won't be able to free it - the sequence of 1s and 0s needs to be returned before I'd be able to free it. Maybe pass structs with a sequence field, although I'm not sure if that suffers from the same issue.
Any help much appreciated. This is a program using C99. Any advice on clarifications welcome!

A: I'm not entirely following what you want to do, but there is not a clear reason why you couldn't use malloc. The pointer returned by malloc can be freed by another function later. Consider the following valid code:
char* foo(size_t* length)
{
    *length = 3;
    char* seq = malloc(*length);
    seq[0] = 1;
    seq[1] = 0;
    seq[2] = 1;
    return seq;
}

int main()
{
    size_t length;
    char* seq = foo(&length);
    /* use seq */
    free(seq);
}

You can also do it without malloc if you know an upper bound for your sequence. By passing a pointer to space you allocated on the stack from main(), you won't lose the data when the function exits:
void foo(char* seq, size_t total_size, size_t* used_size)
{
    *used_size = 3;
    seq[0] = 1;
    seq[1] = 0;
    seq[2] = 1;
}

int main()
{
    size_t used_size;
    char seq[100];
    foo(seq, sizeof(seq), &used_size);
    /* use seq */
}


text:
Q: auto text to columns multiple csv using python I have a lot of csv with a # delimiter and I want to apply "text to columns" for all of them using python.
For example, I have a file "filename.csv" which looks like
1#2#3#4
And I want to rewrite it in the same file so it'd look like this:
1 2 3 4
but each number in it's own column
My code for now is:
import csv
with open('filename.csv', 'rb') as csvfile:
            with open('out.csv','w') as csvfileout:
            spamreader = csv.reader(csvfile, delimiter='#', quotechar='#')
            spamwriter=csv.writer(csvfileout,delimiter='#',quotechar=' ')
            for row in spamreader:
                    lines=' '.join(row)
                    csvfileout.write(lines)

And my output is just wrong.
Could you please help me what's wrong in my code?

A: Just change delimiter, not quotechar.
And you can "pipe" the input directly to the output, keeping data as rows (you were manually creating the row with join which is unnecessary):
import csv
with open('filename.csv', 'r') as csvfile, open('out.csv','w') as csvfileout:
    spamreader = csv.reader(csvfile, delimiter='#')
    spamwriter = csv.writer(csvfileout,delimiter=' ')
    spamwriter.writerows(spamreader)

note that some python 2 versions need wb for output file, and some python 3 versions need the extra parameter newline='' when opening the file for writing.
Both are unnecessary with latest python releases (2 or 3).

A: You can achieve that with linux's sed command very easily.
First check if its working like so:
sed 's/#/ /g' filename

If it's working then you can replace all the # with space like so:
for single file in current folder
sed -i 's/#/ /g' filename

for all files in current folder
sed -i 's/#/ /g' ./*


text:
Q: Extracting the contour lines from an image The Image presented is created by Mathematica ListPLot. It's a list of points out of a 512x512 grid, which meets criteria. I would like to be able to identify the points that make the contour, inside and outside, of the green "ears". Then with these points identified, average over the two contours and have a line that draws the shape. I'm not sure if this can be done in Mathematica and if it can, how to implement it. Any help would be appreciated

Update
Another option would be to use a more restrictive criterion, which gives a plot like this.

Is there a way to make Mathematica connect the points and/or make a list of these points?

A: If you can specify your criteria as an set of inequalities:
criteria = x^4 + y^4 <= 1 && x^2 + y^2 > 0.5^2;

you can simply use ImplicitRegionand RegionBoundary:
r = ImplicitRegion[criteria, {x, y}]
Region[RegionBoundary[r]]


text:
Q: How to remove title bar in support library? I want to port my app to android support library v7 revision 23.1.
For this purpose I have extended my theme from Theme.AppCompat.NoActionBar as instructed in multitude of guides.
<style name="MyTheme" parent=" Theme.AppCompat.NoActionBar ">

The problem is that the activity shows old android title bar with the name of my application and I cannot remove this title bar. Regarding this the support library is a big step backwards in comparison to holoeverywhere. Not to mention load of other bugs.
I have tried to remove title bar using following adition to my theme:
<style name="MyTheme" parent=" Theme.AppCompat.NoActionBar ">
    ...
    <item name="windowNoTitle">true</item>
    <item name="android:windowNoTitle">true</item>
    ...
</style>

But the title bar persists.
The device runs with android 2.3.5.
How to remove title bar?

A: You must set
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

also using toolbar
<android.support.v7.widget.Toolbar
      android:id="@+id/activity_main_page_toolbar"
      android:layout_height="@dimen/actionbar_height"
      android:layout_width="match_parent"
      android:background="@drawable/actionbar_background"
      android:textColorPrimary="@android:color/white"
      app:theme="@style/Theme.CustomAppCompat">

                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/ic_logo"
                        android:background="@drawable/menu_item_drawable"
                        android:padding="5dp"
                        android:clickable="true"
                        android:id="@+id/toolbar_icon" />

     <include layout="@layout/notif_layout" />
</android.support.v7.widget.Toolbar>

A: Try to create such a style.xml.Its for full screen app.So just delete fullscreen for NoTitleBar.And windowFullScreen to false.
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>
    <style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
</resources>

And such a Mansifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="by.test.roma.usermetrics" >

    <application
        android:name=".ParseApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>


text:
Q: python selenium + geckodriver in docker container with headless mode cannot scroll page I am trying to run selenium with geckodriver in headless mode in a docker container ubuntu 18.04. This is my code:
    while True:
        driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

        time.sleep(2)
        newHeight = driver.execute_script("return document.body.scrollHeight")
        print('scrolling..')
        if newHeight == lastHeight:
            print(f'scrolling done..')
            list_of_images = driver.find_elements_by_css_selector('._2eea a')
            print(f'collecting: {fp_url}')
            images = []
            for image in list_of_images:
                url = image.get_attribute('href')
                if 'type=3' in str(url):
                    print(f'append: {url}')
                    images.append(url)
                    # clear_memory()
            print(f'total: {len(images)} memes')
            count = 1
        else:
            lastHeight = newHeight

i got no error when i tried in my local computer but when i tried in a docker container it seems like the page wont scroll. And this is my driver setup:
    options = webdriver.FirefoxOptions()
    options.add_argument('--hide-scrollbars')
    options.add_argument('--disable-gpu')
    options.add_argument('-headless')
    driver = webdriver.Firefox(firefox_options=options, executable_path=os.path.join(os.getcwd(), "geckodriver"))

A: Assuming your chrome driver is completely up to date, but worth checking
https://sites.google.com/a/chromium.org/chromedriver/downloads
perhaps trying a few different ways of scrolling could yield some better results :)
Using actions chains - https://selenium-python.readthedocs.io/api.html
from selenium.webdriver.common.action_chains import ActionChains as AC

ele = driver.find_element_by_id("myID")

actions = AC(driver)
actions.move_to_element(ele).perform()

Passing element id as argument into scrollintoview()
driver.execute_script("arguments[0].scrollIntoView();", ele)


text:
Q: is there a NO MOTION mouse listener? I have a map applet, and I have a JLabel following the mouse, whenever the mouse goes over a city the JLable displays the the name of the city and population.
I use the mouseMotionListener's MouseMoved method for that, but i want the label to be there only if the mouse stays still for a couple of seconds above the city.
I dont know if its because I been working on this code for days now, but i cant seem to think of a solution for this using the MouseMoved method, i tried using timers but that didnt work for me (mayb i just did it wrong cause my brain is burned out)
so is there a mouse listener for the mouse staying still? or do you have any recommendations?
here is more or less what I got
public void mouseMoved(MouseEvent evt) {
   int x = evt.getX();
   int y = evt.getY();
   boolean aboveCity = false;
   mouseover.setBounds(x+20, y-10, 200, 20); //mouseover is a JLabel

   for (int i=0;i<cityCounter;i++){
      if (city[i].containsPoint(x,y){
         name = city[i].getName();
         population = city[i].getPopulation();
         aboveCity = true;
      }
   }
   if(aboveCity){
      mouseover.setText(name + ", " + population);
   }
   else{
      mouseover.setText("");
   }
}

A: Use a Java javax.swing.Timer. Each time the mouse moves, reset the timer. When the timer goes off, the mouse has been "still" for as long as your timer was set for.


text:
Q: Reserved Ports in Windows 1809 First time posting here :)
I'm having an issue where some programs can't run on my Windows 10 device.
It seems that there is a lot of reserved TCP ports. I've narrowed some of those reserved ports to Hyper-V. The thing is I can't really change the port used by those programs that fails to run like "Pulse Secure Application Launcher"...
Do you know what could be reserving port ranges like 1540-1639, 2240-2339, 3278-3377, etc... ?
I tried to remove them but I get an error while trying to do so :
> netsh int ipv4 delete excludedportrange protocol=tcp startport=1540 numberofports=100
Access is denied.

Here's what it looks like when I display excluded port ranges.
> netsh int ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
      1540        1639
      1640        1739
      1740        1839
      1840        1939
      1940        2039
      2140        2239
      2240        2339
      2340        2439
      2542        2641
      2677        2776
      2878        2977
      2978        3077
      3078        3177
      3178        3277
      3278        3377
      3378        3477
      3478        3577
      3578        3677
      3678        3777
      3778        3877
     22654       22753
     22754       22853
     50000       50059     *

* - Administered port exclusions.

It seems some of them are reserved by Hyper-V like 3278 to 3377 because when I uninstall Hyper-V half of low range reserved ports are removed. However I do need Hyper-V on my computer but each time I try to uninstall / reinstall it, the problem is back again.

A: I use next commands to release reserved ports:
net stop winnat
net start winnat

and this command to check which port ranges currently reserved by system:
netsh int ipv4 show excludedportrange protocol=tcp


text:
Q: Distribution of access token expiry reasons - favors removal of user as Page admin We're seeing some strange behavior in the reasons why access tokens are expiring for Pages using our app. We're using the offline_access permission, and aren't experiencing any problems in data collection (limits, errors, etc.).
Several of the users whose Page tokens expired are actual owners of the Page. If a token expires, it's odd that we get a reason for expiry as 'removed from admin role'.
After speaking with some of the users who appear to have been removed as admins, I found that no one explicitly removed them from the admin role - FB seems to have done so of its own accord.
Is this a documented behavior?
Some numbers:

*

*76 : Total access tokens expired (out of several hundred authorized tokens)

*22 (28.9%) : Changed account password (Error validating access token: The session has been invalidated because the user has changed the password.)

*52 (68.42%) : Removed as admin of Page (The user must be an administrator of the page in order to impersonate it.)

*2 (2.6%) : Revoked access to the app (Error validating access token: User has not authorized application.)
The numbers appear to be heavily skewed. Is this kind of distribution common?
How common is it for users to be removed as admins from Pages?
Anyone have insight into user behavior - do they remove admin access instead of revoking app access?
Thanks.

A: Facebook is currently in the process of deprecating the offline_access permission.  See: https://developers.facebook.com/docs/offline-access-deprecation/ and  https://developers.facebook.com/blog/post/500/ for some ways to handle expired tokens.
As far as the inner workings of Facebook, your guess is as good as mine as to what they're doing with page administrators.  This is definitely of concern to me as one of my production apps deals with pages and offline_access.  As of yet, I have not seen an issue with admins being revoked page administration rights.  I will keep my eye out for it.
Check your app settings to see what deprecate offline_access: is set to for your app(s) at https://developers.facebook.com/apps/{appid}/advanced


text:
Q: asp:ImageButton in Gridview OnClick event not working I've spent quite a while searching this problem, there are some other similar threads online but none have helped me fix it.
I have a GridView with an ImageButton within it, the imagebutton has an OnClick function but that event is never reached when it is clicked, below is my gridview:
<asp:GridView ID="gridBuildings" runat="server" AutoGenerateColumns="False"
              GridLines="none" ShowFooter="false" ShowHeader="false"
              Width="100%">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:ImageButton runat="server" ID="cmdBuy"
                     ImageUrl="~/images/button.jpg"
                     OnClick="ImageButton_Click"/>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

and here's the code-behind (I've removed the extra content, the response.redirect is never hit when the ImageButton is clicked)
Protected Sub ImageButton_click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
    response.redirect("test.aspx")
    Dim row As GridViewRow = Me.gridBuildings.SelectedRow
    (etc ... )
End Sub

There is a form runat="server" tag in the master page, as well as an asp:UpdatePanel and an asp:AjaxScriptManager I have a feeling the problem might be something to do with a postback but just can't work it out - any help would be appreciated.
Thanks!

A: Make sure you are not rebinding the grid every page load.  If you rebind, the event will never fire.  Wrap the binding statement in an if not ispostback block.


text:
Q: significance of a test for (javascript) pseudo-random generator I wrote a test case that tests if the javascript pseudo-random number generation algorithm of a given implementation has a given number of significant bits.
You can see and test my code here: https://jsfiddle.net/b93ev14g/1/
Now my question remaining is what statistical significance my test has.
My test does the following:
It generates a given (e.g. 1000) number of pseudo random numbers with the built in algorithmn (e.g. xorshift128+).

*

*If it finds any broken (floating) number, e.g. 10.5 it knows that the bits used by the algorithm are more than the number of bits the test was run for.

*If it doesn't find any odd number after the given amount of iterations it is likely that the algorithm uses less bits than the test was run with.

So my question are

*

*how big is the probability that the test will find a floating number (if the algorithm generates any) after n iterations?

*how big is the probability that the test will find a broken number (if the algorithm generates any)?

Do the probabilities depend on the actual number of bits that the prng generates and the number of bits that the test runs for?
How can I calculate the significance that the test has to pass valid if the pseudo random number generated generates statistically uniform distributed numbers with given number of iterations and a given number of bits against which the test is run?
Thank you!

A: ok, so I just realized it's not that hard, actually quite easy:
It's a classical case of hypothesis testing. You actually want to calculate the probability of a type II error to occur.
I expect the probability of any significant bit to be set or unset to be $\frac {1} {2}$.
So for $n$ iterations this means if the actual number of bits of the prng-function is k bits away from the tested number of bits and all tests pass valid, then the probabilty for this to happen on coincident is:
$p(x) = \binom {n} {n} {\frac {1} {2}}^{k \cdot n} = {\frac {1} {2}} ^ {k \cdot n} $
That's true for point (1) and for point (2).
Since the number of tested bits can only either be too low or too high of course if (1) happend to pass valid on accident then the probability that (2) would pass on accident is $0$ and the other way around.
So the probability for the test to pass on accident actually decreases exponentially in regard to the distance of bits and exponentially in regards to the number of iterations.
Apart from that it is of course possible to decrease the probability of the test to pass on accident to $0\%$ by finding a single example of the test to fail with with number of $bits$ the function is tested against chosen to result in $k = 1$ on either side of the range.


text:
Q: HTML frame tag URL of browser not changing How do I change the URL of the browser with a website using a structure of <frame>. I know the whole point of <frame> is to use embedded frames so that you can't tell where the site is going. In particular, when you click a link, the frame changes, but the URL at the top of the browser says the same thing.
I'm trying to make it so that the browser CHANGES the URL, so the real URL of the main inner frame is shown at all times. How can I do this?

A: You can't; best bet is to change the fragment with JavaScript, e.g. window.location.hash = 'whatever'.
You will need to use JavaScript to then detect this and modify the frame's src attribute.

A: Try to use a javascript to change window.location.hash, see this article : http://bytes.com/topic/javascript/answers/170365-change-browser-url-without-navigating-away
or this question How do I, with JavaScript, change the URL in the browser without loading the new page?


text:
Q: Visual studio 2013 view project in browser gives internal server error I am new with Visual studio 2013 and I am currently working on two projects started by another developer. With one project the view option works fine using IIS Express, but the second one gives me error 500 with the below details...
"HTTP Error 500.19 - Internal Server Error. The requested page cannot be accessed because the related configuration data for the page is invalid."
"Config Error: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'Access-Control-Allow-Origin'"
Config Source:
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />

Hope somebody knows about an error like this and how I can solve it. Thanx in advance

A: I suspect IIS is already sending an Access-Control-Allow-Headers by default and that is blowing up.
Typically when setting custom headers one usually does a prophalactic removal first:
<customHeaders>
<remove name="Access-Control-Allow-Origin" />
<remove name="Access-Control-Allow-Headers" />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaers>

This insures your app works no matter what happened upstream in configuration.


text:
Q: Filter playlist videos based on date they were added I have been going through YoutubeDL's readme, it's pretty detailed, but I could find a way to filter videos of a playlist based date they were added to the playlist.
I am looking for something very similar to dateafter but for the date added, not uploaded.
I thought I could use match-filter, but I don't see any relevant keys when I run:
youtube-dl --skip-download --print-json <playlist_url> | jq keys

Is there any way this can be achieved?


text:
Q: $(C_{1}\cup C_{2})^{\perp}=C_{1}^{\perp} \cap C_{2}^{\perp}$, linear code $C_{1}, C_{2}$ Prove $(C_{1} + C_{2})^{\perp}=C_{1}^{\perp} \cap C_{2}^{\perp}$ for any linear code $C_{1}, C_{2}$ over $\mathbb{F}_{q}$ of the same length.
we know $C^{\perp}= \{ x \in \mathbb{F}_{q}^{n}: <x,v>=0 \forall v \in C\}$, o $C^{\perp}=\{aH:a \in \mathbb{F}_{q}^{n-k}\}$ where $H$  the control matrix.

A: Let $x\in (C_1+C_2)^\perp$. Then for each $v\in C_1$ you have that
$\langle x,v\rangle=0$
so $x\in C_1^\perp$ while for each $w\in C^2$ you have
$\langle x,w\rangle =0$
so $x\in C_2^\perp$.
This means that $x\in C_1^\perp\cap C_2^\perp$. Then
$(C_1+C_2)^\perp\subseteq C_1^\perp\cap C_2^\perp$
Let $x\in  C_1^\perp\cap C_2^\perp$ and $w=v_1+v_2\in (C_1+C_2)$ where $v_1\in C_1$ and
$v_2\in C_2$. Then
$\langle x,w\rangle =\langle x, v_1+v_2\rangle =$
$=\langle x,v_1\rangle +\langle x,v_2\rangle=0+0=0$
So $x\in (C_1+C_2)^\perp$ and this means
$C_1^\perp\cap C_2^\perp\subseteq (C_1+C_2)^\perp $


text:
Q: Carregar HTML de outro HTML gostaria de pedir ajuda em carregar dentro do meu arquivo HTML principal arquivos externos de 2 outras páginas em HTML
Abaixo segue o nav

<!DOCTYPE html>

        <meta charset="utf-8">
        <title>Styling links</title>
        <meta name="author" content="Publio Elon">
        <meta name="description" content="Curso de HTML5 e CSS3">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <link rel="stylesheet" href="css/owl.carousel.css">
        <link rel="stylesheet" href="css/owl.theme.default.css">
        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" href="css/animate.css">
        <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

                Home

                Produtos

                Loja

                Serviços

E depois o footer

   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
   <link rel="stylesheet" href="css/main.css">
   <link rel="stylesheet" href="css/animate.css">

Plug seu celular na moda

Atendimento das 10:00 as 10:10 de Segunda-feira à Sábado!

                Informações
                Politicas
                Serviços

                Formas de Pagamento
                Prazo de Troca
                Troca de Películas

                Descontos
                Políticas de Troca
                Manutenção

                Sorteios
                Regulamento de Trocas
                Encomendas

                Fornecedores
                Reembolso
                Atendimento ao Cliente

                  Facebook
                  teste@hotmail.com
                  Whatsapp:(15)xxxx-xxxx
                  Telefone:(15)xxxx-xxxx

              This is a dark alert with an example link. Give it a click if you like.

Eu queria não usar tudo em 1 página de forma direta, mas sim chamar os 2 arquivos dentro de um HTML para compor a minha página HTML, sei que isso é possível em JSP, mas não quero usar JSP...
EDIT: Não esta funcionando por meio de includes
Aqui o código:

        <meta charset="utf-8">
        <title>Styling links</title>
        <meta name="author" content="Publio Elon">
        <meta name="description" content="Curso de HTML5 e CSS3">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <link rel="stylesheet" href="css/owl.carousel.css">
        <link rel="stylesheet" href="css/owl.theme.default.css">
        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" href="css/animate.css">
        <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

fsadasdas

<?php include 'nav.html';?>

<?php include 'footer.html';?>

A: Com HMTL5 você pode usar a tag <object></object>
Ficaria assim:
<object type="text/html" data="include.html"></object>

A: Como vc colocou PHP nas tags da pergunta vou dar uma resposta com essa opção.
A sua página que vai receber esses includes precisa ser um .PHP, porém os arquivos que vc vai chamar pelo include podem ser HTMLs simples. (se vc quiser pode usar o include com outras extensões, só não é possível fazer include de links tipo "https://pt.stackoverflow.com/" a não ser que vc use um "empacotadores de inclusão de URL")
Veja o Exemplo:

<?php include 'nav.html';?>

Welcome to my home page!

Some text.

Some more text.

<?php include 'footer.html';?>

Os arquivos .HTML que vc vai chamar nos includes não precisam de <!DOCTYPE html>   ou  vc pode começar direto pela
 ou
 por exemplo.
Manual PHP do Include: http://php.net/manual/pt_BR/function.include.php

A: Você pode também pode usar o require com esse breve código PHP
<?php
require('seuarquivo.html');
?>


text:
Q: How-to remote display MS Band on PC I would like to show the Microsoft Band display on a PC. For taking screenshots and for presentations. Somewhere I saw a presenter doing this (maybe on Build 2016).
Does a publicly available remote control tool exist?

A: He was probably using the Band Emulator - Tool - Fake Microsoft Band Emulator - http://peted.azurewebsites.net/fake-microsoft-band/ .  I personally use a inexpensive overhead cam for a lot of photos and such, the ipveo ziggi - http://amzn.to/2bX6tKW .


text:
Q: Tangled up in sequences and recurrence relations I took a trip through sequences and recurrence relations and I got tangled up since the documentation didn't help much. I'm sure you can.
Given a sequence
s = {0, 1, 2, 5, 12, 27, 58, 121, 248, 503, 1014, 2037, 4084, 8179,
   16370, 32753};

I'd like to find a recurrence relation for s and try
fr = FindLinearRecurrence[s]

(* Out[150]= {4, -5, 2, 0} *)

Now the question: what does this list of four elements mean? How does the recurrence relation look like? I couldn't find an Explanation in the documentation.
Of course I tried what I would naturally consider the inverse, LinearRecurrence.
But I even did not understand which arguments I had to put into the function.
Ok, I found a recurrence relation, but with another approach, which was a little adventurous.
My question here is: how is this track to be passed correctly?
Here we go
fs = FindSequenceFunction[s]

(* Out[160]= DifferenceRoot[
 Function[{\[FormalY], \[FormalN]}, {2 - \[FormalN] -
     2 \[FormalY][\[FormalN]] + \[FormalY][1 + \[FormalN]] ==
    0, \[FormalY][1] == 0, \[FormalY][2] == 1}]] *)

Here we can spot a recurrence relation together with initial conditions (we also replace [FormalX] by X)
eq = {2 - \[FormalN] -
     2 \[FormalY][\[FormalN]] + \[FormalY][1 + \[FormalN]] ==
    0, \[FormalY][1] == 0, \[FormalY][2] == 1} /. {\[FormalY] ->
    y, \[FormalN] -> n}

(* Out[163]= {2 - n - 2 y[n] + y[1 + n] == 0, y[1] == 0, y[2] == 1} *)

Trying to solve it in the usual way
RSolve[eq, y[n], n]

During evaluation of In[164]:= RSolve::bvnul: For some branches of the
  general solution, the given boundary conditions lead to an empty
  solution. >>

(* Out[164]= {} *)

Again a failure! I'm not very lucky this time ...
Ok, let's RSolve the equation with only one initial condition (as it should be for a difference equation of order 1, I don`t understand the two Initial conditions under DifferenceRoot[] above):
yy[n_] = y[n] /.
   RSolve[2 - n - 2 y[n] + y[1 + n] == 0 && y[1] == 1, y[n], n][[1]] //
  Simplify

(* Out[206]= 1 + 2^(-1 + n) - n *)

This seems to be ok.
Table[yy[n], {n, 1, 16}]

(* Out[210]= {1, 1, 2, 5, 12, 27, 58, 121, 248, 503, 1014, 2037, 4084, 8179, 16370, 32753} *)

Except for the first term it is the case.
I'm sure all this can be done much better and shorter, and I hope you can help.
Regards,
Wolfgang

A: $Version

"10.0 for Mac OS X x86 (64-bit) (September 10, 2014)"

s = {0, 1, 2, 5, 12, 27, 58, 121, 248, 503, 1014, 2037, 4084, 8179, 16370,
   32753};

On my setup, FindLinearRecurrence returns unevaluated with this sequence
 fr = FindLinearRecurrence[s]

FindLinearRecurrence[{0, 1, 2, 5, 12, 27, 58, 121, 248, 503, 1014,
  2037, 4084, 8179, 16370, 32753}]

fs = FindSequenceFunction[s]

Clear[a]

yy[1] = 0;
yy[n_Integer?Positive] = a[n] /. RSolve[{a[n] ==
      2 a[n - 1] + n - 3, a[2] == 1}, a[n], n][[1]]

1/2 (2 + 2^n - 2 n)

Verifying that FindSequenceFunction and RSolve give equivalent results
With[{r = Range[Length[s]]},
 s == fs /@ r == yy /@ r]

True

A: From the details section of ref/FindLinearRecurrence, it says

FindLinearRecurrence gives the shortest kernel ker which reproduces list from LinearRecurrence[ker,init,\[Ellipsis]]. The initial list init comes from the first elements in list.

The key to using LinearRecurrence is that the second argument has to be as long as the first argument (the result from FindLinearRecurrence), e.g.
LinearRecurrence[{4, -5, 2, 0}, {0, 1, 2, 5}, 15]
(*
{0, 1, 2, 5, 12, 27, 58, 121, 248, 503, 1014, 2037, 4084, 8179, 16370}
*)

A: First, the correct interpretation of the output {4, -5, 2, 0} is that your sequence satisfies the recurrence $a_n = 4a_{n-1}-5a_{n-2}+2a_{n-3}+0a_{n-4}$.
It might be confusing as to why the 0 term is there, but the reason is that your fourth term would not follow the rule correctly (which, in all honesty, really means that your first term is ``wrong"). You have an order-three recurrence that has four initial values, but Mathematica's brain, that doesn't make sense, so it makes it order 4. Try something like:
FindLinearRecurrence[Join[Table[7,{i,1,10}],Table[Fibonacci[i],{i,1,100}]]
to see how it might over-complicate this type of recurrence (you ought to get {1,1,0,0,0,...}).
Anyway, anomaly aside, you can reproduce your sequence as:
LinearRecurrence[{4, -5, 2, 0}, {0, 1, 2, 5}, 10]

(* output: {0, 1, 2, 5, 12, 27, 58, 121, 248, 503} *)

Note that this is not the same as:
LinearRecurrence[{4, -5, 2}, {0, 1, 2}, 10]

(* output: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} *)

Note that FindSequenceFunction doesn't give you a linear recurrence -- it has other stuff in it. I'm not sure which one is better for you, but if you truly want the linear recurrence, you should use FindLinearRecurrence.


text:
Q: How to get checkbox count value in treeview on ajax success?
On return JSON Ajax Success we are having treeview Structure Checkbox
  view I need to take the Checkbox count when i click the save button

 @model MedeilMVC_CLOUD.Models.UserView

On submit Button:
$("#btnSubmit").click(function () {
                var ddlRole = $("#RoleID").val();
                alert("RoleID:" + ddlRole);

//Checkbox checked value code:

            });

When i click btnSubmit get checkbox checked Count value

A:

var html = '';
var data = {"DomainUserViews":[{"DomainName":"a","DomainID":"a"},{"DomainName":"b","DomainID":"b"},{"DomainName":"c","DomainID":"c"}],"ModuleUserViews":[{"ModuleID":"a","Url":"a","ModuleName":"a"},{"ModuleID":"b","Url":"b","ModuleName":"b"},{"ModuleID":"c","Url":"c","ModuleName":"c"}]};
$.each(data.DomainUserViews, function (index, item) {
    html += '
' + "<input type='checkbox' id='" + item.DomainID + "' name='DomainUserViews' class='my_chkBox' />" + " " + item.DomainName + ''
    html += '
'
    $.each(data.ModuleUserViews, function (index, item) {
        if (item.ParentModuleID == -1) {
            item.ModuleName = item.ModuleName
        }
        else {
            item.ModuleName = item.ModuleName + " / " + item.Url
        }

        html += '
' + "<input type='checkbox' id='" + item.ModuleID + "' name='ModuleUserViews' class='my_chkBox' />" + " " + item.ModuleName + '
'
     });
     html += '

'
});

if (html != '')
{
    html = '
' + html + '
'
}

$('.dd-list').html(html);

$("#btnSubmitDomain").click(function () {
    var ddlRole = $("#RoleID").val();
    //alert("RoleID:" + ddlRole);
    var elems = $("ul.dd-list > ul > li > a :checkbox:checked");
    var ids=[];
    elems.each(function(index){ids.push($(this).attr("id"));})
    alert("Count : "+elems.length+" IDs : "+ids);
});

$("#btnSubmitModule").click(function () {
    var ddlRole = $("#RoleID").val();
    //alert("RoleID:" + ddlRole);
    var elems = $("ul.dd-list > ul > li > ul :checkbox:checked");
    var ids=[];
    elems.each(function(index){ids.push($(this).attr("id"));})
    alert("Count : "+elems.length+" IDs : "+ids);
});

$("#btnSubmitTotalCount").click(function () {
    var ddlRole = $("#RoleID").val();
    //alert("RoleID:" + ddlRole);
    var elems = $("div#nestable :checkbox:checked");
    var ids=[];
    elems.each(function(index){ids.push($(this).attr("id"));})
    alert("Count : "+elems.length+" IDs : "+ids);
});

<button id="btnSubmitDomain">Get DomainUserViews Count</button>
<button id="btnSubmitModule">Get ModuleUserViews Count</button>
<button id="btnSubmitTotalCount">Get ModuleUserViews Count</button>

Maybe this is what you are looking for. The following gets the count of checked checkboxes. If this is not what you are looking for, just leave a comment. :)
$("div#nestable :checkbox:checked").length;

Edit: Updated a code snippet it alerts the count, on clicking the button. I have used a dummy data to populate the html.

A: Build a simple count function that gets all checkboxes, filters them to only the ones that are checked and then count the total. Example below with jQuery.length.
Edit: If you want to count discreet sets of checkboxes, say from DomainUserViews vs ModuleUserViews, put different classes on those
 elements (instead of just .dd-list alone) and change .dd-list in the snippet below to the class you're targeting.
Edit 2: Updated code example to match the classes in your updated question.

$(document).ready(function(){
  function countDomains(){
    var $checked = $('.DomainUserViews:checked');
    var out = "There are " + $checked.length + " domains checked";
    $('.totalDomains').html(out);
  }

  function countModules(){
    var $checked = $('.ModuleUserViews:checked');
    var out = "There are " + $checked.length + " modules checked";
    $('.totalModules').html(out);
  }

  $("#btnSubmit").click(function () {
    countDomains();
    countModules();
  });
  $("#btnSubmitDomains").click(function () {
    countDomains();
  });
    $("#btnSubmitModules").click(function () {
    countModules();
  });

});

<input type="checkbox" class="DomainUserViews" checked> Domain 1

<input type="checkbox" class="ModuleUserViews" checked>Module 1

<input type="checkbox" class="ModuleUserViews" checked>Module 2

<input type="checkbox" class="ModuleUserViews">Module 3

<input type="checkbox" class="ModuleUserViews" checked>Module 4

<input type="checkbox" class="ModuleUserViews">Module 5

<input type="checkbox" class="DomainUserViews" checked> Domain 2

<input type="checkbox" class="DomainUserViews"> Domain 3

<input type="checkbox" class="ModuleUserViews" checked>Module 1

<input type="checkbox" class="ModuleUserViews" checked>Module 2

<input type="checkbox" class="ModuleUserViews">Module 3

<input type="checkbox" class="ModuleUserViews" checked>Module 4

<input type="checkbox" class="ModuleUserViews">Module 5

<input type="checkbox" class="DomainUserViews" checked> Domain 4

<input type="checkbox" class="DomainUserViews"> Domain 5

<button id="btnSubmitDomains">Count domains</button>
<button id="btnSubmitModules">Count modules</button>
<button id="btnSubmit">Count Both</button>


text:
Q: Is there an easy way to make all text boxes across a WinForms app respond to certain keyboard shortcuts? For instance, I want all my text boxes to respond to Ctrl-A by selecting all text. I see several options:

*

*Add an event handler to all the text boxes that takes care of the keyboard shortcuts

*Subclass TextBox and replace all my text boxes with it

*Create a user control that wraps TextBox and replace all my text boxes with it

However all of these involve changing each and every text box in the app. Is there any sort of thing I could do globally to all text boxes via one action to accomplish this? I kind of doubt it but I thought it wouldn't hurt to ask! (I mean, I suppose now that .NET is open source I could build a custom framework, but that's definitely overkill!)

A: I have a idea about that. The first step is get all controls of a control. Like this method:
public static IEnumerable<Control> GetAllControls(Control container)
{
    List<Control> controlList = new List<Control>();
    foreach (Control c in container.Controls)
    {
        controlList.AddRange(GetAllControls(c));
        controlList.Add(c);
    }
    return controlList;
}

You can improve this method to get just the TextBox's.
So, now you have all the TextBoxes that you want. You can add a event for each, something like that:
foreach( var textBox in textBoxList )
{
    textBox.KeyPress += MeyKeyPressEvento_KeyPress;
}

Or you can put that event int your form and select all TextBoxes.
I hope you can get a mindset with my answer. Good luck

A: Dynamically attach your events when you load your form.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        // iterate all controls on the form
        foreach (Control control in this.Controls)
        {
            if (control is TextBox textBox)
            {
                // attach your event's method
                textBox.KeyDown += OnKeyDown_SelectAllText;
            }
        }
    }

    private void OnKeyDown_SelectAllText(object sender, KeyEventArgs e)
    {
        if (e.Control && e.KeyCode == Keys.A)
        {
            TextBox textBox = (TextBox) sender;
            textBox.SelectAll();
        }
    }

    // be sure to detach all events when done with form
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        foreach (Control control in this.Controls)
        {
            TextBox textBox = control as TextBox;
            if (textBox != null)
            {
                textBox.KeyDown -= OnKeyDown_SelectAllText;
            }
        }
    }
}


text:
Q: Is there a way to designate a specific Haven R label as NA? This question is for the Haven package in R.
Suppose that I have a variable with the following labels:
1 (Agree)
2 (Neutral)
3 (Disagree)
5 (Did not respond)
But the SPSS .sav file I imported into R using haven didn't designate 5 as the missing variable NA.
Because of this, I need to manually designate the variables that have the label option of Did not respond and numeric value of 5 as the missing values. But, I can't just get rid of every 5 in the dataset because other variables have 5 where it's meaningful. I also can't manually list the variables I need to assign 5 as the missing variable because there are thousands of variables in the dataset.
Is there a way to just designate the label Did not respond as the missing value for every variable in the dataset?


text:
Q: How to Duplicate last character using regex My question is how to duplicate last character of each line.
Example:
hello
hello2
hello$$

after replace
helloo
hello22
hello$$$

A: This is to duplicate the last character of each line of yourfile
sed 's/.$/&&/' yourfile


text:
Q: Why does jQuery.fadeTo() scroll my horizontal page to the top (=to the left)? I am running a horizontal website. I have a gallery which shows only one picture. For not having to refresh the whole page when changing the displayed picture, I used jQuery fadeIn, load and fadeOut. This worked nice in Safari, but in Firefox it jumps to the left edge of the page. So I googled the problem, and I tried to give the parent div a fix width & height and position:relative, while the swapped div also got a fix width/height and position:absolute. This didn't work. I found a blogpost where a similar problem was described and the solution shall be to use fadeTo. Now this is my code and it doesn't work either:
$("#gal").fadeTo(200, 0, function () {
    $("#gal").empty().load(galleryimage,false).fadeTo(200, 1);
});

Where is my fault?
Greetings!


text:
Q: Did a movie give the final blow to the usage of the term "negro"? While rewatching the famous movie "Guess Who's Coming to Dinner" I noticed that the term "negro" instead of "black" was often used. The following is a sentence taken from the movie.
From Guess Who's Coming to Dinner:

"He thinks you're gonna faint because he's a Negro".

the following source notes that:

*

*"Negro" is the very dated word for a black person, which quickly died out in the years immediately following the release of this movie.

(www.eslnotes.com)
Also Etymonline suggests that the term was replaced by "black" in the late 1960s.

*

*because of its perceived association with white-imposed attitudes and roles the word was ousted late 1960s in this sense by "Black".

Given the subject of the movie was the  representation of the controversial subject of interracial marriage during the Civil Rights Movement, I guess the terminology in the movie was very carefully chosen. This leads me to think that when the movie was released, the term "negro" was still a "politically correct" one, but for a very short time though.
Given the immediate  popularity and success of the movie, is there evidence that the film itself actually contributed to the change in usage and the emergence of "black" as a more commonly accepted term?

A: According to this article, it is more likely due to the influential work of civil-rights figure Stokely Carmichael:

When did the word Negro become socially unacceptable?
It started its decline in 1966 and was totally uncouth by the mid-1980s. The turning point came when Stokely Carmichael coined the phrase black power at a 1966 rally in Mississippi. Until then, Negro was how most black Americans described themselves. But in Carmichael's speeches and in his landmark 1967 book, Black Power: The Politics of Liberation in America, he persuasively argued that the term implied black inferiority. Among black activists, Negro soon became shorthand for a member of the establishment. Prominent black publications like Ebony switched from Negro to black at the end of the decade, and the masses soon followed. According to a 1968 Newsweek poll, more than two-thirds of black Americans still preferred Negro, but black had become the majority preference by 1974. Both the Associated Press and the New York Times abandoned Negro in the 1970s, and by the mid-1980s, even the most hidebound institutions, like the U.S. Supreme Court, had largely stopped using Negro.

If this timing is accurate, then the frequent use of the term in a movie released in 1967 would not have sounded unusual, it would have simply been a reflection of the time.
It only sounds out of date to our modern ears.
The source is poor (PDF scan), but here is what Carmichael says about the term "Negro" on page 37 of his book Black Power:

Black people must redefine themselves, and only they can do that. Throughout this country, vast segments of the black communities are beginning to recognize the need to assert their own definitions, to reclaim their history, their culture; to create their own sense of community and togetherness. There is a growing resentment of the word "Negro", for example, because this term is the invention of our oppressor; it is his image of us that he describes. Many blacks are now calling themselves African-Americans, Afro-Americans or black people because that is our image of ourselves. When we begin to define our own image, the stereotypes--that is, lies--that our oppressor has developed will begin in the white community and end there. That black community will have a positive image of itself that it has created.

A: There is no one point when Negro stopped being used.
A now-small, mostly elderly, group of Americans still prefers to self-identify as "Negro".
For example Oscar-winning actor Louis Gossett recently (2015) said:

I call myself an American Negro, not an African-American

In fact, in the 2000 census, 56,000 Americans so-preferred the term "Negro" that they refused to state they were "Black or African American" and instead stated they were "some other race" and hand-wrote that they were "Negro".
The Etymonline is wrong to say "ousted late 1960s".
As of April 1970, blacks strongly preferred "Negro" to "Black" as shown by the following Roper Louisville data, as reported by NASA:

Percent of Blacks preferring to be called the following terms (April 1970):
"Negro"  51%
"Colored" 11%
"Black" 8%
"Afro-American" 8%
Other 4%
No difference 16%
No opinion 3%

Among whites "Negro" was marginally (27% to 25%) preferred over "black" in the same poll.
NASA adds in this report, written in 1971:

It is interesting to note that three times as many whites as Negroes seem
to feel that it is better to use the term "black." It was pointed out in
the article on the Louisville study that the term "black" was formerly considered to be the most derogatory of all, and this may be one reason why it
is not appealing to Negroes. In the Louisville study, "black" was not even
preferred by Negro youth. But in the Gallup poll, the sharpest difference
in preference was shown between younger and older Negroes--at least in the
North: among Negro northerners in their twenties, "black" was chosen
either ahead of or equal to the name "Negro." Also in the same poll, the higher-income Negroes preferred "black' more often than those of lower income;
Southerners were less likely to name "black;" and the term "Afro-American"
was not liked at any level, remaining in the 5 to 10 percentile.

The Chicago Tribune used the term "Negro" in headlines up through 1973, perhaps the last time being Negro elected L.A. mayor 30 May 1973.
Some use of the term continued much longer, even though "black" and later "African-American" became preferable.
The US National Institutes of Health said in a 08 January 2015 release titled Racial and Ethnic Categories and Definitions for NIH Diversity Programs and for Other Reporting Purposes:

Terms such as "Haitian" or "Negro" can be used

The US army stopped using the term in 2014 and Census Bureau stopped in 2013 as explained in U.S. Army apologizes, will drop term 'Negro' from policy document (7 November 2014).
The 2010 census gave the below form, which clearly says "Negro", to every family in the US:

The National Association for the Advancement of Colored People (NAACP) opposed changing the name of Negro Bill Canyon as recently as 2012, one of 757 US place-names containing "Negro", the president of the Salt Lake City chapter insisting:

Negro is an acceptable word

The 2010 article Polls Reveal Black Americans' Contradictory Feelings On "Negro" says:

...when the forms for the 2010 Census were released at the beginning of this year, many were surprised to see that one of the choices provided for a person's race is "Black, African Am., or Negro." As if that wasn't perplexing enough, last week it was revealed that during the 2008 presidential campaign, Senate Majority Leader Harry Reid said Barack Obama was electable in part due to the fact that he is "light-skinned" and speaks "with no Negro dialect, unless he wanted to have one."
So how do Black people feel about the word? In one poll, NewsOne/Blackplanet asked members, "Does the word 'Negro' offend you?" 70 percent said no, the word does not offend them, while only 30 percent said yes.
However, in a follow-up poll, we asked, "If a white person called you a negro, would it offend you?" and the responses almost completely switched. 67% said they would be offended, while only 33 percent said they would not.

A: Prior to the 1960s black was an offensive term often used as an adjective as in, "you black something-else-offensive".  Negro (capitalized) was the polite, respectful term.  About this time Negroes became sensitive to the fact that they are more or less intrinsically black.  Thus it was asserted that "black is beautiful" (black not capitalized).  And so it is.


text:
Q: HTML/CSS: link not clickable This is undoubtedly a stupid error, but I am going crazy trying to find it. In the following code for a calendar, links if there is an event and also links for today are not clickable.
Note I have substituted www.google.com for the hyperlink. In the actual app it points to the daily view of calendar.
Would be extremely grateful if someone could spot the error. Thank you.
Links for 2, 3, 4 and 7 work but links for 5, 6 and 8 do not work.
The jsfiddle is here.
Here is the same code as in the fiddle:
CSS:
div.event {
    position:relative;
    vertical-aligh:top;
    z-index:3;
    top:25px;
    text-width: 70px;
}
a.event {
    position:relative;
    vertical-align:top;
    z-index:3;
//  top:-15px;
    text-width: 70px;
}
a.day-number  {
    vertical-align:top;
    background:#999;
    z-index:2;
    top:0px;
    padding:4px;
    color:#fff;
    font-weight:bold;
    width:18px;
    text-align:center;
    float:right;
}
a.theday-number  {
    vertical-align:top;
    background:#999;
    z-index:2;
    top:0px;
    padding:4px;
    color:#fff;
    font-weight:bold;
    width:18px;
    text-align:center;
    float:right;
    background-color:red;
}

HTML:

2

        3

        4

        5
6:00 PM
drinks

            6
Test

            7

            8
6:00 PM
party

A: You need to move the
 and
 tags out of the

 and
 are block-level elements and a  is an inline element, and you can't have a block element inside an inline element.

A: When using position:absolute;and links together, there are issues with z-index. In order for the link to work, add a high z-index value,
For example,
z-index:9999999;

A: Instead of div within a span use other html element. It seems this is the problem. If you remove those divs, elements are clickable..

A: Add a display block to your span inside your td calendar-day and it will work.

A: From what I can tell, you have some elements overlapping one another. Part of the problem is that you are setting width on an inline element (span).
Discussed here on stackOverflow:
CSS - width not honored on span tag
I added the display: inline-block property to your span tags and also added some background color just for contrast here:

http://jsfiddle.net/6YRRF/16/
All your links seem to be working now.
Hope this helps!

A: I see the links are clickable if you remove the  tag which you have placed inside 	. I suggest you add styling inside  instead of using .
Try. It might work :)

A: You can either remove
 tag or provide css(display: inline-block) to
 tag.

A: For those who didn't address their problem out of the answers provided here, check html element or it's parent element to don't have this CSS property:
pointer-events: none;

A: Please remove the span wrap inside td. And Yes! correct your css.


text:
Q: Word JS Api Throws "RichApi.Error: Cannot read property 'ha' of null" on insertFileFromBase64 in OfficeOnline Only When calling insertFileFromBase64 in word online (build 16.0.12719.32656), the following error will be thrown when trying to insert some documents:
Full error object: "RichApi.Error: Cannot read property 'ha' of null
at new c (https://appsforoffice.microsoft.com/lib/1/hosted/word-web-16.00.js:24:293287)
at b.f.processRequestExecutorResponseMessage (https://appsforoffice.microsoft.com/lib/1/hosted/word-web-16.00.js:24:353940)
at https://appsforoffice.microsoft.com/lib/1/hosted/word-web-16.00.js:24:352045".
The actual content of the document is inserted, but any subsequent calls to insertFileFromBase64 throw "The action isn't supported by Word in a browser," and the document content is not inserted.
The same documents can be inserted using the same logic in any word desktop client.
I'm wondering what is different in word online that could cause this error to be thrown, and how it should be handled to prevent future calls from failing to insert document content?
Here is the code I'm using to insert the document:
Word.run(async (context: Word.RequestContext) => {
        const sections = context.document.sections;
        sections.load();
        await context.sync();
        sections.items.forEach(function(section) {
          // Clear the Body.
          section.body.clear();

          // Clear any Headers.
          section.getHeader('Primary').clear();
          section.getHeader('FirstPage').clear();
          section.getHeader('EvenPages').clear();

          // Clear any Footers.
          section.getFooter('Primary').clear();
          section.getFooter('FirstPage').clear();
          section.getFooter('EvenPages').clear();
        });
        await context.sync();
        context.document.body.insertFileFromBase64(base64EncodedDocument, 'Start');
        return context.sync();
      }).catch(e => {
        console.log(e.message);
      });

Here is an example of a document that throws this error when inserted in office online: https://www.dropbox.com/s/k25ppswzxanb7ez/ASP%20clauses%20non%20admin%20test.docx?dl=0
Here is the full e.debugInfo object:
e.debugInfo

A: We don't support all kinds of ContentControls now on WordOnline. And if there's any unsupported ContentControls in document, we will block latter insert file from base64 operations. This is why you can't do subsequent insertFileFromBase64, the error message is an expected one. We may gradually support more ContentControl types but i don't have a clear date yet.
And about the Cannot read property 'ha' of null , it is not right, we'll take a look, but seems so far it doesn't impact latter API calls, and it's not related to the issue why you can't do subsequent insertFileFromBase64, as I described above.
Thanks for reporting the issue to us, and sorry for inconvenience we brought.
Let us know if you have further questions.