Posts

Showing posts from July, 2011

javascript - Rails link_to ignoring e.preventDefault(); from a jQuery call because method: :get is set -

experimentally i've learned following code: <td><%= link_to 'notify', '/w/'+w.id+'/notify', method: :get, :class => "btn btn-success notify-btn" %></td> fires regardless of jquery: $('.notify-btn').click(function(e){ e.preventdefault(); bootbox.confirm("alert?", function(result){ if(result === true){ return true; } else { return false; } }); }); and it's due method: :get. removed elements of link one-by-one , tried various combinations. if method: :get there, it's going fire. i can prevent e.stoppropagation, won't follow link at all . if click ok sits on page doing nothing. if rid of erb , use straight html so: <a href="/w/53531e8a963e6503c60002b2/notify" class="btn btn-success notify-btn" data-method="get">notify</a> and data-method="get" there, same result. if remo

Twitter and spam control -

we developing carpool app, , posting search requests customers , registration requests customers on twitter. there may time when tweets increase significantly. need ensure not breaking rules ? tweet looks this the tweet looks this @caregiri ride viman nagar, hindjewadi,. install caregiri android app, , reduce @pune_traffic? @mcruiseon @caregiri , @mcruiseon our @ tags. @pune_traffic not. i'd suggest checking rules , policies twitter applications ( https://dev.twitter.com/terms/api-terms ) , if you're unsure, file ticket platform operations team @ https://support.twitter.com/forms/platform

Java webstart complaining about missing jar that isn't in my library anymore (Netbeans) -

i've stumbled on strange behavior when running java app through webstart. used have itext jars added project in netbeans 7.3.1. recently, removed these jars libraries (via project properties) did not use anymore. i've rebuild project (with code-signing certificate), had no errors whatsoever , put new update online. now, when open app first time through java webstart (jnlp), receive following error (from java console): ... basic: exception: unable load resource: http://<my url>/lib/itextpdf-5.3.1-javadoc.jar. exitexception[ 3]com.sun.deploy.net.faileddownloadexception: unable load resource: http://<my url>/lib/itextpdf-5.3.1-javadoc.jar @ sun.plugin2.applet.jnlp2manager.downloadresources(unknown source) @ sun.plugin2.applet.jnlp2manager.preparelaunchfile(unknown source) @ sun.plugin2.applet.jnlp2manager.loadjarfiles(unknown source) @ sun.plugin2.applet.plugin2manager$appletexecutionrunnable.run(unknown source) @ java.lang.thread.run(unknown source) ignored ex

c++ - Clear input command line? -

i'm making console application. starts menu if press key; 1. menu changes menu screen. note, without me pressing 'enter'. means 1 still remains, bad when stepping down further in menus. how clear input command line? the function im using. if(getasynckeystate('1')) { ieventdataptr gamestate(gcc_new evtdata_set_game_state("pregamestate")); em->vtriggerevent(gamestate); //enter line clearing code. } the function getasynckeystate gives "the current state of key". return true between point when keyboard driver has received "key 1 has been pressed" until keyboard driver receives "key 1 has been released". i suggest use readconsoleinput instead if want 1 keypress @ time. the alternative use this: while(getasynckeystate('1')) { // nothing. } to wait key released.

c# - insert asp tags in innerHtml in a div -

i'm trying kind of thing: aspx <div runat="server" id="divaltriindirizzi"> </div> aspx.cs in page_load method stringbuilder sbdivindirizzi = new stringbuilder(); (int = 0; < dtind.rows.count; i++) { sbdivindirizzi.append("<div class='row'> "); sbdivindirizzi.append("<div class='col-lg-12'>"); sbdivindirizzi.append("<h3>indirizzo "+ (i+1).tostring() +"</h3>"); sbdivindirizzi.append("<div class='form-group'>"); sbdivindirizzi.append("<div class='row'>"); sbdivindirizzi.append("<div class='col-lg-8' id='divindirizzo'+(i+1).tostring()>"); sbdivindirizzi.append("indirizzo:"); sbdivindirizzi.append("<asp:textbox runat='s

JavaFX - Get TableView column by name -

is there way column tableview name? when need column have index: tableview.getcolumns().get(i); but column name: tableview.getcolumns().get("column name"); it's hard envision situation in couldn't keep references columns, can write method like private <t> tablecolumn<t, ?> gettablecolumnbyname(tableview<t> tableview, string name) { (tablecolumn<t, ?> col : tableview.getcolumns()) if (col.gettext().equals(name)) return col ; return null ; }

android - Progress while recording audio -

i trying make progress bar , react while record sound. mean while record on , there sound progress bar have move. dont know how should call using in audio players show music playing. hope know mean. i recording sound code: recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.voice_recognition); recorder.setoutputformat(mediarecorder.outputformat.three_gpp); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); recorder.setoutputfile(outputfile); use getmaxamplitude() . call method multiple times delay , need. here's implementation using rxjava : mtimersubscription = observable.interval(100, timeunit.milliseconds) .observeon(androidschedulers.mainthread()) .subscribe(along -> { // evey 100 milliseconds method called int amplitude = mrecorder.getmaxamplitude(); logwrapper.d(tag, &

python - How to convert string to uppercase / lowercase in Jinja2? -

i trying convert upper case string in jinja template working on. in template documentation , read: upper(s) convert value uppercase. so wrote code: {% if student.departament == "academy" %} academy {% elif upper(student.department) != "maths department" %} maths department {% endif %} but getting error: undefinederror: 'upper' undefined so, how convert string uppercase in jinja2? filters used |filter syntax : {% elif student.department|upper != "maths department" %} maths department {% endif %} or can use str.upper() method : {% elif student.department.upper() != "maths department" %} maths department {% endif %} jinja syntax python- like , not actual python. :-)

c - #define a string literal then assign it to a char* -

#define maxstr "maximum number reached" char *str = maxstr; while doing kind of operation. code working & running fine getting lint error. how can resolve it? error: assignment of string literal variable if use: #define maxstr "maximum number reached" char *str = (char *) maxstr; then lint error: attempt cast away const (or volatile) assignment of string literal variable that horrible error message. i'm curious lint thinks string literals for, if cannot assign them variables... should like: "assigning string literal non-constant pointer". attempt cast away const (or volatile) the warning incorrect. again, should tell pointer variable needs const . to sum up, errors because static analyser tool bad. explanation: string literals in c character arrays, char [] . unfortunately not treated constant type const char[] language. defect in c language, because if attempt write access of string literal, lea

Docker driver for Openstack -

i working on openstack installation cant work docker. without docker seems work, when try start instance, exception no host available. found out @ computing nodes docker driver cannot found: 2014-04-21 10:51:26.114 1629 error nova.virt.driver [-] unable load virtualization driver 2014-04-21 10:51:26.114 1629 trace nova.virt.driver traceback (most recent call last): 2014-04-21 10:51:26.114 1629 trace nova.virt.driver file "/usr/lib/python2.7/dist-packages/nova/virt/driver.py", line 1299, in load_compute_driver 2014-04-21 10:51:26.114 1629 trace nova.virt.driver virtapi) 2014-04-21 10:51:26.114 1629 trace nova.virt.driver file "/usr/lib/python2.7/dist-packages/nova/openstack/common/importutils.py", line 52, in import_object_ns 2014-04-21 10:51:26.114 1629 trace nova.virt.driver return import_class(import_str)(*args, **kwargs) 2014-04-21 10:51:26.114 1629 trace nova.virt.driver file "/usr/lib/python2.7/dist-packages/nova/openstack/common/import

objective c - YouTube integration issue in iOS SDK -

i integrating youtube in app in have login user authentication.i got sample code working fine.when started integrating code in app getting issues. first:- when run same code in sample app made telling gtlyoutube.h file missing.i unable know how sample working though not have file. second:- subsequently added downloaded file svn checkout svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/ google-api-objectivec-client-read-only , added files in app. then although gtlyoutubeconstants.m present can see in services->youtube->generated getting error gtlyoutubeconstants.m file not found. i unable find while compiler unable find file.is there wrong in implementation? finally came solution.i need make lot of changes in code write in steps can helpful others. the main problem got in gtlyoutube_sources.m,gtlcommon_sources.m , gtlnetworking_sources.m .when used these files sample app files missing , getting message gtlyoutubeconsta

ruby on rails - will_paginate ajax pagination error -

at same page have projects list on right , comments feed left side of page. will_paginate limits 10 comments per page controller: def index @projects = project.paginate(page: params[:page], per_page: 10) @comments = comment.paginate(page: params[:page], per_page: 10) end view: %table.table %tbody - @comments.each |comment| %tr %td.feeds %li #{comment.content} %span.proj_title #{link_to comment.project.title, comment.project} %br %span.timestamp posted @ #{comment.created_at}. = will_paginate @comments when comments.count > 10 , trigger second page on paginator, request changes from http://0.0.0.0:3000/projects?page=1 to http://0.0.0.0:3000/projects?page=2 so changes pages. , right side(projects list) dissapears. how prevent happening , render pagination correctly? in implementation, params[:page] applies both paginations. you must provide custom pagination parameter either list, each have own p

ios - NSDateFormatter init vs copy performance -

my ios application requires heavy use of nsdateformatter, know creating instance of nsdateformatter expensive, creating few singleton instances fine, need use lot of date formats , cannot create instance of these formats, what doing creating singleton nsdateformatter common settings timezone , locale, , whenever want clone nsdateformatter , make change that, my question does copy better clone? what best practice handle many date formats ? unfortunately, expense of date formatter setup incurred first time use after either creating or setting properties of it . won't able avoid cost @ least once each configuration of formatter use. i have few suggestions: make sure cost matters before spending lot of time on it. naive, easy right code, , profile instruments look @ usage patterns. use few formats far more rest? consider caching those. use few @ time, few different ones, , on? consider caching small number of used formatters can exploit pattern. in worst ca

c# - EF 6: many-to-many self-reference: The DELETE statement conflicted with the REFERENCE constraint -

i have entity: public class course { public course(){ postrequisites = new list<course>(); prerequisites = new list<course>(); } public long id { get; set; } public byte[] rowversion { get; set; } // other properties... public ilist<course> postrequisites { get; set; } public ilist<course> prerequisites { get; set; } } which has many-to-many self-referencing relationship. , here configuration: public class courseconfiguration : entitytypeconfiguration<course> { public courseconfiguration() { // configurations other properties... hasmany(t => t.postrequisites) .withmany(t => t.prerequisites) .map(t => { t.totable("courserequisites"); t.mapleftkey("postrequisiteid"); t.maprightkey("prerequisiteid"); }); } } when try delete item method (see method handle ):

mysql - Exposing calendar as an iCal with subscribe option in PHP -

i have application in php each user has associated events. what want expose events under in way similar events on facebook gives urls in format webcal://www.facebook.com/ical/b.php?uid=123456789&key=asd123asd123asd , whenever there's new event, automatically gets propagated calendar have added google calendar. what want expose calendar on url such http://whatever.org/somelonguniqueperuseridentifier.ics . i tried simulate event generation script simple file @ same url. ics file consumed google, events have been added, when changed file contents (deleted event) = altered resource, google calendar should subscribed, change didn't go through gcal. as unable find reliable source of documentation, tried google lot different keywords , guided webdav servers davical, sabredav, etc. i have installed davical on server getting state have server installed no idea how expose events mysql database on desired url, clients subscribe to. same sabredav, except fact, haven

While loops in C -

i tried changing do-while loop inside piece of code while loop. compiled code , ran didn't error messages, code did not print either, i'm assuming wrong while loop code. show me did wrong while loop code? ... while(fgets(transinput,sizeof(transinput),in)!=null){ i=0; { for(j=0;j<npos;j++){ transchar = transinput[i]; if(transchar != '\n' && transchar != '\0'){ transtemp[j] = transchar; ++i; } else { transtemp[j] = ' '; } } for(ii=0;ii<npos;ii++){ fprintf(out,"%c", transtemp[decrypt[ii]]); } } while(transchar != '\n' && transchar != '\0'); fprintf(out,"\n"); } ... updated current code: ... i=0; while(fgets(input3,sizeof(input3),file1)!=null){ ch = input3[i]; while(ch != '\0'

Changing the Value of a Span tag using JavaScript via Name -

i'm working on making timer application, @ moment, have timers set default values, 5:00, until image above clicked. code clicking image this: <a href="#" onclick="timer1()"><img src="images/icons/image.png" id="id"></a> when clicked, want adjust following span code: <span id="timer" class="one" name="blue1">5:00</span> however, there many parts code , css styles, can't spare id or class variables, i'd use javascript target timer 1 unshared name, name="blue1". here javascript now. function bluetimer1() { document.getelementsbyname('blue1').innerhtml="blah"; } obviously do once done it, need able modify text within span, don't care edits to. thanks assistance. actually document.getelementsbyname('blue1') return collection/array object of spans there 1 need select first 1 using: document.getelementsbyname(&

c++ - Pthread member function with arguments -

i'm trying use pthreads classes. i've read best solution use threads member functions define static helper function , call thread function inside. requires 'this' pointer passed argument pthread_create. how implement if original thread function has argument? there way pass multiple arguments pthread_create? you cannot pass multiple arguments pthread_create , can pack multiple arguments struct create purpose of packing arguments. make struct "private" implementation defining in cpp file, rather in header. pass pointer of struct pthread_create , "unpack" in helper call member function. let's assume thread implementation member function threadrun defined follows: int myclass::threadrun(int arg1, string arg2) { ... // useful work return 42; // return important number } to call function, define thread_args struct this: struct thread_args { myclass *instance; int arg1; string arg2; }; now helper fu

python - Convert certain values in list to int -

i have list of lists , want convert second value in each list int since string [['hello','how','are','you','1'],['hello','how','are','you','2']] i trying convert index 4 int in each list within larger list when do for hi in above: int(hi[4]) it returning int when print list , not entire list. just traverse , convert using int() function every 4th element in every list inside : for li in my_list: li[4] = int(li[4])

On NetBeans(JAVA), Sound file suddenly stops playing when I start/test my program -

first of all, odd problem im trying fix since got netbeans , started programming. basically: made simple program music should playing while program running, when music starts playing, last seconds because stops playing no apparent reason. open program , click button makes music iniciate, , stops 3 or 4 seconds(this random, ll last longer). the curious thing is: on notebook, if try test program while in netbeans yet, problem occurs, if build program, problem goes away. in other hand, if test or build same program on pc(high-end), problem occur while testing on netbeans , after building too, no way ridding off on pc, on notebook after building it(if test while on netbeans without building, problem occur).that happens every sound file or music try, of them on wav format. im not sure have installed k-lite mega codec pack on both systems, dunno if causing that. here part of program sound file started(and importations): //importations below import java.applet.*; import java.net.*;

asp.net mvc - Advanced Search in LINQ Query -

i want make advanced search (filtering) using different criteria. example, if first name available query should return available matches. if first name , last name both available should match first name or last name , similar way many criteria (gender, profession, education etc.) here controller method in taking ajax data parameters. [httppost] public actionresult search(string cno, string fname, string lname, string male, string female, string stateid, string cityid, string professionid, string educationid) { if (request.isajaxrequest()) { var db = new clubdatacontext(); /*----------advanced search query-------------*/ return partialview("serachresult"); } else return redirecttoaction("index", "home"); } it may possible parameters have null value. please suggest linq query suitable in situation. you have option use c# null-coalescing operato

java - Android:Painting in FragmentClass -

i using navigationdrawer in activity.if click of item in navigation drawer in default color should allow paint thing.but tried long time unable it.kindly hep possible.below code using. painting.java package com.example.painturselfnew; import android.annotation.targetapi; import android.app.activity; import android.app.fragment; import android.app.fragmentmanager; import android.content.intent; import android.content.res.configuration; import android.os.build; import android.os.bundle; import android.support.v4.app.actionbardrawertoggle; import android.support.v4.widget.drawerlayout; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toast; @targetapi(build.version_codes.ice_cream_sandwich) public class painting extends activity { private listview mdrawerlist; private drawerlayout mdrawerlayout; private action

objective c - The best way to implement Offline Map in iOS -

can suggest best way implement offline map following features. add mkoverlayview local static map image restrict zoom outside mkoverlay area google map should not appear on screen add multiple annotations of fixed locations tracking & rotating i have used mapkit framework start of & added mkoverlayview in it. while adding few fixed annotations doesn't allow add without internet. i don't think above things can achieved using mapkit framework. can suggest me exact solution ? any suggestions of hints appreciated. thanks. it possible make map kit load map contents private map database. don't remember if new in ios 6 or 7. want ios 7. there wwdc session apple engineer set private map demo. usually you'd host map on server , have app download map tiles server. in case you'd have load tiles local directory on device. however, map content gets big fast. you'd able cover modest areas before file sizes of map content became prohibiti

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