text:
Q: How to remove _id from MongoDB results? I am inserting json file into Mongodb(with Scala/Play framework) and the same getting/downloading it into my view page for some other requirement, but this time it is coming with one "_id" parameter in the json file.
But I need only my actual json file only that is not having any any "_id" parameter. I have read the Mongodb tutorial, that by default storing it with one _id for any collection document.
Please let me know that how can I get or is there any chance to get my actual json file without any _id in MongoDB.
this is the json result which is storing in database(I don't need that "_id" parameter)
{
        "testjson": [{
        "key01": "value1",
        "key02": "value02",
        "key03": "value03"
    }],
  "_id": 1
 }

A: You can use this query in the shell:
db.testtable.find({},{"_id" : false})

Here we are telling mongoDB not to return _id from the collection.
You can also use 0 instead of false, like this:
db.testtable.find({},{"_id" : 0})

for scala you need to convert it in as per the driver syntax.

A: If you have a look at ReactiveMongo dev guide and to its API, you can see it support projection in a similar way as the MongoDB shell.
Then you can understand that you can do
collection.find(selector = BSONDocument(), projection = BSONDocument("_id" -> 0))

Or, as you are using JSON serialization:
collection.find(selector = Json.obj(), projection = Json.obj("_id" -> 0))


text:
Q: How to make slideToggle element toggle back by clicking anywhere but the toggled element I've got an issue where I'd like to make an element that is brought onto the screen using jQuery '.css' go back to where it was originally when you click anywhere outside of the element itself.
Basically a similar thing to lightbox, where you can click anywhere on the black overlay to close the lightboxed image.
This is the code I have so far which slides my element out from the top:
$( ".menu-toggle" ).on( "click", function() {
  $( '.slider' ).css( "margin-top", "0px" );
});

As ever, any help is appreciated! Thank you. =0)

A: You can bind a click() event on the document and check if the target is not '.slider'.
$(document).on('click',function(e){
    if(!$('.slider').is(e.target)){
        $( '.slider' ).css( "margin-top", "-150px" );//hide on top
    }
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: MySQL lag on get (SELECT) My problem is that there is update troo at the get level so the server starts to lag 70% tps loss I do not know how to optimize its?
public static int getCoins(Player player) {
    try {
        PreparedStatement q = Main.sql.prepareStatement("SELECT Coins FROM Players WHERE Players_UUID = ?");
        q.setString(1, player.getUniqueId().toString());

        int coins= 0;
        ResultSet rs = q.executeQuery();

        while(rs.next()){
            balance = rs.getInt("Coins");
        }

        q.close();

        return coins;

    } catch (SQLException e) {
        e.printStackTrace();
    }

    return 0;
}

A: You don't need to do a sql query every time to get coins, just create a int or hashmap field with the data and check every X time if data has changed.
if it has changed send update to mysql server and mark that data has saved like two hashmap/int fields.
hashmap1 = database data
hashmap2 = server data
if hashmap1 and hashmap2 are same don't update.
Do the update in async function like schedulerAsync or thread.
Here a similar example:
package test;

import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import com.mysql.jdbc.Connection;

public class Event extends JavaPlugin implements Listener {

    // Mysql update data
    public static ConcurrentHashMap<UUID, Integer> player_zombiekills = new ConcurrentHashMap<UUID, Integer>();

    // Mysql connection data
    public static Connection connection;
    private String host = "localhost";
    private String database = "DB";
    private String username = "user";
    private String password = "123";
    private int port = 3306;

    //Kill zombie event
    @EventHandler
    public void zombieDeath(EntityDeathEvent eve) {
        if (!(eve.getEntity() instanceof Zombie)) return; // Stop if death is not zombie
        if (!(eve.getEntity().getKiller() instanceof Player)) return; // Stop if killer is not player
        UUID uid = eve.getEntity().getKiller().getUniqueId(); // Save player uuid
        if (player_zombiekills.contains(uid)) player_zombiekills.put(uid, 0); // Set kills 0 if not exist in hashmap
        player_zombiekills.put(uid, player_zombiekills.get(uid) + 1); // plus 1 kills value
    }

    //On enable connection
    public void onEnable() {
        try {
            if (connection != null && !connection.isClosed()) return;
            Class.forName("com.mysql.jdbc.Driver");
            connection = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
            if (!connection.isClosed()) System.out.println("[MySQL] " + "Connected to '" + database + "'");
        } catch (Exception e) {
            System.err.println("[MySQL] " + e.getMessage());
        }

        new BukkitRunnable() {
            public void run() {
                // for updates
                for (Entry<UUID, Integer> ent : player_zombiekills.entrySet()) {
                    try {
                        // send update
                        connection.createStatement().executeUpdate("UPDATE `tablename` SET `zombiekills`=`zombiekills`+" + ent.getValue() + " WHERE `uuid`='" + ent.getKey().toString() + "'");
                        // Sucess remove entry from hashmap to reset kills
                        player_zombiekills.remove(ent.getKey());
                    } catch (SQLException e) { // If error
                        System.err.println("[MySQL] " + e.getMessage()); // Print error in console
                    }
                }
            }
        }.runTaskTimerAsynchronously(this, 20, 20 * 60 * 10); // Run async loop every 10 minutes
    }
}

A: I do not see how to do because if you change the data in BDD it does not change on the server so if I do not get every 1 second its will not work so I have optimized with an async but how without return To get the coins...


text:
Q: Problema al navegar por elementos dinamicos en jquery tengo varios input a modo de formulario con su respectivo label, tengo una funcion que al hacer foco en el input o perderlo, se añade una clase al label para que tome una pequeña animacion y cambie de tamaño. Funciona todo correcto, excepto con los input que se generan de forma dinamica con ajax.
Las funciones listado_comunas y listado_regiones, generan un select segun una consulta a una base de datos, por lo que es con estos elementos dinamicos que no logro ejecutar la funcion.
Adjunto el formulario como esta implementado y la funcion en jquery.

        <a href="<?php echo $raiz;?>"><img src="<?php echo $raiz;?>imagenes/logo-blanco.png" alt="">

CREAR CUENTA

                NOMBRE
                <input type="text" class="form-control form-control-log" name="nombre" id="nombre" style="text-transform:uppercase;" onkeyup="javascript:this.value=this.value.toUpperCase();">

                APELLIDO
                <input type="text" class="form-control form-control-log" name="apellido" id="apellido" style="text-transform:uppercase;" onkeyup="javascript:this.value=this.value.toUpperCase();">

                RUT
                <input type="text" class="form-control form-control-log" name="rut" id="rut" style="text-transform:uppercase;" onkeyup="javascript:this.value=this.value.toUpperCase();">

                TÉLEFONO
                <input type="text" class="form-control form-control-log" name="telefono" id="telefono" style="text-transform:uppercase;" onkeyup="javascript:this.value=this.value.toUpperCase();">

                DIRECCIÓN
                <input type="text" class="form-control form-control-log" name="direccion" id="direccion" style="text-transform:uppercase;" onkeyup="javascript:this.value=this.value.toUpperCase();">

                APELLIDO

                CORREO
                <input type="email" class="form-control form-control-log" name="correo" id="correo" style="text-transform:lowercase;" onkeyup="javascript:this.value=this.value.toLowerCase();">

                CONTRASEÑA
                <input type="password" class="form-control form-control-log" name="registrar_clave" id="registrar_clave">

                REPETIR CONTRASEÑA
                <input type="password" class="form-control form-control-log" name="repetir_clave" id="repetir_clave">

                <button class="btn btn-success w-100 mt-2" id="registrar-usuario">Registrar</button>

Funcion en Jquery
$(document).ready(function () {
        listado_regiones();
        listado_comunas();

        $(".formularios-sesion").find("input, textarea, select").on("blur focus", function (e) {
            var $this = $(this), label = $this.prev("label");
            if (e.type === "focus") {
                label.addClass("active");
            }else if (e.type === "blur") {
                if($this.val() === "") {
                    label.removeClass("active");
                }else{
                    label.addClass("active");
                }
            }
        });
    });

A: Lo que puede estar sucediendo es que la respuesta de estos elementos dinámicos se tarde un poco y al terminar de ser añadidos al DOM, el .find ya ha sido ejecutado, por lo cual, cuando se ejecutó el find estos select no existían en el DOM.
mueve la ejecución del find al done del ajax para que tengas certeza de que existen estos elementos en el DOM
var jqxhr = $.ajax( "example.php" )
  .done(function() {
    $(".formularios-sesion").find("input, textarea, select").on("blur focus", function (e) {
            var $this = $(this), label = $this.prev("label");
            if (e.type === "focus") {
                label.addClass("active");
            }else if (e.type === "blur") {
                if($this.val() === "") {
                    label.removeClass("active");
                }else{
                    label.addClass("active");
                }
            }
        });
  })
  .fail(function() {
    alert( "error" );
  })
  .always(function() {
    alert( "complete" );
  });


text:
Q: Difference Between Page Table and Page Directory I have been hearing the term address space often in microprocessors and microcontrollers Paradigm.  I understand that an address is used to refer to a particular block of memory in the physical memory(Primary).
If I'm right and address space is the super set of all such addresses. Right?
By using virtual memory/paging we are extending the address space using secondary storage.
In this paradigm what exactly is a page table, page table entry and page directory?  I understand that first p.memory is segmented logically and these segments are divided into pages.  So what exactly is a page table? A table containing Pages? And what is a page directory a super table of Page Tables?

A: In the x86 architecture, page directories and page tables together provide the mapping between virtual addresses (memory addresses used by applications) and physical addresses (actual locations in the physical memory hardware).
A page is simply a contiguous chunk of memory. x86 (32-bit) supports 3 sizes of pages: 4MB, 2MB, and 4KB, with the latter being the most commonly used in mainstream operating systems. A page table is an array of 1024 * 32-bit entries (conveniently fitting into a single 4KB page). Each entry points to the physical address of a page. Because a single page table is not able to represent the entire address space on its own (1024 entries * 4KB = only 22-bits of address space), we require a second level page table: a page directory. A page directory also consists of 1024 * 32-bit entries (again fitting into a single page), each pointing to a page table. We can see that now 1024 * 1024 * 4KB = 32-bits and with this 3-level structure we are able to map the entire 4GB virtual address space.
When the CPU is asked to access a virtual address, it uses the 10 highest order bits (31:22) to index into the page directory table (the base address of which is stored in a special register). The next 10 highest order bits (21:12) are used to index into the page table pointed to by the page directory entry. The lowest 12 order bits (11:0) are finally used to index a byte in the page pointed to by the page table entry.
In other systems there may be more or fewer levels of page table required, depending on the size of the virtual address space and the page sizes supported. For example, x86 with 4MB pages only needs a single page directory. In 64-bit mode with 4KB pages, a 4-level system is used: a page mapping level 4 table contains entries that point to one of many page directories.
The Intel Architectures Developer's Manual has much more information about the topic, particularly in chapters 3 and 4.


text:
Q: EXC_BAD_ACCESS within controllerDidChangeContent: at line tableView.endUpdates() This is my all NSFetchedResultsControllerDelegate:
//MARK: - NSFetchedResultsControllerDelegate

func controllerWillChangeContent(controller: NSFetchedResultsController) {
    self.tableView.beginUpdates()
}

func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {

    switch type {
    case .Insert:
        if let newIndexPath = newIndexPath {
            tableView.insertRowsAtIndexPaths([reversedIndexPathForIndexPath(newIndexPath)], withRowAnimation: .Fade)
        }
    case .Delete:
        if let indexPath = indexPath {
            tableView.deleteRowsAtIndexPaths([reversedIndexPathForIndexPath(indexPath)], withRowAnimation: .Fade)
        }
    case .Update:
        if let indexPath = indexPath {
            if let cell = tableView.cellForRowAtIndexPath(reversedIndexPathForIndexPath(indexPath)) as? WLCommentTableViewCell {
                updateCell(cell, withIndexPath: indexPath)
            }
        }
    case .Move:
        if let indexPath = indexPath, let newIndexPath = newIndexPath {
            tableView.deleteRowsAtIndexPaths([reversedIndexPathForIndexPath(indexPath)], withRowAnimation: .Fade)
            tableView.insertRowsAtIndexPaths([reversedIndexPathForIndexPath(newIndexPath)], withRowAnimation: .Fade)
        }
    }
}

func controllerDidChangeContent(controller: NSFetchedResultsController) {

    tableView.endUpdates() //Thread 1: EXC_BAD_ACCESS (code=1, address=0x20)
    updateView()

    if shouldScrollTableToBottom {
        scrollTableViewToBottom()
    }
}

Sometimes my app crashes at line with tableView.endUpdates(). Why?

A: The line
    tableView.endUpdates() //Thread 1: EXC_BAD_ACCESS (code=1, address=0x20)

should go inside the NSFetchresultsController delegate method that informs you of all the changes have finished:

controllerDidChangeContent: Notifies the receiver that the fetched results controller has completed processing of one or more changes due
  to an add, remove, move, or update.

func controllerDidChangeContent(controller: NSFetchedResultsController) {
     updateView()

    if shouldScrollTableToBottom {
        scrollTableViewToBottom()
    }
    tableView.endUpdates() // Mark here no more updates to the tableview
}

endUpdates: Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view.
  You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, UITableView animates the operations simultaneously. Invocations of beginUpdates and endUpdates can be nested. If you do not make the insertion, deletion, and selection calls inside this block, table attributes such as row count can become invalid.


text:
Q: Entity Framework Code First Relationship I am trying to figure out how to make this work in EF. I have two entities Employee and User. I need to make it so the User has an optional mapping to the Employee. If there is a mapping, then it would be 1:1.
Basically this system can be accessed by employees and also by outside vendors, but I want one table to manage logons: Users.
How do I define this realtionship in EF with fluid configurations?

A: You just need to set simple fluent configuration:
modelBuilder.Entity<User>()
            .HasOptional(u => u.Employee)
            .WithRequired(e => e.User);

or in reverse order:
modelBuilder.Entity<Employee>()
            .HasRequired(e => e.User)
            .WithOptional(u => u.Employee);

EF will use Employess's PK as FK to user - that is mandatory requirement for EF to correctly use one-to-one relation. In case of Data annotation it is enough to mark Employee's PK with ForeignKey attribute pairing it with User navigation property:
public class Employee {
    [Key, ForeignKey("User")]
    public int Id { get; set; }

    public virtual User User { get; set; }
}

A: public class User
{
    ...
    public virtual Employee Employee { get; set; }
}

This tutorial may help.


text:
Q: Por que no me funciona este RecyclerView? pues, estoy como 3 horas intentando que funcione, buscando el error, pero no lo capto... me pueden ayudar es la primera vez que uso el RecyclerView
public class HomeActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private RecyclerView.Adapter mAdapter;
    private RecyclerView.LayoutManager layoutManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        ArrayList<ItemCardViewRV> itemCardViewRVS = new ArrayList<>();
        itemCardViewRVS.add(new ItemCardViewRV("nose", "desc", 55, 5));
        itemCardViewRVS.add(new ItemCardViewRV("nose 2", "desc", 85, 5));

        recyclerView = findViewById(R.id.recyclerview_cards);
        recyclerView.setHasFixedSize(true);
        layoutManager = new LinearLayoutManager(this);
        mAdapter = new AdapterRecycleViewCardCake(itemCardViewRVS);

        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(mAdapter);
    }
}

el AdapterRecycleViewCardCake
public class AdapterRecycleViewCardCake extends RecyclerView.Adapter<AdapterRecycleViewCardCake.ExampleHolderCardCake> {

    private ArrayList<ItemCardViewRV> itemCardViewRVS_list;

    public static class ExampleHolderCardCake extends RecyclerView.ViewHolder{

        public TextView mTextView_title;
        public TextView mTextView_desc;

        public TextView mTextView_price;

        public ExampleHolderCardCake(@NonNull View itemView) {
            super(itemView);

            mTextView_title = itemView.findViewById(R.id.textView_card_name);
            mTextView_desc = itemView.findViewById(R.id.textView_card_desc);
            mTextView_price = itemView.findViewById(R.id.textView_card_price);
        }
    }

    public AdapterRecycleViewCardCake(ArrayList<ItemCardViewRV> itemCardViewRVS_v){
        itemCardViewRVS_list = itemCardViewRVS_v;
    }

    @NonNull
    @Override
    public ExampleHolderCardCake onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_cardview_cakes, parent, false);

        ExampleHolderCardCake everReturn = new ExampleHolderCardCake(v);
        return everReturn;
    }

    @Override
    public void onBindViewHolder(@NonNull ExampleHolderCardCake holder, int position) {
        ItemCardViewRV currentItem = itemCardViewRVS_list.get(position);

        holder.mTextView_title.setText(currentItem.getTextView_title());
        holder.mTextView_desc.setText(currentItem.getTextView_desc());
        holder.mTextView_price.setText(currentItem.getPrice());
    }

    @Override
    public int getItemCount() {
        return itemCardViewRVS_list.size();
    }
}

y el ItemCardViewRV
public class ItemCardViewRV {

    private String textView_title;
    private String textView_desc;
    private int price;
    private int starts;

    public  ItemCardViewRV(String nameCake, String description, int price_cost, int start_set){
        textView_title = nameCake;
        textView_desc = description;
        price = price_cost;
        starts = start_set;
    }

    public String getTextView_title() {
        return textView_title;
    }

    public String getTextView_desc() {
        return textView_desc;
    }

    public int getPrice() {
        return price;
    }

    public int getStarts() {
        return starts;
    }
}

Bueno, no se que puedo hacer, asique agradeceria su ayuda. gracias.
He estado revisando, pero aún todavia siguo, pero pienso que tal vez sea por falta de variable o un error de id, pero nada, es como si estuviera perfectamente bien...

android:layout_margin="3dp"
>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    >

    <LinearLayout
        android:layout_width="110dp"
        android:layout_height="match_parent"
        >

        <ImageView
            android:layout_width="100dp"
            android:layout_height="150dp"
            android:src="@drawable/cake_001"
            />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical"
        >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:orientation="horizontal"

            android:layout_gravity="top|end"
            android:background="@drawable/background_card_price"
            android:paddingStart="6dp"
            android:paddingEnd="6dp"
            android:paddingTop="3dp"
            android:paddingBottom="3dp"
            >
            <TextView
                android:id="@+id/textView_card_price"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="$0002"
                android:textColor="#fff"

                />
        </LinearLayout>

        <TextView
            android:id="@+id/textView_card_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TITLE"
            android:textStyle="bold"
            android:textSize="13sp"
            android:textColor="@color/color_card_title"
            />

        <TextView
            android:id="@+id/textView_card_desc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Description of this"
            android:textSize="13sp"
            />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center|end"
            >

            <LinearLayout
                android:id="@+id/textView_card_price_1"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@drawable/ic_star_black_24dp"
                android:orientation="vertical"

                />
            <LinearLayout
                android:id="@+id/textView_card_price_2"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@drawable/ic_star_black_24dp"
                android:orientation="vertical"
                />
            <LinearLayout
                android:id="@+id/textView_card_price_3"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@drawable/ic_star_black_24dp"
                android:orientation="vertical"
                />
            <LinearLayout
                android:id="@+id/textView_card_price_4"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@drawable/ic_star_black_24dp"
                android:orientation="vertical"
                />
            <LinearLayout
                android:id="@+id/textView_card_price_5"
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@drawable/ic_star_half_black_24dp"
                android:orientation="vertical"
                />

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ORDENAR"
                android:textColor="#fff"
                android:background="@drawable/btn_ordenar"
                android:layout_marginStart="6dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="6dp"
                android:layout_marginEnd="6dp"
                />

        </LinearLayout>
    </LinearLayout>
</LinearLayout>

Diganme, que creen que pueda ser el problema? es urgente porfavor gracias.
El xml principal:
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".ScrollingActivity"
    tools:showIn="@layout/activity_home">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <SearchView
            android:layout_width="match_parent"
            android:layout_margin="16dp"
            android:layout_height="50dp"
            android:background="@drawable/background_search"

            />

        <!--androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycleview_cards_cakes"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_margin="16dp"
            /-->

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerview_cards"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

    </LinearLayout>


text:
Q: Is there any advantage to a particular boot order when using UEFI? Just built a system with motherboard that supports the UEFI. I didn't realise what it was at he time and was interested to know why it appears to be attached to a 1TB HDD. I have in my system room for extra storage and not on the SSD where the OS is.
The BIOS lists in the boot order:

*

*the UEFI HDD

*the optical drive

*a 4TB drive

*the SSD
and finally a repeat of the 1TB listed at the top with the UEFI,
(this repeat listing does not carry the UEFI tag on it).

The mainboard is a Gigabyte GA-H97-Gaming 3.
Is there any advantage in rearranging this configuration? E.g., is there any choice on where the UEFI is and does it matter?

A: EFIs have built-in boot managers. Their user interfaces vary greatly, from completely useless to moderately useful, but the key point is that each entry in the built-in boot manager tells the firmware how to launch one program (normally a boot loader). These boot manager entries are stored in NVRAM. Ordinarily, when you install an OS, it creates an EFI boot manager entry that points to the OS's own boot loader. Thus, with an OS installed, you should see an entry for that OS in the boot manager list.
Many EFIs also automatically generate entries for things like network-boot options, the firmware setup utility, a built-in EFI shell, BIOS/CSM/legacy-mode boot of disks, and fallback boot loaders on hard disks and removable disks. This last item deserves some elaboration: If no OS has created an entry, EFI can boot from a standard filename: EFI/BOOT/bootx64.efi (assuming an x86-64/AMD64/x64 CPU). Originally, this fallback filename was intended to enable booting from removable media, so that OS installers and emergency tools can boot. Today, though, it's often used as an emergency backup -- an OS may install a copy of it's boot loader in this location so as to enable the OS to boot in case the NVRAM entries get corrupted.
Your question isn't really 100% clear about what hardware you've got in your computer. I wouldn't be surprised to see at least one, and possibly two, entries for each hard disk that's attached to the computer. (Two would come from one EFI-mode fallback entry and one BIOS/CSM/legacy-mode entry. The latter would probably disappear if you disable the CSM in your firmware.) OTOH, one or both disk entries might be missing depending on the firmware's design and current settings, especially if there's no EFI fallback boot loader on the disk. Additional entries can be highly system-specific. It sounds like you're saying you're seeing a boot entry for booting from a network storage device. This might happen if that device supports network booting via a protocol like PXE, and if PXE support is enabled in your firmware.
Beyond that, if you're seeing entries for hard disks you've never heard of or for OSes you've never installed, my suspicion is that you're not the first owner of the motherboard. If a previous owner booted the system, and especially if that person installed an OS, there might be leftover entries in the machine's NVRAM.
You can manage EFI boot manager entries using utilities in the firmware itself and in many OSes:

*

*Many, but not all, EFIs enable you to adjust boot manager entries using their setup utilities. Details vary from one EFI to another.

*The v2 EFI shell provides a command called bcfg that enables editing these entries.

*In Windows, the bcdedit command provides a limited ability to edit these entries, and the third-party EasyUEFI provides an easier point-and-click interface for doing so.

*In Linux, the efibootmgr command enables adding, deleting, and adjusting EFI boot entries.

Note that poking around with EFI boot manager entries when you don't understand them can cause your system to become unbootable.
Also, most of this is irrelevant if you install your OS(es) in BIOS/CSM/legacy mode. The EFI boot manager still exists, but with nothing but BIOS-mode OS install(s), the EFI boot manager is reduced to the functionality of the simple device-based boot manager in a traditional BIOS.


text:
Q: High session memory usage in Mojarra I have a web application build on Mojarra (JSF 2). The application is deployed on WebSphere 7. The session usage for my application is very high. I use view scoped beans and some of the pages are considerably large. My web xml is configured to keep 5 views in session.
<context-param>
  <param-name>com.sun.faces.numberOfViewsInSession</param-name>
  <param-value>5</param-value>
</context-param>
<context-param>
  <param-name>com.sun.faces.numberOfLogicalViews</param-name>
  <param-value>5</param-value>
</context-param>

I am not explicitly adding anything to session. Still some of the sessions in my application is as large as 60 MB.
When I do a hepdump analysis it shows the session hashmap is taking all the memory. Is there a way to identify what exactly is there in session store?
E.g. The retained heap com.ibm.ws.session.store.memory.MemorySession @ 0x700000057890108  for memory store xxx at /xxx/yyy is 66209288.

A: If you analyze your heap dump with eclipse-memory-analyzer, you should be able to drill down your com.ibm.ws.session.store.memory.MemorySession to find the culprit, as explained in this blog entry: Richfaces Sessions Eating Memory – Analysis of a Memory Leak


text:
Q: Destroying asnync proxy of SLSB by JBoss In my application based on EJB3.0 and JBoss5 I use async proxy from JBoss AsyncUtils.
Stateful bean ComputerBean dispatches work to stateless pooled ProcessorBean(s). I built counter into ProcessorBeans to print out how many of them is currently instantiated. Here is the code:
@Stateful
public class ComputerBean implements ComputerRemote {

    @EJB
    private ProcessorLocal processor;

    public void startComputations() {
        Random r = new Random();
        while(true) {
            AsyncUtils.mixinAsync(processor).compute(r.nextInt());
        }
    }
}

@Stateless
public class ProcessorBean implements ProcessorLocal {

    private static int COUNTER = 0;

    @PostConstruct
    public void init() {
        System.out.println("constructing");
        COUNTER++;
    }

    @PreDestroy
    public void destroy() {
        System.out.println("destroying");
        COUNTER--;
    }

    public void compute(int i) {
        System.out.println("----------------> " + COUNTER);

        // some dummy computations - it's here only in order to take some time
        double d = 0.3;
        for (int j=0; j<100; j++) {
            d+= 0.2 % 4 + i;
        }
    }
}

Tracking console on which JBoss runs I noticed that number of SLSBeans is increased (due to higher load), but it never goes down, even if i stop computations for 20 minutes, and then restarts.
It's a dummy example, but I want to use this mechanism in a more complex system, so I have to be sure that I know exactly how it works. Did i do something wrong? Why SLSBeans counter never goes down?
Thanks in advance,
Piotr

A: You are most likely running into the fact that stateless session beans are pooled. You should see a max number of beans that will be created, as the pool by default has a fixed size.
Apparently this particular pool implementation does not downside the pool after a given amount of time. You can tweak some of the pool's behavior though via a JBoss specific annotation. See this:
http://docs.jboss.org/ejb3/docs/reference/build/reference/en/html/session-bean-config.html
If you really want, you can also replace the default pool and maybe remove instances after some time.


text:
Q: Set the mode for next boot from the terminal I'd like to be able to boot into the recovery mode the next time the machine boots not by using the start up key presses. I'm already logged in in normal user mode - can I set this in the terminal?
Any help with this is much appreciated.


text:
Q: Fatal error: Class 'Google_Service_Plus' I'm getting this error when I try to implement these Google SignIn method PacketCode:

Fatal error: Class 'Google_Service_Plus' not found in C:\xampp\htdocs\es\google\index.php on line 46

The code of the file:
<!DOCTYPE html>
<?php
/*  GOOGLE LOGIN BASIC - Tutorial
 *  file            - index.php
 *  Developer       - Krishna Teja G S
 *  Website         - http://packetcode.com/apps/google-login/
 *  Date            - 28th Aug 2015
 *  license         - GNU General Public License version 2 or later
*/

// REQUIREMENTS - PHP v5.3 or later
// Note: The PHP client library requires that PHP has curl extensions configured.

/*
 * DEFINITIONS
 *
 * load the autoload file
 * define the constants client id,secret and redirect url
 * start the session
 */
set_include_path('C:/xampp/htdocs/es/gplus-lib/');
set_include_path('C:/xampp/htdocs/es/gplus-lib/google');

require_once __DIR__.'/gplus-lib/vendor/autoload.php';

const CLIENT_ID = '234990791129-9ddtnevfm66i516hur6992l2r136m7n6.apps.googleusercontent.com';
const CLIENT_SECRET = XXX';
const REDIRECT_URI = 'http://sosgram.ga/es/account/account/';

session_start();

/*
 * INITIALIZATION
 *
 * Create a google client object
 * set the id,secret and redirect uri
 * set the scope variables if required
 * create google plus object
 */
$client = new Google_Client();
$client->setClientId(CLIENT_ID);
$client->setClientSecret(CLIENT_SECRET);
$client->setRedirectUri(REDIRECT_URI);
$client->setScopes('email');

$plus = new Google_Service_Plus($client);

/*
 * PROCESS
 *
 * A. Pre-check for logout
 * B. Authentication and Access token
 * C. Retrive Data
 */

/*
 * A. PRE-CHECK FOR LOGOUT
 *
 * Unset the session variable in order to logout if already logged in
 */
if (isset($_REQUEST['logout'])) {
   session_unset();
}

/*
 * B. AUTHORIZATION AND ACCESS TOKEN
 *
 * If the request is a return url from the google server then
 *  1. authenticate code
 *  2. get the access token and store in session
 *  3. redirect to same url to eleminate the url varaibles sent by google
 */
if (isset($_GET['code'])) {
  $client->authenticate($_GET['code']);
  $_SESSION['access_token'] = $client->getAccessToken();
  $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
  header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}

/*
 * C. RETRIVE DATA
 *
 * If access token if available in session
 * load it to the client object and access the required profile data
 */
if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
  $client->setAccessToken($_SESSION['access_token']);
  $me = $plus->people->get('me');

  // Get User data
  $id = $me['id'];
  $name =  $me['displayName'];
  $email =  $me['emails'][0]['value'];
  $profile_image_url = $me['image']['url'];
  $cover_image_url = $me['cover']['coverPhoto']['url'];
  $profile_url = $me['url'];

} else {
  // get the login url
  $authUrl = $client->createAuthUrl();
}
?>

    <?php
    /*
     * If login url is there then display login button
     * else print the retrieved data
    */
    if (isset($authUrl)) {
        echo "";
    } else {
        print "ID: {$id}
";
        print "Name: {$name}
";
        print "Email: {$email }
";
        print "Image : {$profile_image_url}
";
        print "Cover  :{$cover_image_url}
";
        print "Url: {$profile_url}

";
        echo "<button>Logout</button>";
    }
    ?>

The line: $plus = new Google_Service_Plus($client);

Anyone could help?


text:
Q: Type map apachesoap unresolved I'm meeting a problem with a WSDL file I've imported.
In this file, the map type is used from the namespace : xmlns:apachesoap="http://xml.apache.org/xml-soap"
But it is unresolved... When I try to go to this URL, I get a "404 error not found"
Any idea ?
Thank you in advance.

A: In the WSDL I've imported, we can read that :
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://exception.metier.framework.civitas.fr" />
    <import namespace="Boite_A_Tache" />
    <import namespace="http://srvcegid01:8080/gfprod/services/Boite_A_Tache" />
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    <complexType name="mapItem">
        <sequence>
            <element name="key" nillable="true" type="xsd:anyType" />
            <element name="value" nillable="true" type="xsd:anyType" />
        </sequence>
    </complexType>
    <complexType name="Map">
        <sequence>
            <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
        </sequence>
    </complexType>
</schema>

The type "Map" is well defined.
Nevertheless, the software I'm using (Websphere Message Broker d'IBM), makes some transformations on WSDL file.
You can see a little part of the WSDL "modified" :
<wsdl:documentation>
    <wsdl:appinfo source="WMQI_APPINFO">
        <MRWSDLAppInfo imported="true">
            <generatedXSD location="blablabla_1_InlineSchema1.xsd"/>
            <generatedXSD location="blablabla_1_InlineSchema2.xsd"/>
            <generatedXSD location="blablabla_1_InlineSchema3.xsd"/>
            <generatedXSD location="blablabla_1_InlineSchema4.xsd"/>
            <binding hasEncoding="true" imported="true" name="BlablaSoapBinding" originalBindingStyle="rpc"/>
            <generatedXSD location="blablabla_1.wsdl"/>
         </MRWSDLAppInfo>
     </wsdl:appinfo>
</wsdl:documentation>

<wsdl:types>
    <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
        <import namespace="http://bla.bla.bla.fr"/>
        <import namespace="blabla"/>
        <import namespace="http://blabla:8080/blabla/blabla/blabla"/>
        <xsd:include schemaLocation="blabla1_InlineSchema1.xsd"/>
    </schema>
     ....
    (autres schemas)
<wsdl:types>


text:
Q: Using Max Count after joining two tables in MySql I am just a beginner in MySql and I am trying to display the worker ID, full name and the maximum number of assignments issued to a particular employee(worker). The two tables worker and assignment are related through Wrk_ID.
My code is not working.
SELECT w.Wrk_ID,
CONCAT_WS(" ", Wrk_FirstName, Wrk_Initial, Wrk_LastName) AS FullName,
COUNT(a.Wrk_ID) AS count
FROM worker w LEFT JOIN assignment a
ON w.Wrk_ID = a.Wrk_ID
GROUP BY w.Wrk_ID
HAVING count = ALL(SELECT MAX(a.Wrk_ID) FROM assignment GROUP BY Wrk_ID);

Really need assistance!...Thanks

A: Try this
SELECT distinct w.Wrk_ID,
CONCAT_WS(" ", Wrk_FirstName, Wrk_Initial, Wrk_LastName) AS FullName,
COUNT(a.Wrk_ID) AS count
FROM worker w LEFT JOIN assignment a
ON w.Wrk_ID = a.Wrk_ID
GROUP BY w.Wrk_ID
HAVING count >= ALL(SELECT count(Wrk_ID) FROM assignment GROUP BY Wrk_ID);

SQL Fiddle - http://sqlfiddle.com/#!9/b6e2b/10


text:
Q: How do I retrieve ebay products with UPC code? I have a UPC for a digital camera (Canon EOS 350D) and I would like to find products on ebay that match this UPC. I have read the API documentation and tried the following:
http://open.api.ebay.com/shopping?callname=FindProducts&responseencoding=XML&appid=MYAPPID&siteid=0&ProductID.Value=8714574585628&ProductID.Type=UPC&version=773
But, this doesn't give me the restuls even though there is a result when I search that UPC on ebay.co.uk
How can I get the listings that match this UPC to return?

A: The easiest way to do it would be using the Finding API -> FindItemsAdvanced Call.
Here is an example of a call for what you need.
<?xml version="1.0" encoding="UTF-8"?>
<findItemsAdvancedRequest xmlns="http://www.ebay.com/marketplace/search/v1/services">
    <descriptionSearch>true</descriptionSearch>
    <paginationInput>
        <entriesPerPage>10</entriesPerPage>
    </paginationInput>
    <keywords>753182925158</keywords>
</findItemsAdvancedRequest>

Of course, this is not the only way. But I find it to be the easiest.


text:
Q: Does weapon weight in Fallout 4 affect anything other than carry weight? Due to recent experience with games like Destiny and how significantly things have changed since Fallout 3 and New Vegas..I've been wondering if there are any implicit effects induced by higher/lower weapon weight. For instance: would a 10mm pistol that's heavier than a stock version of itself have reduced recoil but slower handling (draw/stow speed)? Perhaps slower reload speed?

A: All of the weapon modifications will highlight what they're changing. Having a "lighter" weapon in itself will not directly change anything, but the modification may impact another statistic. For example;

*

*An advanced receiver increases damage and gives you a better rate of fire

*A full stock gives you better recoil

*A quick eject drum magazine gives you better ammo capacity and improved reload speeds

Additionally, "heavy" weapons will effect your movement speed while they're equipped.

A: A loading screen tip for the PC version specifically says that weapon weight inversely affects draw speed.  I'll screenshot it if I see it again for support, but I can safely say that yes, weapon weight matters (though it might not matter much).

A: Most of the mods that increase weapon weight also increase VATS cost.  This includes the heavy receiver (light reduces cost, but anything with "sensitive trigger is better) longer barrels (stub is cheapest), scopes (Reflex is best, focus seems to be keyword there), and stocks as opposed to pistol grips.  Muzzles don't matter though.
Someone also said that weapon weight also affects bash damage.  I haven't really tested this but I have read that Minigun + Shredder + basher perk brutalizes enemies.

A: Weapon weight increases the amount of time it takes for you to ADS (aim down sights) or "scope". This is explained in a loading screen tool-tip.
For example having a lighter scoped weapon will allow you to ADS quicker and reduces the fade-out time of the black overlay.

A: I asked this question myself recently, and found this posting. After performing my own experiment, I have determined that although heavier types of weapons (gauss rifle v pipe rifle) have slower drawing and aiming speeds, there is no discernable difference between a heavier version of the same type of weapon (fully upgraded pipe rifle v light pipe rifle). I also determined that there is similarly no difference between a pistol and a rifle version of the same weapon type.
In conclusion, the drawing and aiming speed of a weapon appears to only be tied to the type of weapon, and not it's actual weight.

A: There's a loading screen (PS4) that says longer weapons have more accuracy when scoped, but less when fired from the hip. This doesn't directly mention weight, but longer weapons tend to be heavier, so weight usually indirectly plays a part in a weapon's accuracy.


text:
Q: Multiline table header Is it possible typeset a table with \pgfplotstabletypeset and change the style of 1 column header to be multiline?
This code doesn't work and can't compile:
...
columns/errorRelC/.style={
    column name=Line 1\\Line 2
},
...

A: An easy way to obtain this is by using the makecell package. It provides \makecell[<alignment>]{<tabular stuff>} that you can use to typeset this kind of line-breaking stuff.
\usepackage{makecell}% http://ctan.org/pkg/makecell
%...
columns/errorRelC/.style={
    column name=\makecell{Line 1\\Line 2}
},
%...

Here is a complete minimal example from the pgfplotstable package documentation:

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{pgfplotstable}% http://ctan.org/pkg/pgfplotstable
\usepackage{makecell}% http://ctan.org/pkg/makecell
\begin{document}

\pgfplotstableset{% global config, for example in the preamble
                  % these columns/<colname>/.style={<options>} things define a style
                  % which applies to <colname> only.
  columns/dof/.style={int detect,column type=r,column name=\makecell[t]{\textsc{Dof}\\Line 2}},
  columns/error1/.style={
    sci,sci zerofill,sci sep align,precision=1,sci superscript,
    column name=$e_1$,
  },
  columns/error2/.style={
    sci,sci zerofill,sci sep align,precision=2,sci 10e,
    column name=$e_2$,
  },
  columns/{grad(log(dof),log(error2))}/.style={
    string replace={0}{}, % erase '0'
    column name={$\nabla e_2$},
    dec sep align,
  },
  columns/{quot(error1)}/.style={
    string replace={0}{}, % erase '0'
    column name={$\frac{e_1^{(n)}}{e_1^{(n-1)}}$}
  },
  empty cells with={--}, % replace empty cells with '--'
  every head row/.style={before row=\toprule,after row=\midrule},
  every last row/.style={after row=\bottomrule}
  }
  \pgfplotstabletypeset[ % local config, applies only for this table
    1000 sep={\,},
    columns/info/.style={
      fixed,fixed zerofill,precision=1,showpos,
      column type=r,
    }
  ]
{
  %# Convergence results
  %# fictional source, generated 2008
  level  dof         error1         error2 info grad(log(dof),log(error2)) quot(error1)
  1        4 2.50000000e-01 7.57858283e-01 48  0              0
  2       16 6.25000000e-02 5.00000000e-01 25 -3.00000000e-01 4
  3       64 1.56250000e-02 2.87174589e-01 41 -3.99999999e-01 4
  4      256 3.90625000e-03 1.43587294e-01  8 -5.00000003e-01 4
  5     1024 9.76562500e-04 4.41941738e-02 22 -8.49999999e-01 4
  6     4096 2.44140625e-04 1.69802322e-02 46 -6.90000001e-01 4
  7    16384 6.10351562e-05 8.20091159e-03 40 -5.24999999e-01 4
  8    65536 1.52587891e-05 3.90625000e-03 48 -5.35000000e-01 3.99999999e+00
  9   262144 3.81469727e-06 1.95312500e-03 33 -5.00000000e-01 4.00000001e+00
  10 1048576 9.53674316e-07 9.76562500e-04  2 -5.00000000e-01 4.00000001e+00
}
\end{document}

I've used a top alignment in \makecell for the second column header to make the first rows of each header be vertically aligned. You can specify other alignment formats, including a different horizontal alignment. See the makecell documentation for more information.
Alternatively, you could just write the header in a tabular yourself - just like \makecell does:
\pgfplotstableset{% global config, for example in the preamble
                  % these columns/<colname>/.style={<options>} things define a style
                  % which applies to <colname> only.
  columns/dof/.style={int detect,column type=r,column name=\begin{tabular}[t]{@{}c@{}}\textsc{Dof}\\Line2\end{tabular}},
%...

Finally, you could box the content, which you then use as the column name. Here is how you would obtain an equivalent layout to the MWE above:
\newsavebox{\mybox}
\savebox{\mybox}{\begin{tabular}[t]{@{}c@{}}\textsc{Dof}\\Line2\end{tabular}}%

\pgfplotstableset{% global config, for example in the preamble
                  % these columns/<colname>/.style={<options>} things define a style
                  % which applies to <colname> only.
  columns/dof/.style={int detect,column type=r,column name=\usebox{\mybox}},
%...

The reason for all this required trickery is because the contents is inserted as-is into the table. As such, inserting \\ in the middle somewhere would terminate the row and start a new row. Therefore, you have to "contain" it to that particular cell. Using makecell allows you to do the header specification within the table and allows for more freedom if changes are required and is a clean (from a code-perspective). Inserting a tabular is a little less clean, but works just as well, while boxing is usually done "outside" of the table and used "inside" - a little more cumbersome.
In all cases, the horizontal cell padding introduced by tabular (in makecell as well) has been removed using @{}..@{}.


text:
Q: TypeError: AddEventListener is not a function {field: 'actions', title: 'Actions', width: 50, align: 'center',
                                formatter: function (value, row, index) {
                                    if (row.isDirectEntitlements && row.context == "child" && row.isEditing) {
                                        var s = 'Save';
                                        var c = 'Cancel';
                                        return s + c;
                                    }
                                    else if (row.isDirectEntitlements) {
                                        var e = 'mode_edit';
                                        e.addEventListener('click',function () {
                                            var s = 'Save';
                                            var c = 'Cancel';
                                        },false);
                                        var d = 'delete';
                                        return e + d;
                                    }
                                }

I am am trying to add two buttons (save and delete) when I press the edit button but I am stuck on this .addEventListener error. Does anyone know why I am getting this error? Any help will be appreciated. Thank you very much.

A: You need to use document.CreateElement function to create html nodes and then on that you can attach event using addEventListener.
This function is available on DOM nodes and not string.
var e = 'mode_edit';

//This is just a string and it does not have addEventListener on it
var anchor = document.createElement('a');
//it returns dom node on which you can aad event
anchor.addEventListener('click',function () {
                                            var s = 'Save';
                                           //code
                                        },false);


text:
Q: how to change value of html element by classname using javascript Here is the code i am using to change value of html element ***
 This text to be chnage

how can I change this text on page load instans

A: Seems you need to add DOMContentLoaded or put your script before
Native JavaScript solution
document.addEventListener("DOMContentLoaded", function(event) {
  document.getElementsByClassName("classname")[0].innerHTML = "qwerty";
});

Add your script before

Version with jQuery
$(funtion(){
   $(".classname:first").text("qwerty");
});

A: You can use css selector, but it can be not safe, because this method return first occurance:
document.querySelector(".classname");

By the way, almost all developers use some js framework: jQuery, prototype, extJs, etc

A: Using jquery (I refered to jquery, since you have tagged it in your question), you could achieve this like below:
$(funtion(){
    $("a .classname")[0].text("aaaaaaqwerty");
});

A: $(document).ready(funtion(){
    $(".classname").text("aaaaaaqwerty");
});

A: You could use this
document.addEventListener("DOMContentLoaded", function(event) {
  document.getElementsByClassName("classname")[0].innerHTML = "some texts";
});

Using jQuery
$(document).ready(function(){
   $(".classname").eq(0).val("aaaaaaqwerty");
});


text:
Q: Why Java RMI Callback doesn't work behind NAT router? I'm trying to do callback on Java RMI with a simple program, and it works OK in localhost and LAN, but I have problems doing that behind a NAT router.
I get connection refused if my server implementation extends UnicastRemoteObject.
If I don't extends UnicastRemoteObject and I export the object manually (UnicastRemoteObject.exportObject(services, 0);), the server does the action when the client calls the remote method, and when the server calls the callback method, it gets a connection timeout because call is going to the private IP.
I bind the service in the registry like this:
public class Server {
    private static final String SRVHOST = "<<external ip>>";
    private static Registry registry;

    public static void main(String[] args) {
        System.setProperty("java.rmi.server.hostname", SRVHOST);
        System.setProperty("java.rmi.server.useCodebaseOnly","false");
        System.setProperty("java.security.policy","src/srv.policy");

        if(System.getSecurityManager()==null)
            System.setSecurityManager(new RMISecurityManager());

        registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
        ServerInterface services = new ServerImpl();
        registry.rebind("ServerAPI", services);
    }
}

And client gets the service:
public class Client {
    private static final String SRVHOST = "localhost";
    private static Registry registry;
    private static ClientInterface callback;

    public static void main(String[] args) {
        System.setProperty("java.security.policy", "src/cli.policy");

        if(System.getSecurityManager()==null)
            System.setSecurityManager(new RMISecurityManager());

        registry = LocateRegistry.getRegistry(SRVHOST, Registry.REGISTRY_PORT);
        ServerInterface services = (ServerInterface) registry.lookup("ServerAPI");
        callback = new ClientImpl();
        int nCallback = services.setClientInterface(callback);
        ...
        <<do_things>>
    }
}

The method setClientInterface(...) gets the client object and stores it in an ArrayList.
I don't know what's the problem. Can someone help me?
All the code is published here:
Policy files:
srv.policy - http://pastebin.com/LTsKSG3r
cli.policy - http://pastebin.com/zqxaRyT3
Package: com.rmicallback.client
Client.java - http://pastebin.com/Xus04JZK
ClientImpl.java - http://pastebin.com/SdQXMDzs
ClientInterface.java - http://pastebin.com/S9PxT5vC
Package: com.rmicallback.server
Server.java - http://pastebin.com/cxQcWy1Q
ServerImpl.java - http://pastebin.com/nqdGPbPr
ServerInterface.java - http://pastebin.com/nPxDJgs1


text:
Q: AndroidTV ImageView 4K resolution I am trying to get ImageViews to render 4K content, but it is only displaying it in 1080p.
If I provide the image in the correct size for 4K resolution, it just gets scaled down and displayed in 1080p anyway.
I am enabling the 4K display mode as follows, but it doesn't seem to affect ImageViews.
    windowManager.defaultDisplay.supportedModes.forEach {
        if (it.physicalHeight == 2160) {
            val params = window.attributes
            params.preferredDisplayModeId = it.modeId
            window.attributes = params
        }

Has anyone managed to render images in 4K correctly? Am I doing something wrong?
I couldn't find any recent guidelines on 4K support, but it seems strange that this is not supported now that 4K TVs are so common.
Any help would be very appreciated.


text:
Q: How to create a LocalDB instance for NEventStore I'm trying to use LocalDb with NEventStore but, even though I think I have set-up the database correctly, I keep getting the following exception:
NEventStore.Persistence.StorageUnavailableException: Invalid object name 'Snapshots'.
In code I configure NEventStore to use the database like this:
this.EventStore = Wireup.Init()
               .LogToOutputWindow()
               .UsingInMemoryPersistence()
               .UsingSqlPersistence("DefaultConnection")
               .WithDialect(new MsSqlDialect())
               .UsingJsonSerialization()
               .LogToOutputWindow()
               .Build();

I have the following database connection in my web.config file:
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Initial Catalog=MyDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />

And using Visual Studio I've added an SqlServerDatabase (MyDatabase.mdf) to the App_Data folder of my Asp.net MVC 5 project. NEventStore seems to be able to open the database (if I remove MyDatabase.mdf from my project I get a different exception). But it seems its unable to initialize the database correctly. When I browse the database, after running into the error message, I see that no tables have been created.
What makes this extra strange is that, if this document is correct,  Snapshots should be the second table made. So it seems it has no problem creating the first one.
The complete stack trace for the StorageUnavailableException
   at NEventStore.Persistence.Sql.SqlDialects.PagedEnumerationCollection.OpenNextPage() in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\Persistence\Sql\SqlDialects\PagedEnumerationCollection.cs:line 200
   at NEventStore.Persistence.Sql.SqlDialects.PagedEnumerationCollection.MoveToNextRecord() in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\Persistence\Sql\SqlDialects\PagedEnumerationCollection.cs:line 146
   at NEventStore.Persistence.Sql.SqlDialects.PagedEnumerationCollection.System.Collections.IEnumerator.MoveNext() in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\Persistence\Sql\SqlDialects\PagedEnumerationCollection.cs:line 70
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at NEventStore.Persistence.Sql.SqlPersistenceEngine.GetSnapshot(String bucketId, String streamId, Int32 maxRevision) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\Persistence\Sql\SqlPersistenceEngine.cs:line 225
   at NEventStore.Persistence.PipelineHooksAwarePersistanceDecorator.GetSnapshot(String bucketId, String streamId, Int32 maxRevision) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\Persistence\PipelineHooksAwarePersistanceDecorator.cs:line 45
   at NEventStore.AccessSnapshotsExtensions.GetSnapshot(IAccessSnapshots accessSnapshots, String bucketId, Guid streamId, Int32 maxRevision) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\AccessSnapshotsExtensions.cs:line 49
   at CommonDomain.Persistence.EventStore.EventStoreRepository.GetSnapshot(String bucketId, Guid id, Int32 version) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\CommonDomain\Persistence\EventStore\EventStoreRepository.cs:line 147
   at CommonDomain.Persistence.EventStore.EventStoreRepository.GetById[TAggregate](String bucketId, Guid id, Int32 versionToLoad) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\CommonDomain\Persistence\EventStore\EventStoreRepository.cs:line 54
   at CommonDomain.Persistence.EventStore.EventStoreRepository.GetById[TAggregate](Guid id, Int32 versionToLoad) in c:\TeamCity\buildAgent\work\38b1777f2112a252\src\NEventStore\CommonDomain\Persistence\EventStore\EventStoreRepository.cs:line 44
   at CapraLibraShop.DataModel.Repositories.UserAggregateRepository.UserWithEmailExists(EmailAddress emailAddress) in D:\Projects\C#\CapraLibraShop\CapraLibraShop.DataModel\Repositories\UserAggregateRepository.cs:line 22
   at CapraLibraShop.Controllers.AccountController.Register() in D:\Projects\C#\CapraLibraShop\CapraLibraShop\Controllers\AccountController.cs:line 55
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()

A: I literally found the answer two minutes after looking. But since I had a hard time Googling this answer I think it would be nice to place the answer here, instead of deleting the question.
I forgot to initialize the storage engine. I overlooked it because of the fluid syntax. The correct way to let NEventStore initialize the database is by including the InitializeStorageEngine method after you have selected the database type:
  this.EventStore = Wireup.Init()
               .LogToOutputWindow()
               .UsingInMemoryPersistence()
               .UsingSqlPersistence("DefaultConnection")
               .WithDialect(new MsSqlDialect())
               .InitializeStorageEngine() // The oh so important line!
               .UsingJsonSerialization()
               .LogToOutputWindow()
               .Build();


text:
Q: What does the phrase "to be only able to do X for subset Y is unacceptable" mean? What does the phrase "to be only able to do X for subset Y is unacceptable" mean?
Does it mean that the speaker is against doing X?
Or that they think effort should be made to expand X for other subsets?
If you want to stick with the pure language discussion and avoid the political correctness and ethics involved do not read below.
The question actually came as an argument whether the author of the phrase "To be only able to offer a product to one part of population is inequitable and should be unacceptable to the field" meant to say that the product should not be released as is or whether she called for more research. The phrase is from this article: https://www.technologyreview.com/s/612322/white-people-only-dna-tests-show-how-unequal-science-has-become/

A: This is interesting, because the placement of "only" can be very confusing, and is supposed to adhere to strict rules regarding its position in the sentence. However, most speakers of English do not stick to these rules, as their meaning is generally obvious when other clues, such as context are taken into account.
I would assume here that the speaker believes that X should be made available to other subsets, not just Y. However, I can only tell that by looking at the actual sentence and its context.
Here what the speaker should have said is:

"To be able to do X for only subset Y is unacceptable"

This is because "only" should be placed as close as possible to the word or phrase that it modifies. However, like most speakers of English, the speaker here is not conforming to this rather strict rule, as the meaning can be gleaned from the context. Also, sticking blindly to this rule can sometimes make speech sound a little archaic (IMO).
For some more examples, see this website: https://getitwriteonline.com/articles/placement-of-only/


text:
Q: SQL-Server-2005: Why are results being returned in a different order with(nolock) i have a primary key clustered index in col1
why when i run the following statements are the results returned in a different order
select * from table

vs
select * from table with(nolock)

the results are also different with tablock
schema:
col1 int not null
col2 varchar (8000)

A: Without any ORDER BY no order of results is guaranteed.
Your question is now heavily truncated but the original version mentioned that you saw different order of result when using nolock as well as tablock.
Both of these locking options allow SQL Server to use an allocation order scan rather than reading along the clustered index data pages in logical order (following pointers along the linked list).
That should not be taken as meaning that the order is guaranteed to be in clustered index order without that as the advanced scanning mechanism, or parallelism for example could both change this.

A: The order of rows is never guaranteed unless you use an ORDER BY.
If you have to have the rows in a specific order there is no other solution that will return the rows in a predictable order.
If you leave out the order by the DBMS is free to return the rows in any order it thinks is most efficient

A: Sql Server makes no guarantee about the ordering, it will change based on how Sql Server optimises the query.
To guarantee the order you must use an order by clause.

A: if you are not specifying an order, it's completely nondeterministic.  Today they may be different, tomorrow maybe not.
Supplying a hint may inadvertently guide the query optimizer down a more efficient path.


text:
Q: SSH to bitbucket returing Permission Denied (publickey) So I am trying to clone a repo to a directory on my Ubuntu server but I keep getting a Permission Denied (publickey) error.
This is very weird because my output for ssh -T git@bitbucket.org shows success:
mo@li515-148:/var/www$ ssh -T git@bitbucket.org
conq: logged in as msamman.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

However when I try to clone, I am getting an error:
mo@li515-148:/var/www$ sudo git clone git@bitbucket.org:username/website-development.git
Cloning into 'website-development'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

here is the verbose output:
mo@li515-148:/var/www$ ssh -v git@bitbucket.org
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [207.223.240.182] port 22.
debug1: Connection established.
debug1: identity file /home/mo/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/mo/.ssh/id_rsa-cert type -1
debug1: identity file /home/mo/.ssh/id_dsa type -1
debug1: identity file /home/mo/.ssh/id_dsa-cert type -1
debug1: identity file /home/mo/.ssh/id_ecdsa type -1
debug1: identity file /home/mo/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/mo/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/mo/.ssh/id_rsa
debug1: Remote: Forced command: conq username:msamman
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Remote: Forced command: conq username:msamman
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([207.223.240.182]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
conq: logged in as msamman.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 3072, received 2904 bytes, in 0.2 seconds
Bytes per second: sent 14028.4, received 13261.2
debug1: Exit status 0

This is an Ubuntu 12.04 server and I am SSHing to it through PuTTY. Any ideas?

A: Found the problem.
I made ssh keys for my user account mo. Thats why ssh -T git@bitbucket.org returned success.
However, calling sudo git clone ...... uses the root account, which doesn't have ssh access to bitbucket.
I simply had to give mo permissions to /var/www folder to bypass using sudo and that fixed my problem.

A: I use:
sudo -u myuser git clone git@.....
where myuser is the user from where I´m executing and sshkey is authorized on bitbucket.


text:
Q: WMI: Win32_ScheduledJob: How do I set UntilTime? Win32_ScheduledJob: How do I set UntilTime?
I am worried that the process will end abruptly after 72 hours due to the scheduled task default setting:
"Stop the task if it runs for [  72 ] hour(s)"
Will the task actually end after 72 hours?
I can set UntilTime but it has no effect on the scheduled task.
For example C#:
System.Management.ManagementClass classInstance;
...
string strTime = "********" + String.Format("{0:HHmmss}", dtSchdTask) + ".000000+000";
object[] arrParams = {"\""+ sProc + "\"", strTime, false, null, null, true, mjob };
...
DateTime dtUntilTime = DateTime.MaxValue;
string strUntilTime = String.Format("{0:yyyyMMddHHmmss}", dtUntilTime)  + ".000000+000";
classInstance.SetPropertyValue("UntilTime", strUntilTime);
...
classInstance.InvokeMethod("Create", arrParams);


text:
Q: Exporting Dates to CSV I can't figure out why the result of the export ( as csv ) has the forward slashes removed when viewing in excel. This options seems to work but the resulting data shows dates like this  ' 2 21 1991 7 26 1989 '
  exporterFieldCallback: function (grid, row, col, input) {
         if (col.colDef.type == 'date')
                     input = $filter('date')(input, 'MM/dd/yyyy');
                    return input;
            },

Please let me know what I am missing here
http://plnkr.co/edit/iJRhjy0nXR4P1xVVDRZd?p=preview

A: There may be a better way to do this, but it seems that since it was date format excel pigeonholed it into a date format which didn't include the format I was trying to display.
I made 1 change to make this work: adding single space around the field to force it to be a general field.
exporterFieldCallback: function (grid, row, col, input) {
     if (col.colDef.type == 'date')
                 input = ' '+$filter('date')(input, 'MM/dd/yyyy') +' ' ;
        },


text:
Q: Overloading a function in C++ I'm learning C++ through Sololearn. I have a  doubt about function overloading
this is the code
#include<iostream>
using namespace std;

void printSomething(int x)   {

   cout << "I'm printing an integer " << x << endl;
}
void printSomething(float x)   {

   cout << "I'm printing a float " << x << endl;
}

int main()  {

   int a =3;
   float b = 2.65;
   printSomething(a);
   printSomething(b);
   return 0;
}

it gives output as
               I'm printing an integer 3
               I'm printing a float 2.65

but if I directly give argument when calling function
like this
#include<iostream>
using namespace std;

void printSomething(int x)   {

   cout << "I'm printing an integer " << x << endl;
}
void printSomething(float x)   {

   cout << "I'm printing a float " << x << endl;
}

int main()  {

   printSomething(3);
   printSomething(2.65);
   return 0;
}

i get following error

..\Playground: In function 'int main()':
     ..\Playground:19:24: error: call of overloaded 'printSomething(double)' is    ambiguous
       printSomething(2.65);
                          ^
  ..\Playground:19:24: note: candidates are:
  ..\Playground:5:6: note: void printSomething(int)
  void printSomething(int x)   {
        ^
  ..\Playground:9:6: note: void printSomething(float)
  void printSomething(float x)   {
        ^

but if I change
void printSomething(float x)   {

    cout << "I'm printing a float " << x << endl;
}

to
void printSomething(double x)   {

    cout << "I'm printing a float " << x << endl;
}

I will get output as
       I'm printing a float 2.65

why is it?
but if it's only the integer it works fine
#include<iostream>
using namespace std;

void printSomething(int x)   {

   cout << "I'm printing an integer " << x << endl;
}
void printSomething(float x)   {

   cout << "I'm printing a float " << x << endl;
}

int main()  {

    printSomething(3);
    return 0;
}

Result
                      I'm printing an integer 3

Why isn't this working with float
Thankyou

A: 2.65 is not a float literal, it's a double literal.
So the compiler doesn't know whether you want to convert the double to a float or an int and so issues the error.
In your first case, when writing float b = 2.65; the compiler assumes you know what you're doing, and calling the overload with b is unambiguous.
If you had written printSomething(2.65f); then that would also have been unambiguous: 2.65f is a float literal.

A: 2.65 is considered a double. But you didn't provide an overload void printSomething(double x). Therefore the compiler must cast the value and it doesn't know if it should cast to float or int (both with precision loss`).
If you write 2.65f it is considered a float and it should work.

A: The reason for that is the conversion rules and overload resolution strategy. If C++ is unable to find an exact match on parameters, it looks for a conversion. The best conversion is an implicit one, that is widening (casting a data type to one that can hold all the values of the original type and potentially more), then a narrowing conversion (casting to a smaller data type, which may cause errors or loss of precision for some values), then a user-defined conversion.
As literal 2.65 is of type double, the compiler looks for conversions. There are two: double -> float and double -> int. They are both narrowing,  which means they are equally good. The compiler is unable to pick the best one, thus reports an error.
To remedy this, you can either:

*

*define overload for double as you did

*use a float literal (2.65f) instead of a double


text:
Q: Lisp : Don't know how to create ISeq from Java.lang.Integer I'm trying to open a text file and split it into a list of integer values in Clojure. I get this error code every single time, and I've got no idea why. I'm relatively new to Lisp development (I mean I started like two hours ago), so it might be that I'm asking a really silly question. Cheers
(ns clojure.examples.hello
  (:gen-class))

(ns clojure-noob.core)

(defn toInt [s]
  (Integer/parseInt (re-find #"\A-?\d+" s)))
(defn toIntList [s]
  (if (not s) ()
    (list* (toInt (first (toInt s)) (toIntList first((rest
  (clojure.string/split s #" "))))))
  )
)

(println (str (toIntList (slurp "hab.txt"))))

A: The reason you are getting that error message is that (somewhere) you are incorrectly calling a function that expects a sequence argument with an integer argument. One place that this could be is here:
(first (toInt s))

The function first expects a sequence (ISeq), yet toInt is returning an integer.
And just to confirm:
(first (java.lang.Integer/parseInt "10"))

IllegalArgumentException Don't know how to create ISeq from: java.lang.Integer

A: Assuming hab.txt is just a single line of space-delimited integers, this should work:
(defn to-int [s]
  (Integer/parseInt (re-find #"\A-?\d+" s)))
(defn parse-int-str [s]
  (map to-int (clojure.string/split s #" ")))
(println (parse-int-str "1 2 3 4 5"))
=> (1 2 3 4 5)

Or a recursive version as requested:
(defn parse-int-str [s]
  (loop [nums []
         strs (clojure.string/split s #" ")]
    (if (seq strs)
      (recur (conj nums (to-int (first strs)))
             (rest strs))
      nums)))

You could do this without loop/recur but you risk exhausting stack space. You could also think about doing this with reduce.

A: Let's prepare a file:
(spit "foo.txt" "  3 5  662 35 3  ")

Now let's read the file, split the string by empty symbols, remove empty ones and parse them into integers. The code
(as->
   "foo.txt" $
   (slurp $)
   (clojure.string/split $ #"\s+")
   (remove empty? $)
   (mapv #(java.lang.Integer/parseInt %) $))

gives
[3 5 662 35 3]


text:
Q: Difference between & and and in python year=1992

print (year%4==0 and (year%100==0 or year%400==0))

print (year%4==0 & (year%100==0 or year%400==0))

Why two output are not equal?

A: Operator precedence. Bitwise operations have higher precedence than equality comparison operator, so your bitwise operation is being computed as:
print (year%4 == (0 & (year%100==0 or year%400==0)))


text:
Q: Loop multidimensional array and group results together I have a MySQL table of events similar to:
+----+------------+-----------+----------+----------+
| id |    date    | starttime | endtime  | location |
+----+------------+-----------+----------+----------+
|  1 | 2018-12-22 | 18:00:00  | 21:30:00 |        3 |
|  2 | 2018-12-23 | 18:00:00  | 21:30:00 |        2 |
|  3 | 2018-12-25 | 18:00:00  | 21:30:00 |        1 |
|  4 | 2018-12-21 | 07:00:00  | 10:30:00 |        3 |
|  5 | 2018-12-21 | 18:00:00  | 21:30:00 |        3 |
+----+------------+-----------+----------+----------+

What I'm trying to do is is list the details of each event grouped by location. For example, the data above would result in:
Location: 1
Date(s): 2018-12-25
Time(s): 18:00:00 - 21:30:00

Location: 2
Date(s): 2018-12-23
Time(s): 18:00:00 - 21:30:00

Location: 3
Date(s): 2018-12-21 | 2018-12-22
Time(s): 07:00:00 - 10:30:00 or 18:00:00 - 21:30:00 | 18:00:00 - 21:30:00

A standalone while loop displays each location separately unless I Group By in the query. If I do a check to see if the last location equals the current location, I get past the having to Group By in the query, but then I can't associate the dates and times with location if that location has multiple dates/times. I have been able to accomplish what I need by re-querying within the while loop, but I think there must be a better, more efficient way. Lastly, If you'll notice, I've used a " | " as a separator between multiple dates/times. Even when I get the results to list out as I mentioned above, I can't seem to get the last " | " NOT to display after the last listing.

A: there are several ways

*

*first populate the location
q1 = "SELECT DISTINCT(location) FROM Table ORDER BY location;"

*retrieve the first query with foreach
foreach ($item in q1 ){
    //load again from location
    q2 = "SELECT date, starttime, endtime FROM Table WHERE location = ". $location .";"

    //print date only once
    echo "Date(s): ".date column;

    //loop the time
    foreach ($item in q2){
        //put the logic to create or by yourself
        echo "Time(s): ". $item->starttime ."-". $item->endtime;
    }
}

A: Try this query:
Select group_concat(date seperator ,'|'), group_concat(starttime ,'|', endtime ) timings, location from tablename group by location order by location


text:
Q: Validations on C++ (Console) Scenario 1 :
The input is taken in as a character array [20] and is saved onto a *.dat file.
I need to validate the size of the array, check the if there are any special characters,numeric and letter's case sensitivity.
since it's not a string cannot I use strlen to validate the length. If not is it possible to use .length  or size_t / sizeof method
Scenario 2 :
Need to validate Age , Id and Phone number which are integers in a struct.(also saved onto a *.dat file)
For an Example:
struct patient{

    int pId, age ,contactNo;
}

void input(){

 patient obj;
 if ((int)obj.age<=65){
 //Some Code
  }
}

The Above method did not work.
I need to validate the age with a set age limit like the above. pId should not be more than four digits and phone number will be 10 digits with out "-" in between and should only allow numeric input.
Is there any possible way of doing the above scenarios. If it possible please give me an example ...

A: It is unclear (at least) to me what you ask for in Scenario 1.
Scenario 2:

*

*You need a semicolon after your struct definition

*You should removed the typecast: (int)obj.age<=65 should be obj.age<=65, as it is already an int

*With respect to pId, just check if it under 10000

*For contactNo  you need a uint64_t otherwise it cannot hold ten arbitrary digits.

It may also be a good idea to make your age and pId variables unsigned int instead of int, this way you remove the possibility of negative age and pId with a minus.
You can construct an object of type patient like this:
patient obj{1234, 47, 1234567};


text:
Q: Why does regedit give different results from reg query? I have jdk 1.6 installed on my machine and have a discrepancy between regedit and reg query.  From regedit I have the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit

but if I try
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"

I get:
ERROR: The system was unable to find the specified registry key or value.

From regedit HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft has the following children:
Java Development Kit
Java Plug-in
Java Runtime Environment
Java Wb Start
Prefs

But reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft" has the following results:
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Auto Update
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs

So there are keys missing from regedit that show up in reg query and others that are missing from reg query that show up in regedit.
Any ideas why these could be different?

A: Try running reg from a console with administrative privileges.


text:
Q: $(...).highcharts is not a function despite correct order of files My first assumption (and from searching SO) was that I'd put the files in the wrong order.
After much experimentation it seems this isn't the case - although it did fix another issue I had, so a good result all the same.
The head contains:
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="/assets/js/highstock-all.js"></script>
  <script src="/assets/js/charting.js"></script>

Charting.js is:
$( document ).ready(function(){
$(function () {
    $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=new-intraday.json&callback=?', function (data) {

        // create the chart
        $('#chartcontainer').highcharts('StockChart', {

            title: {
                text: 'AAPL stock price by minute'
            },

            rangeSelector : {
                buttons : [{
                    type : 'hour',
                    count : 1,
                    text : '1h'
                }, {
                    type : 'day',
                    count : 1,
                    text : '1D'
                }, {
                    type : 'all',
                    count : 1,
                    text : 'All'
                }],
                selected : 1,
                inputEnabled : false
            },

            series : [{
                name : 'AAPL',
                type: 'candlestick',
                data : data,
                tooltip: {
                    valueDecimals: 2
                }
            }]
        });
    });
});
});

There are no issues being displayed in the console other than that highcharts is not a function. The same happens if I just use:
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>

rather than linking the local copies.
How can I get this working?

A: highcharts-all.js is not part of offered framework from Highcharts.
See this forum post.
http://forum.highcharts.com/highstock-usage/highstock-all-t32340/
Also it's not listed in their file service.
http://code.highcharts.com/
Second way is working perfectly. See in their samples
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/stock/demo/basic-line/


text:
Q: Why do they use interface in this guide So I am pretty new in Java and I'm trying to get started with web applications using JSP and servlets. I've came across this CRUD web app guide A simple CRUD Tutorial Using Java Servlet / JSP. The thing is, I don't understand why they have to create the StudentDAO interface. I know this would be easy as pie to understand for most of you that's why I'm asking here. All I want is an answer if StudentDAO interface is really needed since we only declare the methods there, and override all of them in a class called studentDAOImplementation anyway.
I know I should read some more about Java interfaces but I was hoping to get explanation on why interface is needed in this example.

A: This does not really have a simple answer. The sketch of the answer would be - because you want to be independent of how your application actually stores/retrieves the data in the database. The interface provides the functional specification of what the DAO (Data Access Object) should be able to do - it is up to the specific implementation to actually do it. For example, for testing purposes, you might want to setup a stub DAO that does not really use the database, but instead gives you prefabricated objects. In a real-world complex application, you might want to vary the DAO depending on what database engine is really used and so on and so on. So generally, this is an instance of decoupling the functional specification from the implementation.


text:
Q: Aligning content in multirow I want to write a document, where i group two plots and the two functions corresponding to the plots together. There should be two such groups aligned next to each other. Here is a picture of what i mean by that:

This is already looking very similar to what i want to achieve, however i don't like the alignment in the "formula" column.
I am currently doing this with a tabularx-environment with frame lines (obviously) and two minipages. The column with the formulas looks like:
\multicolumn{2}{|c|}{\(\displaystyle s(t) = \sigma \left(t\! +\!
  \frac{T_i}{2}\right) - \sigma\left(t - \frac{T_i}{2}\right)\) \hfill
  \horizontaltransform[F]{} \hfill \(\displaystyle\undersl{S}(f) = T_i
  \cdot \frac{\sin(\pi f T_i)}{\pi f T_i}\)}\\ \hline

(verticaltransform is a TikZ-macro that i have put together)
How can i improve this for the formulas to be centered to the column on top and the transformation-symbol to be centered in the column?
Is this even the way to write it or are there better alternatives? The code looks hairy and i have concerns about different height, once i proceed to other functions and their spectrum.
MWE:
\documentclass{article}

\usepackage{tabularx, multicol, graphicx, trfsigns}
\usepackage[margin=1cm]{geometry}

\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column

\begin{document}

\scriptsize

\begin{minipage}{.49\textwidth}
  \begin{tabularx}{\textwidth}{|X|X|}
    \hline
    \includegraphics[width=4cm]{example-image-a} &%
                                                  \includegraphics[width=4cm]{example-image-a} \\ \hline
    \multicolumn{2}{|c|}{ \hfill \(\displaystyle s(t) = \sigma \left(t\! +\! \frac{T_i}{2}\right) - \sigma\left(t - \frac{T_i}{2}\right)\) \hfill \(\laplace\) \hfill \(\displaystyle\undersl{S}(f) = T_i \cdot \frac{\sin(\pi f T_i)}{\pi f T_i}\) \hfill }\\ \hline
  \end{tabularx}
\end{minipage}\hfill%
\begin{minipage}{.49\textwidth}
  \begin{tabularx}{\textwidth}{|X|X|}
    \hline
    \includegraphics[width=4cm]{example-image-a} &%
                                                  \includegraphics[width=4cm]{example-image-a} \\ \hline
    \multicolumn{2}{|c|}{ \hfill \(\displaystyle s(t) = \sigma \left(t\! +\! \frac{T_i}{2}\right) - \sigma\left(t - \frac{T_i}{2}\right)\) \hfill \(\laplace\) \hfill \(\displaystyle\undersl{S}(f) = T_i \cdot \frac{\sin(\pi f T_i)}{\pi f T_i}\) \hfill }\\ \hline
  \end{tabularx}
\end{minipage}

\end{document}

A: *

*your formulas are to wide (even in \scriptsize font size) that can be fit in width of two cells on the way as you like to have

*to overcome this, you need to enlarge the table width:

*

*one way is increase text width localy by use of \adjustwidth macro from the changepagepacket

*another way is rotate table or put it into landscape page orientation

*in the first case, after rewriting you equations code (that it can be compiled) you can obtain:

\documentclass{article}
\usepackage{geometry}

\usepackage{graphicx}
\usepackage{hhline,     % new
            makecell,   % new
            tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{trfsigns}
\usepackage{amsmath}
%\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column
\usepackage[strict]{changepage}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\lipsum[11]

\begin{adjustwidth}{}{-\marginparwidth}
    \scriptsize
    \setlength\tabcolsep{4pt}
    \setcellgapes{4pt}
    \makegapedcells
\centering\medskip
\begin{tabularx}{\linewidth}{|X X||X X |}
    \hhline{|--||--|}
    \includegraphics[width=\linewidth]{example-image-a}
        &   \includegraphics[width=\linewidth]{example-image-b}
            &   \includegraphics[width=\linewidth]{example-image-a}
                &   \includegraphics[width=\linewidth]{example-image-b}     \\
    \hhline{|--||--|}
    \multicolumn{2}{|>{$}c<{$}||}{
            s(t) = \sigma \left(t{+}\dfrac{T_i}{2}\right) - \sigma\left(t{-}\dfrac{T_i}{2}\right)
            \ \laplace\
            \underline{S}(f) = T_i \dfrac{\sin(\pi f T_i)}{\pi f T_i}
            \rule{4.4em}{0pt}  % manually adjusted
                                    }
            &
    \multicolumn{2}{>{$}c<{$}|}{
            s(t) = \sigma \left(t{+}\dfrac{T_i}{2}\right) - \sigma\left(t{-}\dfrac{T_i}{2}\right)
            \ \laplace\
            \underline{S}(f) = T_i \dfrac{\sin(\pi f T_i)}{\pi f T_i}
            \rule{4.4em}{0pt}  % manually adjusted
                                    }                                       \\
    \hhline{|--||--|}
  \end{tabularx}
\end{adjustwidth}
\end{document}
    &   \multicolumn{1}{>{$\displaystyle}c<{$}|}{
            s(t) = \sigma \left(t{+}\dfrac{T_i}{2}\right) - \sigma\left(t{-}\dfrac{T_i}{2}\right)
    &   \multicolumn{1}{>{$\displaystyle}c<{$}|}{
            \underline{S}(f) = T_i \dfrac{\sin(\pi f T_i)}{\pi f T_i}
                                               }                                \\
    \hhline{|--||--|}
  \end{tabularx}
\end{adjustwidth}
\end{document}

(red lines indicate page layout)

*

*in the second case with use of sidewaystable˙ environment you can increase font size to ˙\footnotesize:
\documentclass{article}
\usepackage{geometry}

\usepackage{graphicx}
\usepackage{hhline,     % new
            makecell,   % new
            tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{trfsigns}
\usepackage{amsmath}
%\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column
\usepackage{rotating}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum[11]

\begin{sidewaystable}
    \footnotesize
    \setlength\tabcolsep{4pt}
    \setcellgapes{4pt}
    \makegapedcells
\centering
\begin{tabularx}{\linewidth}{|X X||X X |}
    \hhline{|--||--|}
    \includegraphics[width=\linewidth]{example-image-a}
        &   \includegraphics[width=\linewidth]{example-image-b}
            &   \includegraphics[width=\linewidth]{example-image-a}
                &   \includegraphics[width=\linewidth]{example-image-b}     \\
    \hhline{|--||--|}
    \multicolumn{2}{|>{$}c<{$}||}{
            s(t) = \sigma \left(t{+}\dfrac{T_i}{2}\right) - \sigma\left(t{-}\dfrac{T_i}{2}\right)
            \ \laplace\
            \underline{S}(f) = T_i \dfrac{\sin(\pi f T_i)}{\pi f T_i}
            \rule{5em}{0pt} % manually adjusted
                                    }
            &
    \multicolumn{2}{>{$}c<{$}|}{
            s(t) = \sigma \left(t{+}\dfrac{T_i}{2}\right) - \sigma\left(t{-}\dfrac{T_i}{2}\right)
            \ \laplace\
            \underline{S}(f) = T_i \dfrac{\sin(\pi f T_i)}{\pi f T_i}
            \rule{5em}{0pt} % manually adjusted
                                    }                                       \\
    \hhline{|--||--|}
  \end{tabularx}
\end{sidewaystable}
\end{document}

A: I would simply use a unique tabular and a strut (\rule[-12pt]{0pt}{30pt}) to enlarge the row with the formulae.
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{amsmath}
\usepackage{tabularx, multicol, graphicx, trfsigns}

\renewcommand\tabularxcolumn[1]{>{\centering\arraybackslash}m{#1}}% for vertical centering text in X column

\begin{document}
\begin{center}
\scriptsize\begin{tabular}{|c|c|c|c|}
    \hline
    \includegraphics[width=4cm]{example-image-a} & \includegraphics[width=4cm]{example-image-a} &   \includegraphics[width=4cm]{example-image-a} & \includegraphics[width=4cm]{example-image-a} \\ \hline
    \multicolumn{2}{|c|}{\rule[-12pt]{0pt}{30pt}\(\displaystyle s(t) = \sigma \left(t + \frac{T_i}{2}\right) - \sigma\left(t - \frac{T_i}{2}\right)\hfill\laplace\hfill%\undersl where is this command defined?
    \underline{S}(f) = T_i \cdot \frac{\sin(\pi f T_i)}{\pi f T_i}\)}&\multicolumn{2}{c|}{\(\displaystyle s(t) = \sigma \left(t + \frac{T_i}{2}\right) - \sigma\left(t - \frac{T_i}{2}\right)\hfill\laplace\hfill%\undersl where is this command defined?
    \underline{S}(f) = T_i \cdot \frac{\sin(\pi f T_i)}{\pi f T_i}\) }\\ \hline
  \end{tabular}
\end{center}
\end{document}


text:
Q: Change textfield height on other devices I'm currently working on an iOS application and I'm stuck..
I'm trying to create a "register-form" and I'm designing using "iPhone SE" (Cuz it seems like everyone else is doing so?) And when I'm designing on this device everything seems fine, but when I run the application the textfields seems to be way to small, and not like I want it.
(First image is a design on the iPhone SE)

(Second image is a design on the iPhone X simulator)

As you see, it looks very small on the bigger devices ex. iPhone X, XR etc etc. And I've no idea how to make it look the same on all devices. I've added constraints of course, but still not good enough. And If I attach the top constrain to the navigation bar, only that textfield will increase size. (Which is pretty damn much)
One question: Is it required to program my application to ALL iPhone devices? or is it enough with just iPhone 7-iPhoneX? Or do I need to make it good on iPhone 4 etc?  Thanks.

A: Just create UIStackView with Distribution Fill Equally, certain spacing between views and set stack view's frame/constraints.

Then add these UITextFields to this stack view.

A: use tableView and inside that use xib cell with textfield and reuse it and give the cell a height with respect to the uiscreen example:
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
            return (0.1*UIScreen.main.bounds.height)

    }