Posts

Showing posts from March, 2011

python - Brand new to scipy/numpy and attempting some batch manipulation -

python - Brand new to scipy/numpy and attempting some batch manipulation - so, have bunch of scanned images annoying white around them want remove. i'm prepping algorithm using numpy arrays find closest pixel row , columns of finish white, cropping them positions. code: from scipy import misc import os import datetime a0 = datetime.datetime.now() print("imported @ " + str(a0)) def run(): inputdir = '/users/nicholasezyk/documents/funeralhomescans' os.chdir(inputdir) #batch image renaming counter = 1 file in os.listdir(inputdir): if file.endswith('.jpg'): img = misc.imread(file) print(file + ' beingness analyzed.') cropx = -1 cropy = -1 lx = img.shape[0] ly = img.shape[1] countx = 0 county = 0 while countx < lx: pix = img[countx, 0] if pix == (255, 255, 255): ...

winapi - C++/Win32: How to wait for a pending delete to complete? -

winapi - C++/Win32: How to wait for a pending delete to complete? - solved: * workable solution: @sbi * explanation happens: @hans * explanation why openfile doesn't pass through "delete pending": @benjamin the problem: our software in big part interpreter engine proprietary scripting language. scripting language has ability create file, process it, , delete file. these separate operations, , no file handles kept open in between these operations. (i.e. during file create handle created, used writing, closed. during file processing portion, separate file handle opens file, reads it, , closed @ eof. , finally, delete uses ::deletefile has utilize of filename, not file handle @ all). recently we've come realize particular macro (script) fails able create file @ random subsequent time (i.e. succeeds during first hundred iterations of "create, process, delete", when comes creating hundred , first time, windows replies "access denied")....

How to show google video snippet in SERP without paid search? -

How to show google video snippet in SERP without paid search? - i have follow same construction http://www.dailymotion.com/ while dailymotion display not site. reason? video thumbnail not display on serp . mysite http://www.easywebvideo.com/ i have submit sitemap google.site map http://www.easywebvideo.com/video_sitemap/files/sitemap_1.xml i have follow same construction http://www.dailymotion.com/ while dailymotion display not site. reason? try seacrh "door knob hanger printing boone north carolina" in google. video google-search

javascript - Responsive Canvas in Bootstrap -

javascript - Responsive Canvas in Bootstrap - i'm trying responsive canvas. tests has been doing 600x600 canvas , height , width works ok , paint every line correctly. problem have tried this: #mycanvas { background-color: #ffffff; border:1px solid #000000; min-height: 600px; height: 100%; width: 100%; } just record, mycanvas within sm-col-8. and looks nice on laptop , looks nice on phone (because of draw() function, because thinking square) draw starts more in down-left corner (nearby) , should start @ up-right corner. so, don't want alter draw() function i'm looking reescale canvas size. mean: if i'm in laptop/tablet.. 600x600, show @ size, if i'm on phone has 384x640 show 300x300? don't know if solution. my draw function: function drawlines(lines,i,table,xtotal,ytotal){ var c = document.getelementbyid("mycanvas"); var ctx = c.getcontext("2d"); var xini; var xfin; var yini; ...

keylistener - Listening for input without focus in Java -

keylistener - Listening for input without focus in Java - i'm making little programme in java using robot class. programme takes on mouse. while in course of study of debugging if starts acting in way don't want it's hard quit program, since can't move mouse on terminate button in eclipse, , can't utilize hotkeys nail because mouse constant clicking in window, giving window focus instead. what i'd hook keylistener when nail q can quit program, way know how involves making window, , window needs focus capture input. there way hear keyboard or mouse input anywhere, regardless of has focus? this not trivial problem , java doesn't give way elegantly. can utilize solution banjollity suggested won't work time if errant mouse clicks open fullsized window open in taskbar example. the fact is, java default gives developers little command on os. due 2 main reasons: security (as citied java documentation) , fact different operating syste...

javascript - Swfobject video doesn't work in IE9 -

javascript - Swfobject video doesn't work in IE9 - i have such swfoject shows video in site. works fine @ browsers except ie 9. can problem? <script src='http://...js/swfobject.js'></script> <div id='video' style='width: 640px; height: 480px;'></div> <script > swfobject.embedswf('http://...js/swfobject.js', 'video', 640, 480, '10.3', 'false', {file:'cam210.0', streamer:'rtmp://1111111111.../1111111111', 'rtmp.tunneling':false, autostart:true}, {allowfullscreen : 'true', allownetworking : 'all'}); </script> update <iframe id='video' name='iframeanimfx' src='http://xmpp.feelinhome.ru:8080/flu/js/swfobject.js' height='600' width='900'></iframe...

What is the meaning of daimond bracket in java generics containg two types List<car> -

What is the meaning of daimond bracket in java generics containg two types List<car<u>> - whats list<car<u>> ?,what meaning of 2 parameters within list?am new generics , illustration code picked online...explain pls! package generics; import java.util.arraylist; import java.util.list; class car<t>{ private t t; public t gett() { homecoming t; } public void sett(t t) { this.t = t; } } public class carlist{ public static <u> void addcar(u u, list<car<u>> cars){ //whats list<car<u>>?,what meaning of 2 parameters within list? car<u> car=new car<>(); car.sett(u); //could expalin above code cars.add(car); } public static void main(string[] args) { arraylist<car<string>> carlist=new arraylist<>(); carlist.addcar("audi", carlist); } } first have @ auto class, al...

asynchronous - Most efficient way to provide EJB @Aynchronous methods for stateless logic -

asynchronous - Most efficient way to provide EJB @Aynchronous methods for stateless logic - i need create ejbs provide @aynchronous methods. some of ejbs have no state whatsoever. some might have cdi-injected (using @inject ) threadsafe instance variables @applicationscoped . is next efficient way this?: @singleton @concurrencymanagement(bean) public class ejbclass { @asynchronous public void asyncmethod() { //some code } } my sec guess use: @stateless instead of pair of @singleton & @concurrencymanagement(bean) . but there shouldn't need more 1 instance of of these ejbs, so, unless i'm missing gotcha @singleton , imagine @singleton efficient. i using ejb 3.2 in glassfish 4.1. i agree assessment @singleton + @concurrencymanagement(bean) fit problem description. highlight, @stateless has disadvantage might build multiple instances if there concurrent calls. overhead probably, might avoid since it's easy so. ...

php - Updating row in database from android app -

php - Updating row in database from android app - i'm trying update row in database via android app. pulling database working i'm having problem updating. code updating follows: my asynctask class: private class updateanimaltask extends asynctask<void, void, boolean> { @override protected boolean doinbackground(void... arg0) { seek { id = (edittext) findviewbyid(r.id.etid); name = (edittext) findviewbyid(r.id.etname); type = (edittext) findviewbyid(r.id.ettype); breed = (edittext) findviewbyid(r.id.etbreed); gender = (edittext) findviewbyid(r.id.etgender); injuries = (edittext) findviewbyid(r.id.etinjuries); treat = (edittext) findviewbyid(r.id.ettreat); string nm = name.gettext().tostring(); string tp = type.gettext().tostring(); string br = breed.gettex...

antlr4 - Building custom Parse Trees in ANTLR v4 -

antlr4 - Building custom Parse Trees in ANTLR v4 - question: there (more straightforward) way of building custom parse trees @ parse time in antlr v4? i guess 1 traverse , rewrite automatically built tree wondering if can still manual tree building (or tweaking, matter) @ parse time (similar antlr v3 , ealier). thought that, depending on how 1 writes his/her grammar, lot of useless nodes in antlr-built tree , while can override listener methods involvement you, 1 still has check , skip useless token types, etc. no, our experience antlr 3 manual ast feature inevitably resulted in code more hard maintain , understand, leading high rate of regression bugs developers making alter grammar. tokens no longer omitted tree since it's hard tell terminals needed future releases of application, , don't want have change/verify of code operating on parse tree if terminal unused required new component or feature. antlr4 parse-tree

ios - Accessing data from HealthKit with Swift -

ios - Accessing data from HealthKit with Swift - i'm finish noob @ swift (and xcode), matter of fact, programming language (somewhat) know javascript. i'm trying create swift spritekit game, , access number of calories burned in healthkit. the thought game provide more points more calories fire using other apps endomondo. app not track anything, access other info left other apps in health app. is possible? (i'm running latest version of everything, mac os x xcode) certainly. don't think there technically preventing making calls healthkit apis in game. in fact, you're free mix , match utilize of public frameworks provided on ios. one thing maintain in mind privacy , disclosure of utilize of health data. user have explicitly grant app permission see data. healthkit rich api lots of ways access lots of different kinds of data, , you're interested in little part right now, quick way experiment create new swift spritekit game new proje...

jqgrid column resize after manually width change -

jqgrid column resize after manually width change - i have function manually set width of jqgrid column. if after want utilize resize handle, adds or substracts relative original width size. doesn't see new width take base. have tried putting width , withorg in colmodel without success. i have click handler inwhich resize column width on click. set width of th trought js. after able utilize .ui-jqgrid-resize element resizing column. a short version of code, th 200px wide: $('th').dblclick(function(){ $(this).width('100px'); }); after user doubleclicked, , th went smaller in size 100px , user uses resize handle widen th 10px . expected result th of 110px wide, th jumps 210px wide. adds 10px user wanted add together original state, not state have set doubleclick. i recommend utilize setcolwidth method, plugin wrote before (see the answer), alter width of grid column. can download current version of plugin github. if trying ...

google chrome - Matching content script with last keyword match -

google chrome - Matching content script with last keyword match - i have page in block.html in extension directory. want match content script page name. check manifest file below, there content_script match: { "manifest_version": 2, "name": "cobra security atd", "version": "1.0", "description": "cobra security advance threat defence.", "icons": { "48": "img/48-48.png", "128": "img/128-128.png" }, "browser_action": { "default_icon": "img/16-16.png", "default_title": "cobra security advance threat defence", "default_popup": "popup.html" }, "background": { "scripts": ["js/jquery-1.11.1.js","js/event.js"], "persistent": false }, "content_scripts": [ { ...

html - Javascript not alerting input value -

html - Javascript not alerting input value - the code below isn't working expected. have excluded rest of tags. whenever execute html, alert alerts nil @ all. has encountered problem before? <p><input type="text" id = "earth"> come in weight on earth.<br><br></p> <script type="text/javascript"> function calculate() { var weight = input.earth.value; window.alert(weight); } </script> you're not getting element correctly - input.earth means nothing. should utilize getelementbyid() : var weight = document.getelementbyid('earth').value; javascript html web

entity framework - Remove stubborn default value in DateTime text box in partial view - Asp.net MVC 5 -

entity framework - Remove stubborn default value in DateTime text box in partial view - Asp.net MVC 5 - i have partial view controls in it. 1 of them textbox used come in datetime value in it. datetime textbox readonly , , type attribute text (to prevent browser date selector popup beingness shown). datetime property in model class in not nulable , unique. cannot nullable . since textbox read only, datetime value entered using jquery datepicker timepicker addon, clicking in textbox , selecting relevant date in datepicker popup. important: although partial view embedded in normal view, not rendered in it. partial view, form, displayed in jquery modal when user clicks action link on normal view. partial view embedded html.action method. everything works should. problem is, however, when partial view shown in jquery modal, datetime text box shown placeholder text monday 01, january, 0001 . on other pages in application datetime controls in them, needed alter type attribu...

node.js - How to "wake-up" an Azure webjob from within a mobile service? -

node.js - How to "wake-up" an Azure webjob from within a mobile service? - let's have azure webjob configured singleton, , running "continuously" in free-site context. according azure specifications, after period start webjob shut down, unless maintain running: as of march 2014, websites in free mode can time out after 20 minutes if there no requests scm (deployment) site , website's portal not open in azure. requests actual site not reset this. however, that's fine me. goal "waking-up" webjob instance upon invocation of mobile-service custom api, basic next example: exports.post = function(request, response) { //ensure webjob running, in case wake var rq = require('request'); rq("http:// ??? (any site invoke?) ", function(error, response, body) { //do nil }); //do specific stuffs related mobile service var rtn = { message : 'hello world!' }; rtn.req = reque...

python - Storing uploaded dynamic media in Django -

python - Storing uploaded dynamic media in Django - i'm making blog django, , i'm wondering should store photos go along articles. should media folder go within articles app, or in main project folder? seems should go within app if want add together more functionality app, can have own media folder , maintain them separate. however, since have add together media_root, seems things set media has go same place. case, or not understanding correctly? can assign multiple media_roots? the 'correct' way have stored in media_root , , each filefield specify own sub directory using upload_to keyword argument. the reason want stored in single media_root folder configuring web server serve files statically simple- 1 configuration directive serve entire folder (rather having configure serving files multiple locations). python django

jquery - animationend is triggerd only once in firefox -

jquery - animationend is triggerd only once in firefox - i want create simple slider css animation , play code: http://tympanus.net/development/imagetransitions/index6.html. seems works in desktop browsers tested except firefox. in firefox animationend event triggered 1 time reason. have ideas why animationend event triggerd 1 time firefox , works ok in other browsers? css: .te-example4.te-show .te-front{ animation: example4front 0.8s ease-in-out forwards; -ms-animation: example4front 0.8s ease-in-out forwards; -moz-animation: example4front 0.8s ease-in-out forwards; -o-animation: example4front 0.8s ease-in-out forwards; -webkit-animation: example4front 0.8s ease-in-out forwards; } @keyframes example4front{ 0% { transform: translatex(0); z-index: 3;} 50% { transform: rotatez(-5deg) translatex(-339px); z-index: 3;} 51% { z-index: 1;} 100% { transform: rotatez(0deg) translatex(0px); z-index: 1;} } @-moz-keyframes example4front{ 0% {...

javascript - Make tag clickable with Angular -

javascript - Make <i> tag clickable with Angular - i'm using semantics ui styling html5 app. added facebook share button follows: <i ng-click="posttofacebook(competitor.title, competitor.votes)" class="icon facebook"></i> but when hover on icon cursor doesn't alter hand cursor appears on clickable link. i tried wrapping anchor tag: <a><i ng-click="posttofacebook(competitor.title, competitor.votes)" class="icon facebook"></i></a> but made icon disappear completely. you can wrap icon in <a> , specify href attribute create link (place nil in href ): <a href="javascript:"><i ng-click="posttofacebook(competitor.title, competitor.votes)" class="icon facebook"></i></a> javascript html css angularjs

html5 - can normal hlml5 tags be used in ionic framework to give square buttons -

html5 - can normal hlml5 tags be used in ionic framework to give square buttons - i trying give square buttons in app made using ionic framework. displaying blank. help? here http://codepen.io/sanand29/pen/mkkvw <table> <tr> <td> <div class="dummy"></div> <div class="content">1</div> </td> <td> <div class="dummy"></div> <div class="content">1</div> </td> <td> <div class="dummy"></div> <div class="content">1</div> </td> </tr> <tr> <td> <div class="dummy"></div> <div class="content">1</div> </td> <td> <div class="dummy"></div...

sql - Access Removing CERTAIN PARTS of Duplicates in Union Query -

sql - Access Removing CERTAIN PARTS of Duplicates in Union Query - i'm working in access 2007 , know nil sql , very, little vba. trying union query bring together 2 tables, , delete duplicates. but, lot of duplicates have info in 1 entry that's not in other. it's not 100% exact duplicate. example, row 1: a, b, blank row 2: a, blank, c i want merge both of these end 1 row of a, b, c. i found similar question on here don't understand reply @ all. help appreciated. i suggest query this: select coalesce(t1.a, t2.a) a, coalesce(t1.b, t2.b) b, coalesce(t1.c, t2.c) c table1 t1 inner bring together table2 t2 on t1.key = t2.key here, have used keyword coalesce . take first non null value in list of values. note have used key indicate column same between 2 rows. illustration looks a cannot sure. sql database duplicates ms-access-2007 union

Replace ubuntu desktop version with server version(14.04) alongside windows server 2008 -

Replace ubuntu desktop version with server version(14.04) alongside windows server 2008 - i remove ubuntu 14.04 desktop version installled alongside of windows server 2008 version , need install ubuntu 14.04 server version. not ubuntu expert, , experience, deleting partition containing ubuntu desktop version lead error grub rescue or related bootloader , won't able boot windows. there way avoid , want. help regarding highly appreciated. pardon me, first question in stackoverflow, not sure if there criterion asking question. thanks, shoukath try solution shoukath ali.glad find here http://www.howtogeek.com/141818/how-to-uninstall-a-linux-dual-boot-system-from-your-computer/ windows-server-2008 ubuntu-14.04 bootloader

c++ - main.c:(.text+0x30): undefined reference to `reciprocal' -

c++ - main.c:(.text+0x30): undefined reference to `reciprocal' - i trying first programme of advance linux programming. other guys felt problem reading thread not helping me. tried methods problem still there. please help me. here main.c #include <stdio.h> #include "reciprocal.hpp" int main(int argc, char const *argv[]) { int i; = atoi(argv[1]); printf("the reciprocal of %d %g\n", i, reciprocal(i)); homecoming 0; } listing reciprocal.cpp #include <cassert> #include "reciprocal.hpp" using namespace std; double reciprocal(int i) { //i should not 0 assert(i != 0); homecoming 1.0/i; } listing reciprocal.hpp #ifdef _cplusplus extern "c" { #endif extern double reciprocal (int i); #ifdef _cplusplus } #endif listing makefile: reciprocal: main.o reciprocal.o g++ $(cflags) -o reciprocal main.o reciprocal.o main.o: main.c reciprocal.hpp gcc $(cfl...

Symfony 2 Validation Form -

Symfony 2 Validation Form - i new , need help. i have problem when seek validate form. below different files: amiattrbtype.php <?php namespace site\testbundle\form; utilize symfony\component\form\abstracttype; utilize symfony\component\form\formbuilderinterface; utilize symfony\component\optionsresolver\optionsresolverinterface; class amiattrbtype extends abstracttype { /** * @param formbuilderinterface $builder * @param array $options */ public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('email','text', array( 'required' => true, 'attr' => array( 'placeholder' => 'adresse mail' ))) ->add('produitsattrb','collection', array( 'type' => new produitattrbtype() )); } /** * @param optionsresolverinterface $resolver */ ...

java - Need to restart JBoss after each test -

java - Need to restart JBoss after each test - i have complex testcase breaks downwards entitymgr.persist(rra); . first time start testcase after jboss eap 6.2.4 has been started, succeed expected. sec time start testcase, fail next exception: javax.ejb.ejbexception: javax.persistence.persistenceexception: org.hibernate.propertyaccessexception: illegalargumentexception occurred calling getter of de.nvg.aelkf.ruleengine.dto.relregelarbeitsschluesselid.gueltigabtimestamp caused by: javax.persistence.persistenceexception: org.hibernate.propertyaccessexception: illegalargumentexception occurred calling getter of de.nvg.aelkf.ruleengine.dto.relregelarbeitsschluesselid.gueltigabtimestamp ... 130 more caused by: org.jboss.arquillian.test.spi.arquillianproxyexception: org.hibernate.propertyaccessexception : illegalargumentexception occurred calling getter of de.nvg.aelkf.ruleengine.dto.relregelarbeitsschluesselid.gueltigabtimestamp [proxied because : original exception caused: c...

Working example of Spring OAuth2.0 and JWT in Java with xml configuration -

Working example of Spring OAuth2.0 and JWT in Java with xml configuration - i working on project have implement authorization server (java web application) has back upwards json web token. much utilize spring back upwards (spring-security-oauth2, spring-security-jwt) unfortunately can't find illustration on net. if has implemented much appreciate if shared me. i have looked cloudfoundry(https://github.com/cloudfoundry/uaa) can't find help there. thanks. java spring oauth-2.0 jwt

c# - Audio position in SpeakProgress event is not correct for "Microsoft Anna" voice -

c# - Audio position in SpeakProgress event is not correct for "Microsoft Anna" voice - in text speech application c# utilize speechsynthesizer class, has event named speakprogress fired every spoken word. voices including "microsoft anna" parameter e.audioposition not synchronized output sound stream, , sound stream played faster auidoposition indicates. void reader_speakprogress(object sender, speakprogresseventargs e) { console.write(e.audioposition + ""); } i thought maybe problem bitrate , wavestream output utilize following. filestream audiostream = new filestream(fname, filemode.create, fileaccess.write); reader.setoutputtowavestream(audiostream); i tried var formats = curvoice.voiceinfo.supportedaudioformats; reader.setoutputtoaudiostream(audiostream, formats[0]); but problem output file not played. have suggestions why voice not synch , why solution has no playable output audio? as have guessed p...

Rails ActiveAdmin Sass Import Error -

Rails ActiveAdmin Sass Import Error - this error has plagued me more 24 hours , need either solve or drop active admin : argumenterror @ /admin wrong number of arguments (3 2) (in c:/users/joelb/rubymineprojects/bleh/app/assets/stylesheets/active_admin.css.scss) engine_from_pathsass-rails (4.0.2) lib/sass/rails/importer.rb def engine_from_path(name, dir, options) (this error line) full_filename, syntax = sass::util.destructure(find_real_file(dir, name, options)) homecoming unless full_filename && file.readable?(full_filename) sprockets::sassimporter#engine_from_path sass-rails (4.0.2) lib/sass/rails/importer.rb, line 80 sprockets::sassimporter#find_relative sass-rails (4.0.2) lib/sass/rails/importer.rb, line 27 sass::tree::importnode#import sass (3.2.0) lib/sass/tree/import_node.rb, line 45 sass::tree::importnode#imported_file sass (3.2.0) lib/sass/tree/import_node.rb, line 25 sass::tree::importnode#css_import? sass (3.2.0) lib/sass/tree/import_nod...

git - Is the "assume-unchanged" information committed? -

git - Is the "assume-unchanged" information committed? - there file want share in current state, don't want farther changes committed. did "assume-unchanged" file. now, git ignores changes file in repository. other users of repository - have "assume-unchanged" file in own repository? is there way automatically create "assume-unchanged" directive valid other users too, done "gitignore" information? no, git update-index --assume-unchanged updates index of local repo. not index of other remote repo, , not pushed. the same git update-index --skip-worktree one approach can pushed around using content filter driver, in order generate actual file versioned template. see instance "automatically ignore selected code changes when pushing git-hub repository" (image "customizing git attributes" git book) git gitignore

objective c - NSOutlineView in NSPopover not readable in OSX 10.10 Yosemite -

objective c - NSOutlineView in NSPopover not readable in OSX 10.10 Yosemite - i have nspopover containing nsoutlineview (source list) displayed on dark background (but it's not dark). nsoutlineview has transparent background blend nicely nspopover view. looked great in os x 10.9 in 10.10 scheme changes text color in nsoutlineview based on background. result text becomes grayness , unreadable in cases: if alter popover hud style more readable: however, in case, becomes problematic lighter backgrounds (the top). is there way command text color in nsoutlineview color stays same no matter background? have tried setting color of text cell black instead of scheme colors not help. also, can control/remove transparency of nspopover ? have read nspopover makes utilize of nsvisualeffectview , has appearance controls, don't know how access nspopover. for aesthetic reasons not want set nsoutlineview under solid background view. in case there ugly mismatch ...

Get a String from json (Vba) -

Get a String from json (Vba) - i new vba , hope can help me. got url gives text /stream json syntax. "json text" should display in exel. alreday made display string in exel set direktly in code. question now: how string url ? you can seek this: dim orequest object set orequest = createobject("winhttp.winhttprequest.5.1") orequest.open "get", "http://www.cboden.de" orequest.send msgbox orequest.responsetext if behind proxy server, this: const httprequest_proxysetting_proxy = 2 dim orequest object set orequest = createobject("winhttp.winhttprequest.5.1") orequest.setproxy httprequest_proxysetting_proxy, "http://proxy.intern:8080" orequest.open "get", "http://www.cboden.de" orequest.send msgbox orequest.responsetext and if want utilize post instead of can seek this: dim orequest object set orequest = createobject("winhttp.winhttprequest.5.1") orequest.open "post...

sql server 2014 - SQL - CASE statement to filter the query -

sql server 2014 - SQL - CASE statement to filter the query - hi having stored procedure selecting same columns, query follows create procedure get_data @in_filter_column1 nvarchar(6), @in_filter_column2 nvarchar(50), @in_flag bit = 0 begin if @in_flag = 0 select t1.column1, t1.colum2, t2.column3 table1 t1 inner bring together table2 t2 on t1.column1 = t2.column1 t1.column1 = @in_filter_column1 else select t1.column1, t1.colum2, t2.column3 table1 t1 inner bring together table2 t2 on t1.column1 = t2.column1 inner bring together table3 t3 on t3.column1 = t2.column1 t3.column1 = @in_filter_column2 end so here instead of writing same select status using switch case or other alternative way. possible one way know trying other create procedure get_data @in_filter_column1 nvarchar(6), ...

SML Pattern matching throwing "types of rules don't agree [tycon mismatch]" error -

SML Pattern matching throwing "types of rules don't agree [tycon mismatch]" error - fun sample(list_of_str_lists, s) = case list_of_str_lists of [] => [] | x::[] => case (all_except_option(s, x)) of lst => lst | none => [] | x::xs' => case (all_except_option(s, x)) of lst => lst @ sample(xs', s) | none => [] @ sample(xs', s) it uses helper function takes list of strings , returns elements in list in list option if there matching string in list (again, excluding matching string). helper function take list ["a", "b", "c"] , string "a" , if matches "a" , homecoming alternative containing ["b", “c”] . my problem in sample in lastly pattern matching branch. throws error earlier rule(s): 'z list alternative -> 'z list rule: string ...

Problems specifying nzmax in sparse command from MATLAB -

Problems specifying nzmax in sparse command from MATLAB - i create sparse matrix of size n × n. usual i, j row , column indices, s values. command s=sparse(i,j,s,n,n); works fine, uses lot of memory during creation of s. according documentation matlab uses nzmax=length(s) default. save memory, want specify nzmax s can compute in advance. testing purpose (i created s above command) calculate nonzeros=nzmax(s); and call s=sparse(i,j,s,n,n,nonzeros); note in illustration nonzeros much smaller length(s). also, nnz(s)=nzmax(s). error message error using sparse: index exceeds matrix dimensions. can explain behavior me, please? possible remedy/workaround? let me add together code snippet example i=randi(10,1000,1); j=randi(10,1000,1); s=rand(1000,1); ell=size((unique([i j],'rows')),1); s=sparse(i,j,s,10,10,ell); error using sparse: index exceeds matrix dimensions. s=sparse(i,j,s,10,10); nnz(s) ans = 100 ell ell ...

c# - Using HttpUtility.HtmlEncode and handling special characters/umlaut etc -

c# - Using HttpUtility.HtmlEncode and handling special characters/umlaut etc - i'm using httputility.htmlencode sanitise user input prevent against xss attacks. problem htmlencode converts special characters ü html equivalent code. can't find documentation , doesn't encode. in order display correctly user need htmldecode it. 2 questions: how htmlencode decide needs encode supposedly valid character ü , not other unicode characters standard english language alphabet characters. htmlencode encode non ascii characters? best way prevent script tags allow special characters umlauts without creating special ignore list? does using htmldecode expose risk converting potentially malicious javascript htmlencode() 2 main things: it handles characters aren't part of default 127 ascii characterset. it encodes characters misinterpreted browser beingness valid html, css or javascript, prevent both accidental , intentional altering of webpage. is unsafe...

html - How to clear float only in curent div? -

html - How to clear float only in curent div? - i have followin g html: <div class="wrapper"> <div class="left-block"> <p> text </p> </div> <div class="right-block"> <p> text </p> <div class="some-block">654</div> <div class="some-block">132</div> <div class="some-block">987</div> <div class="clear"></div> <div class="regular-block">10002</div> </div> </div> blocks class left-block , some-block have property float:left looks http://jsfiddle.net/5k5v67jj/ block class clear has clear:left; how can create block regular-block on screenshot: you have contain float , clear in block formatting context. set such context, mutual practice utilize overflow:auto ...

validation - why use the blank validator rule in the model for the ID field? cakephp -

validation - why use the blank validator rule in the model for the ID field? cakephp - i'm new cake , want understand logic behind this. know blank rule used create sure field left blank or white space characters nowadays in it's value don't want our id equal numeric value? when user submitting info that's used create new entry in database, don't want allow them take id. when id field blank database (or model) generate new id automatically. usually rule used 'on' => 'create' : 'id' => array( 'rule' => 'blank', 'on' => 'create' ) ...which means "when creating, don't take id user." without rule user take database id or pass existing 1 , overwrite data. validation cakephp model

how to get the content of JSON and put it in each html tags -

how to get the content of JSON and put it in each html tags - newbie here, needs help. the content right static, want them dynamic, want content json script below , set on each heading , div. here json xml content. <script type="text/javascript"> var info = { "items": { "phone" : [ { "product" : "iphone 8", "manufacturer" : "apple", "releasedate" : "2018", "price" : 35000 }, { "product" : "galaxy s9", "manufacturer" : "samsung", "releasedate" : "2018", "price" : 33000 }, { "product" : "xperia zz", "manufacturer" : "sony", "releasedate"...

Ruby on Rails Accessing params from controller from form -

Ruby on Rails Accessing params from controller from form - i'm trying access parameters in controller strings when log rails.logger.debug "!!!" << "#{params[:username]}" nothing comes after exclamation points though rails.logger.debug params.inspect shows username has value. can please tell me how username value show in log debugging statement? controller code: def create rails.logger.debug params.inspect rails.logger.debug "!!!" << "#{@user[:username]}" @user = users.new(user_params) {params[:birth_year]}" if @user.save redirect_to(:controller => 'users', :action => 'index') else render(:controller => 'access', :action => 'index') end end last few lines of logged info: "user"=>{"username"=>"trevortt" ... !!! @user not work in line rails.logger.debug "!!...

tfs - How do you edit Lab Process Settings in a Lab Management template? -

tfs - How do you edit Lab Process Settings in a Lab Management template? - everytime seek edit lab process settings in lab management template in visual studio 2013, next error: has seen appearing? tried creating new build definition targeting same template, error appears again. os: windows 8. vs: 2013 update 2 you running tfs update 3 changed back-end of tfs create work items both test plan , test suites now. there odd going on in project, may have not "enabled" features on project things done behind scene. to verify this, go tfs portal , click on little gear in right hand corner, click command panel link (up top left) , select project working under , select manage project administration page , click overview tab. there "enable features" button there? if go home page of project , click little question mark on top right corner , select about, version have there? tfs visual-studio-2013 lab-management

spring mvc - Why jquery validate is not working? -

spring mvc - Why jquery validate is not working? - im trying validate form add together new user using spring mvc :p. had server side validations working via spring custom validators. client side validation allowing form submitted. how im doing it: including javascript files: <script src="resources/js/jquery-1.8.3.min.js" type="text/javascript"></script> <script src="resources/js/jquery.colorbox-min.js" type="text/javascript"></script> <script src="resources/js/jquery.validate.min.js" type="text/javascript"></script> <script src="resources/js/additional-methods.min.js" type="text/javascript"></script> the form before spring send browser: <c:url value="/adduser" var="action"/> <form:form method="post" action="${action}" commandname="user" id="adduserform"> ...

Google spreadsheet counta COUNTIFS -

Google spreadsheet counta COUNTIFS - i'm working @ google spreadsheet , i'm trieing this: | b | c | d 1 | ... | 11 | (???) 2 | ... | 10 | 3 | .... | 11 | 4 | ...... | 11 | (???) d1 = counta unique values @ column if column c = 11. d1 = 3. can help me? i tested =countifs(c:c,"11",a:a,">0") sum "a" (result 10)... =counta(c:c,"11",a:a,">0") = 10 =countifs(c:c,"11",a:a,">0") = 3 typo? google-spreadsheet

java - Generic class references -

java - Generic class references - this question has reply here: is list<dog> subclass of list<animal>? why aren't java's generics implicitly polymorphic? 11 answers please next code. why error thrown though integer inherited number , why same case of error not there when '? extends number' used. public class testgeneric { public static void main(string[] args) { class<integer> classint = int.class; class<number> classnum1 = int.class;// error type mismatch: cannot convert // class<integer> class<number> class<? extends number> classnum2 = int.class; } } you not have co-variance (if word looking for) in generic types. they need match exactly. class<number> can assigned number.class . if wa...

html - Button to Image Button -

html - Button to Image Button - i have dropdown menu can take location, click on go button, direct page, this buttons code in html: <input type="button" name="button" class="gobutton" onclick="opendir(this.form);"> and part in css .gobutton{background-color: url (../images/go.jpg); width:150px; height:50px; padding:0; border:0;} problem have is not changing button image, blank. jsbin demo background-color not background-image also remove space between url , ( .gobutton{ background: url(../images/go.jpg); /* or utilize background-image */ width:150px; height:50px; padding:0; border:0; } html image button

php - strtotime return false while converting date string -

php - strtotime return false while converting date string - using php 5.4.34 , laravel 4 apache 2.2.22 , ubuntu. i seek convert string '2050-10-13' date , homecoming false. var_dump(strtotime('2050-10-13')); ==> false var_dump(strtotime('13-10-2050')); ==> false var_dump(strtotime('2050/10/13')); ==> false var_dump(strtotime('13/10/2050')); ==> false i tried add together before : date_default_timezone_set('europe/brussels'); or date_default_timezone_set('europe/paris'); i doesn't alter anything. in app/config/app.php have : 'timezone' => 'utc', 'locale' => 'en', what problem ?? 2050 cannot represented internally on 32 bit systems. timestamp have limit 2038 because max value 32-bit integer 2,147,483,647 , is: 2038-01-19t03:14:08+0000z you have experienced year2038 bug. how fix don't utilize timestamp. instead utilize mor...

Unable to save cropped image - Android -

Unable to save cropped image - Android - this code got here public class catfragment extends fragment implements onclicklistener{ private dbcreater dbcreate; private static final int select_picture = 1; private string selectedimagepath = "android.resource://com.example.abcd/" + r.drawable.pets; private imageview img; //private button imgbtn; private uri mcropimageduri; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view gv = inflater.inflate(r.layout.new_pet, null); spinner sp = (spinner) gv.findviewbyid(r.id.etpettype); // reference sp.setadapter(new arrayadapter<string>(getactivity().getbasecontext(), android.r.layout.simple_spinner_dropdown_item, pettype)); button btnsubmit = (button) gv.findviewbyid(r.id.buttonnext); btnsubmit.setoncl...