Posts

Showing posts from June, 2014

regex - How to get sentences from a paragraph with custom list of words in Python -

i trying read paragraph , capture sentences in words matching dynamic list of words. the python pre-processing steps identify list of words. want use list of words , identify sentences in paragraph has @ least 1 of words list. identified sentences appended new variable. input: "machine learning science of getting computers act without being explicitly programmed. machine learning pervasive today use dozens of times day without knowing it. many researchers think best way make progress towards human-level ai." list of words: computer, researcher output: machine learning science of getting computers act without being explicitly programmed.many researchers think best way make progress towards human-level ai. what best way accomplish ? based partially on this answer : import nltk tokenizer = nltk.data.load('tokenizers/punkt/english.pickle') text = "machine learning science of getting computers act without being explicitly programmed. machine

How to fill subcategories based on category selection in AngularJS -

i have json data this: [ { "id": "1", "name": "abc", "image": "abc.png", "subcategories": [ { "scid": "1", "scname": "abc1" }, { "scid": "2", "scname": "abc2" }, { "scid": "3", "scname": "abc3" } ] }, { "id": "2", "name": "xyz", "image": "xyz.png", "subcategories": [ { "scid": "4", "scname": "xyz1" }, { "scid": "5", "scname": "xyz2" }, { "scid": "6", "scname&

Youtube API V3 commentThreads.list method not returning "shared privately" comments -

while requesting list of comment threads youtube video there comments not appear on results: comments inside private videos comments shared privately i understand normal response when using public api key . happening if i'm using oauth 2.0 access token belonging user , channel owner of target video. it's there workaround this? many in advance can shed light on matter

delphi - Function of a class returning an array that is declared after the class -

i somehow haven't dealt problem before. have class troom = class private width, length, x1,x2,y1,y2, index: integer; public function draw: roomarr; procedure setparam; function getparam: integer; end; now, below that, because delphi 7 can't return arrays of tclass, have declared this: roomarr = array of troom; this somehow fixes problem. no idea why, found solution on internet i using "roomarr" in other functions , works fine, expected. array declared after class (otherwise not know class troom), troom (more precisely function "draw") cannot use it. is there way bypass problem? thanks in advance. a forward declaration of troom : type troom = class; // forward declaration roomarr = array of troom; troom = class ... function draw: roomarr; end; the forward declaration must completed in same type section.

qt - How to handle namespaces in C++? -

i have created dialogbox in qtdesigner //---------- *.h namespace ui { class mydialog; } class mydialog : public qdialog { q_object public: explicit mydialog(qwidget* parent = 0); ~mydialog(); private: ui::mydialog* ui; }; and source // --------- *.cpp mydialog::mydialog(qwidget* parent = 0) : qdialog(parent), ui(new ui::mydialog) { ui->setupui(this); //.. } i structure in namespace encapsulation, have com::example::mydialogs::mydialog like: //---------- *.h namespace com { namespace example { namespace mydialogs { namespace ui { class mydialog; } class mydialog : public qdialog { q_object public: explicit mydialog(qwidget* parent = 0); ~mydialog(); private: ui::mydialog* ui; }; }}} //namespace closing and source // --------- *.cpp namespace com { namespace example { namespace mydialogs { mydialog::mydialog(qwidget* parent = 0) : qdialog(parent), ui(new ui::mydialog) { ui->setupui(this);

ios - How do I make UIWebView pause/play video content programmatically -

i making app load youtube video through uiwebview need able have pause , play @ times. have looked @ answers here , none of them working. have tried this: webview.stringbyevaluatingjavascriptfromstring("var videos = document.queryselectorall(\"video\"); (var = videos.length - 1; >= 0; i--) { videos[i].pause(); };") but nothing. if matters, loading video this: webview.allowsinlinemediaplayback = true webview.mediaplaybackrequiresuseraction = false let embededhtml = "<html><body style='margin:0px;padding:0px;'><script type='text/javascript' src='http://www.youtube.com/iframe_api'></script><script type='text/javascript'>function onyoutubeiframeapiready(){ytplayer=new yt.player('playerid',{events:{onready:onplayerready}})}function onplayerready(a){a.target.playvideo();}</script><iframe id='playerid' type='text/html' width='0' height='0'

java - Android Navigation Drawer Menu should open When App Starts -

my client requirement open navigation menu when app starts, can't change code so...here code, please give me sample code or idea make code workable. advance. https://github.com/shovonacbd/navigationdrawer/blob/master/drawer mdrawerlayout.opendrawer(gravity.left) put in oncreate, after drawer initialized.

ios - SWRevealViewController - How can I make the menu disappear with a tap and/or swipe on FrontViewController -

i developing locator map. how can make menu disappear tap and/or swipe on frontviewcontroller. front view controller map (google map). you can enable use of swipe gestures close menu in swrevealviewcontroller adding pan gesture recognizer view in viewdidload: of view controller. override func viewdidload() { super.viewdidload() view.addgesturerecognizer(myrevealviewcontroller.pangesturerecognizer()) } getting menu respond taps requires handling tap action separately tap gesture recognizer. for example, tap gesture recognizer defined , added view like mytapgesturerecognizer = uitapgesturerecognizer(target: self, action: "closemenu") view.addgesturerecognizer(mytapgesturerecognizer) you close menu function using: func closemenu() { myrevealviewcontroller?.setfrontviewposition(frontviewposition.left, animated: true) } where .left frontviewposition dependent on how have view controllers configured swrevealviewcont

ExtJS 4: How can I get all grid columns in current order? -

when use grid.columns returns columns grid (visible or not), it's not in current order.. then tried grid.getview().getgridcolumns() , returned columns in current order, visible ones. how can columns, visible , not visible, in current order? you can try grid.down('headercontainer').getgridcolumns(); returns visible , non-visible columns grid.down('headercontainer').getvisiblegridcolumns(); returns visible columns

ruby on rails - How to order associated columns case insensitive -

i'm trying order projects customer company names, error: pg::undefinedtable: error: missing from-clause entry table "customers" line 1: ... "projects"."archived" = $1 order lower(customers.... ^ : select "projects".* "projects" "projects"."archived" = $1 order lower(customers.company) asc . this how tried far: projects = project.includes(:customer).order("lower(customers.company) asc") if leave out lower(…) works fine. you need write using references . project.includes(:customer) .order("lower(customers.company) asc") .references(:customers)

android - Google maps javascript api working slow -

i working on app maps on each pages. problem google maps javascript api slows down app very, much... , take time load , not load in slow network. can recommend other maps engine faster google maps are loading map asynchronously? doing may speed application dramatically. asynchronously loading api

ibm - Out of memory exception on WAS 6.1 and EJB 2.1 -

my application going out of memory , getting internal server error time , after automatically recovered , application running fine. my application hosted on 6.1 , using struts 1.1 , ejb 2.1. here application server logs error. please me on issue please. [7/14/15 12:58:06:238 bst] 00000038 httpconnectio e unable read , handle request: null [7/14/15 12:58:19:793 bst] 00000464 discoveryserv w dcsv1115w: dcs stack defaultcoregroup @ member gal72050cell\gal72050\fleetmanagement_1: member gal72050cell\gal72050\cid_1 connection closed. member removed view. dcs connection status discovery|ptp, transmitter closed. [7/14/15 12:58:19:808 bst] 00000468 ltpaserverobj w secj0371w: validation of ltpa token failed because token expired following info: token expiration date: tue jul 14 10:53:38 bst 2015, current date: tue jul 14 12:58:19 bst 2015. [7/14/15 12:58:19:816 bst] 00000467 ltpaserverobj w secj0371w: validation of ltpa token failed because token expired following info: token

r - Copy script after executing -

is there possibility copy executed lines or script working directory? so normal scenario is, have stand alone script need sourced within working directory , need. after few month, made update these scripts , love have snapshot script when executed source... so file.copy(itself, '.') or this. i think you're looking for: file.copy(sys.frame(1)$ofile, = file.path(dirname(sys.frame(1)$ofile), paste0(sys.date(), ".r"))) this take current file , copy new file, in same directory , name of currentdate.r, example 2015-07-14.r if want copy working directory instead of original script directory, use file.copy(sys.frame(1)$ofile, = file.path(getwd(), paste0(sys.date(), ".r"))) just note sys.frame(1)$ofile works if saved script sourced, trying run in terminal fail. worth mentioning though might not best practice. perhaps looking version control system better. explanat

html - Full window ui-view of openlayers map -

i have angularjs app angular material made yeoman fullstack generator. index.html has navbar , ui-view show sites content. <!-- index.html --!> <!-- add site or application content here --> <div ng-include="'components/navbar/navbar.html'"></div> <div ui-view></div> the main.html page loads: <div ng-include="'app/map/map.html'"></div> openlayers map want fill window not. height not stagnate. there direct route map. setting ui-view's height 100% doesn't work , not need way. while map should @ 100% there other things load in ui-view should not. please me map fill window. the map.html loads open layers directive found here . tried use flex angular material no success either. there way thais new , have added height and/or flex tags find in dom no success. i have full height openlayers map in ui-view using angular material toolbar similar need: be sure have body , html se

c# - Touch input and direct manipulation -

i listening several events handle touch input in windows (phone) 8.1 runtime code. works long no scrollviewer involved. scrollviewer swallows gesture events due direct manipulation . here events listen ( view frameworkelement ): var cw = window.current.corewindow; cw.pointerpressed += onpointerpressed; cw.pointermoved += onpointermoved; cw.pointerreleased += onpointerreleased; cw.pointercapturelost += onpointercapturelost; view.tapped += ontap; view.doubletapped += ondoubletap; view.holding += onhold; view.manipulationdelta += onmanipulationdelta; view.manipulationcompleted += onmanipulationcompleted; as scrollviewer recognizes tap, pointercapturelost , no other event handlers called anymore. rob caplan wrote in 2013 : unfortunately there no solution if app needs both scrolling , gestures (for example, detect crossslides against scrolling). in case option pointer messages everywhere di

android - How I can paint stroke around circle? -

Image
i creating circle programmatically. how can paint stroke around circle ? for example need : bellow code : public class draw extends view { boolean flag = false; private static class circlearea { int radius; int centerx; int centery; circlearea(int centerx, int centery, int radius) { this.radius = radius; this.centerx = centerx; this.centery = centery; } @override public string tostring() { return "circle[" + centerx + ", " + centery + ", " + radius + "]"; } } private paint mcirclepaint; private static final int circles_limit = 1; private hashset<circlearea> mcircles = new hashset<circlearea>(circles_limit); private sparsearray<circlearea> mcirclepointer = new sparsearray<circlearea>(circles_limit); public draw(final context ct) { super(ct); init(ct

android - java.lang.ClassCastException: ListActivity cannot be cast to DatePickerDialog -

i'm having problems implement material datepicker due context call should doing wrong. the sample github works fine because dialog being created activity. however, @ particular case, i'm working fragment attached listactivity . this how i'm calling it: calendar = calendar.getinstance(); datepickerdialog dpd = datepickerdialog.newinstance( (datepickerdialog.ondatesetlistener) getactivity(), now.get(calendar.year), now.get(calendar.month), now.get(calendar.day_of_month) ); dpd.show(getfragmentmanager(), "datepickerdialog"); this line (datepickerdialog.ondatesetlistener) getactivity() generating issue. declared mainactivity.this in sample, can't use listactivity.this or similar. logcat process: kva.ihm, pid: 16218 java.lang.classcastexception: kva.ihm.parameterlistactivity cannot cast com.wdullaer.materialdatetimepicker.date.datepickerdialog$ondatesetlistener @ kva.ihm.parameterdetailfragment$49.onitemclick(par

vsto - Shape Events Visual studio Tools for Office -

by using below code created shape in visual studio tools office private void sheet01_startup(object sender, system.eventargs e) { this.shapes.addshape(office.msoautoshapetype.msoshapeactionbuttoncustom, 160, 461, 109, 20); } i want thing when click on shape. please me write events this. vsto doesn't provide anythig that. if talking excel add-in, shape class doesn't provide event that. bielive may find selectionchange event of worksheet class helpful. fired when selection changes on worksheet. so, can check out select object on sheet.

ruby on rails - Error "cache resources exhausted" with Imagemagick -

i'm using imagemagick on rails app minimagick , generate pictogram it. when launch process have error , don"t find solution minimagick::error (`convert -limit memory 2gib -limit map 2gib -limit disk 4gib -background none -fill #000000 -font ttf/selis006n.ttf -pointsize 300 label: s public/pictogram_images/recintan-el-064-layer-1.png` failed error: convert.im6: cache resources exhausted ` s' @ error/cache.c/openpixelcache/4078. convert.im6: no images defined `public/pictogram_images/recintan-el-064-layer-1.png' @ error/convert.c/convertimagecommand/3044. ): my process simple, have .tff file , each character pictogram. want generate preview of character in png not sure item causing problem, 1 of these: 1) need put font imagemagick's xml-based font file rather specify file.ttf in convert command. list of available fonts, use identify -list font | more path: /users/mark/.magick/type.xml <--- edit font here font: acaslonpro

c# - File Still Locked Despite putting StreamReader in Using -

my program goes through files in folder, reads them, , without altering information moves them location under different name. cannot use file.move method because following ioexception : the process cannot access file because being used process. this how reading file , adding lines list<string> : list<string> lines = null; using (var fs = new filestream(filepath, filemode.open, fileaccess.read, fileshare.readwrite)) using (var sr = new streamreader(fs, encoding.default)) { lines = new list<string>(); while (!sr.endofstream) lines.add(sr.readline()); } and function move file: public static bool archivefile(string filepath, string archivefolderlocation) { if (!directory.exists(archivefolderlocation)) directory.createdirectory(archivefolderlocation); try { string timestamp = string.format("{0:yyyy-mm-dd hhmmss}", datetime.now); string newfilename = path.getfilenamewi

c++ - Compilation errors with OpenCV GOLD -

i'm on ubuntu 14.04 , using opencv 3 gold. have found example here eye detection: https://github.com/trishume/eyelike when compiling on raspberry pi, got lot of errors: /home/pi/opencv-3.0.0/samples/cpp/test/eyelike-master/src/main.cpp: in function 'int main(int, const char)': /home/pi/opencv-3.0.0/samples/cpp/test/eyelike-master/src/main.cpp:82:37: error: no match 'operator=' in 'frame = cvqueryframe(capture)' /home/pi/opencv-3.0.0/samples/cpp/test/eyelike-master/src/main.cpp:82:37: note: candidates are: /usr/local/include/opencv2/core/mat.inl.hpp:560:6: note: cv::mat& cv::mat::operator=(const cv::mat&) /usr/local/include/opencv2/core/mat.inl.hpp:560:6: note: no known conversion argument 1 'iplimage* {aka _iplimage}' 'const cv::mat&' /usr/local/include/opencv2/core/mat.inl.hpp:2878:6: note: cv::mat& cv::mat::operator=(const cv::matexpr&) /usr/local/include/opencv2/core/mat.inl.hpp:2878:6: note: no known conversion

Combine jMonkeyEngine and Vuforia: Geometry doesn't remain at the center of the target -

i trying combine vuforia sdk , jmonkeyengine. cube placed on target (imagetarget) far. when move camera cube moves little bit too. want cube remains @ center of target (like teapot in vuforiasamples imagetarget). have idea how can solve problem? i think relevant code: public void initforegroundcamera() { foregroundcamera = new camera(settings.getwidth(), settings.getheight()); foregroundcamera.setlocation(new vector3f(0.0f, 0.0f, 0.0f)); // perspective transformation cameracalibration cameracalibration = cameradevice.getinstance().getcameracalibration(); videobackgroundconfig config = renderer.getinstance().getvideobackgroundconfig(); float viewportwidth = config.getsize().getdata()[0]; float viewportheight = config.getsize().getdata()[1]; float camerawidth = cameracalibration.getsize().getdata()[0]; float cameraheight = cameracalibration.getsize().getdata()[1]; float screenwidth = settings.getwidth(); float screenheight = sett

jquery - validate not work when use javascript -

when use in view <select data-val="true" data-val-required="Выберете" значение="" id="directionside" name="directionside"><option value=""></option> <option value="27b8c509-8f09-4a0d-ae22-048c2611b7ea">По ходу движения </option> <option value="f40319b8-aa82-4182-bec2-4c9b0ba0146d">Против хода движения</option> <option value="7436112a-122c-4809-9f6c-c5aefff17d6d">На центр перекрестка</option> <option value="266ea166-67e8-446b-95b1-288b0b876eed">Вращается</option> </select> this work when put in of javascript-it not work example $("#insertphoto").before("...."); any ideas ? when put in of javascript-it not work that's because .validate() method has been called , plugin initialized. (if you're using unobtrusive-validation along asp, unobtrusive plugin has calle

c# - Local database: "A network-related or instance-specific error occurred while establishing a connection to SQL Server." -

i'm having problems setting super-simple sql database project in visual studio 2010. upon opening connection local sql database following error message: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) all google searching comes network related solutions, checking firewall settings or configuring remote connections. local sdf file. i've literally created new blank wpf project. right clicked , "add new item" chosen "local database" clicked next produce database1.sdf. can access in server view in vs2010, add tables etc, , crucially, connection string. i create connection using said string: using system.data.sqlclient; namespace sqltest { <summary> interaction logic mainwindow.x

qt - Setting parent of a created qml object from C++ is not working -

i have c++ class creates qml object, takes 5 parameters: //prototype // q_invokable qquickitem *createqmlobject(qobject *parent, qstring path, qstring id="", int x=0, int y=0); qquickitem * qmlitemcreator::createqmlobject(qobject* parent,qstring path,qstring id,int x,int y) { qqmlengine engine; qqmlcomponent component(&engine, qurl::fromlocalfile(path)); qquickitem * mainobject_; if(component.iserror()) { qwarning() << "qmlitemcreator::createqmlobject qmlcomponent " << path << " has errors: " << component.errorstring(); } else if (component.isready()) { mainobject_ = qobject_cast<qquickitem*>(component.create()); qqmlengine::setobjectownership(mainobject_, qqmlengine::javascriptownership); mainobject_->setproperty("id",id); mainobject_->setproperty("x",x); mainobject_->setproperty("y&

nlp - Using kappa coefficient to evaluate results of crowd sourcing -

i have 4 sets of manually tagged data 0 , 1, 4 different people. have final labelled data in terms of 0 , 1 using 4 sets of manually tagged data. have calculated degree of agreement between users a-b : 0.3276, a-c : 0.3263, a-d : 0.4917, b-c : 0.2896, b-d : 0.4052, c-d : 0.3540. i not know how use calculate final data single set. please help. the kappa coefficient works pair of annotators. more two, need employ extension of it. 1 popular way of doing use this expansion proposed richard light in 1971 , or use average expected agreement annotator pairs, proposed davies , fleiss in 1982 . not aware of readily available calculator compute these you, may have implement code yourself. there this wikipedia page on fleiss' kappa , however, might find helpful. these techniques can used nominal variables. if data not on nominal scale, use different measure intraclass correlation coefficient .

sql - Beginner Rails Migration & Column Options in ActiveRecord -

quick question on :null option in activerecord table creation. let's create new table column description . def change create_table :products |t| t.string :name t.text :description, null: false end end if don't have :presence validation in model regarding description column, shouldn't "nothing" able passed description column? i'm not sure null: false can stop me passing nothing in since don't have validation in place. rails migration or schema options null: false operate on database level (storage). if tried save record empty description field, receive database error (e.g. generated postgresql) wrapped in activerecord::statementinvalid: . on calling object.valid? object have been valid application point of view (rails). rails validations :presence operate on application level. in case passing null value create object return false on valid? , access error messages object calling object.errors. if not bypas

rename - How to change file-timestamp from filename-information -

i have lot of files in following formats: xxxxxxxxx - dd-mm-yyyy hh-mm.mp3 (number of x may varies) example " nano - 10-07-2015 14-13.mp3 " now these files wrong timestamps while correct time , date enclosed in filename can me batch put time in filename timestamp, have searched in deep on internet , find vise versa of scenario. thank in advance

html - Android Webview not showing specific page -

i'm using webview on app load web page. other web pages working fine, 1 seems load showing blank page. the source code of html page generated cgi , output is: <html> <head> <meta name="viewport" content="width=device-width; height=device-height;"> <link rel="stylesheet" href="resource://gre/res/imagedocument.css"> /* * css stylesheet defines rules applied imagedocuments, * including in frames. */ @media not print { .overflowing { cursor: zoom-out; } .shrinktofit { cursor: zoom-in; } } @media print { img { display: block; } } </link> <link rel="stylesheet" href="resource://gre/res/toplevelimagedocument.css"> @media not print { body { margin: 0; } img { text-align: center; position: absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; } .completerotation { transition: transform 0.3s ease 0s; }

css - How is Bootstrap's `nav` class making anchors move to their own line -

Image
i'm trying figure out css causing a elements sit on own lines when have bootstrap's nav class, when can't find meaningful difference in styles applied them vs. a elements without nav . i've looked @ rules applied , compared computed styles, , i'm not seeing explain it. here's example: a in first paragraph (with nav class) sits on own line, whereas a in second doesn't: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <p>before <a id="a1" class="nav" href="#">link</a> after</p> <p>before <a id="a2" href="#">link</a> after</p> if inspect a.nav element, see rule applied: .nav { padding-left: 0; margin-bottom: 0; list-style: none; } ...but don't see how causes sit on own line. wrote code compare computed styles of 2 a elements in exa

jsf - c:forEach items not updated from backing bean -

i cannot update list in <c:foreach> backing bean. working primefaces 5.0 , jsf 2.0. this simplified jsf code: <c:foreach var="i" items="#{dataset.columnslist}" varstatus="status"> <h:outputtext value="#{dataset.columnslist.size()}"/> <c:if test="${status.last}"> <h:outputtext escape="false" value="#{status.count}" /> </c:if> </c:foreach> the code works first time. when dataset.columnlist change field dataset.columnlist.size() changes accordingly , correct. instead status.count remains old value. this fact seems confined <c:foreach> only. is there can me please? many thanks. when changing dataset.columnlist, make sure page refreshed. can doing page submit button, or use ajax submit partially page ( <f:ajax> ). know using c tag obsolete , can use <ui:repeat> instead of <c:foreach>

angularjs - Get ng-model value from inside ng-repeat using ng-change -

guys new angular , having problems getting value of ng-model inside ng-repeat. i have array of users, , want appoint users different access levels users = [ {id:1, level:0}, {id:2, level:0}, {id:3, level:0} ] this html <div ng-repeat="user in users track $index"> {{user.id}}- <select name="appoint" ng-change="appoint(user.id)" ng-model="appointlevel"> <option value=0>revoke</option> <option value=1>moderator</option> <option value=2>admin</option> </select> </div> the appoint() function in angular: $scope.appoint = function(id){ console.log(id+' '+appointlevel) } the function working fine , getting value of id not `appointlevel' of input element has triggered function. how can value console.log(id+' '+appointlevel) efficiently on `ng-change'? in advance. use <select name="appoint" ng-change="appoi

get a specified line in variable and Find all indexes of a specified word from a variable in Google script -

here example: hello how you, how friend. i fine take care so here want second line output("how you, how friend.") , index number of "how". want index numbers how = 0 , 3 (since there 2 occurrences. here example: function testit99() { var texttest = "how you, how friend."; //remove commas texttest = texttest.replace(",", ""); logger.log('texttest: ' + texttest); texttest = texttest.replace(".", ""); logger.log('texttest: ' + texttest); //put words array var arrayofwords = texttest.split(" "); logger.log('texttest: ' + texttest); var arrayofindexes = []; var i=0; (i=0;i<arrayofwords.length;i+=1) { if (arrayofwords[i]==="how") { arrayofindexes.push(i) }; }; logger.log("indexes of 'how' are: " + arrayofindexes) };

html - Use perl regular expression to match a pattern that spans multiple lines in SAS -

i have html snippet stored in html.html: </head> <body> <h4>areas of interest</h4> <ul> <li>interest</li> <li>interest</li> </ul> <h4>other</h4> </body> i have build regex pattern (/<\/h4>(\w*\w*)*<h4>/) matches pattern extract between first </h4> tag , second <h4> tag, how sas search pattern across multiple lines? sas code: filename html; data interests (drop=pattern); length string $2500; if _n_ = 1 pattern = prxparse("/<\/h4>(\w*\w*)*<h4>/"); retain pattern; infile html lrecl=2500; string $char2500.; if prxmatch(pattern,string) gt 0 output; run; currently getting blank results. i don't think can way in sas. sas sees each row of html separate observation; if want parse them whole you'd need logic join them together. follows example works on sample code, fail on tons of special ca

ruby on rails - Form fields not saving to DB: does this have to do with how form parameters are passed for new/create controller methods? -

i’m newbie trying create simple rails (4.2.1) app allows user (when logged in >> ‘devise’ gem) add post image (‘paperclip’ gem). the form data not being saved in db. suspect might have way parameters passed since i’m new this, i’m not sure. it working — posts being saved in db , displayed on site — until refactored form use @post instead of post.new (so view isn’t speaking directly model), , added 'new' method controller, form data not being saved. i tried both using , omitting passing in ‘post_params’ 'new' method. when pass in params 'new' method, error: actioncontroller::parametermissing (param missing or value empty: post): app/controllers/posts_controller.rb:22:in `post_params' app/controllers/posts_controller.rb:18:in `new' as side note: left out “multipart: true” in form because based on rails documentation, understood needed “form_tag” , not “form_for” ( http://guides.rubyonrails.org/form_helpers.html ). here controller:

ios - How to purchase physical goods using through mobile app? Payment must be made with CREDITS instead of money -

in application, want take order of food, drinks, etc (for ex. restaurant app) , deliver or serve them. my applications want generate “credits” using through payment. ex, 10$ = 100 credits. using these credits, want accept food orders using through credits (user give payment using credits instead of money). so, above scenario, per knowledge in app purchase (iap) not use in app because physical goods not selling using through iap. another option apple pay, not release universally , limited brand. so, not issue. so, can use other payment gateways paypal, etc? please let know prior experience or comments. in advance. yes, can use paypal or other online payment solution. from previous experience can only use iap if it's digital goods used within app, , you're not allowed use iap physical goods (and can use whatever heart desires).

mysql - Sql query- Get results between two different date columns with its exact days match -

i have following 2 columns in 'deals' table. - subscribed_date - expired_date i want sql query filter records 2 columns difference follows (expired_date - subscribed_date) == 7 days for eg: id | subscribed_date | expired_date 1 | 2015-07-04 04:13:29 | 2015-09-03 04:13:29 2 | 2015-06-03 04:13:29 | 2015-06-10 04:13:29 3 | 2015-01-05 04:13:29 | 2015-02-08 04:13:29 in above example, result should id=2 because difference 7 days. is possible through sql query without iterations? thanks in advance help! why not select * deals datediff(expired_date, subscribed_date) = 7 ? further info here .

c# - Xamarin xaml display string array with seperators -

i looking print array of strings separator between each string example code block string[] array; string[] assignment = {"world","testing","array","hello"}; for(int =0 ; i>assignment.length; i++) { array[i] = assignment[i]; } xaml <controls:tappablecustomfontlabel x:name="array" text="{binding array}" xalign="start" lineheight="2.1"/> xaml.cs array.fillx(); i want display each string in array on separate label, followed seperator i.e world testing array hello

Unable to type anything inside an input text box, after putting a jquery code for keycode trapping -

i have simple html form yes or no button. requirement press "y" or "n" keys , invoke corresponding button without focus.i have written jquery , on pressing 'y' or 'n' invoking correct button , working expected here 1 glitch. my input text box not able accept text or in other words keys not working. my html code : <table> <tr> <td>username:</td> <td><input type="text" id="uname"> </td> </tr> <tr> <td>password:</td> <td><input type="text" id="pswd"> </td> </tr> </table> <br><br><br><br> <table cellspacing="20"> <tr> <td><button type="button" id="yes" >yes</button></td>&nbsp;&nbsp; <td><button type="button" id="no" >no<

python - How to construct multi-level classes using dictionaries -

i need construction like: mainclass["identificator 1"].categories["identificator 2"].plots["another string"].x_values i write many classes like: class c_mainclass(object): def __init__(self): self.categories={} self.categories["identificator 2"]=c_categories() class c_categories(object): def __init__(self): self.plots={} self.plots["another string"]=c_plots() class c_plots(object): def __init__(self): self.x_values=[2,3,45,6] self.y_values=[5,7,8,4] mainclass={} mainclass["identificator 1"]=c_mainclass() #mainclass["identificator bla"]=c_mainclass(bla etc) print(mainclass["identificator 1"].categories["identificator 2"].plots["another string"].x_values) i'd define "subattributes" within 1 class like: class c_mainclass={}: setattr(mainclass["identificator 1"],"categories&quo

c++ - Matlab's ifft2 function in OpenCV -

i've searched lot on internet still haven't come across solution. want convert matlab's ifft2 function opencv obtain same result. instance, if have 10x10 matrix a as: a = 11 22 33 1 1 1 1 1 1 1 44 55 66 1 1 1 1 1 1 1 77 88 99 1 1 1 1 1 1 1 100 111 122 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 then in matlab, calling ifft2(a) gives me this: ans = 9.1600 + 0.0000i 5.4570 + 4.6041i 0.5640 + 4.4443i -1.1170 + 0.7295i 1.0560 - 1.4066i 2.7200 + 0.0000i 1.0560 + 1.4066i -1