text:
Q: multiplying one column in tibble by each element in vector to produce multiple new tibbles Given the tibble:
c1 <- c(1,2,3)
c2 <- c(4,5,6)
c3 <- c(7,8,9)
d1 <- as_tibble(data.frame(c1,c2,c3))

# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4     7
2     2     5     8
3     3     6     9

and the vector
v1 <- c(1,2,3)

I would like a tidyverse method to multiply c3 by each element in the vector to produce three new tibbles that look like this:
# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4     7
2     2     5     8
3     3     6     9

# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4     14
2     2     5     16
3     3     6     18

# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4     21
2     2     5     24
3     3     6     27

I got as far as this:
d1 %>%
    mutate(outer(c3, v1, FUN = "*"))

# A tibble: 3 × 4
     c1    c2    c3 `outer(c3, v1, FUN = "*")`[,1]  [,2]  [,3]
  <dbl> <dbl> <dbl>                          <dbl> <dbl> <dbl>
1     1     4     7                              7    14    21
2     2     5     8                              8    16    24
3     3     6     9                              9    18    27

but it is not really a tidy way and is still one object. What are some better methods?

A: map (or the base R equivalent lapply) are usually good places to start when you want to output a list:
library(purrr)
library(dplyr)
map(v1, ~ d1 %>% mutate(c3 = .x * c3))

[[1]]
# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4     7
2     2     5     8
3     3     6     9

[[2]]
# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4    14
2     2     5    16
3     3     6    18

[[3]]
# A tibble: 3 × 3
     c1    c2    c3
  <dbl> <dbl> <dbl>
1     1     4    21
2     2     5    24
3     3     6    27

In base R:
lapply(v1, \(x) {d1[3] <- d1[3]*x; d1})

A: Using transform in base R
 lapply(v1, \(x) transform(d1, c3 = c3 *x))

-output
[[1]]
  c1 c2 c3
1  1  4  7
2  2  5  8
3  3  6  9

[[2]]
  c1 c2 c3
1  1  4 14
2  2  5 16
3  3  6 18

[[3]]
  c1 c2 c3
1  1  4 21
2  2  5 24
3  3  6 27


text:
Q: A confusion about the Monty Hall problem After reading the other question about the Monty Hall problem, and seeing the solution of it, before giving my perspective to the question, I would like to point out that, to explain the possible cases, we either fix the doors that I choose and Monty Hall opens, and permutate the values of the doors, i.e what is behind them, or we fix the values of the door, and permutate the door we and Monty Hall chooses.
Given that, let WLOG I choose the first door and Monty Hall opens the 3rd door, then we have the following cases;
1-> car
2-> goat
3-> goat
or
1-> goat
2-> car
3->goat
Since, we do know that the car is not behind the door 3.
So, there is only 2 option in one of them I win, and in the other I loose, hence the there is no difference in changing the door I chose first, hence the probability of the door 1 has the case is 1/2.
So my question is what exactly wrong with this argument ? Exactly which step of the argument fails to be true ?
Edit:
In this question, I was pointing out some of the problems that I general answer to Monty Hall problems contains, so it is different than the question that is claimed that this question to be duplicate of.

A: You cannot do the "WLOG" and expect probabilities to stay equally distributed over your cases.
That is, you can say -- assuming that the car is behind a uniformly random door -- that you choose door 1, and then the three options are (car, goat, goat), (goat, car, goat) or (goat, goat, car) -- each with probability 1/3. That is fine.
However, when you then say "Without loss of generality, Monty opens door 3", you are excluding case 3, and implicitly treating it while you are treating case 2. If you continue you then have to add the probability of that situation occurring to the treatment of case 2. There are two options left: (car, goat, goat) and (goat, car, goat), but the first has probability 1/3, while the second has probability 2/3.
Edit: As a more general point, you seem to be using the common argument, "there are $n$ options, and therefore each occurs with probability $1/n$". This argument is dangerous: there's no reason to expect it to hold in general, but you often need it as an implicit assumption, because people forget to specify e.g. that a die or a coin is fair.
Consider the following similar argument: you throw two fair 6-sided dice, and your roll is the sum of the two numbers. The possible outcomes are $\{2,3,4,5,6,7,8,9,10,11,12\}$. You might be tempted to conclude that, since there are 11 possible outcomes, the probability of rolling 2 is $1/11$ -- but if you've played enough Settlers of Catan you know that to be false!

A: We have $$\begin{array}{c|c|c}\#1&\#2&\#3&\mbox{Result at }\#1&\mbox{result otherwise}\\\hline c&g&g&win&lose\\\hline g&c&g&lose&win\\\hline g&g&c&lose&win\end{array}$$We can't assume that the host open door $3$ because then you say "the third option(g,g,c) can't happen", what the host does is taking the column of $\#2$ or $\#3$ "away", but the results won't change.

Update:
You have to note that the host choice depends on your choice: if you choose the correct door then the host will open a door with probability $50\%$ for each door. you have $\#1$ your choice and host open $\#2$ to be $1/3\cdot1/2=1/6$($1/3$ is the probability you are correct at the start) and you have $\#1$ your choice and host open $\#3$ to be $1/3\cdot1/2=1/6$, together you gave $1/3$.
But if you chose incorrect there is $100\%$ that the host will open a particular door: $\#1$ your choice and host open $\#2$ to be $1/3\cdot1=1/3$ and and host open $\#3$ to be $1/3\cdot1=1/3$, together it is $=2/3$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Debugging Deep Q-Learning CNN I'm quite new to TF. I have written a Deep Q-Learning CNN to control a simple driving simulator. I've managed to plot the weights, biases and outputs of my fully connected layers on TensorBoard however, I'm not sure what I'm looking for. I've watched a youtube video that mentions a normally distributed set of weights is good. I was wondering if anyone has any other debugging tips.
Also, I'm using Relu for my activation functions but many of my 'rewards' and hence my 'qualities' output by the CNN are negative should I be using something like a Sigmoid instead? I'll grab some screenshots of my TensorBoard and post them too.
The Sim
What does it all mean Basil?


text:
Q: mysql and php function not displaying % percentage sign correctly I am using codeigniter to build a web application.
This app has a autoconfiguration Network interface for Multicast, which generates the non valid IP multicast based on card information. In the app.txt conf file I input the following data
auto_ip4=239.106.%card.%number

it scans the card number and on the log outputs the IP multicast like this example 239.105.2.1 and this works correctly, but on the frontend webgui things go wrong.
We have a function that saves the input data and stores it on a mysql db; the mysql table records 3 values   ID, NAME, VALUE
The value function is where the data gets store 239.105.%card.%number
When i press save the recorded looks like this: 239.105.?rd.%number and when i export it the text configuration file looks like this
auto_ip4=239.106.?rd.%number

This is the PHP form code that saves data value into the mysql database
<?=form_open('config/edit/'.$config->id.'/valid')?>

        Config param
        <?=$config->name?>
        <input type="text" name="value" value="<?=$config->value?>" />

        <input type="submit" value="Save"/>

<?=form_close()?>

Aparently this only happens on the first % sign, the second one gets stored correctly.

A: Seeing that 239.105.%card.%number becomes 239.105.?rd.%number, and that you specified in the comments that you get the text correctly using 239.106.%cord.%number
There's no doubt that the problem occurs because you mess up somewhere with the urldecode() function.
Check this https://www.w3schools.com/tags/ref_urlencode.asp
% act as the beginning of a char to encode in url encoding.
%CA is decoded to Ê
Your string 239.105.%card.%number has in fact become 239.106.Êrd.%number
You see a ? either because your output app can't display Ê, or because the character-set of your database/table doesn't manage that specific special character. If you were for instance on utf-8, utf-16 or any latin-based charset, on both sides, you would see the Ê
All the rest shown in your examples that works :

*

*%nu in %number

*%co in %cord

are not valid url encoding characters, thus they are stored as plain text and/or not decoded. It is the reason for this weird behavior.
It's hard to tell you exactly how to fix the problem without seeing your code.

A: this is some sort of charset..   my charset on codeigniter app is set to UTF-8
config.php
PHP Code:
$config['charset'] = 'UTF-8';
database.php
PHP Code:
$db['default']['char_set'] = "iso-8859-1"; // or latin1
$db['default']['dbcollat'] = "latin1_general_ci"; // or latin1_swedish_ci
and on my db mysql i have tried setting the same but something is still giving me issues..  because the data input  %card   it gets stored on the db as ?rd,  interesting this just happens on the write function of the copied data to the mysql DB, if i login via phpmyadmin to the database and input the data correctly on the value  %card,  then i refresh the config page php that i use to input the data to read data back from the database, the data displays correctly as %card, but when i try to write back to the db it encodes it wrong and saves it on the db as ?rd

A: <?php
/**

 */

class Config_model extends Model {
    var $id;
    var $name;
    var $value;

    public function __construct() {
        parent::Model();
    }

    public function findAll() {
        $query = $this->db->get('config');
        return $query->result();
    }

    public function find($id) {
        $query = $this->db->get_where('config', array('id' => $id));
        return $query->row();
    }

    public function findOneByName($name) {
        $query = $this->db->get_where('config', array('name' => $name));
        return $query->row();
    }

    public function countAll() {
        $query = $this->db->get('config');
        return $query->num_rows();
    }

    public function add($data) {
        $this->db->insert('config', $data);
        return $this->db->insert_id();
    }

    public function delete($id) {
        if ($this->db->delete('config', array('id' => $id))) return true;
    }

    public function update($id, $data) {
        $this->db->where('id', $id);
        $this->db->update('config', $data);
    }
}


text:
Q: Raspberry Pi webcam server streaming via an IP? I developed one webcam server using my Raspberry Pi and Logitech webcam and Motion library. I'm able to view the stream by using Raspberry Pi's IP.
If I use an IP camera instead of a normal webcam, how can I access the stream. Any ideas?

A: I guess it depends on cameras. In the past, I have successfully done what OP asks by using cameras streaming H.264 over RTP, controlled by RTSP.
In order to do this, an RTP client is required in order to access the camera and get a hold of the stream. I have used live555. My first try was with openRTSP from CLI.


text:
Q: Brush and Zoom D3 Explain I'm following this guide: https://bl.ocks.org/mbostock/34f08d5e11952a80609169b7917d4172
Can you explain to me these two methods line by line? Thanks
function brushed() {
  if (d3.event.sourceEvent && d3.event.sourceEvent.type === "zoom") return; // ignore brush-by-zoom
  var s = d3.event.selection || x2.range();
  x.domain(s.map(x2.invert, x2));
  focus.select(".area").attr("d", area);
  focus.select(".axis--x").call(xAxis);
  svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
      .scale(width / (s[1] - s[0]))
      .translate(-s[0], 0));
}

function zoomed() {
  if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
  var t = d3.event.transform;
  x.domain(t.rescaleX(x2).domain());
  focus.select(".area").attr("d", area);
  focus.select(".axis--x").call(xAxis);
  context.select(".brush").call(brush.move, x.range().map(t.invertX, t));
}


text:
Q: Using breqn in unnumbered equation in LyX I finally found a way to use automatic line breaking in long math formulas in LyX from the last post in:
https://stackoverflow.com/questions/2904807/lyx-breaking-long-formula-lines
I soon realized (when I was making beamer class presentations) that my formula was numbered in the generated PDF. Is there a way to get rid of this numbering without ERT?

A: In the LaTeX preamble, after \usepackage{breqn} and the stuff from the answer I assume you were referring to (not the stuff in the comment), add
\renewcommand\[{\begin{equation*}}
\renewcommand\]{\end{equation*}}

A: I have provided a flexible solution of using breqn in LyX at: https://stackoverflow.com/a/28964812/4653863
You can use the starred version of the dmath environment, i.e., dmath* to surround an unnumbered equation which can be created by hitting Ctrl + Shift + M in LyX.


text:
Q: inner holes in segmentation polygons -coco dataset So to explain the problem
I have a dataset with the coco format
I want to reconstruct the binary mask from the segmentation information stored in the annotation json file
here is the
target mask
in here it is the reconstructed mask
As you can see the inside hole is messing in the reconstructed mask
the mask was reconstructed using the following code
from pycocotools import mask as maskUtils
def annToRLE( ann, height, width):
        """
        Convert annotation which can be polygons, uncompressed RLE to RLE.
        :return: binary mask (numpy 2D array)
        """
        segm = ann['segmentation']
        if isinstance(segm, list):
            # polygon -- a single object might consist of multiple parts
            # we merge all parts into one mask rle code
            rles = maskUtils.frPyObjects(segm, height, width)
            rle = maskUtils.merge(rles)
        elif isinstance(segm['counts'], list):
            # uncompressed RLE
            rle = maskUtils.frPyObjects(segm, height, width)
        else:
            # rle
            rle = ann['segmentation']
        return rle

def annToMask( ann, height, width):
    """
    Convert annotation which can be polygons, uncompressed RLE, or RLE to binary mask.
    :return: binary mask (numpy 2D array)
    """
    rle = annToRLE(ann, height, width)
    m = maskUtils.decode(rle)
    return m

is there a way to keep the inside hole?

A: Well the solution I found is to delete the line
rle = maskUtils.merge(rles)

change variable name
rles = maskUtils.frPyObjects(segm, height, width)

to
rle = maskUtils.frPyObjects(segm, height, width)

this is inside the function annToRLE
and after you call annToMask
m = annToMask(sets,width,hight)

we check if there is multiple masks, add the masks into one mask, overlays between masks will be expressed as value greater than 2, so we set these values to zero
if m.ndim >= 2:
                  reduced=np.add.reduce(m,axis=2)
                  m = np.where(reduced>=2,0,reduced)


text:
Q: Change non selected items color of UITabBar in iOS7 I'm using this code to change UITabBar color, its text color/font and the color of the selected item.
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:10.0f],
                                                        NSForegroundColorAttributeName : [UIColor blackColor]
                                                        } forState:UIControlStateSelected];

    [[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Light" size:10.0f],
                                                        NSForegroundColorAttributeName : [UIColor whiteColor]
                                                        } forState:UIControlStateNormal];

    //change tabbarcolor
    [[UITabBar appearance] setBarTintColor:[UIColor redColor]];

    //to change the tabbar elements color
    [[UITabBar appearance] setTintColor:[UIColor greenColor]];

My problem is I want to change the color of the NON SELECTED UITabBarItems, that are in grey color per default. How can I do that ?
Thank you.

A: Found the solution (that it's a bit longer) from this:
UITabBarController *tabBarController = (UITabBarController *)[[self window] rootViewController];

UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];

tabBarItem1.title = @"Home";
tabBarItem2.title = @"Map";
tabBarItem3.title = @"Weather";
tabBarItem4.title = @"Info";

if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7) {
    [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"cyexplore_home_white.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"cyexplore_home_black.png"]];
    [tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"cyexplore_cloud_white.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"cyexplore_cloud_black.png"]];
    [tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:@"cyexplore_map_white.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"cyexplore_map_black.png"]];
    [tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"cyexplore_info_white.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"cyexplore_info_black.png"]];
} else {
    tabBarItem1.selectedImage = [[UIImage imageNamed:@"cyexplore_home_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem1.image = [[UIImage imageNamed:@"cyexplore_home_black"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem2.selectedImage = [[UIImage imageNamed:@"cyexplore_cloud_white"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem2.image = [[UIImage imageNamed:@"cyexplore_cloud_black"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem3.selectedImage = [[UIImage imageNamed:@"cyexplore_map_white"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem3.image = [[UIImage imageNamed:@"cyexplore_map_black"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem4.selectedImage = [[UIImage imageNamed:@"cyexplore_info_white"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem4.image = [[UIImage imageNamed:@"cyexplore_info_black"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
}

UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selected.png"]];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor], UITextAttributeTextColor, nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil] forState:UIControlStateSelected];


text:
Q: Removing the white space & prettier css I've made my own static website from scratch using html5 and css(3) only.But I have got 2 issues.
The first one is the white space between the top's menu and header's image bottom.I've tried everything.
Maybe the only solution for that is float:left; but then the image goes into the navigation tag or negative value on margin's property but I've heard that this technique is bad.
The second issue I'll display via image http://www.filedropper.com/discoversite that's my simple WebSite. I know my css is awful but I'm still a beginner. The second issue is here. http://postimg.org/image/5adp6379d/ . As you can see the text is going out of the box. (I am using % in css for more responsive). I will be glad if anyone can help me.

A: *

*I can only have a guess for your first issue as I don't know the exact code for your website (create jsfiddle :D ). Try to apply vertical-align: bottom; or display: block; to your header image. Why? Because images are placed like text and some letters like g, j, q and p are going underneath the bottom level. Your browser will leave a tiny space for these letters. Also setting a min-width is a good solution like Kirk Logan said.

*And for your second problem there are multiple solutions (depending on what you want):

*

*You can handle your content with overflow: hidden; or overflow: scroll as Kirk Logan suggested. But this wouldn't make any sense in the case you have shown us in the picture.

*Or (is a little more complex) you could remove the white borders on the left and right side (just when the screen is too small) in order to gain more space for the text. This can be done by:
@media only screen and (max-width: 768px) {
    #BigBorder1 { border-width: 0px; }
    #BigBorder2 { border-width: 0px; }
}

Everthing inside the outer brackets will only be applied when the screen's width is smaller than 768px. But to be honest this is usually done the other way round: When the screen is bigger than 768px then something happens. This simplification is only in order to make it easier for you.


text:
Q: C++11 When To Use A Memory Fence? I'm writing some threaded C++11 code, and I'm not totally sure on when I need to use a memory fence or something. So here is basically what I'm doing:
class Worker
{
   std::string arg1;
   int arg2;
   int arg3;
   std::thread thread;

public:
   Worker( std::string arg1, int arg2, int arg3 )
   {
      this->arg1 = arg1;
      this->arg2 = arg2;
      this->arg3 = arg3;
   }

   void DoWork()
   {
      this->thread = std::thread( &Worker::Work, this );
   }

private:
   Work()
   {
      // Do stuff with args
   }
}

int main()
{
   Worker worker( "some data", 1, 2 );
   worker.DoWork();

   // Wait for it to finish
   return 0;
}

I was wondering, what steps do I need to take to make sure that the args are safe to access in the Work() function which runs on another thread. Is it enough that it's written in the constructor, and then the thread is created in a separate function? Or do I need a memory fence, and how do I make a memory fence to make sure all 3 args are written by the main thread, and then read by the Worker thread?
Thanks for any help!

A: The C++11 standard section 30.3.1.2 thread constructors [thread.thread.constr] p5 describes the constructor template <class F, class... Args> explicit thread(F&& f, Args&&... args):

Synchronization: the completion of the invocation of the constructor synchronizes with the beginning of the invocation of the copy of f.

So everything in the current thread happens before the thread function is called. You don't need to do anything special to ensure that the assignments to the Worker members are complete and will be visible to the new thread.
In general, you should never have to use a memory fence when writing multithreaded C++11: synchronization is built into mutexes/atomics and they handle any necessary fences for you. (Caveat: you are on your own if you use relaxed atomics.)


text:
Q: Mule 4 : For Each : org.mule.runtime.api.metadata.TypedValue cannot be cast to java.util.Map enter image description hereScenario:

*

*Received a list of records of from database

*Transformed the list of records using Transform Message for Salesforce Mapping and data type : application/java

*After the transformation is complete, using a for each block to upsert these transformed records into batches of size 1000.

Problem Statement : As soon as the payload is passed to for each block, the data type of the payload converts to TypedValues and we get the below error when we pass the payload to Salesforce Upsert component:

org.mule.runtime.core.internal.message.ErrorBuilder$ErrorImplementation
{
  description=org.mule.runtime.api.metadata.TypedValue cannot be cast to java.util.Map
  detailedDescription=org.mule.runtime.api.metadata.TypedValue cannot be cast to java.util.Map
  errorType=MULE:UNKNOWN
  cause=java.lang.ClassCastException
  errorMessage=-
  childErrors=[]
}

Below attached is a mule 4 sample project that will take the a input csv file and filter it to find adults and then print the adults name using a for each scope in a batch of 5 people each.
Using a debugger the payload media type can be checked before and inside for each block.
Now inside for each I have used a Logger so the typedValue is not creating an issue, but if we used Salesforce component we would get an error as mentioned above. Since I do not have a SF account, I am unable to create the exact scenario. Sorry for the inconvenience but this will prove the conversion of media type inside for each.
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
    xmlns:file="http://www.mulesoft.org/schema/mule/file"
    xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
    <file:config name="File_Config" doc:name="File Config" doc:id="780eb98e-37d0-48ae-8f6b-47b8782284c9" >
        <file:connection workingDir="${app.home}" />
    </file:config>
    <flow name="bbazaz-json2csv-generatorFlow" doc:id="eebb7bcb-04ba-4c2a-bc7a-924d844c6aa2" >
        <scheduler doc:name="Scheduler" doc:id="f05eafdb-3cf0-43e2-9797-bedb9c4bb04a" >
            <scheduling-strategy >
                <fixed-frequency frequency="1" timeUnit="DAYS"/>
            </scheduling-strategy>
        </scheduler>
        <file:read doc:name="Read" doc:id="b1e9b51e-ab43-4965-ac0a-10c86c72b425" config-ref="File_Config" path="TestFile/InputData.csv" outputMimeType="application/csv; header=true" outputEncoding="UTF-8"/>
        <logger level="INFO" doc:name="Log Data" doc:id="74f972dc-9025-4eb7-916f-9c8dcaef4c7e" message='#["JSON Data Received"]'/>
        <ee:transform doc:name="Filter Adults and Minors" doc:id="6dfbe838-f508-4904-a651-8285b478faa7" >
            <ee:message >
                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
payload reduce((item, acc = {
    'adultsList': [],
    'minorsList': []
}) -> (
    if ( (item.PersonsAge as Number) >= 18 ) {
    adultsList: (acc.adultsList default []) << {
        'Name': item.PersonName
    },
    minorsList: acc.minorsList default []
}
    else{
    minorsList: (acc.minorsList default []) << {
        'Name': item.PersonName
    },
    adultsList: acc.adultsList default []
}))]]></ee:set-payload>
            </ee:message>
        </ee:transform>
        <foreach doc:name="For Each" doc:id="ce464082-620c-41ee-8150-45264c5cb57a" collection="#[payload.adultsList]" batchSize="5">
            <logger level="INFO" doc:name="Logger" doc:id="d0953955-6c4c-4374-aed4-ee0155d8e5d5" message='#[(payload.Name joinBy(",")) ++ "is an adult"]'/>
        </foreach>
    </flow>
</mule>

Sample CSV File :
PersonName,PersonsAge
Jonas,36
Ulysses,36
Lane,31
Tate,30
Rogan,36
Bruno,37
Colt,25
Colby,34
Grady,24
Hyatt,39
Victor,20
Cade,16
Brady,34
Ulric,33
Xavier,40
Cameron,36


text:
Q: Is there a representer theorem for unsupervised learning (to justify kernel density estimation)? In supervised learning, we get a representer theorem by considering regularized losses of the following form:

In Kernel Density Estimation, we simply directly assume densities of the form

Could this be justified by for example regularized maximum likelihood? In other words, is there a representer theorem for unsupervised learning?


text:
Q: Error after migration omnifaces 3.7.1 to 3.8.1 validateBean with UIComponent I'm recently migrate my jsf webapp to omnifaces 3.8.1 and i'm getting an error on validateBean.
This seams to be caused by UIComponent property in bean.
11:10:18,385 ERROR [io.undertow.request] (default task-9) UT005023: Exception handling request to /myexample-hr/faces/create.xhtml: javax.servlet.ServletException: java.lang.reflect.InvocationTargetException
        at javax.faces.api@3.0.0.SP04//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:725)
        at javax.faces.api@3.0.0.SP04//javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
        at io.opentracing.contrib.opentracing-jaxrs2//io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//com.umanxpert.myexample.hrweb.filter.TwoFactorAuthenticationFilter.doFilter(TwoFactorAuthenticationFilter.java:35)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//com.umanxpert.myexample.hrweb.filter.JSecurityCheckFilter.doFilter(JSecurityCheckFilter.java:29)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//com.umanxpert.myexample.hrweb.base.MultiTenancyFilter.doFilter(MultiTenancyFilter.java:32)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.core@2.2.2.Final//io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
        at io.undertow.core@2.2.2.Final//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
        at io.undertow.core@2.2.2.Final//io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.core@2.2.2.Final//io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at io.undertow.core@2.2.2.Final//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
        at io.undertow.core@2.2.2.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
        at org.wildfly.extension.undertow@21.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
        at io.undertow.servlet@2.2.2.Final//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
        at io.undertow.core@2.2.2.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
        at io.undertow.core@2.2.2.Final//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:841)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at org.jboss.xnio@3.8.2.Final//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.getBeanProperty(Reflection.java:377)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromList(Reflection.java:486)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:471)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromMap(Reflection.java:496)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:474)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPath(Reflection.java:517)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPathsFromBean(Reflection.java:509)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.collectBasePropertyPaths(Reflection.java:480)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.getBaseBeanPropertyPaths(Reflection.java:462)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.taghandler.ValidateBean.validateCopiedBean(ValidateBean.java:404)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.taghandler.ValidateBean.processValidateBean(ValidateBean.java:378)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.taghandler.ValidateBean.lambda$apply$0(ValidateBean.java:339)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Events.lambda$wrap$1(Events.java:332)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Events$4.afterPhase(Events.java:368)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.eventlistener.CallbackPhaseListener.afterPhase(CallbackPhaseListener.java:68)
        at com.sun.jsf-impl@2.3.14.SP01//com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:164)
        at com.sun.jsf-impl@2.3.14.SP01//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:82)
        at com.sun.jsf-impl@2.3.14.SP01//com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
        at com.sun.jsf-impl@2.3.14.SP01//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
        at javax.faces.api@3.0.0.SP04//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:707)
        ... 63 more
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at deployment.myexample-application-0.0.1-SNAPSHOT.ear.myexample-hr-web.war//org.omnifaces.util.Reflection.getBeanProperty(Reflection.java:374)
        ... 107 more
Caused by: java.lang.IllegalStateException: Attempting to use a Behavior feature with a component that does not support any event types. Component must implement BehaviourHolder interface.
        at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponentBase.assertClientBehaviorHolder(UIComponentBase.java:1727)
        at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponentBase.getDefaultEventName(UIComponentBase.java:1712)
        ... 112 more

Should UIComponent be excluded from the property types needed for recursion?
Is there any workaround to keep my UIComponent property and validateBean?


text:
Q: Where is the first place I can call a service in angular ui-router? I have an Angular app and I am using ui-router.
I need to call my service at the beginning of my App before anything else runs.
Is there a way I can call a service inside of my app.js file without using app.run? Or is there a better solution other than in my app.js file?

A: Take a look at the resolve functionality of ui-router https://github.com/angular-ui/ui-router/wiki/Quick-Reference. You just add another field to your state called 'resolve' and then can inject the service there. By using a resolve, this route will not execute until this resolve is completed.
I have something similar in an application where I created an abstract state for others to inherit and therefore, none of the states are registered until that initial resolve function is completed.
Ex.
$stateProvider.state('someState', {
    template: 'someTemplate.html',
    controller: 'someController',
    resolve: {
        authenticate: function(AuthSrv){
            //Do stuff with AuthSrv in here
        }
    }
})


text:
Q: Will a sound card help the quality of audio recordings? Some people also seem to use external devices too for podcasting and the like. What are they for? Just some kind of equalizer?

A: TL;DR: If you're serious about broadcasting, yes, they will help!

Here's the main problem: The sound "cards" included in motherboards of typical PCs or laptops are of rather bad quality. Here are some drawbacks:

*

*They might lack shielding, thus picking up interferences from the surrounding hardware

*You can't connect a professional microphone to them. Simple computer microphones are not professional. In no way they are.

*They might introduce latency when recording (sometimes, even 20ms is a lot). When you want to "overdub" (i.e. record over) your own recordings, this is frustrating.

With external audio interfaces (that's the common term), you overcome all that:

*

*They are shielded and away from the computer, sometimes with a separate power adapter.

*You can connect professional, high quality microphones to them, using XLR.

*Even a microphone for $80 like the classic Shure SM58 will get you a dramatic improvement in sound quality.

*There's virtually no latency involved in recording at all.

External audio interfaces are mostly connected through Firewire (IEEE 1394) or USB 2.0. They come in price ranges from around $100 up to thousands of dollars, due to differences in the quality of the microphone preamplifiers, the number of inputs, routing capabilities, etc. For simple podcasting, a simple audio interface will also do.
Here's an example of a very basic external audio interface:

You can see that there are two microphone XLR connectors, as well as a headphone connector. The knobs allow you to change the microphone gain as well as the headphone volume.
Some manufacturers offer audio interfaces bundled with microphones, which seems like a good deal for podcasting.


text:
Q: SQLServer An invalid tabular data stream (TDS) collation was encountered I have got an application that inserts records to a database. This is done using a multi-threaded environment that uses database pools to retrieve the connection and then insert the records in parallel. Had not encountered such an error before when I tested my operation with a different database. When this was re-run, the error did not appear and the issue seems to be sporadic.
We are using Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64) Oct 20 2015 15:36:27 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3  (Build 9600: ) (Hypervisor) The jdbc driver is version 4.2(sqljdbc_4.2.6420)
My question is what should be the course of action when such an error occurred?
Should I still retry using the existing connection as the data does not seem to have caused the issue?
P.S. I am using Retry pattern for retrying upon connection reset.
java.util.concurrent.ExecutionException: com.microsoft.sqlserver.jdbc.SQLServerException: An invalid tabular data stream (TDS) collation was encountered.
        at com.github.rholder.retry.Retryer$ExceptionAttempt.<init>(Retryer.java:254)
        at com.github.rholder.retry.Retryer.call(Retryer.java:163)
        // My application code
        at db.dao.DBUtil.batch(DBUtil.java:208)
        at db.dao.DBWriter.merge(DBWriter.java:183)
        at salesforce.BulkDownloader.call(BulkDownloader.java:173)
        at salesforce.BulkDownloader.call(BulkDownloader.java:42)
        // My application code end
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: An invalid tabular data stream (TDS) collation was encountered.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(SQLServerPreparedStatement.java:1426)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(SQLServerPreparedStatement.java:1336)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:1227)
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345)
        at common.RetryCallables$DatabaseBatch.call(RetryCallables.java:295)
        at common.RetryCallables$DatabaseBatch.call(RetryCallables.java:258)
        at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
        at com.github.rholder.retry.Retryer.call(Retryer.java:160)
        ... 10 common frames omitted


text:
Q: Inserting large quantities in IndexedDB's objectstore blocks UI I want to save some ~35000 objects in my IndexedDB's objectstore. I am using below code to insert.
AddListings = function (x2j_list_new, callback) {
    var transaction = db.transaction(["listings"], IDBTransaction.READ_WRITE);
    var count = 0;
    transaction.oncomplete = function (event) {
        if (callback) {
            console.log('x2jShowListing Added ' + count + '/' + x2j_list_new.length);
                callback([count, x2j_list_new.length]);
            }
    };
    transaction.onerror = function (e) {
       console.log("myError: ", e);
       if (callback) {
          callback(false);
       }
    };
    var store = transaction.objectStore("listings");

    $.each(x2j_list_new, function (index0, item0) {
        var request = store.put(item0);
        request.onsuccess = function (event) {
            count++;
            // event.target.result
            };
        });
    });
};

The above code works fine, but looping and inserting over ~35000 objects makes the UI unresponsive for ~200 seconds. I thought maybe i can use WebWorkers, but IndexedDB is not available inside WebWorkers. I tried to find a way to bulk insert, couldn't find one. Any ideas of how to insert large quantities of objects without blocking the UI?

A: You're on the right track, but you're asking the browser to store 35,000 objects before it's had a chance to finish storing one.  Here's code which asynchronously waits for one request to finish before starting the next (but using the same transaction):
    openRequest = window.indexedDB.open("MyDatabase", 1);
    openRequest.onerror = function(event) {
        console.error(event);
    };
    openRequest.onsuccess = function (event) {
        var db = openRequest.result;
        db.onerror = function(event) {
            // Generic error handler for all errors targeted at this database's requests
            console.error(event.target);
            window.alert("Database error: " + event.target.wePutrrorMessage || event.target.error.name || event.target.error || event.target.errorCode);
        };
        var transaction = db.transaction('item', "readwrite");
        var itemStore = transaction.objectStore("item");
        putNext();

        function putNext() {
            if (i<items.length) {
                itemStore.put(items[i]).onsuccess = putNext;
                ++i;
            } else {   // complete
                console.log('populate complete');
                callback();
            }
        }
    };

A: You're doing everything right by using callbacks.
The Webworker API has not yet been implemented by any major browser. Interestingly, it is expected to be synchronous. The regular API is async for the exact reason you describe -- it's not supposed to block the UI thread.
Using callbacks is the way to avoid lock ups, but at 35k objects you're clearly seeing this paradigm break down. Unfortunately, IDB performance is not yet on par with WebSQL from the benchmarks I've seen.
With Chrome's LevelDB there's been some new experimental backends (FF is SQLite ) but I think your experience proves that there's some room for improvement.

A: Wild guess from my side, but if WebSQL is available from what is known as a "background page", and assuming the bandwidth of messaging between the front- and backpage does not lock up the UI in the same way, maybe a background page with intra page message could be utilized?

A: I am splitting the array in chunks of 500 and using setTimeout instead of for loop. Now the UI responds little better than before


text:
Q: JS Fetch API access return value This is how I access the result from a fetch call:
let data;

fetch(someUri)
    .then((response) => response.json())
    .then(_data => {
        data = _data;
    })
    .catch(error => {
        console.error(error);
    });

Is it also possible to access the result from the fetch function itself, like this:
let data = fetch(someUri)
    .then((response) => response.json())
    .then(data => {
        // do some stuff
        return data;
    })
    .catch(error => {
        return error;
    });

So data will be either the JSON data or the error. I see in my Chrome console that the result is in the variable, but I don't know how to access it because it's wrapped with other information.

A: Here are some good resources for fetch and an example.
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
https://developer.mozilla.org/en-US/docs/Web/API/Body/text
https://developer.mozilla.org/en-US/docs/Web/API/Body/json
You may also want to get familiar with promises.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

    function doSomethingWithText(text) {
        console.log('The text is:', text);
    }

    fetch('someUrl.html')
      .then(data => data.text())
      .then(doSomethingWithText)
      .catch(error => new Error(error));

A: You can wrap it inside an immediately invoked async function and use await:
https://jsfiddle.net/ibowankenobi/ok72rfp6/
!async function(){
let data = await fetch("https://raw.githubusercontent.com/IbrahimTanyalcin/LEXICON/master/lexiconLogo.png")
    .then((response) => response.blob())
    .then(data => {
        return data;
    })
    .catch(error => {
        console.error(error);
    });

console.log(data);
}();

A: fetch method returns a promise that resolves to a Response object.
Once you get the response, it is up to you what to do with it. You can use methods on response body like json, text or blob to get data into desired format to work with.


text:
Q: SQLite query for matching one column with multiple values I am developing android app using RoomDB.
In a table there is a column called category
Assuming the category has the values from A,B,C....Z
So i have 24 category
For filtering category A, My query will be where category=:A (ONE FILTER)
for filtering A and B , Then it will be where category=:A or category=:B(TWO FILTER)
My filtering column can be random it may be one,two or three and so on...
Is there any query to filter these type of case.
I tried REGEXP but roomDB not accepting that
Waiting for good solution
Thanks in advance!

A: You can use in clause like this
select * from emp where dept in ('IT','HR','FIN');

If you have a pattern to search you can use like clause
select * from emp where name like ('%I%');

This will give you all employees having I in their name.


text:
Q: javascript unexpected identifier after string has been escaped? I'm trying to pass this escaped string to a function but keep getting an unexpected string error, with a similar string I'm getting an unexpected identifier error also. Does anyone know why this might be?
Video

A: I'm not certain, but I think %XX escapes are parsed into their original characters before JavaScript gets a hold of the string to execute.
Consider something like this instead:


text:
Q: cant read field in xml section Using python I got to the correct iteration of the XML (forecast) section, but one child field I cant seem to be able to read
here is the section from the XML
<forecast>
<fcst_time_from>2022-05-04T16:00:00Z</fcst_time_from>
<fcst_time_to>2022-05-04T20:00:00Z</fcst_time_to>
<change_indicator>FM</change_indicator>
<wind_dir_degrees>110</wind_dir_degrees>
<wind_speed_kt>6</wind_speed_kt>
<visibility_statute_mi>6.21</visibility_statute_mi>
<sky_condition sky_cover="SCT" cloud_base_ft_agl="4500"/>
<sky_condition sky_cover="SCT" cloud_base_ft_agl="25000"/>
</forecast>

I can get every field except <sky_condition sky_cover="SCT" cloud_base_ft_agl="25000"/>
here is the code where I pull the fields
if startTime_new <= Cur_Date_UTC <= EndTime_new:
                #Cil2 = (l.find('sky_cover')).text
                wDir = (l.find('wind_dir_degrees')).text
                wSpd = (l.find('wind_speed_kt')).text
                vis = (l.find('visibility_statute_mi')).text
                Cil = (l.find('sky_condition')).text
                print(wDir)
                print(wSpd)
                print(vis)
                print(Cil)
                print(l)

The answer given did work in a comand window but I am using beautifulsoup to get the XML . I tried to import from datetime import datetime
however Cil = [x.get('sky_cover') for x in elt.findall('sky_condition')] did not work
here is my full code
from bs4 import BeautifulSoup as bs
import requests
import pytz
from datetime import datetime

#pirip=False

def SetDateTimes():
    utc_time = datetime.now(pytz.utc)
    Cur_Date_UTC = utc_time.strftime("%d/%m/%y %H:%M:%S")
    return Cur_Date_UTC

def FixDateTime(workingTime):
    workingTime = workingTime.replace('T', ' ')
    workingTime = workingTime.replace('Z', '')
    format = "%Y-%m-%d %H:%M:%S"
    dt_object = datetime.strptime(workingTime, format)
    day_st = dt_object.strftime("%d")
    month_st = dt_object.strftime("%m")
    year_st = dt_object.strftime("%y")
    time_st = dt_object.strftime("%H:%M:%S")
    workingTime = day_st + '/' + month_st + '/' + year_st + ' ' + time_st
    return workingTime

def GetTAF3():
    USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36"
    url = 'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&hoursBeforeNow=3&timeType=issue&mostRecent=true&stationString=KEWR'
    session = requests.Session()
    session.headers['User-Agent'] = USER_AGENT
    html = session.get(url)
    soup = bs(html.text, 'html.parser')
    taf = soup.find_all("forecast")
    for l in soup.findAll('forecast'):
            startTime = l.find('fcst_time_from').text
            EndTime = (l.find('fcst_time_to')).text

            #print(startTime)
            startTime_new = FixDateTime(startTime)
            #print(startTime_new)

            #print(EndTime)
            EndTime_new = FixDateTime(EndTime)
            #print(EndTime_new)
            #break

            if startTime_new <= Cur_Date_UTC <= EndTime_new:
                #Cil2 = (l.find('sky_cover')).text

                print(l)

                wDir = (l.find('wind_dir_degrees')).text
                wSpd = (l.find('wind_speed_kt')).text
                vis = (l.find('visibility_statute_mi')).text
                Cil = (l.find('sky_condition'))

                print(wDir)
                print(wSpd)
                print(vis)
                print(Cil)
                print(l)

                if 'OVC' in Cil:
                    print("OVC Found")
                    pirip = True
                else:
                    print('No PIRIP')

                if float(vis) < 5:
                    print("pirip for vis")
                    pirip = True
                else:
                    print('No PIRIP')

Cur_Date_UTC = SetDateTimes()
GetTAF3()
#print(pirip)

A: You are asking for (l.find('sky_condition')).text, but the sky_condition tag has no text content. Take a close look at the source:
<sky_condition sky_cover="SCT" cloud_base_ft_agl="4500"/>
<sky_condition sky_cover="SCT" cloud_base_ft_agl="25000"/>

The values you want are attributes, not text nodes. Additionally, there are multiple sky_condition elements, so you'll need to handle multiple matches.
You could do something like this:
>>> Cil = [x.get('cloud_base_ft_agl') for x in l.findall('sky_condition')]
>>> Cil
['4500', '25000']

Edit: here's a complete, working example:
from xml.etree import ElementTree

data = """<forecast>
<fcst_time_from>2022-05-04T16:00:00Z</fcst_time_from>
<fcst_time_to>2022-05-04T20:00:00Z</fcst_time_to>
<change_indicator>FM</change_indicator>
<wind_dir_degrees>110</wind_dir_degrees>
<wind_speed_kt>6</wind_speed_kt>
<visibility_statute_mi>6.21</visibility_statute_mi>
<sky_condition sky_cover="SCT" cloud_base_ft_agl="4500"/>
<sky_condition sky_cover="SCT" cloud_base_ft_agl="25000"/>
</forecast>
"""

l = ElementTree.fromstring(data)

wDir = (l.find("wind_dir_degrees")).text
wSpd = (l.find("wind_speed_kt")).text
vis = (l.find("visibility_statute_mi")).text
Cil = [x.get("cloud_base_ft_agl") for x in l.findall("sky_condition")]

print(wDir)
print(wSpd)
print(vis)
print(Cil)
print(l)

Running the above code produces the following output:
110
6
6.21
['4500', '25000']
<Element 'forecast' at 0x7f8770c2fd80>


text:
Q: Capacitor that connects the base and the collector of BJT makes it hard to study multistage amplifier I'm studying ECE and at this point in microelectronics they've taught us that when performing DC analysis on low frequencies we must short circuit the capacitors of the circuit.
In the circuit below, I've been asked to find the value of \$R_B\$ so that the dc voltage at the collector of \$T_1\$ is equal to \$5V\$ (\$V_{C1}=5V\$) and then calculate the voltage gain \$\left(\frac{V_{out}}{V_{in}}\right)\$. The capacitor \$C_{BC}\$ makes everything difficult! I've short-circuited the capacitors and have calculated the following.

Assuming that for both \$T_1\$ and \$T_2\$ it is \$\beta=246\$, \$V_{BE}=0.78V\$ and they operate in the active region:
\$V_{B1}=V_{C1}=V_{B2}\$
To calculate \$I_{B1}\$:
\$V_{B1}=V_{BE}+I_{E1}\cdot 0.1k\Omega\Rightarrow\$
\$5V=0.78V+(\beta+1)\cdot I_{B1}\cdot 100\Omega\Rightarrow\$
\$I_{B1}=170.85\mu A\$
Thus, \$I_{C1}=\beta\cdot I_{B1}=42.0291mA\$
To calculate \$I_{B2}\$:
\$V_{B2}=V_{BE}+I_{E2}\cdot (R_{E21}+R_{E22})\Rightarrow\$
\$5V=0.78V+(\beta+1)\cdot I_{B2}\cdot (0.33+1.8)k\Omega\Rightarrow\$
\$I_{B2}=8.02136\mu A\$
Now, to calculate \$R_B\$:
\$V_{C1}=15V-(I_{B1}+I_{C1}+I_{B2})\cdot\left(220k\Omega+R_B+1.8k\Omega\right)\Rightarrow\$
\$5V=15V-(0.17085mA+42.0291mA+0.00802136mA)\cdot\left(220k\Omega+R_B+1.8k\Omega\right)\$
and I get \$R_B=-219.72716...k\Omega\$.
Note that \$R_B\$ is an ohmic resistor. I've found many similar examples/problems in textbooks but none of them had a capacitor like \$C_{BC}\$. Using the low-frequency hybrid-\$\pi\$ model of the BJT proves to be a bit difficult, once again because of \$C_{BC}\$.
I'm not quite sure what it is that I'm not doing right. Any sort of hint, help or even a reference to a similar example in some textbook is much appreciated!

A:
they've taught us that when performing \$\color{red}{\text{dc analysis}}\$ on low frequencies
we must short circuit the capacitors of the circuit.

That is incorrect.
When performing AC analysis it's usual to short capacitors. When performing DC analysis it's usual to open-circuit capacitors.

I've short-circuited the capacitors

That's incorrect for DC analysis; you need to open-circuit the capacitors. So, when you initially start your solution and say this: -
$$V_{B1}=V_{C1}$$
That is incorrect for DC analysis.

A: Rb is incorrect.
For Vc=5V and Vcc=15 with Rc=1.8k it will have a 10V drop thus Ic=10/1.8k= 5.56 mA and Ib=Ic/hFE=22.5 uA  yet hFE has a tolerance >>+/-50% at best if binned parts with special suffix.
Let Ie = Ic and Ve=IeRe=10VRe/Rc = 0.55V
Assumptions are incorrect for Vbe. Use Vbe=0.6 for 1mA and 0.65V for 5mA

*

*Thus now you get Rb= 614k minus the fixed 220k.

*For gain it is usually Rc/Re or slightly less for DC gain for hFE >>100 within 1%. This is attenuated by series rBE when shunt Re is small (<=100). You may compute that and result is around 17 gain instead of 18.

*

*but this will be reduced by the negative feedback of Ccb driving
both Rb and Cin for attenuation of the open loop gain. When
impedance of C matches Rb you have -3dB.  But there is also an attenuation of AC from Ccb to Cin attenuating the input with Rc as a source impedance, so the  voltage net at Vb has a low pass effect. The high pass effects are from CinRin and Cout to Rc&load as the current loop.

*the 2nd stage will have unity gain with no load as Rc/Re=1 but attenuated as expected with the load.


text:
Q: Проблема при отправки данных с формы Здравствуйте, уважаемые! У меня произошла следующая проблема при отправки данных с формы он переадр. на обработчик и выдает белый экран все бы ни чего но ошибки я в коде не нашел он должен переадр. на новость обратно но увы....
add.php
    <?
include('/include/connect.php');

if(isset($_POST['name'])) {
    $name = $_POST['name'];
}

if(isset($_POST['date'])) {
    $date = $_POST['date'];
}

$date = date("d-m-Y â H:i:s");

if(isset($_POST['text'])) {
    $text = $_POST['text'];
}

$text = addslashes($text);
$text = htmlspecialchars($text);
$text = stripslashes($text);
$text = mysql_real_escape_string($text);

if(isset($_GET['id'])) {
    $id = (int)$_GET['id'];
    $com_id = $id;
}

    $add_query = mysql_query("INSERT INTO comment (com_id,name,date,text)  values ('$com_id','$name','$date','$text')");

if($add_query == true) {
    echo "bad"; echo '';
}

else {
echo "bad query";
}

?>

форма
print ' <form  method="post" action="include/add_com.php">
        <input type="text" name="name" maxlength="10" placeholder="Name" reqired>
        <input type="date" name="date" reqired>

        <textarea type="text" name="text" maxlength="255" placeholder="text" required> </textarea>

        <input type="submit" value="button">
        </form>'

Помогите, пожалуйста. В чем ошибка?
A: А файлы у Вас в одной директории находятся?
Форма отправляется к include/add_com.php, а редирект идёт к otziv.php, который по идее находится в директории выше.
Попробуйте такой редирект сделать.
header( 'Location: otziv.php?id='$id );

И вопрос: а запись в БД добавляется? Если Да то внимательней присмотритесь к конструкции
if($add_query == true)


text:
Q: Compress Image cause Error in Android While clicking photo from smartphone, the image size is too large that it takes minute to upload so I want to reduce image size without affecting too much on its quality. So I got code from this website link. But while adding code in my existing code there are some compiler errors which are fixed.
Below errors are under compressImage(String imageUri) function

*

*scaleMatrix.setScale(ratioX, ratioY, middleX, middleY);
Error is:  cannot resolve mrthod 'setScale(float,float,float)'

*canvas.setMatrix(scaleMatrix);
Error is: setMatrix (android.graphics.Matrix) in Canvas cannot be applied to (android.opengl.Matrix)

*matrix.postRotate(90);

*matrix.postRotate(180);

*matrix.postRotate(270);
Error is: cannot resolve method 'postRotate(int)'
Code:
public class Camera extends AppCompatActivity implements View.OnClickListener {

    public static final String UPLOAD_URL = "http://website.com/ImageUpload/upload.php";
    public static final String UPLOAD_KEY = "image";
    public static final String UPLOAD_NAME = "name";
    public static final String UPLOAD_EMAIL = "email";
    public static final String UPLOAD_PHONE= "phone";
    public static final String TAG = "MY MESSAGE";
    boolean b=false,z;
    private int PICK_IMAGE_REQUEST = 1;
    String mock;
    private Button buttonChoose;
    String uploadImage;
    private Button buttonUpload,buttonView;
    private ImageView imageView;
    private Bitmap bitmap,bitmaps;
    private Uri filePath;
    String path;
    String[] max;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.camera);

        buttonChoose = (Button) findViewById(R.id.buttonChoose);
        buttonUpload = (Button) findViewById(R.id.buttonUpload);

      buttonView = (Button) findViewById(R.id.buttonViewImage);

        buttonUpload.setEnabled(false);

        imageView = (ImageView) findViewById(R.id.imageView);
        buttonChoose.setOnClickListener(this);
        buttonUpload.setOnClickListener(this);
        buttonView.setOnClickListener(this);

       /* GetSet b= new GetSet();
        String maths=b.getCombine();
*/
    //    System.out.println("Matru "+maths);

        Bundle bundle = getIntent().getExtras();

        //Extract the data…
        String stuff = bundle.getString("combine_data");
        // String sss = bundle.getString("combine_data2");

        System.out.println("changa " + stuff);

        max=stuff.split("~");

        for(int i=0;i<max.length;i++)
            System.out.println("binku " + max[i]);

    }

    private void selectImage() {

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File f = new File(android.os.Environment.getExternalStorageDirectory(), "temp.jpg");
        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
        startActivityForResult(intent, 1);

    }

    private void showFileChooser() {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if(b) {
            if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {

                filePath = data.getData();
                try {
                    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
                    imageView.setImageBitmap(bitmap);
                    buttonUpload.setEnabled(true);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

        else {

            if (resultCode == RESULT_OK) {
                if (requestCode == 1) {
                    File f = new File(Environment.getExternalStorageDirectory().toString());
                    for (File temp : f.listFiles()) {
                        if (temp.getName().equals("temp.jpg")) {
                            f = temp;
                            break;
                        }
                    }
                    try {

                        BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();

                        bitmaps = BitmapFactory.decodeFile(f.getAbsolutePath(),
                                bitmapOptions);

                        imageView.setImageBitmap(bitmaps);
                        buttonUpload.setEnabled(true);
                          mock= getStringImage(bitmaps);

                        String path = android.os.Environment
                                .getExternalStorageDirectory()
                                + File.separator
                                + "Phoenix" + File.separator + "default";
                        f.delete();
                        OutputStream outFile = null;
                        File file = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
                        try {
                            outFile = new FileOutputStream(file);
                            bitmap.compress(Bitmap.CompressFormat.JPEG, 85, outFile);
                            outFile.flush();
                            outFile.close();
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        } catch (IOException e) {
                            e.printStackTrace();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }

        }
    }

    public String getStringImage(Bitmap bmp){
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
        byte[] imageBytes = baos.toByteArray();
        String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
        return encodedImage;
    }

    private void uploadImage(){
        class UploadImage extends AsyncTask<Bitmap,Void,String>{

            ProgressDialog loading;
            RequestHandler rh = new RequestHandler();

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                loading = ProgressDialog.show(Camera.this, "Uploading Image", "Please wait...",true,true);
            }

            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                loading.dismiss();
                Toast.makeText(getApplicationContext(),s,Toast.LENGTH_LONG).show();
                imageView.setImageDrawable(null);
                buttonUpload.setEnabled(false);
            }

            @Override
            protected String doInBackground(Bitmap... params) {
                Bitmap bitmap = params[0];
                if(z)
                uploadImage = getStringImage(bitmap);
                else
                    uploadImage = mock;

                String compress_image=compressImage(uploadImage);

                HashMap<String,String> data = new HashMap<>();
                data.put(UPLOAD_KEY, compress_image);
                data.put(UPLOAD_NAME,max[0]);
                data.put(UPLOAD_EMAIL,max[2]);
                data.put(UPLOAD_PHONE,max[1]);

                String result = rh.sendPostRequest(UPLOAD_URL,data);

                return result;

            }
        }

        UploadImage ui = new UploadImage();
        ui.execute(bitmap);
    }

    public String compressImage(String imageUri) {

        path = getRealPathFromURI(imageUri);
        Bitmap scaledBitmap = null;

        BitmapFactory.Options options = new BitmapFactory.Options();

//      by setting this field as true, the actual bitmap pixels are not loaded in the memory. Just the bounds are loaded. If
//      you try the use the bitmap here, you will get null.
        options.inJustDecodeBounds = true;
        Bitmap bmp = BitmapFactory.decodeFile(path, options);

        int actualHeight = options.outHeight;
        int actualWidth = options.outWidth;

//      max Height and width values of the compressed image is taken as 816x612

        float maxHeight = 816.0f;
        float maxWidth = 612.0f;
        float imgRatio = actualWidth / actualHeight;
        float maxRatio = maxWidth / maxHeight;

//      width and height values are set maintaining the aspect ratio of the image

        if (actualHeight > maxHeight || actualWidth > maxWidth) {
            if (imgRatio < maxRatio) {
                imgRatio = maxHeight / actualHeight;
                actualWidth = (int) (imgRatio * actualWidth);
                actualHeight = (int) maxHeight;
            } else if (imgRatio > maxRatio) {
                imgRatio = maxWidth / actualWidth;
                actualHeight = (int) (imgRatio * actualHeight);
                actualWidth = (int) maxWidth;
            } else {
                actualHeight = (int) maxHeight;
                actualWidth = (int) maxWidth;

            }
        }

//      setting inSampleSize value allows to load a scaled down version of the original image

        options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight);

//      inJustDecodeBounds set to false to load the actual bitmap
        options.inJustDecodeBounds = false;

//      this options allow android to claim the bitmap memory if it runs low on memory
        options.inPurgeable = true;
        options.inInputShareable = true;
        options.inTempStorage = new byte[16 * 1024];

        try {
//          load the bitmap from its path
            bmp = BitmapFactory.decodeFile(path, options);
        } catch (OutOfMemoryError exception) {
            exception.printStackTrace();

        }
        try {
            scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight,Bitmap.Config.ARGB_8888);
        } catch (OutOfMemoryError exception) {
            exception.printStackTrace();
        }

        float ratioX = actualWidth / (float) options.outWidth;
        float ratioY = actualHeight / (float) options.outHeight;
        float middleX = actualWidth / 2.0f;
        float middleY = actualHeight / 2.0f;

        Matrix scaleMatrix = new Matrix();
        scaleMatrix.setScale(ratioX, ratioY, middleX, middleY);

        Canvas canvas = new Canvas(scaledBitmap);
        canvas.setMatrix(scaleMatrix);
        canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG));

//      check the rotation of the image and display it properly
        ExifInterface exif;
        try {
            exif = new ExifInterface(path);

            int orientation = exif.getAttributeInt(
                    ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
            Log.d("EXIF", "Exif: " + orientation);
            Matrix matrix = new Matrix();
            if (orientation == 6) {
                matrix.postRotate(90);
                Log.d("EXIF", "Exif: " + orientation);
            } else if (orientation == 3) {
                matrix.postRotate(180);
                Log.d("EXIF", "Exif: " + orientation);
            } else if (orientation == 8) {
                matrix.postRotate(270);
                Log.d("EXIF", "Exif: " + orientation);
            }

            scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true);
        } catch (IOException e) {
            e.printStackTrace();
        }

        FileOutputStream out = null;
        String filename = getFilename();
        try {
            out = new FileOutputStream(filename);

//          write the compressed bitmap at the destination specified by filename.
            scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 80, out);

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        return filename;

    }

    private String getRealPathFromURI(String contentURI) {
        Uri contentUri = Uri.parse(contentURI);
        Cursor cursor = getContentResolver().query(contentUri, null, null, null, null);
        if (cursor == null) {
            return contentUri.getPath();
        } else {
            cursor.moveToFirst();
            int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
            return cursor.getString(index);
        }
    }

    public int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
        final int height = options.outHeight;
        final int width = options.outWidth;
        int inSampleSize = 1;

        if (height > reqHeight || width > reqWidth) {
            final int heightRatio = Math.round((float) height/ (float) reqHeight);
            final int widthRatio = Math.round((float) width / (float) reqWidth);
            inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;      }       final float totalPixels = width * height;       final float totalReqPixelsCap = reqWidth * reqHeight * 2;       while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) {
            inSampleSize++;
        }

        return inSampleSize;
    }

    public String getFilename() {
        File file = new File(Environment.getExternalStorageDirectory().getPath(), "MyFolder/Images");
        if (!file.exists()) {
            file.mkdirs();
        }
        String uriSting = (file.getAbsolutePath() + "/" + System.currentTimeMillis() + ".jpg");
        return uriSting;

    }

    @Override
    public void onClick(View v) {
        if (v == buttonChoose) {
            b=true;
            z=true;
            showFileChooser();

        }
        if(v == buttonUpload) {

                uploadImage();
        }

        if(v == buttonView){
            b=false;
            z=false;
            selectImage();

        }

    }
}

A: I think if you reduce the bitmap size then may be you can solve this-
public static Bitmap getBitmapFromByteArray(final byte data[], int maxSize) {
    final int MAX_SIZE = maxSize;
    if (data.length > 0) {
        try {
            final BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0,
                    data.length, options);
            final int fullWidth = options.outWidth;
            final int fullHeight = options.outHeight;
            int w = 0;
            int h = 0;
            if (fullWidth > fullHeight) {
                w = MAX_SIZE;
                h = w * fullHeight / fullWidth;
            } else {
                h = MAX_SIZE;
                w = h * fullWidth / fullHeight;
            }
            options.inJustDecodeBounds = false;
            options.inSampleSize = fullWidth / w;
            bitmap = BitmapFactory.decodeByteArray(data, 0, data.length,
                    options);
            return bitmap;
        } catch (final Exception e) {
        }
    }
    return null;
}

You will send the current bitmap ByteArray data with size which you want from this bitmap. Then it will return the bitmap by resize. You can try this.

A: It can be done by two ways i.e degrade quality of jpeg or resizing the image .
Resizing the image
Bitmap mBitmap = Bitmap.createScaledBitmap(bitmap, 480, 300, true);

Reduce quality of jpeg
bitmap.compress(Bitmap.CompressFormat.JPEG, 60, outFile);


text:
Q: change kerning of \texttt I tried to use a font different than courier for monospaced fonts but none of this list (http://www.ctan.org/topic/font-mono) are available on my system - and as we work in a distributed system custom local additions are not an option. (Build server, standards, etc.)
so question is

*

*is there a usullay available monospace font, that is more condensed, i.e. needs less horizontal space?

*how can i reduce the general kerning for all letters in \texttt or the whole font?

A: Here are two ways: 1) with microtype's \textls macro, and the other, \spaceout, without any packages. I have wrapped those macros into \textttA and \textttB invocation forms.
The \textls macro uses an optional argument to specify the compression or expansion, while \spaceout uses the values of \theLetterSpace and \extraWordSpace to modify the default spacings.
Both approaches support line wrapping.
Summarizing from the comments below, it is worth noting that the \textls approach supports hyphenation, whereas the \spaceout approach does not.  In addition, the argument to \spaceout cannot include a macro that itself takes an argument.
\documentclass{article}
\def\theLetterSpace{-0.5pt}
\def\extraWordSpace{-0.5pt}
\newcommand\spaceout[2][\theLetterSpace]{%
  \def\LocalLetterSpace{#1}\expandafter\spaceouthelpA#2 \relax\relax}
\def\spaceouthelpA#1 #2\relax{%
  \spaceouthelpB#1\relax\relax%
  \ifx\relax#2\else\kern\extraWordSpace\ \kern\LocalLetterSpace\spaceouthelpA#2\relax\fi
}
\def\spaceouthelpB#1#2\relax{%
  #1%
  \ifx\relax#2\else
    \kern\LocalLetterSpace\spaceouthelpB#2\relax%
  \fi
}
\parskip 1ex
\usepackage{microtype}
\def\textttA#1{\texttt{\textls*[-70]{#1}}}
\def\textttB#1{\texttt{\spaceout{#1}}}
\begin{document}
\def\mytext{a bit of texttt}
This is \texttt{\mytext}\par
This is \textttA{\mytext}\par
This is \textttB{\mytext}\par
\def\mytext{a bit of texttt. a bit of texttt. a bit of texttt. a bit of texttt.
a bit of texttt. a bit of texttt. a bit of texttt. a bit of texttt. }
\noindent\hrulefill\sloppy\par
This is \texttt{\mytext}\par
This is \textttA{\mytext}\par
This is \textttB{\mytext}
\end{document}


text:
Q: object window has no method resolveLocalFileSystemURL I want to use the org.apache.cordova.file plugin for my ionic android app.
In addition i use the ngcordova extensions (It gives you simple AngularJS wrappers for the most popular Cordova and PhoneGap plugins available, where you can take a picture, scan a barcode, upload a file, turn on your flashlight, get your current location, and much more with just a few lines of code.)
I install ngcordova as you can see in the docs, and the "Barcode Scanner Plugin" works perfekt, but if i want to use the "File Plugin", i get always the exception:

object window has no method resolveLocalFileSystemURL

the code snippets inside the ngcordova extension:
      try {
        $window.resolveLocalFileSystemURL(path, function (fileSystem) {
          fileSystem.getFile(file, {create: false}, function (fileEntry) {
            fileEntry.file(function (fileData) {
              var reader = new FileReader();

I have added the plugin via

cordova plugin add cordova-plugin-file

and also i have added

cordova plugin add cordova-plugin-file-transfer

A: Did you add the right plugin?

ionic plugin add org.apache.cordova.file

Also your controller needs to have $cordovaFile

app.controller('profileController', ['$scope', 'value', '$ionicPopup', '$cordovaCamera', '$cordovaFile', '$localstorage', function($scope, value, $ionicPopup, $cordovaCamera, $cordovaFile, $localstorage)


text:
Q: different coloured polygon overlays is it possible to create different coloured polygons on a map view using the following method?
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay{

say if i had 2 polygons could i set one to red and the other to yellow?

A: One way is to use the title property to tell one polygon from another.
When adding the polygons, set their title accordingly:
pone.title = @"one";
[mapView addOverlay:pone];

pother.title = @"other";
[mapView addOverlay:pother];

Then in viewForOverlay, you can set the color based on title:
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
{
    MKPolygonView *pv = [[[MKPolygonView alloc] initWithPolygon:overlay] autorelease];

    if ([overlay.title isEqualToString:@"one"])
        pv.fillColor = [UIColor redColor];
    else if ([overlay.title isEqualToString:@"other"])
        pv.fillColor = [UIColor yellowColor];
    else
        pv.fillColor = [UIColor blueColor];

    return pv;
}


text:
Q: Difficult Radical Equation I am stuck in the following radical equation
$$
(4x-1)\sqrt{x^3+1}=2x^3+2x+1.
$$
SOLUTION I have tried based on the guidance of the commenters and I think that the following solution is rather simpler.
$$
(4x-1)\sqrt{x^3+1}=2x^3+2x+1
$$
\begin{eqnarray*}
&\Leftrightarrow& 2(x^3+1)-\sqrt{x^3+1}-4x\sqrt{x^3+1}+2x+2\sqrt{x^3+1}-1=0\\
&\Leftrightarrow& \sqrt{x^3+1}(2\sqrt{x^3+1}-1)-2x(2\sqrt{x^3+1}-1)+2\sqrt{x^3+1}-1=0\\
&\Leftrightarrow&(2\sqrt{x^3+1}-1)(\sqrt{x^3+1}-2x+2)=0\\
&\Leftrightarrow&
2\sqrt{x^3+1}-1=0\quad\text{or}\quad
\sqrt{x^3+1}-2x+2=0\\
&\Leftrightarrow&
x=\sqrt[3]{-3/4}\quad\text{or}\quad
\begin{cases}
x\geq 1/2\\
x^3+1=4x^2-4x+1\\
\end{cases}\\
&\Leftrightarrow& x=\sqrt[3]{-3/4}\quad\text{or}\quad x=2.
\end{eqnarray*}

A: $$(4x-1)\sqrt{x^3+1}=2x^3+2x+1.$$
$$\left((4x-1)\sqrt{x^3+1}\right)^2=\left(2x^3+2x+1\right)^2$$
$$16x^5+16x^2-8x^4-8x+x^3+1=4x^6+8x^4+4x^3+4x^2+4x+1$$
$$4x^6-16x^5+16x^4+3x^3-12x^2+12x=0$$
$$x\left(x-2\right)^2\left(\sqrt[3]{4}x+\sqrt[3]{3}\right)\left(4^{\frac{2}{3}}x^2-\sqrt[3]{12}x+3^{\frac{2}{3}}\right)=0$$
$$\tag1 x-2=0 \implies x=2$$
$$\tag2\sqrt[3]{4}x+\sqrt[3]{3}=0 \implies  x=-\sqrt[3]{\frac{3}{4}}$$
$$\tag3 4^{\frac{2}{3}}x^2-\sqrt[3]{12}x+3^{\frac{2}{3}}=0 \implies \nexists x\in \mathbb{R}$$
Therefore

$$x_1=2,\quad  x_2=-\sqrt[3]{\frac{3}{4}}$$

A: after squaring and factorizing we obtain $$-x \left( 4\,{x}^{3}+3 \right)  \left( x-2 \right) ^{2}=0$$
Can you solve this equation?


text:
Q: Saving an xlsx file with formatted, merged, and locked cells with openpyxl I'm trying to use openpyxl to read in an extensively formatted xlsx file and create a copy with some of the fields populated with specific values. The original file has protection on it (most cells are locked down). Also, many cells are merged together, some horizontally and some vertically. Is there a known issue with saving out such locked/merged/formatted cells? I know that openpyxl does support cell protection, but I'm not clear what the limitations are. All the fields I'm trying to prepopulate are unlocked.
As a test, I loaded the workbook and did nothing more than save it out to the new file, as follows:
wb = load_workbook(src_file)
wb.save(out_file)

I still lost most of the formatting. It remains in some cells, but others lose all formatting. Additionally, all but one of the cells are incorrectly locked. I'm attaching images of the before and after.
before
after
I can get the right values into the right cells, but again there is inconsistency in the locked/unlocked state of the cells, on top of the formatting problems.
Does anyone have any insight into ways around this, or have I encountered a limitation of openpyxl?
UPDATE: It seems that the formatting problem is a known issue as stovfl mentions. I looked further at the sheet and the only cell that stayed correctly unlocked as in the input sheet is one that is a single, non-merged cell. So I am going to assume the locking problem is a direct result of the issue with merged cells.


text:
Q: Sql Query Select From an update, records, that were not updated I'm using Sql server 2012
Just curious if there is a way to do such a thing...
My update query looks like
UPDATE a
SET a.TowerNumber=b.SiteNumber
FROM tower a
INNER JOIN sites  b
ON a.sitenumber = b.sitenumber

what i would like to do after the ON line is something like
EDIT **select records that did not match the ON statement**

thanks in advance

A: This query returns all rows that wouldn't be touched by the update because the ON (join) criteria wasn't met.
SELECT *
  FROM tower
 WHERE sitenumber NOT IN
     (SELECT sitenumber
       FROM sites)

A: I think you can try to use an INSTEAD OF trigger and then make use of the DELETED table. It should contain the rows that were updated during the update operation so what you are looking after are the rest of the rows in the initial table (select rows from your table where  not in DELETED table)


text:
Q: localStorage clears while navigating to next page? I store values to the localStorage using ng-storage plugin in angular.js.
while navigating to the next page the localstorage get cleared.
in html of the navigated page i have set base hfer
the fact is that,the code works fine when am working on an ip
when it is moved to a domain name it fails
any solution ??


text:
Q: Automatic silent update for corporative app I have a private application for almost 20 customers.
We always need to update the application manually via team viewer.
I researched this, but I did not find a good solution or suggestion yet.
For example: https://groups.google.com/forum/#!topic/android-developers/DpGBZI9QrgQ
For example: https://blog.vivekpanyam.com/evolve-seamlessly-deploy-android-apps-to-users/
Do you  have any suggestions for an application to auto update itself.
Note: I know Google play store politic, I am not using Google Play Store.
Thanks for suggestions or solutions.

A: *

*You need to have a place at your server where versions can be downloaded from.

*You need to have a place, maybe a database where you store your version releases.

*Whenever you release a new version, you should store your new version at a place where it can be downloaded from and you need to make sure that you store somehow that you have a new version.

*You need an installer which will extract the newest version of your application and installs it instead of the old version. This should be automatically placed at users.

*Your application needs to check periodically by requesting the server whether there is a new version. If so, then the installer should be executed, which will download the new version, uninstall the old version and install the new version.