text:
Q: G-Counters in Riak: Don't the underlying vclocks provide the same data? I've been reading into CvRDTs and I'm aware that Riak has already added a few to Riak 2.
My question is: why would Riak implement a gcounter when it sounds like the underlying vclock that is associated with every object records the same information? Wouldn't the result be a gcounter stored with a vclock, each containing the same essential information?
My only guess right now would be that Riak may garbage-collect the vclocks, trimming information that would actually be important for the purpose of a gcounter (i.e. the number of increments).
I cannot read Erlang particularly well, so maybe I've wrongly assumed that Riak stores vclocks with these special-case data types. However, the question still applies to the homegrown solutions that are written on top of standard Riak (and hence inherit vclocks with each object persisted).
EDIT:
I have since written the following article to help explain CvRDTs in a more practical manner. This article also touches on the redundancy I have highlighted above:
Conflict-free Replicated Data Types (CRDT) - A digestible explanation with less math.

A: *

*Riak prunes version vectors, no big deal for causality (false concurrency, more siblings, safe) but a disaster for counters.

*Riak's CRDT support is general. We "hide" CRDTs inside the regular riak object.

*Riak's CRDT support is in it's first wave, we'll be optimising further as we make further releases.
We have a great mailing list for questions like this, btw. Stack Overflow has it's uses but if you want to talk to the authors of an open source DB why not use their list? Since Riak is open source, you can submit a pull request, we'd love to incorporate your ideas into the code base.

A: Quick answer: Riak's counters are actually PN-Counters, ie they allow both increments and decrements, so can't be implemented like a vclock, as they require tracking the increments and decrements differently.
Long Answer:
This question suggests you have completely misunderstood the difference between a g-counter and a vector clock (or version vector).
A vector clock (vclock) is a system for tracking the causality of concurrent updates to a piece of data. They are a map of {actor => logical clock}. Actors only increment their logical clocks when the data they're associated with changes, and try to increment it as little as possible (so at most once per update). Two vclocks can either be concurrent, or one can dominate the other.
A g-counter is a CvRDT with what looks like the same structure as a vclock, but with important differences. They are implemented as a map of {actor => counter}. Actors can increment their own counter as much as they want. A g-counter has the concept of a "counter value", and the concept of a "merge", so that when concurrent operations are executed by different actors, they can work out what the actual "counter value" should be.
Importantly, g-counters can't track causality, and vclocks have no idea what their "counter value" is.
To conflate the two in a codebase would not only be confusing, but could also bring in errors.
Add this to the fact that riak actually implements pn-counters. The difference is that a g-counter can only be incremented, but pn-counters can be both incremented and decremented. Pn-counters work by being a map of {actor => (increment count, decrement count)}, which more obviously has a different structure to a vclock. You can only increment both those counts, hence why there are two and not just one.


text:
Q: Initial sort of products pulled from MySQL db I have two very similar but different sites, each which display products on a listing page.  From there you can select an item and view details, just like a regular e-commerce site.  I want the default sort to be alphabetical.  I know my problem is that the erroneous site is not sorting products from db correctly, due to code issues on php product listing template page.  I'm just not 100% sure how to change the problematic site to sort/display products alphabetically by default.
Here is the code from template page that loads items from db - this is the one that functions correctly (alphabetical sort by default, when no other sorting specified
  // Load product from database
  $products = $db->rawQuery("SELECT {$productsCols},
                                {$productsImagesCols},
                                {$productsTypesCols}
                         FROM `products`
                         LEFT JOIN `products_images` ON     `products_images`.`id` = (SELECT `products_images`.`id`
                                                                              FROM `products_images`
                                                                              WHERE `products_images`.`pid` = `products`.`id`
                                                                            AND `products_images`.`featured` = ?
                                                                           LIMIT 1)
                         LEFT JOIN `types` ON `products`.`tid` = `types`.`id`
                         WHERE `products`.`status` LIKE ?
                         ORDER BY `products`.`name` ASC", array('true', 'enabled'));

Here is the code from the product listing template that does not sort alphabetically by default
// Load product from database
 $products = $db->rawQuery("SELECT {$productsCols},
                                {$productsImagesCols},
                                {$productsTypesCols}
                         FROM `products`
                         LEFT JOIN `products_images` ON    `products_images`.`id` = (SELECT `products_images`.`id`
                                                                              FROM `products_images`
                                                                           WHERE `products_images`.`pid` = `products`.`id`
                                                                              AND `products_images`.`featured` = ?
                                                                           LIMIT 1)
                         LEFT JOIN `types` ON `products`.`tid` = `types`.`id`
                         WHERE `products`.`status` LIKE ?
                         ORDER BY " . $sort_field . " ASC", array('true', 'enabled'));
  $products = (count($products) > 0) ? $products : false ;

I am almost certain my issue is due to this line:
ORDER BY " . $sort_field . " ASC", array('true', 'enabled'));

If anyone had any input as to how to change this problematic line or any other pieces of code, let me know!
FYI  this variable - $sort_field = 'products.sort_position'; -- in the db sort_position is all the same (0) so this is not the issue as the first step I took was to change to zeros.
Thanks!

redpajama_set_name: RedPajamaStackExchange


text:
Q: C# searching array I have a random array and I must search how many times the integer number is in the array. This is what I have already. How would you search the resulting array?
Console.WriteLine("enter number:");

int number = Convert.ToInt32(Console.ReadLine());
int[] array = new int[number];
Random rnd = new Random();

for ( int i = 0; i < array.Length; i++)
{
    array[i] = rnd.Next(0 , number);
}

foreach (int i in array)
{
    System.Console.Write(" {0}",i);
}

Console.ReadKey();

A: foreach(var g in array.GroupBy(x=>x))
{
    Console.WriteLine("{0} Count:{1}",g.Key,g.Count())
}

A: The other answers rely on LINQ, here is the code to do so with plain C#
int count = 0;

foreach (int i in array)
{
    if (i == number)
        count = count + 1;
}

Note that in your existing code this will always produce 0 because the upper bound of Random.Next() is exclusive. You should change your code to something like this where the number entered is not linked to the array you generate:
int array_size = 1000;
int max_number = 100;
int[] array = new int[array_size];
Random rnd = new Random();

for (int i = 0; i < array.Length; i++)
    array[i] = rnd.Next(0, max_number);

Console.WriteLine("enter number:");
int number = Convert.ToInt32(Console.ReadLine());

foreach (int i in array)
    System.Console.Write("{0} ", i);

int count = 0;
foreach (int i in array)
    if (i == number)
        count = count + 1;

Console.WriteLine("Number {0} was found {1} times in the array", number, count);

Console.ReadKey();


text:
Q: Find the Set of All Accumulation Points (also called Limit Points) for the given set S. Find the Set of All Accumulation Points (also called Limit Points) for the given set $S$.
$S = \{a_n:n\in \Bbb{N}\}$ where $a_n = \left\{ \begin{array}{c} 0\text{, if } n \text{ is odd} \\ \dfrac{n}{n+1}\text{, if } n \text{ is even} \end{array} \right..$
In my perspective there are two possible answers.
1) $L(S) = \{0,1\}$
Using the definition of the accumulation or limit point, of a sequence. The number $a$ is said to be an accumulation point of $(a_n)$ if there exists a subsequence such that the limit of the subsequence is equal to $a$.
2) $L(S) = \{1\}$
Using the definition of the accumulation or limit point of a set.
The point $a$ is an accumulation point of the set $S$ if each neighborhood of $a$ contains a point of $S$, other than $a$.
$1$ is the only accumulation point because not all the neighborhoods of $0$ contain a point of the set $S$ other than $0$.
As the question mentions "the given set $S$", I vote for the second answer.
What do you think?

A: The critical question is whether $S$ is a set or a sequence.  You call it a set, but defining values for $a_n$ for all $n$ makes it sound like a sequence.  If it is a set, it can have only one member $0$.  If it is a sequence, all the odd positions are $0$.  As a sequence, it has an accumulation point at $0$ and an accumulation point at $1$ because you can select a subsequence converging to each of those two points.  It does not have a limit because there are members of the sequence with arbitrarily high indices that are far from $0$ and others that are far from $1$.  As a set, the only accumulation point is $1$.  Sets are not considered to have limits because they lack the concept of order.

A: The set  $S$ will be like $ {0, 2/3, 4/5.....}$ And so around $0$ there is some neighborhood which contains only $0$. But for $1$, you cannot find such neighborhood. Hence the set has one limit point.


text:
Q: search bar using cakephp I'm new when it comes to work with CakePHP. I'm facing a problem that is bothering me since i started doing it. I got a form with an input and when a person types in what he/she wants (it is a classified website where you can search for something that you'd like to buy eg. a blue pen) it shows the page that refers to the desired object. For example. if i type in 'blue pen', it retrieves all the data that i have in my database related to the blue pen.
Hope you can help me, there is my code:
index.ctp
<?php
    echo $this->Form->create('Location', array('type' => 'get'));
    echo $this->Form->input('Find');
    echo $this->Form->end();
?>

and my ArticlesController
public function search() {
    $obj = '';
    if (!empty($this->data)) {
       $obj  = $this->data['Location']['Procurar'];
       $opts  = array(
           'conditions' => array('Location.Procurar' => $obj)
       );
    }
    $this->set('obj', $obj); // so the keyword is saved. Can also get it via $this->data
 }


text:
Q: Replying to comments in a comment system I have a comment system where a user can post a comment and a reply can be dropped on that comment. since a comment system is mostly contacted i decided to  put the query that grabs the comments in a seperate php file(ajax/asr.php) and then use the setInterval function to load this file periodically so the user sees fresh comments.
<script type="text/javascript">
    setInterval(function() {
        $('.responses').load('ajax/asr.php',{id:<?PHP echo $id?>});
    },1000);
</script>

Each comment has a reply buton which shows the reply form.
My problem is: Whenever i decide to reply to a comment, the reply form disappears shortly due to the setInterval. I want the setInterval to pause when a user clicks the reply button, and then after he replies (submits the reply form) it can continue.

A: The setInterval function returns a value that is a reference to that particular timer. You can use this to pass to the clearInterval function (https://developer.mozilla.org/en-US/docs/Web/API/Window.clearInterval) which will then stop that interval from occuring.
so in your above code you would assign the return from your setInterval function to a variable you can access from wherever you need (eg a global variable). Then when you open the edit form you can just clear that interval.
Then of course when you have finished or cancelled commenting you will need to restart the interval timer (which would of course have been moved into a handy function).


text:
Q: Upgrading FontAwesome from 3.2.1 to 4.x I'm upgrading FontAwesome from 3.2 to 4.1. What would be the least painful way to do it since there is significant difference in syntax of both versions (https://github.com/FortAwesome/Font-Awesome/wiki/Upgrading-from-3.2.1-to-4).
My current two options are:

*

*Searching in HTML for icon- and replacing with fa- (Returns thousands of results!)

*Editing FontAwesome 4.x CSS and changing prefixes to icon-* (Since i'm not using any other lib with icon- prefix - Easier but what about future versions?)

*Any other way?

A: Any text editor will allow you to replace all occurrences of icon- into fa fa-.
It will take you less than 30 seconds, and you'll be ready for future Font Awesome updates.

*

*Sublime Text: Ctrl+Shift+F

*Eclipse: Ctrl+F

*Notepad: Ctrl+H

*Notepad++: Ctrl+H

*NetBeans: Ctrl+Shift+H

*...

Remember to check for new icon names (you should know which one you're using, so I guess you don't have to check for all icons).


text:
Q: Grails Spring Security get assigned roles to a method I would like to have a test that goes through all methods available in a controller and retrieves roles associated with these methods. I understand that it should be a functional test (as opposed to a unit test), but I still do not know how to request the list of roles associated with a method.
Let's say I have this controller:
@Secured("hasAnyRole('ROLE_1')"
class MyController {
    def methodA() {}

    @Secured("hasAnyRole('ROLE_2')"
    def methodB() {}
 }

In my test I would like to have something like this:
assertEquals(['ROLE_1'],getRoles(MyController.class, "methodA"))
assertEquals(['ROLE_1', 'ROLE_2'],getRoles(MyController.class, "methodB"))

Any suggestions?
Thanks.

A: You can do this with the Reflection API. Something like:
Method m = MyController.class.getMethod("methodB");
Annotation[] annos = m.getAnnotations();

But I don't think that's a good validation for your method, since it only ensure that you write the role name correctly. I think it's better you try to call the action and check if the process redirect to denied.
@TestFor(MyController)
class MyControllerTests {
  @Test
  void shouldRedirectToDenied() {
    SpringSecurityUtils.doWithAuth('username') {
      controller.methodB()
      assert controller.response.redirectedUrl == '/login/denied'
    }
  }
}

The doWithAuth closure will mock an authentication for the username, so it's the same to say: "do this code as if the username was logged in successfully".

It seems that you will need to use functional tests indeed. See Burt's comment. I'm still think that's not a valid effort create a test only to validate if the method have the annotation.


text:
Q: Resolve assuming $x$ is real when $x$ is a free variable in a ForAll expression I am using Mathematica to check whether a function is positive semidefinite. I have come upon an odd situation. Namely, when I input
Resolve[ForAll[{x, y}, 0 < y, And @@ Thread[Eigenvalues[D[x^2/y, {{x, y}, 2}]] >= 0]]]

the output is simply True.
But when I input
Resolve[ForAll[y, 0 < y, And @@ Thread[Eigenvalues[D[x^2/y, {{x, y}, 2}]] >= 0]]]

the output is x ∈ Reals.
Does
{x, y}, 0 < y

imply in Mathematica that x ∈ Reals? If so, why?

A: I think the logic for why this happens goes as follows. Start with a simple example:
Resolve[ForAll[x, x^2 >= 0]]

(* ==> True *)

This can be explained because Resolve implicitly assumes that x is real because it appears in an inequality. The documentation for Resolve states this.
On the other hand, the inequality isn't changed if we introduce a different variable y:
Resolve[ForAll[y, x^2 >= 0]]

(* ==> x^2 >= 0 *)

Now combine these two simplifications into a single statement, which can have two orders:
Resolve[ForAll[x, ForAll[y, x^2 >= 0]]]

(* ==> True *)

Resolve[ForAll[y, ForAll[x, x^2 >= 0]]]

(* ==> True *)

In the first line, the inner ForAll is removed without changing the inequality, and we're led back to the first case I wrote above. The first  case also kicks in for the inner ForAll on the last line, leading to the same result.
But the two consecutive ForAll statements are equivalent to
Resolve[ForAll[{x, y}, x^2 >= 0]]

(* ==> True *)

And here the order in {x,y} doesn't matter according to what I said previously.
Now we know that True is the "correct" result without any additional conditions. But this is a consequence of the step-wise way in which I think Resolve eliminates the ForAll.
Now the question is whether adding a condition such as 0 < y should change this result. Indeed, the condition is irrelevant when the unconditional evaluation already yielded True: when something is always true then it is also true under any added conditions.
So the result in my example can be explained because I have implicitly made x a real variable by sticking it in an inequality. I believe that essentially the same thing happened in your more complicated example.


text:
Q: Validate delimiter separated values using JOI I have a use case where I need to validate a set of values separated by | .
I followed https://github.com/hapijs/joi/issues/570 but it throws a number of errors.
Is there any way I can do this?
Example- AA|BB|CC|DD
Now, I need to validate that all of the values (AA, BB, CC, DD) are strings.
I believe I can't use regex as it would validate just the first value.
Also, there are a number of other validations in my code, so I don't wish to loop the validation process.
Please let me know if I'm unclear. Thanks!

A: TL;DR:
const Joi = require('joi').extend(joi => ({
  base: joi.array(),
  coerce: (value, helpers) => ({
    value: value.split ? value.split('|') : value,
  }),
  type: 'versionArray',
}))

The .extend function signature has changed since that comment was written; the name property has been removed and the CoerceFunction should return an object with value as the property.
> Joi.versionArray().validate('AA|BB|CC|DD')
{ value: [ 'AA', 'BB', 'CC', 'DD' ] }
> Joi.versionArray().validate('AA|BB,CC|DD')
{ value: [ 'AA', 'BB,CC', 'DD' ] }

From here on, you can use the .items(...) function to validate each of the strings in the returned array:
> const regex = new RegExp('^[a-zA-Z]+$') // every character must be a-z or A-Z
undefined

> Joi.versionArray().items(Joi.string().regex(regex)).validate('AA|BB|CC|DD')
{ value: [ 'AA', 'BB', 'CC', 'DD' ] }

> Joi.versionArray().items(Joi.string().regex(regex)).validate('AA|BB|CC|00')
{ value: [ 'AA', 'BB', 'CC', '00' ],
  error:
   { ValidationError: "[3]" with value "00" fails to match the required pattern: /^[a-zA-Z]+$/ _original: 'AA|BB|CC|00', details: [ [Object] ] } }

> Joi.versionArray().items(Joi.string().regex(regex)).validate('AA|BB,CC|DD')
{ value: [ 'AA', 'BB,CC', 'DD' ],
  error:
   { ValidationError: "[1]" with value "BB,CC" fails to match the required pattern: /^[a-zA-Z]+$/ _original: 'AA|BB,CC|DD', details: [ [Object] ] } }


text:
Q: Wordpress, style php-generated post Good evening,
Im creating a wordpress-site with a self-made template.
I would like to be able to style every singe post with css. This line:
<h2 id="post-<?php the_ID();

creates a new ID for every post i make, for example
...Is there anyway that I can style, in advance, every post this line will create?

A: If you need to style every post individually, then you can style using inline style.
If you styled using the method you specified, your css file size will become very large. It is a bad practise.
So, My suggestion is to use inline style while creating each post.


text:
Q: php mail() fails on ubuntu server I'm trying to write a code to send emails from a contact form, I'm doing tests on a ubuntu server and here is the php config on this server:

And here is my php code (I've tested this same code in other online production server and works perfectly):
<?php
$ToEmail = 'dukecapitan@gmail.com';
$EmailSubject = 'Site contact form';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."";
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?>

This code isn't working on my Ubuntu server, what can I do? I don't want to use libraries. I read that in Linux server there is no need to install anything and no need to add a SMTP configuration on the code, even in the php manual give some basics examples to send emails and those don't have any SMTP code. What is the problem with this code?

A: This isn't the answer you wanted but probably the best way to tackle given our discussion on the main question.
A PHPMailer Example
You'll just need to adapt your current code to your variables listed in your original code.
Source: PHPMailer Example - Official Package GitHub
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';

$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
try {
    //Server settings
    $mail->SMTPDebug = 2;                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'user@example.com';                 // SMTP username
    $mail->Password = 'secret';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to

    //Recipients
    $mail->setFrom('from@example.com', 'Mailer');
    $mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
    $mail->addAddress('ellen@example.com');               // Name is optional
    $mail->addReplyTo('info@example.com', 'Information');
    $mail->addCC('cc@example.com');
    $mail->addBCC('bcc@example.com');

    //Attachments
    $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
    $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

    //Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}


text:
Q: Thunderbolt 3 vs 10 Gbit ethernet I am not sure if I chose the right stack to ask this but here it goes...
I try to find the differences/competitive advantages/disadvantages of thunderbolt compared to ethernet from a technological perspective
And thats without including speed as in "transfer rate"
What I would like to know is if thunderbolt (being essentially a PCIe interface) is more "native" compared to ethernet
Does this mean thunderbolt consumes less/more resources when transferring data on the same speed as ethernet?
And stuff like that...
Unfortunately searching on the web I only found comparisons with USB or Firewire etc and all of them focused on transfer speed none mentioned a direct comparison with ethernet which I suppose is also the main antagonist.


text:
Q: test network speed with php and output buffering turned on I'm using a php script that outputs a file to the client using output buffering.
I have to use output buffering because of the way the script works. Without OB it's easy to test a start and an end time with an echo in between and show the difference in time, but when using OB the time is near zero because the echo output is put locally in the buffer and the buffer is sent to the network in a second momemt without the php script been aware of the process.
Is there a way the test the network speed in the very same script with OB turned on?
header('X-Accel-Buffering: yes');

$start_time = microtime(true);

echo $data;  // near zero time

ob_flush();
flush(); // test this speed ??

$end_time = microtime(true);

$speed = strlen($data) / ($end_time - $start_time);


text:
Q: Authenticate over OAuth 2.0 for SaaS application I have multi-tenant SaaS application with single URL address.
On application's login screen there is beside username and password fields one more - tenant name.
I would like to add on login screen - Sign On With SalesForce button. There it will be called standard OAuth 2.0 protocol. Problem that I found is, how I will provide tenant name that will be used after authentication ? I know that I can send state within OAuth but I do not know tenant name in the moment when OAuth is initialized ? How to accomplish this ?
Someone has faced with this issue before ?

A: OAuth is meant for authorizing on the Salesforce platform and giving other applications the right to do things in name of the authorizing user. To do this, you don't need the Tenant Name.
But if you want the Tenant Name in your application, then e.g. do an API call to Salesforce (using the OAuth token) to get the users details, and get the Name from there and use that as the Tenant Name?


text:
Q: How to compare part of the data in two rows I have a data set from a fake furniture store for a course I'm taking, and I want to make a query to select the transaction_date and account_created to see how many new customers vs returning customers purchased from the store.
transaction_date    account_created
1/2/09 6:17         1/2/09 6:00
1/2/09 4:53         1/2/09 4:42
1/2/09 13:08        1/1/09 16:21
1/3/09 14:44        9/25/05 21:13

1/2/09 6:17 is type TEXT and I just want to compare the date portions.
Is there a way to do this?

A: Here is a sample to convert string value to dateTime and compare them.
Declare @StringDate1 sysname =  '1/2/09 6:00'
Declare @StringDate2 sysname =  '1/2/09 6:17'

SELECT Cast(@StringDate1 as DateTime),
       Cast(@StringDate2 as DateTime),
       DateDiff(Minute, Cast(@StringDate1 as DateTime), Cast(@StringDate2 as DateTime))


text:
Q: Rotating BitmapImage in C# / XAML I have 2 BitmapImages in a List:
    BitmapImage img1 = new BitmapImage((new Uri("Images/image1.jpg", UriKind.Relative)));
    BitmapImage img1 = new BitmapImage((new Uri("Images/image2.jpg", UriKind.Relative)));

    List<BitmapImage> images = new List<BitmapImage>();

    images.Add(img1);
    images.Add(img2);

How do I rotate both bitmap images with the push of a button?
I have tried the solution (shown below) from MSDN, but I'm getting "no definition for 'Source'".
private void TurnLeft_Click(object sender, RoutedEventArgs e)
{
    //Create source
    BitmapImage bi = new BitmapImage();

    //BitmapImage properties must be in a BeginInit/EndInit block
    bi.BeginInit();
    bi.UriSource = new Uri("Images/image1.jpg", UriKind.Relative);

    //Set image rotation
    bi.Rotation = Rotation.Rotate270;
    bi.EndInit();

    //set BitmapImage "img2" from List<BitmapImage> from source
    img2.Source = bi;
}

A: Take a look the following segments of code.
XAML:
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>

    <Image x:Name="Image1" Stretch="Uniform" >
        <Image.Source>
            <BitmapImage UriSource="Images/logo.png"/>
        </Image.Source>
    </Image>

    <Button x:Name="TurnLeftButton" Content="TurnLeft"
            Click="TurnLeftButton_Click"
            Grid.Row="1"/>
</Grid>

Code behind:
private void TurnLeftButton_Click(object sender, RoutedEventArgs e)
{
    var biOriginal = (BitmapImage) Image1.Source;

    var biRotated = new BitmapImage();
    biRotated.BeginInit();
    biRotated.UriSource = biOriginal.UriSource;
    biRotated.Rotation = Rotation.Rotate270;
    biRotated.EndInit();

    Image1.Source = biRotated;
}

A: dbvega has answered my question. However, there is a cast exception and I thought I'd address it for anyone who is using my question to solve your error(s).
The correct C# code for dbvega's example should look like this:
private void TurnLeftButton_Click(object sender, RoutedEventArgs e)
{
    var biRotated = new BitmapImage();
    biRotated.BeginInit();
    biRotated.UriSource = new Uri("Images/logo.png", UriKind.Relative);
    biRotated.Rotation = Rotation.Rotate270;
    biRotated.EndInit();

    Image1.Source = biRotated;
}

Hats off to dbvega though - problem solved!


text:
Q: nmap loop on shell script cannot run i have loop to use  Nmap command
    for subnet in `cat list_subnet.tmp`
        do
 echo ${subnet}
 nmap -sL -n ${subnet}
done

and nmap cannot list. this is output.
./abc.sh
10.159.18.1/27
Starting Nmap 7.70 ( https://nmap.org ) at 2022-11-03 09:06 +07
"nable to split netmask from target expression: "10.159.18.1/27
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.00 seco

but when i run normal. it is ok
/usr/bin/nmap -sL -n 10.159.18.1/27
Starting Nmap 7.70 ( https://nmap.org ) at 2022-11-03 09:06 +07
Nmap scan report for 10.159.18.0
Nmap scan report for 10.159.18.1
Nmap scan report for 10.159.18.2
Nmap scan report for 10.159.18.3
Nmap scan report for 10.159.18.4
Nmap scan report for 10.159.18.5
Nmap scan report for 10.159.18.6
Nmap scan report for 10.159.18.7

i think have problem with bask. and it not cannot run in loop. any ideal to fix that.


text:
Q: How should a clock object be made in Python? I'm making a very simple clock object in Python. I want to be able to instantiate a clock giving it a name and have it record the time it is running for, with pause functionality. I think I've nearly got it, but the pause functionality is giving me some trouble -- the clock continues to accumulate time even when stopped. I think the problem lies in the way the accumulated run time (the _runTime data attribute) is updated (in the method update()). I would welcome assistance in getting this code working sensibly and would welcome any other comments on making the ideas here better.
import time
import datetime

def style_datetime_object(
    datetimeObject = None,
    style = "YYYY-MM-DDTHHMMSS"
    ):
    # filename safe
    if style == "YYYY-MM-DDTHHMMSSZ":
        return(datetimeObject.strftime('%Y-%m-%dT%H%M%SZ'))
    # microseconds
    elif style == "YYYY-MM-DDTHHMMSSMMMMMMZ":
        return(datetimeObject.strftime('%Y-%m-%dT%H%M%S%fZ'))
    # elegant
    elif style == "YYYY-MM-DD HH:MM:SS UTC":
        return(datetimeObject.strftime('%Y-%m-%d %H:%M:%SZ'))
    # UNIX time in seconds with second fraction
    elif style == "UNIX time S.SSSSSS":
        return((datetimeObject - datetime.datetime.utcfromtimestamp(0)).total_seconds())
    # UNIX time in seconds rounded
    elif style == "UNIX time S":
        return(int((datetimeObject - datetime.datetime.utcfromtimestamp(0)).total_seconds()))
    # filename safe
    else:
        return(datetimeObject.strftime('%Y-%m-%dT%H%M%SZ'))

class Clock(object):

    def __init__(
        self,
        name  = None,
        start = True
        ):
        # options
        self._name      = name
        self._start     = start # Boolean start clock on instantiation
        # internal
        self._startTime = None
        self._stopTime  = None
        self._runTime   = None
        self._running   = False
        # If a global clock list is detected, add a clock instance to it.
        if "clocks" in globals():
            clocks.add(self)
        if self._start:
            self.start()

    def name(
        self
        ):
        return(self._name)

    def start(
        self
        ):
        self._running   = True
        self._startTime = datetime.datetime.utcnow()

    def stop(
        self
        ):
        self._stopTime = datetime.datetime.utcnow()
        self._running  = False
        self.update()

    def startTime(
        self
        ):
        return(style_datetime_object(datetimeObject = self._startTime))

    def update(
        self
        ):
        # If the clock is running, the run time is the difference between the
        # current time and the start time (added to any previously accumulated
        # run time). If the clock is not running, the run time is the difference
        # between the stop time and the start time (added to any previously
        # accumulated run time).
        if self._running:
            if self._runTime:
                self._runTime = self._runTime + datetime.datetime.utcnow() - self._startTime
            else:
                self._runTime = datetime.datetime.utcnow() - self._startTime
        else:
            if self._runTime:
                self._runTime = self._runTime + self._stopTime - self._startTime
            else:
                self._runTime = self._stopTime - self._startTime

    def time(
        self
        ):
        self.update()
        return(self._runTime.total_seconds())

print("create clock")
a = Clock(name = "hello")
print("clock start time: {time}".format(time = a.startTime()))
print("sleep 2 seconds")
time.sleep(2)
print("clock current time (s): {time}".format(time = a.time()))

print

print("create new clock")
b = Clock(name = "world")
print("clock start time: {time}".format(time = b.startTime()))
print("sleep 2 seconds")
time.sleep(2)
print("clock current time (s): {time}".format(time = b.time()))
print("stop clock")
b.stop()
print("sleep 2 seconds")
time.sleep(2)
print("clock current time (s): {time}".format(time = b.time()))

A: I found your code hard to follow. Here is my (much smaller) clock anyway, may be you can draw some inspiration to implement any lacking feature later.
import datetime

class Clock(object):
    def __init__(self):
        self.reset()
    def reset(self):
        self.accumulator = datetime.timedelta(0)
        self.started = None
    def start_stop(self):
        if self.started:
            self.accumulator += (
                datetime.datetime.utcnow() - self.started
            )
            self.started = None
        else:
            self.started = datetime.datetime.utcnow()
    @property
    def elapsed(self):
        if self.started:
            return self.accumulator + (
                datetime.datetime.utcnow() - self.started
            )
        return self.accumulator
    def __repr__(self):
        return "<Clock {} ({})>".format(
            self.elapsed,
            'started' if self.started else 'stopped'
        )

Tests:
c = Clock()
print c
print "Starting..."; c.start_stop()
for i in range(4):
    time.sleep(2)
    print c
print "Stopping..."; c.start_stop()
for i in range(4):
    time.sleep(2)
    print c
print "Starting..."; c.start_stop()
for i in range(4):
    time.sleep(2)
    print c
print "Resetting..."; c.reset()
print c

Result:
<Clock 0:00:00 (stopped)>
Starting...
<Clock 0:00:02.002085 (started)>
<Clock 0:00:04.004263 (started)>
<Clock 0:00:06.006483 (started)>
<Clock 0:00:08.007675 (started)>
Stopping...
<Clock 0:00:08.007756 (stopped)>
<Clock 0:00:08.007756 (stopped)>
<Clock 0:00:08.007756 (stopped)>
<Clock 0:00:08.007756 (stopped)>
Starting...
<Clock 0:00:10.009876 (started)>
<Clock 0:00:12.012034 (started)>
<Clock 0:00:14.013143 (started)>
<Clock 0:00:16.015291 (started)>
Resetting...
<Clock 0:00:00 (stopped)>


text:
Q: Regex for multiline replacement of strings then placing into a pandas dataframe Have a kinda odd request. I'm trying to automate some potential SQL queries and need to be able to universally take a text of multiline strings down to a set amount of text (will show in example). After getting this, I want to put it in a pandas dataframe so I can merge it with another to automatically create specific SQL queries (not what I'm asking about here).
The kind of text I'm talking about is similar to this (but a lot more):
max(if(serving_id in (25315,25357), option_text, null)) as 'Scheduling',
max(if(serving_id in (25316,25358), option_text, null)) as 'Check-in',
max(if(serving_id in (25317,25359), option_text, null)) as 'Services',
max(if(serving_id in (25318,25360), option_text, null)) as 'Quality of Service',
max(if(serving_id in (25319,25361), option_text, null)) as 'Returns'

I would like to be able to easily remove all text before "as" in the above multiline string and then place what's left (i.e. "Scheduling", "Check-in", "Services", etc.) in a pandas dataframe. I've been researching for a while and just can't seem to find a solution for this. Any help would be much appreciated!!!

A: With regular Python, you could use re.findall here to get the terms from each line into a list:
inp = """max(if(serving_id in (25315,25357), option_text, null)) as 'Scheduling',
max(if(serving_id in (25316,25358), option_text, null)) as 'Check-in',
max(if(serving_id in (25317,25359), option_text, null)) as 'Services',
max(if(serving_id in (25318,25360), option_text, null)) as 'Quality of Service',
max(if(serving_id in (25319,25361), option_text, null)) as 'Returns'"""
terms = re.findall(r"\s+as\s+'(.*?)',?$", inp, flags=re.M)
print(terms)
# ['Scheduling', 'Check-in', 'Services', 'Quality of Service', 'Returns']

You may then use this list to populate your Pandas data frame.


text:
Q: mouseOut effect with a mask The following code produces a mask on a web page when hovering over a menu, my question is how do I edit this code to make the mask go away with mouseout event? As it sits now I have to click for the mask to go away. Any help is appreciated.
<script>

$(function() {

    $("#menuwrapper").mouseover(function() {

        $(this).expose();

    });
});
</script>

A: $(function() {

    $("#menuwrapper").mouseover(function() {
        $(this).expose();
    });

  $("#menuwrapper").mouseout(function() {
        $(this).hide();
    });

});

A: Or more succinctly:
$("#menuwrapper").hover(
  function(){ $(this).expose(); },
  function(){ $(this).hide(); } // opposite of expose() function
);

A: If you are using the expose library, you can setup the event like this:
$("#menuwrapper").hover(
  function(){ $(this).expose(); },
  function(){ $(this).unexpose(); } // opposite of expose() function
);


text:
Q: Missing number treated as zero :( Bonjour, quelqu'un (une) pourrait-il (elle) me dire où est le problème dans ce code en LaTeX ?
\documentclass{report}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{color}
\usepackage[centertags]{amsmath}
\usepackage[grey,utopia]{quotchap}
\usepackage{moreverb}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithmic}[1]
\STATE Algorithme\\
\STATE Debut\\
\STATE Trier les $w_{i}$ dans l'ordre décroissant ;\\
\STATE Prendre les t\^{a}ches dans cette ordre ;\\
$w\leftarrow \{w_{1},...,w_{n}\} $;\\
\STATE Tant que ( $w\neq \emptyset$ ) Faire \\
$W_{k} \leftarrow max \; \{w\} $ ;\\
$ w \leftarrow w\{W_{k}\}$ ;\\
\STATE Fin Tant que \\
\STATE \quad Retourner $W_{k}$;\\
\STATE Fin
%\end{verbatimtab}
%\end{listing}
\end{algorithmic}
%\end{algorithm}
\end{document}

l'erreur affichée est :
Missing number treated as zero

Translation: Hi, could someone tell me where the problem is in this LaTeX code? The resulting error message is Missing number treated as zero.

A: You are loading both algorithmic and algpseudocode which are not compatible.
Since your code is written in algorithmic style, simply remove the line
\usepackage{algpseudocode}

Also note that most of the \\ are meaningless, since \STATE already starts a new line, so your code should be:
\documentclass{report}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{color}
\usepackage[centertags]{amsmath}
\usepackage[grey,utopia]{quotchap}
\usepackage{moreverb}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithmic}[1]
\STATE Algorithme
\STATE Debut
\STATE Trier les $w_{i}$ dans l'ordre décroissant ;
\STATE Prendre les t\^{a}ches dans cette ordre ;\\
$w\leftarrow \{w_{1},...,w_{n}\} $;\\
\STATE Tant que ( $w\neq \emptyset$ ) Faire \\
$W_{k} \leftarrow max \; \{w\} $ ;\\
$ w \leftarrow w\{W_{k}\}$ ;
\STATE Fin Tant que
\STATE \quad Retourner $W_{k}$;
\STATE Fin
%\end{verbatimtab}
%\end{listing}
\end{algorithmic}
%\end{algorithm}
\end{document}


text:
Q: Xamarin.Forms (UWP) - How Can I Get a WebView's DOM as an HTML String? In a Xamarin.Forms (UWP) project, I have a WebView control whose Source is created with an HTML string, like this:
var webview = new Xamarin.Forms.WebView
{
    Source = new HtmlWebViewSource
    {
        Html = "<html>....</html>"
    }
};

The HTML contains JavaScript that dynamically generates HTML inside the <body>. This renders perfectly on the screen. That means the WebView understands the DOM that is being created with the JavaScript. Great.
But now I need to parse through some of the generated HTML, but all I can seem to access is the original HTML string that I passed in as the Source, and not the final generated DOM.
Is there a way to convert the DOM generated by the JavaScript and understood by the WebView into a string so that I can parse (using a library like HTML Agility Pack or AngleSharp) and pull out some segments of the HTML? This can be in Xamarin.Forms or UWP (the platform I'm targeting).
NOTE: In full disclosure (in case it helps, and to avoid accusations of this being an XY problem), I am ultimately trying to solve the problem of printing a WebView with multiple pages on UWP - research on this has been met with very sparse information. I have a solution that works for HTML that is not dynamically generated with JavaScript - basically I'm pulling out parts of the HTML that represent printable pages, and I'm adding those as separate pages for print and print preview. But as mentioned earlier, I can't seem to parse through dynamically generated content.

A: My first thought was to use the Eval method built into Xamarin.Forms, but then I found out this is method does not return anything so it is suitable only for app-to-webview communication.
So far the easiest way to implement this is using a custom version of the WebView control:
public class ExtendedWebView : WebView
{
    public delegate Task<string> GetHtmlRequestedHandler();

    public event GetHtmlRequestedHandler GetHtmlRequested;

    public async Task<string> GetHtmlAsync()
    {
        var handler = GetHtmlRequested;
        if (handler != null)
        {
            return await handler.Invoke();
        }
        return null;
    }
}

Now in UWP platform project create a custom renderer:
[assembly: ExportRenderer(typeof(ExtendedWebView), typeof(ExtendedWebViewRenderer))]
namespace App.UWP
{
    public class ExtendedWebViewRenderer : WebViewRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null)
            {
                var ew = (e.OldElement as ExtendedWebView);
                ew.GetHtmlRequested -= Ew_GetHtmlRequested;
            }

            if (e.NewElement != null)
            {
                var ew = (e.NewElement as ExtendedWebView);
                ew.GetHtmlRequested += Ew_GetHtmlRequested;
            }
        }

        private async Task<string> Ew_GetHtmlRequested()
        {
            return await Control.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" });
        }
    }
}

The trick is that we are calling the JavaScript eval function that will return the HTML itself from the web view.
You just need to replace the WebView in XAML with our ExtendedWebView and call its GetHtmlAsync method whenever needed.
The only thing I dislike about this solution is that the event has Task<string> return type, which is weird. Actually already having a return type on event is unusual. A better solution would be to put a property in custom EventArgs that the native control would set with result of the operation, but because the InvokeScriptAsync method is asynchronous (and the non-asynchronous InvokeScript method is obsolete and should no longer be used) we would have to implement a custom Task that would complete when the property is set. Such approach is utilized in UWP with some events, they are using a "deferral" which says the caller that the event will finish only after some asynchronous operation finishes. I will try to look for some authoritative answer on how calling a native asynchronous operation should be implemented in case of custom views :-) .


text:
Q: Autosar Rte_Receive event with wait state and activation of task I am starting to learn about writing application in AUTOSAR and I have run into this question to which I am not able to find a concrete solution. If you could provide an answer based on your experience/knowledge it would be very helpful.
I have a periodic task of 100ms and I want to have a RTE_Receive with wait state in this task. That means as soon as the respective event occurs, my task gets into active-ready state.
Does that mean the task starts running in the same cycle(when the event occurs) or does it wait for the next 100ms cycle to run the task? I just want to determine the worst case latency. If implementing Receive-wait is better than just RTE_read(which just process the data in the next avaialable cycle)
Sorry if the question sounds too dumb. I'm just trying to learn the AUTOSAR concepts.

A: It seems like there is some misunderstanding.
According to your example scenario, The task is periodically activated and starts running even before the Rte_Receive() API is executed, blocking or not. After all, the API call to Rte_Receive() is executed in the code of a RunnableEntity executed as part of the task body.
Again, the event that starts the task is the expiration of the respective timer, not the reception of data.


text:
Q: How can I add a linear-gradient colour to my underline for my heading? I have underlined part of my heading for a website I am building and can colour it normally but I'm struggling when adding a linear gradient colour to it.
I have resorted to putting the section of the heading into a span and colouring the border-bottom and that seems to work, however the border is too far down for it to be an underline.
The coding is this:
span {
    border-bottom: 5px solid transparent;
    border-image: linear-gradient(to right, #7228fe 0%, #4ea2f5 100%);
    border-image-slice: 1;
    float: center;
    margin-bottom: -5px;
    line-height: 20px;
    padding-bottom: 0px;
}

A: I would suggest you to put your heading in a div and target the div using CSS.

.box {
 border-bottom: 5px solid transparent;
 border-image: linear-gradient(to right, #7228fe  0%,#7228fe  60%, #4ea2f5 61%, #4ea2f5 100%);
 border-image-slice: 1;
}

box

https://codepen.io/visheshthakur/pen/XZxWwy


text:
Q: Paraview: some pipeline settings from python script not reflected in the UI I am scripting Paraview (5.6.0) in Python, creating spherical glyphs from a VTU file. Relevant part of the script is shown below. After the script finishes, the glyphs are created and shown with proper parameters but the UI is not reflecting all the settings.
More specifically, the script says sphGlyph.ScaleArray=['POINTS','diameter'] and the view is correctly displaying spheres scaled by the diameter array; the UI nevertheless still says No scale array (in the image below). If I click "apply", I lose the diameter setting and the view updates to No scale array.
Some other settings, like sphGlyph.ScaleFactor=1., are respected both in the UI and in the view.
I don't see any obvious difference between the script and Python trace when constructing the pipeline by hand.
Where is the problem?
# ....
vtuFile="/tmp/burnt.vtu"
view=GetActiveViewOrCreate('RenderView')
# ...
sph=XMLUnstructuredGridReader(FileName=[vtuFile])
RenameSource(vtuFile,sph)
sphGlyph=Glyph(Input=sph,GlyphType='Sphere',GlyphMode='All Points')
sphGlyph.ScaleFactor=1.
sphGlyph.ScaleArray=['POINTS','diameter']    ### <---- SET HERE
sphGlyph.GlyphType.ThetaResolution=32
sphGlyph.GlyphType.PhiResolution=32
sphGlyphShow=Show(sphGlyph,view)
sphGlyphShow.Opacity=0.5
sphGlyphShow.BackfaceRepresentation='Surface'

view.Update()

EDIT: This is the script suggested by @MatthieuWespthal (and downloaded cube.vtu which fails to set Scale Array correctly:
from paraview.simple import *
cubevtu=XMLUnstructuredGridReader(FileName=['cube.vtu'])
glyph1 = Glyph(Input=cubevtu,GlyphType='Arrow')
glyph1.OrientationArray = ['POINTS', 'No orientation array']
glyph1.ScaleArray = ['POINTS', 'f1']
glyph1.ScaleFactor = 0.1
glyph1.GlyphTransform = 'Transform2'
renderView1 = GetActiveViewOrCreate('RenderView')
glyph1Display = Show(glyph1, renderView1)

A: Make sure to call UpdatePipeline before creating the glyph.
The following works perfectly with this dataset.
from paraview.simple import *

# find source
cubevtu = FindSource('cube.vtu')
cubevtu.UpdatePipeline()

# create a new 'Glyph'
glyph1 = Glyph(Input=cubevtu,
    GlyphType='Arrow')
glyph1.OrientationArray = ['POINTS', 'No orientation array']
glyph1.ScaleArray = ['POINTS', 'f1']
glyph1.ScaleFactor = 0.1
glyph1.GlyphTransform = 'Transform2'

# Properties modified on glyph1

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

glyph1Display = Show(glyph1, renderView1)


text:
Q: Check for all null values in a GROUP BY I have the following structre
id val
1 ...
.
.
2 ...
.
.
3 null
3 null
3 null
4 ...
.
.

Basically each id has multiple no. of values. And an id has either all values as integers or all values as null
What I want is to perform an aggregate (like AVG) on val group by id. If that id has null values, I want to put 5 there.
#1
SELECT id, (CASE SUM(val) WHEN null THEN 5 ELSE AVG(val) END) AS ac FROM tt GROUP BY id
> executes ELSE even for id = 3

In CASE, there should be an aggregate function that when done on null values give null.
I checked SUM and MAX like
SELECT SUM(val) FROM tt WHERE id = 3
> null

and it gives null here but doesn't work in  main statement. I guess it is related to the type of equality and hence tried WHEN IS NULL but its a syntax error.
Also, is there some more standard way of indicating group of values as all null rather than using SUM or MAX.

A: The exact problem with your CASE expression is that to check for null in MySQL we have to use IS NULL rather than equality.  So use this version:
CASE WHEN SUM(val) IS NULL THEN 5 ELSE AVG(val) END

But we might as well just use COALESCE() to assign an average of 5 for those id groups having all null values.
SELECT id, COALESCE(AVG(val), 5) AS avg_val
FROM tt
GROUP BY id;

Note that the AVG() function by default ignores nulls.  Therefore, the expression AVG(val) would only be null if every record in an id group were having null for val.

A: You can use if condition :
select id, If(sum(val) is null, 5, AVG(val)) as average
FROM tt
group by id

check here : https://dbfiddle.uk/Uso9nNTM


text:
Q: Facebook like AutoSuggest texbox using jquery in asp.net I need to implement Facebook like AutoSuggest texbox using jquery in my asp.net application.
I googled a lot about this but only found PHP links :(
Any pointer or suggestion will be really helpful. thanks

A: You don't really need a specific example of the server-side code, do you?  I'd guess that using this page as a starting point, and using something like Fiddler to intercept the traffic from the page you should be able to figure out what is required on the back end...  (clue : autocomplete_ajax.cfm expects a query parameter called q with the text entered from the form, and returns data in the format
Match1Name|Match1Id
Match2Name|Match2Id

)

A: Go through this link and download the autosuggestion file(jquery.fcbkcomplete.min http://www.emposha.com/ of jQuery


text:
Q: uploading a file using puppeteer browserWSEndpoint I am trying to upload a file using puppeteer and browserWSEndpoint, the error message I am getting is
"Uncaught (in promise) Error: File chooser handling does not work with multiple connections to the same page".
Here is my code:
  const puppeteer = require('puppeteer');

  async function getTest() {
    const browser = await puppeteer.connect({
      browserWSEndpoint: 'wss://chrome.browserless.io'
    });
    const page = (await browser.pages())[0];
    await page.goto('https://someWebSite');

    //DO STUFF

    console.log("before upload"); //code runs until here

    const [fileChooser] = await Promise.all([page.waitForFileChooser(),page.click('#uploadTrigger'),]);
    await fileChooser.accept(['C:\\myProgram\\pic.jpg']);
    await page.click('#edit-submit');
    }
    getTest().then(console.log);

I must mention that if I don't use browserWSEndpoint, and use this code at the beginning instead, everything works fine.
const browser = await puppeteer.launch({headless: false, defaultViewport:null});

Honnestly I am pretty lost with browserWSEndpoint, I used info from this post How to run Puppeteer code in any web browser?
which led me to browserless.io, copied the code and it works.
Now this is my precise question, my error indicates does not work with multiple connections to the same page.  How exactly am I connecting with multiple connections? Maybe I can resolve this issue and then I could use const [fileChooser].
My main issue is that I need to upload a file, using browserless
Others seem to have the same problem according to https://github.com/GoogleChrome/puppeteer/issues/4783, but using chromuim is not an option if I want to use browserless

A: If you are the only client connected to that browser you must be connected to a browser that doesn't support the fileChooser. You should connect to a Chromium 77.0.3844.0 (r674921) or higher.


text:
Q: What's is yx8018b and what is it symbol? I am trying to fix some solar lamps, that contain pretty much only a handful of electrical components:

*

*A switch

*a solar panel

*a 1.2 V AAA batery

*an LED

*a resistor (inside its "home" it measures ca 45 mOhm, it's labeled in Red-brown-violet-Silver [210 MOhm?!])

and then a little black 4-legged thingy labeled

*

*yx8018b av7n1

While I could find replacement parts under the part number "yx8018", I have no idea what the item is called and how to note it down in the accompanying sketch - an if there is a difference between XY8018 and YX8018B.

A: Although I can't answer the details about the variations of the YX8018 (with or without a B suffix) it is a solar LED driver, similar to the YX8050 whose output waveform I captured in a previous answer.
The datasheet for the YX8018 shows a sample schematic like this:

The inductor (marked "L" in the schematic), required for the boost converter inside this IC, is what you have misidentified as a 270 MOhm resistor. In fact, it is a 220 µH inductor - that is why it measures as such a low resistance.
This additional photo supplied from comments, shows two of the inductors: The "loose" one on the left side of the photo shows the red, red, brown, silver colour bands more clearly than the one still soldered to the PCB on the right side:

Different inductor values are used to change the LED current, as described in the datasheet's table:

I have no idea what the item is called

Solar LED driver.

and how to note it down in the accompanying sketch

See the schematic sample above. There is no specific standardized symbol - so use a rectangle as shown with the part-number on it.


text:
Q: How can I reformat API results into a dictionary then use that dictionary? I have an assignment where I need to key an API using a key that cannot be used by default. Currently, I'm using getJSON to pull data from an API as seen in the code below:
$(document).ready(function() {
    $.getJSON("https://api.nasa.gov/mars-photos/api/v1/manifests/curiosity?api_key=DEMO_KEY", function(data){
        console.log(data);
    });
});

This makes sense, but I'm stuck from here. Essentially, I'd like to reformat the API results and store them in a dictionary so I can key the results using "sol". Ideally, the dictionary would only contain the key "sol", its value, and the key "cameras", and its values for every section within photos as seen in the API.
Additionally, how would you then go about keying the dictionary using a sol value, and returning the cameras associated with that sol value?
EDIT:
The code below works great, but I'm not seeing what I would need to put after everything to use camera globally.
        let new_dict = { "sol": {}, "cameras": {} };

        $(document).ready(function(){
            $.getJSON("https://api.nasa.gov/mars-photos/api/v1/manifests/curiosity?api_key=0L4UJKm4YYvddR1QdZdCihRwQIqKBGrPErgFqUsw", function(data){
                let photos = data["photo_manifest"]["photos"];
                let sol_arr = [];

                for(x in photos){
                    let photo = photos[x];
                    let sol = photo.sol;
                    let cameras = photo.cameras;

                    sol_arr.push(sol);
                    new_dict["cameras"][sol] = cameras;
                }
                new_dict["sol"] = sol_arr;

                let sol_value = 1;
                let camera = new_dict["cameras"][sol_value];
            });
        });

A: $.getJSON("https://api.nasa.gov/mars-photos/api/v1/manifests/curiosity?api_key=DEMO_KEY", function(data){

    let photos = data["photo_manifest"]["photos"];

    let new_dict = { "sol" : {}, "cameras": {} };

    let sol_arr = [];

    for(x in photos){

        let photo = photos[x];

        let sol = photo.sol;
        let cameras = photo.cameras;

        sol_arr.push(sol);
        new_dict["cameras"][sol] = cameras;

    }

    new_dict["sol"] = sol_arr;

});

for keying the dictionary using a sol value, you just need to put sol value
like
let sol_value = 1;
console.log(new_dict["cameras"][sol_value]); //this contains the cameras with the sol value 1


text:
Q: yocto: rebuild part of project I have a project which is using yocto for building libraries including gstreamer. I found out that I need to patch some gstreamer element thus creating new bitbake recipe with patch..
I usually have to run bitbake with image name as parameter which will rebuild whole yocto (which is quite long):
MACHINE=some_machine nice bitbake yocto-etc-etc

How do I rebuild just that part which I need and not whole yocto?
I heard about devtool, but I am not sure how to use that.

A: Certainly, this is easy to do. Just specify the recipe you want to build instead of the image name, for example if it was the main gstreamer recipe you had changed (which at least in current versions is called gstreamer1.0):
MACHINE=some-machine bitbake gstreamer1.0

Note that the name expected on the command line is always a recipe name or something from PROVIDES in a recipe, and not a runtime package name.
Regarding devtool, it can certainly put you into an environment where you can more easily make changes to the source for a recipe and generate patches from them, but the actual building part we are discussing here doesn't really change. You can find more information on how to use devtool in the Yocto Project Development Manual

A: You can also
clean: Removes all output files for a target
cleanall: Removes all output files, shared state cache, and downloaded source files for a target, depending on the changes
bitbake -c clean task
bitbake -c cleanall task

A: First you can create a patch on the gstreamer using quilt or diff etc...
Put the patch into your meta layer and include it into,SRC_URI += "file://xxxx.patch".
Make sure you have added FILESEXTRAPATHS_PREPEND variable in the bbappend file of recipe.
Then do a cleansstate of the package.
bitabake gstreamer** -c cleansstate

Then execute do_patch operation and check our patch has been applied properly.
bitabake gstreamer*** -c patch

Then do the full build of the component followed by built the final target.

A: you can pass different command to bitbake based on what you need.
To remove temp:
bitbake -c clean gstreamer

To remove temp and sstate cache (I use this most):
bitbake -c cleansstate gstreamer

To remove download as well, and lets begin build starting from do_fetch and all
bitbake -c cleanall gstreamer

Once you are done with either of these clean, which ever suits you, you can simple give build command for the specified:
bitbake gstreamer

A: You can also launch the taskes you are interested in, for example:
If you want to apply only the patch you can do something like:
# Apply the patch you have located and sourced in SRC_URI variable previously
MACHINE=some_machine nice bitbake -c patch gstreamer
# Compile the recipe
MACHINE=some_machine nice bitbake -c compile gstreamer

# In case there are more necessary tasks, launch them as previous

Now you can get the generated package, and pass it to your board (eg. via ssh/serial(zmodem) ), test it and repeat until you like the resul, then regenerate the image doing:
for i in clean cleanall cleansstate;do bitbake -c ${i} gstreamer;done
MACHINE=some_machine nice bitbake yocto-etc-etc

A: you can build any specific recipe by providing the recipe name along with the bitbake command
For instance, If you want to build gstreamer
poky/meta/recipes-multimedia/gstreamer1.0_1.16.3.bb

you can use the following command
MACHINE=<your-machine-name> bitbake gstreamer1.0

Note that the PROVIDES value will be parsed from .bb filename excluding the characters after underscore.
Additional suggestions
If you want to do some experimental changes in your source and wants to compile for each minimalistic change, you could do that by navigating to
work directory
cd build/tmp/work/armv5e-poky-linux-gnueabi/gstreamer1.0/1.16.3-r0/

here you can apply your changes in src directory and you can use ./temp/run.do_compile to compile, which will take very less time compared to the entire build time.


text:
Q: Create HostingEnvironment instance with WebRootPath I'm migrating from netcore2.1 to netcore3.1. I have a service where I need to create an IServiceProvider and inject IWebHostEnvironment (I used to inject IHostingEnvironment in netcore2.1). The code used to just create a new Microsoft.Extensions.Hosting.Internal.HostingEnvironment instance but that class doesn't contain WebRootPath anymore. I fetched git repo and tried to look for implementations of IWebHostEnvironment but it seems that the only implementation is internal to aspnetcore which is of no use.
Is there a possibility to create an instance of IWebHostEnvironment somehow?
Daniel

A: Hi You can access WebRoot Path using in Core 3.1
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.Mvc;
    public class HomeController : Controller
    {
          private readonly IWebHostEnvironment _hostingEnv;

           public HomeController(IWebHostEnvironment hostingEnv)
           {
             _hostingEnv = hostingEnv;
           }

          private Void GetWebRoot()
          {
             var webRootPath = _hostingEnv.WebRootPath;
          }
     }

Can you try this, upvote if it helps


text:
Q: Set paging file to none in cli I'm trying to disable paging file with WMIC or other commands,

I found multiple links online but it's all about changing the location.
How do I disable it in cli?

A: Resolved, the syntax is a little bit confusing:
wmic pagefileset where name="C:\\pagefile.sys" delete


text:
Q: JQuery - Range slider issue - changing image I have the following issue:

*

*I want to add an Range Slider

*By moving the trigger different images should appear

The goal:

*

*To combine the 2 Range Slider Examples to one!

*I want to have the design of the first Range Slider

*But with the function of the second Range Slider (the ability to change images)

Hope ya'll can help me - Cheers!

.slider{display:inline-block;vertical-align:middle;position:relative}.slider.slider-horizontal{width:50%;height:20px}.slider.slider-horizontal .slider-track{height:5px;width:100%;margin-top:-3px;top:50%;left:0;     background-image: linear-gradient(to top, #D4D4D4 0%, #BDBDBD 100%);
    border: 0;
    content: ' ';
    display: block;
    height: 5px;
    left: 0;
    opacity: 1;
    position: absolute;
    right: 0;
    top: 10px;
    transition: height .5s ease, opacity 1s ease;
    z-index: -20;}.slider.slider-horizontal .slider-selection,.slider.slider-horizontal .slider-track-low,.slider.slider-horizontal .slider-track-high{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-tick,.slider.slider-horizontal .slider-handle{margin-left:-10px}.slider.slider-horizontal .slider-tick.triangle,.slider.slider-horizontal .slider-handle.triangle{position:relative;top:50%;transform:translateY(-50%);border-width:0 10px 10px 10px;width:0;height:0;border-bottom-color:#2e6da4;margin-top:0}.slider.slider-horizontal .slider-tick-container{white-space:nowrap;position:absolute;top:0;left:0;width:100%}.slider.slider-horizontal .slider-tick-label-container{white-space:nowrap;margin-top:20px}.slider.slider-horizontal .slider-tick-label-container .slider-tick-label{padding-top:4px;display:inline-block;text-align:center}.slider.slider-horizontal.slider-rtl .slider-track{left:initial;right:0}.slider.slider-horizontal.slider-rtl .slider-tick,.slider.slider-horizontal.slider-rtl .slider-handle{margin-left:initial;margin-right:-10px}.slider.slider-horizontal.slider-rtl .slider-tick-container{left:initial;right:0}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;left:25%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-track-low,.slider.slider-vertical .slider-track-high{width:100%;left:0;right:0}.slider.slider-vertical .slider-tick,.slider.slider-vertical .slider-handle{margin-top:-10px}.slider.slider-vertical .slider-tick.triangle,.slider.slider-vertical .slider-handle.triangle{border-width:10px 0 10px 10px;width:1px;height:1px;border-left-color:#2e6da4;border-right-color:#2e6da4;margin-left:0;margin-right:0}.slider.slider-vertical .slider-tick-label-container{white-space:nowrap}.slider.slider-vertical .slider-tick-label-container .slider-tick-label{padding-left:4px}.slider.slider-vertical.slider-rtl .slider-track{left:initial;right:25%}.slider.slider-vertical.slider-rtl .slider-selection{left:initial;right:0}.slider.slider-vertical.slider-rtl .slider-tick.triangle,.slider.slider-vertical.slider-rtl .slider-handle.triangle{border-width:10px 10px 10px 0}.slider.slider-vertical.slider-rtl .slider-tick-label-container .slider-tick-label{padding-left:initial;padding-right:4px}.slider.slider-disabled .slider-handle{background-image:-webkit-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:-o-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:linear-gradient(to bottom,#dfdfdf 0,#bebebe 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf',endColorstr='#ffbebebe',GradientType=0)}.slider.slider-disabled .slider-track{background-image:-webkit-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:-o-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:linear-gradient(to bottom,#e5e5e5 0,#e9e9e9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5',endColorstr='#ffe9e9e9',GradientType=0);cursor:not-allowed}.slider input{display:none}.slider .tooltip.top{margin-top:-36px}.slider .tooltip-inner{white-space:nowrap;max-width:none}.slider .hide{display:none}.slider-track{position:absolute;cursor:pointer;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#f9f9f9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);border-radius:4px}.slider-selection{position:absolute;background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:4px}.slider-selection.tick-slider-selection{background-image:-webkit-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:-o-linear-gradient(top,#8ac1ef 0,#82b3de 100%);background-image:linear-gradient(to bottom,#8ac1ef 0,#82b3de 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef',endColorstr='#ff82b3de',GradientType=0)}.slider-track-low,.slider-track-high{position:absolute;background:transparent;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:4px}.slider-handle{position:absolute;top:0;width:20px;height:20px;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.31);
    background: #d4d4d4;
    background-image: linear-gradient(to bottom, #EFEFEF, #bbbbbb);
    background-size: auto 60px;
    background-repeat: no-repeat;
    transition: box-shadow 0.1s linear, background-position 0.1s linear;
    background-image: linear-gradient(to top, #1B1E28 15%, #e94843 100%);
    height: 38px;
    left: -18px;
    text-align: center;
    top: -6px;
    width: 32px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.8);}.slider-handle.round{border-radius:}.slider-handle.triangle{background:transparent none}.slider-handle.custom{background:transparent none}.slider-handle.custom::before{line-height:20px;font-size:20px;content:'\2605';color:#726204}.slider-tick{position:absolute;width:2px;height:20px;background-image:-webkit-linear-gradient(top,#aeaeae 0,#d1d1d1 100%);background-image:-o-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,##afafaf 0,#d1d1d1 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9',endColorstr='#fff5f5f5',GradientType=0);box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;filter:none;opacity:1;border:0 solid transparent}.slider-tick.round{border-radius:}.slider-tick.triangle{background:transparent none}.slider-tick.custom{background:transparent none}.slider-tick.custom::before{line-height:20px;font-size:20px;content:'\2605';color:#726204}.slider-tick.in-selection{background-image:-webkit-linear-gradient(top,#8ac1ef 0,#d1d1d1 100%);background-image:-o-linear-gradient(top,#8ac1ef 0,#d1d1d1 100%);background-image:linear-gradient(to bottom,#afafaf 0,#82b3de 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#8ac1ef',endColorstr='#afafaf',GradientType=0);opacity:1}

.slider-handle:after {
    content:"";
    border-left: 1px solid #17181E;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    height: 18px;
    margin: 8px 2px;

}

.slider-handle span {
    border-left: 1px solid #17181E;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    height: 18px;
    margin: 8px 2px;
}

.slider-handle::after span {
    border-left: 1px solid #17181E;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    height: 18px;
    margin: 8px 2px;
}

.range-slider {
margin-left: 100px; }

 Main Slider

        <input id="ex19" type="text"
              data-provide="slider"
              data-slider-ticks="[1, 2, 3, 4, 5]"
              data-slider-ticks-labels='["phase 1", "phase 2", "phase 3", "phase 4", "phase 5"]'
              data-slider-min="1"
              data-slider-max="5"
              data-slider-step="1"
              data-slider-value="1"
              data-slider-tooltip="hide"  />

 Image Slider

<input type="range" id="slider" value="0.0" min="0" max="5" step="1" />

slider value = 0

A: Use onchange="changeslider(value)
And then
function changeslider(val) {
  $('#sliderStatus').html(val);
  $("#img").prop("src", imageUrl[val]);
}

Demo

var imageUrl = new Array();

imageUrl[0] = 'https://static.pexels.com/photos/39517/rose-flower-blossom-bloom-39517.jpeg';

imageUrl[1] = 'https://static.pexels.com/photos/36764/marguerite-daisy-beautiful-beauty.jpg';

imageUrl[2] = 'http://cdn2.stylecraze.com/wp-content/uploads/2013/07/dahlia-flowers.jpg';

imageUrl[3] = 'https://static.pexels.com/photos/39517/rose-flower-blossom-bloom-39517.jpeg';

imageUrl[4] = 'https://static.pexels.com/photos/36764/marguerite-daisy-beautiful-beauty.jpg';

imageUrl[5] = 'http://cdn2.stylecraze.com/wp-content/uploads/2013/07/dahlia-flowers.jpg';

$(document).on('input change', '#slider', function() { //listen to slider changes
  var v = $(this).val(); //getting slider val
  $('#sliderStatus').html($(this).val());
  $("#img").prop("src", imageUrl[v]);
});

function changeslider(val) {
  $('#sliderStatus').html(val);
  $("#img").prop("src", imageUrl[val]);
}
.slider {
  display: inline-block;
  vertical-align: middle;
  position: relative
}

.slider.slider-horizontal {
  width: 50%;
  height: 20px
}

.slider.slider-horizontal .slider-track {
  height: 5px;
  width: 100%;
  margin-top: -3px;
  top: 50%;
  left: 0;
  background-image: linear-gradient(to top, #D4D4D4 0%, #BDBDBD 100%);
  border: 0;
  content: ' ';
  display: block;
  height: 5px;
  left: 0;
  opacity: 1;
  position: absolute;
  right: 0;
  top: 10px;
  transition: height .5s ease, opacity 1s ease;
  z-index: -20;
}

.slider.slider-horizontal .slider-selection,
.slider.slider-horizontal .slider-track-low,
.slider.slider-horizontal .slider-track-high {
  height: 100%;
  top: 0;
  bottom: 0
}

.slider.slider-horizontal .slider-tick,
.slider.slider-horizontal .slider-handle {
  margin-left: -10px
}

.slider.slider-horizontal .slider-tick.triangle,
.slider.slider-horizontal .slider-handle.triangle {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  border-width: 0 10px 10px 10px;
  width: 0;
  height: 0;
  border-bottom-color: #2e6da4;
  margin-top: 0
}

.slider.slider-horizontal .slider-tick-container {
  white-space: nowrap;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%
}

.slider.slider-horizontal .slider-tick-label-container {
  white-space: nowrap;
  margin-top: 20px
}

.slider.slider-horizontal .slider-tick-label-container .slider-tick-label {
  padding-top: 4px;
  display: inline-block;
  text-align: center
}

.slider.slider-horizontal.slider-rtl .slider-track {
  left: initial;
  right: 0
}

.slider.slider-horizontal.slider-rtl .slider-tick,
.slider.slider-horizontal.slider-rtl .slider-handle {
  margin-left: initial;
  margin-right: -10px
}

.slider.slider-horizontal.slider-rtl .slider-tick-container {
  left: initial;
  right: 0
}

.slider.slider-vertical {
  height: 210px;
  width: 20px
}

.slider.slider-vertical .slider-track {
  width: 10px;
  height: 100%;
  left: 25%;
  top: 0
}

.slider.slider-vertical .slider-selection {
  width: 100%;
  left: 0;
  top: 0;
  bottom: 0
}

.slider.slider-vertical .slider-track-low,
.slider.slider-vertical .slider-track-high {
  width: 100%;
  left: 0;
  right: 0
}

.slider.slider-vertical .slider-tick,
.slider.slider-vertical .slider-handle {
  margin-top: -10px
}

.slider.slider-vertical .slider-tick.triangle,
.slider.slider-vertical .slider-handle.triangle {
  border-width: 10px 0 10px 10px;
  width: 1px;
  height: 1px;
  border-left-color: #2e6da4;
  border-right-color: #2e6da4;
  margin-left: 0;
  margin-right: 0
}

.slider.slider-vertical .slider-tick-label-container {
  white-space: nowrap
}

.slider.slider-vertical .slider-tick-label-container .slider-tick-label {
  padding-left: 4px
}

.slider.slider-vertical.slider-rtl .slider-track {
  left: initial;
  right: 25%
}

.slider.slider-vertical.slider-rtl .slider-selection {
  left: initial;
  right: 0
}

.slider.slider-vertical.slider-rtl .slider-tick.triangle,
.slider.slider-vertical.slider-rtl .slider-handle.triangle {
  border-width: 10px 10px 10px 0
}

.slider.slider-vertical.slider-rtl .slider-tick-label-container .slider-tick-label {
  padding-left: initial;
  padding-right: 4px
}

.slider.slider-disabled .slider-handle {
  background-image: -webkit-linear-gradient(top, #dfdfdf 0, #bebebe 100%);
  background-image: -o-linear-gradient(top, #dfdfdf 0, #bebebe 100%);
  background-image: linear-gradient(to bottom, #dfdfdf 0, #bebebe 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf', endColorstr='#ffbebebe', GradientType=0)
}

.slider.slider-disabled .slider-track {
  background-image: -webkit-linear-gradient(top, #e5e5e5 0, #e9e9e9 100%);
  background-image: -o-linear-gradient(top, #e5e5e5 0, #e9e9e9 100%);
  background-image: linear-gradient(to bottom, #e5e5e5 0, #e9e9e9 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5', endColorstr='#ffe9e9e9', GradientType=0);
  cursor: not-allowed
}

.slider input {
  display: none
}

.slider .tooltip.top {
  margin-top: -36px
}

.slider .tooltip-inner {
  white-space: nowrap;
  max-width: none
}

.slider .hide {
  display: none
}

.slider-track {
  position: absolute;
  cursor: pointer;
  background-image: -webkit-linear-gradient(top, #f5f5f5 0, #f9f9f9 100%);
  background-image: -o-linear-gradient(top, #f5f5f5 0, #f9f9f9 100%);
  background-image: linear-gradient(to bottom, #f5f5f5 0, #f9f9f9 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);
  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  border-radius: 4px
}

.slider-selection {
  position: absolute;
  background-image: -webkit-linear-gradient(top, #f9f9f9 0, #f5f5f5 100%);
  background-image: -o-linear-gradient(top, #f9f9f9 0, #f5f5f5 100%);
  background-image: linear-gradient(to bottom, #f9f9f9 0, #f5f5f5 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);
  -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  border-radius: 4px
}

.slider-selection.tick-slider-selection {
  background-image: -webkit-linear-gradient(top, #8ac1ef 0, #82b3de 100%);
  background-image: -o-linear-gradient(top, #8ac1ef 0, #82b3de 100%);
  background-image: linear-gradient(to bottom, #8ac1ef 0, #82b3de 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8ac1ef', endColorstr='#ff82b3de', GradientType=0)
}

.slider-track-low,
.slider-track-high {
  position: absolute;
  background: transparent;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  border-radius: 4px
}

.slider-handle {
  position: absolute;
  top: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.31);
  background: #d4d4d4;
  background-image: linear-gradient(to bottom, #EFEFEF, #bbbbbb);
  background-size: auto 60px;
  background-repeat: no-repeat;
  transition: box-shadow 0.1s linear, background-position 0.1s linear;
  background-image: linear-gradient(to top, #1B1E28 15%, #e94843 100%);
  height: 38px;
  left: -18px;
  text-align: center;
  top: -6px;
  width: 32px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.8);
}

.slider-handle.round {
  border-radius:
}

.slider-handle.triangle {
  background: transparent none
}

.slider-handle.custom {
  background: transparent none
}

.slider-handle.custom::before {
  line-height: 20px;
  font-size: 20px;
  content: '\2605';
  color: #726204
}

.slider-tick {
  position: absolute;
  width: 2px;
  height: 20px;
  background-image: -webkit-linear-gradient(top, #aeaeae 0, #d1d1d1 100%);
  background-image: -o-linear-gradient(top, #f9f9f9 0, #f5f5f5 100%);
  background-image: linear-gradient(to bottom, ##afafaf 0, #d1d1d1 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0);
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  filter: none;
  opacity: 1;
  border: 0 solid transparent
}

.slider-tick.round {
  border-radius:
}

.slider-tick.triangle {
  background: transparent none
}

.slider-tick.custom {
  background: transparent none
}

.slider-tick.custom::before {
  line-height: 20px;
  font-size: 20px;
  content: '\2605';
  color: #726204
}

.slider-tick.in-selection {
  background-image: -webkit-linear-gradient(top, #8ac1ef 0, #d1d1d1 100%);
  background-image: -o-linear-gradient(top, #8ac1ef 0, #d1d1d1 100%);
  background-image: linear-gradient(to bottom, #afafaf 0, #82b3de 100%);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8ac1ef', endColorstr='#afafaf', GradientType=0);
  opacity: 1
}

.slider-handle:after {
  content: "";
  border-left: 1px solid #17181E;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  height: 18px;
  margin: 8px 2px;
}

.slider-handle span {
  border-left: 1px solid #17181E;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  height: 18px;
  margin: 8px 2px;
}

.slider-handle::after span {
  border-left: 1px solid #17181E;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  height: 18px;
  margin: 8px 2px;
}

.range-slider {
  margin-left: 100px;
}

 Main Slider

  <input id="ex19" type="text" data-provide="slider" data-slider-ticks="[1, 2, 3, 4, 5]" data-slider-ticks-labels='["phase 1", "phase 2", "phase 3", "phase 4", "phase 5"]' data-slider-min="1" data-slider-max="5" data-slider-step="1" data-slider-value="1" data-slider-tooltip="hide" onchange="changeslider(value)" />

 Image Slider

<input type="range" id="slider" value="0.0" min="0" max="5" step="1" />

 slider value = 0


text:
Q: Не отображается текст с пробелами .textContent Из таблицы MySQL получены три значения:

*

*Имя: Николай

*Имя: Дмитрий

*Имя: С тепан
Когда я кликаю на первый и второй пункты - значения прекрасно выводятся в таблицу(которая находится в нижней части сайта). Если же нажать на третий пункт - клик игнорируется. Когда я убрал пробел в третьем пункте - он тоже стал выводиться в таблицу по клику.
HTML:

Пусто

PHP:
echo '

';
JavaScript:

Как это исправить?

A: Дело в том, что Вы рисуете не правильный HTML. То есть, если поглядеть, что получается у Вас, то получаем:

где мы видим, что у Вас в функцию nFull передается строка 'С тепан', в которой содержится пробел. Вроде бы все хорошо, но Вы забыли еще одни кавычки:

    function nFull(name) {
        document.getElementById('name').textContent = name;
    }

Пусто

Николай

Дмитрий

С тепан

Функцию nFull оберните в кавычки и все заработает. Вот так:
echo '

';


text:
Q: .NET does ORA-0001 multiple calls ORACLE I have noticed in .NET applications (MVC3 and Web Froms) that occasionaly certain called procedure executes multiple times.
(it is very simple (link click) call so it is not problem in c#)
sample of link click code:
try{
     using (var context = new DB())
                {
                    context.some_procedure(user_id, order_id, "string");
                }
}
catch(Exception ex)
{
     Log.Error("some_procedure " + ex.Message + ex.InnerException);
     return null;
}

In Oracle procedure is also taken care of duplicates.
I must add that columns iduser and idorder have pair unique index constraint on table1 (pair_unique_const)
some_procedure(number user_id, number order_id, varchar2 string)
.
.
.
    SELECT COUNT(*)
             INTO var_exists
             FROM table1 WHERE
             iduser = user_id and idorder = order_id;

IF var_exists = 0 then

insert into table1 (id, iduser, idorder, text)
select(sequence.nextval, user_id, order_id, string);

Commit;

end if;
.
.
.

Still error ORA-0001 happens from time to time that suggests pair_unique_const (unique constraint index) is violated and duplicates could happen (if i havent put pair_unique_const).
No where else inserts are made into this table!
So I assume .NET does multiple calls on click ocassionaly in a milisecond.
Or can it be ODAC fault i don't know.
Since I have unique constraint on those 2 columns insert doesn't happen.
Also making a transaction call in c# and then commit when all is finished helped and solved the issue.
But I just want to know why this happens?
click link call should make only one request.
Thank you in advance!


text:
Q: Not implementing all the methods of an interface I tried reproducing the code below on eclipse. I get an error telling me that I have to implement all the inherited methods (because Comparator is an interface).

The type new Comparator(){} must implement the inherited abstract method Comparator.reversed().

There are many of these methods and the only one I want to overwrite is compare. Do I have to implement all the other methods or is there a way to specify I don't need to implement them?
I understand that I will have to do it because of the contractual nature of an interface, but what if I just need to change one method?
static Map sortByValue(Map map) {
     List list = new LinkedList(map.entrySet());
     Collections.sort(list, new Comparator() {
          public int compare(Object o1, Object o2) {
               return ((Comparable) ((Map.Entry) (o1)).getValue())
              .compareTo(((Map.Entry) (o2)).getValue());
          }
     });

    Map result = new LinkedHashMap();
    for (Iterator it = list.iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry)it.next();
        result.put(entry.getKey(), entry.getValue());
    }
    return result;
}

EDIT
Solved by changing the compliance level to java8 in eclipse luna. Thanks!

A: This is sort of a wild guess: I think you are using Java 8 in a pre-Java 8-Eclipse (i.e. pre-Luna). This way, Eclipse does not know that all those new Comparator methods, like thenComparing, have a default implementation.
In Java 7, Comparator has just the method compare, while in Java 8 in has a whole lot more methods, all of which have a default implementation directly in the interface and need not to be implemented in a subclass.
I suggest you switch to the newest version of Eclipse, which should be Luna. Alternatively, you can also install a patch for Eclipse Kepler, but switching to Luna is certainly better.

A:
The type new Comparator(){} must implement the inherited abstract method Comparator.reversed() then if I apply the fix, I have many functions added

Comparator.reversed was introduced in Java 1.8 and it's a default method i.e. a method that you don't have to override.
It seems like you have your compliance level set to pre Java 1.8 (since Eclipse asks you to override reversed), while using Java 1.8 API (since Comparator has a reversed method).
Make sure you either change your API to 1.7 or change your compliance level to 1.8. (The latter option requires Eclipse Luna or better.)
More on Eclipse compliance level:
 What is "compiler compliance level" in Eclipse?

A: The purpose of an interface is to obligate the implementer of said interface to have all of the methods listed there. Now there are a few ways to got about not implementing all of the methods.

*

*For every method you don't wish to implement (support) just throw UnsupportedOperationException. An example of this sort of implementation would be the Collections API.

To keep the number of core collection interfaces manageable, the Java platform doesn't provide separate interfaces for each variant of each collection type. (Such variants might include immutable, fixed-size, and append-only.) Instead, the modification operations in each interface are designated optional — a given implementation may elect not to support all operations. If an unsupported operation is invoked, a collection throws an UnsupportedOperationException. Implementations are responsible for documenting which of the optional operations they support. All of the Java platform's general-purpose implementations support all of the optional operations.

*Or you could follow what the Java developers did with some of the interfaces that declare a lot of methods eg: MouseAdapter. This way you'll implement every method, but they won't be doing anything useful.

A: An abstract class may be better suited for what you are doing. Although you could just .super() everything.

A: You have run into an Eclipse bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390889
Basically, JAVA 1.8 introduced a brand new method Comparator.reversed(). And since you have a JAVA 1.7 or earlier code, JAVA 1.8 doesn't find the method and fails to compile.


text:
Q: Some questions about __getattr__ and __getattribute__? The first demo:
class B:
    def __init__(self):
        self.name = '234'
    # def __getattribute__(self, name):
    #     print('getattr')
    def __getattr__(self, name):
        print('get')
    def __setattr__(self, name, value):
        print('set')
    def __delattr__(self, name):
        print('del')

b = B()
print(b.__dict__)
b.name

b.__dict__ is {}, but the second demo:
class B:
    def __init__(self):
        self.name = '234'
    def __getattribute__(self, name):
        print('getattr')
    def __getattr__(self, name):
        print('get')
    def __setattr__(self, name, value):
        print('set')
    def __delattr__(self, name):
        print('del')

b = B()
print(b.__dict__)
b.name

b.__dict__ is None, why? And b.__dict__ invokes __getattribute__, but don't invoke __getattr__, does it mean __getattribute__ will prevent from invoking __getattr__?

A: The __getattribute__, __setattr__ and __delattr__ methods are called for all attribute access (getting, setting and deleting). __getattr__ on the other hand is only called for missing attributes; it is not normally already implemented, but if it is then __getattribute__ calls it if it could not otherwise locate the attribute, or if an AttributeError was raised by __getattribute__.
You replaced the standard implementations of the 3 main methods with methods that do nothing but print and return None (the default in the absence of an explicit return statement). __dict__ is just another attribute access, and your __getattribute__ method returns None, and never itself calls __getattr__ or raises an AttributeError.
From the Customizing attribute access documentation:

object.__getattr__(self, name)
  Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self).

and

object.__getattribute__(self, name)
  Called unconditionally to implement attribute accesses for instances of the class. If the class also defines __getattr__(), the latter will not be called unless __getattribute__() either calls it explicitly or raises an AttributeError.

(Bold emphasis mine).
Either call the base implementation (via super().__getattribute__) or raise an AttributeError:
>>> class B:
...     def __init__(self):
...         self.name = '234'
...     def __getattribute__(self, name):
...         print('getattr')
...         return super().__getattribute__(name)
...     def __getattr__(self, name):
...         print('get')
...     def __setattr__(self, name, value):
...         print('set')
...     def __delattr__(self, name):
...         print('del')
...
>>> b = B()
set
>>> b.__dict__
getattr
{}
>>> b.name
getattr
get
>>> class B:
...     def __init__(self):
...         self.name = '234'
...     def __getattribute__(self, name):
...         print('getattr')
...         raise AttributeError(name)
...     def __getattr__(self, name):
...         print('get')
...     def __setattr__(self, name, value):
...         print('set')
...     def __delattr__(self, name):
...         print('del')
...
>>> b = B()
set
>>> b.__dict__
getattr
get
>>> b.name
getattr
get

Note that by calling super().__getattribute__ the actual __dict__ attribute is found. By raising an AttributeError instead, __getattr__ was called, which also returned None.


text:
Q: How can I create an interaction with a URL by clicking a button in objective c? I'm trying to make an app for iphone which will send a tcp connection to a specified urf (or web application). I want the button to firstly give an allert before sending. I wrote this code for this:
-(IBAction)tiklandi:(id)sender{
NSString *buton1 = [sender titleForState:UIControlStateNormal];
NSString *uyariText = [[NSString alloc] initWithFormat:@"istek gönderiliyor!"];
UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Sunucuya Gönderildi" message:uyariText delegate:nil
    cancelButtonTitle:@"işlemi iptal ettiniz!"
                                    otherButtonTitles: nil];
[alert show];
//[alert release];

but I couldn't use any url methods in my code.
My second question is, I can't see my Interface builder in Developer directory and also in project navigator of Xcode I can't see folders, all the classes come mixed between each other. I use Xcode 4.2, and I'm new with all these, can anyone please help?

I tried the listed solutions but I dont know how to interact my view controller files and .xib file.
Here is my view controller .h file:
@interface ViewController : UIViewController

@property (nonatomic, retain) NSURLRequest *url;
@property (nonatomic,retain) UIButton *buton;

-(IBAction)fonksiyon:(id)sender;
@end

and this is my implementation file (of view control .. .m)
#import "ViewController.h"

@implementation ViewController

@synthesize buton;
@synthesize url;

-(IBAction)fonksiyon:(id)sender{

    NSString *buton= [sender titleForState:UIControlStateNormal];
    NSURL *url= [sender url];
    NSString *uyariText= [[NSString alloc] initWithFormat:@"gönderiliyor!"];
    UIAlertView *alertView= [[UIAlertView alloc]initWithTitle:@"Sunucuya Gönderildi"
                                                  message:uyariText
                                                 delegate:self
                                        cancelButtonTitle:@"işlemi iptal ettiniz!"
                                        otherButtonTitles:@"Server'a Git!", nil];

    - (NSURL)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
        if (buttonIndex != [alertView cancelButtonIndex]) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://192.168.69.290/cgi-bin/ipad.pl";nil]];
        }

    }

}

The problem is that I can not make a relation between .xib file and the other ones via File's Owner. As I understand, when I drag from file's owner I should see my function (here called fonksiyon) too. Can anyone help?

A: set the delegate to self when you create the UIAlertView and implement one of the UIAlertViewDelegate methods.
Of course if you want to provide the option to cancel you need a "otherButtonTitle"
UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Sunucuya Gönderildi"
                                              message:uyariText
                                             delegate:self
                                    cancelButtonTitle:@"işlemi iptal ettiniz!"
                                    otherButtonTitles:@"Go to website", nil];

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if (buttonIndex != [alertView cancelButtonIndex]) {
        // open url in external safari
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://foo.bar"]];
        // EDIT: I might have misunderstood your question.
        // you should read about NSURLConnection and put that code here.
    }
}

my second question is, i cant see my Interface builder in Developer directory

Interface Builder is no longer an extra application. It is now built-in to Xcode. You don't need to launch it, just select the xib file in Xcode.

and also in project navigator of Xcode i can't see folders, all the classes come mixed between each other.

Select the files you want to group, do a secondary click and select "New Group from Selection".
You are responsible for grouping your files. When you have an existing group just drag&drop your files there.

A: *

*You have to implement the delegate protocol for UIAlert to handle user's response. Then you'll be able to open the URL you want.

*Interface Builder is no longer a separate application (since XCode v4)> Just open a XIB/NIB file in XC.

*To open a URL in Safari mobile check this question: How can I launch Safari from an iPhone app?

*If you want to open an URL inside your app you need to build your own UIWebView:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/