Is this mold in my bathroom?

Question: Moved into a new house and the bathroom has a foul odour and i suspect it has something to do with he black stuff all over the place. Could it be mold?
Comment: Looks more like mildew to me. Give it a scrub with a household cleaner.
Comment: @isherwood mildew is not black, and the cleaners needed for mold, are not the "just give it a scrub" variety - this is not a safe suggestion.
Comment: Yeah, everyone says everything is black mold because it sounds dramatic.  Very rarely is it truly a health concern.
Answer: I am pretty sure that is mold. I would start with a bleach solution to clean it up. Rental? If so, I would have the landlord look at it and get it taken care of. Cleaning, painting with Kilz or Bullseye or something similar. Then monitor it for a few months.
Answer: That is black mold.
If you are renting, your landlord is most likely responsible for this - as it is a health hazard.
It can be cleaned with common household cleaners, like Tilex or Mildex, but you will want to do it in sections, if you don't plan to leave.
You should ventilate the area, and protect yourself, from the toxic fumes, produced by the chemicals.
Regular cleaning, will need to be done, to keep it from coming back - just not with the strong stuff.

Is this mold in my bathroom?


Kotlin/Android app using Retrofit2. JSON query not working as I expect

Question: Working on a small android app to help me learn about JSON queries. The little test app works until I try to drill a little deeper in to my test JSON data.
I'll post a link to the JSON data I'm working with to save space here in the question. It is example code pulled from weatherwunderground's API and hosted on myjson.com.
JSON: https://api.myjson.com/bins/19uurt
MAIN ACTIVITY CODE
class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    val retriever = CycloneRetriever()

    val callback = object : Callback<Cyclones> {
        override fun onResponse(call: Call<Cyclones>?, response: Response<Cyclones>?) {
            println("Got a response!")
            println(response?.body()?.currenthurricane?.get(1)?.stormInfo?.get(0)?.stormName).toString()
        }

        override fun onFailure(call: Call<Cyclones>?, t: Throwable?) {
            println("The thing, it failed!")
        }
    }
    retriever.getCyclones(callback)
}

}
This is my class that helps build/gather the JSON data
CLASS
interface WeatherWunderGroundAPI {
@GET("bins/19uurt")

weatherwunderground.com API
fun getCyclones() : Call<Cyclones>
}

class Cyclones(val currenthurricane: List<CurrentHurricane>)
class CurrentHurricane(val stormInfo: List<StormInfo>)
class StormInfo(val stormName: String)

class CycloneRetriever {
    val apiRetriever: WeatherWunderGroundAPI

    init {
        val retrofitCyclone =
Retrofit.Builder().baseUrl("https://api.myjson.com/")
            .addConverterFactory(GsonConverterFactory.create()).build()
    apiRetriever =retrofitCyclone.create(WeatherWunderGroundAPI::class.java)
}

fun getCyclones(callback: Callback<Cyclones>) {
    val call = apiRetriever.getCyclones()
    call.enqueue(callback)
}

}
Right now I'm just trying to get a good response and print that to the console. Eventually, I will take the JSON data and dump it into a RecyclerView.
I can get a good response if I do the following Println, but it does not return anything of use:
println(response?.body()?.currenthurricane

But once I try to dig further into .currenthurricane, onFailure() is called.
According to some JSON docs, this should get me what I want: $.currenthurricane.[stormInfo].stormName As an example.
But I cannot figure out how to get this working in my code. I was gonna give Klaxxon a try, but have not quite figured out how to get that working either.
I'm using Retrofit2 and GSON plugins in the code above. I'm fairly confident the issue is my JSON query.
Answer: Finally figured out the problem. I was on the right track, but needed a little tweaking on my JSON queries and need to change my classes.
I'm still working on it, and I'm sure there is a much better way to do this, but here is the quick and dirty.
Changed my classes and added a couple data classes:
class Cyclones(val currenthurricane: List<CurrentHurricane>)
class CurrentHurricane(val stormInfo: StormInfo, val Current: Current)

data class StormInfo(val stormName: String)
data class Current(val lat: Double, val lon: Double, val
SaffirSimpsonCategory: Int, val Category: String, val WindSpeed: WindSpeed,
val Movement: Movement)

data class WindSpeed(val Kts: Int, val Mph: Int, val Kph: Int)
data class Movement(val kts: Int, val mph: Int, val kph: Int)

And changed my JSON queries to the following:
val cycloneInfo =
    response?.body()?.currenthurricane?.get(0)?.stormInfo?.stormName
val cycloneCurrentLat =
    response?.body()?.currenthurricane?.get(0)?.Current?.lat
val cycloneCurrentLon =
    response?.body()?.currenthurricane?.get(0)?.Current?.lon
val cycloneCurrentSSCat =
  response?.body()?.currenthurricane?.get(0)?.Current?.SaffirSimpsonCategory
val cycloneCurrentCategory =
    response?.body()?.currenthurricane?.get(0)?.Current?.Category
val cycloneCurrentWindKts =
    response?.body()?.currenthurricane?.get(0)?.Current?.WindSpeed?.Kts
val cycloneCurrentMovement =
    response?.body()?.currenthurricane?.get(0)?.Current?.Movement?.kts


Ring connector max amps?

Question: I bought some ring connectors (crimp) for a fairly high-current application.  The connectors don't say anything about current rating, though.  (They're Gardner Bender 15-096, btw.)  I haven't found any mention of ring connector current rating in general, on the internet, either.  Is it just assumed that they can carry however much current their matching gauge of wire can carry?
Comment: I would hope they are made to carry the same current as the wire gauge.  The main problem with any type of connector, is it not being done right and causes extra resistance(heat) at the the connection.
Answer: A search on UL's Product iQ database for 'gardner bender ring terminal' led to a file for ECM Industries, LLC (owner of the Gardner-Bender brand) and does mention the 15-096 part number (source). It seems those are tested to UL's product code ZMVV "Wire Connectors and Soldering Lugs."
UL's "White Book" describes the standard. I happened upon the 2013 edition in which the ZMVV section includes the following.

Ampacity level rating:
A. Equipment use — Equipment wiring requirements may restrict the sizing, ampacity and temperature ratings of connected conductors. Equipment requirements may limit 90°C or higher-rated conductors to 60 or 75°C ampacity in accordance with Electrical Equipment for Use in Ordinary Locations (AALZ).
B. General use — Connectors rated 75°C are intended for use at ampacities not greater than those for 75°C-rated conductors, and connectors rated 90°C are for use at ampacities not greater than those for 90°C-rated conductors. Connectors may be marked with ''75C'' or ''90C'' to represent these levels. Alternatively, these rating levels may be repre sented by a 7 or 9 associated with the marking ''CU,'' ''AL'' or ''AL-CU,'' e.g., ''AL9,'' ''AL9CU,'' ''AL7CU,'' ''CU7,'' ''CU9.'' Connectors not marked with an ampacity number 7 or 9 have an assumed level per the following table. Use of higher-temperature-rated conductors is not prohibited, provided the ampacity levels continue to be based on the 75 or 90°C ratings.
Connectors are rated and marked as follows:

<code>| Type of Connector      | Rated For | Wire Range | Temp Marking | Rating|
|:-----------------------|----------:|-----------:|-------------:|------:|
|Terminal (CU body)      |CU only    |All         | Not marked   | 90    |
|Terminal (AL body)      |CU only    |All         | 75 or 90     |As marked@|
|Terminal                |AL or AL-CU|All         | 75 or 90     |As marked@|
|Splicing wire           |CU only    |30-6        | Not marked   | 90    |
|Splicing wire (CU body) |CU only    |4 and larger| Not marked   | 90    |
|Splicing wire (AL body) |CU only    |4 and larger| 75 or 90     |As marked|
|Splicing wire           |AL or AL-CU|30-6        | Not marked   | 75    |
|Splicing wire           |AL or AL-CU|4 and larger| 75 or 90     |As marked|
</code>

@ Terminal connectors rated for 6 AWG or smaller conductors may have the markings on the connector, the unit container, or on an information sheet packed in the unit container.

The terminals in question are rated for 75°C but it's not clear whose ampacity chart we should consult. If we go by the 2020 NEC Table 310.16 and use the 75°C column, then 6 AWG copper and these ring terminals have ampacity of 65 amps.

Ring connector max amps?


How to resize(crop) images when changing from desk top to mobile

Question: I'm using twitter-bootstrap with my rails application and as such I'm designing for desktop and mobile at the same time.
On desktop my site uses a series of "banner" style images that fit perfectly. When viewed in mobile these images keep their scaling and as such are just too small.
What I would like to happen is something very similar to what happens to a user profile in the facebook application. When you view your facebook profile on desktop your banner image is its original size where as when your profile is viewed in mobile the left and right sides are cropped off.
Is it possible to do this without uploading 2 sets of image?
Is there something I have overlooked in bootstrap or something basic in css that I can use to fix this?
As an example my banner picture looks like this in desktop

And in mobile it looks like this

I would really like to apply this functionality to my own site as it switches between mobile and desktop, any help is very much appreciated
Edit 1
here is a sample of the html I'm using to display an image

        <%= image_tag("about_us.jpg")%>

here is the sass that I have applied to my application
.home-about-us{
     img{
      display: block;
      margin-left: auto;
      margin-right: auto;
     }
 }

Comment: give `width:100%` to image
Comment: that does not crop the edges off
Comment: @arg0 ahhh A big Sorry for not reading your question completely.
You need to remove `max-width` from your `img`. And We can only solve the query if we are given with some code or link where we can see the issue. Once again SORRY
Comment: Yeah I thought the question might be misinterpreted, it is kind of a strange one since normally people want to keep scaling and the entire image between mobile and desktop.
Answer: You can do one of two things:
1) Set a max-width restriction on the img so that it can only be as wide as the device itself, or,
2) Use a media query which specifiesg the max-width as 720 for mobiles, and then specify the width of the image, and then create another media query but this time using a min-width of 720 for tablets and desktops, specifying a different width for the image.
Comment: both of these solutions will keep scaling or resize the image without cutting the sides off and that's not what I want. sorry
Comment: I've previously done this with heights by setting them as specific pixel heights rather than percentages. Are you able to successfully achieve the same by specifying the width as px rather than a %?
Comment: using specific px sizes will remove allot of the dynamic design that I have gained from using bootstrap.
currently I'm rewriting the html with new image files that only run in mobile.
Comment: Understood. Sorry i couldn't be of more help
Answer: Just use the BS responsive image class ("img-responsive") - see here straight from the BS site.
Comment: image-responsive class doesn't exist in twitter-bootstrap-rails(2.2.8) gem


what is "{0}" in C?

Question: What does char buf[MAXDATASIZE] = { 0 };'s {0} means?
tried to print it out but it print nothing.
#include <stdio.h>

int main(void)
{
        char buf[100] = { 0 };
        printf("%s",buf);
        return 0;
}

Comment: It's the **universal zero-initializer** :) It works for (it sets to zero, the right kind of zero) anything *(for initialization)*: `int k = {0}; char *data = {0}; _Complex double x = {0}; struct whatever array[42] = {0}; /* ... */`
Answer: This is just an initializer list for an array.  So it's very like the normal syntax:
char buf[5] = { 1, 2, 3, 4, 5 };

However, the C standard states that if you don't provide enough elements in your initializer list, it will default-initialize the rest of them.  So in your code, all elements of buf will end up initialized to 0.
printf doesn't display anything because buf is effectively a zero-length string.
Comment: So... It is *explicitly stated* that the first char will be `0`, while others will *default* to `0`? Would `char buf[100] = {65, 66, 67};` initialize `buf` to have `'A'`, `'B'` and `'C'` as first three elements and all other would *default* to `0`? Would `char buf[100];` be non-initialized, i.e., would it contain unexpected values (whatever was written to the memory before reserving it)?
Comment: @binaryLV: Yes, everything you said is correct.  The only exception is that if you write `char buf[100];` as a global or as a static, it will be initialised to zero (in all other contexts, it will not be initialized).
Comment: I thought only static globals were zero initialized? Would appreciate some clarification on that.
Answer: You are assigning an array to the buffer.
In the particular case of string, usually, the character whose ASCII value is 0 terminates the string.
For example, if you wanted to put a string that reads 'Hello world' inside the string you could have done
char buf[100] = {'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', 0};

or
char buf[100] = "Hello world";

Anyway, your code prints nothing because you are trying to print a string with length zero, that is an empty string.
Comment: `0` and `"\0"` are almost exactly the same thing. The first is converted from `int` to `char`; the second is an array of 2 chars, both having the same zero value. There is no portability issue here.

what is "{0}" in C?


Pygame, my sprite looks wierd

Question: I'm working on this project for Literature class and I'm planning on making a game with pygame based of this book we were reading.
Here's the code:
<code>import pygame, sys
from pygame.locals import *

pygame.init()

FPS = 30
fpsClock = pygame.time.Clock()

DISPLAYSURF = pygame.display.set_mode((400, 300), 0, 32)
pygame.display.set_caption('Animation')

WHITE = (255, 255, 255)
romeo = pygame.image.load('rome.png.png')
romeo = pygame.transform.scale(romeo, (50, 50))
romeox = 10
romeoy = 10

while True: # the main game loop
    keys = pygame.key.get_pressed()
    if keys[K_RIGHT]:
        romeox += 5
    if keys[K_LEFT]:
        romeox -= 5
    if keys[K_UP]:
        romeoy -=5
    if keys[K_DOWN]:
        romeoy += 5
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    DISPLAYSURF.blit(romeo, (romeox, romeoy))
    pygame.display.update()
    fpsClock.tick(FPS)
</code>
Unfortunately, the sprite seems to leave a trail of it's own copies while it moves.
Here
Please help!
Comment: This has been answered here I believe: http://stackoverflow.com/a/24843798
Answer: Seems like you forgot to clear the screen every iteration
<code># Fill surface with black color
DISPLAYSURF.fill((0, 0, 0))
</code>
Insert it above the line that blits the sprite onto the screen.
Comment: Thanks, that helped alot
Comment: @SakibPathen You can press the checkmark underneath the upvote arrow to mark the question as answered.

Pygame, my sprite looks wierd


Copy few documents in a collection to another collection in mongo DB

Question: I have two collections , one where all documents are stored and the other where the documents will be stored after processing.
I am new with mongo and would like to know if there is any method to copy the documents from one collection to the other ?
Answer: Try this:
<code>db.firstColllection.aggregate([
    {$limit: 10},
    {$out: "secondCollection"}
])
</code>
Answer: To copy all files, we can use db.source.copyTo("target") as well


What is arbitrary code execution (ACE) and how does it affect speedrunning?

Question: There has been a lot of records being set in The Legend of Zelda: Ocarina of Time within the last couple of weeks or so. A lot of these records keep stating that "ACE" is the reason for this. I have read that "ACE" stands for Arbitrary Code Execution, but why is ACE all of sudden now setting incredible records?
From an article I've read ACE can be described as...

This means that the game can be forced to load and execute a save file
  name as if it is game code — so using a save file name that is game
  code can access parts of the game left over from its development and
  testing.

So basically within a series of in-game inputs, you can use a filename in order to run some development code left over?
Comment: Comments were deleted. This section is not to discuss the validity of glitches in speedruns, or what counts as beating a game.
Answer: Arbitrary Code Execution (ACE) is a glitch that allows the player to cause the instruction pointer to jump to a section of memory that can be written to by the player (such as the filename, the angle and position of certain actors, controller inputs, etc). When the instruction pointer enters this section of memory, it runs that portion of memory as code.
In other words, it allows the player to write "code" with regular input and execute it in game.
The most obvious speedrunning application is to write and run code that tells the game to run the end credits, as we see in the OoT any% speedrun, but that's certainly not the only one; in Ocarina of Time 100% No Source Requirement, ACE is used to give Link almost every item. ACE is usually only allowed in the any% category, which does limit applications permitted by the rules.
Ocarina of Time is not the only game with ACE. For example, Super Mario World also uses ACE in its any% speedrun, writing code using sprite coordinate data to run the end credits (more commonly known as "credits warp"). It can also be used to write and run an entire game.

This is not to be confused with other memory manipulation glitches. For instance, Super Mario World's Cloud Glitch abuses the fact that Bowser's "time remaining until next fight cycle" timer and the cloud's x coordinate share a register, since they were never meant to appear in the same room together. Since the instruction pointer remains within the normal range, you're not running any arbitrary code here even though you are manipulating the game's behavior by abusing this shared memory.
Comment: It should be mentioned that Arbitrary Code Execution does not only exist in videogames, but also other programs, such as web servers. And as you might imagine, random strangers being able to do whatever they want on your server is *really bad*.
Comment: @Parrotmaster I don't think the MissingNo. glitch qualifies as *arbitrary* code execution. If it was an ACE exploit, it would permit players (usually with emulator tooling) to do literally anything they want with the game, such as in [this video for Pokémon Yellow](https://www.youtube.com/watch?v=Vjm8P8utT5g). The specific actions you perform to get MissingNo. aren't really "code" that gets "run"; they're in-game behaviors that happen to touch on an edge case not accounted for, where the game's original code misinterprets data already in the ROM to modify unexpected RAM addresses.
Comment: The most well known application of this is the Missingno glitch in Pokemon Red, where you duplicate the 6th item in your bag by performing a series of specific actions.
Comment: also ACE was discovered in MM recently https://www.youtube.com/watch?v=xb9yijgukak
Comment: See also [Reach the Credits from Kokiri Forest using ACE (Ocarina of Time Glitch Explained)](https://www.youtube.com/watch?v=wdRJWDKb5Bo).
Comment: @Parrotmaster Joe Sewell beat me to it; my reaction was "That's not arbitrary code execution!" There are bugs in Pokémon, some of them even abuse shared memory locations where previous actions cause certain values to reside in memory locations which mean something different in another context. The bug that lets you catch mew (or anything at all, really) without using any gameshark or game genie, capturable by normal gameplay, is another example of this. In fact, if I recall, you can even set its stats if you do it right. Not ACE, but sort of similar I suppose.
Comment: Matrix analogy:  things like Missingno are like the spoon boy  -- you can take advantage of the coding of the system and manipulate it (bend the spoon).  ACE is like being Neo, where you can remake the whole world at will.
Comment: @eps I always thought it was a fourth wall break. The boy tells Neo - and the audience - that he should see the truth. The spoon isn't real, it's fake, it's CGI.
Comment: An atypical but very evocative example is the [ACE in Super Mario Land 2](https://www.youtube.com/watch?v=h15Jk6MOgP0). In this case the player glitches Mario out bounds of the map, and the game world reflects the memory he's in, each block corresponding to one memory cell, block type representing the value. Mario must navigate through memory cells with non-obstructing values in ROM area, to reach the RAM, then find the one block responsible for starting end credits and break it.
Comment: It's not a typical ACE because you're not able to create arbitrary code that does anything you want - you may only modify cells Mario can interact with, can't spawn any arbitrary blocks - but it's evocative - helpful in understanding how ACE works, the 1:1 correspondence between blocks of the game world and the system memory, and how breaking a specific block has a specific effect, helps understanding how regular ACE turns sprite positions or controller angles into executable data.
Answer: I'm not 100% sure about the inner workings of various assemblers and processors, but I'm attempting as best as I can to explain, how I understand it
Let's say the machine instructions to perform a map transition / warp is some value, for example AC.
Let's say, this instruction takes a value to decide where to warp the player. For example, the final boss room has value C8.
So if you tell your game to call the routine to execute AC C8, it knows that it should teleport the player to the final boss.
Now, assume you have some inventory mechanism that saves items by their id. A bomb has id C8 and a stick has id AC.
Assume the data for the inventory is laid out sequentially, so having a stick first and then a bomb is represented as AC C8 as well.
Now "all you need to do" is to trick the program into jumping to a wrong location while it tries to execute some kind of action. This is usually done by the "program counter" which points to the address of the instruction to execute.
If you manage to manipulate the program counter to point to the start of your inventory instead of the address it normally should point to, the program will now read the data from your inventory, but treats it as executable code instead. So since your inventory contains "stick, bomb" the data that will be read is AC C8, which causes the program to warp you to the boss room now.
I think something like this is usually achieved by corrupting parts of the memory or somthing similar. The section of memory that is corrupted contains "nonsensical" data now, but can still be executed.
I'd say, a good example of how all of this can be exploited is shown here: How to beat Pokemon Yellow in 0:00
Comment: I think this answer is brilliant - a person completely unfamiliar with progamming might completely understand it.  You may want to expand on what the "program counter" actually is to make the answer even better.
Comment: Well this was a good explanation. One thing to note is buffer overflow exploits are notorious for causing arbitrary code execution.
Comment: I expect the SRM ACE glitch (in OoT) works by causing the game to accidentally overwrite the location of some code (stored in RAM), with an arbitrary location you can select. Then when it wants to run that code, it runs the wrong code by mistake, and the code it runs is the code which you set up earlier.


PHP MySql Select Query does not return updated records

Question: I have a simple php site that uses a mysql database.
Whenever I attempt to update or insert a record, the database does reflect the change, however when I attempt to run the select query a second time, it returns a result set as if the update or insert never took place.
It seems as if it is caching the results. When I clear the web browser's cache and cookies and reload the page, the select statement does return the updated records.
Any suggestions would certainly be appreciated.
Thanks a lot !
Upon page load, selectplayers is called and will return player A and B.
I then call deleteplayer to remove B and the record is indeed removed from the database.
I call selectplayers a second time and it still returns player A and B.
If I clear the cache and reload the page, it returns only player A.
<code>function selectplayers() {
       $db = new db("mysql-t","user","password","database");
       $id = $db->escape($_REQUEST["id"]);
       $db->execute("SELECT name FROM players WHERE id=$id");
       $db->close();
       //echo result set to page
}

function deleteplayer() {
       $db = new db("mysql-t","user","password","database");
       $id = $db->escape($_REQUEST["id"]);
       $db->execute("DELETE FROM players WHERE id=$id");
       $db->close();
}
</code>
The headers are as follows:
    header('Cache-Control: no-cache, no-store, must-revalidate');
    header('Pragma: no-cache');
    header('Expires: 0');
Comment: Maybe a problem with transactions?
Comment: I've included the code if that helps at all.
I am not using transactions. The inserts and updates do hit the database and are permanent, it's just the select statements appears incorrect the second time. Thanks for replies!
Answer: Are you using transaction, if you are, then you may need to commit after insert. If you don't it will rollback to previous value. without code its harder to guess, i think this may be the issue.


$L^2$ inner product split over sub-domains in $\mathbb{R}^3$

Question: I have a bounded Lipschitz domains $\Omega, \Omega_1, \Omega_2 \subset \mathbb{R}^3$ such that $\overline{\Omega}=\overline{\Omega}_1 \cup \overline{\Omega}_2$ and $\Omega_1 \cap \Omega_2=\emptyset$.
Let $u \in H^k(\Omega)$ and $v \in C^\infty(\Omega)$.
When is the following true:
$
(u,v)_{L^2(\Omega)} = (u,v)_{L^2(\Omega_1)} + (u,v)_{L^2(\Omega_2)}
$
From Sobolev embedding theorem, for $k \geq 2$, $u$ is continuous and the above is true.
For $k=-1$, I can construct counter examples (for example, gradient of a discontinuous function).
What about for $k=0$ and $k=1$?
Answer: This is always true, as $\Omega \setminus (\Omega_1\cup \Omega_2)$ can only contain the boundaries of $\Omega_1$ and $\Omega_2$, which have zero measure due to the regularity assumptions on the domains.
Comment: Thanks for your response. I am still not entirely convinced. For $u \in L^1$, a set of measure zero could contain a Dirac delta function. Why is it not possible to have a function/distribution in $L^2=H^0$ which is non-zero only on a set of measure zero?
Comment: Functions in $L^p$ are actually equivalence classes of functions that have the same function values with the exception of a zero-measure set. Sets of measure zero do not matter for $L^p$ functions.
Comment: But $\delta_0 \in L^1$ and $\delta_0(x)=0 ~\forall x \neq 0$ but $\lVert \delta_0 \rVert_{L^1} \neq 0$
Comment: My last comment was wrong. It seems $\delta_0 \notin L^1$. $L^p$ only allows functions integrable in the sense of Cauchy principal value. Therefore, as you have pointed out, the result is true for all $u \in L^p$ and therefore for all $u \in H^k$ where $k \geq 0$


How to see the tables created on oracle cloud

Question: I am new to DBaaS, I created a new oracle cloud account and instantiated a DB.
I am connecting to the DB using SQL developer and created a new table by logging in as sys user.
How do I see the newly created table on oracle cloud using web console?
I can see the data that I have added into the newly created table using SQL Developer, but is there any way or does oracle provides any web-console to see the data using a browser?
Thanks in advance.
Comment: First of all - DO NOT use sys user to crete objects in the same schema! This user is responsible for all kinds of things, which keeps your DB running etc. For more information see this: https://docs.oracle.com/database/121/ADMQS/GUID-CF1CD853-AF15-41EC-BC80-61918C73FDB5.htm#ADMQS12003
Answer: This is possible using OEM Cloud Control. To view data, navigate to database homepage/summary. From the top menu, navigate to
Schema -> Database Objects -> Tables.

Fill in the desired schema and click "Go". This will populate a list of the tables within the schema. Click on the table name to view the table.
Once at the View Table page, select "View Data" from the Actions menu and click "Go". This will return the top 25 rows from the selected table. If there are more than 2000 rows, you will be given the option to select specific columns and add a where clause.
Comment: The database in question must be added as a target in OEM first - you cannot use OEM to view data in a database that has not been added as a target. To add the database as a target, navigate to  Setup -> Add Target at the top right (next to account name.) Once the database is added, navigate to Targets -> Databases at the top left of the page, select the database from the list of targets, then follow these instructions.

More info on adding the database as a target can be found here: https://docs.oracle.com/cd/E24628_01/install.121/e22624/install_agent.htm#EMBSC181
Comment: I have Oracle 18.104.22.168.0 on the cloud, and I opened the Oracle Enterprise Manager, I don't see any schema or database objects in the Oracle Enterprise Manager wizard.


selecting the latest record from multiple tables in one database (MYSQL PHP)

Question: I have school mysql db with 15 tables (15 class rooms), each table has unified fields/simple data like this: ID, DATE, TIME, CLASSROOM_NO, STUDENTS_ALL, STUDENTS_CURRENT, COMMENTS
approach is to be able to keep updating this data all the time through php form that increment that db, that is fine, it is working fine.
in another php page, i have display.php that shows me only the latest record added, so i can know the latest update done to this classroom, and this is also fine, it is exactly what i need, here is my code:
<?php
$con=mysqli_connect("localhost","classroom","mypsassword","mysqluser");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT id, date, time, classroom_no, students_all,     student_current,comments FROM classroom_1 ORDER BY id DESC LIMIT 1");

while($row = mysqli_fetch_array($result))
 {

 echo "Room: " . $row['classroom_no'] . "
";
 echo "All students: " . $row['students_all'] . "
";
 echo "Available students: " . $row['students_current'] . "
";
 echo "Absent: ";
 echo floatval($row['students_all'])  -  floatval($row['students_current']);
 echo "
";
 echo "Updated on: " . $row['date'] ."
";
 echo "Update time: " . $row['time']."
" ;

  }

mysqli_close($con);

?>

now, i have no problem in achieving and retrieving the latest update from each classroom in one page... what i struggle for is to select the latest record from each table and then display them all accordingly in the same page... so to have a php page say all_classrooms.php
and to show all classrooms together (only the latest record update from each table) in one page, so i am not able to understand how to select the sql query from all tables in the same time and have it limited to the latest record...
my tables are in sequencal orders like this:
classroom_1
classroom_2
classrrom_3
please advise
Comment: I would suggest that you normalize your database design. Put all the classroom data into one table with a column to show what classroom any particular row relates to.
Comment: Why have you got 15 tables for 15 classrooms? You should have three tables - classroom info, students, bookings (or appropriate name)
Comment: So each of tables has a column CLASSROOM_NO and each table has all the same data in that column per table?
Comment: yes LIUFA, exactly, i want it this way so i can update only one table at the time
Answer: As suggested by Kickstart: I would suggest that you normalize your database design. Put all the classroom data into one table with a column to show what classroom any particular row relates to.
Other (workaround) solution that I would not recoment, would be to create a view. That looks like
CREATE VIEW allData AS
SELECT * from Classroom1
UNION ALL SELECT * from Classroom2
....

and then write select from this view.
Comment: thank you again LIUFA, i am unfortunately this is beyond my experience i can't understand it, will try some other basic ways to do, sorry for my english too i know i could be annoying when come to make you guys understand the need :(
Comment: @MikeDerik I have added link on to how to create view, in simple words if you will be selecting same data from multiple tables you usually create a view for that.
Comment: absolutely interesting, you gave me huge homework to learn, thanks dude, will try to understand it and apply accordingly if could, appreciated :)
Answer: It would be best to redesign your database with one table for the classrooms, another for the classes (many rows per classroom), etc.
However if that isn't possible you would need something like this:-
SELECT classroom, id, date, time, classroom_no, students_all, student_current, comments
FROM
(
    SELECT '1' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_1
    UNION
    SELECT '2' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_2
    UNION
    SELECT '3' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_3
    UNION
    SELECT '4' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_4
    UNION
    SELECT '5' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_5
    UNION
    SELECT '6' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_6
    UNION
    SELECT '7' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_7
    UNION
    SELECT '8' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_8
    UNION
    SELECT '9' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_9
    UNION
    SELECT '10' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_10
    UNION
    SELECT '11' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_11
    UNION
    SELECT '12' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_12
    UNION
    SELECT '13' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_13
    UNION
    SELECT '14' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_14
    UNION
    SELECT '15' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_15
) Sub1
INNER JOIN
(
    SELECT classroom, MAX(id) AS maxid
    FROM
    (
        SELECT '1' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_1
        UNION
        SELECT '2' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_2
        UNION
        SELECT '3' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_3
        UNION
        SELECT '4' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_4
        UNION
        SELECT '5' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_5
        UNION
        SELECT '6' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_6
        UNION
        SELECT '7' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_7
        UNION
        SELECT '8' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_8
        UNION
        SELECT '9' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_9
        UNION
        SELECT '10' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_10
        UNION
        SELECT '11' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_11
        UNION
        SELECT '12' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_12
        UNION
        SELECT '13' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_13
        UNION
        SELECT '14' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_14
        UNION
        SELECT '15' AS classroom, id, date, time, classroom_no, students_all, student_current, comments FROM classroom_15
    ) Sub3
    GROUP BY classroom
) Sub2
ON Sub1.classroom = Sub2.classroom AND Sub1.id = Sub2.maxid

Note that I have added a fixed classroom column in the UNION. This might duplicate the value of classroom_no.
It is also concerning that there is a column called students_all. That suggests that you have a column containing a list of the students. If so it would be far better to split that off into another table which could have many rows for each class (one per student in a class)
Comment: i will try this, as i can't change the db design now, i want it this way to be able to update the information of any classroom anytime, and may update only one classroom anytime,, i will try this, but if there is something simipler is also appreciated... my idea was to put all 15 connections under each other on one page, so it will give the 15 classrooms in the same page yet maintain the last record from each classroom data... but i know it is not recommended to have 15 connections in the same page! or what you think?
Comment: No reason to use more than one connection, unless you are using a database class that over writes one query with the next. You can use a single connection and then just pass the resulting $con around (if you need to access a 2nd table when half way through processing a 1st table then just use a different variable to put the result of `mysqli_query(....)` into). You could make the above SQL simpler to use by creating a view based on it but that would not help performance at all (probably slow it down a touch).
Comment: well, i really appreciate your help, i am not that expert to do what you advised, but will try my best to have a big page shows in each row one classroom data, that is the purpose, and this row reflects the latest update of that table (classroom data)... i do see it complicated because i am not that expert :) although i could display the latest update for one classroom using LIMIT 1 and that was achievement, now when comes to an overview of the school and want to show all classrooms data in one page (the latest record from each table only) i see it hard cz i lack of experience, keep trying...
Comment: I will try and explain what the above sql does. What it does is has many queries, one against each rooms table, with the results unioned together. It uses the results of this one along with MAX(id) / GROUP BY classroom. This gets the maximum id for each classroom. It then performs the large query again and joins the results against the results of the max id for each classroom. This gets the other details for each max id per classroom to put them out. You could make the large query into a view, and a view just allows you to use the results of a query as though it were a table.
Comment: thanks a lot Kickstart, appreciated your efforts really, will do my best to understand and apply accordingly.


What is the correct notation for summation not including certain terms?

Question: I want to represent a summation of (say) n terms, but not include (say) the j-th term. Do I represent it like $$\sum_{i=1,i\not=j}^\infty f_i(t) = g(t)$$
Is there any other way? Also, what if there are a number of such j but are random?
Answer: you could define a set first (say A) containing the j values you don't want, and then use:
$\sum_\limits{i=1,i\notin A}^\infty f(t)=g(t)$
Answer: As noted by Roddy MacPhee, you could write
$$ \sum_{\substack{i=1 \\ i\not\in A}}^{\infty} a_i, $$
where $A \subseteq \mathbb{N}$ is the set of indices that you wish to exclude  (note the use of the <code>\substack</code> command; this is perhaps easier to read).  It would also be reasonable to write
$$ \sum_{i\in I} a_i, $$
where $I$ is the set of indices that you wish to sum over.  Note that $I$ can be any set, and needn't be the natural numbers (though if $I$ is uncountable, you might run into trouble).    For example, we could write
$$ \sum_{i=1}^{\infty} \sum_{j=1}^{i} a_{ij}
= \sum_{\substack{i,j\in\mathbb{N} \\ 1 \le j \le i \le \infty}} a_{ij}.
$$
I'm not sure that you would want to, but you could.  ;)
I would also suggest that it is generally poor practice to not indicate in the notation how the terms being summed depend on the index of summation.  When you write
$$ \sum_{i\in I} f(t), $$
do you mean
$$ \sum_{i\in I} f_i(t),
\qquad\text{or}\qquad
\sum_{i\in I} f(t_i)?$$
That is, do the functions depend on $i$, or do the arguments of the function depend on $i$?  Or is something else going on?  You did indicate in your explanation that there is an $i$ in there somewhere, but it is vastly easier to read if the dependence is included in the notation.
Comment: Thanks for the answer, I'll edit the question with regards to the dependency on $i$.


Saved in ArrayLists but wrong output write in a file

Question: Could you please advise what is missing for my code below? My code is running but it didn't write in a file. Inputs where via textfields. Below is what i have.
public class JFrameNewAccount extends javax.swing.JFrame {

 ArrayList<BankAccount> list = new ArrayList<BankAccount>();
 BankAccount account = new BankAccount();

public JFrameNewAccount() {
    initComponents();

 }
private void btnSaveAActionPerformed(java.awt.event.ActionEvent evt) {
account.setAccountName(txt_accountname.getText());
account.setAccountNo(txt_accountnumber.getText());

String fileName = "bank.txt";
    FileWriter file = null;

    try {
        file = new FileWriter(fileName,true);
        PrintWriter pw = new PrintWriter(file);
        for(BankAccount str: list) {
            pw.println(str);
        }

       pw.flush();
       pw.println("\n");

    } catch(FileNotFoundException ex) {
       JOptionPane.showMessageDialog(this, "Can't create your account!");

    } catch (IOException ex) {
        Logger.getLogger(JFrameNewAccount.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
       try {
           file.close();
       } catch (IOException ex) {
           Logger.getLogger(JFrameNewAccount.class.getName()).log(Level.SEVERE, null, ex);
       }
    }

Please advise.
Comment: can you please update the question with above comment?
Comment: I don't see a code, which adds `BankAccount` object to `list`..
Comment: Could you please give me an example of that?
Comment: looks like your `list` is empty. add backAccount to list.. `list.add(backAccount);`
Comment: it prints wrong output: it prints this on the file: finalassignment.BankAccount@b80017

It gives me an error when I'm trying to use list.add(BankAccount);
`account.setAccountName(txt_accountname.getText());
            account.setAccountNo(txt_accountnumber.getText());
            list.add(account);`
Comment: Read the post I've made below. The update 1 is what you need to read to fix the issue you're seeing i.e. the output looking like "finalassignment.BankAccount@b80017"
Answer: You should try posting a SSCCE next time.
Your problem is that you've created an ArrayList (viz. "list"), created an object for the ArrayList (viz. "account"), added data to the object (by calling setAccountName and setAccountNo) and tried to write everything in the ArrayList into the file.
At no point, did you set the object into the ArrayList.
I'm assuming you're trying to create a frame that sets data from the screen into the file. If so, this is what I'd do. (changes are in lines 1 and 4 of your ActionPerformed)
Note: I'm not cleaning up your code (if I could nit pick, I'd write it a bit differently). The point of the response is to show you why your code doesn't work, which is what the question is.
public class JFrameNewAccount extends javax.swing.JFrame {

    private List<BankAccount> list = new ArrayList<>();

    public JFrameNewAccount() {
        initComponents();
    }

    private void btnSaveAActionPerformed(java.awt.event.ActionEvent evt) {
        BankAccount account = new BankAccount();
        account.setAccountName(txt_accountname.getText());
        account.setAccountNo(txt_accountnumber.getText());
        list.add(account);

        String fileName = "bank.txt";
        FileWriter file = null;

        try {
            file = new FileWriter(fileName,true);
            PrintWriter pw = new PrintWriter(file);
            for(BankAccount str: list) {
                pw.println(str);
            }

           pw.flush();
           pw.println("\n");
        } catch(FileNotFoundException ex) {
           JOptionPane.showMessageDialog(this, "Can't create your account!");
        } catch (IOException ex) {
            Logger.getLogger(JFrameNewAccount.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
           try {
               file.close();
           } catch (IOException ex) {
               Logger.getLogger(JFrameNewAccount.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

Update: Just saw your comment. Your solution will not give you the output you need because you're attempting to write an object. You need to override it's toString. Sample below
public class BankAccount {
    private String accountName;
    private String accountNumber;

    @Override
    public String toString() {
        return "Account Name: \"" + accountName + "\"" + System.getProperty("line.separator") + "Account Number: \"" + accountNumber + "\"";
    }

    // Setters and getters here
    public String getAccountName() {
        return accountName;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }
}

Explanation: Streams only write Strings to them. If you try to put an object into System.out.println() you'll get a similarly weird output. The output you see is the default toString() implemented in the Object class in java which shows you the class name and the object's hash code. You can either customise your toString or change the way your write the object to file (by calling getters internally) or the output stream (i.e. System.out.println())
Update 2: If you want to format it with new lines between each field, you can use a "\n" or "\r\n" based on the operating system. It's best to let Java decide which one will work. One of the ways to do that is to use System.getProperty("line.separator") but there are other ways as listed in this wonderful Stack Overflow post asking about platform independent new line characters.
Comment: This is awesome! Thank you so much!!!!! Thanks for the tips! highly appreciated!!!!. I'm having problem in getting the accountType; it was in radiobutton, i can't get it.
Comment: When I'm trying to create a new line for every data, it gives me an error.

how can make the output like this:
Account No: 101 // then new line
Accont Name: John // then new line
Account Type: // then new line
Initial Balance:
Comment: Updated the solution to have new lines as you've requested it.

If you like a solution, you should accept it and up vote it (if you can). It's a good way to show appreciation towards those who take time to help you out :)
Comment: On what line you have modified? Also, how can accept it and vote it?, Sorry, but I'm new here and i don't know how accept it. Uhmm, i have a follow-up question, assuming that i have a radiobutton (for account type, Savings and Checking), how can I get the selected button? Do i have to add a getter and setter for that like with the account number and account name?
Comment: Accepting an answer works as mentioned http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work

You can up vote for an answer by clicking the up arrow on the left of the post you like. You can only do this if you have privileges. As for your second question, I think there is a second post open for it. Best to answer it there. Each StackOverflow question has to stay on track. Can't be answering across posts :)


C++ request for member '' in '', which is of non-class type ''

Question: I have written a simple C++ program which is as follows-
#include<iostream>
using namespace std;

class Rectangle
{
    double length, breadth;

public:
    Rectangle(void);        // constructor overloading
    Rectangle(double, double);  // constructor of class
    // void set_values(double l, double b);
    double area(void);
};  // can provide an object name here

// default constructor of class 'Rectangle'-
Rectangle::Rectangle(void)
{
    length = 5;
    breadth = 5;
}

// constructor of class 'Rectangle'-
Rectangle::Rectangle(double l, double b)
{
    length = l;
    breadth = b;
}

/*
void Rectangle::set_values(double l, double b)
{
    length = l;
    breadth = b;
}
*/

double Rectangle::area(void)
{
    return length * breadth;
}

int main()
{
    /*
    Rectangle r;
    r.set_values(12, 3.4);
    */

    Rectangle r(12, 3.4);
    Rectangle s();

    cout<<"Area = "<<r.area()<<endl;
    cout<<"Area = "<<s.area()<<endl;

return 0;
}

When I try to compile it, I get the following error-
Classes_Example.cpp: In function 'int main()':
Classes_Example.cpp:61:21: error: request for member 'area' in 's', which is of non-class type 'Rectangle()'
  cout<<"Area = "<<s.area()<<endl;

I am using g++ (GCC) 7.2.0
Thanks!
Comment: [Most vexing parse](https://en.wikipedia.org/wiki/Most_vexing_parse). We really need a canonical Q&A entry for this. I'm surprised I can't find one.
Comment: `Rectangle s();` is a function declaration.
Comment: `Rectangle s();` declares a function named `s` that takes no arguments and returns a `Rectangle`. This is known as the most vexing parse in C++. Change it to `Rectangle s;` or `Rectangle s{};`.
Comment: @Cornstalks, I was thinking of the same thing.
Comment: You should always use [list initialization](http://en.cppreference.com/w/cpp/language/list_initialization). No problems with most vexing parse is just one of its benefits.
Comment: @Cornstalks Most Vexing Parse refers to the case when there are also attempted arguments, e.g. `T f( U(x) );`. I call this one the "slightly vexing parse"
Answer: Rectangle s();

is a function declaration rather than variable. In c++ anything that can be parsed as a function declaration takes that parsing over the variable alternative. Removing the () would make it a variable.

C++ request for member ‘’ in ‘’, which is of non-class type ‘’


Newbie confusion on introduction to proofs.

Question: My problem: Show that if $3$ is a factor of $2n$ then $3$ is also a factor of $n$.
Solution: If $3$ is a factor of $2n$ then some integer constant $k$ exist such that $3k=2n$. Now, $2n$ is even hence $3k$ is even and $k$ is even and so $k$ is divisible by $2$
My question: I don't understand the 'some integer constant exist' part. What does this mean and where does it come from?
Comment: The existence of such $k$ is what it means for $3$ to be a factor of $2n$.
Comment: If $p$ is divisible by $q$ then, by definition, $\frac{p}{q}=k$ for some $k$ so $p=kq$.
Answer: That is a definition:
a is a factor of b if there exists some integer constant k such that $b = ak$.


Add where condition with left join

Question: pretty basic question here. but I am stuck with where conditions, knowing that I have multiple left joins and create a sub table w.
Here is the mysql
with w as (SELECT t1.c1, count(DISTINCT(t3.c3)) w from t1
left join t2 on t1.c1 = t2.c2
left join t3 on t3.c3 = t2.c3
left join t4 on t4.c4 and t3.c4

where t1.c4 is true
AND t4.c5 NOT ILIKE '%XXX%'
AND t4.c5 > 0

group by 1)

SELECT
w,
count(id)

from w

group by 1
order by 1 ASC

Can you help me understand where to properly put the 3 conditions and how it would change the result depending on where I put them?
Cheers,
Jeff
Comment: Way too broad. See https://meta.stackoverflow.com/questions/333952/why-should-i-provide-a-minimal-reproducible-example-for-a-very-simple-sql-query
Answer: When you have a query like
...
FROM a LEFT JOIN b ON a.id = b.id

you get every row from a, no matter if there is a corresponding row in b. When there is no corresponding row in b the value is NULL. Therefore when you have a query like
...
FROM a LEFT JOIN b ON a.id = b.id
WHERE b.foo = 'bar'

you implicitly say WHERE b.foo IS NOT NULL, which turns your LEFT JOIN into an INNER JOIN, which basically also filters table a.
There's two ways to fix this. The not so pretty way is of course
WHERE (b.foo = 'bar' OR b.foo IS NULL)

The more elegant way is to put the condition in the join as well.
FROM a LEFT JOIN b ON a.id = b.id AND b.foo = 'bar'

This way you still get every row from a but only the rows from b where all conditions apply.
Is it clear now?
Comment: Exactly, you have your opinion, I have mine (and I think that having the conditions in the join is more readable for me)
Comment: thanks you @fancyPants for the response. really helpful

Add where condition with left join


Creating Migrate.exe at a specific location in Fluent Migrator

Question: I'm using Fluent Migrator 1.6.2 in my .Net application.
For migrating up or migrating down the database, Migrate.exe needs to be executed by passing assembly file (the dll file of the database project in which the migration classes exist) from the command line.
And by default, Migrate.exe file gets created inside \packages\FluentMigrator.1.6.2\tools folder.
I want both these files (Migrate.exe and DbProject.dll) to be created inside the same folder.
Is there any configuration setting in fluent migrator by which I can control the location at which Migrate.exe file gets created and create it inside my DB project?
Answer: No such configuration exists. You however, can set a specific folder in your solution, where you copy the Migrate.exe file and other needed files, then set the properties of your Migrations project, to build to said folder, resulting in binaries generation every time you build the application.
Recommendation here is to have the migrations in their stand alone project inside your solution.


What am I missing for components?

Question: So I have been trying to get a simple java based editor to work that was based for Windows. It is named "Final Fantasy V Advance Editor 1.0" and located here.
Normally most other applications work. But this one does not. I installed Java separately for wine. So that was done. Now when I go to run the application. The task manager shows the .exe loading for a split second then crashes. I have gone through cmd and tried to run wine through that, I got this...
fixme:heap:RtlSetHeapInformation 0x240000 0 0x23fcc0 4 stub
fixme:msvcrt:__clean_type_info_names_internal (0x6d564650) stub
fixme:msvcrt:__clean_type_info_names_internal (0x6ea3b670) stub
fixme:msvcrt:__clean_type_info_names_internal (0x6f486ba0) stub

So it seems to suggest I needed to fix msvcrt, though i did not have it in my library. So I added it and ran again. No such luck came up the same problem. So i've ran out of options and thought I would ask the community on what I'm missing.
Comment: Answer both quests there N0rbert.
https://www.romhacking.net/utilities/907/
Comment: Which editor are you trying to install?
Comment: it does not need installing. It is an editor for snes roms so it can allow me to edit sprites and other aspects of games.
Comment: How it is named? Where we can download it to help you?
Answer: You really do not need Wine. Follow these steps:

download your file FinalFantasyVAdvanceEditor_v1-0.zip
Unzip it with unzip FinalFantasyVAdvanceEditor_v1-0.zip
Install JRE with sudo apt-get install default-jre
Run it directly as java -jar FFVAEditor.exe

What am I missing for components?


WPF excel interop error.'Window' is an ambiguous reference between 'System.Windows.Window' and 'Microsoft.Office.Interop.Excel.Window'

Question: I wrote a small programme to reade data from an excel file in wpf. But i an getting this error:
'Window' is an ambiguous reference between 'System.Windows.Window' and Microsoft.Office.Interop.Excel.Window'.
Why is it happening? My code is given below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Office.Interop.Excel;

namespace FileReader
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }
    Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
    Microsoft.Office.Interop.Excel.Workbook xlWb;
    Microsoft.Office.Interop.Excel.Worksheet xlWsheet;
    private void excel_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            xlWb = xlApp.Workbooks.Open("C:\\Config.xlsm", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            xlWsheet = (Worksheet)xlWb.Sheets["Startup"];
            Range xlRange = xlWsheet.UsedRange;
            for (int rownum = 0; rownum <= 31; rownum++)
            {
                xlRange = xlWsheet.Cells[rownum + 2, 24];
                d32[rownum] = xlRange.Value.ToString().Substring(2);
            }
        }
        catch (Exception e)
        {
            MessageBox.Show("File not found: C:\\Config.xlsm","File not found",MessageBoxButton.OK,MessageBoxImage.Warning);
        }
    }
}

Answer: As stated in error - Window class exists in two namespaces you have used. So, you need to use fully qualified type name.
Replace
public partial class MainWindow : Window

with
public partial class MainWindow : System.Windows.Window

Or you can use shorthand syntax where you can declare alias for namespace and use it  instead of fully qualified namespace.
using WPFWindow = System.Windows;

public partial class MainWindow : WPFWindow.Window

Answer: Problem : you have imported following two namespaces having Window class
using System.Windows;
using Microsoft.Office.Interop.Excel;

hence there is a ambiguity problem while using following statement
public partial class MainWindow : Window

Solution : you can use fully qualified name of a class Window to avoid the ambiguity problem.
Try This:
public partial class MainWindow : System.Windows.Window


Getting a TypeError while creating odd even checker

Question: so basically this is my code, it's supposed to check if num is divisible by 4 and and 2 and print that out. If not it should only check if even or odd. If the user inputs a string instead of int it gives a different message.
    num = (input("number:"""))
try:
    val= int(num)
    if int(num % 2)== 0 and int(num % 4)== 0:
        print("this number is even and divisible by 4!")
    elif (num % 2 == 0):
        print("this number is even")
    else:
        print("this number is odd")
except ValueError:
    print("bro just put a number")

I do realise while creating this that I could solve it by just checking if the number is a multiple of 4 with a single statement as it will always be even so checking if it is also divisible by 2 is redundant. However I'm more interested as to why I'm getting an error.
Error:
dario@Darios-MacBook-Pro Coding % /usr/local/bin/python3 /Users/dario/Desktop/Coding/test.py
number:5
Traceback (most recent call last):
  File "/Users/dario/Desktop/Coding/test.py", line 4, in <module>
    if int(num % 2)== 0 and int(num % 4)== 0:
TypeError: not all arguments converted during string formatting

Comment: After converting string "num" to int "val" you should work with "val" instead of "num".
Comment: Either use val variable or take input in int
num = int((input("number:""")))
Comment: use num= int(num) instead of val= int(num)
Comment: _while creating this I could solve it by just checking if the number is a multiple of 4 with a single statement_ - `6` is even but is not divisible by `4`.
Comment: @ack no but instead of if int(num % 2)== 0 and int(num % 4)== 0: you could just put if int(num%4)==0: and it would be divisible by 4 it would always be even so no need for the double statement. After that you could still check for the 'elif (num % 2 == 0):'
Answer: Is there a way to check if the user did indeed input an int instead of string without converting "num" to "val"?
str.isdigit() returns True if all characters in the string are digits and there is at least one character, False otherwise.
while True:
    inp = input('number: ')
    if inp.isdigit():
        if int(inp) % 2:
            print(f'{inp} is odd')
        else:
            if not (int(inp) % 4):
                print(f'{inp} is divisible by 4')
            else:
                print(f'{inp} is even')
    else:
        print('bro just put a number')

Answer: You need to parse the num value, use int(num) instead of int(num % 2) == 0 or just replace num with val.
At the end you will have this:
num = (input("number: """))
try:
    val = int(num)
    if val % 2 == 0 and val % 4 == 0:
        print("this number is even and divisible by 4!")
    elif (val % 2 == 0):
        print("this number is even")
    else:
        print("this number is odd")
except ValueError:
    print("bro just put a number")

Answer: Take a look at your code again. You have defined
val= int(num)
But you never use the val variable in your code.
Comment: Thanks! this fixed it. Is there a way to check if the user did indeed input a int instead of string without converting "num" to "val"? I got this "try:" solution from another post, that's why I didn't exactly know what it did.
Answer: So I just fixed it with help of the comments, since I converted string "num" to int "val" I had to then use "val" for the statements.
   num = (input("number:"""))
try:
    val= int(num)
    if int(val % 2)== 0 and int(val% 4)== 0:
        print("this number is even and divisible by 4!")
    elif (val % 2 == 0):
        print("this number is even")
    else:
        print("this number is odd")
except ValueError:
    print("bro just put a number")

This is the working code.
Answer: put the input() function inside the try... except... block, and convert the input value direct with int(input("number: "))
try:
    num = int(input("number: "))
    if num % 4 == 0:
        print("this number is even and divisible by 4!")
    elif num % 2 == 0:
        print("this number is even")
    else:
        print("this number is odd")
except ValueError:
    print("bro just put a number")````


ModelChoiceField: remove empty option and select default value

Question: I'm using the default form field for a models.ForeignKey field, which is a ModelChoiceField using the Select widget.
The related model in question is a Weekday, and the field was made nullable so that it didn't force a default value on hundreds of existing entries. However, in practice, our default should be Sunday, which is Weekday.objects.get(day_of_week=6).
By default the select widget for a nullable field when rendered displays the null option. How can I discard this option and have a default value instead?
If I set a initial value, that one is selected by default on a new form:
self.fields['start_weekday'].initial = Weekday.objects.get(day_of_week=6)

But the empty value is still listed. I tried overriding the widget choices:
self.fields['start_weekday'].widget.choices = [(wd.day_of_week, wd.name) for wd in Weekday.objects.all()]

However now Sunday isn't selected by default. I thought maybe I need to use the option value as the initial one but that didn't work either:
self.fields['start_weekday'].initial = Weekday.objects.get(day_of_week=6).pk

In short: how can I remove the empty option in a nullable model field and select a default instead?
Answer: Provide empty_label=None in ModelChoiceField
start_weekday = ModelChoiceField(Weekday.objects.filter(day_of_week=6), empty_label=None)

OR
instead of assigning initial, you can assign empty_label also
self.fields['start_weekday'].empty_label = None

OR
you can provide default value in field in models also
start_weekday = models.CharField(max_length=10,choices=[(wd.day_of_week, wd.name) for wd in Weekday.objects.all()],default=6)


auth0 - redirect to /login after authentication

Question: I am stuck in strange error. I am trying to protect my client side route. I have this code
<Router history={history} component={App}>

            <Route path="/login" render={(props) => <Login auth={auth} {...props} />} />
            <Route path="/apphome" render={(props) => <Apphome auth={auth} {...props} />} />
            <Route path="/apphome" render={(props) => (
                  !auth.isAuthenticated() ? (
                    <Redirect to="/login"/>
                  ) : (
                    <Apphome auth={auth} {...props} />
                  )
                )} />
            <Route path="/contacts" exact component ={Contacts} />
            <Route path="/mytodo" exact component ={Mytodo} />
            <Route path="/favorites" exact component ={Favorites} />
            <Route path="/mention" exact component ={Mention} />
            <Route path="/profile" exact component ={Profile} />
            <Route path="/buy" exact component ={Buy} />
            <Route path="/success" exact component ={Success} />
            <Route path="/cancel" exact component ={Cancel} />

        </Router>

Now, i go to login page, login and it goes back to login page. But, when i dont protect this route and I have it unprotected like

It works perfectly and after login, i go to this Apphome component.
I am using react.js and auth0 . What's the issue here?
Thanks in advance
Answer: Auth0 allows you to specify a callback route which will be called once you're authenticated. Login to auth0.com and list the callback routes you expect to be called. https://manage.auth0.com/#/applications
Then in your code you'll need to define the route:
<Route
    path="/callback"
    render={props => {
        handleAuthentication(props);
        return <Loading />;
    }}
/>

In the handleAuthentication function, redirect the user to any page after you validate their credentials:
handleAuthentication() {
    this.auth0.parseHash((err, authResult) => {
        if (authResult && authResult.accessToken && authResult.idToken) {
            this.setSession(authResult);
            this.history.replace("/");
        } else if (err) {
            this.history.replace("/auth/failed");
        }
    });
}

Now after auth0 has done the authentication, it should trigger your  callback. For example on dev: http://localhost:3000/callback. This should fire your your handleAuthentication function.


Integrating MLFlow with Kubeflow

Question: I am trying to integrate a MLFlow server with my Kubeflow cluster on GCP. To do this I create a an MLFlow deployment and expose it using a Loadbalancer.
The machine learning code is deployed as a pod on the Kubeflow cluster. The MLflow server IP:PORT is provided for logging parameters (e.g. hyper-parameters) and artifacts (e.g. models).
The issue is that the artifacts only get logged within the docker image (pod with the machine learning code). The parameter logging on the other hand works perfectly fine after providing the MLflow server IP:PORT.
Here is a screenshot.
Comment: How are you starting your mlflow server? Can you show your Dockerfile?
Answer: The simple solution is to create and mount a volume to both ml mode pod and mlflow pod. This only shows that your files are not in a volume that is accessible for the UI. Please share the details about mlflow pod and ml model pod.
Lets say Mod1 is a pod for your model
Mlflowpod is where mlflow is deployed.
You create a volume 'Mlflow-artifacts' attach that to both pods. And set that as default backend uri for mlflow service. This will definitely help. Since both pods are in the same cluster there is a very low probability that you are facing any loadbalanver or routing issues.

Integrating MLFlow with Kubeflow


Sketching curve

Question: Does anyone know how to sketch $y^2=x^2(a^2-x^2)?$ Here $a$ is a constant.
I only know that $2y\cdot \frac {dy}{dx}=2x (a^2-2x^2)$ so when $\frac {dy}{dx}=0, x^2=a^2/2.$
Thanks.
Comment: Have you noticed that this is an array of curves?
Answer: Note that there is a symmetry about $x-$axis and also about $y-$axis. Thus you can reduce your sketch to the first quadrant. Polar coordinates will help.
Wolframalpha gives this  for $a=1, a=2, a=4.$

Answer: Rewriting $y^2=x^2(a^2-x^2)$ using the substitution $x = a \cos \theta$, we get its parametric form:
$( a \cos \theta,a^2 \cos \theta \sin \theta ), \ \theta \in [-\pi,\pi)$
which is a family of Lissajous-like curves, one of which for $a=1$ is plotted below

Plots of remaining ones for $-10 \le a \le 10$ can be explored here

Sketching curve


How can I remove paint from a deck?

Question: I bought my house 3 years ago. The deck surface and decorative fence around the edge are painted with a latex-based paint.  After shoveling snow each winter, the deck surface is chipped with raw wood exposed.  I have painted it twice but this seems like a poor approach going forward.  I would like to remove the paint from the surface (3 layers) and stain/seal the deck -- eliminating the need to take care of its surface each spring.
What do you recommend?
Answer: For the main deck, I would recommend a floor sander, similar to what's used for finishing hardwood floors. Put a 100-120-grit belt on it and take it back and forth along the deck in the same direction as the planks until you see bare wood. Once you have bare wood, I would apply whatever stain or sealant you want very quickly thereafter, as you have just removed a large portion of both the artificial and natural weather and bug resistance the wood had.
A handheld orbital or belt sander will get most of the stuff off the vertical components (handrails and pickets). You'll need a "corner cat" or other detail sander, or some elbow grease, to get the paint out of crevices and detail work.
You will not be able to avoid taking off some wood along with the paint. Paint (especially a product designed for this kind of outdoor application) will seep into the grain of the wood, and you will be removing wood before you see the color disappear and bare wood show through.
By the way, you will still need to maintain the deck after staining and sealing. The stain will last for quite a while, but you'll need to re-apply the water seal at least once a year, once every 6 months if you get a lot of rain.
Answer: It's going to take a lot of elbow grease in the form of scraping and sanding.  After you do this, it might be helpful to pressure wash it before re-staining it.
The easiest solution will be to keep painting it.  As the other answer points out, neither stain or paint lasts forever, and no matter what you do, you will need to keep refreshing it every couple years.
You don't mention what type of wood it is, but cedar, for example, will turn gray but otherwise is pretty resilient to nature and will last a long time even if you don't do anything to it.
Answer: Use a pressure washer. The best solution to removing paint from a surface like this. You can buy an inexpensive one for roughly $100, or rent one for less than that.
The problem is, stain does not last forever. If you don't like gray wood, then you will need to stain/seal the deck periodically anyway, and you may well need to do so more often.
Comment: I contacted 2 folks doing pressure-wash and they said it wouldn't remove the paint.  they recommended sanding.
Comment: I also contacted a residential sandblast company and they indicated that it would damage the wood.
Answer: Oh believe you me, pressure washing will remove the stain (deck paint) with a decent pressure washer.  I just did it on 220 sq/ft.  took about 4 hrs but it's clean enough so now I can finish it with a quick sanding using an orbital upright sander.  You just have to give it a week or so of sunny hot weather to dry before you stain it again.  Splash a few areas with water and if the water absorbs into the wood quickly you can stain (splash test).  You could also buy a moisture meter for $25 and test it that way.

How can I remove paint from a deck?


Can someone please tell me why it is 4?

Question: Consider the following method:
public int foo(int n) {
    int x = 1;
    int k = 0;
    while (x <= n) {
        x = x * 2;
        k = k + 1;
    }
    return k;
}

What value is returned by foo(13)? I know the answer is 4 but could someone please tell me why it is 4?
Comment: Is there something else you think it should be? Have you tried simply going through the sequence of steps the program would perform?
Comment: It's funny how much attention this question is attracting.
Comment: Really??? I mean by the time you wrote the question you could have done the calculation using your fingers..
Answer: x doubles with every iteration through the loop, and k increases by 1 every time through.
It's simple enough to draw out with a table.
x  |  k
1  |  0
2  |  1
4  |  2
8  |  3
16 |  4
32 | <end of loop>

Answer: x doubles at each step until it becomes greater than 13. So x = 1 -> 2 -> 4 -> 8 -> 16. So it gets doubled 4 times and k is also incremented 4 times. So from 0 it becomes 4.
Answer: Below is the step/algorithm steps:
X=1 k=0 n =13

Step 1: x=2 k=1

Step 2: x=4 k=2

Step 3: x=8 k = 3. Since 8<13...

Step 4: x=16 k= 4. 16>13, so return k=4.

Answer: Its finding n < 2^k where k is your answer. When n = 13: 13 < 2^k = 2^4 = 16.
Answer: K is the number of times the while loop is entered.
As x is 2 power, 2^3 is little than 13, so it enters one last time, 2^4 is bigger than 13, and then k is 4
Answer: pretty simple...
public int foo([13]) {
    int x = 1;
    int k = 0;
    while (x <= n) {
        x = x * 2;
        k = k + 1;
    }
    return k;
}

your while loop stops when x is bigger or equal to n[13]
each time x is multiplied by 2
(definition)x = 1

x =    2
x =    4
x =    8
x =    16 (is now over n[13])

and so the while loop runs 4 times
while (x <= n) {
            x = x * 2;
            k = k + 1;//dis thang
        }

k[0]+1=1
k[1]+1=2
k[2]+1=3
k[3]+1=4
and thats why its 4.

Can someone please tell me why it is 4?


How to pass array of tables from client to webapi and get it as dataset

Question: anyone know how to do the following:
client:
this.editFileAndSave = function (tablesRaw) {
    return $http.put(uploadUrl, {
        params: { newDS: tablesRaw }
    })
}

Server(web api):
[HttpPut]
    public HttpResponseMessage SaveFile(DataSet newDS)

when i try this it get to the SaveFile function but with null.
i need to send array of arrays to the server and there to get it as dataset.
any idea how?
Answer: You must send it as JSON and get it as JSON.
Or if you want to get DataSet exact in the method, you must write Custom Model Binder.
See this: Custom Model Binding


Hibernate fails to validate in-memory h2 database after flyway migration using Spring-Boot

Question: Hibernate fails to validate database schema, which is created by flyway migration. (database migration script is correct) Is this because of in-memory H2 database? It almost looks like hibernate connects to different database than flyway.
Steps to reproduce:
Create spring-boot project with h2, flyway and jpa (hibernate).
application.properties:
spring.datasource.url=jdbc:h2:mem:flyway_db
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.flyway.baseline-on-migrate=true
spring.flyway.url=jdbc:h2:mem:flyway_db

Example entity:
@Entity
@Table(name = "test_entity")
public class TestEntity {

    public int getId() {
        return id;
    }

    public void setId(final int id) {
        this.id = id;
    }

    public String getDesc() {
        return description;
    }

    public void setDesc(final String desc) {
        this.description = desc;
    }

    @Id
    private int id;
    private String description;
}

V1__init.sql script:
CREATE TABLE test_entity
(
    id INTEGER,
    description VARCHAR(255),
    PRIMARY KEY(id)
);

Expect application run fail: full log:
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.6)

2022-05-20 12:53:54.920  INFO 10104 --- [           main] flyway_hibernate_h2.test.Application     : Starting Application using Java 11.0.15 on cfe484487b08d045fbee329048f51788 with PID 10104 (/home/gitrow/eclipse-workspace-new/spring.flyway_hibernate_h2.test/target/classes started by gitrow in /home/gitrow/eclipse-workspace-new/spring.flyway_hibernate_h2.test)
2022-05-20 12:53:54.926  INFO 10104 --- [           main] flyway_hibernate_h2.test.Application     : No active profile set, falling back to 1 default profile: "default"
2022-05-20 12:53:55.594  INFO 10104 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-05-20 12:53:55.613  INFO 10104 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository interfaces.
2022-05-20 12:53:56.163  INFO 10104 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 8.0.5 by Redgate
2022-05-20 12:53:56.164  INFO 10104 --- [           main] o.f.c.i.database.base.BaseDatabaseType   : Database: jdbc:h2:mem:flyway_db (H2 1.4)
2022-05-20 12:53:56.241  INFO 10104 --- [           main] o.f.core.internal.command.DbValidate     : Successfully validated 1 migration (execution time 00:00.027s)
2022-05-20 12:53:56.263  INFO 10104 --- [           main] o.f.c.i.s.JdbcTableSchemaHistory         : Creating Schema History table "PUBLIC"."flyway_schema_history" ...
2022-05-20 12:53:56.337  INFO 10104 --- [           main] o.f.core.internal.command.DbMigrate      : Current version of schema "PUBLIC": << Empty Schema >>
2022-05-20 12:53:56.344  INFO 10104 --- [           main] o.f.core.internal.command.DbMigrate      : Migrating schema "PUBLIC" to version "1 - init"
2022-05-20 12:53:56.381  INFO 10104 --- [           main] o.f.core.internal.command.DbMigrate      : Successfully applied 1 migration to schema "PUBLIC", now at version v1 (execution time 00:00.054s)
2022-05-20 12:53:56.517  INFO 10104 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-05-20 12:53:56.558  INFO 10104 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.7.Final
2022-05-20 12:53:56.736  INFO 10104 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-05-20 12:53:56.832  INFO 10104 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-05-20 12:53:56.854  INFO 10104 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-05-20 12:53:56.874  INFO 10104 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2022-05-20 12:53:57.385 ERROR 10104 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_entity]
2022-05-20 12:53:57.386  WARN 10104 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_entity]
2022-05-20 12:53:57.386  INFO 10104 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2022-05-20 12:53:57.393  INFO 10104 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2022-05-20 12:53:57.402  INFO 10104 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-20 12:53:57.427 ERROR 10104 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_entity]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.18.jar:5.3.18]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[spring-context-5.3.18.jar:5.3.18]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.18.jar:5.3.18]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.6.jar:2.6.6]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.6.jar:2.6.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.6.jar:2.6.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.6.jar:2.6.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.6.jar:2.6.6]
    at flyway_hibernate_h2.test.Application.main(Application.java:10) ~[classes/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_entity]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421) ~[spring-orm-5.3.18.jar:5.3.18]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.18.jar:5.3.18]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.18.jar:5.3.18]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.18.jar:5.3.18]
    ... 15 common frames omitted
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_entity]
    at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:129) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:97) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:76) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:204) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:85) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:335) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1498) ~[hibernate-core-5.6.7.Final.jar:5.6.7.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.18.jar:5.3.18]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.18.jar:5.3.18]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.18.jar:5.3.18]
    ... 19 common frames omitted

What I tried: explicitly name in memory database, explicitly name schema for both datasource and flyway.
Comment: Try to ommit the line spring.flyway.url=jdbc:h2:mem:flyway_db.
Comment: @pringi So, can it be understood as this?: When the line is ommited, when flyway runs, it gets the datasource, but db is not closed and when hibernate runs, db is still there? Its so unexpected to me, that by defining flyway.url it will close db after it will do its job.
Comment: Does the `flyway_schema_history` table contains the `V1` entry and is the table `test_entity` existing after the startup?
Comment: @pringi wow, ommiting that line helps, why when url is same?
Comment: Because H2 in memory will auto close the DB. Since Flyway runs first, flyway will do it's job (as it is demonstrated by your logs), and then the db closes. Then spring will create the datasource on a new database (with the same url).
Comment: For anyone reading during the bounty: you can post answer if you can provide in-depth explanation, even when we know now that problem can be fixed by ommiting line that sets flyway.url.
Answer: As noted in the comments below the question, the problem can be solved by removing the property spring.flyway.url from the properties file.
If the property is not set, then Spring Boot will configure Flyway with either the primary DataSource or, if it exists, the DataSource that is annotated with @FlywayDataSource. The property spring.flyway.url exists to override this selection process with a concrete connection string. The relevant code for this can be found in the class FlywayAutoConfiguration.
In the particular case of H2, overriding the connection string leads to the issue that H2 databases do not remain open after a transaction unless the connection string contains the flags that tell it do so. This explains the observation in the question that Flyway runs against a database that is afterwards closed and then Hibernate connects to a clean new instance of H2.
This follows the usual patterns of Spring Boot and its philosophy of auto-configuration. Auto-configuration is intended to work hands-off and being triggered by things merely being on the classpath. Accordingly, for many of its features no property or code is required to enable them.
At the same time, Spring Boot can only use sensible defaults or heuristics on what auto-configuration should configure in which cases. Therefore, Spring Boot comes with extensions points and flags that let the auto-configuration back off easily if it's not doing the right thing. The property spring.flyway.url is one of these flags.


Unknown props - react and material-ui

Question: Currently I'm using react and material-ui and I've the following code in my component.
<Dialog
    title="Dialog With Actions"
    actions={actions}
    modal={false}
    open={this.state.open}
    onRequestClose={this.handleClose}>
      Are you sure that you want to proceed?
  </Dialog>

I've imported
import React from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';

But I'm always getting the following error message
Warning: Unknown prop `onKeyboardFocus` on <button> tag. Remove this prop from the element.
Warning: Unknown prop `keyboardFocused` on <button> tag. Remove this prop from the element.

Comment: Probably has to do with the `FlatButton` and not the `Dialog`, right?
Comment: the"actions" are flatButtons     const actions = [
      ,
      ,
    ];
Answer: Use react-tap-event-plugin to resolve this issue. After installing do this -
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();

Comment: this worked for me

btw my material-ui ver > 1.5.2 (so the other answer didn't work).
Comment: be sure to have react and react-dom updated to **^15.4.0**, otherwise you'll get error ```Error: Cannot resolve module 'react/lib/EventPluginHub'```  - https://github.com/prescottprue/generator-react-firebase/issues/27
Answer: First, this is a warning and not an error message i.e. your code is still working. If you follow the link in the warning message, you can find out that:

The unknown-prop warning will fire if you attempt to render a DOM
  element with a prop that is not recognized by React as a legal DOM
  attribute/property. You should ensure that your DOM elements do not
  have spurious props floating around.

There are more details and the possible reasons, but if I have to speculate you are passing all props to the button element.
Also interesting  is a comment bellow the note:

For anyone who is curious/wondering why this new warning exists...

Historically, React has maintained a whitelist of all valid DOM
    attributes, and we would strip unrecognized attributes. This approach
    has a couple major downsides:

Performance: It means we must do a check for every prop on every DOM    element, to sanity check that the prop is valid, and strip the
    prop    if it is not legal. This is silly, because the majority of
    elements    are completely safe (no illegal attributes) and thus the
    checks are    just wasted CPU cycles.
The old technique forced us to maintain a huge whitelist of all    possible DOM attributes. This is a pain to maintain, but more
    importantly, if we accidentally miss one or browser vendors add a new
    one, it means that prop can't be used until we update our whitelist
The old technique is less flexible because it is impossible to render    a non-standard attribute. While rendering non-standard
    attributes is    not recommended (you should use a data- attribute
    instead), sometimes    there are situations/frameworks that require
    it. It sucks that React    previously couldn't support it.

As we move toward removing this whitelist, we need to give people an
  opportunity to clean up their existing apps. This way, an upgrade
  doesn't result in us dumping a ton of unexpected props into the DOM.

EDIT:
Most probably this is coming from the jsx of the library you are using ( material-ui ) Check if you are using the latest version or if you are, they should probably address it soon
Answer: This is an issue with material-ui that they've already fixed. Wait for their 0.15.2 release or get their master branch now.

Unknown props - react and material-ui


How can someone structure a PostgreSQL query that returns high integer numbers like 534,000,000 to 534m or 1,320,000,000 to 1.3 b

Question: I came across this post: https://www.sisense.com/blog/how-to-format-numbers-as-currency-in-postgres-mysql-and-redshift/ and they mentioned how to format currency data using money datatype.
I actually really like the human readable approach of transforming large numbers with several digits. I'm trying to figure out how to create an SQL query to achieve such. Sadly the blog only teases this in a picture, without the code...
So I'm pretty stuck here, I would like to implement this in my stock market dashboard, how could I approach this?
more examples:
1230 = 1.2k
12,312,312 = 12.3 m
Comment: `how to format currency data using money datatype` that's **definitely not** what the `money` type is about. It's a *type*, not a formatting function. Which makes that a pretty bad article, especially once you consider you have no control over how the monetary amount actually looks. What symbol? Before or after the amount? Do negative amounts use a sign or parentheses? Or a different color? All of this depends on the actual *report* or *dashboard* you want to create. The same user will need different formats for different reports
Comment: You're asking about formatting, not querying. That's a job for the client, not SQL. SQL, the language, is pretty bad at text manipulations and formatting.
Answer: I think that the dashboard should take care of data formatting for display.
If you insist on using the DB for that, then the PostgreSQL  pg_size_pretty function can convert numbers into "human readable" representations.
Comment: I just tried your `pg_size_pretty` method, It's appending memory sizes as opposed to numerical digits in string format. (Gb instead of M, gigabytes instead of millions) But yes this is exactly the type of transformation I'm searching for, do you know if I can edit pg_size_pretty?
Comment: I only feel like it is necessary because I am serving a lot of data (multiple tables of stock market information). I'm afraid if I use a lot of python functions for transformations then my dashboard will slow down. I would rather go with performance. I'm a junior developer so If you think It's a bad idea then I would kindly like to know.


How do I indicate that fields are mandatory in Windows Desktop UI?

Question: I need a method of indicating that certain fields are required within my forms on a Windows Desktop UI.
I have read and searched the Windows Design Guidelines, but can not find a standard that Windows suggests to use. Is there a standard method in Windows of indicating this?
Windows Design Guidelines:
https://msdn.microsoft.com/en-us/library/windows/desktop/dn688964.aspx
I know that a common method is to use an asterix beside required fields, is this the standard on Windows too?
N.b. I am not referring to validation messages or feedback after a user has interacted with a form, I am referring to the display of the form on initial load.
Answer: Microsoft does actually provide some guidance for this in the context of dialog boxes. They suggest a few different approaches which are similar to those found on the web, and to some extent in Mac OS.

To indicate that users must provide information in a control, consider
  the following options:

Don't indicate anything but handle missing required input with error messages. This approach reduces clutter and works well if most
  input is optional or users aren't likely to skip controls, thus
  keeping the number of error messages low.
Indicate required input using an asterisk at the beginning of the label. Explain the asterisk using either:

A footnote at the bottom of the content area that says * Required input.
A tooltip on the asterisk that says Required input.

This approach works well if there aren't many required controls, but
  poorly if most controls are required. If all controls require input,
  state "All input required" at an appropriate place at the top of the
  content area. This approach reduces clutter for this specific case.
Comment: @Matt_Obee That's the best example I've ever seen of how a UX.SE answer should be written.
Comment: Why did they put that section under 'Dialog Boxes'... thanks for providing that link, exactly what I was after