text:
Q: Spell word with images in Android Well my question is rather simple
In my layout I have a EditText and two ImageView
I type in any word EditText in two ImageView that I have to be to display images according to the letter, send it as the word of EditText call my problem arises when you want to call one letter for example:
if I enter the word "home" should go in the word and show the two ImageView image according to the letter then would show C (image C) then A (Picture A)
the problem is that I can make the process of finding one letter, I've tried with a for but only recognizes the last letter, I also tried to make a kind of delay (delay) but did not work
part of my code:
public class deletreo extends Activity {

    protected TextView tv;
    protected EditText etxt;
    protected ImageView img,img2;

    final Handler handle = new Handler();

    protected void mth(){
        Thread t = new Thread(){
            public void run(){

                try{
                    Thread.sleep(1000);
                }catch(InterruptedException e){
                    e.printStackTrace();
                }
                handle.post(proceso);
            }
        };
        t.start();
    }

    final Runnable proceso = new Runnable(){
        public void run(){
            letra();
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        tv = new TextView(this);
        setContentView(R.layout.deletreo);

        etxt = (EditText)findViewById(R.id.text);
        Button btn = (Button)findViewById(R.id.btn7);

        btn.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                mth();

            }
        });

    }//fin bundle

     private void letra()  {

        String t = etxt.getText().toString();

            char[] array = t.toCharArray();
            int p = array.length;

                for(int j=0; j<p;j++){

                    if(array[j] == 'a' || array[j] == 'A'){
                        img = (ImageView)findViewById(R.id.img);
                        img.setImageResource(R.drawable.aa);
                        img2 = (ImageView)findViewById(R.id.img2);
                        img2.setImageResource(R.drawable.image_1);
                        onStop();
                    }

                        if(array[j] == 'b' || array[j] == 'B'){
                            img = (ImageView)findViewById(R.id.img);
                            img.setImageResource(R.drawable.bb);
                            img2 = (ImageView)findViewById(R.id.img2);
                            img2.setImageResource(R.drawable.image_2);

                        }

any idea how to solve this problem?

A:
the problem is that I can make the process of finding one letter, I've
  tried with a for but only recognizes the last letter, I also tried to
  make a kind of delay (delay) but did not work

Of course, it behaves that way. Because you are putting delay for 1 second in starting and after that you are calling method letra() which sets image resource in both imageviews in a loop. So you can see only images associated with last letter.
Try it this way instead:
public class deletreo extends Activity {

    protected TextView tv;
    protected EditText etxt;
    protected ImageView img,img2;

    final Handler handle = new Handler();

    protected void mth(){
        Thread t = new Thread(){
            public void run(){

                try{
                    Thread.sleep(1000);
                }catch(InterruptedException e){
                    e.printStackTrace();
                }

            }
        };
        t.start();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        tv = new TextView(this);
        setContentView(R.layout.deletreo);

        etxt = (EditText)findViewById(R.id.text);
        Button btn = (Button)findViewById(R.id.btn7);

        btn.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                letra();

            }
        });

    }//fin bundle

     private void letra()  {

        String t = etxt.getText().toString();

            char[] array = t.toCharArray();
            int p = array.length;

            for(int j=0; j<p;j++){

            if(array[j] == 'a' || array[j] == 'A'){
                img = (ImageView)findViewById(R.id.img);
                img.setImageResource(R.drawable.aa);
                img2 = (ImageView)findViewById(R.id.img2);
                img2.setImageResource(R.drawable.image_1);
                onStop();
                    }

            if(array[j] == 'b' || array[j] == 'B'){
                img = (ImageView)findViewById(R.id.img);
                img.setImageResource(R.drawable.bb);
                img2 = (ImageView)findViewById(R.id.img2);
                img2.setImageResource(R.drawable.image_2);

            }
            mth();
        }
    }
}

Call delay function mth() after each round of loop. Hope it works.


text:
Q: Make Python GUI call specific function So I am having trouble with this code that I have made. What I want it to do is that the user inputs either "real" or "fake" and then they click the submit button and the program outputs this sentence "Your random animal is..." (It will have a random animal in the dots). What I can't get working is the get_animal function. So what this does is it outputs the response to the user. But I can't get it to work with my GUI.
Here is my code:
###### IMPORTS ######
from tkinter import *
from tkinter import ttk
import random

###### FUNCTIONS AND SETUP ######
def get_animal(lit):
    rand_animal = random.choice(lit)
    print("Your random animal is {}".format(rand_animal))

def real_or_fake(user_input):
    user_input.strip()
    if user_input == "Real" or user_input == "Fake":
        return True
    else:
        return False

def main():
    answer = animal.get().capitalize()
    if real_or_fake(answer) == True:
        if answer == "Real":
            response_text.set(get_animal(real_animals))
            play_again = input("Would you like to play again? (Y or N) ").capitalize()
            if play_again == "Y":
                main()
            else:
                exit()

        else:
            response_text.set(get_animal(fake_animals))
            play_again = input("Would you like to play again? (Y or N) ").capitalize()
            if play_again == "Y":
                main()
            else:
                exit()
    else:
        main()

# Set up lists
real_animals = ["horse", "gyrfalcon", "bull", "lion", "meerkat", "cat", "mouse", "moose", "rat", "panda", "stone fish", "anaconda", "python", "owl", "pigeon", "cow", "rabbit", "dog", "narwhal", "killer whale", "shrimp", "plankton", "liger"]
fake_animals = ["unicorn", "phoenix", "minotaur", "orge", "goblin", "hobgoblin", "dragon", "griffin", "centaur", "mermaid", "leviathan", "pegasus", "harpies", "gorgon", "hydra", "sphinx", "raiju", "godzilla", "kraken", "gremlins", "simba", "yogi bear", "bugs bunny", "bambi"]

##### GUI CODE #####
root = Tk()
root.title("Real or Fake")

# Create the top frame
top_frame = ttk.LabelFrame(root, text="Random Animals")
top_frame.grid(row=0, column=0, padx=10, pady=10, sticky="NSEW")

# Create and set the message text variable
message_text = StringVar()
message_text.set("Welcome! You can choose either a real animal or a fake animal.")

# Create and pack the message label
message_label = ttk.Label(top_frame, textvariable=message_text, wraplength=500)
message_label.grid(row=0, column=1, padx=10, pady=10)

# Create the bottom frame
bottom_frame = ttk.LabelFrame(root, text="User Input")
bottom_frame.grid(row=1, column=0, padx=10, pady=5, sticky="NSEW")

# Create and set the account details variable
animal_details = StringVar()
animal_details.set("Animal: \nWe're going to give you an animal. Would you like Real or Fake? ")

# Create the details label and pack it into the GUI
details_label = ttk.Label(bottom_frame, textvariable=animal_details, justify="center")
details_label.grid(row=3, column=1, padx=10, pady=3)

# Create a variable to store the amount
animal = StringVar()
animal.set("")

# Create an entry to type in amount
animal_entry = ttk.Entry(bottom_frame, textvariable=animal)
animal_entry.grid(row=5, column=1, padx=20, pady=5)

# Create a submit button
submit_button = ttk.Button(bottom_frame, text="Submit", command=main)
submit_button.grid(row=7, column=1, padx=100, pady=5)

#  Create the response variable
response_text = StringVar()

# Create the response label and pack it in the GUI
response_label = ttk.Label(top_frame, textvariable=response_text)
response_label.grid(row=2, column=0, columnspan=2, padx=10, pady=10)

#Run the main function
root.mainloop()

If you have any suggestions on how to make this works, that would be great thanks.

A: You need to return the value, not print it. Like so:
def get_animal(lit):
    rand_animal = random.choice(lit)
    return "Your random animal is {}".format(rand_animal)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting "can't create user databases on a --configsvr instance" error while trying to start replicaset of config server I want to create a replicaset of confiserver. For that I performed the following steps:
 1. I created two config server using the following configs:
sharding:
 clusterRole: configsvr

replication:
 replSetName: TestConfigServer1

net:
 bindIp: 127.0.0.1
 port: 27018

storage:
 dbPath: E:\Programming\MongoDBProgramming\Mongodb

sharding:
 clusterRole: configsvr

replication:
 replSetName: TestConfigServer1

net:
 bindIp: 127.0.0.1
 port: 27019

storage:
 dbPath: E:\Programming\MongoDBProgramming\Mongodb1

2. Then I connected "mongo" to the first config, and ran following commands:
rs.initiate()
rs.add( {_id: 1,host: 127.0.0.1:27019} )

This created the replicaset with 27018 port as primary.
Then after closing all the mongod servers, I tried to start the replicaset again.
I started the port 27018 first using the corresponding config file, and then I tried started port 27019 the same way. For the 27019 I got the following error:

2020-05-20T21:48:37.449+0530 F  -        [replication-0] Fatal assertion 40088 InitialSyncFailure: error cloning databases :: caused by :: Location14037: Error cloning collection '.new_enrollment' :: caused by :: can't create user databases on a --configsvr instance at src\mongo\db\repl\replication_coordinator_impl.cpp 743

Also, when connected mongo shell to the 27018 server, and checked the replicaset status, then it showed the 27018 server as secondary.
What am I doing wrong here?

Edit: Result from rs.status()
TestConfigServer1:SECONDARY> rs.status()
{
        "set" : "TestConfigServer1",
        "date" : ISODate("2020-05-20T17:03:47.950Z"),
        "myState" : 2,
        "term" : NumberLong(4),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "configsvr" : true,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "majorityVoteCount" : 2,
        "writeMajorityCount" : 2,
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(0, 0),
                        "t" : NumberLong(-1)
                },
                "lastCommittedWallTime" : ISODate("1970-01-01T00:00:00Z"),
                "appliedOpTime" : {
                        "ts" : Timestamp(1589991517, 1),
                        "t" : NumberLong(4)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1589991517, 1),
                        "t" : NumberLong(4)
                },
                "lastAppliedWallTime" : ISODate("2020-05-20T16:18:37.962Z"),
                "lastDurableWallTime" : ISODate("2020-05-20T16:18:37.962Z")
        },
        "lastStableRecoveryTimestamp" : Timestamp(1589907661, 1),
        "lastStableCheckpointTimestamp" : Timestamp(1589907661, 1),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "127.0.0.1:27018",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 3168,
                        "optime" : {
                                "ts" : Timestamp(1589991517, 1),
                                "t" : NumberLong(4)
                        },
                        "optimeDate" : ISODate("2020-05-20T16:18:37Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "could not find member to sync from",
                        "configVersion" : 2,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 1,
                        "name" : "127.0.0.1:27019",
                        "health" : 0,
                        "state" : 8,
                        "stateStr" : "(not reachable/healthy)",
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2020-05-20T17:03:46.549Z"),
                        "lastHeartbeatRecv" : ISODate("2020-05-20T16:18:37.166Z"),
                        "pingMs" : NumberLong(7),
                        "lastHeartbeatMessage" : "Error connecting to 127.0.0.1:27019 :: caused by :: No connection could be made because the target machine actively refused it.",
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "configVersion" : -1
                }
        ],
        "ok" : 1,
        "$gleStats" : {
                "lastOpTime" : Timestamp(0, 0),
                "electionId" : ObjectId("7fffffff0000000000000004")
        },
        "lastCommittedOpTime" : Timestamp(0, 0),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1589991517, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        },
        "operationTime" : Timestamp(1589991517, 1)
}

A: I'm guessing you started the first config server in a data directory that was previously used for another deployment. Start with an empty data directory.


text:
Q: How to solve this differential equation with given data? We are given a differentiable function $f$ satisfying the following conditions:
$$
\begin{split}
f(2x)&=2\dfrac{f(x)}{e^x}\\
f'(0)&=1
\end{split}.
$$
By using these conditions, we should be able to find the area bounded by $y=f(x)$ and $x$ axis, but how can we do this?

A: Consider $f(x)=xe^{-x} \rightarrow f(2x)=2xe^{-2x}$ which is equal to $2 \times f(x) \times e^{-x}$. $f'(x)=e^{-x}-xe^{-x} \rightarrow f'(0)=1$
So this function satisfies the conditions. We can find the area by taking integral.


text:
Q: click on listView subItem I'm trying to click on row in list view but my code only works when i pressed between two rows
you can see this :
http://www.screencast.com/t/2vei8yOQh
note in rep.xml i using table layout and inside it rowTable
i uses this code :
  public class LastDaysActivity extends ListActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_last_days);
    final Button newFourm = (Button) findViewById(R.id.button1);

    LastDaysAdapter adapter = new LastDaysAdapter(this, getDates(),
            getApplicationContext(), getBusID());

    setListAdapter(adapter);

    newFourm.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(LastDaysActivity.this,
                    TabHostActivity.class);
            startActivity(i);

        }
    });

}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    TextView myView = (TextView) v.findViewById(R.id.textView2);
    String text = myView.getText().toString();
    Toast.makeText(this, text + " selected", Toast.LENGTH_LONG).show();
}

edit xml :
  <?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/TableLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TableRow
        android:id="@+id/TableRow05"
        android:layout_width="fill_parent"
        android:layout_height="27dp"
        android:layout_marginTop="4dp"
        android:background="@drawable/trans01" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="رقم اللوحة" />

        <TextView
            android:id="@+id/TextView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="200dp"
            android:text="التاريخ"
            android:textSize="12sp" />

    </TableRow>

</TableLayout>


text:
Q: How do I apply an opacity gradient on a UIView? I would like my UIView to fade from 100% opacity to 0% opacity. Any thoughts on how I can do this?

A: Ray Wenderlich has a great tutorial on setting gradients for objects.  My suggestion is to modify the following code to suit your needs.
//Ray's code:
void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor,
    CGColorRef  endColor) {
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGFloat locations[] = { 0.0, 1.0 };

    NSArray *colors = [NSArray arrayWithObjects:(id)startColor, (id)endColor, nil];

    CGGradientRef gradient = CGGradientCreateWithColors(colorSpace,
        (CFArrayRef) colors, locations);

    CGPoint startPoint = CGPointMake(CGRectGetMidX(rect), CGRectGetMinY(rect));
    CGPoint endPoint = CGPointMake(CGRectGetMidX(rect), CGRectGetMaxY(rect));

    CGContextSaveGState(context);
    CGContextAddRect(context, rect);
    CGContextClip(context);
    CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0);
    CGContextRestoreGState(context);

    CGGradientRelease(gradient);
    CGColorSpaceRelease(colorSpace);
}

A: If the view, together with its labels, is sitting on some static background image or color, a quick and dirty trick is to create gradient PNGs of that image or color and place them over the view.
Otherwise, see if you can adapt this CALayer gradient mask solution for your view.


text:
Q: How to run cat6 shielded cable from rack I'm planning on running shielded cat6 cable because Ethernet will travel parallel to power on multiple occasions. The rack and patch panel they are going to will be bounded to ground. A few questions:
#1 Do the internal rack components require shielded cable that connect to the patch panel bonded keystones? (Reminder that patch panel is bonded and the cables patched in are shielded.)
#2 Do the external components (ip camera, switch, wall outlet, etc) require bonding?
#3 If a shielded patched in cable in the rack terminates to a wall outlet with a shielded keystone, does the device connected to that outlet require shielding and perhaps bonded back to ground somehow through a power source or other?
Thank you


text:
Q: Sencha ExtJs Why Return `this` from `constructor` method? Sencha Touch v2.3, ExtJS v4.1.0.
When creating a new class, why is it necessary to return this from the constructor method?
Example (from link below):
var Person = new Ext.Class({
    name: 'Mr. Unknown',

    constructor: function(name) {
        this.name = name;

        return this; // <-- HERE. Why????
    },

    walk: function(steps) {
        alert(this.name + ' is walking ' + steps + ' steps');
    }
});

var jacky = new Person('Jacky');
jacky.walk(10); // alerts "Jacky is walking 10 steps"

http://www.sencha.com/learn/sencha-class-system

A: I don't believe it is necessary, but it does make the code easier to understand as to what will happen when the constructor returns: Your newly created object will be returned to the caller. This code sample will still work even without return this;.

A: Returning this is different than using the new keyword to produce an object.  The this returned by the person function will always reference the same object.  In most cases this is going to be the global object, but, like any function, depends on the context in which it is called.
For example, take:
   function person(name) {
        this.name = name;

        return this;
    }

Say you create a new person by invoking the function, which returns this:
 var newPerson = person("Bob");

And you do it again.
var evenNewerPerson = person("Frank");

newPerson.name === "Frank" => true
evenNewerPerson === newPerson => true

Thus you are pointing to the same object.  Whereas using the new keyword will create a completely new object.
var somePerson = new Person("Sue");
var otherPerson = new Person("Sally");

somePerson === otherPerson => false


text:
Q: jQuery UI Autocomplete .result is not a function woes I've done some searching, and this seems to be a not uncommon problem, but none of the solutions posted seem to be working for me.
I've tried a few different methods:
jQuery(document).ready(function(){
    jQuery( "#on-good-terms-add-term" ).autocomplete({
        source: ongoodtermsavailableTags,
    });

    jQuery( "#on-good-terms-add-term" ).result(function(event, data, formatted) { alert(data); });
});

and
jQuery(document).ready(function(){
    jQuery( "#on-good-terms-add-term" ).autocomplete({
        source: ongoodtermsavailableTags,
    }).result(function(event, data, formatted) {
        alert(data);
    });

});
Both give me the same console error. Would appreciate any assistance. Thanks

A: To trigger an event when the user selects a search result with the jQuery UI autocomplete widget, you can initialize your constructor as follows with an event handler for "select":
jQuery("#on-good-terms-add-term").autocomplete({
    source: ongoodtermsavailableTags,
    select: function(e, ui) {
         alert("User selected: " + ui.item.value);
    }
});

A: My error was that I had the file autocomplete-rails.js as well as the provided rails.js in my assets/javascripts folder. Deleting the file was the solution


text:
Q: What is the purpose of the tracer method in Python's turtle? from turtle import Screen

screen = Screen()

screen.tracer()  # What does this tracer method do? How does it work?

It was not understandable in the Python turtle documentation.


text:
Q: How can I correctly handle this POSTed text file? I am having the most difficult time handling a file POSTed in ruby, and am using postman to send the request. The headers of the request are:
Content-Type multipart/form-data

The body looks like:
file crazyfile.txt

In my Sinartra server I am doing the following:
post '/' do
 request.body.rewind
 contents = request.body.read.to_s
 puts contents
end

The output looks like this:
---------499771616322077848081915
Content-Disposition: form-data; name="file"; filename="crazyfile.txt"
Content-Type: text/plain

holy moly
---------499771616322077848081915

How do I get an output of just holy moly?.

A: I believe you can access the filename with params[:file][:filename], and get access to a TempFile via params[:file][:tempfile]. The TempFile will allow you to operate on it as if it were, effectively, a File object, so you can access the contents via the read method (e.g. params[:file][:tempfile].read).

A: Your calling request.body which is already a string but is the body of the request, not the file attachment itself.  The attachment is passed as a parameter which would get saved as a tempfile when the request is received.
post '/' do
 request.body.rewind
 file_attachment_contents = request.params[:file][:tempfile].read
 puts file_attachment_contents
end


text:
Q: Onetomany domain mapping using azure cosmos sql api I am doing spring boot application to perform crud operation using azure cosmos db (SQL API).I need to store the data in two different tables.current it is storing into only one table. i missed mapping between those two domains.can any one help me ?
how to give one many mapping in to store the list item details in database.
currently whole data   storing listdetails table only.
@document(collection = "list_details")
public class ListDetails {
    String id;
    String name;
    List < ListItemDetails > listItems;
    //setters and getters
}

@document(collection = "list_item_details")
public class ListItemDetails {
    String id;
    String name;
    // setters and getters;
}


text:
Q: If we have 3 layers for any Nix system, where are web servers situated? I am new to Linux. I guess everyone here knows Dennis Ritchie's basic hierarchy for Unix: Kernel, Shell & Utilities.
Given a server bundle (such as LAMP) isn't part the kernel but also isn't part of its shell (Services), than on what layer is it actually?
I wouldn't say these are utilities since they have their own utilities to control them (either within the shell terminal or shell GUI which are utilities themselves).
I thus conclude that a server software is actually somewhere "between" the shell/utility layers, if we follow Ritchie's hierarchy, Would you deem that correct ?

A: The distinction between kernel and user (user = non-kernel) is very clear: they have different interfaces, they run in different processor modes, ...
Further separations inside the user realm are not so clear. A shell is a program whose job is to run other programs. By this definition, a web server may or may not be a shell depending on what it's used for: a web server that serves static files isn't a shell, a web server that runs web applications is a shell.
My advice is not to attach much importance to this hierarchy. It makes sense in one specific context (that of typical early 1970s computers), it isn't a generally useful concept.

A: I am not familiar with Ritchie's layering, but in general you put things into separate layers if one depends on the other. In UNIX/Linux, everything depends on the kernel so it should be in a layer below shell/utilities/server. But web server and shell are mutually independent (mostly, though the shell is needed for service start/stop, too). In general, layering is a subjective structuring mechanism, there's not always just one correct answer.


text:
Q: JQuery trigger element itself in a bind Can someone explain me why this snippet can't work ?
I can't use specific features like window.location, submit(), (instead of trigger()), because this function is bound to elements that are very differents.
$('a, button').bind('click', function(oEvent, oData) {
    var oButton = $(this);
    var bSkip   = (oData && oData.skip);

    if(true === bSkip) {
        return true;
    } else {
        oEvent.preventDefault();
        //oEvent.stopPropagation();

        if(confirm('This is a confirm box')) {
            $(oButton).trigger('click', { skip: true });
        }
    }
});

Thanks in advance ! ;)

A: In your case even though the click event gets fired the default behavior of the links may not be triggered because of the constraints imposed by the browser
If I understand what you are trying to do correctly(if the action s not confirmed then cancel the default behavior), then you can achieve it by the below... there is no need to fire the event again
$('a, button').bind('click', function (oEvent, oData) {
    if (confirm('This is a confirm box')) {
        return true;
    } else {
        oEvent.preventDefault();
    }
});

Demo: Fiddle


text:
Q: How to serve regional content to search engine spiders? I currently have a single domain www.mydomain.com
This performs geolocation and shows you the content that is relevant to your country.
This means that search engines also get served regional content when indexing. However, my problem is that google.co.uk is showing the U.S. content (because I identify the googlebot as in the U.S.).
What can I do about this?
How do I tell the bot that there is different content for different countries?
I don't want to have multiple domain suffixes (e.g. mydomain.de, mydomain.co.uk)
and I'd rather not use subdomains, although I will if I have to (although how does Google know that uk.mydomain.com is the UK version of us.mydomain.com and not end up listing both in both regions?)
Are there any alternatives? Do bots identify what region theyre crawling for?
Thanks

A: You can use either subdomains or subfolders (mydomain.com/uk/), but in either case you should do the following two things:

*

*Use rel="alternate" hreflang="x" on the <html> head section of your domain root for each version to specify the language and the country. Alternatively, you can do the same thing with an XML sitemap.

*Verify the different subdomains/subfolders as different "sites" in Google Webmaster Tools, and then set a geographic target for each one of them.
Hreflang example:
<link rel="alternate" href="http://mydomain.com/uk/" hreflang="en-gb" />

A: Separate domains are the best option (you can easily have multiple sitemaps etc.). This automatically gives best results in the specific search engine (yourpage.de goes to google.de).
But if you don't want this solution, your only option is to specify the language in the HTML attributes, meta tags, depeding on the (X)HTML version you use.
Besides, Google has a very good language detection algorithms. See the Google information about geotargeting
The worst option is cloaking (serving different content on the same url). If this is what you want, you may consiter something like Google Website Optimizer.


text:
Q: How can i rotate an image over its x axes in libgdx? I'm trying to rotate an image over its x axes but its not working
Texture one = new Texture(Gdx.files.internal("img/one.jpg"));
oneImg = new Image(one);
oneImg.setOrigin(oneImg.getWidth() / 2, oneImg.getHeight() / 2);
oneImg.setPosition(stage.getWidth() / 2-32 , stage.getHeight()/2);
oneImg.setScale(2f,2f);
oneImg.addAction(rotateBy(360, 0.5f));

A: You can rotate your texture right when you draw it on the batch.
SpriteBatch.draw(textureRegion.getTexture(), x, y, originX, originY, width, height, scaleX, scaleY, rotation, srcX, srcX, srcWidth, srcHeight, false, false);

So above is the exact code that you need to rotate your image in x-axis, y-axis or both.
where :
x - the x-coordinate in screen space
y - the y-coordinate in screen space

originX - the x-coordinate of the scaling and rotation origin relative to the screen space coordinates
originY - the y-coordinate of the scaling and rotation origin relative to the screen space coordinates

width - the width in pixels
height - the height in pixels

scaleX - the scale of the rectangle around originX/originY in x
scaleY - the scale of the rectangle around originX/originY in y

rotation - the angle of counter clockwise rotation of the rectangle around originX/originY

srcX - the x-coordinate in texel space
srcY - the y-coordinate in texel space

srcWidth - the source with in texels
srcHeight - the source height in texels


text:
Q: How is string is immutable and I can replace it in 'python'
*

*The first I'll write a simple program:

s = "Taxi"
output will be:
Taxi

*Then I'll replace the First index (T) To (S): but before I do anything How string is immutable and I can replace it ,, Is it immutable because the id of the first index will be take the old id ..

FOR illustration :
id(T) = 1100
and id(S) = 1100

A: The fact that the ids were the same implies that they are pointing on the same object.
String in Python is immutable, you can't assign to it's indexes values.

Immutability means that we can change the original object:
# List is mutable
l = [1, 2, 3]
# That's OK
l[0] = 5

# String is NOT mutable
s = '123'
# That's NOT OK - and WON'T work!
s[0] = '5'

The following assignment means that we create another pointer, to the same string:
S = "Taxi"
T = "Zaxi"
# The following line of code will cause 'S' point on 'T' string
# The string referenced by 'S' before has not changed! (and not available)
S = T
# Assertion will pass, as we changed S to point on T, now they point on same string
assert id(S) == id(T)

The fact that strings are immutable makes it memory-inefficient to generate new strings based on existing strings.
In C#, where strings are immutable too, there is a class called StringBuilder which mitigates this in-efficiency.
On other alternatives to StringBuilder in Python read more in this great thread.


text:
Q: AJAX https and SSL verification error I have a page that loads a div via AJAX. The AJAX POST call is made in https from a page with the protocol also https.
If I visited the page being loaded into the div directly, there are no SSL issues. If I visit the parent page before loading the div, there are no SSL issues. The error only occurs when I click a link to load the content inside the div. Suddenly, there is an error with the SSL Cert. In firefox I get the following info: "Connection partially encrypted"
What's partially encrypted? The page is fetched via https, the parent is https, both have no problems on their own...
I don't get it.

A: @durilai:
Figured it out. There was a loading image being used during the ajax call that used the http protocol. It didn't appear because it loaded so quickly. Found it in the javascript.
::shakes head::


text:
Q: Why linux route config failed with two NIC in redundancy (Primary/secondary)? I've two nic (eth0/eth1) sending data to a router.
Only one is sending data at a time. I also need a static conf that doesn't change regarding if the NIC are up/down.
If I down eth0, I expect eth1 to make the job.
But destroying eth0 destroy also my default route to the router. So I'm done.
Adding 2 default route seem to work by hand, but I don't want this solution.
So I've tried to add "full" route for eth0 and eth1?
By hand it work but I failed to add them in route-eth0 and route-eth1.
$cat route-eth0
178.12.34.240 via 10.0.10.1 dev eth0

$cat route-eth1
178.12.34.240 via 10.0.10.1 dev eth1

$service network restart
...
Bringing up interface eth1:
Determining IP information for eth1... done.
RTNETLINK answers: File exists
...

$route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
178.12.34.240   10.00.10.1      255.255.255.255 UGH   0      0        0 eth0
...

As you can see route for eth1 failed to be applied. For sure because of the File exist error.
Question:
What is the conf to set to always have correct route whatever the NIC are up or down.
Or another best practice ? What about VIP?

A: Yes, Ron metric is the answer. But I did it on a static route.
It seems having several default route should be banned.
$cat route-eth0
178.12.34.240 via 10.0.10.1 metric 1 dev eth0

$cat route-eth1
178.12.34.240 via 10.0.10.1 metric 2 dev eth1


text:
Q: AdHoc network for Nexus 5 I would like to create a pure adhoc network using Nexus 5 devices. By pure adhoc network, I mean that the devices should be able to communicate even after the access point has been turned off. I aim to create a peer to peer network to share content among devices. I have checked a number of questions related to this and have not found anything concrete. If anybody has had success doing this, please reply.

A: Standard IEEE IBSS mode (ad-hoc mode) has been disabled by google, for whatever reason. I use cyanogenmod for Nexus 5 which has this feature enabled PLUS an option to create ad hoc networks in the settings app. I think they even added an option to the WiFiConfiguration API, but I haven't tried myself. This should get you going.


text:
Q: Sending Custom Tokens Back To Client From Firebase Admin I am working with the Firebase Admin SDK for Nodejs so that I can mint custom tokens for authentication in iOS devices. In the Nodejs docs it states that you send the token back to the client after it is created.
let uid = 'some-uid';

admin.auth().createCustomToken(uid)
  .then(function(customToken) {
    // Send token back to client
  })
  .catch(function(error) {
    console.log('Error creating custom token:', error);
  });

My question is the most efficient way to do this. I've been thinking about creating Could Function to send it back in a response body but I feel like I may be over thinking it. Is this the recommended method or is there a simpler way I am missing?

A: I wouldn't worry too much about efficiency at this point. The token is small and is quick to generate.  The first thing to do is just make it work.  Use Cloud Functions if you prefer, but the Admin SDK will work on any modern nodejs backend.

A: Here is the working code from my application (cloud function) that is as simple as copy paste for your reference.
exports.getCustomToken = functions.https.onRequest(async (req, res) => {
    return cors(req, res, async () => {
        try {
                const token = await createCustomToken(req.body.uid);
                return res.json(token);

        } catch (error) {
            res.status(500).json({ message: 'Something went wrong' });
        }
    });
});

async function createCustomToken(userUid, role = '') {

       let createdCustomToken = '';

        console.log('Ceating a custom token for user uid', userUid);
        await firebaseAdmin.auth().createCustomToken(userUid)
            .then(function (customToken) {
                // Send token back to client
                console.log('customToken is ', customToken)
                createdCustomToken = customToken;
            })
            .catch(function (error) {
                console.log('Error creating custom token:', error);
            });

         return createdCustomToken;
}


text:
Q: What is reloading postfix twice at 4AM Centos 7, postfix
I get a daily reload of Postfix. It's happening twice, back to back.
Jan  8 04:02:08 tn2 postfix/postfix-script[8927]: stopping the Postfix mail system
Jan  8 04:02:08 tn2 postfix/master[10112]: terminating on signal 15
Jan  8 04:02:08 tn2 postfix/postfix-script[9011]: starting the Postfix mail system
Jan  8 04:02:08 tn2 postfix/master[9013]: daemon started -- version 3.2.2, configuration /etc/postfix
Jan  8 04:02:08 tn2 postfix/postfix-script[9030]: stopping the Postfix mail system
Jan  8 04:02:08 tn2 postfix/master[9013]: terminating on signal 15
Jan  8 04:02:09 tn2 postfix/postfix-script[9112]: starting the Postfix mail system
Jan  8 04:02:09 tn2 postfix/master[9114]: daemon started -- version 3.2.2, configuration /etc/postfix

I've looked in the cron files, I don't see anything causing it there.  I could have missed something triggering it secondarily.
I' d be grateful for some assistance finding where this is configured and what is triggering it. Pointers on where to look, etc.


text:
Q: How to use PROC TABULATE in SAS to calculate a sub-group's percentage compared to the main group? Is it possible to use PCTSUM in PROC TABULATE to calculate the what percentage a sub-group (or even a sub-sub-group) takes up compared to the overall group? It's probably best to provide an example.
Here's a sample dataset:
data sample;
input make $ model $ owned rented;
datalines;
Toyota Corolla 400 224
Toyota Camry 750 700
Honda Civic 650 519
Honda Accord 225 203
;

I know the following PROC TABULATE line will give me what percentage of vehicles are rented by make
proc tabulate data=sample;
class make model;
var owned rented;
table (make='Vehicle Make' all), owned='Total Owned'*sum rented='Rented'*(sum='Total Rented' pctsum<owned>='Pct Rented');
run;

Like so:
Veh Make  TotOwned   TotRent    PctRent
Honda     875        722        82.51%
Toyota    1150       924        80.35%
All       2025       1646       81.28%

But is it possible to break that down by model so that it tells us not what percentage of Civics are rented (519/650=79.8%) but what percentage of all Hondas are rented Civics (519/875=59.3%)?
How do I write the PROC TABULATE line so that it shows me this:
Veh Make  VehModel TotOwned   TotRent    PctRent
Honda     Accord   225        203        23.20%
          Civic    650        519        59.31%
          All      875        722        82.51%
Toyota    Camry    750        700        60.87%
          Corolla  400        224        19.48%
          All      1150       924        80.35%
All                2025       1646       81.28%

Note that the 23.2% and 59.31% of the Honda models total up to the 82.51% of the Honda subtotal.
Thanks for any help you can provide.

A: The best I can do is to split the table into pages, and use PAGEPCTSUM.  You could output this to a dataset and then re-print it (if you are using the printed output) using another PROC TABULATE or a PROC REPORT or similar.
proc tabulate data=sample;
  class make model;
  var owned rented;
  table (make='Vehicle Make'), model='Vehicle Model',
         owned='Total Owned'*sum rented='Rented'*
          (sum='Total Rented' pagepctsum<owned>='Pct Rented');
run;


text:
Q: how to defined and object collections in Jhipster? How would you do this? Let's say you have a FrontPage object that is a collection of Many Post object. But it is not any kind of collection. It is a collection made of known members: 5 latest news (LatestNews#1, LatestNews#2, ... LatestNews#5) 5 popular news, and more, up to 25 individual Post Objects.
You can have a FrontPageObject like this....
entity FrontPageConfig {
creationDate Instant required
latestNews1 Long
latestNews2 Long
latestNews3 Long
latestNews4 Long
latestNews5 Long
topNews1 Long
and so on....}

entity Post {
body TextBlob minbytes(3) maxbytes(50000) required
}

... where the Long attribute represents the id of the Post object.
But when you do it, you have to load the object in Angular and make 25 calls to the the server to call the Posts.
How can I have an FrontPageConfig object that has all the properties as defined (latestNews1) Post objects inside and that I only have to call once.
Thanks again.
PD: I tried with OneToOne relationships:
FrontPageConfig{topNews1(id)} to Post{topNews1(id)}
And OneToMany or ManyToOne:
FrontPageConfig{topNews1(id)} to Post{topNews1(id)}
But it is not a defined collection!
And this relationship OneToMany {
Post{topNews1} to FrontPageConfig{topNews1}
Does not give the object, only the id!

A: This is a good use case for Data Transfer Objects (DTOs).

*

*Create a custom API endpoint and in that method, query the database.

*Create a custom DTO object (such as FrontPageDTO) with the fields you want to return to the user interface.

*In your service class (or resource if you don't use services), make the queries through the repository to get the information you need.

*

*Query for 5 latest news and 5 top news, then map that data to the DTO fields

*Return the DTO once the fields are set


text:
Q: How can I use node-sendmail to send emails? This package crashed the server I'm using the node-Sendmail npm package in my express JS app, which is like the MVC structure. I have some weird errors, like
node_modules\sendmail\sendmail.js:291
    if (mail.to) {
             ^
TypeError: Cannot read properties of undefined (reading 'to')

Please see the image above. I tried to send the email when the login route was requested, but it sent the email after the server crashed, and this error showed. I checked their official GitHub and asked a question, but no one replied. Have you ever used a node-Sendmail package?
I checked to see if there were any errors in the node module package and code, and here is a screenshot.

I called the Sendmail with import module :

A: You're calling sendmail with no configuration on line 47, that is throwing your error


text:
Q: sass - create shorthand property from non shorthand properties does anyone know a solution - sass, npm, or whatever - to compose a shorthand form none shorthand properties?
for example:
padding-top: 10px;
pading-right: 20px;
padding-bottom: 30px;
padding-left: 40px;

should render to:
padding: 10px 20px 30px 40px;

I would prefer to explicit write all properties within my sass file but of course like to save the bytes in my css. Would be a big plus if there is also a way for background, border, ... and
cheers

A: The only way I can think of to accomplish what you're wanting is to do something like this:
@mixin shorthand($props) {
  $keys: map-keys($props);
  $main: str-slice(nth($keys, 1), 0, str-index(nth($keys, 1), '-') - 1);
  $top: map-get($props, #{$main}-top);
  $right: map-get($props, #{$main}-right);
  $bottom: map-get($props, #{$main}-bottom);
  $left: map-get($props, #{$main}-left);

  #{$main}: $top $right $bottom $left;
}

.foobar {
  @include shorthand((
    padding-top: 10px,
    padding-right: 20px,
    padding-bottom: 30px,
    padding-left: 40px
  ));

  @include shorthand((
    margin-top: 10px,
    margin-right: 20px,
    margin-bottom: 30px,
    margin-left: 40px
  ));
}

Which results in:
.foobar {
  padding: 10px 20px 30px 40px;
  margin: 10px 20px 30px 40px;
}


text:
Q: A pronoun to disrespect My mother tongue is Hindi and we have two second Pronouns तू and आप translation in English' You' they both work for second person
For example:
Disrespectful Interrogative clause in Hindi language

Why did you not go there?
  तू गया क्यों नहीं?

Respectful introgrative in  Hindi language

Why did you not go there?
  आप क्यों नहीं गये?

I'm looking for pronouns of English which are used to disrepect . If we want to disrepect anyone then we use तू You. and if we want to respect anyone, we use Also आप You. Is there pronoun to use to disrespect in the English language?

A: As others have said, we don't have a "disrespectful" second-person pronoun in English. But we do have ways of referencing you that are similar.
For example, to be rude and disrespectful in English using a similar statement,  one would probably say something like

"Hey, why didn't you get your ass over there?"

The your ass is a rude way of saying yourself in that context.
To be even ruder, with an angry, accusatory tone, one might say

"Hey, why the hell didn't you get your goddamned ass over there?"

Be careful, though. If you use such a statement, or a variation on it, you may be provoking a physical confrontation.
The important thing to observe is that disrespect is not a neutral phenomenon in English.

A: If you are asking whether modern English has different ways to say "you" to show varying levels of respect, the short answer is "no".  There is only you.
(In this English is not as flexible as other languages -- for example you might enjoy Japanese where there are perhaps a dozen ways to say "you", each with its own nuance of gender, respectfulness, historical context, and formality)
In English we do have a few honorifics which can be used to denote respect:  Mister, Sir, Missus, Miss, etc. as well as various other ways to be more respectful, but none to be less, at least not without adding modifiers like "you jerk", "you bastard", "you asshole" and so on.
Of historical interest, English used to have two forms to address someone in the second person: "you" and "thee/thou", as well as the plural "ye". In modern English, thee and thou (as well as the other forms like thy and thine) are only used in formal religious contexts, literature that reproduces archaic language, and certain fixed phrases such as "fare thee well".
For this reason, many associate the pronoun with formality, however, thee was actually the informal and you was the formal.
So since (grammatically) yelling at someone, "Get thy ass over here!" would probably going to send mixed signals, all we're left with is plain old you.

A: I read all comments below your answer and honestly, I took 2 minutes to understand what you meant, but I got there, yeah!
Your main tongue has 2 different pronouns, each one is used specifically when referring to someone in a disrespectful way or a respectful way.
As TRomano, LMS and John Feltz said, unfortunately, such pronoun hasn't yet been invented in English language. You can enjoy words (Well, I wouldn't say enjoy) such as: Jerk, dumb, idiot, stupid. Of course there are others which I'd rather not put them down here.
I presume this construction hasn't yet been invented and won't be, because English and Hindi follow different paths, English came from Latin and had other continental influences along the way, and I presume Hindi is associated and derived from sanscrito.


text:
Q: Send email alert when receiving mail on a different address I currently have 3 email addresses for various things (university, work, personal - all gmail addresses) - I'm trying to stay notified of new emails in all three, but the widely-used methods aren't right for me. As I googled, these options seem to be;

*

*Forward all mail to one address (personal makes sense)

*Use a PC / mobile application to monitor all 3 - or even use a mail client exclusively, rather than browser-based clients

The first one I don't like, simply because work/school email doesn't belong in my personal mailbox ánd there's the risk I accidentally reply to an email from said personal address. I realise I can add aliases to be able to send from my other 2 addresses, but since my work email has a load of aliasses itself, that's going to get really messy. And again, the emails don't belong there in the first place.
Now the second one sounds obvious, but I don't like it. I'm not always at my desktop or laptop, and email alerters for mobile suck up a surprising amount of power, draining the battery.
Since I'm already monitoring my personal mail on my smartphone, the ideal solution for me would be to receive an email alert on my personal mail, so I know to login to the other mail. This could be done in several ways

*

*Ideally, a built-in gmail function. I looked at gmail's filters but there's no option to send a mail when receiving a mail.

*An application that monitors the other addresses (pretty sure gmail supports both pop and imap), sends a mail to the main address, and can be run on linux. That way I can just run it on a VPS or an already running dedicated server.

Well, that's a lot of text for a simple question...
tldr;
Send email to an email-address, when receiving mail on another email-address. How I do dat?


text:
Q: Get the highest number or the next available number in a list I'm encountering a problem with assigning the next invoice line value.
I have written a piece of javascript to get the next value but somehow it is missing the next available value and still choosing the highest value.
What I need is the highest or the next available number, LineNo is what I need the highest or next of.
Code
onGridBeforeEditLines: function (e) {//grid 2
    var event123 = e;
    var lineNo = 0;
    var grid = $("#gridLines").data("kendoGrid");
    $(grid.dataSource.data()).each(function (i, v) {
        if (v != null) {
            if (v.LineNo >= lineNo)
                lineNo = v.LineNo; //Getting the highest value
        }
    });
    lineNo++;
    grid = $("#gridContracts").data("kendoGrid");
    if (e.model.PaymentPeriodID == 0) {
        var selectedItem = grid.dataItem(grid.select());
        e.model.PaymentPeriodID = selectedItem.ID;
        e.model.LineNo = lineNo; //setting the value to the grid
    }
},

Images
It seems to work fine for getting the highest number and adding 1 to it. The highest is 3, so 4 is the next available line number.

It doesn't seem to work in when finding the next available number. I have removed line no 2 so 2 should be the next available option but it still gets the highest and adds 1 to it.

Thank you in advance for help.

A: if (v.LineNo > lineNo+1) { // then we skipped a space
  // next open value is lineNo+1
  lineNo = lineNo+1;
  return false; // break loop
} else if (v.LineNo == lineNo+1) {
  lineNo = v.LineNo; //Getting the next sequential value , keep looping
} else {
  // lineNo should stay the same
}


text:
Q: When is the darkest time of day? What does darkness refer to? Light in regards to player-character visibility.
Why am I asking this? I want optimal conditions for sneaking, so I want to know what time of day I should be performing covert ops.
If you have a suggestion on how to make this question less ambiguous, please comment.

A: It depends where you are. In the East, such as Riften, it can be dark until 10:00 am, but in the far west places like Rorikstead and Helgen, dawn comes at around 4:00 am, and in the middle, like Whitrun and Dawnstar, morning comes around 8:00 am.
If you want to sneak around anywhere, though, 8:00 pm-8:00 am are usually fine.

A: i have actually figured it out,it depends on the day 9-12 would usually be the darkness but its doesn't really affect how detectable you are.

A: I don't have any hard evidence to back this, but I think that any time the sun isn't up you're in the dark. That said, you really still have to avoid light sources (fires, lanterns, etc). There's also no telling (for me anyway) if the moons cast any light. So to be safe (and roleplaying?) do your sneakiest sneaks during the new moon stages. ;)


text:
Q: `twocolumnfalse` not running onto second page I'm writing a two column article and want to have my abstract, ToC, LoF and LoT all spanning both columns.
I can do this by using the twocolumn and twocolumnfalse environments.
\documentclass[a4paper]{article}
\begin{document}
\twocolumn[
    \begin{@twocolumnfalse}
        \maketitle
        \begin{abstract}
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi faucibus lectus vel porta euismod. Ut accumsan venenatis purus vestibulum egestas. Phasellus aliquet tortor quis tortor scelerisque, in molestie turpis consequat. Aenean eleifend ligula vitae urna viverra cursus. Sed blandit nec ante non pulvinar. Cras augue libero, vestibulum sed ante eget, ullamcorper pretium ligula. Etiam commodo purus a lacus cursus dignissim. Donec maximus, nibh id posuere tempor, sapien turpis egestas tellus, vitae vulputate tortor turpis at diam. Donec mollis efficitur condimentum. Curabitur id erat varius, mattis ex ut, commodo dui. Praesent eleifend lacus tellus, consectetur consequat nibh eleifend non. Vestibulum vitae blandit erat. Quisque justo ante, auctor sed rhoncus nec, volutpat id sem. Nam vestibulum, risus sit amet efficitur euismod, libero dui tempus elit, et convallis lectus odio eu dolor. \\\\
        \end{abstract}
        \tableofcontents
        \listoffigures
        \listoftables
    \end{@twocolumnfalse}
\bigskip]
\end{document}

However, the problem arrises due to the fact that my various lists and tables mean this is over a page in length. It doesn't seem to run onto the second page, instead getting clipped. I could fix this manually by separating each list into it's own twocolumn environment and adding a manual newpage where it fit but that's far from ideal.
Any suggestions?

A: The markup you show is for making a spanning entry across the top of the start of two columns.
To set a sequence of pages one column use
\onecolumn

your single column pages

\twocolumn

the rest of the book

Or use multicols if you want to start two column mid-page

\documentclass[a4paper]{article}
\usepackage{multicol}
\title{zzz}
\author{Zzzz}
\begin{document}
        \maketitle
        \begin{abstract}
          Lorem ipsum dolor sit amet, consectetur adipiscing
          elit. Morbi faucibus lectus vel porta euismod. Ut accumsan
          venenatis purus vestibulum egestas. Phasellus aliquet tortor
          quis tortor scelerisque, in molestie turpis
          consequat. Aenean eleifend ligula vitae urna viverra
          cursus. Sed blandit nec ante non pulvinar. Cras augue
          libero, vestibulum sed ante eget, ullamcorper pretium
          ligula. Etiam commodo purus a lacus cursus dignissim. Donec
          maximus, nibh id posuere tempor, sapien turpis egestas
          tellus, vitae vulputate tortor turpis at diam. Donec mollis
          efficitur condimentum. Curabitur id erat varius, mattis ex
          ut, commodo dui. Praesent eleifend lacus tellus, consectetur
          consequat nibh eleifend non. Vestibulum vitae blandit
          erat. Quisque justo ante, auctor sed rhoncus nec, volutpat
          id sem. Nam vestibulum, risus sit amet efficitur euismod,
          libero dui tempus elit, et convallis lectus odio eu
          dolor. %no!\\\\
        \end{abstract}
        \tableofcontents

\begin{multicols}{2}
\section{zzzz}\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
faucibus lectus vel porta euismod. Ut accumsan venenatis purus
vestibulum egestas. Phasellus aliquet tortor quis tortor scelerisque,
in molestie turpis consequat. Aenean eleifend ligula vitae urna
viverra cursus. Sed blandit nec ante non pulvinar. Cras augue libero,
vestibulum sed ante eget, ullamcorper pretium ligula. Etiam commodo
purus a lacus cursus dignissim. Donec maximus, nibh id posuere tempor,
sapien turpis egestas tellus, vitae vulputate tortor turpis at
diam. Donec mollis efficitur condimentum. Curabitur id erat varius,
mattis ex ut, commodo dui. Praesent eleifend lacus tellus, consectetur
consequat nibh eleifend non. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Morbi faucibus lectus vel porta euismod. Ut accumsan
venenatis purus vestibulum egestas. Phasellus aliquet tortor quis
tortor scelerisque, in molestie turpis consequat. Aenean eleifend
ligula vitae urna viverra cursus. Sed blandit nec ante non
pulvinar. Cras augue libero, vestibulum sed ante eget, ullamcorper
pretium ligula. Etiam commodo purus a lacus cursus dignissim. Donec
maximus, nibh id posuere tempor, sapien turpis egestas tellus, vitae
vulputate tortor turpis at diam. Donec mollis efficitur
condimentum. Curabitur id erat varius, mattis ex ut, commodo
dui. Praesent eleifend lacus tellus, consectetur consequat nibh
eleifend non.
\section{zzzz}\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
faucibus lectus vel porta euismod. Ut accumsan venenatis purus
vestibulum egestas. Phasellus aliquet tortor quis tortor scelerisque,
in molestie turpis consequat. Aenean eleifend ligula vitae urna
viverra cursus. Sed blandit nec ante non pulvinar. Cras augue libero,
vestibulum sed ante eget, ullamcorper pretium ligula. Etiam commodo
purus a lacus cursus dignissim. Donec maximus, nibh id posuere tempor,
sapien turpis egestas tellus, vitae vulputate tortor turpis at
diam. Donec mollis efficitur condimentum. Curabitur id erat varius,
mattis ex ut, commodo dui. Praesent eleifend lacus tellus, consectetur
consequat nibh eleifend non. Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Morbi faucibus lectus vel porta euismod. Ut accumsan
venenatis purus vestibulum egestas. Phasellus aliquet tortor quis
tortor scelerisque, in molestie turpis consequat. Aenean eleifend
ligula vitae urna viverra cursus. Sed blandit nec ante non
pulvinar. Cras augue libero, vestibulum sed ante eget, ullamcorper
pretium ligula. Etiam commodo purus a lacus cursus dignissim. Donec
maximus, nibh id posuere tempor, sapien turpis egestas tellus, vitae
vulputate tortor turpis at diam. Donec mollis efficitur
condimentum. Curabitur id erat varius, mattis ex ut, commodo
dui. Praesent eleifend lacus tellus, consectetur consequat nibh
eleifend non.
\section{zzzz}\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
faucibus lectus vel porta euismod. Ut accumsan venenatis purus
vestibulum egestas. Phasellus aliquet tortor quis tortor scelerisque,
in molestie turpis consequat. Aenean eleifend ligula vitae urna
viverra cursus. Sed blandit nec ante non pulvinar. Cras augue libero,
vestibulum sed ante eget, ullamcorper pretium ligula. Etiam commodo
purus a lacus cursus dignissim. Donec maximus, nibh id posuere tempor,
sapien turpis egestas tellus, vitae vulputate tortor turpis at
diam. Donec mollis efficitur condimentum. Curabitur id erat varius,
mattis ex ut, commodo dui. Praesent eleifend lacus tellus, consectetur
consequat nibh eleifend non.
\section{zzzz}\subsection{xggg}xxx\subsection{xggg}xxx\subsection{xggg}xxx
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
faucibus lectus vel porta euismod. Ut accumsan venenatis purus
vestibulum egestas. Phasellus aliquet tortor quis tortor scelerisque,
in molestie turpis consequat. Aenean eleifend ligula vitae urna
viverra cursus. Sed blandit nec ante non pulvinar. Cras augue libero,
vestibulum sed ante eget, ullamcorper pretium ligula. Etiam commodo
purus a lacus cursus dignissim. Donec maximus, nibh id posuere tempor,
sapien turpis egestas tellus, vitae vulputate tortor turpis at
diam. Donec mollis efficitur condimentum. Curabitur id erat varius,
mattis ex ut, commodo dui. Praesent eleifend lacus tellus, consectetur
consequat nibh eleifend non.

\end{multicols}
\end{document}


text:
Q: How to create relationship in neo4j fast Today I have create 591,113 nodes in my neo4j. Then I want create relationships on them using following code:
MATCH (A), (B)
WHERE A.value = B.value
CREATE (A)-[:SameValue]->(B)

But this took me for hours(and I have to terminate it before it finish).
And I want to ask how to create relationship on a big amount of nodes fast?

A: You could try:
MATCH (a:UseLabels)
WITH a
MATCH (b:UseLabels{value:a.value})
CREATE (a)-[:SameValue]->(b)

It only matches values that match and avoid the cartesian product.

A: Do you have indexes on the value properties?
This also might work better (still, indexes are important):
MATCH (a:A) WITH a
  MATCH (b:B {value: a.value})
  CREATE a-[:SameValue]-b


text:
Q: Persistence Pattern - Rule based Observer I'm trying to add functionality to an app where a user can subscribe for changes made either:

*

*To another entity (by any user)

*By another user (to any other entity)

*A combination of the two (this last one's optional, but makes the problem more challenging)

I'm wondering how best to persist these rules to the database.
I'm naturally tending towards for each given entity (including the user itself), I add an addition UserSubscription table / entity (eg, PublisherUserSubscription, BookUserSubscription, UserUserSubscription)
This means that subscriptions will be persisted with integrity enforced.  However, it seems that this can quickly baloon in terms of the number of tables I'll need, and can lead to a very brittle design, should I later change the subscription model.  (Every existing table could need to be updated).
Given this is a fairly commonplace real-world scenario, I'd expect there'd be some patterns around this.  Can anyone suggest some?

A: I hate to suggest the Entity/Attribute/Value pattern, but why not have a simple table such as:
rulename    Observer   ObjectClass  ObjectId
========    ========   ===========  ========

One table for each scenario ObjectToUser/UserToObject ?
If you want to have a particular entity be observed, say a particular book, have the Object's Primary Key be added to the EAV pattern.
Then if you need to check if a rule is fired, you query on "ObjectId" from "ObjectClass" from your table and fire whatever rule is listed.


text:
Q: Many USB 3.0 devices on a single Ubuntu via a powered HUB I tried connecting multiple usb 3.0 enabled devices to my ubuntu 12.04 machine. But found out that at a time not more than 9 devices could be seen connected. I tried monitoring the kernel logs at /var/log/kern.log, where i found out that on connecting the 10th device, the below error was there:

this device cannot find enough free resources that it can use. (code
  12)

My USB Host Controller is:

Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev
  05)

Some forums have suggested disabling the USB 3.0 support should force the devices to work in USB 2.0 mode, and it should solve the problem. And this was true. Disabling xHCI support from BIOS did the trick for me.
I assumed this should be a bug on the older Ubuntu 12.04 setup(or the usb driver may be). Therefore, i upgraded my system to Ubuntu 16. But here also the same problem exists. What if i want to use my devices with USB 3.0? What if the option to disable xHCI support from BIOS is not present on some motherboard?

A: A controller has internal buffers that it allocates for the connected devices
for the purpose of doing input and output.
These buffers are also called resources or endpoints.
Faster devices need to have allocated more buffers to contain more data.
This number can vary per device, but the maximum is 32 endpoints with 16 in and 16 out per device.
There are reports that the Intel 8 Series USB 3.0 XHCI host controller only supports 96 endpoints, and practical limits can be hit earlier.
From the information in your post, I would guess that each USB3 disk uses
10 endpoints aka. resources, probably 5 in and 5 out.
Therefore 9 disks used 90 endpoints which was fine,
but 10 disks require 100 endpoints that exceeds the limit of 96,
hence the controller sent an error code to the operating system.
When you degraded the connection to the slower USB2,
the controller allocated much less buffers for each device,
therefore you could connect more disks.
The solution might be to add a USB2 hub
and put on it the disks that do not need high transfer rates.
Further reading :

*

*USB endpoints and their pipes

*Not Enough USB Controller Resources?

A: The previous answer is almost correct.
There is a limit if 96 endpoints with USB3 which limits you to fewer than 32 devices.
Using a USB2 hub does not fix that however because you're still using the USB3 chip in USB2 mode, and the endpoint limit remains the same, sadly.
I dealt with this problem too and it took me a while to find the real problem and solutions. It's a long page, so you can go read it there http://marc.merlins.org/perso/linux/post_2018-12-20_Getting-Around-USB3-xhci-32-Device-Limit-Max-number-of-devices-this-xHCI-host-supports-is-32.html
Basically, it boils down to these things
1) there is a 96 endpoint limit with USB3 (which translates to 32 devices only)
2) you lose further endpoints due to hubs, using a USB2 cable to a USB3 hub gives you a few slots back
3) more generally you should disable USB3 if you can do without it (remove the USB3 kernel driver, or easier if you can, disable USB3 in your bios). Using a USB3 chip in USB2 mode does not help, you have to disable the USB3 so that your motherboard reroutes the port to a USB2 controller that doesn't have that endpoint limit
4) if you cannot disable USB3, get a USB2 only PCIe card and that one will truly give you 120 devices or so.
Further resources:
https://www.spinics.net/lists/linux-usb/msg175224.html
https://forums.intel.com/s/question/0D50P00004905stSAA/hardware-limitations-on-usb-endpoints-xhci?language=en_US


text:
Q: how to reset root password in phpmyadmin using xampp server HI Any one can help me that how i can reset my phpmyadmin root password.
when i am going to open localhost/phpmyadmin i got this error..

"
   Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user 'root'. "

and when i click on user to change my password i face this error

Error : Token mismatch

I also try this method:
After started  XAMPP server, i go to the browser and type the URL localhost/security/ (incase you've modified XAMPP server port, you need to include that port number also in previous URL). The security page will be shown where you can change the root password for MySQL. This will update the phpMyAdmin config also.
i have follow this method but i cannot solve my problem plz help me out this problem

A: Go to \xampp\phpMyAdmin\config.inc.php
then
$cfg['Servers'][$i]['password'] = 'WhateverPassword';//near line 21

or Run this command
mysqladmin.exe -u root password 'WhateverPassword'

And Possible Duplicate of Resetting MySQL Root Password with XAMPP on Localhost


text:
Q: Approximating BV Function by Piecewise Constant Functions
Let $[a,b] \subset \mathbb{R}$ be a bounded interval. A function $f:
> [a,b] \to \mathbb{R}$ is of bounded variation if  $\sum_{i =
> 1}^{n}|f(x_i) - f(x_{i+1})| \leq C$ for all partitions
  $\{x_1,\ldots,x_n\}$ of $[a,b]$. Let \begin{equation} [f]_{BV} :=
 \sup_{\text{partitions}}\sum_{i = 1}^{n}|f(x_i) - f(x_{i+1})|
\end{equation} denote the BV seminorm.

What I was wondering is the following:

Do there exist piecewise constant $f_k$ such that $[f_k - f]_{BV}
 \to 0$?

I know there exists piecewise constant $f_k$ satisfying $[f_k]_{BV} \to [f]_{BV}$, but I was wondering if the stronger result holds too. (Intuitively, it seems like it should hold, but I can imagine there may be some pathological counterexample out there.)

A: No. If $f$ is BV, right continuous and satisfies $f(-\infty)=0$ then there exists a complex measure $\mu$ so $f(x)=\mu((-\infty,x])$. The BV seminorm is the same as the total variation norm $||\mu||$.
If $f$ is piecewise constant then $\mu$ is a linear combination of point masses. So your question is equivalent to asking whether a complex measure can be approximated in norm by a linear combination of point masses, and the answer to that is no.


text:
Q: Primefaces Datatable column selection I want to know how do I get a column selection
I have the following datatable
<p:dataTable id="DataTable" value="#{dataTable.selecDataModel}" var="test" scrollable="TRUE" scrollHeight="500" styleClass="day-column2" selectionMode="single" >
    <p:column headerText="Column1" footerText="Column1" width="450">
        <h:outputText value="Test1" />
    </p:column>
    <p:column headerText="Column2" footerText="Column2" width="450">
        <h:outputText value="Test2" />
    </p:column>
 </p:dataTable>

The p:ajax only support row selection, if I would like to know which column is selected, how do I get the same.

A: You can find out the index of the selected column with jQuery and send it to server as an ajax event
here is a way:
first add an inputText above the table (make it hidden)
<h:inputText id="mySelectedColumnId" value="#{myBean.mySelectedColumnField}" style="display:none">
    <f:ajax listener="#{myBean.myListener}"></f:ajax>
</h:inputText>

and the following js code to bind clicking on the table and triggering click on the h:inputText which will trigger listened on the server
jQuery(document).delegate("#yourTableID td", "click", function (event) {//bind every click on any td in the table
    var columnNumber = jQuery(this).index();//get index of clicked row
    jQuery("#mySelectedColumnId").val(columnNumber); //set value in the inputtext
    jQuery("#mySelectedColumnId").change(); //this will trigger the ajax listener
});

Update
What I actually meant was the following structure:
<h:outputScript name="js/newjavascriptfile.js" target="head" />

.
.
.
.

<h:form prependId="false">
     <h:inputText id="mySelectedColumnId" value="#{myBean.mySelectedColumnField}" style="display:none">
         <f:ajax listener="#{myBean.myListener}"></f:ajax>
     </h:inputText>
     <p:dataTable id="DataTable"....
.
.
.
.

and inside the js (place it inside js folder inside resources folder in the root of your web app folder Resources (Library) In JSF 2.0) file place
jQuery(window).load(function () {
     jQuery(document).delegate("#yourTableID td", "click", function (event) {//bind every click on any td in the table
        var columnNumber = jQuery(this).index();//get index of clicked row
        jQuery("#mySelectedColumnId").val(columnNumber); //set value in the inputtext
        jQuery("#mySelectedColumnId").change(); //this will trigger the ajax listener
    });
});


text:
Q: does a positive real multinomial always achieve its minimum? Let $f(x,y) \in \mathsf{R}[x,y]$ be a polynomial function with real coefficients in two variables.
Assume that $f(x,y)>0$ for all $x,y \in \mathsf{R}$.
Does $f$ have a minimum?
$$\exists x^*,y^* \in \mathsf{R} \
\forall x,y \in \mathsf{R} \
f(x^*,y^*)\leq f(x,y)$$

This was asked by a colleague.
For single variable, it is easy to see that the largest power will dominate for large enough x, and since it is always positive, the coefficient cannot be negative and the power cannot be odd.
Therefore we can find a $c$ such that for all values of $|x|>c$, the $f(x)>f(c)$. Then we can take $\bar{B}_c = \{x \in \mathsf{R} | |x| <= c\}$ which is compact, and since a continuous function over a compact set has a min, the answer would be yes.
So if the answer is no, it should rely on having two variables.


text:
Q: Nature of Stasis in Passengers At the end of the film we discover:

 The autodoc can put a patient into a statis state which is explained to be equivalent to hibernation. The name difference is why they didn't find it before. However, only one of the two conscious passengers could use this device to survive to see Homestead 2.

Why could only one person do this?  My wife and I both thought the answer was obvious but had differing explanations.  I am curious what the writers intended.

*

*She thought external access was required for operation.

*I thought transfer to an equivalent long term storage device was impossible and it was a singular piece of equipment.

*While discussing it, we realized such a transfer could be necessary but require manual operation.

A: The dialogue indicates that the autodoc is designed for a single occupant

Jim: Inside the autodoc, you can go back to sleep.
Aurora: But there's only one autodoc

No explanation is given why this would be the case (nor why they couldn't jerry-rig the autodoc to manage two hibernation sequences) but I think we can assume that Jim investigated the possibility and ruled it out.
Note that it's Aurora who brings up the objection to it being used for two people, strongly implying that it's common knowledge that an autodoc can only be used on one person at a time.

As an aside, it should be noted that this isn't the same sort of hibernation that we see the other passengers enjoying, it's actually a different procedure that actively uses the autodoc to suspend the patient's metabolic activity, a distinction without a difference as far as Jim and Aurora are concerned.


text:
Q: How to use KoolPHP Suite in CakePHP? hi i am using KoolPHP suite for UI components like grid, tree, calander, tabs to use in cakephp. But some how they are appearing on the webpage but are not accessible. Does any one have idea how to make it work. This is my code to use KoolPHP Tabs:
<?php
                require "vendors/KoolControls/KoolTabs/kooltabs.php";
                $kts = new KoolTabs("kts");
                $kts->styleFolder = "vendors/KoolControls/KoolTabs/styles/silver";

                $kts->addTab("root", "dashboard", "Dashboard", "", true);

                $kts->addTab("root", "admin", "Admin", "admin");

                $kts->addTab("root", "setup", "Setup", "setup");
                $kts->addTab("setup", "users", "Users", "");
                $kts->addTab("setup", "warehouses", "Warehouses", "");
                $kts->addTab("setup", "brands", "Brands", "");
                $kts->addTab("setup", "pos", "POS", "");

                $kts->addTab("root", "stock", "Stock", "stock");
                $kts->addTab("root", "products", "Products", "product");
                $kts->addTab("root", "reports", "Reports", "report");
                $kts->addTab("root", "orders", "Orders", "orders");
                $kts->addTab("root", "help", "Help", "help");

                echo $kts->Render();
?>

A: So stupid. The problem was with URL rewriting in CakePHP's .htaccess file and now everything works fine. Sorry for bothering you guys.


text:
Q: How is it calculated how many trophies are won at end of match? How is it calculated how many trophies an attacker wins (or looses) at the end of the match? I ask because I'm wondering does it ever make sense to "end battle" early, or is it better to let all deployed troops to destroy as much as possible to increase the trophies count?
For example I've seen people end games when only giants are remaining and they end the battle because giants can't attack the resources. Does this logic make sense or should they let the giants takeout as much defense as possible to increase bonus and trophy count?

A: For starters, this answer for How are the total possible trophies awarded determined? is closely related. But it's missing a detail that I think you're actually trying to ask.
You are awarded a portion of the available trophies based on the number of stars you earn during the battle. You earn 1 star for destroying the Town Hall of the base, 1 star for destroying 50% of the base, and 1 more star for destroying 100% of the base.
So, let's say you've launched a raiding attack on a resource-rich base that is worth 30 total trophies. This means you'll get 10 trophies for each star you earn. You've snagged all of the resources you are interested in and you're open to ending the attack early. You've dealt 46% base damage so far. If you stay in the attack a bit longer and do only 3% extra damage, then you'll not earn any additional stars at only 49%, so you won't earn any extra trophies. If you do 4% extra damage instead, then you'll reach 50% damage done, which is an extra star and you'll earn 10 trophies.
Situationally, this probably depends if you've already destroyed the Town Hall or not. If you've destroyed the Town Hall already, then you've already earned 1 star and completed a successful attack. So, you'll earn the successful attack resource bonus for the league you're in and the extra trophies you'd earn aren't really a big deal. If I've yet to earn any stars, I'll usually let the attack ride on the off-chance that I can reach 50% and earn the bonus resources.
But, is there a reason why some would want to actively avoid earning more trophies?
Yes there is. Many long-time players target certain leagues to be in for either raiding or resource defending purposes. Certain Town Hall levels will prefer to be placed in certain leagues in order to see more desirable bases to attack, or be in a pool of players that could do little damage in an attack. If you're earning extra trophies that you don't really want, then you'd have to launch attacks just to purposely lose and shed trophies to keep your spot in your preferred league. Or, you could just avoid earning trophies you don't really need.


text:
Q: laravel - sortBy() not working properly I have collection with subcollections like:
+
+--- name: 1a8 Lorem Ipsum
+
+--- name: 1a2 Lorem Ipsum
+
+--- name: 1a10 Lorem Ipsum

and now I want to sort it by this name:
$collection->sortBy('name')

It should be:
1a2 Lorem Ipsum
1a8 Lorem Ipsum
1a10 Lorem Ipsum

but I'm getting:
1a10 Lorem Ipsum
1a2 Lorem Ipsum
1a8 Lorem Ipsum

Why? I have tried too with $collection->sortBy('name', SORT_NATURAL, false) but it's same effect.

A: What might be happening is that because your values are starting with an integer, is that they are turned into an integer value. That means anything after the first non-numeric character is discared. In your case you're left with 3 1's
You might want to use a custom sorting callback that implements strnatcmp
$collection->sort(function($a, $b) {
   // using 3 = for type and value comparisan.
   if($a->name === $b->name) {
      return 0;
   };
   return strnatcmp($a->name, $b->name);
});

A: The solution is already in the answer by @Tschallacka. if you want an explanation of why is this happening let me explain.
The function sortBy is receiving a string. String sorting is analyzed column by column (char position by char position). Integer or numeric type sorting, is analyzed by value.
So if we try to sort: 1,2,3,4,5,6,7,8,9,10,11,12,13... as string we would get something like: 1,10,11,..2,20,21.
Since you are mixing both, you need a solution like the one given already.


text:
Q: How to represent array literals in VHDL? I have the following type declarations:
type cachesubset is record
                      tag     : std_logic_vector(3 downto 0);
                      word0   : w32;
                      word1   : w32;
                      dirty   : std_logic;
                      valid   : std_logic;
                    end record;

type    cacheset is record
                      lru : std_logic;
                      subsets: array(0 to 1) of cachesubset
                    end record;

I want to define the empty cacheset constant:
constant
empty_cachesubset : cachesubset := (
                                    tag   => "0000",
                                    word0 => "00000000000000000000000000000000",
                                    word1 => "00000000000000000000000000000000",
                                    dirty => '0',
                                    valid => '0'
                                   );

constant
empty_cacheset    : cacheset    := (
                                    lru     => '0',
                                    subsets => ???
                                   );

The point is that I do not know how to create an array literal.
Some notes...
Please, do not mind the fact that I am using two separate fields to address words in a subset while I might do the same for a cacheset and the subsets... the point is that I will also apply an array for words in a subset...

A: You can do this like this:
library ieee;
use ieee.std_logic_1164.all;

package test is
    subtype w32 is std_logic_vector(31 downto 0);

    type cachesubset is record
        tag   : std_logic_vector(3 downto 0);
        word0 : w32;
        word1 : w32;
        dirty : std_logic;
        valid : std_logic;
    end record;

    type subsetst is array (0 to 1) of cachesubset;

    type cacheset is record
        lru     : std_logic;
        subsets : subsetst;
    end record;

    constant empty_cachesubset : cachesubset := (
        tag => (others => '0'),
        word0 => (others => '0'),
        word1 => (others => '0'),
        dirty => '0',
        valid => '0'
    );

    constant empty_cacheset : cacheset := (
        lru         => '0',
        subsets     => (
            0 => empty_cachesubset,
            1 => (
                tag => (others => '0'),
                word0 => (others => '0'),
                word1 => (others => '0'),
                dirty => '0',
                valid => '0'
            )
        )
    );
end package test;

A: subsets => ???

The simplest way is to set every entry in the array to the same value...
subsets => (others => empty_cachesubset);

As the other answer shows, you can set individual elements to different values - then use "others" to default the rest.


text:
Q: How to delete a Minecraft profile on new 2017 launcher? How do I delete a Minecraft profile on new 2017 launcher?

A: To delete a profile, first go to Launch options. Click on the profile you wish to delete and in the top right there should be a delete button. Press that to delete the profile.


text:
Q: Gravity forms custom field mask - escaping a "9" Am having a positive experience whilst using Gravity forms on Wordpress as a whole. However, I am adding a field mask to an input and encountering a small problem.
Every 16 digit account number starts 001191, and we want the customer to be able to input their account number (and not one of the few other identifying numbers associated with them!) into this form.
So, I have that (001191) as a placeholder and a custom mask like this:
0011919999999999
The trouble is, I would like to have that first 9 as part of the custom mask, but can't find a way of escaping it successfully.
I've tried using backslash before it, using quote marks and double quotes, but no joy so far.
Has anyone had a similar problem and found a neat way of resolving this, please?

A: Gravity Forms' uses this script to power our inputs masks (this will change in a future version; version at the time of writing is GF2.3).
https://github.com/digitalBush/jquery.maskedinput
You can add an HTML field to your form and setup a custom definition like so:
<script>
jQuery(function($){
   $.mask.definitions['~']='[9]';
});
</script>

In this example, you would use '~' in your input mask to represent a literal 9.
Edit
If you want to override the default definition, something like this should work:
<script>
jQuery(function($){
   delete $.mask.definitions['9'];
   $.mask.definitions['n'] = '[0-9]';
});
</script>

Then you could use a literal 9 in your mask. The second line replaces the '9' definition with n so you can use n in your input mask to require a number 0 - 9.
Edit II (Nov 11, 2021)
GF 2.5 introduces some order-of-events changes that are challenging to work around. The easiest way to do this now is to reinitialize your mask after overriding the preset definitions.
delete $.mask.definitions['9'];
$.mask.definitions['n'] = '[0-9]';
$( '#input_{formId}_{fieldId}' ).mask( 'nn-99-aaa' );

There's definitely a way to avoid this but I don't have the time to dig in this morning.

A: Currently using GravityForms 2.6.7, this solution references the 'gform_input_mask_script' function here: https://docs.gravityforms.com/gform_input_mask_script/ as well as reworking Dave from Gravity Wiz example above. This example is applied to more than one form field - ID 214 (example account number) and ID 175 (phone number field) and placed within function.php file:
add_filter( 'gform_input_mask_script_45', 'custom_validation_mask', 10, 4 );
function custom_validation_mask( $script, $form_id, $field_id, $mask ) {
  $script = "jQuery(function($){
    delete $.mask.definitions['9'];
    $.mask.definitions['x'] = '[0-9]';
    $('#input_45_214').mask( '9xxxxxxxxxxxZxxxxxxxxx' );
    $('#input_45_175').mask( 'xxxxxxxxxx' ); });";

return $script;
}


text:
Q: Calling functions in postgres like the package in Oracle {call schema_name.package_name.function(?,?,?,?,?,?) with placeholders Converting a package from oracle to POSTGRES But POSTGRES does not support the package so firstly convert the packages to function through Ora2pg tool.
Situation is That the package is being called from the java code as
{call schema_name.package_name.functionName(?,?,?,?,?,?)} in ORACLE

COULD I ABLE TO CALL THE sAME FROM THE JAVA CODE AS WITH  placeholder

{call schema_name.functionName(?,?,?,?,?,?)} in postgres

When i am running it in java then the placeholder for string type is being converted into unknown type in postgres.
setString(2,"action");

of CallableStatement not able to convert it into varchar type but to unknown type
Problem is that setString in postgres is converting to unknown type


text:
Q: UIImagePickerController to select image or video I want the user to be able to select image or video at the same time.The code below allows me to only select video not an image.
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
        picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        //picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];

A: Then you have use ALAsset library classes and use your own custom UI to display the assets.


text:
Q: Setting up a web server on Windows Vista Business What I want to do is simple.  I have two PCs on a home network: One Windows Vista Business edition with IIS 7 where I develop a web site.  I want to be able to access that web site from a Windows 7 PC. So far this is what I have:

*

*I made sure that I could access the Windows 7 PC from the Windows Vista PC. Network discovery seems to have found the Windows 7 PC and I have been able to access the public files of that Windows 7 PC from Windows Vista in Windows Explorer.

*I would love to access the Windows Vista public files from the Windows 7 PC.  But I explored 'Network' in Windows Explorer that PC doesn't seem to find the Vista PC. This might point to a problem that explains the web access issues.

*On the Vista PC, I made sure to allow exceptions through the firewall. I have opened the http port 80.  I have also selected World Wide Web Services as an exception.  I tested different scenarios: setting the exception for all PC on my network, and also for the specific IP address of the Windows 7 PC.
After having done all of that I can't access the Vista PC IIS server from the Windows 7 PC.  The Vista PC doesn't respond to the http request.
I have Windows Security Essentials installed on the Vista PC to scan files.  Of course, I have the firewall turned on.  Other than that as far as I know I didn't specifically install additional security features.
I don't plan to make this web server accessible outside of the home network. So there must be a safe way for me to be able to share this IIS server between the two PC.  Is there is step that I was unaware of to have this.  The PC are connected through the ISP wireless router.  They each have their IP address, and I have been attempting to access the Vista server from Windows 7 using the Vista IP address, e.g. 192.x.x.x:84/page.PHP.

A: If you open a port for World Wide Services but place your website at port 84, the firewall is going to block it.  It has no idea that you now are also servicing http request on port 84 also.


text:
Q: How can build android app using ionic framwork old version? One year before i install ionic framework and build one android app, that app is running sucessfully still now. But now i want some more enhancement for this app, so i am install ionic framework in another system and run the ionic cordova build android command in that project directory,  but it will throw below error.

[WARN] ionic.project file found in C:\xampp\htdocs\officeapp--please rename it to ionic.config.json, or your project
         directory will not be detected!
[ERROR] Unable to find command: cordova build android
          You may need to be in an Ionic project directory.
Project Commands:
   You are not in a project directory.

In that project directory there is no ionic.config.json. So i am install new project and compare the files in the new project i found ionic.config.json. And i compare bower.json files there is some version change, so i thing the version is the problem.
Old project bower.json
{
 "name": "HelloIonic",
 "private": "true",
 "devDependencies": {
  "ionic": "driftyco/ionic-bower#1.3.1",
  "platform.js": "platform#^1.3.1"
 },
 "dependencies": {
  "angular-messages": "1.3.6"
 }
}

Newly created todo project
{
 "name": "HelloIonic",
 "private": "true",
 "devDependencies": {
  "ionic": "driftyco/ionic-bower#1.3.3"
 }
}

Please help anyone how can build app with old code, because all are working fine i want minmal change for this app.

A: As per your question explanation I see you are entering wrong command to build ionic project for the android platform.

[ERROR] Unable to find command: cordova build android You may need to
  be in an Ionic project directory.

Use following commands to build ionic project,
ionic build android

For more help please check here for basic of Ionic.
Hopes this will help you !!


text:
Q: transferring wordpress blog posts from one blog to other including images I want to move all the blog posts from one wordpress installation to other, I know about the Import/Export option but that does not transfer images, I need to transfer the images.
Please ideas would be helpful

A: This answer from the Wordpress Forum outlines a good way to do this:
http://wordpress.org/support/topic/migrating-blog-images-to-brand-new-wordpress-site-database
In short, all of your images live in wp-content/uploads. You'll need to combine the uploads folder from your old installation with the uploads folder in the new one, and then change the image URLs within the posts themselves.
It's a bit of a pain, and definitely would be a nice-to-have for them to include images in future versions of the import/export function.


text:
Q: How to show the preview of epub file (ipad and kindlefire) in a web page? In my project, users can write books online and save it as a  epub file. I need to implement a functionality which enables the user to see the preview of epub file. There will be two tabs  in preview page. One is for kindlefire and other is for ipad. I have saved all the datas (XHTML, css, content, etc) of epub file in the database. The preview should give the exact look of the book in kindlefire and ipad. Is it ok to use normal html and css to generate preview of book ? If there is any other straight forward method for this, please suggest me

A: I think that you shouldn't aim for the EXACT look on those devices, instead just view the html and css (of course, test it on those devices anyway). People usually don't mind if there are small differences like gaps or paddings somewhere, the main thing is text anyway. Unless, of course, you have difficult tables and media content.


text:
Q: Add multiple buttons in each row of tableview but doesn't work Hi guys I'm a beginner in IOS development. I have created a tableview with 3 buttons in each row. And  I have coded a method for one of the buttons. It turns out the button only works in the last row. Please help me with this.
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
UITableViewCell *cell;
NSInteger row = [indexPath row];
......
startButton = [UIButton buttonWithType:UIButtonTypeSystem];
pauseButton = [UIButton buttonWithType:UIButtonTypeSystem];
stopButton = [UIButton buttonWithType:UIButtonTypeSystem];
[pauseButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[stopButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startButton setBackgroundImage:[UIImage imageNamed:@"tianlanse.png"] forState:UIControlStateNormal];
[pauseButton setBackgroundImage:[UIImage imageNamed:@"lianglv.png"] forState:UIControlStateNormal];
[stopButton setBackgroundImage:[UIImage imageNamed:@"qianhong.png"] forState:UIControlStateNormal];

startButton.frame = CGRectMake(522.0f, 26.0f, 65.0f, 50.0f);
pauseButton.frame = CGRectMake(443.0f, 26.0f, 65.0f, 50.0f);
stopButton.frame =  CGRectMake(603.0f, 26.0f, 65.0f, 50.0f);

stopButton.hidden = YES;
pauseButton.hidden = YES;

startButton.tag = indexPath.row+1001;
pauseButton.tag = indexPath.row+2002;
stopButton.tag = indexPath.row+3003;
 [startButton setTitle:@"Start" forState:UIControlStateNormal];
[cell addSubview:startButton];

[pauseButton setTitle:@"Pause" forState:UIControlStateNormal];
[cell addSubview:pauseButton];

[stopButton setTitle:@"Stop" forState:UIControlStateNormal];
[cell addSubview:stopButton];
}
[startButton addTarget:self action:@selector(StartbuttonClicked:) forControlEvents:UIControlEventTouchUpInside];
......
}

-(IBAction)StartbuttonClicked:(id)sender{
NSUInteger row = ((UIButton *)sender).tag-1001;
NSLog(@"start button clicked,Row:%lu",(unsigned long)row);

[stopButton viewWithTag:((UIButton *)sender).tag+2002].hidden = NO;
[pauseButton viewWithTag:((UIButton *)sender).tag+1001].hidden = NO;
[startButton viewWithTag:((UIButton *)sender).tag].hidden = YES;
}

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section
{
return tableCellCount;//tableCellCount is set to be 4 in viewdidload
}

Only in the last row, the button works. I tested the tag for each button. It's valid;
2014-02-09 15:38:31.919 Weight Training[336:60b] 1001,2002,3003
2014-02-09 15:38:31.921 Weight Training[336:60b] 1002,2003,3004
2014-02-09 15:38:31.923 Weight Training[336:60b] 1003,2004,3005
2014-02-09 15:38:31.925 Weight Training[336:60b] 1004,2005,3006

A: You should create buttons for each row in a tableView programmatically or create custom cell via storyboard.
First way:
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
UITableViewCell *cell;
NSInteger row = [indexPath row];
......
UIButton *startButton = [UIButton buttonWithType:UIButtonTypeSystem];
[startButton addTarget:self action:@selector(startButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
UIButton *pauseButton = [UIButton buttonWithType:UIButtonTypeSystem];
[pauseButton addTarget:self action:@selector(pauseButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
UIButton *stopButton = [UIButton buttonWithType:UIButtonTypeSystem];
[stopButton addTarget:self action:@selector(stopButtonClicked:) forControlEvents:UIControlEventTouchUpInside];

[pauseButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[stopButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startButton setBackgroundImage:[UIImage imageNamed:@"tianlanse.png"] forState:UIControlStateNormal];
[pauseButton setBackgroundImage:[UIImage imageNamed:@"lianglv.png"] forState:UIControlStateNormal];
[stopButton setBackgroundImage:[UIImage imageNamed:@"qianhong.png"] forState:UIControlStateNormal];

startButton.frame = CGRectMake(522.0f, 26.0f, 65.0f, 50.0f);
pauseButton.frame = CGRectMake(443.0f, 26.0f, 65.0f, 50.0f);
stopButton.frame =  CGRectMake(603.0f, 26.0f, 65.0f, 50.0f);

stopButton.hidden = YES;
pauseButton.hidden = YES;

startButton.tag = indexPath.row+1001;
pauseButton.tag = indexPath.row+2002;
stopButton.tag = indexPath.row+3003;

[startButton addTarget:self action:@selector(StartbuttonClicked:) forControlEvents:UIControlEventTouchUpInside];
......
}

Then create 3 function:
- (void) startButtonClicked:(id) sender{
}
- (void) stopButtonClicked:(id) sender{
}
- (void) pauseButtonClicked:(id) sender{
}

If something doesn't work or if you need more information let me know.