text:
Q: Resharper FIler layout not applying when using code cleanup? I am trying to learn to use file layout and For now I just wanted my static fields to be sorted according to access modifiers. First private and then public .
I created a file layout and then used code cleanup but nothing changes in my code. please help

XAML code
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
  <FilePattern>
    <Entry DisplayName="Sort statics">
      <Entry.Match>
        <Static />
      </Entry.Match>
      <Entry.SortBy>
        <Access />
        <Name />
      </Entry.SortBy>
    </Entry>
  </FilePattern>
</Patterns>

A: Try this pattern (now it has the "Fields" region you showed on the video)
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
  <TypePattern DisplayName="Default Pattern">
    <Region Name="Fields">
      <Entry DisplayName="Sort static by access modifier" Priority="100">
        <Entry.Match>
          <And>
            <Kind Is="Field" />
            <Static />
          </And>
        </Entry.Match>
        <Entry.SortBy>
          <Access Order="Private Protected ProtectedInternal Internal Public" />
          <Name />
        </Entry.SortBy>
      </Entry>
    </Region>
  </TypePattern>
</Patterns>


text:
Q: Xcode - My app is acting weird I have a project that I got handed me (half working / half not working) and I have never seen something like to this before.
I have a storyboard and one of the scenes is called 'CompletionVC' and inside that scene I have this:

and in my header file for this scene I have this:
UIPickerViewDataSource,UIAlertViewDelegate>
{

    IBOutlet UIButton *areaButton;
    IBOutlet UIButton *unitButton;
    IBOutlet UIView *searchView;
    __weak IBOutlet UILabel *userLabel;
}

and none of those IBOutlets have any Referencing Outlets.
and in my .m file for this scene I have this:
- (IBAction)AreaButtonPressed:(UIButton *)sender

and this does not have a sentEvent assigned to it.
But somehow they are still appearing in my app, which is fine, but I want to adjust them and I cant find them anywhere....based off the information I provided, can someone give me a tip or two about where I these IBOutlets? I would like to make some adjustments, but I can't find them anywhere...also sometimes these IBOutlets have a Sent Event and Referencing Outlet, but it was referencing a file that is not there. The IBOutlets appear and are functional...weird eh?

redpajama_set_name: RedPajamaStackExchange


text:
Q: What does typescript "interface | interface | function" syntax mean? I am using the openapi-generator-cli with typescirpt-fetch generator to generate models for my application.
I am having issues with parts of the generated code that referees to the field that is a polymorphic class.
The generated code has an error that reads:
TS2693: 'ItineraryButtonDTO' only refers to a type, but is being used as a value here.

I am trying to understand what is causing this. But I am not sure what does code in question even means:
'buttons': !exists(json, 'buttons') ? undefined : ((json['buttons'] as Array<any>).map(ItineraryButtonDTO | FlightNotificationButtonDTO | ItineraryPayloadButtonDTO | ItineraryPersonaButtonDTOFromJSON)),

Please help.

A: Sorry, this was an issue with the fetch-typescript generator producing not valid code.
There is an open ticket on their github page
https://github.com/OpenAPITools/openapi-generator/issues/4626


text:
Q: Why can't function A catch the error thrown by function B I'm doing try and catch exercises in JavaScript.
here is my code

function getTime1() {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(11111);
    }, 1000);
  });
}

function getTime2() {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(22222);
    }, 1000);
  });
}

async function funB() {
  // try {
  let b = await getTime2();
  throw "B error";
  // } catch (e) {
  //   console.log("this" + e);
  // }
}

async function funA() {
  try {
    let a = await getTime1();
    funB();
  } catch (e) {
    console.log("that" + e);
  }
}
funA();

and here is the result

Uncaught (in promise) B error

I want to know why there is no catch in funb and Funa. Thank you

A: From my understanding try/catch doesn't work with async :

"Because errorTest is async, it will always return a promise and will
never begin execution exactly where you call it: it is asynchronous.
errorTest returns, and you exit the try block, before a single line of
code within errorTest is run. Therefore, your catch block will never
fire, because nothing in errorTest would synchronously throw an
exception."

Source : Why is try {} .. catch() not working with async/await function?
Since async will return a Promise, I believe you'll need to use the catch on the Promise itself
funB().then((result) => {
    console.log(result);
}).catch((error) => {
    console.error(error);
});


text:
Q: How to stop Excel opening some sheets (downloaded via VBA) in new instance, causing PERSONAL.xlsb to invoke a "File in Use" dialog? I run a lot of macros, and lately had to change to O365, which gave me the "wonderful" 64 bit Excel. One of its most maddening shenanigans is that when I run some macros (working with SAP GUI, creating SAP reports, naming them, saving and downloading to a specific folder where the next macro step opens them and incorporates into a relevant macro sheet), the new Excel opens these in a new instance (which I don't want but cannot prevent - can you help here?), which causes a dialog "File in Use" (which I don't want but cannot prevent - can anyone help me here?) because it tries to open my PERSONAL.XLSB (which I need and therefore don't want to get rid of just because of this) and qualifies it as "locked for editing" by another user, who is myself (which is absolutely stupid but I cannot change it - can anyone help me perhaps with this part?).
Sometimes the macro finishes fine when I don't answer that dialog; sometimes it seems to cause the Excel to hang up in trying to do next steps, sometimes the macro quits on me when I click "Read only" and so on.
All this is maddening also because these files that (possibly) SAP GUI opens, I have to waste my time by closing them after the macro finishes (has anyone a possible solution in stopping SAP opening these files? I was unable to find it anywhere so far.).
In some macros I fixed it by a specific part of code which waits till when these files open up and then it closes them - yet even that wait is wasting my time and it would be better without.
But with O365 and other instances it is even more colorful, because some files open in the same instance (this issue was there even before the O365 though) and I can manually close them after the macro finishes (although again, I have to wait till they open, which is again "vanity and torture of the soul"), but those opening in the new instance (specific to O365) show as blank sheets, I have to click into them, a warning sound follows but no dialog is visible, then I have to click into them again from the Excel icon in the bottom menu bar and then it tells me that I cannot close them because a dialog is open.
Then I need to close this dialog plus the one which appeared about the "File in Use", then I finally wait for the file (that I don't need) to open (because it is already saved inside the folder and already copied and pasted onto the relevant macro sheet) and only then I can close it.
So far I was unable to find anywhere on the internet an advice for how to stop SAP opening these files (when they are already saved where I need them), neither how to stop them opening in new Excel instances. So reluctantly, I think I should aim for at least a tiny little VBA code which will cause my macro to click on the "Read Only" button. Can anyone here help me with any part of this "Excel complaint"?

A: I do not know how/if SAP can be 'persuaded' to not open the workbooks in discussion... But, I think, you can handle that in a different way the "PERSONAL.XLSB" behavior, from the opening point of view. Of course, if SAP itself has this "bad habit" and not your code opens it in a new session, which have to be solved in a different way...

*

*"PERSONAL.XLSB" is located in "...AppData\Roaming\Microsoft\Excel\XLSTART" folder. All workbooks located in this folder are automatically open when an Excel session starts;

*You may change the "PERSONAL.XLSB" workbook path. If you want it to be open when a specific (necessary) workbook needs it, add a reference to it.
addRef. In order to do that, modify the (standard) VBAProject (of "PERSONAL.XLSB"), in, let us say, "VBPersProj", then (being in VBE) trough 'Tools - References...` tick its check box and press 'OK';

*If the exported workbook is open in a new session and, even if it does not bother you any more because of the annoying dialogs and you need to identify that specific session, you can use the next function:

Function sameExSession(wbFullName As String, Optional boolClose As Boolean) As Boolean
   Dim sessEx As Excel.Application, wb As Workbook

   Set sessEx = GetObject(wbFullName).Application
   If sessEx.hWnd = Application.hWnd Then
        sameExSession = True
   Else
        sameExSession = False
        If boolClose Then
            sessEx.Workbooks(Right(wbFullName, Len(wbFullName) - InStrRev(wbFullName, "\"))).Close False
            sessEx.Quit: Set sessEx = Nothing
        End If
   End If
End Function

It offers the possibility to close the workbook and the session itself if it is a different against the one where the code runs. It is an Optional parameter to be used, only if you need that. You can test it in the next way:
Sub testSameExSession()
   Dim wbFullName As String
   wbFullName = ThisWorkbook.fullName 'use here the full name of the SAP exported workbook
   If sameExSession(wbFullName, True) Then
        'process the workbook if this is what you need
   End If
   'if not open in the active session, the workbook could be closed and session quit, choosing the above way
   'You can also simply call the function, without the closing parameter, as:
   Debug.Print sameExSession(wbFullName)
End Sub

In case of False function retur, it can be closed and reopen in the existing session, if needed...
Edited:
If you need personal.xlsb being used/open when ribbon controls calls some of its Subs/functions, please adapt the code to call it in the next way:
Dim x as Long
x = Run("'C:\Users\your_UserName\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB'!GiveMeFive", 4, 3)

if calling a function (with parameters), which must return. Or
Run "'C:\Users\your_UserName\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB'!YourSubName"

when calling a Sub. In such a way, "Personal.xlsb" is opened if it is closed. And, in your specific case nothing will press the ribbon controls.
But, isn't the ribbon added when a specific workbook is open? Probably, the one you are using to make the above mentioned calls... If so, adding the suggested reference at "Personal.xlsb", will configure the new ribbon tab only when it is loaded. And your mentioned "problem" does not exist, in fact. Is it an add-in?


text:
Q: Backbone.js and Require.js - Uncaught TypeError: Object function (){ return parent.apply(this, arguments); } has no method 'on' I'm putting together a simple todo list app based on some examples to learn about Backbone. I'm running the code on Django for database and using Tastypie to do the API, and am trying to use Backbone (with RequireJS for AMD) but am having trouble with the following error in my console:
Uncaught TypeError: Object function (){ return parent.apply(this, arguments); } has no method 'on'

I think my app is having trouble communicating via the backbone collection,because it seems to get this error at about here in my app.js (main app view):
// Bind relavent events to the todos.
this.listenTo(Todos, "add", this.addOne);
this.listenTo(Todos, "reset", this.addAll);

I've seen some similar issues on here but I'm just breaking into this stuff so an explanation of what's happening would be much appreciated.
collections.js
define([
  'underscore',
  'backbone',
  'app/app',
  'app/models/model'
], function(_, Backbone, app, Todo){

    // The collection of our todo models.
    TodoList = Backbone.Collection.extend({
        model: Todo,

        // A catcher for the meta object TastyPie will return.
        meta: {},

        // Set the (relative) url to the API for the item resource.
        url: "/api/item",

        // Our API will return an object with meta, then objects list.
        parse: function(response) {
            this.meta = response.meta;
            return response.objects;
        }
    });

    var Todos = new TodoList();
    return Todos;
});

app.js:
define([
  'jquery',
  'underscore',
  'backbone',
  'app/models/model',
  'app/collections/collection',
  'app/views/view'
], function($, _, Backbone, Todos, Todo, TodoList, TodoView){

    // The view for the entire app.
    var AppView = Backbone.View.extend({
        el: "#todo-app",

        // Bind our events.
        events: {
            "keypress #new-todo": "createOnEnter",
        },

        initialize: function() {
            // TastyPie requires us to use a ?format=json param, so we'll
            // set that as a default.
            $.ajaxPrefilter(function(options) {
                _.extend(options, {format: "json"});
            });

            // Bind relavent events to the todos.
            this.listenTo(Todos, "add", this.addOne);
            this.listenTo(Todos, "reset", this.addAll);

            // Cache some of our elements.
            this.$input = this.$("#new-todo");

            // Get our todos from the API!
            Todos.fetch();
        },

        // Crate a new todo when the input has focus and enter key is hit.
        createOnEnter: function(event) {
            var keyCode = event.keyCode || event.which,
                title = this.$input.val().trim();

            // If we haven't hit enter, then continue.
            if (keyCode != 13 || !title) return;

            // Create a new todo.
            Todos.create({title: title, complete: false});

            // Reset the input.
            this.$input.val("");
        },

        // Add a single todo to the list.
        addOne: function(todo) {
            var view = new TodoView({model: todo});
            $("#todo-list").append(view.render().el);
        },

        // Clear the list and add each todo one by one.
        addAll: function() {
            this.$("todo-list").html("");
            Todos.each(this.addOne, this);
        }
    });
    return AppView;
});

A: The order of definitions and parameters in your app.js file is incorrect, you can try like this:
define([
  'jquery',
  'underscore',
  'backbone',
  'app/models/model',
  'app/collections/collection',
  'app/views/view'
], function($, _, Backbone, Todo, Todos, TodoView){


text:
Q: UserControl's Event Handler not firing I dynamically load a UserControl into a View that's in a MultiView control. Although the UserControl adds an event handler, the event never fires.
What am I missing here?
Thanks!
Containing ASPX page:
protected override void OnPreRender(EventArgs e)
{
    if (MultiView1.ActiveViewIndex == 2) //If the tab is selected, load control
    {
        Control Presenter = LoadControl("Presenter.ascx");
        (MultiView1.ActiveViewIndex.Views[2].Controls.Add(Presenter);
    }
    base.OnPreRender(e);
}

Presenter.ascx.cs
override protected void OnInit(EventArgs e)
{
    Retry.Click += this.Retry_Click; //This is a .Net 2.0 project
    base.OnInit(e);
}

protected void Retry_Click(object sender, EventArgs e)
{
    //This never fires
}

A: I am thinking it is not firing because you are loading the control in your page's prerender event. Upon postback, the control is being lost because there is no view state for it.  Therefore there is no control to fire its event. Try to load the control in the page's init event. Let us know what happens!

A: Postback event handling is done before rendering so the control is not present in the page in your case.
The life cycle events are fired in this order (skipped a few):

*

*Init

*Load

*PreRender

*Unload

And event handling is done between Load and PreRender (in case some events change the way the page should be rendered, it makes sense).
So just move your code that loads the Retry control to Load or Init.
Reference: Asp.Net Page Life Cycle Overview

A: The control must be visible initially to be able to enter in OnPreRender event.
but maybe you want it to be unvisible.
the be sure to have EnableViewState = false;

A: It sounds like the control is not being added after each post back, i would take out the if statement in the containing aspx page to see if that fixes the issue...im assuming Retry is a button?


text:
Q: I am getting a KeyError an am not sure how to fix it I have written out my code and when I run it, I get a KeyError:
Traceback (most recent call last):
  File "C:/Users/sagar/Desktop/Sagar CS131B Files/convert_to_fixed.py", line 21, in <module>
    birthdate = sample['Birthdate']
KeyError: 'Birthdate'

my code:
inputFile = 'raw.data.py'

data = list()
columns = ['First name','Last name','Telephone','Address','City','State','Birthdate']
for line in open(inputFile):
    # Assuming comments in the text file as '#'
    if line.startswith('#'): continue
    row = line.strip().split(':')
    data.append(dict(zip(columns, row)))
#print(data)

formatted_data = list()
for sample in data:
    birthdate = sample['Birthdate']
    mm,dd,yy = birthdate.split('/')
    if len(yy)==2:
        yy = '19' + yy
        birthdate = '/'.join([mm,dd,yy])
        sample['Birthdate'] = birthdate
    modified_row = ':'.join(
        [sample['Last name'], sample['First name'],
        sample['Telephone'], sample['Address'],
        sample['City'], sample['State'], sample['Birthdate']])
    formatted_data.append(modified_row + '\n')

with open('fixed.data','w') as f:
    f.writelines(formatted_data)

I have looked up how to fix it, just not sure on the execution of a try-except function. If someone could help me out with this that would be amazing..
This is what is inside the file given:
'Betty:Boop:245-836-8357:635 Cutesy Lane:Hollywood:CA:6/23/1923',
'Ephram:Hardy:293-259-5395:235 Carlton Lane:Joliet:IL:8/12/1920',
'Fred:Fardbarkle:674-843-1385:20 Parak Lane:DeLuth:MN:4/12/23',
'Igor:Chevsky:385-375-8395:3567 Populus Place:Caldwell:NJ:6/18/68',
'James:Ikeda:834-938-8376:23445 Aster Ave.:Allentown:NJ:12/1/1938',
'Jennifer:Cowan:548-834-2348:408 Laurel Ave.:Kingsville:TX:10/1/35',
'Jesse:Neal:408-233-8971:45 Rose Terrace:San Francisco:CA:2/3/2001',
'Jon:DeLoach:408-253-3122:123 Park St.:San Jose:CA:7/25/53',
'Jose:Santiago:385-898-8357:38 Fife Way:Abilene:TX:1/5/58',
'Karen:Evich:284-758-2867:23 Edgecliff Place:Lincoln:NB:11/3/35',
'Lesley:Kirstin:408-456-1234:4 Harvard Square:Boston:MA:4/22/2001',
'Lori:Gortz:327-832-5728:3465 Mirlo Street:Peabody:MA:10/2/65',
'Norma:Corder:397-857-2735:74 Pine Street:Dearborn:MI:3/28/45',
'Paco:Gutierrez:835-365-1284:454 Easy Street:Decatur:IL:2/28/53',
'Popeye:Sailor:156-454-3322:945 Bluto Street:Anywhere:USA:3/19/35',
'Sir:Lancelot:837-835-8257:474 Camelot Boulevard:Bath:WY:5/13/69',
'Steve:Blenheim:238-923-7366:95 Latham Lane:Easton:PA:11/12/1956',
'Tommy:Savage:408-724-0140:1222 Oxbow Court:Sunnyvale:CA:5/19/66',
'Vinh:Tranh:438-910-7449:8235 Maple Street:Wilmington:VM:9/23/63',
'William:Kopf:846-836-2837:6937 Ware Road:Milton:PA:9/21/46',
'Yukio:Takeshida:387-827-1095:13 Uno Lane:Ashville:NC:7/1/29',
'Zippy:Pinhead:834-823-8319:2356 Bizarro Ave.:Farmount:IL:1/1/67',
'Andy:Warhol:212-321-7654:231 East 47th Street:New York City:NY:8/6/1928'

A: zip() only produces results up to the shorter iterables length:
print(list(zip([1,2],[1,2,3,4,5,6])))     #  [(1, 1), (2, 2)]

Your source data somehow at least one line with less elements in it that is why one of your dicts does not have the 'Birthdate' key (the last one).
You can guard against it:
data = list()
columns = ['First name', 'Last name', 'Telephone',
           'Address', 'City', 'State', 'Birthdate']

# use a context manager for file open
with open(inputFile) as f:
    for line in f:
        # Assuming comments in the text file as '#'
        if line.startswith('#'):
            continue

        # ignore empty lines (you can combine with above)
        if not line.strip():
            continue

        row = line.strip().split(':')
        # raise exception if not enough data found
        if len(row) != len(columns):
            raise AttributeError("Not enough datapoints in line: ", line)

        data.append(dict(zip(columns, row)))


text:
Q: Bayesian analysis...applied to the real world 33% of patients with subarachnoid haemorrhage (bleeding from a burst brain aneurysm) die before they reach hospital. Of those who survive, 15% have another brain-bleed within 2 weeks. 45% of those who have a second brain-bleed die. Using Bayesian analysis,  what is the proportion of people who die from subarachnoid haemorrhage?
MY SOLUTION

*

*I had to draw out the probability tree and calculated the overall percentage of death after subarachnoid haemorrhage being 0.37.

*I can't for the life of me work out what the prior and likelihood are in this question.


text:
Q: update table where column name is set as variable mysql I am creating a mysql statement that should update a table, but instead of setting a column name to be equal to some value the normal way, I decided to make it dynamic, for example  instead of:
UPDATE mytable SET mycolumn = 'a value';

I use a variable. In this case:
SET @column = 'mycolumn';
UPDATE mytable SET @column = 'a value';

This returns a syntax error message when I execute the update statement. Is there a way to do this?

A: you can do this:
set @query = 'UPDATE mytable SET @column = ''a value''';
set @query = replace(@query, '@column', 'col_name');
PREPARE stmt1 FROM @query;
EXECUTE stmt1;


text:
Q: How can I send my current location to webservice periodically? I want to send my current location info to database periodically on background. For example; Once every 5 minutes. The location must be sent in the background even if the user is not in the application. What is best way to make it? What can you suggest to me?
public class AlarmReceiver extends BroadcastReceiver {

private FusedLocationProviderClient client;

private Context context;

@Override
public void onReceive(Context context, Intent intent) {

    this.context = context;

    client = LocationServices.getFusedLocationProviderClient(context);

    if (ActivityCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    client = LocationServices.getFusedLocationProviderClient(context);

    client.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {
        @Override
        public void onSuccess(Location location) {

            // You can send to your webservice in here.
            Log.i("TEST_LOCATION", location.getLatitude()+"");
        }
    });

  }
}

You should start it in Activity class.
    Intent intent = new Intent(getBaseContext(), AlarmReceiver.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), REQUEST_CODE, intent, 0);
    AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, Calendar.getInstance().getTimeInMillis(), 5*60*1000, pendingIntent);

And you should add in Manifest.
<receiver android:name=".AlarmReceiver" />

A: You can achieve this by using Pending Intent and BroadcastReciever.


text:
Q: Which partition can I delete? I currently have a machine running Windows 7 on it and would like to set up a dual boot with Ubuntu (14.03). The computer is an all-in-one and therefore came preassembled and preinstalled with the OS. It also has 4 partitions: 1 System partition (I think Windows creates this upon installation automatically), 1 Boot partition on which the main part of my OS resides, one Recover partition (20GB) and one OEM partition (I think this might have been created by the manuacturer of the HDD). I also shrunk my Boot partition and created some unallocated space to install Ubuntu in. Now as I understand it, I will not be able to install Ubuntu with 4 (primary?) partitions already on my system. I don't know if the OEM partition for example could be removed without causing damage so that I can install Ubuntu. Also one quick question to the installation itself: Should I choose install alongside Windows? Will Ubuntu automatically install in the unallocated space if I do that? Any advice is greatly appreciated!

A: The OEM partition will be too small. to gain you enough space and if they are ordered in the way you say deleting it will be of little use unless you the move the recovery partition, moving partition does not always work. The OEM partition contains all your windows installers, so it is good to back this up onto a DVD.
You should be able just run the install on the live CD and it will give you the side by side option where it will shrink the windows partition and then create an extended one for windows. Shrinking partitions can cause data loss (I have never had a problem myself) so backing up is a good idea.


text:
Q: ArcMap: Copying features class to Oracle DB fails: Shape integrity error I have a feature class in an ESRI file geodatabase where I have isolated one feature. When I copy the feature class to a oracle db (ST_Geometry as defaults; by copy and paste; also fails with gp tools or by python cursor) I get the error "Shape integrity error". Copying the feature or the feature class to other file gdb feature classes works. It only fails on my oracle db.
Check geometry returns no error. What could be wrong? What can I do?
The shape looks like this:

The domain of the feature class is X=(-20037700 to 900699887774,099) Y=(-30241100 to 900689684374,099). The resolution 0,0001 meters and the tolerance 0,001 meters.
EDIT: It also occurs when I copy it to a SQL Server database.

A: I have solved this problem by applying ArcGIS Pro 2.0 that has luckily just been released and by using the Tool "Repair Geometry": https://pro.arcgis.com/en/pro-app/tool-reference/data-management/repair-geometry.htm with the validation_method = 'OGC' parameter.
This solves the problem. Unfortunately now there exist features in the database that can not be copied to another feature class in the database. If I want to copy these features I have to copy them to a local(fGDB) feature class do "Repair Geometry" and then I can copy it to a feature class in a database. But I can live with that.
Thank you all for your help!

A: The Oracle Spatial validation is comform to the OGC Simple Feature Specification.
See Polygons Chapter 6.1.11.1
The rule
d) A Polygon may not have cut lines, spikes or punctures
Oracle and the most other vendors interpretation of the rule is:

*

*"cut lines, spikes or punctures" is equivalent to "touch lines, spikes or punctures"

ESRI software interpretation is:

*

*"cut lines, spikes or punctures" is not equivalent to "touch lines, spikes or punctures"

the result is Oracle wants interior's (holes), ersi software want's in that case only one exterior ring.
Whatever you can fixe it easily, intersect the geometry with it self.

*

*select SDO_GEOM.SDO_INTERSECTION(a.shape, a.shape, 0.001) from dual; (see)

@simsi: please, never post helpful textual information as an image (e.g. coordinates, stacktrace, etc.)


text:
Q: Wine not removed after running apt-get purge I upgraded to Jammy Jellyfish recently and it broke a number of applications and adjustments. I am working on removing/reinstalling them, but Wine is proving difficult.
I ran sudo apt-get purge wine and got the following:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'wine' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

which wine shows:
/usr/bin/wine

Is there another removal method I can try?

A: There is no actual file named /usr/bin/wine so I think this might be a link or now, a broken link. Run the following command: file /usr/bin/wine to confirm this.
If it is an actual file (not a link) and it was installed through a ppa, there are a few ways to find the offending package.
You can use the dpkg -l command to list all installed packages and you can filter the results to only include those matching "wine" like this:
dpkg -l | grep -i wine

This will return all packages that contain the letters "wine" in the name or description. If a package is listed, uninstall or purge the package.
The other way is to use apt-file to locate the package that provides the /usr/bin/wine file.
First, install apt-file using the following commands:
sudo apt update
sudo apt install apt-file

Then, update it:
sudo apt-file update

Finally, search for the offending package:
apt-file search "/usr/bin/wine"

This should return the package name followed by the path to the file contained in the package.

A: Can you try to remove Wine via the Synaptic Package Manager by searching for 'wine'?
Because the package is not called wine as I can see it on my system:


text:
Q: jquery comparing 2 variables gives unexpected result I am so much confused about a silly if condition which returns an unexpected result, I am just not able to figure out what is the problem in my code.
Here is my simple code
$('.for_next_link').click(function() {

    var next = $('.for_next_value_pagination').val();
    var limit = "<?php echo $max; ?>";

    alert(next); // value is 5
    alert(limit); // value is 10

    if (next >= limit) // this condition is always true
    {
        alert('im in if cond.');
        return false;
    }
    else {
        // do something else;
    }
});

I am comparing 2 variables "next" and "limit" which have value 5 and 10 respectively but to surprise the the if condition is always true.
Can you please tell me why this is happening and what is the solution.
Thank you.

A: You are doing string comparison,
console from firebug,
>>> "5">"10"
true

>>> 5>10
false

>>> "5">10
false

>>> 5>"10"
false

A: That happens because you are comparing strings:
"5" >= "10" is true

Force the cast on one of them
if(next*1 >= limit*1) is false

A: You are comparing two string values, rather than two numbers. Try this instead:
if(Number(next) >= Number(limit)){

Because the character "5" has a higher ASCII value than "1" (the first character of "10") then "5" is regarded as being greater than "10"

A: You are actually comparing "5" (a string) and "10" (also a string); "5" > "10" is true since, alphabetically, 5 comes after 1.
Instead, compare them numerically:
if(parseInt(next, 10) >= parseInt(limit, 10))

(You may want to parse them at the same time you initialize the variable, like below)
var next = parseInt($('.for_next_value_pagination').val(), 10);
var limit = parseInt("<?php echo $max; ?>", 10);


text:
Q: Starting with Python 2.x or 3.x? I'm not quite sure what the real differences are so I'm not able to decide which version is better for a beginner.
I have a background about C, C++ and Java basically, i would like to start Python because i need it, this will look like a noob question but i really don't know which version i'm supposed to pick; for what i see the difference between 2.x and 3.x are mostly related to the syntax used in the two versions, but since i don't even have started anything yet i know nothing so i ask: which one I'm supposed to pick ?

A: You can start with any of the version you want. Syntax are almost similar, the major differences can be found here:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html
For learning though I would suggest 3.x because 2.x are frozen. There will hardly be any features added apart from bug-fixings.
For industry level application : 2.x because many libraries are yet to be ported ( example: mechanize, BeautifulSoup etc).  Also Google App Engine does not support 3.x yet.
My suggestion would be to write code in 2.x, but make sure it can easily be ported.  It's not that tough once you get the hang of py2to3 tool.

A: Just read this from python wiki. Short version: Python 2.x is the status quo, Python 3.x is the present and future of the language.
Personally I would install both, but for now use 2.x (2.7 or with some specific libraries 2.6) for developement, mainly due to  better library support. And if the time comes, juping won't be too difficult, as the syntax changes aren't that substantial as Ashwini Chaudhary points. If you are just learning and don't need vast library support, go for the 3.x.

A: Most people are still using 2.x, even Django (one of the most popular web frameworks for Python) doesn't fully support Python 3 yet.
I would start with version 2.x. You'll have a lot less headaches when working with other libraries.


text:
Q: Yii console commands stopped working on windows after updating from 2.0.3 to 2.0.4 I just updated to Yii 2.0.4 and now my custom console command is not working. However, the default Hello still works.
$ yii hello
hello world
$ yii kw
Error: Unknown command "kw".
$ ls commands
HelloController.php  KWController.php

It was working immediately before in 2.0.3.
Strange because it shows up in yii command by itself:
$ yii | grep hello
- hello                        This command echoes the first argument that you have entered.
    hello/index (default)      This command echoes what you have entered as the message.
$ yii | grep kw
- kw

I am working on windows.

A: Problem is probably with the case of your controller name... the kw command would by default look for a KwController.php and won't find a KWController.php if your filesystem is case-sensitive.
You can fix that by either renaming the file, or if you don't want that, manually adding the controller file to the controllerMap in the yii file:
$application = new yii\console\Application($config);
$application->controllerMap['kw'] = 'console\controllers\KWController';


text:
Q: Is there an inverse OR function? The OR function returns TRUE if any of the arguments are true.
Is there a function that returns FALSE if any of the arguments are false?

A: Programming languages and rulebased languages often have operators to see if a condition is met and if so, return true.
Here is a list of what known operators are and how they work.

*

*OR: Gives true if eiter or both conditions are true, and returns false if both are false.

*AND: Gives true if all conditions are true and none are false.

*XOR: Gives true if exactly one condition is true, and the rest is false.

*NOT: Gives the reverse of what goes in. True becomes False, and visa versa.

You are asking for the AND clause, and Excel supports it. =AND(value1, value2, value3)  will result true if all these values are true or false if any of them (or all) are false.

A: Inverse OR is not the correct name for what you're asking!!
What you're looking for is AND function which returns FALSE  if any of the arguments are FALSE. To implement this, you can use this: =AND(value1, value2, value3)
Whereas Inverse OR is actually NOR function which returns FALSE if any of the arguments are TRUE. In other words, it's the combination of OR and NOT and therefore it can be implemented as: =NOT(OR(value1, value2, value3))

A: The Excel function that does what you need is AND.
Usage:
AND(logical 1, logical 2, logical...)
Examples:
=AND(1<2, 2<3) will return TRUE.
=AND(1<2, 3<2) will return FALSE.
Logical functions (reference)


text:
Q: Interpreting output from iostat I'm facing really slow speed serving just static files from 300 to 900 MB on a 1 GBps dedicated line.
This is the output from iostat but I don't know if this is ok or not.
Linux 2.6.32-220.13.1.el6.x86_64 (zlin) 05/04/2012 _x86_64_ (4 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle 0.36 0.00 2.70 35.74 0.00 61.19

Device:   rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda          7.53    17.90   97.65    0.76 26641.93   149.18   272.25    22.72  230.85   7.46  73.39

Also:
netstat -an |grep :80 |wc -l
416

iptraf shows 165000 KB/s

A: The right answer here is to compare these stats against what your system looks like when it's functioning normally. The importance of getting a baseline for performance analysis can not be overstressed.
Nevertheless - there a few good tutorials on iostat:

*

*http://www.igvita.com/2009/06/23/measuring-optimizing-io-performance/

*http://bhavin.directi.com/iostat-and-disk-utilization-monitoring-nirvana/
So with those refreshers, let's take a stab:
- your disk are busy, but not to capacity: utilization is 73%
- disk requests are getting serviced in ~7ms, which sounds pretty good
- most tellingly: CPU is largely idle (61%), and otherwise waiting for I/O.
I'd say there's likely something else getting in the way, maybe delaying/buffering the request to begin with. Might be worth trying to measure -- if possible -- just one httpd process serving one big file, and see if the picture looks different.


text:
Q: Visual Studio Code: c/c++ IntelliSense; globbing in includePath? Does the (C/C++ plugin) not support globbing in its includePath setting?
I tried:
"configurations": [
    {
        "name": "Mac",
        "includePath": [
            "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
            "/usr/local/include",
            "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include",
            "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
            "/usr/include",
            "${workspaceRoot}/**/include"
        ],
... the rest...

and it doesn't seem to help.


text:
Q: Why does addEventListener trigger immediately? This has been asked many times before BUT in different cases so I don't really understand the previous answers. This is my code:

function enableEdit() {
  var btn = this.event.target;
  if (btn.innerHTML == "Edit") {
    document.getElementById("output").innerHTML = "You clicked the Edit button. Changing to Update";
    window.addEventListener("click", function () { disableEdit(btn); } );
    btn.innerHTML = "Update";
  }
  else if (btn.innerHTML == "Update") {
    document.getElementById("output").innerHTML = "You clicked the Update button. Changing to Edit";
    btn.innerHTML = "Edit";
    window.removeEventListener("click", disableEdit);
  }
}

function disableEdit(btn) {
    if (this.event.target != btn) {
        if (btn.innerHTML == "Update") {
            document.getElementById("output").innerHTML = "You clicked somewhere else. Reverting to Edit";
            btn.innerHTML = "Edit";
            window.removeEventListener("click", disableEdit);
        }
    }
}

Output

    <button type="button" onclick="enableEdit()">Edit</button>

This works perfectly BUT I still don't understand this part:
window.addEventListener("click", function () { disableEdit(btn); } );
btn.innerHTML = "Update";

Why does the addEventListener trigger the function immediately? At first I put the btn.innerHTML = "Update" before the window.addEventListener but because the listener fires immediately and reads the button as "Update", I put that line below the addEventListener.
Can somebody explain to me in plain English this behavior which I find weird? Yes, I have read many tutorials but I have become more confused instead.


text:
Q: MongoDB statefulset updating I am in the process of deploying a mongodb ReplicaSet on GKE.
My deployment works, however I would like to enable auth on Mongo.
I have connected to my pod
kubectl exec -it {pod_name} mongo admin

Created an Admin user and also a user for my database. I was then thinking I could update mongo-statefulset.yaml with the --auth flag and apply the updated yaml.
Something like
.....
spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: mongod-container
          image: mongo:3.6
          command:
            - mongod
            - "--bind_ip"
            - "0.0.0.0"
            - "--replSet"
            - rs0
            - "--smallfiles"
            - "--noprealloc"
            - "--auth"
          ports:
            - containerPort: 27017
          volumeMounts:
            - name: mongo-persistent-storage
              mountPath: /data/db
.....

But running kubectl apply -f mongo-statefulset.yaml just produces

service/mongo-svc unchanged
statefulset.apps/mongo configured

Should I restart my pods for this to now take effect?

A: You could try
kubectl delete -f mongo-statefulset.yaml && kubectl apply -f mongo-statefulset.yaml

A: Try to do rolling update:
The RollingUpdate update strategy will update all Pods in a StatefulSet, in reverse ordinal order, while respecting the StatefulSet guarantees.
Patch the web StatefulSet to apply the RollingUpdate update strategy.
$ kubectl patch statefulset your_statefulset_name -p '{"spec":{...}}}'

Don't to forget to add env label with credentials you have created on your pod like:
      env:
        - name: MONGODB_USERNAME
          value: admin
        - name: MONGODB_PASSWORD
          value: password

I hope it helps.


text:
Q: Inserting data extracted from an XML file into a MySQL table I have a variety of data that I'm trying to export into an existing database table in MySQL.  Below is the PHP code that accesses the MySQL database and the XML document (edit.xml), extracts the necessary data and attempts to place it into the table, Person:
<?php

// create connection
$connect = mysqli_connect("localhost", "root", "****");
// check connection
if (!$connect) {
    die('Could not connect: ' . mysql_error());
    exit();
}

// select database
mysqli_select_db($connect, 'poeticarchive');

// save XML document as a variable reference
$xml = simplexml_load_file("edit.xml");

// search document for all <emph> elements with an attribute named 'altrender' that have the value 'identifier' (unique id value)
$aID = $xml -> xpath('//ead/archdesc/dsc/c01//c02[1]//@identifier');
// date of birth value
$dob = $xml -> xpath('//ead/archdesc/dsc/c01//c02[1]//emph[3]');
// first name value
$firstName = $xml -> xpath('//ead/archdesc/dsc/c01//c02[1]//emph[2]');
// last name value
$lastName = $xml -> xpath('//ead/archdesc/dsc/c01//c02[1]//emph[1]');
// biography value
$bio = $xml -> xpath('//ead/archdesc/dsc/c01/c02//c03/bioghist//p');
// books by author value
$book = $xml -> xpath('//ead/archdesc/dsc/c01/c02/c03/c04//unittitle | //ead/archdesc/dsc/c01/c02/c03/c04/c05//unittitle');

// store the values into an array
$person = array("AuthorID"=>$aID,
                "FirstName"=>$firstName,
                "LastName"=>$lastName,
                "Biography"=>$bio,
                "DateOfBirth"=>$dob,
                "Books"=>$book);

$personTable = implode("','",$person);

mysqli_query($connect, "INSERT INTO Person (AuthorID, FirstName, LastName, Biography, Books, DateOfBirth) VALUES ('$personTable')");

// close connection
mysqli_close($connect);

?>

This extracts the data I'm after (as I checked using while(list($key $value) = each($array)) to display the data on-screen).  However it comes up with the error Notice: Array to string conversion....  Does anyone know how I can iterate this array and insert the data into the table Person?
Thank you for your help!

A: The error is clear enough.
SimpleXML returns values as array.
You can easily convert it to string using (string) $xml->path() though.

A: you can try this,
instead of
mysqli_query($connect, "INSERT INTO Person (AuthorID, FirstName, LastName, Biography, Books, DateOfBirth) VALUES ('$personTable')");

write individual values in insert query
like this
mysqli_query($connect, "INSERT INTO Person (AuthorID, FirstName, LastName, Biography, Books, DateOfBirth) VALUES (" . $aID . ", '" . $firstName . "'" . $lastName . "'" . $bio . "'" . $dob . "'" . $book ."')");


text:
Q: When to use innerJoin instead of where with Doctrine 2? I have a user entity and an Event entity. the Users can notify that they want to go to some events.
Those users also have friends who are themselves users (self referencing many to many relation).
I'm looking to retrieve from my database the user' friends who fulfill the following conditions:
They want to go to the same event.
they are nearby each others.
While the second condition is fine, I'm trying to build the best query possible to make sure the first condition is respected.
Here is what I have done so far:
$qb = $this->getEntityManager()->createQueryBuilder();

        $qb->select( 'USER', 'FRIENDS' ) // Selecting Me, the user who is asking to retrieve the users matched, and the friends who fill the criterias below
            ->from( 'Entity\User',  'USER' ) // we start with the user
            ->where( 'USER.id = :userId' ) // And I want the user the be me
            ->leftJoin('USER.friends', 'FRIENDS') // I'm going to take all of his friends
            ->innerJoin( 'FRIENDS.eventNotified', 'EVENT' ) //but ONLY the ones that have notified Events ( array collection ov EVENT entity )
            ->leftJoin( 'EVENT.categories', 'c' ) //take events category in order to avoid doing any request when getting the name of the category
            ->leftJoin( 'EVENT.place', 'p' ) // same with  the place where the event occured
            ->andWhere(
                $qb->expr()->andX(
                    $qb->expr()->between('FRIENDS.latitude', ':minLat', ':maxLat'), //in a defined area
                    $qb->expr()->between('FRIENDS.longitude', ':minLng', ':maxLng'),
                    $qb->expr()->eq('FRIENDS.eventNotified.id', 'USER.eventNotified.id') //I want to select ONLY the friends who have notified they want to go to the same events than me (I have notified the same events as well)
                )
            )
            ->add( 'orderBy', $qb->expr()->sum( 'FRIENDS.latitude - :lat', 'FRIENDS.longitude - :lng' ) );

Unfortunately for me, this is not doing what I am looking to do. And I wonder why.
So once I select FRIENDS, I basically want to select ONLY the friends who have notified they want to go to the same events as the ones I have notified too.
So I'm doing an innerJoin to check if the friends (they are user as well) have notified they want to go to events. And then in those friends, I want to select ONLY the ones who are going to the same events as mine $qb->expr()->eq('FRIENDS.eventNotified.id', 'USER.eventNotified.id').
I think there is my problem ... since eventNotified is a collection of the EVENT entity from which,  I am looking to select ONLY the events we both have notified, can I just get rid of the .id ? also, I have the feeling this is selecting all of the events when I just want to retrieve the eventsnotified we have in commun. So I believe I should do an innerJoin here somewhere but I can find the right synthax.
Any advice ?
Thanks
Bonus: should I also specify I want to retrieve 'c' and 'p' in the SELECT statement ?
EDIT:
I tried the solution below, but I am getting this error I don't understand. How can I retrieve the complete error message ? (some parts are missing ! )
Code I have tried :
//We only want to return users nearby who are available OR who
        $qb = $this->getEntityManager()->createQueryBuilder();
    $qb->select( 'USER', 'FRIENDS' ) // Selecting Me, the user who is asking to retrieve the users matched, and the friends who fill the criterias below
        ->from( 'Entity\User',  'USER' ) // we start with the user
        ->where( 'USER = :user' ) // And I want the user the be me
        ->leftJoin('USER.friends', 'FRIENDS', 'WITH', 'USER.eventNotified = FRIENDS.eventNotified');

    $array = array(
         'user'   => $user
    );

    $qb->setParameters( $array );

    $usersMatched = $qb->getQuery()->getResult();

error:

Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException'
  with message 'SELECT USER, FRIENDS FROM Entity\User USER LEFT JOIN
  USER.friends FRIENDS WITH USER.eventNotified = FRIENDS.eventNotified
  WHERE USER = :user' in
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/QueryException.php:39Stack
  trace:#0
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(429):
  Doctrine\ORM\Query\QueryException::dqlError('SELECT USER, FR...')#1
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(686):
  Doctrine\ORM\Query\Parser->semanticalError('Invalid PathExp...',
  Array)#2
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(240):
  Doctrine\ORM\Query\Parser->_processDeferredPathExpressions(Object(Doctrine\ORM\Query\AST\SelectStatement))#3
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(304):
  Doctrine\ORM\Query\Parser->getAST()#4 /Users in
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/QueryException.php
  on line 49

It seems that Doctrine2 doesn't like 'WITH', 'USER.eventNotified = FRIENDS.eventNotified' for some reason. I don't really understand why. without this bit of code, the code works fine but this condition is indeed not fulfilled.
Many Thanks for your help
EDIT2:
After trying what was in the third comment of the answer below, I still get a similar error message:

Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException'
  with message 'SELECT USER, FRIENDS, EVENT, c, p FROM Entity\User USER
  LEFT JOIN USER.friends FRIENDS WHERE USER = :user AND
  USER.eventNotified = FRIENDS.eventNotified' in
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/QueryException.php:39Stack
  trace:#0
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(429):
  Doctrine\ORM\Query\QueryException::dqlError('SELECT USER, FR...')#1
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(528):
  Doctrine\ORM\Query\Parser->semanticalError(''EVENT' is not ...',
  Array)#2
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(233):
  Doctrine\ORM\Query\Parser->_processDeferredIdentificationVariables()#3
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/Parser.php(304):
  Doctrine\ORM\Query\Parser->getAST()#4 /Users/YohannM/Sites/meetmyfrien
  in
  /Users/YohannM/Sites/meetmyfriends-back/application/libraries/Doctrine/ORM/Query/QueryException.php
  on line 49

I think we cannot do dynamic conditions. I don't know if there is a way to do it with doctrine otherwise I'll probably have to do that with PHP i guess ..
Here are the structure of my event and user entity:
User entity:
class User {
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false, unique=true)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="fb_id", type="bigint", nullable=false, unique=true)
     */
    private $fb_id;

    /**
     * @var string
     *
     * @ORM\Column(name="firstname", type="string", length=100, nullable=false, unique=false)
     */
    private $first_name;

    /**
     * @var string
     *
     * @ORM\Column(name="lastname", type="string", length=100, nullable=true, unique=false)
     */
    private $last_name;

    /**
     * @var string
     *
     * @ORM\Column(name="email", type="string", length=255, nullable=true, unique=true)
     */
    private $email;

    /**
     * @var integer
     *
     * @ORM\Column(name="notation", type="integer", nullable=true, unique=true)
     */
    private $notation;

    /**
     * Bidirectional - Many users have Many favorite comments (OWNING SIDE)
     *
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Entity\Category", inversedBy="userInterests")
     */
    private $interests;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Entity\User", cascade={"persist"})
     * @ORM\JoinTable(name="friends",
     *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="friend_user_id", referencedColumnName="id")}
     *      )
     **/
    private $friends;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="Entity\Request", mappedBy="user", cascade={"remove"}, orphanRemoval=true)
     * @ORM\JoinColumn(nullable=true)
     */
    private $requests;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="Entity\Request", mappedBy="friend", cascade={"remove"}, orphanRemoval=true)
     * @ORM\JoinColumn(nullable=true)
     */
    private $notifications;

    /**
     * Bidirectional - Many users have notified they want to go to different events (OWNING SIDE)
     *
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Entity\Event", inversedBy="userNotified", cascade={"persist"})
     */
    private $eventNotified;

    /**
     * @var integer
     *
     * @ORM\Column(name="age", type="integer", length=3, nullable=true, unique=false)
     */
    private $age;

    /**
     * @var string
     *
     * @ORM\Column(name="description", type="text", nullable=true, unique=false)
     */
    private $description;

    /**
     * @var string
     *
     * @ORM\Column(name="picture", type="string", length=300, nullable=true, unique=false)
     */
    private $picture;

    /**
     * @var string
     *
     * @ORM\Column(name="genre", type="string", length=10, nullable=true, unique=false)
     */
    private $genre;

    /**
     * @var boolean
     *
     * @ORM\Column(name="isregistered", type="boolean", length=1, nullable=false, unique=false)
     */
    private $registered;

    /**
     * @var string
     *
     * @ORM\Column(name="latitude", type="decimal", length=64, precision=25, scale=20, nullable=true, unique=false)
     */
    private $latitude;

    /**
     * @var string
     *
     * @ORM\Column(name="longitude", type="decimal", length=64, precision=25, scale=20, nullable=true, unique=false)
     */
    private $longitude;

    /**
     * @var \Entity\Security_Key
     *
     * @ORM\OneToOne(targetEntity="Entity\Security_Key", cascade={"persist","remove"}, orphanRemoval=true)
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="private_key_id", referencedColumnName="id", unique=true, onDelete="SET NULL")
     * })
     */
    private $private_key;

    /**
     * @var boolean
     *
     * @ORM\Column(name="isavailable", type="boolean", length=1, nullable=false, unique=false)
     */
    private $available = 0;

Event entity:
class Event
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=200, precision=0, scale=0, nullable=false, unique=false)
     */
    private $name;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToMany(targetEntity="Entity\Category", inversedBy="events")
     * @ORM\JoinTable(name="categories_events")
     */
    private $categories;

    /**
     * @var \Entity\User
     *
     * @ORM\ManyToOne(targetEntity="Entity\User", inversedBy="events")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     **/
    private $user;

    /**
     * @var \Entity\Admin
     *
     * @ORM\ManyToOne(targetEntity="Entity\Admin", inversedBy="events")
     * @ORM\JoinColumn(name="admin_id", referencedColumnName="id")
     **/
    private $admin;

    /**
     * @var \Entity\Place
     *
     * @ORM\ManyToOne(targetEntity="Entity\Place", inversedBy="events", cascade={"persist"})
     * @ORM\JoinColumn(nullable=false)
     */
    private $place;

    /**
     * @var string
     *
     * @ORM\Column(name="description", type="text", precision=0, scale=0, nullable=true, unique=false)
     */
    private $description;

    /**
     * @var string
     *
     * @ORM\Column(name="link", type="string", length=200, nullable=true, unique=false)
     */
    private $link;

    /**
     * @var string
     *
     * @ORM\Column(name="picture", type="string", length=100, precision=0, scale=0, nullable=true, unique=false)
     */
    private $picture;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_created", type="datetime", precision=0, scale=0, nullable=false, unique=false)
     */
    private $dateCreated;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_start", type="datetime", precision=0, scale=0, nullable=true, unique=false)
     */
    private $dateStart;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_end", type="datetime", precision=0, scale=0, nullable=true, unique=false)
     */
    private $dateEnd;

    /**
     * @var boolean
     *
     * @ORM\Column(name="confirmed", type="boolean", length=1, nullable=false, unique=false)
     */
    private $confirmed;

     /**
     * Bidirectional - One-To-Many (INVERSE SIDE)
     *
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="Entity\Request", mappedBy="event")
     */
    private $invitations;

    /**
     * Bidirectional - Many users are intending many events (INVERSE SIDE)
     *
     * @ORM\ManyToMany(targetEntity="User", mappedBy="eventNotified", cascade={"persist"})
     */
    private $userNotified;

A: A few ideas:
You can try using something like $qb->expr()->eq('FRIENDS.eventNotified', 'USER.eventNotified') instead of $qb->expr()->eq('FRIENDS.eventNotified.id', 'USER.eventNotified.id'), because I suppose that eventNotified is someway a USER related entity which attribute name in your USER entity is eventNotified.
Anyhow, I would directly use a "with" in the join, so you limit your join results independently of your where clause:
  ->leftJoin('USER.friends', 'FRIENDS', 'WITH', 'FRIENDS.eventNotified = USER.eventNotified') // I'm going to take all of his friends

Bonus: should I also specify I want to retrieve 'c' and 'p' in the SELECT statement ?
Answer : yes, if you want to retrieve them with your getters after without a new query to the database


text:
Q: Make images mobile-responsive in HTML & CSS I know it's a few threads about this, but none of them is working for me and that's the reason why I'm asking for YOUR help. Well. I'm creating a website, and I'm trying to make my images responsive but I can't get it to work.
#banner2 {
background-image: url(Images/banner2.jpeg);
background-attachment: fixed;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
max-width: 100%;
height: 500px;
max-height: 50%;
}

@media screen and (max-width: 800px) {
    #banner2 {
        background-image: url(Images/banner2.jpeg);
        width: 100%;
        height: auto;
    }
}

This is my CSS code so far, and I've tried in a lot of ways but I can't really get it to work on my Iphone.
I've also added this line of code in the HTML.
<meta name="viewport" content="width=device-width, initial-scale=1.0">

But still no..
So when I'm trying to open the webpage on my iPhone, the image doesn't look how I would like.
Any help would be much appreciated!

A: If you're using background-image, you can use padding-bottom to force the element to maintain it's aspect ratio as it resizes.
.image {
  width: 100%;
  padding-bottom: 50%;
  background-image: url(path/to/img.jpg);
}

You will have to tweak padding-bottom to achieve the desired aspect ratio.


text:
Q: Getting error - debugging connection was closed. Reason: Render process gone I'm making a game, and eventually it will just stop working.  It seems no rhyme or reason, not sure if I have a Memory leak or something like that?  Before I inserted the massive array, I was pulling this from a json file hosted online.  It's not until I get to completing the game that is give the message in the console.  "debugging connection was closed. Reason: Render process gone."  Doesn't matter if it's firefox or chrome.  Since it's heavy clicking on the buttons, it seems if I don't click as fast, it will run.

Team 1
Team 2

1st Dice

2nd Dice

<button id="turn" onclick="rollem()">Player 1 Starts</button>
<button id="turn" onclick="lastmove1(unit6)">Unit1 last move</button>

<button id="turn" onclick="bumpmove(unit1, '75')">Unit1 bumpmove</button>

<button id="turn" onclick="bumpmove(unit2, '75')">Unit2 bumpmove</button>

<button id="turn" onclick="bumpmove(unit3, '75')">Unit3 bumpmove</button>

<button id="turn" onclick="bumpmove(unit4, '75')">Unit4 bumpmove</button>

A: I had this error and it appeared random, but I got to the root of the cause: a never-ending for loop.
Given the non-specificity of the error in Google Chrome, I had to write a bunch of console.log("...") notes to zero in on the issue and found that I (poorly) wrote a function that had both non-integer increments and also the potential to never reach the end of the loop.
It looked something like this:
var myArray = [];
for (i = 0; i <= total; i += total / 100) {
   myArray.push(i);
};

Due to rounding issues, i was always <= total.  I updated the code to instead use:
var myArray = [];
for (var i = 0; i <= 100; i++) {
   myArray.push(total * (i / 100));
};

And haven't had the problem since.
And to the OP, while I haven't dived into your code too deeply, it could be that one of your for loops that decreases the iterator (i) could be creating the same never-ending loop.  I'm referring specifically to this part of your code:
Array.prototype.remByVal = function(val) {
   for (var i = 0; i < this.length; i++) {
      if (this[i] === val) {
         this.splice(i, 1);
         i--;  // <-- This part here could be an issue
      }
   }
   return this;
}


text:
Q: How to test NSCFBoolean value? received data from JSON, which is looks like:
{
    myself = 1;
    "id" = 123;
}

and I put it into a NSDictionary *messageDic, I also defined a value *isMyself to receive the value of myself
Boolean isMyself = [messageDic objectForKey:@"myself"];

but it does not work.
So I print the date type,
const char* className = class_getName([[messageDic objectForKey:@"myself"] class]);
NSLog(@"yourObject is a: %s", className);
NSLog(@"Size of BOOL %d", sizeof(isMyself));
NSLog(@"Size of BOOL %@", [messageDic objectForKey:@"myself"]);

the results are:
2012-08-01 17:41:48.886  yourObject is a: __NSCFBoolean
2012-08-01 17:41:48.887  Size of BOOL 1
2012-08-01 17:41:48.887  Size of BOOL 0

and the if section below also does not work.
if ([messageDic objectForKey:@"myself"] == 0)

I tried
NSCFBoolean *isMyself = [messageDic objectForKey:@"myself"];

I got error form above.
my question is what should I do to test the value of [messageDic objectForKey:@"myself"]? and what is the __NSCFBoolean?
Thanks!

A: the result you've got from [messageDic objectForKey:@"myself"], which is a NSNumber, then you need to convert the result to Bool. So try below:
if ([[messageDic objectForKey:@"myself"]boolValue] == NO)

A: __NSCFBoolean is a private class that is used in NSNumber class cluster. To extract appropriate value from it you need to use methods from NSNumber class, -boolValue in your case:
BOOL isMyself = [[messageDic objectForKey:@"myself"] boolValue];


text:
Q: onItemClickListener with custom adapter and listview I am trying to set an onItemClickListener with a custom adapter and listview setup. Can't seem to get the listener working. I don't think I am setting it up properly. Any help is appreciated. Thanks very much.
Adapter:
public class ModuleAdapter extends ArrayAdapter<Module> {

Context context;
int layoutResourceId;
Module data[];

public ModuleAdapter(Context context, int layoutResourceId,
        Module data[]) {
    super(context, layoutResourceId, data);
    this.layoutResourceId = layoutResourceId;
    this.context = context;
    this.data = data;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    ModuleHolder holder = null;

    if(row == null)
    {
        LayoutInflater inflater = ((Activity)context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);

        holder = new ModuleHolder();
        holder.modJapTitle = (TextView)row.findViewById(R.id.moduleJapTitle);
        holder.modEngTitle = (TextView)row.findViewById(R.id.moduleEngTitle);
        holder.modComp = (TextView)row.findViewById(R.id.moduleCompletion);
        holder.modRating = (RatingBar)row.findViewById(R.id.moduleScore);

        row.setTag(holder);
    }
    else
    {
        holder = (ModuleHolder)row.getTag();
    }

    Module module = data[position];
    holder.modJapTitle.setText(module.moduleJapaneseTitle);
    holder.modEngTitle.setText(module.moduleEnglishTitle);
    holder.modComp.setText(module.moduleCompletionRate);
    holder.modRating.setRating(module.moduleRating);

    return row;
}

static class ModuleHolder
{
    TextView modEngTitle;
    TextView modJapTitle;
    TextView modComp;
    RatingBar modRating;
}

}
Implementation:
ModuleAdapter moduleData = new ModuleAdapter(this, R.layout.module_box_item, module_data);
    ListView listView1 = (ListView)findViewById(R.id.moduleListContainer);
    listView1.setAdapter(moduleData);
    listView1.setCacheColorHint(Color.TRANSPARENT);
    listView1.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Log.v("Module Item Trigger", "Module item was triggered");
            Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT).show();
        }
    });

Also here is the XML Layout for one of the single items in the list:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/moduleBox"
android:id="@+id/moduleBoxSingle" >

<TextView
    android:id="@+id/moduleJapTitle"
    style="@style/moduleTitleJap" />
<TextView
    android:id="@+id/moduleCompletion"
    android:layout_above="@+id/moduleSepartor"
    style="@style/moduleCompletion" />
<View
    android:id="@+id/moduleSepartor"
    android:layout_below="@+id/moduleJapTitle"
    style="@style/moduleSeperator" />
<TextView
    android:id="@+id/moduleEngTitle"
    android:layout_below="@+id/moduleSepartor"
    style="@style/moduleTitleEng" />
<RatingBar
    android:id="@+id/moduleScore"
    android:layout_below="@+id/moduleSepartor"
    style="@style/moduleRating"
    android:layout_alignParentRight="true" />

</RelativeLayout>

A: First of All for this you have to impliments the class with the following handler
implements  OnItemClickListener

then add a function as given below onItemClick()
public void onItemClick(AdapterView parent, View v, int position, long id) {
  Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT).show();
}

And when we set the data adapter to the listview then add the following line of code
itemlist.setOnItemClickListener(this);

Hope this will work for you...

A: I have same issue and I fix it by do like:(refer from https://github.com/sephiroth74/HorizontalVariableListView/issues/33 )
add this line in root view in layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/moduleBox"
android:id="@+id/moduleBoxSingle"
android:descendantFocusability="blocksDescendants" >

A: I think it's the similar problem like this.
Add below code to your TextView in the XML
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false"

and try again.

A: Try this...
ListView lv = (ListView)findViewById(R.id.Your_ListView_Id);  // If it extends Activity.

OR
ListView lv = getListView;  // If it extends ListActivity.
lv.setOnItemClickListener(this); // Make the Activity implement onItemClickListener
lv.setAdapter(your_adapter);

Edited part:  Change made in Toast's Context, and Added SysOut
// The method that will handle the Events.
public void onItemClick(AdapterView parent, View v, int position, long id{
     Toast.makeText(Your_Activity_Name.this, "hello", Toast.LENGTH_SHORT).show();
     System.out.println("This is a Test");
}

CHECK YOU LOG.. DOES THE SYSOUT STATEMENT GETS PRINTED !!


text:
Q: How to find one specific key value pair as output from reducer I need to find the student with max marks using MR
Paul 90
Ben 20
Cook 80
Joe 85

So output of reducer should be (Paul 90)
can anyone help me with this?

A: You can map all input tuples to the same key, with a value being the same as each input tuple, like (the-one-key, (Ben, 20)), and use a reduce function that returns only the tuple that has the maximum grade (since there is only one key).
To make sure that MR parallelism kicks in, using a combiner with the same function as the reducer (above) should do the trick. That way, the reducer will only get one tuple from each mapper and will have less work to do.
Edit: even better, you can already eliminate all but the max in the mapping function to get best performance (see Venkat's remark that combiners are not guaranteed to be used).
Example with two mappers:
Paul 90
Ben 20
Cook 80
Joe 85

Mapped to:
Mapper 1
(the-one-key, (Paul, 90))
(the-one-key, (Ben, 20))

Mapper 2
(the-one-key, (Cook, 80))
(the-one-key, (Joe, 85))

Combined to (still on the mappers' side):
Mapper 1
(the-one-key, (Paul, 90))

Mapper 2
(the-one-key, (Joe, 85))

Reduced to:
(the-one-key, (Paul, 90))

A final remark: MapReduce may be "too much" for this if you have a small data set. A simple scan in local memory would be faster if you only have a few hundreds or thousands values.

A: A good way of doing this is to do a secondary sort in Hadoop. Your Map output key should be a combination of (Name, Marks).
You would then implement a custom comparator which can take this key & based on the Marks only compare 2 given values and sort based on higher marks.
Typically we implement a grouping comparator but in this case we would want all the keys to go into a single reducer. So we would ignore the key differences in the grouping comparator.
In the reducer just get the first value & exit.
Details of secondary sort : Secondary Sort

A: Take a look at the following code at gist:
https://gist.github.com/meshekhar/6dd773abf2af6ff631054facab885bf3
In mapper, data gets mapped to key value pair:
key: "Paul 90"
key: "Ben 20"
key: "Cook 80"
key: "Joe 85"

In reducer, iterating through all the records using while loop, each value is split into name and marks and max marks stored in temp variable.
And at the end, the max value and corresponding name pair are returned. e.g. Paul 90.
I tested it on a single node system with more than 1 million records, takes less than 10 sec.


text:
Q: Find the area bounded by the curve using the change of variables in double integrals Here is the equation:
$$
\left(\frac{x}{a}+\frac{y}{b}\right)^5=\frac{\left(x^2y^2\right)}{c^4}
$$
I got the general idea but I don't know how to start solving it, therefore I would greatly appreciate if someone could solve and explain it here.
I am very limited on time since there's a lot of pressure from my other courses. Thus, I would really appreciate detailed explanation of how to approach and solve this equation. I am newbie in this sphere and I struggle with finding correct approaches.
Thank you in advance!


text:
Q: Combining the sum of multiple columns, of multiple tables, in one query/table I have four tables with identical fields (geography, q1, q2, q3, q4). I need to find the sum of the quarters for each of the four tables and produce a new table with the geography, sum of table 1, sum of table 2, sum of table 3, sum of table 4.
I can get each sum individually, but can't figure out how to combine them into one table. Below is the working code for one table, A:
SELECT [A].Geography,
       Sum([A].[q1])+Sum([A].[q2])+Sum([A].[q3])+Sum([A].[q4]) AS TSUM
FROM [A]
GROUP BY [A].Geography
ORDER BY [A].Geography;

A: Simply join all tables by Geography, retrieving their aggregated column sums. Below assumes all Geographies are the same in all tables with table A as the matching source:
SELECT [A].Geography,
       Sum([A].[q1])+Sum([A].[q2])+Sum([A].[q3])+Sum([A].[q4]) AS TSUM_A,
       Sum([B].[q1])+Sum([B].[q2])+Sum([B].[q3])+Sum([B].[q4]) AS TSUM_B,
       Sum([C].[q1])+Sum([C].[q2])+Sum([C].[q3])+Sum([C].[q4]) AS TSUM_C,
       Sum([D].[q1])+Sum([D].[q2])+Sum([D].[q3])+Sum([D].[q4]) AS TSUM_D

FROM (([A]
INNER JOIN [B] ON [A].Geography = [B].Geography)
INNER JOIN [C] ON [A].Geography = [C].Geography)
INNER JOIN [D] ON [A].Geography = [D].Geography

GROUP BY [A].Geography
ORDER BY [A].Geography;

Should Geographies differ in all four tables, consider this workaround, using a derived table union query of all geographies across all tables (UNION returns distinct values vs UNION ALL) and then LEFT JOINs all tables, A-D. Of course this derived table of distinct geography records can be a saved Access query referenced in same place in FROM clause. Do note, in this approach, NULL values will appear in rows where geographies do not appear in particular table.
SELECT main.Geography,
       Sum([A].[q1])+Sum([A].[q2])+Sum([A].[q3])+Sum([A].[q4]) AS TSUM_A,
       Sum([B].[q1])+Sum([B].[q2])+Sum([B].[q3])+Sum([B].[q4]) AS TSUM_B,
       Sum([C].[q1])+Sum([C].[q2])+Sum([C].[q3])+Sum([C].[q4]) AS TSUM_C,
       Sum([D].[q1])+Sum([D].[q2])+Sum([D].[q3])+Sum([D].[q4]) AS TSUM_D

FROM (((
       (SELECT Geography FROM A
        UNION SELECT Geography FROM B
        UNION SELECT Geography FROM C
        UNION SELECT Geography FROM D) As main

LEFT JOIN [A] ON [main].Geography = [A].Geography)
LEFT JOIN [B] ON [main].Geography = [B].Geography)
LEFT JOIN [C] ON [main].Geography = [C].Geography)
LEFT JOIN [D] ON [main].Geography = [D].Geography

GROUP BY [main].Geography
ORDER BY [main].Geography;

Take care to handle parentheses around join clauses as they are required by MS Access SQL.


text:
Q: How to organize MVC structure with big amount of models/controllers I have got a project with about 50 controllers and 60 models.
It is quite difficult to work in that mess.
How can I improve that scructure?
Now I am creating namespaces for some logical parts of my application and store them in separate folders. But for models this have got some side effects.

A: You can organize your classes in subfolders - you don't even need to structure them into submodules (but you can if you want to).
See this other question for details.

A: Refactoring is a discipline that deals with that kind of problem.
Consider this book.

A: you can refactor your code using namespace.


text:
Q: can't create database using sqliteopenhelper class in android Here is my code of the DataBase class. I don't understand why I'm not able to create the table articles.
Error message says "no such table:articles(code1):,while compiling: select * from articles".
I'm totally clueless why is this happening. Please helm me solve this problem.
 class DataBase extends SQLiteOpenHelper {

private static final String DATABASE_NAME = "MyDB.db";

public static final String ARTICLES_TABLE_NAME = "articles";
public static final String ARTICLES_COLUMN_ID = "id";
private static final String ARTICLES_COLUMN_NAME = "name";
public static final String ARTICLES_COLUMN_PRICE = "price";

public static final String COSTUMER_TABLE_NAME = "costumers";
public static final String COSTUMER_COLUMN_ID = "id";
public static final String COSTUMER_COLUMN_NAME = "name";
public static final String COSTUMER_COLUMN_PHONE = "phone";

//private HashMap hp;

DataBase(Context context) {
    super(context, DATABASE_NAME, null, 1);
}

@Override
public void onCreate(SQLiteDatabase db) {

    db.execSQL(
            "create table articles " +
                    "(id integer primary key, name text, price text)");

    db.execSQL(
            "create table costumers " +
                    "(id integer primary key, name text,phone text)");

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS articles");
    db.execSQL("DROP TABLE IF EXISTS costumers");
    onCreate(db);
}

boolean insertArticle(String name, String price) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    contentValues.put("name", name);
    contentValues.put("price", price);
    db.insert("articles", null, contentValues);
    return true;
}

ArrayList<String> getAllArticles() {
    ArrayList<String> array_list = new ArrayList<String>();

    //hp = new HashMap();
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor res =  db.rawQuery( "select * from articles", null );
    res.moveToFirst();

    while(!res.isAfterLast()){
        array_list.add(res.getString(res.getColumnIndex(ARTICLES_COLUMN_NAME)));
        res.moveToNext();
    }

    return array_list;
}

}


text:
Q: What is the idiomatic way to alter a vector that is stored in an atomized map? I have an atom called app-state that holds a map. It looks like this:
{:skills [{:id 1 :text "hi"} {:id 2 :text "yeah"}]}

What is the idiomatic way to remove the element inside the vector with :id = 2 ? The result would look like:
{:skills [{:id 1 :text "hi"}]}

...
So far, I have this:
(defn new-list [id]
   (remove #(= id (:id %)) (get @app-state :skills)))

swap! app-state assoc :skills (new-list 2)

It works, but I feel like this isn't quite right. I think it could be something like:
swap! app-state update-in [:skills] remove #(= id (:id %))

But this doesn't seem to work.
Any help is much appreciated!

A: Try this:
(defn new-list [app-state-map id]
      (assoc app-state-map :skills (into [] (remove #(= id (:id %)) (:skills app-state-map)))))

(swap! app-state new-list 2)

swap! will pass the current value of the atom to the function you supply it. There's no need to dereference it yourself in the function.
See the docs on swap! for more details.

A: (swap! state update :skills (partial remove (comp #{2} :id)))

A: (def skills {:skills [{:id 1 :text "hi"} {:id 2 :text "yeah"}]})

(defn remove-skill [id]
  (update skills :skills (fn [sks] (vec (remove #(= id (:id %)) sks)))))

You would then be able to call say (remove-skill 1) and see that only the other one (skill with :id of 2) is left.
I like your way better. And this would need to be adapted for use against an atom.

A: You can use filter to do this.  Here is a function that takes an id and the map and let's you filter out anything that doesn't match your criteria.  Of course, you can make the #() reader macro check for equality rather than inequality depending on your needs.
user=> (def foo {:skills [{:id 1 :text "hi"} {:id 2 :text "yeah"}]})
#'user/foo
user=> (defn bar [id sklz] (filter #(not= (:id %) id) (:skills sklz)))
#'user/bar
user=> (bar 1 foo)
({:id 2, :text "yeah"})
user=> (bar 2 foo)
({:id 1, :text "hi"})


text:
Q: Array not resetting at end of loop I have the code below that takes the subKeyValuesList and removes values from it as the loop iterates. This works however after each loop (it's one big array containing 4 arrays) I want the subKeyValuesList values to reset to the original value. Below I've tried to reset by applying some code to the last iteration of the loops but no joy. I think it may be a scope issue but have struggled to see where the issue is
 var subKeyValuesList = ['0009397b-563f-4dfc-8022-1516dbdffbda','1358d485-69e6-43bb-bc2f-ff25baa6a810']

   for (var fi = 0; fi < fields.length; fi++) {
       var subKeyValuesList2 = subKeyValuesList
       var fieldSplitTemp = fieldLong.replace(/[`~!@#$%^&*()_|+\=?;:'"<>\{\}\[\]\\\/]/gi, 'x')
       var fieldSplit = fieldSplitTemp.split("xix.")
       var fieldCount = fieldSplit.length

    var arrayPath = fieldSplit.splice(0, fieldCount - 1)

    for (let i = 0; i < eval(arrayPath[0]).length; i++) {

     for (let ii = 0; ii < eval(arrayPath[0] + "[i]." + arrayPath[1]).length; ii++) {
          var keyNames = Object.keys(eval(arrayPath[0] + "[i]." + arrayPath[1] + "[ii]"));
          var subKeyName = keyNames[0]
          var parent = eval(arrayPath[0] + "[i]." + arrayPath[1] + "[ii]." + subKeyName)

         var index = subKeyValuesList2.indexOf(parent);

           if (index !== -1) {
                                subKeyValuesList2.splice(index, 1)
                            }
           if (ii == eval(arrayPath[0] + "[i]." + arrayPath[1]).length - 1) {
        //if last instance in loop do reset spliced list with original subKeyValuesList
                    subKeyValuesList2 = subKeyValuesList
                        }

                    }

            }
        }


text:
Q: Format and replace a phone number using Regex in PHP I'm trying to validate a phone number on a user register/edit form. There are two fields: phone number 1 and phone number 2. They might come filled or not. If they come filled, I'll have to extract its numbers and, using a regular expression, format it correctly and display it so the user can edit. The problem is I'm a beginner and I'm not managing to format it. Here follows the code:
if (!empty($phone_1 )) {
    $string = $phone_1;
    $newString = preg_replace('/[^0-9]/i', '', $string); //extract numbers

    $regex = '^(11 [9][0-9]{4}-[0-9]{4})|(\(1[2-9]\) [5-9][0-9]{3}-[0-9]{4})|(\      ([2-9][1-9]\) [5-9][0-9]{3}-[0-9]{4})$';
    $final = preg_replace($regex, '', $newString);
  }

The format that I'm trying to output is "99 99999.9999".
Thank you.

A: Why not using sub_str to format your string ?
$phone1="01234567890";
$phone1 = substr($phone1, 0, 2) . ' ' . substr($phone1, 2, 5) . '.' . substr($phone1, 7, 4);
echo $phone1;

Output :
01 23456.7890

A: If you want to use a regex you can use this:
^(\d\d)(\d{5})(\d{4})$

Working demo

The code you can use is:
$re = "/^(\\d\\d)(\\d{5})(\\d{4})$/";
$str = "01234567890";
$subst = '\1 \2.\3';

$result = preg_replace($re, $subst, $str, 1);


text:
Q: Disable space-around for one special div There is part of css rules for parent div:
{
    z-index: 1000;
    width: 430px;
    background: #FFF none repeat scroll 0% 0%;
    max-width: 750.5px;
    outline: medium none;
    float: right;
    display: flex;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: -o-flex;
    flex-direction: row;
    flex-direction: -webkit-row;
    -webkit-flex-direction: row;
    -moz-flex-direction: row;
    -ms-flex-direction: row;
    -o-flex-direction: row;
    flex-wrap: nowrap;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    justify-content: space-around;
    -ms-flex-pack: justify;
    -webkit-flex-justify-content: space-around;
}

How to disable space-around for one child div? with following css:
.resultsDiv {
    position: absolute;
    top: 47px;
    left:0;
    right: 0;
    width: 100%;
}

As, I get idea, there should be something like justify-content-self: space-around


text:
Q: Single `c_cpp_properties.json` for multiple folders? In a VS Code workspace I have several folders included.
{
    "folders":
    [
        {
            "path": "C:\\folder1"
        },
        {
            "path": "C:\\folder2"
        },
        {
            "path": "C:\\folder3"
        }
    ]
}

Is it possible to use one single c_cpp_properties.json file (to define include paths and other settings) for all 3 folders? I would like to avoid having a c_cpp_properties.json file in each folder.

A: Generaly this seems not to be possible.
The only way is to have all directories share the same root direcory, and then to place a   .vscode directory inside this root:
c:/root_dir/
c:/root_dir/folder1
c:/root_dir/folder2
c:/root_dir/folder3
c:/root_dir/.vscode
c:/root_dir/.vscode/c_cpp_properties.json


text:
Q: Install Liferay as Windows 2012R2 service I am a newbie on Liferay and furthermore 100% Windows infrastructure knowledge based. I installed Liferay 6.2  on my Windows 2012R2 server together with Java jdk-8u5 version. All is running perfect as long as I am logged in as user on the Server via remotedesktop having open the tomcat startup.bat window.
What have I to do exactly to start Liferay and/or tomcat as service?
Thanks in advance for your efforts.

A: Configuring liferay or tomcat to run as a service on a windows server doesn't differ that much.So in order to do that you have to add some files to the LIFERAY_HOME\tomcat\bin directory.
To get those files you have to download a full version of 64-bitWindows tomcat from here :
http://tomcat.apache.org/download-70.cgi.
Extract the zip and go to the bin directory, copy service.bat , tomcat7.exe and tomcat7w.exe to this location : LIFERAY_HOME\tomcat\bin

*

*Setting Up the service

Open the commad prompt (Make sure you have admin rights or run the command prompt as administrator),In Command Prompt go to  LIFERAY_HOME\tomcat\bin and Execute the following command
service.bat install tomcat7

This will install the tomcat6 service in windows.
Now execute following commond to setup additional configuration for the service
tomcat7w.exe ES tomcat7.exe

2 . Extra configuration :
-XX:MaxPermSize=512m
-Dfile.encoding=UTF8
-Duser.timezone=GMT
-Djava.security.auth.login.config="%CATALINA_HOME%/conf/jaas.config"
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false

and make sure to provide enough memory for your service by setting the initial memory pool and the maximum one.

A: Either go with Rafik Beldi's answer (quite an effort, wow) or just go to tomcat's documentation in case you're still missing some information

A: I had to delete what was in Java Options completely or it wouldn't start: and then I entered:
-XX:MaxPermSize=512m
-Dfile.encoding=UTF8
-Duser.timezone=America/New_York
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
-Djava.net.preferIPv4Stack=true

note that where I am: America/New_York allows for both EST and EDT


text:
Q: Embed Java Script Map for VueJS component
*

*I'm trying to embed a map to my vue component which is written in java script.

*I downloaded that map from this web link. Sri Lanka Map

*In that map files documentation

They say to include some JS and CSS files to the head section.
Eg :- <link href="jsmaps/jsmaps.css" rel="stylesheet" type="text/css" />
Where is the head section in my template and how do I inject JS / CSS files to that head section?

A: There are several ways to manipulate the head section of single page application. Currently you can use Vue plugin named Vue Meta, take a look this repository https://github.com/declandewet/vue-meta.
But if you don't wanna make your hands dirty with that, you can use Nuxt.js, take a look this link https://nuxtjs.org/. Nuxt.js provides an easy way to create a project with Vue.js. You just edit the nuxt.config.js file like described here https://nuxtjs.org/api/configuration-head
Even you also can configure head section of specific page as you mention on the comment above.


text:
Q: Obstruction to a general S^1-action Question: Suppose you have a simply connected, closed, orientable, smooth manifold $M$. What are some restrictions to the existence of a smooth (non-trivial) $S^{1}$-action on $M$?
Note: 1.There are some well known restrictions in the case that we require this action to have isolated fixed points (or preserve some additional structures), but I am not aware of any obstruction in this generality.

*I am aware of the classification of manifolds with $S^{1}$-actions in dimension $2$ and $3$. In higher dimensions (say $\geq 6$) it seems to become less clear.

*I am particularly interested in dimension 6. I would like to get a picture of which manifolds in this dimension (satisying the above restrictions), have a smooth $S^{1}$-action.
Edit: Out of curiosity, using Puppe's methods, is it possible to construct a simply connected, smooth, complex projective 3-fold such that the underlying smooth manifold has no circle actions?
Edit 2 It turns out that (the underlying smooth 6-manifold of) any smooth hypersurface in $\mathbb{C}\mathbb{P}^4$ of degree atleast 3 has no smooth (non-trivial) circle actions. It follows from the main result of https://arxiv.org/pdf/1108.5327.pdf.

A: It is a result of Atiyah-Hirzebruch (1970)  that the $\hat{A}$ genus of a spin manifold with a nontrivial $S^1$ action vanishes, and a result of Herrera and Herrera that the same result, if the manifold is not necessarily spin, but has finite $\pi_2,$ then the same result, is true. In the meantime, there is the result of Freedman and Meeks (Une obstruction élémentaire à l'existence d'une action continue de groupe dans une variété, C. R. Acad. Sci., Paris, Sér. A 286, 195-198 (1978)) that there are some cohomological/geometric obstructions (so the connected sum of a non-sphere and a torus admits no circle action) - this has been generalized in
Assadi, Amir; Burghelea, Dan, Examples of asymmetric differentiable manifolds, Math. Ann. 255, 423-430 (1981). ZBL0437.57021..

A: V. Puppe, in Simply connected manifolds without $S^1$-symmetry. Algebraic topology and transformation groups, Proc. Conf., Göttingen/FRG 1987, Lect. Notes Math. 1361, 261-268 (1988) proved the following:

There exist a simply connected, closed, oriented smooth 6-dimensional manifold $M$ such that no closed, orientable manifold with the same rational cohomology algebra as $M$ admits a non-trivial circle action.


text:
Q: In how many ways can 3 distinct numbers fill 6 blanks (each repeated exactly twice)? I have a basic knowledge of permutations and combinations but using different approaches to this problem lead me to different answers.
Basically, there are 6 blanks and 3 distinct digits a,b, and c. All three of them occupy 2 blanks. For example, some possible combinations are:

*

*a a b b c c

*a b c a b c

*a b c c b a

Please mention the approach used and why the approach is logical and the others are not.
Edit: My Approaches:-

*

*We can first fill the 2 a's in any of the 6 blanks using 6C2 (as both are same). Then we can fill the 2 b's in any of the the remaining 4 blanks using 4C2. Then we can multiply them (there is no need to fill up c's as 2C2 is 1). The answer comes out to be 90.

*We can take the a's ,b's and c's as a1, a2, b1, b2, c1, c2 and find the number of permutations. That comes out to be 6P6 = 720. Since we a1 and a2 are same(similarly b1 and b2), we divide by 2 to get 360 (avoiding repetition).

Edit2:
Upon seeing the comments, I realized that in approach2:

*

*a1 a2 b1 b2 c1 c2

*a2 a1 b1 b2 c1 c2

*a1 a2 b2 b1 c1 c2

*a2 a1 b2 b1 c1 c2

*a1 a2 b1 b2 c2 c1

*a2 a1 b1 b2 c2 c1

*a2 a1 b2 b1 c2 c1

*a1 a2 b2 b1 c2 c1

are same. So, I should divide by 8 to get 90. So, is 90 the correct answer?

A: Your second approach is what needs to be corrected. First approach is correct.
Imagine that you have two systems that you put the variables:
$$
a_1,a_2,b_1,b_2,c_1,c_2
$$
through:

*

*Permute all six variables $\implies 6!$

*Flip a coin for each pair $x_1,x_2$ (independently) deciding whether to swap $x_1,x_2$ or not $\implies 2\cdot 2\cdot 2$
So the answer is:
$$
\frac{6!}{2\cdot2\cdot2}
$$
which gives the same answer you get by using combinations:
$$
6C2\cdot 4C2\cdot 2C2
$$


text:
Q: jquery javascript opening a new image link I need some assistance with this. I am trying to make an image (ad1.jpg) link url to be opened in a new tab. How would I do this? I have tried many options to make this work. I might be placing the code wrong but I have tried window.open, and many more options. Any help is greatly appreciated. Thanks
(function($){
    $(window).load(function(){
        if(jQuery.isFunction(jQuery.fn.prettyPhoto)) {
            $.prettyPhoto.open(
                "images/ad1.jpg", // Image to be opened
                "title",    // Title of the pop-up
                "desc."     // The description
            );
            setTimeout(function() {
                $.prettyPhoto.close();
            }, 10000); // autoclose after 10 seconds
        } else {
            console.log("PrettyPhoto is not defined."); // log this message
        }
    });
})(jQuery);

A: Is jquery a prerequisite?
Because if you want to click on an image and open it in a new tab you can just use target="_blank" like this:

See this jsfiddle demo

A: If you want the picture to be opened in a new tab, a simple link  on your picture should do the work.
But if you want to open the picture in a new tab, with the borders etc... from pretty photo, I think you'll have to create a page dedicated to that, and create a link to it.


text:
Q: Is it possible to share the complete codebase between angular web app and ionic app? I am developing an app with Ionic 4. And I've just recognized, that one can simply run ng serve and use my app in the browser as usual.
Now, if I want to build an angular web app and an Android and IOS with ionic 4, can I do that all in one project?

A: Yes you can. (Nowadays im developing one of this), same code base for both, APK and webapp.
You can turn your Angular webapp into PWA with two commands, this will enable support on mobiles adding your webapp as if would be a native app.
Check Angular doc for more info: Angular PWA


text:
Q: What does the $x$ in $K[x]$? Formal definition: Let $K$ be a fixed field. Then $$R:=\{(a_i)_{i\in\mathbb N}: a_i\in K, a_i = 0\text{ for almost all } i\in\mathbb N_0\}$$
together with the usual $+$ and $\cdot$ is a field, called the polynomial field.
Idea: A polynomial is an expression of the form $a_n x^n +a_{n-1} x^{n-1}+\dots a_2 x^2+ a_1x + a_0$, where $x$ denotes a variable and the coefficients $a_i$ are elements of $K$. For example $4x^3 + 8x^2 - x + 2$ is a polynomial (if $K=\mathbb R$). One can think of a sequence $(a_i)_{i\in\mathbb N_0} \in R$ as representing the polynomial where $a_i$ is the coefficient in front of $x^i$. Thus our example from above $4x^3 + 8x^2 - x + 2$ is represented by  the sequence $(2, -1, 8, 4, 0, 0, \dots)$.
Question: I've often seen that people say "let $x$ be a symbol" in the formal definition and go on saying that they denote the set that I call $R$ by $K[x]$. I don't understand this, because in the formal definition there does never occur any variable $x$! Is the notation $K[x]$ chosen just for psychological reasons (like: "we think of the elements as being polynomial expressions that contain variables")? Or is $x$ treated as a parameter in the definition: "for every given field $K$ and every symbol $x$ we define $K[x]$ to be …". But in this case: what is a "variable"? and why doesn't the definition of $K[x]$ contain an $x$?

A: In your definition, $x$ is simply the sequence $(0,1,0,\ldots,0,\ldots)$.
Some computations leads to: $$x^k=(\delta_{i,k+1})_{i\in\mathbb{N}}=(0,\ldots,0,1,0,\ldots).$$
Namely, $x^k$ is the sequence with zeroes everywhere except at the $(k+1)$ position. Notice that any sequence of $R$ can be written as a finite linear combination over $K$ of elements in $\{x^k\}_{k\in\mathbb{N}}$. This fact is written: $$R=K[x].$$


text:
Q: How to set a libgdx livewallpaper screen orientation only in portrait mode? I am creating an Android Live Wallpaper with Libgdx , It is just a circle on the screen which gets a random color and position and it slowly moves up . The issue is I want the program only in portrait mode but when i turn my phone it goes into landscape mode.
I have already tried changing the manifest file orientation to protrait
android:screenOrientation="Portrait", and placing
this.setRequestOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in Android Launcher Class but nothing is working
Android Launcher Class
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new CoreLWP(), config);
     }
    }

Live Wallpaper class
public class LiveWallpaper  extends AndroidLiveWallpaperService {

public CoreLWP wallpaper;

@Override
public void onCreateApplication () {
super.onCreateApplication();

final AndroidApplicationConfiguration config = new    AndroidApplicationConfiguration();

this.wallpaper = new CoreLWP();
initialize(this.wallpaper, config);

  }
}

Core Live Wallpaper class
public class CoreLWP extends ApplicationAdapter implements ApplicationListener, AndroidWallpaperListener {

private ShapeRenderer ball;
private float x,y;
private Random random;

private float r,g,b;

@Override
public void create () {
ball = new ShapeRenderer();
random = new Random();

//generating random position
x = random.nextInt(Gdx.graphics.getWidth());
y = random.nextInt(Gdx.graphics.getHeight());

 //generating random rgb values
 r = getFloatRandomNum(0, 1) ;
 g = getFloatRandomNum(0, 1) ;
 b = getFloatRandomNum(0, 1) ;
 }

   @Override
    public void render () {

//setting the background
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

//updating x and y position
x = x + 0.5f;
y = y + 0.6f;

ball.begin(ShapeRenderer.ShapeType.Filled);
ball.setColor(r,g,b,1);
ball.circle(x,y,100);
ball.end();

}

//returns a random float number between a range
private float getFloatRandomNum(float min, float max) {
float random = min + new Random().nextFloat() * (max - min);
return random;
}

@Override
public void dispose () {
ball.dispose();
}

@Override
public void offsetChange(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset) {}

@Override
public void previewStateChange(boolean isPreview) {}

@Override
public void iconDropped(int x, int y) {}
}

Is it possible to do so . To fix the orientation only to portrait for the live wallpaper