text:
Q: PHP cant connect locally, using XAMPP - "Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: NO)" I think I got it working again. By forcing the port being used to 80 for apache, and 3306 for mysql. I killed the processes that occupies those port.
This is the exact error showing

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\pcss\public\config\endpoints\db.php:16 Stack trace: #0 C:\xampp\htdocs\pcss\public\config\endpoints\db.php(16): mysqli->__construct('localhost', 'root', Object(SensitiveParameterValue), 'pcss') #1 C:\xampp\htdocs\pcss\public\components\medical-records.php(2): include('C:\\xampp\\htdocs...') #2 C:\xampp\htdocs\pcss\public\index.php(28): include('C:\\xampp\\htdocs...') #3 {main} thrown in C:\xampp\htdocs\pcss\public\config\endpoints\db.php on line 16

and these are the relevant codes
//C:\xampp\htdocs\pcss\public\config\endpoints\db.php
<?php
    $servername = "localhost";

    switch($_SERVER['HTTP_HOST']){
        //this case part is modified, shouldnt matter i think
        case "my website's link in 000webhost":
        $username = "lorem";
        $password = "lorem";
        $database = "lorem";
        break;

        //this default part is not modified
        default:
        $username = "root";
        $password = "";
        $database = "pcss";
    }
    // Create connection
    $conn = new mysqli($servername, $username, $password, $database);

?>

C:\xampp\htdocs\pcss\public\components\medical-records.php(2)
    include("config/endpoints/db.php");

It used to work just fine until I reformatted my laptop. I even have a website running on 000webhost able to connect w/ MySQL there right now, and all other test files I've done have the same local credentials of
    $servername = "localhost";
    $username = "root";
    $password = "";

and I can login with the shell command 'mysql -u root -p -h localhost' and pressing enter again when prompted for a password,
and I can control the users, databases, and etc... in phpMyAdmin.

Tried these:
"Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" from php function
MySQL said: Documentation #1045 - Access denied for user 'root'@'localhost' (using password: NO)
MySQL Error: : 'Access denied for user 'root'@'localhost'
I've tried the alter thing, basically changes the password of the user you are pointing at. Still don't work.
I supposed you should do these stuffs if you can't access phpMyAdmin/MySQL to begin with.
I made a new user account with these credentials just to test:
User name: 'restapi'
Password: 'restapi'

I can login with it in shell's cmd w/ 'mysql -u restapi -p -h localhost', and typing 'restapi' again when prompted for a password. Still can't connect with mysql tho. This is the error:
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'restapi'@'localhost' (using password: YES) in C:\xampp\htdocs\pcss\public\config\endpoints\db.php:16 Stack trace: #0 C:\xampp\htdocs\pcss\public\config\endpoints\db.php(16): mysqli->__construct('localhost', 'restapi', Object(SensitiveParameterValue), 'pcss') #1 C:\xampp\htdocs\pcss\public\components\medical-records.php(2): include('C:\\xampp\\htdocs...') #2 C:\xampp\htdocs\pcss\public\index.php(28): include('C:\\xampp\\htdocs...') #3 {main} thrown in C:\xampp\htdocs\pcss\public\config\endpoints\db.php on line 16

and this is the code with that new user account:
//C:\xampp\htdocs\pcss\public\config\endpoints\db.php
<?php
    $servername = "localhost";

    switch($_SERVER['HTTP_HOST']){
        //this case part is modified, shouldnt matter i think
        case "my website's link in 000webhost":
        $username = "lorem";
        $password = "lorem";
        $database = "lorem";
        break;

        //this default part is not modified
        default:
        $username = "restapi";
        $password = "restapi";
        $database = "pcss";
    }
    // Create connection
    $conn = new mysqli($servername, $username, $password, $database);

?>

I also saw this one:
Access denied for user 'root@localhost' (using password:NO)
And tried changing the root's password, and I think this is the same thing with the alter thing. Just made me changed my configs (config.inc.php) again to access phpMyAdmin but still couldn't connect using PHP, still throwing the same access denied error.


text:
Q: calculate column total in Vaadin 7 Grid In Vaadin 7, is there an easy way to calculate the numeric total for selected columns?  I know how to do it for Vaadin 8, defined here.  But since Vaadin 7 uses a container, I am trying to think of the best way to do it.  Currently, this is the best way I can think of, based on the documentation here.  Code is a rough draft, so I expect there are some syntax problems.  Treat it more as pseudo code, if possible.
Map<Object,Double> totals = new HashMap();
for (Iterator<?> i = container.getItemIds().iterator(); i.hasNext();) {
    Object itemId = i.next();

    Item item = container.getItem(itemId);

    for(Object totalCol : totalColumns)
    {
        Object columnVal = item.getItemProperty(totalCol);

        Double total = totals.get(totalCol);
        if(!(total instanceof Double))
            total = 0.0;
        if(columnVal instanceof Double)
        {
            total += (Double)columnVal;
        }
        else if(columnVal instanceof Long)
        {
            total += (Long)columnVal;
        }
        else if(columnVal instanceof Integer)
        {
            total += (Integer)columnVal;
        }
        else if(columnVal instanceof String)
        {
            try {
                Long value = Long.parseLong((String) columnVal);
                total += value;
            } catch (NumberFormatException e) {
                try {
                    Double value = Double.parseDouble((String) columnVal);
                    total += value;
                } catch (NumberFormatException e1) {
                }
            }
        }

        totals.put(totalCol, total);
    }

    /* At this point, go through totals Map, and set value to correct footer column with correct
     * text formatting.  This part is easy, and clearly documented, so leaving it off this
     * code example.
     */
}

By the way, the above idea works, my question is more if this is the best idea or not?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to apply style using GtkSourceView library I'm trying to style a GtkSourceView object in particular I'd like to change the color of line numbers. I'm reading Style Scheme Definition Reference: GtkSourceView 4 Reference Manual. I'm able to change text but not line-numbers. The document says:
line-numbers : Text and background colors for the left margin, on which line numbers are drawn.
This is the source:
#include <gtk/gtk.h>
#include <gtksourceview/gtksource.h>

int main (int argc,
char *argv[])
{
    GtkWidget *window, *scrolled_win, *textview;
    GtkWidget *vbox, *menubar, *fileMenu, *fileMi, *quit_item;

    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_maximize(GTK_WINDOW (window));
    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    gtk_window_set_title (GTK_WINDOW (window), "Text Views");
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    textview = gtk_source_view_new();
    menubar = gtk_menu_bar_new();
    fileMenu = gtk_menu_new();

    fileMi = gtk_menu_item_new_with_label("File");

    quit_item = gtk_menu_item_new_with_label("Quit");

    gtk_widget_set_hexpand(textview, TRUE);
    gtk_widget_set_vexpand(textview, TRUE);

    GtkCssProvider *provider = gtk_css_provider_new ();
    gtk_css_provider_load_from_path (provider,
    "gtk-widgets.css", NULL);

    GtkStyleContext *context;
    context = gtk_widget_get_style_context(textview);
    gtk_style_context_add_provider (context,
                                    GTK_STYLE_PROVIDER(provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_USER);

    gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileMi), fileMenu);
    gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), quit_item);
    gtk_menu_shell_append(GTK_MENU_SHELL(menubar), fileMi);
    gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);

    scrolled_win = gtk_scrolled_window_new (NULL, NULL);
    gtk_container_add(GTK_CONTAINER(vbox), scrolled_win);
    gtk_container_add (GTK_CONTAINER (scrolled_win), textview);

    gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW(textview), TRUE);
    gtk_widget_show_all (window);

    g_signal_connect(G_OBJECT(window), "destroy",
        G_CALLBACK(gtk_main_quit), NULL);

    g_signal_connect(G_OBJECT(quit_item), "activate",
        G_CALLBACK(gtk_main_quit), NULL);

    gtk_main();
    return 0;
}

This is the CSS file:
text {
    background-color: #002b36;
    color: #c7a21d;
}

line-numbers {
    background-color: red;
    color:red;
}

current-line-number {
    background-color: red;
    color:red;
}

selection{
    color:yellow;
}

What am I doing wrong?

A: The API has a way to access the default styles like this:
manager = GtkSource.StyleSchemeManager().get_default()

print (manager.get_scheme_ids())
>['classic', 'cobalt', 'kate', 'oblivion', 'solarized-dark', 'solarized-light', 'tango']

scheme = manager.get_scheme("oblivion")
buffer.set_style_scheme(scheme)

An example for good measure:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GtkSource as gtksource
from gi.repository import Pango

view = gtksource.View()
view.modify_font(Pango.FontDescription('monospace 11'))
view.set_show_line_numbers(True)
view.set_show_line_marks(True)
buffer = view.get_buffer()
filename = "treeview.py"
txt = open(filename).read()
buffer.set_text(txt)
# set language, syntax highlighting
lm = gtksource.LanguageManager.new()
lang = lm.guess_language(filename)
buffer.set_highlight_syntax(True)
buffer.set_language(lang)
buffer.create_tag("invisible",invisible=True)
manager = gtksource.StyleSchemeManager().get_default()
scheme = manager.get_scheme("monokai")
buffer.set_style_scheme(scheme)
window = gtk.Window()
window.connect("destroy", gtk.main_quit)
window.add(view)
window.show_all()
gtk.main()

From there you should be able use the guide to apply custom themes, change colours of certain elements, etc...


text:
Q: Postgres : Indexing switches to Parallel Seq Scan from index scan when queried for date range exceeding 2 days Database is running on Aurora Postgres db with 16vcpu,128GB RAM.
If the date range selected is more than 2 days, plan is getting switched to parallel seq scan instead of parallel index scan. Is there any reason why parallel seq scan is attached, if the wider date range is chosen.?  and how to force the query to use always parallel index scan.
enable_seqscan=off and vacuum the table. Both the option is not helping.
Query:
**SELECT
    s.exval_00,s.exval_01,  s.EXVAL_03,s.EXVAL_04,s.SAMPLE_DATE
FROM
    xxx.T_EXT_SAMPLES s
JOIN xxx.T_EXT_SAMPLES_CALC c ON
    c.SAMPLE_ID = s.SAMPLE_ID
WHERE
    1 = 1
    AND c.CH_ID IN (91111)
        AND c.SAMPLE_DATE = s.SAMPLE_DATE
    AND s.SAMPLE_DATE BETWEEN TO_DATE('2022-05-05 00:00', 'YYYY-MM-DD HH24:MI:SS') AND to_date('2022-05-06 00:00', 'YYYY-MM-DD HH24:MI:SS')
        AND s.EXVAL_07 IN ('T-EC-ER-TEOS')
    AND (s.EXVAL_09 IN ('xxxxxx1', 'xxxx-V01-PST.01') OR s.exval_15 IN ('xxxx-TEOS-V01-RUN.01', 'xxxx-V01-PST.01'));**

Explain for 2 days(index scan): - Execution time:17sec
Nested Loop  (cost=0.28..7080425.61 rows=1 width=1699) (actual time=5261.678..17069.465 rows=14 loops=1)
   I/O Timings: read=678843.320
   ->  Append  (cost=0.13..6953671.76 rows=180 width=1718) (actual time=900.938..17063.022 rows=312 loops=1)
         I/O Timings: read=678843.320
         Subplans Removed: 179
         ->  Index Scan using t_ext_samples_5_2022_sample_date_exval_00_exval_19_exval_01_idx on t_ext_samples_5_2022 s_1  (cost=0.57..6952228.43 rows=1 width=45) (actual time=900.937..17062.967 rows=312 loops=1)
               Index Cond: ((sample_date >= to_date('2022-05-05 00:00'::text, 'YYYY-MM-DD HH24:MI:SS'::text)) AND (sample_date <= to_date('2022-05-06 00:00'::text, 'YYYY-MM-DD HH24:MI:SS'::text)))
               Filter: (((exval_07)::text = 'T-EC-ER-TEOS'::text) AND (((exval_09)::text = ANY ('{xxxxx-V01-RUN.01,xxxxxTEOS-V01-PST.01}'::text[])) OR ((exval_15)::text = ANY ('{xxxxV01-RUN.01,xxxS-V01-PST.01}'::text[]))))
               Rows Removed by Filter: 3832755
               I/O Timings: read=678843.320
   ->  Append  (cost=0.15..702.39 rows=180 width=16) (actual time=0.007..0.008 rows=0 loops=312)

Explain for >2 days(Parallel Seq scan): - Execution time:111sec
Gather  (cost=1000.72..11284108.20 rows=1 width=1690) (actual time=1364.885..111179.407 rows=30 loops=1)
   Workers Planned: 2
   Workers Launched: 2
   I/O Timings: read=80156489.486
   ->  Nested Loop  (cost=0.72..11283108.10 rows=1 width=1690) (actual time=2960.391..111120.888 rows=10 loops=3)
         I/O Timings: read=80156489.486
         ->  Parallel Append  (cost=0.57..11156959.84 rows=180 width=1708) (actual time=1015.155..111113.961 rows=332 loops=3)
               I/O Timings: read=80156489.486
               Subplans Removed: 179
               ->  Parallel Seq Scan on t_ext_samples_5_2022 s_1  (cost=0.00..11155518.78 rows=1 width=45) (actual time=1015.153..111113.904 rows=332 loops=3)
                     Filter: (((exval_07)::text = 'T-EC-ER-TEOS'::text) AND (sample_date >= to_date('2022-05-05 00:00'::text, 'YYYY-MM-DD HH24:MI:SS'::text)) AND (sample_date <= to_date('2022-05-08 00:00'::text, 'YYYY-MM-DD HH24:MI:SS'::text)) AND (((exval_09)::text = ANY ('{xxxxxx-V01-RUN.01,xxxxxx-V01-PST.01}'::text[])) OR ((exval_15)::text = A
NY ('{xxxx-.01,xxxxV01-PST.01}'::text[]))))
                     Rows Removed by Filter: 42149603
                     I/O Timings: read=80156489.486
         ->  Append  (cost=0.15..699.02 rows=180 width=16) (actual time=0.008..0.008 rows=0 loops=996)


text:
Q: How can I find the bandwidth of a sinc function? I have a solved problem and it says the bandwidth of the function:
$$sinc(\frac \omega {20000}) \cdot rect(\frac \omega {20000 \pi})$$
is 10 kHz. Why it is not 20 kHz or 40 kHz ?

A: It depends on the definition of the \$\mathrm{rect}\$ function you are using, but the most likely confusion is \$\omega=2\pi{}f\$, not \$\pi{}f\$.
However, in the usual definition of \$\mathrm{rect}\$, for example as given by Wikipedia,  the bandwidth of \$\mathrm{rect}(\frac{\omega}{20,000\pi})\$ is normally stated as 5 kHz, not 10 kHz, because we consider only the portion of the passband in the positive frequencies.


text:
Q: How to run qemu with a Yocto generated image on a distant machine? I am using an ubuntu on a distant machine and I'd like to use the runqemu command to start the image. I think there's a way to redirect the serial to the actual one pts/0 or pts/1, but I didn't manage to do it.
How can I do it?

A: I can't comment yet so add here.
Why don't use ssh to log in the remote ubuntu and run runqemu with option nographic?


text:
Q: cut command - How to find the end of line with N bytes I want to cut a line from the 13th byte until the end of the line, but I don't know how many bytes there are in the line.
How can I find the end of the line?
I tried to do:
cut -b 13-CRFL $textfile

Thank you!

A: From man cut (I have bolded the relevant option):

Use one, and only one of -b, -c or -f.  Each LIST is made up of one range, or many ranges  sepa‐
rated  by  commas.   Selected input is written in the same order that it is read, and is written
exactly once.  Each range is one of:

N      N'th byte, character or field, counted from 1

N-     from N'th byte, character or field, to end of line

N-M    from N'th to M'th (included) byte, character or field

-M     from first to M'th (included) byte, character or field

So you just have to use:
cut -b 13- $textfile


text:
Q: Why does the "borrow" algorithm for subtraction work? I would like to understand how the borrow algorithm for simple subtraction ( base 10, the one we learn when we are kids ) works, does anyone have any material on this? Thank you.

A: Let's consider the borrowing in this example:
$$
\begin{array}{rrrr}
 &3&4&2\\
-& &5&8\\\hline
\end{array}
$$
We can't take 8 from 2, so we "borrow" one of the 4 tens from 342, and make it into 10 units instead, and add it to the 2 units we already have.
That leaves 3 tens in the tens' column, and 12 units in the units' column:
$$
\require{cancel}
\begin{array}{rrrr}
\quad &3&\color{darkred}{\cancelto{3}4}&\color{darkred}{{}^1}2\\
-& &5&8\\\hline
\end{array}
$$
What we did here is like making change: We had 4 dimes and 2 pennies, but that was not convenient because we wanted to take away 8 pennies.  So we changed one of the dimes into pennies, and then we had 3 dimes and 12 pennies, and it was easy to take away 8 pennies.  This "borrowing" trick is just like making change.
Then we take 8 units from 12 units, leaving 4 units:
$$
\require{cancel}
\begin{array}{rrrr}
\quad &3&{\cancelto{3}4}&{{}^1}2\\
-& &5&8\\\hline
&&&\color{darkred}{4}\end{array}
$$
Now we want to subtract 5 tens from 3 tens, but, again, we can't. So we do almost the same as before, but this time we "borrow" one of the hundreds from the 3 hundreds in the hundreds' column, and turn it into 10 tens, adding it to the 3 tens that are already in the tens' column:
$$
\require{cancel}
\begin{array}{rrrr}
\quad &\color{darkred}{\cancelto23}&\cancelto{\color{darkred}{1}3}4&{}^12\\
-& &5&8\\\hline
&&&4
\end{array}
$$
Again, this is like making change: we had 3 dollars and 3 dimes, and we changed one dollar into ten dimes, leaving 2 dollars and 13 dimes.  That is allowed in arithmetic for the same reason it is allowed in money dealings: it doesn't change the actual amount!
Anyway subtracting 5 tens from 13 tens we have 8 tens:
$$
\require{cancel}
\begin{array}{rrrr}
\quad &\cancelto23&\cancelto{13}4&{}^12\\
-& &5&8\\\hline
&&\color{darkred}{8}&4
\end{array}
$$
and then 2 hundreds minus no hundreds is 2 hundreds:
$$
\require{cancel}
\begin{array}{rrrr}
\quad &\cancelto23&\cancelto{13}4&{}^12\\
-& &5&8\\\hline
&\color{darkred}{2}&8&4
\end{array}
$$
And the answer is 284.


text:
Q: How to get the keys from values = 1 from a multicheckbox array? In this question I learned how to make an implode.
But now I need something a little more complicated (I think) and after searching I tried several implode options without clear results, here I am again to ask help...
I have a multicheckboxes which are populated with categories (Wordpress).
Each category name has a category id and the value for the checkbox is 1 for checked.
So, this is an echo of an example array after check some categories:
<?php $categories = of_get_option('check_categories' ); ?>

<?php print_r($categories); ?>

Array (
    [13] => 1
    [7] => 1
    [6] => 1
    [23] => 0
    [12] => 0
    [5] => 0
    [11] => 0
    [22] => 0
    [3] => 0
    [14] => 0
    [1] => 1
    [17] => 0
    [10] => 0
    [18] => 1
)

If i make <?php echo implode(', ',of_get_option('check_categories' )); ?>
This is the result: 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1
OK... But I don't want these results, what I need is: for checkboxes = 1 I need to get only the category Id (keys). In this case exactly like this: 13,7,6,1,18 but how?

A: I just solved it.It's quiet simple in fact.
I used function implode with the search within the array_keys to select only the keys with value 1:
<?php echo implode(', ',array_keys($categoriesblog2, 1)); ?>

And the final result is (witch are the categories id from my blog):
13, 7, 6, 1, 18


text:
Q: Running an AWS cli command from a local python script? I'm trying to run this aws s3 ls command:
aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize

with this python:
command = 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize'
s3_folder_data  = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
print s3_folder_data

But it's failing with this error:
subprocess.CalledProcessError: Command 'aws s3 ls s3://path/to/my/bucket/12434 --recursive --human-readable --summarize' returned non-zero exit status 1

The command itself works when I run it. The python script is being called by the same user on the same machine. What gives?

A: New in Python 3.5, you can also use subprocess.run().
subprocess.run(['aws', 's3', 'ls', 's3://path/to/my/bucket/12434', '--recursive', '--human-readable', '--summarize'])

A: As suggested by others, use Boto3 S3 library to get what you want. But if you insist on subprocess, try:
subprocess.check_output(['aws', 's3', 'ls', 's3://path/to/my/bucket/12434', '--recursive', '--human-readable', '--summarize'])

or
subprocess.call(['aws', 's3', 'ls', 's3://path/to/my/bucket/12434', '--recursive', '--human-readable', '--summarize'])

and build on it.


text:
Q: cleaner way of mixing PHP switch case with html i have this php block
<?php switch ($_GET['class_id']) { ?>
<?php case 1:    ?>
<img src="<?php print $result['standard_image'] == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result['standard_image']}" ?>" alt="" />
<?php break; ?>
<?php case 2:    ?>
<img src="<?php print $result['business_image'] == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result['business_image']}" ?>" alt="" />
<?php break; ?>
<?php case 3:    ?>
<img src="<?php print $result['premium_image'] == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result['premium_image']}" ?>" alt="" />
<?php break; ?>
<?php default: ?>
<img src="<?php print $result['standard_image'] == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result['standard_image']}" ?>" alt="" />
<?php break; ?>
<?php } ?>

but this seems a bit messy..any suggestions

A: switch($_GET['class_id'])
{
    case 1:
        $source = '/images/src1.png';
        $class = 'yourClass';
        $alt = 'yourAlt';
    break;

    case 2:
        $source = '/images/src2.png';
        $class = 'yourClass2';
        $alt = 'yourAlt2';
    break;

    case 3:
        $source = '/images/src3.png';
        $class = 'yourClass3';
        $alt = 'yourAlt3';
    break;

    default:
        $source = '/images/src4.png';
        $class = 'yourClass4';
        $alt = 'yourAlt4';
    break;
}

$image = <<<EOF

EOF;

echo $image;

A: Why all the cases in the first place? You're just picking what image to use.
$images = array(
  1 => 'standard_image',
  2 => 'business_image',
  3 => 'premium_image'
);

$id = $_GET['class_id'];
$image_key = (isset($images[$id])) ? $images[$id] : 'standard_image';

$image = '/pre_config/css/images/blue-png2.png';
if ($result[$image_key] != '')
    $image = $result[$image_key];

echo '';

Added bonus: the purpose of the logic is clearer.

A: I agree, that code is crazy.
Write all the PHP code in a single <?php ?> block. When you have to print something, use the print function or echo construct.
Declare variables that can help you read and understand the code.
For example:
<?php

switch ($_GET['class_id']) {
    case 1:
       $imgpath = ($result['standard_image'] == "") ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result['standard_image']}";
       echo '';
       break;
    case 2:
       // and so on for the other cases...
}

?>

Isn't it a bit less messy?

A: <?php
$image = $result['standard_image'];
switch ($_GET['class_id']) {
    case 2: $image = $result['business_image']; break;
    case 3: $image = $result['premium_image']; break;
}
?>
<img src="<?php print $image == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$image}"; ?>" alt="" />

You don't need to open and close php tags every line.

A: <?php
$img = '';
switch ($_GET['class_id']) {
  case 1 :
    $img = $result['standard_image'];
    break;
  case 2 :
    $img = $result['business_image'];
    break;
  case 3 :
    $img = $result['premium_image'];
    break;
  default :
    $img = $result['standard_image'];
    break;
}
if (!$img) {
  $img = 'blue-png2.png';
}
?>
<img src="<?php print $img; ?>" alt="" />

You can remove line breaks as you see fit... I format things consistently as a principle, and you should too ! :)

A: $array = array(
    array('/images/src1.png', 'yourClass', 'yourAlt'),
    array('/images/src2.png', 'yourClass2', 'yourAlt2'),
    array('/images/src3.png', 'yourClass3', 'yourAlt3'));

echo '';

A: I would go with actually putting this in a block and use a few predefined variables. A little bit cleaner, at least to me...
<?php
$p = "/pre_config/css/images/blue-png2.png";
$s = "/shop_possystems/image/";
switch ($_GET['class_id']) {
    case 1:
        $x = (empty($result['standard_image']) ? $p : "{$s}/{$result['standard_image']}";
        break;
    case 2:
        $x = (empty($result['business_image']) ? $p : "{$s}/{$result['business_image']}";
        break;
    case 3:
        $x = (empty($result['premium_image']) ? $p : "{$s}/{$result['standard_image']}";
        break;
    default:
        $x = (empty($result['standard_image']) ? $p : "{$s}/{$result['standard_image']}";
        break;
}

echo "";

?>

A: Yes...
<?php
$a = array(0, 0, 'business_image', 'premium_image');
$t = $a[(int)$_GET['class_id']] || "standard_image";
echo "";
?>

A: You can echo your img tags within the case statement

A: If you want to use the switch, I'd suggest something like the following.
<?php
    $img_type = '';
    switch ($_GET['class_id']) {
    case 1:
        $img_type = 'standard_image';
        break;
    case 2:
        $img_type = 'business_image';
        break;
    case 3:
        $img_type = 'premium_image';
        break;
    default:
        $img_type = 'standard_image';
        break;
    }
    $src = $result[$img_type] == "" ? "/pre_config/css/images/blue-png2.png" : "/shop_possystems/image/{$result[$img_type]}";
?>
<img src="<?php print $src ?>" alt="" />


text:
Q: Avoid putting "global" in every single function Python is supposed to be fun, simple and easy to learn.
Instead, it's been a huge pain.
I've discovered that all the errors I'm getting are related to me not declaring each variable global in each function.
So for my toy program of dressUp, I have to write:
hatColor = ""
shirtColor = ""
pantsColor = ""

    def pickWardrobe(hat, shirt, pants):
         global hatColor
         global shirtColor
         global pantsColor
         ...

This gets really annoying when I have 20 functions, and each one needs to have 20 global declarations at the beginning.
Is there any way to avoid this?
Thanks!
ADDED
I am getting tons of `UnboundLocalError - local variable X referenced before assignment.
Why am I doing this? Because I need to write a py file that can do some calculations for me. I don't want it all in the same function, or it gets messy and I can't reuse code. But if I split the work among a few functions, I have to declare these annoying globals over and over.

A: Classes versus global variables
global is common to all
class is a template for an object, representing something, here it could be person dressed up somehow.
Class might have class properties, these are not so commonly used, as they are shared by all instances (sort of "global for classes).
Classes start living as soon as you instantiate them, it means, the pattern defined by class definition is realized in form of unique object.
Such an object, called instance, might have it's own properties, which are not shared with other instances.
I am sometime thinking about a class as of a can - class definition means "can is something you can put thing into" and instance is real tangible can, which has a name of it and in Python I put property values into it, which are bound to the name of given can holder.
DressUp class with real instance properties
Properties in "holmeswatson" solution are bound to class definition. You would run into problems if you would use multiple instances of DressUp, they would be sharing the properties over class definition.
It is better and safer to use it as instance variables, which are over self bound to instance of the class, not to class definition.
Modified code:
class DressUp:

    def __init__(self, name, hatColor="", shirtColor=""):
        self.name = name
        self.hatColor = hatColor
        self.shirtColor = shirtColor

    def pickWardrobe(self,hat, shirt):
        self.hatColor = hat
        self.shirtColor = shirt

    def __repr__(self):
        name = self.name
        hatColor = self.hatColor
        shirtColor = self.shirtColor

        templ = "<Person:{name}: hat:{hatColor}, shirt:{shirtColor}>"
        return templ.format(name=name, hatColor=hatColor, shirtColor=shirtColor)

tom = DressUp("Tom")

tom.pickWardrobe("red","yellow")
print "tom's hat is", tom.hatColor
print "simple print:", tom
print "__repr__ call:", tom.__repr__()

jane = DressUp("Jane")

jane.pickWardrobe("pink","pink")
print "jane's hat is", jane.hatColor
print "simple print:", jane
print "__repr__ call:", jane.__repr__()

The __repr__ method is used at the moment, you call print tom or print jane.
It is used here to show, how to instance method can get access to instance properties.

A: Is there any way around it?  Yes, there are several.  If you're using global variables on a regular basis, you're making a mistake in your design.
One common pattern when you have many functions that will operate on the same, related data is to create a class and then declare instances of that class.  Each instance has its own set of data and methods, and the methods within that instance can operate on the data within that instance.
This is called object oriented programming, it is a common and basic paradigm in modern programming.
Several respondents have sketched out what a class might look like in your case but I don't think you've given enough information (which would include the method signatures of the other functions) to actually write out what you need.  If you post more information you might get some better examples.

A: If it is appropriate, you could use classes.
class DressUp:

  def __init__(self, name):
    self.name = name

  def pickWardrobe(self,hat, shirt, pants):
    self.hatColor = hat
    self.shirtColor = shirt
    self.pantsColor = pants

 obj1 = DressUp("Tom")

 obj1.pickWardrobe("red","yellow","blue")
 print obj1.hatColor

Have a look:
http://www.tutorialspoint.com/python/python_classes_objects.htm


text:
Q: Get string between 2 known string by Regex I 'm having a link like this
href="abc.com/Details/gotoTicket?ticketID=EO8"

I want get an ID beetwen gotoTicket?ticketID= and ".
The result of link above I want is EO8
How can I do that with Regex ?

A: You don't need regex for that. You can use the HttpUtility to get your query string, e.g.
var href = new Uri("http://example.org/Details/gotoTicket?ticketID=EO8");
string ticketId = HttpUtility.ParseQueryString(href.Query).Get("ticketID");

Just make sure that your href (URL) starts with a scheme.


text:
Q: Unity 5 Control via wasd with rotation I try to implement a simple controlling for my camera in Unity. Successfully I react on pressed w, a, s, d and move the camera. I also want to implement a rotation (Later on rotation with mouse, but at first a rotation using the keys e and q). I've written this script to update my camera but the problem: If you turn around, the update process for my keys w, a, s and d are not working correctly. F.e. I want to go left, but I'll go right. I have no idea how to solve this problem. Can someone give me an idea?
Here is my source code. Hope you'll understand what's my problem.
        float translation_v = -(Input.GetAxis ("Vertical")) * 4.0F * Time.deltaTime;
    camera.transform.position += new Vector3 (0, 0, translation_v);
    float translation_h = -(Input.GetAxis ("Horizontal")) * 4.0F * Time.deltaTime;
    camera.transform.position += new Vector3 (translation_h, 0, 0);
    float rotation = -(Input.GetAxis ("Rotate_Player")) * 4.0F * Time.deltaTime * 10F;
    camera.transform.Rotate(new Vector3(0F, rotation, 0F));
    Vector3 pos = camera.transform.position;
    pos.y = terrain.GetComponent<Terrain>().SampleHeight(camera.transform.position)+1;
    camera.transform.position = pos;

A: First, Unity has standard components for first person controller and you don't have to do it from scratch, check out Assets -> Import Package -> Characters.
Assuming you do it for educational purposes and just want to implement it yourself: as far as I understood you want to move in the direction of the camera. So, what you need is to multiply the value you add to camera.transform.position by current camera rotation, i.e instead of
camera.transform.position += new Vector3 (0, 0, translation_v);

use
camera.transform.position += (camera.transform.rotation * new Vector3 (0, 0, translation_v));

and same for horizontal. You may also consider moving rotation update before position update. The final code would look like this:
float rotation = -(Input.GetAxis ("Rotate_Player")) * 4.0F * Time.deltaTime * 10F;
camera.transform.Rotate(new Vector3(0F, rotation, 0F));

float translation_v = -(Input.GetAxis ("Vertical")) * 4.0F * Time.deltaTime;
camera.transform.position += (camera.transform.rotation * new Vector3 (0, 0, translation_v));
float translation_h = -(Input.GetAxis ("Horizontal")) * 4.0F * Time.deltaTime;
camera.transform.position += (camera.transform.rotation * new Vector3 (translation_h, 0, 0));

Vector3 pos = camera.transform.position;
pos.y = terrain.GetComponent<Terrain>().SampleHeight(camera.transform.position)+1;
camera.transform.position = pos;


text:
Q: GUIZERO: I want to use a pushbutton to save what's in a textbox to file. How do I do that? I'm a super beginner with Python, so please be kind.
I am creating an app that should take in user input from text boxes, and then when the user presses the submit button this is saved in a text file.
I think the issue is that I'm not quite sure how to create the right function for the pushbutton command.
I would really appreciate if someone can code a simple app showing how to do this.
This is the code I have so far, but I get an error "TypeError: write() argument must be str, not TextBox".
from guizero import *
import os
cwd = os.getcwd()

# function for writing files
def save_file():
    with open(cwd+'/Desktop/File handling/newfile.txt','a') as f:
        f.write(userInput)

app = App("testing")

userInput = TextBox(app)
submit_button = PushButton(app, command=save_file, text="submit")

app.display()

`

A: I figured it out. Thanks :)
    from guizero import *
import os
cwd = os.getcwd()

# function for writing files
def save_file():
    with open(cwd+'/Desktop/File handling/newfile.txt','a') as f:
        f.write("First name:"+" "+first_name.value+"\n")

#the app
app = App("testing")

#text box
first_name = TextBox(app, width=30, grid=[2,4])

#submit button
box = Box(app)
submitbutton = PushButton(app, command=(save_file), text="Submit")

app.display()


text:
Q: Can't connect app server to MySQL database in a docker network I cannot get my spring-boot server to run against my database using docker.
If I start up my mysql database (called shape-shop-db-container) and intialize the database like so :
docker run -d -p 3306:3306 --name=shape-shop-db-container --env="MYSQL_ROOT_PASSWORD=root" --env="MYSQL_PASSWORD=root" --env="MYSQL_DATABASE=shapeshop" mysql
docker exec -i shape-shop-db-container mysql -uroot -proot shapeshop < SCHEMA.sql
docker exec -i shape-shop-db-container mysql -uroot -proot shapeshop < TEST_DATA.sql

and then run my application server within my IDE with the following application.properties :
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

spring.datasource.url=jdbc:mysql://localhost:3306/shapeshop?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&useLegacyDatetimeCode=false
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect

spring.datasource.username=root
spring.datasource.password=root
spring.datasource.platform=mysql
spring.datasource.initialization-mode=always

server.port=8080

everything works fine.
Now
.... instead of running my application server through my IDE, I instead have it running on a docker container, and I try the following :
(1) create network 'shape-shop-network'
docker network create shape-shop-network

(2) run db container as before, but this time specifying the network as well.
docker run -d -p 3306:3306 --name=shape-shop-db-container --network shape-shop-network --env="MYSQL_ROOT_PASSWORD=root" --env="MYSQL_PASSWORD=root" --env="MYSQL_DATABASE=shapeshop" mysql
docker exec -i shape-shop-db-container mysql -uroot -proot shapeshop < SCHEMA.sql
docker exec -i shape-shop-db-container mysql -uroot -proot shapeshop < TEST_DATA.sql

(3) now i build my app server and run it on a container called 'shape-shop-server'.
docker build -t shapeshop:1.0 .
docker run --name shape-shop-server -p 8080:8080 shapeshop:1.0 --name shape-shop-server --network shape-shop-network

But when I run it in the container, I get "unable to acquire JDBC Connection" error.
Caused by: org.springframework.dao.DataAccessResourceFailureException: Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
2022-11-03T11:34:10.043594500Z  at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:275) ~[spring-orm-5.1.8.RELEASE.jar:5.1.8.RELEASE]
2022-11-03T11:34:10.043602700Z  at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:253) ~[spring-orm-5.1.8.RELEASE.jar:5.1.8.RELEASE]
2022-11-03T11:34:10.043610900Z

Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]

Why is this happening? Is something 'off' with my ports? Why would it work in my IDE but not as a container? I would assume that the settings are the same.
UPDATE:
I tried to rename "localhost" in my application.properties to shape-shop-db-conatiner. Eg :
spring.datasource.url=jdbc:mysql://shape-shop-db-container:3306/shapeshop?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&useLegacyDatetimeCode=false

But I get "Caused by: java.net.UnknownHostException: shape-shop-db-container" , even though shape-shop-db-container is running.

A: The hostname for the docker container is not the same as "name".
You should apply the --hostname parameter when starting the docker container to specificy the hostname it would be given.
You can then use that to connect to it from another container in the same network.

A: When you want to establish a connection with another Docker container within a network, its hostname should be used instead of its name. By default, the container's hostname is set to the container's ID, which can be overridden using the --hostname flag with docker run command.
Another option would be to use the --network-alias flag, also with docker run command, to specify network-scoped alias for a container, which can be used as an alternative to a hostname. Likewise, the alias can be specified with the --alias flag when connecting to an existing network using docker network connect command.
Consider using docker-compose where you don't have to worry about network and hostnames.
For reference: Container Networking and Docker run reference

A: try change jdbc:mysql://shape-shop-db-container:3306 to jdbc:mysql://host_ip_address:3306


text:
Q: How to select DropDownList items in cascading design on page_load I have 2 dropdownlists on my aspx page, second is filtered by the selection in the first list.
How do I pre-select the two dropdown lists with the data saved in the database for the record when the page loads, it does not work when I bind data on the page on Page_Load.
I am using ObjectDataSource to bind the two dropdownlists.
<asp:DropDownList  ID="ddlStatus" runat="server" Enabled="False"
 onselectedindexchanged="ddlStatus_SelectedIndexChanged"
 AutoPostBack="True" Width="100px" DataSourceID="ObjectDataSource1"
 DataTextField="Status_Desc" DataValueField="Status_Id" />

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
 OldValuesParameterFormatString="original_{0}" SelectMethod="GetStatusAll"
 TypeName="MyDALTableAdapters.StatusTableAdapter"></asp:ObjectDataSource>

<asp:DropDownList ID="ddlSubStatus" runat="server" Enabled="False"
 EnableViewState="False" Width="230px" DataSourceID="ObjectDataSource2"
 DataTextField="Sub_Status_Desc" DataValueField="Sub_Status_Id" />

<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetSubStatusData"
TypeName="MyDALTableAdapters.MyStatusSubGetAllTableAdapter">
<SelectParameters>
 <asp:ControlParameter ControlID="ddlStatus" DefaultValue="-1" Name="StatusId"
 PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
      // How to I select the values stored for this record?
    }
}

protected void ddlStatus_SelectedIndexChanged(object sender, EventArgs e)
{
    ObjectDataSource2.DataBind();
}

A: it should just be a case of setting the SelectedIndex property on each DropDownList control
ddlStatus.SelectedIndex = [your selected index];
ddlSubStatus.SelectedIndex = [your selected index];

A: I ended up binding the second dropdownlist on the DataBind event of the first dropdownlist.


text:
Q: Fast display of waveform in C/C++ I'm interested in implementing an audio editor in C or C++ on Windows and Linux. I can't figure out how to display the waveform quickly enough in its fully zoomed out view. I'm not looking for information about fast frame buffer techniques. This is a question about algorithms and data-structures to efficiently determine what to display.
Say I want to be able to edit a 5 channel, 48 KHz, 24-bit sound that is 2 hours long. That's 5 gigabytes of sample data. I want to be able to zoom out from one-pixel-per-sample all the way until all the sample data is visible at once. I want the application to feel responsive, even on a slow machine, like, for arguments sake, a 1 GHz Atom. When I say responsive, I'd like the GUI updates to generally occur within 1/30th of a second of the user input.
A naive implementation would scan every sample in the whole waveform when deciding what to render for the fully zoomed-out view - it needs to find the max and min sample values for all samples "covered" by each pixel width of the display. I wrote a simple app to test the speed of this approach. I tested with a 1 hour long, mono, 16-bit, 44.1 KHz sample on my 2015 3.5 GHz Xeon. It takes 0.12 seconds. This is hundreds of times too slow.
You can imagine maintaining a cache of zoomed out data, but I can't see how to avoid having to recalculate the entire cache after most inserts or deletes. It feels like there must be a better way.
Here's a diagram showing what I want to achieve:

This is how the display in most currently available audio editors works. Users are likely to expect this behaviour. I tested with Audacity, and it works this way (although it also shows something like the mean of the samples in a lighter colour too). It can handle arbitrary inserts into large sounds, seemingly instantly. I'm not going to read the 75 megabytes of source code to find out how it does it.
EDIT:
Various people have suggested schemes that involve only considering a subset of the samples when showing the zoomed out view. I've come to the conclusion that I don't want to do that because it loses too much useful information. For example, including all the samples is important if you are looking for a glitch in the sound, like a click in a vinyl conversion. In the worst case, if the glitch is only one sample long, I still want a guarantee that it is shown in the fully zoomed out view.

A: After reading Peter Stock's answer, I've come up with the following scheme. I think it will allow display calculation about 500 times faster than the naive scheme and shouldn't add any noticeable cost to inserts or deletes. The memory overhead is less than 1%.
The sound data will be allocated in blocks of 131072 samples, so that inserts and deletes don't require the entire sound to be reallocated and copied. When the sound is first loaded, each block will be completely filled (except probably the last one). Inserts and deletes will lead to a kind of fragmentation. For simplicity, I will arrange for the start of each block to always contain valid sample data, and any gaps will be at the end of the block.
Each block has two look-up tables associated with it, one for max values and one for min. Each item in the look-up tables corresponds to 1024 samples.
The diagram below shows how to calculate the max value for one pixel width of the display. It shows a few blocks relevant to the calculation. It assumes there is no "fragmentation".

After an insert, the situation is slightly more complicated. Two blocks now have invalid regions at their ends. There are entries in the max look-up table that now corresponds to a part-empty region of samples. The value for these entries are found by just taking the max of the samples that are present.

A: When the zoom is at the point where you have multiple samples per pixel it is not worth calculating accurately the mean sample value for each pixel. The user can't align the GUI tooling accurately at that level of zoom so it's no benefit. The user just needs a qualitative view.
I would just select one sample per screen pixel for the window area, skipping over the unnecessary samples.
Something like this completely untested code:
std::vector<double> samples(1024*1024); // [-1.0 < s < 1.0]

int window_x = 1024; // window size in pixels
int window_y = 768; // window size in pixels

// visit every window pixel
for(int x = 0; x < window_x; ++x)
{
    // select relevant sample for the current screen pixel x
    double s = samples[(x * samples.size()) / window_x];

    int y = (window_y / 2) * s; // get y size for sample value

    // draw sample point/line at coordinate (x, f(y))
    gd.draw_line(x, (window_y / 2) - y, x, (window_y / 2) + y);
}

Obviously you also need to account for window scrolling etc...

A: Maybe you could use the mip-mapping technique from graphics, trading using more memory for faster speed?
If you have 32 samples, maintain a cache of zoomed out x2, x4, x8, ... Storing this data will take the same space again as the original data (16 + 8 + 4 + 2 + 1 samples).
A visual guide, with . representing a stored data point (min/max sample value) and _ the samples covered by the previous .:
1st level: ................
2nd level: ._._._._._._._._
3rd level: .___.___.___.___
4th level: ._______._______
5th level: ._______________

Then just query the appropriate level mip-map for the zoom level.
Yes, you would have to re-create the mip-map cache (or part of it) when you insert/remove samples.
But maybe the memory usage makes this not appropriate for you?

Edit
If adding and removing is a frequent operation and makes re-calculation of the cache undesirable (and you want accurate downsampling over intervals rather than just at single points), then you could change the mip-mapping approach to store the data aligned to the local min/max sample points rather than a time-based grid.
Using --------|-------- to denote a local min/max over an interval, here's a pictorial representation:
                             --------|--------
   --------|--------
                   --------|--------
                                     --------|--
------|--------
                                     .
           .                        . .
.     .   . .   .          .       .   .     .
 . ... . .   . . .   . .. . .     .     .   . .
  .     .     .   . . .  .   .   .       . .   .
                   .          . .         .
                               .
--------|--------
           --------|--------
                                  --------|-----
                       --------|--------

Then adding and removing only requires a re-calculation of the immediate local areas at the start and end of the added/removed section.
You'll probably want to index the local min/max values, so you don't need to do a lot of searching. A more complex scheme to implement - maybe not worth it for you?


text:
Q: How to check if all values in an array are equal The following checks if all values in a string array are equal ignoring the case
string [] StringArray = new string[]{"xxx","xXx","Xxx"};
bool ValuesAreEqual = false;
for(int i= 0;i<StringArray.Length;i++)
{
    if(i>=1)
    {
        ValuesAreEqual = StringArray[0].Equals(StringArray[i],StringComparison.InvariantCultureIgnoreCase);
        if(!ValuesAreEqual)
        {
            break;
        }
    }
}

How could I write this using LINQ?

A: string[] StringArray = new string[] {"xxx,xXx,Xxx"};
bool areEqual = StringArray.Select(s => s.ToLower()).Distinct().Count()==1;

bool areEqual = StringArray.GroupBy(s => s.ToLower()).Count() == 1;

just to be original here:)

A:  string[] StringArray = new string[] { "xxx","xXx","Xxx" };

 var item = StringArray.FirstOrDefault();
 bool match = StringArray.Skip(1).All(i => i.ToLower() == item.ToLower());

A: If you want to know if all are equal Enumerable.All is efficient and readable:
string firstItem = StringArray[0];
bool allEqual = StringArray.Skip(1)
  .All(s => string.Equals(firstItem, s, StringComparison.InvariantCultureIgnoreCase));

All breaks also on the first comparison that returns false. Note that i've used the static string.Equals to prevent null-reference exceptions on null objects.
By the way, your loop is incorrect since you start to compare at index 2 instead of 1 here:
if(i > 1 ) // indices are zero based
{
    // ...
}

A: bool areEqual = stringArray.Any()
                  ? stringArray.All(str => str.Equals(stringArray[0], StringComparison.InvariantCultureIgnoreCase))
                  : true;


text:
Q: How many Jedi learned Darth Vader's identity during the Jedi Purge? Ahsoka Tano learned of Darth Vader's identity when she was near him.

Surely other Jedi learned his true name when they were near him, perhaps moments before they died.
Is there any record of other Jedi learning Darth Vader's identity by sensing him when they were nearby?
I am looking for answers from G-canon or T-canon, not lower canon levels.

A: It's worth noting that the original plan, before Anakin had to don the Vader suit to stay alive, appears to have been for there to be no secret and everybody who saw Vader would know just by looking at him that he was Anakin, similar to how Count Dooku was treated. But it seems Palpatine decided that having a mysterious enforcer was better. Maybe he thought that hunting down the Jedi while having a former Jedi as his right hand man would send mixed messages.
Disney Canon

*

*Obi-Wan Kenobi (found out by examining footage of the Jedi Temple massacre, personally made him require the suit)

*Yoda (sensed it, confirmed through footage of the Jedi Temple massacre)

*Ahsoka (sensed Anakin's presence while being told by another that it was Vader)

*Luke Skywalker (was told by Darth Vader himself)

It's not entirely clear how Obi-Wan and Yoda knew that Anakin and the "more machine now than man" Darth Vader were one and the same, but I'll chalk that up to meditating on the Force.
In all of these cases, the individuals chose to keep this information to themselves, likely due to their personal connection to Vader, and to not encourage anti-Jedi sentiment by revealing that a Jedi war hero became a foreboding, ruthless agent of evil.
Legends
In addition to Obi-Wan, Yoda, and Luke, we also have:

*

*Roan Shryne and Olee Starstone

*

*The two were at the Jedi Temple massacre and escaped. Roan was killed by Vader and Olee decided to live a life of anonymity like Obi-Wan and Yoda.

*An'ya Kuro/The Dark Woman

*

*After being killed by Vader, she reappeared as a force ghost and told Vader that he could still become Anakin again. It's not clear how she knew they were one and the same.

Also, the official story from Palpatine is that Anakin Skywalker died during the Jedi Temple massacre, and it seems that the story stuck. The clones from the 501st Legion obviously knew his identity since they marched in with him, but it doesn't seem like they told anyone (and the Battlefront II story campaign shows that they weren't just killed off to keep the secret, but continued fighting for the Empire).


text:
Q: NTLM Authorization using Apache NameBased VirtualHosts over SSL I have a development environment that is fronted via an Apache server. This apache server requires SSL and Centrify-enabled NTLM authentication/authorization with the AD backend, using group access to view the webpages. There will be multiple projects using this environment, so I want to set up Virtual Hosting, which will allow each project to modify their own virtual host with any specific apache modules. The web files will live in /var/www/project1 ; /var/www/project2 ; etc..
I already have the DNS configured properly to point *.domain to the apache server, as well as a wildcard SSL certificate that had the altDNSName field set with *.domain.
The problem is the NTLM authentication piece:
If I point my browser to https://hostname.fqdn/project1/index.html, the NTLM authorization processes exactly as I want. I believe this runs off my default virtual host.
If I instead point my browser to https://project1.domain/index.html, the Apache error logs complain that "User failed NTLM authentication for /index.html. Error: Logon failure.
<VirtualHost ipaddress:443>
    Servername "hostname.fqdn"
    DocumentRoot "/var/www/"

    SSLEngine on
    SSLCertificateFile  /path/to/cert.crt
    SSLCertificateKeyFile   /path/to/cert.key
</VirtualHost>

<VirtualHost ipaddress:443>
    ServerName "project1.domain"
    DocumentRoot "/var/www/project1"

    SSLEngine on
    SSLCertificateFile  /path/to/cert.crt
    SSLCertificateKeyFile   /path/to/cert.key
</VirtualHost>

<Directory "/var/www">
    Options Indexes FollowSymLinks

    SSLRequireSSL

    AllowOverride None

    Order allow,deny
    Allow from all
</Directory>

<Directory "/var/www/project1">
    AuthType CENTRIFYDC

    EnableBasicAuth     false
    EnableKerberosAuth  false
    EnableNtlmAuth      true

    Require group       required_ad_group
</Directory>

I have attempted this with both IE and Firefox, making sure *.domain was in my Local Intranet zone for IE and that the network.automatic-ntlm-auth.trusted-uris and network.negotiate-auth.trusted-uris settings are properly set in Firefox.
I have narrowed it down to the NTLM problem, because if I remove the Centrify directives, the Name-Based Virtual Host works as I would expect. I have tried placing the Directory tag within each Virtual Host, I have also tried using a Location tag, but I have not been able to make any headway.

A: I would start by making 2 solidly separate VirtualHosts that work as expected, and then work back to a hybrid variety by step changes.
I suspect your 2 VirtualHosts resolve to something like this;
<VirtualHost ipaddress:443>
    Servername "hostname.fqdn"
    DocumentRoot "/var/www/"

    SSLEngine on
    SSLCertificateFile  /path/to/cert.crt
    SSLCertificateKeyFile   /path/to/cert.key

<Directory "/var/www">
    Options Indexes FollowSymLinks

    SSLRequireSSL

    AllowOverride None

    Order allow,deny
    Allow from all
</Directory>

<Directory "/var/www/project1">
    AuthType CENTRIFYDC

    EnableBasicAuth     false
    EnableKerberosAuth  false
    EnableNtlmAuth      true

    Require group       required_ad_group
</Directory>

</VirtualHost>

<VirtualHost ipaddress:443>
    ServerName "project1.domain"
    DocumentRoot "/var/www/project1"

    SSLEngine on
    SSLCertificateFile  /path/to/cert.crt
    SSLCertificateKeyFile   /path/to/cert.key

<Directory "/var/www/project1">
    AuthType CENTRIFYDC

    EnableBasicAuth     false
    EnableKerberosAuth  false
    EnableNtlmAuth      true

    Require group       required_ad_group
</Directory>

</VirtualHost>

So I would test something like that, and then move them out of each other sub-directories, and see what directives are conflicting

A: After more investigation, it wasn't a problem with the Apache configuration. It seems as though the browser was passing NTLM and Apache was receiving it, but Centrify isn't properly validating it. Now I need to figure out where the breakdown is here, but that's another thread.


text:
Q: Does stripifier techniques gives performance increase? I have read many times that merging geometry from triangles to triangle strips or triangle fans can increase performance of 3D rendering, because less vertices has to be processed etc... How relevant are all these considerations in the context of use of VBO and indexed rendering?
For example I have a primitive (sphere) that consists of triangles. I have VBO where I store only unique vertices, and I have VBO (bound to GL_ELEMENT_ARRAY_BUFFER) where I store indices to construct primitive from vertices. All rendering is done via glDrawElementsInstanced(). Will I get any performance increase after applying some stripifying technique and rendering my primitive as GL_TRIANGLE_STRIP with primitive restart enabled?
The documentation says that OpenGL pipeline assembles the primitives after all per vertex operations and before rasterization. As I can guess, it means that driver first call vertex (geometry, etc.) shader for all vertices, and only after that starts using index array to get triangles. If it's true, stripifying can slow down the process since additional checks for primitive restart will be applied.
I tried to find some stripifier libraries, but all I've found looks abandoned a couple of years ago. So people suddenly lost interest in this area...
Taking all these considerations into account, there is no need in stripifying. Am I correct or I've missed something important? Does one need to stripify on modern hardware?

A: Generally speaking no, you will not get an advantage from tri-strips. Modern hardware is expecting indexed data, and is optimised for that.
That is not to say that indexes can be randomly accessed - locality is important as data is cached. So arranging the triangles in a strip order might give some improvement.
Performance will also vary depending on how much time is actually spent worrying about triangle setup and vertex processing, and how much is going on actual shading.
So as with everything - profile your performance to see what works for your own case, but I haven't bothered with stripping triangles since the PS2.


text:
Q: Unable to concatenate integer in my "print" statement I am unable to place an integer inside my print statement alongside a string, and concatenate them together.
pounds = input("Please type in your weight in pounds: ")

weight = int(pounds) * 0.45

print("You " + weight)

I thought that I would be able to put these together, why am I unable to?

A: Python doesn't let you concatenate a string with a float. You can solve this using various methods:
Cast the float to string first:
print("You " + str(weight))

Passing weight as a parameter to the print function (Python 3):
print("You", weight)

Using various Python formatting methods:
# Option 1
print("You %s" % weight)
# Option 2 (newer)
print("You {0}".format(weight))
# Option 3, format strings (newest, Python 3.6)
print(f"You {weight}")

A: print("You %s" % weight) or print("You " + str(weight))

A: Since you are trying to concat a string with an integer it's going to throw an error. You need to either cast the integer back into a string, or print it without concatenating the string
You can either
a) use commas in the print function instead of string concat
print("You",weight)

b) recast into string
print("You "+str(weight))

Edit:
Like some of the other answers pointed out, you can also
c) format it into the string.
print("You {}".format(weight))

Hope this helps! =)

A: Another way is to use format strings like print(f"You {weight}")

A: Python is dynamically typed but it is also strongly typed. This means you can concatenate two strs with the + or you can add two numeric values, but you cannot add a str and an int.
Try this if you'd like to print both values:
print("You", weight)

Rather than concatenating the two variables into a single string, it passes them to the print function as separate parameters.


text:
Q: trouble with CouchDB _rewrite handler I am trying to use CouchDB's url rewriting capabilities, but keep getting an error:
{"error":"unknown_error","reason":"function_clause"}
I read http://wiki.apache.org/couchdb/Rewriting_urls and watched http://vimeo.com/20773112 and I believe I am following those guidelines (though obviously something is going wrong somewhere).
I am running CouchDB 1.2.0.
My vhost entry is:
mysite.com => /db/_design/user1505506/_rewrite
My rewrite json is:
   "rewrites": {
       "from": "",
       "to": "/db/_design/user1505506/index.html",
       "method": "GET"
   }

Any information on why this may be happening would be greatly appreciated!

A: As far as I know, rewrites is always an array, so that part should look like this:
"rewrites":
[
    {
       "from": "",
       "to": "/db/_design/user1505506/index.html",
       "method": "GET"
    }
]


text:
Q: i want to read a call log history I want to read call log history in j2me. Is it possible?
If yes, how to do it ?

A: AFAIK Its not possible in j2me.
But i seen this nokia forum. They achieved by using some third party API. You can try with that sample.


text:
Q: Symbolic link on a USB stick automatically adding extra characters upon opening I'm trying to create a relative symbolic link to an html file. Both the symbolic link and the file are to be stored on a USB stick (i want it to open on any computer).
I successfully created the symbolic link by doing this:
me@laptop: /media/administrator/2FE50BF119A67FE4$ ln -s bin/www/index.html "Khan Academy"

Now, when I click on that link, I get the following message in the browser:

Firefox cannot find the file at /bin/www/index.htmlZZZZZZZZZZZZZZZZZZZZZZZZZZ

WHERE in the WORLD did all those z's come from, and how can I get rid of them???????????
I've been trying to get this to work for days, I formatted a bunch of USB drives to nfts (which took forever) just so that I could create the symbolic link on the drive, and now it's not working!!
I suspect it's a bug in firefox on lubuntu. It worked perfectly on another computer running ubuntu.

A: ln -s bin/www/index.html "Khan Academy"

only works if you are positioned at the right place, as it's a relative link. Are you sure you want to do that? (I suspect you want /bin/www/index.html)
Check, after you made the symbolic link, where Khan Academy points to with:
ls -al "Khan Academy"

I'm quite sure Firefox is the same in lubuntu as on the other machine.

A: The mount point for the USB drive could be different on different machines, so you need to use a relative path. Assuming the bin directory is in root of your USB drive (/media/administrator/2FE50BF119A67FE4), the just do ln -s ./bin/www/index.html "Khan Academy" from the root of the USB. However, you still may not see what you expect in your browser depending on how index.html was written.


text:
Q: ¿Cómo hacer que un *ActionEvent* se repita aun sin pulsar el botón? Intento crear un encriptador que desordene las letras introducidas en un
cuadro de texto.
He creado varias ventanas: una para introducir el texto,
otra que lo lee y codifica, y otra para mostrar el texto codificado.
El problema surge en la segunda ventana: debería activar un botón, en un principio desactivado, una vez terminada la codificación, letra por letra, del texto introducido, para lo que usa un bucle while. Pero el botón nunca se activa... me gustaría saber si es porque el bucle while no se ejecuta, ya que es una instancia de otra clase, o la razón concreta de porque falla el código...
Código:
package encriptador;

import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;

class Encriptador extends JPanel {

    static final long serialVersionUID = 1L;
    static boolean terminado;
    static Image fondo;
    static JButton encriptar;
    static JLabel texto = new JLabel();
    static JTextField cuadro = new JTextField(50);
    static String introducido;
    static String paso_intermedio;
    static String paso_intermedio2;
    static String encriptado;
    static String encriptado2;
    static boolean empezar;
    static int recopilador;
    static int lector = 1;
    static boolean scaneado;

    /**
     * Construct
     *
     */
    public Encriptador() {

        File direccion = new File( "wp-1482964256190.jpeg" );
        setLayout( new GridLayout( 1, 2 ));
        try {
            fondo = ImageIO.read( direccion );
            encriptar = new JButton( "desencriptar" );

        } catch ( IOException e ) {
            System.err.println( e.toString( ));
        }

        this.setLayout( new GridLayout( 2, 1 ));
        JPanel pantalla_derecha_12 = new JPanel();
        JPanel pantalla_derecha_13 = new JPanel();
        ActionListener desencriptar2 = new Encriptar();
        pantalla_derecha_12.setLayout( new FlowLayout( ));
        pantalla_derecha_13.setLayout( new FlowLayout( ));
        encriptar.addActionListener(desencriptar2);
        pantalla_derecha_12.add(texto);
        pantalla_derecha_12.add(encriptar);
        pantalla_derecha_12.add(cuadro);
        pantalla_derecha_12.setOpaque( false );
        pantalla_derecha_13.setOpaque( false );
        add(pantalla_derecha_13);
        add(pantalla_derecha_12);
    }

    //la segunda ventana donde surge el problema

    class Procesando extends JFrame {
        private static final long serialVersionUID = 1L;

        /**
         * Construct
         *
         */
        public Procesando() {
            super();
            setBounds(
                getWidth(),
                getHeight(),
                100,
                200
            );
            PantallaProcesador PP = new PantallaProcesador();
            add( PP );
        }

        class PantallaProcesador extends JPanel {

            private static final long serialVersionUID = 1L;
            JButton continuar = new JButton( "Continuar" );

            /**
             * Construct
             *
             */
            public PantallaProcesador() {
                super();
                setLayout( new GridLayout(2, 1));
                JPanel x1 = new JPanel();
                JPanel x2 = new JPanel();
                x1.setLayout( new FlowLayout( ));
                x2.setLayout( new FlowLayout( ));
                JLabel xxx = new JLabel("espere por favor");
                x1.add(xxx);
                x2.add(continuar);
                add(x1);
                add(x2);
                ActionListener t = new Traductor();
                continuar.addActionListener(t);
                continuar.setEnabled(scaneado);
            }

            class Procesandos {

                /**
                 * Construct
                 *
                 */
                public Procesandos() {
                    while ( scaneado = false ) {
                        System.out.println( "n" );

                        introducido = cuadro.getText();
                        recopilador = introducido.length();

                        while ( lector < recopilador ) {
                            lector++;
                            System.out.println( "Número de veces" );

                            paso_intermedio = introducido.substring( lector, lector + 1 );
                            if ( "q".equals( paso_intermedio )) {
                                if ( empezar = false ) {
                                    encriptado = ( "m" );
                                    paso_intermedio2 = encriptado;
                                    encriptado2 = paso_intermedio2;
                                    empezar = true;

                                } else {
                                    encriptado = (paso_intermedio2 + "m");
                                    paso_intermedio2 = encriptado;
                                    encriptado2 = paso_intermedio2;
                                }
                            }

                            //aqui simplemente repido el mismo codigo de arriba pero
                            //con todas las letras
                        }
                        //una vez salido del bucle while, scaneado es igual a true,
                        //por lo que el boton deberia activarse

                       scaneado = true;
                    }
                }

            } //class
        }

        class Traductor implements ActionListener {

            @Override
            public void actionPerformed( ActionEvent arg0 ) {
                JOptionPane.showMessageDialog( null, encriptado2 );
            }

        } //class
    } //class
} //class

A: Como  no sabes cuánto va a tardar el procesado de la cadena de texto que introduce el usuario al codificarse, te sugiero que crees una hebra que se ejecute de forma independiente.
Esto lo puedes conseguir haciendo uso de la interfaz Runnable. Utiliza esta hebra para realizar todo el procesado de datos (tu bucle while o lo que consideres oportuno) y, una vez terminada la ejecución de esta hebra, activas el botón que comentas.
Te recomiendo que en vez de un boolean, definas el botón como public static para poder acceder a él desde la hebra y activarlo cuando esta acabe. Esta sería una posible solución:
public class Procesar implements Runnable {
    @Override
    public void run() {
        // código que procesa el dato que el usuario ha introducido aquí
        Main.boton.setEnabled(true);
    }
}

(Ver Javadoc de la interfaz Runnable aquí).
Una vez que hayas hecho esto, simplemente tendrás que crear la hebra y pasarle una instancia de la clase que implementa la interfaz Runnable:
public class Main {

    public static JButton boton;

    public static void main(String args[]) {
        boton = new JButton("Púlsame");
        boton.setEnabled(false);
        // ...
        Procesar procesar = new Procesar();
        Thread t = new Thread(procesar);
        t.start();
    }
}

Espero que esto te ayude con tu problema. No he podido adaptar tu código exacto ya que hay partes que no he llegado a comprender del todo. Pero si necesitas más información, pregúntame.


text:
Q: How to return only few types from Class using spring boot? I have a class that has users information including the password field. When the user login, it will return everything from class including password. How do I not return everything from class except the password or any important data that only remain in the database.
I tried using the Map this also returns the way I want but I was hoping if there is something easier or quicker then Map.
There are few answers suggesting using JsonIgnore and transient. If I use these two methods, I am not able to login. Because I need password back for login.
My POJO Class
@Entity
public class Users {

@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

@Column(name = "firstname")
private String firstName;

@Column(name = "lastname")
private String lastName;

@Id
@Column(name = "username")
private String username;

@Column(name = "email")
private String email;

@Column(name = "role")
private String role;

@Column(name = "password")
private String password;

Repo Class
  public interface UsersRepository extends CrudRepository<Users,
  String> {

public Users findByUsername(String username);
}

this is Rest Api
@GetMapping("/users/{username}")
public Map<String, Object> usersCheck(@PathVariable String
 username) {
    Map<String, Object> addUser = new HashMap<>();
    Users user = userRepo.findByUsername(username);
    addUser.put("email", user.getEmail());
    addUser.put("firstName",user.getFirstName());
 "
 "
    return addUser;
}

Is there a better way then Map. Any suggestion can be helpful.

A: Actually there is a way in jpa queries To return only specific field so you can use directly while fetching the results.
But in case if you don't want to disturb the findByUsername method than just create an object of User class and set only desired fields.
The approach you are using currently is also feasible solution.

A: The simplest way is to control the serialization to JSON via the annotations provided by the default JSON library which is Jackson.
https://fasterxml.github.io/jackson-annotations/javadoc/2.5/com/fasterxml/jackson/annotation/JsonIgnore.html
@JsonIgnore
@Column(name = "password")
private String password;

You can also do this via a Jackson mixin to avoid 'polluting' the entity with JSON processing instructions.

A: So, there are 2 different ways you can approach this problem.

*

*Make password field transient in your Entity class.

This way, when you fetch the Users object, password field would be blank.
Disadvantage : Making password transient would result in the fact that you would not be able to get password via you entity anywhere in your application.

*Use @JsonIgnore(from jackson library) over password field. This way, when you return the object of Users object, password field would be ignored.

Disadvantage : This would again means that if ever you want to take password field as input or return password field through out the application you would not be able to do so.
Also, it is not recommended that you return object of your POJO class ever as response.
So, you can go with either one keeping in mind the disadvantages each approach has.

A: Apart from already mentioned reply, few other ways are also there such as JsonIgnoreProperties, JsonIgnoreType, JsonFilter. I prefer JsonIgnore for suppressing the field in the output.
Here is a link to nice example
https://www.baeldung.com/jackson-ignore-properties-on-serialization
Also, you can always create a separate POJO class to return desire values.

A: The typical best practice here is to treat the password as a subresource: logically not a direct part of the User resource, but related to it (e.g., it might have its own URL at /users/{id}/password). Spring Data REST handles this automatically when you have a JPA @OneToOne relationship, but there's no problem with doing it yourself.
This example shows why it is not a good idea to use your @Entity classes directly as the JSON API representations, because you may want to have differences internally (including making changes in the future without disturbing clients). Instead, use a data transfer object (DTO) that serves as a "JSON copy" of your entity. Tools like MapStruct make it very simple to copy properties between User and UserDto.
(Finally, if you do find yourself needing to return a bare Map for some odd reason, which does happen, it's typically best to use Map.of("key", value) for simplicity.)

A: Another solution could be create a method in repository with @Query annotation like:
@Query("SELECT NEW MyEntity(M.firstName, M.lastName, M.email) FROM MyEntity M WHERE M.username = ?1")
public MyEntity getByUsername(String username);

Then in your MyEntity class create a constructor that matching with query's constructor.
By last, in your controller:
Instead of:
public Map<String, Object> usersCheck(@PathVariable String
 username)

Do:
public MyEntity usersCheck(@PathVariable String
 username){
   return userRepo.getByUsername(username);
}

Return directly cause spring have a naturally integration with Jackson serialization so by default your response will be a json object
I think this solution is a good alternative in your case.

A: If you want to exclude password from the response then annotate the password field with @JsonIgnore.
If you want to exclude more than one field in the User entity then create an UserDto class and add the required field in that UserDto class.
Use ModelMapper to map the User entity to UserDto class. Finally return this UserDto class as a response object.
Example:
  User user = new User();

  UserDto userDto = new ModelMapper.map(user, UserDto.class);

This will include the fields in UserDto only


text:
Q: apply two callbacks for single dynamic matrix Display
G3.vardisp= uicontrol('Style','edit',...
           'Position', [520 280 30 30],...
           'String','0');

Slider
G3.slide = uicontrol('style','slide',...
                 'unit','pix',...
                 'position',[400 280 120 30],...
                 'min',-10,'max',10,'val',1,...
                 'sliderstep',[1/20 1/10],...
                 'callback',{@sl_call3,G3});

callback for Slider
function [] = sl_call3(varargin)
 [l,G3] = varargin{[1,3]};  % calling handle and data structure.
 set(G3.vardisp,'String',get(l,'value'))
 vbrilho=get(l,'value')
 subplot('Position',[.35, 0.575, 0.375, 0.375])
 x4.head_mod=(vcontraste*x4.head)+(vbrilho*10);
 imshow(x4.head_mod)
end

button
 filtro.medfiltbtn1 = uicontrol('Parent',hsp,...
                'Style', 'pushbutton',...
                'String', 'medfilt2_1',...
                'Position',[0 35 80 30],...
                'callback',{@teste,1});

callback for button
function []= teste(varargin)

[t1] = varargin{[3]};
while t1==1
    subplot('Position',[.35, 0.575, 0.375, 0.375])
    x4.head_modf=imnoise(x4.head_mod,'gaussian',0,0.01);
    t1=0;
    imshow(x4.head_modf)
end

When the code is run the imnoise can be applied over the x4.head_mod, but I can't apply the equation (vcontraste*x4.head)+(vbrilho*10) over imnoise. I want somehow to nest both results.


text:
Q: ProcessBuilder java Unix Commands I have code like below
ProcessBuilder pb = new ProcessBuilder("bash", "-c",
        "  awk -f awkfile " + " file2 " + file1);

p = pb.start();
p.waitFor();
p.destroy();

pb = new ProcessBuilder("bash", "-c",
        "  awk -f awkfile " + " file3 " + outFile);
p = pb.start();
p.waitFor();
p.destroy();

pb = new ProcessBuilder("bash", "-c",
        "  awk -f awkfile " + " file4 " + outFile);
p = pb.start();
p.waitFor();

p.destroy();

awkfile has the contents
 FILENAME==ARGV[1] {vals[$1FS$2FS$3] = ",Y"; next}
      !($1FS$2FS$3 in vals) {vals[$1FS$2FS$3] = ",N"}
       {$(NF+1) = vals[$1FS$2FS$3]; print > "outFile"}

The first ProcessBuilder runs fine.The outFile has complete output (I commented out the remaining code and tested). When I include the second ProcessBuilder or third processbuilder then the outFile is incomplete.
Is this a space issue or a memory issue.
I do not how to find the total space allocated to my home directory.
The du command results are below
   du -s /home/xxxxx
    19172   /home/xxxxx

the df command results are below
 df -k /home/xxxxx
   Filesystem                1K-blocks   Used Available Use% Mounted on
   /dev/mapper/rootvg-homelv   2064208 193068   1766296  10% /home

Is the available above 1766296 for the entire /home directory or just for my home directory /home/xxxxx
Can you please guide me as to how to get past this issue.

A: Unless quotas are enabled, you can go upto the max of what is available on your filesystem.
du -s reports the disk usage for the entire directory. I prefer the "du -sh /home/xxxx" which should report it in Mbytes, Kbytes etc.,
df -k (I prefer df -h) says how much free space is available on the entire disk (or volume) on which the filesystem is present. Note that this may include the home directories of all users.
If quotas are enabled, then you can use quota -v to see what your quotas are on each filesystem.
Looks like what you are trying to do is:

*

*take the 3 fields from the first file

*print out the lines from the second file with a ",Y" ending if it (the 3 fields in the second file)  is also found in the first file.
or

*print out the lines from the second file with a ",N" ending if it (the 3 fields in the second file)  is not present in the first file.

I wonder if you are using the same name for the output file as your input file. You do not say what the value of the outFile variable is in your pb. If you are trying to read and write from the same file, then the output will indeed be indeterminable.
If you are trying to get all common lines from files file1, file2, file3, file4, then i would use something like:
ProcessBuilder pb = new ProcessBuilder("bash", "-c",
    "  awk -f awkfile " + " file2 " + file1);

p = pb.start();
p.waitFor();
p.destroy();

// rename the outFile to something different. eg. outfile2.
File of= new File("outFile");
File of2= new File("outFile2");
of.renameTo(of2);

 pb = new ProcessBuilder("bash", "-c",
    "  awk -f awkfile " + " file3 " + "outFile2");
 p = pb.start();
 p.waitFor();
 p.destroy();

 // rename the outFile to something different. eg. outfile2. again.
of= new File("outFile");
of2= new File("outFile2");
of.renameTo(of2);

pb = new ProcessBuilder("bash", "-c",
    "  awk -f awkfile " + " file4 " + "outFile2");
p = pb.start();
p.waitFor();
p.destroy();