Posts

Showing posts from May, 2013

c++ - Graphing issues in data output -

i have program taking input external source (right now, joystick), , plotting on graph. graph displays last 60 frames of data, 1-2 seconds. here data input: nextdatapoint(double x){ if (x > max){ max = x; } if (x < min){ min = x; } datainput.enqueue(x) //datainput qqueue<double> while (datainput.size() > 60){ datainput.dequeue(); } update(); //this triggers paint event } here graphing function graph function: //this draws min line , max line qpainter painter(this); int linedist = 25; qpen mypen(qt::black, 3); qpoint maxtext(10,20); painter.drawtext(maxtext, "max"); qpoint maxlineleft(0, linedist); qpoint maxlineright(width(), linedist); painter.drawline(maxlineleft, maxlineright); qpoint mintext(10, height()-10); painter.drawtext(mintext, "min"); qpoint minlineleft(0, height()-linedist); qpoint minlineright(width(), height()-linedist); //this draws actual graph mypen.setcolor(qt::blue); mypen.setwidth(2);

c# - Compiled Expression Tree slow due to JIT_MethodAccessCheck -

we're using compiled expression trees generate code dynamically; information available @ runtime enables (in theory) write simpler, faster code. performance boost in many cases. however, in cases performance hit. in such cases, visual studio profiler shows difference in performance due method (which doesn't show @ in statically compiled code) jit_methodaccesscheck what method do? (google doesn't have it). can optimize away somehow? jit_methodaccesscheck method performs security checks such securitytransparent , aptca , class access checks mentioned @xanatos. class access checks include securitycritical , securitysafecritical , attached profiler bypass , linkdemand . more details can found @ coreclr jithelpers.cpp . since coreclr compatible clr, can safely assume checks in same manner in both of them.

html - Aligning complex bootstrap button layout -

Image
i got (not soooo) complex bootstrap button layout align right.here's looks now: i second line (scheduled time) align right. have tried far combinations of pull-right , text-right classes on span tags no avail... anyone has solution this? thanks! the button code: <button type="button" class="btn btn-sm btn-default"> <span class="fa fa-pencil fw"></span> &nbsp; <asp:literal runat="server" text="&nbsp;<%$ resources:main, estimatedtimecaption %>" /> <span data-bind="text: moment(waitingqueueclient.estimatedconsultationtime).format($('#timeformat').html().trim())"></span> <br /> <asp:literal runat="server" text="&nbsp;<%$ resources:main, scheduledtimecaption %>" /> <span data-bind="text: moment(waitingqueueclient.fixedconsultationdatetime).format($('#timeformat').html().trim()

python - Out of index range error, a while loop containing list and dictionary -

after finding alternative solution previous problem, have encountered new one. asked teacher , suggested use dict(zip) in format. final={} rawlines=open("x.txt").readlines() y=0 while y <5: line in rawlines: userlist=rawlines[y].split(',') userid=userlist[0] avmph=userlist[1] print(avmph) #print(userid) lines in rawlines[0:]: lines=lines[:-1] items=lines.split(',') final[items[0]]=dict(zip(userid,avmph)) y=y+1 else: sorted[avmph()] print(avmph) print(userid) i getting out of index range error line. error message traceback (most recent call last): file "c:\users\ryan\desktop\test.py", line 6, in <module> userlist=rawlines[y].split(',') indexerror: list index out of range i have used .txt file in style of .csv file allows me create lists. need sort average miles per hour , return user ids alongside. main problem seems reside 'y' variable , while loop (link s

java - Unable to show images in JSP from database using servlet -

Image
i trying fetch , display , images saved blob on jsp mysql database using servlet. wrote code referring many websites , still , not working. not getting type of errors. showing this i have created table using create table contacts(id int not null auto_increment, name varchar(40), second varchar(40), photo blob, primary key(id)); this servlet displayservlet.java @webservlet("/displayservlet") public class displayservlet extends httpservlet { private static final long serialversionuid = 1l; connection conn = null; preparedstatement stmt = null; resultset rs = null; public void init() throws servletexception { } public displayservlet() { super(); } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { dopost(request, response); } /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse response) */ protected void dopost(httpservletrequest reque

.htaccess redirect old domain to new domain while respecting HTTPS -

this question has answer here: https non www https www 1 answer i know question must have been asked before unable find specific answer question. have multiple pointer domains setup pointing branded domain. redirect http using (note below domain.com signifies branded domain): rewriteengine on rewritecond %{http_host} !^www\.domain\.com rewriterule (.*) http://www.domain.com/$1 [r=301,l] however not redirect https. i've tried: rewriteengine on rewritecond %{https} on rewritecond %{https_host} !^www\.domain\.com rewriterule (.*) https://www.domain.com/$1 [r=301,l] rewritecond %{http_host} !^www\.domain\.com rewriterule (.*) http://www.domain.com/$1 [r=301,l] but results in redirect loop. in essence want maintain protocol (either http or https) , redirect old new domain while leaving remainder of request intact. so if example tries lookup: http://www

html - IE not working SCRIPT5007 HTML1524 errors, possibly doctype needs to be revised? -

i have application receives input words web app , processes them on backend (can done ruby or node.js) , returns words screen in uppercase. works fine firefox, not work ie.. tried ie 9 & 10. when say, not work mean response not returned webpage , instead user sees timeout error although backend application working. these types of errors see. failure occurs when function called: function escapehtml(text) { return text script5007: unable property 'replace' of undefined or null reference index.html but earlier when page loads, see these errors think may real problem; seems if "text" not able returned because doctype and/or codepage causing problem. html1524: invalid doctype. shortest valid doctype "". index.html, line 1 character 1 html1114: codepage utf-8 (http header) overrides conflicting codepage iso-8859-1 (meta tag) i have done several searches show doc type using valid, @ loss why continues problem in ie. <

python - Why can't I access more than 25 tweets using tweepy search API? -

i'm using tweepy in python search tweets. i'm using tweepy.api.search() query older tweets, , noticed can't access 500 tweets @ once. in fact, can't return more 25. i have used both count , rpp (results per page) keywords. can't seem figure out if i'm not allowed access many tweets @ once, or if buggy. here code: for tweet in api.search(q='obama', count=500, show_user=false, rpp=500, geocode='38.899722,-77.048363,500mi'): print tweet.created_at, '\n', tweet.text, '\n\n' this gives me 25 tweets output. here first few show it's working: 2015-04-01 16:42:28 "@jonahmarais: me , michelle obama dating guys" lot twist. april fools day. 2015-04-01 16:42:05 "@jonahmarais: me , michelle obama dating guys" sike. 2015-04-01 16:38:44 forget #winstonchurchill #obama isn't measuring #nevillechamberlain says http://t.co/6jzqxjudrh #irantalks #israel

c++ - VBA debugger precision -

Image
i had single believe c++ equivalent float in vba in excel workbook module. anyways, value assigned (876.34497) rounded off 876.345 in immediate window, , watch, , hover tooltip when set breakpoint on vba. however, if pass single c++ dll c++ reports original value 876.34497. so, stored in memory original value? limitation of debugger? unsure going on here. makes difficult test if i'm passing i'm getting on c++ side. i tried: ?cstr(test) 876.345 ?cdbl(test) 876.344970703125 ?csng(test) 876.345 vba isn't straightforward, @ level must stored 876.34497 in memory. otherwise, don't think cdbl correct is. vba variables of type "single" stored "32-bit hardware implementation of ieee 754[-]1985 [sic]." [see: https://msdn.microsoft.com/en-us/library/ee177324.aspx] . what means in english is, "single" precision numbers converted binary truncated fit in 4 byte (32-bit) sequence. exact process described in wikipedi

java - Editable JavaFX ListView -

i'd make editable listview. documentation indicates setting editable=true insufficient, , wasn't able find example anywhere. in fxml have: <listview fx:id="queuelistview" editable="true"/> what else need (in fxml or in controller) make happen?

cocoa - How to force redrawing a group row in a NSOutlineView after it’s been expanded/collapsed -

i tried calling setneedsdysplay: , setneedsdisplayinrect: drawbackgroundinrect: , drawseparatorinrect: not called group row else this piece of code have: - (void)outlineview:(nsoutlineview *)outlineview didaddrowview:(nstablerowview *)rowview forrow:(nsinteger)row { id previtem = [outlineview itematrow:row - 1]; if ([self outlineview:outlineview isgroupitem:previtem]) { id view = [self outlineview:outlineview rowviewforitem:previtem]; if (view) { [view setneedsdisplay:yes]; } } } edit this came with: - (void)outlineview:(nsoutlineview *)outlineview didremoverowview:(nstablerowview *)rowview forrow:(nsinteger)row { // todo: find a better way repaint node after it's been collapsed (nsview *view in outlineview.subviews) { nsinteger testrow = [outlineview rowforview:view]; if (testrow == row - 1) { id item = [outlineview itematrow:testrow]; if ([(id)outlineview outlineview:

Displaying updated ntp time in java -

i writing ntp client , server in java. calculating offset , round trip delay using ntp timestamps. should point out calculating these seconds (first 32 bits) , fractions (second 32 bits) separately. getting offset results such 0 seconds , 1859395165 fractions. my question how can use these offsets print out system time if adjusted according given offset? i thinking add fractions onto fractions part of timestamp systems current time, if sum of fractions greater 1 second believe encounter problems seconds incorrect. you convert fraction milliseconds first , calculations. lets time 11:05:21:900 server , offset 200 ms. add 11:05:21:900 , 11:05:22:100. you need function checks if hit new second/minute/etc after adding offset. start of code this. systemms += offsetms; if (systemms >= 1000) { systems += 1; systemms -= 1000; if (systems >= 60) { etc } }

java - Injecting JavaScript(JSNI) to Cell Table DOM -

in application using gwt cell table, of column header want add tooltip.column header created using safehtml , injecting js cell table header using jsni. time dom not creating , javascript not attaching column header tooltip.if use timer problem goes off,i don't want use timer.is there way inject js?any clue?see below code, column header safehtml: safehtml="<span>total</span><span title='' rel='tooltiptop' class='reqfull' data-original-title='{0}'> <i class='fa fa-info-circle'></i></span>"; jsni: private static native void inittooltip() /*-{ $wnd.$(document).ready(function(){ $wnd.jquery("[rel=tooltiptop]").tooltip({ placement: 'top'}); }); }-*/; i calling jsni after table creation still dom not ready. tried calling jsni script in onattach() method, @override protected void onattach() { super.onattach(); inittooltip();

How to approach simple recursion in python -

i've been trying understand recursion/recursivity in programming languages , i've chosen work python, since it's language understand most. i've tried resolving following problem - given 3 different lists of elements, find possible patterns person has followed during shopping day. lists purchases = [[money_spent, time0], [money_spent, time1], [money_spent, time3]] time_between_shops = [[time_to_self, time_to_shop2, time_to_shop3, time_to_shop4], [time_to_shop1, time_to_self, time_to_shop3, time_to_shop4], [time_to_shop1, time_to_shop2, time_to_self, time_to_shop4], [time_to_shop1, time_to_shop2, time_to_shop3, time_to_self]] list_of_products = [["shop1", {"product1": price_of_product1, "product2": price_of_product2}], ["shop2", {"product3": price_of_product3, "product4": price_of_product4, "product5": price_o

events - How to redraw gtk widget in python without calling gtk.main_iteration? -

my application have window handle key press events. when user press key run long tasks , during task update label on window. update label while task still running call following code. while gtk.events_pending(): gtk.main_iteration(false) this update label problem process events including key presses. if user press key while tasks running calling main_iteration start processing task. want should update label other events should not processed . events should processed when task completed. one way remove key press handler or in keypress handler check if task running ignore key presses in way keypresses lost. want somehow should update label leave other events , events should handled after task completed , application become idle. there way this? thanks you want .queue_draw() , related gtkwidget methods. note these mark widget needing redraw when main loop; don't think gtk+ has method drawing right now (but marking dirty , letting system redraw when it's r

C# set pictureboxes to hide using SQL Server database -

sqldatareader reader = null; sqlconnection cn = new sqlconnection(global::vaja15.properties.settings.default.database1connectionstring); cn.open(); sqlcommand sda = new sqlcommand("select * uporabnik attacktype='melee' ", cn); reader = sda.executereader(); reader.read(); cn.close(); my database has column attacktype values melee or ranged. , column picturebox possible values picturebox1, picturebox2.... i didn't saved pictures inside database wrote names on form. i'm trying select attacktype melee , set ranged picturebox1.hide(); can filter these 2 kinds. can sql code?

objective c - iOS, Sort allKeys of NSDictionary -

<-- why have been down voted? @ least comment reasoning i have incoming json array details consecutive & non-consecutive date periods. an example: (please note, root index values example clarity. real data associative key-value) [0] => '01/01/2015 - 05/01/2015' : ['01/01/2015', '02/01/2015', '03/01/2015', '04/01/2015', '05/01/2015'], [1] => '01/02/2015 - 05/02/2015' : ['01/02/2015', '02/02/2015', '03/02/2015', '04/02/2015', '05/02/2015'], [2] => '25/03/2015': '25/03/2015', [3] => '01/04/2015': '01/04/2015' my final intention display each asso

ios - How to implement a custom NavigationViewController? -

i want implement navigationviewcontroller, uinavigationviewcontroller, no navigationbar , custom push effect. i know should add view controllers navigationcontroller childviewcontroller, , add views navigationcontroller's view. however, can't handle life cycle methods well, meaning when push , pop viewcontroller, viewwillappeaer viewdiddisapper , other methods should call @ proper time. i try in popviewcontroller: : // life cycle currentvc.viewwilldisappear(animated) previousvc.viewwillappear(animated) currentvc.willmovetoparentviewcontroller(nil) uiview.animatewithduration(self.durationofpop, delay: 0, options: uiviewanimationoptions.curveeaseout, animations: { () -> void in // animations let width = currentvc.view.frame.width currentvc.view.frame = self.view.frame.rectbyoffsetting(dx: width, dy: 0) previousvc.view.frame = self.view.bounds }) { (finished) -> void in

php - Trying to use WP shortcode in HTML -

i'm trying make shortcode outside post/page in wordpress. the problem is, when i'm placing do_shortcode() function, html automatically document php code (e.g <!--*php code* --> ). what can cause problem? you don't place do_shortcode() in pages. somewhere in functions.php or shortcodes.php file set function , assign shortcode function. function myfunction($params = array()) { //function code here } add_shortcode('shortcodename', 'myfunction'); then once done can put [shortcodename] pages, inside square brackets that. there plugins allow run php , enter right on page, default shortcode functionality requires add shortcode first.

javascript - .on('click') only works once -

this question has answer here: why jquery or dom method such getelementbyid not find element? 6 answers i'm trying fill div different color tiles, have html <div id="field"> , , following javascript code: // want field globally accessible var field; var colors; $(document).ready(function(){ field = [[],[],[],[],[],[],[],[],[]]; colors =["black","yellow","blue","green","grey","brown"]; fillfield(); $(".tile").on('click', function(){ console.log("sfadfd"); var x = this.getattribute("data-x"); var y = this.getattribute("data-y"); console.log("x: "+x+", y: "+y); tileclicked(x,y); }); }); var tileclicked = function(x,y){ console.log(colors[field[y][x]]); field[y][x] = 0; showfield(); }; // di

animation - android animationing views for multiple devices -

i have small game in application, if right balloons float screen, balloons views moved 2 objectanimators in animation set, , on main debugging device works fine on other devices (including tablets) looks aweful values on place , views violently sway 1 side next. here snippet of im doing: //2 square balloons floating sb = (imageview)findviewbyid(r.id.squareballoon); sb.setvisibility(view.visible); sb2 = (imageview)findviewbyid(r.id.squareballoon2); sb2.setvisibility(view.visible); sp.play(inflate, 1, 1, 0, 0, 1); //left balloon objectanimator sqbalanim3 = objectanimator.offloat(sb,"x",-500,500); sqbalanim3.setduration(700); sqbalanim3.setrepeatcount(5); sqbalanim3.setrepeatmode(valueanimator.reverse); objectanimator sqbalanim = objectanimator.offloat(sb,"y",2000,-1800); sqbalanim.setduration(3000); sqbalanim.s

r - Holes in polygons disappear after performing checkPolygonsHoles from maptools -

note: @ edzer pebesma's suggestion, question has been crossposted r-sig-geo, here , has received responses. i encountered following unexpected result using checkpolygonsholes : # attach worldmap spatialpolygonsdataframe package maptools library(sp) library(maptools) data(wrld_simpl) # polygon hole shape_with_hole <- wrld_simpl[5,] # plot (hole left white, surrounded blue color) plot(shape_with_hole, col = "blue") # perform checkpolygonsholes shape_with_hole@polygons <- lapply(shape_with_hole@polygons, checkpolygonsholes) # plot again, holes aren't recognized such plot(shape_with_hole, col = "blue") # , original spatialpolygonsdataframe object changed !? plot(wrld_simpl[5,], col = "blue") one irritating side effect here original object wrld_simpl changed. result looks me bug, or have missed something? p.s.: object shape_with_hole edited checkpolygonsholes before, continues behave strange: # check polygons marked ho

excel - find a cell with specific text, multiple occurences, and past active cell in all cells containing specific text -

i working on report, originating in infoview (sap business objects) this report provides valuable information on weekly basis, enhance awareness of current shop performance. like tile of post might show want find cell specific text. has multiple occurrences, , want past selected cell in of instances. i can reach same result ctrl-f, "search all" ( "specific text") , paste (the selected cell) ( http://www.extendoffice.com/documents/excel/816-excel-select-cells-with-specific-text.html ) automate this. i want use: cells.find(what:="[ö]", after:=activecell, lookin:=xlformulas, lookat:= _ xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false _ , searchformat:=false).activate and cells.findnext(after:=activecell).activate but can't incorporate 2 in 1 macro gives me result describes above. the selected cell contains formula, containing index(match) , reference cell on same row "specific text&quo

assembly - The address of the "call" instruction's location -

i think "call" instruction kind of "jump" instruction. "jump" instruction have address go. , "call" instruction either should have target address. when disassemble binary, "call" instruction have lable of target function. then, how know go? in other words, can found target address of each function? x86, arm whatever. the addresses in assembly programming labeled symbolic names. , true not call instruction other instructions. there reason approach - addresses depend on in memory program loaded. also, instructions contains not address itself, offset, relative current address program executed. on other hand, programmer doesn't care exact value of address. want know address placed. why symbolic labels used. using symbolic labels meaningful names improves readability of source code , makes program easy support , extending. these symbolic addresses (labels) translated numbers during assembling of source code executabl

mysql - merge two large tables with unique values -

i have large tables, main 1 (tablea) around 14 million records , second 1 want merge 20 million records (tableb). part first subset of second. i tried making unique index using 2 or 3 fields combined identify records such mysql wouldn't it. i made own field 'unique' concatenating 3 fields. my question how import tableb tablea using unique records i.e. ones value in unique field in tableb not exist in unique field in tablea. since not make unique field actual unique index will/should try make each 1 pk , or ordinary index in respective tables? any thoughts on how efficiently appreciated. use sql union statement. "select * tablea join tableb"

jquery - Getting a JS error when publishing site -

getting a: error: referenceerror: $ not defined when publish website. though have jquery lib added in layout page, , on partialview complains not finding jquery lib how reference it: <script src="~/scripts/jquery-1.10.2.min.js"></script> when run website locally, works fine, no js errors, published, starts complaining. add code question, not sure code add. want know if there difference in how js files loaded when site published, when running locally. has experienced such errors? on 2nd thoughts, i'll try add code anyway. code complains this: (and in partialview) <script type="text/javascript"> $(document).ready(function () { $('#slider').rhinoslider(); $("#sliderholderqitoz").toggle("fade", 6000); }); </script> my layout looks this: <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=devi

arrays - Replace sequence of integers in vector by single number -

let a vector of integers in want replace sequence of numbers precise number. example: a = [ 8 7 1 2 3 4 5 1 2 3 4 5 6 7 ] and want replace sequence 1 2 3 9 . the result be: b = [ 8 7 9 4 5 9 4 5 6 7 ] any advice? this 1 approach strfind , bsxfun - pattern = [1 2 3]; replace_num = 9; b = start_idx = strfind(a,pattern) %// starting indices of pattern b(start_idx) = replace_num %// replace starting indices replacement b(bsxfun(@plus,start_idx(:),1:numel(pattern)-1))=[] %// find group %// indices of pattern except starting indices , %// delete them

Windows Batch script to get filename as input and search the file in a folder location -

i want create windows batch file includes 3 tasks mainly: 1.it ask user input like: please enter file name search: where have give file name , depending on file name search in specified location. 2.if file found ,again search pattern(e.g-"error") in file. 3.copy 10 lines line pattern found , paste contents file. example: you have entered file name as: demofile 1.it search demofile.log in specified location. 2.if above file found search pattern(e.g-"error"). 3.suppoese pattern error found in line #20 ,then copy contents line #20 line #30 file( mydemofile.txt ). it seems quite complex. anyhow need badly. thanks in advance :) below code snippet in prompts user file name. @echo off *** prompting user enter id***** set /p uname=please enter conversation id: if "%uname%"=="" goto error echo entered conversation id : %uname%, below log files related id: /f "tokens=* delims=" %%x in (a.txt) echo %%x *** f

Pass class as a function parameter in client program WCF C# -

i have written wcf program have class library declared function contains class parameter. i accessed function in client program don't know how pass class function. write code below. i have interface contains basic function declaration in class library there class implementing interface. interface contains method takes class parameter. that class parameter contains properties. [servicecontract] public interface icardetails { [operationcontract] string updatecardetails(car c); } public class cardetails : icardetails { public string updatecardetails(car c) { //some operations , initilizations string example = car.carno = "1234"; return "success"; } } public class car { private string carno; private string carmodel; public string carno { get{ return carno; } set{ carno = value; } } public string carmodel { get{ return carmodel; } set{ carmodel

python - Manually trigger Django email error report -

django error reporting handles uncaught exceptions sending email, , (optionally) shows user nice 500 error page. this works well, in few instances i'd allow users continue business uninterrupted, still have django send me email error report exception. so basically: can manually send email error report if catch exception? of course, i'd avoid manually generating error report email. you can use following code send manually email request , exception e : import sys import traceback django.core import mail django.views.debug import exceptionreporter def send_manually_exception_email(request, e): exc_info = sys.exc_info() reporter = exceptionreporter(request, is_email=true, *exc_info) subject = e.message.replace('\n', '\\n').replace('\r', '\\r')[:989] message = "%s\n\n%s" % ( '\n'.join(traceback.format_exception(*exc_info)), reporter.filter.get_request_repr(request) ) mai

excel - How to get timestamp of a remote country in VBA? -

i want timestamp of different country in vba. there direct function or way it? example, in india working mexico , want task based on mexican time. able splitting timestamp , manipulating not consider daylight saving in it. there simple solution writing big user-defined function? know time zone offset & client's time zone offset, use calculate difference dim indiatz single dim mexicotz single dim mytime date dim utc date dim mexicotime date indiatz = 5.5 mexicotz = -4 'note assumes they're in eastern time, 'mexico covers central, mountain & pacific @ -5, -6 & -7. 'you'll need figure out 1 need. mytime = 'need invert offset india utc utc = datediff("h", mytime, indiatz * -1) 'need invert offset utc mexico mexicotime = datediff("h", utc, mexicotz * -1)

javascript - how do i pass js variable in the where clause rails 4 -

<div class="field"> <%= f.label :section_id %> <%= f.select :section_id,options_from_collection_for_select(section.all, :id, :name )%> </div> <div class="field"> <%= f.label :sub_section_id %> <div id="sub_section_div"></div> </div> <div class="actions"> <%= f.submit %> </div> <script type="text/javascript"> $(document).ready(function(){ $("select#sub_section_section_id").change(function(){ var id_value_string = $(this).val(); **$('#sub_section_div').html('<%= j f.select :name,options_from_collection_for_select(subsection.where(:section_id=>1), :id, :name )%>');** }); }); </script> <% end %> i have 2 dropdowns section , subsection in view page.when select section want populate respective sub-section. problem want pass id_value_strin

JQuery add/remove class onClick -

open submenu on click, close on next click - that's achive. example this page (submenu under 'follow' link). opens submenu (adds class 'open'), not closing. stucked... :( my html: <ul id="toggle"><li> <a href="#">menu</a> <ul id="dropdown" class="dropdown-menu" role="menu"> <li><a href="#">2017</a></li> <li><a href="#">2012</a></li> <li><a href="#">2003</a></li> </ul> </li> <li><a href="#">contact</a></li> </ul> javascript: $(document).ready(function(){ $('#toggle li').on('click', function(){ $(this).removeclass('open').addclass('open'); }); }); http://jsfiddle.net/gallex/32pv6xz8/7/ you can use function toggleclass() this: $('#toggle li').on('click', funct

bluetooth lowenergy - android BLE,write operation,in the function(Setcharacteristicnotification) -

if carry out write operations,it means send data phone ble. clientconfig.setvalue(bluetoothgattdescriptor.enable_notification_value) can't run,and app stop. when writes,should call setcharacteristicnotification? besides,when write,oncharacteristicwrite staus= 133.i don't understand write good.this code. private final expandablelistview.onchildclicklistener serviceslistclicklistner = new expandablelistview.onchildclicklistener() { @override public boolean onchildclick(expandablelistview parent, view v, int groupposition, int childposition, long id) { if (mgattcharacteristics != null) { final bluetoothgattcharacteristic characteristic = mgattcharacteristics.get(groupposition).get(childposition); final int charaprop = characteristic.getproperties(); if ((charaprop | bluetoothgattcharacteristic.property_read) > 0) {

Is it an Android's potential support package for Material Design? -

does package named "design" can find in android support sources meant supporting material design: if yes, how use in android studio because doesn't work compile 'com.android.support:support-design:+' the package name wrong try with: com.android.support:design:22.2.0

java - Swing L&F - Import and implementation -

i built game on java , want make looks better, used default "nimbus" lookandfeel it's not enough. tried install other themes building .jar files class path didn't work times tried showed kinds of messages, maybe i'm doing wrong. grateful if explain me how make work! you can in way. add classpath theme want. search , copy qualified name and, finally, this: try { uimanager.setlookandfeel("javax.swing.plaf.nimbus.nimbuslookandfeel"); //uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); //uimanager.setlookandfeel("set.qualified.name.here"); } catch (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception e) { e.printstacktrace(); }

haskell - How to do automatic differentiation on complex datatypes? -

given simple matrix definition based on vector: import numeric.ad import qualified data.vector v newtype mat = mat { unmat :: v.vector } scale' f = mat . v.map (*f) . unmat add' b = mat $ v.zipwith (+) (unmat a) (unmat b) sub' b = mat $ v.zipwith (-) (unmat a) (unmat b) mul' b = mat $ v.zipwith (*) (unmat a) (unmat b) pow' e = mat $ v.map (^e) (unmat a) sumelems' :: num => mat -> sumelems' = v.sum . unmat (for demonstration purposes ... using hmatrix thought problem there somehow) and error function ( eq3 ): eq1' :: num => [a] -> [mat a] -> mat eq1' φs = foldl1 add' $ zipwith scale' φs eq3' :: num => mat -> [a] -> [mat a] -> eq3' img φs = negate $ sumelems' (errimg `pow'` (2::int)) errimg = img `sub'` (eq1' φs) why compiler not able deduce right types in this? difftest :: forall . (fractional a, ord a) => mat -> [mat a] -> [a] -> [[a]] difftest m φs as0 = gra

proxy - Generating requests which appear to be coming from multiple IP's -

we trying create simulation script need send tcp packet data server in way appears coming different ip every time. need emulate multiple devices ( different ip) sending data server. server creates new connection request coming in new ip. best possible way achieve ? there way of using proxy servers or sort of virtualization accomplish ? what want use ip aliasing. allows create virtual network interfaces. each virtual interface can have 1 or more ip addresses assigned it. this link shows how in linux. link shows how in windows. next clients need specify of addresses use. use getifaddrs() enumerate available addresses. use bind() system call on socket before connect() . way can have multiple clients , each 1 use different source ip address. post has details.

emacs - Orgmode: A report of tasks that are done within the week -

is possible ask org mode report list of todo items worked on over period of time? we can assume each todo entry have time tag, e.g. <2014-03-13 thu 17:04> a quick way @ logbook in agenda. you can @ agenda (see agenda views in org mode docs). move agenda time period want - day, week, month, year. put in logbook mode (via 'l' key, described in section 10.5 commands in agenda buffer ). show time period tasks worked on , when. you can use clock table (see section 8.4.2 clock table ) detailed report can set details of interested in. (note: section heading numbers refer in org-mode version 8.2.5h - version may differ, sections still there)

excel - VBA vlookup code in different sheet -

i new vba. have 2 sheets under excel: "data", "sheet1".data sheet amended every day. use vlookup vba macro rows added column in sheet1. code doesn't give me results (it works if run macro under same sheet data are). thank you private sub commandbutton21_click() on error resume next sheet1.range("b3:d500").clear dim dept_row long dim dept_clm long table1 = sheet1.range("a3:a50") table2 = data.range("a3:h24") dept_row = sheet1.range("b3").row dept_clm1 = sheet1.range("b3").column dept_clm2 = sheet1.range("c3").column dept_clm3 = sheet1.range("d3").column each cl in table1 sheet1.cells(dept_row, dept_clm1) = application.worksheetfunction.vlookup(cl, table2, 6, false) sheet1.cells(dept_row, dept_clm2) = application.worksheetfunction.vlookup(cl, table2, 7, false) sheet1.cells(dept_row, dept_clm3) = application.worksheetfunction.vlookup(cl, table2, 8, false) dept_row = dept_row + 1

python - How to compare rows in order to fill missing values in pandas -

i have dataframe 10 fields. in 10th field there missing data, , need fill them. so let's row, row-a, have 10th field empty. if there row-b such fields 3 7 row-a , row-b have same values, want copy value @ 10th field of row-b 10th field of row-a. , don't know how it.

android - How to emulate TrustZone in QEMU? -

i'm trying emulate trustzone features in qemu. i've found 2 links seems explain process. the first reference doesn't attach image kernel supports trustzone (where can find it?) the second reference explains how can compile kernel doesn't start command line written in first website follows ./arm-softmmu/qemu-system-arm -kernel $path_to_kernel/zimage -m vexpress-a15 -cpu cortex-a15 -dtb path_to_dtb/vexpress-v2p-ca15-tc1.dtb -m 1024 -append 'console=ttyama0,38400n8' -serial stdio -initrd $path_to_initrd/initrd.img is there alternate way run trustzone emulator? with op-tee (an open source tee) it's easy run trustzone on qemu. have entire stack running code normal world user space , linux kernel down secure world, running both tee trusted applications. qemu + op-tee works on both armv7-a , armv8-a. if want try out on local pc encourage head on optee_os/readme.md , follow instructions in section 4.1, 5 (only qemu related) , 6. in we're

Why does my AWS CLI hang when I try to do any operation in my new Amazon Linux instance? -

i have provisioned new ec2 instance using cloudformation, , have set network acl following rules: inbound 100 http (80) tcp (6) 80 0.0.0.0/0 allow 102 ssh (22) tcp (6) 22 0.0.0.0/0 allow 104 custom tcp rule tcp (6) 1024-65535 0.0.0.0/0 allow * traffic 0.0.0.0/0 deny outbound 100 http (80) tcp (6) 80 0.0.0.0/0 allow 102 custom tcp rule tcp (6) 1024-65535 0.0.0.0/0 allow * traffic 0.0.0.0/0 deny i have assigned iam role following policy instance: { "version": "2012-10-17", "statement": [ { "sid": "stmt1427889375000", "effect": "allow", "action": [ "s3:*" ], "resource": [ "arn:aws:s3:::my-bucket/*" ] } ] } when

android - achartengine time chart set initial range -

Image
solution instead of using setinitialrange() had set initial x-values using setxaxismin() setxaxismax() . little bit confusing, think. original question i'm working on project involving acharteninge library drawing time diagrams works excellent far. user capable of switching between various graphs (one xymultipleseriesdataset plus 1 timeseries per graph) via separate buttons. far, achartengine displays x values when graph shown. however, asked display data captured in first 3 hours when graph shown, information relevant. nevertheless, user should still able scroll data captured after first 3 hours meaning limiting x-axis maximum value not option. for example: there 2 curves. first curve drawn using data captured on period of 4 hours, while second curve created out of data captured on 18 hours. in current version programme displays data of graph gets displayed meaning first curve shows 3 hours of relevant data while 1 hour of not important information shown too. &qu