Posts

Showing posts from August, 2010

c# - implementing a recursive linq -

so let's have table relation itself, example table page ------------- idpage description idpage_fk <-- foreign key now table it's mapped entity framework this class page ----------- int idpage string description int idpage_fk page page1 icolletion<page> page2 what want archive if it's possible, it's created linq expression navigate on table make output in string variable: assuming values in table idpage description idpage_fk 1 example null 2 example2 1 3 example3 2 this output on string variable string inheritance = (from p in page select....) the output this example > example2 > example3 it's possible? or have create method loop each element create variable? sorry, can't recursive linq out database - you'll either have write iterative function or create stored procedure you. similar question: how entity framework work recursive hierarchies? in

ios - Distance Attenuation with OpenAL on iPhone/iPod -

after messing around distance attenuation in openal, i've come strange results. i've tried different distance models , different values options on sources. it's same, no volume falloff, , panning full left or full right. also, on headphones, device speaker plays left channel (which either full or nothing). using mono sounds, it's not stereo problem. why isn't panning , volume falloff working properly? common problem on iphone? there's not out there it, , i've read whole openal documentation. also, how force device speaker play both channels (as mono source) instead of one?

java - JSlider not updating? -

i'm quite beginner regarding whole drawing stuff in windows , i'm kinda stuck @ moment. @ moment i'm testing things out. import javax.swing.*; import java.awt.*; import javax.swing.event.*; public class test extends jframe { jslider slider1; public test() { slider1 = new jslider(jslider.vertical, 0, 50, 0); setlayout(new flowlayout(flowlayout.trailing)); add(slider1); } public void changevalue () { slider1.setvalue(25); } public static void main(string args[]) { test gui = new test(); gui.setdefaultcloseoperation(jframe.exit_on_close); gui.setsize(550,250); gui.setvisible(true); } } so create jslider call slider1, give orientation , values. when call changevalue method changes slider1 value. there's no change on gui. point me correct direction? have refreshing gui? after initializing slider1 variable in test() constructor, add these lines jsli

spring orm - what's the different between SqlMapClient and SqlMapSeesion in ibatis? -

when read ibatis-sqlmap-2.3.4,i find both implements sqlmapexecutor. sqlmapclientimpl insert localsqlmapsession provide thread safe. but in spring2.5.6, execute method of sqlmapclienttemplate use sqlmapclientimpl this: sqlmapsession session = this.sqlmapclient.opensession(); ... return action.doinsqlmapclient(session); the opensession method return new sqlmapsessionimpl each time. my questions are: why sqlmapclienttemplate use sqlmapseesion instead of sqlmapclient ? why localsqlmapsession of sqlmapclient unused in sqlmapclienttemplate ? use this: return action.doinsqlmapclient(this.sqlmapclient); what's different between sqlmapclient , sqlmapseesion ? for first question, spring-orm explain in comment: // need use sqlmapsession, need pass spring-managed // connection (potentially transactional) in. shouldn't necessary if // run against transactionawaredatasourceproxy underneath, unfortunately // still need make ibatis batch execution work

pointers - C++: Why does dereferencing this vector iterator segfault? -

void insert_string( std::vector<std::string> & strings, const std::string &s ) { std::vector<std::string>::iterator it=lower_bound(strings.begin(),strings.end(),s); if(strings.size()>0) std::cout<<*it<<" found\n"; // **** strings.insert(it,s); } when attempting use function, first insertion goes fine. second insertion output "[firststring] found" , segfault. if comment out if/cout line, can repeatedly call , no segfaults occur. i've tried doing std::string tmp=*it; segfault on line. while printing not huge deal, i'm trying check if string @ position found lower_bound same string trying inserted (i.e., if(*it==s) , segfaulting above 2 examples). what missing here? thanks! check condition if it == strings.end() , if don't print it. cause issue. sure string you're trying check in vector of strings?

How to implement new Android selection mode while retaining backward compatibility with Android 2.x? -

according android design guidelines new convention long pressing on list item switch 'selection mode'. i realise the selection mode new , heavily integrates actionbar not expecting available 2.x devices. wondering strategies being used support new selection mode ics devices while retaining backward compatibility 2.x devices? shortly, can use actionbarsherlock 4.0 give action bar action modes works across android versions 2.1 onwards. 4.0 being released today if understand correctly. if not wish this, use context menus on android 1.x/2.x devices , action modes on android 3.0+ devices. here sample project demonstrating using checklist , action mode on android 3.0+ while using context menus on older devices.

css - Possible bug when changing element class name with javascript in IE8, IE9 and IE10 -

note: had previous similar question i've attempted delete. thought problem .net webbrowser control it's ie. the following code contents of .htm file displays 3 items can clicked. each item clicked javascript method changes background blue , changes selected item background white. here's problem, occurs ie8, 9 , 10. works in ff, chrome , managed demonstrate works in ie5 , ie7 using ie10 developer preview. click on item 1, click on item 1.1 - item 1.1 highlighted item 1 not de-highlighted. however (moving document tree): click on item 1, root - no problem click on item 1,1 item 1 - no problem. now, if switch javascript selectelement(e) method first deselect select, problem becomes: click on item 1.1 click on item 1 - there noticeable delay between item 1 being clicked , blue background being displayed. if image tags removed, problem goes away. scrolling item out of view , in again fixes rendering. unfortunately, calling invalidate or update not fix

PHP readir results - trying to sort by date created and also get rid of "." and ".." -

i have double question. part one: i've pulled nice list of pdf files directory , have appended file called download.php "href" link pdf files don't try open web page (they save/save instead). trouble need order pdf files/links date created. i've tried lots of variations nothing seems work! script below. i'd rid of "." , ".." directory dots! ideas on how achieve of that. individually, these problems have been solved before, not appended download.php scenario :) <?php $dir="../uploads2"; // directory files stored if ($dir_list = opendir($dir)) { while(($filename = readdir($dir_list)) !== false) { ?> <p><a href="http://www.duncton.org/download.php?file=login/uploads2/<?php echo $filename; ?>"><?php echo $filename; ?></a></p> <?php } closedir($dir_list); } ?> while can filter them out * , . , .. handles always come first. cut them away. in particular

objective c - Cocoa: how to get type of button when I have an "id button" variable -

i'm working on code need able type of button based on "id button" variable. button can either radio, checkbox or plain pushbutton. nsbutton class has setbuttontype member no feature type of button. you can't. documentation linked to, here's bit on setbuttontype : the types available common button types, accessible in interface builder. can configure different behavior nsbuttoncell methods sethighlightsby: , setshowsstateby: . note there no -buttontype method. set method sets various button properties establish behavior of type. if need figure out type of arbitrary button, you'll need make table determines buttontype based on possible values of highlightsby , showsstateby .

How can I get SQL Server database properties from C# code? -

i've c# 4.0 console application , sql server 2008 database , running on database server. does know if there way database properties (like "database read-only" ) c# code? my guess should be, not able find out accurate solution. thanks in advance there @ least 2 ways it. 1 use database metadata tables other use sql management objects in both cases there's lot of data there need know want. example how "database read-only" property mentioned. using sqlcommand against metadata using (sqlconnection cnn = new sqlconnection("data source=.;initial catalog=master;integrated security=sspi;")) { sqlcommand cmd = new sqlcommand("select is_read_only sys.filegroups",cnn); cnn.open(); var isreadonly = cmd.executescalar(); console.writeline(isreadonly ); } using smo using system; using microsoft.sqlserver.management.smo; namespace smo_test { class program { static void main(string[] args)

visual c++ - Which option is the best choice for "Runtime library" and "Use of MFC" -

i want write programme vc++ in vs 2008 . , hope programme can run on win nt, xp, vista , win 7 . , hope programme .exe file. i have no idea option of " runtime library " , " use of mfc " combination below: ------------------------------------------------------------------------ | |multi-threaded | multi-threaded dll| ------------------------------------------------------------------------ |use mfc in static library | | b | ------------------------------------------------------------------------ |use mfc in shared dll | c | d | ------------------------------------------------------------------------ i have question, if got it, please me favor. thanks. 1 .the 4 combination 1 best choice me? a, b, c or d ? 2 .after test, choice b occur compile error, why? 3 .when create new project or solution in vs, default option d , d best choice co

Get url favicon with Jquery -

i found script allows display favicons based on url on here: andreaslagerkvist its pretty simple script, there example when copy/paste example doesn't seem work..please take @ demo: jsfiddle what doing wrong? missing in script? you never called plugin, defined it. plugin definition jquery.fn.favicons = function (conf) { var config = jquery.extend({ insert: 'appendto', defaultico: 'favicon.png' }, conf); return this.each(function () { jquery('a[href^="http://"]', this).each(function () { var link = jquery(this); var faviconurl = link.attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1') + '/favicon.ico'; var faviconimg = jquery('<img src="' + config.defaultico + '" alt="" />')[config.insert](link); var extimg = new image(); extimg.src = favic

apache - How could htaccess redirect two hosts to subdirectory -

how both localhost , remote hosts redirect root sub-directory? local host : domain.localhost remote host : domain.com sub directory : subdir domain.localhost -> domain.localhost/subdir/<br> domain.localhost/ -> domain.localhost/subdir/<br> domain.com-> domain.com/subdir/<br> www.domain.com -> www.domain.com/subdir/<br> options +followsymlinks directoryindex questions.php rewriteengine on rewritecond %{http_host} ^domain\.localhost$ rewriterule ^(.*)$ http://domain\.localhost/subdir/$1 [r=301,l] rewritecond %{request_uri} ^/$ rewriterule (.*) http://www.domain.com/subdir/ [r=301,l] for principles: domain.localhost -> domain.localhost/subdir/ domain.localhost/ -> domain.localhost/subdir/ domain.com-> domain.com/subdir/ www.domain.com -> www.domain.com/subdir/ here precise rewriterules: options +followsymlinks directoryindex questions.php rewriteengine on # domain.localhost -> domain.localhost/subdir/ rewr

dom - Query table cell contents from Javascript -

i'm having trouble using variable in following code snippet , wondered if correct mistake ... function displayresult(x) { var myrowindex=x.rowindex; var mycell=document.getelementbyid('msgtable').rows[myrowindex].cells[0].childnodes[0].data; alert("cell content: " + mycell); } myrowindex being correctly populated, when used in definition of mycell error: document.getelementbyid("msgtable").rows undefined my overall intention dynamically building table , users have option select row table. on selection more detail provided in separate box. table sortable first determine relevant rowindex , retrieve dataindex (which in cell[0]). i seems work fine using test edit on w3schools site, in own code seem destroying rows object! thanks, pete

jquery - Stop SoundManager 2 playback on close of Colorbox window? -

i have instance of soundmanager 2 setup inline html displays list of songs within colorbox window. until close colorbox window. sound continues unless reopen window , stop manually. thought use oncleanup callback soundmanager.stopall(); method sound stops window begins close. because jquery skills of beginner i'm not sure of proper placement or syntax. i'm calling colorbox windows basic syntax of: $(document).ready(function(){ $(".inlineplayer1").colorbox({inline:true, width:"300px",height:"530px"}); $(".inlineplayer2").colorbox({inline:true, width:"300px",height:"550px"}); });

r - average time-distance between grouped events -

df battle events within years & conflicts. trying calculate average distance (in time) between battles within conflict years. header looks this: conflictid | year | event_date | event_type 107 1997 1997-01-01 1 107 1997 1997-01-01 1 20 1997 1997-01-01 1 20 1997 1997-01-01 2 20 1997 1997-01-03 1 what first tried was time_prev_total <- aggregate (event_date ~ conflictid + year, data, diff) but end event_date being list in new df. attempts extract first index position of list within df have been unsuccessful. alternatively suggested me create time index within each conflict year, lag index, create new data frame conflictid , year , event_date , , lagged index, , merge original df, match lagged index in new df old index in original df. have tried implement little unsure how index obs. within conflict years since unbalanced. you can use ddply split data.frame pieces (one per year , conflict

Disabling scrolling on a gtkmm combobox -

one gtkmm screen i'm working on contains horizontalbox (which scrolls), box contains several frames, each frame has combobox. issue i'm running when user attempts scroll horizontalbox, cursor on 1 of comboboxes , combobox scrolled instead of horizontalbox. causes serious problem data entry. i've attempted fix situation hijacking scroll event: screenobject::screenobject() { m_cbox->signal_scroll_event().connect(sigc::mem_fun( *this,&screenobject::scrolloverride)); //combobox populated here } bool screenobject::scrolloverride(gdkeventscroll *scroll) { cout <<"scroll attempted!\n"; return true; } i hover mouse on combobox , spin scroll wheel, combobox scrolls usual, , debug message not sent console (which plain confusing). no matter combobox, can't seem event fire. is there other signal need hijack in order suppress combobox scrolling? there constructor option combobox tell ignore scrolling signal?

sql - Prevent duplicate COUNT in SELECT query -

i have following query can see multiple count(competitorid) calls. performance issue, or sql server 2008 'cache' count ? if performance issue, possible store count prevent multiple lookups? select eventid,count(competitorid) numberrunners, case when count(competitorid)<5 1 when count(competitorid)>=5 , count(competitorid)<=7 2 else 3 end numberplacings comps group eventid order eventid; its better practice value once , use subsequently whenever possible. in case, can use inner query count once , compute other (derived) columns off value shown below: select eventid, numberrunners, case when numberrunners <5 1 when numberrunners >=5 , numberrunners <=7 2 else 3 end numberplacings ( select eventid, numberrunners = count(competitorid) comps group eventid ) t order eventid;

objective c - How to add CoreData to exisiting Tab Based IOS project -

i have tried lot of different answers, can't seem work. trying add core data existing tab based project have. added core data framework through targets, set datamodel , entities correctly, can't seem access it. have gotten many different errors, recent is: *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'cannot create nspersistentstorecoordinator nil model' i set new utility based project using preset core data , copied code directly. changed file url name current project , doesn't work. here code: appdelegate.h #import <uikit/uikit.h> @interface appdelegate : uiresponder <uiapplicationdelegate> { bool isnotfirsttime; nsmutablearray *teammembers; nsmutablearray *projects; nsmutablearray *tasks; } @property(readwrite, retain) nsmutablearray *teammembers; @property(readwrite, retain) nsmutablearray *projects; @property(nonatomic, retain) nsmutablearray *tasks; @property(nonatomic)bool isnotfirsttime;

php - the function on Model doesn't work well -

i wanna ask validation on yii. i've put validation on model : public function cekdigit($attribute,$params) { $subject=substr($attribute,0,2); $pattern=$this->string2; if ($subject!==$pattern) { $this->adderror($attribute, $params['message']); return false; } } while ran that, turned on error message, condition true. meant, when put same string (which matched) still got error. how can fix becomes valid condition? thanks instead of if ($subject!==$pattern) you might want use if (strcmp($subject,$pattern) == 0)

javascript - Can I get the data of a cross-site <img/> tag as a blob? -

i trying save couple of images linked webpage offline storage. i'm using indexeddb on firefox , filesystem api on chrome. code extension, on firefox i'm running on greasemonkey, , on chrome content script. want automated. i running problem when retrieve image file. i'm using example code article titled storing images , files in indexeddb , error: images i'm trying download on different subdomain , xhr fails. xmlhttprequest cannot load http://...uxgk.jpg. origin http://subdomain.domain.com not allowed access-control-allow-origin. on firefox use gm_xmlhttprequest , it'd work (the code works on both browsers when i'm in same-origin urls), still need solve problem chrome, in other constraints (namely, needing interact frames on host page) require me incorporate script in page , forfeit privileges. so comes i'm trying figure out way save images linked (and may appear in) page indexeddb and/or filesystem api. either need realize how solve cross-origin

iphone - SVProgressHUD dismiss in viewWillDisappear OK? -

is ok call [svprogresshud dismiss] without ever showing it? reason want because want hud disappear when view disappears. it's ok, long doesn't crash lol. should fine, , it's not it'll take down whole app or remove critical code if goes wrong anyhow. literally, it's try , see now.

How to store css code in a php variable to be used with Javascript -

i'm developing product , 1 of options provide ability copy , paste own css gradient code reliable sources such colorzilla . how can save such code in php object (for use default settings) , output within javascript/jquery code while retaining programming sense of code. have tried using "addslashes()" no avail. at moment, i've got: $default_options = array( 'header_wrap_grad' => ' background: rgb(169,3,41); /* old browsers */ background: -moz-linear-gradient(top, rgba(169,3,41,1) 0%, rgba(143,2,34,1) 44%, rgba(109,0,25,1) 100%); /* ff3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(169,3,41,1)), color-stop(44%,rgba(143,2,34,1)), color-stop(100%,rgba(109,0,25,1))); /* chrome,safari4+ */ background: -webkit-l

javascript - window.open is not applying the given height parameter -

i have onclick event on link inwhich window.open url executed , have given custom width , height it, not accepting , pop window displayed different width , height.. can guide me must wrong that my window.open syntax follows onclick='var myw=window.open ("http://www.google.co.jp/","mywindow","location=1,toolbar=1,menubar=1,resizable=1,width=846,height=786"); also how change display position of pop window in screen? note: after replies being positive code.. tried , found after thinking whatever size giving in parameter browser taking more that... may thats due resolution.... your code working fine : <html> <head> </head> <body> <input type="button" value="cl" onclick='var myw=window.open ("http://www.google.co.jp/","mywindow","location=1,toolbar=1,menubar=1,resizable=1,width=200,height=200");'> </body> </html> for more

php - need help converting and calculating distance -

i'm stuck , need help. have database has on 3000 latitudes , longitudes , i'm trying convert them decimal lat , lon can display distance between 2 coordinates. 2 coordinates passed in url of page. first (lat1 & lon1) converted second (lat2 & lon2) not. latitude , longitude in database stored this: 26°56.34308' -094°41.32328' i'm thinking commas should removed. i've got code few sources i'm not sure how put them properly. ///// 2 locations url $lat1 = $_get[lat1]; $lon1 = $_get[lon1]; ////// lat2 & lon2 ones need converted $lat2 = $_get[lat2]; $lon2 = $_get[lon2]; ///// convert lat2 & lon2 decimal format $pos1 = strrpos($mystring, "°"); $pos2 = strrpos($mystring, "."); $pos3 = strrpos($mystring, "'"); // subsring string: substr(source, start, length) $deg = substr($mystring, 0, $pos1); $min = substr($mystring, $pos1, $pos2 - $pos1); $sec = substr($mystring, $pos2, $pos3 - $pos2); function dmsto

spring - Jar utility for the Java package org.apache.poi.hssf.usermodel.* -

i'm working spring/hibernate (using netbeans 6.9.1). need import excel sheet oracle database (10g). i have visited articles , tutorials one in found appropriate code jar utility containing java package org.apache.poi.hssf.usermodel.* needed functionality perform has not been mentioned in of these tutorials have found on internet. 1 question... from can download jar utility containing package org.apache.poi.hssf.usermodel.* ? this package contains java classes like org.apache.poi.hssf.usermodel.hssfsheet; org.apache.poi.hssf.usermodel.hssfworkbook; org.apache.poi.hssf.usermodel.hssfrow; org.apache.poi.hssf.usermodel.hssfcell; you can use findjar service find jar containing class. in case, can find results here : http://www.findjar.com/class/org/apache/poi/hssf/usermodel/hssfrow.html

How do you change the default windows in Netbeans? -

Image
i'm using netbeans, , want variables window automatically come whenever i'm debugging. there way make happen? easy peasy: when debugging, open variables window. on right top of window, see "pin" , "close" icons. click on "pin" icon, pinned , see later on if attempt debug something.

java - Count characters with TextWatcher fails on HTC longpress -

i have 3 edittext elements, , want jump 1 field next if there 4 characters in input. i use textwatcher this: geteditview(r.id.edit_code1).addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) {} @override public void beforetextchanged(charsequence s, int start, int count, int after) {} @override public void aftertextchanged(editable input) { if(input.length() == 4){ geteditview(r.id.edit_code2).requestfocus(); } } }); the inputtype edittext "textcapcharacters" when doing longpress on key number, holding r 4, devices not add letter, until user stops holding button, , fire aftertextchanged after letter 4 selected. on htc keyboard (in case htc desire on 2.3.5) not case. though user still holding button, r added edittext , aftertextchanged fired, , code job , puts focus on next field. how can undesired behavior prevented? watching onke

c# - How do i simplify 2 foreach using LINQ? -

how can in more readable way? foreach (var actual in actualpositions) { foreach (var projection in projections) { var position = create(book, actual, projection); position.targetnett = projection.dailyprojectednet.tostring(); yield return position; } } you want simplify that? why? it's simple , readable , understandable. can come sorts of gobbledygook harder read sure looks cooler. not! resist urge fancy.

android - setting up JSON format link -

i'm trying setup json format link can parse. format right guys? {"suspended": "false","firstname": "john","lastname": "smith","checkedin": 0,"checkindatetime": 0,"address": {"streetaddress": "21 2nd street","city": "new york","state": "ny","postalcode": "10021"},"phonenumber": [{ "type": "home", "number": "212 555-1234" },{ "type": "fax", "number": "646 555-4567" }]} yes valid json - can use this validate it

prepared statement - PreparedStatement Delete in Java -

i have written code delete record in mysql database java program. compiles , runs successfully, record still in datbase. suggestions? jbutton btndelete = new jbutton("delete"); btndelete.addactionlistener(new actionlistener() { public void actionperformed(actionevent arg0) { try { object[] options = {"yes", "no"}; component form = null; int n = joptionpane.showoptiondialog(form, "do delete record student id: " + textfield_16.gettext() + " ?", "exit confirmation", joptionpane.yes_no_cancel_option, joptionpane.question_message, null, options, options); if(n == joptionpane.yes_option) { string mock = textfield_16.gettext(); string sql = "delete mockexam mockid =?"; preparedstatement prest = con.preparestatement(sql); prest.setstring(1, mock); int v

Error #1009, ActionScript 3, Bullet is null -

typeerror: error #1009: cannot access property or method of null object reference. @ main_fla::maintimeline/bulletfire()[main_fla.maintimeline::frame32:68]. occurring , have no idea why...please help, has been days of me troubleshooting , lost. thanks, also, reason when fire bullet goes @ 45 degrees , 225 degrees...thanks guys //create array hold multiple sprites var myspriteholder:array = []; //create counter keep track of number of sprites var lbcounter:int = 0; //maximum number of sprites on canvas var maxlb:int = 1; //keypress code stage.addeventlistener(mouseevent.click, dropbullet); //function mouse event fire bullet function dropbullet(evt:mouseevent):void{ var bcos:number = math.cos((turret.rotation) * math.pi / 180); var bsin:number = math.sin((turret.rotation) * math.pi / 180); //starting x , y var startx:number = turret.x + (15 * bcos); var starty:number = turret.y + (15 * bsin); //calculates bullet needs go aiming in front of gun

ipad - Universal cocos2d game to support iPad3 -

how image resources named ipad & ipad hd versions in universal app? when supporting normal , hd images iphone use imagename.png & imagename-hd.png . if make universal right in assuming have rename images , use imagenameipad.png & imagenameipad-hd.png ? please let me know how naming convention works. thanks abhinav the correct way in cocos2d (version 2.0 or 1.1beta) this: normal iphone: image.png retina iphone: image-hd.png normal ipad: image-ipad.png retina ipad: image-ipadhd.png you must call image.png in code, code detect device , use file properly.

artificial intelligence - Where to start on making an A.i. in Ada -

this first question on stackoverflow. i'm wanting make a.i. using ada programming language where start , libraries available? my os ubuntu 11.10 my language ada 95 there discussion nice links books , frameworks: ai library framework in ada also google gives link: ada artificial intelligence: http://mind.sourceforge.net/ada.html

java - In ZooKeeper, is there a way to write a hierarchy atomically without implementing distributed locks yourself? -

let's want write out tree zookeeper . . / \ . b c . / \ . d e some other client come along , delete node b right after create before i'm able write node 'd' or 'e'. is there way can write hierarchy atomically, or possibly lock path? you can use new multi() api it completes operations or aborts them all.

java test - package a java app for running on another linux box -

i have java test app. code sample import section follows. created quick/short bash script build app/run app. works. java test runs. i'm trying figure out how quickly/easily "package" java app (and associated files) run java test on linux box. pointers solutions appreciated. test code: import java.sql.*; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import java.util.date; import org.json.simple.*; // json package, download @ http://code.google.com/p/json-simple/ import java.net.urldecoder; import java.net.urlencoder; import java.lang.string.*; public class ms1 { private connection conn = null; private statement stmt = null; . . . is simple doing tar? package thing? trying head around how works small projects in java. update:: the test cmdline. there's no using of ide/eclipse. i

c++ - difference between function parameters -

in parameter's of function, want pass default argument function template. i'm trying decipher difference between (*cmp) or (cmp) in function below: template <typename type> int foo(some var, int (*cmp)(type one, type two) = functtemplate) { ... i used seeing * pointer declaration... pointer function functtemplate? why program see work regardless of way write (astrik or no astrik)? the types not same, there no difference when used parameter type in function declaration. in int (*cmp)(type, type) , cmp has pointer-to-function type (or "function pointer" type). in int (cmp)(type, type) , cmp has function type (i.e., not pointer type @ all). however, c , c++ both have rule parameter has function type implicitly converted corresponding function pointer type, parameter has array type implicitly converted corresponding pointer type.

java - IntelliJ IDEA: How can I make sources of dependent libraries to be available in classpath on compilation? -

how can make sources of dependent libraries available in classpath on compilation ? i'm using intellij idea 11. when add global library module , artifact ide never copies sources , javadocs. makes sense because not needed in runtime. need them in compile time. interestingly though idea makes sources available if add dependency folder. guess in case doesn't differentiate sits in folder. odd. thoughts ? i solved issue in maven config specifying dependency hibernate-validator 1 sources , 1 without. the 1 sources defined: classifier: sources scope: provided ex: <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>4.1.0.final</version> <exclusions> <exclusion> <groupid>javax.xml.bind</groupid> <artifactid>jaxb-api</artifactid> </exclu

javascript - Ajax script fails in IE8 -

the following script executes , works fine in safari, chrome , firefox - not in ie8. unfortunately ie8 1 of targeted browsers bit of problem. since don't have lot of experience ajax i'm not sure begin looking either. i've noted ie reports error on line 15 (marked **) doesn't make sense if-else should stop looking @ line. function getnames(str) { var xmlhttp; // clear previous queries if(str.length == 0){ document.getelementbyid("txthint").innerhtml = ""; return; // due high number of possible hits we'll demand 3 chars // before start querying. }else if(str.length < 3){ return ; } if (window.xmlhttprequest){ // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); }else{ // code ie6, ie5 **xmlhttp = new activexobject("microsoft.xmlhttp");** } xmlhttp.onreadystatechange = function (){ if(xmlhttp.status

How to limit integer values to 16bit only in SQLite fields -

i using sqlite db sqlite expert personal admin tool design , add data. my question is, how limit value of int fields 16bit user cannot add number > 65535? please suggest other better sqlite admin tool if using not great. thanks you can create table in question constraint; create table test ( col1 int, constraint my_limit check (col1<65536) ); which won't let insert numbers larger 65535 in column. (you may want remember limit below 0 if that's requirement) sadly can't add constraint existing table in sqlite .

mongodb - Promote secondary to primary from secondary node -

my test system (due lack of resources) has dual mongodb replicaset. there no arbiter. during system changes 1 of servers got put out of action , not coming back. server happened host primary mongo node. left other member of set secondary. i know should have had @ least 3 nodes cluster (our prod setup does). is there way can make primary offline step down? haven't been able change of rs.conf() settings because working node secondary. starting arbiter doesn't seem work because cannot add replset primary down. has encountered before , managed resolve it? to recap: server (primary) - offline server b (secondary) - online a + b = replset any appreciated. the mongodb website has documentation (in emergency only) when need reconfigure replica set when members down . sounds situation in. basically, if you're on version >= 2.0, , it's emergency, can add force: true replica set configuration command.

Asp.net Application Security -

my firm planing develop online banking system in asp.net/c# .as have not yet started yet , thought nice if suggestions guys. first of , security ,, how should ssl certificate application ,,, provided people host our website. secondly ,, our requirement such example , if user looged in, should able use application in new tab or new instance of browser , not in browser of different type ,,, how achieve this. guess forms authentication , session solve our problem or there additional. suggestions helpful. thanks. you can read more creating secure asp.net website in below link design , deploy secure web apps asp.net 2.0 , iis 6.0

extjs - The content in form window is not selectable. It also drag the whole inner content when try to select. how to avoid it -

var settingform = ext.create('ext.form.panel', { frame: false, bodystyle: 'padding:5px 5px 0', modal: true, resizable: false, draggable: true, forceselection: true, fielddefaults: { labelalign: 'right', //msgtarget: 'side', labelwidth: 140 }, items: [{ xtype: 'fieldset', anchor: '100%', title: 'some information', layout: 'column', items: [{ xtype: 'container', columnwidth: .5, layout: 'anchor', items: [{ xtype: 'hiddenfield', name: 'txthiddenid', id: 'txthiddenid' }, { xtype: 'textfield', fieldlabel: 'host name', name: 'txthostname', id: 'txthostnameid', allowblank:

In java "string" == "string" is false why? -

the following statement appears in section 3.10.5. string literals of java language specification : a string literal refers same instance of class string. because string literals - or, more generally, strings values of constant expressions (§15.28) - "interned" share unique instances, using method string.intern. i using java jdk 7 , eclipse indigo. and test program follows: public class main { public static void main(string[] args) { string s1 = "string"; string s2 = "string"; system.out.print(s1 == s2); // true system.out.print(" , " + "string" == "string"); // false } } this operator precedence issue. == operator has lower precedence + operator. what testing whether (" , " + "string") equal "string" . isn't. if mean compare "string" , "string" should write: system.out.print("

css - Combining multiple "transform" entries in Less -

i have 2 mixins both convert -webkit-transform : .rotate(@deg) { -webkit-transform: rotate(@deg); } .scale(@factor) { -webkit-transform: scale(@factor); } when use them together: div { .rotate(15deg); .scale(2); } ... (as expected) show as: div { -webkit-transform: rotate(15deg); -webkit-transform: scale(2); } this doesn't seem valid css second has precedence on first; first discarded. combine transform entries should be: -webkit-transform: rotate(15deg) scale(2); how can accomplish such css generated less, i.e. multiple transform entries combined correctly? provide transforms arguments single mixin: .transform(@scale,@rotate) { -webkit-transform: @arguments; } i guess, achieve concatenate separate mixins 1 of guards, i'm not entirely sure;) i think not able achieve in way, since parser have modify code afterwards should not possible.

Why does this C# timer not fire? (Interval set based on current and picked time) -

i trying set tick alert timer based on time set datetime picker. dont tick alert @ all. if (datetimepicker1.value >= datetime.now) { sendorder.interval =(int) (datetimepicker1.value.ticks-datetime.now.ticks); sendorder.enabled = true; } in above code, set tick time based on difference between time datetimepicker - current time. doing wrong on one? assuming using system.timers.timer , interval in milliseconds, whereas specifying ticks. there 10,000 ticks in 1 millisecond. try instead: sendorder.interval = (int)(datetimepicker1.value.ticks - datetime.now.ticks) / 10000;

c# - Web API for .Net 3.5 SP1? -

is web api available .net 3.5 sp1? sp1 include system.web.routing assembly guess should available sp1 too. downloaded web api from: http://wcf.codeplex.com/wikipage?title=wcf%20http and downloaded "preview 1" (the oldest one) didn't managed compile source. stuck in .net sp1 in 1 project , need api. has managed use web api in 3.5 sp1 project? or rely on using wcf webhttpbinding only? webapi requires .net 4. can't use on .net 3.5 (sp1 or not). you can't use preview releases production code don't have "go-live" license, if work, wouldn't legal. need use @ least asp.net webapi beta go-live license.

iphone - XCode 4.3 fails to find built app to run -

just upgraded 4.2 4.3 , snowleopard lion. trying run app on device error: no such file or directory (/users/ransom/library/developer/xcode/deriveddata/nordicsemidemo-fbdqueftbwgnzeceifltlleucibx/build/products/debug-iphoneos/nordicsemidemo.app/nordicsemidemo) i can verify app @ path, , cd bundle , see contents. tried cleaning build. app runs in simulator. able run other apps same device, using seemingly same build settings. there no hard-coded build paths can tell. tried manually deleting build , directories.. it appears restarting mac solved issue.

entity framework - MySql MVC3 EF Code First with Stored Procedure -

i have stored procedure created in mysql return resultset create procedure getcount() begin select count(*) mytable; end$$ i trying call mvc3 application using ef cf as: int count = mycontext.database.sqlquery<int>("getcount").first(); it falling on call test in application error ; have error in sql syntax; check manual corresponds mysql server version right syntax use near 'getcount' @ line 1 is not supported using mysql? above works fine ms sql server 2008. wondering if problem mysql side. thanks try int count = mycontext.database.sqlquery<int>("call getcount()").first();

java - Sharing the session between Rails and Spring MVC -

in rails session stored in cookie , signed prevent forgery. looking if there best practices around getting rails cookie (and session) loaded spring mvc in way can read , used. string[] parts = urldecoder.decode(cookie).split("--"); byte[] decoded = base64.decodebase64(parts[0].getbytes()); string checksum = parts[1]; string decoded_string = new string(decoded); this gives serialized hash - ideal if deserialized hash in java. however, hoping others might have tested or done similar , can warn against potential pitfalls. related to: how can access rails' session in java app , how manage sessions in hybrid ruby/gwt system? in particular example can share information between applications using database, example redis or other key-value storage.

jquery - Struggling with slideToggle on nested lists -

first, honest i'm noob when comes jquery. i've been watching ton of tutorials , reading on jquery site itself. while beginning understand it, concept hasn't "clicked" me of yet. i'm working on product display want box slide down when hovering on product image. box contains list of models. i've got page set here: http://www.tailwatersflyfishing.com/sage-fly-rods this effect i'm trying duplicate (one of our rod vendors) http://www.sageflyfish.com/rods-landing.html i've attempted writing code, have failed @ getting work. have in page: $('document').ready(function () { $('.rod-tall').children('.rod-inner').children('.rod-list').hide(); $('.rod-list ul div li ul li a').click(function() { window.location = $(this).attr('href'); }); $(".rod-tall .rod-inner").mouseenter(function () { $(this).children('.rodlist').children('.desc-box').sli

objective c - Data points not showing when using Core Plot -

i'm making graph ios app, using core plot 1.0 , ios 5.1. i've went through tutorials can find core plot , have showing on graph except scatterplot data itself... can't post screenshot because of reputation here link one: http://francoismaillet.com/coreplot_problem.png i'm using numberofrecordsforplot , numberforplot methods simplescatterplot.m example . generatedata method generates numbers between 0 , 2. i've been turning in circles while , appreciated. here's class interface: interface pricechartviewcontroller : uiviewcontroller <cptplotdatasource, cptscatterplotdelegate>{ nsarray *plotdata; } here's viewdidload method: - (void)viewdidload { [super viewdidload]; [self generatedata]; cptgraphhostingview *hostingview = [[cptgraphhostingview alloc] initwithframe:self.view.bounds]; cptxygraph *graph = [[[cptxygraph alloc] initwithframe:self.view.bounds] autorelease]; cpttheme *theme = [cpttheme themenamed:kcp

java - How to remove an object from a list -

in java, can remove object list using method list.remove(object o), method uses equals method of object identify element in list. but, requires override equals method(otherwise default implementation of equals method used, involves comparing references). if dealing list of objects , developer doesn't have liberty change source code of object implement equals method, can do? wondering why java has not provided method list.remove(object o, comparator c), because remove object based on custom equality condition(implemented comparator), solutions problem? if want more complicated, can iterate yourself, performing comparisons want, , use list.remove(int) remove index.

graph - Dijkstra-based algorithm optimization for caching -

i need find optimal path connecting 2 planar points. i'm given function determines maximal advance velocity, depends on both location , time. my solution based on dijkstra algorithm. @ first cover plane 2d lattice, considering discrete points. points connected neighbors specified order, sufficient direction resolution. find best path (sort of) dijkstra algorithm. next improve resolution/quality of found path. increase lattice density , neighbor connectivity order, restricting search points close enough already-found path. may repeated until needed resolution achieved. this works well, nevertheless i'd improve overall algorithm performance. i've implemented several tricks, such variable lattice density , neighbor connectivity order, based on "smoothness" of price function. believe there's potential improve dijkstra algorithm (applicable specific graph), couldn't realize yet. first let's agree on terminology. split lattice points 3 categories:

delphi - Performances with FastReport TFrxCrossObject and large Grids (> 1000 rows) -

i use fastreport , need preview/print grids more 1000 rows , have performances problems. typically use tfrxcrossobject prepare grid because end user may change grid presentation (used columns, column's name, size) need have dynamical print. tested simple grid (16 cols x2000 rows) , needs more 10 seconds present first preview page. idea improve performances ? edit : said in answers, problem : how create 'dynamicaly' grid (with same columns names , sizes have on screen) in fastreport without using tfrxcrossobject seems not efficent. may admit solutions using dataset or enhancing tfrxcrossobject. the test code : unit unit1; interface uses windows, messages, sysutils, classes, graphics, controls, forms, dialogs, frxclass, stdctrls, grids, frxcross; type tform1 = class(tform) button1: tbutton; stringgrid1: tstringgrid; frxcrossobject1: tfrxcrossobject; frxreport1: tfrxreport; procedure button1click(sender: tobject); procedure formcrea