Posts

Showing posts from September, 2014

c# - NHibernate.MappingException: No persister for: XYZ -

now, before it: did google , hbm.xml file is embedded resource. here code calling: isession session = getcurrentsession(); var returnobject = session.get<t>(id); here mapping file class: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="hqdata.objects.subcategory, hqdata" table="subcategory" lazy="true"> <id name="id" column="id" unsaved-value="0"> <generator class="identity" /> </id> <property name="name" column="name" /> <property name="numberofbuckets" column="numberofbuckets" /> <property name="searchcriteriaone" column="searchcriteriaone" /> <bag name="_businesses" cascade="all"> <key column="subcategoryid"/> ...

vb.net - Best way to send an email from a .NET application? -

i'm working on windows forms (.net 3.5) application has built-in exception handler catch (heaven forbid) exceptions may arrise. i'd exception handler able prompt user click "send error report" button, cause app send email fogbugz email address. what's best way this, , there "gotchas" watch out for? you'll want use smtpclient class outlined here . there no gotchas - sending email easy gets.

Can you recommend low cost automated testing tools for a .NET Winforms application? -

looking automated testing tool support functional/regression testing .net winforms client server commercial application. top tier products: hp quicktest pro, borland silktest, ibm rational functional tester , compuware testpartner in 5-10k price range. recommend lower cost tool set functional/regression testing? need tool allows ba/qa analyst can productively engaged test case development. ruling out unit testing tools xunit entirely programmer use. yet want tool provides flexible scripting support allow testing of wider range of issues (possibly developer support). please limit answer single recommened tool. if recommendation answered please upvote create ranking tools available. thanks releated question: tools automated gui testing on windows maybe software ranorex you? i've played few hours while trying evaluate though: no long term experience it. seems me product combination (recorder generates vb/c#/python code against automation api - when run - rep...

gdi+ - Rendering graphics in C# -

is there way render graphics in c# beyond gdi+ , xna ? (for development of tile map editor.) sdl.net solution i've come love. if need 3d on top of it, can use tao.opengl render inside it. it's fast, industry standard ( sdl , is), , cross-platform.

Naming C# events and handlers properly -

from i've read i'm not sure if i've got naming convention events , handlers correct. (there seems conflicting advice out there). in 2 classes below can tell me if i've got naming right event, method raises event , method handles event? public class car { // event named correctly? public event eventhandler<eventargs> onsomethinghashappened; private void moveforward() { raisesomethinghashappened(); } // named correctly private void raisesomethinghashappened() { if(onsomethinghashappened != null) { onsomethinghashappened(this, new eventargs()); } } } and subscriber class: public class subscriber() { public subscriber() { car car = new car(); car.onsomethinghashappened += car_somethinghashappened(); } // named correctly? private void car_somethinghashappened(object sender, eventargs e) { // stuff } } thanks in advance! almost the method fire event - on<when>event (from raisesomethinghashappened ) ...

java - JComboBox Selection Change Listener? -

i'm trying event fire whenever choice made jcombobox . the problem i'm having there no obvious addselectionlistener() method. i've tried use actionperformed() never fires. short of overriding model jcombobox i'm out of ideas. how notified of selection change on jcombobox ? edit: have apologize turns out using misbehaving subclass of jcombobox , i'll leave question since answer good. commence vote down. :) it should respond actionlisteners , this: combo.addactionlistener (new actionlistener () { public void actionperformed(actionevent e) { dosomething(); } }); @john calsbeek rightly points out additemlistener() work, too. may 2 itemevents , though, 1 deselection of selected item, , selection of new item. don't use both event types!

html - How to Center Floated Divs in a Container -

is possible center floated divs in container , if how? for example have page container div containing lots of variable sized (dynamically generated) floated (left) divs. divs overflow onto next line reguarly never centered in container div, instead alined left. looks this: ---------------------------- - - - +++ +++++ ++++ ++ - - +++ +++++ ++++ ++ - - - - ++ ++++++ +++ + - - ++ ++++++ +++ + - - - ---------------------------- whereas floated divs centered in container this: ---------------------------- - - - +++ +++++ ++++ ++ - - +++ +++++ ++++ ++ - - - - ++ ++++++ +++ + - - ++ ++++++ +++ + - - - ---------------------------- thanks, dliks it possible. using http://www.pmob.co.uk/pob/centred-float.htm , http://css-discuss.incutio.com/wiki/centering_bloc...

java - Can I convert the following code to use generics? -

i'm converting application use java 1.5 , have found following method: /** * compare 2 comparables, treat nulls -infinity. * @param o1 * @param o2 * @return -1 if o1&lt;o2, 0 if o1==o2, 1 if o1&gt;o2 */ protected static int nullcompare(comparable o1, comparable o2) { if (o1 == null) { if (o2 == null) { return 0; } else { return -1; } } else if (o2 == null) { return 1; } else { return o1.compareto(o2); } } ideally make method take 2 comparables of same type, possible convert , how? i thought following trick: protected static <t extends comparable> int nullcompare(t o1, t o2) { but has failed rid of warning in intellij "unchecked call 'compareto(t)' member of raw type 'java.lang.comparable'" on line: return o1.compareto(o2); change to: protected static <t extends comparable<t>> int nullcompare(t o1, t o2) { you need becaus...

VS 2005 Installer Project Version Number -

i getting error hit version number 1.256.0: error 4 invalid product version '1.256.0'. must of format '##.##.####' the installer fine 1.255.0 256 (2^8) doesn't like. found stated on msdn.com: version property must formatted n.n.n, each n represents @ least 1 , no more 4 digits. ( http://msdn.microsoft.com/en-us/library/d3ywkte8(vs.80).aspx ) which make me believe there nothing wrong 1.256.0 because meets rules stated above. does have ideas on why failing now? this article says there major , minor max of 255. http://msdn.microsoft.com/en-us/library/aa370859(vs.85).aspx

flash - Referencing back to the parent from a child object -

my question pertaining best practice accessing child object's parent. let's class instantiates class, class instance referenced object. child object, best way reference parent object? know of couple ways use often, i'm not sure if a) there better way or b) of them better practice the first method use getdefinitionbyname, not instantiate class, allow access inside of publicly declared. _class:class = getdefinitionbyname("com.site.class") class; and reference variable based on parent child hierarchy. example, if child attempting reference class that's 2 levels itself: _class(parent.parent).function(); this seems work fine, required know level @ child @ compared level of parent attempting access. i can following statement trace out [object classname] flash's output. trace(class); i'm not 100% on implementation of line, haven't persued way reference object outside of current object i'm in. another method i've seen used pa...

python - Can distutils create empty __init__.py files? -

if of __init__.py files empty, have store them version control, or there way make distutils create empty __init__.py files during installation? is there reason want avoid putting empty __init__.py files in version control? if won't able import packages source directory wihout first running distutils. if want to, suppose can create __init__.py in setup.py . has before running distutils.setup , setup able find packages: from distutils import setup import os path in [my_package_directories]: filename = os.path.join(pagh, '__init__.py') if not os.path.exists(filename): init = open(filename, 'w') init.close() setup( ... ) but... gain this, compared having empty __init__.py files there in first place?

java - How does the default browser on Android send "SEND" intents? -

i'd enable "silent send" application-- is, i'd catch send intent in service, not activity. how default android web browser send intent? possible handle in service, or in activity never sets view? is possible handle in service, or in activity never sets view? action_send intents sent activity intents (e.g., startactivity() ), , cannot have service receive them. can have them handled activity never calls setcontentview() , though.

Figure out if a website has restricted/password protected area -

i have big list of websites , need know if have areas password protected. i thinking doing this: downloading of them httrack , writing script looks keywords "log in" , "401 forbidden". problem these websites different/some static , dynamic (html, cgi, php,java-applets...) , of them won't use same keywords... do have better ideas? thanks lot! looking password fields far, won't sites use http authentication. looking 401s http authentication, won't sites don't use it, or ones don't return 401. looking links "log in" or "username" fields more. i don't think you'll able entirely automatically , sure you're detecting password-protected areas. you'll want take library @ web automation, , write little program reads list of target sites file, checks each one, , writes 1 file of "these passworded" , "these not", , might want go manually check ones not, , make modifications progr...

c# - Why can't DateTime.ParseExact parse DateTime output? -

while struggling datetime.parseexact formatting issues, decided feed parseexact out put datetime.tostring(), this: datetime date2 = new datetime(1962, 1, 27); string[] expectedformats = { "g", "g", "f", "f", "d", "d", "m/d/yyy", "mm/dd/yyy", "mm-dd-yyy", "mmm dd, yyy", "mmm dd yyy", "mmmm dd, yyy", "mmmm dd yyy" }; bool parsed = false; foreach (string fmt in expectedformats) { try { datetime dtdatetime = datetime.parseexact(date2.tostring(fmt), fmt, new cultureinfo("en-us")); parsed = true; } catch (exception) { parsed = false; } console.writeline("[{0}] {1}", parsed,date2.tostring(fmt)); } this output: [true] 1/27/1962 12:00:00 [true] 1/27/1962 12:00 [true] saturday, january 27, 1962 12:00 [true] saturday, january 27, 1962 12:00:00 [true] saturday, january 27, 1962 [true] 1/...

jquery - Figure out div that is visible out of four divs -

i need figure out div visible out of 4 possible divs using jquery. 1 of div's visible @ given time. this have works far: $("#featureimage1:visible, #featureimage2:visible, #featureimage3:visible, #featureimage4:visible").attr("id"); is there way refactor this? there easier way figure out? assign same class each div then: $("div.myclass:visible").attr("id");

sql - How to do a MySQL select query on two tables linked by another table -

suppose have table function link 2 other tables in terms of oop. suppose have 2 tables: 1 person's name , 1 phone numbers: table 1: id person's name 1 john 2 smith table 2: id phone number 5 23424224 6 23424242 and have third table links person , respective phone numbers: table 3: id person-id phone-number-id 1 1 5 2 2 6 hence john has phone number 23424224 , smith has phone number 23424242. and want run sql query fetch persons table 1 phone number start with, let's say, (234). how go linking select queries within table structure...what query run? first, reason table if have many-to-many relation. while person can have many phone numbers, can 1 phone number have many persons? if true, schema implements requirement, seems little over-engineered me :-) second, simple join. want first select out phone numbers in question, given that, select out person ids third table, given that, select ...

What are the differences between Visual C++ 6.0 and Visual C++ 2008? -

what advantages/disadvantages between ms vs c++ 6.0 , msvs c++ 2008? the main reason asking such question there still many decent programmers prefer using older version instead of newest version. is there reason might prefer older on new? well, 1 thing may because executables built msvs 6 require msvcrt.dll (c runtime) shipped windows now. the msvs 2008 executables need msvcrt9 shipped them (or installed). plus, have lot of oss libraries compiled windows 32 bit 6.0 c runtime, while 2008 c runtime have take source , compile them yourself. (most of libraries compiled mingw, uses 6.0 c runtime - maybe that's reason).

DevExpress eXpressApp Framework (XAF) and eXpress Persistent Objects (XPO): how do I speed up the loading time of associations? -

i having problem speed of accessing association property large number of records. i have xaf app parent class called myparent . there 230 records in myparent . myparent has child class called mychild . there 49,000 records in mychild . i have association defined between myparent , mychild in standard way: in mychild : // mychild (many) , myparent (one) [association("mychild-myparent")] public myparent myparent; and in myparent : [association("mychild-myparent", typeof(mychild))] public xpcollection<mychild> mychildren { { return getcollection<mychild>("mychildren"); } } there's specific myparent record called myparent1 . for myparent1 , there 630 mychild records. i have detailview class called myui . the user chooses item in 1 drop-down in myui detailview, , code has fill drop-down mychild objects. the user chooses myparent1 in first drop-down. i created property in myui return collection of m...

ajax - How to prevent IE6 from refetching already-fetched images added via DOM manipulation -

if add image browser's dom, ie6 not check cache see if downloaded image will, instead, re-retrieve server. have not found combination of http response headers (of ensuing image request) convince ie6 can cache image: cache-control, expires, last-modified. some suggest can return 304 of subsequent image requests tell ie6 "you got it" want avoid whole round trip server in first place. maybe this work? (is same behaviour hovering on links css background image)

backup - Speeding up mysql dumps and imports -

are there documented techniques speeding mysql dumps , imports? this include my.cnf settings, using ramdisks, etc. looking documented techniques, preferably benchmarks showing potential speed-up. http://www.maatkit.org/ has mk-parallel-dump , mk-parallel-restore if you’ve been wishing multi-threaded mysqldump, wish no more. tool dumps mysql tables in parallel. smarter mysqldump can either act wrapper mysqldump (with sensible default behavior) or wrapper around select outfile. designed high-performance applications on large data sizes, speed matters lot. takes advantage of multiple cpus , disks dump data faster. there various potential options in mysqldump such not making indexes while dump being imported - instead doing them en-mass on completion.

iphone - UIOrientation returns 0 or 5 -

i running simple function get's called in multiple areas deal layout on ipad app during orientation changes. looks this: - (void) getwidthandheightfororientation:(uiinterfaceorientation)orientation { nslog(@"new orientation: %d",orientation); end and call in various places this: [self getwidthandheightfororientation: [[uidevice currentdevice] orientation]]; the function has simple code runs if orientation portrait or landscape. unfortunately wasn't working expected when app started in position 1. 0 result. later if function called in same manner device has never been rotated value of 5. mean? why throw these values? in short why [[uidevice currentdevice] orientation] ever throw 0 or 5 instead of value between 1 , 4? update: because kept finding bugs in code due way orientation handled, wrote definitive post on how handle uidevice or uiinterface orientations: http://www.donttrustthisguy.com/orientating-yourself-in-ios i recommend using ui...

makefile - Which version of Make to use for Java? -

i have make (windows sdk), nmake (visual studio) , make (codegear) which version of make use compile java apps? "make" from? downloaded jdk , there no make. searched around compile java makefile. what use, if have makefile , *.java files? java projects rarely use make , makefiles. in fact, i've ever seen used once in practice , 13 years ago, predating java build tools. instead java projects use 1 of 2 leading build tools. based on question i'm going assume have no particular reason use make (in you're not trying compile existing project has makefile). ant ant xml-based scripting build tool bears little (but not lot) similarity makefile in concept. ant build script define number of tasks. tasks depend on other tasks. tasks can include compiling java source files, building jars , really. ant flexible end writing bunch of boilerplate on , on (between projects). no 2 moderately complex ant projects same , dependencies can become huge problem...

Difference in creating Application object in WPF and WinForms -

why there difference in way application object created in winforms , wpf? -> in winforms never created application object. available (i believe singleton pattern). in wpf, although hidden in app.g.cs need instantiate one. -> in winforms sealed class, in wpf way go inherit it. is done: to able define application in xaml (app.xaml) due introduction xbap/navigation projects? what benefits provide? i don't know design decision entirely motivated desire able define application object in xaml. that's reason enough, seems me.

actionscript 3 - Accessing Variables in another class? -

first off don't understand classes, how "call" or "initiate" them. i'm class ignorant. i have 2 .fla files. 1 of .fla files consist of 15+ .as files; we'll call 1 xml editor. other .fla file consists of 10+ .as files; we'll call interface. the xmleditor.swf loads interface.swf. within xmleditor.swf, login screen appears , enduser logs in either "user" or "admin". "user" or "admin" stored in public variable called "usertype". usertype variable created in 1 of many xmleditor.fla .as files called login.as. once logged in, xmleditor loads interface.swf. interface.fla uses 10+ .as files. 1 called nodenames.as need if statement in nodenames.as this: if (login.usertype == "user"){ trace("do something"); } i have following flashvars.as file have no idea steps make work. package extras.utils { import flash.display.sprite; import flash.display.loaderinfo; ...

SceneGraph traversal in Haskell -

i want implement simple scenegraph in haskell using data.tree consisting of transform , shape nodes. in scenegraph spatial transformation accumulated while traversing , applied shape rendering. type transform = vector2 double data shape = circle double | square double data scenenode = xformnode transform | shapenode shape say have scene object moved right , consisting of square @ bottom , circle on top ^ | | () | [] 0-----> i came tree definition: let tree = node (xformnode (vector2 10 0)) [node (shapenode (square 10)) [] ,node (xformnode (vector2 0 10)) [node (shapenode (circle 10)) []] ] the rendering this: render :: position2 -> shape -> io () render p (circle r) = drawcircle p r render p (square a) = drawsquare p my questions are: 1) how define traverse function, accumulates transformation , calls render tasks? 2) how avoid making traverse io? 3) there shorter version ...

What's new in jQuery 1.4? -

what's new in jquery(including ui) , have problems(using ui dialog , datepicker) when switch 1.4(and 1.8.2) ? there breaking changes . important point make sure plugins using has been updated 1.4 support, , use updated versions only. shouldn't have issues, or minor issues can solve. benefits (for example performance) worth of it.

sql server - Problem calling stored procedure from another stored procedure via classic ASP -

we have classic asp application works , have been loathe modify code lest invoke wrath of long-dead greek gods. we had requirement add feature application. feature implementation database operation requires minimal change ui. i changed ui , made minor modification submit new data value sproc call (sproc1). in sproc1 called directly asp, added new call sproc happens located on server, sproc2. somehow, not work via our asp app, works in sql management studio. here's technical details: sql 2005 on both database servers. sql login authenticating asp application sql 2005 server 1. linked server server 1 server 2 working. when executing sproc1 sql management studio - works fine. when credentialed same user our code uses (the application sql login). sproc2 works when called independently of sproc1 sql management studio. vbscript (asp) captures error emitted in xml client. error number 0, error description blank. both adodb.connection object , whatever err....

css - What is the best way to replace the file browse button in html? -

i know it's possible replace browse button, generated in html, when use input tag type="file . i'm not sure best way, if has experience please contribute. the best way make file input control almost invisible (by giving low opacity - not " visibility: hidden " or " display: none ") , absolutely position under - lower z-index . this way, actual control not visible, , whatever put under show through. since control positioned above button, still capture click events (this why want use opacity, not visibility or display - browsers make element unclickable if use hide it). this article goes in-depth on technique.

command line - How to recursively download a folder via FTP on Linux -

i'm trying ftp folder using command line ftp client, far i've been able use 'get' individual files. you rely on wget handles ftp (at least in own experience). example: wget -r ftp://user:pass@server.com/ you can use -m suitable mirroring. equivalent -r -n -l inf . if you've special characters in credential details, can specify --user , --password arguments work. example custom login specific characters: wget -r --user="user@login" --password="pa$$wo|^d" ftp://server.com/ edit pointed out @asmaier, watch out if -r recursion, has default max level of 5: -r --recursive turn on recursive retrieving. -l depth --level=depth specify recursion maximum depth level depth. default maximum depth 5. if don't want miss out subdirs, better use mirroring option, -m : -m --mirror turn on options suitable mirroring. option turns on recursion , tim...

pthreads - Problem with the timmings of a program that uses 1-8 threads on a server that has 4 Dual Core Cpu's? -

i runig program on server @ university has 4 dual-core amd opteron(tm) processor 2210 , o.s. linux version 2.6.27.25-78.2.56.fc9.x86_64. program implements conways game of life , runs using pthreads , openmp. timed parrallel part of program using getimeofday() function using 1-8 threads. timings don't seem right. biggest time using 1 thread(as expected), time gets smaller. smallest time when use 4 threads. here example when use array 1000x1000. using 1 thread~9,62 sec, using 2 threads~4,73 sec, using 3 ~ 3.64 sec, using 4~2.99 sec, using 5 ~4,19 sec, using 6~3.84, using 7~3.34, using 8~3.12. the above timings when use pthreads. when use openmp timing smaller follow same pattern. i expected time decrease 1-8 because of 4 dual core cpus? thought because there 4 cpus 2 cores each, 8 threads run @ same time. have operating system server runs? also tested same programs on server has 7 dual-core amd opteron(tm) processor 8214 , runs linux version 2.6.18-194.3.1.el5. there ...

java - How to use the update statement in my jsp -

i having update statament in jsp. problem when changing whole fields in jsp , executed update statament, db updated, when updating field, other fields "" in sql statement. also, having problem having miss match in date, best format applied in sql statement in jsp. for first problem: html code: <select size="1" name="nationality" class="content"> <option selected value="<%=nationality%>"><%=nationality%></option> <% try { resultset rs=null; statement st1=null; string query = "select country_code, nationality_name nationality_lkup "; st1 = conn1.createstatement(); rs = st1.executequery(query); while(rs.next()) { %> <option value="<%=rs.getstring("country_code")%>" > <%=rs.getstring("nationality_name")%></option> <% } } ...

How can I search a text in some website (not from the source) with Python? -

i want make "autofill" works this: the site contains name , down name has field write it. so, want make program search "name" in website, , before that, click down "name" , write name (easy part)... how can search it? i can't use site forms, because, everysite has different forms try: automate firefox python? , https://addons.mozilla.org/en-us/firefox/addon/7620

Can "classic" ASP.NET pages and Microsoft MVC coexist in the same web application? -

i'm thinking trying out mvc later today new app we're starting up, i'm curious if it's or nothing thing or if can still party it's 2006 viewstate , other crutches @ same time... yes can have webforms pages , mvc views mixed in single web application project. useful if have application built , want migrate app webforms mvc. you need make sure none of webforms pages go in 'views' directory in standard asp.net mvc application though. pages (or views) in 'views' directory can't requested directly through url. if starting application scratch, there little benefit mixing two.

python - Unit testing: More Actions than Expected after calling addAction Method -

here class: class managementreview(object): """class describing managementreview object. """ # class attributes id = 0 title = 'new management review object' fiscal_year = '' region = '' review_date = '' date_completed = '' prepared_by = '' __goals = [] # list of <managementreviewgoals>. __objectives = [] # list of <managementreviewobjetives>. __actions = [] # list of <managementreviewactions>. __deliverables = [] # list of <managementreviewdeliverable>. __issues = [] # list of <managementreviewissue>. __created = '' __created_by = '' __modified = '' __modified_by = '' def __init__(self,title='',id=0,fiscal_year='',region='',review_date='', date_completed='',prepared_by='',created='',...

reporting services - Custom ROLAP Data Source in SSAS -

i trying build olap datasource bunch of binary files, , our current model isn't working. using ssas our analysis / reporting model our results, aren't able performance want out of sql. our main constraints are: the database large. have huge dimension tables millions of rows, , several smaller fact tables (<1,000,000 rows). we have dynamic cube. b/c fact tables built dynamically, , (possibly multiple times per day), there can't huge overhead in setting cube. current deploy times on cube can exceed 24 hours, , need orders of magnitude increase in performance hardware isn't gonna give us. basically, want fast setup , deploy, doesn't inherently lend ssas using sql server 2005, want use ssrs reporting , want olap model analysis in excel, we'd still use ssas build cube if possible. the common solution in ssas fast deploy rolap, getting execution errors on larger rolap queries, , don't overhead involved in converting binary data sql , loadi...

language agnostic - Solving the NP-complete problem in XKCD -

Image
the problem/comic in question: http://xkcd.com/287/ i'm not sure best way it, here's i've come far. i'm using cfml, should readable anyone. <cffunction name="testcombo" returntype="boolean"> <cfargument name="currentcombo" type="string" required="true" /> <cfargument name="currenttotal" type="numeric" required="true" /> <cfargument name="apps" type="array" required="true" /> <cfset var = 0 /> <cfset var found = false /> <cfloop from="1" to="#arraylen(arguments.apps)#" index="a"> <cfset arguments.currentcombo = listappend(arguments.currentcombo, arguments.apps[a].name) /> <cfset arguments.currenttotal = arguments.currenttotal + arguments.apps[a].cost /> <cfif arguments.currenttotal eq 15.05> <!--- pri...

offline - What is current status of RIA for Mobile Browsers and what solutions are out there? -

the heart of web app it's offline capability , javascript functionality. tools , wrappers availability desktop web app maker cross on mobile market? necessary read ups such team? clarifications: searching information on how offline capabilities , javascript functionality has improved on mobile phones. know term 'mobile phones' broad. aware of offline solutions gears, adobe air, silverlight etc. these mobile phones? how has javascript improved on mobile webkit browsers such iphone , symbians? operamini claims javascript functionality. i'm not totally sure understand question, you'll want take @ iphone dev center , google android sdk start. blackberry has development program. beyond that, may want wap , wml . google gears , adobe air , , mozilla's xul give offline capability, knowledge won't wrap existing desktop app , make available web.

performance - Can anyone explain how the oracle "hash group" works? -

i've come across feature of doing large query in oracle, changing 1 thing resulted in query used take 10 minutes taking 3 hours. to briefly summarise, store lot of coordinates in database, each coordinate having probability. want 'bin' these coordinates 50 metre bins (basically round coordinate down nearest 50 metres) , sum probability. to this, part of query 'select x,y,sum(probability) .... group x,y' initially storing large number of points probability of 0.1 , queries running reasonably ok, taking 10 minutes each one. then had request change how probabilities calculated adjust distribution, rather of them being 0.1, different values (e.g. 0.03, 0.06, 0.12, 0.3, 0.12, 0.06, 0.03). running same query resulted in queries of 3 hours. changing 0.1 brought queries 10 minutes. looking @ query plan , performance of system, looked problem 'hash group' functionality designed speed grouping in oracle. i'm guessing creating hash entries each uniq...

java - how does pre - increments and post increments work? -

suppose have initialised 2 variables this int a=0; int b=0; now if assign b value b=a++ + ++a + ++a; now a=3 , b=5 shouldnt have been b=2 ? why b assigned value 5 ? lets see: a++ = 0, afterwards increased 1. ++a = (the 1 a++ plus 1 preincreased) 2 ++a = (the 2 ++a above plus 1 preincreased) 3 in total: 0 + 2 + 3 = 5 this explains why three. in last step increased three.

ios - Cropping an UIImage -

i've got code resizes image can scaled chunk of center of image - use take uiimage , return small, square representation of image, similar what's seen in album view of photos app. (i know use uiimageview , adjust crop mode achieve same results, these images displayed in uiwebviews ). i've started notice crashes in code , i'm bit stumped. i've got 2 different theories , i'm wondering if either on-base. theory 1) achieve cropping drawing offscreen image context of target size. since want center portion of image, set cgrect argument passed drawinrect that's larger bounds of image context. hoping kosher, instead attempting draw on other memory shouldn't touching? theory 2) i'm doing of in background thread. know there portions of uikit restricted main thread. assuming / hoping drawing offscreen view wasn't 1 of these. wrong? (oh, how miss nsimage's drawinrect:fromrect:operation:fraction: method.) update 2014-05-28: wrote...

visual studio - How to setup VS2008 for efficient C++ development -

normally program in c# have been forced work in c++. seems integration visual studio (2008) poor compared c# wondering if there tools, plugins or configurations can improve situation. another post pointed out program visual assist x, @ least helps things such refactoring (though bit expensive me). major problem is, though, compile errors give little clue wrong , spend of time figuring out did wrong. feels possibly statically check lot more errors vs out of box. , why doesn't provide blue underlines c#, shouldn't hard?! i realize half problem fact new c++ feel can unreasonably hard program compile. there tools of sort out there or demands high? i think there 2 possibilities: 1) either you're trying out c++ stuff waaay on knowledge (and consequently, don't know did wrong , how interpret error messages), 2) have high expectations. a hint: many subsequent errors caused first error. when huge list of errors, correct first error , recompile. you'd ama...

delphi - How can I call a procedure (that deals with a message) from another unit? -

i want procedure wminput(var mess: tmessage); message wm_input; placed in separate unit. should declare same way in other unit (i'm asking if prototype still same procedure wminput(var mess: tmessage); message wm_input; )? how can call this? following acceptable? procedure wminput(var msg: tmessage) begin funit:= fotherunit.create(self); funit.wminput(msg); end; are there other alternatives? message handlers methods, , therefore must declared , implemented within same unit class belong to. that doesn't stop delegating real work other function in unit, though. there's nothing special message handlers in regard. declare whatever function like, , pass whatever parameters need in order accomplish duties. if needs contents of tmessage record, it. however, need know form received message, pass reference that, too. or maybe needs know values of of form's private fields, pass instead. you make unit handling messages. interface section this: unit mess...

What's the encoding type of Android 2.2 push message? -

i'm studying android push service (c2dm) android froyo version. google says max size of message 1024 bytes ( http://code.google.com/intl/ko/android/c2dm/ ). message encoding type? want put message not english. c2dm requires application send messages url-encoded content type application/x-www-form-urlencoded . can confirm works data german umlauts + ß.

c# - Access Master Page/Child Page Controls from My Class -

i have div on master page , want use showing page errors. have error display class , works fine. problem in instances, error gets displayed before tag resulting in (non)-display of message. code has response.redirect. i want counter having error shown on div within master page (hoep helps). how can access <div id="errorsegment" runat="server"> ? you can use findcontrol method on class inherits system.web.ui.control . includes master pages, pages , usercontrols. instance, page class, do: htmlgenericcontrol errordiv = (htmlgenericcontrol)master.findcontrol("errorsegment"); the other thing remember using findcontrol controls in asp page arranged in control tree structure. means need call findcontrol on right node in tree (typically page or masterpage).

.net - Add index in EF Model First design -

i option of doing model first design entity framework (4). however, haven't been able find out how add additional index table besides primary key. is possible in visual designer? or need add index manually after creating database (which shortcoming of designer)? read article . section influencing ddl generation . hth

java - Upgrade to Quartz 1.6 on JBoss 4.2.x -

is there recommended way upgrade quartz in jboss 4.2.x? jboss bundles quartz 1.5.2, have encountered issues ( quartz-399 , quartz-520 ) want avoid. i not want patch quartz.jar in jboss resolve errors, instead provide new quartz.jar (plus associated configuration artifacts). quartz 1.6 migration notes contain information specific quartz, , not find additional information during search. it not seem work put new quartz.jar ear file, because old version loaded @ server level (in server's lib directory). i quite sure has tried that, , hope person share or provide links. you include quartz 1.6 in war or ear, , application use instead. however, application components within war or ear use new jar, may problem or advantage, depending on how you've set deployments.

iphone - Check if user has a song from iTunes in his library -

i building iphone app music album released on itunes, client requested if user purchased album, app should allow play these songs in app while playing games. need find way how quicly check if song available in ipod library. i've heard every song itunes has unique id have no idea how use it. searching name of song not option in library mine cause have on 20 gigs of music ... thanks, ondrej you have 20 gigs of music data, not names. searching unique id involves same number of searches name, have same number of tracks. happens if user bought cd , ripped ipod?

Problem uninstalling an Application package from Android device -

we have application on start pulls terms , conditions screen. when user declines these terms have ask user if wishes delete package. so, within application launch following intent: uri uninstalluri = uri.parse("package:some.package.name"); intent intent = new intent(intent.action_delete, uninstalluri); startactivity(intent); this brings settings-> manage applications -> uninstall page our application. the user can go ahead , uninstall pacakge. when chooses not to(by pressing cancel) taken our terms , conditions activity. if presses again, taken out of application. problem if pull launcher menu, our application icon not show up. can see in "recently launched application list" , application still there on device. is because packagemanager disabled our application? if so, how re-enable it? what did miss here? please help. thanks.

.net - How to return the result of dialog window work in the moment of its closing? -

everyone knows messagebox.show() method, returns dialogresult value after dialog closed. how can implement such method in dialog class? class mydialog : form { public static mydialogresult show() {}; } the problem, can guess, method returns value after user clicks button in dialog. you can set dialogresult property on button. if button clicked specified value returned showdialog() method.

c - How to initialize all members of an array to the same value? -

i have large array in c (not c++ if makes difference). want initialize members same value. swear once knew simple way this. use memset() in case, isn't there way built right c syntax? unless value 0 (in case can omit part of initializer , corresponding elements initialized 0), there's no easy way. don't overlook obvious solution, though: int myarray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }; elements missing values initialized 0: int myarray[10] = { 1, 2 }; // initialize 1,2,0,0,0... so initialize elements 0: int myarray[10] = { 0 }; // elements 0 in c++, empty initialization list initialize every element 0. not allowed c: int myarray[10] = {}; // elements 0 in c++ remember objects static storage duration initialize 0 if no initializer specified: static int myarray[10]; // elements 0 and "0" doesn't mean "all-bits-zero", using above better , more portable memset(). (floating point values initialized +0, pointers null...

sql server 2005 - SQL - looping through columns, once empty is found, update it -

i started similar thread problem more difficult, start scratch. imagine there 10 inventory slots (in db columns in user's row). when users picks item up, should placed first empty column (it gets updated). how looping through columns (except if exists) in query if want have still flexible design? cannot solved having items in rows order of items matters (each item belongs particular slot). if users has 1nd , 3rd slot full, next picked item should go 2nd. hope more clear now, thanks! why not have table inventory items? you'd have inventory table , inventory_item table, this: ---------- inventory ---------- id int description varchar(100) --------------- inventory_item --------------- id int inventory_id int (foreign key inventory table) sequence_num int (indicates "slot" data represents) so now, have row in inventory, , insert rows inventory_item values. if have 3 values, insert 3 rows inventory_item. "slot" go in, sequence_num field tell ...

matlab - Why does fopen fail the first time, but work the second time? -

i using matlab create new file calling fid = fopen(filename,'w') since filename doesn't exist, should create new file , give me valid file descriptor. instead returns -1. if run code again however, fid = 3. this being run on ubuntu apparently works fine on windows , can't figure out why. -mike not sure if helps, note if folder doesn't exist, fopen 'w' can't create file , returns -1.

syntax - Haskell: Would "do" notation be useful for contexts other than monads? -

we love do , , curious if perhaps sort of alternate syntax theoretically useful outside of monad world. if so, other sorts of computations simplify? make sense have equivalent applicative, example? it might consider, regarding do notation itself, it's actually for. travis brown points out, i've advocated use of "function application" style monad s , related types, there's flip side well: some expressions can't written cleanly in direct function application style . instance, following can make applicative style clumsy: intermediate results used in multiple subexpressions, @ different depths of nesting arguments outermost function used deeply-nested in subexpressions awkward or inconsistent argument order, i.e. needing partially apply function other first argument deeply embedded flow control based on intermediate results, shared subexpressions between branches pattern matching on intermediate results, particularly in case of extracting par...

c# - Is there a free SQL formatting library for .NET? -

i've been looking free library/source code format sql queries, preferably in .net, quite while. after searching of responses here on so, i'm @ point i'm willing believe nothing exists. the closest thing i've found, project called sqlformat , not seem active, nor support workable subset of sqls features formatting. are there free or open source sql formatting libraries out there? don't want canned product, need integrate functionality tool i'm building. web services aren't acceptable either, since ones have found t-sql tidy haven't proven reliable. i don't know free version, there 1 here $100 , can try 60 days (choose api version). http://www.dpriver.com/buynow.php it's not free, @ $100, it's less 2 hours of time trying find/integrate free one

cocos2d iphone - what's the difference between CCCallFunc and CCCAllFuncN -

yeah, not sure understand difference. because can specify target object using cccallfunc well. cccallfuncn passes ccnode called action on method. example if need run action removes node parent can use cccallfuncn , said method this: -(void)thecalledmethod:(ccnode *)thepassednode { [thepassednode.parent removechild:thepassednode]; } if used cccallfunc instead have keep reference said node in order able retrieve later , remove in called method.

c# - How do I out put the JSON format for other website? -

This summary is not available. Please click here to view the post.

iphone - How do I create a rounded table with controls in the cells? -

i'm exploring iphone sdk , want create , use ui component figure below. rounded table cells in each cell can have label text, maybe input text field , action button take next screen. table should not screen filling. but... can't figure out how or find example code. 'table view' seems result in screen filling table , although 'table view cell' looks need can't find examples. i'm sure it's not hard, can't find it. tips, pointers appreciated. (this figure example of sort of ui component i'm looking for, i'm not build related flight tracking...) table component http://gerodt.homeip.net/table_ui_component.png gero try looking @ "5_customtableviewcell" project of tableviewsuite code sample apple. should how create custom subclasses of uitableviewcell. the short answer is, alluded above, you'll want subclass uitableviewcell , add custom ui elements it. example provided, you'd want 2 different types of ce...

Which is the best alternative for Java Serialization? -

i'm working on project needs persist kind of object (of implementation don't have control) these objects recovered afterwards. we can't implement orm because can't restrict users of our library @ development time. our first alternative serialize java default serialization had lot of trouble recovering objects when users started pass different versions of same object (attributes changed types, names, ...). we have tried xmlencoder class (transforms object xml), have found there lack of functionality (doesn't support enums example). finally, tried jaxb impose our users annotate classes. any alternative? the easiest thing still use serialization, imo, put more thought serialized form of classes (which ought anyway). instance: explicitly define serialuid. define own serialized form appropriate. the serialized form part of class' api , careful thought should put design. i won't go lot of details, since pretty have said comes effect...

url - How do I check for valid (not dead) links programmatically using PHP? -

given list of urls, check each url: returns 200 ok status code returns response within x amount of time the end goal system capable of flagging urls potentially broken administrator can review them. the script written in php , run on daily basis via cron. the script processing approximately 1000 urls @ go. question has 2 parts: are there bigtime gotchas operation this, issues have run into? what best method checking status of url in php considering both accuracy , performance? use php curl extension. unlike fopen() can make http head requests sufficient check availability of url , save ton of bandwith don't have download entire body of page check. as starting point use function this: function is_available($url, $timeout = 30) { $ch = curl_init(); // curl handle // set curl options $opts = array(curlopt_returntransfer => true, // not output browser curlopt_url => $url, // set url cur...

android - How to animate views? -

i'm working on game in ways similar tetris (imagine 2d array of colored squares move around) i trying animate individual squares smoothly slide down coordinate next. since wanted use android's built-in tweening feature, animation has apply whole view (rather parts of it). doesn't work me because want of colored squares slide down, , rest of them stay still. the (theoretical) solution came resolve make 2 views, layered directly on top of each other. top view animating squares when need move, , bottom layer static squares. animation-layer transparent until ready animate something. turn on colored square in animation-layer, tween new location, , turn off when done. in same time span, static-layer turns squares on , off @ right time make whole thing seamless end user. the proposed solution theory, since haven't been able make work correctly yet. since have been having trouble, wondering if best way solve problem? perhaps there more elegant solution on looking? kno...