Posts

Showing posts from 2015

ASP.NET session vs session state and cookies vs cookie less -

please me whether understanding right. asp.net sessions stored on web server , no cookies whatsoever used this. asp.net if configured use session webconfig->session state: can configure either stateconnection or sqlconnection. asp.net if configured use session state (either stateconnection or sqlconnection) when user uses sessions in code cookies on client machine used unless specify in webconfig cookieless=true if use <sessionstate cookieless="true" /> default stateconnection set localhost when talking session in many dynamic web sites want store user data between http requests (because http stateless , can't otherwise associate request other request), don't want data readable / editable @ client side because don't want client play around data without passing through (server side) code. the solution store data server side, give "id", , let client know (and pass @ every http request) id. there go, sessions implemented. or

Swift - UITableView scroll event -

i wondering how detect if uitableview scrolled (up or down). want hide keyboard when uitableview scrolled self.view.endediting(true) . thanks in advance you can add uiscrollviewdelegate . after can implement scrollviewdidscroll method.

python - Indent Error with my battleship.py script -

i'm trying create simple 2 player game classic battleship. hence i'm beginning learn python , i'm keeping simple. have created 5x5 grid , want players (2) able place 1 ship 1x1 anywhere on board. take turns guessing other person placed ship. when compiled code got indent error on line 61 "else: " . i'm aware "h" , "m" hit , miss overlap since i'm outputting same playing board. i guess need while loops in code. import sys #////////////////////////////setting board//////////////////////////////////// board = [] x in range(5): board.append(["o"] * 5) def print_board(board): row in board: print " ".join(row) #///////////////////////////getting input////////////////////////////////////////// def user_row(): get_row = raw_input("enter ship row between 1 , 5") #not shure if best way of checking input int if int(get_row) == false: print "you must enter integer

c++ - Calculate the function F(n) with recursion -

read topic not know saying: function f (n) determined on non-negative integers follows: f (0) = 1; f (1) = 1; f (2n) = f (n); f (2n + 1) = f (n) + f (n + 1) calculated f (n) recursion. , code: #include<iostream.h> double tinh_f(int n) { if(n == 0) { return 0; } if(n == 1) { return 1; } return (f(n+1) - f(2*n+1)); } this incorrect. recursive function calls itself , includes stopping condition: #include<iostream.h> double tinh_f(int n) { if(n == 0) { return 0; } if(n == 1) { return 1; } // note function name change return (tinh_f(n+1) - tinh_f(2*n+1)); } what should function if integer passed in negative? recursion still work? or should throw exception indicate callers contract broken?

javascript - Angular looping multi dimensional json object not working -

i'm practicing angular , thought cool make shopping cart, have downloaded pre-made site template displays items in categories way layed out pretty like <div class="row"> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </div> so every row in category grid div containing un ordered list of 3 items here angular code: <div ng-app="categoryloader" ng-controller="catloader"> <div ng-repeat="row in items"> <ul> <li class="new" ng-repeat="item in row"> <div class="catthum"><img src="http://cart.asccio.net/images/oxo---homepage_39.jpg" alt="" /><div class="new"></div></div> <div class="catdetail"> <h4><a href="#">{{item.name}}</a></h4> <p

javascript - C3js - Uncaught TypeError: Cannot read property 'data' of null -

Image
the error message re-created in demo: http://plnkr.co/edit/6tok16u287skhqpsramx?p=preview var chart = c3.generate({ data: { "columns": [["b1", 1], ["b2", 2]], "type": "donut", onclick: onclick, }, donut: { "title": "iris petal width" } }); function onclick(){ chart.load({ columns: [['a_b1', 1], ['b_b1', 2]], unload: ['b1', 'b2'] }); } the documentation function here: http://c3js.org/reference.html#api-load do think i'm using wrong or it's bug in library? --reponse comment-- error occurs in fiddle when section of donut clicked. if watch transition animation closely can see hesitate when rendering different sections of donut. these errors occur after rendering.

backbone.js - Passing variables into Handlebars template when rendering Marionette/Backbone View -

i'm using handlebars backbone , marionette. i'm compiling handlebars templates , storing them in object can referenced view definitions. i'm using layoutview , regions display various items need in ui. what want pass (boolean) variables view such handlebars make decisions (via block helper {{#if varname}} ) render. clarity don't want persist data i'd rather not make them part of model i'm passing in rendered. so i'm doing defining backbone.model , marionette.itemview normal, , trying pass in additional variables via initialize: var newuser = new app.userview({ model: new app.usermodel(), initialize: function(){ this.isnewdoc = true } }); // display view in region using app.regions.maun.show(newuser); // ...etc. what want able pass in , able refer variables such isnewdoc in handlebars template, ideally via {{#if isnewdoc}}...{{/if}} . i've tried various permutations line this.isnewdoc = true such isnewdoc: true i'm not ge

javascript - The best performant way to push items into array? -

in website have many arrays data. example: vertices array, colors array, sizes array... i'm working big amounts of items. tens of millions. before adding data arrays need process it. until now, did in main thread , made website freeze x seconds. froze because of processing , because of adding processed data arrays. today 'moved' (did lot of work) processing web workers, processed data being added in main thread. managed save freezing time of processing not of adding. the adding done array.push() or array.splice() . i've read articles how array works, , found out when add item array, array being copied new place in memory array.length + 1 size , there adding value. makes data pushing slow. i read typed array faster. need know size of array, don't know, , creating big typed array counter , managing adding items in middle(and not end of array) lot of code change, don't want @ time. so, question, have typedarray return web worker, , need put regu

oop - How to create an instance in java based on specific input? Implementation of Singleton pattern -

suppose have crypto class. public class crypto{ // method returns instance of crypto class key. // if instance key hasn't been created new instance created. // if created key same instance returned. public static crypto getinstance(string key){ } } how implement pattern? mean singleton design pattern different instances different keys , save instance? i think can use map : class crypto{ map<string,crypto> map = new hashmap<string,crypto>(); private crypto(){ } public static crypto getinstance(string key){ if(map.contains(key)){ return map.get(key); } else{ // switch on key , create cryptos map.put(key,new crypto(); } return map.get(key); } }

c - Problems linking my driver -

i've got quite programming experience, i'm new windows driver development. trying create simple display driver, following this turorial . goal simulate second (and in future: third, etc.) display, purely virtual , renders framebuffer. grab contents of virtual screen via vnc , render remote machine. the problem is: if try build project (using visualstudio 2013 , wdk 8.1), lnk2019 error: error lnk2019: unresolved external symbol "driverentry" in function "gsdriverentry". e:\vs_projects\mviz\mvizvmongdidrv\bufferoverflowfastfailk.lib(gs_driverentry.obj) mvizvmongdidrv there no driverentry function in code, bool drvenabledriver , acting equivalent driverentry in display driver. any ideas on how resolve error? okay, found solution myself: entry point wrong. changing drvenabledriver fixed it.

excel - unique values in combobox based on another combo box -

i adding unique values in combobox2 based on selection in combobox3 . when implementing same code add unique values in combobox3 based on selection on combobox2 , not working. replaced combobox2.value combobox3.value , column b column c . private sub combobox1_change() dim ws worksheet, _ dic object, _ rcell range, _ key string set ws = worksheets("sheet1") set dic = createobject("scripting.dictionary") me.combobox2.clear 'clear added elements me.combobox2.value = vbnullstring 'set active value empty string '------here need tests------- each rcell in ws.range("b2", ws.cells(rows.count, "b").end(xlup)) if rcell.offset(0, -1) <> me.combobox1.value else if not dic.exists(lcase(rcell.value)) dic.add lcase(rcell.value), nothing end if end if next rcell each key in dic userform1.combobox2.additem key next end sub

http - ios multipart image upload, uploaded file is corrupted -

Image
i making multipart post request server , works fine, jpeg i'm uploading doesn't have file extension , can't opened (the file size same orginal). i've tried on tho different servers , same error occured, i'm assuming it's issue of app code. let boundary = generateboundarystring() let request = nsmutableurlrequest(url: urls.sendfileurl) request.httpmethod = "post" request.setvalue("multipart/form-data; boundary=\(boundary)", forhttpheaderfield: "content-type") let body = nsmutabledata() (key, value) in params { body.appendstring("--\(boundary)\r\n") body.appendstring("content-disposition: form-data; name=\"\(key)\"\r\n\r\n") body.appendstring("\(value)\r\n") } let imagedata: nsdata = uiimagejpegrepresentation(photo, 0.8) body.appendstring("--\(boundary)\r\n") body.appendstring("content-disposition: form-data; n

ubuntu - Seafile-server search option in web -

Image
i have installed seafile server in centos , seafile client in windows machine. please me clarify doubts. have included screenshot. how enable search bar in pages seacloud.cc after logged admin account how view user files. in future how upgrade hard disk incase if hard disk full. only available in pro edition you cannot view other users files except have shared them you stop server -> copy old disk new disk -> update settings ngnix (path data) -> start server

jquery - Moving fullscreen background image -

have been looking 2 days after googling still no idea how achieve want. hope can me. i want background image move this: http://www.theophile-patachou.com/nl/ any suggestions? dug through stackoverflow searching gold no result... guess way go css transform? i tried use these examples build outcome not desired http://www.sitepoint.com/css3-transform-background-image/ you can achieve zooming affect using jquery animate function ( http://api.jquery.com/animate/ ). $('img').animate({width:'+=300',height:'+=300'},16000); $('img').animate({width:'-=300',height:'-=300'},16000); if need use setinterval , call repeatedly. setinterval(function(){ $('img').animate({width:'+=300',height:'+=300'},16000); $('img').animate({width:'-=300',height:'-=300'},16000); },32100);

C dynamic memory allocation array -

my program has 3 int arrays (pointers) declared in main function. user enters length of array a , filled random numbers. then, function called takes 3 arrays arguments. takes numbers array a , puts them array b , , odd numbers c . sizes of b , c need same number of elements. elements of b printed. #include <stdio.h> #include <stdlib.h> #include <time.h> int vela, velb, velc; //the sizes of arrays void napravi(int a[], int *b, int *c); void main() { int *a, *b, *c; int i; srand(time(null)); printf("enter array lenght:"); scanf("%d", &vela); getchar(); = (int*)calloc(vela, sizeof(int)); b = (int*)malloc(4); //i have initialize variable in order pass argument ? c = (int*)malloc(4); for(i = 0; < vela; i++) { a[i] = rand() %101; } napravi(a, b, c); for(i = 0; < velb; i++) { printf("%d ", b[i]); } free(a); // free(b); //windows has trig

javascript - IDs in quotes when using MongoDB $setEquals -

i've got problem quoted ids in referenced array. when try this: task.find({ game: req.user.game }).exec(function(err, task) { if(err) { console.log(err); } else { console.log(task[0].incategories); } }); it writes array of ids in quotes node.js console ( ["5550a9604b24bcdc1b88cc76", "5551213c35d0516807b2cd99"] ). i'm trying return task logged in user (look @ comments next console.log commands): profession.find({ _id: req.user.profession }).exec(function(err, profession) { if(err) { return res.status(400).send({ message: errorhandler.geterrormessage(err) }); } else { console.log(profession[0].assignedtaskcategories); // output: array quoted ids var pipeline = [ { '$match': { 'game': req.user.game, } }, { '$project': { 'title': 1,

python - "yield from iterable" vs "return iter(iterable)" -

when wrapping (internal) iterator 1 has reroute __iter__ method underlying iterable. consider following example: class fancynewclass(collections.iterable): def __init__(self): self._internal_iterable = [1,2,3,4,5] # ... # variant def __iter__(self): return iter(self._internal_iterable) # variant b def __iter__(self): yield self._internal_iterable is there significant difference between variant , b? variant returns iterator object has been queried via iter() internal iterable. variant b returns generator object returns values internal iterable. 1 or other preferable reason? in collections.abc yield from version used. return iter() variant pattern have used until now. the significant difference happens when exception raised within iterable. using return iter() fancynewclass not appear on exception traceback, whereas yield from will. thing have information on traceback possible, although there situations want hid

android - Mail link open my app on specific URL -

i'm using crosswalk . have hard restrictions speaking project i'll try clear possible. when open app manually, webview load home index.html of website. website used webrtc so, send invitation via e-mail specific url. is possible open my own application url clicked ? i checked <intent-filter> have no clue how deal url opening. hope have solutions or clues. edit: <intent-filter> <data android:scheme="https" android:host="xxx.xxx.com"/> <action android:name="android.intent.action.view"/> <category android:name="android.intent.category.browsable"/> <category android:name="android.intent.category.default"/> </intent-filter> with can open application when click on link, still need link url , set url loaded in xwalkview. example: https://xxx.xxx.com/join?xertfgf=1 when click on that, app open good, know want xwalkview load this.

Android ListView Pull to refresh and Swipe List item to reveal buttons -

i working on android listview. implemented pull refresh through xlistview , want implement swipe left right show buttons list item on listview. how can it? or how add 2 libs same on listview. my listview in xml is. <com.orderlyexpo.www.listview.refresh.xlistview android:id="@+id/lvorders" android:layout_width="match_parent" android:layout_height="wrap_content" android:divider="@color/gray_text" android:dividerheight="@dimen/dp1x" /> don't use lib swipe, make own view , can use pull refresh same lib. just way. add class name. swipedetector.java public class swipedetector implements view.ontouchlistener { public static enum action { lr, // left right rl, // right left tb, // top bottom bt, // bottom top none // when no action detected } private static final string logtag = "swipedetector"; private static final int min_distance = 100

How to set the screen orientation to Landscape mode in a activity when the auto rotation feature is turned off in the device settings in Android -

well, have requirement, orientation of screen should changed, when phone turned when auto-rotation feature off on android-device settings. i know can achieved using the setrequestedorientation(activityinfo.screen_orientation_sensor); in oncreate of activity. or by @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setrequestedorientation(activityinfo.screen_orientation_sensor); } any tips or best practices or code snippets can achieve this? way of implemenatation right? helpful if has managed achieve within custom views or fragments share logic on how implemented. help! i know can done in androidmanifest file adding tag, limit layout in landscape , not i'm looking for.

How to sort by the value of number1 plus number2 in the mongodb -

i prepare objects in mongodb. {number1:123,number2:321} {number1:222,number2:4532} for example, these have in database. now, want them value of number1 + number2. how ? one option no 1 has said here use aggregation framework. better using $where since faster , can sort on return , more such: db.c.aggregate([ {'$project': {sumfield: {$add: ['$number1', '$number2']}}}, {'$sort': {sumfield: 1}} ]); like so. better using inbuilt js, plus index , covered query make faster since aggregation, unlike $where can use index.

Rename multiple files using windows command prompt -

i have several files name format dbo.table_name.sql , want rename them table_name.1.tbl how using windows cmd prompt ? i have tried ren *.sql *.1.tbl rename dbo.table_name.1.tbl still not able remove dbo. here.. tried ren dbo.*.sql *.1.tbl still not luck :( a batch file work. @echo off setlocal enabledelayedexpansion %%f in (dbo*.sql) ( set "name=%%~nf" ren "!name!.sql" "!name:dbo.=!.tbl" )

Making a player jump using physics in Visual Basic? -

i have been trying time implement jumping start of platformer game, without success. have managed implement gravity continuously trying move player downwards, , if falls below bottom of screen. case game_status.void keyboard_controls() plyer.moveplayer(0, g) if plyer.bottom > height plyer.playerstanding(true) plyer.moveplayer(0, -g) else plyer.playerstanding(false) end if what struggling implementing "jump" based on real-life physics. level student studying physics, aware of suvat , equations, , f=ma, cannot player jump when key pressed. ideas? key event: case keys.w if me.controls.contains(gamepanel) , gamepanel.controls.contains(plyer) u = true end if my failed attempts @ physics: if u = true dim t, v double t = get_elapsed_ti

PHP - change first folder in url but keep remaining folders as is -

using if else statement, php check if first folder in url (en), example: http://www.domain.com/en/newyork/car/ if first folder [ en ] shown above in example, change ahref of link have on page change link from: en change link to: ru looking @ example above, thing want php change en or ru keeps remaining url of current page is : if current page url http://www.domain.com/en/newyork/car/ link russian in order current language of page, first have path of current url, , string after first slash. follows: // current url $current_url = $_server['request_uri']; // 'path' portion (without things 'http') $url = parse_url($current_url); // split string in array $parts = explode('/', $url['path']); $lang = $parts[1]; $prepath = $url['scheme'] . '://' . $url['host'] . $parts[0]; // array slice remaining parts $postpath = array_slice($parts, 2); // append first part of path, new language, , // remainder of

forms - if dsum is blank then insert 0 -

i trying sum text boxes in form within access 2010. within text boxes summing there dsum function. query time dependent , updated throughout day. causes boxes empty @ points throughout day. need input 0 can sum total in box having trouble. here have tried far. = iid(dsum("[field_name]", "[table_name]", "[time]='08'") = '', 0, _ dsum("[field_name]", "[table_name]", "[time]='08'")) i have tried single , double quotes around 0 , single , double quotes around 'if blank' may haven't got right permutation? please driving me nuts! dsum returns null, if condition not met. try wrapping in nz(). like, = nz(dsum("[field_name]","[table_name]","[time]='08'"), 0)

c# - What to specify for Local ManagementScope -

i trying connect (locally) list of virtual machines , properties. have hacked code found, code failing connect can assume connection string wrong. using server 2012, hyper-v private void listvirtualmachines() { managementscope manscope = new managementscope(@"\\localhost\root\cimv2"); if (manscope.isconnected) { objectquery queryobj = new objectquery("select * msvm_computersystem"); // connect , set our search managementobjectsearcher vmsearcher = new managementobjectsearcher(manscope, queryobj); managementobjectcollection vmcollection = vmsearcher.get(); // loop through machines foreach (managementobject vm in vmcollection) { // display vm details logstring(vm["elementname"].tostring()); logstring(vm["enabledstate"].tostring()); logstring(vm["description"].tostring());

ruby - Can't use conditions on symbols. DataMapper with Sinatra -

i'm getting troubles when trying use conditions on symbols in datamapper: clusters = cluster.all(:latitude.not => nil) this code throws error: argumenterror - condition #<origin::key:0x50d05a0 @name=:latitude, @strategy=:__override__, @operator="$not", @expanded=nil, @block= nil> of unsupported object origin::key: c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:888:in `block in assert_valid_conditions' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:853:in `each' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:853:in `assert_valid_conditions' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:776:in `block in assert_valid_options' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:766:in `each' c:/ruby21/lib/ruby/gems/2.1.0/gems/dm-core-1.2.1/lib/dm-core/query.rb:766:in `assert_valid

c# - Insert a linq-query into DataTable Rows dynamically -

i looking way dynamically insert fields of linq-query (excluding id-field) rows of datatable matching columns. end goal bulkinsert/sqlbulkcopy datatable database. var clearing = line in readcsvfile(e.fullpath) select new clearingdata { //about 200 fields set here snip }; //create datatable bulk inserting datatable dt = new datatable(); //insert appropriate columns datatable foreach(var property in typeof(clearingdata).getproperties().where(x => x.name != "csvreportid")) { dt.columns.add(property.name, nullable.getunderlyingtype(property.propertytype) ?? property.propertytype); } foreach(clearingdata clear in clearing) { //something dt.rows.add(all elements in clear.where(field != "id")) } clearingdata mapped type entity framework, clearing linq-query imports 200-meg .csv , creates anonymous type containing rows , fields. there 200 fields, why don't want add rows hand. than

java - Linked List steps -

i have project , don't know steps pierced write java program store employee information in linked list, program should implement following functions: function task insert new employee add new employee linked list , store employee's information ( id, name, address, department, salary) update employee information modify existing employee's information (change address , salary only). should ask employee id update his/her information remove employee remove employee using employee id linked list the program should display list of functions, , ask user enter number of function he/she wants do, perform function required in previous table. this did

git log - Get list of tasks numbers from git log based on message -

task number = jira issue number = **** (e.g.: 7600) let's suppose have list of commits having following messages: prj-7600 - first message prj-8283 - second message prj-8283 - third message prj-1001 - fourth message prj-8283 - fifth message prj-7600 - sixth message where first 1 oldest commit. wanted output: 1001 7600 8283 i listed commits using following command: git log --author="first last" --oneline --grep=prj --pretty=format:"%s" | sort where committer = author (in case) --grep=prj specified ignore comments automatically generated (" merge branch ... ") (alternative --no-merges ) --pretty=format:"%s" shows message (removes hash) actual output: prj-1001 - fourth message prj-7600 - first message prj-7600 - sixth message prj-8283 - fifth message prj-8283 - second message prj-8283 - third message is possible extract numbers (probably using regex or substring) showing them once? details: windows 7 git

javascript - Make jQuery getScript() know other variables -

var some_array = [ 1, 2, 3, 4 ]; $.getscript('{% static 'js/input_field_validations.js' %}'); my function inside input_field_validations.js says: uncaught referenceerror: some_array not defined input_field_validations executed before need or happening here? since static -loading django, added tag

visual studio 2013 - How do I solve Xamarin 'Failed to start application on the target simulator'? -

this not new failure. though, have tried solutions found on xamarin forum. new development on xamarin , running visual studio 2013 inside parallels since vs way easy true cross-platform development xamarin (using trial license). i got working windows phone (of course) , android tried many hours working ios no. have paired build host in mac visual studio. i following error when try run iphonesimulator (iphone 4s ios 8.3) (debug/release) failed start application on target simulator server returned error. remote server returned error: (401) unauthorized. server error code: 401 unauthorized not authorized run command solutions tried; made sure build host , visual studio using latest stable version of xamarin - no paired, unpaired , paired again... multiple times - no emptied xamarin cache in parallels instance , unpaired , paired again - no tried cleaning solution, changing info.plist copy always, doing release build , debug build - no tried remove dot 

c - Extended Inline Assembly GCC- bad register name and junk 'done' after expression error when compiling -

i'm writing program using assembly code write program calculate 1 of quadratic equation roots. i've written of code, have following error: main.c:37: error: bad register name `%qword' main.c:39: error: junk `done' after expression how correct error, please? my codes is: // function checking assembly code computing correct result double quadraticrootc(double a, double b, double c) { return (-b + sqrt(b * b - 4 * * c)) / (2 * a); } double quadraticroot(double a, double b, double c) { double root; asm( "fld %1 \n" "fadd %%st \n" "fld %1 \n" "fld %3 \n" "fmulp %%st(1) \n" "fadd %%st \n" "fadd %%st \n" "fchs \n" "fld %2 \n"

android - How to pass VmOptions to AndroidStudio via command line arguments? -

quick version: i want pass studio.vmoptions arguments while executing studio.sh directly on command line, instead of actual vmoptions file. is possible? how? for example, ./studio.sh -dhidpi=true . use case: latest version of android studio adds support hidpi screens windows , linux. adding -dhidpi=false or -dhidpi=true studio.vmoptions file activate/deactivate feature. my problem work on 24" fullhd screen ( -dhidpi=false ) , other times directly on laptop 11" fullhd screen ( -dhidpi=true ). i quick/easy able launch android studio true or false without having edit vmoptions every.single.time. believe type of cmd line argument best, i'm open suggestions doesn't involve creating custom script modify vmoptions before launching it. unfortunately not yet possible. provide 2 different files. documentation says can export environment variable studio_vm_options - vmoptions file use -. wrap studio.sh, in script, , place in /usr/local/bin .

eclipse - IBM Java SE 1.6 and STS conflict -

i'm using eclipse kepler , ibm jdk 1.6. java version "1.6.0" java(tm) se runtime environment (build pwa6460sr2-20080818_01(sr2)) ibm j9 vm (build 2.4, j2re 1.6.0 ibm j9 2.4 windows vista amd64-64 jvmwa6460-20080816_22093 (jit enabled, aot enabled) j9vm - 20080816_022093_ledsmr jit - r9_20080721_1330ifx2 gc - 20080724_aa) jcl - 20080808_02 when install sts eclipse kepler following error message appears whenever run eclipse. can me, please ? could not lookup required component com.google.inject.provisionexception: guice provision errors: 1) error in custom provider, java.lang.typenotpresentexception: type javax.enterprise.inject.typed not present @ classrealm[plexus.core, parent: null] @ classrealm[plexus.core, parent: null] while locating org.sonatype.plexus.components.cipher.plexuscipher while locating org.sonatype.plexus.components.sec.dispatcher.defaultsecdispatcher @ classrealm[plexus.core, parent: null] @ classrealm[plexus.core, paren

Is it possible to do a Git Commit with the user being the current SSH user? -

us in our team have our own ssh usernames use log in our dev server. when git commit though (without specifying author), author of course becomes --global user.name set. but possible automatically use current ssh user git author? can set default global user.name this. purpose when commits dev server, we'll know right away did , not see dev@oursite.com . thank you. yes, @ least in workaround, can commit author option --author=<author> and add alias section gitconfig [alias] ci= !git commit --author="\"env_author\"" if call env_author="a <b@c.d>" git ci it use content of variable env_author author string. now, fill value in login profile scripts each user or magic whoami , don't know.

django - How to validate a url field whether the website url is valid format or not in forms.py and shows the error in template -

i using django class based views. trying validate url field in forms.py file. check whether given url valid format or not , return errors in template page. can me this. def clean_website(self): website = self.cleaned_data.get("website") val = urlvalidators(verify_exists=false) val(website) it's not working me.please 1 me validate field , return error. thanks in advance. try returning data @ end of method: return val(website)

regex - python pandas use map with regular expressions -

i have dict: dealer = { 'esselunga': 'spesa', 'decathlon 00000120': 'sport', 'leroy merlin': 'casa', 'conad 8429': 'spesa', 'ikea': 'casa', 'f.lli madaffari': 'spesa', 'supermercato il gigant': 'spesa', 'naturasi spa': 'spesa', 'esselunga settimo milane': 'spesa' } and want map pandas df: entries.categoria = entries.commerciante.map(dealer) is there way use regex match map on "commerciante" column? in way can rewrite dealer this: dealer = { 'esselunga': 'spesa', 'decathlon': 'sport', 'leroy merlin': 'casa', 'conad': 'spesa', 'ikea': 'casa', 'f.lli madaffari': 'spesa', 'supermercato il gigant': 'spesa', 'naturasi spa': 'spesa',

vscode - How Do I debug in server side code? -

i have download & install vscode on ubuntu 14.04 lts box, , it's working fine. have created 1 app in node.js, , want debug it. when put debug point in app.js file, , hit f5 (run), , seems it's working. how debug server side , client side code? have video tutorial in detail, new user can understand it. vscode supports node , mono (on linux , mac) debugging atm. client side debugging not supported, can vote here: https://visualstudio.uservoice.com/forums/293070-visual-studio-code?filter=hot&page=1 we might produce video tutorials new users soon. in meantime can @ docs https://code.visualstudio.com/docs/debugging

php - address verification with USA credit card -

i want check whether user entered address correct credit card details, don't want charge user verify credit card address. have tried verify address using stripe: http://stripe.com/docs/api#create_card_token when retrieve token address fields returns null . stripe\token json: { "id": "tok_15xbrlbohzkqwmnn8j62vizn", "livemode": false, "created": 1430376391, "used": false, "object": "token", "type": "card", "card": { "id": "card_15xbrlbohzkqwmnnfnlqkusp", "object": "card", "last4": "4242", "brand": "visa", "funding": "credit", "exp_month": 8, "exp_year": 2016, "country": "us", "name": null, "address_line1": null, "address_line2": null, "address_city": null

backbone.js - Backbone Nested Views & Nested Models -

i newbie backbone , trying start using in our projects. my requirement have this var textfields = backbone.model.extend({}); var textfieldscollection = backbone.collection.extend({}); var module = backbone.model.extend({ defaults: { fields: new textfieldscollection() }); var modulecollection = backbone.collection.extend({ model: ctmodule }); now have views defined textfields & modules. if change value in textfields event gets fired model , changing value in model collection not getting updated. tried trigger backbone events in child model @ collection view not able map correct model triggered change event. any comments helpful. not in position use more libraries. can done in backbone? i not know full code, if in fashion backbone apps written should work. quick tutorial: var testmodel = backbone.model.extend({}); var testmodelcollection = backbone.collection.extend({ model: testmodel }); // if have view collection var testmodelcollectio

rest - gatling load testing Restful Api with @RequestParam -

i writing gatling load test restful api test. endpoint accepts @requestparam, getting 400 when call rest endpoint scala script. here how have setup. scala script loadtest gatling: val getmails = exec(http("get_mails") .get("/api/v1/users/${userid}/mails") .formparam("datefrom", "1430987200") .formparam("dateto", "1432987200") rest endpoint: @requestmapping(value="/users/{userid}/mails", method=requestmethod.get, headers="accept=application/json") public responseentity getmailsb`enter code here`yfilter(@pathvariable("userid") long userid, @requestparam(value="datefrom") long datefrom, @requestparam(value="dateto") long dateto); first, should using queryparam pass "datefrom" , "dateto" in que

javascript - How to update a field of collection efficient in MongoDB? -

i have dataset {"id":1,"timestamp":"mon, 11 may 2015 07:57:46 gmt","brand":"a"} {"id":2,"timestamp":"mon, 11 may 2015 08:57:46 gmt","brand":"a"} the expected result of data {"id":1,"timestamp":isodate("2015-05-11t07:57:46z"),"brand":"a"} {"id":2,"timestamp":isodate("2015-05-11t08:57:46z"),"brand":"b"} it means want revise timestamp in each row string isodate current code db.tmpall.find().foreach( function (a) { a.timestamp = new date(a.timestamp); db.tmpall2.insert(a); } ); it runs sucessfully, take couple minutes run code , need create new collection. there efficient way it? you don't need create new collection. use collection.save method update document. db.tmpall.find().foreach(function(doc){ doc.timestamp = new date(doc.tim

ExtJS - convert json to Model -

i have json string need map model, i've been checking json reader, ext.data.reader.jsonview, seems wokrs proxy, need pass string (which contains json) , map model. possible? thanks, angelo. take on ext.data.model's constructor. http://docs.sencha.com/extjs/4.2.3/#!/api/ext.data.model-method-constructor can pass data , map model's fields. can like: var model = new ext.data.model(ext.decode(<yourjsonstring>)); ext.data.model can replaced model class.

javascript - how do you make content scripts for Chrome extensions based on saved URL's from some data file? -

content scripts list exact url or blanket acceptance of types of url's example below every webpage. want "matches" data set. "manifest_version": 2, "name": "getting started example", "description": "this extension shows google image search result current page", "version": "1.0", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html " }, "permissions": [ "activetab", "https://ajax.googleapis.com/" ], "content_scripts": [ { "matches": ["*://*/*"] } ] you can list urls want use array: "content_scripts": [ { "matches": [ "http://www.google.com/*", "http://stackoverflow.com/*" ] } ]

loops - Is it possible to wrap looping PHP output in tags? -

everyone. i'm having bit of php conundrum here , couldn't find answer existed. see, i'm working on project have take classmate's discography website , revamp php, where, instead of having album covers , tracklists hard-coded in, query database them. problem have keep general style of site intact, , i'm having trouble doing that. styles depend on having album cover, name, , tracklists in div tags, , style he's got in place achieved through both bootstrap , own, custom css stylesheet. before start ramble, question is: there way wrap looping output in html tags? need album cover, album name, , tracklists in div tag, tracklists loop. here code have in place query database: <?php require ('mysqli_connect.php'); // connect database server mysql_connect("localhost", "admin", "instructor") or die(mysql_error()); // select database mysql_select_db("phprediscography") or die(mysql_error()); // sql query $q =

fuseesb - Database transactions between multiple camel routes -

how transactions works in camel routes spring dsl , 1 of route throws exception? if routeb throws exception, how exception propagated routea. if exception thrown in routeb, see transactionalerrorhandler handling exception , rolling transaction. setting errorhandlerref="noerrorhandler" on routeb not help. how can this? my camel routes definition: <route id="routea"> <from uri="direct-vm:endpointa" /> <transacted /> <to uri="direct-vm:endpointb" /> <bean ref="beana" method="save" /> <onexception> <exception>java.lang.exception> <handled><constant>true</constant></handled> <bean ref="beana" method="handleerror" /> <rollback markrollbackonly="true" /> </onexception> </route> <route id="routeb"> <from uri="direct-vm:endpointb" />

sql - What does "<>" symbol mean? -

i read laravel manual , found symbol in code below: select * users name = 'john' or (votes > 100 , title <> 'admin') so dose "<>" mean?? both <> , != ok think!

Meteor - Deny read? -

how deny reads of collection in meteor? there no allow/deny method , can't in collection publish filter since runs once. i'm shocked, thought make sense template render blank if denied read. meteor looks works fine in website single type of user how segregate data more reading? you can call .stop() in publish callback function after checking user role there example here. https://github.com/alanning/meteor-roles#usage-examples meteor.publish('secrets', function (group) { if (roles.userisinrole(this.userid, ['view-secrets','admin'], group)) { return meteor.secrets.find({group: group}); } else { // user not authorized. not publish secrets this.stop(); return; } }); i found answer after quite bit of googling. helps other people. still find odd can't define read property on allow or deny , achieve same behavior.

AngularJS Directive, ng-repeat and a Jquery Plugin -

i have section @ html load testimonials , i'm using flexslider on it. the markup looks this: <section class="testimonials"> <div class="row"> <div class="small-12 column"> <div class="flexslider"> <ul class="slides"> <li> <h2>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod</h2> <span>- author name</span> </li> <li> <h2>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod</h2> <