text:
Q: Microsoft Teams call recording.....audio issues Issue
My code is based upon this sample.  When I capture audio it is extremely jittery/stuttery and sounds slightly 'sped up' as the playback duration is approx a quarter of the expected duration.
Code Snippet
Within my callhandler i have the following....my 'plan' is to try and hive off the received buffer asap to avoid any potential bottleneck(s) and then process the 'raw' bytes later and convert them into a WAV file.

private async void OnAudioMediaReceived(object sender, AudioMediaReceivedEventArgs e)
{
  try
  {
    if (e.Buffer.IsSilence) return;
    var managedArray = new byte[e.Buffer.Length];
    Marshal.Copy(e.Buffer.Data, managedArray, 0, (int)e.Buffer.Length);
    using (var fs = new FileStream($"c:\\tmp\\myTelephoneCallAudio.raw",FileMode.Append))
    {
      fs.Write(managedArray, 0, managedArray.Length);
      fs.Close();
    }
  }
  catch (Exception exception)
  {
    Console.WriteLine(exception);
    throw;
  }
  finally
  {
    e.Buffer.Dispose();
  }
}

......then once the telephone call has ended i process the .raw file created above into a .wav by basically generating a wav file header and appending the wav content from the raw file.
Expected behavior
A clear and audible recording of the call lasting the expected duration.
Graph SDK(s) in use:

*

*Microsoft.Graph (Nuget) - v3.12.0

*Microsoft.Graph.Core (Nuget) - v1.21.0

*Microsoft.GraphCommunications.Calls (Nuget) - v1.2.0.1702

*Microsoft.GraphCommunications.Calls.Media (Nuget) - v1.2.0.1702

*Microsoft.GraphCommunications.Client (Nuget) - v1.2.0.1702

*Microsoft.GraphCommunications.Common (Nuget) - v1.2.0.1702

*Microsoft.GraphCommunications.Core (Nuget) - v1.2.0.1702

Other information
I've raised an issue here but experience tells me I'm not going get a response.  But within that raised issue I attached is a zip with the 'mangled' wav.  This wav file is only 1m 25s but the call was 6.5 minutes long.
For a time I thought of the possibility of maybe the audio 'frames' were coming to me/being processed by me slightly out of sync/order....therefore i did try storing the frames in a dictionary where the key was the timestamp of the frame/buffer.....then i could order by the timestamp before attempting the conversion to the wav file.
Also after looking around online at expected wav file sizes, i.e. 10MB/min, etc.. it appears that the amount of data I'm capturing currently is a lot lower than expected for the assumed values, i.e. mono (1 channel), PCM 16K, with 32K sample rate, etc.
final note... every time when debugging OnAudioMediaReceived(), the buffer only has 640 bytes, meaning I'm appending at a rate of 640 per time...is this the same for anyone else who may be working on this?


text:
Q: PhpMyAdmin fail to export any Database It will just give me the below error on localhost/phpmyadmin/export.php
Fatal error: Call to a member function getHeader() on a non-object in C:\xampp\phpMyAdmin\libraries\common.inc.php on line 1067
I've already replaced installation and no luck so far. Can anyone help me?

A: Make sure you have Profiling turned-off in phpmyadmin.
To check that, you can run any query inside phpmyadmin and look for Profiling checkbox, make sure it's unchecked.

A: Issue was solved by simply rebooting system. There was some problem with commoninc.php

redpajama_set_name: RedPajamaStackExchange


text:
Q: problem installing ruby-debug-ide gem with jruby 1.4.0 I tried to follow the UsingTheJRubyDebugger instructions on the jruby wiki.  (kenai.com/projects/jruby/pages/UsingTheJRubyDebugger).  I got an error trying to install the ruby-debug-ide gem.
jruby -S gem install --ignore-dependencies ruby-debug-ide
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
Building native extensions.  This could take a while...
rake aborted!
Don't know how to build task '2>&1'
(See full trace by running task with --trace)
ERROR:  Error installing ruby-debug-ide:
        ERROR: Failed to build gem native extension.
I'm using Vista. Has anybody gotten this to work?  Any help would be greatly appreciated.
hhh

A: JRuby does not support native extensions. A related stackoverflow question is here.
Second try:
There is bug report and a workaroud: set rake=jruby -S rake.


text:
Q: Performance difference between two implementations of the same algorithm I'm working on an application that will require the Levenshtein algorithm to calculate the similarity of two strings.
Along time ago I adapted a C# version (which can be easily found floating around in the internet) to VB.NET and it looks like this:
Public Function Levenshtein1(s1 As String, s2 As String) As Double
    Dim n As Integer = s1.Length
    Dim m As Integer = s2.Length

    Dim d(n, m) As Integer
    Dim cost As Integer
    Dim s1c As Char

    For i = 1 To n
        d(i, 0) = i
    Next
    For j = 1 To m
        d(0, j) = j
    Next

    For i = 1 To n
        s1c = s1(i - 1)

        For j = 1 To m
            If s1c = s2(j - 1) Then
                cost = 0
            Else
                cost = 1
            End If

            d(i, j) = Math.Min(Math.Min(d(i - 1, j) + 1, d(i, j - 1) + 1), d(i - 1, j - 1) + cost)
        Next
    Next

    Return (1.0 - (d(n, m) / Math.Max(n, m))) * 100
End Function

Then, trying to tweak it and improve its performance, I ended with version:
Public Function Levenshtein2(s1 As String, s2 As String) As Double
    Dim n As Integer = s1.Length
    Dim m As Integer = s2.Length

    Dim d(n, m) As Integer
    Dim s1c As Char
    Dim cost As Integer

    For i = 1 To n
        d(i, 0) = i
        s1c = s1(i - 1)

        For j = 1 To m
            d(0, j) = j

            If s1c = s2(j - 1) Then
                cost = 0
            Else
                cost = 1
            End If

            d(i, j) = Math.Min(Math.Min(d(i - 1, j) + 1, d(i, j - 1) + 1), d(i - 1, j - 1) + cost)
        Next
    Next

    Return (1.0 - (d(n, m) / Math.Max(n, m))) * 100
End Function

Basically, I thought that the array of distances d(,) could be initialized inside of the main for cycles, instead of requiring two initial (and additional) cycles. I really thought this would be a huge improvement... unfortunately, not only does not improve over the original, it actually runs slower!
I have already tried to analyze both versions by looking at the generated IL code but I just can't understand it.
So, I was hoping that someone could shed some light on this issue and explain why the second version (even when it has fewer for cycles) runs slower than the original?
NOTE: The time difference is about 0.15 nano seconds. This don't look like much but when you have to check thousands of millions of strings... the difference becomes quite notable.

A: It's because of this:
 For i = 1 To n
        d(i, 0) = i
        s1c = s1(i - 1)

        For j = 1 To m
            d(0, j) = j 'THIS LINE HERE

You were just initializing this array at the beginning, but now you are initializing it n times. There is a cost involved with accessing memory in an array like this, and you are doing it an extra n times now. You could change the line to say: If i = 1 Then d(0, j) = j. However, in my tests, you still basically end up with a slightly slower version than the original. And that again makes sense. You're performing this if statement n*m times. Again there is some cost. Moving it out like it is in the original version is a lot cheaper It ends up being O(n). Since the overall algorithm is O(n*m), any step you can move out into an O(n) step is going to be a win.

A: You can split the following line:
d(i, j) = Math.Min(Math.Min(d(i - 1, j) + 1, d(i, j - 1) + 1), d(i - 1, j - 1) + cost)

as follows:
tmp = Math.Min(d(i - 1, j), d(i, j - 1)) + 1
d(i, j) = Math.Min(tmp, d(i - 1, j - 1) + cost)

It this way you avoid one summation
Further more you can place the last "min" comparison inside the if part and avoid assigning cost:
tmp = Math.Min(d(i - 1, j), d(i, j - 1)) + 1
If s1c = s2(j - 1) Then
   d(i, j) = Math.Min(tmp, d(i - 1, j - 1))
Else
   d(i, j) = Math.Min(tmp, d(i - 1, j - 1)+1)
End If

So you save a summation when s1c = s2(j - 1)

A: Not the direct answer to your question, but for faster performance you should consider either using a jagged array (array of arrays) instead of a multidimensional array. What are the differences between a multidimensional array and an array of arrays in C#? and Why are multi-dimensional arrays in .NET slower than normal arrays?
You will see that the jagged array has a code size of 7 as opposed to 10 with multidimensional arrays.
The code below is uses a jagged array, single dimensional array
Public Function Levenshtein3(s1 As String, s2 As String) As Double
    Dim n As Integer = s1.Length
    Dim m As Integer = s2.Length

    Dim d()() As Integer = New Integer(n)() {}
    Dim cost As Integer
    Dim s1c As Char

    For i = 0 To n
        d(i) = New Integer(m) {}
    Next

    For j = 1 To m
        d(0)(j) = j
    Next

    For i = 1 To n
        d(i)(0) = i
        s1c = s1(i - 1)

        For j = 1 To m
            If s1c = s2(j - 1) Then
                cost = 0
            Else
                cost = 1
            End If

            d(i)(j) = Math.Min(Math.Min(d(i - 1)(j) + 1, d(i)(j - 1) + 1), d(i - 1)(j - 1) + cost)
        Next
    Next

    Return (1.0 - (d(n)(m) / Math.Max(n, m))) * 100
End Function


text:
Q: Calling a Python Tkinter wait_window inside a method and then resuming the method I have a main window which creates a setup window (defined as a top level window) as a wait_window via this line of code:
 main.wait_window( Setup_Panel.setup_panel(main) )

That setup window has a method to writes its variables to a text file, however if the input file or output directory variables are blank I call a warning popup window as a wait_window of the setup window which is also defined as a top level window.  The method is as follows:

def write_to_directory_file(main):
    main.execute_command = True
    if (main.input_directory_location.get().strip() == ""):
         main.wait_window( Error_Box.WarningPopup(main, "Input File Missing") )
    elif (main.output_directory_location.get().strip() == ""):
         main.wait_window( Error_Box.WarningPopup(main, "Output Directory Missing") )
    if execute_command:
         directory_file = open("plink.dir", 'w')
         directory_file.write("input_file: " + main.input_directory_location.get() + "\n")
         directory_file.write("output_directory: " + main.output_directory_location.get()    + "\n")
         directory_file.write("output_file: " + main.output_file_name.get() + "\n")
         directory_file.write("hom_name: " + main.HOM_name.get() + "\n")
         enable_parent_window(main.parent_main)
         main.destroy()
    print "FLAG"

The warning popup has the message given and two buttons one is Continue and the other is Cancel.
If you press cancel the warning popup will be destroyed and set main.execute_command to False so the method won't continue.  If you press continue it should destroy the popup and set main.execute_command to true so that the method will resume and write to the directory anyway.  My problem is that when the warning popup is destroyed it doesn't return to the method immediately.  Rather it won't return to that point and print "FLAG" until the setup window has also been destroyed.
How would I code it so that it would resume the method directly after the warning popup has been destroyed rather than after I destroy the warning window and the setup window?  The only window that is calling .mainloop() is the main panel window.
The main panel is defined as:  main = Tkinter.Tk()
and calls main.mainloop()
The setup panel is defined as:  setup_main = Tkinter.Toplevel()
The warning popup is defined as:  warning_main = Tkinter.Toplevel()
Any help in figuring this out would be appreciated, thanks!

A: I have just encountered a problem just like the one you described. The child window appeared and worked but the function that called it hasn't resumed after the child window was closed. However after the parent window was closed too, the function that hasn't resumed in time finally resumed.
I found out, that I have accidentally set wrong parameter to the wait_window() line. I wrote the function name that created the child window instead of the child windows' own name.
Example:
#some code before
def create_cw(self):
    self.cw = Toplevel()
#some other after

What was wrong:
wait_window(self.create_cw)

What was the solution in my case:
wait_window(self.cw)

I found your question while I searched for solution to my problem. I hope I could help.

A: I found this old question because I had a similar problem.
According to my findings, wait_window(w) waits for w to be destroyed as in w.destroy(), then returns normal control flow to the program. In my case, I also implemented my own dialog window, but I didn't destroy the window. It may be your case.
TL/DR: The window argument to wait_window() must be destroyed for normal control flow to continue.


text:
Q: How to prevent Gmail from stacking into a "conversation" emails sent via PHP mail()? I have a web form which uses the following PHP code to send email:
$senderEmail = "sender@sender.com"
$senderName = "John Smith"

$noreplyEmail = "noreply@receiver.com"
$receiverEmail = "inbox@receiver.com"

$header = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
$header .= 'From: "' . $senderName . '" <' . $noreplyEmail . ">\r\n";
$header .= 'Reply-To: "' . $senderName . '" <' . $senderEmail . ">";

$subject = "Contact form";
$message = "...";

mail($receiverEmail, $subject, $message, $header);

The problem is that although each time $senderName, $senderEmail and $message are different in the inbox of the receiver (which is a Gmail domain inbox) the emails get stacked into a conversation by the Gmail's system.
What would be the proper way to prevent this stacking and receive them always as individual separate emails?

A: Easy: You have to change the Subject of your email:
mail('hi@example.com', 'Test', 'Hi there 3')

mail('hi@example.com', 'Test 3', 'Hi there 3')

Maybe something like $subject = "Contact from" . $senderName;


text:
Q: Laravel Basic auth:api 401 Unauthorized I have a Laravel 5.5 application (not using Passport) and I'm trying to access /api routes from a VueJS component I built using the stock infrastructure.  Using vue-resource I'm not able to get a valid, authenticated response.  I can see the XSRF token being passed here:

My VueJS:
    methods: {
        updateSubscription(newChannelId, oldChannelId) {
            if (oldChannelId < 1 && newChannelId > 0) {
                console.log('new subscription', this);
                this.$http.post('/api/subscribe', {
                    'game_id': this.gameId,
                    'channel_id': newChannelId
                }).then(response => {
                    // success
                }, response => {
                    console.error('Failed to subscribe');
                });

My Laravel route in routes/api.php:
Route::middleware('auth:api')->group(function () {
    Route::post('subscribe', 'SubscriptionController@create');
    Route::post('unsubscribe', 'SubscriptionController@delete');
    Route::post('update-subscription', 'SubscriptionController@update');
});

I thought Laravel handled XSRF out of the gate and I wouldn't run into this issue.  I suppose I'm not 100% familiar with auth:api given that my http kernel looks like:
protected $middlewareGroups = [
    'web' => [
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        // \Illuminate\Session\Middleware\AuthenticateSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\VerifyCsrfToken::class,
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],

    'api' => [
        'throttle:60,1',
        'bindings',
    ],
];

/**
 * The application's route middleware.
 *
 * These middleware may be assigned to groups or used individually.
 *
 * @var array
 */
protected $routeMiddleware = [
    'auth'       => \Illuminate\Auth\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    'bindings'   => \Illuminate\Routing\Middleware\SubstituteBindings::class,
    'can'        => \Illuminate\Auth\Middleware\Authorize::class,
    'guest'      => \App\Http\Middleware\RedirectIfAuthenticated::class,
    'throttle'   => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];

What did I miss?


text:
Q: How to escape input in PHP? I have a PHP page that accepts input from a form post, but instead of directing that input to a database it is being used to retrieve a file from the file system. What is a good method for escaping a string destined for the file system rather then a database? Is mysql_real_escape_string() appropriate?

A: If you're using user-provided input to specify a filename directory, you'll have to make sure that the provided filename/path isn't trying to break "out" of your site's playground.
e.g. having something like
readfile($_GET['filepath']);

will send out ANYTHING on your server that the attack knows the path for. Even something like
readfile('/path/to/your/site/download/' . $_GET['filepath']);

accomplishes the same, if the user specifies enough '../../../' to get to whatever file they want.
mysql_real_escape_string() is NOT appropriate for this, as you're not doing a database operation. Use appropriate tools for appropriate jobs. In a goofy way, m_r_e_s() is a banana, and you need a giraffe. Something like
readfile('/path/to/your/site/download/' . basename($_GET['filepath']));

would be relatively save as basename() will extract only the filename portion of the user-provided file, so even if they pass in ../../../../../etc/passwd, basename will return only passwd.

A: You always only need to escape characters that are otherwise interpreted by your target system. For databases you usually make sure to escape quotes so you use mysql_real_escape_string or others. If your target is html, you usually use htmlspecialchars to make sure you get rid of html special characters (namely <, > and &). If your target is CSV, you basically only need to make sure line breaks and the CSV separator are escaped.
So depending on your target you can either reuse an existing escape function, define your own, or even go without one. If all you do is dump the input in a single file, then there is not much you need to take care of, as long as you specify the filename and that file is never used (or interpreted) by anything else than your application.
So think of what kind of special characters your target format requires for it to work, and simply escape those. You can usually ignore the rest.
edit:
If you want to use the input as the file path or file name, you can simply decide yourself how gracious you are, and what characters you want to support. A simple method would be to replace everything except latin characters and numbers (and maybe some special characters like _ and -) by something else. For example:
preg_replace( '/[^A-Za-z0-9_-]/', '_', $text );


text:
Q: Windows Store App and iFrame cookie I have a Javascript Windows Store Application that hosts an iframe. The webpage inside of my iframe is not aware of my app, so it doesn't have any PostMessage interface to my app.
The iframe will set a cookie when I 'log in' in the iframe. But in my app, I don't believe that there is a way that I can get the iframe cookie.  Is this correct?
What if the web page knows about my application? (i.e. I can change the webpage in the iframe) Do I use PostMessage?

A: You can use PostMessage that your main page will receive the message.
Here is working example in Win8 Developer Preview:
<!DOCTYPE html>

<meta charset="utf-8" />
<meta name="viewport" content="width=1024, height=768" />
<title>WinWebApp1</title>

<link rel="stylesheet" href="/winjs/css/ui-dark.css" />

<link rel="stylesheet" href="/css/default.css" />

Click on Send Message above

On the server (it is live at this moment on http://www.scrumpt.com/frametest2.html) you have:
<!DOCTYPE html>

Send message

make sure that your div ("target-element-id") has the correct id when if you copy paste the code above. VS might change the id to "Div1" when pasting.


text:
Q: Kristina 'stopped'/'finished' drinking [a cup of] tea and then went to sleep
(1) Kristina stopped drinking tea ...
(2) Kristina finished drinking tea ...
(3) Kristina stopped drinking a cup of tea ...
(4) Kristina finished drinking a cup of tea ...

Are the sentences above somewhat different if they are referred to the situation in which Kristina is drinking and then, when she has finished, she has to go to bed? More precisely, which of the sentences above might be successfully ended with:

... and then went to sleep.

A: Your examples using "stopped" have the feeling of her not finishing the tea - she quit with half a cup still left, or she was interrupted.
The examples with "finished" feel like she drank all of the tea then went on to do something else.
However, the phrase that feels most natural to me is:

Kristina finished drinking her cup of tea, and then went to bed.

A: "Kristina stopped drinking tea" can mean she either gave up drinking tea, or she faced some problem during drinking, so she stopped.  Or in this case, she could have been in need of sleep so badly that she stopped drinking.
The correct sentence would be:

Kristina finished drinking her cup of tea and went to bed.

or rather

Kristina finished her cup of tea and went to bed.

The word then need not be used as in:

Kristina finished drinking her cup of tea and then went to bed.

Since this is a continued action (she drinks tea and goes to bed), then would make it more affirmative, and need not be used.

A: With your ending added on, those for sentences each imply something slightly different to me.

(1) Kristina stopped drinking tea and then went to sleep.

From this, I infer that Kristina has been drinking tea for a while, not just one glass, but finally stopped and went to sleep.

(2) Kristina finished drinking tea and then went to sleep.

This would be confusing.  Almost like she had an assignment to drink tea or something.

(3) Kristina stopped drinking a cup of tea and then went to sleep.

This implies that she did not finish the cup of tea for some reason and then went to sleep.

(4) Kristina finished drinking a cup of tea and then went to sleep.

This is closest to what I think you want, but has an, I don't know, almost detached quality to it. It sounds like something a police detective might say when reporting to his superior about what a subject under surveillance had done.
As Eric S said, "Kristina finished her cup of tea and then went to bed." sound much more natural.


text:
Q: How do I connect to Cassandra with the C++ driver? I am trying to connect cassandra with c++ in linux 'titan' by using the cmake .nothing in the internet useful I found,
Can anyone help me with steps please?

A: There are packages available for RHEL/CentOS and Ubuntu on the C++ driver Installation page. You can find the download links for the dependencies on the same page.
You'll need to install the dependencies and runtime library. See the Installation instructions for details.
Once you've installed the driver, try running the sample code for connecting to a Cassandra cluster in the C++ driver Getting started guide. Cheers!


text:
Q: Eigenvectors with dgeev in Maxima I am finding eigenvectors with the function dgeev in maxima and comparing them with eigenvectors I find from the same matrix but using mathematica.
In the odd column right eigenvectors in maxima are the same as in mathematica but not the even. And the even column left eigenvectors are the same in mathematica but not the odd. if I were to take odd column right eigenvectors and even column eigenvectors I would have what mathematica prints out.
I do not fully understand what is going on here, does anyone have an explanation?
Thanks,
Ben

A: Eigenvectors aren't unique, so the actual result depends on conventions for normalization and ordering. A better way to check the result is to verify that the difference between the original matrix and the product of the eigenvectors and eigenvalues is zero.


text:
Q: Unexpected Symbol for Project I'm having some trouble understanding why "unexpected symbol" exists for my code. I'm using for loops for a project and these few lines of code are giving me problems. I'm guessing it has something to do with not putting brackets/ semi-colins somewhere, but I don't know where it would be. Could I get some help identifying where I need to correct this error?
 enter image description here
enter image description here
Here's the full code where the errors exist
 // Use this for initialization
void Start()
{
    string[] imagesNames = new string[3] { "portrait01", "portrait02", "portrait03" };
    //images [0] = CreateSprite ("portrait01");
    //images[1] = CreateSprite ("portrait02");
    //images[2] = CreateSprite ("portrait03");
    string[] professionNames = new string[3] {"Karate fighter", "Ninja Figher", "Samurai Fighter"};
    string[] professionDescriptions = new string[3] { "Use hand to hand combat for powerful attacks! Req: Strength = 13 and Special = 10",
        "Use high stealth and sneak attacks to suprize you enemies! Req: Speed = 15 or Strength = 9",
        "Use your wisdom to reverse attacks with 2x the power! Req: Wisdom = 14 or Special = 13" };

    string[] professionImageNames = new string[3] { "profession01", "profession02", "profession03"};
    int[] [] minRequirements = { new int [3] {11, 11, 12}, new int[3] {11,13,12}, new int[3] {11,11,16} };

professions = new Profession[3]
for (int i = 0; i < 3; i++)

    {
        professions[i] = CreateProfession (name[i], description[i], profimages[i], minRequirements[i]);

    }

    for (int i = 0; i < professionNames.Length; i++) //this starts at least one of the loops

    {
        profession[i] = createItem(professionNames[i], professionDescriptions[i], professionImageNames[i], minRequirements[i]);

    }

    //profession01 = createItem("Karate Fighter", "Use hand to hand combat for powerful attacks!", "portrait01");
    //profession02 = createItem("Ninja Fighter", "Use high stealth and sneak attacks to suprize you enemies!", "portrait02");
    //profession03 = createItem("Samurai Fighter", "Use your wisdom to reverse attacks with 2x the power!", "portrait03");

    for (int i = 0; i < imagesNames.Length; i++) //creates a for loop for the images
    {
        images[i] = CreateSprite(imagesNames[i]); //makes it so the images come from CreatSprite
        //array
    }

     portraitImage.sprite = images[currentImage]; //renders the current images

profession.characterManager = this;

for (in i = 0; i < minRequirement.Length; i++) {

    profession.requirements [i] = profession.CreateRequirement { Attribute [i], minRequirement[i];
}

return profession;

}

A: You are missing a ; on this line:
professions = new Profession[3]

These types of errors should be pretty apparent, usually you always want to inspect the line above the first error, missing a semi-colon is probably the most common programming "error", and it was a lot worse before IDE's highlighted error lines.
The second error, as pointed out by Lazy Coder, is a missing t on the last for loop:
for (int i = 0; i < minRequirement.Length; i++)

Again, should be apparent from reviewing the errors. It should be giving an error "Identifier expected; 'in' is a keyword"

A:  // Use this for initialization
void Start()
{
    string[] imagesNames = new string[3] { "portrait01", "portrait02", "portrait03" };
    //images [0] = CreateSprite ("portrait01");
    //images[1] = CreateSprite ("portrait02");
    //images[2] = CreateSprite ("portrait03");
    string[] professionNames = new string[3] {"Karate fighter", "Ninja Figher", "Samurai Fighter"};
    string[] professionDescriptions = new string[3] { "Use hand to hand combat for powerful attacks! Req: Strength = 13 and Special = 10",
        "Use high stealth and sneak attacks to suprize you enemies! Req: Speed = 15 or Strength = 9",
        "Use your wisdom to reverse attacks with 2x the power! Req: Wisdom = 14 or Special = 13" };

    string[] professionImageNames = new string[3] { "profession01", "profession02", "profession03"};
    int[] [] minRequirements = { new int [3] {11, 11, 12}, new int[3] {11,13,12}, new int[3] {11,11,16} };

professions = new Profession[3]  //WERE IS THE PROFESSION CLASS CREATED?
//PROFESSIONS NEEDS TO HAVE A TYPE var profession = new Proffession[3];
for (int i = 0; i < 3; i++)

    {
        professions[i] = CreateProfession (name[i], description[i], profimages[i], minRequirements[i]); //CreateProffession is not implemented on your example, the signature could be like public Profession CreateProfession(string name, string description des, string proofImage, int[] minRequirement)

    }

    for (int i = 0; i < professionNames.Length; i++) //this starts at least one of the loops

    {
        //DID YOU MEAN professions
        profession[i] = createItem(professionNames[i], professionDescriptions[i], professionImageNames[i], minRequirements[i]);

    }

    //profession01 = createItem("Karate Fighter", "Use hand to hand combat for powerful attacks!", "portrait01");
    //profession02 = createItem("Ninja Fighter", "Use high stealth and sneak attacks to suprize you enemies!", "portrait02");
    //profession03 = createItem("Samurai Fighter", "Use your wisdom to reverse attacks with 2x the power!", "portrait03");

    for (int i = 0; i < imagesNames.Length; i++) //creates a for loop for the images
    {
        //DID YOU MEAN imagesNames
        images[i] = CreateSprite(imagesNames[i]); //makes it so the images come from CreatSprite
        //array
    }

     portraitImage.sprite = images[currentImage]; //renders the current images  //WHERE IS currentImage created?

profession.characterManager = this;

//FOR is for(int i=0 , int with t
for (in i = 0; i < minRequirement.Length; i++) {

    profession.requirements [i] = profession.CreateRequirement { Attribute [i], minRequirement[i];
}

return profession;

}


text:
Q: PHP - FILTER_SANITIZE_ENCODED does`t work correctly First I want to know what is FILTER_SANITIZE_ENCODED default flag?
and when I try:
filter_var('α', FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW);

'α' ascii is 224 when I use  FILTER_FLAG_ENCODE_LOW it should encode ascii values less than 32. but when I put 224 ascii character it get encoded.
(edit) I want to not encode the ascii characters above 127 but it returns '%CE%B1'

A: not sure i understand exactly what you want, but.. does this work?
function encode(string $str): string
{
    $ret = "";
    for ($i = 0, $max = strlen($str); $i < $max; ++ $i) {
    if (ord($str[$i]) > 127) {
            $ret .= $str[$i];
        } else {
            $ret .= urlencode($str[$i]);
        }
    }
    return $ret;
}

it urlencodes all characters except those with uint8-values above 127, which are left untouched.. is that what you want?
edit: another possibility, if you're talking about CP-437, you want to urlencode every character except characters above 127 in CP-437? in which case,
function urlencode_cp437(string $str): string
{
    $ret = "";
    for ($i = 0, $max = strlen($str); $i < $max; ++ $i) {
        if (ord($str[$i]) > 127 && mb_check_encoding($str[$i], 'CP-437')) {
            $ret .= $str[$i];
        } else {
            $ret .= urlencode($str[$i]);
        }
    }
    return $ret;
}

*

*i guess? (untested, but should work, i guess?)

*should probably use mb_ord() instead of ord(), but since CP-427 is a single-byte ascii-compatible encoding, and mb_ord doesn't exist until php 7.2, i guess ord() would work regardless, idk


text:
Q: Laravel: 'use' statement sometimes necessary, sometimes not It's quite random to me if I need to have a use statement to access a class. In the following code, which runs without issues, the Faker library doesn't need use Faker or something like that, yet the Seeder does need an use.
I assume Faker is accessed using the Composer autoloader, yet in composer.json I don't see the vendor directory being used for either the psr-4 autoload or the classmap autoload, so how it finds this is beyond me.
<?php

use Illuminate\Database\Seeder;

class MoreProductsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        for ($i = 0; $i<1000; $i++)
        {
            $faker = Faker\Factory::create();
            \App\Product::create([
                'name' => $faker->name,
                'photo' => 'https://picsum.photos/200/300',
                'price' => rand(1,20000),
                'category_id' => rand(1,3)
            ]);
        }

    }
}

A: If you are using a class multiple times, for e.g
Faker\Factory::create(...)
.
.
.
then, in the same file you use
Faker\Factory::create(...) again.
Here you are repeating the full path Faker\Factory, rather you should just use Faker\Factory as Faker; before the class and then simply use the Faker::create(...) as many time you want without repeating the full path.
You can even do class MoreProductsSeeder extends Illuminate\Database\Seeder this instead if you prefer it.


text:
Q: What is syntax for placeholder usage in regular expression in Predicate? I want to specify my value in regular expression, how can I do it?
What I am doing:
request.predicate = Predicate(format: "entityProperty MATCHES [c] '[^0123]%@'", myValue)

Observing the result, I can say that %@ is parsed as a characters in the regex string, no value is placed instead of it
Here is some explanation on usage of regular expressions with predicates, but no information about placeholders for values

A: Your Solution would work for:

*

*myValue is representing valid regex pattern.

*myValue may not contain single quotes (').

If myValue may contain single quote, this would work:
request.predicate = NSPredicate(format: "entityProperty MATCHES [c] %@", "[^1234]" + myValue)

And if myValue is not a regex pattern and may contain some meta-characters, you may need to write something like this:
request.predicate = NSPredicate(format: "entityProperty MATCHES [c] %@", "[^1234]"+NSRegularExpression.escapedPattern(for: myValue))

Anyway, you need to remember:

Single or double quoting variables (or substitution variable strings)
  cause %@, %K, or $variable to be interpreted as a literal in the
  format string and so prevent any substitution.

Parser Basics (Predicate Programming Guide)
(I used NSPredicate as Predicate is not available in Xcode 8 beta 6.)

A: request.predicate = Predicate(format: "entityProperty MATCHES [c] '[^0123]\(myValue)'")

Solution:
instead of %@ placeholder use string substitution:
"prefixSomeText\(myValue)suffixSomeText"


text:
Q: Find a number with Oracle regexp that has an exact length of 3 I want to get only 456.
I tried this regular expression, but I got all numbers which contain 3 digit characters, 456, 46354376, etc.
select regexp_substr(MY_COLUMN,'([[:digit:]]{3})') from MY_TABLE

A: I'm not quite clear on whether you want exact matches or sub-string matches so I've included various options:
SQL Fiddle
Oracle 11g R2 Schema Setup:
CREATE TABLE MY_TABLE (MY_COLUMN) AS
          SELECT '456' FROM DUAL
UNION ALL SELECT '12345678' FROM DUAL
UNION ALL SELECT 'abc 123 def 456' FROM DUAL;

Query 1:
If you only want rows where MY_COLUMN contains exactly a 3-digit number then you can just use your regular expression wrapped in the start-string (^) and end-string ($) anchors:
    SELECT MY_COLUMN
    FROM   MY_TABLE
    WHERE  REGEXP_LIKE( MY_COLUMN, '^[[:digit:]]{3}$' )

Results:
| MY_COLUMN |
|-----------|
|       456 |

Query 2:
Or, if you are using Oracle 11g then you can use the less verbose PERL syntax:
    SELECT MY_COLUMN
    FROM   MY_TABLE
    WHERE  REGEXP_LIKE( MY_COLUMN, '^\d{3}$' )

Results:
| MY_COLUMN |
|-----------|
|       456 |

Query 3:
If you want to extract the first 3-digit number from the column (where it can have surrounding text or more digits), then:
    SELECT MY_COLUMN,
           REGEXP_INSTR( MY_COLUMN, '\d{3}' ),
           REGEXP_SUBSTR( MY_COLUMN, '\d{3}' )
    FROM   MY_TABLE
    WHERE  REGEXP_LIKE( MY_COLUMN, '\d{3}' )

Results:
|       MY_COLUMN | REGEXP_INSTR(MY_COLUMN,'\D{3}') | REGEXP_SUBSTR(MY_COLUMN,'\D{3}') |
|-----------------|---------------------------------|----------------------------------|
|             456 |                               1 |                              456 |
|        12345678 |                               1 |                              123 |
| abc 123 def 456 |                               5 |                              123 |

Query 4:
If you want to extract the first exactly 3-digit number from the column then:
    SELECT MY_COLUMN,
           REGEXP_SUBSTR( REGEXP_SUBSTR( MY_COLUMN, '(^|\D)\d{3}(\D|$)' ), '\d{3}' ) AS match
    FROM   MY_TABLE
    WHERE  REGEXP_LIKE( MY_COLUMN, '(^|\D)\d{3}(\D|$)' )

Results:
|       MY_COLUMN | MATCH |
|-----------------|-------|
|             456 |   456 |
| abc 123 def 456 |   123 |

Query 5:
If you want to extract all the non-overlapping 3-digit numbers from the column (where it can have surrounding text), then:
    WITH re_counts AS (
      SELECT MY_COLUMN,
             REGEXP_COUNT( MY_COLUMN, '\d{3}' ) AS re_count
      FROM   MY_TABLE
    )
    ,indexes AS (
      SELECT LEVEL AS "index"
      FROM   DUAL
      CONNECT BY LEVEL <= (SELECT MAX( re_count)  FROM re_counts)
    )
    SELECT MY_COLUMN,
           "index",
           REGEXP_SUBSTR( MY_COLUMN, '\d{3}', 1, "index" )
    FROM   re_counts
           INNER JOIN
           indexes
           ON ("index" <= re_count)
    ORDER BY MY_COLUMN, "index"

Results:
|       MY_COLUMN | INDEX | REGEXP_SUBSTR(MY_COLUMN,'\D{3}',1,"INDEX") |
|-----------------|-------|--------------------------------------------|
|        12345678 |     1 |                                        123 |
|        12345678 |     2 |                                        456 |
|             456 |     1 |                                        456 |
| abc 123 def 456 |     1 |                                        123 |
| abc 123 def 456 |     2 |                                        456 |

Query 6:
If you want to extract all the sub-matches which are exactly 3-digit numbers then:
    WITH re_counts AS (
      SELECT MY_COLUMN,
             REGEXP_COUNT( MY_COLUMN, '(^|\D)\d{3}(\D|$)' ) AS re_count
      FROM   MY_TABLE
    )
    ,indexes AS (
      SELECT LEVEL AS "index"
      FROM   DUAL
      CONNECT BY LEVEL <= (SELECT MAX( re_count)  FROM re_counts)
    )
    SELECT MY_COLUMN,
           "index",
           REGEXP_SUBSTR( REGEXP_SUBSTR( MY_COLUMN, '(^|\D)\d{3}(\D|$)', 1, "index" ), '\d{3}' ) AS match
    FROM   re_counts
           INNER JOIN
           indexes
           ON ("index" <= re_count)
    ORDER BY MY_COLUMN, "index"

Results:
|       MY_COLUMN | INDEX | MATCH |
|-----------------|-------|-------|
|             456 |     1 |   456 |
| abc 123 def 456 |     1 |   123 |
| abc 123 def 456 |     2 |   456 |

Query 7:
If you want to extract all 3-digit numbers from a column regardless of whether those matches partially overlap or not then:
    WITH positions AS (
      SELECT LEVEL AS pos
      FROM   DUAL
      CONNECT BY LEVEL <= (SELECT MAX( LENGTH( MY_COLUMN ) - 2 )  FROM MY_TABLE )
    )
    SELECT MY_COLUMN,
           pos,
           SUBSTR( MY_COLUMN, pos, 3 )
    FROM   MY_TABLE
           INNER JOIN
           positions
           ON (pos <= LENGTH( MY_COLUMN ) - 2 )
    WHERE  REGEXP_LIKE( SUBSTR( MY_COLUMN, pos, 3 ), '^\d{3}$' )
    ORDER BY MY_COLUMN, pos

Results:
|       MY_COLUMN | POS | SUBSTR(MY_COLUMN,POS,3) |
|-----------------|-----|-------------------------|
|        12345678 |   1 |                     123 |
|        12345678 |   2 |                     234 |
|        12345678 |   3 |                     345 |
|        12345678 |   4 |                     456 |
|        12345678 |   5 |                     567 |
|        12345678 |   6 |                     678 |
|             456 |   1 |                     456 |
| abc 123 def 456 |   5 |                     123 |
| abc 123 def 456 |  13 |                     456 |

A: You're sub-stringing the number... if you're searching for a number that is exactly 3 digits then use LENGTH():
 select * from my_table where length(my_column) = 3

This presupposes that you've stored your numbers in a NUMBER column. If there might be characters in there as well use REGEXP_LIKE() and ensure you tie the regular expression to the beginning (with the ^ operator) and end ($) of the string
select * from my_table where regexp_like( my_column, '^[[:digit:]]{3}$')

You're not checking to see whether your number is at both the beginning and end of the string so you're getting everything with 3 numbers.

A: You can use this pattern:
(^|[^[:digit:]])([[:digit:]]{3})($|[^[:digit:]])

where [^[:digit:]] is all that is not a digit and ^, $ are start and end of the string anchors.


text:
Q: Android API design: Int vs. Float precision I'm just wondering why some parts of Android UI are represented with Int precision while some other parts are represented with Float.
Is there any pragmatic reasoning behind this?
Example of Int based Android API:

*

*View.width/View.height

*View.top/View.bottom/...

Example of Float based Android API:

*

*View.x/View.y

*View.translateX/View.translateY
I'm asking this, because I often find myself in a position, where I have to do the calculations with both Ints and Floats.
If I can position a View with Int precision (View.top/bottom/etc.), but later move it with Float precision (View.translateX), why don't just have all the attributes as Floats?


text:
Q: Formula for area in a special occasion in polar coordinates. I know that the area of a curve given in polar coordinates is $$\int_{\theta_1}^{\theta_2}\frac{r^2}{2}d\theta$$. But what is the area outside one curve and inside another, when one of them is not entirely inside the other?
For example, what is the area inside $a(1+\cos{\theta})$ and outside $a\sin{\theta}$?

A: integrate the cardioid from $-\pi$ to $\frac {\pi}{2}$ and subtract half the circle


text:
Q: Vague IOException when running Javadoc with special doclet This might be a doclet-implementation-specific question, but I believe its really a JavaDoc configuration issue I'm dealing with here.
I'm trying to get the yDoc UML Doclet to work so that it will generate UML diagrams for my Java app as part of the Ant build. I downloaded the project (community edition) and have tried adapting their build-sample.xml but can't quite get it to work.
Here's my project directory structure:
MyProject/
    src/main/java/
        <All the Java sources I want documented and diagrammed>
    bin/main
        <Compiled binaries of src/main/java/>
    lib/
        styleed.jar
        ydoc.jar
    resources/
        <All the yDoc resources that came with the download>
    umldoclet/
        <Where I want all JavaDocs to go>
    build.xml

Here's build.xml:
<project name="MyProject" default="ydoc" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:jacoco="antlib:org.jacoco.ant">

    <!-- The "compile" task and all its dependencies omitted for brevity,
         but they all absolutely work 100% and "compile" places compiled
         CLASS files under bin/main. -->

    <target name="ydoc" depends="compile">
        <property name="ydoc.home" value="${basedir}"/>

        <javadoc source="1.5" destdir="./umldoclet" additionalparam="-breakiterator">
            <packageset dir="src/main">
                <include name="java/**"/>
            </packageset>
            <doclet name="ydoc.doclets.YStandard" path="${ydoc.home}/lib/ydoc.jar;${ydoc.home}/resources">
                <param name="-author"/>
                <param name="-generic"/>
                <param name="-umlautogen"/>
                <param name="-filterpath" value="./lib/ydoc.jar"/>
                <param name="-filter" value="ydoc.filters.ExcludeFilter"/>
                <param name="-tag" value="y.precondition"/>
                <param name="-tag" value="y.postcondition"/>
                <param name="-tag" value="y.complexity"/>
                <param name="-tag" value="param"/>
                <param name="-tag" value="return"/>
                <param name="-tag" value="see"/>
                <param name="-tag" value="y.uml"/>
            </doclet>
        </javadoc>
    </target>
</project>

When I run the ydoc task, even running Ant in "verbose" mode with the -v argument, I see the [ydoc] task getting called in the Ant Console, followed by a log statement that reads "Generating Javadoc" and about 20 lines from the verbose output regurgitating the yDoc params back to me, then a final log message saying "Javadoc execution". Then, the following stunningly-vague IOException:
BUILD FAILED
<my-eclipse-home>/MyProject/build.xml:200: Javadoc failed: java.io.IOException: Cannot run program "javadoc": java.io.IOException: error=2, No such file or directory
    at org.apache.tools.ant.taskdefs.Javadoc.execute(Javadoc.java:1765)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:392)
    at org.apache.tools.ant.Target.performTasks(Target.java:413)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
    at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.io.IOException: Cannot run program "javadoc": java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
    at java.lang.Runtime.exec(Runtime.java:610)
    at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
    at org.apache.tools.ant.taskdefs.Javadoc.execute(Javadoc.java:1759)
    ... 15 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
    ... 20 more

Is there any way to get more details out of Ant? To find out what file or directory its referring to in the exception? Any JavaDoc/yDoc gurus ever ran into this before? Is my project directory structure set up incorrectly, or different than what the Ant build is looking for? I believe I have my doclet/path attribute set up correctly, and using the correct path separators (I'm on Ubuntu Linux). For the life of me I can't figure out where to go from here, or how to go about diagnosing the underlying issue here! Thanks in advance!
Edit/Update:
Thanks to everyone so far for the suggestions. I am doing away with Eclipse totally (as far as the build is concerned and just running Ant from the command-line; this is fine for now. When I do this, I get a successful build (so Eclipse was at least partly the culprit), however still no yDoc generation.
Now, when I run Ant from the terminal with the verbos (-v) option, here's what I see:
Hundreds of warnings that look the same, but with different classes:
[javadoc] Constructing Javadoc information...
[javadoc] /<path-to-my-project>/MyProject/src/main/java/com/some/pkg/SomeObject.java:11: package org.springframework.beans.factory.annotation does not exist
[javadoc] import org.springframework.beans.factory.annotation.Autowired;
[javadoc]                                                    ^

After hundreds of those, I get the following output (1 of these for every package in my source tree):
[javadoc] javadoc: warning - No source files for package java.com.some.pkg.<whatever>

Last, the final section of the verbose build output:
[javadoc] Valid license file found.
[javadoc] Registered Filter ydoc.filters.ExcludeFilter ...
[javadoc] Registered Taglet for tag @y.complexity ...
[javadoc] Registered Taglet for tag @y.precondition ...
[javadoc] Registered Taglet for tag @y.postcondition ...
[javadoc] Registered Taglet for tag @y.author ...
[javadoc] 1 error
[javadoc] 109 warnings
[javadoc] javadoc: error - No public or protected classes found to document.

BUILD SUCCESSFUL
Total time: 6 seconds

Furthermore, if it were executing correctly, it should be places all the JavaDocs under the uml-doclet/ directory in my project root. It does no such thing!
So it looks like there are several more things going on:

*

*The JavaDoc can't see my 3rd party dependencies (such as Spring, Camel, etc.); hence the list of hundreds of warnings

*It can't find any of my sources to document

Again, the bounty goes to anyone who can help me get this working. Thanks again for all the help so far!

A: It looks like ant is failing to find the javadoc binary. I don't think ant uses the defined PATH to find the javadoc binary (the docs says that it uses the same JDK that ant uses).
Some of the things I would try are:

*

*Add the executable attribute to the task, to point to a javadoc binary (I'm not saying this is a correct solution, but if it works, it means that there's a problem with the location from where ant is looking by default).

*Ensure that your JAVA_HOME and PATH points to a JDK rather than JRE

*Ensure that your JAVA_HOME points to the same java installation that your PATH points to.

A: If you execute ant with -verbose -debug you will either see these lines:
Setting project property: ydoc.home -> /var/tmp/ydoc-test
  [javadoc] scanning /var/tmp/ydoc-test/src/main for packages.
dirset: Setup scanner in dir /var/tmp/ydoc-test/src/main with patternSet{ includes: [java/**] excludes: [] }
  [javadoc] Generating Javadoc
  [javadoc] Executing '/usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc' with arguments:
  [...]

Or you will see these lines:
Setting project property: ydoc.home -> /var/tmp/ydoc-test
  [javadoc] scanning /var/tmp/ydoc-test/src/main for packages.
dirset: Setup scanner in dir /var/tmp/ydoc-test/src/main with patternSet{ includes: [java/**] excludes: [] }
  [javadoc] Generating Javadoc
  [javadoc] Executing 'javadoc' with arguments:

In the first case Eclipse/Ant have found a valid javadoc command and tell you so in the line [javadoc] Executing >FULL_PATHNAME_TO_JAVADOC>. In the second case it only talks about javadoc without any pathname and the debug output will show your exceptions later.
I assume that your case is the second one, but please check it!
If Eclipse / Ant don't know the location of javadoc you first should simplify things by taking Eclipse out of the equation: Use the command line and check that typing these commands do not result in in a "command not found" message:
java
javac
javadoc

I assume that the first one is OK (after all you can run Eclipse as shown in you stacktraces). If the second and third command are not found, you have not installed an JDK but only a JRE on your computer. Install one and restart Eclipse.
If on the other hand javac is found but javadoc not, then your JDK is broken.
If both javac and javadoc are found then Eclipse simply does not know about it. But before going back to Eclipse type a last command in the command shell:
readlink -m $(which javadoc)/../..

Remember the path readlink gives you.
In Eclipse goto "Window -> Preferences -> Java -> Installed JREs". In the list select the entry with the checked checkbox and press "edit". If the line "JRE home" is not the same as the path readlink gave you, then most likely your Eclipse is configured to use only a local JRE but not your installed JDK.
If that's the case then cancel that "Edit" dialog, press "Add", select "Standard VM" and enter the path readlink gave you. After entering that path correctly Eclipse should fill out the other fields for you, hence you can just say "OK". Back in the "Installed JRE" list tick on the new item.
After that the javadoc task per se should start.
EDIT
However you need some more adjustments:
First: In this part:
       <packageset dir="src/main">
            <include name="java/**"/>
        </packageset>

you are mixing the source directoy and the package parts. It should read:
       <packageset dir="src/main/java">
       </packageset>

Also javadoc likes to have access to referenced classes. Therefore you should add the same classpath to javadoc as you used for compiling your code. So add an appropriate <classpath> section right after </packageset>. This will take care of the "package xyz does not exist" warnings.

A: I would change these lines in your build.xml :
<packageset dir="src/main/java">
    <include name="**" />
</packageset>


text:
Q: Android - back arrow doesn't return to MainActivity when opened via notification In android app I have let's say 2 activities - MainActivity and OtherActivity. When I press the back arrow in OtherActivity, it goes back to MainActivity, this is working fine. This is the part of code in OtherActivity:
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        onBackPressed();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

But when I send a notification, after clicking the notify window, OtherActivity opens - that is ok, as I want. This is caused by this code in Notifications:
private void sendNotification(String title, String body) {
    Intent i = new Intent(this, OtherActivity.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pi = PendingIntent.getActivity(this,
            0 /* Request code */,
            i,
            PendingIntent.FLAG_ONE_SHOT);
}

This works very well, but now if I press the back arrow on OtherActivity, it just exits the app and goes not to MainActivity.
I have already set the parent in manifest for OtherActivity, so I am not sure why it is not going to MainActivity:
   <activity
            android:name=".OtherActivity"
            android:label="OtherActivity"
            android:parentActivityName=".MainActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme" />

A: The way the back button works is that it just restarts the previous activity, in the case of pressing back after opening the app from the notification the code skips the main activity and that makes it normal that the app just closes when you click back, the way to handle this would require some work at the first time but then would work like a charm for you in every other step or notification handling.
What you need to do is to create a layer that handles the launch of your app, for example Splash Screen > Authentication > MainActivity > any other Activity (or stop at Main if first time launching and not from notification), that way when a user clicks on the notification, don't redirect him to the OtherActivity from the start, instead redirect to the AppLauncher for example and let the app launcher do all the previous steps to reach your MainActivity and then to the OtherActivity, that way if the user clicks back from OtherActivity or OtherActivity2, etc., he will always return to the MainActivity after pressing back after opening the app from a notification.
About setting a new Intent for the onBackPressed to re-open MainActivity, this is a terrible solution as you are creating a new Instance of your already open MainActivity and this will be a huge data leak and performance issue, you will notice the app going slower till it terminates if you keep redirecting back and forth between Main and Other Activities in this scenario.

A: OK, I think finally I found the answer. In my Sendnotification method I use this:
    Intent backIntent = new Intent(this, MainActivity.class);
    backIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Intent notificationIntent = new Intent(this, OtherActivity.class);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    final PendingIntent pi = PendingIntent.getActivities(this, 1,
            new Intent[] {backIntent, notificationIntent}, PendingIntent.FLAG_ONE_SHOT);

Now this is working as expected.


text:
Q: Select dependent on another select - Material Angular I would like to create two mat-selects. One of them (related with reference) is dependent on the select with type.
types is an array with enums implemented in Typescript.
I tried as follows, but after choice on of the references which were correct after change type, the select with reference is empty...
<mat-form-field>
  <mat-label>Type</mat-label>
  <mat-select placeholder="Type" formControlName="type" name="type">
    <mat-option>None</mat-option>
    <mat-option *ngFor="let t of types" [value]="t">
      {{t}}
    </mat-option>
  </mat-select>
</mat-form-field>

<mat-form-field>
  <mat-label>Reference</mat-label>
  <mat-select placeholder="Reference" formControlName="reference" name="reference">
    <div [ngSwitch]="type.value">
      <div *ngSwitchCase="types[0]">
        <mat-option *ngFor="let r of deliveries" [value]="r.id">
          {{r.id}}
        </mat-option>
      </div>
      <div *ngSwitchCase="types[1]">
        <mat-option *ngFor="let r of orders" [value]="r.id">
          {{r.id}}
        </mat-option>
      </div>
      <div *ngSwitchDefault>
        <mat-option>None</mat-option>
      </div>
    </div>
  </mat-select>
</mat-form-field>

Could someone please assist? Maybe, there's a better way of doing it?
By the way... Creating new object without "select with reference" is correct, so probably the logic of this select is guilty...

A: there're several ways to achaive this. You can, e.g. create two array of array
deliveries=[[1,2,3],[4,5],[6,7,8]]
orders=[["A","B","C"],["D","E"],["F","G","H"]]

and make the
<mat-option *ngFor let r of deliveries[myForm.get('type').value]>...</mat-option>
 //and
<mat-option *ngFor let r of orders[myForm.get('type').value]>...</mat-option>


text:
Q: Plotting a barchart over a histogram in R I am trying to overlay a histogram with a stacked barplot, yet the barplot is always shifted to the right as it starts plotting from zero. See below for an example on what I am trying to do (without using ggplot, I should maybe add).
set.seed(1)

dat <- rnorm(1000, sd = 10)
h <- hist(dat)
cnt <- h$counts
breaks <- h$breaks

mat <- matrix(NA, nrow = 3, ncol = length(cnt))
for(i in 1:length(cnt)){
  sample <- sample(1:3, size = cnt[i], replace = TRUE)
  for(j in 1:3){
    mat[j, i] <- sum(sample == j)
  }
}

barplot(mat, add = TRUE, width = unique(diff(breaks)), space = 0,
        col = c("blue", "green", "orange"))

The output from this code looks as follow:

I have tried using columnnames in the matrix mat which specify the position, but to no avail. In the plot I want to create the histogram will be overplotted entirely, as it should be in the exact same place as the barplot. The reason for plotting it in the first place is that I want the axis that a histogram plot gives me. Any ideas on how to do this are very much appreciated.

A: You may combine the bar mids of barplot console output and breaks of hist to create axis ticks; subtract half of barplot widths from the bar mids. Using mtext gives a better control for the axis labels.
h <- hist(dat, plot=FALSE)
# [...]

.width <- unique(diff(breaks))
b <- barplot(mat, width=.width, space=0,
        col=c("blue", "green", "orange"))
axis(1, b-.width/2, labels=FALSE)
mtext(h$breaks[-length(h$breaks)], 1, 1, at=b-.width/2)

Edit
.width <- unique(diff(breaks))
b <- barplot(mat, width=.width, space=0,
             col=c("blue", "green", "orange"))
ats <- seq(0, par()$usr[2], 5)
mod <- (ats + 5) %% 20 == 0
labs <- h$breaks
axis(1, ats[mod], labels=FALSE)
mtext(labs[mod], 1, 1, at=ats[mod])

A: I would just set a manual x axis to the barplot with the desired labels at the desired position, like this:
barplot(mat, width = unique(diff(breaks)),space = 0,
        col = c("blue", "green", "orange"))
axis(1,at=c(15,35,55,75),labels = c(-20,0,20,40))


text:
Q: Как подтянуть куки в Environment - Postman Для того что бы положить значение из ответа в jSon в Environment - я использую форму:
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("имя в энваироменте", jsonData.значение);

А вот как забирать значение из cookie, полученное в ответе, и записывать их в Environment - Для использования в следующем запросе ?


text:
Q: Why IIFE this keyword refers to window object..? When I run the below IFFE, why does the this keyword refer to the window object and not to a variable?
var a = {
 printThis : function () {
 console.log('printThis', this);
  var inner = (function () {
    console.log('inner', this);
   })();
  }
};

a.printThis();

Result in the following output:
printThis **an object**

inner **window object**   <-- why..?

var a = {
  printThis: function() {
    console.log('printThis', this);
    var inner = (function() {
      console.log('inner', this);
    })();
  }
};

a.printThis();

A: Consider the following example:
var a = {};
var b = {};
a.hello = function() { console.log(this); };
b.hello = a.hello;

In most programming languages, b.hello() would print a since they base this on where the function is. The function is in a, so this is a. Makes sense, right?
However, JavaScript is a bit different in that regard. Instead of where it is, it's based on how it was called. b.hello() calls hello on b, thus this is set to b. This also makes sense since JavaScript doesn't really have a concept of "where" a function is (unlike methods in, say, Java, which are always tied to a specific class), and it's hard to determine that a is where it "is".
So, foo.bar() will always set this to foo for the purposes of this call to bar (unless one has used bind or similar to bind this to a specific value in advance).
Now, an IIFE is invoked on... nothing, really. It's not a foo.bar() situation, it's just a bar() where bar is your function expression. In cases like this where there's no foo, it defaults to the window object.
There are two simple workarounds:

*

*Create a variable outside the IIFE containing the value you´re interested in: var that = this; and use that instead of this in the IIFE, or

*bind the this value: (function(){ CODE GOES HERE }).bind(this)();


text:
Q: Does adding [[noreturn]] to main function make sense As far as I understand, C++ attribute [[noreturn]] can be applied to functions not returning to the caller so that the compiler can generate more optimised code. I do understand it makes a difference for "normal" functions, but was wondering if it also makes a difference in performance when applying it to the main function.
Assuming I want to write a program constantly running with no chance it aborts (meaning the main function will never return to the caller (= operating system)
Which of this generates in faster (more optimised) code or does it not make a difference at all?
Option 1:
int main()
{
    while(true)
    //..
    return 0;
}

Option 2:
[[noreturn]] int main()
{
    while(true)
    //..
    return 0;
}

A: The noreturn is mostly useful for callers of functions, not for the functions themselves, and in the case of main() the caller of main() is the C++ runtime, which is ready-made, so the compiler does not get to compile it, so there is nothing to optimize there.
However, there is a tiny benefit to be gained within your main(), since theoretically, the noreturn version will produce slightly smaller code, since the compiler can omit the sequence of instructions known as epilogue.
These performance (speed/size) gains are trivial and not really worth paying much attention to.  What is more interesting is the possibility of receiving a warning if you have written any code right after a call to a noreturn function. In this case the compiler should be able to warn you that this code of yours will never be executed.  I find this a lot more useful.

A: The noreturn attribute is supposed to be used for functions that don't return to the caller. That doesn't mean void functions (which do return to the caller - they just don't return a value), but functions where the control flow will not return to the calling function after the function finishes (e.g. functions that exit the application, loop forever or throw exception).
This can be used by compilers to make some optimizations and generate better warnings. For example if f has the noreturn attribute, the compiler could warn you about g() being dead code when you write f(); g();. Similarly the compiler will know not to warn you about missing return statements after calls to f().
from What is the point of noreturn?
EDIT:
to asnwer clearly to the post. There is I think a tiny benefit to use no return in main but it's a bad practice. In C/C++ by "convention" if everything worked well you must return 0; in your main


text:
Q: How to visualize the structure of this dynamic programming code I am studying Mr. Wizard's answer to this question which tries to identify elementary circles in a graph. That answer uses dynamic programming technique to simplify the code. The underlying guideline in the code is that, in Mathematica, more specific rules are applied before more general rules. Thus, the three functions with the same name f:
(* case 1 *)
f[x_, b___, x_] := (
   (f[##] = {}) & @@@ NestList[RotateLeft, {x, b}, Length@{x, b} - 1];
   {{x, b}}
);

(* case 2 *)
f[circle__] /; Signature@{circle} === 0 = {};

(* case 3 *)
f[circle___, vertex_] :=
  Join @@ (f[circle, vertex, #] & /@ ReplaceList[vertex, edges]);

will always be checked and evaluated in the order case1 -> case2 -> case3. Where the circle___ is initially an nonexistent expression and I slightly modify the variable names to make the code easier to understand. For example, when we evaluate f[1], firstly the pattern of case1 doesn't apply, so we come to case2 which is also not applicable due to the fact thatSignature@{1} is not 0. Finally we check that case3 is applicable and duo to SetDelayed we need to temporarily leave the evaluation of f[1] and try to compute f[1,2] and f[1,4] instead, and so on. We can use Trace[f[1]] or Trace[f[1], f[__]] to get a sense of the evaluation progress. But the results are nested expressions and not easy to recognize.
It will be helpful for us to understand the code better if we can find a way to visualize the dynamic progress. A first try can be made like this
op = {{1, 2}, {1, 4}, {2, 3}, {2, 5}, {3, 1}, {3, 6}, {4, 1}, {4,
    6}, {5, 4}, {5, 2}, {6, 5}, {6, 3}};
vertices = Union @@ op;
edges = Rule @@@ op;

traceRes = Trace[f[1], f[__]];
traceResIndex = traceRes /. MapIndexed[#1 -> #2[[1]] &,
    DeleteDuplicates@Flatten@traceRes];
pos = First@Position[traceResIndex, #] & /@ Flatten[traceResIndex];
pos = Sort[pos, Length[#1] <= Length[#2] &];
pos = Gather[pos, Length[#1] == Length[#2] &];

length = Length[pos];
i = 1;
linkedVretices = {};
With[{cmuopt = SystemOptions["CompileOptions"]},
  Internal`WithLocalSettings[
   SetSystemOptions[{
     "CompileOptions" -> "ListableFunctionCompileLength" -> Infinity,
     "CompileOptions" -> "MapCompileLength" -> Infinity
     }], (
    While[i + 1 <= length,
      linkedVretices = {
        linkedVretices,
        Map[
         Block[{subList, subLength, link, var},
           subList = pos[[i, #]];
           subLength = Length[subList];
           subList[[-1]] += 1;
           link = Select[pos[[i + 1]], #[[;; subLength]] == subList &];
           Thread[Rule[var, link]] /. var -> pos[[i, #]]
           ] &, Range@Length@pos[[i]]
         ]};
      i += 1;
      ];),
   SetSystemOptions[cmuopt]
   ]];
linkedVretices = Flatten[linkedVretices];
linkedVretices = Apply[traceRes[[##]] &, linkedVretices, {2}]

GraphPlot[linkedVretices, VertexLabeling -> True]

We can clearly understand the progress from the above graph. However, as the input data op gets a bit more complex, for example,
op = {{1, 2}, {1, 9}, {2, 3}, {2, 17}, {3, 4}, {3, 13}, {4, 1}, {4,
    5}, {5, 4}, {5, 6}, {6, 16}, {6, 7}, {7, 8}, {7, 22}, {8, 5}, {8,
    10}, {9, 1}, {9, 10}, {10, 8}, {10, 11}, {11, 12}, {11, 21}, {12,
    9}, {12, 18}, {13, 14}, {13, 3}, {14, 15}, {14, 20}, {15,
    16}, {15, 23}, {16, 13}, {16, 6}, {17, 2}, {17, 18}, {18,
    19}, {18, 12}, {19, 24}, {19, 20}, {20, 17}, {20, 14}, {21,
    11}, {21, 22}, {22, 7}, {22, 23}, {23, 15}, {23, 24}, {24,
    19}, {24, 21}};

Then the result will be
GraphPlot[linkedVretices, VertexLabeling -> Tooltip]

or if we use CommunityGraphPlot

Now it is too complex for extracting useful information. I wonder if we can find a way to clearly visualize the progress, like only show some "local graph" in-progress? Such technique, although not very important for actually solving problems, can still be valuable for tracking.

A: You could reconstruct graph with some more information. Here, I add Tooltip wrapper to vertex to show NeighborhoodGraph of that vertex in distance 2:
g = Graph[linkedVretices];

Graph[
   Tooltip[#,
   HighlightGraph[
   NeighborhoodGraph[g, #, 2,
   VertexShapeFunction -> (Text[Pane[#2, 80], #1] &),
   GraphLayout -> {"RadialEmbedding", "RootVertex" -> #},
   VertexStyle -> Black], #1]] & /@ VertexList[g],
   EdgeList[g],
   GraphStyle -> "LargeNetwork", GraphLayout -> {"RadialEmbedding"}]

Here, I add the rough version that select vertices by rectangle area and generate subgraph.  I just create separate static window to show snapshot of selected subgraph, but you could easily make dynamic window that respect sub vertices.
First, some pre-computation:
g = Graph[linkedVretices, GraphLayout -> "RadialEmbedding"];
vcoord = GraphEmbedding[g];
{xrange, yrange} = {Min[#], Max[#]} & /@ Transpose[vcoord];
xwid = Abs[xrange[[2]] - xrange[[1]]];
ywid = Abs[yrange[[2]] - yrange[[1]]];
xrange = xrange + .1 xwid {-1, 1};
yrange = yrange + .1 ywid {-1, 1};
isize = {600, 600};
g = Graph[linkedVretices, VertexCoordinates -> vcoord,
   PlotRange -> {xrange, yrange}, PerformanceGoal -> "Speed",
   VertexShapeFunction -> "Point", ImageSize -> isize,
   VertexStyle -> Black];
crule = Thread[vcoord -> VertexList[g]];

and generate Manipulate:
DynamicModule[{x, y, xmin, xmax, ymin, ymax, ptin, vin, subg},
 Manipulate[
  Overlay[{Dynamic[g],
    Graphics[{{Opacity[.2],
       Dynamic[Rectangle[pts[[1]],
         pts[[2]]], {None, {x, y} = Transpose[pts];
         {xmin, xmax} = Through[{Min, Max}[x]];
         {ymin, ymax} = Through[{Min, Max}[y]];
         ptin =
          Cases[vcoord,
           x_ /; (xmin <= x[[1]] <= xmax && ymin <= x[[2]] <= ymax)];
         }]}, {Orange, Point[Dynamic@ptin]}},
     PlotRange -> {xrange, yrange}, ImageSize -> isize]}, All, 2],
  {{pts, {{xrange[[1]], yrange[[2]]}, {xrange[[1]] + xwid .2,
      yrange[[2]] - ywid .2}}}, Locator},
  Button["Zoom", vin = ptin /. crule;
   subg = Subgraph[g, vin,
     VertexCoordinates -> vcoord[[VertexIndex[g, #] & /@ vin]],
     VertexLabels -> Placed["Name", Tooltip]];
   CreateDialog[subg, WindowTitle -> "Zoom",
     WindowFrameElements -> {"CloseBox", "ResizeArea"},
     WindowFloating -> True],
   Method -> "Queued"]]
 ]

you could wrap this as one function.


text:
Q: visually customizing Git Status output? I was wondering if it was possible, to colorize a specific part of the git status message, specifically:
your branch is ahead of ... by x commits
Is that possible somehow?

A: According to the documentation this does not seem to be possible.
The closest you could get to that is to colorize the whole header text as follows:
git config --global color.status.header yellow

with the outcome being something like this:


text:
Q: back-to-top button not appearing Using Javascript, I've added a back-to-top button to my website.  When I scroll, it appears (so the first function below works fine).  However, when I add the second function, the button doesn't even appear when I scroll.  I've been at this for hours!  Have I missed something obvious?
window.addEventListener("scroll", appear);

function appear(){
  if (document.documentElement.scrollTop > 20)
    {document.getElementById("button").style = "display: block;"}
  else
    {document.getElementById("button").style = "display: none;"}
};

document.getElementById("button").addEventListener("click", top);

function top(){
  document.documentElement.scrollTop = 0
};

Edit:
html
<img id="button" src="button.jpg" alt="the back-to-top button">

css
#button {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 1;
  height: 50px;
  border-radius: 10px;
  cursor: pointer;
}

A: Ok, so the issue here, I believe is that top is already a property on window and you are replacing it by creating a global function called top.
This will work if you change your function to something like goToTop.
If you log console.log(window.top) you'll find something already exists there.
window.addEventListener("scroll", appear);

function appear(){
  if (document.documentElement.scrollTop > 20)
    {document.getElementById("button").style = "display: block;"}
  else
    {document.getElementById("button").style = "display: none;"}
};

function goToTop(){
  document.documentElement.scrollTop = 0
};

document.getElementById("button").addEventListener("click", goToTop);

A: Instead of
document.getElementById("button").style = "display: block;"
I think you should write
document.getElementById("button").style.display = "block"
similar to the next one.
I refer to this website - https://www.w3schools.com/jsref/prop_html_style.asp


text:
Q: How can i check if data is " " How can i check if data is blank but not null
the data is == " " but it still proceeds to the else statement.
Here is my code :
@if(App\Company::all()->first()->logo == " ")

@else
    first()->getLogoAttribute()}}' style=" width: 20%;">
@endif

A: You can use the is_null() and the empty() method:
<?php $logo = App\Company::all()->first()->logo;
@if(is_null($logo) == false && empty($logo) == true)

@else
    first()->getLogoAttribute()}}' style=" width: 20%;">
@endif


text:
Q: Eloquent: check if relationship has certain conditions I have a model Survey which is related to hasOne  another model Installation which is related to hasMany another model Assignment.
So i defined a hasManyThrough relationship like this
public function assignments()
    {
        return $this->hasManyThrough(Assignment::class,Installation::class);
    }

I want to write a query to fetch any Survey where the Assignments associated with the survey does not have an assignment.type of 0,1,2,3 and 4.
i.e.
Each survey should have an 5 assignments with records
Survey => [
[Assignment => [type = 0]]
[Assignment => [type = 1]]
[Assignment => [type = 2]]
[Assignment => [type = 3]]
[Assignment => [type = 4]]
]

I tried this query
 $schedulables = Survey::whereNotNull('installer_id')
            ->where(function ($query) {
                $query
                    ->whereNotExists(function ($query) {
                        return $query->raw('SELECT * FROM assignments,installations where assignments.installation_id = installations.id and installations.survey_id = surveys.id and assignments.type= 1');
                    })
                    ->orwhereNotExists(function ($query) {
                        return $query->raw('SELECT * FROM assignments,installations where assignments.installation_id = installations.id and installations.survey_id = surveys.id and assignments.type= 2');
                    })
                    ->orwhereNotExists(function ($query) {
                        return $query->raw('SELECT * FROM assignments,installations where assignments.installation_id = installations.id and installations.survey_id = surveys.id and assignments.type= 3');
                    })
                    ->orwhereNotExists(function ($query) {
                        return $query->raw('SELECT * FROM assignments,installations where assignments.installation_id = installations.id and installations.survey_id = surveys.id and assignments.type= 4');
                    });

            })
            ->with('customer', 'installer', 'installation')
            ->latest('updated_at')->get();

Please any suggestions and help would be appreciated.

A: If I've understood your question correctly, you can use whereHas() and whereNotIn() to achieve what you're after:
$schedulables = Survey
    ::with('customer', 'installer', 'installation')
    ->whereNotNull('installer_id')
    ->whereHas('assignments', function ($query) {
        $query->whereNotIn('type', [0, 1, 2, 3, 4]);
    })
    ->latest('updated_at')
    ->get();

A: My final solution was to create these relationships in the Survey model
 public function assignment_outdoor(){
        return $this->hasManyThrough(Assignment::class,Installation::class)
            ->where('assignments.type',1)
            ->where('assignments.status',2);
    }
    public function assignment_indoor(){
        return $this->hasManyThrough(Assignment::class,Installation::class)
            ->where('assignments.type',2)
            ->where('assignments.status',2);
    }
    public function assignment_testing_activation(){
        return $this->hasManyThrough(Assignment::class,Installation::class)
            ->where('assignments.type',3)
            ->where('assignments.status',2);
    }
    public function assignment_lm_splicing(){
        return $this->hasManyThrough(Assignment::class,Installation::class)
            ->where('assignments.type',4)
            ->where('assignments.status',2);
    }

And then built the query using doesntHave and ordoesntHave.
$schedulables = Survey::when($installer_filter, function ($query, $installer_filter) {
            return $query->where('installer_id', $installer_filter);
        })
            ->whereNotNull('installer_id')
//actual solution
            ->where(function ($query) {
                return $query

                    ->doesntHave('assignment_outdoor')
                    ->orDoesntHave('assignment_indoor')
                    ->orDoesntHave('assignment_testing_activation')
                    ->orDoesntHave('assignment_lm_splicing');

            })
//end
            ->doesntHave('network_job_order_customer')
            ->with('customer', 'installer', 'installation')
            ->latest('updated_at');


text:
Q: If-Modified-Since vs If-None-Match This question is based on this article
response header
HTTP/1.1 200 OK
Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT
ETag: "10c24bc-4ab-457e1c1f"
Content-Length: 12195

request header
GET /i/yahoo.gif HTTP/1.1
Host: us.yimg.com
If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT
If-None-Match: "10c24bc-4ab-457e1c1f"
HTTP/1.1 304 Not Modified

In this case browser is sending both If-None-Match and If-Modified-Since. My question is on the server side do I need to match BOTH etag and If-Modified-Since before I send 304.
Or
Should I just look at etag and send 304 if etag is a match. In this case I am ignoring If-Modified-Since .

A: Excerpt from RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1"

13.3.4 Rules for When to Use Entity Tags and Last-Modified Dates
...
An HTTP/1.1 origin server, upon receiving a conditional request that
includes both a Last-Modified date (e.g., in an If-Modified-Since or
If-Unmodified-Since header field) and one or more entity tags (e.g.,
in an If-Match, If-None-Match, or If-Range header field) as cache
validators, MUST NOT return a response status of 304 (Not Modified)
unless doing so is consistent with all of the conditional header
fields in the request.

A: You only need to send and conversely check the pair in which you are interested.  So, if you have an ETag, send an ETag header and check the If-None-Match header.  If you have a Last-Modified date, send a Last-Modified date and check the If-Modified-Since header.

A: If you can get Last-Modified before generating the content, and you generate your etag from the content, you should check Last-Modified before content generation, and abort the generation if it match's to save sever recourse's espically with graphics operations, I have a PHP script that takes about .8s retrieve an image, here i use a sever cache an generate the image taking about 1.6s if its out of date, otherwise I return that, however, in the if-modified-since date is more than or equal to the modified date, i don't even retrive it from my sever cache, and finally I use an md5 checksum of the content as an etag, i the etag I generate match the If-None-Match request header, I don't bother sending the data, to save sever bandwidth.

A: The server can use either.  Presumably since you provided both, you can theoretically check both on the server, and of course the browser is right to provide both as well.
You might as well check whichever is faster to check.  If these are files on disk, for example, checking last-modification time (mtime) will be faster than MD5'ing the content.
But in other systems the MD5 can be stored somewhere as meta-data, e.g. in a database or a header like in S3, in which case the ETag might actually be just as fast.
Of course you're also not required to do anything.  That is, you can elect to ignore either one and just return a normal 200 code with content.  So if those things are inconvenient for you, no worries.


text: Q: Update @Named("someproperty.key") Runtime I am using Guice 3.0. I have used Names.bindProperties() to bind a property file key and values. However, my requirement is that, at run time if i change the property value for a Named key, it should be bound automatically through a Scheduler or some job which is running at pre-defined interval. Is that possible? I could not find any post for the same. Any help is appreciated.


text:
Q: Is it possible to use Madeline proto library to upload files without bot? Here is a class for downloading file from URL but it work only when user go to bot and send link to that bot. Is it possible to call these functions directly without opening bot. Link to that sample code.
https://github.com/danog/MadelineProto/blob/master/examples/downloadRenameBot.php


text:
Q: DOMNodeInserted Not Working Properly I have a problem ..
The "DOMNodeInserted" is not working as it supposed to.
I am not sure if I am using it properly.
Any ideas ?

A:
EDIT: Scroll further down for an better approach using a MutationObserver.

When constructing the DOM at page-loading, no DOMNodeInserted events are fired. I don't think there is a way to have the HTML pass through your filter before being rendered (or if there is I don't know it).
Filtering on DOMContentLoaded instead, might be quick enough for the user not to notice the difference (or at least not to bother too much).
Of course, you have to listen for dynamic changes in the DOM (e.g. content loaded via AJAX etc) and filter it dynamicaly. A MutationObserver might come in handy for that.
Take a look at this demo code, to get you started on this approach:
manifest.json
(Note that for this to work you don't need any of the following:
browser_action, page_action, background, permissions)
...
"content_scripts": [
    {
        "matches": [
            "http://stackoverflow.com/*",
            "http://www.stackoverflow.com/*"
        ],
        "js":         ["content.js"],
        "run_at":     "document_start",
        "all_frames": true
    }
],
...

content.js
// Implement your filtering mechanism
// Good luck trying not to break the HTML :)
var doFilter = function(elem) {
    // Demo filtering: highlighting links
    // (and possibly breaking HTML in many pages)
    elem.innerHTML = elem.innerHTML.replace(
        /(<a[^>]*)(>[^<]*<\/a>)/ig,
        "$1 style=\"background-color: yellow;\"$2");
};

window.addEventListener("DOMContentLoaded", function() {
    doFilter(document.body);
});

UPDATE
Here is a different approach using a MutationObserver, which is even more quick. Using this approach the changes should be virtualy "transparent" to the user.
(This still needs twicking, e.g. to handle dynamic node updates.)
content.js
// Highligth the element by giving it a yellow background
var doFilter = function(link) {
    link.style.backgroundColor = "yellow";
}

// Create a MutationObserver to handle events (i.e. filtering <a> elements)
var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
        if (mutation.addedNodes) {
            for (var i = 0; i < mutation.addedNodes.length; i++) {
                var node = mutation.addedNodes[i];
                if (node.nodeName == "A") {
                    doFilter(node);
                }
            }
        }
    });
});

// Start observing "childList" events in document and its descendants
observer.observe(document, {
    childList:     true,
    subtree:       true
});

If you decide to go for the MutationObserver approach, there is this JS library that is supposed to make your life easier: mutation-summary


text:
Q: Draw multiple polygon inside rectangle based on line intersection point I have created below SVG using svg.js 2.7
Now I want to draw all possible polygons made based on lines intersection with other line and outer rectangle.
I have got all intersection points for lines and lines intersection with the outer rectangle using svg.js plugin svg-intersections-js
My requirement is, I want to display a hover effect for every possible polygon.
Edit 1: Line position and alignment are dynamic.
Is it possible?


text:
Q: Hidden attributes didn't hide the file completely? Let say a file has attribute Hidden but when I unchecked the Hide protected operating system files from folder options file is visible.
Io.File.SetAttributes("File.txt",IO.FileAttributes.Hidden)

How to resolve this problem?

A: From the point that you want to hide a file and never be seen by allowing to display hidden files and folders, you can restrict directory access which will not let you open the directory in the first place. This piece of code can be put to use:
DirectorySecurity dirSecurity;
bool modifiedFlag;

dirSecurity = Directory.GetAccessControl(yourFolderPath);

foreach (AuthorizationRule rule in dirSecurity.GetAccessRules(true, true, typeof(System.Security.Principal.SecurityIdentifier)))
{
      // Secure file to not allow any modification actions by user
      dirSecurity.ModifyAccessRule(AccessControlModification.Add
                                   , new FileSystemAccessRule(rule.IdentityReference, FileSystemRights.Modify, AccessControlType.Deny)
                                   , out modifiedFlag);
}

Directory.SetAccessControl(yourFolderPath, dirSecurity);

Doing this you will block user from even opening the folder.


text:
Q: Increase MaxReceivedMessageSizeProperty I'm doing one mobile application and while calling one web service, I'm getting  MaxReceivedMessageSize error. It says this value should be increased.

I read that we can find this property in the WCF web config file and there we should increase the value.
But one web application is also using the same service and it is receiving the response. So Is the issue in mobile application happening because of the value in web config file or Do i need to set anything in the mobile app side to take care of this.
Please advise.

A: first, check the client side code and see if the service API is called with wrong value. i mean whether the big request message is normal for the application.
second, try to increase the value at server side and see if it solves the issue. e.g.
        <basicHttpBinding>
            <binding maxReceivedMessageSize="bigger value">
                ...
            </binding>
        </basicHttpBinding>

third, for the web application which uses the same service and receives response, can you double-check if web app and the mobile app use the same service (e.g. different endpooint)?


text:
Q: w3.css slideshow: How to add enlarge images in automatic slideshow in my website (www.ricpedrotti.com) I use PrettyPhoto for the slideshow. I want to lighten and speed up by replacing it with css3 and at most a bit of java.
I am able, separately, to make the slideshow and to enlarge the image with the hover, but I am not able to automatically grow the images inside the show.
My question is: how do I merge both effects (just like in PrettyPhoto)?
P.S. I am willing and passionate, but not very skilled ...
Thank you very much for your reply. I add my code, hoping it's not too
primitive, and the img upload is correct.
HTML[tryptics]
<link rel="stylesheet" href='css/stile.css' type="text/css" /><link href="css/stile.css" rel="stylesheet" type="text/css" />

 ![image1]="1.jpg"> ![image2]="2.jpg"> ![image3]="3.jpg"> ![image4]="4.jpg"> ![image3]="3.jpg"> ![image2]="2.jpg"> ![image1]="1.jpg"> ![image4]="4.jpg">

CSS
.container { position:relative; } .container img { position:absolute; width:350px; height:150px } div { margin:200px 250px; width:600px; height:300px; background:white; transition:all 2s ease ; } .grow:hover { -webkit-transform: scale(1.4); -ms-transform: scale(1.4); transform: scale(1.4); } @-webkit-keyframes xfade { 0% { opacity: 1; } 12.5% { opacity:1; } 16.5% { opacity:0; } 96% { opacity:0; } 100% { opacity:1; } } @keyframes xfade { 0% { opacity: 1; } 12.5% { opacity:1; } 16.5% { opacity:0; } 96% { opacity:0; } 100% { opacity:1; } } .container img:nth-child(8) { -webkit-animation: xfade 48s 0s infinite; animation: xfade 48s 0s infinite; } .container img:nth-child(7) { -webkit-animation: xfade 48s 6s infinite; animation: xfade 48s6s infinite; } .container img:nth-child(6) { -webkit-animation: xfade 48s 12s infinite; animation: xfade 48s 12s infinite; } .container img:nth-child(5) { -webkit-animation: xfade 48s 18s infinite; animation: xfade 48s 18s infinite; } .container img:nth-child(4) {

-webkit-animation: xfade 48s 24s infinite; animation: xfade 48s 24s infinite; } .container img:nth-child(3) { -webkit-animation: xfade 48s 30s infinite; animation: xfade 48s 30s infinite; } .container img:nth-child(2) { -webkit-animation: xfade 48s 36s infinite; animation: xfade 48s 36s infinite; } .container img:nth-child(1) { -webkit-animation: xfade 48s42s infinite; animation: xfade 120s 48s 42s infinite; }


text:
Q: Angular $location doesn't work I created a plunkr for this code and it can be viewed here:
The problem is very simple. I am trying to create a master/details scenario. So there are two templates: listings and details. In the listing controller there is a methods redirects to the detials route. This method works well as i verified it with the debugger (via breaking point).
 $scope.goToDetails = function(propItem) {
  //$rootScope.currentProperty = propItem;
  $location.path('/details/');

}

The 'details' path (see blow) calls the 'detailsController', which is currently (for testing purposes) defined as:
 var detailsController = function($scope, $http, $routeParams, $rootScope) {
    var dosomething = "do";
 };

I verified with the debugger that the execution indeed reaches the "dosomething" command and that the route changes in the browser to "details". However, and HERE is the problem, when I continue with the debugger, angular changes the route back to the default route. I went over the definitions but nothing that i did seems wrong.Any ideas?
Here is how I defined the routes:
app.config(function($routeProvider) {
$routeProvider
  .when('/main/', routes.main)
  .when('/details/', routes.details)
  .otherwise({
    redirectTo: '/main'
  });
});

var routes = {
  main: {
  templateUrl: 'PropertiesResults.html',
  controller: 'listingController'
},
details: {
  templateUrl: 'property-detail.html',
  controller: 'detailsController'
 },
}

A: Replace:
<a href="#" ng-click="goToDetails(property)" ...

With:
<a href="" ng-click="goToDetails(property)" ...

Or it will go to your otherwise route.

A: Change your link to be
Read More

A few things to consider:

*

*Links should work just like in a regular html page

*If you want to execute code on a new page, look into putting that code on the route, or in a controller in the new view.

*If you want to conditionally enable or disable the link, think about disabling the link with something like <a ng-disabled="expression"... this might not work out of the box but you could add a custom directive.

*If you still need to run that code in a controller method, consider using a <button type="button" class="link"... and style it to look like a link, e.g. display: inline; border: 0; background: transparent;"

Happy coding


text:
Q: How to teach AppArmor about toplevel symlinks I have my "root" partition split into two: a normal one that contains most files and a second one used for those areas that can "grow".  Concretely, this means, I have symlinks like:
/var/log   -> /part1/log
/var/cache -> /part1/cache
/var/spool -> /part1/spool

This worked well until I started using AppArmor which keeps complaining about things like cupsd looking at files in /part1/log/cups/..
I currently work around this problem by adding entries for each application protected by AppArmor, but this is tedious.
Is there some way to tell AppArmor once and forall that if access to /var/log/FOO is allowed than access to /part1/log/FOO should also be allowed?

A: It can be done in /etc/apparmor.d/tunables/alias as follows:
# Alias rules can be used to rewrite paths and are done after variable
# resolution. For example, if '/usr' is on removable media:
# alias /usr/ -> /mnt/usr/,
#
# Or if mysql databases are stored in /home:
# alias /var/lib/mysql/ -> /home/mysql/,

/var/log   -> /part1/log,
/var/cache -> /part1/cache,
/var/spool -> /part1/spool,

See also:

*

*https://manpages.debian.org/unstable/apparmor/apparmor.d.5.en.html#Alias_rules

*https://bugs.launchpad.net/apparmor/+bug/1485055/comments/2

A: The only solution without changing your setup is to edit all profiles to point to the new locations. This can be done with pattern matching followed by careful review. It will also likely make upgrades more involved, since you will have to continuously apply these changes.
The simplest workaround would be to use bind mounts for these directories.
Adding the following to /etc/fstab should be enough to replace the symlinks:
/var/log /part1/log none defaults,bind 0 0
/var/cache /part1/cache none defaults,bind 0 0
/var/spool /part1/spool none defaults,bind 0 0

Make sure these lines come after the /part1 mount.


text:
Q: Mod_rewrite causes AJAX requests using a relative URL to fail Even though I'm aware there have been posts with similar questions before, I'd like to present an issue I've been struggling with for many hours now and can't seem to resolve.
On a website that has its URLs rewritten by the mod rewrite module:
www.domain.com/index.php?page=one
becomes
www.domain.com/one/
I'm making an AJAX request using JQUERY and a relative URL >>>>
$.get('views/ajax_page.php', { }, function(data) {
    alert(data);
});

Obviously no problem as long as the URL in the browser's address bar is www.domain.com, but when the GET variable 'page' is not null, the script fails to find the file ajax_page.php and throws the AJAX error "404 not found".
I know I could get around this by using an absolute URL in the AJAX request, but since the same-origin policy causes the browser to throw the HTTP error 0 when the visitor omits the protocol when typing the website's address in the address bar, this is not watertight too.
What would be the best way to tackle either one of the aforementioned problems or, even better, both?
Many thanks for your support.

A: is your folder views at the root of your site?
if so, add a slash before views:
$.get('/views/ajax_page.php', { },

function(data) {

alert(data);

});

If not, i would suggest calling the current page with your ajax request and manage to call the ajax file in your back end...
Also, make sure that your htaccess access files before redirecting :
# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

A: When using relative paths it's always wise to add the base tag to your html site header:
<base href='http://www.your-site-address-here.com'/>


text:
Q: Tumblr custom domains don't load at all This seems really obscure, but for some reason ALL Tumblr sites that use a custom domain don't load for me. Regular Tumblr subdomains do load, though.
For instance, this loads for me: http://authenticjobs.tumblr.com
This does not: http://blog.fetchnotes.com (it's a Tumblr site on a custom domain)
It's that case for any Tumblr site with a custom domain and it's been like this for at least a couple of weeks.
What on earth could be making that happen? I don't notice it on any other sites.
I'm running Mac OS X (10.7.3).
Things I've tried:

*

*Restarting computer

*Power cycling modem

*Power cycling router

*Trying different browsers

*Checked http://downforeveryoneorjustme.com

*Pinged (and I'm able to ping without issue)

*Changed devices (tried my iPhone...it worked on 3G but did NOT work when on the same Wi-Fi network)

A: I have had exactly the same problem for a few months, but I think I've fixed it. I was using google's IPv4 DNS addresses (8.8.8.8 and 8.8.4.4) and I just switched them to the IPv6 options
(2001:4860:4860::8888 / 2001:4860:4860::8844) and it's tentatively fixed.