Posts

Showing posts from July, 2013

html - Why isnt the google search function working by pressing "Enter" or "Return" in keyboard? -

i attempting @ creating homepage in can set browser home page. below "google search" function open google whatever searched if click google button. when press "enter" in text area, reloads page. my problem whenever press "enter" on keyboard, reloads page instead of opening google whatever words put box. i want google open whatever search box says pressing enter or google button. <form> <input class="form-control radius-input" id="textbox" type="text" placeholder="search on google..." onkeydown="if (event.keycode == 13 || event.which == 13) { location='http://www.google.com/search?q=' + encodeuricomponent(document.getelementbyid('textbox').value);}" /> <a class="btn btn-common btn-lg pull-right " id="googlelink" href="notrequired" onclick="this.href='http://www.google.com/search?q=' + encodeuricomponent(document.gete...

java - How to add clicable a href to attachment of email sended from javax.mail -

i sending email javax.mail. i sending attachments (some files, example pdf.) i want add link attachment email body this: dear user, can download file in attachment link "download" my code is: string cidlinks = "<br>"; int counter = 0; (string attachments : email.pathtoattachments) { string ciddata = "<data" + (counter) + ">"; mimebodypart mimebodypart = buildmimebodypart(attachments, ciddata); multipart.addbodypart(mimebodypart); counter++; cidlinks += "<a href='cid:" + ciddata + "'> " + mimebodypart.getfilename() + "</a>" + "<br>"; } and mimebuilder is: private mimebodypart buildmimebodypart(string path, string id) { mimebodypart emailmemebodypart = new mimebodypart(); try { datasource source = new filedatasource(path); emailmemebodypart.setdatahandler(new datahandle...

java - Method to count all rows in my database crashes my app -

i trying count rows in app. call following method app crashes: public int getdbplacescount() { string countquery = "select * " + table_db_verladestellen_eintrag; sqlitedatabase db = this.getreadabledatabase(); cursor cursor = db.rawquery(countquery, null); cursor.close(); // return count return cursor.getcount(); } the exception: caused by: java.lang.illegalstateexception: attempt re-open already-closed object: sqlitequery: select * orte can tell me did wrong? you tried cursor count, line above close connection database. should count first, close connection, like: public int getdbplacescount() { string countquery = "select * " + table_db_verladestellen_eintrag; sqlitedatabase db = this.getreadabledatabase(); cursor cursor = db.rawquery(countquery, null); int count = cursor.getcount(); cursor.close(); // return count return cou...

swift - PopOverViewController: Wrong alignment of the top arrow -

Image
i use popoverviewcontroller in swift application show dat when button pressed. button clickable black line can see in attached picture. the problem top arrow (i'm not sure how should call it?) popoverviewcontroller should right under black button. here function of display popoverviewcontroller: @ibaction func btnshowmoretapped(_ sender: anyobject) { let vc = storyboard?.instantiateviewcontroller(withidentifier: "popoverviewcontroller") as! popoverviewcontroller vc.preferredcontentsize = cgsize(width: uiscreen.main.bounds.width - (uiscreen.main.bounds.width / 5), height: 310) let navcontroller = uinavigationcontroller(rootviewcontroller: vc) navcontroller.modalpresentationstyle = .popover navcontroller.isnavigationbarhidden = true let viewforsource = sender as! uiview let popmenu = navcontroller.popoverpresentationcontroller popmenu?.delegate = self popmenu?.sourceview = viewforsource present(navcontroller, animated:...

ios - Swift: How to enable and disable annotations on map view? -

i have code displays annotations on map view. however, i'm trying have function can enabled or disabled when user taps uiswitch button. suggestions on how can achieve this? in advance! let thehouse = mkpointannotation() thehouse.coordinate = cllocationcoordinate2d(latitude: 38.8977, longitude: -77.0365) thehouse.title = "the house, dc" thehouse.subtitle = "new jersey, dc" mymapview.addannotation(thehouse) myannotations.append(thehouse.title!) //switch toggles annotation... @ibaction func turnoffannotations(_ sender: uiswitch) { //code enables , disables annotation? if toggle.ison{ let visible = mymapview.visiblemaprect let inrect = mymapview.annotations(in: visible) annotation: mkannotation in mymapview.annotations{ if (inrect.contains(anno as! anyhashable)){ mymapview.removeannotation(annotation) } } } else { let visible = mymapview.visiblemaprect l...

Matlab GUI - winopen Excel on specific sheet -

i have excel file test.xlsx multiple sheets e.g. matrix1 , matrix2 . connect specific sheets of file different push-buttons in matlab gui. i have tried use winopen, opens file, not specific sheet in workbook. there simple way this?

java - Twitter Spring Social - filter does not work -

i'm writing spring web application , need monitor new tweets of user. i'm using spring-social-twitter , i'm trying exploit streaming feature, i'm not able catch new tweets :( any suggestions? @requestmapping("twitter/notify") public string twitternotify(){ twitter twitter = new twittertemplate(consumerkey, consumersecret, accesstoken, accesstokensecret); streamlistener listener = new streamlistener() { @override public void onwarning(streamwarningevent warningevent) { // todo auto-generated method stub system.out.println("onwarning"); } @override public void ontweet(tweet tweet) { // todo auto-generated method stub system.out.println("tweet: " + tweet.getfromuser() + " -> " + tweet.gettext()); } @override public void onlimit(int numberoflimitedtweets) { // todo au...

Python retrieving data from web HTTP 400: Bad Request Error (Too many Requests?) -

i using python module (googlefinance) retrieve stock information. in code, create symbols list gets sent loop collect information each symbol. the symbols list contains 3000 indexes why think getting error. when try shortening range of loop (24 requests), works fine. have tried tried using time delay in between requests no luck. how can make can retrieve information specified symbols without getting http 400 error? from googlefinance import getquotes import pandas pd import pymysql import time import threading import urllib.request def createsymbollist(csvfile): df = pd.read_csv(csvfile) saved_column = df['symbol'] return saved_column def getsymbolinfo(symbollist): newlist=[] in range(int(24)): newlist.append(getquotes(symbollist[i])) return newlist nyselist = createsymbollist("http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download") try: l=(getsymbolinfo(nyselist)) ...

Google Maps API - Javascript Filter -

i utilizing google maps api in application polygons visualize locations. im trying allow user filter attribute using select , update polygons on change filtered output. filter returning correct data not updating polygons. going wrong? filter $('#species_select').change(function(){ $.get( '/species_filter', $('#species_select').val(), function(data){ console.log(data); infowindow.close(); // map.fitbounds(bounds); } ); }); polygons var map; var infowindow; // map display options function initmap() { map = new google.maps.map(document.getelementbyid('map'), { zoom: 9, center: {lat: 42.05, lng: -70.25}, maptypeid: google.maps.maptypeid.satellite }); ...

java - JavaFX: Having issues making a draggable node -

Image
i'm attempting make node i've created draggable. i'm able place nodes @ point in pane, when comes dragging them around, seem automatically offput. i've tried making delta class contain x , y updated accordingly during pressing of mouse on node. nfapane.setonmousepressed(event -> { if (!event.getbutton().equals(mousebutton.primary)) return; (final nfanode node : nfanodes) if (node.ishover()) return; final nfanode nfanode = new nfanode(nfanodes.size(), event.getx(), event.gety()); nfapane.getchildren().add(nfanode); nfanodes.add(nfanode); delta dragdelta = new delta(); nfanode.setonmousepressed(event1 -> { dragdelta.setdragdeltax(nfanode.getlayoutx()); dragdelta.setdragdeltay(nfanode.getlayouty()); }); nfanode.setonmousedragged(event1 -> { nfanode.moveto(event1.ge...

.net - Disable default use of Accept-Language header in ASP.Net Core -

in asp.net core, have following setup per documentation on establishing culture in application: var supportedcultures = new[] { new cultureinfo("en-ca"), new cultureinfo("fr-ca"), new cultureinfo("fr"), new cultureinfo("en"), new cultureinfo("en-us"), }; var defaultrequestculture = configuration["settings:culture:defaultrequestculture"]; if (defaultrequestculture == null) { defaultrequestculture = "en-ca"; } app.userequestlocalization(new requestlocalizationoptions { defaultrequestculture = new requestculture(defaultrequestculture), supportedcultures = supportedcultures, supporteduicultures = supportedcultures }); i've added settings:culture:defaultrequestculture appsettings.json file can configured on per site installation basis. this documentation indicates order can changed, unfortunately doesn't provide example on how it. it indicates these 3 providers used default: ...

python - Trying to move turtle object to random location -

i'm trying switch method allow fish try 4 random locations next move. i've tried few cracks @ it, haven't figured out way yet. def trytomove(self): offsetlist = [(-1, 1), (0, 1), (1, 1), (-1, 0) , (1, 0), (-1, -1), (0, -1), (1, -1)] randomoffsetindex = random.randrange(len(offsetlist)) randomoffset = offsetlist[randomoffsetindex] nextx = self.xpos + randomoffset[0] nexty = self.ypos + randomoffset[1] while not(0 <= nextx < self.world.getmaxx() , 0 <= nexty < self.world.getmaxy()): randomoffsetindex = random.randrange(len(offsetlist)) randomoffset = offsetlist[randomoffsetindex] nextx = self.xpos + randomoffset[0] nexty = self.ypos + randomoffset[1] if self.world.emptylocation(nextx, nexty): self.move(nextx, nexty) i don't comment on code can't run i'll take crack @ this. belo...

refresh - Android invalidate() not updating textView -

i'm trying make textview update alongside timed loop. i've tried making invalidate() every time loops. seems work, app crashes when timer starts. here's loop: private timer timer; private timertask timertask = new timertask() { @override public void run() { thango += 10; textypoo.settext(integer.tostring(thango)); textypoo.invalidate(); } }; public void start() { if (timer != null) { return; } timer = new timer(); timer.scheduleatfixedrate(timertask, 0, 2000); } here oncreate initialize stuff: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_second); intent intent = getintent(); textypoo = (textview)findviewbyid(r.id.textmcview); } here 2 onclick method. 1 updates textview whenever press it, , calls timer: public void sendthestuff(view view) { setcontentview(r.layout.activity_second); texty...

mysql - Using awk on sql database to change all iframe "width" and "height" sizes -

i have wordpress database thousands of posts in it. need regex , awk command go through database (after mysql dump it) , change sizes uniform size width="600" height="350" currently looks this: some paragraph text here, description [tab:short code here] <iframe width="200" height="180" src="https://www.youtube.com/embed/ad4grqxzpfg" frameborder="0" allowfullscreen></iframe> [tab:different short code here] <iframe src="http://other-videohost.com/embed-ksq9vn3gwc16.html" frameborder=0 marginwidth=0 marginheight=0 scrolling=no width=250 height=300></iframe> result in database should this: some paragraph text here, description [tab:short code here] <iframe width="600" height="350" src="https://www.youtube.com/embed/ad4grqxzpfg" frameborder="0" allowfullscreen></iframe> [tab:different short code here] <iframe src="http://other-...

javascript - Firebase Facebook login with redirect returning null email -

Image
if have following code function facebooksignin(){ var provider = new firebase.auth.facebookauthprovider(); provider.addscope('email'); firebase.auth().signinwithredirect(provider); } firebase.auth().getredirectresult().then(function(result) { if (result.credential) { var token = result.credential.accesstoken; } var user = result.user; console.log(result); }).catch(function(error) { var errorcode = error.code; var errormessage = error.message; var email = error.email; var credential = error.credential; console.log(errormessage); }); i'm trying email facebook login when print user object null email. have included screenshot of user object printed in console check content of firebase.auth().currentuser.providerdata[0].email. should show facebook email. possible have enabled "multiple accounts per email" in firebase console. default new projects singl...

ios - Swift / Objective C - performTransitionOperation Crash -

Image
i've been going @ while , i'd love hear potential solutions. essentially, i'm trying incorporate right menu/nav using swrevealviewcontroller , when attempt go log app , go home screen/logged in landing, app crashes. app doesn't crash when segue modal,etc. continues crash while it's set appropriate segue plugin i'm using. here console output when app crashes: 2016-11-12 22:21:04.861 freely market[16811:3049283] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[freely_market.loginviewcontroller _performtransitionoperation:withviewcontroller:animated:]: unrecognized selector sent instance 0x7fc71950ea30' for wonder ui of application looks - here: 1 login button, user passed onto following screen pending information matche stored within system. 2 segue, sw_front 3 logged in screen 4 segue sw_right 5 menu the segues set properly, , think i'm onto right track when comes finding out issue...

scala - java.util.ConcurrentModificationException in CountVectorizer -

i'm getting java.util.concurrentmodificationexception exception in following block of quote val cvmodel: countvectorizermodel = new countvectorizer(). setinputcol("filtered"). setoutputcol("countvector"). setvocabsize(50000). setmindf(20). fit(cleanedtokenized) i using spark 2.0. how can resolve error?

Paypal payment method in Laravel -

i think have integrate payment method site.my site developed in laravel.that's why looking way add paypal integration. my site there can visit. follow bellow few step: 1)install laravel application 2)database configuration 3)install required packages 4)configuration paypal.php file 5)create route 6)create controller 7)create view file step 1 : install laravel application going scratch, require fresh laravel application using bellow command, open terminal or command prompt , run bellow command: composer create-project --prefer-dist laravel/laravel blog step 2 : database configuration in step, require make database configuration, have add following details on .env file. 1.database username 1.database password 1.database name in .env file available host , port details, can configure details in system, can put bellow: .env db_host=localhost db_database=homestead db_username=homestead db_password=secret step 3 : install required packages have req...

JavaScript + CSS3 animations not working properly? -

i programming library called quickly.js . there conceal(milliseconds) , display() functions, have animations programmed through css. conceal function animation working correctly, display function animation not work correctly. not fade in. instead, abruptly appears. here jsfiddle demonstrating bug: https://jsfiddle.net/v6esmqtf/6/ . you didn't have display function set up. element.prototype.conceal = function(ms) { ms = ms || 0; var thisstyle = this.style; thisstyle.opacity = 0; settimeout(function() { thisstyle.display = "none"; }, ms); }; element.prototype.display = function(ms) { ms = ms || 0; var thisstyle = this.style; thisstyle.display = ""; settimeout(function() { thisstyle.opacity = 1; }, ms); }; and then... document.getelementbyid("conceal").onclick = function() { document.getelementbyid("get").conceal(800); }; document.getelementbyid("display").onclick = function() { d...

swift - Linker Error occurs when using Firebase and Google pods -

Image
i having linker error being produced on build , don't know how fix it. have tried many solutions on stackoverflow , none of them have worked me. appreciated. (summary of error: ld: 44 duplicate symbols architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) error message: to begin, had looked through many solutions , tried of them, none of them had worked, started go through these steps: recreate project, keep important things. recreated project copying assets , main.storyboard files new 1 had created. installing pods correctly. went terminal, , watched video carefully, explained pods needed firebase/auth , googlesignin. used pod init initialize pods in project. then, used open podfile , install pods needed. when in podfile, turned off smart quotes because had created errors in project before. typed in pod 'firebase/auth' , pod 'googlesignin' saved file, , ran pod install . afterwards, must open .xcworks...

regex - finding a character in a pattern in regular expression -

i trying find occurances of equals within quotes in string if input string is: anything='', bob2='age=24, sex=m', dilan=24, noble1='yellow' i wish find characters follows anything='', bob2='age=24, sex=m', dilan=24, nobel1=24 ^ ^ followed replacing as anything='', bob2='age~24, sex~m', dilan=24, nobel1=24 ^ ^ i tried following find occurances '[^',].+?' but didnt work. it's quite difficult implement requirement regex. i'd iterate string char char implement it. please check code below. have put comment inside it. i'm using java can utilize algorithm inside it. public class main { public static void main(string args[]){ string input = "param1='', param2='age<b>=</b>24, sex<b>=</b>m', param3=24, param4='yellow'"; char[] arr = input.tochararra...

assembly - GDB expressions -

0x00000000004013fb <+334>: mov 0x602500(,%rax,8),%rdx i want know 0x602500(,%rax,8) means. there source code 0x00000000004012fb <+78>: movq $0x400a8c,0x2011fa(%rip) # 0x602500 <func> 0x0000000000401306 <+89>: movq $0x400d44,0x2011f7(%rip) # 0x602508 <func+8> 0x0000000000401311 <+100>: movq $0x400faa,0x2011f4(%rip) # 0x602510 <func+16> 0x000000000040131c <+111>: movq $0x401262,0x2011f1(%rip) # 0x602518 <func+24> 0x0000000000401327 <+122>: movq $0x401295,0x2011ee(%rip) # 0x602520 <func+32> each 0x400a8c, 400d44, 400faa, 401262 , 401295 address of functions guess 0x602500(,%rax,8) choose proper function execute rax. want make sure guess from gnu documentation: https://sourceware.org/binutils/docs/as/i386_002dmemory.html#i386_002dmemory an intel syntax indirect memory reference of form section:[base + index*scale + di...

python - Calculate row value referring previous rows in panda dataframe -

i'm trying figure out way compare values different rows in dataframe calculate new column. i've found these ways: iterate on rows (i'm looking vectorized solution): for index, row in df.iterrows(): .... merge same dataframe multiple times using shift on index, this: d1 = data.shift() data.merge(d1[["value col"]], how="inner", left_index=true, right_index=true) is there way access current dataframe apply method: dataframe.apply(myfunction(row),axis=1) def my_function(row, current_dataframe) index = row.name row_to_compare = current_dataframe.iloc[index-delta] row["new column"] = calc(row["value], row_to_compare["value"]) return row passing argument doesn't seem work: data.apply(date_diff,axis=1,args=(data)) or data.apply(lambda row,df: date_diff(row, df),axis=1,args=(data)) keeps saying: > valueerror: truth value of dataframe ambiguous. use a.empty, a.bool(), a.item(), a...

java - log4j.properties gets overwritten when creating a "fat-JAR" using Gradle -

one of java projects exports executable "fat-jar" file ready deployment. creating jar file using gradle, followed instructions described here : task fatjar(type: jar) { manifest { attributes 'implementation-title': '<human_readable_title_of_your_package>', 'implementation-version': version, 'main-class': '<path_to_the_main_application_class>' } basename = project.name + '-all' { configurations.compile.collect { it.isdirectory() ? : ziptree(it) } } jar } the task illustrated recursively go through dependency tree, unzip jars if needed, , squash together. problem far of dependencies come own log4.properties files, overwrite 1 have written myself. of them reside within same level respective resources folders , when files merged together, later ones seem overwrite ones have been added before. so far, solution have found, manually set path right file, using...

iOS Push Notifications Flow -

i'm working on push notification flow not getting how handle it. need simple explanation, when push notification comes which delegate called 1. when user tap on push notification label 2. when user tap on app icon when push notification comes please me because i'm unable maintain app application state me flow should like when user tap on push notification label : should open particular viewcontroller when user tap on app icon when push notification comes : should open same viewcontroller app goes in background how can achieve in xcode 8.1/ios 10.1.1. also i'm using background mode remote notification , background fetch thanks in appdelegate.m used check user tap icon - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { //handle notification when user click while app running in background or foreground. if(application.applicationstate == uiapplicationstateinactive) { nslog...

opengl - 2D Rectangle stroke in GLSL -

i'm attempting draw rectangle modern opengl using shader fill , stroke. i'm sending fill color, stroke color , stroke width uniform block in fragment shader (along rectangle position , size). recommended way setting stroke fragments stroke color , fill fragments fill color? at moment, have 2 ideas floating in head. first, if statement checks whether frag coordinate within bounds of rectangle or rectangle stroke , set frag color based on that. methods produce quite large complex if statement , when comes time rotate rectangle, may worse. (also, i've read branching in shader should avoided) the second idea have use signed distance function determine color, unfamiliar using these , have idea don't sharp corners well. am way off mark here? there perhaps better way this? the fragment shader sounds stage late if want rasterise stroke. fragment shader executed after rasterisation process has been performed. if can make recommendation, i'd using geometry...

How to convert a time whch given in string and find the difference in java and convert back to string -

this question has answer here: calculating difference between 2 java date instances 43 answers i have following time given day in sting format. "begin_time_tz": "00:00 dst", "end_time_tz": "07:30 dst", i have find difference between them in java. please me find difference , convert string note: date in 24 hour format(00:00 -- 23:59) you can use below method time difference, pass hh:mm without timezone. public long gettimedifference(string time1, string time2) throws parseexception{ simpledateformat format = new simpledateformat("hh:mm"); date date1 = format.parse(time1); date date2 = format.parse(time2); long difference = date2.gettime() - date1.gettime(); return difference/1000; }

android - Firebase code not creating new user -

the code login/register class is: package com.example.joshpc.bluetoothattendee; import android.app.progressdialog; import android.content.intent; import android.support.annotation.nonnull; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.text.textutils; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast; import com.google.android.gms.tasks.oncompletelistener; import com.google.android.gms.tasks.task; import com.google.firebase.auth.authresult; import com.google.firebase.auth.firebaseauth; public class loginactivity extends appcompatactivity { private edittext etemail; private edittext etpassword; private edittext etregpw; private firebaseauth firebaseauth; private button loginbut; private button regbut; private progressdialog message; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(...

c# - print multiline textbox data of crystal report for 270 degrees rotated text -

hello want print multi line text object, text object set 270 degrees rotation that's why can grow option disable, there others way it. you can use wraping field in crystal report open crystal report open the open report want enable word wrap report right click on field want word wrap. select format object then place check in box can grow , set maximum line number.

c# - Should I create a new method to handle the event or override the base method? -

i'm using class derived uielement class when writing uwp program using c#, want include handling input controls such mouse , keyboard actions. see there virtual methods says onsomeevent() , can override these method fit handling process, or can create new method handling public events defined in base class, , subscribe them these input events in constructor. assume these 2 methods both work i hope know more professional or more advisable way of doing this, , why. explain why ms offers these 2 ways @ same time. here's events , methods of uielement class https://msdn.microsoft.com/en-us/library/system.windows.uielement(v=vs.110).aspx#examples and paragraph of quoting uielement provides starting point element layout characteristics, , exposes virtual methods derived classes can override, can influence layout rendering behavior of element , child elements. of input , focusing behavior elements in general defined in uielement class. includes events keyboa...

Excel - combining two csv files into one with a common column -

i working 2 datasets in csv form (movielens latest-small dataset). given below fields of both. rating.csv user_id movie_id rating movie.csv movie_id movie_name what want combine them single .csv following fields user_id movie_id movie_name rating so common column movie_id maps corresponding movie_name . could done using excel? if not, how can it? i need dataset recommender engine, simple solution welcome end result matters. since i've experience in java easy easy understand , implement. if there way using excel best. have tried searching online , found vlookup method couldn't it. also tried online merging tools attached sheets 1 after not mapping column. have no problem using online tools too. check out tool - https://github.com/datafoxco/gocsv - it's based off of csvkit has ton of additional features. 1 of our engineers custom built - , open sourced solve of these data issues deal every day :) it vlookup of sized csv...

ruby on rails - Blog post issue in comments -

Image
i following guide http://guides.rubyonrails.org/getting_started.html have issue. as can see in image, below comments section irrelevant information presenting, , how avoid displaying. helpful if expert sort out. new rails........ remove = in view in front of comments.each . should like: <% @comment.each |comment| %> <-- no `=` here

Android sqlite database -

i have entered exit problem.. my own database file in encrypted zip file , on assets folder. @ first copy zip file in package directory. extract encrpyted zip file zip4j library. extract database file package directory , open database file with; sqlitedatabase database = sqlitedatabase.opendatabase( dbfile.getpath(), null, sqlitedatabase.no_localized_collators | sqlitedatabase.open_readonly); then delete database file dbfile.delete(); (because database file not encrypted , large ~6mb lot of space) but dont delete zip file because encrypted, little size ~2mb and @ each application launch not copy zip file again. although database query's work (but delete database file maybe database open in memory?) but times show problem on logcat; sqliteconnectionpool: sqliteconnection object database '/data/user/0/mypackage/files/mydb' leaked! please fix application end transactions in progress , close datab...

php - Translation filter inside a twig {% raw %} block -

i have html template containing handlebarsjs code include in page render product popups. problem templates bit complex , i'd need translate labels on them too, there way notify exception twig parser? that, though code inside raw block rendered anyway? if use translation tag doesn't work {{ 'translations.project.template.price'|trans }} eg: index.html.twig: {{ include('webbundle:frontend:partials/templates/product-template.html.twig') }} product-template.html.twig: {% trans_default_domain "home" %} {% raw %} {{#if islovepromo}} <div class="product-infotag promo"> promozione <!-- here text i'd translate --> </div> {{/if}} {% endraw %} at moment i'm working aroun passing translations object rendered handlebars have this: index.html.twig: data.translations = { promo: "{{ 'translations.project.template.promotion'|trans }}" } template.render(data); product-templa...

How to check for user data on a oauth protected rest service from second application which has spring security? -

i have rest application secured oauth2 (a1) , 1 (a2) calls a1 login , in general data. the problem login don't want call a2 user entity , register in a1 (which has spring security integrated => need register credential data including password it) i think making rest call a2 (send userid , user role , password) not solution because not secure. can call a2 id , user data including password , role. what approach here? how can user stuff register in spring security (integrated in a1)? , don't want a1 connect same db a2 i don't know if understood correctly, think want authenticate user a2 using same authentication use on a1. you may use sso (single sign-on) authenticate in both a1 , a2. spring security oauth provides means that: https://spring.io/blog/2015/02/03/sso-with-oauth2-angular-js-and-spring-security-part-v

AngularJS + Firebase (not AngularFire) -

i want use storage service of firebase in app angularjs. every document or tutorial had found use angularfire library. library not include storage service angularjs. is possible use firebase services without use angularfire? yes can use firebase features in angularjs without angularfire no restriction angularfire highly recommended angularjs binding firebase . have @ link https://firebase.google.com/docs/web/setup there guidance using firebase alone in javascript project.

java - Unable to mock Jersey ClientResponse using Mockito/PowerMockito -

i trying mock web service call mocking clientresponse in junit tests.i using jersey version 1.6 while unit test doesnt give error . in spite of mocking response calls actual webservice , return actual response. code tested : client client; webresource initresource = client.resource("my_urlendpoint""); clientresponse initresponse = initresource.header("content-type", mediatype.application_json) .accept(mediatype.application_json) .post(clientresponse.class, "myrequeststring"); unit test : @test clientresponse clientresponse=null; webresource webresource=null; builder builder=null; com.sun.jersey.api.client.client client=null; webresource = mock ( webresource.class ); builder = powermockito.mock ( builder.class ); client=mock ( com.sun.jersey.api.client.client.class ); clientresponse=mock(clientresponse.class); when(...

rubygems - Can't start ruby gem robocop (MAC OS X) -bash: robocop: command not found -

i try start robocop gem, terminal returns: -bash: robocop: command not found for example: bundler gem works normaly. what can fix it? thank advice. it's gem list: air-dmitri:rb_dev dk$ gem list *** local gems *** ast (2.3.0) bigdecimal (1.2.8) bundler (1.13.6) bundler-unload (1.0.2) byebug (9.0.6) coderay (1.1.1) did_you_mean (1.0.0) executable-hooks (1.3.2) gem-wrappers (1.2.7) io-console (0.4.5) json (1.8.3) method_source (0.8.2) minitest (5.8.3) net-telnet (0.1.1) parser (2.3.1.4) power_assert (0.2.6) powerpack (0.1.1) pry (0.10.4) pry-byebug (3.4.0) psych (2.0.17) rainbow (2.1.0) rake (10.4.2) rdoc (4.2.1) rubocop (0.45.0) ruby-progressbar (1.8.1) rubygems-bundler (1.4.4) rvm (1.11.3.9) slop (3.6.0) test-unit (3.1.5) unicode-display_width (1.1.1) ruby -v ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] gem -v 2.5....

Java Stream Map T -> ?T:List<T> -

i'm new java , love stream api. got loop: list<filetree> expanded = new arraylist<>(); for(filetree item : tree){ if(item.gettype().equals("tree")){ expanded.addall(gettreeofsubstudpackage(item.getname())); } else{ expanded.add(item); } } and wonder if converted neat stream. first guess following: tree.stream().map(filetree -> { if(filetree.gettype().equals("tree")){ return gettreeofsubstudpackage(filetree.getname()); } else{ return filetree; } }).collect(collectors.tolist()); it compiles fine. recommended, have implemented no-go or there nicer way? , last not least: there overhead in .stream() make improvement worthless? appendix list<filetree> gettreeofsubstudpackage(...){ //... } class filetree { private string name; private string type; private string mode; private string id; //... public getter , setter ... } you need map ...

javascript - Not able to save updated rows in table column with php -

i troubling save records in update set statement within php. im using javascript update record on submit. see below code: /* update record */ $(document).on('submit', '#emp-updateform', function() { $.post("update.php", $(this).serialize()) .done(function(data){ $("#dis").fadeout(); $("#dis").fadein('slow', function(){ $("#dis").html('<div class="alert alert-info">'+data+'</div>'); $("#emp-updateform")[0].reset(); $("body").fadeout('slow', function() { $("body").fadeout('slow'); window.location.href="home.php"; }); }); }); return false; }); /* update record */ note above method retrieving file update.php update set statement lies. see code: if(isset($_post)){ ...

python - Inefficient numpy code -

in python i'm using numpy package math matrices. in code below i'm trying calculate new matrix orignal. xfactors , yfactors both 3x3 matrices. size = self.matrix.shape x in range(1, size[0] - 1): y in range(1, size[1] - 1): submatrix = self.matrix[x-1:x+2, y-1:y+2] newx = (xfactors * submatrix).sum() newy = (yfactors * submatrix).sum() self.newmatrix[x-1][y-1] = newx + newy my problem code inefficient. tested te code 500x500 matrix , takes 2 seconds. have ideas how can optimize code? if xfactors , self.matrix both numpy.array , not numpy.matrix (in other words if using element-wise multiplication , not matrix multiplication in calculating newx , newy), should same thing lot faster: from scipy.signal import convolve2d self.newmatrix = convolve2d(self.matrix, xfactors + yfactors, mode='valid') in original code, not stated xfactors , yfactors square. if weren't 1 need make them square repeating them n...

C++ to Delphi pointer conversion -

i trying convert open source c++ project delphi(berlin 10.1). uses pointers can not find way convert them delphi pointers. how can translate piece code c++ delphi? here code: int solveall(int dragfunction, double dragcoefficient, double vi, double sightheight, double shootingangle, double zangle, double windspeed, double windangle, double** solution) { double* ptr; ptr = (double*)malloc(10*__bcomp_maxrange__*sizeof(double)+2048); double t=0; double dt=0.5/vi; double v=0; double vx=0, vx1=0, vy=0, vy1=0; double dv=0, dvx=0, dvy=0; double x=0, y=0; double headwind=headwind(windspeed, windangle); double crosswind=crosswind(windspeed, windangle); double gy=gravity*cos(degtorad((shootingangle + zangle))); double gx=gravity*sin(degtorad((shootingangle + zangle))); vx=vi*cos(degtorad(zangle)); vy=vi*sin(degtorad(zangle)); y=-sightheight/12; int n=0; (t=0;;t=t+dt){ vx1=vx, vy1=vy;...

Effect of a driver in the host OS to a Docker process -

i'm new docker world, , understand docker not vm (but sort of user space isolation). i wondering happen if install driver on host os. let's have driver hooks syscall open (it's not i'm doing, example made question) , writes "open" every time called. will see open syscalls processes inside docker? same process call outside of docker?

geometry - Cartesian to Latitude/Longtitude -

i have 3d model of 10km x 10km topographic map i've imported sketch-up , model bunch of x,y,z points (where x+ north , z+ straight up, perpendicular ground) i know latitude longitude values of (0,0,0) point. given x,y,z point how latitude longitude values? i need pretty accurate can't assume earth perfect sphere (you can assume it's ellipsoid) for best accuracy need know map projection map drawn in. should able find out map. example in uk ordnance survey maps use osgb36 datum, , projection transverse mercator. projection tells how convert geographic (lat,long datum ellipsoid) coordinates map coordinates (easting , northing) , how reverse calculation, pretty want. if don't know projection, next best thing if find out -- again map, written on -- scale-factor , convergence of projection @ points on map. point there spatially varying difference between map north (the direction north axis points in) , true north (the direction of north pole point, direct...

UILocalNotification in background Swift -

hello guys have question, how can receive notification when app closed? right when i'm near position i'll receive notification inside app , when i'll left position i'll receive notification, don't know how can receive same notifications when app closed. have used 3 functions: // 1. user enter region func locationmanager(_ manager: cllocationmanager, didenterregion region: clregion) { showalert(title: "enter \(region.identifier)") } // 2. user exit region func locationmanager(_ manager: cllocationmanager, didexitregion region: clregion) { showalert(title:"exit \(region.identifier)") } func showalert(title: string) { let alert = uialertcontroller(title: title, message: nil, preferredstyle: .alert) alert.addaction(uialertaction(title: "cancel", style: .default, handler: { (action) in alert.dismiss(animated: true, completion: nil) })) self.present(alert, animated: true, completion: nil) } thanks lo...

Memory leak in C, 2d array in struct -

i need memory leaks. ive been staring @ code while , still cant find out leaks. think freeing everything, unnecessarily, there still something. code #include <stdio.h> #include <stdlib.h> struct matrix{ int **data; int rows; int columns; }; struct matrix matrix_op(struct matrix, struct matrix, char); int** _2d_array(int,int); void print_matrix(struct matrix); void _2d_array_free(int**, int); void _scalar_mul(struct matrix*, int); int** _2d_array(int x,int y){ int** arr; arr = malloc(sizeof(int*)*x); for(int = 0; i<x;++i){ arr[i] = malloc(sizeof(int)*y); } return arr; } void _scalar_mul(struct matrix* a, int s){ (int x = 0; x < a->rows; ++x) { (int y = 0; y < a->columns; ++y) a->data[x][y] *= s; } } void _2d_array_free(int** array, int x){ (int = 0; < x; ++i) { free(array[i]); } free(array); } void exit_err(int err, char* message){ fprintf(stderr,mess...