Posts

Showing posts from September, 2011

c# - Sort ArrayList with custom comparison -

i trying sort arraylist using c#. when arraylist contains comparable objects, possible sort using list.sort() need sort arraylist contains non-comparable objects. example, let's object ring , has attribute property price . need sort arraylist price order. if is possible select ascending or descending more helpful. thank you! blockquote arratdmon = **(arraylist)**hashtb[unixmon]; if (arratdmon != null) moncount = arratdmon.count; int[] arraymax = { moncount, tuecount, wedcount, thucount, fricount }; int maxvalue = arraymax.max(); kidattendance valmon = null; string montagname = string.empty; blockquote above array list sorted self. you can implementing icomparer interface:- public class ring : icomparer { public decimal price { get; set; } public int compare(object x, object y) { return ((ring)x).price.compareto(((ring)y).price); } } working fiddle .

java - Set Security Context within AuthenticationSuccessEvent Listener -

i working on web application uses spring security. using legacy database system, necessary write custom authenticationprovide r. after successful authentication, can load info on user, e.g. roles, available domains, etc. while logic can contained within authenticationprovider , have reasons factor out external location. so, wrote listener spring security authenticationsuccessevent : public void onapplicationevent(authenticationsuccessevent event) { authentication auth = event.getauthentication(); user user = (user)auth.getprincipal(); //custom userdetails implementation list<grantedauthority> newauthorities; //do stuff user , new authorities securitycontextholder.getcontext().setauthentication( new usernamepasswordauthenticationtoken(user, null, newauthorities); } the securitycontext changed within method, seem lose new authorities afterwards. in particular, within method, securitycontext contains usernamepasswordauthenticationt...

vb.net - How to connect Mysql server from another computer? -

i have created application in vb (visual express 2013). have connected application mysql localhost (same computer). can't connect computer in same network. please me connect... just replace databse connection string localhost server's pc name or ip address

c - how to call a function having pointers as arguments -

i trying call function int db5_disk_header(struct db5_raw_internal *rip, const unsigned. char *cp) { fprintf(openfile, "these headers %d b %d c %d", rip->a, rip->b, rip->c); ... } how call function in main() in c? read basic pointer operations in case: #include <stdio.h> struct db5_raw_internal { int a, b, c; }; int db5_disk_header(struct db5_raw_internal *rip) { fprintf(stdout, "these headers %d b %d c %d", rip->a, rip->b, rip->c); return 0; } int main(void) { struct db5_raw_internal x = {1, 2, 3}; db5_disk_header(&x); // pointer x using address-of operator (&) struct db5_raw_internal *y = &x; db5_disk_header(y); // y pointer (don't use &) return 0; }

jquery - jQM ui-hidden-accessible doesn't hide parent div -

<div id="foo"> <input type="text" id="myinput" class="ui-hidden-accessible"> <a href="#" onclick="myfunc()" data-role="button">bar</a> <ul id="search" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="search 1" ></ul> <ul id="search2" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="search2" ></ul> </div> i'm trying hide input field, jquery mobile adds ugly div around 100% width of page , 2px high (grey). possible hide css? use data-wrapper-class attribute apply custom classes input type. <input type="text" data-wrapper-class="ui-hidden-accessible custom-style"> the classes added parent div of input.

robotframework - On Ubuntu, How can I uninstall or remove the lower version of selenium? -

while using appiumlibrary robotframework, getting below error. error: importing test library 'appiumlibrary' failed: importerror: no module named switch_to here,pythonpath: /usr/local/lib/python2.7/dist-packages/selenium-2.44.0-py2.7.egg to resolve above error want try solution mentioned @ link " https://github.com/appium/appium/issues/2625 " asks remove lower version of selenium. i have 2 selenium folders @ below location. selenium folders: 1)/usr/local/lib/python2.7/dist-packages/selenium 2)/usr/local/lib/python2.7/dist-packages/selenium-2.44.0.egg-info how can remove the selenium other 2.44? no process required uninstall selenium. i deleted directory "/usr/local/lib/python2.7/dist-packages/selenium". resolved error robot framework.

objective c - IOS 8 ScrollView fixed content -

Image
hi developing ios application. using scrollview. encountered problem on ios version 8. added in following way scroll content inside. scroll in first picture looks steady. other images scrolling. nsarray *aimageurls = (nsarray *)[_datasource arraywithimageurlstrings]; if([aimageurls count] > 0) { [_scrollview setcontentsize:cgsizemake(_scrollview.frame.size.width * [aimageurls count], _scrollview.frame.size.height)]; (int = 0; < [aimageurls count]; i++) { cgrect imageframe = cgrectmake(_scrollview.frame.size.width * i, 0, _scrollview.frame.size.width, _scrollview.frame.size.height); uiimageview *imageview = [[uiimageview alloc] initwithframe:imageframe]; [imageview setbackgroundcolor:[uicolor clearcolor]]; [imageview setcontentmode:[_datasource contentmodeforimage:i]]; [imageview settag:i]; [imageview setimagewithurl:[nsurl u...

c# - StyleCop rule for different bracing style instead of just disabling it? -

1st , lets clear bracing style taste only - is, if team decides on taste, question (within reason). the problem when use tools stylecop (btw. there other c# tools stylecop? have impression rather singular in c# ecosystem?) stylecop, default, enforces bracing style, 1 in question found is: curlybracketsformultilinestatementsmustnotshareline , i.e. enforces void bla() { return x; } instead of void bla() { return x; } the team, however, really stick second style. the question ask myself now: can stylecop validate other rule, instead of just disabling rule? are shooting ourselves in foot deviating stylecop recommendation? you can create own rule validate specific style. take on tutorial: creating custom stylecop rules in c#

Querying Androids ContactsContract in Kotlin -

i having bit of trouble trying query contactscontract in android app written in kotlin. android studio gives errors unresolved references example contactscontract.contacts._id. know right way query these in kotlin? this open bug in kotlin. please refer to: https://youtrack.jetbrains.com/issue/kt-3180 . for use java access such fields workaround: public class contactssupport { public static interface basecolumns { public static final string _id = contactscontract.rawcontacts._id; public static final string _count = contactscontract.rawcontacts._count; } } so can write contactssupport.basecolumns._id in kotlin.

java - View Pager Android -

i'm trying implement view pager : http://developer.android.com/training/animation/screen-slide.html but seem have problem when comes creating page number. when debugging downloaded zip previous mentioned website, first method called create(int pagenumber) , afterwards oncreate() you're getting page number. in case, it's other way around, therefore null pointer exception. here current implementation of view pager: public class singlecheckindisplay extends android.support.v4.app.fragment { private checkin data; private fragmentmanager fragmentmanager; private list<checkinuser> enlooped; private textview checkinlocation; private textview checkindescription; private textview checkintime; private button cancelbtn; private imagebutton singlecheckinenloopbtn; private imagebutton singlecheckincancelbtn; private horizontallistview enloopedfriends; public static final string arg_page = "page"; private int mpag...

php - Query column for multiple values -

i have table looks 1 below, , doing search query multiple fields refine search job. @ moment able enter multiple fields, however, search results query entire database, not 1 specific id. table: contentid meta_key meta_value 1 1 vacancytype hospitality 2 1 vacancyrole chef 3 1 vacancydate 2014-01-01 4 2 vacancytype adin 5 2 vacancyarea st albans 6 2 vacancydate 2014-01-01 code: $getjobs1 = "select distinct * cms_contentextra, cms_content cms_contentextra.meta_value in ('$type','$key') , cms_content.contentid = cms_contentextra.contentid group cms_content.contentid"; $getjobs2 = mysql_query($getjobs1) or die("didn't query"); while ($getjobs3 = mysql_fetch_array($getjobs2)) { echo ' - ...

Is it possible to run a Neo4j cluster with strong consistency? -

the docs of neo4j state when running in ha mode, eventual consistency. quote page: all updates propagate master other slaves write 1 slave may not visible on other slaves my question is: there configuration allow me write cluster strong consistency, of course @ cost of reduced performance? i'm looking sort of active-passive failover cluster configuration. there such config option. ha.tx_push_factor determines how many slaves transaction should pushed synchronously. when setting ha.tx_push_factor=<clustersize>-1 have immediate full consistency.

haskell - Pretty Printing list of lists -

i have list of lists: [[5,1,0,0,5,5,0,0],[0,0,1,4,2,0,6,1],[1,1,6,3,0,1,0,0],[1,5,0,0,0,1,1,6]] and string "wxyz" i have: 1) w: 5 1 0 0 5 5 0 0 x: 0 0 1 4 2 0 6 1 y: 1 1 6 3 0 1 0 0 z: 1 5 0 0 0 1 1 6 i wrote: f c xs = putstrln (c : ':' : ' ' : concat (intersperse " " $ map show xs)) to write 1 line and 2) g xxs c = mapm_ (f c) xxs how can modify 2) loop through string "wxyz" in order have 1) ? instead of mapm_ , can use zipwithm_ control.monad : g xss cs = zipwithm_ f cs xss or, if change order of arguments in either f or g match, can less "points": g = zipwithm_ f also, concat (intersperse " " ...) otherwise known unwords ... .

matplotlib - Stuck with python multiple twinx axis graph using matlibplot -

hello i'm trying make graph 1 y axis , 4 x axis i don't want make separate graphs , wondering if possible put multiple x axis using twinx() command. the problem i'm having final axis i'm trying add ends appearing on both sides of graph , want on left. from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist aa import matplotlib.pyplot plt host = host_subplot(111, axes_class=aa.axes) par1 = host.twinx() par2 = host.twinx() new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right",axes=par2,offset=(60, 0)) par2.axis["right"].toggle(all=true) host.set_xlabel("y axis") host.set_ylabel("x axis 1 on left") par1.set_ylabel("x axis 2 on right") par2.set_ylabel("x axis 3 on right") par3 = host.twinx() new_fixed_axis = par3.get_grid_helper().new_fixed_axis par3.axis["left"] = new_fixed_axis(loc="left",axes=...

php - Laravel mail cannot send from field -

im trying send mail laravel , when add dynamic field error: "expected response code 250 got code "501", message "501 syntax error encountered in command argument.." this code: $user = input::get('user'); mail::send('template.contact', $user , function($message) use ($user) { $email = $user['email']; $message->from($email , 'name'); thats doesnt //$message->from('us@example.com', 'laravel'); work $message->to('test@gmail.com', 'contact us' )->subject($user['subject']); }); and user coming angular - service: this.sendconatctmail = function(data) { return $http.post('send-contact-mail', {user: data}); } and controller: contactservice.sendconatctmail($scope.user); here's 1 way can solve this. let's assume data on this.sendconatctmail = function(data) { object this: var data { email: 'some@ema...

php - Show multiple values from a row when dropdown box is used from mysql database -

i'm trying show specific item in row when item in dropdown list selected. clarify, lets have item1 chosen in dropdown menu, , when item1 chosen, want price item1 shown in field on page. ps. i'm trying make inventory , ordering form connected mysql database. thanks in advance. here php code. <?php function dropdown( $alcohol, array $options, $selected=null ) { /*** begin select ***/ $dropdown = '<select name="'.$alcohol.'" id="'.$alcohol.'">'."\n"; $selected = $selected; /*** loop on options ***/ foreach( $options $key=>$option ) { /*** assign selected value ***/ $select = $selected==$key ? ' selected' : null; /*** add each option dropdown ***/ $dropdown .= '<option `value="'.$key.'"'.$select.'>'.$option...

pandas - Show DataFrame as table in iPython Notebook -

i using ipython notebook. when this: df i beautiful table cells. however, if this: df1 df2 it doesn't print first beautiful table. if try this: print df1 print df2 it prints out table in different format spills columns on , makes output tall. is there way force print out beautiful tables both datasets? you'll need use html() or display() functions ipython's display module: from ipython.display import display, html # assuming dataframes df1 , df2 defined: print "dataframe 1:" display(df1) print "dataframe 2:" html(df2.to_html()) note if print df1.to_html() you'll raw, unrendered html. you can import ipython.core.display same effect

The best way to collect the Java-8 Stream to Guava ImmutableList -

i want stream immutable list. difference between following approaches , 1 better performance perspective? collect( collectors.collectingandthen(collectors.tolist(), immutablelist::copyof)); immutablelist.copyof( stream.iterator() ); collect( collector.of( immutablelist.builder<path>::new, immutablelist.builder<path>::add, (l, r) -> l.addall(r.build()), immutablelist.builder<path>::build) ); a few more parameters performance or efficiency, there may many entries in list/collection. what if want set sorted, using intermediate operation ".sorted()" custom comparator. consequently, if add .parallel() stream i expect 1) efficient: going via builders seems less readable , unlikely win on normal tolist() , , copying iterator discards sizing information. (but guava working on adding support java 8 things this, might wait for.)

How to return char* array in c/c++ function? -

following function prototype(we can't change prototype of function): char** myfun() { // implementation } how can return array of char* function can access/print content of array in caller of method. tried creating array using dynamic memory allocation,but not working. is possible without dynamic memory allocation. please provide me pointer? unless have global char*[] want return function, yes, need dynamic allocation, way can safely return variable created inside function, variables stored in stack destroyed function finishes. char** myfun() { char **p = new char*[10]; return p; //or return new char*[10]; } int main() { char **pp = test(); char *p = "aaa"; pp[0] = p; delete[] pp; //if allocate memory inside array, have explicitly free it: //example: pp[1] = new char("aaa"); require delete p[1]; } --edit you don't have use dynamic allocation, return local static variable. keep...

alignment - How to align the top of a view to half the parent view's height in Xcode 6.1 -

Image
i trying align top of white subview half height of container view in viewcontroller. see attached image. in old versions of xcode possible ctrl-drag view container view , select "top alignment container view", in new xcode 6.1 offer alignment "toplayout guide". used constraint , setup constraint can see in right hand side of image. based on reading, following equation applies: property1 = property2 * multiplier + constant. so wanted settings: view.top = toplayoutguide.bottom * 0.5 + 0 such top of white "view" aligns half height of toplayoutguide.bottom. however, when this, result ).5 totally ignored, , white view's top aligned toplayouguide.bottom, covering whole screen basically. can figure out doing wrong, , proper way align view's top half height of container? thanks -malena i encountered same problem xcode 6.1. found there several ways use storyboard editor split view (nearly) in half adding subview use sort of benchma...

eclipse plugin for hadoop 2.4.1 version -

i have installed hadoop 2.4.1 working , trying configure eclipse hadoop. dont see eclipse plugin hadoop 2.4.1 version. know pick plugin , use eclipse. i understand hadoop distributions have eclipse plugin in it, unfortunately 2.4.1 doesnt have far see. where eclipse plugin , eclipse-plugin version that an additional question on this, seeing .a files in hadoop/lib folder. , how open those, because suspect might have library jar files. there no official eclipse plugin hadoop project. https://issues.apache.org/jira/browse/yarn-1487 but can compiled per below tutorial https://github.com/winghc/hadoop2x-eclipse-plugin also, check out hadoop development tools (hdt) official hadoop eclipse plugin support. http://hdt.incubator.apache.org/

performanceanalytics - R: using apply.fromstart to calculate returns and standard deviation -

i find total return has made on period standard deviation of returns. have found function, apply.fromstart in performanceanalytics package, looks promising. am, however, having difficulty implementing it. here have: dataframe containing various data, including return per period: hourlydata time position 2014-08-01 01:00:00 1.01 2014-08-01 02:00:00 0.99 2014-08-01 03:00:00 1.01 2014-08-01 04:00:00 1.02 i find total return in each period, follows: period totalreturn 2014-08-01 01:00:00 1.01 2014-08-01 02:00:00 1.01*0.99 2014-08-01 03:00:00 1.01*.099*1.01 2014-08-01 04:00:00 1.01*.099*1.01*1.02 my code reads: apply.fromstart(hourlydata[,2,drop = false],fun="*",width=1) i find standard deviation of returns. code part reads follows: apply.fromstart(hourlydata[,2,drop = false],fun="sd",width=1) the data type of hourlydata$position "zoo" i gettin...

scala - How to find max value in pair RDD? -

i have spark pair rdd (key, count) below array[(string, int)] = array((a,1), (b,2), (c,1), (d,3)) how find key highest count using spark scala api? edit: datatype of pair rdd org.apache.spark.rdd.rdd[(string, int)] use array.maxby method: val = array(("a",1), ("b",2), ("c",1), ("d",3)) val maxkey = a.maxby(_._2) // maxkey: (string, int) = (d,3) or rdd.max : val maxkey2 = rdd.max()(new ordering[tuple2[string, int]]() { override def compare(x: (string, int), y: (string, int)): int = ordering[int].compare(x._2, y._2) })

c# - How to pass search criteria from one site to another site and load -

in application have address displayed on screen, have dropdown links when user clicks on link should open site in new tab , search address. lets have address "3301 s finely rd, chicago il" , link "www.zillow.com" how pass address site , load page? resolved creating passing parameters way zillow accepts. url generated when search property on zillow site. http://www.zillow.com/homes/{address}-{city}-{state}-{zip}_rb and opened using window.open()

laravel 4 - Get client_id and service_email from google analytics -

i developed web application need allow users embed google analytics dashboard. in order access analytics dashboard need client_id , service_email . is there way grab client_id , service_email using oauth , don't want force users manually create client_id can integrate dashboard. just mention i'm using laravel 4 . i what's issue here. you have set new project in https://console.developers.google.com . enable oauth access google analytics api. client_id , service_email referring developer's one, accessible under project > api & auth > credentials in dashboard . there's quite lot take in. i'll available clarify concepts you. references: https://developers.google.com/accounts/docs/oauth2 https://developers.google.com/console/help/new/

php - CURL Showing Different data and Original page showing different -

Image
i used scrap data different websites, came across issue original site showing different data when used curl fetch data showing different data. clarify point attaching screen shots of both pages. original image curl image do guys having suggestions point me doing wrong? site http://www.whatsthescore.com/ and curl request $url ='http://www.whatsthescore.com/'; $ch = curl_init(); curl_setopt($ch, curlopt_autoreferer, true); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_followlocation, true); $data = curl_exec($ch); curl_close($ch); echo $data; any suggestions ?

math - dual number magnitude and normalization -

i need figuring out how calculate magnitude of dual number , how use normalize number. the closest answer found this: properly normalizing dual quaternion however, there either error there or (more likely) not understand notation. reply post states magnitude of unit dual quaternion (still form of dual number) follows: qq' = (r, d)(r*, d*) = (rr*, rd* + dr*) = (1, 0) note dual number, not single value. have seen same result in many articles on dual quaternions, none of them explain why dual number 0 (zero). i assume that, if dual quaternion normalized, real , dual component quaternions normalized. in case, quaternion conjugate equivalent it's inverse, , rr* indeed = 1. if not normalized, rr* not = 1, do then? additionally, rd* + dr* not 0 (unless i'm reading notation wrong), rather rd* + dr* = [2(r.scalar)(d*.scalar) + 2dot(r.vector,d.vector), <0,0,0>] which quaternion non-zero scalar , "zero vector", speak. quaternion not of magnit...

arrays - Passing as a variable the individual columns of individual matrices in a list of matrices -

i want pass columns in various matrices loop. if 2 matrices had same number of columns, might this: mat1 = matrix(rep(1:25), 5,5) mat2 = matrix(rep(26:50), 5,5) array.mat = array(c(mat1,mat2), dim=c(5,5,2)) mat1.ncol = ncol(mat1) mat2.ncol = ncol(mat2) mat.ncol = c(mat1.ncol, mat2.ncol) mat.ncol array.mat (dimi in 1:2){ dim.col = mat.ncol[dimi] (coli in 1:dim.col){ st = shapiro.test(array.mat[,coli,dimi])$p.value if(st > .001){ array.mat[,coli,dimi] = log(array.mat[,coli,dimi]) }}} but, data don't have same number of columns, i'd use list of matrices instead. mat1 = matrix(rep(1:10), 5,2) mat2 = matrix(rep(26:50), 5,5) list.mat=list(a=mat1, b=mat2) list.mat but can't figure out how i'd pass columns of matrices? list.mat$a[1:5] gives first column of first matrix, how pass $a , [startindex:endindex] in loop? other answers see tend pass ith element (e.g., column) of both matrices. need keep 2 matrices (a , b) separate la...

java - Futuretask doesn't work -

i created futuretask in analog way presented in brian goetz's book java concurrency in practice (the code sample can found here , listing 5.12 ). the problem task times out if given 10 seconds. task returns true there shouldn't reason happen: public static void main(string[] args) throws exception { futuretask<boolean> task = new futuretask<>(new callable<boolean>() { @override public boolean call() throws exception { return true; } }); system.out.println(task.get(10, timeunit.seconds)); } this code prints: exception in thread "main" java.util.concurrent.timeoutexception @ java.util.concurrent.futuretask.get(unknown source) @ main.main(main.java:19) you haven't executed task. there never result available. javadoc states this class provides base implementation of future , with methods start , cancel a computation , query see if computation complete, , retr...

android - Can't Delete Contacts from Read-Only Accounts - Sync Adapter -

Image
i've created custom syncadapter , given following xml: <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" android:contentauthority="com.android.contacts" android:supportsuploading="true" android:uservisible="true" android:accounttype="@string/authenticator_account_type"/> thousands of searches has led me 'supportsuploading="true"' not case - contacts still being marked read-only. since of documentation has "self-explanatory" vibe (which not case), have no idea begin. please give me direction on this? edit: verified account in line google has set accounts: the problem turned out contacts information has set in particular way. includes having xml file contactsaccounttype definition, sync adapter xml file (sync-adapter) android:supportsuploading="true" set... , there appears no 1 particular solution - if no...

Convert android.support.v4.app.Fragment to regular android.app.Fragment? -

quick question. is possible convert fragment support v4 library fragment of regular app library? if so, how? i can't find information online this. hope not duplicate. no, different , can't convert 1 other. the v13 support library contains classes use android.app.fragment rather support fragments. specifically, android.support.v13.app.fragmentpageradapter allows use regular fragments viewpager .

html - Embed Website using iframe but iframe doesn't scroll on IOS -

i tring embed website website using iframe witch works greet on on ipad, scrolling seem lagging or not working. smoothing out scroll action , changing color of scrolls awesome! here code iam using <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <div id="scroller" style="height: 800px; width: 600; overflow: auto;"> <iframe height="100%" id="iframe" scrolling="auto" width="100%" id="iframe" src="https://docs.google.com/spreadsheets/d/1ziqcvuo27r73tijzqlkvcxdt3kg7kixqlyzrblt7_aq/edit#gid=512 365425" /> </div> <script type="text/javascript"> settimeout(function () { var starty = 0; var startx = 0; var b = document.body; b.addeventlistener('touchstart', function (event) { parent.window.scrollto(0, 1); starty = event.targettouches[0].pagex; startx = event.targettouches[0].pagey; }); b.addeventlistener(...

java - How to make JButton reference object when pressed? -

first off, first post stack overflow please forgive me if not following of proper etiquitte. im trying make gui program display different food genres , when user presses genre want show randomly generated restraunt of genre. new programming , having hard time figuing out how make buttons work. have assigned restraunts objects each value. mexican values 1 , 2. italian values 3 , 4. im wanting when user selects "mexican" program generate random number (the restraunts value attribute) between 1 , 2 , display object attributes in same window. i've been stuck on part bit , appreciated. thank in advance time. code have follows: import trysource.trywindow; import trysource.restraunts; import java.awt.flowlayout; import javax.swing.jframe; public class trysomethingnew { public static void main (string[] args) { trywindow frame = new trywindow(); frame.settitle("try new"); frame.setsize(1000,900); frame.set...

neo4j - get all transitive relationships from a node via cypher -

do know how write cypher query return transitive relationships related node. for instance if have : (node1)-[rel1]->(node2)-[rel2]->(node3) . i'd query that, given node1 returns rel1 , rel2 . thanks ! you need use variable path match, assuming start node node 1 having label label , name='node1' : match path=(node1:label {name:'node1'})-[*..100]->() return relationships(path) rels the relationships function returns list holding relationships along path. best practice provide upper limit variable depth matches, here i've set arbitrarily 100. update regarding comment below to id's of relationships: match path=(node1:label {name:'node1'})-[*..100]->() return [r in relationships(path) | id(x)] relids

iphone - Detecting which button clicked in prototype cell in ios -

i created 1 prototype cell. cell has 1 label , 1 button. have given tag's both. want detect button clicked 10 cells. previously differentiating based on tag. how prototype cell. my code cell creation follows: - (uitableviewcell *) tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cellidentifier"]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:@"cellidentifier"]; } uibutton *stopstartbutton = (uibutton *)[cell viewwithtag:103]; uilabel *charginglabel = (uilabel *)[cell viewwithtag:102]; } -(ibaction)stopstartbuttonclicked:(id)sender { nslog(@"button clicked"); } you can use button.titlelabel.tag differentiate button , @ action time can compare same tag. second option button action. can append event provide information regarding butto...

c++ - Building chromium on windows 8.1 using Visual Studio 2013 pro update 3 (or 4). -

i have been struggling 2 weeks build chromium following build instructions (windows) . specs are: windows 8.1 visual studio 2013 update 3 intel i7 cpu , 16gb ram every time build failed. tried many ways, after installing depot_tools after default way failed. set depot_tools_win_toolchain=0 set gyp_msvs_version=2013 set gyp_generators=msvs-ninja,ninja gclient runhooks ninja -c out\debug chrome one of error like: src\gin\function_template.h(152) : error c2059: syntax error : '' so, have following questions: 1) has build chromium on windows 8.1 using visual studio 13 pro update 3? 1.1) if yes, can give detailed instructions on installation sequence follow if matters, (1. visual studio, 2. directx sdk, 3. windows sdk etc. 4. depot_tools 5. fetch chromium 6. gclient sync .... etc)? 1.2) if yes, how can eliminate errors c2059? it says on website visual studio update 4 supported. http://www.chromium.org/developers/how-tos/build-instructions-win...

jquery - Regex in Javascript to remove nested paragraphs -

<p style="text-align: right;"> <p style="text-align: center;"> <p style="text-align: left;"> <p style="text-align:center;"> leave content </p> </p> </p> </p> <br> save content , last paragraph style has been applied, <p style="text-align: right;"> for concrete case provided try simple code: var elementtokeep = $('selectortoparagraph'); elementtokeep.html(elementtokeep.text()); for more universal cases you'll have use html parser.

rabbitmq - Can we use amqp://user:password@ instead of amqp://user:password@localhost for local connections? -

can use shortened syntax? i've been suggested usage of such short amqp url forces rabbitmq work in "direct" mode, more efficient. however, when changed local connections settings shovels that, don't see connections in connections list anymore. take here: https://www.rabbitmq.com/shovel-static.html specifically: if host omitted (not valid in general amqp uri), shovel uses direct connection broker in running. avoids using network stack

Updating field in nested documents in mongodb php -

i use mongodb php driver, convenience write query syntax, find more elegant solution found today following problem. i have collection "story" nested document: collection story: { "_id":"story1", "title":null, "slug":null, "sections":[ { "id_section":"s1", "index":0, "type":"0", "elements":[ { "id_element":"001", "text":"img", "layout":1 } ] }, { "id_section":"s2", "index":0, "type":"0", "elements":[ { "id_element":"001", "text":"hello world", "layout":1...

ios - how reference storyboard (current view) from another normal class -

i create animation in class (outside of normal view) called viewdidload method , make run on storyboard : how connect class effect class viewcontroller (storyboard) ?? class viewcontroller : uiviewcontroller { var effetto:effects = effects() override func viewdidload() { super.viewdidload() effects.typeeffects = 1 effects.createeffect } } class effects { var squareview: uiview! var gravity: uigravitybehavior! var animator: uidynamicanimator! var collision: uicollisionbehavior! var typeeffects = 0 func createeffect() { if var typeeffect = 1){ gravity() } else { other() } } func gravity() { squareview = uiview(frame: cgrect(x: 100, y: 100, width: 100, height: 100)) squareview.backgroundcolor = uicolor.bluecolor() viewcontroller.addsubview(squareview) ...

sql server 2012 - How to process SSAS objects in SSIS (single task or multiple sub tasks)? -

Image
i'm working on ssis , ssas build bi plateform. i develop ssis worflow process ssas objects. so, want use 'analysis services processing task` job. in case, there 8 cubes using more thant 15 dimensions (a dimension can used few cubes). should process ssas objets using 1 analysis services processing task or can split them different sub tasks. example, 1 package each sub task including 'analysis services processing task'. so example : package 1 - task 1 - processing dimensions package 2 - task 2 - processing cube 1 package 3 - task 3 - processing cube 2 ... is approach more efficient if 1 asp task can use parallel process ? thanks ! normally, go simplest way of running "process full" of complete database. analysis services takes care of dependencies, , uses multiple parallel threads process everything. , default, part of 1 single transaction, i. e. if fails, stays in original, consistent state, , users see original state during pr...

regex - How do I escape a single quote using C# string.Replace to use in HighCharts? -

in c# application using user input fill elements in highcharts. issue running when user types customer's causes application break unless escaped typing \ before ' . here section in highcharts filling in user input: subtitle: { text: '<%=strdescription%>' }, when adding records, instead of telling users type \ before typing ' want them automatically them when pull out of database , assign variable. here have tried: strdescription = reader1.getstring(0); strdescription.replace("'", "\'"); when remove slash user input causes application break if string not escaped. note following error: subtitle: { text: 'this goal set once have bench-marked first quarter's results.' }, how escape single quote properly? one way invert quotes - '' "" subtitle: { text: "<%=strdescription%>" },

javascript - OwlCarousel 2 function animate -

i'm using owl.carousel 2 (beta version). animate function fade effect works clicking on nav buttons. there function (or add code) changes images when click on image? can hide prev-next buttons. thanks. maybe this: var owl=$('.owl-carousel').owlcarousel({ items:4, loop:true, margin:10 }).click(function(){ owl.trigger('next.owl.carousel'); }) http://jsfiddle.net/sm6nc81z/2/

union - Simplify table with repeated entries MYSQL -

i have created table union of 2 select statements, friends_and_neighbors, , want remove repetitions of two, except not coincide in fields. simplifying case, have table called friends (that has pairs of users, , link id) , table user includes zip_code, neighbors section. i'm fixing reference user user_id = @usr , , zip_code = @zip . following. create table friends_and_neighbors (select user_id frnd_id, # choose neighbors zipcode. zip_code frnd_zip, # 0 frnd_link # reference friendship comes later. user zip_code = @zip) union (select frd.friend_id frnd_id, usr.zip_code frnd_zip, frd.link frnd_link friends frd join user usr on frd.friend_id = usr.user_id frd.user_id = @usr); then may counting neighbor/friends twice, still differ in frnd_link column, gave 0 because couldn't join two. want remove corresponding neighbor row has 0, when has been counted friend. thank help.

php - HTML repopulate input text or textarea with original text -

i want have text-field (input type="text") or text-area in html takes users input. after "submit" clicked, php returns results. want repopulate text-field or text-area original user input. code works text-field, not text-area: this works: <input type = "text" name = "seqbox" size = 50 placeholder = "enter sequence here" value = "<?php if(isset($_get['seqbox'])) {echo $_get['seqbox'];} ?>"> this not work: <textarea name = "seqbox" cols=100 rows=20 placeholder = "enter sequence here" value = "<?php if(isset($_get['seqbox'])) {echo $_get['seqbox'];} ?>"></textarea> any idea why? thanks! textarea doesn't have value property. need set in between element this: <textarea name = "seqbox" cols=100 rows=20 placeholder = "enter sequence here"> <?php if(isset($_get['seqbox']...

javascript - Dropzone.js - Setting Basic Parameters -

i trying implement dropzone.js custom cms. have no problems processing files needed in php, that's easy part. i need know how following on page-by-page basis (will use dropzone script in several pages different functions): restrict files types (jpg,jpeg,pdf) restrict number of files can uploaded (some pages 1 file, 100) restrict max file size redirect page or have 'next' button/link appear when file upload complete. can add @ bottom of page, while addressing settings: <script src="../assets/global/plugins/dropzone/dropzone.js"></script> <script> jquery(document).ready(function() { // initiate layout , plugins metronic.init(); // init metronic core components layout.init(); // init current layout demo.init(); // init demo features formdropzone.init(); }); </script> html: <div id="my-dropzone"></div> javascript: var initdropzone = function( filesallowed ){ dropzone.opt...

javascript - Insert DIV without knowing element classes -

i trying insert div on several positions in joomla websites; not in native articles in other components. positions are: after title below article right / left of article since every component has own layout , each template can use own setup (i think) cannot use default jquery functions append(), after(), etc because classes used reference can differ each component / template. in way possible make generic solution works (joomla) websites? thanks in advance! cheers, roy assuming can choose runtime instead of dynamically, best option here create joomla content plugin, since manipulations related articles. http://docs.joomla.org/plugin/events/content oncontentaftertitle 1st requirement, oncontentprepare or oncontentbeforedisplay 2nd , third.

mysql - explain this OOPS cpnecpt in php ..i dont get the 2nd echo $a becomes 30 -

why $a in 2nd echo becomes 30 when should 20 function &ref_return() { global $a; $a = $a * 2; return $a; } $a = 10; $b =& ref_return(); echo "a: {$a} / b: {$b}<br />"; $b = 30; echo "a: {$a} / b: {$b}<br />"; output: a: 20 / b: 20 a: 30 / b: 30 $a , $b referencing same address. first creating reference : $b =& ref_return(); now $a , $b identically. when next assign $b = 30 affects $a well.

java - if object collides with the same object -

i cant figure out how make collision same object same arraylist, not in lbgdx. possible? , how do that? how create objects: private static list<tree> objects = new arraylist<tree>(); (int = 0; i<400 ; i++ ) { objects.add(new tree()); } they spawn randomly around "player" , they're on top each other. tree class: public class tree { public textureregion sprite; public vector2 position; private int x, y, varx, vary; public int size; private random r; public boolean injunglex, injungley = false; public int mylevel; public rectangle objrect, objrectup; public rectangle playerrect; public boolean active = false; private int random, tolis=700; public tree() { gamerender.medis++; size = gamerender.tilesize*5; position = new vector2(x, y); r = new random(); random = r.nextint(2); int zenkas = r.nextint(2); if(assetloader.load){ position.y = assetloader.getint("treey"+gamerender.medis); pos...

javascript - Why do I get a type error when trying to access the value of an element stored in a variable? -

i’m having trouble storing input element in javascript variable. please see code below. commented out bits not work. code works is; however, not dry. overly verbose. storing element in variable clean things up, when attempt (and push value x array) “uncaught type error: cannot read property value of null ”. please see markup , script attached. why error when use variable form of document.getelementbyid , not when hardcode element on , over? javascript: var x = []; var y = []; //var xinput = document.getelementbyid("xinput"); //var yinput = document.getelementbyid("yinput"); //var databox = document.getelementbyid("display"); function insert() { x.push(document.getelementbyid("xinput").value); y.push(document.getelementbyid("yinput").value); clearandshow(); } function clearandshow() { //clear fields xinput.value = ""; yinput.value = ""; //show output document.getelement...

how can I load file.txt in matlab? -

i have folder contained several files in loc1.txt loc2.txt .... loc10.txt want use them in matlab code : for i=1:10 myfile =['e:\dis\locs\loc' '.txt']; b= importdata(myfile); but not work , output : 'e:\dis\locs\loc .txt' there body me here? you need convert i characters. myfile =['e:\dis\locs\loc' num2str(i) '.txt'];

Dr. Racket Recursion count occurrences -

i'm new racket , trying learn it. i'm working through problems i'm struggling with. here problem asking: write definition recursive function occur takes data expression , list s , returns number of times data expression appears in list s. example: (occur '() '(1 () 2 () () 3)) =>3 (occur 1 '(1 2 1 ((3 1)) 4 1)) => 3 (note looks @ whole elements in list) (occur '((2)) '(1 ((2)) 3)) => 1 this have written far: (define occur (lambda (a s) (cond ((equal? (first s)) (else (occur a(rest s)))))) i'm not sure how implement count. next problem similar , have no idea how approach that. here problem says: (this similar function above, looks inside sublists well) write recursive function atom-occur?, takes 2 inputs, atom , list s, , outputs boolean true if , if appears somewhere within s, either 1 of data expressions in s, or 1 of data expression in 1 of data expression in s, or…, , on. examp...

ruby on rails - Getting Susy to compile with Koala on windows -

just started using sass first time. set ruby on rails on windows 8, , got work , compile koala compiler allright. need use susy library, not working. far, i've installed following: 1. ruby, using ruby installer 2. gems: a. gem install rails b. gem install sass c. gem install susy this doesn't seem susy working. sass compiler keeps throwing errors whenever encounters susy syntax. on page mention make sure sass-rails version 5.0.0.beta1, ruby command prompt doesn't accept command such gem 'sass-rails', '~> 5.0.0.beta1' . have enter somewhere else? or need use different compiler? be gentle i'm new :d

c++ - Unwanted destructor call in std::swap -

i've run problem std::swap. have swap object. object releases memory in destructor. i've written move constructor , move assignment operator copies pointer memory. default constructor sets pointer null. of course, have regular copy constructor , assignment operator, allocate , copy memory, not want swap operation. when call std::swap, creates temporary object _left using move constructor. then, uses move assignment operator move _right _left, , finally, moves temp object _right. this looks when bottom of std::swap. however, when step out of bottom of it, destructor temp object runs, freeing memory _right object expecting have. what's normal accepted way this? hoping avoid having write swap functions since that's point of move constructors/move assignment operators. have use own swap() avoid this? the move operation should leave object being moved in destructible state, may different state how came move. if understanding problem right sound...

php - Not able to access zend framework 1.12 home page -

i trying use zend framework 1.12 on wamp 2.5. i took following steps create zend project on wamp:- created project using 'zf' tool command line. created entry in host file. 127.0.0.1 zendy.local added virtual host entry in conf\extra\httpd-vhosts.conf. <virtualhost *:80> documentroot "c:/wamp/www/zendy/public" servername zendy.local <directory "c:/wamp/www/zendy/public"> directoryindex index.php allowoverride require granted </directory> </virtualhost> enabled rewrite module but when try access zendy.local http 500 internal server error. excerpt apache error log [sat nov 15 09:19:13.739450 2014] [mpm_winnt:notice] [pid 3424:tid 552] ah00422: parent: received shutdown signal -- shutting down server. [sat nov 15 09:19:15.761937 2014] [mpm_winnt:notice] [pid 6832:tid 476] ah00364: child: worker threads have exited. [satnov 15 09:19:15.777562 201...

assembly - How to far jump to $0x9000:%ax using AT&T syntax? -

i'm writing toy os learn workings of it, here came little problem. want long jump, follows: ljmp $0x9000, *(%ax) the section address 0x9000, offset address stored in register ax (currently i'm still under real mode), i've tried following, none of them worked. ljmp $0x9000, ax ljmp $0x9000, %ax ljmp $0x9000, (%ax) ljmp $0x9000, *(%ax) so how trick? i'm using gnu (i686-elf-as). as alternative "nrz"'s method may push 0x9000 , ax , perform retf: pushw $0x9000 push %ax retf note: on original 8086s , 8088s "pushw $xxxx" instruction not exist...

ios - How can I hide the bottom bar when pushed but stay in the main view Controller -

i want hide bottom bar when press button or cell ( in table ) in main view controller push view controller , not when press button in bottom bar . , when main view controller i want bottom bar i tried code in main view controller : hidesbottombarwhenpushed = true but when press on item in bottom bar , main view controller bottom bar disappear, , same when go new view controller (by push main view controller), bottom bar in main view controller disappears. so far can see have hide bottom bar in prepareforsegue func in first view controller. code below works fine on side: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "yoursegue" { if let indexpath = tableview.indexpathforselectedrow() { if let destvc = segue.destinationviewcontroller as? targetvc { destvc.hidesbottombarwhenpushed = true } } } }

android - Unable to start activity ComponentInfo java.lang.NullPointerException File Browser -

i have copied class, opens dialog in order pick file, tutorial , don't know why throws me exception, can me? this class : import android.app.activity; import android.app.alertdialog; import android.app.dialog; import android.content.dialoginterface; import android.os.environment; import android.util.log; import java.io.file; import java.io.filenamefilter; import java.util.arraylist; import java.util.list; public class filedialog { private static final string parent_dir = ".."; private final string tag = getclass().getname(); private string[] filelist; private file currentpath; public interface fileselectedlistener { void fileselected(file file); } public interface directoryselectedlistener { void directoryselected(file directory); } private listenerlist<fileselectedlistener> filelistenerlist = new listenerlist<filedialog.fileselectedlistener>(); private listenerlist<directoryselectedlistener...