Posts

Showing posts from January, 2012

javascript - What should be the correct path of templateUrl in angularJs directive? -

i want give path of templateurl seprate .jade file. showing 500 err , error: [$compile:tpload] . below code in directive app.directive('personrecord',['$http',function(http){ return{ restrict : 'ae', templateurl : '../../views/template.jade', link : function(scope,ele,attr){ } } }]); and folder structure below. bin node_modules public |-- js |-- main.js routes views |-- template.jade |-- index.jade app.js package.json please me out in ! missing here ! my suggestion put views folder inside public folder:- bin node_modules public |-- js | |-- main.js |--views |-- template.jade |-- index.jade routes app.js package.json and use app.directive('personrecord', function(http){ return { restrict : 'ae', templateurl : 'views/template.jade', link : function(scope, ele, attr){ } }; }); hope helps :)

properties - PHP OOP how to access class parent property Scope Resolution Operator (::)? -

how can access property var in class otherclass inside class method myfunc (parent::myfunc();) <?php class myclass { public $var = 'a'; protected function myfunc() { echo "myclass::myfunc()\n"; } } class otherclass extends myclass { public $var = 'b'; // override parent's definition public function myfunc() { // still call parent function parent::myfunc(); echo "otherclass::myfunc()\n"; } } $class = new otherclass(); $class->myfunc(); you cannot, because there's no separate variable. otherclass extends myclass therefore otherclass contains myclass features + additional stuff otherclass whilte keeping access parent's methods (thru parent:: ) makes perfect sense (i.e allows chaining) having more 1 variable of same name cause massive headache w/o bringing benefits.

SSL certificate verifaction error cPanel -

when want install certificates on cpanel, see error: error certificate verification failed! executed /usr/bin/openssl verify -capath /var/cpanel/ssl/installed/cabundles: stdin: cn = example.com error 20 @ 0 depth lookup:unable local issuer certificate i able resolve issue including ca trusted bundle @ bottom.

subset - Serial Subsetting in R -

i working large datasets. have extract values 1 datasets, identifiers values stored in dataset. subsetting twice each value of 1 category. multiple category, have combine such double-subsetted values. doing similar shown below, think there must better way it. example datasets set.seed(1) df <- data.frame(number= seq(5020, 5035, 1), value =rnorm(16, 20, 5), type = rep(c("food", "bar", "sleep", "gym"), each = 4)) df2 <- data.frame(number= seq(5020, 5035, 1), type = rep(letters[1:4], 4)) extract value grade a asub_df2 <-subset(df2, type == "a" ) asub_df <-subset(df, number == asub_df2$number) new_a <- cbind(asub_df, grade = rep(c("a"),nrow(asub_df))) similarly extract value grade b in new_b , combine analysis. can use you can split 'df2' , use lapply filter(negate(is.null), lapply(split(df2, df2$type), function(x) { x1 <- subset(df, number==x$number) ...

C# check if object is out of bounds (GUI) -

i'm making moving rectangle in c# wfa. it's moving without problems, can go away gui need check if rectangle out of bound. i've tried it, works in left-up corner. (my window 400x400) using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace object { public partial class form1 : form { enum directions { left, right, up, down } directions _direct; private int _x; private int _y; public form1() { initializecomponent(); _x = 50; _y = 50; _direct = directions.down; } private void form1_load(object sender, eventargs e) { invalidate(); } private void form_paint(object sender, painteventargs e) ...

c# - Using String.Format when passing DateTime arguments type to DB. Exception is thrown. What is wrong? -

object args = new object[] { "project", "projectname", "@prname", "projectstartdate", "@startdate", "projectenddate", "@enddate", "projectid", "@id" }; //******************this line causes exception thrown ******************* string commandstring = string.format(@"update {0} set {1} = {2}, {3} = {4} , {5} = {6} {7} = {8}", args); command.commandtext = commandstring; command.commandtype = commandtype.text; command.connection = connection; command.parameters.add("@id", sqldbtype.int).value = selid; command.parameters.add("@prname", sqldbtype.text).value = projectname; command.parameters.add("@startdate", sqldbtype.datetime).value = startdate; command.parameters.add("@enddate", sqldbtype.datetime).value = enddate; connection....

ruby on rails 4 - Use chop before resize in Imagemagick -

i using paperclip gem process images. in images, need chop top 35 pixels of source image , conversions , processing currently using :convert_options => { all: lambda{ |instance| "#{!instance.chop_top.blank? ? '-chop 0x35' : '' } -limit memory 64 -limit map 128"}, mobile_sm: "-resize 620 -quality 90 -strip -interlace plane", mobile_lg: "-resize 1280 -quality 80 -strip -interlace plane", feature: "-quality 90 -strip -interlace plane", medium: "-quality 85 -strip -interlace plane", preview: "-quality 85 -strip -interlace plane", tiny: "-quality 90 -strip -interlace plane"} this works, mostly, on mobile_lg seems chop occurs after resizing (and guess happens on other...

php - can not print whole record with use of for each loop -

my template file try print fetch records data base problem select query working in front cant print whole records in result print first record mistake can me <table id="example" class="cell-border" cellspacing="0" width="100%" border="1"> <tr> <td>edit</td> <td>particular</td> <td>date</td> <td>rate</td> <td>diff</td> <td>diff amount</td> <td>total</td> <td>k.g.</td> <td>total amount</td> <td>javak date</td> <td>javak fine</td> <td>javak amount</td> <td>aavak date</td> <td>aavak fine</td> <td>aavak amount</td> </tr> {foreach from=$clientdetail item=onerow} <input type="hidden...

javascript - Multiple popups appearing in prod (on Heroku) but not locally -

i had issue once before ( button click causes multiple stripe modals pop up ) reason because had 2 callbacks both triggering same event (open stripe checkout modal). however, here issue different. have 1 callback triggering (the clicking of button), , locally, behaves expected, , 1 modal pops up. however, on heroku, 2 popups appear 1 on other. cleared assets , rebuilt scratch issue persists. here code of page: <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/js/materialize.min.js"></script> <div class="panel panel-default"> <div class="panel panel-header"> <h1 style="text-align: center"> <%= current_user(@conn).name %> </h1> </div> <div class="panel panel-content"> <%= if current_user(@conn) %> <%= if current_user(@conn).instagram_token == nil %> <button onclick="location.href='<%= @url %>&current_user=<%= cur...

javascript - ExtJs taskrunner using Slider -

i trying load chart/grid should change data displayed after time interval .i have used extjs taskrunner, reloads store(project store fetched data using proxy ajax type call) after specific time interval user sets extjs slider . var runner = new ext.util.taskrunner(), task = runner.start({ run: function() { store.reload(); }, interval: function(){ return ext.getcmp('myslider').value(); } }); runner.stop(); } here fiddle : https://fiddle.sencha.com/#fiddle/p49 the interval given slider not setting runner . how give value slider runner , right approach show live data on dashboard, graphs changing whenever data backend changes for setting new runner new timer need destroy old 1 in slider's listener thing this. , listeners:{ changecomplete: function( me, newvalue, thumb, eopts ){ console.log(newvalue) var val = newvalue*1...

Objective-C block to Swift Closure translating Estimote "Examples" app -

i'm translating estimote "examples" ios app objective-c swift , have run problem translating following: @property (nonatomic, copy) void (^completion)(clbeacon *); - (id)initwithscantype:(estscantype)scantype completion:(void (^)(id))completion { self = [super init]; if (self) { self.scantype = scantype; self.completion = [completion copy]; } return self; } demoviewcontroller = [[estbeacontablevc alloc] initwithscantype:estscantypebeacon completion:^(clbeacon *beacon) { estdistancedemovc *distancedemovc = [[estdistancedemovc alloc] initwithbeacon:beacon]; [self.navigationcontroller pushviewcontroller:distancedemovc animated:yes]; }]; how can translated swift? i've tried many solutions other posts , documentation, still haven't gotten right syntax. first, initializers called init ; not have func . , call superclass initializer, super.init() , without ne...

osx - Objective C singleton class members -

this mac os x app. have created singleton class, i'm not sure how add class members (not sure if correct term). getting error property 'chorddictionary' not found on object of type '__strong id' , i'm not sure why. want create nsdictionary can access via class. here's code: #import "chordtype.h" @interface chordtype() @property nsdictionary *chorddictionary; @end @implementation chordtype + (instancetype)sharedchorddata { static id sharedinstance = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ sharedinstance = [[self alloc] init]; sharedinstance.chorddictionary = @{@"" : @"047", @"m" : @"037", @"dim" : @"036", @"aug" : @"048",}; //error on line }); return sharedinstance; } @end declare sharedinstance chordtype * instead of id or call setchorddictionary: method instead of using prop...

c# - WCF Service not returning data -

i have simple wcf project accepts xml string , parses xml build search object. search object used make calls referenced project calls sql stored procedure. results put class , class serialized xml , returned string wcf service. able debug wcf service starting , adding web reference project. in debug mode returns xml 14 records. published wcf service iis site , returns xml no records. search object there since parsed return referenced code has 0 records. sample code below. seems execute performsearch code isn't returning results. any ideas?? <?xml version="1.0"?> <configuration> <appsettings> <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5"/> </system.web> <system.servicemodel> <behaviors> <servicebe...

java - Maven jar dependency issue package not found on OpenShift server -

i'm getting dependency issue jar i'm attempting use. receive following error remote: [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sparq: compilation failure: compilation failure: remote: [error] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/serverquery.java:[3,0] error: package com.github.koraktor.steamcondenser not exist remote: [error] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/serverquery.java:[8,8] error: cannot find symbol remote: [error] class serverquery remote: [error] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/serverquery.java:[8,34] error: cannot find symbol here offending java file. package helpers; import com.github.koraktor.steamcondenser.*; public class serverquery { public static string getplayers() { sourceserver server = new sourceserver("66.150.155.152...

python - How do I get variables from a returned value within a function of a function? -

i put returned player sent message !player1 or !player2 short list can them later, can't seem find out how returned variables functions inside of functions. saw closure think following example can't seem returned values can assign them. def players(sender, event): def getplayer(): msg = event.parsed[0]['msg'] if msg == '!player1': botbasicfunction.sendmsg(msgg='{} has joined game!'.format(hasplayer())) hasplayer() if msg == '!player2': botbasicfunction.sendmsg(msgg='{} has joined game!'.format(hasplayer())) hasplayer() def hasplayer(): invoker = event.parsed[0]['invokername'] return invoker parsedmsg = event.parsed[0]['msg'] players = [getplayer(), getplayer(), getplayer(), getplayer()] if parsedmsg == '!players': botbasicfunction.sendmsg(msgg='{}'.format(players))

R: Isotonic regression Minimisation -

i want minimize following equation: f=sum{u 1:20}sum{w 1:10} quw(ruw-yuw) with following constraints: yuw >= yu,w+1 yuw >= yu-1,w y20,0 >= 100 y0,10 >= 0 i have 20*10 ruw , 20*10 quw matrix, need generate yuw matrix adheres constraints. coding in r , familiar lpsolve , optimx packages, don't know how use them particular question. because quw , ruw both data, constraints objective linear in yuw decision variables. result, linear programming problem can approached lpsolve package. to abstract out bit, let's assume r=20 , c=10 describe dimensions of input matrices. there r*c decision variables , can assign them order y11, y21, ... yr1, y12, y22, ... yr2, ..., y1c, y2c, ..., yrc , reading down columns of matrix of variables. the coefficient of each yuw variable in objective -quw ; note quw*ruw terms in summation constants (aka not affected values select decision variables) , therefore not inputted linear programming solver. interestin...

node.js - Destroying a session in node on a specific event -

basically, app receives request platform hosting saying app uninstalled specific user. in request want log user out destroying req.session , since request not actual user don't have access session. there anyway destroy session?

Create a list from a txt file with all italian words, python -

i downloaded here ( https://sourceforge.net/project/showfiles.php?group_id=128318&package_id=141110 ) dictionary italian words. wanted add them list use randint(0, list.count()) use random italian word string. little program "guess word". used guide: creating list of every word text file without spaces, punctuation see achieve this, received ascii code errors. tried replace odd characters (‡ËÈÏÚ) effective characters (àèèìù) , removed first line of thesaurus.txt file, still same ascii error. thank in advance help, i'm newbie in python. oh, , here's code, can recreate ascii error (you can download .txt file link above). import re random import * file = open('thesaurus.txt', 'r') # .lower() returns version upper case characters replaced lower case characters. text = file.read().lower() file.close() # replaces not lowercase letter, space, or apostrophe space: text = re.sub('[^a-z\ \']+', " ", text) words = list(text.spli...

Android - Set e Get Conversion -

when trying run method "set" in fields 'setrm,setcpf,setpermissao' shows error: "the method setrm(integer) in type usuariovo not applicable arguments (string)" usuariovo vo = new usuariovo(); vo.setrm(txtrm.gettext().tostring()); vo.setcpf(txtcpf.gettext().tostring()); vo.setcargo(txtcargo.gettext().tostring()); vo.setcurso(txtcurso.gettext().tostring()); vo.setsenha(txtsenha.gettext().tostring()); vo.setpermissao(txtpermissao.gettext().tostring()); here code usuariovo: package br.info.vo; public class usuariovo { private integer rm; private integer cpf; private string cargo; private string curso; private string senha; private integer permissao; public integer getrm() { return rm; } public void setrm(integer rm) { this.rm = rm; } public integer getcpf() { return cpf; } public void setcpf(integer cpf) { this.cpf = cpf; } publi...

Excluding a visual studio project from compilation for TeamCity -

i'm using teamcity build server, 1 of projects wix project, don't need teamcity compile it. tried exclude project visual studio configuration manager, , project excluded build in visual studio, teamcity keeps trying build project. anybody knows why happening?

python - Creating a resuable template in Django -

question 1: so i'm working on template email in django. email has table in it, , need put formatting each row of table because email clients require css styles inline. created template implement table row, , i'm calling with each row. row template <tr style="blahblah"> <td>{{ description}}</td> <td>{{ value}}</td> </tr> then i'm able call template {% include 'included_template.html description=some_context_var value=some_other_var %} all right world, until need other context variable go in 1 of table cells. in case, need reformat datetimefield in date format so: {{ create_date| date:"n j, y" }} the above works fine, when do: {% include "included_template.html" description="date:" value=create_date| date:"n j, y" %} i error: django.template.base.templatesyntaxerror: not parse remainder: '|' 'invoice.create_date|' question 2: i hav...

javascript - How loop through an array, add only string's that start with 'a' to a new array? -

below given question. understand how loop through array. not know how check specific character in each string in array , how copy string's new array? question: loop through famous array add people names start 'a' favorites: var favorites = []; var famous = [ 'alex smith', 'amy whinehouse', 'cameron diaz', 'brad pitt', 'ashton kutcher', 'mark whalberg', 'morgan freeman', 'mila kunis']; my answer far: var favoriteletter = 'a'; for(var = 0; < famous.length; i++) { if(famous.indexof(0) === favoriteletter) { favorites.push(famous[i]); } }; change if(famous.indexof(0) === favoriteletter) to if(famous[i].charat(0) === favoriteletter)

unix - Can CVS repository commit command pass command line arguments to the files? -

is there way pass command line arguments files present in cvs repository. say, cvs repository has .tcl file prints version number , date along other processing. don't want hardcode version number , date file. whenever modifies file , checks cvs, can add tag version number , date modify tcl file accordingly? say have test.tcl puts "version number: **v1.2** puts "date: 05/05/10" .... ..... if modify file , want commit cvs, saying "cvs commit test.tcl v1.3 06/19/15" or that the test.tcl should committed in cvs , should be: puts "version number: **v1.3** puts "date: 06/19/15" ...... ...... is there way done? first hint: keyword substituion if want version numbers or commit time - cvs has enraged linus torvalds started design git : can change files on commit. see example $id$ , others @ this mit doc page . second hint: see running arbitrary scripts under cvs , title says all.

c# - Simple Injector decoration with additional dependency -

i have decorator somethingloggerdecorator supposed decorate isomething instances logging: public class somethingloggerdecorator : isomething { private readonly isomething decoratee; private readonly ilogger logger; public somethingloggerdecorator(isomething decoratee, ilogger logger) { this.decoratee = decoratee; this.logger = logger; } public void dosomething() { this.logger.info("doing something"); this.decoratee.dosomething(); } public void dosomethingelse(string withthis) { this.logger.info("doing else " + withthis); this.decoratee.dosomethingelse(withthis); } } how can use simple injector decorate instances of isomething somethingloggerdecorator , inject instance of ilogger into each of decorators using static factory method logmanager.getlogger(decoratee.gettype()) decoratee actual instance decorated? lifetime of injected ilogger somethingloggerdecorato...

Yeoman angular-fullstack ckeditor production -

i'm using yeoman's angular-fullstack generator default parameters. i use ckeditor https://github.com/lemonde/angular-ckeditor , extended bower.json following lines: "ckeditor": "#full/4.4.7", "angular-ckeditor": "~0.4.2" it works in development mode ( grunt serve ), fails in production ( grunt serve:dist ). tries load /config.js , /skins/moono/editor_gecko.css , language file dynamically, fails. have idea how solve it? had similar issue ace editor. did added override in bower.json for ace looks this "overrides": { "ace-builds": { "main": [ "src-noconflict/ace.js", "src-noconflict/theme-monokai.js", "src-noconflict/worker-javascript.js", "src-noconflict/mode-javascript.js" ] }, for ckeditor config can specify in similar way in overrides i.e. "overrides": { "ckedit...

unit testing - Distinguish design and implementation detail when doing TDD -

i have been doing unit tests while. little confused boundary between design , implementation details when doing tdd. for example, have 2 interfaces, service , adapter, process employee information (add, get, delete ...) public interface iemployeeservice { employee getemployeebyid(int id) } public interface iemployeeadapter { private iemployeeservice _service employee getemployeebyid(int id) } by design, service reads data storage such database, file system or web service, adapter uses service information. this design looks fine until start writing unit test adapters. the problem need know whether adapter.getemployeebyid(id) call service.getemployeebyid(id) (or other methods) determine whether need mock services in test method. makes feel kind of considering implementation detail when writing unit test. there wrong? unit tests white-box tests, aware of goes on inside system under test. there's nothing wrong using information determine mock. yes,...

java - JTable cell losing value when it's clicked to open a JComboBox -

got current project going on , need set cells column in jtable jcomboboxes. items same rows , extracted sql server table. when program runs, fills whole jtable values sql server table. ok @ point when user clicks column show jcombobox , items show up, the value on cell overwritten jcombobox . wanted happen opening jcombobox values , "suggesting" user last value in cell (the 1 disappeared), dropping down , selecting said value. is there way doing easily? this how i'm adding items jcomboboxes tablecolumn col_cod_tipo_verba = jtab_verba.getcolumnmodel().getcolumn(3); jcombobox box_tab_tipo_verba = new jcombobox(); resultset rs = glob.conecta_sql().preparestatement("select * tab_tipo_verba").executequery(); while (rs.next()) { box_tab_tipo_verba.additem(rs.getstring(1)); } col_cod_tipo_verba.setcelleditor(new defaultcelleditor(box_tab_tipo_verba)); you can override method component gettable...

c# asp.net call async method from static sync -

i call static method named - validsendpass ajax [webmethod] public static string validsendpass(string em) in method need create email class , call method send async email classes.email ems = new classes.email(); ems.sendpassword(myemail, email name, user email, user name, password, "your password", pas); this method: var fromaddress = new mailaddress(fromem, fromname); var toaddress = new mailaddress(toem, toname); var smtp = new smtpclient { host = "smtp.gmail.com", port = 587, enablessl = true, deliverymethod = smtpdeliverymethod.network, usedefaultcredentials = false, credentials = new networkcredential(fromaddress.address, frompassword), timeout = 20000 }; using (var message = new mailmessage(fromaddress, toaddress) { subject = subject, body = body }) { try { smtp.send(message); } catch { } } for replace smtp.send smtp.sendmailasync or smtp sendasync, add async. how need change code - call async met...

ios - How to dismiss a popover only with a button in swift -

my ipad app has several data gathering popovers, , want able disable dismissal of popover touching outside of it, use button quit popover @ users discretion. the app looks great, popovers work fine, , have button inside them quits nicely. can't find way of disabling dismissal in swift, lots of posts on obj-c nothing in swift. does mean functionality no longer available? i appreciate frustration. simply set view controller's modalinpopover true , popover's passthroughviews nil . must latter using delayed performance or won't work. small delay that's needed. example: let vc = uiviewcontroller() vc.modalpresentationstyle = .popover self.presentviewcontroller(vc, animated: true, completion: nil) if let pop = vc.popoverpresentationcontroller { vc.modalinpopover = true delay(0.1) { pop.passthroughviews = nil } } for delay function, see dispatch_after - gcd in swift? .

group concat - Mysql working with comma separated list - Junction table -

i have junction table productid , accessory column: table1 productid accessory 1 2 1 3 2 1 2 4 2 5 3 4 1 5 2 it means productid 2, has accessory productids 1,4 , 5 ... and have table 2 below grp , productid provided, need fetch accesories. table2 grp productid accessories 2 b 3 c 1 d 4 e 5 so if using update this table2 update table2 t2 set t2.accessories = (select group_concat(distinct t1.accessory) table1 t1 t1.productid = t2.productid) grp productid accessories 2 1,4,5 b 3 c 1 2,3 d 4 1 e 5 2 but want change productids in t2.accessories grp character instead according t2.productid final table looks . table2 grp productid accessories 2 ...

Typeahead for rails with remote data -

currently typeahead works on local machine thise $(document).ready(function(d){ var companies = new bloodhound({ datumtokenizer: bloodhound.tokenizers.obj.whitespace('value'), querytokenizer: bloodhound.tokenizers.whitespace, remote: { //url: '/javascripts/company_list.json', url: 'http://localhost:3000/?utf8=%e2%9c%93&search=%query' } }); i wondering if did url part correctly? works that, feel hardcoded , wanted know best way handle if move heroku. thanks! var departaments = new bloodhound({ datumtokenizer: function(d) { return bloodhound.tokenizers.whitespace(d.value); },querytokenizer: bloodhound.tokenizers.whitespace, limit: 6, remote: '/departaments?value=%query' }); with works me, in case maybe is remote: '/?value=%query'

javascript - date time issue moment -

sometimes timestamp more 10 digits. using moment js function is: moment.unix(timestamp).format('yyyy-mm-dd hh:mm') when 10 digits long giving me perfect answer. when more 10 digits. don't know why giving wrong year. sample: correct: 1433167001 gives me 2015-06-01 13:56 incorrect: 1433287744646 gives me date: 47389-01-29 12:37 i tried /1000 not working code - var timestamp ='' - if (typeof(res[j]['timestamp']) !== 'undefined'){ - timestamp = math.floor(res[j]['timestamp']); - if (timestamp.length > 10) { - timestamp = math.floor(timestamp/1000) - } -} tr td #{index++} td #{results[i]['userinfo']['us...

Read input into string in Lisp reader macro -

i trying make reader macro convert @this "this". have: (defun string-reader (stream char) (declare (ignore char)) (format nil "\"~a\"" (read-line stream t nil t)) ) (set-macro-character #\@ #'string-reader ) the problem requires put newline after ever @this. i've tried (read), returns variable test, has not been set. can't hard-code number of characters after @ symbol, because don't know how many there be. there way fix this? edit: way loop on read-char , peek-char, reading until #),#\space, or #\newline? you can try use read , @ returns: (defun string-reader (stream char) (declare (ignore char)) (let ((this (let ((*readtable* (copy-readtable))) (setf (readtable-case *readtable*) :preserve) (read stream t nil t)))) (etypecase (string this) (symbol (symbol-name this))))) (set-macro-character #\@ #'string-reader) above allow @this , @"t...

jmap - Convert from non-binary to binary format for java memory dump -

using tool jmap, can create memory dump in 2 formats: binary format: jmap -dump:format=b,file=binary_dump.dat <pid> or other format: jmap -dump:file=other_format_dump.dat <pid> i've read number of places binary format readable tools jhat , jvisualvm. so: are there tools can read other format? are there tools can convert other format binary format? i have memory dump file created using other format , need able examine it, preferably eclipse memory analyzer tool .

ios - PFQuery on Array for item starts with String -

i have array of search keywords field in custom object , wanna make search when user enter 2 or 3 characters of of array items example ["cafe" , "food" , "eat"] ["car" , "gas"] if user entered caf should return object contains search keyword [query wherekey:@"keywords" greaterthan:keyword]; returns not relevant data returns 2 rows of car , cafe ! i tried equalto [query wherekey:@"keywords" equalto:keyword]; but row should enter whole word any ideas should query on?

c# - Why would I get a format exception when updating a boolean binding with WriteValue? -

i have bunch of checkboxes on form checked properties bound boolean properties on data model: chk1.databindings.add(new bindingvalue(this, "checked", "mybooleanproperty1", false)) chk2.databindings.add(new bindingvalue(this, "checked", "mybooleanproperty2", false)) chk3.databindings.add(new bindingvalue(this, "checked", "mybooleanproperty3", false)) there shared event handler checkboxes on screen ensures databound value correctly set checked value. private void allcheckboxes_checkedchanged(object sender, eventargs e) { var chk = ((checkbox)sender); var binding = chk.databindings["checked"]; if (binding != null) binding.writevalue(); } in cases, first time form , bindings loaded, exception : cannot format value desired type. at system.componentmodel.reflectpropertydescriptor.setvalue(object component, object value) @ system.windows.forms.bindtoobject.setvalue(object value)...

How to mark designated initializers of super class "invalid" in Objective-C? -

from adapting modern objective-c document : if class provides 1 or more designated initializers, must implement of designated initializers of superclass. that means if have subclass of nsobject has own designated initializer, - (instancetype)initwithimage:(uiimage*)image ns_designated_initalizer; then need provide implementation of nsobjects -init . should mark -init initializer "invalid", i.e., nobody should call use -initwithimage: instead? what's best practice here? edit i tried techniques described here . however, when mark superclass -init method unavailable in interface, compiler still tells me need overwrite initializer of superclass. when try other techniques, i.e., raising exception or calling -doesnotrecognizeselector: inside of -init , error stating need call 1 of designated initializers.

parsing - passing value down the pipe in Scala parser combinator -

i have following rules (many others obmitted clarity): def bindrg: parser[cmd] = "bind-roaming-group" ~> name ~ bindrgbody(????) <~ exit ^^ { case name~body => new bindroaminggroupcmd(name, body)} def bindrgbody(name: string) = // ... def name: parser[string] = """\s+""".r i want pass string value of "name" bindrgbody(????) not sure put in '????' you use flatmap on parser "bind-roaming-group" ~> name : def bindrg: parser[cmd] = ("bind-roaming-group" ~> name) flatmap (n => bindrgbody(n) <~ exit ^^ (b => new bindroaminggroupcmd(n, b))) or def bindrg: parser[cmd] = ("bind-roaming-group" ~> name) >> (n => bindrgbody(n) <~ exit ^^ (new bindroaminggroupcmd(n, _))) if want shorten bit.

c# - ListView Does Not save the edited record -

i using asp.net 4.5 listview using data entity populate control when edit record using c# code below not save changes. code compiles without errors , if step through code pulls record editing not save changes. here code: public void listview1_updateitem(int linkanalysisid) { linkanalysis.linkanalysi item = null; using (laentities db = new laentities()) { // load item here, e.g. item = mydatalayer.find(id); item = db.linkanalysis.singleordefault(uu => uu.linkanalysisid == linkanalysisid); if (item == null) { // item wasn't found modelstate.addmodelerror("", string.format("item id {0} not found", linkanalysisid)); return; } tryupdatemodel(item); if (modelstate.isvalid) { // save changes here, e.g. mydatalayer.savechanges(); db.savechanges(); } } } any appreciated. aft...

android - How to get items from a string-array using an ID-based mechanism? -

the problem simple. i've implemented navigation drawer in android. now, have menu, each item item of string-array in strings.xml . fragment created every time user clicks on 1 of menu items. within fragment class i'd switch among items in order populate main content appropriate information. way know check position of item, happens if, in future, i'll add further item? need change position values in code. so, wonder if there way assign sort of id each element. i've read here define separate string each of them, how can check values? tried in following way, gives me constant expression required error: resources resources = getresources(); switch(item_string) { case resources.getstring(r.string.item1): //todo case resources.getstring(r.string.item2): //todo ... as suggested selvin, i've created json file in assets/ in each element of json array corresponds menu item including 3 fields (id, name ,...

swift - Using a Metal shader in SceneKit -

i'd use metal shader apply toon/cell shading materials used in scene. shader i'm trying implement apple's own aaplcelshader found in metalshadershowcase . i'm little new implementing shaders in scenekit doing wrong. from understand in documentation metal or gl shader can used modify scenekit rendering of ios 9 , xcode 7. documentation suggests done in same way gl shaders. my method try , path .metal file , load string used in scnmaterial shadermodifiers property in form of [string: string] dictionary, gl shader (though i've yet working properly). my code is: var shaders = [string: string]() let path = nsbundle.mainbundle().pathforresource("aaplcelshader", oftype: "metal")! do{ let celshader = try string(contentsoffile: path, encoding: nsutf8stringencoding) shaders[scnshadermodifierentrypointlightingmodel] = celshader }catch let error nserror{ error.description } scene.rootnode.enumeratechildnodesusingblock({ (node, stop...

php - Regex Lookarounds, prevent ahead and behind -

i have regex cannot working right. using pcre(php) run it. the regex looks inch measurements written fractions using forward slash separate numerator , denominator. ex 1 3/8in or 19 15/16" it match 12 1/2" here: a product description 12 1/2" in it. but want not match if measurement part of dimension, ie has x before or after , matches format: 19 3/4" x 19 5/8" example text matching incorrectly: product description 19 3/4" x 19 5/8" in it. this matches 5/8" when supposed ignore of because of x in there. my regex knocks off measure left of x, ignores whole number on right side. lookbehind capture 5/8" example above. need ignore both sides of dimension , match measurements themselves. using negative ahead , behind match x. regex: /\s+(?<!x\s)\d*\s?\d+\/\d+"*\s*(in|")(?!\d*\s?x)\s*/i i ran through regex101.com's debugger , still can't figure out. reading. with pcre/php use (*skip)(*fail) ...

sql - Comparing rows in a table against latest (by date) row in another and inserting or updating based on condition -

i have 1 table (approx 800k rows), ' a ' sake of post has id , statusid. table ' b ', stores duration (fromdate , todate) of row in a maintaining single status - updated once day. a: id, statusid, b: idfroma, fromdate, todate, statusid for instance if have row: (id: 123, statusid: 1) holds onto statusid 2 days , on 3rd day changes (id: 123, statusid: 2) table b used record change. i need write query i'm not sure how compare current statusid of each row in a of latest row same id in b - , depending on either insert new row or extend todate (by in case day) - pointers help you can use trigger on tablea keep tableb in sync. if object_id('tablea') not null drop table tablea create table tablea ( id int, statusid int ) if object_id('tableb') not null drop table tableb create table tableb ( id int, fromdate datetime, todate datetime, statusid int ) go create trigger tg_tablea_statudid on tablea aft...

CMake User String Input -

i attempting use cmake convert generic wrapper specific one, via token replacement. hope user have input specific set of strings, have cmake configure_file, , wrapper read in values , work intended. i aware of possibility use set set token needs replaced: set(fav_food "sushi" cache string "what favorite food?") as option have user select set of answers so: set(my_selection "option a" cache string "help message variable") set_property( cache my_selection property strings "option a" "option b" "option c" ) the problem can't enumerate valid answers. there way cmake have gui pop , allow user answer string? have user fill out these values in file before calling make, i'd avoid users doing hand in files, , want take advance of cmake cache , avoid assuming user has filled out variables in file. any advice helpful. thanks. your first example standard way provide user-specified opt...

send binary files from php to mysql using mysqli -

i want send data 2 tables php script,the pic , idcard 2 binary files in mysql db , both of them have longblob type first insert query executed successfully(insert user table) second query(insert `applicant' table) have 2 situations: 1-if make pic , idcard field nullable in db,other data except these 2 inserted successfully. 2-if make pic , idcard field not nullable nothing insert `applicant' table. and both of 2 situation cant save binary data database,where problem? and have no problem in $_files array , passing them,i can see details of these fileds when post php script. think wrong send_long_data use before now! here script: require_once('db_connection_config.php'); if (mysqli_connect_errno()) { print_r("<div class='bs-example center-block'><div id='alertshow' class='bs-example center-block alert alert-danger'><a href='#' class='close' data-dismiss='alert'>&times...

android - How to start activity from background service -

i have voip application after it's being swept away recent apps should show activity when receive call. there background service should create activity, after swiping app away that's not possible. so, how start activity background service in case? first of all, need ui thread handler. in activity class: private final handler h = new handler(); then, pass handler background service, , next: handler.post(new runnable() { public void run() { //startactivity } }); read handler here handler, such message queue of thread. post message queue, , processed possible

Why is test case failing in Django when it returns True in Python intrepreter? -

when run code in python interpreter, returns true: >>> movies.models import movie >>> movie_list = movie.objects.all() >>> bool(movie_list) true when run test case, python3 manage.py test movies , fails: from django.test import testcase .models import movie class questionmethodtests(testcase): def test_movie_list_empty(self): movie_list = movie.objects.all() self.assertequal(bool(movie_list), true) what missing? shouldn't test pass? i see. mean test cases test code can't use of actual database content in tests? by default no, , don't want mess actual db anyway, there usual way provide initial objects tests (the actual source can differ, e.g. loading file) from django.test import testcase .models import movie class questionmethodtests(testcase): def setup(self): # can create movie objects here movie.objects.create(title='forest gump', ...) def test_movie_list_em...