Posts

Showing posts from August, 2011

c# - How to access the session declared in Session_Start in Global.asax file in another class file in asp.net -

##global.asax file ## this global.asax file writing session variable protected void session_start(object sender, eventargs e){ session["myname"] = "something"; } the class below located in separate library in same solution -------------------------------------------- ## myclass.cs ## using system.web; public class myclass{ public string method() { string x = httpcontext.current.session["myname"]; return x; } } but here session value null. unable populate string. please let me know doing wrong.

Confluence keyboard shortcut markup -

on stackoverflow , can use markup keyboard shortcuts <kbd>ctrl</kbd>+<kbd>alt</kbd>+<kbd>f2</kbd> ctrl + alt + f2 . is possible in confluence ? if yes, how? do mean https://confluence.atlassian.com/display/doc/keyboard+shortcuts ? regards, gorka

html5 - Google map client side(Google Maps JavaScript API) geocoding keep counting quota of all session? -

Image
i'm using google maps javascript api load , search(geocoding) locations on map. google suggests use api key, i'm using api key in site can monitor requests too. also google says ; client-side geocoding not face quota limit unless perform batch of geocoding requests within user session. therefore, running client-side geocoding, don't have worry quota. but when check usage via google developer console, request keep counting i'm accessing , searching location different browsers(sessions). seems google count sessions geocoding requests 1 place. mean, quota limit when reaches 2500? or no need warry google says "you don't have worry quota." or missing something? thanks. from geocoding strategies -> quota considerations client-side geocoding through browser rate limited per map session, geocoding distributed across users , scales userbase. geocoding quotas , rate limits drive strategies outlined in article. and quota summ...

php - Eloquent next record -

i trying last 3 blog post database single variables (for templates). saw implementation @ other thred , works fine next record on third query returns null. opinion problem? blogcontroller.php: public function getindex($l = 'hu') { $post_last = post::orderby('created_at', 'desc')->first(); $post_2 = $post_last->next($post_last->created_at); $post_3 = $post_2->next($post_2->created_at); var_dump($post_3); } post.php:(model) <?php namespace civitas; use illuminate\database\eloquent\model; class post extends model { /** * physical table name */ protected $table = 'posts'; /** * next result in record list * * @param $created_at * @return mixed */ public function next($c) { return post::where('created_at', '<', $c)->get()->first(); } } i can't tell why function doesn't work, suggest...

serial port - Need help fixing C code for pololu maestro -

i trying move multiple servos using c language. using pololu mini maestro 24 channel enter link description here . modified code provided in user manual. pasted compact protocol in manual moving multiple servos. doesn't work. there no errors of warnings code doesn't work. used serial monitor , took peek @ serial output , got this: [b]aa 0c 1f [u]0d[/u] 0a 07 70 2e 70 2e 70 2e 70 2e 70 2e 70 2e 70 2e 70 2e 70 2e 70 2e [/b] i don't know why there '0d' in there. not supposed there. oh , getting pot position channel 0 can't move servos. great if can me it. // uses posix functions send , receive data maestro. // note: maestro's serial mode must set "usb dual port". // note: must change 'const char * device' line below. #include <fcntl.h> #include <stdio.h> #include <unistd.h> #ifdef _win32 #define o_noctty 0 #else #include <termios.h> #endif #include <math.h> int mod (int a, int b) { if(b <...

c++ - Why does assertion failed if both values are the same? -

string removenonalphas(string original) { for(int = 0; < original.size(); ++i){ if(!(original[i] > 64 && original[i] < 91) && !(original[i] > 96 && original[i] < 124)){ original[i] = original[i] - original[i]; } } return original; } //test1.cpp string test = "abc abc"; cout << removenonalphas(test) << endl; // output = "abcabc" assert(removenonalphas(test) == "abcabc"); // assertion failed //why assertion fail above? removenonalphas result("abcabc") same //rhs "abcabc" original[i] = original[i] - original[i]; what makes repaces character '\0' not remove it. because of output not "abcabc" "abc\0abc" . '\0' non-printable won't see in output present when compare == . instead of replacing charactes in string, create new string while iterating old one: string removenonalphas...

ms access - How to find parameter value -

situation: have report based on query. query not have parameter values need entered. yet when open report, asks me parameter values. question: how can find out part of report access needs these values? i've been searching on web, can find references query parameters, i've said, don't have. i managed solve missing parameters problem using following 2 strategies: entered fake variable ("xxxxxxxxxx") parameter, spot in preview version of report (once realized form was, realized particular form had small light green triangle in upper left hand corner indicating error) i used database documenter object definitions report subreport included. in report saw there expression included report grouping function. didn't show anywhere else! hope helps else!

What does the triple question mark mean in scala? -

i can't seem find anywhere. example have method such def somefunction(a: string): string ={ ??? } what triple question marks signify? ??? defined in predef , throws notimplementederror : def ??? : nothing = throw new notimplementederror it has return type of nothing sub-type of every type , can therefore used in place of return value.

c# - Dictionary throwing an Argument Exception even when protected by ContainsKey -

in production, code (c#, .net 4.5.1) throwing argumentexception stating an item same key has been added. code: public myclass() { this.mycontent = new dictionary<string, string>(); } public idictionary<string, string> mycontent { get; private set; } public void addorupdatedictionary(string key, string value) { if (this.mycontent.containskey(key)) { this.mycontent[key] = string.concat(this.mycontent[key], value); } else { this.mycontent.add(key, value); } } however, can't recreate error in unit test. e.g. behaves expected - [testmethod] public void addorupdatedictionary_whenaddingsecondvalue_valueisappended() { const string inputvalue1 = "value1"; const string inputvalue2 = "value2"; string expectedvalue = string.concat(inputvalue1, inputvalue2); var obj = new myclass(); obj.addorupdatedictionary("key", inputvalue1); obj.addorupdatedictionary(...

How do I get IntelliJ IDEA to import maven libraries correctly? -

i using intellij idea version 14.1.4 , importing maven pom.xml file create idea project configuration. expect read dependencies declared in pom file , configure idea module use libraries, not; instead fails locate (all of) libraries , therefore not build. (the project build command line using maven.) if open project structure dialog , @ individual module, can see has no dependencies other jdk , "". if try add 1 find maven libraries appear in list of "project libraries", none of ones need. if click "new library" add maven library can specify library name , appear in autocomplete list, when click "ok" error message "no files downloaded ". i tried looking in settings under build, execution, deployment > build tools > maven > repositories , local repository looks correct. furthermore, if open maven repository hand can find .pom , .jar files package. i welcome suggestion how fix or how troubleshoot it. [note: jetbrains f...

how to check the number of clicks the user clicks on an image in swift -

is there function count numbers of click user clicks on image , when user starts clicking on image count resets. example : there image requires user click on 3 times , image comes out requires user click on 5 times , there function can me in touchbegan method. you can use uitapgesturerecognizer , add 1 image views need. selector can choose same method every gesture recognizer. when user press in method increase counter , save view has received tap, if user change view can find mismatch between previous view , pressed one. in case reset couter.

javascript - Slickgrid - how to modify id value -

i'm getting grips slickgrid (with asp.net mvc end) simple start want editing grid key/value pair of systems settings. have working ok add, update works ok unless edit key. because have changed key value looks new key/value pair rather modifying existing item. question is, how let backend know item modifying ? i figure add field (holding original id) dataview, kind of wondering if missing functionality makes easier. $(function() { var grid; var columns = [{ id: "id", name: "name", field: "id", editor: slick.editors.text }, { id: "value", name: "value", field: "value", editor: slick.editors.text }, ]; var options = { enablecolumnreorder: false, editable: true, enableaddrow: true, enablecellnavigation: true, autoedit: false }; var dataview = new slick.data.dataview(); grid = new...

edittextpreference - ImageButton in EditText -

what code make image button stay @ top right of edittext when scrolled instead of following data input causing messy appearance? i create custom component, extending relativelayout , apply custom layout. have @ article, can desired result few edit of code: https://arunbadole1209.wordpress.com/2011/12/16/how-to-create-edittext-with-crossx-button-at-end-of-it/ clearable_edit_text.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <edittext android:id="@+id/clearable_edit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingright="35dip" /> <button android:id="@+id/clearable_button_clear" android:layo...

android - Two level listview with embedded sub items (image) -

Image
i create layout image below. items dynamic flavor of listview ou expandablelistview seems way go i'm curious see if know of existing component or way of implementing it. i don't care collapsing groups. thanks! if don't care collapsing groups (i.e. children displayed, always) can away using listview (or recycleview). this means can store data list (instead of list of lists), since items defined position in list (instead of pair of indexes: e.g. group/child). to this, override listview getviewtype , getviewtypecount methods. i'd direct existing post on how implement methods if don't know: android listview different layouts each row

c - How to find every java process? -

is possible somehow find every running java process? need processid of java processes. if install java developement kit, there exe called jps.rexe . if run exe finds every running java processes , lists processid. need same, written in c . jps.exe requires java developement kit installed. also note there 2 scenarios: - java.exe or javaw.exe (there more) process starts reuired process, in case "easy" find java processes. - second 1 more complicated. application started, components or features requires java, , there no java.exe or javaw.exe process running, application still uses jre. hopefully clear, want. does have have idea how this? thanks in advance! (take comment unfortunately long, post answer.) providing links stumbled upon looking answer: as using jre file means having open, sysinternals tool handle might helpful. seems use windows object manager able find open files (by path fragment) , associated processes. the promising c sou...

Why the results of the command 'date -u' command 'date' faster than the result of 25 seconds in linux(centos 5.1)? -

in centos release 5.10, results of command 'date -u' command 'date' faster result of 25 seconds. here result: [a@mg11za1 b]$ lsb_release -a lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0- ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch distributor id: centos description: centos release 5.10 (final) release: 5.10 codename: final [a@mg11za1 b]$ uname -a linux mg11za1 2.6.18-371.el5 #1 smp tue oct 1 08:35:08 edt 2013 x86_64 x86_64 x86_64 gnu/linux [a@mg11za1 b]$ date && date -u && /usr/sbin/hwclock --show fri jun 26 17:47:42 cst 2015 fri jun 26 09:48:07 utc 2015 fri 26 jun 2015 05:47:18 pm cst -0.235359 seconds and result of following code not right #include <time.h> #include <stdio.h> int main(int argc, char** argv) { time_t = time(null); struct tm today; localtime_r(&now, &today); printf( "secon...

java - External Jar Library not included to apk using Android Studio -

firstly know there similar questions not exact same problem , didn't solve problem. found solutions eclipse there no studio. when add external library jar, throws classnotfound exception running code. in other hand works fine on desktop module. there anyway solve problem? or reason? without knowing project looks can make couple guesses. in app's build.gradle (there separate 1 in folder below project can ignore 1 now) file need add jar files dependancies.. done default this: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) } this add jar files in libs folder normally place jar files in directory like: myprojectfolder/app/libs so make sure jar files in place gradle can find them in

jquery - Is it possible to apply a blur filter to a background-image of a div with position:fixed, from another div rendered on top of it? -

how question different proposed duplicate: i want only part of div.background-pic (the div background image) behind div.lower (the div translucent blue color), just appear be blurred. explained: as can see, div.background-pic position:fixed (which means out of flow, , not scroll), while rest of page scrolls vertically, implies there different parts of div.background-pic behind div.lower @ different times (while page being scrolled). so obvious don't want div image itself, (apply kind of filter if there one, etc.) on div.lower such causes part of the background-image of div behind it, appear blurred. question: jsfiddle in following sscce, want part of ( background-image of) .background-pic behind .lower (and partially visible because .lower translucent) appear blurred out. possible? .background-pic { background-image: url(http://khongthe.com/wallpapers/nature/beautiful-valley-45851.jpg); background-size: cover; position: fixed; z-i...

java - Why findViewById() doesn't work as getActivity().findViewById() here? -

/** * placeholder fragment containing simple view. */ public static class placeholderfragment extends fragment { public placeholderfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_detail, container, false); // detail activity called via intent. inspect intent forecast data. intent intent=getactivity().getintent(); textview text=(textview)rootview.findviewbyid(r.id.text1); string b=intent.getstringextra(intent.extra_text); text.settext(b); return rootview; } } in code when using textview text=(textview)getactivity().findviewbyid(r.id.text1) then app crashes , logcat says that caused by: java.lang.nullpointerexception: attempt invoke virtual method 'android.view.vi...

php - Proper method of storing private images on server? -

i have written php script retrieve images not under public_html folder. script authenticates user has permission view image displays it. image permissions set "0755" secure method prevent other people viewing private images? hashing image file name add security benefit? there other alternative methods improve script? script of image_retrieval.php <?php include '../user_verification.php'; $image_request = $_get['image_request']; $pic = file_get_contents("/home/username/images/'.$image_request.'"); header('content-type: image/jpeg'); echo $pic; ?> script of display_image.php <?php include '../world/verification.php'; $image_request = $_get['image_request']; echo"<img src='http://www.domainname.com/request_image.php?userid=$userid&image_request=$image_request'>"; ?> <form id='image_requester' method='get' action='display_image.php'> ...

java - What Swing layout(s) should I use for this? -

Image
could please tell me layouts should use make image below? know you'll have use multiple layouts this, i'm having problem don't know main panel layout be, panel containing other panels inside. please neeed know panel layouts should use make picture below. (the frame stretches , of buttons stretches) gridbaglayout flexible layout, , can use accomplish example shown. oracle has great tutorial on how use gridbaglayout . should easy find on google.

Handling Float/Double datatypes using Aerospike Java Client -

i came know java client 3.0.33 supports float/double datatype @ client side. release notes says: support double/float on client-side. server store these values longs. fine. when insert float value aerospike bin, stored long integer in aerospike server. whereas while retreiving value using java client, getting long integer saved in server. expect java client should have converted long float automatically on retrieval. done in python client (serialize/deserialize). have explicitly use getfloat() convert float while using java client. question how know bin need apply getfloat() , bin should not. because never know datatype reading inserted float. in advance. use aerospike java client 3.1.2 following code. double/float stored serialized java type, long write , read jave fine. key key = new key("test", "some-floats", "float-001"); bin bin = new bin("a-float", 3.14159f); this.client.put(null, key, bin); record record = this.client...

python - Incorrect results with Sympy when utilizing (numpy's) floats -

Image
i trying calculate velocity tensor time dependent rotationmatrix re(t) (namely earth rotation @ latitude 48.3°). achieved determining skew symmetric matrix se(t) = dre(t)/dt * re.t . obtaining incorrect results when utilizing float instead of sympy expression, shown in following example: from ipython.display import display import sympy sy sy.init_printing() # latex pretty printing ipython def mk_rotmatrix(alpha, coord_ax="x"): """ rotation matrix around coordinate axis """ ca, sa = sy.cos(alpha), sy.sin(alpha) if coord_ax == "x": return sy.matrix([[1, 0, 0], [0, ca, -sa], [0, sa, +ca]]) elif coord_ax == 'y': return sy.matrix([[+ca, 0, sa], [0, 1, 0], [-sa, 0, ca]]) elif coord_ax == 'z': return sy.matrix([[ca, -sa, 0], [sa, +ca, 0], ...

java - Array to TextView -

i create simple method: private void getcheckeditems() { int len = mgrid.getcount(); sparsebooleanarray checked = mgrid.getcheckeditempositions(); list <integer> numberlist = new arraylist<>(); (int = 0; < len; i++) if (checked.get(i)) { integer item = mnumber.get(i); numberlist.add(item); integer[] mnumberarray = numberlist.toarray(new integer[numberlist.size()]); log.d("played number: ", ""+ arrays.tostring(mnumberarray)); } } with control method such elements selected grid , them return. split array put in textview ! how can do? arrays.tostring(mnumberarray) give string [2,3,45,67] remove brackets [] , have string "2,3,45,67" . can split string , string array. set each element of array each text view

jquery ui sortable append -

here jquery code stands. $(document).ready(function() { $('#btn1').click(function() { $("ol").append("<li>"+$("#txt1").val()+"</li>"); $("#txt1").val("").focus(); $('li').addclass('block2'); $('li').click(function() { $(this).hide(500, function() { $(this).remove('li'); }); }); }); }); its blank todo list, when enter in text , click button, appends list. i'm looking code re-arrange items in list 'that have been appended'. examples jquery-ui sort-able or drop-able, have 'li' elements in place in html not work in code. how add jquery code make user entered list rearrangable? you can recalling sortable() inside first .click() , so: $(document).ready(function() { $('#btn1').click(function() { $("ol").append("<li>"+$("#txt1").val()+"</li>"); ...

javascript - jquery - issue getting script tags after two .filter()'s -

i have ajax response want parse tags, , want find script tags within specific div id. below capture , run each javascript within page: success: function(data) { var dom = $(data); dom.filter('script').each(function(){ var obj = $(this); $('#my_div').append(obj); }); }, when try filter first div id, , script not append anything. have access reponse html obviously, , can see there should multiple tags in 'js_outer_div' div: var dom = $(data); dom.filter('js_outer_div').filter('script').each(function(){ var obj = $(this); $('#my_div').append(obj); }); unfortunately have no control on response html. there way filter first div , script wanting? edit: sample html response: ... <div id="i9-content-div"> <script xmlns:efactions="http://www.enginframe.com/2009/efactions" xmlns:grid=...

javascript - capture photo with camera in cordova application -

i continue training on cordova , javascript (i need it). try create little application using camera. have take code provide below [ http://cordova.apache.org/docs/en/2.5.0/cordova_camera_camera.md.html#camera] , i'm trying adapt code in cordova project in netbeans. i code below. provide index.html , index.js. have problem when test in emulator. when click on button, nothing happened, there not error message, nothing , take not picture camera. seem there problem line in method capturephoto because have warning in netbeans (global variable destinationtype not declared). me please ? index.html <head> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight...

google bigquery - tbigqueryinput Talend limit error -

whenever fetching data bigquery table specifying more 100000 records, giving me below error running query : select action_payout [freebstaging.fb_appreporting] limit 1000000 exception in component tbigqueryinput_1 com.google.api.client.googleapis.json.googlejsonresponseexception: 404 not found { "code" : 404, "errors" : [ { "domain" : "global", "message" : "not found: table igneous-study-87009:_165c6d3f4b2c1dbd0d644a1155ebebf7f2dbacfd.anon22fbed90bfc239ef84ee0345744d6cda6052a060", "reason" : "notfound" } ], "message" : "not found: table igneous-study-87009:_165c6d3f4b2c1dbd0d644a1155ebebf7f2dbacfd.anon22fbed90bfc239ef84ee0345744d6cda6052a060" } even if don’t specify limit giving me error. working fine less 100000 records. the query job id provided in comments fails because result large. bigquery has allowlargeresults options...

c# - How do i return a false or true each process so i can monitor if the process is in front or not? -

in form1 have timer: private void form1_load(object sender, eventargs e) { system.windows.forms.timer t1 = new system.windows.forms.timer(); t1.interval = 50; t1.tick += new eventhandler(timer1_tick); t1.enabled = true; } the tick event: private void timer1_tick(object sender, eventargs e) { label4.text = setprocesswindow.applicationisactivated().tostring(); } and applicationisactivated method: public static bool applicationisactivated() { process[] processes = process.getprocesses(); foreach (process singleprocess in processes) { var activatedhandle = getforegroundwindow(); if (activatedhandle == intptr.zero) { return false; } var procid = singleprocess.id;//process.getcurrentprocess().id; int activeprocid; ...

r - Convert quarter/year format to a date -

i created function coerce vector of quarters-years format vector of dates. .quarter_to_date(c("q1/13","q2/14")) [1] "2013-03-01" "2014-06-01" this code of function. .quarter_to_date <- function(x){ ll <- strsplit(gsub('q([0-9])[/]([0-9]+)','\\1,\\2',x),',') res <- lapply(ll,function(x){ m <- as.numeric(x[1])*3 m <- ifelse(nchar(m)==1,paste0('0',m),as.character(m)) as.date(paste(x[2],m,'01',sep='-'),format='%y-%m-%d') }) do.call(c,res) } my function works fine looks long , little bit complicated. think should done in other packages( lubridate example) can't find it. can me simplify code please? 1) zoo package has "yearqtr" class. convert , "date" class: library(zoo) x <- c("q1/13","q2/14") as.date(as.yearqtr(x, format = "q%q/%y")) ## [1] "2013-01-01...

python - API doesn't accept requests.put HTTP call, JSON formatting -

i'm trying make http call using requests http library python. i have code: import requests import json body = json.dumps({"on": "false"}) url = "http://192.168.100.100/api/0000/lights/4/state" r = requests.put(url=url, data=body) however, api responds with "error": { "type": 7, "address": "/lights/4/state/on", "description": "invalid value, true }, parameter, on" i'm not entirely sure problem is, body getting formatted wrong; r.request.body says {"on": "false"} when should be {"on": false} if take off quotes code get nameerror: name 'false' not defined the call works when done in browser, know value correct parameter. how can correctly send call? try changing body = json.dumps({"on": "false"}) body = json.dumps({"on": false}) notice capitalization ...

python - No exponential form of the z-axis in matplotlib-3D-plots -

Image
i have similar problem described in how prevent numbers being changed exponential form in python matplotlib figure : i don't want (in special case) weird scientific formatting of axis. problem different have problem @ z -axis. 2-d plots can use ax.get_yaxis().get_major_formatter().set_useoffset(false) . , there no function ax.get_zaxis() what use format z -axis same way? edit: example: from mpl_toolkits.mplot3d import axes3d import numpy np import sys import matplotlib import matplotlib.pyplot pyplot def func(xi, ti): res = 10e3 + np.cos(ti) * np.sin(xi) return res if __name__ == '__main__': timespacing = 20 timestart = 0 timeend = 1 time = np.linspace(timestart, timeend, timespacing) widthspacing = 50 widthstart = 0 widthend = 3 width = np.linspace(widthstart, widthend, widthspacing) reslist = [] matplotlib.rcparams['legend.fontsize'] = 10 fig = pyplot.figure() ax = fig.gca(projection = '3d...

How to display discount percentage if discount percentage is greater than zero? PHP -

i have php script selling deals. currently, there 2 requirements deal; 1 deal_value (original price) , special_value (discount price). have variables: deal_value, special_value, deal_percentage (which coded discount percentage). these inserted database already. so how show discount percentage label if deal percentage > 0%? fyi: have php html hot label already, how code , display hot_label if deal percentage > 0%? also, need echo whole div= hot_label, there php inside , because there css in class=hot_label <div class="hot_label"> <p>off</p> <b><?php echo round($h->deal_percentage); ?>%</b> </div> <?php if ( $h->deal_percentage > 0) { echo '<div class="hot_label"><p>off</p><b>' . round($h->deal_percentage) . '%</b></div>'; } ?>

drag and drop - Layout flicker when dragging view in its MotionEvent.ACTION_MOVE android -

Image
here picture of i'm trying do: so, want resize single cell while dragging resize anchors (black quads) imageviews. attached custom ontouchlistener them next in motionevent.action_move: calculate drag offset set cell height/width based on offset reposition anchor point changing it's layout params the outcome of cell resizes there king of flicker, more shaking left/right or up/down, small offset. my guess problem comes when catches move event, manualy change position of anchor , then, when catches move event again doesn't handle change well...or something i have idea put invisible imageviews under each anchor , resize based on movement not move anchor while draging. when relese it, lines coresponding visible anchor. more hacking solution :) and finally, anubody know why happening? edit: here code i'm handlign move event: float dragy = event.getrawy() - resizepreviouspositiony; linearlayout.layoutparams componentparams = (line...

d3.js - Map data for lineWithFocusChart time series -

i trying create timeseries using nvd3 linewithfocuschart model. data array of objects this: [ { "key": "red", "values": [ { "date": "2015-06-17t11:00:00.000z", "value": 17 }, ...] }, { "key": "green", "values": [ { "date": "2015-06-17t11:00:00.000z", "value": 20 }, ...] }, ] i want map date x , value y , looking @ other examples typically done this: nv.addgraph(function() { var chart = nv.models.linewithfocuschart() .x(function(d) { return new date(d.daterun)}) .y(function(d) { return d.value}); chart.brushextent([50,70]); chart.xaxis.tickformat(d3.format(function(d) { return d3.time.format('%x')(new date(d)...

Understanding lambda's sort function in python -

i trying sort list of lists in python. have written following code: def sort(intervals): if intervals == [] : return [] intervals.sort(key = lambda x:x.start) return intervals = [[1,3],[8,10],[15,18],[2,6]] print(sort(a)) i getting following error: attributeerror: 'list' object has no attribute 'start' please can explain lambda function sort , details above error. thank you!! the reason error message sort ing based on attribute not list ( start not attribute of list') , quick fix is, either use sort method of list or use built-in method sorted : 1 - using sort method of list : intervals.sort(key = lambda l:l[0]) 2 - using built-in method sorted : intervals = sorted(intervals, key=lambda l:l[0]) reading more sorting list in wiki post, interesting.

igraph - How to compress rows to a binary list in R? -

i have list of page visits session id. need modify list of 2 pages each, repeating across list until used. id duplicated down new rows. need keep prior node go new one. i want turn this: session page id1 home id1 inventory id1 details id1 home id2 inventory id2 home id2 details id2 inventory id3 inventory id3 details id4 details id4 inventory id4 details id4 inventory id4 details id4 inventory id4 details id4 inventory id4 home into this: session node1 node2 id1 home inventory id1 inventory vehicles id1 vehicle home id2 inventory home id2 home vehicle id2 vehicle inventory id3 inventory vehicle id4 vehicle inventory id4 inventory vehicle id4 vehicle inventory id4 inventory vehicle id4 vehicle inventory id4 inventory vehicle id4 vehicle inventory id4 inventory home the ultimate g...

c# - Cant debug Using QueueClient.OnMessage on a console app -

i need able debug following console application know if messages correctly deserialized or not. however, when press f5 on visual studio, can debug line: string mensaje = message.getbody(); but following line seems not executed, , console app closes , can't see message wrote console. best guess because nature of async calls onmessage thing. not sure. class program { static void main(string[] args) { try { string connectionstring = cloudconfigurationmanager.getsetting("microsoft.servicebus.connectionstring"); console.writeline("press key continue"); console.readkey(); queuehelper.receivemessageempresa("empresa", connectionstring); } catch (exception ex) { throw ex; } } } public static void receivemessageempresa(string queuname, string connectionstring) ...

outlook vba - Saving "Device Independent Bitmap" attachment -

how save kind of attachment (from signed message)? saved .saveasfile method, without extension , no application can open it. set outitem = application.activeexplorer.selection.item(1) each att in outitem.attachments att.saveasfile "c:\temp\" & att.displayname next for olole attachments, need open attachment istorage com object , extract data (which can mangled) 1 of streams inside storage - can see data in outlookspy : select message, click imessage button on outlookspy ribbon, go getattachmenttable tab, double click on 1 of attachments. select pr)_attach_data_obj property, right click, imapiprop::openproperty, select iid_istorage. data cannot accessed in vba using outlook object model if using redemption option, rdoattachment .saveasfile method smart enough extract bmp, emf, pdf, excel, etc. file data storage. following (off top of head) should job: set session = createobject("redemption.rdosession") session.mapiobject = applicatio...

angularjs - displaying placeholder in form text field -

i'm working ui bootstrap , i'm using typeahead directive. added placeholder attribute display text before typing. my controller returns list of json , related textbox: <input type="text" ng-model="selected" placeholder="data loaded via $http" typeahead="users (users.first + ' ' + users.last + ' ' + users.gender) users in getdata($viewvalue)" class="form-control"> problem: when load page text box display 2 blank chars istead of palceholder. i able fix issue white space in typehead attribute. problem version of angular , bootstrap have used. have updated plnkr. please find below updated plnkr : updated plnkr: http://plnkr.co/edit/mbswee?p=preview

clone - Java: Rationale of the Cloneable interface -

why wasn't .clone() method specified in java.lang.cloneable interface ? basically, it's broken interface. ken arnold , bill venners discussed in java design issues . arnold: if god @ point, , many people glad not, deprecate cloneable , have copyable , because cloneable has problems. besides fact it's misspelled, cloneable doesn't contain clone method. means can't test if instance of cloneable , cast cloneable , , invoke clone . have use reflection again, awful. 1 problem, 1 i'd solve.

d3.js - 'd3-circle-text' on zoomable circle-pack -

the 'd3-circle-text' plug-in works great on static circle-pack (many musically-ut contributing https://github.com/musically-ut/d3-circle-text ). however, on zoomable circle-pack, labels fly place (in fiddle, stay static not repositioning on zoom). is possible circle-text zoom circles? (if plug-in isn't zoomable, that's ok. i'll try labelling approach.) here's code section i'm working on: ////////////circle text var circletext = d3.circletext() .radius(function(d) { return d.r - 5; }) .value(function(d) { return d.key; //get lables }) .method('align') .spacing('exact') .precision(0.1) .fontsize('100%'); var gtexts = svg.selectall('g.label') .data(pack.nodes) //returns names .enter() .append('g') .classed('label'...

c# - Read/Write synchronizer , get the owner of the lock -

probably simple question, due lack of knowledge on c# i'm having hard time finding solution this. here's deal, have implement semaphore 5 methods, lockread, lockwrite, releaseread, releasewrite , releaselockwriter. the names of first 4 methods quite self-explanatory, last 1 method releases writer lock , acquires read lock atomically. now problem here releaseread, releasewrite , releaselockwriter can called thread has acquired read or write lock, respectively. how can know if thread owner of lock? possible solution creating id's each thread , passing them when acquiring lock , when releasing passing id again , check if id owner, there's better way of doing it.

ios - Swift: Extra argument 'error' in call -

i'm developing first ios app using swift 2.0 , xcode beta 2. reads external json , generates list in table view data. however, i'm getting strange little error can't seem fix: extra argument 'error' in call here snippet of code: let task = session.datataskwithurl(url!, completionhandler: {data, response, error -> void in print("task completed") if(error != nil){ print(error!.localizeddescription) } var err: nserror? if let jsonresult = nsjsonserialization.jsonobjectwithdata(data, options: nsjsonreadingoptions.mutablecontainers, error: &err) as? nsdictionary{ if(err != nil){ print("json error \(err!.localizeddescription)") } if let results: nsarray = jsonresult["results"] as? nsarray{ dispatch_async(dispatch_get_main_queue(), { sel...

asp.net mvc 4 - Emitting an HTML string from anonymous type property in a repeated, dynamically-typed Partial View -

i passing anonymous type dynamic partial view part of @model , , 1 of properties string contains html. when use htmlhelper methods render property, razor engine encoding string, resulting in literal text on page - <i>text</i> in case, instead of desired text . since dynamically typed view, cannot call property directly. specifically, if try bind @model.myfield , runtimebindingexception : 'object' not contain definition 'myfield' ideally create type (or @ least interface) specify view (which recommend optimal solution), scope of work not permit this. plus i'm using partial view in first place can recycle template different types, have same property names not same type properties (yay legacy code!). i have looked @ several related questions address similar issues, answers not work specific situation (due needing anonymous type passed @model dynamic view)). displaying html string model in mvc razor view lists several failed approaches,...