Posts

Showing posts from August, 2014

vb.net - Inconsistent behavior when using OleDbDataAdapter with MS Excel -

i using ms excel 2010 sort of database store data records , manipulate them vb.net forms. i observing strange , inconsistent behavior: the data record populated insert command//insertcommand.executenonquery() api of vb.net the data record sometimes not modified update command//updatecommand.executenonquery() api of vb.net. however, api status success , returns number of affected rows 1 at other times, same piece of code able modify record during time of failure, if execute couple of sql commands manually (at microsoft query dialog in excel), , re-run vb.net code, records start getting updated! here's simple piece of code: ''''''''''''''''''''''' dim obj new cdatabaseconnection obj.dbconnect() dim strsql string strsql = "update [mytable$] set status = 'cancelled' id = 39" obj.dbrunupdatequery(strsql) obj.dbdisconnect() &#

php - Overriding FOSUserBUndle Controllers Symfony 2 -

i want override fos\userbundle\controller\registrationcontroller add functionalities (to manage fields add in registration form etc). i not know why, after overriding it, symphony ignores controller. not first time, tried override others ... never found solutions ... <?php namespace fp\userbundle\controller; use symfony\component\httpfoundation\redirectresponse; use fos\userbundle\controller\registrationcontroller basecontroller; class registrationcontroller extends basecontroller { public function registeraction() { $response = parent::registeraction(); echo "fpuserbundle"; // custom stuff return $response; } } . <?php namespace fp\userbundle; use symfony\component\httpkernel\bundle\bundle; class fpuserbundle extends bundle { public function getparent() { return 'fosuserbundle'; } } . <?php /* * file part of fosuserbundle package

c# - BsonSerializer Deserialize Script To Wrong BsonDocument -

i'm using dynamic js queries browser client .net server mongodb c# driver. but passing query bsonserializer result bad deserializion. bsondocument doc = bsonserializer.deserialize<bsondocument>("{policy:{'$gt':5}} ,{policy:1}"); the doc value: {{ "policy" : { "$gt" : 5 } }} mongodb bug?

android - Add item in a ListView -

Image
i have activity that's creating check list, if close activity button list saved in database. the list database used mainactivity content. this how app look: if press list item button, new element should added list. how can add , sisplay new item (layout checkbox , edittext)? do need adapter? don't want 'list item' part repeated. that looks after press 4 times activity private arrayadapter madapter; oncreate listview lv = (listview) findviewbyid(r.id.my_list); list<string> initiallist = new arraylist<string>(); //load these madapter = new arrayadapter(this, android.r.id.text1, initiallist) lv.setadapter(madapter); when event happens madapter.add(newstring); the add method in arrayadpater automatically take care of notifydatasetchanged() call , update display. textwatcher you might not need part, it's if want text added text changed question seems indicate - risky because might partial entries, recommend done

c# - Get HTML via URL in Xamarin Forms -

i'm trying html content of webpage via url in xamarin forms project, don't know how. i've tried use stuff this, not working in portable project: get html code website in c# unfortunately, it's not possible use system.net.http. recommended use modernhttpclient, don't know how use html via webpage url. can't find answer in example on github page: https://github.com/paulcbetts/modernhttpclient thanks in advance help! br, fg it's possible use system.net.http in app. need install nuget package: "microsoft.net.http" ( https://www.nuget.org/packages/microsoft.net.http ).

vhdl - Wrong Truth Table for 2 bit comparator using 2 inputs and 3 outputs -

i making 2 bit comparator 2 inputs , 3 outputs. wrote following code in vhdl , when created schematic using xilinx, showed wrong truth tables , k maps of them. here's code: library ieee; use ieee.std_logic_1164.all; entity comparator port ( : in std_logic_vector(1 downto 0); b : in std_logic_vector(1 downto 0); a_lt_b : out std_logic; a_eq_b : out std_logic; a_gt_b : out std_logic); end comparator; architecture behavioral of comparator begin a_lt_b <= ( b(1) , not a(1)) or( b(1) , b(0) , not a(0)) or( b(0) , not a(1) , not a(0)); a_eq_b <= (not b(1) , not b(0) , not a(1) , not a(0)) or (not b(1) , b(0) , not a(1) , a(0)) or ( b(1) , not b(0) , a(1) , not a(0)) or ( b(1) , b(0) , a(1) , a(0)); a_gt_b <= (not b(1) , a(1)) or (not b(1) , not b(0) , a(0)) or (not b(

linux - wx python as portable language -

i chose learn python wish have programs running on multiple platforms. undertake development on ubuntu. my program uses lots of images placed in screen locations using gridbag sizer. when want change image @ specific location use code along lines of def refreshsizercell(self, item, sizer, row, column, span, flag=wx.all, border=10): self.freeze() olditem=sizer.finditematposition((row, column)) if (olditem !=none) , olditem.iswindow(): olditem.getwindow().destroy() sizer.add(item, pos=(row, column), span=span, flag=flag, border=border) self.layout() self.fit() self.thaw() on ubuntu machine works dream, when run under windows sorts of issues: images remainig background, cells moving unpredictably, screen fluttering, ... is issue wxpython on windows (have others had success?) or unrobust code?

php - laravel 5 insert relationship between two tables -

user hasmany profiles profile belongs user. following works: $u = user::firstornew(['email' => $s['email']]); $u->name = $s['name']; $u->avatar = $s['avatar']; $u->save(); $p = new userprofile; $p->provider = $s['provider']; $p->provider_uid = $s['provider_uid']; if ($u->profiles()->save($p)) { } but don't it, there better more streamlined way? why can't save in 1 atomic insert? you trying save data 2 different table , that's why can't using single insert . the way - first save parent object, associate child object , save - how done. you have @ push() method of eloquent 's models, works in similar fashion save() calls save() on related models. using method allows replace code: $a = new a; $a->save(); $b = new b; $b->a()->associate($a); $b->save(); with $a = new a; $b = new b; $b->a()->associate($a);

SSO - from java clients on windows to java server on linux -

i have java application running on windows, need authenticate java application (servlet container) running on linux. i'm unfamiliar of issue, tried googling , experminted different technologies, here things found - weren't right me: waffle - waffle works windows server. thought redirecting incoming requests windows server login process, adds new servers need support. spengo - doesn't if works linux, think meant windows server. (i mean os implementation - http://spnego.sourceforge.net/ ) i'm using tomcat, migrating different servers, don't want specific "tomcat" solution, rather 1 can use in pure java, if possible (or servlet filter solution, can run on standard serlvet container). there lots of patterns available. haven't mentioned how communication between java application , server. you can servletfilter model work if communication between applications , server on http. if communication on rmi, can intercept rmi requests on ser

javascript - Fade boxes after each other in -

i want fade in boxes @ my site . not works already. want first last box fades in , moving down info box etc. boxes appears after each other. the fadein effect made with: .content { -webkit-animation: fadein 3s; -moz-animation: fadein 3s; -ms-animation: fadein 3s; -o-animation: fadein 3s; animation: fadein 3s; background: rgba(49,54,59,0.8); *zoom: 1; } @keyframes fadein { 0% { opacity: 0; } 75% { opacity: 0.3; } 100% { opacity: 1; } } @-moz-keyframes fadein { 0% { opacity: 0; } 100% { opacity: 1; } } @-webkit-keyframes fadein { 0% { opacity: 0; } 100% { opacity: 1; } } @-o-keyframes fadein { 0% { opacity: 0; } 100% { opacity: 1; } } it possible use jquery, javascript , css. hope you'll ahve solution. the jquery fadein function (and animations) has "complete" option. can pass animation call , chain them in order achieve proper order. for instance, can do: $( "#box1" ).fad

regex - Splitting a string into words and punctuation with Ruby -

i'm working in ruby , want split string , punctuation array, want consider apostrophes , hyphens parts of words. example, s = "here...is happy-go-lucky string i'm writing" should become ["here", "...", "is", "a", "happy-go-lucky", "string", "that", "i'm", "writing"]. the closest i've gotten still inadequate because doesn't consider hyphens , apostrophes part of word. this closest i've gotten far: s.scan(/\w+|\w+/).select {|x| x.match(/\s/)} which yields ["here", "...", "is", "a", "happy", "-", "go", "-", "lucky", "string", "that", "i", "'", "m", "writing"] . you can try following: s.scan(/[\w'-]+|[[:punct:]]+/) #=> ["here", "...", "is", &

javascript - Can't remove div with id using jQuery -

this question has answer here: jquery selecting id colon in it 4 answers after ajax request, want div id disappeard doesn't work. there no error in console log. i've checked condition after ajax request alert() , works remove() function wich doesn't work. my div (it contains lot of content divs) <div class="div_avion" <?php echo ($demandephp==true)?'id="avion_iddiv:'.$dataphp['avion_id'].'"':'';?> <?php echo ($demandephp==false)?'style="display:none;"':'';?>>...</div> js $(document).ready(function(){ $(document).on('click', '.button-trash', function() { if($(this).is(".avion_bdd")) { var avion_id = $(this).attr('id').replace("avion_id:", "");

jquery mobile - Link in popup doesn't works -

i'm using jquery mobile create little mobile website. i have popup link, link works if popup not taller phone screen. works on computer... the cross close popup illuminated when click on link. <div id="trouverunmatch" data-role="page"> <div id="notification" data-role="popup" data-overlay-theme="b"> stuff here <a href="#allnotifications">more</a> </div> </div> <div id="allnotifications" data-role="page"> </div> edit : it's not problem bottom link, when click on everywhere inside popup go popup top , illuminate close button. for example if go http://demos.jquerymobile.com/1.4.5/popup/ , click on picture (photo lightbox), resize browser half of (in height), if click on picture close button illuminated. i have replace link : <span class="link" data-link="allnotifications">more

php - How to list most recently updated parent upper in the query? -

Image
i have pic related parent/child tables. every 1 row in parent table, there can 100 or 200 child rows in child table. when upgrade child table; give it's parent row's tid number child's row under thread id column. so, there isn't more 1 parent row each child row. if had column in parent table "lastchildtimestamp" upgrade related row last child timestamp? if can show me example? what want achieve keep updated parents upper when list out parents , want make easy. if have better solution or method i'm open too. there 2 different approaches use solve problem. create parent.lastchildtimestamp field, use database trigger update it. see: http://www.techonthenet.com/mysql/triggers/after_update.php in particular, set after insert , after update triggers in child table update associated parent row. alternately, instead aggregate data child rows when need read it. query looks like: select max(timestamp) child child.threadid = (thread i

actionscript 3 - AS3 | Move graphics points at runtime? -

how graphics points , change values of x&y @ runtime? for example: var movetox:array = [50, 200]; var movetoy:array = [0, 0]; var linetox:array = [100, 0, 50, 250, 150, 200]; var linetoy:array = [100, 100, 0, 100, 100, 0]; var _points:array = []; var linesindex:int = 0; var myshape:shape = new shape(); myshape.graphics.linestyle(3, 0x000000, .2); myshape.graphics.beginfill(0x666666, .1); (var i:uint = 0; i< movetox.length; i++) { var _point:point = new point(movetox[i], movetoy[i]); _points.push(_point); } (var p:uint = 0; p< _points.length; p++) { myshape.graphics.moveto(_points[p].x, _points[p].y); myshape.graphics.lineto(linetox[linesindex], linetoy[linesindex]); myshape.graphics.lineto(linetox[linesindex+1], linetoy[linesindex+1]); myshape.graphics.lineto(linetox[linesindex+2], linetoy[linesindex+2]); linesindex +=3; } myshape.x = 0; myshape.y = 0; addchild(myshape); now want change points values , update

c++ - Cmake cannot find boost library -

i'm on mac os x, following cmake file, , boost v1.58.0 installed @ /usr/local/lib/boost_1_58_0, , every time run cmake prints "could not find boost". i've read through every stack overflow post can how working, , nothing has worked. there i'm missing? cmake_minimum_required (version 3.1) project (helloworld) set (cmake_cxx_flags "--std=gnu++11 ${cmake_c_flags}") file (glob source_files "source/*.cpp") set (cmake_include_path ${cmake_include_path} /usr/local/lib/boost_1_58_0/boost) set (cmake_library_path ${cmake_library_path} /usr/local/lib/boost_1_58_0/stage/lib) set (boost_no_boost_cmake on) set (boost_no_system_paths on) set (boost_root /usr/local/lib/boost_1_58_0) set (boost_includedir /usr/local/lib/boost_1_58_0/boost) set (boost_librarydir /usr/local/lib/boost_1_58_0/stage/lib) set (boost_use_static_libs off) set (boost_use_multithreaded on) set (boost_use_static_runtime off) find_package (boost 1.58.0 components optional) i

hibernate - Kotlin with JPA: default constructor hell -

as jpa requires, @entity classes should have default (non-arg) constructor instantiate objects when retrieving them database. in kotlin, properties convenient declare within primary constructor, in following example: class person(val name: string, val age: int) { /* ... */ } but when non-arg constructor declared secondary 1 requires values primary constructor passed, valid values needed them, here: @entity class person(val name: string, val age: int) { private constructor(): this("", 0) } in case when properties have more complex type string , int , they're non-nullable, looks totally bad provide values them, when there's code in primary constructor , init blocks , when parameters actively used -- when they're reassigned through reflection of code going executed again. moreover, val -properties cannot reassigned after constructor executes, immutability lost. so question is: how can kotlin code adapted work jpa without code duplication, ch

ruby on rails - How to access first item in hash value array -

i have hash value array of song lyrics (line1, line2, etc..) code: class song def initialize(lyrics) @lyrics = lyrics end def get_song_name() puts @lyrics.keys end def get_first_line() puts @lyrics.values[0] end end wasted = song.new({"wasted" => ["i better when we're wasted", "it makes easier see"]}) real_world = song.new("real world" => ["straight want learn here", "if else fall apart"]) wasted.get_song_name() wasted.get_first_line() #=>i better when we're wasted #=>it makes easuer see so when called wasted.get_first_line , want first item in array of value. tried doing @lyrics.values[0] , returns both lines of song instead of first one. how accomplish this? you need understand in above code @lyrics hash. here doing , translates to: @lyrics # => {"wasted"=>["i better when we're wasted", "it ma

node.js - Defining a map with ObjectId key and array of strings as value in mongoose schema -

i'm facing problem while creating mongoose schema db. want create map objectid key , array of string values value. closest can is: var schema = new schema({ map: [{myid: {type:mongoose.schema.types.objectid, ref: 'myothercollection'}, values: [string]}] }); but somehow not working me. when perform update {upsert: true}, not correctly populating key: value in map. in fact, i'm not sure if have declared schema correctly. can tell me if schema correct ? also, how can perform update {upsert: true} schema? also, if above not correct , can;t achieved how can model requirement other way. use case want keep list of values given objectid. don't want duplicates entries same key, that's why picked map. please suggest if approach correct or should modelled other way? update: based on answer @phillee , this , i'm wondering can modify schema mentioned in accepted answer of mentioned thread this: { "_id" : objectid("4f9519d6684c8b

javascript - Two jquery-ui sortables connected, how to change droppable target? -

i have 2 sortables connected means of jquery sortable plugin. possible change target draggables 1 of them? want drag not #sortable1 #sortable2, $('#sortable').parent(), because #sortable2 small. making larger spoils html layout. $( "#sortable1, #sortable2" ).sortable({ connectwith: ".connectedsortable" }).disableselection(); <ul id="sortable2" class="connectedsortable"> <li class="ui-state-default">item 1</li> <li class="ui-state-default">item 2</li> </ul> <ul id="sortable2" class="connectedsortable"> <li class="ui-state-default">item 3</li> </ul> here demo: https://jsfiddle.net/uq3vu5ne/ i not sure understand trying achieve here. want parent div height of second sortable or sortables have fixed height? if it's first can remove static height. if it's latter can add fixed height , scroll sortab

osx - Apple Script Error: Can't continue click -

i'm trying open messaging application (it not have apple script dictionary (command + shift + o)), click on text, , type text box, , hit send. pop up: script error - telegram got error: can't continue click after application becomes active. result tab: error "telegram got error: can’t continue click." number -1708 p.s., messaging application telegram . apple script: tell application "telegram" activate delay 1 click on text "chat name" keystroke "some text" //assuming works because text box first responder when chat opens. click on text "send" end tell if application lacks applescript dictionary, command except standard commands launch , activate , open , reopen , quit throw error. the solution gui scripting: built-in application system events bridge send mouse clicks , keyboard events target application. i don't know application telegram @ all, code mig

android - How to make glide display like picasso? -

Image
i've been using picasso's library load images gridview in application , works , looks i'd like. users telling me images loading slowly. know because of poor network speed , picasso loading full images big , resizing them fit image view. tried using glide loads images in twice speed on images it's not keeping structure picasso does. example picasso loading images looks whilst glide loading them has different states here's loads initially and after scrolling looks and after lots of scrolling looks i pretty confident due images sizes being different , seems making placeholder image different size has effect want know how glide keep initial state, or how picasso load quicker? i've heard lowering color format 888 565 has dramatic effect, can lend me there 2 cents? , suggestions edit this imageview <imageview android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="

rust - &self move field containing Box - Move out of borrowed content -

i have struct field containing references other structs (that did not define) struct htmlhandlebars { user_helpers: vec<(string, box<helperdef + 'static>)>, } and htmlhandlebars has implement function fn render(&self, ...) -> &self and in function need move box function. this: fn render(&self, ...) -> &self { let mut handlebars = handlebars::new(); (name, helper) in self.user_helpers { handlebars.register_helper(&name, helper); } } but kind of stuck because: i can't move box references because borrowing self i can't copy box references because struct not implement copy i can't modify &self &mut self because causes other problems... maybe doing wrong.. there else can do? options? if need more complete overview of code, can find here ps: had no idea how describe situation in title, feel free change it the code you've written trying consume vec , elements. i

Visual Studio 2015 code map external dependencies -

i have native win32 project written in c , wanted visualize project's dependencies external dlls. visual studio 2012 , 2013 let me generate code map not show functions , dependencies each other using arrows, external libraries used, functions used , of functions called external functions etc.. now, in visual studio 2015, latter part seems missing. can not visual studio show project's external dependencies. see internal ones. here's questions: missing something? have activate specific option in project settings? or external dependencies not working in visual studio 2015 right now? steps reproduce: create new non-empty win32-project. in architecture menu, select generate code map solution . see win32project1.exe in middle of screen. meanwhile, visual c# seems fine, showing external dependencies. create c#-project comparison. thank taking time post this! looks regression, in visual studio 2013 externals group external dependencies shown c++. i've logged

Create totals array from two-dimensional array in Javascript -

say have two-dimensional array: // [name, item, price] var arr = [ ['bob', 'book', '3'], ['mary', 'pencil', '2'], ['steve', 'book', '2'], ['steve', 'pencil', '1'], ['bob', 'book', '2'] ]; i need create second array contains: each name once a total each name an array of objects, each object representing item , corresponding price. for instance: // [name, total_price, [ { item: item, price: price } ] ] totals = [ ['bob', 5, [ { item: 'book', price: 3 }, { item: 'book', price: 2 } ] ], ['mary', 2, [ { item: 'pencil', price: 2 } ] ], ['steve', 3, [ { item: 'book', price: 2 }, { item: 'pencil', price: 1 } ] ] ]; what best way create totals array? also, array of objects items , prices two-dimensional array if that's more efficient, this: // [name,

html - How can I reference an image in Meteor? -

i displaying html table in basic meteor app - replaced boilerplate meteor html html table, , looks fine. need add image after table, , tried this: . . . </table> <img border="0" height="640" hspace="0" src="regconvfapssmapwithnumbers.png" width="800" /> </body> but hoped image be, see outline of dimensions , "busted image" icon. i first placed image in project's main directory (on same level <projectname>.css, <projectname>.html (the file i'm trying add image to), , <projectname>.js). i created "public\images" folder, , copied image there, too, makes no difference. am referencing image wrong, have in wrong place, or what? when want reference assets (images, favicon.ico, robots.txt etc.) should create top level public folder in meteor project. since added image in public/images , guess should point /images/my_image.png . below should trick: <im

jquery - Changing Background Image on Change in Device Width -

i have full screen background image. problem face gets chopped when viewing website mobile handset. what have focus object getting viewed in mobile. have cropped image mobile dimensions of focus object. code detect mobile device , change background:url(); normal image if device tablet or desktop cropped version of image if smartphone being used. unaware how might take place. know jquery , @media rules me. with media object check if current screen size bigger 768. if #bg values overwritten. #bg { background-image: url('small.jpg'); } @media (min-width: 768px) { #bg { background-image: url('big.jpg'); } }

html - What are the integrity and crossorigin attribute? -

bootstrapcdn changed links. looks this: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-mfvzlkhceqatnogioxvee8fiwmzzg4w85qfrfifbfyc= sha512-dtfge/zgomypp7qbhy4gwmegsbsdzecxz7iritjcc3spuftf0kufbdz/ixg7artxmdjlxdmezhubenikykgvyq==" crossorigin="anonymous"> what integrity , crossorigin attributes mean? how affect loading of stylesheet? both attributes have been added bootstrap cdn implement subresource integrity . subresource integrity defines mechanism user agents may verify fetched resource has been delivered without unexpected manipulation reference integrity attribute allow browser check file source ensure code never loaded if source has been manipulated. crossorigin attribute present when request loaded using 'cors' requirement of sri checking when not loaded 'same-origin'. more info on crossorigin more detail on bootstrap

unit testing - Nose/Unittest different tests dependent on Python version -

i writing a nose test api addition pandas i'm writing. use travis ci run test suites. in version of python i'm using (python 2.7.6, numpy 1.9.2) following raises typeerror : >>> numpy.round([1.23, 1.132], 2.5) typeerror: integer argument expected, got float but in version being tested against travis ci (python 2.6.9, numpy 1.9.2) same command raises warning: >>> numpy.round([1.23, 1.132], 2.5) /home/some_user/anaconda/envs/py26/lib/python2.6/site-packages/numpy/core/fromnumeric.py:45: deprecationwarning: integer argument expected, got float result = getattr(asarray(obj), method)(*args, **kwds) array([ 1.23, 1.13]) this means assertraises(typeerror) test fails. how can write test either check typeerror or assert_produces_warning(deprecationwarning) depending on python version being tested? there seem 2 ways this, used in pandas testing source. there several (very similar) variants on approach: if sys.version_info < (2, 7):

jquery - How to pen c drive in windows using html or javascript -

i want open c drive using html , javascript on windows not on browser this code open c drive in browser <a target="_blank" href="file://c:\">useful link </a> but want open in windows open c drive using html or javascript try this... new activexobject("wscript.shell").run('"c:\"'); if you're looking full blown app on windows using html , javascript , check out hta: https://msdn.microsoft.com/en-us/library/ms536495(v=vs.85).aspx example hta: <!doctype html> <html lang="en"> <head> <title>test</title> <hta:application border="thin" borderstyle="normal" caption="yes" contextmenu="no" innerborder="yes" maximizebutton="yes" minimizebutton="yes" navigable="yes" scroll="auto" scrollflat="yes"

android - Iterate over a java map and change values -

i have map of <checkbox, imagebutton> . i want able iterate on map , change image of each imagebutton . there way can this? getvalue() doesn't seem let me use methods associated each imagebutton. taken this answer you have cast result of getvalue imagebutton use functions. iterator = mp.entryset().iterator(); while (it.hasnext()) { map.entry pair = (map.entry)it.next(); ((imagebutton)pair.getvalue()).setimagebitmap(bitmap); }

android - How to handle onClick event on imageSpan in editText? -

i working on app in user choose image gallery , added in edittext, want if user click on image in edittext should open in fullscreen, used below code :- public void addtoedt(bitmap bitmap){ spannablestring ss = new spannablestring("abc"); drawable d = new bitmapdrawable(getresources(), bitmap); d.setbounds(0, 0, d.getintrinsicwidth(), d.getintrinsicheight()); imagespan span = new imagespan(d, imagespan.align_baseline); ss.setspan(span, 0, 3, spannable.span_inclusive_exclusive); edt_note.settransformationmethod(null); edt_note.gettext().insert(edt_note.getselectionstart(), ss); final int start = ss.getspanstart(span); final int end = ss.getspanend(span); clickablespan click_span = new clickablespan() { @override public void onclick(view widget) { toast.maketext(getapplicationcontext(),"clicked",toast.length_long).show(); } }; clickablespan[] click_spans = ss.getspans(s

php - ajax call can't see what's wrong :S -

when click button load js file, nothing happens, have testet php file alone without ajax pure php , working! thinking there's wrong code here: $(document).ready(function(){ $('#changepasswordneededbutton').click(function(){ $.post("http://example.com/change_password.php", { currentpassword : $('#currentpassword').val(), newpassword : $('#newpassword').val(), repeatnewpassword : $('#repeatnewpassword').val() }, function(data){ if (data.result == 1) { location.href = data.location; } }, "json" // content has been returned in json format ); }); }); the html this: <div class='changepassword'> <div id='changepasswordinner'> <form> <input id='currentpassword' type='password' name='currentpassword' placehol

location - How to access three Web products via Apache Web server using single IP and one port -

we appreciate vectors solve following issue accessing our web products via urls. access 3 products through port 80 on our hosted server has 1 public ip. accessed @ different points of time using single port of them. how access these products via following urls? can achieved through apache web server configuration below? or, need local dns server in addition apache web server configuration? products accessed via urls: http://<our.server.fully.qualified.domain.name.com>/product1 http://<our.server.fully.qualified.domain.name.com>/product2 http://<our.server.fully.qualified.domain.name.com>/product3 in /etc/hosts file, have added 10.10.10.100 product1 product2 product3 apache web server’s vhosts.conf <virtualhost 10.10.10.100:80> documentroot "/usr/local/product1" servername product1 serveradmin admin@our.server.fully.qualified.domain.name.com errorlog "/usr/local/apache2/logs/error_log" transferlog &quo

Rails Amazon S3 direct upload with JQuery File Uploader -

i have spent days trying make work. getting error options https://bucketname.s3.oregon.amazonaws.com/ net::err_name_resolution_failed i using version 43.0.2357.130 ubuntu 14.04 (64-bit) gemfile: gem "jquery-fileupload-rails" gem 'aws-sdk' application.js (after jquery): //= require jquery-fileupload/basic application.css: *= require jquery.fileupload *= require jquery.fileupload-ui i have model called uploads have generated scaffolds this: rails generate scaffold upload upload_url:string uploads_controller.rb: def new @s3_direct_post = aws::s3::presignedpost.new(aws::credentials.new(env['aws_s3_access_key_id'], env['aws_s3_secret_access_key']), "oregon", env['aws_s3_bucket'], { key: '/uploads/object/test.test', content_length_range: 0..999999999,

c# - Can we extend HttpContext.User.Identity to store more data in asp.net? -

i using asp.net identity. create default asp.net mvc application implement user identity. application use httpcontext.user.identity retrieve user id , user name : string id = httpcontext.user.identity.getuserid(); string name = httpcontext.user.identity.name; i able customize aspnetusers table. add properties table want able retrieve these properties httpcontext.user. possible ? if possible, how can ? you can use claims purpose. default mvc application has method on class representing users in system called generateuseridentityasync . inside method there comment saying // add custom user claims here . can add additional information user here. for example, suppose wanted add favourite colour. can by public async task<claimsidentity> generateuseridentityasync(usermanager<applicationuser> manager) { // note authenticationtype must match 1 defined in cookieauthenticationoptions.authenticationtype var useridentity = await manager.createidentityasyn

ios - How to retrieve instance of NSDictionary when AnnotationCallout is tapped? Swift -

my app uses yelp api generate json data store nsdictionary . user clicks on categories , mapview populates pins information yelp api client. when user taps annotation callout, want display detail view controller contents of dictionary of data yelp client. want instance of array of businesses can display contents on detail view controller. here code: this business model query businesses: class resturant: nsobject { var name: string! var thumburl: string! var address: string! var jsondata: nsdata! var location: nsdictionary! // location init(dictionary: nsdictionary) { name = dictionary["name"] as? string thumburl = dictionary["thumburl"] as? string address = dictionary["address"] as? string location = dictionary["location"] as? nsdictionary } class func searchwithquery(map: mkmapview, query: string, completion: ([resturant]!, nserror!) -> void) { yelpcli

amazon s3 - Using boto (v1) how can I copy_key with SSE-S3 encryption? -

Image
i've used copy_key copy file encrypted sse-s3, copying unencrypts file reason. how ensure gets copied sse-s3? when server side encryption used amazon s3, data encrypted @ rest . means data encrypted before stored disk , decrypted when read disk. never see encrypted version of object. if want copy object copy_key() , have destination object encrypted, set storage_class reduced_redundancy .

java - How to add arrays to ArrayList? -

i have int[3][3] array , contains 0 or 1 values, if value 1 want add coordinates of value in arraylist int[2] array, don't know why add last 1-value coordinates, what's problem? public static void main(string[] args) { random random = new random(); int[] coordinates = new int[2]; arraylist<int[]> arraylist = new arraylist<>(); int[][] board = new int[3][3]; (int = 0; < board.length; i++) { (int j = 0; j < board[i].length; j++) { board[i][j] = random.nextint(2); } } (int = 0; < board.length; i++) { (int j = 0; j < board[i].length; j++) { system.out.print(board[i][j] + " "); if (board[i][j] == 1){ coordinates[0] = i; coordinates[1] = j; arraylist.add(coordinates); } } system.out.println(); } system.out.println("coordinates of cells contain 1 value"); (

java - How to pass password in soap header which requires password digest -

bellow header file using. <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi=http://www.w3.org/2001/xmlschema-instance xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <soap:header> <wsse:security soap:mustunderstand="1"> <wsse:usernametoken wsu:id="usernametoken-14867177"> <wsse:username>wsadvins</wsse:username> <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passworddigest"> gqeg0mep2fappuljkkla3b8k73g= </wsse:password> <wsse:nonce>o7wgbbqpzrdwolsibihm7q==</wsse:nonce> <wsu:created>2007-02-20t19:45:56.456z</wsu:created> </wsse:usernametoken> </wsse:security> </so

javascript - Parse JS SDK + Angular + Ionic - Uncaught TypeError: object.get is not a function -

in app.js file have below code data parse. if if query parse first time dont data view, if query twice info in view error("uncaught typeerror: object.get not function "). please me resolve error.. thanks! query.find({ $scope.getrsvps = function(params) { var rsvpobject = parse.object.extend("rsvpobject"); var query = new parse.query(rsvpobject); if(params !== undefined) { if(params.title !== undefined) { query.equalto("title", params.title); } if(params.discription !== undefined) { query.equalto("description", params.description); } } query.find({ success: function(results) { $scope.data = results; alert("successfully retrieved " + results.length + " rsvps!"); (var = 0; < results.length; i++) { var object = results[i]; $scope.data.push({&

c# - Task Parallel is unstable, using 100% CPU at times -

i'm testing out parallel c#. works fine, , using parallel faster normal foreach loops. however, @ times (like 1 out of 5 times), cpu reach 100% usage, causing parallel tasks slow. cpu setup i5-4570 8gb ram. have idea why problem occurs? below codes used test out function // using normal foreach concurrentbag<int> resultdata = new concurrentbag<int>(); stopwatch sw = new stopwatch(); sw.start(); foreach (var item in testdata) { if (item.equals(1)) { resultdata.add(item); } } console.writeline("normal foreach " + sw.elapsedmilliseconds); // using list parallel resultdata = new concurrentbag<int>(); sw.restart(); system.threading.tasks.parallel.for(0, testdata.count() - 1, (i, loopstate) => { int data = te

javascript - Pop out navigation menu to close when click any blank part of page -

my current project has navigation menu has floating toggle on top left, , when toggled menu pops out on left hand side of page. menu auto closes when link clicked, if #menutoggle clicked again, or there menuclose button [x] @ top right of menu. add ability close menu clicking anywhere outside menu - or blank part of page. i'm sure simple addition current script - , i've tried few things without success. coming right code appreciated! //javascript // menu settings ;(function(){ $('#menutoggle, .menu-close').on('click', function(){ $('#menutoggle').toggleclass('active'); $('body').toggleclass('body-push-toleft'); $('#themenu').toggleclass('menu-open'); }); $('.smoothscroll').on('click',function(){ $('#menutoggle').removeclass('active'); $('body').removeclass('body-push-toleft'); $('#themenu').removeclass('menu-open'); });