Posts

Showing posts from June, 2011

jquery - how to keep the background image height same throughout all page width? -

the background image width 1579px, beyond if stretch browser 1920px, background image height changes, though have given fixed div width(650px). how can keep background height same throughout page widths? css: .blue_bg1{ background: url("../images/hero-bg-espresso.jpg") no-repeat; height: 650px; background-position: center center; background-size: 100% auto; width: 100%; } use cover property. so: .blue_bg1 { background-size: cover; }

How to write a list to a text file exactly as it appears in python? -

i want able write list text file, appear if print out in console (with brackets , everything). reason being, need use list later on , has appear if being printed. i've tried using csv module, couldn't formatted wanted. any suggestions? try using repr . repr "returns canonical string representation of object", should give same string gets printed when inspect things on interactive prompt. file.write(repr(my_list))

parallel processing - How to distribute MATLAB's parfor workers between GPUs AND CPUs (cores)? -

i have computation has structure of binary tree, @ each node bunch of highly vectorized functions take output of previous branches produce new branch(es) (nodes on same level independent). since functions vectorized, run both on cpu or gpu, latter naturally giving substantially faster execution. i have access 4-gpu 2-cpu workstation run code on , use optimally can. understand how use parfor on gpus or on cpus' cores only, reasonably distribute workload between gpus , cpu, since gpu execution leaves many cpu cores @ idle, , though slower gpus, still fast enough have noticeable impact on total execution time. (q1) since functions in each node vectorized, reasonable run independent nodes in 1-node-per-core mode? or strictly depend on particular case? there "rule of thumb" such dilemmas? (q2) assuming in (q1) simultaneous execution of 1 node per core suboptimal, there way assign several cpu cores 1 worker? (q3) there way distribute parfor workers between gpu

uitableview - CAGradientLayer not shown until table cell is redrawn iOS 7 only -

on root view controller, have uitableview uses custom cells, uiimageview fills bounds of cell , has cagradientlayer added on top of create transparent gradient. works in ios 8. however, in ios 7, cells don't show cagradientlayer. if scroll down make cell out of view, scroll again come in view it's redrawn, cagradientlayer appears. ideas how can resolve this? below code i'm using in custom cell: override func awakefromnib() { super.awakefromnib() // initialization code l = cagradientlayer() l.frame = bandimageview.bounds l.colors = [uicolor(red: 0, green: 0, blue: 0, alpha: 0).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.2).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.5).cgcolor, uicolor(red: 0, green: 0, blue: 0, alpha: 0.8).cgcolor] bandimageview.layer.insertsublayer(l, atindex: 0) } override func layoutsubviews() { self.contentview.frame = self.bounds l.frame = bandimageview.bounds } and in tableview: func table

c++ - libv4l2 error : No space left on device -

i have 2 different cameras. used below simple code , error. there similar question on site there isn't accepted answer. error message : libv4l2: error turning on stream: no space left on device vidioc_streamon: no space left on device opencv error: assertion failed (size.width>0 && size.height>0) in imshow, file /home/opencv/opencv-2.4.10/modules/highgui/src/window.cpp, line 269 code : videocapture cap(2); videocapture cap2(1); if(!cap.isopened()) // check if succeeded { cout << "webcam cannot open!\n" ; return -1; } if(!cap2.isopened()) // check if succeeded { cout << "webcam2 cannot open!\n" ; return -1; } namedwindow( "window1", cv_window_autosize ); namedwindow( "window2", cv_window_autosize ); for(;;) { ikey = waitkey(5); if (ikey == esc) { break; } cap >> frame; cap2 >> frame2; imshow("window1", frame); imshow("window2",

angularjs - angular restriction to not allow spaces in text field -

i not want user enter spaces in text field. don't want on submit validation rather - space not show on text field when click it. <input ng-model="field" ng-trim="false" ng-change="field = field.split(' ').join('')" type="text"> update: improve code quality can create custom directive instead. don't forget directive should prevent input not keyboard, pasting. <input type="text" ng-trim="false" ng-model="myvalue" restrict-field="myvalue"> here important add ng-trim="false" attribute disable trimming of input. angular .module('app') .directive('restrictfield', function () { return { restrict: 'ae', scope: { restrictfield: '=' }, link: function (scope) { // match spaces, tabs, line feeds etc // can change regex want var regex = /\s/

C - discard pointer parameter -

i'm not sure how phrase question i'll give example of i'm looking do. i have function gets next byte fifo. void fifoget(uint8_t * byte) { *byte = somefunction(); } i'm making function flush fifo void fifoflush(void) { uint8_t i; uint8_t discardbyte; (i=0; i<fifolength; i++) { fifoget(&discardbyte); } } what i'm wondering, since don't need discardbyte , can around allocating memory , pass void pointer fifoget()? something like void fifoflush(void) { uint8_t i; (i=0; i<fifolength; i++) { fifoget(&void); } } no, void approach cause behaviour of program undefined you'll dereferencing pointer unknown memory. your using discardbyte best thing do.

ftp - I have some questions regarding external folder use within Java -

i have questions regarding external folder use within java, i when load .jar file, creates external folders, names "resources", , wondering how go doing that? another question know how download files ftp server (ftp.connorwright.uk) "resources" folder, lead me onto next question my last question how can reference these external folders within code, without ioexception errors or anything i have tried using commonsio library, didn't seem help. thank you. your first question easy file folder = new file("path\to\your\folder\resources"); folder.mkdir(); you can replace "mkdir" "mkdirs" create entire path of folders in case doesn't exist your second question bit complicated, website has great tutorial on it http://www.codejava.net/java-se/networking/ftp/java-ftp-file-download-tutorial-and-example and lastly, way can avoid ioexceptions if files looking exists, there's no universal trick. hope help

java - IntelliJ directory little blue dot label in maven -

Image
so i'm working on java/scala maven project in intellij. made new directory, , filled out src , test stuff, it's not behaving same other directories. what little blue square mean? important? how make new directory (second one) behave same? thanks in advance, sorry if stupid question. it means folder cis defined intellij module. complete list of intellij icons: https://www.jetbrains.com/idea/help/symbols.html

Xcode "Project" versus "project", removing association with SVN working copies -

if fresh checkout of project new working directory location using svn command line "svn checkout " , open new foo.xcodeproject retains references previous working copy location. under source control menu show both new working copy , old. and, in "issues inspector" there 2 headings "foo project" , "foo project". 1 capital p has different icon have never seen before, , lists 1000's of issues missing files old working directory (which deleted file system). how xcode forget old working directory? missing files have nothing xcode, in repository android build. have never referenced them within xcode, guess has decided manage them since referenced .svn files. block checkins due tree conflicts. figured out how svn "sparse" checkout exclude these files local working copy, seems have solved problem, except xcode still trying find files in previous working copy did not sparse checkout. so, how manage files xcode thinks part of

c# - I'm getting an error when I turn on string Unicode encoding -

so, i'm making program reads spanish dictionary. grabs random word. need turn on unicode string because there characters "é" , that, requires encoding string differently. when turn on unicode string[] gives me error message: system.windows.markup.xamlparseexception unhandled message='the invocation of constructor on type 'wordaday.mainwindow' matches specified binding constraints threw exception.' line number '4' , line position '9'. source=presentationframework linenumber=4 lineposition=9 stacktrace: @ system.windows.markup.xamlreader.rewrapexception(exception e, ixamllineinfo lineinfo, uri baseuri) @ system.windows.markup.wpfxamlloader.load(xamlreader xamlreader, ixamlobjectwriterfactory writerfactory, boolean skipjournaledproperties, object rootobject, xamlobjectwritersettings settings, uri baseuri) @ system.windows.markup.wpfxamlloader.loadbaml(xamlreader xamlreader, boolean skipjournaledpropert

excel - Using INDIRECT to sum cells in another spreadsheet -

in worksheet titled “data!” have following successful formula: =sum(indirect(char(64+match(e3,a3:n3,0))&match($b165,$a$1:$a$900,0)&":"&(char(64+match(e3,a3:n3,0))&match($b165,$a$1:$a$900,0)+$o$2-1))) please don't bother details, problem related referencing spreadsheet, explained below. in sum, above formula works intended summing cells e124 e133. in cell e3 have desired column name. in b165 have desired year. i need formula in different worksheet. so, in second worksheet i’ve written: =sum(indirect("data!"&(char(64+match(data!e3,data!a3:n3,0))&match($o3,data!a1:a900,0)&":"&"data!"&(char(64+match(data!e3,data!a3:n3,0)&match($o$3,data!a1:a900,0))))) however, brings me #value error. when break formula 2 parts works. that is, works: char(64+match(data!e3,data!a3:n3,0))&match($o3,data!a1:a900,0) and works: (char(64+match(data!e3,data!a3:n3,0)&match($o$3,data!a1:a900,0)))

ios - killing iPhone app due to wrong version -

i show alert users must update app if version no longer supported , kill application, i've read in here many answers saying using exit(0) or [[nsthread mainthread] exit] may cause app refused in app-store non-standard interface. i have several application have feature i'm wondering right way achieve above task if ([requiredversion compare:actualversion options:nsnumericsearch] == nsordereddescending) {// actualversion lower requiredversion ??? } if app uses crashlytics crash logging service, can use function provide purpose. [[crashlytics sharedinstance] crash]; keep in mind killing own app frowned upon, etc.

cakephp - how use Acl to limit user access -

i have same login 3 different type of users, admin/client/user, has different layout , privileges issue after login every 1 able access pages. after lot of search on google , stack overflow decided use acl. created tables in database via right procedure recommended acl given here accesscontrollist . set permission in following way. still type of user accessing pages. $this->acl->allow( array('model' => 'user', 'foreign_key' => 1), 'admins' ); $this->acl->allow( array('model' => 'user', 'foreign_key' => 2), 'clients' ); any appreciated.

IOS Google Maps Get NorthEast and SouthWest Lat Long padded by certain size -

i able ne , sw lat long this. bounds_ = [[gmscoordinatebounds alloc] initwithregion:mapview_.projection.visibleregion]; cllocationcoordinate2d southwest = cllocationcoordinate2dmake(bounds_.southwest.latitude, bounds_.southwest.longitude); cllocationcoordinate2d northeast = cllocationcoordinate2dmake(bounds_.northeast.latitude,bounds_.northeast.longitude); how can pad northeast , southwest lat long 25% can pass padded coordinates api , image bigger screen view area. you might want change zoom level of mapview camera. sample objective-c code: [mapview_ animatetozoom:12]; for more information, can read the zoom section of google maps ios page.

How do I configure ant on Android to include an external jar without exporting it in the apk? -

i have application uses shared jar library located on platform. build project off platform. so, need include jar file in compilation. this works in eclipse - add library project, , works fine. encounter problem after building ant. ant requires include jar file in libs directory. if include there, exported apk. when deploy locally built apk device, runtime errors complaining multiple symbol definitions. try add custom_rules.xml file project exclude jar after compilation apk. see here exclude dependency jar file apk when using ant android

java - How to access Hadoop counters values via API? -

in hadoop can increment counter in map/reduce task, looks this: ... context.getcounter(mycountersenum.somecounter).increment(1); ... than can find value in log. how access them code after job completes? what hadoop api read counter value? counters represent global counters , defined either map-reduce framework or applications. each counter can of enum type. can define counter enum in driver class static enum updatecount{ cnt } and increment counter in map/reduce task public class cntreducer extends reducer<intwritable, text, intwritable, text>{ public void reduce(intwritable key,iterable<text> values,context context) { //do context.getcounter(updatecount.cnt).increment(1); } } and access them in driver class public int run(string[] args) throws exception { . . . job.setinputformatclass(textinputformat.class); job.setoutputformatclass(textoutputformat.class); fileinputformat.setinputpaths(job,in ); fileoutputformat.s

angularjs - Ajax calls to server are not getting triggered -

i unable angular-datatables request data server. when use .fromfnpromise() works fine. code called , call service data. vm.dtoptions = dataoptionbuilder.fromfnpromise( service.getviewitems() .then(function(data) { vm.logs = data; }); ) .withpaginationtype('full_numbers') .withdisplaylength(25); however, need server-side paging, i'm using .withoptions() , passing in ajax options: vm.dtoptions = dataoptionbuilder.newoptions() .withoption('ajax', { url: '/api/services/app/patients/getviewitems', type: 'post' }) .withdataprop('data') .withoption('serverside', true) .withoption('processi

How to print all digits of a large number in python? -

so, have large number i'm working out in python, when try print this: 3.101541146879488e+80 how print digits of lovely number? both int , long work >>> 3.101541146879488e+80 >>> int(a) 310154114687948792274813492416458874069290879741385354066259033875756607541870592l >>> long(a) 310154114687948792274813492416458874069290879741385354066259033875756607541870592l >>> print (int(a)) 310154114687948792274813492416458874069290879741385354066259033875756607541870592 >>> print (long(a)) 310154114687948792274813492416458874069290879741385354066259033875756607541870592

recursion - Recursive algorithm for the sum of odd number positive integers -

i expressing algorithms in pseudo code. i'm wondering if design works original 1 displayed below. algorithm supposed compute sum of n odd positive integers. this how algorithm should look: procedure sumofodds(n:positive integer) if n = 1 return 1 else return sumofodds(n-1) + (2n-1) this how designed algorithm: procedure odd(n: positive integer) if n = 1 return 1 if n % 2 > 0 return n + odd(n-1) // means n odd if n % 2 = 0 return 0 + odd(n-1) // means one small improvement might defining tail recursion. tail recursion happens when last thing execute recursive call. make tail recursive, use helper method , pass running sum parameter. i'm pretty sure pseudo code below tail recursive since, regardless of result of (if odd) check, final step recursive call (the math happens before recursive call). procedure sumodds(n) return sumoddshelper(n, 0) procedure sumoddshelper(n, sum) if n = 1 re

hibernate - Spring + tomee JTA transactions -

i have been struggling through trying build simple application deploys tomee using spring, hibernate , jms. believe of configurations correct (have mysql xa data source , xa active mq connection factory) things aren't working expect. have simple service writes using injected entity manager pushes jms within 1 method annotated being transactional (spring annotation) message listener being delivered these messages before transaction committed in spring. i've tried using jms template , xa connection factory directly, neither works properly. template configured jta transaction manager received jndi. ideas @ hints why jms sends not participating in same transaction database writes? spring configuration: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/conte

Amazon Web Services and non-amazon website -

i'm confused facets of amazon web services stuff. here want do. my site lets users enter equations , solve them. of equations deal large data sets , math computationally expensive browser. my site @ each equation , determine if should solved in browser or on server. if needs solved on server, want 1 of 2 things. first, either send data , function , have aws run code on data. other option have preset code given data. aws runs code , returns json of solution. for example, lets user has numeric matrix of 1,000 1,000 , want take inverse or gaussian elimination. code @ size of matrix , decide needs run on server. code call function on aws solve this, send data, , aws returns answer. as read, don't understand how set ec2 call function server or ajax call. aws not think does? need host site on aws this? if matters, running lamp stack on hostmonster. you can use amazon ec2 create server (eg web server) accessible on internet. load on server, , how use server,

css - stick divs to a central div that has left absolute position -

is there way stick div (#diva) div (#divb) has left absolute position in pure css without javascript? for example: #divb { position: absolute; left: 100px; } i want #diva attached left side of #divb, if dynamically increase #divb left... update: final objective manage position of others divs, basing on position of div in middle (div b in picture) staying sticked on it: img http://www.sumoware.com/images/temp/xzpsxdkdnccotgoe.png just use absolute positioning offsets of 100% stick sides of originator. html: <div id="a"> <div id="b"> </div> <div id="c"> </div> </div> css: div { position:absolute; height:50px; width:50px; } #a { left:100px; background:red; } #b { right:100%; background:blue; } #c { background:green; left:100%; } will give want .

r - Increasing speed of string comparison using mapply -

i have data frames containing unique ngrams in form of: > head(ngram4, 3) term1 term2 term3 term4 freq 1 end of 3457 2 rest of 2974 3 @ end of 2950 > head(ngram3, 3) term1 term2 term3 freq 1 1 of 15268 2 lot of 13365 3 10709 and on down ngram1 (term1 , freq only). term columns character, freq column integer. for each row, trying pull in frequency of lower order ngram table corresponds last term column. row 1 in ngram3, "one of the", need pull ngram2$freq row term1="one" , term2="of". like: ngram2[ngram2$term1==ngram3$term1 & ngram2$term2==ngram3$term2, "freq"] i'm trying using mapply each row of ngram3 follows: mapply(function(xfreq, xterm1, xterm2) ngram2[ngram2$term1==xterm1 & ngram2$term2==xterm2,"freq"], ngram3$freq, ngram3$term1, ngram3$term2) the problem have 750,000 rows in both ngram2 , ngram3, process terribly slow. timed

Making patterns in java with nested loops -

i'm having trouble figuring out last pattern in java assignment. know i'm close can't figure out here's code: public static void main(string[]args){ system.out.println("pattern d:"); (int = 6; i>=1; i--) { // row int x = 6; // counter? (int j = 1; j<=i; j++){ //column system.out.print(""); x--; } for(int k=1;k<=i;k++) { system.out.print(x); } system.out.println(); } } i understand outer loop rows , inner columns, that's not part have wrong. pattern self right not out put of numbers. can't put output on here because won't format right. if copied code instead of line of 0,then 1, then, 2... etc, i'm trying 1 2 3 4 5 6 on top line, 1 2 3 4 5, next line , on... you close correct pattern, added little much. general tip (not of time), when making these loop patterns can print these patterns using integers in loops. cha

java - Why does LinkedList.indexOf() return -1 if the object is contained in the list? -

i have declared linkedlist, frame list item. private linkedlist<frame> linkedlist = new linkedlist<frame>(); i realized when test indexof -1 returned though list contains queried item. documentation states "(...) or -1 if list not contain element.". https://docs.oracle.com/javase/7/docs/api/java/util/linkedlist.html#indexof(java.lang.object) look @ these strange results: linkedlist.size() -> 1 linkedlist.get(0) -> frame linkedlist.contains(linkedlist.get(0)) -> false linkedlist.indexof(linkedlist.get(0)) -> -1 did overlook anything? ideas what's going on? i accessing list various threads without synchronization. have caused problem? -- log (see below): 12-05 20:30:00.101 16446-16461/cc.closeup i/system.out﹕ **** test 0 12-05 20:30:00.301 16446-16476/cc.closeup i/system.out﹕ **** test -1 12-05 20:30:00.856 16446-16461/cc.closeup i/system.out﹕ **** test 0 12-05 20:30:01.051 16446-1647

How can i compile a file containing different libraries (e.g. jquery, jquery-ui, other 3rd party libs) with typescript -

i working on project contains multiple libraries (jquery, jq-ui, fileupload plugins , other 3rd party plugins) converting project typescript in order work libraries need .d.ts file include in project when compile plugins.ts (just rename .js .ts) give me bunch of errors , generate .js file no .d.ts file , cannot compile other files need include reference of plugin file is there kind of -force type flag in tsc or way compile file. i use command compile ts file tsc --declaration bmkjqplugins.ts is there kind of -force type flag in tsc or way compile file. no. need reference files complete type safety. said : typescript will generate valid javascript in presence of typeonly errors. note: grunt-ts support not failing on type errors : https://github.com/typestrong/grunt-ts#grunt-ts-gruntfilejs-options

pipe - Python subprocess/Popen stdout is truncated -

the output of popen stdout not same running command shell, or using os.system : cmd = ['git', 'diff', commithash, '--stat'] print popen(cmd, stdout=pipe).stdout.read().strip() os.system(' '.join(cmd)) the output popen : src/tech/dalvik/sidebar.md | 10 - .../encryption/android_crypto_implementation.md | 359 -- src/tech/encryption/index.md | 22 - src/tech/encryption/sidebar.md | 9 - src/tech/index.md | 58 - src/tech/nfc/index.md | 25 - src/tech/nfc/sidebar.md | 7 - src/tech/sidebar.md | 5 - templates/footer | 3 +- templates/includes | 2 +- templates/sidebar | 2 +- 257 files changed, 32311 insertions(+), 11358 deletions(-)

javascript - Modifying one array modifies another one I made from it -

this question has answer here: copying array value in javascript 19 answers var allcoords = [{ x: 2, y: 3 }, { x: 3, y: 4 }]; var emptyspaces = allcoords; emptyspaces.splice(0, 1); console.log(allcoords.length); console.log(emptyspaces.length); i not understand why both of these output "1". why original array, allcoords being modified, when want second one, emptyspaces edited? modify code this: (function testing() { var allcoords = []; var emptyspaces = allcoords.slice(); emptyspaces.push({ x: 1, y: 2 }); console.log(allcoords.length); console.log(emptyspaces.length); }());

python - Group by business day of month -

data generated on business days. df['day_of_month'] = df.index.day date........................................ day_of_month 2014-11-26 1049.25 1054.75 26 2014-11-28 1041.00 1051.50 28 2014-12-01 1010.75 1022.50 1 can group calendar day of month,'day_of_month', approx 30 per month goal group business day of month, approx 22/month is there df.index. buiness_day_of_month type function? tried importing bday, special calendars , like, without success. thank help. may helps dat1$grp <- with(dat1, ave(seq_along(date1), format(date1, '%m'), fun=seq_along)) aggregate(val~grp, dat1, fun=sum) data date <- seq(as.date('2014-11-01'), length.out=80, by='1 day') library(timedate) date1 <- date[isbizday(as.timedate(date))] day_of_month <- as.numeric(format(date1, '%d')) set.seed(24) dat1 <- data.frame(date1, day_of_month, v

c++ - A CV-qualified type cannot be converted to the cv-unqualified type -

i've written example: #include <iostream> struct { a(const a&){ std::cout << "a(const a&)" << std::endl; } a(){ std::cout << "a()" << std::endl; } }; struct b { b(){ std::cout << "b()" << std::endl; } operator a(){ std::cout << "operator a()" << std::endl; return a(); } }; b b; void foo(a) { } int main(){ std::cout << "main function starting..." << std::endl; foo(b); } demo it works fine, if replace b b; const b b; won't work. #include <iostream> struct { a(const a&){ std::cout << "a(const a&)" << std::endl; } a(){ std::cout << "a()" << std::endl; } }; struct b { b(){ std::cout << "b()" << std::endl; } operator a(){ std::cout << "operator a()" << std::endl; return a(); } }; const b b; void foo(a) { }

php - search the database based on the value selected from database -

i have code cascade drop down list works fine, there 2 drop down list , 2nd 1 depends on first one, wish perform search (from database table )based on parameter choosed second drop down list. have code search also, don't know how combine search code cascade drop down list code there 2 pages cascade drop down list. first index.php , second fetch_state.php. there code is index.php <body> <div id="container"> <div id="body"> <div class="mhead"><h2>cascaded dropdown jquery ajax , php - infotuts</h2></div> <form class="form-horizontal" role="form" action="" enctype="multipart/form-data" method="post"> <div id="dropdowns"> <div id="center" class="cascade"> <?php $sql

How to work with two lists as round robin python -

i have 2 lists like num = [1,2,3,4] names = ['shiva','naga','sharath','krishna','pavan','adi','mulagala'] i want print 2 lists parallel , if 1 list(num) ends want repeat first list(num) till second(names) list ends. now want output as 1 shiva 2 naga 3 sarath 4 krishna 1 pavan 2 adi 3 mulagala using itertools.cycle , zip : >>> num = [1,2,3,4] >>> names = ['shiva','naga','sharath','krishna','pavan','adi','mulagala'] >>> import itertools >>> i, name in zip(itertools.cycle(num), names): ... print('{} {}'.format(i, name)) ... 1 shiva 2 naga 3 sharath 4 krishna 1 pavan 2 adi 3 mulagala

android - Check if my app can show notification -

in android 5, aka lollipop, how can check if app can show notification? (by using sdk) i want warn user if system blocked notifications. you can create notification , query notificationlistenerservice whether notification displayed. returned statusbarnotification should contain enough metadata identify notification.

jquery - How keep tooltip when is clicked on EditorFor? -

i have @html.editorfor(model => model.q1, new { htmlattributes = new { @class = "form-control",@title = "we ask age statistical purposes."} }) tooltip appears when hover on it. how make when clicked appear tooltip message hint , keep state until changes other editorfor ? something http://blogs.planetcloud.co.uk/mygreatdiscovery/image.axd?picture=image_145.png you need use javascript library custom behavior. jquery ui has implementation http://jqueryui.com/tooltip/ edit you looking when clicked shows ui. more popup or popover. bootstrap has nice implementation: http://getbootstrap.com/javascript/#popovers

sql server - SQL Select with a function -

i have following sql statement : select rtrim(ltrim(replace(lagkart.varenummer,char(2),''))) itemno, rtrim(ltrim(replace(lagkart.sxson,char(2),''))) season, isnull(rtrim(ltrim(replace(lagkart.variant1,char(2),''))),'') variant1, isnull(rtrim(ltrim(replace(lagkart.variant2,char(2),''))),'') variant2, (select * [dbo].[b2bgetspringfinal] ( lagkart.varenummer, lagkart.variant1, lagkart.variant2 )) springavailable lagkart but error : msg 170, level 15, state 1, line 8 incorrect syntax near '.'. but if call function fixed values : select rtrim(ltrim(replace(lagkart.varenummer,char(2),''))) itemno, rtrim(ltrim(replace(lagkart.sxson,char(2),''))) season, isn

logging - How to see smtp server logs from cpanel -

i asked question in stackoverflow , answered check smtp server logs. there way see smtp server logs cpanel. if how? it's not possible check mail server logs through cpanel, have root access check server logs file.

IOS 8 keyboard how to swap between the decimal and numeric keyboard + shift key -

i busy making ios 8 keyboard , need help. i have made basic keyboard , works fine have bumps , need slove them. wrote code in swift(keep in mind i'm new swift). i need following: to swap keyboard decimal(the normal 1 letters) numeric(the number/symbol one) wrote code (it hides keyboards respectively , shows them again) don't know how make run when tap "123" button. when type key eg. "a" prints out how appears on keyboard how can make automatically lowercase , implement shift button give me capital letters? some solve appreciated. here code have far: import uikit class keyboardviewcontroller: uiinputviewcontroller { @iboutlet var nextkeyboardbutton: uibutton! var allbuttons = [uibutton]() override func updateviewconstraints() { super.updateviewconstraints() // add custom view sizing constraints here } override func viewdidload() { //normal keyboard start super.viewdidload() let buttontitles1 = ["q", &qu

c# - How to draw graph using chart in .net windows forms based on time(seconds) -

my requirement draw graph using chart control in .net(windows form or wpf) in c# or vb.net update data serial port.the graph should show received data , plot load value(y axis) against time(x axis).the interval should in seconds , should keep on moving left in ecg or oscilloscope. i made graph not scaling second intervals , not moving , redrawing left. i don't think there built in chart function. guess need split up. >make array, hold data points. >then use timer, , ontimerevent method, put next data point in array, , move along, deleting last one. >and refresh--delete , add--all chart data points array values timer: http://msdn.microsoft.com/en-us/library/393k7sb1(v=vs.110).aspx sorry can't think of simple way

python - How to access cookie and IP fields in DjangoRatings? -

i'm using djangoratings library found here , have running , set up. in views.py file have button executes line of code when pushed: myinstance.rating.add(score=1, user=request.user, ip_address=request.meta['remote_addr'], request.cookies) everything works fine. backend works, columns updated votes etc etc, how can access/call ip , cookie fields , columns in djangoratings can write quick if condition refuses run 'add' line if cookies , ip have voted? thanks in advance help. i've been struggling lot. myinstance.rating contains method get_ratings() - returns queryset calculate votes related object. can extend retrive necessary information. example: # it's lazy object rating = myinstance.rating.get_ratings() # additional query db if not rating.filter(user=user, ip_address=request.meta['remote_addr']).exists(): ...

excel - Adding in information from one spreadsheet to another -

good morning, i have spreadsheet 40,000 products , spreadsheet 35,000 products item id's is there anyway can add in missing 5,000 item id's using forumla? dont want manually go through each item , see missing thank time , help cheers if columna holds unique id's in each sheet please try: =countif(sheet1!a:a,a1) in sheet2 and =countif(sheet2!a:a,a1) in sheet1, both copied down suit. then sort both on results of these columns , copy result in 0 1 sheet other ensure complete sets in both sheets , check whether either sheet has duplicates.

php - Unable to install MySQL using installer. Get error "unable to determine the products that correspond with that setup type" -

beginner here. i'm getting message. unable determine products correspond setup type i above error when trying install mysql, occurs on "choosing setup type" screen on mysql installer. click on "developer default" when click next above error. should note have wamp installed , thinking that, might interfering somehow. can still go way through installer nothing installs or shows on following pages. solutions, there work around based around wamp? not able find or maybe wasn't searching right terms. running on windows 7 machine 64-bit. choose custom install , choose product want install. it work me.

html5 - What means "runtime" in Intel XDK? -

i new mobile development , interested hybrid apps , of course intel xdk. when reading intel xdk's documentations faced "runtime" word. what mean of phrase , it's mean when saying crosswalk html5 runtime, ... in blog post . apologize me if asking 1 of stackoverflow's stupid questions. "runtime" refers time program runs , opposed other times in programs life cycle compile time . software typically written, compiled, deployed or installed, run. these different phases referred "compile time", "install time" , "runtime". e.g. "at compile time, compiler ..." . " a runtime" software package necessary at, well, runtime. e.g. library, interpreter, virtual machine or other such supporting packages. crosswalk system takes in html 5 "apps" (including html, javascript etc.) and, well, makes them work. executes them. runs them. it's browser engine, not packaged browser, system

haxe - Casting Dynamic to an other class -

i know if that's possible cast dynamic other class (partially or totally) for example, code breaks : class test { public function new() {} public var id: string; } class main { public static function main() { var x:dynamic = jsonparser.parse("{\"id\":\"sdfkjsdflk\"}"); var t:test = cast(x, test); } } with following message class cast error however, "test" class has "id" field dynamic object. (that's example, use case more complexe ^^) so, don't understand how object dynamic one. this isn't casting dynamic class instance may accomplish same thing: create empty instance of class type.createemptyinstance set of fields dynamic object on new class instance using reflect example: import haxe.json; class test { public function new() {} public var id: string; } class main { public static function main() { var x:dynamic = json.parse(&quo

angularjs - ng-include with ng-src not working -

i'm trying compile template has data-ng-include , data-ng-src defined. i'm trying set src calling getpartial() , returns path of template. getpartial() not getting called. html: <button ng-click="displayelements();">display elements</button> <div id="container"></div> js: $scope.displayelements = function() { var template = '<div data-ng-include data-ng-src="getpartial()"></div>'; var linkfn = $compile(template)($scope); //console.log(angular.element(document.getelementbyid("container"))); angular.element(document.getelementbyid("container")).append(linkfn); } $scope.getpartial = function() { console.log("from partial"); return 'hello.html'; } plnkr : http://plnkr.co/edit/ig9taxvpk4k1bqwi9pqo?p=preview '<div data-ng-include data-ng-src="getpartial()"></div>'; replace code this '<div

php - Notice: Undefined variable in function += -

this question has answer here: reference - error mean in php? 30 answers in couple scripts i've created same error when connect on wampserver. every thing running smooth don't errors. notice: undefined variable the $watdan function giving me error. for example i've amounts need count up: 2835 + 11024 i've multipled those. when use code: $total[0] = $totaal->amount; $total[1] = $totaal->price; $watdan += $total[0] * $total[1]; im getting right answer 13859 i'm getting error i've mentioned. now when add $watdan=0; 11024 without given error. this full code: $pak14 = $db->query("select * log_drops inner join log_items on log_drops.item = log_items.name , log_drops.game = log_items.game log_drops.log_id = '".$id."' order log_drops.log_name asc") or die

c++ - Typedef a shared_ptr type with a static custom deleter, similar to unique_ptr -

i have read through many questions on over custom deleter shared_ptr , unique_ptr , , difference between two. but, still haven't found clear answer question: how can 1 best go creating type acts shared_ptr custom deleter, similar how unique_ptr has deleter part of type definition? for unique_ptr usage, use deleter class, handles deletion of individual types (limiting 2 types, brevity): struct sdl_deleter { void operator()( sdl_surface* ptr ) { if (ptr) sdl_freesurface( ptr );} void operator()( sdl_rwops* ptr ) { if (ptr) sdl_rwclose( ptr );} }; using surfaceptr = std::unique_ptr<sdl_surface, sdl_deleter>; using rwopsptr = std::unique_ptr<sdl_rwops, sdl_deleter>; which can used like surfaceptr surface(img_load("image.png")); and call sdl_freesurface upon destruction. this fine , well. however, how 1 go achieving same shared_ptr ? type defined as template< class t > class shared_ptr; and