text:
Q: A fish\Two fish\Two fishes Do I understand the next right?
I caught a fish
It will mean I just caught some fish in quantity of one.
I caugh two fish
Means I caught two fish that are of the same species
I caught two fishes
I caught some indefinite amount of fish of two different species.

A: If I heard someone say "I caught two fishes", I would assume that they mean "I caught two individual fish" and that they're deliberately speaking in a childlike way by using the wrong plural of the word "fish".
If someone wanted to say that they caught some indefinite amount of fish of two different species, they would probably say, "I caught two different kinds of fish."
It wouldn't be completely wrong to say "I caught two fishes" to mean "I caught two different kinds of fish" (since "fishes" does, in fact, mean "kinds of fish"), but it would be a very cryptic way of speaking.

A: Your first two interpretations are right, but your third isn't.
I guess you are thinking of the pattern where most uncountables can be made plural to convey "types of thing": like "I tasted three wines".
Unfortunately, fish doesn't work like that. Fish is countable in this context, and has a plural; it's just that the usual plural is the same as the singular (often the case for animals, cf sheep, deer). Fishes is just a less common variant for the plural.
So I caught two fishes sounds odd (perhaps baby-talk) but means the same as I caught two fish. Nobody would think you meant two different kinds of fish.
(Fish can also be uncountable, like many foodstuffs: I had some fish: it was delicious; but I think it would be unusual to use fishes in that context to mean "types of fish" either).

A: I asked the same thing before. , the answer said,

Fish is certainly the most common and arguably correct plural of the word "fish". However, "fishes" is an archaic plural form, and is apparently also used in some situations which I will go on to explain.
An example of the archaic use of "fishes" as plural is the biblical account of a miracle involving "five loaves and two fishes". Actually modern English translations of this use "fish" as the plural, but people of a certain age were taught this in school from the King James version (1611) and as a result many people still refer to this as the miracle involving "five loaves and two fishes"! This idiom may even have been passed on to younger generations.
The collective term for fish is a school, or shoal. You would correctly refer to a school of fish - not "fishes".
However, I found this use of "fishes" as a plural in a scientific textbook from 1968. The book is even titled "Deep Water Fishes of California"!
Unless a marine biologist here can advise otherwise, it would seem that it is also acceptable to use fishes when referring to more than one type of fish, although it should equally be correct to say "different types of fish".

FYI.

A: Well, the first two are right, but the third is (technically) wrong. The only people that really ever say "fishes" are scientists, and even they dont say it all the time. Its like deer and moose. They can mean singular or plural depending on the other words used in the sentence.
I saw a moose. The letter "a" tells us that the next word is singular.
I saw some moose or I saw a lot of moose is plural, because the words in front of moose modify it to go from singular to plural.
So, in your example, if you wanted to tell someone you caught 2 different species of fish, you would say I caught 2 different fish and if you caught multiple fish, and it doesnt matter if the difference is specified, you could say I caught some fish.


text:
Q: Compilation error on prefix header with Xcode 5.0 I'm attempting to compile my project which compiled fine with the iOS 6 SDK & Xcode 4.x, however with Xcode 5 & iOS 7 SDK, I'm getting a prefix header error, below:
clang: error: no such file or directory:'/Users/.../IOS/Dependencies/RestKit/Code/Support/RestKit-Prefix.pch'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Everything seems to be fine, other than compiling a subproject, RestKit with the app.
I've tried cleaning the project, and the build folders but to no avail.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Using CMake, how do I identify the dependant of a target I have a library which builds as multiple flavours. These different flavours (combinations of GUI/CLI and shared/static) were incomplete and inconsistently named. In fixing this, the original target names are no longer used.
The library is brought in as an external to many other projects. In order to avoid upsetting people and confusing the hell out of them I have created "dummy" targets using the original names that output a useful error message. I have also set the EXCLUDE_FROM_ALL property so that these dummy targets will only get built if they are explicitly used somewhere.
add_library(Utilities STATIC IMPORTED GLOBAL)
set_target_properties(Utilities PROPERTIES
    IMPORTED_LOCATION "${CMAKE_CURRENT_BUILD_DIR}/Utilities.warning"
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/inc"
    EXCLUDE_FROM_ALL TRUE
)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BUILD_DIR}/Utilities.warning"
    COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "The 'Utilities' target has been replaced by 'Utilities_shared'. Please update your CMakeLists.txt."
    COMMAND ${CMAKE_COMMAND} -E false
)
add_custom_target(Utilities_fail DEPENDS "${CMAKE_CURRENT_BUILD_DIR}/Utilities.warning")
add_dependencies(Utilities Utilities_fail)

So far so good, it all works well...except that when one of these dummy targets is hit, I don't know where it is being included from. Our projects include many libraries, some of which also use this specific library. I would like to update the error message that is printed to identify which CMakeLists.txt needs to be updated. E.g.:
The 'Utilities' target has been replaced by 'Utilities_shared'. Please update the 'other_library' CMakeLists.txt.

or even:
The 'Utilities' target has been replaced by 'Utilities_shared'. Please update /home/Me/Work/MyProject/libs/OtherLib/CMakeLists.txt.

Is there a CMake generator expression, or some other way, that I can identify the "ancestor" target that this target is a dependency of? If it is included in multiple places I only really care about the "first" one.


text:
Q: Save userinformation (username, age, etc) in Server.Cache instead of fetching from db When a user login to my site I fetch some information about that user from the db:

*

*UserID

*Username

*Email

*etc

This information is then saved into FormsAuthentication with .SetAuthCookie.
Is this the fastest way to do this or what If I change so the information gets saved into System.Cache?

A:
or what If I change so the information gets saved into System.Cache?

Then all users of your website will share the same information. So you totally don't want to be storing user specific information into the Cache. The userData portion of the FormsAuthentication cookie seems like an excellent place to store some user specific information which is used on all pages to avoid hitting your database on each page. Some people might also recommend you using the Session but I am not part of those people.


text:
Q: How do I fix a div during scroll relative to Squarespace image blocks? I'm trying to fade in/out and fix the blue div on the left when scrolled relative to the image blocks on the right.
http://www.warface.co.uk/#/testing/
pass: squared
.meta { /*This is the block I'm trying to stick/*
    background: blue;
    position: fixed;
    width: 372px;
    float: left;
    z-index: 3;
    right: 100%;
}

A: Here is the basics in JavaScript:
function controlMeta() {
    var meta = document.querySelector("div.meta");
    console.log(meta);
    if (window.scrollY > 500) {
        meta.style.display = "none";
    } else {
        meta.style.display = "block";
    }
}

window.addEventListener("scroll", function () {
    controlMeta();
})

You can get your elements scroll position with something like this:
document.getElementById("57513a9220c6475fb77061c5").getBoundingClientRect().top+window.scrollY

EDIT 1
Here is a method for associating elements with the meta box, based upon the previous:
//Load elements that affect the meta box
var meta = [];
var images = document.querySelector('.sqs-gallery').getElementsByTagName('img');
for (var i = 0; i < images.length; i++) {
    meta.push({
        node : images[i],
        height : images[i].height,
        //top is used with scroll position to determine which element we are looking at
        top : images[i].getBoundingClientRect().top + window.scrollY
    });
}
function controlMeta() {
    meta.filter(function (el) {
        //You might need to pad your filter a little
        return window.scrollY < el.top && window.scrollY > el.top - el.height;
    }).forEach(function (el) {
        //These are the matching elements. I'm just fetching the src as an example
        document.querySelector("div.meta div.body").innerHTML = el.node.src;
    });
}
window.addEventListener("scroll", function () {
    controlMeta();
});


text:
Q: Limit Frame per second Hi all I'm attempting to limit my FPS to 30 with the below code, but I'm not sure it's working.
while (runthread){

            c = null;
            timestart = System.currentTimeMillis();                         //Get time at start of loop for FPS calc

            try{
            c=mySurfaceHolder.lockCanvas();                                 //Set c (Canvas) to locked

            synchronized(mySurfaceHolder){
            framesskipped = 0;                                              // resetting frames skipped (as this is about to render to the screen, the frames skipped variable is only incremented when the onDraw() method is skipped, once it's run, reset it back to 0 for the next count
            doDraw(c);                                                      //Draw game world
            updateMenu();  //Update game logic

            }
            }
            finally{
                if (c != null){

                mySurfaceHolder.unlockCanvasAndPost(c);                     //Unlock and post

                }
            }

            //work out timings

                timeend = System.currentTimeMillis();                       //get end time for current frame (for FPS)
                frametime = timeend-timestart;                              //Set the frametime variable to the time the frame took to render & update (end time - start time)
                sleepfor = (int) (30.3030303030303-frametime);              // this is the time that the thread will sleep for if <target time (1000/33 = apx. 30FPS

                if (sleepfor>0){                                            // If the 'sleepfor' variable is >0 then set the thread to sleep for it's value (expressed in milliseconds)

                    try {
                        MainThread.sleep(sleepfor);                         //send thread to sleep for value of sleepfor (determined above).

                    } catch (InterruptedException e) {}                     //in case of exception
                }                                                           //close if statement

                    while (sleepfor<0 && framesskipped<maxframesskipped){   //if sleepfor is < 0 (ie, frame took longer to render than target time and the maxframesskipped has not reached it's limit)
                        updateMenu();                                       //Update game logic only
                        sleepfor+=33;                                       //time to sleep plus the time frame took to render
                        framesskipped++;                                    //add one to framesskipped variable so this only skips a certain number of frames
                        frame=0;
                        }

Output from my logging that I place in my onDraw method.

As you can see, it doesn't look to be limiting to 30fps, I'm not sure why, my figures must be wrong.
Secondly, anyone have any ideas why my frame count drops down to as low as 5 every now and then?!
Thank you

A: I found out what the problem was:
sleepfor = (int) (30.3030303030303-frametime);

Should have been
sleepfor = (int) ((1000/fps)-frametime);

so
    sleepfor = (int) (33.3333333-frametime);
Changed it and it runs pretty good at 30 / 31 fps


text:
Q: Problems with Continuous Integration (CI) in TFS during Build Automation? I am using TFS 2008 and Visual Studio and my boss has instructed me to implement Build Automation for Development and Release builds for a web Project.
I am a total newbie in Build Automation.
There are multiple developers working on the project on different machines using Visual Studio 2008 team System. Source is already being maintained on TFS 2008. SQL Server in Use is SQL Server 2000 and hosted IIS is IIS 7.5 on Windows Server 2008 x64.
I have searched over the net and found Continuous Integration and Nightly Builds as two important Build Automation techniques.
I was just wondering of any disadvantages associated with both the methodologies (CI and Nightly Builds).
If someone could guide me to a working tutorial that explains both techniques the it would be quite helpful.
Please also tell the requirements of IIS, SQL Server and any other that might be pre-requisite to implement build automation.
Also i would like to know whether there are other techniques that are better then CI?
Replies and discussion much appreciated.
Thanks

A: There are no real disadvantages, except that with CI your server will be busier.
The reasons for these builds are:
NB: Every morning you have a fully built release installer that you can test. You know all your code builds, and every day you have a release "ready" that you could send out if you wanted to. This is much better than having a programmer spend a day running through a "how to build a release" document step by step to create an installer every time you're ready to release a new version! And your testers are able to test a complete release package, so you have confidence that every part of your release and installation process works as it's getting a daily workout.
CI: This is just a fast build that runs every time someone checks in. It tells you if you check in non-compiling code, so that the author can fix the problem immediately and minimise disruption to other team members. You can waste a lot of time when 4 or 5 programmers get the latest code and then find they can't do any work for 2 hours until Fred fixes his bad checkin. Knowing about a broken net allows your programmers to avoid doing a Get unless the code has been verified as working.
To implement NBs and CI you first need to get a build that will run on your server.

*

*If you have a running TFS, then to create a build server you just need to install your dev tools (VS2008 and anything else needed to build the code, such as 3rd party libraries/build tools etc) as if it is a developer PC, and it's ready to use as a build server. Just right click on the Builds folder and "Create new build" and you should be able to figure out most of it as you go. You have to give it a name, set up the workspace mappings to tell it where to build the code, and set up an output folder for the results to be "dropped" into, and you'll be good to go.

*You may need to tweak the setup of your projects to make this work well e.g. developers are terrible at putting references to "C:\Projects..." in their solutions, which often break when the project moves onto the D: drive of a buid server, etc. Also, rather annoyingly the build server will build code into different locations than your dev PCs, so you may find parts of the build process will break and you will have to reconfigure things like fixed locations for references etc so that they work on both Build and Dev machines.

*Add as much of the process as you can (clean, get code, build it, run unit tests, obfuscate binaries, sign binaries, build installers, sign installers, copy to deployment folder) automated so that the NB can build everything and you get a fully releasable product at the press of a single button. Computers are good at this stuff, so don't leave an error-prone and expensive to run human slaving away all day to make an installer!

*Set the NB up to do a full rebuild (this should be the case by default) and use the Triggers settings to have it run every weeknight at (e.g.) 1am. The NB should build everything (a good, thorough build).

*Copy the NB build settings to make a CI build. In the MSBuild project file, set these properties: IncrementalGet=true, IncrementalBuild=true, ForceGet=false. This will convert it to a fast incremental build. In the Workspace Mapping, Cloak or remove as many folders as possible to minimise the amount of code it Gets from source control, to help keep it fast. Set the build to only build one variant (e.g. Release) so it'll be a quick build. In the Triggers (right click on the build and edit it), set it to build whenever there is a checkin.

*Run the build monitor on all dev machines. This places an icon in your icon tray and give you optional notifications whenever builds start, complete, and fail. If your CI build fails you will then know about it immediately.
Now, you should have a nightly build ready for testing every morning, and whenever anyone checks in any changes, a new incremental build will kick off, and you'll know within a few minutes if you have broken the codebase in source control.
(We have a third build, which is an incremental Test build. This is the same as the CI build, but it runs all our unit tests as well. This is executed nightly, and developers can trigger it whenever they wish to verify the codebase on the server (we use this as a gating mechanism before promoting to a the test branch). It's a lot slower than the CI test, which is why it's not used for the CI build - you want the CI build to finish as fast as possible)
Note: To make the CI work, you will sometimes need to do a full rebuild. In the "Queue Build" dialog, enter these command line options to force this:
/p:IncrementalGet=false;ForceGet=true;IncrementalBuild=false

There aren't any techniques that are "better" than CI. You can (and should) use CI in addition to all other processes you implement.


text:
Q: Convert time from hours to minutes with Linq? I've done a lot of searching and can't quite find what I'm trying to accomplish. When using Linq - Entities I'm get the difference between the UTC time an a value in the database that is the estimate of when something should leave. I think the subtraction of my ETO subtracted from UTC is working correctly however I need to convert it to minutes. The current subtraction (due to it being a DateTime) is being display in hours and minutes but I need to display as 240 instead of 2:00 for a two hour difference.
The problem is that I'm getting an error when I try to divide my results by 60 or try to format using .ToString(@"mm"). When I try to multiple by 1440 (mins in a 24 hr period) I get an error can't convert system.TimeSpan to Double. If I try not to cast to a double I get an error that an operand of "*" can't be applied to a TimeSpan. Trying to set it to .ToString(@"mm") it tells me there is no overload for .ToString.
Here is my select on a query. Currently my MinutesLeft is being displayed as 02:32:38.7914913 for 2 hours, 32 min, 38 secs.
    select new
                    {
                        EstimateOut=f.ESTIMATED_OUT,
                        UTC=DateTime.UtcNow,
                        MinutesLeft=(DateTime.UtcNow - f.ESTIMATED_OUT),
                        //MinutesLeft=(double)(DateTime.Now - f.ESTIMATED_OUT)*1440,
//MinutesLeft=(DateTime.Now - f.ESTIMATED_OUT)*1440,
                    }).ToList();

A: You can use the property TotalMinutes to get your result:
MinutesLeft = (DateTime.UtcNow - f.ESTIMATED_OUT).TotalMinutes;

The value you get is a nullable type. You can access it this way:
MinutesLeft = (DateTime.UtcNow - f.ESTIMATED_OUT).Value.TotalMinutes;

Since nullable types can be null, you should make sure that it does have value:
TimeSpan? t = (DateTime.UtcNow - f.ESTIMATED_OUT);
var MinutesLeft = t.HasValue? t.Value.TotalMinutes : -1;

A: During my initial testing of this query I was using LinqPad set to "C# Statements". Now I'm actually applying this in my MVC project and I'm coming up with an error with the AddMinutes portion. The error says "LINQ to Entities does not recognize the method 'System.DateTime AddMinutes(double)' method, and this method cannot be translated to a store expression'.
So I have a few questions. I searched on this error and found some posts saying I should be using something like this System.Data.Entity.DbFunctions.AddMinutes("DATETIMEHERE", 180). However, when I add this in LinqPad I get "DbFunctions does not exist in the namespace". When I add it to the query in the MVC project I get basically the same message. So far I haven't found anything to help address that message. Do I need to add a reference to something from NuGet? I've already installed EntityFramework through NuGet.
Second question, would the following statement be correct once I get all the references done correctly?
ETD=System.Data.Entity.DbFunctions.AddMinutes(f.ESTIMATED_OUT, f.OFFSET_DEP_TIME_MINS + (f.OFFSET_DEP_TIME_MINS/1440))


text:
Q: MVC Model Binding Limitation I have a question regarding Model Binding in MVC
Say I have a simple POCO like below.
public class Person
{
    public Title Title { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public bool LeadPassenger { get; set; }
}

I have a controller that passes a collection of Persons to a View and within that View I want to render a radio button to allow the user to select the LeadPassenger from the collection of Persons.
Now, for this to work (and only one radio button be selected at a time) all the "LeadPassenger" radio buttons must share the same name. But this seems to be impossible using the Model Binding conventions whereby each control is named after each property of the item in the collection.
<input id="Passengers_0_LeadPassenger " name="PolicyMembers[0].LeadPassenger" type="radio" value="true" />
<input id="Passengers_1_LeadPassenger " name="PolicyMembers[1].LeadPassenger" type="radio" value="false" />

How do I get round this limitation? I could use jQuery to force all the radio buttons to switch off when one is selected but that seems to be a 'fudge'!
Any ideas?

A: The trick here is the task you are trying to accomplish isn't really something for model binding, which isn't really aware of data outside it's "row" so to speak. What you want to do here is introduce a new field for lead passenger selection, binding the value to the unique identifier for person and the name to the same thing. Then pick it up as a separate variable in your controller and map it from there.


text:
Q: Count icosahedron edge colorings How many ways are there to color the edges of an icosahedron in five colors so that any two adjacent edges have different colors? Equivalently, any vertex has incident edges of all five colors.
The answer is given in the article at Mathpages (http://www.mathpages.com/home/kmath095.htm), however, the author does not describe in detail how they have arrived at it. My guess is that it was done by exhaustive computer search.
I wonder, are there more clever solutions to this problem?


text:
Q: How to show csv file data into primefaces datatable? For example I have a csv file like this:
column1,column2,column3,column4
1,one,un,eins
2,two,deux,zwei
3,three,trois,drei
4,four,quattre,four
5,five,cinque,fuenf
6,six,six,sechs
7,seven,sept,sieben
8,eight,huit,acht
9,nine,neuf,neun
10,ten,dix,zehn

But the number of columns will change as I have multiple csv files. So I have used this dynamic columns and I have successfully displayed the column header of some random csv files but I am unable to display the data of the columns into primefaces data table. How I can display the content of the file?
.xhtml:
<p:dataTable var="attr"  value="#{newClass.a_name2}" scrollable="true" scrollWidth="50%" scrollHeight="150">
       <p:columns  width="125" value="#{newClass.columns}" var="column" >
            <f:facet name="header">
                <h:outputText value="#{column.header}" />
            </f:facet>
            <h:outputText value="#{attr[column.property]}" />
        </p:columns>
 </p:dataTable>

bean :
@ManagedBean
@ViewScoped
public class NewClass implements Serializable{
private List<Attribute> a_name2;
private List<ColumnModel> columns;
private String columnTemplate;

public void settingValue {
//csv file
columnTemplate=;//setting column names.
a_name2=createFile(numberofRowsinCsvFile);
createDynamicColumns();
}
private void createDynamicColumns() {
        String[] columnKeys = getColumnTemplate().split("\t");
        columns = new ArrayList<ColumnModel>();
        for(String columnKey : columnKeys) {
         columns.add(new ColumnModel(columnKey.toUpperCase(),columnKey));
        }
}

public String getColumnTemplate() {
        return columnTemplate;
    }

public void setColumnTemplate(String columnTemplate) {
        this.columnTemplate = columnTemplate;
    }
public List<ColumnModel> getColumns() {
        return columns;
    }
public void setColumns(List<ColumnModel> columns) {
        this.columns = columns;
    }
public List<Attribute> getA_name2() {
        return a_name2;
    }

 public void setA_name2(List<Attribute> a_name2) {
        this.a_name2 = a_name2;
 }
 public List createFile(int size) {
        List list = new ArrayList();
        for(int i = 0 ; i < size ; i++) {
          list.add(i);
 }

        return list;
 }
static public class ColumnModel implements Serializable {

        private String header;
        private String property;

        public ColumnModel(String header, String property) {
            this.header = header;
            this.property = property;
        }

        public String getHeader() {
            return header;
        }

        public String getProperty() {
            return property;
        }
    }

}

I am getting an error:
javax.el.PropertyNotFoundException: /index.xhtml @53,70 value="#{attr[column.property]}": The class 'java.lang.Integer' does not have the property 'outlook'.


text:
Q: How to make a box with a height based on multiples of the current line height How can I create (in XeLaTeX) a box that has a defined height in multiples of lines that keeps this size 100% without any additional spacings?
Please see the following MWE:
\documentclass{article}

\usepackage{lipsum}
\usepackage{multicol}

\newcommand{\mybox}[2]{\parbox[t][#1\baselineskip]{\columnwidth}{#2}}

\begin{document}
\begin{multicols}{2}\raggedcolumns

\lipsum[1]
\mybox{3}{Some more text}
\lipsum[2-8]

\end{multicols}
\end{document}

The mybox should create a 3-line box. However, after that box, the base lines seem to be off ~1pt if compared to the right column. I've tried a lot of different types of boxes, spacers, minipages and such, and have not yet a solution. Often the box has the correct height, but it does not properly fit into the surrounding, throwing baseline-alignment in the other column off.
In the solution I look for, the first priority should be exact height, no matter what happens inside or right next to the box. The box might contain text, but also images or maybe small tables - it's purpose is to create a reliable "reserved space". Or, to be more precise, the base lines in both columns before and after the box should always stay aligned. If odd fonts are used with artistic overlength letters (both upwards and downwards, like in handwriting), the box should not make space for that. If more content is in the box than there is space, it's ok to either crop or to overflow into the surrounding, or if it looks odd what happens inside the box, but the specified hight in lines must be enforced. Also, the solution should not require hardcoded values (like point sizes for line heights, skips or spacing) but work with any text/font size that is currently in use.

A: You have to disable the interline skip after the \parbox:
\documentclass{article}
\usepackage[latin]{babel} % just to avoid over or underfull boxes

\usepackage{lipsum}
\usepackage{multicol}

\newcommand{\mybox}[2]{%
  \par\noindent
  \parbox[t][#1\baselineskip][t]{\columnwidth}{#2}%
  \par\nointerlineskip
  \noindent\ignorespaces
}

\begin{document}
\begin{multicols}{2}\raggedcolumns

\lipsum[2]
\mybox{3}{\bfseries Some more text that wraps to the following line}
\lipsum[3-5]

\end{multicols}
\end{document}

A: A different approach:
\documentclass{article}

\usepackage{lipsum}
\usepackage{multicol}

\newcommand{\myfixedsizepar}[1]{\par
   \def\x{\par\vskip-\prevgraf\baselineskip\vskip#1\baselineskip}%
   \bgroup\aftergroup\x\let\next=}

\begin{document}\thispagestyle{empty}

\begin{multicols}{2}\raggedcolumns

\lipsum[1]
\myfixedsizepar{3}{Some more text some more text on three lines}
\lipsum[2]
\myfixedsizepar{5}{Some more text some more text on five lines}
\lipsum[3]

\end{multicols}
\end{document}

And, here is a variant (possibly useful in another context) which adjusts the height only if it is less than the asked-for minimal number of times the baselineskip:
\newcommand{\myminimumsizepar}[1]{\par
   \def\x{\par
   \ifnum\prevgraf<#1 \vskip-\prevgraf\baselineskip\vskip#1\baselineskip\fi}%
   \bgroup\aftergroup\x\let\next=}


text:
Q: Trigger SharePoint Online List Workflow 2010 using the REST API I am trying to trigger the SharePoint online List 2010 workflow.
But some how the I am able to trigger the 2013 workflow using the below code sample
Please help with how can i start the 2010 Workflow by using the Rest API of the by using the csom
    //StartWorkflow
    function Start2013WFRestAPI(subscriptionId, itemID, workflowParams) {

        var restURL = _spPageContextInfo.webAbsoluteUrl + "/_api/SP.WorkflowServices.WorkflowInstanceService.Current/StartWorkflowOnListItemBySubscriptionId(subscriptionId='" + subscriptionId+ "',itemId='" + itemID + "')";

        $.ajax({
                 url: restURL,
                 type: "POST",
                 contentType: "application/json;odata=verbose",
                 headers: {
                      "Accept": "application/json;odata=verbose",
                      "X-RequestDigest": $("#__REQUESTDIGEST").val()
                 },
                 success: function (data) {
                    alert('Workflow Trigger Successfully');

                 },
                 error: function (data) {
                     alert("Error");
                 }
        });

    }

Thanks in advance.


text:
Q: Adding a UISearchBar to a UIActionSheet in an iOS app I'm having some trouble implementing a design for an app I'm building. The design shows a UIActionSheet menu with a search bar at the top. When someone enters in text into the search bar, the menu goes away and is replaced by a table view containing search results. (The search results display in a similar style to when you slide all the way left on your home screen to search on your iPhone / iPod)
Here's essentially what I'm trying to pull off:

Here's the code I have:
// build menu
UIActionSheet* menu = [[UIActionSheet alloc] initWithTitle:@""
                      delegate:self
                      cancelButtonTitle:@"Cancel"
                      destructiveButtonTitle:nil
                      otherButtonTitles:@"Button 1",@"Button 2",@"Button 3",nil];

[menu showInView:self.view];

UISearchBar *searcher = [[UISearchBar alloc] initWithFrame: CGRectMake (0, -216, 320, 44)];
searcher.delegate = self;

// use transparent background
[[searcher.subviews objectAtIndex:0] removeFromSuperview];

[menu addSubview:searcher];

When I run this, it is as though the search bar is disabled. You cannot click on it or open up a keyboard. If I change the vertical position of the search bar from -216 to 0, I can click on it and bring up a keyboard, but I'm unable to type anything.
I'm a little confused about how I can implement this. Any ideas? I'm using Xcode 4.4 with ARC and storyboards.

A: That's how UIActionSheet objects work. Do something else instead, like sliding up a UIView.
From the Apple iOS Human Interface Guidelines:

Use an action sheet to:

*

*Provide alternate ways a task can be completed. An action sheet allows
you to provide a range of choices that make sense in the context of
the current task, without giving these choices a permanent place in
the user interface.

*Get confirmation before completing a potentially
dangerous task. An action sheet prompts users to think about the
potentially dangerous effects of the step they're about to take and
gives them some alternatives. This type of communication is
particularly important on iOS-based devices because sometimes users
tap controls without meaning to.


text:
Q: Using git commit -a with vim I'm new with git, so I decided to learn git using the tutorials of github. The third chapter said:

"For this first example we'll modify the README file to add ourselves as an author on the project. So we simply edit the file. Now we want to commit that change, so we run the git commit -a command."

When I use the git commit -a command, the console opens a vim and I wrote my message, but I don't know how to close this vim editor from the console. How do I save the message and close vim?

A: The better question is: How do I interrupt the commit when I quit vim?
There are 2 ways:

*

*:cq or :cquit

*Delete all lines of the commit message, including comments, and then :wq
Either way will give git an error code, so it will not proceed with the commit. This is particularly useful with git commit --amend.

A: Instead of trying to learn vim, use a different easier editor (like nano, for example).
As much as I like vim, I do not think using it in this case is the  solution. It takes dedication and time to master it.
git config core.editor "nano"

A: Try ZZ to save and close.
Here is a bit more info on using vim with Git

A: *

*In vim, you save a file with :wEnter while in the normal mode (you get to the normal mode by pressing Esc).

*You close your file with :q while in the normal mode.

You can combine both these actions and do Esc:wqEnter to save the commit and quit vim.
As an alternate to the above, you can also press ZZ while in the normal mode, which will save the file and exit vim. This is also easier for some people as it's the same key pressed twice.

A: See this thread for an explanation: VIM for Windows - What do I type to save and exit from a file?
As I wrote there: to learn Vimming, you could use one of the quick reference cards:

*

*http://bullium.com/support/vim.html

*http://tnerual.eriogerg.free.fr/vim.html
Also note How can I set up an editor to work with Git on Windows? if you're not comfortable in using Vim but want to use another editor for your commit messages.
If your commit message is not too long, you could also type
git commit -a -m "your message here"

A: To exit hitting :q will let you quit.
If you want to quit without saving you can hit :q!
A google search on "vim cheatsheet" can provide you with a reference you should print out with a collection of quick shortcuts.
http://www.fprintf.net/vimCheatSheet.html

A: Bro use these steps
First step
tap on Esc -for to come out from insert writing mode
Second step
Press shift+;
Third Step
At last write wq and hit enter
Wq is use for to save and exit


text:
Q: Set foreign column to NULL when related row is deleted I have users with two optional pictures (don't worry about the logic, the names have been changed to protect the innocent):
CREATE TABLE users (
    id INT(10) NOT NULL AUTO_INCREMENT,
    first_name VARCHAR(255),
    last_name VARCHAR(255),
    first_picture_id INT(10) NULL DEFAULT NULL,
    second_picture_id INT(10) NULL DEFAULT NULL,
    PRIMARY KEY (id),
    CONSTRAINT FK_users_second_picture_id FOREIGN KEY (second_picture_id) REFERENCES pictures (id),
    CONSTRAINT FK_users_first_picture_id FOREIGN KEY (first_picture_id) REFERENCES pictures (id)
);

CREATE TABLE pictures (
    id INT(10) NOT NULL AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    path VARCHAR(255) NOT NULL,
    type VARCHAR(255) NOT NULL,
    PRIMARY KEY (id)
);

I've linked my models this way (I hope that part's correct):
class User extends AppModel{
    public $belongsTo = array(
        'FirstPicture' => array(
            'className' => 'Picture',
            'foreignKey' => 'first_picture_id',
        ),
        'SecondPicture' => array(
            'className' => 'Picture',
            'foreignKey' => 'second_picture_id',
        ),
    );
}

class Picture extends AppModel{
    public $hasOne = array(
        'User',
    );
}

Now, when I remove either picture:
$this->FirstPicture->delete($this->request->data('FirstPicture.id'));

...  I want to set the corresponding column in user set to NULL.
What'd be the CakePHP idiom (if any) to replicate an ON DELETE SET NULL foreign key deletion?

A: There is no functionality built into CakePHP 2.x that would automatically do that, you'd have to implement that on your own. Whenever possible it would be advised to use actual foreign key constraints in your database, but if that's not possible, then you don't really have much options here.
It should be easy enough doing that in the beforeDelete or afterDelete events/callbacks. If your database supports transactions (and your app uses them - they don't happen automatically for delete operations), then beforeDelete is advised as it can easily stop the deletion process. Without transactions, it would depend on what you like better in an error scenario, nulled foreign keys without the associated records being deleted (beforeDelete), or deleted associated records with non-nulled foreign keys (afterDelete).
Here's a simple example, you could do it from either side of the association, Picture:
public function beforeDelete($cascade = true) {
    if (!parent::beforeDelete($cascade)) {
        return false;
    }

    $result = $this->User->updateAll(
        array('first_picture_id' => null),
        array('first_picture_id' => $this->getID())
    );
    if (!$result) {
        return false;
    }

    $result = $this->User->updateAll(
        array('second_picture_id' => null),
        array('second_picture_id' => $this->getID())
    );
    if (!$result) {
        return false;
    }

    return true;
}

or User:
public function __construct($id = false, $table = null, $ds = null)
{
    parent::__construct($id, $table, $ds);

    $this->FirstPicture->getEventManager()->attach(
        function () {
            return $this->updateAll(
                array('first_picture_id' => null),
                array('first_picture_id' => $this->FirstPicture->getID())
            );
        },
        'Model.beforeDelete'
    );

    $this->SecondPicture->getEventManager()->attach(
        function () {
            return $this->updateAll(
                array('second_picture_id' => null),
                array('second_picture_id' => $this->SecondPicture->getID())
            );
        },
        'Model.beforeDelete'
    );
}


text:
Q: how to remove popup on execution of a setup command line powershell when i start this exe
Start-Process -FilePath 'c:\temp\chrome_installer.exe' -ArgumentList '/silent', '/install'
I see a popup asking to run how can suppress this ?
i get a popup asking to run or cancel
is there a way to remove this ?
Regards

A: Without a actual screenshot of the exact popup that is appearing we honestly can only guess at an answer, however, based on experience its most likely because the file is not trusted.
If this is the popup then you can do one of the following things.
PowerShell: use the unblock-file command.
Manual: Right-click the executable, select properties, and check the 'unblock' checkbox and click ok.
Full tutorial: https://winaero.com/how-to-unblock-files-downloaded-from-internet-in-windows-10/


text:
Q: How to iterate through a directory and sub-directories using a URL I'm trying to iterate through files in a directory and files in sub-directories within:
<?php

$dir = get_stylesheet_directory_uri() . '/js';

echo $dir;

$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::SELF_FIRST );

foreach ( $iterator as $path ) {
    if ($path->isDir()) {
        print('
 DIR : ' . $path . PHP_EOL . "
");
    } else {
        $path_parts = pathinfo($path);
        $file_parts = $path_parts['extension'];
        if ($file_parts == "js")
        {
            $array = explode("/opt/lampp/htdocs", $path);
            unset($array[0]);
            echo $path = implode("/", $array);
            print("
http://localhost$path" . PHP_EOL . "
");
            echo("");
        } else if ($file_parts == "css") {
            echo("");
            echo("<link rel='stylesheet' href='http://localhost/$path'>");
        }
    }
}

?>

I, however, get the error:
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(http://localhost/projects/wordpress_projects/wp-content/themes/rev_cust/js): failed to open dir: not implemented in /opt/lampp/htdocs/projects/wordpress_projects/wp-content/themes/rev_cust/header.php:40

echo $dir; gives:

http://localhost/projects/wordpress_projects/wp-content/themes/rev_cust/js

The StackTrace:
Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(http://localhost/projects/wordpress_projects/wp-content/themes/rev_cust/js): failed to open dir: not implemented in /opt/lampp/htdocs/projects/wordpress_projects/wp-content/themes/rev_cust/header.php:40 Stack trace: #0 /opt/lampp/htdocs/projects/wordpress_projects/wp-content/themes/rev_cust/header.php(40): RecursiveDirectoryIterator->__construct('http://localhos...') #1 /opt/lampp/htdocs/projects/wordpress_projects/wp-includes/template.php(684): require_once('/opt/lampp/htdo...') #2 /opt/lampp/htdocs/projects/wordpress_projects/wp-includes/template.php(643): load_template('/opt/lampp/htdo...', true) #3 /opt/lampp/htdocs/projects/wordpress_projects/wp-includes/general-template.php(45): locate_template(Array, true) #4 /opt/lampp/htdocs/projects/wordpress_projects/wp-content/themes/rev_cust/index.php(18): get_header() #5 /opt/lampp/htdocs/pro in /opt/lampp/htdocs/projects/wordpress_projects/wp-content/themes/rev_cust/header.php on line 40

How can I fix it and make it work right?
Thank you all in advance.

A: RecursiveDirectoryIterator::__construct expects a path not a uri. To fix this try:
$dir = get_stylesheet_directory() . '/js'; // This gives you a path instead

A: You are passing an URL, while you have to pass a path.
Check it here: http://php.net/manual/en/class.recursivedirectoryiterator.php


text:
Q: Use Date from JSON data in scalelog in d3v4 I am trying to use the date I get from my JSON data on the X-Axis using the ScaleLog. Like this one https://bl.ocks.org/andrewdblevins/f4ea65f70dbcb34abc1e4c3d75cfa142 only for time. I have a setting on my chart that is supposed to show a year's worth of data on the X-Axis.
My Code:
var svg = d3.select("#main-chart svg"),
margin = {top: 20, right: 20, bottom: 100, left: 75},
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom;

var tooltip = d3.select("body").append("div").attr("class", "toolTip");

var x = d3.scaleBand().rangeRound([0, width]).padding(0.1),
y = d3.scaleLinear().rangeRound([height, 0]);

var colours = d3.scaleOrdinal()
.range(["#d9534f", "#d9534f"]);

var g = svg.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

d3.json(url, function(error, data) {
   if (error) throw error;

x.domain(data.map(function(d) {
      let get_date = "";
      if($('#day').hasClass("active")) {get_date = moment(d.date, 'YYYY-MM-DD').format('MMM DD, YYYY')}
        else if($('#month').hasClass("active")) {get_date = moment(d.date, 'YYYY-MM-DD').format('MMM, YYYY')}
          return get_date;
      }));

    y.domain([d3.min(data, function(d) {return d.total_valid_subscribers-1000000; }), d3.max(data, function(d) { return d.total_valid_subscribers; })]);

    g.append("g")
    .attr("transform", "translate(0," + height + ")")
    .call(d3.axisBottom(x).ticks(5))
    .selectAll("text")
    .style("text-anchor", "end")
    .attr("dx", "-.8em")
    .attr("dy", ".15em")
    .attr("transform", "rotate(-65)" );

    g.append("g").call(d3.axisLeft(y).ticks(10).tickFormat(function(d) {return parseInt(d); }).tickSizeInner([-width]));

    g.selectAll(".bar")
    .data(data)
    .enter().append("rect")
    .attr("x", function(d) {let get_date = "";
      if($('#day').hasClass("active")) {get_date = moment(d.date, 'YYYY-MM-DD').format('MMM DD, YYYY')}
        else if($('#month').hasClass("active")) {get_date = moment(d.date, 'YYYY-MM-DD').format('MMM, YYYY')}
          return x(get_date);
      })
    .attr("y", function(d) {return y(d.total_valid_users); })
    .attr("width", x.bandwidth())
    .attr("height", function(d) { return height - y(d.total_valid_subscribers); })
    .attr("fill", function(d) { return colours(d.date); })
    .on("mousemove", function(d){
      tooltip
      .style("left", d3.event.pageX - 50 + "px")
      .style("top", d3.event.pageY - 70 + "px")
      .style("pointer-events", "none")
      .style("display", "inline-block")
      .html((d.date) + "<br>"  + (d.total_valid_users));
    })
    .on("mouseout", function(d){ tooltip.style("display", "none");});
});

When I do "Last 7 Days". I get:

But when I do "This Year", all my data gets smushed together:

I was hoping to get something like this on both my scales, for X-Axis:

and for Y-Axis:

Is there anyways to do this?


text:
Q: Unable to clone repository while connected to VPN. SSL: certificate subject name does not match target host name 'github.com' I am trying to clone a git repository on a remote system connected via ssh. I need to connect to the VPN in order to ssh to the local machine of my organization.
I am trying to clone this git repository but I am getting SSL error,
fatal: unable to access 'https://github.com/chiphuyen/stanford-tensorflow-tutorials.git/': SSL: certificate subject name (*.<organisation-name>.com) does not match target host name 'github.com'

How can I clone this repository to the given remote desktop given that I can't modify system configuration?
Basic Info:

*

*The system is owned by my organization and I don't have root access on that machine (I am not sudoer).

*The system is Ubuntu 64 bit.

A: You can disable certificate verification;
git -c http.sslVerify=False clone \
https://github.com/chiphuyen/stanford-tensorflow-tutorials.git

Note that:

Git will let you disable SSL certificate verification on a global, per host or per command invocation basis. But before you do any of this, you have to understand that this is a really bad thing: it opens you up to man-in-the-middle attacks and you should really consider all data (including passwords) sent this way to be compromised.

(Realistically speaking, for downloading some tensorflow examples it is probably fine.)
So it is best to do this on a per-command basis as shown above. You should never globally disable certificate verification;

a grue will absolutely eat you.

At a guess, there is a good chance has nothing to do with the configuration of the system in question, or your VPN connection. I would suspect that your organization's firewall is set up to systematically intercept SSL traffic via a MITM for deep packet inspection.


text:
Q: angularjs - Grunt serve gives "spawn cmd ENOENT" error I'm pretty new to using Grunt and I'm getting this error and I've tried everything anyone has suggested in related posts.
connect: {
        options: {
            port: 9000,
            // Change this to '0.0.0.0' to access the server from outside.
            hostname: 'localhost',
            livereload: 35729
        },
        livereload: {
            options: {
                open: true,
                middleware: function (connect) {
                    return [
                        connect.static('.tmp'),
                        connect().use(
                            '/bower_components',
                            connect.static('./bower_components')
                        ),
                        connect().use(
                            '/app/styles',
                            connect.static('./app/styles')
                        ),
                        connect.static(appConfig.app)
                    ];
                }
            }
        },

Here is my config
And when I run grunt serve I get the error
Running "connect:livereload" (connect) task
Started connect web server on http://localhost:9000
Fatal error: spawn cmd ENOENT

I have windows\system32\ in my environmental variables and I've looked over my config files and can't make heads or tails of it. I've additionally run npm cache clean as checking it's installed.
C:\Users\Thomas Wollschlager\Documents\webapp>npm -v
3.8.3

Any help or suggestions would be greatly appreciated.
Thanks guys!
`

A: Run it using command prompt instead of gitBash. Worked for me


text:
Q: Let $x \in \mathbb{R}$ satisfy $x^7+5x^2-3=0$. Prove that $x$ is irrational. I've been working on this past exam and haven't made any progress. I'm trying proof by contradiction be supp. that $x \in \mathbb{Q}, x = \frac{p}{q}$ where $q \neq 0$. Then I get $ \frac{p^7}{q^7} + 5 \frac{p^2}{p^2} = 3 $ but playing around further does not seem to get anywhere.
I also tried Setting $f(x) = x^7+5x^2-3$. Then $f'(x) = x(7x^5+10)$ which gives me two critical points and hence max 3 solutions for $f(x)=0$. I'm also not sure where to go on from here.
edit So I did $ \frac{p^7}{q^7} + 5 \frac{p^2}{p^2} = 3 \to p^7+5p^2q^5=3q^7 \to q(3q^6-5p^2q^5) = p^7$ Because $3q^6-5p^2q^5$ is an integer then that implies $q | p^7$ which is a contradiction because $\gcd(p,q)=1$
edit2 I'm tagging this as proof verification since I came up with a solution in my first edit.
edit3 While it's quite interesting, our class isn't using the Rational Root Theorem. Instead, were convert the equation in question to the form $p^2(p^5+5q^5)=3q^7$ and showing by cases that for each possibly parities of p, q we either have $\gcd(p,q) \neq 1$ or $p^2(p^5+5q^5) \neq 3q^7$. Also, my first edit is indeed incorrect.

A: Hint:
Write  $x=\dfrac pq$ in lowest terms, which means $p,q$ are coprime. The equation can be rewritten as
$$p^7+5p^2q^5=p^2(p^5+5q^5)=3q^7$$
So $p$ divides $3q^7$. As it is coprime with $q^7$, Gauß' lemma asserts it divides $3$, whence $p=\pm 1$ or $\pm3$.
Also, $q$ divides $p^2(p^5+5q^5)$. So it divides $p^2$ or $p^5+5q^5$. The latter case implies it divides $p^5$. In both cases, as $p$ and $q$ are coprime, it is possible only if $q=\pm1$.
Conclusion: if the equation has a rational root, it is necessarily one of $\,\{1,-1,3,-3\}$. Now, it is easy to check that none of them is a root.
Note:
In the same way , one proves  the Rational root theorem:

If a polynomial $f$ with integer coefficients has a rational root, written in lowest terms as $x=\dfrac pq$, then $p$ divides the constant term of $f$ and $q$ divides its leading coefficient.


text:
Q: (Solved) Multiple monitors on Windows 10, different resolutions, densities, and sizes Is there a way to make all monitors play nicely with each other?
I have a laptop with a 4K screen, and I'm (at least temporarily) using a physically larger 1080p monitor beside it. So, the monitor is larger, but there are less pixels. I don't really mind the aesthetically jarring effect of this, but is there some way I can tell Windows that the monitor ISN'T 4x smaller than the laptop screen (aka change the pixel density settings)? Because as it is, it's doing its best to adjust scaling but fails when A: windows straddle the screens and B: the mouse jumps on the Y-axis when moving between them.
Also, windows will occasionally keep their scale from the other monitor when moving from one to the other, for example if I unplug the external monitor while the laptop is asleep the windows will jump to the laptop screen at 1/4 size. Any way to fix these things?

A: Not sure if you already solved this, but maybe LittleBigMouse can help: https://github.com/mgth/LittleBigMouse
It allowed me to solve some issues with the 'gaps' between the screens (allow corner crossing), but it allows you to correct/optimise mouse movement between displays with different DPI values.
My setup in LBM:

My setup IRL:


text:
Q: Why the return value for more than a token? I want to return DOLLARID($foo) and DOTID(.foo),so I wirte tow rule(A code snippet of my lex file):
ID  ([_a-zA-Z]+[a-zA-Z0-9_\-]*)
DOLLAR ("$"|("$!"))
DOT "."
%x DIRECTIVE REFERENCE
%%

[^#$]*?/"$" {BEGIN REFERENCE;yylval.string = yytext;printf("==========begin reference flex content===content:%s=====\n",yytext);return CONTENT;}
[^$#]*?/"#" {BEGIN DIRECTIVE;yylval.string = yytext; return CONTENT;}
<REFERENCE,DIRECTIVE>{DOLLAR}{ID} {yylval.string = yytext;printf("==========flex    content===ID:%s=====\n",yytext);return DOLLARID;}
<REFERENCE,DIRECTIVE>{DOT}{ID} {yylval.string = yytext;printf("==========flex content===DOTID:%s=====\n",yytext);return DOTID;}

A code snippet of my yacc file:
set:SET PARENTHESIS reference EQUAL expression CLOSE_PARENTHESIS { $$ = set_directive($3,$5); }
;
reference: DOLLARID {printf("reference ---Id,key:%s\n",$1);$$ = reference($1);}
|DOLLARID DOTID {printf("reference ---dotId\n");$$ = reference($2);}
;

I write a test file test.vm
#set($arr = [1..5])
#set($hell = "sinory")
$hell
$arr

when I run it,a part of the result is:

line 1 is printed by lexer, it's right
line 2 is printed by bison, it's more than two characters(" =")
Because of flex needs more than a token?
I don't know why?please help me to fix it.

A: The problem is that yytext is only valid for a single token and will get overwritten or otherwise modified by the next token read.  So returning a pointer into it will generally not work -- it will have the token text for a little while but will later change out from under you.  You need to make a copy of the string in yytext if you want to actually make use of its value in the parser.
Change your lexer code to use yylval.string = strdup(yytext); and things will work better (though then you need to worry about freeing the strings to avoid leaking memory).


text:
Q: WPF TabItem contents is not read by screen reader when custom ControlTemplate is applied to TabControl The ControlTemplate is taken from Microsoft's website
<Window.Resources>
    <ControlTemplate x:Key="TabTemplate" TargetType="TabControl">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Border BorderThickness="0,0,1,1" BorderBrush="#D0CEBF" Grid.Row="1">
                <Border BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}">
                    <Border Background="{TemplateBinding Background}">
                        <ContentPresenter ContentSource="SelectedContent"/>
                    </Border>
                </Border>
            </Border>
            <TabPanel Grid.Row="0" IsItemsHost="true"/>
        </Grid>
    </ControlTemplate>
</Window.Resources>
<TabControl x:Key="TabTemplate">
    <TabItem Header="Header">
        <TextBlock Focusable="True" Text="Some text"/>
    </TabItem>
</TabControl>

If I remove x:Key="TabTemplate" from TabControl screen reader reads the content.
Should I add something to ControlTemplate to make it available for screen reader?

A: <ControlTemplate x:Key="TabTemplate" TargetType="TabControl">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border BorderThickness="0,0,1,1" BorderBrush="#D0CEBF" Grid.Row="1">
            <Border BorderThickness="{TemplateBinding BorderThickness}"
                    BorderBrush="{TemplateBinding BorderBrush}">
                <Border Background="{TemplateBinding Background}">
                    <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
                </Border>
            </Border>
        </Border>
        <TabPanel Grid.Row="0" IsItemsHost="true"/>
    </Grid>
</ControlTemplate>

The trick is the x:Name property of ContentPresenter. It should be exactly PART_SelectedContentHost for screen reader to behave correctly.


text:
Q: Path to Deno is not correct WebStorm I am trying to run a simple Deno project in WebStorm. I have installed Deno and enabled the Deno support for this project.
Also added an environment variable of the Deno bin folder with name: DENO_INSTALL_DIR
But while setting the run configuration it's showing an error: Path to Deno is not correct
Please give me a solution regarding this problem. Thanks in advance.

A: In my case bin path after default installation on ubintu is is on location: $HOME/.deno/bin/deno
You should have this path in your DENO_INSTALL_DIR environment variable, depending on your OS.


text:
Q: Confusion regarding the concluding lines to the $GCD(a,b) = GCD(b,r)$ proof...why can we conclude the divisors are all part of the same set? As my title suggests, the last few lines of the proof to the following theorem:
If $a=bq+r$, then $gcd(a,b)=gcd(b,r)$
are not sitting well with me. I understand completely the preceding remarks in the proof...namely:
$x|a \land x|b \Rightarrow x|r$
and
$x'|b \land x'|r \Rightarrow x'|a$
However, I fail to see that this implies $x'$ and $x$ belong to the same set...which is the crucial 'insight' that precedes the ultimate steps of proving the theorem.
I've tried a few different ways of visualizing these sets...specifically:
Let $D = \{d\ \epsilon \ \mathbf Z | \ \ d|a \}$   i.e. $D$ is the set of all divisors of $a$
Let $E = \{e\ \epsilon \ \mathbf Z | \ \ e|b \}$ i.e. $E$ is the set of all divisors of $b$
Let $F = \{f\ \epsilon \ \mathbf Z | \ \ f|r \}$ i.e. $F$ is the set of all divisors of $r$
Let $G = D \cap E$
Let $H = E \cap F$
Therefore:
if $x|a \land x|b$, then $x \ \epsilon \ G $
and
if $x'|b \land x'|r$, then $x' \ \epsilon\  H$
I note that $x'$ and $x$ are clearly both in the set $E$, as they are both divisors of of $b$. Additionally, by my first two remarks:
$x\ \epsilon \ F$ and $x'\ \epsilon\ D$
This generates the resulting odd illustration, where both $x$ and $x'$ need to be simultaneously present in two different locations (which I have depicted as occurring in one of four possible different ways):

(Sorry for all of the pictures). So, obviously, these elements can't be in two places at once. To me, intuitively, the only way this can actually (within the limits of the rule you can only be in one place at a time) happen is if the set containing $x$ is identically the same set that contains $x'$. Unfortunately, I am uncomfortable with that statement. Is there a proof of what I am regarding as "intuitive"? Further, does this mean that the set $G$ and the set $H$ are the same set even though they are fundamentally constructed in different ways? Such  a situation could be expressed by the following picture:

However, I am still uncertain of whether or not I can "accept" this based purely on the idea of its visual appeal. Any help would be appreciated!


text:
Q: How to disable flash plugin in Chrome and IE using Selenium/Java Used the following code for Chrome...But the flash is not disabled for Chrome..
Even I require the code for IE as well
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings.state.flash",0);
//profile.default_content_settings.popups
options.setExperimentalOption("prefs", prefs);
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"\\chromedriver.exe");
driver = new ChromeDriver(options);

A: This is how i got it to work for Chrome:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-bundled-ppapi-flash");
WebDriver webDriver = new org.openqa.selenium.chrome.ChromeDriver(options);

A: I believe you have two options when working with Chrome. I don't know about IE, though. Your only option might be to manually configure it.
Disabling external plugins
Based on Disabling flash in Chrome. This will disable any external plugin, including Adobe Flash Player.
ChromeOptions options = new ChromeOptions();
options.AddArguments("--disable-plugins-discovery");
WebDriver driver = new ChromeDriver(options);

Disabling Adobe Flash Player plugin
Based on Disable flash in saucelabs/selenium webdriver?. This should disable only Adobe's plugin.
Map<String, Object> prefs = new HashMap<>();
prefs.put("plugins.plugins_disabled", "Adobe Flash Player");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);


text:
Q: Nested and syncd listviews with Flutter (scheduler like) I'm going over a few tutorials on Flutter and I'm at a point where I'm trying to build a scheduler view. I divided the layout in two list views, which are next to each other (blue and orange).
The blue list view is simple enough: 24 items, scrollable vertically.
Now the orange list view is where I'm stuck. This part should be both vertically and horizontally scrollable as a whole (notice the last cells are partially visible). Both the number of vertical and horizontal cells are known.
I tried to achieve this using nested list views, list view and child of another list view, but I get an error:

Vertical viewport was given unbounded width.

My question is: how would I go about achieve something like this with Flutter?

A: Process of nesting listView.
Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Confirmed Request'),
      ),
        body: Column(
            children: <Widget>[
                nestedWidget()
            ],
        ),
    );
}
Widget nestedWidget() {
    List<Widget> listTiles = new List();
    for(int i=0;i<scheduleLists.length;i++){
      listTiles.add(getChildLists(i,scheduleLists.values.elementAt(i)));
    }
    return Column(children: listTiles,);
}

Widget getChildLists(int i, Map<String,String> tempChild){
    if(tempChild.keys.length==0){
      isEmpty = true;
      return Center(child: Container(child: Text('No data'),),);
    }
    return ListView.separated(
      shrinkWrap: true,
      itemBuilder: (BuildContext context, int index){
        return Container(
            child: Text(tempChild.values.elementAt(index)),
        );
      },
      itemCount: tempChild.length,
      separatorBuilder: (BuildContext context, int index) => Divider(),
    );
}


text:
Q: Angular displays ERROR TypeError: Cannot read property 'selected' of undefined although I see it is defined This is the code in the template:
<li
        *ngFor="let option of optionList"
        [attr.value]="option.value"
        [hidden]="!option.visible"
        (click)="liClicked(option, $event)"
        (mouseenter)="addNameToLabelOnHover && false ? liHovered(option, $event) : ''"
        (mouseleave)="addNameToLabelOnHover ? liLeft(option, $event) : ''"
        [ngStyle]="{ width: option.addNameToLabel ? 'max-content' : '' }"
        [title]="addFullNameTooltip ? option.name : ''"
        [class.hiddenContainerSpace]="!isListOpen"
        class="valuesList main-option-list-option"
    >
        <input
            type="checkbox"
            [disabled]="isEuSelected"
            (click)="cbClicked(option, $event)"
            [(ngModel)]="option.selected"
        />

        <span class="option-label" (mouseenter)="addNameToLabelOnHover ? liHovered(option, $event) : ''"
            >{{ option.label }}
            {{ displayFullOptionNameAsLabel || option.addNameToLabel ? "(" + option.name + ")" : "" }}</span
        >

        <input
            *ngIf="addCoupledCheckbox"
            class="ingredient-checkbox"
            type="checkbox"
            [disabled]="isEuSelected"
            (click)="coupledCbClicked(option, $event)"
            [(ngModel)]="coupledOptionList[option.label].selected"
        />
    </li>

In the first input and span, everything works fine, but the second input breaks because of the error:
ERROR TypeError: Cannot read property 'selected' of undefined

I am assuing this has something to do with too much nesting here for the ngModel, but I would love to know what is wrong adn can this be done? Thanks everyone for any suggestions!


text:
Q: set the callout annotation title from "DidSelectAnnotationView" in Swift 2.0 and Data From CoreData please help. =) i have a problem to set the callout title. I receive the informations from core data with predicates.
When i click on a annotation on the map, i receive all data from the pin in my Logs.
how can set the title in the callout Bubble?
  func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {

  let annotationView:MKPinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "CheckpointPins")

 if annotation is MKUserLocation {
     return nil }
  else {

        let pred:NSPredicate = NSPredicate(format: "checkpoint_longitude != nil && checkpoint_latitude != nil")
        let items = fetchedResultsController?.fetchedObjects
        let filt = (items! as NSArray).filteredArrayUsingPredicate(pred)

        let startCheckPoint:Checkpoint = (filt as NSArray).firstObject as! Checkpoint!
        let endCheckpoint:Checkpoint = (filt as NSArray).lastObject as! Checkpoint!

        if filt.count != 0 {

           if startCheckPoint .isEqual(annotation) {
              annotationView.pinTintColor = MKPinAnnotationView.greenPinColor()
           }else if endCheckpoint.isEqual(annotation) {

              annotationView.pinTintColor = MKPinAnnotationView.purplePinColor()
           }else {
              annotationView.pinTintColor = MKPinAnnotationView.redPinColor()

           }
     }
           let point = annotation as! Checkpoint

           annotationView.tag = (point.checkpoint_order?.integerValue)!
           annotationView.enabled = true
           annotationView.animatesDrop = true
   //  annotationView.canShowCallout = true
   annotationView.annotation = annotation
           // annotationView.opaque = false
           print("tag = \(annotationView.tag)")
  }
  return annotationView
 }

 func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) {

  if !(view.annotation!.isKindOfClass(MKUserLocation)) {

     let pred:NSPredicate = NSPredicate(format: "checkpoint_longitude != nil && checkpoint_latitude != nil")
     let pred2:NSPredicate = NSPredicate(format: "checkpoint_order == %d", view.tag)
     let compoundPredicate:NSPredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [pred, pred2])

     let items = fetchedResultsController?.fetchedObjects
     let filt = (items! as NSArray).filteredArrayUsingPredicate(compoundPredicate)
     let point:Checkpoint = (filt as NSArray).firstObject as! Checkpoint

     print(point.description)

        }

  }
 }

A: First of all, if you want to show callouts, you need to set canShowCallout to true. There are no callouts unless you enable them.
In a comment you said that you're getting a crash with an error that reads must implement title when canShowCallout is YES on corresponding view <MKPinAnnotationView: 0x7fb9ef536e70... What this is telling you is that the object you used as your annotation does not implement the title part of the MKAnnotation protocol. The title is an optional part of the protocol unless you use callouts in which case you must implement it. The title is what's displayed on the callout. The error message is telling you that you enabled the callout but didn't provide a title to display. You can either add title to the class you're using as the MKAnnotation or you can skip using callouts.


text:
Q: compute a certain maximum in MATLAB let $ C \in \mathbb{N} $ and $ c_1>c_2>\ldots>c_k \in \mathbb{N} $ with $ C>c_1 $ and $ c=(c_1,c_2,\ldots,c_k)^\top \in \mathbb{N}^k $, where $ \mathbb{N} $ are the natural numbers without zero. Consider the set
$ A:= \left\lbrace x \in \mathbb{N}_0^k \, \middle| \, c^\top x \ge C, x \mbox{ has } (P) \right\rbrace $, where $ (P) $ is the following property:
$ \forall \, i \in \lbrace 1,\ldots,k \rbrace \, : \, x_i \ge 1 \Longrightarrow c^\top \left(x-e^i\right)<C $ with $ e^i $ as the $i$-th unit vector.
How can I compute in MATLAB-Code
$ f^\star=\max \left\lbrace c^\top x \, \middle| \, x \in A \right\rbrace $?


text:
Q: Dynamic jQuery on click function? In one of my search bars, upon keyup a div is loaded with the contents of another file.
<input type='text' value='search' id='search' />

My JS code for this task is:
$("#search").keyup(function(){
        var search = $(this).val();
        var url = "model/quickpicks_backend.php";
        var league = $('#league_form').val();
        var position = $('#compose').val();
        var data = "search="+ search +"&league="+ league +"&position="+ position;
        $('#load').load(url, data);
    });

All of the URL parameters are effectively passed to model/quickpicks_backend.php and based upon the values of the three parameters that are passed along, PHP will echo out anywhere from 0 to 5 results. Whatever is echoed out will be wrapped inside of a  with the class of "result." There is also some JS code. It is as follows:
$('.sky').click(function(){
        var num = $('#num').text();
        var num_trim = num.trim();
        var new_num = Number(num) + Number(1);
        $('#num').text(new_num);
        var id = $(this).attr('id');
        var player_id = Number(id) - Number(5);
        var league = $(this).attr('title');

        $.ajax({
            type: 'GET',
            url: 'model/quickpicks_list.php',
            data: 'num='+ num +'&player_id='+ player_id +'&league='+ league,
            dataType: 'JSON',
            success: function(data)
            {
                $.parseJSON(data);

                $('#'+ id).fadeOut('fast');
                $('#search').val('');
                $('#num').text(new_num);
                $('#'+ num_trim).html(data.value);

                if(num == 5)
                {
                      alert("done");
                }
            }
        });
    });

The problem is that whenever .sky is clicked, the data from the most recent element that was clicked isn't collected. Rather, it's all the same info from the very first time a h1.sky is clicked. I thought that maybe using
$('.sky').each(function(index) {
     $(this).click(function(){

    });
});

instead would work. But, it didn't. Using
$('.sky').live();

sort of worked but upon the 5th click (the click that is supposed to trigger the alert), it alerts multiple times.
A working example can be found here

A: the syntax is
$('.sky').live("click",function(
   ........................
));

this might be the problem

A: Try using a break statement just after the alert statement so that it will move out of the loop.


text:
Q: Python How to combine two rows into one under multiple rules I try to combine many pairs of rows when run the code one time. As my example shows, for two rows which can be combined, the rules are,

*

*values in PT, DS, SC columns must be same.

*time stamps in FS must be the closest pair.

*combine on ID column (string) is like ID1,ID2.

*combine on WT and CB column (number) is sum().

*combine on FS is as the latest time.

My example is,
df0 = pd.DataFrame({'ID':['1001','1002','1003','1004','2001','2002','2003','2004','3001','3002','3003','3004','4001','4002','4003','4004','5001','5002','5003','5004','6001'],
                   'PT':['B','B','B','B','B','B','B','B','B','B','B','B','B','B','B','B','D','D','D','D','F'],
                   'DS':['AAA','AAA','AAA','AAA','AAA','AAA','AAA','AAA','AAB','AAB','AAB','AAB','AAB','AAB','AAB','AAB','AAA','AAA','AAA','AAB','AAB'],
                   'SC':['P1','P1','P1','P1','P2','P2','P2','P2','P1','P1','P1','P1','P2','P2','P2','P2','P1','P1','P1','P2','P2'],
                   'FS':['2020-10-16 00:00:00','2020-10-16 00:00:02','2020-10-16 00:00:03','2020-10-16 00:00:04','2020-10-16 00:00:00','2020-10-16 00:00:01','2020-10-16 00:00:02','2020-10-16 00:00:03','2020-10-16 00:00:00','2020-10-16 00:00:01','2020-10-16 00:00:05','2020-10-16 00:00:07','2020-10-16 00:00:01','2020-10-16 00:00:10','2020-10-16 00:10:00','2020-10-16 00:10:40','2020-10-16 00:00:00','2020-10-16 00:10:00','2020-10-16 00:00:40','2020-10-16 00:00:10','2020-10-16 00:00:05'],
                   'WT':[1,2,3,4,10,11,12,13,20,21,22,23,30,31,32,33,40,41,42,43,53],
                   'CB':[0.1,0.2,0.3,0.4,1,1.1,1.2,1.3,2,2.1,2.2,2.3,3,3.1,3.2,3.3,4,4.1,4.2,4.3,5.3]})

When run the code one time, the new dataframe df1 is,
df1 = pd.DataFrame({'ID':['1001,1002','1003,1004','2001,2002','2003,2004','3001,3002','3003,3004','4001,4002','4003,4004','5001,5002','5003','5004','6001'],
                   'PT':['B','B','B','B','B','B','B','B','D','D','D','F'],
                   'DS':['AAA','AAA','AAA','AAA','AAB','AAB','AAB','AAB','AAA','AAA','AAB','AAB'],
                   'SC':['P1','P1','P2','P2','P1','P1','P2','P2','P1','P1','P2','P2'],
                   'FS':['2020-10-16 00:00:02','2020-10-16 00:00:04','2020-10-16 00:00:01','2020-10-16 00:00:03','2020-10-16 00:00:01','2020-10-16 00:00:07','2020-10-16 00:00:10','2020-10-16 00:10:40','2020-10-16 00:10:00','2020-10-16 00:00:40','2020-10-16 00:00:10','2020-10-16 00:00:05'],
                   'WT':[3,7,21,25,41,45,61,65,81,42,43,53],
                   'CB':[0.3,0.7,2.1,2.5,4.1,4.5,6.1,6.5,8.1,4.2,4.3,5.3]})

When run the code again on df1, the new dataframe df2 is,
df2 = pd.DataFrame({'ID':['1001,1002,1003,1004','2001,2002,2003,2004','3001,3002,3003,3004','4001,4002,4003,4004','5001,5002,5003','5004','6001'],
                   'PT':['B','B','B','B','D','D','F'],
                   'DS':['AAA','AAA','AAB','AAB','AAA','AAB','AAB'],
                   'SC':['P1','P2','P1','P2','P1','P2','P2'],
                   'FS':['2020-10-16 00:00:04','2020-10-16 00:00:03','2020-10-16 00:00:07','2020-10-16 00:10:40','2020-10-16 00:10:00','2020-10-16 00:00:10','2020-10-16 00:00:05'],
                   'WT':[10,46,86,126,123,43,53],
                   'CB':[1,4.6,8.6,12.6,12.3,4.3,5.3]})

Here no more combines can be done on df2 because no any pair of rows meets the rules.
The reason is that I have memory limit and have to decrease the size of data without losing the info. So I try to bundle IDs which shares same features and happens close to each other. I plan to run the code multiple times until no more memory issue or no more possible combines.

A: This is a good place to use GroupBy operations.
My source was Wes McKinney's Python for Data Analysis.
df0['ID'] = df0.groupby([df0['PT'], df0['DS'], df0['SC']])['ID'].transform(lambda x: ','.join(x))

max_times = df0.groupby(['ID', 'PT', 'DS', 'SC'], as_index = False).max().drop(['WT', 'CB'], axis = 1)

sums_WT_CB = df0.groupby(['ID', 'PT', 'DS', 'SC'], as_index = False).sum()

df2 = pd.merge(max_times, sums_WT_CB, on=['ID', 'PT', 'DS', 'SC'])

This code just takes the most recent time for each unique grouping of the columns you specified. If there are other requirements for the FS column, you will have to modify this.
Code to concatenate the IDs came from:
Concatenate strings from several rows using Pandas groupby

A: Perhaps there's something more straightforward (please comment if so :)
but the following seems to work:
def combine(data):
    return pd.DataFrame(
        {
            "ID": ",".join(map(str, data["ID"])),
            "PT": data["PT"].iloc[0],
            "DS": data["DS"].iloc[0],
            "SC": data["SC"].iloc[0],
            "WT": data["WT"].sum(),
            "CB": data["CB"].sum(),
            "FS": data["FS"].max(),
        },
        index=[0],
    ).reset_index(drop=True)

df_agg = (
    df.sort_values(["PT", "DS", "SC", "FS"])
    .groupby(["PT", "DS", "SC"])
    .apply(combine)
    .reset_index(drop=True)
)

returns
                    ID PT   DS  SC   WT    CB                   FS
0  1001,1002,1003,1004  B  AAA  P1   10   1.0  2020-10-16 00:00:04
1  2001,2002,2003,2004  B  AAA  P2   46   4.6  2020-10-16 00:00:03
2  3001,3002,3003,3004  B  AAB  P1   86   8.6  2020-10-16 00:00:07
3  4001,4002,4003,4004  B  AAB  P2  126  12.6  2020-10-16 00:10:40
4       5001,5003,5002  D  AAA  P1  123  12.3  2020-10-16 00:10:00
5                 5004  D  AAB  P2   43   4.3  2020-10-16 00:00:10
6                 6001  F  AAB  P2   53   5.3  2020-10-16 00:00:05


text:
Q: I want to make the content of the boy Scrolling in flutter when i trie to wrap the Center widget of the body into a SingleChildScrollView i am getting this issue and  i don't see the content of the page anymore
 ══════ Exception caught by rendering library ═════════════════════════════════
RenderPositionedBox object was given an infinite size during layout.
The relevant error-causing widget was
    Center

if some one can help i would appreciate
and there is my code
import 'package:flutter/rendering.dart';

class DetailLivre extends StatefulWidget {
  @override
  _DetailLivreState createState() => _DetailLivreState();
}

class _DetailLivreState extends State<DetailLivre> {
  @override
  Widget build(BuildContext context) {
    final _backgroundColor = Theme.of(context).primaryColor;
    final _tailleWidth = MediaQuery.of(context).size;
    final _couleurIcons = Colors.blueGrey[200];
    return Scaffold(
      backgroundColor: _backgroundColor,
      appBar: AppBar(
        elevation: 0.0,
        leading: IconButton(
          icon: Icon(
            Icons.arrow_back,
            color: _couleurIcons,
          ),
          onPressed: () =>
              Navigator.pop(context), // Me redirige à la page précédante
        ),
        title: Text(
          'My Books',
          style: TextStyle(color: Color(0xFFB0BEC5)),
        ),
      ),
      body: SingleChildScrollView(
              child: Center(
          child: Stack(
            children: <Widget>[
              Positioned(
                  top: _tailleWidth.height / 35,
                  right: _tailleWidth.width / 2.9,
                  child: Container(
                      height: _tailleWidth.height / 5.0,
                      width: _tailleWidth.width / 4.0,
                      decoration: BoxDecoration(
                          image: DecorationImage(
                              fit: BoxFit.fill,
                              image: AssetImage('images/4.jpg'))))),

            ]
          ),
        ),
      ),
      bottomNavigationBar: Container(
        height: 60,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.only(
            topRight: Radius.circular(30),
            topLeft: Radius.circular(30),
          ),
          boxShadow: [
            BoxShadow(color: Colors.black26, spreadRadius: 0, blurRadius: 7.0),
          ],
        ),
        child: BottomAppBar(
          color: _backgroundColor,
          elevation: 10.0,
          shape: CircularNotchedRectangle(),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        elevation: 6.0,
        onPressed: () => setState(() {}),
        child: Icon(
          Icons.play_arrow,
          size: 40.0,
        ),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    );
  }
}

but it didn't work it show a white screen  when the SignleChildScrollView is wrapped with the Center widget of the Body

A: To use Positioned Widget in Stack, the Stack widget must have some space. In your case, the stack is empty, nor it is inside a parent container. So Positioned Widget is not working. And you are getting wrong error message. SingleChildScrollView is not the reason behind error.
To define space for the stack u can do 2 things.

*

*Wrap the Stack Widget inside a Container widget and give it some height width.

*Or Insert a Container Inside a Stack

Container(
  height: 200,
  Width: 200,
  child: Stack(
    children: [
    Positioned(...)
    ]
  )
)


text:
Q: Alfresco workflow assign not working In Alfresco community edition-5.1.x  using custom workflow  In workflow task assignation to group or individual not working please help me out
My Bpmn20.xml code
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="mentoraTraining" name="TrainingRequest" isExecutable="true">
    <startEvent id="start" activiti:formKey="mentoratraining:start"></startEvent>
    <sequenceFlow id="sequenceFlow1" sourceRef="start" targetRef="userTask1"></sequenceFlow>
    <userTask id="userTask1" name="Operations" activiti:formKey="mentoratraining:operations" activiti:candidateGroups="${bpm_groupAssignee.properties.authorityName}">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;;
]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
if (typeof task.getVariableLocal('mentoratraining_needtocoverprerequisites') != undefined) execution.setVariable('mentoratraining_needtocoverprerequisites', task.getVariableLocal('mentoratraining_needtocoverprerequisites'));
if (typeof task.getVariableLocal('mentoratraining_desiredoutcomesforstudents') != undefined) execution.setVariable('mentoratraining_desiredoutcomesforstudents', task.getVariableLocal('mentoratraining_desiredoutcomesforstudents'));

]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sequenceFlow2" sourceRef="userTask1" targetRef="userTask2"></sequenceFlow>
    <userTask id="userTask2" name="Recruitment " activiti:formKey="mentoratraining:recruitment">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;;
]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[
if (typeof task.getVariableLocal('mentoratraining_trainername') != undefined) execution.setVariable('mentoratraining_trainername', task.getVariableLocal('mentoratraining_trainername'));
if (typeof task.getVariableLocal('mentoratraining_rateperhour') != undefined) execution.setVariable('mentoratraining_rateperhour', task.getVariableLocal('mentoratraining_rateperhour'));
if (typeof task.getVariableLocal('mentoratraining_coursedurationhours') != undefined) execution.setVariable('mentoratraining_coursedurationhours', task.getVariableLocal('mentoratraining_coursedurationhours'));
if (typeof task.getVariableLocal('mentoratraining_costoftrainer') != undefined) execution.setVariable('mentoratraining_costoftrainer', task.getVariableLocal('mentoratraining_costoftrainer'));

]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sequenceFlow3" sourceRef="userTask2" targetRef="serviceTask1"></sequenceFlow>

  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_mentoraTraining">
    <bpmndi:BPMNPlane bpmnElement="mentoraTraining" id="BPMNPlane_mentoraTraining">
      <bpmndi:BPMNShape bpmnElement="event1" id="BPMNShape_event1">
        <omgdc:Bounds height="30.0" width="30.0" x="1075.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusiveGateway2" id="BPMNShape_exclusiveGateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="1070.0" y="0.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusiveGateway1" id="BPMNShape_exclusiveGateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="980.0" y="65.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="serviceTask1" id="BPMNShape_serviceTask1">
        <omgdc:Bounds height="60.0" width="100.0" x="380.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="30.0" width="30.0" x="0.0" y="70.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask1" id="BPMNShape_userTask1">
        <omgdc:Bounds height="60.0" width="100.0" x="80.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask3" id="BPMNShape_userTask3">
        <omgdc:Bounds height="60.0" width="100.0" x="530.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="serviceTask2" id="BPMNShape_serviceTask2">
        <omgdc:Bounds height="60.0" width="100.0" x="680.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="30.0" width="30.0" x="1160.0" y="5.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask2" id="BPMNShape_userTask2">
        <omgdc:Bounds height="60.0" width="100.0" x="230.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="userTask4" id="BPMNShape_userTask4">
        <omgdc:Bounds height="60.0" width="100.0" x="830.0" y="55.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow5" id="BPMNEdge_sequenceFlow5">
        <omgdi:waypoint x="630.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="680.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow6" id="BPMNEdge_sequenceFlow6">
        <omgdi:waypoint x="780.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="830.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow3" id="BPMNEdge_sequenceFlow3">
        <omgdi:waypoint x="330.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="380.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow4" id="BPMNEdge_sequenceFlow4">
        <omgdi:waypoint x="480.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
        <omgdi:waypoint x="30.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="80.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">
        <omgdi:waypoint x="180.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="230.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow10" id="BPMNEdge_sequenceFlow10">
        <omgdi:waypoint x="1110.0" y="20.0"></omgdi:waypoint>
        <omgdi:waypoint x="1122.0" y="20.0"></omgdi:waypoint>
        <omgdi:waypoint x="1122.0" y="20.000000000000004"></omgdi:waypoint>
        <omgdi:waypoint x="1160.0" y="20.000000000000004"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow9" id="BPMNEdge_sequenceFlow9">
        <omgdi:waypoint x="1020.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="20.000000000000004"></omgdi:waypoint>
        <omgdi:waypoint x="1070.0" y="20.000000000000004"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow7" id="BPMNEdge_sequenceFlow7">
        <omgdi:waypoint x="930.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="980.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow8" id="BPMNEdge_sequenceFlow8">
        <omgdi:waypoint x="1020.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="1032.0" y="155.0"></omgdi:waypoint>
        <omgdi:waypoint x="1075.0" y="155.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

And my model.xml file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="mentoratraining:model">
    <imports>
        <import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0"/>
        <import prefix="cm" uri="http://www.alfresco.org/model/content/1.0"/>
        <import prefix="bpm" uri="http://www.alfresco.org/model/bpm/1.0"/>
    </imports>
    <namespaces>
        <namespace prefix="mentoratraining" uri="http://www.alfresco.org/model/dynamic-workflow/mentoratraining/1.0"/>
    </namespaces>

    <types>
        <type name="mentoratraining:operations">
            <parent>bpm:workflowTask</parent>
             <properties/>
            <associations/>
            <overrides>
                <property name="bpm:packageActionGroup">
                    <default>add_package_item_actions</default>
                </property>
                <property name="bpm:packageItemActionGroup">
                    <default>edit_and_remove_package_item_actions</default>
                </property>
            </overrides>
            <mandatory-aspects>
                <aspect>mentoratraining:requestdate</aspect>
                <aspect>mentoratraining:requestorcompany</aspect>
                <aspect>mentoratraining:requestorname</aspect>
                <aspect>mentoratraining:requestoremail</aspect>
                <aspect>mentoratraining:trainingtopic</aspect>
                <aspect>mentoratraining:modeoftraining</aspect>
                <aspect>mentoratraining:country</aspect>
                <aspect>mentoratraining:traininglocation</aspect>
                <aspect>mentoratraining:requestedstartdate</aspect>
                <aspect>mentoratraining:expecteddurationinhoursperday</aspect>
                <aspect>mentoratraining:expecteddurationtotalhours</aspect>
                <aspect>mentoratraining:timingrestrictionsifany</aspect>
                <aspect>mentoratraining:classtimingincludingtimezone</aspect>
                <aspect>mentoratraining:numberofstudents</aspect>
                <aspect>mentoratraining:needtocoverprerequisites</aspect>
                <aspect>mentoratraining:desiredoutcomesforstudents</aspect>
                <aspect>mentoratraining:mlpoc</aspect>
                <aspect>mentoratraining:trainingbudget</aspect>
                <aspect>mentoratraining:requestedcurriculumtopics</aspect>
                <aspect>mentoratraining:requiredoperatingsystem</aspect>
                <aspect>mentoratraining:requiredsoftware</aspect>
                <aspect>mentoratraining:requiredhardware</aspect>
                <aspect>mentoratraining:hardwaredetails</aspect>
                <aspect>mentoratraining:softwaredetails</aspect>
                <aspect>mentoratraining:operatingsystemdetails</aspect>
                <aspect>mentoratraining:details</aspect>
                <aspect>mentoratraining:selectgroup</aspect>
                <aspect>bpm:groupAssignee</aspect>
            </mandatory-aspects>
        </type>

</model>

finally my share-config-custom.xml code
<config >
   <forms>
      <form>
         <field-visibility>
            <show id="bpm:groupAssignee" />
             </field-visibility>
      </form>
   </forms>
</config>

A: Try to add,  <aspect>bpm:groupAssignee</aspect> in your task.
      <type name="mentoratraining:operations">
            <parent>bpm:workflowTask</parent>
             <properties/>
            <associations/>
            <overrides>
                <property name="bpm:packageActionGroup">
                    <default>add_package_item_actions</default>
                </property>
                <property name="bpm:packageItemActionGroup">
                    <default>edit_and_remove_package_item_actions</default>
                </property>
            </overrides>
            <mandatory-aspects>
                  <!-- Your existing aspects goes here -->
                <aspect>bpm:groupAssignee</aspect>
            </mandatory-aspects>
        </type>


text:
Q: Proxy класс для своего контейнера и его использование Один добрый человек в моем прошлом вопросе о контейнерах дал описание proxy класса для перехвата rvalue mymap[100] == 200;. То есть 999 идет в АВЛ дерево, а потом создается файл с именем 999, и в него сохраняется значение 100.
template<typename T1, typename T2>
struct PersistentMap;

template<typename T1, typename T2>
struct PersistentMapProxy
{
    PersistentMap<T1, T2> & parent;
    T1 key;
    PersistentMapProxy(PersistentMap<T1, T2> & parent, T1 key)
      : parent(parent), key(key)
    {}

    const T2& operator = (const T2& value) const
    {
         parent.assign(key, value);
         return value;
    }

    operator const T2& () const
    {
        return parent.get(key);
    }
};

template<typename T1, typename T2>
struct PersistentMap
{
    // ...

    typedef PersistentMapProxy<T1, T2> Proxy;

    Proxy operator[] (T1 key)
    {
        return Proxy(*this, key);
    }

    void assign(T1 key, const T2& value){ /*...*/ }

    // ...
};

Proxy класс работает безукоризненно при простых операциях вроде:
myMap[1] = 10;
myMap[2] = 20;
int c = 30;
myMap[3] = c;

Но стоит мне немного усложнить присваивание, как возникает ошибка.
Представим, что у нас есть метод:
void modify(int& a) {а += 5;}

и мне нужно выполнить данное действие:
modify(myMap[2]);

то есть взять и увеличить значение в ячейке [2] на 5 пунктов.
При этом возникают ошибки:

1) (active) initial value of reference to non-const must be an lvalue
2) C2664 'void modify(int &)': cannot convert argument 1 from 'const
  lib::PersistentMapProxy' to 'int &'

Метод modify обязан быть использован и менять его не могу, а значит нужно что-то делать с контейнером и proxy классом.
Не могли бы вы мне подсказать, как решить данную проблему? И желательно дать пример решения.

A: Если очень нужно обеспечить возможность вызова вида modify(myMap[2]);, то достаточно реализовать оператор преобразования Вашего proxy-типа к неконстантной ссылке на тип (по аналогии с имеющейся константной):
operator T2&()
{
    return parent.get(key); // тут должна быть соответствующая версия get
}

A: template<typename T1, typename T2>
struct PersistentMapProxy
{
    PersistentMap<T1, T2> & parent;
    T1 key;
    T2 value;
    PersistentMapProxy(PersistentMap<T1, T2> & parent, T1 key)
      : parent(parent), key(key), value( parent.get(key) )
    {}

    const T2& operator = (const T2& value_) const
    {
        value=value_;
        parent.assign(key, value);
        return value;
    }

    operator T2& ()
    {
        return value;
    }
    ~PersistentMapProxy()
    {
        if(value!=parent.get(key))
            parent.assign(key, value);
    }
};

Но этот подход настолько ошибкоопасен что на собеседовании такое лучше не показывать.
Правильный способ - исправить функцию modify, так чтобы она принимала Proxy в качестве аргумента.


text:
Q: Typescript optional type does not allow recursive partial utility type to work I wanted to use the popular RecursivePartial utility type to make all fields, objects, and arrays of objects be optional but not invalid. However when a field is already marked as optional, this breaks. It suddenly does not allow partial types. Is there any way to fix this such that eventA works like eventB?
type RecursivePartial<T> = {
  [P in keyof T]?:
    T[P] extends (infer U)[] ? RecursivePartial<U>[] :
    T[P] extends object ? RecursivePartial<T[P]> :
    T[P];
};

class MyEvent {
  date!: Date;
  name!: string;
}

interface MyUser {
  name: string;
  eventA?: MyEvent;
  eventB: MyEvent;
}

type PartialUser = RecursivePartial<MyUser>;

const a: PartialUser = {
  eventA: { // It wants all fields defined
    name: '',
  },
  eventB: { // But this one is OK
    name: '',
  },
};

Playground

An attempt at a solution because I still have issues with a field like users?: User[]
type RecursivePartial<T> = {
  [P in keyof T]?:
  T[P] extends (infer U)[] | undefined ? RecursivePartial<U>[] :
  T[P] extends object | undefined ? RecursivePartial<T[P]> :
  Partial<T[P]>;
};

It works but I'm trying to understand the consequences of | undefined. It seems that it will let me get away with assigning a number to a Date for example.. Yikes

Attempt 3: I think this works. Just have to do the hard work and add more stronger typechecking
type RecursivePartial<T> = {
  [P in keyof T]?:
  T[P] extends Date | undefined ? Date :
  T[P] extends (infer U)[] | undefined ? RecursivePartial<U>[] :
  T[P] extends object | undefined ? RecursivePartial<T[P]> :
  Partial<T[P]>;
};

A: The issue here is that the type of the eventA field is actually MyEvent | undefined. Since it includes the union with undefined, it will no longer match to the extends object clause and thus is mapped back to itself (T[P] in the final case).
One way to fix this is to reform your RecursivePartial so that each type conditional happens on the overall type rather than on the keys of the type. This way the type can distribute itself over each part of a union separately.
Eg:
type RecursivePartial<T> =
  T extends Date ? T :                                       // Leave Date objects alone
  // Also of note: possibly add cases for Set, Map, other JS builtins...
  T extends (infer U)[] ? RecursivePartial<U>[] :            // Recurse into array types!
  T extends {} ? {[P in keyof T]?: RecursivePartial<T[P]>} : // Recurse into object types!
  T;                                                         // Leave other types as-is.

This seems to produce the inference you are looking for:
const a: PartialUser = {
  eventA: {   // No Error!
    name: '',
  },
  eventB: {
    name: '',
  },
};

Let me know if this still doesn't work for your actual use case.

Typescript Playground