text:
Q: C++11 - Returning an expression to determine a type C++11 includes a wonderful amount of great features when it comes to type deduction and management altogether. For example auto and decltype -keywords have proven themselves to be a worthy addition to the language.
As I adopted these simple, yet effective features, I begin to think of implementing some kind of reflection system. Here's what I've managed to pull off this far:
/// ------------------------------------------------------------
/// @class  Reflection
/// @brief  General-purpose reflection class.
/// @exmpl  Get type id:
///             auto a = Reflection::get_id_type<int>();
///             auto b = Reflection::get_id_type<Object>();
///         Get type via received id:
///             decltype(Reflection::get_type(a)) d;
/// @note   It is forbidden to create an instance of this class.
/// ------------------------------------------------------------
class Reflection{
public:
    /// Static member functions:
    template<typename T>
    static inline long get_id_type(void){
        return reinterpret_cast<long>(&Database<T>::id);
    }
    static auto get_type(long const type_id) -> decltype(/* UNFINISHED! */){ // This is where I'm having problems.
        // This function body is intentionally left empty.
        // All that matters is the return type.
    }
private:
    /// Inner structures:
    template<typename T>
    struct Database{
        static void* id; // Created void pointer here, because only the address of this variable matters.
    };
    /// Constructors & destructors:
    Reflection(void) = delete;
    ~Reflection(void) = delete;
    /// Member functions (overloaded operators):
    Reflection& operator=(Reflection&&) = delete;
    Reflection& operator=(Reflection const&) = delete;
};

The code should be easy enough to understand. If you read the overall code with the comments, you should realize how to use this class. But the question is:

"How do I return an expression from function "get_type" in order to
  turn this expression into usable type by decltype-specifier?"

Thanks in advance.

A: You can't have a return type that depends on the runtime value of an argument. Period. What you're trying to do is not feasible.


text:
Q: JSON array unset First of all, I really don't know if that kind of topic exist. But I searched a lot and now I am here.
My question about parsing. For example I would like to unset some items.
$now = array();
$now[0]['name'] = "Hello1";
$now[0]['si'] = "BumBum1";
$now[1]['name'] = "Hello2";
$now[1]['si'] = "BumBum2";
$now[2]['name'] = "Hello3";
$now[2]['si'] = "BumBum3";
$now[3]['name'] = "Hello4";
$now[3]['si'] = "BumBum4";

echo json_encode($now)."<br>";

unset($now[0]);

echo json_encode($now);

And the output:
[{"name":"Hello1","si":"BumBum1"},{"name":"Hello2","si":"BumBum2"},{"name":"Hello3","si":"BumBum3"},{"name":"Hello4","si":"BumBum4"}]

{"1":{"name":"Hello2","si":"BumBum2"},"2":{"name":"Hello3","si":"BumBum3"},"3":{"name":"Hello4","si":"BumBum4"}}

And my the JSON file turns to messy code. Appears numbers and etc.
Any ideas how to solve this.

A: You need to "reindex" the array (use array_values() function).
//unset..
unset($now[0]);

//reindex
$now = array_values($now);

//display as before
echo json_encode($now);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Flexbox Adaptive Widths w/Truncation I'm trying create a flexbox row of two string items of widely varying lengths, that truncate with ellipses when the strings can't fit.
Seems easy enough and works okay with:
.flex-parent {
  display: flex;
}

.flex-child {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 50%;
}

However, occasionally strings will be very short, such as 'N/A', and in that case I would like the other string in the pair to take up as much space as possible, which would exceed max-width: 50%.
The max-width of 50% is included to keep a very long string from shrinking at the same rate as a very short string.  I.e., without it, it would truncate like this:
N/... A very long string with lots of words...
Instead, ideal behavior would be that the two strings take up equal space when they are both longer than half of the parent container.  However, when one is shorter than 50%, then that entire string is displayed while the other string takes up all of the remaining space.
Because the behavior depends on parent size & length of own string & length of the OTHER string, all of the built-in flex-basis, flex-grow/flex-shrink does not appear to help.
http://jsfiddle.net/ods1zpjy/
Anyone solved this before?


text:
Q: Deferred loading of input datalist in Firefox I would like to create an input field for a username where it should be possible to choose from a large number of names / usernames. It should be possible to enter a partial string contained in the name or username. I would like to not load the list initially but after the user has typed a minimum of a number of characters (e.g. 3) because the list is ultimately very large and should be reduced to a subset by the initial 3 characters.

This works perfectly if using <input> with <datalist> in Chrome or Chromium, but does not work as expected in Firefox. I have not tested other browsers yet.
The expected behaviour (and the way it works in Chromium) is I type my characters and after the third character the drop-down autosuggest list is loaded and automatically displayed. If I continue typing, the list continues to get filtered. Additionally, I can make the list disappear with escape and reappear with arrow down or arrow up.
In Firefox, the list does not automatically appear. I have to type another character and then backspace. Also, I cannot make it appear with arrow down or arrow up. (The solution does work in Firefox though, if the list is created initially and not lazy-loaded, but this is not an option as described above).
What I would like to find is a way to make the suggest list automatically open (or on key press) or solve this differently (without datalist).
Requirements

*

*Use as little external libraries as possible. I currently use jquery, it would be ok if it is a jquery solution, but pure JavaScript would be preferable.

*Automatically having the suggest-list drop down (once the list is loaded) in all browsers would be ideal. But at least have a possibility to drop-down the list via keypress or button.

Examples
Initially populated datalist

*

*This also works in Firefox.

*The list should appear as soon as you type one of the characters contained in the list (e.g. '1', 'o', '12' etc.)

<input class="my-input-class" placeholder="Enter '123' ... or 'one' ... " list="myDatalist" size="100">
<datalist id="myDatalist">
  <option value="1">one</option>
  <option value="12">one two</option>
  <option value="123">one two three</option>
  <option value="1234">one two three four</option>
  <option value="12345">one two three four five</option>
  <option value="123456">one two three four five six</option>
</datalist>

Lazy populated datalist

*

*does not work with Firefox

*The list should appear as soon as you type at least three of the characters contained in the list (e.g. '123' or 'one')

var previous = null;

function delayedCallback(callback, ms) {
  var timer = 0;

  return function() {
    var context = this,
      args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function() {
      callback.apply(context, args);
    }, ms || 0);
  };
}

function generateSelectList(inputElement) {
  var value = inputElement.val();

  var optionList = {
    '123': 'one two three',
    '1234': 'one two three four',
    '12345': 'one two three four five',
    '123456': 'one two three four five six',
    '1234567': 'one two three four five six seven',
  }

  $('#myDatalist').remove();

  dl = document.createElement('datalist');
  inputElement.attr('list', 'myDatalist');
  dl.id = 'myDatalist';

  for (var key in optionList) {
    var option = document.createElement('option');
    option.value = key;
    option.append(optionList[key]);
    dl.append(option);
  }
  inputElement.append(dl);
}

$(document).on('input', '.my-input-class', delayedCallback(function(event) {
  var inputElement = $(event.target);
  var value = inputElement.val();

  // only get result list if
  // - minimum 3 chars
  // - same result list has not already been fetched (if string starts with previous string)
  if (value.length >= 3) {
    if (previous && value.startsWith(previous) && $('#myDatalist').length) {
      console.log("DO NOT fetch list (again) value=" + value + " previous=" + previous);
    } else {
      console.log("fetch list: value=" + value);
      generateSelectList(inputElement);
      previous = value;
    }
  }

}, 500));
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input class="my-input-class" placeholder="Enter '123' ... or 'one' ... (at least 3 characters)" list="myDatalist" size="100">

I searched for some solutions or if others had the same problem. I did find some complaints about datalist not working as expected or not working the same in different browsers and also suggestions to use some jquery libraries. While I could just use one of the suggested solutions, I am not sure if they will solve my problem or if there is a way to make this work with datalist and other browsers (besides Chrome).

A: As per canIuse there is a bug in Firefox which requires autocomplete to be set to off for datalist to work properly. Maybe this would help?


text:
Q: Running tests in Maven, without classes and just jars I have this strange request for a proceedure. Basicly we want to be able to run tests using a method like
mvn surefire:test failsafe:test

which will only perform testing. The problem is we want to do this on a system that the target dirs don't contain the classes. I have figured out a possible way of doing this by running with the
<additionalClasspathElements>

option in the surefire plugin and putting access to the jars. Problem is this is difficult to find. Is there another way to run tests without having access to the class files and just the jars?


text:
Q: Transction Fees in erc20 smart contract I ran into an issue...
I built a erc20 smart contract but dont know how to add features such as a transaction fees on each transaction.
How to code a transaction fees on each transaction?

A: Not sure exactly what you're asking - but if you want to take a cut of the transaction whenever an ERC20 is transferred you could do this:.
In the ERC20 contract: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
Add owner to state, and update the constructor to be:
address contractDeployer;
uint txCharge = 1 // As we can't store decimals (1 = 1%)

constructor(string memory name_, string memory symbol_) {
  _name = name_;
  _symbol = symbol_;
  contractDeployer= msg.sender;
}

Then, modify the transfer function to be:
function transfer(address to, uint256 amount) public virtual override returns (bool) {
  address owner = _msgSender();
  // Transfers 1% of the amount to send to the contract deployer (you)
  _transfer(owner, contractDeployer, amount * txCharge / 100);
  // Transfers the remaining 99% to the actual recipient
  _transfer(owner, to, amount - (amount * txCharge/100);
  return true;
}


text:
Q: how to fix my index page I'm new to php programming and I tried writing the index page for the admin login however it won't work can anybody tell me what is wrong and how to fix it?
<?php
     session_start();
        if (!isset($_SESSION["manager"])) {
        header("location: admin_login.php");
        exit();
    }

    // Be sure to check that this manager SESSION value is in fact in the database
    $managerID = preg_replace('#[^0-9]#i', '', $_SESSION["id"]); // filter everything but numbers and letters

    $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["manager"]); // filter everything but numbers and letters

    $password = preg_replace('#[^A-Za-z0-9]#i', '', $_SESSION["password"]); // filter everything but numbers and letters
    // Run mySQL query to be sure that this person is an admin and that their password   session var equals the database information

    // Connect to the MySQL database
    include "../storescripts/connect_to_mysql.php";
    $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' AND username='$manager' AND password='$password' LIMIT 1"); // query the person

    // ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
     $existCount = mysql_num_rows($sql); // count the row nums
    if ($existCount == 0) { // evaluate the count
         echo "Your login session data is not on record in the database.";
         exit();
    }
    ?>

A: Please posrt all code including html form then we help u.
you miss else case
in else case use
if ($existCount == 0) { // evaluate the count
         echo "Your login session data is not on record in the database.";
         exit();
    }

else{
$_SESSION["manager"]=$manager;

}


text:
Q: Host database with values in Github i am currently working on a webapplication with some friends. All of us need to generate data with a random value generator. It could be awesome if we could host the database in github so each time one of us generates the data, we could pull the main branch and the databases on our local machines would have the same data.
If its not clear what i want let me try to demonstrate it.
Person 1 pushes database with values ABC in it
Person 2 pulls the database, generates data DEF and pushes the data on github.
The values in the database are ABCDEF now and so on.
is that possible or do i have to rent a database server for that?
Thank you in advance!

A: You can use sql lite.
https://www.sqlite.org/index.html
Just things like merging will obviously not work.
I actually think dropbox might work better than git. Git was meant to track changes, and you cannot meaningful track changes in a binary file.


text:
Q: Is it possible to disable the retry mechanism in Exim I have a very simple Exim configuration that's just forwarding all mail to a set of destination addresses.  When immediate delivery to an address fails, the message is added to the queue (and then processed by the retry rules).  I want to change this so that if immediately delivery fails, the message is :blackhole:d.  (It's ok if a bounce is generated instead, as I'll just redirect the bounce to the :blackhole:).
This needs to occur for temporary failures (i.e. 4xx) as well as permanent (i.e. 5xx) ones.
I understand that this means that if delivery can't be done immediately the message will be permanently and irretrievably lost.  In this particular context, that isn't a problem.
Reading over this, it sounds suspiciously like "how can I improve my spamming Exim server".  That really isn't what this is for, and if you can figure out a way I can prove that, I'm happy to do so!

A: Exim has extensive configuration for setting the retry times. In your exim.conf, there will be a retry section near the bottom. The retry configuration is three fields, the email address, the error code causing the failure and a list of timing patterns. These are defined as a group of three numbers: a letter behaviour code, the length of time to apply this rule and an interval to retry. For example:
F,2h,15m

can be read as "For 2 hours, try of a fixed internal every 15 minutes",
You could try setting an empty retry:
begin retry
*    *

It's possible that exim gets upset by this. Instead, you could use a single retry of a minute:
begin retry
*    *    F,1m,1m

This isn't exactly what you asked for, but it's pretty close.
There's also options for changing it for particular email addresses and for different return codes.

A: Set retry to something absurdly long, cron a script to pull message ids from exim -bpu in queue greater than length x, then remove with exim -Mrm <msgid>
You can alternatively run exim as a non-queueing daemon with mua_wrapper = true. Look at Section 48 "Using Exim as a non-queuing client", it may do what you need.

When delivery fails, an error message is written to the standard error stream (as well as to Exim's
  log), and Exim exits to the caller with are turn code value 1. The message is expunged from Exim's
  spool files. No bounce messages are ever generated.
No retry data is maintained, and any retry rules are ignored.

A: Can you set system_filter option in your exim.conf.
Ater, in your configuration system filter file, create one rule like that:
if not first_delivery then
seen finish
endif

After first delivery, exim will put message in the queue again but when try to process again, it will discarded.


text:
Q: I want to create paging between sets of columns created via the jQuery Columnizer plugin //UPDATE//
I found some code to do paging which I have modified to work with the columnizer plugin (newsletter sample 10) for jQuery. The only problem is I can only go to the next part of the article (It's split into 3 columns per part). For some reason I can't go back to the previous part of the article. If I click the ".articleprevbutton" it just takes me to the next part. The code for paging is from here http://pastebin.me/217b55dff89af94ad04de32328dca62a and is made for an image carousel. I don't need it to loop back round to the beginning at the last part of the article when I click next. I just don't know how to take it out without it breaking.
    $(function(){
        var content_height = 466;

        var page = 1;

        function buildNewsletter(){
            if($('#theArticle').contents().length > 0){

                $page = $("#page_template").clone(true).addClass("page").css("display", "block");

                $page.find("#partnumbertext h3").append(page);
                $("#singlepostbox").append($page);
                page++;

                $('#theArticle').columnize({
                    columns: 3,
                    target: ".page:last .content",
                    overflow: {
                        height: content_height,
                        id: "#theArticle",
                        doneFunc: function(){
                            buildNewsletter();
                        }
                    }
                });
            }

            $('.page').hide();
            $('.page:first').show();

                $('.articleprevbutton, .articlenextbutton').click( function (ev) {
                //prevent browser jumping to top
                ev.preventDefault();

                //get current visible item
                var $visibleItem = $('.page:visible');

                //get total item count
                var total =  $('.page').length;

                //get index of current visible item
                var page = $visibleItem.prevAll().length;

                //if we click next increment current index, else decrease index
                $(this).attr('href') === 'Next' ? page++ : page--;

                //if we are now past the beginning or end show the last or first item
                if (page === -1){
                   page = total-1;
                }
                if (page === total){
                   page = 0
                }

                //hide current item
                $visibleItem.hide();

                //fade in the relevant item
                $('.page:eq(' + page + ')').fadeIn(500);

            });

        }

        setTimeout(buildNewsletter);
    });

Very much an amateur jQuery user in need of help. Any would be great. Also any improvements are welcome.

A: Ok I finally got it working using some of the code from my question and the rest from here: http://www.jsfiddle.net/brunolm/256mU/. The pain is over, if you have any tips on how to reduce or improve the code they are more than welcome.
$(function(){

        // columnizer section creating all the pages of columns, I have 3
        // columns per page, goto the link at the bottom to find out more about the
        // columnizer newslettter code.

 var content_height = 466;

 function buildNewsletter(){
 if($('#theArticle').contents().length > 0){

 $page = $("#page_template").clone(true).addClass("page").css("display", "block");

 $("#singlepostbox").append($page);

 $('#theArticle').columnize({
  columns: 3,
  target: ".page:last .content",
  overflow: {
   height: content_height,
   id: "#theArticle",
   doneFunc: function(){
    buildNewsletter();
   }
  }
 });
}

        // Code for post nav info before click, total of pages reused on click. For example 1 of 3
        var $pagination = $("#PostNav");
        var total = $('.page').length;
        var current = $pagination.data("Current") ? $pagination.data("Current") : 1;

        // Hides all pages except the very first page and shows the current page number + total number of pages
        $('.page').hide();
        $('.page:first').show();
        $("#pagenumbertext").text("page " + (current) + " of " + total + "");

        }

setTimeout(buildNewsletter);

});

$("#PostNav a").click(function (e) {
 e.preventDefault();

 var $this = $(this);

 var $pagination = $("#PostNav");

 var $thepage = $(".page");

                // total number of pages
 var total = $('.page').length;

          // Current page index
 var current = $pagination.data("Current") ? $pagination.data("Current") : 0;

 /* handling prev & next buttons */
 if ($this.index() == 0) /* Previous */
 {
  /* go 1 back or start at the end */
  current = ((current - 1) < 0 ? (total - 1) : (current - 1));
 }
 else /* Next */
 {
  /* go 1 forward or start at the beginning */
  current = ((current + 1) == total ? 0 : (current + 1));
 }

 /* Save the current index for next time */
 $pagination.data("Current", current);

 /* Transition to next or previous page and Update which page is visible*/
 $thepage.css("display", "none").eq(current).css("display", "").fadeIn(500);

 $("#partnumbertext").text("part " + (current+1) + " of " + total + "");
});

If you need more info and help working with columnizer to get your articles and content into automatic multiple columns split into pages or parts just search google for columnizer. I hope that this helps anyone who really wants to give a website a more magazine feel. With the added benefit of been able to split it into to pages rather than have it all endlessly falling down the page. Thanks.


text:
Q: Find differing items in mysql database when another item is the same? I've got a SQL database that is holding product information, including the name and description of products.
The way it is currently set up is something like this:
+-------------+-------------+------------------+--------------------------------+
| products_id | language_id | products_name    | products_description           |
+-------------+-------------+------------------+--------------------------------+
|           1 |           1 | A19845002        | CONE DRIVE ASSEMBLY            |
|           1 |           2 | A19845002        | CONE DRIVE ASSEMBLY            |
|        4619 |           1 | A51959001        | CONE DRIVE SPACER              |
|        4619 |           2 | A51959001        | CONE DRIVE SPACER              |
|       13600 |           1 | A18535004        | CONE DRIVE UNIT                |
|       13600 |           2 | A18535004        | CONE DRIVE UNIT                |
|       13701 |           1 | A17236001GEARSET | CONE DRIVE GEARSET             |
|       13701 |           2 | A17236001GEARSET | CONE DRIVE GEARSET             |
|       14388 |           1 | A18535003        | CONE DRIVE UNIT                |
|       14388 |           2 | A18535003        | CONE DRIVE UNIT                |
|       14389 |           1 | A18535002        | CONE DRIVE UNIT                |
|       14389 |           2 | A18535002        | CONE DRIVE UNIT                |
|       14390 |           1 | A18535001        | CONE DRIVE UNIT                |
|       14390 |           2 | A18535001        | CONE DRIVE UNIT                |
|       14727 |           1 | A19346006        | CONE DRIVE SPEED REDUCER       |
|       14727 |           2 | A19346006        | CONE DRIVE SPEED REDUCER       |
|       14859 |           1 | A18957002        | CONE DRIVE GEARMOTOR UNIT      |
|       14859 |           2 | A18957002        | CONE DRIVE GEARMOTOR UNIT      |
|       14867 |           1 | 604037           | CONE DRIVE GEARMOTOR           |
|       14867 |           2 | 604037           | CONE DRIVE GEARMOTOR           |
|       15182 |           1 | A17236001        | CONE DRIVE UNIT SM-502000-AJ   |
|       15182 |           2 | A17236001        | CONE DRIVE UNIT SM-502000-AJ   |
|       15410 |           1 | A19346004        | CONE DRIVE WORM REDUCER        |
|       15410 |           2 | A19346004        | CONE DRIVE WORM REDUCER        |
|       15751 |           1 | 604036           | CONE DRIVE GEARMOTOR 2.75 BORE |
|       15751 |           2 | 604036           | CONE DRIVE GEARMOTOR 2.75 BORE |
|       15752 |           1 | 604035           | MSR 50 CONE DRIVE GEARMOTOR    |
|       15752 |           2 | 604035           | MSR 50 CONE DRIVE GEARMOTOR    |
|       15842 |           1 | A19346005        | CONE DRIVE WORM REDUCER        |
|       15842 |           2 | A19346005        | KEGELRÄDER WORM REDUCER        |
+-------------+-------------+------------------+--------------------------------+

It'd like to go through and find out where products_description is DIFFERENT when it is the same products_id, but different language_id. (1 should be English, 2 should be German). If I ran the query on this, I'd like to have an easy way to find CONE DRIVE WORM REDUCER/KEGELRÄDER WORM REDUCER (so the product_id or product_name).
How would I go about doing this with mysql? I'm not really used to doing a lot of database stuff, but I need to find if any of these products have been treated properly or not.

A: Try this:
SELECT DISTINCT products_id
FROM products_table -- assumed
GROUP BY products_description
  HAVING COUNT(products_id) > 1

Should give you a result containing product IDs for products which have had their descriptions translated. If you decide you instead want IDs for products which haven't had their descriptions translated, replace the > test in the HAVING clause with an =.

A: SELECT P1.PRODUCTS_ID, P1.PRODUCTS_DESCRIPTION, P2.PRODUCTS_DESCRIPTION
FROM PRODUCTS AS P1
INNER JOIN PRODUCTS AS P2
ON P2.PRODUCTS_ID = P1.PRODUCTS_ID
AND P1.LANGUAGE_ID <> P2.LANGUAGE_ID
AND P1.PRODUCTS_DESCRIPTION<> P2.PRODUCTS_DESCRIPTION


text:
Q: Differences between user mode and system mode in ARM The following excerpt comes from ARM system developer's guide

Every processor mode except user mode can change mode by writing
  directly to the mode bits of the cpsr. All processor modes except
  system mode have a set of associated banked registers that are a
  subset of the main 16 registers.

My question are:

*

*Is User mode and System mode the same? Or different mode?

*Can System mode change mode by writing directly to the mode bits of the cpsr?

*Does User mode have a set of associated banked registers that are a subset of the main 16 registers?

A:

*

*Is User mode and System mode the same? Or different mode?

From the same reference you linked, section 2.2.1 Processor Modes

System mode is a special version of user mode that allows full
  read-write access to the cpsr

*Can System mode change mode by writing directly to the mode bits of the cpsr?

See above.

*Does User mode have a set of associated banked registers that are a subset of the main 16 registers?

It uses the same registers as System mode; it is only the CPSR access that differs.

A:

*

*Is User mode and System mode the same? Or different mode?

Also, from the same reference you linked, section 2.1 REGISTERS

The processor can operate in seven different modes, which we will
  introduce shortly.

You can infer that System mode and User mode are the different mode.

*Can System mode change mode by writing directly to the mode bits of the cpsr?

Since System mode and User mode are the different mode, System mode definitely can change mode by writing directly to the mode bits of the cpsr. According to your reference below the image.

*Does User mode have a set of associated banked registers that are a subset of the main 16 registers?

No, it does not.
I insist that this is manual's typo.


text:
Q: Internal name encoding in SharePoint It's pretty well publicised knowledge that _x0020_ replaces spaces in SharePoint internal field names. When working with SharePoint web services this can be a bit of a nightmare until you write a replace rule when comparing field names.
I've just found myself another one of these "encoding exceptions" in a field called SSL2. Bizarrely the internal name ends out being _x0053_SL2. I've tried something like RRL2 which comes out as _x0052_. From this it appears that the number used in the encoding represents the ASCII value of that character. Space would likewise be _x0020_.
My question is twofold:

*

*In this case, whats causing SharePoint to encode these
characters.

*Broadly, what sort of encoding is being done and is there a general
    step I can do to decode strings
    rather than replacing specific
    occurances which I've come across
    and know to be a problem.

A: You should use System.Xml.XmlConvert.DecodeName

A: This is an old question, but I wanted to understand the first part of this question and it wasn't answered so here goes...
Essentially SSL2 is being encoded to _x0053_SL2 because it resembles an "A1 mode" excel cell reference ([a-zA-Z]{1,3}[0-9]{1,5}). When Sharepoint sees one of those it decides it needs to encode the first character.
This is obviously not standard XML encoding, and I'm not going to posit any theories as to why this is done, but hopefully this at least explains what the OP observed.

A: It's a secret) :
public static string EncodeName(string name)
{
    var encodedName = string.Empty;
    foreach (var c in name)
    {
        var s = c.ToString();
        byte[] bytes = Encoding.BigEndianUnicode.GetBytes(s);
        //Regex.Match(s, "[^\x00-\x80]")
        //IsCyrillic (0x400–0x4FF) и IsCyrillicSupplement (0x500–0x52F)
        //if (Regex.Match(s, @"\p{IsCyrillic}|\p{IsCyrillicSupplement}").Success)
        if (!Regex.Match(s, @"[a-zA-Z0-9_]").Success)
        {
            encodedName += "_x";
            foreach (var b in bytes)
            {
                encodedName += b.ToString("X2").ToLowerInvariant();
            }
            encodedName += "_";
        }
        else
        {
            encodedName += s;
        }
    }
    if (encodedName.Length > 32)
    {
        encodedName = encodedName.Substring(0, 32);
    }
    return encodedName;
}

A: SharePoint XML encodes names because it want to be able to use the field names as attributes in XML.
You can use System.Xml.XmlConvert.EncodeName to encode your names


text:
Q: Facebook Graph API- Page post fetch in website I used following code to access facebook page posts.
$accessToken = 'EAAlGssgdgQIBAHuD9ZBZB6RWZClM3bmm8Vjv2nZBNmotTTnubgzdK4aiHbqJwhRlELjAurPEHKSqxJS7c0Pyd5ZBuqZAo2keabbkubx0AZCl3m6brDGlkXNgMq9dtNUZAx4P6QwdsXwNvJaEi2j3YDsHpZABiRxRK6qMAmZAyynLvJNCJ41ZBn9se28QUsDHG72mhZCzHFLpLQUxZCAZDZD';
$id = '109395947376896';
$url = "https://graph.facebook.com/$id/posts?access_token=$accessToken";
$result = file_get_contents($url);
$decoded = json_decode($result, true);
var_dump($decoded);

and get the following result. screenshot is attached

how do I get images of posts??

A: Without specifying the fields, you will only get default ones. This is how you can get fields (checkout the API docs for Posts about available ones):
$url = "https://graph.facebook.com/$id/posts?access_token=$accessToken&fields=full_picture,message,...";

Source: https://developers.facebook.com/docs/graph-api/reference/post/#fields

A: You can get them in field parameters

*

*picture

*full_picture

*child_attachments

Also refer https://developers.facebook.com/docs/graph-api/reference/post/


text:
Q: Not getting highlighted text I wrote the following program which is getting the data. I required
 import pdfquery

 pdf = pdfquery.PDFQuery('data/BUSTA_PAGA - 2.pdf')
 pdf.load()
 pdf.tree.write('pdfXML.xml', pretty_print = True)

 Name = pdf.pq('LTTextLineHorizontal:overlaps_bbox("25.509, 729.284, 102.06,
 737.284")').text()
 Nam = pdf.pq('LTTextLineHorizontal:overlaps_bbox("25.509, 740.621, 97.031, 748.621")').text()
 N = pdf.pq('LTTextLineHorizontal:overlaps_bbox("25.509, 706.61, 188.558, 714.61")').text()
 A = pdf.pq('LTTextLineHorizontal:overlaps_bbox("425.166, 668.04, 570.398, 676.04")').text()
 B = pdf.pq('LTTextLineHorizontal:overlaps_bbox("538.588, 479.073, 569.716, 515.873")').text()
 Total = pdf.pq('LTTextLineHorizontal:overlaps_bbox("356.072, 193.955, 399.622,
 201.955")').text()
 linkForRegistration=pdf.pq('LTTextLineHorizontal:overlaps_bbox("25.509, 112.425, 445.637,
 120.425")').text()

 print('\n',Name,'\n',Nam,'\n',N,'\n',A,'\n',"Competenze:",B,"\n",f'Link for registration
 {linkForRegistration}')

Output:
 Nome: ANTONIETTA
 Cognome: D'AVINO
 Domicilio fiscale: PONTECAGNANO FAIANO
 Qualifica: KA07 Scadenza: 31/08/2024
 Competenze: 2.034,84 197,74 83,42 333,68
 Link for registration:http://www.rgs.mef.gov.it/VERSIONE-
 I/sistema_delle_ragionerie/ragionerie_territoriali_dello_stato/sportelli_rts/

Now I want to get the only that text data that user had entered. for example, user has entered cogname. So it'll display the cogname from the file how can I do that.
Click here for xml file.


text:
Q: How to execute javascript function when the user clicks on the image I want to call or execute javascript function when user click on image. I have javascript file with many functions and one of them is ShowKeybord(). So i want to execute this function ShowKeybord() when user clicks on image.
I tried with HTML parameter onclick:  but its not working.
Here is my code of key functions that are related to my problem.

I tried with header.addEventListener('click', ShowKeyboard) and work properly but the keyboard is displayed when you click anywhere in the header of the web page. I would however like to make the keyboard appear only when a user clicks on the image.
What am I doing wrong and what should change depending on my code?
Thank you very much for your help.

A: You can also try to encapsulate your img with a div with the attribute onclick="ShowKeyboard()"
Wich gives something like this

A: in the head tag put

and should work.
or maybe try onclick="ShowKeyboard()" rather than onclick = "ShowKeyboard()"
I think that has to do something with it.

A: It's better to enclose your image inside a div tag. As suggested by @Lucas Duval.
This should definitely work if not please give your div an "ID" or "class" and try to handle this with JQuery.
Thanks!


text:
Q: FME Merge two files that only have some attributes the same I am trying to join 2 spatial files that have some but not all attribution the same.
One of them (property_template.tab) has no data but has the schema that I want. The other one (cadastre_bpoly.tab) has the spatial info and only some required attributes.
In QGIS a simple merge vector gives the result I need where if an attribute matches it is filled but if not it's left.
In FME I have tried FeatureMerger where the requester/supplier has join on as $(SourceDataset_MAPINFO_5) but it doesn't give a result.
I have also tried ListBasedFeatureMerger.
ALL I need to do is the following:

*

*Get the previous output of the property table and use it as a template (with no data)

*Populate it with the cadastre and have it auto fill any attributes that are the same.

*Join by attributes with an xls sheet that has a key field but be able to build up the key field using existing columns.

I understand #3 is really a separate question but I included it as it may help in choosing the correct transformers.
For points 1&2 above the merge shouldn't try to do any type of join by attribute but it doesn't allow me to leave the Join Attributes Requester/Supplier blank.
===== UPDATE
Based on Mark Ireland's suggestion

A: No experience with TAB files but in general a source file without any records will not read any feature. So using an empty file to merge the schema to the features is not going to work, this way.
You can read the schema from the file (SchemaReader or FeatureReader) and use it to write a dynamic schema (send Schema Feature directly to the writer, select Dynamic Schema Definition, "Schema from Schema Feature") but I doubt this is what you are looking for.
Other than that you are on the right track I think. You can easily put the same character, like 1, in the Requestor- and Supplier fields to simulate 1=1.

Connect the new input to the Requestor port and the old data to the Supplier port and there you go.
For #3 you do the same, now using the key field in the FeatureMerger.

A: I'd give the FeatureJoiner a look too -- it has very similar functionality to the FeatureMerger but uses database terminology and as such may be easier to understand.  After the join you may need to merge the output from ports (with either transformer) to get what you wanted. Worst case, post a simple example here of input data and what you're doing and we can look more closely.

A: The feature merger should be okay to use but you may want to take the data coming from the different ports such as Not Merged to account for when a match was not found.

A: I think - if I understand correctly - that I would do a simple translation for parts 1 and 2. So, in an empty workspace, try following these steps...

*

*Choose Readers > Add Reader from the menubar.

*Set MapInfo tab as the reader format and select the Cadastre dataset.

*Click OK to add the reader.

*Choose Writers > Add Writer from the menubar.

*Set MapInfo tab as the writer format and choose a new folder to write to.

*Set Table Definition to Import From Dataset and click OK to add the writer.

*You will be prompted where to import the schema from. Set MapInfo Tab as the format and select the Property dataset. Click OK to finish adding the writer.

You now have a workspace that will write the Cadastre data to a new MapInfo dataset, using the Property dataset as a form of template.
If any attributes exist in the Cadastre data that also appear on the Property schema, they will get written out. Everything else will be ignored.
There are a few ways to do this, but I think my solution is about as good as you can get. You could use a Dynamic translation, but I don't see any point in that (unless you are going to run this multiple times and the Property dataset will change schema each time). The FeatureMerger/Joiner method mentioned in other answers isn't that simple because it doesn't define the output schema.
The one possible snag is that the Property dataset is empty. FME might not like that. Without features it might think there is no schema and you get an error when adding the writer. The simple solution would be to add a single record to that table. We aren't reading that dataset, just using the structure, so it doesn't matter whether the table is full or empty. That data won't get included, only features from the Cadastre data.
As you say, requirement #3 is really a different thing altogether. But, as everyone else here has mentioned, you can use a FeatureJoiner (or FeatureMerger) transformer to do this. Actually, given that the data is Excel, and you don't really need to read all of it into the workspace, I would use the DatabaseJoiner transformer. So create your key as a new attribute (StringConcatenator or AttributeManager > Text Editor dialog) and use that in the DatabaseJoiner to connect to the Excel sheet.
I found a reasonably suitable demo dataset so I put a short video together, to demonstrate the techniques above. I hope it is of use. You can find it here: https://www.screencast.com/t/tO1F3s3i


text:
Q: Why use 'unowned' in UIViewPropertyAnimator So ive been doing some reading about UIViewPropertyAnimator and in the examples I've been looking at, they do something like this:
animator = UIViewPropertyAnimator(duration: 2.0, curve: .easeInOut, animations: {
        [unowned self, redBox] in
        redBox.center.x = self.view.frame.width
        redBox.transform = CGAffineTransform(rotationAngle: CGFloat.pi).scaledBy(x: 0.001, y: 0.001)
    })

I dont understand the '[unowned self, redBox] in' part of it. Can anyone explain what we use it for?
I know that unowned is usually used to decide how the reference count is determined and that it can not be set to nil as the references are going to not exist one without the other(as an alternative to weak), but i dont understand the use here, and I dont understand the bracket part. It looks to me to be an array of the item im animating and the view its located in?
Full code is as follows:
import UIKit

class ViewController: UIViewController {

    var animator: UIViewPropertyAnimator!

    override func viewDidLoad() {
        super.viewDidLoad()

        //redBox

        let redBox = UIView(frame: CGRect(x: 10, y: 100, width: 100, height: 100))
        redBox.translatesAutoresizingMaskIntoConstraints = false// lar oss redigere posisjon og sånn selv, uten at xcode setter posisjon/størrelse i stein.
        redBox.backgroundColor = .red
        redBox.center.y = view.center.y

        view.addSubview(redBox)

        animator = UIViewPropertyAnimator(duration: 2.0, curve: .easeInOut, animations: {
            [unowned self, redBox] in
            redBox.center.x = self.view.frame.width
            redBox.transform = CGAffineTransform(rotationAngle: CGFloat.pi).scaledBy(x: 0.001, y: 0.001)
        })

        // slider

        let slider = UISlider()
        slider.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(slider)
        slider.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
        slider.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true
        slider.addTarget(self, action: #selector(sliderChanged), for: .valueChanged)

    }
    func sliderChanged(_ sender: UISlider){
        animator.fractionComplete = CGFloat(sender.value)
    }

}

A: *

*We need to use either weak or unowned otherwise an ownership (reference) cycle would be created (self => animator => animations => self).

*We can use unowned instead of weak because we can be sure that self and animator are destroyed together and when self is deallocated, the animations won't be running any more.


text:
Q: Microsoft release manager taking second last version for deployment I am using Microsoft Release Management for Visual Studio 2013 Update 2.
I have setup deployer using ReleaseTfvcTemplate.12 template. This setup is deploying the code as expected but only problem I am seeing is it is not taking latest version. It is taking previous version of build for deployment.
Can anyone provide inputs on how can I resolve this?

A: First, please make sure your template created without any problem. Do not use the web downloaded version. You can follow below ways to create it:
When you install Release Management it creates a Build Template for you to use with an exampleRelease Management Build Process Template. Release Management Build Process Templates are not installed in TFS by default, so it won't appear as an available build process template until you add it.
Find the Template in your server install in : C:\Program Files (x86)\ Microsoft Visual Studio 12.0\ReleaseManagement\bin\
TFS 2013 : ReleaseTfvcTemplate.12.xaml (or ReleaseGitTemplate.12.xaml if using GIT)

To add the release management build process template, you will need to check it in to your TFS source control in the BuildProcessTemplate folder in your project. Then add the build process file when editing (or adding) a Build Definition. Please ensure you use the above templates from the Release Management Server and not the client directory.
You can also update your VS2013 to the latest version just as Daniel suggests to see whether the issue still exist.


text:
Q: Replace file content without creating a new file with Node.js I'm playing with Node.js fs.writeFile() flags to find the right file for my problem: I want to replace the content of a file but throw an error if the file does not exist.
My first try was with r+ but I have issues if the new content is shorter than the old one:
fs.writeFileSync('test', '11111111111');
> 111111111111
fs.writeFileSync('test', '22', {flag: 'r+'})
> 221111111111

Removing the flag solve the problem (give 22) but create a new file if test doesn't exist.
Is it doable with a flag or do I need to detect file existence before (not very found of that)?

A: You can't do this in a single step: opening a file for writing will create the file if it does not exist, while opening the file with r+ mode presents the problem you mention.
I see two options:

*

*Test for existence using fs.stat(), then fs.writeFile() in w mode.

*Open the file in r+ mode, write to it, then fs.ftruncate() the file to the desired size.

I recommend the first approach. The code will be easier to read and reason about.


text:
Q: Website displays weird on Ipad/Iphone I have an odd situation over here. Our website displays fine on desktop and mac. Also on android devices (I'm using google nexus 7). But somehow, when viewing on an Ipad or Iphone, the website's css seems to b not as it should be. All divs, for example, are reacting weird and other stuff seems to get out of place for no reason that i can find. I tried several ios simulators (google aswell) and they all come out possitively and everything seems to be feen like currently it is on android devices. Only when trying on the devices themselve, it seems to get messed up.
Here is a link to the website: http://www.kiliwatch.be/ -> this is a directed/framed website
You can view the original source here: http://davion.be/kiliwatch/
Here is a screenshots on Ipad air: http://i.cubeupload.com/QCSYcE.png
Someone who has an idea why this occurs?


text:
Q: Facebook login responce : Not Get Users details except (Id and name) Facebook login responce not getting user's all Details like email, firstname, lastname. Its works fine in Facebook Graph API v2.0 but not in v2.4. I am using this plugin for PhoneGap application. this repository from https://github.com/phonegap-build/FacebookConnect
if (response.authResponse) {
      facebookConnectPlugin.api('/me', null,
           function (me_response) {
               var username = me_response.email;
               var firstname = me_response.first_name;
               var lastname = me_response.last_name;
               var ExternalIdentifier = me_response.id;
               var Email = me_response.email;
               var ProviderSystemName = "ExternalAuth.Facebook";
               ExternalResponseInsert(apiSecretKey, storeId, languageId, username, firstname, lastname, Email, ExternalIdentifier, OAuthToken, OAuthAccessToken, ProviderSystemName);
                    facebookConnectPlugin.logout(function (response) {}, function (response) {});
               });
            }

A: This is a reference from Stackoverflow Question
Looks like you're using v2.4 of the Graph API. See

*

*https://developers.facebook.com/docs/apps/changelog#v2_4

Declarative Fields
  To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /me no longer includes likes and comments by default, but GET /me?fields=id,name,username,emails,first_name,last_name will return the data. For more details see the docs on how to request specific fields.


text:
Q: Replication Issue in Sql Server 2008 While launching replication monitor and creating publisher by Add Publisher Link in sql server 2008 I am getting following errors :-
**Server is neither Publisher not a distributor , or you do not have permission to access replication functionality in this server.**

User I am using for this replication have sysadmin and all other required permissions for this server so I am unable to find what is causing this issue
Kindly help me to sort out this issue


text:
Q: How to update node to the latest minor version using nvm-windows? In bash, I can use this command to update my current node version of nvm to the latest minor version:
nvm install $(nvm current | sed -rn "s/v([[:digit:]]+).*/\1/p") --reinstall-packages-from=$(nvm current)

How to do the same in Batch using nvm-windows?
source

A: You can achieve the same from the window using a batch file.
Create a batch file with the following text:
@echo off
FOR /F "tokens=* USEBACKQ" %%F IN (`nvm current`) DO (
SET var=%%F
)
SET var=%var:v=%
SET unused=%var:*.=%
CALL SET var=%%var:%unused%=%%
SET var=%var:.=%
nvm install %var%

Then run your batch file from "cmd"
I tried with the same in my system.


text:
Q: How to rotate labels in clustered bar charts I can label groups in a bar chart but when trying to rotate the column labels I get unexpected results.
This works:
BarChart[{{1, 2, 3}, {4, 5, 6}},
 ChartLabels -> {{"c1", "c2"}, {"r1", "r2", "r3"}}]

this doesn't:
BarChart[{{1, 2, 3}, {4, 5, 6}},
 ChartLabels ->
  Placed[{{"c1", "c2"}, {"r1", "r2", "r3"}}, Axis, Rotate[#, Pi/4] &]]

What am I doing wring?

A: Placed should be inside the List:
BarChart[{{1, 2, 3}, {4, 5, 6}},
  ChartLabels -> {Placed[{"c1", "c2"}, Axis, Rotate[#, Pi/4] &],
    Placed[{"r1", "r2", "r3"}, Axis, Rotate[#, Pi/4] &]}]


text:
Q: Can past continous fit in this example?
After three days of lessons, we felt more confident and we really started to enjoy ourselves. By the end of the week, we (were both falling / both fell) in love with  snowboarding and we did not want to go home.

I think were both falling is better because it is a continuous thing.  Why would both fell be correct?

A: I think I would exclude fell.
Given the time frame By the end of the week..., two valid choices would be were falling and had fallen.
Why? Because "fall in love" refers to a transition to a state. The process can be ongoing if it is specifically made continuous (were falling), but otherwise, it's a completed thing.
It's different from the first sentence, where After three days of lessons, we felt more confident... because felt refers to a state, not a transition.


text:
Q: Linq - XElement Compare i am trying to compare two xelements () as below:
XElement parentItems =
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
  <tcm:Item Title="070_Page" Modified="2016-01-06T18:08:36" CP1="-6185, Intro" CP2="-6182, Article Body" CP3="-14507, Article Body1" CP4="-14430, Article Body2" CP5="-14530, Article Body3" CP6="-7064, Article Body4" CP7="-14529, Article Body5" CP8="-7065, Article Body6" CPCount="8" />
  <tcm:Item Title="080_Page" Modified="2015-04-23T13:27:59" CP1="-6302, Intro" CP2="-6193, Article Body" CPCount="2" />
  <tcm:Item Title="Release Notes" Modified="2016-01-07T21:25:43" CP1="-6303, Release Notes Intro" CP2="-6196, Release Notes Article Body" CPCount="2" />
</tcm:ListItems>

XElement childItems =
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
  <tcm:Item Title="070_Page" Modified="2016-06-06T19:36:35" CP1="-6185, Intro" CP2="-6147, Media & Delivery Intro" CP3="-6182, Article Body" CP4="-14507, Article Body1" CP5="-14430, Article Body2" CP6="-14530, Article Body3" CP7="-7064, Article Body4" CP8="-14529, Article Body5" CP9="-7065, Article Body6" CPCount="9" />
  <tcm:Item Title="080_Page" Modified="2016-02-09T21:03:32" CP1="-6302, Intro" CP2="-6193, Article Body" CPCount="2" />
  <tcm:Item Title="Release Notes" Modified="2016-02-09T21:03:33" CP1="-6303, Release Notes Intro" CP2="-6196, Release Notes Article Body" CPCount="2" />
  <tcm:Item Title="Release Notes1" Modified="2016-03-09T22:00:13" CP1="-6303, Release Notes Intro" CP2="-6196, Release Notes Article Body" CPCount="2" />
</tcm:ListItems>

I want my result to be (first one has different CPCount, and second one is a new element in childItems):
XElement diff =
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
  <tcm:Item Title="070_Page" Modified="2016-06-06T19:36:35" CP1="-6185, Intro" CP2="-6147, Media & Delivery Intro" CP3="-6182, Article Body" CP4="-14507, Article Body1" CP5="-14430, Article Body2" CP6="-14530, Article Body3" CP7="-7064, Article Body4" CP8="-14529, Article Body5" CP9="-7065, Article Body6" CPCount="9" />
  <tcm:Item Title="Release Notes1" Modified="2016-03-09T22:00:13" CP1="-6303, Release Notes Intro" CP2="-6196, Release Notes Article Body" CPCount="2" />
</tcm:ListItems>

I've tried XMLDiff API but no luck. I can loop through and get the results, but sometimes the list can be huge (3000+). Is there a best way to handle this?

A: Ok, here is the code - in a console app created using VS2015 (could be non-optimal but it works - I get the two expected elements in the end - leaving refactoring for you as a homework):
class Program
{
    //this is just for convenient storage of all collected data
    //also to avoid additional dictionary lookups and processing
    internal class ElementAttributes
    {
        public XElement Element { get; set; }
        public Dictionary<string, string> Attributes;

        public ElementAttributes(XElement element)
        {
            this.Element = element;
            this.Attributes = new Dictionary<string, string>();
        }
    }

    static void Main(string[] args)
    {
        //loading XML elements from embedded resources
        XElement parentItems = XElement.Parse(ResourceXML.parentItems);
        XElement childItems = XElement.Parse(ResourceXML.childItems);

        XElement diff = XElement.Parse(@"<tcm:ListItems xmlns:tcm=""http://www.tridion.com/ContentManager/5.0"" ></tcm:ListItems>");

        var parentDictionary = BuildDictionary(parentItems);
        var childDictionary = BuildDictionary(childItems);

        //perform diff
        foreach (string key in childDictionary.Keys)
        {
            ElementAttributes parentElementAttributes;
            if (parentDictionary.TryGetValue(key, out parentElementAttributes))
            {
                //found Title/key in parent, compare attributes
                foreach (var childAttribute in childDictionary[key].Attributes)
                {
                    var attributeName = childAttribute.Key;
                    var childAttributeValue = childAttribute.Value;

                    string parentAttributeValue;
                    if (parentElementAttributes.Attributes.TryGetValue(attributeName, out parentAttributeValue))
                    {
                        //found attribute in parent, compare value
                        if(childAttributeValue == parentAttributeValue)
                        {
                            //values are equal, compare other attributes
                            continue;
                        }
                    }

                    //parent does not have this attribute OR
                    //different value in child -> show in diff
                    diff.Add(childDictionary[key].Element);

                    //do not compare other attributes
                    break;
                }

                //child may have missing attributes, which are in parent only
                //NOTE: your example does not present a use case for this scenario
                foreach (var parentAttribute in parentElementAttributes.Attributes)
                {
                    string attributeName = parentAttribute.Key;
                    if (!childDictionary[key].Attributes.ContainsKey(attributeName))
                    {
                        //attribute found in parent, but not in child
                        diff.Add(childDictionary[key].Element);
                        break;
                    }
                }
            }
            else
            {
                //not found in parent, show in diff
                diff.Add(childDictionary[key].Element);
            }
        }
    }

    private static Dictionary<string, ElementAttributes> BuildDictionary(XElement element)
    {
        XNamespace tcm = "http://www.tridion.com/ContentManager/5.0";

        var resultDictionary = new Dictionary<string, ElementAttributes>();
        foreach (XElement childElement in element.Elements(tcm + "Item"))
        {
            var attributeDictionary = new ElementAttributes(childElement);
            foreach (XAttribute attribute in childElement.Attributes())
            {
                string[] excludedColumns = {"Title", "Modified"};

                if (excludedColumns.Contains(attribute.Name.LocalName))
                {
                    continue;
                }

                attributeDictionary.Attributes.Add(attribute.Name.LocalName, attribute.Value);
            }
            resultDictionary.Add(childElement.Attribute("Title").Value, attributeDictionary);
        }
        return resultDictionary;
    }
}


text:
Q: Github Failed To Load My Fonts With 404 Error I use @font-face in my project and it works very well locally but when I pushed my project to Github it failed to load the fonts with the error 404
Reop Link: https://github.com/0GeNN0/rock-paper-scissors-advanced-with-typescript

Live Link: https://0genn0.github.io/rock-paper-scissors-advanced-with-typescript/


text:
Q: Wix Burn didn't Pass command line args to related packages (old version of same installer) Recently I saw an annoying behaviour with my Wix based bootstrapper. We pass a command line args to our installer like
myinstaller.exe /S option=10

I then use it in my bundle by following
<Variable Name="option" Value="0" bal:Overridable="yes" />

I was then passing it to related msi or exe packages. All was working fine and according to expectation.
I then noticed an unexpected behaviour with our app and investigate it through log to realize that Wix is not forwarding this command line args or variable to related bundle.
On same machine I executed the newer version of installer with command line args. Wix noticed the older version so it went to removing it after installing newer version but it didn't forward option to that installer. Installer use this args to decide few thing and it went on wrong path. See log for details.
[349C:282C][2014-05-08T20:12:24]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: G:\myinstaller.exe, cmdline: '/S option=-2'
[349C:282C][2014-05-08T20:12:24]i000: Initializing numeric variable 'option' to value '0'
.
.
.
.
[349C:282C][2014-05-08T20:12:28]i301: Applying execute package: {93df3160-1ac2-4e72-ad1b-9040001d9d58}, action: Uninstall, path: C:\Users\Test\AppData\Local\Package Cache\{93df3160-1ac2-4e72-ad1b-9040001d9d58}\myinstaller.exe, arguments: '"C:\Users\Test\AppData\Local\Package Cache\{93df3160-1ac2-4e72-ad1b-9040001d9d58}\myinstaller.exe" -uninstall -quiet -burn.related.upgrade'

A: I have spent many hours over the internet to search any solution but I didn't able to find any. I then resolved this issue by setting a registry value, which is obviously workaround but I have to do this. I then looked at wix toolset bug list to find it is marked as bug targeting wix 4.x. Here is a link for further insight.
http://wixtoolset.org/issues/3704/


text:
Q: Django not recognizing my Token? I'm using Django Rest Framework on the backend and an ember-cli app on the frontend. The authentication is working correctly, but there seems to be a hole somewhere in authorization.
# settings.py
REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.AllowAny',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.TokenAuthentication',
    ),
}

# views.py
class CurrentUserView(APIView):
    "get the data for the current authenticatd user"
    permission_classes = (IsAuthenticated,)

    def get_queryset(self, request):
        queryset = User.objects.filter(username=request.user.username)
        return queryset

    def get(self, request):
        serializer = UserSerializer(request.user)
        return Response(serializer.data)

When I make a request to this endpoint /v1/me/ it responds back with a 403. When I take off the permission class, I get back {"id":null,"username":"","is_active":false} because it doesn't know who I am.
Also, when I use the browsable API, the /v1/me URL works correctly.
On the Ember side of things, I login with my account and correctly get back my Token. In the request the Authorization: Token asdf1234asdf1234asdf1234 is being passed. I would think Django takes that token and knows who I am? Am I missing something?

A: Try something like
from rest_framework import authentication
class TokenAuthView(APIView):
    authentication_classes = (authentication.TokenAuthentication,)

Then,
class CurrentUserView(TokenAuthView)

A: In the setting you need to add auth_token.
# settings.py
   INSTALLED_APP = ('rest_framework.authtoken',)

You don't need to add the authentication_classes on every view.


text:
Q: How can I change a &mut Peekable into a &[u8]? I have a value with type &mut Peekable<I> and I want to use it for input value for other function which gets the value with type &[u8]. How can I change the type of it?

A: Peekable<I> is an iterator that gives elements from an iterator that it wraps (with a twist that you can peek one ahead, but that is not relevant here).
&[u8] is a slice of bytes laid out contiguously in memory.
So you have two problems:

*

*The iterator I could be anything. Assuming you got I from a generic context, like foo<I: Iterator>(), you need to ensure that the iterator gives u8, or something convertible to u8.

*The data behind Peekable doesn't have to exist in memory. It could be created from a range for example (0..1000) or iterating over a HashMap which has data scattered in a random fashion. You need to copy it to a vector that guarantees contiguous layout.
First, you'll need to declare you want u8 with where I: Iterator<Item=u8>, or require that the type is convertible to u8 with where I: Iterator<Item=impl Into<u8>>. Then you'll be able to do let iterator = iterator.map(|el| el.into()) to get an iterator of u8 elements.
And once you have that, you can collect them into a vector, and get a slice of the vector:
let vec: Vec<u8> = iterator.collect();
let slice = &vec[..];


text:
Q: How to make my list effects work when I'll change list into table? I have list of files - and after clicking on one of them it shows the jquery form: here it is: http://jsfiddle.net/GSC3x/11/
But now I noticed, that I will need a table on this page, and I want to this list be one column in my whole table, here is the (ugly) example: http://jsfiddle.net/GSC3x/15/ .
I want the jquery form thing work the same way after changing into the table view. I mean, hide everything and make form appear.
How to do it?
Thanks!

A: To make the table disappear, you shouldn't hide the individual cells (as you do with $(".show_hide").hide();), but hide the whole table instead.
Also, you are reusing the button that is showing the form for hiding it, but with a completely different styling. That is weird, unnecessary and makes it difficult to use.
Use a separate button to close the form, and don't use the same event handler ($('.show_hide').click). The show and hide parts share no code anyway.
Structuring your code like this also makes it very easy to add smooth transitions like fading or, the sliding you already had implemented.


text:
Q: How to get a specific account from web3 with version 1.2.x? In an old version of web3 web3.eth.accounts[0] returns a sepcific account. I used it as a parameter for the vote function like this:
app.vote(1, { from: web3.eth.accounts[0]})

Since version 1.2.x web3 uses web3.eth.getAccounts() to return a list of accounts the node controls.
How can I get a specific account like I did before with this web3 version?

A: web3.eth.defaultAccount;
> undefined

// set the default account
web3.eth.defaultAccount = '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe';


text:
Q: Quick junction / pn junction diode clarification I was studying diodes. I was at the part where we talk about P-N junctions diodes. There is a part I am confused about. Is the "junction" part the part in the middle which blocks the current if no voltage is applied? Or is the "junction" part the entire diode, or each of the sections that have P material or N material?

A: The junction is the area of the diode in the center where the P and N regions meet. In a silicon diode current is blocked at the junction if the voltage is reversed and typically for a forward voltage, the junction develops a .67 voltage drop. For any forward voltage greater than .67 volts, the junction conducts current.The P and N regions are always conductive within them selves, the junction conducts in one direction only.
Quote https://wiki.analog.com/university/courses/electronics/text/chapter-5:

A p-doped semiconductor is relatively conductive. The same is true of an n-doped semiconductor, but the junction between p and n type regions is a nonconductor. This non-conducting layer, called the depletion layer, occurs because the electrically charged carriers, electrons in n-type and holes p-type silicon, diffuse into the other type of material (i.e. electrons in p-type and holes in n-type) and eliminate each other in a process called recombination. This diffusion of charge causes a built in potential difference across the depletion region. By manipulating this non-conductive layer, PN junctions are commonly used as diodes: circuit elements that allow a flow of electricity in one direction but not in the other (opposite) direction. This property is explained in terms of forward bias and reverse bias, where the term bias refers to the application of an electric voltage across the PN junction. A PN junction will conduct current when the applied external voltage exceeds the built in potential of the junction.

A: There will be depletion layer present at the middle of the pn junction. this depletion layer consists of some immobile charges. like negative charge on p side and positive charge on n side. if an electron tries to jump over this junction, the electron will be reflected by the already present immobile charge on the p side. if this electron got sufficient energy to overcome that potential barrier then only the electron will jump to n side and current will flow through the diode. It will happen only if the voltage across pn junction is greater than around 0.7 volts for si diodes.


text:
Q: Good data - debugging a graph (grf file) I've got a graph that isn't behaving as it should in CloudConnect.
I'm running it locally, and it's completing, but not doing its work.
In an effort to figure out why this is, I've added printLog calls in many places, like the following
printLog(warn, 'transfrom from file ' + $in.0.fileName);
printLog(debug, 'joining etc');

The Phase consists of a FileList into a SimpleCopy, into a LookupJoin, a Reformat (produce SQL) and a DBInsert.
However, while I see logs for phases above, I'm not seeing anything produced in the log for any part of my phase.  All parts of the phase do report running successfully in log.  I've also done Enable Debugging on all connections in this phase.
Am I missing something to enable logging?  Is there a better way to debug processing in CloudConnect?

A: Discovered the problem - the FileList will succeed if the source file cannot be found, but none of the subsequent steps will then fire.  It's somewhat unintuitive, since the log files says 'succeeded'.
For debugging, after run you can access the data by right clicking on the connection, and selecting "View Data"
Sorry for the elementary question, but documentation didn't seem to cover this clearly, at least for a GoodData noob.  I'll leave it up for anyone with the same problem!


text:
Q: SharePoint 2010 custom publishing page not displaying as expected in Edit Mode I have a SharePoint 2010 publishing site with all publishing features enabled.  If I create an OOTB article page, my edit page experience looks like this:

However, when I edit my custom publishing page, my experience looks like this:

I expected my custom publishing page layouts to behave like the article page where editing fields were outlined with the field name in the "tab".  Is this not the case or am I missing a bit of configuration?
To create my site columns, I used the following XML in a Powershell call to $rootWeb.Fields.AddFieldAsXml():
"<Field Type=`"HTML`" RichText=`"TRUE`" RichTextMode=`"ThemeHtml`"
                          Name=`"$name`"
                          Description=`"$desc`"
                          DisplayName=`"$disp`"
                          StaticName=`"$stat`"
                          Group=`"OperMan`"
                          Hidden=`"FALSE`"
                          Required=`"FALSE`"
                          Sealed=`"FALSE`"
                          ShowInDisplayForm=`"TRUE`"
                          ShowInEditForm=`"TRUE`"
                          ShowInListSettings=`"TRUE`"
                          ShowInNewForm=`"TRUE`"></Field>"

To create my custom content types, I used the parent type "Page".
I then created corresponding custom page layouts for my custom content types.
Am I confused about how this is supposed to work or am I missing something?
I appreciate your help in advance!
Thanks...janice

A: I think I figured out a solution.  Not sure if it is the correct one.  In SPD, I created a new page layout based on my custom content type.  Then, I borrowed the styling from one of the article page layouts.  I used PageFromDocLayout.aspx but removed the UIVersion 3 code and the roll-up image.  Worked nicely.  Now, my custom page layouts have the nicer editing experience.

A: I had the same problem, it turned out that stupidly enough the PageImage field control makes the page include some extra css which render the field borders and titles. I had removed the control since my publishing pages didn't need a specific image, any image would be included using the rich text field. I added the field on the page again in a hidden (display:none;) div and al my fields rendered again in edit mode :-S.

A: Or you can use the following CSS where .ms-formfieldlabelcontainer and .ms-formfieldvaluecontainer are the classes you can override to have the look and feel you need
.ms-formfieldlabelcontainer{margin-bottom:0;margin-left:4px;margin-right:4px;margin-top:4px}
.ms-formfieldvaluecontainer{border:1px solid #ccc;margin-bottom:4px;margin-left:4px;margin-right:4px;padding:5px}


text:
Q: How can I turn off my alarm with a switch i have a switch which triggers a TimePickerDialog to set an alarm. I want now that the alarm turns off when it is switched off. Also i want to set the alarm again when I switch it to on.
public class MainAddMedActivity extends AppCompatActivity {

    private TextView txtAlarmPrompt;
    private TimePickerDialog timePickerDialog;
    private Switch switchReminder;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_add_med);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        this.txtAlarmPrompt = (TextView) findViewById(R.id.txtAlarmPrompt);
        this.switchReminder = (Switch) findViewById(R.id.switchReminder);

        switchReminder.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    openTimerPickerDialog(true);
                    timePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialog) {
                            switchReminder.setChecked(false);
                        }
                    });
                }
            }
        });
    }

    private void openTimerPickerDialog(boolean is24HourView) {
        Calendar cal = Calendar.getInstance();

        timePickerDialog = new TimePickerDialog(
                MainAddMedActivity.this,
                onTimeSetListener,
                cal.get(Calendar.HOUR_OF_DAY),
                cal.get(Calendar.MINUTE),
                is24HourView);
        timePickerDialog.show();
    }

    TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
        @Override
        public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
            Calendar calNow = Calendar.getInstance();
            Calendar calSet = (Calendar) calNow.clone();

            calSet.set(Calendar.HOUR_OF_DAY, hourOfDay);
            calSet.set(Calendar.MINUTE, minute);
            calSet.set(Calendar.SECOND, 0);
            calSet.set(Calendar.MILLISECOND, 0);

            if (calSet.compareTo(calNow) <= 0) {
                calSet.add(Calendar.DATE, 1);
            }
            setAlarm(calSet);
        }
    };

    private void setAlarm(Calendar targetCal) {
        txtAlarmPrompt.setText(getString(R.string.txtPromptAlarm) + " " + targetCal.getTime());
        Intent intent = new Intent(getApplicationContext(), AlarmNotificationReceiver.class);
        final PendingIntent pendingIntent = PendingIntent.getBroadcast(this, AlarmNotificationReceiver.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
        final AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);

        ***switchReminder.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked = false) {
                    alarmManager.cancel(pendingIntent);
                }
            }
        });*** //This Part is wrong does not work
    }

A: Your OnCheckedChangeListener is not working, because of your if-statement.
if (isChecked = false) will assign false to the variable isChecked before the if-statement is being run and so the body of your if-statement will be never be run, because isChecked will never be true.
Using = will assign the right-hand-side as the new value of the left-hand-side, while == will evaluate 2 values against each other.
Change your if-statement to:
if (!isChecked) {
    alarmManager.cancel(pendingIntent);
}

You could also do:
if (isChecked == false) {
    alarmManager.cancel(pendingIntent);
}

but it's considered bad practice to check if a boolean is either true or false by using if (myBoolean == true) or if (myBoolean == false) as an if evaluates booleans directly.
To set the alarm again, you need an else on your if-statement where you can call alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent);
So the if-else would be something like this:
if (!isChecked) {
    alarmManager.cancel(pendingIntent);
} else {
    alarmManager.set(AlarmManager.RTC_WAKEUP, targetCal.getTimeInMillis(), pendingIntent); // Remember to change the time to a new time in millis.
}


text:
Q: powerup in race game I've got a problem: i need to add a powerup to a racegame, using collision detection.
so i drawed the powerup, but the problem is: It has to be drawn after every 5 rounds and it needs to be placed ramdomly on the track.
Someone with any good advice?
Thanks.

A: Thats a bit vague. So here is my best shot at an answer.
You would want to use the c# Random class, here are the docs
For a simple game, using rectangular collision should be all you need (I assume thats what you are using) - If you want to randomly generate the power-up position, you will want to create a new Vector2 (the powerups position) with the random generator.
You can use the Next function, to pass in a low, and high variable - which you would need to configure the the bounds you wish the powerup to appear.
My advice as a game designer on the other hand, tells me that randomly located power-ups aren't always the go. It makes it harder to control the games flow and balance, and can very easily result in a flawed final product.
So my advice is a hard coded set of possible weapon spawn points - using a random generator to pick one to place.


text:
Q: How to perform a spatial query using GeoPandas? I have two shapefiles: Italian postcodes; and Italian municipalities. Both are polygon format and both contains the name of each relevant shape. I'd like to add to the postcode shapefile a field for the postcode's municipality. I believe this is a spatial query. How do I do this using GeoPandas?

A: Such a spatial query can be done with the spatial join function sjoin of GeoPandas. It will look something like:
res = geopandas.sjoin(postcodes, municipalities, op='contains')

where the op will depend on the specific spatial relationship of your data.
See https://geopandas.readthedocs.io/en/latest/mergingdata.html#spatial-joins for more.


text:
Q: Difference between destructor, dispose and finalize method I am studying how garbage collector works in c#. I am confused over the use of Destructor, Dispose and Finalize methods.
As per my research and understandings, having a Destructor method within my class will tell the garbage collector to perform the garbage collection in the way mentioned in the destructor method which cannot be called explicitly on the instances of the class.
The Dispose method is meant to provide the user to control the garbage collection.  The Finalize method frees the resources used by the class, but not the object itself.
I am not sure if I understand it the right way. Please clarify the doubts. Any further links or guides are welcome.

A: Destructor implicitly calls the Finalize method, they are technically the same. Dispose is available with objects that implement the IDisposable interface.
You may see : Destructors C# - MSDN

The destructor implicitly calls Finalize on the base class of the
  object.

Example from the same link:
class Car
{
    ~Car()  // destructor
    {
        // cleanup statements...
    }
}

The Destructor's code is implicitly translated to the following code:
protected override void Finalize()
{
    try
    {
        // Cleanup statements...
    }
    finally
    {
        base.Finalize();
    }
}

Your understanding for the Destructor is right:
From MSDN

The programmer has no control over when the destructor is called
  because this is determined by the garbage collector. The garbage
  collector checks for objects that are no longer being used by the
  application. If it considers an object eligible for destruction, it
  calls the destructor (if any) and reclaims the memory used to store
  the object. Destructors are also called when the program exits. It is
  possible to force garbage collection by calling Collect, but most of
  the time, this should be avoided because it may create performance
  issues.

A: In C# terms, a destructor and finalizer are basically interchangeable concepts, and should be used to release unmanaged resources when a type is collected, for example external handles. It is very rare that you need to write a finalizer.
The problem with that is that GC is non-deterministic, so the Dispose() method (via IDisposable) makes it possible to support deterministic cleanup. This is unrelated to garbage collection, and allows the caller to release any resources sooner. It is also suitable for use with managed resources (in addition to unmanaged), for example if you have a type that encapsulates (say) a database connection, you might want disposing of the type to release the connection too.


text:
Q: Normalization of basis vectors with a continuous index? I have an infinite basis which associates with each point, $x$, on the $x$-axis, a basis vector $|x\rangle$ such that the matrix of $|x\rangle$ is full of zeroes and a one by the $x^{\mathrm{th}}$ element. The book on Quantum Mechanics by Shankar says that the inner product between a basis vector and itself is not one, why not? Why can't these basis vectors be normalized to one, only to the Dirac delta function?

A: Any good basis should be complete. If the set of all $|x\rangle$ is complete, any other vector $|\psi\rangle$ in the Hilbert space of your system should be writeable as $|\psi\rangle=\sum_{x} |x\rangle\langle x|\psi\rangle$. This sum does not make sense for continuous variables $x$, hence the need to redefine the completeness relation with an integral (as Jan's answer demonstrates nicely). Once you employ integrals to define a meaningful completeness relation, then the relation $\langle x|y\rangle =\delta_{x,y}$ is not correct because it gives
\begin{equation}
|y\rangle=\int \mathrm{d}x |x\rangle\langle x|y\rangle=\int \mathrm{d}x |x\rangle\delta_{x,y}=0,
\end{equation}
which is inconsistent. The way out is to define $\langle x|y\rangle=\delta(x-y)$, which correctly gives
\begin{equation}
|y\rangle =\int \mathrm{d}x |x\rangle\langle x|y\rangle=\int \mathrm{d}x |x\rangle \delta(x-y)=|y\rangle.
\end{equation}
Now $\langle x|y\rangle=\delta(x-y)$ leads to $\langle x|x\rangle=\delta(0)$, that you may not like, but this is the best one can do.

A: I) We interpret OP's question (v2) as follows:

Why not normalize
  $$\tag{1} \langle x_1 | x_2\rangle~=~\delta_{x_1,x_2}~:=~\left\{ \begin{array}{ccl}
1 & \text{for} & x_1= x_2, \\
0& \text{for} & x_1\neq x_2, \end{array} \right. $$
  via a continuous Kronecker delta function rather than a Dirac delta distribution
  $$\tag{2} \langle x_1 | x_2\rangle~=~\delta(x_1-x_2)~? $$

In a nutshell, the reason is that the rhs. of eq. (1) is equal to the zero function almost everywhere wrt. the Lebesgue measure.
In this answer we would like to build intuition via Gaussian wave packets to argue that we should use a Dirac delta distribution normalization (2) (possibly modulo a conventional normalization constant) rather than a continuous Kronecker delta function normalization (1).
II) To be concrete, let us for simplicity view a ket
$$\tag{3} |\psi\rangle \quad\longleftrightarrow\quad\psi(x)$$
as a position wave function $\psi(x)\in L^2(\mathbb{R})$ in the Hilbert space
$$\tag{4} L^2(\mathbb{R})~=~{\cal L}^2(\mathbb{R})/\sim,$$
where we have modded out by an equivalence relation "$\sim$". Here ${\cal L}^2(\mathbb{R})$ is the set of square integrable functions. Two functions $\phi\sim\psi$ are equivalent iff $\phi$ and $\psi$ are equal almost everywhere (a.e.) wrt. the Lebesgue measure. See e.g. this Phys.SE post. Overlaps/inner products read
$$\tag{5} \langle \phi|\psi\rangle ~:=~ \int_{\mathbb{R}} \! \mathrm{d}x ~\phi(x)^{\ast}~\psi(x). $$
III) Now pragmatically, short of mathematically constructs such as distributions, what would represent a state localized at $x=x_1$? Let us allow the wave packet to be spread by a tiny amount $\epsilon>0$, say smaller than any experimental resolution. We can model such a wave function by an extremely narrowly peaked Gaussian function
$$\tag{6} |x_1\rangle \quad\longleftrightarrow\quad \psi_{x_1}(x)~=~ A\epsilon^{-p} \exp\left[-\left(\frac{x-x_1}{2\epsilon}\right)^2\right], $$
where $p\in\mathbb{R}$ is some fixed power and $A>0$ is a normalization constant to be determined below. The
normalization of (6) is
$$\langle x_1|x_1\rangle ~\stackrel{(5)}{=}~ \int_{\mathbb{R}} \! \mathrm{d}x ~|\psi_{x_1}(x)|^2
~\stackrel{\text{Gauss. int.}}{=}~ \sqrt{2\pi}A^2\epsilon^{1-2p} $$
$$\tag{7}\longrightarrow ~\left\{ \begin{array}{ccl}
 0 & \text{if} & p<\frac{1}{2} \\
\sqrt{2\pi}A^2& \text{if} & p=\frac{1}{2} \\
\infty& \text{if} &p>\frac{1}{2}
\end{array} \right\} \text{  for  } \epsilon~\to~ 0^{+}.  $$
To avoid that the normalization (7) disappears in the limit $\epsilon\to 0^{+}$, we must demand that the power $p\geq \frac{1}{2}$. The Kronecker normalization (1) [modulo an overall constant] corresponds to the power $p=\frac{1}{2}$.
IV) More generally, if we assume the ansatz (6), then the overlap between two such kets $|x_1\rangle$ and $|x_2\rangle$ reads in a distributional sense
$$ \langle x_1|x_2\rangle~\stackrel{(5)}{=}~\int_{\mathbb{R}} \! \mathrm{d}x ~\psi_{x_1}(x)^{\ast}~\psi_{x_2}(x)
~\stackrel{(6)}{=}~A^2\int_{\mathbb{R}} \! \mathrm{d}x ~\epsilon^{-2p}~
\exp\left[-\left(\frac{x-x_1}{2\epsilon}\right)^2-\left(\frac{x-x_2}{2\epsilon}\right)^2\right] $$
$$~\stackrel{\text{Gauss. int.}}{=}~\sqrt{2\pi}A^2\epsilon^{1-2p}\exp\left[-\frac{1}{2}\left(\frac{x_1-x_2}{2\epsilon}\right)^2\right]$$
$$\tag{8}\longrightarrow ~\left\{ \begin{array}{ccl}
 0\text{ almost everywhere} & \text{if} & p<1 \\
4\pi A^2~\delta(x_1-x_2)& \text{if} & p=1 \\
\text{too singular}& \text{if} &p>1
\end{array} \right\} \text{  for  } \epsilon~\to~ 0^{+}.$$
In the last step we used the heat kernel representation of the Dirac distribution.
The Dirac normalization (2) [modulo an overall constant] corresponds to the power $p=1$. In detail, if $f(x_1-x_2)$ is a test function, then eq. (8) states that
$$ \tag{9}\int_{\mathbb{R}}\! \mathrm{d}x_1~ f(x_1-x_2)~
\langle x_1|x_2\rangle ~\longrightarrow ~\left\{ \begin{array}{ccl}
 0 & \text{if} & p<1 \\
4\pi A^2~ f(0)& \text{if} & p=1 \\
\infty & \text{if} &p>1
\end{array} \right\} \text{  for  } \epsilon~\to~ 0^{+}.$$
V) Physically, according to the Born rule, the integral (10) of the overlap
$$ \tag{10} \left| \int_{\mathbb{R}}\! \mathrm{d}x_1~
\langle x_1|x_2\rangle\right|^2 ~=~1 $$
is supposed to denote the tautological probability that a particle located at position $x_2$ belongs to the real axis $\mathbb{R}$ with probability 100%.
Comparing eqs. (9) and (10), we are naturally lead to choose the power $p=1$, and therefore the Dirac normalization (2). Note that the power $p=1$ means that the position state $|x_1\rangle$ fails to be normalizable, and in particular, it does not belong to the Hilbert space, cf. eq. (7).
VI) A more rigorous discussion of eqs. (2) and (10) can be given by introducing momentum eigenstates. It turns out that ultimately eq. (10) is problematic, cf. e.g. this Phys.SE post.

A:
Why cant these basis vectors be normalized to one, only to the delta function?

Because that would make those continuously indexed vectors unsuitable for the role of a "continuous basis" for normalizable functions. Here is the explanation. Suppose some function $\psi(\mathbf r)$ is expressed as the integral
$$
\psi(\mathbf r) = \int c(k) \phi_k(\mathbf r)\,dk,
$$
where the functions $\phi_k$, $\phi_{k'}$ are orthogonal for $k\neq k'$:
$$
\int \phi_k^*(\mathbf r) \phi_{k'}(\mathbf r)\,d^3\mathbf r = 0
$$
(at least in distributive sense).
The above expression of $\psi$ can be described as "linear combination of the basis functions $\phi_k(\mathbf r)$". If the function $\psi$ is to be used to calculate probability density according to the Born rule, we have to require
$$
\int \psi^*\psi\, d^3\mathbf r = 1.
$$
This leads to
$$
\int \int c^*(k)c(k') (\phi_k, \phi_{k'}) \,dkdk' = 1,~~~(*)
$$
where $(\phi_k, \phi_{k'})$ is a scalar product of two continuously-indexed functions:
$$
(\phi_k, \phi_{k'}) = \int \phi_k^*(\mathbf r) \phi_{k'}(\mathbf r)\,d^3\mathbf r.
$$
Imagine points of plane labeled by Cartesian coordinates $k,k'$. If we had $(\phi_k, \phi_{k'}) = \delta_{kk'}$ with ordinary Kronecker delta, the scalar product would be non-zero only on the diagonal $k=k'$ which has zero area, while all over the large area where $k\neq k'$ it would vanish. The integral in (*) would then vanish too and couldn't be equal to 1 as needed.
One way to make the integral in (*) have a non-zero value is to postulate that for the above orthogonal functions, $(\phi_k, \phi_{k'})$ is to be regarded as some singular distribution of the kind Dirac introduced - to bring substantial contributions from the diagonal $k=k'$ only.
In practice we choose functions $\phi_k(\mathbf r)$ such that they obey
$$
(\phi_k, \phi_{k'})= \delta(k-k').
$$
Then the integral in (*) is
$$
\int |c(k)|^2\,dk,
$$
which can be non-zero and equal to 1 for properly normalized function $c(k)$.
In the language of kets, the kets $|x\rangle, |y\rangle$ are meant to be such that they satisfy the relation
$$
\langle x|y\rangle = \delta(x-y),
$$
because only then the relation
$$
|\psi\rangle = \int |x\rangle \langle x|\psi\rangle \, dx,
$$
which is part of the motivation behind the formalism of kets, is valid and consistent with
$$
\langle \psi|\psi\rangle = 1.
$$
The expression
$$
\langle x|x\rangle
$$
is not a valid expression and usually is not used in manipulations with the bra-ket formalism; if we used the above relation, we would get $\delta(x-x)$, which could be regarded as either positive infinity or not a meaningful number at all (since $\delta$ is not an ordinary function and does not have ordinary number-valued function values.)


text:
Q: What is the meaning of this Boolean function definition?
For every Boolean function except the one identically equal to zero we can say that:
$$f(x_1,x_2,...x_n)=\bigvee [f(\alpha_1,...\alpha_n)\land x_1^{\alpha_1}\land...x_n^{\alpha_n}] \\
 f(x_1,x_2,...x_n)=\bigwedge [f(\alpha_1,...\alpha_n)\lor x_1^{\alpha_1}\lor...x_n^{\alpha_n}]$$
where $\alpha_i \in \{0,1\}$

The use of $\lor$ and $\land$ outside the brackets and $f(\alpha_1,...\alpha_n)$ confuse me. Is this just a way of saying that any Boolean function can be written in disjunctive normal form and conjunctive normal form?

A: This would make sense if the $\bigvee[\cdots]$ means to take the disjunction of one instance of the formula in brackets for each possible combination of values for the $\alpha_i$s.
In that case then, yes, it's just a way of saying that the function can be written in disjunctive and conjunctive normal forms. Why they exclude the always-0 function is a mystery.
But it is not really standard to omit the index range like that. And the notation also seems to depend on using $x^0$ and $x^1$ to denote $x$ and $\neg x$ (or vice versa), which is definitely not a standard notation.


text:
Q: Altering order of attributes in table using ArcPy I have gone through a sequence of table joins. The resultant table should be with the attributes rearranged in more logical order. I cannot find this functionality within ArcGIS or any mention of it in Python
For example, say a TableResultingFromJoins has the following attributes:
v1,v2,v3,w1,x1
... and I want it like this:
v1,w1,x1,v2,v3
What do I do?


text:
Q: what i'am doing to retrive the date that date like this "dd/MMM/yyyy" only i'am using datetimepicker inthat i'am applying  custom format like this"dd/MMM/yyyy" and date saving this format in  database. my query is retrive that date it come like"dd/MMM/yyyy 12:00:00 AM" .what i'am doing to retrive the date that date like this "dd/MMM/yyyy" only?

A: Try Using the below code.
  DateTime FinancialYearStart =Convert.ToDateTime(dt.Rows[0][6].ToString());
  string YearStart= FinancialYearStart.ToString("dd/MM/yyyy");


text:
Q: How to determine bounding box of current qgis 'map canvas extent' from the python console I've asked a similar question here: How to quickly calculate bounding box coordinates of a selected polygon with qgis
...regarding a quick way to determine the bounding box of a given layer.
Is there any way to do the same thing for the current qgis view? I imagine it is an iface property but cannot find it in the documentation. Thanks.
update:
I'm working with the qgis print (map) creator right now, and I've found a button which appears to call a function that I'm alluding to. If you open the print creator, in the right side bar there is a menu button called "Item Properties". Click on this and below there is a submenu called "Extents". Expand that and there is a button called "Set to map canvas extent". This button appears to utilize the function I'm alluding to by extracting the bbox coords of the main qgis map view.

A: This will return you the extent of the canvas.
extent = iface.mapCanvas().extent()

Reference: http://qgis.org/api/classQgsMapCanvas.html#a878f0c387c9475d59c6aac425db01020


text:
Q: Cannot record video+audio on iPhone Safari I have used RecordRTC for capturing the video+audio from the browser.
For Android devices, it's working perfectly as expected. But in iPhone devices especially on the safari browser, it's not recording as expected.
Browser console produces the following error.
Your browser does not support Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.
Could someone please help me out like:
Does Safari support basic video capturing?

A: It is better to use StereoAudioRecorder which is made in RecordRTC.js as Recorder for Safari.
This is the document of StereoAudioRecorder.
You're going to have to read this first :)
https://recordrtc.org/StereoAudioRecorder.html
const option = {
  type: 'video',
  recorderType: StereoAudioRecorder
};
const recorder = new RecordRTC(mic, options);

recorder.startRecording();

I hope this will help you.

A: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder
MediaRecorder was introduced in iOS14 (Safari 14), if you have an older version, this can be your problem.


text:
Q: How do I avoid a conflict during rebase when a later commit resolves the conflict? How to easily rebase branch with conflicts that are already fixed at the end of the rebase in git?
For example, I am on a feature branch and there are 2 commits in the master branch for the rebase.
First commit makes a conflict, but if the rebase joined both of the commits together, there would not be a conflict after the second commit.
So how to rebase it as a whole instead of rebasing it 1 by 1 and solving the conflicts twice?
I think it must be answered somewhere, but I can't find anything, because all the similar questions titles are vague.

A: The best way is to squash the two commits first (by using the interactive rebase) and then rebase it on the master.

*

*squash the last 2 commits by interactive rebase:
git rebase -i head~2

choose squash (or fixup) for the 2nd commit

*and then rebase on master
git rebase master

A: You should squash the commits in question before you rebase onto master.  Do this with an interactive rebase onto the most recent common ancestor:
git rebase -i $(git merge-base master HEAD)

That way, the combined commit, when represented as a patch, can be applied to master cleanly:
git rebase master

The original first commit you are trying to apply to master will conflict, plain and simple.  You must be able to check out that "state" once it is finished, so Git makes you resolve the conflict.  Your fundamental question boils down to "how can I apply a patch that contains a conflict without creating a conflict," which you obviously cannot do.  By squashing the commits first, you remove the need to apply the conflicted commit.


text:
Q: Java JOptionPane.showInputDialog() getting called more than once when code only says once Okay, so I'm making a online fighting game and the dialog where you input the server IP keeps popping up again and again even though the code only asks for it once. It's not in any kind of loop though, so I dunno what's going on.
    public void connectAndInit(){
        try{
            String ip = JOptionPane.showInputDialog("Input server IP.");
            players = new Player[MAX_PLAYERS];
            players[0] = new Player(25,25,135);
            players[1] = new Player(750,550,315);

            ct = new ClientThread(ip, players);
            ct.start();
            ct.setPriority(Thread.MAX_PRIORITY);

            playerNum = ct.playerNum;

            init = false;
        }

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

    @Override
    public void update()
    {
            if(init)
            connectAndInit();
    }

Here is the game with the problem: http://prime.programming-designs.com/java/metaship-client.jnlp
And here is the server you need to start before you run the game: http://prime.programming-designs.com/java/metaship-server.jnlp

A: I'd need to see the class hierarchy to be sure, since I'm not 100% on when and why update() is called but here's what I suspect is happening.
update() is being called twice, once initially (when you first show your JOptionPane) and again for some reason.  Possibly when the JOptionPane is show, destroyed, or when it causes a repaint in some other component.
The gotcha is that while the JOptionPane is shown execution on that thread has stopped, so when it is closed there's a mad scramble for execution threads and connectAndInit() is often (or always) called before init=false is reached.  If the calls to update() are coming from different threads it's probably an always proposition.
To fix this, change your code to:
if(init){
  init=false;
  connectAndInit();
}

And dispense with the init=false; in connectAndInit().

A: Let's say update() gets called a hundred times at once in a hundred different threads. init will be true in every thread, so connectAndInit() will be called a hundred times, and thus your dialog box will be shown a hundred times.
I'm not sure if that's necessarily what's happening here, but it very well could be.

A: Good case for using your debugger.
Anyway, my guess would be to check that the init variable you're setting is not set elsewhere, e.g. by a separate thread.


text:
Q: Window.popup Does not keep Session values When system is in main window it acts well , but sometimes when i generate bill through ajax and after generate bill window.popup open automatically for show details in bill format.
on that time log in session is not stored,
in short when window.popup open session value is blank and after refresh main screen system will be log-out.
possibilities :
Ajax is creating issue for session
Window.popup does not support session .

Please help Give me suggestion .....

A: Ajax is creating issue for session i really dont think so
Window.popup does not support session  nope, it does support session
your issue is you are starting new session with another id. include the following on top every page
if you are on php for starting the session
if(!isset($_SESSION)){session_start();}

including the page that opens up on popup