Posts

Showing posts from September, 2015

AWS S3 The security of a signed URL as a hyperlink -

is safe? maintaining security using pre-signed url aws s3 bucket object? <a href="https://mywebsite.s3.amazonaws.com/40.pdf?awsaccesskeyid=[my access key]&expires=1433297453&signature=[this random set of numbers]">my link</a> another words - part 1... say i'm storing bunch of separate individual's files in bucket. want provide link file user. obviously, each file uniquely consecutively named, don't want people able change link 40.pdf 30.pdf , different file. url seems that. part 2, , more importantly.... is safe or dangerous method of displaying url in terms of security of bucket? clearly, giving away "access key" here, of course, not "secret". already answered 3 years ago... sorry. how secure amazon aws access keys? aws security credentials used when making api calls aws. consist of 2 components: access key (eg akiaisemtxnog4abpc6q ): similar username. okay people see it. secret key : long s...

mysql startup shell problems -

since met many startup errors,i decide analyze mysql startup shell.while code fragment cannot understand clearly. version: mysql ver 14.14 distrib 5.5.43, osx10.8 (i386) using readline 5.1 368 # 369 # first, try find basedir , ledir (where mysqld is) 370 # 372 if echo '/usr/local/mysql/share' | grep '^/usr/local/mysql' > /dev/null 373 374 relpkgdata= echo '/usr/local/mysql/share' | sed -e 's,^/usr/local/mysql,,' -e 's,^/,,' -e 's,^,./,' 375 else 376 # pkgdatadir not relative prefix 377 relpkgdata='/usr/local/mysql/share' 378 fi what's purpose of line 372? little weird any appreciated. at first glance, strange indeed... here's solution mystery. 372: if echo '/usr/local/mysql/share' | grep '^/usr/local/mysql' > /dev/null 373: grep returns true if matches , false if doesn't, testing whether string /usr/local/mysql/share begins ( ^ ) /usr/local/mysql . o...

java - How do I verify that the ETag is valid if the user does not pass If-None-Match? -

my first time ever hearing of 'etag'. have been able determine system i'm on, system uses etags validate item being submitted has not been altered prior submission of changes. if user has modified item system responds etag invalid. users using rest services had been created project , have not been altered in couple years. i'm working on jira based java application has rest services plugins. now in regards etag, i'm @ loss here. our security scan on system marks header etag risk injection of code. perhaps i'm over-thinking but, is etag created , set code in application or created tomcat server? am take value of etag , compare make sure valid? how validate value etag valid? where validation occur if if-none-match provided request? how protect injection? i've been reading posts on forum things dealing etag i'm not understanding what/how etag step 1 whatever last step is. could use reference how i'm code this. listing resources find: ...

How to copy Excel text and keep line breaks -

i have excel (2013) spreadsheet contains multiline text in of cells. word-wrap enabled cells, appear line breaks correctly. however, cells in question protected (and don't have password), can't click edit box copy there. if use ctrl-c copy clipboard, paste notepad, line breaks removed , double quotes placed around text. how can copy out text , keep line breaks? notepad doesn't interpret line breaks cleverly more fully-featured text editors. best bet try copy/pasting either wordpad, or download notepad++ ( https://notepad-plus-plus.org/download/ ) , paste first. this answer nice job of further explaining issue: https://superuser.com/questions/362087/notepad-ignoring-linebreaks

twitter bootstrap - nav menu not selected correctly -

Image
i created vertical menu nav bar work fine except drop down button. it don't seem able active. active state keep on previous item clicked. i don't use javascript <ul class="nav nav-pills nav-stacked"> <li id="contact" role="presentation" data-toggle="tab" class="active"><a href="#"><span class="glyphicon glyphicon-user"></span> dossier personnel</a></li> <li id="appointment" role="presentation" data-toggle="tab"><a href="#"><span class="glyphicon glyphicon-calendar"></span> rendez-vous</a></li> <li id="room" role="presentation" data-toggle="tab"><a href="#"><span class="glyphicon glyphicon-bed"></span> chambre</a></li> <li id="task" role="presentation" data-to...

javascript - Recursive method for checking an object -

so have created constructor attempting prototype. want method checks through each property in object see if empty , if returns key. if property object want check through sub object well. updated: my code far: function properties(val1, val2, val3, val4){ this.prop1 = val1 || ""; this.prop2 = val2 || ""; this.prop3 = val3 || ""; this.prop4 = val4 || {}; } properties.prototype = { isempty: function(){ (key in this) { if(typeof this[key] == "object" && this[key] !== null){ this[key].isempty(); } else { if(!this[key]){ console.log(key); } } } } } var test = new properties("something", "", "", {subprop1: "something else", subprop2: "", subprop3: {subsubprop1: "", subsubprop2: "" }}); the method should return prop2, pro...

PHP/Javascript/AJAX - Redirect page with a form, and then submit it -

i've been making webpage gathers tweets depending on input on form , i'm having problems using default form submit. i want change how form submit works might take ages page redirect , give user token id, due php script executing. make things simple thought best way make faster redirecting , submitting form. unfortunately don't think can php. someone recommended me give @ ajax, didn't how me. this how form looks like: <form action="testing.php" method="post"> <input type="text" name="search" value="" placeholder="all of these words" autofocus/><br> <input type="text" name="search2" value="" placeholder="this exact word or phrase" /><br> <input type="text" name="search3" value="" placeholder="any of these words" /><br> <input type="text" name="sear...

c# - Display variable in textbox -

in asp.net page have search box working expected. leave searched value in textbox after searching (the search opens new page, though i'm retaining search value querystring). can confirm variable being retained correctly using value <%= search%> in aspx, when try show in textbox nothing displays. have searched dozens of forum posts , nearest can tell need databind textbox. i'm not sure mistake is, closest have come with: <asp:textbox id="searchtextbox" runat="server" text='<%# search %>'></asp:textbox> search: <%=search %> with code behind public string search; protected void page_load(object sender, eventargs e) { search = request.querystring["search"]; searchtextbox.text = search; page.databind(); } you have check if first time see page this if (page.ispostback == false) { } and check first if query string exist.

asp.net mvc 5 - MVC 5 trouble on validating posted form inputs that are html encoded -

Image
i have view model string property: [stringlength(10)] public string phone { get; set; } in view: @html.editorfor(x => x.phone) if enter '+12' , submit, 'phone' html encoded , controller gets , had decode before saving database: httputility.htmldecode(phone); is normal behavior? another problem entering '+123456789' fails string length checks because encoded. how handle this? edit: my controller action looks like: [httppost] [validateantiforgerytoken] public actionresult edit([bind(include = "phone")] myviewmodel vm) edit2: i using custom template default adding sanitizing module modelbinders in application_start() causing trouble. garryp pointed out, framework takes care of once rid of custom binder , controller getting exact string user entered. not encoding/decodings happening on entered string though.. it shouldn't necessary htmldecode value; framework should take care of this. sto...

html - Safe to use // over https:// or http:// -

on our website have secure , unsecure pages. should link images, css etc using full https:// or how safe link using // ? example 1: <link href="https://www.domain.com/style.css" rel="stylesheet" type="text/css" /> example 2: <link href="//www.domain.com/style.css" rel="stylesheet" type="text/css" /> to ensure traffic encrypted, use https safe. can't hurt; can make traffic more secure.

How can I restrict the number of characters entered into an HTML Input with CSS (or jQuery, if necessary)? -

i can manipulate control based on state of control, shown in this jsfiddle , state of checkbox alters width , background color of textbox. the html is: <input type="checkbox" id="ckbxemp" >czech bachs <input type="text" id="txtbxssnoritin"> the jquery is: $(document).on("change", '[id$=ckbxemp]', function () { if ($(this).is(":checked")) { $('[id$=txtbxssnoritin]').css('background-color', '#ffff00'); $('[id$=txtbxssnoritin]').css('width', '24'); } else { $('[id$=txtbxssnoritin]').css('background-color', 'green'); $('[id$=txtbxssnoritin]').css('width', '144'); } }); but besides this, need restrict number of characters user enters textbox, according whether checkbox's state. how can that, preferably css but, if necessary, jquery? jsfiddle fir...

Is it possible to use Resource Template Manager in Azure with cloud services -

it looks list of services can deploy resource template manager azure limited. see examples vm, web sites, storage, sql, not cloud services. does know if can use cloud services (web roles, worker roles)? this has been mentioned on user voice forum resource manager here . it has been updated "planned" feature of june 25th. feel free add votes feature request!

Missing line in "Follow UDP Stream" in wireshark -

Image
i streaming raw udp packets (rf data) gnu radio octave (or other program). data consists of 390625 4 byte floats per second. 1562500 bytes per second. when gnu radio streams udp, there no header or sequence number in udp data, it's raw floats. because localhost localhost, able use large mtu. attached screenshot of wireshark after right clicking , doing "follow udp stream". there "blank" part of hex dump @ 0x6f38c8. don't understand means? (i know udp not provide reliable delivery , packets can dropped , arrive out of order @ moment). great! the blank part used barrier differentiate between 2 udp packets, solely convenience. if track down exact data in normal wireshark window you'll notice data before blank part belongs udp packet , data after blank part belongs subsequent udp packet. the hex numbers on left specify offset of first byte of line beginning of stream in direction (i.e. in half blank line, byte 0x08 has 0x6f38...

python - Flask-Dance and TokenExpiredError -

how code around error: oauthlib.oauth2.rfc6749.errors.tokenexpirederror i spent while trying try/except block no luck on this. errors seems happen when session stale, life of me can't figure out how refresh session. here's code causes that: @main.route('/', methods=['get', 'post']) def index(): if google.authorized: user_profile = json.loads(google.get("/userinfo/v2/me").content) new_user = user.load_by_id(user_profile['id']) if not new_user: user.create(user_profile) else: login_user(new_user) if current_user.is_authenticated: return render_template("index.html", menu=menu) return redirect(url_for('user.signin')) looks issue posted on @ singingwolfboy/flaskdance#35

logging - Stop Log from Outputting in py2neo -

how can stop py2neo spitting out each created relationship/node, following: (http://localhost:7474/db/data/' ref=u'relationship/13441' start=u'node/13446' end=u'node/3' type=u'in' properties={}>,) as encouraged this page , when set below line off java.util.logging.consolehandler.level=off i silence logging when call function creates relationship/node. however, if directly create (graph.create(...) in main, still see print console. if talking running graph.create python console value see return value method, not log entry. note logging setting refer server, not driver.

fpga - Any example useage of a BSCANE2 primitive in Xilinx 7 series? (using the JTAG port to configure user design) -

i've looked on info on bscane2 in http://www.xilinx.com/support/documentation/user_guides/ug470_7series_config.pdf (pg 169 7 series fpga configuration guide) , can't quite figure out how use based on descriptions. i want able use jtag port on kc705 board shift in configuration data our design. think (based on description there in user guide linked above) bscane2 need that... don't understand why of pins of bscane2 component seem have wrong direction (tdo input while of other jtag control sigs tck, reset, tdi outputs). had thought there implicit connection signals of jtag port of fpga instantiated bscane2 component, doesn't appear case based on port directions. suspect i'm missing information somewhere , while have read docs it's still not clear me how use bscane2 i'm trying do. any example usage of bscane2 component appreciated. note: description of bscane2 in user guide linked above says: the bscane2 primitive allows access between internal ...

Syntax for returning multi-dimensional array by reference in C++ -

i've been killing myself trying figure out syntax returning 2 dimensional array reference in c++, i've been getting weird errors. i've searched lot online, couldn't find syntax returning reference specifically. of please me? lot! some soul helped me out, never have guessed this: type (&scope::getarray())[x][y]

angularjs - Make UI Bootstrap accordion heading fully clickable area -

i have ui bootstrap accordion heading want clickable, not title default behavior. <accordion class="fda-accordion panel-group panel-group-square" close-others="oneatatime"> <accordion-group is-open="fdaclass1open" ng-show="fdarecallsclass1count"> <accordion-heading> <div class="panel-heading-blue"> <i class="fa fa-plus fa-fw" ng-class="{'fa-minus': fdaclass1open, 'fa-plus': !fdaclass1open}" style="margin-right:10px"></i> fda class 1 recalls ({{fdarecallsclass1count}}) </div> </accordion-heading> {{fdarecallsclass1content}} </accordion-group> </accordion> is there workaround this? the issue anchor that's handling toggle wrapped around header text rather div . style content of heading negativ...

Rules for counting with parentheses C# -

this question has answer here: c# simple divide problem 9 answers this mabey dumb question try count discount on price this: newallavaror.pris = system.convert.todouble( (1 - (clientkampanj.visakampanj(vara.produktnamn) / 100)) * vara.pris ).tostring(); it in reality (1-(20/100)*7.99), output 7.99 should 6,392..becuse orginal price 7.99... have tried move parentheses 1 then.. in wich order c# go thru parentheses, becuse should work right?? i'm pretty sure doing integer division here: (clientkampanj.visakampanj(vara.produktnamn) / 100) so if have 20/100, result in 0 instead of expected 0.2 reminder truncated. you need convert double, 1 of operands: (clientkampanj.visakampanj(vara.produktnamn) / 100.0) since @scott pointed out other variables of type decimal , need convert 1 of operands type instead: (clientkampanj.visakamp...

r - Installing Statnet -

installing statnet on mac 10.10.3 r 0.99.441. ld: warning: directory not found option '-l/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not found -lgfortran clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [latentnet.so] error 1 error: compilation failed package ‘latentnet’ * removing ‘/library/frameworks/r.framework/versions/3.2/resources/library/latentnet’ warning in install.packages : installation of package ‘latentnet’ had non-zero exit status error: dependency ‘latentnet’ not available package ‘statnet’ * removing ‘/library/frameworks/r.framework/versions/3.2/resources/library/statnet’ warning in install.packages : installation of package ‘statnet’ had non-zero exit status i tried updating xcode/command line tools. tried not installing dependencies. have been able install other packages, such ergm , sna. it looks install looking gcc folder , not finding it. whereis gcc reveals gcc in /usr/bin/gcc it looks in...

algorithm - Optimizing C code, Horner's polynomial evaluation -

i'm trying learn how optimize code (i'm learning c), , in 1 of books there's problem optimizing horner's method evaluation polynomials. i'm little lost on how approach problem. i'm not great @ recognizing needs optimizing. any advice on how make function run faster appreciated. thanks double polyh(double a[], double x, int degree) { long int i; double result = a[degree]; (i = degree-1; >= 0; i--) result = a[i] + x*result; return result; } you need profile code test whether proposed optimizations help. example, may case declaring i long int rather int slows function on machine, on other hand may make no difference on machine might make difference on others, etc. anyway, there's no reason declare i long int when degree int , changing won't hurt. (but still profile!) horner's rule supposedly optimal in terms of number of multiplies , adds required evaluate polynomial, don...

java - Store and Restore previous userinput texfield -

i have 2 textfields can input user , used calculation later (number only), lets inputx , inputy. , 2 radio button, rad1 , rad2. when user choose rad1, both textfiled input-able user , stored memory/variable when user input in it. when user choose rad2, only inputx available , inputy inputy.settext("inputx only") . if user choose rad1 back, want restore value user input inputy previously , not showing " inputx only ". so, question is: how get previous value userinput when user choose rad1 back, since its has been overridden rad2 inputy.settext("inputx only") ? please create full code example possible/alternative code, i'm new in java. note: im using netbeans v8.0.2 , create form using built in form builder/designer public class inputvalidator extends javax.swing.jframe { private static final string input_x_only = "inputx only"; private string temp = ""; public inputvalidator() { initcomponents(); j...

ruby on rails - Eager loading a custom join with an instance variable -

given system allows users invite other users events: class event has_many :invites end class user has_many :invites has_many :invited, inverse_of: :inviter, foreign_key: :inviter_id, class_name: 'invite' end class invite belongs_to :user belongs_to :event belongs_to :inviter, class_name: 'user' has_many :invited, -> (invite) { where(invites: { event_id: invite.event_id }) }, through: :user, class_name: 'invite' end i'm generating simple report shows invites event. i'm trying modify report include actions can done against invited sample event: <%- event.includes(:user).each |invite| -%> <%= invite.user.name %> <%- invite.invited.each |other| -%> <%= link_to invite_path(other), method: :destroy %> ... <% end %> <%- end -%> <%- end -%> this works fine has n+1 issue. attempting eager load custom association gives: deprecation warning: association scope 'inv...

asp.net mvc - In html attributes setting disabled = "disabled" not working -

@html.actionlink(" ", "edit", new { id = item.userid }, new { title = "user not editable" , @class = "edit_btn", disabled = "disabled"}) i want disable actionlink setting html attribute disabled ="disabled", not working. able class , title attributes actionlink not getting disabled. can help.. doing wrong. the disabled attribute doesn't work in anchor tags. mvc renders expect, disabled="disabled" , browsers ignore it . you need different, such not rendering anchor @ all, render text or in span .

java - Null pointer exception in array initialized to null -

this question has answer here: what nullpointerexception, , how fix it? 12 answers this following code. have make array null purpose, when initialize array components 1, shows null pointer exception. how handle this? public static void main(string[] args) { double[] a; a=null; if(a==null) for(int i=0;i<12;i++) a[i]=1; } you need create array object , assign array variable before trying use variable. otherwise creating definition of nullpointerexception/npe: trying use (dereference) reference variable refers null. // constant avoid "magic" numbers private static final int max_a = 12; // elsewhere in code if (a == null) { = new double[max_a]; // need this! (int = 0; < a.length; i++) { a[i] = 1.0; } }

javascript - Progressbar for a XMLHttpRequest file download -

firstly sorry if potential duplicate issue. i trying display file download status , display in dialog box using xmlhttprequest. far able achieve in displaying download status in dialog once file downloaded. file not created stored in browser memory. able see file downloaded in response of request. can please me how can show progress without overwriting file download behavior. you want tracking xmlhttprequest's progress event can use update dialog: xhr.addeventlistener("progress", function(event) { if (event.lengthcomputable) { var percentloaded = (event.loaded / event.total) * 100; console.log(percentloaded); } }); (one caveat: while supported in modern browsers not supported below ie10.)

c++ - Win32 window freezes after the first draw (directx 11) -

i have standard win32 window, draw on d2d1 . responsive , runs smoothly. problem follows: after window created, calls wm_paint once , gets "stuck" waiting user input ( ex. mouse move or click in window area ). receives input, runs without further problems. while doesn't render program nonfunctional, seems highly unprofessional and... ugly . oh, , mean "stuck" background processes still run without problems, loop runs intended - however, wm_paint isn't called reason. here current code: header file: #define program_fps 30 #define gwindow_style (ws_overlapped | ws_caption | ws_sysmenu | ws_minimizebox | ws_clipchildren | ws_clipsiblings) class application { public: application(); ~application(); // register window class , call methods instantiating drawing resources hresult initialize(); // process , dispatch messages void runmessageloop(); static inline void saferelease(iunknown * _x) { if(_x != null) ...

excel - Vlookup checking for multiple values and adding them together -

i have table called "data" has bunch of data dates , ids along 2 return values(we can call a , b ) , value number of hits( c ) i wrote script: =if(isnumber(vlookup(f$1&$a4&"1"&"0",data!$a:$f,6,false)+vlookup(f$1&$a4&"0"&"0",data!$a:$f,6,false)),vlookup(f$1&$a4&"1"&"0",data!$a:$f,6,false)+vlookup(f$1&$a4&"0"&"0",data!$a:$f,6,false),0) my current formula adds , returns approiate value if both a=1 , b=0 , a=0 , b=0 values found. if a=1 , b=0 found or a=0 , b=0 is found return 0. i want check data table , return values( c ) have either a=1 , b=0 or a=0 , b=0 specific date , id number. want add values together. how can edit formula this?

deployment - Capistrano mkdir: cannot create directory -

i'm trying use capistrano (for first time) deploy website. web hosting mediatemple. dir structure website looks this: domains/site.com/html/index.html it looks capistrano's default deployment tries create var/www directory place application inside. i'm getting error when trying run cap production deploy : mkdir: cannot create directory `/var/www': permission denied i assume don't have privileges create these folders, there way around instead of manually creating them? also, var/www structure recommended, or worth dumping application in domains/site.com ? this first experience capistrano, appreciated. in advance! in default capistrano deployment setup, there commented line looks like: # default deploy_to directory /var/www/my_app # set :deploy_to, '/var/www/my_app' you want uncomment set line , change path location want application deployed to.

c# - Bind Dictionary<string, double> entries to a XAML number textblock WPF -

in xaml file, have 3rd party (syncfusion) doubletextbox control: <syncfusion:doubletextbox x:name="personaheight" style="{staticresource sfdoubletb}" /> when doubletextbox loses focus, copies value dictionary have created (the xaml element , dictionary key have exact same name), in order save keys , values use on page. public static dictionary<string, double> globaldictionary = new dictionary<string, double>() { {"personaheight", 0}, {"personbheight", 0}, // on 100 keys & values } when doubletextbox loses focus (this has been set in styles): void sftextbox_lostfocus(object sender, routedeventargs e) { var tb1 = sender doubletextbox; if ((double) tb1.value != 0) { if (app.globaldictionary.containskey(tb1.name)) { app.globaldictionary[tb1.name] = (double) tb1.value; // replace value } ...

c++ - Eclipse / g++ not recognizing "-std=c++11" flag -

i running centos 6.6 x64 eclipse luna , g++ 4.7.2 (provided devtoolset-2 ). i'm using eclipse's built in automatic makefile generation. i've enabled g++ 4.7.2 using scl enable devtoolset-2 bash [me@dev ~]# g++ --version g++ (gcc) 4.7.2 20121015 (red hat 4.7.2-5) copyright (c) 2012 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. unfortunately, when compiling, eclipse throwing errors saying "-std=c++11" isn't valid option. i've set dialect under project properties >> c/c++ build >> settings >> dialect >> "other dialect flags" value "-std=c++11". invoking: gcc c++ compiler make: *** waiting unfinished jobs.... g++ -std=c++11 .... cc1plus: error: unrecognized command line option "-std=c++11" i've tried using "language standard" option "-std=c++0x", thr...

Running R and RStudio on Dropbox -

this question has answer here: run r dropbox 2 answers for collaborative project can install rstudio (and r itself) on shared dropbox folder, run script same location? if yes, there special procedure should employed in setting up? have both r , rstudio installed on pc. collaborator need have r installed on computer work? sounds there 2 separate aspects question: can share r & rstudio application/executables can share r scripts/project documents regarding 1, share application/executables, follow portable rstudio approach @hrbrmstr. that's going require providing correct versions collaborator's os. if working 1 person, may find easier have them download , install rstudio on own computer. if project requires installing custom libraries cran, make sure communicate collaborator, libraries you've installed won't installed them. re...

webrtc - Can Quickblox provide Javascript-based video chat on iOS? -

i can't use app on ios, has in-the-browser javascript, , has video chat. can support on quickblox? know webrtc not available on ios. sure used supported case before move webrtc? deprecated api offer this? know when can expect webrtc supported in browser on ios? webrtc javascript api should work on ios opera/chrome browsers, not in safari unfortunately

Save canvas image to sql database with php -

i'am sorry if question stupid , how can save canvas image database via php i've searched lot did not found working , useful , here code use popup print form <script> function print(){ var canvas1 = document.getelementbyid("testcanvas"); var ctx1 = canvas1.getcontext("2d"); var img = canvas1.todataurl("image/png"); img = encodeuricomponent(img); $.ajax({ url: 'upload.php', data: { data: img }, type: 'post', success: function(data) { console.log(data); alert("done"); } }); </script> <button onclick="print()">click me</button><br> upload.php <?php $data = $_post['data']; $server = "localhost"; $username = "root"; $password = ""; $database = "sports"; $bd = mysq...

html - Vertical alignment of a div using Semantic-UI -

i can't seem find anywhere in docs. is there way vertically center div on page using semantic-ui semantics :) here i'm trying do: <div class="ui centered grid"> <div class="eight column wide"> <div>i want centered vertically on page</div> </div> </div> http://semantic-ui.com/examples/grid.html use middle aligned class on grid

docusignapi - With the DocuSign API call CreateEnvelopeFromTemplates how do you match a recipient with the role in the template? -

my template has 1 role defined. i'm trying send envelope based on template , filling in name , e-mail 1 role user not have place own signature block. the problem adds second signer envelope. second signer got email asking them sign must manually place signature because signature block defined first signer. i started code here: https://www.docusign.com/p/apiguide/content/sending%20group/createenvelopefromtemplates.htm here code have. java code. // first template envelopetemplates templates = port.requesttemplates(accountid, false); string templateid = templates.getenvelopetemplatedefinition().get(0).gettemplateid(); envelopetemplate template = port.requesttemplate(templateid, false); // existing recipient template recipient recipient = template.getenvelope().getrecipients().getrecipient().get(0); recipient.setemail("asdf@example.com"); recipient.setusername("jo...

recursion - Handling negative integers in recursive factorial function in Java -

i have written recursive factorial function in java. program works fine, want function show message if integer input given negative , quit immediately rather calling recursively. how possible? the factorial operation defined non-negative integers. java way handle throw illegalargumentexception on negative input: public static int factorial (int n) { if (n < 0) { throw new illegalargumentexception ("n must non-negative"); } if (n == 0) { return 1; } return n * factorial (n - 1); }

php - Symfony 2 Catchable Fatal Error: Argument 1 passed to Sg\DatatablesBundle\Datatable\::__construct() must be an instance of -

i'm using stwe/datatablesbundle symfony 2 ( http://github.com/stwe/datatablesbundle ) (stable version v0.6.1) , getting following error: catchable fatal error: argument 1 passed sg\datatablesbundle\datatable\view\abstractdatatableview::__construct() must instance of symfony\bundle\twigbundle\twigengine, none given, called in g:\server\www\bongoapp\app\cache\dev\appdevdebugprojectcontainer.php on line 418 , defined i have tried following answer here , not working me. doing wrong? code below , in advance: generated datatable class: namespace bbd\bongoappbundle\datatables; use sg\datatablesbundle\datatable\view\abstractdatatableview; /** * class artistdatatable * * @package bbd\bongoappbundle\datatables */ class artistdatatable extends abstractdatatableview { /** * {@inheritdoc} */ public function builddatatableview() { $this->getfeatures() ->setserverside(true) ->setprocessing(true); ...

javascript - Issues disabling a button on IE -

i'm having issue disabling button on ie. the issue should simple fix... want button disabled while function running reason on ie button never disabled... i've tried 2 approached both of them work on chrome , ff can't work on ie... document.getelementbyid('printimage').setattribute('disabled', true); document.getelementbyid('printimage').disabled = true; additionally if go on developer tools on ie , manually set disabled attribute work have no idea what's going on. update ok issue wasn't on setting attribute.... issue this: first disable button, open new window using window.open, after random stuff , window.focus window.print() , lastly window.close() after re enable button reason ie enables on if new opened window still open... works fine in chrome waits new window close before enabling button again thanks can provide! the proper value disabled attribute disabled . try: document.getelementbyid('printimage'...

How to create a ASP.NET 5 project in Visual Studio 2013? -

i trying create asp.net 5 project in visual studio 2013. extensions need download make run in visual studio 2013. in project using nuget package manager console run this pm> install-package microsoft.aspnet.mvc -version 5.2.3 more information on nuget if talking mvc 5, if need asp.net 5 information , download available here

java - Return 2 integers in a int function -

i have 2 classes. in first class integers low , high needed. in second class want declare , change low , high . public class displaymessageactivity extends actionbaractivity { int low = 0; int high = 101; this works fine - after following function run through, integers didn't change. public int close (view v) { edittext low2 = (edittext) findviewbyid(r.id.edittext2); edittext high2 = (edittext) findviewbyid(r.id.edittext3); int low = integer.parseint(low2.gettext().tostring()); int high = integer.parseint(high2.gettext().tostring()); high ++; toast.maketext(getapplicationcontext(), "low: " + low +" high: "+high, toast.length_short).show(); if (low > high) { //you can ignore alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("false numbers"); builder.setmessage("you set lower number higher higher one."); builder.show(); } ...

javascript - Loading HTML Video With jQuery -

so trying to load different video based on screen size of device. here jquery: var v = new array(); v[0] = [ "header.webm", "header.ogv", "header.mp4" ]; v[1] = [ "mobhead.webm", "mobhead.ogv", "mobhead.mp4" ]; var src = $('#bgvid source'); if(window.innerwidth >= 642){ src.attr("src", v[0]); } if(window.innerwidth <= 641){ src.attr("src", v[1]); } here html: <video autoplay="" loop="" poster="" id="bgvid"> <source src="" type="video/webm"> <source src="" type="video/ogg"> <source src="" type="video/mp4"> </video> here browser output: <video autoplay="" loop="" poster="" id="bgvid"> <source src="header.webm,header.ogv,header.mp4" ...

ios - Haneke in Swift: Eagerly loading images -

is there way load image url , write directly disk cache (without presenting them uiimageview ), can emulate eager loading? problems emanate need present 100+ images 4mb each (can't resize them lower); decided download of them disk cache, displaying progress bar user, , presenting them after in disk cache. any solution uses hanake emulate eager loading do. could download , save in nscache like let cache = nscache() cache.setobject(image, forkey: theurlyoudownloadedfrom)

#linkedin LinkedIn API stopped functioning in Salesforce -

we had built widgets linkedin in salesforce (force.com) enterprise version environment using api has stopped working time. causing major inconveniences affected users. kindly share if similar issue has been noticed @ end , fix it. here steps performed till date: after achieving successful authentication using oauth 2.0,we using “people search” linkedin search functionality. response getting , when making request people search api: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <error> <status>403</status> <timestamp>1433254195523</timestamp> <request-id>py4ljundox</request-id> <error-code>0</error-code> <message>access people search denied.</message> </error> starting may 12, 2015 , linkedin has limited open apis. access groups requires apply , granted access information linkedin. the following endpoints available general use...

c# - Beacons in Windows Phone 8.1 - there are no possibilities? -

first of all, yes, have read other similar questions. secondly, developing app (wp 8.1 winrt), must use beacons. read lot it, , know, connection ble device not possible without pairing first. hope dies last, want ask possibilities have. possible pair devices in code (according articles have read - not, maybe know way)? or obtain nearby beacons id or name, or information them? posts have found outdated (from last year, maybe ms or released update/api?) search kind of solution, api or idea how avoid pairing problem. pairing manually won't work - 1. not sure if possible pair beacons, 2. many of them (beacons need) anyway communicate or obtain beacons. grateful option or idea while have not tried yet, there developer has built hci layer talk directly bluetooth dongles on pre-windows 10 machines. available here: winbeacon this work on desktop machines, , not mobile phones. if interested in mobile phones windows 8.x, not believe there solution. have spoken microsoft...

c# - Logging from more applications in one Graylog index -

i running dozens of applications , want them push logs 1 graylog server. have lot of console applications , lot of websites. website logs have data browseragent, url, etc. console applications have other kind of data. is idea log these applications 1 graylog index? each application has own 'applicationname' theoretically possible distinguish logs each other in search. use benefit of searching on 1 place information. i worried 2 things: does cause problems when index big because company applications logging 1 place is idea mix logs schema of data not identical (web logs vs. console logs) should set more instances of graylog or ok put stuff 1 place? recommendations? thx lot! ok tried put logs apps 1 index , looks good. mixing more application types seems not making problem. in couple months see if working on production.

html - Why is child elements margin being applied to other cells? -

i have strange problem. child elements in table cell margin , affecting every other cell. it's hard explain, check out jsfiddle: https://jsfiddle.net/5s9nab3h/ <style> .table { display: table; width: 100%; } .table > .cell { display: table-cell; border: 1px solid #f00; } .tallmargin { padding-top: 100px; } </style> <div class="table"> <div class="cell"> cell has no margin or padding. </div> <div class="cell"> <p class="tallmargin">this content has 100px margin on top.</p> </div> </div> edit: problem in .table > .cell needed have vertical-align: top since defaults middle . display: table-cell setting height of each column equal size. might want read tutorial on table-cell consistent height columns by adding display: table-cell property columns expand match he...

fpga - Verilog Serial to Parallel Conversion -

i having problem converting serial input external device, parallel input xilinx spartan 3e fpga. first module turns serial parallel, , second outputs first bit of po (parallel output) led. of right after checking on scope signal coming out of led following serial input , not retaining value of po[0] module spi_logic (c, si, po, notcs); input c,si,notcs; output reg [15:0] po; reg [4:0] cnt; @(posedge c or posedge notcs) begin if (notcs==1) begin cnt <= 4'b0000; end else if (cnt <= 5'd15) begin po[cnt] <= si; cnt <= cnt + 1'b1; end else begin cnt <= cnt; end end endmodule module spi( input clock, input notcs, input [15:0] po, output reg led, output reg sinusoidal, output reg [11:0] dac_hi, output reg [11:0] dac_lo, output reg [5:0] blank_time, output reg [5:0] blank_time_bcm ); @(posedge notcs) begin led<=po[0]; end endmodule after checking scope external device works correctly. when ...

Whats the difference between android themes (Theme, ThemeOverlay, Base.Theme etc) -

in android have lot of themes theme.appcompat.light , themeoverlay.appcompat.light , base.themeoverlay.appcompat.light , platform.themeoverlay.appcompat.light . what difference between them , 1 should use?

finding equidistant point in triangle with vertices a, b and c. language is c -

i know steps calculate circumcentre of triangle couldn't understand how implement in program. please help. vertices a(2, 4) b(10, 15) c(5, 8) program step 1. finding midpoint a, bc, ca. (x1+x2)/2 (y1+y2)/2 step 2. finding slopes ab, bc, ca m=(y1-y2)/(x2-x1) step 3. finding perpendicular bisectors slope -1/m step 4. finding equations. using midpoint , perpendicular bisectors slope (y-y1)=m(x-x1). step 5. solving , finding x , y. #include <stdio.h> #include <math.h> typedef struct point { double x, y; } point; #if 0 ax + = c ax + = c x = (c - by)/a = (c - by)/a ac - aby = ac - aby (ab - ab)y = ac - ac y = (ac - ac) / (ab - ab) x = (bc - bc) / (ab - ab) #endif point ans(double a, double b, double c, double a, double b, double c){ point ret = {fp_nan, fp_nan}; double d = a*b -a*b; if(d == 0) return ret; ret.x = (b*c - b*c) / d; ret.y = (a*c - a*c) / d; return ret; } #if 0 (x-ox)^2+(y-oy)^2=r^2 (xa-ox)^2+(ya-oy)^2=(xb-ox...

file - How to Store Android Pictures to Prevent User Deletion but Still Give User Access -

i'm working on first real android application, , have run use case problem cannot seem find best practice. application has main screen recyclerview has imageview part of view makes individual list items. clicking on item in recyclerview takes activity viewpager giving details selected item , allowing user swipe through details of items displayed in recyclerview. part of workflow of adding or editing item, user can take picture used generating thumbnail recyclerview , display in details fragment in viewpager. plan provide ability user share detail entry, including picture, on social media or email or google photos. dilema how picture should stored on user's device. can store public external storage, scanned media scanner , can accessed user copying computer or sharing. file file = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), albumname); however, user can delete pictures stored there poses problem generating thumbnails , display ...

sql server - Performance Issue in SSRS - Multiple Dataset -

i have 1 complex report fetches records multiple tables. i saw @ many places ssrs not allow multiple data tables returned single stored procedure, reason created 1 stored procedure , created 6 dataset report filtered shared dataset, when ran below query shows procedure executed 6 times , might causing performance issue. select top 100 *,itempath,parameters, timedataretrieval + timeprocessing + timerendering [total time], timedataretrieval, timeprocessing, timerendering, bytecount, [rowcount],source, additionalinfo executionlog3 itempath '%getservicecalls%' order timestart desc to rid of this, removed dataset filters , applied filter on tablix. after can see procedure called 1 time. not affect performance much. now, question coming me how can improve performance of ssrs report. note: query executes in 13 seconds of time , report takes 20 mins execute. please me resolve issue. regards, dhaval i found ssrs filters on large tables take fo...

sql server 2005 create temporary table using xml parameter -

i want create temporary table xml input parameter. xml: <offices> <group id="22807"> <office>185901</office> <office>185902</office> <office>185944</office> </group> </offices> this sql: declare @groupsofficeids xml set @groupsofficeids = '<offices><group id="22807"><office>185901</office><office>185902</office><office>185944</office></group></offices>' create table #groupofficeid (pk int primary key identity(1,1), idxml xml) insert #groupofficeid values (@groupsofficeids) select pk, group.ref.value('@id', 'int') groupid, group.ref.value('(office/text())[1]', 'varchar(20)') officeid #groupofficeid go cross apply go.idxml.nodes('/offices/group') group(ref) this returns 1 row: pk groupid officeid 1 22807 185901 i ...

rstudio - How to restrict Shiny fileInput to text files only? -

i want restrict file browser displaying types of file specify, e.g. .txt files only. relevant snippets of code found following: fileinput("in_file", "input file:", accept=c("txt/csv", "text/comma-separated-values,text/plain", ".csv") however, does't filter files showing in browser .txt , .csv. ideas? as far understand, that's right way it. if view app in rstudio viewer wouldn't anything, in browser should. i'm using chrome , ran code , did in fact show me txt , csv files. of course user can still choose view other files going little select box , choosing view files, have consciously choose that. default csv , txt files shown

php - Fatal error: Class 'CDbTestCase' not found -

i'm new in php , have testing app. i'm trying make unit testing error messages displayed. have many weeks ago , cannot fix it, please me!! the message says: fatal error: class 'cdbtestcase' not found. i read , follow many tutorials issue doesn't work. i'm using yii, eclipse ide , composer. i think problem in bootstrap.php don't use because i'm working composer, composer.json { "require-dev": { "yiisoft/yii": "1.1.*", "phpunit/phpunit": "4.6.*", "phpunit/phpunit-selenium": ">=1.2", "codeception/codeception":"*", "phpunit/dbunit": ">=1.2" }, "autoload": { "psr-0": {"": "vendor/autoload.php"}, "psr-4": {"": "/../framework/test/cdbtestcase.php"} } } the bootstrap file needed load y...

c++ - Exception thrown when locking boost::unique_lock which is already locked in other thread -

there global object boost::unique_lock. 1 thread locks it. when other thread tries lock exception "already owns mutex" thrown. why happening? expect thread blocked until other thread call unlock. boost::mutex mutex; boost::unique_lock<boost::mutex> lock(mutex); static void* scheduller(void* arg) { boost::this_thread::sleep(boost::posix_time::seconds(5)); lock.lock(); return 0; } static void* usb(void* arg) { lock.lock(); boost::this_thread::sleep(boost::posix_time::seconds(20)); return 0; } int bevent_test() { lock.unlock(); int = 0; boost::thread thread1(usb,&a); boost::thread thread2(scheduller,&a); boost::this_thread::sleep(boost::posix_time::seconds(100)); return 0; } in bevent_test function i'm doing unlock because unique lock locked in constructor. delays make sure scheduller thread starts after usb thread. when tries lock() exception thrown. why? your use of unique_lock wrong, i...