text:
Q: Is there a word for words formed of repeating sounds? Is there a word for words formed of repeating sounds?
Mama, Papa, ... Any other such words...

A: The distinctive linguistic feature in words like papa, dada, mama or bubba is called reduplication, or to be precise, exact reduplication, where a single CV syllable is repeated.
When infants begin to vocalize beyond crying, they imitate the prosody of the language around them with vowel sounds. When they are a bit older, a limited set of consonants — usually stops and nasals — combine with the vowel sounds into babbling, a word imitative of infant sounds like bababa. This repetition is called canonical or reduplicative babbling, which in turn is imitated in baby talk, or child directed speech (CDS), in a limited set of English words. Think of it as a kind of pidgin language between adults and children, which like any language, can preserve archaic features. Generations of children were taught the word choo choo 'train' long after trains were no longer steam-powered with whistles.
This feature of baby talk seems a peculiarity of English. Italian has a more limited set, but il papa is the name for the Pope, so I guess it balances out. Languages with highly productive diminutives, like Czech/Slovak -ko, tend to use those. The German CDS word for 'doggy', for example, is a double diminutive: Hund + i + lein, Hundilein 'little doggy'.
This feature is productive in adult speech as well, with some baby talk borrowing:
Exact reduplication: bye bye, hush hush, toot toot, too too (as in too too much), la la, so so, gaga, beebee, papa, dada, mama,   bubba (brother), wakey wakey. Words imitative of laughter or giggling: hee hee, ha ha, ho ho. With infix: yackity yack. Yada yada yada and blah blah blah would be triplication, I suppose.
Rhyming reduplication occurs when only an initial consonant changes or is added: teeny weeny, super duper, willy nilly, boogie woogie, walkie talkie, bow wow, argle bargle, hodgepodge/hotchpotch. Tra la la would be triplication. Ragtag was formed from two "normal" lexemes, but fits the pattern. Brand names like TicTac candies or the Southern American grocery store chain Piggly Wiggly.
A subtype of rhyming reduplication is shm-reduplication borrowed from Yiddish: fancy shmancy. This feature, combined in Eastern Yiddish from two features in Slavic and Turkic languages, spread from New York City to the rest of the US by the 1930s.
Ablaut reduplication occurs when a vowel is changed, almost always from a front vowel to a mid or back one: teeny tiny, shilly shally, dilly dally, hiphop, zigzag, seesaw, singsong, pitter patter, splish splash, mishmash, ping pong, tick tock, flipflop, riff raff. In the American South, mamaw and papaw 'grandmother', 'grandfather'. With infix: tickity tock, clickity clack. Telltale isn't formed as these words, but fits the phonetic pattern.
Another linguistic feature sometimes termed contrastive focus reduplication is where a word is repeated, the first instance establishing a meaning as 'true to type' or as 'commony understood' as opposed to some other sense.

This was in Delano, CA I was visiting my girlfriend (friend friend no relationship just a girl friend I'm a guy so that's ok to have a girl girl friend).

Though a bit confusing, this writer is insisting that the constituent parts of girlfriend be understood in their non-compounded senses: a friend friend (no romantic involvement) and a girl girl, a young woman (with whom he has no romantic relationship).

A: Yes: assonance. Assonance is repeating vowel sounds, as in your example. A repeating consonant sound in the middle or at the end of a word is known as 'consonance'. Of course, most are familiar with 'alliteration': repeating sounds at the beginning of words, but that is not what you are asking.


text:
Q: Why i'm getting IOException : The process cannot access the file? This is the code:
static string ftpurl = "ftp://ftp.test.com/files/theme/";
static string filename = @"c:\temp\test.txt";
static string ftpusername = "un";
static string ftppassword = "ps";
static string value;

public static void test()
{
    try
    {
        FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(
        ftpurl + "/" + Path.GetFileName(filename));
        request.Method = WebRequestMethods.Ftp.UploadFile;

        request.Credentials = new NetworkCredential(ftpusername, ftppassword);

        StreamReader sourceStream = new StreamReader(@"c:\temp\test.txt");
        byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
        sourceStream.Close();
        request.ContentLength = fileContents.Length;

        Stream requestStream = request.GetRequestStream();
        requestStream.Write(fileContents, 0, fileContents.Length);
        requestStream.Close();

        FtpWebResponse response = (FtpWebResponse)request.GetResponse();

        Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);

        response.Close();
    }
    catch(Exception err)
    {
        string t = err.ToString();
    }
}

The exception is on the line:
StreamReader sourceStream = new StreamReader(@"c:\temp\test.txt");

Here is the exception:
The process cannot access the file 'c:\temp\test.txt' because it is being used by another process

System.IO.IOException was caught
  HResult=-2147024864
  Message=The process cannot access the file 'c:\temp\test.txt' because it is being used by another process.
  Source=mscorlib
  StackTrace:
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
       at System.IO.StreamReader..ctor(String path)
       at ScrollLabelTest.FtpFileUploader.test() in e:\scrolllabel\ScrollLabel\ScrollLabel\FtpFileUploader.cs:line 33
  InnerException:

Why I'm getting the exception and how can I fix it?

A: You should use a finally block, and close all the Streams there:
finally
{
    sourceStream.Close();
    requestStream.Close();
    response.Close();
}

This way even if you have an exception, everything will be closed.
This happends because maybe you have gotten an exception before the close of that file, and then, when you run your program again, and try to open, is still opened.
Close your file first, and then use the finally block, or the using statement.
Something like:
using (StreamReader reader = new StreamReader("file.txt"))
{
    line = reader.ReadLine();
}

I hope this helps

redpajama_set_name: RedPajamaStackExchange


text:
Q: ¿Por qué el método de solicitud SpringMVC 'GET' no esta soportado? Es el siguiente error:
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
El controlador
@Controller
public class NoticiaControlador {

    @Autowired
    private NoticiasServicesAPI noticiasServicesAPI;

    @RequestMapping("/noticia")
    public String index(Model model) {
        model.addAttribute("list", noticiasServicesAPI.getAll());
        return "index";
    }

    @GetMapping("/noticia/crear/{id}")
    public String crear(@PathVariable("id") Long id, Model model) {
        if (id != null && id != 0) {
            model.addAttribute("noticia", noticiasServicesAPI.get(id));
        } else {
            model.addAttribute("noticia", new Noticias());
        }
        return "crearNoticia";
    }

    @PostMapping("/noticia/crear")
    public String registro(Noticias noticias, ModelMap modelo) { // String imagen
        noticiasServicesAPI.save(noticias);
        return "index";
    }

y en el navegador me sale
There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported

A: Revisando el código no has colocado correctamente las anotaciones, las anotaciones de la clase deben de ser @RestController y @RequestMapping("/noticia"), después para tener el GET en la ruta /noticia anotas el método con  @GetMapping() y lo dejas vacío para indicar que utilice la ruta del controlador.
Al tener @RequestMapping("/noticia") en el controlador todos los métodos heredaran ese prefijo lo que hace innecesario agregar/noticia a los métodos, sino quedaría la ruta por ejemplo: /noticia/noticia/crear/{id}.
La clase con las correcciones quadria:
@RestController
@RequestMapping("/noticia")
public class NoticiaControlador {

    @Autowired
    private NoticiasServicesAPI noticiasServicesAPI;

    @GetMapping()
    public String index(Model model) {
        model.addAttribute("list", noticiasServicesAPI.getAll());
        return "index";
    }

    @GetMapping("/crear/{id}")
    public String crear(@PathVariable("id") Long id, Model model) {
        if (id != null && id != 0) {
            model.addAttribute("noticia", noticiasServicesAPI.get(id));
        } else {
            model.addAttribute("noticia", new Noticias());
        }
        return "crearNoticia";
    }

    @PostMapping("/crear")
    public String registro(Noticias noticias, ModelMap modelo) { // String imagen
        noticiasServicesAPI.save(noticias);
        return "index";
    }
}

Ahora, hay algunos puntos que según las buenas practicas no están correctamente aplicados en el servicio, porque no estas respetando la utilidad de las acciones GET y POST con respecto a la URL porque estas describiendo la acción en la ruta /crear cuando la debe de marcar el POST únicamente, porque /crear/{id} no es intuitivo para pensar que buscas una noticia por id.
Las rutas correctas deberían ser:
GET   /noticias       : Listar todas las noticias
GET   /noticias/{id}  : Buscar noticia por id
POST  /noticias       : Crear una nueva noticia
La clase quedaría:
@RestController
@RequestMapping("/noticias")
public class NoticiaControlador {

    @Autowired
    private NoticiasServicesAPI noticiasServicesAPI;

    @GetMapping()
    public String index(Model model) {
        model.addAttribute("list", noticiasServicesAPI.getAll());
        return "index";
    }

    @GetMapping("/noticias/{id}")
    public String crear(@PathVariable("id") Long id, Model model) {
        if (id != null && id != 0) {
            model.addAttribute("noticia", noticiasServicesAPI.get(id));
        } else {
            model.addAttribute("noticia", new Noticias());
        }
        return "crearNoticia";
    }

    @PostMapping("/noticias")
    public String registro(Noticias noticias, ModelMap modelo) { // String imagen
        noticiasServicesAPI.save(noticias);
        return "index";
    }
}


text:
Q: Detecting unicode private use area characters with python What is the proper way to identify unicode private use characters in python 3? There's nothing obviously relevant in the module unicodedata, which which makes it easy to look up character names and attributes.
Some background: unicodedata.name(), which gives the name of unicode characters, will raise a ValueError if called with a private use character (e.g., try unicodedata.name("\uf026")). But whitespace characters (except for space itself), and possibly other things, also trigger an exception. So what's a non-hacky, reliable way to detect PUA characters?

A: Private use characters are all in the Co general category, as returned by category() in unicodedata:
>>> import unicodedata
>>> def is_pua(c):
...   return unicodedata.category(c) == 'Co'
...
>>> is_pua(u'\uF026')
True

Given that the Unicode Standard guarantees that the set of private use characters will never change (no characters will ever be added or removed), it's also safe to hard-code the three ranges:

*

*U+E000 to U+F8FF

*U+F0000 to U+FFFFD

*U+100000 to U+10FFFD


text:
Q: UIView build in Interface Builder connected to my custom UIViewController I was trying to use IB in a slightly different way that I am use to and I can't get it working extending the normal approach I use, when dealing with IB.
Instead of making a new UIViewController and have the view XIB generated for me and everything linked together by Xcode, I would like to just build a small (320x40px) View XIB and link it to my already existing ViewController.
I start out by making a new file in Xcode, select "view XIB".
I then open IB and add some labels etc. to the view and I set "Files Owner" to be my existing ViewController.
In my existing ViewController I set the IBOutlets for the labels etc. I put in my view.
I go back to IB and hook up the UILabels to my outlets in "Files Owner".
I would now think that I have a reference to the labels inside the XIB, in my viewController.
This is not really the approach I would like, I see no need for my viewController to have a reference to labels inside my view.
How I usually do in code:
My ViewController controls a bunch of UIViews made entirely in code and who instantiate them by:
UIView *customView = [[CustomView alloc] initWithFrame:aFrame];
[customView setTag:MY_CUSTOM_VIEW];
[customView setDelegate:self];
[self.view addSubView:customView];
[customView release];

After this I would access the labels, buttons etc. from my controller by using the [(UILabel*)[[self.view viewWithTag:MY_CUSTOM_VIEW] myLabel] setText@"Hello, World"];
have my UIViewController implement what ever methods the customView protocol required.
How to get that functionality with IB
Should I first build a MyCustomView class extending the UIView class, have it hold all my IBOutlets, set MyCustomClass as files owner and then instantiate that as shown above?
Is it OK to have a view act as viewController for the IB view and how would I relay actions to my "real" viewController?
What I would like to achieve is to deal with instantiating and laying out several UIViews in my UIViewControllers code, but have the freedom of designing some of these UIViews in IB.
All the info I can find is regarding the standard "build a UIViewController with a XIB for the view" or "How to build libraries of IB components".
I hope it makes sense and thanks for any help given:)

A: You can create whatever view structure you want in Interface Builder and then instantiate it using the UINib class. Once you create an UINib object it loads the contents from the nib and keeps them. Then, whenever you send it the instantiateWithOwner:options: message, it will instantiate the objects contained in the xib and return an array with the top level views. You can then add these views to your view hierarchy and handle them just like any other view you created programmatically.
If you keep the UINib object (as a property for example), you can instantiate the contents again and again, which allows your xib to be used like a template.
update: For a pre-iOS 4 workaround see my recent question and answer.


text:
Q: Function class consisting of gradients of real-valued convex functions Denote $\mathcal F$ as the function class consisting of gradients of all real-valued convex functions in $\mathbb R^d$, that is, $\mathcal F = \{ \nabla \phi ~|~ \phi: \mathbb R^d \to \mathbb R \text{ and $\phi$ is convex}\}$. Note that every element of $\mathcal F$ is a function from $\mathbb R^d$ to $\mathbb R^d$. Then is $\mathcal F$ closed under composition operation? That is, suppose $f \in \mathcal F$ and $ g\in \mathcal F$, do we have $f\circ g \in \mathcal F$ where $\circ$ denotes function composition?
Note: the statement should be true for $d = 1$ since:

*

*Gradient of a univariate real-valued convex function is non-decreasing;

*Composition of two non-decreasing functions is still non-decreasing;

*Non-decreasing gradient corresponds to a convex function.

A: Set
$$A = \begin{pmatrix} 2 & 1\\ 1 & 1\end{pmatrix} \quad\text{and}\quad B = \begin{pmatrix} 5 & 2\\ 2 & 1\end{pmatrix}.$$
Both matrices are positive definite because their diagonal entries are positive as are their determinants. Hence, they are gradients of convex functions, namely $\tfrac{1}{2}\langle x,Ax\rangle$ and $\tfrac{1}{2}\langle x,Bx\rangle$, respectively.
However,
$$AB = \begin{pmatrix} 12 & 5 \\ 7 & 3\end{pmatrix}$$
is not even symmetric, so it cannot be a gradient of a convex function.
Note: The matrices were already used in a sister question:  Product of any two arbitrary positive definite matrices is positive definite or NOT?


text:
Q: Confusion with interpreting leading and lagging concepts for given electrical quantities I have a confusion interpreting the lagging leading concept when it comes to time plots.
I think in phasors I can see which one is leading or lagging. For example in the below phasor diagram:

How I interpret the above diagram is that A is leading B; and B is leading C. And I think it is because we imagine the phasors are rotating counter clockwise and the reference point is the green line (positive x axis) the first phasor we encounter is A then B and then C.
But what should be the practical way of thinking if we are only given time plots as shown?:

Above in the first plot there are three voltages with 120 degree phase shifts. And in the second plane voltage and current plots are given for a single line.
For these plot what is leading what? What should be the way of thinking here? Do we have to see the plots from the time zero or?

A:
And I think it is because we imagine the phasors are rotating counter clockwise and the reference point is the green line (positive x axis) ...

That is fine.

... the first phasor we encounter is A then B and then C.

No. If we are rotating counter-clockwise then A will be followed by C and then B. (Imagine A has just crossed the green line. Which one is next?)

For these plot what is leading what? What should be the way of thinking here? Do we have to see the plots from the time zero or? (sic)

A simple way to do this is to decide which is going to be the reference signal. Usually we choose the voltage.

Figure 1. Leading or lagging? Voltage is blue. Current is yellow.
Next find the zero crossing point for the voltage. This is point (1) on the graph.
Then find the zero-cross for the current. This is point (2) on the graph.
Since these are within 180° of each other reading from left to right it makes sense to say that the voltage is leading the current. The lead is about 3 ms on a 20 ms cycle so that gives \$ \frac {3}{20}360 = 54° \$.
CIVIL
As an extra help, if you remember "C-I-V-I-L": in a Capacitor I leads V  but V leads I in an inductor. From this we can conclude that these voltage and current measurements were taken on an inductive load.

From the comments:

Ok so we have to find zero crossing points for current and voltages where these points are less than 180 degrees apart from each other; then the point on the left side is the leading quantity.

In power circuits the leading or lagging is 90° max so that's a good way to approach it. If you got a lag of 300° it would be much more sensible to convert this into a lead of 60°.

That's cool we dont need the initial point for this; any steady state part of the plots work to interpret.

Zero is an easy point to use. You could use the peak or trough also but the curve is flat (zero slope) at those points whereas it crosses the 0 line at a steep angle making it much more convenient to measure.


text:
Q: Where is the .apk file output after signing it via Azure android signing build pipeline? I'm signing an apk file in a build pipeline using the Azure 'Android Signing' task but I cannot see the path in which the signed apk is output to. I've exported the entire root of the build pipeline as .zip file, but a signed .apk file does not exist. What's even more confusing is that the Android Signing task is passing, so the signed .apk must be somewhere right? The question is where!
Thanks

A: Android Signing' task did not create a new apk. The signed apk is still in the output folder of android build task.
If you use XamarinAndroid task to build your apk. The .apk will be output to $(Build.ArtifactStagingDirectory) for below example:  Check here for all predefined variables
- task: XamarinAndroid@1
  inputs:
    projectFile: '**/*droid*.csproj'
    outputDirectory: '$(Build.ArtifactStagingDirectory)'
    configuration: '$(buildConfiguration)'

Then you can add the android sign task and point apkFiles to $(Build.ArtifactStagingDirectory)/*.apk for below example:
- task: AndroidSigning@3
  inputs:
    apksign: true
    zipalign: false
    apksignerKeystoreFile: levi.keystore
    apkFiles: '$(Build.ArtifactStagingDirectory)/*.apk'
    keystoreAlias: levi
    apksignerKeyPassword: '**'
    apksignerKeystorePassword: '**'

You can then add a publish artifacts task to publish your apk to azure server,where you can download from azure devops build summary UI when your build is complete.
- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)'.

Then you can download the apk from your build summary page.

You can run below command to check if the apk is signed or not after you downloaded it from azure server.
$ jarsigner -verify -verbose -certs my_application.apk


text:
Q: How do I change the color of the drawable in a button? I have a button in the list of items rendered with recycler view with a drawable icon. Here is my code.
<Button
  android:id="@+id/button_like"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:drawableLeft="@drawable/ic_thumb_up_black_24dp"
  android:text="@string/label_like"
  android:textSize="11dp"
  style="?android:attr/borderlessButtonStyle"/>

Now I want to change the color of the icon ic_thumb_up_black_24dp which is anydpi xml icon from Android material design icons.
I tried android:drawableTint="@android:color/secondary_text_dark" but it does not work.
android:textColor="@android:color/secondary_text_dark" works only on the text color but not on the icon. Can someone help me with this?


text:
Q: RequireJS inconsistent error with async and google maps api when using identity services I'm working on a .NET 5 based MVC app.  I wanted to switch it to TypeScript and modularize the code.  The best way I found to do this is to build everything as AMD packages and use RequireJS for loading.  At first glance things seem to work OK but then I started seeing errors on some pages.  Any time there is an error I can do a CTRL-F5 and the page loads correctly without any error.  When the error occurs, it is near instantaneous.  It is not happening after 7 seconds (the default, I believe) so the "timeout" message appears to be false.
The most common error being seen is this one:
Uncaught Error: Load timeout for modules: async!https://maps.googleapis.com/maps/api/js?key={{REMOVED_API_KEY}}_unnormalized2,jquery
https://requirejs.org/docs/errors.html#timeout
    at makeError (require.min.js:1)
    at R (require.min.js:1)
    at require.min.js:1

I'm not sure if it is just the error reporting format, but notice that there is extra text being added after the API key.
Another errors that happens at times is:
Uncaught TypeError: Cannot read property 'initializePage' of undefined
    at require-config.js:48
    at Object.execCb (require.min.js:1)
    at e.check (require.min.js:1)
    at e.<anonymous> (require.min.js:1)
    at require.min.js:1
    at require.min.js:1
    at each (require.min.js:1)
    at emit (require.min.js:1)
    at e.check (require.min.js:1)
    at enable (require.min.js:1)

"initializePage" is a function that is defined and usually works fine.  The background information below will show how it is setup.
A third error that can appear at times:
Uncaught Error: Mismatched anonymous define() module: function(){return t.hljs}
https://requirejs.org/docs/errors.html#mismatch
    at makeError (require.min.js:1)
    at T (require.min.js:1)
    at require.min.js:1

I can't find anything in the project with "return t.hljs", so I guess this has to be generated code.
Now comes the strangest part.  This site uses Identity Management to authenticate users.  If the user is not logged in, no errors are occurring.
For background, first, here is the config I'm using for RequireJS:
function requireConfig(mapsApiKey) {
    var mapsUrl = "https://maps.googleapis.com/maps/api/js?key=" + mapsApiKey;
    require.config({
        baseUrl: '/js',
        paths: {
            'async': '../lib/requirejs-plugins/async.min',
            'jquery': '../lib/jquery/jquery.min',
            'bootstrap': '../lib/twitter-bootstrap/js/bootstrap.bundle.min',
            'datatables.net': '../lib/datatables.net/jquery.dataTables.min',
            'datatables.net-bs4': '../lib/datatables.net-bs4/dataTables.bootstrap4.min',
            'datatables.net-responsive': '../lib/datatables.net-responsive/dataTables.responsive.min',
            'datatables.net-responsive-bs4': '../lib/datatables.net-responsive-bs4/responsive.bootstrap4.min',
            'jquery-validation': '../lib/jquery-validate/jquery.validate.min',
            'jquery.validate.unobtrusive': '../lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min',
            'select2': '../lib/select2/js/select2.min'
        },
        shim: {
            'jquery': {
                exports: 'jquery'
            },
            'bootstrap': {
                deps: ['jquery'],
                exports: 'Bootstrap'
            },
            'datatables.net-bs4': {
                deps: ['jquery', 'bootstrap', 'datatables.net']
            },
            'datatables.net-responsive-bs4': {
                deps: ['datatables.net-bs4', 'datatables.net-responsive']
            },
            'jquery.validate': {
                deps: ['jquery']
            },
            'jquery.validate.unobtrusive': {
                deps: ['jquery', 'jquery-validation']
            },
            'select2': {
                deps: ['jquery']
            }
        }
    });

    define('gmaps', ['async!' + mapsUrl], function () { return window.google.maps; });
}

function requireSite() {
    require(['site'], function (site) {
        site.initializePage();
    });
}

Next, here is my "libman.json" file so you can see what versions of various libraries are in use:
{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "jquery@3.5.1",
      "destination": "wwwroot/lib/jquery/"
    },
    {
      "library": "twitter-bootstrap@4.6.0",
      "destination": "wwwroot/lib/twitter-bootstrap/"
    },
    {
      "library": "select2@4.0.13",
      "destination": "wwwroot/lib/select2/"
    },
    {
      "library": "font-awesome@5.15.2",
      "destination": "wwwroot/lib/font-awesome/"
    },
    {
      "library": "datatables.net@1.10.23",
      "destination": "wwwroot/lib/datatables.net/"
    },
    {
      "library": "datatables.net-responsive@2.2.7",
      "destination": "wwwroot/lib/datatables.net-responsive/"
    },
    {
      "library": "datatables.net-responsive-bs4@2.2.7",
      "destination": "wwwroot/lib/datatables.net-responsive-bs4/"
    },
    {
      "library": "datatables.net-bs4@1.10.23",
      "destination": "wwwroot/lib/datatables.net-bs4/"
    },
    {
      "library": "jquery-validation-unobtrusive@3.2.11",
      "destination": "wwwroot/lib/jquery-validation-unobtrusive/"
    },
    {
      "library": "jquery-validate@1.19.2",
      "destination": "wwwroot/lib/jquery-validate/"
    },
    {
      "library": "require.js@2.3.6",
      "destination": "wwwroot/lib/require.js/"
    },
    {
      "library": "requirejs-plugins@1.0.3",
      "destination": "wwwroot/lib/requirejs-plugins/",
      "files": [
        "async.min.js",
        "async.js"
      ]
    }
  ]
}

Here is the identity setup section from Startup.cs:
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddRoles<ApplicationRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>();
services
    .AddAuthentication()
    .AddGoogle(options =>
    {
        var googleAuthNSection = Configuration.GetSection("Authentication:Google");
        options.ClientId = googleAuthNSection["ClientId"];
        options.ClientSecret = googleAuthNSection["ClientSecret"];
    });

I've been searching through various resources for over a week and although I see lots of related messages to the errors I'm seeing, none appear to be the exact pattern and none of the recommended remedies of worked.  Hopefully someone out there has an idea of what interaction is going on here or can suggest an alternate pattern to get this all working.
Edit with information requested by Damian
On pages with the 'initializePage' error, only the require.js script and the script with the require setup is loading.  No resources defined to require.js (including the site.js file) are being loaded and there is no attempt to load them.
CTRL-F5, and the page comes up just fine.
On pages getting the "Mismatched anonymous" error with "return t.hljs", all of the required scripts (site, jquery, bootstrap, and google-maps) are loading in under 3 ms.
CTRL-F5 fixes these pages as well.
It took a while but I finally triggered a page that had the module timeout error with google maps.  On that one, the require.js and require setup scripts loaded, followed by the site.js and the async module for require.  Noe of the other scripts (mentioned above) were loaded and there were no callouts to load them.


text:
Q: Is remapping table column names supported in JOOQ JOOQ documentation explains a way to map JOOQ tables to different schema and table names. What about column names? In other words, can I run my JOOQ backed code on a similar structured set of tables where column names are different from the one hard coded, but have the same meaning. For example
PEOPLE(FIRST_NAME, LAST_NAME) -> EMPLOYEES(FName, LName)
Thanks,
Max

A: As of jOOQ 3.9, this is not yet supported out of the box. Here's the relevant feature request https://github.com/jOOQ/jOOQ/issues/2949
A workaround would be to implement a VisitListener, which would take care of such translation on a lower AST transformation level.


text:
Q: How to add custom logrotate configuration files to Ubuntu core? Is there a way to add custom logrotate configuration files to Ubuntu core? /etc/logrotate.d is not writable. Should /writable/system-data/etc/logrotate.d be sourced? It doesn't seem to work and also is not referenced in the /etc/logrotate.conf file.

A: That would be because /etc/logrotate.d is a directory and not a writable file. You can add a file under /etc/logrotate.d/ for your specific application, or edit one of the existing default ones.
Here is what my system has by default:
$ ls /etc/logrotate.d/
apache2  consolekit  jockey-common  rsyslog            unattended-upgrades
apport   cups        pm-utils       speech-dispatcher  upstart
apt      dpkg        ppp            ufw

Good luck!

A: This is the best answer I came up with assuming a docker environment. I'd appreciate hearing if someone has a better answer:
It turns out for Ubuntu Core that /etc/logrotate.d is not writable. It sounds like 3rd-party scripts are not supported for logrotate. Same issue with cron.
I happen to be using docker so I created a docker container that periodically calls logrotate on my script. A bit of a hack but with "restart: always" it seems reliable.


text:
Q: Anaconda navigator is not opening I have had this problem for quite some time now. Every time I restart my PC, the anaconda navigator, prompt or any other application don't open. Instead, the python shell opens up. The message in the shell goes like this.
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Well, I went to the given link and there it said to run conda activate myenv where myenv is the path directory. When I try this out in the terminal, the error message is something like this:
'conda' is not recognized as an internal or external command, operable program or batch file.
Can somebody direct me and help me out?

A: Make sure you have installed python 2.7 or python 3 version before installing anaconda navigator and also choose appropriate python verion which u have  preinstalled...and then select accordingly while installing conda navigator


text:
Q: Calculations for grid based games For a grid game to match items in chains of 3 or more, how can a difficulty be calculated?
I have a number of moves, and a grid with a cell count and an element type count n, e.g. 6 different elements/types. Matching elements gives 20 score per element in a chain, e.g. 60 for a 3 element chain. If additional matches occur during the same move a multiplier is applied so e.g. the second 3 element chain will give 120 points.
I would like to be able to use a formula with the variables and then apply a difficulty variable to the outcome, so e.g. there could be a minimum score, and then 3 other levels or rankings for the score they got.
How can this be calculated with the given variables and an additional difficulty variable?
The game is a one player game, which fills a grid with elements/objects. The player then gets a number of moves. When they match a sequence in the grid, new items are dropped in to replace them, which could trigger new matches.

A: This isn't a very mathematical answer, but I don't think there is a good mathematical approach. I would simply create a program to play completely randomly. Have it play maybe ten thousand games and look at the statistics on what kinds of scores it gets. Base your target scores on percentiles: On easy mode, you simply have to get a better score than in 70% of those random games, on normal mode better than 90%, and on hard mode better than 99%. You will have to adjust those numbers by actually testing your game out with real human players to find out if they're too high or too low.


text:
Q: Scroll into a RichTextBox using buttons c# How can I code two buttons for scrolling into a RichTextBox up and down ? What I try :
private void btnScrollTop_Click(object sender, EventArgs e) {
            if (rtbDefinitie.SelectionStart >= 30) {
                rtbDefinitie.SelectionStart -= 30;
                rtbDefinitie.ScrollToCaret();
            }
        }
private void btnScrollBottom_Click(object sender, EventArgs e) {
            if (rtbDefinitie.SelectionStart <= 30) {
                rtbDefinitie.SelectionStart += 30;
                rtbDefinitie.ScrollToCaret();
            }
        }

But it's seems to get stuck after I press scroll down button twice. What I need to do ?

A: The second click seems to be interpreted as DoubleClick, so you could just register this event too and put the same code behind it (or replace the 30 by 60)
EDIT:
If the Application stucks, because it's working and does not have the time to update the GUI, you could try to call Application.DoEvents(); after every raised Clickevent:
private void btnScrollBottom_Click(object sender, EventArgs e) {
            if (rtbDefinitie.SelectionStart <= rtbDefinitie.TextLength) {
                rtbDefinitie.SelectionStart += 30;
                rtbDefinitie.ScrollToCaret();
                Application.DoEvents();
            }
        }


text:
Q: HTTP Errors with AWS ALB I am having basic HTTP related issues when sending a python post request to my AWS ALB which routes traffic to a Java WebSocket.
In terms of my client I am trying to send an HTTP post by sending the following python string to my ALB:
headers = """\
    POST / HTTP/1.1\r
    Content-Type: {content_type}\r
    Content-Length: {content_length}\r
    Host: {host}\r
    Connection: close\r
    \r\n"""

    post_dict = {"totalPartitionCount": 3}
    body = bytes(json.dumps(post_dict),encoding="utf-8")
    header_bytes = headers.format(
        content_type="text/plain",
        content_length=len(body),
        host=str(albAddr) + ":" + str(8080)
    ).encode('utf-8')

    payload = header_bytes + body

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((albAddr, 8080))

    s.sendall(payload)
   ...

But in running this I am returned a 400 Bad format Error.
Similarly, my health checks to my AWS ALB are failing from the java server when sending an http response:
        ServerSocket s = new ServerSocket(8081);
        while(true) {
            Socket sock = s.accept();
            System.out.println("Sending Status OK...");
            String httpResponse = "HTTP/1.1 200 OK\r\n";

            byte[] out = httpResponse.getBytes(StandardCharsets.UTF_8);

            try {
                sock.getOutputStream().write(out);
            } catch (IOException e) {
                System.out.println("Error in Writing Health Check Response");
            }
            System.out.println("OK status sent.");
            sock.close();

        }

Am I making simple mistakes regarding HTTP? I have looked at multiple different sources on how http requests are being formatted in python and java and have tried to use those but haven't found any luck. Thanks.

A: What is the ALB health check status to your java application? (to / 8081)
Is the target group in InService status? There are some reasons the it's not Inservice
a bit confused - are your ALB listening to tcp/8080 and the health check is on tcp/8081?
The 400 error looks like that is related to the backend code. not the health check.
What if you send the request to the backend without the ALB? Coudl you get a valid response from your python code?


text:
Q: How do I label expression alternatives with same precedence level? With antlr4 I can label rule alternatives like this:
e : e '*' e # Mult
  | e '+' e # Add
  | INT # Int
  ;

From what I understand, in the rule above, Mult has higher precedence over Add because Mult comes before Add in the list of alternatives.
So for instance, if I wrote:
e : e '*'       e # Mult
  | e ('+'|'-') e # Add
  | INT # Int
  ;

The + in 1 + 2 and - in 4 - 2 have the same precedence.
However, now the alternative is not in the top level. Is there a way I can label the rules e '+' e # Add and e '-' e #Sub separately while still having both alternatives have same precedence level?

A: I'm afraid not. You can label the op though with op=('+'|'-') and then get the ctx.op() value during a tree walk and ask for its token type.


text:
Q: Handling Form Upload Success with JQuery to Django App How can I submit a form, uploading a file, to a Django app using JQuery so that I can capture the "success" handler?
I am able to upload a file my Django app using a regular form submit, but I am redirected to a new after the POST is complete (naturally).
The Django views.py snippet for generating the page is:
def adminImportView(request):
    """
    """
    if request.method == 'POST':
        form = UploadFileForm(request.POST, request.FILES)
        if form.is_valid():
            handle_file(request.FILES['file'])
            return HttpResponseRedirect(reverse('lobbyVisitorLog.view.adminView'))
    else:
        form = UploadFileForm()

    return render(request, 'utils/importDatabase.html', {'form': form});

Which, when no form is being submitted, generates a form block:
<form id="dbImportForm" action="/visitorLog/admin/import/" enctype="multipart/form-data" method="post">
  {% csrf_token %}

        Browse...
        {{ form.file }}

      <button type="submit" class="btn btn-primary start" id="buttonImport">

        Start Import
      </button>

</form>

But, I would to avoid loading a new page when the process is complete.  If I change the button to a simple link and hock it using JQuery my form validation fails.  My latest attempt at the Javascript block is:
$('#buttonImport').click(function()
{
  if ($('#id_file').val() == '')
  {
    alert("empty file, can't submit!");
    return false;
  }

  $.post(
    '/visitorLog/admin/import/',
    $('#dbImportForm').serialize(),
    function(data)
    {
      alert("all done!");
    },
    "json"
  );
})

How can I tweak my JQuery POST call to properly validate the form on the server end?

A: Use jQuery Form Plugin .
It support AJAX file uploads.
Another solution without Form Plugin is here How to send FormData objects with Ajax-requests in jQuery? but have limited support in browsers.


text:
Q: How to open an extenal form modal with Angular.js using multiple views with parallel states I am developing a one-page application and I'm currently working on the website's navbar. I want to put in the navbar a dropdown menu that lets the user connect/register to the website if he's not currently connected and to logout/change settings if he already logged in.
The website makes use of ngRoute to load the main page content so the page already has a ng-view (I read that you can only have one per page).
I would like to open a modal with a login form when the user clicks on the link "Login" in the dropdown menu (and a modal with a registration form when the user clicks on "Register").
I know how to add a modal to the page but I would like to load it from an external template file only the first time the modal is opened (just like the main content view works).
The website will probably have several modals and I don't want to put a lot of hidden modals every-time a page is generated.
As you may have noticed, I'm new to Angular.js, so I'm wondering if the library provides me an easy way to do this.
To explain what I'm trying to do in an easier way:

*

*I'd ilke to have a /template/loginForm.html file that contains the login form in a modal

*I'd like have a link in the dropdown menu that loads the file ONLY if it was never loaded before (just like ngRoute does)

*Everytime the link is clicked the modal is opened (URL doesn't change)

I would solve this by adding variables that indicate which modals are already loaded (new modals would be appended to the page with a unique ID) but I'm not sure this would be a great solution.

A: You can make use of AngularUI Router where you would have possibility of nested states and views.
So you would have your index page

    Main Page
    Other Page

Then

main page

Login
Register

Define you login and register page

Login Page

Register Page

Controller would be configured as,
myApp.config(function($stateProvider, $urlRouterProvider) {
  //
  // For any unmatched url, redirect to /state1
  $urlRouterProvider.otherwise("/main");
  //
  // Now set up the states
  $stateProvider
    .state('main', {
      url: "/main",
      templateUrl: "partials/main.html"
    })
    .state('main.login', {
      url: "/login",
      templateUrl: "partials/main.login.html",
      controller: function($scope) {
      }
    })
    .state('main.register', {
      url: "/register",
      templateUrl: "partials/main.register.html",
      controller: function($scope) {
      }
    });
});

Its pretty similar to ngRoute and simple. Detailed instructions are given on github page.

A: I managed to solve the problem by using multiple separate views in the same page (which was my goal). I couldn't do that with the library ngRoute so I added ui-router to my project.
As far as I understood ui-router doesn't support multiple separate (no parent-child relations) views in the same page with parallel states (it does support named views but you can't just update one at a time without clearing the others, if I'm not mistaken).
In the end I solved the problem by importing ui-router-extras that adds a lot of useful features to ui-router. You can see a nice modal example here (which is what I was trying to accomplish).


text:
Q: python fernet - decrypt exception InvalidToken - user login authentication I am trying to implement the solution (encryption of data with password) provided in the fernet docs under Using passwords with Fernet.
Since I would also like to use the same password for user login authentication I would like to know if it is safe to assume that if the encrypted data can't be decrypted with another (e.g. false) password, since I get the exception cryptography.fernet.InvalidToken, that also the user authentication failed because the provided password does not match the password used to encrypt the data?
In other words, do I need to check the authentication also using a separate logic with an implementation of a hashed password or can I rely solely on the fernet exception cryptography.fernet.InvalidToken for this?


text:
Q: GPUImage terminates due to [AVAssetWriter startWriting] Cannot call method when status is 3' I am having an issue running GPUImage. I have modified SimpleVideoFileFilter program(replaced the filter with a chromakeyfilter) and am using my own video. My program is terminating due to the following error:
[AVAssetWriter startWriting] Cannot call method when status is 3'
I have gone through the forums but not sure why the moviewriter is closing and then someone is writing to it.
I am using iPhone4 running iOS 7.0
Any clues are greatly appreciated.  Thanks much!

A: Check whether your destination file exists already. If it does, remove it.

A: I was trying to add the file to a directory which did not exist. Example : /Videos/Video.mov , leaving it just /Video.mov worked.

A: movieFile1 = [[GPUImageMovie alloc] initWithURL:movieFileURL1];

movieFile2 = [[GPUImageMovie alloc] initWithURL:movieFileURL2];
movieFile2.runBenchmark = YES;
movieFile2.playAtActualSpeed = NO;

filter = [[GPUImageChromaKeyBlendFilter alloc] init];
[(GPUImageChromaKeyBlendFilter *)filter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
[(GPUImageChromaKeyBlendFilter *)filter setThresholdSensitivity:0.4];

GPUImageView *filterView = (GPUImageView*)displayView;
[filter addTarget:displayView];

[movieFile1 addTarget:filter];
[movieFile2 addTarget:filter];

NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];

movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(1920.0, 1280.0)];
[filter addTarget:movieWriter];

movieWriter.shouldPassthroughAudio = YES;
movieFile1.audioEncodingTarget = movieWriter;
[movieFile1 enableSynchronizedEncodingUsingMovieWriter:movieWriter];

[movieWriter startRecording];
[movieFile1 startProcessing];
[movieFile2 startProcessing];

[movieWriter setCompletionBlock:^{

   [filter removeTarget:movieWriter];
   [movieWriter finishRecording];
}];

A: Ok, I have a few ideas for you.
When you say "it just shows a frame and never plays the video" we have a good indication that your entire processing pipeline from start to finish is functional exactly once, then stops working.
That tells us that you are stringing things together correctly, but some of the components don't exist longer than a single frame buffer cycle, and subsequently the whole process stops.
it looks like filter and movieWriter are scoped to the class (I'm assuming they're not properties from the lack of an underscore, _filter and _movieWriter). So they will live on after this method has finished (correct me if I'm wrong...)
I think where you are encountering trouble is your (GPUImageView*)displayView
This should probably be declared as a class property (although it could work as just a variable) and then instantiated through the nib or the viewDidLoad method of the view controller.
As you have it now, this line: GPUImageView* filterView = (GPUImageView*)displayView; is making an assignment for filterView which is not used (and therefore unnecessary). It's not clear if displayView really is an instance of GPUImageView or if it will still be in existence when the current method finishes. (in fact you say it "is a UIView that I have programmatically created")
displayView will have to be a subclass of GPUImageView for this whole thing to work, and it will have to be scoped to the class, and not the method.
Declare it like this:
@property (strong, nonatomic)GPUImageView* displayView;

and then instantiate it and add it to your view hierarchy from within viewDidLoad

A: if (outputPath) {
                finalURL = [[stongObj tempFileURL] copy];
                DebugLog(@"Start Filter Processing :%@",finalURL);
                DebugLog(@"movieUrl :%@",movieUrl);

         //   [CSUtils removeChuckFilePaths:@[outputPath]];

            //Create Image Movie Object
            _movieFile = [[GPUImageMovie alloc] initWithURL:outputPath];
            //_movieFile = [[GPUImageMovie alloc] initWithURL:[[NSBundle mainBundle] URLForResource:@"videoviewdemo" withExtension:@"mp4"]];
            _movieFile.runBenchmark = NO;
            _movieFile.playAtActualSpeed = YES;
            _movieFile.delegate = self;

            //Movie Writer Object
            _movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:finalURL size:CGSizeMake([UIScreen mainScreen].bounds.size.height,[UIScreen mainScreen].bounds.size.height)];
            //_movieWriter.delegate = self;

            //Create Selecetive GPU Image Filter
            [stongObj setGpuOutputFilter:selectedVideoFilterType];

            //Create Group Filter
            groupFilter = [[GPUImageFilterGroup alloc] init];
            [groupFilter addTarget:imageOutputFilter];

            // Only Single Filter is implemented.
            //Apply Initial and Terminal Filter
            [(GPUImageFilterGroup *)groupFilter setInitialFilters:[NSArray arrayWithObject:imageOutputFilter]];
            [(GPUImageFilterGroup *)groupFilter setTerminalFilter:imageOutputFilter];

            //_movieWriter -> groupFilter ->_movieFile
            [_movieFile addTarget:groupFilter];
            [groupFilter addTarget:_movieWriter];

            _movieWriter.shouldPassthroughAudio = YES;
            _movieFile.audioEncodingTarget = _movieWriter;
            [_movieFile enableSynchronizedEncodingUsingMovieWriter:_movieWriter];

            //Start Recording
            [_movieWriter startRecording];
            //Start Processing
            [_movieFile startProcessing];

            __weak typeof(self) weekSelf=self;
            [_movieWriter setCompletionBlock:^{

                __strong typeof(self) stongSelf=weekSelf;

                DebugLog(@"Movie Write Completed");
                //Finish Recording.
                [stongSelf.movieWriter finishRecording];

                //Release all object
                // [self releaseAllObject];

                //remove movieUrl,audioUrl,outputPath
                [CSUtils removeChuckFiles:@[movieUrl,audioUrl,outputPath]];

            }];

[_movieFile startProcessing]; app get crash in iOS 8 on this line but working fine on iOS 7

A: @Seasia Creative ,I have no enough reputation to add a comment by that list,I create a new list to answer U.
I check the output URL,console log "/var~~~~/tmpmerge.mp4",so i realize that ,i miss a "/" --->"/var~~~~/tmp/merge.mp4".
If the url is no correct, project runs into the same error.
hope to help some.


text:
Q: Does this java homework involve boolean? How to implement the loop? I am almost a complete beginner.
I need to write a program that asks user to input a binary number, verifies whether the number is in fact binary, and then count the number of 1's in the binary number.
So far I have this:
import java.util.Scanner;
import java.text.DecimalFormat;

public class BinaryWords
{
    public static void main( String [] args )
    {
    int binaryNumber1;
    int binaryNumber2;
    int binaryNumber3;
    int binaryNumber4;
    int binaryNumber5;
    int binaryNumber6;
    int binaryNumber7;
    int binaryNumber8;
    int binaryNumber9;
    int binaryNumber10;
    int binaryNumberWhole = binaryNumber1 + binaryNumber2 + binaryNumber3
            + binaryNumber4 + binaryNumber5 + binaryNumber6 + binaryNumber7
            + binaryNumber8 + binaryNumber9 + binaryNumber10;

    if 1<binaryNumber1<0

        then final int SENTINEL = binaryNumber1;

    System.out.println( "This program verifies a binary number"
            + "representing a word and then"
            + "counts how many 1's are in that number");

    System.out.println("Please enter a binary number representing a word");

Not pretty, I know!  I am confused as to how to read each binary number in the binary sequence and check for 0 or 1.
Any help would be greatly appreciated!

A: You can read user input as String and then analyse each character of that String if its not equal to 0 or 1.
In the same loop you can also count how many characters are 1's.
Do you know how to read user input in Java?
Best regards,
Miguel

A: Create a String variable and use it to receive the input from the user. When they do you loop through every character of this string checking if it is a number and if it is 0 or one.
You need to learn how to get an input from the console so take a look on how to use the Scanner class on java.
So, you have a String, a for loop and two if conditions (maybe you choose to use an try block instead to convert it to a number)
As you are learning I will not provide the code to it so you can be able to figure out yourself.


text:
Q: WPF Command Not Executing My main window is currently displaying the YearView in a content control via DataTemplated  YearViewModel. When I click the month button on the YearView I want the main window to instead display the MonthView. The MainViewModel (view model of the main window not shown) retrieves the view model to be displayed from '_navigationStorage.CurrentViewModel' as seen in NavigateMonthCommand.Execute(). But when I click the month button, NavigateMonthCommand.Execute() is never called.
Is the month button binding not working? In YearView.xaml should I be specifying the DataContext differently?
MainWindow.xaml
<Window x:Class="Calandar.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodels="clr-namespace:Calandar.ViewModels"
    xmlns:views="clr-namespace:Calandar.Views"
    xmlns:local="clr-namespace:Calandar"
    mc:Ignorable="d"
    Title="MainWindow" Height="450" Width="800">
    <Grid Background="LightSlateGray">

        <ContentControl Content="{Binding CurrentViewModel}">
            <ContentControl.Resources>
                <DataTemplate DataType="{x:Type viewmodels:YearViewModel}">
                    <views:YearView/>
                </DataTemplate>
                <DataTemplate DataType="{x:Type viewmodels:MonthViewModel}">
                    <views:MonthView/>
                </DataTemplate>
            </ContentControl.Resources>
        </ContentControl>

    </Grid>
</Window>

YearView.xaml
<UserControl x:Class="Calandar.Views.YearView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:Calandar.Views"
         xmlns:viewmodels="clr-namespace:Calandar.ViewModels"
         mc:Ignorable="d"
         d:DesignHeight="450" d:DesignWidth="800">
    <Grid Background="White" DataContext="viewmodels:YearViewModel">
        <StackPanel>
            <TextBlock Text="Year" FontSize="55"/>
            <Button Content="Month" Command="{Binding NavigateMonthCommand}"/>
        </StackPanel>
    </Grid>
</UserControl>

YearViewModel.cs
public class YearViewModel : ViewModelBase
{

    public ICommand NavigateMonthCommand { get; }

    public YearViewModel(NavigationStorage navigationStorage)
    {
        NavigateMonthCommand = new NavigateMonthCommand(navigationStorage);
    }

}

NavigateMonthCommand.cs
public class NavigateMonthCommand : CommandBase
{

    private readonly NavigationStorage _navigationStorage;

    public NavigateMonthCommand(NavigationStorage navigationStorage)
    {
        _navigationStorage = navigationStorage;
    }

    public override void Execute(object parameter)
    {
        ;
        _navigationStorage.CurrentViewModel = new MonthViewModel();
    }

}

CommandBase.cs
public abstract class CommandBase : ICommand
{
    public event EventHandler CanExecuteChanged;

    public bool CanExecute(object parameter) => true;

    public abstract void Execute(object parameter);

    public void OnCanExecuteChanged()
    {
        CanExecuteChanged?.Invoke(this, new EventArgs());
    }
}

A: Look this one
Without iNotifyPropertyChanged Viewmodel cannot get data from view interface. You must connect properly. You should derive ViewModelBase from INotifyPropertyChanged.
I think you have created your BaseViewModel, you can create the method there.
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string PropertyName)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));
}

you need to call it while doing property set operation in the YearViewModel you specified. Sample:
        private string surName;
        public string SurName
        {
            get { return surName; }
            set { surName = value; OnPropertyChanged(nameof(SurName)); }
        }

Good Luck


text:
Q: Spark DataFrame ArrayType or MapType for checking for value in column I have a pyspark dataframe, and one column is a list of IDs. I want to, for example, get the count of rows which have a certain ID in it.
AFAIK the two column types relevant to me are ArrayType and MapType. I could use the map type because checking for membership inside a map/dict is more efficient than checking for membership in an array.
However, to use the map I would need to filter with a custom udf rather than the built in (scala) function array_contains
with a MapType I can do :
from pyspark.sql.types import BooleanType
from pyspark.sql.functions import udf

df = spark.createDataFrame([("a-key", {"345": True, "123": True})], ["key", "ids"])

def is_in_map(k, d):
    return k in d.keys()

def map_udf(key):
    return udf(lambda d: is_in_map(key, d), BooleanType())

c = df.filter(map_udf("123")(df.ids)).count()

or with an ArrayType I can do :
from pyspark.sql.functions import array_contains

df = spark.createDataFrame([("a-key", ["345", "123"])], ["key", "ids"])
c = df.filter(array_contains(df.ids, "123")).count()

My first reaction is to use the MapArray because checking for membership inside the map is (I assume) more efficient.
On the other hand the built in function array_contains executes scala code and I assume that whatever scala defined function I call is going to be more efficient than returning the column dict to a python context and checking k in d.keys().
For checking membership in this (multi-value) column, is it best to use the MapType or ArrayType pyspark.sql.types?
Update
There is a column method pyspark.sql.Column.getItem which means I can filter by membership without a python udf

A: Maps are more performant, in Scala + Spark I used
df.where(df("ids").getItem("123") === true)

it uses standard Dataframe API and df("ids").getItem("123") returns Column with value of the map or null, it will work at Spark's native speed. Pyspark developers say that Pyspark has that API as well.


text:
Q: Print iterations when loop is inside a function R I am trying to get a loop inside a function.
So the main idea is that you get a var model, periods for forecasting, the training set, and the real data (for the forecasted period).
So I am making up this function, that reorganizes the data and computes the MSFE, the loop works fine! But as soon as it is inside a function, it won't print the results in the console.
Here I asked about the loop, so I know it is working fine.
Since the desired output is text, I don't want to store the sentences. Just print them in the console, I don't know how to make it.
Thanks in advance!

This is the function:
MSFE <- function(var, periods, train, test){

  # Now for each variable compute the MSFE
  ## Recall that MSFE is mean((real-predicted)^2)

  # var is the model,
  # periods is the forecasted period
  # train is the training data (1971m1-2003m12)
  # test is the real data (2004m1-2004m12)
  fcast_data <- forecast(var, h=periods)
  test <- head(test, periods)

  fcast_data <- fcast_data %>%
    as.data.frame() %>% select(Time, Series, `Point Forecast`) %>%
    spread(key="Series", value = `Point Forecast`) %>%
    mutate(Time=toupper(Time),
           Time=gsub(" ","",Time),
           Time=paste0("01",Time),
           Time=dmy(Time)) %>% arrange(Time) %>% select(-Time)

    for(i in names(train)){
    msfe <- paste("The Mean Squared Forecast Error for",i,"is:",mean((test[,i]-fcast_data[,i])^2))
    print(msfe)
  }

}


text:
Q: asp.net ValidationSummary and User Controls I'm doing a webform in .Net 3.5. I have a number of user controls on a page that have validation (mostly required fields) in the user controls. On the main page I have a validation summary.
The validation summary shows the errors correctly. The problem is when there's a field in a user control that is required and I fill it in, the validation message goes away but it still shows in the validation summary.
The code for the validation summary is:
    <asp:ValidationSummary ID="valSummary" runat="server" ShowSummary="true"
        DisplayMode="BulletList" CssClass="RequiredMessage" EnableClientScript="true"
        HeaderText="You must enter a value in the following fields:" />

The validation works correctly just appears as if in a user object it doesn't update unless a postback is done.
Is there something I need to add to the user object?
TIA - Jeff.

A: Try to add the same ValidationGroup (for example ValidationGroup="MyGroup") to all validation controls and ValidationSummary control.
PS. Please show the validation controls code.


text:
Q: Access to the path 'xxx' is denied (where 'xxx' is a folder) I know this has been asked before many times, but I have browsed tens of similar questions without help.
This error is showed when my asp.net 4.0 application tries to access a folder on my local drive, doing this:
XmlTextReader confReader = new XmlTextReader (filename);
while (confReader.Read())  // <- error line
{
  // do something
}

In my web.config I have <Identity Impersonate="true">. For the folder I have assigned full-access to:
everyone
IIS APPPOOL\<custom apppoolname>
NETWORK SERVICE

Debugging the application, I can put up a watch which evaluates this call right before the incriminated line:
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

the call shows the current user is IIS APPPOOL\<custom apppoolname>.
I'm on Windows 7 64bit with Sp1. I know it's probably something stupid but I have already spent an awful amount of time on this.
Edit:
The problem was in the variable "filename", which pointed to the right folder, but for a configuration problem the filename was missing (i.e. the content was "c:\data\" instead of "c:\data\file.xml"). The Asp.net error was actually confusing, since I had all the right permissions to access that folder. DJKRAZE pointed me to the right direction.

A: Here is what I would suggest checking
where are you declaring filename..?
Does the file even exist..?
do you have rights to that folder..? have you tried running VS as Admin..? do you have Virtual Directory setup for the web app..sounds like you have a few things configured improperly as well but can't really tell based on the code for starters this line System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
 should yield your domain\\username or compuername\\username
Glad that FileName was all it was

A: IIS requires the path to a folder in the server machine has rights for Anonymous user login to access.
Make sure the user Anonymous has the rights to access the folder.


text:
Q: Is saying "if ( $a != null && $a == 5)" the same as "if ($a == 5)" First off, sorry if this is answered somewhere else.  I did a brief search, but wasn't sure how to ask in search terms.
I'm looking at some code and came across lot's of statements like this:
if ( ($a != empty_or_null_or_notDefined && $a == 5 )

Is this the same as just saying:
if ( $a == 5 )

?
(language is PHP.)

A: At a purely logical level, presuming & is the local and operator, then $a being 5 precludes it from being null.
That said, in some languages, and short circuits (that is, if one operand fails, it does not check the others, as the whole clause is known to fail when one does). In this case, this could be a move for efficiency, although it's highly unlikely equality is an expensive enough operation to make this worthwhile (especially as PHP doesn't offer operator overloading).
As it's PHP, a single ampersand is a bitwise and operation, not a logical one, as such, it will not be lazy. Your topic has one ampersand, while the question itself has two, I think the latter is more likely to be the real option (as what is happening is a logical check), but you should clarify.

A: This code is necessary to avoid errors. If you try to access an undefined object, you get a fatal error.
Checking whether this object is not undefined before checking the value allows you to work around this error.
If the first check doesn't pass (is it undefined?), it won't check the value, thus will not throw an error.

A: Nice question.

Logic A # if ( ($a != empty_or_null_or_notDefined && $a == 5 )
Logic B # if ( $a == 5 )

Logic B is better than Logic A. (Regarding Algorithm complexity)
If your purpose is only Logic B, then you don't need Logic A.
NULL is critical. It can be stated as Undefined, Empty, etc.
Better to escape NULL comparison, because it is hard to debug.
I support @Florian Margaine's answer, absolutely, Every code is necessary to avoid errors.  If you try to access an undefined object, you get a fatal error. Checking whether this object is not undefined before checking the value allows you to work around this error.
And if comparison to NULL is necessary to you, then please have a look at the following resource
https://stackoverflow.com/questions/381265/better-way-to-check-variable-for-null-or-empty-string


text:
Q: an inequality for a positive random variable let be X positive random variable, $q \geqslant1$ . show that
$\sum\limits_{k \geqslant 0} {q{k^{q - 1}}P\left( {X \geqslant k + 1} \right) \leqslant E({X^q})}$.
this is what i did :
since we can write ${X^q} = \int_0^X {q{t^{q - 1}}dt} $, we have :
$E({X^q}) = \int_0^\infty  {q{t^{q - 1}}P(X \geqslant t)dt}$
how can i continue?


text:
Q: Planned Items & Tools does not remove Upload Changes queue when you uncheck the Use box When I click on the Use checkbox in the Planned Items and Tools screen, the blue upload changes column shows the icon that the record needs to be updated. When I uncheck the Use box, the Upload changes remains. So, even though I unchecked the box, the transaction still uploads to the server and the transaction is recorded instead of reset.
Whenever I checked on the row, Upload Changes would screen shows the queued record as "Use: true". What happens when I uncheck the the box? The Upload changes screen is as "Use: false". If I Upload Changes, the transaction goes through even though I unchecked the box and "Use: false"
I tried replacing "Use: false" with "Use: null" by creating a Verify Field, Modify Attribute event action where the condition was ${Use} == false . Then in Modify Attribute, for Use, I performed a test := Test (${Use} == false, null, null)
That made the Upload Changes show "Use: null" but the transaction still uploads and is processed as if I checked on the box.

A: Reset the record instead.

*

*Event Handling, Under Event Bindings add Verify Field

*Event Actions, add Execute Command, Event Condition is ${Use} == false

*Under Action Details, Command Type: RawCommand, Disposition: Client, ResetContext (check on), Command: resetRecord()

With this code in place, it has the desired effect of removing the transaction from the Upload Changes screen. Visually, you should see the upload changes icon disappear as well:


text:
Q: SQL using DISTINCT with INNER JOIN I currently have 9 columns joined using INNER JOIN
but i now want to remove the duplicates from column 1 which is CIFnumber.
If i use DISTINCT at the top of the query it does not function.
What could I do?
select distinct
    c.CIFNumber,c.FirstName,c.Surname,c.FamilyID,a.AccountID,
    b.ValuationAmount,d.NAME,ad.ID_Number,f.PrPlanner
from
    CUSTOMERINFORMATIONFILETBL c
inner join ACCOUNTTBL a on c.CIFNumber=a.CIFNumber
inner join BALANCETBL b on a.AccountID=b.AccountID
inner join FAMILYTBL f on c.FamilyID= f.FamilyID
inner join DIVISION d on f.DIVISION=d.ID
inner join ADDRESSTBL ad on c.CIFNumber=ad.CIF
where
    b.ValuationDate = '2017-09-30' and
    d.name = 'Wealth Management' and
    (
        ad.ID_Number= '' or
        ad.ID_Number is null or
        LEN(ad.ID_Number) < 13
    )

A: DISTINCT does function - it remove duplicates of the column set in specific SELECT statement. If DISTINCT did't remove duplicates for specific column in your column set it means that you have unique values in other columns.
If you need only one unique value from specific column and don't care about other column values, you can use window function.
   select *
   from (
    select c.CIFNumber,c.FirstName,...,
    row_number() over (partition by c.CIFNumber order by [some logic]) as rn
    from...) as a
    where rn = 1

A: You have two or more different values in at least one of your columns. If you dont care about some data you can use TOP 1 WITH TIES + ROW_NUMBER:
select top 1 with ties
            c.CIFNumber,
            c.FirstName,
            c.Surname,
            c.FamilyID,
            a.AccountID,
            b.ValuationAmount,
            d.NAME,
            ad.ID_Number,
            f.PrPlanner
from
    CUSTOMERINFORMATIONFILETBL c
inner join ACCOUNTTBL a on c.CIFNumber=a.CIFNumber
inner join BALANCETBL b on a.AccountID=b.AccountID
inner join FAMILYTBL f on c.FamilyID= f.FamilyID
inner join DIVISION d on f.DIVISION=d.ID
inner join ADDRESSTBL ad on c.CIFNumber=ad.CIF
where
    b.ValuationDate = '2017-09-30' and
    d.name = 'Wealth Management' and
    (
        ad.ID_Number= '' or
        ad.ID_Number is null or
        LEN(ad.ID_Number) < 13
    )
ORDER BY ROW_NUMBER() OVER (PARTITION BY c.CIFNumber, c.FirstName, c.Surname, c.FamilyID ORDER BY (SELECT NULL))

In my example I expect that c.CIFNumber, c.FirstName, c.Surname, c.FamilyID are unique.


text:
Q: Which relation between database tables will be proper? We have a database, which keeps informations about music - we have e.g. table for artists, bands, songs, albums etc. The next step is to allow users to rate those things, using 10-point grading scale.
What is the best way to remember all of users ratings? Surely I can create simple table, that contains user_id, rating_value and rated_thing_element, but obviously I can't join it to EVERY table.
Is it better then, to create, for example, one table called ratings and few additional tables, like ratings_albums, ratings_songs, ratings_bands etc. to bind, or maybe just few ratingsXXX tables for each of elements I've mentioned above?
I'm not sure which way I should go... or does it really matter.=?

A: My personal preference is to go with a normalized table and strict foreign references. So I would use artist_ratings, album_ratings, and song_ratings tables. To make queries easier, I would create views to represent the most often joined tables.
You can use a ratings table with no foreign keys (well except for the user reference), but you lose referential integrity enforcement. This table would be
ratings {
  id integer,
  userId integer, -- FK to users table
  referenceId integer, -- This is not a FK, but will contain the ID of the artist/album/song
  type char, -- a = album, A = artist, s = song
  rating int
}


text:
Q: Is a relation transitieve if and only if $R\circ R \subset R$? Let $X,Y, Z$ be sets and call $R\subset X\times Y$ a relation from $X$ to $Y$. Let $R$ be a relation from $X$ to $Y$ and S a relation from $Y$ to $Z$. Then composition relation is given by $S\circ R=\{(x,z)\in X\times Z: \text{there is a } y\in $Y$ \text{ such that }(xRy \text{ and } ySz)$.
I wonder whether a relation $R$ is transitive if and only if $R\circ R \subset R$.
Can someone help me?

A: First of all you should say $S\circ R=\{(x,z)\in X\times Z: \text{there is a } y\in $Y$ \text{ such that }(xRy \text{ and } ySz)$ instead of $S\circ R=\{(x,z)\in X\times Z: \text{there is a } y\in $Y$ \text{ such that }(xRy \text{ and } yRz)$.
Notice the change. And yes then your statement is true.


text:
Q: openCV Error module 'cv2.face' has no attribute 'createEigenFaceRecognizer' I am using python 3.7 and latest version of openCV. When i try to create an EigenFaceRecognizer. This error pops up "module 'cv2.face' has no attribute createEigenFaceRecognizer. I have got this bellow code from a Gitub repo.
recognise = cv2.face.createEigenFaceRecognizer(15, 4000)
recognise.load("Recogniser/trainingDataEigan.xml")

A: I believe the face module is in the opencv-contrib library. You can install it with
pip uninstall opencv-contrib-python
pip install opencv-contrib-python --no-cache-dir

Also the function got changed to this. load was replaced with read
import cv2

recognise = cv2.face.EigenFaceRecognizer_create()
recognise.read("Recogniser/trainingDataEigan.xml")


text:
Q: Git - pulling from master remote shows unstaged/changed files - how to determine source This post involves several questions, as I'm not sure what's going on and need to as well know how to determine source of problem.
The repo is stored at Git Hub and I have access to it.  When I do an initial git clone everything works fine and I see all the files.  This is a Laravel project but that's not the main question however might be relevant.
I am doing this in a bash kernel for Windows, perhaps that is relevant.
when I open source tree (or type git status), I show about 20 files that are "changed" but unstaged.  There should be no changed or unstaged files in master.  Also, apparently one folder /vendor/facebook/webdriver/lib/interactions/[files listed] has a lowercase i for interactions, and there is both a Interactions and an interactions folder in the lib folder.  Perhaps at some point some files were wrongly named or the folder case was changed and windows or mac didn't like it.
My questions are:
1. How do I determine if there are actually changed/unstaged files on a remote branch?
2. If not, what in my system would be causing this, especially anything relating to case sensitivity?

A: This turned out to be an issue with case sensitivity on a Windows platform, though I don't know the specifics of why, or when the discrepancy happened.
This problem went away when I called git clone ... from inside my virtual machine (a Vagrant box) versus calling git clone from Windows on the shared folder.  There were then NO unstaged/changed files that hadn't been committed.
Moral of the story appears to be, run git in the environment you're working on the file system on through ssh, not in the shared folder in Windows.


text:
Q: Norm on cotangent space and Hölder's inequality on Riemannian manifolds Let $(\mathcal{M}, g)$ be a Riemannian $n$-manifold. We know that
$$
  \Vert v \Vert_g := \langle v, v \rangle_g^\frac{1}{2}
$$
defines a norm on the tangent space $T_p \mathcal{M}$. Can we derive the norm $\Vert \cdot \Vert_*$ of $T_p^* \mathcal{M}$ from $\Vert \cdot \Vert_g$? Would simply defining $\Vert \omega \Vert_* := \Vert \omega^\sharp \Vert_g$ works?
In particular, I'm interested in knowing whether Hölder's inequality holds on $T_p \mathcal{M}$, i.e.
$$
  \sum_{k=1}^n \vert v_k w_k \vert \leq \Vert v \Vert_g \Vert w \Vert_* \, ,
$$
for any $v, w \in T_p \mathcal{M}$. (Though when $\Vert \cdot \Vert_*$ is defined to be $T_p^* \mathcal{M} \to \mathbb{R}$, that doesn't make sense.)
Is there any other definition of dual norm on tangent space of Riemannian manifold, such that Hölder's inequality holds?

A: I don't know what the $\sharp$ symbol means, but any scalar product $g(\cdot, \cdot) $on a finite dimensional vector space $X$ induces a natural isomorphism from $X$ to $X^*$ by mapping $v$ to $\omega_v$ by letting $\omega_v(w):= g(v, w)$.
You can request this to be an isometry, which induces a norm and a scalar product on $X^*$ in a natural way (so $||\omega_v||= ||v||$)
It's not difficult to see that then $g^*(\omega_v,\omega_w) = g(v,w)$.
These definitions easily carry over naturally and continuously to the tangent bundle construction.
(If that matches the inverse of your $\sharp$ map then your pertaining question is answered by yes :-)
I'm not sure what kind of Hölder inequality you want, but clearly $$||\omega_v(w)||= ||g(v,w)||\le ||v||\,||w|| = ||\omega_v||\,||w||$$
by the Cauchy Schwartz inequality for $g$ and using the fact that the map in question is an isometry.


text:
Q: I have read (programming in c 3rd edition book). I can't understand, what they have mentioned. Could anyone please explain the following paragraph? When a program terminates simply by executing the last statement in main, its exit
status is undefined. If another program needs to use this exit status, you mustn't let this
happen. In such a case, make certain that you exit or return from main with a defined
exit status.

A: What is says is that if you don't have a return statement from the main function, the returned value is indeterminate (just like missing a return statement from another function declared to return a value).
However this is no longer true. Since the C99 standard if there's no explicit return statement in the main function, the compiler will add an implicit return 0; at the end.


text:
Q: Netlogo - Flocking to others in agentset (as opposed to all turtles) Sorry, there probably is a simple answer to this problem, but I am relatively new to Netlogo and have spent a couple of days working on this to no avail, so any suggestions are really welcomed -thanks.
There is a great flocking method for flocking fish and birds (see MacLennan, 2007 (http://web.eecs.utk.edu/~mclennan/Classes/420-594-F07/NetLogo/Flock.html)  based on the Huth and Wissel (1992)) and I would like to adapt this flocking method, so that rather than flocking to your nearest three neighbours (who are all one homogeneous population), you only flock to those within your agentset, or more specifically, those in your own group (ignoring those outside of it).
I understand that one suggestion may be to create two different breeds at the beginning, e.g. deer and moose, and then you only flock to those who belong to the same breed. However, in my example, I have agents who reassess at each tick which group is most optimal to belong to, and flip between groups (which are defined through agentsets).
The original code (MacLennan, 2007), for a homogeneous population is as follows:
TO GO ;--------------------------------------------------------------------------------------------

set i 0                                            ; initializes variables used in finding neighbors
set distance_1 1000
set distance_2 1000
set distance_3 1000

   ; (below) determines ID numbers and distances for three closest neighbors; each turtle is
   ;   first checked to be visible (i.e., out of blind spot and in front of obstacles), and then
   ;   its distance is compared with that of neighbor_3.  If a bird is closer than neighbor_3,
   ;   it is then compared with neighbor_2 and (if it's closer than neighbor_2) with neighbor_1;
   ;   variables are then re-assigned to accomodate the new neighbor as one of the closest three.

repeat count turtles
  [ifelse not ((i = who) or in_blind_spot? or behind_opaque_obstacle?)
     [set dist distance turtle i
      ifelse dist < distance_3
        [ifelse dist < distance_2
           [set neighbor_3 neighbor_2
            set distance_3 distance_2
            ifelse dist < distance_1
              [set neighbor_2 neighbor_1
               set distance_2 distance_1
               set neighbor_1 i
               set distance_1 dist]
              [set neighbor_2 i
               set distance_2 dist
               repeat 2 [fd 0]]]                 ; (see note at end for explanantion of "fd 0")
           [set neighbor_3 i
            set distance_3 dist
            repeat 4 [fd 0]]]
        [repeat 6 [fd 0]]]
     [repeat 7 [fd 0]]
   set i i + 1]

set acceleration 0                                ; sets acceleration to zero

set target_1 calc_target neighbor_1 distance_1    ; calculates targets (see procedure below) based on
set target_2 calc_target neighbor_2 distance_2    ;   the headings and positions of each neighbor;
set target_3 calc_target neighbor_3 distance_3    ;   acceleration is set by the calc_target procedure

   ; (below) calculates a bird's composite target, weighting each individual target by the inverse
   ;   of distance to that neighbor

set target atan ((sin target_1) * 100 / distance_1 + (sin target_2) * 100 / distance_2 + (sin target_3) * 100 / distance_3)
                ((cos target_1) * 100 / distance_1 + (cos target_2) * 100 / distance_2 + (cos target_3) * 100 / distance_3)

   ; (below) turns bird towards target by a fraction specified by "flexibility"; random motion is also
   ;   included to an extent governed by "noise".  The "... + 540) mod 360) - 180" clause is necessary to
   ;   ensure that the bird turns in the right direction.  For example, if a bird is oriented at 0 degrees
   ;   and its target is 300 degrees, it should consider a 60 [ = ((0 - 300 + 540) mod 360) - 180] degree
   ;   turn to the left instead of a 300 [ = 300 - 0] degree turn to the right.

fd 1 + acceleration                               ; moves birds forward

end

I thought the easiest way to do this would be to keep as much of the original code as possible and then look to change the line of code
[set dist distance turtle i

as turtle means any turtle in the world rather than only those turtles within my group.
To do this, I thought about converting my agentset 'group-members' temporarily into a breed so that I could replace the word turtle i with groupmember i.. e.g.
create-groupies-from group-members
[set dist distance group-member i

However, I when I tried to used the create-<breed>-from code I received an error that 'Nothing named CREATE-GROUPIES-FROM has been defined, even when this breed was or was not included in breeds [ ]
Therefore, I tried to adapt the code to only consider flocking towards other group members as follows:
   to flock
set id-within-group 0                                            ; initializes variables used in finding neighbors
set distance_1 1000
set distance_2 1000
set distance_3 1000

set group-members turtle-set turtles with [group-id = [group-id] of myself] ; set those sharing a group id as my group-members
 (foreach (sort group-members) (n-values count group-members [?]) [ ; set each turtle in my agentset (group) with an ID no. 0 - n?
    ask ?1 [ set id-within-group ?2 ]
  ])
repeat count group-members ; repeat the next step as many times as there are group members
  [ifelse not (id-within-group = who)
     [
       set dist distance turtle id-within-group
       print "turtle id-within-group"
       print turtle id-within-group
       print dist
      ifelse dist < distance_3
        [ifelse dist < distance_2
           [set neighbor_3 neighbor_2
            set distance_3 distance_2
            ifelse dist < distance_1
              [set neighbor_2 neighbor_1
               set distance_2 distance_1
               set neighbor_1 id-within-group
               set distance_1 dist]
              [set neighbor_2 id-within-group
               set distance_2 dist
               repeat 2 [fd 0]]]
           [set neighbor_3 id-within-group
            set distance_3 dist
            repeat 4 [fd 0]]]
        [repeat 6 [fd 0]]]
     [repeat 7 [fd 0]]
   print "_____________________"
   print "ID" print self
   print "group-id" print group-id
   ]

;]
set acceleration 0                                ; sets acceleration to zero

set target_1 calc_target neighbor_1 distance_1    ; calculates targets (see procedure below) based on
set target_2 calc_target neighbor_2 distance_2    ;   the headings and positions of each neighbor;
set target_3 calc_target neighbor_3 distance_3    ;   acceleration is set by the calc_target procedure

   ; (below) calculates a bird's composite target, weighting each individual target by the inverse
   ;   of distance to that neighbor

set target atan ((sin target_1) * 100 / distance_1 + (sin target_2) * 100 / distance_2 + (sin target_3) * 100 / distance_3)
                ((cos target_1) * 100 / distance_1 + (cos target_2) * 100 / distance_2 + (cos target_3) * 100 / distance_3)

   ; (below) turns bird towards target by a fraction specified by "flexibility"; random motion is also
   ;   included to an extent governed by "noise".  The "... + 540) mod 360) - 180" clause is necessary to
   ;   ensure that the bird turns in the right direction.  For example, if a bird is oriented at 0 degrees
   ;   and its target is 300 degrees, it should consider a 60 [ = ((0 - 300 + 540) mod 360) - 180] degree
   ;   turn to the left instead of a 300 [ = 300 - 0] degree turn to the right.

lt (flexibility / 100 * (((heading - target + 540) mod 360) - 180)) + (random noise) - (random noise)

fd 1 + acceleration                               ; moves birds forward

end

In my modified example, while the groups do correctly assign an individual ID group members, they do not flock towards their own. Also the neighbor,distance and target_1 - _3 all have the same values which is wrong.
I was wondering if anyone has any insight into some of the problems I am having? Any solutions or relevant literature would be really appreciated - Thank you!

A: First, just to let you know, turtles can change breeds simply by asking the relevant turtle to set its breed property to the new breed: ask ... [set breed ...] (see breed primitive in the NetLogo dictionary for an example).
Nevertheless, I think you are correct to do this with a 'group' property and use agentsets to do what you want. This is something like what you want but not correct. Hopefully someone else will be able to improve it.
turtles-own
[ groupID ]

to setup

  create-turtles 20
  [ set groupID random 2
    set xcor random-xcor
    set ycor random-ycor
  ]

  ask turtles
  [ let close-friends min-n-of 3 turtles with [groupID = [groupID] of myself] [distance myself]
    ask close-friends
    [ face myself
      forward 1
    ]
  ]

end

This code (I think) finds the three closest turtles in the same group. However, it moves those three towards the asking turtle rather than moving the asking turtle to move towards those three. I can't work out how to do the other way around without doing ugly stuff with lists.

A: okay, here's a corrected version (i didn't edit the above because that would mess up the comments). There's still no error checking to make sure there are 3 others in the group etc, but this uses lists to get round the problem in the first suggestion. It creates the agentset close-friends to contain the three closest (which is a single line instead of all the nested distance checking). That agentset is converted to a list and then the code loops through the list and moves towards the list member. I still think there must be a better way of looping directly through the agentset, but at least this works.
turtles-own
[ groupID ]

to setup
  clear-all
  create-turtles 20
  [ set groupID random 2
    set xcor random-xcor
    set ycor random-ycor
    set color 155 - 10 * groupID
  ]
  reset-ticks
end

to go
  ask turtles
  [ let close-friends min-n-of 3 turtles with [groupID = [groupID] of myself] [distance myself]
    let friend-list sort-on [distance myself] close-friends
    foreach friend-list
    [ face ?
      forward 1
    ]
  ]
  tick
end


text:
Q: How to create google chrome like install for my app?
Possible Duplicate:
Google Chrome-like downloader and installer

I wonder what chrome uses on windows to doownload and install itself, and how to create such install process for my application?

A: Chrome's silent self-update strategy comes at a high price.  It stores the .exe in a folder that any process can write to, C:\Users\hpassant\AppData\Local\Google\Chrome\Application\chrome.exe on my machine.
This bypasses the need for a UAC prompt that asks for elevation to write to c:\program files, the normal directory where executables are installed.  So an update can be entirely silent.  Which ought to make Chrome an attractive target for virus writers that can get code to execute on your machine but are otherwise normally powerless to mess with critical files to replicate themselves.  They just need to patch or replace chrome.exe and can do so silently.  The desktop shortcut points straight to this file so when the user starts Chrome again, it will run the affected executable.
No real idea why this isn't a wide-spread attack vector, other than that it is rather a large program and is in constant flux and probably has some countermeasures.  And perhaps because UAC otherwise can shield the machine from an infected copy of the .exe, you could only do things like steal passwords and redirect the user to pr0n sites.
I don't particularly care for this loophole so I avoid Chrome, you might want to consider that your customer has the same concern about your program.  Especially when it doesn't have the kind of countermeasures that Chrome might have.  Users and IT staff typically like UAC, only programmers don't.

A: See Google Chrome-like downloader and installer
A quite complete list of solutions:

*

*Google Omaha (Google Chrome's install solution)

*AdvancedInstaller

*Somoto BetterInstaller ( + adds recommendations from which you make money)

*Ignite (not available yet)

Or possibly create your own using the WiX Toolset, NSIS or Inno Setup.
You would need to create a small downloader EXE that would download the full installation from your web server, and then launch it.
All of those are free solutions, except for AdvancedInstaller.


text:
Q: SSRS 2005 - Sorting with page groups in SSRS 2005 One of our SSRS 2005 reports would time out when executed at the "All" level (was returning upwards of 80K records), so I added a group to the table whose sole purpose was to force a page break after every 500 records. I found the grouping in another post. It looks like this:
=IIF(Fields!ShowPageBreaks.Value = 1, Floor((RowNumber(Nothing) - 1) / 500), Nothing)

The problem is that the user sort no longer works correctly. E.g., "A"s show up at the top of multiple pages. I haven't been able to find any pattern in how SSRS decides to perform the sort. I've tried playing around with the Sort Scope and the Sort Target, like setting one to the Table and one the other to the Group, both to the Table, one or the other to nothing, etc and nothing seems to work.
Has anyone found a solution to a problem like this?

A: The sorting is happening within each group, aka, "working as intended."  You're creating a somewhat arbitrary and random set of record groups based on row position in an un-ordered set.
You need to find a way to sort properly (in the SQL?) prior to applying any sort of grouping, or use a less random means of paging.


text:
Q: Javascript Dialogue box in ctp? In test.ctp file
<?php   echo $form->create(null, array('url' => 'test/'.$test['Test']['id'], 'onSubmit'=>'return status(this)')); ?>

<?php   echo $form->hidden('id', array('value' => $test['Test']['id'])); ?>

    <?php echo $form->create(null, array('url' => 'test/'.$test['Test']['id'])); ?>
    <?php echo $form->hidden('id', array('value' => $test['Test']['id'])); ?>

<?php __('Update Status');?>:

<?php echo $form->select('status_id', $statuses, $selectedStatus, array(), false); ?>

<?php  echo $form->end(__('Update Status', true));  ?>

In the same .ctp file I need a dialogue box to appear when update button is clicked for confirmation that if user wants to continue with "No Status" or not?
Following code is not working for me, where I am not getting status_id value.

Required: If status_id value is 1 in posted data then dialogue box should appear for confirmation.

A: To create one button you don't need to keep create a new form. by using form->create...
what you want is just to check the dropdown if the value equals 1 confirmation_window appears.
To do so first you have to know the basic of HTML and JS. if you could implement that you will be able to do so. convert the code blow to cakephp tagging and form. it will get it work.
<form onsubmit="status();" >
    <select name="data[User][field]" id="UserField">
       <option value="0">1</option>
       <option value="1">2</option>
       <option value="2">3</option>
    </select>
    <input type="submit" />
</form>

you could even assign id_name to your dropdown. then you should be able to get the value from dropdown using js or jQuery.
$form->select('status_id', array('id'=>'status_id')); ?>


text:
Q: Nginx upstream to external URL hang When I'm trying to proxy pass to an external URL from like below, it's hang.
curl -v http://test.local => this will hang forever.
server {

    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name localhost test.local;
    root /usr/share/nginx/html;
    index index.php index.html index.htm;

    location / {
        proxy_pass http://frontend;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

}
upstream frontend {
  server     www.google.com  fail_timeout=10s;
}

A: If you are specifying upstream servers by domain name you need to include a resolver directive


text:
Q: Set color to hyperlink except in the Table of Contents When I set \hypersetup{linkcolor=blue} to make the references of figures/tables blue, the TOC was also changed to blue. How can I change the link color to blue except change the default color (black) of the TOC?

A: There are many ways to achieve this, one way which

*

*preserves the capability to click the links

*allows coloured links before the table of contents

is to use { \hypersetup{hidelinks} \tableofcontents }. Pay attention to the curly brackets around the code, this puts the \hypersetup together with the table of contents inside a group, so it will not effect the remaining document.


text:
Q: How to access properties of object supplied by snapshotChanges() in angularfire2? I am pretty new to Angular and Firebase so there might be a very simple solution to this.
I am trying to use Ionic Angular and Firebase to create small web app.
I have a the following function in a service ("DataService") :
constructor(private db: AngularFireDatabase) {}
getSessions(uid: string) {
    return this.db.list(`/sessions/${uid}/`).snapshotChanges();
}

In an ionic page ts file I have the following:
export class DashboardPage {

  ...

  sessionList: Observable<any[]>;

  constructor(... private data: DataService ...) {
  }

  ionViewWillLoad() {
      this.sessionList = this.data.getSessions(this.authenticatedUser.uid);
    })
  }

Then in my template html file for DashboadPage I want to have this:
<ion-list>
    <ion-item *ngFor="let session of sessionList | async" text-wrap>
        {{ session.payload.name }}
    </ion-item>
</ion-list>

Now, the problem here is that the {{ session.payload.name }} expression doesn't work.
Interestingly I can do {{ session | json }} and {{ session.payload | json }} and they both will render text on the page. But when I try to drill down one more layer and add the property for the 'name' it just shows up as blank. Here's what the first list item contains when it has {{ session | json }}:
{
  "payload": {
    "name": "One",
    "notes": {
      "-L3o08afJDL025aTYHSd": {
        "content": "The first thing in my session\n",
        "systemTime": 1516996172239
      },
      "-L3o09m9n9ewPE7kOZKv": {
        "content": "The 2nd thing in my session \n",
        "systemTime": 1516996177071
      },
      "-L3o0BlH5MbgGB-N54H5": {
        "content": "The third thing in session \"One\"\n",
        "systemTime": 1516996185207
      }
    },
    "ownerUid": "cT6gbEZBalPNUOz5bwqs6l5rH5t2",
    "systemTime": 1516996163072
  },
  "type": "value",
  "prevKey": null,
  "key": "-L3o06MSYcSS2dXJBMKO"
}

So the puzzle here is why can't I access the content from the "name" key (or any other key from that level).
Thanks!

A: User 'Hareesh' supplied correct answer in a comment:
use the .val() method on the snapshot. For example:
{{ session.payload.val().name }}

With documentation here:
https://firebase.google.com/docs/database/web/read-and-write#listen_for_value_events