Posts

Showing posts from June, 2013

javascript - HTML5 Pattern fallback for Safari -

safari not support html5 pattern... input pattern below works fine in need of workable fall back. <input type="password" required pattern="(?=^.{8,}$)((?=.*\d)|(?=.*\w+))(?![.\n])(?=.*[a-z])(?=.*[a-z]).*$" name="password" id="password"> fallback attempt... (from answer dated 2011) var input = document.getelementsbyname('password')[0]; input.addeventlistener('change', function() { console.log('is valid?', input.value.search(new regexp(input.getattribute('pattern'))) !== -1); }, false); the problem event you're listening to. event change same blur in case. change event listen keyup or input : input.addeventlistener('input', function() { console.log('is valid?', input.value.search(new regexp(input.getattribute('pattern'))) !== -1); }, false);

Scala macros referring to a member type -

i have trait member type, , want have macro signature containing type: trait foo { class bar[a] { ... } def baz[a](x: bar[a]): bar[a] = macro bazimpl[a] def bazimpl[a: c.weaktypetag](c: blackbox.context)(x: c.expr[bar[a]]) = ... } this doesn't work, since bazimpl must belong either static (i.e. non-member) object or macro bundle. in neither case have foo: foo write foo.bar[a] . one workaround can think of use foo#bar[a] , add casts: trait foo { class bar[a] { ... } def baz[a](x: bar[a]): bar[a] = foo.baz1(x).asinstanceof[bar[a]] def bazimpl[a: c.weaktypetag](c: blackbox.context)(x: c.expr[bar[a]]) = ... } object foo { def baz1[a](x: foo#bar[a]): foo#bar[a] = macro bazimpl[a] def bazimpl[a: c.weaktypetag](c: blackbox.context)(x: c.expr[foo#bar[a]]): c.expr[foo#bar[a]] = ... } but i'd avoid (both because it's not type-safe , because real case more complicated). alternatives? if you're using scala 2.11, write c.tree everyw...

pip - Installing psycopg2 into virtualenv when PostgreSQL is not installed on development system -

is possible install psycopg2 virtualenv when postgresql isn't installed on development system—macbook pro os x 10.6? when run pip install psycopg2 within virtualenv , received error shown below. i'm trying connect legacy database on server using django, , i'd prefer not install postgresql on development system if possible. why not install postgresql? i received error when installing postgresql using homebrew. have xcode4—and xcode4—installed on macbook pro , thinking it's related missing gcc 4.0. however, problem stackoverflow question. update 8:37 on april 12, 2011: i'd still know if possible without installing postgresql on macbook pro. however, ran brew update , forced reinstallation of ossp-uuid brew install --force ossp-uuid , brew install postgresql works. postgresql installed, able pip install psycopg2 within virtualenv. error pip install psycopg2 $ pip install psycopg2 downloading/unpacking psycopg2 running setup.py egg_info packa...

python - Using a context processor in conjunction with Jinja template variables -

i in midst of deploying stripe , requires that payment values being passed stated in "cents" rather dollars. can handle on backend (i.e can process payment appropriate amount) in order render in stripe's ui, must convert price cents. ($400 becomes 40000 cents) i attempting use context processor convert dollar price store in database dollars can following code in views.py file: @buy_blueprint.context_processor def utility_processor(): def format_price(amount): return u'{0:.0f}'.format(amount) return dict(format_price=format_price) and following inserted in template.html file course price: {{ format_price(40000) }} which renders 40000 - perfect. but want like: {% course in courses %} <p> course name: {{ course.course_name }} course price: {{ course.price }} max number of students: {{ course.max_number_students}} remaining space: {{ course.spaces_left }} {% if course.spaces_left > 0 %} <form action="{{ url_for('buy.buy...

javascript - Error: [ngModel:datefmt] Expected `2015-05-29T19:06:16.693209Z` to be a date - Angular -

i'm working on angular application django rest-framework .. the app receives it's info json server.. 1 of keys created_time ... value of field format according iso-8601 , example 2015-05-29t19:06:16.693209z . in client have field: <input type="time" ng-model="created_time"> but when data arriving error: error: [ngmodel:datefmt] expected `2015-05-29t19:06:16.693209z` date http://errors.angularjs.org/1.3.13/ngmodel/datefmt?p0=2015-05-29t19%3a06%3a16.693209z @ regex_string_regexp (angular.js:63) @ array.<anonymous> (angular.js:19807) @ object.ngmodelwatch (angular.js:23289) @ scope.$get.scope.$digest (angular.js:14235) @ scope.$get.scope.$apply (angular.js:14506) @ done (angular.js:9659) @ completerequest (angular.js:9849) @ xmlhttprequest.requestloaded (angular.js:9790) i tried :( format instructions in docs of angular... this must happening angular 1.3+. 1.3+ on wards ng-model date/time input needs valid date object, stri...

c# - Disable button on a specific page -

i made web application in asp.net mvc5. in application have products. on every product logged user can press button. how can disable button after logged user pressed it. want other users able press button, not users have pressed button. i don't want save in database users have liked product because have many values in database. can give me advice how should this? @ least maybe save in session. thanks! just create simple db table called userlikes it can have 2 columns: userid , productid whenever user likes product, make entry in table. when user viewing product page, if see entry in table user , product, disable like button.

python - Output separated HBase columns using happybase -

i have such hbase-table: total date1:tcount1 date2:tcount2 ... url1 date1:clickcount1 date2:clickcount2 ... url2 date1:clickcount1 date2:clickcount2 ... ... url1, url2, ... row keys. table has only one column family. i have date range (from datei datej ) input. need output shares of clicks in day each url. the output must have such format: datei url1:share1 url2:share1... ... datej url1:share1 url2:share1... where datei.url1:share1 = url1.datei:clickcount1 / total datei:tcount1 i started write happybase-script, don't know, how select separate columns row using happybase. happybase-script below: import argparse import calendar import getpass import happybase import logging import random import sys usage = """ query daily data year, run: $ {0} --action query --year 2014 query daily data particular month, run: $ {0} --action query --year 2014 --month 10 query daily data particular day, run: $ {0} --action query --year 2014 --month 10 ...

activerecord - Ruby on Rails Associate pairs of one model to a second model -

i'm building rails app have models users , images , , image_pairs . want each image_pair have 2 images , named :before_image , :after_image . so: users have many images (many one) users have many image_pairs (many one) images may have 1 image_pair image_pairs have 2 images i have working, except can't call @image.image_pair . get: pg::undefinedcolumn: error: column image_pairs.image_id not exist how can set can image_pair image ? schema.rb (some irrelevant fields removed) create_table "image_pairs", force: true |t| t.integer "before_image_id" t.integer "after_image_id" end add_index "image_pairs", ["before_image_id"], name: "index_image_pairs_on_before_image_id", using: :btree add_index "image_pairs", ["after_image_id"], name: "index_image_pairs_on_after_image_id", using: :btree add_index "image_pairs", ["user_id"], name: "...

java - Can't resolve Log Forging Fortify issue -

i having trouble fixing log forging issue in fortify. issue, "writes unvalidated user input log", being raised both of logging calls in getlongfromtimestamp() method. public long getlongfromtimestamp(final string value) { logger.info("getlongfromtimestamp(" + cleanlogstring(value) + ")"); long longval = 0; date tempdate = null; try { tempdate = new simpledateformat(format_yyyymmddhhmmss, locale.us).parse(value); } catch (parseexception e) { logger.warn("failed convert date: " + cleanlogstring(value) + " exception: " + cleanlogstring(e.getmessage())); throw new exception(e); } if (tempdate != null) { longval = tempdate.gettime(); } return longval; } private cleanlogstring(string logstring) { string clean = logstring.replaceall("[^a-za-z0-9]", ""); if(!logstring.equals(clean)) { clean += " (cleaned)"; ...

ios - Draw attention to and foster discovery of actionable controls -

Image
in attempt defer content, chose not use (navigation or tool) bars. the app has tinted uibutton brings action sheet (where user share content, , adjust preferences). what i've seen people don't interact button. merely @ content. i'd draw attention button in subtle initial way, user discover content can shared or changed. unsuccessful approaches: changing button text (action or settings) icon image. while more recognizable/familiar, lose out on title describes selected content. uialertcontroller (displaying instructions first launch). obnoxious. coach marks. transparent overlay spoils initial impression. what has helped, yet still unobtrusive: changing background/foreground colors. button's more noticeable on black background. i haven't tried animating button (until user taps it). are there other or better methods user discover app interactive? let glow. let glow. let glow. view.layer.shadowcolor = [uicolor whitecolor].c...

angularjs - Getting sourcemaps to work with Grunt, usemin, uglify and rev -

i'm using grunt optimize angularjs application production. uses useminprepare , usemin read files concat/minify index.html page. i'm trying sourcemaps work can view errors happening. here's relevant versions package.json: "grunt": "0.4.5", "grunt-autoprefixer": "2.2.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.11.0", "grunt-contrib-uglify": "~0.9.1", "grunt-rev": "~0.1.0", "grunt-usemin": "~2.0.2", here's trimmed down version of gruntfile.js relevant tasks: 'use strict'; // usemin custom step var useminautoprefixer = { name: 'autoprefixer', createconfig: require('grunt-usemin/lib/config/cssmin').createconfig // reuse cssmins createconfig }; module.exports = functio...

angularjs - Angular: parse a URL into a route and params without following that URL? -

suppose have angular app using $routeprovider i've initialized following: $routeprovider .when('/foo/:var1', { templateurl: 'templates/template-1.html', controller: 'somecontroller' }) .when('/bar/:var2a/:var2b', { templateurl: 'templates/template-2.html', controller: 'someothercontroller' }).... now suppose have url , want know information route map (in particular, route parameters contains , values are) without following route. angular service such $route , $routeparams , or $routeprovider provide function will, given url, return information me? as example, if site hosted @ example.com , called such function passing in argument 'http://example.com#/bar/2/blue' i'd return (something contains) object like { var2a: 2, var2b: 'blue' } i thought since angular's routing service has capability map urls browser's address bar route , list of params, there might way harnes...

regex - Quantifier to print only three digit numbers in a Java regular expression -

what quantifier print 3 digit numbers in string in java regular expressions? input : 232,60,121,600,1980 output : 232,121,600 instead output coming as: output : 232,121,600,198 i using (\\d{3}) . quantifier should use in order print 3 digit numbers? you need make use of \b word boundary: \b\d{3}\b see demo in java, use double slashes: string pattern = "\\b\\d{3}\\b"; you not need use capturing group round whole regex, can access match via .group() . see ideone demo

coq - How to prove remove_copy from ACSL by example -

i tried prove algorithm remove copy (the first version) "acsl example" version 11.1.0. i used alt-ergo (0.99.1), cvc3 (2.4.1), z3 (4.3.2), cvc4 (1.4) , why3 (0.85) time limit in why3 50 sec , start frama-c, used command: frama-c-gui -wp -wp-model typed+ref -wp-rte -wp-split remove_copy_11.c only 1 proof obligation not solved (timeout). its body is: goal preservation of invariant 'kept' (file remove_copy_11.c, line 73) (1/2): tags: then. let x_0 = (l_count mint_2 a_0 i_1 v_0). let x_1 = -x_0. let x_2 = i_1-x_0. let a_1 = (shift_sint32 b_0 x_2). let a_2 = (shift_sint32 a_0 i_1). let x_3 = mint_2[a_2]. let x_4 = 1+i_1. let x_5 = 1+i_1-x_0. let a_3 = (shift_sint32 b_0 0). let a_4 = (shift_sint32 a_0 0). assume { type: (is_sint32 v_0) /\ (is_uint32 i_1) /\ (is_uint32 n_0) /\ (is_uint32 x_4) /\ (is_sint32 x_3) /\ (is_uint32 x_2) /\ (is_uint32 x_5). have: (linked malloc_0) /\ ((region (base a_0))<=0) /\ ((region (base b_0))<=0...

dll - python ctypes with dots -

how load module ctypes has dots in name example mydll.1.0.dll trying load this ctypes.cdll.mydll.1.0 gives module not found error i using python on windows answer comments: use ctypes.cdll('mydll.1.0'). if you're fixed on using loader it's ctypes.cdll['mydll.1.0']. note loader caches cdll instance, caches functions. can or bad depending use case , whether other packages want use same dll don't define function prototypes (i.e. restype, argtypes, errcheck, paramflags) equivalently.

c# - How to Pass Raw JSON to RegisterPercolator in ElasticSearch NEST? -

i trying create object-agnostic percolator microservice in c#. can create , map index passed method using json object mapping, can register percolator against index using standard nest query format, such this: var percolateresponse = client.registerpercolator<dynamic>(query .name, p=>p .index(index.actualname) .query(q=>q .term(t=>t .onfield("banana") .value("green")))); the problem is, need able pass in json of query , i've been trying use following code: var percolateresponse = client.registerpercolator<dynamic>(query .name, p=>p .index(index.actualname) .query(q=>q.raw(query.context))); the json passing in is: {"query": {"term": {"banana": {"value": "green"} } } } what happening though, instead of registering specified query percolator query, sets q...

insert a list 2xn obtained from a json in python -

hi i'm trying access json save in list perform sort of append , create pdf in reportlab, have following code have several problems first have list of 2xn has columns , rows dynamic according json. if can me grateful much import json json_data = [] attributesname = [] testtable = { "attributes":[] } attributesvalue = [] path="prueba2.pdf" doc = simpledoctemplate(path, pagesize=letter) stylesheet = getsamplestylesheet() text = [] open("prueba.json") json_file: document = json.load(json_file) item in document: data_item in item['data']: attributesname.append([str(data_item['name']) attributesvalue.append([data_item['value']]) testtable[attributesname].extend({data_item['name'], data_item['value']}) print attributesname[0] print testtable[0] parts = [] p = paragraph('''<para align=left fontsize=9>{0}</para>'''.format(text), stylesheet[...

pdf - -dSubsetFonts=false option stops showing TrueType fonts /glyphshow -

i have postscript uses truetype fonts. however, want include rarly used characters registration marks (®) , right/left single/double quotes (’, “ etc). so used glyphshow , called names of glyphs %! << /pagesize [419.528 595.276] >> setpagedevice /devicergb setcolorspace % page 1 % % set original top left % 0 595.276 translate 1 -1 scale gsave % % save state before moving x y images % 1 -1 scale /bauerbodonibt-roman findfont 30 scalefont setfont % set pt size %-3.792 - 16 1 0 0 setrgbcolor 10 -40 moveto /quoteright glyphshow 10 -80 moveto /registered glyphshow /museo-700 findfont 30 scalefont setfont % set pt size %-3.792 - 16 1 0 1 setrgbcolor 10 -120 moveto /quoteright glyphshow 10 -180 moveto /registered glyphshow showpage when execute postscript using following command (due requirement pdf editable in illustrator i.e. can opened fonts intact) pdf shows nothing seems contain glyphs if copy , paste pdf text file. gs -o gly_subsetfalse.pdf -s...

java - Difference between Application servers and standalone frameworks -

i guys give me feedback, on understanding the difference between application servers such jboss , frameworks such axis , cxf . cxf standalone, web-app based framework implements jax-rs , jax-ws api wich, in turn, part of larger api set of jee . being web-app based implementation, can used host " soap on http " services if standard jax-ws defines other possible channels soap messages,such smtp . application servers,such jboss , instead implement jax-ws other jee apis in more "native" , direct way, so,for example, can used host soap on smtp services. both as , standalone frameworks such cxf , axis make extensive use of inversion of control . application servers, such jboss , can thought composed a set of frameworks implement jee stack api. please take time correct/enhance above statements. thanks

Linking to external site from Chrome single app kiosk mode -

we using single app kiosk mode keep page been closed. however, cannot link external sites. idea how link other sites? to display external content inside chrome app, need <webview> .

Android: Handling cookies with Webviews now that Apaches HTTP methods are deprecated? -

i'm trying make post request gives me json. in request, header contains header cookie. later, need attach(?) cookie webview (along proper url). now apache requests , cookiesyncmanager deprecated, i'm kinda lost. this code, , doesn't work. post request code: public static string calljsonpost(string urlstring) { string data = null; try { url url = new url(urlstring); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setreadtimeout(10000 /* milliseconds */); conn.setconnecttimeout(15000 /* milliseconds */); conn.setrequestmethod("post"); conn.setdoinput(true); conn.setusecaches(true); // set cookies in requests cookiemanager cookiemanager = cookiemanager.getinstance(); string cookie = cookiemanager.getcookie(conn.geturl().tostring()); if (cookie != null) { conn.setrequestproperty("cookie", cookie); } ...

linkedin - Error: Scope parameter is not authorized: r_contactinfo -

i following error using linkedin api: error: scope parameter not authorized: r_contactinfo throw new error("scope parameter not authorized: " + p); the application working month, , don't want deploy again because of issue. there way fix this, guess it's connected linkedin api? <script type="text/javascript" src="https://platform.linkedin.com/in.js"> api_key: 75x5459m1lbbde onload: onlinkedinframeworkload authorize: true scope: r_basicprofile rw_groups r_contactinfo </script> best m r_contactinfo no longer openly available, per linkedin's api change announcement in february ( https://developer.linkedin.com/blog/posts/2015/developer-program-changes ). you need apply , approved in 1 of partnership programs continue using it, or have stop requesting member permission continue functioning.

css - cssmin grunt plugin generates incorrect source urls in sourcemap -

cssmin grunt plugin grunt-contrib-cssmin trims leading slash in css sourcemap sources url, making css mapping incorrect. meanwhile after editing sourcemap file hand (adding leading slash each source url) seems mapped correctly. original sourcemap file taken annotation in original css (unminified), generated correctly other grunt plugins. my file structure: web (resource root) ├─css │ └─..(css files) └─less └─..(less files) sourcemap of original (unminified) css – sources urls correct. generated grunt-contrib-less , grunt-autoprefixer respectively: {"version":3,"sources":["/less/base/normalize.less","/less/base/boilerplate.less"... sourcemap of minified css – leading slashes source files disappeared. generated grunt-contrib-cssmin : {"version":3,"sources":["less/base/normalize.less","less/base/boilerplate.less"... part of gruntfile.js : module.exports = function(grunt) { grunt.ini...

javascript - Angular error with ng-repeat -

the last 3 hours made little app. it's not ready yet, there error. can not figure out, what's wrong. here html: <html lang="en" ng-app="reporting"> <head> <meta charset="utf-8" /> <title>.reporting</title> <!-- bootstrap --> <link href="content/bootstrap.css" rel="stylesheet" /> <!-- bootstrap --> <!-- jquery --> <script src="scripts/jquery-2.1.4.js"></script> <!-- jquery --> <!-- editor --> <script src="scripts/wysihtml5-editor/bootstrap3-wysihtml5.all.min.js"></script> <link href="scripts/wysihtml5-editor/bootstrap3-wysihtml5.css" rel="stylesheet" /> <script src="scripts/wysihtml5-editor/bootstrap3-wysihtml5.min.js"></script> <!-- editor --> <!-- angular --> <script src="scripts/angular.js"></script> <!-- angular --> <!-...

javascript - Validation error in JSlint -

i having troubles. had assignment in javascript class taking create game of hangman using module pattern. i have succeeded making function, however, code not pass jslint validation test. keeps giving me 1 error , have no idea how rid of it. read below says. hangman.js: line 221, col 30, expected assignment or function call , instead saw expression. i have tried remove on line 221 code not work anymore. please me. line 221 hangman.wrongcount = 0; here link fiddle in have put code. , note, line 221 in javascript creating problem, rest can ignore. link fiddle: http://jsfiddle.net/1nvaahyv/ thanks in advance! the problem lies in preceding line (note comma): hangman.guessedletters = [], hangman.wrongcount = 0;

c++ - Add unique_ptr as instance field of a class instead of explicitly removing copy / assignment ctors -

there macros preventing classes being copied, eg: macros disallow class copy , assignment. google -vs- qt would identical results having unique_ptr in class? if so, there reason not this? eg class foo { private: std::unique_ptr<int> disable_copy; }; the disallow macros meant c++98/03. c++11 has = delete operator eliminating copy/assignment. adding unique_ptr bloat class little bit, worse think it's roundabout , unclear way implement deleted copy/assignment. class foo { public: foo(const foo&) = delete; foo& operator=(const foo&) = delete; }; will achieve these results clearly.

javascript - Using Check boxes to update input text field -

i'm learning how different things javascript , html webpage design , ran problem can't figure out , can't seem find when solution. i'm making simple check box table asked question, select answer , response gets updated based on answer. user can click boxes , response updated. have 1 function in js right because trying work first before writing other two. here have. function strengthcheckbox() { var strengthcheckyes = document.getelementbyid("strengthcheckyes"); var strengthcheckno = document.getelementbyid("strengthcheckno"); if (strengthcheckyes === document.getelementbyid("strengthcheckyes").checked) { document.getelementbyid("checkboxstrengthresponse").value = "you wrestled putin in past life didn't you?"; } else if (strengthcheckno === document.getelementbyid("strengthcheckno").checked) { document.getelementbyid("checkboxstrengthresponse").value = "that...

latex - Vertical align text to a box next to it -

Image
in output below, i'm trying align author top of box next it. i've tried couple of different boxes , whatnot, can't align properly. here's code: \mbox{ author } \fbox{\begin{minipage}[c]{12cm} \medskip $for(author)$ $author.name$\\$if(author.title)$\emph{$author.title$}\\$endif$$if(author.company)$$author.company$$endif$ \par\medskip $endfor$ \medskip \end{minipage}} you should set entire construction inside tabular , , use [t] op-aligned tabular framed box construction: \documentclass{article} \begin{document} \begin{tabular}{l | l |} \cline{2-2} author & \begin{tabular}[t]{@{}p{12cm}@{}} jack appleseed \\ \emph{marketing manager} \\ unimaginitive solutions \\ \\ john appleseed \\ \emph{business development manager} \\ unimaginitive solutions \\ \end{tabular} \\ \cline{2-2} \end{tabular} \end{document} i'm assuming can use following pandoc construction (i haven't used pandoc): \begin{tabu...

javascript - When is WebSocket.onmessage triggered? -

(1) open websocket connection. var ws = new websocket(url); (2) when connection established, send message trigger blob sent in response. ws.onopen = function () { ws.send('1000000'); } (3) onmessage triggered when response begins or complete? ws.onmessage = function () { // has entire blob arrived or has download begun? } the w3c spec websocket api says message event should dispatched "when websocket message has been received": when websocket message has been received type type , data data , user agent must queue task follow these steps: ... let event event uses messageevent interface, event type message , not bubble, not cancelable, , has no default action. ... dispatch event @ websocket object. to understand meant "when websocket message has been received," must consult rfc 6455, " the websocket protocol " . in websockets, participants send messages contained in ...

c# - Link Button with query string in ASP.NET -

i have link button follow <asp:linkbutton id="linkbuttonsearchclient" postbackurl="~/ui/clients.aspx" runat="server">recherche </asp:linkbutton> i want query string it <asp:linkbutton id="linkbuttonsearchclient" postbackurl="~/ui/clients.aspx?id=12" runat="server">recherche </asp:linkbutton> and id value comes source code public string id { { return viewstate["id"]; } } to value on page load (in backend .cs file) : protected void page_load(object sender, eventargs e) { var id = request.querystring["id"]; if (id != null) { // use id } } or might want put id link (in html) : <asp:linkbutton id="linkbuttonsearchclient" runat="server" navigateurl='<%# string.format("~/ui/clients.aspx?id={0}", eval("id"))%>' text='recherche'></asp:linkbutton> ...

timer - How to use time delay in MobileFirst adapters -

has tried introducing delay/timer mobilefirst platform foundation adapters? there anyway introduce specific amount of delay? i tried settimeout() doesn't work because of window object not available in adapter.js you can't in adapter logic, can in client logic... add required delay implementation in adapter procedure request's success callback function won't processed right away, if that's want (which strange, but...).

c++ - OpenglES 2.0 Vertex Shader Attributes -

i've read in tutorials bare minimum vertex shader needs define below: attribute vec3 v3_variable; attribute vec3 v3pos; void main() { gl_position = v3pos; } opengles passes shader vertex data v3pos name of variable can anything, other tutorials name a_position , a_pos , whatever~. so question is, how opengles know when call glvertexattribpointer() knows should put data v3pos instead of v3_variable ? there 2 methods of identifying attributes in shaders 'paired' data provide glvertexattribpointer . identifier glvertexattribpointer index (the first parameter), must done index somehow. in first method, obtain index of attribute shader after compiled , linked using glgetattriblocation , , use first parameter, eg. glint program = ...; glint v3posattributeindex = glgetattriblocation(program, "v3pos"); glint v3varattributeindex = glgetattriblocation(program, "v3_variable"); glvertexattribpointer(v3posattributeindex, ...); glverte...

Xamarin.iOS share extension for video files -

i've implemented share extension project , there seems issue video files. when use itemprovider.loaditem function object. the extension works fine files conform to: uttype.audio , uttype.image when share videos, check if file conforms to: attachment.hasitemconformingto (uttype.movie) i've logged videos exact type signings using insights: com.apple.quicktime-movie (gallery) , public.video (imovie) i've modified exact type use in itemprovider.loaditem match 1 recorded insights then end result nsobject comes null nserror set following: no item available requested type identifier. has else run issue? doing wrong?

php - Add infowindow on google map with multiple waypoints -

i creating multiple route between multiple source , destination, route created working fine want display info window custom text source , destination, tried many code not getting success below code <script type="text/javascript"> var my={directionssvc:new google.maps.directionsservice(), maps:{}, routes:{}}; /** * base-class * @param points optional array array of lat+lng-values defining route * @return object route **/ function route(points) { this.origin = null; this.destination = null; this.waypoints = []; if(points && points.length>1) { this.setpoints(points); } return this; }; /** * draws route on map * * @...

python - How to delete all values from sorted set which are part of different unsorted set -

i trying delete using lua script don't know what's going wrong import redis r = redis.redis(host='localhost',port=6379) pipe = r.pipeline(transaction = false) lua = """ local env = redis.call('smembers', 'user_key') redis.call('zrem','another_key', unpack(env)) """ p = r.register_script(lua) p(client=pipe) local reserved lua keyword that's used declaring local variables. in redis' lua scripting engine, variables must local prevent sandbox litter getting out of hand (read docs @ http://redis.io/commands/eval#global-variables-protection ) your script missing variable name - following should work better: import redis r = redis.redis(host='localhost',port=6379) pipe = r.pipeline(transaction = false) lua = """ local l = redis.call('smembers' 'user_key') redis.call('zrem', unpack(l)) """ p = r.register_script(lua) p(client=pi...

laravel - Relationship results automatically coming out? -

i have series of relations on model, here 1 of them. class product extends model{ public function user(){ return $this->belongstomany('\app\user'); } } i rows with: $data = product::all() and these looped through so: foreach ($data $value) { var_dump($value->title); } my understanding if wished relational data come out, need like: $data = product::with('user')->get(); but without above , doing all() still can access user: foreach ($data $value) { var_dump($value->title->user); } why this? relationship results automatically coming out? no, when do $data = product::all(); foreach ($data $value) { var_dump($value->title); } you doing this: select * products but on foreach, since trying access property wasn't loaded, doing new query, behind scenes laravel fetching user. represents n + 1 query problem, if have 25 products run 26 queries (25+1): select * products select * us...

c++ - Facing "unable to find string literal operator" error when compiling ui code with C++11 -

i compiling qtgui application (version 4) own gnu makefile. worked nice when used c++03 standard gcc compiler. now need c++11 standard , error: unable find string literal operator 'operator"" __ file__' " at following lines in window.cpp connect(ui->myglwidget, signal(xrotationchanged(int)), ui->rotxslider, slot(setvalue(int))); connect(ui->myglwidget, signal(yrotationchanged(int)), ui->rotyslider, slot(setvalue(int))); connect(ui->myglwidget, signal(zrotationchanged(int)), ui->rotzslider, slot(setvalue(int))); i tried compile .ui file uic version 4 , 5 , nothing changed. result of uic, ui_window.h has same errors whenever qbject::connect(.....) used. i can't go old c++ standard , both uic compilers produces same ui_window.h file. how can rid of it? before c++11, syntax "foo"__file__ compile "foo""filename.cpp" , resulting in concatenated string "foofilename.cpp" . c++11 add...

email - How to limit result on php-imap -

i'm getting mails php-imap using php-imap-client, script work without problems want limit number of mails server. this script: <?php require_once "imap.php"; $mailbox = 'imap-mail.outlook.com'; $username = 'myemail@outlook.it'; $password = 'mypassword'; $encryption = 'ssl'; // or ssl or '' // open connection $imap = new imap($mailbox, $username, $password, $encryption); // stop on error if($imap->isconnected()===false) die($imap->geterror()); // folders array of strings $folders = $imap->getfolders(); foreach($folders $folder) echo $folder; // select folder inbox $imap->selectfolder('inbox'); // count messages in current folder $overallmessages = $imap->countmessages(); $unreadmessages = $imap->countunreadmessages(); // fetch messages in current folder $emails = $imap->getmessages($withbody = false); var_dump($emails); // add new folder archive $imap->addfolder('archive...

Saving data through JPA sometime causes strange error: java.lang.String cannot be cast to enum -

i'm trying save data database through jpa. here's entity , enum: public enum myenum implements java.io.serializable { myvalue, myothervalue } @entity public class myentity implements java.io.serializable { @enumerated(enumtype.string) @column(name = "myenum") private myenum myenum; public myenum getmyenum() { return myenum; } public void setmyenum(myenum parameter) { this.myenum = parameter; } } and try save entity calling entitymanager's merge method. what is: "java.lang.string cannot cast myenum". strange part possibility of scenario 80% on our production environment, , 20% on our test environment. i tried debug code see happens inside, reached error once. restarted our webserver (wildfly) , can't reproduce. so problem? update : if restart wildfly, problem not comes out while... after unknown time or don't know what, can't save entity again because of casting error.

java - @Autowired singleton of services is null in webservices object -

in services project have defined : package fr.gipmds.fpoc.service; @service("fpocservices") public class fpocservicesimpl implements fpocservices { which implements package fr.gipmds.fpoc.service; @service public interface fpocservices { in webservice project 've defined webservice classes instance of service : package fr.gipmds.fpoc.controller.webservices.ficheparametrage.impl; @webservice(servicename = "publierficheparametrageservice", portname = "publierficheparametrageport", targetnamespace = "http://ws.fpoc.gipmds.fr/", endpointinterface = "fr.gipmds.fpoc.controller.webservices.ficheparametrage.publierficheparametrage") public class publierficheparametrageimpl implements publierficheparametrage { @autowired private fpocservices fpocservices; public retour publier() if (!fpocservices.existefiche(idfiche)) { in parent project have : <context:component-scan base-package="fr.gipmds.fp...

Is it possible to handle multiple form updates in single php page? -

i have multiple forms different fields in them. i want these forms' use single update/edit script, possible. i haven't tried yet code. if it's possible can please provide reference or method carry out way? name submit buttons uniquely in each of pages user interacts , use name="..." property decide form sent data. if(isset($_post['submit1'])){ //do code form 1 } if(isset($_post['submit2'])){ //do code form 2 } submit1 , submit2 submit button names

javascript - Node.JS memory increasing issue -

i have done small program work crone job , hosted it, when make call www.myurl.com:3030/start, script start , every 10 seconds api call happen until set send time met. end time can in 1 or 2 hour since script started, how works when 1 time called. can called again till 100 times, issue is. memory increasing nothing, i tried running twice, memory ran in 90 mb. have question isnt there grabage collection done in node.js ? have tried deploying forever , pm2 both still same. this code, simple code. var express = require('express'); var path = require('path'); var app = express(); var router = express.router(); var bodyparser = require('body-parser'); var moment = require('moment'); var http = require('http'); //app.use( bodyparser.json() ); // support json-encoded bodies app.use(bodyparser.urlencoded({ // support url-encoded bodies extended: true })); app.set('views', path.join(__dirname, 'views')); app.set...

ios - How to import created a Xcode project in iPhone? -

i created , running project in xcode mac.i thought project running in iphone.how import xcode project iphone.please me if have apple developer account, then: 1- need create few certificates, info distributing ios apps itunes connect if don't have developer account, have purchase apple developer program ios otherwise not possible run on real devices, can check app on simulator. read detailed tutorial on how test app on ios device