Tim Tim
10906 questions
1
votes
1
answer
1.5k
views
Ansible with Google Cloud Platform GCE
I used Ansible to create a gce cluster following the guideline at: https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html
And at the end of the GCE creations, I used the add_host Ansible module to register all instances in their corresponding groups. e.g. gce_master_ip
But then when...
1
votes
2
answer
347
views
CSP - How to solve style-src unsafe-inline -when having dynamically positioned page elements
In our app code we allow some objects to drag and drop around the page. Also we have things like popups that need to be positioned below buttons and dialogs that we position in the page ect.
To do so we need to allow the following inline css properties
z-index
top, bottom, left, right
height, width...
2
votes
5
answer
58
views
Can XPath and XQuery work on HTML documents?
I heard that an HTML document is not a XML document from https://stackoverflow.com/a/39560454.
XPath and XQuery work on XML documents. Can they work on HTML documents, and why?
Although I don't know why, I guess XPath can work on HTML documens, because of https://www.quora.com/Why-do-we-use-XPath-in...
1
votes
2
answer
71
views
using boolean expressions instead of if/else or similar condition
I need to use boolen expressions instead of using terms such as: c: b? A, switch, else ... if. and using for / while-do / while as if is also not allowed.
My question is when receiving a name, based on its value we decide what to print. For example, if the name is shorter than 6 letters we print 'pl...
0
votes
0
answer
3
views
Inconsistent error message ''Action not allowed (line 298, file “<functionName>”)"
Context
Using g-suite, I have a google form that users submit information to a google sheet. Code aligned to the google sheet takes the submitted information and outputs a google doc/pdf. This final doc/pdf is created by copying a master doc template, merging/appending sections from other template d...
1
votes
1
answer
1.1k
views
What's the correct way to use Effort with Entity Framework 6?
I'm trying to get some test code working using the Effort data provider with Entity Framework 6. What I'm trying to do seems like it should be the absolute simplest use-case, but I'm just not able to get things to work.
Here is my DbContext class:
public class CcdReductionFrameCatalogue : DbContex...
0
votes
0
answer
17
views
Different text in footer, depending on `lang` attribute
We want to create pdfs out of doocbook xml documents, via an fop-processor using the docbook-xsl stylesheet distribution and a customization layer.
In the docbook's header one can find a language attribute, so the author can decide what language the document should be published in.
For our purposes...
1
votes
2
answer
69
views
find world-writable files with powershell
I can use this command on my Win10 machine to discover files that are writable by everyone (within the current dir hierarchy):
get-childitem -recurse | get-acl | out-string -stream | select-string -pattern 'everyone'
That works fine but on my Win7 machine the out-string -stream seems to truncate the...
1
votes
1
answer
71
views
dplyr: divide all values in group by group's first value
My df looks something like this:
ID Obs Value
1 1 26
1 2 13
1 3 52
2 1 1,5
2 2 30
Using dplyr, I to add the additional column Col, which is the result of a division of all values in the column value by the group's first value in that column.
ID O...
1
votes
1
answer
45
views
How can I mock a simple method using Moq framework?
Let's say I've a simple method which checks whether the passed number is Even & returns a boolean value. I'm new to mocking & trying it out. How can I mock this method using Moq framework?
public bool isEven(int x)
{
bool result = (x % 2 == 0) ? true : false;
return result;
}
1
votes
1
answer
40
views
Access VBA Application.Quit Closing Multiple Databases
I created a launch app for the database users to open the front end of a particular database. For example, the users open the launch app (which is an Access DB on a shared network), which then performs the following actions:
Copies the front end db from the shared network location to the user's loca...
1
votes
2
answer
26
views
Should the Locators have awaits and is that causing flaky tests?
We're testing JS apps with protractor and sometimes we get some randomly unstable tests. Sometimes the errors are Failed: stale element reference: element is not attached to the page document
Just a hunch but sometimes developers write the code like this
await element(await by.css('.pager-next')).cl...
1
votes
4
answer
1.7k
views
Selecting an option in a dropdown menu based on node value?
Is there a way to set the value of a dropdown list in jQuery (or Javascript) based on the node value?
Animal Kingdom
Epcot
Hollywood Studios
Magic Kingdom
Downtown Disney
I'd need to set the option of Magic Kingdom, so something like:
$('#ddlLocation').val('Magic Kingdom')
So that Magic Kingdom woul...
-1
votes
0
answer
19
views
Form controls appearing very big
I'm working on a project in asp.net mvc5 using .net 4.6.1. Apparently in my view my controls appear very big and i don't know why. Any suggestions?
I Already tried a few different designs of code but witouth any good results.
@model Firewall.Models.Rules
@{
ViewBag.Title = 'Rules';
}
@using (Html.B...
1
votes
2
answer
404
views
Using number_with_precision in Ruby on Rails 3.0.5 on numbers with large precision
I am working on a Ruby-on-Rails 3.0.5 application, which has numerous numeric fields. It has been decreed by those above, that all numeric 'quantity' fields be stored with a precision of 15 (i.e. 15 digits after the decimal place).
In one particular field, the number stored is 99999.999999999900000...
1
votes
2
answer
4.4k
views
How to show the hidden files and hide the shown files with ls?
To list files I use ls. I know how to list almost (-A) or all (-a) of them. But when I try to show the hidden files and hide the shown files I'm out of luck with:
ls --hide='*' -A
The behavior that the -A option neutralizes the --hide option is described in the documentation of ls.
So is there anoth...
0
votes
0
answer
9
views
Is there a way to loop through an array list grabbing 2 parameters then set those parameters
First proper question on Stack Overflow, I apologise if the question is bad, rather than downvote please explain how I can better the question and I will update immediately.
I am trying to get the dropItem method to loop through and getItemName and getItemDescription. I then want to use both these p...
1
votes
0
answer
59
views
Haskell - can't generate and use Image file in threepenny
I will try to be as specific as possible.
I am trying to make a graph visualization GUI using Haskell, Threepenny and DOT
I have created buttons that modify the graph, and I am trying to save the modified graph in the image and load that image Every Time the graph is modified
However, I can run the...
1
votes
1
answer
178
views
SVG linearGradient mask not working since Firefox Quantum
https://codepen.io/timbarden/pen/wpqGYE
In Chrome, this works as intended - it should display a purple/green gradient masked by another vertical gradient. This used to work in Firefox, but since Quantum has stopped working.
Any ideas?
1
votes
1
answer
20
views
JPA Query with Joins and a Custom Obj that is not Table
I am doing a join with a native query. The returned object is a new object that contains all the attributes in the query. But it throws an error saying it can't bind object[] to CombinedObj. What do I do?
public interface SettingsRepository extends JpaRepository {
@Query(value = 'select s.some_va...
1
votes
0
answer
129
views
Python selenium: Need help in selection using ActionChains
How to select these 2 devices using ActionChains?
Click and hold some place near B1 and dragging the selection till some offset after B2 to select B1 and B2.
Need to select 2 devices BL1 and BL2.
Xpath for them:
BL1:
dropdown = driver.find_element_by_xpath(
'.//*[@class='n9k healthscore90 sb-node']...
1
votes
0
answer
283
views
Why is Instagram not using signed URLs?
I was just dabbling a little with the Instagram API and noticed that all the media links (e.g. image / video URLs) that point to the fbcdn are publicly accessible.
I usually try to use signed URLs for user-generated content and was wondering why Instagram apparently is not choosing to do that?
If...
1
votes
0
answer
456
views
Excel for Mac - Macro crashing Excel - Works on Windows
For our work-planning we created an excel document with integrated macro, so the document can be exported in a specific format for importing it in another program. The document was created on a windows pc with the latest version of Excel. The macro works perfectly on Windows. At home I use my Mac. I...
1
votes
0
answer
52
views
How can I print the entire webpage at this url to a pdf file?
I would like to download and convert https://spring.io/guides/gs/maven/ into a pdf file
But I tried several options of wkhtmltopdf in the following commands, and they can only print the beginning part of the webpage
wkhtmltopdf https://spring.io/guides/gs/maven/ 'Building Java Projects with Maven.p...
1
votes
1
answer
58
views
Mock rootView of Caliburn.Micro WindowManager
Given I have a method like this:
public void ShowDialog()
{
TestViewModel vm = new TestViewModel();
_windowManager.ShowDialog(vm);
DialogResultTest = vm.CoolText;
}
Now I want to write a test. In that test I want to inject a prepared TestViewModel into the ShowDialog(vm) method. My code looks like t...
1
votes
0
answer
90
views
R Markdown code chunks missing code after site build and serve
I built a static website in RStudio using blogdown. I'm using the Even theme. When I publish a post, using R Markdown, that includes a code chunk, such:
```{r, echo = TRUE}
#linear model
car_lm
1
votes
0
answer
57
views
Intermittently get blank screen when opening code file
Sometimes in Visual Studio 2017, when opening a code-behind file, the page is empty.
If I close all the tabs, and reopen the same file from the Solution Explorer, the code will display.
Is there something about the way the project file is being saved, when tabs are left open, that might be causing...
1
votes
1
answer
71
views
DbContext returns wrong id after add
I have Pin Model
public class Pin
{
[Key]
[Column('pin')]
public int Id { get; set; }
[StringLength(50, MinimumLength = 1)]
[Column('desc', TypeName = 'varchar')]
public string Description { get; set; }
}
I have MyDbContext
public class MyDbContext : DbContext
{
public MyDbContext() : base('DbName')...
1
votes
0
answer
202
views
invalid argument '-mmacosx-version-min=10.12' not allowed with '-mios-simulator-version-min=7.0'
I am building llvm-3.4 with clang in Mac OS 10.12, but after I successfully configure it with
cmake-3.8.0(LLVM_ENABLE_PIC=FALSE,LLVM_TARGETS_TO_BUILD=ARM;Mips;X86,CMAKE_INSTALL_PREFIX=/my/install/path/)
I build the program with Xcode 9.0, but I get this error message:
clang: error:invalid argument...
1
votes
0
answer
208
views
Illegal reflective access to method java.nio.DirectByteBuffer.cleaner()
I am using jpdfbookmarks with 2.5.2 version.
$ jpdfbookmarks_cli spec.pdf -dump -o orig.jpdf
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.lowagie.text.pdf.MappedRandomAccessFile$1 (file:/home/t/program_files/document/bookmark/jpdfbookmarks-2....
1
votes
1
answer
521
views
Owin/Katana UseJwtBearerAuthentication Always Returns 401
I need to implement JWT Bearer Authentication in both a .NET 4.6.1 Web API project, as well as a .NET Core 2.0 web project.
I successfully got the core project up and running with the this sample from Microsoft.
I'm following this sample from Scott Allen for the .NET 4.6.1 project.
My 4.6.1 code lo...
1
votes
1
answer
394
views
Typescript Currying and Async Functions
[email protected]
In typescript writing definitions for manually curried functions. They work when the final return value is a non-promise, but fail when it is a promise. For example, this works:
function test (
a: number,
): (
b: number,
) => number
function test (
a: number,
b: number,
): numbe...
1
votes
0
answer
37
views
PyInstaller: Support cmd and Gui mode?
Is there a way to make my PyInstalled Pythoncode run either in CMD or in GUI mode?
My intention is: If the user drops a file to my .exe file, I want to immediately start processing it (and therefore show the results within the CMD window as usual), if the user does not drop a file, I want to show a...
-1
votes
0
answer
27
views
Swift, Xcode - Open ViewController only once per use
My intention is to add a tutorial to my app, which is supposed to show only once per user.
So far my approach has been to create a func which is being called when viewDidLoad:
func checkInitialVc() {
firstTime = defaults.bool(forKey: 'firstTime')
if firstTime {
let initialData = self.storyboard?.i...
1
votes
2
answer
36
views
How do I center an inline list to fit all screen sizes?
Here is CSS:
.wrapper{
display: inline;
line-height: 2em;
width: 100%;
height: 100%;
min-width: 1000px;
min-height: 1000px;
text-align: center;
}
ul{
list-style: none;
}
li{
list-style: none;
}
.craftbeers{
color: white;
margin-top: 85px;
display: inline-block;
}
.craftbeers h2{
margin-left: 40px;
}...
1
votes
0
answer
40
views
Text en/decoding issue
I'm hoping someone can relieve me of my ignorance here: I'm using python 3.6.4 currently and I'm trying to convert strings to simple alphanumerics.
I've got the how mostly sorted until I get to characters with diacritics. It involves football team names so I'm looking to convert, by way of example,...
1
votes
1
answer
56
views
How to pass data between two contexts in MVC with Entity Framework
In my MVC app with Entity Framework, I have 2 contexts. One is for my business data (DemoPoolEntities) and the other is for the ASPNet identity data such as ASPNetUsers and ASPNetRoles(ApplicationDbCcontext). The data is all stored in the same database. I have them split into two different models...
1
votes
0
answer
45
views
Python - API / wrapper function design pattern
I'm implementing API which takes users' code and execute at my server.
For instance, user submits the code as following
push('item')
then I want to execute this string code in the users's context, such as
users_stack.push('item')
What would be the design pattern and how do I convert user's code this...
1
votes
1
answer
95
views
C++ function accepting any callable of a given templated signature
If I understand it correctly, the standard way to write a function that accepts any callable as a parameter is:
template void myFunction(Fn&& f) { ... }
I would like to do something similar, except I want to be able make Fn conform to a certain signature and I need to know the type of its parameter....
1
votes
1
answer
64
views
How do I wait for third part application to finish updating. GUI
I'm using the unmanaged windows automation api from C# to automate a third party application. I use this to select a list item in list A in the third part application. This causes the third party application to change the list items in list B. List B items are logically child elements (not in terms...