Posts

Showing posts from July, 2011

c# - Change specific cell color depending on it's data -

i have datagrid view connected access database there column called status . want when cell in column changed ready background color of cell changes green , if not ready changes red. suggestions? on databound function of grid can check cell condition , color cell. example: protected void grd_databound(object sender, eventargs e) { foreach (gridviewrow gr in grd.rows) { //here run loop on rows , check value of cell of column name status gr.cells[index of cell].backcolor = system.drawing.color.cyan; } } hope might you.

ios - How to display hh:mm:ss in NSTimer? -

hello i'm trying make simple countdown app. however countdown in seconds , not in minutes , hours. how make such? create timer: timer = [nstimer scheduledtimerwithtimeinterval: 1.0 target:self selector:@selector(countdown) userinfo:nil repeats: yes]; countdown method: -(void) countdown { int hours, minutes, seconds; secondsleft--; hours = secondsleft / 3600; minutes = (secondsleft % 3600) / 60; seconds = (secondsleft %3600) % 60; label.text = [nsstring stringwithformat:@"%02d:%02d:%02d", hours, minutes, seconds]; } reference : https://developer.apple.com/library/ios/documentation/cocoa/conceptual/timers/articles/usingtimers.html

grails - Name for this M:M pattern -

in grails there 2 ways m:m associations. firstly, have collection on both sides. gorm figure out intermediately table , encapsulated away. the second way have 3 objects, third object representing connecting table. approach means more code means can add columns actual relationship table easily. is there name second approach? i'm not aware of names these different approaches. database point-of-view aren't different approaches, because in both cases have n:n relationship join table (this refer "the intermediately [sic] table"), in 1 case have additional columns (to foreign keys) in join table at gorm level, approaches more different because in 1 case have domain class (mapped join table), again, i'm not aware of specifics names these different approaches.

android - How call onDraw method from another method to draw dynamically? -

i want redraw view method (say setprogress) in class extending view. how can this. my view class is public class spinview extends view { private paint paint; private context context; private canvas canvas; private rectf arcoval; public spinview(context context) { super(context); this.context = context; } public spinview(context context, attributeset attrs) { super(context, attrs, 0); this.context = context; } public spinview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); this.context = context; } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); this.canvas = canvas; display d = ((windowmanager)context.getsystemservice(context.window_service)).getdefaultdisplay(); int width = d.getwidth(); int height = d.getheight(); arcoval = new rectf((width/2-50), (height/2-50), (width/

Convert a raw TwoTuple to TwoTuple<A,B> in a wrong way but didn't get any warning(Java Generics) -

enviroment: java se 7,eclipse 4.2 there r codes : code 1: import java.io.bytearrayoutputstream; public class tuple { static twotuple<string, integer> f() { return tuple("hi", 47); } static twotuple f2(){ return tuple(new bytearrayoutputstream(), 47); } public static <a,b> twotuple<a,b> tuple(a ,b b) { return new twotuple<a, b>(a, b); } public static void main(string[] args) { twotuple<string, integer> tt = f(); twotuple<boolean, integer> tt2 = f2(); // there wrong system.out.println(tt); system.out.println(tt2); } } code 2: public class twotuple<a,b> { private final a ; private final b b ; public twotuple(a f , b s) { // todo auto-generated constructor stub a= f; b=s; } @override public string tostring() { // todo auto-generated method stub return "a : " +a+ &q

r - Converting data.frame to xts order.by requires an appropriate time-based object -

i have following data frame: > head(table,10) date open high low close volume adj.close 1 2014-04-11 32.64 33.48 32.15 32.87 28040700 32.87 2 2014-04-10 34.88 34.98 33.09 33.40 33970700 33.40 3 2014-04-09 34.19 35.00 33.95 34.87 21597500 34.87 4 2014-04-08 33.10 34.43 33.02 33.83 35440300 33.83 5 2014-04-07 34.11 34.37 32.53 33.07 47770200 33.07 6 2014-04-04 36.01 36.05 33.83 34.26 41049900 34.26 7 2014-04-03 36.66 36.79 35.51 35.76 16792000 35.76 8 2014-04-02 36.68 36.86 36.56 36.64 14522800 36.64 9 2014-04-01 36.16 36.86 36.15 36.49 15734000 36.49 10 2014-03-31 36.46 36.58 35.73 35.90 15153200 35.90 i trying make xts file using > table3<-xts(table[,-1],order.by=table$date) but error: error in xts(table[, -1], order.by = table$date) : order.by requires appropriate time-based object where did go wrong? thought table$date organized time-based. ?xts says following order.by : cur

android - Capture entire content of EditText into a picture -

i have print entire text of text field picture. reason is: have exchange messages unsupported utf-8 characters between android , other web clients. unsupported utf-8 characters mean missing fonts in android (see this topic here ). tried use direct way bitmap b; edittext edittext = (edittext) findviewbyid(r.id.edittext); edittext.builddrawingcache(); b = edittext.getdrawingcache(); edittext.destroydrawingcache(); which works charm until have multiple lines: solution captures text visible user instead of complete text inside of long text field (scrollbars!). i tried workaround generating picture stackoverflow answer . prints entire text not respect text formatting newlines. don't want handle stuff myself. i forced use android 4.3 , earlier versions. is there smart way capture text pictures? if not: is possible modify code above work expected? after searching 24 hours solution ran into solution webview . trick is generate view hold content avoid marker ed

javascript - CSS selector .find(">div.childCollapsible>div[data-onthemovecollapsible=true]") is not respecting parent restriction -

actual case more complicated please play along. trying select siblings of element has class 'sss', using $('.sss').parent().parent().find(">div.childcollapsible>div[data-onthemovecollapsible=true]") i can use css selectors (this part of selenium thest). expected siblings of 'sss' getting children of sub elements too. how restrict siblings? or other workaround can me element in tree siblings of data-onthemovecollapsible="true" attribute holder. edit: firstly apologise failing express myself clearly. structure working 'infinite tree structure' has unknown amount of nodes on each layer, mechanism looking ability siblings on same level starting search , children of parent (his brothers + himself). levels of tree have identical html syntax, looking @ them relatively element 1 starts from, each layer identical, hence css selector should identical too. cannot use other jquery method 'find', , can use css selec

forms - Orbeon control details in own component -

i'm making own component, , want have oportunity set properties in form builder. in want reach effect similar autocomplete control, can set 3 properties (uri, xpath, , relative xpath). read, can using control-details markup, unfortunately not work. code (i working on davinci tutorial): <xbl:binding element="fr|tutorial-davinci" id="fr-tutorial-davinci" xxbl:mode="lhha binding value"> <metadata xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:xf="http://www.w3.org/2002/xforms"> <display-name lang="en">davinci-modified</display-name> <templates> <instance label=""/> <view> <fr:tutorial-davinci id="" appearance="minimal" labelref="@label" xmlns="" resource="" > <xf:label ref=""/> <xf:hint ref=

opengl - pyglet on_key_press Error: 'key' not defined -

i'm using pyglet , trying handle keypress events on_key_press method. keep getting same error when defining events specific symbols key.up: nameerror: global name 'key' not defined based on examples i've seen in pyglet documentation, no prior definition of key necessary. mistaken or there else i'm missing? here's code i'm using event handler @window.event def on_key_press(symbol, modifier): if symbol == key.up: data.rx -= 2 draw() elif symbol == key.down: data.rx += 2 draw() elif symbol == key.space: close()

Is it safe to remove selected keys from Golang map within a range loop? -

how can 1 remove selected keys golang map? safe combine delete() range, in code below? http://play.golang.org/p/u1vufvejsw package main import "fmt" type info struct { value string } func main() { table := make(map[string]*info) := 0; < 10; i++ { str := fmt.sprintf("%v", i) table[str] = &info{str} } key, value := range table { fmt.printf("deleting %v=>%v\n", key, value.value) delete(table, key) } } this safe! can find similar sample in effective go : for key := range m { if key.expired() { delete(m, key) } } and the language specification : the iteration order on maps not specified , not guaranteed same 1 iteration next. if map entries have not yet been reached removed during iteration , corresponding iteration values not produced. if map entries created during iteration , entry may produced during iteration or may skipped. choice may vary each

javascript - ajax closest is not affected in ruby on rails -

hello newbie in ruby on rails.and try ajax in demo website.delete performed have refresh each time. view/shared/_feed_item.html.haml %li{id: feed_item.id} = image_tag current_user.image_url(:small_thumb).to_s %span.user %span.destination %b source: = feed_item.source %span.destination %b destination: = feed_item.destination %span.destination %b date: = feed_item.date %span.timestamp %b time: = feed_item.time %span.content %b comment: = feed_item.content %span.timestamp - if current_user == feed_item.user = link_to "delete", feed_item ,method: :delete, data: { confirm: "you sure?" }, title: "delete", remote: true, class: "delete_post" view/requests/delete.js.haml $(document).ready(function(){ $(function(){ $('.delete_post').bind('ajax:success',function() { $(this).closest('li').fadeout(); }); }); }); controller/requests_controller.rb def destroy @request.destroy respond_to |format| fo

python - scipy.signal.cwt is getting a value error in correlate() -

i'm getting weird error when attempting use scipy.signal.cwt: i have list c , , want take continuous wavelet transform this: scipy.signal.cwt(np.array(c), scipy.signal.morlet, np.arange(.01,.1,.01)) and weird error: --------------------------------------------------------------------------- valueerror traceback (most recent call last) <ipython-input-55-5af5e14b96cd> in <module>() ----> 1 sig.cwt(a, sig.morlet, np.arange(.01,.1,.01)) /usr/local/lib/python2.7/site-packages/scipy/signal/wavelets.pyc in cwt(data, wavelet, widths) 359 wavelet_data = wavelet(min(10 * width, len(data)), width) 360 output[ind, :] = convolve(data, wavelet_data, --> 361 mode='same') 362 return output /usr/local/lib/python2.7/site-packages/scipy/signal/signaltools.pyc in convolve(in1, in2, mode) 270 271 if np.iscomplexobj(kernel): --> 272

validation in flex datagrid using itemEditor -

i have datagrid conatains 2 columns. datatype , value. datatype has combobox options char, int, unsigned int, signed int etc.now want have validation on value entered in value column. using following method . <mx:datagridcolumn headertext="value" datafield="values" width="100" editable="{!this.arevariablesreadonly}"> <mx:itemeditor> <mx:component> <mx:textinput restrict="0-9" maxchars="3" /> </mx:component> </mx:itemeditor> </mx:datagridcolumn> this validates value column's fields int values. if char selected , need use different itemeditor validate in different way. in short, if (int) use itemeditor1 else if (char) use itemeditor2 else if (condition) use itemeditor3. can point me in correct direction? the data pr

android - Journey mornitoring - stop working when adding marker to map -

my location app ok. purpose change app journey monitoring. idea getting information website containing current latitude , longitude of vehicle. added url request runnable. received java.lang.illegalstateexception: not on main thread , com.google.android.gms.maps.internal.igooglemapdelegate$a$a.addmarker(unknown source) , com.google.android.gms.maps.googlemap.addmarker(unknown source) . how can solve this. activity: package tri.mylocapp; //import... public class mainactivity extends activity{ googlemap googlemap = null; latlng latlng; locationmanager lm; string provider; location location; markeroptions marker; double lat,lng; url url; urlconnection conn; string str; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (isgoogleplay()){ setcontentview(r.layout.activity_main); setupmap(); } } private boolean isgoogleplay(){

android - How to restrict the AutoCompleteTextView dropdown dismiss on text change listener? -

i take autocomplete textview , it's change liseter event. when enter text in it, pop fill data adapter, when again enter 1 more character, dismiss , reopen again. don't want dismiss it. remain open when enter character 1 one , change data in adapter. xml : <autocompletetextview android:id="@+id/autotextsearch" android:layout_width="120dp" android:layout_height="wrap_content" android:background="@drawable/search_bg" android:completionthreshold="1" android:dropdownheight="360dp" android:dropdownhorizontaloffset="-140dp" android:dropdownverticaloffset="0dp" android:dropdownwidth="400dp" android:ems="10" android:gravity="center_vertical" android:imeoptions="actiondone" android:inputtype="text&

c# - How to make tooltip on hovering mouse over a button -

i c# silverlight(5) beginner , not bit know how make tool tip. in fact couldnt find option in toolbox tool tip. what have show tooltip when mouse hover button. suppose if have button : <button content="{binding path=id}" command="{binding datacontext.showpopupcommand, relativesource={relativesource ancestortype=data:datagrid}}"/> now how create tooltip on button in viewmodel.cs class ? could please give me guidance on how create tooltip in c# silverlight application using mvvm approach. piece of code appreciated. great help. thanks. <button tooltipservice.tooltip="tooltip based on mouse." tooltipservice.placement="mouse"/> if need display frameworkelements (and not text) can set tooltip this: <button> <tooltipservice.tooltip> <border background="pink"> <stackpanel> <image .../> &l

css - Twitter Bootstrap Dropdown Menu offset with strange graphic -

Image
i have twitter bootstrap navbar , working except dropdown menus offset 40 pixels , have strange shadowed graphic left of drop down. i've inspected figure out might be, have attempted reset radius, margin , padding no avail. if knew was, great help. update thanks christian varga, strange shape indeed box-shadow , i've removed that. left left margin of looks 40 pixels wrapping whole drop down list. i have posted html , css below html <body> <header> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></sp

tin can api - Tin Can API and courses -

i'm new tin can api, decided begin tin can driver , followed these steps http://tincanapi.com/driver-quickstart/ can't find or understand how can add pdf or powerpoint content of driver, mean other html files. don't know if question totally wrong anyways understand how can add course of type if can't add other html files. or suggestions appreciated. a pdf or powerpoint link inside of html of course file included in package. tin can driver product designed enable cross standard course building, use if want able support tin can and scorm and/or aicc, etc. if targeting tin can control how things used within course. tin can doesn't provide concepts of packaging , launch. current de facto standard concepts set of guidelines published implementing tin can in lms. cmi-5 working group developing concepts specification. also note in both cases pdf or powerpoint may or may not playable directly in browser, , either case need implement hooks interfaces call

linux - Hard to Resolve :- "SCP copies files successfully, but files not visible in local computer" -

i want download file server local linux machine. using following command scp -r username@remote:/path/to/folder /dest/local/path file transfer;but in local folder file doesn't see. what's wrong me? thanks. we cannot "what wrong you " (your words), there number of things might want check: is folder copied (or files) hidden ? name start dot ( .somefile )? when "looking local files", use file manager? should try refresh view. when using graphical file manager, filters set might hide files? what command output: ls -al /dest/local/path ? what type of resource /dest/local/path ? ordinary folder inside locally mounted partition or else? for real paranoid amongst us: scp command that? path, package belong to? checked that? what happens if try transfer files using same commands? warning files getting overwritten? and finally: tried adding -v flag (verbose mode) additional information during transfer?

c# - Click first email using selenium -

i trying login hotmail, , click first email shown in emails box. problem, when i'm trying find first email. i've tried in lot of different ways, i've wanted make test finding list items li , i've made simple function: public void clickfirstemail() { var lis = driver.findelements(by.tagname("li")); //this raising exception foreach (var li in lis) { messagebox.show(li.text); } } whenever try access elements, exception: permission denied access property '__qosid' i've seen answers here on stackoverflow, guess right when running selenium server. i start driver this: driver = new firefoxdriver(); any ideas on how right ? the whole plan click first email. update: i've tried 1 more time, , worked, gave me error now: element no longer attached dom on messagebox.show line. i thinking page (javascript) loading/changing new stuff, ?

javascript - Hybrid App: Audio not playing on Android -

i using monaca.mobi build hybrid app. when build app ios fine; however, when build android device (nexus 7) audio come through. in monaca debugger; however, audio works fine. there android devices not aware about, maybe permissions of app? sound played through angularjs function called on button clicks. know code correct, thought might share it: function dontask($scope){ $scope.play = function(){ var audio = new audio(); audio.src = 'sounds/donteventask.mp3'; audio.play(); }} thanks insight. your above code working ios. android, path local audio file not recognized. following code work both oses. i've tested built app too. $scope.play= function(){ var os = navigator.platform; if (os=='iphone'){ var url = "sounds/donteventask.mp3"; } else{ var url = getphonegappath() + "sounds/donteventask.mp3"; } var my_media = new media(url, // success callback function(

Jenkins build.xml disappears from build location -

i appear having inconsistency some, not all, of jenkins projects. on occasion appear build.xml removed/deleted build location therefore causing project not build. the more odd facet of issue seems may run project fine on it's next attempt. if has ideas why may experiencing issue or suggestions grateful advice. have googled , searched stackoverflow similar issues , can't find seems similar. my builds purely triggering batch operations. here snippet of log: info: started out of order build detection ?[33mapr 23, 2014 7:09:27 jenkins.diagnostics.ooom.problem$inspector scan warning: failed inspect c:\users\tdrive.jenkins\jobs\main_trunk_sanity_check _rokdoc\builds\2014-03-21_18-00-35: c:\users\tdrive.jenkins\jobs\main_trunk_san ity_check_rokdoc\builds\2014-03-21_18-00-35\build.xml doesn't exist ?[0m?[33mapr 23, 2014 7:09:27 jenkins.diagnostics.ooom.problem$inspector scan how workspace managed? under svn? job doing svn update everytime?

android - Hide a EditText & make it visible in AsyncTask -

i making android app send id_user , id_status remote database asynctask. if success == 1, edittext , button visible automatically. commentactivity package com.portalalumni; import java.util.arraylist; import java.util.hashmap; import java.util.list; import org.apache.http.namevaluepair; import org.apache.http.message.basicnamevaluepair; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.os.asynctask; import android.os.bundle; import android.os.handler; import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.button; import android.widget.edittext; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class commentactivity extends activity { sessionmanager session; boolean isvisibl

sql - Inserting Into and Maintaining Many-to-Many Tables -

Image
sqlite3 user. i have read thru numerous books on relational dbs , sql , not 1 shows how maintain linking tables many-to-many relationships. went through book went details of select , joins examples, glosses on same when many-to-many relationships covered. author showed pseudo code table, no data, , pseudo code query--wtf? missing something, has become quite maddening. anyways, have table [people] 3 columns: pid (primary), name , age. table [groups] 3 columns: gid (primary), groupname , years. since people can belong multiple groups , groups can have multiple people, set linking table called [peoplegroups] 2 columns: pid, , gid both of come respective tables. so ,how efficiently data linking table when inserting on others , how data out using linking table? example: want insert "jane" [people] , make member of group gid 2, "bowlers" , update linking table {peoplegroups] @ same time. later want go , pull out list of of bowlers or groups person part of.