text:
Q: Error in Assembly masm linker 'link: extra operand' I installed masm for assembly programming but i have problem with link below code
.586
.MODEL FLAT
.STACK 4096
INCLUDE io.h

.DATA
prompt      BYTE "shalgham", 0

.CODE
_main       PROC
            output  prompt

            mov     eax, 0
            ret
_main       ENDP
END

when i assemble above code by commandLine every thing is ok
but when i want to link it below error will be print in commandLine
C:\Users\mahdi\Desktop\New folder>ml /c /coff simple.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: simple.asm

C:\Users\mahdi\Desktop\New folder>link /subsystem:console /entry:main simple.obj
 io.obj Kernel32.Lib
link: extra operand `simple.obj'
Try `link --help' for more information.

And when i use visual studio 2010 below error will be printed.
1>InitializeBuildStatus:
1>  Touching "Debug\console32.unsuccessfulbuild".
1>_MASM:
1>  Assembling [Inputs]...
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>temp.obj : error LNK2001: unresolved external symbol itoaproc
1>temp.obj : error LNK2001: unresolved external symbol atoiproc
1>temp.obj : error LNK2001: unresolved external symbol dtoaproc
1>temp.obj : error LNK2001: unresolved external symbol atodproc
1>temp.obj : error LNK2001: unresolved external symbol inproc
1>temp.obj : error LNK2019: unresolved external symbol outproc referenced in function _main
1>E:\programming\assembly\VS2010_files\console32\Debug\console32.exe : fatal error LNK1120:     6 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:06.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

before asking this question i search it very but not solution found

A: Although this question was answered by @Michael, I would like to make it clear.
We have to put the CYGWIN path stand behind the MS Visual Studio path.
 Path=....C:\Program Files (x86)\Microsoft Visual Studio\VC98\bin;C:\cygwin\bin

Open Windows command prompt:
cmd
link --help

Make sure:
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


text:
Q: Time delay between two function call I need to call two functions where the second function need to wait for the first function to finish its execution and to be delayed by 10 seconds. What I have in mind that after the fist function finished and after 10 seconds has passed, only then the second function should be invoked. It is an apex code related question.

A: In apex you can not have wait time. You can not suspend a thread. If you use while loop to create such time gap then you may face 10 seconds transaction time limit. I would suggest you make use of visual force page and have your control returned to page and then via JavaScript call your second function after 10seconds.

A: You can use action function to delay the invoking method only if you are using visual force page. In Apex there is no function to delay the code execution. You can use loop something like this but it's not a best practice to do it.
Integer start = System.Now().millisecond();
        while(System.Now().millisecond()< start+10){
        }

There is an idea posted for this function but Salesforce does not seem to implement it asIn the mutli-tenant world, a sleeping thread is one that cannot be used by another customer.  If this happens once and again, yeah, it's fine.  But, if used poorly, this could harm our service.
https://success.salesforce.com/ideaview?id=08730000000Bq2HAAS

redpajama_set_name: RedPajamaStackExchange


text:
Q: Retrieve percentile of a specific value in SQL column Let's say I know I have a specific value in an SQL column, and I want to determine its percentile. Based on another SO post (https://dba.stackexchange.com/questions/13703/get-the-rank-of-a-user-in-a-score-table) I tried to modify this, which works but returns the rank of every value in the column:
mysql> SELECT FIND_IN_SET( sum_squares, (SELECT GROUP_CONCAT(sum_squares ORDER BY sum_squares DESC)                  |
    -> FROM entries)                                                                                |
    -> ) AS rank                                                                                |
    -> FROM entries;

As below:
+------+                                                                                |
| rank |                                                                                |
+------+                                                                                |
|    4 |                                                                                |
|    4 |                                                                                |
|    2 |                                                                                |
|    3 |                                                                                |
|    1 |                                                                                |
+------+

I tried to modify it by appending a WHERE statement before the FROM entries as below:
mysql> SELECT FIND_IN_SET( sum_squares, (SELECT GROUP_CONCAT(sum_squares ORDER BY sum_squares DESC)                  |
    -> FROM entries)                                                                                |
    -> ) AS rank
    -> ) WHERE sum_squares = 5                                                                                |
    -> FROM entries;

This leads to the following error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE sum_squares = 5
FROM entries' at line 4

Can someone explain to me why my query seems to be disallowed and if there is another way to do this? I'd rather not return the entire column!
Here's a sample entries table:
+----+-------------+
| id | sum_squares |
+----+-------------+
|  1 |           5 |
|  2 |           5 |
|  3 |          55 |
|  4 |          33 |
|  5 |         111 |
+----+-------------+

A: Here's what almost did it following @GordonLinoff's comment:
mysql> SELECT FIND_IN_SET( sum_squares, (SELECT GROUP_CONCAT( sum_squares ORDER BY sum_squares DESC)
    -> FROM entries HAVING sum_squares = 5)
    -> )  AS rank
    -> FROM entries

However this returns the answer in matching rows plus NULL in other rows, so I'd welcome improvements on this. Thanks.
+------+
| rank |
+------+
|    4 |
|    4 |
| NULL |
| NULL |
| NULL |
+------+

A: If you want the rank for a single entry, try this query:
SELECT COUNT(DISTINCT sum_squares) + 1
FROM entries
WHERE sum_squares > 5 ;


text:
Q: Include HTML webform in ASP/C# on page load I made a webform in html and I have a website in C#.
I would like this form to show up every time the page is loaded.
What is the best way to integrate/include/call the form?
Which pages I have to modify? Default.Aspx or Default.Aspx.cs?
The purpose of this project is to show this form everytime the cookies is not set in the aspx code.
Which I guess I have to modify the aspx part that checks if the value of the cookie is set or not and show/not show the webform based on this value.

A: You could do this using a combination of JavaScript (to check if cookies are enabled) and JQuery. If cookies aren't enabled, have a placeholder DIV that can hold the HTML content you wanted to show. Then use $.ajax (http://api.jquery.com/jquery.ajax/) to load the html content from browser and set the DIV's innerHTML property with the returned HTML.
Hope this works for you!!

A: Some little progress.
That's how I modified my pages for my needs. In this way the html webform is diplaying correctly.
In the head of default.master I added:

in the default.aspx I added:

with the entire html of my html page (tag html included).
Now I need to modify this page that in the way this pop up is showed only if a cookie value is not set.


text:
Q: Writing to Firebase Database from Sign Up Screen Error on Flutter I'm creating an app in Flutter using both the Firebase Authentication plugin as well as the RT Database plugin. The concept is that the user inputs some simple data such as their name, email, phone and password and signs up for an account. The authentication plugin saves the email and password for authentication later on the login screen (this works). What I want to have happen, however, is for the other data (specifically the name and email address) to be saved to the RT Database, which I will call on later on another screen in a list view. I'm using the "UID" and "authResult" as a means to accomplish this, however, I'm getting the following errors anywhere "uid" is in my code...
"The property 'uid' can't be unconditionally accessed because the receiver can be 'null'."

ElevatedButton(
child: Text('Sign Up'),
style: ElevatedButton.styleFrom(
fixedSize: Size(100, 10),
backgroundColor: const Color.fromRGBO(0, 33, 115, 2),
),
onPressed: () {
FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: emailController.text,
password: passwordController.text)
.then((authResult) {
var userProfile = {
'uid': authResult.user.uid,
'name': nameController.text,
'email': emailController,
};
                FirebaseDatabase.instance
                    .ref()
                    .child("students/" + authResult.user.uid)
                    .set(userProfile)
                    .then((value) {
                  print("Successfully created the profile information");
                }).catchError((error) {
                  print("Failed to create profile information");
                });
              }).catchError((error) {
                print('Failed to sign up user');
                print(error.toString());
              });
            },
          ),

I've tried using a null check, Flutter also suggests using ?. as well as interpolation. ?. cleared the error on the variable but not the Firebase instance. Using interpolation cleared the error on the FB instance but it didn't work.


text:
Q: Is it possible to get transparency on title bars in Windows 8, like Aero of Windows 7?
Possible Duplicate:
Aero Glass/Transparent window borders in Windows 8?

Is it possible to get transparency on title bars in Windows 8, like Aero was in Windows 7? My Chrome title bar is feeling super bright compared to Windows 7.

A: It is no longer officially supported. However, there are some applications which can bring back the aero look.
You can use:

*

*Registry hacks (buggy, and not recommended)

*Aero8Tuner (might also have bugs when moving transparent windows - I am not sure)

Sources:

*

*http://www.redmondpie.com/how-to-enable-and-customize-aero-glass-in-windows-8-video/

*http://www.youtube.com/watch?v=jWt94nGwzZ4

A: If the problem is the chrome bar being to bright you can change the themes from the chrome store


text:
Q: Is there a way to not copy custom field value when library item is copied? I use SharePoint Online.
I have a custom field created in a library.
My item has some custom data in that field.
User decides to make copy of that item.
Is there a way to prevent that custom data being copied into the new copy ?

A: This is by design that the column value will be copied if you have same column structure in the new destination library.
Currently, the way to avoid this is not to create the same custom column in the target library.


text:
Q: With repetition, no order. Probability of drawing atleast 18 distinct balls, when there are 20 different balls and one has 50 draws? I came up with this today, however I could not figure out a solution to this problem.
Say, you have a pool of 20 different balls. Therefore, the probability of drawing one of the balls is equal to drawing any other. Also, you have 50 draws.
Our variables so far are:
n=20 (# of balls)
k=50 (# of moves)
p=5% (% of a certain ball).
Obviously, the number of combinations in this problem is: nCr(20+50-1;50).
Additionally, in the a-th draw the probability of drawing a yet undrawn ball is: (1-p)^a.
Could you please explain to me what the solution to this problem is and how it works? I am looking forward to reading your answers and thanks in advance.

A: It may be easier to find the probability that there are not at least 18 distinct balls in the set of 50 draws, i.e. that there are three or more balls which do not appear.
There are $20^{50}$ possible sequences of 50 draws, all of which we assume are equally likely.  We would like to count the number of sequences in which three or more balls do not appear.  To that end, we use an extension of the Principle of Inclusion and Exclusion (PIE).  Reference: An Introduction to Probability Theory and Its Applications by William Feller, Volume I, Third Edition, Section IV.5(a), "The Realization of at Least $m$ Events".
To apply PIE, let's say a sequence of 50 draws has "Property $i$" if ball $i$ does not appear in the sequence, for $1 \le i \le 20$.  We define $S_j$ to be the number of sequences with $j$ of the properties, for $1 \le j \le 20$.  If $j$ of the balls do not appear, then there are $\binom{20}{j}$ ways to pick the missing balls, and then there are $(20-j)^{50}$ possible sequences of the remaining balls.  So
$$S_j = \binom{20}{j} (20-j)^{50}$$
The extension of PIE we will use is that the number of sequences with at least $m$ of the properties is
$$N_m=S_m - \binom{m}{m-1} S_{m+1} + \binom{m+1}{m-1}S_{m+2} - \binom{m+2}{m-1}S_{m+3} + \dots \pm \binom{N-1}{m-1}S_N$$
In our case we have $m=3$ and $N=20$, so
$$N_3=S_3 - \binom{3}{2} S_{4} + \binom{4}{2}S_{5} - \binom{5}{2}S_{6} + \dots - \binom{19}{2}S_{20}=1.98074 \times 10^{64}$$
The probability that three or more balls do not appear in the sequence of 50 draws is
$$\frac{N_3}{20^{50}} = 0.175925$$
and the answer to the original problem, the probability that at least 18 balls appear, is
$$1-0.175925=\boxed{0.824075}$$


text:
Q: No LogCat output from AVD? When I start my avd and deploy my application, there is no output being send to LogCat, any thoughts of how to fix this? When it happens I just re-make the project and add all the files. Is there any way to force the logcat tab to grab output from a specific avd?

A: focus your app in Devices in Windows/ Show View


text:
Q: how can I simplify these pair of equations (2 variable equations) to eliminate one of the variables?
How can I simplify these equations to eliminate one of the variables?
$$0.5 = \dfrac{xe^{0.7(1-x)^2}75v}{60} + x(1-v)\\
0.5 = \dfrac{(1-x)e^{0.7x^2}35v}{60} + (1-x)(1-v)$$


text:
Q: What's an appropriate response to a British person asking "You alright?" I've heard this phrase from various British people: "You alright" (comes out as a slurred "y'rite") and I'm always a bit confused on how to respond. From context, it seems to have two meanings (correct me if I'm wrong):

*

*equivalent to an American saying "How are you" in passing

*are you being served / can I help you, e.g. from the barman at a pub

In case 1, is it expected of me to say "yes" as in, yes, I'm alright, which would be equivalent to saying I'm fine in response to the American "how are you"?
And then should I ask "are you alright" back, as I would if I were saying I'm fine, you? (in the US it would be a bit rude to say "I'm fine" without asking how about you...)
In the second usage, I haven't been helped yet, should I say "no"?

A: You are correct, there are two meanings which you mention.  The first one has a couple of possible responses:
1 - yes, yeah or something else short and semi-positive
2 - a response of 'alright' itself can be appropriate for passing, which means "yes, thank you, and yourself?'  That could just be a Northern thing though.
For the barman/waitress/service person, you can either keep things short as per the point above, or you can engage them in your request/order to facilitate teh service.

A: Part of the key to this is matching the length of response to the length of greeting. 'y'alright?' or just 'alright' tends to be said as an acknowledgement in passing and mostly isn't a conversation opener or and invitation to stop and chat. It can be, bt mostly isn't. You would judge this by whether the person slows/stops and how much they elide the phrase.
I first encountered this in the West Midlands/Black Country in the form of 'you'm a'right?', where the proper response seemed to be 'Ahh' (which is my rendering of the YamYam affirmative. I don't know the technical speech terms, but it is said far back in the mouth, with a hint of an 'r' and the mouth not very open. So it isn't like when you say 'Ahh' at the Doctor's. In fact, I'm getting funny looks here, you sort of drop and retract the lower jaw to pronounce it properly.
Anyway, all it means is 'yes'.)
Now that I'm back in Scotland I reply with 'Aye', and it's quite easy to elide that with a questioning 'you?' to return the question if there seems to be time. if someone is striding down a corridor without pause, you don't bother with the 'you?'
I really don't know what the proper reply would be in parts of the UK where the standard word for 'yes' is 'yes', somehow it seems to clipped to work, perhaps its more of a 'yeah'? That would also elide with 'you?' quite well.
Actually, my increasing view on this over the years is that it is sufficient to make a vowel sound, it needn't be a word.
Of course if it is all a little more formal and your interlocutor pauses and
says clearly 'How are you, alright?' don't just grunt.
If the question is coming from a barman, don't say 'No' if you haven't been served yet, that risks seeming rude and confrontational. Just make a pleasantry and give your order. I

A: Although "Y'alright" may sound like a question and is delivered as a question, it is not a question. It is simply a greeting. The best way to respond is to just say "Hi" and maybe ask how the person is.
In the case of the barman, if he asks "Y'alright?" he is literally asking if you are alright and if you need a drink. The best way to respond would be to say hello and order.


text:
Q: Failed to set session cookie phpmyadmin I configure my phpadmin with nginx and I have a problem to login. my phpadmin version 4.9.5 my php version PHP 7.4.3 .
it work when I try to change $cfg['Servers'][$i]['auth_type'] in /etc/phpmyadmin/config.inc.php with 'http' or 'config'
$cfg['Servers'][$i]['auth_type'] = 'http';
but with cookie $cfg['Servers'][$i]['auth_type'] = 'cookie'; not working and return Failed
to set session cookie Maybe you are using HTTP instead of HTTPS .I search I
found clear browser ...but it is not a solution

A: The problem is the extension Selenuim IDE in my browsers google Chrome and Mozilla firefox. now it work when I disabled the extension


text:
Q: Thunderbird doesn't show embedded images in email I'm using the following code (C#) to embed an image into an html email:
Bitmap image = new Bitmap();
// set something to image
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Jpeg);
ContentType contentType = new ContentType(MediaTypeNames.Image.Jpeg);
ms.Seek(0, SeekOrigin.Begin);
Attachment attachment = new Attachment(ms, contentType);
attachment.ContentId = "image@email";

MailMessage mail = new MailMessage();
mail.From = new MailAddress("...");
mail.To.Add("...");
mail.Subject = "...";
mail.Body = body; // view below
mail.IsBodyHtml = true;
mail.Attachments.Add(attachment);
smtpClient.Send(mail);
ms.Close();

here the relevant part of the html body:
<img align='center' alt='' src='cid:image@email' width='100' style='padding-bottom: 0; display: inline !important; vertical-align: bottom;'>";

Viewing the email on the gmail website it looks correct: i.e. the image is embedded into the html body.
Instead, using Thunderbird the image is received as an attachment, but not recognized as jpg. The attachment is named "Part 1.2". If I double click on it the image is opened with the default image viewer installed on the computer.
What I need to add in order to correctly send embedded images in a way that is compatible with the most common email readers?
UPDATE
To name the attached image is enough to add the following:
attachment.Name = "name.jpg";

Still Thunderbird refuses to show it inside the html.

A: As Scarnet pointed out, this is the right way to place an embedded image into an html email:
AlternateView view = AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html);
LinkedResource inline = new LinkedResource(filename, MediaTypeNames.Image.Jpeg);
inline.ContentId = "image@email";
view.LinkedResources.Add(inline);

MailMessage mail = new MailMessage();
mail.From = new MailAddress(username);
mail.To.Add(address);
mail.Subject = subject;
mail.IsBodyHtml = true;
mail.AlternateViews.Add(view);
await smtpClient.SendMailAsync(mail);


text:
Q: props not working inside normal javascript function .Cannot read property 'props' of undefined Here is my code.
var i = 0;

function myLoop() {
    let xhr1 = new XMLHttpRequest();
    xhr1.open('GET', data.data[0].sideList[i].sideSvg);
    xhr1.onload = () => {
        document.getElementById("configurator_side_" + i)
            .appendChild(xhr1.responseXML.documentElement);
        i++;
        this.props.dispatch(storeActions.setSideThumbSvg());
        if (i < data.data[0].sideList.length) {
            myLoop();
        }
    };
    xhr1.send();
}

myLoop();

I think "this" keyword is not accessible inside normal javascript. Please suggest .

A: In your constructor bind that function to your current class ,
as below :
constructor( props ){
    super( props );
    this.myLoop = this.myLoop.bind(this);
}

function myLoop() {

    // self = this;
    let xhr1 = new XMLHttpRequest();
    xhr1.open('GET', data.data[0].sideList[i].sideSvg);
    xhr1.onload = () => {
        document.getElementById("configurator_side_" + i)
            .appendChild(xhr1.responseXML.documentElement);
        i++;
        this.props.dispatch(storeActions.setSideThumbSvg());
        if (i < data.data[0].sideList.length) {
            myLoop();
        }
    };
    xhr1.send();
}


text: Q: Android How to implement save pdf file as GMail I need to get path while saving pdf. It is implemented on GMail via Standart file explorer. Moreover there are inputs which is file name and save button. How can i do the same. Thanks in advance!


text:
Q: How is Auto-Suggestions implemented in Android? I am trying to see in android source code as how exactly auto-suggestion is implemented. For example, editable compose textview in messaging application shows suggestions when we start typing. I understand that input method displays the dictionary-based candidates. But, from where exactly it  fetches the suggestions ? Is there any dictionary database ?  I don't see any code where it fetches words from any source.

A: Try google first..:
http://blog.jamware.biz/2009/11/android-development-how-to-add-auto.html


text:
Q: passing all init variables to self Is there a standard way to pass all arguments defined in __init__() to the whole class (as self arguments)?
For example in my program I usually do it like this:
class DummyClass():
   def __init__(self,x,y,z):
      self.x = x
      self.y = y
      self.z = z
      ...

Is there a way to do the same without individually passing each argument? I think I saw once a similar thing with super().

A: As per this answer you can do this:
class X(object):
    def __init__(self, x, y, z):
        vars = locals() # dict of local names
        self.__dict__.update(vars) # __dict__ holds and object's attributes
        del self.__dict__["self"] # don't need `self`

A more pythonic answer is to use a dataclass
@dataclass
class X:
    x: float
    y: float
    z: float


text:
Q: Is it possible to use GCC's '__builtin_avr_delay_cycles' in the assembler? Sory for bad English, please.
I need write a time-critical piece of code (a strict part of software protocol implementation via bit-bang) that uses delays. C preprocessor at the compile time can compute the number of clock cycles (with F_CPU macro) for a delay, so I need to implement a assembler delay code for unknown number of cycles.
But GCC provide very useful function __builtin_avr_delay_cycles(unsigned long cycles) that make delay exactly cycles clock cycles for defined F_CPU frequency.
Question. Is there way to use __builtin_avr_delay_cycles within inline-assembler code?
Note. Bypass way is like this:
__asm__ (...);
__builtin_avr_delay_cycles(...);
__asm__ (...);

but the compiler can make some code around __asm__ pieces. It is bad for me, I need to control each clock cycle.

A: __asm__ (...);
__builtin_avr_delay_cycles(...);
__asm__ (...);

Compile the code like this and then look at what the compiler emitted for the builtin.
It will be a sequence very similar to the following:
   ldi R2,lo8(N)
   ldi R3,hi8(N)
   ldi R4,hlo8(N)
1: subi R2,1
   sbci R3,0
   sbci R4,0
   brne 1b"

There may be a 2-3 such sequences, sometimes ending with nopv insn, sometimes there will be 1 or 2 or 3 ldi and sbci insns, you get the pattern (it depends on the cycles count).
Turn these insns into inline assembly, N is the cycles count, Rn are registers.
The drawback is that generated code depends on the cycle count and if it changes, you'll have to repeat the process. However, you're safe if the change is within one of the following ranges:  [83886082, 0xFFFFFFFF], [262145, 83886081], [768, 262144], [6, 767].

A: No, compiler built-ins are not real functions and cannot be called from assembler, nor will the compiler recognise them within assembler.


text:
Q: Why does my site work using Jekyll 1.4.3 but not Jekyll 2.0.2? After upgrading my web application based on Jekyll 1.4.3 to Jekyll 2.0.2, my home page does not incorporate the specified layout file.
Here are the steps to reproduce:
Download https://github.com/morea-framework/basic-template/tree/jekyll-2.0.

This is the jekyll-2.0 branch of my web application, which is a stripped down version to illustrate the problem. If you clone the repo, be sure to switch to the jekyll-2.0 branch.
gem uninstall jekyll
gem install jekyll -v '1.4.3'

This installs the version of jekyll in which the site builds correctly.  For reasons not apparent to me, I ran into problems when I had both 1.4.3 and 2.0.2 installed simultaneously.
cd basic-template/master/src
jekyll serve --baseurl ''

This brings up my web application. If you now go to http://localhost:4000, you should see:

Now control-c to stop the application, and invoke:
gem uninstall jekyll
gem install jekyll
jekyll serve --baseurl ''

These three commands uninstalls Jekyll 1.4.3, installs Jekyll 2.0.2, and reruns Jekyll. Now if you refresh http://localhost:4000, you should see:

As you can see, the CSS styling is no longer present. That's because the layout specified in the Front Matter has for some reason not been included.
Can anyone tell me why my code no longer works correctly under Jekyll 2.0.2?

A: Your post references the post.html layout in it's front matter, which in turn references the default layout. The default layout doesn't exist in your _layouts folder:
https://github.com/morea-framework/basic-template/blob/jekyll-2.0/src/_layouts/post.html
You should always have a default layout.


text:
Q: Android socket app crash I want my app to connect to a server. I only want the client.
protected void onCreate(Bundle savedInstanceState) {
    //...
    try {
             InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
             socket = new Socket(serverAddr, REDIRECTED_SERVERPORT);

    } catch (UnknownHostException e1) {
         //...
    } catch (IOException e1) {
         //...
    }
}

But the application just crashes. I started this activity by pressing a button.
Do you know what the problem could be?

A: You need to perform all your blocking processes in a Thread, and release the main UI Thread, for example:
protected void onCreate(Bundle savedInstanceState) {
    //...
    new Thread(){
        public run(){
            try {
                InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
                socket = new Socket(serverAddr, REDIRECTED_SERVERPORT);
            } catch (UnknownHostException e1) {
                //...
            } catch (IOException e1) {
                //...
            }
        }
    }.start();
}


text:
Q: Title: Reload page get json text in Node.js using angular Let say from index page , I move to detail page (http://localhost:8080/posts/1) with template.
The problem is when I reload detail page, the screen displays json text like this:
{"id":1,"title":"foo","teaser":"foo"}

Why I have json text instead of the page the same as beginning?
server.js file:
var express = require('express'),
    app     = express(),
    lastId  = 4;

var posts = [
    { id: 1, title: 'foo', teaser: 'foo' },
    { id: 2, title: 'bar', teaser: 'bar' },
    { id: 3, title: 'foobar', teaser: 'foobar' },
    { id: 4, title: 'baz', teaser: 'baz' }
];

function getPostIdx (id)
{
    for (var i = posts.length - 1; i >= 0; i--) {
        if (posts[i].id === id)
            return i;
    }
    return null;
}

app.use('/', express.static(__dirname + '/public'));
app.use(express.bodyParser());

app.listen(8080, function () {
    console.log("server listen on port 8080");
});

app.get('/', function (req, res) {
    res.send(JSON.stringify(posts));
});

app.get('/posts/:postid', function (req, res) {
    var postIdx = getPostIdx(parseInt(req.params.postid)),
        post    = posts[postIdx];
        res.send(JSON.stringify(post));
});

app.js file:
var resourceDemo = angular.module('resourceDemo', ['ngResource', 'ngRoute']);

resourceDemo.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(true);

    $routeProvider
    .when('/', {
        templateUrl: '/partials/index.html',
        controller: 'MainCtrl'
    })
    .when('/posts/:postid', {
        templateUrl: '/partials/detail.html',
        controller: 'DetailCtrl',
        resolve: {
            post: function ($route, Post) {
                return Post.get({ postid: $route.current.params.postid }).$promise;
            }
        }
    })
    .otherwise({
        redirectTo: '/'
    });
}]);

resourceDemo.factory('Post', function ($cacheFactory, $resource) {
    var Post = $resource('/posts/:postid', {}, {
        get: { cache: true, method: 'get'}
    });
    return Post;
});

resourceDemo.controller('MainCtrl', function ($scope, Post) {
    $scope.posts = Post.query();
});

resourceDemo.controller('DetailCtrl', function ($scope, post, Post) {
    $scope.post = post;
});

index.html file:
<!DOCTYPE html>

    <base href="/">
    <meta charset="UTF-8">
    <title>Resource</title>

Resource demo


text:
Q: Flutter - how to avoid inserting duplicate entries in sqflite database i am new to flutter i am trying to build a news app i am displaying a list of news from json url and when the save icon button is clicked the news is saved to readlater file
when the save icon button is clicked twice then it is adding duplicate entries in database.
how to avoid it
expected result when clicked for the first time it should add the news to readlater and when clicked again it should delete it from the readlater.dart file
thanks in advance.
below is the code where i am saving and displaying the news title and its description(file name is news_detail.dart);
class Newsdetail extends StatefulWidget {
  String  value_image, value_description, value_title;
  List value_datalist;
  int value_index;
  String newsId;

  Newsdetail(
      {this.value_image,
        this.value_description,
        this.value_title,
        this.value_datalist,
        this.value_index,
        this.newsId,
      });

  @override
  _newsdetail createState() => _newsdetail(value_title,value_image,value_description,value_datalist,value_index,newsId);
}

class _newsdetail extends State<Newsdetail> {
  String  image, description, title;
  List<News> datalist;
  int v_index;
  bool _isLoaded = false;
  String idNews;
  final dbHelper = DatabaseHelper.instance;

  List<Read> cars = [];

  _newsdetail(this.title,this.image,this.description,this.datalist,this.v_index,this.idNews);
  double custFontSize = 22;
  void increaseFontSize() async{
    setState(() {
      custFontSize+=2;
    });
  }

  void decreaseFontSize() async{
    setState(() {
      custFontSize-=2;
    });
  }

  @override
  void initState() {
    super.initState();
    print(widget.newsId);
  }

  _openFacebook() async {
    //FlutterShareMe().shareToFacebook(url: "https://www.kutchmitradaily.com/article.aspx?news_id="+
    //widget.newsId);
  }

  _openTwitter() async {
    var response = await FlutterShareMe().shareToTwitter(url: "https://www.kutchmitradaily.com/article.aspx?news_id="+
        widget.newsId);
    if (response == 'success') {
      print('navigate success');
    }
  }

  _openWhatsapp(){
    FlutterShareMe()
        .shareToWhatsApp(base64Image: "$image",msg: "$title\n\n" +
        "https://www.kutchmitradaily.com/article.aspx?news_id="+
        widget.newsId + "\n via Kutchmitra App (Download Now):" + "\n https://play.google.com/store/apps/details?id=com.webpioneer.kutchmitra"
    );
  }

  void _insert(newsId, title, image, description) async {
    Client rnd = Client(newsId: newsId, newsTitle: title, newsImage: image, newsDescription: description);
    await DBProvider.db.newClient(rnd);
    print(newsId);
    print(title);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    onPreviousChange(){
      setState(() {
        image = datalist[widget.value_index-1].image;
        title = datalist[widget.value_index-1].title;
        description = datalist[widget.value_index-1].description;
        v_index = widget.value_index-1;
      });
      widget.value_index = v_index;
    }
    onNextChange(){
      setState(() {
        image = datalist[widget.value_index+1].image;
        title = datalist[widget.value_index+1].title;
        description = datalist[widget.value_index+1].description;
        v_index = widget.value_index+1;
      });
      widget.value_index = v_index;
    }
    return Scaffold(
      body: Stack(
        children: [
          SingleChildScrollView(
          scrollDirection: Axis.vertical,
          child: image.isNotEmpty ? Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 10.0),
                child: Row(
                  children: <Widget>[
                    Expanded(child:
                    Image.network("$image")),
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: <Widget>[
                          IconButton(
                              icon: Image.asset('images/facebook.png',),
                              padding: EdgeInsets.all(0.0),
                              onPressed: () {
                                _openFacebook();
                              }),
                          IconButton(
                            icon: Image.asset('images/twitter.png',),
                            padding: EdgeInsets.all(0.0),
                            onPressed: () {
                              _openTwitter();
                            },
                          ),
                          IconButton(
                            icon: Image.asset(
                              'images/whatsapp.png', width: 180.0,
                              height: 180.0,),
                            padding: EdgeInsets.all(4.0),
                            onPressed: () {
                              _openWhatsapp();
                            },
                          ),
                        ],
                      ),
                    ),
                    Expanded(child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 30,
                            child: FlatButton(
                                padding: EdgeInsets.all(0),
                                onPressed: (){
                                  increaseFontSize();
                                },
                                child: Text('A+',style: TextStyle(
                                    fontSize: 22.0,color: Colors.black
                                ),)),
                          ),
                        ),

                        Padding(
                          padding: EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 40,
                            child: FlatButton(
                              padding: EdgeInsets.all(0),
                              onPressed: (){
                                decreaseFontSize();
                              },
                              child: Text('A-',style: TextStyle(
                                  fontSize: 15.0,color: Colors.black
                              ),),

                            ),
                          ),
                        ),
                        Padding(
                          padding: EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 40,
                            child: FlatButton(
                              padding: EdgeInsets.all(0),
                              child: _isLoaded ? IconButton(
                                  icon: Icon(Icons.favorite),
                                  onPressed: () async {
                                    setState(() {
                                      _isLoaded = false;
                                    });
                                    _insert(widget.newsId,datalist[widget.value_index].title,datalist[widget.value_index].image, datalist[widget.value_index].description);
                                  }
                              ) : IconButton(
                                  icon: Icon(Icons.favorite_border),
                                  onPressed: () async {
                                    setState(() {
                                      _isLoaded = true;
                                    });
                                    _insert(widget.newsId,datalist[widget.value_index].title,datalist[widget.value_index].image, datalist[widget.value_index].description);
                                  }
                              ),
                            ),
                          ),
                        ),
                      ],
                    ))
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(15.0, 5.0, 10.0, 10.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: Text(
                        "$title",
                        style: TextStyle(
                            fontSize: custFontSize, fontWeight: FontWeight.bold),
                      ),
                    ),
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(15.0, 5.0, 10.0, 10.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                        child: Text(
                          "$description".replaceAll('
', '').replaceAll('\r', '').replaceAll('\n', '').replaceAll('\t', ''),
                          style: TextStyle(fontSize: custFontSize),
                        )),
                  ],
                ),
              ),
            ],
          ) : Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(left: 8.0,top: 100.0,right: 8.0,bottom: 8.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: <Widget>[
                          IconButton(
                              icon: Image.asset('images/facebook.png',),
                              padding: EdgeInsets.all(0.0),
                              onPressed: () {
                                _openFacebook();
                              }),
                          IconButton(
                            icon: Image.asset('images/twitter.png',),
                            padding: EdgeInsets.all(0.0),
                            onPressed: () {
                              _openTwitter();
                            },
                          ),
                          IconButton(
                            icon: Image.asset(
                              'images/whatsapp.png', width: 180.0,
                              height: 180.0,),
                            padding: EdgeInsets.all(4.0),
                            onPressed: () {
                              _openWhatsapp();
                            },
                          ),
                        ],
                      ),
                    ),
                    Expanded(child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 30,
                            child: FlatButton(
                                padding: EdgeInsets.all(0),
                                onPressed: (){
                                  increaseFontSize();
                                },
                                child: Text('A+',style: TextStyle(
                                    fontSize: 22.0,color: Colors.black
                                ),)),
                          ),
                        ),

                        Padding(
                          padding: EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 40,
                            child: FlatButton(
                              padding: EdgeInsets.all(0),
                              onPressed: (){
                                decreaseFontSize();
                              },
                              child: Text('A-',style: TextStyle(
                                  fontSize: 15.0,color: Colors.black
                              ),),

                            ),
                          ),
                        ),

                        Padding(
                          padding: EdgeInsets.fromLTRB(0,0,0,0),
                          child: SizedBox(
                            width: 40,
                            child: FlatButton(
                              padding: EdgeInsets.all(0),
                              child: _isLoaded ? IconButton(
                                  icon: Icon(Icons.favorite),
                                  onPressed: () async {
                                    setState(() {
                                      _isLoaded = false;
                                    });
                                    _insert(widget.newsId,datalist[widget.value_index].title,datalist[widget.value_index].image, datalist[widget.value_index].description);
                                  }
                              ) : IconButton(
                                  icon: Icon(Icons.favorite_border),
                                  onPressed: () async {
                                    setState(() {
                                      _isLoaded = true;
                                    });
                                    _insert(widget.newsId,datalist[widget.value_index].title,datalist[widget.value_index].image, datalist[widget.value_index].description);
                                  }
                              ),
                            ),
                          ),
                        ),
                      ],
                    ))
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(15.0, 5.0, 10.0, 10.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: Text(
                        "$title",
                        style: TextStyle(
                            fontSize: custFontSize, fontWeight: FontWeight.bold),
                      ),
                    ),
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.fromLTRB(15.0, 5.0, 10.0, 10.0),
                child: Row(
                  children: <Widget>[
                    Expanded(
                        child: Text(
                          "$description".replaceAll('
', '').replaceAll('\r', '').replaceAll('\n', '').replaceAll('\t', ''),
                          style: TextStyle(fontSize: custFontSize),
                        )),
                  ],
                ),
              ),
            ],
          )
        ),
          Positioned(
            top: 0.0,
            left: 0.0,
            right: 0.0,
            child: AppBar(
              title: Text(''),// You can add title here
              leading: IconButton(
                icon: Icon(Icons.arrow_back, color: Colors.black,size: 30.0,),
                onPressed: () => Navigator.of(context).pop(),
              ),
              backgroundColor: Colors.blue.withOpacity(0.0), //You can make this transparent
              elevation: 0.0, //No shadow
            ),),
          ]
      ),
      bottomNavigationBar: BottomAppBar(
        color: Color(0xFF125688),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            Padding(
              padding: EdgeInsets.fromLTRB(10.0,0,0,0),
              child: Container(
                child: SizedBox(
                    child: FlatButton(
                        padding: EdgeInsets.all(5),
                        onPressed: (){
                          onPreviousChange();
                        },
                        child: Row(
                          children: [
                            Icon(MyFlutterApp.left_arrow),
                          ],
                        ))
                ),
              ),
            ),
            Padding(
                padding: EdgeInsets.fromLTRB(0,0,10.0,0),
                child: SizedBox(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        FlatButton(
                          padding: EdgeInsets.all(5),
                          onPressed: (){
                            onNextChange();
                          },
                          child: Row(
                            children: [
                              Icon(MyFlutterApp.next),
                            ],
                          ),
                        ),
                      ],
                    )
                )
            ),
          ],
        ),
      ),
    );
  }
}

below is the client.dart file where i am saving the news using a model:
import 'dart:convert';

Client clientFromJson(String str) {
  final jsonData = json.decode(str);
  return Client.fromMap(jsonData);
}

String clientToJson(Client data) {
  final dyn = data.toMap();
  return json.encode(dyn);
}

class Client {
  int id;
  String newsId;
  String newsTitle;
  String newsImage;
  String newsDescription;

  Client({
    this.id,
    this.newsId,
    this.newsTitle,
    this.newsImage,
    this.newsDescription,
  });

  factory Client.fromMap(Map<String, dynamic> json) => Client(
    id: json["id"],
    newsId: json["newsId"],
    newsTitle: json["title"],
    newsDescription: json["description"],
    newsImage: json["image"],
  );

  Map<String, dynamic> toMap() => {
        "id": id,
        "newsId": newsId,
        "title": newsTitle,
        "description": newsDescription,
        "image": newsImage,
      };
}

below is the database file where i am creating the database and the inserting the values in database:
class DBProvider {
  DBProvider._();

  static final DBProvider db = DBProvider._();

  Database _database;

  Future<Database> get database async {
    if (_database != null) return _database;
    // if _database is null we instantiate it
    _database = await initDB();
    return _database;
  }

  initDB() async {
    Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "News.db");
    return await openDatabase(path, version: 1, onOpen: (db) {},
        onCreate: (Database db, int version) async {
      await db.execute("CREATE TABLE News ("
          "id INTEGER PRIMARY KEY,"
          "newsId TEXT,"
          "title TEXT,"
          "image TEXT,"
          "description TEXT"
          ")");
    });
  }

  newClient(Client newClient) async {
    final db = await database;
    //get the biggest id in the table
    var table = await db.rawQuery("SELECT MAX(id)+1 as id FROM News");
    int id = table.first["id"];
    //insert to the table using the new id
    var raw = await db.rawInsert(
        "INSERT Into News (id,newsId,title,image,description)"
        " VALUES (?,?,?,?,?)",
        [id, newClient.newsId, newClient.newsTitle, newClient.newsImage, newClient.newsDescription]);
    return raw;
  }

  updateClient(Client newClient) async {
    final db = await database;
    var res = await db.update("News", newClient.toMap(),
        where: "id = ?", whereArgs: [newClient.id]);
    return res;
  }

  getClient(int id) async {
    final db = await database;
    var res = await db.query("News", where: "id = ?", whereArgs: [id]);
    return res.isNotEmpty ? Client.fromMap(res.first) : null;
  }

  Future<List<Client>> getAllClients() async {
    final db = await database;
    var res = await db.query("News");
    List<Client> list =
        res.isNotEmpty ? res.map((c) => Client.fromMap(c)).toList() : [];
    return list;
  }

  deleteClient(int id) async {
    final db = await database;
    return db.delete("News", where: "id = ?", whereArgs: [id]);
  }

  deleteAll() async {
    final db = await database;
    db.rawDelete("Delete * from News");
  }
}

A: There are two ways that I can suggest on how you can approach this. You can either check for existing entries if it exists in the sqflite database, or clear the Object that you're writing to the database once the save button has been clicked once.
What happens in the code snippet that you've provided is that _insert() is being called regardless of the value of isLoaded.


text:
Q: pandas isin based on common column for 2 different dataframes at row level I have two dataframes. Example:
DF1:

ID  Val1 VAl2
123  a    d
234  b    e
345  c    f

DF2:

ID  Val1 VAl2
234  b    d
345  c    f
567  k    l
123  b    d

I want to compare rows of DF2 with DF1 based on ID (Index for same ID value is different in both the DFs are different), and get output like:
Output:

ID   Val1 VAl2
NaN  NaN  d
NaN  NaN  NaN
567  k    l
NaN  b    NaN

So, where-ever values are similar based on ID is populated as NaN and the values that are different are populated as it is.
I tried to use:
DF2[~DF2.isin(DF1)]

But it compares based on index of dataframes.
I also tried:
DF2.isin(DF1.values.ravel())

But, it compares at individual value level in dataframe.
Thanks

A: Set the index then use eq
df1.set_index('ID').eq(df2.set_index('ID'))
      Val1   VAl2
ID
123  False   True
234   True  False
345   True   True
567  False  False


text:
Q: Give the image of the set under mapping
Consider $D = \{(x, y) | 1 \le x \le 2, 2 \le y \le 3\}$ and the mapping $(u, v) = (xy, x^2 - y^2)$. Find the image of $D$ under this mapping.

From combining the inequalities, I got $2 \le xy \le 6 \implies 2 \le u \le 6$. Is this part right?
I get $1 \le x^2 \le 4$ and $4 \le y^2 \le 3$, but I am aware I cannot directly combine these.
What can I do next? Will $u, v$ be dependent on each other somehow?


text:
Q: Apache POI - Applying styles per row I am working on generating a excel in my app for reporting purposes. I can apply styles to all rows but when I try and target specific rows (as shown below), the style does not work.
 public void postProcessXLS(Object document) {

    HSSFWorkbook wb = (HSSFWorkbook) document;
    HSSFSheet sheet = wb.getSheetAt(0);
    CellStyle cs = wb.createCellStyle();

    cs.setFillBackgroundColor(IndexedColors.RED1.index);
    cs.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    cs.setFillForegroundColor(HSSFColor.HSSFColorPredefined.BLUE.getIndex());

    sheet.getRow(0).setRowStyle(cs);
}

Trying to format the data in my table so the users have an easier time reading / handling it. I want to display different styles for alternate rows. If there is an easier way to do this in HSSF without having to manually write the styles, I am open to suggestions.

A: If you want to apply styles based on some condition or pattern , then go for conditional formatting , i faced the same challenges during my tussle with Apache POI and this post helped http://www.javavillage.in/fills-and-colors-using-conditional-formate-using-apache-poi.php , hope this helps you too


text:
Q: How to animate HTML5 shapes using a spine curve I've made a program that creates parametric shapes (spheres, toruses, and cylinders) and performs matrix transformations on them to animate them in specific ways (e.g. translate(), rotate(), scale()). I now want to animate the shapes using splines which will serve to allow the shapes to move along smoother paths than with the transformations alone. I'm not exactly sure how to approach this with html5 and javascript, but based on my work up to this point, I would think that the approach would involve first calculating all of the points that lie along the spline curve (for x,y, and z), storing each point in a data structure, and then iterating over the data structure passing in each point to the translate() method.
I've looked at some resources on B-Splines and NURB's but sites like these generally seem either very theoretical and hard to translate to code, or they use specific api's in languages that I'm not using. What would be the best implementation (code wise) of this sort of spline animation in html5 and javascript?


text:
Q: Como traer 2 datos por ajax y graficar en una sola Necesito colocar una grafica de diferencia venta x gasto. Traigo los datos por medio de jquery y consulta en la base de datos, estoy estancado porque no sé como enviar los datos por separados a uno solo, o si se puede un solo jquery para hacer las 2 consultas distintas
Esta es la consulta para traer la venta:
    function datagrafico2(base_url, year) {
      namesMonth = ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Dic"];
      $.ajax({
        url: base_url + "Admin/getData?id=<?= $perfil->sede_id ?>",
        type: "POST",
        data: {
          year: year
        },
        dataType: "json",
        success: function(data) {
          var dias = new Array();
          var montos = new Array();
          $.each(data, function(key, value) {
            dias.push(namesMonth[value.mes - 1]);
            valor = Number(value.monto);
            montos.push(valor);
          });
          grafica(dias, montos);
        }
      });

Y esta es la consulta para traer los gastos:
    function gasto2(base_url, year) {
      namesMonth = ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Dic"];
      $.ajax({
        url: base_url + "Admin/getDataGasto?id=<?= $perfil->sede_id ?>",
        type: "POST",
        data: {
          year: year
        },
        dataType: "json",
        success: function(data) {
          var dias = new Array();
          var montos = new Array();
          $.each(data, function(key, value) {
            dias.push(namesMonth[value.mes - 1]);
            valor = Number(value.monto);
            montos.push(valor);
          });
          grafica(dias, montos);
        }
      });
    }

y este es el codigo que dibuja la grafica, en el momento solo tengo dibujando la venta y en gastos no tengo acomodado los valores
   function grafica(dias, montos) {

      var options = {
        chart: {
          type: 'bar',
          events: {
            dataPointSelection: function(event, chartContext, config) {
              var fecha = config.w.globals.categoryLabels[config.dataPointIndex];
              $.ajax({
                url: base_url + "Admin/view?id=<?= $perfil->sede_id ?>",
                type: "POST",
                dataType: "html",
                data: {
                  fecha: fecha
                },
                success: function(data) {
                  $('#myModal').modal('show'); {
                    $('.modal-body').html(data)
                  }
                }
              });
            }
          }
        },
        series: [{
          name: 'monto',
          data: montos
        }],

        stroke: {
          show: true,
          width: 3
        },

        plotOptions: {
          bar: {
            columnWidth: '100%',
            distributed: true,
          }
        },
        xaxis: {
          labels: {
            rotate: -45
          },
          categories: dias,
          tickPlacement: 'on'
        },
        yaxis: {
          title: {
            text: 'Dias',
          },
        },
      }

      var chart = new ApexCharts(document.querySelector("#chart2"), options);

      chart.render();
    }

Si necesitan que adjunte el controlador y modelo de cada consulta me dicen, lo tengo todo con codeigniter
esta era la consulta que traia a gasto
public function montosMesesGasto($year,$id){
    $this->db->select("MONTH(fecha) as mes, SUM(monto) as monto");
    $this->db->from("gastos");
    $this->db->where("fecha >=",$year."-01-01");
    $this->db->where("fecha <=",$year."-12-31");
    $this->db->where("sede_id",$id);
    $this->db->group_by("mes");
    $this->db->order_by("mes");
    $resultados = $this->db->get();
    return $resultados->result();
}

y este es la de venta
public function montosMesesGasto($year,$id){
        $this->db->select("MONTH(fecha) as mes, SUM(monto) as monto");
        $this->db->from("venta");
        $this->db->where("fecha >=",$year."-01-01");
        $this->db->where("fecha <=",$year."-12-31");
        $this->db->where("sede_id",$id);
        $this->db->group_by("mes");
        $this->db->order_by("mes");
        $resultados = $this->db->get();
        return $resultados->result();
    }

A: Realicé la opción de antonio y realicé una consulta en una sola. Voy a editar la pregunta para revisar la consulta, así quedó lo de una sola consulta
SELECT MONTH(ve.fecha_actualizacion) AS mes, SUM(ve.total) AS montov ,
    (SELECT  SUM(ga.monto) AS monto
        FROM gastos ga
        WHERE MONTH(ga.fecha)= MONTH(ve.fecha_actualizacion)
        AND ga.sede_id=1
        AND ga.fecha >='2022-01-01'
        AND ga.fecha <='2022-12-31') gastov
FROM venta ve
WHERE ve.fecha_actualizacion >='2022-01-01'
AND ve.fecha_actualizacion <='2022-12-31'
AND ve.sede_id = 1
GROUP BY 1;


text:
Q: Invitaion to facebook friends is not working I am trying this code to invite facebook friends.But it did not work for me.Invitaion dialog is opened properly but no friend got invitaion.
can anyone please try this code at their end ,it will not take more then 2 minutes and let me know is this working at their side.

//HTML Code

Facebook Invite Friends Link

A: nitika..
Now a days facebook doesn't show invitation on its notification,
Your invitation will be seen at
Appcenter/ Request
one more things about callback from FB.ui
FB.ui({method: 'apprequests',
  message: 'My Great Request'
}, requestCallback);

this callback will work for you to save request id for future use.


text:
Q: Need to split string which is starting with bullet #!/usr/bin/env ruby
require 'roo'

Dir.glob("**/*.xlsx") do |file|
 xlsx = Roo::Spreadsheet.open(file)
 bookname = xlsx.column(1)

 tn = xlsx.column(4)
 tn_data = tn[1]
 p_tn_data = tn_data.split(/\R+/)
 puts p_tn_data.[2]
 puts p_tn_data.length
end

Original string:

["Notes", "The apostle John wrote this to Christians.\n• That which was from the beginning - The phrase "That which was from the beginning"\nrefers to Jesus, who existed before everything was made. You could translate this as "We\nare writing to you about the one who existed before the creation of all things."\n• the beginning - "the beginning of all things" or "the creation of the world"\n• we - In verses 1 and 2, the word "we" refers to John and those who knew Jesus when he\nwas on this earth, but it does not include the people John was writing to. (See: Exclusive)\n• which we have seen with our eyes, which we have contemplated - "We ourselves have\nseen him."\n• the eternal life - This phrase also refers to Jesus, who causes us to live forever. It can be\ntranslated as "that he causes us to live forever."\n• which was with the Father - "He was with God the Father"\n• and was manifested to us - "but he came to live among us" (UDB)"]

Output:

TThe apostle John wrote this to Christians.
  • That which was from the beginning - The phrase "That which was from the beginning"
  refers to Jesus, who existed before everything was made. You could translate this as "We
  are writing to you about the one who existed before the creation of all things."
  • the beginning - "the beginning of all things" or "the creation of the world"
  • we - In verses 1 and 2, the word "we" refers to John and those who knew Jesus when he
  was on this earth, but it does not include the people John was writing to. (See: Exclusive)
  • which we have seen with our eyes, which we have contemplated - "We ourselves have
  seen him."
  • the eternal life - This phrase also refers to Jesus, who causes us to live forever. It can be
  translated as "that he causes us to live forever."
  • which was with the Father - "He was with God the Father"
  • and was manifested to us - "but he came to live among us" (UDB)

p_tn_data.length is showing 13 but my data is only 7 (I am counting only string which start with bullet like •)


text:
Q: How to add a ribbon at the top with css? I try desperately to add this little png ribbon on the top right of my page. Exactly like this one: http://www.thebestdesigns.com/
I have checked their code, but it gets messed up when I use it in mine. Take a look:

       online store | main website

  n@hotmail.com | the athens store | Mitropoleos 37 | t: 2xx00

I tried something like that, but it gets up when I put it inside the two divs I have. What can I do? Any suggestions?
#ribbon {
position: absolute;
right: 0;
top: 0;
z-index: 1000;
}

A: This is all the code you need for the ribbon:
HTML

    Wordpress Themes

CSS
#new-themes {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1000;
}

#new-themes a {
  background: url("/deck/wp-content/themes/tbd/images/ribbon-themes-red.png") no-repeat;
  display: block;
  height: 140px;
  width: 140px;
  text-indent: -9000px;
}

Be sure to place the div right in our body.


text:
Q: Class names that start with C The MFC has all class names that start with C.  For example, CFile and CGdiObject.  Has anyone seen it used elsewhere?  Is there an official naming convention guide from Microsoft that recommends this style?  Did the idea originate with MFC or was it some other project?

A: I remember Borland compilers were comming with libraries where class names started with 'T'. Probably for "type" :)

A: I can't answer all your questions, but as far as I know, it's just to distinguish the MFC classes from other classes -- a form of Hungarian Notation.
Interestingly, it's apparently controversial not just outside MS, but inside as well.

A: Years ago naming convention is crucial to help identifying the class, type of even the grouping of the class. Dont forget back then there was no namespace and no/limited intellisense available.  C is a form of Hungarian notation but certainly made popular by MFC. Borland and Delphi was using T - as prefix for Type

A: While MFC and lots of software written for Windows used the "C" convention for classes, you generally don't find the latter in software written for UNIX platforms.  I think it was a habit very strongly encouraged by Visual C++.  I remember that Visual C++ 6.0 would prefix a "C" to any classes that one created with the class wizard.

A: See here : http://www.jelovic.com/articles/stupid_naming.htm for a long article on this issue.

A: It's evil. Don't use Hungarian Notation for anything but abstracted things.
For instance, btnSubmit is ok to describe a button named Submit(which would have an accompanying lblSubmit for the label next to the button)
But things like CMyClass for Class and uiCount for unsigned integer named count does not help programmers and just leads to extra wasteful typing.

A: Something a bit similar is used in Symbian C++, where the convention is that:
T classes are "values", for example TChar, TInt32, TDes
R classes are handles to kernel (or other) resources, for example RFile, RSocket
M classes are mixins, which includes interfaces (construed as mixins with no function implementations). The guideline is that multiple inheritance should involve at most 1 non-M class.
C classes are pretty much everything else, and derive from CBase, which has some stuff in it to help with resource-handling.
HBufC exists primarily to generate confused posts on Symbian forums, and having its very own prefix is just the start. The H stands for "huh?", or possibly "Haw, haw! You have no STL!" ;-)
This is close in spirit to Apps Hungarian Notation rather than Systems Hungarian notation. The prefix tells you something about the class which you could look up in the documentation, but which you would not know otherwise. The whole point of naming anything in programming is to provide such hints and reminders, otherwise you'd just call your classes "Class001", "Class002", etc.
Systems Hungarian just tells you the type of a variable, which IMO is nothing to get very excited about, especially in a language like C++ where types tend to be either repeated constantly or else completely hidden by template parameters. Its analogue when naming types is the Java practice of naming all interfaces with I. Again, I don't get very excited about this (and neither do the standard Java libraries), but if you're going to define an interface for every class, in addition to the interfaces which are actually used for polymorphism in non-test situations, then you need some way to distinguish the two.

A: That was a old C++ coding style, and MFC was probably one of the last things to use it.
It was usually just a convention of C++ (and maybe a few other languages), and hence it started falling out of favor as the languages became more interoperable, through COM and then .NET.
You still see it's cousin, the "I" prefix for interfaces, pretty often.  I've always found it interesting that "I" survived when "C" died, but that was probably because interfaces were used so heavily in COM interoperability.

A: we use it at work, like many other naming conventions
by many I meant C for classes, p for pointer, m_ for members, s_ for static members, n for integer ... not many documents

A: Such conventions for variables are useful for languages like Fortran where you don't need to declare the types of your variables before using them.    I seem to recall that variables who's names started with "i" or "j" defaulted to integers, and variables who's names started with "r" and other letters defaulted to real (float) values.
That people use similar for languages where you do need to declare variables - or for class definitions - is probably just a relic of someone misunderstanding the old code conventions from languages like Fortran where it actually mattered.

A: When writing applications that use the Qt libraries, we use a naming convention that distinguishes classes that are directly or indirectly derived from QObject from classes that aren't. This is useful because you can tell from the class name whether or not it supports signals/slots, properties, and all the other goodies that come from QObject.

A: personally I find that hungarian notation helps me, in that I can look at a screen full of variables and instantly know what they are as I try and absorb the logic. Your only argument against it I see is "extra typing"


text:
Q: Tomcat 10 - jakarta.faces - Tomcat does not start I am in the process of converting a Java 11 project with JSP and JSF web sites from javax.* to jakarta.*. For this I ...

*

*updated Tomcat 9 to 10

*updated all dependencies to the latest versions (build.gradle dependencies see below)

*changed all imports (javax -> jakarta)

*updated config files (web.xml, beans.xml, context.xml, faces-config.xml see below)

But unfortunately Tomcat 10 won't start now (StackTrace see below). I only get it to start when I remove jakarta.faces from the dependencies, but then no JSF pages run anymore, only JSP. So this is not a solution.
Does anyone maybe have a good idea what is going wrong here?
Thanks!
Exceptions:
22-Jun-2021 14:25:00.320 INFORMATION [RMI TCP Connection(3)-127.0.0.1] com.sun.faces.config.ConfigureListener.contextInitialized Mojarra 3.0.1 für Kontext '' wird initialisiert.
22-Jun-2021 14:25:00.536 INFORMATION [RMI TCP Connection(3)-127.0.0.1] com.sun.faces.spi.InjectionProviderFactory.createInstance JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden.  Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
    java.lang.NoClassDefFoundError: javax/faces/context/FacesContextFactory
22-Jun-2021 14:25:00.806 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment:
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2517)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:872)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1408)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at jakarta.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:410)
        at jakarta.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:338)
        at jakarta.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:183)
        at jakarta.faces.FactoryFinder.getFactory(FactoryFinder.java:264)
        at com.sun.faces.config.processor.FactoryConfigProcessor.lambda$verifyFactoriesExist$0(FactoryConfigProcessor.java:289)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:283)
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:198)
        at com.sun.faces.config.ConfigManager.lambda$initialize$0(ConfigManager.java:263)
        at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:261)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:207)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4715)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
        at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1873)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
        at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:428)
        at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:376)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
        at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.ClassNotFoundException: javax.faces.context.FacesContextFactory
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
        ... 69 more
22-Jun-2021 14:25:00.806 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
22-Jun-2021 14:25:00.806 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
14:25:00 [RMI TCP Connection(3)-127.0.0.1] INFO  (org.jboss.weld.environment.servletWeldServlet) [EnhancedListener.java:75] - WELD-ENV-001009: org.jboss.weld.environment.servlet.Listener used for ServletRequest and HttpSession notifications
22-Jun-2021 14:25:00.906 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] com.sun.faces.config.ConfigureListener.contextDestroyed Unexpected exception when attempting to tear down the Mojarra runtime
    java.lang.NullPointerException
        at java.base/java.lang.reflect.Method.invoke(Method.java:559)
        at com.sun.faces.el.ELUtils.addEL3_0_Resolvers(ELUtils.java:317)
        at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:243)
        at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:463)
        at com.sun.faces.application.applicationimpl.ExpressionLanguage.performOneTimeELInitialization(ExpressionLanguage.java:183)
        at com.sun.faces.application.applicationimpl.ExpressionLanguage.getELResolver(ExpressionLanguage.java:122)
        at com.sun.faces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:206)
        at jakarta.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:631)
        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:335)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5426)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
        at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1873)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
        at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:428)
        at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:376)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:293)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
        at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
        at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2f43a77d]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.PatternFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$PatternFormatter@2f34dd35]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2070279c]) and a value of type [org.apache.logging.log4j.core.impl.MutableLogEvent] (value [org.apache.logging.log4j.core.impl.MutableLogEvent@6a9c3d09]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@706f2549]) and a value of type [org.apache.logging.log4j.core.time.MutableInstant] (value [MutableInstant[epochSecond=1624361213, nano=607000000]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@7b902a38]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.PatternFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$PatternFormatter@13951f65]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@57728a91]) and a value of type [org.apache.logging.log4j.core.time.MutableInstant] (value [MutableInstant[epochSecond=1624361213, nano=861000000]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@5e3ea85b]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.PatternFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$PatternFormatter@2485884e]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1fd0d58c]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.PatternFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$PatternFormatter@5c35f2e5]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@77e2e548]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.FixedFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$FixedFormatter@7f2dd402]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.922 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@66c812de]) and a value of type [org.apache.logging.log4j.core.time.MutableInstant] (value [MutableInstant[epochSecond=1624361213, nano=407000000]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.937 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@15197638]) and a value of type [org.apache.logging.log4j.core.pattern.DatePatternConverter.PatternFormatter] (value [org.apache.logging.log4j.core.pattern.DatePatternConverter$PatternFormatter@75b10976]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
22-Jun-2021 14:25:00.937 SCHWERWIEGEND [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@642d5e06]) and a value of type [org.apache.logging.log4j.core.time.MutableInstant] (value [MutableInstant[epochSecond=1624361213, nano=739000000]]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

build.gradle dependencies:
runtimeOnly ('com.fasterxml.jackson.core:jackson-databind:2.12.3') {
    because 'log4j yaml layout'
}
runtimeOnly ('com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.3') {
    because 'log4j yaml layout'
}

implementation ('org.apache.logging.log4j:log4j-1.2-api:2.14.1') {
    because 'ireasoning snmp agent'
}
implementation 'org.apache.logging.log4j:log4j-web:2.14.1'
implementation 'com.h2database:h2:1.4.200'
implementation 'org.jboss.weld.servlet:weld-servlet-shaded:4.0.1.Final'
implementation 'org.glassfish:jakarta.faces:3.0.1'
implementation 'jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:2.0.0'
implementation 'net.lingala.zip4j:zip4j:2.8.0'
implementation 'org.primefaces:primefaces:10.0.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.1'
implementation ('commons-io:commons-io:2.10.0') {
    because 'commons-fileupload loads outdated version 2.2'
}
implementation 'org.apache.commons:commons-text:1.9'
implementation 'org.apache.commons:commons-csv:1.8'
implementation 'org.springframework:spring-web:5.3.8'

providedCompile 'jakarta.platform:jakarta.jakartaee-web-api:9.1.0'
providedCompile 'net.java.dev.jna:jna-platform:5.8.0'
providedCompile 'org.apache.poi:poi-ooxml:5.0.0'
providedCompile 'org.flywaydb:flyway-core:7.10.0'
providedCompile 'com.ireasoning:snmpagent:6.5.24c'
providedCompile 'com.neuronrobotics:nrjavaserial:3.15.0c'

compileOnly 'org.apache.tomcat:tomcat-catalina:10.0.7'

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
  version="4.0"
  metadata-complete="true"
>
    <context-param>
        <param-name>org.jboss.weld.development</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>jakarta.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jsp</param-value>
    </context-param>
    <listener>
        <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
    </listener>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>
            jakarta.faces.webapp.FacesServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <error-page>
        <exception-type>jakarta.faces.application.ViewExpiredException</exception-type>
        <location>/index.jsp</location>
    </error-page>
    <error-page>
        <error-code>500</error-code>
        <location>/error.xhtml</location>
    </error-page>
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>
    <resource-env-ref>
        <resource-env-ref-name>BeanManager</resource-env-ref-name>
        <resource-env-ref-type>
            jakarta.enterprise.inject.spi.BeanManager
        </resource-env-ref-type>
    </resource-env-ref>
</web-app>

beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd" version="3.0"
       bean-discovery-mode="annotated">
</beans>

context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="">
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Resource name="BeanManager"
        auth="Container"
        type="jakarta.enterprise.inject.spi.BeanManager"
        factory="org.jboss.weld.resources.ManagerObjectFactory"/>
    <Resources cachingAllowed="true" cacheMaxSize="100000" />
</Context>

faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="https://jakarta.ee/xml/ns/jakartaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_3_0.xsd"
    version="3.0"
>
    <!-- Your faces config here. -->
</faces-config>

A: primefaces 10.0.0 comes in two versions: a Java EE compatible one (default) and a Jakarta EE 9 version.
You need to add the jakarta classifier to select the second version:
implementation 'org.primefaces:primefaces:10.0.0:jakarta'

Remark: Since you depend on Spring, you must wait with your migration until Spring 6.x (Jakarta EE 9 compatible) is out.


text:
Q: insert sql to database not inserting properly I want to insert my data to database, however, it doesn't work out properly such as, when I have 4 products added to cart, it will only insert two out of four. And the subtotal appears such that it captures the first amount of the product as my subtotal and then it shows the total amount for the whole products. And my quantity doesn't insert in my database.

        Name
        Quantity
        Price per item
        Total cost

    <?php
    $sql = "SELECT * FROM productsc WHERE id_product IN (";
    foreach ($_SESSION['cartCity'] as $id => $value) {
        $sql .= $id . ",";
    }
    $sql = substr($sql, 0, -1) . ") ORDER BY name ASC";
    $query = mysql_query($sql);
    $total_price = 0;
    if (!empty($query)) {
        while ($row = mysql_fetch_assoc($query)) {
            $subtotal = $_SESSION['cartCity'][$row['id_product']]['quantity'] * $row['price'];
            $total_price += $subtotal;
            ?>

                <?php echo $row['name']; ?>
                <input type="text" name="quantity-<?php echo $row['id_product']; ?>" size="5" value="<?php echo $_SESSION['cartCity'][$row['id_product']]['quantity']; ?>" />
                <?php echo "$" . $row['price']; ?>
                <?php echo"$" . $_SESSION['cartCity'][$row['id_product']]['quantity'] * $row['price']; ?>

            <?php
            if ($row = mysql_fetch_assoc($query)) {
                $sql2 = "INSERT INTO order_details (name,quantity,price,subtotal) VALUES ('" . $row['name'] . "','" . $quantity . "','" . $row['price'] . "','" . $total_price . "')";
                $query2 = mysql_query($sql2) or die(mysql_error());
            }
        }
    }
    ?>

        Total price:
        <?php echo"$" . $total_price; ?>

A: possibly because you call $row = mysql_fetch_assoc($query) inside a loop doing the same, meaning that the outer loop is only going to run half of the time and you will only enter every other item
try
    while ($row = mysql_fetch_assoc($query)) {
        $subtotal = $_SESSION['cartCity'][$row['id_product']]['quantity'] * $row['price'];
        $total_price += $subtotal;
        ?>

            <?php echo $row['name']; ?>
            <input type="text" name="quantity-<?php echo $row['id_product']; ?>" size="5" value="<?php echo $_SESSION['cartCity'][$row['id_product']]['quantity']; ?>" />
            <?php echo "$" . $row['price']; ?>
            <?php echo"$" . $_SESSION['cartCity'][$row['id_product']]['quantity'] * $row['price']; ?>

        <?php
        $sql2 = "INSERT INTO order_details (name,quantity,price,subtotal) VALUES ('" . $row['name'] . "','" . $quantity . "','" . $row['price'] . "','" . $total_price . "')";
        $query2 = mysql_query($sql2) or die(mysql_error());

    }


text:
Q: FCM hostnames whitelist for firewall I recently found problem with firebase-admin behind firewall (using firebase-admin for nodejs
).
This is actual error:

Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: Error while making request: connect ECONNREFUSED 142.251.37.109:443. Error code: ECONNREFUSED"

which is quite self explanatory, I can add IP and port to firewall whitelist, but if FCM change their IP my connection will be refused again.
For me, better approach is to add hostname to whitelist, but I can't find in any documentacion what host is called by initializeApp function. For example, it is not any specified hostname from docs (none is resolved to 142.251.37.109, but it is definitely firebase IP according to ip range).


text:
Q: Android Developer Tools do not recognize the newer API? The project was built on Android 4.4.2.
Now I want to use new APIs of Android 5.0.1.
The ADT do not recognize 'BatteryManager.BATTERY_PROPERTY_CAPACITY'.
How can I fix it?

A: You should be sure that your compileSdkVersion and buildToolsVersion is suitable for 5.0.1.
Adt won't be update any more,so suggest you using AndroidStudio.

A: From the image provided it's clear that your build target is still set to Android 4.4.2, you need to change it to 5.0.1:

Also you really should migrate to using Android Studio by now, there's no telling how long will Google continue to support Eclipse ADT.