text:
Q: Convert Json Javascript format to PHP readable format I have bunch of json files to read through and store some information to db using PHP.
The problem is these json keys are without quotes like:
[{f:{v:11,ib:5,gh:"res",bfr:7,ju:7,ugy:8,ki:"y"...
PHP doesn't recognize it as json. However, if I take this json file and run it in a browser with javascript function "JSON.stringify" the data is formatted with quotes which can be used in PHP.
So I wrote a script to parse these files using javascript and then post it to PHP script to write it to the server. Works well in the browser BUT I cannot automate this as curl does not run javascript!!!
Is there anyway to convert json format (without quotes) to PHP readable format? I tried this suggestion... regex option did not work and I do not know how to work with PEAR, even though my server has PEAR Version: 1.10.1 and PHP Version: 5.4.45

A: Here is my solution to your problem. Yeah it is regex but it works.
$text = preg_replace(["/\\\\'/", '/("(.*?)"|(\w+))(\s*:\s*(".*?"|.))/s'], ["'", '"$2$3"$4'], $text);
$text = json_decode($text);

$text - is the bad formatted json
For the last comment this should work:
$text = preg_replace(["/\\\\'/", '/("(.*?)"|(\w+))(\s*:\s*(".*?"|.))/s', '/((:\s*)(0\d+))/'], ["'", '"$2$3"$4', '$2"$3"'], $text);


text:
Q: CPU usage different? I have a basic question.
If I run an executable file (Release, Visual Studio 2010) on two computers with the same CPU speed run two different Windows operating systems, eg. Windws7 vs XP, shall I expect to see different CPU usages when I measure it using the task manager? Is the CPU speed the only factor to measuring the CPU usage?
Thanks.
Sar

A: Different OS's?  Yes.
Operating Systems are the go-between between the programs you run and the bare-metal they run on.  As OS'es change and evolve the naturally and and remove features that consume resources--these are things that run in the background; or they could be changes to the manner in which the OS speaks to the hardware.
Also, the measurement of CPU usage is done by the OS.  There isn't a tachometer on chips saying "running at 87% of redline", but rather that "tach" is constructed largely by the OS.

After better understanding your situation:  I would suggest taking a look at the Performance Monitor (perfmon.exe) which ships with both XP and Win7, and gets you much finer-grain detail about processor usage levels.   Another (very good) option would be to consider running a profiler on your application on both OSes and compare the results.  It would likely be the best option to specifically benchmark your application on both OSes.

A: Even on the same OS you should expect to see different usages, because there are so many factors that determine CPU usage.

A: The percentage of CPU usage listed in the task manager is not a very good indication of much of anything, except to say that a program either is, or is not using CPU.  That particular statistic is derived from task switching statistics, and task switching is very sensitive to basically every single thing that's going on in a computer, from network access to memory speed to CPU temperature.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Windows: how to disable scanning of Smart Cards Under Windows (at least, 8 and 10), when a Smart Card is inserted in a PC/SC Smart Card reader, something in the OS typically issues Select commands (C-APDUs starting in 00 A4) to the Smart Card, as part of scanning for certificates for automated logon.
How can this scanning be avoided, without disabling the SCardSvr service responsible for PC/SC, so that SCardTransmit and the like remain usable? This scanning can be an issue when the Smart Card is unable to process the Select command and becomes inoperable (for some reason like being in a debug mode).
I'm aware that under gpedit.msc, Computer configuration, Administration templates, Windows components, Smart Card, setting Enable Plug and Play Smart card Service to Disabled avoids recognition of Smart Cards as plug-and-play devices. It however does not disable said scanning.

A: The only way to stop the scan is to disable the device or stop all smart card services.
Start/stop smart card system services
For system services, there are three that are associated with smart cards.
The main one is SCardSvr, but a second one is ScDeviceEnum
or the Smart Card Device Enumeration Service.
On my computer the Startup type for both is Manual, so I assume yours are too
(better check it).
Disabling the second service may be enough, done this way:
sc config ScDeviceEnum start= disabled
sc stop ScDeviceEnum

Note the blank after start=.
Enabling is done with:
sc config ScDeviceEnum start= demand

You may create two .bat files with these command(s),
to disable and enable the service(s) (one or both).
It is also possible to create desktop shortcuts to the two files for fast execution.
I don't really know, and hope that a reboot is not required.
Start/stop smart card device
You may use the Microsoft utility of
Windows Device Console (Devcon.exe),
downloaded from github
DevCon-Installer
(click "releases"),
to enable and disable drivers.
To see an example of using Devcon, see the post in
ss64.com.
The commands to disable and enable a device are:
devcon.exe disable "name of smart card device"
devcon.exe enable "name of smart card device"

The name of the smart card device can be found in Device Management.
As said before, these two commands can be stored in two .bat files.
For testing, try all commands first in an elevated Command Prompt.

A: I had the same problem. Use gpedit.msc

*

*Computer Configurations ->

*Administrative Templates ->

*Windows Components ->

*Smart Card ->

*Enable Plug and Play Smart card Service

*and set it to Disabled not helped.

So I Disabled all services in that list (I mean Windows Components -> Smart Card). And this was a solution, after that windows didn't send any APDU to the card.


text:
Q: Copiar dados de uma tabela para outra JS / HTML Tenho 2 tabelas (tab1 e tab2) a tab1 possui 'inputs' pra cadastrar informações. A tab2 retorna produtos já cadastrados na base de dados.
Gostaria de criar uma função que ao selecionar a linha(checkbox) o valor da "td" "valproduto" fosse enviada para a primeira linha da tab1 no campo "valprod".
Estou usando um exemplo de outra pergunta(De uma tabela para outra tabela html) porém neste exemplo a tab1 recebe todo o valor da "tr".

var adicionar = document.querySelectorAll("input[type='checkbox']");

var tab1 = document.querySelector("#tab1 tbody");
var tab2 = document.querySelector("#tab2 tbody");
var adicionarOnClick = function () {
    var escopo = this.checked ? tab1 : tab2;
    escopo.appendChild(this.parentNode.parentNode);
};

for (var indice in adicionar) {
    adicionar[indice].onclick = adicionarOnClick;
}

//---------------------------
    (function ($) {
        RemoveTablePRow = function (handler) {
            var tr = $(handler).closest('tr');

            tr.fadeOut(200, function () {
                tr.remove();
            });

            return false;
        };
    })(jQuery);

    (function ($) {
        AddTablePRow = function () {
            var newRow = $("
");
            var cols = "";
            cols += '+<input type="text" name="valprod" value="0">	';
            cols += '<input type="text" name="prcvenda" value="">	';
            cols += '<td Remover Linha	';
            newRow.append(cols);
            $("#tab1").append(newRow);

            return false;
        };
    })(jQuery);

    Tabela 1

Adicionar
<form method="post">

            Valor do Produto
            Preço de Venda

            +
                <input type="text" name="valprod" value="50">

                <input type="text" name="prcvenda" value="">

                Remover Linha

        Tabela 2

            Selecionar
            Codigo
            Descrição
            Valor

                <input type="checkbox">

            001
            Caneta
            23,00

    <button class="btn_enviar">Enviar</button>
</form>


text:
Q: LicFileLicenseProvider class and licenses.licx file I am going to create a LicFileLicenseProvider based license provider. I have read many articles, questions and answers regarding this content. Finally, I have created my license provider, MyLicFileLicenseProvider and it has two modes, RunTime and DesignTime. I am going to set license for design time only. I did it and it is working good as well. Therefore, the license will be (and should be) used only during the compiling with existance of the "licenses.licx" file.
A. Normal Case
1) Create a class:
[LicenseProvider(typeof(MyLicFileLicenseProvider))]

public class XXXObject

{

        private License license = null;
        /// <summary>
        /// Creates an instance of the XXXObject object.
        /// </summary>
        public XXXObject()
        {
            try
            {
                license = LicenseManager.Validate(typeof(XXXObject), this);
            }
            catch (Exception ex)
            {
                throw new SecurityException("Invalid license!");
            }
        }
}

2) Then, create a licenses.licx file, content
   Object Full Name, Name space, Version, Culture, PublicKeyToken
3) Create a license file, XXX.XXXObject.lic file.
Now, I have created all necessary stuffs and compiled the project. It is compiled and working well.
B. Bi-normal case.
My question is, as I mentioned in above I have decorated the XXXObject class with the attribute [LicenseProvider(typeof(MyLicFileLicenseProvider))].
Then, I exclude the licenses.licx file from the project. Then, compiled the project. However, it is still compiling. This is not make sense, because I decorated
the class with [LicenseProvider(typeof(MyLicFileLicenseProvider))], and it should be looking for the licenses.licx, but it did not and compiled without error?


text:
Q: Factorising n! fitting $x^\frac{n}{k}$ Prove: There exist real numbers a,b, such that 1<a<b and for any integer $n\ge 2$, there exist positive integers $x_1\ge x_2\ge ...\ge x_{\lfloor{\frac{n}{2}}\rfloor}$such that $n!=\Pi_{k=1}^{\lfloor\frac{n}{2}\rfloor}x_k$ and $x_k\in (a^\frac{n}{k},b^{\frac{n}{k}})$.
I've tried to list all the prime factors of n! but that's too complicated. Notice that the function $x^\frac{n}{k}$ is too strange. It means there are many small factors and a few large factors.

A: Your initial guess about prime factors can produce a solution. More precisely, it is known that
$$
n!=\prod_{p\leq n} p^{v_p(n!)},
$$
where the product is taken over prime numbers and
$$
v_p(n!)=\left[\frac{n}{p}\right]+\left[\frac{n}{p^2}\right]+\ldots
$$
Let now for any $1\leq k\leq n/2$
$$
x_k=\prod_{\alpha, p: p^\alpha\leq n/k}p.
$$
The product is over prime values of $p$ and positive integers $\alpha$. The inequality $x_{k}\geq x_{k+1}$ is trivial. Product of all $x_k$ is equal to $n!$ by the factorisation above: the factor $p$ that corresponds to a given $d=p^\alpha$ appears in $x_k$ for $d\leq n/k$, there are $\left[\frac{n}{p^\alpha}\right]$ such $k$. This means that
$$
\prod_k x_k=\prod_{\alpha,p} p^{\left[\frac{n}{p^\alpha}\right]}=\prod_{p\leq n} p^{v_p(n!)}=n!,
$$
as needed. Finally, let $\Lambda(d)$ denote the von Mangoldt function, i.e. $\Lambda(d)=\ln p$ if $d=p^\alpha$ for some $p$ and $\alpha$ and $\Lambda(d)=0$ otherwise. Then we clearly have
$$
\ln x_k=\sum_{d\leq n/k} \Lambda(d)=\psi(n/k).
$$
Here $\psi(x)$ is Chebyshev's psi function, the summatory function of $\Lambda$. It is well-known that there are $c,C>0$ such that for $x\geq 2$ we have
$$
cx\leq \psi(x)\leq Cx.
$$
In particular, one can take $1<a<e^c$, $b>e^C$ and get the desired bound:
$$
a^{n/k}\leq \exp(\psi(n/k))=x_k\leq b^{n/k}.
$$


text:
Q: Keeping Existing Sessions When Upgrading to Rails 5.2 (with Redis Session Store) I have recently finished a big upgrade of a Rails application. I took the App incrementally from Rails 4.2.8 to Rails 5.2.3. Everything has gone smoothly, all our automated tests are passing, and we've begun user acceptance testing.
So far the only issue that has been found is that logged in users are being signed out by this upgrade. We previously had the redis-rails gem (version 4.0.0) installed to enable using Redis for our session_store and now we're using the built-in Redis store that comes with Rails 5.2.
I have our configuration set up to use the same Redis connection and the same session_store key value as before, and I can't figure out why sessions are still being reset. It seems like perhaps redis-rails 4.0.0 was not properly setting the session_store key value?
Has anyone else dealt with this and successfully retained existing sessions when upgrading from redis-rails to Rails 5.2?
Edit:
Other possibly-related gems that have been updated include ruby 2.3.4 => 2.5.5, devise 4.0.3 => 4.6.2, & redis 3.2.2 => 4.1.2

A: I have figured this out! I thought that the key parameter for the session_store config was supposed to be setting the Redis Key value. This parameter is actually used for the users browser cookie key. The upgrades I made did add a new Redis key to the session store values, but it doesn't look like there are any parameters to change or remove this new Redis key.
My solution was to use a script to rename all of my Redis session keys to match the new format (I use 'namespace' as the Redis cache store namespace):
redis-cli --scan --pattern "namespace:*"  | \
awk '/^/ {new_key=$1;gsub(/namespace:/,"namespace:_session_id:", new_key); printf "*3\r\n$6\r\nrename\r\n$" length($1) "\r\n" $1 "\r\n$" length(new_key) "\r\n"  new_key "\r\n";}'  | \
redis-cli --pipe

The final relevant config is:
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'], namespace: 'namespace' }
config.session_store :cache_store, key: '_mysite_session'

The downside to this is that it also invalidates and incorrectly renames all of the other Redis cache objects since the session stores did not have a key to identify them before.


text:
Q: Execution time with warm up cache I have a query that takes around 1 second on first execution and 15-50 ms after running the same query again. The only difference between EXPLAIN outputs is that the second execution contains a lot of Buffers: shared hit which are probably (and correct me if I'm wrong) responsible for the noticeable speed up.
So I was wondering, when people talk about queries taking x milliseconds, are they usually referring to the time it takes on first execution?
Do you care about a slow query that after caching is actually quite fast? This assumes that your application requires reasonable response times (e.g. e-commerce, real-time analytics, etc).
I'm using PostgreSQL 9.5, but I intended to ask something general enough to be widely useful.

A: If the reporter had any thoughts of rigor I would expect the hot cache / cold cache information to be included in the report. Otherwise it is like saying a car costs $y without saying which option, warranty, service or taxes that includes. Similarly I would expect to see it stated that subsequent tests were performed under the same conditions and how that was achieved. In less formal discussion I would assume hot cache, as that is the usual operating condition, unless told otherwise.
The two conditions emphasise different aspects of the host configuration. For a cold cache one sees more of an impact from the disk subsystem. For hot cache it is more about memory pressure and efficiency of the query plan. It would be unusual to find a workload that was purely one or the other in a real-world scenario, however.
SQL Server, for one, assumes a cold cache when costing a query plan.


text:
Q: Trying to get pagination working on WP_Query() post grid So I've been developing my own theme as a learning experience, and I'm at a loss regarding how to get pagination working. I've tried several things before getting to this point and asking, I just seem to be missing something.
This is on a "Static Frontpage" which is why the $paged is calling 'page' at least, that's one thing my research brought to light.
    <?php while ( have_posts() ) : the_post(); ?>

Recent Posts

            <?php
                 $paged = (get_query_var('page')) ? get_query_var('page') : 1;
                $Post = array(
                    'post_type'      => 'post',
                    'posts_per_page' => 4,
                    'orderby'     => 'modified',
                    'order'       => 'DESC',
                    'paged' => $paged
                );
                $q    = new WP_Query( $Post );
            ?>

                <?php while ( $q->have_posts() ) : $q->the_post(); ?>

                            <?php
                            //echo get_the_date()
                                $u_time = get_the_time('U');
                                $u_modified_time = get_the_modified_time('U');
                                    if ($u_modified_time >= $u_time + 86400) {
                                echo "Last updated ";
                                    the_modified_time('F jS, Y');
                                echo ""; }
                                else {echo "Posted "; the_time('F jS, Y');}
                            ?>

                    <?php
                        $perma_cat = get_post_meta($post->ID , '_category_permalink', true);
                            if ( $perma_cat != null ) {
                                $cat_id = $perma_cat['category'];
                                $category = get_category($cat_id);
                            } else {
                                $categories = get_the_category();
                                $category = $categories[0];
                            }
                                $category_link = get_category_link($category);
                                $category_name = $category->name;
                            ?>

                        <picture class="post-thumb block">

                            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('medium'); ?>

                                <a class="post-cat bg-darkpurple" href="<?php echo $category_link ?>"><?php echo $category_name ?>

                        </picture>

                            <a href="<?php the_permalink(); ?>">
                                <?php the_title(); ?>

                            <?php echo '
' . get_the_excerpt(). '
'; ?>

                <?php endwhile; ?>

                    <?php
                        echo paginate_links( array(
                        'base'         => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
                        'total'        => $query->max_num_pages,
                        'current'      => max( 1, get_query_var( 'page' ) ),
                        'format'       => '?page=%#%',
                        'show_all'     => false,
                        'type'         => 'plain',
                        'end_size'     => 2,
                        'mid_size'     => 1,
                        'prev_next'    => true,
                        'prev_text'    => sprintf( ' %1$s', __( 'Newer Posts', 'text-domain' ) ),
                        'next_text'    => sprintf( '%1$s ', __( 'Older Posts', 'text-domain' ) ),
                        'add_args'     => false,
                        'add_fragment' => '',
                    ) );
                    ?>

            <?php wp_reset_postdata(); ?>
        <?php endwhile; ?>

Thanks for any insight

A: If you're set to a static front page, why would there be pagination?
The proper way to have a paginated grid of posts as your front page is to set the homepage to "Your latest posts". You would then develop your front-page.php, home.php or index.php template to display posts as a grid (use the Template Hierarchy to determine which file you need).
In that template you don't need to use WP_Query or $paged or anything like that. Only the main loop:

Recent Posts

    <?php while ( have_posts() ) : the_post(); ?>

    <?php endwhile; ?>

    <?php
    echo paginate_links( array(
        'end_size'     => 2,
        'mid_size'     => 1,
        'prev_text'    => sprintf( ' %1$s', __( 'Newer Posts', 'text-domain' ) ),
        'next_text'    => sprintf( '%1$s ', __( 'Older Posts', 'text-domain' ) ),
    ) );
    ?>

Note the other changes I made:

*

*The pagination links should be outside the while loop.

*I've removed arguments paginate_links() because they were either unnecessary due to the proper loop structure, or because they were just set to the defaults.

If you'll humour me in the comments, this misuse of WP_Query and pagination is by far the most common mistake I see on this site, so I'm just curious where you got the idea that you needed to do a new WP_Query, because it should never be necessary for the main list of posts in any of the standard templates, but I see it done almost every day. Is there a tutorial out there spreading this, or something in the official docs that's implying this?


text:
Q: How to change body background image by clicking a button in Angular Js? Hello I am adding buttons to my website that allow users to change the background.
I am trying to make the background change with Angular.
So far I have successfully been able to change the background color a couple ways (changing to a single color and gradient)... however, I am trying to change the background-image with one button and the other button I am trying to change the background gradient and background-size at the same time.
These are the steps I have done so far:

*

*<body ng-style="myStyle">

*

*Successful: <input type="button" class="bg stripes" ng-click="myStyle={background: 'red'}">

*Failing: <input type="button" class="bg numbers" ng-click="myStyle={background-image:'url(../images/count2.png)'}">

*Successful: <input type="button" class="bg stripes" ng-click="myStyle={background:'linear-gradient(45deg, #379690 25%, #3aa19b 25%, #3aa19b 50%, #379690 50%, #379690 75%, #3aa19b 75%, #3aa19b)'}">

*Failing: <input type="button" class="bg stripes" ng-click="myStyle={background:'linear-gradient(45deg, #379690 25%, #3aa19b 25%, #3aa19b 50%, #379690 50%, #379690 75%, #3aa19b 75%, #3aa19b)',background-size:'100px 100px'}">
Please help! Thanks a lot!

A: You have a problem with the syntax. You need to wrap background-image key in quotes, otherwise it's not a valid identifier. It works with background because having nothing but alpha characters, it doesn't require quotes.
<input type="button" class="bg numbers" ng-click="myStyle={'background-image': 'url(../images/count2.png)'}">

Then it will work properly:

angular.module('demo', [])
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js"></script>

<body ng-app="demo" ng-style="myStyle">

  <input type="button" class="bg numbers" ng-click="myStyle={'background-image': 'url(http://subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/dark_embroidery.png)'}" value="Set background">

</body>

A: You don't have to redefine the myStyle object each time.
In your ng-click you could
ng-click="myStyle.background='...';myStyle.backgroundSize='...'"

You can fiddle around this fiddle.


text:
Q: How to hit breakpoint in startup.cs for a program that is already running? I have an application that is always running on IIS, (the program is always deployed to IIS, and to update it you will need to rebuild the solution).
But I want to add a breakpoint on startup.cs for debugging purposes.
But since the app is already running I cannot hit the break point.
And if I want to rebuild the program then debugging mode will stop.
Are there any workarounds?
Thanks

A: MS Docs: Debugger.Launch Method

Launches and attaches a debugger to the process.

Debugger.Launch();

As mentioned by @Ibrennan208, Debugger.Break() might be a workaround if Launch does not work:

To build off of @MarkusMeyer if the Launch doesn't work, Debugger.Break() could also be a workaround, it will prompt you to select a debugger if you don't already have one selected. That being said, definitely try Launch before Break.

If no debugger is attached, users are asked if they want to attach a debugger. If users say yes, the debugger is started. If a debugger is attached, the debugger is signaled with a user breakpoint event, and the debugger suspends execution of the process just as if a debugger breakpoint had been hit.


text:
Q: Are generator function's local variable stored on Stack or Heap? In this article:
https://wingolog.org/archives/2013/06/11/ecmascript-generators-from-a-performance-perspective, it mentioned that:

In a generator function, V8 stores local variables on the  heap
  instead of on the stack.

but it also contradicts itself with this next passage:

The exception to this case is when you yield and there are
  temporaries on the stack. Recall in my article on V8's  baseline
  compiler that the full-codegen is a stack machine.  It allocates slots
  to named locals, but temporary values go  on the stack at run-time,

The part that I don't understand is that generator functions always use yield, and I would assume that the suspension mentioned in the article refers to yield statement.

A: I think the article is missing an example:
  return 12 + yield 5

In this case, 12 has to be allocated on the stack, and when suspending the iterator, it has to be copied off the stack, and then onto the stack again when the iterator continues. The second paragraph talks about "temporaries" (12 in this case), not about "variables".


text:
Q: How do I create a "Licensing add-on" for my Android application? I see that some apps on the market come as a Free version, and a "Licensing add-on", where you can use the Free version with its limited features, or buy the license apk which just acts as a license key for the originally "Free" version, to unlock extra features hidden within the "free" version.
Can someone point me to an example of how this can be done?

A: You can use the PackageManager's getInstalledPackages() or getInstalledApplications() to simply check if the license package is installed.
Or, if you want something a bit more sophisticated, you can give the main app and the license apk the same user id in the manifest. This means that both apps can have access to your data (Shared Preferences, SQLite DB, etc). Then the license app just needs to be run once; it can store a value in the shared data indicating that the extended functionality should be enabled. The main app just needs to check this flag and alter its behaviour accordingly.
The advantage of the second approach is that the license app can be uninstalled after being run, and the main app will continue to allow the extended functionality.

A: A better approach might be to look at in-app billing. That would allow you to have multiple 'products' and enable features based on what products people have bought.
The license apk approach is very simple: you know the package of the license apk and check if it is installed. If it is, you assume they have bought it, and enable 'pro' features. The disadvantage is that it is essentially an app that does nothing, and people have to keep it installed. It also gets its own rating and download count, and probably 1-star comments like 'crap, does nothing' from people who don't understand the concept.


text:
Q: Is $L^{n}$ normal, where $L$ denotes the closed long ray? 1.I am trying to prove that $L^{n}$, the $n$-$th$ product of closed long ray is normal, so that I can apply Tietze extension theorem to its closed subset and prove something else. I think I am able to prove this (if it is true) for $n\leq3$ in a very elementary and ugly method, but I cannot convince myself about generalizing this in a staightforward way to higher dimensions. Could anyone offer me hint?
2.Possibly related to 1: I found this 1963 paper. At the beginning the author says whether the pruduct of a normal space $X$ and unit interval $I$ must be normal was then an open question. Is it still open now? Is there some condition which ensures the normality of $X\times I$?
Briefly explain my idea for $n=2$: I like to use the following equivalent criterion for normality: for any closed $E$ contained in open $U$, there exists open $V$ such that $E\subset V\subset\overline{V}\subset U$. It can be proved that if $F\subset U\subset L$ where $U$ is open and $F$ is closed unbounded (closed in topology sense and unbounded in order sense) then $U$ is "big", namely $[x,+\infty)\subset U$ for some $x\in L$. The proof is via Fodor's lemma and the property of $L$ near limit ordinals. Similarly if $F\subset U\subset L^{2}$ where $U$ is open and $F$ is closed unbounded in both directions, then $[x,+\infty)^{2}\subset U$ for some $x$. Deleting $(x,+\infty)^{2}$ from $L^{2}$ we obtain something homeomorphic to gluing two $L\times I$, and we would be almost done if $L\times I$ is normal, which I believe I am able to prove by similar augument. The case when $F$ is unbounded only in one direction can be reduced to $L\times I$.

A: $X \times I$ is normal iff $X$ is normal and countably paracompact (every countable open cover has a locally finite refinement). This is due to Dowker (On countably paracompact spaces, Canad. J. Math. 3 (1951) 219-224 ), see Engelking General Topology, Theorem 5.2.8 for an accessible modern reference.
A normal non-countably paracompact space $X$ (so that $X \times I$ is not normal) exists in ZFC, as shown by M.E. Rudin in 1971 (so that problem was open for about 20 years).
But ordered spaces are countably paracompact so $L \times I$ is certainly normal.
It is also well-known that $\omega_1^n$ is normal (and pseudocompact) so I think (but I have a PhD thesis by van Dalen that has a lot of results on this problem that I could look into to) that $L^n$ will probably also be normal.
If we add the compactifying point to $L$, so we get $L^+$ (as its sometimes called) though, we can see that $L \times L^+$ is not normal, so it's subtle. This has the same reason that $\omega_1 \times (\omega_1 +1)$ is not normal: $\omega_1$ (and $L$) is not paracompact, and $\omega_1 +1 = \beta \omega_1$ and $L^+=\beta L$ (the Cech-Stone compactification).


text:
Q: The GET method is not supported when redirecting back in Laravel I'm trying to redirect the user back to the previous page if the token entered is invalid  but i'm getting the error:

The GET method is not supported for this route. Supported methods: POST.

Everything works well when the token is valid. Here  is my code:
ForgotPasswordController
public function showPasswordResetForm(Request $request)
{
    $inputToken = $request->token;
    $tokenData = DB::table('password_resets')
                    ->where('token', $inputToken)
                    ->first();

    if ( ! $tokenData) {
      return redirect()
            ->back()
            //redirect back if the token does not exist
            ->withErrors(['token' => 'Token doesnt exist']);
    }

    $token = $tokenData->token;

    return view('auth.passwords.reset')->with('token', $token);
}

Route
 Route::get('reset-password/{token}', 'Auth\ForgotPasswordController@showPasswordResetForm')
        ->name('check.token');

Blade
<form method="POST" action="{{ route('check.token',$token) }}">
    @csrf

            {{ __('Reset code') }}

            <input
                id='token'
                type="text"
                class="form-control @error('token') is-invalid @enderror"
                name="token"
                required
                autocomplete="token"
                autofocus
            >

            @error('token')

                    {{ $message }}

            @enderror

            <button type="submit" class="btn btn-primary">
                {{ __('Continue') }}
            </button>

</form>

A: First of all, if you are sending data through a form, you should avoid using GET (as the one defined in your route). You are making a post request, so this must be consistent with your defined endpoint. Chage it to this:
/** view */

<form method="POST" action="{{ route('check.token', $token) }}">
    //       ^^^^^
</form>

/** route */

Route::post('reset-password/{token}', '/** ... */')->name('check.token');
//     ^^^^

Now, the error is originated when doing the redirect back, this doesn't have to do with this endpoint but the previous one, the one that shows that form. It looks like this previous endpoint is defined as POST instead of GET, this is the one that you should modify to fix the issue.
We can't see how this route is defined so I'll use an example. Try changing it from:
Route::post('show-form', 'MyController@myMethod');

To this:
Route::get('show-form', 'MyController@myMethod');


text:
Q: Core Data: load binary property lazy/only when accessed I have a pretty big list (several thousand entrires) of elements which contain a binary property where a PDF document is stored (can be up to several MB).
How can I fetch all the elements but the binary property not immediately but only when it is accessed via element.document?

A: If I were you, I would save the PDF to the local filesystem, and store only the folder/filename in CoreData.  (Note, you should store only the folder and filename relative to the Documents directory (or other defined folder) rather than the full path to the file, because the Documents folder can actually change (eg. with new builds of your app).
If for some reason you don't want to go that route, you could replace the attribute with a to-one relationship to a new, separate entity which has only one attribute for the PDF data.  Relationships are by default not faulted in, even when the originating object is faulted.


text:
Q: Ayuda error delphi xe7 Me he descargado este codigo de fuente en delphi:
https://github.com/SamuelCFW/GTA-V-Console-Texture-Editor
Pero cuando voy a compilarlo me da error y no he podido solucionarlo,
Alguien me podria ayudar?

A: En cuanto al primer error, si buscas ese componente en los ficheros verás que pone lo siguiente:
btnImport: TAeroButton;

No es un botón estandard (TButton) sino que es otro tipo de componente (TAeroButton). Antes de poder cargar el proyecto (y abrir los formularios) correctamente debes asegurarte de que tienes instalador esos componentes.
En la documentación de ese proyecto te dice que debes tener instalados estos 2 paquetes:

* Vampyre Imaging Library: http://imaginglib.sourceforge.net/
* NTS Code Suite: http://code.google.com/p/nts-code-suite/

El segundo es el que incluye esos botones.
Por otro lado, si Delphi no encuentra un componente instalado al cargar un formulario, (como es este caso), elimnina su referencia para intentar continuar con la carga. en tu caso debe haberlos elimnado y de ahí ese error.
1) Instala los paquetes que aparecen máas arriba.
2) Vuelve a descargar el proyecto y cargalo de nuevo.


text:
Q: Onedrive VBA getting share link of a file my question is rather simple but I've spent several hours googling trying to find a straight forward solution but I haven't found it.
Basically, using vba I want to save an Excel file to oneDrive's public folder which automatically will upload the file to the cloud, and I want to get a share link to that file so I can include it in an automatically generated email. I can already generate the automated email using vba and saving the file to the onedrive folder wouldn't be a problem I think but I want to include the share link before sending the email
I've read a little bit about rest and I have found info on how to communicate with one drive using a number of different programming languages but I haven't found any example vba interacting with onedrive.
Any help will be greatly appreciated

A: This may help you get started: ActiveWorkbook.SaveAs "c:\User\\OneDrive\public folder name\" & name you want to give this file & ".xls" to save, and you have to use HTML tags for the hyperlink:
olEmail.HTMLBody = "
Here is my hyperlink: " & _
                               ""


text:
Q: How do I troubleshoot "INSERT INTO"? I have just now solved an issue that was preventing my SQL "INSERT INTO" code from executing, but it took a long time to find. A comma was missing somewhere.
Suppose this happens to me again. Perhaps I forget a comma again, or perhaps it's some other issue. Is there a diagnostic function I can run that will help me pinpoint what went wrong?
I already know about mysqli_error($conn) and error_reporting(E_ALL) but they didn't help at all.

A: Sorry everyone, it was a really basic error. I wrote mysqli_error($conn); when I should have written echo mysqli_error($conn);


text:
Q: Firefox does not render stylesheet immediately? I'm not sure if this a settings problem or an HTML problem, but on a page layout I'm working on, Firefox does not render the stylesheet immediately. Meaning for maybe half a second I can see the unstyled page, then the stylesheet kicks in and it renders as I expect.
All my stylesheets are in external css files loaded in the head tag. I'm not encountering this on Flock (which is a Firefox variant) nor on Google Chrome/IE.
Any idea how to avoid it?

A: Firebug definitely slows down the page render time.  Brutally so.
Additionally, Install yslow: http://developer.yahoo.com/yslow/ in firefox to make sure that your page is optimized to its fullest.

A: Try disabling firebug.

A: Show us the page! Is it valid?
You might want to search for "flash of unstyled content" or "FOUC" and see what comes up, that's the commonly-used phrase for this phenomenon.

A: You didn't mention the platform, but this can also happen with the Visual Studio built-in web server if IPv6 is enabled in Firefox. See http://blog.codeville.net/2008/11/07/speeding-up-communication-between-firefox-and-visual-studios-built-in-web-server/

A: In my case turning off Firebug didn't help. From the other hand I happend to use @import in my css and when i removed it - the FOUC (Flash Of Unstyled Content) was gone. That is very strange because this behaviour is mostly referred to IE (http://www.bluerobot.com/web/css/fouc.asp/)


text:
Q: c3p0 DataSource monitor deadlock - all threads hang - how to fix We have a Spring based application and recently we went into production. We are using Spring @Controller that ultimately hit DAOs that use JDBCTemplate. It is using c3p0's ComboPooledDataSource
On an increased load (something like 150 concurrent users), the application hangs for all users - the DataSource gets locked by something - on a thread dump, there are like 200 threads that say - obviously the DataSource is deadlocked.
"http-bio-8080-exec-440" - Thread t@878
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Native Method)
- waiting on <146d984e> (a com.mchange.v2.resourcepool.BasicResourcePool)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1418)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:756)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:683)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:718)

After that point the application becomes unusable unless restarted. When this happened DBA team didn't observe any load on the database.
At that time c3p0 was configured like that:
app_en.driverClass=com.mysql.jdbc.Driver
app_en.user=tapp_en
app_en.password=tapp_en
app_en.jdbcUrl=jdbc:mysql://10.10.0.102:3306/tapp_en?useUnicode=true&characterEncoding=utf-8&autoReconnect=true

app_en.acquireIncrement=5
app_en.maxIdleTime=3600
app_en.maxIdleTimeExcessConnections=300
app_en.unreturnedConnectionTimeout=3600
app_en.numHelperThreads=6
app_en.minPoolSize=20
app_en.maxPoolSize=100
app_en.idleConnectionTestPeriod=120
app_en.testConnectionOnCheckin=true

After that, I changed c3p0's configuration as follows - and enabled DEBUG logging for com.mchange.v2.c3p0 package:
app_en.driverClass=com.mysql.jdbc.Driver
app_en.user=tapp_en
app_en.password=tapp_en
app_en.jdbcUrl=jdbc:mysql://10.10.0.102:3306/tapp_en?    useUnicode=true&characterEncoding=utf-8&autoReconnect=true

app_en.acquireIncrement=5
app_en.maxIdleTime=180
app_en.maxIdleTimeExcessConnections=60
app_en.unreturnedConnectionTimeout=30
app_en.checkoutTimeout=10000
app_en.numHelperThreads=12
app_en.debugUnreturnedConnectionStackTraces=true
app_en.initialPoolSize=10
app_en.maxPoolSize=100
app_en.idleConnectionTestPeriod=120
app_en.preferredTestQuery="select 1 from tbl_users"

With this configuration in place, I again ran load tests and the application still hanged... although the threads recover after they are unable to obtain connection to the database. Even though, the game hanged for too many users even though the threads recovered unlike the previous configuration - so they had to restart their clients.
Although all logging was enabled, the c3p0 logs don't log any deadlock messages. The error messages I see are just that:
[06/24/2015 12:20:54] [C3P0PooledConnectionPoolManager[identityToken->1oed6dl9a9ak8qsgqfvdu|4d6145af]-HelperThread-#10] DEBUG NewPooledConnection  - com.mchange.v2.c3p0.impl.NewPooledConnection@7f0bc55a closed by a client.
java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:659)
at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:255)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:621)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1024)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

There aren't any transactions in the application made, nor are we using any TransactionManager or TransactionTemplate. I wonder if this may be some kind of bug in the frameworks used, or misconfiguration. These are the relevant frameworks used:
c3p0-0.9.5-pre8
mysql-connector-java-5.1.24
spring-core-3.2.1.RELEASE
spring-web-3.2.1.RELEASE
mchange-commons-java-0.2.7

We really appreciate any help because this is blocking our efforts to release our product.
P.S. EDIT: Here is the configuration of the DataSource:
<bean id="app_en_DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass" value="${app_en.driverClass}" />
    <property name="jdbcUrl" value="${app_en.jdbcUrl}" />
    <property name="user" value="${app_en.user}" />
    <property name="password" value="${app_en.password}" />

    <property name="acquireIncrement" value="${app_en.acquireIncrement}"></property>
    <property name="maxIdleTime" value="${app_en.maxIdleTime}"></property>
    <property name="maxIdleTimeExcessConnections" value="${app_en.maxIdleTimeExcessConnections}"></property>
    <property name="unreturnedConnectionTimeout" value="${app_en.unreturnedConnectionTimeout}"></property>
    <property name="checkoutTimeout" value="${app_en.checkoutTimeout}"></property>
    <property name="numHelperThreads" value="${app_en.numHelperThreads}"></property>
    <property name="debugUnreturnedConnectionStackTraces" value="${app_en.debugUnreturnedConnectionStackTraces}"></property>
    <property name="initialPoolSize" value="${app_en.initialPoolSize}"></property>
    <property name="maxPoolSize" value="${app_en.maxPoolSize}"></property>
    <property name="idleConnectionTestPeriod" value="${app_en.idleConnectionTestPeriod}"></property>
    <property name="preferredTestQuery" value="${app_en.preferredTestQuery}"></property>
</bean>

And here is some code inside the application that isn't using the jdbcTemplate directly. There is nothing else that does that, everything else is jdbcTemplate.update, jdbcTemplate.query:
    Connection conn = null;
    ResultSet getItemsRS = null;

    try {
        JdbcTemplate jdbcTemplate = getJdbcTemplate(database);

        conn = jdbcTemplate.getDataSource().getConnection();

        UserItems items;

        if (!action.areItemsNew()) {

            conn.setAutoCommit(false);
            conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);

            PreparedStatement getItemsPS = conn.prepareStatement("select * from tbl_items where ownerId = ? for update",
                    ResultSet.TYPE_FORWARD_ONLY,
                    ResultSet.CONCUR_UPDATABLE);
            getItemsPS.setLong(1, userId);

            getItemsRS = getItemsPS.executeQuery();
            getItemsRS.next();

            items = new UserItemsRowMapper().mapRow(getItemsRS, getItemsRS.getRow());
        } else {
            items = new UserItems();
        }

        action.doUserItemsAction(items);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(items.getItemContainers());
        oos.close();
        byte[] data = baos.toByteArray();
        Blob blob = conn.createBlob();
        blob.setBytes(1, data);

        if (!action.areItemsNew()) {
            getItemsRS.updateBlob("data", blob);
            getItemsRS.updateRow();
        } else {
            jdbcTemplate.update("insert into tbl_items(ownerId,data) values(?,?)", userId, data);
        }

    } catch (Exception e) {
        logger.error(e);
        throw new RuntimeException(e);
    } finally {
        if (!action.areItemsNew()) {
            try {
                conn.commit();
                conn.close();
            } catch (SQLException e) {
                logger.error(e);
                throw new RuntimeException(e);
            }
        }
    }

The reason for this code is that I would like to block reading/writing to the user's items before they are updated by this operation action.doUserItemsAction(items) as written above.

A: So, a few things.
1) The "error" messages that you see are not errors, when c3p0 logs an Exception whose message begins with DEBUG, that means you are logging at DEBUG levels and c3p0 has generated the Exception just to capture the stack trace. (c3p0 is an old library; Thread.getStackTrace() didn't exist back in the day, creating an Exception was a convenient way to capture and dump the stack.) You are just logging the expected destruction of pooled Connections due to expiration or test failures. In general, c3p0 expects to log at INFO, it will be very verbose at DEBUG levels.
2) You are not deadlocking c3p0's Thread pool. If you were, you'd see APPARENT DEADLOCK messages and then recoveries. You are experiencing a condition of pool exhaustion: clients are awaiting Connections, but the pool is at maxPoolSize and unable to acquire them.
3) The usual cause of pool exhaustion is a Connection leak: Somewhere in your application's code path, under some (probably Exceptional) circumstances, Connections are acquired and then never close()ed. You need to be very careful to ensure that Connections are reliably close()ed in finally blocks in ways that cannot be skipped due to prior failures within the finally block. In Java 7+, use try-with-resources. In older versions, use the reliable resource cleanup idiom.
4) To test whether a Connection leak is the issue, set the c3p0 config params unreturnedConnectionTimeout and debugUnreturnedConnectionStackTraces. unreturnedConnectionTimeout will work around the problem, but yuck. More importantly, debugUnreturnedConnectionStackTraces will show you where the problem is so that you can fix it, logging the stack trace that opened the unclosed Exception at INFO. (You must set unreturnedConnectionTimeout for debugUnreturnedConnectionStackTraces to have any effect; the stack trace is logged when a Connection times out as abandoned.)
5) Although 0.9.5-pre8 is probably ok, the current production version of c3p0 is c3p0-0.9.5.1 (which depends upon mchange-commons-java v.0.2.10). You might think about using that. I don't think it has anything at all to do with your issue, but still.
I hope this helps!
Update: Since you've now posted code that shows the likely Connection leak, here's a suggestion for how to fix it. Replace your finally block with:
} finally {
    if ( conn != null ) {
        try { if (!action.areItemsNew()) conn.commit(); }
        catch (SQLException e) {
           logger.error(e);
           throw new RuntimeException(e);
        } finally {
           conn.close()
        }
    }
}

Update 2: The redone finally block above will solve the Connection leak, but if I were you I'd also change the logic of this code regarding commit(). Here's a suggested revision:
Connection conn = null;
ResultSet getItemsRS = null;

try {
    JdbcTemplate jdbcTemplate = getJdbcTemplate(database);

    conn = jdbcTemplate.getDataSource().getConnection();

    UserItems items;

    if (!action.areItemsNew()) {

        conn.setAutoCommit(false);
        conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);

        PreparedStatement getItemsPS = conn.prepareStatement("select * from tbl_items where ownerId = ? for update",
                ResultSet.TYPE_FORWARD_ONLY,
                ResultSet.CONCUR_UPDATABLE);
        getItemsPS.setLong(1, userId);

        getItemsRS = getItemsPS.executeQuery();
        getItemsRS.next();

        items = new UserItemsRowMapper().mapRow(getItemsRS, getItemsRS.getRow());
    } else {
        items = new UserItems();
    }

    action.doUserItemsAction(items);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(items.getItemContainers());
    oos.close();
    byte[] data = baos.toByteArray();
    Blob blob = conn.createBlob();
    blob.setBytes(1, data);

    if (!action.areItemsNew()) {
        getItemsRS.updateBlob("data", blob);
        getItemsRS.updateRow();
        conn.commit();
    } else {
        jdbcTemplate.update("insert into tbl_items(ownerId,data) values(?,?)", userId, data);
    }
} catch (Exception e) {
    logger.error(e);
    throw new RuntimeException(e);
} finally {
    try { if ( conn != null ) conn.close(); }
    catch ( Exception e )
      { logger.error(e); }
}

Now commit() will get called only if (!action.areItemsNew()) AND all expected operations have succeeded. Before commit() would get called even if something went wrong. The resource cleanup code is much simpler and cleaner too. Note that in the suggested version, if there's an Exception on close() it's logged, but it is not wrapped and rethrown as a RuntimeException. Usually if there's an Exception on close(), there will have been a more informative Exception prior and that's the one you want to see. If the only place an Exception occurs is on close(), it means that all database operations have succeeded so your application can proceed correctly despite the fault. (If there are lots of Exceptions on close(), eventually you'd exhaust the Connection pool, but in practice that would happen only if there's something badly wrong with your database or network.)

A: The code you have is potentially dangerous and has a connection leak, when checking out a connection yourself you should always close it, there might be a case it fails to close the connection.
Instead I strongly suggest using Spring to manage your transactions and connections.
First annotate your method with @Transactional(isolation=SERIALIZABLE). Next add a DataSourceTransactionManager and <tx:annotation-driven /> to your configuration. After these changes rewrite the data access code you have.
JdbcTemplate jdbcTemplate = getJdbcTemplate(database);
final UserItems items;
if (!action.areItemsNew()) {
    items = jdbcTemplate.queryForObject("select * from tbl_items where ownerId = ? for update", userId, new UserItemsRowMapper());
} else {
    items = new UserItems();
}

action.doUserItemsAction(items);

String query = !action.areItemsNew() ? "update tbl_items set data=? where ownerId=?" : "insert into tbl_items(data,ownerId) values(?,?)";

byte[] data = SerializationUtils.serialize(items.getItemContainers());
jdbcTemplate.update(query, new SqlLobValue(data), userId);

Something like that (together with the aformentioned modification should work). (This was more or less from the top of my head, so it might need some tweaking). The use of proper transaction management ensures that everything is reusing the same single connection instead of multiple connections, it also ensures that a connection is returned to the pool when finished or when something goes wrong.
I would still suggest a different datasource as C3P0 is pretty old.


text:
Q: Ansible using Having same host in multiple groups but while running playbooy even after specifying groupname its taking another groups variable We have Apache setup chrooted, so we can multiple apache on single directory for multiple httpd instance. I have added all the different groups with the instance name in inventory but their hosts are same.
While I am running tasks on one httpd instance, it takes groups vars of different group even though the hosts are same in all groups.

A: This answer can help:
Ansible same host on different groups with group_vars
Try overriding host variables each time it is required with "vars_files":
hosts: {{ group_name }}
vars_files:
 - group_vars/{{ group_name }}.yml
tasks:

A: I have done another workaround.
I have added entries in /etc/hosts with different hostname but with same ips like below.
10.0.0.2 apache1
10.0.0.3 apache2
10.0.0.2 newapache1
10.0.0.3 newapache2

also i have added in inventory like below
[apache]
apache1
apache2

[newapache]
newapache1
newapache2

with same name you can create the groupvars with different details for same server.
Its not correct solution but for small setup its work great.


text:
Q: `serializeArray()` not getting all fields I have this form:
<form class="js-form">
   <input type="hidden" name="csrf_name" value="csrf5915b96bceb5e">
   <input type="hidden" name="csrf_value" value="b6de78b37c878cfb3cbe2b11edc86049">

               Email
               Password

                <input type="email" name="" value="" style=" border: 0; background: transparent;" class="form-control" id="email">

 <input type="password" name="" value="" style=" border: 0; background: transparent;" class="form-control" id="password">

            <button type="submit" id="submit" class="btn btn-block btn-lg btn-success">
            Update Emails
            </button>

            <button type="button" class="btn btn-block btn-lg btn-link" data-dismiss="modal">Cancel</button>

</form>

And this js:
$( "form" ).submit(function( event ) {
    console.log( $( this ).serializeArray() );
    event.preventDefault();
  });

But it only returns the csrf tokens twice.
Any idea why this is happing and how can I fix it?

*Some text to stop this post been mostly code!
*More text to stop this post been mostly code!

A: You haven't given the email and password inputs proper names, that's why the are excluded from the serialization.
Give those input elements the names you want them to be serialized with and you should be good.
Here is your original code in a JS Fiddle instance, and a corrected version with the name attributes filled in. The only differences are specified below:
Original Inputs
<input
    id="password"
    type="password"
    value="my-password"
    style=" border: 0; background: transparent;"
    class="form-control"
/>

<input
    id="email"
    type="email"
    value="my-email@my-domain.com"
    style=" border: 0; background: transparent;"
    class="form-control"
/>

Corrected Inputs
<input
    id="password"
    type="password"
    name="password"
    value="my-password"
    style=" border: 0; background: transparent;"
    class="form-control"
/>

<input
    id="email"
    type="email"
    name="email"
    value="my-email@my-domain.com"
    style=" border: 0; background: transparent;"
    class="form-control"
/>

A: Your input fields have an empty name attribute. Per documentation

The .serializeArray() method uses the standard W3C rules for
  successful controls to determine which elements it should include; in
  particular the element cannot be disabled and must contain a name
  attribute.

https://api.jquery.com/serializeArray/

A: The problem is that you have empty name attributes. According to the JQuery .serializeArray() Documentation:

The .serializeArray() method uses the standard W3C rules for
  successful controls to determine which elements it should include; in
  particular the element cannot be disabled and must contain a name
  attribute.

You can fix it by adding name attributes for your fields:
<input type="email" name="email" value="" style=" border: 0; background: transparent;" class="form-control" id="email">
...
<input type="password" name="password" value="" style=" border: 0; background: transparent;" class="form-control" id="password">


text:
Q: Overhead involved in nested sequences in F# I need to do excessive pattern matching against an xml structure, so I declared a type to represent the xml nodes. The xml is a multitree and I need to somehow iterate over the nodes. To make the tree enumerable, I use nested sequence comprehensions. My XML will never be too big, so simplicity beats performance in my case, but is the following code somehow dangerous for larger inputs, or would it be ok to leave it as it is.
type ElementInfo = { Tag : string; Attributes : Map<string, string> }
type Contents =
    | Nothing
    | String of string
    | Elements of Node list
and Node =
    | Element of ElementInfo * Contents
    | Comment of string
    member node.PreOrder =
        seq {
            match node with
            | Element (_, Elements children) as parent -> yield parent; yield! children |> Seq.collect (fun child -> child.PreOrder)
            | singleNode -> yield singleNode
        }

A: I thought the call to Seq.collect might cause it to generate an IEnumerable per call, so I replaced it with a for loop and it produces the same output (via ILSpy).
That made me curious so I decompiled a simpler sequence expression I'd expect to be "flattened."
let rec infSeq n =
  seq {
    yield n
    yield! infSeq (n+1)
  }

The code to generate the next element in the sequence decompiles to this:
public override int GenerateNext(ref IEnumerable<int> next)
{
    switch (this.pc)
    {
    case 1:
        this.pc = 2;
        next = Test.infSeq(this.n + 1);
        return 2;
    case 2:
        this.pc = 3;
        break;
    case 3:
        break;
    default:
        this.pc = 1;
        this.current = this.n;
        return 1;
    }
    this.current = 0;
    return 0;
}

As you can see, it calls itself recursively, generating a fresh IEnumerable each time. A quick test in FSI
infSeq 0 |> Seq.take 10000000 |> Seq.length

you can see there's a lot of GC:
> Real: 00:00:01.759, CPU: 00:00:01.762, GC gen0: 108, gen1: 107, gen2: 1

Compared to the C# version
public static IEnumerable<int> InfSeq(int n) {
    while (true) yield return n++;
}

in FSI:
> Real: 00:00:00.991, CPU: 00:00:00.998, GC gen0: 0, gen1: 0, gen2: 0

It's faster and uses constant memory (no extra IEnumerables).
I thought F# would generate a single IEnumerable for yield! in a tail position, but apparently not.
EDIT
The spec confirms this: {| yield! expr |} is elaborated as expr, that is, subsequences (recursive or otherwise) are not merged into a single IEnumerable.


text:
Q: How can I add an existing AKS to AAD? Some days ago Azure published a description on how to create an AKS cluster with RBAC and AAD. I already have an AKS. How can I add an existing AKS to AAD?

A: If I go to https://resources.azure.com and check my AKS cluster created with Azure Active Directory (AAD) RBAC, I can see these properties related to such integration:
"enableRBAC": true

and
"aadProfile": {
  "clientAppID": "7ee598bb-0000-0000-0000-83692e2d717e",
  "serverAppID": "7ee598bb-0000-0000-0000-83692e2d717e",
  "tenantID": "72f988bf-0000-0000-0000-2d7cd011db47"
}

If I then go to https://resources.azure.com and try to change the property enableRBAC to true in another AKS cluster I have that was not created with AAD integration I get this error:

{   "code": "InternalOperationError",   "message": "An error has
  occurred in subscription 12a6d3bd-xxxx-xxxx-accf-0c984bed2311,
  resourceGroup: aks request: existing ManagedCluster has
  properties.enableRBAC false. update to true is not supported." }

So it looks like currently is not possible to add AAD support to an existing cluster - you will need to re create the cluster with AAD support.

A: You can't.
Because to do this update on the cluster you would need access to the master nodes, which by definition you don't have in AKS.


text:
Q: Having issues executing multiple javascript lines in chrome console I have been trying to do some manipulation on webpages using JavaScript. So I started with the basic Google page(https://google.com).
I ran the command
document.getElementById('lst-ib').value = 'search_term';
Then after that tried running
document.getElementsByName('btnI')[0].click();
which is the I'm feeling Lucky button.
It is showing undefined on doing so.
But when I try only click on the I'm Feeling Lucky button without changing the content of the search bar, it works.
The target is to click the Search Button, it is also not working.
So I used the I'm Feeling Lucky button for testing to see if anything can be clicked.
The Same is happening in YouTube search bar as well
Any help or guidance would be much appreciated.
Also please note that I am N00b and trying to learn as I go :(
TLDR; The Idea is to simulate all the operation a user can do on the browsers using JavaScript.

A: document.getElementById('lst-ib').value = 'search_term';
document.getElementById('tsf').submit();

(or document.querySelector("form").submit();)
I'm not entirely sure what you're trying to achieve, but did you consider just using the queryparams? google.com?search=search_term ?
I found this ID simply by going to google.com, rightclicking on the input field, choose 'inspect element' and search for the first ancestor that is a 'form'.


text:
Q: How to make ordered dictionary from list of lists? The problem is:
Having a list of names, and a list of lists, how to create a list, in which each item is an ordered dictionary with names as keys, and items from list of lists as values? It might be more clear from code below:
from collections import OrderedDict

list_of_lists = [
                ['20010103', '0.9507', '0.9569', '0.9262', '0.9271'],
                ['20010104', '0.9271', '0.9515', '0.9269', '0.9507'],
                ['20010105', '0.9507', '0.9591', '0.9464', '0.9575'],
                ]

names = ['date', 'open', 'high', 'low', 'close']

I would like to get:
ordered_dictionary = [
                     OrderedDict([('date', '20010103'), ('open', '0.9507'), ('high', '0.9569'), ('low', '0.9262'), ('close', '0.9271')]),
                     OrderedDict([('date', '20010104'), ('open', '0.9271'), ('high', '0.9515'), ('low', '0.9269'), ('close', '0.9507')]),
                     OrderedDict([('date', '20010105'), ('open', '0.9507'), ('high', '0.9591'), ('low', '0.9464'), ('close', '0.9575')]),
                     ]

A: Use zip() to combine the names and the values. With a list comprehension:
from collections import OrderedDict

ordered_dictionary = [OrderedDict(zip(names, subl)) for subl in list_of_lists]

which gives:
>>> from pprint import pprint
>>> pprint([OrderedDict(zip(names, subl)) for subl in list_of_lists])
[OrderedDict([('date', '20010103'), ('open', '0.9507'), ('high', '0.9569'), ('low', '0.9262'), ('close', '0.9271')]),
 OrderedDict([('date', '20010104'), ('open', '0.9271'), ('high', '0.9515'), ('low', '0.9269'), ('close', '0.9507')]),
 OrderedDict([('date', '20010105'), ('open', '0.9507'), ('high', '0.9591'), ('low', '0.9464'), ('close', '0.9575')])]

A: I know this question is very old, but I thought I'd suggest a namedtuple solution as an alternative to OrderedDict that would work well in this situation:
from collections import namedtuple

Bar = namedtuple('Bar', ['date', 'open', 'high', 'low', 'close'])

bars = [Bar(date, o, h, l, c) for date, o, h, l, c in list_of_lists]

>>> bars
[Bar(date='20010103', open='0.9507', high='0.9569', low='0.9262', close='0.9271'),
 Bar(date='20010104', open='0.9271', high='0.9515', low='0.9269', close='0.9507'),
 Bar(date='20010105', open='0.9507', high='0.9591', low='0.9464', close='0.9575')]

>>> bars[2].date
'20010105'

>>> bars[2].close
'0.9575'

Even better, one could use dictionary comprehension with the date as the key:
Bar = namedtuple('Bar', ['open', 'high', 'low', 'close'])

bars = {date: Bar(o, h, l, c) for date, o, h, l, c in list_of_lists}

>>> bars
{'20010103': Bar(open='0.9507', high='0.9569', low='0.9262', close='0.9271'),
 '20010104': Bar(open='0.9271', high='0.9515', low='0.9269', close='0.9507'),
 '20010105': Bar(open='0.9507', high='0.9591', low='0.9464', close='0.9575')}

>>> bars['20010105']
Bar(open='0.9507', high='0.9591', low='0.9464', close='0.9575')

>>> bars['20010105'].close
'0.9575'


text: Q: how to read and write to Virtual com port in java I want to read and write to virtual com port that is dynamically created by CP2101 driver when i connect a device through USB To UART Bridge to my system.the problem is that with rxtx we can not find that which com port is assigned to the connected device.only we can manually set the port(say "COM1").in my case virtual port is automatically created so any idea to read that  virtual port will be appreciated.


text:
Q: Chart not showing first bar if series has only one point I have a asp.net chart with int for Y values and DateTime for X values. If I have only one point in each series the first bar is not shown even though by debugging the datapoint is shown in the series.
If I have more than one point in each series all is working fine. The only thing which is different is that with one series the label for the date is not shown in the X axis, with two point in each series one date is shown in the axis. Don't know if this matters.
Series with one datapoint

Chart with one datapoint

Series with two or more datapoints

Chart with two or more datapoints

UPDATE
This is my base table with one row (note: different values than in the question above):

I add the series for each "Gruppe" manually:
chart.Series.Add("Gruppe A");
chart.Series["Gruppe A"].ChartType = SeriesChartType.Column;
chart.Series["Gruppe A"].YValueMembers = "Gruppe A";
chart.Series["Gruppe A"].Color = System.Drawing.Color.FromArgb(0, 142, 207);
chart.Series["Gruppe A"].Label = "A:" + "#VALY";
chart.Series["Gruppe A"].XValueMember = "Datum";

Format of the AxisX:
chart.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Months;
chart.ChartAreas[0].AxisX.Interval = 1;
chart.ChartAreas[0].AxisX.LabelStyle.Format = "MMM/yy";
chart.ChartAreas[0].AxisX.Title = "Monat";

Chart with missing first month:

A: Got the solution, set the AxisX.Intervalto 0 when there is only one row in the datasource:
if (dtChart.Rows.Count == 1) { chart.ChartAreas[0].AxisX.Interval = 0; } else { chart.ChartAreas[0].AxisX.Interval = 1; }

and set
chart.Series[0].IsXValueIndexed = true;


text:
Q: Simple HTML/PHP Refuses to work Here is poster dot php
<?php
$FILENAME = "poster.php";
$txt = "data.txt";
if (isset($_POST['field1']) && isset($_POST['field2'])) { // check if both
fields are set
$fh = fopen($txt, 'a');
$txt=$_POST['field1'].' - '.$_POST['field2'];
fwrite($fh,$txt); // Write information to the file
fclose($fh); // Close the file
}
?>

Here is my HTML form
<!DOCTYPE html>

    <title>Field 1 & 2</title>

        <form action="poster.php" method="post">
        What is your name?

        <input type="text" name="field1">

            <input type="text" name="field2">

        <input type="submit" value="Submit">
        </form>

I tried everything to make this work when i put it in a debugger it says the file should end on the first line. When I run the file all i get is a white screen. I'm in desperate need of help.

A: action attribute of form should be file name where you submit your form.
<form action="action.php" method="post">

Here it is 'action.php' but you have to submit it on poster dot php.

A: please check it:
<form action="poster.php" method="post">

Form action will be your main file name(poster.php) and after form post, you can easily get all the form fields data on poster.php file.

you wotre this file name -> poster dot php means poster.php ?

A: You are not writing anything after appending your form data in your poster.php file. You can get the file contents in the following way...
Html form:
   <!DOCTYPE html>

    <title>Field 1 & 2</title>

        <form action="poster.php" method="post">
        What is your name?

        <input type="text" name="field1">

            <input type="text" name="field2">

        <input type="submit" value="Submit">
        </form>

and in poster.php
 <?php
   $FILENAME = "poster.php";
   $txt = "data.txt";
   if (isset($_POST['field1']) && isset($_POST['field2'])) { // check if both
   //fields are set
      $fh = fopen($txt, 'a');
      $txt=$_POST['field1'].' - '.$_POST['field2'].PHP_EOL;
      fwrite($fh,$txt); // Write information to the file
      fclose($fh); // Close the file
      echo file_get_contents("data.txt");
   }
?>

As per requirement, write PHP code and HTML code inside a single file and remove the action attribute of the form  in the following code ...
    <?php
     //$FILENAME = "poster.php";
      $txt = "data.txt";
      if (isset($_POST['field1']) && isset($_POST['field2'])) { // check if both
      //fields are set
      $fh = fopen($txt, 'a');
      $txt=$_POST['field1'].' - '.$_POST['field2'].PHP_EOL ;
      fwrite($fh,$txt); // Write information to the file
      fclose($fh); // Close the file
      //echo file_get_contents("data.txt");
   }
?>
<!DOCTYPE html>

    <title>Field 1 & 2</title>

        <form action="" method="post">
        What is your name?

        <input type="text" name="field1">

            <input type="text" name="field2">

        <input type="submit" value="Submit">
        </form>


text:
Q: How to wait for service on activity start I am making an application that has Activity which communicates with a single service, and is used to start, stop or change settings of that service. I used a singleton approach from this tip.
My problem is that busy-waiting is not working for me and I can't attach a listener to the service because activity gets blocked. I want the service to start or get it's current instance at application start so I put the busy-waiting in onCreate. I'm guessing I'm doing this very wrong, so how do I do this appropriately?
Also if there is a better approach to this, please post any links or guides, cuz I'm getn confused on android developer site :P
thanks!

A:
I used a singleton approach from this tip.

Don't do that. Use bindService() and the local binding pattern instead, and you will be notified when the service is ready. You also get access to an API published by the service and can start using it once you are bound.

A: The problem is one of procedural vs. event-driven programming, android's UI being built on the later.
onCreate is an event.  Notification of a service connection is also an event.  You won't be delivered the service connection notification (even though it's happened) until you return from onCreate.
Can you split your activity startup into two parts, the first done in onCreate and the second in response to the service connection?


text:
Q: Date comparison in Struts2 Ognl tags My requirement is to display a date from db and the status message to inform whether the date coming from db is past date, current date or a future date.
I'm displaying the date from db by
<s:property value="%{selObj.lastdate}"/>

Now how to get the current date in OGNL tags, I have tried
<s:propery value="%{new Date()}"/>

I need this current date to compare with selObj.lastdate and find out the date is passed?

A: If you can modify your action side:
You can try to write a getter as like:
public Date getCurrentDate(){
    return new Date();
}

at your Java(Action) side.
So you can get that value:
<s:property value="currentDate"/>

at your JSP side.

A: To get the current date/time, you won't need to modify your action class, just add this line to your jsp:
<s:property value="@java.util.Calendar@getInstance().time" />

A: That's is the right way to compare and get current date. I have to suggest to display a date in UI, should use like this;
<s:date name="currentDate"  format="dd-MM-yyyy" />

It will be formatted date.


text:
Q: Subscribing to an observable from within a service vs from within a component Angular 5

I have a service that contains a method addVal() that makes an HTTP call using an observable.There is a component from which the addVal() method is being called. Is there any difference (functionality-wise as well as design-wise) in calling the subscribe() method in the component versus in the service?

A: My rule of thumb is that I always write services as a thin layer.
They usually contain only a dependency injection for HttpClient and HttpHeaders, and I create just calls to the API endpoints there.
Subscription and data is usually handled by components, since you might want to use different parameters while calling your API.
For that reason alone, it's better to have a slimmer service, and 'fatter' component that does all the logic relevant to itself.


text:
Q: MS Access VBA acImport sheet name with spaces and range I'm building a form with a button called "Go" to import a specific range of a specific excel sheet from an excel file. Another sub/function takes care of having the file name on the form in the field called text_filepathdata.
I've discovered that spaces in the sheet names are problematic, however it can be resolved by using special quotation.
Dim sheetname As String
sheetname = "'Commit Volumes!'"
DoCmd.Transferspreadsheet acImport, acSpreadsheetTypeExcel12, _
    "lcl_ImportedFile", text_filepathdata, True, sheetname

That works, but I can't specify a range in addition to the sheet name because of the special quotation... (ie. "'Commit Volumes!A6:Z5000'" doesn't work and neither does a concatenation of the two pieces like "'Commit Volumes'" & "A6:Z5000")
I've tried all manner of quotations and concatenations, but the only things that work are:
sheetname = "'Commit Volumes!'"
sheetname = "'Commit Volumes$'"
sheetname = "CommitVolumes!A6:Z5000"

The excel sheet cannot be modified because it comes from another system and the file (after being updated) must be uploaded back to that system.
Here is my code:
Private Sub button_Go_Click()
On Error GoTo Err_button_Go_Click

Dim sheetname As String
sheetname = "'Commit Volumes!'"

If IsNull(text_filepathdata) Or text_filepathdata = "" Then
    MsgBox "Please browse and select a valid file to import.", _
        vbCritical, "Invalid File"
Else
    DoCmd.OpenForm "f_PleaseWait_Processing", acNormal, , , acFormReadOnly, acWindowNormal
    If ifTableExists("lcl_ImportedFile") = True Then
        DoCmd.DeleteObject acTable, "lcl_ImportedFile"
    End If
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,_
        "lcl_ImportedFile", text_filepathdata, True, sheetname

'Call module to process the imported data
        Call MainProcess
    End If

Exit_button_Go_Click:
    Exit Sub

Err_button_Go_Click:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_button_Go_Click

End Sub

I get two different error messages depending on the issue.
If there's a space in the name I get: Run-time error 3129: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
If there's a problem with the name otherwise I get: Run-time error 3011: The Microsoft Access database engine could not find the object "Commit Volumes$A1:Z5000". Make sure the object exists and that you spell its name and the path correctly. If "Commit Volumes$A1:Z5000" is not a local object, check your network connection or contact the server administrator.
Any help would be greatly appreciated!
Bill
Variations I've Tried:
sheetname = "'Commit Volumes'!A6:Z5000";
sheetname = "'Commit Volumes!'A6:Z5000"
sheetname = "'Commit Volumes$'A6:Z5000"
sheetname = "'Commit Volumes'$A6:Z5000"
sheetname = "'Commit Volumes'$A$6:$Z$5000"
sheetname = "'Commit Volumes!'$A$6:$Z$5000"
sheetname = "'Commit Volumes$'$A$6:$Z$5000"

A: If the file gets exported from the other system in a known\set format, you could refer to it by index rather than by name:
For Example: sheets(1), sheets(2). Then add the range.

A: I had the same problems.  When I created a range string variable and passed it to the DoCmd.TransferSpreadsheet routine, Access changed the "!" character to "$" and gave me an error. If I passed a string constant to the Range parameter of the DoCmd.TransferSpreadsheet routine, Access did not change the character.  In other words, running the following code, ...
Dim strFilename As String
Dim strRange As String
Dim strTableName As String

strFilename = "YourWorkbookName.xlsx"
strRange = "Sheet5!A1:Z99"
strTableName = "tblImport"

DoCmd.TransferSpreadsheet _
  TransferType:=acImport, _
  SpreadsheetType:=acSpreadsheetTypeExcel12Xml, _
  TableName:=strTableName, _
  FileName:=strFilename, _
  HasFieldNames:=True, _
  Range:=strRange

... gave me the 3011 runtime error.
However, when I separated the sheet name and the address into two separate variables and passed them to the routine, Access was happy.  In other words, when I ran the code, ...
Dim strAddress As String
Dim strFilename As String
Dim strSheetName As String
Dim strTableName As String

strAddress = "A1:Z99"
strFilename = "YourWorkbookName.xlsx"
strSheetName = "Sheet5"
strTableName = "tblImport"

DoCmd.TransferSpreadsheet _
  TransferType:=acImport, _
  SpreadsheetType:=acSpreadsheetTypeExcel12Xml, _
  TableName:=strTableName, _
  FileName:=strFilename, _
  HasFieldNames:=True, _
  Range:=strSheetName & "!" & strAddress

... I received no error and the data from the Sheet5 sheet was properly imported into tblImport.
It should be noted that Sheet5 is not the first sheet of the workbook and strAddress does not have "$" characters in it.
Happy coding.

A: I have found a solution that works in the two cases I needed it to.
The original poster above and all of the attempts to answer here have not been able to stumble upon the specific format required to get this to work.  I did, through stubborn trial and error, and it is not what any of us expected.
In order to get the DoCmd.TransferSpreadsheet function to take a specific range on a specific sheet, the "range" parameter must be in the following format:
"SheetName$A1:Z100"

If SheetName has a space in it, it must be:
"Sheet Name$A1:Z100"

*

*The sheetname must NOT be put in single quotes, or the method will
fail.

*The sheetname must NOT be ended with an exclamation mark
before the range, or the method will fail.

*The range (A1:Z100) must NOT be in fixed addressing notation, or
the method will fail.

To summarize:
If you have a workbook named "WB" with two sheets: "S1" and "S 2", and you want to import range A1:Z100 from each of them:
DoCmd.TransferSpreadsheet ,,"TABLE NAME 1","WB",,"S1$A1:Z100"
DoCmd.TransferSpreadsheet ,,"TABLE NAME 2","WB",,"S 2$A1:Z100"

A: This is what you need:
'Commit Volumes'!A6:Z5000
When there is a sheet name with spaces or dashes, excel places single quotes around the sheet name itself, not around the whole reference.
So:
sheetname = "'Commit Volumes'!A6:Z5000"

A: use sheetname = "Commit Volumes$" with no range which seems to work by matching the table field names with the excel column headings

A: I had the same issue.
finally i found that you can use:
sheetname = "Commit Volumes!A6:Z5000"
example
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "table name", _
filetoimport, False, "Commit Volumes!A6:Z5000"
Regards!

A: I tried the above proposed solutions and unfortunately it did not work in my case: indeed the import method of Access does not like it when the worksheets have spaces in their names.
I did a workaround: renaming the worksheets during the code to something short and without spaces, for instance: from "Data Q1 2016"  to "WS1". In this way, you can pass the value "WS1$" to the Range argument of the import function, and Access will import the used range of the given worksheet
When importing the second worksheet, I again used the code and renamed it to "WS2"... and so forth.
in summary:  rename the worksheets during code runtime to short names without spaces, and add the '$' symbol at the end to make it grab the used range.


text:
Q: Resolving relative paths in Rollup and Webpack are different In my module which is imported by a project, the path is being resolved differently in Rollup and Webpack. I'm therefore not able to publish my module for use because it will work inconsistently depending on the bundler being used.
In my module:
// myModule/dist/index.js
const pkg = require("./package.json");

When imported via a user's project.
// myProject/index.js
import myModule from `myModule`;

In Rollup this resolves as:
/Users/limitlessloop/Sites/myProject/package.json`

In Webpack this resolves as:
/Users/limitlessloop/Sites/myProject/node_module/myModule/dist/package.json

or in my actual case when using symlink for local testing
/Users/limitlessloop/Sites/myModule/dist/package.json

I've tried using require(process.cwd() + "package.json") but because of the case of compiling to a sandboxed environment (Figma plugin) without access to node, process does not exist and bundlers don't seem to support dynamic paths very well.
How can I achieve it so that my module references the user's current project directory when imported via their project?


text:
Q: unable to connect to my DB I am getting this error when I try compiling
ConnectDB.java:14: error: unreported exception ClassNotFoundException; must be caught or declared to be thrown
Class.forName("com.mysql.jdbc.Driver");

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectDB
{
   public ConnectDB() throws SQLException
   {
      Class.forName("com.mysql.jdbc.Driver");
      Connection dbConnect = DriverManager.getConnection("jdbc:mysql://xx.xx.xxx.xxx:3306/my_DB", "userName", "superSecurePassword");
   }
}

I have downloaded and installed the driver and set the classpath but continue to get the error.

A: That's because the compiler is telling you that you're not catching a checked exception. You need appropriate handling:
try {
    Class.forName("com.mysql.jdbc.Driver");
} catch(ClassNotFoundException e) {
    // log exception, probably abort application if it can't run without a database
}

A: You need to place the following code
Class.forName("com.mysql.jdbc.Driver")

inside a try catch block. Because the code throws *checked exception* and compiler force to catch the checked exception.


text:
Q: Extract required text from Word document using C# Can anyone tell me how to extract only required text from Word document using C#.
About Word document:
Word document contains some simple text and audio text and I want to differentiate and extract that text from word doc into excel.
Storyboard Screen shot link contains Simple text and audio text and where you can see 2 Text colors Blue and Black. Problem is to identify the Black color Text because it has some Simple Text and Audio Text and I want that Text into Excel in separate columns as displayed in Screen shot link above.
and i'm able to extract the text from Word document into Excel but problem is how can I identify Simple text and Audio text without changing the font style and color.
Any help in this will be highly appreciated.
Thanks in advance.


text:
Q: Suddenly cant open Emulator in Android Studio i started my PC today and all of a sudden I cant get my emulator to start in AndroidStudio.
I have an AMD Ryzen 2600X
It says HAXM is not installed.
I have HyperV disabled, I have Windows-Hypervisor-Platform enabled. It used to work just yesterday, idk what changed. Virtualization is on too.
I tried "bcdedit /set hypervisorlaunchtype off" in cmd but nothing seems to work.
Reinstalled Android Studio, still nothing. Did ALL the steps 5 times in a row, still nothing.. what is going on?


text:
Q: How to set maxUploadSize for each file in case of multiple file uploads using CommonsMultipartResolver? I have a requirement to support multiple file upload in one request. The user can select any number of files and upload them to the server. I would like limit each of those files not to exceed 10MB. I wrote the below code, but it limits the total size of all files combined to be less than 10MB, but I want to limit 10MB per file and total there could be any number of files. I am using spring web mvc 3.0
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <!-- 10 megs is 10485760 bytes.-->
    <property name="maxUploadSize" value="10486784"/>
</bean>

Any ideas?

A: maxUploadSize parameter of CommonsMultipartResolver is not about to set validation on file size. Its about restricting a Multipart file upload request, so that no malicious user can upload something that overwhelms your resources to handle that request. On that case, the individual file size actually does not matters. The thing to be concerned is the total upload size. That's why CommonsMultipartResolver does not have any property to restrict individual file size.
To put restriction on individual file size, you must put a server side validation (in both cases, single file upload or multiple file upload).
Thanks and Happy coding!


text:
Q: Elmah DDL giving sql errors when run by context.Database.ExecuteSqlCommand (EF4.1) I am attempting to run the Elmah Sql Server DDL upon database generation in my EF4.1 CodeFirst application.
To accomplish this, in my DbInitializer.Seed Method I have:
    protected override void Seed(MyJobLeadsDbContext context)
    {
        // Run Elmah scripts
        context.Database.ExecuteSqlCommand(GetElmahDDLSql);
    }

GetElmahDDLSql is just a string constant that contains the entirety of the DDL from http://code.google.com/p/elmah/source/browse/trunk/src/Elmah/SQLServer.sql
Unfortunately, when this is run I get the following exception:
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'ALTER'.
Incorrect syntax near the keyword 'ALTER'.
Incorrect syntax near 'GO'.
Incorrect syntax near the keyword 'SET'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@ErrorId".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@TotalCount".
Must declare the scalar variable "@PageIndex".
Must declare the scalar variable "@TotalCount".
Must declare the scalar variable "@Application".
Must declare the scalar variable "@PageSize".
Must declare the scalar variable "@PageSize".
Must declare the scalar variable "@Application".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.
Must declare the scalar variable "@ErrorId".
Incorrect syntax near 'GO'.
Incorrect syntax near 'GO'.

Any idea how to correctly execute the DDL via EF4.1?

A: As I know, you can't use GO. GO is not SQL command it is special batch control command for tools like SQLCMD, OSQL or Query editor in SSMS. When using ADO.NET or EF you must divide your SQL script to commands and execut each part separately = each part between two GOs is separate command which needs its own ExecuteSqlCommand. There can be some issues with global variables in the script.
Another approach is using SQL Server Management Objects to execute whole script.


text:
Q: XPATH: How to select an element that contains some piece of text and its sibling do not contain some other piece of text

      "Something"

   <c>
      "Something else"
   </c>

<d>
    <e>
     "Something"
    </e>
    <f>
      "Foo"
    </f>
</d>

I want to select the elements that contain the text "Something" but don't have siblings containing "Something Else". (In this example I'd want to select 'e')
This is what I've tried
//*[contains(text(), 'Something') and ../*[not(contains(text(), 'Something Else'))]]

A: Here is the xpath that you can use.
//label[contains(.,'Something') and following-sibling::label[not(contains(.,'Something else'))]]

Below is the sample html and the solution screenshot.

      "Something"

      "Something else"

     "Something"

      "Foo"

Screenshot:


text: Q: What is the purpose of Database View and when to use it i want to know when to use view in a database...i know a little bit about view that it is a virtual table which is used to hold data from other tables temporally but i do not know when to use them in your app when you can collect data from different tables through sql joins and present it in HTML table...then what is the exact purpose of view??


text:
Q: FFMPEG and DirectX Capture in C++ I have a system that allows me to capture a window and save it as a mp4, using ffmpeg. I use gdigrab to capture the frame, but it is fairly slow (60ms per av_read_frame calls)
I know I can capture a game using the DirectX API, but I don't know how to convert the resulting BMP to an AVFrame.
The following code is the DirectX code I use to capture the frame
extern void* pBits;
extern IDirect3DDevice9* g_pd3dDevice;
IDirect3DSurface9* pSurface;
g_pd3dDevice->CreateOffscreenPlainSurface(ScreenWidth, ScreenHeight,
                                      D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH,
                                      &pSurface, NULL);
g_pd3dDevice->GetFrontBufferData(0, pSurface);
D3DLOCKED_RECT lockedRect;
pSurface->LockRect(&lockedRect,NULL,
               D3DLOCK_NO_DIRTY_UPDATE|
               D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)));
for( int i=0 ; i < ScreenHeight ; i++)
{
    memcpy( (BYTE*) pBits + i * ScreenWidth * BITSPERPIXEL / 8 ,
         (BYTE*) lockedRect.pBits + i* lockedRect.Pitch ,
         ScreenWidth * BITSPERPIXEL / 8);
}
g_pSurface->UnlockRect();
pSurface->Release();

And here is my read loop :
{
    while (1) {
    if (av_read_frame(pFormatCtx, &packet) < 0 || exit)
        break;
    if (packet.stream_index == videoindex) {
        // Decode video frame
        av_packet_rescale_ts(&packet, { 1, std::stoi(pParser->GetVal("video-fps")) }, pCodecCtx->time_base);
        avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

        if (frameFinished) {
            pFrame->pts = i;
            i++;
            sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
            pFrameRGB->pts = pFrame->pts;
            enc.encodeFrame(pFrameRGB);

    }
    // Free the packet that was allocated by av_read_frame
    av_free_packet(&packet);
}

How can I create an AVFrame using the bmp I have, without using the av_read_frame ?


text:
Q: WSO2 ESB with DSS integrated doesn't response JSON I have a WSO2 ESB server with DSS features installed. When I invoke a REST service with "accept: application/json" in request header, I don't receive JSON response, only XML.
Best, Ivan

A: In this API, to get the response in JSON, I use these two properties:
<property name="Accept" value="application/json" scope="transport" type="STRING"/>
<property name="messageType" value="application/json" scope="axis2"/>

You can see the implementation here
<api xmlns="http://ws.apache.org/ns/synapse" name="showById" context="/getById">
   <resource methods="POST GET" uri-template="/getEmployeeXML/{Id}">
      <inSequence>
         <property name="getId" expression="get-property('uri.var.Id')" scope="default" type="STRING"/>
         <log>
            <property name="ID" expression="get-property('getId')"/>
         </log>
         <property name="Accept" value="application/json" scope="transport" type="STRING"/>
         <property name="messageType" value="application/json" scope="axis2"/>
         <payloadFactory media-type="xml">
            <format>
               <p:getEmployeeXML xmlns:p="arce.farmacy">
                  <xs:Id xmlns:xs="arce.farmacy">$1</xs:Id>
               </p:getEmployeeXML>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('getId')"/>
            </args>
         </payloadFactory>
         <property name="Action" value="urn:getEmployeeXML" scope="transport" type="STRING"/>
         <property name="SOAPAction" value="urn:getEmployeeXML" scope="transport" type="STRING"/>
         <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
          <send>
            <endpoint>
               <address uri="http://169.254.193.10:9763/services/StoredProcedureFarmacy" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <log level="full"/>
         <send/>
      </outSequence>
      <faultSequence>
         <sequence key="{faultSEQ}"/>
      </faultSequence>
   </resource>
</api>

This is the response
{
  "Employees": {
    "Employe": [
      {
        "Id": 5,
        "Description": "Office 2"
      }
    ]
  }
}


text:
Q: android - check which language text file (DE, EN) is loaded in the RAW directory I've a text file in the RAW DIrectory
called test.txt
My java Code checks correctly the test.txt file with device language german. How can i check the EN-File, when the device language is english?
I think in line 3 of my code i have to set an if-else block to proof the raw directory?
THX a lot for HELP!
My Java Code (works):

     TextView HelpTxtMain;

     HelpTxtMain = (TextView)findViewById(R.id.TextViewMain);
     HelpTxtMain.setText(readTxtDe());

 private String readTxtDe() {

     InputStream inputStream = getResources().openRawResource(R.raw.test);

     ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

    int i;

    try {
       i = inputStream.read();
    while (i != -1)
     {
      byteArrayOutputStream.write(i);
      i = inputStream.read();
     }

     inputStream.close();
    } catch (IOException e) {

   // TODO Auto-generated catch block

     e.printStackTrace();
    }

  return byteArrayOutputStream.toString();
}

A: Try to rename the file to "test.txt" and put them into the directories values-de and values-en or better out the english file into the values directory to set the english language as the default language.
Android will select the right file based on the currient language.


text:
Q: Solve "you don't have permission to save to this location" I was trying to save a Camtasia file, and got this error:

Needless to say, I work on my own laptop PC, and there are no administrators I can contact (I simply love Microsoft's 'contact your administrator' message). I tried saving a new notepad file, and got the same error.
I am the administrator on my PC:

I've checked the security properties of the folder in question, and verified that Administrator group has full permissions.
So, why does this message show up and how to fix the issue so I can save files on my PC wherever the hell I want?

A: Folders in Program Files or Program Files (x86) will be limited to being written to only by System groups or Administrator groups by default. Quite often the Administrator group or SYSTEM will be the owner of the folder.
The default permissions will usually allow users in the Administrator group full control:

But as you've spotted, your account is in the Administrator group, but you can't write in it.

For the simple reason that you aren't running with those elevated privileges. You are running your account as a normal user, which, if you check the first screenshot, only has Read & execute permissions to the folder.

The "solution" is to not write in this folder, as it could cause problems updating, difficulty finding your files, or might work fine but it's not really a logical place to look for a video. That's not to mention the risk of accidentally overwriting a critical file needed by the application.
Of course, if you want to do so regardless, you can run the program in question as an administrator:

Now it'll be within the correct privilege group.

But as stated, this isn't typically a very good idea, and I'd recommend keeping programs and their data separated.

A: That's to be expected. A regular user should not save files to the "Program Files" folders (and various other system folders). Simply save the file elsewhere, preferably in the "Videos" folder in your profile.
If this error occurs before you're able to select a save location, it is a bug in the program and you have to contact the developer.


text:
Q: extract 2D slice (defined by aribtrary plane) from 3D volume again? extract 2D slice (defined by arbitrary plane intersection)  from 3D volume using either iTK or scipy ndimage and interpolation with SimpleITK.
Does anyone have a working example ? I have read several posts here and on the ITK users list but no one has a something that works.
Thanks
GT