Posts

Showing posts from September, 2010

algorithm - Represent a number as a sum of a subset of an array -

given natural number s>10, generate array of n natural numbers = (a1, a2, …, ak, …, an) such s sum of m ai. constraint 1: ai < s/2 constraint 2: m >= k constraint 3 (optional): ai != aj sorry, i’m not sure how describe problem using proper mathematical notation, idea simple: generate values add pre-defined total. , add more values (“decoys” were) make task of selecting right values use more difficult. let's s=18 , want represented sum of @ least 3 values. so, "winning" array a=(7,8,3,4,5) because 7+8+3=18 , there's no way use less 3 values 18. i have simple algorithm kinda works: input: s - sum k - number of values required add s n - total number of values (includes decoys) output: - array of values ai 1) generate k values dividing s k , adding , subtracting random numbers. ensures ai more or less random while still adding s. 2) generate (n-k) random values less s/2 each. 3) combine generated values 1 array a. 4) test s can repres...

thrift - In Apache Spark SQL, How to close metastore connection from HiveContext -

my project has unit tests different hivecontext configurations (sometimes in 1 file grouped features.) after upgrading spark 1.4 encounter lot of 'java.sql.sqlexception: instance of derby may have booted database' problems, patch make contexts unable share same metastore. since not clean revert state of singleton every test. option boils down "recycle" each context terminating previous derby metastore connection. there way this? well in scala used funsuite unit tests beforeandafterall trait. can init sparkcontext in beforeall, spawn hivecontext , finish this: override def afterall(): unit = { if(sparkcontext != null) sparkcontext .stop() } from i've noticed closes hivecontext attached it.

javascript - Displaying subitems in responsive JQuery/CSS menu -

i'm sorry if i'm duplicating question... promise i've looked everywhere answer this. i'm looking add submenu responsive menu. i'm struggling finding way display subitems main items in responsive way. so here's code snippets... css still little rough, i'm working on can display menu items 1 slidetooggle(); i should mention working on in joomla... i've checked module configuration , template , i'm pretty sure problem not there. maybe have suggestion? ok, here's code snippets. in advance! :) $(function() { var pull = $('#pull'); menu = $('nav ul'); menuheight = menu.height(); $(pull).on('click', function(e) { e.preventdefault(); menu.slidetoggle(); }); $(window).resize(function(){ var w = $(window).width(); if(w > 320 && menu.is(':hidden')) { menu.removeattr('style'); } ...

performance - How to pass a variables to a function called by ENTER_FRAME without override -

updated i have got big cluttery code want speed instantiating cubeeaseout class once. through ff: var myclass = new cubeeaseout() myclip.addeventlistener(mouseevent.mouse_over, onmouseover); myclip2.addeventlistener(mouseevent.mouse_over, onmouseover); myclip3.addeventlistener(mouseevent.mouse_over, onmouseover); function onmouseover(e:event){ //made changes here myclass.initializer(e.currenttarget, ["scalex",1.5,"height",200]); } so whenever move mouse on of clips, function named initializer() inside cubeeaseout class called. inside cubeeaseout class, have got code lunches on enter_frame once periodically call function animatethis() . package; import goes here... class cubeeaseout extends sprite { var here... public function new(){ super(); addeventlistener(event.enter_frame, animatethis); } public function initializer(mc:dynamic, vars:array<dynamic>()){ vars[1] //this float value 1.5...

c - String print out differently in Visual Studio and gcc -

i have created simple project using visual studio 2012, , code compiled successfully, ran, , printed out expected (the fruit name is: apple). when try compile same code gcc, print out looks different (the fruit name is: apple'). ' come from? below code: #define _crt_secure_no_warnings #include <stdio.h> #include <string.h> #include <stdlib.h> char * getcharvalue(char line[]){ char *pch = strchr(line, '='); //find equal sign in line char *pch1 = strchr(line, '\0'); // find index of end of line char *info = (char *) malloc(sizeof(char) * (pch1-pch-4)); info[pch1-pch-5] = '\0'; // copy value new array return new char; memcpy(info, &line[pch-line+3], pch1-pch-5); return info; } int main() { char namefilename[] = "name.txt"; //register file name; char *namevalue; file *fid = fopen(namefilename, "r"); if (fid != null){ char line[150]; whil...

windows runtime - UWP/WinRT: How to scroll a RichEditBox to the cursor position? -

i've implemented find function on richeditbox when executed search query , select found text inside richeditbox: string^ doctext; currentricheditbox->document->gettext(text::textgetoptions::none, &doctext); start = currentricheditbox->document->selection->endposition; end = doctext->length(); int result = newrange->findtext(query, end-start, text::findoptions::none); if (result != 0) { currentricheditbox->document->selection->setrange(newrange->startposition, newrange->endposition); } this works, in text found selected. however, richeditbox contents long scroll, off-screen , richeditbox won't scroll bring view. oddly enough, however, if code re-run it'll scroll view previous result. example, take following text: this test [screen end] 1 hat 2 hat when code searches hat, highlight first instance of word hat. however, richeditbox won't scroll down it, though it's off-screen. second time cod...

android - Get yuv size size stored by Mediabuffer -

i use openmax decode video frame,my sample this: file* fp = fopen("/data/local/tmp/test.yuv", "wb"); while(!isexit) { mediabuffer *mvideobuffer; mediasource::readoptions options; status_t err = mvideodecoder->read(&mvideobuffer, &options); if (err == ok) { if (mvideobuffer->range_length() > 0) { // if video frame availabe, render mnativewindow int w = 0; int h = 0; int dw = 0; int dh = 0; int stride = 0; sp<metadata> metadata = mvideobuffer->meta_data(); sp<metadata> outformat = mvideodecoder->getformat(); outformat->findint32(kkeywidth , &w); outformat->findint32(kkeyheight, &h); int64_t timeus = 0; metadata->findint64(kkeytime, &timeus); metadata->findint32(kkeydisplayheight, &dh); metadata-...

c++ - x64 function detouring without inline assmebly -

good evening, fellow coders , hackers. i'm experimenting binary patching, more precise: detouring functions not called via vftable. what doing in detail i'm injecting dll running process , determine start address of function ( original function ) scanning signature. once i've found it, rewrite first 13 bytes own shell code redirect every call function function of dll ( hook function ): mov rax, <dll_function_address> jmp rax ret the hook function calls address of original function again, after removing shellcode in order prevent endless recursion. once original function returns, hook function meant return value has returned preserve regular code flow. the issue you might have noticed shellcode no means preserve registers (not rax, might not manipulated hook function , manipulated shellcode. therefore, original function fails when called hook function . wanted add inline assembly push registers stack first action in hook function popping the...

How to do PCA and SVM for classification in python -

i doing classification, , have list 2 sizes this; data=[list1,list2] list1 1000*784 size. means 1000 images have been reshaped 28*28 size 784 . list2 1000*1 size. shows label each images belonged to. below code, applied pca: from matplotlib.mlab import pca results = pca(data[0]) the output this: out[40]: <matplotlib.mlab.pca instance @ 0x7f301d58c638> now, want use svm classifier. should add labels. have new data svm: newdata=[results,data[1]] i not know how use svm here. from sklearn.decomposition import pca sklearn.svm import svc sklearn import cross_validation data=[list1,list2] x = data[0] y = data[1] x_train, x_test, y_train, y_test = cross_validation.train_test_split(x, y, test_size=0.4, random_state=0) pca = pca(n_components=2)# adjust pca.fit(x_train) x_t_train = pca.transform(x_train) x_t_test = pca.transform(x_test) clf = svc() clf.fit(x_t_train, y_train) print 'score', clf.score(x_t_test, y_test) print 'pred label', c...

html - My div won't change width with my javascript function -

i have made makeshift progress bar 2 divs, styled css fit 1 in make progress bar. have button changes width of inside div go when click button, button click not change width of div. made sure made no errors, javascript console in chrome browser gives no errors when click button. anyways, here code: function clickme() { var newexp = parseint(document.getelementbyid("exphold").innerhtml); document.getelementbyid("bar2").style.width = newexp + 'px'; document.getelementbyid("exphold").innerhtml += '+1'; document.getelementbyid("exphold").innerhtml = eval(document.getelementbyid("exphold").innerhtml); } #bar1 { border: 2px solid gold; height: 15px; width: 100px; background-color: blue; border-radius: 8px; } #bar2 { height: 15px; width: 1px; background-color: skyblue; border-radius: 8px; } <div id="bar1"> <div id="bar2"> </div>...

Delete in C++ and garbage collection in Java -

does delete in c++ work same way garbage collection in java? mean, memory management part internally (what happens in heap in both cases?). in c++, functionality of delete , delete[] , , new operators can defined through operator overloading, can make work want. in java's heap behavior defined jvm, , in general, long no references object exist in memory, cleared out garbage collector eventually. see this more details on java's garbage collection.

How to use cmd command "tasklist" to list all processes and it;s cpu usage? -

Image
i want list processes , it's cpu usage, can "tasklist" command acheive? i want list image name,pid,and cpuusage througn cmd command this, has no cpu usage use tasklist /v . you may want set mode 240 before, or redirect output file: tasklist /v >tasklist.txt (sorry, tasklist not support selection of properties show; "standard" view or "verbose" view)

java - The method write(int) in the type BufferedWriter is not applicable for the arguments (byte[]) -

i beginner spring, i trying download file net , store in local disk getting compilation error mentioned in tile i tried make responseentity , json string worked says image damaged or not supported when try open image my code: public static void main(string arg[]) throws ioexception { httpheaders requestheaders = new httpheaders(); //requestheaders.setacceptencoding(contentcodingtype.identity); httpentity<?> requestentity = new httpentity<object>(requestheaders); // create new resttemplate instance resttemplate resttemplate = new resttemplate(); // add string message converter resttemplate.getmessageconverters().add(new stringhttpmessageconverter()); // make http request, marshaling response string responseentity<byte[]> response = resttemplate.exchange("http://www.nndb.com/people/954/000354889/duke-kahanamoku-2-sized.jpg", httpmethod.get, requestentity,byte[].clas...

android - authorization error while calling adapter from iphone -

when make adapter call iphone getting following error in server log , while in android working fine. srve0190e: file not found: /authorization/v1/clients/instance [error ] fwlse0048e: unhandled exception caught: srve0190e: file not found: /authorization/v1/clients/instance java.io.filenotfoundexception: srve0190e: file not found: /authorization/v1/clients/instance @ com.ibm.ws.webcontainer.extension.defaultextensionprocessor.handlerequest(defaultextensionprocessor.java:528) @ com.ibm.ws.webcontainer.filter.webappfilterchain.invoketarget(webappfilterchain.java:127) @ com.ibm.ws.webcontainer.filter.webappfilterchain.dofilter(webappfilterchain.java:88) @ com.worklight.core.auth.impl.authenticationfilter$1.execute(authenticationfilter.java:217) @ com.worklight.core.auth.impl.authenticationservicebean.accessresource(authenticationservicebean.java:76) @ com.worklight.core.auth.impl.authenticationfilter.dofilter(authenticationfilter.java:222) @ com.ibm.ws.w...

google play - Blocking installation of android apps on a Particular Manufacturer's Device -

is there way through can restrict android devices of particular manufacturer installing apps google play store. no, there no such way,, unreliable since many new manufacturing companies register android os. i.e: more 15 companies operating locally in country.. besides giants samsung, sony, htc etc. you can restrict device on hardware or software features like, cpu architecture. for complete list of filters available check official guide .

Convert data format for R package Mfuzz -

i have dataframe called mydf containing 4 different columns. want convert format accepted mfuzz package generate cluster. want see cluster of sample1 , sample2 , sample3 . how convert mydf format used in mfuzz ? mydf s. no sample1 sample2 sample3 1 0.003 0.9 11.3 2 0.003 1.9 33.3 3 0.004 2.9 3.4 4 0.005 2.0 44.4 5 0.004 2.3 43.4 i hope little example helpful set.seed(42) mydf = data.frame(a=rnorm(10),b=runif(10),c=rpois(10,l=1)) test = new('expressionset', exprs=mydf) # fails test = new('expressionset', exprs=as.matrix(mydf)) # works t.cl = mfuzz(test,c=3,m=1.25) mfuzz.plot(set,cl=t.cl, mfrow=c(2,2))

asp.net web api - datacontext in johnpapa angularjs -

in recent project, opted johnpapa angularjs framework web app. now, want our pages interact web api located on server. so, have googled bit , found there 2 approaches 1 factory , other service. , datacontext located in johnpapa angularjs framework factory. so, looks calls going make our webapi's needs implemented in teh datacontext factory. seems little messy imo. , want create seperate file each service/factory i.e. usersvc.js, ordersvc.js so, approach split functions in different service/factory according logical separation. and, second thing need create service or factory calling webapis.

java - Compare two objects field by field and show the difference -

i want compare 2 object i.e 2 database rows field field. e.g. object1[name="abc", age=29, email="abc@amail.com"] , object2[name="xyz", age=29, email="xyz@amail.com"] suppose want compare these 2 object , want output this [{ "fieldname" : "email", "oldobjectvalue" : "abc@amail.com", "newobjectvalue" : "xyz@amail.com" }, { "fieldname" : "name", "oldobjectvalue" : "abc", "newobjectvalue" : "xyz" }] here age same age field not present in output. if possible doing generic method using reflection please provide code. because have not worked on reflection yet. please help. according requirement can follow. you can take 2 database rows 2 objects. eg: sampleobject public class sampleobject { private string name; private int age; private string email; public sampleobject(string name, int age, stri...

Point Nginx to one page of my rails app -

i have domain on namecheap , created subdomain staging env, nevertheless point of me doing because want have domain point 1 page in rails app i'm not sure how that. went staging , nano file in sites-enabled directive , added block: server { listen 8880; server_name staging.my_domain_name.com; access_log /var/www/my_app_name/current/log/access.log; error_log /var/www/my_app_name/current/log/error.log; root /var/www/my_app_name/current/public/; passenger_ruby /home/deploy/.rbenv/versions/2.1.0/bin/ruby; passenger_enabled on; rails_env staging; rails_spawn_method smart-lv2; passenger_min_instances 1; # maintenance error_page 404 /404.html; error_page 403 /404.html; location = /404.html { internal; } } so root tried change path view path /var/www/my_app_name/current/app/views/pages/page_name.html.erb; i tried add link i'm not sure how , i...

mysql - How to select all items in column by column name getJSON and php -

i have getjson call php function returns items in column column name. php function. public function getcertsbycategory($certcategory) { $connection = $this -> connect(); return $this -> select("select '.$certcatogory.' cert_catalog"); } this function data: function certname(certcategory) { $('#certificationname').empty(); console.log(certcategory); $.getjson('json_data.php', { method: 'getcertsbycategory', certcategory: certcategory }, function(data) { console.log(data); $.each(data, function(key, value) { console.log(value); $('#certificationname').append('<option value="' + value + '">' + value + '</option>'); }); }); } why getting 2 dots values? looks in chrome developer tools. 10: object ..: ".." __proto__: object 11: object ..: ".." __proto__...

How to add a ListView to a Fragment -

i writing code adding listview fragment. , listview data retrieved class (by using arraylist). can't add listview fragment. here code. guys, can suggest me do? public class startfragment extends fragment { datasource datasource; arraylist<employee> arraylist; listview listview; customadapter adapter; context context; public startfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment return inflater.inflate(r.layout.fragment_start, container, false); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); listview = (listview) getactivity().findviewbyid(r.id.listview); arraylist = datasource.getallemployee(); adapter = new customadapter(context,arraylist); listview.setadapte...

oracle11g - Sequence numbers for varchar data type? -

this used generate integer data type create sequence sequence [increment n] [start n] [{maxvalue n | nomaxvalue}] [{minvalue n | nominvalue}] [{cycle | nocycle}] [{cache n | nocache}]; i want genrate sequence id of varchar data type. sequence numbers varchar data type? can me?

javascript - WebdriverJS : driver.manage().logs().get('browser') returns empty array -

i have following mocha test case, i'm trying print webdriver logs in end, returning empty array. result same when pass 'browser' argument logs().get(). can please tell me why logs empty? it('should open url', function(done){ var = nemo.wd.by; driver.manage().logs(); driver.get("http://www.google.com"); driver.findelement(by.name('q')).sendkeys("webdriver"); driver.findelement(by.name('btng')).click() driver.manage().logs().get('driver').then(function(logs){ console.log(logs); done(); }); }); it because didn't enable logging option in list of capabilities while creating driver instance. resolved these changes. var pref = new webdriver.logging.preferences(); pref.setlevel('browser', webdriver.logging.level.all); pref.setlevel('driver', webdriver.logging.level.all); var driver = new webdriver.builder() .withcapabilities(webdriver.capabilit...

geolocation - Geonear is not working - mongodb? -

i have following sample mongodb document in collection offers . collection : offers { "countrycode" : "lu", "geolocation" : [ { "lat" : 49.8914114000000026, "lng" : 6.0950994999999999 } ] }, { "countrycode" : "de", "geolocation" : [ { "lat" : 50.8218536999999984, "lng" : 9.0202151000000015 } ] } requirement: fetch document based on geolocation around 50km radius what have tried: db.getcollection('offers').aggregate([ { $geonear: { near: [6.0950994999999999, 49.8914114000000026], distancefield: "geolocation", maxdistance: 50000, //50 km radius } } ]); problem: it fetching documents instead of searching around 50km. any suggestion grateful. legacy coordinate pairs not retu...

data structures - C++ STL container suited for finding the nth element in dynamic ordered list? -

using balanced bst avl or red-black-tree, can maintain set of values that: insert/delete/query given value. count elements smaller/larger given value. find element rank k after sort. all above can archived in o(log n) complexity. my question is, there stl container supporting 3 above operations in same complexity? i know stl set/multiset can used 1 , 2. , examined _rb_tree based containers map/set/multiset, none provides support 3. there way subclassing ext/rb_tree solve this?

objective c - iOS Background Image is repeated in iPad? -

Image
i've got image 1x , 2x , 3x types resolutions 404*750 , 808*1500 , 1212*2250 respectively. here code: self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"bgr"]]; on iphone background not repeated , good. ipad background repeated 4 times. would know why happening? from apple's reference you can use pattern colors set fill or stroke color solid color. during drawing, image in pattern color tiled necessary cover given area. so in iphone device image large enough cover area ... in ipad it's not large enough cover area ... repeat itself. you can use image.xcassets different image iphone , ipad ... see screen shot you can use different image ipad proper size overcome error

Image don't shown in Django LFS -

i've added image product, not shown in product preview. error message appears: "the request content cannot loaded. please try again later". web-page located in localhost, db in utf8_general_ci (mysql), django 1.8, python 2.7. when try open attachement (i've put image there), recieve error, traceback il below post: environment: request method: request url: http://localhost:8000/media/files/book1.png django version: 1.8 python version: 2.7.6 installed applications: ('lfs_theme', 'compressor', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.sites', 'django.contrib.flatpages', 'django.contrib.redirects', 'django.contrib.sitemaps', 'django_countries', 'pagination', 'reviews', 'portlets', 'lfs.addresses', 'lfs.caching...

javascript - How to change the cell's background color of the ui-grid to some color, if its edited and new value is not equal to the old value (dirty). -

based on help link able achieve color change in solution applies color entire row, not i'm looking for. i want change color of edited cell. please share if has idea. thanks. here's plunker example desired behaviour: http://plnkr.co/edit/zfeinxiglqeivfeaqy2y?p=preview the code block of interest is: gridapi.edit.on.aftercelledit($scope, function(rowentity, coldef, newvalue, oldvalue) { coldef.cellclass = function(grid, row, col, rowrenderindex, colrenderindex) { if (rowentity.id === row.entity.id && newvalue !== oldvalue) { return "test" ; } return ""; }; $scope.gridapi.core.notifydatachange(uigridconstants.datachange.column); note "test" class name defined in main.css .test { background-color: red !important } edit : here fork of plunker example: http://plnkr.co/edit/ogecjqo8foreisqcufuz?p=preview

php - Is it possible to count all with where condition in codeiginter? -

i trying this $this->db->count_all("grant_money")->where('id',5); is possible ? if there way please let me know.thanks i want query in single line code tried above you can use this. $this->db->where('id',5); $this->db->from("grant_money"); echo $this->db->count_all_results(); this show count condition. with single line try this echo $this->db->where('id',5)->from("grant_money")->count_all_results();

Tinker always returning not found in eval() Laravel 5.1 -

i have models place in app/models, , if attempt run in tinker: $user = new app\user; or $user = new app\models\user; i shown with: class x not found in eval()'d code on line 1 i found out following not work either: $user = new user(); what doing wrong here?

Python numpy: Dimension [0] in vectors (n-dim) vs. arrays (nxn-dim) -

i'm wondering how numpy array behaves. feel dimensions not consistent vectors ( nx1 dimensional) 'real arrays' ( nxn dimensional). i dont get, why isn't working: a = array(([1,2],[3,4],[5,6])) concatenate((a[:,0],a[:,1:]), axis = 1) # valueerror: input arrays must have same number of dimensions it seems : (at 1:] ) makes difference, ( :0 not working) thanks in advance! detailled version: expect shape(b)[0] references vertical direction in ( nx1 arrays), in 2d ( nxn ) array. seems dimension [0] horizontal direction in arrays ( nx1 arrays)? from numpy import * = array(([1,2],[3,4],[5,6])) b = a[:,0] print shape(a) # (3l, 2l), [0] vertical print # [1,2],[3,4],[5,6] print shape(b) # (3l, ), [0] horizontal print b # [1 3 5] c = b * ones((shape(b)[0],1)) print shape(c) # (3l, 3l), i'd expect (3l, 1l) print c # [[ 1. 3. 5.], [ 1. 3. 5.], [ 1. 3. 5.]] what did wrong? there nicer way than d = b * ones((1, shap...

xml - Set exchange body to null -

i trying set null body of exchange in xml definiton this: <camel:setbody> <camel:constant>null</camel:constant> </camel:setbody> or this: <camel:setbody> <camel:simple>null</camel:simple> </camel:setbody> they give string "null" in end. any idea right form is? how this? <camel:setbody> <camel:simple>${bodyas(null)}</camel:simple> </camel:setbody>

php - Unable to get session varibale after redirect to another domain -

i have created session on 1 page , unable these session on page, how can able session on page. page1.php $_session['access_token'] = "token"; $_session['access_secret'] = "secret"; $_session['session_handle'] = "handle"; header("location: mydomain/page2.php"); page2.php session_start(); if(isset($_session['access_token'])) { echo $_session['access_token']; } else { echo ""; } i have tried above code same domain or different domain. try put session_start(); in page1.php (on first line). if domains different not work

c# - enable button when certain textboxes has information -

this question has been asked not extend i have 8 textboxes, , button disabled on form_load.. 4 of 8 textboxes required filled before button can enabled... how check textbox1,textbox2,textbox3,textbox4 has values (excluding textbox 5 textbox8) before enabling button wire textchanged event 4 textboxes single method checks if of 4 textboxes have text, , enable button.

javascript - jQuery mmenu: Position of menu next to the layout -

as far tested jquery.mmenu can descide wheter want have menu left or right in browser window. the design of website not take 100% of screen, position menu @ top left of design , not top left of browser window. the javascript of jquery.mmenu moves html of menu directly after opening body tag, not in html structure of design anymore. pure css positioning not guess :-( <!-- page --> <div class="page"> <!-- menu --> <nav id="menu"> <ul> <li><a href="/">home</a></li> <li><a href="/about">about us</a></li> <li><a href="#">...</a></li> </ul> </nav> <div class="header"> <a href="#menu">open mmenu</a><br> demo </div> <div class="content"> <p><strong>...

android - Image is not attached to intent -

string url = mediastore.images.media.insertimage(getcontentresolver(), v.getdrawingcache(), "title", null); final intent intent = new intent( android.content.intent.action_send); intent.setflags(intent.flag_activity_new_task); intent.putextra(intent.extra_stream, url); intent.settype("image/*"); startactivity(intent.createchooser(intent, getresources().gettext(r.string.send_to))); when choose app chooser doesn't see image try below code... public void addattachments(view v) { intent intent = new intent(android.content.intent.action_send); intent.settype("application/image"); intent.putextra(intent.extra_stream, uri.parse("file:///mnt/sdcard/testimage.jpeg")); startactivity(intent.createchooser(intent, getresources().gettext(r.string.send_to))); }

python: return list method takes index as arguments -

i'm wondering if pseudo coded below possible: def getlst(index = :): lst = [1, 2, 3, 4, 5, 6, 7] return lst[index] print getlst() >> [1, 2, 3, 4, 5, 6, 7] print getlst(2) >> 3 print getlst(2:-2) >> [3, 4, 5] obviously i'm getting syntaxerror. the method being used in @ class returning private list. i know example below possible, , might more correctly (easier read/understand code), since i've got idea of doing first example , wasn't possible got curioss of knowing how make first example work. def getlst(): lst = [1, 2, 3, 4, 5, 6, 7] return lst print getlst() >> [1, 2, 3, 4, 5, 6, 7] print getlst()[2] >> 3 print getlst()[2:-2] >> [3, 4, 5] the 2:-2 notation specific array subscribtion (ie a[2:-2] expression). closest thing if want accept notation use whole notation. done overloading __getitem__ method (if want negatives need overload __len__ well). class getlist: def __...

ibeacon - Receive notification from beacon region detection during background monitoring -

i trying create basic app in create regionbootstrap background monitoring of various types of beacons, in reference app. however, instead of bringing app foreground upon entering beacon region, display 'you have entered beacon region' local notification. i presume need coded in oncreate method within 'extends application implements bootstrapnotifier' class. see intent starting main activity instantiated within didenterregion method, in fact i'd need code notification? the easiest way trigger background notification make custom application class implements bootstrapnotifier . put notification code in didenterregion callback method so: @override public void didenterregion(region arg0) { notificationcompat.builder builder = new notificationcompat.builder(this) .setcontenttitle("beacon reference application") .setcontenttext("a beacon nearby.") .setsmall...

android - what is interval time of advertising classic Bluetooth in discoverable mode -

from quesiton is-it-possible-to-create-a-beacon-with-classic-bluetooth i see possible simulate beacon using discoverable mode. disciverable mode advertising action? , if yes, advertising interval time? , how sniff these advertising packets?

javascript - Responsive FileManager with tinyMCE upload error -

i'm using tinymce 4 wysiwyg editor , i've installed responsive filemanager in asp.net environment. tutorial have problem when using simple upload file ( > 1.5mb ), nothing uploaded server (every thing ok when upload smaller file: test 1.2mb & 0.8mb of pdf file. please me, stuck on 2 days :( below config.php file (max file size upload: 100mb ) <?php session_start(); mb_internal_encoding('utf-8'); date_default_timezone_set('europe/rome'); /* |-------------------------------------------------------------------------- | optional security |-------------------------------------------------------------------------- | | if set true access rf url contains access key(akey) like: | <input type="button" href="../filemanager/dialog.php?field_id=imgfield&lang=en_en&akey=myprivatekey" value="files"> | in tinymce new parameter added: filemanager_access_key:"myprivatekey" | example tinymce config: | | tin...

message queue - Amazon SQS multi tenancy and HIPAA compliance -

i'm going implement client/server application - 1 server - [0-n] clients. in order organize communication between clients , server plan use amazon sqs or that. right have 2 questions: is amazon sqs hipaa compliant ? how organise multi tenancy support based on amazon sqs queues ? the data between clients must not shared. each client can deal data sent client. is possible implement on single amazon sqs queue or need create separate queue each client ? regarding hipaa , sqs: while baa aws not allow use sqs phi, allow use s3 (but don't take word it, in baa sure). if case, can put message payload (phi) in (encrypted) s3 file , send sqs message references s3 key. when handle sqs message, go grab file s3 , process it, deleting message and/or file appropriate. there "extended" sqs client may able use handles magic you. another option enable , configure event notifications on s3 bucket such message queued each file uploaded bucket. in other wor...

asp.net mvc - kendoChart - Refresh only bars not whole graph -

i implemented kendo chart of telerik , below code after applying updated values. i smoothly update bar - below link: http://www.jqueryscript.net/demo/dynamic-animated-jquery-bar-charts-plugin-livegraph/demo/ my existing code refresh graph is: var chart = $("#divbarchart").data("kendochart"); chart.options.series[0].data = globalseriesvalue chart.refresh(); please guide. in kendo - chart api exposes setdatasource() method. when want refresh bars nothing providing new data source chart. way chart not redrawn rather points on chart repainted. here documentation link: http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#methods-setdatasource i have created demo here: http://dojo.telerik.com/@kashyapa/ekara

queue - use qpid-proton to send persistent messages to Azure service bus - url parsing error -

i'm trying use python-qpid-proton version 0.9.1 send message azure service bus queue. the examples in examples/python/messenger/ accept addresses of form amqps://:@/, , can send messages queue have on azure it. problem can't control of what's going on, namely can't see if sending failed. want persist messages in case internet connection goes down temporarily. the example code examples/python/db_send.py , examples/python/simple_send.py seem more useful aspects, use messaginghandler instead of messenger class. when run them, error: ./simple_send.py -a amqps://send:mxirestofmypassword@testsoton.servicebus.windows.net/queue2 traceback (most recent call last): file "./simple_send.py", line 62, in <module> container(send(opts.address, opts.messages)).run() file "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 120, in run while self.process(): pass file "/usr/local/lib/python2.7/dist-packages/proton/reactor...