Posts

Showing posts from August, 2014

Exclude a few words from a simple regex in PHP -

i'm categorizing few folders on drives , want weed out low quality files using regex (this works): xvid|divx|480p|320p|divx|xvid|divx|xvid|xvid|divx|dvdscr|pdtv|pdtv|dvdrip|dvdrip|dvdrip now filenames in high definition still have dvd or xvid in filenames 1080p, 720p, 1080i or 720i. need single regex match 1 above exclude these words 1080p, 720p, 1080i or 720i. you can use negative lookahead this ^(?!.*(?:1080p|720p|1080i|720i)).*(?:xvid|divx|480p|320p|divx|xvid|divx|xvid|xvid|divx|dvdscr|pdtv|pdtv|dvdrip|dvdrip|dvdrip) this match on search strings, fail if there 1080p|720p|1080i|720i in string.

android ndk - WebRTC support on BlackBerry 10 -

are there webrtc libraries ported blackberry? if not, possible port android ndk code bb10 project? thanks in advance! webrtc free both paid , unpaid apps. currently, blackberry interested in delivering support webrtc , researching/investigating on technology. however, no dates or release schedules have been announced @ moment. depending on apis being used in android app. may or may not possible port android ndk code blackberry10. though android runtime not support webrtc projects, blackberry10 os built on qnx, compliant posix system. qnx compiler, qcc, has gcc-compliant mode port on existing code.

sql - PostgreSQL Mathematical Function -

i have table aps_sections many integer fields (such bare_width , worn_width ). have multiple tables (such aps_bare_width , aps_worn_width ) contain id column , weighting column. id recorded in above columns of aps_sections table. need sum weightings of columns in aps_sections table (whereby weighting value comes tables). have managed using below select statement. select aps_sections.ogc_fid, ( aps_bare_width.weighting + aps_worn_width.weighting + aps_gradient.weighting + aps_braiding.weighting + aps_pigeon.weighting + aps_depth.weighting + aps_standing_water.weighting + aps_running_water.weighting + aps_roughness.weighting + aps_surface.weighting + aps_dynamic.weighting + aps_ex_cond.weighting + aps_promotion.weighting + aps_level_of_use.weighting) calc row_access.aps_sections, row_access.aps_bare_width, row_access.aps_worn_width, row_access.aps_gradient, ro

regex - Qt 4.8.4 MAC Address QRegExp -

i'm trying qt match mac address ( 1a:2b:3c:4d:5e:6f ) using qregexp. can't seem match - doing wrong? i forcing try , match string: "48:c1:ac:55:86:f3" here attempts: // define regex match mac address //qregexp regexmacaddress("[0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2}"); //qregexp regexmacaddress("[0-9a-f]{0,2}:[0-9a-f]{0,2}:[0-9a-f]{0,2}:[0-9a-f]{0,2}:[0-9a-f]{0,2}:[0-9a-f]{0,2}"); //regexmacaddress.setpatternsyntax(qregexp::regexp); // ensure hexadecimal characters upper case hwaddress = hwaddress.toupper(); qdebug() << "string match: " << hwaddress << "matched it: " << regexmacaddress.indexin(hwaddress) << " exact match: " << regexmacaddress.exactmatch(hwaddress); // check mac address format if ( regexmacaddress.indexin(hwaddress) == -1 ) { in first example opening bracket missing , \. incorrect (read help explanations), in both a-f matches nothing, due &#

c++ - Simple insert-erase-insert on std::deque<char> gives strange result -

here simple program #include <iostream> #include <deque> #include <string.h> std :: deque <char> d; int main () { const char * x = "abcdefg"; d .insert (d .end (), x, x + strlen (x)); d .erase (d .begin (), d .begin () + 4); d .insert (d .end (), x, x + strlen (x)); std :: cout .write (& d [0], d .size ()); } i expected output "efgabcdefg", actual output, in hex, is 65 66 67 00 00 00 00 c9 0b 02 which "efg???????" what has gone wrong? the problem output deque has no guarantee elements stored contiguously, , in fact not be. means when take address of first element , size may not accessing elements of deque . you have multiple approachs solve problem. the simplest seems to use string instead of deque . printing becomes trivial, , cut-then-append trivial. you use example ostream_iterator print out contents of deque . finally use vector instead is guranteed store eleme

javascript - How to communicate Catalyst and Node.js -

how communicate between node.js , perl catalyst applications? i have 2 applications: node.js , catalyst. now these 2 applications communicate each other http. it's not fast , secure way. what way communicate its, local unix socket or other? what perl modules , node.js packages can use? a couple of options: zeromq - node binding ; perl binding dnode - perl dnode protocol support lots of possibilities message transport (e.g. rabbitmq) , network communication... sure nice stick http (on top of ssl/tls) of support come it.

push - Is there an effective working method for having two git repositories separated by network file transfer, but not ssh/http? -

i have git repository a on machine a (which in turn clone of "central" repository hosted development team). various reasons, don't develop on machine a (poor development tools), instead i'd develop on machine b . 2 are/can connected transferring files across network (i.e. virtual sneakernet), various complicated firewall-related questions outside scope of question, cannot connect them directly using ssh, http, or suchlike. connecting removable drive/usb stick etc. machine a not possible either. is there easy way me clone repository onto machine b , develop on local branch there several commits, , once i'm done, move/push changes branch onto corresponding branch on machine a transferring single file, rather connecting remote machine using git push / git pull etc.? in other words, can keep them in sync kind of delta file/package file/etc.? i have thought of flattening changes on machine b , using git rebase -i , 1 change, passing on diff, i'd pref

iphone - iOS How to tell the App Delegate to present a new view from the current view -

i have iphone application receives notifications when user not using application. when user clicks on notification, should brought new view when user opens application result of opening notification. the delegate method within app delegate use pass information notification is: -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo{ //pass data json payload in here //tell current view go new view } i believe reference last view controller user interacting before exiting application method go , storing object in nsuserdefaults . any suggestions on how implement appreciated. try nsnotificationcenter :) register observer push should done , fire notification appdelegate. take tutorial registration , firering ;) // appdelegate -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo{ //pass data json payload in here nsobject *obj = myinformationforthereciever; [

user interface - IOS resize UI after rotation (Is fill parent possible in IOS) -

Image
is possible make textfield or other ui fill screen width? "match_parent" or "fill_parent" in android. .. if not, right solution use "willrotatetointerfaceorientation" , every time calculate new size? 1) should read handling layout changes automatically using autoresizing rules view programming guide. 2) check size inspector in interface builder . check out these beautiful links : iphone rotation, view resizing , layout handling , understanding uiview autoresizing question : uiview autoresizing resources

actionscript 3 - AS3 Setting Visible Property of MovieClips -

can set "visible" property of movie clip every frame or should check current state of "visible" property decide if needs updated? is setting "visible" property same value cheap or not? please provide source. it doesn't matter. the visible property flag set , read next time displaylist renders. updating value doesn't other set internal property used drawing object value supply. can modify value of visible multiple times each frame , perform same. basically, when flash runs on of displayobjects have added displaylist, checks collection of flags , values each has, x , y , alpha , visible . uses these values determine drawing object. when make object not visible, happens flash skip object , not attempt draw it. for tidiness, stick not having if .

symfony - Site Map Generation Symfony2 Bundle -

does knows vendor bundle symfony2 sitemap generation minimal modifications. i think this article primer creating sitemap way - can see how can adapt specific needs required. (although think rather push route generation down template on general principle - way won't have pass hostname in.)

ruby on rails - EC2 - Gem bundler is not installed, run `gem install bundler` first -

i deploying rails app ec2 using capistrano, within deployment process, got ... error: gem bundler not installed, run `gem install bundler` first. command finished in 344ms *** [deploy:update_code] rolling ... i not sure what's problem, here's list of installed gems on ec2: bundler (1.3.5) rake (10.0.4) rubygems-bundler (1.1.1) rvm (1.11.3.7) ruby -v ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux] can give me tip how fix it? thanks can give details: are using rvm ? what rails version in gemfile ? gem version ? if using rvm, check gemset being used, remove .bundle , fresh $ bundle install gems. post entire o/p command $ gem list project folder.

c# - Distributed Transcations, DTCPING, How to set NetBIOS -

i'm microsoft distributed transaction coordinator write 2 different databases on separate servers not on same network. when attempt execute code inside c# transactionscope, following error: "communication underlying transaction manager has failed." i'm using dtcping.exe tool attempt ping remove server see why error. however, i'm being told need using netbios name of remote computer instead of ip address. however, i'm not sure how accomplish this, given 2 machines on separate networks. note - i've temporarily disabled windows firewall on both machines. i might wrong, believe add entry hosts file. http://technet.microsoft.com/en-us/library/cc751132.aspx

NoSuchMethodError: Matcher.quoteReplacement during sbt execution on Ubuntu -

i installed sbt typesafe repository suggested here : wget http://apt.typesafe.com/repo-deb-build-0002.deb sudo dpkg -i repo-deb-build-0002.deb sudo apt-get update sudo apt-get install sbt when run sbt i'm facing following error: ~/fun/sbt$ sbt starting sbt: invoke -help other options java.lang.nosuchmethoderror: method java.util.regex.matcher.quotereplacement signature (ljava.lang.string;)ljava.lang.string; not found. @ xsbt.boot.configurationparser$.substitutevariables(configurationparser.scala:22) @ xsbt.boot.configurationparser.id(configurationparser.scala:106) @ xsbt.boot.configurationparser$$anonfun$3.apply(configurationparser.scala:66) @ xsbt.boot.configurationparser$$anonfun$processsection$1.apply(configurationparser.scala:101) @ xsbt.boot.configurationparser.process(configurationparser.scala:102) @ xsbt.boot.configurationparser.processsection(configurationparser.scala:101) @ xsbt.boot.configurationparser.xsbt$boot$configurationparser$$a

c# - How to host Windows Service (like) in IIS -

how host windows service in iis , keep service runing running on windows? use feature wcf service? i've not access windows itself, iis. inside service i'll create thread @ scheduled time process data. in short, can't. a more detailed answer there 2 problems: iis worker processes launched when http request comes in. means can't start service system. iis worker processes recycled (i.e. restarted) on several conditions. example, worker process restarted if no http request comes in long time. means can't control when service shut down, unless have access application pool recycling configuration. keep in mind recycling logic ensures pending http requests complete, not await background threads complete. you can come partial solution way: create wcf service method checks if long-running thread alive , if not, starts it. create very simple windows service periodically (once in 5 seconds) calls method. deploy service somewhere, e.g. on own machin

TFS mapping the same for an entire development team -

Image
we're using tfs our source control , we're facing following problem. has mapped projects differently. causing builds break(as person1 has project/file references different person2). pass around piece of paper mapping printed out, , seems bit antiquated. so question(s) is: where vs store mappings each user? is there way enforce have same mappings(or pass out file map same)? the mappings stored in tfs , on client, they're not 'enforceable'. can create workspacetemplate. option available command line (by default). see tf.exe workspace /new /template . but team foundation power tools add feature team utilities page of team explorer: then can instruct team members use workspacetemplate when setting workspaces. you can copy/paste workspace definition notepad , copy/paste visual studio (quite nifty). you create small workspace analyzer find broken workspaces. tfs object model can used query workspaces stored on tfs server.

Cassandra atomicity/isolation guarantee in repair modes -

i know cassandra offers atomicity , isolation batch mutations on row-level basis since version 1.1 ( http://www.datastax.com/dev/blog/row-level-isolation ) but these guarantees hold repair mechanisms (hinted handoff, read repair , node repair)? i'd guess these operations use batch mutations , 1 can therefore state these guarantees hold. don't know code , therefore can't prove or disprove point. i neither have found source tells me atomicity , isolation guarantees aforementioned repair mechanisms. so maybe of can give me source or can justify if these guarantees hold in these cases? kind regards stefan repair works @ sstable level, not individual mutations. since individual mutation not split across multiple sstables, same isolation guarantee during repair.

regex - Python - Extract and reformat field names from rows of data -

i have flat text file (infile) restructure. has few tab-delimited columns , looks this: person1 height=60;weight=100;age=22 person2 height=62;weight=101;age=25 person3 height=64;weight=110;age=29 and want this: person height weight age 1 60 100 22 2 62 101 25 3 64 110 29 you can see second column contains several semicolon-delimited header/value fields, , want restructure them typical column header rows. right have: for line in infile: line = line.split("\t") line_meta = line[1].split(";") print line_meta i thinking best solution loop on line_meta variable, use use regular expressions detect header names (detect strings start multiple capital letters , ends "="_), add each header dictionary key, , store rest of string value. then, next row, if same header detected append existing dictionary. can code or provice feedback ho

python - error<0x275b990> - what does this mean -

i have function, i'm not familiar error or how correct it. def intify(file1): numbers=range(0,10) strnum=[] x in numbers: strnum.append(str(x)) number1=[] line in file1: split in line.split(' '): number1.append(split) listnum=[] x in number1: if x[0] in strnum: listnum.append(x) w=map(float, listnum) #return w print(w) error map object @ 0x275b990 error map object @ 0x275b990 it not error - print address of iterator, returned map . print list(w) make sure everything's alright. of course, should not return list(w) since unnecessary , expensive.

asp.net - More than one await in HttpTaskAsyncHandler -

Image
httptaskasynchandler nice base-class making async http-handlers in asp.net 4.5 wonder how runtime handles more 1 await statement in processrequestasync. public class callbackhandler : httptaskasynchandler { public override async task processrequestasync(httpcontext context) { int value1 = await task.factory.startnew(() => 1); int value2 = await task.factory.startnew(() => 2); int value3 = await task.factory.startnew(() => 3); context.response.write(value1 + value2 + value3); } public override bool isreusable { { return true; } } } is iis thread being put on hold 3 times? how test/see this? better wrap 3 awaits in asyn method? edit: concerned code take iis-workerthread 4 times handle request. if wrap in async method - performe better? msdn article this diagram explaining difference between sync , asyn page processing in asp.net. afraid example result in 3 threads being started main worker threa

angularjs - Require login per controller/view (Angular JS) -

parts of app require user validation done either automatically (using existing refresh token stored cookie) or manually using login form. while can implement using service feels rather hackish (the various services designed return data). can't think of better way share capabilities between different controllers. p.s did check out https://github.com/witoldsz/angular-http-auth catching 401 error , initiating login means make call though can tell fail. i think can break login process service, can incredibly important store , pass info various controllers in app, , precisely services for. i have created bug-reporting app using similar link pointed out, customized using service , controller well. these steps followed set up: first, set interceptor catch 401 errors , broadcasts message login required. i set authservice log bad 401 calls. if there bad call, gets stored. i have login controller uses authservice handles form, registration, login, logout, etc et

ruby on rails - Load en.yml before config.yml -

i work on ruby on rails application. reason need translate values config.yml file. here (simplified make short , readable): foo: bar: <%= i18n.t 'config.foo.bar' %> in en.yml : --- en: config: foo: bar: "translated bar" but when i'm trying start server, shows error message: translation missing: en.config.foo.bar i guess happens because config.yml loads before of files translations (including en.yml ). have alot of translations in on places , work fine. ideas how can force en.yml load before config.yml ? thanks.

reference knitr chunk in R markdown -

i'm using knitr embed r code within markdown (.rmd) file. i'm converting file pdf file pandoc. contents of .rmd file looks this: report ======================================================== report. analysis included in link chunk named my.analysis here ```{r my.analysis, echo=false} summary(cars) ``` where says link chunk named my.analysis here, able provide link code chunk named my.analysis in outputted pdf? i believe op asked similar, different question here: figure captions, references using knitr , markdown html do this: report ======================================================== report. analysis included in \href{http://stackoverflow.com/q/16445247/1000343}{link chunk named my.analysis here} ```{r my.analysis, echo=false} summary(cars) ``` and covert markdown file (not rmd) pdf. this works using devel version of reports : ```{r setup, include=false} # set global chunk options opts_chunk$set(cache=true) library(reports); library(k

gwt - Updating the content of dependency jar in Gradle -

i'm trying compile javadoc gradle application seems crash on 1 of dependencies. specifically, gwt-user-2.4.0.jar file. i've figured out problem lies in fact file contains both .class , .java files , it's trying compile java files. for i'm trying fixed until know how deal underlying problem removing .java files jar. i'm trying accomplish adding following code build.gradle : javadoc{ newjar = jar { ziptree("${project.configurations.compile.find{it.name == 'gwt-user-2.4.0.jar'}}") { exclude "**/*.java" } destinationdir = file("${project.builddir}/temp") basename = "gwt-user-2.4.0.new" } classpath -= files(project.configurations.compile.find{it.name == "gwt-user-2.4.0.jar"}) classpath += newjar } this doesn't seem work, , can't find in documentation on how copy content 1 jar or alike. have ideas on how this? tl;dr : how alter con

javascript - Show me if all inputs are empty -

i need build such 4 inputs must specified such if there nothing in name must appear trouble nothing written in name. i want want out of not have use such can create user or send email must have written in every input form. i have done this: <form action="#" method="post" name="kontakt_box"> <span id="myhint" class="info_box_kontakt"></span> <br /> <label>navn<br /><input type="text" name="navn" class="new" placeholder="navn"></label><br /> <label>efternavn<br /><input type="tel" name="efternavn" class="new" placeholder="efternavn"></label><br /> <label>email<br /><input type="email" name="email" class="new" placeholder="email"><

vb.net - WPF DataGrid / LINQ Query (DataGrid new row not visible) -

i'm relatively new wpf/linq2entities. i've managed make progress stuck on 1 issue i've been researching: 1) have wpf datagrid populated based on collectionviewsource. collectionviewsource's source linq query. private context new qadbentities dim qadbentitiesviewsource collectionviewsource dim salesorderserialnumber_query = salesorders in context.tblsalesorders join serialnumbers in context.tblserialnumbers on salesorders.sales_order_id equals serialnumbers.sales_order_id salesorders.sales_order_id = 5 select new {salesorders, serialnumbers} qadbentitiesviewsource = ctype(me.findresource("qadbentitiesviewsource"), collectionviewsource) qadbentitiesviewsource.source = salesorderserialnumber_query.tolist() here excerpt xaml datagrid: <datagrid x:name="tblserialnumbersdatagrid" autogenerat

java - Cancel selecting a file within JFileChooser without closing the dialogue -

i trying implement "save as" dialogue using jfilechooser . dialogue supposed give user ability type filename , click save, @ point new file object returned , created. this works, running problem when try add dialogue. specifically, want create "file exists" dialogue using joptionpane warn user if trying create file same name pre-existing file (this common feature in many programs). dialogue prompts "file <filename> exists. replace it?" (yes/no) . if user selects "yes", file object should returned normal. if user selects "no", jfilechooser should stay open , await selection/creation of file. the problem can't find way cancel selection (if user chooses "no") and keep dialogue open. have code: public void saveas() { if (editors.gettabcount() == 0) { return; } final jfilechooser chooser = new jfilechooser(); chooser.setmultiselectionenabled(false); chooser.addactionlisten

c# - how to catch id in aspx page in MVC -

Image
i'm working on mvc production project. in production details view have buttons more data database, need id of product. can see exist can catch it? here's controller return data: public actionresult details(long aproductionorderid) { productionorderlist item = new productionorderlist(); item = productionorderreg.getproductionorders(conn, aproductionorderid); viewdata["item"] = item; return view(); } here's details page when load, can see id, how catch , use in buttons in left bring more date ? you use hidden input on view page submit id. your view: <form method="post"> <button type="submit">button text</button> <input type="hidden" name="aproductionorderid" value="@viewdata['item']"> </form>

c# - Binding a ListBox to a List<string> -

i trying bind list of strings contents of list box. reason, results bluetape list, contents of bluetapelist not ever make listbox. appreciated! xaml: <listbox name="lbxtapein" grid.row="1" grid.column="1" grid.columnspan="1" width="70" height="80" selectionchanged="tapeselectionchanged" itemssource="{binding}" selectedvalue="{binding selectedbt}" background="deepskyblue" foreground="midnightblue" horizontalalignment="center" verticalalignment="center" margin="5"/> code behind: public partial class overrideaoibinningwindow : window { private overrideaoibinningwindowviewmodel ovaoibinwin; public overrideaoibinningwindow() { in

c# - Retrieve specific Uid from Selected ComboBoxItem in a ComboBox in WPF -

how can uid comboboxitem selected user? i have following code in xaml <combobox x:name="cmbcat" horizontalalignment="left" margin="210,163,0,0" verticalalignment="top" width="183" background="white"> <comboboxitem content="computing , it" uid="2001"/> <comboboxitem content="electrical" uid="2002"/> <comboboxitem content="stationery" uid="2003"/> <comboboxitem content="building" uid="2004"/> </combobox> and i'd specific uid, whichever selected user in combobox. you can uid setting " sectionchanged " event on combobox , getting value combobox item. xaml: <combobox x:name="cmbcat" horizontalalignment="left" margin="210,163,0,0" verticalalignment="top" width="183&q

javascript - jQuery: Hide tr of child td that contains ul + print? -

i have <table> <td> contain <ul> , want when specific button clicked, 2 things occur: parent <tr> of children <td> contain <ul> hidden the window printed after step 1 executed, <tr> containing <ul> hidden on printed sheet http://jsfiddle.net/emturano/s9ywl/ html: <table id="todo-list"> <tr> <td>entry no ul 1</td> </tr> <tr> <td>entry no ul 2</td> </tr> <tr> <td> <ul>i should hidden when printed</ul> </td> </tr> <tr> <td>entry no ul 4</td> </tr> </table><p> click print jquery: function () { $('#followup_a').click(followup); }); function followup() { $('#todo-list tr:has(td:has(ul))').hide(); window.print(); } first problem see line function () { . improper s

Android - webview - shouldOverrideUrlLoading not called - when user clicks links inside iframe -

in our app, using webview load external link inside view. loaded link using loadurl method , set webview client show preloader , webchrome client listen link change webview. url loaded inside webview. when link loading, there couple of iframes , inside have text link. onclick of link, page need opened in default browser , not inside webview itself. using min-sdk / api level 8 build project. below code snippet reference. oncreate attached webview client , webchromeclient webview , assigning url it. private class somwebviewclient extends webchromeclient{ public void onprogresschanged (webview view, int newprogress){ if(newprogress == 100){ } } } private class somwebviewdefclient extends webviewclient { @override public boolean shouldoverrideurlloading(webview view, string url) { intent intent = new intent(intent.action_view, uri.parse(url)); startactivity(intent); return true; } @override public void onloadres

c# - run a method on a Databinder.Eval object and convert to a string -

This summary is not available. Please click here to view the post.

magic numbers - SOLID principles, and hard code configuration inside a class -

i have noticed in lot of code lately people put hard coded configuration (like port numbers, etc.) values deep inside of classes/methods, making difficult find, , not configurable. is violation of solid principles? if not, there "principle" can cite team members why it's not idea? don't want "it's bad because don't it" having trouble thinking of argument. a argument against hardcoding tcp port number in class 'context independence' violation. goos , emphasis: context independence ... "context independence" rule helps decide whether object hides or hides wrong information . system easier change if objects context-independent; is, if each object has no built-in knowledge system in executes . allows take units of behavior (objects) , apply them in new situations. context-independent, whatever object needs know larger environment it’s running in must passed in . in specific case of context in

perl - Display array in multi-column table using template tookit? -

i have array of phone numbers. want display these numbers in table, 5 numbers per row. can in template toolkit without modifying data structure? you can use plugin template::plugin::table : [% use table(phone_numbers, cols=5) %] [% foreach row in table.rows %] [% foreach item in row %] [% item %] [% end %] [% end %] phone_numbers reference phone number array should passed template toolkit. example: ... $data->{phone_numbers} = \@phone_numbers; $template->process('example.tmpl', $data) || die "template processing failed: ", $template->error(), "\n";

ruby - Running new rails app *and* legacy app on top of the same database -

i'm working on project we're building several new rails apps intended launched running along side legacy app need use same database. legacy database uses oracle. i believe ideal cut-over cleanly , not have both new , legacy apps running on same db, in case it's not possible. legacy app large , runs pretty complex system that's core of business. intention replace bit @ time. but require launch rails apps each handling part of application -- , sharing database operating legacy app. i've looked around quite bit , haven't been able find definitive rails docs describing issues might run -- or if it's possible. know heroku supports running multiple rails apps pointing @ single database. i've found lots of discussion on people doing this, nothing pinpoints potential risks are. is possible? specific problems occur? edit: clarify, legacy application not rails-based. it's based on different technology. while possible, you'll have car

c# - Tool to find all methods and classes used from a specific assembly in .NET? -

i have xamarin.ios project references dll created bindings project. bindings project rather big , "hacky". want recreate bindings project time start minimum amount of methods , classes needed, instead of binding , fight way through typos , other issues. incrementally want add new stuff want have in use. there way in visual studio (or tool) scans solution , prints out all: classes used referenced assembly all methods , properties used these classes? that's managed linker :-) removes that's not being used. so could: a) enable link assemblies (or @ least make sure binding.dll linked when build against application); b) use tool show inside binding.dll e.g. il spy on windows or xamarin's studio assembly browser then fight way through typos , other issues i strongly suggest (now or later) create binding unit test project . find 99% of typos , other common mistakes in bindings. you'll save lot of time , make updating bindings lot

MATLAB: Iterate Through a Loop Array -

Image
in matlab, need create loop iterate through entire string array , plot. in other words, first iteration: loop steps montana value (23,45) , generates plot. second iteration: continue loop georgia value (54,75) , plot. third iteration: continue loop texas value (55,90) , plot. so, have 3 different plots each string. here array: a = {'montana','georgia','texas'}; with x values: x = [23, 54, 55] with y values: y = [45, 75, 90] thanks, amanda % input data = {'montana','georgia','texas'}; x = [23, 54, 55]; y = [45, 75, 90]; % plot points figure(1); plot(x, y, 'rx'); % adjust limits figure axis axis([0 70 0 100]); % label points text(x,y, a, 'verticalalignment','bottom', ... 'horizontalalignment','right'); the output figure

java - Syntax error on token ";" ... why? -

why there syntax error on line ( shown below ) ? thanks import java.util.stringtokenizer; public class tokenizer { public tokenizer() { } int n; string esempio = "ciao dodo sos"; stringtokenizer tok = new stringtokenizer(esempio); // <---- syntax error on token ";" while (tok.hasmoreelements()) system.out.println("" + ++n +": "+tok.nextelement()); } the compiler attempting associate stringtokenizer declaration while loop expecting opening brace { (for anonymous implementation block) rather semi-colon ; . you need use method rather have code in class block: int n = 0; string esempio = "ciao dodo sos"; stringtokenizer tok = new stringtokenizer(esempio); void dosomething() { while (tok.hasmoreelements()) { system.out.println("" + ++n +": "+tok.nextelement()); } } a while statement non-declarative statement must appear in method,

iphone - How to find the current location in google maps iOS? -

how can show in google maps current position of user? do have read form gps? to move current position have to: self.googlemapsview.mylocationenabled = yes; then can setup key value observer in viewwillappear method , location update location manager of googlemaps sdk. - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; // implement here check if kvo implemented. ... [self.googlemapsview addobserver:self forkeypath:@"mylocation" options:nskeyvalueobservingnew context: nil] } and observe property. - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context { if ([keypath isequaltostring:@"mylocation"] && [object iskindofclass:[gmsmapview class]]) { [self.googlemapsview animatetocameraposition:[gmscameraposition camerawithlatitude:self.googlemapsview.mylocation.coordinate.latitude

java - Load More Button Android with Limit and Offset -

i have implemented custom scroll view (not list view). using intent service hit server offset , limit , display result. instance. set offset = 0 , limit = first_batch (int first_batch = 15) first call. returning 15 names , details. , next intent service call. using offset = first_batch , limit = first_batch. retuning next 15 names, 15 30. , displaying load more button @ end of 30 names. here problem. once hit load more button, want display next 15 names, offset = first_batch + first_batch , limit = first_batch. , growing more ..... here implementation .... private void startname(){ intent getnamesearch = new intent(getsherlockactivity(), intentservice.class); getnamesearch.putextra("search_offset", 0); getnamesearch.putextra("search_limit", first_batch); getnamesearch.setaction(intentservice.action_get_namesearch); getsherlockactivity().startservice(getnamesearch); mcallback.oncreateprogressdialog(); getnamesearch = new intent(getsher

cocos2d iphone - why is userdata set to self? -

in several box2d code samples i've seen line of code: body->setuserdata(self); in search have not found explanation this. main purpose setting userdata self in box2d? usually assign visual object (ie sprite) userdata object of box2d body contact listeners. in case of contact callback, receive box2d objects. therefore contact's bodies , body userdata, in order send messages sprite represents body visually. for example if want run animation on sprite when collides.

Shopify Product Variant destroy is locked (HTTP code 423) -

i'm trying update existing variants on product. to this, first need delete existing variants due race condition issues on api side won't go here outlined here: https://groups.google.com/group/shopify-app-discuss/tree/browse_frm/month/2011-12/927b3c41f7effb44?rnum=231&_done=%2fgroup%2fshopify-app-discuss%2fbrowse_frm%2fmonth%2f2011-12%3ffwc%3d1%26 i http response code 423 (locked) when try delete variant. i'm using shopify ruby gem v3.0.3 fyi. can delete product , create scratch, not ideal. why deleting variant locked not deleting product? shopify_product = shopifyapi::product.find(id) shopify_product.variants.each{|v| v.destroy} every product in shopify must have @ least 1 variant. if try delete variant product has, shopify return 423 response code.

performance - absolutely NO functions surrounding a tstamp in a SQL? Hourly historical data query -

i need obtain specific hours data specific week day 10 weeks. db work on oracle. came following condtions time stamp field: to_char(hy.tstamp,'hh24')='10' , hy.tstamp > sysdate - 70 , mod(extract ( day sysdate-1) - extract ( day hy.tstamp), 7) =0 someone told me "absolutely no functions surrounding tstamp" (for performance reasons?). how specify conditions without operations on time stamp field? you can filter out time slices without functions or function indexes if join table of acceptable ranges. can create 1 on fly (note need functions create table, won't need them afterward): select trunc(sysdate + 6) - (7 * level) + interval '10' hour startat, trunc(sysdate + 6) - (7 * level) + interval '11' hour endat dual connect level <= 10 with today's date being 5/8/2013, give following: startat endat ------------------- ------------------- 05/07/2013 10:00:00 05/07/2013 11:00:00 04/30/2013 10:

javascript - Redirect page and auto-open some lightbox -

i have address: www.example.com/teste123 on page have redirect: <% response.redirect "http://www.example.com/index.asp?teste=true" %> so want? want if user access these address www.example.com/teste123, , page redirect root of website, open lightbox file inside... i found script variable on url: function geturlvars(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); for(var = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } var xxx = geturlvars()["teste"]; these return me true .. right... but.. how open lightbox if var xxx equal "true" ? there lots of tutorials on lightboxes can google , pick from. basic logic (assuming you're using jquery): <div class="my_light_box" style="display:none;&q

ios - Integer read from plist always returns 0 -

i'm trying value of integer number plist. nsstring *path = [[nsbundle mainbundle] pathforresource:@"prop" oftype:@"plist"]; nsdictionary *dict = [[nsdictionary alloc] initwithcontentsoffile:path]; int number = [[[dict objectforkey:@"root"] objectforkey:@"quant"] intvalue]; nslog(@"quant %d",number); the plist: <dict> <key>quant</key> <integer>5</integer> </dict> app runs value of number 0. have been reading various manuals whole day, can't find error.

salesforce - Clearing the value of a Multi-Select Picklist using API -

i have simple question - how use php soap api clear value of multi-select picklist in salesforce? can update other fields heart's content, if try , update field empty string, nothing. i know i'm missing simple this, can point me int right direction? you want add picklist field name sobject fieldstonull string array. this clear value.

Tracking the number of put/get methods on Map using the Java API -

how can track number of calls on , put methods on map?. i have seen somewhere jprofiler , must know if problem can solved using java api itself . couple of options come mind. if don't want change source code of application introspection way go. use profiler method invocations , see how these methods invoked. visualvm, jprofiler , others. if don't want use external application needs hook in aspect oriented programming. example aspectj. configure aspect method entries , log results. if want log calls own api can write wrapper around map implementation of choie , log invocations. of course need custom wrapper map related operations.

php - web service which provides stock market information -

i checking if there web services out there, can post ticker symbol , return me details symbol. if pass 'goog' tell me company name, current price, whether mutual fund, equity etc... i trying make php poc service can collate , show financial stock market information. any free service know of? i've had experience few of these service providers. favourite yahoo finance csv api. it returns formatted data based on url parameters provide. so example can post following: http://download.finance.yahoo.com/d/quotes.csv?s=goog financial information 'goog' ticker symbol. quick example yahoo: http://code.google.com/p/yahoo-finance-managed/wiki/csvquotesdownload also check out page examples of data can fetch: http://www.jarloo.com/yahoo_finance/ , examples include: ask, dividend yield, dividend per share, ask, previous close, open date, change , 100 more.

print out xquery sequence and exit -

is there way "die" in execution flow in xquery file , output nicely formatted printout of sequence variable? i'm trying like: return { fn:error(xs:qname("error"), $xml) } but doesn't quite seem work. thanks! based on comment (you need debugging) guess looking fn:trace function, described here http://www.xqueryfunctions.com/xq/fn_trace.html if want abort execution flow , output error in application should in fact use xquery exception handling.

Just an input in Python -

i've started learning python. first language, don't harsh on me if easy. can't figure out how solve this. i've programed: a=input("enter pyramid base size ") h=input ("enter pyramid height size ") p=a*a+2*a*h print (p) but comes out: enter pyramid base size 2 enter pyramid height size 2 traceback (most recent call last): file "d:\program files (x86)\python\pyramid.py", line 3, in <module> p=a*a+2*a*h typeerror: can't multiply sequence non-int of type 'str' the type of input received string equation, numbers needed. can convert input integer or float , math a = int(a) h = float(h) now might need check if input can converted number , can like: try: h = int(h) except valueerror: print 'the input couldnt converted integer' edit so, here code should like a = input("enter pyramid base size ") h = input ("enter pyramid height size ") try: = int(a) h = int(a

css - Bootstrap nav dropdown under wrong item -

alrighty, asked, here question reformatted: i using bootstrap. nav bar has drop-down. drop-down appearing under wrong nav item. this happening me on firefox 20.0 on 2010 macpro osx 10.8.3 it work on other browsers (chrome , safari) here links. nav item @ far right (zone tools) should have dropdown. image alone: tinypic.com/r/e0kqp/5 code put here. little funkyness because tried strip down nav bar, you'll gist. http://bootply.com/61045 i have more links, cannot put more 2 in @ time far. thank all. it looks problem in css.. .navbar .nav li { display: table-cell; width: 1%; float: none; font-size: 13px; } .navbar .nav ul li { display: table-row; width: 1%; float: none; font-size: 13px; } when remove works, you'll need figure out way center nav items. http://bootply.com/61059 p.s. - don't need include bootstrap scripts in bootply.

Android : Created System Notification. - Can you retrieve parameters on notification CLICK? -

i've created notification. when user clicks notification within android operating system, starts desired activity. calls oncreate on activity_send.class. question is, can access information regarding notification? title of notification, or id or possible pass parameters can set when creating notification can retrieve when calls activity?? the below code im using create notification... revised code private static void notice(string msgfrom, string msg) { intent intent = null; string title; taskstackbuilder stackbuilder = taskstackbuilder.create(appctx); title = "new message " + msgfrom; senduser = msgfrom; // sending message to? intent = new intent( appctx, activity_send.class); intent.putextra("from", msgfrom); intent.putextra("id",integer.tostring(noticecount)); if (whoscreen != null) { stackbuilder.addnextintent(whoscreen); } stackbuilder.addnextintent(intent); //pendingintent pintent = pendingintent.getactivity(appctx,notice

iphone - Stop mobile Safari from preloading HTML5 audio -

i trying mobile safari on , iphone 5 stop preloading html5 audio element. can see in server log still calling mp3 file though have preload set none . ideas on how stop or way around this? i'm trying keep log in mysql database, doing this, throwing things off. edit if try following code , check server log, you'll see audio still called. <audio preload="none" id="audio" src="mp3.mp3" type="audio/mpeg"></audio> from apple documentation: note: preload attribute supported in safari 5.0 , later. safari on ios never preloads. http://developer.apple.com/library/safari/documentation/audiovideo/conceptual/using_html5_audio_video/audioandvideotagbasics/audioandvideotagbasics.html#//apple_ref/doc/uid/tp40009523-ch2-sw9

orchardcms - Orchard CMS and Shibboleth authentication -

we're looking @ using orchard internal site. we use shibboleth initial authentication, makes post our site in format of http://domain/shibboleth.sso/{stuff} in our current asp.net mvc website needed modify global.asax following: routes.ignoreroute("shibboleth.sso/{isapiinfo}/{isapidetails}"); routes.ignoreroute("shibboleth.sso/{*pathinfo}"); unfortunately, orchard doesn't allow go route, after research looks requires handler added. via iis (server 2008 r2) added web.config within handlers group: <add name="shib" path="*.sso" verb="*" modules="isapifiltermodule" scriptprocessor="c:\{path}\isapi_shib.dll" resourcetype="either" requireaccess="script" precondition="integratedmode" /> i've tried couple different variations of this, , still no dice. since pulled down source anyway, tried going simple route of adding 2 routes.ignoreroute calls , re-buildi

Java file limit on OSX lower than in bash -

i've increased max files limit on macbook pro elasticsearch can work more files, isn't working. i run command 'ulimit -a' , says "open files" 100,000. can run simple shell script this: export counter=0 while (true) ; touch "/tmp/foo${counter}" ; export counter=`expr $counter + 1` ; done and i'm able create lots of files (over 60,000 before killed script). however, using java code create randomaccessfiles in empty sub-directory of "/tmp" directory, can make 10,232 files before error: java.io.filenotfoundexception (too many open files). here's java code: import java.io.*; import java.util.*; public class max_open_files { public static void main(string ... args) throws exception { file testdir = new file("/tmp/tempsubdir"); testdir.mkdirs(); list<file> files = new linkedlist<file>(); list<randomaccessfile> filehandles = new linkedlist<randomaccessfile&

Make a javascript canvas rectangle clickable -

i creating simple calculator. here is. done basic design confused on how make buttons clickable? 1 trick make div each button think there has simple way. please guide. <!doctype html> <html> <body> <canvas id="mycanvas" width="300" height="400" style="border:2px solid ;"> browser not support html5 canvas tag.</canvas> <script> var c=document.getelementbyid("mycanvas"); var ctx=c.getcontext("2d"); ctx.moveto(0,80); ctx.lineto(300,80); ctx.fillstyle="#333333"; ctx.fillrect(0,320,50,80); ctx.fillstyle="#333333"; ctx.fillrect(250,320,50,80); ctx.stroke(); </script> </body> </html> you can “press” drawn key on canvas listening mouseclicks , hittesting whether click position inside 1 of calculator key’s boundary. here code return true if mouseclick inside rectangle: function ispointinsiderect(pointx,pointy,rectx,recty,rectwidth,recthe