Posts

java - Regex - starts with OPERATION and must be followed by either an integer or double -

so have follow input string operation: 12, 12.32, 54.3332 operation can of min, max, sum. regex should accept strings start of 3 words follow colon , followed either integer or double. i have been googling , fidling around hours before decided turn guys. thanks time! edit: so far have ended regex ^[max:sum:average:min:(\\d+(\\.\\d+)?), ]+$ it matches "max: " correct "max:" , "ma: . matches strings of following format : "max: 12, 12.3323......" you misunderstand meaning of [] . these refer single character alternatives. so [max:sum:average:min:(\\d+(\\.\\d+)?), ] either m or a or x or .... mmmmm should match. you may want more this: ^(max|sum|average|min): (\\d+(\\.\\d+)?(, (?=.)|$))+$ explanation: (max|sum|average|min) either max , sum , average or min . ": " refers actual characters : , space. \\d+(\\.\\d+)? had before. ", " refers actual characters , , space. (?=.) look-ahea...

java - How do you change Vector to ArrayList? -

i developing application in java , since vector obsolete required change using arraylist . this relevant code needs changed arraylist : this "house" class. public vector<vector> getitems() { vector<vector> data = new vector<vector>(); (int = 0; < _itemlist.size(); i++) { vector<string> row = new vector<string>(); row.add(_itemlist.get(i).getdecription()); row.add(string.valueof(_itemlist.get(i).getprice())); data.add(row); } return data; } this gui class: private void updateview() { //gets rows , columns house.class vector<vector> rowdata = _listener.gethouse().getitems(); vector<string> columnnames = new vector<string>(); columnnames.add("product name"); columnnames.add("product price(€)"); //creates shopping cart , sets size + properties table1 = new jtable(rowdata, columnnames); table1.setpreferredscrollablev...

c# - Attaching vs selecting and modifying in L2S -

i have data access layer creates context , retrieves data (with no object tracking) , passes information ui layer:- my unit of work method , release appdatacontext after executing particular method. not keeping track of data context anywhere.. public linqobject getobject(){ using (appdatacontext = new datacontext()){ ---code select , return object } } i modify data using form in ui , submit data db. two approaches are:- 1. detach , reattach different data context using [detach..serialise , attach] *i have lot of plumping code enable functionality* 2. db object using primary key , make changes in selected object , submitchanges. which 1 better approach doing task? i against moving unit of work data access layer wise or web application life cycle (httpcontext), because dont want track changes , complicate entire application structure unwanted plumping code . using linq making retrieval , updates db easy. i have never seen discuss these 2 approaches in lin...

how to get suspended user status from google api using oauth -

i looking way google apis list of not-suspended users in organization, using oath authorization. google profile api has oauth, user list returned not contain issuspended flag. google provisioning api returns issuspended flag, far understand cannot oauth authorized. are there other options have accomplish this? yes, provisioning api works oauth 1.0 , 2.0. see docs , necessary scopes here . if need users in entire google apps instance, use retrieve users in domains api call , filter out users issuspended = true . if need filter list down users under organizational unit (ou), use retrieving organization unit's immediate sibling users api call , filter down list users in ou , not disabled.

TypeScript - Inline function not getting checked for type safety -

i new typescript , trying few things where function demands number parameter , bool return value. function where(items: number[], filter: (item: number) => bool) { (var counter = 0; counter < items.length; counter++) { var item = items[counter]; if (filter(item)) { console.log(item); } } } var data = [1, 2, 3, 4]; case 1 - typescript gives compile error var evenfilter = function (item: number) { //actual line item % 2 == 0; return item; } where(data, evenfilter); case 2 - inline function incorrect return type not generate compile time error where(data, function(item : number){ return item; }); case 3 - short hand syntax not generate compile time error where(data, item => item); is bug typescript or expected behavior? definitely bug. apparently anonymous functions not type checked. functions assigned variables / named functions are. can open bug report here: https://typescript.codeplex.com/w...

windows installer - Wix Patch Generation issues -

i struggling build working patch our product using wix 3.7. we @ development stage our product , want validate process building patches before rtm know original installer has information required. i have tried follow patch creation properties approach detailed on wix toolset website, built 2 installers identical upgradecode , productcode since small update - difference single text file called something_to_patch.txt. when generated patch correctly identifying data in something_to_patch.txt has changed; log file msimsp.exe contains: info comparing files: d:\development\xa3-modular\xanalyser3\installer\patches\tmpinstall\target\warwick control technologies\x-analyser 3\something_to_patch.txt d:\development\xa3-modular\xanalyser3\installer\patches\tmpinstall\origin\warwick control technologies\x-analyser 3\something_to_patch.txt... info comparing bytes... info different content... info file key: something_to_patch.txt modified info: phase iv: entering generate payload. info: p...

java - jvisualvm: Stuck on "Loading Heap Dump" screen -

Image
i created heap dump file hprof using command: java -agentlib:hprof -cp "..\..\jars\trove.jar;.\bin" com.mysite.myapp this created file "java.hprof.txt" 5mb. opened jvisualvm view file, , loaded in. visualvm appears stuck on loading screen. screen below has been 10 minutes now. did miss step? should have used different options on command line hprof? how can read heap dump file? visualvm supports heap dumps in binary hprof format. easier use visualvm create heap dump. if not possible use visualvm, can use jmap -dump:live,format=b,file=heap.bin <pid> . advantage don't need special startup arguments , there no slow down caused hprof agent library.