Friday 15 February 2013

algorithm - Modifying A* to find a path to closest of multiple goals on a rectangular grid -



algorithm - Modifying A* to find a path to closest of multiple goals on a rectangular grid -

the problem: finding path closest of multiple goals on rectangular grid obstacles. moving up/down/left/right allowed (no diagonals). did see this question , answers, and this, and that, among others. didn't see utilize or suggest particular approach. have major error in approach?

my of import constraint here is inexpensive me represent path (or list, matter) "stack", or "singly-linked-list", if want. is, constant time access top element, o(n) reversing.

the obvious (to me) solution search path of goals starting point, using manhattan distance heuristic. first path goal starting point shortest path closest goal (one of many, possibly), , don't need reverse path before next (it in "correct" order, starting point on top , goal @ end).

in pseudo-code:

a*(start, goals) : init_priority_queue(start, goals, p_queue) homecoming path(start, p_queue) init_priority_queue(start, goals, q_queue) : (g in goals) : h = manhattan_distance(start, g) insert(h, g, q_queue) path(start, p_queue) : h, path = extract_min(q_queue) if (top(path) == start) : homecoming path else : expand(start, path, q_queue) homecoming path(start, q_queue) expand(start, path, q_queue) : = top(path) (n in next(this)) : h = mahnattan_distance(start, n) new_path = push(n, path) insert(h, new_path, p_queue)

to me seems natural reverse search in way. there think-o in here?

and question: assuming priority queue stable on elements same priority (if 2 elements have same priority, 1 inserted later come out earlier). have left next above undefined on purpose: randomizing order in possible next tiles on rectangular grid returned seems inexpensive way of finding unpredictable, rather zig-zaggy path through rectangular area free of obstacles, instead of going along 2 of edges (a zig-zag path statistically more probable). correct?

it's right , efficient in big o far can see (n log n long heuristic admissible , consistent, n = number of cells of grid, assuming utilize priority queue operations work in log n). zig-zag work.

p.s. these sort of problem there more efficient "priority queue" works in o(1). these sort of problem mean case effective distance between every pair of nodes little constant (3 in problem).

edit: requested in comment, here details constant time "priority queue" problem.

first, transform graph next graph: allow potential of nodes in graph (i.e., cell in grid) manhattan distance node goal (i.e., heuristic). phone call potential of node p(i). previously, there border between adjacent cells , weight 1. in modified graph, weight w(i, j) changed w(i, j) - p(i) + p(j). same graph in proof why a* optimal , terminates in polynomial time in case heuristic admissible , consistent. note manhattan distance heuristic problem both admissible , consistent.

the first key observation a* in original graph same dijkstra in modified graph. since "value" of node in modified graph distance origin node plus p(i). sec key observation weight of every border in our transformed graph either 0 or 2. thus, can simulate a* using "deque" (or bidirectional linked list) instead of ordinary queue: whenever encounter border weight 0, force front end of queue, , whenever encounter border weight 2, force end of queue.

thus, algorithm simulates a* , works in linear time in worst case.

algorithm search linked-list a-star

DB2 SQL z/OS - variable equivalent of a hex constant -



DB2 SQL z/OS - variable equivalent of a hex constant -

i'm trying extract info (using spufi) db2 table file, 1 of output fields converting decimal field same format cobol comp field. e.g. today's date (20141007) ..ëõ

the sql hex function converts 20141007 013353cf, , doing select of x'013353cf' gives me desired result, that's constant, i'm trying find equivalent function. inverse of hex function.

i've come across couple of suggestions using user defined functions. problem is, we've upgraded db2 10 , new function mode isn't enabled yet, means don't have access command functions in udf.

i suspect i'm out of luck, wondering if has suggestions. appreciate wrong tool job, , easier write cobol programme it, various constraints preventing that. i'm limited sql functions , perchance jcl).

i thought had solution using recursive udf around lack of command functions, that's not allowed either.

sql db2 hex zos

google maps - a custom marker for each type of place -



google maps - a custom marker for each type of place -

i want create map shows hotspots.

a bit illustration does: google maps example

for illustration i'm going on holiday , want know nearest supermarket, nightclubs , bars. want type in location , shows me these spots custom marker.

i can figure of out myself can't seem multiple custom markers in there.

the results returned placessearch contain multiple properties each result, 1 of them icon-property contains url of icon, e.g.:http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png

google-maps google-maps-api-3 google-places-api

ios8 - Location services not updating in background -



ios8 - Location services not updating in background -

for ios 8 have added next key plist:

nslocationalwaysusagedescription

i added:

// check ios 8 if ([_locationmanager respondstoselector:@selector(requestalwaysauthorization)]) { [_locationmanager requestalwaysauthorization]; }

i deleted app phone. upon launch prompted if ok run location services in background expected. click yes. while app running locations , location active icon in status bar.

however if leave app location active icon disappears status bar , no longer locations.

do need re setup location manager when app enters background? location manager property/variable need defined in appdelegate such never goes away?

you have set location updates in background modes of capabilities.

ios8 core-location

java ee - Avoiding timeout on container-managed EntityManager -



java ee - Avoiding timeout on container-managed EntityManager -

i have j2ee application beans have container-managed entitymanager's. in long running method calls, trying merge info throws

rollbackexception (timed out)

i have tried using entitymanagerfactory doesn't seem allowed:

cannot utilize entitytransaction while using jta

how can run arbitrarily long processes without setting unreasonable timeout? can't jta create new transaction when needed?

following comments question, question , documentation here, solved problem using container-managed entitymanager , transactionattributetype annotations.

the bean method caused timeout multiple calls different method handles subtask, such each method phone call executes within different transaction. utilize not_supported attribute type since:

if client not associated transaction, container not start new transaction before running method.

with arrangement, smaller processdoc method creates transactions shouldn't timeout.

public class mybean { @ejb private docsbean docsbean; /** * method transaction risks timeout * no transaction created not_supported */ @transactionattribute(transactionattributetype.not_supported) public void longrunning(list<document> docs) { (document doc : docs) { // different transaction used each element docsbean.processdoc(doc); } } } public class docsbean { /** runs within new transaction */ @transactionattribute(transactionattributetype.requires_new) public void processdoc(document document) { // takes time under timeout // ... } }

.

java-ee jpa ejb jta oc4j

IOS Parse - Pointer -



IOS Parse - Pointer -

i have class called subcategory column named category pointer. trying phone call , store pointer specific row. nil beingness stored self.categoryname.text? looking.

here code:

pfquery *query = [pfquery querywithclassname:@"subcategory"]; [query wherekey:@"user" equalto:[pfuser currentuser]]; [query wherekey:@"name" equalto:@"food"]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { (pfobject *object in objects) { self.subcategoryname.text = object[@"name"]; self.categoryname.text = object[@"category"]; } }];

use query this

[query wherekey:@"user" equalto:[pfuser currentuser]]; [query includekey:@"food"];

ios

How to delete the empty TAGS while publishing XML in Informatica Target -



How to delete the empty TAGS while publishing XML in Informatica Target -

i publishing xml informatica target , getting empty tags in published file. have treid below mentioned settings still empty tags coming. xml null content representation-> no tag xml empty string content representation->no tag xml null attribute representation->no attribute xml empty string attribute representation->no attribute , below mentioned custom properties writenullxmlfile=no;suppressnilcontentmethod=bytree;

i came across in kb. please check if applicable in case.

when attribute of element in mapping projected , not element itself, when null passed attribute, attribute suppressed. however, empty element tag still created in target xml filebecause, null content representation=no tag in effect when element projected.

solution

to suppress empty element tags, project these elements in mapping , pass null value

xml informatica informatica-powercenter

ios - Auto Layout in camera overlay view - can't center button vertically -



ios - Auto Layout in camera overlay view - can't center button vertically -

i trying add together overlay camera. that, i've created next event method:

- (ibaction)takephoto:(id)sender { uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init]; if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]){ [imagepicker setsourcetype:uiimagepickercontrollersourcetypecamera]; imagepicker.showscameracontrols = no; imagepicker.navigationbarhidden = yes; imagepicker.toolbarhidden = yes; imagepicker.wantsfullscreenlayout = yes; // overlay // insert overlay self.overlay = [[overlayviewcontroller alloc] initwithnibname:@"overlayview" bundle:nil]; //[self.overlay.view settranslatesautoresizingmaskintoconstraints:no]; self.overlay.pickerreference = imagepicker; imagepicker.cameraoverlayview = self.overlay.view; imagepicker.delegate = self.overlay; [self presentviewcontroller:imagepicker animated:no completion:nil]; } else{ [imagepicker setsourcetype:uiimagepickercontrollersourcetypephotolibrary]; [imagepicker setdelegate:self]; [self presentviewcontroller:imagepicker animated:yes completion:nil]; } }

the button centered in view this.

but when used, appears on iphone 4. not centered vertically. if seek pin button slikaj on bottom, not visible because iphone 4 screen size smaller iphone 5. utilize auto layout checkbox checked (turned on). doing wrong?

your overlay view has reason frame dimensions. can prepare assigning imagepicker frame dimensions overlay view.

self.overlay = [[overlayviewcontroller alloc] initwithnibname:@"overlayview" bundle:nil]; self.overlay.pickerreference = imagepicker; self.overlay.frame = imagepicker.cameraoverlayview.frame; imagepicker.cameraoverlayview = self.overlay.view; imagepicker.delegate = self.overlay;

ios autolayout

redirect - Exclude certain people (ip's) from viewing 'website under construction' page -



redirect - Exclude certain people (ip's) from viewing 'website under construction' page -

i'm working on site, i'd place 'website under construction' page tries view it. thing is, want selected grouping of people view real, actual, undeveloped page when type regarding website in adress bar. rest automatically redirected 'under construction' page.(is there name phenomenom?)

question summarized: possible auto-redirect people 'under contruction' page, exclude ip's beingness redirected? have knowledge of html, css, php, , little bit of js.

thanks.

this solution me, satisfied with. doesn't meet requirements of people same problem.

i created .htaccess file in root directory. here denied ip's one's should have access it. created (temporary) custom 403(forbidden) errordocument a 'website under construction' page, long website isn't launched. i'll set default page when site's ready.

my .htaccess file follows:

errordocument 403 /forbidden.php order deny,allow deny allow 123.123.123.123

because doesn't reply specific question, didn't mark best answer.

redirect ip-address webpage

vb.net - Is it possible to add a T-SQL function/query to an adapter whos table is build in the datasetdesigner -



vb.net - Is it possible to add a T-SQL function/query to an adapter whos table is build in the datasetdesigner -

i want add together t-sql query existing datatable adapter datasetdesigner.xsd . possible in designer? if not, can utilize existing adapter designer when hardcode query?

cheers steven

@tim did already. right clicked , added sql query : here query

declare @start integer declare @currentkey varchar(20) set @rowcount = (select max(id) z_skm) set @start =1 while @start <= @rowcount begin set @currentkey= (select branche_firma_key z_skm id = @start ) if(@currentkey = null or @currentkey ='') begin end else begin update [sysdba].[z_skm] set branche_firma_val = (select text zdefproperty bring together zsysproperty on zdefproperty.zdefpropertyid=zsysproperty.zdefpropertyid @currentkey= zsysproperty.syspropertyid , valuetype ='branch' , text not '% eh' , text not '% gh' , text not '% alt' ) id = @start end set @start = @start + 1 end

it works in mssql - servermanager doesnt work in visual studio rightclicking adapter, add together query , insert it.. there syntax use? or need hardcode it?

cheers steven

i made function work saving procedure in sql server. after able phone call procedure in visual studio dataset designer rightclik on adapter , click "add query" -> "saved procedure"

vb.net tsql visual-studio-2013

osx - Alias setup -bash: vm: command not found -



osx - Alias setup -bash: vm: command not found -

in build larabook scratch laracast tutorial, required synchronize local folder of app virtual machine (homestead) , vice versa.

to simplify development, tutorial recommends create next alias:

ssh vagrant@127.0.0.1 -p 2222

by placing alias vm="ssh vagrant@127.0.0.1 -p 2222" in ~/.aliases file, did.

this lets narrator type vm command local app folder launch virtual machine.

when seek so, -bash: vm: command not found

did miss something?

osx bash laravel ssh terminal

regex - JavaScript regexp parsing an array of URLs -



regex - JavaScript regexp parsing an array of URLs -

string

url(image1.png), url('image2.png'), url("image3.png")

note ' , " delimiters. nice handle them well, i'm happy if first form captured.

result

var results = 'image1.png', 'image2.png', 'image3.png';

how?

i utilize regular expressions in javascript parse string used css property of element multiple backgrounds. aim url of images set in background of element using css.

see more: http://www.css3.info/preview/multiple-backgrounds/

jsfiddle

http://jsfiddle.net/fcx9x59r/1/

/url\(([^"']+?)\)|'([^'"]+?)'\)|"([^'"]+?)"\)/g

try this.grab captures.see demo.

http://regex101.com/r/qq3kg7/1

javascript regex

javascript - Keep zooming (or zooming out) when mouse key is pressed -



javascript - Keep zooming (or zooming out) when mouse key is pressed -

i'm working on project need kind of screen calibration.

this calibration works in way when plus button pressed "credit card" zoomed in , when minus button pressed zoomed out 0.5mm.

everything works fine when button clicked "credit card" zoomed in or zoomed out 0.5mm, need maintain clicking alter zoom further. want zoom constant when mouse key pressed , stop zooming when released.

there javascript code:

var c = document.queryselector('.card'), m = document.queryselector('.m'), p = document.queryselector('.p'), s = document.queryselector('.s'), r = document.queryselector('.r'), w = c.style.width = '54mm'; m.addeventlistener('click', function() { w = c.style.width = parsefloat(w) - 0.5 + 'mm'; }); p.addeventlistener('click', function() { w = c.style.width = parsefloat(w) + 0.5 + 'mm'; }); s.addeventlistener('click', function() { r.innerhtml = 54 / parsefloat(w); });

you can @ jsfiddle see code i'm using now. can help me integration of function in existing code?

you need setup event listeners little bit different. solution - belive it's quite clear:

var c = document.queryselector('.card'), m = document.queryselector('.m'), p = document.queryselector('.p'), s = document.queryselector('.s'), r = document.queryselector('.r'), w = c.style.width = '54mm'; var min = false; var max = false; m.addeventlistener('mousedown', function(event) { min = true; }); m.addeventlistener('mouseup', function(event) { min = false; }); p.addeventlistener('mousedown', function() { max = true; }); p.addeventlistener('mouseup', function() { max = false; }); s.addeventlistener('click', function() { r.innerhtml = 54 / parsefloat(w); }); setinterval(function() { if(min) { w = c.style.width = parsefloat(w) - 0.5 + 'mm'; } }, 100); setinterval(function() { if(max) { w = c.style.width = parsefloat(w) + 0.5 + 'mm'; } },100);

javascript jquery

c# - How do I add a reference to an external configuration file to Visual Studio 2010? -



c# - How do I add a reference to an external configuration file to Visual Studio 2010? -

i have external configuration file, 3rd party tool, able edit part of editing other project components in vs2010.

the project i'm working on mvc-3 project, , file located outside of folder construction project (it's in equivalent of ../externalconfig root).

how add together reference file vs2010? currently, attempts have resulted in vs creating re-create of file within of directory structure, not ideal.

(sure, go unusual lengths, adding script build process set config file in right place, i'd rather able edit sits)

the trick add together item link:

right-click project in solution explorer select "add" -> "existing item..." navigate file want add together solution [important] instead of hitting come in or clicking add together button, want click down-arrow icon @ right border of add together button, , select "add link".

c# visual-studio-2010

importing and running generated pyqt gui in python is not working -



importing and running generated pyqt gui in python is not working -

i'm new python , pyqt well. i'm using canopy python editor.

i have designed simple gui using qt designer (version 5) including 2 buttons , graphicsview. converted using pyuic python file called themaingui followings:

from pyqt4 import qtcore, qtgui try: _fromutf8 = qtcore.qstring.fromutf8 except attributeerror: def _fromutf8(s): homecoming s try: _encoding = qtgui.qapplication.unicodeutf8 def _translate(context, text, disambig): homecoming qtgui.qapplication.translate(context, text, disambig, _encoding) except attributeerror: def _translate(context, text, disambig): homecoming qtgui.qapplication.translate(context, text, disambig) class ui_mainwindow(object): def setupui(self, mainwindow): mainwindow.setobjectname(_fromutf8("mainwindow")) mainwindow.resize(467, 268) self.centralwidget = qtgui.qwidget(mainwindow) self.centralwidget.setobjectname(_fromutf8("centralwidget")) self.fetchbutton = qtgui.qpushbutton(self.centralwidget) self.fetchbutton.setgeometry(qtcore.qrect(30, 40, 111, 31)) self.fetchbutton.setobjectname(_fromutf8("fetchbutton")) self.plotbutton = qtgui.qpushbutton(self.centralwidget) self.plotbutton.setgeometry(qtcore.qrect(30, 120, 111, 31)) self.plotbutton.setobjectname(_fromutf8("plotbutton")) self.graphicsview = qtgui.qgraphicsview(self.centralwidget) self.graphicsview.setgeometry(qtcore.qrect(190, 10, 256, 192)) self.graphicsview.setobjectname(_fromutf8("graphicsview")) mainwindow.setcentralwidget(self.centralwidget) self.menubar = qtgui.qmenubar(mainwindow) self.menubar.setgeometry(qtcore.qrect(0, 0, 467, 21)) self.menubar.setobjectname(_fromutf8("menubar")) mainwindow.setmenubar(self.menubar) self.statusbar = qtgui.qstatusbar(mainwindow) self.statusbar.setobjectname(_fromutf8("statusbar")) mainwindow.setstatusbar(self.statusbar) self.retranslateui(mainwindow) qtcore.qmetaobject.connectslotsbyname(mainwindow) def retranslateui(self, mainwindow): mainwindow.setwindowtitle(_translate("mainwindow", "mainwindow", none)) self.fetchbutton.settext(_translate("mainwindow", "fetch user data", none)) self.plotbutton.settext(_translate("mainwindow", "plot user track", none))

i want import gui code python file add together functionality gui. don't want edit same gui python file since might need alter while implementing , erase code.

therefore, created python file including next code:

import sys pyqt4 import qtgui themaingui import ui_mainwindow class main(qtgui.qmainwindow,ui_mainwindow): def __int__(self): qtgui.qmainwindow.__init__(self) self.ui= ui_mainwindow() self.ui.setupui(self) if __name__ == "__main__": app = qtgui.qapplication(sys.argv) window = main() window.show() sys.exit(app.exec_())

this code working tutorials found online. but, when run it, shows empty window without title.

i spent much time trying figure out what's wrong code without progress. help much appreciated.

python pyqt enthought qt-designer canopy

pointers - How to make make a variable undetermined type in c++? -



pointers - How to make make a variable undetermined type in c++? -

for illustration have node contains

node * next; [x] data;

how fill in [x] can create 'data' either types a, b, c, d, determine later on. tried making void, lead errors. using have linked list holding 1 variable, of types b c d.

you can either utilize templates, or void pointers (and should never utilize void pointers in c++ when templates trick).

template <typename t> struct node { node * next; t data; };

now node<int> , node<float> different types. can utilize any type argument, long type can default-constructed. if want restrict t 1 of set of types reply bit more involved, there no reason this.

if, on other hand, want single linked list able hold many different types t has able represent of types. illustration if of types want store derive mutual class a utilize node<std::unique_ptr<a>> , able store a or more-derived-subtype of a in particular list.

if want 1 single list able hold elements of of set of unrelated types, need build "variant" construction capable of storing of them, field indicating type holds, utilize variant construction type argument node.

if want 1 single list able hold elements of any type @ all don't have many options besides using void pointer data: node<void *>. there many caveats technique, deciding owns pointed-to allocations, , figuring out right way delete them.

(note though wrote node * next, next node<t> *. within node class, template arguments implied.)

c++ pointers linked-list nodes

ruby on rails - Rails4 : live or faye or polling - Reload page when background job is finished -



ruby on rails - Rails4 : live or faye or polling - Reload page when background job is finished -

i have background job (sidekiq) generate pdf , save on s3 paperclip. during process, nowadays "waiting page" user.

i'm wondering how auto-reload waiting page pdf 1 time background job completed. know how nowadays pdf inline when exists (when background job finished). know how check if exist on page load, need auto check presence till success.

i did homework , checked possible solutions :

polling - seems outdated solution, not efficient one activerecord::live::sse - seems interesting complex new knowledge on "livestreaming". , not compatible ie (even it's not blocker, still con) faye , websocket - still, have difficulties understand how implement regarding need.

could please help me on best technique, , proper way implement it? (mostly timeout part on poll, , reload part live::sse , faye). examples show chat apps, create me wonder if i'm on right track.

ruby-on-rails live long-polling sidekiq

servlets - Dropwizard - override the url for the healthcheck endpoint -



servlets - Dropwizard - override the url for the healthcheck endpoint -

dropwizard uses codahale metrics healthcheck servlet. when using servlet outside of dropwizard can override uri setting init-param "healthcheck-uri".

is there way override in dropwizard?

it looks setting init-param on nonblockingservletholder.

you right nonblockingservletholder beingness constructed. issue dropwizard defaultserverfactory isn't transferring of params set in applicationcontext or admincontext, both part of dropwizard environment.

i believe viable alternative extend abstractserverfactory , set init params in config adminservlet before initialized. defaultserverfactory can extended , set configuration kid class.

class myserverfactory extends defaultserverfactory{ //copied abstractserverfactory protected handler createadminservlet(server server, mutableservletcontexthandler handler, metricregistry metrics, healthcheckregistry healthchecks) { //copied abstractserverfactory.configuresessionsandsecurity because private , can't called here if (handler.issecurityenabled()) { handler.getsecurityhandler().setserver(server); } if (handler.issessionsenabled()) { handler.getsessionhandler().setserver(server); } handler.setserver(server); handler.getservletcontext().setattribute(metricsservlet.metrics_registry, metrics); handler.getservletcontext().setattribute(healthcheckservlet.health_check_registry, healthchecks); //here - set init parameter , add together servlet def holder = new nonblockingservletholder(new adminservlet()) holder.setinitparameter("healthcheck-uri", "/myurl") handler.addservlet(holder, "/*"); //end handler.addfilter(allowedmethodsfilter.class, "/*", enumset.of(dispatchertype.request)) .setinitparameter(allowedmethodsfilter.allowed_methods_param, joiner.on(',').join(allowedmethods)); homecoming handler; } }

configuration kid class:

class myconfiguration extends configuration{ myconfiguration(){ setserverfactory(new myserverfactory()) } }

for worth:

i dove code initializes servlets , realized after while couldn't without overriding serverfactory doing: dropwizard environment has admincontext, applicationcontext , servletenvironment of allow set initialization parameters. adminservlet class place init param of "healthcheck-uri" used, hopeful setting these parameters in admincontext pass them through adminservlet, alas, not because jetty servletcontexthandler sets adminservlet has init params buried in _servlethandler._servletcontext._initparams.

none of these you:

environment.admincontext.setinitparameter("healthcheck-uri","/something") environment.applicationcontext.setinitparameter("healthcheck-uri","/something") environment.servlets().setinitparameter("healthcheck-uri","/something") environment.admin().setinitparameter("healthcheck-uri","/something")

servlets jetty dropwizard

ios - What it means to 'drop support for SSL 3.0' and 'add support for TSL' -



ios - What it means to 'drop support for SSL 3.0' and 'add support for TSL' -

hundreds of articles have popped on lastly 24 hours claiming that:

apple switching off ssl 3.0 back upwards in favor of more secure transport layer security (tsl) protocol on wednesday, oct. 29, noting developers have build in back upwards time ensure uninterrupted force notification service continues.

but none of them go farther detail implications developers , needs done beyond 'build in support'.

i have various applications hosted @ on aws , on parse back upwards our force notifications. i'm sorry if general edit , add together more detail start responses: need do go on back upwards force notifications? don't know much ssl/tsl.

thanks!

ios ssl amazon-ec2 parse.com apple-push-notifications

JSON Parsing in Javascript & node -



JSON Parsing in Javascript & node -

i trying parse json array posted client side node based server.

the json object holding array looks this

customdata : { "playlist": [ "//www.youtube.com/embed/bxq6sofu_38?rel=0", "//www.youtube.com/embed/qyqchamz4em?rel=0" ] }

however when seek access info using customdata.playlist[0], returns cannot parse 'playlist' console reports undefined.

i checked json using jsonlint validator , said me json valid. must missing pretty simple thoughts?

if info client side should parse this:

var parsed = json.parse(recieveddata);

and have access them.

javascript json node.js

Running a long COM operation in C#, unable to remove poison message -



Running a long COM operation in C#, unable to remove poison message -

i've been working on week , used stackoverflow extensively, can't figure out.

i'm writing plug-in in c# in autodesk product, , i'm connected (with marshal) different 3d application. i've done dozens of other plug-ins in past without issue.

this project unique. different 3d application, i'm running long-running task (file export) on big model. takes 1-60 minutes @ times.

i toxicant message: "this action cannot completed because 'application' not responding. take "switch to" and..." technically, can allow client click "retry" until finds application, undesirable.

i thought set doevents type thing, , wait export finish, toxicant message appears while export sub running (this first occurrence toxicant messages, i'm learning). looked running export operation on background thread, testing threadpool , thread operations. however, can "start" service, never exports model different 3d application. runs forever. (i removed error message original post because i'm not looking solution sub-problem, rather i'm describe below)

lastly, tried modify netmsmqbinding (i know nil either, trying larn it) in hopes set number of allowed retries bigger number.

system.timespan ts = new system.timespan(0, 30, 10); system.timespan tb = new system.timespan(10, 0, 0); netmsmqbinding nmb = new netmsmqbinding(); nmb.maxretrycycles = 1000; nmb.receiveretrycount = 1000; nmb.retrycycledelay = ts; nmb.opentimeout = tb;

however, no matter alter netmsmqbinding values to, "retry" message @ same time. must not writing correctly. in other examples, noticed xml file containing these values, , don't know xml is. nor want know, because i'd rather have run in plug-in, rather have xml file deal with.

i'm finding lots of examples on how deal in hypothetical (lots of console.write bs), nil has concrete illustration long running com process interrupting main c# utility.

i'd figure out how reset retry frequency , cycles lastly longer, toxicant messages aren't presented. how can that?

here more code, give context:

namespace testing_v0 { [pluginattribute("testing_v0r1", "adsk", tooltip = "testing plugin", displayname = "testing plugin")] [addinpluginattribute(addinlocation.addin)] public class myplugin : addinplugin { public override int execute(params string[] parameters) { system.timespan ts = new system.timespan(0, 30, 10); system.timespan tb = new system.timespan(10, 0, 0); netmsmqbinding nmb = new netmsmqbinding(); nmb.maxretrycycles = 1000; nmb.receiveretrycount = 1000; nmb.retrycycledelay = ts; nmb.opentimeout = tb; //nmb.receiveerrorhandling = receiveerrorhandling.drop; //do export process here } } }

because didn't have anymore time work on this, explain how resolved this. not advisable way resolve issue, has advantages.

on non-related project few months ago, did similar application exported same file format, console application. there no issues console application these issues arising in dll autodesk product.

using remembered console app export, made new little console app exe did file export. used system.io.process.start(file.exe, "arguments") command in parent dll trigger executable.

this roundabout way rid of pop messages, there advantages. executable runs export, while c# dll continues. allows me run simple file-exists loop until file appears in directory, continues on. set progress counter in c# dll ui, , gives client nice stable read out while exporter running.

like said, not ideal, works me, now.

c# com marshalling netmsmqbinding

fortran test memory overflow -



fortran test memory overflow -

i running fortran programme allocates memory dynamically rather big arrays, , not fit memory.

thus allocation

allocate(my_array(really big_number))

will give error

operating scheme error: cannot allocate memory allocation exceed memory limit

and programme exit. know if there way capture or test memory available, can take appropriate measures if i'm not allowed allocate such big array?

use: allocate(my_array(really big_number),stat=ierror)

with stat= specifier, status of allocation stored in specified variable (ierror in example). 0 means allocation succeeded, non-zero means failed.

from fortran 90 standard (ftp://ftp.nag.co.uk/sc22wg5/n001-n1100/n692.pdf) on allocate statement:

if stat= specifier present, successful execution of allocate statement causes stat-variable become defined value of zero.

if error status occurs during execution of allocate statement, stat-variable becomes defined processor-dependent positive integer value. if error status occurs during execution of allocate statement not contain stat= specifier, execution of executable programme terminated.

memory-management fortran

java - Overlapping buttons in android -



java - Overlapping buttons in android -

in android, trying add together buttons programatically, buttons added overlapping. code using this:

for(int = (int) 'a'; <= (int) 'z'; i++) { button button = new button(this); char letter = (char)i; string letteronbutton = character.tostring(letter); button.settext(letteronbutton); relativelayout rl = (relativelayout)findviewbyid(r.id.dynbuttons); layoutparams lp = new layoutparams(layoutparams.wrap_content,layoutparams.wrap_content); rl.addview(button,lp); }

it not throw button, see "z" button.

any thought on how prepare this?

as mentioned above linearlayout best solution, if u still want utilize relativelayout, seek setting id each button , inflate subsequent parameter right_of/below..as suggested above, parameter "layout_alignleft" produce same effect, i.e inflate buttons in same position

relativelayout rl = (relativelayout) findviewbyid(r.id.layout); int id = 0; (int = (int) 'a'; <= (int) 'z'; i++) { button button = new button(this); char letter = (char) i; string letteronbutton = character.tostring(letter); button.settext(letteronbutton); button.setid(i); layoutparams lp = new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); lp.addrule(relativelayout.below, id); rl.addview(button, lp); id = i; }

java android

java - Convert DateTimeZone to UTC Offset -



java - Convert DateTimeZone to UTC Offset -

given datetimezone, can name , id of timezone this:

class="lang-java prettyprint-override">datetimezone timezone = new datetimezone("america/chicago"); // prints "america/chicago" system.out.println(timezone.getid()); // prints "cdt" (since daylight savings time now) system.out.println(timezone.getnamekey(datetimeutils.currenttimemillis())); // prints "central daylight time" system.out.println(timezone.getname(datetimeutils.currenttimemillis()));

all great, timezone utc offset. in case utc offset -05:00

how do joda-time?

a pure joda-solution looks like:

int offsetmillis = datetimezone.forid("america/chicago").getoffset(datetimeutils.currenttimemillis()); datetimezone zone = datetimezone.foroffsetmillis(offsetmillis); string utcoffset = zone.tostring(); system.out.println(utcoffset); // output: -05:00

java jodatime

html - how to style a javascript button? -



html - how to style a javascript button? -

hello struggling styling add together button within of code

i learning javascript , kinda confusing on phone call css class.

check out js fiddle.

http://jsfiddle.net/infinityswift19/6xwyc6tn/

attemping style line >>

<input type="button" value="add" onclick="additem(document.getelementbyid('ch1').rowindex)" />

thanks response.

i suggest adding class button , styling way.

<input class="my-button" type="button" value="add" onclick="additem(document.getelementbyid('ch1').rowindex)" />

then in css:

.my-button { styles want go here }

you should come more meaningful class name "my-button", idea. nice because can reuse class later if need to. example, if have link needs same button, can like:

<a href="http://wwww.google.com" class="my-button">google button</a>

edit: jsfiddle class added first button: http://jsfiddle.net/yplqjmwa/

javascript html css styles

c - .h note: previous declaration of 'QueueADT' was here typedef struct { } *QueueADT; -



c - .h note: previous declaration of 'QueueADT' was here typedef struct { } *QueueADT; -

i know how solve errors redefinition of typedef struct queueadt.

error messages

gcc -std=c99 -ggdb -wall -wextra -c queueadt.c queueadt.c:22:3: error: 'queueadt' redeclared different kind of symbol }*queueadt; ^ in file included queueadt.c:9:0: queueadt.h:23:21: note: previous declaration of 'queueadt' here typedef struct { } *queueadt; ^ queueadt.c:30:1: error: unknown type name 'queueadt' queueadt que_create( int (*cmp)(const void*a,const void*b) ) { ^ queueadt.c:30:10: error: conflicting types 'que_create' queueadt que_create( int (*cmp)(const void*a,const void*b) ) { ^ in file included queueadt.c:9:0: queueadt.h:44:10: note: previous declaration of 'que_create' here queueadt que_create( int (*cmp)(const void*a,const void*b) ); ^

the .h file has definition if not compiling queueadt , que_create

#ifndef _queue_impl_ typedef struct { } *queueadt; #endif queueadt que_create( int (*cmp)(const void*a,const void*b) );

now not sure how define queueadt struct , que_create .c file here

#ifndef _queue_impl_ #include "queueadt.h" struct node { void* data; //size_t num; struct node *next; }node; typedef struct queueadt { struct node *front; /* pointer front end of queue */ struct node *rear; /* pointer rear of queue */ int *contents[ queue_size ]; /* number of items in queue */ int *cmprfunc; /* compare function used insert */ }*queueadt; queueadt que_create( int (*cmp)(const void*a,const void*b) ) { struct queueadt *new; new = (struct queueadt*)malloc(sizeof(struct queueadt)); if (cmp == null) { //do create new pointer cmp_int64? new->front = null; new->rear = null; new->cmprfunc = null; } else { new->cmprfunc = &cmp; new->front = null; new->rear = null; } homecoming ( new ); }

edit 1 error message went

queueadt.c:22:3: error: 'queueadt' redeclared different kind of symbol }*queueadt; ^ in file included queueadt.c:9:0: queueadt.h:23:21: note: previous declaration of 'queueadt' here typedef struct { } *queueadt; ^ queueadt.c:30:1: error: unknown type name 'queueadt' queueadt que_create( int (*cmp)(const void*a,const void*b) ) { ^

to

in file included queueadt.c:8:0: queueadt.h:44:1: error: unknown type name 'queueadt' queueadt que_create( int (*cmp)(const void*a,const void*b) ); ^ queueadt.h:49:19: error: unknown type name 'queueadt' void que_destroy( queueadt queue ); #define queue_size 5 #include "queueadt.h" #define _queue_impl_ struct node { void* data; //size_t num; struct node *next; }node; typedef struct queueadt { struct node *front; /* pointer front end of queue */ struct node *rear; /* pointer rear of queue */ //int *contents[ queue_size ]; /* number of items in queue */ int *cmprfunc; /* compare function used insert */ }*queueadt; queueadt que_create( int (*cmp)(const void*a,const void*b) ) { struct queueadt *new; new = (struct queueadt*)malloc(sizeof(struct queueadt)); if (cmp == null) { //do create new pointer cmp_int64? new->front = null; new->rear = null; new->cmprfunc = null; } else { new->cmprfunc = &cmp; new->front = null; new->rear = null; } homecoming ( new ); }

the first line of c file

#ifndef _queue_impl_

is incorrect, should defining macro, not testing it:

#define _queue_impl_

that beingness said, there's easier way accomplish you're trying do. instead of preprocessor wrapping, can instead have single line in header:

typedef struct queueadt *queueadt;

even if struct queueadt (n.b. different queueadt) isn't defined, can still utilize pointer it. then, within c file, define struct queueadt:

struct queueadt { ... };

note lack of typedef in struct definition.

c debugging header queue abstract-data-type

javascript - Getting what is the first day of the week based on Locale with momentJs -



javascript - Getting what is the first day of the week based on Locale with momentJs -

using momentjs, possible first day of week (monday(1), sunday(7)...) based on locale without creating new moment?

i know can access first day of week current locale with:

moment.locale('uk'); moment().startof('week').isoweekday(); //returns 1 moment.locale('en'); moment().startof('week').isoweekday(); //returns 7

but think it's bit ugly...

creating momentjs object. going first date of week. resolving weekday.

any improve idea? thx!

this question has proper reply in momentjs's current api:

moment.localedata('en-us').firstdayofweek();

as op asked - no instance of moment() needed, no ugliness of going "start of", plain simple utilize of localedata.

note, might required download moment+locale file larger (44kb) moment (about 12kb).

seems case version 2.2.0, more info can found on docs: http://momentjs.com/docs/#/i18n/locale-data/

javascript momentjs

html - Footer div text wont line up -



html - Footer div text wont line up -

what im trying lining 3 divs in footer. cant seem them line properly. when seek utilize float 2 of them line while 3rd 1 go below them. know whats going on?

class="snippet-code-css lang-css prettyprint-override">body{ background-color: rgb(240, 240, 240); } #pagefooter{ margin-top: 10px; background-color: red; height: 200px; border-top-left-radius: 5px; border-top-right-radius: 5px; box-shadow: 1px 1px 1px 1px #888888; } #pagefooter p{ color: white; padding-left: 1em; font-family: sans-serif; vertical-align: middle; line-height: 40px; font-weight: bold; } #leftfooter{ text-align: left; float: left; position: relative; } #midfooter{ text-align: center; float: center; position: relative; } #rightfooter{ text-align: right; float: right; position: relative; } class="snippet-code-html lang-html prettyprint-override"><!doctype html> <html> <head> <meta charset="utf-8"> <title>oppgave 1</title> <link rel="stylesheet" type="text/css" href="css/meyersreset.css"> <link rel="stylesheet" type="text/css" href="css/mainstyle.css"> </head> <body> <div id="container"> <footer id="pagefooter"> <div id="leftfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> <div id="midfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> <div id="rightfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> </footer> </div> </body> </html>

i think display: table technique suits situation:

class="snippet-code-css lang-css prettyprint-override">body { background-color: rgb(240, 240, 240); } #pagefooter { margin-top: 10px; background-color: red; height: 200px; border-top-left-radius: 5px; border-top-right-radius: 5px; box-shadow: 1px 1px 1px 1px #888888; display: table;/*add display table*/ width: 100%; } #pagefooter p { color: white; padding-left: 1em; font-family: sans-serif; vertical-align: middle; line-height: 40px; font-weight: bold; } #leftfooter { text-align: left; display: table-cell;/*add display table-cell*/ position: relative; } #midfooter { text-align: center; display: table-cell;/*add display table-cell*/ position: relative; } #rightfooter { text-align: right; display: table-cell;/*add display table-cell*/ position: relative; } class="snippet-code-html lang-html prettyprint-override"><body> <div id="container"> <footer id="pagefooter"> <div id="leftfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> <div id="midfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> <div id="rightfooter"> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> <p>lorem ipsum</p> </div> </footer> </div> </body>

html css

java - Performance of Loggly when logs are generated from 12000 client systems simultaneously -



java - Performance of Loggly when logs are generated from 12000 client systems simultaneously -

i have 600 restaurant stores. each store consists of 20 systems of type point of sale, kitchen display scheme , server. so, loggly work when logs generated 12000(600 x 20) client systems simultaneously? want integrate point of sale, kitchen display scheme , server loggly logs generated these systems using java logback posted loggly dashboard. logs can generated each scheme multiple threads @ same time. moreover, logs can generated systems multiple threads simultaneously. can loggly back upwards such scenario? there performance issue?

i think need talk loggly people directly. folks able reply these questions accurately.

bear in mind if found other loggly client logging ~12000 systems, there experience won't generalize use-case. there other as of import "variables"; e.g. network bandwidth, latency , reliability, , rate @ systems generate log messages.

java logback loggly

ios - Xcode 6 symbolication not working -



ios - Xcode 6 symbolication not working -

i've followed of solutions symbolicating can't of apple framework lines symbolicate. using symbolicatecrash outputs new crash log terminal, symbolicates code:

/applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash crash1.crash defqt.app.dsym

exception type: exc_crash (sigabrt) exception codes: 0x0000000000000000, 0x0000000000000000 triggered thread: 0 lastly exception backtrace: 0 corefoundation 0x185f59e48 0x185e34000 + 1203784 1 0x1966540e4 + 6818185444 2 corefoundation 0x185f597fc 0x185e34000 + 1202172 3 defqt 0x1000e5358 __39-[mutcameraassetgrouplist getallalbums]_block_invoke (mutcameraassetgrouplist.m:139) 4 assetslibrary 0x18528d58c 0x185284000 + 38284 5 0x196c993ac + 6824760236 6 0x196c9936c + 6824760172 7 0x196c9d980 + 6824778112 8 corefoundation 0x185f116a0 0x185e34000 + 906912 9 corefoundation 0x185f0f748 0x185e34000 + 898888 10 corefoundation 0x185e3d1f4 0x185e34000 + 37364 11 0x18efd35a4 + 6693926308 12 uikit 0x18a76e784 0x18a6f8000 + 485252 13 defqt 0x1000e174c main (main.m:16) 14 0x196cc2a08 + 6824929800 thread 0 name: dispatch queue: com.apple.main-thread thread 0 crashed: 0 libsystem_kernel.dylib 0x0000000196ddb270 0x196dc0000 + 111216 1 libsystem_pthread.dylib 0x0000000196e79224 0x196e74000 + 21028 2 libsystem_c.dylib 0x0000000196d52b14 0x196cf0000 + 404244 3 libc++abi.dylib 0x0000000195e39414 0x195e38000 + 5140 4 libc++abi.dylib 0x0000000195e58b88 0x195e38000 + 134024 5 libobjc.a.dylib 0x00000001966543bc 0x19664c000 + 33724 6 libc++abi.dylib 0x0000000195e55bb0 0x195e38000 + 121776 7 libc++abi.dylib 0x0000000195e55474 0x195e38000 + 119924 8 libobjc.a.dylib 0x0000000196654200 0x19664c000 + 33280 9 corefoundation 0x0000000185f597f8 0x185e34000 + 1202168 10 defqt 0x00000001000e5354 __39-[mutcameraassetgrouplist getallalbums]_block_invoke (mutcameraassetgrouplist.m:139) 11 assetslibrary 0x000000018528d588 0x185284000 + 38280 12 libdispatch.dylib 0x0000000196c993a8 0x196c98000 + 5032 13 libdispatch.dylib 0x0000000196c99368 0x196c98000 + 4968 14 libdispatch.dylib 0x0000000196c9d97c 0x196c98000 + 22908 15 corefoundation 0x0000000185f1169c 0x185e34000 + 906908 16 corefoundation 0x0000000185f0f744 0x185e34000 + 898884 17 corefoundation 0x0000000185e3d1f0 0x185e34000 + 37360 18 graphicsservices 0x000000018efd35a0 0x18efc8000 + 46496 19 uikit 0x000000018a76e780 0x18a6f8000 + 485248 20 defqt 0x00000001000e1748 main (main.m:16) 21 libdyld.dylib 0x0000000196cc2a04 0x196cc0000 + 10756

i next errors after running script:

use of uninitialized value $image_base in hex @ /applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash line 572. utilize of uninitialized value $image in sprintf @ /applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash line 573. utilize of uninitialized value $image_base in sprintf @ /applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash line 573. utilize of uninitialized value $image_base in hex @ /applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash line 572. utilize of uninitialized value $image in sprintf @ /applications/xcode6/xcode.app/contents/sharedframeworks/dtdevicekitbase.framework/versions/a/resources/symbolicatecrash line 573.

try utilize "symbolicatecrash -v xxx.crash" command verbose log, should able find apple frameworks' symbols not found, should located in ~/library/developer/xcode/ios devicesupport/${ios version}, symbols copied if connect real device mac , synchronise it, , version must exact same device's ios version crash study occurs.

i don't know download symbols different ios versions, question missing ios symbols @ “~/library/developer/xcode/ios devicesupport” has asked no reply @ moment.

ios objective-c xcode xcode6 symbolicatecrash

How to end program while loop in python -



How to end program while loop in python -

i'm running issue next python 3.x code in while(keepalive): continues, after keepalive false. when user enters "1", killing program... displayed while loop continues. i'm familiar other languages, starting out python. seems must have made simple mistake... i'd appreciate if point out.

keepalive = true def main(): if(input("enter 1 end program") == "1"): print("killing program...") keepalive = false while(keepalive): main()

thanks

currently, module keepalive , local keepalive within main 2 independent names. tie them together, declare keepalive within main global. next works.

keepalive = true def main(): global keepalive if(input("enter 1 end program") == "1"): print("killing program...") keepalive = false while(keepalive): main()

look 'global' in python doc index , should find explanation.

python-3.x

arrays - Creating a 2D matrix in Matlab -



arrays - Creating a 2D matrix in Matlab -

i want create matrix like

a = [1 2 3 ;4 5 6; 7 8 9];

i want this,

a = 1 + val : 1 : 3 + val ; val = [0 3 6];

but getting [1 2 3] , not 2d matrix .

try this,

val = [0 3 6]; = bsxfun(@plus,val',1:3); = 1 2 3 4 5 6 7 8 9

arrays matlab matrix vector

php - Customize $this->Html->link() As per HTML -



php - Customize $this->Html->link() As per HTML -

i have html code, , having problem create link on cakephp !

this html code!

<li> <a href="#"> <i class="fa fa-angle-double-right"></i> morris </a> </li>

and want create this, cakephp way!

<li> <?php echo $this->html->link(__('list'), array( 'controller'=>'transactions', 'action'=>'index' ) ); ?> </li>

but having problem this, , how set this:

i want this

https://drive.google.com/file/d/0bw9k-whe0suvqkhuqy14t2lacjq/view?usp=sharing

use

echo $this->html->link( '<i class="fa fa-angle-double-right"></i>', array( 'controller'=>'transactions', 'action'=>'index' ), array( 'escape'=>false //notice line *************** ) );

php cakephp cakephp-2.0 cakephp-2.3 helpers

javascript - browser_action to trigger content_script failed -



javascript - browser_action to trigger content_script failed -

what want when click browser_action icon, webpage css, failed next code, not respond @ all. idea?

the manifest json file this

{ "manifest_version": 2, "name": "test", "description": "yada yada", "version": "1.0", "permissions": [ "https://*/*", "tabs" ], "icons": { "128" : "icon.png" }, "browser_action": { "default_icon": "icon.png" }, "content_scripts": [ { "matches": [ "http://*/*", "https://*/*" ], "js": ["jquery.js","request.js"], "run_at": "document_end" } ] }

and request.js here

chrome.browseraction.onclicked.addlistener(function (){ document.body.style.background = 'yellow'; });

from understand, want alter css of relevant pages using programmatic injection. manifest.json should include next permission:

"permissions": [ "activetab" ],

access chrome.* api restricted in content scripts

once have permissions set up, can inject javascript page calling tabs.executescript. inject css, utilize tabs.insertcss.

so want (injects javascript code):

chrome.browseraction.onclicked.addlistener(function(tab) { chrome.tabs.executescript({ code: 'document.body.style.backgroundcolor="yellow"' }); });

alternatively, utilize insertcss method described in docs on activetab so:

chrome.browseraction.onclicked.addlistener(function(tab) { chrome.tabs.insertcss(tab.id, { code: 'document.body.style.backgroundcolor="yellow"' }); });

again docs:

if content script's code should injected, register in extension manifest using content_scripts field, in next example-

"content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["mystyles.css"], //mystyle.css gets injected relevant pages. "js": ["jquery.js", "myscript.js"] } ],

edit - should have explicitly stated earlier, documentation says content scripts cannot

use chrome.* apis, exception of: extension ( geturl , inincognitocontext , lasterror , onrequest , sendrequest )

so can't next in content script (i wonder how worked you):

chrome.browseraction.onclicked.addlistener(function callback)

that said, have access browseraction api in background page(s). require this:

manifest.json:

{ ... "background": { "scripts": ["background.js"] }, ... }

background.js:

chrome.browseraction.onclicked.addlistener(function(tab) { chrome.tabs.executescript({ code: 'document.body.style.backgroundcolor="yellow"' }); });

in essence utilize chrome.browseraction in background pages content scripts don't back upwards it. hope clarify point , should help problem sorted.

javascript google-chrome-extension

cross platform - How to get console width without using ncurses? -



cross platform - How to get console width without using ncurses? -

what need console width, improve not depend on library provides many other functions. in addition, user of library don't have ncurses dev headers installed; if remove dependency on ncurses, there less claims user.

i have downloaded ncurses source code , had brief @ it, failed grasp key code collecting console width. know fcntl() can it, windows don't have it. tell me how width in cross-platform way?

you find in columns environment variable.

cross-platform console-application ncurses fcntl

nlp - Identifying the context of word in sentence -



nlp - Identifying the context of word in sentence -

i created classifier classy class of nouns,adjectives, named entities in given sentence. have used big wikipedia dataset classification.

like :

where abraham lincoln born?

so classifier give short of result - word - class

where - question abraham lincoln - person, movie, book (because classifier find abraham lincoln in there categories) born - time

when titanic released?

when - question titanic - song, movie, vehicle, game (titanic classified in these categories)

is there way identify exact context word?

please see :

word sense disambiguation not help here. because there might not near word in sentence can help

lesk algorithm wordnet or sysnet not help. because suppose word bank lesk algo behave this

======== testing simple_lesk ===========

testing simple_lesk() ...

context: went bank deposit money

sense: synset('depository_financial_institution.n.01')

definition: financial establishment accepts deposits , channels money lending activities

testing simple_lesk() pos ...

context: river bank total of dead fishes

sense: synset('bank.n.01')

definition: sloping land (especially slope beside body of water)

here word bank suggested financial institute , slopping land. while in case getting such prediction titanic can movie or game.

i want know there other approach apart lesk algo, baseline algo, traditional word sense disambiguation can help me identify class right particular keyword?

titanic -

thanks using pywsd examples. regards wsd, there many other variants , i'm coding them myself during free time. if want see improve bring together me in coding open source tool =)

meanwhile, find next technologies more relevant task, such as:

knowledge base of operations population (http://www.nist.gov/tac/2014/kbp/) tokens/segments of text assigned entity , task link them or solve simplified question , reply task.

knowledge representation (http://groups.csail.mit.edu/medg/ftp/psz/k-rep.html)

knowledge extraction (https://en.wikipedia.org/wiki/knowledge_extraction)

the above technologies includes several sub-tasks such as:

wikification (http://nlp.cs.rpi.edu/kbp/2014/elreading.html) entity linking slot filling (http://surdeanu.info/kbp2014/def.php)

essentially you're asking tool np-complete ai scheme language/text processing, don't think such tool exists of yet. maybe it's ibm watson.

if you're looking field into, field out there if you're looking @ tools, wikification tools closest might need. (http://nlp.cs.rpi.edu/paper/wikificationproposal.pdf)

nlp data-mining nltk semantics

objective c - launch/wake iOS app periodically -



objective c - launch/wake iOS app periodically -

i have app runs in background. i'd wake periodically: either @ preset times of day or every n hours. must done without user intervention.

i believe since app runs in background, nstimer not work. how can 'wake' app on periodic basis?

of course, that's possible, , easy implement. technique called background fetch. works - 1) inquire operation scheme wake / start application on times. 2) operation scheme decides , periodically start application , calls

-(void)application:(uiapplication *)application performfetchwithcompletionhandler:(void (^)(uibackgroundfetchresult))completionhandler

3) jobs there, , can trigger local force notification user, new info available.

here great article covers question

objective-c ios7 nstimer

c# - asp.net GridView table won't display if container div is set invisible during page load -



c# - asp.net GridView table won't display if container div is set invisible during page load -

i have 2 gridviews in asp webform project, 1 display , 1 edit. have them each in separate div. start edit div invisible, , have button in display div makes display div invisible , edit div visible. basic code looks this:

<div id="displaydiv"> <asp:gridview id="certlist" runat="server" autogeneratecolumns="false" datasourceid="getmydata"> <columns> <asp:boundfield datafield="a few datafields go here /> </columns> </asp:gridview> <asp:button id="btnedit" runat="server" onclick="btnedit_click" text="edit" /> </div> <div id="editdiv" visible="false"> <asp:gridview id="certlist" runat="server" autogeneratecolumns="false" datasourceid="getmydata" "> <columns> <asp:boundfield datafield="a few datafields go here /> </columns> </asp:gridview> </div>

the click event button looks this:

protected void btnedit_click(object sender, eventargs e) { editdiv.visible = true; displaydiv.visible = false; }

everything works fine plumbing if don't set editdiv's visible attribute false in markup. if set false, table doesn't show when set true programmatically in button click event. seems dataview's rendering capability tied ability access markup. so, based on theory, tried setting position absolute , left -10000 , got same result.

is can't do, or missing something?

edit: set test @ home , works fine:

<asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <div id="div1" runat="server"> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datakeynames="customerid" datasourceid="sqldatasource1"> <columns> <asp:boundfield datafield="customerid" headertext="customerid" readonly="true" sortexpression="customerid" /> <asp:boundfield datafield="companyname" headertext="companyname" sortexpression="companyname" /> <asp:boundfield datafield="contactname" headertext="contactname" sortexpression="contactname" /> <asp:boundfield datafield="contacttitle" headertext="contacttitle" sortexpression="contacttitle" /> </columns> </asp:gridview> <asp:button id="button1" runat="server" onclick="button1_click" text="button1" /> </div> <div id="div2" runat="server" visible="false"> <asp:gridview id="gridview2" runat="server" autogeneratecolumns="false" datakeynames="productid" datasourceid="sqldatasource2"> <columns> <asp:boundfield datafield="productid" headertext="productid" insertvisible="false" readonly="true" sortexpression="productid" /> <asp:boundfield datafield="productname" headertext="productname" sortexpression="productname" /> <asp:boundfield datafield="unitsinstock" headertext="unitsinstock" sortexpression="unitsinstock" /> </columns> </asp:gridview> <asp:button id="button2" runat="server" onclick="button2_click" text="button2" /> </div> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:northwindconnectionstring %>" selectcommand="select top (5) customerid, companyname, contactname, contacttitle customers"> </asp:sqldatasource> <asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<%$ connectionstrings:northwindconnectionstring %>" selectcommand="select top (5) * products"> </asp:sqldatasource> </asp:content>

and code behind:

protected void button1_click(object sender, eventargs e) { div1.visible = false; div2.visible = true; } protected void button2_click(object sender, eventargs e) { div2.visible = false; div1.visible = true; }

so there's proof of concept. it's silly mistake, i'll post 1 time find out story is.

set runat="server" both divs seek access code behind.

<div id="displaydiv" runat="server"> .... </div> <div id="editdiv" runat="server" visible="false"> .... </div>

or can utilize asp:panel instead of div can access visible property code behind.

<asp:panel id ="pnldisplay" runat="server"> .... </asp:panel> <asp:panel id ="pnledit" runat="server" visible="false"> .... </asp:panel>

and code behind

protected void btnedit_click(object sender, eventargs e) { pnldisplay.visible = false; pnledit.visible = true; }

c# asp.net gridview webforms

Return hexidecimal differences in binary files with PHP -



Return hexidecimal differences in binary files with PHP -

i've read , tried every reply here, yet seem apply strings in non-binary formats. i'm trying compare differences in binary files , homecoming in format such this:

[file1] -0001010: ac 0f 00 00 01 00 00 00 48 65 6c 6c 6f 2c 20 77 ........hello, w [file2] +0001010: ac 0f 00 00 01 00 00 00 48 75 6c 6c 6f 2c 20 77 ........hullo, w

xdiff works fine creating bdiff patches , patching file - i'm looking illustrate differences.

$one = 'one'; // original file $two = 'two'; // updated file $pat = 'dif'; // bdiff patch $new = 'new'; // new destfile xdiff_file_diff_binary($one, $two, $pat); xdiff_file_patch_binary($one, $pat, $new); $diff = xdiff_file_diff($one, $two, 1); if (is_file($diff)) { echo "differences:\n"; // result = 1 echo $diff; }

maybe xdiff isn't right extension using this? i'm not sure.

sound big pain in butt in php, might suggest next bash one-liner?

diff <(hexdump -c file1) <(hexdump -c file2)

output:

10c10 < 00000090 35 35 61 34 32 62 62 31 30 33 31 62 38 38 39 34 |55a42bb1031b8894| --- > 00000090 35 35 61 34 32 62 62 31 30 33 31 61 38 38 39 34 |55a42bb1031a8894|

and can mess options diff , hexdump.

php binary hex diff

ios - Provisioning profile does not match bundle identifier -



ios - Provisioning profile does not match bundle identifier -

i have run in iphone ok, seek build , upload, error, how can prepare it, thanks!

code sign error: provisioning profile not match bundle identifier: provisioning profile specified in build settings (“pickey distribution”) has appid of “com.kkapps.pickey” not match bundle identifier “com.kkapps.pickey.mykeyboard”.

codesign error: code signing required product type 'app extension' in sdk 'ios 8.0'

at creation of provisioning profile on developer portal have provided app id com.kkapps.pickey

your bundle identifier has strictly identical 1 provided provisioning profile, no additions after .mykeyboard

two solutions you

1. in case, explicit app id : alter app bundle identifier com.kkapps.pickey match provisioning profile app id

2. utilize create new app id com.kkapps.pickey.* , alter provisioning profile link (or create new one). * wildcard allowing match multiple apps

with solution 2 able create apps bundle identifier starting com.kkapps.pickey.

for exemple com.kkapps.pickey.mykeyboard, or com.kkapps.pickey.mysuperapplication

apple's explanations app ids

explicit app id (example: com.domainname.appname)

if plan incorporate app services such game center, in-app purchase, info protection, , icloud, or want provisioning profile unique single app, must register explicit app id app.

to create explicit app id, come in unique string in bundle id field. string should match bundle id of app.

wildcard app id (example: com.domainname.*)

this allows utilize single app id match multiple apps. create wildcard app id, come in asterisk (*) lastly digit in bundle id field.

ios bundle identifier provisioning

java - Prevent generation of duplicate classes from XSDs without namespaces -



java - Prevent generation of duplicate classes from XSDs without namespaces -

i implementing functionally our netbeans platform application using classes generated jaxb using mojo maven plugin 'jaxb2-maven-plugin'. unfortunately creation of xsd files not in hands , confidential. trying provide minimal running illustration farther demonstrate hope can force me in right direction solely description.

we have many xsd files , got few additions in lastly weeks. 2 of these xsds (lets phone call them a.xsd , b.xsd) include xsd (lets phone call common.xsd) contains mutual types used both of other xsds. common.xsd has no namespace , should remain way.

this creates next problem: types defined in common.xsd there 3 duplicates generated xjc. 1 residing in bundle named 'generated' (exactly classes want use) , 2 others residing in packages of a.xsd , b.xsd same classes in 'generated' except few namespaces not needed me.

i understand reading few other questions on stackoverflow episodes resolve not getting work xsd without namespace.

my plugin configuration in pom pretty simple:

<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <configuration> <npa>true</npa> </configuration> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> </plugin>

is there resolution problem using episodes special configuration or maybe kind of binding can utilize resolve this?

this explanation of why episodes fail, unfortunately, not reply question.

you can utilize jaxb:class/@ref binding map schema type onto existing class. see this post blaise.

in short, can like:

<jaxb:binding node="...point type here"> <jaxb:class ref="existingclass"/> <jaxb:binding>

in case existingclass reused type.

you trying create work episodes. episode, in essence set of such mappings. episodes utilize scd (schema component designator) point types, not node xpath-expressions. , scd namespace-driven. if have no namespace - or, improve - have chameleon namespace design, don't have right namespace. hence episodes fail.

the problem "common" classes should utilize namespace of "host" schema (this chameleon design about). namespace , local names provided in annotations. if have 1 set of classes , 1 set of annotations - have 1 namespace. @ moment don't see easy way have 1 set of "common" classes.

if can utilize a , b separately, is, not in same context @ same time possible trick annotation reader utilize specified namespace common.

but if want utilize , b @ same time, don't know how it. maybe invent namespace common , apply preprocessing replace namespaces mutual elements in , b namespace...

so not answer, more elaboration on backgrounds.

java maven jaxb xsd xjc

MySQL calculate from same value -



MySQL calculate from same value -

i have query:

select `item_code`, `q_rr`, `q_srs`, @running_bal := @running_bal + (`q_rr` - `q_srs`) `balance` records, (select @running_bal := 0) tempname order records.item_code, records.date

which results is:

item_code | q_rr | q_srs | balance -------------------------------------------- 0f02206a 2 0 2 br00113d 3 0 5 br00114d 10 0 15 br00114d 0 1 14 br00114d 0 1 13 br00115d 20 0 33 br00115d 0 1 32 br00115d 0 1 31

need help create result calculate balance, if q_rr(+) , q_srs(-) , calculate per item_code.

item_code | q_rr | q_srs | balance -------------------------------------------- 0f02206a 2 0 2 br00113d 3 0 3 br00114d 10 0 10 br00114d 0 1 9 br00114d 0 1 8 br00115d 20 0 20 br00115d 0 1 19 br00115d 0 1 18

i added @code variable track item_code changes:

select r.item_code, r.q_rr, r.q_srs, @running_bal := if(@code = r.item_code, @running_bal, 0) + (r.q_rr - r.q_srs) balance, @code := r.item_code dummy records r cross bring together (select @running_bal := 0, @code := '') tempname order r.item_code, r.date

sql fiddle: http://sqlfiddle.com/#!2/04ef2b/11

you can eliminate dummy column putting subquery in select:

select item_code, q_rr, q_srs, balance ( -- there set first query ) r

sql fiddle: http://sqlfiddle.com/#!2/04ef2b/12

mysql

c++ - Pointer in linked list/vector -



c++ - Pointer in linked list/vector -

i'm trying implement own linked list using vectors , pointers. problem i'm have can't first node point sec node.

here's code , i've tried:

struct node { node* previous; node* next; int data; }; // initialize: create vector size 20 , first node void linkedlist::init() { veclist.resize(20, null); // vector of size 20 node* head = new node(); // create head node head->previous = null; // previous point set null head->next = veclist[1]; // next pointer set next position head->data = 0; // info set @ value 0 veclist[0] = head; // set head node in first position count = 1; // increment count 1 } // add together node array void linkedlist::push_back(node* node, int data) { count += 1; node = new node(); node->next = veclist[count + 1]; node->previous = veclist[count - 1]; node->data = data; veclist[count - 1] = node; }

the info has been passed in , displayed using:

cout << linkedlist.veclist[1]->data << endl;

but if seek way display error saying next pointer <unable read memory>

cout << linkedlist.veclist[0]->next->data << endl;

you forgot set next pointer of previous node in push_back method. if count fellow member variable of list containing number of entries have alter method this:

edit: have increment count in end because array indices start zero.

void linkedlist::push_back(node * node, int data){ node = new node(); node->next = null; // null because next element not exist yet node->previous = veclist[count - 1]; node->data = data; veclist[count] = node; veclist[count-1]->next = veclist[count]; count++; }

still it's bit unusual seek implement linked list vector or array because defeats advantages of list...

c++ pointers vector linked-list

uml - Do you make a Use Case Narrative of a general use case? -



uml - Do you make a Use Case Narrative of a general use case? -

i have utilize case diagram. can see, "rate service provider" general utilize case of "rate on computer" , "rate online" utilize cases. since 2 utilize cases specific, know have separate utilize case narratives. question need create utilize case narrative general utilize case? general utilize case has same behavior 2 specific utilize cases. give thanks you. :)

yes, base of operations on previous experienced. rate computer , rate online alternative sequence in utilize case narrative.

uml use-case diagrams

asp.net mvc 5 - What URL does this route match? -



asp.net mvc 5 - What URL does this route match? -

“routes.maproute("static", "welcome", new { controller = "home", action = "index" });”

so mean go home/index? "welcome" in url?

first name of route, sec url , 3rd part default values.

please refer official documentation next time, instance tutorial: http://www.asp.net/mvc/tutorials/controllers-and-routing/creating-custom-routes-cs

this specific route apply url: {root}/welcome , {root} may www.mysite.com , utilize controller name home , activate action index.

asp.net-mvc-5

jquery - Error in Inserting Values into PostgreSQL table through php -



jquery - Error in Inserting Values into PostgreSQL table through php -

i'm trying insert received values postgresql table using php. can't figure out why statement doesn't work

$query = "insert user_info (name, emailaddress, phonenumber, jobdesc) values ('" . $name . "," . $emailaddr . "," . $phonenumber . "," . $jobdesc ."')";

i error:

query failed: error: column &quot;emailaddress&quot; of relation &quot;user_info&quot; not exist

however, tried one:

$query = "insert user_info values ('" . $name . "," . $emailaddr . "," . $phonenumber . "," . $jobdesc ."')";

it works, inserts values first column!

i'm not sure i'm missing here!

i think missing whole host of single quotes in values list...

$query = "insert user_info (name, emailaddress, phonenumber, jobdesc) values ('" . $name . "','" . $emailaddr . "','" . $phonenumber . "','" . $jobdesc ."')";

php jquery postgresql

java - Gradle get 'sudo' rights -



java - Gradle get 'sudo' rights -

i have next problem : need execute deployment stuff on server using gradle, gradle should have 'root' access on target deployment server. have password 'sudo', don't know how insert in server.

is there way 'sudo' rights gradle task?

thanks in advance.

java unix gradle war

Android Twilio make a call -



Android Twilio make a call -

i trying create phone call altering android hellomonkey few days using valid userid, when create phone call error "account sid cannot null when making call" code like

public void connect(string phonenumber) { map<string, string> parameters = new hashmap<string, string>(); parameters.put("phonenumber", phonenumber); if (device == null){ log.w("", "failed device == null"); }else{ log.w("", "device != null"); } connection = device.connect(parameters, null /* connectionlistener */); if (connection == null) log.w(tag, "failed create new connection"); }

nothing found null

please help. in advance

instead of using key name "phonenumber", utilize "to" key map parameters.

public void connect(string phonenumber) { map<string, string> parameters = new hashmap<string, string>(); parameters.put("to", phonenumber); connection = device.connect(parameters, null /* connectionlistener */); if (connection == null) log.w(tag, "failed create new connection"); }

twilio client android

android twilio twilio-click-to-call

android - Turning a Parcelable object into a POJO with Parcelable child -



android - Turning a Parcelable object into a POJO with Parcelable child -

i have started helping out exisitng android project , have many classes possible in "pure" java module write junit tests against.

however, there ton of model objects implement parcelable android class.

given existing class

package com.example; public class foo implements parcelable { //...fields, getter/setters, etc. @override public void writetoparcel(....) { } public static final parcelable.creator<t> creator = new ... { public t createfromparcel() {...} public t[] newarray(int size) {....} } }

if split 2 classes (the first [parent] class in 'pure' java module)

package com.example.pure; public class foo { // ... fields , getters/setters, etc. }

and

package com.example; public class foo extends com.example.pure.foo implements parcelable { // parcelable implementation goes here. } would cause problems code (presumably in android framework) using parcelable object? are there factors consider create poor choice?

android parcelable parcel

canjs - how can can.component returning value to user? -



canjs - how can can.component returning value to user? -

problem: building component need output json object. how can expose output code can phone call component , retrieve value? (eg. getter value)

for e.g. can.component of tree combo defined on here (http://canjs.com/docs/can.component.html) allows select values. how can retrieve selected values can component utilize farther in code ? method homecoming me values selected can reuse later pass function doing other computation.

have @ https://github.com/bitovi/canjs/issues/1209, there are several ways accomplish this. have 3 ways:

pass can.map kid component, sub-component update object use dom events (see 3.2.1 in link above) using can-event callback (see 3.2.3)

canjs canjs-component

javascript - How can I color specific letters in html element text? -



javascript - How can I color specific letters in html element text? -

this question has reply here:

change color of character 4 answers

i have span words in it, like

<span id="phrase">here words</span>

i need color 'e' characters red.

i think of taking span.innertext property, remove text node span element , add together more spans within (or instead), , give them necessary style.

is way, or solved in more elegant way?

you can certainly javascript:

class="snippet-code-js lang-js prettyprint-override">var span = document.getelementbyid('phrase'), text = span.innerhtml.split('').map(function(el) { homecoming '<span class="char-' + el.tolowercase() + '">' + el + '</span>'; }).join(''); span.innerhtml = text; class="snippet-code-css lang-css prettyprint-override">.char-e { color: red; } class="snippet-code-html lang-html prettyprint-override"><span id="phrase">here words</span>

for convenience wraps each character span corresponding class name, makes easy assign individual styles.

warning: not recommend doing big texts because code above replaces innerhtml can break html if contains other nested elements. little titles text not going problem.

if want work more complex html markup (with children elements) function needs improved work recursively on kid items text content.

javascript css

unix - File permission set to 755 but still no web access -



unix - File permission set to 755 but still no web access -

i've ran problem after setting folder , contents 755 permissions. ran

chmod 755 -r folder/

however, when trying access in /var/www folder via browser 403 forbidden error. did download folder web, other files 755 permissions loaded fine browser. here looks like:

ls -l drwxr-xr-x. 4 root root 4096 folder

edit: if you're going downwards vote, how explain why?

drwxr-xr-x.

the trailing dot means directory has selinux acl, cause of problem. -- acl denies access.

unix centos

jquery - Javascript Array Variable Scope -



jquery - Javascript Array Variable Scope -

this question has reply here:

how homecoming response asynchronous call? 11 answers

i have problem array variable scope in javascript. here's code

class="snippet-code-js lang-js prettyprint-override">var features = new array(); var x = 0; $.ajax({ async: true, url: domain + "client/applications/getfeatures", datatype: 'json', success: function(data) { if (data.code == 200) { $.each(data.data, function(i, val) { features[x] = val.features_value; x++; }); } } }); alert(features[0]);

the result of pop "undefine". have solutions ? give thanks you

you problem isn't variable scope, it's async code.

your alert fired before success callback, features hasn't been set yet. instead:

$.ajax({ // ... other ajax opts success: function(data){ var features = new array(); if(data.code == 200){ var x = 0; $.each(data.data, function(i, val){ features[x]=val.features_value; x++; }); } alert(features[0]); } });

javascript jquery ajax

MIPS A String to Integer Conversion -



MIPS A String to Integer Conversion -

basically, read string console, no problem. first , 3rd characters in string 0-9 number , want these numbers store ıntegers in memory reuse later. "exception occured @ pc=0x0040004c" , when clicking abort "unaligned address in store:0x100100c9".

what problem? please, help!

edit:when run step step, error occurs in line 24.

.data exp: .space 201 #allocate 200 bytes logic look read stdin. +1 null char. dimension: .space 8 #allocate 8 bytes dimensions of environment .text main: li $v0, 8 # load appropriate scheme phone call code register $v0; # code reading string 8 la $a0, exp # load address of string read $a0 li $a1, 201 # load length of string read $a1 syscall # phone call operating scheme perform read operation la $t0, exp la $t1, dimension add together $t2,$zero,$zero lb $t2, 0($t0) addi $t2, $t2, -48 sw $t2, 0($t1) li $v0, 10 syscall

you have align info @ word boundary when storing word.

for have utilize .align directive parameter 2.

in illustration dimension not aligned because exp 201 bytes length (not multiple of 4). have use:

.data exp: .space 201 #allocate 200 bytes logic look read stdin. +1 null char. .align 2 # align info dimension: .space 8 #allocate 8 bytes dimensions of environment .text

string mips

git - Combine an old merged branch into a single history -



git - Combine an old merged branch into a single history -

i have master branch, deleted merged branch "redesign".

a - b - c - d - e (master) | | f - g - h (redesign)

is possible combine merged "redesign" branch master have single uniform history?

a - b - c - f - g - h (master)

i think git rebase --interactive trick. on master branch do

git rebase --interactive <commit hash of b>

and pick every commit. if want reorder commits swap lines.

edit:

just found similar question community wiki answer: combining history of merged branches in git?

git merge branch

mysql - Select 1 row from select statement php -



mysql - Select 1 row from select statement php -

$query = "select questionid, surveyid, question, responsetype, imageid questions surveyid = " . $_post['survey'] .";"; $result = $mysqli->query($query); $row = $result->fetch_array(3);

i'm trying 3rd row of select statement. lastly line didn't work , returns first line , i've been trying hr looking around stackoverflow , php website , can't find anything. there way this?

just utilize limit clause in sql statement:

$query = "select questionid, surveyid, question, responsetype, imageid questions surveyid = " . $_post['survey'] ." limit 2,1;";

the 2 means start @ 3rd row (remember start counting @ zero) , 1 means homecoming 1 row.

php mysql

Binding AngularJS value to call existing JavaScript function -



Binding AngularJS value to call existing JavaScript function -

i have existing javascript need call. existing function called 'confirmdelete'. sake of demonstration, shortened version looks this:

function confirmdelete(orderid) { homecoming confirm('are sure want delete order #"' + orderid + '"?'); }

there more function. either way, trying phone call function this:

<a href="~/order/delete/{{order.id}}" onclick="return confirmdelete('{{order.id}}');">delete order</a>

my other bindings working. however, cannot figure out how pass order id existing javascript function. how do that?

thank you!

you inject $window:

.controller('examplecontroller', ['$scope', '$window', function($scope, $window) { $scope.window = $window; });

and can do:

<a href="~/order/delete/{{order.id}}" ng-click="window.confirmdelete(order.id);">delete order</a>

or can add

$scope.confirmdelete = function(id) { homecoming window.confirmdelete(id); }

and can do:

<a href="~/order/delete/{{order.id}}" ng-click="confirmdelete(order.id);">delete order</a>

or create pass-through method global function:

$scope.callglobal(fn, params) { if (!angular.isarray(params)) { params = [params]; } homecoming window[fn].apply(window, params) }

which takes function name, , array of params (or, if 1 argument, can pass argument), , can do

<a href="~/order/delete/{{order.id}}" ng-click="callglobal('confirmorder', order.id);">delete order</a>

javascript angularjs

php - Online shopping cart with Laravel -



php - Online shopping cart with Laravel -

i using laravel , moltin/cart build cart scheme online store. far, have managed integrate cart scheme , go on paypal. though, in controller have constructor prevents user viewing, adding or removing items cart unless authenticated.

public function __construct() { parent::__construct(); $this->beforefilter('csrf', array('on'=>'post')); $this->beforefilter('auth', array('only'=>array('postaddtocart', 'getcart', 'getremoveitem'))); }

in order create paypal work had add together several hidden inputs in view necessary values , passing them paypal's paying page, so:

<input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="office@shop.com"> <input type="hidden" name="item_name" value="ecommerce store purchase"> <input type="hidden" name="currency_code" value="eur"> <input type="hidden" name="amount" value="{{ cart::total() }}"> <input type="hidden" name="first_name" value="{{ auth::user()->firstname }}"> <input type="hidden" name="last_name" value="{{ auth::user()->lastname }}"> <input type="hidden" name="email" value="{{ auth::user()->email }}"> {{ html::link('/', 'continue shopping', array('class'=>'btn btn-default')) }} <input type="submit" value="checkout paypal" class="btn btn-primary">

the problem user shouldn't logged in view, add together or remove items cart, asked login when submit button clicked. if remove filters constructor then, "trying property of non-object" error because of hidden inputs create utilize of auth class. have tried add together blade if auth::check status wasn't solution. suggestions?

answer

this did trick:

@if(!auth::check()) {{ html::link('users/signin', 'sign in pay', array('class'=>'btn btn-primary')) }} @else <input type="hidden" name="first_name" value="{{ auth::user()->firstname }}"> <input type="hidden" name="last_name" value="{{ auth::user()->lastname }}"> <input type="hidden" name="email" value="{{ auth::user()->email }}"> {{ html::link('/', 'continue shopping', array('class'=>'btn btn-default')) }} <input type="submit" value="checkout paypal" class="btn btn-primary"> @endif

also, removed filters constructor , changed redirection in sign in function, redirects accessed page.

using session variable hold visited url

in order go visited page need utilize session::put.

so, in getsignin function add:

session::put('previous_url', url::previous());

and in postsignin function need retrieve previous_url variable, stored in session, so:

if ( session::has('previous_url') ) { $url = session::get('previous_url'); session::forget('previous_url'); homecoming redirect::to($url); }

how replacing checkout button sign in button , redirect cart checkout again?

php laravel paypal