Posts

Showing posts from May, 2013

download - Content-Disposition in dropbox -

is there way rename file while downloading dropbox without changing filename : for example : dropbox link : https://www.dropbox.com/s/uex431ou02h2m2b/300x50.gif?dl=1 and file downloaded : newnameimage.gif instead of 300x50.gif content-disposition header didn't work me . any ideas how ? if you're downloading file locally should either able control name given local file, or able rename after fact. example, using curl, -jo downloads file using remote name specified in content-disposition header, while -o lets specify name: $ curl -l -jo "https://www.dropbox.com/s/uex431ou02h2m2b/300x50.gif?dl=1" ... curl: saved filename '300x50.gif' $ ls 300x50.gif $ rm 300x50.gif $ curl -l -o "newnameimage.gif" "https://www.dropbox.com/s/uex431ou02h2m2b/300x50.gif?dl=1" ... $ ls newnameimage.gif alternatively, renaming after fact: $ curl -l -jo "https://www.dropbox.com/s/uex431ou02h2m2b/300x50.gif?dl=1" ... curl: saved fil

android - CoordinatorLayout with RecyclerView: onScroll -

i have recyclerview have added different actions can performed on list items. particularly, dragdrop , swipedismiss . dragdrop initiated long-press, , swipedismiss initiated swiping. have watch scroll events block actions happening. annoying scrolling switched dragging. before add onscrolllistener handle this. this did before: @override public void onscrollstatechanged(recyclerview recyclerview, int newstate) { super.onscrollstatechanged(recyclerview, newstate); if(newstate == recyclerview.scroll_state_idle){ drag.setcurrentaction(idle); } else { drag.setcurrentaction(scroll); } } no longer work i added coordinatorlayout collapsable toolbars . when scrolling up, drag wont set scroll until toolbar has been collapsed. tried create own behavior, replace current behavior using; @string/appbar_scrolling_view_behavior . removed behaviors wanted toolbar , didn't work notify drag state. what have tried: @override public boolean ons

sas - How to scan a numeric variable -

i have table this: lista_id 1 4 7 10 ... in total there 100 numbers. i want call each 1 of these numbers macro created. trying use 'scan' read it's character variables. error when runned following code there's code: proc sql; select id into: lista_id separated '*' work.amostra; run; proc sql; select count(*) into: nr separated '*' work.amostra; run; %macro ciclo_teste(); %let lim_msisdn = %eval(nr); %let = %eval(1); %do %while (&i<= &lim_msisdn); %let ref = %scan(lista_id,&i,,'*'); data work.up&ref; set work.base&ref; format perc_acum 9.3; if first.id_cliente perc_acum=0; perc_acum+perc; run; %let = %eval(&i+1); %end; %mend; %ciclo_teste; the error that: variable perc unitialized and variable first.id_cliente unitialized. what want run macro each 1 of id's in list showed before, ,

c++ - Enum or array with structs inside -

i have (constant) data this: (index) width height scale name 0 640 360 1 "sd" 1 1080 720 2 "hd" 2 1920 1080 3 "fhd" so far - have created structure this: struct resolution { int width; int height; int scale; std::string name; }; now need object let me this: int index = 0; int width = resolutions[index].width; // 360 i need enum or array constant, , accessible without initialization (static?). for start constant data not use std::string . but following: struct resolution { int width; int height; int scale; const char * name; }; struct resolution resolutions[] = { {640, 360, 1, "sd"}, { 1080, 720, 2, "hd"}, { 1920, 1080, 3, "fhd"} }; but on note use lowercase variation variable.

vba - Excel Autofilter all but variable value -

so need filter values in row except one. got work, using part of code, filter on everything, "belgium", need there variable. dim myvalue variant myvalue = inputbox("which country exclude? ") range("ab1").select activesheet.range("$b$1:$by$319696").autofilter field:=27, criteria1:="<>belgium" for version of filter filter on particular country variable works fine: dim myvalue variant myvalue = inputbox("which country filter on: ") range("ab1").select activesheet.range("$b$1:$by$319696").autofilter field:=27, criteria1:= _ myvalue activewindow.smallscroll down:=-30 so why not work: activesheet.range("$b$1:$by$319696").autofilter field:=27, criteria1:= <>myvalue also not know why structured this, generated record macro, _ criteria1:= _ myvalue the "<>" isn't operator (which how tried use in "not working&

python - Django multiple inheritance E005 -

in django docs stated in order use multiple inheritance 1 either has to use explicit autofield in base models or use common ancestor hold autofield in case have common ancestor in following setup (as taken docs): class piece(models.model): piece_id = models.autofield(primary_key=true) class article(piece): pass class book(piece): pass class bookreview(book, article): pass unfortunately results in following error: $ python manage.py check systemcheckerror: system check identified issues: errors: testapp.bookreview: (models.e005) field 'piece_ptr' parent model 'testapp.book' clashes field 'piece_ptr' parent model 'testapp.article'. system check identified 1 issue (0 silenced). any way around this? edit: django version 1.8.2 i found out can name link parent: class piece(models.model): pass class article(piece): article_to_piece = models.onetoonefield(piece, parent_link=true) class bo

facebook - allow lifetime checking of users inbox in our web app in fb php sdk -

i doing web app , should run in cron , checks if facebook user (who authorized app) has new unread message in inbox. updates in our database. i using php script: if ( isset( $session ) ) { $request = new facebookrequest( $session, 'get', '/123456/inbox' ); $response = $request->execute(); $graphobject = $response->getgraphobject(); echo print_r( $graphobject, 1 ); } else { $params = array( 'read_mailbox' ); $weburl = "http://example.com/cron.php"; $helper = new facebookredirectloginhelper( $weburl ); $loginurl = $helper->getloginurl( $params ); header("location: $loginurl"); } it works when (user) visit page in browser not working in cron job. how should write php instructions graph api able check of our users' inbox script? (without need of prior login via our page)

mysql - SQL PRIMARY KEY duplicate error same PRIMARY KEY across 3 tables -

getting error having duplicate primary key. how can use same primary key across multiple tables? showing how can use in tables below appreciated. error com.mysql.jdbc.exceptions.jdbc4.mysqlintegrityconstraintviolati onexception: duplicate entry 'jam' key 'primary' create table `skills` ( `playername` varchar(15) not null default '', `testa` double default null, `testb` double default null, `testc` double default null, `testd` double default null, primary key (`playername`) ) engine=myisam; create table `playerrights` ( `playername` varchar(15) not null default '', `rank` int(2) default null, primary key (`playername`) ) engine=myisam; create table `skillsoverall` ( `playername` varchar(15) not null default '', `lvl` int(11) default null, `xp` bigint(11) default null, primary key (`playername`) ) engine=myisam; you can't sp

python - How to group models in django admin? -

lets have group of models must kept separate (visually) in admin group. right alphabetic, jumbles them. i'd organize them way: group 1: (custom named) model 1 model 4 group 2 (custom named) model 2 model 3 i cannot seem find documentation on how this. possible? you need create 2 apps. first app == group 1. second app == group 2. then, need create proxy model in new app. this. class proxyreview(review): class meta: proxy = true # if you're define proxyreview inside review/models.py, # app_label set 'review' automatically. # or else comment out following line specify explicitly # app_label = 'review' # set following lines display proxyreview review # verbose_name = review._meta.verbose_name # verbose_name_plural = review._meta.verbose_name_plural # in admin.py admin.site.register(proxyreview)

How to read GET and POST request in PHP (post is in json) -

Image
i have javascript (not me) sync information between client (javascript) , server (php) , javascript send server , post information, can read easy information try read $_post information , cannot retrieve post information. i try print_r($_post) , returns array() nothing. i try firebug , console firefox , see that how can retrieve , treat json string >transmission de la requete< php code? can retrieve parameters such token, src , etc can't retrieve post transmission. thank helping ! i don't you. since it's json request sent page. can use file_get_contents('php://input') grab json request sent. can decode object or array. example $request = file_get_contents('php://input'); to obtain object $input = json_decode($request); so input fields be $input->name; $input->password; to obtain array $input = json_decode($request, true); so input fields be $input[name]; $input[password];

java - get local android test resources -

when running standard junit tests (not androidtestcase) in android, how can resources in src/test/resources ? i have tried usual... getclass().getresourceasstream("/testdata.dat"); and... thread.currentthread().getcontextclassloader() .getresourceasstream("/testdata.dat"); and gradle copy resources.. task copytestresources(type: copy) { "${projectdir}/src/test/resources" "${builddir}/classes/test" } what confuses me when ask in unit test classloaders path getting resources using classloader classloader = thread.currentthread().getcontextclassloader(); url resource = classloader.getresource("."); it returns: /home/rob/android/sdk/platforms/android-17/data/res can please explain me , tell me how can relative path anywhere in project can use test resources?

javascript - Manually install modules in Adobe CQ 5.6 -

i try install custom google search module from here . documentation explains how install using package manager , way i'll have install same package on every cq instance. there way include package inside code deploy cq, saved in repository , pull code have module installed? an organization specific nexus or apache archiva can helpful in situation maintaining/deploying packages not in central maven/adobe repo. if package not in central repo ("custom google search module" in case) , can upload[0] package local/organization specific nexus/apache archiva , tell your/team member's pom file download . so, pom.xml needs have repository url of local/organization specific nexus/apache archiva or maven settings should have mirror pointing org. nexus/archiva. your project can have dependency of custom google search module follows , <dependency> <groupid>infield-tools</groupid> <artifactid>googlesearch</arti

postgresql - Column data types for materialized views? -

for general tables , views, can see data type running following query: select data_type information_schema.columns ..... however not seem information materialized views appear here. i able list of columns materialized view running: select a.attname column_name pg_catalog.pg_attribute inner join (select c.oid, n.nspname, c.relname pg_catalog.pg_class c left join pg_catalog.pg_namespace n on n.oid = c.relnamespace c.relname ~ ('^(materializedview)$') , pg_catalog.pg_table_is_visible(c.oid) order 2, 3) b on a.attrelid = b.oid inner join (select a.attrelid, max(a.attnum) max_attnum pg_catalog.pg_attribute a.attnum > 0 , not a.attisdropped group a.attrelid) e on a.attrelid=e.attrelid a.attnum > 0 , not a.attisdropped order a.attnum but, have not been able figure out if can dete

JQuery Waypoint function not reseting after resize -

i've looked around extensively on stackoverflow answer , can't find fixes issue. basically, i've got waypoint function fires in header. it's supposed fire in 2 different manners, depending on window width. loading script within width parameters (one less 750 pixels, other greater 750 pixels) results in expected behaviour. if user resizes screen, however, going 800 pixels 400 pixels, function 800 pixels still runs. despite function being bound resize event. i have feeling need refresh function entirely on resize, unsure how achieve this. below code. i've tried running mobileview , tabletview in same function, same result. var _w = math.max( $(window).width(), $(window).height() ); var mobileview = (_w <= 750); var largeview = (_w >= 751); var header_cta = $(".header_cta"); var midbar = $(".midbar"); var header_container = $(".header"); var top_spacing = 0; var waypoint_offset = 1;

android - Application abnormal behavior does not start activity mentioned in intent -

i have 3 major class in application 1) intent service: receive push notification , open activity according notification message , other 2 classes behavior. below code that if(global.ismainscreenrunning){ intent intent = new intent(this, mainscreen.class); intent.setflag(intent.flag_activity_new_task); startactivity(intent); } else if(!global.notificationscreenrunning){ intent intent = new intent(this, notificationscreen.class); intent.setflag(intent.flag_activity_new_task); startactivity(intent); } 2) notificationscreen : mediator screen if application not running screen shown first , on click of yes button of screen mainscreen opened , screen finished. 3) main screen: main screen of application show map. core behavior ts launchmode="singletask" mentioned in menifest file, means if screen running hole data sent onnewintent() method rather opening screen again. now happening in flow is step 1: application in background , push notification c

python - Why Flask gives 404 for files in the same directory with my application -

let's have domain. under home directory of domain have text(.txt) file called note.txt. below https://www.example.com/note.txt when access url, browser display text string contained inside file. when run flask under domain instead of traditional html,css,javascript,php app, server return 404 error though file exists in fact @ same location. can see ftp client. so why server returns 404 error when site hosts python app instead of more traditional html,css,javascript,php app? what missing here flask has its own url routing . python code must exposed through app.route decorator static files, note.txt can served through flask, often handled front end web server (nginx, apache) through configuration the answer "why server returns 404 error" url routing should explicit (nothing happens unless tell happen) instead of implicit (everything on server exposed default). because php chose latter approach, wordpress, drupal, et. al. traditional php sites

ffmpeg concat + invalid data found when processing + check for valid avi file -

i'm using ffmpeg concatenate (merge) multiple avi files single avi file. i'm using following command. ffmpeg -f concat -i mylist.txt -c copy out.avi the list of files merge given in mylist.txt ex 'mylist.txt': file 'v01.avi' file 'v02.avi' file 'v03.avi' ... file 'vxx.avi' however, there problem when 1 of file corrupted (or empty). in case, video contains files corrupted file. in case, ffmpeg return following errors: [concat @ 02b2ac80] impossible open 'v24.avi' mylist.txt: invalid data found when processing input q1) there way tell ffmpeg continue merging if encounters invalid file ? alternatively, decided write batch file check if avi files valid before doing merging. second problem operation takes more time doing merging itself. q2) there fast way check if multiple avi files valid ffmpeg ? (and delete, ignore or rename them if not valid). thanks in advance comments. ssinfod. for information, here

Integrating JIRA Service Desk with PagerDuty -

Image
i create pagerduty incident every time customer creates issue of type (fault) on jira service desk. have created jira user email address provided pagerduty, incident created when jira sent invitation pagerduty, seems indicate when jira sends email, pagerduty gets it. added automation rule (issue notifications did not work didn't find way send notification when issue of type created), notify special user every time issue created fault type. but when create issue of type, nothing seems sent pagerduty. have tested sending email directly email address of pagerduty user , worked. have tested notifying user when issue created in jira service desk , worked too. don't know what's wrong can't email sent pagerduty jira service desk. idea of missed?

r - Error in installing "rgl" package in Yosemite 10.10.4 -

i message whenever try install rgl package on yosemite 10.10.4 error : .onload failed in loadnamespace() 'rgl', details: call: dyn.load(file, dllpath = dllpath, ...) error: unable load shared object '/library/frameworks/r.framework/versions/3.2/resources/library/rgl/libs/rgl.so': dlopen(/library/frameworks/r.framework/versions/3.2/resources/library/rgl/libs/rgl.so, 6): library not loaded: /opt/x11/lib/libglu.1.dylib referenced from: /library/frameworks/r.framework/versions/3.2/resources/library/rgl/libs/rgl.so reason: image not found error: package or namespace load failed ‘rgl’ how can fix this? six years late other people searching solution. solution worked me download , install xquartz https://www.xquartz.org see stackoverflow answers here , here

android - Kivy & Cython compilation error on Ubuntu 14.04.2 -

i made simple hello world app using kivy , python , when try compile android using buildozer, following error: log file : http://pastebin.com/hbbcptem i have gcc,javac , cython installed. how can fix this?

Spring data elasticsearch query products with multiple fields -

es newbie here, sorry dumb question. i have been trying create elasticsearch query products index. i'm able query it, never returns expect. i'm using query builder in wrong way, have tried sorts of queries builders , never got make work expected. my product class (simpler sake of question): public class product { private string sku; private boolean soldout; private boolean freeshipping; private store store; private category category; private set<producturl> urls; private set<productname> names; } category nas name , id use aggregations the boolean field used filters. productname , producturl both have string locale , string name or string url accordingly i building query following logic private searchquery buildsearchquery(string searchterm, list<long> categories, pageable pageable) { nativesearchquerybuilder builder = new nativesearchquerybuilder(); if (searchterm != null) { b

php - OpenTBS RTL issue -

i'm using opentbs plugin tinybutstrong fill docx templates data using php. when i'm trying fill rtl text in template, displayed in right direction (from right left) text seems messy. for example, string: שלמה ארצי (זמר) + 2 will displayed as: שלמה ארצי) זמר2 + ( note when i'm trying copy messy string notepad displayed fine. , when copy word fine. any suggestions? a bit of dirty solution, after 6 hours of digging , testing solution make. php: function f_html2docx($fieldname, &$currval, &$currprm) { $currval='</w:t></w:r><w:r><w:rpr><w:rfonts w:ascii="arial" w:hansi="arial" w:cs="arial"/><w:rtl/></w:rpr><w:t>'.$currval.'</w:t></w:r><w:r><w:t>'; } docx: (add onformat , strconv) [event.name;block=tbs:row;onformat=f_html2docx;strconv=no]

ios - Navigation Between Two View Controller -

i have 2 view controllers. in mainviewcontroller there tabbarbutton when clicked user goes 1stviewcontroller , there uibutton when has clicked user goes 2ndviewcontroller . before making 2ndviewcontroller worked fine. after add segue function in program got error. could not cast value of type 'calculator.1stviewcontroller' (0x791a8) 'calculator.2ndviewcontroller' (0x794c8). briefly code is @ibaction func calculategpa(){ //calucation goes here } override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { var anothername : 2ndviewcontroller = segue.destinationviewcontroller as! 2ndviewcontroller //code here } uibutton perform segue , barbutton nothing go 1stview controller. when run program , click barbutton im getting above error. its because prepareforsegue cant identify button should perform right? how solve it? try code. override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { if (

hibernate - SQL Server hangs when running query with multiple joins on empty tables -

we have experienced appears interesting bug in sql server describe you. hoping find out if bug, , if can found out more information it. if not bug, hope can explain me why not , have unwittingly done wrong. can't seem find description of similar issue , i'm not sure if should report microsoft bug or what. first describe problem briefly , provide details after. in short, problem seems sql server chokes on statements containing many joins when (large?) portion (sorry, can't more specific here in terms of numbers) of tables being joined empty. choke, mean churns , churns away @ query, never finishing, causes sql server stop responding entirely. actually, running query once causes cpu jump 25% , stay there. attempt , cpu jumps 50%. sometimes, cpu go 75% or 100%, @ 50% mark, can't log in database server more. the problem occurs in application have uses hibernate (via coldfusion orm) , has entity (document) sub-classed many different types of document. sql query in qu

mysql - Output failure (No Output!) in PHP if umlaut/mutation in String -

if read text database, contains ü, ö, ä, , on -> function gives no output. its not easy check errors because webhook called script. example (like function): function foo() { global $db_link; $output = "names: "; $res = mysqli_query($db_link, "sql"); while ($data = mysqli_fetch_assoc($res)) { $output .= "desc1: ".$data['name1']."/"; } return $output; } here part of original function: $sql = "select * `member_cars` `car_memberid` = ".$profile_data['member_id']; $res = mysqli_query($db_link_website, $sql); $anzahl_erg = mysqli_num_rows($res); if ($anzahl_erg>0) { $return_var .= "❚ ".$anzahl_erg." fahrzeug(e): "; while ($data = mysqli_fetch_assoc($res)) { if ($i==2) { echo $return_var .= " ".$i." fahrzeug: "; } $return_var .= " ".$data['car_

vba - Excel Multiple XLA AddIns use at the same time -

can 2 excel add ins (named differently containing same code) used @ once? , how select 1 use when running macro on ribbon link example? i have add in lot of code being used in many excel files, want split production , developer add in (only make changes in developer add in). but since add in settings global excel files, how select want use dev or prod add in? i can't rid of production altogether, because regularly need work both. if mean want easier method switch between 2 addins (dev , production) don't use excel addin manager, open addin want if workbook.

How does java generics syntax help avoid type casting? -

Image
below code, import java.util.list; import java.util.arraylist; public class dummy { public static void main(string[] args) { list<string> lst = new arraylist<string>(); lst.add("a string"); lst.add("another string"); string s = lst.get(0); } //end main } when constructor new arraylist<string>(); invoked, array of type object created. .. lst holds object[0] array. so, if array of type object gets created constructor, how javac not see type casting issue in statement string s = lst.get(0); , despite generic syntax used while invoking constructor? here non-generic code: public class mylist { list mydata = new arraylist(); public void add(object ob) { mydata.add(ob); } public object getatindex(int ix) { return mydata.get(ix); } } this code allow store object of type mylist instances even if contract of mylist specifies objects must of

Map screen coord to 3d scene with Vispy -

is there way of doing built in function? i understand have revert transformation of projection screen. tried first obtaining simplified chain matrix with: canvas.render_cs.node_transform(canvas.view.scene).simplified() , canvas.canvas_cs.node_transform(canvas.view.scene).simplified() but lost here when both return chain object. then tried canvas "node_transform" method: canvas.render_cs.node_transform(canvas.view.scene).map((0, 0)) that gives result vector of 4 elements. thought coords of line, isn't. here example code: import sys vispy import app,scene class canvas(scene.scenecanvas): def __init__(self): scene.scenecanvas.__init__(self, keys='interactive', show=true) self.view = self.central_widget.add_view() camera = scene.cameras.turntablecamera(fov=45, azimuth=80, parent=self.view.scene) self.view.camera = camera self.show() def on_mouse_press(self, event): """pan v

How can I pass an instance variable to a placeholder in form_form in Rails? -

i'm trying pass instance variable placeholder in form_for: <h2>sign up</h2> <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) |f| %> <%= devise_error_messages! %> <div class="field"> <%= f.label :number %> <em>(add 1 + area code w/ no spaces; i.e. 15555555555)</em><br/> <%= f.text_field :phone, :placeholder => @phone_number.phone_number %> </div> <div class="field"> <%= f.label :email %><br /> <%= f.email_field :email, autofocus: true %> </div> when 'undefined method `phone_number' nil:nilclass. @phone_number set same controller view ...here corresponding controller class users::registrationscontroller < devise::registrationscontroller before_filter :configure_sign_up_params, only: [:create] before_filter :configure_account_update_params, only: [:update] #before_filt

swift - Why doesn't my In App Purchase purchase the product? -

i'm calling function when press button unlock level nothing happens when this. runs function doesn't ask password or else. doing wrong? func callthis() { if(skpaymentqueue.canmakepayments()) { println("iap enabled, loading") var productid:nsset = nsset(object: "unlockleveltwoplease") var request: skproductsrequest = skproductsrequest(productidentifiers: productid set<nsobject>) request.delegate = self request.start() } else { println("please enable iaps") } } func callthis2() { if(skpaymentqueue.canmakepayments()) { println("iap enabled, loading") var productid:nsset = nsset(object: "unlocklevelthreeplease") var request: skproductsrequest = skproductsrequest(productidentifiers: productid set<nsobject>) request.delegate = self request.start() } else { println("please enable iaps")

python - SciPy Sparse Array: Get index for a data point -

i creating csr sparse array (because have lot of empty elements/cells) need use forwards , backwards. is, need input 2 indices , element corresponds ( matrix[0][9]=34) need able indices upon knowing value 34. elements in array unique. have looked on answer regarding this, have not found one, or may have not understood looking if did! i'm quite new python, if make sure let me know functions find , steps retrieve indices element, appreciate it! thanks in advance! here's way of finding specific value applicable both numpy arrays , sparse matrices in [119]: a=sparse.csr_matrix(np.arange(12).reshape(3,4)) in [120]: a==10 out[120]: <3x4 sparse matrix of type '<class 'numpy.bool_'>' 1 stored elements in compressed sparse row format> in [121]: (a==10).nonzero() out[121]: (array([2], dtype=int32), array([2], dtype=int32)) in [122]: (a.a==10).nonzero() out[122]: (array([2], dtype=int32), array([2], dtype=int32))

c# - Get dynamically created asp control ids(values) using for loop -

how can access similar asp control id's using for loop? have following asp text boxes. <asp:textbox id="pftxtname1" runat="server"></asp:textbox> <asp:textbox id="pftxtname2" runat="server"></asp:textbox> <asp:textbox id="pftxtname3" runat="server"></asp:textbox> <asp:textbox id="pftxtname4" runat="server"></asp:textbox> <asp:textbox id="pftxtname5" runat="server"></asp:textbox> <asp:textbox id="pftxtname6" runat="server"></asp:textbox> and want access these text box value through loop using jquery, how can do? i tried value below code, shows error. var ar_val=[]; for(i=0;i<7;i++) { var txtv = $("#<%=pftxtname"+i+".clientid%>").val().trim(); ar_val.push(txtv); } you mixing client side , server side code, not work way. add commom css clas

ruby on rails - undefined method user_path' form_for -

i have userscontroller , has below code def sign_up @user = user.new end and view page has <div class="col-md-6 col-md-offset-3"> <%= form_for @user |f| %> <%= f.label :first_name%> <%= f.text_field :first_name %> <%= f.label :last_name %> <%= f.text_field :last_name %> <%= f.submit "register", class: 'btn btn-primary'%> <% end %> </div> my routes.rb file contains following entry 'signup' => 'users#sign_up' but when submit form, says actionview::template::error (undefined method `users_path' #<#<class:0x00000004d91490>:0x00000004d90220>) why throw error , need explicity point url in form_for?? why so?? change routes to: resources :users, only: [:new, :create], path_names: {new: 'sign_up'} and rename sign_up action new . reason getting error rails trying guess correct url given resource. si

ruby - How to understand if unless combination in rails? -

i'm reading official rails 4 guide in section . there conditional statements don't understand . this post helps me understand cases confused following example: def ensure_login_has_a_value if login.nil? self.login = email unless email.blank? end end i understand in way : if login.nil? return true. code self.login = email executed, if email.blank? return true . nothing. however when @ code : before_create self.name = login.capitalize if name.blank? i have no idea why if conditional statement there ? when encounter kind of issue , instead of asking on stackoverflow? with this: before_create self.name = login.capitalize if name.blank? end if this: before_create self.name = login.capitalize end then name overwritten login.capitalize . instead, want set name equal login if name isn't set. it's saying "the default value name capitalized version of login". the first bit of code quite conf

Wix - Setting Compatibility Mode on shortcut for all users -

i have msi has installscope set "permachine" , creates shortcut available users: <directory id="programmenufolder"> <directory id="companyshortcutsdir" name="my company" /> </directory> <component id="cmp_mainexeshortcut" directory="companyshortcutsdir" guid="{b857cd9e-xxxx-yyyy-f2090c50c985}"> <shortcut id="myexestartshortcut" name="my product" description="$(var.wix_prodname)" target="[applicationfolder]myapp.exe" workingdirectory="applicationfolder" icon="my.ico" /> <removefolder id="removecompanyshortcutsdir" on="uninstall" /> <registryvalue root="hkcu" key="software\mycompany" name="mainexeshortcut"

android - How to pass score parameter in play-services-turn-based methods? -

i have started exploring google-play-services-turnbased apis. till have been successful in creating match. documentation haven't been able figure out how player's score after completes turn. this onclickstartmatch method. public void onstartmatchclicked() { intent intent = games.turnbasedmultiplayer.getselectopponentsintent(mhelper.getapiclient(), 1, 7, true); startactivityforresult(intent, rc_select_players); } this onactivityresult method in main activity class. if (request == rc_select_players) { if (response != result_ok) { // user canceled return; } // invitee list. final arraylist<string> invitees = data.getstringarraylistextra(games.extra_player_ids); // auto-match criteria. bundle automatchcriteria = null; int minautomatchplayers = data.getintextra( multiplayer.extra_min_automatch_players, 0);

android - In Xamarin error inflating class cardview -

i have used smaple code of xamarin.andoird.support.v7.cardview though bellow error caused by: android.view.inflateexception: binary xml file line #1: error inflating class android.support.v7.widget.cardview remove android support library v7 cardview component , add again! rebuild project , it's done! should not getting error now! tried same , worked.

javascript - accessing html element after it was inserted by DOM manipulation -

this question has answer here: event binding on dynamically created elements? 19 answers i have jquery function when button add_entry clicked, inserts 'save button' inside page this; button shows up, assume part working. $("#add_entry").click(function(){ $("#add_entry").hide(); $('#status').append(<button class="save_entry">test</button>); }); then have yet function supposed called when aforementioned save button clicked: $(".save_entry").click(function(){ alert("i dont work :/"); }); which makes me wonder... a) how dom manipulation work? - since jquery part wrapped $document.ready() method mean cant access 'on-the-fly' created elements ? b) when injecting elements dom manipulation, never appear in source... why? thank time. for dynamically added