text:
Q: How to set pressure sensitivity in GIMP to control line thickness? My sister is moving from Windows and I just got her a new graphics tablet. However, the pressure sensitivity controls opacity rather than line thickness; she really needs this feature from Photoshop/Corel Painter.
Is there a way to toggle on or off the pressure affecting either line opacity or thickness?

A: Make sure you have checked Pressure: Size in the Brush Dynamics section of the Toolbox:

If this still doesn't work, you probably haven't enabled the tablet. To do so, go to:

*

*Edit → Preferences

*Input Devices → Configure Extended Input Devices

*Choose your device and set it to Screen mode

*Save, close, and try again.

A: RE: Tablet not showing up in input devices
Hi....Information from
http://blenderartists.org/forum/showthre...ost2324411
on Post #13 as :
Download as : https://download.gimp.org/mirror/pub/gimp/v2.6/
Then I follow is work. But.. I Use Windows 10 my Gimp 2.6.9 Follow Below :
All,
I know this is a bit outdated (the last post was in October), but I've stumbled on a different, although more troublesome, way to enable pressure sensitivity in GIMP 2.8:

*

*Plug tablet in.

*Launch 2.6 (in this case I was using 2.6.12)

*Go to File > Preferences > Input Devices > Configure Extended Input Devices...
a. If you get an error saying no input devices found, close 2.6 and relaunch.

*Draw something on the canvas using the tablet.

*Close 2.6

*Launch 2.8

You should now be able to draw in 2.8 with full pressure sensitivity. I'm not sure why this works, but I've tried it, rebooted my computer and tried it again with success. I am using Windows 8, but I believe it should work on all versions of Windows. Because OSX used X11 for 2.6, but not for 2.8 I'm unsure if this process would work.
Using Ubuntu 12.04 I was able to get 2.8 to handle pressure sensitivity right out of the box--but it could have been because I had just launched & closed 2.6 and had both installed side-by-side.
Like I said, this is a bit more cumbersome than the solution 2blackbar suggested above but I figured it was worth sharing.
Last edited by BnBGobo99; 28-May-13 at 15:13. Reason: Workflow was unnecessary.

A: On newer versions of Gimp the Brush Dynamics window will not look like that. Here is how it looks in Ubuntu 13.04:

If you click on the notepad to the right of "Pencil Generic copy", it will show the menu where you can select what pressure will do to the picture (opacity, size, etc.). But it is all disabled/greyed out. What you need to do is click on the crazy blue arrow, then click on the crazy blue arrow again, which will open the brush dynamics selection dialog. There you can select a brush and duplicate it. You will then be able to select the duplicate brush you just create, click on the notepad button, and then finally edit the brush dynamics as shown by htorque.
This has been tested in a Thinkpad X61 tablet running 13.04/raring and Gimp 2.8.4.

A: if you are using a newer version of GIMP you just need to click on the arrow with three dots right of the text saying "Dynamics" then select the option you want to use, for example: "Pressure Size".
Hope this helps

A: If you do not see the items Pressure, Velocity and Random you need to open those fields by clicking on "Brush Dynamics". This will unfold the three checkbox fields as shown in the screenshot. It took me an hour to find this out.


text:
Q: Create dynamic text box id I want to create dynamic text box id on click event of button using jquery. I have created a function that creates three text boxes when I click on a button. What I require is, every text box should have it unique ID.
Here is the function :-
function CreateTextBox(value) {
    return '

Ingredients<input class="form-control"name = "text1" id="ring" type="text" value = "' + value + '" />
'+
    '
Quantity<input class="form-control"name = "text2" type="text" id="rqty" value = "' + value + '" />
'+
    '
Measure Unit<input class="form-control"name = "text3" id="runit" type="text" value = "' + value + '" />
'+
    '
<input type="button" value="Remove" class="btn btn-info remove" id="rm"/>

'

}

This code works fine for me for the first time. When I run this function for the second time I need different Id(like ring1,rqty1,runit1)

A: you could add a class to the created parent div (for example
) and then in the function you get the number of these using:
var number=$('.createdBoxes').length+1;

and then add that number to the dynamically created fields id so each  id would be like id="qty'+number+'" and on each call to the function the length would increase so you would have an index of the number of dynamically created divs.

A: You should make some kind of increment value to keep track of how many times the button was pushed (say, something like var round = 0;).  Then for each time you add the inputs you can have the ids look like 'id="rqty'+ round+ '"'.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to navigate without a nest navigation I use react-navigation stackNavigator for my native router. The simply path is LoginRouter -> DashboardRouter -> AddressRouter, map tree here.
// LoginRouter.js
const LoginRouter = createStackNavigator(
  {
    Login: Login,
    Register: Register,
    Dashboard: DashboardRouter
  },
  {
    initialRouteName: "Login"
  }
);

// DashboardRouter.js
const TabNavigator = createBottomTabNavigator(
  {
    MessageRouter: MessageRouter,
    AddressRouter: AddressRouter,
  },
  {
    ...
  }
);

// AddressRouter.js
const AddressRouter = createStackNavigator(
  {
    // these all navigator will become a nested navigation
    Address: Address,
    UserAdd: UserAdd,
    UserGroup: UserGroup
  },
  {
    initialRouteName: "Address"
  }
);

If I want to let the AddressRouter navigate without a nest navigation, how do I change this code?
PS
The navigate work fine when I extract the AddressRouter to the LoginRouter.
// LoginRouter.js
const LoginRouter = createStackNavigator(
  {
    Login: Login,
    Register: Register,
    Dashboard: DashboardRouter,
    Address: Address,
    UserAdd: UserAdd,
    UserGroup: UserGroup
  },
  {
    initialRouteName: "Login"
  }
);

// DashboardRouter.js
const TabNavigator = createBottomTabNavigator(
  {
    MessageRouter: MessageRouter,
    AddressRouter: AddressRouter,
  },
  {
    ...
  }
);

A: If I got your question right, what you can do is create another navigator as a root navigator (another StackNavigator or SwitchNavigator) and include your LoginRouter, AddressRouter there.
Something like this, maybe?
const rootNavigator = createSwitchNavigator(
    {
      LoginRouter: {
        screen: LoginRouter,

      },
      AddressRouter: {
        screen: AddressRouter,

      }
    },
    {
      headerMode: "none",
      mode: "modal",
      initialRouteName: "LoginRouter"
    }
  );

This is just a example to give you an idea on how you could also implement your router.


text:
Q: Auto check checkboxes by retriving their values I've met some issues by retrieving checkboxes from an array of values.
I tried to auto check the checkboxes which are concerned by an array.
array[i] generate some input of checkboxes
target[i] is an array which contains some checkboxe's values. So when I refresh the page, I have to see that "tuesday" and "Wendesday" is already selected. cf.the snippet
(I don't know if I explain correctly)

// table which generate checkboxes

var array = new Array();
array[0]="Monday";
array[1]="Tuesday";
array[2]="Wendesday";
array[3]="Thirsday";
array[4]="Friday";
array[5]="Saturday";
array[6]="Sunday";

// values to of checkboxes I want to auto-check
var target = new Array();
target[0]="Tuesday";
target[1]="Wendesday";

var cbh = document.getElementById('checkboxes');
var val = '';
var cap = "";

var j = "";
for (var i in array) {
    //Name of checkboxes are their number so I convert the i into a string.
 j = i.toString();

 val = j;
 //cap will be the value/text of array[i]
 var cb = document.createElement('input');
 var label= document.createElement("label");

 cap = array[i];
 var text = document.createTextNode(cap);
 cb.type = 'checkbox';
 cbh.appendChild(cb);
 cb.name = cap;
 cb.value = val;
 label.appendChild(cb);
 label.appendChild(text);
 cbh.appendChild(label);
}
{
 box-sizing: border-box;
}
#data {
 padding:5px;
 width:100vw;
}
.multiselect {
 overflow: visible;
 padding:0;
 padding-left:1px;
 border:none;
 background-color:#eee;
 width:100vw;
 white-space: normal;
 height:50px;
}
.checkboxes {
 height:100px;
 width:100px;
 border:1px solid #000;
 background-color:white;
 margin-left:-1px;
 display:inline-block;
}

label {
 display: inline-block;
 border: 1px grey solid;
 padding:5px;
}
<form>

</form>
Tuesday and Wendesday have to be automitacly checked

Thank you for your help.
Regards

A: "So when I refresh the page..." When you refresh the page, the entire thing is reloaded, starting from scratch. Your array will be gone. If you want this behavior, you will have to persist the array somewhere (localStorage, cookies, server-side, etc.) and then retrieve the array upon page load.
If that's not quite what you meant and you just want to have a static array, then you need to access that array and check the checkboxes upon page load.
You have quite a bit of unneeded code, so a corrected version looks like this:

// Master array from which checkboxes are created (uses "array literal" syntax for shorter typing)
  var cbArray = ["Monday", "Tuesday", "Wendesday", "Thirsday", "Friday", "Saturday", "Sunday"];

  // values to of checkboxes I want to auto-check
  var target = ["Tuesday", "Wendesday"];

  // Get element that will contain checkboxes
  var cbh = document.getElementById('checkboxes');
  const checkboxGroupName = "chkDays";  // It is common to give all checkboxes in a group the same name

  // Loop through the master array and make labels and checkboxes based on what's in it
   cbArray.forEach(function(item, index) {

    // Create and configure checkbox
   var cb = document.createElement('input');
    cb.type = 'checkbox';
    cb.value = item;
    cb.name = checkboxGroupName;
    cb.id = checkboxGroupName + (index + 1);

    // If new checkbox is supposed to be checked, check it
    target.forEach(function(val){
      if(cb.value === val){
        cb.checked = true;
      }
    });

    // Create and configure label
   var label= document.createElement("label");
    label.setAttribute("for", cb.id);  // Labels should target an element's id
   label.textContent = item; // No need to go through the trouble of making a text node

    // Append elements into the DOM
    label.appendChild(cb);
   cbh.appendChild(label);

    // Confirming Output:
    console.log(label.outerHTML);
   });
* { box-sizing: border-box; }

#data { padding:5px; width:100vw; }

.multiselect {
    overflow: visible;
    padding:0;
    padding-left:1px;
    border:none;
    background-color:#eee;
    width:100vw;
    white-space: normal;
    height:50px;
}

.checkboxes {
    height:100px;
    width:100px;
    border:1px solid #000;
    background-color:white;
    margin-left:-1px;
    display:inline-block;
}

label { display: inline-block; border: 1px grey solid; padding:5px; }
<form>

</form>

A: set cb.checked = true to check the checkbox when created.
if (target.indexOf(cap) != -1) {
    cb.checked = true;
}

Adding snippet:
function getCheckbox(value, label, checked) {
  var cb = document.createElement('input');
  cb.value = value;
  cb.checked = checked;

  var label = document.createElement('label');
  label.innerHTML = label;

  return [cb, label];
}

var days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];

var checked = ['Tuesday', 'Wednesday'];

var cbh = document.getElementById('checkboxes');
var container = document.createDocumentFragment();

for (var i=0, len=days.length; i < len; i++) {
  var dom = getCheckbox(i, days[i], checked.indexOf(days[i]) != -1);
  container.appendChild(dom[0]);
  container.appendChild(dom[1]);
}

cbh.appendChild(container);

A: You can check if one array contains a specific string with:
Array.prototype.includes() ES6 or
Array.prototype.indexOf()
Also don't forget that  can wrap both your input and text-label

var cbh = document.getElementById('checkboxes'),
dayNames  = ["Monday","Tuesday","Wendesday","Thirsday","Friday","Saturday","Sunday"],
preselect = ["Tuesday", "Wendesday"];

for (var i in dayNames) {
  var day = dayNames[i];

  var label = document.createElement("label"),
      cb = document.createElement('input'),
      text = document.createTextNode(day);

  cb.type = 'checkbox';
  cb.name = day;
  cb.value = i;
  // PRESELECT MATCHING inputs
  // if(preselect.includes(day)) cb.checked = true; // or like:
  if(preselect.indexOf(day) > -1) cb.checked = true;

  label.appendChild(cb);
  label.appendChild(text);
  cbh.appendChild(label);
}

A: Well better solution was provided by @Scott Marcus but you can also try this,

    <form>

    </form>


text:
Q: jQuery dataTable to show recent records I'm new to dataTables concept in jQuery. I'm trying my best to learn and work with dataTables. My requirement is to show most recent recent records when the checkbox is checked. I'm using jQuery datatable.
Below is my sample code:
    $(document).ready(function() {
        initTable();
        } );

    function initTable(){
            oTable = $('#table_id').dataTable({
                                "aaSorting": [[ 12, "desc" ]],
                                "oLanguage": {
                                "sProcessing": "<span style='font-size:20px; color:blue;'>Loading...<span/>",
                                 "sLengthMenu": 'Display <select>'+
                                   '<option value="10">10</option>'+
                                   '<option value="20">20</option>'+
                                   '<option value="30">30</option>'+
                                   '<option value="40">40</option>'+
                                   '<option value="50">50</option>'+
                                   '</select> records'
                                            },
                                "bProcessing": true,
                                "bServerSide": true,
                                "asStripeClasses": [ 'evenrow', 'oddrow' ],
                                "sAjaxSource": "spreadData.do?method=searchSpreadData",
                                 "fnServerParams": function ( aoData )
                                 {
                                   aoData.push({"name":"searchCriteria.toDate", "value": $('#todateId').attr("value") });
                                   aoData.push( { "name":"searchCriteria.SerialNumber", "value":$('#serialNumberId').attr("value")});
                                   aoData.push( { "name":"searchCriteria.formatId", "value": $('#formatId').attr("value")});
                                   aoData.push( {  "name":"searchCriteria.fromDate", "value": $('#fromdateId').attr("value")});
                                   aoData.push( {  "name":"searchCriteria.doSearch", "value": $('#doSearchId').attr("value")});
                                   aoData.push( {  "name":"searchCriteria.spreadpercentage", "value": $('#spreadPercentage').attr("value")});
                             },
                                 "aoColumnDefs": [
                                     { "bVisible": false, "aTargets": [ 0 ] },
                                                               { "bVisible": false, "aTargets": [ 11 ] }
                                    ],
                                "bJQueryUI": true,
                                "bFilter": false
                        });
            $('#displayRecentRecords').click( function() {
                alert("step1");
                oTable.fnDraw();
        } );
    }
  //The below function is not getting called when checkbox is checked from UI.
    $.fn.dataTableExt.afnFiltering.push(
        function( oSettings, aData, iDataIndex ) {
            alert("step2");
             if($("#displayRecentRecords").is(':checked')){
               return true;
           }
            return !aData[11];

         }
    );

Show Recent Records:<input type="checkbox" id="displayRecentRecords"/>

Please see my sample code above. When I run the application and select the checkbox step1 alertbox is shown but step2 alert box is not getting called.
Please suggest what are the changes to be done to the above code to call last mentioned datatable function (alertbox which prints step2).
I'm new to dataTable concepts in jQuery. I read the documentation and came across few examples. Please find the JSFiddle : http://jsfiddle.net/9jf2k53p/135/.
Please suggest what modifications to be done in JSFiddle to show the most recent records when the checkbox is checked.
Appreciate the help. Thanks.

A: Change this line:
$.fn.dataTableExt.afnFiltering.push(

to this:
$oTable.fn.dataTableExt.afnFiltering.push(

OR (not sure which will work in your case):
$oTable.dataTableExt.afnFiltering.push(

You need to define the table as part of this function. That's what the oTable is for, as you defined this variable on the 6th line of your code above.

A:
SOLUTION

You need to define custom filtering function before initializing the table.
$.fn.dataTableExt.afnFiltering.push(
   function( oSettings, aData, iDataIndex ){
      // ... skipped ...
   }
);

var oTable = $('#table_id').dataTable({
   // ... skipped ...
});

DEMO

See this jsFiddle for code and demonstration.


text:
Q: SQL Server query performance suddenly degrades after data insertion Context: we have a SQL Server 2019 database containing outputs of a scenario modelling process (this was also happening on a SQL Server 2017 Express implementation).
Each instance of the model creates a complete set of data in a set of standard tables. The instance identifier is a key column in each table.
This data is then transformed into a star schema for visualisation and analysis.
The queries that join tables to create the star schema typically run in a few 10s of seconds to return 500,000 - 5,000,000 rows to populate the fact table of the star schema.
Problem: when a new instance is added often one or more of the queries takes hundreds of times longer. When run interactively in SSMS I am seeing around 10,000 rows a minute being returned. To get to 1 million this takes over an hour, where previously it was taking 20 seconds to return 880,000 rows.
This occurs both when running the simple query in SSMS with one 'instance ID' in the where clause, or whether this is done through a stored procedure that runs several queries to populate a fact table.
A rebuild of the indexes restores the previous performance.
Given that rebuilding the indexes becomes increasingly expensive as we have more instances in the database, are there other approaches to fixing this sort of performance blow-out?

A: Sounds like it could be that the tempDB is hitting an upper threshold (disk space).  Re-building indexes will clean up some space for a bit but it can start cranking back up again and cause problems.

A: The answer to this issue was provided by @Hogan.  After a bulk insertion for a new instance into the database do update statistics on each of the tables added to.
The existing statistics have no knowledge of the new instance ID and so SQL builds a plan that assumes 1 resulting record, instead of the million or so actually present.
This has made a difference of around 100-500 times in execution time and cost.


text:
Q: Jquery cookie not being read, or recognized correctly I have two cookies in this form, one is Text, one is a radio button selection. The text cookie works fine, but the radio button does not.
How its supposed to work:
Input text, make a selection, press button. Sends you to next page where the text is displayed, and the associated number of the radio button is displayed.
What is actually happening:
Input text, make a selection, press buton. Sends you to next page where the text is displayed, but there is nothing from the radio button selection.
Thank you ahead of time.
JSfiddle - http://jsfiddle.net/q7nja8j9/
HTML -
<form action="javascript:void(0)">
    <input type="text" name="cookie" id="cookie" value="">

   <input type="radio" name="char" id="char1" value="1">
   <input type="radio" name="char" id="char2" value="2">
   <input type="radio" name="char" id="char3" value="3">

 <input type="button" name="Fight" id="saveCookie" value="Fight" onclick="window.location.href='Battle.html'">
 </form>

JS-
$(function(){
    // attach event listener to save cookie button
    $('#saveCookie').click(function(){
        // set cookie expiration to 1 year from today
        var expDate = new Date();
        expDate.setFullYear(expDate.getFullYear() + 1);
        // create cookie string
        var cookieStr = $('#cookie').val() + ";expires=" + expDate.toGMTString();
        // create cookie
        var cookieChar = $('input[name="char"]:checked').val() + ";expires=" + expDate.toGMTString();
        document.cookie = cookieStr;
        document.choice = cookieChar;
    });

});

A: I think this question is related: How do I create and read a value from cookie?
First of all you have document.choice = cookieChar; instead of document.cookie = cookieChar;
But from what I have tested it shouldn't work anyway as at the point you have document.cookie = cookieStr; the value of cookieStr is something like abc;expires=Tue, 15 Dec 2015 02:20:13 GMT, but you need to set a cookie name as well. So it should be:
document.cookie = 'cookieName=' + cookieStr;
document.cookie = 'char=' + cookieChar;

Is there any reason you're using cookies like this instead of POSTing the form to a server side script (eg. php)? This may help: http://books.msspace.net/mirrorbooks/php5/067232511X/ch04lev1sec2.html
Javascript cookies
You need to read this (at a minimum): http://www.w3schools.com/js/js_cookies.asp
document.cookies is not a simple string variable, if you try console.log(document.cookies) you'll see something like this:
"cookieName=abc; char=2; __utma=45159731; __utmc=45159731;"

Which is a concatention of all the cookies set for the page, the part before the = is the cookie name, the part after the = is the cookie value, and the semi-colons separate the cookies. If you set a cookie with no cookie name (as you are doing) the string will look like this:
"2; cookieName=abc; char=2; __utma=45159731; __utmc=45159731;"

Note the extra "2" at the start. This is why the second cookie is overwriting the first one - because you haven't specified a name for the cookie so it has just re-set the first cookie with the new value.


text:
Q: What is the relation between normal extension and separable extension? What is the relation between normal extension and separable extension?
Let F be the algebraic extension of K, if F is a separable extension of K,if and only if F is a normal extension of K? is this correct?

A: Neither implies the other. So, there exist separable extensions that are not normal, and normal extensions that are not separable.
$\mathbb{Q}(\sqrt[3]{2})/\mathbb{Q}$ is a separable extension that is not normal.
It is separable because any extension of characteristic zero fields is separable, but it is not normal because (for example) not all algebraic conjugates of $\sqrt[3]{2}$ lie in the field $\mathbb{Q}(\sqrt[3]{2})$ (its conjugates are $\zeta_3\sqrt[3]{2}$ and $\zeta_3^2\sqrt[3]{2}$ where $\zeta_3$ is a cube root of unity; these are complex numbers, while $\mathbb{Q}(\sqrt[3]{2})\subset\mathbb{R}$).
$\mathbb{F}_p(\sqrt[p]{T})/\mathbb{F}_p(T)$ is a normal extension that is not separable.
It is normal because $\mathbb{F}_p(\sqrt[p]{T})$ is the splitting field of $x^p-T\in \mathbb{F}_p(T)[x]$, but it is not separable because the minimal polynomial of $\sqrt[p]{T}$ is $x^p-T=(x-\sqrt[p]{T})^p$ which does not have distinct roots.
A field extension $L/K$ that is both normal and separable is called a Galois extension.


text:
Q: How can I fix messy hair in Animal Crossing? I time-warped in Animal Crossing: New Leaf so I could get to the award ceremonies for the Bug-Off. I time-warped a year ahead, and now my hair's all messy. How can I put my hair back to normal?

A: First, you will need to have a Shampoodle's on Main Street. You can get Shampoodle's by spending 10,000 Bell at the Able Sisters after unlocking Kicks. You can do this after spending at least 8,000 Bells in the Able Sisters after you have played the game for at least 10 days. Then, when Shampoodle's is open for business, she will ask you a couple of questions on how you want your hair to look. The process will cost 3,000 Bell, but will be worth it after you see the kind of hair you got!

A: You can fix messy hair by going to Shampoodles. Shampoodles can be found on main street.


text:
Q: Django - Join first row of a related table Say I have the tables Products and Images, where a product can have many images. When fetching a list of products for a search results page, how can include the first product image as a thumbnail?
What would be the best way to do when also taking performance into consideration? (number of queries, memory, overall time, etc)

A: I believe you would want to fetch the image directly in template. Rather than building a list in view and pass it in template, as there would be on number of items.
So I will recommend to implement a method in Products model that finds first image and returns url for it.
models.py
def Products(models.Model):
    #your fields

    def get_image_url(self):
        try:
            img = self.images_set.filter()[0] #get first image
            return img.url()
        except Exception:
            return None

In template:
{% for p in product_list %}
     {# render product and add image #}
     <img href="{{p.get_image_url }}" />
{% endfor %}

A: If you need performance boost w/o much architecture reworking, de-normalization is a first way to try:
class Product(models.Model): # instead of Products as convention
    first_image = models.ImageField(editable=False, null=True)

Then maintaining the first_image when Product.image_set get updated through signal.
Also, you could even store the "weakref" inside some dumped field (use this when you really need it :)
class Product(models.Model):
    # from django-jsonfield, store raw values of ImageField of the Images model
    extra = JSONField()
    def first_image(self):
        image = self.extra.get('image')
        return models.ImageField.attr_class(None, models.ImageField(), image) if image else None

Other simple ways may include

*

*Load the first images in batch and use them in template loop per Product(). The first images need to be marked for easy query.

*directly store first_image in Product instead of being an Images. This works fine for  simple sites w/o too much management requirements .


text: Q: Multiple parents in typeorm tree structure? I have an application that uses Materialized Path to map a folder structure. Now I want to change it so that it is possible to link folders logically in multiple places (so a folder can have multiple parents). Is this possible with TypeORM? I've read a lot in the documentation and found nothing suitable.


text:
Q: Why is my Win32 application not starting? I just made a C application (first time programming) but when I start the application, the console doesn't show up. However the program remains active in background because when I try to compile again, Linker says that it cannot access the .exe.
The application runs smoothly on another computer (64bits and Windows 10).
The app is ok but for some reasons my laptop can't run it.
I have a MSI apache 2qd (64bits). It runs on Windows 10 and use Visual studio 2013.
Here is the app source code:
#include <stdio.h>          // librairie de fonctions utiles dont printf() et scanf()
int main()                  // le programme principal, celui qui sera execute
{
    double a, b, c, sol, sil, delta;                // declaration des variables reelles
    //int i, j, quotient, reste;       declaration des variables entieres
    printf("Resolution de l'equation du second degre : ax²+bx+c=0 \n");
    printf("Terme du 2nd degre (a) : ");
    scanf("%lf", &a);
    printf("Terme du 1er degre (b) : ");
    scanf("%lf", &b);                            // saisir sur le clavier : attention au &
    printf("Terme independant (c) : ");
    scanf("%lf", &c);

    if (a == 0)
    {
        printf("\nVous cherchez les solutions de l'equation %lf x² + %lf x + %lf = 0\n\n", a, b, c);
        if (b != 0)               // !=   est different de (comparaison ds une condition)
        {
            sol = -c / b;         //  =   calculer l'expression a droite et ranger le resultat dans la variable de gauche (affectation)
            printf("Solution unique : %lf \n", sol);
        }
        {
            if (c == 0)           // ==   est egal a (comparaison ds une condition)
                printf("Equation indeterminee : une infinite de solutions !\n");
            else
                printf("Equation impossible : pas de solutions !\n");
        }
    }
    else
    {
        if (a != 0)
        {
            delta = b*b - 4 * a*c;
            if (delta == 0)
            {
                sol = -b / 2 * a;
                printf("Solution unique : %lf \n", sol);
            }
            else
            {
                if (delta > 0)
                {
                    sol = (-b + sqrt(delta)) / (2 * a);                                         // sqrt(x);
                    sil = (-b - sqrt(delta)) / (2 * a);
                    printf("solution 1 : %lf \n", sol);
                    printf("solution 2 : %lf \n", sil);
                }
            }
            if (delta < 0)
            {
                printf("Equation impossible : pas de solutions réel !\n");
            }
        }
    }
    return 0;
}

thanks in advance.

A: Turn off Avast or any other antivirus you currently have for a few minutes while you test your program.
Antivirus software sometimes get stuck analyzing this new executable and never return control back to the OS.
If this solves your issue, add your C projects folder to the exclusion list so you don't have to manually disable/re-enable the antivirus each time you want to run your application.


text:
Q: Angular - Animation initialization with ngIf My current angular version is: 4.2.6
I am using angular's animation dsl to animate the opening of a modal component. The component is nested within another component that is shown/hidden using an *ngIf.
Here is a basic overview of the structure of the page:
<parent-wrapper>

    <child-component>

      <modal-component active="modalActive"></modal-component>
    </child-component>

    <child-component>

      <modal-component active="modalActive"></modal-component>
    </child-component>

</parent-wrapper>

When the page loads the toggle values are false. During this time logging shows that the components get initialized yet are not added to the DOM.
When I set one of the toggles to true it renders the component in the DOM yet the animation styles for the modal component are not properly initialized which prevents the animation from working properly. The modal functions as expected yet it does not animate.
This is what I'm seeing in my inspector (modal component initialized with the input "inactive" for the animation):
<app-modal class="ng-tns-c21-7" ng-reflect-active="inactive">

If I move the modal component outside the *ngIf it initializes and is rendered to the DOM as expected and animates just fine.
This is what it looks like properly initialized (modal component initialized with the input "inactive" for the animation):
<app-modal class="ng-tns-c21-7" ng-reflect-active="inactive">

It's important that the modal be packaged with the child component so moving it to another location is not an option.
What is preventing those styles from being applied to the modal DOM when the modal component is rendered from an *ngIf?


text:
Q: Data not saving to database properly Django ManyToManyField I have a webapp with a friends feature, which is all working except for the bit of saving the current user into the requested user's ManyToManyField
Here is my model
friends = models.ManyToManyField(User,blank=True,related_name='user_connections')

And my view
class AddFriendRedirect(RedirectView):
    def get_redirect_url(self,*args,**kwargs):
        username = self.kwargs.get("username")
        obj = get_object_or_404(UserProfileInfo,slug=username)
        url_ = obj.get_absolute_url()
        user = self.request.user
        if user.is_authenticated:
            print("User is authenticated")
            if user in obj.friends.all():
                obj.friends.remove(user)
                user.user_connections.remove(obj) #this line isnt saving the obj to the database
            else:
                obj.friends.add(user)
                user.user_connections.add(obj) # this line isnt saving the obj to the database
        return url_

And finally my urls
path('profile/<str:username>/add/',views.AddFriendRedirect.as_view(),name='add_friend'),
Everything is working except for saving for the user.user_connections.add(obj). On obj.friends.add(user), it adds the current user to their Manytomanyfield, but it's just not working on the user.user_connections.add(obj) one. I have tried heaps of things, including
user.friends.add(obj)
user.userprofileinfo.friends.add(obj)
user.userprofileinfo.user_connections.add(obj)

UserProfileInfo is my custom UserProfile model

I am just confused as to why this isn't working, and it's weirder because no errors are being thrown either.
Thanks for any help


text:
Q: javascript and divs, creating images and paragraphs in divs. Im trying to do some basic stuff with javascript, to get it to generate some website content automatically,, but its driving me crazy!!! Could someone please show me a simple example of how to do get javascript to create new images and paragraphs in divs.. lets say my website structure is like this...

</html

how would I use a javascript function to create images and paragraghs in the "content" div on-loading the page and also on-clicking an image. I know it has to with the DOM but Ive been at this for hours and I just cant get it to work! Please show me an example of how its done. Thanks a lot in advance!!!!!!

A: In its simplest form:
// gets a reference to the div of id="content":
var div = document.getElementById('content'),
    // creates a new img element:
    img = document.createElement('img'),
    // creates a new p element:
    p = document.createElement('p'),
    // creates a new text-node:
    text = document.createTextNode('some text in the newly created text-node.');

// sets the src attribute of the newly-created image element:
img.src = 'http://lorempixel.com/400/200/people';

// appends the text-node to the newly-created p element:
p.appendChild(text);

// appends the newly-created image to the div (that we found above):
div.appendChild(img);
// appends the newly-created p element to the same div:
div.appendChild(p);

JS Fiddle demo.
References:

*

*element.appendChild().

*document.createElement().

*document.createTextNode().


text:
Q: I cannot get spring tools suite to run my program [36mo.a.tomcat.jdbc.pool.ConnectionPool     [0;39m [2m:[0;39m Unable to create initial connections of pool.
java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES)


text:
Q: Web Content radio buttons don't switch in Screen Time Family As my daughter grows, I wanted to change the settings of Content & Privacy Restrictions > Content Restrictions > Web Content, from Allowed Websites Only to Limit Adult Websites.
But radio buttons don't seem to work. It asks for the PIN, but after changing, two buttons are selected. It is the same on the child's and parent's device.

I tried turning off ST, and restarting, and turning on again, but it looks like it gets back to Allowed Websites Only mode.
Is there a way to reset that without signing off iCloud?
PS: Also submitted with Feedback Assistant under FB9071145.

A: Here's how I fixed this issue. I had to use my iPhone:

*

*Go into your iPhone > Screentime > Family area (scroll down) > Select the family member with the rogue settings

*Turn Off Screen Time

*Turn Screen Time back on and set it up again (you can skip most of the settings, they will actually revert to what was saved last time on the MacBook you are trying to control)

*Change the setting for Content for the rogue radio buttons to what you want it to be

*Go back to the Macbook in question - view how the settings are now fixed!


text:
Q: Error while importing oracle dump using DBMS_DATAPUMP in oracle 12g I have been trying to import a dump file into Oracle 12g under RDS in AWS and getting below error all the time and I can't figure it out on what is happening. Any help or pointers are greatly appreciated.
Here is what I am trying to do.
1) I got a .dat dump file from customer (not sure how they have exported this dump from oracle) and my aim is to import this to AWS oracle RDS instance.
2) As per How to transfer Oracle dump file to AWS RDS instance?
I have created new EC2 instance and installed Oracle Express edition and then copied .dat file to DATA_PUMP_DIR directory (/u01/app/oracle/admin/XE/dpdump/).
3) Created database link to AWS oracle RDS instance and able to copy this to rds instance using DBMS_FILE_TRANSFER.PUT_FILE.
4) I can see the file under DATA_PUMP_DIR path in oracle rds instance.
so far so good.
5) Now, I am trying to import the dump file into RDS using below procedure
DECLARE
hdnl NUMBER;
BEGIN
hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA', job_name => null);
DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'sample.dat', directory => 'DATA_PUMP_DIR');
DBMS_DATAPUMP.START_JOB(hdnl);
END;
/

All the time I get below error
DECLARE
*
ERROR at line 1:
ORA-39001: invalid argument value
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4087
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4338
ORA-06512: at line 5

I understand the error is pointing to the line DBMS_DATAPUMP.ADD_FILE() but I could not able to make out what is wrong here.
I have tried various options to import but none helped. I have created tablespace and also make sure user is having correct permissions.
Any pointers are greatly appreciated.

A: 1)Connect to the RDS instance with the Amazon RDS master user account.
2) Run this pl/sql block
    DECLARE
    hdnl NUMBER;
    BEGIN
    hdnl := DBMS_DATAPUMP.OPEN( operation => 'IMPORT', job_mode => 'SCHEMA', job_name=>null);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'sample_copied.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
    DBMS_DATAPUMP.METADATA_FILTER(hdnl,'SCHEMA_EXPR','IN (''SCHEMA_NAME'')');
    DBMS_DATAPUMP.START_JOB(hdnl);
    END;

/

3) You can start importing from any oracle client. For example, Instance EC2.
impdp RDS_master_user/password@rds_instance DUMPFILE=sample.dmp   DIRECTORY=DATA_PUMP_DIR parfile=import_parfile

import_parfile
SCHEMAS =SCHEMA_NAME


text:
Q: Selenium - how to click on white space area of the text box I'm trying to click the whitespace area of the text box rather than the text of the element. Is it possible in selenium or is there any other tricky approach?

The red arrow is placed where I want to click
HTML:

    <div id="stan_servicecategoryid" data-attributename="stan_servicecategoryid" data-formid="bfef905d-acd0-4ee9-a900-2034792789c1" data-fdeid="PrimaryEntity" data-layout="0" tabindex="1070" isinline="true" lookupstyle="single" lookupdialogmultipleselect="0" isinlinenewenabled="1" showasbreadcrumbcontrol="0" showglobalquickcreate="0" openfullform="1" addlookupimagebutton="" role="application" entitylogicalname="stan_servicecategory" entitydisplayname="Service Category" entitytypecode="10041" allowfilteroff="0" disablequickfind="0" disableviewpicker="1" disablemru="1" isdeduplookup="0" availableviewids="{EA878523-32E1-49BB-B0C5-FF97230B5AF2}" resolveemailaddress="0" allowunresolvedpartiesonemailsend="0" defaultviewid="{152B96D2-3BF4-469E-8BB4-52C639E51E50}" class="ms-srm-Inline-Chrome lookup nvarchar" aria-label="Service Category Unique identifier for Service Category associated with Service Request.  test Select the Enter key to edit the lookup field, and the Control and Enter keys to open the link">

Service Category

                test

                                            test

                            Enter a search term, then select the Enter key to search
                            <input class="ms-srm-InlineInput ms-srm-InlineLookupEdit" ime-mode="auto" aria-labelledby="stan_servicecategoryid_lookupedit stan_servicecategoryid_w" type="text" id="stan_servicecategoryid_ledit" maxlength="1000" style="display: none;">

Selenium:
driver.FindElement(By.Id("stan_servicecategoryid_lookupValue").Click();

new Actions(driver).MoveToElement(driver.FindElement(by)).SendKeys(Keys.Clear).Perform(); // This will clear the value of the text box

A: Use ACTIONS (or ActionChains in Python)
If you simulate moveToElement(element) and click(), it clicks exactly in the centre of the element. If the text is long and the above still clicks on the text, use moveToElement (with offset), giving it x-offset as required.
Java:
Actions action = new Actions(driver);
action.moveToElement(element).click().perform();

or
action.moveToElement(element, x-offset, 0).click().perform();

Python:
from selenium.webdriver.common.action_chains import ActionChains as AC

AC(driver).move_to_element(element).click().perform()

or
AC(driver).move_to_element_with_offset(element, x-offset, 0).click().perform()


text:
Q: Zend_Search_Lucene, how to share an index storage folder over network I am running web application on two different servers with load balancing, and using Zend_Search_Lucene for indexing documents.
Now I am facing indexing issue which a user comes to the site through server #1 and stores information, Zend_Search_Lucene stores index only server #1.
So once another user comes to the site through server #2 and search, only the indexes in server #2 retrieve.
Is there any way to share an index storage folder to be accessed by both servers?
Or is there any way to store indexes in mysql database, not a file system?

A: okay please don't hurt me because i won't give you an exact answer to your question but give you an alternative.
please dont use zend for that, its very slow. believe me. its just a bad implementation that has to be fully loaded for every search request. just do some benchmarks and you'll notice.
lucene does indeed support sharding (distributing indexes to several servers and combine the results seperately fetched)
it does as well support replication which would be a better go for you
so here comes the actually useful part:
check out solr at http://lucene.apache.org/solr/
its all setup witn an example installation using jetty included.
you raelly don't have to do anything more than customize your fields if you dont use wildcard fields and start it using java -jar start.jar
once the server is running on its default port which i just forgot, you have an inderface to which you can send your new documents using http post.
you can do that from php from each of your application servers.
solr will then index it and commit the changes if you included the commit flag.
you can query your index using the http interface and the solr query parameters. then you get a neat json or xml formattet document.
you can replicate your server if you experience any load problems.
but your server will manage 1000x times more requests than if you do it using zend because everything is up and running, lucene is loaded and the querys can be prozessed right away.
just check out this step by step tutorial and you should be fine:
http://lucene.apache.org/solr/tutorial.html
if you dont like all that and want to stick with zend anyway:
database is not possible bei nature, but you could write a wrapper. this would however be absurd.
the best thing to do in this case is to set up a network file system!
any questions, lemme know.
ps: when you come across the choice, is suggest using dismax, in most cases its a lot faster.


text:
Q: ASP.NET configuration files vs normal XML files In my web site which is basically a monitor application I have to keep a configuration file which contains some web servers name, names of web sites hosted on each web server, url and port numbers etc.
Can anyone please explain me what are the benefits of treating this configuration file as custom configuration file of my web application and reading it using "ConfigurationSection" or "IConfigurationSectionHandler" rather than treating it as a normal xml file and reading it using 'XMLDocument' or 'XMLTextReader' or 'XLINQ' etc? This will save me from creating an entry in in the web.config file as well this custom configuration file.
I have spent good amount of time on the internet looking for this answer but could not find any satisfactory answer.
Please help..

A: There are at least two reasons:

*

*The web.config is designed to hold the configuration for your website; therefore, anyone maintaining the site in the future will know to look there for settings that pertain to the site.

*Using the *.config for any application allows you to use the ConfigurationManager class (in the System.Configuration assembly) to read from / write to the file, which is simpler than writing your own xml (as it is designed specifically for the purpose of persisting configuration information).

A: From a security perspective, if you put your XML file on your site and I can guess/discover the filename, I can get the file and I now know all your sites, what servers they are on, and a set of ports on the server that are open that I might be able to use to attack and take control of the servers.
By contrast, ASP.NET will not (by default) serve up a .config file to a browser request, making it harder for me to discover all that information.


text:
Q: How do I open a specific port on OS X Yosemite from the command line? I cannot seem to find anywhere how to open a specific port on OS X Yosemite. I understand that I can use 'Little Snitch' in order to open a port, but I would love to do it from the command line.
This is for a Firewall port.


text:
Q: Organization Chart - Allow editing by multiple team members using C# I am working on creating an org chart for my organization and I am using C# as the technology to implement the same with XML to store the data.  I have few challenges and need your guidance:

*

*If an employee has more than one manager/supervisor, how to establish the relationship?

*How to handle a case wherein one of the employee of an already existing chart (tree) wants to create a chart from his level, but he is already in a tree created by his manager/supervisor?


text:
Q: ELMAH not logging in WCF I've implemented the solution explained here: Exception Logging for WCF Services using ELMAH
When I debug my code, the ProvideFault in the ErrorHandler is executed correctly and the line which calls ELMAH is also hit:
Elmah.ErrorSignal.FromCurrentContext().Raise(error);
However ELMAH does not log any errors and doesn't send an email (both are set up in the web.config). But if I call ELMAHS log method directly, ELMAH creates a log entry in the database:
Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(error));
Anyone SO's who've had this problem?
All input is much appreciated!

A: Not sure what could be wrong from what you provide in your question but try going through all the steps outlined in this blog post.

A: I was puzzled before - now I'm even more puzzled! I tried to upload my solution and it works on IIS?! I doesn't work when i test i locally, but works on the server. Why is a mystery to me...


text:
Q: In `Python 3`, get maximum of first m elements and last m elements from a list of integers In Python 3, how to get maximum of first m elements and last m elements from a list of integers n times (omitting the previous maximum value) efficiently?
say
arr=[10,20,35,30,10,45,0,20,25,50,15]
m=4
n=3
1<=array size<=10^5
0<=array element<=10^9
1<=n<=array size
1<=m<=array size

First m elements = [10,20,35,30]
Last m elements = [20,25,50,15]

0th element of the output list --> maximum of above i.e. 50

after omitting 50
arr=[10,20,35,30,10,45,0,20,25,15]
First m elements = [10,20,35,30]
Last m elements = [0,20,25,15]
1th element of the output list --> maximum of above i.e. 35

and so on... upto (n-1)th element

I tried using basic logic and its working fine for small inputs, but got timeout error as list size,m,n can be upto 10^5. is there any python specific shortcuts to achieve it efficiently?
Code #1
for i in range(0,n):
    if len(arr)>2*m+n-i-1:
        temp=arr[:m]+arr[-m:]
    else:
        temp=arr
    x=max(temp)
    ind=temp.index(x)
    if ind>=m:
        ind=ind-len(temp)
    arr.pop(ind)
    print(x)

code #2
l=len(arr)
for j in range(0,n):
    acnt=0
    bcnt=0
    ai=0
    bi=-1
    x=-1
    while acnt<m and ai<l:
        if arr[ai]!=-1:
            if arr[ai]>x:
                x=arr[ai]
                i=ai
            acnt=acnt+1
        ai=ai+1
    while bcnt<m and bi>=-l:
        if arr[bi]!=-1:
            if arr[bi]>x:
                x=arr[bi]
                i=bi
            bcnt=bcnt+1
        bi=bi-1
    print(x)
    arr[i]=-1

Also I tried using recursion and sorting, but I am still getting Timeout error for large test cases. Is there any other solution with less complexity?

A: m = 4
n = 3
arr = [10,20,35,30,10,45,0,20,25,50,15]

# From Start
for x in range(n):
    maximum = max(arr[:m])
    arr.remove(maximum);
    print(maximum)

arr = [10,20,35,30,10,45,0,20,25,50,15]

# From End
for x in range(n):
    maximum = max(arr[m+1:])
    arr.remove(maximum);
    print(maximum)

Slice the list to the m-th element and take it's maximum and after that remove the first occurrence from the initial list.
Since it removes the maximum element from the array and assuming those ranges might overlap, there is the need to initialize the initial array twice. Unless you know they won't overlap.
Or if the goal is to take max from the beginning and from the end in turns then it can be easily modified to:
m=4
n=3
arr=[10,20,35,30,10,45,0,20,25,50,15]

for x in range(n):
    maximum = max(arr[m+1:]) # From End
    arr.remove(maximum);
    print(maximum)
    maximum = max(arr[:m]) # From Start
    arr.remove(maximum);
    print(maximum)

Obviously there might be a better solution.
You could possibly speed up the process by using some sort of memoization and dynamic programming. Keep track of sub-array values in sorted order, for easy access to the next maximum and only add/remove those one by one.
Or create some custom data structure to keep track of local maximum.
Also check this:
Finding maximum in sliding window

A: A full implementation could be like the following:
import itertools

def f(array, m, n):
    l = len(array)
    if l <= 2 * m: # The full array fits in the first iteration
        temp = sorted(array)
        for i in range(-1, -min(n,l)-1, -1):
            yield temp[i]
    else:
        i = m          # Next element from the start
        j = l - m - 1  # Next element from the end
        temp = [(array[k], k) for k in itertools.chain(range(i), range(j + 1, l))]
        for _ in range(n):
            temp.sort()
            max, index = temp[-1]
            yield max
            if i > j:  # Check that we haven't crossed the indexes
                break
            if index < i:
                temp[-1] = (array[i], i)
                i += 1
            else:
                temp[-1] = (array[j], j)
                j -= 1

# Usage
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=4, n= 3)))
# [50, 35, 30]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=4, n= 4)))
# [50, 35, 30, 45]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=4, n=10)))
# [50, 35, 30, 45]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=4, n=12)))
# [50, 35, 30, 45]

print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=10, n= 3)))
# [50, 45, 35]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=10, n= 4)))
# [50, 45, 35, 30]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=10, n=10)))
# [50, 45, 35, 30, 25, 20, 20, 15, 10, 10]
print(list(f([10, 20, 35, 30, 10, 45, 0, 20, 25, 50, 15], m=10, n=12)))
# [50, 45, 35, 30, 25, 20, 20, 15, 10, 10, 0]

A: Finally removing the extra loop overheads, it is working fine for all test cases. Thanks for the help guys.
f=0
r=len(arr)-1
f_flag=1
r_flag=1
for i in range(0,n):
    if r<=f+2*m-1:
        arr[f:r+1]=sorted(arr[f:r+1],reverse=True)
        f=f+n-i
        break
    else:
        for j in range(0,m-1):
            if f_flag==1:
                if f+j+1<len(arr):
                    if arr[f]<arr[f+j+1]:
                        x=arr[f]
                        arr[f]=arr[f+j+1]
                        arr[f+j+1]=x
            if r_flag==1:
                if r-1-j>=0:
                    if arr[r]<arr[r-1-j]:
                        x=arr[r]
                        arr[r]=arr[r-1-j]
                        arr[r-1-j]=x
        if arr[f]>=arr[r]:
            f=f+1
            f_flag=1
            r_flag=0
        else:
            r=r-1
            f_flag=0
            r_flag=1
return(sum(arr[:f]+arr[r+1:]))


text:
Q: How to make a JTable's width >= the enclosing scroll pane's width? I want to make the table width at least fitting the enclosing scroll pane's width, and if it's getting larger, the horizontal scroll bar is used.
None of JTable's auto resize modes suits my need: AUTO_RESIZE_OFF does allow the table to be resized larger than the scroll pane's width, but it can't limit the table's minimal width; the other modes don't allow the table width to be larger than the scroll pane's width at all.
I have tried to set the minimal size as below but it didn't work:
JTable table = new JTable(myModel);
JScrollPane scrollPane = new JScrollPane(table);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

// After the table is displayed.
table.setMinimalSize(scrollPane.getSize());

Any idea to achieve that?

A:
I have tried to set the minimal size as below but it didn't work:
table.setMinimalSize(scrollPane.getSize());

*

*JTable and JScrollPane can't returns reasonable Min, Max and PreferredSize

*you can to fit (on applications startup) JScrollPanes dimension to JTable by using table.setPreferredScrollableViewportSize(table.getPreferredSize()); (carefully with number of row, otherwise you have to calculating a Dimension instead of JTable.getP...) for JFrame.pack(), on runtime must be validated by revalidate() and repaint() for container nested JScrollPane, don't do that

*don't reinvent the wheel, to use Fixed Column Table of Table Column Adjuster by @camickr, which one isn't clear from your description,  depends of your ...

a JTable's width >= the enclosing scroll pane's width?

*

*couldn't be reversed this idea


text:
Q: SQL Server oddity with full-text indexing and case sensitivity and numbers This problem may be unique to our server, but I can't tell from the symptoms where the issue may lie.
My SQL Server version is  Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2019 Standard 10.0  (Build 17763: ) (Hypervisor)
The Server Level Collation: SQL_Latin1_General_CP1_CI_AS;
The Database Maintenance Collation: SQL_Latin1_General_CP1_CI_AS
I have a field (searchtitle) in a table (fsItems) that has a full-text index turned ON. For the record with primary key (IDItem) 704629, the content of this full-text indexed field is "TEST AFA 0 TEST".
Surprisingly, the following query returns no results:
SELECT * FROM fsItems WHERE CONTAINS(searchtitle,'AFA') AND IDItem = 704629
However, if I change the content to be "TEST afa 0 TEST" or "TEST AFA O TEST" (capital "O" instead of zero) the query returns the record. (It also returns the record if I change the content to "TEST AFB 0 TEST" and change the CONTAINS argument to AFB.)
At first I thought maybe AFA was some kind of stop word (I checked, it isn't), but that wouldn't explain why changing zero to upper-case "O" returns the proper result.
Any idea what is going on here? In other words, the query doesn't seem to be able to find "AFA" unless it is "afa" or unless I make some seemingly unimportant changes to the text itself, like change a number to a letter, or change the spelling of AFA to AFB. Why would that be?
Thanks for any suggestions


text:
Q: The group $G=\{ \sigma \in Aut(K) : \sigma|_\mathbb{Q} = id_\mathbb{Q} \}$ of $K=\mathbb{Q}(7^\frac{1}{5})$ I'm trying to find the group $G=\{ \sigma \in Aut(K): \sigma|_\mathbb{Q} = id_\mathbb{Q} \}$ for $K=\mathbb{Q}(7^\frac{1}{5})$ and here is my reasoning:
Since $\mathbb{Q}\subseteq K$ is a finite extension and $\textrm{char}(\mathbb{Q})=0$ the extension is separable, hence $|S|=[K:\mathbb{Q}]_s=[K:\mathbb{Q}]=\textrm{deg}(f)=5$ where $f=x^5-7$ is the minimal polynomial of $\alpha=7^\frac{1}{5}$ and $S=\{\sigma:K\rightarrow \overline{\mathbb{Q}} :\sigma \hspace{0.2cm} \textrm{is an homomorphism and} \hspace{0.2cm} \sigma|_\mathbb{Q}=id_\mathbb{Q} \}$. Clearly, $G\subseteq S$.
Note that for each $j=1,...,4$, $\alpha\beta^j$ is a root of $f$, where $\beta=e^\frac{2\pi i}{5}$ and together with $\alpha$ they are all the roots of $f$. Hence $K\simeq \mathbb{Q}[x]/(f) \simeq \mathbb{Q}(\alpha\beta^j)$ for each $j=1,...,4$ by the isomorphism $\sigma_j: K\rightarrow \mathbb{Q}(\alpha\beta^j)$,  $\sigma_j(\alpha)=\alpha\beta^j$, $\sigma_j|_\mathbb{Q}=id_\mathbb{Q}$. Since $\mathbb{Q}(\alpha\beta^j)\subseteq \overline{\mathbb{Q}}$ and there are $4$ distinct $\sigma_j$ we arrive that $S=\{id_K, \sigma_1, \sigma_2, \sigma_3, \sigma_4 \}$. Because $\alpha\beta^j \notin K$ we get that $\sigma_j \notin G$. Therefore: $G=\{id_K\}$
If anyone could verify my reasoning and give me feedback would help me very much. Also any alternative proof is appreciated.

A: Looks good.  A couple of comments on your proof.  Any field automorphism of $K$ is automatically going to fix $\mathbb Q$ pointwise, so you can just write $G = \operatorname{Aut}K$.
Your proof contains a lot of fluff and can be shorted.  There is no need to mention anything about separability (since we are in characteristic zero as you point out) or about the fields $K(\alpha \beta^j)$ or about embeddings of $K$ into $\overline{\mathbb Q}$.
The main idea is that any automorphism $\sigma$ of $K$ is going to send $\alpha = \sqrt[5]{7}$ to a root of $x^5= 7$.  Since $K$ doesn't contain any such roots except for $\alpha$ itself, this means that $\sigma$ must fix $\alpha$ and hence $\sigma = \operatorname{id}_K$.


text:
Q: Time Dependent Perturbation Theory Probabilities (This is taken from Griffiths Quantum Mechanics):
So suppose I have two states $\psi_{a}$ and $\psi_{b}$, and the particle starts out in the state $\psi_{a}$:
$$
c_{a}(0)=1\qquad c_{b}(0)=0.
$$
To first order,
$$
c_{a}^{(1)}(t)=1\qquad c_{b}^{(1)}(t)=-\frac{i}{\hbar}\int_{0}^{t}H_{ba}'(t')e^{i\omega_{0}t'}dt'
$$
where
$$
H_{ba}'=\left<\psi_{b}|H'|\psi_{a}\right>
$$
for some perturbation $H'(t)$.
Now the probabilities $$|c_{a}^{(1)}(t)|^2+|c_{b}^{(1)}(t)|^2\neq 1.$$ Griffiths says that to first order in $H'$, these sum to 1. I'm just not quite sure how to make sense of this statement. Do I do some kind of expansion in $H'$ and show that $|c^{(1)}_{b}(t)|^2$ vanishes?

A: Indeed, to the 1st order, the sum is 1.
Note that $|c_b(t)|^2$ is on the 2nd order of the perturbation.


text:
Q: Recaptcha works locally, but not in production I followed the instructions on how to add Recaptcha to my website (asp.net 4.0, Visual Studio / VB.  When I run the page locally, which is just a simple contact form page that sends an email, the recaptcha thing shows up fine.  I am NOT a programmer, though.
When I move it to production -- and I move the website (and the dll and pdb to the app_code folder and the bin folder, which Visual Studio created on its own), the page won't just refreshes and never sends an email -- and it doesn't matter if you type the right or wrong thing in the recaptcha textbox.  Without the recaptcha code, the contact.aspx page functions normally and sends the email instantly.
But the recaptcha box is there.  I've read things about handler mappings in IIS and my web.config, but I'm not intelligent enough to understand if I have to do anything or not, and what to do.  I also have IIS 7.0 on here.
UPDATE:
When you enter the recaptcha information in the text box properly, the page displays the confirmation I encoded, and sends an email.  When you do NOT enter the recaptcha info correctly, instead of sending a "Please try again" message, it just refreshes the page and makes them start all over again.  It does not say "Please Try again" and doesn't leave the client with knowledge that they mistyped the code

A: Are you using the reCAPTCHA ASP.NET control with the Recaptcha.dll?
You need to have signed up for the service with a domain name. The public and private keys you receive are checked against this domain:

reCAPTCHA will only work on this domain and subdomains.

Notice it the admin page screenshot below:

But this rule does not apply on the localhost domain, which is what you use when developing with Visual Studio. So it may be that you are not using the keys that you received when registering your domain. When you select the control and switch from design view to code view in Visual Studio the control code should look like this, with the keys:
<recaptcha:RecaptchaControl ID="recaptcha" runat="server"
  PublicKey="6Lexn8wSAAAAAIfH1c3-6K3FbSjcKdMj3uiMImI7"
  PrivateKey="6Lexn8wSAAAAAKRFTJXTudJN1owrIQMDahwYv0hg" />

If not, you have to enter your keys. This is just an example, don't use these keys, use the keys displayed in your own account for your own domain.


text:
Q: Using KnpMenuBundle in Symfony2 for menu of Entities? I have a User entity and all users have many Category entities.  I have a controller which accepts a Category slug as a parameter.
I would like to render a menu that lists all of the Category's of a User as links to that controller.  I would also like to mark one as "current" if they are on that page already.
The KnpMenuBundle looks nice for this https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/index.md
But all of its examples use a static menu that is built up, rather than building the menu from dynamic items.  I thought about getting the items in the Builder, but I already have them in the controller that ultimately renders the twig template, so I would rather somehow pass these Category's to the Builder and let it handle rendering a menu.
What is the best way to do this?
My other idea is to just do the menu myself in twig, but I would need extra logic to determine which page is "current"

A: I know that this might not be useful to you anymore but for others viewing the question maby this is helpful.
Since recently it is possible to send your own variables from twig to the builder.
It's done like this as noted in the Documentation:
{% set menuItem = knp_menu_get('AcmeDemoBundle:Builder:mainMenu', [], {
        'some_option': 'my_value'
    })
%}

{{ knp_menu_render(menuItem) }}


text:
Q: Hiding/showing a particular `UIView` I have around 5 UIViewsin my .xib, inially i am showing only 1 view(view1) which has some labels and button, when i click on button i prompt a systems alertView for granting permission from the setting of the phone and once i get the permission, i am hiding view1 and showing other 4 views using setHidden method, but the view is not refreshing and not showing other 4 views.
-(void) gotPermission
{
    [self->_View2 setHidden:NO];
    [self->_View3 setHidden:NO];
    [self->_View4 setHidden:NO];
    [self->_View1 setHidden:YES];
}

A: Try this.
Check for proper connections to the properties, (ie view1 with the view1 in the storyboard or XIB).
-(void)gotPermission{
 self.View2.hidden = NO;
 self.View3.hidden = NO;
 self.View4.hidden = NO;
 self.View1.hidden = YES;
}

Check if views are overlapping on one another, If not check if views are inside one another, if so, all the views should have a similar parent view (eg. self.view)


text:
Q: cannot find syslog.h on windows I am rewriting a c program which was used to linux, now I'll reused it on windows, I write a bat file. I run this file as administrator, then error occurs:
    syslog.h:No such file or directory.
Could you please give me some advices? thx.

A: Probably the program you are porting to windows uses the syslog(3) function call (in addition to openlog and closelog). These are defined in syslog.h on unix. Windows does not have these, so you can do the following:

*

*Remove syslog.h and these function calls from the code.

*Create a syslog.h and implement these calls or just define them as empty macros.

*Use cygwin which provides POSIX compatibility.

A: Windows doesn't offer a built-in syslog client. You may be able to use a third-party library, such as http://syslog-win32.sourceforge.net.

A: In PHP source code you can find a wrapper based on Windows function ReportEvent().
E.g.: take a look at wsyslog.c and syslog.h
Edit: have you tried syslog-server?


text:
Q: how do i return the info from the named array with a for each loop. WordPress-Plugin this is the array the array is way bigger but this is to show it a bit beter
$products = [
    ['product_code' => 106, 'product_name' => 'ESET NOD32 Antivirus'],
    ['product_code' => 107, 'product_name' => 'ESET Endpoint Antivirus'],
    ['product_code' => 108, 'product_name' => 'ESET Cyber Security'],

this is the function, i really dont know i just tried something
function add_products_callback()
{
    include('includes/products.php');
        foreach ($products as $product){
            echo "Product Code:" . "
";
        }
}

here is an image of how it comes out
but i want it to come out like,
Product Code: 106
Product Code: 107
Product Code: 108

A: The foreach function puts each value in every round into the same variable. It gets overwritten per round.
Just get the variable of the round and echo the value at the key "product_code".
include('includes/products.php');

    function add_products_callback()
    {
            foreach ($products as $product){
                echo "Product Code:" .$product["product_code"]. "
";
            }
    }


text:
Q: Javascript blinking background colour: when to stop blinking and when to start I've figured out by using the below code, we can blink the background of my html page:
<script type="text/javascript">
setInterval("Timer()", 500);
var x=1;
var set;
function Timer()
{
    set=1;
    if(x==0 && set==1) {
        document.bgColor='#00008B';
        x=1;
        set=0;
    }
    if(x==1 && set==1) {
        document.bgColor='#FFFFFF';
        x=0;
        set=0;
    }
}
</script>

The html page will forever be blinking with just using this code.
But how do we stop the blinking and start the blinking again?
I want to start blinking when the page received some protocol command, and stop blinking when user press a button on the page. How do we do it?

A: setInterval returns an ID which can be used to disable the timer. Read the documentation on MDN https://developer.mozilla.org/en/docs/DOM/window.setInterval
<script type="text/javascript">

var x=1;
var set;

function Timer()
{
    set=1;
    if(x==0 && set==1) {
        document.bgColor='#00008B';
        x=1;
        set=0;
    }
    if(x==1 && set==1) {
        document.bgColor='#FFFFFF';
        x=0;
        set=0;
    }
}

var timerInterval = null;

startBlinking = function() {
   if(timerInterval === null)
       timerInterval = setInterval(Timer, 500);
}

stopBlinking = function() {
    if(timerInterval !== null) {
        clearInterval(timerInterval)
        timerInterval = null
    }
}
</script>

call startBlinking to start the blinking and stopBlinking to stop it. See it in action http://jsfiddle.net/8D3KW/

A: use this http://jsfiddle.net/9FUWu/
you need to do clearInterval and use onclick

A: Assign your setInterval to a var and then do clearInterval on it.
var timer = setInterval("Timer()", 500);
...
clearInterval(timer);

A: Save the interval in a variable:
var interval = setInterval("Timer()", 500);

You can use this variable to clear it later:
clearInterval(interval);


text:
Q: display element from php page to html I created a simple custom CMS using some instructional videos from youtube. However, I wanted to display those contents from my CMS php page to an HTML file. I was able to do so (so i thought) but when I tried opening on a different pc, instead of displaying the content, it is showing the login form of the CMS. As it turns out, unless I log in to the CMS on that computer, it won't show the content.
Here is the script code I used to display the content:
$(document).ready(function()  {
    $.ajax({
        url:"http://**********/SubPage.php?ID=3",
        xhrFields: {withCredentials:true},
        success: function(data){
            var dt=$(data).find("#phpContent").html();
            $("#htmlDIV").html(dt);}
        });
});

i've used access-control-allow-origin & credentials on the source page and i'm wondering if there's anyway that i can send the login details (securely) to display the php page content on page load.


text:
Q: Tab characters not working properly in flutter I want to use tab characters in Strings (\t) to indent my text, but it seems that Flutter displays all tab characters as single spaces.
For example, using Flutter's demo app, I want it to display  at the center of the screen this string:
'#1\tYou have pushed the button:\n#100\tYou have pushed the button'
and this is what I get:
https://i.stack.imgur.com/NFH0x.png
Here the \n is working properly but the \t is clearly not.
However, if I print out the message in the console, the \t works fine.
I've tried on both my Mac and my PC and always end up with the same result.
Any help?

A: user rich text widget
https://api.flutter.dev/flutter/widgets/RichText-class.html
you can find the reference on the api docs

A: class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Model model = Model();
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: Center(
          child: RichText(
            text: TextSpan(
              style: TextStyle(color: Colors.black),
              text: 'Hello\thello',
            ),
          ),
        ),
      ),
    );
  }
}

Check out this example you will get the idea


text:
Q: Typescript Add types to libraries method arguments I am using an external library pg-mem which exposes LibAdapters and it has a method createTypeormConnection which accepts few arguments but of type any.
export interface LibAdapters {
  createTypeormConnection(typeOrmConnection: any, queryLatency?: number): any;
}

I want to specify the exact type of these arguments as I am getting a lot of lint errors:
Unsafe return of an `any` typed value.eslint@typescript-eslint/no-unsafe-return
How can I specify the types of the arguments & return type of the method?

A: You can extend exisiting types by using declaration merging:
declare module "pg-mem" {
    interface LibAdapters {
        createTypeormConnection(typeOrmConnection: SomeType, queryLatency?: number): SomeOtherType
    }
}

Note, that this will add overload of createTypeormConnection instead of overriding it, so if you call createTypeormConnection with value of type other than SomeType, you will still get any.


text:
Q: Read more redirection problem I have tried
<?global $more;
$more = 0;?>

On pages and read more link shows but the full content is not shown. If I click read more it remains on same page. Logically I'm supposed to taken to index.php, but why not?


text:
Q: How to Add Images to Elements Within a Linked List I'm creating the game Snake. I have defined the snake as a linked list which will hold the individual within an element. I want to set each individual bit to have an image I have created with dimensions (20, 20) and in jpeg format. I have placed the image into the src foldr in which I have created a resource folder, this is where the image is held.
This is the method in which I am using to set this image. I am unsure how to set the image within this. The method will be called to draw the snake.
//This is a method used to set the image for the snake bits.
    public void imgSnake() {
        //A for loop which will assign every point on the snake linked list to have this image.
        for (Point p : snake) {
             //This is where I need to set the image
        }


text:
Q: How do you get an iPhone's device name If you open Settings -> General -> About, it'll say Bob's iPhone at the top of the screen.  How do you programmatically grab that name?

A: For swift4.0 and above used below code:
    let udid = UIDevice.current.identifierForVendor?.uuidString
    let name = UIDevice.current.name
    let version = UIDevice.current.systemVersion
    let modelName = UIDevice.current.model
    let osName = UIDevice.current.systemName
    let localized = UIDevice.current.localizedModel

    print(udid ?? "") // ABCDEF01-0123-ABCD-0123-ABCDEF012345
    print(name)       // Name's iPhone
    print(version)    // 14.5
    print(modelName)  // iPhone
    print(osName)     // iOS
    print(localized)  // iPhone

A: For xamarin user, use this
UIKit.UIDevice.CurrentDevice.Name

A: For Swift 4+ versions, please use the below code:
UIDevice.current.name

A: To get an iPhone's device name programmatically
 UIDevice *deviceInfo = [UIDevice currentDevice];

 NSLog(@"Device name:  %@", deviceInfo.name);

// Device name:  my iPod

A: Device Name would not work out of Box now, Need to have a special entitlement.
Entitlement :
com.apple.developer.device-information.user-assigned-device-name
Doc : https://developer.apple.com/forums/thread/708275
Official : https://developer.apple.com/documentation/uikit/uidevice/1620015-name

A: From the UIDevice class:
Swift version:
UIDevice.current.name
Objective-C version:
[[UIDevice currentDevice] name];

The UIDevice is a class that provides
information about the iPhone or iPod
Touch device.
Some of the information provided by
UIDevice is static, such as device
name or system version.

source: http://servin.com/iphone/uidevice/iPhone-UIDevice.html
Offical Documentation: Apple Developer Documentation > UIDevice Class Reference

A: Unfortunately from iOS 16 onwards you need a special entitlement. You can request it here: https://developer.apple.com/contact/request/user-assigned-device-name/

A: In addition to the above answer, this is the actual code:
[[UIDevice currentDevice] name];

A: Here is class structure of UIDevice
+ (UIDevice *)currentDevice;

@property(nonatomic,readonly,strong) NSString    *name;              // e.g. "My iPhone"
@property(nonatomic,readonly,strong) NSString    *model;             // e.g. @"iPhone", @"iPod touch"
@property(nonatomic,readonly,strong) NSString    *localizedModel;    // localized version of model
@property(nonatomic,readonly,strong) NSString    *systemName;        // e.g. @"iOS"
@property(nonatomic,readonly,strong) NSString    *systemVersion;

A: Remember:  import UIKit
Swift:
UIDevice.currentDevice().name

Swift 3, 4, 5:
UIDevice.current.name

A: In Unity, using C#:
SystemInfo.deviceName;

A: As of iOS 16 name cannot be used for that and unfortunately I couldn't find an alternative. From UIKit.UIDevice:
open var name: String { get } // Synonym for model. Prior to iOS 16, user-assigned device name (e.g. @"My iPhone").


text:
Q: Optimization of a jQuery code I try here to detect the select of option[name='admin'] and if it's, then I check the mentioned checkbox if not I uncheck it.
Is there a better optimization of this code?
$("select option[name='admin']:selected").select(function () {
    $(".gestionSupervision").prop('checked', true);
});

$("select option[name='sei']:selected").select(function () {
    $(".gestionSupervision").prop('checked', false);
});

HTML:
<select name="role" id="role" class="form-control" disabled>
    <option value="admin">Administrateur</option>
    <option value="sei">Superviseur</option>
</select>

Thanks a lot !!

A: I think you need to use the change event
$("#role").change(function () {
    $(".gestionSupervision").prop('checked', $(this).find('option[value="admin"]').is(':selected'));
}).change();

Demo: Fiddle

A: You can use below code for easier to understand:
$('select#role').on('change', function (e) {
    var optionSelected = $("option:selected", this),
        selectedVal = this.value;

    if(selectedVal == "admin") {
        $(".gestionSupervision").prop('checked', true);
    } else {
        $(".gestionSupervision").prop('checked', false);
    }
}).change();

Fiddle Demo
Or you can shorten above code to:
$('select#role').on('change', function (e) {
    var selectedVal = $(this).find('option:selected').val();
    $(".gestionSupervision").prop('checked', selectedVal == "admin");
}).change();

Fiddle Demo

A: Probably something like this:
$("select option:selected").select(function () {
    status = (this.val() == 'sei')
    $(".gestionSupervision").prop('checked', status);
});

No need to repeat the whole thing and change only the names/booleans.


text:
Q: Attempted to call an undefined method named "flush" I use:  composer require annotations  and then
 public function editAction(Product $product){
//        echo '<pre>';
//        print_r($product);

        if(!$product){
            throw $this->createNotFoundException("No product found for id:".$product->getId());
        }
        $product->setName('New product name!');
        $product->flush();
        return $this->redirectToRoute('product_show',[
            'id'=>$product->getId()
            ]);

    }

$product object contains all property inside Entity but flush() method is treated as undefined. Here is the error message:
Attempted to call an undefined method named "flush" of class "App\Entity\Product".

I solved this as follows:
/**
 * @Route("/product/edit/{id}")
 */
public function updateAction($id)
{
    $em = $this->getDoctrine()->getManager();
    $product = $em->getRepository(Product::class)->find($id);

    if (!$product) {
        throw $this->createNotFoundException(
            'No product found for id '.$id
        );
    }

    $product->setName('New product name!');
    $em->flush();

    return $this->redirectToRoute('product_show', [
        'id' => $product->getId()
    ]);
}

But I wanna do it with less code as I can pass $product object. Why the first approach is failed?
N.B: I am using symfony4.

A: You need to get the manager, and call the flush on it, and not call flush() directly to the entity object
Like:
$em = $this-getDoctrine()->getManager();
$product = new Product();
$product->setName('New product name!');
$em->flush();

A: Under line $product->setName('New product name!'); follow this code:
$em->persist($product);
$em->flush();


text:
Q: Query data from multi keys sorted sets in redis I have several sorted sets stored in redis. Like:
ZADD tag:1 1 1 2 2 3 3 4 4 5 5 6  6
ZADD tag:2 21 1 22 2 23 3 24 4 25 5 26 6
ZADD tag:3 31 1 32 2 33 3 34 4 35 5 36 6
Here is my question: I want to get the data sorted by scores in tag:1 and tag:2, or tag:1 and tag:3, or tag:1,tag:2,and tag:3. That means I need to get data from different key combination([ 1 ] [ 2 ] [ 3 ] [ 1,2,3 ] [ 1,2 ] [ 2, 3 ] [ ... ] ). I have hundreds of this kind of sorted sets, with each sorted set that can be combined to any one/two/more of the others.
I kinda not choosing the ZUNIONSTORE, cause all the combination is temporary, and ZUNIONSTORE will create another new sorted set, and this set will have very low possibility for reusing. So is there any good idea to solve my problem, or any new solution to help me? Thanks in advance!

A: Despite your reluctance, use ZUNIONSTORE for this. Once you're done, just DEL the result. This workflow can be embedded in a Lua script that performs the actions and returns the unified result.


text:
Q: C code to start terminal application....? Can anyone tell me the procedure or C code to start another terminal after executing that C code. Actually I want to write a program which can start a new terminal without clicking to terminal icon. Can anybody guide me or provide me with C code.

A: Use the below C code:
#include "stdio.h"

int main(void)
{

    system("gnome-terminal");
    return 0;
}

system() function will run the terminal command's you can run any linux command using the
system function in the C code.

A: There are several ways to execute a command in Terminal without manually interacting with a shell, including:
Choose the Shell > New Command menu item and enter a command. Leave the Run command inside a shell checkbox unselected. Your program will be executed directly without a shell. If you open the Inspector window and look at the Info pane, you'll see the list of processes only lists "login" and your command, but no shell.
Open a *.command file from Finder. Terminal will start a shell and tell it to execute the command file and then exit. You'll see a shell prompt followed by a command that looks like: /path/to/your/file.command ; exit;. Again, if you look at the Inspector, the list of processes will include "login", your shell, and your command executable. (This is also what happens if you select Run command inside a shell in the New Command panel.)
It sounds like you are using #2. There is no way to alter your program to have the shell remain interactive after your program exits; however, there are a couple of indirect ways to have Terminal run a command and then leave you with an interactive shell:
Create a settings profile that runs your command in an interactive shell:
In Preferences > Settings duplicate the default profile using the action (gear) menu at the bottom of the profiles list.
Go to the Shell pane and select Run command:.
Enter the pathname to your command file.
Select Run inside shell.
Export the settings profile to a *.terminal file, either with the Export command in the action menu, or by dragging it from the profiles list to Finder.
Then, whenever you want to create a new shell that starts by running your program, open the *.terminal file. You can also just open a new terminal with this profile from inside Terminal, either using the Shell > New Window [or Tab] menu, or by double-clicking the profile in the profile list.
Write an AppleScript that directs Terminal to run your command, as if you'd entered it into the command line. You can then either store the script in the system-wide Script menu and invoke it from there, or you can save the script as an application that you can run. The script would look like this, for example:
tell application "Terminal"
    activate
    do script "/path/to/your/file.command"
end tell


text:
Q: Get main URL part in PHP OK, this is what I'm trying to do (it's quite a quickie actually, but decided to post in case we come up with something smarter... :-))

*

*Get a URL like : http://www.somedomain.com/subfolder/yet-another-subfolder/final.php?param=2

*Retrieve just this part : http://www.somedomain.com/subfolder/yet-another-subfolder/
That's what I was thinking of :
function getMainPart($url)
{
     $parts = explode("/",$url);
     return str_replace(end($parts),"",$url);
}

Do you have anything... smarter or better to suggest? Any ideas? (Or anything more universal/directly-supported-by-PHP?)

A: You are looking for parse_url:
<?php
$url = 'http://username:password@hostname/path?arg=value#anchor';

print_r(parse_url($url));

echo parse_url($url, PHP_URL_PATH);
?>

Array
(
    [scheme] => http
    [host] => hostname
    [user] => username
    [pass] => password
    [path] => /path
    [query] => arg=value
    [fragment] => anchor
)
/path

A: Why don't you try this one:
$main_path = realpath(dirname(\__FILE__)) . "main_folder/";

A: Maybe this one can help:
echo 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);

But this just works for the current file - not for every random URL ;)
for this you should use parse_url like Fluffeh said..

A: The "right" (albeit a lot more long-winded) way to do it:
function getMainPart ($url) {
    $parts = parse_url($url);
    if (!isset($parts['scheme'])) {
        return FALSE; // Not a valid, complete URL
    }
    $out = $parts['scheme'].'://';
    if (!empty($parts['user'])) {
        $out .= $parts['user'];
        if (!empty($parts['pass'])) {
            $out .= ':'.$parts['pass'];
        }
        $out .= '@';
    }
    $out .= $parts['host'];
    if (!empty($parts['port'])) {
        $out .= ':'.$parts['port'];
    }
    $out .= $parts['path'] == '/' ? '/' : dirname($parts['path']);
    return $out;
}

A: You will need the parse_url() function for this.
$parts = parse_url($url);
echo $parts['scheme'] ."://". $parts['host'] . $parts['path'];

A: if you`re certain that your main-part is always ending with / this one is some shorter and does not involve array-functions:
$url = 'http://www.somedomain.com/subfolder/yet-another-subfolder/final.php?param=2';
function getMainUrlPart($url) {
    return substr($url, 0, strrpos($url, '/')+1);
}
echo getMainUrlPart($url);


text:
Q: Do the property of $f_n$ carry over to $f_n'$? Suppose a sequence of differentiable functions $f _ { n } : \mathbb { R } \rightarrow [ 0,1 ]$ converges pointwise to the zero function. Does it follow that the derivatives $f _ { n } ^ { \prime }$ converge pointwise to the zero function?

A: No!
Consider $$f_n(x)=\frac{\sin nx}{\sqrt{n}}$$ on $\Bbb R$. Here each $f_n$ is infinitely differentiable and  $f_n$ converges pointwise (actually uniformly) to zero. But $$f_n'(x)=\sqrt{n} \cos nx$$ is divergent at each $x \in \Bbb R$


text:
Q: Add Value To URL On Form Submit With Jquery I have this form below when i submit it i want it to append a value to the 6 urls generated from a php query.
<form id="emailform" action="" method="post">
      <input type="text" value="" size="30" name="email" id="email">
      <input type="submit" name="submit" value="Submit" class="continue-button">
</form>

This is an example of my link, sitename.com/demo.php?1=demo&2=haha How can i use the form and jquery to append &email=formvalue to the url so sitename.com/demo.php?1=demo&2=haha = sitename.com/demo.php?1=demo&2=haha&email=formvalue ?
Please keep in mind that these urls are generated dynamically with a query.
I tried using attr on a but it doesnt work. I know you have to check for the submit then use attr.
$('#emailForm').submit(function(){ //listen for submit event

}

A: You can use hidden field like this
<form action="" method="post">
      <input type="hidden" name="new_value" value="value"/>
      <input type="text" value="" size="30" name="email" id="email">
      <input type="submit" name="submit" value="Submit" class="continue-button">
</form>

or you can add to action of form like this
<form action="http://action_url?new_value=value" method="post">
      <input type="text" value="" size="30" name="email" id="email">
      <input type="submit" name="submit" value="Submit" class="continue-button">
</form>

A: You'd better to use markup input type="hidden" to submit the value
Your Form :
<form action = "sitename.com/demo.php" method="post" >
    <input type="hidden" name="1" value="demo" />
    <input type="hidden" name="2" value="haha" />
    <input type="text" value="" size="30" name="email" />
    <input type="submit" name="submit" value="Submit" class="containue-button" />
</form>

Then you just need to submit this form in javascript or jquery.
: )

A: use serilaize method
$('#emailForm').submit(function(){

 //listen for submit event
 var all_submit_data = $( '#emailForm' ).serialize() ;
 //this will have all input fields values in serilized

}

ref : https://api.jquery.com/serialize/


text:
Q: Strategy for Processing a Text File with a Header using Reg Exp in Java I have a file that contains a header with comments (e.g. [Comment] This is a comment) and a subsequent data section. The data starts at "Mk1=".
The program I am working on should:

*

*Copy the header contents

*Search and replace only in the data section of the file

*Write header and data to a new file

I am currently using:

*

*StringBuffer

*Scanner

*regex.Pattern;

In my code so far (reduced to its essentials):
public static void main(String[] args) {

    File file = readFile("file.ext");

    Scanner inputScanner = null;

    try {
        inputScanner = new Scanner(file);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }

    String currentLine = "";

    while(inputScanner.hasNext()) {
        currentLine = inputScanner.findInLine(regexpPattern);

        if (currentLine != null){
             fileOutput.append(currentLine + "\n");
        }
    }

}
Because the Scanner works like a queue, I have trouble figuring out what strategy I should use. I have found examples of using a Matcher instead of a Scanner. To my understanding I also have to work with boolean flags, because of the queue-like structure of Scanner. The findInHorizon() method does not seem helpful as I want the reg exp only to apply beyond the horizon. Is there perhaps a "hack" for the delimiter of the Scanner, assuming I know the series of characters of the header start and end?
File Example
[Comment]
Text goes here.

[Another Comment]
;Instructions: Below you will find Mk1= where the data can be assigned.
;More text.

Mk1=data
Mk2=data
Mk3=data

What strategy should I use?

A: Assuming you can use java.nio.file.Files (since Java 1.7) and your text file isn't too big, I'd read all lines at once and go for the Matcher:
Charset charset = Charset.forName("UTF-8");
List<String> lines = Files.readAllLines(file.toPath(), charset);

for (String line : lines) {
    Matcher matcher = regexpPattern.matcher(line);

    if (matcher.matches()) {
        // do something
    }
}

Using regex groups will prove useful for retrieving parameter-value pairs:
Pattern dataPattern = Pattern.compile("^Mk(\\d+)=(.*)$");
Matcher dataMatcher = dataPattern.matcher(line);
int mk = Integer.parseInt(dataMatcher.group(1));
String data = dataMatcher.group(2);

A: Parsing is a two step process: You have a tokenizer which recognizes patterns in the input and a parser which reads tokens but also has a state to know where it is.
You can use regexp for the "tokenize" part of the problem but you also need a parser which remembers "I have seen [Comment]" so it knows what could/should be next.
Related:

*

*https://class.coursera.org/compilers/lecture


text:
Q: Create folder with batch but only if it doesn't already exist, parallel jobs creates a race condition The first half of the question is answered here.
The solution to create a folder only if it doesn't exist in a batch file is the following:
if not exist "C:\FOLDER_NAME" mkdir C:\FOLDER_NAME
The problem we're facing is this batch file is being run in parallel. For business reasons we can't change the timing of when these batch file are started. Two of the jobs are clearly passing the if statement, but one is creating the folder and the other raises the error "A subdirectory or file FOLDER_NAME already exists".
The %ERRORLEVEL% = 1, and the thought was to simply do the following:
if %ERRORLEVEL% gtr 1 goto errorexit. Access is denied is also %ERRORLEVEL% = 1 so this solution isn't feasible; this error stills need to exit the batch process.
How does one deal with race conditions when using mkdir in this context?

A: FOR /f "delims=" %%e IN ('MD "%targetdir%" 2^>^&1') DO (
 ECHO %%e|FIND "or file">NUL
 IF ERRORLEVEL 1 (ECHO Access denied) ELSE (ECHO already exists/other)
)

Where targetdir contains the required directory name.
If an error occurs, %%e contains either "A subdirectory or file FOLDER_NAME already exists" or some other message.


text:
Q: When asked to find bifurcations in a differential equation, am I only looking for changes in quantity/type of equilibrium solutions? Background
I'm taking a course on differential equations (more theory, less "solve this one").
We're at bifurcations, and I have a gripe with the way it's worded. Both in the text book, and by the teacher's words, bifurcations are described as

drastic changes in behavior given miniscule changes in a parameter

After this we're taught to look for parameter values, to the left and right of which, the equilibrium solutions change type (source, sink, node) or count.
Example
Given the equation $$y' = Ay+y^3$$
we have 3 equilibria when $A<0$, and one when $A>0$. Thus, we have a bifurcation at $A=0$.
Question
Is this it? Is that the extent of the term "bifurcation"? Because if so, I submit that the description above is too vague. "Behavior" seems to me like it could encompass more than just equilibrium points.

A: No, this is not it. What you are studying is the simplest bifurcations of equilibrium points. There are many other bifurcations. For example, Poincare-Andronov-Hopf bifurcation is about limit cycle being born out of an equilibrium point. There are bifurcations of limit cycles such that an invariant torus appears under a small perturbation of a parameter. These are all examples of local bifurcations, since the changes occur in a small neighborhood of a point or of a limit cycle. There are global bifurcations, the simplest one is appearance of a limit cycle out of a homoclinic trajectory. The list can be easily extended.
So, what is the mathematical definition of a bifurcation? What you are given in your course is not a definition but rather a description. Actually, due to some subtle reasons, it is quite difficult to come up with a universal definition of a bifurcation. The one, which is probably the closest one to being the most general, is that a bifurcation is the appearance of topologically non-equivalent phase portraits under parameter changes. I will leave it to you to google the definition of being topologically equivalent.
There are a lot of higher level books that treat bifurcations from precise mathematical stand point. One of the very few which is rigorous and still geared towards undergraduates is Hale and Kocak Dynamics and Bifurcations. You can find much more details there about your question.


text:
Q: Countdown html/css/js not working but works in jsfiddle Is there any reason why this solution won't work in SharePoint? It works well on jsfiddle. I modified the html file to add css and js reference and put the html in a cewp. What am i missing? any help will be appreciated.
https://jsfiddle.net/h353rdzx/2/

<link href="/SiteAssets/CountDown/CountDown.css" rel="stylesheet" type="text/css" />

Countdown Clock

Days

Hours

Minutes

Seconds

A: You can save a whole lot of Script and HTML by using the SharePoint String.format function to format the counts

Note
If you only want the number of days, SharePoint (sp.datetimutils.js) has a function available:
var daysremaining = GetDaysAfterToday(new Date(2017,11,31) );//New Years eve

sp.datetimeutils.js is loaded on Form en View pages, but in CSR it might not be available yet as the page is still loading

A: The SharePoint UI loads in stages. Your code is likely executing before the elements are loaded in the DOM.
You should add your initializer to this client side (JS) array and it will be executed when the body is loaded:
_spBodyOnLoadFunctionNames

Hope this helps.


text:
Q: How can I space crons in 100 minute cycles? I had to split some larger crons and an easy way was to just take the last two digits of the id.  So id 10001 would run at the same time as 1,101,201,...1001,2001,etc.
Instead of a single cron taking hours to run, they now are split 100 times and run much more consistently.
However, how can I schedule a cron to run every 100 minutes, starting at x?
example:
php cron.cli 00   start at 12:01am and run every 100 minutes
php cron.cli 01   start at 12:01am
php cron.cli 02   start at 12:02am
     . . .
php cron.cli 99   start at 1:39am
php cron.cli 00   start at 1:40am [looping every 100 minutes]
php cron.cli 01   start at 1:41am

I need cron 01 to start at 12:01am, cron 02 to start at 12:02am and cron 99 to start at 1:39am. And every hundred seconds afterward, respectively.
Can you help?

A: I would only write one entry into the crontab file. The one command would start the cron.cli script and passing the current time as a parameter.
The cron-cli script then takes that parameter and creates the id in question out of it. That made, the file is much simpler to manage, as you won't mess the crontab file with soo many entries. And imagine your 100 steps become 200 steps or even more ... .
* * * * * php cron.cli $(date +\%R)

A: Assuming they don't have to run contiguously, a simple work-around is to let them run every 120 minutes, so you can specify even-numbered hours for jobs 00 to 59 (I'm guessing you start at 00, since you finish at 99.) and odd-numbered hours for jobs 61 to 99.
If you want a more even distribution, you could spread them out a little (skip minutes that are multiples of 6), so that jobs 00 to 49 fill up the first hour, and 50 to 99 fill up the second hour.

A: Luckily, if you write this out explicitly, you only need to specify one year's worth of cron entries, since:


text:
Q: Rails 3: Routing and pluralization issue for has_one I created a scaffold for Etho, where I am attempting to have a User get 1 single "ethos" to edit. Ethos was working but on the User model it was only working with has_many :ethos
The user should only get 1 so I can create better associations. But now when I change in the model, it creates quite the spider effect that I can't track down.
User model:
class User < ActiveRecord::Base
  has_many :jobs
  has_one  :ethos #used to be has_many :ethos

On all the pages now I get uninitialized constant User::Ethos on EthosController#edit
Please help, how do I fix this?

A: Have you tried?
class User < ActiveRecord::Base
  has_many :jobs
  has_one  :etho

has_one should be singular: http://guides.rubyonrails.org/association_basics.html#the-has_one-association

A: You can continue to use the ethos pluralized name by explicitly specifying the class_name on the has_one association:
class User < ActiveRecord::Base
  has_many :jobs
  has_one  :ethos, class_name: 'Ethos'

This answer provides additional details: https://stackoverflow.com/a/6604247/37966


text:
Q: Клонирование объекта var user = {
  name: "Вася",
  age: 30
};
var clone = {}; // новый пустой объект
// скопируем в него все свойства user
for (var key in user) {
  clone[key] = user[key];
}

Вопрос относительно строки clone[key] = user[key].
По идее, user[key] содержит только значение(Вася и 30) свойств name и age, а в переменной key хранится имя свойства?
Но в результате клонирования скопировались и имена переменных.
Как так вышло?

A: А как Вы хотели?
Клон должен быть идентичен по определению.
key - имя свойства (name, age); user[key] - значение свойства (Вася, 30).
Копировать объект проще так:

var user = {
  name: "Вася",
  age: 30
};

let clone = Object.assign(user);

console.dir(clone);