Posts

Showing posts from May, 2010

arraylist - Java List, Counting non-zero attributes of Object, by group of 3 -

i have arraylist<fileline> , inside fileline function public double getvalue() { ... doing stuff ... return value; } what i'm trying return count of non-zero getvalue() of group of 3 filelines. let's have list<fileline> filelines of filelines.size() = 12 , respective getvalue() 0,0,0, 0,1,2, 0,3,0, 4,5,5 result i'd 3, valid expect first group. if group of 1 fileline filter , count : long resultcount = filelines.stream().filter(x -> x.getvalue() > 0).count(); , fact it's group of 3 causing me problem. is best approach split list multiple 3 elements sublists or more elegant way? you can group 3 mapping range of indices sublists this: list<fileline> filtered = intstream.range(0, list.size()/3) .maptoobj(n -> list.sublist(n*3, n*3+3)) .filter(sublist -> sublist.stream().anymatch(fl -> fl.getvalue() != 0.0)) .flatmap(list::stream) .collect(collectors.tolist()); i assume

Why excel rounded but still shows more than 2 decimal points -

i have set of numbers rounded of 2. when sum range, ended on cell shows 762,078.31. copied cell , paste value , shows 762078.31. increased decimal , still shows 762078.3100. on 'formula bar' shows 762078.309999999. i show calculations here there ~359 rows. it's simple formula used follows; =round(q2*s2,2) , =sum(y2:y359). idea why happens, let me know. thanks. not sure why it's happening, can edit sum cell round well: =round(sum(y2:y359),2)

mysql - how to design mvc entity models -

its pain me design models. way iam progressing is: find out data involved create database data create entity models data manually ie without table2class conversion the reason told without table2class conversion is: need understand how on mysql/manually. beginner , feel hard each time put hand on area. consider example of saving rating employee , company. employee can rate self , several employees can rate company. database become: employeerating : id | employee_id | tag_id | rating companyrating : id | company_id | employee_id | tag_id | rating how design models scenario. don't it. below model wanted. [table("employee")] public class employee { [key] public int id { get; set; } ... public list<rating> ratings { get; set; } } [table("company")] public class company { [key] public int id { get; set; } ... list of list of rating can seperate each employee should come here } how design mode

objective c - Multiple UIAlertControllers in iOS -

in app there scenarios multiple alerts come. in ios8 uialertview turned uialertcontroller, not able show multiple alerts can not present 2 or more controllers @ same time. how can achieve using uialertcontroller? here method show multiple alertcontrollers : uialertcontroller *av = [uialertcontroller alertcontrollerwithtitle:title message:msg preferredstyle:uialertcontrollerstylealert]; uialertaction *cancelaction = [uialertaction actionwithtitle:kalertok style:uialertactionstylecancel handler:^(uialertaction *action) { }]; [av addaction:cancelaction]; uiwindow *alertwindow = [[uiwindow alloc]initwithframe:[uiscreen mainscreen].bounds]; alertwindow.rootviewcontroller = [[uiviewcontroller alloc]init]; alertwindow.windowlevel = ui

Regex: negative match on group of characters? -

i want create regular expression match strings starting 0205052i0 , next 2 characters not bb. so want match: 0205052i0aaaaaa 0205052i0acaaaa 0205052i0bcabaa but not match: 0205052i0bbaa how can pcre regular expressions? i've been trying $0205052i0^(bb) on https://regex101.com/ doesn't work. you can use negative ahead : "0205052i0(?!bb).*" see demo https://regex101.com/r/mo6uv4/1 also note have putted anchors @ wrong position. if want use anchor can use following regex : "^0205052i0(?!bb).*$"

javascript - Iterate through IEnumerable Model without loop - ASP.NET-MVC5 -

Image
i have typed ienumerable of 2 records passing view controller. have maximum 2 records. need print these 2 record in separate form i.e. html beginform. my question how can print ienumerable model data without using @for or @foreach loop??? can use kind of index read object in model , data based on index??? get data record public list<emergencycontact> getemergencycontactbystudentid(int _studentid) { try { using (var _uow = new studentprofile_unitofwork()) { var _record = (from _emergencycontact in _uow.emergencycontact_repository.getall() join _student in _uow.student_repository.getall() on _emergencycontact.studentid equals _student.studentid _emergencycontact.studentid == _studentid select _emergencycontact).tolist(); return _record; } } catch { return null; } } contr

html - Why does the scrollbar not work in IE? -

i have created scrollbar , works fine in google chrome , firefox not in ie. have feeling has line-height property. my code: html: <div id="scrollbar"><br /></div> css: #scrollbar { margin-top: 10px; height: 220px; float: right; overflow-y: scroll; line-height: 403px; } here jsfiddle . anyway work in ie? change <br/> &nbsp; . ie picks non-breaking space bit better <br> tag. http://jsfiddle.net/s9sycey1/3/

c# - IQueryable different results when adding where clause later -

i'm experiencing variations in results depending on when i'm specifying clause... if use: query1 = ct in customertransfers join j in jobs on ct.stock.jobno equals j.jobno join o in organisations on j.organisationid equals o.organisationid ogroup o in ogroup.defaultifempty() ct.organisationid == intcustomerb && ct.neworganisationid == intcustomera group new { ct, j, o } ct.wedno g let largestvalue = g.orderbydescending(x => x.ct.transferno).firstordefault() select new { id = g.key, organisationid = largestvalue.ct.organisationid, neworganisationid = largestvalue.ct.neworganisationid, }; query1.tolist(); it gives 2 results... if remove following initial iqueryable construction: where ct.organisationid == intcustomerb && ct.neworganisationid == intcustomera and add them in later using clause so: query2 = ct in

PHP: YouTube v3 API Captions Upload with Sync Flag -

for past couple weeks co workers , me have been working on trying captions on our clients youtube video's through v3 api. after week able captions upload fine but, youtube give message in ui "track content not processed" , doesn't display caption's upload. however, can download original format upload; know file uploaded successfully. we able sync flag work tells youtube run through transcript , set timings video but, doesn't work. returns telling syncing when go ui video shows caption track name , give's message "track content not processed." . we've used hours had , we're working on our own time solve problem still no luck. has ran problem before? if so, able work? i post snippet of code below shows upload portion of our script. # insert video caption. # create caption snippet video id, language, name , draft status. $captionsnippet = new google_service_youtube_captionsnippet(); $captionsnippet->setvideoid($videoid); $cap

c++ - Sign extension on x64 assembly dword -

i'm doing programming x64 assembly using masm in vs2013. know when provide integer assembly procedure (defined extern "c" in c++) integer goes rcx register. in case, integer 32 bits, size of dword. thing i'm not sure if compiler performs sign extension when placing dword rcx or 0 extension (zero'ing upper 32 bits , losing sign of dword). if can confirm compiler in instance (since cannot manually use movsxd , preserve sign myself) appreciated. 32bit integers passed in 32bit part of register ( ecx etc), meaning upper half zeroed. doesn't matter, sign not lost, it's not uselessly copied 32 high bits. if work 32bit part of register (which normal when operating on 32bit data), should be. when upcasting 64bit need sign extension.

angularjs - Angular $http difference between .success() and .then() -

sometimes have trouble fetch data using $http service. , did not 100% understand main difference between .success() , .then() the following example can fetch data using $http().then(), can't fetch data using $http().success(). can explain why? code using $http.success() http://jsfiddle.net/xoonplte/11/ var manurep = angular.module('manurep', ['ui.bootstrap']); manurep.controller('myappcontroller', function($scope, $http) { $http.get('https://dl.dropboxusercontent.com/u/59954187/jobs.json'). success(function(response) { $scope.cats = response.data; }). error(function(error){ alert(json.stringify(error)); return error; }); }); code using $http.then() http://jsfiddle.net/xoonplte/12/ var manurep = angular.module('manurep', ['ui.bootstrap']); manurep.controller('myappcontroller', function($scope, $http) { $http.get('https://dl.dropboxusercontent.com

Test if file exists in powershell -

i can use test-path check whether file name entered exists, i'd avoid producing system error if user hits return , input string blank. thought -erroraction common parameter trick, this: $configfile = read-host "please specify config. file: " $checkfile = test-path $configfile -erroraction silentlycontinue still produces: test-path : cannot bind argument parameter 'path' because empty string. @ c:\scripts\testparm2.ps1:19 char:31 + $checkfile = test-path <<<< $configfile -erroraction silentlycontinue + categoryinfo : invaliddata: (:) [test-path], parameterbindingvalidationexception + fullyqualifiederrorid : parameterargumentvalidationerroremptystringnotallowed,microsoft.powershell.commands.testpathcommand do have check string isn't blank or null explicitly? i'm using powershell v2.0 you can this: $checkfile = if ("$configfile") { test-path -literalpath $configfile

html - Flag Sprites css library: why it renders badly? -

Image
i want use lot of flags images in website without loading heavy images, found css sprite of flags https://www.flag-sprites.com/ , seems usefull try use , works partially shows ugly img in chrome , firefox: i have folder index.html , fil library flags.css , flags.png <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>test sprite flag</title> <link rel="stylesheet" type="text/css" href="flags.css" /> </head> <body> <img class="flag flag-cz" alt=" tchèque" /> <img src="blank.gif" class="flag flag-cz" alt=" tchèque" /> tchèque <br/> <img class="flag flag-zanzibar" alt=" zanzibar" /> <img src="blank.gif" class=&quo

.net - How do I Generate a Windows Form (from a programmatically created project)? -

first want mention not asking how create windows form. have unique situation person decided create entire windows forms application programmatically. asking is... is there way work backwards , generate designer file, or can visually work through, this? what have programmatically created "designer" file... is there way this? steve there no quick way this. there 2 normal reason choose build form entirely in code, rather via designer. one when controls shown on form determined @ run time, rather front @ design time. because using same form number of different screens/views loading/unloading controls need specific view, or form data driven, information controls want stored in database. the other reason build form entirely in code when using custom controls don't work forms designer. any of these reasons require (at minimum) rebuild form in designer hand, , may require re-create controls scratch or prevent using designer @ all.

php - Laravel select subquery -

i'm rather stuck trying figure out how can run single query database rather fetching results using 1 query executing other. $query->wherein('page_user_id', staff::lists('staff_id')); thanks help $query->join('staff', 'staff.staff_id', '=', 'user.page_user_id')->get(); i think help. reference http://laravel.com/docs/5.1/queries

How to tween alpha of a BitmapFontCache in libgdx? -

i animating text in libgdx application , label text fade-in , move (e.g. similar jsfiddle ). i can move, , change alpha of other objects (e.g. sprites) , can move bitmapfontcaches. can't alpha of bitmapfontchage change. declaration: message = new bitmapfontcache(messagefont, true); message.setwrappedtext("some text", 10.0f, 10.0f, 10.0f); message.setalphas(0.0f); in screen class, override render method, , call .draw() on renderer class, (among other things) message.draw(batch); call. @override public void render(float delta) { ... try{ batch.begin(); feedbackrenderer.draw(batch); tweenmanager.update(delta);} finally{ batch.end(); } } then a part of timeline call these 2 tweens. (yes, wrapped in .push( ) , start tweenmanager:) tween.to(message, bitmapfontcacheaccessor.position_x, animationduration) .target(35.0f) tween.to(message, bitmapfontcacheaccessor.alpha, animationduratio

c - Two dimensional array address and corresponding pointer to its 1st element -

in terms of 1 dimensional array, array name address of first element. fine assign pointer, below: char data[5]; char* p_data=data; so think should same 2 dimensional array. array name should address of first element's address. so, i'd this: char data[5][5]; char** pp_data=data; then warning saying pointer type char** incompatible char[ ][ ] . why happen? comprehend pointer , array concept wrong? you're right array referred pointer first element. when have "two dimensional" array char data[5][5]; what have array of arrays . first element of array data array of 5 characters. code work: char (*pa_data)[5] = data; here pa_data pointer array . compiler won't complain it, may or may not useful you. it's true pointer-to-pointer char **pp_data can made act two-dimensional array, have memory allocation work. turns out in array-of-arrays char data[5][5] there's no pointer-to- char pp_data pointer to. (in particular,

Writefile method error serial port -

i'm trying write serial port com 1: (to atmega8 mcu) using escapecommfunction create file method, write file dcb dcb = new dcb(); [dllimport("kernel32.dll")] static extern bool setcommstate(intptr hfile, [in] ref dcb lpdcb); [dllimport("kernel32.dll", setlasterror = true)] public static extern bool closehandle(intptr handle); [dllimport("kernel32.dll", setlasterror = true)] private static extern bool escapecommfunction(intptr hfile, int dwfunc); intptr porthandle; int setrts = 3; [dllimport("kernel32.dll", setlasterror = true, charset = charset.unicode)] private static extern intptr createfile(string lpfilename, system.uint32 dwdesiredaccess, system.uint32 dwsharemode, intptr psecurityattributes, system.uint32 dwcreationdisposition, system.uint32 dwflagsandattributes, intptr htemplatefile); [dllimport("kernel32.dll")] static extern bool writefile(intptr hfile, byte[] lp

javascript - Unexpected token ) in line that does not exist -

Image
i'll rather post images code present issue better, these of last lines of file: it clear code ends withing 237th line. when type "npm start" terminal keep getting: looks syntax error in nonexistent line of code. i tripple checked file, try introducing syntax errors , checked if catches them. i'm sure file npm tries use. how come? maybe sublime text? has of ever experienced such weird issue? edit: var express = require('express'), router = express.router(), mongoose = require('mongoose'), //mongo connection bodyparser = require('body-parser'), //parses information post me thodoverride = require('method-override'); //used manipulate post router.use(bodyparser.urlencoded({ extended: true })) router.use(methodoverride(function(req, res){ if (req.body && typeof req.body === 'object' && '_method' in req.body) { // in urlencoded post bodies , delete var m

Allure. How to get screenshot on testFailure event. Use Java+Junit4+Maven -

if want screenshot when tests failed, best practice is? try next way: 1)overridre allurerunlistener: public class simplescreenshottestlistener extends allurerunlistener{ @override public void testfailure(failure failure) { if (failure.getdescription().istest()) { firetestcasefailure(failure.getexception()); } else { startfaketestcase(failure.getdescription()); firetestcasefailure(failure.getexception()); finishfaketestcase(); } makescreenshot("failure screenshot"); } } the method makescreenshot("failure screenshot") static method in util class: public final class util { private util() {} @attachment(value = "{0}", type = "image/png") public static byte[] makescreenshot(string name) { return ((takesscreenshot) <thread local driver>).getscreenshotas(outputtype.bytes); } } 3) in pom file use created listener simplescreenshottestlistener: <plugin>

Dynamic Where in SAS - Conditional Operation based on another set -

to disappointment, following code, sums 'value' week 'master' weeks appear in 'transaction' not work - data master; input week value; datalines; 1 10 1 20 1 30 2 40 2 40 2 50 3 15 3 25 3 35 ; run; data transaction; input change_week ; datalines; 1 3 ; run; data _null_; set transaction; until(done); set master end=done; week=change_week; sum = sum(value, sum); end; file print; put week= sum=; run; sas complains, rightly, because doesn't see 'change_week' in master , not know how operate on it. surely there must way of doing operation on subset of master set (of course, suitably indexed), given transaction dataset... 1 know? i believe closest answer asker has requested. this method uses index on week on large dataset, allowing possibility of invalid week values in transaction dataset, , without requiring either dataset sorted in particular order. performance bett

Laravel Sentinel referencing the wrong config file -

so im using cartalyst sentinel manage authentication , roles in laravel 5.1. @ first downloaded package , adding additional query scopes , defining relations in vendor/../eloquentuser class. composer updated package today , naturally code removed. @ point realized needed have own user class extended eloquentuser , modify published config file use own user class. seems sentinel using config file within /vendor directory because when modify 1 use user model, works, query scopes , relations start work on users. changing published config has no effect on application. im new laravel , composer , all, coming codeigniter, maybe doing wrong or messed while setting up? there's steps setup laravel here: https://cartalyst.com/manual/sentinel/2.0#laravel-5 for laravel 5.1 i've made couple changes edit config/app.php: $providers array cartalyst\sentinel\laravel\sentinelserviceprovider::class, $aliases array 'activation' => cartalyst\sentinel\laravel\f

How to differ linked clone from a full clone in VirtualBox? -

i've got list of virtual machines. know of them clones of few base ones. how determine if vm full clone or linked clone? linked clones have own disks or these differencing images of base? basically these definitions: full-clone: full clone independent copy of virtual machine shares nothing parent virtual machine after cloning operation. ongoing operation of full clone entirely separate parent virtual machine linked-clone: linked clone copy of virtual machine shares virtual disks parent virtual machine in ongoing manner. conserves disk space, , allows multiple virtual machines use same software installation linked clones have own virtual disk diferential disk contains new files or whatever parent virtual machine didn't have when snapshot of linked clone created. the main difference full-clone independent virtual machines , linked-clones dependent virtual machines because linked clones need parent virtual disk base-virtual-disk. you can find these definiti

java - use multi languages in swing application -

Image
we can use several font styles in swing application , can assign different font style different swing text fields. there way configure 1 jtextfield in java swing application support multi languages. example input address. 12b "street name in other language" jtextfield field = new jtextfield("example",30); font font = new font("courier", font.bold,12); field.setfont(font); how can achieve this? there font support dual font style (english + french). update after first answer also need send typed text database , retrieve same format. think not possible switch between font dynamically. update 2 if consider microsoft word can use multiple fonts in single page. there should algorithm save typed letters respective font. how can make kind of behavior in swing without making 2 text fields different language inputs. you can mix fonts using html tags if change component jtextpane . code below create field containing text "hello w

How to make my javascript function wait for a html element to render -

there single page application in angularjs. has nested tabs. in inner tab there button on event gets fired.i need trigger click event of button present on inner tab button gets rendered after both tabs rendered. best way wait until tabs render , button available. i tried using 'while loop'(i.e keep looping until id button undefined) , $timeout(set timeout 2-3 seconds) service both have consequences when there delay in tab render. please suggest if there exists better approach. you can jquery: $(document).ready(callbackfn); or native js: document.addeventlistener('readystatechange', function onreadystatechange() { if (document.readystate !== "complete") return; callbackfn(); }, false);

php - Symfony2 initialize error -

i have problem symfony2 project. on localhost works fine, on server got error: "catchable fatal error: argument 1 passed symfony\component\httpfoundation\session\attribute\attributebag::initialize() must of type array, string given, called in /home/visset/ftp/cms/dashboard/app/cache/dev/classes.php on line 252 , defined" i checked , initialize() function passed empty string. what reason of problem?

javascript - jQuery append with Handebars -

i'm using handlebars render info got local server using ajax. html looks like: <ul class="nav nav-tabs" id="tabsid"> <script id="tabs-template" type="text/x-handlebars-template"> {{#each tabs}} <li data-tab-content={{id}}><a href="#">{{name}}</a></li> {{/each}} </script> </ul> <div id="tabscontentid"> <script id="tabs-content-template" type="text/x-handlebars-template"> {{#each tabs}} <div class="tab-content" data-tab-content="{{id}}">{{content}}</div> {{/each}} </script> </div> i have simple form id, name , content inputs , sumbit button. looks like: <input type="text" class="form-control" name="inputindex" id="inputindex" placeholder="i

WIX : Install multiple instances of an application and upgrade the application if installed at previously installed location -

i able install @ user specified location uninstall previous version (either if installed in same directory or in different directory) , performing major upgrade. if remove major upgrade creates independent instances doesn't upgrade when overwriting existing instance. i want create independent instance if there no existing instance @ location of installation upgrade existing version if there existing instance @ location of installation. isnt situation handled major ugprade? thats major upgrade meant for. if upgrade table correctly configured, can upgrade older version of application. if no older version found, application gets installed fresh installation. or there more question not seeing?

php - twig dynamic variable call -

i passed data in 3 languages twig template , display data in way: {% set lang=app.request.get("lang")%} {% item in contests%} {% if lang=="fa"%} {{item.titlefa}} {% elseif lang=="en"%} {{item.titleen}} {% elseif lang=="ar"%} {{item.titlear}} {% endif%} {% endfor%} it wirking must create 3 if condition each object in "contests" how can show data in logic: {% set lang=app.request.get("lang")%} {{item.title~lang}} {% endfor%} that can call proper method in contest you can use attribute twig function call @ runtime method name, example: {% set lang=app.request.get("lang")%} {% methodname = 'title'~lang %} {% item in contests%} {{ attribute(item, methodname) }} {% endfor%} hope help

debugging - Lisp unroll/partial eval function -

is there way show evaluation steps in common lisp follows: > (defun fac (n) (if (= n 0) 0 (if (= n 1) 1 (* n (fac (- n 1)))))) fac > (step-by-step (fac 3)) 0: (fac 3) 1: (* 3 (fac 2)) 3: (* 3 (* 2 (fac 1))) 4: (* 3 (* 2 (1))) 5: (* 3 2) 6: 6 result: 6 looking way visualize recursion , return values in general small course. know of (step fn) , (optimize (debug 3))) unfortunately not produce desired output, or don't know how tell to. note: non-emacs/slime solution preferred it's not asked for, , specific output implementation dependent, may milage out of standard trace . won't show expansion showed, it's way meet some of requirements [to] visualize recursion , return values in general … see whole expression on each step. having debug print of each function call. many implementations include additional arguments can customize how things traced, gets printed, etc. here's example of default behavior sbcl: cl-user> (defun fac (n

r - Using regex and subset to extract a subset of a data frame -

i have 1 column inside dataframe contains different kinds of text within it, example follows: column column b column c kuala lumpur 2 new 7 old jakarta 3 6 c 7 hong kong 3 jakarta new 22 2 b my goal extract rows of dataframe corresponding word 'jakarta' somewhere in aforementioned column. imagine regex capable of finding word, not sure how 1 combine extract info via subset. note sheet large, prefer use command subset rather loop if possible. desired output be: column column b column c old jakarta 3 6 c jakarta new 22 2 b many in advance help you grepl data df <- data.frame(columna=c("kuala lumpur 2 new", "old jakarta 3", "7 hong kong", "jakarta new 22"),

Efficient PDF Handling in PHP -

i'm looking fantastic community point me in right direction. building application in part work pdf files. essentially have 1 or more large pdf files need split smaller pdf files. right using php , zend framework. the zend framework support i've found rather slow when working larger pdf files. there command line tool, or library faster / more efficient of know about? thank much! user mpdf. http://www.mpdf1.com/mpdf/index.php i have used in more 5 projects , doing great.

vim - what is double forward slash in removing traling whitespace in vi -

i see following command in vi: delete trailing whitespace (at end of each line) with: :%s/\s\+$// i know %: current buffer; s: search , replace; \s: white space; +: 1 or more occurrences; $: end of line but "//" ? the / characters separators. between first , second slashes, defining you're searching , between second , third slashes you're defining you're replacing with. // @ end says you're replacing search text (trailing white space) nothing.

vb.net - VB 2010 - How to Format a number -

i have masked textbox in program asks user write number in mask "00". user writes 1 number "4". how can format textbox show "04" instead ? padleft you. textbox1.text = textbox1.text.padleft(2, "0")

java - I am getting "Authentication did not succeed for user ID" repeatedly 20 times -

i using apachewink , liberty 8.5 when user enters wrong password @ server console below log message printed 20 times consecutively. [audit ] cwwks1100a: authentication did not succeed user id sdwtest1@in.ibm.com. invalid user id or password specified. i debugged client code of apache wink above logs printed when call reaches line java.net.httpurlconnection.getresponsecode() when call returns give response code 401. connection.getresponsecode() call made org.apache.wink.client.internal.handlers.httpurlconnectionhandler class i want if @ first attempt 401 received should not retry again. any appreciated. i found apar related message, http://www-01.ibm.com/support/docview.wss?uid=swg1pm65742 if not running 8.5.0.1 or higher suggest upgrade see if helps.

jquery - How to add simple click event to `cube` -

i created cube using, three.js . how add click event cube ? is require additional js libraries or can directly add event in object? here code : $(function () { var scene = new three.scene(); var camera = new three.perspectivecamera( 50, window.innerwidth / window.innerheight, 0.1, 1000); var webglrenderer = new three.webglrenderer({ antialias : true }); webglrenderer.setclearcolor (0xeeeeee, 1.0); webglrenderer.setsize ( window.innerwidth, window.innerheight ); webglrenderer.shadowmapenabled = true; var cube = createmesh(new three.cubegeometry(5, 5, 5), "floor-wood.jpg" ); cube.position.x = -12; scene.add(cube); // console.log(cube.geometry.facevertexuvs); var step = 0; render (); camera.position.x = 00; camera.position.y = 12; camera.position.z = 28; camera.lookat(new three.vector3(0, 0, 0)); var amb

sql server - How to update a table from the same table in the backup? -

i want recover values table. want use table backup. how update table same table in backup? this source update dbcurrent.dbo.table1 curr set curr.value1 = (select bck.value1 dbbackup.dbo.table1 bck bck.id = curr.id , bck.id2 = curr.id2 ) how do that? may work fine update curr set curr.value1 = bck.value1 value1 curr inner join value1 bck on bck.id = curr.id , bck.id2 = curr.id2

spring mvc - Mismatch in @PathVariable resolving -

let's suppose have method signature: @requestmapping(value = "/verifyusers/{site}/{users}", method = requestmethod.get) @responsebody public list<string> verifyuser( @pathvariable("site") string site, @pathvariable("users") string[] users) { ... } receving request /verifyusers/aoud/farmaci.rain,farmaci.postacuti we get: site="aoud" , users = [farmaci.rain, farmaci] lose second part of second string after dot ("postacuti") i think it's fault of org.springframework.util.antpathmatcher ... use below code prevent truncation of parameter after ' . ' @requestmapping(value = "/verifyusers/{site}/{users:.+}", method = requestmethod.get) @responsebody public list<string> verifyuser( @pathvariable("site") string site, @pathvariable("users") string[] users) { ... } note: {users:.+}

javascript - frame rate: relationship between FPS and MS (milliseconds needed to render a frame) in stats plugin -

Image
i'm using stats.js plugin monitor three.js performance. the fps (frames rendered in last second) , ms (milliseconds needed render frame) information not seem fit together: per calculation, if need 4 ms render frame, should able render 1000 ms / 4 ms = 250 frames per second, far more requestanimationframe provides, lot higher reported 17 fps stats plugin. what missing? you need newer version of stats.js. you have screen refresh rate of 60hz (or possibly 59hz). translates average of 16.67 ms/frame (or 16.95 ms/frame 59 hz). the version of script using incorrectly showing time each frame fps instead of number of frames per second.

java - Spring Security - No bean named 'springSecurityFilterChain' is defined -

the following configuration gives me no bean named 'springsecurityfilterchain' defined error.my question why happening , not how can resolve this. able resolve using org.springframework.web.context.support.annotationconfigwebapplicationcontext web.xml <web-app id="webapp_id" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>spring mvc application</display-name> <!-- spring mvc --> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispa

java - Any tool to annotate a method so that method do not produce logs -

i have junit tests. in tests test cases goes exception blocks in testing method. , logs errors, ends in junit test results. can slf4j configuration , omit whole class logging. wish can annotate test method , ever code runs not produce logs. (a) can use 2 loggers, default class , 1 method-specific in method: private static final logger log = loggerfactory.getlogger(yourservice.class); private static final logger customlog = loggerfactory.getlogger(yourservice.class.getcanonicalname() + "#yourmethod"); (b) or can adjust logging system in test setup/teardown: @setup public void setup() { logger log = loggerfactory.getlogger(yourservice.class); ((loggerimlpementationclass) log).setloglevel(...); } // same, reset, in tear down method. however in case required change logger dependency scope runtime test (in maven terms).

Tomcat deploy via maven URL -

i have .war file in maven url (like : http://maven.x.ch/maven2-x/x/x/x/x/x-x/01.03.00.00/myfile.war ) how can directly deploy in tomcat ?

c# - Repeat read specific number of line into a text file, show them into a textboxes and save them -

i read text file (8 lines), show them textbox , save them db. it. need continue read text files (8 lines everytime). this code: var textboxes = new list<textbox> { textbox1, textbox2, textbox3, textbox4, textbox5, textbox6, textbox7, textbox8 }; using (streamreader sr = new streamreader(@"saverisbex.txt")) { int incnumber = 0; string nynumber = incnumber.tostring("00"); incnumber++; textbox9.text = incnumber.tostring(); int linenumber = 0; int lastgroup = 0; string line; while ((line = sr.readline()) != null) { int currentgroup = linenumber / 8; if (lastgroup != currentgroup) { conn.open(); sqlcommand comando = new sqlcommand("", conn); comando.commandtext = "insert finabex (id,home,away,homescoresft,aw

Writing a function to find a triangular number in python 2.7 -

i couldn't find answer searching , i've been working on 2 days , stumped. think confused on math. trying write function finds first n triangular numbers. def formula(n): = 1 while <= n: print i, '\t', n * (n + 1)/ 2 += 1 print so example if type in formula(5) this: 1 1 2 3 3 6 4 10 5 15 i got how make table going 1 through whatever number choose n.. can't figure out how make second part equal formula typed in n*(n+1)/2. logic going through this? everytime type in formula(5) example loop goes 1-5 returns same exact answer in right hand column way down 15. can't make start @ 1, 3, 6 etc on right hand side. the comment observed computing n * (n + 1) / 2 instead of i * (i + 1) / 2 correct. can rid of having multiplication , division @ each step observing i-th triangle number sum of integers 1 i, @ each step have add previous triangle number. code below: def formula(n): ith

architecture - App communicate with message queue directly vs. communicating with a proxy (front end service) -

we working new architecture our product. out product not iot - devices communicate single box @ client site , box communicates our servers. we have 2 options: the box send message directly queue picked worker server , handled @ it's turn. the box send message front end server. server put message in queue worker handle. there pros , cons each method. number 1 pro communicating directly queue don't need spend money on machines hold front end services. the biggest pro using front end server acts abstraction layer against queue technology working - if change queue don't need update clients new version them keep working. advantage think allows simulate synchronios calls. of course, there many pros , cons each. suggested way work? best practices? security? one aspect consider scalability. need support load balancers that. while message queue protocols can run on load balancers (see e.g. load blancing mqtt broker ), advise test before making decision.

java - What's the difference between a string in the source code and a string read from a file? -

there file named "dd.txt" in disk, it's content \u5730\u7406 now ,when run program public static void main(string[] args) throws ioexception { fileinputstream fis=new fileinputstream("d:\\dd.txt"); bytearrayoutputstream baos=new bytearrayoutputstream(); byte[] buffer=new byte[fis.available()]; while ((fis.read(buffer))!=-1) { baos.write(buffer); } string s1="\u5730\u7406"; string s2=baos.tostring("utf-8"); system.out.println("s1:"+s1+"\n"+"s2:"+s2); } and got different result s1:地理 s2:\u5730\u7406 can tell me why? , how can read file , same result s1 in chinese? when write \u5730 in java code, it's interpreted single unicode character (a unicode literal) compiler. when write same file, it's 6 regular characters (because there's nothing interpreting it). there reason why you're not writing 地理 directly file? if wish read file contai

sql server - MSSQL and MYSQL Migration -

i have migration problem must resolved @ ten days. have middle sized c# web server has 50.000 line of code , have middle sized sql server has triggers, storage procedures , 20 tables contains @ least 10 columns. because our microsoft licences expired end of month, must convert project project uses mysql database reducing our cost of server without buying microsoft sql server licence. cannot change adapter class because did not wrote c# server code. if want make changes on server program, must understand whole project , takes @ least 2 weeks because of tons of codes. what advise me migration process? need quick , robust migration tactic. cannot take backup because server data exceeded 10tb data (yeah bad programming). thanks advising. migration of stored code (procedures, triggers) challenging task. please read guide: https://www.mysql.com/why-mysql/white-papers/guide-to-migrating-from-sql-server-to-mysql/ i don't think migration without changing c# code possi

How to open a program into a XAML c# window -

i using visual studio 2015 rc (wpf application c#) , want program open of apps (with click of button) app window, code below unfinished. the problem happens when click button, notepad opens randomly in it's own window, , not in app's canvas. main.window.xaml: <window x:class="stackoverflowquestion1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:stackoverflowquestion1" mc:ignorable="d" title="mainwindow" height="350" width="525"> <grid> <grid.columndefinitions> <columndefinition width="0*"/> <columndefinition/> </grid.columndefinitions&g

Creating a task in outlook from Java program -

Image
i trying create task in outlook user through application. tried using ical4j vtodo , task being created not shown in outlook. appreciable. in advance. when sent mail , access outlook, task shown .ics attachment. when clicked on attachment, follow message show.

php - how to replace all the ? and = by / htaccess -

hello have site in replace ? , = of urls / . know cn done htaccess file new htaccess i have code in htaccess file errordocument 404 /error404.php errordocument 403 /error404.php options -indexes rewriteengine on rewritebase / rewritecond %{request_method} post [nc] rewriterule ^ - [l] rewritecond %{http_referer} !^http://(www\.)?domain.*$ [nc] rewriterule \.(gif|jpg|jpeg)$ http://www.domain.com [l] rewritecond %{http_host} !^www\. rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] rewritecond %{the_request} \s/+(page1)\.php\?eid=(78)[&\s] [nc] rewriterule ^ /%1/%2? [r=301,l] rewriterule ^(page1)/(\d+)$ /$1.php?eid=$2 [l,qsa,nc] rewritecond %{the_request} \s/+page2\.php\?url=([^\s&]+) [nc] rewriterule ^ /%1? [r=301,l] rewritecond %{the_request} \s/+(.+?)\.php[\s?] [nc] rewriterule ^ /%1 [r=302,l,ne] rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^(.+?)/?$ /$1.php [l

Consuming JSON with Android using external libraries -

i use this weather api in android application stumped on easiest way , library use gson, retrofit, volley? it seems have researched simple task furthest have gotten creating multiple pojos application handle long json returned api. any idea on how tackle this?

ios - getting -[__NSArrayI integerValue] exception -

2015-07-13 23:56:13.659 icbuses[41867:12770881] -[__nsarrayi intvalue]: unrecognized selector sent instance 0x7fddc8e00e30 2015-07-13 23:56:13.670 icbuses[41867:12770881] * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nsarrayi intvalue]: unrecognized selector sent instance 0x7fddc8e00e30' * first throw call stack: he's data parsing class there using data put gps location of bus on map. don't believe i'm calling intvalue on array. separating data nsstrings instantiating class busgps. on instance of class i'm calling intvalue on property of class. please , thank you. data bus location: ( { heading = "-4"; id = 110; lat = "41.66044"; lng = "-91.53468"; } i need lat , lng in int form use google map api. here code. model object header: @interface buslocation : nsobject @property (strong, nonatomic) nsstring *lat; @property (strong,