Posts

Show multiple (2,3,4,…) images in the same window in OpenCV -

i want show 2, 3 or more images in same window. my problem how put second, third image on right side (above, left or upper) main image. i want create this, using opencv. --------------- | | | | | | --------------- | | | | | | --------------- thanks in advance jorge you can find answer on opencv wiki: http://code.opencv.org/projects/opencv/wiki/displaymanyimages :-)

c# - How to make a button that changes apperance on mouseover event? -

i creating windows forms application in visual studio 2010. need make button has different image changes on mouseover , mousedown events. i used this: public form1() { initializecomponent(); button1.mouseenter += new eventhandler(button1_mouseenter); button1.mouseleave += new eventhandler(button1_mouseleave); } void button1_mouseleave(object sender, eventargs e) { this.button1.backgroundimage = ((system.drawing.image)(properties.resources.img1)); } void button1_mouseenter(object sender, eventargs e) { this.button1.backgroundimage = ((system.drawing.image)(properties.resources.img2)); } i saved images in resources "img1" , "img2". however, not recognised. this.button1.backgroundimage = ((system.drawing.image)(properties.resources. img2 )); what put instead of "img2" in example ? how access image resources? button has bevel-border. ho...

c# - Detect changes in ObjectSet in Entity Framework 4.0? -

i want check if there changes in table in ef 4.0 following code: var = context.users.gethashcode(); addnewuser(); context.savechanges(); var b = context.users.gethashcode(); a == b, don't know why? any helps appreciated! gethashcode has absolutelly different usage . can't detect changes in objectset because entry point related database table(s). can detect changes prepared in objectcontext before accept changes (default savechanges accept changes). changes objectcontext use: context.objectstatemanager.getobjectstateentries(...)

java - ImageIO.write() method and png -

why imageio.write(bufferedimage_dest,"png",new file(filedest)); writes jpg (without transparency colour) file instead png? added: static bufferedimage createresizedcopy(image originalimage, int scaledwidth, int scaledheight, boolean preservealpha) { system.out.println("resizing..."); int imagetype = preservealpha ? bufferedimage.type_int_rgb : bufferedimage.type_int_argb; bufferedimage scaledbi = new bufferedimage(scaledwidth, scaledheight, imagetype); graphics2d g = scaledbi.creategraphics(); if (preservealpha) { g.setcomposite(alphacomposite.src); } g.drawimage(originalimage, 0, 0, scaledwidth, scaledheight, null); g.dispose(); return scaledbi; } public static void scale(string src, int width, int height, string dest) throws ioexception { bufferedimage bsrc = imageio.read(new file(src)); bufferedimage bdest = ...

mysql - How to insert just year and month into date field? -

i have column called table_date using now() insert current date ( 2011-02-23 ). know can manipulate sql/php show me year , monthname. however, want know if it's possible insert table_date current date year-month 2011-02 ? thanks a date field going full date, , far know, required specify full date. it might easiest use 01 , 2011-02-01 february 2011. obviously, can format output of date field liking when querying it: select date_format(fieldname,"%y-%m");

iphone - YouTube-Video hidden by css not loading in MobileSafari -

on iphone-mobile-webseite in jquery-accordion there «video»-content-box embeded youtube-video [iframe]. if load page «video»-box 'open' youtube-video loading , displaing preview-image … but if load page boxes closed (display: none … accordion), mobilesafari load box, empty (but has right height/height has displayed video. on desktop-safari video load no matter if box visible or hidden (accordion) … short: on mobilesafari video shows if box visible start … :-/ the problem i've used iframe embed video … therefore mobilesafari had problem iframe. if use object/embed-code (the 'old' youtube-embed-code), whole thing works perfectly.

python - Does anyone know how to configure the hunpos wrapper class on nltk? -

i've tried following code , installed http://code.google.com/p/hunpos/downloads/list english-wsj-1.0 hunpos-1.0-linux.tgz i've extracted file onto '~/' directory and when tried following python code: import nltk nltk.tag import hunpos nltk.tag.hunpos import hunpostagger import os, sys, re, glob cwd = os.getcwd() infile in glob.glob(os.path.join(cwd, '*.txt')): (path, filename) = os.path.split(infile) read = open(infile) ht = hunpostagger('english.model') ht.tag(read.readline()) i following error traceback (most recent call last): file "<stdin>", line 4, in <module> file "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/tag/hunpos.py", line 46, in __init__ verbose=verbose) file "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/internals.py", line 503, in find_binary raise lookuperror('\n\n%s\n%s\n%s' % (div, msg, div...

javascript - js function not working on IE8 -

i have div , on mouseover show ice:menupop function: function firecontextmenu(element, event) { if (element.getattribute('oncontextmenu')) { element.oncontextmenu = new function ('event', element.getattribute('oncontextmenu')); element.oncontextmenu(event); } } calling like: onmouseover="firecontextmenu(this, event);" on chrome working perfect on ie not appears. suppose it's wrong in js or ie8 not support hover of div? solved. no longer use js function use directly value of oncontextmenu. for case: onmouseover="ice.menu.contextmenupopup(event, 'frmmainmenu:menupopupcbm_sub', 'frmmainmenu:divmenupopupcbm');return false;"

bitmap - Android animated pixelation -

i'm working on game obscures part of image, player guesses what's hidden , obscured part revealed, player can see if guessed correctly. at moment draw black box above obscured part, nice if pixelate obscured area huge pixel size, decrease pixelation size until image visible, in animation. is possible somehow utilize android's support animations (i have used in 1 game, animate on screen stuff), or need implement entirely on own using kind of timer , drawing on canvas myself? or there handy me? hint possible solution: use bitmapfactory sample of image that's smaller original, , blow create "pixelated" version. see: http://developer.android.com/reference/android/graphics/bitmapfactory.options.html#insamplesize

Convert Ruby ActiveRecord Schema to SQL syntax -

i haven't used ruby trying learn. found 'schema.db' file looks generated active record module. i trying figure out how convert file sql can import database? active record generate schema.rb , represents current state of database (useful getting quick idea of attributes each model has). it used when deploying new instances of app, rather replaying whole migration history (and how test database created) as example, here's how can deploy production database: rails_env=production rake db:create db:load

objective c - Need help to make own coordinate system (classic, center of UIView is 0,0) -

i need create own coordinate system in uiview, 0,0 center of uiview. don't know ho this. please help. uiview *view = /*...*/; cgcontextref ctx = /*...*/; /* shift center ul corner mid-x, mid-y. */ cgrect bounds = [view bounds]; cgfloat hx = bounds.size.width / 2.0; cgfloat hy = bounds.size.height / 2.0; cgcontexttranslatectm(ctx, hx, hy); /* y still increases down, , x right. */ /* if want y increase up, flip y: */ cgcontextscalectm(ctx, 1.0/*sx*/, -1.0/*sy*/);

c# - Is there a common way to test complex functions with NUnit? -

is there common way test complex functions several parameters nunit? think hard or impossible test every condition. i'm afraid combination of parameters isn't expected in function not expected in test. so expected condition not fail unexpected. thanks this shouldn't hard test @ all. if is, method isn't designed testability, , code smell tells you need refactor it. i tend write tests in these cases follows (others may have better suggestions): does work intended when appropriate parameters passed? does throw expected exceptions when think should? (argumentnullexception, etc.) for each parameter, happens when pass null, minimum , maximum. (this can extensive, depending on number of arguments.) if method takes lot of parameters, consider refactoring take object information on it, can encapsulate rules in object, , pass object method.

regex - Regular expression any character with dynamic size -

i want use regular expression following thing ( extracted part i'm in trouble in order simplify ): character 1 5 first characters, "underscore", digits, "underscore", digits or dot. with restriction on "underscore" should give that: ^([^_]{1,5})_([\\d]{2,3})_([\\d\\.]*)$ but want allow "_" in 1-5 first characters in case still match end of regular expression, example if had somethink like: to_to_123_12.56 i think linked eager problem in regex engine, nevertheless, tried lazy stuff explained here without sucess. any idea ? i used following regex , appeared work fine task. i've replaced initial [^_] . . ^.{1,5}_\d{2,3}_[\d\.]*$ it's best replace final * + too, unless allow nothing after final '_'. , note final part allows multiple '.' (i don't know if that's want or not). for record, here's quick python script used verify regex: import re strs = [ "a_12_1", ...

c# - Get Item[i] from listview -

i trying item[i] string listview. don't seem understand supposed do, when listview on thread. public delegate void getcurrentitemcallback (int location); ... private void runasthread() { while (..>i) { //i tried following //doesn't work. //string item_path = listview.item[i].tostring(); //attempting thread safe. how return string? string item_path = getcurrentitem(i); } } private void getcurrentitem(int location) { if (this.listviewmodels.invokerequired) { getcurrentitemcallback d = new getcurrentitemcallback(getcurrentitem); this.invoke(d, new object[] { location }); } else { this.listviewmodels.items[location].tostring(); } } what missing? you need have delegate type returns string, not void, begin with. then, need matching method return string well. public delegate string getcurrentitemcallback (int location); ... private string getcurrentitem(int location) { if (t...

c# - How to limit the number of Installations on a Setup package -

i developing c# win forms application needs installed on client machine(windows xp / windows 7). the problem have , need limit number of installations per installation package 2(or number). is there way achieve through install shield or other means? is embedding key in file name , practice? awaiting answer. thanks in advance, vijay this must impossible user may make copy of installation package before running it. package (like *.msi file) sequence of bytes, can copied... you can limit 2 installations per machine given leave information behind somewhere (like in registry). another alternative have license key (or key embedded installation package) used activate software using central server on internet. option.

c# - delete folder/files and subfolder -

i want delete folder containing files , subfolder, containing files. have used everything, not working me. i'm using following function in web-application asp.net: var dir = new directoryinfo(folder_path); dir.delete(true); sometimes deletes folder, or doesn't. if subfolder contains file, deletes file, , not folder well. this looks right: http://www.ceveni.com/2008/03/delete-files-in-folder-and-subfolders.html //to call below method emptyfolder(new directoryinfo(@"c:\your path")) using system.io; // dont forget use header //method delete files in folder , subfolders private void emptyfolder(directoryinfo directoryinfo) { foreach (fileinfo file in directoryinfo.getfiles()) { file.delete(); } foreach (directoryinfo subfolder in directoryinfo.getdirectories()) { emptyfolder(subfolder); } }

jmeter url formatting questions -

trying load test site using tool dont quite understand against formatting standard cant seem crack. so: somesite.com/users/sign_in/service:accounts?redirect=/ is url in question. while (think) understand url doing, steps test in jmeter? appreciated. the steps test in jmeter depend largely on you're trying test. as starting point, recommend recording logging site, capture every parameter that's being sent along value. you can parametrize these values needed. looks once logs in, redirected page. when record, you'll see login page , landing page captured.

XSLT rounding attributes for SVG optimization -

i need reduce numeric precision, , minimum exponent of svg attributes save space. input: <svg xmlns="http://www.w3.org/2000/svg" width="250" height="250"> <circle cx="125.1111" cy="125.2222" r="124.9999" fill="red"/> </svg> output: <svg xmlns="http://www.w3.org/2000/svg" width="250" height="250"> <circle cx="125.1" cy="125.2" r="125.0" fill="red"/> </svg> what stylesheet achieve result? thoughts on safety of this? this stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="@*[.=number()]"...

java - How to make an image slideshow with JSF? -

is possible? if answer no, other ideas? the list of pictures dynamic, depends on user you're viewing. how can make slideshow images user uploaded? now it's working way: single picture displayed , need close open next one. <rich:datagrid id="albumgrid" value="#{somebean.pictures}" var="item" columns="4" elements="4" width="450px" rendered="#{not empty somebean.pictures}" style="margin-left:20px;"> <a4j:commandlink id="fulllinkprofile"> <a4j:actionparam name="pic" value="#{item.path}" assignto="#{picsbean.path}" /> <h:graphicimage value="/home/pictures/user/#{item.path}" rendered="#{item.path != null}"/> </a4j:commandlink> <f:facet name="footer"> <rich:datascroller for="a...

floating point - How can I make sure a float will always be rounded up with PHP? -

i want make sure float in php rounded if any decimal present, without worrying mathematical rounding rules. function work follows: 1.1 2 1.2 2 1.9 2 2.3 3 2.8 3 i know round() function exists don't see function rounding if decimal found. there easy way this? use ceil function: $number = ceil(1.1); //2