Benjamin Benjamin

1

votes
2

answer
316

views

React.js .map is not a function, mapping Firebase result

I am very new to react and Firebase and I really struggle with arrays and objects I'm guessing that you can't use .map with the way my data is formatted (or type). I've looked through stack but nothing has helped (at least in my poor efforts to implement fixes). I am trying to use .map to map throug...
Benjamin
1

votes
1

answer
91

views

Function decorator raising positional argument error?

I'm trying to write a function decorator that tests for bounds of x, y #this is my bound test function def boundtest(func): def onDecorator(self, x, y, *args, **kwargs): print(x, y, *args, **kwargs) assert x in range(self.width) and y in range(self.height) return func(x, y, *args, **kwargs) return o...
Benjamin Kosten
0

votes
0

answer
15

views

How to use scss parent selector to select its double selector

I came threw a scenario where I wanted to reference to my parent selector in my sass, later instance I wanted to add the parent selector its double selector animate to perform a certain animation on scroll. Is there a way I can achieve it. Any help would be appreciated. I know it's tricky to explain...
Benjamin
0

votes
0

answer
6

views

Ruby factory method returns a NoMethodError when it's called. What happened?

I'm trying to integrate a factory method into this imperial-to-metric converter. I can make it work independently, but when it's iterated through a hash of ingredients it brings up a NoMethodError. What did I do wrong? I've run independent instance variables through the factory without issue: @item...
Benjamin
1

votes
2

answer
1.2k

views

use of builtin function n with summarize_if

I am attempting a basic dplyr::summarize_if on a df with the built-in n function: ###Seems like this should work df %>% summarise_if(is.numeric, funs(n, mean, sd, min, max), na.rm = TRUE) Error in summarise_impl(.data, dots) : `n()` does not take arguments ###Works fine without the n df %>% summar...
Benjamin Gowan
1

votes
2

answer
1.5k

views

Applying programmatically a coupon to an Order in WooCommerce3

I'm developing a plugin that creates an order directly (no cart) and applies a coupon. In version 3.0 of the woo API the function add_coupon() has been deprecated in favour of a WC_Order_Item_Coupon object you add to the order. Create the coupon $coupon = new WC_Order_Item_Coupon(); $coupon->set_pr...
Benjamin Beaumont
1

votes
2

answer
30

views

React rendering deleted array element after setState()

I'm having an issue where React seems to be rendering a deleted array element after I've removed it from an array in the components state. After setState(), rendering is triggered, but the deleted item is shown, instead of the remaining item (see GIF video below). Although the component is extremely...
Benjamin B.
1

votes
2

answer
46

views

Spark map with many String concatenation

I am looking for a way to optimize a code like this one: // for each line do many string concatenations myRdd.map{x => "some_text" + x._1 + "some_other_text" + x._4 + ...} I just read that use a s"some_text${x._1}..." will be replaced by a basic string concatenation like in my map. So my first tho...
Benjamin
1

votes
1

answer
37

views

Processing an image with block letters for OCR

I would like to OCR this battle log from a game: battle log image The original image had block text font, so after thresholding I inverted the colors. Now I want to remove the "black" background (but not the black text), but I'm not sure how to achieve that in OpenCV. Afterwards I imagine I would li...
Benjamin Ing
1

votes
2

answer
1.8k

views

How to update windows explorer's shell extension without rebooting

There is a windows explorer extension dll. This dll can be update automatically if there is new one in our server. I rename the origin dll and download the new dll. But Windows Explorer never reload a new one. So I kill the windows explorer and relaunch. But this is looked very ugly. And I don't wan...
Benjamin
1

votes
1

answer
494

views

sf 2.6 A2LiX entityTranslation doesn't found

I just want to make a multilingual application site so I red and saw translatable and other bundle. I use translatable and a2lix... so I read the doc but when I try to use a2lix, I get this error message : Class c2c\AppBundle\Entity\PeriodTranslation does not exist 500 Internal Server Error - Refle...
Benjamin Lucas
1

votes
1

answer
130

views

Able to setup credit card as a backup source if checking account charge fails?

I'd like customers to submit checking account and credit card information. Is it possible that if a checking account charge fails, that a credit card is charged automatically? Is it possible to have multiple credit cards as backup? I understand the charge for a failed checking account charge is $3....
Benjamin Bakhshi
1

votes
1

answer
697

views

Is there a coding standard for PHP annotations?

Is there a PHP coding standard that defines unambiguously how to write docblock annotations for properties and methods: @var @param @return @throws including the correct spacing between them? PSR-2 covers the code itself, but does not enforce the usage of annotations.
Benjamin
1

votes
2

answer
109

views

echo two arrays from csv

I have 2 array from data.csv How can I use while loop to print out both array I can only print out 1st array and it keep loop same array. $file = fopen("data.csv","r"); while(!feof($file)){ print_r(fgetcsv($file)); } fclose($file); //////////////////////////////////////////////////////////////// $fi...
Benjamin W
1

votes
2

answer
149

views

How to replicate nested class structure in Ruby

Suppose I have a class A as follows: class A class B end class C < B end ... end And I want to create a class D that has the same nested class structure as A class D Replicate nested class structure of A here end I want D to look like: class D class B end class C < B end ... end So that I can do A::...
Benjamin Godlove
1

votes
3

answer
3.1k

views

JQuery: Change class when radiobutton is clicked

I need some help with javascript. Here is the link to the code in JSFIDDLE: http://jsfiddle.net/Gopher69/B98kZ/4/ My JS is: $(document).ready(function() { //add the Selected class to the checked radio button $('[type=radio]').parent().addClass("selected"); //If another radio button is clicked, add...
Benjamin
1

votes
1

answer
239

views

OCUnit crashes when creating UITextView

Unit testing is handling out humble-pie by the bucketload here at the moment. I am trying to run tests on my BannerAdViewController-class, but everything comes tumbling down when reaching the following line: UITextView *buyAppTextView = [[UITextView alloc] initWithFrame:CGRectMake(8, 2, 304, 50)];...
T. Benjamin Larsen
1

votes
1

answer
273

views

Function casting and the internal representation of the function arguments list in C

I was wondering how does a C compiler (I tried gcc and clang) organize the argument list of functions internally. For this purpose I made a program consisting of two files, for instance: foo.c : double foo (double (*f) (void *, double), void * arg, double x) { return f (arg, x); } main.c : #include...
Benjamin Batistic
1

votes
4

answer
2.3k

views

Syntax error after show create table in mysql

I just want to copy an existing table structure into another database. All queries are executed in phpmyadmin: I first execute: SHOW CREATE TABLE keyword_session Then I execute the output of it in another database: CREATE TABLE `keyword_session` (   `id` int(11) NOT NULL AUTO_INCREMENT, `session_i...
Benjamin Crouzier
1

votes
1

answer
7.2k

views

My JFrame does not refresh

does anyone know how to refresh my JFrame so I can display my new JButton ? private void displayGrid() { Case arrayGrid [][] = Grid.returnArray(); for(int i = 0; i < Settings.returnYGrid(); i++) { for(int j = 0; j < Settings.returnXGrid(); j++) { Case caase = arrayGrid [i][j]; panel.add(caase.getBut...
Benjamin Clanet
1

votes
2

answer
108

views

Join with select SQL query?

I'm trying to run a query on a table (the one Wordpress uses) where I want to select the ID and post_type columns from one table, then do a Left Join to another table, two separate times (getting separate data). This is what I have so far, but it's not cutting the mustard: SELECT derby_posts.id...
Benjamin Allison
1

votes
2

answer
6k

views

Jquery: Uncaught RangeError: Maximum call stack size exceeded

Here is my javascript. It was working well prior to conducting a Git Pull from my partner. On a click the hint loads with fancy box. The load does not work now. Game = { loadLevel: function(levelNum) { $("#level").load("/level/" + levelNum + "/", function() { // disable all hints except the first $...
Benjamin Bakhshi
1

votes
2

answer
590

views

Repository not found error, right after `git remote add`

So I ran git remote add origin again to show that it already exists. The error looks self explanatory. How do I make git push origin master to work here? (ENV)Benjamins-MacBook-Air:rss Ben$ git remote add origin [email protected]:ars/rss.git fatal: remote origin already exists. (ENV)Benjamins-MacBook-A...
Benjamin Bakhshi
1

votes
1

answer
111

views

Javascript console.log Loads Prematurely

I am working with Ian Li's Raphael SketchPad, and am having some trouble saving a drawing. Upon changes on my sketchpad an object with id data is supposed to get updated, I placed a console log "changed" just to check. What happens is that upon loading the screen I see the console log message, and I...
Benjamin Bakhshi
1

votes
1

answer
259

views

Multiple TThread Instances

I have a TThread Class that can run independently and terminates and frees itself after it's done. I considered the termination and everything works. The problem is, that I would like to add a feature that the user can select and choose how many SYNCHRONOUS threads should be active at the same time....
Benjamin Weiss
1

votes
2

answer
160

views

How to get the first elements of COLLECT whithout limiting the global query?

In a twitter like app, I would like to get only the 3 last USERS which has PUBLISH a tweet for particular HASHTAG (A,B,C,D,E) START me=node(X), hashtag=node(A,B,C,D,E) MATCH n-[USED_IN]->tweetme WITH p.date? AS date,hashtag,user ORDER BY date DESC WITH hashtag, COLLECT(user.name) AS users RETURN has...
1

votes
3

answer
155

views

How to create a new function from a method, with fewer arguments?

I have two classes, ClassA and ClassB. ClassA has three methods: double Foo(double, ClassB); double Bar(double (*f)(double)); double Baz(double, ClassB); I would like to define a function Qux inside Foo, based on Baz but without the argument of type ClassB: i.e. of the kind "double Qux(double)" so t...
1

votes
1

answer
56

views

When are PID released?

As far as I know (pardon my ignorance on the subject), when a process fork()s: Each child gets assigned its own PID After a child has exited, the parent is still able to query the child's PID with waitpid() Does that mean that: Because this PID is still "queryable" from the parent, it's still locked...
Benjamin
1

votes
1

answer
463

views

F# Cannot find DLL

I am currently learning F# and working through the samples on tryfsharp.org. I am using the Mono F# on a Mac.The script begins as follows: #r "MathNet.Numerics.dll" open MathNet.Numerics open System.Numerics When starting the script I get the following error message: /Users/benjamin/Desktop/Kalman/k...
Benjamin
1

votes
1

answer
178

views

vim regex for python2 print to python3

So say I have a python v2.7 file with some code like this: print 'asdf' print 'hi mom!' But I want to run it in python3, I'll need to add those parenthesis to them like so: print('asdf') print('hi mom!') I was trying to use the following regex in vim to solve the problem, but it wasn't working: :%s/...
Benjamin
1

votes
2

answer
254

views

Has and belongs_to many or has_many through example with active record

Let's say that I have a fictional car rental application. I have users, cars, and addresses. user (id, name, email) has_many :addresses has_many :cars car (id, name) belongs_to :user address (id, name, user_id) belongs_to :user Each user has multiple addresses and cars. An address is a location wher...
Benjamin Crouzier
1

votes
1

answer
10.8k

views

VbScript to strip space of string?

Say I have a string that = Grilled Cheese How would I echo the string without the space between Grilled Cheese with out changing the string? Also if I had a string that variables but will always have a space, like a full name. I can show the first letter of the string: WScript.Echo Left(strUserName,...
Benjamin Jones
1

votes
2

answer
700

views

WP Toolkit DatePicker won't update value

So in developing an app for Windows Phone 8, I've run into the following problem with the toolkit. Edit: The following is the complete code for a page which reproduces the problem: This looks right, and lets the user select a date, but never updates its value. After clicking on it you are presented...
Benjamin Chambers
1

votes
1

answer
664

views

Messaging gems for rails with the ability to group messages by threads

I have a rails 3 application. I want to add a internal messaging system with the following features: Users have many messages (sent and received) To send a message, a user can type one or many emails in the "To" field. Each email is autocompleted (this doesn't need to be in the gem) Messages can be...
Benjamin Crouzier
1

votes
4

answer
4.3k

views

Phonegap 3.0 FileTransfer download not working

I'm downloading a multi-part mime encoded image to iOS like this: var ft = new FileTransfer(); url = encodeURI(url); ft.download(url, path, function(fileEntry) {}, function(err) {}); with path = "file://localhost/var/mobile/Applications/D702F059-A29F-4FF4-A165-D4A903DEDE7D/Documents/captured/2419747...
Benjamin E.
1

votes
2

answer
101

views

How do I color in active accordion children?

I have a jQuery UI accordion I'm using for navigation. I need to be able to highlight the active parent and it's children in 3 levels. (see image below) I've taken a few swings, but I' having trouble with targeting the active menu and using the right selectors. Fiddle: http://jsfiddle.net/abenjami...
Aaron Benjamin
1

votes
3

answer
90

views

best way to select…where in using linq

There are three tables in the database that are relevant. Advocate, Vendor, and Advocate_Vendor. The Advocate_Vendor table being the many to many link, has a vendorId and an advocateId. My end goal is to get back a List object...a collection of advocates that belong to one Vendor. I wrote this: va...
J Benjamin
1

votes
1

answer
227

views

close() func of http.client.HTTPConnection doesn't work?

Python version I used is 3.3. It is supposed that I can't send a http request, with a closed connection. but actually, it still works after close() function called. Here is my code: conn = http.client.HTTPConnection("192.168.8.186:8081") conn.request("GET", "") response = conn.getresponse() d...
Benjamin Li
1

votes
2

answer
56

views

Most efficient way to return entries with no relationship to another table in MySQL?

I'm developing a table reservation system, and would like to list all Restaurants that have not received any Reservation yet. I've thought of the following approaches: Using NOT IN(): SELECT * FROM Restaurant WHERE id NOT IN(SELECT restaurantId FROM Reservation); Using LEFT JOIN: SELECT rst.* FROM R...
Benjamin
1

votes
3

answer
799

views

Which is more efficient, storing output in variable or output to file?

I am using Robocopy in PowerShell to sort through and output millions of filenames older than a user-specified age. My question is this: Is it better to make use of Robocopy's logging feature, then import the log via Get-Content -ReadCount, or would it be better to store Robocopy's output in a varia...
Benjamin Hubbard

View additional