Posts

Showing posts from September, 2015

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()]"&g

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

javascript - Chrome-only cross-domain scripting errs in Facebook iFrame App upon FB.Login(..) -

in google chrome (i'm on 9.0.597.98) facebook iframe app using graph api/javascript sdk tends throw following 2 javascript errors (see below) based on cross-domain scripting, on 1 page of app. it goes endless retry loop on second message. after leaving overnight, reported half million retries morning! the fb call being used login: fb.login(function(response) { if (response.session) { // user logged in } else { // user cancelled login } }); in firefox , ie9 not these errors. it's specific chrome (maybe webkit). what's odd have second page in app uses fb.login , works in chrome in addition other browsers. read somewhere safari has more stringent requirements on cross domain scripting - , chrome share same code base. domains, protocols , ports must match (error message) believe satisfied because have page works fb.login call the other difference see between these 2 messages postmessage query argument has different value each (bolded in messa

how can i stop google indexing pages with urls ending with date and time -

i have website pages like www.xyz.com/product1 www.xyz.com/product2 and www.xyz.com/product1/ date can dynamic user searches. current google indexing www.xyz.com/product1 www.xyz.com/product2 www.xyz.com/product1/ date i dont want google index www.xyz.com/product1/ date urls.... maybe writing proper robots meta tag: html spec

c# - How do I dynamically create an Expression<Func<MyClass, bool>> predicate from Expression<Func<MyClass, string>>? -

i trying append predicates , goal create same expression as: services.where(s => s.name == "modules" && s.namespace == "namespace"); i have following code: expression<func<service,string>> sel1 = s => s.name; expression<func<service,string>> sel2 = s => s.namespace; var val1 = expression.constant("modules"); var val2 = expression.constant("namespace"); expression e1 = expression.equal(sel1.body, val1); expression e2 = expression.equal(sel2.body, val2); var andexp = expression.andalso(e1, e2); parameterexpression argparam = expression.parameter(typeof(string), "s"); var lambda = expression.lambda<func<string, bool>>(andexp, argparam); this create following output: s => ((s.name == "modules") andalso (s.namespace == "namespace")) however, faulty since parameter name , namespace isn't same. if change 1 of expression selector to: expressio

c - Programmatically enable/disable UNIX network interface -

there lot of similar questions posted, windows - want know how (if possible) can have c program (run root, on linux) disable network interface no longer receiving packets. if can tell me functions need this, great, better if can link me example script or tutorial somewhere (exempli gratia) turns network interface off , on again. for linux, doable mnl , knowledge of rtnl protocol: http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libmnl.git;a=blob;f=examples/rtnl/rtnl-link-set.c;hb=head on unices or other operating systems, os-specific call and/or archaic ioctl call available, latter of cannot express linux multiple addresses per interface properly, serious programs not make use of on platform.

Wordpress header.php displaying different CSS depending on page? -

i'm in process of converting website wordpress site..and i've run problem my homepage's header uses different class single_page header uses 2 different css ids . right have homepage using inside header.php want display when you're on page (is_page) how that? what need conditional tags: http://codex.wordpress.org/conditional_tags if (is_page()) { } elseif (is_front_page()) { } else { nothing? } this question also: detect browsed page url in wordpress

php - Computing number of days which fall between predefined date ranges -

this complex situation ain. have booking system rooms booked. the thing rates rooms aren't stored single value period based. room can have 1 daily rate between september december , adifferent rate march august, while have base rate other wise. the rates table this: roomid | rate | period_start | period_end lets suppose rate room between 1st march 31st march 20 dollars/day , rate same room 15th april 30th may 30 dollars, aside rate flat rate of 15 dollars/day. if room booked 1 client between 15th march 10th may, total cost be: 15th march - 31st march charged @ 20 dollars/day = 16x20 1st april - 14th april charged @ 15 dollars/day = 14x15 15th april - 10th may charged @ 30 dollars/day = 25x30 now how can compute value in code, need compute thenumber of days based upon rate periods if any, else use base rate them. complex thats how is. i'm using php mysql this possible solution algorithm: find rate periods have non-empty intersection booking period f

Html forms to SQL build helper -

is there lib (javascript, python, perl, java) me build html forms, , after submit convert sql language? i mean if have int field in db, want automatic builf form , int validation , after submiting create sql and filed_name=value . or set field in db build checkboxes , convert sql where myset = 'travel,sports' , on... :) there potential problems that. first putting in danger of sql injection allowing field content directly added sql command/query. better have use stored procedures or @ least parse through filter/function of kind. second, every database has it's own quirks, you'd need still adjust auto-build features match database , version using syntax , type. plus else whether bit or boolean should represented checkbox, or yes/no dropdown, or radio button. by time done you'd happier building database tier can pass information , handle how like.

c# - Reading Active Directory on Windows XP Machine -

i have problem cant connect (and read) active directory under windows xp. solutions ive tryed far are http://www.codeproject.com/kb/ip/storeractivedirectory.aspx and http://linqtoad.codeplex.com i need read groups of current user. thanks lot! regards denis pointing dns of tcp/ip v4 active directory server solves problem.

html - How can I create a basic human readable plain text representation of XHTML using Java? -

given simple xhtml, i'd create human readable plain text version of it. involve removing html tags, adding or preserving whitespace. for example, input: <div> <p>this text, <b>bold</b>.</p> <ul> <li>point one</li> <li>point two</li> </ul> </div> would become: "this text, bold. point 1 point two" (commas between lis ideal... :) jericho html parser. can either strip tags or call on "renderer" class tries mimick (eg bulleted lists tabbed)

math - C++ library for drawing graphics -

someone can suggest me good, free, easy use library c++ allow draw mathematical function in window microsoft windows? (e.g. parabola x^2+5x+3=0) another wxwidgets-based option wxart2d , has got tons of features drawing mathematical functions curves, pass y=140*cos(x/20) + 80*cos(x*2/20) + 40*cos(x*4/20)" curve object , drawn, it's amazing! check out these screenshots there curves drawn equations in string format!

javascript - IE issue while replacing title tag content with another title tag content using jquery -

i have page has 2 title tags (this due @ run time include page in page). seeing first title tag value in browser want show second title tag's value. here code have, working fine in firefox , chrome not in ie7. suggestions? var titlename; $(document).find('title').each(function(){ titlename = $(this).text(); }); $(document).attr("title", titlename); you don't need jquery this. should work in ie (as other browsers) using vanilla javascript. document.title = 'new title'; because of how ie handles <title> element , you'll need give little in getting second value. var titlename; // find title elements using plain ol' javascript var titles = document.getelementsbytagname('title'); // iterate on array of titles $.each(titles, function(i, title) { // if there childnodes, know we're not in ie if (!!title.childnodes.length) { titlename = title.firstchild.data; } // in ie, can read title

Mootools 1.11 and 1.2.4 conflict, Ajax.Form -

i'm trying use mootools ajax.form, , able make successful test installation this: http://demos111.mootools.net/ajax.form only if downgraded mootools script 1.11. rest of stuff on site, i've been using 1.2.4. i'm guessing there's conflict issue going on...but wasn't sure how fix this? did searching ajax.form see if else had problem, far have been unsuccessful. any appreciated. thank you! the difference element.send shortcut changed it's signature between 1.11 , 1.2.x new signature no longer accepts request options part of .send method, url accepted (to allow overriding url get/post on each request). with new api, have use set method on form element set send options this: document.id('myform').set({ send: { onrequest: function() { /* here */ }, oncomplete: function() { /* else */ } } }); you can see full example on how use element.send method on following fiddle: http://jsfiddle.net/s3h4g/2/ you can refer offi

linux - How pthread_mutex_lock is implemented -

i curious know how functions related synchronization between processes , threads implemented inside unix means happens when call pthread_mutex_lock?? pointers?? or source code help. it both complicated , differs unix unix variant. in linux, example, system called futex (short fast userspace mutex) used. in system atomic increment , test operation performed on mutex variable in user space. if result of operation indicates there no contention on lock, call pthread_mutex_lock returns without ever context switching kernel, operation of taking mutex can fast. only if contention detected system call (called futex) , context switch kernel occurs puts calling process sleep until mutex released. there many many more details, reliable and/or priority inhertience mutexes, essence of it. for more details see: http://linux.die.net/man/2/futex , http://en.wikipedia.org/wiki/futex

c++ - why type casting doesn't work in here? -

the following code has type casting error #define img_i (std::complex<double>(0, 1)) #define pi 3.1415926535 (unsigned long int j = 0; j < 10; ++j) std::cout << exp(-img_i * pi * j); the type casting can solved using parenthesis or changing order of multiplication. not clear me why type casting problem occurs in first place , why c++ cannot handle above code is. can explain me? this operator* overload std::complex function template declaration looks like: template<typename t> complex<t> operator*(const complex<t>& lhs, const t& val); the t in complex<t> lhs argument must same t val argument in order template argument deduction work. you trying call std::complex<double> (the type of -img_i * pi ) , unsigned long (the type of j ). double , unsigned long not same type, template argument deduction fails. -img_i * (pi * j) works because type of pi * j double , there no ambiguity t is. likewis

php - Is using IP sockets for RPC functionality for a distributed system a good idea? -

i curious if using socket daemon in php idea building rpc functionality on distributed system? well, depends on you're doing. in general, i'd build restful interface opposed using raw sockets. way it's normal http (which easy use, extend, etc) rather needing invent own protocol. either that, or use 1 of many rpc protocols: xmlrpc jsonrpc <- since it's easy use in language soap etc...

help me to solve the string condition in sql server 2008? -

departmentid parentid 2 52630 8 52630 14 52630 20 52630 26 52630 declare @retstr varchar(8000) select top 5 @retstr = coalesce(@retstr + ',','') +''''+ convert (varchar,departmentid) +'''' department parentid =52630 print @retstr i following result output : '2','8','14','20','26' @retstr have '2','8','14','20','26' value, using in operator check condition select * product inner join [departmentproduct] dp on p.productid=dp.productid inner join [department] d on d.departmentid = dp.departmentid inner join [producttranslation] pt on p.productid = pt.productid , pt.localeid = 1 **d.department in (@retstr)** it throws following error: error converting data type nvarchar bigint. you comparing bigint string in sec

Does it matter in which order I set the action in CSS definitions? -

this might silly question, haven't managed find out if there difference between these 2 css definitions: div:hover.item {} div.item:hover {} or... behavior same both of them? pseudo selectors such :hover, :link, etc. come last see http://www.w3schools.com/css/css_pseudo_classes.asp : the syntax of pseudo-classes: selector:pseudo-class {property:value;} css classes can used pseudo-classes: selector.class:pseudo-class {property:value;}

c# - Using 'switch' with strings in resource file -

i have bunch of strings in resource(.resx) file. trying directly use them part of switch statement (see sample code below). class test { static void main(string[] args) { string case = args[1]; switch(case) { case stringresources.cfg_param1: // something1 break; case stringresources.cfg_param2: // something2 break; case stringresources.cfg_param3: // something3 break; default: break; } } } i looked @ of solutions, of them seem suggest need declare them const string dislike. liked top voted solution question: using collection of strings in switch statement . need make sure enum , strings in resource file tied together. know neat way of doing that. edit: found this great answer while researching how use action : you use dictionary<string, action> . put action (a delegate method) each str

python - Int Object Is Not Iterable -

i have come across problem don't know how resolve involving dijkstra's algorithm - here code: infinity = 1000000 invalid_node = -1 #startnode = 0 class node: distfromsource = infinity previous = invalid_node visited = false def populatenodetable(): nodetable = [] f = open("twodarray.txt", "r") line in f.readlines(): #get number of nodes file nodetable.append(line.split(',')) # create matrix of weights numnodes = len(nodetable) # count nodes print numnodes #for nodes in text file, set visited false, distfromsource infinity & predecessor none **for in numnodes: nodetable.append(node(i))** #nodetable.append(node()) nodetable[startnode].distfromsource = 0 print nodetable if __name__ == "__main__": populatearray() populatenodetable() when run code following error: traceback (most recent call last): file "2darray.py

vb.net - FileHelpers Library - Append Multiple Records on Transform -

using filehelpers library great things in vb.net. parsing files dynamic classes built text file templates. 1 thing can't find: way read in single record , determine should result in generation of 2 records. current code: dim fromtype type = dynamic.classbuilder.classfromsourcefile(myfilepath, mydynamictypename, netlanguage.vbnet) dim fromrecords() object fromrecords = filehelpers.commonengine.readstring(fromtype, mystringbuilder.tostring) '... maybe code here check values dim engine new filetransformengine(of itransformable(of mydestinationclass), mydestinationclass) ' ideally in next line see conditions , able generate 2 records single source line. dim payrecords() object = engine.transformrecords(fromrecords) alternately, if there way implement "itransformable(of ..." transformto() , have return multiple records, put logic in dynamic class definition transformto() method. thoughts? here sample of source dynamic class: imports filehelpe

iphone - How to put placeholder image and redraw cell when image is downloading from URL? -

i'm trying put placeholder images in table view cell. there event trigger redraw of cell contents once image data uploaded? i'm using following create image: [uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:photourlstring]]] side note: i'm using abtableviewcell manually draw contents of cell drawinrect method. thanks. that call synchronous, when complete image ready. what want loading image asynchronously , updating image loaded. something like: nsurl *url = [nsurl urlwithstring:imageurl]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; nsurlconnection *conn = [[nsurlconnection alloc] initwithrequest:request delegate:self]; set property contain nsdata , keep track of nsurlconnection can release it. self.activedownload = [nsmutabledata data]; self.imageconnection = conn; then provide proper delegate methods handling connection callbacks: - (void)connection:(nsurlconnection *)connection didreceivedata

iphone - How do I change the color of a UITableView row when it is selected? -

i've looked around answers have yet find 1 works. want able change background color, or image of uitableview row select. i used transitioning views when select row, time want able change rows properties. know row want change, indexpath.row, don't know how go changing how row looks because cellforrowatindexpath method has been called! what can change color? you this: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ //first cell want change uitableviewcell* thecell = [tableview cellforrowatindexpath:indexpath]; //then change properties (label, text, color etc..) in case, background color thecell.contentview.backgroundcolor=[uicolor redcolor]; //deselect cell can see color change [tableview deselectrowatindexpath:indexpath animated:yes]; } just make sure consider color change when recycle cells. if need more info post comment.

mysql not reverse sorting datetime field correctly -

i trying sort datetime field in descending order. sorting day fine. however, time part random. sorts in ascending order perfectly. sample query: select * pcvisit page_id='0005e1ca1784383bf6bf032f33dc6e27' order dtime desc result: 4adbc6b1cab4f14e7c9f2e308eb0944e | 0005e1ca1784383bf6bf032f33dc6e27 | 2011-02-23 16:08:35 | 1 733ab6507fbdab0e71f357f2f0ff6067 | 0005e1ca1784383bf6bf032f33dc6e27 | 2011-02-23 07:24:12 | 1 a5f9c9810e9648d2dbe4dec0e785216c | 0005e1ca1784383bf6bf032f33dc6e27 | 2011-02-23 05:26:59 | 1 981e24b4dd257f44a7a41dbdfe4def54 | 0005e1ca1784383bf6bf032f33dc6e27 | 2011-02-22 09:07:12 | 3 67906b350d59e97d7f56b7ceb254857e | 0005e1ca1784383bf6bf032f33dc6e27 | 2011-02-22 06:55:44 | 1 i have tried: select * pcvisit page_id='0005e1ca1784383bf6bf032f33dc6e27' order dtime desc, time(dtime) desc trying best not have split 2 fields. the date , time being sorted correctly. closer. when day changes 22nd, time starts @ top again, , starts descending

Only print matching lines in perl from the command line -

i'm trying extract ip addresses file. far, i'm using cat foo.txt | perl -pe 's/.*?((\d{1,3}\.){3}\d{1,3}).*/\1/' but prints lines don't contain match. can fix piping through grep, seems ought unnecessary, , lead errors if regexes don't match perfectly. is there simpler way accomplish this? if you've got grep, call grep directly: grep -po "(\d{1,3}\.){3}\d{1,3}" foo.txt

maven 3 Failed to read artifact descriptor for -

i upgrade netbeans 7 uses embeded maven 3. have project lot of modules , modules containing other modules. other submodules don't depend on internal projects work fine same configuration. in case, spring-hibernate depends on domain 1 of submodules , fails. my main project has this <modelversion>4.0.0</modelversion> <artifactid>spring</artifactid> <packaging>pom</packaging> <groupid>${masterproject.groupid}</groupid> <version>${masterproject.version}</version> my submodule has following def <modelversion>4.0.0</modelversion> <parent> <artifactid>spring</artifactid> <groupid>${masterproject.groupid}</groupid> <version>${masterproject.version}</version> </parent> <artifactid>spring-hibernate</artifactid> <packaging>pom</packaging> <dependency> <groupid>${masterproject.groupid}</groupid>

Silverlight ApplicationLifetimeObjects vs Application ResourceDictionary -

in silverlight application difference between adding objects applicationlifetimeobjects vs application resourcedictionary? if memory serves me right, applicationlifetimeobjects implement interface iaplicationlifetimeaware , iapplicationservice those objects supposed handle application's lifetime events, while resources "are" - if understanding correct.

apache - Restricting access to website, allowing only a single IP access -

for testing purposes, set in htacces: order deny, allow deny allow 123.456.789.000 but firefox shows: internal server error server encountered internal error or misconfiguration , unable complete request. error log shows: [thu feb 24 04:05:12 2011] [alert] [client 123.456.789.000] /var/www/vhosts/website.org/httpdocs/.htaccess: order takes 1 argument, 'allow,deny', 'deny,allow', or 'mutual-failure' what mean? doing wrong? helping this. you have space in order directive argument.

javascript - What are some empirical technical reasons not to use jQuery? -

context: astounded number of front end developers hack @ html, javascript , css day long , ignore tools jquery ( or other equivalent helper frameworks ) , refuse use them. not talking javascript gurus, talking in trenches every day joe production developers. lot of arguments more excuses or personal opinions don't think have technical merit, want make sure not missing something. question: empirical technical reasons not use jquery? i not looking religious or dogmatic arguments or subjective opinions "like other framework better", consider jquery straw man comparable frameworks in question. update 2015: in answer 2011 i'm talking libraries jquery, yui or prototype. today in 2015 reasoning still applicable frameworks angular, react or ember. in 4 years technology progressed tremendously , though see considerably less prejudice against react or angular saw against jquery or yui, same kind of thinking - though lesser extent - still pre

objective c - iPhone custom browser app programmatically create 'Bookmark' on Home Screen -

we trying create custom browser app iphone. in app able allow user click on link labeled "add homescreen" safari browser , have our custom browser add link/icon homescreen (just web app link/url). possible , if figure out how it? thanks! please check "app store review guidelines. it says 10.4 apps create alternate desktop/home screen environments or simulate multi-app widget experiences rejected, thanks.

What's the purpose of item-id's in Android ListView Adapter? -

(not specific listview, adapter). i keep implementing when subclass baseadapter: @override public long getitemid(int position) { return position; } because have implement that. don't see use of it, need getitem(position) only, not getitemid(position). i wonder if has significance (to android sdk or else)? there many reasons have stable item ids. default implementation cannot given since depends on type of object being stored in adapter. android has check make sure item ids used when stabled, i.e. subclass has overridden getitemid ; baseadapter.hasstableids must overriden return true. few reasons have come across: adapterview.onitemclicklistener 's method onitemclick(adapterview<?> parent, view view, int position, long id) sends long id the getcheckeditemids method the result valid if choice mode has not been set choice_mode_none , adapter has stable ids. reply "because have implement that" : don't have

asp.net mvc - Entity Framework 4 POCO's and AutoMapper -

i have been working on new mvc application utilizies ef4, poco domain objects , repository <--> service layer. i see lot of talk using automapper map ef4 classes dto view models. under impression rid of tightly bound ef4 classes. question since using poco classes, can't use in view models? or there still need automapper? the argument "poco's" domain models, , view's shouldn't concerned domain models. think way - data validation, if want data annotations, have put them on poco's - input validation (this field required, etc) isn't domain concern, it's ui concern - hence use of viewmodels data annotations , automapper. of course, it's not cut , dry, it's matter of preference. i use mvc/ef4/poco/automapper/service layer , never bind poco's - use viewmodel per view. this way, have level of consistency: all view's have viewmodel poco's have nothing business/domain logic viewmodel's have basic inpu

ruby on rails 3 - refinery-edge gives error "no such file to load -- refinerycms-base (LoadError)" -

i'm trying run refinery-edge on ubuntu 10.04 64bit. have rvm installed, created gemset "refinery-edge", , followed steps in refinery website , when try create refinery project following error: <internal:lib/rubygems/custom_require>:29:in `require': no such file load -- refinerycms-base (loaderror) <internal:lib/rubygems/custom_require>:29:in `require' /home/felixmm/desktop/rails_projects/refinerycms-edge/lib/refinerycms.rb:2:in `block in <top (required)>' /home/felixmm/desktop/rails_projects/refinerycms-edge/lib/refinerycms.rb:1:in `each' /home/felixmm/desktop/rails_projects/refinerycms-edge/lib/refinerycms.rb:1:in `<top (required)>' <internal:lib/rubygems/custom_require>:29:in `require' <internal:lib/rubygems/custom_require>:29:in `require' /home/felixmm/desktop/rails_projects/refinerycms-edge/lib/refinery.rb:3:in `<top (required)>' <internal:lib/rubygems/custom_require>:29:in `require&

Split string with inner and outer delimeters in Javascript -

in javascript code, have string this: "1943[15]43[67]12[32]" i want return array this: ["1","9","4","3","15","4","3","67","1", 2","32"] that is, want separate every character, except numbers inside brackets, want preserve 1 element. is there elegant way this? var str = '1943[15]43[67]12[32]', matches = str.match(/\d|\[\d+\]/g); (var = 0, matcheslength = matches.length; < matcheslength; i++) { matches[i] = matches[i].replace(/\d/g, ''); }; console.log(matches); // ["1", "9", "4", "3", "15", "4", "3", "67", "1", "2", "32"] jsfiddle .

JavaScript libraries for rich interactions -

if developing highly interactive website can accessed both desktops , mobile devices, recommended javascript libraries? my personal favourite jquery worth read http://forum.jquery.com/topic/jquery-mobile-js-separate-library-or-is-the-mobile-support-being-pushed-into-core

tableview - iPhone - adjust size of table view according to text -

is there way adjust size of table view , text wrap in iphone? i'm using following code, , succeeds in adjusting height of cell, text doesn't wrap, ends "...." - (cgfloat)tableview:(uitableview *) tableview heightforrowatindexpath: (nsindexpath *)indexpath { cgsize cellheight; city *thiscity = [cities objectatindex:indexpath.row]; nsstring * mystring = thiscity.cityname; cellheight = [mystring sizewithfont:[uifont systemfontofsize:13.0f] constrainedtosize:cgsizemake(300.0, 1000.0) linebreakmode:uilinebreakmodewordwrap]; return cellheight.height + 20; } there 2 things here: wrapping of text in displayed label - have define uilabel how looks container - how many rows can have, wrap , of course how big is. can either in code or in interface builder (depending on if using own custom cell) you can change uitableview's width either in interface builder or in code (mytableview.frame = cgrectmake(x,y,width,height)

java - Sending Email with attachment, sends a blank file -

i using code: file mydir = new file(getapplicationcontext().getfilesdir().getabsolutepath()); try { log.i("csv testing ", "csv file creating"); filewriter fw = new filewriter(mydir + "/myfile.csv"); // // write data file // log.i("csv testing ", "csv file created , data has been saved"); // process sending email csv file file csvfile = new file(mydir,"myfile.csv"); // , sending email attachment } catch (ioexception e) { log.i("exportcsv exception", e.tostring()); } but sends myfile.csv blank file. checked file explorer, myfile.csv not blank , contains right data. how can solve this? my logcat messages i/csv testing (16920): csv file creating i/csv testing (16920): csv file created , data has been saved i/csv file(16920): csv file exists i/send email testing(16920): email sending d/dalvikvm(16920): gc freed 2902 objects /

python - How does Apache know the names of the handlers in each module? -

i reading following: http://modules.apache.org/doc/api.html please explain how apache knows name of handler call. cgi module has following handlers: int translate_scriptalias (request_rec *); int type_scriptalias (request_rec *); int cgi_handler (request_rec *); another module might have other names. how apache know handler (let's say) response phase ? ps: can assign right tags ? couldn't know ones attach. they're (eventually) members of module struct @ bottom of first snippet.

Twitter oAuth login cancel? -

Image
i use twitter login in application. if user login, works fine. need handle, when user click cancel button in twitter oauth login screen instead of login. there callback mechanism when user click cancel button? for web application, if redirect user twitter authorization , user clicks on deny , he/she has option go application or not. if user didn't log in twitter account, or closed tab or went different url. won't know, unless keep track of users , check if he/she gone longer specified time. in case, if user clicks on ublogthis! link, he/she redirected application via callbackurl specified when getting request token and! http variable denied included: http://domain.com/twitterapp/callback.php?denied=8l74y149ftnzi1m3idstring so then, got out $_get['denied'] if using php example. if instead open popup window show user twitter authorization page via javascript, can check if popup closed without callback url being initiated. can add timer judge if

java - How to resolve com.ibatis.common.xml.NodeletException: Error parsing XML -

i using ibatis orm of application. sqlmapconfig.xml file below: <?xml version="1.0" encoding="utf-8"?> <!doctype sqlmapconfig public "-//ibatis.apache.org//dtd sql map config 2.0//en" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> <sqlmapconfig> <sqlmap resource="file:com${file.separator}platysgroup${file.separator}lmexserver${file.separator}mobile${file.separator}dao${file.separator}ibatis{file.separator}lmexusermobileinfo.xml" /> </sqlmapconfig> i need use file separator developing using 2 operating system ubuntu , windows xp. when run application show me exception below: com.ibatis.common.xml.nodeletexception: error parsing xml. cause: java.lang.runtimeexception: error parsing xpath '/sqlmapconfig/sqlmap'. cause: java.io.ioexception: not find resource file:comfile.separatorplatysgroupfile.separatorlmexserverfile.separatormobilefile.separatordaofile.separatoribatis{file.separator}l

how to find between dates in sql server 2008? -

i give 2 different date input. want find, date between 2 date.. for eg: 1'st input : 2011-02-20 2'nd input : 2011-02-25 output is: 2011-02-20 2011-02-21 2011-02-22 2011-02-23 2011-02-24 2011-02-25 is there function find between date... otherwise how find ? you can use cte achieve this. declare @startdate datetime declare @enddate datetime set @startdate = '2011-02-20' set @enddate = '2011-02-25' ;with getdates ( select 1 counter, @startdate date union select counter + 1, dateadd( day, counter, @startdate ) getdates dateadd( day, counter, @startdate ) <= @enddate ) select date getdates

php - Get expiration date using Customer Payment Profile Response -

in web site have implemented authorixe.net cim function. have created users details , deleted users account. want retrieve customer profile info. have send customer profile request , tried display credit card number , exp date renew payment process (for site objective). see code below if ("ok" == $parsedresponse->messages->resultcode) { echo $parsedresponse->profile->paymentprofiles->payment->creditcard->cardnumber; echo $parsedresponse->profile->paymentprofiles->payment->creditcard->expirationdate; } i got last 4 digits card number, , got result xxxx expiration date. i need display date usual date (not xxxx format). how can expiration date? that information masked , cannot retrieved via api. when creating profile either need store expiration date , or if using determine when card going expire, store notification date of when need start notifying them card expire .

time series - ets() error in R -

i have time serie , when applying ets error dont know generated. timeserie not big or has no such big values. do spot wrong? > ts jan feb mar apr may jun jul aug sep oct nov dec 2005 22.84 21.58 21.93 25.25 28.69 30.63 34.47 28.72 36.49 34.77 40.65 2006 36.73 31.55 38.07 34.77 36.91 39.16 36.07 35.37 39.34 35.62 27.58 33.37 2007 37.11 33.32 34.09 34.64 21.05 41.60 36.52 37.63 42.66 38.17 39.26 39.95 2008 35.33 38.63 38.04 36.90 33.56 35.14 33.82 36.18 29.30 25.65 20.71 21.63 2009 17.12 19.02 22.48 24.42 16.94 19.75 24.56 22.55 16.68 17.86 20.83 18.41 2010 14.74 16.49 19.75 22.88 24.11 27.02 27.46 26.47 26.81 26.59 23.56 18.88 > fit = ets (ts) error in `-.default`(y, e$e) : non-numeric argument binary operator in addition: warning message: in ets(ts) : large numbers may cause numerical problems. try scaling data first > thanks. update traceback: traceback: 7: nextmethod(.generic) 6: ops.ts(y, e$e) 5: etsmodel(y, errortype[i],

repository - Storing files on TFS -

i working co-worker on files, in tfs repository. have share these files frequently, however, in process of our development neither compilable, nor working properly. don't want put them in repository, because rest of crew shall have problems compiling solution. however, manual sharing rather painful. there way put files on tfs, not inside repository? (mark temporary, not finished or that). best regards -- spook. you can use shelveset - if shelve set of changes colleague can pick them , other members of team never see them. bit of pita need have 2 shelvesets (1 each can update own). other way branch , merge when have compilable code.

Google Suggest API -

is there documentations google suggest api? all searches google suggest api show pages either outdated info or non working scripts. example. @ google.com type in "app" google suggests apple, applebees, etc. as can imagine, it's changed. the newer url http://clients1.google.com/complete/search?hl=en&output=toolbar&q=yoursearchterm or more recent: http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=yoursearchterm

entity framework - how to do many to many with the same table with EF4 Code First -

i have schema: create table person ( id int identity primary key, name nvarchar(30) ) create table personpersons ( personid references person(id), childpersonid references person(id) ) how create classes map them using ef4 code first ctp5 ? for poco... class person { public guid personid { get; set; } public virtual person parent { get; set; } public virtual icollection<person> children { get; set; } } ...set mapping in dbcontext... protected override void onmodelcreating(modelbuilder modelbuilder) { modelbuilder.entity<person>() .hasoptional(entity => entity.parent) .withmany(parent => parent.children) .hasforeignkey(parent => parent.personid); } ...will give default implementation. if need rename table explicitly (and want many-to-many relationship), add in this... class person { public guid personid { get; set; } public virtual icollection<person> parent { get; set; }

java - How to disable EGit temporarily? -

when doing things git repack command line, pack gets locked , can't removed, doubling repo size. culprit egit holding file open (which bad in windows). exiting eclipse workaround know. i've found this article , there's no such option egit. other idea? the "startup , shutdown" option way disable plugin mentioned in link (" temporarily disable eclipse plugin ") or in " how disable plugins in eclipse 3.6 helios ? ". if building plugin, use different target platform (as in this thread , in comments of article " [galileo] manage plug-ins in eclipse ide "), isn't case here.

GDB arithmetics -

when use commands: print/x &_start -> get: 0x08049054 print/x &_key -> get: 0x0804916d it quite easy figure out difference is: 119h but if use command: print/x &_key-&_start -> get: 0x46 (!!) why? confirm if debug program of own? what see pointer arithmetic. see also: so:pointer arithmetic

Java, Removing backslash in string object -

i have url this: http:\/\/www.example.com\/example in string object. can tell me, how remove backslashes? i programming blackberry system. see string.replace(charsequence, charsequence) string myurl = "http:\\/\\/www.example.com\\/example"; myurl = myurl.replace("\\","");

pug - node.js Unexpected identifier anywhere the file is called -

i'm writing app in node.js , had unexpected error on project. when try call model in browser , syntaxerror: unexpected identifier on function called in code . for example, if go on "/session/new", my code : app.get('/session/new',function (req,res) { res.render('sessions/new',{locals:{ redir:req.query.redir }}); }); and error syntaxerror: unexpected identifier @ object.function (unknown source) @ object.render (/usr/local/lib/node/.npm/jade/0.6.3/package/lib/jade.js:267:14) @ serverresponse.render (/usr/local/lib/node/.npm/express/1.0.7/package/lib/express/view.js:334:22) @ serverresponse.render (/usr/local/lib/node/.npm/express/1.0.7/package/lib/express/view.js:344:10) @ object.<anonymous> (/users/geraudmathe/desktop/nodemongo/app.js:133:6) @ param (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/middleware/router.js:145:21) @ pass (/usr/local/lib/node/.npm/connect/0.5.2/package/lib/connect/middleware/r

java - Problem with iPhone push certificate -

i using javapns api push notifications iphone. i made program worked fine on windows , able receive push notifications on device. when deploying code on server (linux), getting following error - java.io.ioexception: derinputstream.getlength(): lengthtag=127 big i searched net , figured out there wrong .p12 certificate. does knows can possibly wrong? certificate, when used in windows, still working fine , able send notifications. please help. i found problem , silly though. modified permission on .p12 file 777 , worked :p. took me 1 day figure out

oop - basic inheritance (in python) -

users, i have basic question concerning inheritance (in python). have 2 classes , 1 of them inherited other like class p: def __init__(self,name): self.pname = name class c(p): def __init__(self,name): self.cname = name is there possibility can create parent object , several child objects refer same parent object? should work that parent object contains several variables , whenever access corresponding variables child access variable form parent. i.e. if change 1 child changed other childes , data stored once in memory (and not copied each child...) thank in advance. here possible workaround not consider nice class p: def __init__(self, name): self.pname = name class c: def __init__(self, name,pobject): self.pobject = pobject self.cname = name is state of art or there exist other concepts? sebastian thank helping me, name conventions :) still not satisfied. maybe give more advanced example stress want