text:
Q: Hardcoding into web.config in asp.net Below specified is c# code and i am using asp.net with c#,The below code describes the date difference it will update the table after 2 months,
cmd3.CommandText = "update TrackingFaculty_det "
                   + "SET Type=@Type WHERE "
                   + "DATEDIFF(d,TrackingFaculty_det.LastUpdateDate,@Today)>60";

I need to hardcode the month value into web.config,so that if i want to change the date difference to three months or so on,so that in web.config if i make a change then the changes will occur in every c# pages where i have these lines of code.
My Web.Config is as below
  <?xml version="1.0"?>
   <!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
 <configuration>
<appSettings/>
<connectionStrings>
    <add name="ProjectConnectionString" connectionString="Data  S ource=BOPSERVER;Initial Catalog=Project;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="ProjectConnectionString2" connectionString="Data Source=BOPSERVER;Initial Catalog=Project;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="ProjectConnectionString3" connectionString="Data Source=BOPSERVER;Initial Catalog=Project;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
    <!--
        Set compilation debug="true" to insert debugging
        symbols into the compiled page. Because this
        affects performance, set this value to true only
        during development.
    -->

    <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/></assemblies>
    </compilation>
    <!--
        The <authentication> section enables configuration
        of the security authentication mode used by
        ASP.NET to identify an incoming user.
    -->

    <authentication mode="Windows"/>
    <!--
        The <customErrors> section enables configuration
        of what to do if/when an unhandled error occurs
        during the execution of a request. Specifically,
        it enables developers to configure html error pages
        to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
        <error statusCode="403" redirect="NoAccess.htm" />
        <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>
    -->
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>

A: Add key in web.config like this
<configuration>
   ....
   <appSettings>
      <add key="Difference" value="60"/>

   </appSettings>
   ....
</configuration>

get key from web.config like this
string str_Diff = WebConfigurationManager.AppSettings["Difference"].ToString();

cmd3.CommandText =
    "update TrackingFaculty_det "
    + "SET Type=@Type WHERE "
    + "DATEDIFF(d,TrackingFaculty_det.LastUpdateDate,@Today) > " + str_Diff;

A: Web.config code
   <configuration>
      ....
     <appSettings>
     <add key="Difference" value="60"/>

     </appSettings>
     ....
   </configuration>

get key from web.config
    string str_diff = Convert.ToString(ConfigurationManager.AppSettings["Difference"]);
    cmd3.CommandText = "update TrackingFaculty_det SET Type=@Type WHERE (FID=@FID) and DATEDIFF(d,TrackingFaculty_det.LastUpdateDate,@Today)>'"+str_diff+"'";

This is what i needed and i got the solution


text:
Q: Ubuntu 16.04.01 MATE - Chrome 'Aw snap" crashes On a fairly fresh install of Ubuntu, Chrome 57.
Chrome is being a real pain. Constantly getting the 'Aw snap' error on multiple tabs, ironically even the actual google support page on that issue (https://support.google.com/chrome/answer/95669?co=GENIE.Platform%3DDesktop&hl=en). Its definitely not tied to a single / specific sites.
I still have stacks of memory available, so its not running out. It can happen either a couple hours after initial load, or almost immediately after I kill all chrome processes and start fresh.
I have tried:

*

*Removing as many unessential extensions as possible

*Updated to latest version

*Rebooted

*Killed chrome processes and restarted

In /var/log/syslog I am getting things like:
May  2 15:34:13 nikon kernel: [23673.707007] traps: chrome[678] general protection ip:56439cc9a257 sp:7ffff28aed28 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:34:29 nikon kernel: [23689.425474] traps: chrome[612] general protection ip:56439c840b57 sp:7ffff28acd50 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:34:32 nikon kernel: [23692.708588] traps: ScriptStreamerT[855] general protection ip:56439c8493b3 sp:7fc465671180 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:34:38 nikon kernel: [23698.881207] traps: chrome[876] general protection ip:56439c840b43 sp:7ffff28ae820 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:35:10 nikon kernel: [23730.732626] traps: chrome[894] general protection ip:56439c848621 sp:7ffff28acfd0 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:37:09 nikon kernel: [23849.271061] traps: chrome[1034] general protection ip:56439cb40b0a sp:7ffff28ae3d0 error:0 in chrome[56439b9d0000+6aa4000]
May  2 15:38:38 nikon dbus[2936]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service'
May  2 15:39:37 nikon kernel: [23997.351302] traps: chrome[1693] general protection ip:55be77890119 sp:7ffeeadc56d0 error:0 in chrome[55be766f1000+6aa4000]
May  2 15:43:21 nikon org.freedesktop.Notifications[4983]: Xlib:  extension "RANDR" missing on display ":0".
May  2 15:49:39 nikon kernel: [24599.574516] traps: chrome[2434] general protection ip:55be778a2afd sp:7ffeeadc22e0 error:0 in chrome[55be766f1000+6aa4000]

Any ideas how I can even troubleshoot what is wrong / check logs?

A: Got the same error message after update ubuntu 14.04 -> 16.04.
You can enable logs with command line arguments as stated here:

--enable-logging --v=1

For me the resulting file was located here

~/.config/google-chrome/chrome_debug.log

Here is an explanation how to find log file for other platforms: http://dev.chromium.org/user-experience/user-data-directory
Unfortunately, content of log gives me nothing.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Symfony 3.4 microkernel custom services I wonder if possible to register custom service in symfony 3.4 MicroKernel app directly from AppKernel class by configureContainer method instead of loading all services from service.yml file.
Maybe by ContainerBuilder loadFromExtension method?
...

class AppKernel extends Kernel
{
    use MicroKernelTrait;

    public function registerBundles()
    {
       ...
    }

   protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config.yml');

        $c->loadFromExtension('custom_service', [
            ...
        ]);
    }

   ...
}

A: Working example:
<?php

use App\LoremIpsum;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;

require_once __DIR__ . '/../vendor/autoload.php';

class AppKernel extends Kernel {
    use MicroKernelTrait;

    public function registerBundles() {
        return [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        ];
    }

    protected function configureRoutes(RouteCollectionBuilder $routes) {
        $routes->add('/', 'kernel:exampleAction');
    }

    protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) {
        $c->loadFromExtension('framework', [
            'secret' => 'r0tf1.XD',
        ]);

        $c->register(LoremIpsum::class)->setArguments([123, 'ABC'])->setPublic(true);
    }

    public function exampleAction() {
        $obj = $this->getContainer()->get(LoremIpsum::class);
        return Response::create((string)$obj);
    }
}

$kernel   = new AppKernel('dev', true);
$request  = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

See also: http://symfony.com/doc/3.4/service_container/definitions.html


text:
Q: How to refresh listview in fragment that is filled with ArrayAdapter I got data from json response and showed it in listView. When I delete an item in listView, it is deleted successfully but listView doesn't refresh.
I am using an ArrayAdapter instead of a BaseAdapter.
CustomList.java
public class CustomList extends ArrayAdapter<String>  {

    ImageButton imgdelete;
    private String[] clientid;
    private String[] mobile;
    private String[] grand;
    private String[] billid;
    View listViewItem;
    TextView textViewname;

    private Activity context;

    public CustomList(Activity context, String[] clientid, String[] mobile, String[] grand, String[] billid) {
        super(context, R.layout.activity_listview, clientid);
        this.context = context;
        this.clientid = clientid;
        this.mobile = mobile;
        this.grand = grand;
        this.billid = billid;
    }

    @Override
    public View getView(final int position, final View convertView, ViewGroup parent) {
        final LayoutInflater inflater = context.getLayoutInflater();
        listViewItem = inflater.inflate(R.layout.activity_listview, null, true);
        textViewname = (TextView) listViewItem.findViewById(R.id.viewClientMobile);
        TextView textViewmobile = (TextView) listViewItem.findViewById(R.id.viewClientName);
        TextView textViewgrand = (TextView) listViewItem.findViewById(R.id.viewCompnayName);
         TextView textViewbillid = (TextView) listViewItem.findViewById(R.id.viewCompanyEmail);
        ImageButton imgedit = (ImageButton)listViewItem.findViewById(R.id.imgeditbtn);
       imgdelete = (ImageButton)listViewItem.findViewById(R.id.imgdeletebtn);
        textViewname.setText(clientid[position]);
        textViewmobile.setText(mobile[position]);
        textViewgrand.setText(grand[position]);
        textViewbillid.setText(billid[position]);

        imgdelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                new AlertDialog.Builder(context)
                        .setTitle("Delete entry")
                        .setMessage("Are you sure you want to delete this entry?")
                        .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                // continue with delete
                                DeleteClient_api();

                            }
                        })
                        .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                // do nothing
                            }
                        })
                        .setIcon(android.R.drawable.ic_dialog_alert)
                        .show();

                notifyDataSetChanged();
          }
        });

        return listViewItem;

    }
    protected void DeleteClient_api() {
        final StringRequest stringRequest = new StringRequest(Request.Method.POST, "http://befoodie.co/billingsystem/client_api.php",
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                       // Toast.makeText(getContext(), response, Toast.LENGTH_LONG).show();
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(getContext(), error.toString(), Toast.LENGTH_LONG).show();
                    }
                }) {
            @Override
            protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<String, String>();
                // final String session = ActivityLogin.MostSecureRandom.nextSessionId();
                params.put("Action", "RemoveClient");
               params.put("ClientID",textViewname.getText().toString());

                return params;
            }

        };

        RequestQueue requestQueue = Volley.newRequestQueue(getContext());
        requestQueue.add(stringRequest);

    }
}

ViewAllClient.java
public class ViewAllClient extends Fragment {

    private ListView listView;

    //create Array of product Details

    public ViewAllClient() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.activity_view_all_client, container, false);

        //   listView = (ListView) rootView.findViewById(R.id.listviewclient);
        listView = (ListView) rootView.findViewById(R.id.listviewclient);
       View_api();
               return rootView;
    }
    protected  void View_api(){
        final StringRequest stringRequest = new StringRequest(Request.Method.POST, "http://befoodie.co/billingsystem/client_api.php",
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                     showJSON(response);   //Toast.makeText(getActivity(), response, Toast.LENGTH_LONG).show();
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(getActivity(), error.toString(), Toast.LENGTH_LONG).show();
                    }
                }) {
            @Override
            protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<String, String>();
                // final String session = ActivityLogin.MostSecureRandom.nextSessionId();
                params.put("Action", "ViewClients");
                return params;
            }

        };

        RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
        requestQueue.add(stringRequest);

    }

    protected  void showJSON(String json){
        ParseJSON pj = new ParseJSON(json);
        pj.parseJSON();

        final CustomList cl = new CustomList(getActivity(), ParseJSON.CLIENTID,ParseJSON.mobile,ParseJSON.grand, ParseJSON.billid);
        listView.setAdapter(cl);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            }
        });

    }

}

ParseJSON.java
public class ParseJSON  {

    public static String[] CLIENTID;
    public static String[] mobile;
    public static String[] grand;
    public static String[] billid;

    public static final String JSON_ARRAY = "ClientDetails";
    public static final String KEY_ID = "ClientID";
    public static final String KEY_MOBILE = "ClientName";
    public static final String KEY_GRAND = "EmailID";
    public static final String KEY_BILL = "StartingCommunicationDate";

    private JSONArray users = null;

    private String json;

    public ParseJSON(String json){
        this.json = json;
    }

    protected void parseJSON(){

        JSONObject jsonObject=null;
        try {
            jsonObject = new JSONObject(json);
            users = jsonObject.getJSONArray(JSON_ARRAY);

            CLIENTID = new String[users.length()];
            mobile = new String[users.length()];
            grand = new String[users.length()];
            billid = new String[users.length()];

            for(int i=0;i<users.length();i++){
                JSONObject jo = users.getJSONObject(i);
                CLIENTID[i] = jo.getString(KEY_ID);
                mobile[i] = jo.getString(KEY_MOBILE);
                grand[i] = jo.getString(KEY_GRAND);
                billid[i] = jo.getString(KEY_BILL);

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

A: Call adapter.notifyDataSetChanged() on your Adapter object once you've modified the data in that adapter. ;
Note : For an ArrayAdapter, notifyDataSetChanged only works if you use the add(), insert(), remove(), and clear() on the Adapter.

A: Try below code,
YourAdapter adapter = new YourAdapter(context, ListDataHeader, ListDataChild, data);
adapter.notifyDataSetChanged();

A: Hi @Dipu First you have to delete the item from the local jsonresponse(which is populating your list).After that you have to notify the adapter that the data has been changed.If you deleted from inside the adapter simply write notifyDataSetChanged(); after deleting the item.
If you are deleting from the class then you have to simply write
adapter.notifyDataSetChanged();

I hope it helps

A:     // in ViewAllClient fragment

    public void delete(int position){
      adapter.notifyItemChanged(position);//-- only update the required row
   // notifyDataSetChanged for full listview

}
// in adapter
ViewAllClient  viewAllClient =new ViewAllClient();
viewAllClient .delete(position);


text:
Q: Is having docker installed a massive security hole? Suppose I have an Ubuntu machine and did sudo apt install docker.io. Did I just put a huge security hole in my machine that will allow anyone with terminal access to escalate into root?
I ask that because I can mount any directory as a volume inside a container, escalate to root inside the container, and it seems I can do whatever I want in the mounted volume. All this seems so wrong that I feel I am certainly missing something. Or it is simple as that, and there really is a "sudo" replacement in Ubuntu's repository that doesn't ask for password?

A: Yes, but possibly not quite as bad as you imagine. As the other answers have told you, there are some access controls in place so that it does not immediately give root to arbitrary local users (only ones in the access list), but it's still a big footgun. Docker is not a sandbox, at least not in the standard configuration.
If you can, you should read up on and consider using rootless Docker, or at least using userns-remap mode. These can be made sandbox-like, and if configured with some care do not allow arbitrary users with access to Docker to achieve root on the host (at least not without other local vulns).

A: Not quite, you're allowing anyone in the docker group to escalate into root. This is described in /usr/share/doc/docker.io/README.Debian:

As noted in the upstream documentation (https://docs.docker.io), Docker will
allow non-root users in the "docker" group to access "docker.sock" and thus
communicate with the daemon.  To add yourself to the "docker" group, use
something like:
adduser YOURUSER docker
As also noted in the upstream documentation, the "docker" group (and any other
means of accessing the Docker API) is root-equivalent.  If you don't trust a
user with root on your box, you shouldn't trust them with Docker either.
If you are interested in further information about the security aspects of
Docker, please be sure to read the "Docker Security" article in the
upstream documentation:
https://docs.docker.com/engine/security/security/

If you're interested in being able to run (most) OCI containers without requiring root-equivalent privileges, take a look at Podman.

A: No. Having Docker installed doesn't allow anyone to use it by default.
$ docker info
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/info: dial unix /var/run/docker.sock: connect: permission denied

As an ordinary user, you don't have the privilege to even connect to the Docker daemon, let alone instruct it to run something in a container.
On the other hand, any user who is in the docker group effectively has root powers on the host. It's very difficult to allow users to create a Docker container without giving them root powers on the host. You can allow users to run an application in a Docker container if the container is configured securely. A secure configuration must not grant access to any sensitive files on the host and should include a USER directive that doesn't grant root access inside the container. (Preventing root from escaping a container is possible, but tricky.)
The "sudo replacement" is adduser alice docker or having alice ALL = ( : docker) docker in /etc/sudoers, not merely installing docker.io.


text:
Q: Using GAP to determine when cosets are equal to each other. Let $P1 = SL_{2} (\mathbb{F}_{2} [[t]])$ and $P2= \{ [a \; t^{-1}b ; tc \; d] | a,b,c,d \in \mathbb{F}_{2}[[t]], ad-bc = 1 \}$. I am considering cosets of $P1$ and $P2$. For instance, $[0 -1/t; t 0]P1$ and $[0 \; -1 ; 1\; 0 ]P2$.
I want to multiply these cosets on the left by elements of a group with generating set $\{ [1 \; 1 ; 0 \; 1], [1 \; t ; 0 \; 1] , [1 \; 0 ; 1 \; 1] [1 \; 0 ; t \; 1] , [t \; 0 ; 0 \; t^{-1}] \}$.
How can I use GAP to determine when these cosets are equal to each other?


text:
Q: A system of $m$ linear equations and $n$ variables? Consider a system of $m$ linear equations and $n$ variables ?

*

*If $m<n$, then all such systems have a solution.

*If $m>n$, then none of these systems has a solution.

*If $m=n$, then there exists a system which has a solution.

How can I Prove/Disprove above statements ? Any Examples ?

A: *

*$m=2<n=3$: No,
$$
\cases{x+y+z=0\\x+y+z=1}
$$
has no solution.

*$m=2>n=1$: no,
$$
\cases{x=1\\2x=2}
$$
has a solution.

*$m=n$: yes, $Ax=0$ has a solution $x=0$.