text:
Q: Excircle and incircle proof
Prove that if the incircle of triangle $ABC$ touches side $BC$ at $D$ and the $A$-excircle touches side $BC$ at $D'$, then the midpoint of $BC$ is the midpoint of $DD'$.

This is an interesting property that I discovered when doing a few problems but the solutions didn't prove it. After drawing several triangles and their in- and excircles, it seems to be true that the midpoint of the intouch and and extouch points is in fact the midpoint of the side of the triangle.
As another question, if anyone can prove that the antipode of the intouch $D$ which I have labeled as $U$ in the triangle below is collinear with the exsimilicenter $A$ and $D'$ that would help. Finally, is it also true that $A,U,D',$ and $I_a$ are collinear or just $A,U,$ and $D'$?

Note: $I_a$ is the center of the $A$-exircle.

A: I will answer the first question.
This is easy to prove using just one basic idea: when a circle is tangent to two sides of an angle, the distance from the vertex to each of the points of tangency is the same.
Applying that idea to the incircle, you'll find after some calculations that $BD = \frac{1}{2}(a + c - b)$. Applying it to the excircle opposite vertex $A$, you'll find $CD' = \frac{1}{2}(a + c - b) = BD$.
For the second question, the dilation $h$ with centre $A$ taking $I$ to $I_a$ transforms the incircle into the excircle. It also transforms line $ID$ into a parallel line passing through $I_a$. Since $ID$ and $I_aD'$ are both perpendicular to $BC$, the image of line $ID$ must be line $I_a D'$. Points $U$ and $D$ are the intersections of the incircle with $ID$. They must be carried by $h$ to the intersections of the excircle with $I_a D'$. Since $h$ has positive ratio, $U$ must be carried to $D'$. This proves that $A, U, D'$ are aligned.
Assume $I_a$ is on line $AD'$. Then since $I_a D'$ and $UD$ are both perpendicular to $BC$ and pass through $U$, we must have $D = D'$. This shows that $AI$ is is perpendicular to $BC$, hence that $ABC$ is isosceles.

A:
Finally, is it also true that A, U, D', and Ia are collinear, or just A, U, and D' ?

Ia is not collinear with the other three, unless the triangle is isosceles. As an aside, the points A, D, and U' are also collinear, where U' is the antipode of D' with regard to Ia. Also, $DU\parallel D'U'.$


text:
Q: AttributeError: 'SimpleImputer' object has no attribute '_validate_data' in PyCaret I am using PyCaret and get an error.
AttributeError: 'SimpleImputer' object has no attribute '_validate_data'

Trying to create a basic instance.
# Create a basic PyCaret instance
import pycaret
from pycaret.regression import *
mlb_pycaret = setup(data = pycaret_df, target = 'pts', train_size = 0.8, numeric_features = ['home',
'first_time_pitcher'], session_id = 123)

All my variables are numeric (I coerced two of them, which are boolean). My target variable is label and this is by default.
I also installed PyCaret, imported its regression, and re-installed scikit learn, imported SimpleImputer as from sklearn.impute import SimpleImputer
OBP_avg Numeric
SLG_avg Numeric
SB_avg  Numeric
RBI_avg Numeric
R_avg   Numeric
home    Numeric
first_time_pitcher  Numeric
park_ratio_OBP  Numeric
park_ratio_SLG  Numeric
SO_avg_p    Numeric
pts_500_parkadj_p   Numeric
pts_500_parkadj Numeric
SLG_avg_parkadj Numeric
OPS_avg_parkadj Numeric
SLG_avg_parkadj_p   Numeric
OPS_avg_parkadj_p   Numeric
pts_BxP Numeric
SLG_BxP Numeric
OPS_BxP Numeric
whip_SO_BxP Numeric
whip_SO_B   Numeric
whip_SO_B_parkadj   Numeric
order   Numeric
ops x pts_500 order15   Numeric
ops x pts_500 parkadj   Numeric
ops23 x pts_500 Numeric
ops x pts_500 orderadj  Numeric
whip_p  Numeric
whip_SO_p   Numeric
whip_SO_parkadj_p   Numeric
whip_parkadj_p  Numeric
pts Label

My traceback is the following:

A: The problem here is with the imputation. The default per pycaret documentation is 'simple' but in this case, you need to make that imputation_type='iterative' for it to work.

A: It's incompatibility of library, install pycaret again with: pip install pycaret pandas shap

A: Good day all. What helped me is installing pycaret=='2.3.10 ' and scikit-learn='0.23.2' at the same time. These two version are compatible and all works fine. I installed scikit-learn using conda as the older versions are not available through pip, and I installed Pycaret using pip3. I hope this helps all who have struggled to get this working like I did.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Modern Books on Group Theory in German or French Except the book of Huppert's Group Theory I (which I have read partly), I am happy to see if there are modern books on group theory in German or French which include (one or many of) the topics on
matrix groups, classical groups, Mathieu groups, simple groups, Coxeter groups, groups of Lie type
and which include some recent developments in finite group theory.
Can one suggest for books?

Modern= published after Huppert's book (so after 1967/1970).
Recent development: some new theorems on structures of finite groups proved after say 1970.


text:
Q: getting empty square bracket on scrapy shell I am getting empty square bracket for this xpath  response.xpath( "//div[@class='c16H9d']").extract()
here is url https://www.daraz.com.bd/audio/?spm=a2a0e.home.cate_2.2.49c74591NNpWDU
my xpath is not wrong then why I am getting this empty square bracket?
>>>scrapy shell "https://www.daraz.com.bd/audio/?spm=a2a0e.home.cate_2.2.49c74591NNpWDU"
>>>response.xpath( "//div[@class='c16H9d']").extract()
>>>[]

A: I see your using scrapy shell and yes indeed that class does exist as the first item. However, if you look at the full HTML you will see this tag
<script type="application/ld+json">

This appears to contain the JSON that is used to populate the front end of the page. So you could do something like this and then import the json and use json loads to load it into a python object.
response.css('script::text').extract()[-1]

The last script elements text contains all the json for the product list of the page.
import json
data = json.loads(response.css('script::text').extract()[-1])
item_list = data['itemListElement']
for each in item_list:
    print(each['name'], each['price'])


text:
Q: Three js physical light go beyond wall I'm new to Three js. Trying to implement physical lighting and I tried this example. threejs_physical_light
My problem is, why light go beyond the brick wall? and how can I prevent that? (I have changed wall size in that example)
image

A: It looks like the second wall doesn't accept shadows... could you please show the code? Most importantly, how are lights and walls created.

A: First of all, "physical lights" in the three.js example you referenced refers to physically-based light intensity units and physically-based light attenuation. It has noting to do with the artifacts you are seeing.
The artifacts are present because the near plane of the frustum for the light's shadow camera is set at its default value of 0.5.
By default in three.js, shadows are cast by back-faces of objects. So once the light's position is closer than 0.5 units from the back-faces of the shadow-casting wall, you will see the artifacts you refer to.
three.js r.86


text:
Q: drone.io Not using .drone.yml file of GitHub repo I have a problem with the CI tool drone. At the Moment I'm using drone.io and with the selft-hosted version I have the same issue. When I try to build my golang test application drone.io always ignores my .drone.yml file.
The GitHub repo is: https://github.com/norbell/dronetest
My .drone.yml file looks like this:
pipeline:
  build:
    image: golang:1.6
    commands:
      - go get
      - go build

And the settings page of my drone.io project looks like this:

And when I click the build button it shows me that the project was successfully "build":

Obviously does everything but not building my project. I have done everything I found in the documentation but I can't get it working.
When I put go get and go build or go run main.go into the "commands" textarea field of the settings page, drone is suddenly able to build my go application.
I'm not sure what I'm doing wrong, so it would be very nice if someone could help me. :)

A: https://drone.io/ - doesn't support .drone.yml file, this file supported by https://github.com/drone/drone

A: If you want to use a .drone.yml you are forced to host drone on your own.


text:
Q: Asynchronous zle (zsh line editor) I've modified my zsh to always guess/autosuggest what I'm trying to type by modifying self-insert to run a guess function that interprets and modifies $BUFFER after running the default zle .self-insert.
The problem is this guess function may take a while to execute, which means pasting a line of input takes some time (as the characters come one after another with maybe up to 1 second delay between each one), and on a slow machine the lag would be quite noticeable even when I'm typing the command.
What I'd like it to do is to terminate this guess function as soon as another key is typed by the user, as the original guess based on the previous $BUFFER is no longer relevant anyway. This way the keyboard input will not be blocked by the guess function, and the guess function will update the $BUFFER only when it manages to complete before another key is entered.
Any suggestion on how to do this would be very helpful.Thank you.


text:
Q: Obtaining user's email using Apple's IdentityToken On my mobile app I use apple-id authorization. My implementation uses ASAuthorizationAppleIdProvider class and does not require additional proxy web-application, that sends request to Apple. All interaction is done on the mobile client.
All things work ok, and I get authorized and I get IdentityToken from Apple.
Now, I want to send this IdentityToken (looks like "AjzN91mNajN3401jazOs001m3ks") to the server. And on the server side I want to extract user's email from this token.
For Google to solve the same task I have to send GET request with token, like that
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=google_token
and if token is valid in response I get JSON with user's email inside.
How can I do the same for the Apple using Apple's identity key?

Update #1:
My project has 2 parts, client part (frontend) and server part (backend).
The functionality to obtain IdentityToken looks like that (AuthManager is just a delegate):
var provider = new ASAuthorizationAppleIdProvider();
var req = provider.CreateRequest();

authManager = new AuthManager(UIApplication.SharedApplication.KeyWindow);

req.RequestedScopes = new[] {
  ASAuthorizationScope.FullName,
  ASAuthorizationScope.Email
};
var controller = new ASAuthorizationController(new[] {
  req
}) {
  Delegate = authManager,
  PresentationContextProvider = authManager
};

controller.PerformRequests();

ASAuthorizationAppleIdCredential credentials = await authManager.Credentials;

When I get credentials, there is credentials.IdentityToken property available.
Now, I want to send this identity token to the server, to let the server check this token and obtain user's email using this token from the Apple server, like I do for Google (described above).
And I do not understand, how can I do that.
What Apple endpoint and what HTTP request (GET, POST) should be used to achieve this task?

A: In OpenID Connect, the Identity Token is never sent to the Provider. I think this is just a typo/naming issue and you mean the Access Token.
The end result of the user authenticating is two tokens:

*

*the Access Token, an opaque token which is not meant to be introspected by the Client. It may or may not be a JWT.

*an ID Token, a JWT which contains the user claims.

To obtain the user's email address, decode the ID/Identity Token's JWT payload. To do this in Swift, see these SO answers. The JWT should contain an email value. It looks like the email address may also be an instance property of ASAuthorizationAppleIdProvider, so you should be able to get them from credentials.email.
There does not appear to be a way to directly validate the Access Token. Most OpenID Connect Providers offer a Userinfo Endpoint, or a Token Instrospection Endpoint (I think this is the Google endpoint that was linked in question), but Apple does not. A number of steps were already performed to obtain the Access Token, however, which should make it impossible to forge. If you really only want the email address, though, JWTs are cryptographically signed, so verifying the JWT should guarantee it was issued by Apple. You can also verify the Refresh Token as shown in Apple Developer docs. In your code above, I don't see a way to access Refresh Token, but if you followed an alternative flow as shown in one of the tutorials here or here, you would be able to.


text:
Q: Neo4J with APOC and MongoDB Driver, limiting returned records from Mongo Limiting the number of returned records in MongoDB is as simple as
db.collection.find().limit(n).
However I'd like to issue the equivalent query from Neo4J.
Given that a find query is issued from Neo4J as follows...
apoc.mongodb.find(host, db, collection, query, project, sort)
I find it difficult to see how one should tell the MongoDB instance to limit the returned results before streaming to Neo4J.
I am aware of Cypher's LIMIT clause, however, this feels like bad practice, considering the amount of redundant data that will be streamed from Mongo.
Is there yet a way of adding a limit to the query results pre-stream?

A: At the moment this is not available out of the box. But you can add this functionality.
In the APOC source code make the following changes:
neo4j-apoc-procedures/src/main/java/apoc/mongodb/MongoDB.java:

@Procedure
@Description("apoc.mongodb.find(host-or-port,db-or-null,collection-or-null,query-or-null,projection-or-null,sort-or-null,[compatibleValues=true|false]) yield value - perform a find,project,sort operation on mongodb collection")
public Stream<MapResult> find(@Name("host") String hostOrKey, @Name("db") String db, @Name("collection") String collection, @Name("query") Map<String, Object> query, @Name("project") Map<String, Object> project, @Name("sort") Map<String, Object> sort, @Name(value = "compatibleValues", defaultValue = "false") boolean compatibleValues) {
    return getMongoColl(hostOrKey, db, collection, compatibleValues).find(query, project, sort).map(MapResult::new);
}

interface Coll extends Closeable {

...

    Stream<Map<String, Object>> find(Map<String, Object> query, Map<String, Object> project, Map<String, Object> sort, Map<String, Object> pagination);

neo4j-apoc-procedures/src/main/java/apoc/mongodb/MongoDBColl.java:

@Override
public Stream<Map<String, Object>> find(Map<String, Object> query, Map<String, Object> project, Map<String, Object> sort, Map<String, Object> pagination) {
    FindIterable<Document> documents = query == null ? collection.find() : collection.find(new Document(query));
    if (project != null) documents = documents.projection(new Document(project));
    if (sort != null) documents = documents.sort(new Document(sort));
    if (pagination != null) {
        Object skip = pagination.get("skip");
        Object limit = pagination.get("limit");
        if (skip != null) documents = documents.skip(Integer.parseInt(String.valueOf(skip)));
        if (limit != null) documents = documents.limit(Integer.parseInt(String.valueOf(limit)));
    }
    return asStream(documents);
}


text:
Q:  show as not correct size my <fb:request-form> show incorrect size (width).
here is my code:
<fb:serverFbml style="width:600px;">
    <script type="text/fbml">
      <fb:fbml>
          <fb:request-form
                    action="<?= BASE_URL; ?>/pages/eid/inc/_send_card.php?ctid=<?= $card_type_id; ?>"
                    target="_top"
                    method="POST"
                    invite="true"
                    type="Muslimsquare Gift Card"
                    content="<?= $name; ?> ได้ส่งของขวัญเนื่องในวันอีดิ้ลฟิตรี่ให้กับคุณ โดยหวังว่าคุณจะตอบรับของขวัญของเขา คลิกปุ่ม Accept เพื่อตอบรับของขวัญจาก <?= $name; ?> และส่งของขวัญให้คนอื่นๆต่อไป <fb:req-choice url='http://www.muslimsquare.com/applications/pages/eid/acp_gift.php?uid=<?= $uid; ?>' label='Accept' />"
                    <fb:multi-friend-selector
                    showborder="false"
                    actiontext="เลือกเพื่อนที่คุณต้องการส่งของขวัญให้">
        </fb:request-form>
      </fb:fbml>
    </script>
    </fb:serverFbml>

But when it show in iframe application. it is about width:964px; and my iframe application display some stupid scrollbar like :

How can I fix this issue?

A: You need to use <fb:serverFbml width= "755"> NOT the style="width: 755px" attribute.
See my blog post about this.


text:
Q: PHP site freeze/crash but static contents fine I have a PHP site where users upload a lot of photos. The photos are cropped in the front end and sent as base64 in a POST form. The max size is around 80kB.
JavaScript:
document.getElementById('image').src = dataurl;   To display croped image on the browser
document.getElementById('inddeninput').value = dataurl; To set hidden input value

Then ajax call to submit to PHP
axios({
  method: 'post',
  url: `url/to/php/file`,
  data: formData,
  headers: {'Content-Type': 'multipart/form-data' }
  })

The PHP script:
$img = $_POST['img'];

$dataImg = base64_decode($img);

file_put_contents($fileLocation, $dataImg);

Then insert/update the MySQL(Mariadb) table with the location of the image.
$response = location of the image;
echo json_encode($response);

Hosting:
It's hosted on a VPS with 4CPU and 8GB. PHP 7.4 and Apache 2.4 running mpm_event.
The Issue
Everything's fine when there are fewer users.
When there are a lot of concurrent users (approximately 400), the entire site is very slow and takes 30 seconds or more to respond. However, there are no Apache error logs, no site error logs, nothing, and if I restart Apache its fine for a few minutes.
If I try to load a static file like an image from the site(mydomain.com/public/images/img.1.jpg) it is very fast and takes less than a second.
What things can I try to solve this?
Edit
After a lot of digging around I found the issue in the /var/log/php7.4-fpm.log
[pool www] server reached pm.max_children setting (96), consider
raising it

It was the php_fpm module child connections. I had the following settings before:
pm.max_children = 96
pm.start_servers = 48
pm.min_spare_servers = 32
pm.max_spare_servers = 64

A lot of my users are on slow connections, and I guess subsequent requests went on queue. I have increased the values and the situation has improved.


text:
Q: Default Values don't work with Positional and Optional arguments present My code (train.py):
parser = argparse.ArgumentParser()

    parser.add_argument('data_dir')
    parser.add_argument('--save_dir', type = str, default = 'save_directory', help = 'Save checkpoint directory')
    parser.add_argument('--arch', type = str, default = 'VGG', help = 'Select architecture. Choose VGG or AlexNet')
    parser.add_argument('--learning_rate', type = float, default = '0.001', help = 'Select the model learning rate')
    parser.add_argument('--hidden_units', type = int, default = '1024', help = 'Select the model hidden units')
    parser.add_argument('--epochs', type = int, default = '2', help = 'Select the number of epochs')
    parser.add_argument('--gpu', type = str, default = 'gpu', help = 'Select the device type. CPU or GPU.')

    return parser.parse_args()

When I try to run

python train.py data_dir --arch

I get

train.py: error: argument --arch: expected one argument

Why do my default values not work?

A: There are three ways you can pass the '--arch' argument:

*

*Not at all, which will use the value from default.

*With '--arch' alone, which will use the value from const. Since const was originally not specified, this case defaulted to None, making it the same as the first case.

*With '--arch <value>', which will use <value>.

Therefore, you need to specify that the flag takes a further optional argument with nargs='?', and the value of const:
parser.add_argument('--arch',
                    nargs='?',
                    type=str,
                    const='VGG',
                    default='VGG',
                    help='Select architecture. Choose VGG or AlexNet')

You may also wish to note that you can pass choices=['VGG', 'AlexNet'] to constrain the available choices (an error will be raised if the argument is not in choices).

A: Default values are substituted when the corresponding argument is not present.
You have defined --arch as "an optional argument which takes string values, and if not present it should be VGG"
If you pass --arch it should have a string value. If you don't pass --arch it will be VGG.
You have tried something in-between. That's an error case.


text:
Q: What are the Server Sent Request (SSE) Good practices with database? I just discovered Server Sent Request and I find it very useful. I have tested with php server side.
In the php case with the while(1) to keep the connection opened, I ask me, and now, I ask the question of performance if I use database connection.
For example, if I want to create a notification system based on server sent event for a user. Inside the while(1) there are a request to check if the user has notifications. If yes, I write data: ... else the looping continue to while(1). And again and again to check in the database...
I think the risk is to have: "too many connections" on the database.
What are the good practices in this case ?
Thank you to advice me


text:
Q: I'm using MongoSkin in my Node.js application and after a period of inactivity it loses connectivity with the database I'm building my first Node.js application and I've run into an issue with MongoDB. I'm using the MongoSkin driver.
Once I start my application it all works great. I can sit and toy with it for an hour and it will continue to work. However, if I let it sit for a few minutes without any activity then the next request will result in an error:

Error: connection closed
      at Server.connect.connectionPool.on.server._serverState (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\server.js:520:35)
      at EventEmitter.emit (events.js:126:20)
      at connection.on._self._poolState (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:109:15)
      at EventEmitter.emit (events.js:99:17)
      at Socket.closeHandler (X:\Code\CodeTunnel\node_modules\mongoskin\node_modules\mongodb\lib\mongodb\connection\connection.js:427:12)
      at Socket.EventEmitter.emit (events.js:96:17)
      at Socket._destroy.destroyed (net.js:358:10)
      at process.startup.processNextTick.process._tickCallback (node.js:244:9)

I've tried adding auto_reconnect=true to the connection string as is suggested on the mongoskin documentation but that didn't help.

A: I eventually figured this one out. The solution is rather simple.
USE MONGOOSE
...or something else.
I've had nothing but problems with MongoSkin and after finally taking the time to learn Mongoose I prefer it anyway. The model paradigm is wonderful, especially since each model has its own persistence methods for saving changes to the document. The use of promises to create a fluent query API is so powerful and sooo much easier to read than the standard callback hell provided by the native MongoDB driver. Callback hell is only slightly mitigated by MongoSkin and it's still very hard to read the more complicated queries.
Edit: Downvote.....really? What thoughts were going through your head Mr. downvote? "Mongoose isn't my preferred ORM so here's a downvote."?


text:
Q: php merge 'subsets' of array in loop I'm struggling merging subsets of an array in a loop.
I have a big array that can contain any amount of $data records (depending on the API results)
When I try to merge just 2 'products' subsets this works just fine:
$merged=array_merge($data[0][products], $data[1][products]);

But since I don't know in advance how many $data records I will end up with I decided to do it in a loop, something like this:
foreach ($data as $products) {
$merged=array_merge($merged,$products[products]);
}

This doesn't work, I've been playing around with this for a couple of hours, but haven't been able to get it to work.

A: Try adding this above the foreach:
$merged = array();
Also I reckon $data[0][products] needs to be $data[0]['products'].

A: This is an ideal situation to use call_user_func_array in combination with array_column:
$merged = call_user_func_array('array_merge', array_column($data, 'products'));


text:
Q: got 3 arguments but expected 2 lui a1, %hi(.LJTI0_0) I am converting the dhrystone benchmark to test its performance on a riscv compiled version. I have generated the assembly code and now intend to convert it into a hexcode format using the venus-simulator.
But when i run the code on the simulator i get multiple warnings regarding the same few lines. it seems that i am passing extra arguments in the 'lui', 'addi' and a few other instructions. I cant seem to make any sense of it.
Your help is greatly appreciated.
Here is the code
Proc_6:                                 # @Proc_6
        addi    sp, sp, -32
        sw      ra, 28(sp)                      # 4-byte Folded Spill
        sw      s0, 24(sp)                      # 4-byte Folded Spill
        addi    s0, sp, 32
        sw      a0, -16(s0)
        sw      a1, -20(s0)
        lw      a0, -16(s0)
        lw      a1, -20(s0)
        sw      a0, 0(a1)
        lw      a0, -16(s0)
        call    Func_3
        li      a1, 0
        bne     a0, a1, .LBB0_2
        j       .LBB0_1
.LBB0_1:
        lw      a1, -20(s0)
        li      a0, 3
        sw      a0, 0(a1)
        j       .LBB0_2
.LBB0_2:
        lw      a1, -16(s0)
        sw      a1, -24(s0)                     # 4-byte Folded Spill
        li      a0, 4
        bltu    a0, a1, .LBB0_12
        lw      a0, -24(s0)                     # 4-byte Folded Reload
        slli    a0, a0, 2
        lui     a1, %hi(.LJTI0_0)
        addi    a1, a1, %lo(.LJTI0_0)
        add     a0, a0, a1
        lw      a0, 0(a0)
        jr      a0
.LBB0_4:
        lw      a1, -20(s0)
        li      a0, 0
        sw      a0, 0(a1)
        j       .LBB0_12
.LBB0_5:
        lui     a0, %hi(Int_Glob)
        lw      a0, %lo(Int_Glob)(a0)
        li      a1, 101
        blt     a0, a1, .LBB0_7
        j       .LBB0_6
.LBB0_6:
        lw      a1, -20(s0)
        li      a0, 0
        sw      a0, 0(a1)
        j       .LBB0_8
.LBB0_7:
        lw      a1, -20(s0)
        li      a0, 3
        sw      a0, 0(a1)
        j       .LBB0_8
.LBB0_8:
        j       .LBB0_12
.LBB0_9:
        lw      a1, -20(s0)
        li      a0, 1
        sw      a0, 0(a1)
        j       .LBB0_12
.LBB0_10:
        j       .LBB0_12
.LBB0_11:
        lw      a1, -20(s0)
        li      a0, 2
        sw      a0, 0(a1)
        j       .LBB0_12
.LBB0_12:
        lw      a0, -12(s0)
        lw      ra, 28(sp)                      # 4-byte Folded Reload
        lw      s0, 24(sp)                      # 4-byte Folded Reload
        addi    sp, sp, 32
        ret
.LJTI0_0:
        .word   .LBB0_4
        .word   .LBB0_5
        .word   .LBB0_9
        .word   .LBB0_10
        .word   .LBB0_11
Proc_7:                                 # @Proc_7
        addi    sp, sp, -32
        sw      ra, 28(sp)                      # 4-byte Folded Spill
        sw      s0, 24(sp)                      # 4-byte Folded Spill
        addi    s0, sp, 32
        sw      a0, -16(s0)
        sw      a1, -20(s0)
        sw      a2, -24(s0)
        lw      a0, -16(s0)
        addi    a0, a0, 2
        sw      a0, -28(s0)
        lw      a0, -20(s0)
        lw      a1, -28(s0)
        add     a0, a0, a1
        lw      a1, -24(s0)
        sw      a0, 0(a1)
        lw      a0, -12(s0)
        lw      ra, 28(sp)                      # 4-byte Folded Reload
        lw      s0, 24(sp)                      # 4-byte Folded Reload
        addi    sp, sp, 32
        ret
Proc_8:                                 # @Proc_8
        addi    sp, sp, -48
        sw      ra, 44(sp)                      # 4-byte Folded Spill
        sw      s0, 40(sp)                      # 4-byte Folded Spill
        addi    s0, sp, 48
        sw      a0, -16(s0)
        sw      a1, -20(s0)
        sw      a2, -24(s0)
        sw      a3, -28(s0)
        lw      a0, -24(s0)
        addi    a0, a0, 5
        sw      a0, -36(s0)
        lw      a0, -28(s0)
        lw      a1, -16(s0)
        lw      a2, -36(s0)
        slli    a2, a2, 2
        add     a1, a1, a2
        sw      a0, 0(a1)
        lw      a0, -16(s0)
        lw      a1, -36(s0)
        slli    a1, a1, 2
        add     a1, a1, a0
        lw      a0, 0(a1)
        sw      a0, 4(a1)
        lw      a0, -36(s0)
        lw      a2, -16(s0)
        slli    a1, a0, 2
        add     a1, a1, a2
        sw      a0, 120(a1)
        lw      a0, -36(s0)
        sw      a0, -32(s0)
        j       .LBB2_1
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
        lw      a1, -32(s0)
        lw      a0, -36(s0)
        addi    a0, a0, 1
        blt     a0, a1, .LBB2_4
        j       .LBB2_2
.LBB2_2:                                #   in Loop: Header=BB2_1 Depth=1
        lw      a0, -36(s0)
        lw      a1, -20(s0)
        li      a2, 200
        mul     a2, a0, a2
        add     a1, a1, a2
        lw      a2, -32(s0)
        slli    a2, a2, 2
        add     a1, a1, a2
        sw      a0, 0(a1)
        j       .LBB2_3
.LBB2_3:                                #   in Loop: Header=BB2_1 Depth=1
        lw      a0, -32(s0)
        addi    a0, a0, 1
        sw      a0, -32(s0)
        j       .LBB2_1
.LBB2_4:
        lw      a1, -20(s0)
        lw      a0, -36(s0)
        li      a4, 200
        mul     a2, a0, a4
        add     a1, a1, a2
        slli    a0, a0, 2
        add     a1, a1, a0
        lw      a0, -4(a1)
        addi    a0, a0, 1
        sw      a0, -4(a1)
        lw      a0, -16(s0)
        lw      a3, -36(s0)
        slli    a2, a3, 2
        add     a0, a0, a2
        lw      a0, 0(a0)
        lw      a1, -20(s0)
        addi    a3, a3, 20
        mul     a3, a3, a4
        add     a1, a1, a3
        add     a1, a1, a2
        sw      a0, 0(a1)
        lui     a1, %hi(Int_Glob)
        li      a0, 5
        sw      a0, %lo(Int_Glob)(a1)
        lw      a0, -12(s0)
        lw      ra, 44(sp)                      # 4-byte Folded Reload
        lw      s0, 40(sp)                      # 4-byte Folded Reload
        addi    sp, sp, 48
        ret
Func_1:                                 # @Func_1
        addi    sp, sp, -16
        sw      ra, 12(sp)                      # 4-byte Folded Spill
        sw      s0, 8(sp)                       # 4-byte Folded Spill
        addi    s0, sp, 16
        sb      a0, -13(s0)
        sb      a1, -14(s0)
        lb      a0, -13(s0)
        sb      a0, -15(s0)
        lb      a0, -15(s0)
        sb      a0, -16(s0)
        lbu     a0, -16(s0)
        lbu     a1, -14(s0)
        beq     a0, a1, .LBB3_2
        j       .LBB3_1
.LBB3_1:
        li      a0, 0
        sw      a0, -12(s0)
        j       .LBB3_3
.LBB3_2:
        lb      a0, -15(s0)
        lui     a1, %hi(Ch_1_Glob)
        sb      a0, %lo(Ch_1_Glob)(a1)
        li      a0, 1
        sw      a0, -12(s0)
        j       .LBB3_3
.LBB3_3:
        lw      a0, -12(s0)
        lw      ra, 12(sp)                      # 4-byte Folded Reload
        lw      s0, 8(sp)                       # 4-byte Folded Reload
        addi    sp, sp, 16
        ret
Func_2:                                 # @Func_2
        addi    sp, sp, -32
        sw      ra, 28(sp)                      # 4-byte Folded Spill
        sw      s0, 24(sp)                      # 4-byte Folded Spill
        addi    s0, sp, 32
        sw      a0, -16(s0)
        sw      a1, -20(s0)
        li      a0, 2
        sw      a0, -24(s0)
        j       .LBB4_1
.LBB4_1:                                # =>This Inner Loop Header: Depth=1
        lw      a1, -24(s0)
        li      a0, 2
        blt     a0, a1, .LBB4_5
        j       .LBB4_2
.LBB4_2:                                #   in Loop: Header=BB4_1 Depth=1
        lw      a0, -16(s0)
        lw      a1, -24(s0)
        add     a0, a0, a1
        lbu     a0, 0(a0)
        lw      a2, -20(s0)
        add     a1, a1, a2
        lbu     a1, 1(a1)
        call    Func_1
        li      a1, 0
        bne     a0, a1, .LBB4_4
        j       .LBB4_3
.LBB4_3:                                #   in Loop: Header=BB4_1 Depth=1
        li      a0, 65
        sb      a0, -25(s0)
        lw      a0, -24(s0)
        addi    a0, a0, 1
        sw      a0, -24(s0)
        j       .LBB4_4
.LBB4_4:                                #   in Loop: Header=BB4_1 Depth=1
        j       .LBB4_1
.LBB4_5:
        lbu     a0, -25(s0)
        li      a1, 87
        blt     a0, a1, .LBB4_8
        j       .LBB4_6
.LBB4_6:
        lbu     a1, -25(s0)
        li      a0, 89
        blt     a0, a1, .LBB4_8
        j       .LBB4_7
.LBB4_7:
        li      a0, 7
        sw      a0, -24(s0)
        j       .LBB4_8
.LBB4_8:
        lbu     a0, -25(s0)
        li      a1, 82
        bne     a0, a1, .LBB4_10
        j       .LBB4_9
.LBB4_9:
        li      a0, 1
        sw      a0, -12(s0)
        j       .LBB4_13
.LBB4_10:
        lw      a0, -16(s0)
        lw      a1, -20(s0)
        call    strcmp
        mv      a1, a0
        li      a0, 0
        bge     a0, a1, .LBB4_12
        j       .LBB4_11
.LBB4_11:
        lw      a0, -24(s0)
        addi    a0, a0, 7
        sw      a0, -24(s0)
        lw      a0, -24(s0)
        lui     a1, %hi(Int_Glob)
        sw      a0, %lo(Int_Glob)(a1)
        li      a0, 1
        sw      a0, -12(s0)
        j       .LBB4_13
.LBB4_12:
        li      a0, 0
        sw      a0, -12(s0)
        j       .LBB4_13
.LBB4_13:
        lw      a0, -12(s0)
        lw      ra, 28(sp)                      # 4-byte Folded Reload
        lw      s0, 24(sp)                      # 4-byte Folded Reload
        addi    sp, sp, 32
        ret
Func_3:                                 # @Func_3
        addi    sp, sp, -32
        sw      ra, 28(sp)                      # 4-byte Folded Spill
        sw      s0, 24(sp)                      # 4-byte Folded Spill
        addi    s0, sp, 32
        sw      a0, -16(s0)
        lw      a0, -16(s0)
        sw      a0, -20(s0)
        lw      a0, -20(s0)
        li      a1, 2
        bne     a0, a1, .LBB5_2
        j       .LBB5_1
.LBB5_1:
        li      a0, 1
        sw      a0, -12(s0)
        j       .LBB5_3
.LBB5_2:
        li      a0, 0
        sw      a0, -12(s0)
        j       .LBB5_3
.LBB5_3:
        lw      a0, -12(s0)
        lw      ra, 28(sp)                      # 4-byte Folded Reload
        lw      s0, 24(sp)                      # 4-byte Folded Reload
        addi    sp, sp, 32
        ret
debug_printf:                           # @debug_printf
        addi    sp, sp, -48
        sw      ra, 12(sp)                      # 4-byte Folded Spill
        sw      s0, 8(sp)                       # 4-byte Folded Spill
        addi    s0, sp, 16
        sw      a7, 28(s0)
        sw      a6, 24(s0)
        sw      a5, 20(s0)
        sw      a4, 16(s0)
        sw      a3, 12(s0)
        sw      a2, 8(s0)
        sw      a1, 4(s0)
        sw      a0, -12(s0)
        lw      ra, 12(sp)                      # 4-byte Folded Reload
        lw      s0, 8(sp)                       # 4-byte Folded Reload
        addi    sp, sp, 48
        ret


text:
Q: PPM Image Transformations in C++ I am stuck on how to perform these transformations on a PPM image.
This is what I have so far, these are close to the solution but a few pixels are wrong for each of them, and I have no idea why?
void vertical_flip(PpmImage &ppm) {
  for (unsigned int r = 0; r < ppm.height/2; r++) {
    for (unsigned int c = 0; c < ppm.width; c++) {
      Pixel temp = ppm.pixels[r][c];
      ppm.pixels[r][c] = ppm.pixels[ppm.height-r-1][c];
      ppm.pixels[ppm.height-r-1][c] = temp;
    }
  }
}

void grey_scale(PpmImage &ppm) {
  for (unsigned int r = 0; r < ppm.height; r++) {
    for (unsigned int c = 0; c < ppm.width; c++) {
      Pixel p = ppm.pixels[r][c];
      p.r = p.g = p.b = p.r/3.0 + p.g/3.0 + p.b/3.0;
      ppm.pixels[r][c] = p;
    }
  }
}


text:
Q: How to make icon and `a` in one line So, I used sidebar menu in my web. At the first, this sidebar just has 100px, and when I hover the mouse to it, it will shows up all the sidebar. this is the image, before and after hover:
My HTML code:

   .sidenav {
            height: 100%;
            width: 100px;
            position: fixed;
            z-index: 2;
            top: 0;
            left: 0;
            background-color: #111;
            overflow-x: hidden;
            padding-top: 60px;
            transition: 0.8s;
        }

        .sidenav:hover{
           width: 250px;
           transition: 0.8s;
        }

    .sidenav a {
        float:left;
        width:100%;
        padding: 8px 8px 8px 32px;
        text-decoration: none;
        font-size: 20px;
        color: #818181;
        display: block;
        opacity: 0;
        transition: opacity 1300ms
    }
    .sidenav:hover a {
        opacity: 1
    }

    .icon{
      display: block;
        position: relative;
        left: 50%;
        top: 50%;
        width: 15px;
        height: 15px;
        float: left;
        border-radius: 50%;
        border: 1px solid red;
        border-top-color: transparent;
        -webkit-animation: spin 2s linear infinite;
        animation: spin 2s linear infinite;
    }

      Home
      Menu 1
      Menu 2
      Menu 3
      Menu 4
      Menu 5

all my link menu is hidden when sidebar is not hover, and will appear when hovered. My question is how to just display icons when sidebar is not hover, and display all when its hover, where I use this class:
so its still shows when sidebar not hover and still in one line with the link menu? thanks

A: You can use FontAwesome for the icons. Hope it helped.

.sidenav a {
    float: left;
    width: 250px;
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 16px;
    display: block;
    line-height: 37px;
    color: transparent;
    transition: 1300ms;
    height: 30px;
    font-family: arial;
    letter-spacing: 1px;
    text-transform: uppercase;
}
i {
    display: block;
    position: relative;
    width: 15px;
    height: 15px;
    float: left;
    border-radius: 50px;
    border: 1px solid red;
    padding: 10px;
    text-align: center;
    line-height: 15px !important;
    color: #fff;
    opacity: 1;
    margin-right: 10px;
    font-size: 15px !important;
}
.sidenav {
    width: 100px;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    padding-top: 60px;
    transition: 0.8s;
}
.sidenav:hover {
    width: 250px;
    overflow: hidden;
    transition: 0.8s;
}
.sidenav:hover a {
    color: #fff;
}

   Home
   Menu 1
   Menu 2
   Menu 3
   Menu 4
   Menu 5

A:

.sidenav {
  height: 100%;
  width: 250px;
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  background-color: #111;
  overflow: hidden;
  padding-top: 60px;
  transition: 0.8s;
  transform: translatex(-150px);
}
.sidenav:hover {
  transition: 0.8s;
  transform: translatex(0);
}
.sidenav a {
  display: block;
  width: 150px;
  padding: 8px 8px 8px 32px;
  text-decoration: none;
  font-size: 20px;
  color: #818181;
  transition: opacity 1300ms;
  position: relative;
}
.sidenav a::after {
  content: '';
  display: block;
  position: absolute;
  right: -16px;
  top: calc(50% - 8px);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid red;
  border-top-color: transparent;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
}

  Home
  Menu 1
  Menu 2
  Menu 3
  Menu 4
  Menu 5


text:
Q: Oracle 11g - Want to know current row information, especially PK I made a trigger like below.
test_suc_func always return varchar2 "00".
create or replace procedure call_func (v_a_id  IN NUMBER)
is
begin
update A_TBL set created = test_suc_func() where a_id = v_a_id;
end;

CREATE OR REPLACE TRIGGER a_trigger
  AFTER
    INSERT ON A_TBL
  -- FOR EACH ROW
BEGIN
  call_func(a_seq.currVal);
exception
  when others then
  update A_TBL set rc='99'
  where a_id = a_id;
END;

I expect this PLSQL to execute followings.

*

*When data insert into A_TBL, it calls a function.

*When it fails, it update that COLUMN.

The problem is when I wrote in exception statement, updates all rows in A_TBL.
Since PK of A_TBL is sequence, I can get that with a_seq.currVal, but as you see can not use sequence in where statement.
Q. How can I refer current row data in trigger like this keyword in javascript?
I have tried :new and :old, but It pops up a weird window in sqldeveloper. Thanks :D bb
=================== 2015 09 18
I edited the post, since I got an error. Some of a_seqs change to a_ids.

A: I am sure there is much better way than this. However I found a detour.
CREATE OR REPLACE TRIGGER a_trigger
  AFTER
    INSERT ON A_TBL
  -- FOR EACH ROW
DECLARE
  tmp_id number;
BEGIN
  select a_seq.currVal into tmp_id from dual;
  call_func(tmp_id);
exception
  when others then
  update A_TBL set rc='99'
  where a_id = tmp_id;
END;

I have declared a temporary variable in trigger.
And refer that. Now I update only current row when I failed.
I am still looking for more efficient and clever answer for this problem. Thanks

A: As I understand, you need to modify columns of inserted record.
For such case you don't need update statements in trigger.
You just need BEFORE INSERT trigger with FOR EACH ROW option.
In such case you may just assign new value for
:new.created and :new.rc, and they will be inserted in created and rc columns.
Something like this:
CREATE OR REPLACE TRIGGER a_trigger
  BEFORE
    INSERT ON A_TBL
    FOR EACH ROW
BEGIN
  :new.created = test_suc_func();
exception
  when others then
    :new.rc = '99';
END;

You can't modify :new variables in AFTER trigger and can't access them without FOR EACH ROW option. Also you can't call DML (insert/update/delete) on some table from FOR EACH ROW trigger on the same table (table is mutating).


text:
Q: Extreme lag issues in creative mode For some reason when I am in creative mode, I lag so badly, but when I switch to spectator mode, my game is completely okay.  But the thing is what is causing the lag in creative mode?  I checked the debug profiler and the tick percentage rules over everything and I pressed "1" on the keyboard and it says something unspecified is lagging the game.  Also, turning every setting to increase fps doesn't help and it is exactly the same as having my regular settings.  Any clues what this is?

A: The lag disappearing when you switch to spectator mode could possibly suggest that your random tick speed is set to an extremely high number, causing lag. Random ticks usually occur around the player, but not around players in spectator mode.
Try to set the random tick speed to 3 (the default value).
/gamerule randomTickSpeed 3


text:
Q: Command-line way of send pinging I have lots of Drupal powered website. Each of the website has Multiping module to pinging ping server.
Is there any way of send pinging through command-line?
I hope I can build dedicated server for pinging.

A: As Caleb notes, cURL is usually the weapon of choice for command-line
HTTP.  The tricky part - as Caleb again notes - is putting the request
together, especially for XML-RPC, where the server is likely looking
for a well-formed input.
But if you poke around at the source for Multipin, you see that it's
not just a simple HTTP request (thought it does fall back to that) -
and it changes based on what services the target service has enabled
-- and, in the case of weblogUpdates -- special-cases what is sent:
// Ping! Check service method
if (!empty($pingservice->method)) {
  if ($pingservice->method == 'weblogUpdates.ping') {
    $result = xmlrpc($pingservice->url, $pingservice->method, $name, $base_url);
  }
  else {
    $result = xmlrpc($pingservice->url, $pingservice->method, $name, $base_url, $rss_url);
  }
}
else {
  $pingurl = strtr($pingservice->url, array(
    '%name' => urlencode($name),
    '%url' => urlencode($base_url .'/'),
    '%rss' => urlencode($rss_url),
  ));
  $result = drupal_http_request($pingurl);

And a few lines above, it's clever about deciding what rss URL to
send, based on taxonomy, etc.
So I'd suggestion one of two approaches.

*

*If you just want to get something going, simulate the drupal_http_request
by sending something like this:
$ curl <target-pingservice-url> -d 'name=<your site name>' -d url=<your-url> -d rss=/rss.xml

*Alternatively: if want all the behavior of MultiPing, you could
extract that _multiping_doping function and run it from the
command line directly by PHP.
The workhorse function you'll need is Drupal's xmlrpc:
http://api.drupal.org/api/drupal/includes%21common.inc/function/xmlrpc/7
Good luck!


text:
Q: Does QGIS support parsing of date strings in tables? It is straightforward to load GPX files (GPS downloaded tracks / points) into QGIS, then save and manipulate them as shapefiles. However, the recording date (in the comment (cmt) field) of waypoints is in the format YY-MMM-DD HH:MM:SS (e.g. 28-AUG-11 11:57:51) and it would be possible to sort by date only if the format could be parsed to something closer to the ISO 8601 standard (YYYY-MM-DD ...).
String manipulation in the field calculator can take you partway: '20' || substr(cmt,8,2) || '-' || substr(cmt, 4, 3) || '-' || substr(cmt, 1, 2) || ' ' || substr(cmt, 11, 8)
However, you're  then left with YYY-MMM-DD HH:MM:SS - i.e. AUG instead of 08.
Is there a straightforward way to parse the date string directly, providing integer months? (Ideally, something like the R strptime() function)

A: If you're willing to use PostGIS, you can convert the GPX date field to a Postgres timestamp field like so (this works as long as the months are always abbreviated to 3 letters, which I believe is the case):
to_timestamp('28-AUG-11 11:51:57', 'DD-MON-YY HH:MI:SS');

Or, in the field calculator, you can do something like this:
replace(replace(replace(substr(date, 4, 3), 'JAN', '01'), 'FEB', '02'), 'MAR', '03')

(of course, put in more nested replaces for all the months). It isn't pretty but it works.


text:
Q: Check signup checkbox is check or not on checkout Hello currently i am using one page checkout and i want to know that signup check-box is check or not on checkout page. How can i know that sign up is checked or not?

A: You can check the value of
Mage::getSingleton('checkout/session')->getQuote()->getCheckoutMethod()

This value can be:

*

*empty - if the customer is already logged in

*register - if the customer chose to register

*quest - if the customer selected 'Checkout as guest'

[EDIT]
To know if a customer is logged in check this:
Mage::getSingleton('customer/session')->isLoggedIn();//true if the customer is logged in


text:
Q: Distributing points evenly spaced within a sphere I am looking for an algorithm to distribute a bunch of points (could be anywhere from a few hundred to millions) within a sphere.  In this case the sphere is centered at (0,0,0).
For random points a simple method is
repeat
    x:=random*diameter-radius;
    y:=random*diameter-radius;
    z:=random*diameter-radius;
until ((x*x+y*y+z*z)<(radius*radius));

But I want to get the points evenly spaced within the sphere and without bunching at the poles.
Any good tricks/algorithms/formulas/code snippet to accomplish this?

A: You could do something like this:

*

*Put the center of your sphere at a random position within an infinite volume of evenly-spaced points, like a tetrahedral or cubic lattice.

*Enumerate points in order of increasing distance from the center until you have the right number.

*Rescale the selected points around the center so that the distance to the furthest point is equal to the desired radius.

A: If you need evenly spaced points - just place them in grid nodes.
Sphere with radius R has volume
 V=4/3*Pi*R^3

so for placing N points every cell of cubic grid (perhaps you might want to use hexagonal close packing) should have volume
v=4/3*Pi*R^3/N

and edge length
l = R * (4*Pi/(3*N))^1/3

Then generate points in coordinates (a*l, b*l, c*l) where a,b,c are integers limited by -R..+R (with appropriate sum of squares).

Proposed approach is quite rough estimation and perhaps some points from N needed ones might run outside of the sphere. In this case one have to diminish cell size or use more exact value - it might be calculated using 3D analog of Gauss circle formula  ()

A: Thanks for the explanation by joriki. The above formula has been explained in proof of the formula mentioned. But the formula has some limitations. The cube length can be 2 (-1 to 1 in all directions). From the above concept, mentioned by joriki or proof of the formula mentioned we can generalize for the cube of any length (i.e 2a (-a to a in all directions)). Here 2a is the side length of the cube.
$a^6-(a^2-x^2 )(a^2-y^2)(a^2-z^2)=x^2 a^2 (a^2-\frac{z^2}{2}-\frac{y^2}{2}+\frac{y^2 z^2}{3a^2})+y^2 a^2 (a^2-\frac{z^2}{2}-\frac{x^2}{2}+\frac{x^2 z^2}{3a^2})+z^2 a^2 (a^2-\frac{x^2}{2}-\frac{y^2}{2}+\frac{y^2 x^2}{3a^2})$
$x'=xa \sqrt{a^2-\frac{z^2}{2}-\frac{y^2}{2}+\frac{y^2 z^2}{3a^2}}$,
$y'=ya \sqrt{a^2-\frac{z^2}{2}-\frac{x^2}{2}+\frac{x^2 z^2}{3a^2}}$,
$z'=za \sqrt{a^2-\frac{x^2}{2}-\frac{y^2}{2}+\frac{y^2 x^2}{3a^2}}$,
From the above equation, we can easily separate the (x',y',z') as explained in 1. The above equation will readily find the mapping of the generalized length of the cube to a sphere. I hope this will be helpful.
Form the above equation we can also find the evenly distribution of points within the sphere by varying the grid size of the cube. By discretizing the cube into different grids and simultaneously mapping into the sphere will give the evenly distribution of points within the sphere.
Kindly ignore some typos.
C++ code for evenly distributing points within the sphere:-
for(x=-a;x<=a;x=x+n)
for(y=-a;y<=a;y=y+n)
{
    for(z=-a;z<=a;z=z+n)
    {
        xnew=x*a*(sqrt((a*a)-(y*y)/(2)-(z*z)/(2)+(y*y*z*z)/(3*a*a)));
        ynew=y*a*(sqrt((a*a)-(z*z)/(2)-(x*x)/(2)+(x*x*z*z)/(3*a*a)));
        znew=z*a*(sqrt((a*a)-(x*x)/(2)-(y*y)/(2)+(y*y*x*x)/(3*a*a)));
        cout<<" "<<xnew<<" "<<ynew<<" "<<znew<<endl;
        }
}
    }

Note:- Here in code, n is the grid size of a cube.


text:
Q: Vue page transition with Vue-Router I'm trying to make nice page transitions using Vue and Vue-Router.
I load different pages (components) directly in the router-view, these have a nice animation.
I've already got a great animation for all my pages, however I need to figure out how to simply change the transition based on the router-link that is clicked.
If class of route-link is special, do another animation.
App.vue
<template>
  <div id="app">
    <nav>
      <router-link to="/1">Page 1</router-link>
      <router-link to="/2">Page 2</router-link>
      <router-link to="/3">Page 3</router-link>
      <router-link class="special" to="/4">Page 4</router-link>
    </nav>
    <transition @enter="enter" @leave="leave">
      <router-view/>
    </transition>
  </div>
</template>

<script>
  export default {
    ...
    methods: {
      enter(el, done) {
        // main page animation with a timeline using Greensock
      },
      leave(el, done) {
        // main page animation with a timeline using Greensock
      }
    },
  }
</script>

How do I get this to work?
If the user clicks on router-link with a class of special, change
<transition @enter="enter" @leave="leave">
  <router-view/>
</transition>

to:
<transition @enter="enterSpecial" @leave="leaveSpecial">
  <router-view/>
</transition>

so that I can add
    methods: {
      enter(el, done) {
        // main page animation with a timeline using Greensock
      },
      leave(el, done) {
        // main page animation with a timeline using Greensock
      }
    },

I've searched through the docs + googled, and haven't found anything that could help.

A: You can use Router Meta Fields to know which animation you should apply.
On routes declaration, you can add meta fields for each route. E.g:
const router = new VueRouter({
  routes: [
    {
      path: '/default',
      component: SomeComponent
    },
    {
      path: '/special',
      component: SomeComponent2,
      // meta fields
      meta: {
          animation: 'special'
      }
    }
  ]
})

Then on your components, you can do this:
 methods: {
   enter(el, done) {
     if (this.$route.meta.animation === 'special') {
         // apply special animation
     } else {
        // main page animation with a timeline using Greensock
     }
   },
   leave(el, done) {
     // main page animation with a timeline using Greensock
   }
 }

You can find more information about vue-router meta fields here.


text:
Q: Compute the volume of the region $R$. Let $R=\{(x,y,z):3x^2 \leq z \leq 3, \ -z \leq y \leq z\}$ and compute the volume $\text{Volume}(R).$
Plotting the first inequality:

and since $y$ varies between $-z$ and $z$, the region is just a cylindric paraboloid bounded by the parabola $z=3x^2,$ the planes $z=3$, $y=-z$ and $y=z$. Now it remains to get the bounds for the trippleintegral.
Clearly $ -1\leq x \leq 1$ and it's already given that $-z \leq y \leq z$. But It's also given that (and it's evident from the figure above) that $3x^2 \leq z \leq 3$. So
$$I=\iiint_R1 \ dzdydz=\int_{-1}^{1}\int_{-z}^{z}\int_{3x^2}^{3}1 \ dzdydx= 8z.$$
Now I got a my answer in terms of $z$, but this is ok since I don't know the bounds explicitly for $y$.
Am I on the right path?

A: You can't "decompose" the integral like this with those boundaries for the variables. When you do such "decomposition" of the integral you are actually first projecting the region onto the $xy$-plane and afterwards on $x$-line and so on. When you do the projection onto the $xy$-plane it can't be dependent on $z$.
To get around this you can express $y$ in terms of $x$ using the inequality $3x^2 \le z \le 3$. However a better solution would be to project the region onto the $xz$-plane first and afterwards onto the $x$-line. Then the solution would be:
$$\iiint_R1 \ dzdydz=\int_{-1}^{1}\int_{3x^2}^{3}\int_{-z}^{z}1 \ dydzdx$$
Now just evaluate the integral, which shouldn't be that hard.


text:
Q: Vim: how to get the mode I'm currently in I'm writing a plugin for commenting the code in special way and it should act a bit different when called in visual or normal modes.
Is there a function or some way to determine the mode in which the user is (was) when the function was called?

A: There's

mode([expr])    Return a string that indicates the current mode.

http://vimdoc.sourceforge.net/htmldoc/eval.html#mode%28%29
but that might not work since you're probably going to start command mode in the rhs of the mapping.
A more robust way would be to set up slightly different mappings like
nmap <Leader>c :call MyFunc('n')<CR>
vmap <Leader>c :call MyFunc('v')<CR>

and use the argument value to know what mode the user was in.


text:
Q: cakePHP validation data before save I have a problem in my site created with cakePhp 2.x, when I try to register an account my form check all my rules of my fields and beforeSave crypt the password, but crypt the password before check the password(MatchPassword) with the confirm password and then return me the error tha the two password is't equal because the password is crypt with 40characters.
Here is my Model code, How can I solv this problem?
<?php
    //questo modello interessa lòa tabella User
    class User extends AppModel{
        public $name = 'User'; //non utilizzata nel sito è il nome del modello alla fine per migliorare la compatibilità

        public $validate = array(

            'password' => array(
                'non_vuoto' => array(
                    'rule'=> 'notEmpty',//non è vuoto metodo che eredito da appmodel
                    'message'=> 'La password non può essere vuota'
                ),
                'min_lunghezza' => array(
                    'rule' => array('minLength',5),
                    'message' => 'La password deve contenere almeno 5 caratteri'
                ),
                'max_lunghezza' => array(
                    'rule' => array('maxLength',15),
                    'message' => 'La password deve contenere al massimo 15 caratteri'
                ),
                'password_uguale' => array(
                    'rule' => 'matchPasswords',
                    'message' => 'Not equal password'
                )
            ),
            'password_confirm' => array(
                'non_vuoto' => array(
                    'rule'=> 'notEmpty',//non è vuoto metodo che eredito da appmodel
                    'message'=> 'La password non può essere vuota'
                )
            )
        );

        public function matchPasswords($data){

            if ($data['password']==$this->data['User']['password_confirm']){
                return true;
            }

            $this->invalidate('password_confirm','Le due password non coincidono');
            return false;
        }

        public function beforeSave(){
            //crypt
            if (isset($this->data['User']['password'])){
                $this->data['User']['password']=AuthComponent::password($this->data['User']['password']);
            }
            return true;
        }

    }
?>

A: I had a similar problem -- I'm not sure if it's exactly what you were asking -- but I needed to validate my model, before the beforeSave() rules were applied.
I found CakePHP's Validating Data from the Controller page helpful. Basically, you set the data
$this->ModelName->set($this->request->data);

Then you can check the model's validates() method...
if ($this->ModelName->validates()) { // ...

Then, you can decide whether to save the model or show the user an error using, e.g., $this->Session->setFlash().


text:
Q: Google App Engine: Intro to their Data Store API for people with SQL Background? Does anyone have any good information aside from the Google App Engine docs provided by Google that gives a good overview for people with MS SQL background to porting their knowledge and using Google App Engine Data Store API effectively.
For Example, if you have a self created Users Table and a Message Table
Where there is a relationship between Users and Message (connected by the UserID), how would this structure be represented in Google App Engine?
SELECT * FROM Users INNER JOIN Message ON Users.ID = Message.UserID

A: Can I supplement the excellent answer further above with a link to a video:
http://sites.google.com/site/io/building-scalable-web-applications-with-google-app-engine
It's a great talk by Google's Brett Slatkin who talks for an hour about the special way you need to think about your application before you can expect it to scale well. There are some genuine WTFs (such as no count() in db queries) that will cause you to struggle if you are coming from a relational background.

A: Here is a good link: One to Many Join using Google App Engine.
http://blog.arbingersys.com/2008/04/google-app-engine-one-to-many-join.html
Here is another good link: Many to Many Join using Google App Engine:
http://blog.arbingersys.com/2008/04/google-app-engine-many-to-many-join.html
Here is a good discussion regarding the above two links:
http://groups.google.com/group/google-appengine/browse_thread/thread/e9464ceb131c726f/6aeae1e390038592?pli=1
Personally I find this comment in the discussion very informative about the Google App Engine Data Store:
http://groups.google.com/group/google-appengine/msg/ee3bd373bd31e2c7

At scale you wind up doing a bunch of
  things that seem wrong, but that are
  required by the numbers we are
  running. Go watch the EBay talks. Or
  read the posts about how many database
  instances FaceBook is running.
The simple truth is, what we learned
  about in uni was great for the
  business automation apps of small to
  medium enterprise applications, where
  the load was predictable, and there
  was money enough to buy the server
  required to handle the load of 50
  people doing data entry into an
  accounts or business planning and
  control app....

Searched around a bit more and came across this Google Doc Article:
http://code.google.com/appengine/articles/modeling.html

App Engine allows the creation of easy
  to use relationships between datastore
  entities which can represent
  real-world things and ideas. Use
  ReferenceProperty when you need to
  associate an arbitrary number of
  repeated types of information with a
  single entity. Use key-lists when you
  need to allow lots of different
  objects to share other instances
  between each other. You will find that
  these two approaches will provide you
  with most of what you need to create
  the model behind great applications.

A: I think this is the basics : Keys and Entity Groups
look for it in appengine docs. (I'm new here so can't post a link)

A: I have worked on it but not a expert though Google app engine is very good thing and it is the future as it implements Platform as a Service and Software as a Service. Google app engine provides a non- relational database. So you cantreally write relationships here.
Regards,
Gaurav J

A: These links are great, but are predominantly python biased, I am using GWT, and therefore have to use the java flavour of GAE, does anyone have any examples of how to achieve these "join" equivalencies in the java version of GAE?
Cheers,
John

A: The standalone GAE SDK is pretty difficult to use for putting data into and retrieving data from the Google App Engine data store.
"Objectify" is a GAE extension that makes these operations much easier.  The Objectify wiki and source code can be found here.  I strongly recommend using Objectify in your GAE project.
http://code.google.com/p/objectify-appengine/
Here are a couple of tutorials on using Objectify with the app engine.  Follow these tutorials and you will be storing and retrieving data in no time.
http://www.fishbonecloud.com/2010/11/use-objectify-to-store-data-in-google.html


text:
Q: Help Needed! GWT Error I am a beginner in GWT. I'm trying a first application with GWT for almost 6 hours. I am following a tutorial and everything should go fine. But I dont know what problem I am getting with service def target. Please can someone help me, it concerns very basic rpc. I am just trying to bring a hello string from the server and display it at the client for the sake of knowing the basics of rpc
you can find the eclipse file i coded uploaded at http://noorsolution.zxq.net/Hi.zip
Thanks in advance

A: Just put your actual exception, So it will better to understand.
There is no any service interface in your application.In gwt there must be interface implementing Remote Service.
I suggest you to make a simple application form gwt, which will give you all basically related classes.
May this will help you.


text:
Q: removing bracket value from first and adding some data to second column I want to remove all the brackets value from first column and add some field in last column
Sample Input
EXAMPLE(abc@gmail.com),60,6
EXAMPLE(bcd@gmail.com),30,6
EXAMPLE1(sample@gmail.com),60,3

Sample Output

EXAMPLE,60,6.ABC
EXAMPLE,30,6,ABC
EXAMPLE1,60,3,ABC

Below is code which I tried but no luck :
 for file_name in tmp/*.csv
    do
       sed -i 's/$/,"AB"/' "$file_name"| awk '{sub(/[(].*[)]/,"")}1' $file_name > tmp.csv && mv tmp.csv $file_name
    done

when I try it with single file it is working but in look it is not working:
sed -i 's/$/,"AB"/' abc.csv| awk '{sub(/[(].*[)]/,"")}1' abc.csv > tmp.csv

A: Perhaps this will do:
awk '{sub(/[(].*[)]/,""); print $0",ABC"}' file | awk '{sub(/60,6,/,"60,6.")}1'

EXAMPLE,60,6.ABC
EXAMPLE,30,6,ABC
EXAMPLE1,60,3,ABC

A: Try this
/tmp> cat jyoti.txt
EXAMPLE(abc@gmail.com),60,6
EXAMPLE(bcd@gmail.com),30,6
EXAMPLE1(sample@gmail.com),60,3
/tmp> perl -lne  's/\(.*\)//; print "$_,ABC" ' jyoti.txt
EXAMPLE,60,6,ABC
EXAMPLE,30,6,ABC
EXAMPLE1,60,3,ABC
/tmp>


text:
Q: Add and subtract 1 hour from Timestamp column in DBeaver (SQL) I have a table with the column 'Timestamp'. I want to create 2 columns that contains the -1hour and +1hour of that time stamp.
This is the format of the timestamp: 2020-08-31 11:05:55
and I want to get 2 more columns showing the -1hour and +1hour: 2020-08-31 10:05:55 and 2020-08-31 12:05:55
Thanks!

A: In standard ANSI SQL you can simply subtract an interval:
select the_column - interval '1' hour as one_hour_before,
       the_column,
       the_column + interval '1' hour as one_hour_after
from the_table
where ....

A: a_horse_with_no_name is right. The standard way is to add/subtract INTERVALs.
However Vertica date arithmetics offers some very simple shortcuts...
When you add/subtract an INTEGER value it is interpreted as number of days:
    SELECT CURRENT_TIMESTAMP, CURRENT_TIMESTAMP+1, CURRENT_TIMESTAMP-1;
           ?column?            |           ?column?            |           ?column?
-------------------------------+-------------------------------+-------------------------------
 2020-09-03 00:38:54.781675-04 | 2020-09-04 00:38:54.781675-04 | 2020-09-02 00:38:54.781675-04

If you want to add/subtract:

*

*hours you have to use 1/24,

*minutes you have to use 1/1440

*seconds you have to use 1/86400.

For example:
SELECT CURRENT_TIMESTAMP, CURRENT_TIMESTAMP+1/24, CURRENT_TIMESTAMP-1/24;
           ?column?            |           ?column?            |           ?column?
-------------------------------+-------------------------------+-------------------------------
 2020-09-03 00:38:54.781675-04 | 2020-09-03 01:38:54.781675-04 | 2020-09-02 23:38:54.781675-04

SELECT CURRENT_TIMESTAMP, CURRENT_TIMESTAMP+1/1440, CURRENT_TIMESTAMP-1/1440;
           ?column?            |           ?column?            |           ?column?
-------------------------------+-------------------------------+-------------------------------
 2020-09-03 00:38:54.781675-04 | 2020-09-03 00:39:54.781675-04 | 2020-09-03 00:37:54.781675-04

A: DATEADD()]1 might be your best bet if your DBMS is Microsoft SQL Server. If you are using something like Oracle, the ANSI interval solution by a_horse_with_no_name is a great, easy to read, option.
For example the below code yields,
SELECT '2020-08-31 11:05:55' AS time_stamp,
   DATEADD(hour, 1, '2020-08-31 11:05:55') plus_one_hour,
   DATEADD(hour, -1, '2020-08-31 11:05:55') minus_one_hour;

--OUTPUT
      plus_one_hour              time_stamp                minus_one_hour
'2020-08-31 12:05:55.000'   '2020-08-31 11:05:55.000'     '2020-08-31 10:05:55.000'


text:
Q: How to handle elasticsearch-curator log file size? I am working on the elasticsearch-curator 5.5 with following logging style in curator_config YAML:
logging:
  loglevel: INFO
  logfile: curator.log
  logformat: default
  blacklist: [elasticsearch]

Is there any way to provide maxFileSize (alike log4j configuration) here and handle the logs gracefully?
I am going to use this Curator config in a scheduled snapshot/restore job and want to retain logs.
Reference for curator config: Elasticsearch-curator logging

A: This functionality does not exist in Curator. Not yet, anyway.
You'd be best served to use logrotate (or similar) handle this for you.


text:
Q: How can I capture Memberpress user info after signup I'm currently working on a website where users can purchase subscriptions using memberpress, I want to capture the user data after the signup process is completed and the payment transaction is also completed as well.
If I add the member through dashboard manually I'm able to catch the user info as there is no payment gateway is involved, with this code
function mepr_capture_new_member_added($event) {
    $user = $event->get_data();
    //mail('myemail', 'mp user added', 'new user added successfully');
  }
  add_action('mepr-event-member-added', 'mepr_capture_new_member_added');

As I'm new to WordPress development I don't know how I can access this data on my other page templates, that's why I'm sending an email to test if it works or not I was able to figure out the action hook for the transaction-completed event, but it doesn't seem to work properly. Here is the code
function mepr_capture_new_one_time_sub($event) {
    $transaction = $event->get_data();
    $user = $transaction->user();
    //mail('myemail', 'user purchased subscription', 'user-transaction-completed event captured '); }

add_action('mepr-event-non-recurring-transaction-completed', 'mepr_capture_new_one_time_sub');

I've read the complete memberpress documentation but the resources related to development are not what I'm looking for, they gave an option for webhooks and I can capture the data on zapier after user signup and payment transaction is completed but I need the data on my website so Zapier is not an option, they also provide the rest API but I want to capture the user information on 'signup and transaction complete' event and I don't think so that's possible with rest API, Please let me know how I can overcome this issue, any kind of help will be appreciated.

A: After searching for about 2 days I was able to figure out a way to capture the user after signup process is completed and the user's payment goes through the payment gateway, the way I'm doing it right now is when a signup process is completed user is redirected to thank-you page and a querystring containing subscr_id is passed on that page and I'm capturing that subscr_id and fetching the user from the database manually and its working perfectly fine, the process is seamless, and I can use the data on my other page templates as well.
You can simply get subscr_id from $_GET['subscr_id'] and use that to capture the user associated with this subscription from the table 'wp_mepr_subscriptions' and then use the user id to fetch the user detail from 'wp_usermeta' table of the wordpress, hope it helps someone else :)


text:
Q: AngularJS equivalent for event.pageX of jQuery In jQuery hover event has event.pageX and event.pageY properties. Is there any equivalent property for ng-mouseover in AngularJs?
I tried using $event.offsetX and $event.x but they not seem to give same values, also $event.pageX always returns undefined.
So what is the equivalent property for event.pageX in AngularJs?

A: The ng-mouseover event does contain pageX and pageY, the event is wrapped around jquery-lite. Angular's version of jQuery.
  $scope.mouseOver = function(e) {
            console.log(e);
        }

    <a ng-href="#" ng-mouseover="mouseOver($event)">

When you pass $event in it, you pass the jQuery event. A simple console.log of the properties gave me the following:
pageX: 97
pageY: 85

Put together an example here:
https://jsbin.com/nedovoqile/edit?html,js,console,output


text:
Q: Converting HR to OR for meta-analysis (or vice versa) I've looked both in SO and others (Borenshtein's) and have yet to find an answer.
I have some studies that provide an adjusted OR estimate, some HR, and then some with adjusted RR. I can subgroup and report them based on treatment effect, but I am also interested in bundling them.
My colleague suggested treating RR as HR and then converting to OR to RR (formula available in the cochrane handbook - a solution I'm not really satisfied with, since RR != HR, and that also requires me to extrapolate baseline risk from univariate data. In addition I'll end up describing with RR although almost all studies use a different measure.
However I couldn't find an appropriate method/ function for HR -> OR.
Can someone point me in the direction?
This describes converting log-hazard to probability and then back, but going the other way around again I don't have baseline hazard.


text:
Q: Can you configure key event handling in Qt Designer (PyQt5)? I just discovered Qt Designer today and it's rather wonderful.
But I'm a keyboard fanatic and don't want to be forced to use the mouse any more than is strictly necessary, or at the very least I want to have hotkey alternatives to any buttons, etc.
This can be coded manually but I was just wondering whether you can somehow set this up through Qt Designer? It would be good if this kind of configuration could be kept in the auto-generated .ui file (and then be converted to a .py file), rather than cluttering up the business code.
There is an item under "Input Widgets" called "Key Sequence Edit"... but I haven't worked out what this does. It doesn't seem to be the answer. I've also tried right-clicking on a widget (e.g. a QTreeView) but I couldn't find an obvious answer there.
There's also something called "Action Editor" (second tab in the bottom right box)... looks promising but I haven't a clue what to do currently.

A: There is an important distinction that is required for this question. Note that this is valid for almost any GUI based environment/framework, not just Qt.
Mnemonics
I will cite the description in the related Wikipedia article:

A mnemonic is an underlined alphanumeric character, typically appearing in a menu title, menu item, or the text of a button or component of the user interface. A mnemonic indicates to the user which key to press (in conjunction with the Alt key) to activate a command or navigate to a component.

Depending on the platform and framework in use, but most importantly the source of the mnemonic, the behavior can slightly change.
For buttons or "buddies" (labels that are linked to another widget in order to use their mnemonic to set the focus on that widget), the mnemonic usually works with Alt+letter.
For menu items, instead, it's usually enough to directly press the letter without the Alt modifier.
Keyboard shortcuts
They are (usually) keyboard combinations, using at least one or more modifiers and another standard (possibly) alphanumeric key.
A typical example is Ctrl+A, used to select everything in the current object.
Note that while conceptually a mnemonic _is_ a keyboard shortcut, and technically you can construct a keyboard shortcut without any modifier, it's common convention to differentiate them (and avoid shortcuts without modifers).
Qt paradygm and use in Designer
In Qt mnemonics exist in the following cases:

*

*actions (when they're added to a QMenu or a QToolbar)

*buttons (QAbstractButton subclasses)

*tabs (QTabBar tabs, usually for QTabWidget)

*group boxes (QGroupBox)

*labels (using setBuddy()
In all situations they are shown with the mnemonic letter underlined[1], and that letter can be explicitly set using the & character preceding the letter that is going to be used (the ampersand can be actually shown using &&), otherwise the style will autonomously try to set them.
An important note about the last case (letting Qt set the mnemonics). The style set for the application (the default one or that set using setStyle()) or for a specific widget not only sets mnemonics on its own[2], but it will also overwrite the object text() property. If you create a button with its text as "Button", not only Qt will probably use the "b" letter for its mnemonic, but button.text() will also return "&Button". Note that this does not happen within the creation, but only as soon as the widget is added to a parent and that parent is shown.
That is another very important reason for which object comparison (if someWidget.text() == 'someText': do something) should never be done using the text() property.
An other important aspect to consider about mnemonics is that only the first &-preceded letter will be used for the mnemonic. If you create a button with text "&Some &button", only the "S" letter will be considered (even if the "b" will still be probably underlined). Not only: if you try to use the same multiple &-based mnemonics on different widgets, the result will be undefined[3].
Now. Qt Designer doesn't allow to create shortcuts for specific widgets arbitrarily, and that's for good reasons: keyboard shortcuts should be unique and need context. UIs created with Designer should be as much universal as possible and should not go too "deep" in implementations that should be done on the logic side of the programming. QActions are designed for that, to be "actions" possibly executed out of any context, unlike standard widgets which depend on keyboard focus and mouse position, and that's why you can set shortcuts for them.
Finally.
If you are just looking for mnemonics, follow the above suggestions about them.
If you need something that could actually be activated from anywhere, create a QAction, and connect its triggered signal to the related function within the code; if that something is going to appear on menus or toolbars also, you can create the related QAction on Designer.
Notes:
1 Some styles (notably, "breeze") only shows underlined letters when the Alt is pressed.
2 Automatic mnemonics are created in insertion order to their parent, recursively.
3 Try creating two buttons with the text "&test &button": the second button will probably appear as "test &button".


text:
Q: How to play video file while it is being written to I am using gstreamer to get a multicast stream and create an OGG file. At the sametime, I am using the HTML5 video tag to playout the OGG file.
What is happening now is that if I start the gstream pipe, wait a few seconds and then refresh the web page, the web page will play the OGG file for a few seconds since that is what the OGG file contains. If I refresh the web page, then the OGG file will play longer and so on.
Is there any way to get the web page to play OGG file play continously as it is being written to?


text:
Q: Json Jackson deserialize object without setters I have class(for example. In real project I have JAXB generated class instead User):
public class User {
  private List<String> users;

  public List<String> getUsers() {
    return users;
  }
}

When I get User user(with data) I can serialize it to String or byte[] with JacksonJson. But when I try deserialize it to User I get error:
Cannot construct instance of `javax.xml.bind.JAXBElement` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

Because User has not setter. How can I deserialize it?

A: You can do it by implement custom deserializer class.
Try with this:
String json = null;//your request json
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(User.class,new UserDeserialzer());
User user = objectMapper.registerModule(module).readValue(json,User.class);

Deserializer class:
public class UserDeserialzer extends JsonDeserializer<User>{
    @Override
    public User deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        JsonNode value = new ObjectMapper().readTree(p.getText());
        User user = new User();
        try {
            Field field = user.getClass().getDeclaredField("users");
            field.setAccessible(true);
            field.set(user,value.get("users"));
        }catch (Exception ex){
        }
        return user;
    }
}

For Spring-boot application :
add this bean to deserialize globally.
@Bean
    public Jackson2ObjectMapperBuilder configureObjectMapper() {
        Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
        ObjectMapper objectMapper = new ObjectMapper();
        SimpleModule module = new SimpleModule();
        module.addDeserializer(User.class,new UserDeserialzer());
        objectMapper.registerModule(module);
        builder.configure(objectMapper);
        return builder;
    }

A: If you prefer to use Apache CXF while creating JAXB objects, you can use xjc plugin to create setter-getter methods automatically during generated objects. This way may be very pratical for you.
I ran into the same problem and in this way, I solved the problem without making a code change.
You can add the following part to your pom file:
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${version.apache.cxf}</version>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <sourceRoot>${basedir}/src/main/java</sourceRoot>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>${basedir}/src/main/resources/wsdl/sample.wsdl</wsdl>
                                <wsdlLocation>classpath:wsdl/sample.wsdl</wsdlLocation>
                                <extraargs>
                                    <extraarg>-xjc-Xbg</extraarg>
                                    <extraarg>-xjc-Xcollection-setter-injector</extraarg>
                                </extraargs>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.cxf.xjcplugins</groupId>
                    <artifactId>cxf-xjc-boolean</artifactId>
                    <version>3.0.3</version>
                </dependency>
                <dependency>
                    <groupId>org.andromda.thirdparty.jaxb2_commons</groupId>
                    <artifactId>collection-setter-injector</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>


text:
Q: Animating UITableView replacement - not showing data until animation complete I have UISplitViewController, that displays a UITableView in the master view, and also in the detail view.
When the user selects an item in the master view table, I reload the table in the detail view, and I would like to animate this with a page curl up.
Here's the code I'm using:
UITableView *newTableView = [[UITableView alloc] initWithFrame:self.tableView.frame style:UITableViewStylePlain];

[newTableView reloadData]; // ineffective attempt to load data prior to transition

[UIView transitionFromView:self.tableView
            toView:newTableView
            duration:0.8
            options:UIViewAnimationOptionTransitionCurlUp
            completion:^(BOOL finished)
                {
                    [newTableView reloadData]; // needed
                    [self setTableView:newTableView];
                    [newTableView release];
                }];

The transition occurs, but the 'revealed' UITableView is just a plain unpopulated UITableView,  unless I force a reload of the data in the completion block.  Then, if I do that, I get the transition to an empty table, followed by a reload to show the intended data - not very nice.
How can I make it so that the table that is revealed already shows the required data? Thanks.

A: i guess this should work.
UITableView *newTableView = [[UITableView alloc] initWithFrame:self.tableView.frame style:UITableViewStylePlain];

[self setTableView:newTableView]; //until the table is set, there is no use reloading it
[newTableView reloadData]; // it should reload now and then animate

[UIView transitionFromView:self.tableView
            toView:newTableView
            duration:0.8
            options:UIViewAnimationOptionTransitionCurlUp
            completion:^(BOOL finished)
                {
                    [newTableView reloadData]; // needed
                    [self setTableView:newTableView];
                    [newTableView release];
                }];

u were missing [self setTableView:newTableView]; above reloadData. hope it helps. happy coding :)


text:
Q: RecyclerView itemView OnGlobalLayoutListener doesn't fire for all itemViews I have a RecyclerView in whose view holder constructor I'm adding an onGlobalLayoutListener as follows
public CustomViewHolder(final View itemView, Context context) {
    super(itemView, context);
    itemView.getViewTreeObserver().addOnGlobalLayoutListener(
        new ViewTreeObserver.OnGlobalLayoutListener() {
          @Override
          public void onGlobalLayout() {
            // Get height here
          }
     });
}

This fires for all itemViews that are visible on the screen, but as I scroll the recyclerView, it doesn't fire for the itemViews that start to appear on the screen. Why is that? How can I capture this listener for those items?

A: Register an OnLayoutChangeListener like this:
imageViewAvatar.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {

@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
       imageViewAvatar.removeOnLayoutChangeListener(this);
       // Get height here
}
});

A: You can use OnPreDrawListener instead of OnGlobalLayoutListener on ViewTreeObserver
    public CustomViewHolder(final View itemView, Context context) {
        super(itemView, context);
        ViewTreeObserver vto = getViewTreeObserver();
        vto.addOnPreDrawListener(
            new ViewTreeObserver.OnPreDrawListener() {
              @Override
              public boolean onPreDraw() {
                vto.removeOnPreDrawListener(this);
                // Get height here
                return true;
              }
         });
    }

Or in Kotlin:
        val vto = viewTreeObserver
        vto.addOnPreDrawListener(
            object: ViewTreeObserver.OnPreDrawListener {
                override fun onPreDraw(): Boolean {
                    viewTreeObserver.removeOnPreDrawListener(this)
                    //Your code
                    return true
                }
            }
        )


text:
Q: How to efficiently read a predicate logic formula (best practices) This no question about how to understand a predicate logic proposition in general, it's about fast understanding such a proposition.
E.g. as a simple example, the convergence definition for $(a_n)_{n\in \mathbb{N}}$ with $a_n\in M$ (for all $n\in \mathbb{N}$ ; $M$ ordered ; e.g. $M=\mathbb{R}$ ) is
$\exists a\in M \forall \epsilon \in M_{>0} \exists N\in \mathbb{N} \forall n\in \mathbb{N}\colon n\ge N \implies |a_n -a|<\varepsilon $
When you read something like that (unknown to you): What is your approach?
So far, mine is the following:
Part 1: The part, that does include the quantifier declations. (e.g. "$\exists a\in M \forall \epsilon \in M_{>0} \exists N\in  \mathbb{N} \forall n\in \mathbb{N}$"
Part 2: The part, that does not include the quantifier declrations.  (e.g. "$n\ge N \implies |a_n -a|<\varepsilon $")
a) Directly read the formula as it is:

*

*Look very shortliy at part 1 to get a short impression of the quantifiers (mostly to see what variables are used).

*Read part 2.

*Look closely to the part 1 again and read it carfully from right to left. While doing that, i look from time to time to part 2 again, to see how the read variable is used in context of part 2.
b) Transform the formula:
If the formula appears to be too "chaotic" for me, i transform it to an equivalent predicate logic propositions which composes of a declaration part (part 1) and a coresponding part (part 2). After that i do a).
My questions now are:

*

*What is your approach/procedure to read a (new to you) formula efficiently?

*Do you occasionally transform the formula in a better readable formula?
And if yes: How do you transform (e.g. do you also separate the declaration part of the other part; do you write the discure universum conditions alltogether in the declaration part [e.g. short $\forall n \in \mathbb{N}\ge N$])?

A: The best solution to the problem is not to create the problem.  Write formulas in a readable way.  You might have to rewrite it yourself.
1) Don't use the variable "a" to refer to 2 different things.  Avoid using $n/N/\mathbb N$ to refer to different things.  Sometimes a convention helps, something like upper case for sets (and maybe sequences), lower case for primitive values.
2) Don't try to shove everything into 1 formula.  Give different names to different concepts.
$$\exists l \in M~ \forall \varepsilon \in M_{>0} ~\exists k \in \mathbb{N} ~\forall j \in \mathbb{N} ~\colon~ j \ge k \implies |a_j - l|<\varepsilon$$
Break it up:
Eventuality: $E(a, P) = \exists k \in \mathbb N ~ \forall j \in \mathbb N ~:~ j \ge k \implies P(a_j)$ : "Eventually every value in a sequence has property P"
Boundedness : $B(a, l) = \forall \varepsilon \in M_{>0} ~:~ E(a, a_j \mapsto |a_j - l| < \varepsilon)$ : "For every deviation $\varepsilon$, (eventually every value in a sequence has property) that it is within $\varepsilon$ of L".
Existance : $F(a) = \exists l ~:~ B(a, l)$ : "There exists a limit L such that (for every deviation $\varepsilon$, (eventually every value in a sequence has property) that it is within $\varepsilon$ of L)"
You probably will have to start with the first part of the formula that makes sense, and go from there.  It could be inside out, or left to right, or right to left.


text:
Q: Scale_fill_manual using column of a dataframe Using ggplot2 I want to plot a barplot using colors included in the column of that dataframe
Reproducible example below:
df<-cbind.data.frame("bar_colors"=c("red","blue","green"), "Counts"=c(10,20,30), "Spp"=c("a","a","a"))

ggplot(data=df, aes(x=Spp,y=as.numeric(as.character(Counts)), fill=bar_colors)) +
  geom_bar(stat="identity")+scale_fill_manual(values = as.character(df$bar_colors))

But the colors are mixed-up. What do I miss?
Thanks
EDIT:
Solved myself by releveling the factor:
df$bar_colors<-factor(df$bar_colors, levels = as.character(df$bar_colors))


text:
Q: Showing for $n=pq$, s.t $p,q$ primes, there is $a$ mod $(\bmod n)$ s.t. $a^{(n-1)/2} \neq (\frac{a}{n})$, where $(\frac{a}{n})$ is a Jacobi symbol I'd really love your help with the following question:
For $n= pq$, where $p, q$ are both distinct odd prime  numbers. I need to show that there is  unit $a$ modulo $n$ such that $a^{(n-1)/2} \not\equiv (\frac{a}{n}) \bmod n$, where $\left(a\over n\right)$ is a Jacobi symbol.
I chose $a \equiv 1 (\bmod p)$ so we get  that $a^{(q-1)/2} \equiv 1 (\bmod p)$ since $(q-1)/2$ is a positive integer.
 I feel it should follow from here that $a^{(q-1)/2} \equiv  \left(a\over q\right)\equiv -1 (\bmod q)$, but I can't prove it to myself, why would it be correct? I'm missing something.
With this I get that $\left(a\over n\right)\equiv -1 (\bmod q)$, and I am done, since $a=a^{(n-1)/2}=1 (\bmod q)$ so I get that $a^{(n-1)/2} \neq \left(a\over n\right) (\bmod q)$ and also for $\bmod n$ since $p|n$.
Thanks

A: Take $\,p=3\,,\,q=5\,,\,a=4=1\pmod 3\,$ , then
$$a^{\frac{q-1}{2}}=16=\left\{\begin{array}{} 1 \pmod 3\\1\pmod 5\end{array}\right.=1\pmod{15}$$so what you "you feel" it is implied is just not true.
Nevertheless, and following your argument, we see we need in element $\,a\in\left(\mathbb Z/pq\mathbb Z\right)^*\,$ as $\,a\,$ that you described, but it won't be that trivially easy found...so it won't be that hard to find, either.
What didn't work with the above example? That we chose an element that was both a square modulo $\,p\,$ and modulo $\,q\,$, so we must avoid this.
So assume $\,p<q\,$ . Since there are $\,\displaystyle{\frac{r-1}{2}}\,$ non-zero squares modulo any prime $\,r\,$, we see we can always choose and element $\,a\,$ s.t. $$\left(a\over p\right)=-\left(a\over q\right)$$
In the example above, $\,2\,$ works:
$$2^{\frac{15-1}{2}}=\left(2^4\right)2^3=1\cdot 2^3=8\neq -1=\left(2\over {15}\right)$$
Hopefully the above is what you meant and this will help you.
Added This addition comes trying to address Erick's comments below.
As already said, for any prime $\,r\,$ there are exactly $\,\displaystyle{\frac{r-1}{2}}\,$ non-zero quadratic residues modulo $\,r\,$, which is exactly half of the non-zero elements of the field $\,\mathbb F_r:=\mathbb Z/r\mathbb Z\,$.
Now, for $\,a\in\mathbb Z/n\mathbb Z\,\,,\,\,n=pq\,$ , we have
$$1=\left(a\over pq\right)=\left(a\over p\right)\left(a\over q\right)\Longrightarrow$$either $\,a\,$ is a quadratic residue modulo both $\,p\,,\,q\,$ or else it is a non-quadratic residue modulo both $\,p\,,\,q\,$ .
In particular, if $\,a\,$ is a quadratic residue modulo $\,n\,$, then it must be a quadratic residue modulo both $\,p\,,\,q\,$ . As any quadratic residue modulo a prime has two different square roots, we get that any quadratic res. modulo $\,n\,$ has 4 different roots (this is easily obtained applying the Chinese Remainder Theorem), and since any element in $\,\left(\mathbb Z/n\mathbb Z\right)^*\,$ is a square root of some element, if we denote the set of quadratic res. modulo $\,n\,$ by $\,Q_n\,$, we get
$$|Q_n|=\frac{\left|\left(\mathbb Z/n\mathbb Z\right)^*\right|}{4}=\frac{(p-1)(q-1)}{4}$$
We want to prove the existence of an element  $\,a\in\left(\mathbb Z/n\mathbb Z\right)^*\,$ s.t. $\,\displaystyle{\left(a\over p\right)=-\left(a\over q\right)}\,$ , but if we put
$$NQ_n:=\left\{b\in \left(\mathbb Z/n\mathbb Z\right)^*\;\;;\;\;\left(b\over p\right)=\left(b\over q\right)=-1\right\}$$
this follows from the fact that
$$|Q_n|=|NQ_n|$$ as there's the same number of quadratic and non-quadratic res. modulo a prime, so we're left with
$$\frac{\left|\left(\mathbb Z/n\mathbb Z\right)^*\right|}{2}$$elements that are either quadratic residues modulo $\,p\,$ or modulo $\,q\,$ but not both, and any of these will do.
Please do not hesitate to make any comment if you see any mistake or "weird" thing above.


text:
Q: How would I get the last "date" from a JSON file? I have a JSON file. The entries in the file may not be in order.
How would I get the last calendar date entry.
The JSON file looks like
[
    {
        "name": "Vacant",
        "date": "02/6/2017",
        "title": "Division Manager",
        "mondayAM": "Main Campus AM",
        "mondayPM": "Main Campus PM",
        "tuesdayAM": "Main Campus AM",
        "tuesdayPM": "Main Campus PM",
        "wednesdayAM": "Main Campus AM",
        "wednesdayPM": "Main Campus PM",
        "thursdayAM": "Main Campus AM",
        "thursdayPM": "Main Campus PM",
        "fridayAM": "Main Campus AM",
        "fridayPM": "Main Campus PM",
        "saturdayAM": "Main Campus AM",
        "saturdayPM": "Main Campus PM"
    },
    {
        "name": "Vacant",
        "date": "02/13/2017",
        "title": "Division Manager",
        "mondayAM": "Main Campus AM",
        "mondayPM": "Main Campus PM",
        "tuesdayAM": "Main Campus AM",
        "tuesdayPM": "Main Campus PM",
        "wednesdayAM": "Main Campus AM",
        "wednesdayPM": "Main Campus PM",
        "thursdayAM": "Main Campus AM",
        "thursdayPM": "Main Campus PM",
        "fridayAM": "Main Campus AM",
        "fridayPM": "Main Campus PM",
        "saturdayAM": "Main Campus AM",
        "saturdayPM": "Main Campus PM"
    },
    {
        "name": "Vacant",
        "date": "02/20/2017",
        "title": "Division Manager",
        "mondayAM": "Main Campus AM",
        "mondayPM": "Main Campus PM",
        "tuesdayAM": "Main Campus AM",
        "tuesdayPM": "Main Campus PM",
        "wednesdayAM": "Main Campus AM",
        "wednesdayPM": "Main Campus PM",
        "thursdayAM": "Main Campus AM",
        "thursdayPM": "Main Campus PM",
        "fridayAM": "Main Campus AM",
        "fridayPM": "Main Campus PM",
        "saturdayAM": "Main Campus AM",
        "saturdayPM": "Main Campus PM"
    },
    {
        "name": "Vacant",
        "date": "02/20/2018",
        "title": "IT Division Manager",
        "mondayAM": "Main Campus AM",
        "mondayPM": "Main Campus PM",
        "tuesdayAM": "Main Campus AM",
        "tuesdayPM": "Main Campus PM",
        "wednesdayAM": "Main Campus AM",
        "wednesdayPM": "Main Campus PM",
        "thursdayAM": "Main Campus AM",
        "thursdayPM": "Main Campus PM",
        "fridayAM": "Main Campus AM",
        "fridayPM": "Main Campus PM",
        "saturdayAM": "Main Campus AM",
        "saturdayPM": "Main Campus PM"
    }
]

Please let me know if there is a quick way of finding out using LINQ
The only pattern for the date is that it will always be a Monday.
My CalendarModel.cs File
class CalendarModel
{
        [JsonProperty("name")]
        public string name { get; set; }

        [JsonProperty("date")]
        public string date { get; set; }

        [JsonProperty("title")]
        public string title { get; set; }

        [JsonProperty("mondayAM")]
        public string mondayAM { get; set; }

        [JsonProperty("mondayPM")]
        public string mondayPM { get; set; }

        [JsonProperty("tuesdayAM")]
        public string tuesdayAM { get; set; }

        [JsonProperty("tuesdayPM")]
        public string tuesdayPM { get; set; }

        [JsonProperty("wednesdayAM")]
        public string wednesdayAM { get; set; }

        [JsonProperty("wednesdayPM")]
        public string wednesdayPM { get; set; }

        [JsonProperty("thursdayAM")]
        public string thursdayAM { get; set; }

        [JsonProperty("thursdayPM")]
        public string thursdayPM { get; set; }

        [JsonProperty("fridayAM")]
        public string fridayAM { get; set; }

        [JsonProperty("fridayPM")]
        public string fridayPM { get; set; }

        [JsonProperty("saturdayAM")]
        public string saturdayAM { get; set; }

        [JsonProperty("saturdayPM")]
        public string saturdayPM { get; set; }

 }

A: Your question (currently) does not contain a lot of information, so this is something of a guess.  If your question is updated and is actually about the JSON processing itself, I will most likely delete this answer.
I am going to assume that you are somehow processing your JSON into a list of objects similar to this:
public class ScheduleEntry
{
    public string Name
    {
        get;
        set;
    }

    public DateTime DateStamp
    {
        get;
        set;
    }

    // Plus the rest of the properties
}

Assuming that you have some kind of processing method, you would simply have something like this:
private void ProcessSchedule()
{
    List<ScheduleEntry> scheduleList = new List<ScheduleEntry>();

    // [Processing from JSON Done Here]

    // [Done Processing]

    DateTime maxDate = scheduleList.Max(o => o.DateStamp);
}