Posts

Showing posts from August, 2013

android - How can i use AudioTrack to play mp3 file and also seek to position -

iam trying develop application can set speed of music file(mp3) set 1x,1.5x,2x,2.5x this.but mediaplayer not support feauture unless 23 api.how can use audiotrack play mp3 file , seek position.the below code gives me "zzzzzzz" sound. public void playaudio(){ int minbuffersize = audiotrack.getminbuffersize(8000, audioformat.channel_configuration_mono, audioformat.encoding_pcm_16bit); int buffersize = 512; audiotrack = new audiotrack(audiomanager.stream_music, 8000, audioformat.channel_configuration_mono, audioformat.encoding_pcm_16bit, minbuffersize, audiotrack.mode_stream); string filepath = environment.getexternalstoragedirectory().getabsolutepath(); int = 0; byte[] s = new byte[buffersize]; try { final string path= environment.getexternalstoragedirectory().getabsolutepath() + "/folioreader/audio"+".mp3"; fileinputstream fin = new fileinputstream(path); data

php - Upload file. After uploading will be save in the place where i have stated -

i upload docx location "c:\xammp\htdocs\fyp3\uploads/" below codes uploading file. now, after click on upload, cannot find file in given address. not sure error is. in advance:) if(isset($_files['file'])) { $file=$_files['file']; $file_name=$file['name']; $file_tmp = $file['tmp_name']; $file_size = $file['size']; $file_error = $file['error']; $file_ext = explode('.',$file_name); $file_ext = strtolower(end($file_ext)); $allowed=array('docx', 'jpg'); if(in_array($file_ext, $allowed)) { if($file_error === 0) { if($file_size <= 2097152) { $file_name_new = uniqid('', true) . '.' . $file_ext; $file_destination = "c:\xammp\htdocs\fyp

raspberry pi - I2C between RPI and Arduino using Processing -

posted here code rpi master , arduino slave project. have analog sensor connected arduino , reading data processing on rpi. using processing because intend on generating graph , waveform data. code below seems work, however, slight movement of setup "disconnects" slave device because following message. "the device did not respond. check cabling , whether using correct address." have narrowed problem down , found out disconnects @ i2c.read(); function. question whether there type of break function when happen processing moves on , tries again in next iteration? or if stuck in loop waiting signal slave device? have suggestions on how approach this? processing code import processing.io.*; i2c i2c; int val = 0; void setup() { i2c = new i2c(i2c.list()[0]); } void draw () { if (i2c.list() != null) { i2c.begintransmission(0x04); i2c.write(8); byte[] in = i2c.read(1); int accel = in[0]; println (accel); } } arduino code #include <wire.h> #define sl

python pandas - how to apply a normalise function to a dataframe column -

i have pandas dataframe, output similar below: index value 0 5.95 1 1.49 2 2.34 3 5.79 4 8.48 i want normalised value of each column['value'] , store in new column['normalised'] not sure how apply normalise function column... my normalising function this: (['value'] - min['value'])/(max['value'] - min['value'] i know should using apply or transform function add new column dataframe not sure how pass normalising function apply function... sorry if i'm getting terminology wrong i'm newbe python , in particular pandas! these pretty standard column operations: >>> (df.value - df.value.min()) / (df.value.max() - df.value.min()) 0 0.638054 1 0.000000 2 0.121602 3 0.615165 4 1.000000 name: value, dtype: float64 you can write df['normalized'] = (df.value - ....

android - Manually parse a portion of dynamic JSON object alongside Gson deserializer -

i want parse following json response dynamic json object, { "id": 1, "last_login": "2016-07-16t12:46:29.621996z", "point_of_sales": [ { "counter 4": { "type": "retail", "id": 6 } }, { "counter 5": { "type": "retail", "id": 7 } }, { "counter 6": { "type": "retail", "id": 8 } } ] } here objects name inside " point_of_sales " array dynamic makes difficult parse using gson. here's i've tried far, @serializedname("id") @expose private integer id; @serializedname("last_login") @expose private string lastlogin; @serializedname("point_of_sales") @expose private list<map<string, counter>> pointofsales = new arraylist<map<string, counter>>();

python - matching a substring in a dateframe column -

i want match id column in dataframe if name contain string 'test_'. there simple way boolean vector df.id == 'something' df.id contains 'test_'. iiuc following should work: df.loc[df['id'].str.contains('test_'), 'id'] this return id's contain partial string if want boolean array against rows: df['id'].str.contains('test_')

Git reset in detached HEAD state -

i understand git reset command moves branch backwards in history (*), , branch moves 1 head pointing to. so got curious , tried call in detached head state see happen. expecting error git did something, , i'm unable figure out did. did git acted head still pointing before checked out , went detached head state ? [ edit 1 ] figured out. same when 1 not in detached head state, except doesnt move branch backward. it's the [ edit 2(*) ] git reset moves branch backward in history when specifying older commit. when doing git reset head , leaves branch (see comments below). git reset makes current branch , head move specific commit. if it's detached head, makes head move.

android - Prevent custom SurfaceView from drawing on top of other views -

Image
i have created custom surfaceview use draw shapes, , user can zoom , pan view interact shapes. works great, problem shapes drawn on top of everything on screen, on top of other views such buttons , textviews. have tried ordering custom view , buttons in different ways in xml layout, tried parenting views framelayouts , relativelayouts ( as suggested here ). i have buttons , other layout elements floating on top of custom view. seen in image below, when pan view rectangle obscure buttons. how can prevent custom surfaceview drawing on top of everything? my drawing code runs in separate thread in surfaceview class: public class customshapeview extends surfaceview implements runnable, surfaceholder.callback { /* other implementation stuff */ @override public void run() { while (isdrawing) { if (!holder.getsurface().isvalid()) continue; //wait till becomes valid canvas canvas = null; try { canvas = holder.lockcanvas(nul

angularjs - Angular directive pass data to template -

i hava directive need pass data template. in understanding should able this. return { template: '<p>{{answers}}</p>', restrict: 'e', scope: { data: '=' }, scope.answers = scope.data.answers; my scope.answers = ["no", "yes", "yes", "yes"] but no data show in html. wrong approach? in addition post of @devanshu madan, i'd share link tutorial. creating directive pass data into, , render in template section of specific directive can achieved following this tutorial. better have @ link, proper information you'll needed background information.

How can i get javascript variable to store in php? -

this question has answer here: how pass javascript variables php? 12 answers i see 1 example in pass javascript variable php this: <html> <head> <script type="text/javascript"> var q = "hello"; <?php $ff ="<script>document.write(q1)</script>"; ?> </script> </head> <body> <?php echo $ff; ?> <input type="hidden" value="nis" id="val"> </body> </html> i try 1 exaple this: <html> <head> <script type="text/javascript"> var q = $("#val").val(); <?php $ff ="<script>document.write(q)</script>"; ?> </script> </head> <body> <?php echo $ff; ?> <input type="hidden" value="nis" id="val"

javascript - Contact the Field button when there are two buttons -

i have problem. want build home page 2 fields: username , password, , click ok button. under button, there button clicking on sign how associate fields of existing user button , not button of registration? <fieldset> <legend>login details</legend> <div class="form-group "> <label for="username">user name:</label> <input type="text" name="username" class="form-control requiredfield signin" id="username"> </div> <div class="form-group"> <label for="password">password:</label> <input type="password" name="password" class="form-control requiredfield signin" id="password"> </div> <div class="form-group"> <button type="submit" class="btn btn-default

angular ui router - Multiple named views with dynamic routing in angularjs -

edit: here complete code @ plunker . though can not c in execution same code working @ local. gives console error though it works perfect. due :id in /news/:id/ , getting jquery/angular errors in console can not tracked anywhere in code i can not c doing wrong. edit: solved plunker https://plnkr.co/edit/fwcubggpvdmj3crofryj first of trying use ui-router you're including ngroute script in plunker. change to <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.min.js"></script> then should work fine! i suggest few changes... 1. use ui-sref instead of href because it's easier define ui-sref="post({id:1})" turns href="#/news/1" if change url day, have change route file, not each href . $stateprovider .state('post', { url: "news/:id" or $stateprovider .state('post', { url: "archive/:id" or $s

c# - When subclassing Xamarin Android.Views.View (or any of its subclasses), do I need to call dispose on objects I created? -

if have class below create drawables , use them while button on page, standard dispose of of imagedrawable 's when overriding dispose method, or should dispose of them in ondetachedfromwindow, or not needed @ all. 1. public class exampleimagebutton : imagebutton { private ilist<animationdrawable> _animations; .... protected override void dispose (bool disposing) { if(disposing) { foreach(var item in _animations) { item.dispose(); } _animations = null; } base.dispose (disposing); } } 2. public class exampleimagebutton : imagebutton { private ilist<animationdrawable> _animations; .... protected override void ondetachedfromwindow() { foreach(var item in _animations) { item.dispose(); } _animations = null; } } it standard practice dispose() child objects within parents dispose(

google cloud messaging - Pass action to the app when the user click on notification on android devices -

how can pass information android application when user click notification when application not in foreground, example user message, notice getting notification, after user click navigate application, problem application opens in default state, want navigate messaging page first. public class mygcmlistenerservice extends gcmlistenerservice { private static final string tag = "mygcmlistenerservice"; private userdetails userdetails; /** * called when message received. * * @param senderid of sender. * @param data data bundle containing message data key/value pairs. * set of keys use data.keyset(). */ // [start receive_message] @override public void onmessagereceived(string from, bundle data) { string message = data.getstring("message"); log.d(tag, "from: " + from); log.d(tag, "message: " + message); log.d(tag, "data" + data); /** * in cases may useful show notification indicating user

php - Reset a numeric sequence after deleting a row -

if have list of users following data: +----+---------+----------+ | id | user | sequence | +----+---------+----------+ | 2 | dave | 1 | | 3 | sam | 2 | | 4 | harry | 3 | | 5 | sarah | 4 | +----+---------+----------+ if delete user harry, re-order sequence column give me following: +----+---------+----------+ | id | user | sequence | +----+---------+----------+ | 2 | dave | 1 | | 3 | sam | 2 | | 5 | sarah | 3 | +----+---------+----------+ i have tried following: set @i = 0; update users set `sequence` = @i:=@i+1 order `sequence` asc; if run using mysql workbench works. when run via php method mysql_query failing error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near . it works if run statements separately. safe method - open problems? there workaround or better way write statement? the application not using mysqli can't use http://p

search - React Native : Searching, Filter, and Base View all in one route -

i ask, there solution come out messenger(mobile app) searching function? route having basic view elements. when user typing in words, search start function, within same screen, view overlap show filter list. had tried use react-native-overlap module not work well. var react = require ('react-native'); var { text, view, stylesheet, textinput, dimensions, image, platform, scrollview, reactnative, deviceeventemitter,touchableopacity } = react; var navigationbar = require ('../components/navigationbar'); var searchbarfromnodemodule = require ('react-native-search-bar'); var overlay=require('react-native-overlay'); var recent = react.createclass({ getinitialstate(){ return { isvisible:'aa', }; }, onnamechanged(e){ //todo here // alert('asd'); }, render (){ return ( <view> <view style={styles.navbarcontainer}> <searchbarfromnodemodule ref='searchbar' placeholder='search' showscancelbut

jquery - Hiding divs using javascript if a certain class is used -

i have website plays css animation of clouds drifting across screen. i have added javascript function pulls in data yahoo's weather api. i've used change background colour depending on weather. cloud animation have @ moment appears when cloudy (aka when javascript makes body class 'body.cloudy' or 'body.partly-cloudy'). the clouds in divs @ moment, assume need make divs hidden if body other 'body.cloudy' or 'body.partly-cloudy' i'm not sure how this. <body> <div class="sky"> <div class="cloud cloud01"></div> <div class="cloud cloud02"></div> <div class="cloud cloud03"></div> <div class="cloud cloud04"></div> <div class="cloud cloud05"></div> <div class="cloud cloud06"></div> </div> </body> js $.yql = function(query, callback)

javascript - Load polygon in Google map api -

i want implement user can draw area in google map our application. when come back, should load data drew him/her. i've done 2 way of method. 1 is, using drawing manager. drawing polygon in google map using javascript https://developers.google.com/maps/documentation/javascript/drawinglayer using google map api data layer. http://jsfiddle.net/dg9e93qy/ from first method, can allow user drag, , can restrict user drawing multiple polygons. but cannot load polygons again drawing. found somewhere can load polygons. https://developers.google.com/maps/documentation/javascript/examples/polygon-simple . but using polygon instance show polygons not drawing. here need other 2 solutions. whether should load polygon data map using drawing. should enable drawing option using polygon https://developers.google.com/maps/documentation/javascript/examples/polygon-simple from second method, can coordinates, , can load polygon again. cannot polygon area that. (actually get

node.js - Set cache header in hapi -

how can set cache-control header in hapi 'no-cache', 'no-store', 'must-revalidate'? in express able following: res.header('cache-control', 'no-cache, no-store, must-revalidate'); i have following in hapi think may incorrect: function(request, reply){ var response = reply(); response.header('cache-control', 'no-cache'); response.header('cache-control', 'no-store'); response.header('cache-control', 'must-revalidate' } is possible in hapi? function(request, reply){ var response = reply(); response.header('cache-control', 'no-cache, no-store, must-revalidate'); } yes, can it. string ( 'no-cache, no-store, must-revalidate' ) single value of header, set header. calling header() method on response object . server.route({ method: 'get', path: '/', handler: function (request, reply) { reply('ok').header

javascript - Communication between Reactjs Components -

after struggling redux, flux , other pub/sub methods ended following technique. not know if can cause big damage or flaws posting here light experienced programmers pros , cons. var thismanager = function(){ var _manager = []; return{ getthis : function(key){ return _manager[key]; }, setthis : function(obj){ _manager[obj.key] = obj.value; } } }; var _thismanager = new thismanager(); // react component class header extends component{ constructor(){ super(); _thismanager.setthis({ key: "header", value:this} } somefunction(data){ // call this.setstate here new data. } render(){ return <div /> } } // other component living far somewhere can pass data render function , works out of box. i.e. class footer extends component{ _click(e){ let header = _thismanager.getthis('header'); header.somefunction(" wow new data f

node.js - Node js SSL error {"code":"CERT_UNTRUSTED"} -

i using node version 0.12.7 npm (2.11.3) , sails (0.11.5). in project consuming rest api using request (npm module). api on domain enable cors in sails, working fine on qa server when move code production (api hosted ssl) @ api call says {"code":"cert_untrusted"}. below api call request module. request({ url: sails.config.constant.baseapiurl+'login', method: "post", json: true, body: data }, function (error, response, body){ console.log('error:- '+json.stringify(error)); console.log('response:- '+json.stringify(response)); console.log('body:- '+json.stringify(body)); // other code handle response }); ****response:-**** error:- {"code":"cert_untrusted"} response:- undefined body:- undefined how solve issue.

Assiging values in Ruby using PHP equivalent for loop (I'm using Ruby on Rails) -

i have unsolved issue on stackoverflow suspect due incorrect syntax of loop on ruby language. i ask equivalent of following in ruby: for ($x = 0; $x <= 10; $x++) { $array[] = $x; } thanks in advanced helping! please me solve initial question in link above. many thanks!

c# - FUNCTION not returning required value -

i have created class library generates number everytime use in other windows application , number gets updated everytime use it. public int generate_num(string p_prm_type) { try { int v_last_no = 0; string query = @"select parm_value soc_parm_mast parm_type = '" + p_prm_type + "';"; command.commandtext = query; oledbdatareader reader = command.executereader(); reader.read(); v_last_no = int32.parse(reader["parm_value"].tostring()) + 1; reader.close(); command.commandtext = @"update soc_parm_mast set parm_value = parm_value+1 parm_type = " + p_prm_type + ";"; command.executenonquery(); return v_last_no; } catch(exception exception) { return 404; } } i using class in other windows form application generate new no. everytime call it.but not working , returning 404. int vtrans_no = gen_no.generate_num("tr

How can you write a docker daemon that can kick off other docker containers as needed? -

i've seen several options how docker container can communicate directly host system seem kind of sneaky. instance, appears 1 can start container , bind (using -v) in-container docker executable host's docker executable. 1 can send messages host using networking protocol. appears --privilege flag might well. each of these methods appears have drawbacks , security concerns. bigger question if architecture best approach. our goal have docker daemon process running, polling database being used queue. (i know frowned upon in ways our traffic low , internal. performance sort of queue not issue.) when docker daemon detects there work done, kicks off docker container handle work. container dies when finished. each container belongs "system" , run load on system. each system can have 1 container running load on it. is paradigm makes sense? daemon better off host-level process? python script, instance, instead of docker container? docker meant used way? missing where,

C# Async socket server receives only one message from client -

i'm quite new sockets programming. hope problem presented understandable. the problem when use client's button1_click send textbox 's content - server gets first message. have no idea what's going wrong. what might problem? here server: public partial class form1 : form { socket server; byte[] bytedata = new byte[1024]; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { try { server = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); ipendpoint endpoint = new ipendpoint(ipaddress.any, 20000); server.bind(endpoint); server.listen(1); server.beginaccept(new asynccallback(accept), null); textbox1.text = "server started..."; } catch(exception ex) { mess

c# - Import CSV file to Mongo database -

if want import csv file command line use: mongoimport -d <database> -c <collection name> --type csv --file <path csv> --headerline of course headerline optional. in case, csv files have header. how can same via c#? there similar 1 line command? know how read csv file i'm surprised cannot find (a single?) simple command(s). i have looked @ lot of online documentation of seems different .net driver version; mine version 2.2.4. here long way around code far (it works i'm thinking can done more easily): mongoclient client = new mongoclient("mongodb://127.0.0.1:27017/test"); // local database var db = client.getdatabase("test"); var reader = new streamreader(file.openread(@"<full path csv")); // <full path csv> file path, of course imongocollection<bsondocument> csvfile = db.getcollection<bsondocument>("test"); reader.readline(); // skip header while (!reader.endofstream) { var

How to get rid of multiple outliers in a timeseries in R? -

i'm using "outliers" package in order remove undesirable values. seems rm.outliers() funcion not replace outliers @ same time. probably, rm.outliers() not perform despikes recursively. then, have call function lot of times in order replace outliers. here reproducible example of issue i'm experiencing: require(outliers) # creating timeseries: set.seed(12345) y = rnorm(10000) # inserting outliers: y[4000:4500] = -11 y[4501:5000] = -10 y[5001:5100] = -9 y[5101:5200] = -8 y[5201:5300] = -7 y[5301:5400] = -6 y[5401:5500] = -5 # plotting timeseries + outliers: plot(y, type="l", col="black", lwd=6, xlab="time", ylab="w'") # trying rid of outliers replacing them series mean value: new.y = outliers::rm.outlier(y, fill=true, median=false) new.y = outliers::rm.outlier(new.y, fill=true, median=false) # plotting new timeseries "after removing outliers": lines(new.y, col="red") #

algorithm - For a given string which contains only digits , what's the optimal approach to return all valid ip address combinations? -

example: given “25525511135” output : [“255.255.11.135”, “255.255.111.35”]. (sorted order) kindly let me know if depth first search on here ?(that's thing striking me ) why important have 'optimal' approach answering this? there not many permutations simple approach of checking every combination fits ip format , filtering out have out of range numbers work. it's unlikely bottle neck whatever part of.

javascript - I have several select, how do I select only one option to true and set the others to false? -

how select 1 option true , set others false, regardless of select user choose real option? note: user can not choose 2 options true. $(function() { $('select[name="verdadeira[]"]').change(function() { $('select[name="verdadeira[]"]').each(function() { if($(this).val() == 'v'){ $(this).val('v'); } }); }); }); <select class="form-control v" name="verdadeira[]" style="width: 120px; height: 37px; float: left;" > <option value="f" selected="selected">&nbsp;&nbsp;&nbsp; falsa</option> <option value="v">verdadeira</option> </select> <select class="form-control v" name="verdadeira[]" style="width: 120px; height: 37px; float: left;" >

sqldataadapter - SqlAdapter.Fill(DataSet) fills only first datatable returned by stored procedure in Xamarin -

i try fill dataset multiple tables using stored procedure on sqlserver. code simple: var execprocedurestring = "exec dbo.someprocedure ..." var mydataset = new dataset(); using (var conn = new sqlconnection(connectionstring)) { using (var command = new sqlcommand(execprocedurestring, conn)) { using (var adapter = new sqldataadapter(command)) { adapter.fill(mydataset); } } } but somehow fill creates (and fills) first table (not others). not procedure because returns normal data. missing in adapter? i still don't know why fill not working. worked before. there's walkaround (without need specificate datatables) envolves sqldatareader var execprocedurestring = "exec dbo.someprocedure ..." var mydataset = new dataset(); using (var conn = new sqlconnection(connectionstring)) { using (var command = new sqlcommand(execprocedurestring, conn)) { conn.open(); using (var re

android studio - My app is crashing whenever I am trying to open the app info in settings tab. It also looks like referring to the old package name -

this happening after changed package name. app crashes when open "about" this crash report --------- beginning of crash 07-19 18:18:21.332 2739-2739/com.wallkeeper.reader e/androidruntime: fatal exception: main process: com.wallkeeper.reader, pid: 2739 java.lang.securityexception: permission denial: starting intent { act=android.intent.action.view cmp=net.fred.feedex/.activity.aboutactivity } processrecord{ca81fb2 2739:com.wallkeeper.reader/u0a64} (pid=2739, uid=10064) not exported uid 10063 @ android.os.parcel.readexception(parcel.java:1599) @ android.os.parcel.readexception(parcel.java:1552)

angularjs - Need help to understand async calls in angular js -

i have main controller , nested controllers within it. in main controller have defined object async query service, , try use object in nested controller. in object in nested controller empty, cause fires before updated in main controller. as understand, asyncronous query should updates scope after data obtain? .controller('maincontroller', ['$scope', function($scope) { $scope.udata = {}; $scope.udatacurrent = {}; $scope.usersdata = usersfactory.getusersdata().query( function(response) { $scope.udata = response; $scope.udatacurrent = $filter('filter')($scope.udata, {'user':$scope.myuser}); $scope.udatacurrent = $scope.udatacurrent[0]; }, function(response) { $scope.message = "error: "+response.status + " " + response.statustext; }); })] .controller('nestedcontroller', ['$scope', function($scope) { console.log($scope.ud

Getting exception java.lang.NoClassDefFoundError while using json-schema-validator-2.2.6 -

i trying use json-schema validator on code given in this link using eclipse.. there main class reads 2 .json file(schema , json data) if (validationutils.isjsonvalid(schemafile, jsonfile)) used validate them validationutils class takes schema file , json file , validates it.. but getting following errors.. , donno how fix it..plz help? exception in thread "main" java.lang.noclassdeffounderror: com/github/fge/msgsimple/bundle/propertiesbundle @ com.github.fge.jackson.jsonnodereader.(jsonnodereader.java:66) @ com.github.fge.jackson.jsonloader.(jsonloader.java:50) @ com.wilddiary.json.validationutils.getjsonnode(validationutils.java:30) @ com.wilddiary.json.validationutils.getschemanode(validationutils.java:55) @ com.wilddiary.json.validationutils.isjsonvalid(validationutils.java:99) @ com.wilddiary.json.main.main(main.java:18) caused by: java.lang.classnotfoundexception: com.github.fge.msgsimple.bundle.propertiesbundle @ jav

c# - Sum of child of child in LINQ -

i need in linq query in ef6. the master table called exam . child examresult . each examresult has question , selected answer . each answer has power (0 if wrong, 1 if correct). if want know total of correct answers, run command: var examtotal = db.exams.firstordefault(ex => ex.examid == examid).examresults.sum(er => er.answer.power); my problem when questions not answered, , nullreferenceexception . some general nullchecks should trick var exam = db.exams.firstordefault(ex => ex.examid == examid); var examtotal = exam.examresults.sum(er => er.answer?.power ?? 0); ...and in case you're not using c# 6, here's version of it: var exam = db.exams.firstordefault(ex => ex.examid == examid); var examtotal = exam.examresults.sum(er => er.answer != null ? er.answer.power : 0);

iOS:How to change color of the separator in UISplitViewController? -

i have small project uisplitviewcontroller . masterview tableview , detailview collectionview . background colors of them both black color. when project runs in simulator, there separator between tableview , collectionview , has white color. want change separator's color can't find helpful in uisplitviewcontroller class reference. does know how change separator's color? change background color of uisplitviewcontroller yoursplitviewcontroller.view.backgroundcolor = [uicolor redcolor];

inheritance - Eager loading of derived class in Entity Framework -

i have model this: public abstract class point { public int id { set; get; } public string name_f { set; get; } public byte side { set; get; } } public class place : point { public bool isatm { set; get; } public bool is24h { set; get; } public string tel { set; get; } public virtual category category { set; get; } } public class street : point { public bool iswalkway { set; get; } } i want load of point table records including records place , street derived point class. i used didn't data: var points = context.points .oftype<place>() .include(p => p.subcategory) .concat<points>(context.points.oftype<street>()); i places , streets in same query. any idea?

Netsuite Saved search to create substring from single field -

i want create saved search (netsuite) return me number of time got same answer. scenario: suppose have question , 4 answer question(user can select multiple answer) , answer stored in same field separated comma. now want create saved search return me number of time user has selected same answer. example: suppose question 1 has 4 multiple choice a, b, c, d response 1--> question1--> a, b, c, d response 2--> question1--> a, b, response 3--> question1--> a, b, c response 4--> question1--> a now saved search should return me question --> answer --> count question 1 --> --> 4 question 1 --> b --> 3 question 1 --> c --> 2 question 1 --> d --> 1 i think should consider building restlet answer queries. set take parameter question number, or have spit out answ

objective c - recycleURLs:completionHandler: with NIL makes it block until completion? -

i sending file trash with [nsworkspace recycleurls: myarrayofonensurl completionhandler: nil] myarrayofonensurl nsarray created arraywithobject: of single nsurl created absolute file path fileurlwithpath:isdirectory: . the normal way tell if successful use completionhandler , check if 2nd arg ( nserror ) nil , means success. is there anyway check success without callback? have setup loop after calling this, check file existence, if 1second has past , still exists, declare fail. wondering if set nil second arg recycleurls:completionhandler: make block until process completes (regardless of success)? in tests, first check finds file no longer @ original place (meaning trashed), i'm not sure if computer super fast, or blocking until file operation completes. for trashing single file or directory, can use nsfilemanager trashitematurl instead. synchronous, avoid headaches completion callback. nserror * error = nil; [[nsfilemanager defaultmanag

android - setImageViewUri doesn't show picture but show background of imageview -

file file = new file("/storage/emulated/0/babycaredata/photo/20160229_161413.jpg"); if (file.exists()) { views.setimageviewuri(r.id.imageavatar, uri.parse(file.getpath())); } i have check path , uri,it right. setimageviewuri doesn't show picture show white screen(background white). try this: file file = new file(/storage/emulated/0/babycaredata/photo/20160229_161413.jpg); if(file.exists()) { bitmap mybitmap = bitmapfactory.decodefile(file.getabsolutepath()); setbitmap(views,r.id.imageavatar,mybitmap); } private void setbitmap(remoteviews views, int resid, bitmap bitmap){ bitmap proxy = bitmap.createbitmap(bitmap.getwidth(),bitmap.getheight(), bitmap.config.argb_8888); canvas c = new canvas(proxy); c.drawbitmap(bitmap, new matrix(), null); views.setimageviewbitmap(resid, proxy); }

java - Error while starting ADB in Eclipse -

this repeated question, have seen , tried many answers. when try deploy android application, getting error - ------------------------------ android launch! connection adb down, , severe error has occured. must restart adb , eclipse. please ensure adb correctly located @ 'd:\android sdk 22.6.2\sdk\platform-tools\adb.exe' , can executed. i tried - adb kill-server restart eclipse adb start-server checked adb located in platform-tools , same path updated in eclipse sdk location also started adb.exe cmd run adb devices can see devices (they offline) went windows task manager , killed adb.exe process , restarted eclipse again. even after these steps, unable start adb eclipse. in run configurations also, have launch configuration actual package name. can start emulator separately adb devices dialog in eclipse, device offline. not sure going wrong in part. can 1 please me out of this? please let me know in case of additional details required. finally, aft

python - Django: Access request.GET in form to pass queryset as choices -

how in django can access requset in form? need data tuple pass in choices form. below init approach doesn't work: nameerror: name 'request' not defined , self or without: self.request.get.get('project') or request.get.get('project') class postfilterform(forms.form): def __init__(self, *args, **kwargs): self.request = kwargs.pop("request") super(postfilterform, self).__init__(*args, **kwargs) monitoring_words_to_show = nlpmonitorword.objects.filter(monitoringwords__name = self.request.get.get('project')) words_list = [] word in monitoring_words_to_show: words_list.append((word.monitor_word, word.monitor_word)) words_list = tuple(words_list) # trying here tuple pass in choises (('vk', 'vk'), ('fb', 'fb'), ('vkfb', 'vkfb')) project = forms.charfield(required=true, label='') monitor = forms.multiplechoicefield(widget=for

Dropdown not showing up within Wordpress -

my dropdown menu not show in wp website, when hover mouse. tried adding this? .sub-menu .navigation { display: block; height: 0px; z-index: 63; overflow-x: hidden; overflow-y: hidden; } still didn't help.

visual studio - Publish error on fresh umbraco install -

i'm new umbraco , first install apologies if ask pretty beginner questions. so i've installed umbraco using nugent. build program , press 'control & f5' run it. after umbraco installed went solution explorer in visual studio , made sure 'include in project' new files , folders created. now want deploy iis server have sitting on server. when deploy following web.config error could not open source file: not find part of path 'c:\users\josha\documents\visual studio 2015\projects\umbraco - secondattempt\umbraco - secondattempt\umbraco\install\views\web.config;\umbraco\install\views\web.config'. umbraco___secondattempt 0 i'm not sure if i'm not doing correctly since i'm new followed few tutorials , didn't think set incorrectly. i still had issue 7.5 solution: inside project dir, if file projectname.wpp.targets not exist, create it. make sure content include: <project toolsversion="4.0" xml

python - How to output a long dictionary in a pandas dataframe column in its entirety? -

i have pandas dataframe rather long dictionaries in 1 column. example: import pandas pd d = [[{'a':'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','b':'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'}]] df = pd.dataframe.from_dict(d) print df[0] which leads output: 0 {u'a': u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', u'... name: 0, dtype: object everything start of dictionary omitted ellipses. how output full dictionary without iterating on individual keys? this should work: in[6]:df[0].values out[6]: array([ {'a': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'b': 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'}], dtype=object)

node.js - Automate Git commit + versioning + tag by npm node -

what have been trying is, work npm version update package.json , create tag , commit changes. in way, able have tags version, auto versioning , commit info. the problem having is, when using npm version, it's doing tag + commit automatically , can not done if have changes, me, doesn't make sense increase version of project, before changes/implementation/fixes. then, problem having first increase version 'patch', changes, add all, commit , publish, @ end, have 2 commits, 1 because of npm version patch, , other 1 one. i saw in documentation here there parameter allow disable auto tag + commit, use command in console able update package console , version set tag. by hand, not sure if saying make sense because far know, when create tag, can go in project point, how pretend work if disabling auto commit? finally , want make clear goal, want reach handle node scripts semi-automated script able increase version of project, create tag new version, add chan

javascript - How to generate a Ractive <select> with only a max value -

using ractive, want generate dropdown number options 1 n. a select element can generated using ( source ): <select value='{{selectedcountry}}'> <option selected disabled>select country</option> {{#countries}} <option value='{{id}}'>{{name}}</option> {{/countries}} </select> with: ractive = new ractive({ el: mycontainer, template: mytemplate, data: { countries: [ { id: 'afg', name: 'afghanistan' }, { id: 'alb', name: 'albania' }, // , on... ] } }); so data change like: ractive = new ractive({ el: mycontainer, template: mytemplate, data: { n: 50 } }); but syntax #countries loop when have max value ( n )? <select> {{#each array(n):i}} <option>option {{i}}</option> {{/each}} </select> relevant docs: handlebars style sections adding arra

Azure: error not detected -

Image
i have experiment in azure. when launch run obtain: if @ top on right see there error, no module has it. if run single module (in simple case) know error has be, can highlight specific error. is bug or doing wrong? i had similar error once when, reason, module (not created me) under one. error shown, couldn't see module.

php - Session data not being passed through to the next page -

i have login system has 2 pages, it's quite simple doesn't appear data being passed through being redirected back. have tried couple solutions. adding exit; , die; after inital redirect login. have printed session_id worked fine. login page: session_start(); if(isset($_post['login'])){ $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); $username = stripslashes($username); $password = stripslashes($password); $password = md5($password); $sql = "select * table username = :username limit 1"; $stmt = $conn->prepare($sql); $stmt->bindparam(":username", $username); $stmt->execute(); foreach($stmt $row) { $id = $row['id']; $db_password = $row['password']; } if($password == $db_password){ $_session['username'] = $username; $_session['id'] = $id; header("location

javascript - load-grunt-config not finding target task -

i want split large gruntfile in smaller pieces , came these articles: https://github.com/firstandthird/load-grunt-config http://ericnish.io/blog/how-to-neatly-separate-grunt-files/ however, seems i'm missing obvious. when issue "grunt testtask" task not found. i'm doing wrong, obviously, don't it. here's content of files, stripped down as possible: gruntfile.js: module.exports = function(grunt) { var path = require('path'); require('load-grunt-config')(grunt, { configpath: path.join(process.cwd(), 'grunt3'), init: true }); }; grunt3/testtask.js: module.exports = { copy: { main: { files: [{ src: "test1.txt", dest: "test2.txt" }] } } }; added aliases file: module.exports = { 'default': [], 'mytesttask': [ 'testtask' ] }; default found. mytesttalk "testtask not found". shouldn't