Posts

Showing posts from March, 2010

ios - How do I specify class name as variable in Swift? -

i want this: class dog: object { dynamic var name = "" dynamic var age = 0 } let results = realm.objects(dog) ...but specify object name variable. this doesn't work: let objectname = "dog" let results = realm.objects(objectname) neither this: let object = dog let results = realm.objects(object) ...or this: let object = dog() let results = realm.objects(object) ...or this: let object: dog let results = realm.objects(object) any ideas? you can reference type directly dog.self : let type = dog.self i don't have project realm, in theory should able like: let results = realm.objects(type)

SurveyMonkey API get_survey_details -

why get_survey_details response returning error msg? when running request via surveymonkey api get_survey_details method https://api.surveymonkey.net/v2/surveys/get_survey_details the response is: {"status":3,"errmsg":"survey requested 'xxxxxxx' has more 200 pages" } this custom app, using api key , token generated in api console. user has gold plan. the online guide api indicates limit (any plan level) of 1000 questions , 1000 pages. https://developer.surveymonkey.com/mashery/limits any appreciated the max page size limit used pagination. represents maximum number of resource items can returned page. example, can fetch maximum of 1000 surveys /v2/surveys/get_survey_list per call. i've updated docs provide bit more clarity.

c# - BulkCopy.WriteToServer error for Azure Table (clustered index related) -

in asp.net page i'm trying to.... create temp datatable , fill data (this works) do bulkcopy columnmappings on columns destination table do bulkcopy.writetoserver temp datatable destination table the destination table in azure db. everything works until try writetoserver, @ time error: "tables without clustered index not supported in version of sql server. please create clustered index , try again." my temp table , azure destination table have pk. suggestions? your table might have pk not have clustered index. make pk clustered.

node.js - Restify set method like in Express -

in express 4.0, after declaring server following set server-wide variable... var app = express(); app.set('foo', 'bar'); i don't see method in restify's documentation, i'm declaring object inside server holds variables. is correct? there better way in restify? it sounds work, why not create module hold variables? create file named vars.js somewhere appropriate , make this: module.exports = { my_var: 2112, other_var: 'signals' } then wherever need access variable var all_vars = require('./path/to/var.js'); and you'll have them.

Vim- need timer for autosave -

in vim, have autosave file with: augroup write_it autocmd! autocmd insertleave * write autocmd textchanged * write augroup end it works good. need place wait in there when rapidly delete characters in command mode textchanged . ideas how? nightmare livereload , gulp tasks watchers front end development. i tried exec 'sleep 2' vim async , it's useless. check cursorhold , cursorholdi events. triggered after period of inactivity according 'updatetime' option. can use them. there autowrite . anyway, can go complicated, in opinion best alternative reuse code thought :-) • autosave plugin: https://github.com/907th/vim-auto-save.git

scala - Where should the META-INF/services be in sbt -

where should meta-inf directory in order sbt pick custom configurations. had issue when trying use serviceloader , trying create custom services in meta-inf/services the meta-inf folder automatically picked sbt if put folder in src/main/resources/

performance - DebugDiag giving no stacktrace for .NET 4.6 MVC5 application -

Image
i'm trying debug cpu issues caused .net 4.6 mvc5 application analyzing dump created debugdiag 2.1.0.7. i'm finding after loading custom .pdb symbols i'm still not getting stacktrack information in generated report: the error report displays is type: microsoft.diagnostics.runtime.clrdiagnosticsexception message: runtime not initialized , contains no data. i note debugdiag version 1.2 didn't support .net 4.0+. debugdiag 2.1 perhaps not support .net 4.6?

c# - How to set Drop down List containing Months to previous month -

i have drop down list contains months. have set previous month. getting null reference exception trying in line dropdownlistbm.items.findbyvalue(datetime.now.addmonths(-1).tostring()).selected = true; given below code.i thinking has if january current month. datetime month = convert.todatetime("1/1/2000"); (int = 0; < 12; i++) { datetime nextmont = month.addmonths(i); listitem list = new listitem(); list.text = nextmont.tostring("mmmm"); list.value = nextmont.month.tostring(); dropdownlistbm.items.add(list); } dropdownlistbm.items.findbyvalue(datetime.now.addmonths(-1).tostring()).selected = true; this: dropdownlistbm.items.findbyvalue(datetime.now.addmonths(-1).tostring()).selected = true; should be: dropdownlistbm.items.findbyvalue(datetime.now.addmonths(-1).month.tostring()).selected = true;

Javascript make dynamic links but ignore existing links -

im using dynamically make links in webpage: var linkword = function(obj){ for(i in obj){ var x = document.body.innerhtml; var linkstart = '<a href="'+obj[i]+'">'; var linkend = '</a>'; var reg = new regexp("\\b(" + + ")\\b","ig"); x = x.replace(reg, linkstart + + linkend); document.body.innerhtml = x; } console.log(obj); } linkword({ 'the':'http://www.example.com', 'vokalia':'http://icant.co.uk', 'brent':'http://google.com', }); this creates links in page matches keyword, overwrites existing hrefs if matches. how can improve ignore existing links? no jquery please. https://jsfiddle.net/o43lxmtr/ you can fix appending negated sets reg expression in order discard words prefixed > , suffixed < . edit: better approach might build negative lookahead in order disallow text contained inside tags

Spring MVC ExceptionHandler and the controller context -

this should common problem solution haven't managed find anywhere. i defining global exception handler using @controlleradvice, define new modelandview , redirect error page. works great except fact want add link go original page of course vary depending on error originated. what want store kind of context information controller generated error, instance if it's mycontroller can access value via mycontroller.exception_redirect_url , generate appropriate link. i find lack of context information in exception handler rather limiting. make custom exception class , pass context in exeption. class myexception extends exception { private mycontroller c; myexception( string msg, mycontroller c ) {...} ... } i feel there's better way, revolving around request context object. want.

How to use composer, artisan ...(Laravel) php commands manually -

i have 1 problem have no ssh access server, cannot use php artisan, composer , other commands. can quess nothing other modifying files or copying php src files specific directories. in order understand process better , because of no access via ssh server looking tutroial, manual or article how can perform commands manually. example need execute php artisan vendor:publish --provider="tymon\jwtauth\providers\jwtauthserviceprovider" what should in case, grate find document describes should manually same result. laravel provides handy facade artisan commands. just use artisan::call('your-command') need. example: route::get('artisan-command/{command}', function($command) { artisan::call($command); }); your url looks this: http://yourhost.com/artisan-command/db:seed more specific use-case: route::get('vendor-publish/{provider}', function($provider) { artisan::call('vendor:publish', ['provider' =>

jsp - Adding a Class to <%=getCurrentAttribute -

i'd add class no in front of it. there way so? <%=getcurrentattribute('item', 'custitem_refurbmsg')%> i'm thinking here, <%=getcurrentattribute('item', 'custitem_refurbmsg') class='classname' %> but doesn't work. idea's how write correctly?

assembly - Why does conditional branching in ASM 6502 have limit of 128 bytes -

what hardware reasons why routine must within 128 or -127 bytes of issued branching instruction? the hardware reasons two-fold: first, 6502 8-bit processor, means single byte can hold unsigned values 0 255, or if bit 7 used indicate sign (two's complement) -128 +127. second, chuck peddle designed branch instruction two-byte operation - first byte represents branch condition (opcode) , second signed offset value (operand) added program counter [pc] if condition true. as apparent, use of single signed offset byte branch operand means maximum 'jump' range brx instruction can accommodate either 128 locations current pc, or 127 locations ahead. this limitation can cumbersome overcome in cases need branch (as opposed jump , see below) further range allows; however, practice , experience in 6502 assembly programming techniques , deep understanding of flow , organisation of code permit artful design avoids need branch on larger distances. the cpu arch

javascript - Initiating AngularJS -

i'm having issue getting started angularjs. have downloaded minified file , have living in js directory along app.js file. works until try calling app.js file. breaks. here's code. index.html <head> <meta charset=utf-8 /> <meta name="description" content="description"> <title>my app</title> <script src="js/angular.min.js"></script> <script src="js/app.js"></script> </head> <body ng-app> <h1>intro data binding</h1> <div ng-controller="dbcontroller"> <input type="text" ng-model="username" /> <p>hello, {{username}}.</p> </div> </body> app.js function dbcontroller($scope) { $scope.username; } on body tag ng-app="app" then, in .js file... angular.module('app', []) .controller("dbcontroller", fu

java - Add bitmap to sql database errors? -

so in android app user can take picture hits done , image decompiled byte array , added sql database. getting crash when try image sql , error. here logcat: 10-02 20:30:56.543 6259-6259/com.nick.mowen.receiptmanager e/cursorwindow: failed read row 0, column 0 cursorwindow has 0 rows, 2 columns. 10-02 20:30:56.553 6259-6259/com.nick.mowen.receiptmanager e/androidruntime: fatal exception: main 10-02 20:30:56.553 6259-6259/com.nick.mowen.receiptmanager e/androidruntime: process: com.nick.mowen.receiptmanager, pid: 6259 10-02 20:30:56.553 6259-6259/com.nick.mowen.receiptmanager e/androidruntime: java.lang.illegalstateexception: couldn't read row 0, col 0 cursorwindow. make sure cursor initialized correctly before accessing data it. 10-02 20:30:56.553 6259-6259/com.nick.mowen.receiptmanager e/androidruntime: @ android.database.cursorwindow.nativegetlong(native method) 10-02 20:30:56.553 6259-6259/com.nick.mowen.receiptmanager e/androidruntime: @ android.database.cursorw

IPython notebook: define a dummy cell magic that simply runs the cell as usual -

how can define simple cell magic executes cell if %%mymagic wasn't there? the context using wonderful ipython parallel framework. in places, use defined %%px magic. we'd run same notebook without cluster (local only). in case, %%px isn't defined , have comment out. instead, in case i'd redefine %%px that: %%px : no-op. %%px --local : runs cell, no other side-effect. alternatively, %%px (with --local or not) run cell, if that's simpler. another approach create ipyparallel client fake one, i.e. 0 nodes (but still operate correctly, e.g. regard %%px --local ). question. things i've tried : %alias_magic px time (after all, don't care if cell timed). unfortunately, %%time doesn't take arguments , chokes on --local . define own "no-op" magic: if use_client: pass else: # temporarily define %%px cell magic ipython import get_ipython def px(line, cell): """do nothing""&

Parsing a Text File with Lines of Different Sizes in C -

i have program reads lines text file , puts in list. words on each line categorized command (add or remove element), position, product , price. in order. lines not have price or product, command , position. parse lines correctly first few lines, if text file comes short of few words, example, doesn't tell price or product command , postion, segfault. there way me check if line text file shorter can parse elements there? the text file looks this: add 0 staples 2 add 1 paper 4 add 1 tape 3 add 3 paperclips 2 remove 2 remove 0 the function parse follows. while (fgets (buff, 140, test)) { token = strtok(buff, " "); instructions = malloc(sizeof(char)*strlen(token)+1); strcpy(instructions, token); token = strtok(null, " "); listposition = atoi(token); token = strtok(null, " "); product = malloc(sizeof(char)*strlen(token)+1); strcpy(product,token); token = strtok(null, " "); price = atoi(token);

class - Creating static variables in classes (C++) -

so i'm noob programming, , unsure why unable make static variable in class? got question class , i'm not sure if i'm going right way. question is: create class static member item whenever new object created, total number of objects of class can reported. this code far: #include <iostream> class objectcount { public: objectcount(); void reportobjectno(); private: static int objectno = 0; }; objectcount::objectcount() { objectno++; } void objectcount::reportobjectno() { std::cout << "number of object created class objectcount: " << objectno << std::endl; } int main() { objectcount firstobject; firstobject.reportobjectno(); objectcount secondobject; secondobject.reportobjectno(); objectcount thirdobject; thirdobject.reportobjectno(); return 0; } and error is: iso c++ forbids in-class initialization of non-const static member 'objectno' line 9 i sincerely apologize i

ios - Loading PHAsset data FAST. -

i using requestimageforasset load assets, described in apple dev documentation. it works , all, find very slow when comes large assets, such videos of several hundreds of megabytes. my goal load asset, copy chunk of data, , send chunk server. i load chunks because of obvious reasons, ram limitation. i have couple of questions in mind this: how can copy chunks of large video assets fast? can direct , fast access asset data without calling requestimageforasset ? should maintain requestimageforasset open until send data , leave it's completion block? so, approach should take , can find info this?

android - How to increase streets name size/readability? -

i'm rendering map on osmdroid using following code: the problem i'm running app on gs6 edge, , it's impossible read street names: http://img.ctrlv.in/img/15/10/03/560f4427e54c9.png is possible increase street name size or increase zoom? (it's set 100) public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { getactivity().settitle(fragment_name); // inflate layout fragment view view = inflater.inflate(r.layout.fragment_map_view, container, false); mmapview = (mapview) view.findviewbyid(r.id.mapview); mmapview.settilesource(tilesourcefactory.default_tile_source); mmapview.setmultitouchcontrols(true); mmapcontroller = (mapcontroller) mmapview.getcontroller(); mmapcontroller.setzoom(100); geopoint gpt = new geopoint(-23.5784,-46.4078); mmapcontroller.setcenter(gpt); return view; you're using mapnik (aka osm) map tiles, rastered graphics

java - How to use Integrator service in Hibernate 5 for adding annotated classes -

this reference jpa 2.0: adding entity classes persistenceunit *from different jar* automatically , unable call hibernate/querydsl maven subproject it seems hibernate 4 had great way dynamically load entity classes using org.hibernate.integrator.spi.integrator service. now when using hibernate 5, integrator interface's integrate method gives me public void integrate(metadata metadata, sessionfactoryimplementor sessionfactory, sessionfactoryserviceregistry serviceregistry) { } where metadata of type org.hibernate.boot.metadata i unable call addannotatedclass(), neither able obtain original configuration object there in hibernate 4. how around this? i using maven , jetty. i not using spring (so please not provide spring based solution) this related wrestling on weekend in getting caught on hibernate 5. can read planned changes related configuration class in latest javadoc hibernate 4 . new place getting info on loaded entity classes including a

Python telnetlib client doesn't appear to be opening telnet connection to server -

Image
i trying open telnet connection, write 1 string, print telnet server in python. assume missing obvious because documentation seems pretty self-explanatory , doing think exact same thing in terminal works fine. here python code: import telnetlib telnet = telnetlib.telnet() telnet.open('192.168.1.128', 9801, 10) telnet.write("system_cal") print(telnet.read_all()) this times out after 10 seconds / doesn't connect server assume. here output: traceback (most recent call last): file "/volumes/work/scripting/telnet test/main.py", line 9, in <module> print(telnet.read_all()) file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/telnetlib.py", line 385, in read_all self.fill_rawq() file "/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/telnetlib.py", line 576, in fill_rawq buf = self.sock.recv(50) socket.timeout: timed out in image below connect same server in

ios - sublayer with non-finite position [inf inf] -

i using third cocoapods library written in objective-c take screenshot of uitextview. ok ios 8, after change syntax ios 9 , swift 2, throws error: terminating app due uncaught exception 'calayerinvalidgeometry', reason: 'sublayer non-finite position [inf inf]' here code library: - (uiimage *)screenshotforcroppingrect:(cgrect)croppingrect { uigraphicsbeginimagecontextwithoptions(croppingrect.size, no, [uiscreen mainscreen].scale); // create graphics context , translate view want crop // in grabbing (0,0), origin point represents actual // cropping origin desired: cgcontextref context = uigraphicsgetcurrentcontext(); if (context == null) return nil; nslog(@"hiii :%f" , croppingrect.size.width); cgcontexttranslatectm(context, -croppingrect.origin.x, -croppingrect.origin.y); [self layoutifneeded]; [self.layer renderincontext:context]; uiimage *screenshotimage = uigraphicsgetimagefromcurrentimagecontext(

laravel 5 - FileNotFoundException in File.php line 41 -

Image
in laravel making application uploads file , user can download same file. but each time click download error. the view code: <h5><a href="/download/{{$filesharing->filename}}/{{$filesharing->filetype}}">download</a></h5> the route code: route::get('/download/{filename}/{filetype}', 'filesharingscontroller@download'); the controller code: public function download($filename, $filetype){ $downloadpath = public_path(). '/assests/' . $filename ; $headers = array( 'content-type: application/octat-stream', 'content-type: application/pdf' ); return response::download($downloadpath, $filename . '.' . $filetype, $headers); } please not when upload file remove extension. example: if upload 'sample.pdf' saved 'sample' . i have no clue wrong path in error correct path. , file exists in path. plz help the folder structure: and code used

What is ESB ? What it Does ? Where it runs? -

can elaborately explain esb ? new it. apart integrating applications, need know esb runs ? types of services can integrated. in advance. an enterprise service bus (esb) software architecture concept enables communication among various applications. instead of having make each of applications communicate directly each other in various formats, each application communicates esb, handles transforming , routing messages appropriate destinations. an esb provides fundamental services through event-driven , standards-based messaging engine (the bus). esb, integration architects can exploit value of messaging without writing code. developers typically implement esb using technologies found in category of middleware infrastructure products, based on recognized standards. service-oriented architecture (soa), esb collection of enterprise architecture design patterns implemented directly many enterprise software products. moreover, wso2 esb fast, light-weight, , versatile enterpri

indexoutofboundsexception - android:array index out of bound exception -

import android.app.activity; import android.app.fragment; import android.app.fragmentmanager; import android.content.res.configuration; import android.content.res.typedarray; import android.os.bundle; import android.support.v4.widget.drawerlayout; import android.support.v4.app.actionbardrawertoggle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.listview; import java.util.arraylist; public class mainactivity extends activity { private drawerlayout drawerlayout; private listview lvslidingmenu; private actionbardrawertoggle drawertoggle; // navigation drawer titles private charsequence drawertitle; private charsequence apptitle; // sliding menu items private string[] titles; private typedarray icons; private arraylist slidingmenuitems; private slidingmenuadapter adapter; @override protected void oncreate(bundle savedi

android - Simple intent crashes app -

new android. i'm trying create simple intent in onclicklistener open new page. however, app crashing when click button. i'm not sure wrong. here's listener buttoncheat.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent cheatview = new intent(getapplicationcontext(),cheatactivity.class); startactivity(cheatview); } here's have declared activities in manifest file <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".quizactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" />

python - How to format a date in a Pandas dataframe column with a certain date format such as YYYY-MMM-DD -

i able convert date value pandas datetime object, not able specify format of date without there being error. the 2 formats want use yyyy-mmm-dd format='%y%b%d' , yyyy-mm-dd format='%y%m%d' however when try , use following code, error: def convert_date(x): x = x.strip() x = pd.to_datetime(x,format='%y%b%d') return x you can try: d1 = ' 2015sep03 ' d2 = ' 2015-sep-03 ' d3 = ' 20150903' d4 = ' 2015-09-03' print pd.to_datetime(d1.strip(),format='%y%b%d') print pd.to_datetime(d2.strip(),format='%y-%b-%d') print pd.to_datetime(d2.strip()) print pd.to_datetime(d3.strip(),format='%y%m%d') print pd.to_datetime(d4.strip(),format='%y-%m-%d') print pd.to_datetime(d4.strip()) 2015-09-03 00:00:00 2015-09-03 00:00:00 2015-09-03 00:00:00 2015-09-03 00:00:00 2015-09-03 00:00:00 2015-09-03 00:00:00

powershell - Why does Add-Member think every possible property already exists (on a Microsoft.ActiveDirectory.Management.ADUser object)? -

so, helping out in question on serverfault , ran odd behaviour. if object of microsoft.activedirectory.management.aduser type, such through get-aduser , whenever try add noteproperty using add-member , following situation: ps c:\users\someuser> $u = get-aduser someuser ps c:\users\someuser> $u | add-member ldskfjlkdsfj dfklsjdflkdsjf add-member : cannot add member name "ldskfjlkdsfj" because member name exists. overwrite member anyway, add force parameter command. @ line:1 char:6 + $u | add-member ldskfjlkdsfj dfklsjdflkdsjf + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (cn=someuser,...example,dc=com:psobject) [add-member], invalidoperationexception + fullyqualifiederrorid : memberalreadyexists,microsoft.powershell.commands.addmembercommand using -force parameter allow me "overwrite" bogus property, object makes act has every property? trying access property (even 1 not added) returns nothing,

c# - Resharper/Nunit AssertionException was unhandled by user code -

i trying set unit testing in solution visual studio enterprise 2015 , resharper ultimate 2015.2. i created new unit test project in solution , used nuget install nunit 2.6.4. debugging unit test through resharper throws assertionexception. expected catch exception , report it. for example: [testfixture] class asserttest { [test] public void istrue() { assert.true(false); } } is there additional configuration needs done integrate resharper , nunit? perhaps need "unit test session" resharper. get it ctrl+alt+r. there can right click , debug unit tests on second reading of question wonder if scenario you're describing isn't expected? in test want assert true. if is, jolly-good -> continue. if isn't, you'd wanna know, hence assertionexception. my point is, tests should tell if not expected. , assert.true(false) doing that. if wanna log, surround assertions try-catch , log exception , throw it. should ha

javascript - How to overlay a popup message on top of an ionic navigation bar - ion-nav-bar -

i trying popup message appear @ top of screen on top of navigation bar (ion-nav-bar). can appear below. the css div using message is: .notification-message { position: fixed; top: 0px; height: 60px; padding-top:10px; width: 100%; min-width: 100%; color: white; background-color: #656565; text-align: center; vertical-align: middle; } the html page message div in file watchlist.html: <ion-view view-title="cues - watch list"> <ion-content> <div ng-hide="notificationmessage" class="notification-message">{{messagecontents}}</div> <ion-list> <ion-item ng-repeat="watchlistitem in watchlist" href="#/app/trailer/{{watchlistitem.id}}"> <div class="watchlist-movie-thumb"> <img class="movie-thumb-image" src="{{watchlistitem.picture}}"> </div> <div cla

c++ - How to initialize a dynamic array of pointers to an object? -

class leg { public: leg (const char* const s , const char* const e , const double d) : startcity (s), endcity (e), distance (d) {} friend void outputleg( ostream& , const leg& ) ; private: const char* const startcity ; const char* const endcity ; const double distance; }; class route { public: /* include 2 public constructors -- (1) 1 create simple route consisting of 1 leg, first constructor's parameter should const reference leg object.*/ route ( const leg& ) : arrayholder( new const leg* [1] ), arraysize( 1 ), r_distance( leg.distance ) {} //(2) create new route adding leg end of existing route. private: const leg** const arrayholder;//save dynamically-sized array of leg*s const leg** const. const int arraysize;//save size of leg* array const int . const double r_distance;//store distance of route const double, computed sum of distances of legs. }; i use clarification on doing in first constructor. how correctly save pointer

mysql - Find not common users in sql -

i have 5 tables. want specific users in table 1 not in table2, table3, table4 , table5. can please me :) table1(userid,discount) table2(userid,discount) table3(userid,discount) table4(userid,discount) table5(userid,discount) the following query: select userid table1 t1 not exists ( select 1 ( select userid table2 union select userid table3 union select userid table4 union select userid table5) t2 t1.userid = t2.userid) returns users of table1 don't exist in of other tables. demo here if want, say, users of table2 don't exist in of other tables, can modify above query return users table2 , perform union between these 2 queries: select userid table1 t1 not exists ( select 1 ( select userid table2 union select userid table3 union select userid table4 union select userid table5) t2 t1.userid = t2.userid) union select userid table2 t1 not exists

Why use an ArrayList as a constructor parameter in Java (BlueJ)? -

i'm trying complete assignment in bluej uni , i've hit snag @ first hurdle. in assignment, given class, names of constructor, methods, , parameters of class. we're not allowed change these because assignments partially marked test unit (or effect). one of constructors class given as public class playlist { public playlist(string name, arraylist<track> tracks) { } and have (partially) completed as public class playlist { private string listname; private arraylist<track> listtracks = new arraylist<track>(); /** * constructs playlist title , arraylist of tracks * * @param name name of playlist * @param tracks arraylist of tracks in playlist */ public playlist(string name, arraylist<track> tracks) { listname = name; //i don't know tracks parameter yet } okay, so, know question ( how enter parameters arraylist in bluej? ) have create instance of arraylist in order pass parame

node.js - Router.use() requires middleware function but got a Object at Function.use -

code contact.js : var express = require('express'); var router = express.router(); var nodemailer= require('nodemailer'); var dateformat = require('dateformat'); var = new date(); // basic usage dateformat(now, "dddd, mmmm ds, yyyy, h:mm:ss tt"); /* home page. */ router.get('/', function(req, res, next) { res.render('contact', { title: 'contact' }); }); router.post('/send', function(req, res, next) { verifyrecaptcha(req.body["g-recaptcha-response"], function(success) { if (success) { res.end("success!"); // todo: registration using params in req.body var transporter = nodemailer.createtransport({ service: 'gmail', auth: { user : 'email@gmail.com',

c++ - Why my camera matrix is an identity matrix after calibration -

after calibrating camera using sample data in opencv , camera matrix becomes identity matrix. here code: std::vector<cv::point3f> t_3d; t_3d.push_back(cv::point3f(50, 100, 0)); t_3d.push_back(cv::point3f(375, 100, 0)); t_3d.push_back(cv::point3f(50, 1600, 0)); t_3d.push_back(cv::point3f(750, 1600, 0)); object_points.push_back(t_3d); std::vector<cv::point2f> t_2d; t_2d.push_back(cv::point2f(2.27556, 98.9867)); t_2d.push_back(cv::point2f(631.467, 58.0267)); t_2d.push_back(cv::point2f(207.076, 1020.59)); t_2d.push_back(cv::point2f(1061.55, 969.387)); image_points.push_back(t_2d); cv::calibratecamera(object_points, image_points, cv::size(1440, 900), cam_mat, dist_coeffs, rvecs, tvecs, cv_calib_use_intrinsic_guess); is behaviour normal? according docs , need initialize camera matrix @ least partially beforehand. from docs: if cv_calib_use_intrinsic_guess and/or cv_calib_fix_aspect_ratio specified, or of fx, fy, cx, cy must initializ

node.js - Getting dynamic routing input from HTML -

i using ejs templating language . <main class="content"> <% documents.foreach(function(documentobject) { %> <h1><a href="/showprofile/:username"><%= documentobject.username %></a> solved </h1> <h2><%= documentobject.problem_id %>. <%= documentobject._statement %> in <%= documentobject.time %> seconds on <%= documentobject.date_added %> . </h2> <% }) %> </main> i using dynamic route /showprofile/:username redirection . need make hyperlink in such way such value of documentobject.username gets passed parameter :username . how can ? you use ejs function render username in href attribute instead of :username : <h1><a href="/showprofile/<%= documentobject.username %>"><%= documentobject.username %></a> solved </h1>

javascript - Displaying lat lng wherever user clicks -

i want display latitude , longitude location user clicks on map wherever wants (i'm not using marker event), still shows. here code: var mycenter=new google.maps.latlng(51.508742,-0.120850); function initialize() { var mapprop = { center:mycenter, zoom:5, maptypeid:google.maps.maptypeid.roadmap }; var map=new google.maps.map(document.getelementbyid("googlemap"),mapprop); var marker=new google.maps.marker({ position:mycenter, }); marker.setmap(map); var infowindow = new google.maps.infowindow(); google.maps.event.addlistener(map, 'click', function(event) { infowindow.setcontent(event.latlng.lat()+","+event.latlng.lng()); infowindow.open(map,marker); }); } google.maps.event.adddomlistener(window, 'load', initialize); can help? update position -property of marker in click -handler: google.maps.event.addlistener(map, 'click

ssl - How to config ssl_trusted_certificate of Let’s Encrypt? -

i use mozilla ssl configuration generator ( https://mozilla.github.io/server-side-tls/ssl-config-generator/ ) generate nginx configuration file. there item in configuration file, this: ssl_trusted_certificate /path/to/root_ca_cert_plus_intermediates; i use certificate of let’s encrypt,how generate ssl_trusted_certificate ? this needed when have client certificate verification. syntax: ssl_trusted_certificate file; default: — context: http, server directive appeared in version 1.3.7. specifies file trusted ca certificates in pem format used verify client certificates , ocsp responses if ssl_stapling enabled. in contrast certificate set ssl_client_certificate, list of these certificates not sent clients. i believe not need you, since looking host https site. need comment directive , good.

c# - How do i implement drag delta on grid when grid column*row (4*5) staying on canvas in wpf -

Image
i have created usercontrol below.please me. please see below code xaml code : <border cliptobounds="true" borderthickness="2" borderbrush="deeppink" width="200" height="150" x:name="tempmaxentityborder"> <canvas x:name="tempmaxentitycanvas" background="lightpink" focusable="true" allowdrop="true" tag="matrixentitycanvas" horizontalalignment="stretch" verticalalignment="stretch" > <grid x:name="gridlayout" verticalalignment="stretch" horizontalalignment="stretch" > <grid.rowdefinitions > <rowdefinition height="auto" ></rowdefinition> <rowdefinition height="auto"></rowdefinition> <rowdefinition height="auto"></rowdefinition> </grid.rowdefinitions&

c - About some settings of strtok() -

this warning getting: passing argument 1 of ‘strtok’ discards ‘const’ qualifier pointer target type [enabled default] i wanted disable default operation can me this? thank you! strtok works in-place: needs tokenize string passed it. of course, force non-const cast violate contract. if caller expects re-use passed string after operation? it's no-go. so if have constant string, have make copy before using it, instance using strdup char *copy = strdup(my_const_char); toks = strtok(copy," ",null); ... in end, have tokens in separate pointers, memory allocated , held copy . once don't need tokens anymore, free ing copy need clean up. note generic answer const qualifier question is: passing argument 1 discards qualifiers pointer target type