Posts

Showing posts from January, 2010

c - segmentation fault / malloc error? -

edit: problem solved, all so i'm writing code final piece of c coursework. i've written function fastdfs carries out fourier transform. following code supposed time process different input sizes. #include <stdio.h> #include <stdlib.h> #include <complex.h> #include <math.h> #include <time.h> void fastdfs(complex double *, complex double *, complex double *, complex double *, int, int); void print_complex_vector(complex double *, int); void free_complex_vector(complex double *); complex double *make_complex_vector(int); complex double *makewpowers(int); int main(void) { int i,n, operations_required; int index_counter = 1; double initial_time, final_time, time_taken, mega_flops_rate; complex double *mega_flops_vector = make_complex_vector(21); for(n = 2; n <= pow(2,20); n = n * 2) { complex double *wp = makewpowers(n); complex double *y = make_complex_vector(n); complex double *x = make_

java code keeps throwing exception -

my code throws exception java.lang.string.charat @ line in code : while(0 == chartoint(value.charat(startvalueat))){ in code segment, private static arraylist<integer> stringtoarray(string value){ arraylist<integer> holder = new arraylist<integer>(); int startvalueat = 0; if(value.charat(0)=='-'|| value.charat(0)=='+') startvalueat= 1; else startvalueat = 0; while(0 == chartoint(value.charat(startvalueat))){ startvalueat++; } int startofvalue = value.length() - (startvalueat - 1); //to make sure arraylist right size , last element ends @ 0 find starting index of j above step //we use value of startvalueat for(int = startofvalue, j = startvalueat; j <= value.length() - 1; i--, j++){ holder.add(0, chartoint(value.charat(j))); } return holder; } here stack trace: exception in thread "main" java.lang.stringindexoutofbound

powershell - DataReader causing SQL Server to leak available memory -

i have powershell script that's reading data local sql server express 2014 database , writing csv file. works fine, it's using entire pool of available memory sql server, , not releasing when script finished running . calling gc.collect() doesn't release memory; have restart sql server service back. here's relevant portion of script, i've determined leak occurring: try { $sqlconn = new-object -typename system.data.sqlclient.sqlconnection($sqlconnstring); $sqlconn.open(); $sqlcmd = new-object -typename system.data.sqlclient.sqlcommand; $sqlcmd.connection = $sqlconn; $sqlcmd.commandtype = [system.data.commandtype]::text; $sqlcmd.commandtext = "select * $exportreadings"; #write contents csv file $line = new-object -typename system.text.stringbuilder; $out = new-object -typename system.io.streamwriter -argumentlist $csvfile, $false; $out.writeline("header_row"); $reader = $sqlcmd.executere

ios - Adding a title to the left side of the navigation bar -

is possible add title left side of navigation bar? know how can add title in center when try add 1 left side see nothing. code have: self.navigationitem.leftbarbuttonitem?.title = "elapsed time: 0:00" thank help. try code: let leftitem = uibarbuttonitem(title: "title", style: uibarbuttonitemstyle.plain, target: nil, action: nil) leftitem.isenabled = false self.navigationitem.leftbarbuttonitem = leftitem more powerful solution of problem: let longtitlelabel = uilabel() longtitlelabel.text = "long long long long long long title" longtitlelabel.font = ................ longtitlelabel.sizetofit() let leftitem = uibarbuttonitem(customview: longtitlelabel) self.navigationitem.leftbarbuttonitem = leftitem now can edit label want. can use font or text color.

javascript - REST adapter to work with https -

i writing rest adapter in express translates incoming rest calls rest api exposed northbound device. essentially, client device sending request rest api exposed adapter , adapter sends rest request device. adapter both rest server client devices rest client northbound device. var express = require('express'); var router = express.router(); var request = require('request'); router.route('/') .get(function(req, res) { request('url'', function (error, response, body) { if (!error && response.statuscode == 200) { console.log("sent mos"); console.log(body) // print google web page. } }) }); module.exports = router; i'm using request module. northbound device exposing https rest api. when insert https (mind 's') rest api call in url section in code above don't answer northbound device. it works if 'url' above po

c# - Trying to get Mysql code first from database to work -

edit: found post , worked, had run win forms: enable entity framework 6 mysql (c#) in winforms of microsoft visual studio 2013 op-------------------- i have created console c# application when right click on project, goto add new item, i add ado.net entity data model called model1 i select mysql connection , hit finish nothing happens. closes wizard , nothing. anyone come across problem? i have installed mysql visaul studio program , have run npm command: install-package mysql.data.entities my app.config looks this: <?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> <!-- more information on entity framework configuration, visit http://go.mi

How to remove object/array from javascript variable? -

how remove object/array javascript variable? you can use array.prototype.pop() remove last element of array. bankbranchreponse.pop(); to remove element @ specific index, example 3rd element: var index = 2; // 0 based 2 3rd element bankbranchreponse.splice(index, 1);

javascript - Convert string to array or object -

is there possible convert string array or object? not valid stringify json data, not sure how tackle this. "{"subject":"test comment"},{"message":"test message."}" thank in advance! like this: json.parse('[' + '{"subject":"test comment"},{"message":"test message."}' + ']')

javascript - How to use noscript tag with ScriptBundle -

i've used scriptbundle in code this var ideagaugesbundle = new scriptbundle("~/content/scripts/external/gauges/ideagaugesbundle") .include("~/content/scripts/external/gauges/gauges.js") .include("~/content/scripts/external/gauges/raphael.js"); ideagaugesbundle.orderer = nullorderer; bundles.add(ideagaugesbundle); and it's rendering on page @scripts.render("~/content/scripts/external/gauges/ideagaugesbundle") <script src="/content/scripts/external/gauges/gauges.js"></script> <script src="/content/scripts/external/gauges/raphael.js"></script> how can add noscript tag each 1 on fly? <script src="/content/scripts/external/gauges/gauges.js"></script> <noscript>it appears javascript not supported or disabled.</noscript> <script src="/content/scripts/external/gauges/raphael.js

c# - Show content with button click without postback -

<asp:updatepanel id="uptaskinfo" runat="server" clientidmode="static" updatemode="conditional"> <contenttemplate> <div class="customalertdisplay hidetag" id="customalertdisplay" runat="server"> <section class="notif notif-warn"> <h6 class="notif-title">warning!</h6> <p>this task forced checked out user. changes not saved site.master.</p> <div class="notif-controls"> <a href="javascript:void(0);" class="notif-close" id="cbtn" title="close message">close</a> </div> </section> </div> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="lb1" /> </triggers> </asp:updatepa

Java Socket/SocksSocketImpl memory clog -

in our test lab setup have 2 hosts, both acting server/client sending heartbeats each other. i running automated performance tests, , after 5 days ram consumption increase steady consistent, on first application. since tests did not target heartbeat application, not expected. after collecting heap dump of problematic host , loading memoryanalyzer , found lots of "unreachable" sockssocketimpl objects. the number huge, more 12k of objects. now, application create , use sockets pretty confident, after reviewing code, there no sort of creation loop there. however, when application quits, socket not closed, again, heartbeat application did not restart during 5 days. i've read in question: memory leak sockssocketimpl finalize method ... however, running version 1.7.0_76 , guys there write bug fixed in 1.7.0_51 . java -version output: java version "1.7.0_76" java(tm) se runtime environment (build 1.7.0_76-b13) java hotspot(tm) server vm (build 24

How can I show a object using Ajax in a button with JQuery? -

in module appinformacionderegistro have method accionbotonenviar , , contains click(function() : accionbotonenviar: function(data){ var self = this; $("#btn_enviar_formulario_id").click(function(){ (var = 0; <acontadorestados.length; i++) { var enviar = true; if (acontadorestados[i] == "no contiene") { enviar = false; break; }; }; if (enviar) { self.hideerror(); self.hidesuccess(); self.validarnombretrabajador(); }else{ self.hidesuccess(); self.hideerrortrabajador(); self.showerror(); }; }); }, for now, need show object objtareas of method datosguardados chrome's debug console console.info() , using ajax. datosguardados: function(problema){ var self = this; var objtareas = new object(); objtareas.tareas = atareas; objtareas.descripcionproblema = problema; objtareas.idtareaseleccionada = $('#nombre_trabajador_id').va

What is the difference between Regex and string in javascript? -

> "1fff=*; style=mobile".match("[\s]*") [ '', index: 0, input: '1fff=*; style=mobile' ] > "1fff=*; style=mobile".match("[^;]*") [ '1fff=*', index: 0, input: '1fff=*; style=mobile' ] > "1fff=*; style=mobile".match('(^|;)[\s]*style=([^;]*)') null > "1fff=*; style=mobile".match(/(^|;)[\s]*style=([^;]*)/) [ '; style=mobile', ';', 'mobile', index: 6, input: '1fff=*; style=mobile' ] str.match(str) can work partially regex mode, there difference. what difference? the difference in string literal, \s means s — there's no \s escape-sequence string literals, \ gets dropped. if want use string literal, , need regex contain \s , string literal needs contain \\s (with backslash) string contain \s : > "1fff=*; style=mobile".match('(^|;)[\\s]*style=([^;]*)') ; style=mobile,;,mobile (i recommend sti

javascript - How merge two objects array in angularjs? -

i want append following object array existing 1 in angulajs implementing load more feature. ie,appending ajax response existing 1 each time. i have 1 variable, $scope.actions contains following json data, { "total": 13, "per_page": 2, "current_page": 1, "last_page": 7, "next_page_url": "http://invoice.local/activities/?page=2", "prev_page_url": null, "from": 1, "to": 2, "data": [ { "id": 2108, "action_type_id": 202, "user_id": 1 }, { "id": 2108, "action_type_id": 202, "user_id": 1 } ] } i want append following json response each time variable. { "data": [ { "id": 2108, "action_type_id": 202,

java - Using JMX with Jaas for jconsole authentication -

i have following scenario: i have application uses jmx expose methods, sat on server. @ present users can connect via command line using jconsole. there no access restrictions. users logging machine , have access rights stored in form of active directory. i looking add authentication , authorisation jmx process when user types command line: jconsole <processname> it check ad user group , determine if have authorisation either read or read , write managed resource. i have solution retrieving ad groups, not in how pass jmx process. can set hard coded passwords file on jmx process have no way of calling user automatically determine access rights. is possible current jmx process execute callback determine given users access rights when try connect it? if not, there existing tools , frameworks (for example jboss) allow me this? this solved using jaas custom login module, bouncing , relaunching jmx process following in command line: -dcom.sun.management.jm

github - Trigger Jenkins to build when changes are pushed from git -

Image
i trying jenkins setup start build whenever push sent local branch remote branch. i believe have setup fields in jenkins browser ide, yet no build produced when push jenkins. via http://blog.cloudbees.com/2012/01/better-integration-between-jenkins-and.html : configure system / github web hook: project / configure / build triggers: the check option on "build when change pushed github" not working. although found workaround poll changes in git every 30 min. monday through friday using "poll scm" option , cron input:

selenium - parallel_tests - Ruby multiple browser testing -

so far have tried running multiple scenarios using parallel_tests , working fine. problem approach need run multiple times different browser parameter , think not practice. right passing browser parameters along cucumber config. can pass array of browsers 'chrome', 'firefox' , 'ie' etc. question is, there anyway can trigger scenarios against these browsers? parallel_tests should invoke scenarios? (lets 2 scenarios) 6 times (1 scenario against 3 browsers). there anyway can achieve task?

java - Problems in JSON results calling JAWBONE API -

i'm developing android app analyze band data. using example given in sdk android , @ moment can trend data json object. problem json object malformed. in fact when try deserialize trend data with: jsonelement je = new jsonparser().parse(o.tostring()); i following error: com.google.gson.jsonsyntaxexception: com.google.gson.stream.malformedjsonexception: expected value @ line ... moreover, inspecting result of api call get: {meta={user_xid= masked , message=ok, code=200.0, time=1.430319261e9}, data={earliest=2.0130408e7, data=[[2.0150423e7, {e_protein=null, weight=78.0, goal_body_weight_intent=null, body_fat=null, m_distance=8073.0, s_awakenings=null, height=1.72, m_lcat=1336.0, goal_body_weight=null, s_quality=null, m_steps=10760.0, e_cholesterol=null, s_light=null, e_sat_fat=null, n_bedtime=null, m_workout_time=0.0, e_calcium=null, s_bedtime=null, n_awakenings=null, n_light=null, s_awake_time=null, pal=null, n_duration=null, m_lcit=9660.0, m_active_time=5717.0, e_uns

c# - Consume WCF library functions from browser -

i've wcf library functions use powershell , c# clients. use couple of util functions directly browser i'm not sure how do. first added webhttpbinding endpoint in web.config file, here slice <services> <service name="mi_lib.mainservice"> <endpoint name="basic" address="" binding="basichttpbinding" bindingconfiguration="mi_lib_http" contract="mi_lib.interfacemainservice"></endpoint> <endpoint name="web" address="web" binding="webhttpbinding" bindingconfiguration="mi_lib_web" contract="mi_lib.interfacemainservice"></endpoint> </service> </services> <bindings> <basichttpbinding> <binding name="mi_lib_http" /> </basichttpbinding> <webhttpbinding> <binding name="mi_lib_web" crossdomainscriptaccessenabled="true&

IOS/xcode/coredata: Implement calendar control using core data -

ios newb here trying implement open source calendar control maday in project data stored in core data. calendar control not provide documentation accessing core data. i guessing need create nsarray after pulling events core data corresponds "events" array below. all? , if so, how do that? thanks suggestions. here datasource code library: - (nsdate *)nextdayfordate:(nsdate *)date; - (nsarray *)eventkiteventsfordate:(nsdate *)date; - (nsarray *)eventkiteventstomaevents:(nsarray *)eventkitevents; @property (readonly) ekeventstore *eventstore; @end @implementation maeventkitdatasource - (nsarray *)dayview:(madayview *)dayview eventsfordate:(nsdate *)date { return [self eventkiteventstomaevents:[self eventkiteventsfordate:date]]; } - (nsarray *)weekview:(maweekview *)weekview eventsfordate:(nsdate *)date { return [self eventkiteventstomaevents:[self eventkiteventsfordate:date]]; } - (ekeventstore *)eventstore { if (!_eventstore) { _event

javascript - Add text input to Pikaday modal dialog -

Image
i trying redesign pikaday , , replace year select text input. however, whenever adding input there - becomes disabled. if inspect element - not disabled, not z-indexed background , not opacity. not clicable. on hover, however, replace cursor text-edit cursor. does know why happens, , whether available "fix" it? thanks! ok, after analyzing code better - saw modal dialog listening event on mouse down - "preventdefault"s whenever click not on expected target. . so, in case, applying class 'pika-select' make form element interacted expected.

ruby - rails I18n wrong parameter order in route (id as locale and id is nil) -

i want internationalize external code (see github ) i18n rails. have read guide rails internationalization (i18n) api . translating text not problem, underlying code seems not work anymore in situations. unfortunately, i'm not rails/ruby expert. from log: fatal -- : actionview::template::error (no route matches {:action=>"edit", :controller=>"plans", :format=>nil, :id=>nil, :locale=>115} missing required keys: [:id]): so problem is, parameter id (=115) passed locale instead id. to i18n working added following code app/controllers/application_controller.rb: ... before_action :set_locale protected def set_locale i18n.locale = params[:locale] || i18n.default_locale end def default_url_options(options = {}) { locale: i18n.locale }.merge options end ... moreover, wrapped original routes in config/routes.rb: dmptool2::application.routes.draw scope "(:locale)", locale: /en|de/ lot of origin

performance - How to preallocate a buffer of certain size in Python? -

i have use case want combine multiple chunk of buffers single buffer. in case of c/c++/java preallocate buffer size same combined size of source buffers, copy source buffers it. how can done in python in similar way. want avoid creating multiple smaller intermediate buffers may have bad impact on performance. i think best way wanna is: initial_value = none # or 0, false, etc. size = 10 # or size of buffer buffer = size * [initial_value]

android - WebView: Differences between LoadUrl() and LoadDataWithBaseURL() -

i want load remote url haves ad. ad use javascript. i using: webview.loadurl("http://myurl.com") webview.getsettings().setjavascriptenabled(true); which differences exists if use: webview.loaddatawithbaseurl("http://myurl.com", null, null, null, null) webview.getsettings().setjavascriptenabled(true); thanks loaddatawithbaseurl() - loads given data webview, using baseurl base url content. base url used both resolve relative urls , when applying javascript's same origin policy. historyurl used history entry. .... loadurl() - loads given url specified additional http headers. see documentation - http://developer.android.com/reference/android/webkit/webview.html

php - Error: Uncaught exception 'Twig_Error_Loader' with message 'The "src/assets/" directory does not exist.' -

getting strange error when accessing backend in bolt. haven't deleted particular directory, , frontent works fine. stack trace: #0 src/render.php(53): twig_loader_filesystem->addpath('/var/www/html/h...') #1 src/application.php(607): bolt\render->render('error.twig', array) #2 [internal function]: bolt\application->errorhandler(object(twig_error_loader), 500) #3 vendor/silex/silex/src/silex/exceptionlistenerwrapper.php(52): call_user_func(array, object(twig_error_loader), 500) #4 [internal function]: silex\exceptionlistenerwrapper->__invoke(object(symfony\component\httpkernel\event\getresponseforexceptionevent), 'kernel.exceptio...', object(symfony\component\eventdispatcher\eventdispatcher)) #5 vendor/symfony/event-dispatcher/symfony/component/eventdispatcher/eventdispatcher.php(164): call_user_func(object(silex\exceptionlistenerwrapper), object(sym file: vendor/twig/twig/lib/twig/loader/filesystem.php line: 93

javascript - Integrating Angular App within Laravel PHP - Unhandled Exception -

i have laravel app i'd add in angular frontend. my index file, main.blade.php, specifies name of app. here structure of main page... html partials piped in through {{ $content }}: <!doctype html> <html lang="en" ng-app="myapp"> <head> ... </head> <body> <div id="main-container"> <header> ... </header> {{ $content }} <footer> ... </footer> </div> </body> </html> i have partial page, private events: <div id="inner-container" class="events" ng-controller="myctrl"> <li ng-repeat="phone in phones"> <p>{{phone.name}}</p> </li> ... </div> and controllers.js file: var myapp = angular.module('myapp', []); myapp.controller('myctrl', function($scope) { $scope.phones = [ {'name'

word cloud - R wordcloud-finding frequency per block of text -

this question has answer here: creating “word” cloud of phrases, not individual words in r 2 answers i have csv file of data contain phrases : dd<-c("hello how you?";"i fine"; "hello how you?"; "not bad") i want frequency of each block of sentences (divided ; ) using wordcloud. however, frequency per word. is there way frequency per block of content in each cell? in toy example get: text freq ---------------------------- hello how you? 2 fine 1 not bad 1 thank in advance fwiw, try this library(wordcloud) library(tm) txt <- c("hello how you? fine", "hello how you?; not bad") semicolontonekizer <- function(x) unlist(strsplit(as.character(x), ";", fixed = true)) tdm <- termdocumentmatrix(corpus(vectorsource(txt)), list

Eclipse slow after import of yeoman scaffolded angularjs project -

i've created new angularjs project using yeoman. yo angular it create huge project folder, near 190mb of node_modules libraries. don't know if normal, i've tried import created project in eclipse new javascript project , after that, eclipse become slow, cause isn't able validate/handle such big project. is normal new angularjs project scaffolded yeoman take disk space? if so, how can make eclipse handle it? thanks information. i had same issue , crashes eclipse occasionally. solution use eclipse resource filter ignore yeoman related folders. right click on project, select properties. resource->resource filters click on "add..." select "exclude all" under "filter type" select"folders" under "applies to" enter "node modules" in text box , click on ok repeat 1-6 "bower-components" folder after these 2 folders ignore eclipse running fine. i'm running luna (4.4.1)

javascript - Why does the runtime of my Chrome extension content script not have any onMessage only connect and send message -

Image
i've been struggling days on this, extension's content script seems missing permissions or something, i've searched through api docs , found nothing. the messaging works if send message content page, not content page following code: from background page: var messagecallback = function (e) { var nodemessage = json.parse(e.data); switch (nodemessage.executiontype) { case 0: chrome.tabs.create({ url: nodemessage.url }, function (tab) { //injects injected.js not messages.js injectcode(tab.id); chrome.tabs.sendmessage(tab.id,nodemessage); }); break; //some other switch cases... from content script: chrome.runtime.onmessage.addlistener(function (message) { console.log('message received'); var event = new customevent("foo_receive", { detail: message, bubbles: true }); console.log('event sent'); document.dis

ios - UIApplication sharedApplication EXC BAD ACCESS in a UITextField category -

- (void)somemethod { bool isrighttoleft = ([uiapplication sharedapplication].userinterfacelayoutdirection == uiuserinterfacelayoutdirectionrighttoleft) } this causes exc bad access. i'm thinking because not thread safe , called many times. rules in using uiapplication sharedapplication? thanks!

hibernate - Save entity and all its child entities -

Image
i'm having problems updates of mdfe entity, before explaining happens, looked image below, can explain. we can see mdfe has ratio of 1 many mdfedocumento has ratio of 1 many mdfeunidadetransporte , has ratio of 1 many mdfeunidadecarga. the crud structure performed on mdfe. when editing mdfe , update entity, mdfedocumento changed, however, there, other entities not suffer changes. example, if when editing mdfe , change transport unit of given document, while giving update on mdfe entity, transport unit not suffer modification. how can make these inserts / changes made saving mdfe? if can not insert / update parent entity, best way insert / update other? thank all, , if in doubt comment on explanation improve. sorry bad english, brazilian the font code: @entity @table(name = "mdfe") public class mdfe implements ientity { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.auto) @column(name = &q

jquery - Upload file via FTP using javascript (Chrome Extension) -

i have chrome extension, it's pure javascript + chrome api. want upload via ftp protocol file. i have understood vanilla javascript can't ftp request. there other way ? i'm in chrome extension haven't find ftp purpoes in online api and have clarify, have upload file via ftp on black box. don't have control on it. , black box not accessible via internet, via local network. it seems can use chrome-app-ftp library var ftpclient = new ftpclient(host, port, user, password); ftpclient.connect().then(function () { ftpclient.upload("test.txt", buffer) }); but socket api doesn't available in extensions. here more information it

mongoose - MongoDB query for today call list -

this data of 1 user in user table in mongodb { "_id" : objectid("553799187174b8c402151d06"), "modified" : isodate("2015-04-22t12:50:32.477z"), "name" : "suresh", "userid" : "sursha6398", "created" : isodate("2015-04-22t12:50:32.457z"), "deleted" : false, "call_schedule" : [ { "calltype" : "a", "calldate" : isodate("2015-01-14t18:30:00.000z"), "_id" : objectid("553799187174b8c402151d0e") }, { "calltype" : "a", "calldate" : isodate("2015-01-31t18:30:00.000z"), "_id" : objectid("553799187174b8c402151d0d") }, { "calltype" : "b", "calldate" : isodate("2015-02-19t18:30:00.000z"), "_id" : objectid("55379

In R: use system() to pass python command with white spaces -

im trying pass python command r (on windows x64 rstudio) python script via command promt. works if type directly cdm not if via r using r function system() . format (this how write in windows cmd shell/promt): pyhton c:/some/path/script <c:/some/input.file> c:/some/output.file this works in cmd promt, , runs script input file (in <>) , gives output file. thought in r do: system('pyhton c:/some/path/script <c:/some/input.file> c:/some/output.file') but gives error python error: unparsable arguments: ['<c:/some/input.file>', 'c:/some/output.file'] it seems if r or windows interpret white spaces different if wrote (or copy-paste) line cmd promt. how this. from ?system this interface has become rather complicated on years: see system2 more portable , flexible interface recommended new code. system2 accepts parameter args arguments of command. so can try: system2('python', c('c:\\some\\path

vb.net - Remove specific string while writing log of .bat file -

i creating .bat file transfer files 1 server another. after file moved, delete original .bat file. in addition writing log .bat file. code works fine, issue along result password being stored in log file, can't remove same original .bat file used transferring given credentials. can remove same log file? below code same: shell("filters.bat >log.txt") here's 1 way replace text (password "***") in text file (filename). it's untested, should close. s = system.io.file.readalltext(filename) s = s.replace(password, "****") system.io.file.writealltext(filename, s) to replace while writing file, use string replace on whatever string you're writing: s = system.io.file.readalltext(batchoutput) s = s.replace(password, "****") system.io.file.appendalltext(logfilename, s)

prefix and postfix operators c++ -

class compl{ float re,im; public: compl(float r, float i) {re=r; im=i;} compl& operator++() {++re; return*this;} //(1) compl operator++(int k){ compl z=*this; re++; im+=k; return z;} //(2) friend compl& operator--(compl& z) {--z.re; return z;} friend compl operator--(compl& z,int k) {compl x=z; z.re--; z.im-=k; return x;} }; (1) why have return current object reference? understood, reference second name something. (2) why have save current object in z, change object , return unchanged z? doing this, returning value not increased. because of way postfix operator works(it returns old value, , increases it) (1) don't have to, it's idiomatic because allows chaining operators or calls. (2) yes, postfix should return previous value.

c# - LocalDB MDF file property "Copy if newer" not working -

i developing application in visual studio 2012 .net framework 4.5 , using mdf file local db. problem here changes made data @ runtime not getting saved permanently. however, able retrieve data @ runtime save not displayed in server explorer. have set "copy output directory" property of mdf file "copy if newer" problem still exists. how solve it? this connection string in application's app.config. had earlier tried seperate data set .xsd file no avail. <connectionstrings> <add name="ea_logistics_control.properties.settings.logisticslocaldbcs" connectionstring="data source=(localdb)\v11.0 attachdbfilename=|datadirectory|\localdbs\logisticslocaldb.mdf;integrated security=true" providername="system.data.sqlclient" /> </connectionstrings> some might suggest : use sqlexpress server instead of localdb or try connect localdb programmatically , replace bin\debug "folder_name\file_name.mdf" bu

android - Recyclerview scrolling past FAB -

i'm using recyclerview , have fab on layout. want able give bit of space @ bottom of last item gmail app when scroll bottom right hand star on bottom item still clickable. i tried adding padding bottom achieves scrollbar doesn't scroll way bottom, stopping @ padding height, whilst gmail version does. have idea how this? <recyclerview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:cliptopadding="false" android:paddingbottom="90dp" android:scrollbars="vertical" /> you have add "footer" @ end of adapter. footer blank view, android.widget.space . recycler view doesn't have native options header n footers, can google around , find few options. i developed library extras recycler view have header/footer/section options: i didn't upload yet maven can grab code here: https://github.com/eyeem/recycler

python - Pandas Dataframe Plot -

Image
i trying plot time series data. dataframe looks this [1]:index ship_date cost_amount 0 1/8/2010 34276 1 1/8/2010 12375 2 1/8/2011 12343 3 2/9/2011 15435 [2]: df1.plot(figsize(20,5)) i trying plot data reason plot doesn't have x-axis in ascending order. how plot date ascending or descending order ? your problem (as spotted @ j richard snape) dates in fact strings it's ordered lexicographically. you should convert datetime dtype: df1['ship_date'] = pd.to_datetime(df1['ship_date']) after should maintain expected order.

java - Object value as null in Jackson Parsing -

i using jackson library , trying achieve mentioned here baseoperationrequest.java @jsontypeinfo( use = jsontypeinfo.id.name, include = jsontypeinfo.as.property, property = "command" ) @jsonsubtypes({ @jsonsubtypes.type(name = "zadd", value = zaddbaseoperationrequest.class) }) public class baseoperationrequest { public short operationid; public command command; public string gameid; public string key; } zaddbaseoperationrequest.java public class zaddbaseoperationrequest extends baseoperationrequest{ public map<string, double> members; } command.java public enum command{ zadd, hset } the problem here when try pass object rest call this: @restcontroller public class mycontroller{ //keeping get, change post , take in requesbody later on @requestmapping(value = "/process/{object}", method = requestmethod.get, produces = "application/json") public @responsebody responseentity process(@p

java - How to change the property signUpUrl in ProviderSignInController in Spring Boot -

in short i need change property value of bean defined in auto configuration of spring boot, not available configure application.properties descriptive i want change signupurl of bean providersignincontroller . not available change in properties file according documentation. http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html so did somthing this. @configuration public class someconfig { @autowired public void configureprovidersignincontroller(providersignincontroller signincontroller){ signincontroller.setsignupurl("/register"); } and ended following error caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [org.springframework.social.connect.web.providersignincontroller] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {} @ org.springframework.beans.factory.support.defaultlistab

python - MongoDB: How to determine is specific value does not exist -

i can find examples find if specific keys not exist. i have specific documents in mongodb instance have fields this: "actions" : [ { "date" : "2015-03-09t15:28:03z", "reason" : "", "begin_date" : "2015-03-09t15:28:03z", "end_date" : "2015-03-09t15:28:03z", "action_type" : "block", "performed_date" : "2015-03-09t15:28:03z", "active" : "on", }, { "date" : "2015-03-09t15:28:03z", "reason" : "", "begin_date" : "2015-03-09t15:28:03z", "end_date" : "2015-03-09t15:28:03z", "a

android - What to use for image gallery using parse -

i trying display images retrieving through parse in imageview. want keep images swipe-able both left , right. confused in method use. please guide me might right me keeping in mind things want achieve. example or tutorial help. thank-you. you can have specific class gallery1 holds image , image name. if gallery1 class & image column name (i.e key in parse ), can imageurl by, parsequery<parseobject> query = new parsequery<parseobject>("gallery1"); query.orderbyascending("createdat"); try { parseobjects = query.find(); } catch (parseexception e) { e.printstacktrace(); log.e("error : ", e.getmessage()); } (parseobject parseobject : parseobjects) { parsefile image = (parsefile) parseobject.get("image"); if (image!=null) { log.d("image", image.geturl()); } } for swiping left , right, there many posts available h

angularjs - Angular spinner is not appearing -

i using urish/angular-spinner not working when try use in controller through $scope.startspin() , $scope.stopspin() ; please find plunker @ plunker . here spinner not appearing @ all. the following code starting , stopping spinner. $scope.startspin(); dashboardsdataservice.getnetspendovertimedata() .then(function(data) { $scope.data = data; $scope.stopspin(); }); it simple need remove spinner-key="spinner-1" and work fine! the final code <!doctype html> <html ng-app="myapp"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script>document.write('<base href="' + document.location + '" />');</script> <link rel="stylesheet" href="style.css" /> <script data-require="angular.js@1.2.x" src="https://code.angularjs.org/1.2.16/angular.js

php - Display each color separate with values -

i having trouble in printing values database. item table item | color | material | dimensions | category | quantity - 01 33 05 111 12 1000.00 - 02 33 07 125 18 200.00 - 03 33 11 156 18 254.00 - 04 56 15 25 66 113.00 - 05 66 05 11 33 521.00 i trying print values in table(for each color print material dimension category) output be: color - > 33 material | dimension | category | quantity 05 111 12 1000.00 07 125 18 200.00 11 156 18 254.00 color - > 56 material | dimension | category | quantity 15 25 66 113.00 color - > 66 material | dimension | category | quantity 05 11 33 521.00 i using query $query = "select a.itemnb, b.colorname, c.materialname, d.