Posts

Showing posts from May, 2014

apache - Running a open source php project after modifications -

i looking open source php website code , found 1 @ http://projects.students3k.com/online-exam-website-php-source-code.html , downloaded it. doesnt have read me suppose involves common sense people use php. subsequently, installed apache2, placed whole stuff in var/www/ , connected database. what i'm unable find users login user or admin interface. did find file users in csv format doesn't work the instructions have make changes file lib/db.php adding local parameters. this not sort of homework , wanna explore functionality of website. p.s. - file size 80 mb before i'm scolded posting such links. p.p.s - reallllly me , have smashed head trying. db.php file after modifications : define('db_server', 'localhost'); define('db_user', 'root'); define('db_passwd', 'password'); define('db_name', 'test'); define('admin_url', 'localhost/admin/'); define('url', 'localhost/&

c++ - Alphanumeric generator with restrictions -

i want create generator use these characters: b c d f g h j k m p q r t v w x y z 2 3 4 6 7 8 9 i want select 18 random letters list , 7 random numbers list , shuffle them (total of 25). there can repeats. python or c++. please help! python code attempt: import string import random letters = [random.choice('bcdfghjkmpqrtvwxyz') x in range(18)] numbers = [random.choice('2346789') x in range(7)] random.shuffle(letters + numbers) you had right: >>> import random >>> letters = [random.choice('bcdfghjkmpqrtvwxyz') x in range(18)] >>> numbers = [random.choice('2346789') x in range(7)] >>> s = letters + numbers >>> random.shuffle(s) >>> s ['j', 'p', 'f', 'm', '3', 'q', 'k', 'p', '2', 'k', '7', 'j', 'b', 'p', 'x', 'g', 'm', 'b', 'k'

apache - First cgi script in perl and don't know what it does -

i new perl , looking cgi programs. tried following perl monks , works. have no idea does. 1) end_here ? followed html ? : print <<end_here; <html> <head> <title>my first cgi script</title> </head> <body bgcolor="#ffffcc"> <h1>this pretty lame web page</h1> <p>who ovid guy, anyway?</p> </body> </html> end_here 2) modified sample script adding: my $query = new cgi; $p= $query->param('myparam'); i.e. new script is: #!c:\perl\bin\perl.exe -wt use strict; use cgi; $query = new cgi; print $query->header( "text/html" ); $time = $query->param('fromdate'); print <<end_here; <html> <head> <title>my first cgi script $time</title> </head> <body bgcolor="#ffffcc"> <h1>this pretty lame web page</h1>

angularjs - Angular (directive newbie): How to add date time-picker to ngModel so that it can be validated? -

i new angular , have specific use case in mind have form has 2 fields - name , datetime. the name ng-model datetime not since not part of angular , jquery component what want do? here plunker = http://plnkr.co/edit/wgrvxafmpgoyswh9gfxh?p=preview a.) want associate date ngmodel ngmodel="transaction.date" b.) validate required using angular way something (much angular) <input type="text" name="transactiondate" ng-model="transaction.date" data-date-format="yyyy-mm-dd hh:ii" required> why? a.) to things angular way b.) makes model more consistent test, validate i asked question on stackoverflow , recommended use custom directive, can give me direction example how it? please guide me further since not able validate currently thank much based on ketan's answer, had write new directive , associate value form jquery ng-model, validated form. directive looks like app.directive('datetime'

model view controller - How does business logic class calls methods inside a managed bean? -

i have business logic code renders facesmessages on facelet based on output, made method in facelet managed bean method: public void renderfacesmessages(string summary, string detail) { facesmessage message = new facesmessage(summary, detail); facescontext.getcurrentinstance().addmessage(null, message); } and business logic class pass arguments method according message that's needed, question right approach business logic call method on managed bean? it layering concept... i presume have managedbean has method delegate business logic seperate business class/module. if case,i tell ,never have faces methods on business side... instead have business results wrapped in class , return managed bean.this result class encompass results,meta information result like,errors,exceptions.so managed bean can use renderfacesmessage method even if had not followed above presumption:my suggestion never have jsf faces logic inside business components.it bad idea.

java - Validate Bean inside a Bean -

i have following beans public class mymodel { @notnull @notempty private string name; @notnull @notempty private int age; //how validate this? private mysubmodel submodel; } public class mysubmodel{ private string subname; } then use @valid annotation validate controller side. thank you you can define own custom validation bean validation (jsr-303), example here simple custom zip code validation, annotating custom annotation can validate: @documented @constraint(validatedby = zipcodevalidator.class) @target(elementtype.field) @retention(retentionpolicy.runtime) public @interface zipcode { string message() default "zip code must 5 numeric characters"; class<?>[] groups() default {}; class<?>[] payload() default {}; } and custom validation class, instead of , can use custom beans <yourannotationclassname,typewhichisbeingvalidated> public class zipcodevalidator implements constraintvalidator<zipco

javascript - Hyphens are causing a blank result -

i'm having issues hyphens in slugs tutorial i'm trying go through... http://wp.tutsplus.com/tutorials/theme-development/create-a-quicksand-portfolio-with-wordpress/ , i'm having problem when client uses hyphens in category. category blank when client puts in hyphen reason. otherwise else working perfectly! has else ran problem? i'm thinking js problem uncertain not receiving console errors @ all. i'm not sure how debug. why not use term_id desired prefix: $term->term_id . in case have unique identifier , less possibility breake something. final version be: $term_list .= '<li><a href="javascript:;" class="sort_by_term_'. $term->term_id .'">' . $term->name . '</a></li>'; will produce this: <li><a href="javascript:;" class="sort_by_term_1234568">some long name more words</a></li> info: http://codex.wordpress.org/functio

javascript - YouTube API not working in iOS (iPhone/iPad) but working fine in Desktop browsers? -

i using youtube api in simple 1 page website. able videos play , of youtube functionality works in desktop browsers (with exception of ie 7 -- perhaps issue addressed in helping me answer question) doesn't seem work @ in ios (iphone , ipad.) youtube player not show , there no reminiscences of youtube functionality @ in ios. below code implementation. if there's question information did not provide helpful question, please let me know. want start simple possible in addressing issue , bring in additional information if necessary. /*========================================================================== youtube ========================================================================== */ var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var ytready = false, playeridlist

javascript - Ruby on Rails: Inserting .js file in asset but still getting no method -

this maybe long shot question ask, worth try... i have .js file inserted vendor/assets/javascript folder , in application.js in apps/assets/javascript folder, inserted correct file name //= require autoresize.jquery the file name autoresize.jquery.js i'm using library here . in 1 of .js.coffee script file have this $(document).ready -> $('textarea').autosize(); but i'm getting error uncaught typeerror: object [object object] has no method 'autosize' i know jquery file being loaded because can see in chrome's inspection element tool, , also, have required jquery first. i'm not understanding why i'm still getting error?

javascript - document.getElementById("myFrame").contentWindow.myFrameFunction() won't work in Chrome 26.0.1410.64 m -

it works in firefox 20.0.1 , ie 10.0.9200.16442, both input elements won't work in chrome 26.0.1410.64 m chrome console showed this: uncaught typeerror: property 'say' of object [object global] not function ========================main.html======================= function say() { alert("parent.html------>i'm @ parent.html"); } function callchild() { var ifrm = document.getelementbyid("myframe"); ifrm.contentwindow.say(); } < input type=button value="invoke say() in child.html" onclick="callchild()" /> < iframe id="myframe" name="myframe" src="child.html" /> ========================child.html======================= function say() { alert("child.html--->i'm @ child.html"); } function callparent() { window.parent.say(); } < input type=button value="invoke function say() in parent.html" onclick="callparent

node.js - Reading incomplete API docs - how do you know what all your [options] are if they are not listed? -

how go finding [options] available when not listed out? in case of mongoose nodejs : http://mongoosejs.com/docs/api.html#schema_schema-index examples not complete. how 1 track down full extent of options can pass in second parameter? it reads : schema#index(fields, [options]) defines index (most compound) schema. show code parameters: fields <object> [options] <object> example schema.index({ first: 1, last: -1 }, { unique: true }) in places, options detailed out, wonderful. example: http://mongoosejs.com/docs/api.html#connection_connection-openset thanks. also, found lovely question/answer. how read api documentation newbs? the obvious answer read through source code, i've found it's easier read tests. tests bits of code developer(s) cares about. in case of schema index tests alluded several options: https://github.com/learnboost/mongoose/blob/master/test/schema.test.js#l1028 however after further digging lot of options tied

javascript - jQuery to show a div and hide another div at the same time. Purpose to browse a 5 div's -

assume there book has various chapters (say 5) in it. complete book present in single html page 5 chapters in it. each chapter html content , present inside div class name called chapter. can take dummy html content each of 5 pages tags in chapter 1, chapter 2 ..... , chapter 5. now when page opens first chapter shown user. has chapter 1 in heading. single chapter bigger height of window user can scroll read chapter. once user reaches end of chapter user can not see or scroll next chapter. when user @ end of chapter sees button @ bottom right saying go next chapter. imp:- button can not part of chapter html has generated programmatically @ end of chapter via js. when person clicks on button next chapter (chapter 2 in case) should scroll bottom automatically till top pushing first page out of window. whole screen should covered chapter 2 shown animation pushing chapter 1 above. so @ given time user can see 1 chapter scrolling or down. have click buttons access next or pre

jquery - JSON posting data -

i have json data being added this: { "name": "ghngjnghj", "email": "jhjhj@jkbjvk.com", "message": "hjhjhj" } but need format this: jsoncallback(    { "name": "ghngjnghj", "email": "jhjhj@jkbjvk.com", "message": "hjhjhj" } ); url: "post_json.aspx", data: $("#contact_form").serialize(), also i'm using json.net in code behind string json = jsonconvert.serializeobject(account, formatting.indented); file.writealltext(@"c:\inetpub\wwwroot\json\dotnet4b\test_file.json", json); i had change string json so! string json = "jsoncallback(\n" + jsonconvert.serializeobject(account, formatting.indented) + "\n);"; hth someone

Include new line character in value attribute of Liferay search container -

i have following line of code of search container. want include new line between 2 values want display.. <liferay-ui:search-container-column-text name='employee name' value='<%=string.valueof(search.getempfname()) + string.valueof(search.getemplname()) +"\n" + string.valueof(search.getemptitle()) %>' href="" > the reason want way want these values in 1 box each row. so how should format above code have: string.valueof(search.getempfname()) + string.valueof(search.getemplname()) on 1 line , string.valueof(search.getemptitle()) on next line of same row. converting comment answer: you can try using <br> tag instead of "\n" this: string.valueof(search.getemplname()) + "<br>" + string.valueof(search.getemptitle()` or can use <liferay-ui:search-container-column-jsp tag instead of <liferay-ui:search-container-column-text tag or else use tag following:

css - jquery mobile select box content is in middle of select box -

ive been looking through documentation jquery mobile trying work out how left align text within select boxes.. ive tried various things $("select").addclass('ui-btn-left'); and making sure rules class align text left no luck, ive tried #('select').parent().addclass('ui-btn-left'); but doesnt appear work. ive tried create css rule make global select boxes have text aligned left.. no luck here either. any suggestions im strugling understand how works.. i think that, in css file have maintained text align = center or that. put text-align ; left in body.

External server codeigniter code php -

is there way use controller hosted on 1 server , use in other server b i thinking create controller on host b , use include_once("http://www.server2.com/php/ci/index.php/controller/function"); supposing have mirror database on host (b host use same database using data server) work? what models? server application | | -----> controller | | ------> control_a.php server b application | | -----> controller | | ------> control_b.php(use control_a.php code) you can using restful services in codeigniter. refer restful service in codeigniter

Python ValueError: invalid literal for float(): 127.0.0.1 -

i working on simple bot udp flooding, isn't working, when run is: valueerror: invalid literal float(): 127.0.0.1 here snip of think causing problem: line = line.split() print line if(line[0]=='!udp'): print "attacking ", line[1] udp=socket.socket ( socket.af_inet, socket.sock_dgram ) udp.connect((float(line[1]), int(line[2]))) udp.send(os.urandom(10000)) i have searched around error cant find anything. '127.0.0.1' not valid floating-point number. change float(line[1]) line[1] , won't error. might want find out should sending first argument connect since can't send ip in format float.

sql - PLSQL - Store a select query result in variable throw error -

i want store select query result in variable in plsql. sql>var v_storedate varchar2(19); sql>exec :v_storedate := 'select cdate rprt cdate between cdate , to_char(sysdate, 'yyyy/mm/dd-hh24-mi-ss-sssss') , ryg='r' , cnum='c002''; as sql>select cdate rprt cdate between cdate , to_char(sysdate, 'yyyy/mm/dd-hh24-mi-ss-sssss') , ryg='r' , cnum='c002'; returns : 2013/04/27-10:06:26:794 but throws error: error @ line 1: ora-06550: line 1, column 121: pls-00103: encountered symbol "yyyy" when expecting 1 of following: * & = - + ; < / > @ in mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> , or like2_ like4_ likec_ between || multiset member submultiset_ symbol "*" substituted "yyyy" continue. ora-06550: line 1, column 148: pls-00103: encountered symbol ") , ryg=" when expecting 1 of following: . ( * @ % & = - + ;

javascript - Rendering SVG images everywhere with Modernizr, CanVG and ExCanvas -

the website i'm making ( here ) has images svg. since svgs aren't compatible everywhere (notably ie <9 , android browser on versions 2.x), needed find workaround. couldn't svgweb, since uses flash, , flash doesn't work on mobile devices. so thought had found working solution. compatibility.js: $(document).ready(function() { yepnope({ test: modernizr.svg, nope: ['extensions/canvg/rgbcolor.js','extensions/canvg/canvg.js'], complete: function(url,result,key) { if(!modernizr.svg) { yepnope({ test: modernizr.canvas, nope: 'extensions/excanvas.compiled.js', complete: function() { canvg(); } }); } } }); }); but seems have no effect whatsoever, , since there no errors , can't find logical errors, i'm stumped. here tag, in case messe

lisp - What does the asterisk do in Python other than multiplication and exponentiation? -

this question has answer here: proper name python * operator? 7 answers in peter norvig's lisp interpreter written in python ( http://norvig.com/lispy.html ), defines lisp's eval follows: def eval(x, env=global_env): "evaluate expression in environment." if isa(x, symbol): # variable reference return env.find(x)[x] elif not isa(x, list): # constant literal return x elif x[0] == 'quote': # (quote exp) (_, exp) = x return exp elif x[0] == 'if': # (if test conseq alt) (_, test, conseq, alt) = x return eval((conseq if eval(test, env) else alt), env) elif x[0] == 'set!': # (set! var exp) (_, var, exp) = x env.find(var)[var] = eval(exp, env) elif x[0] == 'define':

ruby on rails - ActiveAdmin: Can't mass-assign protected attributes: email, password, password_confirmation -

i having rails activeadmin devise authentication. have adminuser , user models user model doesn't have care admin. however, cannot create/edit neither adminuser nor user inside admin page. every time try doing so, give me message can't mass-assign protected attributes: email, password, password_confirmation that's weird because inside user model , adminuser models, have: attr_accessible :email, :password, :password_confirmation to try other way, went rails console , try creating adminuser , worked: adminuser.create(:email => 'asdf@admin2.com', :password => 'password', :password_confirmation => 'password') that means creation admin web page failed. i using devise authentication. error occurs both user , adminuser models. for password , password_confirmation, don't have fields in database, way devise default, never have password in database. here user model: devise :database_authenticatable, :registerable, :rem

javascript - DataURL not returning value -

i have created function stores datauri of image in local storage. data stored in local storage if try value function i.e. return statement, "undefined" value. probably, function returning value before converting dataurl. need help. here code: function getimagedataurl(local_name,w,h,i){ var data, canvas, ctx; var img = new image(); img.onload = function(){ canvas = document.createelement('canvas'); canvas.width = w; canvas.height = h; ctx = canvas.getcontext("2d"); ctx.drawimage(img,0,0,w,h); try{ data = canvas.todataurl("image/png"); localstorage.setitem(local_name,data); }catch(e){ console.log("error "+e) } } try{ img.src = i; }catch(e){} return data; } the problem you're taking asynchronous value , trying return synchronously. img.onload being called way after function returns. common pattern in javascript pass function function call when d

html5 - showing error when value is null in mvc -

i have locations column in site. in database there separate tables , country state city region these table id's stored locations table location table id referred candidatepreferredlocation . my problem is, want show location candidates stored. eg: location: country, state, city,region that. in above, if city null means shows "object reference not set object." so use code following, still showing same error. don't know. 1 suggest me? . mistake here you didn't check whether corresponding properties not null before using them: <% foreach (dial4jobz.models.candidatepreferredlocation cl in model.candidatepreferredlocations) { %> <% if (cl.location != null) { %> <% if (cl.location.country != null) { %> <%: cl.location.country.name %> <% } %> <% if (cl.location.state != null) { %> <%: cl.location.state.name %> <% } %>

ghdl does not produce binaries (windows) -

i'm using ghdl studies since couple of months. now forced use windows , tried use ghdl , gtkwave there also. my problem is: after i've installed ghdl tried compile code. with: ghdl -a aa.vhdl ghdl -a bb.vhdl ... ghdl -e test same used in linux. but not produce ant output except of work-obj93.cf if list ghdl -d everything seems fine. executes without error message, not binary or anything. see ghdl user guide 3.1.2 elaboration command on gnu/linux elaboration command creates executable containing code of vhdl sources, elaboration code , simulation code execute design hierarchy. on windows command elaborates design not generate anything. ... the actual elaboration performed @ runtime. on windows command can skipped because done run command. also see 1.3 ghdl? : the windows(tm) version of ghdl not based on gcc on internal code generator. the internal code generator version known mcode generates executable code memory ar

jquery - PHP json_encode behaves differently in different php version -

my code in php , jquery <script type="text/javascript"> $(function() { var city_list = <?php echo json_encode($_request['cities']); ?> alert("city_list:: "+city_list); }); this working fine in local php version 5.3.1, when put server php version 4.3.11 not working... i need work on both local , sever side. here file can use php < 5.2. http://www.boutell.com/scripts/jsonwrapper.html and can compare versions this: if (version_compare(php_version, '5.2.0', '<')) { //include or require jsonwrapper file }

javascript - Make fadeToggle more smooth when collapsing -

when click toggle toggle anchor in jsfiddle: http://jsfiddle.net/kaahm/ when animation complete, collapsing of remaining <li> jarring , abrupt. i wondering if there quick way make smooth like: http://razorjack.net/quicksand/ ? how remaining items slide new spots rather collapse. don't think have keep fadetoggle fade , disappear visibly, physically. i've updated fiddle - http://jsfiddle.net/kaahm/1/ basic idea behind, apply width parent li elements, fade out anchors , animate width of parent li elements down zero, , remove elements. that way, 1 element stays put smoothly placed near left edge of parent container.

scons - How to get the exit status in python -

i using scons build tool renesas compiler. i want know exit status of scons when build terminated error. when scons executed project return 0. how exit status or number check erros. is there function in python them. thanks there scons.script.main.exit_status , scons.script.main.exit_status.code , i've found them unreliable in practice (i.e. differ actual return code). the actual exit code set calling sys.exit appropriate argument. seems way access replacing original sys.exit wrapper: import atexit import sys exit_code = none original_exit = none def my_exit(code=0): global exit_code exit_code = code original_exit(code) original_exit = sys.exit sys.exit = my_exit @atexit.register def my_exit_handler(): print "exit code is", exit_code if __name__ == '__main__': sys.exit(1) if need more information in case of error want use custom wrapper sys.excepthook . there's scons.script.getbuildfailures .

javascript - Unable to select the newly add button -

i have table default of 4 rows user input. please see fiddle here http://jsfiddle.net/xakxm/4/ when user click on " add more ", table add new row " labeltable " unique id, "configtabletable" . var displaymore = '<tr id=row'+currentindex+'><td style="text-align: center">'+currentindex+'</td>'+ '<td width="60%"><p id="label_row_'+currentindex+'"></p></td>'+ '<td><button type="button" class="switch" id="switch_'+currentindex+'"data-role="button" data-transition="fade">activate</button></td></tr>'; when button "submit" pressed, user can see description , " activate " button in configtabletable . in order make sure activate button useful, append thisindex paragraph #ptest . works first 4 default rows not work newly add

performance - Runtime of string concatenation checking algorithm -

i wrote algorithm check whether or not string concatenation of number of strings in array (while being able use string multiple times). i'm having trouble figuring out runtime of algorithm is. i check string in question against every word in array , when find word substring of original string starting @ index 0, check remaining substring against every word in array well. i'm thinking o(n^n), unless i'm missing something. def check_concat(str,substr,words) if substr == "" return false end words.each |word| if word == substr && str != substr return true end if substr.index(word) == 0 if check_concat(str,substr[word.length..-1],words) return true end end end return false end let assume main string contains m words , there n words in array searched. in worst case need check each word in main string each word in array, mn time. time complexity of function o(mn) . for example main str

jsf - Netbeans CRUD generator: customization and is it efficient for real applications? -

i use netbeans 7.2.1. jsf crud generated code efficient real applications? have created test database , used netbeans crud generator. uses datamodel , paginationhelper instead of lists crud operations. there entity test.java , testfacade.java , testcontroller.java . , jsf files list.xhtml , edit.xhtml , view.xhtml , create.xhtml . added nemdquery entity file: @entity @namedquery(name = "test.findbytestcriteria", query = "select t test t t.testcriteria = true") public class test implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue @column(name = "id") private integer id; @column(name = "title") private string title; @column(name = "testcrieteria") private boolean testcrieteria; public test() { } //getters , setters and created query in testfacade.java: @stateless public class testfacade extends abstractfacade<test> { @persist

mercurial - How to hg ignore filename with no extension? -

mercurial can configured ignore files filename have extension. example, *.txt files can ignored adding ~/.hgignore : syntax: glob *.txt how can setup .hgignore file ignore files filenames have no extensions ? example, files named foobar , abracadabra should ignored, foobar.cpp , abracadabra.c should tracked. use regexp syntax instead since it's not possible glob : syntax: regexp ^[^.]+$ ps: can add right after syntax: glob section

iphone - Check UDID access in pre built library and strip that call without compiling again -

is there way confirm udid not accessed in pre built library? for example: have google admob ios sdk. how can confirm below api not used in library? [[uidevice currentdevice] uniqueidentifier] also there way remove line of code pre built library? you can check through terminal: strings libsomething.a | grep uniqueidentifier

javascript - using jquery set datepicker value to "" on form submission -

i have jsp code on submit calls function function filterexcesspage() { setdefaultvalues(); var fromlast =document.getelementbyid('fromlast').value; var fromdate =document.getelementbyid('fromdate').value; var todate =document.getelementbyid('todate').value; $("#excesslistform").submit(function() { if((todate.length>0) && (fromdate.length==0)) { $('#validatedate').text('*from date mandatory'); return false; }else if ((fromdate.length>0) && (new date(fromdate)>new date())) { $('#validatedate').text('*from date should less current date'); excesslistform.fromdate.value=""; return false; }else if ((todate.length>0) && (new date(todate)>new date())) { $('#validatedate').text('*to date should less current date'); excesslistform.tod

database - Rails preference tables and over-riding -

i'm wondering best way go following design problem: i have user have preferences table. have venue, belongs user. want following functionality: a venue have preferences, of set in preference table belonging user. want these "default" preferences. however, each individual venue can override these preferences. single table inheritance? separate models , check existence of "venue preferences?" assuming user's default preferences , user's specific venue preferences have same exact attributes, seems candidate single table inheritance. so, preferences have both user id venue id. then, in order determine actual preferences venue be, you'd first check see if there preferences venue. otherwise, default user's preferences.

Checking Groovy version Gradle is using -

i running gradle , have been running groovy 1.76. have updated groovy on local machine (groovy_home points groovy 2.1.2 etc). $ groovy -version groovy version: 2.1.2 jvm: 1.7.0_17 vendor: oracle corporation os: linux however, when running gradle commands (gradle test, classes, etc) believe not building against groovy 2.1.2 still building against 1.76. (the reason believe this, when execute classes keep getting error upgrading groovy 1.7 - 2.1 incompatability , related changes made post 1.76) is there way confirm version of groovy gradle install building against? also, can confirm should configuring groovy version gradle? which groovy library building against (and groovy compiler using) determined groovy library resides on compile (or, in earlier gradle versions, groovy ) configuration. typically groovy dependency configured explicitly, may pulled in transitive dependency management. (in case of version conflict, higher version wins default. groovy version(s) hav

OpenCV 2.4.5 read and display image crash -

good morning all, i encountering problem when attempting run simple program open , display image, program compile , run , create "my image" window, window solid gray, , program crashes no error other standard windows "test.exe has stopped working" shortly after opening window. i using opencv 2.4.5 , code::blocks 12.11. of importance cannot add .dll's system variable "path" , result have pasted of .dll's project folder. appreciated, code giving me problems can seen below. #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> int main() { // read image cv::mat image= cv::imread("jellyfish.jpg"); // create image window named "my image" cv::namedwindow("my image"); // show image on window cv::imshow("my image", image); // wait key 5000 ms cv::waitkey(5000); return 1; } maky sure have read ima

tfs2010 - Is Kanban Board available for Visual Studio 2010 and TFS 2010 -

some of user had ask me kanban board tfs 2010. tried googling, didn't find answer. is kanban board available tfs 2010? can integrate process template? is freeware? can download from? i haven't found free software integrates tfs 2010 , provides kanban board out of box. however, during digging around last year did find urban turtle provide several agile tools tfs 2010. it seemed able use process templates when looked it, didn't push tool hard enough see how customized process templates handle.

python - Multiple operations in a List Comprehension -

say this: vlist=[1236745404] flist=[ "<td>{}</td>".format ] [ f(x) f, x in zip(flist, vlist) ] but want convert integer time string feeding multiple process stream. pseudocode: flist=[ "<td>{}</td>".format(time.strftime("%a %h&#58;%m %d %b %y", time.localtime())) ] [ f(x) f, x in zip(flist, vlist) ] and want see is: ['<td>tue 22&#58;23 10 mar 09</td>'] is list comprehension variable input limited 1 operation, or can output passed downstream? your 2 cases quite different; in first have callable ( str.format ) in second built complete string. you'd need create callable second option too; in case lambda work: flist=[lambda t: "<td>{}</td>".format(time.strftime("%a %h&#58;%m %d %b %y", time.localtime(t)))] this list 1 callable, lambda accepts 1 argument t , , returns result of full expression t passed time.localtime() formatted using

javascript - multiple setTimeout calls within a for loop -

i'm trying code game simon in html/js , it's working, except part game flashes sequence know new sequence is. have is: for(var in thepattern){ var obj = document.getelementbyid(thepattern[i]); window.settimeout(coloron(obj),500); window.settimeout(coloroff(obj),1000); } where coloron , coloroff are: function coloron(obj){ if(obj.id == "red"){ obj.style.backgroundcolor="#ff5555"; }else if(obj.id == "blue"){ obj.style.backgroundcolor="#5555ff"; }else if(obj.id == "green"){ obj.style.backgroundcolor="#88ff88"; }else{ obj.style.backgroundcolor="#ffffaa"; } } function coloroff(obj){ if(obj.id == "red"){ obj.style.backgroundcolor="#ff0000"; }else if(obj.id == "blue"){ obj.style.backgroundcolor="#0000ff"; }else if(obj.id == "green"){ obj.style.backgroundcolor="#22ff

python - Leibniz determinant formula complexity -

i wrote code calculates determinant of given nxn matrix using leibniz formula determinants . i trying figure out it's complexity in o-notation. think should like: o(n!) * o(n^2) + o(n) = o(n!*n^2) or o((n+2)!) reasoning: think o(n!) complexity of permutations. , o(n) complexity of perm_parity, , o(n^2) multiplication of n items each iteration. this code: def determinant_leibnitz(self): assert self.dim()[0] == self.dim()[1] # o(1) dim = self.dim()[0] # o(1) det,mul = 0,1 # o(1) perm in permutations([num num in range(dim)]): in range(dim): mul *= self[i,perm[i]] # o(1) det += perm_parity(perm)*mul # o(n) ? mul = 1 # o(1) return det the following functions wrote used in calculation: perm_parity: given permutation of digits 0..n in order list, returns parity (or sign): +1 parity; -1 odd. i think perm_parity should run @ o(n^2) (is correct?). def perm_parity(lst): parity = 1 lst = lst[:] in rang

python - Find the length of a sentence with English words and Chinese characters -

the sentence may include non-english characters, e.g. chinese: 你好,hello world the expected value length 5 (2 chinese characters, 2 english words, , 1 comma) you can use chinese characters located in unicode range 0x4e00 - 0x9fcc . # -*- coding: utf-8 -*- import re s = '你好 hello, world' s = s.decode('utf-8') # first find 'normal' words , interpunction # '[\x21-\x2f]' includes interpunction, change ',' if need match comma count = len(re.findall(r'\w+|[\x21-\x2]', s)) word in s: ch in word: # see https://stackoverflow.com/a/11415841/1248554 additional ranges if needed if 0x4e00 < ord(ch) < 0x9fcc: count += 1 print count

c# - Parallel.ForEach with MatchCollection -

first off, know duplicate of this question , can't solution listed there work me. understand matchcollection not implement ienumerable parallel.foreach uses, , need oftype()... idea i'm doing wrong? here's setup: matchcollection startmatches = regex.matches(temprtb.text, startpattern); system.threading.tasks.parallel.foreach(startmatches.oftype<match>, m => { // stuff m }); and here's compile error get: error 11 type arguments method 'system.threading.tasks.parallel.foreach<tsource>(system.collections.generic.ienumerable<tsource>, system.action<tsource>)' cannot inferred usage. try specifying type arguments explicitly. all missing () (oftype static extension method) system.threading.tasks.parallel.foreach(startmatches.oftype<match>(), m => { // stuff m });

forms - Integrate junction and lookup tables with a basic Access database -

Image
i have simple database stores customer's name, city , state. i've added 2 new tables. 1 lookup table, describing car model, , second junction table setting 1 or more car models customer record. here's relationship layout of now: and datasheets each table. cust_id , model_id auto increment columns. demographics lookup_model junction_model using scripting language, mysql , html whip complete form in few minutes. having little trouble figuring out how done in access 2007. two features need are ability edit/add items lookup table ability add new customer records including selecting cars found in lookup table, while maintaining primary key relationships. ex: "mary jane" owns ford pinto , datson 510. when add info to-be-created form, cust_id 5, , 2 new entries show in junction table cust_id: 2 (ford) , 5 (datsun). is there relatively painless way of setting form in access 2007? edit: i've managed working f

javascript - Kendo chart.redraw() method not working in IE8 -

i use kendoui chart object in dynamic data being added it. there dynamic data being added both data points value axis. when trying run .redraw() method on chart in order re-paint whole thing rather update data points ie8 throws invalid argument errors not complete operation due 80020101. removing redraw() statement fixes , allows charts render, section update axis , chart whole not. here section of code fails. //add value axis: var chartoptions = metricschart.options; var valueaxis = metricschart.options.valueaxis; chartoptions.valueaxis = []; //reset value axis chartoptions.valueaxis.push(valueaxis); //chartoptions.valueaxis.push({}); //right value axis //left value axis: chartoptions.valueaxis[0] = { name: leftdata.measurementtypegroupname, //"blood pressure" title: { text: leftdata.measurementtypegroupname + (leftdata.seriesdata[0].unitname.length > 0 ? " (" + leftdata.seriesdata[0].unitname + ")" : ""),

web services - Error on Spring REST webservice call -

i have following webservice call @requestmapping(value = "modifyuser/{userdn}", method = requestmethod.post, headers="accept=application/json") public @responsebody jsonobject modifyuser(@pathvariable string userdn, @requestbody directoryuser directoryuser) { // modify user boolean modifieduser = this.authenticationservice.modifyuser(userdn, directoryuser.getpassword(), directoryuser); // build jsonobject jsonobject jsonobject = new jsonobject(); jsonobject.put("modifyuser", modifieduser); return jsonobject; } i using following client method access above rest webservice. string url = "http://www.local.com:8080/commonauth-1.0-snapshot/api/authentication/modifyuser/"; defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url + "user6.external") jsonobject ob = new jsonobject(); ob.put(

javascript - Having difficulty closing a PopUP window, after update and submit button -

so, have javascript calls asp page, using showmodaldialog ... works great, passes correct information, user prompted radio button answer question, if user presses "submit" ... data written sql table. works; however, cannot window close. behavior program opens page (same content in window popup) full page size. when tried add following code: response.write("script language='javascript'?window.close();") ... same behavior message indicating program trying close window. frustrating because don't understand why closing window diffcult. please if can.

sql server - T-SQL IF statement embedded in a sum() function -

i'm attempting convert mysql query t-sql query , if statement that's enclosed within sum statement tripping me up. suggestions? select cmts_rq.[dated], cmts_rq.cmts_name, count(cmts_rq.cmts_name) emat_count, sum(if(cmts_rq.us_pwr>=37 , cmts_rq.us_pwr<=49)) us_pwr_good cmts_rq group cmts_rq.cmts_name, cmts_rq.[dated] but error: msg 156, level 15, state 1, line 5 incorrect syntax near keyword 'if'. msg 102, level 15, state 1, line 5 incorrect syntax near ')'. t-sql doesn't have "inline" if statement - use case instead: select cmts_rq.[dated], cmts_rq.cmts_name, count(cmts_rq.cmts_name) emat_count, sum(case when cmts_rq.us_pwr >=37 , cmts_rq.us_pwr <= 49 1 else 0 end) us_pwr_good cmts_rq group cmts_rq.cmts_name, cmts_rq.[dated] so if value of cmts_rq.us_pwr >= 37 , <= 49 add 1 sum - otherwis

javascript - how do you restart setInterval on mouse out -

i have function runs on document load after 5 seconds, on mouseover, want stop setinterval , on mouseout reset it. have read loads tutorials cant work. my code follows: jquery(function () { var timerid = setinterval(function () { var name = "name"; jquery.ajax({ url: "/ajax-includes/index.php", type: 'post', datatype: 'html', data: {name: name}, beforesend: function () { jquery('#progress').html('processing...'); }, success: function (data, textstatus, xhr) { jquery('#bodymain').html(data) }, error: function (jqxhr, exception) { if (jqxhr.status === 0) { alert('not connect.\n verify network.'); } else if (jqxhr.status == 404) { alert('requested page not found. [404]');

OR query with elasticsearch -

i have index "name" , "description" filed. running boolean query against index. term present in both name , description fields, in case documents in both name , description contains search term scored higher compared ones having either name or description having search term. what want score them equal. the documents either name or description having term has same score document having search term present in both name , description. is possible? here example: { "name": "xyz", "description": "abc xyz" }, { "name": "abc", "description": "xyz pqr" }, { "name": "xyz", "description": "abc pqr" } if user search term "xyz" want 3 documents above have same score. documents contains term "xyz" either in name or in description or in both fields. you can use filtered query this.

cmis - how do I install cmislib for Python 3.3 -

im trying install latest cmislib python 3 (i have pydev installed) using easy_install (which ive never used before) described in http: //chemistry.apache.org/python/docs/install.html#requirements i following error, either im doing silly or doesnt work python 3.3 ? c:\users\mystuff\downloads>c:\python33\scripts\easy_install-3.3 cmslib-0.5.1-py2.7 searching cmslib-0.5.1-py2.7 reading http://pypi.python.org/simple/cmslib-0.5.1-py2.7/ couldn't find index page 'cmslib-0.5.1-py2.7' (maybe misspelled?) scanning index of packages (this may take while) reading http://pypi.python.org/simple/ no local packages or download links found cmslib-0.5.1-py2.7 error: not find suitable distribution requirement.parse('cmslib-0.5.1-py2.7') any suggestions ? there different way install cmislib? thx i have never tested cmislib python 3.x differences between python 2.x , 3.x significant, not @ surprised not work. please try python 2.7. using easy_install desc

c# - Getting the total number of frames to write it into BVH file while recording with kinect -

i'm trying write skeleton data bvh file, need total number of frames , write before joints data hierarchy of bvh file is. function sensorskeletonframeready allows me have frame number i'm using function extract joints data of each frame , write directly bvh file. can me, please? bvh files have total number of frames represented in file. impossible know number until done recording. using skeletonframeready event could: save data list (or other array type structure) stop recording , count number of frames (i.e., list items) write file, total frames ... or ... output file in real-time (as indicate in question), keeping running total of frame count stop recording , close file best can re-open file, seek "frames" line , enter appropriate value you've stored ... or ... output skeleton tracking data in real-time keep seeking point in file frames defined , keep updating it, seek end write next frame. i'm not taking last 1

javascript - make the initial value of an input to disappear on click and to go back on blur -

i have form contains inputs initial value. want when click on input , click off default value go back. , if click on , type in, won't try erase put if go click on again. this code tried : <input type="text" name="prenom" value="prénom" onfocus="this.value = this.value=='prénom'?'':this.value;" onblur="this.value = this.value==''?'prénom':this.value;"/> isn't there other method that, because code long. if aren't worried older browsers, can use this: <input type="text" name="prenom" placeholder="prénom"/>

python - How do I write a file in headerless PCM format? -

how write file in headerless pcm format? source data in numpy array, , have application expecting data in headerless pcm file, can't find documentation of file format? same data chunk in wave file? the problem there no 1 "headerless pcm" format. example, 8-bit mono 22k , little-endian 16-bit stereo 48k both fine examples of pcm, , whole point of "headerless" need know information through out-of-band channel. but, assuming have expected format, it's simple sounds. for sample in samples: channel in channels: f.write(the_bytes_in_the_right_endianness) and if you've got data in format, write file 1 big block. the "default" codec wav files—and 1 supported python's wave module—is pcm. so, yes, if have wav file in same format want, can copy raw frame data headerless file, , you've got headerless pcm file. (and if have wav in wrong format, can use simple transformation, or @ worst out of audioop , convert it

simple html and css assistance -

i have logo called gif.gif, trying position on top left corner. @ moment there gap, want no padding or margins. this html , css css #header, .img margin:0px; padding:0px; html <!doctype html> <html> <head> <link rel="stylesheet" href="foo.css" type="text/css" /><!-- footer stylings --> </head> <body> <div id="header"> <div class="logo"> <a href="https://www.google.co.uk"/><img src="gif.gif"/></a> </div> </div> </body> </html> try this: body { margin:0px; padding:0px; }

c++ - FindWindow does not find the a window -

hey guys i've plan make simple trainer console c++ first step i've got problem findwindow() #include <stdio.h> #include <cstdlib> #include <windows.h> #include <winuser.h> #include <conio.h> lpctstr windowname = "mozilla firefox"; hwnd find = findwindow(null,windowname); int main(){ if(find) { printf("found\n"); getch(); } else{ printf("not found"); getch(); } } the above code use try whether command findwindow() when execute output show not found i've replaced character set on property project use unicode character set to use multi-byte character set and lpctstr to lpcstr or lpcwstr but result same, hope can me. hwnd find = ::findwindowex(0, 0, "mozillauiwindowclass", 0);