Q: Android - TextViews not showing up in ListView I'm having an issue to where none of my TextViews are showing up in the ListView. I'm not sure whether it is an issue with the layout or the java class itself. There are two images here, one of the application running after data had been entered into the database and one of what it is supposed to look like.
Layout for each row of data in ListView

Fragment for the ListView (Delete Button appears but not the TextViews)

row_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="123dp"
        android:layout_height="wrap_content"
        android:id="@+id/resultTeamNumber"
        android:text="Here Number"
        android:textSize="18dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:id="@+id/textPortcullis"
        android:text="Portcullis:"
        android:layout_above="@+id/textChevalFrise"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultPortcullis"
        android:text="Yes/No"
        android:singleLine="false"
        android:layout_below="@+id/resultTeamNumber"
        android:layout_marginLeft="110dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textChevalFrise"
        android:text="Cheval de Frise:"
        android:layout_below="@+id/resultPortcullis"
        android:layout_alignParentStart="true"
        android:singleLine="false" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultChevalFrise"
        android:text="Yes/No"
        android:singleLine="false"
        android:layout_below="@+id/resultPortcullis"
        android:layout_alignStart="@+id/resultPortcullis" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textMoat"
        android:singleLine="false"
        android:layout_below="@+id/textChevalFrise"
        android:layout_alignParentStart="true"
        android:text="Moat:" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultMoat"
        android:text="Yes/No"
        android:singleLine="false"
        android:layout_below="@+id/resultChevalFrise"
        android:layout_alignStart="@+id/resultChevalFrise" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textRamparts"
        android:text="Ramparts:"
        android:singleLine="false"
        android:layout_below="@+id/textMoat"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultRamparts"
        android:text="Yes/No"
        android:singleLine="false"
        android:layout_above="@+id/textDrawbridge"
        android:layout_alignStart="@+id/resultMoat" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textDrawbridge"
        android:text="Drawbridge:"
        android:singleLine="false"
        android:layout_below="@+id/textRamparts"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultDrawbridge"
        android:text="Yes/No"
        android:singleLine="false"
        android:layout_below="@+id/resultRamparts"
        android:layout_alignStart="@+id/resultRamparts" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textSallyPort"
        android:text="Sally Port:"
        android:singleLine="false"
        android:layout_below="@+id/textDrawbridge"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultSallyPort"
        android:singleLine="false"
        android:layout_below="@+id/resultDrawbridge"
        android:layout_alignStart="@+id/resultDrawbridge"
        android:text="Yes/No" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textRockWall"
        android:text="Rock Wall:"
        android:singleLine="false"
        android:layout_alignTop="@+id/resultPortcullis"
        android:layout_toEndOf="@+id/resultPortcullis"
        android:layout_marginStart="34dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultRockWall"
        android:singleLine="false"
        android:text="Yes/No"
        android:layout_marginStart="46dp"
        android:layout_above="@+id/resultRockTerrain"
        android:layout_toEndOf="@+id/textRockTerrain" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textRockTerrain"
        android:text="Rock Terrain:"
        android:singleLine="false"
        android:layout_below="@+id/textRockWall"
        android:layout_alignStart="@+id/textRockWall" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultRockTerrain"
        android:singleLine="false"
        android:text="Yes/No"
        android:layout_alignBottom="@+id/textRockTerrain"
        android:layout_alignStart="@+id/resultRockWall" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textLowBar"
        android:text="Low Bar:"
        android:singleLine="false"
        android:layout_above="@+id/resultRamparts"
        android:layout_alignStart="@+id/textRockTerrain" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/resultLowBar"
        android:singleLine="false"
        android:text="Yes/No"
        android:layout_below="@+id/resultRockTerrain"
        android:layout_alignStart="@+id/resultRockTerrain" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#fff"
        android:background="@color/colorPrimary"
        android:text="Delete"
        android:id="@+id/buttonDelete"
        android:layout_below="@+id/textLowBar"
        android:layout_toEndOf="@+id/textLowBar"
        android:layout_above="@+id/resultSallyPort" />
</RelativeLayout>

ScoutFragment.java
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

/**
 * A simple {@link Fragment} subclass.
 */
public class ScoutFragment extends Fragment {

    FloatingActionButton addDataScout;
    ListView eListScoutInfo;
    SQLiteDatabase sqLiteDatabase;
    DatabaseHelper databaseHelper;
    Cursor cursor;
    ListScoutInfoAdapter listScoutInfoAdapter;

    public ScoutFragment() {
        // Required empty public constructor
    } //End of ScoutFragment

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_scout, null, false);
        view.setBackgroundColor(Color.WHITE);
        eListScoutInfo = (ListView) view.findViewById(R.id.listScoutInfo);
        listScoutInfoAdapter = new ListScoutInfoAdapter(getActivity().getApplicationContext(), R.layout.row_layout);
        eListScoutInfo.setAdapter(listScoutInfoAdapter);
        databaseHelper = new DatabaseHelper(getActivity().getApplicationContext());
        sqLiteDatabase = databaseHelper.getReadableDatabase();
        cursor = databaseHelper.getInformation(sqLiteDatabase);

        //Checks if information is available in cursor
        if(cursor.moveToFirst()){
            do {
                //Declare all strings
                String teamNumber, portcullis, chevalFrise, moat, ramparts, drawbridge, sallyPort, rockWall, rockTerrain, lowBar;

                //Get strings from cursor
                teamNumber = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_NUMBER));
                portcullis =  cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_PORTCULLIS));
                chevalFrise = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_CHEVAL_FRISE));
                moat = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_MOAT));
                ramparts = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_RAMPARTS));
                drawbridge = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_DRAWBRIDGE));
                sallyPort = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_SALLY_PORT));
                rockWall = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_ROCK_WALL));
                rockTerrain = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_ROCK_TERRAIN));
                lowBar = cursor.getString(cursor.getColumnIndex(DatabaseContract.NewDataInfo.COL_LOW_BAR));

                //Get methods from DatabaseProvider
                DatabaseProvider databaseProvider = new DatabaseProvider(teamNumber, portcullis, chevalFrise, moat, ramparts,
                        drawbridge, sallyPort, rockWall, rockTerrain, lowBar);

                //Pass objects to add method
                listScoutInfoAdapter.add(databaseProvider);
                listScoutInfoAdapter.notifyDataSetChanged();
            } while (cursor.moveToNext());
        } //End of if statement

        //Setups Floating Action Button
        addDataScout = (FloatingActionButton) view.findViewById(R.id.fab);
        addDataScout.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                AddScoutDataFragment fragment = new AddScoutDataFragment();
                FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
                fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right);
                fragmentTransaction.replace(R.id.fragment_container, fragment);
                fragmentTransaction.commit();
            } //End of onClick
        }); //End of setOnClickListener
        return view;
    } //End of onCreateView
} //End of class

I don't believe the issue is with database showing the data because some of the TextViews in the ListView don't even use the data from inside the database.

A: It is theme issue on your end,probably textcolor set to white in your theme change these
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>

change it to black

A: your row_layout.xml file textview in set textcolor:
 <TextView
    android:layout_width="123dp"
    android:layout_height="wrap_content"
    android:id="@+id/resultTeamNumber"
    android:text="Here Number"
    android:textSize="18dp"
    android:layout_alignParentTop="true"
    android:layout_alignParentStart="true"
    android:textColor="@android:color/black"

/>

A: set your adapter upon listview in the last..............


Q: How to Append radio buttons to dynamic html table I have an ajax call that returns a sql query result and parses it into an html table. See below:
function CreateTableFromJSON() {
  var email = "<?php echo $user_email; ?>";
  console.log(email);
  $.ajax({
    type: 'POST',
    url: 'api.php',
    data:{
      //format:'json'
      //data:$.param({
        'userEmail': email
    },
    dataType: 'json',
    success: function(data) {
      console.log(data);
      console.log("success");

      // EXTRACT VALUE FOR HTML HEADER.
      var col = [];
      for (var i = 0; i < data.length; i++) {
        for (var key in data[i]) {
          if (col.indexOf(key) === -1) {
            col.push(key);
          }
        }
      }

      // CREATE DYNAMIC TABLE.
      var table = document.getElementById('excel_tablebody2');
      var tr = table.insertRow(-1); // TABLE ROW.

      //for (var i = 0; i < col.length; i++) {
      //  var th = document.createElement("th"); // TABLE HEADER.
      //  th.innerHTML = col[i];
      //  tr.appendChild(th);
      //}

      // ADD JSON DATA TO THE TABLE AS data.
      for (var i = 0; i < data.length; i++) {
        tr = table.insertRow(-1);

        for (var j = 0; j < col.length; j++) {
          var tabCell = tr.insertCell(-1);
          tabCell.innerHTML = data[i][col[j]];
        }
      }

      // FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER.
      var divContainer = document.getElementById("excel_table2");
      divContainer.appendChild(table);
    },
    error: function(error) {
      console.log(error);
      console.log("CreateTableFromJSON did not work.....");
    }
  });
};

I'd like to append radio buttons to the table. Specifically how can I do this for dynamic tables (undefined number of rows and or columns)?
In addition the radio button would need to relate to a specific tr as it will need to be used to send data back for that tr
The goal is to return the table based on some criteria (user email).
The table will contain data that needs to be verified using the radio buttons. Yes/No button and then sent back.
Edit
I'll add I'm unsure how to approach my overall goal.
Is it best to allow the user to update the each row by using the radio button and once done submit it all back to the server. OR have each radio button fire an individual 'update' back to the server as you progress. Live update vs bulk update?


Q: Trouble in installing Font::TTF module I failed to install the module through cpan Font::TTF.
I'm on strawberry perl 5.24, windows 8 32bit.
C:\Users\user>cpan
Loading internal null logger. Install Log::Log4perl for logging messages

There seems to be running another CPAN process (pid 5860).  Contacting...
Other job not responding. Shall I overwrite the lockfile 'C:\STRAWB~1\cpan\.lock
'? (Y/n) [y]

cpan shell -- CPAN exploration and modules installation (v2.11)
Enter 'h' for help.

cpan> o conf build_dir_reuse 0
    build_dir_reuse    [0]
commit: wrote 'C:\Strawberry\perl\lib/CPAN/Config.pm'

cpan> o conf commit
commit: wrote 'C:\Strawberry\perl\lib/CPAN/Config.pm'

cpan> exit
Lockfile removed.

C:\Users\user>cpan Font::TTF
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: CPAN::SQLite loaded ok (v0.211)
Database was generated on Fri, 15 Jul 2016 06:47:48 GMT

Running install for module 'Font::TTF'
CPAN: Digest::SHA loaded ok (v5.95)
CPAN: Compress::Zlib loaded ok (v2.069)
Checksum for C:\STRAWB~1\cpan\sources\authors\id\M\MH\MHOSKEN\Font-TTF-  1.05.tar.
gz ok
CPAN: Archive::Tar loaded ok (v2.06)
CPAN: File::Temp loaded ok (v0.2304)
CPAN: YAML::XS loaded ok (v0.62)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v1.4417)
CPAN: CPAN::Meta loaded ok (v2.150005)
CPAN: Module::CoreList loaded ok (v5.20160507)
Configuring M/MH/MHOSKEN/Font-TTF-1.05.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for Font::TTF
Writing MYMETA.yml and MYMETA.json
  MHOSKEN/Font-TTF-1.05.tar.gz
  C:\Strawberry\perl\bin\perl.exe Makefile.PL -- OK
Running make for M/MH/MHOSKEN/Font-TTF-1.05.tar.gz
  MHOSKEN/Font-TTF-1.05.tar.gz
  C:\STRAWB~1\c\bin\dmake.exe -- OK
Running make test
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness"   "-
e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')"   t/
*.t
t/tags.t ..... Can't locate Font/TTF/OTTags.pm in @INC (you may need to   install
the Font::TTF::OTTags module) (@INC contains: C:\STRAWB~1\cpan\build\Font-TTF-1.
05-8DWSyh\blib\lib C:\STRAWB~1\cpan\build\Font-TTF-1.05-8DWSyh\blib\arch  C:/Stra
wberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at
t/tags.t line 5.
BEGIN failed--compilation aborted at t/tags.t line 5.
t/tags.t ..... Dubious, test returned 2 (wstat 512, 0x200)
Failed 6/6 subtests
t/ttfcopy.t .. Can't locate Font/TTF/Font.pm in @INC (you may need to install th
e Font::TTF::Font module) (@INC contains: C:\STRAWB~1\cpan\build\Font-TTF-  1.05-8
DWSyh\blib\lib C:\STRAWB~1\cpan\build\Font-TTF-1.05-8DWSyh\blib\arch C:/Strawber
ry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib .) at t/tt
fcopy.t line 5.
BEGIN failed--compilation aborted at t/ttfcopy.t line 5.
t/ttfcopy.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 4/4 subtests

Test Summary Report
-------------------
t/tags.t   (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 6 tests but ran 0.
t/ttfcopy.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 4 tests but ran 0.
Files=2, Tests=0,  1 wallclock secs ( 0.05 usr +  0.00 sys =  0.05 CPU)
Result: FAIL
Failed 2/2 test programs. 0/0 subtests failed.
dmake.exe:  Error code 130, while making 'test_dynamic'
  MHOSKEN/Font-TTF-1.05.tar.gz
  C:\STRAWB~1\c\bin\dmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports MHOSKEN/Font-TTF-1.05.tar.gz
Stopping: 'install' failed for 'Font::TTF'.

C:\Users\user>

A: Jiang Bo, I was also getting the same problem with the latest Strawberry Perl version (5.24.0.1). I downgraded to 5.20.3.3 / 64bit and cpan installations work fine there.


Q: Dynamically executed ARM ASM syscall with relocations from C++ I would like to call ARM/ARM64 ASM code from C++. ASM code contains syscall and a relocation to external function.
ARM architecture here is not so important, I just want to understand how to solve my problem conceptually.
I have following ASM syscall (output from objdump -d) which is called inside shared library:
 198:   d28009e8    mov x8, #0x4f                   // #79
 19c:   d4000001    svc #0x0
 1a0:   b140041f    cmn x0, #0x1, lsl #12
 1a4:   da809400    cneg    x0, x0, hi
 1a8:   54000008    b.hi    0 <__set_errno_internal>
 1ac:   d65f03c0    ret

This piece of code calls fstatat64 syscall and sets errno through external __set_errno_internal function.
readelf -r shows following relocation for __set_errno_internal function:
00000000000001a8 R_AARCH64_CONDBR19  __set_errno_internal

I want to call this piece of code from C++, so I converted it to buffer:
  unsigned char machine_code[] __attribute__((section(".text"))) =
        "\xe8\x09\x80\xd2"
        "\x01\x00\x00\xd4"
        "\x1f\x04\x40\xb1"
        "\x00\x94\x80\xda"
        "\x08\x00\x00\x54"   // Here we have mentioned relocation
        "\xc0\x03\x5f\xd6";

EDIT: Important detail - I chose to use buffer (not inline assembly etc) because I want to run extra processing on this buffer (for example decryption function on string literal as a software protection mechanism but that's not important here) before it gets evaluated as machine code.
Afterwards, buffer can be cast to function and called directly to execute machine code. Obviously there is a problem with relocation, it's not fixed automatically and I have to fix it manually. But during run-time I can't do it because .text section is read-only & executable.
Although I have almost full control over source code I must not turn off stack protection & other features to make that section writable (don't ask why). So it seems that relocation fix should be performed during link stage somehow. As far as I know shared library contains relative offsets (for similar external function calls) after relocations are fixed by linker and binary *.so file should contain correct offsets (without need of run-time relocation work), so fixing that machine_code buffer during linking should be possible.
I'm using manually built Clang 7 compiler and I have full control over LLVM passes so I thought maybe it's possible to write some kind of LLVM pass which executes during link time. Though it looks like ld is called in the end so maybe LLVM passes will not help here (not an expert here).
Different ideas would be appreciated also.
As you can see problem is pretty complicated. Maybe you have some directions/ideas how to solve this? Thanks!

A: There's already a working, packaged mechanism to handle relocations. It's called dlsym().  While it doesn't directly give you a function pointer, all major C++ compilers support reinterpret_casting the result of dlsym to any ordinary function pointer. (Member functions are another issue altogether, but that's not relevant here)


Q: error: bind message supplies 1 parameters, but prepared statement "" requires 0 I have a table 'article' with column 'content' .I want to query Postgresql in order to search for a string contained in variable 'temp'.This query works fine-
pool.query("select * from article where upper(content) like upper('%some_value%')");

But when I use placeholder $1 and [temp] in place of some_value , I get the above error -
pool.query("select * from article where upper(content) LIKE upper('%$1%')",[temp] );

Note - Here $1 is a placeholder and should be replaced by the value in [temp] , but it treats '%$1%' as a string , I guess. Without the quotes ' ' , the LIKE operator doesn't work. I have also tried the query -
pool.query("select * from article where upper(content) LIKE upper(concat('%',$1,'%'))",[temp] );

to ensure $1 is not treated as a string literal but it gives the error -
    error: could not determine data type of parameter $1

A: pool.query(
  "select * from article where upper(content) LIKE upper('%' || $1 || '%')",
  [temp]
).then( res => {console.log(res)}, err => {console.error(err)})

This works for me. I just looked at this Postgres doc page to try and understand what concat was doing to the parameter notation. Can't say that I understand the difference between using || operators and using concat string function at this time.

A: The easiest way I found to do this is like the following:
// You can remove [0] from character[0] if you want the complete value of character.
  database.query(`
    SELECT * FROM users
    WHERE LOWER(users.name) LIKE LOWER($1)
    ORDER BY users.id ASC`,
    ["%" + character[0] + "%"]
  );

// [%${character}%] string literal alternative to the last line in the function call.

There are several things going on here, so let me break each line it down.

*

*SELECT * FROM users

*

*This is selecting all the columns associated with table users

*WHERE LOWER(users.name) LIKE $1

*

*This is filtering out all the results from the first line so that where the name(lowercased) column of the users table is like the parameter $1.

*ORDER BY users.id ASC

*

*This is optional, but I like to include it because I want the data returned to me to be in ascending order (that is from 0 to infinity, or starting low and going high) based on the users.id or the id column of the users table. A popular alternative for client-side data presentation is users.created_at DESC which shows the latest user (or more than likely an article/post/comment) by its creation date in reverse order so you get the newest content at the top of the array to loop through and display on the client-side.

*["%" + character + "%"]

*

*This part is the second argument in the .query method call from the database object (or client if you kept with that name, you can name it what you want, and database to me makes for more a sensical read than "client", but that is just my personal opinion, and it's highly possible that "client" may be the more technically correct term to use).
The second argument needs to be an array of values. It takes the place of the parameters inserted in the query string, for example, $1 or ? are examples of parameter placeholders which are filled in with a value in the 2nd argument's array of values. In this case, I used JavaScript's built-in string concatenation to provide a "includes" like pattern, or in plain-broken English, "find me columns that contain a 'this' value" where name(lowercased) is the column and character is the parameter variable value. I am pulling in the parameter value for the character variable from req.params (the URL, so http://localhost:3000/users/startsWith/t), so combining that with % on both ends of the parameter, it returns me all the values that contain the letter t since is the first (and only) character here in the URL.

I know this is a VERY late response, but I wanted to respond with a more thorough answer in case anyone else needed it broken down further.

A: In my case :
My variable was $1, instead of ?1 ...
I was customizing my query with @Query


Q: Errors only when running shiny application on server - debug I have written a small application in shiny. I have the following files:
global.R, server.R and ui.R
In the global.R file, I load my data. I read data from three different csv files.
a.csv, b.csv and c.csv and I use merge to join a.csv and b.csv and another merge to join a.csv and c.csv
In the ui.R file, I have the layout for some filters. In the shinydashboard, I have tabItems, tabPanels containing selectInput and sliderInput for the filters.
In the server.R file, I have the implementation. One functionality is that based on the filters, I show a table with some values. If the user selects a row, I activate another tab with more details on the selected row (eg, graphs, tables etc related to the selected row)
This whole thing works perfectly when I run it on my machine using RStudio. When I move the code to the shiny server, I get the first tab layout, the functionality to activate second tab on selection all working. However in the second tab, I cannot see the table, and I get an error for the graphs.
Error: 'from' cannot be NA, NaN or infinite.
I have no clue why I cannot see any data on the tab when I run the application on the server. I suspect maybe there is some problem in the merge. I want to debug and find the problem. I wanted to know how I can debug since I run this on the server using a web browser and all I can see on the browser is a line Error: 'from' cannot be NA, NaN or infinite and blank table.
Can someone give some inputs on debugging to find the problem. Thanks

A: I was able to figure out the problem. The problem was with the package version of DT on the server. The package version of DT on the server was 0.1 and that version has some bugs (based on this post: https://github.com/rstudio/DT/issues/206)
I was able to get the package version updated to 0.2 and all worked fine.
The problem was with using input$table_rows_selected with the old version of DT package with selection = 'single' as a parameter. Moving to 0.2 version of DT package resolved the problem.


Q: Detect click when the allow Button in the notification alert permission is tapped
I'm developing this iOS app with SwiftUI.
How I can detect when the user clicks the allow button of the Notification permission alert? It should happen only one time and I need to take the user to a specific tab the first time he tapped the button. Is this possible?

A: you can add the attribute onclick="location.href='https://google.com';".
but could you post codesnippets? and do you use javascript and php?

A: I found a solution. To create this behaviour, I simply saved in a UserDefault a Bool value.
 func registerForPushNotifications() {
    UNUserNotificationCenter.current()
        .requestAuthorization(options: [.alert, .sound, .badge]) { [weak self] granted, _ in
            print("Permission granted: \(granted)")

            self?.userDefault.set(granted, forKey: "notificationGranted")

            guard granted else {
                return
            }

            self?.getNotificationSettings()
        }
}

      func getNotificationSettings() {
    UNUserNotificationCenter.current().getNotificationSettings { settings in
        print("Notification settings: \(settings)")

        guard settings.authorizationStatus == .authorized else {
            return
        }
        // Saving the value to permit to take the user to the Notification screen only the first time
        if (self.userDefault.value(forKey: "permissionPopUpIsShowed") == nil) {
            self.userDefault.set(true, forKey: "permissionPopUpIsShowed")
        }

        DispatchQueue.main.async {
            UIApplication.shared.registerForRemoteNotifications()
        }
    }
}

In the Content View inside the onAppear method you can do this:
                        if appDelegate.userDefault.bool(forKey: "permissionPopUpIsShowed") == true && appDelegate.userDefault.bool(forKey: "notificationGranted") == true {
                        tabSelection = .notifications
                        appDelegate.userDefault.set(false, forKey: "permissionPopUpIsShowed")
                    }

In this way you will be able to select a new view (through the tabSelection) and obtain this behaviour only once (when the notification permission popUp is showed).


Q: Python destroying content to save memory I have a class to get a webpage's html and do some things with it
import requests

class A(object):
    def __init__(self, url):
        self.r = requests.get(url)
        self.html = self.r.text
        #other things

class B(A):
    def __init__(self,url):
        super(B,self).__init__(url)
        #other things

I am going to instantiate this class hundreds of thousands of times, like so
for url in many_urls:
    page = B(url)
    #other things

how can I make sure that the content like page.html and other attributes get deleted and aren't kept in memory to slow it down?

A: The html will be held in memory for as long as the object that references it exists.
If your for loop does not assign the B object to any other variable, then each time you re-assign page the previously created B object will become eligible for garbage collection, and the html will be removed from memory at the same time.
If you are retaining references to each of your B objects you will slowly fill up your memory, but if you allow them to be garbage collected you should be fine.

A: You can use del page or page = None, both statements release the content for garbage collection. This makes sense if your for-loop kernel is memory critical or you are using object that bring their own memory management (like numpy.ndarray).
Also note that variables "bleed" out of the scope of for-loops. That means that the page from the last iteration will be present until the current scope is terminated (usually at the end of the function/method).


Q: Algorithm prints length of string rather than number of Cs and Gs in it I am new to Java and currently learning it in a 4 week course. I am working on on an assignment to find all of the Cs and Gs in a string named dna, and then divide the number of Cs and Gs by dna. I have written a small program, and it compiles with no syntax errors, but when I run it, all that is printed out is the length of dna and then 1(The output of the dividing part).
My code:
public static void cgRatio (String dna) {
    int counter = 0; // counts how many Cs and Gs
    int index = 0; // start looking from index 0
    while (dna.indexOf("C") != -1 && counter != dna.length()) { // while dna is not finished and you can find C in dna
        index = dna.indexOf("C", index); // Start looking from last index
        if (index != -1) {
            counter++;
        }
        else {
            break;
        }
    }
    System.out.println("Number of C in dna: " + counter);

    System.out.println("Gene cg ratio: " + (counter / dna.length()));
}

If anyone can help that would be great and appreciated, thanks!

A: The problem is that the second argument to indexOf is the first index in the string that it searches.

Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.

Once it finds the first "C", it will then continue to always find that same "C" in the first index it looks in. You need to change your code to this:
index = dna.indexOf("C", index + 1);

To start from the first character after the "C" that you already found. You should also change the initial index to -1 so that it starts from the first character.

A: There are a few problems with your code:

*

*It uses counter as the number of cs in your dna string when it is really equal to dna.length(). This causes the ratio to be 1 if there are any cs at all, or 0 if there are none.

*There should be a variable that keeps track of how many cs there are in the string and how many gs there are (as seen in the above bullet, counter cannot be used for this.)

*As resueman said, this line:
index = dna.indexOf("C", index); should be changed to: index = dna.indexOf("C", index + 1);, or else the index will remain the same (it will always be equal to the index of the first c in the string.)

*A while loop really is not all that well suited to this kind of thing; instead, a for loop should be used.

*The ratio should be a double, not an int since doubles have more precision (they can be decimals.)

Here's code I came up with that works:
public static void cratio(String dna) {
    int c = 0;
    int g = 0;
    for(int i =0; i < dna.length(); i++) {
        if((dna.charAt(i) == 'c') || (dna.charAt(i) == 'C')) c++;
        if((dna.charAt(i) == 'g') || (dna.charAt(i) == 'G')) g++;
    }
    System.out.println("Number of 'C's in DNA: " + c + " and number of 'G's in DNA: " + g);
    int length = dna.length();
    double ratio = (double) (c+g)/length * 100;
    System.out.println("The ratio of 'C's and 'G's to the length of the DNA chain is: " + ratio + "%.");
}

If you have any questions, just let me know!


Q: iOS Take or Select Photo The camera app on iOS allows one to take a photo, but also has the button to the left that allows one to browse the photo album.
When using the UIImagePickerController I can only tell them to either do one or the other.
So, rather than making a custom camera view, or even a custom overlay to add these abilities, I'll ask if there isn't some sort of flag I'm missing to allow this use case.

A: When invoking it, you choose which one you want. There isn't a way to get exactly the same functionality as the camera app unless you, as you said, make a custom view for it. But wherever you want to invoke this, you could provide the options for either choosing a photo or taking one at that point.
You'll notice other apps that either let you take a photo or choose one from your library give you those as separate options within their UI.


Q: parity bit and error detection I have faced that in my computer architecture course at university.
I can't understand the parity bit; Why it has two kinds of even and odd.
Can anyone give me clear explain about parity codes?

A: A 'parity bit' is a method of error checking. Imagine that you need to send 8 bits over a connection and determine whether they got through right. You could try sending it twice, that way if there is an error, the receiver will know because the two messages differ. However, this requires two times the bandwidth, which is too much. So often every byte (8 bits) will also have a parity bit. You count up the number of ones in the byte. If it is odd, the parity bit is one. If it is even, the parity bit is zero. That way if there is any single error the receiver will know and only one eighth the extra bandwidth is needed. Examples:
Data: 01001001  3 ones, parity bit 1
Data: 00110101  4 ones, parity bit 0

If receiver gets 00111101 and parity bit 0, it will know that there is some corruption.
Of course if there are two errors in the same byte there will be no way to detect this - example if original is 00000001 and received is 00000010 - but this is considered to be rare enough to not worry for most applications.

A: The first sentence of the Wikipedia article is clear enough, and so is the second paragraph... But ohwell.
Given a word of n bits, with n-1 bits to check parity on and 1 bit of parity, the parity bit will be set to:

*

*1 if the number of bits set to 1 is odd, 0 otherwise (even parity);

*0 if the number of bits set to 1 is even, 1 otherwise (odd parity).

Example: 1101011x where x is the parity bit. There are 5 bits set to 1, therefore an odd number: x will be set to 1 (even parity) or 0 (odd parity).


Q: Coldfusion counting based on patterns matching I am reading numbers off a database and create a 4 digits patterns such as:
1, 2, 2, 1
0, 2, 2, 2
4, 0, 2, 0
1, 2, 2, 1
2, 1, 1, 2

Each digit can only be from 0-6. The second step is where my problem is.  I need to tally each pattern.  For example, pattern 1,2,2,1 has a tally of 2 because it appears twice and the other patterns appear only once each.
At the end output, I need to be able to display each unique pattern with the count such as:
1, 2, 2, 1 - 2
0, 2, 2, 2 - 1
4, 0, 2, 0 - 1
2, 1, 1, 2 - 1

I was thinking of using a 2-dimensional array. Where
combinations[1][1]="1, 2, 2, 1" (the pattern)
combinations[1][2]=2 (the count)
combinations[2][1]="0, 2, 2, 2"
combinations[2][2]=1
etc.

How can I actually create the array dynamically while matching the pattern? i.e. if the pattern is not yet found add to the array.  If it is found, add to the count.  I have tried this:
<cfloop index="i" from="1" to="#ArrayLen(combinations)#">
    <cfif not arrayFind(combinations[i][1],"#patterns#")>
        <cfset arrayAppend(combinations,["#patterns#",1]) >
    <cfelse>
        <cfset combinations[i][2] = combinations[i][2] + 1>
    </cfif>
</cfloop>

But I am getting the error on the ArrayFind:
Object of type class java.lang.String cannot be used as an array

Any help is appreciated.  Thank you in advance.

A: Solved my own question.  Looks like I used the wrong function. This works:
<cfloop index="i" from="1" to="#ArrayLen(combinations)#">
    <cfif Find(combinations[i][1],"#patterns#")>
        <cfset combinations[i][2] = combinations[i][2] + 1>
        <cfset found = 1>
    </cfif>
</cfloop>
<cfif not found>
    <cfset arrayAppend(combinations,["#patterns#",1]) >
</cfif>

A: Instead of using a 2-dimensional array, you could also use a structure instead, in which the keys are the patterns and the values the counts. That naturally avoids duplicates because the keys of a structure can only exist once.
The code for creating the structure would look something like this:
<cfset combinations = {}>
<cfloop query="#dbresults#">
  <cfif not structKeyExists(combinations, dbresults.pattern)>
    <cfset combinations[dbresults.pattern] = 1>
  <cfelse>
    <cfset combinations[dbresults.pattern]++>
  </cfif>
</cfloop>

In the end you just have to loop over the structure to output the counts:
<cfloop collection="#combinations#" item="pattern">
  <cfoutput><p>#pattern# - #combinations[pattern]#</p></cfoutput>
</cfloop>


Q: Amazon ELB and Apache trailing slash issue Actually I've an amazon ELB configured ONLY with rule HTTPS 443 --> HTTP 80.  I cannot open the HTTP (port 80) on ELB for contract reasons.
I see that for all client requests in https without training slash the apache for some unknown reasons redirect it in http with training slash:
https://host/site  --> redirect to http://host/site/ (doesn't work)
I see different questions about this problem and seems that all people solve opening HTTP on ELB (it add some header informations as well as X-Forwarded-Proto "https")
And they apply these Rewrite rules:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

to get it working behind an AWS Elastic Load Balancer.
For me this automatic apache redirect when is missing the trailing slash on the the URL is not clear (for my understanding apache when see an URL without trailing slash that point to a dir, redirect it adding trailing slash)
Is there an alternative way to solve this problem WITHOUT open HTTP on Amazon ELB?


Q: vb combo box selected item to open in individual form Am actually new in vb and trying to learn it, i have a combo box of 13 collections and a button, i want whenever a user selects an option from the combo box and clicks the button, it should open in an individual form. but the problem is whenever the user clicks on an option, all the 13 forms will open.
please help
here is my code
 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    ComboBox1.SelectedValue = "1"
    Form2.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "2"
    Form3.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "3"
    Form4.Show()
    ComboBox1.SelectedValue = "4"
    Form3.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "5"
    Form5.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "6"
    Form6.Show()
    ComboBox1.SelectedValue = "7"
    Form7.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "8"
    Form8.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "9"
    Form9.Show()
    ComboBox1.SelectedValue = "10"
    Form9.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "11"
    Form10.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "12"
    Form11.Show()
    Me.Hide()
    ComboBox1.SelectedItem = "13"
    Form12.Show()
    Me.Hide()
End Sub

A: Based upon what you are trying to do,
And what the other members advised you already,
It sounds like you did not correctly format your if...then and/or your select...case  statements.
The code below should do what you are trying to do.
We use the SELECTINDEX property to find out which index element in the drop down is selected at present.
Additionally, The code below can be affected (affected so it does not work) by any code in the combobox/dropdown object's event procedures if you have any of them setup.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    '
    Select Case Combobox1.SelectedIndex
        Case 1
            Form2.Show()
            Me.Hide()
        Case 1, 4
            Form3.Show()
            Me.Hide()
        Case 3
            Form4.Show()
            Me.Hide()
        Case 5
            Form5.Show()
            Me.Hide()
        Case 6
            Form6.Show()
            Me.Hide()
        Case 7
            Form7.Show()
            Me.Hide()
        Case 8
            Form8.Show()
            Me.Hide()
        Case 9, 10
            Form9.Show()
            Me.Hide()
        Case 11
            Form10.Show()
            Me.Hide()
        Case 12
            Form11.Show()
            Me.Hide()
        Case 13
            Form12.Show()
            Me.Hide()
    End Select
'
End Sub

A: *

*Combo box to open Form

*Add & Name Combo Box SelectFormsEdit

*Go to Property Sheet, Data Tab, Edit Row Source, SQL:

SELECT MsysObjects.Name
FROM MsysObjects
WHERE (((MsysObjects.Type)=-32768));

*Event Tab, After Update, ... Code Builder:

Private Sub SelectFormsEdit_AfterUpdate()
    DoCmd.OpenForm SelectFormsEdit, , , , acFormEdit
End Sub

*Save everything


Q: Is it possible to get url of clicked link in WebEngineView? I've noticed that in Qt version 5.4, WebView has a signal named navigationRequired, which had a clicked URL in parameters. In the new WebView and WebEngineView, there is no such signal. I also haven't found any alternatives.
Is there any way to get a clicked link's URL in Qt 5.6?

A: Reimplement the method acceptNavigationRequest of QWebEnginePage :
class MyQWebEnginePage : public QWebEnginePage
{
    Q_OBJECT

public:
    MyQWebEnginePage(QObject* parent = 0) : QWebEnginePage(parent){}

    bool acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool)
    {
        if (type == QWebEnginePage::NavigationTypeLinkClicked)
        {
            // retrieve the url here
            return false;
        }
        return true;
    }
};


Q: Component not being unmounted I am trying to write a React mixin that creates a few keybindings to easily scroll list views, however, I have problems with removing the event listeners after the component has been removed from the DOM
Mixin:
componentDidMount: function() {
    var requiredFunction = Object.getPrototypeOf(this).keyedList;
    if (!_.isFunction(requiredFunction)) {
      console.log('[KeyedListMixin] You must define the keyedList() function');
    }

    $(document).on('keydown', this.__handleKeyDown);
  },

  componentDidUnMount: function() {
    $(document).off('keydown', this.__handleKeyDown);
  },

render:
if (showNewCommentWindow) {
      centeredWindow   = (
        <FixedView>
          <div className='new-comment-window'>
            <NewResourceWindow
              listObjects       = {searchResults}
              onSearchItemClick = {this._handleSearchItemClick}
              handleOnChange    = {this._handleSearchChange}
              />
          </div>
        </FixedView>
      )
    }
return (
   ....
   {centeredWindow}
   ....

But once showNewCommentWindow is false, and as a result, the FixedView doesn't get rendered, the component don't unmount for some reason.

A: The lifecycle method isn't called componentDidUnMount, it's called componentWillUnmount. Two important differences where the casing is Unmount and not UnMount and that it's Will and not Did. If it was called componentDidUnmount the component would have already been unmounted and the reference to the DOM node would have been released. So you clean up any DOM related things in componentWillUnmount just before the component is unmounted.


Q: Implementing Word2Vec for stemming/lemmatizing Turkish I'm working on building a stemming programm for Turkish which is a morphologically rich language. None of the ressources that I've found are accurate enough for my purpose and I don't think they are built on deep learning technology.
How could I use word embeddings to train a stemmer/lemmatizer? What are the main steps I should be considering?


Q: Predictability of Pseudo Random Generators by Quantum computers May classical pseudo random generators be predictable by powerful quantum computers in the future or is it proven that this is not possible?
If they are predictable, do scientists know whether there exist PRGs that are unpredictable by quantum computers?

A: The security of a classical Cryptographic Pseudo-Random Number Generator (CPRNG) is always based on some hardness assumption, such as "factoring is hard" or "colliding the SHA-256 function is hard".
Quantum computers make some computational problems easier. That violates some of the old hardness assumptions. But not all of them.
For example, blum blum shub is likely broken by quantum computers, but no one knows how to break lattice-based cryptography with quantum computers. Showing you can break all classical CPRNGs with quantum computers is tantamount to showing that BQP=NP, which is not expected to be the case.
Even if quantum computers did break all classical CPRNGs, they happen to also fill that hole. They enable the creation of "Einstein-certified" random numbers.


Q: cannot uninstall node and npm completely on high sierra I recently installed Node on my MacBook running High Sierra 10.13 using the .pkg file supplied on their website.
After a few hours of experimenting with installing other packages and writing scripts, I decided I would like to uninstall both Node and NPM to get a fresh start.
I tried all of the top answers from this thread, but to my dismay, after having followed all instructions, and repeated all steps many times, terminal would still recognise the Node and NPM versions.
I ended up running a bash script through terminal which I found on the same thread, which ended up doing nothing but downgrading my current version of Node to 0.10.8 - making it a lot more difficult to delete in the long run.
I've re-done all of the steps from the aforementioned thread with no avail, and terminal still stating that it has version 0.10.8 (and NPM just completely not working at all)
Currently at my last stance of what to do, so hopefully someone on here can help me with my problem.
Cheers.

A: After searching through Google and StackOverflow for hours, I finally came up with a solution to the problem on my own.
Running the type command within terminal against node, I got this returned:
:~ myusername$ type node
node is /Users/myusername/.nvm/v0.10.48/bin/node

Subsequently, after deleting that folder, Node appears to be completely removed from my system.

I have since made sure that I have deleted all node and node_module folders that I could find within /usr/ to make sure - and I would suggest that anyone attempting this also do the same.

A: Try to run the following command
brew uninstall node

After the above command, you need to scan manually for node_modules if exists. Try following.
grep -irl "node_modules/node"

sudo rm -rf result_from_above_command
rm -rf ~/.npm

I hope this will remove all the node and it's components. As I have done like this, once before.
Thank you.


Q: On cloudcontrol, how can I do a URL rewrite? For a Python / Django application running on cloudcontrol, what's the recommended way of rewriting urls, e.g. attaching a wordpress blog to a certain url path like example.com/blog/, or even just redirecting a subdomain?
I'd know how to do this with an .htaccess file - is there an equivalent that would work on cloudcontrol? I found some sample cctrl apps that use .htaccess files (e.g. https://github.com/cloudControl/example_apps/blob/master/php/kohana/example.htaccess), but that's all PHP and it does not seem to work for my Django app.

A: You have multiple options. Let me explain the basic concept first. Generally every app on cloudControl has its own subdomain like APP_NAME.cloudcontrolled.com. Requests to those subdomains (or from a CNAME pointing to that subdomain) are forwarded by the routing tier to one or more of the containers available to serve requests. What runs inside each container is controlled by the Buildpack. Depending on the preferences of each language ecosystem (e.g. PHP vs Python) the runtime environment in the container differs. So for PHP, Apache is available while for Python it is not.
Option 1: The recommended way would be to have e.g. www.example.com poing to PYTHON_APP.cloudcontrolled.com and blog.example.com point to PHP_APP.cloudcontrolled.com.
Option 2: Alternatively if you have to use /blog instead of a blog. subdomain you can teach the Apache running inside the PHP App's containers to only serve requests for /blog and forward everything else to PYTHON_APP.cloudcontrolled.com.
Option 3: Soon you'd have a third option also, but this isn't available yet. We're currently working on enabling the Python buildpack to run Nginx inside the containers and use WSGI to communicate with the Python process. (Currently the Python process has to listen on the $PORT and serve HTTP directly) As soon as Nginx is available you could also configure it to forward /blog to PHP_APP.cloudcontrolled.com and serve everything else directly.
My recommendation would be to go with option 1, since that keeps both apps nicely decoupled. By permanently redirecting /blog in the Python app to blog.example.com you can make the migration painless.


Q: WordPress Custom Repeater Controller For Customizer I want to create custom repeater controller for theme, for this i tried but i am stuck with issue and i am unable to save any changes to my repeater section, any help is highly appreciated, here is link to my code
The code for customizer class is
if (class_exists('WP_Customize_Control')):
class Test_Testimonial_Control extends WP_Customize_Control {
    public $type = 'textarea';

    public function render_content() {
    ?>

<?php echo esc_html( $this->label ); ?>

                    <input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">
                    Upload Image

                    <?php _e('Description Text','text-domain'); ?>
                    <textarea rows="2" style="width:100%;"><?php echo esc_textarea( $this->value() ); ?></textarea>
                    <input type="text" name="cl_name" placeholder="Name">

                Add More
                <input <?php $this->link(); ?> type="hidden" value="<?php echo esc_attr($this->value()); ?>"/>

    <?php
    }
}
endif;

jquery code is
 $('.test-contents').hide();
$('body').on('click', '.test-title', function(){
    $('.test-contents').slideToggle();
});

$('body').on('click', '.new_section', function(){
var tCount = 0;
$('.test-rep-section-wrap').append('

Testimonial Options

<input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">Upload ImageDescription Text<textarea rows="5" style="width:100%;"></textarea><input type="text" name="cl_name" placeholder="Name">
Add More<input data-customize-setting-link="ripple_pro_testimonial_repeater" type="hidden" value="">
Delete Feature

');

});
$(document).on('click', '.delete-test-feature > a', function(){
   $(this).parents('.test-rep-section').remove();
});


Q: CSS Issue in IE7 and IE8 - text-indent on  field Is it possible to make IE7 and IE8 respect the text-indent css property on an input field?
Here's my code
<!DOCTYPE html>
<html>
<body>
        <input type="text" style="text-indent:100px; display:block;" value="Test indent" />
</body>
</html>

When you first load the page in IE8, the text is NOT indented.  You can "activate" the text-indent property by focussing in on the text field and typing into it (ie. trigger the onchange event).
How do I make IE7 and IE8 respect the text-indent of an input text element on page load instead of on input.onchange event?

A: in normal case input tag text-indent does not work in ie6 and ie7
If we add lineheight:1px it will work all browser
Text-indent  will work all browser
<input type="text" style="text-indent:-100px; display:block; line-height:1px;" value="Test indent" />

Text-indent  not will work ie7 and ie6 browser
<input type="text" style="text-indent:-100px; display:block;" value="Test indent" />

demo
http://jsfiddle.net/KczMR/1/

A: Are you sure that you want 'text-indent' instead of either the 'margin-left' or the 'padding-left' property? The 'text-indent' property is meant to affect only the first line of text in an element. You might have better luck with margin or padding.


Q: Is it possible to open an Apple Developer account for a client? My company is developing an iPad app for a technically unsophisticated government client, and I understand that they need their own Apple Developer account.  We would like to open and maintain the developer account for them, because we'll be much happier to have the control of our own destiny, and they'll be much happier to delegate the work to us.
But in the Apple Enrollment Guidelines, it says this:

I'm a contractor who develops apps for companies other than my own.
  How do I ensure my  client's name is listed as the “Seller” on the App
  Store?
If your client plans to distribute the apps you create for them on the
  App Store  with their legal entity name as the “Seller”, they must
  enroll in the iOS Developer Program. They can add you as a member of
  their development team so you can access the resources you need to
  create the app. While they must be the one who submits the app for
  review, you can assist them if necessary.

This makes it sound like any company that wants to be a "Seller" must physically create their own account and do at least some of the work, even when it's clear that another party is the only one that is going to be able to do any of the work.  Am I reading this right?  Is it really not possible for a contractor to set up a developer account on behalf of a client?

A: Yes that is correct. Your client is responsible for creating an account and paying the developer fee.
You could create the account, but then when your contract is over you would be getting support requests, be responsible for all future updates, and have to renew the account every year. It's better for your client to create the account. SEE EDIT

Edit: Found a thread on this discussion - http://www.buzztouch.com/forum/thread.php?tid=10608297F86BD057C74C0F9. The post by MGoBlue on 10/10/11 at 09:04 PM is Apple's stance, which says not to do that. Don't mess with Apple, have your client create an account and invite you to it.
There's also a note about this on Apple's Program Enrollment FAQ:
I'm a contractor who develops apps for companies other than my own. How do I ensure my client's name is listed as the “Seller” on the App Store?

If your client plans to distribute the apps you create for them on the App Store with their legal entity name as the “Seller”, they must enroll in the iOS Developer Program. They can add you as a member of their development team so you can access the resources you need to create the app. While they must be the one who submits the app for review, you can assist them if necessary.


Q: how inadvertently adding UTF8 format while copy paste? I have a string with non uft8 format
$str = Processing’s;
following json_encode works fine because i'm copying and pasting code to my editor
$str = Processing’s;
echo json_encode($str);

output:
Processing\u2019s"

if i retrive the same string Processing’s from DB and do json_encode it returns NULL because of it is non UTF8 string.
How when I copy paste code works like UTF8 encoded string? what happens when I copy and Paste the codes?


Q: Check if users are a member of an AD group - Powershell i have a txt file with a list of usernames and I want to check if these users are a member of a specific AD-group. If they aren't a member of this group, their username has to be written in a csv file. So the output should be a csv file with all usernames who are not in the specified AD-group.
I always get the error "A connection to the directory on which to process the request was unavailable. This is likely a transient condition".The error is reproduced when implementing a workflow that triggers up to 20 powershell sessions to run, each importing the Active Directory module to create a connection with AD.
This is my short script:
 $userlist = get-content -Path "C:\Temp\users.txt"

 $group = "group_xy"

 $result = foreach ($user in $userlist)
 {
     $groupmembers = Get-ADgroup -Filter {Name -eq $group}|Get-ADGroupMember

     if ($groupmembers.samaccountname -notmatch $users){
        [PSCustomObject]@{
        Name = $user
        Group = $group
        Member = 'False'
        }
    }

}

$result |Export-csv "C:\Temp\Result.csv" -NoTypeInformation

How can I solve this?
BR

A: if ($groupmembers.samaccountname -notmatch $users) {

Should be
if ($groupmembers.samaccountname -notmatch $user) {

Since you never define $users I think this is the error


Q: Null when sharing data between Activity and Fragment I got a problem that I can't share a RxBleClient between MainActivity and Fragments.
I pass a instance of RxBleClient to MyViewModel, and while trying to receive from ViewModel in Fragment it is just a Null. Fragment is a part of ViewPager2. Here is how I did this:
View Model code:
public class MyViewModel extends ViewModel {
    private MutableLiveData<RxBleClient> rxBleClient = new MutableLiveData<RxBleClient>();

    public MyViewModel() {
    }

    public void setRxBleClient(RxBleClient item) {
        rxBleClient.setValue(item);
    }

    public LiveData<RxBleClient> getRxBleClient() {
        return rxBleClient;
    }
}

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

        MyViewModel model = new ViewModelProvider(this).get(MyViewModel.class);

        //        Turn on Bluetooth
        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        int REQUEST_ENABLE_BT = 1;
        this.startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);

//        pass instance of RxBleClient to ViewModel
        rxBleClient = RxBleClient.create(getApplicationContext());
        model.setRxBleClient(rxBleClient);
// bind
        ButterKnife.bind(this);
// rest of code

Fragment code:
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_connection_list, container, false);
        scanResultList = new ArrayList<ScanResult>(0);
        // Set the adapter
        if (view instanceof RecyclerView) {
            Context context = view.getContext();
            RecyclerView recyclerView = (RecyclerView) view;
            if (mColumnCount <= 1) {
                recyclerView.setLayoutManager(new LinearLayoutManager(context));
            } else {
                recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
            }
            recyclerView.setAdapter(new MyConnectionRecyclerViewAdapter(scanResultList));
        }

        // get View Model
        myViewModel = new ViewModelProvider(getActivity()).get(MyViewModel.class);

        myViewModel.getRxBleClient().observe(getViewLifecycleOwner(), client -> {
            this.rxBleClient = client; // HERE IS NULL
        });

        return view;
    }

Where did I make mistake?

First edit:
This is my only one Activity, yet. This Activity is hosting ViewPager2:
//        FRAGMENT ADAPTER
        fragmentStateAdapter = new ViewPager2FragmentStateAdapter(getSupportFragmentManager(), getLifecycle());
        viewPager2 = findViewById(R.id.pager);
        viewPager2.setAdapter(fragmentStateAdapter);

        // TOP BAR
        final String tabTitles[] = {"Debugging", "Bluetooth", "Video"};
        final @DrawableRes int tabDrawable[] = {R.drawable.ic_bug_report_24px, R.drawable.ic_bluetooth_24px, R.drawable.ic_videocam_24px};
        tabLayout = findViewById(R.id.tab_layout);
        new TabLayoutMediator(tabLayout, viewPager2,
                (tab, position) -> tab.setText(tabTitles[position]).setIcon(tabDrawable[position])
        ).attach();


Q: Use config.py file in other directories of my poject My project's structure is:
My_Project:
├── scripts
│   ├── script.py
├── _main_config
│   ├── config.py

I'm trying to call from script.py file the config.py file in main_config. I'm working with sagemaker studio so currently my project is not a module.
First I added init.py files to both the main project dir and to scripts dir as well.
I saw that i can use the following code:
import sys
sys.path.append('/root/My_Project/main_config')
from main_config.config import BehConfig

BehConfig is a simple class i created in the config.py file:
class BehConfig:
   x = 'test'
   y = ['test1', 'test2']

When I tried to print both x and y i got the correct values. When I tried to modify the config.py file and add for instance, a value for the list y, when i ran the print command i still got the previous output without the value that i added.
Does anyone know why it's not working?
My guess is that it has to do with the sys.path.append above the import but i was unable to fix the issue.
Thank you for your help!


Q: Mysql query staying in 'SENDING DATA' state for long time when using LEFT JOIN I have query which is going in the SENDING DATA state for very long period of time.
Can someone please help me with this : below are details
Mysql Query:
select a.msgId,a.senderId,a.destination,a.inTime,a.status as InStatus,b.status as SubStatus,c.deliverTime,substr(c.receipt,82,7) as DlvStatus
from inserted_history a  left join submitted_history b  on b.msgId = a.msgId left join delivered_history c  on a.msgId = c.msgId
where a.inTime between '2010-08-10 00:00:00' and '2010-08-010 23:59:59' and a.systemId='ND_arber'

Total records in delivered_history : 223870168
Total records in inserted_history : 264817239
Total records in submitted_history : 226637058
Explain query returns:
id  ,  select_type  ,  table  ,  type  ,  possible_keys  ,  key  ,  key_len  ,  ref  ,  rows  ,  Extra
  1  ,  SIMPLE  ,  a  ,  ref  ,  systemId,idx_time  ,  systemId  ,  14  ,  const  ,  735310  ,  Using where
  1  ,  SIMPLE  ,  b  ,  ref  ,  PRIMARY  ,  PRIMARY  ,  66  ,  gwreports2.a.msgId  ,  2270405  ,
  1  ,  SIMPLE  ,  c  ,  ref  ,  PRIMARY  ,  PRIMARY  ,  66  ,  gwreports2.a.msgId  ,  2238701  ,

CREATE TABLE for delivered_history
CREATE TABLE `delivered_history` (
 `msgId` VARCHAR(64) NOT NULL,
 `systemId` VARCHAR(12) NOT NULL,
 `deliverTime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
 `smscId` VARCHAR(64) NOT NULL,
 `smsc` VARCHAR(20) NOT NULL,
 `receipt` BLOB NULL,
 `errcode` INT(11) NULL DEFAULT NULL,
 PRIMARY KEY (`msgId`, `deliverTime`),
 INDEX `systemId` (`systemId`),
 INDEX `smsc` (`smsc`),
 INDEX `idx_time` (`deliverTime`)
)
ROW_FORMAT=DEFAULT

CREATE TABLE for inserted_history
CREATE TABLE `inserted_history` (
 `msgId` VARCHAR(64) NOT NULL,
 `systemId` VARCHAR(12) NOT NULL,
 `senderId` VARCHAR(15) NOT NULL,
 `destination` VARCHAR(15) NOT NULL,
 `inTime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
 `status` VARCHAR(20) NOT NULL,
 `msgText` BLOB NULL,
 `msgType` VARCHAR(15) NULL DEFAULT NULL,
 PRIMARY KEY (`msgId`, `inTime`),
 INDEX `systemId` (`systemId`),
 INDEX `senderId` (`senderId`),
 INDEX `destination` (`destination`),
 INDEX `status` (`status`),
 INDEX `idx_time` (`inTime`)
)
ROW_FORMAT=DEFAULT

CREATE TABLE for submitted_history
CREATE TABLE `submitted_history` (
 `msgId` VARCHAR(64) NOT NULL,
 `systemId` VARCHAR(12) NOT NULL,
 `submitTime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
 `status` VARCHAR(20) NOT NULL,
 `smscId` VARCHAR(64) NOT NULL,
 `smsc` VARCHAR(16) NOT NULL,
 `errcode` INT(6) NULL DEFAULT '0',
 PRIMARY KEY (`msgId`, `submitTime`),
 INDEX `systemId` (`systemId`),
 INDEX `smsc` (`smsc`),
 INDEX `status` (`status`),
 INDEX `idx_time` (`submitTime`)
)
ROW_FORMAT=DEFAULT

ALL TABLES ARE DATE PARTIONED on the timestamp fields
List of the global variables in Mysql Server
Variable_name  ,  Value
  auto_increment_increment  ,  1
  auto_increment_offset  ,  1
  autocommit  ,  ON
  automatic_sp_privileges  ,  ON
  back_log  ,  50
  basedir  ,  /usr/
  big_tables  ,  OFF
  binlog_cache_size  ,  32768
  binlog_format  ,  STATEMENT
  bulk_insert_buffer_size  ,  8388608
  character_set_client  ,  latin1
  character_set_connection  ,  latin1
  character_set_database  ,  latin1
  character_set_filesystem  ,  binary
  character_set_results  ,  latin1
  character_set_server  ,  latin1
  character_set_system  ,  utf8
  character_sets_dir  ,  /usr/share/mysql/charsets/
  collation_connection  ,  latin1_swedish_ci
  collation_database  ,  latin1_swedish_ci
  collation_server  ,  latin1_swedish_ci
  completion_type  ,  0
  concurrent_insert  ,  1
  connect_timeout  ,  10
  datadir  ,  /var/lib/mysql/
  date_format  ,  %Y-%m-%d
  datetime_format  ,  %Y-%m-%d %H:%i:%s
  default_week_format  ,  0
  delay_key_write  ,  ON
  delayed_insert_limit  ,  100
  delayed_insert_timeout  ,  300
  delayed_queue_size  ,  1000
  div_precision_increment  ,  4
  engine_condition_pushdown  ,  ON
  error_count  ,  0
  event_scheduler  ,  OFF
  expire_logs_days  ,  10
  flush  ,  OFF
  flush_time  ,  0
  foreign_key_checks  ,  ON
  ft_boolean_syntax  ,  + -><()~*:        &|
  ft_max_word_len  ,  84
  ft_min_word_len  ,  4
  ft_query_expansion_limit  ,  20
  ft_stopword_file  ,  (built-in)
  general_log  ,  OFF
  general_log_file  ,  /var/run/mysqld/mysqld.log
  group_concat_max_len  ,  1024
  have_community_features  ,  YES
  have_compress  ,  YES
  have_crypt  ,  YES
  have_csv  ,  YES
  have_dynamic_loading  ,  YES
  have_geometry  ,  YES
  have_innodb  ,  YES
  have_ndbcluster  ,  NO
  have_openssl  ,  DISABLED
  have_partitioning  ,  YES
  have_query_cache  ,  YES
  have_rtree_keys  ,  YES
  have_ssl  ,  DISABLED
  have_symlink  ,  YES
  hostname  ,  smscdb
  identity  ,  0
  ignore_builtin_innodb  ,  OFF
  init_connect  ,
  init_file  ,
  init_slave  ,
  innodb_adaptive_hash_index  ,  ON
  innodb_additional_mem_pool_size  ,  1048576
  innodb_autoextend_increment  ,  8
  innodb_autoinc_lock_mode  ,  1
  innodb_buffer_pool_size  ,  8388608
  innodb_checksums  ,  ON
  innodb_commit_concurrency  ,  0
  innodb_concurrency_tickets  ,  500
  innodb_data_file_path  ,  ibdata1:10M:autoextend
  innodb_data_home_dir  ,
  innodb_doublewrite  ,  ON
  innodb_fast_shutdown  ,  1
  innodb_file_io_threads  ,  4
  innodb_file_per_table  ,  OFF
  innodb_flush_log_at_trx_commit  ,  1
  innodb_flush_method  ,
  innodb_force_recovery  ,  0
  innodb_lock_wait_timeout  ,  50
  innodb_locks_unsafe_for_binlog  ,  OFF
  innodb_log_buffer_size  ,  1048576
  innodb_log_file_size  ,  5242880
  innodb_log_files_in_group  ,  2
  innodb_log_group_home_dir  ,  ./
  innodb_max_dirty_pages_pct  ,  90
  innodb_max_purge_lag  ,  0
  innodb_mirrored_log_groups  ,  1
  innodb_open_files  ,  300
  innodb_rollback_on_timeout  ,  OFF
  innodb_stats_on_metadata  ,  ON
  innodb_support_xa  ,  ON
  innodb_sync_spin_loops  ,  20
  innodb_table_locks  ,  ON
  innodb_thread_concurrency  ,  8
  innodb_thread_sleep_delay  ,  10000
  innodb_use_legacy_cardinality_algorithm  ,  ON
  insert_id  ,  0
  interactive_timeout  ,  28800
  join_buffer_size  ,  131072
  keep_files_on_create  ,  OFF
  key_buffer_size  ,  1073741824
  key_cache_age_threshold  ,  300
  key_cache_block_size  ,  1024
  key_cache_division_limit  ,  100
  language  ,  /usr/share/mysql/english/
  large_files_support  ,  ON
  large_page_size  ,  0
  large_pages  ,  OFF
  last_insert_id  ,  0
  lc_time_names  ,  en_US
  license  ,  GPL
  local_infile  ,  ON
  locked_in_memory  ,  OFF
  log  ,  OFF
  log_bin  ,  ON
  log_bin_trust_function_creators  ,  OFF
  log_bin_trust_routine_creators  ,  OFF
  log_error  ,
  log_output  ,  FILE
  log_queries_not_using_indexes  ,  OFF
  log_slave_updates  ,  OFF
  log_slow_queries  ,  OFF
  log_warnings  ,  1
  long_query_time  ,  10.000000
  low_priority_updates  ,  OFF
  lower_case_file_system  ,  OFF
  lower_case_table_names  ,  0
  max_allowed_packet  ,  536870912
  max_binlog_cache_size  ,  4294963200
  max_binlog_size  ,  104857600
  max_connect_errors  ,  10
  max_connections  ,  151
  max_delayed_threads  ,  20
  max_error_count  ,  64
  max_heap_table_size  ,  16777216
  max_insert_delayed_threads  ,  20
  max_join_size  ,  18446744073709551615
  max_length_for_sort_data  ,  1024
  max_prepared_stmt_count  ,  16382
  max_relay_log_size  ,  0
  max_seeks_for_key  ,  4294967295
  max_sort_length  ,  1024
  max_sp_recursion_depth  ,  0
  max_tmp_tables  ,  32
  max_user_connections  ,  0
  max_write_lock_count  ,  4294967295
  min_examined_row_limit  ,  0
  multi_range_count  ,  256
  myisam_data_pointer_size  ,  6
  myisam_max_sort_file_size  ,  2146435072
  myisam_recover_options  ,  BACKUP
  myisam_repair_threads  ,  1
  myisam_sort_buffer_size  ,  8388608
  myisam_stats_method  ,  nulls_unequal
  myisam_use_mmap  ,  OFF
  net_buffer_length  ,  16384
  net_read_timeout  ,  30
  net_retry_count  ,  10
  net_write_timeout  ,  60
  new  ,  OFF
  old  ,  OFF
  old_alter_table  ,  OFF
  old_passwords  ,  OFF
  open_files_limit  ,  20000
  optimizer_prune_level  ,  1
  optimizer_search_depth  ,  62
  optimizer_switch  ,  index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
  pid_file  ,  /var/run/mysqld/mysqld.pid
  plugin_dir  ,  /usr/lib/mysql/plugin
  port  ,  3306
  preload_buffer_size  ,  32768
  profiling  ,  OFF
  profiling_history_size  ,  15
  protocol_version  ,  10
  pseudo_thread_id  ,  0
  query_alloc_block_size  ,  8192
  query_cache_limit  ,  1073741824
  query_cache_min_res_unit  ,  4096
  query_cache_size  ,  536870912
  query_cache_type  ,  ON
  query_cache_wlock_invalidate  ,  OFF
  query_prealloc_size  ,  8192
  rand_seed1  ,
  rand_seed2  ,
  range_alloc_block_size  ,  4096
  read_buffer_size  ,  131072
  read_only  ,  OFF
  read_rnd_buffer_size  ,  33554432
  relay_log  ,
  relay_log_index  ,
  relay_log_info_file  ,  relay-log.info
  relay_log_purge  ,  ON
  relay_log_space_limit  ,  0
  report_host  ,
  report_password  ,
  report_port  ,  3306
  report_user  ,
  rpl_recovery_rank  ,  0
  secure_auth  ,  OFF
  secure_file_priv  ,
  server_id  ,  3
  skip_external_locking  ,  ON
  skip_networking  ,  OFF
  skip_show_database  ,  OFF
  slave_compressed_protocol  ,  OFF
  slave_exec_mode  ,  STRICT
  slave_load_tmpdir  ,  /tmp
  slave_net_timeout  ,  3600
  slave_skip_errors  ,  OFF
  slave_transaction_retries  ,  10
  slow_launch_time  ,  2
  slow_query_log  ,  OFF
  slow_query_log_file  ,  /var/run/mysqld/mysqld-slow.log
  socket  ,  /var/run/mysqld/mysqld.sock
  sort_buffer_size  ,  67108864
  sql_auto_is_null  ,  ON
  sql_big_selects  ,  ON
  sql_big_tables  ,  OFF
  sql_buffer_result  ,  OFF
  sql_log_bin  ,  ON
  sql_log_off  ,  OFF
  sql_log_update  ,  ON
  sql_low_priority_updates  ,  OFF
  sql_max_join_size  ,  18446744073709551615
  sql_mode  ,
  sql_notes  ,  ON
  sql_quote_show_create  ,  ON
  sql_safe_updates  ,  OFF
  sql_select_limit  ,  18446744073709551615
  sql_slave_skip_counter  ,
  sql_warnings  ,  OFF
  ssl_ca  ,
  ssl_capath  ,
  ssl_cert  ,
  ssl_cipher  ,
  ssl_key  ,
  storage_engine  ,  MyISAM
  sync_binlog  ,  0
  sync_frm  ,  ON
  system_time_zone  ,  IST
  table_definition_cache  ,  256
  table_lock_wait_timeout  ,  50
  table_open_cache  ,  500
  table_type  ,  MyISAM
  thread_cache_size  ,  8
  thread_handling  ,  one-thread-per-connection
  thread_stack  ,  196608
  time_format  ,  %H:%i:%s
  time_zone  ,  SYSTEM
  timed_mutexes  ,  OFF
  timestamp  ,  1282125419
  tmp_table_size  ,  16777216
  tmpdir  ,  /tmp
  transaction_alloc_block_size  ,  8192
  transaction_prealloc_size  ,  4096
  tx_isolation  ,  REPEATABLE-READ
  unique_checks  ,  ON
  updatable_views_with_limit  ,  YES
  version  ,  5.1.37-1ubuntu5-log
  version_comment  ,  (Ubuntu)
  version_compile_machine  ,  i486
  version_compile_os  ,  debian-linux-gnu
  wait_timeout  ,  28800
  warning_count  ,  0

A: Your explain plan that you gave:
id , select_type , table , type , possible_keys      , key      , key_len  , ref                 , rows , Extra
1  , SIMPLE      , a     , ref  , systemId idx_time) , systemId , 14       , const              , 735310 , Using where
1  , SIMPLE      , b     , ref  , PRIMARY            , PRIMARY  , 66       , gwreports2.a.msgId , 2270405 ,
1  , SIMPLE      , c     , ref  , PRIMARY            , PRIMARY  , 66       , gwreports2.a.msgId , 2238701 ,

shows that you are hitting: 735310 * 2270405 * 2238701 = 3T rows!!!!!!
Effectively your not using your indexes to their fullest potential.
How to interpret your 'explain plan':
     For every row in table 'a' (735310 ), you hit table 'b' 2270405  times.
     For every row you hit in table 'b', you hit table 'c' 2238701  times.
     As you can see, this is an exponential problem.
Yes, the 8MB of InnoDb Buffer space is small, but getting your explain plan down to xxxx * 1 * 1 will result in incredible speeds, even for 8MB of Buffer Space.
Given your Query:
SELECT a.msgId,a.senderId,a.destination,a.inTime,a.status as InStatus,b.status as SubStatus,c.deliverTime,substr(c.receipt,82,7) as DlvStatus
  FROM inserted_history a
  LEFT JOIN submitted_history b ON b.msgId = a.msgId  -- USES 1 column of PK
  LEFT JOIN delivered_history c ON a.msgId = c.msgId  -- USES 1 column of PK
 WHERE a.inTime BETWEEN '2010-08-10 00:00:00' AND '2010-08-010 23:59:59' -- NO key
   AND a.systemId='ND_arber' -- Uses non-unique PK

Here are the problems I see:
   A) Your _history tables are partitioned on the columns with 'Timestamp' datatype, YET you are NOT those columns in your JOIN/WHERE criteria.  The engine must hit EVERY partition without that information.
   B) Access to submitted_history and delivered_history is using only 1 column of a 2-column PK.  You are only getting partial benefit of the PK.  Can you get more columns to be part of the JOIN?  You must get the # of rows found for this table as close to '1' as possible.
   C) msgID = varchar(64)  and this is the 1st column of the PK for each table.  Your Keys on each table are ** HUGE **!!
      - Try to reduce the size of columns for the PK, or use different columns.
Your data patterns of the other keys shows that you have LOTS of disk/ram space tied up in non-PK keys.
Question 1) What does "Show Indexes FROM " (Link) for each of the tables report??  The column 'Cardinality' will show you how effective each of your keys really are.  The smaller the cardinality is, the WORST/Less effective that index is.  You want cardinality as close to "total rows" as possible for ideal performance.
Question 2) Can you re-factor the SQL such that the JOIN'd columns of each table are those with the highest cardinality for that table?
Question 3) Is the columns of 'timestamp' datatype really the best column for the partitioning?  If your access patterns always use 'msgId', and msgId is the 1st column of the PK, then .
Question 4) Is msgId unique?  My guess is yes, and the 2nd column of the PK is not really necessary.
Read up on Optimizing SQL (Link) and have the index cardinality reports of your tables. This is the path to figure out how to optimize an query.    You want the 'rows' of the explain plan to be N * 1 * 1.
SIDE NOTE:InnoDb & MyISAM engines does NOT automatically update table cardinality for non-unique columns, the DBA needs to manually run 'Analyze Table' periodically to ensure its accuracy.
Good Luck.

A: Would it be possible to alter the index of inserted_history,
systemId (systemId)
to be
systemId (systemId, inTime). Or add an additional index
My logic being that this should help to speed up the selection of the inserted_history (a) rows which forms the basis of the join.
The where clause "where a.inTime between '2010-08-10 00:00:00' and '2010-08-010 23:59:59' and a.systemId='ND_arber'" would all be selectable by index. At present, rows are selectable by systemId but then all those rows need to be scanned for the time.
Just as a matter of interest, how many records would there be (on average) for each system id. Also as msgid is not unique on its own, how many records (on average) in the other tables will have teh same msgid.

A: Main Idea
Are you using InnoDB? It looks like your buffer pool is only 8MB. That could easily be the problem, you're dealing with a lot of data and InnoDB doesn't have much memory. Can you bump the innodb_buffer_pool_size up? You'll have to restart MySQL, but I'm betting that would make a HUGE difference, even if you only give it 256 or 512MB.
Update: I see your storage engine and table format seem to default to MyISAM, so unless you specified otherwise this wouldn't apply. I wonder if the myisam_sort_buffer_size would help? We don't use MyISAM so I'm not familiar with tuning it.
Random Thought
I wonder if having having the primary key be alphanumeric (especially VARCHAR) has anything to do with it. I remember we had problems with performance on non-numeric primary keys, but that database dated from 4.0 or 4.1, so that may not apply (or ever have been true).
Secondary Idea
After the memory thing above, my best guess would be to give MySQL more hints. When I have a query that's running slow, I often find giving it more information helps it out. You have messageId/time indexes on each table. Maybe something more like this would work better:
select a.msgId,a.senderId,a.destination,a.inTime,a.status as InStatus,
b.status as SubStatus,c.deliverTime,substr(c.receipt,82,7) as DlvStatus
from inserted_history a left join submitted_history b on b.msgId = a.msgId
left join delivered_history c on a.msgId = c.msgId
where a.inTime between '2010-08-10 00:00:00' and '2010-08-010 23:59:59'
and a.systemId='ND_arber' AND c.inTime between b.inTime >= a.inTime
and c.inTime >= b.inTime

I'm guessing things get inserted into A, then B, then C. If you have better limits (say when something goes in A, it's always sent out and submitted within one day) add that information could help.
I wonder about this both because I've seen it help my query performance in some situations, but also because you have the data partitioned on the datetime. That may help the optimizer.
My other suggestion would be to run your query for a short amount of time, say 10 minutes instead of a full day, and make sure the results are right. Then try 30. Increase it and see when it falls off into "come back tomorrow" territory. That may tell you something.


Q: What is the preferred way to undo a `svn switch` with svn 1.7? Switching below the root of a project, svn switches that subdirectory only. Prior svn 1.7 one could simply delete that directory and run an update.
But now with svn 1.7, it doesn't store svn-information per directory. How can I undo the effect of the switch?
extra: apart the command line client, can it be done via TortoiseSVN? :) on win32
note this question was already asked, but for svn < 1.7 which is a quite different situation


Q: A simple model in Winbugs but it says "This chain contains uninitialized variables" I have some simple time to event data, no covariates. I was trying to fit a Weibull distribution to it. So I have the following code. Everything looks good until I load my initials. It says "this chain contains uninitialized variables". But I don't understand. I think Weibull dist only has 2 parameters, and I already specified them all. Could you please advise? Thanks!
model
{
    for(i in 1 : N) {
            t[i] ~ dweib(r, mu)I(t.cen[i],)
    }
    mu ~ dexp(0.001)
    r ~ dexp(0.001)
}
# Data
list(
t.cen=c(0,3.91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21.95,23.98,33.08),
t=c(2.34,NA,5.16,5.63,6.17,6.8,7.03,8.05,8.13,8.36,8.83,10.16,
10.55,10.94,11.48,11.95,13.05,13.59,16.02,20.08,NA,NA,
NA),
N=23
)
# Initial values
list(
r=3,mu=3
)

A: The other uninitialised variables are the missing (NA) values in the vector of t. Remember that the BUGS language makes no distinction between data and parameters, and that supplying something as data with the value NA is equivalent to not supplying it as data.


Q: Solving Matrix elements by using while iteration in Matlab I have a known 5X6 sized M matrix, and a 6x1 sized K matrix which its 4 elements unknowns and two knowns. P matrix obtained by multiplication of these two matrices and has different 5 elements all which function of an x variable. Altogether, there are 5 equations and 5 unknowns (four from the K, and one from the P(which is x))
M[5X6]*K[6X1]=P[5X1]
 P=[constant*x, constant2*x, constant3*x, constant4*x, constant5*x)
How can I obtain a while iteration in Matlab to solve these 5 unknowns? Is this possible in Matlab with the while or for loop?         `


Q: truncate git repository keepinng regular snapshots I want to keep track on a 500kb json text that changes its content minutely. I would like to use git, so I can use git pull on another server to download the latest version of that file without the problem, that the file could change during download and I also want to have a versioning of that file for the last months/years this way at the same time.
I thought of creating a git repository where I commit every file change, but I noticed, after some days, this repository gets the size of many GB (even with git gc because there changes so much in the file)
I could truncate the git regularly to a particular depth but that is not what I need. I need the information, how the file looked like a week ago, a month ago, a year ago. although I don't need as many commits the longer in the past it is.
Is this even possible with git and some bash magic? I am fine with deleting and recreating the repository and using --amend in that git
Or would you suggest another solution?

A: There is at least one way to do this; I'll outline an approach below.  First a few things to think about:
Depending on the nature of the changes that occur, you might want to see if frequent packing of the database might help; git is pretty good at avoiding wasted space (for text files, at least).
Of course with the commit load you describe - 1440 commits per day, give or take? - the history will tend to grow.  Still, unless the changes are dramatic on every commit, it seems like it could be made better than "many GB in a few days"; and maybe you'd reach a level where a compromise archiving strategy would become practical.
It's always worth thinking, too, about whether "all the data I need to keep" is bigger than "all the data I need regular access to"; because then you can consider whether some of the data should be preserved in archive repos, possibly on backup media of some form, rather than as part of the live repo.
And, as you allude in your question, you might want to consider whether git is the best tool for the job.  Your described usage doesn't use most of git's capabilities; nor does it exercise the features that really make git excel.  And conversely, other tools might make it easier to progressively thin out the history.
But with all of that said, you still might reach the decision to start with "per minute" data, then eventually drop it to "per hour", and maybe still later reduce to *per week".
(I'd discourage defining too many levels of granularity; the most "bang for your buck" will come with discarding sub-hourly snapshots.  Hour->day would be borderline, day->week would probably be wasteful.  If you get down to weekly, that's surely sparse enough...)
So when some data "ages out", what to do?  I suggest that you could use some combination of rebasing (and/or related operations), depth limits, and replacements (depending on your needs).  Depending on how you combine these, you could keep the illusion of a seamless history without changing the SHA ID of any "current" commit.  (With more complex techniques, you could even arrange to never change a SHA ID; but this is noticeably harder and will reduce the space savings somewhat.)
So in the following diagrams, there is a root commit identified as 'O'.  Subsequent commits (the minutely changes) are identified by a letter and a number.  The letter indicates the day the commit was created, the numbers sequentially mark off minutes.
You create your initial commit and place branches on it for each granularity of history you'll eventually use.  (As changes accumulate each minute, they'll just go on master.)
O <--(master)(hourly)(weekly)

After a couple days you have
O <-(hourly)(weekly)
 \
  A1 - A2 - A3 - ... - A1439 - A1440 - B1 - B2 - ... - B1439 - B1440 - C1 <--(master)

And maybe you've decided that at midnight, any sub-hour snapshot that's 24 hours old can be discarded.
So as day C starts, the A snapshots are older than 24 hours and should be reduced to hourly snapshots.  First we must create the hourly snapshots
git checkout hourly
git merge --squash A60
git commit -m 'Day A 1-60'
git merge --squash A120
git commit -m 'Day A 61-120'
...

And this gives you
O <-(weekly)
|\
| A60' - A120' - ... - A1380' - A1440' <-(hourly)
 \
  A1 - A2 - A3 - ... - A1439 - A1440 - B1 - B2 - ... - B1439 - B1440 - C1 <--(master)

Here A1440' is a rewrite of A1440, but with a different parentage (such that its direct parent is "an hour ago" instead of "a minute ago").
Next, to make the history seamless you would have B1 identify A1440' as its parent.  If you don't care about changing the SHA ID of every commit (including current ones), a rebase will work
git rebase --onto A1440' A1440 master

Or in this case (since the TREEs at A1440 and A1440' are the same) it would be equivalent to re-parent B1 - see the git filter-branch docs for details of that approach.  Either way you would end up with
O <-(weekly)
|\
| A60' - A120' - ... - A1380' - A1440' <-(hourly)
|                                     \
|                                      B1' - B2' - ... - B1439' - B1440' - C1' <-(master)
 \
  A1 - A2 - A3 - ... - A1439 - A1440 - B1 - B2 - ... - B1439 - B1440 - C1

Note that even though the granularity of changes in the B and C commits is unchanged, these are still "rewritten" commits (hence the ' notation); and in fact the original commits have not yet been physically deleted. They are unreachable, though, so they'll eventually be cleaned up by gc; if it's an issue, you can expedite this by discarding reflogs that are more than 24 hours old and then manually running gc.
Alternatively, if you want to preserve SHA ID's for the B and C commits, you could use git replace.
git replace A1440 A1440'

This has a number of drawbacks, though.  There are a few known quirks with replacements.  Also in this scenario the original commits are not unreachable (even though they aren't shown by default); you would have to shallow the master branch to get rid of them.  The simplest way to shallow a branch is to clone the repo, but then you have to jump through extra hoops to propagate the replacement refs.  So this is an option if you never want the master ref to "realize" it's moving in an abnormal way, but not as simple.


Q: Calculate How Many Overlapping Dates There Are Within Multiple Date Ranges I need to be able to calculate the number of days when someone was taking at least 1 drug from Class A and 1 drug from Class B.
One of the biggest issues I am encountering is that prescriptions for the same Drug Class may overlap each other and when they are joined to Class B prescriptions I end up double counting days.
For example, between 01/01/21 and 06/30/21, what's the total number of days for each individual where they took a drug from Class A and from Class B
I have fake data below as an example.
TABLE 1
| ID | START | END | CLASS |
|:---- |:------| :-----| :-----|
|1234   |12-Feb-21  |19-Feb-21| A
|1234   |20-Feb-21  |22-Feb-21| A
|1243   |13-Mar-21  |23-Mar-21| A
|1234   |21-Apr-21  |1-May-21   |A
|1234   |20-Jun-21  |25-Jun-21  |A
|1234   |11-Jul-21  |16-Jul-21  |A
|4321   |25-Jan-21  |24-Feb-21  |A
|4321   |31-Jan-21  |2-Mar-21   |A
|4321   |28-Feb-21  |30-Mar-21  |A
|4321   |25-Mar-21  |24-Apr-21  |A
|4321   |25-Mar-21  |24-Apr-21  |A
|4321   |25-Apr-21  |25-May-21  |A
|4321   |29-Apr-21  |29-May-21  |A
|4321   |23-May-21  |22-Jun-21  |A
|4321   |26-May-21  |25-Jun-21  |A
|4321   |23-Jun-21  |23-Jul-21  |A
|4321   |23-Jun-21  |23-Jul-21  |A

TABLE 2
| ID | START | END | CLASS |
|:---- |:------| :-----| :-----|
|1234   |18-Jan-21  |17-Feb-21  |B
|1234   |17-Mar-21  |16-Apr-21  |B
|1234   |14-Apr-21  |14-May-21  |B
|1234   |12-May-21  |11-Jun-21  |B
|1234   |9-Jun-21   |9-Jul-21   |B
|1234   |11-Jul-21  |10-Aug-21  |B
|4321   |25-Jan-21  |24-Feb-21  |B
|4321   |11-Feb-21  |13-Mar-21  |B
|4321   |7-Mar-21   |6-Apr-21   |B
|4321   |4-Apr-21   |4-May-21   |B
|4321   |30-Apr-21  |30-May-21  |B
|4321   |24-May-21  |23-Jun-21  |B
|4321   |20-Jun-21  |20-Jul-21  |B

PS - I am working in Oracle SQL Developer

A: A relatively simple approach is a brute-force approach.  This splits the periods into days for each class.  Then joins and aggregates to get the total:
with cte1(id, d, endd, class) as (
      select id, startd, endd, class
      from table1
      union all
      select id, d + interval '1' day, endd, class
      from cte1
      where d < endd
     ),
     cte2(id, d, endd, class) as (
      select id, startd, endd, class
      from table2
      union all
      select id, d + interval '1' day, endd, class
      from cte2 -- edit here
      where d < endd
     )
select cte1.id, count(*)
from cte1 join
     cte2
     on cte1.id = cte2.id and cte1.d = cte2.d
group by cte1.id;

Here is a db<>fiddle.


Q: Creating a completely custom pagination component for tabulator Is there any way with which we can create a custom pagination component for tabulator?
I don't want to :

*

*Add custom controls to the Footer. (Already Checked Footer docs)

*Put the pagination element in a custom container. (Already checked with Pagination docs)
Use case:
Suppose I want to use a third party paginator for it's theming and interactivity options. Is there a way by which I can just apply the pagination classes to it and it will work as expected ?

A: Tabulator is a modular system, you could easily either modify the existing pagination module, or create your own from scratch.
There is a guide to Building Your Own Module along with several Example Modules to show how things work in practice.
If you want a good starting point for the pagination module then why not start with the source code for the existing pagination module, which you can find Here


Q: Reshape a large matrix with missing values and multiple vars of interest I need to reorganize a large dataset into a specific format for further analysis. Right now the data are in long format, with multiple records through time for each point. I need to reshape the data so that each point has a single record, but it will add many new columns of the time-specific data. I’ve looked at previous similar posts but I need to ultimately convert several of the current variables into columns, and I can’t find an example of such. Is there a way to accomplish this in a single reshape, or will I have to do several and then concatenate the new columns back together?   Another wrinkle before I post the example is that not all points were sampled at each time-step, so I need those values to show up as NA. For example, (see data below) SitePoint A1 was not sampled at all in 2012, SitePoint A10 was not sampled during the first round in 2012, but K83 was sampled all nine times.
mydatain <- structure(list(SitePoint = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 6L, 6L), .Label = c("A1", "A10", "K145", "K83", "T15",
"T213"), class = "factor"), Year_Rotation = structure(c(1L, 2L,
3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L, 8L, 9L, 1L, 2L, 4L, 5L,
6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 1L, 7L), .Label = c("2010_1", "2010_2",
"2010_3", "2011_1", "2011_2", "2011_3", "2012_1", "2012_2", "2012_3"
), class = "factor"), MR_Fire = structure(c(5L, 6L, 6L, 2L, 9L,
9L, 5L, 6L, 6L, 2L, 9L, 9L, 7L, 8L, 16L, 17L, 21L, 22L, 23L,
25L, 3L, 4L, 10L, 11L, 12L, 13L, 14L, 15L, 18L, 19L, 20L, 1L,
2L, 2L, 5L, 6L, 6L, 11L, 11L, 12L, 7L, 24L), .Label = c("0",
"1", "10", "11", "12", "13", "14", "15", "2", "23", "24", "25",
"35", "36", "37", "39", "40", "47", "48", "49", "51", "52", "53",
"8", "9"), class = "factor"), fire_seas = structure(c(2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
1L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 1L, 3L), .Label = c("dry", "fire", "wet"
), class = "factor"), OptTSF = c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L,
1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L,
0L, 1L, 1L)), .Names = c("SitePoint", "Year_Rotation", "MR_Fire",
"fire_seas", "OptTSF"), row.names = c(31L, 32L, 33L, 34L, 35L,
36L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 10543L, 10544L,
10545L, 10546L, 10547L, 10548L, 10549L, 10550L, 14988L, 14989L,
14990L, 14991L, 14992L, 14993L, 14994L, 14995L, 14996L, 17370L,
17371L, 17372L, 17373L, 17374L, 17375L, 17376L, 17377L, 17378L,
19353L, 19354L), class = "data.frame")

Ultimately I need something like this:
myfinal <- structure(list(SitePoint = structure(1:6, .Label = c("A1", "A10",
"K145", "K83", "T15", "T213"), class = "factor"), MR_Fire_2010_1 = c(12L,
12L, 39L, 23L, 0L, 14L), MR_Fire_2010_2 = c(13L, 13L, 40L, 24L,
1L, NA), MR_Fire_2010_3 = c(13L, 13L, NA, 25L, 1L, NA), MR_Fire_2011_1 = c(1L,
1L, 51L, 35L, 12L, NA), MR_Fire_2011_2 = c(2L, 2L, 52L, 36L,
13L, NA), MR_Fire_2011_3 = c(2L, 2L, 53L, 37L, 13L, NA), MR_Fire_2012_1 = c(NA,
NA, 9L, 47L, 24L, 8L), MR_Fire_2012_2 = c(NA, 14L, 10L, 48L,
24L, NA), MR_Fire_2012_3 = c(NA, 15L, 11L, 49L, 25L, NA), season_2010_1 = structure(c(2L,
2L, 1L, 2L, 2L, 1L), .Label = c("dry", "fire"), class = "factor"),
    season_2010_2 = structure(c(2L, 2L, 1L, 2L, 2L, NA), .Label = c("dry",
    "fire"), class = "factor"), season_2010_3 = structure(c(1L,
    1L, NA, 1L, 1L, NA), .Label = "fire", class = "factor"),
    season_2011_1 = structure(c(2L, 2L, 1L, 2L, 2L, NA), .Label = c("dry",
    "fire"), class = "factor"), season_2011_2 = structure(c(2L,
    2L, 1L, 2L, 2L, NA), .Label = c("dry", "fire"), class = "factor"),
    season_2011_3 = structure(c(2L, 2L, 1L, 2L, 2L, NA), .Label = c("dry",
    "fire"), class = "factor"), season_2012_1 = structure(c(NA,
    NA, 2L, 1L, 1L, 2L), .Label = c("fire", "wet"), class = "factor"),
    season_2012_2 = structure(c(NA, 1L, 2L, 1L, 1L, NA), .Label = c("fire",
    "wet"), class = "factor"), season_2012_3 = structure(c(NA,
    1L, 2L, 1L, 1L, NA), .Label = c("fire", "wet"), class = "factor"),
    OptTSF_2010_1 = c(1L, 1L, 0L, 1L, 1L, 1L), OptTSF_2010_2 = c(1L,
    1L, 0L, 1L, 1L, NA), OptTSF_2010_3 = c(1L, 1L, NA, 1L, 1L,
    NA), OptTSF_2011_1 = c(1L, 1L, 0L, 0L, 1L, NA), OptTSF_2011_2 = c(1L,
    1L, 0L, 0L, 1L, NA), OptTSF_2011_3 = c(1L, 1L, 0L, 0L, 1L,
    NA), OptTSF_2012_1 = c(NA, NA, 1L, 0L, 0L, 1L), OptTSF_2012_2 = c(NA,
    1L, 1L, 0L, 0L, NA), OptTSF_2012_3 = c(NA, 1L, 1L, 0L, 0L,
    NA)), .Names = c("SitePoint", "MR_Fire_2010_1", "MR_Fire_2010_2",
"MR_Fire_2010_3", "MR_Fire_2011_1", "MR_Fire_2011_2", "MR_Fire_2011_3",
"MR_Fire_2012_1", "MR_Fire_2012_2", "MR_Fire_2012_3", "season_2010_1",
"season_2010_2", "season_2010_3", "season_2011_1", "season_2011_2",
"season_2011_3", "season_2012_1", "season_2012_2", "season_2012_3",
"OptTSF_2010_1", "OptTSF_2010_2", "OptTSF_2010_3", "OptTSF_2011_1",
"OptTSF_2011_2", "OptTSF_2011_3", "OptTSF_2012_1", "OptTSF_2012_2",
"OptTSF_2012_3"), class = "data.frame", row.names = c(NA, -6L
))

The actual dataset is about 23656 records X 15 variables, so doing it by hand is likely to cause major headaches and potential for mistakes. Any help or suggestions are appreciated. If this has been answered elsewhere, apologies. I couldn’t find anything directly applicable; everything seemed to related to three columns and only one of those being extracted as new variables. Thanks.
SP

A: dcast from the devel version of data.table i.e., v1.9.5 can cast multiple columns simultaneously. It can be installed from here.
library(data.table) ## v1.9.5+
dcast(setDT(mydatain), SitePoint~Year_Rotation,
         value.var=c('MR_Fire', 'fire_seas', 'OptTSF'))

A: You can use reshape to change the structure of your dataframe from long to wide using the following code:
reshape(mydatain,timevar="Year_Rotation",idvar="SitePoint",direction="wide")