text:
Q: I am using the epublib and I am trying to get the entire chapter of a book at a time I am trying to get one chapter at a time of a book. I am using the Paul Seigmann library. However, I am not sure how to do it but I am able to get all the text from the book. Not sure where to go from there.
// find InputStream for book

InputStream epubInputStream = assetManager

            .open("the_planet_mappers.epub");

        // Load Book from inputStream

        mThePlanetMappersBookEpubLib = (new EpubReader()).readEpub(epubInputStream);

        Spine spine = new Spine(mThePlanetMappersBookEpubLib.getTableOfContents());
        for (SpineReference bookSection : spine.getSpineReferences()) {
            Resource res = bookSection.getResource();
            try {
                InputStream is = res.getInputStream();
                BufferedReader r = new BufferedReader(new InputStreamReader(is));
                String line;
                while ((line = r.readLine()) != null) {
                    line = Html.fromHtml(line).toString();
                    Log.i("Read it ", line);
                    mEntireBook.append(line);
                }
            } catch (IOException e) {
            }

A: I don't know if you're still looking for an answer, but...
I'm working on it too right now. This is the code I have to retrieve the content of all the epub file:
public ArrayList<String> getBookContent(Book bi) {
    // GET THE CONTENTS OF ALL PAGES
    StringBuilder string = new StringBuilder();
    ArrayList<String> listOfPages = new ArrayList<>();
    Resource res;
    InputStream is;
    BufferedReader reader;
    String line;
    Spine spine = bi.getSpine();
    for (int i = 0; spine.size() > i; i++) {
        res = spine.getResource(i);
        try {
            is = res.getInputStream();
            reader = new BufferedReader(new InputStreamReader(is));
            while ((line = reader.readLine()) != null) {
                // FIRST PAGE LINE -> <?xml version="1.0" encoding="utf-8" standalone="no"?>
                if (line.contains("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>")) {
                    string.delete(0, string.length());
                }

                // ADD THAT LINE TO THE FINAL STRING REMOVING ALL THE HTML
                string.append(Html.fromHtml(formatLine(line)));

                // LAST PAGE LINE -> </html>
                if (line.contains("</html>")) {
                    listOfPages.add(string.toString());
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return listOfPages;
}

private String formatLine(String line) {
    if (line.contains("http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd")) {
        line = line.substring(line.indexOf(">") + 1, line.length());
    }

    // REMOVE STYLES AND COMMENTS IN HTML
    if ((line.contains("{") && line.contains("}"))
            || ((line.contains("/*")) && line.contains("*/"))
            || (line.contains("<!--") && line.contains("-->"))) {
        line = line.substring(line.length());
    }
    return line;
}

As you may have notice I need to improve the filter, but I have every chapter of that book in my ArrayList. Now I just need to call that ArrayList like myList.get(0); and is done.
To show the text in a proper way, I'm using the bluejamesbond:textjustify library (https://github.com/bluejamesbond/TextJustify-Android).
It is easy to use and powerful.
I hope it helps you, and if anybody finds a better way to filter that html, notice me, please.


text:
Q: Apache Drill UI server binding issue I am trying to configure Apache drill.
I have downloaded, build and tested few things already, clustered configured on Zookeeper seems to run fine.
I am okay with the drill bit startup and all but the inbuilt Jetty server used by Drill is not binding to all the ips automatically.
Output of netstat:
$>sudo netstat -nlp | grep 8047
tcp6       0      0 :::8047                 :::*                    LISTEN      23041/java

I want to make it listen from 0.0.0.0.
Any pointers appreciated.

A: Delving into it a bit, I see in the source code, drill uses Jetty Server class for the UI, that class has a convenience constructor that only accepts a port.
http://api.dpml.net/org/mortbay/jetty/6.1.0/org/mortbay/jetty/Server.html
Looks like it would require using the .addConnector() to support port and IP address.

redpajama_set_name: RedPajamaStackExchange


text: Q: using connectors to read from office365 excel file I've been reading a lot about connectors and I'm trying to develop a .net application that is able to read data from an excel file in office 365 much like power apps such as power automation. The problem is in the documentation https://learn.microsoft.com/en-us/connectors/custom-connectors/use-custom-connector-logic-apps I only find ways to connect a file using azure or power apps. How can I read data from an office 365 file using my own .net application?


text:
Q: Associar commit ao Issues do Bitbucket Com o Bitbucket é possível trabalhar com "Issues", onde no caso poderia ser utilizado como "tarefas/bugs/etc...". A minha dúvida seria se é possível associar um ou mais commits a determinado "Issues".
Caso não seja possível, existe alguma ferramenta que possibilite trabalhar desta forma?

A: Sim, podes usar #<issue-number> na mensagem do commit, tal como no GitHubt.
Exemplo retirado da documentação:

fixes #6, resolve ticket #5 and see ticket #9 and ticket #5 in the tracker

Documentação: Resolve issues automatically when users push code
Ceritifica-te que em Settings > Hooks aparece um hook chamado Issues.


text:
Q: How to make a non-blocking PrinterJob pageDialog in Java? Below is code to create a simple window with a useless button in it and a PrintingJob that automatically opens a page dialog when the program starts:
import java.awt.BorderLayout;
import java.awt.print.PrinterJob;
import javax.swing.JButton;
import javax.swing.JFrame;

public class DummyCode {
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new JButton("TEST"), BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
    PrinterJob pj = PrinterJob.getPrinterJob();
    pj.pageDialog(pj.defaultPage());
  }
}

Current behavior: The page dialog blocks user inputs to the rest of the application - it's not possible to click or move the application window.
Wanted behavior: The page dialog shall not block user inputs to the rest of the application - it shall be possible to click and move the application window.
From what I can see pageDialog() creates a WPageDialog which extends Dialog and is hardcoded to set modal=true, aka it blocks user input to other top-level windows when shown. I essentially want modal=false such that user input to other top-level windows are not blocked by the dialog, but this is not immediately modifiable.
Running the pageDialog in it's own thread does not resolve the issue.
Is there some nifty workaround for this to achieve the wanted behavior?

A: Here is an example of creating a ServiceDialog explicitly, which doesn't block the origin JFrame (or anything really).
mport sun.print.ServiceDialog;

import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.print.PrinterJob;

public class TestPrint {

    public static void main(String[] args) throws Exception{
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton test = new JButton("TEST");
        test.addActionListener(evt -> System.out.println("action!"));

        frame.getContentPane().add(test, BorderLayout.CENTER);
        frame.pack();
        frame.setVisible(true);

        final GraphicsConfiguration gc =
            GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        PrintService service = PrinterJob.getPrinterJob().getPrintService();
        ServiceDialog log = new ServiceDialog(gc, 500, 500, service, DocFlavor.SERVICE_FORMATTED.PAGEABLE, new HashPrintRequestAttributeSet(), frame);
        log.setModal(false);
        log.setVisible(true);
        System.out.println("waiting");
    }
}

Something that probably shouldn't be done. The example at the bottom starts a separate process with jshell running and creates the print dialog. The original gui stays responsive.
import java.awt.BorderLayout;
import java.awt.print.PrinterJob;
import java.awt.Dialog;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
public class DummyCode {

    static void drain(Process proc) throws Exception{
        InputStream is = proc.getInputStream();
        InputStreamReader reader = new InputStreamReader( is, "UTF8");
        new Thread( ()->{
            char[] buffer = new char[512];
            try{
                int read = reader.read(buffer, 0, 512);
                while(read >= 0 ){
                    System.out.println( new String(buffer, 0, read ) );
                    read = reader.read(buffer, 0, 512);
                }
            } catch(IOException e){
                e.printStackTrace();
            }
        } ).start();
    }

  public static void main(String[] args) throws Exception{
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton test = new JButton("TEST");
    test.addActionListener(evt -> System.out.println("action!"));

    frame.getContentPane().add(test, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
    Process proc = Runtime.getRuntime().exec("/usr/bin/jshell");

    drain(proc);

    OutputStream os = proc.getOutputStream();
    OutputStreamWriter writer = new OutputStreamWriter( os, "UTF8" );
    writer.write( "import java.awt.print.PrinterJob;\n");
    writer.write( "PrinterJob pj = PrinterJob.getPrinterJob();\n");
    writer.write( "pj.pageDialog(pj.defaultPage());\n");
    writer.flush();

  }
}


text:
Q: Can I safely delete all the Win-7 installer cache files once updates complete? I have a forced windows update every month, these seem to leave copies of the installation binaries long after the update has been installed.
In the past, when short of c:\ disk space, I have deleted some of these, but on each occasion have lost licences as a result.
Is this just a coincidence?  Should I be able to delete these binaries (a selection below) as they seem to be working copies of windows files?
For example the largest 8 files, in the largest installer cache folder, are very old versions of MSOffice files, for example here are the active versions for the totally obsolete version still being held in the installation cache

C:\Program Files (x86)\Microsoft Office\Office14
  MSACCESS.EXE              13,802,160 2018-02-17 17:15:24
C:\Program Files (x86)\Microsoft Office\Office12
  MSACCESS.EXE               9,896,112 2015-10-14 07:55:30

So ideally I'd like to delete all the content of the Managed folder, the latest subfolder [2018-07-06] is already  5 months old

C:\Windows\Installer\$PatchCache$\Managed 1.8GB "Managed": Sub-Folders=171, Files=2399

Folder summary:

C4286E3D5810BA7498039DF94A0411C6    2018-07-06 13:48:31      Latest
  ...
  00004109110000000000000000F01FEC    2017-10-24  460 MB       Biggest
MSORES.DLL                72,521,600 2010-03-22 20:36:56
  GROOVE.EXE                30,969,208 2010-03-25 10:25:22
  EXCEL.EXE                 20,753,760 2010-03-13 14:53:52
  OART.DLL                  20,516,712 2010-03-13 15:08:22
  WWLIB.DLL                 19,370,840 2010-03-27 08:38:44
  MSO.DLL.x86               18,743,168 2010-03-23 11:03:04
  XL12CNV.EXE               17,800,544 2010-03-13 00:50:14
  MSACCESS.EXE              13,988,704 2010-03-01 05:09:14
00002109030000000000000000F01FEC    2017-09-18  448 MB  2nd Biggest
  00002109150000000000000000F01FEC    2016-07-07  265 MB  3rd Biggest
  ...
  E85265FE62305C848AC6B3CA62CF51FD    2015-05-12 15:21:17      Oldest

A: Just saw this after posting.
IMHO it's a stuff up.  I'll just write the full 1.8 GB to a DVD in order to delete this offense to my sensibilities and duct tape it to the back of the monitor, and curse Microsoft every time I see it there.
**

*

*Update 24 Jan 2019

**
Archived all the windows install stuff on DVD, deleted originals - now we wait and see what happens when Windows wants to update itself towards end of February
How to safely delete stuff from %SystemDrive%\Windows\Installer?

Removing the "installation" (the installation package) will mean the
  program cannot be uninstalled, even if the installer program exists,
  because the installation package is required for the instalation.
  (plus registry items again)
Plus having all that does not guarantee that everything does get
  uninstalled, or that the program will even be able to repair itself
  with the installation package.
...
Sometimes you can Reinstall the original whole installation, (lapped
  install) to replace all the items you removed (+ all of the above
  mess), then the installation and un-installation itself will again
  operate. But Often this also requires resetting any items that can
  cause the installation to fail (usually in the registry).

A: Lost first version of 2nd answer - more windows aggrievement
C:\ free space down below 1MB
Deleted all of c:\windows\temp
-->
DOS prompt won't start anymore
Opera browser window sized to minimum size, cannot resize.
Why oh why should I bother with windows, it's a major handicap in my work day!!!!


text:
Q: If the other team is split pushing and your team barely survives a 5v4, what is the best thing to do? Should the whole team go after that solo lane or should you just keep trying to push with your team because your team would get picked off if split up?
When does that pushed lane become a priority? Is going after that solo pusher when he's at the inhibitor too late?

A: When you are losing team fights, you need to defend (That's your first priority). With that being said, stick together as a team and prioritize your towers, you want to keep a strong line of defense, so don't try and save the farthest tower if the other two lanes are down to the inhibitors. It seems dumb to let a tower die, but if your team stays back and farms up the minions while holding a decent enough defense, you will be surprised how much the farm will help your team catch up, and hopefully win a team fight.

A: Depending on how far the split pusher has pushed to and what the position of the enemy towers is and whether baron is up or not.
If the split pusher is trying to take the outer turret, the game is around the 20-25 minute mark and baron is available.  Take baron if you can.  Having baron buff generally means you can take all the outer turrets for free if done right.  In this case, pushing a lane might get you 1-2 towers before the enemy team respawns, and when they respawn they might pick off some of your team or rush baron if they are smart while your team is trying to retreat back to base.  Secure baron nashor, buy up and heal then start pushing as a team.  If the other team still insists to split push, force a 5v4 under tower, and push as a team.
If baron is unavailable or the game is around the 60 minute mark, push a lane as a team quick as possible.  Regardless of the situation, a team will outpush a solo push and at 60 minute mark, the death timers is around 1 minute long.  That should allow you to push in from outer turret all the way to taking inhibitor.  If an inhibitor is already down, just go after nexus turrets.  Lane should have pushed in from superminions, coordinate with tanking turrets with allies who can do so and take out the nexus turrets fast.  Then take out nexus itself.  That should easily be done in the minute it takes for the enemy team to respawn.
Your priority at all times is nexus if it is ever available to take before enemy team can react.

A: It depends on how many team members are left alive, their position, and the solo enemy's position.
Generally, it's best for those with low health to recall to base and deal with the solo pusher, while anyone fit for combat should push until the enemies have respawned.
While this video doesn't exactly pertain to your question, it shows what happens when two teams focus on destroying buildings instead of team fighting:

A: At that point, you should stay by your towers and play Defense so they can't get to the inhibitor while backdooring towers and farming as much as you can.


text:
Q: How to log all process names that connect to the internet? I found a virus in Windows 10 today, or at least debris of it and want to make sure Ubuntu is not similarly compromised. How can I log all process names that (try to) make an outgoing internet connection, while using Ubuntu normally?

A: Try the nethogs tool to monitor network traffic by process. It shows the process name, PID, user as which it runs, network device it uses and how much it is sending and receiving.
Install it using sudo apt install nethogs.
Then you can start monitoring processes interactively using sudo nethogs.


text:
Q: Duplicate key errors in Postgres queue-like table when rows should be locked by SELECT FOR UPDATE SKIP LOCKED I have a table called queue with items that need to be processed:
CREATE TABLE public.queue (
    id serial NOT NULL
        CONSTRAINT queue_pkey
            PRIMARY KEY
);

Another table process represents processed items from the queue (e.g. a report has been generated). In reality, there are more such tables (there are more processes that need to be performed on an item). There is one-to-one relation between queue and process – each item can be processed just once.
CREATE TABLE public.process (
    id            serial  NOT NULL
        CONSTRAINT process_pkey
            PRIMARY KEY,
    queue_item_id integer NOT NULL
        CONSTRAINT process_queue_item_id_key
            UNIQUE
        CONSTRAINT process_queue_item_id_8953ec7b_fk_datastore
            REFERENCES public.queue
            DEFERRABLE INITIALLY DEFERRED
);

Here are some test data:
BEGIN;
TRUNCATE TABLE queue, process
    RESTART IDENTITY CASCADE;
INSERT INTO queue
SELECT GENERATE_SERIES(1, 10000);
COMMIT;

The worker that processes the items is implemented as follows. The code is in Django (Python framework), but I am convinced that my error is not caused by Django or its ORM.
(For simplicity, there is no termination condition.)
while True:
    with transaction.atomic():
        queue_items = Queue.objects \
                          .filter(process=None) \
                          .order_by() \
                          .select_for_update(skip_locked=True, of=('self',))[:8]

        print('Generating report...')
        time.sleep(0.1)

        Process.objects.bulk_create(
            (Process(queue_item=q)
             for q in queue_items)
        )

Here is a transcript of the SQL queries that travel to the database:
-- while True:

BEGIN;

SELECT queue."id"
FROM queue
         LEFT OUTER JOIN "process"
                         ON (queue."id" = "process"."queue_item_id")
WHERE "process"."id" IS NULL
LIMIT 8 FOR UPDATE OF queue SKIP LOCKED;

-- print('Generating report...')
-- time.sleep(0.5)

INSERT INTO "process" ("queue_item_id")
VALUES (1),
       (2),
       (3),
       (4),
       (5),
       (6),
       (7),
       (8)
RETURNING "process"."id";

COMMIT;

If I start one worker, the queue is processed perfectly fine. If I run two or more workers, I start getting this error:
duplicate key value violates unique constraint "process_queue_item_id_key"
DETAIL:  Key (queue_item_id)=(**) already exists.

How another transaction could create rows in process for items in a queue when those rows are locked?
What I tried:

*

*I tried to rewrite SELECT query with EXISTS:

SELECT "queue"."id"
  FROM "queue"
 WHERE NOT (EXISTS(SELECT U0."id", U0."queue_item_id" FROM "process" U0 WHERE U0."queue_item_id" = "queue"."id"))
 LIMIT 8
   FOR UPDATE OF "queue" SKIP LOCKED

without success, the same error occurs.

*If I arrange the rows randomly, the error occurs much later (almost at the end of the queue).

SELECT "queue"."id"
  FROM "queue"
  LEFT OUTER JOIN "process"
    ON ("queue"."id" = "process"."queue_item_id")
 WHERE "process"."id" IS NULL
 ORDER BY RANDOM()
 LIMIT 8
   FOR UPDATE OF "queue" SKIP LOCKED

*I put a breakpoint in the middle of the transaction and in another transaction I checked that the row locking in my opinion works correctly:

SELECT id
FROM queue
WHERE id NOT IN (
    SELECT id
    FROM queue
        FOR UPDATE SKIP LOCKED
);

*

*My Postgres version: PostgreSQL 13.1, compiled by Visual C++ build 1914, 64-bit.

*Each worker has its own connection to Postgres with default isolation level (read committed).

A: When a process commits, the locks it held are immediately released to all.  But the rows it inserted are not visible to other snapshots which started before it committed.  So the just-unlocked rows are eligible for someone else to lock, when that someone else is not able to see the inserted rows that would cause them not to select the just-unlocked row.  When you select a row FOR UPDATE, the anticipation is that you will update that row.


text:
Q: How to start getting notifications again when using epoll in edge-triggered mode? When using epoll in edge-triggered mode, if there is like 2KB of data in a socket and you only read 1KB from it, you won't get another notification for it when you do epoll_wait().  If I wanted to get another notification for the unread data, what would I do?  I think removing the fd from the epoll set and then adding it again would work, but is there a better way?

A: By its very definition, edge-triggered mode doesn't do what you want. Based on your description, you should be using level-triggered mode instead.
What you are asking is akin to "how can I use fread() to write to a file?" You can't, because it's the wrong thing to use to write to a file.


text:
Q: How do I browse for available gsettings options? There are certain gsettings keys that can have multiple values (e.g. a key like verbosity could be assigned to one error, info, or debug). I want to be able to list them, but my dconf-editor (0.7.3) can't view them. Is there an existing alternative?

A: You could also do that in CLI with gsettings:
gsettings range SCHEMA [:PATH]  KEY

where
range
           Queries the range of valid values for KEY.

In your case:
$ gsettings range org.freedesktop.Tracker.Store verbosity
enum
'errors'
'minimal'
'detailed'
'debug'

A: The newer version of dconf-editor now lists the options.

In this example, if you click on debug, you'll see a list of other available values. This screenshot is of version 0.10 of the tool.
A screenshoot from v0.19.3, shows options:

A: Complement to the main answer on Dconf-Editor:
In version 3.18.2 - the drop down list of options contains less than what is listed in the more detailed description in the lower part of the window.
Example for org.gnome.desktop.wm.preferences action-right-click-titlebar:

Menu, lower, shade and none options are not available in the drop-down list and cannot be selected with Dconf Editor - but they are listed in the lower part of the window inside the more detailed description.
To select those options, one could use the terminal - with something like
gsettings set org.gnome.desktop.wm.preferences action-right-click-titlebar 'minimize'

The newer version 3.28.0 fixes this - along with a new design.

A: you can get it through /usr/share/glib-2.0/schemas/org.gnome.nautilus.gschema.xml or you have to use gconf-editor.


text:
Q: How to develop for an interactive kiosk that needs two separate displays. (Preferably in flash) Here's the situation:

*

*I need to create a game for an interactive kiosk.

*The game is fairly basic, it will most likely be done in flash/AS3 (I believe this
is the best choice for this kind of game) UNLESS the dual display
requirement is far easier to accomplish with a different technology.

*The kiosk consists of two displays, both of which need to show
separate content from within the same game.
Here's the question:
How can I (or anyone) create a flash game that utilizes two separate displays for different content? (This is not just a wider field of vision for the game, the two screens will show different things.)
I am asking for a method by which to do this, not for information about coding the game.
[EDIT] My Idea (probably not the best):
Design the game on a canvas twice as wide as one of the monitors, then split the canvas in half and code the game to output different things to each half of the screen. Then run the monitors in "extended desktop" mode or something like that, and make sure that the split between the two desktops occurs in the middle of the game canvas.
[EDIT] The two displays are being fed from the same machine and same graphics adapter. The whole "kiosk" is powered by one single machine.

A: Pixel perfect, you could run a split screen display, as you've mentioned.
Another approach could be leveraging Flash LocalConnection:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html

LocalConnection objects can communicate only among files that are
  running on the same client computer, but they can be running in
  different applications — for example, a file running in a browser and
  a SWF file running in Adobe AIR

Via a central controller, synchronization between displays could be maintained for both applications with LocalConnection serving as a communications pipeline.
Or, you could install a host server that both Flash applications communicate through.
If built in Adobe AIR, two applications could communicate peer-to-peer using flash.net.ServerSocket.

A: The flixel framework has a splitscreen camera feature: http://flixel.org/features.html

A: The easiest way is probably with some sort of MVC-like design. Separate your game logic from your display (MovieClip instances), and get each screen to render its own view separately.
So in this solution, you'll have some sort of Model class with the actual game data, and each "screen" will poke the data and draw whatever stuff it needs to draw.
This is what MVC is supposed to be good for -- separating concerns like "what is my game (state)" (model) vs. "how do I draw X aspects of my game here" (view).

A: If you're able to run the flash application inside a web browser, you might be able to get away with datapassing between Flash and Javascript, and then pass Javascript data between browser windows (and run the browsers full screen for the sake of presentation).
So, basically, Flash on Window 1-> Javascript on Window 1 -> Javascript on Window 2 -> Flash on Window 2


text:
Q: Synaptics - Windows 8.1, updating Synaptics failed On Windows 8.1, I tried to install the latest Synaptics Touchpad Driver v17.0.19 and it failed for some unknown reasons. Turns out it's problem with Synaptics, not Windows. Synaptics did not "Sign" the files inside the installation properly, and so Windows doesn't allow the installation. See below for lots of solutions.

A: Here is a trick on how to install Synaptics Touchpad Driver v17.0.19
> WIN + I
> Change PC Settings
> Update and Recovery
> Recovery
> Under 'Advanced startup' click 'Restart Now'. Make sure to save your work first.
> Select 'Troubleshoot'
> Advanced Options
> Startup Settings and click Restart
> When it boots up, press 7 to Disable driver signature enforcement
> Install Synaptics as you would normally do.
> Restart

If the Synaptics settings does not appear under Mouse properties after completing the preceding steps, try the following
> Open device manager
> Find the touchpad device ("PS/2 Compatible Mouse")
> Right click on the device and click "Update Driver Software"
> Select "Browse my computer for driver software"
> Select "Let me pick from a list of device drivers on my computer"
> Uncheck the option "Show compatible hardware"
> Under "Manufacturer", scroll down to "Synaptics"
> Under "Model", the 17.0.19 driver should appear.
> Select the driver and click next.
> Click "Yes" to the "Update Driver Warning" pop-up.
> Restart

A: Thanks to Fabian for informing me of the risky nature of Dev-Host, prompting this much-needed update.
I experienced the same issue, and thought I'd try reinstalling old drivers to see if that helped.
Solution/permanent workaround
A more permanent solution taken from the answer posted by Anonymous, reformatted with pictures shamelessly taken from this article on HowToGeek.
The short version solution of this is: disable driver signature enforcement and then install the latest Synaptics driver.
Disabling driver signature enforcement

*

*Press Win+I, or open up the Windows Charms bar from your right upper/lower corner and select "Settings".

*Select "Change PC Settings" from the Settings-part of the charms menu.

*In the Settings-app, select "Update & recovery".

*Then, choose "Recovery" from the same left-side menu.

*You'll get the following display, where you'll need to restart your computer to continue, which will happen when you select "Restart now".

*Now, once restarted, you'll need to select "Troubleshoot" as the option on the startup menu.

*Head into the "Advanced options".

*Then to the core of what we're looking for: "Startup Settings"!

*We'll have to do another restart, as we'll be modifying options that are applied at boot.

*At last, now you'll have to press F7 to disable driver signature enforcement for this boot.

*When your computers has booted up, you'll need to install the Synaptics touchpad driver, and it should complete without issue.

*Once installed, it's highly recommended that you restart your computer one last time.
In the event that it doesn't seem like the touchpad driver is in use, you'll need to manually change the driver for your touchpad device. Here's a quote from the other answer:

If the Synaptics settings does not appear under Mouse properties after completing the preceding steps, try the following:

*

*Open device manager

*Find the touchpad device ("PS/2 Compatible Mouse")

*Right click on the device and click "Update Driver Software"

*Select "Browse my computer for driver software"

*Select "Let me pick from a list of device drivers on my computer"

*ncheck the option "Show compatible hardware"

*nder "Manufacturer", scroll down to "Synaptics"

*Under "Model", the 17.0.19 driver should appear.

*Select the driver and click next.

*Click "Yes" to the "Update Driver Warning" pop-up.

*Restart

Cause of error
It's worth noting that it seems like it failed due to not being properly signed. When attempting to install just the driver, manually, from the device management console, it would allow you to select it, but would fail due to not being digitally signed. It's an odd peculiarity that I hope gets fixed relatively soon.

Previous workaround
The following steps are not recommended, as they use older versions of Synaptic and needs to be downloaded from less-desired locations.
Another fellow troubleshooter already had the issue, and found an older version of the suite, v17.0.6.13, which used to be available, but the host is down.
Simply installing this version, after making sure I had uninstalled previous versions, can "solve" the problem.
Note: Here are two alternative version. Be careful with the download links on the sites, as some ads might give you unwanted software: Link 1: recommended | Link 2: careful!

A: I realize this question has already been answered, but I am posting this for future readers.
I tried the solution given by Thor, which was to install an older version. The install succeeded, but I still had no touchpad driver upon system reboot.
I performed the following steps to get around this:

*

*Install Synaptics version 17.0.6.13. DO NOT REBOOT.

*Open the Synaptics install target folder (C:/Program Files/Synaptics/SynTP).

*Open file properties for oemsetup.bat.

*At the bottom of the General tab, click Unblock.

*Reboot.

If you reboot and still have no touchpad driver, you may want to go through each of the files in the install target folder and unblock it.

A: A very strange way but worked 100%

*

*Just download the driver from synaptics.com

*Do not extract the .zip file, launch the setup from the .zip file and setup will continue successfully after answering a dialog box question about installing drivers from Synaptic corporation.
I have tried a lot of versions specially Dell Synaptics touchpad drivers but many errors happened with them.


text:
Q: How can I change my code below to avoid the unexpected type error (required : variable; found: value)? 1.The fifth line of my code below returns an unexpected type error where a variable is required but a value found.
2.The code is a to check if a number n is Prime or not using a while loop.
public boolean primeNumberCheck(int n)
{
    int divisionNumber = 2;
    boolean primeCheck = true;
    while (divisionNumber < n)
    {
        if (n%divisionNumber = 0)
        {
            primeCheck = true;
            divisionNumber = n;
        }
        else
        {
            primeCheck = false;
        }
        divisionNumber++;
    }
    return primeCheck;
}

A: = is the assignment operator. n%divisionNumber returns a value, and you cannot assign a value to another value. So you get that error.
You need to compare the values using the == operator. So, you should do:
if (n%divisionNumber == 0)

A: This is not an answer, just a more optimized algorithm based on Primality test on WikiPedia
public boolean primeNumberCheck(int n) {
    // exclude numbers with divisor 2 or 3
    if (n % 2 == 0) {
        return false;
    }
    if (n % 3 == 0) {
        return false;
    }
    // all integers can be expressed as (6k + i) for some integer k and
    // for i = −1, 0, 1, 2, 3, or 4;
    // 2 divides (6k + 0), (6k + 2), (6k + 4); and 3 divides (6k + 3).
    // so we only have to test numbers of the form 6k +- 1
    int k = 1;
    int i = -1;
    // we only need to check candidates up to SQRT(n)
    double sqrtN = Math.Sqrt(n);
    int candidateDivisor = getCandidateDivisor(k, i);
    while (candidateDivisor < sqrtN) {
        if (n % candidateDivisor == 0) {
            return false;
        }
        // flip i between -1 and 1
        i = -i;
        // when i flips back to -1, increment k
        if (i < 0) {
            k++;
        }
        candidateDivisor = getCandidateDivisor(k, i);
    }
    return true;
}

private int getCandidateDivisor(k, i) {
    return (6 * k) + i;
}

DISCLAIMER: I have not tested this code

A: Apart from the answers here , one more tip which I follow is doing :
if (0 == n%divisionNumber) rather than  if (n%divisionNumber = 0).
this ensures that I haven't missed one "=" sign.


text:
Q: Convert int value to decimal value in xslt1.0 How to convert an integer value to a decimal value in XSLT?
For example, convert
15954 to 159.54

12376 to 123.76

22090 to 220.90

I used the format-number function, but it does not give the intended result.
format-number(22090,'#.##')

A: You'd clearly need to divide the number by 100 before formatting it, but also you need to use 0 rather than # after the decimal point to force 2dp.
format-number(theNumber div 100,'#.00')


text:
Q: The eigenfunctions of $H =\frac{p^2}{2m}+ V_0 \log(|x|/a)$ and a curious virial theorem result I'm thinking about applications of the virial theorem to $1d$ quantum systems. The statement of the virial theorem is that all bound states of the Hamiltonian $T+V$ satisfy the constraint
$$\langle 2 T \rangle = \langle x \frac{dV}{dx} \rangle$$
where $T=\frac{p^2}{2m}$ and $V$ are the kinetic and potential energies respectively.
There's something strange that happens for the case of $$H = \frac{p^2}{2m} + V_0 \log(|x|/a)$$ Here, I take $V_0>0$ to ensure that the eigenspectrum is discrete and bounded below.
Plugging in this potential into the virial theorem gives a constant kinetic energy! That is, we have
$$\langle T \rangle = \frac{V_0}{2}$$

I find this result surprising, as it says that all eigenstates of the Hamiltonian, even those varying widely in total energy, have the same kinetic energy. I'm hoping to gain intuition for this result and to understand what the result means for the shape of the eigenfunctions. What do the eigenfunctions of this Hamiltonian look like at low and high energy? In particular, does the constraint with the average kinetic energy being constant in total energy have a fingerprint in the shape of the wavefunctions?

A: Since $\langle p^2 \rangle$ is constant, one would expect the distance between the nodes of the wave function would not show a strong dependence (if any) on the quantum number, which is shown in figure in the comments.

A:
There's something strange that happens for the case of $$H = \frac{p^2}{2m} + V_0 \log(|x|/a)$$ Here, I take $V_0>0$
...we have
$$\langle T \rangle = \frac{V_0}{2}$$

What do the eigenfunctions of this Hamiltonian look like at low and high energy?

The link provided by QCD_IS_GOOD in the comments shows what some eigenfunctions look like.

...does the constraint with the average kinetic energy being constant in total energy have a fingerprint in the shape of the wavefunctions?

The average kinetic energy being constant constrains the integral of the absolute value of the derivative of the wave function like this:
$$
\langle T\rangle = \int dx {\left|\frac{d\psi}{dx}\right|}^2 = V_0\;,
$$
where I have chosen units such that $m=\hbar=1$.
This tells you something about the shape of the wavefunction, but not a whole lot.


text:
Q: Double const declaration I often see the following function declaration:
some_func(const unsigned char * const buffer)
{

}

Any idea why the const is repeated before the pointer name?
Thanks.

A: The first const says that the data pointed to is constant and may not be changed whereas the second const says that the pointer itself may not be changed:
char my_char = 'z';
const char* a = &my_char;
char* const b = &my_char;
const char* const c = &my_char;

a = &other_char; //fine
*a = 'c'; //error
b = &other_char; //error
*b = 'c'; //fine
c = &other_char; //error
*c = 'c'; //error

A: It's a constant pointer to a constant unsigned char. You can't change the pointer nor the thing it points to.

A: In a declaration like const  * const T, the first const (before the *) means that what the pointer points at is const (i.e. it's a pointer to a const T). The const after the * means that the pointer itself is const (i.e. can't be modified to point at anything else).
You can read the declaration from the object being declared outward, so const unsigned char * const buffer is read as: "buffer is a const pointer to a const unsigned char" (this is why const should always being placed after what it modifies--with it before, you have to rearrange things to make the sentence--with it declared as unsigned char const * const buffer, translation to English is simple and straighforward (or perhaps "straightbackward", since you actually read from right to left in this case).

A: assuming const unsigned char * const
Everyone is correct that its a const pointer to a const unsigned char.
C++ types read mostly right to left unless there are any modifiers on the far left then these read left to right.

A: type declarations should(?) be read RTL.  const modifies the thing on its left, but the rule is complicated by the fact that you can write both const T and T const (they mean the same thing).

*

*T * const is a constant pointer to mutable T

*T & const would be constant reference to mutable T, except references are constant by definition

*T const * is a mutable pointer to constant T

*T const & is a reference to constant T

*T const * const is constant pointer to constant T

A: This makes it a const pointer to a const value, rather than a mutable pointer to a const value or a const pointer to a mutable value.

A: const * unsigned char const buffer means that you cannot modify the pointer buffer nor the memory that buffer points to.

A: A couple of articles to help you understand const correctness in C++:

*

*Wikipedia

*Possibility.com


text:
Q: ST_Contains not returning a correct result I'm trying to do a spatial join between a table that stores locations of photos and the table with names and geometries of countries and the table containing locations of major cities.
For example here we have a multupolygon of Australia and I've confirmed that it's a valid geometry:

and we have a point that is clearly in Australia:

If I run a simple query:
select c."name"
from country c
where st_contains(c.geometry, st_geomfromtext('POINTZ(-37.56977080555556 144.89031980555555 265)', 4326))

...I get an empty return from the query. I've also tried st_within and st_intersects but neither of those return any result.
I tried a spatial join, and it works correctly if I only merge with the City table:
select i."path", i."timestamp", c."name"
from image i
join city c
    on ST_DWithin(i."location", c."location", 50000, true)

but if I add Country table to the mix, I get only a handful of results and even those are all wrong:
select i."path", i."timestamp", c."name" , x."name"
from image i
join city c
    on ST_DWithin(i."location", c."location", 50000, true)
join country x
    on ST_Contains(x.geometry, i."location")

What am I doing wrong here?
P.S. As I said, all geometries are valid and DBeaver correctly interprets the geometry in SRID 4326.
EDIT:
Ok I found the issue. For some reason it contains doesn't like the order of coordinates I have.
This (lat, lon):
'POINT(144.89031980555555 -37.56977080555556)'

doesn't work, but for some reason
'POINT(-37.56977080555556 144.89031980555555 )'

Gives a correct result.


text:
Q: C# | Adding password protection for a program I am currently building a C# app(offline .net), and I wanted to give the users the possibility to have password protection for the use of the program. (store their passwords and then have the program be not accessible with out the right password).
My problem is that I have encounterd almost the same problem here
Is there any good way of doing this?

A: in general you should NOT store a password, not in plain text and not encrypted.
What you could do is store in a database the hash of the password user has created at first login then every time he logs in, you hash his input (without saving it anywhere) and compare new hash and saved one, if comparison is ok, password was correct.
this as quick example, you can have a lot of complexity in here if you want to make it very safe ;-)


text:
Q: Find an orthogonal basis for ℝ3 that begins with an orthogonal basis for Col() The problem is as follows:
Find an orthogonal basis for ℝ3 that begins with an orthogonal basis for Col(A). The matrix A is given in the image below (do not know how to display matrices correctly in text).
My calculations
Is this a correct answer to the problem? Or do i need to use the Gram-Schmidt process directly on Col(A) before i find the reduced row echelon form of A?

A: The span of the two vectors you found is
$$
\operatorname{span}\left\{\begin{bmatrix} 1\\0\\0\end{bmatrix},\begin{bmatrix}0\\1\\0\end{bmatrix}\right\}
=\left\{\begin{bmatrix}x\\ y\\0\end{bmatrix}:\ x,y\in\mathbb R\right\}.
$$
So your candidate for the basis cannot span neither the second nor the third column.
You have to do Gram-Schmidt, not forgetting that you will often (as in this case) get some zeros; since the dimension of col$(A)$ is $2$.


text:
Q: MVC.NET C#: Getting the emitted null values of a JSON http request? I have a WebService, that expects a list of a defined type via Json.
Class:
public class myType
{
    public int id { get; set;}
    public int? varA { get; set;}
    public string varB { get; set;}
    public float? varC { get; set;}
}

Logic:
//Passed JSON --> Data:{'id':'1','varA':''}
[HttpPost]
public JsonResult Update(myType Data)
{
    //Data ends up with value's id = 1; varA = null; varB = null; varC = null;
    //So how can I find that valueA was actually passed with a null value, and all the
    //others are just nulling by default?
    if (Data.varA.HasValue) dbItem.varA = Data.varA
    ...
}

Lets assume myType has several values, eg {id, varA, varB, varC}
all values except id are nullable.
Now, I purposely want to null out only 1 value
the problem is, For bandwidth conservation, I'm only sending the id, and whatever value has been updated in JSON eg: Data:{'id':'1','valueA':''}, as far as the method is consurned though, the Data Object, returns the object that gives the id, but also gives a null value for all other variables of the object.
So, what can I to to be able to tell which emited variables were sent via the json to the webmethod? So I can tell which variable I was really wanting to null?
More info:
Using ExtJS 4 For the front End. This question is in relation to Ext.Store's

A: MVC attempts to parse the values you send to it based on the name (via normal deserialization). Therefore, if you don't specify the value it will send null as expected because you have nullable properties. Why don't you pass actual values in valueA, -1 for example. If you don't specify values for nullable properties they will be null...


text:
Q: Order of an Element Under a Homomorphism I was reading an example about describing homomorphisms and I'm having a bit of trouble with this one.
Show there is no group homomorphism $f : \mathbb{Z}_{10} \to \mathbb{Z}_{25}$ such that $f(1) = 3$.
The first step of the proof is
$|1| = 10$ in $\mathbb{Z}_{10}$, so $|f(1)| \in\{ 1, 2, 5, 10\}$.
Does this mean that $|f(1)|$ can be $1$, $2$, $5$ or $10$? I see that $|1| = 10$ since $1$ is a generator of $\mathbb{Z}_{10}$, and that $|f(1)|$ seems to be a factor of $10$. If $f(1)$ is the image of $1$ under $f$, how would I find the order of $f(1)$?
Thanks for your help.

A: If $x^n=e$ and $\phi$ a homomorphism, then $\phi(x^n)=(\phi(x))^n$ is the identity element too. Therefore, the order of $\phi(x)$ divides $n$, which gives a solution to present problem.


text:
Q: autoComplete combo Box error in autoComplete combo Box
I think it may gets  called after xmlHttprequest finishes
please provide me a solution near a code line this $("#isUsedCombo").combobox
You will find 'isUsedCombo' str variable
function editGov(govID){

    var xmlHttp;
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
           var x1=xmlHttp.responseText.split(",");
           isUsed=x1[5]; // isUsed comboxBox Value
           var str="

  English Name	 <input type=text id=txtEnName"+x1[0]+" value=\""+x1[1]+"\">

  Arabic Name	 <input type=text id=txtArName"+x1[0]+" value=\""+x1[2]+"\">

  EnShort Name	  <input type=text id=txtEnNameSt"+x1[0]+" value=\""+x1[3]+"\">

  ArShort Name	  <input type=text id=txtArNameSt"+x1[0]+" value=\""+x1[4]+"\">

  Is Used	   <select> id=isUsedCombo> <option value=1> Once</option>  <option value=2> Multiple </option>  </select>

  	  <button class=bttnGov onclick=updateGov("+x1[0]+")> Update</button> 	  <button class=bttnGov onclick=updateGov('close')> Close</button>

";
           DiaLgFrm(str);

            $("#isUsedCombo").combobox({
             selected: function(event, ui) {
                isUsed= ui.item.value;
              }
            });
        }
    }
    var URL = "Empty\\emptyGovt2.aspx?govID="+govID;
    xmlHttp.open("GET", URL, true);
    xmlHttp.send(); }

A: there is a problem with your string
change this
 <select> id=isUsedCombo>

to
 <select id=isUsedCombo>

in var str=


text:
Q: How can I add a class on Click event Here is my markup :

Here is my JavaScript code:

*

*Note, I am building my markup with the following Jquery code, dynamically:

This is my script for the click event:

thus it is setActive that should add "active-section" to the Div inside the anchor tag  which I am building dynamically. but I not certain if I am doing this correctly.

A: It seems like it would be easier to just bind the click event to your element in your js code based on its class rather than adding it into your html.
So maybe change markup to include a common class name like:

And then just bind a click event to all elements with that class:
$('.section').click(function(){
  $(this).find('.section-dots').addClass("active-section");
});

A: I would un-capitalize the DIV and some other things in your code, but this should work if I'm understanding what you want to do.
$('.section-dots').click(function(){
  $(this).addClass('active-section');
});

A: you are using $(this) without passing any parameter to the function.

useing jquery, select the element you want to add the class to it and use the addClass("class_to_add") function.


text:
Q: Ordering by meta key with pre_get_posts leaves out posts without the metakey I am able to display posts ordered by custom meta key using the pre_get_posts action. How ever, it is leaving out (not displaying) posts without this meta key. Is there any way to display the posts with out the meta key at the end?
$q->set( 'meta_key', '_1m_e_date' );
$q->set( 'orderby', 'meta_value' );
$q->set( 'order', 'ASC' );

Thank you


text:
Q: Linkedin api v2 /invitations 403 After authorization with all available permissions(r_basicprofile, r_emailaddress,rw_company_admin, w_share) try to exec request like that
$client->post(
    'invitations',
    [
        'invitee' => "urn:li:person:bQKCsQOZUt",
        'message' => [
            "com.linkedin.invitations.InvitationMessage" => [
                "body" => "Let's connect!"
            ]
        ]
    ]

Get such response
{"serviceErrorCode":100,"message":"Not enough permissions to access: POST /invitations","status":403}

A: You need to request permissions from LinkedIn to the v2 API.
Submit this form to them with your info: https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program
After approval, it should work.


text:
Q: Why is my Align-items not having any efffects? I'm trying to make my image be a the center of my container but it won't center and I don't know why.
The container of the picture :
.navbar-4{
    width: 13vw;
    height: 8vh;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    background-color: transparent;
}

The properties of the picture :
.photo{
    width: auto;
    height: 3vh;
    background-color: transparent;
  }

The picture in itself (I'm using React) :
import React from 'react'
import logo from './images/logoo.png';

function Logo() {
  return (
    <div> <img className='photo' src={logo} />

    </div>
  )
}

export default Logo

The result :

Same result but with some colors :


text:
Q: Surface keyboard suddenly stopped working Suddenly my Surface Pro keyboard stopped working. The Fn key stays lit. The mouse pad works but the keys won't work. Basically nothing can be typed. Keep in mind the Surface works fine. Oh one thing the keyboard stays lit and does not go to sleep.
Help please. Hate to spend money on a new keyboard.

A: I haven been using surface pro from last 2 years & I have come across this issue several times. hopefully this information will help you.

*

*Detach, clean and reattach your surface type cover
Sometimes dirt and dust over surface keyboard connector can lead to surface keyboard not working problem. A simple cleaning of connector can resolve this problem.

*Fix Ease of access Setting
Search "ease of access" in the search box on the taskbar
Select Ease of access keyboard settings
Under the keyboard setting make sure that sticky key & filter key both are off.

*Perform Force shutdown & restart
For Surface go, Surface pro 6, Surface pro (5th Gen)
You need to press & hold the power button for 10 seconds it will turn the Surface off.
Now press the power button & release, it will turn your surface on again.
If it does not work, to shut down & restart your surface completely
you keep power button pressed until surface restart & you see the windows logo. It will take approx. 20 seconds.
For Surface pro, Surface pro 2, Surface pro 3, Surface pro 4 perform these steps to force shutdown & restart the device
You need to press & hold the power button for 10 seconds it will turn the Surface off.
Now press the power button & release it will turn your surface on again & you will be able to see surface logo.
If it does not work then perform two button shutdown steps as below to ensure your surface turns off completely.

*

*Press & hold the power button for approx. 30 seconds & then release it.

*After this press power & volume up button at the same time and keep it pressed for 15 seconds, even after if you see surface logo keep it pressed for 15 seconds.

*Wait for 10 seconds after releasing the button.

*Now press the power button & release, it will turn your surface on again.

*Update or reinstall surface type cover driver

*Check for windows file error
Before starting these steps, ensure that your surface is plugged into power because this may take a while.

*

*Search "command prompt" in the search box on the taskbar

*Select "Run as administrator" even if you are logged as Admin

*You may get a warning prompt, tap ok.

*In the command line type SFC/scannow and tap enter

*This will start process of scanning

*Reset the Surface and Fix Surface Keyboard Not Working Problem
If you need any further detail on Surface Pro keyboard stopped working, you may refer this resource which I found while searching when I had same problem

A: First, be sure to have a valid Internet connection as this method will download drivers from Microsoft.

*

*Go to Control Panel\Hardware and Sound\Devices and Printers

*Open the Properties of "Surface Type Cover" and select the Hardware tab.

*From this tab, open the properties of each associated device. Uninstall each device, deleting drivers when the option is available.

*After all items have been uninstalled (The Surface Type Cover Properties Hardware tab will NOT update as you do this), You can close the open windows.

*Next, Open Device Manager: "Scan for Hardware Changes"

*Expand the following groups: Firmware & Keyboards.

*Under Firmware, update all drivers using "Search Automatically for updated driver software"

*Under Keyboards, you should see several "HID Keyboard Device". There's no quick way to identify which is the Surface Type Cover. I performed driver updates as noted before in Firmware for each Keyboard until the Surface Type Cover was installed.

That's it. No reboot was necessary. Keyboard started working right away.

A: What happens if you hold a key down for a long time? I just experienced this on my Surface Book - my Caps LED was lit and the touchpad worked fine, but the keyboard appeared unresponsive - even after attaching/detaching - despite having worked fine moments earlier. I eventually discovered that my 1 year-old had activated Filter Keys by holding down the Shift key. I was able to verify this by holding down keys and seeing that they did, after a long time, actually produce output. Reverting the setting restored normal operation.

A: in my case the problem was a driver  in 1903 update. it installed a  wacom driver in human interface devices. roll it back to the genric 'usb input device'[microsoft 2006 v 10.0.18362.175

A: I had this issue today on my Surface running Windows 10 and here's what I did to correct it (I suspect only steps 6 - 9 really mattered):

*

*Since I was able to move the mouse, I clicked Start | [Power Icon] |
Shutdown.

*I unplugged all USB devices attached to the keyboard and removed the power cord.

*While the unit was off I pressed the [Up Arrow] key at top right hand-side of the keyboard to force-eject the touchscreen and separate it from the keyboard. The key lighted up orange and a clicking noise was heard, indicating I could pull off the touchscreen (even though the entire unit had been turned off!)

*I turned the tablet (touchscreen) on.

*I put the touchscreen back together with the keyboard and tested again. However, that still didn't seem to correct the issue.

*I hit the [Up Arrow] key at top right-hand side of the keyboard to eject the touchscreen again (while the entire unit was still on this time).

*I waited about a minute.

*I put the touchscreen and keyboard back together again.

*This time everything was working again!

One thing I learned in retrospect later was that the keyboard malfunction seemed to coincide with the moment I plugged in an external USB 3.0 HDD that malfunctioned (it never came online and I even got a yellow tip message on the system tray at the bottom right of the screen indicating that a USB device was malfunctioning.) It seems that maybe that device knocked out the keyboard temporarily. Perhaps the faulty keyboard was due to the drive just not spinning up in time (I know it didn't spin up because I didn't hear it whirring as it normally does.) I guess that sort of paralyzed the keyboard device and it only cleared up after it reset itself somehow through the steps I took above. This is just my guess! When I got the keyboard working again per the above steps, I plugged the drive back in and this time it did spin up. Everything is fine now.

A: If the volume up and volume down buttons are working, maybe the "filter keys" are the answer for Your issue. Try to press right Shift for 8-10 seconds


text:
Q: Who implements the "other methods" in a Functional Interface - and where? The "other methods" for Consumer and BiConsumer<T,U> and BiFunction<T,U,R> is andThen().
The "other methods" for Function<T,R> UnaryOperator are compose(), andThen(), identity().
The "other methods" for BinaryOperator<T,T> are andThen(), maxBy(), minBy().
The "other methods" for Predicate is and(), or(), negate(), isEqual().
The "other methods" for BiPredicate<T, U> is and(), or(), negate().
Since a Functional Interface is passed to an implementing method by a lambda expression, who will implement these other methods - and where?
Update: What I was trying to point out; what if the semantics of the "other methods" are not trivial or straightforward as in the example in the comments below? Consider the Predicate Functional Interface. If I pass in a lambda expression to an implementing method, but the and(), or(), negate() are not straightforward. Then the default implementation will not cover it. I suppose we would have to handroll our own custom Functional Interface that extends the original one and implements all the "other methods"?
Update: For Functional interfaces like BiFunction which has an andThen() other method, does this mean we would have to inherit from this interface and create a new one with a default method andThen()?

A: Well, I got the feeling you are missing something here.
Let's consider the Predicate interface. I stripped it down with the elements not relevant to the question.
interface Predicate<T> {

    boolean test(T t);

    default Predicate<T> negate() {
        return (t) -> !test(t);
    }
}

This is a functional interface: it has exactly one abstract method. The authors of this interface also added a method which they named negate. Its implementation returns a new Predicate which returns the exact opposite result when its test method is called. They added this method because they thought it would be useful.
As you can see, the negate method is default, and has a method body. Methods which have a body, are never abstract.

Since a Functional Interface is passed to an implementing method by a lambda expression

and

If I pass in a lambda expression to an implementing method

Not sure what you mean here, but I think it's poorly worded. A lambda expression can only be used where a functional interface is expected. So a lambda expression is the implementation of the only abstract method of a functional interface. The "other" methods are not relevant to this story so far.
Say, I want to create a Predicate which tests if a string is equal to "Hello". A typical implementation may look like this:
str -> str.equals("Hello")

This is (roughly) equivalent to this:
class PredicateImpl implements Predicate<String> {

    @Override
    public boolean test(String t) {
        return t.equals("Hello");
    }

    public Predicate<String> negate() {
        return new Predicate<String> {

            @Override
            public boolean test(String t) {
                return !PredicateImpl.this.test(t);
            }
        };
    }
}

As you can see, negate() returns a new Predicate which captures the predicate on which the method is called, and when its test method is called, it is deferred to the captured Predicate, and returns the resulting boolean inversed.
A lambda expression never implements a default method, as these are not abstract. So negate is not overridden in any way at all.

Of course, this doesn't stop us from creating our own functional interface in order to tamper with the semantics of negate.
public interface MyPredicate<T> extends Predicate<T> {

    @Override
    public default MyPredicate<T> negate() {
        return t -> true; // Say what?! That's not a negation!
    }
}

Now let's first see the "normal" predicate in action:
String s = "Hello";
Predicate<String> stringIsHello = t -> t.equals("Hello");
Predicate<String> stringIsNotHello = stringIsHello.negate();
System.out.println(stringIsHello.test(s));
System.out.println(stringIsNotHello.test(s));

Outputs, as expected:
true
false

Now let's use our custom predicate instead:
String s = "Hello";
MyPredicate<String> p1 = t -> t.equals("Hello");
MyPredicate<String> p2 = p1.negate();
System.out.println(p1.test(s));
System.out.println(p2.test(s));

Output:
true
true

Now does negate in our MyPredicate what you expect it to do? Absolutely not. Does the compiler prevent you from actually doing it? No, it cannot and it will not.

A: While reading the topic of Lambdas again, I had the same question come to me and I came back here as I had not understood the other comments and answers.
I think perhaps the answer is this - the parameter to andThen() is another Funtional interface; in this case, another Consumer<T>
   default Consumer<T> andThen(Consumer<? super T> after)

So one can have chained methods with a different lambda following for the andThen clause.
void foo(Consumer<T> consumer1Lambda, Consumer<T> consumer2Lambda) {

    consumer1Lambda.test().andThen(consumer2Lambda);
}


text:
Q: USB 3 spontaniously stopped working on reboot I'm running 4.13.3-1-ARCH and I have verified that the offending USB 3 ports still work in other Operating Systems. For clarification, I have a H81M-E34 motherboard and it's the I/O shield USB3 ports which aren't working anymore. The Front I/O still work.
lsusb
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 003 Device 006: ID 413c:a503 Dell Computer Corp.
Bus 003 Device 005: ID 8564:4000 Transcend Information, Inc. RDF8
Bus 003 Device 004: ID 093a:2521 Pixart Imaging, Inc. Optical Mouse
Bus 003 Device 003: ID 0451:8044 Texas Instruments, Inc.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lsmod
Module                  Size  Used by
xfs                  1048576  0
libcrc32c              16384  1 xfs
crc32c_generic         16384  0
jfs                   180224  0
btrfs                1036288  0
xor                    24576  1 btrfs
raid6_pq              114688  1 btrfs
cfg80211              532480  0
rfkill                 20480  3 cfg80211
snd_hda_codec_hdmi     49152  1
snd_usb_audio         163840  2
mousedev               20480  0
snd_usbmidi_lib        28672  1 snd_usb_audio
snd_rawmidi            28672  1 snd_usbmidi_lib
snd_seq_device         16384  1 snd_rawmidi
input_leds             16384  0
led_class              16384  1 input_leds
joydev                 20480  0
sch_fq_codel           20480  2
vboxnetflt             28672  0
vboxnetadp             28672  0
pci_stub               16384  1
vboxpci                24576  0
vboxdrv               385024  3 vboxnetadp,vboxnetflt,vboxpci
nvidia              10526720  156
nls_iso8859_1          16384  1
nls_cp437              20480  1
intel_rapl             20480  0
x86_pkg_temp_thermal    16384  0
vfat                   20480  1
intel_powerclamp       16384  0
fat                    65536  1 vfat
coretemp               16384  0
kvm_intel             192512  0
kvm                   516096  1 kvm_intel
irqbypass              16384  1 kvm
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
crc32c_intel           24576  2
ghash_clmulni_intel    16384  0
pcbc                   16384  0
snd_hda_codec_realtek    77824  1
aesni_intel           184320  0
snd_hda_codec_generic    69632  1 snd_hda_codec_realtek
aes_x86_64             20480  1 aesni_intel
crypto_simd            16384  1 aesni_intel
glue_helper            16384  1 aesni_intel
cryptd                 20480  3 crypto_simd,ghash_clmulni_intel,aesni_intel
intel_cstate           16384  0
snd_hda_intel          36864  3
iTCO_wdt               16384  0
evdev                  24576  10
iTCO_vendor_support    16384  1 iTCO_wdt
mac_hid                16384  0
mxm_wmi                16384  0
fuse                   94208  7
intel_rapl_perf        16384  0
snd_hda_codec         106496  4 snd_hda_intel,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_core           65536  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
drm                   303104  3 nvidia
snd_hwdep              20480  2 snd_hda_codec,snd_usb_audio
snd_pcm                86016  5 snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_hda_core,snd_hda_codec_hdmi
pcspkr                 16384  0
i2c_i801               24576  0
r8169                  77824  0
snd_timer              28672  1 snd_pcm
mii                    16384  1 r8169
snd                    73728  22 snd_hda_intel,snd_hwdep,snd_hda_codec,snd_usb_audio,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_usbmidi_lib,snd_seq_device,snd_hda_codec_realtek,snd_pcm
mei_me                 36864  0
lpc_ich                24576  0
soundcore              16384  1 snd
mei                    81920  1 mei_me
shpchp                 32768  0
ie31200_edac           16384  0
thermal                20480  0
fan                    16384  0
battery                20480  0
tpm_infineon           20480  0
tpm_tis                16384  0
tpm_tis_core           20480  1 tpm_tis
tpm                    49152  3 tpm_infineon,tpm_tis,tpm_tis_core
wmi                    20480  1 mxm_wmi
video                  36864  0
intel_smartconnect     16384  0
button                 16384  0
ses                    20480  0
enclosure              16384  1 ses
scsi_transport_sas     36864  1 ses
usbip_host             28672  0
usbip_core             28672  1 usbip_host
crypto_user            16384  0
ip_tables              24576  0
x_tables               32768  1 ip_tables
ext4                  557056  2
crc16                  16384  1 ext4
mbcache                16384  1 ext4
jbd2                   90112  1 ext4
fscrypto               24576  1 ext4
sr_mod                 24576  0
cdrom                  53248  1 sr_mod
sd_mod                 49152  9
hid_generic            16384  0
usbhid                 45056  0
hid                   114688  2 hid_generic,usbhid
uas                    24576  0
usb_storage            65536  1 uas
ahci                   36864  6
libahci                28672  1 ahci
libata                208896  2 ahci,libahci
xhci_pci               16384  0
ehci_pci               16384  0
scsi_mod              155648  7 sd_mod,ses,usb_storage,scsi_transport_sas,libata,uas,sr_mod
xhci_hcd              188416  1 xhci_pci
ehci_hcd               73728  1 ehci_pci
usbcore               208896  10 usbhid,snd_usb_audio,usb_storage,usbip_host,ehci_hcd,xhci_pci,snd_usbmidi_lib,uas,xhci_hcd,ehci_pci
usb_common             16384  2 usbcore,usbip_core
serio                  20480  0

I can't think of what other kinds of information I can provide.


text:
Q: Mobile Emulation Selenium Python - Code is unreachable Hey all trust that you're well, I'm currently receiving a Code is unreachable, it seems to work when I remove mobile emulation, however I need mobile emulation
Code:
def test_instance(data, tgs):

    Options = webdriver.ChromeOptions()

    mobile_emulation = {"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/102.0.5005.63 Mobile Safari/535.19"}

    Options.add_experimental_option("mobileEmulation", mobile_emulation)

    Options.add_argument("--log-level=3")
    #Options.add_argument("--headless")
    #Options.add_argument("--remote-debugging-port=9222")
    #Options.add_argument('--no-sandbox')

Error:
Code is unreachablePylance


text:
Q: onStart() call startService() sometimes causes exception in Android O Our app is targeting Android O.
After reading Background Service Limitation, I have come to notice that it is safe for a foreground app to launch services. Therefore in our app we called startService() in our Fragment's onStart() method. We think this is ok because in this document it says when onStart is called, fragment is visible to the user and when it is visible, it means this app is a foreground app.
But sometimes, and I must admit it happens pretty rare, we still receive the following exception

java.lang.IllegalStateException: Not allowed to start service Intent {
  act=ACTION_DEACTIVATE cmp=com.adyxe.sync/.ClientService }: app is
  in background uid UidRecord{db2a697 u0a19 LAST bg:+7m30s540ms idle
  change:cached procs:1 seq(0,0,0)}

Why is this happening? Is it safer to call startService() in onResume() just to be more sure that the app is now a foreground app?

A: First of all, You might have found a bug in Android :)
Regardless, You should use a JobIntentService and enqueue it.
This way the system will run your service when the app is considered in the foreground and you will not see the error. In pre-Oreo versions the service should run immediately regardless of the app foreground state.
Here is an example:
public class ExampleJobIntentService extends JobIntentService {
  static final int JOB_ID = 1000;

  static void enqueueWork(Context context, Intent work) {
    enqueueWork(context, ExampleJobIntentService.class, JOB_ID, work);
  }

  @Override
  public void onCreate() {
    super.onCreate();
    // Some initializations...
  }

  @Override
  protected void onHandleWork(Intent work) {
    // Do your stuff...
  }

  @Override
  public boolean onStopCurrentWork() {
    // return true to reschedule this service if your work failed.
    return false;
  }
}

Then you enqueue it like this:
// The intent is the one that will be received here: onHandleWork(Intent work)
ExampleJobIntentService.enqueueWork(context, intent);

Register it in the Manifest like this:
<service
     android:name=".ExampleJobIntentService"
     android:permission="android.permission.BIND_JOB_SERVICE" />

If you plan on running the service in the background as well you should add the WAKE_LOCK permission in the Manifest for pre-Oreo versions:
<uses-permission android:name="android.permission.WAKE_LOCK" />


text:
Q: How we can give same name to the multiple textbox which are created by a loop I have created multiple textboxes/textfields using a for loop in JSP (or Struts2). The textboxes/textfields are created at runtime based on the condition, therefore i am unable to say exact number of textboxes. I have code which is executed using the onFocus of each of these textboxes and perform the same function for each one, for example when i onfocus on textbox, the calender will be opened. The function which is executed is performed based on the "name" of the textbox. But whenever i run this JSP and onfocus on the textbox, it executes only for the first textbox rather than all of them. please help me with this, or give me some suggestions  what i need to  do in this scenario. Thank You

A: you can try array variable in textbox
<s:iterator...>
    <S:textfield name="elementname[]" id="elementname[]" onfocus="javascript:funcName(this)"/>
</s:iterator>

in script
var variablename = document.getElementsByName('elementname[]');
for(var i=0;i<transferBusinessId.length;i++)
{
     alert(variablename [i]);
}

A: when calling the javascript function on focus , pass this as one of the parameter which will give the selected element. You can do something like this
<s:textfield name="yourElemetnName" onfocus="javascript:funcName(this)">

in javascript function
function funcName(element){
 alert("selected the correct element -- "  + element.id);
 //the real work goes here

}

Hope this helps :)


text:
Q: How can we import data coming another erp? I have a question concerning the impact of companies acquisition and its impact on the global
information system harmonization. as an example, let's take a company A using ABS ERP
and acquiring:
- Company B using Blue cherry ERP
- Company C using Styleman ERP
How can we harmonize and give company A real time access to data from it's affiliates ERPs?
Thank you !

A: You can either use ETL to move data from one database to another, and have the same schema but this would be an overkill.
Another option would be to create services which sit on top of one ERP to extract data, and then custom development would be required to be done to the other system to integrate to these services. When data is viewed, data would be picked up from one of the ERP's database, and from the web services of the other.
Or else try to merge the companies using the same system, having a period of time with the systems running in parallel on both systems to make sure everything is running smoothly. Cross checks would need to be done to make sure data is OK.


text:
Q: When running CRON, 'require' fails silently I have a backup script that runs from the browser without a problem. It extracts data from the database and writes it to a ZIP file that's under 2MB .
It mostly runs from the server, but it fails (silently) when it hits a particular line:
require ('/absolute-path/filename');  // pseudo filespec

This is one of several such statements. These are library files that do nothing but 'put stuff in memory'. I have definitely eliminated any possibility that the path is the problem. I'm testing the file with a conditional is_readable(), output it, and sent myself emails.
$fs = '/absolute-path/filename'; // pseudo filespec
if (is_readable ($fs) ) {
    mail('myaddress','cron','before require'); // this works reliably
    require ($fs); // can be an empty file ie. <?php ?>
    mail('myaddress','cron','after require'); // this never works.
}

When I comment out the require($fs), the script continues (mostly, see below).
I've checked the line endings (invisible chars). Not on every single include-ed file, but certainly the one that is running has newline (NL) endings (Linux-style), as opposed to newline + carriage return (NL CR) (Windows style).
I have tried requiring an empty file (just <?php ?>) to see if the script would get past that point. It doesn't.
I have tried calling mail(); from the included script. I get the mail. So again, I know the path is right. It is getting executed, but it never returns and I get no errors, at least not in the PHP log. The CRON job dies...
This is a new server. I just migrated the application from PHP 5.3.10 to PHP7. Everything else works.
I don't think I am running out of memory. I haven't even gotten the data out of the database at this point in the script, but it seems like some sort of cumulative error because, when I comment out the offending line, the error moves on to another equally puzzling silent failure further down the code.
Are there any other useful tests, logs, or environment conditions I should be looking at? Anything I could be asking the web host?

A: This usually means that there is some fatal error being triggered in the included file. If you don't have all errors turned on, PHP may fail silently when including files with certain fatal errors.
PHP 7 throws fatal errors on certain things that PHP 5.3 did not, such as Division by Zero.
If you have no access to server config to turn all errors on, then calling an undefined function will fail silently. You can try debugging by putting

die('test');
__halt_compiler();

at the beginning of a line, starting from the top, on the line after the first <?php tag and see if it loads. If it does slowly displace line by line (though don't cut a control structure!) and retest after each time and when it dies you know the error is on the line above.

A: I believe the problem may be a PHP 7 bug. The code only broke when it was called by CRON and the 'fix' was to remove the closing PHP tag ?>. Though it is hard to believe this could be an issue, I did a lot of unit testing, removing prior code, etc. I am running PHP 7.0.33. None of the other dozen or so (backup) scripts broke while run by CRON.

A: As nzn indicated this is most likely caused by an error triggered from the included file. From the outside it is hard to diagnose. A likely case is a relative include/require within that file. A way to verify that is by running the script on console from a different location. A f might be to either call cd from cron before starting PHP or doing a chdir(__DIR__) within the primary file before doing further includes.


text:
Q: Unable to generate tables with eclipse link and oracle db - IllegalBlockSizeException I've created a dynamic web project and added JPA facet in my eclipse mars.
In my build path, I have: jdk8, EclipseLink 2.6, JPA 2.1, Tomcat 8, Oracle thin driver(ojdbc14.jar);
There is a strange matter because the same project works in some machines but doesn't work in others.
For the purpose I think that tomcat is not essential because I just want generate tables from entities in a simple jpa project.
I've created two jpa entities and I've set persistence.xml to point to my Oracle database (Ping successful):
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="question" transaction-type="RESOURCE_LOCAL">
        <class>it.corsojava.question.domain.Student</class>
        <class>it.corsojava.question.domain.Question</class>
        <properties>
            <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@192.168.14.111:1521:ORCL"/>
            <property name="javax.persistence.jdbc.user" value="fede"/>
            <property name="javax.persistence.jdbc.password" value="fede"/>
            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
            <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
            <property name="eclipselink.jdbc.bind-parameters" value="false"/>
            <property name="eclipselink.jdbc.exclusive-connection.is-lazy" value="true"/>
            <property name="eclipselink.jdbc.exclusive-connection.mode" value="Transactional"/>
            <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC"/>
        </properties>
    </persistence-unit>
</persistence>

Question.java
    package it.corsojava.question.domain;
import java.io.Serializable;
import java.lang.Long;
import java.lang.String;
import javax.persistence.*;

/**
 * Entity implementation class for Entity: Question
 *
 */
@Entity
public class Question implements Serializable {

    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    private String text;
    private static final long serialVersionUID = 1L;

    public Question() {
        super();
    }
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getText() {
        return this.text;
    }

    public void setText(String text) {
        this.text = text;
    }

}

Student.java
package it.corsojava.question.domain;

import java.io.Serializable;
import java.lang.Long;
import java.lang.String;
import javax.persistence.*;

/**
 * Entity implementation class for Entity: Student
 *
 */
@Entity
public class Student implements Serializable {

    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    private String name;

    private String username;
    private String password;
    private String email;

    private static final long serialVersionUID = 1L;

    public Student() {
        super();
    }
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}

Unfortunately, when I run JPA tools>create tables from entities... I get following error:
[EL Fine]: server: Configured server platform: org.eclipse.persistence.platform.server.NoServerPlatform
[EL Config]: metadata: The access type for the persistent class [class it.corsojava.question.domain.Question] is set to [FIELD].
[EL Config]: metadata: The access type for the persistent class [class it.corsojava.question.domain.Student] is set to [FIELD].
[EL Config]: metadata: The alias name for the entity class [class it.corsojava.question.domain.Question] is being defaulted to: Question.
[EL Config]: metadata: The table name for entity [class it.corsojava.question.domain.Question] is being defaulted to: QUESTION.
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID.
[EL Config]: metadata: The column name for element [text] is being defaulted to: TEXT.
[EL Config]: metadata: The alias name for the entity class [class it.corsojava.question.domain.Student] is being defaulted to: Student.
[EL Config]: metadata: The table name for entity [class it.corsojava.question.domain.Student] is being defaulted to: STUDENT.
[EL Config]: metadata: The column name for element [password] is being defaulted to: PASSWORD.
[EL Config]: metadata: The column name for element [name] is being defaulted to: NAME.
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID.
[EL Config]: metadata: The column name for element [email] is being defaulted to: EMAIL.
[EL Config]: metadata: The column name for element [username] is being defaulted to: USERNAME.
[EL Severe]: ejb: Local Exception Stack:
Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered during string decryption.
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at org.eclipse.persistence.exceptions.ValidationException.errorDecryptingPassword(ValidationException.java:894)
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:114)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateLogins(EntityManagerSetupImpl.java:2404)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateSession(EntityManagerSetupImpl.java:2716)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:710)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:150)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
    at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314)
    at javax.crypto.Cipher.doFinal(Cipher.java:2165)
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:109)
    ... 12 more

Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered during string decryption.
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:815)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:150)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.buildEntityManagerFactory(Main.java:94)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:80)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:68)
Caused by: Exception [EclipseLink-7107] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Error encountered during string decryption.
Internal Exception: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at org.eclipse.persistence.exceptions.ValidationException.errorDecryptingPassword(ValidationException.java:894)
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:114)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateLogins(EntityManagerSetupImpl.java:2404)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.updateSession(EntityManagerSetupImpl.java:2716)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:710)
    ... 9 more
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
    at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314)
    at javax.crypto.Cipher.doFinal(Cipher.java:2165)
    at org.eclipse.persistence.internal.security.JCEEncryptor.decryptPassword(JCEEncryptor.java:109)
    ... 12 more

A: This relates to a known bug which was fixed with version 2.6.5-RC1. It also works as expected with the latest 2.6.5-RC2 release candidate (available since June 2017).
In case you have a Maven project, change the version string of the EclipseLink dependency like so:
 <dependency>
     <groupId>org.eclipse.persistence</groupId>
     <artifactId>eclipselink</artifactId>
     <version>2.6.5-RC2</version>
 </dependency>

If this is a standalone project, find the latest 2.6.5-RC2 jar file on Maven Central. Just remove the old jar file and put the new one in the application's class path.
Hope it helps.


text:
Q: Having trouble with HTML/php forum image upload Preface:
I would like to state that I have no experience with PHP. I've been making edits to the PHP file by simply using common sense.
Problem:
I've recently started working on a new website and I'm coding this one 100% from scratch. But I want to add a image submission forum and so I looked around the web for a little bit and from visiting multiple different websites I was able to come up with the following php code (which I have tested and it works)[This php code is in a LevelBRSubmit.php file]:
<?php
/* Set e-mail recipient */
$myemail  = "example@email.com";

/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your Username");
$email    = check_input($_POST['email'] "Provide your Email");
$comments = check_input($_POST['comments'], "Write your comments");

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
    show_error("E-mail address not valid");
}

/* Let's prepare the message for the e-mail */
$message = "Hello!

Your contact form has been submitted by:

Username: $yourname
E-mail: $email

Level Description:
$comments

End of message
";

/* Send the message using mail() function */
mail($myemail, 'New Level Submition!', $message);

/* Redirect visitor to the thank you page */
header('Location: http://projectskyforums.x10.mx/');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
        show_error($problem);
    }
    return $data;
}

function show_error($myError)
{
?>

    Please correct the following error:

    <?php echo $myError; ?>

    <input type="button" value="Back To Forum" />

<?php
exit();
}
?>

Along with this forum (which is in an BaseHTMLPlate.html file):

Required fields are bold

<form action="LevelBRSubmit.php" method="post">

Your Username: <input type="text" name="yourname" />

E-mail: <input type="text" name="email" />

Your comments:

<textarea name="comments" rows="10" cols="40"></textarea>

<input type="submit" value="Send it!">

When I added the image upload button it all stopped working (which I already assumed would happen):

Required fields are bold

<form action="LevelBRSubmit.php" method="POST" enctype="multipart/form-data">

Your Username: <input type="text" name="yourname" />

E-mail: <input type="text" name="email" />

Your Level Design:<input type="file" value="Upload Image" name="pic" accept="image/*">

Your comments:

<textarea name="comments" rows="10" cols="40"></textarea>

<input type="submit" value="Send it!">

PHP:
<?php
/* Set e-mail recipient */
$myemail  = "example@email.com";

/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your Username");
$email    = check_input($_POST['email'] "Provide your Email");
$pic = $_FILES['pic']['name'];
$comments = check_input($_POST['comments'], "Write your comments");

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
    show_error("E-mail address not valid");
}

/* Let's prepare the message for the e-mail */
$message = "Hello!

Your contact form has been submitted by:

Username: $yourname
E-mail: $email

Level Description:
$comments

Level Design: $pic

End of message
";

/* Send the message using mail() function */
mail($myemail, 'New Level Submition!', $message);

/* Redirect visitor to the thank you page */
header('Location: http://projectskyforums.x10.mx/');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
        show_error($problem);
    }
    return $data;
}

function show_error($myError)
{
?>

    Please correct the following error:

    <?php echo $myError; ?>

    <input type="button" value="Back To Forum" >

<?php
exit();
}
?>

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
Update
The PHP sent the email! But instead of displaying the image the email simply displays the images name.
If anyone would like to give the page itself a look you can find it at the website link below (the website is still in early stages of development):
http://projectskyforums.x10.mx/BaseHTMLPlate.html

A: You have to use enctype="multipart/form-data" in your form tag and to receive file in your php file you have to use $_FILES['pic'] to get your file data.
<form action="LevelBRSubmit.php" method="post">

Replace above line with this
<form action="LevelBRSubmit.php" method="post" enctype="multipart/form-data">

In your LevelBRSubmit.php file change this line
$pic    = check_input($_POST['pic'] "Provide your Design");

to this
$pic = $_FILES['pic']['name'];

The new line give you the name of image file. You can find all data using $_FILES['pic'] for your image file.