Posts

Showing posts from August, 2012

php - In Propel2, filter crossref by null value -

i use propel2 orm. i've 2 tables entry , category connected many-to-many relationship via entrycategory table. i set iscrossref on true in schema.xml. everything works fine : i'm able filter entry category : entryquery::create()->filterbycategory($cat) but i'm not able filter entries with no category . tried entryquery::create()->filterbycategory(null, criteria::equal) or entryquery::create()->filterbycategory(null, criteria::isnull) but, gives me 'filterbycategory() accepts arguments of type \category or collection' i tried entryquery::create()->where('category null') but, i've got error unknown column 'category' in 'where clause' so, need ... edit : extract of schema.xml : <?xml version="1.0" encoding="utf-8"?> <database package="core" name="bank" identifierquoting="true" defaultidmethod="native" defaultphpnamingm

angularjs - TypeError: Cannot read property '0' of null (Javascript/Angular) -

i'm running relatively strange error here. in controller, have array defined. $scope.results = []; on ng-keyup event, fire method: $scope.search = function() { myservice.findstuff($scope.mymodel.searchterms).success(function(response) { $scope.results = response; }); on first keyup, search fires, returns result, , updates dom results: <div ng-repeat="thing in results">{{ thing.name }}</div> everything work perfectly, on first keypress. afterwards, i'm getting error: typeerror: cannot read property '0' of null this crashes angular app , i'm out lunch. edit: should clarify, error thrown before of code in $scope.search executes. no query server fired, no console logging executed, nothing. i've tracked down $scope.results = response; . line removed, queries repeatedly fire no issue. i've noticed if try change results manually (ie. on keypress $scope.results = [{ name: "spaz" }] , works on

Create multi statement instructions in TWIG -

i wonder if there way of creating multi statements in twig example: 2 separate statements ... {% set foo:bar %} {% set baz:qux %} into 1 single statement {% set foo:bar set baz:qux %} no can't. set "tag", thing after compiled token parser "tag".

sql - Convert decimal to currency in C# visual studio 2010 -

hi guys have label on website shows price of items on pages. t shirt page displays price t-shirt 55 , want show £55 . label show price in £ currency format. current code below. can please point me in right direction? time... <asp:label id="label2" runat="server" text='<%# convert.todecimal(eval("price")).tostring("#,##0.00") %>'> change format string use c , format string currency value. <asp:label id="label2" runat="server" text='<%# convert.todecimal(eval("price")).tostring("c") %>'> see msdn more info.

javascript - Detect page change for one page apps JS -

i'm wondering if has solution tracking "page" changes one-page apps? i understand concept of one-page app in html/css page preloaded , pages constructed based on dictating elements of page hide/show. though technically it's one-page app, perception of user is several pages/experiences. what's best way differentiate/track these pages/experiences in one-page app environment? yes, https://github.com/angular-ui/ui-router has $statechangesuccess , fired once page/state transition complete. add $rootscope.$on page controllers want stuff happen on page changes. http://angular-ui.github.io/ui-router/site/#/api/ui.router.state .$state $rootscope.$on('$statechangestart', function(event, tostate, toparams, fromstate, fromparams){ console.log('page change happened'); })

R Shiny - resize numericInput box -

i have basic shiny app. ui.r: library(shiny) shinyui(fluidpage( titlepanel("average run length simulation"), fluidrow( tabsetpanel( tabpanel("shewhart v. shewhart", fluidrow( column(4,"rule"), column(2,"group 1"), column(2,"group 2") ), fluidrow( column(4,"1 point more k sigma away mean"), column(2, checkboxinput("svsg1r1",label=" ",value=f), numericinput("svsg1k1",label=" ",value=3,min=1,step=1) ), column(2, checkboxinput("svsg2r1",label=" ",value=f), numericinput("svsg2k1",label=" ",value=3,min=1,step=1) ) ) ) ) ) )) the server.r file basic 1 created rstudio in new project. what want tabular layout of widge

android - Notifying adapter from model -

i'm trying make changes android application adopting mvp pattern, i'm having trouble notify adapter recyclerview using. what i'm doing giving reference adapter in model , notifying changes made when click events happen, so: public class mymodel { private myadapter adapter; ... public void setadapter(myadapter adapter) { this.adapter = adapter; } public void action() { // make changes model , notify adapter changes // made individual items ... adapter.notifyitemchanged(position) } } i'm wonder conventional way of handling kind of behaviour using mvp pattern. the observer pattern might looking for. when changes made model can notify observers (the presenters) can update view. http://en.wikipedia.org/wiki/observer_pattern

sorting - Algorithms to sort data from text files in ascending/descending order C# -

right, let me try explain stuck on , trying do! have multiple .txt files, large set of data inside them (one has days of week, dates, , others other data stocks) in descending order (so first piece of data of 1 .txt file matches first piece of data in .txt file). i trying code read lines of text files (using file.readalllines), place read data big array (if possible) if user requests see data on "wednesday" or data in text files 01/03/1999 - 31/03/1999 , data show on command line (i added table - run code , you'll see mean) user has able search day or date , needs able sorted ascending , descending order using algorithm, in head, know need do, implementation struggle, i've tried array.list(), array.sort(), quicksort (wasn't useful @ all) , more have forgotten after 3 hours worth of trial , error. i'm still quite new this, in terms of algorithms have explained it's @ least understandable open enough might others. if makes no sense, please ask questi

git branch - Git - switch local branches various scenario -

git powerful tool helps boost productivity. say, great power comes great responsibility, don't want mess while being more productive using git. need have strategies while using git version control. following few scenario while using local branches. can someone, please, explain how can deal those: , b local branches x remote branch 1.a pulled x, made changes. not staged,not committed,not pushed. how switch branch b without discarding changes of not including them in b 2.a pulled x, made changes.few unstaged(yes/no), staged changes,not committed,not pushed. how switch branch b without discarding changes of not including them in b 3.a pulled x, made changes.few unstaged(yes/no), staged changes,committed changes,not pushed. how switch branch b without discarding changes of not including them in b 4.a pulled x, made changes. want keep copy of these changes , want work simultaneously on other 2 features on top of changes in (the reason i'm working on multiple features si

list - How to Sort Python Objects -

i have nested list contains different objects, they're duplicate pairs of objects in nested list , i'm trying remove them keep getting typeerror: unorderable types: practice() < practice() i know error caused me trying work objects rather integers don't know how else remove duplicates here tried class practice: id = none def __init__(self,id): self.id = id = practice('a') b = practice('b') c = practice('c') d = practice('d') e = practice('e') f = practice('f') x = [[a,b],[c,d],[a,b],[e,f],[a,b]] unique_list = list() item in x: if sorted(item) not in unique_list: unique_list.append(sorted(item)) print(unique_list) if want compare objects id: class practice: id = none def __init__(self,id): self.id = id def __lt__(self, other): return other.id > self.id def __gt__(self, other): return self.id > other.id unique_list = list()

jquery - QUnit - testing plugin method calls, generic statements, etc -

few things know: my app heavily uses jquery jquery plugins (jquery ui, chosen, datatable, etc) bootstrap so new js unit testing , maybe sound very lame have few questions below: i have started qunit test js code , have used blanket.js code coverage. blanket js output shows code uncovered. wondering how/what can them covered? example 1 function resetform(form) { form.reset(); // line shows not covered } example 2 $('a.staticlink').on('click', function(e) { e.preventdefault();// line shows not covered }); similarly generic bootstrap functions show(), hide() show not covered. even statements have plugin call show not-covered $(".chosen-select").chosen(); //not covered any appreciated what have trigger event manually in test case. in case of example 2 below $('a.staticlink').trigger('click'); and write assertions based on supposed happen once button clicked.

ruby on rails - Filter chain halted as force SSL rendered or redirected -

Image
so app in production has totally crashed message: filter chain halted #<proc:0x007f766547ea18@/app/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_controller/metal/force_ssl.rb:65> rendered or redirected i've done research online , far seems happen in local dev mode when port lost. i'm not sure why happening in heroku app... context code has not changed, , working fine of 30 minutes ago. i'm using cloudflare, checked bare your-app-name.herokuapp.com broken same error. any appreciated! i got same error on development environment in rails 4.0 (because of controller force_ssl on it). i solved using thin web server ssl support , so: add thin gem gemfile on development group: group :development gem 'thin' end run bundle install on termnal: bundle install start thin ssl support on terminal: bundle exec thin start --ssl access page via https on web browser: the protocol need https @ beginning , other

function - Fill Color Python Graphic (India Flag) -

Image
i'm working on creating indian flag in graphwin graphics system in python. i'm missing code right now. when run code below, dark green covers white. when remove setfill('darkgreen') bottom, white shows fine, , doesn't cover else out. missing? from graphics import * def main(): win = graphwin("india flag", 500, 500) pt = point(50,50) pt.draw(win) top = rectangle(point(260,100), pt) top.setfill('orange') top.draw(win) pt2 = point(50, 150) middle = rectangle(point(260,100), pt2) middle.setfill('white') middle.draw(win) pt3 = point(50, 200) bottom = rectangle(point(260,100), pt3) bottom.setfill('darkgreen') bottom.draw(win) main () any appreciated! from graphics import * def main(): win = graphwin("india flag", 500, 500) pt = point(50,50) pt.draw(win) top = rectangle(point(260,100), pt) top.setfill('orange') top.draw(win) pt2 = point(50, 150) middle =

database - django on jython(cannot import name BaseDatabaseWrapper) -

i have problem buliding django on jython i have installed django-jython , jython , django in settings.py dababase engine write : doj.db.backends.sqlite raiseimproperlyconfigured(error_msg) django.core.exceptions.improperlyconfigured: 'doj.db.backends.sqlite' isn't available database backend. try using 'django.db.backends.xxx', xxx 1 of: u'base', u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3' error was: cannot import name basedatabasewrapper it seems in doj.db there no these classes can find in django.db and i find in site-packages\django_jython-1.7.0b2-py2.7.egg\doj\db\backends\sqlite\base.py there : from doj.db.backends import jdbcbasedatabasewrapper basedatabasewrapper from doj.db.backends import jdbcbasedatabasefeatures basedatabasefeatures from doj.db.backends import jdbcbasedatabaseoperations basedatabaseoperations from doj.db.backends import jdbccursorwrapper cursorwrapp

mysql - PHP code for registering a user is not working -

i code registering user. code works, , adds new user. seems ignore part has check if there user registered username or email. <?php // include database connection , functions here. include 'db_connect.php'; include 'functions.php'; // hashed password form $password = $_post['p']; // create random salt $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); // create salted password (careful chilli) $password = hash('sha512', $password.$random_salt); $username = $_post['username']; $email = $_post['email']; $result = mysqli_query($con,"select * members username='$username'"); $username_check = mysqli_fetch_array($result); $result_email = mysqli_query($con,"select * members email='$email'"); $email_check = mysqli_fetch_array($result_email); if ($username == $username_check['username']){ mysqli_close(); header("..\..\..\?error12"); exit;

for loop - Reading data from RandomAccessFile producing incorrect results - Java -

i have text file 42 lines. each line has more 22,000 numbers separated comma. i wanted extract numbers each line, , have int array length of 1000 containing 1,000 numbers need each of 42 lines. for example if array contains 43, 1 , 3244, means want 43th number, 1st number , 3244th numbers each line, starting first line ending 42nd line. my loop not seem work, reads first line text file has 42 lines of 220000 numbers, , dont know goes wrong. for(int i=0;i<42;i++){ //irretates through 42 lines of counter=1; // keep track on line code working system.out.println("starting line"+i); st2=new stringtokenizer(raf1.readline(),","); //raf3 randomaccessfile object containing 42 lines a:while(st2.hasmoretokens()){ b=is_there(array2,counter); // is_there method compares rank of taken being read //the whole array has 1000 numbers want. if(b==false){ // if rank or order of token [e.g. 1st, 432th]

list - Python class constructor returns an empty value -

i'm writing python class based on list. constructor builds list based on 2 other lists passed parameters. logic roughly: copy list new instance, iterate on list b, adding entries , using others modify entries list a. i've got 2 versions of constructor. in first, list , list b processed loops. decided clever; used comprehension replace loop adds list new instance. the first version of constructor works perfectly. second version returns empty list, though can @ value of self in debugger before constructor ends, , see it's correct. why happening, , can make second version work? here code makes second version misbehave. copies list new instance, iterates on instance update data in dictionary represents items in list b. ba list a; getkey function (passed parameter) derives dictionary key list element; _dictb dictionary contains element each element in list b. self = [ [bae,none] bae in ba ] # copy list self n in xrange(0,len(self)) : # iterate on list b

indexing - Index was outside the bounds of the array visual basics -

i having error index outside bounds of array. me @ code please? private sub piclist_click(byval sender system.object, byval e system.eventargs) handles piclist.click frmlist.show() frmlist.lstshow.items.clear() dim fmtstr string = "{0,-5}{1,-10}{2,-15}{3,-20}{4,-25}" frmlist.lstshow.items .add(string.format(fmtstr, "university name", "abbreviation", "state", "accredited year", "total students")) = 0 n - 1 .add(string.format(fmtstr, name(a), abbreviation(a), state(a), accredited(a), total(a))) next .add(string.format(fmtstr, "", "", "", "", "")) .add("total of " & n & " universities.") end end sub

ios - RLMObjects not recognised as the same in Realm Cocoa -

i have tableview containing rlmobjects , want search row containing specific rlmobject. after casting rlmresult object original type not same original object: // ... adding todoa !iscompleted defaultrealm() var firstitem = todo.objectswhere("iscompleted == false")[0] as! todo if firstitem == todoa { // todoa != firstitem even-though should same object } how can compare 2 rlmobjects without having implement primarykey allocation? rlmobject not conform swift's equatable protocol, allowing == , != comparisons. depending on equality semantics want objects, can use following extension on rlmobject : extension rlmobject: equatable {} func == <t: rlmobject>(lhs: t, rhs: t) -> bool { return lhs.isequaltoobject(rhs) }

php - How do I get the table schema/columns from an entity object in cakephp 3? -

let's have bonified \cake\orm\entity object -- $kablammo can confirm , make sure has associated repository doing following: use cake\orm\entity; // ..snip if ($kablammo instanceof entity && !empty($kablammo->source())) { $repository = $kablammo->source(); // ... do here table schema info/columns? } i'd able view table columns entity's associated table basically. what's best way this? going wrong already? i think figured out. use cake\orm\entity; use cake\orm\tableregistry; // ..snip if ($kablammo instanceof entity && !empty($kablammo->source())) { $repository = $kablammo->source(); $table = tableregistry::get($repository); debug($table->schema()); } at least i'm on right track now.

python - django templates not altering form action -

i have url file chat.urls.py: `urlpatterns = patterns('', url(r'^message/(?p<username>\w+)/$',views.message,name='message'), url(r'^message/(?p<username>\w+)/submit/$',views.send_message,name='send_message'), url(r'^inbox/$',views.inbox,name='inbox'), url(r'^inbox/(?p<username>\w+)/$', views.inbox_by_user,name='inbox_by_user'), )` and message.html template send message form this: <form action="{% url 'inbox' %}" method="post"> {% csrf_token %} <input type="text" name="text" id="text" value="" /> <label for="message">enter message here</label><br /> <input type="submit" value="send" /> </form> where substituted working code "url 'inbox'", , no matter substitute form action html source rendered <form

inheritance - JavaScript: Object inheriting from Function.prototype -

Image
i testing out james shore's object playground , , see methods inherit function.prototype, including methods on global object.prototype. how work? isn't kinda circular? mean... doesn't function.prototype "itself" inherent object.prototype? how object inherent function.prototype? isn't function sub-type of object? shouldn't object inherently contain these behaviors anyway? why need inheritance? tl;dr object.prototype last in prototype chain , doesn't inherit anything. object constructor 1 inherits function.prototype because it's function; it's function instance. long version since question general one, i'll try describe few subjects , answer own question. here subjects i'll try cover: two ways use word "prototype". how classes created in javascript. how function & object constructors relate. note: can hard , @ times confusing explain how javascript works. hope you'll out of though.

How to print Database value as we input in Drupal 7 or PHP? -

Image
below input gave in textarea. hi ram, how you? thank you. when hit submit got stored in database. below value when database , print hi ram,how you?thank you. here issue. when database want pint same input. any appreciated. good morning, i think should consider using wysiwyg module . usage of module , libraries (such ckeditor) provides user-friendly interface add styles textareas. speaking, provides bold, italic, link, images , many other features. this example of see editing textarea ckeditor . hope helps.

javascript - In an ember model, how can you reference dynamic object keys? -

in our application passing array of objects server side model, , each element in array has key in it. instance... [ {name: "dog", sound: "bark", food: "cats"}, {name: "cat", sound: "meow", food: "mouse"} ] in model defined so... animals: hasmany(animal, {key: 'name', embedded: true }) then if want data cat, use findby feature find 1 name = "cat" so... var animalname = "cat"; model.get('animals').findby('name', animalname); this works well, there lots of potential types of 'animal' objects, , know we're looking for. however i'm curious other reasons if can pass in map server, becomes json object on client looks this... animals : { "dog" : {sound: "bark", food: "cat"}, "cat" : {sound: "meow", food: "mouse"} } it seems in order this, in model code need define &quo

JQuery Ajax POST to Web API returning 405 Method Not Allowed -

so have jquery ajax request this: function createlokiaccount(someurl) { var d = {"jurisdiction":17} $.ajax({ type: "post", url:"http://myserver:111/api/v1/customers/createcustomer/", data: json.stringify(d), contenttype: "application/json; charset=utf-8", datatype: "json", success: function(data){alert(data);}, failure: function(errmsg) { alert(errmsg); } }); } this hitting web api basically: [httppost] public createcustomer.response createcustomer(createcustomer.request request) { httpcontext.current.response.appendheader("access-control-allow-origin", "*"); ... which when call in chrome gives me: options http://myserver:111/api/v1/customers/createcustomer/ 405 (method not allowed) no 'access-con

PHP: setting content length of MIME message -

i have build api in php returns request java coder. have done. header("mime-version: 1.0".$eol); header("connection: keep-alive".$eol); header("accept-encoding: gzip, deflate".$eol); header("host: host".$eol.$eol); header("content-type: multipart/related; boundary...//not sure if can show boundary".$eol); echo $res; so, there main headers , $res variable bdy of response. form way. $eol="\r\n"; $boundary = "boundary...//not sure if can show boundary"; $res="--".$boundary.$eol; $res .= "content-type: application/json".$eol; ob_start(); print_r($json); $result = ob_get_clean(); $data .= "content-length: ".strlen($result).$eol.$eol; $res.=$result; $res.=$eol.$eol; $res.="--".$boundary.$eol; ob_start(); readfile('/var/www/9292/inputphoto.jpg'); $result = ob_get_clean(); $res.="content-type: image/jpeg".$eol; $imagelength=strlen($result)+6; //i add +6 be

openlayers - Wrong projection for vector layer with http protocol -

i'm using openlayer geoserver. i want create vector layer sends viewparams geoserver layer, done wms . however : var newlayer = new openlayers.layer.vector('layer', { strategies: [new openlayers.strategy.fixed({preload: true})] , projection: new openlayers.projection("epsg:4326") ,protocol: new openlayers.protocol.http({ url:"/geoserver/ows?service=wfs&version=2.4.0&request=getfeature&typename=wg:layer&maxfeatures=50&outputformat=json&viewparams=uid:"+id, format: new openlayers.format.geojson() }), stylemap: new openlayers.stylemap({ 'default': new openlayers.style(null, { rules: [ new openlayers.rule({ symbolizer: { graphic: false,

java - Where can I download the eclipse GlassFish tools ide sourcecode? -

i want download eclipse glassfish tools ide sourcecode, searched lots of pages include oracle homepage , glassfish home page. found older plugin soucre code . can tell me can download latest glassfish eclipse plugin source code? thanks lot

linux - Weird issue with "sed" command -

on script, -for unknown reason- gives me errors when reaches sed command: function nzb() { ( [ -z "$1" ] ) && echo "no argument given!" && return 1 hash="$(echo -n "$1" | md5sum | cut -d" " -f1)" mkdir "${hash}" && rar -m0 -v200m "${hash}"/"${hash}".rar "$1" && rm -rf "$1" && par2 c -r10 -l "${hash}"/"${hash}".par2 "${hash}"/* && ~/newsmangler-master/mangler.py -c ~/.newsmangler.conf "{hash}" && sed -i "1i$1\n${hash}\n" ~/hashs.txt } . error: "{hash}" not exist or not file! error: no valid arguments provided on command line! but when -out of curiosity- removed sed's preceding commands, worked suppose to: function nzb() { ( [ -z "$1" ] ) && echo "no argument given!" && return 1 hash="$(echo -n "$1

security - django page got hacked - how to react? -

my original page http://www.stahlbaron.de/ since 2 days, http://www.joma-topflex.ru/ pointing page. realized , added allowed_hosts = ['.stahlbaron.de'] , didnot help. bad url still pointing page. what can do? used nginx, uwsgi deploy page. ngix doesnot have deny www.joma-topflex.ru; option unfortunately. there 2 possibilities: the owner of copy stole code , database, unlikely. can checked — add change page on website , see if appears on doppelgaenger. if copy independent nothing change there. don't forget use ctrl+f5 avoid seeing cached contents. if case, can report abuse copy's hosting provider . in fact, should in case. if copy proxied mirror website, blocking ip solve problem. can in nginx modifying configuration this: geo $bad_client { default 0; 78.47.49.3/32 1; } server { ... if ($bad_client) { return 403; } add_header x-frame-options sameorigin; ... } this idea

Photoshop JSX font size -

upd: using photoshop cc 5 i writing script replacing strings in psd text layers. works fine, except in of layers text size smaller of original strings. when log text size before , after change contents, indeed different: the old size , new size: 74.601448059082 pt : 38.3819046020508 pt i tried saving old size in var , setting size after change content, text size still wrong (and equal second value). doing wrong? here code use replacing string , logging: var originalstring = layerset.textitem.contents; var replacementstring = ""; replacementstring = mmifromlines(originalstring, lines); var oldsize = layerset.textitem.size; var oldkind = layerset.textitem.kind; layerset.textitem.contents = replacementstring; log.writeln("the old size , new size: " + oldsize.value + " " + oldsize.type + " : " + layerset.textitem.size.value + " " + layerset.textitem.size.type); log.writeln("old kind vs new kind: " + oldkind + &

encryption - in python compilation EOFError SyntaxError: multiple statements found while compiling a single statement -

i have code , while run it import sys msgs = ["315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b159610b11ef3e", "234c02ecbbfbafa3ed18510abd11fa724fcda2018a1a8342cf064bbde548b12b07df44ba7191d9606ef4081ffde5ad46a5069d9f7f543bedb9c861bf29c7e205132eda9382b0bc2c5c4b45f919cf3a9f1cb74151f6d551f4480c82b2cb24cc5b028aa76eb7b4ab24171ab3cdadb8356f", "32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb", "32510ba9aab2a8a4fd06414fb517b5605cc0aa0dc91a8908c2064ba8ad5ea06a029056f47a8ad3306ef5021eafe1ac01a81197847a5c68a1b78769a37bc8f4575432c198ccb4ef63590256e305cd3a9544ee4160ead45aef520489e7da7d835402bca670bda8eb7

c# - when using override on a collection<T> method, base class has ToCollection but derived class doesn't have -

base class: public virtual collection<string> getpaymentmethods(organization organization) { ipaymentservice paymentservice = servicelocator.getpaymentservice(); collection<paymentmethod> paymentmethods = paymentservice.getpaymentmethods(organization.countrycode, organization.languagecode, organization.usertype, appavailabletype.autorenewal); return paymentmethods.select(p => p.paymentmethodtype).tocollection<string>(); } override: public override collection<string> getpaymentmethods(organization organization) { collection<paymentmethod> paymentmethods = this.paymentservice.getpaymentmethods(organization.countrycode, organization.displaylanguagecode, organization.usertype, appavailabletype.autorenewal); return paymentmethods.select(p => p.paymentmethodtype).**tocollection**<string>(); } in above method ".tocollection" isn't available

javascript - how to read audio file in fire fox using file reader class -

savebutton.onclick = function(e) { var filename= file.name; console.warn("file name " +filename); //alert("hello"); var audiotype = "audio/*"; //console.warn("audiotype " +audiotype); if(filename.type.match(audiotype)) { console.warn("audiotype " +audiotype); var reader=new filereader(); console.warn("file reader object " +reader); read.onload=function(e) { var rowdata=reader.result; console.warn("file reader object row data " +rowdata); } reader.readasbinarystring(filename); } } here on save button event getting audio file name using file.name.now want read in buffer because want upload file on server.so want read using file reader class.but here not getting output.can 1 plzz me figure out problem in code. very broad solution, supposing using post request upload file , server accepting post request. var myfile;

motion detection - Smartwatch Gear 2 -

i have developed application getting data gear2 accelorometer. devicemotion events managed window event listener such as: window.addeventlistener('devicemotion', function(e) { ax = e.accelerationincludinggravity.x / 9.8; ay = e.accelerationincludinggravity.y / 9.8; az = e.accelerationincludinggravity.z / 9.8; }); i need run application in background if screen switched off. adopted power setup: tizen.power.request("screen", "screen_normal"); tizen.power.request('cpu', 'cpu_awake'); the problem: when screen switched off (by means of home button) motion event associated window not fired. think if window not active listener not active. somebody has idea how accelometer data if screen off? regards v yes, can still data when app running in background on pressing home key. please add in config.xml <tizen:setting background-support="enable"/> this enable app collect data in bac

php - Laravel 5 Lang::get() Replace -

i'm having problems. you can use lang :: () in laravel 5, want make replace characters. resources/lang/en/messages.php <?php return array( 'test' => 'test message. :name', views/top.blade.php {!! app::setlocale('en') !!} {!! lang::get('messages.test', array('name' => 'dayle')) !!} however, error. errorexception in translator.php line 148: missing argument 2 illuminate\translation\translator::illuminate\translation\{closure}(), called in /home/my-site/www/my-site/vendor/compiled.php on line 11547 , defined (view: /home/my-site/www/my-site/resources/views/top.blade.php) cause not know. do not people know? i resolve issue following steps here to summarize, try following steps: delete vendor/compiled.php , storage/framework/compiled.php run composer update , if didn't run automatically, run php artisan optimise compile again. use double quotes in messages.php file (e.g. "ti

java - Add component to top of JPanel -

i have vertically aligned elements in jpanel , , want add 1 first position, not last one. there way that? i tried using borderlayout , adding elements borderlayout.north replaced it. use gridbaglayout or gridlayout jpanel. allow align elements vertically. can use add(component component, int index) method provided component class add new component first position.

Ant ssh can`t connect to computer -

i have problem connection ant build.xml via ssh computer. have computer ip adress: 10.62.11.40, ant have ant code connect computer: <available property="ant-jsch.present" file="${ant.home}/lib/ant-jsch.jar"/> <fail if="ant-jsch.present" message="please remove ant-jsch.jar ant_home/lib see [http://ant.apache.org/faq.html#delegating-classloader]"/> <path id="jsch.path"> <pathelement location="lib/ant-jsch.jar" /> <pathelement location="lib/jsch-0.1.44.jar" /> </path> <taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.scp" classpathref="jsch.path" /> <taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.sshexec" classpathref="jsch.path" /> <echo message="start working...123&qu

java - Android: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) on movie.draw -

i trying display animated gif in imageview using android movie class in ondraw method follow: @override protected void ondraw(canvas canvas) { canvas.drawcolor(color.transparent); super.ondraw(canvas); long = android.os.systemclock.uptimemillis(); if (moviestart == 0) { moviestart = now; } movie = getmoviefromgif(); if (movie != null && movie.duration() > 0) { try { int reltime = (int) ((now - moviestart) % movie.duration()); movie.settime(reltime); float movie_height = convertdptopixels(movie.height()); float movie_width = convertdptopixels(movie.width()); float new_movie_height = movie_height; float new_movie_width = movie_width; float movie_ratio = movie_width / movie_height; if (new_movie_width > container_width) { new_movie_wid

if statement - IF entry in MySQL exists do -

i trying query database under condition there session active. want solve if-statement , looked through these pages here nice solution, nothing works out me. my current approach one: if (select exists (select endtime session userid = 0 , sessionid = 1 , endtime = -1)) begin //do stuff here end maybe can me out here? i running mariadb mysql. cheers & thanks.

node.js - couchdb - how to search by array -

i have documents following format: { url: 'some-unique-url', name: 'some-name' } what need select documents has specific url supplying array contains url's need select: ['some-unique-url', 'another-url'] here's view looks like: function(doc) { if(doc.type == 'message'){ emit([doc.url], null); } } and here's node.js code. i'm using nano . db.view('message', 'by_url', {'key': urls}, function(err, body){ res.send(body); }); this works if have 1 item in array add item, here's get: {"total_rows":18,"offset":11,"rows":[]} i tried startkey , endkey works acts same way previous one: db.view('message', 'by_url', {'startkey': online_users_ids, 'endkey': [online_users_ids, {}]}, function(err, body){ res.send(body); }); is i'm trying possible couchdb , nano? if not, what's closest thing can without

go - Converting Erlang-C port example to Erlang-Golang -

i'm trying write golang driver erlang, accesible via erlang port. i've started erlang c port example, works fine: http://www.erlang.org/doc/tutorial/c_port.html now i'm trying port c code golang; trying echo simple 'hello world\n' message, using '\n' delimiter. so golang code follows: package main import ( "bufio" "fmt" "os" ) func main() { reader := bufio.newreader(os.stdin) fmt.print("enter text: ") bytes, _ := reader.readbytes('\n') os.stdout.write(bytes) } and can compile , run command line follows: justin@justin-thinkpad-x240:~/work/erlang_golang_port$ go build -o tmp/echo echo.go justin@justin-thinkpad-x240:~/work/erlang_golang_port$ ./tmp/echo enter text: hello hello however when try call driver erlang side (erlang code below) following: justin@justin-thinkpad-x240:~/work/erlang_golang_port$ erl erlang r16b03 (erts-5.10.4) [source] [64-bit] [smp:4:4] [a

mysql - Retrieving error for failed event -

Image
i'm trying find out happen if event failed, event sql: delimiter $$ create event if not exists `cdr2015_daily_update` on schedule every 1 day starts (timestamp(current_date) + interval 1 day + interval 3 hour) begin declare exit handler mysqlexception, mysqlwarning begin insert events_state values ('cdr2015_daily_update', 'true', now(), 'unknown', 'unknown') end; insert cdr2015_v2 (clid, src, dst, dcontext, channel, dstchannel) select calldate, clid, src, dst, dcontext, channel, dstchannel cdr date_format(calldate, '%y-%m-%d') = subdate(current_date, 1); -- yesterday calls end; $$ delimiter ; every day @ 03:00 backup of calls day before. event fail sure, i'd know error, like: `error code: 1136. column count doesn't match value count @ row 1` , possible catch error , insert table? this events_state table: create table `events_state` ( `event` varchar(255) default n

php - Symfony2 is it possible to remove session variable with Javascript? -

when displaying selected products saved in sessions have button want remove specific product if dont need it. can achieve javascript? if not other solutions problem? i have heard cant set session variables javascript same goes removing them, have heard can ajax remove them?? anyway im displaying products this(for im showing price of product dynamically): {% item in items %} <tr> <td><img width="60" src="{{ asset('bundles/mpfrontend/assets/products/4.jpg') }}" alt=""/></td> <td>{{ item.model }}</td> <td> <div class="input-append"><input class="span1" style="max-width:34px" placeholder="1" id="appendedinputbuttons" size="16" type="text"> <button class="btn" type="button"><i class="icon-minus"></i></button>

java - Insert object into List wildcard extending interface -

so have interface public interface identity { abstract void setkey(string key); abstract string getkey(); } that want use insert sort function public static void insertidentity(identity identity, arraylist<? extends identity> list) { int = 0; identity id; while (i < list.size()) { if ((id = list.get(i)).getkey().compareto(identity.getkey()) < 0) { i++; }else{break;} } list.add(i, identity); } but cannot add identity arraylist - ? extends identity i wondering if there way around this? i know java has other ways of doing task function work. you make method generic : public static <t extends identity> void insertidentity(t identity, arraylist<t> list) { //... you may need make other methods generic well, if use approach.

c++ - Verticalize Triangle -

i have triangle 2 points have same z-value , 1 has different value. want transform point different z-value, optically generates "vertical" triangle. assuming point c 1 different height-value, somehow need move x , y coordinates of point c orthogonal difference-vector of , b, until vertically line up, e.g. slope 90 degrees. unfortunately, complete idiot concerning rotations , stuff. give me hints how solve that? the code need written in c++, simple pseudo-code enough :) but preferably rather quick way, because has called 700000 times per player, per chunk load let's have points b c, , a.z == b.z, , z represents vertical direction. first, project x,y co-ordinates of c onto line between , b in 2d: // find normalized ab vector: ab.x = b.x - a.x; ab.y = b.y - a.y; length = sqrt(ab.x * ab.x + ab.y * ab.y); // test length == 0 avoid div 0 ab.x /= length; ab.y /= length; // note: save division dividing dot length instead // project c onto ab: ac.x = c.x - a.