Posts

Showing posts from August, 2012

c# - Why do i get this app.config related error when i try to acess EF from console application? -

here simple project structure - idea acess entity information in console application sln - data access layer (entity framework , metadata) , repository - service layer list of items in each entity - console project access service layer am using windsor castle , code in console is static void main(string[] args) { // registering var container = new windsorcontainer(); container.register(component.for<irefrepository>().implementedby<refrepository>()); container.register(component.for<ireflservice>().implementedby<refservice>()); container.register(component.for<refentities>()); // resolving var list = container.resolve<irefservice>(); list.getcountries(); } i getting following error on var list = container.resolve(); the specified named connection either not found in configuration, not intended used entityclient provider, or not valid. my app.config generated ef in data access laye

arrays - PHP to store all variables from loop to use them later -

i trying use wsdl webservice work each parameters. working absolutely fine; however, once script executed, have "log" emailed me. all works fine when use print , or echo inside loop (this display values of different variables loop). however, outside of loop, display 1 variable. is there way store variables array inside of loop can used later on, outside of loop, example emailing this? this have tried: <?php // api request , response $requestparams = array( 'request' => 'hello' ); $client = new soapclient('https://example.com/webservice.asmx?wsdl'); $response = $client->command($requestparams); //load response xml $xml = simplexml_load_string($response); $rows = $xml->children('rs', true)->data->children('z', true)->row; foreach ($rows $row) { $attributes = $row->attributes(); /* xml document contains 2 columns, first attribute to, second attribute ref. extract required data */ $to = (s

python - Integration of a function of two variables -

Image
i have function func(rp,pi) i have values . have values of rp , pi . i need integrate function within limits of 0 pi how go using quad scipy solve this? doubt have is, how quad know integral limits pi , not rp ? i tried: from scipy.integrate import quad integral = [] in func: result,error = quad(lambda func:a,0,pi) integral.append(result) integral = np.array(integral) here func list has values of function. give me values, not sure if right? here download link file rp,pi,func . first column rp , second column pi , third column func

c# - How do I create Optional Type injection for a base class? -

during course of regular agile programming technique, lot of refactoring. if find common things candidates base class. assume code pattern: public subclass : baseclass{ private dynamic somevalue = null; public subclass(){ somevalue = baseclass.method<t>(); } } everything works fine until tired of continually injecting type method. why not inject type base class instead? wait second, don't want have redo 20 classes using pattern above. have 2 potential patterns can use, being second. public subclass : baseclass<t>{ private t somevalue = null; public subclass(){ somevalue = baseclass.method(); } } this second pattern logical derivation of first example whereby merely moving type class ctor instead of using generic type in each method. i ask community thoughts on how accomplish both constructs without changing current code adding in support of generic type baseclass pattern. i have read other posts on "optional generic

ios - How can I dynamically set UIView constraints? -

i have custome uitableviewcell. contains labels , uiimageviews top bottom. added constraints labels , uiimageviews. can use systemlayoutsizefittingsize: uilayoutfittingcompressedsize caculate cell height fit content. image in uiimageview loaded online using sdwebimage. @ first can set constraints uiimageview. when image loaded, should change uiimageview's constraint meet size. error occurs. it's ok: * assertion failure in -[nslayoutconstraint _setsymbolicconstant:constant:], /sourcecache/foundation_sim/foundation-1142.14/layout.subproj/nslayoutconstraint.m:585 2015-04-01 19:57:44.537 hipda[3760:63583] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'constant not finite! that's illegal. constant:nan' *** first throw call stack: ( 0 corefoundation 0x00000001113cfa75 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x0000000111068bb7 objc_exceptio

string - PHP how to count the length of each word in the text file -

i need help. how count length of each word in text file using php. for example. there test.txt. , contain " hello everyone, need help." how output text , count length of each word,like: array hello => 5 => 8 => 1 need => 4 => 4 => 4 i start learn php. please explain detail code write. many thanks if don't need process words' length later, try this: // file contents $text = file_get_contents('path/to/file.txt'); // break text array of words $words = str_word_count($text, 1); // display text echo $text, '<br><br>'; // , every word it's length foreach ($words $word) { echo $word, ' => ', mb_strlen($word), '<br>'; } but noticed, str_word_count() function has many issues utf-8 string (f.e. polish, czech , similar characters). if need those, suggest filtering out commas, dots , other non-word characters , using explode() $words array.

javascript - Button listener to create incremented title -

i'm creating form website let users add step step tutorials. each time user clicks on 'add step' , new block image field , text field appears. i'm beginning jquery , wanted have title displayed before every new block appearing after user's click 'step 1' ... 'step n' i tried adding html field block , filling (263 id of 'add step' button , 323 of htlm field added): $x = 0 $([263]).click(function () { $x ++ ; $("[323]").val("step $x"); } but doesn't work ... me please ? thanks :) use id selector jquery #... , missing close ); click function. , .text() used set h1 title: var x = 0 $("#323").text("step " + x); $("#263").click(function() { x++ ; $("#323").text("step " + x); }); and don't use $x looks php world :) you can fiddle around code here http://jsfiddle.net/uh8m2wax/ you can place code @ end of page prior body tag this:

sas - Loop through list -

i have following macro: rsubmit; data indexsecid; input secid 1-6; datalines; 108105 109764 102456 102480 101499 102434 107880 run; %let endyear = 2014; %macro getvols1; * first extract secids options given date , expiry date; %do yearnum = 1996 %to &endyear; proc sql; create table volsurface1&yearnum select a.secid, a.date, a.days, a.delta, a.impl_volatility, a.impl_strike, a.cp_flag optionm.vsurfd&yearnum a, indexsecid b a.secid=b , a.impl_strike ne -99.99 order a.date, a.secid, a.impl_strike; quit; %if &yearnum > 1996 %then %do; proc append base= volsurface11996 data=volsurface1&yearnum; run; %end; %end; %mend; %getvols1; proc download data=volsurface11996; run; endrsubmit; data _null_; set work.volsurface11996; length fv $ 200; fv = "c:\users\user\desktop\" || trim(put(indexsecid,4.)) || ".csv"; file write filevar=fv dsd dlm=',' lrecl=32000 ; put

python - How to compare rows in order to fill missing values in pandas -

i have dataframe 10 fields. in 10th field there missing data, , need fill them. so let's row, row-a, have 10th field empty. if there row-b such fields 3 7 row-a , row-b have same values, want copy value @ 10th field of row-b 10th field of row-a. , don't know how it.

I am developing a Outlook plugin for Outlook 2007, 2010 and 2013 -

i developing outlook plugin. outlook 2007,2010 , 2013 it's working fine in 2010 , 13 not showing tab in 2007. installing properly, checked in addins in active mode not showing tab or button of addin. please tell me proper way that. first of all, make sure don't ui errors in outlook. see how to: show add-in user interface errors more information. the explorer windows in outlook 2007 don't use ribbon ui, inspectors. so, need use command bars customizing explorer windows. anyway, markup did use custom ui? namespace used in markup?

objective c - View jumps back after setting center in iOS 8 -

Image
i’m beginner xcode, , have problem counter in app. when put timer count points player(paddle) jump in place in first time(in middle) everytime when timer count point. so should keep paddle is? there other way count points? its doesnt matter how control player swipe or g-sensor, in example control swipe. , problem appears in ios 8.0> , not in ios 7. here code: .h file: int scorenumber; @interface viewcontroller : uiviewcontroller{ iboutlet uilabel *scorelabel; nstimer *timer; } @property (nonatomic, strong)iboutlet uiimageview *paddle; @property (nonatomic) cgpoint paddlecenterpoint; @end .m file: @implementation viewcontroller -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [touches anyobject]; cgpoint touchlocation = [touch locationinview:self.view]; cgfloat ypoint = self.paddlecenterpoint.y; cgpoint paddlecenter = cgpointmake(touchlocation.x, ypoint); self.paddle.center = paddlecent

javascript - How to get all directive names in a given angular app? -

say have angular app, has modules , directives. want list of defined directives in app. for example: var mymodule = angular.module('mymodule', [function(){...}]); mymodule.directive('mydirective', [function () {...}]); mymodule.directive('myotherdirective', [function () {...}]); var myothermodule = angular.module('myothermodule', [function(){...}]); myothermodule.directive('thirddirective', [function () {...}]); i want write function getalldirectives() return ['mydirective','myotherdirective','thirddirective'] . also if possible know module each directive belongs to: { 'mymodule': ['mydirective','myotherdirective'], 'myothermodule':['thirddirective'] } how can done? please note need outside app , after has loaded. have access publicly available on page, such angular object , dom . you can directives defined in each module using custom function one

sql - select * from (select a,b,c ...) guaranteed order of result columns? -

i had comment in code review: it's better enumerate fields explicitly. "select *" doesn't guarantee order is true in case query select * (select a,b,c ...) ? can't imagine database engine re-order columns in result, imagination more logical database engines. the advice against select * when you're querying tables directly. in databases it's possible insert new column partway through table, such table t (a, b) becomes table t (a, c, b) . postgresql not (yet) support this, can still append columns, , can drop columns anywhere, can still t (a, c) if add c , drop b . this why it's considered bad practice use * in production queries, if application relies on ordinal column position read results. really, applies situations not specify fields elsewhere in query. in case in subquery. * safe , imo quite acceptable in usage. this: select * (select a,b,c ... t) is fine. this: select * t or select * (select * t) a

c# - Telling RestSharp *not* to add a specific HTTP header -

i trying call rest service c# asp.net 4.0 application using restsharp. it's straightforward post call https:// address; code ( checkstatusrequest plain simple dto 4 or 5 string , int properties - nothing fancy): public checkstatusresponse checkstatus(checkstatusrequest request) { // set restclient restclient client = new restclient(); string uri = "https://......."; // create request (see below) irestrequest restrequest = createrequestwithheaders(url, method.post); // add body request restrequest.addbody(request); // execute call var restresponse = _restclient.execute<checkstatusresponse>(restrequest); } // set request private irestrequest createrequestwithheaders(string uri, method method) { // define request restrequest request = new restrequest(uri, method); // add 2 required http headers request.addheader("accept", "application/json"); request.addheader("content-t

c - Why doesn't my for loop exit? -

c program. trying make multiple choice quiz. have used loop run question 1 2 3 etc. after running program never exits loop when have specified count <=3. why? can see have done wrong? #include <stdio.h> int main (void) { char s; char response[]={'a','b','c','d'}; int ,x; int count,result; printf (" listo para empezar?\n\n please type 's' si or 'n' no.\n"); scanf ("%c",&s); if (s='s'){ printf ("bueno. ya empezamos!\n"); } (count=0;count<=3;count++){ printf ("1.que significa la palabra 'conocer'\n"); printf ("1.\t 2.\t know\t 3. do\t 4. eat\n"); scanf ("%d",&x); if (x=response[1]) { printf ("equivocado!\n 'conocer'significa: know\n"); } else { printf ("cor

Android Studio can't download packages -

i can't start android studio after installing it, error: sys-img-x68-addon-google_apis-google-21, extra-android-m2repository , 3 more sdk components not installed and log: android sdk installed c:\users\vincent\appdata\local\android\sdk refresh sources: fetched add-ons list refresh sources installing archives: preparing install archives download finished wrong size. expected 159505060 bytes, got 1527 bytes. download finished wrong size. expected 1848028 bytes, got 1537 bytes. download finished wrong size. expected 271448751 bytes, got 1559 bytes. download finished wrong size. expected 41693483 bytes, got 1533 bytes. download finished wrong size. expected 39017864 bytes, got 1531 bytes. done. nothing installed. sys-img-x86-addon-google_apis-google-21, extra-android-m2repository , 3 more sdk components not installed note: on proxy server have setup proxy settings in advance help

html - How can I force set the distance between my divs? -

Image
i not sure why margin:13.5px; doesn't take effect. want set them aside each other 27px . : can me give space between them ? here have : jsfiddle you need make sure container div right size inner div - @ moment small inner div isn't showing margin. if remove margin .tl-box , add following styles (makes outer box correct width it's contents , adds margin it), should fix issue: .slide .col-lg-2 { width:239px; margin:13.5px; } example

c# - How to format asp.net web services (ASMX) to look like the mentioned example? -

i'm trying format web service result (json) mentioned example. current format fullcalendar not able display events. if @ output see date format different example though tried not use (tounixtimespan) , have double quotes on every item such as, title,start,end , id. how can rid of double quotes , format date , time? i appreciate efforts in reaching solution problem. example events: [ { title: 'all day event', start: '2014-11-01' }, { title: 'long event', start: '2014-11-07', end: '2014-11-10' }, { id: 999, title: 'repeating event', start: '2014-11-09t16:00:00' }, { id: 999, title: 'repeating event', start: '2014-11-16t16:00:00' }, { title: 'conference',

wikipedia - SPARQL: retrieve all the info from DBpedia from a URI -

if want retrieve abstract uri, following: prefix dbp_owl: <http://dbpedia.org/ontology/> select distinct ?abstract { <http://dbpedia.org/resource/horizon_high_school_(thornton,_colorado)> dbp_owl:abstract ?abstract filter (lang(?abstract) = "en" )} if want retrieve thumbnail: select distinct ?thumb { <http://dbpedia.org/resource/horizon_high_school_(thornton,_colorado)> dbp_owl:thumbnail ?thumb } how can retrieve uri , not 1 property? as retrieving multiple properties, can using variable in property position. e.g., select ?property ?value { dbpedia:mount_monadnock ?property ?value } sparql results note if try filter ?value here language, you'll miss lot of results, because results aren't literals, or aren't language tagged literals won't give value lang function. need restrict filter bit: select ?property ?value { dbpedia:mount_monadnock ?property ?value filter ( !isliteral(?value) #--

ember.js - User authentication and login flow with Ember and JSON web tokens -

i'm trying figure out how best authentication , login flow ember. i'll add first web app i've built it's bit new me. i have express.js backend protected endpoints using jwts (i'm using passport, express-jwt , jsonwebtoken that) , works. on client-side, i'm using ember simple auth jwt authenticator. have login flow working (i'm using login-controller-mixin) , correctly see isauthenticated flag in inspector after successful login. the thing i'm struggling after login: once user logs in , gets token, should make subsequent call user details, e.g. /me, can have representative user model client side? these details let me transition appropriate route. see this example in repo example of how add property session provides access current user.

Can I restrict Amazon S3 Browser-Based Uploads by URL in my bucket policy -

based on: http://s3.amazonaws.com/doc/s3-example-code/post/post_sample.html is there way limit browser based upload amazon s3 such rejected if not originate secure url (i.e. https://www.someurl.com )? thanks! i want absolutely guarantee post coming website that impossible. the web stateless , post coming "from" specific domain not valid concept, because referer: header trivial spoof, , malicious user knows this. running through ec2 server gain nothing, because tell nothing new , meaningful. the post policy document not expires, can constrain object key prefix or exact match. how malicious user going defeat this? can't. in client form have encrypted/hashed versions of credentials.  no, not. what have signature attests authorization s3 honor form post. can't feasibly reverse-engineered such policy can modified, , that's point. form has match policy, can't edited , still remain valid. you generate signature using in

java - iText RadioGroup/RadioButtons across multiple PdfPCells -

i'd make pdfptable multiple rows in it. in each row i'd have radio button in first cell , descriptive text in second cell. i'd radio buttons part of same radio group. i've used pdfpcell.setcellevent , own custom cellevents in past render textfields , checkboxes in pdfptables. however, can't seem figure out how radio buttons/radio groups. is possible itext? have example? please take @ createradiointable example. in example, create pdfformfield radio group , add after constructing and adding table: pdfformfield radiogroup = pdfformfield.createradiobutton(writer, true); radiogroup.setfieldname("language"); pdfptable table = new pdfptable(2); // add cells document.add(table); writer.addannotation(radiogroup); when create cells radio buttons, add event, instance: cell.setcellevent(new mycellfield(radiogroup, "english")); the event looks this: class mycellfield implements pdfpcellevent { protected pdfformfield ra

php - How do I add inline css to dropdown in Yii? -

this code: <?php echo $form->dropdownlist($model, 'type', chtml::listdata($ab->type, 'id', 'name'), array('class' => 'edit'), array('width:165px')); ?> i trying add inline css dropdown, example not work. why ? it should this: <?php echo $form->dropdownlist($model, 'type', chtml::listdata($ab->type, 'id', 'name'), array('class' => 'edit', 'style' => 'width:165px')); ?>

haskell - What are the space complexities of inits and tails? -

tl; dr after reading passage persistence in okasaki's purely functional data structures , going on illustrative examples singly linked lists (which how haskell's lists implemented), left wondering space complexities of data.list 's inits , tails ... it seems me that the space complexity of tails linear in length of argument, and the space complexity of inits quadratic in length of argument, but simple benchmark indicates otherwise. rationale with tails , original list can shared. computing tails xs consists in walking along list xs , creating new pointer each element of list; no need recreate part of xs in memory. in contrast, because each element of inits xs "ends in different way", there can no such sharing, , possible prefixes of xs must recreated scratch in memory. benchmark the simple benchmark below shows there isn't of difference in memory allocation between 2 functions: -- main.hs import data.list (inits, tails)

python - Identify and extract number from text files -

i trying extract data text file. data in file random , has numbers followed code. (example 1.25crow, 4.25crd, 10.25cr) want extract number associated #.##cr index. if find 4.25cr need parse 4.25 , add totals of these numbers. have been able identify lines contain ###.##cr shown below. trying parse number associated cr , put each occurrence in list add together, identify, etc. have looked string.operands , re.match can't come solution. appreciated. open("some.txt").read() #txt ='cr' count = 0 line in open("some.txt"): if 'crd' in line: pass elif 'crow' in line: pass elif 'cr' in line: print line count = count + 1 print print "total # count " print count yep on write track. need modify last elif block as elif 'cr' in line: print line count = count + 1 value = float(line.split('cr')[0]) listofcrs.append(value)

bash - Shell script strange echo behavior -

i want print content have obtained split of array in way : string="abc test;abctest.it" ifs=';' read -a array <<< "$string" name="${array[0]}" url="${array[1]}" echo -ne "\n$url,$name" >> "$outputdir/$filename" but output file doesn't contain url part i think problem "." don't know how fix it if try echo $url it's work! thanks i've tried printf , hardcoded filename nothing! printf '%s %s\n' "$url" "$name" >> test.txt it seems when try concatenate thing after variable $url part of variable deleted or overwritten output file for example if try printf '%s %s\n' "$url" "pp" >> test.txt what simple cat test.txt : pptest.it but content of variable $url must abctest.it it's strange to complement chepner's helpful answer : if output doesn't look expect

Python dictionary issue update values -

i've problem python's dictionary. import random values = {"a" : [2,3,4], "b" : [2], "c" : [3,4]} # variable have store keys values in lists kept variable values, , values list of numbers # example of dictionary : # {"2" : [2, 6 ,7 ,8, 8], "3" : [9, 7, 6, 5, 4], "4" : [9, 7, 5, 4, 3]} dictionary = {} x in values.keys(): listofkeyx = values[x] newvalues = [] index in range (0, 5): newvalue = random.randint(0,15) newvalues.append(newvalue) value in listofkeyx: if value in dictionary.keys(): index in range (0, 5): #i want update value in dictionary if "if" condition satisfied if(newvalues[index] < dictionary[value][index]): dictionary[value][index] = newvalues[index] else: dictionary.setdefault(value, []) dictionary[value] = newvalues print dictionary i have pr

Facebook share throwing connection error when sharing -

every article on following website fails when attempting share page via share link in our social media widget. for example: the following page, http://news.gc.ca/web/article-en.do?mthd=index&crtr.page=1&nid=957389 when shared via following link: returns error: connection error in share preview window. response headers request are: cache-control: private, no-cache, no-store, must-revalidate content-encoding: gzip content-type: text/html date: wed, 01 apr 2015 14:22:20 gmt expires: sat, 01 jan 2000 00:00:00 gmt pragma: no-cache strict-transport-security: max-age=15552000; preload vary: accept-encoding x-content-type-options: nosniff x-fb-debug: iyvcjsrjjqvdvxyiubd1kvq6tezbilibrrcaczw9hi/ms+b2qsquq52kyu5820utflmuxtis3lbrol2bmlcvbw== x-frame-options: deny x-xss-protection: 0 x-firefox-spdy: 3.1 200 ok running above url through opengraph object debugger returns: error parsing input url, no data cached, or no data scraped. and scraper sees following url: docum

java - not able to set Background color of the panel -

in assignment of graphics, not able set background color of panel. if put colorpanel panel, color of panel background changes, circle doesn't move if change size of panel. in assignment required if change size of frame, circle should @ center of frame import javax.swing.*; import java.awt.*; import java.awt.event.*; public class colormenuframe extends jframe { private jmenu colormenu = new jmenu("colors"); private colorpanel p = new colorpanel(); public colormenuframe(){ p.setpreferredsize( new dimension( 100, 100 ) ); this.add(p); } // main method public static void main(string[] args) { colormenuframe frame = new colormenuframe(); frame.pack(); frame.setlocationrelativeto(null); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.setvisible(true); } //colorpanel class public class colorpanel extends jpanel { private int

android - Licence required to use Map intent? -

in 1 activity exposing address map intent in our app. google maps api have buy license , pay based on usage, have such clause when using google maps or other maps intent ? if need new intent maps application (or external link), no license required... to call new maps intent use: string url = "https://www.google.es/maps/place/mag%c3%b2ria-la+campana/@41.367488,2.138879,17z/"; intent intent = new intent(intent.action_view, uri.parse(url)); toast.maketext(activity, "maps", toast.length_long).show(); intent.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivity"); activity.startactivity(intent);

ColdFusion: ORM Collection with Multiple Foreign Keys -

my database structure consists of multiple primary keys per table, therefore multiple columns required per join. i'm trying use coldfusion (11 specific) orm collection property . seems comma separated list of columns in fkcolumn attribute doesn't work, relationship properties . have filed bug adobe , i'm wondering if else has run , found workarounds. or maybe i'm doing wrong.. table setup years staff staffsites sites =========== ============ ============ =========== yearid (pk) staffid (pk) yearid (pk) siteid (pk) yearname staffname staffid (pk) sitename siteid (pk) staff orm cfc component persistent=true table='staff' { property name='id' column='staffid' fieldtype='id'; property name='year' column='yearid' fieldtype='id'; property name='sites' elementcolumn='siteid' fieldtype='collection'

watchkit - Is it possible to implement dynamic notifications on Apple Watch without a launchable app? -

i've designed custom notification app i'm working on apple watch. notifications because of current technical limitations don't want build launchable app or glance until have mic , speaker access. possible display dynamic notifications without having app icon on home screen of watch or watch app mandatory have dynamic notification @ all? no, need add dynamic notification scene in watch app. if want read more information i'd refer page: https://developer.apple.com/library/ios/documentation/general/conceptual/watchkitprogrammingguide/customzingthepushnotificationinterface.html#//apple_ref/doc/uid/tp40014969-ch6-sw1

c# - Linking two lists efficiently -

i have 2 lists: products a list of product , warehouse combination containing prices/quantities etc. two seperate results of sql queries. the second list has 'productid'. what i'm doing is: foreach(var product in products) var productwarehouses = warehouses.where(x=> x.productid == productid).tolist(); product.warehouses = productwarehouses; thing is, takes very, long. note: i've tried splitting products chunks of lists , using parallel.foreach() , tasks take time down - still takes long. use join rather doing linear search through entirety of 1 collection each item in other collection: var query = product in products join warehouse in warehouses on product.productid equals warehouse.productid warehouses select new { product, warehouses, };

javascript - Angular, bootstrap-ui with requirejs issues -

i trying use bootstrap-ui on angualr project requirejs. i think have set correctly seems having issues - here setup - require.config({ paths: { 'angular': '//thirdparty/angular/1.3.4/angular.min', 'underscore': '//thirdparty/underscore/1.6.0/underscore.min', 'bootstrap-ui' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap.min', 'bootstrap-ui-tpls' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min', }, shim: { 'angular': { exports: 'angular' }, 'underscore': { exports: '_' }, 'bootstrap-ui-tpls' : { deps: ['angular'], exports: 'bootstrap-ui-tpls' }, 'bootstrap-ui': { deps: ['angular','bootstrap-ui-tpls'] } } }); i assuming need add tpls - may part of issue? then define

sql - How to count words frequency in Teradata -

for example if have 1000 rows of data has customer id (e.g. 123) , comments on our product (e.g. great product easy use) how use teradata (version 15) word frequency count output has 2 columns 1 word , other frequency e.g. (great: 20, product: 10)? thank you you use strtok_split_to_table pull off. something following: select d.token, sum(d.outkey) table (strtok_split_to_table(1, <yourtable>.<yourcommentsfield>, ' ') returns (outkey integer, tokennum integer, token varchar(20)character set unicode) ) d group 1 this split each word in comments field individual records, counts occurrence of each word. stick own <yourtable>.<yourcommentsfield> in there , should go. more information on strtok_split_to_table: http://www.info.teradata.com/htmlpubs/db_ttu_14_00/index.html#page/sql_reference/b035_1145_111a/string_ops_funcs.084.242.html here sql , results test on system: create set table db.testcloud ,no fallback , no b

android - Play Service 6.5.+ granular dependencies not working correctly -

update: per request, entire dependency declaration build.gradle, list of jars, , dependencies of included library projects listed @ bottom of quesion. i'm working on project uses location, gcm, ads , identity components of google play services (version 7.0.0). i've defined them such in build.gradle of app module: compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' compile 'com.google.android.gms:play-services-gcm:7.0.0 note: don't know if it's relevant (i don't expect be), project includes 2 additional library modules, 1 of declares subset of above dependencies: compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' still, after trying build app,

How to subset from a 4 dimensional array in R, based on value -

basically have 4 dimensional array of various radar variables named pol has dim (5,1191,360,11) for part of analysis want subset analysis pixels below height, note pol[2,,,] contains height information ideally this newpol<-pol[pol[2,,,]<5,] the issue construct not 4 dimensional features, have tried newpol[,,,]<-pol[,,,][pol[2,,,]<5,,,] but results in error "logical subscript long" my goal obtain 4 dimensional array consisting of elements of pol pol[2,,,]<5. thanks in advance assistance. two things here: adding ,drop=false indexing, , which(..., arr.ind=true) . some data: set.seed(42) pol <- array(sample(20, size=3*4*5*6, replace=true), dim=c(3,4,5,6)) this simple subsetting, lose dimensionality c(3,4,5,6) c(4,5,6) , not good: pol[2,,,] < 5 ## , , 1 ## [,1] [,2] [,3] [,4] [,5] ## [1,] false false false false false ## [2,] false false false false false ## [3,] true false false false false ## [4,] false false

ruby on rails - Changing cloudinary file default url per uploader -

i have rails 4 app ruby 2.2.0 . i building app need store quite bit of images. app exists , managing images on local server, want change that. the app deployed on heroku , want use cloudinary service upload(using carrierwave ) new images store existing ones. the issue comes fact can't seem able adopt current folder structure platform using. start uploaded files via media manager in cloudinary dashboard. created 2 folders header , logo . in case refer header folder example. class banneruploader < carrierwave::uploader::base include cloudinary::carrierwave def store_dir "uploads/header/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end the model: class companyimage < activerecord::base mount_uploader :file_name, banneruploader belongs_to :company end and last not least, here view: <% work_advantages = company.presentation.work_advantages banner = company.company_images.where(header: true).first %> <%

How to get join results using backbeam Android SDK? -

i using backbeam back-end , implementing backbeam's android sdk . i want performing joins results. using below code documentation getting join results : backbeam.select("place") .setquery("join last 10 events") .fetch(100, 0, new fetchcallback() { @override public void success(list<backbeamobject> objects, int totalcount, boolean fromcache) { // pick place (in real code check objects.size() first) backbeamobject place = objects.get(0); joinresult join = place.getjoinresult("events"); list<backbeamobject> events = join.getresults(); int count = join.getcount(); } }); i'm getting exact count of join relationship using getcount() . issue is, join result's list size returned '0' in getresults() . please me. i'm stuck on here.

Rails: Relate two records after creation -

i have model in rails: class commission < activerecord::base has_and_belongs_to_many :books end class book < activerecord::base has_and_belongs_to_many :commissions end this model generates 3 tables: commission, book , books_commissions. in first process of app generate , save commissions , books without relating entries. question : how create record in books_commissions if know book_id , commission_id? lets have object book model book , object commission model commission. then book.commissions << commission should trick.

c# - Excel exception HRESULT: 0x800A03EC from ChartArea.Copy() -

i'm working on c# application thats interacts excel instance using excel interop.dll v11.0. i'm using following code copy chart excel worksheet clipboard: public image readchart(chart chartaccess) { try { microsoft.office.interop.excel.worksheet sheet = workbook.sheets[chartaccess.sheet.name]; microsoft.office.interop.excel.chartobject chart = sheet.chartobjects(chartaccess.name); chart.chart.chartarea.copy(); // exception gets thrown here return system.windows.forms.clipboard.getimage(); } catch (comexception) { // display error dialog etc... } this worked fine excel 2007. since switching excel 2013 function chartarea.copy() results in following comexceptions being thrown: message: "dimension not valid chart type" stack trace: system.runtimetype.forwardcalltoinvokemember(string membername, bindingflags flags, object target, int32[] awrappertypes, messagedata& msgdata) microsoft.of