Posts

Showing posts from July, 2010

c# - Trying to refine several if statements down -

i'm trying find more elegant way reduce if statements down, have right little messy , reckon done better, suggestions? if(ship.position.y >= transform.position.y + ybound) { hitbounds = true; } if(ship.position.y <= transform.position.y - ybound) { hitbounds = true; } if(ship.position.x >= transform.position.x + xbound) { hitbounds = true; } if(ship.position.x <= transform.position.x - xbound) { hitbounds = true; } thanks time! update if(mathf.abs(ship.position.x - transform.position.x) >= xbound || mathf.abs(ship.position.y - transform.position.y) >= ybound) { hitbounds = true; } worked treat, million! hitbounds = math.abs(ship.position.x - transform.position.x) >= xbound || math.abs(ship.position.y - transform.position.y) >= ybound;

javascript - Using web workers with chrome extension -

what trying achieve here, execute xhrhttprequest() on worker speedup extension. using worker_proxy.js here . working totally fine except unable figure out how pass string worker. here code: manifest.json "permissions": [ "alarms", "activetab", "tabs", "webnavigation", "http://*/*", "https://*/*", "cookies" ], "options_page": "options.html", "background": { "persistent": false, "scripts": [ "worker_proxy.js","background.js"] }, "content_scripts": [ { "matches": ["https://*/*","http://*/*"], "js": ["jquery-2.1.4.js","hmac-sha256.js","enc-base64-min.js","worker_proxy.js","content.js"] } ], "web_accessible_resources": [ "worker_proxy.html",...

How i can create while loop as SINGLE LINE for command-line /bin/sh -

i can't create cycle single line in /bin/sh i tried: while true; do; sleep 1; done how can it? if want sleep 1 , remove ; after do . if want run command , sleep 1 , add command after do so: while true; echo "hi"; sleep 1; done

spring - Trying to delete a record from a parent entity java class -

i have 2 entity java classes . trying delete record parent entity throwing error : org.hsqldb.hsqlexception: integrity constraint violation: foreign key no action; sys_fk_10142 table: child . **parent class** @entity @table(name = "parent") public class parent { @id @generatedvalue(strategy = generationtype.identity) private long id; @notblank @column(name = "data") private string data; public long getid() { return id; } public void setid(long id) { this.id = id; } public string getdata() { return data; } public void setdata(string data) { this.data = data; } } **child class** @entity @table(name = "child") public class child { @id @generatedvalue(strategy = generationtype.identity) private long id; @notblank private string model; @manytoone() @ondelete(action= org.hibernate.annotations.ondeleteaction.cascade) private parent parent; public long getid() { return id; }...

ruby - Properly set / match routes in routes.rb -

i've implemented basic tagging in app, posts can filtered tags. there's route in routes.rb that get 'tags/:tag', to: 'links#index', as: :tag however, have url /tags lists tags (triggers index action in tag controller). i've set route up get 'tags' => 'tags#index' in tag view have index.html.erb <% @tags.each |tag| %> <div class="row"> <%= link_to tag.name, tag_path(tag) %> </div> <% end %> the problem <%= link_to tag.name, tag_path(tag) %> leads /tags/:id instead of /tags/:tag , doesn't work. how set up? add following to_param method tag model: def to_param name end

Rails Route URL segment with + (plus) sign character in id is not parsed correctly -

i have tagscontroller class, route following (in routes.rb) resources :tags now, when go http://localhost:3000/tags/test it works correctly. however, when go to http://localhost:3000/tags/c++ rails seems parsing "c++" "c ", results in "404 not found" could give me instructions on how fix this? for rails 4 rails provides constrain options determine regex parameter in routes: this constrains allowing access param /photos/1 or /photos/rr27 resources :tags, constraints: { id: /[a-z][a-z][0-9]+/ } for advance constraint by default :id parameter doesn't accept dots - because dot used separator formatted routes. if need use dot within :id add constraint overrides - example id: /[^/]+/ allows except slash. resources :tags, constraints: { id: /[^\/]+/ } these details of specifying constraint routes. hope can you.

jquery - Mobile menu breakpoint in Foundation -

Image
when resize browser, mobile menu shows @ 568x320 default breakpoint is. so want create breakpoint around 900px rid of menu issue (menu big) see in image below have no idea how it. i've been trying 5 hrs. straight , can't figure out. help? fiddle here . thanks. <nav class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="name"> <h1><a href="#">my site</a></h1> </li> <!-- remove class "menu-icon" rid of menu icon. take out "menu" have icon alone --> <li class="toggle-topbar menu-icon"><a href="#"><span>menu</span></a> </li> </ul> <section class="top-bar-section"> <!-- right nav section --> <ul class="right"> <li class="ha...

android - Select File from file manager via Intent -

Image
what wanna do: i wanna path string of file, choose via android file manager. what have: intent intent = new intent(intent.action_get_content); intent.settype("*/*"); startactivityforresult(intent.createchooser(intent, "open ..."), file_select_code); this code, works fine me, there 1 problem. can select file following apps: my question: does have working code choosing file via android file manager? use this: intent intent = new intent(intent.action_open_document); intent.addcategory(intent.category_openable); intent.settype("*/*"); startactivityforresult(intent, request_code); for samsung devices open file manager use this: intent intent = new intent("com.sec.android.app.myfiles.pick_data"); intent.putextra("content_type", "*/*"); intent.addcategory(intent.category_default); for more reference checkout http://developer.android.com/guide/topics/providers/document-provider.html ...

c# - Update y-axis maximum in chart -

Image
my english not apologize in advance. tried object chart in windowsformsapplication . built program looks this: , code: private void form1_load(object sender, eventargs e) { chart1.dock = dockstyle.fill; chart1.series.clear(); } private void button1_click(object sender, eventargs e) { chart1.series.clear(); chart1.series.add("button1 series"); (int = 1; <= 100; i++) chart1.series[0].points.addxy(i, * 2); } private void button2_click(object sender, eventargs e) { chart1.series.clear(); chart1.series.add("button2 series"); (int = 1; <= 100; i++) chart1.series[0].points.addxy(i, * 4); } when click first button ( button1 ), graph displayed want: if after hit second button ( button2 ), points on y-axis escape out: maximum of y-axis (250) stay same instead change bigger. how can fix program graph not out of area? thanks, , sorry...

python - Recognising Correct Plaintext after Kasiski Examination on Binary File -

i have ran kasiski examination on cipher text file, created through use of modified vigenere cipher. polyalphabetic cipher focuses on swapping sub-bits of each character, key , plain, cipher character. i quite confident know key length, length far long brute force possibilities. also, decoded file not plaintext ascii sort of binary word processing file (pdf, doc, etc) i have found python-magic can identify files header (i think?) still require brute forcing @ least few lines, if not whole file, saving it, testing file see if proper type. any suggestions on how recognize output proper file type? or, better yet, way not have brute force?

python - urllib.error.URLError: <urlopen error [Errno -2] Name or service not known> -

from urllib.request import urlopen bs4 import beautifulsoup import datetime import random import re random.seed(datetime.datetime.now()) def getlinks(articleurl): html = urlopen("http://en.wikipedia.org"+articleurl) bsobj = beautifulsoup(html) return bsobj.find("div", {"id":"bodycontent"}).findall("a",href = re.compile("^(/wiki/)((?!:).)*$")) getlinks('http://en.wikipedia.org') os linux. above script spits out "urllib.error.urlerror: ". looked through number of attempts solve found on google, none of them fixed problem (attempted solutions include changing env variable , adding nameserver 8.8.8.8 resolv.conf file). you should call getlinks() valid url: >>> getlinks('/wiki/main_page') besides, in function, should call .read() response content before passing beautifulsoup : >>> html = urlopen("http://en.wikipedia.org" + articleurl).read...

android - App Inventor: A way to track 2 scores across multiple screens -

i looking way send 2 scores (called coins , gems) treasure game across several screens. class. i have tried tiny db not wipe after each game played , have not found fool proof way make clear if closes game. i have tried using close screen start value 1 value , need have both send next screen. i have tried creating list gems , coins value start value can not continue add scores on next screen , gives me errors. i include screenshots , code @ point jumbled together. have tried make sure each screen closes , sends value has been not successful appreciated. can post whatever helpful! what sounds need umbrella type class. make separate class, name, example, myapp. then make coin , gem values in myapp class. use these values maintain across multiple activities. when done on screen, add values accumulated on screen myapp totals, once new "activity or fragment" screen. initialize screen values myapp class. if want totals cleared upon each start up, make boo...

json - REST - Partial Resources -

it's common in rest design allow partial resources returned. in case; want allow user specify fields of resource returned in json representation of resource. for example lets have resource person: { "id": 12, "name":{ "first":"angie", "last": "smith", "middle": "joy", "maiden": "crowly", }, "address": { "street": "1122 st.", ..and on... }, ... , on } lets list of params pretty long. , lets have api consumer @ beginning of creating api design wants couple fields id , name.first back. i'm assuming it's common allow this: /person?fields=id,name where fields says want fields back. the question have is, should person resource return fields nulls , fields values or should return person representation fields id , name , literally remove other params dynamical...

swt - RCP overrided Composite dispose method not called -

i have created own compound composite extending composite class in e4 application. i have override dispose method never gets called. if add dispose listener on compound composite or of widgets contains listener called. could explain why? here example. public class mycomposite extends composite{ public mycomposite(){ this.adddisposelistener(new disposelistener(){ @override public void widgetdisposed(disposeevent e) { system.out.println("this printed"); } }); } @override public void dispose(){ system.out.println("this not printed"); super.dispose(); } } i have read javadoc dispose method , says: note: method not called recursively on descendants of receiver. means that, widget implementers can not detect when widget being disposed of re-implementing method, should instead listen dispose event. for behaviour seeing , javadoc above, seems dispose method can not override because ignored. interpretati...

javascript - JQuery Highlight plugin, argument somehow undefined -

i'm modifying jquery highlight plugin . want provide title argument in addition element: 'abbr' . here's snippet plugin: jquery.extend({ highlight: function (node, re, nodename, classname, titleval) { if (node.nodetype === 3) { var match = node.data.match(re); if (match) { console.log('title after: ' + titleval); var highlight = document.createelement(nodename || 'span'); highlight.classname = classname || 'highlight'; highlight.setattribute('title', titleval); var wordnode = node.splittext(match.index); wordnode.splittext(match[0].length); var wordclone = wordnode.clonenode(true); highlight.appendchild(wordclone); wordnode.parentnode.replacechild(highlight, wordnode); return 1; //skip added node in parent } } else if ((node.nodetype === 1 && node.childnodes) && // element nodes have chil...

Where to find public .dicom files online -

i know there libraries online can upload .dicom file , view computer need public access .dicom file can download computer. there on-line pacs here url: http://www.dicomserver.co.uk/ nice project. can query/retrieve, store, get, ... here there links sample dicom images: upmc breast tomography , ffdm collection http://www.dclunie.com/pixelmedimagearchive/upmcdigitalmammotomocollection/index.html display shutters in fluoroscopy image test case http://www.dclunie.com/images/fluorowithdisplayshutter.dcm.zip full field digital mammography (ffdm) sample images , cad objects , ihe mammo profile test cases, in mesa tests http://ihedoc.wustl.edu/mesasoftware/10.15.0/dist/data/mesa-storage-b_10_11_0.zip signed range test dicom images http://www.dclunie.com/images/signedrange/ jpeg, jpeg-ls , jpeg 2000 compressed transfer syntax test dicom images @ nema ftp://medical.nema.org/medical/dicom/datasets/wg04 enhanced ct , mr multi-frame test dicom images @ nema ftp://medical.ne...

postgresql - Rails scope where having groupby count -

i have model 'user' can have multiple 'rides' (has_many :rides). ride's table looks this: # table name: rides # # id :integer not null, primary key # user_id :integer # title :text # description :text i want create scope in ride model called 'is_multiple_ride' returns rides have user owns multiple rides. query pretty opposite of distinct(:user_id) the scope have created looks this: scope :multiple_live_listings, -> { where(user_id: ride.group(:user_id).having("count(user_id) > 1").pluck(:user_id)) } this scope works it's inefficient when used multiple chained scopes because querying entire ride table rides(in order pluck ids , use them in scope query) rather checking rides in current query. if there more efficient way please out! using postgresql 9.3.5 , rails 3.2.2, cheers! given user has 3 rides, if want scope return 3 ride...

ios - NSNumber? to a value of type String? in CoreData -

so can't figure out, supposed change '.text' else or have go converting string double? here code if item != nil { // errors keep getting each 1 unitcost.text = item?.unitcost //cannot assign value 'nsnumber?' value of type 'string?' total.text = item?.total //cannot assign value 'nsnumber?' value of type 'string?' date.text = item?.date //cannot assign value 'nsdate?' value of type 'string?' } you trying assign invalid type text property. text property of type string? stated compiler error. trying assign nsnumber or nsdate . expected type string or nil , must ensure provide only 2 possibilities. result, need convert numbers , dates strings. in swift, there no need use format specifiers. instead, best practice use string interpolation simple types numbers: unitcost.text = "\(item?.unitcost!)" total.text = "\(item?.total!)" for dates, can use nsdateformatter p...

java - Library and Book Class, Contructor -

why constructor not reading elements in array of library class? when call element let's csbooks[3] , garbage. public class library { string address; public static book[] booklibrary = {}; public library(string location, book[] s){ address = location; for(int = 0; < booklibrary.length-1; i++){ booklibrary[i] = s[i]; } public static void main(string[] args) { // create 2 libraries book [] books = {new book("the da vinci code"), new book("le petit prince"), new book("a tale of 2 cities"), new book("the lord of rings")}; book [] csbooks = {new book("java dummies"), new book("operating systems"), new book("data structures in java"), new book("the lord ...

c# - Aspose Cells - Preserver the leading zeros in a CSV -

i using aspose cells pretty simple report. problem have few fields have leading zeros. when opened in csv, not see leading zeros. if @ text, can see zeros any ideas how keep leading zeros thanks. i dont feel perfect solution, able results wanted. formatted column string.format("=\"{0}\"", content.account_no)); had interate through rows int curretcol = system.array.findindex<string>(clmary, (string r) => r.tostring() == "account_no"); int currentrow = 1; foreach (glsearchdc content in gllist) { cell cell = worksheet.cells[cellshelper.cellindextoname(currentrow++, curretcol)]; cell.putvalue(string.format("=\"{0}\"", content.account_no)); content.account_no)); }

gen event - What are the differences between Elixir GenEvent's handle_call and handle_event? -

please @ answer below differences found , let me know if wrong or if there more differences. thank you. the difference saw on elixir's documentation handle_call must return reply , handle_event not have return reply it seems me event used change state , call used state.

osx - Control key remap not working in vim -

i'm using macbook pro os x 10.10.5 , vim 7.3. i've got following remap inoremap <c-u> <esc>viwu<esc>ea . obviously, expect word under cursor capitalized after pressing ctrl-u, instead pages up. can't seem figure out why isn't working. see few posts on remapping ctrl cmd i'd prefer stick cntrl - use same settings when working on windows machine. as note, i'm using logitech keyboard, doesn't work on mac keyboard well. inoremap creates insert mode mapping. using <c-u> in normal mode moves page up. your mapping should work if hit <c-u> in insert mode.

javascript - Custom formater calling in jqgrid not worked -

i trying call formatter function jqgrid.i put alert inside formatter function .but not worked.i followed http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter tutorial. here code function jqgridmethod() { var jsondata = { "model" : [ { "name" : "code", "index" : "code", "width" : "100", "sortable" : false, "editable" : false, formatter : "showlink", formatoptions : { baselinkurl : 'javascript:', showaction : "seasonedit('", addparam : "');" } }, { "name" : "name", "index" : "name", "width" : 100 },{ "name" : "colorcode", "index...

linux - Aria2 max-connection not working -

i installed aria2 (1.18.1) in ubuntu. problem can not increase download connection. aria2c -x 10 http://mirror.sg.leaseweb.net/speedtest/100mb.bin [#fe34b4 2.1mib/95mib(2%) cn:4 dl:233kib eta:6m49s] by default download 4 connection not 10 (as given). try sites, default 4 connection carried out while downloading solved:- there multiple options influence behavior: --split -s maximum number of concurrent splits (connections) per download. defaults 5, unless changed it, max 5 connections single download no matter -x. --min-split-size -k split should initiated when split bigger this. defaults 20m, meaning when download 100m file, time download split data retrieved means less less 100mb remaining, meaning 4 splits (5 splits create splits less 20mb). there have it. please check out manual more information on various options. $ aria2c -k 1m -s 10 -x 10 http://mirror.sg.leaseweb.net/speedtest/100mb.bin [#1325f1 7.4mib/95mib(7%) cn:10 dl:1.2mib eta:1m8s]

Perform xpath function on an xform output node -

i've got xform output element references "time" node in model contains string "00:12:34,567". i'd text of output element substring "00:12:34". didn't quite expect work maybe you'll i'm trying do. <xf:output ref="substring-before(//time[1],',')"> <xf:label>time</xf:label> </xf:output> a ref attribute pointing atomic value should work per xforms 2.0, maybe implementation doesn't support feature yet. try use value attribute, more appropriate here anyway: <xf:output value="substring-before(//time[1],',')"> <xf:label>time</xf:label> </xf:output>

Exception while trying to get value from a json object in java webservice -

when tried value json object in java webservice side getting runtime exceptions,please find exception getting below: when tried value json object in java webservice side getting runtime exceptions, please find json object below: {"data":[{"userid":657,"name":"eliina","username":"admin","aim_name":" eliina ","aim_title":"administrator","password":"eli456456","role":1,"rolename":"client ain","clientno":"540","id":8,"client_name":"eliina","defaulturl":"clientsettings.htm","attempts":0,"aimaccess":1}]} please find java method wrote: public void insertlist(string ip, jsonobject loginresult) { try{ string n = loginresult.getstring("data"); } catch( jsonexception je ) { je.printstacktrace(); } } please...

html - Hovering on element and making another element appear at the same time -

i've been trying figure out long time , can't seem it. have following html: <div class="b"> <button>show when hover</button> </div> <div class="a">when hover on background should change</div> with corresponding css: .b { float: right; display: none; } .a { float: left; display: inline; width: 1000px; } .a:hover { background: gray; } .a:hover + .b { display: block; } what i'm trying whenever hover on a b div , corresponding button should show. in addition, want such when mouse on button, background of a still gray if hovering on it. can't seem figure out. ideas? relevant jsfiddle: http://jsfiddle.net/sn19k1wz/3/ you can changing position of a , b <div class="a">when hover on background should change</div> <div class="b"> <button>show when hover</button> </div>

excel - Column values to be replaced with another column's values -

Image
i have excel file '|' separated values in it: 20120615|user 1|mak||tobereplaced|20150114 20120615|user 1|mak||tobereplaced|20150115 20120615|user 1|mak||tobereplaced|20150116 20120615|user 2|mak||tobereplaced|20150114 20120615|user 2|mak||tobereplaced|20150115 20120615|user 2|mak||tobereplaced|20150116 20120615|user 3|mak||tobereplaced|20150114 20120615|user 3|mak||tobereplaced|20150115 20120615|user 3|mak||tobereplaced|20150116 i have excel spreadsheet has names of managers. eg manager1 manager2 manager3 manager4 now want managers names replaced column values tobereplaced each user. i.e 20120615|user 1|mak||manager1|20150114 20120615|user 1|mak||manager1|20150115 20120615|user 1|mak||manager1|20150116 20120615|user 2|mak||manager2|20150114 20120615|user 2|mak||manager2|20150115 20120615|user 2|mak||manager2|20150116 20120615|user 3|mak||manager3|20150114 20120615|user 3|mak||manager3|20150115 20120615|user 3|mak||manager3|20150116 that should go on replacing us...

c# - Return new incoming call uri -

i'm using simple code incoming call , uri of caller. if user have multiple lync sessions open return first 1 because of static index. how i'm able new connection index proper uri of caller? imports microsoft.lync.model imports microsoft.lync.model.conversation imports lync = microsoft.lync.model.conversation public class mylync private _lyncclient lyncclient public withevents _conversationmgr microsoft.lync.model.conversation.conversationmanager public withevents _conv conversation private sub form1_load(sender object, e eventargs) handles mybase.load try _lyncclient = lyncclient.getclient() _conversationmgr = _lyncclient.conversationmanager catch ex exception end try end sub private sub _conversationmgr_conversationadded(byval sender object, byval e microsoft.lync.model.conversation.conversationmanagereventargs) handles _conversationmgr.conversationadded addhandler e.conversation.modalities(mo...

reading only some strings from a file and storing it in stack in java -

the file is: the lord of rings j.r.r. tolkein great expectations charles dickens green eggs , ham dr. seuss tom sawyer mark twain moby dick herman melville 3 musketeers alexander dumas hunger games suzanne collins 1984 george orwell gone wind margret mitchell life of pi yann martel it has title of book in first line , in next line has author. i want read first 5 books , authors file , store in stack. add first 2 books author in stack , remove last one. how can it? did stack<book> readinglist = new stack<>(); file myfile = new file("books.txt"); scanner input = new scanner(myfile); int = 0; while (input.hasnext()) { readinglist.push(new book(input.nextline(), input.nextline())); system.out.println("adding: " + readinglist.lastelement().getinfo()); readinglist.push(new book(input.nextline(), input.nextline())); system.out.println("adding: " + readinglist.lastelement().getinfo()); ...

angularjs - How can I remove the need to use $scope with ui-router and services? -

my ui-router configuration looks this: var homeaccess = { name: 'home.access', url: 'access', templateurl: 'app/access/partials/webapi.html', controller: [ '$scope', 'accessservice', 'testservice' function ( $scope, accessservice: iaccessservice testservice: itestservice) { $scope.ac = accessservice; $scope.ts = testservice; }] }; in html use accessservice , testsaervice this: <input ng-model="ac.statustext" /> <input ng-model="ts.text" /> from understand better if not use $scope. can tell me how implement without using $scope? i don't see point unless you've got legitimate reasons avoiding $scope (see angularjs - why use "controller vm"? ). being said, can use controller as expressio...

Implement R-Files from subfolders into Shiny -

i want stick kiss (keep simple, stupid) principle within shiny app ( http://code.tutsplus.com/tutorials/3-key-software-principles-you-must-understand--net-25161 ). so created folder , subfolders , saved peaces of code uses in server.r functions , .r files. here 2 examples of 2 saved .r files: output$mychoices <- renderui({ selectinput(inputid = 'x', label = 'y', choices = levels(mydataset$df$z), multiple = t ) }) or absolutematrix <- reactive({ lifechar <- switch(as.integer(input$something), "abc", "def", "ghi", "jkl", "mno" ) if( (myboolean$absolute == true) && (length(input$xy) != 0) ){ if( (length(input$gh) == 0) ) { return(mydata()[,grepl(lifechar, names(mydata()))] %>% na....

java - Printing a number next to each String -

i have method prints out elements of string array not null. desired output: 1. cook 2. chef 3. baker 4. butcher 5. distiller output getting: 1. cook 3. chef 4. baker 7. butcher 9. distiller the numbers aren't consecutive in first example. it's because it's printing 'i' when 'i' not null. there anyway can make first example? i've tried different solutions none of them seem work. public class main { public void testmethod() { string myarray[] = new string [] { "cook", null, "chef", "baker", null, null, "butcher", null, "distiller" }; (int = 0; < myarray.length; i++) { if (myarray[i] != null) system.out.println((i + 1) + ". " + myarray[i]); } } public static void main(string[] args) { main main = new main(); main.testmethod(); } } just keep counter: public void testmethod() { string myarray[] = new string [] { "cook...

amazon web services - EC2 used space increases after resizing volume -

i have followed aws guide expand 8gb volume 16gb. what have done is: take snapshot of 8gb volume create new 16gb volume snapshot detach 8gb volume ec2 instance, attach 16gb volume ec2 instance after that, df -h : filesystem size used avail use% mounted on /dev/xvda1 16g 11g 5.3g 67% / why used size increase 11g? should 8g. while disk 'bigger', partition has not yet been extended cover new disk space. use sudo resize2fs /dev/xvda1 extend disk partition include additional space on disk. see: extending linux file system on same page.

asp.net - How do I change the format of a specific column in EPPlus? -

Image
i've used epplus download datatable website / database excel sheet , first picture result get. second picture be. questions: how change format of timestamp "time"? obviously title still string format. how make width of columns match longest word inside? so 80% of message isn't hidden , have drag column out read entire message. edit: forgot add code... public actionresult exportdata() { datatable datatable = getdata(); using (excelpackage package = new excelpackage()) { var ws = package.workbook.worksheets.add("my sheet"); //true generates headers ws.cells["1:1"].style.font.bold = true; ws.cells["a1"].loadfromdatatable(datatable, true); ws.cells[ws.dimension.address].autofitcolumns(); var stream = new memorystream(); package.saveas(stream); strin...

excel lookup with mulitple answers -

hi trying work out formula give me results of days visited. eg. 1040 came in monday, tuesday , friday. can please me out! member spend sunday monday tuesday wednesday thursday friday saturday 1040 $100 0 2 2 1 1 2 1 11509 $300 1 0 0 3 1 1 2 1178 $500 1 0 3 3 2 0 0 as little beginning use function concatenate max , e.g. =concatenate(if(a2=max(a2:g2);a1;);if(b2=max(a2:g2);b1;)) and on rest of needed cells

java - Implementing a Stack<E> using Vector<E> -

i using stack in following way... have problem here in line 26: import java.util.vector; public class stack<e> { private vector <e> v=new vector <e>(1); public int getsize() { return v.size(); } public boolean isempty() { return (v.isempty()); } public e gettop() { return v.lastelement(); } public e pop() { e p; if (!isempty()) { p = v.lastelement(); v.remove(v.size() - 1); } /*return p; here?? when stack empty how return , to?* / } public void push(e p) { v.add(p); } } one way go although not advised return null: public e pop() { e p = null; if (!isempty()) { p = v.lastelement(); v.remove(v.size() - 1); } return p; it better if can provide default constructor(s) type(s) used within stack can check afterwards if object valid or not. e p = new e(); // invalid object you might want check out null object p...

javascript - How to run a Python script upon button click using mod_python without changing browser window -

i using mod_python publisher set , working fine. allows me run python file in browser , python file has html embedded in it. have defined click-able image input type = "image" onclick = "some action" . when click image takes me javascript function performs window.location = "./move" takes me python function. problem browser window redirects function, i. e. localhost/scripts becomes localhost/scripts/move . possible execute script without having browser window change? can post code if needs be. in fact, i've found using ajax/xmlhttprequest simple , work that, if server python simpleserver style. you link javascript code button: // send request, don't refresh page xhttp = new xmlhttprequest(); xhttp.open("get", "?like", true); xhttp.send();

sql server - Detecting split character in string -

recently had problem splitting html string separate columns in access 2010 , store date in sql server 2008r2 table. works more or less because number of lines varies. to avoid storing html-tags have easier solution, use text field in access formated standard while other text-field formated rich-text contain format. inserting same content, copied html mail in standard text field maintains line feed ! how can "detect" character replace character further use?? example: <div><font face=arial size=3 color=black>customer name</font></div> <div><font face=arial size=3 color=black>customer address</font></div> <div><font face=arial size=3 color=black>12345 city</font></div> is copied content html mail , inserted rich-text field. if copy content standard text field looks this: customer name customer address 12345 city in server table content of field looks this customer name customer addre...

opencv - Human recognition using Template matching -

i using emgu-cv identify each person in big room. camera static , in-door. count number of persons visited room, want recognize each person if got images in different angles @ different times in day. i using haar classifiers detetct face, heads , full body image , comparing detected image portions using template matching can recognize person. getting poor results. right approach problem ? can suggest better approach ? or there better libraries available can solve problem ? i think template matching weak point in system. suggest training haar cascade each person individually result replace (detecting + recognition) (detect precise object). sure if number of people want recognize rather small. or can use other stuff surf note licence.

php - How to create a action button that creates users in codeigniter? -

Image
i have 3 users admin,reseller , users. reseller request admin want xyx number of users. this saved in table called user_request in admin there view can see reseller has requested how many users. and there button approve or reject. if admin hits approve want code create users reseller. each users mapped his/her reseller field called key unique. so, when users created must store key of reseller in users table. now, if approves users request re-seller must deleted. confused should doing here! the view : <div class="row"> <div class="col-lg-12"> <div class="panel panel-info"> <div class="panel-heading"> <h4>new user requests</h4> </div> <!-- /.panel-heading --> <div class="panel-body"> <div class="datatable_...

c++ - How can I make a point cloud shared? -

i'm working on kinect v2 , grabber run it. encountered problems wanting write cloud information on pcd . @ code: int main(int argc, char* argv[]) { boost::shared_ptr<pcl::visualization::pclvisualizer> viewer(new pcl::visualization::pclvisualizer("point cloud viewer")); viewer->registerkeyboardcallback(&keyboard_callback, "keyboard"); viewer->registermousecallback(&mouse_callback, "mouse"); pcl::pointcloud<pcl::pointxyzrgb>::constptr cloud; boost::function<void(const pcl::pointcloud<pcl::pointxyzrgb>::constptr&)> function = [&cloud](const pcl::pointcloud<pcl::pointxyzrgb>::constptr &ptr){ boost::mutex::scoped_lock lock(mutex); cloud = ptr; }; pcl::grabber* grabber = new pcl::kinect2grabber(); boost::signals2::connection connection = grabber->registercallback(function); grabber->start(); while...

delphi - Convert the numbers of a set to String -

i save numbers myset = set of 1..8 mystring : string . there function inttostr can this? i have scheduler, takes in string in form of (* * * * * * * *) . 1 of stars represents days of execution, , myset list of days. example 1 monday, 2 tuesday. have save numbers set string, this: (0 0 15 * * * 1,2,3 *) . means, scheduler trigger every monday, tuesday, wednesday @ 15:00. if want read more format: http://www.nncron.ru/help/en/working/cron-format.htm use for..in iterator produce wanted string: type myset = set of 1..8; function mysettostring(const s: myset): string; var i: integer; begin result := ''; in s begin result := result + inttostr(i) + ','; end; setlength(result,length(result)-1); end;

php - Add FedEx Shipping in drop down prestashop shopping cart -

Image
i using fedex shipping in prestashop , shipping showing in table radio buttons. i want display shipping drop down , in shopping cart table below last product in cart list. please see image below what have done included order-carrier.tpl file place wanted display works when page loads , change shipping options list every things gets blank , distorted. {include file="$tpl_dir./order-steps.tpl"} i understand not right way. need hook . don't know how this. beginner prestashop user . please help/ guide me. there no default hooks in place, can create new , use in module. or check order-carrier.tpl in theme folder, there default hooks, can use code.

angularjs - How to design overlaying views in Angular.js? -

my app using angular , ui-router . there 2 pages, first page (state : "book") shows categories , book list. book item clicked, page switch book detail (state: "bookdetail"). however, when switch book list, reload view , not preserve scroll , other stuff. in opinion, relation of book list , book detail more relation of content , modal, not parallel views. find hard understand modal in ui-router state system, because modal not navigating specific view, rather overlaying it. any solution operating views modal , routerizing state ? $stateprovider.when('booklist',{ url : '/booklist', ... }).when('booklist.bookdetail',{ url : '/bookdetail/{bookid}' }).when('booklist.buybook',{ url : '/bookdetail/{bookid}' ... }) as above, child views should overlay parent view, , removed when url goes back.

javascript - jQuery - Multiple Email Addresses in Input Field -

Image
i working on form allow users enter multiple email addresses in input field. by searching around net cam across jquery plugin: http://t2a.co/blog/index.php/multiple-value-input-field-with-jquery/ (function( $ ){ $.fn.multipleinput = function() { return this.each(function() { // create html elements // list of email addresses unordered list $list = $('<ul />'); // input var $input = $('<input type="text" />').keyup(function(event) { if(event.which == 32 || event.which == 188) { // key press space or comma var val = $(this).val().slice(0, -1); // remove space/comma value // append list of emails remove button $list.append($('<li class="multipleinput-email"><span> ' + val + '</span></li...

javascript - Re-fill area of erased area for canvas -

i trying fill color in image using below code snippet filling color on image of canvas . filling color in canvas. trying erase filled color on touch of user using code snippet erasing color on image of canvas . erasing color & setting transparent area on touched position. want refill area on user touch colors not allowing me color on because of transparent pixels. there way refill pixels color or there other way erase color image of canvas ? reply appreciated. code snippet filling color on image of canvas var ctx = canvas.getcontext('2d'), img = new image; img.onload = draw; img.crossorigin = 'anonymous'; img.src = "https://dl.dropboxusercontent.com/s/1alt1303g9zpemd/ufbxy.png"; function draw(color) { ctx.drawimage(img, 0, 0); } canvas.onclick = function(e){ var rect = canvas.getboundingclientrect(); var x = e.clientx-rect.left, y = e.clienty-rect.top; ctx.globalcompositeoperation = 'sour...

SQL server query for selecting data with 5 seconds interval -

can tell me t-sql script selecting data interval of 5 seconds? have scada system logs data parameter every second want retrieve data interval of 5 sec, start time decided user. example if start = 10:00:01 , end 11:00:00 want see data @ 10:00:06, 10:00:11, 10:00:16... not data @ 10:00:02, 10:00:03 10:00:05, , between 10:00:07 , 10:00:10 i first create dummy data every second 10:00 10:16 declare @data table(creation datetime2); declare @start datetime = '20150930 10:00:00'; declare @end datetime; -- create dummy data 10:00:00 10:16:40 ids(n) ( select row_number() over(order n) ( select 1 (values(1), (1), (1), (1), (1), (1), (1), (1), (1), (1)) x1(n) cross join (values(1), (1), (1), (1), (1), (1), (1), (1), (1), (1)) x2(n) cross join (values(1), (1), (1), (1), (1), (1), (1), (1), (1), (1)) x3(n) ) x(n) ) insert @data(creation) select dateadd(second, n, @start) ids i calculate difference in second between start date , creation date ...

removechild - Delete all occurences from JSON Array -

i have 32mb-json-file represents database. has following structure: { "players": [ { "item1":"a" "item2":"b" "item3":"c" }, { "item1":"d" "item2":"e" "item3":"f" } { ... } ] } in order reduce weight, i'd delete "item1" , associated values. best way it? mean manually text editor. you can use sublime text this: select find > replace switch regular expressions (alt + r) in find enter regular expression: . "item1". \n leave replace empty click replace all after sample looks this: { "players": [ { "item2":"b" "item3":"c" }, { "item2":"e...