text:
Q: Transfer Fault on SAME70 Xplained Microcontroller I am using a SAME70 Xplained microcontroller for a project I am working on. I program it using an editor made by Microchip called MPLAB X. About a week ago, suddenly I could no longer upload any code to the board as I keep receiving the error
java.lang.RuntimeException: java.lang.RuntimeException: TransferFault
Resetting the board, uploading different code or using other features in the program to interact with it do nothing. An important note is that when I got ahold of a brand new board of the same type and tried to upload to the board, it actually succeeded the first time. But then for some reason later the same error pops up again. It seems the issue is a bit more than downloading code as the function in the program which allow for uploading code or pausing the controller throw the same error. I have been struggling with this issue for over a week now and cannot use the board because of it. I cannot find any mention of this issue on the internet. Has anyone ever encountered this? Does anyone know the specifics of what a transfer fault is and can point me in the right direction?


text:
Q: newly installed mysql configurations for php usually i used to download and install xampp or wamp, but this time i tried setting up apache24, php individually.
Well apache and php is working fine, except i want to install mysql.
i downloaded and installed mysql 64bit MSI installer from this below link
http://dev.mysql.com/downloads/mysql/

but after that i dont know what to do with that because i can not connect do database, what is database username password etc etc..
i tried to lookup over internet, i found i have to do some changes in my.ini, but i dont have my.ini, instead i have my-default.ini, so i put values of port directory etc.
If anyone can direct me to right path or give me link, what is the best way to configure mysql with step by step instruction.
my-default.ini
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = C:/mysql/
datadir = C:/mysql/data
port = 3306
# server_id = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

redpajama_set_name: RedPajamaStackExchange


text:
Q: problem with python code of writting recognition I have got a python code from githab which is used for recognizing a hand written pcture (ex. a number) but there is proble. when I run the code an error about line 4 which is " label = int(image_file_name[-5:-4])" appears. The exact description of the error is :"ValueError: invalid literal for int() with base 10: 'y'". Moreover, I have a 28*28 pixel photo which I want to be read by the code.
import imageio
import glob

import numpy
import matplotlib.pyplot
our_own_dataset = []
for image_file_name in glob.glob('my_own_images/2828_my_own_?.png'):
    print ("loading ... ", image_file_name)
    # use the filename to set the correct label
    label = int(image_file_name[-5:-4])
    # load image data from png files into an array
    img_array = imageio.imread(image_file_name, as_gray=True)
    # reshape from 28x28 to list of 784 values, invert values
    img_data  = 255.0 - img_array.reshape(784)
    # then scale data to range from 0.01 to 1.0
    img_data = (img_data / 255.0 * 0.99) + 0.01
    print(numpy.min(img_data))
    print(numpy.max(img_data))
    # append label and image data  to test data set
    record = numpy.append(label,img_data)
    print(record)
    our_own_dataset.append(record)
    pass

A: image_file_name is a string and you are trying to convert it into int. That is what the error means.i think the indexes when filtering in that string are wrong.
it should be int(9) but you got int('y')


text:
Q: flutter) How can I make the dialog disappear when the back button is pressed? I used a dialog to prevent the backbutton pressed like following
WillPopScope(
          onWillPop: () async => await onBackPressed(context:context, msg: 'back?')

Future<bool> onBackPressed(
    {required BuildContext context, required String msg}) async {
  bool willLeave = false;
  await showDialog(
      context: context,
      builder: (context) => AlertDialog(
              title: Text('$msg'),
              actions: <Widget>[
                TextButton(
                  child: const Text("OK"),
                  onPressed: () {
                    willLeave = true;
                    Navigator.of(context).pop();
                  },
                ),
                TextButton(
                    child: const Text("No"),
                    onPressed: () => Navigator.of(context).pop())
              ]));
  return willLeave;
}

By the way, when the dialog poped up, the dialog does not disappear although the button is pressed.
Does dialog disappear only the button or background screen tapped?
Can't I make it to disappear with the real back button?
Help me, please.. Thank you


text:
Q: Calling Oracle procedure with error I'm calling a procedure written in Oracle 11g from ColdFusion2016. I've been debugging since yesterday unsuccessfully, a little help is appreciated. I don't know if this error is caused my oracle procedure or Coldfusion so I did some test by calling the procedure from my oracle sql developer:
variable x refcursor;
variable y varchar2(200);
variable z varchar2(200);
exec um_check_alloc_bene_loadv2(v_session_id => 1, v_summary => :y, v_continue => :z, cv_1 => :x );
print x;
print y;
print z;

This get me some result. So, my assumption is that the error must be due to the ColdFusion call. But I can't see what's wrong with my call:
        <cfstoredproc procedure="um_check_alloc_bene_loadV2" datasource="#Trim(TESTDB)#">
          <cfprocparam type="in" cfsqltype="cf_SQL_INTEGER" variable="session_id" value="#Trim(max_session_id)#" MAXLENGTH="4">
          <cfprocparam type="out" cfsqltype="CF_SQL_VARCHAR" variable="summary" value="">
          <cfprocparam type="out" cfsqltype="CF_SQL_VARCHAR" variable="continue" value="">
        <cfprocresult name="errors" resultset="1">
        </cfstoredproc>

The beginning of the procedure looks like this:
create or replace PROCEDURE um_check_alloc_bene_loadV2 (
  v_session_id IN     NUMBER DEFAULT NULL,
  v_summary       OUT VARCHAR2                                /* DEFAULT ' '*/
                          ,
  v_continue      OUT VARCHAR2                                /* DEFAULT ' '*/
                          ,
  cv_1         IN OUT SYS_REFCURSOR)
AS
  v_rowcount   NUMBER (10, 0);
  v_errorcount NUMBER (5, 0);
BEGIN
  -- clean errors
  UPDATE um_allocation_beneficiary_ldV2
     SET errors = ' '
   WHERE session_id = v_session_id;

and when I call this proc from my ColdFusion I got this error that I cannot figure out:
Error Executing Database Query.
[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to
'UM_CHECK_ALLOC_BENE_LOADV2' ORA-06550: line 1, column 7: PL/SQL: Statement
ignored
........................................
138 :             <cfprocparam type="out" cfsqltype="CF_SQL_VARCHAR"
variable="summary" value="">
139 :             <cfprocparam type="out" cfsqltype="CF_SQL_VARCHAR"
variable="continue" value="">
140 :           <cfprocresult name="errors" resultset="1">
141 :           </cfstoredproc>
142 :           <table align="center" width="90%">

SQLSTATE      HY000
DATASOURCE    TESTDB
VENDORERRORCODE   6550
SQL   {call um_check_alloc_bene_loadV2( (param 1) , (param 2) , (param 3) )}
Resources:

A: Your procedure is expecting four parameters such as below but you pass only three parameters. Thanks.
PROCEDURE um_check_alloc_bene_loadV2 (
  v_session_id ,
  v_summary    ,
  v_continue   ,
  cv_1         )


text:
Q: How to apply validation on data stored in txt,csv,xls,xlsx file I want to select the File(txt,csv,xls,xlsx) and then apply validation on the structure of the file. I have a DTO(Data Transfer Object) and want to validate the file using the DTO. For ex- DTO has three properties (Name,Class,Roll no) then the selected excel file should have the same columns.

A: You can't validate data when data is in the file(csv,txt...) .You must read data into computer memory,then through differrent metho to read data in different type of file.
For example,you can read txt File through File.ReadAllText,but you can't read Excel by the same way.
On my opinion,you can try...catch... wrap the read file code,if any exception is thrown,then file is not exactly what you want.


text:
Q: How to zip many n-th level subdirectories, without their top (parent) dir? in such a filesystem structure:
root/
    |
    container1/
    |         |
    |         subdir2/
    |                |
    |                subdir3/
    |                       |
    |                       subdir4/
    |                              |
    |                              file1
    |                              file2
    |                              subdir5/
    container2/
              |...

I need to zip everything:

*

*under `/subdir4/``

*without the /subdir4/ itself

*in all potential /container/ subdirs of the root/directory

*name the zip the same as the parent folder of the contents being zipped (in this case, it would be "subdir4.zip")

Please bear in mind:

*

*these are not the real names of dirs and subdirs, it's just an approximation

*I am using ZSH on a Mac OSX

*I am quite new to Unix/Linux scripting

I would really like a shell-agnostic, simple, loop kind of solution so I can learn as much as possible and be flexible in modifying this solution for other potential cases.
Here is what I have tried so far, as suggested by friends:
find . -mindepth 5 -maxdepth 5 -type d -exec sh -c '
pushd "$0/..";zip -rFS "$(basename "$0").zip" "$(basename "$0")";popd ' {} \;

In the meantime, I have learned that this solution has the following drawbacks:

*

*$0 should not be used as positional parameter because it is used in error reporting and/or as the shell script name (in my case, it's just a string)

*basename and dirname are best avoided if using bash (read more here)

*this syntax, with ... {} \;invokes as many shells as there are results, supposedly not efficient way of doing this type of operation

I should have been using:

*

*$1 in my positional parameters

*... ;popd ' sh {} +
That one is supposed to get all the results in a sort-of an "array/list" and apply the commands within the string passed to the sh all at once.
Thanks!
BONUS POINTS: :)

*

*can I name the resulting .zip same as /subdir3/ instead of as /subdir4/ from this hierarchy?

A: You can use awk to create the system command to execute
find * -mindepth 5 -maxdepth 5 -type d  | awk -F"/" '{system( "cd "$0"; zip -rF "$NF".zip *")}'

The -F splits the line on / , $0 represents the complete line and $NF has your actual directory name.  There is no popd required since the system command executes in its own shell, and the parent shell stays in the current working directory.


text:
Q: TypeError: this.name is not a function In the below code I always get an error "TypeError: this.verifyUrl is not a function at Server.ImageServer.handleRequest" even though the function is defined above.
Any hint welcome.
The same applies if i write the sample in pure JavaScript.
"use strict";

import Http = require('http');
import Url = require('url');

export class ImageServer {

    port: number;
    server: Http.Server;

    constructor(port: number) {
        this.port = port || 1337;
    }

    run() {
        this.server = Http.createServer(this.handleRequest);
        this.server.listen(this.port);
    }

    verifyUrl(urlitems: Url.Url) {
        return true;
    }

    handleRequest(req: Http.IncomingMessage, res: Http.ServerResponse) {
        console.log('request: ', req.url);
        var urlitems = Url.parse(req.url, true);
        var pathitems = urlitems.path.split('/').slice(1);

        console.log('url: ', urlitems);
        console.log('path: ', pathitems);

        if (!this.verifyUrl(urlitems)) {
            this.sendNotFound(res);
            return;
        }

        res.writeHead(200, { 'Content-Type': 'text/plain' });
        res.end('Hello World\n');
    }

    sendNotFound(res: Http.ServerResponse) {
        res.statusCode = 404;
        res.end();
        return undefined;
    }

}

A: Try this:
"use strict";

import Http = require('http');
import Url = require('url');

export class ImageServer {

    port: number;
    server: Http.Server;

    constructor(port: number) {
        this.port = port || 1337;
    }

    run() {
        this.server = Http.createServer(this.handleRequest);
        this.server.listen(this.port);
    }

    verifyUrl(urlitems: Url.Url) {
        return true;
    }

    handleRequest = (req: Http.IncomingMessage, res: Http.ServerResponse) => {
        console.log('request: ', req.url);
        var urlitems = Url.parse(req.url, true);
        var pathitems = urlitems.path.split('/').slice(1);

        console.log('url: ', urlitems);
        console.log('path: ', pathitems);

        if (!this.verifyUrl(urlitems)) {
            this.sendNotFound(res);
            return;
        }

        res.writeHead(200, { 'Content-Type': 'text/plain' });
        res.end('Hello World\n');
    }

    sendNotFound(res: Http.ServerResponse) {
        res.statusCode = 404;
        res.end();
        return undefined;
    }

}

I suppose you call handleRequest as a callback from a module (probably expressjs?), so this is not binded to the class scope but to the module's scope. Using arrow functions, this will be automatically assigned to the class scope and so you can access to your class functions/properties
Here's your problem explained with examples
class Hi {
   hello: string = "Hello world!";

   haha(req: Http.IncomingMessage, res: Http.ServerResponse) {
      console.log(this.hello) // print undefined or error
   }
}

var hi = new Hi();

app.get("/foo", hi.haha);

With this code, you can't access to the class properties because this is assigned to express.
You can fix it as said above with arrow functions. Here's a working example:
class Hi {
   hello: string = "Hello world!";

   haha = (req: Http.IncomingMessage, res: Http.ServerResponse) => {
      console.log(this.hello) // print Hello world!
   }
}

var hi = new Hi();

app.get("/foo", hi.haha);

A: At a quick glance it looks like a scope issue since at the time of invokation this refers to the scope of Http.createServer(). A quick fix would be to bind to the actual object scope imo.


text:
Q: Assigning object type in plsql I need your help to know how to assign the object type through a string in PLSQL
Below is the problem description:
I first created the object types as below:
create or replace type picu_obj is  object(Customer_ID varchar2(32767),Customer_Name varchar2(32767),Server_Name varchar2(32767),Time_stamp varchar2(32767));
create or replace type picu_obj_tab is table of picu_obj;

and I have a PLSQL block as below:
declare
 l_str1 varchar2(1000);
  l_str2 varchar2(10000);
   l_newstr1_1 varchar2(10000);
   picu_var picu_obj_tab;
   cursor c1cudetails
  is
    select item,current_value
    from
      (select rownum,
        last_value(category ignore nulls) over (order by rownum) category ,
        last_value(item ignore nulls) over (order by rownum) item,
        current_value
      from pi_perfdata_new
      order by rownum
      )
  where upper(category) like '%CUSTOMER%DETAILS%' ;
  type cudet is table of c1cudetails%rowtype index by pls_integer;
  l_cudet cudet;
begin
/* create dynamic string for items */
  open c1cudetails;
       fetch c1cudetails bulk collect into l_cudet limit 50;
       for i in l_cudet.first..l_cudet.last loop

       l_str1:=l_str1||','||''''||l_cudet(i).current_value||'''';
       l_str2:=trim(leading ',' from l_str1);
       l_newstr1_1:='picu_obj_tab(picu_obj('||l_str2||'))';
       end loop;
      --  dbms_output.put_line(''||l_newstr1_1||'');
     -- picu_var := l_newstr1_1;
   close c1cudetails;
  end;

For the string "l_newstr1_1" following value is retruned from above PLSQL block
picu_obj_tab(picu_obj('CSCO5','DXRTYE','PI22-pro-333','2015-07-22-22:48:56'))

Now I want to assign the above result to variable  "picu_var"  which I have declared.
Basically I need to convert to the following during runtime.
picu_var := picu_obj_tab(picu_obj('CSCO5','DXRTYE','PI22-pro-333','2015-07-22-22:48:56'))

How to achieve the same?
Please suggest how to initialize the object type variable to the string values.

A: Use dynamic PL/SQL like this:
execute immediate 'begin :x := ' || l_newstr1_1|| '; end;'
   using out picu_var;


text:
Q: How can I close or minimize the Windows 10 on screen Keyboard using JAVA? I have tried executing a taskkill to shut down the On screen Keyboard in windows 10 (OSK.exe), but the OSK seems to behave differently in windows 10... while I can launch the application, I cant shut it down as before with taskkill.  Even in the command prompt I get an access denied error...
I would settle for the ability to at least minimize it, but that is something I don't know how to do.. any suggestions?
My processing line looks like this
public void onScreenKbdMain_click1(GImageButton source, GEvent event) {
  println("onScreenKbdMain - GImageButton >> GEvent." + event + " @ " + millis());
  if (keyboardOnOff == false) {
    sentense="Onscreen keyboard activated";
    String[] params = {
      "C:/bala/bala.exe", "-t", sentense
    };
    launch(params);
    //pKeyboard = open(new String[] { "c:/Windows/system32/osk.exe" } ); // Windows Keyboard
    pKeyboard = launch(new String[] {
      "osk"
      }
      ); // Windows Keyboard
    keyboardOnOff=!keyboardOnOff;
    //println("keyboardOnOff= "+keyboardOnOff);
  } else {
    sentense="Onscreen keyboard disabled";
    String[] params = {
      "C:/bala/bala.exe", "-t", sentense
    };
    launch(params);
    pKeyboard = launch(new String[] {
      "taskkill IM/osk.exe/T/F"
      }
      ); // Windows Keyboard
    keyboardOnOff=!keyboardOnOff;
    //println("keyboardOnOff= "+keyboardOnOff);
  }
}

A: Check my answer here: https://stackoverflow.com/a/71410876/12346089 is using TabTip.exe instead of osk.exe but it may work for you.


text:
Q: JS: Processing form as a POST but retrieving as a GET? Retrieving the data with PHP, I cannot use $_POST; but $_GET. Why? Am I sending my form data incorrectly?
I'd have thought request.open("POST" would process the form as a POST and not GET? How may I sent it as a POST?
var request = new XMLHttpRequest();
request.open("POST","email.php?text=" + textarea.value + "&email=" + email.value, true);

request.onload = function() {
    if (request.status >= 200 && request.status < 400) {
        var resp = request.responseText;

        console.log(resp);

    }
};

request.send();

A: Because you're adding data inside the URL.
Change your request to:
request.open("POST","email.php", true);
request.setRequestHeader("Content-length", 2); // 2 here is the no. of params to send
....

request.send("text=" + textarea.value + "&email=" + email.value);

Docs: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

A: The reason is you are sending the variables in the url that is why you are getting in get. See this example post
var http = new XMLHttpRequest();
var url = "get_data.php";
var params = "lorem=ipsum&name=binny"; // all prams variable here
http.open("POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
    if(http.readyState == 4 && http.status == 200) {
        alert(http.responseText);
    }
}
http.send(params);


text:
Q: save Dynamic Link Library (DLL) in database How can i save a DLL in sql table BINARY(n), and then retrieve it save on disk and reference to it, so the main application can use it? (c#)

A: After you return the DLL from the database and save the file, you can then use the AppDomian class to load your DLL. Please refer to AppDomainProject for sample code.
Load the DLL call a method in the DLL and then unload the DLL
Nequeo.Reflection.AppDomianHost host = new Nequeo.Reflection.AppDomianHost(@"D:\Development\Version2015\Test\LoadUnload\ConsoleLoadUnload\bin\Debug");
int ret = host.Instance.ExecuteMethod<int>("ConsoleLoadUnload", "ConsoleLoadUnload.Test", "EntryPoint", new object[] { (int)6, (int)6 });
host.Unload();

textBox1.Text = ret.ToString();

A: Reference this answer https://stackoverflow.com/a/2579467/1865718 for save file into database and get file from database.
Then you can use the dll through System.Reflection.Assembly.Load(bytes); or System.Reflection.Assembly.LoadFrom('File path');.


text:
Q: Strange performance test results for LAMP site We have an online application of large amount of data in tables ranging usually from 10+ million in each table.
The performance hits i am facing is in reporting modules  where some charts and tables are displayed loads very slow.
Assuming that total time = PHP execution time + MYSQL query time + http response time
To verify this when i open phpmyadmin which again another web app.
If i click a table with 3 records (SELECT * from table_name) = total time for displaying is 1 - 1.5 seconds. i can see mysql query time 0.0001 sec
When I click a table with 10 million records = total time is 7 -8 second and mysql query time being again close to 0.0001 sec
shouldnt the page load time be the sum of mysql and script run times ? why it loads slow when mysql rows has larger data even mysql says it took same time.

A: PHPMyAdmin uses LIMIT, so that's an irrelevant comparison.
You should use EXPLAIN to see why your query is so awfully slow. 10 million is a small dataset (assuming average row size) and shouldn't take anywhere near 7 seconds.
Also, your method of counting the execution time is flawed. You should measure by timing the individual parts or your script. If SQL is your bottleneck, start optimizing your table or query.


text:
Q: Loading External .js file that requires jQuery So there I am trying to load an external .js file which in return loads other pages using $.ajax and jQuery Templates. Everything was working when my code was all in a single .aspx page. But after distributing everything to separate clean files I am having this error:
Default.aspx
<asp:ScriptManagerProxy ID="ScriptManagerProxy" runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/Scripts/jquery-1.7.min.js" />
        <asp:ScriptReference Path="~/Scripts/jQuery.tmpl.min.js" />
        <asp:ScriptReference Path="~/Pages/Templates/Stream/Stream.js" />
    </Scripts>
</asp:ScriptManagerProxy>

Stream.js
GetStream();

 function GetStream() {
        alert('ok');
        $.ajax({ /* It reaches this line */
        type: 'POST',

But returns the following.
$ is undefined

Please note that I have added the Stream.js file seperately without using the ScriptManagerProxy below the jquery-1.7 file. And still got the same thing. Ideas?
I forgot to mention that the content of Stream.js is wrapped in:
$(document).ready(function () { });

A: What is the benefit of using the script manager for this? It's just going to format/output HTML  tags.. Why not use HTML instead.
<script language="javascript" src="/Scripts/jquery-1.7.min.js"></script>
<script language="javascript" src="/Scripts/jQuery.tmpl.min.js"></script>
<script language="javascript" src="/Pages/Templates/Stream/Stream.js"></script>

A: You should reference the external file in the ScriptManagerProxy to make sure they're executed in the correct order.


text:
Q: Initializing a ActionBarDrawerToggle with some confusing code Android Studio 1.1 Beta 4

Hello,
I am expecting some source code below, and I can't understand the reason behind it. I can understand this part
 ActionBarDrawerToggle mActionBarDrawerToggle =
                    new ActionBarDrawerToggle(getActivity(), mDrawerLayout, toolbar, R.string.open, R.string.close)

Creating a new instance of the ActionBarDrawerToggle with a constructor that takes 5 arguments.
The part this is confusing is why the braces after, I have never seen that before. Is this a shortcut of doing something?:
{
    @Override
    public void onDrawerOpened(View drawerView) {
        super.onDrawerOpened(drawerView);
    }

    @Override
    public void onDrawerClosed(View drawerView) {
        super.onDrawerClosed(drawerView);
    }
};

complete:
 private void init() {
        ActionBarDrawerToggle mActionBarDrawerToggle =
                new ActionBarDrawerToggle(getActivity(), mDrawerLayout, toolbar, R.string.open, R.string.close) {
                    @Override
                    public void onDrawerOpened(View drawerView) {
                        super.onDrawerOpened(drawerView);
                    }

                    @Override
                    public void onDrawerClosed(View drawerView) {
                        super.onDrawerClosed(drawerView);
                    }
                };

A: The given construction:
SomeType st = new SomeType(){
    ...
}

creates anonymous subclass extending SomeType and allows to override/add methods, add members, make initialization etc
In your case {} creates anonymous subclass extending ActionBarDrawerToggle and overriding methods onDrawerOpened() and onDrawerClosed().
P.S. It's useful when you need class only once.

A: ActionBarDrawerToggle implements DrawerLayout.DrawerListener which has abstract methods. This means you have to define them.
ActionBarDrawerToggle does define them itself but you can overwrite them in {} after the constructor. Actually you are creating an anonymous subclass of ActionBarDrawerToggle. (A class without a name)
You can read about it in the Java documantation


text:
Q: visual 2015 shortcut search untiy API Referring to https://www.youtube.com/watch?v=7C7WWxUxPZE 4:48
Does Visual studio 2015 have a shortcut to search the unity API, and if so what is the shortcut?

A: The standard shortcut is:  CTRL + ALT + M, CTRL + H
If you want a simpler shortcut or even to make it the same as in MonoDevelop, you can do the following...
Open Visual Studio
Go to: Debug > Options and Settings > Environment > Keyboard
Find command "Help.UnityAPIReference"
Assign a new shortcut. Personally I am using CTRL+ALT+'
Original here


text:
Q: What cohomology theories would be interesting for nilpotent cones/nullcones? As I understand, when we have a nilpotent cone, or a nullcone of a Lie group representation, what seems to be done in a lot of the literature (e.g. Achar&Henderson-"Orbit closures in the enhanced nilpotent cone") is to compute the intersection cohomology sheaves and find polynomials that determine the dimensions of various stalks.
But what other cohomology theories (that are different to intersection cohomology, I understand sometimes two different cohomology/homology can coincide under special circumstances), would be interesting in nilpotent cones?
Here's a bit about the problem I'm working on, and some theories that I hope (?) might be interesting, can anyone tell me some more that might be interesting? I am very far from being knowledgeable about cohomology, so if some-one could tell me if the following questions are stupid/trivial/ill-defined or not, please tell me.

*

*I have the orbits, which themselves are usually quasi-affine or quasi-projective varieties, which I could compute cohomology of? (perhaps Cech cohomology?)

*The set of orbits inherits a Zariski topology structure from the Zariski topology structure (that coincides with that inherited from the classical topology), perhaps I can compute some (co)homology of this topological space? In my case the set of orbits is uncountably infinite, but I am not completely sure if it has a triangulation - any theory that doesn't involve triangulations?

*As standard, one computes the orbit closures, and instead of doing intersection cohomology of these singular varieties, compute perhaps some of the lower K-groups?

*perhaps Hochschild cohomology of the coordinate rings of some of the affine coordinate rings of these varieties could be interesting?

A: I'll just note: as a general rule, it's a very bad idea to take cohomology of anything in the Zariski topology.
Also, nilcones are always contractible (in both the Zariski and classical topology), so you won't get anywhere with any theory that's homotopy invariant (intersection cohomology isn't).
I'm not sure what else to tell you; I'd say that intersection cohomology is by far the most obvious answer to your question, so I'm not sure why you're so eager to rule it out (unless it's already known).

A: I think most questions of interest regarding the nilpotent cone have to do with categories of equivariant sheaves on it - either equivariant perverse sheaves, like IC complexes of orbits, or equivariant coherent sheaves, like structure sheaves of orbit closures. So cohomologies that help elucidate the structure of these categories would be great. For example, equivariant IC of orbit closures fits into this, as does ordinary cohomology of orbit closures. Hochschild homology/cohomology of structure sheaves or K-theory likewise control aspects of the category of coherent sheaves, and you could ask for equivariant analogs.
But I would say history suggests it's best to emphasize two things:
-the full structure of the category (ie what are simples, standards, relations
between them)
-if you have an analog of the Springer resolution for these nullcones, its cohomologies might be even more interesting (or if you'd like, the pushforwards of standard sheaves from there to the nullcone..)


text:
Q: webbrowser URL from listview i have favorites in my c# webbrowser and i try to change the url when the form is closing
my code:
    private void Favorites_FormClosing(object sender, FormClosingEventArgs e)
    {
        System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Application.StartupPath + "\\Favorites.xml", null);

        writer.WriteStartElement("Favorites");
        for (int i = 0; i < listView1.Items.Count; i++)
        {
            writer.WriteStartElement("Item");
            writer.WriteAttributeString("url", listView1.Items[i].Text);
            writer.WriteEndElement();
        }
        writer.WriteEndElement();
        writer.Close();
    }

How do i change the url when the form is closing?


text: Q: Unity3d - Can a package installation modify a project? I would like to create a package that makes changes in the project when it is installed. like add a script to all colliders when the package is installed. Is it possible?


text:
Q: Recovering from "chmod -R 777 /" in Ubuntu
Possible Duplicate:
Wrongly set chmod / 777. Problems?

I am using Ubuntu for  development purposes.
As I work on the database side, there are a lot of things which require file permissions in order to access the data directory or some other according to the requirement.
Every time I get an errors like:
[ERROR] path/to/directory/ permission denied

To avoid it I have to log in as root root from the terminal and give access to that directory with:
chmod -R 644 /path/to/directory

To avoid this problem completely, I have given full access privileges with the following command:
chmod -R 777 /

Now my system has some problems.
I am not able to log in as a root neither from OS accounts nor from the terminal. And if I restart the system I am not sure it will boot smoothly.
I think some of the files which should not be given the full access are given the full access and I don't know what those file are.
Can any one help me out?

A: chmod -R 777 /

If you ever find yourself thinking of recursively applying mode 777 to any directory, please stop and take a moment to make absolutely sure that's what you want to do. 777 is shorthand for:

*

*permit read, write and execute for the file's owner

*permit read, write and execute for members of the file's group

*permit read, write and execute for everyone on the system

(for simplicity's sake, I'll ignore the issue of setuid, setgid and sticky bits)
This is almost always not what you want.
Recursively applying this to the root (/) of the filesystem will set these permission on every file and directory on your machine . This is definitely Not What You Want.
In terms of recovering from this... purely hypothetically, if

*

*Your Ubuntu box is still running sshd, and you can log into ssh as root

And you have another machine that

*

*Can connect to your development machine over ssh

*Has a filesystem that is very, very similar to your development machine (say, a clean installation of the same version of Ubuntu, and your DBMS of choice)

the following commands will copy that machine's file permissions onto your development box:
sudo find / -print0 | \
xargs -0 stat -c "chmod %a '%n'; chown -h %U:%G '%n';" | \
ssh user@your-development-machine

This will take some time to run.
This has a good chance of fixing a large number of the 777'd permissions on your Ubuntu box. However, even in the best case you should expect that you will encounter more permissions-related errors that you will need to fix manually.
The other option, and the one I would recommend, would be to start over completely. Backup your data, reinstall Ubuntu, your DBMS and any other software required on your development box.

A: Giving the whole world read, write and execute access to your filesystem is usually a very bad idea. On the one side everyone with access to your computer can do basically anything with the system. And furthermore there are several system daemons like ssh which check the permissions of directories and files. If they are not correct, those daemons often fail to start.
The best solution for your current situation would be to restore it from a backup. So you get easily all files with the correct permissions back.
If you don't have a backup, the next practical solution would be to reinstall the system. So first you make a backup of your files, save the installed software (dpkg --get-selection > installed-software.txt), then install a new system and also install the software which you used (apt-get update && dpkg --set-selection < installed-software.txt && apt-get -u dselect-upgrade). Now you have a fresh system and you can update your config files.
Another solution would be to write a script. This script should walk through your filesystem recursively and compare the permission of each file and directory with some other system. It can change the permissions according to the other system. You maybe need to change some values, but this script could do the main work for you.
This solution will also work, if you have physical access to your computer. Just boot it from a Live-CD or USB stick and mount the file system. Or you can also remove your harddrive and mount it at another computer.
However from my perspective the fastest way to get a working system back would be backing it up and reinstalling it.

A: If you no longer have root access you are out of luck, Reinstalling is your best bet.
There are files with fancy permissions like 4755 like the command su and sudo, and without that they won't run.


text:
Q: Media queries not working as expected (Hidden classes Bootstrap) On certain breakpoints in the browser I am getting some unexpected results while using Bootstrap (V3.3.7). So I set up a little experiment with the BS hidden classes.
The BS CSS file contains the following CSS for the hidden classes:
@media (max-width: 767px) {
  .hidden-xs {
    display: none !important;
  }
}
@media (min-width: 768px) and (max-width: 991px) {
  .hidden-sm {
    display: none !important;
  }
}
@media (min-width: 992px) and (max-width: 1199px) {
  .hidden-md {
    display: none !important;
  }
}
@media (min-width: 1200px) {
  .hidden-lg {
    display: none !important;
  }
}

I have set up the following code:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Test Bootstrap hidden classes</title>

    <link rel="stylesheet" type="text/css" href="http://getbootstrap.com/dist/css/bootstrap.min.css">

Hidden xs

Hidden sm

Hidden md

Hidden lg

With the CSS I expect at all time there will be 3 elements visible in my set up. However on window widths 767, 991 and 1199 there are 4 elements present. I tested this in Chrome and Firefox.
I was under the assumption the way media queries in BS are used, is the correct way. Why am I getting this result? Am I missing something or is BS using media queries wrong?

A: I'm having a similar issue in my project, so I edited the bootstrap code like this, and it seemed to fix the issue.
@media (max-width: 767.99px) {
  .hidden-xs {
    display: none !important;
  }
}
@media (min-width: 768px) and (max-width: 991.99px) {
  .hidden-sm {
    display: none !important;
  }
}
@media (min-width: 992px) and (max-width: 1199.99px) {
  .hidden-md {
    display: none !important;
  }
}
@media (min-width: 1200px) {
  .hidden-lg {
    display: none !important;
  }
}

I think the underlying issue here is that the browsers are measuring out width in fractions of pixels, but the css leaves a 1 pixel gap between the classes.


text:
Q: Monadic second-order theories of the reals I'm looking for a survey of monadic second-order theories of the reals.
I'm starting from a 1985 survey by Gurevich which says (p 505) that true arithmetic can be reduced to "the monadic theory of the real line" even though true arithmetic can not be interpreted in that theory.  But which monadic theory does he mean?  And is there a good reference for the latter claim, for which he cites a 1981 preprint with Shelah?
I think he means the theory in the language with two predicates, one for inclusion and one for openness of subsets. In any case I'd like a reference that covers monadic second-order theories with < and + as well.
Most work on monadic second-order logic seems to focus on orders and trees, which makes it harder to find what I'm looking for. Is there a good reference on monadic second-order theories of the reals from more recently than 1985?


text:
Q: using nameserver for redirection I have bought a domain for cheap on crazydomains. The sad thing is they do not provide DNS settings without paying additional amount. They just give us a feature to set the nameserver details and some thing called 'Host records'.
Is there any way to use the nameserver settings to redirect the domain to a blog address ?
And also is there any chance to avail free DNS services offered by many sites just by using the nameserver feature provided by Crazydomains ?

A: you can use the host records only to redirect to an IP.
If they provide a feature like hosting a single HTML file, you can use an HTTP redirect. For example, create an index.html File with the following content and adapt the URL in it to point to your blog:
<meta http-equiv="Refresh" content="1; URL=http://www.some-other-server.foo/some/path/to/your/blog.html">

There are other options like a php-Redirect. Example:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.exampledomain.foo/" );
?>

As long as you don't have your own Server to where you can point your IP to, this is the only way I can think of.
Good luck!

A: Have you tried DNSEXIT it is free DNS service and you will get full control also dont forget to add NS record with your Domain Registrar.


text:
Q: Pass PHP variable to JavaScript thru the DOM works, but can't pass that same variable back from JS to PHP UPDATE: problem solved... see answer below
Summary:
I'm having trouble passing a variable from one PHP routine to JavaScript and then passing that same variable from JavaScript to a different PHP routine. JavaScript gets the variable from the first PHP routine and can work with it in JavaScript, but it doesn't seem to have it when I try to send it to a second PHP routine. Checking both before and after sending to the second PHP routine show that JS has the variable, but the PHP routine just gets null.
Details:
I want to pass a variable from PHP to JavaScript, do some stuff in JavaScript, then pass from JavaScript to PHP a new variable and the original PHP variable. In other words:

*

*Pass PHP variable --> JavaScript

*JavaScript does stuff and gets a resulting variable

*Pass JavaScript variable and PHP variable (from step 1) --> PHP

I pass the PHP variable to JavaScript by echoing the data into the page and use JavaScript to pull it from the DOM, an idea I found in the second suggestion in this great StackOverflow answer about passing variables from PHP to Javascript. Here's the code I'm using for this. There's no problem with it, it works great (or at least seems to?!).

<?php
$output = "php variable being passed to JavaScript";
echo htmlspecialchars($output);
?>

The problem is that when I try to use JavaScript to pass the variable back to PHP, it's not there. I can use it in JavaScript, do things with it, print it, play with it, whatever I want... but it's not there if I try to send it back to PHP. The code I use to pass it back:

In this code, the variable calculated by JavaScript, jsResultVar, gets sent from JavaScript to PHP with no problem.
If I hardcode PHPVar in the code above, e.g. "var PHPVar = 42", then the variable gets sent from JavaScript to the PHP routine with no problem.
But when I try to send the variable which PHP inserts for JavaScript to pull from the DOM, it doesn't get sent and sends a null instead. PHPVar definitely contains the variable in JavaScript; I've checked in simple ways by just writing it with JS onto the html page, and it's there both before and after trying to send to the PHP routine. But it just sends null to PHP.
What am I doing wrong?
PROBLEM SOLVED:
The suggestion of @vrijdenker was the right idea.
I played around with the line spacing of the code which PHP uses to send the variable to JavaScript. The code definitely works with the original line spacing in that JS can get the variable and use it... but the code can't be used as written to send that variable back from JS to a different PHP routine.
By changing the line spacing to put all of it on one line, JS is able to send the variable to the second PHP routine.
I actually pulled that code with the not-quite-working line spacing essentially verbatim from this great StackOverflow answer. I don't understand white-space issues well enough to suggest updating that answer, and I don't have the reputation points to put a comment on @SecondRikudo's answer, but if anyone is knowledgeable enough, it'd be helpful for the next person who hits this problem after using that code.
:)

A: So this is the part that was broken.

<?php
$output = "php variable being passed to JavaScript";
echo htmlspecialchars($output);
?>

Which could result in:

Some contents

OP is creating a variable out of it resulting in a variable like this:
var vars = "javaScriptResult=jsresult&PHPVar=\r\n
Some contents\r\n
";

(I placed the \r\n meaning a Windows linebreak. It may be just a \n if OP is on Linux for example).
In the comments above I suggested removing the linebreaks by moving the php tags, like this:

<?php
$output = "php variable being passed to JavaScript";
echo htmlspecialchars($output);
?>

Which would make:

Some contents

And result in
var vars = "javaScriptResult=jsresult&PHPVar=Some contents";

Since this fixxes the problem, one must note that if the contents themselves contain line-breaks the same problem would occur. Because of that one might take a look at this post as well: Pass a PHP string to a JavaScript variable (and escape newlines)


text:
Q: mdadm 10 far raid uneven read speed Why sequential read speed from raid 10 growth only with very huge bs(>100MB, dd parameter).
Having raid:
/dev/md127:
Version : 1.2
Raid Level : raid10
        Array Size : 46875009024 (44703.49 GiB 48000.01 GB)
     Used Dev Size : 11718752256 (11175.87 GiB 12000.00 GB)
      Raid Devices : 8
     Total Devices : 8
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

             State : clean
    Active Devices : 8
   Working Devices : 8
    Failed Devices : 0
     Spare Devices : 0

            Layout : far=2
        Chunk Size : 1024K

Consistency Policy : bitmap

I expect sequential read speed at least 100MB*n_drives=800+MB/sec.
But:
dd if=/dev/md127 of=/dev/null bs=10240k count=1000 iflag=direct
1000+0 records in
1000+0 records out
10485760000 bytes (10 GB, 9.8 GiB) copied, 14.2918 s, 734 MB/s

iostat -zxs 1
Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
md127          2880.00 737280.00     0.00    0.00   256.00    0.00   0.00
sda             360.00  92160.00     0.00    5.21   256.00    1.24  70.80
sdb             360.00  92160.00     0.00    5.05   256.00    1.14  74.80
sdc             367.00  93952.00     0.00    5.25   256.00    1.26  76.80
sdd             368.00  94208.00     0.00    6.46   256.00    1.70  80.80
sde             360.00  92160.00     0.00    5.53   256.00    1.31  75.60
sdf             362.00  92672.00     0.00    6.15   256.00    1.54  72.40
sdg             364.00  93184.00     0.00    5.18   256.00    1.24  73.20
sdh             364.00  93184.00     0.00    5.73   256.00    1.40  70.40

If I test single drive:
dd if=/dev/sda of=/dev/null bs=1024k count=1000 iflag=direct
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 4.25743 s, 246 MB/s

iostat -xs /dev/sda 1
Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
sda             868.00 222208.00     0.00    2.79   256.00    0.70 100.00

Only when I set bs very huge - I can gain read speed similar to single speed * n_drives:
dd if=/dev/md127 of=/dev/null bs=1024000k count=30 iflag=direct
30+0 records in
30+0 records out
31457280000 bytes (31 GB, 29 GiB) copied, 16.2737 s, 1.9 GB/s

iostat -dxs 1
Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
md127         10115.00 2341348.00     0.00    0.00   231.47    0.00   0.00
sda            1077.00 259848.00   187.00  153.82   241.27  163.51  95.20
sdb            1077.00 260612.00   197.00  162.94   241.98  173.33  99.20
sdc            1083.00 262412.00   197.00  160.82   242.30  171.96  98.40
sdd            1067.00 258568.00   195.00  170.78   242.33  180.09 100.00
sde            1086.00 262416.00   195.00  159.38   241.64  170.90  98.40
sdf            1077.00 260360.00   189.00  155.88   241.75  165.71  96.40
sdg            1073.00 259076.00   197.00  160.96   241.45  170.56  98.00
sdh            1085.00 260872.00   191.00  163.61   240.44  175.34  99.60

My workload contains mostly sequential reads, but I'm not sure that app will issue IO reads with such huge sizes.
Since test is performed on block device directly - this mean that problem is not in FS.
areq-sq in all cases near the same, but %util is lower for raid, does this mean that raid has the problems with generating requests(but aqu-sz is very huge for raid, also why?)?
How to find the reason?
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
Linux 5.4.0-67-generic #75-Ubuntu SMP Fri Feb 19 18:03:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cat /sys/block/md127/queue/scheduler
none

EDIT I was wrong about >100MB in my first row.
I've made some experiments with different bs(to check aligned reads variants):
dd if=/dev/md127 of=/dev/null bs=8M count=3000 iflag=direct
25165824000 bytes (25 GB, 23 GiB) copied, 33.1877 s, 758 MB/s

dd if=/dev/md127 of=/dev/null bs=16M count=300 iflag=direct
5033164800 bytes (5.0 GB, 4.7 GiB) copied, 4.71832 s, 1.1 GB/s

dd if=/dev/md127 of=/dev/null bs=18M count=1000 iflag=direct
18874368000 bytes (19 GB, 18 GiB) copied, 18.4601 s, 1.0 GB/s

dd if=/dev/md127 of=/dev/null bs=20M count=500 iflag=direct
10485760000 bytes (10 GB, 9.8 GiB) copied, 10.0867 s, 1.0 GB/s

dd if=/dev/md127 of=/dev/null bs=32M count=300 iflag=direct
10066329600 bytes (10 GB, 9.4 GiB) copied, 7.29756 s, 1.4 GB/s

dd if=/dev/md127 of=/dev/null bs=128M count=100 iflag=direct
13421772800 bytes (13 GB, 12 GiB) copied, 8.27345 s, 1.6 GB/s

dd if=/dev/md127 of=/dev/null bs=256M count=100 iflag=direct
26843545600 bytes (27 GB, 25 GiB) copied, 15.5701 s, 1.7 GB/s

dd if=/dev/md127 of=/dev/null bs=512M count=100 iflag=direct
53687091200 bytes (54 GB, 50 GiB) copied, 28.9437 s, 1.9 GB/s

dd if=/dev/md127 of=/dev/null bs=1G count=32 iflag=direct
34359738368 bytes (34 GB, 32 GiB) copied, 18.36 s, 1.9 GB/s

Despite it is still hard to understand why speed grows with bs growing(for example from 256M to 512M), it shows not bad read speed starting from bs=32M.

A: Your chunk size is 1M so with 8 drives, your stripe size is 8M. If you issue a direct IO read of 10M, then you are asking for 1 and a fraction stripes, so it will take as long as reading two stripes to finish.  If you are going to use direct IO, you will want to keep your bs to an even multiple of the stripe size.  Normal applications also don't use direct IO, but go through the cache, so you may want to make sure the readahead value is big enough ( /sys/block/mdxxx/queue ).  Going with a smaller chunk size when you create the array might be a good idea.  I thought the default these days was 512k, but it used to be 64k and I'm not sure why it was increased.


text: Q: What does the $\pi_1(\mathsf{C})$ really mean? Assume that $\mathsf{C}$ is a small category (in my case with finitely many objects but this is probably irrelevant). In a paper I'm studying at the moment there is a notion used constantly, this of $\pi_1(\mathsf{C})$. This is some kind of (probably!!) fundamental groupoid occurring in that context , but I don't really know what it is and there is no additional information concerning it. Could you please give me a clue (or a reference)?


text:
Q: Array initialization error in Verilog I made a code like this:
input [7:0] Address, WriteData;
input MemRead = 0, MemWrite = 0, CLK;
output reg[7:0] ReadData;

reg [31:0] Input[7:0], Output[7:0];
reg [31:0] Sel;
wire [4:0] addr = Address[4:0];
integer i;

initial begin
    for(i = 0; i < 16; i = i + 1) begin
        Output[i] = i;
        Output[15 + i] = 255 - i + 1;
    end
    Sel = 32'b0;
end

always @(MemRead or MemWrite) begin
    if(MemRead == 1) begin
        ReadData <= Output[7]; // here is error point
    end
    else if(MemWrite == 1) begin
        Input[addr] <= WriteData;
        Sel[addr] <= MemWrite;
    end
end

It initializes array Output like:
Output[0] = 0, Output[1] = 1, Output[2] = 2...

When I gave ReadData <= Output[number] with number < 8, and simulate, it gives expected result: ReadData = 00000111 for Output[7].
But, when I gave number >= 8, result changes: ReadData = XXXXXXXX for Output[8].
I did not changed anything but the number. How can this happen?

A: You declared Output as following:
reg [31:0] Output[7:0];

It means that you have 8 vectors, 32 bits each. Judging by your confusion and one of your loops, I'd say that you want 32 vectors, 8 bits (1 byte) each. In that case, you should declare Output as:
reg [7:0] Output [31:0];

Btw you should rather avoid naming your signals almost like Verilog keywords (input, output, etc)


text:
Q: Exporting FEATURE_FLAG recursively to makefiles, CPP and Header files
*

*FEATURE_FLAG is applicable to feature_folder - being newly introduced in the build system based on below condition in the top level makefile.
ifdef FEATURE_AAA
export FEATURE_FLAG=0
else
export FEATURE_FLAG=1

*CPP and Header files inside the feature_folder further include some headers based on FEATURE_FLAG as below.
e.g. foo.cpp includes foo.h which has-
//Code
#if FEATURE_FLAG
#include <cstring>
#endif
//Code
a = memset(...);
//Code

*With the $(warning ...) prints in the makefiles corresponding to foo.cpp and foo.h, I have ensured that FEATURE_FLAG=1 just right before foo.cpp gets compiled. This means, the FEATURE_FLAG=1 setting works fine in the contained makefiles.

However, foo.cpp compilation gives the error as - memset not found.
If I comment the FEATURE_FLAG in the foo.h and include the cstring as default, the compilation works ok.
Q => Why doesn't the foo.h "see" the FEATURE_FLAG being set to 1?
CXX := arm-5.3-uclibc-1.0.12/usr/bin/arm-linux-g++
CC := arm-5.3-uclibc-1.0.12/usr/bin/arm-linux-gcc

A: You have set the make variable FEATURE_FLAG.  Make variables exist in your makefile, they do not exist (automatically) in your compiler when it compiles your code.
If you want to pass a value from your makefile into the compiler as a C or C++ preprocessor macro definition, you have to put it on the compiler's command line using the -D option.
You don't show enough of your makefile to be able to give exact instructions but assuming that you have a make variable CPPFLAGS that contains preprocessor definitions, you would do something like this:
CPPFLAGS += -DFEATURE_FLAG=$(FEATURE_FLAG)


text:
Q: slow insert into the android database I have to insert the following fields in android database:
this code is in my activity
for(int k=0; k<pdvs.size(); k++)
      {
       Map<String, String> testMap1 = new HashMap<String, String>();
       testMap1.put("pos_id", pdvs.get(k).pos_id);
       testMap1.put("visit_date", pdvs.get(k).nextvisitDate);
       testMap1.put("roadmap_id", String.valueOf(roadmap_id));
       testMap1.put("sys_visit_status_id", "1");
       testMap1.put("gps_latitude", "5");
       testMap1.put("gps_longitude", "5");

      db.insertData("pos_visit", testMap1);

}
There are about 16 rows to insert...not that much. Still I tried to use a ContentValues like this:
this is the code from SQLiteOpenHelper class
public long insertData(String tableName, Map<String, String> map) {
            long id;
        ContentValues columnValues = new ContentValues();

            db.beginTransaction();
            try{

        for (Map.Entry<String, String> entry : map.entrySet()) {
            String columnName = entry.getKey();
            String value = entry.getValue();
            columnValues.put(columnName, value);

        }
        id = db.insert(tableName, null, columnValues);

            db.setTransactionSuccessful();
            }finally{
                db.endTransaction();
            }
            return id;
    }

but it still takes about 10-12 seconds to introduce 16 rows.  Anyway, after that I found out about InsertHelper as known to be much faster and I did this:
 public long insertData(String tableName, Map<String, String> map) {
            long id = 0;
            int i = 0;
            int [] columnIndex = new int[map.size()];
            String [] value = new String[map.size()];

        InsertHelper ih = new InsertHelper(db, tableName);

            for (Map.Entry<String, String> entry : map.entrySet()) {

            String columnName = entry.getKey();
                    columnIndex[i] = ih.getColumnIndex(columnName);
            value[i] = entry.getValue();
                    i++;
        }

            try{
            ih.prepareForInsert();
        for (int k=0; k<columnIndex.length; k++) {

             ih.bind(columnIndex[k], value[k]);
        }
                 id = ih.execute();
            }finally{
            ih.close();
            }

            return id;
    }

But the result is that this second method is as slow as the first one!!! Anyone can give me an idea about how to improve the speed of insert into my database? What I'm doing wrong in these methods?
Thank you!!!

A: You should wrap your outer loop in a transaction and get rid of it in your insertData method.
Right now, you call a full chain of open transaction, insert, set success for each element of your pdvs set. If pdvs must always be persisted as a whole, then you should only use 1 transaction for the whole operation. It'll make your code noticeably faster.
// begin transaction here
for(int k=0; k<pdvs.size(); k++)
                    {
                        Map<String, String> testMap1 = new HashMap<String, String>();
                    testMap1.put("pos_id", pdvs.get(k).pos_id);
                    testMap1.put("visit_date", pdvs.get(k).nextvisitDate);
                    testMap1.put("roadmap_id", String.valueOf(roadmap_id));
                    testMap1.put("sys_visit_status_id", "1");
                    testMap1.put("gps_latitude", "5");
                    testMap1.put("gps_longitude", "5");

                    db.insertData("pos_visit", testMap1);

                    }
//set success here

And in your insertData just use insert without transaction


text:
Q: No output to console from a WPF application? I'm using Console.WriteLine() from a very simple WPF test application, but when I execute the application from the command line, I'm seeing nothing being written to the console. Does anyone know what might be going on here?
I can reproduce it by creating a WPF application in VS 2008, and simply adding Console.WriteLine("text") anywhere where it gets executed. Any ideas?
All I need for right now is something as simple as Console.WriteLine(). I realize I could use log4net or somet other logging solution, but I really don't need that much functionality for this application.
Edit: I should have remembered that Console.WriteLine() is for console applications. Oh well, no stupid questions, right? :-)
I'll just use System.Diagnostics.Trace.WriteLine() and DebugView for now.

A: I use Console.WriteLine() for use in the Output window...

A: Old post, but I ran into this so if you're trying to output something to Output in a WPF project in Visual Studio, the contemporary method is:
Include this:
using System.Diagnostics;

And then:
Debug.WriteLine("something");

A: You can use
Trace.WriteLine("text");

This will output to the "Output" window in Visual Studio (when debugging).
make sure to have the Diagnostics assembly included:
using System.Diagnostics;

A: I've create a solution, mixed the information of varius post.
Its a form, that contains a label and one textbox. The console output is redirected to the textbox.
There are too a class called ConsoleView that implements three publics methods: Show(), Close(), and Release(). The last one is for leave open the console and activate the Close button for view results.
The forms is called FrmConsole. Here are the XAML and the c# code.
The use is very simple:
ConsoleView.Show("Title of the Console");

For open the console. Use:
System.Console.WriteLine("The debug message");

For output text to the console.
Use:
ConsoleView.Close();

For Close the console.
ConsoleView.Release();

Leaves open the console and enables the Close button
XAML
<Window x:Class="CustomControls.FrmConsole"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:CustomControls"
    mc:Ignorable="d"
    Height="500" Width="600" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Topmost="True" Icon="Images/icoConsole.png">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="40"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="40"/>
    </Grid.RowDefinitions>
    <Label Grid.Row="0" Name="lblTitulo" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" FontFamily="Arial" FontSize="14" FontWeight="Bold" Content="Titulo"/>
    <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="10"/>
        </Grid.ColumnDefinitions>
        <TextBox Grid.Column="1" Name="txtInner" FontFamily="Arial" FontSize="10" ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" TextWrapping="Wrap"/>
    </Grid>
    <Button Name="btnCerrar" Grid.Row="2" Content="Cerrar" Width="100" Height="30" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
</Grid>

The code of the Window:
partial class FrmConsole : Window
{
    private class ControlWriter : TextWriter
    {
        private TextBox textbox;
        public ControlWriter(TextBox textbox)
        {
            this.textbox = textbox;
        }

        public override void WriteLine(char value)
        {
            textbox.Dispatcher.Invoke(new Action(() =>
            {
                textbox.AppendText(value.ToString());
                textbox.AppendText(Environment.NewLine);
                textbox.ScrollToEnd();
            }));
        }

        public override void WriteLine(string value)
        {
            textbox.Dispatcher.Invoke(new Action(() =>
            {
                textbox.AppendText(value);
                textbox.AppendText(Environment.NewLine);
                textbox.ScrollToEnd();
            }));
        }

        public override void Write(char value)
        {
            textbox.Dispatcher.Invoke(new Action(() =>
            {
                textbox.AppendText(value.ToString());
                textbox.ScrollToEnd();
            }));
        }

        public override void Write(string value)
        {
            textbox.Dispatcher.Invoke(new Action(() =>
            {
                textbox.AppendText(value);
                textbox.ScrollToEnd();
            }));
        }

        public override Encoding Encoding
        {
            get { return Encoding.UTF8; }

        }
    }

    //DEFINICIONES DE LA CLASE
    #region DEFINICIONES DE LA CLASE

    #endregion

    //CONSTRUCTORES DE LA CLASE
    #region CONSTRUCTORES DE LA CLASE

    public FrmConsole(string titulo)
    {
        InitializeComponent();
        lblTitulo.Content = titulo;
        Clear();
        btnCerrar.Click += new RoutedEventHandler(BtnCerrar_Click);
        Console.SetOut(new ControlWriter(txtInner));
        DesactivarCerrar();
    }

    #endregion

    //PROPIEDADES
    #region PROPIEDADES

    #endregion

    //DELEGADOS
    #region DELEGADOS

    private void BtnCerrar_Click(object sender, RoutedEventArgs e)
    {
        Close();
    }

    #endregion

    //METODOS Y FUNCIONES
    #region METODOS Y FUNCIONES

    public void ActivarCerrar()
    {
        btnCerrar.IsEnabled = true;
    }

    public void Clear()
    {
        txtInner.Clear();
    }

    public void DesactivarCerrar()
    {
        btnCerrar.IsEnabled = false;
    }

    #endregion
}

the code of ConsoleView class
static public class ConsoleView
{
    //DEFINICIONES DE LA CLASE
    #region DEFINICIONES DE LA CLASE
    static FrmConsole console;
    static Thread StatusThread;
    static bool isActive = false;
    #endregion

    //CONSTRUCTORES DE LA CLASE
    #region CONSTRUCTORES DE LA CLASE

    #endregion

    //PROPIEDADES
    #region PROPIEDADES

    #endregion

    //DELEGADOS
    #region DELEGADOS

    #endregion

    //METODOS Y FUNCIONES
    #region METODOS Y FUNCIONES

    public static void Show(string label)
    {
        if (isActive)
        {
            return;
        }

        isActive = true;
        //create the thread with its ThreadStart method
        StatusThread = new Thread(() =>
        {
            try
            {
                console = new FrmConsole(label);
                console.ShowDialog();
                //this call is needed so the thread remains open until the dispatcher is closed
                Dispatcher.Run();
            }
            catch (Exception)
            {
            }
        });

        //run the thread in STA mode to make it work correctly
        StatusThread.SetApartmentState(ApartmentState.STA);
        StatusThread.Priority = ThreadPriority.Normal;
        StatusThread.Start();

    }

    public static void Close()
    {
        isActive = false;
        if (console != null)
        {
            //need to use the dispatcher to call the Close method, because the window is created in another thread, and this method is called by the main thread
            console.Dispatcher.InvokeShutdown();
            console = null;
            StatusThread = null;
        }

        console = null;
    }

    public static void Release()
    {
        isActive = false;
        if (console != null)
        {
            console.Dispatcher.Invoke(console.ActivarCerrar);
        }

    }
    #endregion
}

I hope this result usefull.

A: Brian's solution is to always open a console when your WPF application starts. If you want to dynamically enable console output (for example, only when launched with certain commandline arguments) call AttachConsole:
[DllImport("kernel32.dll")]
static extern bool AttachConsole(uint dwProcessId);

const uint ATTACH_PARENT_PROCESS = 0x0ffffffff;

Then, when you want to start writing to the console:
AttachConsole(ATTACH_PARENT_PROCESS);
Console.WriteLine("Hello world!");
Console.WriteLine("Writing to the hosting console!");

A: Although John Leidegren keeps shooting down the idea, Brian is correct. I've just got it working in Visual Studio.
To be clear a WPF application does not create a Console window by default.
You have to create a WPF Application and then change the OutputType to "Console Application". When you run the project you will see a console window with your WPF window in front of it.
It doesn't look very pretty, but I found it helpful as I wanted my app to be run from the command line with feedback in there, and then for certain command options I would display the WPF window.

A: Right click on the project, "Properties", "Application" tab, change "Output Type" to "Console Application", and then it will also have a console, the WPF Applications still runs as expected (even if the Application output type is switched to "Console Application").

A: It's possible to see output intended for console by using command line redirection.
For example:
C:\src\bin\Debug\Example.exe > output.txt

will write all the content to output.txt file.

A: You'll have to create a Console window manually before you actually call any Console.Write methods. That will init the Console to work properly without changing the project type (which for WPF application won't work).
Here's a complete source code example, of how a ConsoleManager class might look like, and how it can be used to enable/disable the Console, independently of the project type.
With the following class, you just need to write ConsoleManager.Show() somewhere before any call to Console.Write...
[SuppressUnmanagedCodeSecurity]
public static class ConsoleManager
{
    private const string Kernel32_DllName = "kernel32.dll";

    [DllImport(Kernel32_DllName)]
    private static extern bool AllocConsole();

    [DllImport(Kernel32_DllName)]
    private static extern bool FreeConsole();

    [DllImport(Kernel32_DllName)]
    private static extern IntPtr GetConsoleWindow();

    [DllImport(Kernel32_DllName)]
    private static extern int GetConsoleOutputCP();

    public static bool HasConsole
    {
        get { return GetConsoleWindow() != IntPtr.Zero; }
    }

    /// <summary>
    /// Creates a new console instance if the process is not attached to a console already.
    /// </summary>
    public static void Show()
    {
        //#if DEBUG
        if (!HasConsole)
        {
            AllocConsole();
            InvalidateOutAndError();
        }
        //#endif
    }

    /// <summary>
    /// If the process has a console attached to it, it will be detached and no longer visible. Writing to the System.Console is still possible, but no output will be shown.
    /// </summary>
    public static void Hide()
    {
        //#if DEBUG
        if (HasConsole)
        {
            SetOutAndErrorNull();
            FreeConsole();
        }
        //#endif
    }

    public static void Toggle()
    {
        if (HasConsole)
        {
            Hide();
        }
        else
        {
            Show();
        }
    }

    static void InvalidateOutAndError()
    {
        Type type = typeof(System.Console);

        System.Reflection.FieldInfo _out = type.GetField("_out",
            System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);

        System.Reflection.FieldInfo _error = type.GetField("_error",
            System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);

        System.Reflection.MethodInfo _InitializeStdOutError = type.GetMethod("InitializeStdOutError",
            System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);

        Debug.Assert(_out != null);
        Debug.Assert(_error != null);

        Debug.Assert(_InitializeStdOutError != null);

        _out.SetValue(null, null);
        _error.SetValue(null, null);

        _InitializeStdOutError.Invoke(null, new object[] { true });
    }

    static void SetOutAndErrorNull()
    {
        Console.SetOut(TextWriter.Null);
        Console.SetError(TextWriter.Null);
    }
}


text:
Q: Creating app.tss in titanium How can I create app.tss in Titanium? I'm following this link http://www.smashingmagazine.com/2014/03/10/4-ways-build-mobile-application-part4-appcelerator-titanium/
I think that app.tss is not an alloy controller so I can't just right click on the app in Project Explorer and create an alloy contoller.
Should I just right click and create a new file and label it app.tss. Would that have a negative effect on entire project?

A: I think that app.tss is not an alloy controller so I can't just right click on the app in Project Explorer and create an alloy contoller.

Yes, you are right it is not an Alloy Controller. Files with an extension TSS are Titanium Style Sheets. app.tss contains styles accessible globally and it is in a folder called app/styles. You should have it in your project by default.
If you don't then just do right click on the folder styles -> New -> Alloy Style


text:
Q: Denseness of the set $\{f: \int_0^1 x^\alpha f''(x) dx = \int_0^1 x^\beta f''(x) dx = 0 \}$ in $C[0,1]$ Let $\alpha, \beta \in (-1,1) \setminus \{ 0 \}$. Is it true that the set
$$
\left\{f \in C^2[0,1]: \int_0^1 x^\alpha f''(x) dx = \int_0^1 x^\beta f''(x) dx = 0 \right\}
$$
is dense in $C[0,1]$? I think it is not, but have no idea how to prove it. In case $\alpha, \beta \geq 1$ it is quite easy since we can use integration by parts twice and rewrite the condition without derivatives, but I do not know what to do if $\alpha, \beta < 1$.

A: Your set seems to be indeed dense in $\mathcal C([0,1])$. Without loss of generality, assume that $\alpha\neq \beta$.
We need the following fact:
$\mathbf{Fact.}$ Given a compact set $K\subset\mathbb R^2$, there is a constant $C$ such that the following holds: for any $(p,q)\in K$ and $A>1$, one can find a function $\Phi\in \mathcal C^2([0,A])$ such that $\int_0^{A} \Phi''(t)t^\alpha dt=p$, $\int_0^{A}\Phi''(t)t^\beta dt=q$ and $\Vert\Phi\Vert_\infty\leq C$.
Assuming this has been proved, let us show that your set (call it $\mathcal A$) is dense in $\mathcal C([0,1])$.
By something like Weierstrass theorem, it is enough to approximate any $\mathcal C^2$ function; so let us fix $f\in\mathcal C^2([0,1])$ and $\varepsilon \in (0,1)$.
Put $L_\alpha(f)=\int_0^1 f''(x)x^\alpha dx$ and $L_\beta(f)= \int_0^1 f''(x)x^\beta dx$. Choose $\gamma >0$ such that $\gamma(1-\alpha)>1$ and $\gamma(1-\beta)>1$ By the above fact applied with $K=\{ (p,q);\; \vert p\vert\leq \vert L_\alpha(f)\vert\;{\rm and}\; \vert q\vert\leq  \vert L_\beta(f)\vert \}$, one can find a function $\Phi\in\mathcal C^2([0,{\varepsilon^{-\gamma}}])$ such that $\int_0^{{\varepsilon^{-\gamma}}} \Phi''(t)t^\alpha dt=\varepsilon^{\gamma(1-\alpha)-1}L_\alpha(f)$, $\int_0^{{\varepsilon^{-\gamma}}}\Phi''(t)t^\beta dt=\varepsilon^{\gamma(1-\beta)-1}L_\beta(f)$ and $\Vert\Phi\Vert_\infty\leq C$, where $C$ does not depend on $\varepsilon$. Now define $g$ on $[0,1]$ by $g(x)=f(x)-\varepsilon\, \Phi({\varepsilon^{-\gamma}}x)$. Then $g\in\mathcal C^2([0,1])$ and $\Vert g-f\Vert_\infty\leq C\varepsilon$. Moreover,
\begin{eqnarray*}\int_0^1 g''(x)x^\alpha\, dx&=&L_\alpha(f)-\varepsilon^{1-2\gamma}\int_0^1\Phi''({\varepsilon^{-\gamma}}x)x^\alpha dx\\
&=&L_\alpha(f)- \varepsilon^{1-\gamma+\gamma\alpha}\int_0^{\varepsilon^{-\gamma}}\Phi(t) t^\alpha\, dt\\&=&0\, ,
\end{eqnarray*}
and likewise $\int_0^1 g(x)x^\beta dx=0$. So $g\in\mathcal A$, and since $C$ does not depend on $\varepsilon$, this shows that $\mathcal A$ is dense in $\mathcal C([0,1])$.
To prove the fact, we first note that given $p,q\in\mathbb R$, one can find a quadratic function $\psi(x)=ax^2+bx+c$ such that $\int_0^{1} \psi(x)x^\alpha dx=p$, $\int_0^{1}\psi(x)x^\beta dx=q$, $\psi(1)=0$ and $\vert a\vert+\vert b\vert+\vert c\vert\leq M (\vert p\vert+\vert q\vert)$, where $M$ is a constant depending only on $(\alpha,\beta)$. Indeed, this amounts to solving the linear system
$$\left\{
\begin{matrix}\frac{1}{\alpha+3}& a&+&\frac{1}{\alpha +2}& b&+&\frac{1}{\alpha +1}& c&=&p\\
\frac{1}{\beta+3}& a&+&\frac{1}{\beta +2}& b&+&\frac{1}{\beta +1}& c&=&q\\
&a&+&&b&+&&c&=0
\end{matrix} \right. $$
whose matrix depend only on $(\alpha,\beta)$ and turns out to be invertible (I'm skipping some row manipulations here).
It follows that for any $(p,q)\in\mathbb R^2$ and any $A>1$, one can find a function $\varphi\in\mathcal C([0,A])$ such that $\int_0^A \varphi(t)
t^\alpha dt=p$, $\int_0^A\varphi(t) t^\beta dx=q$, $\varphi\equiv 0$ on $[1,A]$ and $\Vert\varphi\Vert_\infty\leq M(\vert p\vert+\vert q\vert)$ for some constant $M$ which does not depend on $(p,q)$: just define $\varphi$ to be equal to the above quadratic function $\psi$ on $[0,1]$ and $\varphi\equiv 0$ on $[1,A]$.
Now, let $K$ be an arbitrary compact subset of $\mathbb R^2$ and let $A>1$. For any $(p,q)\in K$, define $\Phi:[0,A]\to \mathbb R$ by $\Phi(t)=\int_1^t\int_1^s \varphi (u) du$, where $\varphi$ is as above. Then $\Phi\equiv 0$ on $[1,A]$, so $\Vert\Phi\Vert_\infty\leq C$ for some constant $C$ depending only of $K$; and $\Phi$ does the job.


text:
Q: Pandas Col to dict with key, value pair where value is frequency of string occurrence so my df['data'] looks like this
[[G, 37, T], [-, 447, A]]
[[G, 78, A], [-, 447, A], [A, 1023, -]]
[[-, 447, A], [C, 3049, T]]
[[-, 447, A]]

What I need is dictionary like this
{'-447A':4,'G37T':1,'G78T':1,'C3049T':1,'A1023-':1}

I've tried to do df.to_list() but i get list of lists of lists and then joining each item to get list of strings and then convert them to dict but all i got is some
TypeError: 'float' object is not iterable
TypeError: sequence item 0: expected str instance, list found
so i think there is a better/faster option than for loops

A: Don't think there's a more optimized way to do this in pandas, just convert it to a list, transform and count it using collections.Counter:
from collections import Counter
Counter((''.join(map(str, slst)) for lst in df.data.to_list() for slst in lst))
# Counter({'-447A': 4, 'G37T': 1, 'G78A': 1, 'A1023-': 1, 'C3049T': 1})


text:
Q: How to make Owl Carusel slider looks like this How to make my carusel looks like this slider on the picture.
The center image overlapping the two other images.

A: $('.owl-carousel').owlCarousel({
stagePadding: 10,
loop:true,
margin:0,
nav:true,
responsive:{
    0:{
        items:1
    },
    600:{
        items:3
    },
    1000:{
        items:1
    },

    1200:{
      items:1
    }
}
})

and this is the html code


text:
Q: Building the AWS SDK from source on Amazon Linux 2 I am trying to follow up suggestion from aws-lamba-cpp to reduce complexity in building my application.

If you choose to build on the same Amazon Linux version used by
lambda, you can avoid packaging the C runtime in your zip file.

After reading:

*

*Building the SDK from source on EC2
Here is what I tried:
% docker run -it amazonlinux:latest /bin/bash
$ cd /tmp/
$ yum -y install libcurl-devel openssl-devel libuuid-devel cmake3 wget tar gzip make gcc-c++
$ wget https://github.com/aws/aws-sdk-cpp/archive/refs/tags/1.9.9.tar.gz
$ tar xfz 1.9.9.tar.gz
$ cd aws-sdk-cpp-1.9.9/
$ mkdir build
$ cd build
$ cmake3 .. -DBUILD_ONLY=s3 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Building AWS libraries as shared objects
-- Generating linux build config
-- Building project version: 1.9.9
-- The CXX compiler identification is GNU 7.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7")
--   Zlib library: /usr/lib64/libz.so
-- Encryption: Openssl
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.0.2k")
--   Openssl include directory: /usr/include
--   Openssl library: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
-- Http client: Curl
-- Found CURL: /usr/lib64/libcurl.so (found version "7.61.1")
--   Curl include directory: /usr/include
--   Curl library: /usr/lib64/libcurl.so
-- Performing Test HAVE_ATOMICS_WITHOUT_LIBATOMIC
-- Performing Test HAVE_ATOMICS_WITHOUT_LIBATOMIC - Success
CMake Error at CMakeLists.txt:184 (include):
  include could not find load file:

    AwsFindPackage

CMake Error at CMakeLists.txt:194 (add_subdirectory):
  The source directory

    /tmp/aws-sdk-cpp-1.9.9/crt/aws-crt-cpp

  does not contain a CMakeLists.txt file.

-- Add s3-crt:s3 to C2J_SPECIAL_NAME_LIST
-- Considering s3
-- Looking for pathconf
-- Looking for pathconf - found
-- Looking for umask
-- Looking for umask - found
-- The C compiler identification is GNU 7.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Updating version info to 1.9.9
-- Custom memory management enabled; stl objects now using custom allocators
-- Performing Test CURL_HAS_H2
-- Performing Test CURL_HAS_H2 - Success
-- Performing Test CURL_HAS_TLS_PROXY
-- Performing Test CURL_HAS_TLS_PROXY - Success
CMake Error at aws-cpp-sdk-core/CMakeLists.txt:496 (aws_use_package):
  Unknown CMake command "aws_use_package".

-- Configuring incomplete, errors occurred!
See also "/tmp/aws-sdk-cpp-1.9.9/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/aws-sdk-cpp-1.9.9/build/CMakeFiles/CMakeError.log".

What is the correct solution to build aws-sdk-cpp on an Amazon Linux 2 system ?

A: Something changed in the past weeks, it worked fine for me before, now I got the same error as you.
Cloning with submodules fixed it for me:
$ git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git

(With version 2.13 of Git and later, --recurse-submodules can be used instead of --recursive)


text:
Q: How to deactivate safe mode in the mongo shell? Short question is on the title: I work with my mongo Shell wich is in safe mode by default, and I want to gain better performance by deactivating this behaviour.
Long Question for those willing to know the context:
I am working on a huge set of data like
{
_id:ObjectId("azertyuiopqsdfghjkl"),
stringdate:"2008-03-08 06:36:00"
}

and some other fields and there are about 250M documents like that (whole database with the indexes weights 36Go). I want to convert the date in a real ISODATE field. I searched a bit how I could make an update query like
db.data.update({},{$set:{date:new Date("$stringdate")}},{multi:true})

but did not find how to make this work and resolved myself to make a script that take the documents one after the other and make an update to set a new field which takes the new Date(stringdate) as its value. The query use the _id so the default index is used.
Problem is that it takes a very long time. I already figured out that if only I had inserted empty dates object when I created the database I would now get better performances since there is the problem of data relocation when a new field is added. I also set an index on a relevant field to process the database chunk by chunk. Finally I ran several concurrent mongo clients on both the server and my workstation to ensure that the limitant factor is the database lock availability and not any other factor like cpu or network costs.
I monitored the whole thing with mongotop, mongostats and the web monitoring interfaces which confirmed that write lock is taken 70% of the time. I am a bit disappointed mongodb does not have a more precise granularity on its write lock, why not allowing concurrent write operations on the same collection as long as there is no risk of interference? Now that I think about it I should have sharded the collection on a dozen shards even while staying on the same server, because there would have been individual locks on each shard.
But since I can't do a thing right now to the current database structure, I searched how to improve performance to at least spend 90% of my time writing in mongo (from 70% currently), and I figured out that since I ran my script in the default mongo shell, every time I make an update, there is also a getLastError() which is called afterwards and I don't want it because there is a 99.99% chance of success and even in case of failure I can still make an aggregation request after the end of the big process to retrieve the single exceptions.
I don't think I would gain so much performance by deactivating the getLastError calls, but I think itis worth trying.
I took a look at the documentation and found confirmation of the default behavior, but not the procedure for changing it. Any suggestion?

A:
I work with my mongo Shell wich is in safe mode by default, and I want to gain better performance by deactivating this behaviour.

You can use db.getLastError({w:0}) ( http://docs.mongodb.org/manual/reference/method/db.getLastError/ ) to do what you want but it won't help.
This is because for one:

make a script that take the documents one after the other and make an update to set a new field which takes the new Date(stringdate) as its value.

When using the shell in a non-interactive mode like within a loop it doesn't actually call getLastError(). As such downing your write concern to 0 will do nothing.

I already figured out that if only I had inserted empty dates object when I created the database I would now get better performances since there is the problem of data relocation when a new field is added.

I did tell people when they asked about this stuff to add those fields incase of movement but instead they listened to the guy who said "leave them out! They use space!".
I shouldn't feel smug but I do. That's an unfortunately side effect of being right when you were told you were wrong.

mongostats and the web monitoring interfaces which confirmed that write lock is taken 70% of the time

That's because of all the movement in your documents, kinda hard to fix that.

I am a bit disappointed mongodb does not have a more precise granularity on its write lock

The write lock doesn't actually denote the concurrency of MongoDB, this is another common misconception that stems from the transactional SQL technologies.
Write locks in MongoDB are mutexs for one.
Not only that but there are numerous rules which dictate that operations will subside to queued operations under certain circumstances, one being how many operations waiting, another being whether the data is in RAM or not, and more.
Unfortunately I believe you have got yourself stuck in between a rock and hard place and there is no easy way out. This does happen.


text:
Q: Embedding Java Applet in web page I've built a java applet and am trying to embed it into an HTML file on my server. When I access the page, the applet tries to load but then crashes with a ClassNotFoundException on .applet.BookingApplet.class (which is the name of the applet, where applet is the name of the package the applet is in.)
   <body>
    <script src ="http://java.com/js/deployJava.js"></script>
    <script>
        var attributes = {
        codebase: '/webapp/HelpSessions.jar',

       code: '/webapp/HelpSessions.jar/applet/BookingApplet.class',
       archive: '/lib/javax.persistence.jar, /lib/javax.validation-1.0.0.GA.jar, /lib/joda-time-2.1.jar, /lib/mail.jar, /lib/mysql-connector-java-5.1.23-bin.jar',
       width: 800,
       height: 600
        };
        var version = "1.6"
        deployJava.runApplet(attributes, version);
        </script>
</body>

This is the first time I've tried to do anything like this, so I'm sure this is just a syntactical error with the way I'm referring to the class files in the HTML. I can post any other code if needed, but I don't think its relevant because the applet runs fine in AppletViewer.
I'm not going to sleep tonight till I get this thing running...
EDIT: To simplify things, I tried moving everything into one folder so I wouldn't have to deal with the codebase. Here's what it looks like now:
<html>
<head>
    <title>Schedule a Help Session</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
    <script src ="http://java.com/js/deployJava.js"></script>
    <script>
        var attributes = {

       code: '/applet/BookingApplet.class',
       archive: '/lib/javax.persistence.jar, /lib/javax.validation-1.0.0.GA.jar, /lib/joda-time-2.1.jar, /lib/mail.jar, /lib/mysql-connector-java-5.1.23-bin.jar',
       width: 800,
       height: 600
        };
        var version = "1.6"
        deployJava.runApplet(attributes, version);
        </script>
</body>

and I'm getting the same ClassNotFoundException. Also, I can see an InterruptedException in the details on the java console, but it doesn't tell me where (if anywhere) in my code the exception is being caused.

A: Change the code attribute to be "applet/BookingApplet.class". Currently you are using "/applet/BookingApplet.class".
When Java reads a URL, it converts any '/':s to '.':s. That will make the URL "/applet/BookingApplet.class" ".applet.BookingApplet.class". "applet/BookingApplet.class" will become "applet.BookingApplet.class", which is the correct one.
Just remember to set codebase to point to the directory where the "applet" directory is located.


text:
Q: VPS and Network firewalls opened, still can't connect I created a VPS on Oracle Cloud (Ubuntu Minimal image) and I'm trying to run a server on it.
I tried running a simple server command first to test connectivity:
 sudo python2 -m SimpleHTTPServer 80

Ok, I get "serving HTTP on 0.0.0.0 port 80".
Now I try to access it via browser and it times out. So, it must be the firewall..
So I disable all firewall rules usind the following commands:
sudo service iptables stop

and
sudo ufw disable

I try to connect again. Still, no luck. So it must be a network firewall on Oracle. I go to the Oracle configurations and I find the firewall and add the rule to open port 80, as follows:

I try to connect again. Still not connecting. I ran out of ideas. What could be going on?


text:
Q: ng add@angular-material // The package that you are trying to add does not support schematics VS code, in terminal, angular project root: ng add @angular/material.
Then: The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
Windows 10; Angular CLI 8.3.23; Node 12.7.0; Angular 8-2.14
Any clues how to solve this issue?
Thanks.

A: I had the same issue. You'll need to first install both @angular/cdk and @angular/material, and only then add the schematics:

*

*npm i @angular/cdk

*npm i @angular/material

*ng add @angular/material


text:
Q: Google Maps JS API Fit Bounds Not Working I'm having a very strange problem with my Google Maps implementation.  I am getting back an array from a REST service that gives me lat/lng and I am in turn using that information to put markers on the map and implement functionality.
That part works fine, it's when it comes to taking the markers output on the page and getting their bounds and zooming the map to them that I get to the problem.  I have read several solutions and I have attempted implementing them to the best of my ability.
Here's my implementation:
// Reset the maps bounds
MapView.bounds = new google.maps.LatLngBounds(null);

// Get the new map bounds
for (var i=0, j=MapView.markers.length; i<j; i++){
    var marker = MapView.markers[i],
        lat = marker.position.lat(),
        lng = marker.position.lng(),
        latlng = new google.maps.LatLng(lat, lng);

    MapView.bounds.extend(latlng);
};

// Set the map bounds to the new bounds
MapView.map.fitBounds(MapView.bounds);

Here is a list of the coordinates being used:
21.245445,-105.167631
41.887668,-87.622522
49.817492,15.472962
50.075538,14.4378
33.951611,-118.387578
41.887668,-87.622522
14.782827,-90.793702
33.741973,-78.817013
45.922225,-95.408973
28.320306,-81.422964
36.166667,-86.783333
-17.82922,31.053961
-8.708704,115.169616
41.901514,12.460774
-34.013717,23.054811
20.483443,-86.971039
34.933333,34.083333
6.428055,-9.429499
38.79142,-95.960607
43.771033,11.248001
46.271588,13.95641
33.773,-78.779504
40.789342,-3.249749
20.926822,-156.695125
46.271588,13.95641
18.853921,-71.300939
36.462205,-5.011611
25.788969,-80.226439
50.36809,8.73632
37.540667,126.948346
45.495992,-121.5879
14.782827,-90.793701
0,0
13,-76
20.431006,-86.908065
40.75694,-73.984872
64.143935,-21.934099
-17.816667,25.15
12.879721,121.774017
32.640054,-117.084196
-16.522046,28.850942
40.280559,22.50584
39.202686,-106.831683
36.122611,-115.170973
38.79142,-95.960607
18.126285,-65.440099
22.876396,-109.918562
30.36884,-86.324846
36.076518,-115.153343
36.0443,14.251222
41.894809,-87.624214
36.0443,14.251222
-34.035086,23.046469
36.42,25.431667
-17.82922,31.053961
20.696686,-105.292631
18.533333,-68.366667
42.407211,-71.382437
21.158964,-86.845937
9.748917,-83.753428
14.782827,-90.793701
34.852965,32.361479
34.939737,32.461585
34.052234,-118.243685
64.143935,-21.934099
35.369598,24.482727
52.407927,3.222711
47.497912,19.040235
21.158964,-86.845937
37.446719,25.328862
21.160386,-86.843338
39.770247,21.182861
36.124253,-115.168476
46.421684,15.856075
116.468401,39.947856
41.553221,-70.608589
43.706449,7.292265
39.415044,21.737618
21.158964,-86.845937
20.629559,-87.126904
36.832012,25.897065
50.075538,14.4378
8.87509,98.352656
57.702051,11.982304
-24.183889,29.012778
38.904253,-77.047904
0,0
-25.360413,27.09947
55.940209,-3.225319
36.286023,-5.27918
-3.386069,39.971999
20.749045,-105.31098
17.280151,-62.689038
21.040195,-104.358146
14.782827,-90.793702
20.696686,-105.292631
50.071287,14.397221
51.891877,-8.493827

Then I used those bounds to create a poly line to try and find out where the problem was, and the wierd part is even that is wrong, but the map isn't even zooming/panning to THOSE bounds.
Code for poly line:
var ne = MapView.bounds.getNorthEast();
    var sw = MapView.bounds.getSouthWest();

var boundingBoxPoints = [
    ne, new google.maps.LatLng(ne.lat(), sw.lng()),
    sw, new google.maps.LatLng(sw.lat(), ne.lng()), ne
];

var boundingBox = new google.maps.Polyline({
    path: boundingBoxPoints,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
 });

boundingBox.setMap(MapView.map);

And a picture of the result (this is as the map loads, un-altered):

It will either load like that (if I'm lucky) or load with most of the trips out of the top of the map with only a couple showing and most of the map canvas gray.
I am a total loss right now, could somebody please point me in the right direction?


text:
Q: webcam send snapshot to my website automatically how can i display them? Hello I have a webcam 'foscom' that send automatic snapshot every 30minutes a pictures to this folder in my ftp "testcamera/img"
I was able to create a code that display the latest image uploaded in php.
But i want also to display a drop down menu that display all old image that's mean i will let the viewer to choose another picture and display it.
An example of the idea i want: http://www.skileb.com/webcam/mzaarv/
My Sample look like this: www.stevendahdah.com/testcamera/index.php
So anyone can help me?

A: Here is a link that will get you started :
sort files by date in PHP
Getting the first or last file is merely getting the correct element from your sorted array :
$latest_file = $files[1];
$oldest_file = $files[count($files)];

You can create a image  tag
echo '';

For the rest, you can create links
for ($i  = 2;  $i <= count($files); $i++) {
   echo '' . $latest_file . '';
}


text:
Q: Why is Kurtosis of ND 3? 3 seems to be an important number when it comes to kurtosis. I see that it is often removed from the value entirely and this seems to be due to its being the kurtosis of the normal distribution. I don't see though how to get the number 3 from that distribution.
Given a definition of kutosis like $$\frac{\mu _4}{\mu _2^2} = \frac{E((X-E(X))^4)}{E((X-E(X)^2)^2}$$ with $\mu_i$ being the i-th central moment, and a normal distribution with mean and variance $m$ and $\sigma^2$, how do I derive the number 3? I've tried expanding out all the polynomial terms but things don't seem to cancel.

A: For a standard normal distribution with $E(X) = 0$.
$$\mu_2 = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}x^2e^{-x^2/2} \, dx = 1,$$
and integrating by parts with $u = x^3$ and $dv = xe^{-x^2/2}dx$,
$$\mu_4 = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}x^4e^{-x^2/2} \, dx  = -\left.\frac{1}{\sqrt{2 \pi}}x^3e^{-x^2/2}\right|_{-\infty}^{\infty} +\frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}3x^2e^{-x^2/2} \, dx\\=\frac{3}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}x^2e^{-x^2/2} \, dx=3\mu_2 = 3$$
For a general normal distribution rescale as $\hat{X} = \frac{X-E(X)}{\sqrt{\mu_2}}$ and you will find the same result.


text:
Q: Use the same color definition in \setbeamercolor and \usecolortheme In a Beamer document I have
% ...
\definecolor{darkred}{rgb}{0.6,0.0,0.2}
\setbeamercolor{frametitle}{fg=darkred}
\usecolortheme[darkred]{structure}
% ...

and when I compile with XeLaTeX I get this error
ERROR: Package xcolor Error: Undefined color `beamer@structure@color'.

associated with the \usercolortheme macro.
Of course I could do
\usecolortheme[RGB=135,0,51]{structure}

but I'd like to know if it possible to

*

*either use directly darkred in the specification of a colortheme

*or define darkred differently, so that it can be used in both ways,

because I'd like to use and possibly change a single definition.

A: To use a previously named color in \usecolortheme, you can use its optional argument as folows:
\usecolortheme[named=darkred]{structure}

From the beamer manual: