text:
Q: Intercom over IP? This is an odd request, but I'm hoping some of you have had to field it before:
We have an office in New York and remote employees in Oregon and Florida. Communication is extremely important to us, and we would really like to set up a system that worked like an intercom over IP. There's something about waiting for a phone to ring that's not satisfying enough; we'd like a 3-way walkee talkee system that works cross-country.
Odd request, I know. I'm wondering if there isn't a solution out there though.
I appreciate your help in advance. Thank You!

A: Skype

A: You can configure most VoIP phones to auto-answer and use their speakerphone. Or, you can also have the server send hints to auto-answer.
Alternately, use some network-based speakers or even an intercom wired into the audio port on a computer. Lots of hackish ways to do so, it just depends on your budget and tolerance for 'nifty hacks'.

A: Most VOIP systems have intercom functionality - http://www.voip-info.org/wiki/view/Asterisk+Paging+and+Intercom has a bunch of info that might be useful, and googling "Asterisk Intercom" will probably give you a bunch more.
If you don't have a VOIP system I'd go with Skype though - less setup.

A: There's also Google Plus Hangouts, if you want group video chat.  But, yeah, Skype.

A: I Would go for 3 x cyberdata voip intercoms. certified by over 35 IP Telephone systems. You could purchase, say a Asterisk hosted solution. These are not much money at all. From the hosted platforms GUI you could set and form hunt groups. This would be an integrated office and remote office solution. That is controlled through the intercom. You can buy these in America on-line. Also the outdoor intercom over IP from iEntry Systems. The Intercom has a 2nd SIP extension, you could use this for IP phone call notification and up-load your own ring tones.


text:
Q: Display post in sequence from different custom post_type I'm trying to first fetch latest 18 post from all of our custom post_types (4) sorted on a custom field in DESC and then display them in sequence.
E.g I have custom post_types: paper, policy, media and Event (Event type: meeting, conference, and seminars).
The order of display required is 1st post will be from paper, 2nd from policy, 3rd from media, 4th from event but it will be a conference, 5th will be again paper, 6th policy etc. So, in a way below is the sequence of post required.
paper - 1, 5, 9
policy - 2,6,10
media - 3,7,11
event {conference} - 4,13,16
event {meeting} - 8,14,17
event {seminar} - 12,15,18
The code used is below:
<?php
      $counter = 1;

      $args = array(
  'post_type'   => 'any',
  'post_status' => 'publish',
  'posts_per_page' => '18',
          'meta_key'    => 'first_day',
           'orderby' => 'meta_value',
         'order' => 'DESC'
 );

$query = new WP_Query( $args );

      if( $query->have_posts() ) :

while( $query->have_posts() ) : $query->the_post();

if ($counter ==1 || $counter ==5 || $counter ==9)
{
//display paper post data
}

if ($counter ==2 || $counter ==6 || $counter ==10)
{
//display policy data
}

if ($counter ==3 || $counter ==7 || $counter ==11)
{
//display media post detail
}

if ($post->post_type == "event")
{
  if($slug==meetings &&  $counter ==8 || $counter ==14 || $counter ==17)
   {
    //display meeting type event detail
   }

   if($slug==seminars &&  $counter ==12 || $counter ==15 || $counter ==18)
     {
      //display seminar eventtype post detail here
     }

     if($slug==conferences &&  $counter ==4 || $counter ==13 || $counter ==16)
     {
      //display conference event type post detail
     }

 $counter++
 endwhile;
 wp_reset_postdata();

?>

The problem is that I'm able to display paper/policy and media in sequence but not for the Event custom post_type as in the loop some of the post type do not display. If I echo $counter and custom post type details I get it like below:
1Paper:1    2Policy:2   3commentary:3   4 5Paper:5  6Policy:6   7commentary:7   8 9Paper:9  10Policy:10 11commentary:11 12 13 14 15 Seminar15 16 17 Meeting17   18
If you notice above, 4th, 8th, 12,13,14,15,17 and 18th post doesn't display which are mainly conference/meeting/seminar 'eventtype'.
Please let me know what is wrong in the code.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I transfer data from html to php in this case

    Account ID:
    <input type="text" placeholder="Enter your ID in here" class="form-control" id="usr" style="position:absolute;width:350px;margin-top:205px;margin-left:900px;">

    PIN:
    <input type="password" placeholder="Enter your PIN in here" class="form-control" id="pwd" style="position:absolute;width:350px;margin-top:255px;margin-left:900px;">
    <button type="submit" onClick="process_Login()" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:fixed;margin-left:1040px;margin-top:310px;width:100px;">Login</button>
    <button type="submit" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:absolute;margin-left:1150px;margin-top:310px;width:100px;">Sign Up</button>

I have some problems with this code, I'm doing an ATM visual in web. I wanna transfer data from HTML file to PHP file, I know I have to use "form" but I don't know how to use it in this case, I also use "script" to solve if user enter an incorrect value.

What will I do to fix it?

A: If you are doing a form, you will be posting it to your PHP script.
Your inputs will need to have a name attribute, i.e,
<form action="myPHPLogin.php" method="post">
    <input type="text" placeholder="Do this.." name="username">

    <button type="submit">submit</button>
</form>

On your PHP script, you can access your fields with $_POST['username'] etc.

A: You should create form like this:
<form action="file.php" method="post" onsubmit="return process_login()">

</for>

remember to delete onClick handler on your <input type="submit"> code
and than your javascript code:

A:

<form method="post" id="dataForm">
Account ID:
  <input type="text" placeholder="Enter your ID in here" class="form-control" id="usr" name="user" style="position:absolute;width:350px;margin-top:205px;margin-left:900px;">

   PIN:
   <input type="password" placeholder="Enter your PIN in here" class="form-control" id="pwd" name="pass" style="position:absolute;width:350px;margin-top:255px;margin-left:900px;">
   <button type="button" onClick="process_Login()" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:fixed;margin-left:1040px;margin-top:310px;width:100px;">Login</button>
   <button type="button" class="btn btn-default" style="font-weight:bold;font-family:Tahoma, Geneva, sans-serif;position:absolute;margin-left:1150px;margin-top:310px;width:100px;">Sign Up</button>
  </form>

//your javscript
 function process_Login() {
var c = document.getElementById("usr").value;
var d = document.getElementById("pwd").value;
if (c.length == 0) {
  alert("ERROR: Your ID account is NULL");
} else if (isNaN(c)) {
  alert("ERROR: Your ID must be number");
}

$.ajax({url:"your php page.php",type:'POST',data:$("#dataForm").serialize(),success: function(data){

    if(data==0){alert("No data Added");}
    }});

}
//on your php page
 <?php
 $user=$_POST['user'];
 $pass=$_POST['pass'];
 //you database query for insert

 if($result)
 {
   echo "inserted";
 }
  else
 {
     echo 0;
 }
 ?>


text:
Q: why arent event rendering in fullcalendar under FF11+ and IE8+ I've got fullcalendar set to query a db and return json with just a title, and start date, and this renders just fine in Chrome.  However, under IE8,9, and FF11,12, I dont see any events.
I even tried to dummy up the data and manually import it to make sure it wasnt my php.
ec2-23-20-230-58.compute-1.amazonaws.com/default.html
^^^^ This page uses a file with the json data in it to render the calendar.  The file can be found here:
ec2-23-20-230-58.compute-1.amazonaws.com/json.data
I've opened up firebug and can confirm that the json is getting returned from a GET request on my real page, so I'm fairly certain its a rendering issue.  I havent seen any open bugs related to rendering on any of the above browsers though.
Any ideas?

A: I got a hint from this question which was similar:
FullCalendar not loading from JSON except in Chrome
My original json-events.php was returning dates in the format "JAN-01-12".  Once I modified the return date format, events started showing up in FF and IE.  Win.
Here's the relevant code:
$date=$res['EVENT_DATE'][$i];
$caldate=date("Y-m-d",strtotime($date)); // this is new
$event_data['start'] = $caldate;


text:
Q: The number of FixedLocator locations (11), usually from a call to set_ticks, does not match the number of ticklabels (166) | Matplotlib I posted a question previously but my wording got it flagged as a duplicate, so I'll be super specific on this one.
This is 13 rows of data, but my df has about 160:
Animal  Score
0   Dog 1
1   Pig 2
2   Chicken 3
3   Cat 4
4   Fox 5
5   Whale 6
7   Beetle 7
8   Ox 8
9   Monkey 9
10  Cow 10
11  Duck 11
12  Hen 12
13  Crow 13

I'm trying to annotate a graph with the values, and there is one line of code that's buggin' out on me and I cannot figure out why - ax.set_xticklabels(x_labels)
I think it's because of the concat that's forcing 11 rows instead of the full 160 odd, but here's the code:
#Add custom entries here
custom_df = dfAnimalRankings.loc[dfAnimalRankings['Animals'].isin(['Beetle'])]

# Create new df to show top 5, bottom 5, and Beetle
new_df = pd.concat([dfAnimalRankings[:5], dfAnimalRankings[-5:], custom_df])
new_df.sort_values(by=['Score'], inplace= True)
new_df.reset_index(drop=True, inplace= True)

# Plot the figure.
plt.figure(figsize=(12, 8))
ax = new_df.plot(kind='bar')
ax.set_title('Animal Rankings')
ax.set_xlabel('Animals')
ax.set_ylabel('Score')
ax.set_xticklabels(x_labels)

rects = ax.patches

def add_value_labels(ax, spacing=5):
    """Add labels to the end of each bar in a bar chart.

    Arguments:
        ax (matplotlib.axes.Axes): The matplotlib object containing the axes
            of the plot to annotate.
        spacing (int): The distance between the labels and the bars.
    """

    # For each bar: Place a label
    for rect in ax.patches:
        # Get X and Y placement of label from rect.
        y_value = rect.get_height()
        x_value = rect.get_x() + rect.get_width() / 2

        # Number of points between bar and label. Change to your liking.
        space = spacing
        # Vertical alignment for positive values
        va = 'bottom'

        # If value of bar is negative: Place label below bar
        if y_value < 0:
            # Invert space to place label below
            space *= -1
            # Vertically align label at top
            va = 'top'

        # Use Y value as label and format number with one decimal place
        label = "{:.1f}".format(y_value)

        # Create annotation
        ax.annotate(
            label,                      # Use `label` as label
            (x_value, y_value),         # Place label at end of the bar
            xytext=(0, space),          # Vertically shift label by `space`
            textcoords="offset points", # Interpret `xytext` as offset in points
            ha='center',                # Horizontally center label
            va=va)                      # Vertically align label differently for
                                        # positive and negative values.

# Call the function above. All the magic happens there.
add_value_labels(ax)

plt.savefig("image.png")

If I run the above code, I get the following error:
The number of FixedLocator locations (11), usually from a call to set_ticks, does not match the number of ticklabels (166).

But if I run this code:
#Add custom entries here
custom_df = dfAnimalRankings.loc[dfAnimalRankings['Animals'].isin(['Beetle'])]

# Create new df to show top 5, bottom 5, and Beetle
new_df = pd.concat([dfAnimalRankings[:5], dfAnimalRankings[-5:], custom_df])
new_df.sort_values(by=['Score'], inplace= True)
new_df.reset_index(drop=True, inplace= True)

# Plot the figure.
plt.figure(figsize=(12, 8))
ax = new_df.plot(kind='bar')
ax.set_title('Animal Rankings')
ax.set_xlabel('Animals')
ax.set_ylabel('Score')
# ax.set_xticklabels(x_labels)

rects = ax.patches

def add_value_labels(ax, spacing=5):
    """Add labels to the end of each bar in a bar chart.

    Arguments:
        ax (matplotlib.axes.Axes): The matplotlib object containing the axes
            of the plot to annotate.
        spacing (int): The distance between the labels and the bars.
    """

    # For each bar: Place a label
    for rect in ax.patches:
        # Get X and Y placement of label from rect.
        y_value = rect.get_height()
        x_value = rect.get_x() + rect.get_width() / 2

        # Number of points between bar and label. Change to your liking.
        space = spacing
        # Vertical alignment for positive values
        va = 'bottom'

        # If value of bar is negative: Place label below bar
        if y_value < 0:
            # Invert space to place label below
            space *= -1
            # Vertically align label at top
            va = 'top'

        # Use Y value as label and format number with one decimal place
        label = "{:.1f}".format(y_value)

        # Create annotation
        ax.annotate(
            label,                      # Use `label` as label
            (x_value, y_value),         # Place label at end of the bar
            xytext=(0, space),          # Vertically shift label by `space`
            textcoords="offset points", # Interpret `xytext` as offset in points
            ha='center',                # Horizontally center label
            va=va)                      # Vertically align label differently for
                                        # positive and negative values.

# Call the function above. All the magic happens there.
add_value_labels(ax)

plt.savefig("image.png")

I get this (I'm aware the numbers don't match, but it's an output from my actual dataset not the sample above):

Why does that one line of code break the annotation? And how can I get the data labels, which are animal names and not the numbers, added to the chart?
Cheers

A: The reason why you're getting an error is clear, your plot has only 11 bars but you're passing 166 labels to them. My guess is you've mixed up your dfAnimalRankings and new_df as a result you've got mismatched labels.
The workaround here would be to set x_labels to
x_labels = new_df['Animals'].tolist()

That way you'll get exactly 11 labels for 11 bars.


text:
Q: Silverlight Drag and drop custom controls I want to create a drag and drop functionality in my silverlight 3.0 project.
I use Nov 2009 release of the silverlight toolkit.
I created several custom user controls and want to apply drag and drop functionality to them.
I checked using

ListBoxDragDropTarget

with a ListBox but found that it must be bound to some data source.
is there a way to put my custom controls inside the list box and achieve the drag-drop behaviour ?
thanks

A: You can inherit your control from DragDropTarget. Let say you want to create TextBox and you want to drop items from DataGrid. Then you create
public class DropingTextBox : DragDropTarget<DataGridRow,TextBox>{}

Then you can override methods of DragDropTarget.
Please write what you want to do so maybe I can help more. What behaviour you want to acheive?


text:
Q: Error Handler For Server Instance using Jetty9 Ioc I have been trying to setup a jetty server with common error handling. I'm using jetty 9.4.44.v20210927 home distribution. As per the jetty-9 doc, i have written a class that extends ErrorHandler class and overrides the handle() method. I exported it as a jar and included it in lib/ext and the class is being discovered and loaded properly (verified using --debug and -Dorg.eclipse.jetty.LEVEL=DEBUG flags). I've also added this to jetty.xml server instance as instructed in the doc. No matter what change is done, the error is only being handed by the default ErrorPageErrorHandler and not my custom class. This is the xml context file that i have
<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    ...
    <Call name="addBean">
        <Arg>
            <New class="com.example.test.CustomErrorHandler"/>
        </Arg>
    </Call>
    ...
</Configure>

NOTE : I'm trying to set the errorHandler for the entire server instance and not for a specific context. Setting the same error handler for a single context works. But the same does not work for server instance. Also, i'm trying to achieve this using jetty IoC.

A: You want to use Server.setErrorHandler(ErrorHandler)
See: https://javadoc.io/static/org.eclipse.jetty/jetty-server/9.4.45.v20220203/org/eclipse/jetty/server/Server.html#setErrorHandler(org.eclipse.jetty.server.handler.ErrorHandler)
So that means ...
<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
 "http://www.eclipse.org/jetty/configure_9_3.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    ...
    <Set name="errorHandler">
      <New class="com.example.test.CustomErrorHandler"/>
    </Set>
    ...
</Configure>

This server level ErrorHandler is used for non-webapp based requests, or even requests that have an error that cannot be dispatched to a webapp.
Each Web App will have it's own unique ErrorPageErrorHandler, created at the time when the Web App is being deployed.


text:
Q: Average grades using a while loop I am trying to average grades using a while loop. Here is the program requirements:
Let the user enter grades to average. The user may type any number of grades; when he or she types "quit" or "Quit" print the average, rounded to two decimal places.
Please keep advice relatively simple. First time programming. Only am familiar with for loops and while loops and if else statements right now.
I was given this skeleton code:
def main():
    '''Average grades entered by the user'''
    #Set the total to 0
    #Set the grade count to 0
    #Get a grade
    #While the grade is not "quit" or "Quit"
    #    Add the grade to total
    #    Add one to the grade count
    #    Get a grade
    #Average the grades
    #Round the average to two decimal places
    #Print the average

main()  #Start execution

Here is my code thus far:
def main():
    '''Average grades entered by the user'''
    total = 0#Set the total to 0
    grade_count = 0#Set the grade count to 0
    grade = int(input('Enter grade :'))#Get a grade
    while grade != 'quit' or grade != 'Quit':#While the grade is not "quit" or "Quit"
        total += grade#    Add the grade to total
        grade_count += 1#    Add one to the grade count
        grade = int(input('Enter grade :'))#    Get a grade
    average = total / grade_count#Average the grades
    round(average, 2)#Round the average to two decimal places
    print(average)#Print the average

main()  #Start execution

And this is the error I am getting:
Enter grade :70
Enter grade :80
Enter grade :90
Enter grade :quit
Traceback (most recent call last):
  File "\\trace\Class\CSC-130\004\Rall992\Asn2\Asn2-1.py", line 21, in        <module>
    main()  #Start execution
  File "\\trace\Class\CSC-130\004\Rall992\Asn2\Asn2-1.py", line 16, in main
    grade = int(input('Enter grade :'))#    Get a grade
ValueError: invalid literal for int() with base 10: 'quit'


text:
Q: Exception when perform a segue I use Swift2 and Xcode 7.1
I want to trigger a segue when I click on a collectionCell that is present in a tableViewCell.
Only I have a identifier error.
Yet I have said my good segue into my storyboard.

Error :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'look''

    class PostsCell: UITableViewCell, UICollectionViewDataSource, UICollectionViewDelegate {

    var controller: PostsController!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {

        controller.perform(data![indexPath.item])

    }

    // ...

}

My Controller :
class PostsController: UITableViewController {

// ....

override func viewDidLoad() {
    super.viewDidLoad()

    // ...
}

// ...

func perform(post: Post) {
    self.post = post
    self.performSegueWithIdentifier("look", sender: self)
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if (segue.identifier == "look") {
        let viewController:SeePostController = segue.destinationViewController as! SeePostController
        viewController.data = self.post
    }
}

}

A: Instead of PostsController().performSegueWithIdentifier("look", sender: self) use self.performSegueWithIdentifier("look", sender: self)
Update
Create a new instance of your viewcontroller and call your perform method.
var controller: PostsController!
controller.perform(data![indexPath.item])


text:
Q: ListView Adapter NullPointer exception I am trying to implement Navigation drawer and in the listview adapter is creating Null-Pointer exception. Kindly tell me why it's doing so ?
Navigation_drawer.xml
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!-- The main content view -->
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff" />
    <!-- The navigation drawer -->
    <ListView android:id="@+id/listview"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

  </LinearLayout>

textdata.xml
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 <TextView
    android:id="@+id/textview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:text="16dip"
     />

           </LinearLayout>

Main Activity
At activity_main.xml file I have added some other code.
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry","WebOS","Ubuntu","Windows7","Max OS X"};

    DrawerLayout   mdrawer=(DrawerLayout) findViewById(R.id.drawer_layout);

    ArrayAdapter adapter = new ArrayAdapter<String>(this,R.layout.textdata,mobileArray);
    ListView drawerlist=(ListView) findViewById(R.id.listview);
    drawerlist.setAdapter(adapter);

Log
      01-01 03:46:37.180 19591-19591/com.example.shahik.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.shahik.myapplication/com.example.shahik.myapplication.MainActivity}: java.lang.NullPointerException
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
                                                                                at android.app.ActivityThread.access$700(ActivityThread.java:159)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                at android.os.Looper.loop(Looper.java:176)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5419)
                                                                                at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                at java.lang.reflect.Method.invoke(Method.java:525)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
                                                                                at dalvik.system.NativeStart.main(Native Method)
                                                                               Caused by: java.lang.NullPointerException
                                                                                at com.example.shahik.myapplication.MainActivity.onCreate(MainActivity.java:44)
                                                                                at android.app.Activity.performCreate(Activity.java:5372)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
                                                                                at android.app.ActivityThread.access$700(ActivityThread.java:159)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                at android.os.Looper.loop(Looper.java:176)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5419)
                                                                                at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                at java.lang.reflect.Method.invoke(Method.java:525)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
                                                                                at dalvik.system.NativeStart.main(Native Method)

A: Can you provide the logcat output?
Also try and instantiate the drawerlit with it's "parent" view i.e.
ListView drawerlist=(ListView) mdrawer.findViewById(R.id.listview);

A: Thats the name of your layout -> Navigation_drawer.xml
And thats the contentview you set ->  activity_main.xml
I guess youre missing the main layout.


text:
Q: how to focus on a div element in webview use code in android development I had a question while I try to focus on a div element in webview in Android development. I had set editable for the div element. However, no matter that I use webView.requestFocus() or document.getElementById('container').focus() or both, it never works. So I want to know how to get focus for div element in webView.

A: When your div loading event is generated with js. Can you set tab index attribute and give a try
http://jsfiddle.net/QAkGV/
<div id="generate">

$("#generate").attr('tabindex',-1).focus(function () {
    //do stuff
});


text:
Q: Loop over lines character by character I am trying to treat a series of letters as an array in order to loop through each letter in a for loop, line by line, element by element.
My $data after extracting a column looks something like:
ACACACACACA
CGCGCGCGGGG
TATATATAAAA
GAGAAAGAAGG
TGGTTTTGGTG

My script:
for j in `cat $data` # go line by line
do
    for k in "${j[@]}" # go through each letter element by element
    do
        echo $k
    done
done

Gives the output:
ACACACACACA
CGCGCGCGGGG
TATATATAAAA
...

I'd like the output to look like:
A
C
A
C
A
C
...
G
T
G

Is there something wrong with my syntax? Or is there a better way to call each element of the line?

A: Assuming it's always uppercase letters:
$ sed 's/[A-Z]/&\n/g' inputFile

or use the following to replace any character and number with the same character or number followed by a newline.
$ sed 's/./&\n/g' inputFile

OR if you have fold available,
$ fold -w1 inputFile

fold wraps line. With -w1 option, it wraps to a fix width of 1.

A: It's not pure bash, but this gets you what you're after:
for j in `echo $data | grep -o .`
do
  echo $j
done

The grep command matches every single character and prints it out (or in this case, stores it in the variable j where I assume you intend to do more than just echo it).

A: The shortest option:
fold -1 <<<"$data"


text:
Q: 2 CentOS boxes - one can't SSH to the other using publickey auth? I have 2 CentOS boxes with literally identical sshd configs and overall setups.
Box A can SSH to Box B just fine, but Box B can't SSH to Box A using publickey authentication (works fine with password auth). I've checked and re-checked the keys, setup, etc. literally 100 times and it just won't work.
When Box B offers the RSA public key to Box A, Box A literally just seems to ignore it. Normally it should return a packet of "type 60" but instead it again returns a type 51 and re-announces the authentications that can continue.
Here's the debug info. Does anyone have any idea what might cause this?
debug1: Offering RSA public key: /home/patrick/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
...

And here's the relevant part of my /etc/ssh/sshd_config:
Subsystem   sftp    /usr/libexec/openssh/sftp-server
GatewayPorts no
AllowTcpForwarding yes
KeepAlive yes
Protocol 1,2
Port 8855
IgnoreRhosts yes
IgnoreUserKnownHosts no
PrintMotd yes
StrictModes yes
PubkeyAuthentication yes
PermitEmptyPasswords no
RSAAuthentication yes

And this is using OpenSSH_7.4p1, OpenSSL 1.0.2k-fips on both boxes.

A: Crazy, it was an selinux issue. Just figured it out. I had to do:
restorecon -R -v /home/patrick/.ssh
Just putting this here for posterity ...


text:
Q: why I am getting Class not found exception I am using DeferredTextImpl Class and eclipse does not seems to complain about it but when I run my project I get run time exception .... Class not found exception for DeferredTextImpl ..
When I searched for the class file, I found it in rt.jar which should certainly be on the class path.  I also checked the build path in project properties->Java build path and could see JRE System Library at the very bottom. when I expanded that. I could see rt.jar. which means it is on the class path, right ?
Why am I getting this error ?

A: There is a difference between the build path in Eclipse and the classpath when you run your code. The build path is used to compile your code. The classpath is what your application has when it runs.
The build path is configured with Project -> Properties -> Java Build Path
The class path is configured with Run -> Run Configurations -> Classpath
In your case, you should also check (as others mentioned), if the JRE tab under Run Configurations points to the same JRE as in your build path.

A: Check the version of your Xerces jar for your runtime versus you compile time classes. Make sure have a Xerces2 jar at runtime. I doubt the the class in the rt.jar is the same class your application is looking for.

A: This class is part of a specific DOM implementation (Apache Xerces). It's not part of the public Java API, and if you do in fact find it in one JVM's runtime class library, this is no guarantee it'll be in others. If you need to explicitly work with Xerces, then you need to explicitly include the Xerces libraries on your runtime class path.

A: Can you try running the code by explicitly adding rt.jar with -jar option while running the code? If this works then it means that the rt.jar in eclipse is not on classpath.

A: Right click on project > java build path > Libraries
remove JRE and add library pointing to JDK folder which in my case is C:\Program Files\Java\jdk1.7.0_55.
But before that do the same thing with java installed JRE as well.
Windows > java > installed JRE .
Hope this will help


text:
Q: How to prevent NetworkManager from changing iptables? Every time I turn on/off a device in my local network the NetworkManager automatically adds/removes the set of rules in iptables.
The extracts from /var/log/syslog:
NetworkManager[799]: <info>  [1576899905.0615] Executing: /sbin/iptables --table filter --insert INPUT --in-interface wlp1s0 --protocol tcp --destination-port 53 --jump ACCEPT
NetworkManager[799]: <info>  [1576899905.0639] Executing: /sbin/iptables --table filter --insert INPUT --in-interface wlp1s0 --protocol udp --destination-port 53 --jump ACCEPT
...
NetworkManager[799]: <info>  [1576899905.0748] Executing: /sbin/iptables --table filter --insert FORWARD --in-interface wlp1s0 --out-interface wlp1s0 --jump ACCEPT
NetworkManager[799]: <info>  [1576899905.0768] Executing: /sbin/iptables --table filter --insert FORWARD --source 10.42.0.0/255.255.255.0 --in-interface wlp1s0 --jump ACCEPT
NetworkManager[799]: <info>  [1576899905.0787] Executing: /sbin/iptables --table filter --insert FORWARD --destination 10.42.0.0/255.255.255.0 --out-interface wlp1s0 --match state --state ESTABLISHED,RELATED --jump ACCEPT
...

Some of those rules conflict with my own rules because it always adds them in the beginning of the list. I didn't manage to find the files which contain these rules to change them. So how to stop these unwanted injections?
Ubuntu 18.04.3

A: NetworkManager does so because you activate a profile with ipv4.method=shared.
This basically means to run dnsmasq as DHCP server and enable NAT/masquerading.
It is a simple thing, for simple usecases. I probably wouldn't use this as DHCP server for my infrastructure, but I would use it to quickly share the internet for another host. Possibly this could be extended in the future with more flexibility and features, but until now it's simple.
If it doesn't do what you want, don't use it. That means, don't activate a profile with "ipv4.method=shared`.


text:
Q: How can I use JSONata in Electron? I have gone to https://try.jsonata.org/ and copied the addresses json file. I have entered into my code the expression on the right side and run my app. I do not get the result in my app that is shown in https://try.jsonata.org/. So, I know this is a very generic question, but is there anything "special" I need to do to get JSONata to work in an Electron app?

A: Turns out that I was evaluating the stringified JSON. Once I evaluated on the actual JSON object, everything worked as expected.


text:
Q: Mouse event trigger two time in firefox when hovering on element. Lead to flicker. Is there any way to change this flicker? HTML:

    Demo01

Demo01Children01

Demo01Children01

Demo02

Javascript:
$("ul.navigate>li").mouseenter(function(){
  $(this).children("a").slideDown();
  console.log("hover");
}).mouseleave(function(){
  $(this).children("a").slideUp();
  console.log("out");
});

Running the html and the JS in the firefox, I see the output is "hover, out, hover" in the firefox firebug when the mouse hover every time. Actually It isn't my purpose which is only output "hover". Dose any one can help me solve the problem?

A: I think the reason you're getting the flicker is because the li includes a bullet point.
As you enter from the left hand side, you hit the bullet point (trigger in), then the blank space (trigger out), then the text iteself (trigger in again).
If you add the following CSS to the demo:
li{
   list-style-type: none;
}

Do you find the behaviour disappears?
On another note: adding 'hover' behaviour on a moving (sliding) element is probably a really bad idea!
Codepen here to demonstrate.

A: Without changing your markup, I slightly modified your javascript to look like this :
$("ul.navigate > li").mouseenter(function(){
    $(this).find("li").slideDown();
    console.log("hover");
}).mouseleave(function(){
    $(this).find("li").slideUp();
    console.log("out");
});

A suggested, I also apply display: none to the children menu
Demo : http://jsfiddle.net/C2nVz/1/
Note: The demo also include list-style-type: none, as suggested by Ed, which causes multiple mouseover and mouseleave events.

A: You are having problems because you are sliding the elements, which rapidly call the events again! Take a look at this jsfiddle, where I commented out the slidedown lines.
I suggest you tell us how you inted for your code to work(is the slidedown necessary?), then we can find a solution.
Basically I changed your code to:
$("ul.navigate>li").mouseenter(function()
{
    //$(this).children("a").slideDown();
    console.log("hover");
}).mouseleave(function()
{
   //$(this).children("a").slideUp();
   console.log("out");
});


text:
Q: passphrase issue with correct ssh keys It is the first time I experienced this issue : I have setup ssh keys and I set the passphrase. Since the file is not id_rsa but id_rsd, I set this
Host someIP
  HostName someIP
  User git
  IdentityFile /Users/mehdibenchoufi/.ssh/id_rsd.pub

Now, when I connect via ssh -vT someIP, I am asked to enter the passsphrase. I did it correctly, but the passphrase does not seem to be recognized. How can it be ? (btw, I changed the  perms on id_rsd* setting it to 700 since Gitlab's server on which I am trying to clone from complained about the 640 default perms)

A: You need to specify private key for IdentityFile option, as described in manual page for ssh_config(5):
IdentityFile /Users/mehdibenchoufi/.ssh/id_rsd

If ssh does not recognize the key typ, it tries to decrypt it regardless the content of the file, which ends in nonsense (regardless the passphrase).


text:
Q: I want to make a playlist from all my liked songs on spotify with spotipy library Since my liked songs aren't public I want spotipy to get a list from all the songs and add them to my playlist, but when I try to do that with a loop it says that the uri is incorrect, I don't know if I should use another method.
client_credentials_manager = SpotifyClientCredentials(client_id=cid, client_secret=secret)
scope = 'user-library-read playlist-modify-public'
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager,auth_manager=SpotifyOAuth(scope=scope))
def show_tracks(results):
    for item in results['items']:
        track = item['track']
        #print("%32.32s %s" % (track['artists'][0]['name'], track['name']))
        sp.playlist_add_items(playlist_id, track['uri'])

results = sp.current_user_saved_tracks()
show_tracks(results)

while results['next']:
    results = sp.next(results)
    show_tracks(results)

The error is
HTTP Error for POST to https://api.spotify.com/v1/playlists/5ZzsovDgANZfiXgRrwq5fw/tracks returned 400 due to Invalid track uri: spotify:track:s
Traceback (most recent call last):
  File "C:\Users\ferch\AppData\Local\Programs\Python\Python37\lib\site-packages\spotipy\client.py", line 245, in _internal_call
    response.raise_for_status()
  File "C:\Users\ferch\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.spotify.com/v1/playlists/5ZzsovDgANZfiXgRrwq5fw/tracks

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "make_playlists.py", line 23, in <module>
    show_tracks(results)
  File "make_playlists.py", line 20, in show_tracks
    sp.playlist_add_items(playlist_id, track['uri'])
  File "C:\Users\ferch\AppData\Local\Programs\Python\Python37\lib\site-packages\spotipy\client.py", line 1025, in playlist_add_items
    position=position,
  File "C:\Users\ferch\AppData\Local\Programs\Python\Python37\lib\site-packages\spotipy\client.py", line 296, in _post
    return self._internal_call("POST", url, payload, kwargs)
  File "C:\Users\ferch\AppData\Local\Programs\Python\Python37\lib\site-packages\spotipy\client.py", line 266, in _internal_call
    headers=response.headers,
spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/playlists/5ZzsovDgANZfiXgRrwq5fw/tracks:
 Invalid track uri: spotify:track:s, reason: None

I think this problem is because of the type of variable of track['uri']

A: playlist_add_items is expecting a list of URIs, URLs, or IDs to add to the playlist, but right now you're passing a single URI, which is a string like this: spotify:track:2t7rS8BHF5TmnBR5PmnnSU. The code for the spotipy library is likely doing a loop for item in items..., so when you pass it a string, it considers each character in the string as a different item. So it encounters the first character, s and tries to make a URI out of it resulting in spotify:track:s. This isn't a valid URI, so the request fails.
You can try wrapping the uri in a list like so:
for item in results['items']:
        track = item['track']
        # Note brackets around track['uri']
        sp.playlist_add_items(playlist_id, [track['uri']])

This will handle the issue you're getting now, but you may have issues down the line making one request per track you want to add to the playlist. You could run into rate limiting issues, so I recommend trying to build a list of 100 URIs at a time, which is the max that can be sent in one request.
Keeping this in mind, we could try something like this:
def show_tracks(results):
    for idx in range(0, len(results['items']), 100):
         uris = [item['track']['uri'] for item in results['items'][idx:idx+100]]
         sp.playlist_add_items(playlist_id, uris)

A: Another way to do this would be to create a list with all the uris/ids of the tracks you want to add, and then pass that list into the sp.playlist_add_items() function. This could be useful if you need the list of uris again further down the line. Like so :
uris = []

for item in results['items']:
    track = item['track']
    uris.append(track['uri'])

sp.playlist_add_items(playlist_id, uris)

Bear in mind, sp.playlist_add_items only lets you add <= 100 tracks at a time. i created this loop to handle adding a list of tracks no matter the size: (where songIDs is a list of song ids / uris)
i = 0
increment = 99
while i < len(songIDS)+increment:
    try:
        sp.playlist_add_items(playlistID, songIDS[i: i+increment])
    except spotipy.exceptions.SpotifyException:
        pass

    i += increment

Hope this helps, i've only been using spotipy for a week myself


text:
Q: Activity always on top [Check out bar] I have an shopping app and when a customer adds an Item to the shopping cart a bar should appear in the bottom part of the screen, providing the customer to checkout or edit the cart.
This bar should stay in the bottom of the screen until the customer reset the cart or checkout, and it may display recommendations of similar items as those being displayed on the current screen.
How can I make an activity that is always on top, but only cover a set are of the screen?
Maybe I should use fragments, but I'm unsure of having a whole app in a frame just to get this one feature working.
Example: The black bar should stay on top of all activities at all times until checked out.

Any thoughts?


text:
Q: ffmpeg mp4 cut from correct point | without encode I'm using this this command for cut my mp4 video :
ffmpeg -i clip.mp4 -ss 00:00:25 -to 00:01:20 -c copy cutted.mp4

But there is a problem with this code. My "cutted" clip has black video for a couple seconds and it's have sync problem on editing software. When i tweak the first parameter -ss like 00:00:24 ... 00:00:23 .... 00:00:26 etc when i found the right position it doesn't have any black frame or sync problem. I want to learn how can i learn all of this correct times for my video ? I don't know what should i call these points. Gop or anything else. Is there any solution built-in ffmpeg to learn this times so i can cut them without any corruption ? Thanks!

A: Move your -ss 00:00:25 to before the -i Here it is in your example:
ffmpeg -ss 00:00:25 -i clip.mp4 -t 55 -c copy cutted.mp4

This moves -ss from an output option, which will "seek to the closest seek point before your time," to an input option, which "decodes but discards input until the timestamps reach [your] position."  Input option is much more accurate in my experience.  More details here. -t denotes time of output clip in seconds.


text:
Q: Change the Chromium update frequency on Ubuntu to Stable build PPA So, I have been using Chrome as my primary browser for a while now.
As far as I can remember I had set the PPA to the stable build, but somehow recently, it seems to have changed to the daily build that breaks things often.
How do I change back to the stable PPA build of chrome?

A: All the repositories/ppas that are considered are either in /etc/apt/sources.list and any files in /etc/apt/sources.list.d. You can remove the daily-build ppa and make sure the stable-build ppa is still there.
Any change in the sources must be followed by executing "sudo apt-get update" in order to take effect...
if you use
apt-cache policy <packagename>

you can check all the candidates for a particular package.
I believe the stable ppa you are looking for is ppa:chromium-daily/stable (https://launchpad.net/~chromium-daily/+archive/stable)
The link has instructions how to add it to your sources.


text:
Q: Conformal map from a trapezoid like subset of a unit disk to the upper half plane. I'm having some trouble with finding a conformal map for this problem.

Find a holomorphic one-to-one map from the open set bounded by the unit semicircle $|z| = 1$, ${\bf Im}\, z > 0$ and the line $y =\dfrac{1}{2}$ and the upper half plane.

So I have set it up and obtained a trapezoid-like region with vertices $(1,-1,-\dfrac{\sqrt{3}}{2}+\dfrac{i}{2}, \dfrac{\sqrt{3}}{2}+\dfrac{i}{2})$. So now I have four points I need to take care of and I ust can't see how can I map them. I only know how to map 3 points to $1,0,\infty$.
Thank you!


text:
Q: Impossible to track visits/referral from an iframe We have created a website that sales online ferry tickets.
We also created an affiliate system and propose our booking engine to third party websites (via an iframe).
Ex: http://travelq.ru/s-krita-na-santorini-na-parome/.
Iframe url: https://www.ferriesingreece.com/affiliate_engine_small.php
Every time a user is searching from this engine (in iframe), there is a form submission to https://www.ferriesingreece.com/redirecting.php?aff=affiliate_name.
Problem:
We can not track visits (as referrals or as new visits) from third party websites.
Analytics do not count the clicks that comes from the iframe.
We thought it was an issue of the submitting form. So, we added a direct link to https://www.ferriesingreece.com in the iframe to test it and the result is the same. Nothing is counted.
Finally we think that this is logically happening because the iframe content belongs to https://www.ferriesingreece.com, and analytics record that the user is already in our site, so it shows up as a user is navigating in our site. (not a new visit, not a referral.)
Is there any way to track those visits/referals from an iframe?
Is there a way to add analytics code somehow in this iframe and be able to record only the clicks and the parent website as referal?

A: You should be able to use UTM URL parameters for this. For example, if you add the parameters utm_source=form&utm_medium=referral&utm_campaign=affiliate to your form's target, the visit should* show up in your analytics report as a referral from the source 'form'. It will also show up the 'campaigns' section of your report.
Read more about UTM here: https://support.google.com/analytics/answer/1033867?hl=en
The full target link to your form would look like this: https://www.ferriesingreece.com/redirecting.php?aff=affiliate_name&utm_source=form&utm_medium=referral&utm_campaign=affiliate


text:
Q: Let R be a ring with unity and S be the set of all units in R I need to prove two things
(a) prove or disprove that $S$ is a subring of $R$
(b) prove or disprove that $S$ is a group with respect to multiplication in $R$
For (a) (1) it is clearly that $S$ is non empty since it contains the identity (The unity)
(2) let $a,b \cap S$ then $ab \in S$ because for $a$ we know there is an element $x$ such that $ax = e$ and for $b$ we know what there exists an element $y$ such that $by = e$ and so $ab(yx) = a(by)x = aex = ax = e$ and so $ab \in S$
$a - b \in S$ i am stuck here ! any suggestions
for (b) i think we already proved that it is closed under multiplication and have the identity and it is trivial to prove that all elements have inverses and are also associative , so yes it is a group under multiplication

A: For the case (a), you already mentioned that $S$ is non-empty as $1 \in S$. But $1 - 1 = 0$ does not belong to $S$, unless $1 = 0,$ i.e. unless $R$ is the trivial ring. So if $R$ is non-trivial then $S$ can not be a subring.

A: Since in any ring, the additive identity is not a unit, it can not belong to the set of units, which can therefore never be a subring.


text:
Q: Eclipse plugins not loading automatically I have done a few Eclipse plugins, and when developing, I always place the new versions of the plugin into the eclipse\plugins folder on the installed Eclipse target, and when I launch Eclipse, they are loaded.
I'm now updating a plugin that was targeting Luna, now to work in Oxygen.3.  I've rebuilt the plugin using Oxygen.3 Eclipse for Eclipse Committers, and then place the resultant output .jar file into the target Eclipse plugins folder, along with the new dependencies my plugin needs (namely several WST modules).  But when I launch Eclipse, the plugin won't load automatically.
If I launch Eclipse with -console option, I can then try to manually load the plugin from the console:
osgi> install reference:file:plugins/com.mystuff_1.0.0.201805181701.jar

Then using the console diag command to check if the dependencies were satisfied, it gives:
  Unresolved requirement: Require-Bundle: org.eclipse.wst.sse.ui; bundle-version="1.3.600"

I can then load that via console via install command:
install reference:file:plugins/org.eclipse.wst.sse.ui_1.3.600.v201707042340.jar

diag again shows that the wst.sse.ui plugin has unresolved requirements - basically, repeat the cycle for each of the 8 WST related plugins that are in the dependency tree.  Finally, all dependencies are satisfied, the diag command gives:
osgi> diag 355
com.mystuff [355]
  No resolution report for the bundle.

At this point, my plugin is active and can be debugged.
What am I missing?  Why won't the plugins load automatically?

A: Since the introduction of the Provisioning platform (p2) in Eclipse Ganymede (3.4) the plugins folder is no longer scanned for changes. Instead, the dropins folder is scanned (see also Eclipse 3.4 - New and Noteworthy - New dropins folder):

*

*Place the new versions of your plug-ins into the dropins folder instead of into the plugins folder.

*Alternatively, you can install the plug-ins directly into your running Eclipse IDE when exporting the plug-ins (see Eclipse Help: Export and Install into the Running Host).


text:
Q: How can I create an IIS ASP.NET MVC web site located at an address like domain/some/path? As per question, this is what I'd like to achieve:

*

*Create a separate Web site node in IIS (7) to host a deployed ASP.NET 4 MVC (and Web API) application. I'd like a separate Web site node instead e.g. of creating an Application in IIS under the default web site node. This is in order to have full rights on application web.config, and not to have restrictions if the Web.config is placed in some subfolder.

*Say I'm deploying on a development IIS server. Typically the web site node will be located at some URL similar to some.IP.addr.ess/. I'd like instead the web site to be located at an URL like some.IP.addr.ess/some/path/. This is in order to have the web application ready to work also when deployed in a subfolder. That's also because I'd like to deploy another web app on the same server, and have it accessible from some.IP.addr.ess/another/path/.
To clarify my jumbled requirements :) I'd like to have:

*

*One IIS web server instance running on a server, with one IP and possibly a domain name.

*Inside the IIS instance, several Web Site nodes, one for each application. An  application could be running on ASP.NET MVC/Web API. Another application could be running on PHP. Another could be static HTML pages. Here I'm saying application as a generic term, not necessarily related to an IIS Application.

*If the server has an IP address, say 123.123.123.123, each application should be reachable at an URL like 123.123.123.123/MvcApp1, 123.123.123.123/PhpApp2, and so on.

I've searched on the web but probably I didn't use the right terms: I always got articles on how to create applications inside the default node, or virtual directories, etc. And then I found this ASP.NET forum post which seems to say I can't.
** Thanks all
EDIT -
Going to the root of the problem, as asked below:
I'd like to refer to the different apps with different URL paths, so e.g. IPaddress/Mvc1, IPaddress/Php2, and so on.
All this is needed for development server, and then for test and staging, not for production. So in the first place there would be no quick need for a domain.
I can live with apps and Web.config in subfolders, or virtual directories, or applications, as long as this does not prevent one each other to work correctly. E.g. an ASP.NET application, next to an ASP.NET MVC with its own routing, and an ASP.NET Web API one, and a PHP one.

A: I think I understand what you're getting at, however, I think you have some fundamental misunderstandings about things.
First, yes, you can have multiple website nodes on a server.  And those nodes can all respond to the same IP address, HOWEVER, that will only work when using HTTP 1.1 hostnames, meaning that you have to refer to each site with a different domain name (hostname).  Thus, you have:
domain1.com/mvc1
domain2.com/php1
Both domain1.com and domain2.com resolve to 123.123.123.123, but IIS will look at the host name field and determine which site it needs to go to.
If you type in the ip address, 123.123.123.123 then IIS does not know which site you mean, so it uses the default web site.  This is key, if there is no hostname, then the default site is always used.
The only option you have, if you wish to use the ip address, is to use application folders within the default site.  At least with normal IIS.

A: It's a while since I poked around in IIS, so I'm somewhat rusty, and I don't recall ever coming across your scenario. Here's what I can figure, though:
The IIS docs on creating sites mention the phrase "unique bindings" a lot without making it all that clear what scope that uniqueness is in, but it's logical to assume that it means server-wide, so if your two sites will need to bind to the same URL then it doesn't appear to be possible. The docs also state that a binding can specify a protocol, a port, and a host. Note that there is no mention of a path; you don't seem to be able to bind to anything lower-level. This suggests that a site can be set up to bind to www.somehost.com, but not www.somehost.com/some/path/.
Having said that, it's possible that your problem can be solved by fixing the root of the problem, not the symptom. Rather than asking "how do I set up IIS sites under sub-paths so that I can deploy two applications under one URL?", ask "how do I set up two applications under one URL and not have trouble with rights over the Web.config?"
I know for a fact that you can quite happily deploy multiple applications under sub-paths of one URL because that's exactly what we do at work - we have one application in ASP.NET MVC at www.ourURL.com/somepath, and a legacy ASP.NET Classic app at www.ourURL.com/otherpath. The two applications are separate projects under a single Visual Studio solution, each with their own Web.config.
I can't really be any more helpful without a little more info on the structure of your application and/or details on exactly what problems you're having with Web.config and subfolder-related restrictions; like I said, we deploy like this at work and I've not come across problems with either.


text:
Q: JS Trigger submit event while preventing default I have a from I added a event listener to for the submit event like this:
form.addEventListener('submit',function(event){
event.preventDefault();
/*some few hundred more lines*/
},false);

My issue is when I use this bit of js later on:
from.dispatchEvent(new Event('submit'));
The function is processed, but the page is reloaded because preventDefault() had no effect, how can a dispatch a event and not trigger the default?

A: 1) you also need e.stopPropogation(), and even though it's redundant these days, to cope with old IE, it's good form to return 0 at the end
2) practically speaking, just stop making the button a submit button.  submit explicitly means "send to the other end."  just handle the button's onclick instead.

A: Setting the action on the form to javascript:void(0); instead of # worked.


text:
Q: Custom taxonomy list in WordPress I just registered following code in my function
add_action( 'init', 'create_resources_taxonomies', 0 );

function create_resources_taxonomies() {
    $labels = array(
        'name'              => _x( 'cat2', 'taxonomy general name' ),
        'singular_name'     => _x( 'cat2', 'taxonomy singular name' ),
        'search_items'      => __( 'Search category' ),
        'all_items'         => __( 'All category' ),
        'parent_item'       => __( 'Parent category' ),
        'parent_item_colon' => __( 'Parent category:' ),
        'edit_item'         => __( 'Edit category' ),
        'update_item'       => __( 'Update Category' ),
        'add_new_item'      => __( 'Add New Category' ),
        'new_item_name'     => __( 'New category Name' ),
        'menu_name'         => __( 'genre' ),
    );

    $args = array(
        'hierarchical'      => true,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array( 'slug' => 'genre' ),
    );

    register_taxonomy( 'genre', array( 'resources' ), $args );
}

and i want to get category list in my sidebar, so i added following code in my sidebar
<?php
$taxonomy     = 'genre';
$orderby      = 'name';
$show_count   = 0;      // 1 for yes, 0 for no
$pad_counts   = 0;      // 1 for yes, 0 for no
$hierarchical = 1;      // 1 for yes, 0 for no
$title        = '';

$args = array(
  'taxonomy'     => $taxonomy,
  'orderby'      => $orderby,
  'show_count'   => $show_count,
  'pad_counts'   => $pad_counts,
  'hierarchical' => $hierarchical,
  'title_li'     => $title
);
?>

<ul>
<?php wp_list_categories( $args ); ?>
</ul>

But i just get "No categories" text. What is wrong with my code?

A: Your code looks correct, I guess your categories are empty! Am i correct? if yes, add the following code to your last array section before 'title_li'
'hide_empty'   => 0,

So your code should be like this
$args = array(
  'taxonomy'     => $taxonomy,
  'orderby'      => $orderby,
  'show_count'   => $show_count,
  'pad_counts'   => $pad_counts,
  'hierarchical' => $hierarchical,
  'hide_empty'   => 0,
  'title_li'     => $title


text:
Q: How do I set a JSDoc tutorial title? I'm using JSDoc tutorials, as described in http://usejsdoc.org/about-tutorials.html
I can't get the configuration options to work, and I haven't yet found any examples or discussion of the topic online.
In my trivial example, I pass a tutorials parameter to JSDoc, and it builds a tutorial file for tutorial1.md. I would like to give this tutorial a display name of "First Tutorial".
Following this from the online docs:

Each tutorial file can have additional .js/.json file (with same name, just different extension) which will hold additional tutorial configuration. Two fields are supported:
title overrides display name for tutorial with the one specified in it's value (default title for tutorial is it's filename).
children which holds list of sub-tutorials identifiers.

I tried several attempts at adding tutorial1.json, or tutorial1.js but either JSDoc pukes on the json file, or doesn't seem to recognize anything I throw at it in the js file.
Can anyone suggest a simple format for a tutorial configuration file that should work?
(Edited to include one .js file I tried, which did not change the tutorial display name.)
tutorial1.md
First Tutorial
================

tutorial1.js
/**
 @title First Tutorial
 */
@title = "First Tutorial";
title = "First Tutorial";

A: It works with .json extension but not with a .js extension. jsdoc does not seem to try to even read the file if a .js extension is used. So the doc seems incorrect.
With a .json extension, and using jsdoc 3.2.2, the following works:
{
    "title": "Custom Title"
}

Your .json file needs to be in the same directory as your .md file and have the same name (ignoring extensions).


text:
Q: Suggested way to do a 'parallel period' SQL statement Let's say I want to get the profit between two dates. Then I can do something like this:
SELECT SUM(Profit)
FROM Sales
WHERE date BETWEEN '2014-01-01' AND '2014-02-01' AND <other_filters>

I would then like to compare it to a previous period offset by a fixed amount. It could be written something like this to get it in two rows:
SELECT SUM(Profit)
FROM Sales
WHERE date BETWEEN '2014-01-01' AND '2014-02-01' AND <other_filters>
UNION ALL
SELECT SUM(Profit)
FROM Sales
WHERE date BETWEEN '2014-01-01' - INTERVAL 1 YEAR AND '2014-02-01' - INTERVAL 1 YEAR AND <other_filters>

Is there a way to do this without a union? I am looking for something like this:
SELECT
    SELECT SUM(Profit),
    ???
FROM Sales
WHERE date BETWEEN '2014-01-01' AND '2014-02-01' AND <other_filters>

I think the tricky part here is how to 'un-do' the where filter for the offseted-time calculation.

A: You can use conditional aggregation and OR the range checks in the WHERE clause (unless they are subsequent in which case you can combine them directly of course).
SELECT sum(CASE
             WHEN date >= '2014-01-01'
                  AND date < '2014-02-02' THEN
               profit
             ELSE
               0
           END),
       sum(CASE
             WHEN date >= '2014-01-01' - INTERVAL 1 YEAR
                  AND date < '2014-02-02' - INTERVAL 1 YEAR THEN
               profit
             ELSE
               0
           END)
       FROM sales
       WHERE date >= '2014-01-01'
             AND date < '2014-02-02'
             OR date >= '2014-01-01' - INTERVAL 1 YEAR
                AND date < '2014-02-02' - INTERVAL 1 YEAR;

Note: Prefer not to use BETWEEN here but check for a right half open range check. That way, if the precision of date changes, records on the end past midnight are still in the results.


text:
Q: Eclipse CDT - using objdump in Windows The Eclipse CDT Binary Parser 'GNU Elf Parser' is having trouble on my Eclipse install on Windows.

*

*All works fine on linux install

Problem
I have a compiled ELF in the GNU ELF 32 format. When I attempt to view this with the GNU Elf Parser, I get:
java.io.IOException: Cannot run program "objdump": Launching failed
at org.eclipse.cdt.utils.spawner.Spawner.exec(Spawner.java:347)
...
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

Deubg
Of course, this just means the CDT-plugins can't find objdump.

*

*The ELF tested opens correctly in a linux-eclipse-cdt install

*Say my objdump is located at 'C:\binutils\bin'

*How the heck do you setup Eclipse's CLASSPATH to search there?

I've tried several things, from editing my system PATH, or CLASSPATH. I've also tried setting Workspace & C/C++ Build/Env settings. Nothing has worked.
Question
How the heck do you get this to work?
Edit - Basic Solution
Feel kind of silly, but to solve you just need to install MinGW and add C:/MinGW/bin to PATH. Then restart Eclipse.

*

*I'm producing my own Eclipse distro with our own in-house toolchain & objdump versions, thus the mixup!

*I've tried several other ways to get this to work (so I can eventually use our own objdump instance, but no luck!
Basic Solution Notes:

*

*All you need from C:\MinGW\bin to make this work is:

*

*objdump.exe

*addr2line.exe

*c++filt.exe

*libgcc_s_sw2-1.dll

*zlib1.dll

So if you move these to, say C:\myGnuBinUtils and add that to your system PATH (not some eclipse-setting, the actual path), then this works too.

*

*these files are 24MB total; MinGW is 715MB...

Does anyone know how to achieve the same result with out HAVING to modify system PATH?

A: It sounds like you need an "ObjDump" Java wrapper.  For example:

*

*https://code.google.com/p/cdtplugin/source/browse/trunk/org.eclipse.cdt.core/src/org/eclipse/cdt/utils/Objdump.java?r=5
"CLASSPATH" is Java-only: it won't affect running a non-Java .exe
Java exec() will use the system PATH of your Java VM.  You can, however, modify it at runtime.  For example:
using Runtime.exec() in Java
ProcessBuilder proc = new ProcessBuilder("<Directory PAth>" + "Executable.exe");
proc.redirectOutput(ProcessBuilder.Redirect.INHERIT);
proc.directory(fi); //fi = the output directory path
proc.start();


text:
Q: how do you get your current screen in kivymd? so i have my main app class which looks like this
class MainApp(MDApp):
    def on_resize(self):
        if self.app.manager.get_screen() == "table_screen":
            if self.width>self.height:
                self.manager.get_screen("table_screen").ids.table_image.source="table1.png"
                self.manager.get_screen("table_screen").ids.left_panel.opacity=0
            else:
                self.ids.left_panel.size_hint_x=.5
                self.ids.left_panel.opacity=1
    def build(self):
        Window.bind(size=self.on_resize())
        return Main()

and i want to firstly know that the current screen is "table_screen" and later i need to get ids from that screen, but with current code i get an error
 if self.root.manager.get_screen() == "table_screen":
 AttributeError: 'NoneType' object has no attribute 'manager

so  what is the way to do it?
here is my Main
class Main(MDBoxLayout):
    pass

and here is my Main in kv
<Main>:
    orientation: "vertical"
    id: main
    ScreenManager:
        id:SM

A: First, change
Window.bind(size=self.on_resize())

to
Window.bind(size=self.on_resize)

Since the root class for your App contains the ScreenManager, you can rewrite your on_resize() as:
def on_resize(self, *args):
    if self.root.ids.SM.current == "table_screen":
        if self.width>self.height:
            self.root.ids.SM.current_screen.ids.table_image.source="table1.png"
            self.root.ids.SM.current_screen.ids.left_panel.opacity=0
        else:
            self.ids.left_panel.size_hint_x=.5
            self.ids.left_panel.opacity=1

The current property of the ScreenManager contains the name of the current screen and the current_screen property contains a reference to the current Screen object. Since you have not posted a MCVE, I cannot be sure that your use of ids is correct.


text:
Q: Audio recording in Xamarin.forms I have a xamarin.forms project which has to record the audio and save it localy on the app.
Is there any plugin / api which can be used to achieve this?
Also I would like to know the source of the recorind ie. whether it is being recorded from microphone or is it from handsfree (speaker) without using microphone.

A: There is an open-source plugin for working with audio recorder in Xamarin.Forms :
https://github.com/NateRickard/Plugin.AudioRecorder

A: You can use the dependency service to access platform-specific APIs such as AVAudioRecorder on iOS or MediaRecorder on Android.

A: There is no plugin that I know of that does this. you could create a generic service interface called IRecorder which has the functionality you need and then implement the IRecorder interface in the platform specific projects using called AndroidRecorder etc using the dependency service
when implementing your platform specific code you can use these samples

*

*Android

*iOS

*Windows 10


text:
Q: Restrict user to a directory vsftpd I'm kind of new with Linux Ubuntu. I followed this guide.
My user: jer is still able to see files by going back from his directory and open stuff and copy things. The thing that I found good is that he can't delete, edit or add rather than his own directory(which was before bugged but then I added Owner:jer from Winscp to that folder).
I want jer not able to view anything else than his folder! As jer could open other secret files and copy data.

A: The manual:
https://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/
Setup FTP server on Ubuntu 14.04
Step 1 » Update repositories.
$ sudo apt-get update

Step 2 » Install VsFTPD package using the below command.
$ sudo apt-get install vsftpd

Step 3 » After installation open /etc/vsftpd.conf file and make changes as follows.
»Uncomment the below lines (line no:29 and 33).
write_enable=YES
local_umask=022

» Uncomment the below line (line no: 120 ) to prevent access to the other
folders outside the Home directory.
chroot_local_user=YES

and add the following line at the end.
allow_writeable_chroot=YES

» Add the following lines to enable passive mode.
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Step 4 » Restart vsftpd service using the below command.
$ sudo service vsftpd restart

Step 5 » Now ftp server will listen on port 21.
Create user with the below command.
Use /usr/sbin/nologin shell to prevent access to the bash shell for the ftp users .
$ sudo useradd -m john -s /usr/sbin/nologin
$ sudo passwd john

Step 6 » Allow login access for nologin shell . Open /etc/shells and add the following line at the end.
/usr/sbin/nologin


text:
Q: App Widget: Ripple effect lost on list item when background is added to outer layout This thing is driving me crazy. Here's how it works
1. everything is set as default

*

*ripple effect works

*list view item separator is visible

2. white background added to the widget layout

*

*ripple lost

*list view item separator also gone

*looks like list item style has been removed

Here's the code
main widget layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              ...
              android:background="@android:color/white" -- this line only applies for case 2
              android:padding="@dimen/widget_padding">

    <TextView
        ...
        android:background="@color/primary"
        android:textColor="@android:color/white"/>

    <ListView
        ...
        android:drawSelectorOnTop="true""/>

    <TextView
        ...
        android:textColor="?android:attr/textColorSecondary"/>

</LinearLayout>

list item layout
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:id="@+id/widgetItem">

    <TextView
        ...
        android:textColor="@android:color/black"
        android:textSize="14sp"/>

    <TextView
        ...
        android:textColor="@color/negative_amount"
        android:textSize="16sp"
        android:textStyle="bold"/>

</RelativeLayout>

I've spent a day trying all possible combinations but nothing helped. And I don't get the fact that unrelated background change to some layout around the list view completely alters the behaviour. WTF?
I would like to solve it in the cleanest way possible - e.i. no hacking with custom selectors. This should work straight out of the box if possible.

A: It looks like you're using a dark theme for your activity, so the ripple is white and thus not visible over a white background. The simplest solution is to use a light variant of the theme, which will cause the ripple to be black.
For example, if you're using an AppCompat theme, you can add this line to your ListView:
<ListView
    ...
    android:drawSelectorOnTop="true"
    style="@style/Theme.AppCompat.Light"/>

You can also apply this to a view hierarchy, e.g.:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      ...
      android:background="@android:color/white"
      android:padding="@dimen/widget_padding"
      android:theme="@style/Theme.AppCompat.Light">

This will cause the theme to be used in the LinearLayout and all of its child views.
Also, you can specify a theme activity-wide or even app-wide by adding android:theme attribute to the <activity> or <application> tag to your AndroidManifest.xml.


text:
Q: Read from socket server in C# in socket client in Android My server in C# sends message using this code:
byte[] data = Encoding.UTF8.GetBytes("Hello World");
current.Send(data);

But in Android I dont know how to read it. Im using this code:
byte[] b1 = new byte[2048];
int bytesToRead;
while ((bytesToRead = socket.getInputStream().read(b1)) > 0)
{
    Log.d("test", bytesToRead+"");
}

but it returns the length of the message from server. How I am supposed to get the message content sent by server.


text:
Q: AttributeError: 'NoneType' object has no attribute 'write' i try to my code python to exe but i got a error "AttributeError: 'NoneType' object has no attribute 'write'". But when i try to run this script in terminal it was fine. But when i convert my python script in exe and try to execute it show the error.
This is the line where i get the error:
sys.stdout.write("\x1b[1;%dm%s%s\n" % (random.choice(colors), line, clear))
Check the image
I want to solve the error and how can i do that. Can any one help me out? Please solve the code
Thanks


text:
Q: Is it possible to show a double integral from the product of two? I have two identical integrals here.
If I multiply them by each other is it possible that a double integral will result ?
1)
Integrate[t^(x - 1)/E^t, {t, 0, Infinity}]*Integrate[s^(x - 1)/E^s,  {s, 0, Infinity}]
ConditionalExpression[Gamma[x]^2, Re[x] > 0]
2)
Integrate[(t^(x - 1)*s^(x - 1))/E^(t + s), {s, 0, Infinity},  {t, 0, Infinity}]
ConditionalExpression[Gamma[x]^2, Re[x] > 0]

*..not derived with MMA

$\int_0^{\infty } e^{-s} s^{x-1} \, ds \left(\int_0^{\infty } e^{-t} t^{x-1} \, dt\right)=\int _0^{\infty }\int _0^{\infty }e^{-(s+t)} s^{x-1} t^{x-1}dtds$
Integrate[t^(x - 1)/E^t, {t, 0, Infinity}]*Integrate[s^(x - 1)/E^s,  {s, 0, Infinity}] == Integrate[(t^(x - 1)*s^(x - 1))/E^(t + s),  {s, 0, Infinity}, {t, 0, Infinity}]
ConditionalExpression[True, Re[x] > 0]

A: Double integral shows the same result as the product of singl integrals
{ Integrate[t^(x - 1)/E^t, {t, 0, Infinity}]*Integrate[s^(x - 1)/E^s,  {s, 0,Infinity}],
Integrate[t^(x - 1)/E^t s^(x - 1)/E^s, {s, 0, Infinity}, {t, 0, Infinity}]}

(*{ConditionalExpression[Gamma[x]^2, Re[x] > 0],
ConditionalExpression[Gamma[x]^2, Re[x] > 0]}*)

A: If I understand correctly you just want to display it. In the following I used Inactive as in another recent answer to one of your questions. You might want to look up HoldForm and Defer for display purposes.
Relevant comment: though a nicer display might be aesthetically pleasing, I am not a big fan of it for practical purposes and long computations.
Define the following:
int[f_, g_, t1_, t2_, s1_, s2_] :=
 Inactive[Integrate][f, {t, t1, t2}] Inactive[Integrate][
    g, {s, s1, s2}] =
  Inactive[Integrate][f g, {t, t1, t2}, {s, s1, s2}]

For your example
int[t^(x - 1)/E^t, s^(x - 1)/E^s, 0, Infinity, 0, Infinity]

If you want to calculate it now
Assuming[Re[x] > 0,
 Activate@int[t^(x - 1)/E^t, s^(x - 1)/E^s, 0, Infinity, 0, Infinity]]


text:
Q: How to hyperlink to same-document bookmark in RTF file shown in CRichEditCtrl I want to disply a char array of RTF format text embedded my program, using an MFC dialog hosting a CRichEditCtrl 2.0 control. I want the text to have a hyperlink to a bookmark in another location in the same text array (like a link to an anchor in an HTML doc).
In plain text my simplified test RTF text looks like this:
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang2057{\fonttbl{\f0\fnil\fprq15\fcharset0 Arial;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\f0\fs20
\par This is a {\field{\*\fldinst HYPERLINK \\l "dest_1"}{\fldrslt link}} you can click.\par
{\field{\*\fldinst HYPERLINK "http://www.google.com/"}{\fldrslt Google}}
\par
...
\par
\par It should take you to this {\*\bkmkstart dest_1}bookmark{\*\bkmkend dest_1} here.\f0\fs20\par
}

where ... is a bunch more \par to take the bookmark a long way down-screen.
When I load this file into Word it works fine - control-clicking on the word "link" in the first line causes a jump down to the word "bookmark" in the last line. (And control-clicking on Google in the second line launches Google in a browser, as it should.)
However, when I load it into the CRichEditCntrl in my program, the text displays fine and the external link to Google works, but the internal link to the bookmark does not work.
My question is, is this a limitation of the CRichEditCntrl itself, or is my RTF syntax at fault? I'm kind-of reverse engineering another RTF file generated by Word itself to get the syntax, and I'm wondering if hyperlinks to an internal bookmark might be a Word-specific extension to the RTF specification?
The background reason for doing this is that I want an embedded help document in my program, and I want that to have rich-text capability, with internal links. Is there a better way than using the RTF viewer? I could do something similar with HTML launched in an external browser, but I want the exe file of my program to be a simple light-footprint single file, which does not need to access any external file/program to launch its help.
Ideas or suggestions would be welcome - I'm certainly no expert on RTF format (or help programming).
Bill Heitler


text:
Q: How do I create an executable jar for my webapp with Maven? Backgound
I develop a webapp using a REST Interface with Spring. Normally I develop and execute my software with Eclipse. When my program has been started I enter localhost:8080/RESTPath in Chrome to access RESTPath with my program.
Issue
Now I want to build and execute my program with Maven instead with a executeble jar. The issue is that my knowledge with Maven is limited so I'm not sure how to do. Of course I have googled my issue and I have tested some examples but without succes. So far I think I should use the plugin tomcat7-maven-plugin in my POM.xml to generate a jar to execute with java -jar file.jar. I have followed the example with a webapp using tomcat7-maven-plugin but the jar file is never generated: https://www.baeldung.com/executable-jar-with-maven.
My POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <!-- My project -->
    <groupId>tobbe</groupId>
    <artifactId>stocks-rest</artifactId>
    <packaging>jar</packaging>
    <version>1.0.2-SNAPSHOT</version>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

    <!-- My projects -->
    <dependency>
        <groupId>tobbe</groupId>
        <artifactId>Stocks_Backend</artifactId>
        <version>1.0.2-SNAPSHOT</version>
    </dependency>
     <dependency>
        <groupId>tobbe</groupId>
        <artifactId>Other</artifactId>
        <version>1.0.2-SNAPSHOT</version>
    </dependency>
    </dependencies>

</project>

Question
how should my POM look like a how should I build with Maven (i.e. mvn clean compile) to create an executable jar?

A: <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
       https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.2</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>17</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

You are missing build section in your pom. When you execute mvn clean package you will get the JAR File in the target folder


text:
Q: Physical meaning of Ward Identity and computing vertex functions Following the derivation of Ward Identity by Weinberg book, you get it in the form
$$
(l-k)_\mu S'(k)\Gamma^\mu(k,l)S'(l) = i S'(l) - iS'(k)
$$
Can anyone explain the physical meaning of this identity? And how to understand it from this form?
$S'(k)$ is the complete propagator and $\Gamma^\mu(k,l)$ the vertex function.
EDIT (after comments and with more details and questions)
For instance, let's consider the following Lagrangian density
$\mathcal{L} = -\frac{1}{4}F^{\mu\nu}F_{\mu\nu} - \frac{1}{2}(\partial_\mu A^\mu)^2 - (D_\mu \phi)^*(D^\mu \phi) - m^2\phi^*\phi - \frac{\lambda}{4}(\phi^*\phi)^2$
where $D_\mu = \partial_\mu +ieA_\mu$, $\phi$ is a complex scalar field( of charge $-e$) and $A_\mu$ is the electromagnetic field.
This lagragian is invariant under the Gauge transformation $A_\mu \rightarrow A_\mu + \partial_\mu \alpha(x)$ if $\partial_\mu\partial^\mu \alpha(x) = 0$.
Suppose fields in the lagrangian are the "bare" fields. Then, I normalize them in a proper way and I obtain
$$
\mathcal{L} = \mathcal{L}_0 + \mathcal{L}_c + \mathcal{L}_{int}
$$
where
$$
\mathcal{L}_0 =-\frac{1}{4}F^{\mu\nu}F_{\mu\nu} - \frac{1}{2}(\partial_\mu A^\mu)^2 - \partial^\mu\phi^*\partial_\mu\phi - m^2\phi^*\phi
$$
and
$$
\mathcal{L}_c = -i(Z_1-1)eJ_\mu A^\mu - (Z_4-1) e^2 \phi^* \phi A_\mu A^\mu - (Z_\lambda-1)\frac{\lambda}{4}(\phi^*\phi)^2 - (Z_2-1)\partial^\mu\phi^*\partial_\mu\phi -(Z_m - 1) m^2\phi^*\phi -\frac{1}{4}(Z_3-1)F^{\mu\nu}F_{\mu\nu}
$$
where $J_\mu = \partial_\mu\phi^*\cdot \phi-\phi^*\partial_\mu\phi$
and $$
\mathcal{L}_{int} = -ieJ_\mu A^\mu -e^2 \phi^* \phi A_\mu A^\mu  - \frac{\lambda}{4}(\phi^*\phi)^2
$$
Then, I'm working with these vertices

Which is the vertex function in this case? Is it only a 3-point irreducible diagram?
I should draw also the following diagrams (and more diagrams that I don't upload)

The third is the vertex function as I found on Weinberg's book. The first and the second seems the 4-point Green Functions.
Question 1) Can you explain me the differences among the diagrams and can you show me the mathematical expression of the vertex function?
Question 2) Can I use the Ward identity and the gauge invariance to say something about the $Z$ factors on $\mathcal{L}_c$?


text:
Q: Mosfet output stage with PI controller The image below is an output stage I designed for research purposes on my own. It is a PI controlled DC push-pull amplifier. On the left there is a common base circuit with amplification stage (with cascode) after to generate the output stage drive. The simulation looked ok but as always simulation is never the real world. The real curcuit has some overshoot at the output when I input a step function as set voltage. However I can't get rid of it by changing the PI controller parameters. I use OPA288 as real operational amplifier. What do you guys think of that circuit. Any ideas how to get rid of the overshoot at the output?

Output voltage in time domain:


text:
Q: Web api set name and password to request.BasicAuth The route for login authenticate -- app.Handle("GET", "/v1/users/token", u.Token).
We can get name and password from request.BasicAuth.
func (u *User) Token(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
    ...
    name, pass, ok := r.BasicAuth()
    ...
}

But how can I set name and pass from client web url?

A: Before a browser asks the user to supply basic auth credentials, you have to deny the request access (using status code 401 Unauthorized). You should set the header WWW-Authenticate to Basic realm="Your message".
Also see this article.
So in your code, when ok is false, you should deny that request:
func (u *User) Token(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
    ...
    name, pass, ok := r.BasicAuth()
    if !ok  {
         w.Header().Set("WWW-Authenticate", "Basic realm=\"Your message\"")
         http.Error(w, "Must supply authentication credentials", http.StatusUnauthorized)
         return
    }
}


text:
Q: How to find if arrays have matching objects? I need to loop 2 arrays and see if they have matching objects and if so, add a marker to a map and when i click on it I want to tell the number of total results for matching coordinates which in the following example would be 2. The marker is fine as I am looping the arrays and placing it based on the coordinates but I can't give the total number currencies within the same coordinates.
Therefore I have:
latitude = [{"45.99"},{43.22},{"45.99"}];

longitude = [{"9.22"},{"2.645"},{"9.22"}];

This answer helps a bit, basically it uses filter but what I would like to do is to check if both arrays have any matching values and place the number of results in a modal.
Currently I do:
$("#results .modal-body").html("Risultati"+" " +longitude.length + "<button id='goToResul' type='button' class='btn btn-danger'>Go to result</button>");

But that would check the length of the whole longitude array while in the arrays example we have twice 45.99 and 9.22 which means 2 matches.
What might helps is that both longitudes and latitudes follow the same index

A: As per my understanding, you can try below approach

var lat = ["45.99","43.22","45.99", "45.99"]
  , lng = ["9.22","2.645","9.22", "9.22"]
  , latlngCount = Object.entries(lat.reduce((o, d, i) => (o[lat[i]+'-'+lng[i]] = (o[lat[i]+'-'+lng[i]] || 0) + 1, o) , {})).filter(([latlng, count]) => count > 1)
  , matchingCount = latlngCount.reduce((sum, [latlng, count]) => sum + count, 0)

console.log('Matching lat lng', latlngCount)
console.log('Matching Count', matchingCount)

A: Do you mean something like this?
count=0
latitude = ["45.99","43.22","45.99"];
longitude = ["9.22","2.645","9.22"];
lat=latitude.concat([])
long=longitude.concat([])
for(i in latitude){
  lat.shift()
  long.shift()
  if((index=lat.indexOf(latitude[i]))!==-1){
    if(long[index]==longitude[i]){
      //DO SOMETHING IF A PAIR IS FOUND
      count++
    }
  }
}
console.log(count)


text:
Q: Sidebar navigation: which tag is semantically correct? I have a sidebar with navigation links in a template I am building for an admin
dashboard, something like:

...

 ...

I wonder if using an  tag was semantically correct, or should I use  instead?

A: It is for navigation, use

The HTML  element represents a section of a page that links to other pages or to parts within the page: a section with navigation links.

Compare against , which does not mean what you think it means;

The HTML  element represents a section of the page with content connected tangentially to the rest, which could be considered separate from that content.

So,  means more "side note" rather than "side bar".

If you wanted, you could use  to section the side bar then a  inside it to contain the navigation links

A:
The aside element represents a section of a page that consists of
  content that is tangentially related to the content around the aside
  element, and which could be considered separate from that content.
  Such sections are often represented as sidebars in printed typography. html5doctor

And

Do not use the  element to tag parenthesized text, as this kind
  of text is considered part of the main flow. Mozilla

Here is the best simple example about how to use aside:

    The Disney movie The Little Mermaid was
    first released to theatres in 1989.

    The movie earned $87 million during its initial release.

    More info about the movie...

Before, I saw HTML structure of some popular websites like Spotify, they are using div for their sidebar. But if you like to read more, you should take a look at Best HTML5 markup for sidebar


text:
Q: RequestContext.getCurrentInstance().update doesn't work I have a JSF page with commandbutton to show dialog and show data from datatable, but the problem RequestContext.getCurrentInstance().update doesn't update the dialog, can anyone tell me what is wrong with my code?
here is my JSF code

    <h:form id="formEmp">
        <p:commandButton value="Edit"
                         id="buttonUpdate"
                         actionListener="#{masterRoleController.doUpdate()}"/>

        <br/>
        <p:separator/>

        <p:dataTable id="dtEmployee"
                     value="#{masterRoleController.lazyUserRole}" var="dtEmp"
                     selectionMode="single"
                     selection="#{masterRoleController.userRole}"
                     rowKey="#{dtEmp.roleId}"
                     paginator="true"
                     rowsPerPageTemplate="15, 25, 50"
                     rows="15"
                     lazy="true"
                     resizableColumns="true"
                     emptyMessage="No Data"
                     styleClass="eric-panelgrid">

                                <p:ajax event="rowSelect"
                                        listener="#{masterRoleController.enableButtonEdit()}"
                                        update=":formEmp:buttonDelete, :formEmp:buttonUpdate" />

            <p:column headerText="Id">
                <h:outputText value="#{dtEmp.roleId}" styleClass="eric-textInput"/>
            </p:column>
            <p:column headerText="Role Name">
                <h:outputText value="#{dtEmp.roleName}" styleClass="eric-textInput"/>
            </p:column>
            <p:column headerText="Role Desc" style="width: 50%">
                <h:outputText value="#{dtEmp.roleDesc}" styleClass="eric-textInput"/>
            </p:column>

        </p:dataTable>
    </h:form>
</center>

<h:form id="formDlgUpdate">
            <p:dialog id="dlgUpdate"
                      widgetVar="widDlgUpdate"
                      header="Update Role"
                      modal="true"
                      resizable="false"
                      dynamic="true"
                      showEffect="fade"
                      hideEffect="fade"
                      draggable="false">
                <p:panelGrid id="pgridUpdate" columns="3" >
                    <h:outputText value="Role Name"/>
                    <h:outputText value=":"/>
                    <p:inputText id="inEmpTpName"
                                 value="#{masterRoleController.userRole.roleName}"
                                 required="true"
                                 requiredMessage="Name must be filled."
                                 maxlength="50"
                                 onblur="value = value.toUpperCase();
                                             value = trim(this.value)"
                                 onkeypress="return checkAlpNumeric(event)">
                        <f:validator validatorId="com.hospital.util.validator.UniqueValidator"/>
                        <f:attribute name="table" value="user_role"/>
                        <f:attribute name="column" value="role_name" />
                        <f:attribute name="info" value="Test Role"/>
                        <f:attribute name="actInfo" value="#{masterRoleController.actInfo}"/>
                        <f:attribute name="compare" value="#{masterRoleController.nameTemp}"/>
                    </p:inputText>

                    <h:outputText value="Role Desc"/>
                    <h:outputText value=":"/>
                    <p:inputTextarea value="#{masterRoleController.userRole.roleDesc}"
                                     required="true"
                                     requiredMessage="Description must be filled."
                                     maxlength="100"
                                     onblur="value = value.toUpperCase();
                                                 value = trim(this.value)"
                                     onkeypress="return checkAlpNumeric(event)"/>

                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <p:commandButton value="Edit"
                                     actionListener="#{masterRoleController.update()}"
                                     update="pgridUpdate">
                    </p:commandButton>
                </p:panelGrid>
            </p:dialog>
        </h:form>

and here is my managedbean
public void doUpdate() {
        headerInsUpd = "Update";
        toggleBtnInsUpd = false;
        actInfo = "U";
        nameTemp = userRole.getRoleName();
        RequestContext.getCurrentInstance().execute("PF('widDlgUpdate').show()");
        RequestContext.getCurrentInstance().update("formDlgUpdate:dlgUpdate");
    }

A: It doesn't work because your dialog is dynamic (dynamic="true").
You should disable dynamic behavior to achieve what you want. Or to update not the dialog itselt but a component inside the dialog after the dialog is opened.