Posts

Showing posts from February, 2010

java - String has access to entire text file -

i working on java project loosely simulates search engine converting gettysburg address text file linear-linked list of word objects contain string of word , line position. compare these against hash table of ignorable words , insert considerable words binary search tree number of appearances recorded if duplicates occur. i have hashing function , of tree-adding parts down having issue can't seem figure out regarding input: when reading gettysburg address using bufferedreader.readline(), after cleansing string of punctuation string seems contain entire text file though instantiated line = br.readline(). here first few lines of getty.txt: four score , 7 years ago our fathers brought forth, upon this continent, new nation, conceived in liberty, , dedicated proposition men created equal. engaged in a i have attached code below context. private static objectlist getwords(string filename) throws ioexception { bufferedreader br = new bufferedreader(new filereader(fil...

python - AWS - DJANGO - Error in formatting: OperationalError: fe_sendauth: no password supplied -

i have setup django app on aws beanstalk postgresql 9.4.7. database settings follows; if 'rds_db_name' in os.environ: databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': os.environ['rds_db_name'], 'user': os.environ['rds_username'], 'password': os.environ['rds_password'], 'host': os.environ['rds_hostname'], 'port': os.environ['rds_port'], } } i have installed psycopg2. aws application installation completed when opened index page received following error. exception type: runtimeerror exception value: error creating new content types. please make sure contenttypes migrated before trying migrate apps individually. further digging exception page found error **variable** my_list **value** error in formatting: operationalerror...

objective c - build Libidn for Apple TV -

i working in chat application apple tv. , using https://github.com/robbiehanson/xmppframework . its working in simulator not in apple tv. getting error message, ld: in /users/c/documents/kasi/v-appletv/vertv/xmpp/vendor/libidn/libidn.a(nfkc.o), building tvos, linking in object file built ios, architecture arm64 clang: error: linker command failed exit code 1 (use -v see invocation) how build libidn tvos? have tried downloading libidn , compiling library tvos ? i don't know how compile tvos, this should give clue. need use appletvos.platform instead of iphoneos.platform of course , maybe change other values too.

Need to archive teamcity build configuration of test -

please me! need archive configuration of 1 test, not hole project, how can this! can archive hole project not test, need archive config of test! teamcity 8.0.1! if have archive 1 configuration of build, have create new 1 project , copy config of build new project, , after that: administration->projects->on project @ right side click on more , archive project!

ios - AFNetworking Send JSON as a parameter for POST request -

i gone several answers same question...but unable figure out issue..i getting error * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '* +[nsjsonserialization datawithjsonobject:options:error:]: invalid top-level type in json write' my code is: nsdictionary *logindict=[[nsdictionary alloc] initwithobjectsandkeys:password.text,@"password",username.text,@"username",nil]; nserror *error; nsdata *jsondata = [nsjsonserialization datawithjsonobject:logindict options:nsjsonwritingprettyprinted error:&error]; if (jsondata) { nsstring *jsonstring = [[nsstring alloc] initwithdata:jsondata encoding:nsutf8stringencoding]; } else { nslog(@"got error: %@", error); } afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.requestseria...

apache - How to serve DASH video (MPEG-DASH and HLS) over a web sever -

i doing small research project test dash streaming on low bandwidth mobile connections in india. i have aws machine can upload video , package mpeg-dash , hls streaming , create mpd , m3u8 files. but unable serve video. i have tried apache , node.js. told placing folder contains mpd nad m3u8 files video chunks should able stream video. i not sure doing wrong. there special configuration need server mpeg-dash video ? if there tutorial/blog/github project point me towards, brilliant. tia. you not need server side application. if using aws simple s3 bucket behind cloudfront trick nicely, without ec2 needed @ all. ensure have cors , crossdomain.xml in place. stefen lederer posted blog set up. also, use browsers developer mode catch failed requests , console errors might give pointers why not working you.

android - Detect installed languages for offline recognition -

it possible determine via code language packages installed on device? tried this: intent detailsintent = new intent(recognizerintent.action_get_language_details); sendorderedbroadcast(detailsintent, null, new languagedetailschecker(), null, activity.result_ok, null, null);   public class languagedetailschecker extends broadcastreceiver { private list<string> supportedlanguages; @override public void onreceive(context context, intent intent) { bundle results = getresultextras(true); if (results.containskey(recognizerintent.extra_supported_languages)) { supportedlanguages =results.getstringarraylist(recognizerintent.extra_supported_languages); log.d("tag","languages: " + supportedlanguages); } } } however, output shows me tons of languages, while have en_uk, en_us , es_es installed. idea? if have root(sorry), can way: public static boolean isoffline...

is there a way to use different heroku regions based on location under one domain? -

i'm creating socket.io app. have 1 url app connect to. thinking using freegeoip.net , computing distance away each region , using closest one. what's best way it? heroku not allow have 2 apps in different regions pointing same domain. best way achieve proxy requests cdn cloudflare , automatically serve requests closest location has.

java - Get decoded byte stream from MP3 file -

i want fft on mp3 file. this, extract decoded byte stream file format (i believe called raw pcm data).for task using jlayer 1.0.1 library. here code should extract pcm data each frame: short[] pcmout = {}; bitstream bitstream = new bitstream(new fileinputstream(path_to_mp3_file)); boolean done = false; while (!done) { header frameheader = bitstream.readframe(); if (frameheader == null) { done = true; } else { decoder decoder = new decoder(); samplebuffer output = (samplebuffer) decoder.decodeframe(bitstream.readframe(), bitstream); //returns next 2304 samples short[] next = output.getbuffer(); pcmout = concatarrays(pcmout, next); //do whatever samples } bitstream.closeframe(); } (int = 0; < pcmout.length; i++) { if (pcmout[i] != 0) { system.out.pri...

ubuntu 15.10 - sudo apt-get update command not working on linode -

Image
i unable run package update command on linode server sudo apt-get update gives following error (image below). has been 2 days struck. have not added domain server yet , using server ip address.

titanium - Google Play Security Alert X509Trustmanager - Will my App be removed from store after May 17? -

i have app, developed in titanium, in google play have trustmanager security alert. alert says: "your app using unsafe implementation of x509trustmanager interface apache http client, resulting in security vulnerability. please see google center article details, including deadline fixing vulnerability. please address issue possible , increment version number of upgraded apk. beginning may 17, 2016, google play block publishing of new apps or updates containing unsafe implementation of interface x509trustmanager." my question app removed after may 17 if don't update it? thanks i don't think so. not able publish app has issue may 17. some appcelerator apps facing issue appcelerator team has fixed in api. nothing worry appcelerator users. you can follow here : jira link

node.js - Bluebird - how to propagate errors in nested promise -

promisea().then(function(){ promiseb().catch(function (e) { throw e; }) }).catch(function (e) { // want exceptions thrown in nested promise chain end here. }) how exceptions nested promises bubble parent promise? use return keyword, your code can simplified as: promisea().then(function(){ return promiseb(); }).catch(function (e) { // want exceptions thrown in nested promise chain end here. }) edit: not sure if right way, if promise cancellation involved , want bubble error flow, can wrap promise in custom promise never resolves throws error( if happens): promisea().then(function(){ var mypromise = promiseb().then...; return new promise(function(resolve, reject){ mypromise.catch(reject) }) }).catch(function (e) { // want exceptions thrown in nested promise chain end here. })

php - javascript / jQuery hide if html equals 0 -

i've built site www.piano-warehouse.co.uk/category/upright-pianos/ using wordpress , have utilised plugin calculating amount of money saved if discount has been applied product. modify setup if no discount has been applied , there no amount saved hide save section. assume javascript or jquery ticket have elementary understanding of these languages , appreciate constructing query. so far i've tried adding functions file no joy function you_save_hide () { if ($("span.yousave_list_price").text() == "0") { $("span.yousave_list").hide(); } } from link can see if $("span.yousave_list_price") contains dom element <span class="yousave_list_price"> <span class="amount">some value</span> </span> so if looking hide span.yousave_list_price may have this var _getamountlist = $('.amount'); _getamountlist.each(function(){ // equalizing £0 demo // can use regex ...

C# delegate contravariance with lambda expression -

this question has answer here: can’t assign delegate anonymous method less specific parameter type 3 answers the second test method below not compile (cannot convert lambda expression target type d1 ). mean (non-generic) delegate contravariance not work lambda expressions? [testfixture] public class myvariancetests { private abstract class animal {} private class tiger : animal {} private delegate type d1(tiger tiger); private static type m1(animal animal) { return animal.gettype(); } [test] public void contravariantdelegatewithmethod() { d1 func = m1; type result = func(new tiger()); assert.areequal(result, typeof (tiger)); } [test] public void contravariantdelegatewithlambda() { d1 func = (animal animal) => animal.gettype(); type result = func(new tiger());...

ios - UIPickerView content flowing unexpectedly -

Image
i using uidatepicker , uipickerview in app. both controls showing weird behaviour. when scroll content in picker, flows outside picker , not scroll supposed to. implementation below. sexarray = @[@"male", @"female"]; uipickerview *picker = [[uipickerview alloc] initwithframe:cgrectmake(0, 50, 100, 150)]; [picker setdatasource: self]; [picker setdelegate: self]; picker.showsselectionindicator = yes; gendertf.inputview = picker; #pragma mark -- uipickerview methods -(nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component{ return sexarray.count; } -(nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview{ return 1; } - (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view { uilabel *retval = (uilabel*)view; if (!retval) { retval = [[uilabel alloc] initwithframe:cgrectmake(0.0f, 0.0f, 100, [pickerview rowsizeforcompone...

intellij idea - How to change line space in Project window? -

Image
is possible change line space project window in intellij idea? i've seen "overrride default fonts" in settings "not recommended". there recommended way that? thanks. i think it's possible editor. can change using settings panel:

How to make a String array case insensitive in Android -

i creating application read nfc tag , text of tag against string array see if there. works if tag case sensitive correct e.g. 'test', not 'test'. have tried various methods haven't worked. please @ code , see best solution me. here relevant code: string[] dd; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); dd = getresources().getstringarray(r.array.device_description); } @override protected void onpostexecute(string result) { if (result != null) { if(arrays.aslist(dd).contains(result)) { vibrator v = (vibrator)getsystemservice(context.vibrator_service); v.vibrate(800); //mtext.settext("read content: " + result); intent newintent = new intent(getapplicationcontext(), tabstest.class); bundle bundle1 = new bundle(); bundle1.putstring("key", r...

asp.net - Visual Studio Community 2015 and MVC2 template -

i'm trying create project tutorial of asp.net programming @ first step, teacher told me create project online template named asp.net mvc 2 web application. screen: http://img2.altcontroldelete.pl/images/thumbs/09b32b23-5f25-9204-7140-0a112c6e81f4.jpg unfortunnetly can't find in diag. in online projects don't have templates. screen: http://prnt.sc/b1y42k is in vs community 2015 avalaible? go tools>>nuget package manger >> package manger console use command "install-package mvc2" , press enter able see mvc2 templates

php mysql dropdown value select -

currently following code displays filters individual publishers ie if select dc see dc titles. the issue current code cannot display publishers dropdown menu. <div id="main"> <form method="post" action=""> <div id="search_query" > <select name="make" size="0"> <option value="all">all publishers</option> <option value="dc">dc</option> <option value="marvel">marvel</option> <option value="image">image</option> </select> <input type="submit" name="submit" value="submit"> </div> </form> <div id="main_container"> <?php $db_con = mysql_connect('127.0.0.1','root','root'); if (!$db_con) { die('could not connect: ' . mysql_error()); } mysql_select_db('work...

c# - Binding to ActualWidth in changing collection -

i have flipview control witch consists of image , text image. want text same width image. of images have different dimensions others. here xaml code: <flipview x:name="flipview" horizontalcontentalignment="center" verticalcontentalignment="center" itemssource="{binding imageswithdescriptions}"> <flipview.itemtemplate> <datatemplate> <grid x:name="grid" tapped="flipview_tapped"> <grid.rowdefinitions> <rowdefinition height="3*"/> <rowdefinition /> </grid.rowdefinitions> <image x:name="image" grid.rowspan="2" source="{binding image}"></image> <grid x:name="textgrid" grid.row="1"> <grid.background> <solidcolorbrush color...

redirecting some STDERR message in R -

i creating r tool galaxy , have issue stderr default galaxy mark "finished error" tool write on stderr. r script use package latice send opening message ("you using latice version xxxx") on stderr i avoid not redirecting messages stderr connection, of them may right tag tool "finish error". is there way choose redirect stderr messages somewhere else part of code ? thanks advance

linux - Docker - How to check if curl command inside Dockerfile had response code 200 -

inside dockerfile try download artifact using curl. have checked although artifact doesn't exist (thus getting 404) docker build keeps running. run curl -h 'cache-control: no-cache' ${standalone_location} -o $jboss_home/standalone/configuration/standalone.xml is there way check curl response code 200 , throw error otherwise? you can add -f (or --fail ) curl call, causes curl silently fail on server errors. curl manpage : -f/--fail (http) fail silently (no output @ all) on server errors. done better enable scripts etc better deal failed attempts. in normal cases when http server fails deliver document, returns html document stating (which describes why , more). flag prevent curl outputting , return error 22. this method not fail-safe , there occasions non-successful response codes slip through, when authentication involved (response codes 401 , 407).

mod rewrite - Apache VirtualHost: strip www. and force https -

i working on site owns ssl cert monsite.fr . trying remove www. , redirect https://monsite.fr . redirection doesn't work if user type www.monsite.fr , not redirected https://monsite.fr https://www.monsite.fr , certification error net::err_cert_common_name_invalid . this content of mysite.conf file: <ifversion < 2.3 > namevirtualhost *:80 namevirtualhost *:443 </ifversion> <virtualhost *:80> servername monsite.fr redirect / https://monsite.fr/ #rewriteengine on #rewritecond %{http_host} ^www\.(.*)$ [nc] #rewriterule ^(.*)$ https://%1$1 [r=permanent,l] </virtualhost> <virtualhost *:80> servername www.monsite.fr redirect / https://monsite.fr/ </virtualhost> <virtualhost *:443> servername monsite.fr serveralias www.monsite.fr #rewriteengine on #rewritecond %{http_host} ^www\.(.*)$ [nc] #rewriterule ^(.*)$ https://%1$1 [r=permanent,l] rewriteengine on rewritecond %{https} =on rewritecond %{htt...

php - Multiple nested loop -

can explain me working of multiple nested loops suitable example in php? actually, know how loop inside loop works don't know how loop inside loop of loop works. example trying understand code given below unable understand it's working. <?php for($i=5;$i>=1;$i--){ for($k=6;$k>=$i;$k--){ echo " &nbsp;"; } for($j=1;$j<=$i;$j++){ echo "* &nbsp;"; } echo "<br>"; } try debug flow yourself: the main loop $i looping 5 times (5 1). each $i inner first loop $k looping various times depending on condition , same next loop. check result , debug yourself. for($i = 5; $i >= 1; $i--){ echo '$i $k started:<br/>'; for($k = 6; $k >= $i; $k--){ echo $i." - ".$k."<br/>"; } echo '<br/><br/>'; echo '$i $j started:<br/>'; for($j = 1; $j <= $i; $j++){ echo $i." - ".$j."...

c++ - libcurl uninitialized variable curl error -

i trying make http request retrieve json data; error curl variable not initialized though easy_init() it. on how go around error kind!! below code: #pragma once #include "stdafx.h" #include "requestjson.h" #include <string.h> #include <include/curl/curl.h> #include <fstream> #include <iostream> #include <sstream> using namespace std; class requestjson { public: static std::string requestjsonstring(std::string url) { //set json response on listed loans; open csv file , read unemployment , other indices. ::curl *curl; curlcode res; struct curl_slist *headers = null; std::ostringstream oss; //curl_global_init(curl_global_all); curl = curl_easy_init(); curl_slist_append(headers, "accept: application/json"); curl_slist_append(headers, "content-type: application/json"); curl_easy_cleanup(curl); if (curl) ...

optimization - Optimize MySQL query (generating stats) -

Image
db tables: i have got mysql query : select calendar.datefield date, ( select ifnull(sum(visits),0) link_stats link_stats.link_id = '1' , statdate = date ) visits, ( select round(ifnull(sum(leads * (rate/1000)),0),3) link_stats link_stats.link_id = '1' , statdate = date ) cash, ( select ifnull(sum(leads),0) link_stats link_stats.link_id = '1' , statdate = date ) leads `calendar` `calendar`.`datefield` between '2016-05-10' , '2016-05-11' i try generate stats report per link blank days. example: between 11-01-2016 20-01-2016 , link doesn't has records date 12-01-2016. build table possible dates. call tableofdates , have 1 column: datefield then rearrange query this: select d.datefield date, ls.visits, ls.cash, ls.leads tableof...

vb.net - Why are these marked as unnecessary imports? -

Image
why these highlighted entries marked unneccesary imports? i added google contacts component application. had google calendar implemented. thank explaining! the namespaces marked unnecessary because aren't used @ specific times it's mentioned. can remove them without problems, have add them if meant used.

java - mongodb aggregation longer than distinct -

here how distinct mongodb aggregation framework: db.big.aggregate([ { "$project" : { "first_name" : "$first_name"}} , { "$group" : { "_id" : { "col1" : "$first_name"}}} , { "$limit" : 50000}]) and takes 3 seconds on collection has little more 2m documents. if run following query db.big.distinct('first_name') i pretty same result in less 1 second. issue have distinct can not limit it, if collection has 1m distinct values attribute returned. there way use distinct more performant have limitation on number of elements returned. i'm using mongodb java driver, i'd need solution works it. first, there no way @ moment use limit distinct shown in jira task . second, distinct performance beat aggregation framework equivalent. bucketing/grouping heavier operation checking distinct values. having that, there 1 way speed aggregation framework grouping stage, explained here asya ...

php - How to get values from DB inside javascript? -

i generating rows on clicking plus button add further rows in table using javascript. inside 1 of cell need value master table user select in php . not able put php inside script. how should populate values ? you can use ajax values db.( assuming want populate dropbox db values )

mysql - How to fetch data from two db and insert into temp table, using SQL? -

i have 2 databases old , new . want count record both databases , insert new temporary table table name. i created temporary table: create temporary table tempemp (tablename varchar(50),northwindcount int(11),dest_northwindcount int(11)); and counted records: select (select count(*) northwind.orders) northwind_cnt, (select count(*) dest_northwind.orders) dest_northwind_cnt; how can insert temp table? dunno mysql, in ms sqlserver t-sql, you'd this: insert tempemp( tablename,northwindcount,dest_northwindcount) select '???' table make, (select count(*) northwind.orders) northwindcount, (select count(*) dest_northwind.orders) dest_northwindcount my syntax might little off, general idea insert statement can have select clause instead of values clause. maybe similar in mysql?

why elasticsearch exact match ignore symbols? -

i new elasticsearch , has got me stuck hours. want search following: post _search { "query": { "match_phrase": { "heading":"retweet - barbara keeley (labour mp)" } } } and gives me want, if change the phrase following: "heading":"retweet - barbara keeley (labour mp" see, remove bracket in end, still give me same result, looks when running search, ignore special characters ")", or "@" , search letters. so please advise if want search entered, how do this? if add special character or remove any, should not give me result. the mapping info is: { politicaldataheading: { mappings: { politicaldata: { properties: { date: { type: "date", format: "strict_date_optional_time||epoch_millis" }, heading: { type: "string" }, id: { ...

qt - How can I convert a QImage of format RGB32 to OpenCV::mat? -

Image
i have qimage of format rgb32 when this: cv::mat depthmat(depthimg.height(),depthimg.width(),cv_8uc3,(uchar*)depthimg.bits(),depthimg.bytesperline()); i image of left. supposed image on right. okay! figured out! rgb32 has 8 bits of r, 8 bits of g, 8 bits of b , 8 bits of alpha. it's rgba. so, can use this: cv::mat depthmat(depthimg.height(),depthimg.width(),cv_8uc4,(uchar*)depthimg.bits(),depthimg.bytesperline());

group by - MYSQL query to count descendants of items by finding its id in a comma separated string -

my mysql database uses tree-like system each item can have arbitrary number of descendants. each item has regular int 'parent' column containing parent varchar 'parents' column consists of comma-separated string containing of ancestor's ids. id parent parents ------------------------------- 1 0 0 2 1 0,1 3 1 0,1 4 3 0,1,3 i need list of items, each of them total number of descendants counted up. here query have far: select items.id item_id, count(children.id) children items items left join items children on (items.id in (children.parents)) this sends 1 row, child count of 0. how do properly? edit: after fixing query appears this: select i.id item_id, count(*) children items left join items c on (i.id in (c.parents)) group i.id; the results show rows, each has 1 child. not reflect data, presumably wrong in statement (find_in_set same thing). edit2: after changing in ...

javascript - Not able to generate JSON file using JSON.stringify() -

i have 7mb of .json file , filtering data node.js , storing data displayme array. when display shorted array in console it's visible in that. when try write array using json.stringify . json file blank array. here code: var fs = require("fs"); var data = fs.readfilesync('india2011.json'); var mydata=json.parse(data);//contains main array var len=mydata.length;//main array length var k=1; var count=0; var displayme=[]; var canread=0; var cannotread=0; (var = 0; <len; i++) { (var j = k; j <=35; j++) { var obj={}; if ((mydata[i]["state code"]==(j))&&(mydata[i]["total/ rural/ urban"]=="total")&&(mydata[i]["age-group"]=="all ages")) { obj["literate - persons"]=parseint(mydata[i]["literate - persons"]); obj["illiterate - persons"]=parseint(mydata[i]["illiterate - persons"]); obj["total - persons...

user controls - The previous instances of usercontrol have the same values with last one. Why? -

in application (winform - using devexpress components), have tabs same usercontrol (with different values when control loading depending on user choice) them. my problem usercontrol instances have same values last instance. why happening ? code in visual rpg. (when user clicks button create new user control) begsr managecreatenew dclsrparm sender type(*object) dclsrparm e type(devexpress.xtrabars.itemclickeventargs) dclfld appcode type(*string) dclfld filestatusparm type(*boolean) dclfld parmcompany type(*char) len(3) dclfld parmprotno type(*zoned) len(5,0) dclfld parmprotyear type(*zoned) len(2,0) dclfld tabform1 type(kyklades_menu_protocol.manageprotocol) dclfld tabformsupplier type(kyklades_menu_supplier.supplierform) dclfld infoboxresult type(dialogresult) dclfld isprojectsubheaderopen type(*boolean) inz(*true) dclfld suppliercodeparm type(*string) dclfld isview type(*boolean) dclfld isoldvsl type(*string) inz...

html - Activate a new logo within a div at certain width -

i have different logo image when site goes tablet/mobile size. figured best way rather have img src within div, set logo background image div/id. when page goes below 990px different mobile logo displayed. this have, works correct way this? https://jsfiddle.net/omca16oe/ <div id="logo"><a href="/home"></a></div> #logo { background-image:url('http://i.imgur.com/o49apfa.jpg'); background-repeat: no-repeat; display:block; width:452px; height:62px; } @media (max-width:990px) { #logo { background-image:url('http://i.imgur.com/cnydtsd.jpg'); background-repeat: no-repeat; display:block; width:452px; height:62px; } } it works, use mobile-first appropach in case, because desktop logos/images larger , won't loaded @ on mobile devices (= reducing bandwidth), like: #logo { background-imag...

Call different interpreter for Tcl in python -

i wish run tcl script different interpreter ( opensees ) python itself, similar this question , practical way? i've tried tkinter , subprocess routines far understand i'm running script in pure tcl , nothing happens (functions defined in opensees environment). i've tried calling tcl script via tkinter , can't life of me figure out how run tcl interpreter, i've tried is: for-test.tcl proc fractional_while {j float_increment upper_limit} { while {$j < $upper_limit} { set j [expr $j + $float_increment] } } puts "time took: [time {fractional_while 1 0.001 500} 1]" python file import tkinter r = tkinter.tk() r.eval('source {for-test.tcl}') what want call opensees inside python , run following routine: elastic-1dof-spectrum.tcl model basicbuilder -ndm 2 -ndf 3 set time_zero [clock clicks -millisec] set node_restraint 1 set node_spring 2 ... set load_dir $x_direction set x_mass 1 set elastic_modulus 2e6 set rotatio...

bluetooth lowenergy - ATMEL SAMB11/BTLC1000 simple GAP/GATT example -

i hope give me quick example how configure btle-device correctly without huge ble-manager library. litte gap authetication , 1 gatt-service enough start. i've managed create own gatt-service , characteristics without need ble-manager several defines, typedefs etc. can't figure out how gap , how register callbacks it. maybe has used these modules before , can give me quick example how it's done? since mentioned 1 gatt-service authentication atmel-bas [battery service] example easy one. better understand can download getting started guide see architecture. in-order register callbacks need check order of callbacks in function ble_event_manager in ble_manager.c file.

VBA Listbox: Check if listbox items are already in specified worksheet range and write listbox item in next empty cell -

title seems bit complicated, i'll try explaining steps (what want vba code do): read 1 list item list if item in 1st column (columns(1)) in worksheet, skip steps 3. , 4. if item not in 1st column (columns(1)) check first empty cell in column (reading top) when next empty cell has been found copy item not in column in empty cell proceed next item what have far following code: private sub tab1_done_button_click() dim ws worksheet dim integer dim listitem variant listitem = 0 me.tab1_product_picked.listcount - 1 'check if product there (dont't create duplicate) = 4 400 if ws.cells(i, 1).value <> me.tab1_product_picked.list(listitem) 'write in first empty cell in 1st column if not duplicate each cell in ws.columns(1).cells if isempty(cell) = true cell.value = me.tab1_product_picked.list(listitem) ...

python - modify dictionary using dictionary comprehensions without creating a new dict -

i have below dictionary: d = {'lnsd-02': 'manager', 'lnsd-03': 'manager', 'lnsd-01': 'quorum', 'lnsd-04': 'manager', 'lnsd-05': 'manager'} i trying out dictionary comprehensions on similar lines of list comprehensions. for in d: if i[-2:] in ('02', '05'): d[i]='quorum-manager' how apply dictionary comprehension above code , change values keys without creating new dictionary ? below d[i] = {i: 'quorum-manager' in d if i[-2:] in ('02', '05')} finally, need original dictionary values changed as d = {'lnsd-02': 'quorum-manager', 'lnsd-03': 'manager', 'lnsd-01': 'quorum', 'lnsd-04': 'manager', 'lnsd-05': 'quorum-manager'} use dict.update method: d.update({i: 'quorum-manager' in d if i[-2:] in ('02', '05')}) the com...

qt - QIODevice::ReadWrite | QIODevice::Unbuffered - Unsupported open mode -

http://doc.qt.io/qt-5/qserialport.html#open warning: mode has qiodevice::readonly, qiodevice::writeonly, or qiodevice::readwrite. other modes unsupported. following code not open serial port. if(serialport.open (qiodevice::readwrite | qiodevice::unbuffered)) { qdebug() << "asdasdas"; serialport.setdatabits(qserialport::data8); serialport.setparity(qserialport::noparity); serialport.setstopbits(qserialport::onestop); } else { qdebug() << "qserialport::serialporterror: " << serialport.errorstring(); } what way use unbuffered flag? what way use unbuffered flag? there none. qserialport doesn't support it. alas, assumption buffering slowing down unfounded unless have measurements demonstrate issue. bet don't , won't have such measurements. have other problems. serial ports of comparatively slow bandwidth, single megabits/second aren't issue when...

c++ - Defined in discarded section error -

i have struct type defined in header file mystruct.h struct mystruct {...}; . then have declared 1 struct object in main as: mystruct s; and once in class header in same way. this doesn't work, giving error: `_zn10mystructc2ev' referenced in section `...myclass...' of.../module.pre.o: defined in discarded section `.text._zn10mystructc2ev[_zn10mystructc5ev]' of .../module.pre.o if have struct in class works, need in main. how can solve? define : extern mystruct s; in header file.

android - Load a remote image in a MenuItem using Glide -

usually if want load image glide write following: glide.with(context) .load(theurloftheimage) .error(r.drawable.ic_error_image) .into(theimageview); but if need load image of url menuitem has changed in real time? the following not possible because method into not accept parameter: @override public boolean onprepareoptionsmenu(menu menu) { menuitem settingsitem = menu.finditem(r.id.actionbar_menu_profile_actions); if (changeimage) { glide.with(this).load(theurloftheimage).error(r.drawable.ic_error_image).into(settingsitem); } return super.onprepareoptionsmenu(menu); } using approach suggested in responses this question worked @override public boolean onprepareoptionsmenu(menu menu) { menuitem settingsitem = menu.finditem(r.id.actionbar_menu_profile_actions); if (changeimage) { glide.with(this).load(theurloftheimage).asbitmap().into(new simpletarget<bitmap>(100,100) { @override ...

python - Filtering data that is 'water falled' in a spread sheet -

i working data "water falled" (in excel) becomes normal after number of lines in excel. essentially need script remove empty data rows , keep full rows, location of rows data full variable, , not experienced python not quite sure how filter out "waterfall" rows. i attached simple example of mean, row 10 script need start keeping rows: excel example what have written, assuming .py script in same folder data needs filtered, along folder 'archive' , 'downsampled'. folders = os.listdir('./') folder in folders: filename = folder f = open(filename,'r') lines = f.readlines() f.close() shutil.move(folder, './archive') f_out = open('./downsampled/' + folder + '.csv', 'w') #filter data. f_out.close() i ended using pandas dropna() feature. thank you.

reporting services - How to find the Average in a Calculated Member with filtered Values? -

i trying implement calculated member (ssrs or ssas ) show me average values per customer, need divide sum of values projects, , divide amount of projects don't have 0 value. a similar table of values 1 using shown below.   > customer | project | value | > customer1 | project1 | 124.24... | > customer1 | project2 | 0.00 | > customer1 | project3 | 242.221... | > customer1 | project3 | 72.221... |   tried in calculated member following (i tried in both ssrs , ssas) sum([measures].[value]) /count(filter([order].[project], [measures].[value] > 0)) my hope filter out amount of projects have value of zero, , divide sum of values amount of projects have value of <> 0. the problem is, when browser so i try calculated member out count value of projects (relative ex. above) 1 instead of 3, , average value : (124.24 + 0 + 242.221 + 72.221) / 1 as opposed (124.24 + 0 + 242.221 + 72.221) / 3  (not devide 4 beca...

r - Passing code parameters through a file "parameters.txt" -

i want make code usable other users. in order want provide file "parameters.txt" in user can change values. i'd insert comments in (such make clearer). has like: # file of parameters # # here put year want analyze. # can choose: # 1) 2000 # 2) 2001 # 3) 2002 # 4) 2003 year 2004 # here put team want analyze # choose between # 1) "lazio" # 2) "juventus" # 3) "inter" team lazio when read files don't want take comment. in other words, i'd read lines except ones starting "#". is wat pass parameters? do know how can take lines i'm interested to? following advices of mrflick have found solution read.table : parameters <- read.table("./parametri.txt", header = false, blank.lines.skip = true, comment.char="#", skip = 12 , skipnul = true , fill=true) supposing paramet...

How to pass the value to Ansible playbook from Jenkins -

Image
i need pass value ansible playbook yml jenkins could please me ? just because looking recently, in addition answer above, on ansible build step, can click on advanced, , variables , add variable there. if have choice step stores value of choice in variable, can reference choice variable in later variable using ${choice_variable}.

caching - Get last few query results in SQL -

i static analysis of sql databases, during have luxury of nobody being able change data except me. however, have not found way 'tell' sql in order prevent running same query multiple times. here do, first start complicated query has small output. select * mytable myproperty = 1234 then run simple query same window (mostly using sql server studio if relevant) select 1 now realize forgot save results first complicated (slow) query. as know underlying data did not change (or if did) 1 step , result. @ moment don't know trick , have run entire query again. so question summary is: how can (automatically store/)get results executed queries. i particulary interested in simple select queries, , happy allocate 100mb memory automated result storage. prefer solution works in sql server studio t-sql, other sql solutions welcome. edit: not looking way manually prevent happening. in cases can anticipate problem not happen. i going suggest run each quer...

csv - RE: Importing awkward dataset to R -

i have csv datasets (so-called datras "exchange data" ices ) in unusual format making challenge efficiently import them r workspace. the files laid out so: v1 v2 v3 ... v60 ................ ................ ................ v2.1 v2.2 v2.3 ... v2.27 ........................ ........................ v3.1 v3.2 v3.3 ... v3.27 ........................ ........................ so, issue two-fold: there 3 sets of (related) data stacked on top of 1 in csv file wish able import 3 separate objects in r; , these datasets have different dimensions , colnames. so far, have been using count.fields() on files in directory identify boundaries between each dataset, readlines() read entire file character string each row of data, subsetting these chaacter strings acording values derived count.fields() . are there more direct methods? feel approach using quite inelegant. should noted these large csv files.

python - Shaped shadows with wand -

Image
are there functions equivalent to: convert -background none -stroke black -fill white \ -font candice -pointsize 48 label:a -trim \ \( +clone -background navy -shadow 80x3+3+3 \) +swap \ -background none -layers merge +repage shadow_a.png which produces 'a' blue shadow. i have searched docs thoroughly couldn't find anything. not possible yet? not cli methods present in c-api library wand integrates with. however, behavior methods straight forward (e.g. +swap ), , free implement them application sees fit. from wand.image import image wand.color import color wand.drawing import drawing wand.compat import nested nested(image(width=100, height=100, background=color("transparent")), image(width=100, height=100, background=color("transparent"))) (text, shadow): drawing() ctx: ctx.stroke_color = color(...

SSIS Script Task- Updated Excel -

i need updated specific cell in excel in server,but server not having microsoft office. how update excel using script task in ssis 2008r2 ? thanks, santhosh here blog post appears detail want do: updating single excel cell using ssis

spring security - custom filter positioning -

i need customize authentication process in such manner: client sends request (rest api) "special" url param server calls third-party service passing param , receiving user name server lookups database name , authenticated principal. i split server side (2+3) on 2 parts - custom filter (2), obtains user name - , custom userdetailservice for(3) builds principal looking name in database. but cannot build security.xml correctly - every time seems doesn't process filter @ all. think problem in first (http) node, cannot understand position should set filter. here config: <http use-expressions="true" auto-config="true" authentication-manager-ref="authenticationmanager"> <intercept-url pattern="/*" access="isauthenticated" /> <custom-filter ref="casserviceticketfilter" position="first"/> </http> <authentication-manager alias="authenticationmanager"...

R- create temporary table in sql server from R data frame -

i know can create temporary table in sql r with, example: require(rodbc) x<- odbcdriverconnect('driver={sql server}; server=s001000;database=x1;trusted_connection=true') sqlquery(x, "create table #temptable (test int)" ) sqlquery(x, "insert #temptable(test) values(201508)") doesitwork <- sqlquery(x, "select * #temptable") but create temporary table in sql server r object (i have table has result of previous r calculations , need query against table in sql. don't want export txt , upload sql server. has way r. tried: tabla<-data.frame(per=c(201508,201510)) sqlquery(x, "select * ##temporal tabla") but got error message: "42s02 208 [microsoft][odbc sql server driver][sql server]invalid object name 'tabla'." "[rodbc] error: not sqlexecdirect 'select * ##temporal tabla '" i know can create table sqlsave: sqlsave(x, tabla, rownames=false,safer=false) but wa...

parse.com - How to prevent the creation of data readable by all customers in a Parse table? -

i have table called goals default clp (public read , write). my mobile app has default acl set owner data can read , write it. let’s assume able obtain client keys maliciously app, , add entry in table goals without acl using command that: curl -x post \ -h "content-type: application/json" \ -h "x-parse-application-id: xyx” \ -h "x-parse-rest-api-key: 12345” \ -d "{\"name\":\"whatever\"}" \ https://api.parse.com/1/classes/goals now every user load new data, prevent that. i assume there 2 options: prevent rest api users writing data without acl or public acl, perhaps cloudcode in app filter out data doesn't belong directly user my question is, 2 above available options? first option doable cloud code? ok, let's try again. think best solution in case create beforesave trigger in cloud-code sets acl way want it. parse javascript sdk, can construct acl gives access user passed in constructor. (untested ...

php - Issue facing whille creating form in Admin Panel for Custom Module in Magento CE 1.9.2 -

Image
i developing custom module in facing issue. made custom button on grid . pointing form save data. due issue not coming. its coming this how added button on grid. public function getmainbuttonshtml() { $html= parent::getmainbuttonshtml(); $add_button_work = $this->getlayout()->createblock('adminhtml/widget_button') ->setdata(array( "label"=> mage::helper('custom_abc')->__('custom'), "onclick"=> "setlocation('".$this->geturl('*/*/newcustom')."')", "class"=>"save" )); $html .= $add_button_work->tohtml(); return $html; } here code of controller public function newcustomaction() { $this->_title($this->__("custom")); $this->_title($this->__("custom")); $this->_title($this->__("new item...