ben ben

12693 questions
1

votes
1

answer
1.9k

views

jQuery trigger not working in Safari

I have a input type file, I set it display none and use the other button to trigger it. I test on every browser, works fine but Safari. $("#file_button").click(function () { $("#image").trigger('click'); });
Ben
1

votes
1

answer
1k

views

PHP files in certain dir result in HTTP 500 error

I'm facing a strange situation. For a website some cronjobs are being executed. This all worked well until now; when I try to excecute a cronjob I'm getting no result. For some reason the URL is recognized by .htaccess trying to put it into the site with wrong $_GET parameters. The second parameter...
Ben
1

votes
6

answer
1.3k

views

How can I detect a html class with javascript?

I use these three lines of code to detect lesser internet explorer versions. Using javascript, how can I find out whether or not the lt-ie8 class is enabled for the element?
ben
2

votes
2

answer
21

views

Generate data.frame from frequency table

I have synthetic data in a 2*4 array with 500 observations: datax = array(c(120, 181, 50, 43, 41, 33,24,8), dim=c(2,4)) dimnames(datax) = list(gender= c('male', 'female') , punishment = c('None', 'Community_service', 'Youth_prison', 'Normal_prison')) I'd like to produce a data.frame from the table t...
ben_aaron
1

votes
2

answer
2.8k

views

getValue formatting is off when pulling a date from spreadsheet

I'm using a script to convert a spreadsheet to a PDF. To define the title of the PDF, I'm pulling in data from a few specific cells, one of which contains a date. The problem is, the date comes out in a long format in the title. Here's a chunk of my code: var ss = SpreadsheetApp.openById("XXXXXXXXXX...
ben.oliver
1

votes
2

answer
1.3k

views

Laravel https route for form

Is there way to submit a form over https using the blade syntax? I have {{Form::open(['route' => 'pages.store', 'class' => 'crud-form'])}} but this uses http://
Ben
1

votes
4

answer
2.3k

views

javascript convert timestamp to 2 digit style of hours/minutes

new Date(timestamp).getHours(); new Date(timestamp).getMinutes(); I have a timestamp, i convert it to h/m, ex.00:00 how can I convert it to the format with 2 digit style, what I have now is 0:0
Ben
1

votes
1

answer
390

views

Replace try { } catch { } block for file upload

I have a file upload using an OpenFileDialog(), so I can read .csv files and add the to a datagrid. However, if the OpenFileDialog is closed without a file selected, it crashes. so I placed it in a try { } catch { } block as a temporary fix. Can someone provide a better solution to a file not being...
Ben
1

votes
2

answer
9.6k

views

Opening local files from chrome

Is it possible to open a local file on the filesystem/network drive (c:\abc.xlsx or p:\abc.xlsx)? If so, is it possible to do it through a custom extension that I create for Google Chrome?
Amit Ben Ami
1

votes
1

answer
573

views

Add a serial column based on a sorted column

I have a table that has one column with unordered value. I want to order this column descending and add a column to record its order. My SQL code is: select * into newtable from oldtable order by column_name desc; alter table newtable add column id serial; Would this implement my goal? I know that r...
Ben
0

votes
0

answer
3

views

Accessing MLFlow UI with a folder name different than mlruns

I set the tracking_uri to a folder name different than mlruns. Is there a way I can open the MLFlow UI pointing to the new folder name for mlruns? I know I can rename the folder back to mlruns, which gets me access to all of my metrics and parameters for each experiment, but the artifacts are not ac...
Ben Fowler
0

votes
0

answer
2

views

Is there a way to create functions in a functionapp in the Azure CLI?

I'm trying to automate the creation of a serverless application using a cosmos db, static webpage, and functionapp (with at least one function) using a script which invokes a local installation of the Azure CLI. I've managed to create the db, the static page, and the functionapp using the CLI, but I...
Ben D
1

votes
1

answer
1.4k

views

Running the selected code in Sublime Text

I have created a "build system" in Sublime Text 3 like so: { "cmd": ["node", "$file"] } I have a file foo.js containing two lines: 01 console.log('foo'); 02 console.log('bar'); If I highlight line 1. Can I run just that line in the build system?
Ben
0

votes
1

answer
16

views

Creating a function for plotting using ggplot2 and providing data frame, x, and y for the function. How to reference the axis the right way? [duplicate]

This question already has an answer here: Passing arguments to ggplot in a wrapper 2 answers R pass variable column indices to ggplot2 [duplicate] 1 answer How to use a variable to specify column name in ggplot 3 answers I want to create a function for plotting using ggplot2 because I will have t...
Ben
0

votes
0

answer
4

views

Dynamic sidebarMenu, reflecting changes in tabsetPanel

I have a dashboardBody that is populated with a tabsetPanel. What I am looking for is a way to give each tabPanel it's own sidebarMenu In my code, when selecting a tab, only the the text in the body changes. How can I extend this code in such a way that the sidebarMenu is updated? I found a few post...
Ben Engbers
1

votes
2

answer
129

views

Two ways of implement Delegation in Swift, what is the difference?

Say for example you have a protocol in Swift: protocol WeatherServiceDelegate: class { func didCompleteRequest(result: String) } Two ways of implementing them: Way 1: Via class inheritance class ViewController: UIViewController, WeatherServiceDelegate { .... } Way 2: Via extension However, Swift...
Ben
1

votes
3

answer
2k

views

How to sort a pandas dataframe by date

I am importing data into a pandas dataframe from Google BigQuery and I'd like to sort the results by date. My code is as follows: import sys, getopt import pandas as pd from datetime import datetime # set your BigQuery service account private private key pkey ='#REMOVED#' destination_table = 'test.t...
Ben P
1

votes
1

answer
51

views

After using msiexec to uninstall a program it remains in the control panel (add/remove programs)

This seems really odd. I have a program installed (via a WiX installer) and I'm trying to uninstall it programatically (using c#) so I use msiexec.exe /x{product-code-GUID}. The program is uninstalled but it still shows in the control panel (add/remove programs). When I look in the registry I see th...
Ben_G
0

votes
0

answer
4

views

the tmux will exit from the terminal iterm2(in mac OS) after leaving operation, with all session running

I use tmux restore my working window in iterm2, but I got a problem that tmux always exit from the iterm2 with session running after a while when I left. But if I don't run in tmux, the window is OK.
Ben
0

votes
0

answer
5

views

Twitter api reply to tweet

I'm trying to write a script to reply to a tweet, using the twit npm module. However whenever I pass the in_reply_to_status_id_str or in_reply_to_status_id this seems to be ignored. Not sure what the issue is? T.get('search/tweets', { q: `golf since:2011-07-11`, count: 1 }).then(function (response)...
Ben Flowers
-2

votes
0

answer
13

views

How to list pairs of primes in increasing order of their sum in Haskell

As a learning exercise, I've been using Haskell to solve a few Project Euler problems. I would like to write a function in Haskell which outputs a list of pairs of distinct prime numbers, such that each pair of prime numbers is included in the list, and the list elements are increasing in the sum of...
Ben
0

votes
1

answer
14

views

Rails string of array of hashes with keys - convert to array of hashes

I have this string which I pass with an ajax call from an API response (I cannot alter the data before sending to Rails, since it is done with jQuery in the view) str = '{"0"=>{"firstName"=>"Testing", "lastName"=>"It", "email"=>"[email protected]"}, "1"=>{"firstName"=>"Tester", "lastName"=>"You", "em...
Ben
1

votes
1

answer
31

views

Confused with how to compare 1 int with 3 others and declare one less than the other three

I am trying to implement a code that seems easy, but I keep missing the point. The problem I am having is I am trying to take my budget and compare it to my prices for items (p's ..). If there is ONLY ONE item that is less than my budget, then I want it to print that. If there is more than one item,...
Ben
1

votes
2

answer
2.4k

views

How do I get CloudFront-Viewer-Country to appear in response headers?

I am attempting to leverage AWS's geotracking feature on CloudFront to inform my UI of user location so that it knows not to load certain files in problematic regions. AWS documentation mentions the following but does not give clear instructions on how exactly to configure CloudFront to forward the...
Ben Inada
1

votes
2

answer
282

views

BotBuilder backchannel event data into session

TLDR: How can I initialise my conversations with data sent from the backchannel and use that information throughout the conversation with a user? Using Microsoft botbuilder, a "backchannel" mechanism is provided with which I can send data to and from the bot. Similar to this answer I am using the ba...
Ben Swinburne
1

votes
1

answer
21

views

How to create couchbase full text search index alias using the api

When creating the full text search index using admin interface, i can use "Show curl command to modify this index definition" option to get a curl command. like this one : curl -XPUT -H "Content-Type: application/json" \ -u Administrator:password http://localhost:8094/api/index/idx_order_customer -...
Lho Ben
1

votes
1

answer
41

views

How do I parse through string looking for specific word/digits and display them if found

I have written some fairly questionable code I'm sure, but it seems to do the job. The issue is that it is printing the data to a spreadsheet and in the column where I am hoping to find the vehicle's year if the first word in the advert isn't the year, then it displays the first word which could be...
Ben Willis
0

votes
0

answer
10

views

Directory users update clearing fields not included in resource

Google's documentation states that Users.update will only update fields included in the userResource object. https://developers.google.com/admin-sdk/directory/v1/reference/users/update In my script, I am able to submit updates successfully, but when I do, fields not specified are cleared out. Here...
Ben
0

votes
1

answer
29

views

Filter on relation field in Django ORM

I have a model Media that has a relationship to a model UserMedia (user ratings). Also there's a model called UserMatchScore (match scores of users) that is relevant to the question. In a view I am querying the Media table, in this view there's an option to only get the media that my matches have ra...
Ben Gosub
0

votes
3

answer
63

views

One specific variable reference is being skipped

It seems like the %s in the final printf is entirely being skipped. This is the entire code: #include int main(void){ char address[100]; char city[100]; char state[2]; char zip[15]; printf("Enter street address: "); scanf(" %[^\n]",&address); printf("Enter city: "); scanf(" %[^\n]",&city); printf("...
Ben R.
1

votes
1

answer
19

views

Combine two MySQL queries to display one unique value and an AVG value for each column

Is there a way to combine two MySQL queries to display one unique value and an AVG value for each column? Such as in this query: SELECT `price`, `cost`, `shipping` FROM `orders` WHERE `year` = 2019 AND `product_id` = 5 AND `order_id` = 77 LIMIT 1 WITH SELECT AVG(`price`), AVG(`cost`), AVG(`shippi...
Ben in CA
1

votes
0

answer
7

views

Passing imported style object into a custom hook does not work as expected

I am trying to create a custom hook which will handle some merging of Aphrodite (https://github.com/Khan/aphrodite) styles for us, but I'm getting some unusual behaviour with the styles object being passed in. Here's my hook: (the plan was to compose with useMemo which is why it's a hook at all) imp...
Ben Slinger
0

votes
1

answer
17

views

SQL Trace record history using ID fields

Firstly I apologize if the subject of this question is not clear or is using the wrong terminology, but I'm not quite sure what I am trying to do is called. I am using SQL Server 2016. I have a table which has the following three columns: PrevID |ID | NextID NULL |ABC1 | ABC3 NULL |ABC2 | ABC4...
Ben
1

votes
5

answer
3.4k

views

How to move an item within a dictionary when the Key equals the order number?

So I have a dictionary that looks something like this: var newDictionary = new Dictionary(); The int (key) within this dictionary is the oder number for the items. So say I have a list like this { 1, "item1" } { 2, "item2" } { 3, "item3" } { 4, "item4" } In my controller I pass what the old item...
Ben
-1

votes
0

answer
17

views

Fragment's findViewById on Recyclerview single item returns null

I am trying to set a StateListAnimator on an item in a RecyclerView which is inside a tabbed Fragment. However trying to call findViewById returns null in onViewCreated. Without the findViewById and setting the StateListAnimator it works perfectly fine. Here is my code snippet: @Override public View...
Ben Brix
0

votes
1

answer
14

views

i want to insert name,description and image into db .what is not correct with my code .i would like to modify it

i want to insert name,description and image to my db .what is the not correct with this code.
ben
1

votes
2

answer
836

views

Ruby if statement - how to avoid multiple elsif statements including not

I am creating a piece of functionality to auto generate descriptions based on attributes I have on properties (in a Rails app). I have created a series of service classes to handle this - here is class RoomDescriptionGeneratorInternetTV < RoomDescriptionGeneratorBase def generate if internet? && c...
Ben Hawker
1

votes
1

answer
689

views

Android Studio: How to see class hierarchy for gradle dependencies

I have included various dependencies in my build.gradle file. For example: dependencies { compile 'io.reactivex:rxandroid:1.0.1' } Is there any way to see the class hierarchy that this provides in Android Studio? e.g. the list of packages and classes. If I include a .jar dependency in my libs folder...
Ben Clayton
0

votes
1

answer
19

views

printf and string concatenation I think; beginner at this future looks bleak

The code works fine. Just looking for information on how to set up my print f and get the desired results. signs more than one print f statement(s) import java.util.Scanner; public class Coupon { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner...
Ben DeRue
0

votes
1

answer
11

views

Set Background Image Including Unsafe Area Programatically (Swift)

Is it possible to have a background image extend into the unsafe areas? I tried the following to set a background image to the Super View and it doesn't work. // viewDidLoad override func viewDidLoad() { super.viewDidLoad() // Set up background image let backgroundImage = UIImageView(frame: super...
Ben

View additional