2018-10-22         Jeff

How to disable toggling of landscape/portrait on a mobile web app (Android Browser/iOS-Mobile Safari)

I am trying to disable phone rotation affecting the web page of one of my HTML5 mobile apps. No reorganizing of the layout, resizing, orientationchange behavior.I want it so that you rotate the phone and the initial layout loaded will stay the same, forcing the user into using the app in the original orientation. There are many subtleties to user logic and I truly feel this is needed in my app, so please no comments on that choice, rather help for my question in the first sentence.I tried listening for BOTH 'orientationchange' and 'resize' events and calling preventDefault ...

 javascript                     5 answers                     60 view
 2018-10-22         Jeff

Using Bundler along with preinstalled gems

So I've got thin installed the old fashioned way:gem install thinI put an app on the server and installed all of its required gems via bundler:bundle installBut, when I tried to start the app with thin start, it can't find any of the bundler-installed gems since they're not installed in the default gems directory. My question is: how do I make this work? Do I need to install thin via bundler as well? Will that still set up the thin executable in /usr/bin so I can start it from the command line like normal? Thanks! Found it. Bundler has a little setup method that gets all...

 ruby                     1 answers                     21 view
 2018-10-22         Jeff

E2E testing in a submodule of gradle project

Let's say that my project have 2 modules, API, core and store, and I want to write some E2E tests for the core. My intention is that the final structure for test is:root +- core +-src +-e2e +-javaIs it possible with gradle, or my only option is to put this tests as part of root project? Yes, why wouldn't it be possible. There are many examples out there. Simplest solution is to define a new sourceSet and add a Test task to it.sourceSets { e2e { java { compileClasspath += sourceSets.main.output + sourceSets.test.output runtimeCla...

 gradle                     1 answers                     97 view
 2018-10-22         Jeff

How do I convert 234.35 into Binary?

I need to convert the above into Binary. I'm at a loss here. Can you include full information on how you got the answer too?. Step by step would be great! First, convert the integral part which is 11101010. Next, you build the decimal part. If demonstrated informally, it is something like:0.1 is one half, but 0.35 is less than that, so the first binary digit is zero -> .0 (0.35)0.01 is one quarter, and 0.35 is greater than that, so then follows one. 0.35 minus one quarter is decimal 0.1 -> .01 (0.35 - 0.25 = 0.1)0.001 is one eighth, and decimal 0.1 is less than that, so ...

 binary                     1 answers                     11 view
 2018-10-22         Jeff

oidc-client.js raises "No authority passed" error

I'm a new comer for SSO. Recently I'm focusing on a project which is using OIDC. I try to use oidc-client to solve the problem. Here is my settings.(I erase the detail url, but they are effective).var mgr = new Oidc.UserManager({ userStore: new Oidc.WebStorageStateStore({ store: window.localStorage }), metadata: { issuer: 'https://foo.com/', authorization_endpoint: 'https://foo.com/', userinfo_endpoint: 'https://foo.com/', end_session_endpoint: 'https://foo.com/', jwks_uri: 'https://foo.com/' }, keys: [ { 'kty': 'RSA', ...

 javascript                     1 answers                     92 view
 2018-10-22         Jeff

Overriding admin template in django to add custom javascript

I have a model that I need to add some custom javascript processing to its admin form. I have tried an implementation via the following guide:https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#overriding-admin-templatesSo I created my own change_form.html, and I overrode object-tools-items and put my js in there, but I'm not seeing it when I go to the change form. Then, just as a test, I put it directly into the real django change_form.html, but still nothing. Then to see if that template is being used, I changed it - added data, created syntax errors, but still, it h...

 javascript                     1 answers                     79 view
 2018-10-22         Jeff

Amazon Lex - Taking user input and storing it

Is there a way to store the users input from slots? For example, the persons favourite meat is beef and bun is brioche. Then can this data be checked and returned with I recommend the Tennessee Stack that has a 6oz beef patty inside of a brioche bun.Also, would it be possible to then have this data sent in an email automatically? Or am I asking too much?Cheers It is definitely possible, but not with Lex alone. You'll have to use another Amazon Web Service or your own website/server to do the emailing and storing long-term. However, storing the input short-term (the lengt...

 amazon-lex                     1 answers                     46 view
 2018-10-22         Jeff

Python code explanation for stationary distribution of a Markov chain

I have got this code: import numpy as npfrom scipy.linalg import eig transition_mat = np.matrix([ [.95, .05, 0., 0.],\ [0., 0.9, 0.09, 0.01],\ [0., 0.05, 0.9, 0.05],\ [0.8, 0., 0.05, 0.15]])S, U = eig(transition_mat.T)stationary = np.array(U[:, np.where(np.abs(S - 1.) < 1e-8)[0][0]].flat)stationary = stationary / np.sum(stationary)>>> print stationary[ 0.34782609 0.32608696 0.30434783 0.02173913]But I can't understand the line: stationary = np.array(U[:, np.where(np.abs(S - 1.) < 1e-8)[0][0]].flat)Can anyone explain the part: U[:, np.where(np.a...

 python                     1 answers                     23 view
 2018-10-22         Jeff

python gettext - produce an error when message id not found

I'm using python2.7 gettext.For translation I use the following code:t = gettext.translation( domain, path, fallback=False, languages=[self._lang, 'en'] )_ = t.ugettexttranslated = _('foo')The default behaviour is that if there is no entry in the catalog for the message id, the message id is returned.Is there a way to produce an error instead?A simple code example would be appreciated. That is not possible without hacking the source code of gettext. You could write a wrapper around the translation function that produces ...

 python                     2 answers                     6 view
 2018-10-22         Jeff

What this datediff check constraint on SQL table column is verifying?

Can anyone let me know what exactly date difference this below statement is verifying for column check constraint?DATEDIFF(millisecond,[MyDateColumn], DATEADD(day,DATEDIFF(day,(0),[MyDateColumn]),(0)))=(0))) CAST(0 AS DATETIME) is 1900-01-01 00:00:00.000 (The default value of the DATETIME datatype). The integer 0 is implicitly converted to DATETIME.datediff(day, (0), [MyDateColumn]) is the difference between the above date in daysdateadd(day,datediff(day,(0),[MyDateColumn]),(0)) is the midnight of the given day.datediff(millisecond,[MyDateColumn],dateadd(day,dat...

 sql                     1 answers                     87 view
 2018-10-22         Jeff

MAX on columns generated by SUM and GROUP BY

I'm trying to get the MAX on a column which is generated dynamically using the SUM statement. The SUM statement is used together with the 'GROUP by' syntax.This is the original query, however it needs to be modified to work with grouping, sums and of course MAX.SELECT SUM(video_plays) AS total_video_plays FROM `video_statistics` v_stat GROUP BY v_stat.`video_id` ASCAs you can see SUM is adding all the values inside video_plays as total_video_plays.. But I SIMPLY want to get the MAX of total_video_plays My attempts are below, however they do not work.. SELECT SUM(vide...

 sql                     4 answers                     52 view
 2018-10-22         Jeff

How to install Kafka on hadoop cluster?

I want to install the latest release of Kafka on our HortonWorks Hadoop cluster that contains 2 master nodes, 2 edge nodes and 8 data nodes. The plan is to install Kafka on 2 out of 8 data node boxes.Kafka will need to handle up to few million events a day an probably few batch copies of files of a size of 0.5Gb-1.2Gb.Questions: any special configuration to data nodes or to kafka I need to consider in order to avoid a potential performance deterioration of kafka (or data nodes)?How Kafka is normally deployed (on dedicated boxes or is it ok to run it on data nodes)? You c...

 hadoop                     1 answers                     43 view
 2018-10-22         Jeff

Rescale x-Axis in surf plot

I have a 1024 by 100 matrix. When I use the function surf it plots the data with axis limit 0 to 1024 for x, 0 to 100 for y and the entries of the matrix as z values (as expected). Now I want to keep everything in the plot the same, except for the x axis limits: I want to have them from 400 to 1000 i.e. I want to rescale the x axis. I don't want to start at the 400th entry and stop at the 1000th. I want to have the first entry to correstpond to 400 and the last one to 1000th. In other words change only the labels of the x axis to go from 400 to 1000 and not from 0 to 1024. ...

 matlab                     1 answers                     29 view
 2018-10-22         Jeff

How to get Path previous to Exceuting Assembly

i have some files located in c:\MyApp\file.txtand current executing assenbly in in debud filderc:\MyApp\bin\Debug\i want to get address of above "file.txt" at run time..i tried thisAssembly.GetExecutingAssembly().Locationit gives me c:\MyApp\bin\Debug\MyApp.exehow can i get address of "file.txt" The "Debug" folder (and the "Release" folder) are the actual output from your project's build. If you haven't included file.txt in the project and marked it as "Copy to Output Directory", then it doesn't count as part of the build output, and your app shouldn't try to load it.Ba...

 .net                     3 answers                     27 view
 2018-10-22         Jeff

Azure Function stopped working - Could not load type 'Microsoft.Azure.WebJobs.BlobTriggerAttribute'

My always running function stopped working recently. So I started to look what's changed, loaded solution locally in VS2017 and hit compile. Everything seems to be compiling but when I run it locally I get: Error indexing method 'CheckNewBlob.Run' Microsoft.Azure.WebJobs.Host: Error indexing method 'CheckNewBlob.Run'. System.Private.CoreLib: Could not load type 'Microsoft.Azure.WebJobs.BlobTriggerAttribute' from assembly 'Microsoft.Azure.WebJobs, Version=, Culture=neutral, PublicKeyToken=null' ok, I tried to register the binding and tried to install latest A...

 c#                     1 answers                     71 view
 2018-10-22         Jeff

Time Complexity of while loop

What is the Best case, Worst Case and Average Case scenario of the followingcode segment ? def sumInts(n): Count = 0 while i < n: Count = count + n Return count It doesn't run because there's neither an i nor a count defined anywhere.In other words: Best case: crash, Worst case: crash, Average case: crash. [XXX]

 python                     1 answers                     57 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last