Posts

Showing posts from March, 2014

Finding duplicate atoms in possibly nested lists in LISP -

i trying figure out how find duplicate atom in possibly nested lists. have been trying figure out day. if please give me logic, great because want learn. basically (finddup '(a b b)) return t (finddup '(a c ((d (f a)) s))) return t the easiest , efficient way following (pseudocode): create data structure (such common lisp's hash table) remembering atoms seen create recursive sub-function actual traversing - walking nested lists , adding new atoms data structure, , if 1 there, returning true

c# inheritance override question -

fixed issues code. ok, think need clarify question. new a.example(); outputs "a" what should inside example method output "???"? possible? public class letter { public virtual void asastring() { console.writeline("???"); } public void example() { this.asastring(); } } public class : letter { public override void asastring() { console.writeline("a"); } public void example2() { base.asastring(); } } new a().example2(); new a().example(); that's easy: public void example() { console.writeline("???"); } from answer should realise asked wasn't thought asked for... if mean want call virtual method if wasn't virtual, not possible. if cast reference base class, still uses actual type of object determine method call.

java - Display numbers from 1 to 100 without loops or conditions -

is there way print numbers 1 100 without using loops or conditions "if"? can using recursion again has if condition. there way without using "if" well? no repetitive print statements, or single print statement containing numbers 1 100. a solution in java preferable. pseudo code. uses array force exception after 100 elements caught , nothing. function r(array a, int index){ a[index] = a[index-1]+1 print a[index] r(a, index+1) } try{ array a; a.resize(101) r(a, 1) }catch(outofboundsexception){ } edit java code: public void printto100(){ int[] array = new int[101]; try{ printtoarraylimit(array, 1); }catch(arrayindexoutofboundsexception e){ } } public void printtoarraylimit(int[] array, int index){ array[index] = array[index-1]+1; system.out.println(array[index]); printtoarraylimit(array, index+1); }

href - CSS - Hyperlinks aren't going anywhere -

for reason i've been trying figure out, links on page clickable, aren't going anywhere. markup looks fine, , can't figure out if there's issue css rendering them useless. added in z-index tag, but, had no effect. note: css below taken firebug, not actual stylesheet... markup: <li class=""> <span id="thmr_93" class="thmr_call"> <a href="/edit/1">edit</a> </span> </li> css: .tabs ul.primary, .tabs ul.primary li { float:left; line-height:normal; list-style-image:none; list-style-position:outside; list-style-type:none; margin:0; padding:0; text-align:left; } .tabs ul.primary li { color:#008080; text-decoration:none; height:30px; line-height:30px; margin:10px; width:100%; z-index:100; list-style-image:none; list-style-position:outside; list-style-type:none; text-align:left; } i going guess, bas...

Restarting windows service (hosting WCF service) after it reaches particular memory limit -

i restart windows service after memory consumption of reaches limit. scenario: i have wcf service hosted on windows service. wcf service keeps on increasing in memory consumption after every call without releasing seen task manager. results in outofmemory exception. restart windows service or servicehost hosting windows service after reaches memory limit. challenge face find out how memory consumed widows service/servicehost , restart out side or same application. i have posted regarding memory consumption issue did not found answer. wcf windows service not releasing resources/memory after every call

c# extracting words -

i have following piece of code me iam spliting words using 1 space , output output: when ambition ends happiness begins but want split words after 2 spaces mean output should this: when ambition ends happiness begins string vj = "when ambiton ends happiness begins"; list<string> k = new list<string>(); char ch = ' '; string[] arr = vj.split(ch); foreach (string r in arr) { response.write(r + "<br/>"); } string vj = "when ambiton ends happiness begins"; list<string> k = new list<string>(); char ch = ' '; string[] arr = vj.split(ch); bool flag=false; foreach (string r in arr) { if(flag) { response.write(r + "<br/>"); flag=false; } else { response.write(r + " "); flag=true; } } the above case specified (skipping single space). though not necessary, if want wrapped up, here : string mystring = "when ambiton ends ha...

php - Exception instead Notice -

i have 2 classes: class test { public $name; } /*******/ class myclass { private $_test = null; __get($name) { return $this->$name; } __set($name,$value) { $this->$name = $value; } } and when want use way: $obj1 = new myclass(); $obj1->_test = new test(); $obj1->_test->name = 'test!'; everything ok. possible, might use way: $obj1 = new myclass(); $obj1->_test->name = 'test!'; then notice "notice: indirect modification of overloaded property myclass::$_test has no effect in /not_important_path_here". instead notice want throw exception. how it? what you're looking errorexception object. function exception_error_handler($no, $str, $file, $line ) { throw new errorexception($str, 0, $no, $file, $line); } set_error_handler("exception_error_handler");

html - resize button image using javascript -

i want following button (and it's image) change size when click it. dialog showing, size not changing.. <html> <input type="image" src="pacman.png" onclick=" alert('test'); this.height='200px'; // change de button size // this.image.height='200px'; // not sure if line work.. "/> </html> need in javascript, no in css, becouse i'll make animation later.. you have manipulate "style" property: this.style.height = '200px';

c# - why in this case the compiler doesn't complain? -

this code: private treenode gettoplevelnode(treenode childnode) { if (childnode == null) throw new argumentnullexception("childnode", "childnode null."); if (childnode.parent == null) return childnode; treenode node = childnode; while (true) { if (node.parent == null) { return node; } node = node.parent; } } in while loop, if node.parent == null, node returned, why compiler doesn't report "not code paths return value" error? if 'node.parent == null' can't satisfied , no tree node returned. compiler can't detect situation? because using while(true){ , there no other way exit loop other using return. if node.parent == null cannot satisfied, infinite loop. therefore, there no way past loop without returning, , compiler doesn't complain. also, code specified return null treenode...

c# - Linq query with group by retrieving percentage -

i have calculate percentage in group clause. more in depth need calculate percentage of controlforms have status = 'false'. status in table checkresult. var items = (from controlform in datacontext.controlforms join controlformstatus in datacontext.controlformstatus on controlform.fk_controlformstatus equals controlformstatus.id join doccheck in datacontext.documentchecks on controlform.id equals doccheck.fk_controlform join checkresult in datacontext.checkresults on doccheck.fk_checkresult equals checkresult.id controlform.fk_controlcycle.tostring().equals(controlcycleid) & ( controlformstatus.description.equals(constants.controlformstatustestcontrolowner) | controlformstatus.description.equals(constants.controlformstatusapprovalprocessowner)) group controlform new { controlform.id, controlform.fk_controlcycle, controlform.fk_samplenode, controlform.fk_control, /*function*/} ct...

In C#, how do I make my button's text dynamic? -

i'm newbie when comes coding c#, please don't harsh on me. i've coded actionscript before, , notice it's similar. anyway, need build simple application 2 characters give each other "money"... or ints. character name should dynamic, , buttons should play off of names are. please help! have far: namespace lab_2 { public partial class form1 : form { guy firstname; guy secondname; int bank = 100; public form1() { initializecomponent(); firstname = new guy() { cash = 100, name = "joe" }; secondname = new guy() { cash = 50, name = "bob" }; firstname = textbox1.text; secondname = textbox2.text; updateform(); } public void updateform() { name1cashlabel.text = firstname.name + " has $" + firstname.cash; name2cashlabel.text = secondname.name + " has $...

WMI: "Invalid Namespace" when trying to retrieve "SqlServerAlias" scope -

following code throwing managementexception: "invalid namespace". idea? private managementclass getmanagementobject() { const string client = @"localhost"; const string sqlserveraliasscope = @"sqlserveralias"; const string aliasscopepart = @"\root\microsoft\sqlserver\computermanagement10"; managementscope scope = new managementscope(@"\\" + client + aliasscopepart); managementclass clientalias = new managementclass(scope, new managementpath(sqlserveraliasscope), null); clientalias.get(); // *** throws here *** return clientalias; } this ps script fails, should if above fails after all: get-wmiobject -namespace root\microsoft\sqlserver\computermanagement10 -class sqlserveralias am missing install server maybe? this works me: get-wmiobject -computer server -namespace root\microsoft\sqlserver\computermanagement10 -class sqlserveralias returns: __genus : 2 __class ...

openssl - Is it possible to use AES CTR mode encryption using the EVP API? -

i'm new openssl. understand encryption should performed using evp api acts common interface ciphers. aes ctr mode seems present in version of openssl have, definition evp_aes_128_ctr disabled in evp.h: #if 0 const evp_cipher *evp_aes_128_ctr(void); #endif any idea why is? can remove #if 0? other pointers on getting 128 bit aes ctr mode encryption work in openssl appreciated! thanks! btw, looks answer no, not yet. maybe soon. found email thread indicating patch address issue may have been submitted in june 2010: http://www.mail-archive.com/libssh2-devel@cool.haxx.se/msg01972.html but when downloaded latest development branch svn, aes ctr still not enabled in evp. ended implementing directly, found link helpful: aes ctr 256 encryption mode of operation on openssl

php - Reusing the same curl handle. Big performance increase? -

in php script doing lot of different curl requests (a hundred) different url. is reusing same curl handle curl_init improve performance or negligible compare response time of curl requests? i asking because in current architecture not easy keep same curl handle. thanks, benjamin it depends on if urls on same servers or not. if are, concurrent requests same server reuse connection. see curlopt_forbid_reuse. if urls on same server need sort urls default connection cache limited ten or twenty connections. if on different servers there no speed advantage on using same handle. with curl_multi_exec can connect different servers @ same time (parallel). need queuing not use thousands of simultaneous connections.

authentication - Using Tomcat NTLM with Spring Security -

i'm using spring security 2 spring mvc. tomcat container using has ntlm support , provide access authenticated users, before forwarding username in header of request. i tried writing custom autenticationentrypoint idea no form/ http-basic login required, since request header contain userids. far, have found no means of achieving this. any ideas , suggestions highly appreciated. thanks. look @ waffle . maybe waffle not want, has spring security filter implementation on receiving end of you're trying achieve.

ruby on rails - Feather an image from code -

is there way feather image code? (if don't know feathering is, check this out - i'm not using dirty language) i know professional design applications photoshop can this, users upload images site , display them in feathered fashion. (now there's sentence don't hear every day) i can see 2 ways. in both ways prepare transparent png image "feather" effect. combine image original , requested result. the solution little more complicated in case of dynamic sizes - basic principle same. css way in case can make operation on client side. prepare transparent png mask makes "feather" effect - use photoshop/gimp create it. let's suppose named mask "feather.png" , original image named "source.jpg". can use html code <div style="width: 200px;height: 200px; background: url(/images/source.jpeg)"> <img width="200" height="200" src="/images/feather.png" /> </di...

css - jQuery - How to get position of element that has a class -

i have slider ads class (.current-item) each tab on, , removes when it`s off. want use lavalamp menu efect , need position of each element has class current-item. i used: var = $("li.current-item"); var myposition = my.position(); function setcurr(el) { $back.css({'top': myposition.top }); curr = el; }; but works 1 item (the first). afer slider removes class , ads class next li nothing happens. here live: http://asgg.ro/slider-html/ src script @ bottom of source. i`m new jquery , need help! thank much var offset = $('.class_name').offset(); var x_pos = offset.left; var y_pos = offset.top; this give x , y position of element related viewport hoper helps

iPhone - how can this code leak? -

very simple code, leaks hell... check out. - (void)loadview { nsstring * mytitle = @"hello"; nsstring * message = @"\nthis stuff leaking!\n"; nsstring * cancelbutton = @"dismiss"; nsstring * othertitles = nil; [self showalert: mytitle : message: cancelbutton : othertitles]; } - (void) showalert: (nsstring *) titulo : (nsstring *) mensagem : (nsstring *) cancelbutton : (nsstring *) otherbutton { uialertview * alertview = nil; if (otherbutton) { alertview = [[uialertview alloc] initwithtitle:titulo message:mensagem delegate:self cancelbuttontitle:cancelbutton otherbuttontitles:otherbutton, nil ]; } else { alertview = [[uialertview alloc] initwithtitle:titulo message:mensagem delegate:self cancelbuttontitle:cancelbutton otherbutt...

CouchDb bulk rename -

for example have posts tag names, , decided rename 1 of tags. bulk updating when should know revision not suitable. better if integrated. check out costco , provides simple interface lets write little function gets applied documents modify them. you write simple function like: function (doc) { // ignore documents without tags if (!doc.tags) return doc; (var = 0, len = doc.tags.length; < len; += 1) { // convert tag misspelled "couch-db" real name "couchdb" if (doc.tags[i] === "couch-db") doc.tags[i] = "couchdb"; } return doc; }

google api - AuthSub with PHP -

can use authsub php ? want use google api php don't want install zend framework.i'm goolging , not found authsub class php. google supports both authsub , oauth standard. oauth standard newer. php has support oauth standard, details of can found in http://php.net/manual/en/book.oauth.php

Not showing focus in wxPython? -

i don't know if stupid question, there way not show focus in wxpython? example, built simple gui few buttons , don't want dotted rectangle show on button have clicked. if remember correctly in excel vba set takefocusonclick tag false. equivalent in wxpython? wxpython uses native gui elements on each platform as possible , doesn't seem setting can changed. work-around use non-native button .

Is there only one way to get session in java calling request.getSession()? -

i know there 1 way call session using request.getsession() or there other way? the api shows 2 methods. 1 creates session if needed, , other doesn't. http://java.sun.com/javaee/5/docs/api/javax/servlet/http/httpservletrequest.html#getsession%28%29 and http://java.sun.com/javaee/5/docs/api/javax/servlet/http/httpservletrequest.html#getsession%28boolean%29

javascript - What are Closures and Callbacks? -

what closures , callbacks in javascript? i've yet find explanation of either. closures have been handled in stackoverflow here selection:- how javascript closure work? what “closure” refer in javascript? can right example of javascript closure.. places need consider avoiding closures?? javascript scope , closure javascript closures , ‘this’ context javascript - how learn “closures” usage? callbacks simpler concept. callback function accepts function parameter. @ point during execution called function execute function passed parameter, callback . quite callback happens asynchronous event, in case called function may return without having executed callback, may happen later. here common (browser based) example:- function fn() { alert("hello, world"); } window.settimeout(fn, 5000); here function fn passed callback settimeout function. set timeout returns 5 seconds later function passed callback executed. closures , callbacks quite...

iphone - How to hide navigational bars according to cursor positions to use full screen? -

i trying hide navigational bars according cursor positions.so, can use full screen of iphone. donno how start it. similar (less confusing :) ) question: show/hide uitoolbar, "match finger movement", precisely in example ios7 safari use below code if want hide , unhide navigation bar on double tap on part of view in .h file: iboutlet uinavigationcontroller *navigationcontroller; connect iboutlet in xib. in .m file: -(void)viewdidload { [super viewdidload]; [navigationcontroller setnavigationbarhidden:yes]; } -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event{ uitouch *touch = [touches anyobject]; if (touch.tapcount == 2) { [navigationcontroller setnavigationbarhidden:no]; [nstimer scheduledtimerwithtimeinterval:(1.0) target:self selector:@selector(hidebar) userinfo:nil repeats:no]; } } -(void)hidebar{ [navigationcontroller setnavigationbarhidden:yes]; } do modifications per requirement. ...

Optimize Linq code -

tables: item id keyword id keyword itemkeyword itemid keywordid sequencenumber searching items via keyword: keyword keyword = keyword.firstordefault(a => a.keyword .equals(input, stringcomparison.invariantcultureignorecase)); ienumerable<item> items = keyword.itemkeyword.orderby(a => a.sequencenumber) .selectmany(a => a.item); for getting related keywords: ienumerable<keyword> relatedkeywords = items.itemkeyword .selectmany(a => a.keyword) .except(keyword); ienumerable<keyword> orderedrelatedkeywords = relatedkeywords .orderbydescending(a => relatedkeywords .where(b => b .keyword.equals(a.keyword, stringcomparison.invariantcultureignorecase)) .count()) .distinct(); i don't have development computer me right now, hope idea. real problem here arranging in descending order relatedkeywords times has been used. there ways this? thanks. hrm, linqtoentities, impl...

php - Cookie not saving -

on site user greeted yes/no menu determines whether see it, peiece of code. if(!isset($_cookie['banguser'])) { // createrandomid() method , return unique id user $unique = ''; // setting cookie, name = banguser, cookie expire after 30 days setcookie("banguser", $unique, time() + (60*60*24*30)); $data['firsttime'] = true; } else { $data['notfirsttime'] = true; } if user clicks yes run function createcookie() { // function gets called when user clicks yes on firsttime menu. // purpose of function create cookie user. // first we'll give them unique id $unique = $this->createrandomid(); // set expiration time $expireat = time() + (60*60*24*30); // unique id available can set our cookie doing same function before $_cookie[] = setcookie("banguser", $unique, $expireat); ...

extjs - grid panel row height issue -

i have image + text in column.when chaange width of column row height of grid panel changing.i think because of image because when change width of other columns dont have image in row height doesnt chage.how can prevent happening.however issue not seen in firefox. please me regarding issue. make sure every image in every row has same height.

Neural Network Backpropagation? -

can recommend website or give me brief of how backpropagation implemented in nn? understand basic concept, i'm unsure of how go writing code. many of sources i've found show equations without giving explanation of why they're doing it, , variable names make difficult find out. example: void bpnn_output_error(delta, target, output, nj, err) double *delta, *target, *output, *err; int nj; { int j; double o, t, errsum; errsum = 0.0; (j = 1; j <= nj; j++) { o = output[j]; t = target[j]; delta[j] = o * (1.0 - o) * (t - o); errsum += abs(delta[j]); } *err = errsum; } in example, can explain purpose of delta[j] = o * (1.0 - o) * (t - o); thanks. the purpose of delta[j] = o * (1.0 - o) * (t - o); is find error of output node in backpropagation network. o represents output of node, t expected value of output node. the term, (o * (1.0 - o), derivative of common transfer function used, sigmoid function. (other transf...

Remove previous lines then join when SED finds expression -

i'm trying join sentences in document, of sentences have been split apart empty line in between. example: the dog chased after ball that thrown owner. the ball travelled quite far. to: the dog chased after ball thrown owner. the ball travelled quite far. i thinking search empty line , beginning of next line lower case character. copies line, removes , empty line above it, , appends copied sentence other broken sentence (sorry confusion). i'm new sed , tried command: sed "/$/{:a;n;s/\n\(^[a-z]* .*\)/ \1/;ba}" but once , removes empty line , not appending 2nd half of broken sentence first part. please help. this should trick: sed ':a;$!{n;n};s/\n\n\([a-z]\)/ \1/;ta;p;d' sentences

tcp - How host name is broadcasted in a subnet -

i'm working microchip's tcp/ip stack , host name of device not being broadcasted, although can access using dhcp assigned ip. so question is, protocol network device uses broadcast host name, when see list of devices in network can identify name? is netbios name service or else? in advance. the network-agnostic way specify hostname host on network through dns , device cannot control, not lost. in environments, dhcp , dns servers tied (ad in windows networks, dnsmasq on linux, etc...) best option rely on behaviour. when request ip using dhcp, dhcp protocol allows specify hostname you'd use , if network set allow dns entries created , maintained dns server, hostname send during dhcp request typically used. the dhcp parameter called ' hostname '. network protocol documentation parameter located in rfc 2132 , , explained here .

.net - Is there a PTP (Precision Time Protocol | IEEE 1588) library? -

i've been tasked syncing time critical process logging data plc ptp (precision time protocol, ieee 1588) time source. a quick @ available libraries turn nothing ivi-c , ivi-com based implementations. is there managed library supports ptp missed, or need find method use theivi-com library designed labview in application? i had reffered, following answer site http://code.google.com/p/ptpv2d/wiki/introduction , gave me clear idea on ptpv2d, hope clear information, this. pls refer http://code.google.com/p/ptpv2d/ ptpv2d gpl licensed open source code of ieee 1588 version 1, version 2 , ieee 802.1as including hardware timestamping freescale mpc831x family of processors. the ptpv2d precision time protocol has following features: the user mode application runs under standard linux, modular design ensures easy portation additional operating systems. an extensive optional print-to-console debug message function. message functionality can...

c++ - Why should I check the return value of operator NEW? -

meyers in book " 50 ways improve..." second edition writes must check return type of new, know if operator new can't allocate memory throws exception , newer libraries don't need check return value of new, right? in advance in general, think you're correct: modern libraries throw exceptions this. if you're distributing source, compilers still return null rather throwing exception. in situations, can useful, depends whether you're going there debug , how critical stability of program is. also, else pointed out such obscure problem nowadays burden on person using ancient compiler.

wpf - How to close a window in c# -

i've got following code in window b started in own thread window a. view.closing += (sender, e) => { view.visibility = visibility.collapsed; e.cancel = true; }; when close window window b remains in memory , application doesn't dispose. how should go forward make sure application shut down when closing window a. edit: window b takes while load , build that's why code there. use application.exit(); for wpf: application.current.shutdown();

encoding - how is the sarcmark implemented? -

these people selling proprietary exclamation mark sarcasm, , without going through unicode standardisation process, proposing it's possible download mark (in format it's not clear), , use in written communications (to extent it's not clear). question being downloaded , how transmitting across network. i'm not sure if it's sort of multilayered sarcastic joke , don't think it's nice idea on level, i'm curious if they're doing clever implement , interoperate (curious enough override reluctance add word of mouth). they provide image can paste document - far it's $2 piece of clip art, nothing mysterious it. they provide font new glyph (or character?) - presumably if going send they'd have have same font installed , message have have enough information recipient choose font viewing it? they claim have working sms on blackberries - how work? how glyph transmitted through network? way can think of they're transmitting unicode private ...

scripting - Trigger an event when system locks/unlocks on Windows XP -

please me find way track lock/unlock time on winxp machine. i've tried windows scheduler - logs logins, not locks. alternatives? in miranda's source code saw implementation via idleobject tracker, way long. may autoit script? time tracking program (freeware)? if have windows service can notification of login/logout/lock/unlock events via onsessionchange method. in c# this: protected override void onsessionchange(sessionchangedescription changedescription) { switch (changedescription.reason) { case sessionchangereason.sessionlogon: //logon break; case sessionchangereason.sessionlogoff: //logoff break; case sessionchangereason.remoteconnect: //remote connect break; case sessionchangereason.remotedisconnect: //remote disconnect break; case sessionchangereason.s...

objective c - Want to connect any external device having bluetooth to the iphone through programatically -

as aware game-kit framework, used session delegates , peerpickercontroller. want connect external device having bluetooth iphone through programatically, application executed on device, able connect external device , want transfer data between them. can suggest me solution.... waiting reply.. in advance. to communicate external bluetooth device (that's not ios device) need use external accessory framework . don't know details, understanding need join mfi program before can start development.

file - Reading specific lines only (Python) -

i'm using loop read file, want read specific lines, line #26 , #30. there built-in feature achieve this? thanks if file read big, , don't want read whole file in memory @ once: fp = open("file") i, line in enumerate(fp): if == 25: # 26th line elif == 29: # 30th line elif > 29: break fp.close() note i == n-1 n th line. in python 2.6 or later: with open("file") fp: i, line in enumerate(fp): if == 25: # 26th line elif == 29: # 30th line elif > 29: break

javascript - Show user information on mousehover -

on mouse-over wish show user information such user id, user name, user location, user age etc. info coming database. well, information in rectangular block come-up on mouse-over. i aware javascript use show div (in mouse-over) don't know how fetch database? plus application windows based asp.net application. not aware whether possible in windows based i'm web based developer. thanks inputs. you use jquery qtip plugin can display dynamic content, see documentation at http://craigsworks.com/projects/qtip/docs/tutorials/#dynamic and demo @ http://craigsworks.com/projects/qtip/demos/content/loading the url parameter should point @ aspx page show text loaded database.

linux - Problem removing duplicate files using awk -

contents of part3.1.awk { current_line=$0 if (current_line!=prev) { print $1 " -> " " -> " $5 " -> " $8 } prev=$0 } to list of processes, run in terminal. want output removed duplicates , sorted too. $ps -ef | awk -f part3.1.awk | sort what wrong doing? you sorting output awk script, when want sorting input. $ps -ef | awk -f part3.1.awk | sort should be $ps -ef | sort | awk -f part 3.1.awk but should tell you don't need awk remove duplicates. sort -u you, in ps -ef | sort -u

Strange GPS fix behavior on 3g iPhone -

i wrote gps enabled iphone app needs 70m accuracy. in cases accuracy reached after few seconds waiting. on occasions never reached. have restart iphone , app , fix acquired immediately. some users told me starting different app uses gps, close app , starting app again fixes problem well. not sure if works, because couldn't test myself. the problem occurs on 3g iphones not on 3gs. any idea happening or how can fix in code, don't have reboot iphone? edit: code use: locationmanager = [[cllocationmanager alloc] init]; [locationmanager setdesiredaccuracy:kcllocationaccuracybest]; locationmanager.distancefilter = kcldistancefilternone; locationmanager.delegate = self; [locationmanager startupdatinglocation]; i'm seeing same behavior in own gps-centric app. 3g tends narrow in more 3gs. can figure far 3g's gps got improved 3gs.

css - Customising Google Custom Search's iFrame to have a transparent background? -

i've looked through relative gcs questions , answers on site , have looked around net, no avail. i using google custom search iframe option , standard theme on site background of site has textured, multicolour background. google results come in standard #ffffff background inside iframe. want set either none or transparent, search results iframe compliments site's current design. i've looked in global styles , various customising styles options in google admin product, offers options pick hex colours background , no way have none or transparent. if leave blank, it'll default blank. i can't use javascript or css adjust what's inside google generation iframe - or can i? there way around problem? thank in advance. nope. there's no way around problem - i've looked myself. real option use google search api , fetch results using ajax. not idea if you're hoping make money out of sponsored links though. you cannot content inside iframe...

layout - Prevent figures/listings from being inserted into specific parts of a LaTeX document -

i have part in document text , listings/figures in between. figures , listings positioned using htb . following part a, there bibliography. couple of figures not fit , therefore offset page, fine. but: want limit offset space part , not have figures placed within bibliography text. also, don't want force page of float figures ( hp positioning or something). page of floats @ end of part , before bibliography fine. so questions is, there way exclude parts of latex document being used positioning floats did not fit someplace before? maybe i'm missing something, couldn't put \clearpage right before bibliography? forces out floats haven't found place yet.

SonarJ like tool for .NET -

i'm looking tool sonarj .net instead of java. sonarj helps find deviations between architecture , code within minutes. can integrated ide avoid introduction of new architetural violations code base. can use maintain metric based software quality rules keep complexity under control. i googled , searched without satisfying results. here 2 others: lattix ( http://www.lattix.com ) ndepend ( http://www.ndepend.com )

php - Prepend New Section To Jquery UI Accordion When Link Is Clicked...? (Code Igniter) -

i'd add new section jquery ui accordion when clicks link, either on same page or different page. i've looked @ append() function content i'd pulling in contain php html, it'd need parsed. the link user clicking reference database record pull e.g. /site/index/record/3 (i'm building in code igniter). what best way this? i thinking of using prependto (if that's right), pulling content in via ajax? not sure how work, clicking through page though. any ideas, suggestions, pointers or comments gratefully appreciated, i've no idea how this. here's accordion js have: $(function() { // jquery ui accordion mods sorting var stop = false; $("#ccaccordion h3").click(function( event ) { if ( stop ) { event.stopimmediatepropagation(); event.preventdefault(); stop = false; } }); $("#ccaccordion") .accordion({ header: "> div > h3", ...

c# - How to detect if a JS is packed already -

hey guys.. writing windows application in c# minifies css files , packs js files batch job. 1 hurdle application is, if user selects javascript file has been packed? end increasing file size, defeating purpose entirely! is opening file , looking string eval(function(p,a,c,k,e,d) enough? guess no, there other js packing methods out there. me out! one might suggest compare size of pre , post packed js , return/use smaller of two. update based on question in comment gpx on sep 30 @ 1:02 the following simple way tell. there may different, or more accurate, ways of determining this, should going in right direction: var unpackedjs = file.readalltext(...) var unpackedsize = jscontent.length; var packedjs = ... // packaging routine file.writealltext(pathtofile, unpackedsize < packedjs.length ? unpackedjs : packedjs)

ruby - Using Curl to download files that require logging in -

i need download movie files website requires logging in. started prototyping script using mechanize, i'm wondering if curl supports sending username , password server, make work lot faster. i use httparty rather curl. supports authentication.(http://httparty.rubyforge.org) sudo gem install httparty here example shows authentication taken site. class twitter include httparty base_uri 'twitter.com' basic_auth 'username', 'password' end twitter.post('/statuses/update.json', :query => {:status => "it's httparty , invited!"})

algorithm - Meshing of Point Clouds from a 3Dlaser scanner -

is there package/software can meshing of point clouds in real time? what data structure used represent 3d point clouds ? meshlab great 1 meshing point clouds . look under filters > re-meshing, simplification , reconstruction . ball pivoting surface reconstruction , poisson reconstruction ones. here can find tutorial on meshing point clouds using meshlab. as representing point cloud easiest format use xyz format: x1 y1 z1 x2 y2 z2 etc. another format relatively easy use object (obj) model format.

sql - More efficient double coalesce join alternative -

i have procedure (slightly more complex) version of below: create proc sp_find_id ( @match1 varchar(10), @match2 varchar(10) ) declare @id int select @id = id table1 match1 = @match1 , coalesce(match2,@match2,'') = coalesce(@match2,match2,'') select @id id essentially match1 mandatory match, match2 both optional on input procedure, , on table being searched. 2nd match succeeds input and/or table match2 values null, or they're both same (not null) value. my question is: there more efficient (or more readable) way of doing this? i've used method few times, , feel sullied each time (subjective dirtiness admittedly). is there more efficient (or more readable) way of doing this? the example provided, using coalesce/etc non-sargable . need separate things needs present in query run: declare @id int if @match2 not null begin select @id = t.id table1 t t.match1 = @match1 , (t.match2 = @match2 or t.match2 null...

c# - LINQ list to sentence format (insert commas & "and") -

i have linq query simple like: var k = people.select(x=>new{x.id, x.name}); i want function or linq lambda, or output names in sentence format using commas , "ands". {1, john} {2, mark} {3, george} to "1:john, 2:mark , 3:george" i'm fine hardcoding id + ":" + name part, tostring() depending on type of linq query result. i'm wondering if there neat way linq or string.format(). public string toprettycommas<t>( list<t> source, func<t, string> stringselector ) { int count = source.count; func<int, string> prefixselector = x => x == 0 ? "" : x == count - 1 ? " , " : ", "; stringbuilder sb = new stringbuilder(); for(int = 0; < count; i++) { sb.append(prefixselector(i)); sb.append(stringselector(source[i])); } string result = sb.tostring(); return result; } called with: string result = toprettycommas(people, p => p....

timer - need help regarding a packet capture program -

the following program captures tcp packets < port 80 > , prints header related information in console every packet. have included timer , after every 1000 millisec i.e. 1 sec , frequency of occurence of various flags , , distinct number of src ips , ack nos , seq nos encountered written file. i'm working in fedora core 5. encountering following problems : 1.file writing part works fine during executions , of other times ,in same machine , file not @ written to. 2.when execute program in house , 30 packets captured every second. when run same program in lab , 1 packet captured per second. ( though same amount of browsing in both places ) #define interval 1000 /* number of milliseconds go off */ #include <pcap.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>...

What is the best way to translate the generation of a multidimensional cell array from Matlab to Clojure -

i'm halfway through figuring out solution question, have feeling won't efficient. i've got 2 dimensional cell structure of variable length arrays constructed in non-functional way in matlab convert clojure. here example of i'm trying do: pre = cell(n,1); aux = cell(n,1); i=1:ne j=1:d k=1:length(delays{i,j}) pre{post(i, delays{i, j}(k))}(end+1) = n*(delays{i, j}(k)-1)+i; aux{post(i, delays{i, j}(k))}(end+1) = n*(d-1-j)+i; % takes account delay end; end; end; my current plan implementation use 3 loops first initialized vector of n vectors of empty vector. each subloop initialized previous loop. define separate function takes overall vector , subindices , value , returns vector updated subvector. there's got smarter way of doing using 3 loop/recurs. possibly reduce function simplifies syntax using accumulator. i'm not 100% sure understand code doing (i don't know matlab) might 1 approach building multi-dimen...

css - How can I apply styles to multiple classes at once? -

i want 2 classes different names have same property in css. don't want repeat code. .abc { margin-left:20px; } .xyz { margin-left:20px; } <a class="abc">lorem</a> <a class="xyz">ipsum</a> since both classes doing same thing, should able merge one. how can that? .abc, .xyz { margin-left: 20px; } is looking for.

asp.net - RadComboBox load all item s on load and allow filtering on typing of text -

i use radcombobox , use code same mentioned @ site http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx i use code "server side" on page mentioned in above link. however able populate values first time page loaded when type in text not refine .am missing out on ? regards, francis p. have done properties this. enableloadondemand="true" showmoreresultsbox="true" enablevirtualscrolling="true" and filtering need implement item requested event. onitemsrequested="radcombobox1_itemsrequested" , server method this. protected void radcombobox1_itemsrequested(object sender, radcomboboxitemsrequestedeventargs e) { }

sql server - help required with Sql query -

i have problem , got 3 tables table id employee 1 1 2 2 3 3 table b id employee hoursworked hourscode 1 1 10 basic hours 2 1 20 holiday pay 3 2 10 basic hours 4 2 15 overtime table c id employee payments paycode 1 1 100 bonus 2 2 150 bonus 3 2 250 student loan i want records out of these table in minimum lines , can have 1 line says id employee hour hourscode payments paycode 1 1 10 basic hours 100 bonus 2 1 20 holiday pay null null 3 2 10 ...

java - preserve search criteria in jsp page -

i have jsp page display list servlet, has textbox used filter search result. selecting item in list (table) , redirecting page editing details after finishing editing. able come search page via servlet, unable preserve search condition in textbox , result. how that? thinking of setting session value , in search page, correct? or there other way? storing in session scope easiest way but, depending on how big application expected be, arise scalability issues. as alternative, when select item in list, forward (instead of redirect because if make redirect, lose request parameters) page, passing search query parameter in request. 1 possibility have form 2 hidden fields (the query , selected item): <form action="go_to_the_detail"> <input type="hidden" name="selecteditem" value="value_selected_item" /> <input type="hidden" name="query" value="query" /> </form> in editing page: ...

c# - Does the Content-Type of a POST or PUT request need to be 'application/x-www-form-urlencoded' in a WCF ReSTful service? -

what trying is, seemingly, simple: send pox via request body, have wcf service process it, , return 201 status code. in servicecontract have defined following method: [webinvoke(method = "put", uritemplate = "/content/add", bodystyle = webmessagebodystyle.bare, responseformat = webmessageformat.xml, requestformat=webmessageformat.xml)] [operationcontract] stream addcontent(stream input); the verb here doesn't matter; replace 'put' 'post' , wind same result. implementation of above method follows: public stream addcontent(stream input) { weboperationcontext.current.outgoingresponse.statuscode = system.net.httpstatuscode.created; } since method of little consequence have omitted of procedural code. test functionality fired fiddler , issued following request: user-agent: fiddler host: myhost.com content-length: 771 content-type: text/xml && application/xml; charset: utf8 <xmldatagoeshere...

Scala: Exposing a JDBC ResultSet through a generator (iterable) -

i've got set of rows in database, , i'd provide interface spin through them this: def findall: iterable[myobject] where don't require having instances in memory @ once. in c# can create generators using yield, compiler takes care of converting code loops through recordset iterator (sort of inverting it). my current code looks this: def findall: list[myobject] = { val rs = getrs val values = new listbuffer[myobject] while ( rs.next() ) values += new valuefromresultset(rs) values.tolist } is there way convert not store entire set in memory? perhaps use comprehension? try extending iterator instead. haven't tested it, this: def findall: iterator[myobject] = new iterator[myobject] { val rs = getrs override def hasnext = rs.hasnext override def next = new valuefromresultset(rs.next) } this should store rs when it's called, , otherwise light wrapper calls rs. if want save values traverse, check out stream.

accessing the .java file from .jsp file in Eclipse -

in eclipse ide how can access java class .jsp accessing servlet jsp file ? in other word, should replace question marks "????????" <form name="myform" action="???????????????" method="post"> </form> when run engine.java file "mypackage" package tomcat application servers shows address in address bar. http://localhost:8080/rouyesh/servlet/mypackage.engine anybody can please? you'll need use whatever path relative current url is, or absolute path, files. might prudent @ point investigate web framework, however, before destroy product insanity :p.

visual studio - Setting selection in a rad combo box -

i'm sure quite simple can't seem work. i'm trying set selection of radcombobox using ondatabound function. protected void reto_databound(object sender, radcomboboxitemeventargs e) { if (e == null) throw new argumentnullexception("e"); var combo = sender radcombobox; if (combo.finditembytext("jack johnson") != null) combo.finditembytext("jack johnson").selected = true; } i think i'm calling combobox incorrectly. thanks help. i can't solve here finditembytext "smelly" :), don't item string value, 1 char difference... try check item value not text , see happens. cheers

c++ - Convert Hex String to Hex Value -

i have large hex string abcdef... and want convert 0xab 0xcd 0xef are there functions that? also tell me means when people ask inputs in ascii or not? abcdef represented string. not sure if ascii or not. not sure mean. new programming here appreciated. have huge string need use in array , converting aforementioned format me initialize array hex string. you can using string streams. #include <iostream> #include <sstream> #include <vector> int main( int , char ** ) { const char *str = "afab2591cfb70e77c7c417d8c389507a5"; const char *p1 = str; const char *p2 = p1; std::vector<unsigned short> output; while( *p2 != null ) { unsigned short byte; ++p2; if( *p2 != null ) { ++p2; } std::stringstream sstm( std::string( p1, p2 ) ); sstm.flags( std::ios_base::hex ); sstm >> byte; output.push_back( byte ); p1 += 2; } for( std::vector<unsigned short>::const_itera...

sql - Execution Plan reuse -

consider following "code" define stmt1 = 'insert t(a, b) values(1, 1); define stmt2 = 'select * t'; mssqlcommand.execute( stmt1;stmt2 ); mssqlcommand.execute( stmt2 ); investigating cached query-plans using: select [cp].[refcounts] , [cp].[usecounts] , [cp].[objtype] , [st].[dbid] , [st].[objectid] , [st].[text] , [qp].[query_plan] sys.dm_exec_cached_plans cp cross apply sys.dm_exec_sql_text ( cp.plan_handle ) st cross apply sys.dm_exec_query_plan ( cp.plan_handle ) qp ; my impression first "execute" generates composite execution plan instead of 2 singular execution plans, thereby disabling second "execute" reusing execution plan generated in first execute. am right? yes, you're right. reuse the second part of execution plan need split first statement 2 separate execution plans. can either executing them separate mssqlcommand.execute calls or using 2 calls sp_executesql in 1 query (this adds 1 level of indi...

visual studio 2008 - Solution explorer not showing files, not because the show/all files button -

i have solution checked tfs. looking in source control explorer have .cs file in solution. looking in solution explorer it's missing. when project built takes file consideration , it's code included in build. a collegue of mine has pulled code tfs , built , appears expected. any ideas? had same problem. did was, keeping solution/projects open. went windows explorer, deleted files of project not showing files. tfs, got files project. prompted reload project, , voila - files showed up. not sure why happened though.

.net - Shortcut to collapse all documentation headers/comments in Visual Studio -

is there way collapse documentation headers (/// comments) in current file in visual studio (2008+)? see macro collapsing xml comments need.

asp.net - Is this LINQ statment vulnerable to SQL injection? -

Image
is linq statment vulnerable sql injection? var result = b in context.tests b.id == inputtextbox.text select b; where context entity , tests table. i'm trying learn linq , thought benefit of wasn't vulnerable sql injection, stuff i've see has said differently. need parametrize linq statement make safer? if so, how? also considered linq sql or linq entities? short answer: linq not vulnerable sql injection. long answer: linq not sql. there's whole library behind scenes builds sql expression trees generated compiler code, mapping results objects—and of course takes care of making things safe on way. see linq sql faq : q. how linq sql protected sql-injection attacks? a. sql injection has been significant risk traditional sql queries formed concatenating user input. linq sql avoids such injection using sqlparameter in queries. user input turned parameter values. approach prevents malicious commands being used custom...

iis 7 - Use WMI to create IIS Application Directory with C# -

we have web application installed on windows 2003 , windows 2008 systems. in past, our install code used adsi create couple of application directories in iis, requires iis 6 management components installed in windows 2008. have been trying use wmi create application directories can support both operating systems. i have been trying code public static void addvirtualfolder(string servername, string websiteid, string name, string path) { managementscope scope = new managementscope(string.format(@"\\{0}\root\microsoftiisv2", servername)); scope.connect(); string sitename = string.format("w3svc/{0}/root/{1}", websiteid, name); managementclass mc = new managementclass(scope, new managementpath("iiswebvirtualdirsetting"), null); managementobject owebvirtdir = mc.createinstance(); owebvirtdir.properties["name"].value = sitename; owebvirtdir.properties["path"].value = pat...