Posts

Showing posts from April, 2011

c# - How do I remedy this type does not exist in type error? -

i need value script keep getting error says the type name 'head' not exist in type 'steamvr_camera'. my code: using unityengine; using system.collections; using unityengine.vr; public class hmdhelper : monobehaviour { private steamvr_camera.head.localposition hmdlocalpos; //error thrown here. void start() { } // update called once per frame void update() { if (input.getkeydown("g")) { autorotate(); } } void autorotate() { hmdlocalpos = inputtracking.getlocalposition(head); debug.log(hmdlocalpos); } } what have fix error? this script retrieved other value ( hmdlocalpos ) from... //========= copyright 2014, valve corporation, rights reserved. =========== // // purpose: adds steamvr render support existing camera objects // //============================================================================= using unityengine; using system.collection

sqlplus - sql multiple attribute join -

i'm creating test database on medical practices. here picture of er diagram reference. er diagram so question how joins properly. i'm trying give list of patients seen given practice (e.g practice id 1) want show practice name , details. want show list of patients , and gp's work or have been practice (keep in mind have populated tables 10 rows of test data) i have got far select patient.firstname, patient.surname patient join appointment on patient.patientid = appointment.patientid appointment.practiceid in (1) order firstname; `how include practice details , gp details associated practice. what's confusing me how add more select statements if not patient table. great! you can add more join clauses: select patient.firstname, patient.surname, practice.name, practice.address patient join appointment on patient.patientid = appointment.patientid join practice on appointment.practiceid = practice.practiceid appointment.practiceid in

php - Call to DB and Files outside the Public Folder - CodeIgniter -

first post ! ... , i'm in need of :d we using code-igniter base frame our website (custom tailored). way it's programmed, can call website files , databases stored outside public folder (for security reasons), had domain/server transition few days back, , website broken because it's not allowing calls (system_path). after research, found possible cause server not support request_uri variable. so, did work around, no results. the main web works fine, error other ulrs one: internal server error the server encountered internal error or misconfiguration , unable complete request. please contact server administrator @ webmaster@mydomainname.net inform them of time error occurred, , actions performed before error. more information error may available in server error log. additionally, 500 internal server error error encountered while trying use errordocument handle request. i have tried suggestions of codeigniter troubleshoot p

sql server - SSIS Cross-DB "WHERE IN" Clause (or Equivalent) in Azure -

i'm trying build data flow in ssis select records mapping table id column exists in related item table. there 2 complications: the 2 tables in different databases on different servers. the databases in azure, i've read linked servers not supported. to more clear, job migrate data staging environment production. want push lookup records prod if associated item ids in there. here's psudo-tsql give clear goal of i'm trying achieve: select * [staging_server].[sourcedb].[dbo].[lookup] l l.[id] in ( select p.[item] [production_server].[targetdb].[dbo].[item] p ) i haven't found way create in ssis. think i've created work-around involves sorting both tables , performing merge join, sorting both sides unnecessary hit on performance. i'm looking more direct , intuitive design seemingly simple data flow. doing in data flow, you'd have source query, sans filter, fed lookup component subquery. the challenge ssis on-premises means go

wordpress - Woocommerce - Empty cart when products in a specific category are added to cart? -

how can cart empty when product specific category added cart, in woocommerce? i found following code empties cart when product added cart, need apply when product specific category: add_filter( 'woocommerce_add_cart_item_data', 'wdm_empty_cart', 10, 3); function wdm_empty_cart( $cart_item_data, $product_id, $variation_id ) { global $woocommerce; $woocommerce->cart->empty_cart(); // nothing data , return return $cart_item_data; } found solution. not sure why works compared other solutions i've tried, works! add_filter( 'woocommerce_add_cart_item_data', 'wdm_empty_cart', 10, 3); function wdm_empty_cart( $cart_item_data, $product_id, $variation_id ) { global $woocommerce; //check if product id in category if( has_term( 'category-slug', 'product_cat', $product_id ) ){ $woocommerce->cart->empty_cart(); } //do nothing data , return return $cart_item_data; }

IBM Watson Concept Insights conceptual search using Curl to pass mutiple/an array of ids as a parameter -

so, trying pass multiple of ids ("array of concept") on query using curl on ibm concept insights. according documentation on site, should able it, cannot figure out how make work -> http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/concept-insights/api/v2/?curl#conceptual_search if use "example request" prodiveded on link , modify @ least add query on same data command, how think work. curl -u "{username}":"{password}" -g -d "ids=[\"/graphs/wikipedia/en-20120601/concepts/artificial_intelligence\", \"/graphs/wikipedia/en-20120601/concepts/html\"]" "https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/public/ibmresearcher/conceptual_search" when enter command, no results back. not error. any thoughts? please don't point out obvious... of course, replacing "{username}":"{password}" credentials. :) instead of -d "ids=..."

c# - nameof() operator for static string -

i understand use of nameof() operator exception handling, logging, etc. not understand example below coming directly microsoft code. public static class sessionkeys { public static class login { public static string accesstoken = nameof(accesstoken); public static string userinfo = nameof(userinfo); } } how more useful public static class sessionkeys { public static class login { public static string accesstoken = "accesstoken"; public static string userinfo = "userinfo"; } } nameof operator evaluated @ compile time, once application compiled there no difference between 2 solutions. however, using nameof in case has few benefits: it makes string value less “magic”. instead of being disconnected magic string, semantic reasoning behind value clear: it’s name of variable itself. the name actual reference name, both connected. allows refactor either of them , automatically af

java - JSR 352 Restarting a job? -

when job restarted, failed partitions run again. how run completed job again? is there difference between submitting job again , restarting job? i using ibm's implementation of jsr 352 on websphere liberty. java batch designed when restart job instance, execution continues left off (in previous failed or stopped execution). so typically means 2 things: within job, begin @ previously-failing step (or step @ job stopped). within step, begin positioning input cursor using checkpoint values kept batch container. so if on initial execution completed step1 failed @ step2 @ record #4123, , checkpointing every 100 records, on restart you'd typically begin executing @ step2 @ record #4100. in cases it's necessary execute step1 on restart well, before executing step2 job had failed, , there option behavior well. it typical submit/start job repeatedly, on schedule. in terms of batch specification, new jobinstance created each time job started.

amazon web services - How to get the CloudFront endpoint country of a client request? -

my website hosted in s3 , cloudfront distribution pointing it. in website need know country request website comes from. is there way cloudfront add information based on cloudfront endpoints location request, maybe header or so? http://docs.aws.amazon.com/amazoncloudfront/latest/developerguide/header-caching.html if want cloudfront cache different versions of objects based on country request came from, configure cloudfront forward cloudfront-viewer-country header origin . cloudfront automatically converts ip address request came two-letter country code. easy-to-use list of country codes, sortable code , country name, see wikipedia entry iso 3166-1 alpha-2.

php - Extending a class with a namespace is saying class not found -

i have structure so: index.php core exceptions exceptioncore.php exceptionutil.php vendor autoload stuff index file: <?php require 'vendor/autoload.php'; new \core\exceptions\exceptioncore\exceptioncore(); exceptioncore: <?php namespace core\exceptions\exceptioncore; class exceptioncore { public function __construct() { echo 'fffhf'; } } but getting error: fatal error: uncaught error: class 'core\exceptions\exceptioncore\exceptioncore' not found in c:\xampp\htdocs\user\index.php:5 stack trace: #0 {main} thrown in c:\xampp\htdocs\user\index.php on line 5 the autoloader expects find class core\exceptions\exceptioncore\exceptioncore in file core/exceptions/exceptioncore/exceptioncore.php . read more psr-0 , prs-4 standards.

Does Microsoft provide offline API documentation for .NET 4.0? -

does microsoft provide offline api documentation .net 4.0 (c#, vb.net, , c++)? latest can find on msdn .net 3.5 sp1. more interested in class library examples , articles on proper usage, though these desirable have when not able connect internet. if answer no, there third-party services or websites offer downloadable documentation .net 4.0 api? yes. visual studio's built-in viewer can download of msdn want. open viewer, click manage content

java - This program asks the user for a file name and displays the occurrences of each character( for example: a=2, b=3.... z=5) in the text file -

i have program asks file name not sure next, how can make method count occurrences of each letter in text file(and need use tolower , toupper) so please help.. thank you here code: import java.util.*; import java.io.*; public class fileopener { public static void main(string[] args) throws ioexception { scanner input = new scanner(system.in); int[] array = new int[26]; string[] alphabets = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; //string lines = input.nextline().touppercase(); //string path = input.nextline(); // prompt user file name system.out.p

php - SQL=INSERT INTO `#__user_usergroup_map` (`user_id`,`group_id`) VALUES (, 2) -- database was not updated -

i have responsibility of joomla! 3.5.1 website. new users added script in 'operator' may add member. however, have encountered problem message, " sql=insert #__user_usergroup_map ( user_id , group_id ) values (, 2) -- database not updated" returned. i have looked in jfacotry api & found module 'com_users" holds script makes bind data params & passes sql execution of insert statement #__user_usergroup_map table. however, don't see sql statement in execution of code. $user->geterror returns sql error. my understanding of problem, code not providing user id 1 of 2 required variables insert statement. when process works, code generates new user id & provides sql statement. this has worked in past since using joomla! 1.5. moving joomla! 3.5.1 want maintain same member addition methodology. is there special constraints upon #__user_usergroup_map table not in place? can help? you must use mark ' , user_id val

jsf - Is Primefaces DataGrid able for lazy loading? -

i created development startup code generjee online tool. have selected datagrid data list style , have choosen lazy loading entities. now i'm wondering if primefaces datagrid able lazily load data? in primefaces datagrid showcase there nothing lazy loading. feature supported? i'm new faces. yes primefaces can lazy loading, this, have put attributes. here example of lazy datagrid : <p:datagrid var="car" value="#{carbean.cars}" columns="3" rows="12" paginator="true" lazy="true"> ... </p:datagrid> value="#{carbean.cars}" : list of backing bean lazy="true" : allow lazy loading rows="12" : number of items load in lazy paginator="true" : activate pagination

How to test if none of the iterables are true in Python 3 -

the task take inputted string ( query ) , see if of words match keys in dictionary ( rsp_dict ). simple. words = query.split() each in words: if each in rsp_dict: print(rsp_dict[each]) but can't figure out, how make print out phrase if none of words match keys dictionary. i've tried million different methods, end phrase printing every false value, rather once. i'm hoping learn or guidance appreciated. please feel free suggest edits on how i've phrased question. you can this: words = query.split() not_found = true each in words: if each in rsp_dict: print(rsp_dict[each]) not_found = false if not_found: print("the phrase not found!") hope helps!

c++ - Forking in a MEX -

i trying mex c++ code contains systemc module. here trying achieve: the mex file should act according input supplied user. when called first time, want fork new process , should create simple systemc module (which contains sc_thread, has wait on events matlab(which plan implement semaphore)). after creating systemc module, i'll start simulation. new process contains systemc module , sc_thread function runs once , waits on event matlab. now, return results matlab , exit out of main mex process. should return process id of process contains systemc module. when call mex after this, argument pass, determines systemc module exists , should post semaphore triggers sc_thread , runs once , returns result matlab. in end, want kill process. my question : of make sense , feasible in matlab?

java - Servlet Not Getting Hit In Simple JSP Application -

this question has answer here: servlet returns “http status 404 requested resource (/servlet) not available” 1 answer here servlet class package com.jsp.servlet; import java.io.ioexception; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; @webservlet("/studentregistration") public class userservlet extends httpservlet { private static final long serialversionuid = 1l; @override protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { try { string username; username =(string)request.getparameter("name"); // system.out.println(fnameoperator);

Regex in R: match everything but not "some string" -

this question has answer here: how can remove objects 1 workspace in r? 13 answers remove punctuation except apostrophes in r 4 answers the answers question explain how match string not containing word . the problem (for me) solutions given don't work in r. often create data.frame() existing vectors , want clean workspace. example, if workspace contains: > ls() [1] "a" "b" "dat" "v" > and want retain dat , i'd have clean with: > rm(list=ls(pattern="a")) > rm(list=ls(pattern="b")) > rm(list=ls(pattern="v")) > ls() [1] "dat" > (where a , b , , v examples of large number of complicated names my.first.vector not easy match rm(list=ls(pattern="[abv]&q

html - How do I pass an Object between Web Pages through POST in PHP? -

is possible pass object through hidden field in html form using $_post , retrieve object on page form links to? on first page, have form 1 below: <?php session_start(); require_once '../model/player.php'; // enable creation of new player object $playername = filter_input(input_post, 'playername'); $playernumber = 1; $player = new player($playername, $playernumber); if (isset($player)) { echo '<p>successfully created player!</p><br>'; ?> <form class="viewstats" action="../view/displayplayerstatsview.php" method="post"> <input type="hidden" name="playerobject" value="<?php echo $player; ?>"> <input type="submit" value="view player's stats"> </form> <?php } ?> and on second (receiving) page, have code code below: session_start(); require_once '../model/player.php'; // use player object $pla

vbscript - vbs not saving as a .vbs -

this question has answer here: saving notepad file .vbs 2 answers so have problem little problem right now. write simple .vbs script, x=msgbox("test",18,"test") which total perfect, right? everytime try save file following it's dutch save .txt file, extension .vbs. i'm curious how stupid am, or how i'm going fix this. essentially, saving "test.vbs.txt". click "save type" (opslaan als) dropdown box , select all files (*.*) (alle dateien?). after should save "test.vbs" expect.

sql server - select average of top 3 for each specific sql job -

Image
select jobs.job_id jobid , jobs.name jobname , act.start_execution_date startexecutiondate , avg(floor(run_duration / 100)) avgdurationmin , case --if job average less 5 minutes limit avg+10 minutes when avg(floor(run_duration / 100)) <= 5 ( avg(floor(run_duration / 100)) ) + 2 --if job average greater 5 minutes limit avg*limit percentage else ( avg(floor(run_duration / 100)) ) end durationlimit , datediff(mi, act.start_execution_date, getdate()) [currentduration] @currently_running_jobs crj inner join msdb..sysjobs jobs on crj.job_id = jobs.job_id inner join msdb..sysjobactivity act on act.job_id = crj.job_id , act

linux - Python Check if Condition in Loop Changes -

i have created small python script monitor if os (linux) able ping ip address of 10.0.0.1 (router on lan). first script works fine have execute script have evaluate condition each time. i think understand script exits after condition evaluated. tried including while else loop in second example below evaluates return of os call , place function call in loop keep checking if router plugged lan. is correct approach define function evaluate ping status? tried adding function in last example doesn't seem update. my goal run script once , have detect 10.0.0.1 or down when unplug network or plug in. import os import time ip = "10.0.0.1" response = os.system("ping -c 1 " +ip) if response != 0: print ip, 'is down' time.sleep(3) else: print ip, 'is up!' i tried adding while else loop condition doesn't seem updated. import os import time ip = "10.0.0.1"

reactjs - TypeScript ReactDOM Property 'type' is missing on component -

getting following error: error ts2345 argument of type 'typeof somecomponent' not assignable parameter of type 'reactelement<{}>'. property 'type' missing in type 'typeof somecomponent'. got following code typescript code: import * react 'react'; import * reactdom 'react-dom'; interface iprops{} interface istate {} class somecomponent extends react.component<iprops, istate> { render() { return <div />; } } var component = somecomponent; var root = document.getelementbyid("root"); reactdom.render(component , root); i tried following: class somecomponent extends react.component<iprops, istate> { render() { return <div />; } type() { return "test"; } } should like: interface iprops{} interface istate {} class somecomponent extends react.component<iprops, istate> { render() { return <

How to validate WebRTC connection signals when peers can't trust each other? -

i building webrtc app 2 users selected @ random , connect each other chat. both clients keep open websocket connection , planning use exchange offers/answers signal connection. case trying account when there peer intentionally sends bad configuration information, , when peer might spontaneously disconnect in middle of signaling exchange. my solution first case have server keep state of exchange, when connection first established expect user provide offer , user b have answer. appropriate? or should implemented exclusively client side? my solution second problem feels me hack. trying notify user match has been made , user set timeout 20 seconds, if connection hasn't been made in amount of time should move on... are these appropriate solutions? how reliably establish webrtc when either peer can't trusted? should signaling server concerned state of exchange? sounds you're more concerned call set errors rather being able trust identity of remote peer. 2 diff

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback

javascript - how to move dojo datagrid after a hidden control is shown -

1 - simple form contains select (let's call select1 ) , dojo datagrid below it. 2 - when change value of select1 toggles visibility of select, let's call select2 , located between select1 , datagrid1 3 - when select2 appears, datagrid1 doesn't move make room it. need happen please note: due arcgis.com, snippet not run @ first click. thank you <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css" /> <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.13/dojox/grid/resources/grid.css"> <link rel="

hadoop - How do I include a resource file in Java project to be used with just new File()? -

i'm writing udf pig using java. works fine pig doesn't give me options separate environment. pig script doing geo location ip address. here's code on geo location part. private static final string geo_db = "geolite2-city.mmdb"; private static final string geo_file = "/geo/" + geo_db; public map<string, object> geodata(string ipstr) { map<string, object> geomap = new hashmap<string, object>(); databasereader reader = new databasereader.builder(new file(geo_db)).build(); // other stuff } geolite2-city.mmdb exists in hdfs that's why can refer absolute path using /geo/geolite2-city.mmdb . however, can't junit test or have create /geo/geolite2-city.mmdb on local machine , jenkins not ideal. i'm trying figure out way make test passed while using new file(geo_db) , not getclass().getresourceasstream('./geo/geolite2-city.mmdb') because getclass().getresourceasstream('

hibernate - How do you retrieve nested Sets? -

is there annotation i'm missing or limitation hibernate retrieval? entities: class { long id; set<b> b; @manytomany(fetch = fetchtype.eager) @jointable(name = "a_b", joincolumns = @joincolumn(name = "a_id"), inversejoincolumns = @joincolumn(name = "b_id") public set<b> getbs() { return b; } } class b { long id; set<c> c; @manytomany(fetch = fetchtype.eager) @jointable(name = "b_c", joincolumns = @joincolumn(name = "b_id"), inversejoincolumns = @joincolumn(name = "c_id") public set<c> getcs() { return c; } } daos: class adaoimpl { public load(long id) { return new a((a) session.load(a.class, id); } } when attempt load a, caused by: java.lang.nullpointerexception @ org.hibernate.engine.internal.statefulpersistencecontext.getloadedcollectionownerornull(statefulpersistencecontext.java:853) i had issue similar h

ruby on rails action mailer not receiving emails to arrays from a yaml file -

i have issue able send email via mailer hardcoded array. email not go through array picked config.yml here config.yml company: email: - user1@company.com - user1.lastname@company.com - user2.lastname@company.com this mailer class: class reportmailer < actionmailer::base default :from => "donotreply@company.com" def send_report(company, file) mail(:to=> "#{config[company]['email']}", :subject => "daily report") end end end when run in rails console & view logs, seems executed fine did not receive email: [debug] 2016-04-21 18:21:29 :: date: thu, 21 apr 2016 18:21:29 -0400 from: donotreply@merchantlink.com to: ["user1@company.com", "user1.lastname@company.com","user2.lastname@company.com"] ... ... [info] 2016-04-21 18:21:29 :: sent mail ["user1@company.com", "user1.lastname@company.com", "user2.lastname@company.com"] if c

Confusion with Batch-file code -

so started learning batch-file, , today decided try , make game it. have few errors, , can't figure out wrong code. heres code: @echo off title batch rpg color 07 echo welcome batch rpg! echo. echo. pause :menu cls echo. echo -menu- echo. echo. echo. echo 1) begin echo. echo 2) how play echo. echo 3) exit echo. echo. echo. echo --------- echo. set /p c=choice: if %c%==1 goto prestart1 if %c%==2 goto howtoplay if %c%==3 goto cfr_exit if not %c%==1 if not %c%==2 if not %c%==3 goto menu :cfr_exit cls echo. echo sure want exit? echo. set /p c=(y/n): if %c%=="y" exit if %c%=="n" goto menu if not %c%=="y" if not %c%=="n" goto cfr_exit2 :cfr_exit2 cls echo. echo must enter valid option. echo. pause goto cfr_exit :howtoplay cls echo. echo -how play- echo. echo. echo. echo game simple. there number option after it, type option in , perform action(a

android - Upload a replacement Alpha Testing APK on Google Play? -

i using new google play "alpha testing" tab in android developer console. we have been successful uploading 7 previous versions , distributing them our alpha testers using google+ community. this morning 1 of team accidentally published version 7 production instead of alpha. unfortunate, happened. now when try upload version 8 or version 9 "alpha testing" tab in android developer console, see strange error. some devices eligible run multiple apks. in such scenario, device receive apk higher version code. i not sure how work around error. developer console can provide more detailed list, however, not appear helpful. previously active apks supported more devices in draft configuration. devices not receive upgrades. less devices running version 8 no longer supported current configuration. such devices not receive upgrades. api levels in range 4+ , release track excluding of [alpha] , screen layouts containing of [small, normal, large, xlarge] , fea

sqlite - Does ADO wrappers for SQLLite preserve performance? -

does ado wrappers sqllite assume significant interprocess communications (as example sql server far separate process)? far know sql lite dll loaded inproc (it's fast - no need in ipc overhead), so, using ado wrapper preserve benefit? (for example - system.data.sqlite )

java - Display array of words in reverse order -

i have of code done not know how display sentence in reverse order entered. example; if 1 enters "my name joe" should display in output: joe name my import java.util.scanner; public class sentence { public static void main(string [] args) { scanner input = new scanner(system.in); system.out.print("enter sentence: "); string sentence = input.nextline(); string[] words = sentence.split(" "); // display array of words in // reverse order } } if understand problem, can that: public static void main(string [] args) { scanner input = new scanner(system.in); system.out.print("enter sentence: "); string sentence = input.nextline(); string[] words = sentence.split(" "); (int = words.length - 1; >= 0; i--) { system.out.println(word

oracle - sql join and minus -

i seem having problem getting query work. know i'm close. here's copy of er diagram i think close achieving want code, invalid identifier when trying run it. think because practice being changed somehow after joining, getting invalid identifier on row 5? select staffid, staff_firstname, staff_surname, practice.practice_name, practice.practice_city staff join practice on staff.practiceid = practice.practiceid minus select staffid, staff_firstname, staff_surname, practice.practice_name, practice.practice_city staff role = 'gp'; basically i'm trying use minus construct find practices not employ gp , include information such city , practice_address. i can use minus construct find out how many staff not have role of gp so: select staffid, staff_firstname, staff_surname staff minus select staffid, staff_firstname, staff_surname staff role = 'gp'; where results: staffid staff_firs staff_surn __________ __________ __________