Posts

Showing posts from March, 2012

php - Loop through array and print HTML dinamcly for each element -

i trying loop through array contains objects , print out data need html. html needs print first element , afterwards "create" new html showing second element , on... this php function query db: public function getcuponesuser(){ $db = jfactory::getdbo(); $user = jfactory::getuser()->id; $query = 'select * #__cuphoneo_subscripcion cs left join #__k2_items k2i on k2i.id = cs.item_id cs.user_id='.$user.' group cs.item_id'; $db->setquery($query); $resultado = $db->loadobjectlist(); return $resultado; } this $resultado returns: http://pastebin.com/psx7kmbq and html/php code trying print data retrieved: <div class="panel-group" id="accordion"> <div class="panel panel-info"> <?php $model = $this->getmodel(); $cuponesusuario[] = $model->getcuponesuser(); foreach($cuponesusuario $valor){ ?> <div class="panel-heading" data-toggle=...

python - Must Kivy properties be used in all classes? -

classic common-sense programming says separate gui code core processing. started way in kivy, ran problem in first-round prototype. deck.py class card: def __init__(self, suit, value): self.name = "%s %s" % (suit, value) main.py from kivy.app import app kivy.uix.boxlayout import boxlayout kivy.properties import objectproperty deck import card class carddisplay(boxlayout): card = objectproperty(card("default", 0)) class boarddisplay(boxlayout): board = [[card("player1", 1), card("player1", 2), card("player1", 3), card("player1", 4)], [card("player2", 1), card("player2", 2), card("player2", 3), card("player2", 4)]] class gameapp(app): pass if __name__ in ("__main__", "__android__"): gameapp().run() game.kv boarddisplay: ...

php - Failure when passing a variable to a view CodeIgniter -

i trying pass $variable codeigniter controller view it's fail. my controller code is: class index_controller extends ci_controller { public function index(){ $formurl = base_url().index_page().'authorization_controller/authorization'; $attributes = array('class' => 'authorization','id' => 'authorization'); $this->load->view('header'); $this->load->view('leftframe', $formurl, $attributes); $this->load->view('rightframe'); $this->load->view('index'); $this->load->view('footer'); } } my view code is: <?php echo form_open($formurl, $attributes); ?> </form> error message: a php error encountered severity: notice message: undefined variable: formurl and a php error encountered severity: notice message: undefined variable: attributes you need pass data in array or object....

Android - SQLite query to look for the deleted flag - Exception DELETED column not found -

i'm trying filter out contacts , data android's contacts storage database. i'm using deleted filter. from here says there access using data.deleted either i'm doing wrong can't figure out or documentation seems wrong. i'm using cursor each query , don't know 1 causing exception. here cursors: final cursor cursorphonenumber = contentresolver.query(phone.content_uri, projectionphonenumber, data.mimetype + " =? , " + phone.deleted + " != 1", new string[]{phone.content_item_type}, phonequeryorder); final cursor cursorstructuredname = contentresolver.query(data.content_uri, projectionstructuredname, data.mimetype + " =? , " + data.deleted + " != 1", new string[]{structuredname.content_item_type}, null); final cursor cursor = contentresolver.query(data.content_uri, projectionemail, data.mimetype + " =? , " + data.deleted + " != 1", new string[]{email.content_item_type}, null); final cursor ...

How to update Estimated time of issue for user in Jira using Groovy -

i tried add worklog: import com.atlassian.jira.issue.issue; import com.atlassian.jira.issue.mutableissue; import com.atlassian.jira.issue.issuemanager; import com.atlassian.jira.component.componentaccessor; import com.atlassian.crowd.embedded.api.user; import com.atlassian.jira.event.type.eventdispatchoption; import com.atlassian.jira.util.importutils; import com.atlassian.jira.issue.worklog.worklogmanager; import com.atlassian.jira.bc.jiraservicecontextimpl; import com.atlassian.jira.bc.jiraservicecontext; import com.atlassian.jira.componentmanager; import com.atlassian.jira.bc.issue.worklog.worklogservice; import com.atlassian.jira.issue.worklog.worklog; import com.atlassian.jira.issue.worklog.worklogimpl; boolean condition = false; issuemanager = componentaccessor.getissuemanager(); issue myissue = issuemanager.getissueobject("gym-2109"); worklogmanager worklogmanager = componentaccessor.getworklogmanager(); for(int i=0; i<=4; i++) { worklog = new worklogimp...

c++ - Ball of Light (Light, Material?) glutsolidsphere -

Image
i'm programming game called falldown. i'm finished; want design ball. how can light ball such glows these examples? i created cube glutsolidsphere , ask myself how can light ball. void ball() { glcolor4f(0, 0, 0.5, 0.5); glutsolidsphere(0.25,40,40); } void initlightsources() { ?????? glenable( gl_lighting ); glenable(gl_depth_test); glenable( gl_light0 ); }

php - Get checkbox value in a html form -

the part of form post goes this: <input type="checkbox" id="somevalue1" value="somevalue1" class="css-checkbox" name="checkbox1" /> <input type="checkbox" id="somevalue2" value="somevalue2" class="css-checkbox" name="checkbox2" /> now want make php/mysql script posts every selected value, if somevalue1 selected , form posted puts somevalue1 in table, if both values selected puts somevalue1 in table and puts somevalue2 in table. summed up: want values of checked checkboxes change name checkbox checkbox[] . change single value in $_request array of values in $_request .

jquery - Find out where a "#" link is pointing? -

i have link here <a href="#" id="gallery_search" data-filter=".<?php echo $filterclass; ?>"><?php echo strtoupper($ui); ?></a> when click it, reloads page (without refresh) , shows different result based on data-filter is. pretty simple. problem i'd find out link leads can alter it, , go straight it. my domain http://explorerhinelander.com/rsd (wordpress installation) when try go http://explorerhinelander.com/rsd/#gallery_search not load page in same way if clicked link. reloads whatever there. i need know how url of link leads. firebug shows it's "#". in down of page have next script jquery(function () { jquery("#gallery-bank-thumbnails_3413 > > div.gb_overlay").addclass("animated overlay"); jquery(".imgliquidfill").imgliquid({fill: true}); jquery("#holder_3413").jpages({containerid: "gallery-bank-thumbnails_3413...

Converting supported image/texture memory format information to readable string in opencl -

i want supported image formats of device. opencl function returns results in cl_image_format. want know results in string. currently using following code: cl_uint uinumsupportedformats = 0; // 2d clgetsupportedimageformats((cl_context)image.clcxt->oclcontext(), cl_mem_write_only, cl_mem_object_image2d, null, null, &uinumsupportedformats); cl_image_format* imageformats = new cl_image_format[uinumsupportedformats]; clgetsupportedimageformats((cl_context)image.clcxt->oclcontext(), cl_mem_write_only, cl_mem_object_image2d, uinumsupportedformats, imageformats, null); for(unsigned int = 0; < uinumsupportedformats; i++) { cout<<imageformats[i].image_channel_order<<endl; cout<<imageformats[i].image_channel_data_type<<endl; } delete [] imageformats; right getting integer val...

How to use the DriveApi.OnSyncFinishCallback (Android's Google Play Services) -

the android's developer documentation states can use driveapi.onsyncfinishcallback (presumably) handle when synchronization between local contet , google drive account completed. such synchronization appens automatically, trasparently managed google play services, apparently can force sync request call to: drive.driveapi.requestsync(mgoogleapiclient); i "apparently" because official documentation of function poor, @ least ( https://developer.android.com/reference/com/google/android/gms/drive/driveapi.html#requestsync(com.google.android.gms.common.api.googleapiclient) ) anyway, onsyncfinishcallback can instantiated code: onsyncfinishcallback mycallback = new onsyncfinishcallback(){ @override public void onsyncfinish(com.google.android.gms.common.api.status arg0) { // todo auto-generated method stub } }; my question , how can register callback called automatically when sync completed? requestsync call returns pendingresult have setresult...

Imacros, search source -

i not expert on imacros search source command, tried looking text on source page extracted.. <div id='keywordsdiv' name='keywordsdiv' class='r-sidebar'> <dl class="list normal-text"> <dt class="key">category</dt> <dd class="value"><a class="black" href="http://www.abcd">abcd</a> &nbsp;</dd> <dt class="key">style</dt> <dd class="value"><a class="black" href="http://www.def.com/">def</a>&nbsp;</dd> <dt class="key">location</dt> <dd class="value"><a class="black" href="http://www.ghi.com/">ghi</a>&nbsp;</dd> <dt class="key">keywords</dt> ...

javascript - What does a closed-over variable mean? -

this question has answer here: how javascript closures work? 89 answers the example below taken a stackoverflow answer helps identify closure. for (var = 0; < 10; i++) { (function f() { var i2 = i; settimeout(function g() { console.log(i2); }, 1000); })(); } the following explanation given: for g: list variables: console free variable. i2 free variable. find parent scope each free variable bound: console bound global scope. i2 bound scope of f. in scope function referenced? scope of settimeout. hence console not closed on g. hence i2 closed on g. however not able understand bolded part - explain me? the term "closed-over" variable in post means variable not accessible caller of function; neither seen nor modifiable context function being called. let's modify code...

php - cannot insert the right values into table -

i have database named user_job_apply(id, job_id, postby_id, applier_id, flag, flag_wall, time_apply) . the "time_apply" type in database set :datetime my problem following piece of code inserts suceesfully in databe, not insert value $timestring . when in database shows 0000-00-00 00:00:00. idea problem here? i have tested echoing $timestring , displays date , time success, cannot pass database. idea how fix this? <?php // next 2 values comes form $the_job_code = mysql_real_escape_string($_post['jobid']); $the_postedby = mysql_real_escape_string($_post['postedby']); // use current time user's computer $timestring= ' <script language="javascript"> var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10) { dd="0"+dd } if(mm<10) { mm="0"+mm } today = mm+"/"+dd+"/"+yyyy + " "...

css - Header breaks a apart when resizing browser window -

i've got simple page header element consisting of logo image within anchor tag nested in h1 element , nav element 4 links. below i've got 2 elements each holding image , text. i'm wondering why header breaks apart when resize browser window, , why text not wrap around respect images , landing right of them. i've noticed when hover passed logo there's slight area still link shouldn't be. i'd appreciate assistance here, i'm looking understand what's happening under hood css. http://s27.postimg.org/7eyff3ivn/header_break1.png http://s28.postimg.org/fwg9lohjh/header_break2.png html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>acme</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <link rel="stylesheet" href="layout....

javascript - How to inject an entire module dynamically in AngularJS? -

alright, i'm trying set-up $httpbackend use mock server local development against api. have 2 services in separate modules: search , searchmock: search returns $resource object exposes api verbs when in staging or production environments, , works expected searchmock exposes $httpbackend which, in turn, responds mock json objects, , works expected itself i have service, apiinjector, determines current environment based on config file that's included dynamically grunt when app built , injects either search or searchmock accordingly. my problem is, far can tell searching high , low, $httpbackend needs set-up within module's run method. problem can't inject run method within apiinjector's conditional logic. how can expose $httpbackend if dev environment condition met, , $resource service otherwise? note didn't include calling controller's or searchservice's code, can if needed clarification. searchmock: var searchmockservice = angular.modu...

ios - How do i loop an nsobject once saved to -

i using nsmutablearray store items in list form web service. how read data out of array display random quote. as trying avoid hitting webservice twice or on complicating it? nsinteger randomint = arc4random_uniform(3); nsstring *baseurl = @"http://movie-quotes.herokuapp.com/api/v1/quotes"; nsstring *webserviceurl= [nsstring stringwithformat:@"%@/%ld", baseurl,(long)randomint]; randomquotes = nil; dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); dispatch_async(queue, ^{ // load json string our web serivce (in background thread) nsdictionary * dictionary = [jsonhelper loadjsondatafromurl:webserviceurl]; dispatch_async(dispatch_get_main_queue(), ^{ randomquotes = [nsmutablearray array]; // iterate through array of quotes records in dictionary (nsdictionary * onequote in dictionary) { quotes* newquotes =[[quotes alloc] init]; // add our new customer r...

PHP CSV Export With MetaData -

i have basic order system i've built in php. each product can have unlimited number of metadata entries (containing information product). want build csv export include each metadata option column in export file. export should contain metadata products in order. for example, if have following array: order = array( 'product1' => array( 'name' => 'tshirt', 'metadata' => array( '1' => array( 'key' => 'size', 'value' => 'm' ) ), 'product2' => array( 'name' => 'backpack', 'metadata' => array( '1' => array( 'key' => 'waist', 'value' => '50 cm' ), '2' => array( 'key' => 'height', ...

html - Table <colgroup> min-max-width ignored -

having http://jsfiddle.net/ihtus/ecu4x/ for 1st column: min-width: 100px; max-width: 200px; but if minimize browser window, 1st column width getting less 100px. need have col widths in range 100-200px. workaround? tried remove table-layout:fixed; from table style, , seems make col have min-width... http://jsfiddle.net/ihtus/mggz9/

model view controller - Where is logic/behavior placed in when using an MVC pattern? -

assume friend , writing chess-game android , want use mvc pattern. i have no experience mvc pattern, , not sure implement core logic , ui behavior. where must logic located (such validating , making move)? where must ui behaviors located (such animating game board , pieces)? model = data objects represent game (such player info, board, pieces , scores, virtually no logic/behavior) view = ui elements, ui behaviors (such animations, updating graphics, etc) - nothing qualifies business logic, state management, nor persistence. views "reactive" , "interactive" meaning change based on model changes, , user uses them interact 1 or more controllers. controller = validation, logic, model/state management, persistence, etc. controller expose methods view can invoke actions (such moving peice). upon invoking these action methods model may change, in response model changes view should update (usually through data-binding, event, well-known registered ...

android - Edit Text in custom List View Loses Value on Scroll -

i know it's duplicate question, didn't find proper answer. in custom list-view having 2 textview , 1 editext, when inserted value in edit text , scroll loss value of edited text. , when pass string value adapter through list adapter show blank edit text. here adapter code: class createadapter extends arrayadapter<string> { string[] stritecode=null; string[] stritem; string[] strquantity,text; context context; int temp; createadapter(context context, string[] stritemcode, string[] stritem, string[] strqauntity) { super(context, r.layout.create_list_item, r.id.txtitemcode, stritemcode); this.context = context; this.stritecode = stritemcode; this.stritem = stritem; this.strquantity = strqauntity; text= new string[stritem.length]; } public view getview(int position, view convertview, viewgroup parent) { v...

html - How to properly center align whats inside this table element? -

Image
i trying edit this webpage here . i novice front end developer , still trying learn. coworker created site copying template site thats why code screwy , unorganized (sorry!). basically center element near bottom shown below: and believe relevant code below, on line 263:- <tr> <td colspan="3"><div align="center"> <p><a href="https://www.onlinebusinessbureau.com/companyrating.cfm? company_id=1843849"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="80" height="124" id="sealtracker" align="middle"> <param name="allowscriptaccess" value="samedomain" /> <param name="movie" value="https://www.onlinebusinessbureau.com/sealtracker.swf?company_id=1843849" /><param n...

html - CSS background color not appearing -

my webpage has footer 4 separate footer cols. separated 5px margin on right , left side. have green background. footer (containing element) has red background not appear. validated html , not find problem xhtml markup i'm assuming it's css woe. fiddle: http://jsfiddle.net/48dk6/ footer css declarations. /* footer , descendants */ #footer { font-size:1.3em; margin-top:10px; clear:both; background-color:red; } /* footer col styling/positioning */ .footercol { background-color:green; width:180px; float:left; margin:10px 5px 10px 5px; } add overflow:auto #footer css: #footer { font-size:1.3em; margin-top:10px; clear:both; background-color:red; overflow:auto; } jsfiddle example this restore behavior seek, caused children .footercol divs being floated. floating child divs removes them normal flow, parent behaves if there nothing contain.

mysql - SQL delete all rows for all children -

is possible in mysql delete children recursively based on parent table? suppose have +-------+ |tbl1.id| +-------+ +-------+--------------------------+ |tbl2.id|tbl2.parentid (fk tbl1.id)| +-------+--------------------------+ +-------+--------------------------+ |tbl3.id|tbl3.parentid (fk tbl2.id)| +-------+--------------------------+ now, can't delete rows tbl1 because tbl2 has references tbl1.id, , can't delete tbl2 because tlb3 has references tbl2. is possible generate sql query using mysql list order tables have deleted? or lists dependency of tables, starting farthest child? i don't want drop tables, delete rows of set of tables , children, , children, ... currently have several scripts, 1 per parent table delete children, i'd automate that. edit 1: database in development mode, new tables , constraints still being added it. i don't own database, doesn't have cascade delete. could add cascade delete copy sent me, work us...

partition - getting a specific row over a partitioned sql query -

i know can first_value() , last_value() on partitioned sql query ordered column know, let's want second value, or third... there function so? in advance. as far know, there no specific function that. can select second row this: with row_numbers as(select row_number() over(order yourcolumn) 'row', * table) select * row_numbers row=2

c++ - Reading the binary content of a file -

this question has answer here: what best way read entire file std::string in c++? 11 answers i have university assignment , need have sort of function detects presence of binary sequence (in case, should "virus" signature -> assignment create sort of antivirus checks files viruses ) in file. believe need whole binary content of file, , check presence of signature. problem every function found gives me content of file, not raw binary data. ideas how should proceed this? ! i think use: istream::read

python - tornado webserver unlimited subprocess forking -

http://tornado.readthedocs.org/en/latest/tcpserver.html#tornado.tcpserver.tcpserver.start http://tornado.readthedocs.org/en/latest/httpserver.html server = httpserver(app) server.bind(8888) server.start(0) # forks multiple sub-processes ioloop.instance().start() when set 0 in server.start(), tornado forks maximum of x subprocesses (where x equals numbers of machine cores, in case have 4.) to test it, have 2 controllers, 1 controller (a) sleep(9999), , other quick controller (b) returns "hello world" when make 3 concurrent request controller a, + 1 request b controller, works fine, "hello world" returned. but when make 4 concurrent request controller a, + 1 request b controller, b request waits. how can no limit number of forks? thanks! there isn't option fork unlimited number of subprocesses. documentation states this: if num_processes none or <= 0, detect number of cores available on machine , fork number of child proces...

javascript - Email form not sending -

i"m having trouble getting email form submit. email.php file in root directory , looks this: <?php $val= $_post['val']; $toemail='someone@gmail.com'; $name = $val['name']; $email = $val['email']; $msg = $val['msg']; $subject = 'message zachjanice.com'; $headers = "from: zachjanice.com \r\n"; $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; &nbsp; $message = "<b>name :</b>".$name."<br>"; $message .='<b>email :</b>'.$email."<br>"; $message .='<b>message :</b>'.$msg; mail($toemail, $subject, $message, $headers); echo "thanks contacting me!"; ?> i'm using validate.js validate form , bootstrap style. here html: <form class="contactform" role="form"> <div class="form-g...

computer vision - Essential Matrix from Fundamental Matrix in OpenCV -

i've computed fundamental matrix of stereo pair through corresponding points, found using surf. according hartley , zisserman, essential matrix computed doing: e = k.t() * f * k how k? there way compute e? i don't know got formulae, correct 1 e = k'^t . f . k (see hartley & zisserman, §9.6, page 257 of second edition) k intrinsic camera parameters, holding scale factors , positions of center of image, expressed in pixel units. | \alpha_u 0 u_0 | k = | 0 \alpha_u v_0 | | 0 0 1 | (sorry, latex not supported on so) edit : values, can either: calibrate camera compute approximate value if have manufacturer data. if lens correctly centered on sensor, u_0 , v_0 half of, respectively, width , height of image resolution. , alpha = k.f f: focal length (m.), , k pixel scale factor: if have pixel of, say, 6 um, k=1/6um . example, if lens 8mm , pixel size 8um, alpha=1000 computing e sure, there several ...

entity framework - Storing arbitrary complex objects in c# to database -

i programming multiple api's. till have created classes use ef syntax (id = classnameid etc...) , convert whatever item being returned ef object. since i'm using c# wrappers (created whatever company created api) api's can't alter whatever class want store database use ef syntax. there project allow me dynamically generate tables , columns generic object using run time reflection? keep in mind many of complex objects have within them complex objects. as of right i'm considering writing script generate inherited classes each of complex types (identified via reflection) , inserting id (and whetever other information ef need generate db) inherited class. little complicated require implicit conversions ienumerable ienumerable. any appreciated. thank you. what need schema-less database, mongodb or ravendb instead of relational. these allows said in title: store arbitraty complex objects in db.

How to open an .as file in Flash CC and jump to a particular line / column? -

so if, instance, wanted open .as file in notepad ++ cursor lined @ 15th character of 10th line, command might this: c:\program files (x86)\notepad++\notepad++.exe filename.as -n10 -c15 what's equivalent flash ide? (i know kind of tangentially programming question, seemed applicable place it.) adobe has improved flash ide flash cc it's still not text editor or featured code editor. no can't that. many people using flash ide, code on side free code editor flashdevelop avoid using flash ide purpose.

c - Child Fork Process using fork() and pipe() -

i have create pipe creates 2 child processes fork(). child 1 redirects stdout write end of pipe , executes execlp() "ls -al" command. child 2 redirects input stdin read end of pipe, executes "sort -n -k 5" command. after creating both children, parent process waits them terminate before can exit. when run code, gives following output: pipes pipes.c pipes.c~ the parent program same thing shell runs command "ls -al | sort -r -n -k 5". when command line, following: -rwxrwxr-x 1 username username 8910 may 28 21:52 pipes drwxrwxr-x 3 username username 4096 may 28 13:52 .. drwxrwxr-x 2 username username 4096 may 28 21:52 . -rwxrwxr-x 1 username username 1186 may 28 21:52 pipes.c -rwxrwxr-x 1 username username 1186 may 28 19:48 pipes.c~ is there im not doing correctly in code output? tips? my code: #include <stdio.h> #include <string.h> // strlen #include <stdlib.h> // exit #include <sys/types.h> #include <sys/wait.h...

ruby - precompile assets - rails 4.1.1 -

i'm setting first ruby site in production, works ok, when run rake assets:precompile it adds css/js in "public/assets/" directory ok, have paths , line numbers in files? wondering how on 1 line , without line numbers/comments? have missed setting or this? here example of how application-428d86248ca363.css comes out: /* line 1, /home/joe/myapp/app/assets/stylesheets/main.scss */ body { background: #ccc; } /* line 6, /home/joe/myapp/app/assets/stylesheets/main.scss */ #head { background: #666; } /* line 4, /home/joe/myapp/app/assets/stylesheets/welcome.css.scss */ .block { color: #1e1e1e; } /* * manifest file that'll compiled application.css, include files * listed below. * * css , scss file within directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can referenced here using relative path. * * you're free add application-wide styles file , they'll appear @ bottom of * compiled...

sml - ML. How to correctly work with sequences -

so have "new" 2 way sequence: datatype direction = | forward; datatype 'a bseq = bnil | bcons of 'a * (direction -> 'a bseq); and need function seq2bseq : 'a seq -> 'a seq -> 'a bseq "appends" 2 regular sequences 1 so: if sequp 0 1 2 3 4 ... , seqdown -1 -2 -3 -4 ... seq2bseq create .. -4 -3 -2 -1 0 1 2 3 4 .. . in other words starter element first of sequp(0) if move first element of seqdown(-1) , 2 second of sequp(1) if move forward. far wrote following: fun appendq (nil, yq) = yq | appendq (cons(x,xf), yq) = cons(x,fn()=>appendq(xf(),yq)); fun seq2bseq (downseq) (upseq) = bcons(head(upseq), fn (forward) => seq2bseq appendq(head(upseq), downseq) tail(upseq) | (back) => seq2bseq tail(downseq) appendq(head(downseq), upseq) ); for following errors: stdin:28.101-28.153 error: operator , operand don't agree [tycon mismatch] operator dom...

mfc - Remove visual click effect of CButton -

is there way of removing visual effect of clicking cbutton? i want put 2 cbuttons bmps side side form bigger image, want remove visual effect of click - image being pressed. how can that? use same image , down states of button. way same whether pressed or not. have use cbitmapbutton class, however, derives cbutton . http://msdn.microsoft.com/en-us/library/a3y45xs0.aspx there 4 states of button: up, down, focus, disabled , each can have own image (or not). http://msdn.microsoft.com/en-us/library/6y6acs49.aspx

.net - check if windows service exists and is running -

how can add condition code below check if services running? for each s servicecontroller in servicecontroller.getservices() if s.servicename = "test" or s.servicename = "test1" or s.servicename = "test2" s.stop() end if next you can check status of servicecontroller , stop if running. should check can stopped: for each s servicecontroller in servicecontroller.getservices() if s.servicename = "test" orelse s.servicename = "test1" orelse s.servicename = "test2" if s.canstop andalso s.status = servicecontrollerstatus.running s.stop() end if end if next note should use orelse , andalso whenever possible make code more efficient

ruby on rails - Rspec, sham_rack and Savon 2 -

i trying update our savon (from version 1) version 2. have feature test loads page hits method fires savon. savon seems work fine. however, have support file using sham_rack intercept request , return default info. works fine in savon v1, not v2. doesn't seem trigger @ all, , not sure if it's wrong code, sham_rack, or savon. # savon call def client @client ||= savon.client settings.savon # yml file, stuff turning on logging, etc endpoint 'http://www.site.local/someservice.svc?wsdl=wsdl10' namespace 'http://www.somesite.com/url/1.0' namespaces 'xmlns:ns' => 'http://www.somesite.com/url/1.0', 'xmlns:arr' => 'http://schemas.microsoft.com/2003/10/serialization/arrays' pretty_print_xml true end end # here action 'getallitems' def do_collections_server_request(body, action, options = {}) options.reverse_merge!(raise_errors: true) client.globals.raise_errors(option...

command line - Run programmes in a sequence using python -

this question has answer here: why subprocess.popen not waiting until child process terminates? 3 answers i have python programme below import os import subprocess m in range(0,10): os.chdir("c:/") run="my command%d"%m subprocess.popen(run).wait() where 'my command' used launch programme. although have wait() after popen, turns out 10 programmes still run simultaneously, not expected. how settle issue? two options: use subprocess.check_call() (which should run sequentially) use popen.communicate() ( https://docs.python.org/2/library/subprocess.html#subprocess.popen.communicate ) stdout , stderr set subprocess.pipe see if stdout , stderr indeed sequentially generated also, datetime.datetime.now() gives microsecond, can see time granularity higher 1s.

matlab - Function returns different answers with same arguments -

i'm transitioning matlab fortran , encountering sorts of weird behaviors i'd never expect matlab. here's 1 that's got me puzzled: program pruebanormal double precision :: g01eaf, x, y character :: t*1 integer :: iffail iffail = 0 t = 'l' x = 0.0 y = g01eaf('l',0.0,iffail) write(*,*) 'y = ',y end program pruebanormal i have simple program in i'm trying find pdf @ x=0 of standard n(0,1) variable (should 0.5). g01eaf() nag library function me. i'm using gfortran compile. leaving rest of program unchanged, depending on how write arguments in g01eaf() , different answers: a) g01eaf(t,x,iffail) b) g01eaf(t,0.0,iffail) c) g01eaf(t,x,0) now, under matlab, same (correct) answer either way: y = 0.500000. under fortran, however, get: a) y = 0.500000 b) y = 1.000000 c) program received signal sigsegv: segmentation fault - invalid memory reference. backtrace error: #0 0xb766c163 #1 0xb766c800 #2 0xb77763ff #3 0x80498...

PHP variable assignment needs parentheses -

i wrote code , found didn't work expected. for example, following return false or throw exception, undefined variable: a : if ($a = 12 && $a == 12) { return true; } else { return false; } i fixed wrapping assignment in parentheses: if (($a = 12) && $a == 12) { return true; } else { return false; } it lucky guess. i'm wondering why parentheses needed , haven't found explains why. that because of operator precedence . assignment operator = has lower precedence && , without parenthesis doing following. if ($a = (12 && $a == 12)) observe second $a not yet defined before assignment happens, because has evaluated before assignment can happen.

matlab - Image segmentation in a grayscale image with close intensity levels? -

here's deal, i'm trying segment capsicum @ lower centre of image using matlab. tried intensity level slicing problem intensity levels close. tried stretching histogram , doing no luck. can me? https://www.google.co.in/search?q=grayscale+image+matlab&source=lnms&tbm=isch&sa=x&ei=0_ahu6hll9ixuatirikadg&sqi=2&ved=0cayq_auoaq&biw=1366&bih=622#q=+matlab+flower+grayscale&tbm=isch&facrc= &imgdii= &imgrc=awrqu-vbisji3m%253a%3bfy0fngztpyzszm%3bhttp%253a%252f%252fwww.cs.tut.fi%252f~foi%252fgcf-bm3d%252fimages%252fpeppers256_est_s15.png%3bhttp%253a%252f%252fwww.cs.tut.fi%252f~foi%252fgcf-bm3d%252f%3b256%3b256

java - how to calculate outdegree of DAG which is represented using adjancency matrix -

i need method calculate outdegree of each vertex of dag check whether leaf or not.i m using java boolean adjancency matrix representation sum along row. in adjacency matrix, there 1 @ position ( i , j ) if there edge vertex i vertex j . therefore, outgoing edges of vertex i in row i . sum of row i therefore gives outdegree of vertex i . for transposed adjacency matrix, sum along columns. like david says, if you're interested in whether outdegree 0 or not can save work stopping summation if find 1.

android - In Google Glass, Menu Items are not shown after XE 17.2 Update, any Solutions? -

this worked when glass in on xe12, have opened solution after 2 months , xe17 menu items not shown when tapped on live card, instead live card disappearing. have updated gdk, have changed code support latest gdk sneak peek version 2 changes according ( https://developers.google.com/glass/release-notes#xe12 ) this code public class menuactivity extends activity { private static final string tag = menuactivity.class.getsimplename(); private visionservice.visionbinder mvisionservice; private serviceconnection mconnection = new serviceconnection() { @override public void onserviceconnected(componentname name, ibinder service) { if (service instanceof visionservice.visionbinder) { mvisionservice = (visionservice.visionbinder) service; openoptionsmenu(); } // no need keep service bound. unbindservice(this); } @override public void onservicedisconnected(componentname name) { } }; private boolean mresu...

javascript - Autostop page from loading after 10 seconds -

i have advertisements , scripts run on forum, , page continues load forever because scripts aren't loading on time (i.e. facebook, adsense). have javascript automatically stop page continuous load after, say, 10 seconds? how can sure page loaded in 10 seconds? if user has poor internet connection/speed? what suggest put javascript of advertisements , tracking (anaylytics) etc @ end of page. or if can use jquery put in ready function, when document/page ready, start calling js functions advertisements , all. $( document ).ready(function() { // code goes here });

Reading xls Date Values with php excel reader -

i using phpexcel read date cells in excel file have values 'mar-13' returning integer values '41791'. please, need make sure date reads in correctly? excel stores dates serialized timestamps (number of days since 1/1/1900), can convert unix timestamp , format standard php date functions $unix_timestamp = ($cell_value - 25569) * 86400; $phpdate = date("m-d-y", $unix_timestamp);

C# Remove Unwanted GUI Method in Visual Studio -

new visual studio c# forms... unwanted gui methods group box , labels: private void groupbox1_enter(object sender, eventargs e) { } private void folderpathlabel_click_1(object sender, eventargs e) { } private void destinationpathlabel_click(object sender, eventargs e) { } error code when delete methods: error 1 'a_better_backer.form1' not contain definition 'groupbox1_enter' , no extension method 'groupbox1_enter' go control error (in case groupbox1) , remove onenter event handler. can right-click on control , select properties, click on events icon in properties window (looks lightning) , delete unused event handler.

java - Cache implementation using cache framework -

i want implement cache in java. below requirement want cache 1 table on server startup.onece cached,i fetch data cache give key , return value associated key suppose if key not present call method , can put data in cache key , return me value. googled , found google guava cache , implement requirement 1 option if possile want know other cache frameworks can choose option that. please note using jsp,servelet jdbc means not using spring,hibernate or framework in application. appriciated thanks in advance find example of java caching system (jcs).i think solve problem. http://commons.apache.org/proper/commons-jcs/usingjcsbasicweb.html

c# - How to document old value vs new value in generic function callback -

i have generic callback function notify listeners when value has changed: public func<t, t, task> valuechangedasync { get; set; } where first t should old value , second t should new value. i use callback this: await valuechangedasync(old, newvalue); can make users of function aware of t old value , new value? when using callback gets implemented default: private task valuechangedasync(string s, string s1) { throw new notimplementedexception(); } i "s" named "oldvalue" , "s1" named "newvalue" or such. you events , custom delegate type, delegate type documentation can indicate old value , new value parts. example: // want non-void return type, we're not following event conventions // anyway... might have 3 parameters... public delegate task valuechangedhandler<t>(object source, t oldvalue, t newvalue); then: public event valuechangedhandler<string> valuechanged; invoke as: valuechanged...