Posts

Showing posts from February, 2015

java - Radio Button Project with null point errors -

how fix it? -------------------configuration: questions - jdk version 1.8.0_25 - -------------------- exception in thread "main" java.lang.nullpointerexception @ question3.(question3.java:103) @ question2.(question2.java:51) @ questions.main(questions.java:17) //////////////\ output of whole program hey need project, don't know how fix it. i'm new @ this, in advance helping. this first class, named questions /** * @(#)questions.java * * questions application * * @author * @version 1.00 2015/5/22 */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class questions { public static void main(string[] args) { question2 frame = new question2(); frame.setsize(800,600); frame.setvisible(true); } } this 2nd class, name question2 /** * @(#)question2.java * * * @author * @version 1.00 2015/5/22 */ import java.awt.*; import java.awt.event.*; imp...

sql server 2012 - table created in SQL management studio will not show up in Visual studio -

table created in sql management studio not show in visual studio when try create light switch app. added new table appendix existing database existing tables. native tables show up, except new one. idea? table exist in server explorer not in solution explorer

how to dynamically choose row labels using tabulate in python -

i have dictionary keys strings , values lists of integers. created follows: table_dict_of_lists = {} label in return_dict_keys: temp_list = [] dict_list in stats_list_dict_list: temp_list.append(len(dict_list[label])) table_dict_of_lists[label] = temp_list when run following: for k, v in table_dict_of_lists.iteritems(): print k, v i following: agentsgtx [566, 0, 0, 69, 134] pure_user_dict [11818, 0, 0, 627, 1910] inv_a_id_user_id [857, 0, 0, 73, 135] user_email_id_dict [18005, 0, 0, 800, 2669] ruurl_set [1288, 0, 0, 107, 247] user_id_invite_dict [9772, 0, 0, 473, 1578] pure_users_with_agents_dict [11060, 0, 0, 580, 1825] user_id_email_dict [18066, 0, 0, 800, 2682] this in service of trying dynamically print data table using tabulate . i've got: first_table = table_dict_of_lists f.write(tabulate(first_table, headers = "keys")) needless say, puts the keys column headers. i've looked here don't see answer. how keys l...

javascript - Window.onload Scope -

let's have following code: var x; window.onload = function(){ x=4; }; console.log(x); the console doesn't output 4, undefined. does know how able access changed x variable outside of window.onload function? thanks in advance! this has javascript's async behavior. console.log doesn't happen after window.onload has fired. they're separate events. if want output x, need var x; window.onload = function(){ x=4; console.log(x); };

javascript - Animate Header based on different scroll positions -

currently have header animates (squishes) smaller version different logo , different nav after scrolling amount of pixels. if user scrolls past pixel amount (170 in case), header expands normal state. (because there long pages on site) client wants header 'expand' time the user scrolling in up. think getting close, events firing zillion times when begin scroll page. here current javascript: function squishheader() { compactheader = true; header.animate({height: '48px'}, 500); mainnav.fadeout("fast"); logo.fadeout("fast"); scrolllogo.delay(300).slidedown("fast"); if (overlayisvisible == true) { overlay.fadeout("slow"); overlayisvisible = false; } } function expandheader() { compactheader = false; header.animate({height: '130px'}, 100); scrolllogo.css("display", "none"); logo.fadein("slow"); mainnav.delay(300).fadein(...

javascript - Find the substrings in a string and put them in an array -

so have string (line-breaks added): var str = '[{"id":1,"type":"one","status":"pending","user_id":2}, {"id":2,"type":"two","status":"pending","user_id":14}, {"id":3,"type":"three","status":"queue","user_id":5}, {"id":4,"type":"four","status":"queue","user_id":8 }]'; what algorithm can use type values in 1 array? result "one", "two", "three", "four" . if you're writing es6, following @arunpjohny: array.map(elt => elt.type) or [ (elt of array) elt.type ]

python - Optimizing py2neo's cypher insertion -

i using py2neo import several hundred thousand nodes. i've created defaultdict map neighborhoods cities. 1 motivation more efficiently import these relationships having been unsuccessful neo4j's load tool . because batch documentation suggests avoid using it, veered away implementation op of this post . instead documentation suggests use cypher. however, being able create nodes defaultdict have created. plus, found difficult importing information first link demonstrates. to reduce speed of import, should create cypher transaction (and submit every 10,00) instead of following loop? for city_name, neighborhood_names in city_neighborhood_map.iteritems(): city_node = graph.find_one(label="city", property_key="name", property_value=city_name) neighborhood_name in neighborhood_names: neighborhood_node = node("neighborhood", name=neighborhood_name) rel = relationship(neighborhood_node, "in",...

javascript - Pass object to underscore.js template -

i'm trying pass object underscore.js (1.8.3) template , use in template script. simple example console: > t = _.template("<% console.log(data) %>", {data: 42}) > t() uncaught referenceerror: data not defined what correct way pass object template script use inside? note: know substituting simple values, this: t = _.template("<%= data %>") t({data:42}) <- "42" but need pass , use objects in more complicated script. update this works: > t = _.template("<% console.log(data) %>") > t({data: [1,2,3,4,5]}) i swear i'm not crazy (well not much)... looking @ this tutorial on backbone.js passes object template("...", object) . perhaps way did in older version of underscore.js (version 1.4.2 in video)? since version 1.7.0 underscore templates no longer accept initial data object. _.template returns function now.

How do you rewrite this Scala class with variable fields in a more functional style? -

class myclass { var myfield = list.empty[double] var mysecondfield = list.empty[double] def mymethod = { // code heavy computation myfield = mycomputationoutput mysecondfield = mysecondcomputationoutput } } i avoid saving state in myclass, seems convenient store computed values during mymethod call. what design alternatives? if caching results of heavy computations, use memoize pattern . compute result first time , return if parameters same: class myclass { var myfield = option[list[double]] = none var mysecondfield = option[list[double]] = none def mymethod = { if ( ! myfield.isdefined ) { myfield = some(mycomputationoutput) } if ( ! mysecondfield.isdefined ) { mysecondfield = some(mysecondcomputationoutput) } } } if values never change, consider computing them first time referenced, using lazy evaluation: class myclass { lazy val myfield = mycomputationoutput lazy val mysecondfield = mysecondcom...

time - What is the real code behind digital clocks? Java -

i know it's kind of naive question, , maybe out of place, wondering secret behind functionality used calculate right timing seconds, minutes, , hours in computers? since, know, computer doesn't create things itself, , numbers doesn't increase in time while adding ones, somehow, in case? explain how exactly? maybe provide java code make better understanding of how it's implemented computer. these systems rely on real time clock . this hardware device uses quartz crystal , keeps track of time, , draws next no current, , can remain counting on nothing more button cell few years. devices gps location devices rely on gps signal time. still way these devices functions having precise crystal oscillated @ known frequency, these ticks counted calculate time. in event of drift, next time system boots , talks time server, may update value on rtc.

asp.net mvc - K ef command gives "k : System.Exception: Unable to locate project.json " -

Image
when try add migration, "k" gives me following error: k : system.exception: unable locate project.json @ line:1 char:1 + k web + ~~~~~ + categoryinfo : notspecified: (system.exceptio...te project.json:string) [], remoteexception + fullyqualifiederrorid : nativecommanderror bij microsoft.framework.runtime.defaulthost.initialize(defaulthostoptions options, iserviceprovider hostservices) bij microsoft.framework.runtime.defaulthost..ctor(defaulthostoptions options, iservice provider hostservices) bij microsoft.framework.applicationhost.program.main(string[] args) here global.json: { "projects": [ "src", "fooddelivery" ], "sdk": { "version": "1.0.0-beta4" } } i have following directory structure foodpick foodpick/src foodpick/src/fooddelivery foodpick/src/fooddelivery/project.json foodpick/src/foodshare foodpick/artifacts foodpick/global.json i want execute k ef migration add fooddelivery...

php - Check if session data isset and apply error to each item -

i have following large amount of session variables, there way can shorten code apply variables rather repeatedly writing out if(!isset($_session['whatever'])) , adding apropriate error errors array. if(!isset($_session['fiat'])) { $errors[fiat] = 'please enter valid amount'; } if(!isset($_session['contact'])) { $errors[contact] = 'please enter valid contact'; } if(!isset($_session['name'])) { $errors[name] = 'please enter valid name'; } i have tried things loops , arrays struggling after serious googling, appreciated. thanks! i have made following array unsure how use it: $errors = array( $_session['fiat'] => 'please enter valid amount', $_session['contact'] => 'please enter valid contact', $_session['name'] => 'please enter valid name', ); do following? not sure goes inbetween. for(!isset($errors)){ } what can following: $errors ...

python - Pandas: How do I check for value match between columns in same dataframe? -

i complete coding novice , have been experimenting pandas. first post. thank in advance help! i remove rows cat1 not match either dog1 or dog2. not have match both, 1 or other. cat1 dog1 dog2 0 red red blue 1 red green blue 2 blue red blue 3 blue blue green 4 red green blue i end result follows: cat1 dog1 dog2 0 red red blue 2 blue red blue 3 blue blue green how do this? this simple: df.query('cat1 == dog1 or cat1 == dog2')

java - Android Can't Get Cached Image From File Path -

we have cordova app. getting image passed me saved in cache. i need make file string url: file picturefile = new file(fileurl) however when try load image file keeps failing (file not found). a sample of passed this: file:///data/data/co.appname.app/cache/tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg i have tried making following urls , none work when create file /data/data/co.appname.app/files/tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg file:/data/data/co.appname.app/files/tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg i tried taking file name tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg , getting cached directory directly , didn't work either string path = getfilesdir().getabsolutepath() + tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg that ends /data/data/co.appname.app/files/tfss-4cb94488-1843-4ad3-8d02-8802008c7186-1685720347.jpg still comes null. the image has exist there though because uploa...

python - self referential many to many flask-sqlalchemy -

i life of me cannot figure out why self-referential many-to-many not happy: minor_contains = db.table( 'minor_contains', db.column('parent_id', db.integer, db.foreignkey('minors.id'), primary_key=true), db.column('contains_id', db.integer, db.foreignkey('minors.id'), primary_key=true)) class minor(db.model): __tablename__ = 'minors' id = db.column(db.integer, primary_key=true) name = db.column(db.string()) ... contains = db.relationship( "minor", secondary=minor_contains, primaryjoin="id == minor_contains.c.parent_id", secondaryjoin="id == minor_contains.c.contains_id", backref="contained_by", lazy='dynamic') i've tried reworking few different ways based on examples i've seen sqlalchemy , flask-sqlalchemy, consistently end either following error message or end in infinite ...

javascript - Multiple social share buttons with different links -

i have implemented jquery social sharing solution on website of this article . had modify code since have multiple posts on 1 page these buttons. have set 'data-href' attribute buttons container in php, shows correct link every post, script gets attribute of first one, every popup window tries share same post. how should modify code different 'data-href' values? $(document).ready(function(){ var pagetitle = document.title; //html page title var pageurl = $('.share-btn-wrp').attr('data-href'); $('.share-btn-wrp li').click(function(event){ var sharename = $(this).attr('class').split(' ')[0]; //get first class name of clicked element switch(sharename) //switch different links based on different social name { case 'facebook': openshareurl('https://www.facebook.com/sharer/sharer.php?u=' + encodeuricomponent(pageurl) + '&amp;title=' + encodeuricomponent(pagetitle))...

matlab - How to run GUI in my script -

i using cvap clustering toolbox based on gui. after loading data, using run clustering , run validation commands, respectively. then, choosing error rate option tool menu. need repeat process 20-30 times. and,in each time need save , open result file, @ clustering outputs.to avoid manual process, there way run gui in script? basically, need "click" run clustering , run validation button choose error rate tool menu in script. here simple example of how use gui script. assuming know gui's should make sense. if not let me know. first handle of gui guihandle = guidata(guiname); then in script can press buttons (execute button callback function) using type of command: guiname('callback_functionname',guihandle.callback_functionname,callback_inputs,guihandle); this run whatever callback does. make sure before have manipulated whatever inputs button callback need. mentioned you'll need choose error rate option. since don't know exact code it...

using string to break out of loop in java -

i break out of while true loop if user enters in "stop" scanner. scanner takes in integers , believe problem lies. if try type in "stop" many errors saying "exception in thread main". here snippet of code: public class algorithm { private scanner input = new scanner(system.in); int n; while (true){ system.out.println("eneter number check if odd or even, hit enter: "); system.out.println("type 'stop' end program"); n = input.nextint(); string strn = string.valueof(n); //convert integer string if (new string(strn).equals("stop")){ //if string stop, breaks system.out.println("thanks using program"); break; } if (n % 2 == 0){ system.out.println(n+" even"); continue; } else{ system.out.println(n+" odd"); continue; i know missing closing curly braces rest assured there in actual code. thanks. here e...

Redirect Loop with Heroku and Rails 4 App -

my app runs fine locally, when push heroku, in firefox says "the page isn't redirecting properly" (i.e. 302 error). running heroku logs results in bunch of requests this: 2015-06-02t21:30:26.556750+00:00 heroku[router]: at=info method=get path="/" host=www.mydomainname.com request_id=a0cb3aa2-af7c-431a-9cc4-a237e551ae0a fwd="173.27.229.45" dyno=web.1 connect=2ms service=13ms status=302 bytes=499 2015-06-02t21:30:27.761039+00:00 heroku[router]: at=info method=get path="/" host=www.mydomainname.com request_id=32026d7d-2167-4058-8ef6-8ebd15af7460 fwd="173.27.229.45" dyno=web.1 connect=2ms service=12ms status=302 bytes=499 2015-06-02t21:30:27.914344+00:00 heroku[router]: at=info method=get path="/" host=www.mydomainname.com request_id=2087a90c-fd56-4d14-b630-9c92fda30c80 fwd="173.27.229.45" dyno=web.1 connect=1ms service=15ms status=302 bytes=499 when run "network" option under firefox's deve...

javascript - D3 animate donut chart while updating it with different data length -

i tried find answer on internet couldn't. saw lot of similar quations not need. so, have donut chart text labels. need update new set of data. problem new data different. example. first set of data: var data1 = [{key: 'label1', value: 3}, {key: 'label2', value: 5}]; and second data set is: var data2 = [{key: 'label1', value: 25}]; so, difference in data array length. can different change data clicking button. i used http://bl.ocks.org/dbuezas/9306799 example build donut , woking propely when data changes equal data length, when data length different animation dousn't work. reload itself. can me out here? i copy directly example , change call , works http://codepen.io/luarmr/pen/jdwbme var data1 = [{label: 'label1', value: 3}, {label: 'label2', value: 15}]; var data2 = [{label: 'label1', value: 25}]; change(data1); i think problem key of hash 'label'

AngularJS - How to separate controllers/modules? -

i have 1 application has 2 pages. 1 - list of users 2 - can manage particular user in order organize create 2 separated controllers , 1 module inside app.js file , put stuff (custom filters, directives, factories...) now want separate things in diferent files (or maybe folders too). how can this? angular.module('app', []). controller('listcontroller', function ($scope) { ... }). controller('managecontroller', function ($scope) { ... }). factory('api', ['$resource', function($resource) { return { ... }; }]). filter('formtadata', function(){ return function(data, modo){ ... } }). other issue controllers have different dependencies , in actual way have include them in module (and scripts on page) if page don't need them. appconfig.js angular.module('app', [dep1, dep2]); listcontroller.js angular.module('app').controller('listcontroller', function ...

sql - Find what application is connected with what login to what database what table and what columns -

is there script finds current activity application->login->database->table->column level ? i have used sp_who2, sp_who2'active',sysprocesses activity monitor audit profiler trigger extended events and coludnt column level data connections, able sql statements, table name, database,instance, application, login name ...but couldn't column names the reason trying find track usage , re architect database.. any appreciated sp_who2 , sp_who ones have used required information. can check against sys.sysprocesses know processes running on instance of sql server. if want columns involved in queries consider using sql server tracing probably.

gwt - ListGrid / ListGridField - Hover message while editing -

is there way show hover message on editable cell/listgridfield while in edit mode? was able have hover message on cell in non-edit mode : cusipfield.setshowhover(true); cusipfield.sethovercustomizer(getcusiphovercustomizer()); thank you you should able manipulate properties of editor created when enter edit mode field through appropriate formitem , listgridfield.seteditorproperties(formitem editorproperties) method. example, if field storing texts, shall create textitem , define hover text using setprompt(java.lang.string prompt) method. use textitem set editor properties field.

c# - create a panel for login using MVC /account/login -

using mvc4/5's auto generated code there shared _loginpartial.cshtml allows me call small (login) box in cshtml view @html.partial("_loginpartial") pretty cool , responsive element change depending on if user logged or not , show username. my goal have drop down panel, wondering if put jquery in mix , on click show page. here's code tried. $(function () { $('#loginbtn').on('click', function () { var path = '/account/login' $("#logincontent").load(path); }); }); </script> <button id="loginbtn">login</button> <ul class="sub-menu"> <li id="logincontent"></li> this passes in view doesn't show inside floating panel. here it's pushing page down. is there c#/razor equivalent can place in _loginpartial.cshtml or ...

asp.net - Using date picker control how to enable particular days -

using date picker control want enable saturday , remaining dates should disabled. you need use datetimepicker.mindate property property of datetime picker control have minimum date , time can selected in control. again, have set specific date , not saturdays.

rails-controller-testing Gem -

i pulled app edge rails. i've fixed compatibility issues, tests giving errors this: nomethoderror: assigns has been extracted gem. continue using it, add `gem 'rails-controller-testing'` gemfile. the first time occurred, added gem 'rails-controller-testing' gemfile in :test group , ran bundle . according process, gem installed @ version 0.0.3 , getting same errors. how resolve them? try adding in spec_helper.rb rspec.configure |config| [:controller, :view, :request].each |type| config.include ::rails::controller::testing::testprocess, :type => type config.include ::rails::controller::testing::templateassertions, :type => type config.include ::rails::controller::testing::integration, :type => type end end

java - Difference between Websphere Application server and Websphere commerce server -

we trying install patch websphere application server. have got instructions websphere commerce server. wondering if both same , same instruction can applied. do need root access doing websphere installation or owner access websphere installation directory job ? websphere commerce using websphere application server underneath, not same , patching instructions might different. you can find installation instruction each assosiated fixpack here: fix list ibm websphere application server v7.0 for general instruction installing fixpacks , interim fixes see here: installing maintenance packages, interim fixes, fix packs, , refresh packs regarding root user - should use same user used during installation - if root use root, if dedicated user use same user.

c# - how to give relative path -

this question has answer here: loading image relative path in windows forms 2 answers getting path relative current working directory? [duplicate] 5 answers i have image in current project, access it, use absolute path, mybitmapimage.urisource = new uri(@"f:\jcnu\displaydemo1_c#_circlebased\display1\120px-arrow_blue_right_001.png"); want give relative path can move application other path. i can place image sub-folder of project consider well. in advance.

go - How do I pass in an interface{} to a function as a specific structure? -

i trying have generic routine handle messages between specific components. part of involves reading byte array , using json.marshal , json.unmarshal , calling callback. i trying pass interface function expects specific structure, not know type of target structure. in code below, how function r() call function cb() , pass in correct data? package main import ( "encoding/json" "fmt" "reflect" ) type bottom struct { foo string } func cb(b *bottom) { fmt.println("5. ", b) } func r(t interface{}, buf []byte) { _ = json.unmarshal(buf, &t) fmt.println("2. ", reflect.typeof(t)) fmt.println("3. ", t) cb(&t) } func main() { x := bottom{foo: "blah"} var y bottom buf, _ := json.marshal(x) fmt.println("1. ", x) r(&y, buf) } you need use type assertion convert interface{} type function requires. can add error checking appr...

c++ - copy a c string into a char array -

new c, still getting grasp on pointers. i'm trying add copy of c string char array such that char temp[40]; temp[0] = 'a'; temp[1] = 'b'; temp[2] = 'c'; temp[3] = null; char *container[40] = {0}; strcpy(container[0], temp); cout << container[0] << endl; prints "abc". trying make copy because temp being replaced new characters , pointer temp won't suffice want after abc printed. char temp[40]; temp[0] = 'd'; temp[1] = 'e'; temp[2] = 'f'; temp[3] = null; char *container[40] = {0}; strcpy(container[1], temp); cout << container[1] << endl; prints 'def'. p.s have far, doesn't work. i'm not sure if im using strcpy incorrectly, alternatives helpful. you using strcpy correctly, not giving proper memory. why both programs have undefined behavior - write memory pointed uninitialized pointers. to fix this, allocate memory each element of container using malloc : cha...

php - How to populate multiple items on a different page using a search bar? -

hi wondering if help. have developed search bar site on every page loaded using include function same. code can read database @ lose on how send more 1 result page in format need. problem post 2 3 variables next page in url each link of sort , if search bar returns more 1 result each result need 2 3 variables populate next page. link example <a href="page.php?gen=var1&media=var2&order=date_added desc">movies home</a> here search bar code. <?php if(isset($_post['search_term'])){ $search_term = $_post['search_term']; if (!empty($search_term)) { $query = "select title database title '%".mysql_real_escape_string($search_term)."%'"; $query_run = mysql_query($query); $query_num_rows = mysql_num_rows($query_run); $result = mysql_query($query_num_rows); if ($query_num_rows >= 1) { echo $query_num_rows.' results found:<b...

java - How do I check for an empty string in a Boolean statement? -

i have assignment have attach letters "un" word user inputs (unless inputted word has "un" in front of it, in case return inputted word). i'm testing method encountered 1 problem: program keeps returning error if test empty input. here code: scanner keyboard = new scanner(system.in); system.out.print("enter: "); string input = keyboard.nextline(); if(input.substring(0,2).equalsignorecase("un")) { system.out.println(input); } else if(input.equals("")) { system.out.println("un"); } else { system.out.println("un" + input); } so wanted ask how can test empty input/blank string since, evidently, "" quotations not work. you having problem because trying substring of string doesnt have required length. put empty string check first. if(input.equals("")||input.leng...

c# - DataGridView retaining old columns -

i can't quite seem figure 1 out. i'm using datagridview in vs2013. i've got simple script pull tables , update grid view. seems work fine except datagridview seems appending columns instead of replacing them new ones. i've looked around hours , have tried many remedies. perhaps can help? here's code use far: public centralstation(mysqlconnection _myconnection) { initializecomponent(); myconnection = _myconnection; myadapter = new mysqldataadapter(); mycommand = new mysqlcommand(" ", myconnection); mydatatable = new datatable(); mybinder = new bindingsource(); populatetableselection(); } private void button1_click(object sender, eventargs e) { try { mycommand.commandtext = "select * tcpro." + this.tablemenulist.text + ";"; myadapter.selectcommand = mycommand; mydatatable.clear(); myadapter.fill(mydatatable); mybinder.datasource = null; mybinde...

javascript - How to autofocus/autoclick paper-input in polymer 1.0? -

i able use javascript , call .click() or .focus() in order have paper-input ready typing in polymer 0.5.6. 1.0 seems have lost ability. there way have input ready type either using js or using new 1.0 polymer api? according documentation @ https://elements.polymer-project.org/elements/paper-input?active=polymer.paperinputbehavior should work: <paper-input autofocus></paper-input>

python - Why does this lambda require *arg, what difference does it make? -

i came across pretty clever little function takes 2 functions, applies 1 on top of each other given argument x : def compose(f,g): return lambda *x: f(g(*x)) now issue *x , don't see doing here. why couldn't simple x (without asterisk)? here tests: >>> def compose(f,g): ... return lambda *x: f(g(*x)) ... >>> = lambda i: i+1 >>> = lambda b: b+1 >>> compose(this,that)(2) 4 >>> def compose(f,g): ... return lambda x: f(g(x)) ... >>> compose(this,that)(2) 4 >>> def compose(f,g): ... return lambda *x: f(g(*x)) ... >>> compose(this,that)(2,2) typeerror: <lambda>() takes 1 argument (2 given) if g ( that in tests) can take variable number of arguments, lambda *x: f(g(*x)) can useful. otherwise, not much. the aim allow composed function invoked number of arguments, , these arguments passed inner function in composition.

c# - Linq to Sql where condition String NotSupported Exception -

i trying pull password length asp.net tables following linq sql query (from t1 in aspnet_users join t2 in aspnet_memberships on t1.userid equals t2.userid decrypt(t2.password).length< 8 || decrypt(t2.password).length>16 select new { t1.username, t2.email, length=decrypt(t2.password).length}) but when try run code. getting following error. notsupportedexception: method 'system.string a(system.string)' has no supported translation sql. can guys give me idea fix it? you cannot use c# method, in case decrypt , in linq sql. works linq object not linq sql whole linq query converted sql query , compiler fails recognize methods. for this, can convert linq code lambda expression, , make func<> delegate decrypt, , use in clause.

glm - Prediction of Exponential Decay or Logistic Growth in R -

Image
i'm trying predict in r, , i'm not sure syntax should use. know that, polynomial, can do: predict(glm(y ~ x +i(x^2) + i(x^3) +... i(x^n),data=mydata)) which have been successful with, wondering how predict equations of form y = c(1-e^(-kx)) or y = a/(1 + b*e^(-kx)), k>0 i'm not sure example data can give illustrate well... an example: set.seed(1234) # parameters simulated data c<-1 k<-2 # set x values , compute y them x<-seq(-100,120,1)/100 y<-c*(1-exp(-k*x))+rnorm(length(x),sd=0.1) # plot points plot(x,y); grid() # fit fit<-nls(y ~ c*(1-exp(-k*x)), data=data.frame(y,x), start=list(c=5,k=5)) # plot fit lines(x, predict(fit, list=(x=x)), col="red") > fit nonlinear regression model model: y ~ c * (1 - exp(-k * x)) data: data.frame(y, x) c k 1.022 1.987 residual sum-of-squares: 2.147 number of iterations convergence:...

jquery - How do I use Ajax to send to a RESTful API using the data property of Ajax? -

if api this, /controller/action/var1/something/var2/somethingelse and controller expecting data in fashion, how can use data property of ajax send var1 , var2? doesn't use querystring, cannot this , $.post( "test.php", { name: "john", time: "2pm" } ); my rewriterule keeps me doing this, rewriterule ^(.+)$ index.php?url=$1 [qsa,l] it never ? querystring values. isn't way building url outside of .ajax function first?

javascript - How can I avoid CORS restriction for web audio api? -

i trying create visualization audio-stream. run cors trouble when try access raw audio data createmediaelementsource() function. is there way avoid restriction , raw audio data stream on other origins? perhaps using websockets? there 5 ways deal protections against cross-origin retrieval: cors headers -- ideal, need cooperation of third-party server jsonp -- not appropriate streaming content , typically need cooperation of third-party server iframes , inter-window communication -- not appropriate streaming content , need cooperation of third-party server turning off browser protections -- need running browser in custom mode, , should not use browser else server-side proxy -- comparatively slow feasible option

c - C99 pointer to compound literal array of pointers -

note: actively fiddling on over ideone . i have (self-referential) structure: typedef struct t_function t_function; struct t_function { t_function * (* inhibits)[]; // pointer array of pointers structure }; and use compound literals target of inhibits pointer. along lines of t_function a, b, c; a.inhibits = & (<type>) {&b, &c}; this done follows looking understand type specification can use compound literals. t_function a, b, c; t_function * ai[] = {&b, &c}; a.inhibits = &ai; what appropriate type specification replace <type> above? a.inhibits pointer subsequent memory locations forming pointer array. if want assign a.inhibits , need array of pointers somewhere location store in a.inhibits . why there no syntax &(...){&b, &c} : can't right regardless of using ... because there no actual array {&b, &c} in memory. in second example, allocating array of t_function * pointers on stack. ...

Ruby Hash inner another Hash is every empty -

i create method group commits of user per month in hash: def calculate_month_ranking(commits) rank = hash.new(hash.new(0)) commits.each |commit_yml| commit = yaml.load commit_yml.data commit[:commits].each |local_commit| time = time.parse(local_commit[:timestamp]) month = "#{time.month}/#{time.year}" rank[month][commit[:user_name]]+= 1 binding.pry # debug end end rank end but rank[month] have value, if call rank , value every empty. why? [1] pry(main)> rank[month] => {"user1"=>4, "user2"=>1} [2] pry(main)> rank => {} your problem in flowing line, assignment not correct hash rank[month][commit[:user_name]]+= 1 i don't know values, adding here example can try out this declare hash following rank = {} assign values key pair rank.merge!(:month => {:user_name => 'test' }) hear adding console output 2.0.0-p481 :007 > rank = ...