Searching text file for string in python

I'm using Python to search a large text file for a certain string, below the string is the data that I am interested in performing data analysis on. def my_function(filename, variable2, variable3, variable4): array1 = [] with open(filename) as a: ...
more »

2017-08-17 21:08 (2) Answers

Adding functions in .cshrc in C-Shell

I want to add custom functions in my .cshrc file to execute some functionality with some inputs through my command line. I'm using C-shell. is there any way I could implement this or any work around to get the desired result? ...
more »

2017-08-17 16:08 (1) Answers

Return array of objects from function - VBA

I need to "return" an Array of Objects from a function that I created using VBA. When I try to set the function as the array it gives me an error message, saying Object is required. I am not very used to VBA, and I can't fix this. Here is the ...
more »

2017-08-17 14:08 (1) Answers

Convert datetime to date using a function

I have one column in my database that I need to convert from datetime to the date data type using a SQL Server function. I can't figure out how to get the correct syntax. Could I get some help with the syntax so IntelliSense will stop yelling at me a...
more »

2017-08-17 04:08 (1) Answers

Product of 2 fibonacci numbers

My assignment: Given a number, say prod (for product), we search two Fibonacci numbers F(n) and F(n+1) verifying F(n) * F(n+1) = prod if F(n) * F(n+1) = prod Your function productFib takes an integer (prod) and returns an array: [F(n), ...
more »

2017-08-17 00:08 (6) Answers

How to edit post meta data on Wordpress blog

I am trying to edit the post meta data on my Wordpress blog to include: Author(no link) Date(no link) Page(with affiliate link to page on my site) under every Post Title. I am using the Activello theme and have installed a child theme. I am tryin...
more »

2017-08-16 23:08 (0) Answers

Excel - Advanced Sorting Function

I have a tournament spreadsheet that has a list of names in column "D" (between 20 and 150 entries) and the table number that each person is assigned to (column "E"). In column "I", I have a ridiculous formula that creates a list of the number of ...
more »

2017-08-16 21:08 (3) Answers

Assign onclick to a function issue

My code to add a onclick function is as followsnewbutton.onclick = whoWon(this.id) Other Relevant Code var winner; function whoWon(name){ winner = name } My problem is that the onclick when i try to assign it executes and doesn't add the oncl...
more »

2017-08-16 17:08 (2) Answers

Defining a function with this if statement

Not sure if I'm doing this right so hopefully someone can help. I have to define an 'explode' function that takes in a string and adds a space around all letters except the first and last. For instance, calling the function with the string Kristopher...
more »

2017-08-16 11:08 (5) Answers

How to compare two things in qunit test?

Qunit test to check if two things are equal. I have 2 variables i want to compare. var currentVector = scene.up; var expectedVector = new THREE.Vector3( 0, 1, 0 ); they return the following: assert.equal( currentVector, expectedVector, "Vector...
more »

2017-08-16 06:08 (1) Answers

Getting error while running function using T-SQL

I have created small table value function using T-SQL which takes one input parameter phone number as and returns area code from it. Function compiles successfully but when I run it I am getting error: Msg 4121, Level 16, State 1, Line 1776 Can...
more »

2017-08-16 02:08 (2) Answers

Javascript functional logic not working

I am trying to create an object with currency opening balance and closing balance i have the following data var _ = require('underscore'); var accounts=[ { "id":"20", "name":"OASIS MALL-RMB Account", "branchId...
more »

2017-08-15 16:08 (1) Answers

Call two pandas columns in a function?

I have a bunch of URLs I am trying to write to files. I store the URLs in a pandas dataframe. The dataframe has two columns: url and id. I am trying to request each URL from url and write it to a file named id. Here is what I got so far: def get...
more »

2017-08-15 09:08 (2) Answers

Laravel function callback

I need to find certain cues in a string and call functions with these cues Example <?php namespace App\Http\Controllers; class ModulesController { private $modules = [ ['name' => 'someFunction','maxNumber' => 50] ]; public function...
more »

2017-08-15 04:08 (2) Answers

Solving for two parameters using `optim()` in R?

I'm trying to find shape1 and shape2 in dbeta() such that the answer from dbeta() for the two input values: .6 and .8 become 3. I'm using the below optim() but don't get exact result, that is I expect getting values for shape1 and shape2 that when u...
more »

2017-08-15 01:08 (0) Answers

Swift 3 custom parameter types

I'm sorry if this has been asked before, I can't find an answer. I would like to create custom parameter types for a function. Typedef?/Define type direction { LeftToRight, RightToLeft }; Function: class func animateIn (dir:direction) { ...
more »

2017-08-14 22:08 (2) Answers