text:
Q: How to catch "action" link after submitting web form? There is a login panel on bank site, and I'm trying to fetch/catch "action link" after (button press) submitting a form.
Site is using https and some js scripts, that makes effort to read all of them and figure out, plus each site has their own scripts and other techniques and they change a lot. I am trying to find a way to make it easier to catch than reading all the html/js code.
I am not trying to harm anyone, just want to get my data with auto login to many (about 5) sites at once.
I was using strace but without any success, then i heard that wireshark has ability to decode SSL but no success here either.
Is there any chance to catch "action link" that browser is sending?
I have idea to put server and redirect my outgoing connection to my server, and catch those request there but it will take to much time for me, so trying to find "simple/faster" way. Maybe some browsers/add-ons already has one of those functionalities?
Thank you for any ideas.

15/01/2012 14:12 Well i used firefox & firebug to debug with suggestion of slhck, i found that f&f current crash when touching scripts - so couldn't do much, for now I'm giving myself a chill. I will turn to this problem again - cause now it generates more problems than solutions.
I don't want to install chrome because of my personal feelings. Back in the day i was using greasemonkey for browser interaction.
@lastpass: i need that "action link" for my program that fetch data from site and presents in readable sheet, couldn't find source of lastpass to eventually mod it to my purposes.

15/01/2012 15:23 UNTESTED It is not the solution i want but: there is a way to open x window with web frame, load in this frame page, then program will fill login/pass and click what is needed to be clicked in this x window webframe, then copy data from loaded page. But is about to use X that i don't want to use, but on the other hand i don't need to know action link to do this operation. I'm facing compromise here.

29/01/2012 11:20
Used GreaseMonkey scripts http://commons.oreilly.com/wiki/index.php/Greasemonkey_Hacks/Web_Forms to inject code and read form post data, but another failure. Anyway if someone want to do something similar, it should be fine to do it with GM. On Bank site, it was for me to hard to do it, because there was a dummy form, dummy js, and somewhere was created another form and the real js was compressed whole source "full" obscurity. I could reverse it but that was not my point to do it ... its time for 1st idea: to put some proxy and catch link on wire.

08/08/2012 15:15
I found that seamonkey has pageinfo (ctrl+i) tab Forms. It will show all forms on the site (but only before submitting a form). So, it should be possible to freeze web page after submitting and check pageinfo again.
For me, Proxy was the solution.


text:
Q: Error when trying to install any package from NuGet I'm getting a message like this when trying to install a package using NuGet:

Install-Package : Unable to find package 'Newtonsoft.Json'.
At line:1 char:16
+ Install-Package <<<<  Newtonsoft.Json
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

(the same error for other packages). Tried to reinstall NuGet - no success.
Any other ideas?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Woocommerce Orders: How to display First Name then Last Name when Previewing? When i check my orders on my Woocommerce website and click on the preview button I get this popup window displaying the billing and shipping details. As you can see from the shipping details the LASTNAME is displayed first. Is there a way to display first the FIRSTNAME then LASTNAME?

A: You can go to the plugins > woocommerce > templates > order and find logic for the shipping address and change the order for the name as you want.


text:
Q: How does #redirect_to get the domain to append a relative path? When using the Rails redirect_to with a relative path, how does it determine the domain to combine with the relative path? Is there a method or env that is being used?

A: When using the Rails redirect_to with a relative path, it determines the domain to combine with the relative path by using the request.host method.
https://guides.rubyonrails.org/v6.1/layouts_and_rendering.html#using-redirect-to


text:
Q: The Lawvere Theory and Monad for the category of Symmetric groups Take the category of Symmetric groups.  Each object is the group of all permutations for some set.  Is there a Lawvere theory for this category?  What is the monad for the Lawvere theory?

A: There is no Lawvere theory whose category of models is the category of symmetric groups.  This is immediate, for instance, from the fact that the category of models of any Lawvere theory is complete and cocomplete, but the category of symmetric groups has very few limits or colimits (for instance, it does not have a product $S_2\times S_3$ since such a product would have exactly $2\cdot 4=8$ homomorphisms from $S_2$ but there is no symmetric group with that property).


text:
Q: LG Ultrafine 24MD4KL-B not charging via USB-C (Thunderbolt) I'm running Ubuntu 20.04 on a ThinkPad P14s Gen 1 with internal 4K display. I'm currently running the Intel Mesa drivers on X11, but the behavior I'm about to describe is the same with the proprietary Nvidia drivers.
I have two LG UltraFine 4K external displays, that were originally designed for Macs. These are great displays, as they have an unmatched pixel density, connect via USB-C and can also charge the computer through the same cable. They don't have buttons, but there is third-party support for changing the brightness via a custom USB protocol.

*

*22MD4KA-B 21.5" Model, 65W power delivery

*24MD4KL-B 24" Model, 85W power delivery, support for daisy chaining.

So with my Macbook Pro I have the 22" plugged into the 24" and the 24" plugged into the computer, it charges and drives both displays.
With my Thinkpad, the 21.5" on its own works perfectly. The computer charges, I get full 4k resolution, I can use the custom drivers to change the brightness. Perfect support basically.
When I use the daisy-chained setup as with my Macbook, only one of the Displays works. It seems a bit random, but usually its the last one in the chain, the 21.5". When I unplug it, the 24" turns on and displays correctly. When I re-plug it, the 24" continues to display, the 21.5" stays black. (I know I can drive two external Displays, because I can connect another one using the HDMI port and then both work). It would be nice if I could run both through the daisy-chain (then I'd not need the internal display), but I guess it has to do with how the display lines are soldered on the motherboard. That's not a big deal, I'm fine to use just one external one, but I would like to be able to choose which one without having to change the cables.
The main issue though is, that the 24" model does not charge my laptop. Neither with both displays attached nor with just the 24" one on its own. Maybe it's power delivery is too high? The Thinkpad came with a 65W brick, maybe it doesn't support 85W? But shouldn't there be a way to negotiate the power draw? If I use my 96W power brick that came with my Macbook and use the same cable as for connecting to the display, it charges the Thinkpad.
(I actually want to buy a second 24" one for symmetry reasons, but I cannot until I can charge my Thinkpad with it, so for now I'm just using the 21.5" one and have to re-plug it to the 24" afterwards)
Maybe I need to change some Thunderbolt options? I don't even know where to start debugging this? If I google for "ubuntu power draw support" I only find answers about monitoring CPU power draw, not how much a certain USB port is using or would support or something like that?


text:
Q: Как в apache отключить редирект https на localhost? Во время создания vhost на локалхосте возникает проблема с редиректом на https. Подскажите пожалуйста как отключить редирект https ?

A: Можно через .htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

или
RewriteEngine On
RewriteCond %{ENV:HTTPS} =on
RewriteRule ^(.*)$ http://site.ru/$1 [R=301,L]

Так Вы включаете редирект с https на http

*Зайти в папку где создаются vhost файлы там найти нужный файл где прописан домен с портом 443 и удалить этот файл.

*Если пользуетесь веб интерфейсом (например: Wemin). Зайти в категорию  Веб-сервер apache, найти там домен с портом 443 и удалить его оттуда. Не забудьте перезапустить apache.


text:
Q: What part of Spark SQL parse SQL statements and create execution plan? Assuming the following query:
select * from my_table

what part of Spark parses the sql and create the execution plan?
Does Spark SQL execution engine have its own sql parser that translates it to his own execution model? how it works?
I got exception for some functions that spark does not support them yet, does it means spark parse the sql query ? does each other execution engine does it too?

A: In Spark SQL it's AstBuilder that builds a abstract syntax tree of logical operators and expressions.

The AstBuilder converts an ANTLR4 ParseTree into a catalyst Expression, LogicalPlan or TableIdentifier.

AstBuilder is a ANTLR-based SQL parser that uses the SQL grammar described in SqlBase.g4 (that was incidentally borrowed from Facebook's Presto with additional support for Hive and PostgreSQL statements).
You can play with supported queries using SparkSession.sql:

sql(sqlText: String): DataFrame Executes a SQL query using Spark, returning the result as a DataFrame. The dialect that is used for SQL parsing can be configured with 'spark.sql.dialect'.

You could go low-level and use the parser directly:
import spark.sessionState.sqlParser
scala> :type sqlParser
org.apache.spark.sql.catalyst.parser.ParserInterface

Use parsePlan method (among the other parsing methods) that accepts a SQL text.
scala> sqlParser.parsePlan("select * from myTable")
res1: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
'Project [*]
+- 'UnresolvedRelation `myTable`

With a logical plan (for SQL) Spark SQL uses something I call a structured query execution pipeline (aka QueryExecution):

QueryExecution The primary workflow for executing relational queries using Spark. Designed to allow easy access to the intermediate phases of query execution for developers.

Every Dataset has its own QueryExecution that you can access using queryExecution property:
val q = spark.range(5)
val qe = q.queryExecution

You can access the phases of a query execution using analyzed, withCachedData, optimizedPlan, sparkPlan, executedPlan, toRdd lazy values that are all together displayed using explain operator.
scala> q.explain(extended = true)
== Parsed Logical Plan ==
Range (0, 5, step=1, splits=Some(8))

== Analyzed Logical Plan ==
id: bigint
Range (0, 5, step=1, splits=Some(8))

== Optimized Logical Plan ==
Range (0, 5, step=1, splits=Some(8))

== Physical Plan ==
*Range (0, 5, step=1, splits=8)


text:
Q: iframe onreadystatechange I have a HTML page that contains an . The  is being refreshed on certain events (and I can see the contents of the  being changed, so as far all is ok).
What I want to do is add a onreadystatechange to the  so that I can display a "loading" text while the contents are being fetched.
I could not add the onreadystatechange in any browser (Safari, Chrome, Firefox). From what I found on the Internet it seems to work in IE, but this is no help for me.
I've tried:

document.getElementById('frameId').onreadystatechange = function() {};
document.getElementById('frameId').contentDocument.onreadystatechange = function() {};

but nothing seems to work.

A: So if you want to show a "The page is loading" message and hide this when the iframe has finished loading you can do something similar to the example below. Note that I used JQuery just to easen up this process. But obviously it can be done in 100% Javascript too.
I also created this on JSFiddle to show you the result. Check it here!!

This page is currently loading.. Just a sec please!

Thanks for waiting, enjoy my website now!


text:
Q: Object (into Array) variables in PHP Here is the code:
$obj = new stdClass;
$obj->AAA = "aaa";
$obj->BBB = "bbb";

$arr = array($obj, $obj);

print_r($arr);

$arr[1]->AAA = "bbb";
$arr[1]->BBB = "aaa";

print_r($arr);

And here is the output:
Array
(
    [0] => stdClass Object
        (
            [AAA] => aaa
            [BBB] => bbb
        )

    [1] => stdClass Object
        (
            [AAA] => aaa
            [BBB] => bbb
        )

)

Array
(
    [0] => stdClass Object
        (
            [AAA] => bbb
            [BBB] => aaa
        )

    [1] => stdClass Object
        (
            [AAA] => bbb
            [BBB] => aaa
        )

)

Can anybody explain to me why all object variables (that are in array) are changed?
And sorry for my bad english. I am not a native english speaker.

A: The array is storing two references to the same object, not two distinct objects, as represented below:

array(
    0 =>  ---|          stdClass
             |------->     [AAA] => bbb
    1 =>  ---|             [BBB] => aaa
)

If you want to copy an object, use clone, which performs a shallow copy of the object:
$arr = array($obj, clone $obj);

A: You need to create a new instance of the class
$obj2 = new stdClass;
$obj2->AAA = "bbb";
$obj2->BBB = "aaa";

$arr = array($obj, $obj2);

Otherwise your array contains 2 pointers to the same object.  The update statement changes the underlying object.


text:
Q: async.series is not doing things in series. Why? As I understand it, async.series does things one at a time. Can you help me decipher this output?
The code to manipulate a mongo database collection:
    async.series([
        countDocuments(db,function(){console.log("Step 1 complete");}),
        insertDocument(db,function(){console.log("Step 2 complete");}),
        countDocuments(db,function(){console.log("Step 3 complete");}),
        removeDocument(db,function(){console.log("Step 4 complete");}),
        countDocuments(db,function(){
        })], function(){
            db.close();
    });

And the output:
Step 1 complete
Step 3 complete
Step 2 complete
Step 4 complete

This makes no sense to me. Surely the whole point is to wait until 2 is complete before starting 3?

A: You must pass callback functions to async.series. Currently you're just calling all those functions directly - immediately - and pass their results to async.series. Also, each of those function does get a callback argument from passed from async that you need to invoke asynchronously to tell that the step is done and the next one should be executed.
async.series([
    function(cb) {
        countDocuments(db,function(e){console.log("Step 1 complete");cb(e);});
    },
    function(cb) {
        insertDocument(db,function(e){console.log("Step 2 complete");cb(e);}),
    },
    function(cb) {
        countDocuments(db,function(e){console.log("Step 3 complete");cb(e);}),
    },
    function(cb) {
        removeDocument(db,function(e){console.log("Step 4 complete");cb(e);}),
    },
    function(cb) {
        countDocuments(db, cb); // the short version
    }
], function(){
    db.close();
});

A: I think you are confusing async.series with async.waterfall. Here, your 4 functions will all start regardless of whether earlier functions have finished executing or not. However, the final call back (which executes db.close()) will be called back once all of the series functions have finished executing (It is like a barrier). If you use async.waterfall, every function will pass its result to the next one. which means the first will start and finish then the second will start and finish and so on.
Another issue is, you are not calling the callback by the end of your every function. If you don't call the callback the function which executes db.close() will never get called.


text:
Q: Python-like unpacking list in Groovy? For example in Python I can do something like:
li = [('John', 20, '360 244 4210'), ('Bill', 22, '360 244 4211'), ('Susan', 19, '360 244 4214')]
for name, age, phone_num in li:
    register(name, age)
    make_a_call(name, phone_num)

But in Groovy I have to do it like:
li = [['John', 20, '360 244 4210'], ['Bill', 22, '360 244 4211'], ['Susan', 19, '360 244 4214']]
li.each {
    name = it[0]
    age = it[1]
    phone = it[2]

    register(name, age)
    make_a_call(name, phone_num)
}

Is there any way in Groovy can I use to unpack list like Python?

A: Groovy supports positional destructuring on closure arguments.  This
works for ordered collections (e.g. List or Tuple).
def list = [['John', 20, '360 244 4210'], ['Bill', 22, '360 244 4211'], ['Susan', 19, '360 244 4214']]
list.each { name, age, phone ->
    println([name, age, phone])
}
// → [John, 20, 360 244 4210]
// → [Bill, 22, 360 244 4211]
// → [Susan, 19, 360 244 4214]


text:
Q: Consulta agrupada con distintos contadores Buenas tardes, espero esten bien.
Tengo un problema con una consulta SQL que pinta a ser sencilla pero creo que no lo es, tengo la siguiente tabla con esta información:
id   pais    sexo
== ========  ====
 1 Venezuela F
 2 Venezuela F
 3 Venezuela M
 4 Colombia  F
 5 Colombia  F
 6 Colombia  F
 7 Colombia  M
 8 Brasil    F
 9 Brasil    F

Debo hacer una consulta, que me devuelva la información de esta forma:
pais      femenino masculino
========= ======== =========
Venezuela        2         1
Colombia         3         1
Brasil           2         0

Yo he pensando algo así:
SELECT count(per1.sexo), count(per2.sexo), per1.pais, per2.pais
FROM `personas` per1,`personas` per2
WHERE
per1.sexo = "F"
AND per2.sexo = "M"
group by(per1.pais)

pero no es la solución y no me funciona, por favor si pueden ayudarme, muchas gracias :)

A: SELECT pais,
   sum(case when sexo = 'M' then 1 else 0 end) Masculino,
   sum(case when sexo = 'F' then 1 else 0 end) Femenino
FROM personas
GROUP BY pais;

Y te devolverá
+----------+----------+----------+
| pais     | Masculino| Femenino |
+----------+----------+----------+
| Venezuela| 0        |        2 |
| Colombia | 3        |        1 |
+----------+----------+----------+

A: Para obtener el resultado tal cual lo deseas en una tabla lo puedes realizar con subconsultas:
SELECT pais,
(SELECT COUNT(*) FROM Personas P1 WHERE P1.pais = P.pais AND sexo = 'F') AS Femenino,
(SELECT COUNT(*) FROM Personas P1 WHERE P1.pais = P.pais AND sexo = 'M') AS Masculino
FROM Personas P
GROUP BY Pais

El resultado es el siguiente:
pais                      Femenino    Masculino
------------------------- ----------- -----------
BRASIL                    2           0
COLOMBIA                  3           1
VENEZUELA                 2           1

A: Esta consulta es prácticamente lo mismo que @sioesi, solo que usa IF
SELECT pais AS Pais,
   SUM(IF(sexo = 'M', 1, 0)) AS Masculino,
   SUM(IF(sexo = 'F', 1, 0)) AS Femenino
FROM personas
GROUP BY pais
ORDER BY pais ASC

El resultado sera:
+-----------+-----------+----------+
| Pais      | Masculino | Femenino |
+-----------+-----------+----------+
| BRASIL    |         0 |        2 |
| COLOMBIA  |         1 |        3 |
| VENEZUELA |         1 |        2 |
+-----------+-----------+----------+

Nota: Para que la consulta funcione correctamente, la columna pais, debe tener una cotejamiento case insensitive, por ejemplo latin1_general_ci.

A: Para agregar a las excelentes respuestas de @sioesi y @Marcos Gallardo, te dejo otra opción que es un poco más compacta, pero simpre usando un SQL estándar que te puede servir en otras bases de datos también y que es completamente equivalente en rendimiento a sus respuestas. La diferencia es simplemente que uso la función COUNT en vez de SUM para no tener que escribir una expresión ELSE:
select pais,
       count(case when sexo = 'M' then 1 end) as masculino,
       count(case when sexo = 'F' then 1 end) as femenino
  from personas
 group by pais

Lo que sí te sugiero es de evitar de usar sub consultas para este problema. Puede parecer la forma mas obvia y sencilla de ejecutar la sentencia, pero no es muy eficiente y no es necesario.
Nota adicional
Aunque funcione, te sugiero de evitar usar las comillas dobles para delimitar cadenas como M y F. No es estándar hacerlo de esa manera. Mas bien, favorece usar las comillas simples, como de hecho todos lo han hecho en las respuestas publicadas a tu pregunta.

A: Usa esta consulta
SELECT p.pais, count(f.sexo) as femenino, count(m.sexo) as masculino
FROM personas p
LEFT JOIN personas m on  (m.pais = p.pais and m.sexo = 'M')
LEFT JOIN personas f on  (f.pais = p.pais and f.sexo = 'F')
GROUP BY p.pais


text:
Q: AWS Kinesis firehose - query current stats Is there a way to query AWS Kinesis Firehose for current stats such as

*

*Number of records in current buffer?

*how much of the buffer is consumed?

A: There are quite a few metrics that you can get from CloudWatch for Kinesis Firehose: http://docs.aws.amazon.com/firehose/latest/dev/monitoring.html
Note that these metrics are aggregated on a minute base. You can compare the numbers for PutRecord(batch), Incoming.Records and DeliveryToS3.Records


text:
Q: Open cv 3.0.0 FaceRecognizer class cannot be resolved while compiling in Linux (Ubuntu) In Open Cv 3.0.0 FaceRecognizer class cannot be resolved while compiling  in Linux (Ubuntu). This used to work in 2.4.11 version and the class was present in the contrib module. Looks like the contrib module is missing in the Open cv 3.0.0 version.

A: The contrib module by default doesn't come with the installation of open cv 3.0.0
The contrib module has to be separately installed. Please follow the instructions below to get rid of the compilation issue with FaceRecognizer class.

*

*First, go to your build directory in open cv. This could be named as
build or release when you have installed the open cv 3.0.0
version.

*There you can run the following command to install the contrib module

cmake -DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules opencv_source_directory

*In the above command, opencv_contrib is the opencv contrib module directory path that you have downloaded from the github link [https://github.com/Itseez/opencv_contrib/tree/3.0.0-rc1][1]. opencv_source_directory is the source directory of the opencv, which would be typically the open cv root folder where you extracted or downloaded it, this would be ../ if you have followed open cv tutorial instructions for installing and creating the release or build folder

*I used RC1 tag of open cv 3.0.0 from github, you can use tag of your choice.

*Now run the following two commands

make -j $(nproc)
sudo make install

*After this, in the code (.cpp or .hpp file) where you are referring to the FaceRecognizer class, put the following namespaces near the #includes

using namespace cv;
using namespace face;

*Alternatively you can also refer to the class with namespace prefix, as in, if you are referring to FaceRecognizer as cv::FaceRecognizer, now refer to it as cv::face::FaceRecognizer. It's just a coding style. Use either point 6 or 7 style, not both.

Now you shouldn't see any compilation issue.


text:
Q: How do I associate my custom ANT builder with the project instead of the Eclipse workspace? I'd like to associate some ANT targets with my project's build in Eclipse.
No problem, I create a custom ANT builder, specify targets to run, all is well.
But then I realize that the builder information is saved in the workspace instead of the project! Why is that, and how do I fix it?
The goal is that anyone who imports the project in a new Eclipse workspace can build it without adding the builder manually. This means that I should have the builder configuration under source control, which means it should belong to the project, not the per-user workspace.
Maybe I'm just missing something?
There is a bit of confusion, it seems, because builders look like launchers, but they are stored in a different directory. Simply creating the .settings dir and copying the xml doesn't help...

When I create the .externalToolBuilders directory under .settings and copy the launcher/builder there, I get this:

Solution:
I restarted from scratch, deleted the project-specific data in the workspace directory, but left the .settings dir in the project dir. Re-created the builder/launcher, and Eclipse automatically created it in the correct place, and also added it to source control.

A: Indeed, your launcher (Run/Debug launchers or External Builders launchers) are saved by default in the workspace.
<workspace>\myProject\.externalToolsBuilder)

You can move that directory (.externalToolsBuilder) manually in the .settings directory of your project.
And uncheck the option "Delete configurations when associated resource is deleted" as mentioned in this SO answer.
With a full refresh of the project (or even a delete, followed by a reimport), your local version of .externalToolsBuilder should be taken into account.

For the Debug/Run launchers (not your case), you also can (since Eclipse3.4) use one of the Import wizards:
File > Import

type launch configuration, and you can import said configuration directly within your project.


text:
Q: Django Models, on delete set pk This is my models:
class Customer(models.Model):
    nome = models.CharField(max_length=40)
    indirizzo = models.CharField(max_length=40)

class Appo(models.Model):
    appo = models.CharField(max_length=40)
    customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True, default=1,related_name='appocli')

now, if I delete a Customer I need SQL set in Appo models a specific PK for customer Foreign Key. For example 1.
Something like: on delete set 1
Please help

A: You can use SET_DEFAULT to set your foreign key to a default value
customer = models.ForeignKey(Customer, on_delete=models.SET_DEFAULT, default=1)


text:
Q: Recursion with strings Let $A$ be a set of strings on the alphabet ${a, b}$ starting with $a$ and ending with $b$ and they don't have occurrences of $ba$ as a substring. For example, $abab ̸∉ A$, $ab ∈ A$, $abb ∈ A$, $aabab ̸∉ A$, $aaab ∈ A$.
(i) Provide a recursive definition of A.
My attempt:
Base: $λ∈A$ (empty string)
Recursive Passage: ?
Please exaplin me how to do it.

A: The empty string is not in $A$, since any element of $A$ must start with $a$, and end with $b$.

A recursive specification for $A$ can be given as follows . . .

*

*$ab\in A$.$\\[4pt]$

*If $x\in A$, then $ax\in A$, and $xb\in A$.

A: Recursive definition of A:
$ A := ab | aA | Ab $

A: Since the strings have to start with $a$ and end with $b$, your base case isn't the empty string but $ab$. From there, your options are to add an $a$ or a $b$. If you add a character to a 2-character string, there are three places to put it: a the beginning, middle, or end. If you add an $a$ to $ab$, the beginning and middle are the same, and the end is not allowed, since that will create an instance of $ba$. Thus, you can consider the beginning to be the only place to put an $a$. Similarly, the only place to put a $b$ is at the end. This means that you end up with a string of $a$'s and $b$'s, with all of the $a$'s before the $b$'s. Every time you add an $a$, you can have to add it to the beginning (otherwise you would create an instance of $ba$), and every time you add a $b$, you have to add it to the end. So $A =\{ab, aS, Sb: S \in A\}$


text:
Q: Determine if exists a subgroup of order $3$ of $H=\langle\sigma^{8440}\rangle$ Consider the following permutation of $S_{13}$.
$\sigma=(1\;3\;13\;5\;11\;8)(2\;10\;4\;6\;12\;7\;9)$
Determine if exists a subgroup of order 3 of $H=\langle\sigma^{8440}\rangle$. If yes, exhibit it if no say why.
My attempt by using some properties of cyclic groups.
First of all, I calculated the order of $\sigma$ which is $ \operatorname{lcm}(6,7)=42$. Then the order of $\sigma^{8440}$ which is $\frac{42}{\gcd(8440,42)}$. Since $\gcd(8440,42) = 2$ then $|H|=o(\sigma^{8440}) = 21$ (since we are working with cyclic groups).
Finally, since $3\mid21$, there exists a subgroup of $H$ of order $3$. I call it $G$ and it is generated by $\langle\sigma^{\frac{21}{3}}\rangle=\langle\sigma^{7}\rangle$.
Is my attempt correct?

A: You make a mistake at the very end of your argument; $\sigma^7$ is not an element of $H$. Because $8440\equiv40\pmod{42}$ you have
$$H=\langle\sigma^{8440}\rangle=\langle\sigma^{40}\rangle=\langle\sigma^{-2}\rangle=\langle\sigma^2\rangle.$$
The subgroup $H\subset\langle\sigma\rangle$ is the subgroup of even powers of $\sigma$. I'll leave it to you (for now) to determine the subgroup of order $3$.
Besides this, you are entirely correct. Depending on how complete you want to be, you could

*

*note that $\sigma$ is given as a product of disjoint cycles, and hence its order is $\operatorname{lcm}(6,7)$.

*make explicit what the elements of the subgroup of order $3$ are, i.e. write out the appropriate powers of $\sigma$ in cycle notation.


text:
Q: java week count for previous month In java how can one get number of weeks of previous month, week starting from Monday
cal.setFirstDayOfWeek(Calendar.MONDAY);

cal is Calendar instance
It returns 0 if first day of week is other than Monday. So it has to be counted as previous months last week, that's my requirement.

A: Your question is not very clear but probably you're looking for something like this:
Calendar cal = Calendar.getInstance();
cal.setTime(new Date()); // today's date
// previous month from today
cal.add(Calendar.MONTH, -1);
// get to the 1st week
cal.add(Calendar.DATE, -7 * (cal.get(Calendar.DAY_OF_MONTH)/7));
// Get to the 1st Mon of last month
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
// # of days in last month
int maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
// print # of week since Mon of last month
int numWeeks = ((maxDay-cal.get(Calendar.DATE))/7)+1;
System.out.printf("# of weeks from Mon in last month: %d%n", numWeeks);

A: Quick and dirty (given the requirements as asked in my comment above):
public static void main(String[] args) {

    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -1);
    cal.set(Calendar.DAY_OF_MONTH,1);
    while ( cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY ) {
        cal.add(Calendar.DAY_OF_WEEK, 1);
    }
    int startingMonth = cal.get(Calendar.MONTH);
    int numberOfWeeks = 0;

    while (cal.get(Calendar.MONTH) == startingMonth ) {
        cal.add(Calendar.WEEK_OF_MONTH, 1);
        numberOfWeeks++;
    }
    System.out.println("weeks in last month:" + numberOfWeeks);
}

A: If you want to count all the Mondays in the previous month here you are:
public int getNofWeeks() {
    Calendar cal = Calendar.getInstance();
    while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
        cal.roll(Calendar.DATE, false);
    }
    int currentMonth = cal.get(Calendar.MONTH);
    int previousMonth = (currentMonth + 12 - 1) % 12;
    int prePreviousMonth = (currentMonth + 12 - 2) % 12;
    int nofWeeks = 0;
    do {
        int month = cal.get(Calendar.MONTH);
        if (month == previousMonth) {
            nofWeeks++;
        }
        if (month == prePreviousMonth) {
            break;
        }
        cal.roll(Calendar.WEEK_OF_YEAR, false);
    } while (true);
    return nofWeeks;
}

A: java.time
Avoid using the troublesome old date-time classes now supplanted by the java.time classes.
If your Calendar is actually a GregorianCalendar then convert to a ZonedDateTime.
GregorianCalendar gc = (GregorianCalendar) myCal;
ZonedDateTime zdt = gc.toZonedDateTime();

Extract the date-only.
LocalDate ld = zdt.toLocalDate();

1st to 1st
Get first of this month, and first of next month. Use a TemporalAdjuster defined in TemporalAdjusters (note the plural).
LocalDate firstOfThisMonth = ld.with( TemporalAdjusters.firstDayOfMonth() );
    LocalDate firstOfNextMonth = ld.with( TemporalAdjusters.firstDayOfNextMonth() );

Calculate weeks between.
long weeks = ChronoUnit.WEEKS.between( firstOfThisMonth , firstOfNextMonth );

Monday-to-Monday
If you want Monday-to-Monday, used different TemporalAdjuster already defined in TemporalAdjusters with a DayOfWeek enum object.
LocalDate firstMondayOfThisMonth = ld.with( TemporalAdjusters.firstInMonth( DayOfWeek.MONDAY ) );
LocalDate firstMondayOfNextMonth = ld.plusMonths( 1 ).with( TemporalAdjusters.firstInMonth( DayOfWeek.MONDAY ) );

long weeks = ChronoUnit.WEEKS.between( firstMondayOfThisMonth , firstMondayOfNextMonth );

About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.* classes.
Where to obtain the java.time classes?

*

*Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later  - Part of the standard Java API with a bundled implementation.

*

*Java 9 adds some minor features and fixes.

*Java SE 6 and Java SE 7

*

*Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

*Android

*

*Later versions of Android bundle implementations of the java.time classes.

*For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.


text:
Q: Google ChartEditor to open up on the "Customize" tab I have a very simple script that opens up the Google ChartEditor for a chart:
 function loadEditorG1() {
    chartEditorG1 = new google.visualization.ChartEditor();
    google.visualization.events.addListener(chartEditorG1, 'ok', redrawChartG1);
    chartEditorG1.openDialog(wrapperG1, {});
}

function redrawChartG1(){
  wrapperG1 = chartEditorG1.getChartWrapper();
  wrapperG1.draw();
}

How can I make the loadEditorG1() function open up the editor on the "Customize" tab? By default Google ChartEditor opens up on the "Start" tab.


text:
Q: How to see m2e connectors installed? I have installed Tycho m2e connector as described here: http://codeandme.blogspot.ru/2012/12/tycho-build-1-building-plug-ins.html
It was said to "Go to Preferences/Maven/Discovery and click on Open Catalog. Find and select the Tycho Configurator".
When I was doing this first time, Tycho appearead in the list and I installed it. Later, when I repeated the same thing second time, Tycho didn't appear in search result.
This probably because it was already installed.
So, how to be sure? How to check the list of things, installed for m2e and see tycho there?

A: m2e connectors are discovered via a special catalog, but in the end they are installed just like any normal feature. So once they are installed, you'll find them listed with the other features under Help > About > Installation Details.
Knowing that the Tycho connector is called "Tycho Project Configurators", you can find out if you have that connector installed.

But what if you don't know the name of the connector you are looking for? Or you don't know if some installed feature is an m2e connector? In this case, the only solution I could find was to look into the data behind the catalog. The catalog URL is shown in the configuration under Maven > Discovery. The XML file at that URL points to another location with a JAR file (in my m2e 1.4 installation, this pointed here), and in the JAR file there is a plugin.xml with the raw catalog data.
There, you can for example find the feature ID of the Tycho connector, which is the same ID as shown in the Installation Details dialog:
<iu id="org.sonatype.tycho.m2e.feature.feature.group" />

This is all not very convenient, but if you need the definite answer, you can find it there. E.g. I found out that I have an old version of the Tycho connector installed. If this is also the case for you, just uninstall the connector and have m2e automatically discover the connectors you need. This installed the right connector version for my m2e version.

A: Go to Help -> About Eclipsse -> Installation Details -< Installed Software. This will list all of your installed (top-level) features.  It will list your m2e components.  Here is mine:

This should be enough to let your figure out what is installed.

A: if you need Discovery  for the test you can add in your pom:

             commons-discovery
         <artifactId>commons-discovery</artifactId>

         <version>0.5</version>

         <scope>test</scope>


text:
Q: ASP.NET Core with React - 431 Request headers too long I have a dotnet application that I start with the dotnet run command. I also have a React app, that I start with yarn start.
When I open the browser on localhost:3000 (where the react app is) the server log looks like this:
....this goes on for long
 Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/build/bundle.js
info: Microsoft.AspNetCore.Server.Kestrel[17]
      Connection id "0HLMFVTO65C53" bad request data: "Request headers too long."
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Request headers too long.
   at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TakeMessageHeaders(ReadOnlySequence`1 buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ParseRequest(ReadOnlySequence`1 buffer, SequencePosition& consumed, SequencePosition& examined)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)

After like 15 seconds of this the page loads, but I get an error in the browser console about the bundle.js 431 error.
If I make the RequestHeaders max total size larger for the Kestrel server, the same thing happens but this goes on for even longer and the end result is a 500 server error instead of 431.
Moreover if I try to make a simple DELETE request to the server using postman the result is pretty much the same. As if the request was stuck in an infinite loop and then returns a 431.
Lines from Startup.cs that might be relevant:
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

// In production, the React files will be served from this directory
services.AddSpaStaticFiles(configuration =>
     {
          configuration.RootPath = "client/build";
     }
);

app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            }
);
app.UseSpaStaticFiles();
app.UseSpa(spa =>
            {
                if (env.IsDevelopment())
                    spa.UseProxyToSpaDevelopmentServer("http://localhost:3000");
            }
);

What is going on?

A: I ran into the same issue, but with Angular, using asp.net core during localhost dev. The solution for me was to set the header size for node in the "start" script inside of my package.json file.
Inside scripts json object:
"start": "node --max-http-header-size=100000 ./node_modules/@angular/cli/bin/ng serve",


text:
Q: SQL: Number of Comments left by single commenter I am trying to get the number of comments left by each commenter (subscriber) and order from highest to least.
For Starters this was the first link I went to :
SQL: How to get the count of each distinct value in a column?
Similar problem, except in my first column the values may repeat. Mine looks something like this.
email   | comment
--------------------
foo@bar | blah..
bar@bar | blah..
zob@bar | blah..
foo@bar | blah..
foo@bar | blah..
bar@bar | blah..

and essentially all I need to do is get an output like this
-foo@bar (3)
-bar@bar (2)
-zob@bar (1)

I know this may be very trivial, I just don't use SQL queries that often.

A: select
  email, count(*)
from
  mytable
group by email
order by count(*) desc

Here's a fiddle


text:
Q: how to save extended-mapi imessage as html I am using Delphi 10.3 with IMIBO extended MAPI.

*

*Is it possible to save IMessage as HTML?

*If no, is it possible to convert IMessage to MailItem.MAPIObject and use MailItem to save as HTML

This works fine, but takes too long:
procedure TForm7.Button1Click(Sender: TObject);
const
  olMailItem = 0;
var
  Outlook    : OleVariant;
  FNameSpace : OleVariant;
  vMailItem  : variant;
begin

  Outlook := CreateOleObject('Outlook.Application');
  FNameSpace := Outlook.GetNamespace('MAPI');
  FNameSpace.Logon;
  vMailItem := FNameSpace.OpenSharedItem('c:\3\aa.msg');

  ShowMessage(vMailItem.Subject);

  //olHTML, olMSG, olRTF, olTemplate, olDoc, olTXT, olVCal, olVCard, olICal, or olMSGUnicode.
  vMailItem.SaveAs('c:\3\aa.html', olHTML);

  VarClear(vMailItem);
  VarClear(FNameSpace);
  VarClear(Outlook);
end;

A: Of course, but you'd have to build the HTML yourself from all the gory MAPI properties. There is nothing in MAPI that exports a message in anything but MSG format.

A: *

*To retrieve the complete message body with images you need to retrieve the PR_BODY_HTML property value which contains the HTML markup. See Retrieving MAPI Properties for more information on that.
To get the message body with images you need to search for <img> tags in the markup and check their location, i.e. whether any of them are referring to the embedded images. If so, you need to save attached images to the same folder with HTML markup to get the message body displayed correctly, of course, with some modififcations by removing the CID prefix from the <img> tag.

*There is no direct cast. Instead, you can use the PR_ENTRYID property value to retrieve a corresponding item from the OOM by using the NameSpace.GetItemFromID method which returns a Microsoft Outlook item identified by the specified entry ID (if valid). This method is used for ease of transition between MAPI and OLE/Messaging applications and Outlook.


text:
Q: Creating a templating function that passes in a name for a class Let's say I have a set of classes I want to extend because they have different properties i'll use in my callback function (to come):
class ExtendMe1 //
class ExtendMe2 //

And I wanted to write a new class that extended it programmatically. Is there a way of doing something like this:
ExtenderTemplate(
    <ExtendMe1>, // Class to extend
    <AClassToExtendWith>, // New class name that i'm extending for
    CallbackFunction() // A function that can be run locally inside our new class
);

let's say that the method ExtenderTemplate looked something like this:
void ExtenderTemplate( <Ext>, <NewClass> )
{
    CreateClass( <NewClass ).Extends( <Ext> ).Run( CallbackFunction );
}

Is there a way of doing this in Java?
The resulting class would programmatically be built but would look like this:
public class AClassToExtendWith extends ExtendMe1
{
    public AClassToExtendWith()
    {
        CallbackFunction();
    }
    public void CallbackFunction()
    {
        // accesses something that belongs to ExtendMe1
    }
}

Context
We have a set of ui controls that we have to extend with our own class, do some routine crap inside it, then actually do something to extend the ui control (hopefully can be done with the callback function). It would be really great if we could pack this into some template method where in the end you just have these 3 paramaters.. which ui control are you extending, what do you want the class to be called (so we can call within our view) and finally what you will change about the ui control (the callback function)
Further clarification of how our team might use this function

*

*So I want to extend a UI Control that someone else has made.. I know what its called..

*I need to call it somehow in my code so I need to give it a nice new name... I also need to do this because I want to write some more functionality to it.

*I want to modify the UI control so that it uses my functionality instead.

I might end up calling it with something like (this will have to be pseudo)
ExtenderTemplate( "NewUIControl", "UIControl_Table", {
    UiControlRender.text = "New stuff added by accessing the extended method";
});

Otherwise I would have to do this:
public class NewUIControl extends UIControl_Table
{
    public void FunctionThatIsRunByFrameworkAutomatically()
    {
         // Do routine stuff that accesses UIControl_Table and makes copies of this and that

         // MODIFY THIS AND THAT WITH THE NEW STUFF I WANT IN THE UICONTROL

         // Do  more routine stuff that belongs that accesses UIControl_Table and makes copies of this and that but passes in my modified stuff instead of the typical stuff the UI COntrol outputs
    }
}

A: I think, a Proxy is what you are looking for. Some sample code from the Proxy documentation:
To create a proxy for some interface Foo:
 InvocationHandler handler = new MyInvocationHandler(...);
 Class proxyClass = Proxy.getProxyClass(
     Foo.class.getClassLoader(), new Class[] { Foo.class });
 Foo f = (Foo) proxyClass.
     getConstructor(new Class[] { InvocationHandler.class }).
     newInstance(new Object[] { handler });

or more simply:
  Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
                                      new Class[] { Foo.class },
                                      handler);

Update:
I just saw, that the Proxy class only proxies Interfaces, but does not seem to be able to extend classes.


text:
Q: DotNet Neo4JClient error: Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied I am currently using the Neo4J Client for .Net for a new project. Beforehand I already used the client in other project and tried to reuse my code but came across an error I never had before. Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied
I already searched a lot but cant figure out an answer to my problem.
My setup:

*

*Web API with.NET Framework 4.8

*Neo4JClient at version 4.1.15 installed from NuGet

*Neo4J Desktop with Neo4J Database at version 4.3.1

*Also tested with Neo4J Desktop with Neo4J Database at version 3.5.30

So basically I have a Neo4J Database that contains some nodes with Label "ObjectType" that are connected to nodes with label "Table" via the relationshiptype "IS_CREATED_IN". Now I want to query the objecttypes and the tables.
My C# code is:
var q = Client.Cypher
.Match("(node:ObjectType)-[e:IS_CREATED_IN]->(table)")
.Return((node, e, table) => new
{
   node = node.As<Node<string>>()
});

With that I always get the error **Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied **.
I changed the type of the nodes from Node to NodeObjectTypeDto. This works, but I want to create more general methods to use them in a BaseRepository. Therefore I want to use the Node Type but cant figure out how I can do that.
public class NodeObjectTypeDto
{

    public string Id { get; set; }

    public string Name { get; set; }

    public string Alias { get; set; }

    public string Description { get; set; }

    public string ENTRYCOUNT { get; set; }
}

In my earlier project I used the below setup. There the usage of node.As<Node>() worked fine.

*

*Neo4JClient at version 2.0.0.9

*Neo4J Server with Neo4J Database at version 3.4.1

Here is an excerpt of the returned Raw JSON of Neo4J:
{"columns":["node"],"data":[{"row":[{"Description":"MATERIAL","Alias":"MATERIAL","ENTRYCOUNT":16968,"Id":29585,"Name":"MATERIAL"}],"meta":[{"id":62937,"type":"node","deleted":false}]},{"row":[{"Description":"MATERIAL","Alias":"MATERIAL","ENTRYCOUNT":16968,"Id":29585,"Name":"MATERIAL"}],"meta":[{"id":62937,"type":"node","deleted":false}]}]

Has anyone an idea how I can solve this problem?

A: The problem with using Node<string> is that all you are getting is the raw JSON, and at that point, you may as well either use a standard REST client (if using GraphClient) or the Neo4j.Driver (if using the BoltGraphClient) as both of those give you a more 'base' level connection.
Having said that - the Node<string> approach should work - and I'm not sure when it stopped working.
At the moment, the only realistic way to get it working would be a PR to allow it to do the conversion, and, if I'm honest, I'm a bit surprised it's not working with the http version as well, as I'm reasonably confident that hasn't been touched.
If that is the case, then the other 'reason' might be that Neo4j itself no longer gives the output that can be parsed correctly.
All of these are 'investigation' lines unfortunately, and not 'answers'.


text:
Q: Change PouchDB's rev algorithm to use a blockchain / hashchain pattern Is it within reason to change CouchDB / PouchDB's revision algorithm 'under the hood' to use a blockchain style 'hashchain' such that the _rev of every doc is the result of a hash of it's previous revisions?
Such a model would help preserve the integrity of revisions; in a distributed network for example it could essentially be the basis of an immutable history for your entire db.

A: In fact, the _rev is a deterministic hash over the document and all of its revisions, at least for CouchDB. It's also using the previous _rev, so you basically get a deterministic hash if you make the same sequence of updates to a document.
Unfortunately, it's an MD5 hash, so it isn't really suitable for security-related stuff.
AFAIK, the actual value of the _rev is never checked, only the part before the dash must be numeric. So you could write a PouchDB plugin that changes the _rev generation and also checks the integrity of the _rev value on every update.


text:
Q: FHIR protocol questions We are a HISP connecting doctors and patients looking at adopting FHIR protocol. I have few questions regarding FHIR.

*

*We are looking at serializing FHIR resources as JSON in Couchbase. Is serializing FHR resources as-is a right approach?

*How can I add new resources in addition to already defined ones? I read about creating "Other" resource and define all properties as extensions.
Is it the right approach?

*How can I define value sets like medication code, gender etc or any kind of lookup as a resource?

*I see "Contained" resource as a way to add a reference. In some scenarios it can be expensive to send many references.
Is it possible to define a resource that has "Contained" resource but has actual value instead of reference? Here is an example:
I'm an intermediary site where patients can book appointments and I send the data to a practice's EHR. I'd like to send full patient resource instead of display name alone (see  example below). How do I do this?

Part of appointment resource sample:
"participant":[{"individual":{"reference":"Patient/example","display":"Peter James Chalmers"},"required":"required","status":"accepted"},{"type":[{"coding":[{"code":"attending"}]}]

*How are resources defined in FHIR correspond to C-CDA? For example, if a C-CDA document comes from a EHR, how can I transform to a FHIR resource?
If an EHR consumes only C-CDA, how can I convert FHIR resource to C-CDA before sending to EHR.

*Are there push notification mechanism built in FHIR? For example, I may want to push record changes to a patient's iPhone or push changes to an EHR.

*Are there open source .Net libraries for FHIR that can help us jump start?

*What is the recommended way to do authentication & authorization? I'd like to use oAuth2.
Thanks.

A:
1 . We are looking at serializing FHIR resources as JSON in Couchbase. Is serializing FHR resources as-is a right approach?

it's "a" right approach, yes. There are others

2 . How can I add new resources in addition to already defined ones? I read about creating "Other" resource and define all properties as extensions. Is it the right approach?

Yes, for now; in principle it is intended to be possible to define real additional resources, but what the rules will be are not yet defined

3 . How can I define value sets like medication code, gender etc or any kind of lookup as a resource?

using the value set resource.

4 . I see "Contained" resource as a way to add a reference. In some scenarios it can be expensive to send many references. Is it possible to define a resource that has "Contained" resource but has actual value instead of reference?

I don't know what you mean.

5 . How are resources defined in FHIR correspond to C-CDA? For example, if a C-CDA document comes from a EHR, how can I transform to a FHIR resource? If an EHR consumes only C-CDA, how can I convert FHIR resource to C-CDA before sending to EHR.

Roughly, an section corresponds to the List resource, and an entry to a resource. There's no formal published work on alignment between C-CDA and FHIR yet, though some operational work exists here:

6 . Are there push notification mechanism built in FHIR? For example, I may want to push record changes to a patient's iPhone or push changes to an EHR.

Well, in the EHR case, the EHR should offer a FHIR server, and you create/update on the EHR. For a mobile client, the rules are different. You can't just push stuff at a phone, you need some kind of client initiation. We have added Subscriptions to the development version of FHIR (see the continuous build), but these are not in the DSTU version

7 . Are there open source .Net libraries for FHIR that can help us jump start?"

yes. see http://hl7.org/fhir/downloads.html

8 . What is the recommended way to do authentication & authorization? I'd like to use oAuth2.

We recommend OAuth


text:
Q: Explanation of the construction of the reals using Dedekind cuts. I have recently started studying calculus 1.
I am studying by myself (pre-academic, starting my degree next month) and have touched very lightly on the subject of constructing $\mathbb{R}$.
I have seen how to construct it via Dedekind cuts, and Cauchy sequences.
I am really trying to get my head about the formationg of $\mathbb{R}$ using Dedekind cuts, using Cauchy sequences is rather intuitive for me.
I'd like to receive an abstract point of view on how does it work (sort of an "explain to me like im 5" - any redditors here? lol)
I understand the basics of it. I just don't get how we actually get the real numbers from it.

A: I'll just describe the geometric heuristics here. Reading the analytical rewriting would be easier after:
Dedekind noticed that the concept of a rational number can be thought of as representing a separation, partition, or cut (schnitt, to use the German he used) of the rational line into two sets, say L and R, so that every point of L is to the left of every point of R.
After this realisation, and the fact that some cuts of $\mathbf Q$ are not rational (Dedekind used the cut defined by all $x$ separated as to whether $x^2$ is less than or greater than two, which has become the classic non-example ever since), the completion of the cuts of the rational numbers so that every such cut is represented by a number is how Dedekind understood the reals.
That's the basic idea, and you'll find the detailed and precise development of this idea (and how to define the usual arithmetic operations on these cuts consistently with those operations we are used to) in your favourite analysis text, namely Rudin. Or better still, read Dedekind himself. If I recall, I think it's called (in translation): What are numbers and what are they for? or something similar.
Good luck.


text:
Q: $env must not be accessed before initialization I upgrade my project from SF 5.4 to SF 6 with php 8.1.2.
With my dev env I have no errors!
When I use the prod env when I cache clear I have the error:
In Route.php line 196:

  Typed property Symfony\Component\Routing\Annotation\Route::$env must not be accessed before initialization

I try to remove the var/cache folder.
Do you have any ideas how to fix that one?
I found the same error in stack and I replace the handler_id with null value.
The error come from the SF router vendor. Route.php is not my own code.

A: I have had the same issue so I cleared cache typing this command symfony console cache:clear to make all work again.
You can also refer to this link if the need arises:
$env not initialized


text:
Q: Rails 3 - Passing models to another controller & losing stylesheets on render I am attempting to build a simple content management system using Twitter's Bootstrap for a small site and I'm running into an issue with the views.
Rails version is 3.0.10
I want to allow the user to create their own pages so I have a Pages controller that has all your standard RESTful methods.  Since these can have crud applied to them, they can only be accessed by a logged-in administrator.
So... I have a Public controller that sets the @pages and @page instance variables and uses those to display them in the public Show view.
Here is the Public controller - pretty simple:
  def index
    @pages = Page.all
  end

  def show
    @pages = Page.all
    @page = Page.find(params[:id])
  end

The reason that there is a @pages instance variable on the 'index' method is because I have a welcome page that loads and I'm passing in @pages to populate the navigation elements dynamically:

<%= link_to "Welcome", public_index_path, :class => 'active', :id => 'menu_home' %>

          <% @pages.each do |page| %>

<%= link_to page.title, public_path(page) %>

          <% end %>

The content of the Public controller's 'show' method (which contains an individual page) is passed into the <%= yield %> statement in the applicaton.html.erb file:

  <%= yield %>

My site

So far, this is working fine.
The problem is that when I click the link that takes me to the public_path(page) - I get the content as it should appear, but I lose all my styles.  I'm actually getting a 404 error on my stylesheets:

All of these style sheets were loading in just fine on the http://localhost:3000/public page, but when it goes to http://localhost:3000/public/1 - that's when all the styles disappear.  But, they are both using the same layout.
Here is what the log file shows when the request is made:
Started GET "/public/1" for 127.0.0.1 at 2012-03-03 21:14:49 -0600
  Processing by PublicController#show as HTML
  Parameters: {"id"=>"1"}
  [1m[35mPage Load (1.0ms)[0m  SELECT "pages".* FROM "pages"
  [1m[36mPage Load (0.0ms)[0m  [1mSELECT "pages".* FROM "pages" WHERE "pages"."id" = 1 LIMIT 1[0m
Rendered public/show.html.erb within layouts/application (24.0ms)
Completed 200 OK in 63ms (Views: 51.0ms | ActiveRecord: 1.0ms)

Started GET "/public/stylesheets/bootstrap.css" for 127.0.0.1 at 2012-03-03 21:14:50 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/bootstrap.css"):

Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.0ms)

Started GET "/public/stylesheets/bootstrap-responsive.css" for 127.0.0.1 at 2012-03-03 21:14:50 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/bootstrap-responsive.css"):

Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.0ms)

Started GET "/public/stylesheets/elements.less" for 127.0.0.1 at 2012-03-03 21:14:51 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/elements.less"):

Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (3.0ms)

Thanks for having a look

A: I managed to find my own answer...
The Rails helper stylesheet_link_tag was generating a relation attribute of type "stylesheet" when the Less css files needed a relation of type "stylesheet/less".
The fix was specifying the relation like this:
 <%= stylesheet_link_tag 'elements.less', :rel => 'stylesheet/less' %>
 <%= stylesheet_link_tag 'main.less', :rel => 'stylesheet/less' %>

A: Try to change path to your resource, something like that:
# config/routes.rb

resources :public, :path => :my_public

This will give you routes
public_index GET  /my_public(.:format)          public#index
             POST /my_public(.:format)          public#create
new_public   GET  /my_public/new(.:format)      public#new
edit_public  GET  /my_public/:id/edit(.:format) public#edit
public       GET  /my_public/:id(.:format)      public#show
             PUT  /my_public/:id(.:format)      public#update
             DELETE /my_public/:id(.:format)    public#destroy

This way it will not mess up with requests to the static assets in public directory. But you may want to rename resource and controller instead.

A: If you are using the bootstrap-saas gem, make sure you take out the "link href='assets/css/bootstrap-responsive.css' rel='stylesheet'" tag out of your application.html.erb file, this will prevent the helper from generating the relation which results in a routing error.


text:
Q: Type file content, pipe some actions and put result back Is there way to do something like thas:
cat somefile.txt | sort | uniq > somefile.txt

I.e. I want to list entire file, then pipe some actions to its content and finally put result back to source file overwriting it completely. For now I doing it by putting output to temporary file and after all moving it over original. I want to do it such simple way like linux piping allows.
Shell is bash in Linux and cmd in Windows if it is important.

A: (answering for bash)
No. The shell processes redirections first, which then truncates the file. Only then does cat start, and it's operating with an empty file.
There is a tool called sponge in the moreutils package that lets you do this:
cat somefile.txt | sort | uniq | sponge somefile.txt

This command can be simplified (remove UUOC):
sort -u somefile.txt | sponge somefile.txt

Without sponge you have to write to a temp file, and if the command succeeds, overwrite the input file
tmpfile=$(mktemp)
sort -u somefile.txt > "$tmpfile" && mv "$tmpfile" somefile.txt

A: You can use Vim in Ex mode:
ex -sc 'sort u|x' somefile.txt

*

*sort u sort unique

*x save and close


text:
Q: XCode is resolving the wrong time.h file I'm just getting my feet wet in C with some work in GStreamer, but seem to already be stuck.
I'm compiling the project in X Code using GNU99. The <time.h> header file that is part of the GStreamer code has no reference to time_t, which is used by some of the files.
Therefore I'm seeing:
/Library/Frameworks/GStreamer.framework/Versions/1.0/Headers/glib/gbookmarkfile.h:171:11:
Unknown type name 'time_t'; did you mean 'size_t'?

Do some C versions have varying header files for <time.h> that have done away with the time_t type? If so, is there a workaround?
Edit:
Looks like it has something to do with how XCode is searching for the <time.h> header file.
It should grab it from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/time.h, but it's instead using one from FFmpeg
Under header search paths, I see this:
/Library/Frameworks/GStreamer.framework/Versions/1.0/Headers
This setting is directly from the tutorial download

A: My workaround solution was to add
#include </Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/time.h>

to the FFMPEG time.h file.
Your path to the proper time header file may vary.


text:
Q: Automated graphics card recommender? Crucial have a tool that when you run it, it suggests the correct memory for you and gives you options based on price and performance.
is there anything similar to this for graphics cards?

A: I'm not aware of such a tool. The fundamental difference between memory and graphics cards is that there are far more different types of memory interfaces (DDR1, DDR2, DDR3, and then all the different speeds and timings) than there are graphics ones (which is basically just the question of AGP or PCI-E). The bottom line is, if you have an AGP slot, 99.99% of AGP graphics cards will work in your PC at it's full capacity (assuming the bottleneck isn't somewhere else) - and likewise for PCI-E. This isn't always true for memory as motherboard manufacturers will recommend specific brands and models of memory.
Before going out and buying anything, I'd want to establish that my graphics card is actually the bottleneck. There are tools out there that will let you monitor GPU usage, which is one helpful measure. i.e. If you're playing a game and your CPU usage isn't maxed out** but your GPU usage is, then your graphics card is probably the bottleneck and you'll benefit from a replacement.
** Be careful doing this. Example: If you have a quad-core processor and your game is taking up 25% of the total CPU usage (i.e. 100% of one core) and the game itself doesn't support multiple cores, then your CPU is getting maxed out.

A: There is no such tool AFAIK, but you can get an list of GPU's arranged based on their memory clock, chipset, price at this site. It helped me a lot.

http://pcpartpicker.com/parts/video-card/


text:
Q: Is it possible to change a String value into a R.string reference name? The title is a little confusing so let me explain further. An application I am trying to make has multiple buttons opening a new activity that look the same, but the text is different depending on the button clicked (Like a dictionary). So instead of recreating the activity 50+ times, I made a new method for onClick() in the first activity with a new Intent, and added a getIntent() to the second activity.
//first activity method
public final static String TRANSFER_SYMBOL = "com.engineering.dictionary.MESSAGE";

public void openView(View view)
{
  Intent open = new Intent(this,displayCharHB.class);
  Button setBtn = (Button) findViewById(view.getId());
  String grabText = setBtn.getText().toString();
  String thisChar = "sym_hira_" + grabText;
  open.putExtra(TRANSFER_SYMBOL,thisChar);
  startActivity(open);
}

//second Activity method
@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent grabChar = getIntent();
    String thisChar = grabChar.getStringExtra(hira_basic.TRANSFER_SYMBOL);
    //String strValue = "R.string." + thisChar;

    TextView displaySym = (TextView) findViewById(R.id.charDisplay);
    displaySym.setText(thisChar);
}

sym_hira_ + whatever is stored in grabText is the name of a String in strings.xml (For example, grabText = "ro", sym_hira_ro is a String name). Is it possible to get it to reference that string name with setText() and not actually set the text to "sym_hira_..."?

A:
Is it possible to get it to reference that string name with setText()

Use getIdentifier to get value from strings.xml using name:
int resId = getResources().getIdentifier(thisChar, "string",getPackageName());
displaySym.setText(getResources().getString(resId));

A: you can using BeanShell execute the "R.string.xxxx" command to get the string resource id.
this is my code example;
String str = "";
Interpreter i = new Interpreter();
i.set("context", MainActivity.this);
Object res = i.eval("com.example.testucmbilebase.R.string.hello_world");
if(res != null) {
    Integer resI = (Integer)res;
    str = MainActivity.this.getResources().getString(resI);
}


text:
Q: Django Autocomplete-light Case Sensitivity Issue I have created a basic setup for autocomplete-light on one of my forms. I am using direct SQL queries to access the data I require, and the Select2ListView to send the data to the template. The autocomplete data is available on the browser, but it is case sensitive. Can someone please suggest what I can do to make the autocomplete-light become case insensitive?
I read about using 'split_words = True' from the AutocompleteModel class, but I have no idea how to do this.
For example (q = 'ger'):
Command Prompt (views.py print statement) returns

['Algeria', 'Germany', 'Niger (the), 'Nigeria']

http://127.0.0.1:8000/autocomplete/country-autocomplete?q=ger returns

{"results": [{"text": "Algeria", "id": "Algeria"}, {"text": "Niger (the)", "id": "Niger (the)"}, {"text": "Nigeria", "id": "Nigeria"}]}

As you can see,  Germany is visible in the data I am returning from the view, but there is some additional filtering going on by autocomplete-light. I need to change autocomplete-light so that the filtering it performs is case-insensitive. Any ideas?
I am running Python 3.5.2, and the latest pip install for autocomplete-light.
Thanks
Stephen
View
class CountryAutocomplete(autocomplete.Select2ListView):
    def get_list(self):
    # Only allow authenticated users
    if not self.request.user.is_authenticated():
        return []

    # Read all country names from database
    cursor = connection.cursor()
    cursor.execute('SELECT country_name FROM autocomplete_iso3166;')
    results = cursor.fetchall()

    # Flatten database query into a list
    results = [e for l in results for e in l]

    # Check POST query and filter further
    if self.q:
        # Make query case insensitive
        results = list(filter(lambda k: self.q.casefold() in str(k).casefold(), results))

    print(results)
    return results

Form
    class VendorForm(forms.ModelForm):
    class Meta:
        model = client
        fields = [
            'vendor_name', 'address5', 'address4', 'address3', 'address2', 'address1',

            ]

    widgets = {
    'address5': autocomplete.ListSelect2(url='country-autocomplete'),
    'address4': autocomplete.ListSelect2(url='state-autocomplete',forward=['address5'])
    }

Model
class client(models.Model):
    vendor_name = models.CharField(max_length=100)
    user_admin = models.ForeignKey(User, unique=False, null=True, blank=True)
    address1 = models.CharField(null=True, blank=True, max_length=200)
    address2 = models.CharField(null=True, blank=True, max_length=50)
    address3 = models.CharField(null=True, blank=True, max_length=50)
    address4 = models.CharField(null=True, blank=True, max_length=50)
    address5 = models.CharField(null=True, blank=True, max_length=50)

A: if self.q:
    queryset = queryset.filter(country_name__istartswith=self.q)

i means case insensitive.  This example uses the beginning of the field.
If you want an exact match case-insensitive it would be:
country_name__iexact=self.q


text:
Q: How to have wget entire set of text data? I have Ubuntu 18.4.  I recently found out about wget and tried it on a remote file of my data that I've been trying to get onto my PC for months with no luck.
I ran wget and it got the "front page" that sets up the display format for displaying the text I wrote over many years on that remote news site. But, it did not go any further.  I've looked at the code the site uses to display all of this text data and it is a combination of html and java.  I am not a programmer and have little understanding of all of their code which is extremely long. This site has not been a bit helpful to get all these old comments and text of mine.
I want to get my text data and be able to reformat it for a book I'd like to write.
Is there some way to have wget grab all of my data?  The site sometimes has a communication fault and drops the connection with an error message of "error-connection-retry" which may get reconnect and be OK or may get reconnected but start mixing different years of data for display, or may just freeze and not continue and I have had to start over from the top.
I've copied the sites code onto a WordPad doc, but it is a lot of pages long.  If it would help, I can copy the display of several pages of my text data as displayed to show what the site has set up for display that may or may not need to be dealt with if wget can actually deal with this.
Thanks,
Pat

A: One option would be to use lynx as described in this answer to a similar question.
You may have to install lynx and you will have to enable the Universe repository:
sudo add-apt-repository universe
sudo apt update
sudo apt install lynx

and then run it with the dump option like this:
lynx -dump https://example.com

To save this text to a file, you can pipe the output to tee like this:
lynx -dump https://example.com | tee filename.txt

This should dump the entire text of the page. Although there may be some unrelated text, the text you desire should be included without all the fancy code.

Another option would be to:

*

*go to the web page in your web browser

*double click on any word in the text portion of the page

*press CTRL+a to select all of the text

*press CTRL+c to copy the text

*then paste the text into a text editor or a word document or wherever

One thing to make this option more easy would be to view the Google webcache "text only" version of the page.
From there, you can then use the method of copy and paste as described above.
To search for the Google webcache version of the page (if one exists) use the following URL syntax:
http://webcache.googleusercontent.com/search?q=cache:URL&strip=1&vwsrc=0

and replace "URL" with the actual URL of the page.
For example, to view the text only version of the example.com page, you would use the following URL:
http://webcache.googleusercontent.com/search?q=cache:https://example.com&strip=1&vwsrc=0


text:
Q: Reflection to execute code in Assembly.GetExecutingAssembly returns null According to .Net Framework Source Code, GetExecutingAssembly use following code to get assembly.
public static Assembly GetExecutingAssembly()
{
    StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
    return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
}

Use System.Reflection to call this method works.
Type.GetType("System.Reflection.Assembly")
    .GetMethods(BindingFlags.Public | BindingFlags.Static)
    .Where(f => f.Name.Contains("GetCallingAssembly"))
    .First().Invoke(null, null)

However, if I use reflection to call the code inside Assembly.GetExecutingAssembly, it always returns null.
Type.GetType("System.Reflection.RuntimeAssembly")
    .GetMethods(BindingFlags.NonPublic | BindingFlags.Static)
    .Where(f => f.Name.Contains("GetExecutingAssembly")).Skip(1)
    // the second overload takes one argument
    .First().Invoke(null, new object[]  {
        Type.GetType("System.Threading.StackCrawlMark")
        .GetEnumValues().GetValue(1) // System.Threading.StackCrawlMark.LookForMyCaller
    })

Is there any explanation why it returns null?


text:
Q: Looking for duplicate question via flag I was reviewing this question and I thought : "Why not check if it has any duplicates?" I know the flag "Duplicate" question has automatic search function in the popup, so I pressed flag just to use that search function.
Immediately the review audit was failed as you can see. But it was not at all my intention to flag that question whatsoever.
Are there other users (reviewers) that use the flag "duplicate" for searching duplicates and also got a failed review audit while just trying to do a good reviewing job?
Is there a quicker way to search for duplicate questions? (I don't think so)
I know there aren't real repercussions to failing a review audit, but it isn't really motivating to see your audit failing by a click (on the link flag) that doesn't mean anything yet. So maybe this has to change?
UPDATE:
The important thing here for this site is to reduce clutter by removing duplicates. In my opinion this is something that could be improved in the reviewing process. A possibility is to show a list of possible duplicates immediately when you start reviewing an item (like in the flag - duplicate popup).

A: I never use the flag dialog to look for duplicates.  As a search mechanism, it stinks, at least compared to the other search options (like a site-specific search via Google and even the Stack Exchange search).
There aren't any faster ways though, but there are certainly more accurate ones.


text:
Q: I get an Error: "Java.Net.SocketException" When i call the log in Api or the Register Api Using Web Api & Xamarin forms This is my Register Api:
public async Task RegisterAsync(string email, string password, string confirmPassword)
{
            var model = new RegisterBindingModel
            {
                Email = email,
                Password = password,
                ConfirmPassword = confirmPassword
            };

        try
        {

            var json = JsonConvert.SerializeObject(model);

            HttpContent content = new StringContent(json);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var client = new HttpClient();

            var response = await client.PostAsync("http://155.238.210.61:44382/api/Account/Register/", content);

            if (response.IsSuccessStatusCode)
            {
                return true;
            }

        }
        catch (SocketException ex)
        {
            Console.WriteLine("Oxception Occured" + ex);
        }
        return false;

    }

==================================================================================
My View Model:
public class RegisterViewModel
{
private readonly ApiServices _apiService = new ApiServices();
    public string Email { get; set; }
    public string Password { get; set; }
    public string ConfirmPassword { get; set; }
    public string Message { get; set; }

    public ICommand RegisterCommand
    {
        get
        {
            return new Command(async () =>
            {
                var isSuccess = await _apiService.RegisterAsync(Email, Password, ConfirmPassword);
                Settings.Email = Email;
                Settings.Password = Password;

                //ClearFields();

                if (isSuccess)

                    Message = "Registered Successfully";
                    else

                    Message = "Error Occured, Please try Again";

            });
        }
    }

}

}
=========================================
Helper Class:
public static class Settings
{
private static ISettings AppSettings
{
get
{
return CrossSettings.Current;
}
}
    public static string Email
    {
        get
        {
            return AppSettings.GetValueOrDefault("Email", "");
        }
        set
        {
            AppSettings.AddOrUpdateValue("Email", value);
        }
    }

    public static string Password
    {
        get
        {
            return AppSettings.GetValueOrDefault("Password", "");
        }
        set
        {
            AppSettings.AddOrUpdateValue("Password", value);
        }
    }

    public static DateTime AccessTokenExpirationDate
    {
        get
        {
            return AppSettings.GetValueOrDefault("AccessTokenExpirationDate", DateTime.UtcNow);
        }
        set
        {
            AppSettings.AddOrUpdateValue("AccessTokenExpirationDate", value);
        }
    }

    public static string AccessToken
    {
        get
        {
            return AppSettings.GetValueOrDefault("AccessToken", "");
        }
        set
        {
            AppSettings.AddOrUpdateValue("AccessToken", value);
        }
    }
}

=========================
The Web Api is Connected to an Sql Server DB


text:
Q: Intermediate value theorem for functions $f:\mathbb R \to \mathbb R^2 $ Let $f:[a,b]\subset \mathbb R\to\mathbb R^2$ be a continuous function on $[a,b]$, and differentiable on $(a,b)$, such that $f´(t)\neq 0 $ for all $t\in(a,b)$.
   Prove that there exists $\xi \in (a,b) $ and $\lambda\in\mathbb R$ such that:
$$f(b)-f(a)= \lambda f´(\xi)$$
What I have so far is that by applying the one dimensional case, i get that:
$$f(b)-f(a)=(b-a)(f_1´(\xi_1), f_2´(\xi_2))$$
For some $\xi_1,\ \xi_2 \in \mathbb R$. Thus one way to prove it would be by showing that $\xi_1=\xi_2$, and this is where I´ve no clue how to proceed.


text:
Q: Custom Re deployments from My Eclipse IDE Experts
When we redeploy any application from an IDE such as MYEclipse , it just redeploys the .class files. I want to customize the eclipse developer, so the deployer can also deploy the custom files (other than class files).
Should i write any custom ANT script for Myeclipse or any custom settings the My Eclipse provides us ?

A: IDEs along the classes and libraries usually deploy everything they find in the web / www-root folder (in the folder that contains the WEB-INF and META-INF).
So you can configure your deployed applications structure using the IDE by structuring the content of that folder.
If it still doesn't fit your needs, then ANT would be the best option.
In my opinion ANT is always the best option, but using the development environment's functionality is proven faster then writing an ant build file.
Say, if you're developing a web service, a web application consuming that service, and a library that both the service and the webapp uses, then with a single (and not even long or difficult) ant file you can build them, create the aar, war and jar files and deploy them all in their correct places, eg. under axis, inside the global lib folder, and in the webapps folder.
All these in one step.


text:
Q: Create cached image twice with javascript var image1 = new Image();
image1.src = someUrl;

// someUrl is a valid URL to a PHP file which outputs a PNG file using the imagepng function. This action caches image1 to someUrl.

image1.onload = function() {

    // Some things have changed and a new image is created, which I would like to cache to someUrl.
    // This is currently done by sending a session (temporary) cookie, which is recognised by the PHP file, so that it knows to take different action than the first time.
    // Again, the imagepng function is used to output the image.

    var image2 = new Image();
    image2.src = someUrl; // this is the exact same URL
};

The desired result is to have the browser cache the image2 as a replacement of the cached image1. Unfortunately, image1 is the one that is cached, even after the image2.src = someUrl; statement.
What does work, however, is to cache image1, then create the session cookie and manually go to the someUrl page. It then does cache image2.
Is it not possible to make a browser cache an image twice, without refreshing the page?

A: You can try adding arbitary params to the url.
For example :
var image1 = new Image();
image1.src = someUrl;

var image2 = new Image();
image2.src = someUrl + '?action=cache'; // or timestamp

This will trick the browser to treat image2 as a new image, while still loading the image
from the correct url (Assuming you aren't sending any other paramaters in GET, in that case use '&' instead of '?')

A: Try using cache control headers in your php file which outputs the png. E.g.
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

source: http://php.net/manual/en/function.header.php


text:
Q: How can i reindex a monthly pandas series to mins, having the values corresponding to the month in every day of the resulting days of thats months? i have a  pandas series of this form:
1950-01-31      2.0
1950-02-28      2.0
1950-03-31      1.0
1950-04-30      2.0
1950-05-31      0.0
1950-06-30      0.0

i would like to reindex passin from monthly to mins likes this:
1950-01-31 00:00:00     2.0
1950-01-31 00:01:00     2.0
1950-01-31 00:02:00     2.0
1950-02-28 00:03:00     2.0
.
.
.

1950-06-30 00:00.00     0.0
1950-06-30 00:01.00     0.0
1950-06-30 00:02.00     0.0
1950-06-30 00:03.00     0.0
.
.

i mean for example that the values corresponding to 1950-01-31 that is in this case is 2.0, it expands to every min of that month and successively
hi, thanks, i have a trouble, i need strictly that the value be in the month that belongs, for example if i use  s.resample('T').ffill()   i have this in my resultant serie:
2018-03-31 23:24:00    2.0
2018-03-31 23:25:00    2.0
2018-03-31 23:26:00    2.0
2018-03-31 23:27:00    2.0
                      ...
2018-04-01 23:31:00    2.0
2018-04-01 23:32:00    2.0
2018-04-01 23:33:00    2.0
2018-04-01 23:34:00    2.0

every min of 2018-04 of that month must be 0.0 instead i have 2.0 using s.resample('T').ffill(). resuming in need a serie pasing the monthly values to mins in the respective months since the firts min to last min of that month.  (Sorry for my english)

A: IIUC:
Setup
s = pd.Series([2, 2, 1, 2, 0, 0], pd.date_range('1950-01-31', periods=6, freq='M'))

Broadcasting and reindex
Looks as though you only capture the first 4 minutes.  So I created an array of timedeltas that range from 0 to 3 minutes.
d = np.arange(4).astype('timedelta64[m]')

s.reindex((s.index.values[:, None] + d).ravel(), method='ffill')

1950-01-31 00:00:00    2
1950-01-31 00:01:00    2
1950-01-31 00:02:00    2
1950-01-31 00:03:00    2
1950-02-28 00:00:00    2
1950-02-28 00:01:00    2
1950-02-28 00:02:00    2
1950-02-28 00:03:00    2
1950-03-31 00:00:00    1
1950-03-31 00:01:00    1
1950-03-31 00:02:00    1
1950-03-31 00:03:00    1
1950-04-30 00:00:00    2
1950-04-30 00:01:00    2
1950-04-30 00:02:00    2
1950-04-30 00:03:00    2
1950-05-31 00:00:00    0
1950-05-31 00:01:00    0
1950-05-31 00:02:00    0
1950-05-31 00:03:00    0
1950-06-30 00:00:00    0
1950-06-30 00:01:00    0
1950-06-30 00:02:00    0
1950-06-30 00:03:00    0
dtype: int64

To capture every minute, do as @Wen suggested
s.resample('T').ffill()


text:
Q: Wifi RSSI reading hi this is my first question because i'm new to android world programs
I want to take wifi rssi reading and disply it on list
I write the code below and when run it on my phone ,the program stop and say "sorry program is stop "
I dont know why???  could any one help me please ???

public class MainActivity extends ActionBarActivity {

    ListView list;
    WifiManager wifiManager;
    IntentFilter filter;
    String wifi [];
    WifiScanClass myClass;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        list=(ListView)findViewById(R.id.list1);
        wifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);
         myClass = new WifiScanClass();
                    registerReceiver(myClass,new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
                    wifiManager.startScan();
    }
    protected void onResume()
    {
        filter=new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
        registerReceiver(myClass,filter);
        super.onResume();
    }
    protected void onPause()
    {
        unregisterReceiver(myClass);
        super.onPause();
    }

    class WifiScanClass extends BroadcastReceiver {
        @SuppressLint("UseValueOf")
        public void onReceive(Context context, Intent intent) {
            List<ScanResult> listResult=wifiManager.getScanResults();
            wifi=new String[listResult.size()];
            int i;
            for (i=0;i<listResult.size();i++);
            wifi[i]=((listResult.get(i)).toString());
            list.setAdapter(new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,wifi));

        }
    }
}

A: Please add the Logcat output for the error.
A possible source of the problem could be that getApplicationContext() needs to be called on the supplied context. So try to replace getApplicationContext() with context.getApplicationContext().

A: public class MainActivity extends ActionBarActivity {

    ListView list;
    WifiManager wifiManager;
    IntentFilter filter;
    String wifi [];
    WifiScanClass myClass;

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

        list=(ListView)findViewById(R.id.list1);
        wifiManager=(WifiManager)getSystemService(Context.WIFI_SERVICE);
        myClass = new WifiScanClass();
        wifiManager.startScan();

    }

    protected void onResume()
    {
        filter=new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
        registerReceiver(myClass,filter);
        super.onResume();

    }

    protected void onPause()
    {

        unregisterReceiver(myClass);
        super.onPause();

    }

    class WifiScanClass extends BroadcastReceiver {

        @SuppressLint("UseValueOf")
        public void onReceive(Context context, Intent intent) {
            List<ScanResult> listResult=wifiManager.getScanResults();
            wifi=new String[listResult.size()];

            int i;
            for (i=0;i<listResult.size();i++)

                wifi[i]=((listResult.get(i)).toString());

            list.setAdapter(new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,wifi));

        }
    }
}

finally i found the error
";" in for loop .


text:
Q: MySQL Order By in Right Join Clause I'm trying to do a right join in MySQL like so:
SELECT customers.id,customers.firstname,customers.lastname,customers.email,orders.time,orders.notes,pendings.date_updated,pendings.issue,appointments.closed,appointments.job_description,backup_plans.expiration FROM customers
RIGHT JOIN orders
ON customers.id = orders.customer_id
ORDER BY orders.time DESC LIMIT 1
RIGHT JOIN pendings
ON customers.id = pendings.customer_id
ORDER BY pendings.date_updated DESC LIMIT 1
RIGHT JOIN appointments
ON customers.id = appointments.customer_id
ORDER BY appointments.closed DESC LIMIT 1
RIGHT JOIN backup_plans
ON customers.id = backup_plans.customer_id
ORDER BY backup_plans.expiration DESC LIMIT 1

My intent is this: to select customers' name and email, along with the most recent order, pending, appointment, and backup plan exploration. When I execute this I get a syntax error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RIGHT JOIN pendings
ON customers.id = pendings.customer_id
ORDER BY pendings.d' at line 5

I'm unfamiliar with joins and would appreciate any help.

EDIT 1:
It seems that I need to make a subquery per DanK's suggestion like so:
SELECT customers.id,customers.firstname,customers.lastname,customers.email,orderstmp.time,orderstmp.notes FROM customers
RIGHT JOIN (
    SELECT orders.time,orders.notes,orders.customer_id FROM orders ORDER BY orders.time DESC LIMIT 1
) as orderstmp ON orderstmp.customer_id = customers.id

But when I do this, I only get one row result, whereas I want all the customer information.

EDIT 2:
Per Tom H's suggestion, I've built this query:
SELECT
    customers.id,
    SQ_O.time,
    SQ_O.notes
FROM customers
LEFT JOIN (
    SELECT
        customers.id,
        orders.time,
        orders.notes
    FROM customers
    LEFT JOIN orders ON orders.customer_id = customers.id
    ORDER BY orders.time DESC LIMIT 1
) AS SQ_O ON SQ_O.id = customers.id

which has all blank time and notes fields
and
SELECT
    customers.id,
    O1.time,
    O1.notes
FROM customers
LEFT JOIN orders AS O1 ON O1.customer_id = O1.id
LEFT JOIN orders AS O2 ON O2.customer_id = customers.id AND O2.time > O1.time WHERE O2.customer_id IS NULL

Which reaches max execution time. I'm guessing this is due to my lack of familiarity with what's possible in MySQL in comparison to other dialects.
I also tried Correlated subqueries like this:
SELECT
    customers.firstname,
    customers.lastname,
    customers.email,
    (
        SELECT CONCAT(orders.time,': ',orders.notes)
        FROM orders
        WHERE orders.customer_id = customers.id
        ORDER BY orders.time DESC LIMIT 1
    ) as last_order
FROM customers

But the "last_order" column comes up blank.

FINAL, DISAPPOINTING EDIT
After trying a number of really stellar suggestions that helped me learn SQL significantly, I decided to write a PHP script to get me what I want. The project's under a bit of a deadline so whatever works, works. Thanks everyone!

A: You can only have one ORDER BY statement per query. You can of course use subqueries and refer to a result set as a virtual table but ultimately in a single SELECT you can only have one ORDER BY.
For instance:
SELECT something
FROM table
ORDER BY something -- One order By

With a subquery as a virtual table:
SELECT something
FROM (SELECT anotherthing, something
      FROM table
      ORDER BY anotherthing) -- this is an order by in a separate select statement..
ORDER BY something -- still only one Order by

------EDIT--------
For assistance with your join syntax, try something like this:
SELECT --fields,
FROM customers
RIGHT JOIN orders ON customers.id = orders.customer_id
RIGHT JOIN pendings ON customers.id = pendings.customer_id
RIGHT JOIN appointments ON customers.id = appointments.customer_id
RIGHT JOIN backup_plans ON customers.id = backup_plans.customer_id
ORDER BY orders.time DESC, pendings.date_updated DESC, appointments.closed DESC, backup_plans.expiration DESC
LIMIT 1

A: Try this:
SELECT customers.id,customers.firstname,customers.lastname,customers.email,orders.time,orders.notes,pendings.date_updated,pendings.issue,appointments.closed,appointments.job_description,backup_plans.expiration FROM customers
RIGHT JOIN orders
ON customers.id = orders.customer_id
RIGHT JOIN pendings
ON customers.id = pendings.customer_id
RIGHT JOIN appointments
ON customers.id = appointments.customer_id
RIGHT JOIN backup_plans
ON customers.id = backup_plans.customer_id
ORDER BY orders.time DESC, pendings.date_updated DESC,  appointments.closed DESC,  backup_plans.expiration DESC LIMIT 1

A: You can accomplish this through subqueries or with additional JOINs. Here's an example of each. (NOTE: I use SQL Server, so it's possible that some of the syntax that I'm used to isn't supported in the same way in MySQL). I'm only doing these example with the Orders, but hopefully you can extend the ideas to the other tables.
Using subqueries:
SELECT
    C.id,
    SQ_O.time,
    SQ_O.notes
FROM
    Customers C
LEFT OUTER JOIN
(
    SELECT
        C2.Customer_ID,
        O.time,
        O.notes
    FROM
        Customers C2
    LEFT OUTER JOIN Orders O ON O.customer_id = C2.id
    ORDER BY
        O.time DESC LIMIT 1
) SQ_O ON SQ_O.customer_id = C.id

Using multiple JOINs:
SELECT
    C.id,
    O1.time,
    O1.notes
FROM
    Customers C
LEFT OUTER JOIN Orders O1 ON O1.customer_id = C.id
LEFT OUTER JOIN Orders O2 ON O2.customer_id = C.id AND O2.time > O1.time
WHERE
    O2.customer_id IS NULL -- Basically we're excluding any rows where another order was found with a later time than O1

If exact matches in Orders.time are possible than you'll need additional criteria on which one to choose.

A: As long as you can rely on no customer having their two most recent orders having the same time, this should work:
SELECT c.firstname, c.lastname, c.email, o.*
FROM customers AS c
LEFT JOIN (
   SELECT customer_id, MAX(`time`) AS maxTime
   FROM orders
   GROUP BY customer_id
) AS lastO ON c.id = lastO.customer_id
LEFT JOIN orders AS o
   ON lastO.customer_id = o.customer_id
   AND lastO.maxTime = o.`time`
;

As long as the other tables can also be relied upon to have only one MAX value per customer, you should be able to append similar JOINs for them. The issue with multiple of the same "last" time\date_updated\closed\etc.. for a customer is that they will multiply results. For example, pairs of the same time in orders and pairs of date_updated in pending on the same customer will result in 4 rows instead of two as every "last" row for that customer in orders is paired up with every "last" row in pending.