Posts

Showing posts from July, 2010

javascript - Content Security Policy not working for Ionic serve -

in index.html have meta tag: <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> when run ionic serve (ionic version 1.6.1) following error: refused load script ' http://localhost:35729/livereload.js?snipver=1 ' because violates following content security policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' http://localhost:8100 " does knows how fix this? i noticed, have set script-src self means scripts load domain same origin (host name). your port number changed when run on web server because chooses randomly selected port run application. not have knowledge ionic server csp , can conclude that. in case, localhost:35729 , localhost:8100 not same policy header blocks loading of script. to fix this, better use host name app.

excel - If statement to copy cells if they are NOT blank else, don't copy -

i wanna ask how should write if statement copy , paste data on range of cells if not empty, , if range of cells empty, should not copy anything. any suggestion appreciated. thanks! this copies cell values column 1 (usedrange) column 2 if cell not empty: option explicit public sub copyifnotempty() dim cel range, lrow long 'next line determines last row in column 1 (a), of first worksheet lrow = worksheets(1).usedrange.columns(1).rows.count 'iterate on every cell in usedrange of column each cel in worksheets(1).range("a1:a" & lrow) 'cel represents current cell 'being processed in iteration of loop 'len() determines number of characters in cell if len(cel.value2) > 0 'if cel not empty, copy value cell next 'cel.offset(0, 1): cell offset current cell ' - 0 rows current cell's row (1 row below, -1 row above) '

sql server - Naming a column as a parameter passed in to a stored procedure -

i have stored procedure takes in parameter @n , @colname , uses @n compute information. right @colname nothing because t-sql not allow make column name parameter. there examples of people saying can through dynamic stored procedure, far can tell, not want. the reason behind because want create stored procedure uses other stored procedure several times , passes different values of @n , @colname. so clarify again, able write dynamic stored procedure this: select a, b, c @colname t1 b = @n then once can that, write other stored procedure this: exec stored_procedure1 @n = 3, @colname = 'column 1' exec stored_procedure1 @n = 6, @colname = 'column 2' any on appreciated. in advance you need make dynamic query below exec ('select a, b, c ['+ @colname + '] t1 b = ' + @n) hope rest can figure out.

c# - FTP upload not working when run async, but works when run sync -

i trying upload file via ftp, , want report progress user. following this suggestion , couldn't make work. if call code synchronously, works fine... ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://myftpserver.com/test.zip"); request.credentials = new networkcredential("uid", "pwd"); request.method = webrequestmethods.ftp.uploadfile; using (filestream inputstream = file.openread(@"d:\test.zip")) { using (stream outputstream = request.getrequeststream()) { byte[] buffer = new byte[64 * 64]; int totalreadbytescount = 0; int readbytescount; while ((readbytescount = inputstream.read(buffer, 0, buffer.length)) > 0) { outputstream.write(buffer, 0, readbytescount); totalreadbytescount += readbytescount; int progress = (int)(totalreadbytescount * 100.0 / inputstream.length); debug.writeline(" " + progress + "%"); } } } ...b

html - display content before footer in report odoo -

i'm trying display div "test" before div footer , did code : <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <template id="mysale_report" inherit_id="report.external_layout_footer"> <xpath expr="//div[@class='footer']" position="before"> <div class ="test"> fix content </div> </xpath> </template> </data> </openerp> but nothing show , in fact if change 'before' 'after' div test appear inside footer . question why cant display before footer . there way display content before footer ? , . if using debian jessie, need install manually wkhtmltopdf library form here , because version of wkhtmltopdf available in debian repositories not support headers , footers. if before or using other os, try t

c# - Wpf - Speed ListBox -

i've got wpf application , i'm having speed/time issues. i've got grid 2 columns. left column contains panel listbox, , when 1 of items selected creates new panel , sets @ right column of grid. i've got fixed panel on left , changing panel on right. my right panel contains details , listbox. when keep changing right panel (change selection of left panel) gets slow , ui freezes. able find issue, , listbox. has complex itemtemplate , explain why slow. my listbox itemtemplate: <datatemplate> <stackpanel orientation="vertical" verticalalignment="center" horizontalalignment="{binding ., converter={staticresource myconverter}}"> <textbox style="{staticresource mystyle}" text="{binding property, converter={staticresource myconverter}}" horizontalalignment="{binding ., converter={staticresource myconverter}}" fontsize="10" visibility="{binding property, converter={sta

shell - To Split into fixed sequences and leave extra out -

i limit files of same fixed length last item can variable size not more 557. means file amount can more determined flag -n of command split . code 1 (ok) $ seq -w 1 1671 > /tmp/k && gsplit -n15 /tmp/k && wc -c xaa && wc -c xao 557 xaa 557 xao where xaa first file of sequence, while xao last one. increase sequence 1 unit causes 5 unit increase (557->562) in last file xao not understand: $ seq -w 1 1672 > /tmp/k && gsplit -n15 /tmp/k && wc -c xaa && wc -c xao 557 xaa 562 xao why increase of one-unit in sequence increase last item (xao) 5 units? code 2 $ seq -w 1 1671 | gsed ':a;n;$!ba;s/\n//g' > /tmp/k && gsplit -n15 /tmp/k&& wc -c xaa && wc -c xao 445 xaa 455 xao $ seq -w 1 1672 | gsed ':a;n;$!ba;s/\n//g' > /tmp/k && gsplit -n15 /tmp/k&& wc -c xaa && wc -c xao 445 xaa 459 xao so increasing whole length 1 sequence (4 characters) leads 4 ch

java - Non-static method execute() cannot be referenced from a static context -

i don't understand why i'm receiving compile error; none of classes or methods involved here static. maybe can shed light here. in mainactivity class have declared public class extends asynctask: public class asyncstuff extends asynctask<string, void, string> { ... } in non-activity class have public function should fire async task: public class util { public void executeasyncmethod(){ mainactivity.asyncstuff.execute(new string[]{"test" }); // error here } } i have tried instantiate object of mainactivity.asyncstuff class , execute execute() method, doesn't work either since it's not in enclosing class. can't move somewhere else because need update ui needs stay in mainactivity class. anyhow, need figure out why executeasyncmethod() method doesn't compile. thank you!! define this: public static class asyncstuff extends asynctask<string, void, string> { ... } and run this: public class

html - Div overflowing container div with height: 100%, overflow: hidden breaks scroll-y -

first, fiddle: https://jsfiddle.net/bsdvc4km/1 i'm having trouble aligning inner div take rest of height of container. can see in fiddle, div "whole" has header attached it, , underneath "content" div. "whole" div overflowing "content" div height 100%, instead of grabbing height of parent "content", grabs height of entire viewport. <div class="whole"> <div class="left"> </div> <div class="right"> </div> </div> this container should fitting inside <div class="content"> <div class="whole"> </div> <div> the reason there 2 divs, "chrome" , "content", hold left , right divs react app , "chrome" div wrapper around component returns. if add overflow:hidden "chrome" div, appears solve problem. however, because heights still tall, merely invisible,

c# - How to move jQuery from <head> tag to <footer> tag in Orchard 1.7.3 CMS -

i have project requirement per which, need move tag adds jquery, tag tag. i able find 'documemnt.cshtml' has tag. in view file, display(model.head) used render rest of stuff, including jquery. i having hard time figuring out 'jquery' coming , how move script tag location in html document. one of other stuff rendered 'document.cshtml' favicon. tried find no success. somewhere including jquery @ head of document. need move foot. search script.require("jquery").athead() , change .atfoot(); don't try move around shapes, guaranteed end badly.

C# Enum Flag - two ways binding - enum - class -enum -

i have following enum [flags] public enum weekdays { monday = 1, tuesday = 2, wednesday = 4, thursday = 8, friday = 16, saturday = 32, sunday = 64 } in ui, user can select ceratain days: monday, tuesday, wednesday example. user selection of monday, tuesday, wednesday 7. values saved in databse in column called days. now if have class: public class week { public bool monday { get; set; } public bool tuesday { get; set; } public bool wednesday { get; set; } public bool thursday { get; set; } public bool friday { get; set; } public bool saturday { get; set; } public bool sunday { get; set; } } how can bind value 7 , make appropriate properties true or false. example: 7 equivalent monday, tuesday, wednesday enum. if convert value 7 class week, result properties: monday, tuesday, wednesday true, , rest false. if instead have class week properties: monday, tuesday, wednesday true, , convert enum weekdays result 7. how

apache spark - Increase memory available to PySpark at runtime -

i'm trying build recommender using spark , ran out of memory: exception in thread "dag-scheduler-event-loop" java.lang.outofmemoryerror: java heap space i'd increase memory available spark modifying spark.executor.memory property, in pyspark, @ runtime. is possible? if so, how? update inspired link in @zero323's comment, tried delete , recreate context in pyspark: del sc pyspark import sparkconf, sparkcontext conf = (sparkconf().setmaster("http://hadoop01.woolford.io:7077").setappname("recommender").set("spark.executor.memory", "2g")) sc = sparkcontext(conf = conf) returned: valueerror: cannot run multiple sparkcontexts @ once; that's weird, since: >>> sc traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'sc' not defined you set spark.executor.memory when start pyspark-shell pyspark --num-executors 5 --drive

android - how to fix: executio failed for task app:compiledebugRenderStript -

android studio showing unknow constant tag 0 in class file /com/android/internal/compiler/renderscriptprocesor$abi why showing error, started new project default configurations of android studio , and continues showing same error please check if following exists in build.gradle file: renderscripttargetapi renderscriptsupportmodeenabled renderscriptndkmodeenabled if so, remove it.

php - $SESSION not working despite numerous tries and search online -

i coding online quizzer using php. whenever answerer of quiz choose correct answer, code automatically +1 overall score. to that, used $_session['score']=0; first set score 0 , $_session['score']++; whenever answerer gets answer correct each question. however, have no idea why score not adding despite answerers answering questions correctly. when answerer answers question correctly, score still 0 reason , have no idea why. may know went wrong? thank you. things have tried: 1.changing $_session['score']++; $_session['score']+1; 2.changing: if(!isset($_session['score'])){ $_session['score']=0; } to $_session['score']=0; 3.changing if($correct_choice == $selected_choice){ $_session['score']++; } to just: if($correct_choice = $selected_choice){ $_session['score']++; } below code process.php: <?php include 'database.php'; ?> <?php session_star

unity3d - How to use GUITexture in unity -

i'm newbie unity. i've seen guitexture in scripting , don't know how use it. want know can guitexture , how show guitexture on screen. please me. gui(graphic user interface) textures, images can displayed on screen , adding layer on camera. mean if place gui texture on screen, no matter player goes, appear in same position relative players camera. example of using gui textures if wanted make health bar displayed in corner of players view. how use gui textures: public class testgui { //declare texture, can multiple ways public texture texturetype1; //this type more blurry because being rendered texture rather plain image public 2dtexture texturetyple2; //this type less blurry texture, , used 2d elements public guitexture texturetype3; //this type clearest , meant solely gui public void ongui() { gui.drawtexture(new rect(xoffset, yoffset, width, height), texturetype3); //this texture drawn not f

c# - MVC Display Template for Summing Totals -

i want display summary totals in table-footer without creating special property in view-model. however...the footer code fails, saying: "templates can used field access, property access, single-dimension array index, or single-parameter custom indexer expressions." footer code looks like: <tfoot> <tr> <td colspan="6" class="bg-gray"></td> </tr> <tr> <td colspan="2"> totals not include price consessions </td> <td> @html.displayfor(modelitem => model.entities.sum( x => x.price)) </td> <td> @html.displayfor(modelitem => model.entities.sum(x => x.annualfee)) </td> <td> &nbsp; </td> </tr> </tfoot> just leave out @html.displayfor , put @model.entities.sum( x => x.price)

windows - Delete zero byte files write file name to text file -

i have following in batch script , works deleting files of 0 byte size in target directory how can modify append text file each file name textfile called results.txt set "targetdir=c:\users\william\desktop\test" /f "delims=" %%a in ('dir/s/b/a-d "%targetdir%\*.*"') ( if %%~za equ 0 del "%%~a" ) so in results.txt might see somefilename.jpg anotherfile.png yetanotherfile.jpg i've tried adding >results.txt various parts of script no luck set "targetdir=c:\users\william\desktop\test" /f "delims=" %%a in ('dir/s/b/a-d "%targetdir%\*.*"') ( if %%~za equ 0 echo %%~na>>results.txt & del "%%~a") try :)

java - How can a parameter in a Generic method be assigned to an Integer and a Character class at the same time? -

why code isn't showing compilation error? public class generic { public static void main(string[] args) { character[] arr3={'a','b','c','d','e','f','g'}; integer a=97; system.out.println(non_genre.genmethod(a,arr3)); } } class non_genre { static<t> boolean genmethod(t x,t[] y) { int flag=0; for(t r:y) { if(r==x) flag++; } if(flag==0) return false; return true; } } if write normal code this(shown below) public class hello { public static void main(string[] args) { character arr=65; integer a='a'; if(arr==a) //compilation error,shows incompatible types integer , character system.out.println("true"); } } then why above above running fine,how can t of integer class , array of t of character class @ same time,a

pycharm - Spectral Python Display not staying up -

i'm experimenting spectral python library, , whenever try re-create first example here: http://www.spectralpython.net/graphics.html image window appears , disappears. i'm scripting in pycharm, doing wrong? my code identical code in example, without line numbers of course turns out had bigger problems, wasn't using wx backend matplotlib, meaning attempt display window naught. i've since moved anaconda, , have run new errors! @ least not 1 :d

javascript - React - populating <li> error -

hello implement basic navigation in react, have following code: edited .js var navigation = react.createclass({ getdefaultprops: function() { return { navigationitems: [ { 'id': 1, 'name': 'home', 'url': '/home' }, { 'id': 2, 'name': 'about', 'url': '/about' }, { 'id': 3, 'name': 'contact', 'url': '/contact' } ] }; }, render: function() { return ( <nav> <ul> {this.props.navigationitems.map(function() { return ( <li><a href={this.props.url}>{this.props.name}</a></li> ); })} </ul> </nav> ); } }); module.exports = navigation it's throwing me following error: uncaught typeerror: cannot read property 'props' of undefined . ideas why? unless have in d

javascript - Turning jQuery event listener on after off -

so want turn off jquery event under condition (if user scrolls down) if opposite (scroll up) want event turned on fire. this code new jquery, pretty sure i'm missing in handler - don't know should be. here code: function myfunction() { var handler = function(e){ //code here } var position = $(window).scrolltop(); $(window).scroll(function() { var scroll = $(window).scrolltop(); if(scroll > position) { // scrolling downwards $(window).off("scroll", handler); } if(scroll < position) { //scrolling upwards $(window).on("scroll", handler); hypedocument.showpreviousscene(hypedocument.kscenetransitionpushtoptobottom, 1.1) } position = scroll; }); } $(function() { var handler = function(e){ // hypedocument.showpreviousscene(hypedocument.kscenetransitionpushtoptobottom, 1.1) console.log('handler'); } var position = $(window).scr

objective c - Creating and assigning a value to lvalue when the rvalue depends on the lvalue -

i bit surprised see code not throw compile error, , bit curious why works. packet object contains byte-array, , read these custom methods. function read bytes location length . usually, write: uint8_t byte; byte = *(uint8_t*) [packet getbytes:&byte startingfrom:&bytelocation length:sizeof(byte)]; but surprise see following line seems valid. uint8_t byte = *(uint8_t*) [packet getbytes:&byte startingfrom:&bytelocation length:sizeof(byte)]; can illuminate me how right hand side of statement can depend on left hand side have been created? there potential pitfalls should worried though not getting compile time errors (for ios 8 application)? thanks edit: without getting specifics of why function written way (which reducing lines of code on page), function copy value byte array of bytes, , returns value. auto advances bytelocation length parameter, can call these lines 1 after parse byte data array it's value components. the packet object contains

javascript - Choose which fields to submit in a form -

i using hidden form in python cgi code pass information on cgi file (let's call printer.cgi) print information in forms. have made clickable text links point same printer file tutorial: http://www.thesitewizard.com/archive/textsubmit.shtml the hidden form contains massive, nested dictionary has been encoded text json. printer file turns string dictionary object. based on link clicked, printer file decides information in dictionary print. however, decoding , encoding entire dictionary inefficient , slows down program. instead submit through hidden form smaller dictonary objects print rather entire dictionary. here example of doing: javascript code: function getdetails(selectedfield) { document.results.resultstoprint.value = selectedfield; document.results.submit(); } python method: def transfertestresults(testresults, printer_file_directory): form = "<form name = 'results' method = 'post' action

powershell v2.0 - Accessing values in an object resulting of a parsed JSON -

have following json (too big fit here), i'am not able value using [system.reflection.assembly]::loadwithpartialname("system.web.extensions") $ser = new-object system.web.script.serialization.javascriptserializer $jsonobj = $ser.deserializeobject($json) $jsonobj.servers | where-object {$_.name -eq 'tendaji'} | ` select-object { $_.ipv4addr } i receive $_.ipv4address -------------- 113.55.212.113 how return 113.55.212.113 ? have : $_.ipv4address | get-member get-member -inputobject $_.ipv4address you may have array $_.ipv4address[0] be carreful you've got error inside json : "name": "aboubacar""ipv4addr": "143.179.56.126" should : "name": "aboubacar", "ipv4addr": "143.179.56.126" then $jsonobj.servers[0].ipv4addr gives 113.55.212.113 so in code can use : ($jsonobj.servers | where-object {$_.name -eq 'tendaji'}).i

Python: Updating one key of the pair adding the previous value to the new one - Dictionary/Hash -

in problem giving sequence of pairs: «number of student» «grade(partial)», gives final grade of students ordered highest grade lowest, , students same grade orders them using student number lower higher. eg. input: 10885 10 70000 6 70000 10 60000 4 70000 4 60000 4 10885 10 output: 10885 20 70000 20 60000 8 here's code have far: nice={} try: open('grades.txt') file: data = file.readlines() except ioerror ioerr: print(str(ioerr)) each_line in data: (number, grade) = each_line.split() nice[number]=grade num,grade in sorted(nice.items()): print(num,grade) output get: 10885 10 60000 4 70000 4 which means grade being overriden everytime updates, there way can sum grade if belongs student number instead of overidding it? something of likes of: for num,grade in sorted(nice.items()): if(num in finaldic): //finaldic being new dicionary create //find number , update grade adding existent else():

agile - In Sprint methodology when should the adaptive part be done? -

in sprint, plan @ start , try follow plan next 2 weeks. see sprint teams changing things while sprint in progress. question : when following sprint-based agile software development process, normal adaptive while sprint in progress, or any adaptive changes should occur @ end sprint these changes can incorporated next sprint? to me seems counter-productive adaptive within sprint period, since violate fundamental principle of 'execute plan succeed'. example as example, let's sprint next 2 weeks has been planned 5 tasks assigned each of 4 developers in team. then, after week sprint, team lead adds task 'developer 1' , 'developer 5'. this example of changing things i.e. being adaptive when sprint in progress. in view, should not happen since amounts changing plan set out achieve, , in end doesn't team or stakeholders. after all, trying follow plan next 2 weeks , not next 6 months, , have full opportunity after 2 weeks change things around ,

git - Spring Cloud Config Server + BitBucket -

i'm trying spring cloud's config server setup bitbucket private repository , haven't had luck. no matter configuration use, seem 404 returned when trying load configuration. i've tried setting breakpoints in jgitenvironmentrepository never seems called outside of afterpropertiesset . if manually triggering findone(application,profile,label) while debugging, error branch name <null> not allowed . if specify "master" label property, dreaded ref master cannot resolved error. the app loads fine no results. documentation i've read, seems should work out of box. appreciated. bootstrap.yml server: port: 8888 spring: application: name: config-service cloud: bus.amqp.enabled: false config: enabled: false failfast: true server: prefix: /configs git : uri: https://bitbucket.org/[team]/[repo].git username: [user] password: [pass] repo files - demo.app.yml att

javascript - How to work around the Firefox SDK bug where uninstall is never called as a reason -

according firefox add-on sdk documentation here: listening load , unload when trying run following function acts listener when user disables or uninstalls add-on if reason parameter string "uninstall" never called. example follows: exports.onunload = function (reason) { if(reason === 'uninstall') { tabs.open("http://www.google.com"); } }; as mentioned code never run when reason string uninstall bugged , not work. wondering if knew work around specific bug can redirect user specific url when uninstall add-on. this because unload done first. on purpose prevent addon developer malicious intent doing bad things if user chooses uninstall addon. far know there no way work around strictly within addon.

javascript - Align objects with dynamic width in SVG -

Image
i generating svg needs include dynamic text elements. general structure follows: -------------------------------------------- | <rect> <text> <rect> <text>| | | | | | | -------------------------------------------- or bit clearer - it's legend @ top of chart: the rectangles 5px 5px colored boxes, both text elements dynamic in width. 4 elements need aligned right. is there way somehow 'float' 4 elements next each other. have looked @ far seems indicate each of these elements needs explicit x , y coordinate don't know until text rendered. i'm aware there javascript options available ('getbbox()' etc) wondered if there using svg dom itself? here's solution doesn't have javascript. uses font-awesome <tspan> draw entire text. update: added "roboto" fon

r - paste not returning values concatenated -

i trying column names of dataframe use them in call, apply call returns values separated, instead of concatenated correctly. did wrong here? df<-data.frame(c(1,2,3),c(4,5,6)) colnames(df)<-c("hi","bye") apply(df,2,function(x){ paste("subscale_scores$",colnames(x),sep="") #this command trying run #lm(paste("subscale_scores",colnames(x))~surveys$npitotal+ipip$extraversion+ipip$agreeableness+ipip$conscientiousness+ipip$emotionalstability+ipip$intelimagination) }) goal output: subscale_scores$hi subscale_scores$bye is there need apply ? is mean? paste0('subscale_scores$', names(df)) # [1] "subscale_scores$hi" "subscale_scores$bye" if need them concatenated newline say, add , sep='\n' . the paste0 shorthand paste(..., sep="") . a note on lm call later - if want lm(y ~ ...) y each of columns separately, try: lms <- lapply(colnames(df),

javascript - What's the use of textContent/innerText when innerHTML does the job better? -

this might newbie question of explained me innertext gets element's text , can't modified using html tags, while innerhtml same job , html can used. so, what's point in having of them? advantages of textcontent on innerhtml : it works on nodes, not elements. var node = document.createtextnode('hello'); node.innerhtml; // undefined node.textcontent; // 'hello' it gets text contents of element, without having strip html tags manually. var el = document.createelement('div'); el.innerhtml = 'a<p>b<span>c</span>d</p>d'; el.textcontent; // "abcdd" (html tags stripped successfully) it sets contents of element bunch of plain text, without having html-escape it. var el = document.createelement('div'); el.textcontent = 'a<p>b<span>c</span>d</p>d'; el.children.length; // 0 (plain text html-escaped successfully) sure, when use them on elements, innerhtml

Using scons to compile c++ file with -std=c++11 flag -

i trying compile c++ file -std=c=+11 option using scons. file : test.cc #include <unordered_map> int foo() { return 0; } file : sconstruct env = environment() env.append(cxxflags = '-std=c++11') #print env['cxxflags'] src_files = split('test.cc') lib_name = 'test' library(lib_name, src_files) i getting following error. seems cxxflags not taking effect when g++ invoked: g++ -o test.o -c test.cc in file included /usr/include/c++/4.8.2/unordered_map:35:0, test.cc:2: /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error file requires compiler , library support iso c++ 2011 standard. support experimental, , must enabled -std=c++11 or -std=gnu++11 compiler options. #error file requires compiler , library support \ ^ scons: *** [test.o] error 1 i have read few postings compiling c++ files -std=c++11 option modifying "construction environment", feel have done. can please help. thank you, ahme

javascript - Username availability check using AJAX -

i'm trying develop small website in php test skills. found myself stuck when decided implement live username availability check sign process, javascript knowledge basic. right when put name in username field, loading image , nothing else. have done: my login.php page stored in /views folder: <section> <div> <form action="?action=login" method="post"> <input type="text" placeholder="username" name="username" id="username" onkeypress ="check()"> <span id="usernamestatus"></span> </form> </div> </section> my js file stored in /views/js: function check () { var status = document.getelementbyid('usernamestatus'); var u = document.getelementbyid('username').value; if(u != ""){ status.innerhtml = '<img src="views/img/wait.gif" alt=&qu

r - dplyr sql -- reading from multiple schemas without copy == TRUE -

i have large tables in 2 different schemas inside same greenplum postgresql database want join using dplyr. cannot provide reproducible example because involves proprietary data, can provide code (with names suitably changed). in sql select column_name(s) schema1.table1 inner join schema2.table2 on schema1.table1.column_name=schema2.table2.column_name; using dplyr, my_db <- src_postgres(host = "s.net", user = "id",password = "xxx",dbname="db1", options="-c search_path=schema1") my_db_src <- src_postgres(host = "s", user = "id", password = "xxx", dbname="db1", options="-c search_path=schema2") tbl1 <- tbl(my_db, "table1") tbl1 <- tbl(my_db_src, "table2") cc_compare <- inner_join(tbl1 ,tbl2,by="customerid",copy=true) i'd join them in dplyr without using copy == true, takes long time. can dplyr accomplish , if how?

.net - Quartz.Net scheduler - What specifically indicates successful job completion? -

is sole factor in quartz determining if job successful if job's execute() method completes without having thrown jobexecutionexception? this assumption i've been working under; if wire listener job , jobexception parameter == null in jobwasexecuted(...) assuming quartz considers job successful. i asking because have seen others check triggerstate within jobwasexecuted(...) , if triggerstate.complete, appear considering job successful. checking state of trigger itself, not job, correct? if case, triggerstate of complete mean trigger has fired? so 2 things looking confirm: lack of thrown jobexecutionexception inside job's execute method (and hence null in listener) means (to quartz) job completed successfully and triggerstate not indicator of job completion success what job being successful depend on how write job. example, have job each of our clients. it's designed continue if there exception or issue while doing work 1 client. in other

perl - How to enable "pretty" JSON rendering in Mojolicious::Lite? -

simple question. how turn on "pretty" json rendering in mojolicious::lite? i'm developing restful api , see output in bit more human readable format. you override default json renderer in startup method. for minimal example: use json::xs; our $json = json::xs->new->utf8->pretty; sub startup { $self = shift; ... $self->app->renderer->add_handler(json => sub { ${$_[2]} = $json->encode($_[3]{json}); }); } the default handler defined in mojolicious/renderer.pm , use mojo::json::encode_json .

Make a PowerPoint presentation using Python? -

so have collection of close 90 photographs along caption , date stored in text file. images of variable sizes , automate procedure of converting data powerpoint presentation, 1 picture on 1 slide along date , caption title. reliable methods present? check out python-pptx library. useful creating , updating powerpoint .pptx files. also quick examples in python-pptx screenshots, can check link .

Django internal 200 error after changing some code -

i have git repository, use django project. when change locally, push , pull @ "real" server. settings.py files ignored, there no conflict. after latest pull however, following error: [sun jul 05 16:59:05 2015] [error] no handlers found logger "django.request" [sun jul 05 16:59:05 2015] [error] [client 127.0.0.1] mod_wsgi (pid=30560): exception occurred processing wsgi script '/home/libraring/webapps/libraring/src/mysite/wsgi.py'. [sun jul 05 16:59:05 2015] [error] [client 127.0.0.1] traceback (most recent call last): [sun jul 05 16:59:05 2015] [error] [client 127.0.0.1] file "/home/libraring/webapps/libraring/lib/python2.7/django/core/handlers/wsgi.py", line 187, in __call__ [sun jul 05 16:59:05 2015] [error] [client 127.0.0.1] response = self.get_response(request) [sun jul 05 16:59:05 2015] [error] [client 127.0.0.1] file "/home/libraring/webapps/libraring/lib/python2.7/django/core/handlers/base.py", line 199, in get_respon

haskell - How does one pipe `rawRequestBody` into `requestBodySource`? -

yesod has rawrequestbody following type signature: rawrequestbody :: monadhandler m => source m bytestring and http-conduit has function converts source requestbody : requestbodysource :: int64 -> source (resourcet io) bytestring -> requestbody i want able stream rawrequestbody s3 object converting requestbody inside handler , resourcet io ~ monadhandler doesn't compute , can't seem monadhandler m => m -> resourcet io i've tried: transpipe - if source handler bytestring rawrequestbody seems way @ bytestring consume it, i.e transpipe ??? rawrequestbody :: source (resourcet io) bytestring handlertoio - seems request body cleared there won't data available please :) the function wairequest give wai request value. can use sourcerequestbody source that.

python - Nested for-loops and dictionaries in finding value occurrence in string -

i've been tasked creating dictionary keys elements found in string , values count number of occurrences per value. ex. "abracadabra" → {'r': 2, 'd': 1, 'c': 1, 'b': 2, 'a': 5} i have for-loop logic behind here: xs = "hshhsf" xsunique = "".join(set(xs)) occurrences = [] freq = [] counter = 0 in range(len(xsunique)): x in range(len(xs)): if xsunique[i] == xs[x]: occurrences.append(xs[x]) counter += 1 freq.append(counter) freq.append(xsunique[i]) counter = 0 this want do, except lists instead of dictionaries. how can make counter becomes value, , xsunique[i] becomes key in new dictionary? the easiest way use counter: >>> collections import counter >>> counter("abracadabra") counter({'a': 5, 'r': 2, 'b': 2, 'c': 1, 'd': 1}) if can't use python library, can use dict.get

Writing from one file to another python -

i trying take information got webpage , write 1 of variables file having no luck easy i'm lost. here example of 1 of rows there 1253 rows. <div class='entry qual-5 used-demoman slot-head bestprice custom' data-price='3280000' data-name="kill-a-watt allbrero" data-quality="5" data-australium="normal" data-class="demoman" data-particle_effect="56" data-paint="" data-slot="cosmetic" data-consignment="consignment"> i after field called data-name not @ same spot in each row. tried did not work mfile=open('itemlist.txt','r') mfile2=open('output.txt','a') row in mfile: if char =='data-name': mfile2.write(char) edit 1: i made example file of 'hello hi peanut' if did: for row in mfile: print row.index('hello') it print 0 expected when changed hello hi didnt return 1 returned nothing. let’s try

javascript - Animation continues after once trigged by scroll -

i made bar chart css , animation low works well, want run when trigged scroll. somehow animation after trigged scroll not stop, keeps running. in inspect element latest bar. jquery // bar chart animation function barchart(){ $("#demographicsbars li .bar").each( function( key, bar ) { var percentage = $(this).data('percentage'); $(this).animate({ 'height' : percentage + '%' }, 1000, function() { $('.viewerdemographics #demographicsbars li .bar').css('overflow','inherit'); }); }); }; // scroll call animation $(window).scroll(function () { $('.viewerdemographics').each(function () { var imagepos = $(this).offset().top; var imageheight = $(this).height(); var topofwindow = $(window).scrolltop(); if (imagepos < topofwindow + imageheight && imagepos + imageheight > top

syntax error, unexpected end of file in PHP -

this question has answer here: php parse/syntax errors; , how solve them? 12 answers this registration page code. don't know why giving me syntax error. although in page seems fine. here code: <?php // grab user submitted information if (isset($_post["register"])) { $name = $_post["name"]; $email = $_post["email_address"]; $utdid = $_post["utd_id"]; $uname = $_post["email_address"]; $password = $_post["password"]; // connect database $con = mysql_connect("localhost","root",""); // make sure connected succesfully if(! $con) { die('connection failed'.mysql_error()); } // select database use mysql_select_db("planner",$con); $result = mysql_query("insert user(name, utdid, username, password) values ('$name', '$utdid', '$una

How to declear association from an array in Rails 4 model? -

we following in user model: class user < activerecord::base model_names = ['pets', 'computers' ] model_names.each |a| has_many #{a.to_sym} end end is code above going work in rails 4? or better way that. thanks. yes can that, rails expects names lowercase, snake-case symbols instead of class names. you can try tableize that if need them classnames, you'll need like: model_names.each |a| has_many a.tableize.to_sym end though tbh i'd go other way eg: class user < activerecord::base model_names = [:pets, :computers ] model_names.each |a| has_many end end then if ever needed use model_names elsewhere use: model_names.map{|a| a.classify } possibly constantize turn real class.

ios - Local Notification custom sound NOT playing after OS8.3 -

as apple updated os 8.3 local custom sounds weren't playing. i've done right, because worked <=8.2, code shouldn't issue, in case how i've created notifications: fyi 30 sec or less first converted them caf format using apples supplied code then added project. have verified it's in resource bundle. have verified assigned target. it's still not playing, did in previous os versions. here schedule method: - (void) schedulelocalnotification { nsstring *localnotificationsound; localnotificationsound = [[nsbundle mainbundle] pathforresource:@"clock" oftype:@".caf"]; uilocalnotification *timerdonenotification = [[uilocalnotification alloc] init]; timerdonenotification.soundname = localnotificationsound; timerdonenotification.alertbody = @"time up!"; timerdonenotification.alertaction = @"reset"; timerdonenotification.firedate = [nsdate datewithtimeintervalsincenow:secondsleft]; timerdonenotification.timezone =

Rails cache will block the clients' request while they are making -

Image
prevent requests blocked caching , auto regenerate fresh caches we can make rails cache , , set expires time that rails.cache.fetch(cache_key, expires_in: 1.minute) `fetch_data_from_mongodb_with_complex_query` end somehow, when new request comes in, expiration happens, , request block. question is, how can avoid kind of situation? basically, want give previous cache client's request while rails making cache. as shown in the expected behaviour diagram, second request cache 1 not cache 2 , although rails making cache 2 . therefore, user won't have spend time on making new cache. so, how can automatically regenerate caches without users' request trigger it? expected behaviour cache snippet cache_key = "#{__callee__}" rails.cache.fetch(cache_key, expires_in: 1.hour) all.order_by(updated_at: -1).limit(max_rtn_count) end update how cached keys in command ? because cached query can generate composition of start_da

html - use a class instead of id in a link -

is possible make link go id: <a href="http://example.com/page#someid"> instead go class: <a href="http://example.com/page.someclass"> would page scroll wildly , down, trying reach elements class, or nothing? it nothing, except file called "page.someclass" @ server , yield 404. please refer url spec because you're wildly confusing css selectors 'hash' part of url.

angularjs - How to change maxlength value in angular -

i'm new angular. im trying change value of maxlength 300 140 on click. buttons loaded using ng-repeat , first 1 1 that's supposed change value 140, rest should go 300. here's have in controller: //character counter $scope.counter = function() { var myel = angular.element(document.queryselector('.form-control')); myel.attr('maxlength', '150'); }; and html this: <textarea data-ng-model="view.post.content" ng-trim="false" maxlength="340" class="form-control" style="height: 100px;"></textarea> just use ng-maxlength , bind property on scope, provide validation safety. example:- <textarea data-ng-model="view.post.content" ng-trim="false" ng-maxlength="maxvalue" class="form-control" style="height: 100px;"></textarea> if want restrict use interpolation maxlength={{maxvalue}

spring boot - How to speed up unit tests with less configuration -

the unit test template of jhipster great, sometime, especially, during coding, need write unit test code , run frequently. unit test start tomcat container , many other module, don't need if want test service function. now test class this: @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = application.class) @webappconfiguration @integrationtest @transactional public class someclasstest { ..... how can modify initialize spring container , db? thanks. if not need server, don't make test integration test. if remove @webappconfiguration , @integrationtest spring boot start regular (i.e. non-web context) , not start tomcat. if need go further, can disable features, either via application-test.properties + @activeprofiles("test") disable stuff via config or using exclude parameter of @springbootapplication (or @enableautoconfiguration ) lukas said already.

initializing class properties before use in Swift/iOS -

i'm having trouble grasping proper way of instantiating variables need set before object functional may need instantiated after constructor. based on swift's other conventions , restrictions seems there design pattern i'm unaware of. here use case: i have class inherits uiviewcontroller , programmatically create views based on user actions i need attach these views class, need retrieve content based on configuration data supplied controller i don't care if configuration data passed constructor (in case required) or supplied secondary call object before used my problem seems both of approaches in bullet 3 seem flawed. in first case, there 1 legitimate constructor class can called with, yet i'm forced override other constructors , initialize member variables fake values if other constructors never intended used (i'm trying keep these variables let types based on swift's best practices). in second case, i'm splitting constructor 2 parts ,

reactjs - Does using Meteor with React mean that you don't have to use IronRouter or FlowRouter? -

i've been exploring more meteor react 1 question hasn't been answered going through documentation whether react removes need router or rather if removes need bind collection router , abstracts rendering router function; routing. does make sense? what i'm trying figure out if ironrouter suffice meteor+react app or if should move flowrouter paradigm if i'm taking reactive path anyways. react can used in conjunction iron router or other routing systems provided in meteor packages. personally, have integrated react router , routing system built on top of react, , use , forgo both blaze , router built on top of blaze. doing makes easier me manage routes , components in single react component. have demo repository on github can starting point setup tutorial goes through repo step step if want go down path.

java - XAdES4j verification certificate chain -

Image
i have problem verify xades signatures in application uses xades4j api. try verify 2 singed files, 1.docx , 2.pdf . when verify 2.pdf exception 18:03:38.230 [http-listener-1(5)] error p.c.k.i.repository.pki.digitalsignverifierservice - invalid certification path. xades4j.providers.cannotbuildcertificationpathexception: unable find valid certification path requested target @ xades4j.providers.impl.pkixcertificatevalidationprovider.validate(pkixcertificatevalidationprovider.java:257) ~[xades4j-1.3.1.jar:na] @ xades4j.verification.xadesverifierimpl.verify(xadesverifierimpl.java:175) ~[xades4j-1.3.1.jar:na] @ pl.comp.kbf.services.ejb.repository.pki.digitalsignverifierserviceimpl.verifyfilesignature(digitalsignverifierserviceimpl.java:95) ~[kbfportalejb.jar/:na] @ pl.comp.kbf.services.ejb.repository.pki.digitalsignverifierserviceimpl$proxy$_$$_weldclientproxy.verifyfilesignature(unknown source) [kbfportalejb.jar/:na] @ pl.comp.kbf.portal.documents.registered.f