text:
Q: TinyButStrong created dynamic  with dynamic  and  looping issue I want to create the leave report of employee in calender table view as attached image.

i have fetched employee from controller and stored in and array.
same way i am fetching the dates(based on selected year and month) in controller and stored in an array.
based on this employee and date, i am fetching the leaves of each employee and stored in an array.
controller
    $month = 7;
    $year = 2015;
            for($d=1; $d<=31; $d++)//for dynamic dates as displayed in image
            {
                $time=mktime(12, 0, 0, $month, $d, $year);
                if (date('m', $time)==$month)
                $this->data['blk4'][]['date']=date('d', $time);
                $this->data['blk5'][]['day']=date('D', $time);
                $this->data['blk6'][]['fulldates']=date('Y-m-d',$time);
            }
            $data['employee'] = $this->teamprofile_model->allTeamMembers('team_profile_full_name', 'ASC');//fetching all amployee

            foreach($data['employee'] as $d)//for each employee checking the leave
            {
                foreach($this->data['blk6'] as $date)//for each date
                {
                    $this->db->where('employee_id',$d['team_profile_id']);
                    $this->db->where('leave_date',$date['dates']);
                    $Q=$this->db->get('leave_reports');
                    if($Q->num_rows() > 0)
                    {
                        foreach ($Q->result_array() as $row)
                        {
                            $data1[] = $row;
                        }
                    }
                    $this->data['blk8'][]['leave'] = $data1[0]['leave_time'];//stored leave of each employee in this array
                    $data1="";
                }
            }

HTML

                 Employee	//display employee

	 //display dates as displying in above image

                	//dynamic employee list
                here i want to display the leave stored in [blk8.leave]

but the problem is that the [blk8.leave] stored all employees leave of each dates so if i print it as [blk8.leave;block=td;comm] then it print all array value in one row. I want to break this array after month's end date that is 31.

output should be :

A: The problem is your Leave data is structured linearly while it need to be associated with a date.
TBS (TinyButStrong) as a built in feature for merging tables with dynamics columns (or other similar structure).
The example under is very similar to your problem, you can adapt it easily.
http://www.tinybutstrong.com/examples.php?e=dyncol1
But the structure of your data should be amended.
Here is an example of how the data could be:
        $blk7 = array();
        foreach($data['employee'] as $d)//for each employee checking the leave
        {
            $employee = array(
                'team_profile_id' => $d['team_profile_id'],
                'all_team_members' => $d['all_team_members'],
            );
            foreach($this->data['blk6'] as $date)//for each date
            {
                $this->db->where('employee_id',$d['team_profile_id']);
                $this->db->where('leave_date',$date['dates']);
                $Q=$this->db->get('leave_reports');
                if($Q->num_rows() > 0)
                {
                    foreach ($Q->result_array() as $row)
                    {
                        $data1[] = $row;
                    }
                }
                $column = 'leave_' . $date['dates'];
                $employee[$column] = $data1[0]['leave_time'];//stored leave of each employee in this array
                $data1="";
            }
            $blk7[] = $employee;
        }


text:
Q: Running a flask app with nginx and gunicorn I'm new at this and have only been using nginx to serve static files. I have now installed flask and gunicorn. If I run gunicorn -b 127.0.0.2:8000 hello:app and then wget it from the server it works well. If I try to access it from a browser, however, it returns a 404 error (I am running this on a server that hosts a wordpress site which is locatet at root).
The flask app:
from flask import Flask
from werkzeug.contrib.fixers import ProxyFix
app = Flask(__name__)

@app.route('/')
def hello():
    return "Hello world!"

app.wsgi_app = ProxyFix(app.wsgi_app)

if __name__ == '__main__':
    app.run()

And the relevant part of my nginx configuration:
location /flask {
                 proxy_set_header       Host            $http_host;
                 proxy_set_header       X-Real-IP       $remote_addr;
                 proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_\
for;
                 proxy_pass             http://127.0.0.2:8000;
                 proxy_redirect         off;
    }

I hope this is all the relevant info. If not, do tell. Thanks!

A: This is how I serve my flask apps in Nginx:
Run gunicorn daemonized using a socket:
  sudo gunicorn app:app --bind unix:/tmp/gunicorn_flask.sock -w 4 -D

Related nginx config:
    upstream flask_server {
        # swap the commented lines below to switch between socket and port
        server unix:/tmp/gunicorn_flask.sock fail_timeout=0;
        #server 127.0.0.1:5000 fail_timeout=0;
    }
    server {
        listen 80;
        server_name www.example.com;
        return 301 $scheme://example.com$request_uri;
    }

    server {
        listen 80;
        client_max_body_size 4G;
        server_name example.com;

        keepalive_timeout 5;

        # path for static files
        location  /static {
            alias /path/to/static;
            autoindex on;
            expires max;
        }

        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;

            if (!-f $request_filename) {
                proxy_pass http://flask_server;
                break;
            }
        }
    }

}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How did Rush know that he had gone back in time in SG-U S02E12? After the failed use of the stargate in the middle of the star, Rush gets in the shuttle and goes out to meet the Destiny approaching the star in the past.
How did he know that he was in the past and could go do that?

A: He didn't know that he was in the past, he was forced to abandon Destiny because the air became toxic. When the other Destiny dropped out of FTL was when he actually realized it.


text:
Q: JQuery does not execute on $(document).change() I need to make some JQuery execute when the page/document has changed - in this case, when a div with a specific CSS class is displayed.
I have the following JQuery code:
   <script>
           $(document).change(function () {
               if ($('.validation_errors').length) {
                   alert("test");
               }
           }
    </script>

However, it does not execute and display the alert. Am I missing something here?

A: Change is only for input, textarea or select elements. Instead you need to bind a function to the DOMSubtreeModified mutation event:
$(document).bind('DOMSubtreeModified', function () {
   if ($('.validation_errors').length) {
       alert("test");
   }
});

EDIT: If your target browsers support it, you should use a MutationObserver instead.

A: You can't monitor changes in the DOM is this manner. Quote from the jQuery docs:

The change event is sent to an element when its value changes. This
  event is limited to  elements,  boxes and
  elements. - http://api.jquery.com/change/

If you're looking to execute code when there is a DOM change, you may need to either set up and interval which checks the DOM or use this technique provided by a poster on the jQuery forums.
There is the DOMSubtreeModified event, but it is scarcely available in current browsers, so I personally wouldn't recommend its use. See this stackoverflow answer for further details on that

A: Your syntax is wrong too buddy! If you're going to do it, do it within document ready, .change is very limited and wont fire on a new page.
$(document).ready(function(){
    if($('.classOrId').length){
        //do something if it exists
    };
});


text:
Q: VisibleDeprecationWarning in python I am new to Python and have been trying to find out bag of words. I used vectorizer.fit_transform function as follows
vectorizer = CountVectorizer(vocabulary=set_of_words, tokenizer=nltk.word_tokenize)
bag_of_words = vectorizer.fit_transform(doc).toarray().astype(np.float64)

where doc contains the text whose bag of words is to be extracted.
and i get a warning as follows:/usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py:2499: hereVisibleDeprecationWarning:rankis deprecated; use thendimattribute or function instead. To find the rank of a matrix seenumpy.linalg.matrix_rank`.
  VisibleDeprecationWarning)
On displaying vectorizer I get something like this
CountVectorizer(analyzer=u'word', binary=False, charset=None,
    charset_error=None, decode_error=u'strict',
    dtype=<type 'numpy.int64'>, encoding=u'utf-8', input=u'content',
    lowercase=True, max_df=1.0, max_features=None, min_df=1,
    ngram_range=(1, 1), preprocessor=None, stop_words=None,
    strip_accents=None, token_pattern=u'(?u)\\b\\w\\w+\\b',
    tokenizer=<function word_tokenize at 0xafbc6f4>,
    vocabulary=[u'dissolution', u'comparatively', u'desirable', u'four', u'obstruction', u'nursery', u'perverted', u'appetite', u'repress', u'consider'])

A: From TessellatingHeckler's link I found out: "It's one of those scipy calling old numpy function things"
Running pip install --upgrade scipy resolved this issue for me.

A: Are you using Scipy / Scite and hitting this bug https://github.com/scikit-learn/scikit-learn/issues/3866 ?

A: The issue has been resolved.. The modifications mentioned in
https://github.com/scipy/scipy/commit/fa1782e04fdab91f672ccf7a4ebfb887de50f01c
when made in the scipy files solved the problem.


text:
Q: Horizontal scroll bar visible when hovering on the faq tag in MSE and per-site meta In the MSE and per-site meta (communities which you were already joined) main page, the faq tag is in the right hand side bottom of the screen.
When hovering on the tag, there is a horizontal scroll bar is visible, but I can't use the scroll bar, it will disappear once your cursor navigate out of the faq.
Hope the horizontal scroll bar is not required. The scroll bar design issue in the Google Chrome and Mozilla Firefox on Windows 10.

In the recent tag UI change also, the horizontal scroll bar is visible.


text:
Q: Limiting analysis to particular area of larger DTM using Whitebox GAT? I am new at using Whitebox GAT, which I find very interesting.
When one runs an analysis, is there any possibility to limit the processing to a section of the input DTM, or does the latter have to be clipped exactly to the extent of the study area?

A: No, unfortunately there is no concept of a global work area in Whitebox GAT. Your best way forward is simply to clip the data layers to your area of interest using the Clip Raster To Polygon (raster data clipped to vector polygon) or Clip (vector clipped to vector polygon) tools.


text:
Q: How to debug Yii extensions? I have been troubling myself with Yii and currently basically trying to accomplish a chart of data that could be (ajax-)refreshed to different scales (like day, week or month basis). I really would like to use Amcharts-extension, but basically something simpler like EFlot would also do.
Now, to not go to my unique problem, I seem not to be able to generate any kind of error or debug messages from extension (at least from these what I have tried). For example when I try to pass some unknown variable or malformed data to a chart widget, it ends up drawing me a blank sheet with nothing. Nothing here means that the space is reserved but chart is not drawn, no error messages are seen anywhere.
I have the CWebLogRouteenabled in my main config and it works showing actual Yii errors properly in the page, but for the extensions it does not report anything.
So, what is the proper way to debug extensions in Yii? Is there some generic interface I just have missed or does each extension have their own way to provide error and debug data?

A: If you think the problem is on the server side you can turn on trace logging in your config file (protected/config/main.php by default):
'log'=>array(
    'class'=>'CLogRouter',
        'routes'=>array(
                array(
                    'class'       => 'CFileLogRoute',
                    'levels'      => 'error, warning, trace'
                ),

         ),
 ),

and add some Yii::trace() calls to your extensions:
class MyExtension {
    public function whatever() {
        Yii::trace("Inside MyExtension::whatever()", "MyExtension");
        // do some stuff
        Yii::trace("Inside MyExtension::whatever(), just did some stuff.", "MyExtension");
    }
}

This will insert trace calls into your application.log file (by default this is located in protected/runtime/application.log).  They'll look something like this:

2013/02/21 15:35:43 [trace] [MyExtension] Inside MyExtension::whatever()
  in /path/to/MyExtension.php (3)
  2013/02/21 15:35:43 [trace] [MyExtension] Inside MyExtension::whatever(), just did some stuff
  in /path/to/MyExtension.php (5)

Put whatever you need into the traces.  I'd start with making sure the data you think you're sending from the browser is actually making it to the function to which it's intended to reach in the form in which you expect it.  If everything looks normal there then it's time to fire up the web inspector (I prefer Chrome) and watch the Network tab.  Take a look at the request to the server and the response delivered.  Also check the JS console to be sure nothing's breaking there.


text:
Q: Is it safe to store authorization flags in redux store I am new to react and redux, and am creating a react app that needs to have routes based on the user's role like student or teacher. Currently, I use a component to conditionally create routes based on the status of the user:
// AppRouter.js

const AppRouter = () => (
      <Router history={history}>

          <Switch>
            <Route path="/Login" component={LoginPage} exact={true} />
            <ProtectedRoutes />
          </Switch>

      </Router>

//ProtectedRoutes.js

const ProtectedRoutes = (props) => {
  const isStudent = props.isStudent;
  const isTeacher = props.isTeacher;

  const studentRoutes = [
    <Route key={1} path="/StudentHub" component={StudentHubPage} />,
    <Route key={2} path="/Assignment" component={AssignmentPage} />
  ];
  const teacherRoutes = [
    <Route key={1} path="/TeacherHub" component={TeacherHubPage} />,
    <Route key={2} path="/CreateCourse" component={CreateCourse} />
  ];

  return (

      {isStudent && studentRoutes}
      {isTeacher && teacherRoutes}

  );
};

const mapStateToProps = (state) => ({
  isStudent: state.isStudent,
  isTeacher: state.isTeacher
});

export default connect(mapStateToProps)(ProtectedRoutes);

My back-end API implements JWT for authentication. During the login process I would set the isStudent and isTeacher flags in my store based on what I get back from my API after loging in. The API already checks for roles from the auth token every time I make a request, so there isn't an issue for the back-end.
My question is, is this the proper and safe way of storing and checking user roles and creating routes? Would a user be able to manipulate or change my redux store and change these values to create unauthorized routes?


text:
Q: service block based on agent size in anylogic My shop floor is divided into 4 quadrants, each occupied by a welder. For the small products it could occupy 1 quadrant but for large products, it will occupy 2 quadrants with 2 welders working on it. How can I translate that in anylogic using service building block? I already have my product size determined at the source.

A: *

*Create a ResourceType "Quadrant".

*Create a ResourcePool with 4 resources of type "Quadrant"

*Set up your Service block such that each bit of work needs 1 welder

*before that, create a seize block that seizes "quadrant" resources based on the product type. See pic below where I assume this is stored in Product.type as a String:

*don't forget to create a release block as well downstream of the Service.


text:
Q: Using cbind to take values from a dataframe to a matrix to do partition data into test/train for knn I'm trying to run a knn for prediction, and im having trouble partitioning the data in a way that R will accept it for using the function. It seems to have a problem at the cbind step. There might be additional problems after but I haven't gotten past the ## step yet. Here is my code
library(class)
set.seed(1)
a<-runif(10)
b<-runif(10)
c<-rnorm(10)
sample_outcome<-sample(c(0,1), replace=TRUE, size=10)
sample.df<-data.frame(a,b,c,sample_outcome)
stack_smp_size <- floor(0.75 * nrow(sample.df))
sample_train_ind <- sample(seq_len(nrow(sample.df)), size = stack_smp_size)
sample_train <- sample.df[sample_train_ind, ]
sample_test <- sample.df[-sample_train_ind, ]
###Problem here
sample_train_x <-cbind(a,b,c)[sample_train,]
sample_test_x <-cbind(a,b,c)[!sample_train,]
sample_train_outcome<-sample_outcome[sample_train]
sample_knn=knn(sample_train_x,sample_test_x,sample_train_outcome,k=1)

A: sample_train is a dataframe.
class(sample_train)
#[1] "data.frame"

cbind(a, b, c) gives a matrix. I am not sure what do you expect to happen when you subset a matrix with the dataframe (sample_train_x <-cbind(a,b,c)[sample_train_ind,]).
I think what you might be looking for is :
library(class)

sample_train_x <- cbind(a,b,c)[sample_train_ind,]
sample_test_x <- cbind(a,b,c)[-sample_train_ind,]
sample_train_outcome <- sample_outcome[sample_train_ind]
sample_knn = knn(sample_train_x,sample_test_x,sample_train_outcome,k=1)


text:
Q: NodeJS net module - don't try to create another instance of TCP server when called again I'm totally new to the whole nodeJS asynchronous-y callback-y programming so I need more like a guidance to understanding what I'm even doing. With that said, I have two files main.js and server.js
My main file looks like this:
var server=require('./server.js');

server();

function WhenUserClicksButton(){
   server();
}

and my server file looks like this:
var net = require('net');

function server(){
   net.createServer(function (socket) {

      socket.write('\x16');  //SYN character

      socket.on('data', function (data) {
         //handle data from client
      });
   }).listen(33333);
}

First call of server(); starts the TCP server. Then function WhenUserClicksButton is called when user clicks button (duhh) in a GUI. But it attempts to start the server again so I get

Error: listen EADDRINUSE :::33333

I got why this is happening but I can't think of a solution for it. What I really need is:

*

*Start the server and listen on 33333

*When nothing is happening server and client just exchanges SYN and ACK characters every few seconds (I already have this part done, I just removed it from this example for clarity because it's not really topic of this question)

*When user click button change socket.write('\x16'); to socket.write('something');

*Then wait for server and client to exchange data and after everything  is done return results back to main.js
As I said, I'm new to this and I believe my problem lies in not understanding fully of what I'm doing. Any help and explanations are welcome!

A: I think you're very near where you need to be. I would do something like this:
server.js
var net = require('net');

var netServer = null;
var netSocket = null;

function sendData(data) {
    if (netServer && netSocket) {
        console.log('Send data: sending: ', data);
        netSocket.write(data);
    }
}

function startServer(){
    netServer = net.createServer(function (socket) {

      netSocket = socket;
      socket.write('\x16');  //SYN character

      socket.on('data', function (data) {
         console.log('Server: data from client: ', data);
         if (data.length === 1 && data[0] === 0x16) {
             // log and ignore SYN chars..
             console.log('SYN received from client');
         } else if (newDataCallback) {
             newDataCallback(data);
         };
      });
   });

   console.log('Server listening on 33333..');
   netServer.listen(33333);
}

var newDataCallback = null;
function setNewDataCallback(callback) {
    newDataCallback = callback;
}

module.exports = {
    sendData: sendData,
    startServer: startServer,
    setNewDataCallback: setNewDataCallback
};

main.js
var server = require('./server');

function newDataCallback(data) {
    console.log('newDataCallback: New data from server: ', data);
}

server.setNewDataCallback(newDataCallback);
server.startServer();

function wheneverUserClicksButton()  {
    server.sendData('something');
}

testClient.js
var clientSocket = net.createConnection(33333, "127.0.0.1");

clientSocket.on('data', (someData) => {
  console.log('Data received', someData);
});

clientSocket.on('connect', () => {
  console.log('Client Socket connected ');
  clientSocket.write('Hello from client');
});


text:
Q: Error when parsing $_SERVER['REQUEST_URI'] in PHP while Apache Server mod_rewrite is on I'm trying to use Apache's mod_rewrite to create better URLs. I'm redirecting everything to a single index.php page, parsing the $_SERVER['REQUEST_URI'] and then including the appropriate pages.
The code for the RewriteRule is the following:
Options +FollowSymLinks
RewriteEngine on
RewriteRule \b.*\b index.php

I made a url class to handle url manipulation, and inside it there is this function to get the URL:
public function get_url(){
    $url = strtolower($_SERVER['REQUEST_URI']);
    $url = explode("/", $url);
    array_shift($url);
    print_r($url);
    return $url;
}

It works, but there's a problem: the explode function causes the last array index to be null when there is a / character, which bothers me and make things more complicated when including the right page. That should be easy to fix, doing some cheap manipulation such as:
$url = trim(str_replace(" ", "/", $url));
$url = explode(" ", $url);

But whenever I try to change the $url variable (which is a copy of $_SERVER['REQUEST_URI']) in any way other than what I wrote above, I get this error:

The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
      cookies.

My guess is that somehow the $_SERVER['REQUEST_URI'] is being passed by reference, and when I try to manipulate the string the Apache server can't find a match and goes bananas, but I have no idea why this could be happening (or why exploding with a / delimiter is ok but changing the / character to whitespace and then exploding is not) or, more importantly, how to fix it.

A: The problem you are having is not connected to your PHP at all.
You simply told the apache to rewrite that Request again and again, which results in the Firefox statement you posted.
To avoid a rewrite when index.php is addressed already, you have to add a condition:
RewriteCond %{REQUEST_URI} ^!(index\.php.*)
RewriteRule \b.*\b index.php

This way the rule only applies if URI does not start with "index.php" and therefore not has been rewritten yet
Regards,
STEFAN


text:
Q: application.conf resource not found for kamon play application Having some trouble here with my play-akka application that I'm trying to monitor using Kamon.io. I was having trouble with it telling me I'm not utilizing kamon.start() and after finding the work around javaOptions in Runtime := Seq("-Dkamon.auto-start=true"); I now find my self with a resource not found error for my application.conf file.
When I don't run aspectjweaver kamon throws a different error, but my application will work. Here is the error I'm getting, if anyone could help it would greatly help me out! Thanks guys!
[info]  Running Play application with Aspectj Weaver.
--- (Running the application, auto-reloading is enabled) ---

[WeavingURLClassLoader] warning javax.* types are not being woven because the we
aver option '-Xset:weaveJavaxPackages=true' has not been specified
com.typesafe.config.ConfigException$IO: application.conf: java.io.IOException: r
esource not found on classpath: application.conf
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:188)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at com.typesafe.config.impl.Parseable.parse(Parseable.java:299)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1
002)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:9
30)
        at com.typesafe.config.ConfigFactory.parseApplicationConfig(ConfigFactor
y.java:251)
        at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.ja
va:519)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:305)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:302)
        at com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(Confi
gImpl.java:65)
        at com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.ja
va:92)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:302)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:278)
        at kamon.Kamon$.ifStarted(Kamon.scala:95)
        at kamon.Kamon$.metrics(Kamon.scala:78)
        at akka.kamon.instrumentation.LookupDataAware$LookupData$.apply$default$
3(DispatcherInstrumentation.scala:184)
        at akka.kamon.instrumentation.DispatcherInstrumentation.aroundDispatcher
sLookup(DispatcherInstrumentation.scala:83)
        at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:81)
        at akka.dispatch.Dispatchers.defaultGlobalDispatcher(Dispatchers.scala:7
1)
        at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:599)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:126)
        at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:291)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:205)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:61)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
        at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala
:50)
        at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at play.runsupport.Reloader$.startDevMode(Reloader.scala:207)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.devModeServer$lzycompute$1(PlayRun.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRu
n.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:99)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:52)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
Caused by: java.io.IOException: resource not found on classpath: application.con
f
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(P
arseable.java:735)
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(P
arseable.java:710)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at com.typesafe.config.impl.Parseable.parse(Parseable.java:299)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:1
002)
        at com.typesafe.config.ConfigFactory.parseResources(ConfigFactory.java:9
30)
        at com.typesafe.config.ConfigFactory.parseApplicationConfig(ConfigFactor
y.java:251)
        at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.ja
va:519)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:305)
        at com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:302)
        at com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(Confi
gImpl.java:65)
        at com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.ja
va:92)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:302)
        at com.typesafe.config.ConfigFactory.load(ConfigFactory.java:278)
        at kamon.Kamon$.ifStarted(Kamon.scala:95)
        at kamon.Kamon$.metrics(Kamon.scala:78)
        at akka.kamon.instrumentation.LookupDataAware$LookupData$.apply$default$
3(DispatcherInstrumentation.scala:184)
        at akka.kamon.instrumentation.DispatcherInstrumentation.aroundDispatcher
sLookup(DispatcherInstrumentation.scala:83)
        at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:81)
        at akka.dispatch.Dispatchers.defaultGlobalDispatcher(Dispatchers.scala:7
1)
        at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:599)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:142)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:126)
        at play.api.libs.concurrent.ActorSystemProvider$.start(Akka.scala:291)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:205)
        at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerSta
rt.scala:61)
        at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
        at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
        at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala
:50)
        at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at play.runsupport.Reloader$.startDevMode(Reloader.scala:207)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.devModeServer$lzycompute$1(PlayRun.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRu
n.scala:73)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:99)
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun
$apply$3.apply(PlayRun.scala:52)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last aspectj-runner:run for the full output.

[error] (aspectj-runner:run) java.lang.reflect.InvocationTargetException
[error] Total time: 13 s, completed 3-Nov-2015 3:18:25 PM

A: Add a "me to" to the list. It somehow changes the way how Play locates certain things.

A: It seems that this issue is solved in next kamon release (v.0.6.0).
There is a workaround though. I found it here:
https://groups.google.com/forum/#!msg/kamon-user/b9U7Z7EfQcM/7vQuHAKxDwAJ

A: For Play 2.5 and Kamon 0.6.2, the following approach works. You need to pass the application.conf path via system property, like this:
sbt "webapp/aspectj-runner:run" -Dconfig.file=webapp/conf/application.conf

It's important to respect the paths. In the example above, from my current project, the Play application is a project in multi-project SBT build, and therefore resides in a subdirectory called "webapp". If you're running a simple singe-project build, you'd call it like this:
sbt "aspectj-runner:run" -Dconfig.file=conf/application.conf

A: I had a similar problem and found out at the end that I didn't provide Akka with the web context.
In the controller, you have to make sure you pass the context when calling a web-dependent method. Following is a java example:
CompletableFuture.supplyAsync(() -> {
}, MyHttpExecutionContext.current());

Without the Web context, no files can be located.


text:
Q: Pages of same website opened in multiple instance of browser should refer to same variable using javascript
*

*I have website www.xyz.com and it is having 3 pages a, b and c.

*I open one page a in Internet Explorer instance 1 (i.e. www.xyz.com/a )

*I open the page b in new IE window instacne 2 (i.e. www.xyz.com/b )

*I open the page c in the new tab of IE window instance 3(i.e. www.xyz.com/c)

I need a method using javascript ONLY, via which I will be able to refer to a variable which I have defined for the website xyz and all three pages a,b and c will use the same variable. If the variable does not exsist I should be able to create the variable using javascript.

A: There are a couple of options, but the most-supported is cookies. When you open the first page you can set a cookie, which will then be available on all subsequent pages on the site.
Another option for modern browsers (IE 8+, Chrome, Firefox, etc) is to use localStorage which works similarly to cookies, but the data is kept client side and never accessible to server-side scripts. Saves a bit of overhead if the data is more than a few bytes.

A: Variables at client-side can be managed in different ways:

*

*Hidden form fields, or <input type='hidden' id='variable-name' name='variable-name' value='some-value' />, which are scoped to one page, that is, one HTTP Request, and Response. So this option is not applicable for you.

*Parameters sent in URL, known as Query String, which are also scoped to one URL, that is, one HTTP Request and response. So, this options is not applicable either.

*Using server-side session objects, to share a variable between many pages, which is widespread and applicable, but of course not in your case, where you want to work with JavaScript.

*Using Cookies, which is shared among all pages, of a specified domain and path. For example, a cookie set for www.xyz.com and for the path /, can be accessed from all the pages like www.xyz.com/a, www.xyz.com/b, and www.xyz.com/c.

So, as others have mentioned, your only solution is to use cookies.

A: Javascript variables across multiple pages of a same domain can be accessed using cookies:
See here for more details: http://www.w3schools.com/js/js_cookies.asp


text:
Q: how to set a the minimal height of a div to adjust it's content I'm trying to make a webpage with the following structure:
1 big div (main), and 3 divs inside it, a left shadow, content, and a right shadow.
these is the css code for them, mleft and mright are the shadows.
body,html{height:100%;}
.main {
width:900px;
    height:100%;
}

.mleft, .mright {
width:25px;
height:100%;
float:left;
}
.mleft { background-image: url("shadowleft.jpg"); }
.mright { background-image: url("shadowright.jpg"); }

.content {
width:850px;
float:left;
   background-color:red;
}

And the html is like this:

    (content, some text and images)

I want this to be viewable in big and small screens, the problem is that when viewing in small screens or making the window small, the main div height goes below the height of content div, so the shadow is too short to cover content div.
I've been playing with min-height, but min-height:auto, doesn't work, and none of the values of "overflow" does what I want.
Any clean way of solving this that works on any browsers?
Should I use javascript?, redo everything another way?
Update:This is an image of how it looks

Update2: The height of main seems to be directly the height of the window (100%) so I main is always the size of the window, which if small it's less than the content inside it, I tried playing with min-height with no success. The expected result is that it resizes until it reaches the size of it's contents, when it should stop.

A: OK, I've deleted all the old stuff... found a solution using positioning :)
http://jsfiddle.net/Damien_at_SF/AtX4A/
Basically, the shadows sit inside the content div and with absolute positioning are placed at 0,0 left and 0,0 right (or you could move them outside the content using negative positioning)
UPDATE: put the main div back in and applied margin:auto to it's style in order to center the whole lot :)
HTML

    (content, some text and images)>

CSS
body,html{
    height:100%;
    margin:0px;
    padding:0px;
}

.main {
  width:900px;
  height:100%;
  margin:auto;
}

.mleft, .mright {
    width:25px;
    height:100%;
}

.mleft {
    background:green;
    position:absolute;
    top:0px;
    left:0px;
}

.mright {
    background:blue;
    position:absolute;
    top:0px;
    right:0px;
}

.mcontent {
    width:850px;
    background-color:red;
    position:relative;
    padding-left:25px;
}

Hope that helps :)


text:
Q: No Source Available Error With Ninject When Debugging Code I have used NuGet to install the latest version of Ninject (v2.2.1.4).
I have then created my own NinjectDependencyResolver (credit to Adam Freeman & Steve Sanderson):
public class NinjectDependencyResolver : IDependencyResolver
{
    private IKernel kernel;

    public NinjectDependencyResolver()
    {
        kernel = new StandardKernel();
        AddBindings();
    }

    public object GetService(Type serviceType)
    {
        return kernel.TryGet(serviceType);
    }

    public IEnumerable<object> GetServices(Type serviceType) {
        return kernel.GetAll(serviceType);
    }

    public IBindingToSyntax<T> Bind<T>()
    {
        return kernel.Bind<T>();
    }

    public IKernel Kernel
    {
         get { return kernel; }
    }

    private void AddBindings()
    {
        kernel.Bind<ITitleRepository>().To<TitleRepository>();
        kernel.Bind<IDayRepository>().To<DayRepository>();
        kernel.Bind<IMonthRepository>().To<MonthRepository>();
    }
}

And then registered the dependency resolver in the global.asax applcation startup:
    protected void Application_Start()
    {
        //...other code

        DependencyResolver.SetResolver(new NinjectDependencyResolver());
    }

I then have the following line in my code:
ITitleRepository titleRepository = (ITitleRepository)DependencyResolver.Current.GetService(typeof(ITitleRepository));

If I run the code through in debug mode it appears to work correctly, however, if I step into this code (line by line) then when it runs the kernel.TryGet(serviceType) the following error occurs:
No Source Available
Hopefully the image will be visible?

Does anyone have any idea why this may be occuring?

A: This happens because Visual Studio does not find the source code for Ninject.
Do one of the following:

*

*Download the appropriate source code and point VS to it

*Configure VS to use symbolsource.org as symbol server (Only for Ninject 3.0.0-rc3 and later)

*Delete all the Ninject pdb's

*Disable debuging of other then your code in the VS settings (Tools/Options/Debugging/Enable Just My Code)

See http://msdn.microsoft.com/en-us/library/3sehk0fb%28v=vs.100%29.aspx

A: You should ask package maintainers to publish symbols, e.g. through SymbolSource. Then you'll be able to load them and step into Ninject source.


text:
Q: ubuntu suspend does not work well after ram upgrade enter image description heremy hp 255 g5 system that runs ubuntu as its only OS.
I recently upgraded the RAM size from 4GB to 8GB by installing another 4GB RAM on the second slot, and ever since the suspend feature does not respond after I suspend it.
It just shows a blank screen and the power LED stays on but the disk LED doesn't come on, the fan is heard working but the system doesn't respond. The newly installed ram works fine when I use it alone and try to suspend everything works fine same as the old ram but when both are in the system the suspend does not respond. I always have to force power off by holding down the power button.
I have tried to upgrade the OS to the latest ubuntu 22.04 LTS version and it still does the same thing.
The swap file has also been increased to 11GB with 1 as its priority.
I don't know what else to do.

A: Issue solved by updating the motherboard BIOS. Do it carefully as it may break the motherboard.
In my case I have a Gigabyte Z690 motherboard and failed when upgrading from 16 GB (2x8) to 48 GB (2x16 + 2x8) of RAM Kingston FURY Beast DDR5 4800MT/s CL38.
To solve the issue I did the following steps:

*

*Format a USB to FAT32

*Go to Gigabyte Z690 official web and download the latest bios version (in my case for the Z690-UD-AX-rev-1x board).

*Unzip and coy the *.FXX file into the USB, then rename this file to GIGABYTE.bin

*Turn off the PC, disconnect the power supply, put USB in the port that is labeled as BIOS (on the back), then turn on the power supply, turn on the PC and access to the BIOS.

*In the BIOS go to the Q-FLASH menu, which is in the bottom right side tabs (for the Gigabyte Z690 board).

*Go to Upgrade BIOS section and select the USB, then click on the GIGABYTE.bin file and continue.

*The PC will turn on and off a few times, DO NOT TURN OFF!, leave it until the PC boots the OS.


text:
Q: What is the most proper way to declare global variable to use for many modules in Fortran? The question is: If I want to use global variables in many modules. How should I do?
In my opinion, I think, maybe we could make another module and declare the global variables and then include it to any files that require it or something like that. I think this is a very simple way but the problem is I'm not familiar with Fortran. I don't know how to do it and how normally people do it.
Please give me some easy example.

A: You can just make a module, perhaps called global
module global
  implicit none
  real :: my_global_x
  integer :: my_global_i
end module

and then you can use it wherever it is needed, in modules
module a
  use global ...
end module

in subroutines
...
subroutine s
  use global
  ...
end subroutine
...

or in the main program
program main
  use global
  implicit none

  ...
end program

You can also use just a limited number of variables from the module to avoid name-space pollution
use global, only: my_global_x


text:
Q: Save purchace order and product list Good Day,

Can anyone help me please on how to figure this one out..
Im creating a purchase order module on my project and this modules saves the data into 2 different tables at the same time, which are tblPurchaseOrder_order and tblProductList, but i need to get the purchase order id which will be generated automatically once the data is saved in the tblPurchaseOrder so that I can save it on the tblProductList as the reference id of the new products.
here's what my form looks like:
my opinion is:
I save first the data in tblPurchaseOrder then retrieve that id, then save the products on the tblProductList with the id I retrieved, would it be okay if i do that?
by the way im using laravel4
Your help would really be appreciated.. thank you for TIME :3
Best Regards..
-Melvn

A: Depending on your DB, once your first insert occurs it could be returning a value - the last inserted id. If so, you can use this in a join to get the purchase order id for your second insert.


text:
Q: Does ".default" have any special significance in Symfony service IDs? I'm looking at some service definitions in FriendsOfSymfony/FOSOAuthServerBundle and it stood out to me that there's a definition for fos_oauth_server.storage.default, but another service in the same file lists fos_oauth_server.storage, without the .default part, as a dependency. Is there some kind of wildcard thing going on here, or...? This is something the Symfony documentation isn't particularly clear about.

A: The id fos_oauth_server.storage is an alias pointing to a storage service, by default fos_oath_server.storage.default. In your application's config you can replace this storage with a custom service as can be seen in the bundle's Configuration or the Configuration reference in the docs. Inside the Bundle's Extension-class you can see how the app configuration is wired into the bundle's service configuration and that the alias points to the configured service (either default or your own).
All services requiring an oauth storage (including the classes in your application) should only reference the alias, so that the underlying (default) storage can easily be replaced without touching the code that is using it.
The concept is widely used in bundles and the naming convention for the underlying service varies. Another common naming scheme, especially if there are multiple options that can be configured, is appending what type of service it is, e.g fos_oauth_server.storage.mysql, fos_oauth_server.storage.redis and so on. Aside from being a way to better distinguish the alias and the concrete implementations that the alias can point to there is no special significance to .default in Symfony.


text:
Q: How to make Jupyter Notebooks Sharable to your colleagues At my organisation we currently use a sql query tool on top of Redshift. This provider us with ability to save our sql queries and create a place where any one can search for a query name and look at it and its results. We can also give query links to each other.
Problem is since it is sql and complex analysis and visualisation is impossible to achieve. So we are thinking of moving to jupyter Python notebooks. I am not able to find and answer to something that is free / or low cost that can give the same wearability that we are getting from sql tool. In case there is an open source tool , we can also modify it as per our needs.


text: Q: Smart way to store a function during execution I have a function that I modify frequently. I want to be able to store the exact version of the function used during execution and then use that to recreate the result. Is there a smart way to do that?


text:
Q: How to configure OpenSSL on the QT How can I make my QwebView/QNetWorkRequest work with SSL?
QT return this errors (is clear that the error occurs because I did not configure SSL in my application):

QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
  QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
  QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_conf

I am use Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL) - my window is 64bit
I'll be honest, I have no idea where to start.
I searched but have not found anywhere that shows how trabalar SSL with QNetWorkRequest.
I install openSslWin32 (my Windows is 64bit, but my application is 32bit), I try this:
pro file:
LIBS += -LC:/OpenSSL-Win32/lib -lubsec
INCLUDEPATH += C:/OpenSSL-Win32/include

cpp file:
#include <openssl/aes.h>

But continues to show errors.
I know it is missing something, but do not know what exactly, forgive me I'm beginner.

A: I am install OpenSSL 32bit, is now working.
Download precompiled for Windows:
http://slproweb.com/products/Win32OpenSSL.html
Downloads:

*

*Win32: http://slproweb.com/download/Win32OpenSSL_Light-1_0_2j.exe

*Win64: http://slproweb.com/download/Win64OpenSSL_Light-1_0_2j.exe
After install copy DLLs (from C:\OpenSSL-Win32 or C:\OpenSSL-Win64, depends on whether you will compile with Qt 32bit or Qt 64bit) for release or debug project folder:

*

*libeay32.dll

*libssl32.dll

*ssleay32.dll

Note: No need to add anything to "LIBS +="

A: You may be missing a bunch of libraries.
Go into C:/OpenSSL-Win32/lib and find out which 32 bit libraries are present and add them all to your
link line,
ie if libXYZ.a is present in the directory add -lXYZ to your LIBS += statement.


text:
Q: Выполнить код одновременно public partial class MainWindow : Window
{

    public MainWindow()
    {
        InitializeComponent();

        Opacity = 0;
        FadeIn();

    }

    private void Window_Closing(object sender, CancelEventArgs e)
    {
        Closing -= Window_Closing;
        e.Cancel = true;

        DoubleAnimation fadeOut = new DoubleAnimation(0, TimeSpan.FromMilliseconds(350));
        fadeOut.Completed += (s, _) => Close();
        BeginAnimation(OpacityProperty, fadeOut);
    }

    private void FadeIn()
    {
        DoubleAnimation fadeIn = new DoubleAnimation(1, TimeSpan.FromMilliseconds(250));
        DoubleAnimation scaleWidth = new DoubleAnimation(Width * 1.1, TimeSpan.FromMilliseconds(350));
        DoubleAnimation scaleHeight = new DoubleAnimation(Height * 1.1, TimeSpan.FromMilliseconds(350));

        BeginAnimation(OpacityProperty, fadeIn);
        BeginAnimation(WidthProperty, scaleWidth);
        BeginAnimation(HeightProperty, scaleHeight);
    }
}

Анимация идет друг за другом, а как ее выполнить одновременно? Пробовал потоки, но нельзя обращаться к GUI


text:
Q: unable to unregister this item an error occurred I have troble unregistering my plugin. "unable to unregister this item an error occurred".
I am using p![enter image description here][1]lugin Registration Tool version 5.0.9690.3739.

Unhandled Exception: system.Service model.FaultException 1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The 'Delete' operation on the current component(name='SdkMessageProcessingStep', id='726aaafe-adce-e211-8dc2-000c293f67e0') failed during managed property evaluation of condition: 'Microsoft.Crm.BusinessEntities.IsComponentDeletionEnabledCondition'

Detail:
     -2147160014

      0
      SdkMessageProcessingStep

      1
      726aaafe-adce-e211-8dc2-000c293f67e0

      2
      Delete

========================================================================
???

A: The error says that the plugin step is a managed plugin step. You cannot delete this one by the PluginRegistrationTool. If you want to delete the plugin step, you must delete the whole managed solution via the UI of CRM. But that's not wat you want, I think....


text:
Q: CVS: see log of last n commits How can I see a list of the last n commits to a CVS repository?
Thanks!

A: cvs history -x AMR | tail ...

But this requires a history file on CVS server (info page), which may not be present.


text:
Q: Stack multiple columns in a single column based on another column In sheet1, I have something like this (A to D are headers - sample sheet here):

A
B
C
D

X
X1
X2

Y
Y1
Y2
Y3

Z
Z1

And in sheet2, I want something like this:

A
B

X
X1

X2

Y
Y1

Y1

Y1

Z
Z1

*Values in column A exists only on the first instance (it's not merged with the cells below it)
Sheet1 data comes from google form submissions, but we want to structure them as to the table sample in sheet2, where sheet1 columns B to D are stacked in sheet2 column B.
For now, we're using the following to merge columns B to D in a single cell aligned with the values in column A:
=ArrayFormula(Sheet1!A:A&CHAR(10)&Sheet1!B:B&CHAR(10)&Sheet1!C:C&CHAR(10)&Sheet1!C:C&CHAR(10)Sheet1!D:D)

However, this presents a lot of problems since line breaks would still be there even when there's no supposed second line, and that we have to manually update status of these items (since they're used for monitoring).
If we can have it line by line as what is expected, we'd be able to automate some of the tasks. We tried playing with QUERY, but to no avail (although I think it's possible via that function... not sure).
Hoping to get ideas from the community. Thanks!

A: I've added a new sheet ("Erik Help") with the following formula in A1:
=ArrayFormula({"Header 1", "Header 2";QUERY(SPLIT(FLATTEN({FILTER(INDIRECT("Sheet1!A2:A"),INDIRECT("Sheet1!A2:A")<>"")&"|"&FILTER(INDIRECT("Sheet1!B2:B"),INDIRECT("Sheet1!A2:A")<>""),IF(FILTER(ROW(INDIRECT("Sheet1!A2:A")),INDIRECT("Sheet1!A2:A")<>""),"")&"|"&FILTER(INDIRECT("Sheet1!C2:D"),INDIRECT("Sheet1!A2:A")<>"")}),"|",1,0),"Select * Where Col2 Is Not Null")})
This formula creates the two headers first.
You'll notice the heavy use of INDIRECT to reference ranges. This is because you'll have form data coming into that sheet; and if the formula doesn't have a way to "lock" ranges, those ranges will shift down one every time a new row is added onto the form-intake sheet. In most other applications, you can "lock" those ranges by using full-column references (e.g., A:A instead of A2:A). But given the specifics of what you're trying to do here, INDIRECT was the least complex approach. Keep in mind that, because INDIRECT is used, the references will not automatically change if you rename Sheet1 to something else (like "Form Responses 1"). You will need to change each reference manually. Or use FIND/REPLACE, select "Specific Range" set to the formula cell, and check the "Also search within formulas" box.
The idea here is that every value from A2:A is concatenated to every value in the same row of B2:D, with a pipe symbol between (as a SPLIT marker for later). Since you only want to see the Col-A values beside Col-B values, Col-A&"|"&Col-B are first processed alone; then a blank is appended instead of Col-A for everything else.
FILTER is used to only process rows for which there is data in Col-A.
SPLIT splits the combinations made (as described above) at the pipe symbol, forming two columns.
QUERY keeps only those results of the SPLIT that have something in the second column.


text:
Q: Splice file from an object javascript I am using multiple file upload in a web application using html
input type file and multiple attribute.

The files are accessing in javascript using   $('#id_docfile').get(0).files I need to delete some files depending on its extension, from that object before performing submit($('form_id').submit())
I have tried delete $('#id_docfile').get(0).files.i.But the object is not filter out unwanted files.How can i achieve that?

A: You won't need to splice the unwanted data, you can just filter it. First you need to push the multiple files in an array, then filter the unwanted data by checking the necessary condition into another array.
function uploadFile(){
    var files = [];
    var file = document.querySelector('input[id="fileUpload"]').files;
    if (file) {
        $.each(file, function(i,v) {
            // extension extraction process
            var startIndex = (v.name.indexOf('\\') >= 0 ? v.name.lastIndexOf('\\') : v.name.lastIndexOf('/'));
            var filename = v.name.substring(startIndex);
            filename = filename.substring(1);
            var extension = filename.split('.').pop().toLowerCase();

            if (extension == "jpg") { // check the necessary condition
                files.push(v);
            }
        });
        console.log(files); // 'files' will contain the desired files
    }
}


text:
Q: median calculation in sql - getting no result i'm using below query to calculate median value based on PACK_DESC and REGION1_CD partitions.
SELECT
    PACK_DESC,
    AVG(PRICE) AS MED_PRICE,
    REGION1_CD
FROM (
    SELECT
        PACK_DESC,
        REGION1_CD,
        PRICE,
        ROW_NUMBER() OVER (PARTITION BY CHECKSUM(PACK_DESC,REGION1_CD) ORDER BY PRICE ASC) AS ROWASC,
        ROW_NUMBER() OVER (PARTITION BY CHECKSUM(PACK_DESC,REGION1_CD) ORDER BY PRICE DESC) AS ROWDESC
    FROM prices
) y
WHERE ROWASC IN (ROWDESC,ROWDESC-1,ROWDESC+1)
GROUP BY PACK_DESC,REGION1_CD

for one of the region i'm getting ROWASC and ROWDESC values in varying order, due to which i think i'm not able to get the median value.
below is the script to generate the table with data
/****** Object:  Table [dbo].[prices]    Script Date: 08/26/2014 13:34:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[prices](
    [REGION1_CD] [float] NULL,
    [REGION2_CD] [float] NULL,
    [REGION3_CD] [nvarchar](255) NULL,
    [PRICE] [float] NULL,
    [CURRENCY_DESC] [nvarchar](255) NULL,
    [PACK_CD] [float] NULL,
    [PACK_DESC] [nvarchar](255) NULL
) ON [PRIMARY]
GO
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 15.456592, N'EUR', 1285, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 8.481165, N'EUR', 1286, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 79, N'NULL', 9.353736, N'EUR', 1287, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 4.92, N'EUR', 1288, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 6.02, N'EUR', 1289, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 4.97, N'EUR', 1290, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 26.908139, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 31.1323, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 32.066316, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 33.028385, N'EUR', 1291, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 92, N'NULL', 1.95661, N'EUR', 1292, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 8.62848, N'EUR', 1293, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 6.624518, N'EUR', 1294, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 7.021574, N'EUR', 1294, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 5.52, N'EUR', 1295, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 5.52, N'EUR', 1295, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 7.26, N'EUR', 1296, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 7.26, N'EUR', 1296, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 2.52865, N'EUR', 1298, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 2.52865, N'EUR', 1298, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 2.52865, N'EUR', 1298, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 2.61619, N'EUR', 1299, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 93, N'NULL', 8.63541, N'EUR', 1300, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 93, N'NULL', 8.43024, N'EUR', 1301, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 93, N'NULL', 14.06793, N'EUR', 1302, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 93, N'NULL', 15.282, N'EUR', 1302, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 86, N'NULL', 3.45121, N'EUR', 1303, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 83, N'NULL', 10.991, N'EUR', 1304, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 93, N'NULL', 14.21836, N'EUR', 1305, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (60, 83, N'NULL', 5.575551, N'EUR', 1306, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 89, N'NULL', 12.81084, N'EUR', 1307, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 17.71856, N'EUR', 1308, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 39.838612, N'EUR', 1309, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 7.71015, N'EUR', 1310, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 92, N'NULL', 6.187129, N'EUR', 1311, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 92, N'NULL', 6.128287, N'EUR', 1311, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.09582, N'EUR', 1312, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.09582, N'EUR', 1312, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.09582, N'EUR', 1312, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.09582, N'EUR', 1312, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 9.516528, N'EUR', 1313, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 9.516528, N'EUR', 1313, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 9.516528, N'EUR', 1313, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.078811, N'EUR', 1314, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.078811, N'EUR', 1314, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.53527, N'EUR', 1315, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.53527, N'EUR', 1315, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 6.53527, N'EUR', 1315, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 81, N'NULL', 5.62, N'EUR', 1316, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 2.05178, N'EUR', 1317, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 1.2283, N'EUR', 1317, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 1.2283, N'EUR', 1317, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 3.379084, N'EUR', 1318, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 87, N'NULL', 6.9, N'EUR', 1319, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 3.77068, N'EUR', 1320, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 3.71, N'EUR', 1321, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 3.71, N'EUR', 1321, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 3.71, N'EUR', 1321, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 3.71, N'EUR', 1321, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 3.71, N'EUR', 1321, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 5.334797, N'EUR', 1322, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 4.9, N'EUR', 1324, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 4.86, N'EUR', 1325, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 4.47, N'EUR', 1326, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 3.36, N'EUR', 1327, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 5.35, N'EUR', 1328, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 5.42, N'EUR', 1329, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 3.26986, N'EUR', 1330, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 6.02, N'EUR', 1331, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 5.338361, N'EUR', 1332, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 5.448506, N'EUR', 1333, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 5.57, N'EUR', 1334, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 90, N'NULL', 3.36, N'EUR', 1335, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 72, N'NULL', 5.18, N'EUR', 1336, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 72, N'NULL', 5.04, N'EUR', 1336, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 85, N'NULL', 3.82, N'EUR', 1338, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 2.17, N'EUR', 1339, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 2.02, N'EUR', 1339, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 2.02, N'EUR', 1339, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 80, N'NULL', 2.02, N'EUR', 1339, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (72, 85, N'NULL', 3.21, N'EUR', 1340, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (61, 88, N'NULL', 6.02126, N'EUR', 1342, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (75, 77, N'NULL', 4.47, N'EUR', 1343, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (77, 77, N'NULL', 5.17, N'EUR', 1344, N'abc')
INSERT [dbo].[prices] ([REGION1_CD], [REGION2_CD], [REGION3_CD], [PRICE], [CURRENCY_DESC], [PACK_CD], [PACK_DESC]) VALUES (77, 77, N'NULL', 4.47, N'EUR', 1345, N'abc')

i'm getting result as shown in below image

as you can see in image above, i'm not getting any row for REGION1_CD of 61.
please help

A: This is the problem, from the documentation:

There is no guarantee that the rows returned by a query using
  ROW_NUMBER() will be ordered exactly the same with each execution
  unless the following conditions are true.

*

*Values of the partitioned column are unique.

*Values of the ORDER BY columns are unique.

*Combinations of values of the partition column and ORDER BY columns are unique.

This causes your ROWDESC to not be the exact inverse of ROWASC.
The following query will give you the correct values:
SELECT x.PACK_DESC, x.REGION1_CD, AVG(x.price)
FROM (
    SELECT
        PACK_DESC,
        REGION1_CD,
        price,
        COUNT(1)
            OVER (PARTITION BY CHECKSUM(PACK_DESC,REGION1_CD))
            AS total_rows,
        ROW_NUMBER()
            OVER (PARTITION BY CHECKSUM(PACK_DESC,REGION1_CD) ORDER BY price ASC)
            AS row_order
    FROM prices) x
WHERE  x.row_order IN (
    FLOOR((x.total_rows + 1) / 2.0),
    FLOOR((x.total_rows + 2) / 2.0))
GROUP BY PACK_DESC, REGION1_CD

The tricky part is in the row_order comparison at the bottom:

*

*For an uneven number of rows, for example 5, it will evaluate to:
x.row_order IN (3, 3)
So only the third row will be selected.

*For an even number of rows, for example 6, it will evaluate to:
x.row_order IN (3, 4)
So the third and fourth row are selected, and they are averaged at the top of the query.


text:
Q: Client not routing through CentOS7 OpenVPN I recently setup a server on digitalocean, i setup the vpn server key etc and i can connect with my client, the problem is that if i connect and i google for my public ip adress that i don't get the ip address of the server but still my client public ip.
I'm using CentOS7 and Firewalld. I don't want to use iptables because that is deprecated.
My firewalld service is set with the service "openvpn" added to the permanent list. If i run "firewall-cmd --query-masquerade" i get yes.
My server configuration is the following (i have enabled the redirect gateway) :
 port 1194

 proto udp

 dev tun

 ca ca.crt
 cert SectorFiveVPN.crt
 key SectorFiveVPN.key  # This file should be kept secret

 dh dh2048.pem

 server 10.8.0.0 255.255.255.0

 ifconfig-pool-persist ipp.txt

 push "redirect-gateway def1 bypass-dhcp"

 push "dhcp-option DNS 8.8.8.8"
 push "dhcp-option DNS 8.8.4.4"

 keepalive 10 120

 comp-lzo

 user nobody
 group nobody

 persist-key
 persist-tun

 status openvpn-status.log

 verb 3

 mute 20

My ip addr output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 04:01:33:68:37:01 brd ff:ff:ff:ff:ff:ff
inet 178.62.133.212/18 brd 178.62.191.255 scope global eth0
   valid_lft forever preferred_lft forever
inet6 fe80::601:33ff:fe68:3701/64 scope link
   valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 100
link/none
inet 10.8.0.1 peer 10.8.0.2/32 scope global tun0
   valid_lft forever preferred_lft forever

Client Connection Log:
 Fri Dec 05 13:41:52 2014 OpenVPN 2.3.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Dec  1 2014
 Fri Dec 05 13:41:52 2014 library versions: OpenSSL 1.0.1j 15 Oct 2014, LZO 2.08
 Fri Dec 05 13:41:52 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
 Fri Dec 05 13:41:52 2014 Need hold release from management interface, waiting...
 Fri Dec 05 13:41:53 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'state on'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'log all on'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'hold off'
 Fri Dec 05 13:41:53 2014 MANAGEMENT: CMD 'hold release'
 Fri Dec 05 13:41:53 2014 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
 Fri Dec 05 13:41:53 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,RESOLVE,,,
 Fri Dec 05 13:41:53 2014 UDPv4 link local: [undef]
 Fri Dec 05 13:41:53 2014 UDPv4 link remote: [AF_INET]178.62.133.212:1194
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,WAIT,,,
 Fri Dec 05 13:41:53 2014 MANAGEMENT: >STATE:1417783313,AUTH,,,
 Fri Dec 05 13:41:53 2014 TLS: Initial packet from [AF_INET]178.62.133.212:1194, sid=a36afa9b 21e7c867
 Fri Dec 05 13:41:53 2014 VERIFY OK: depth=1, C=BE, ST=WV, L=Brugge, O=SectorFive, OU=SectorFiveVPN, CN=fraise.servegame.com, name=SectorFiveVPN, emailAddress=sector5five@outlook.com
 Fri Dec 05 13:41:53 2014 VERIFY OK: depth=0, C=BE, ST=WV, L=Brugge, O=SectorFive, OU=SectorFiveVPN, CN=SectorFiveVPN, name=SectorFiveVPN, emailAddress=sector5five@outlook.com
 Fri Dec 05 13:41:54 2014 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
 Fri Dec 05 13:41:54 2014 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
 Fri Dec 05 13:41:54 2014 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
 Fri Dec 05 13:41:54 2014 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
 Fri Dec 05 13:41:54 2014 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
 Fri Dec 05 13:41:54 2014 [SectorFiveVPN] Peer Connection Initiated with [AF_INET]178.62.133.212:1194
 Fri Dec 05 13:41:55 2014 MANAGEMENT: >STATE:1417783315,GET_CONFIG,,,
 Fri Dec 05 13:41:56 2014 SENT CONTROL [SectorFiveVPN]: 'PUSH_REQUEST' (status=1)
 Fri Dec 05 13:41:56 2014 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: timers and/or timeouts modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: --ifconfig/up options modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: route options modified
 Fri Dec 05 13:41:56 2014 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
 Fri Dec 05 13:41:56 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
 Fri Dec 05 13:41:56 2014 MANAGEMENT: >STATE:1417783316,ASSIGN_IP,,10.8.0.6,
 Fri Dec 05 13:41:56 2014 open_tun, tt->ipv6=0
 Fri Dec 05 13:41:56 2014 TAP-WIN32 device [LAN-verbinding 2] opened: \\.\Global\{B9B2C67D-BCB9-4A41-A97B-86186DD39D11}.tap
 Fri Dec 05 13:41:56 2014 TAP-Windows Driver Version 9.9
 Fri Dec 05 13:41:56 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {B9B2C67D-BCB9-4A41-A97B-86186DD39D11} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
 Fri Dec 05 13:41:56 2014 Successful ARP Flush on interface [41] {B9B2C67D-BCB9-4A41-A97B-86186DD39D11}
 Fri Dec 05 13:42:01 2014 TEST ROUTES: 2/2 succeeded len=1 ret=1 a=0 u/d=up
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 178.62.133.212 MASK 255.255.255.255 192.168.0.1
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=25 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 192.168.0.1 MASK 255.255.255.255 192.168.0.1 IF 4
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=25 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 0.0.0.0 MASK 128.0.0.0 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 128.0.0.0 MASK 128.0.0.0 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 MANAGEMENT: >STATE:1417783321,ADD_ROUTES,,,
 Fri Dec 05 13:42:01 2014 C:\Windows\system32\route.exe ADD 10.8.0.1 MASK 255.255.255.255 10.8.0.5
 Fri Dec 05 13:42:01 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=30 and dwForwardType=4
 Fri Dec 05 13:42:01 2014 Route addition via IPAPI succeeded [adaptive]
 Fri Dec 05 13:42:01 2014 Initialization Sequence Completed
 Fri Dec 05 13:42:01 2014 MANAGEMENT: >STATE:1417783321,CONNECTED,SUCCESS,10.8.0.6,178.62.133.212

is there anyone that can help?

A: Ok i found the answer apparently everything was correct the only STUPID mistake I made was not running the OpenVPN GUI as Administrator => Stupid me


text:
Q: Count several rows and make a new column in R I want to count several rows (x1-x4) and make a new column (x1_x4) in R looks like the below picture. Can anyone help me?
df <- data.frame(ID = c(1,2,3,4,5,6,7,8,9,10),
                 x1 = c(0,NA,0,1,0,0,1,1,1,NA),
                 x2 = c(0,NA,1,0,0,NA,0,1,0,0),
                 x3 = c(0,NA,0,1,1,0,1,1,1,0),
                 x4 = c(0,NA,0,0,0,0,1,1,1,1))

A: You can use rowSums and test with apply if all are NA.
df$x1_x4 <- rowSums(df[-1], TRUE)
df$x1_x4[apply(is.na(df[2:5]), 1, all)] <- NA
#   ID x1 x2 x3 x4 x1_x4
#1   1  0  0  0  0     0
#2   2 NA NA NA NA    NA
#3   3  0  1  0  0     1
#4   4  1  0  1  0     2
#5   5  0  0  1  0     1
#6   6  0 NA  0  0     0
#7   7  1  0  1  1     3
#8   8  1  1  1  1     4
#9   9  1  0  1  1     3
#10 10 NA  0  0  1     1

A: One dplyr solution could be:
df %>%
 rowwise() %>%
 mutate(x1_x4 = any(!is.na(c_across(-ID)))^NA * sum(c_across(-ID), na.rm = TRUE))

      ID    x1    x2    x3    x4 x1_x4
   <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
 1     1     0     0     0     0     0
 2     2    NA    NA    NA    NA    NA
 3     3     0     1     0     0     1
 4     4     1     0     1     0     2
 5     5     0     0     1     0     1
 6     6     0    NA     0     0     0
 7     7     1     0     1     1     3
 8     8     1     1     1     1     4
 9     9     1     0     1     1     3
10    10    NA     0     0     1     1

A: vars <- paste0("x", 1:4)
df$x1_x4 <- rowSums(df[vars], na.rm = TRUE)
df[rowSums(is.na(df[vars]), na.rm = TRUE) == 4, "x1_x4"] <- NA
df
#    ID x1 x2 x3 x4 x1_x4
# 1   1  0  0  0  0     0
# 2   2 NA NA NA NA    NA
# 3   3  0  1  0  0     1
# 4   4  1  0  1  0     2
# 5   5  0  0  1  0     1
# 6   6  0 NA  0  0     0
# 7   7  1  0  1  1     3
# 8   8  1  1  1  1     4
# 9   9  1  0  1  1     3
# 10 10 NA  0  0  1     1

A: Base R one (obfuscated) expression:
within(df, {x1_x4 <- apply(df[,grepl("^x", names(df))], 1,
       function(x){ifelse(all(is.na(x)), NA_integer_, sum(x, na.rm = TRUE))})})


text:
Q: How to change default sms application background in android I am creating an app based on sms functionality, But I am stuck at one point where i want to set background image to default sms app in android.
How can i achieve this...?
A sample code or link will be appreciated.
Thanks in advance...!

A: It is not possible until you are doing Customization of Android OS.

Will you prefer someone else application changing background of your application??


text:
Q: How to handle absent elements in jquery For a medium sized app with a medium amount of javascript (in the way of jQuery), what's the best way to combine the javascript into a single file while also avoiding acting on absent elements?
For example, given the html:

  <title>Foobar</title>

Bar

And the following javascript
$(document).ready(function() {
  // This will get bound
  $('#foo').click(function() { alert('foobar'); });

  // This will not get bound
  $('#bar').click(function() { alert('foobar'); });
});

Granted both of the above bindings are relatively innocuous, but for complex behaviors, will attempting to bind to absent elements cause a performance hit?  If so, how do you balance keeping your javascript in a single file (to decrease http requests) with maintainable, performant jQuery?

A: The cost of not finding an element is basically the same of finding it.
So probably this won't cause a performance hit.


text:
Q: Pull out data from a file and store it in strings in C++ I have a file which contains records of students in the following format.
Umar|Ejaz|12345|umar@umar.com
Majid|Hussain|12345|majid@majid.com
Ali|Akbar|12345|ali@geeks-inn.com
Mahtab|Maqsood|12345|mahtab@myself.com
Juanid|Asghar|12345|junaid@junaid.com

The data has been stored according to the following format:
firstName|lastName|contactNumber|email

The total number of lines(records) can not exceed the limit 100. In my program, I've defined the following string variables.
#define MAX_SIZE 100
// other code
string firstName[MAX_SIZE];
string lastName[MAX_SIZE];
string contactNumber[MAX_SIZE];
string email[MAX_SIZE];

Now, I want to pull data from the file, and using the delimiter '|', I want to put data in the corresponding strings. I'm using the following strategy to put back data into string variables.
ifstream readFromFile;
readFromFile.open("output.txt");
// other code
int x = 0;
string temp;

while(getline(readFromFile, temp)) {
    int charPosition = 0;
    while(temp[charPosition] != '|') {
        firstName[x] += temp[charPosition];
        charPosition++;
    }
    while(temp[charPosition] != '|') {
        lastName[x] += temp[charPosition];
        charPosition++;
    }
    while(temp[charPosition] != '|') {
        contactNumber[x] += temp[charPosition];
        charPosition++;
    }
    while(temp[charPosition] != endl) {
        email[x] += temp[charPosition];
        charPosition++;
    }
    x++;
}

Is it necessary to attach null character '\0' at the end of each string? And if I do not attach, will it create problems when I will be actually implementing those string variables in my program. I'm a new to C++, and I've come up with this solution. If anybody has better technique, he is surely welcome.
Edit: Also I can't compare a char(acter) with endl, how can I?
Edit: The code that I've written isn't working. It gives me following error.
     Segmentation fault (core dumped)

Note: I can only use .txt file. A .csv file can't be used.

A: There are many techniques to do this.  I suggest searching StackOveflow for "[C++] read file" to see some more methods.
Find and Substring
You could use the std::string::find method to find the delimiter and then use std::string::substr to return a substring between the position and the delimiter.
std::string::size_type position = 0;
positition = temp.find('|');
if (position != std::string::npos)
{
    firstName[x] = temp.substr(0, position);
}

A: If you don't terminate a a C-style string with a null character there is no way to determine where the string ends. Thus, you'll need to terminate the strings.
I would personally read the data into std::string objects:
std::string first, last, etc;
while (std::getline(readFromFile, first, '|')
    && std::getline(readFromFile, last, '|')
    && std::getline(readFromFile, etc)) {
    // do something with the input
}

std::endl is a manipulator implemented as a function template. You can't compare a char with that. There is also hardly ever a reason to use std::endl because it flushes the stream after adding a newline which makes writing really slow. You probably meant to compare to a newline character, i.e., to '\n'. However, since you read the string with std::getline() the line break character will already be removed! You need to make sure you don't access more than temp.size() characters otherwise.
Your record also contains arrays of strings rather than arrays of characters and you assign individual chars to them. You either wanted to yse char something[SIZE] or you'd store strings!


text:
Q: Unable to run springboot application with gradle bootrun Creating springboot application and i am unable to run it.
Here is what my Application class looks like
@SpringBootApplication
@EnableAutoConfiguration
@ComponentScan
@EnableConfigurationProperties
public class ApplicationMain implements CommandLineRunner {

    @Autowired
    private CloudStorage cloudSt;

    public static void main(String[] args){
        SpringApplication app = new SpringApplication(ApplicationMain.class);
        app.run();
    }

    public void run(String... args) throws Exception {
        System.out.println("--------------");
        cloudSt.print();
    }
}

I run this application by using command gradle bootRun and it gives following output
❯ gradle bootRun

> Task :bootRun
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed

Note there is no error.
Note: I am building an app which would be used as Jar file but i am testing this as a commandline app to verify if the properties are being injected properly or not. for reference, here is my CloudStorage bean
@Component
@ConfigurationProperties(prefix = "cloud.storage")
public class CloudStorage {
    @Value("${accountName}")
    private String accountName;

    @Value("${key}")
    private String key;

    @Value("${containerName}")
    private String containerName;

    public AzureBlobDirectory getAzureRootDirectory() throws CloudStorageException {
        try {
            CloudStorageAccount cloudStorageAccount = CloudStorageAccount.parse(buildConnectionString(accountName, key));
            CloudBlobClient cloudBlobClient = cloudStorageAccount.createCloudBlobClient();
            return new AzureBlobDirectory(cloudBlobClient, containerName);
        } catch (URISyntaxException ex) {
            throw new CloudStorageException(ex);
        } catch (InvalidKeyException ex) {
            throw new CloudStorageException(ex);
        }
    }

    private String buildConnectionString(String accountName, String accountKey){
        return String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s", accountName, accountKey);
    }

    public void print() {
        System.out.printf("%s --- %s --- %s\n", accountName, key, containerName);
    }
}

*

*Am i configuring my springboot application wrong?

*What am i missing here, why i don't see the print statements from my main class

A: You appear to be missing a logging framework that integrates with SLF4J:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

As a result, it has defaulted to a no-operation implementation which means that log messages will not be output anywhere:
SLF4J: Defaulting to no-operation (NOP) logger implementation

In a Spring Boot application, the default logging framework that integrates with SLF4J is Logback. It should be on the classpath through a dependency on spring-boot-starter or spring-boot-starter-*.

A: You can use @Slf4j annotation.
@Component
@Slf4j
@ConfigurationProperties(prefix = "cloud.storage")
public class CloudStorage {
    @Value("${accountName}")
    private String accountName;

    @Value("${key}")
    private String key;

    @Value("${containerName}")
    private String containerName;

    public AzureBlobDirectory getAzureRootDirectory() throws CloudStorageException {
        try {
            CloudStorageAccount cloudStorageAccount = CloudStorageAccount.parse(buildConnectionString(accountName, key));
            CloudBlobClient cloudBlobClient = cloudStorageAccount.createCloudBlobClient();
            return new AzureBlobDirectory(cloudBlobClient, containerName);
        } catch (URISyntaxException ex) {
            log.error(ex.toString());
            throw new CloudStorageException(ex);
        } catch (InvalidKeyException ex) {
            log.error(ex.toString());
            throw new CloudStorageException(ex);
        }
    }

    private String buildConnectionString(String accountName, String accountKey){
        return String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s", accountName, accountKey);
    }

    public void print() {
        log.info("%s --- %s --- %s\n", accountName, key, containerName);
    }
}


text:
Q: pandas Sparse dataframe density issue with fillna I'm trying to create a sparse dataframe in pandas. I create the initial dataframe via
df =  pd.read_sql(sql=sql, con=db_eng, index_col=index)
idx = pd.MultiIndex.from_product([df.index.levels[0], df.index.levels[1]], names=df.index.names)
my_df = df.reindex(idx)

and then make that sparse with the following methods
s1 = my_df.to_sparse()
s2 = my_df.to_sparse(fill_value=0)
s2 = my_df.to_sparse().fillna(value=0)

When I check the density of s1, s2, s3 I get different values:
>>> s1.density
0.054158277796754875
>>> s2.density
1.0
>>> s3.density
0.054158277796754875

Why is the second method giving me a density of 1?

A: I don't have access to your data, but it looks like your "empty" values are NaN, so when making it sparse based on 0 values (i.e. s2), then the sparse dataframe is not sparse at all.
This would return what you are expecting:
s2 = my_df.fillna(0).to_sparse(fill_value=0)

Now your "empty" values are 0s, so calling to_sparse with fill_value=0 actually makes your dataframe sparse.

Edit: In other words, to_sparse will make your dataframe sparse based on the fill_value, which is NaN by default.
If you call to_sparse with fill_value=0 on a dataframe filled with NaN values, then the resulting dataframe is not sparse at all (density = 1.0), it is full of NaN values.
You should read the introduction: http://pandas.pydata.org/pandas-docs/stable/sparse.html.


text:
Q: Getting error while implementing web-view in flutter applications I am building a flutter app that has a web-view. I have updated the minsdkversion to 20. and added the android permission to use the internet but still getting the errror.click here to view error
DART

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() {
  runApp(
    const MaterialApp(
      home: WebViewApp(),
    ),
  );
}

class WebViewApp extends StatefulWidget {
  const WebViewApp({Key? key}) : super(key: key);

  @override
  State<WebViewApp> createState() => _WebViewAppState();
}

class _WebViewAppState extends State<WebViewApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView'),
      ),
      body: const WebView(
        initialUrl: 'https://flutter.dev',
      ),
    );
  }
}

A: I ran your code into my machine it works fine on android devices. I hope you are running your app on an android or ios device because flutter_webview: any version supports only Android and ios devices as per the official doc.

A: you are using webview_flutter that support platform Android and iOS, but you trying to run on web, that's why this error occurs.
Thanks,
Happy Codding!


text:
Q: Moment generating function - Can it be a polynomial? Let X be a random variable such that P(X = 0) < 1.
Is it possible for a moment generating function of X to be a polynomial $a_n t^n + a_{n-1} t^{n-1} +\cdots+  a_1 t +  a_0$? Why

A: If the mgf $M_X(t)$ is a polynomial, the $2k$-th derivative of $M_X(t)$ is identically $0$ for some positive integer $k$. It follows that $E(X^{2k})=0$, which is only possible if $X$ is $0$ with probability $1$.


text:
Q: Android Controlling Checked Checkboxes in TableLayout I have a TableLayout and I'm adding rows dynamically. And in every row, I have a checkbox also.
My problem is controlling which checkboxes are checked and I don't know even how can I loop for each row. Please help me.

A: Checkbox checkbox;

checkbox = (CheckBox) findViewById(R.id.checkbox);

checkBox.setChecked(false);

or true. that should work, just replace checkbox with your variable and @+id
EDIT:
You can implement OnCheckedChangeListener, then use something like
@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
    // TODO Auto-generated method stub
    switch (arg0.getId()) {
    case R.id.checkbox1:
         if (checkbox1.isChecked()){
        //code to use when user checks the box
        }else{
        //code to use when user UNchecks the box
        }
    break;

    }
}


text:
Q: How do I inject a third party AngularJS module in a unit test? uploadCtrl.js
'use strict';
angular.module('app.controllers').controller('UploadCtrl', ['$scope', 'FileUploader',
    function ($scope, FileUploader) {
        $scope.uploader = new FileUploader();
        $scope.upload = function () {
            // Do some validation of form fields before submitting to server here...
            $scope.success = true;
        };
    }]
);

uploadCtrlSpec.js
'use strict';
describe('UploadCtrl', function () {
    var scope, controller, FileUploader, UploadCtrl;
    beforeEach(module('app.controllers'));
    beforeEach(module('angularFileUpload'));
    beforeEach(inject(function (_FileUploader_, $rootScope, $controller) {
        scope = $rootScope.$new();
        FileUploader = _FileUploader_;
        controller = $controller;

        UploadCtrl = controller('UploadCtrl', {$scope: scope, FileUploader: FileUploader});
    }));

    it('verify upload success', function () {
        scope.upload();
        expect(scope.success).toBeTruthy();
    });
});

When I try to run this test I get:
Error: [$injector:unpr] Unknown provider: FileUploaderProvider <- FileUploader

I have tried to remove all down to very the very basic to rule out other issues. If I change the "FileUploader" variable to FileUploaderX" I get the same error and only the unknown provider name changes, so the problem seem to be within the unit test injection.
Also if I change the "beforeEach(module('angularFileUpload'));" to for example "beforeEach(module('angularFileUploadX'));" I get an error that the module could not be found, so the test conf seem to be including the script for the module correctly.
The application works and I'm able to upload a file to my server (not visible here since I removed all logic except for the FileUploader initiation to rule out other issues).
Anyone got any ideas?
Btw, I'm using this module:
nervgh/angular-file-upload
Update: I have noticed that if I remove the path to the angularFileUpload module (angular-file-upload.js) in the karma config file It's still the same error that shows, but if I change the module name in the beforeEach (in the test file) it says it can't be found. Could there be a conflict with an existing module with the same name?
 Error: [$injector:modulerr] Failed to instantiate module angularFileUploadX due to:
    Error: [$injector:nomod] Module 'angularFileUploadX' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

A: Add the dependency to your karma.config.js file.
ex:
{
    files: [
        "path/to/FileUploader.js",
        ...
    ],
    ...
}