Posts

Showing posts from July, 2015

Question about Prolog matching -

i'm brand new prolog , i'm trying match along lines of this: rule(blah variable, ...). basically i'm trying match atom "blah" followed expression. possible? if using swi can use atom_concat/3: rule(x, ....):- atom_concat(blah, y, x), ... e.g.: suppose x=blahsomethingelse atom_concat(blah, y, x) instantiate y somethingelse. note atom_concat works atoms.

Get Internet Explorer security settings from end user -

there reported problems our web application seem happening @ 1 client's site. diagnostic purposes, there way can client send ie security custom settings ? e.g. in ie 8, tools -> internet options -> security tab, "internet" zone, can click "custom level" see custom security settings. there way user can export settings text file or ? or screen dumps way ? edit : sorry, should have mentioned windows xp (sp3) gpedit.msc -> local computer policy -> computer configuration -> administrative templates -> windows components -> internet explorer right click, export list...

Using the Google Web Toolkit or Javascript how do I go about parsing HTML to find an image element and its link? -

i prefer answer in gwt should able translate javascript purposes. appreciated! if element has id, can use: element e = com.google.gwt.user.client.dom.getelementbyid("myimgelementid"); string imagesrc = e.getpropertystring("src"); if you're fan of strong typing, like: element e = dom.getelementbyid("myimgelementid"); imageelement img = imageelement.as(e); string imagesrc = img.getsrc("src");

silverlight - Edit Path Programatically -

is possible edit path programatically? i'm trying create usercontrol acts horizontal meter width dynamic. have created path in xaml , planned on having int property controls width of meter dynamically. has rounded edges had planned edit x coordinates on right end of meter shrink meter keep same rounded corners. see data property on path don't understand how can edit it. is there better approach, perhaps? if you're setting path.data directly, won't able edit in code behind. if want able that, should use pathgeometry instead. msdn as can see preceding examples, 2 mini-languages similar. it's possible use pathgeometry in situation use streamgeometry; 1 should use? use streamgeometry when don't need modify path after creating it; use pathgeometry if need modify path. the following 2 path's equivalent, later 1 can modified in code behind <!-- path 1: using streamgeometry --> <path x:name="mypath"

java - com.sun.awt package usage -

i found java code , want use in project. contains these imports jdk not have : import com.sun.awt.awtutilities; import com.sun.jna.native; import com.sun.jna.platform.windowutils; i referred sun site , found download page : http://www.oracle.com/technetwork/java/javase/downloads/index.html is necessary download jdk , jre , replace sun website? jdk version 6 , date. thank all jna additional library , not part of standard api, have download ( here ) , include in classpath. the awtutilities class distributed sun jvm implementation detail of api , such subject change, can break program depending on (if possible don't use it ). windowutils can found in platform.jar, can find on same page jna.

java - How to get position of item selecte in gridview, or detect release of key with onItemClick? -

i must able detect press , release of button, must have position of item in gridview being touched. have gridview d-pad control. when user pushed on need send "go" , when release need send "stop" with below , there no way tell when lift off button (that know!). grid.setadapter(new imageadapter(c, mthumbids)); grid.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id) { message msg = new message(); msg.what = what; msg.arg1 = position; chandler.sendmessage(msg); } }); but if use ontouch listner cant tell item in grid have selected grid.setontouchlistener(new ontouchlistener() { public boolean ontouch(view v, motionevent event) { if (event.getaction() == motionevent.action_up) { message msg = new message(); msg.what = 255;

c# - XAML-inheritance, code re-use, optimization -

in wpf4 desktop application windows have same structure — header & footer main menu , copyright marks; left-side navigation menu , body (center of screen) show data, main toolbar etc. body block block changes in windows, e.g. in window students show datagrid students' data, in window new course form user can fill in form , submit db. stuff located in body section of windows. in order improve reusability of code, use inheritance of c# code, store basic window functions in generalwindow , other windows extend class. my question is: can use same technique in order reduce copy of same code-block in xaml-part of window? moment, each window class has same blocks of xaml code (e.g. left side menu, header, footer). how can reduce code copy , use same technique used in case of c#? possible inheritance xaml-class (.xaml) define basic stuff in 1 class , other extend/inherit design of class? increase code reusability. you should create 1 window , put frame on it. dynamical

Is it possible to load other database in Android devices? -

i know sqlite default database loaded in android devices. other databases can use in android devices, , how load them on device? additionally, per knowledge, sqlite using phone memory store data. can memory card used storing data instead? how / specify location? there android versions of projects available. instance couchdb has android version they've been working on: http://www.couchone.com/android generally though question subjective, it's unlikely you'll many answers on stack overflow. might better off asking new question specifics you're looking for, makes 'good' database you? space optimized? speed? particular features query syntax? existing question broad.

java - multiple unrelated log files with log4j and commons logging -

i want app have 4 log files. 3 of log files typical log4j info, warn , error logs. 4th log file unrelated , used log data. my log4j.properties file looks this: log4j.threshold=all log4j.rootlogger=all, infoappender, warnappender, errorappender log4j.data_logger=info, dataappender log4j.additivity.data_logger = false log4j.appender.dataappender=org.apache.log4j.dailyrollingfileappender log4j.appender.dataappender.file=/app_logs/data.log log4j.appender.infoappender=org.apache.log4j.dailyrollingfileappender log4j.appender.infoappender.file=/app_logs/info.log log4j.appender.warnappender=org.apache.log4j.dailyrollingfileappender log4j.appender.warnappender.file=/app_logs/warn.log log4j.appender.errorappender=org.apache.log4j.dailyrollingfileappender log4j.appender.errorappender.file=/app_logs/error.log and java code looks this: import org.apache.commons.logging.log; import org.apache.commons.logging.logfactory; private static final log log = logfactory.getlog(someclassinm

flash - Performance issue with swf having text content while using in page Flip class -

i have pageflip project , have 15 swf. of swf having image content loading(fliping effect) smoothly , if swf having text content loading slowly. var ocf:object = pageflip.computeflip (this.pagecorner.clone(), this.lastflippedcorner, this.width/2, this.height, !this.tearactive, 1); pageflip.drawbitmapsheet (ocf, this.render, this.bitmapdata[frontindex], this.bitmapdata[backindex]); any 1 please tel me possible error while handling swf image , text content. there difference in process of these 2 kind of swfs http://code.google.com/p/ricardo-flex/source/bro

encoding conversion in iphone application -

how can covert convert current encoding nsutf8stringencoding kcfstringencodingdoschinesetrad. please me out maybe cfstringconvertencodingtonsstringencoding can you, don't test it: nsstringencoding enc = cfstringconvertencodingtonsstringencoding (kcfstringencodingdoschinesetrad);

php - which is a Faster function -

how 1 go calculating of 2 functions faster. there way conclusively in php? there best practice, n times average, , n be? p.s. i'm looking doesn't require special setup if possible. i'm not looking specialized framework, more primitive way of getting idea. you can time scripts microtime . example included in page. the larger n, better results. keep things caching in mind. if functions request same stuff database, first request may slower rest. repeat couple of times (so m tests of n times)

sql server 2005 - how to take unique values in sql -

select distinct customerid, adress left join b on a.customerid=b.customerid points > 15 so after gives me result customerids , adresses, incase customer may have 2 ids, example or has twice registered, address same. how can take unique values adress, adress unique, if there 2 different ids have same adress sql has leave 1 value. please help! select adress, max(a.customerid) left join b on a.customerid=b.customerid points > 15 group adress

Netbeans with tomcat -

i installed apache tomcat , added tools -> servers. when create java ee -> enterprice application dont see tomcat in list of aviable servers. see glassfish. i installed netbeans tomcat , dont see it. installed netbeans without tomcat, added manually, dont see when create ent.application yet. why dont see tomcat? sorry bad english. press ctrl+5 > right click server > add server > select tomcat add , listed

VB.NET CType: How do I use CType to change an object variable "obj" to my custom class that I reference using a string variable like obj.GetType.Name? -

the code below works class hard coded "xccustomers" in retrieveidandname method use ctype. however, able pass in various classes , property names integer , string list returned. example, in code below, pass in "xcemployees" retrieveidandname method. feel close... hoping knew how use ctype can pass in class name string variable. note, other examples have seen , tried fail because using option strict on disallows late binding. why need use ctype. studied "activator.createinstance" code examples try class reference instance string name unable ctype work that. when use obj.gettype.name or obj.gettype.fullname in place of "xccustomers" in ctype(obj, xccustomers)(i) error "type 'obj.gettype.name' not defined" or "type 'obj.gettype.fullname' not defined" thanks help. rick '+++++++++++++++++++++++++++++++ imports datalaasxc.business imports datalaasxc.utilities public class uccustomerlist 'he

asp classic - Refreshing page with runtime error -

i wonder if refreshing page runtime error overload web server. example did refreshed domain.com/default.asp?id=99999999999999999999999999999999999999999 page generates following error: microsoft vbscript runtime error '800a000d' type mismatch: 'cint' /default.asp, line 9 this caused server not respond sites hosted on or ip blocked time firewall. it depends on rest of code around error looks (which can't see). won't overload server in sense of dos many requests (flood) since handled before request gets iis process on server side. but if code page breaks other processing based on value crash iis or app pool. stuck waiting on passed db call , has timeout before server responds. either time out or reset , when see site functional again. either way code or website/server should setup better alleviate problem. admins figure out when investigate why site keeps crashing due web hits ;)

android - PopUpWindow dismiss issue -

i have show popupwindow. if show in click event of imageview, call dismiss hides. when show in touch event of imageview, dismiss event calls, popup not hides. reasons error?. how can solve it? the code used show popup window is displaymetrics dm = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(dm); int width = dm.widthpixels; //320 cabotmessagehandler.printconsole("width of screen"+width); //show popup layoutinflater inflater = (layoutinflater) this.getsystemservice(context.layout_inflater_service); popupview=inflater.inflate(r.layout.gallerytoppopup, null, false); pw = new popupwindow( popupview, width, 30, true); // code below assumes root container has id called 'main' pw.setanimationstyle(r.anim.popupanimation); pw.showatlocation(this.findviewbyid(r.id.webview), gravity.top, 0, 30); finally find out problem. touch event calls twice, , 2 p

in PHP - what is the difference in use of ' ' and " " -

possible duplicate: difference between single quote , double quote string in php hi all i new php , wanted know difference in use of ' ' , " " ? thanks double quotes evaluate content of string, single quotes don't. $var = 123; echo 'this value of var: $var'; // output: value of var: $var echo "this value of var: $var"; // output: value of var: 123 it perfomance issue too, 'cause evaluation time affects interpreter, nowadays current (minimum) hardware it's not issue anymore.

asp.net - Is there a cleaner / more efficient way of splitting strings for use in a gridview? -

i have entity gets bound gridview , has string value this: 'data1|data2|data3|data4'. is there more efficient or better way of doing method using below? <asp:repeater runat="server" id="rptcentres"> <itemtemplate> <h2><%#eval("centre.name") %> ( <%#eval("entities.count") %> )</h2> <asp:gridview runat="server" id="dgshotlist" autogeneratecolumns="false"> <columns> <asp:templatefield> <itemtemplate> <p><%#eval("imagecontainer.title").tostring().split('|')[0]%></p> </itemtemplate> </asp:templatefield> <asp:templatefield> <itemtemplate> <p><%#eval("imagecontainer.title").tostring().split('|')[1]%></p> </itemtemplate> <

wcf - Providing workflow extensions to a workflow service - WF 4.0 -

greetings 1 , all! i'm new wf 4.0 , wwf in general forgive me if seems newbie type of question, believe me i've scoured depths of internet solution problem, no avail. i have created sample wf application custom codeactivity requires extension provided, per below: public sealed class preparepizza : codeactivity { public inargument<order> order { get; set; } protected override void cachemetadata(codeactivitymetadata metadata) { base.cachemetadata(metadata); if (this.order == null) metadata.addvalidationerror("you must supply order."); metadata.requireextension<ipreparepizzaextension>(); } // if activity returns value, derive codeactivity<tresult> // , return value execute method. protected override void execute(codeactivitycontext context) { // obtain runtime value of text input argument order order = context.getvalue(this.order); var extension = co

xslt - Need to validate html styles -

i converting docx file html using xslt. resulting html contains styles margin-top:nan pt; , style value nan ignored in browser default.but have validate presence of such attributes , have remove before viewing in browser... please me...thanks in advance... have tried w3c css validator? http://jigsaw.w3.org/css-validator/ you can use programatically soap web service: http://jigsaw.w3.org/css-validator/api.html

windows limit on no of files in a particular folder -

i in doubt whether right place question.. want know if windows 7 or xp has limit on no. of files within particular folder? there's no practical limit on combined sizes of files in folder, though there may limits on number of files in folder. more importantly, there limits on individual file size depend on filesystem you're using on hard disk. (the "filesystem" nothing more specification of how files store on disk.) let's break down file system: fat aka fat16 fat, file allocation table, successor original fat12 filesystem shipped ms-dos many, many years ago. maximum disk size: 4 gigabytes maximum file size: 4 gigabytes maximum number of files on disk: 65,517 maximum number of files in single folder: 512 (if recall correctly, root folder "/" had lower limit of 128). fat32 "there's no practical limit on combined sizes of files in folder, though there may limits on number of files in folder."fat32 introduced overco

utf 8 - Handling UTF-8 characters in Oracle external tables -

i have external table reads fixed length file. file expected contain special characters. in case word containing special character "göteborg". because "ö" special character, looks oracle considering 2 bytes. causes trouble. subsequent fields in files shifted 1 byte thereby messing data. has faced issue before. far have tried following solution: changed value of nls_lang american_america.we8iso8859p1 tried setting database character set utf-8 tried changing nls_length_symmantic char instead of byte using alter system tried changing external table characterset to: al32utf8 tried changing external table characterset to: utf-8 nothing works. other details include: file utf-8 encoded operating system : rhel database: oracle 11g any thing else might missing? appreciated. thanks! the nls_length_semantics pertains creation of new tables. below did fix problem. records delimited newline characterset al32utf8 string sizes in characters

java - How do I override the spring framework version in Spring Batch? -

i'm starting new project spring batch 2.1.6.release , use maven depemdency management. by default, imports spring framework 2.5.6, i'd use 3.0.5.release instead. this post says it's compatible, don't know how declare in maven pom file. i tried putting dependencies spring-core, spring-beans , spring-context versions 3.0.5.release, adds libraries project without removing 2.5.6 version. i had @ spring-batch-parent pom file, , there profile called "spring3" uses spring version want. how activate profile in project's pom file ? thanks in advance, philippe you can exclude transient dependency on spring framework v2.5.6 of spring batch using dependency exclusions element of spring-batch dependency in maven. like... <dependency> <groupid>org.springframework.batch</groupid> <artifactid>spring-batch-core</artifactid> <version>2.1.6.release</version> <exclusions> <exclusion&g

windows - Is it easy to port TortoiseHg to use Git instead? -

tortoisehg superior tortoisegit in many features. matter of changing few lines of code make new tortoisegit based on tortoisehg, or requires weeks/months of development? it not matter of changing few lines. tortoisehg intimately written against mercurial. doesn't wrap around command line client, integrates core python code. the entire program, bottom , up, have rewritten. it more constructive give tortoisegit team feedback on see improved.

user interface - Tools for prototyping iPad applications -

i build gui prototype ipad application. prototype can use static data (e.g. xml file) should , functional, i.e. support user gestures, etc. obviously, can program in objective-c . wonder if can use other tool build such gui easier. such tool exist ? maybe should use gui builder build "static" gui , add objective-c code make react on user gestures. make sense ? you use antetype it ships various , feels including ios , android.

WCF imperative binding -

how translate following declarative (via configuration file) binding, imperative binding (hardcoded inside application)? <system.servicemodel> <bindings> <custombinding> <binding name="custombinding_iaeservice"> <security defaultalgorithmsuite="basic256sha256rsa15" authenticationmode="mutualcertificateduplex" requirederivedkeys="false" securityheaderlayout="lax" includetimestamp="true" allowserializedsigningtokenonreply="true" keyentropymode="combinedentropy" messageprotectionorder="signbeforeencrypt" messagesecurityversion="default" requiresignatureconfirmation="false"> <localclientsettings cachecookies="true" detectreplays="true" replaycache

how to see complete output in visual c++ 2008 -

my program's output big, run loop 100 times, displaying 5-6 lines every time. problem is, when run output, displays last 20-25 results. possible of results @ once? is console app or gui app? if console, can make screen buffer size bigger - select properties menu item console icon in upper left corner , go layout tab, change height in screen buffer size larger.

.net - Windows Service without Visual Studio interference -

i'd create , manage windows service application without "help" visual studio's designer. since .net, , judging msdn , designer does, means inheriting installer , , constructing , dealing serviceprocessinstaller , serviceinstaller able manage install-time execution of serivce. runtime, means creating servicebase subclass , starting main using servicebase.run (and overriding various servicebase event handling methods). however, when this, visual studio insists on treating installer , servicebase subclasses designer-edited files. doesn't readability, not mention fact can't deal handwritten code @ all. i'd avoid designer keep things manageable (to avoid nebulous who-knows-what-runs-when, particularly code that's tricky test , debug such windows services after must installed run @ all), , able specify service name @ run-time, rather @ compile time - designer doesn't support that. how can create windows service application withou

javascript - jQuery UI's sortable doesn't allow dropping outside of the parent -

if @ the default sortable example , "drop zone" defined mouse pointer within list -- is, if you've drag last item top while mouse pointer stays outside list entire time, "letting go" of item send previous position. if use "axis" argument (for example set axis: 'y' items can move , down) think x-coordinate of mouse pointer should irrelevant. there easy way set drop zone anywhere on page , item moved position based on pointer's y-coordinate? are sure sortable system 1 need, sounds of second paragraph dont want make element draggable? ( see http://jqueryui.com/demos/draggable/ ) would better using lock x-axis , let dragged anywhere along y-axis. hope understood correctly, thought.

c# - Problem rendering Custom "MenuItem" -

here's problem: when open program in computer option menu rendered this: http://img811.imageshack.us/img811/1623/prob1.jpg but when open program father 's computer , brother computer menuitem renders out this: http://img203.imageshack.us/img203/3451/prob2l.jpg as can see in computer renders text in black , in others computer renders text in white. here's code: <separator> <separator.template> <controltemplate> <border cornerradius="2" padding="5" background="palegoldenrod" borderbrush="black" borderthickness="1"> <textblock text="global options (are saved):" fontweight="bold" /> </border> </controltemplate> </separator.template> </separator> have tried setting texblock foreground black? (perhaps vista / 7 has black default while xp not, forcing black might help) &

asp.net - Getting client values of IIS Server Variables in Load Balanced Environment -

i have intranet asp.net web application in need ip of client's machine. vis following code: httpcontext.current.request.servervariables.item("remote_host") it used work when asp.net site hosted on single server. once got load balancer installed , migrated our apps web farm, code above returns ip of load balancer device , not of client anymore. i working networking folks determine can configured differently load balancer, in meantime wondering if there way client's ip other using iis server variable? or other suggestions? thank you! which load balancer using? sounds if load balancer acting proxy web traffic, hence reason source appears come lb. hardware load balancers built on linux platforms , there provision transparency if kernel supports it: http://www.mjmwired.net/kernel/documentation/networking/tproxy.txt however, require root access unit , downtime. may worth mentioning vendor's support team if don't have ideas. another (hopef

A python code to convert a number from any base to the base of 10 giving errors . What is wrong with this code? -

import math def baseencode(number, base): ##converting number of base base10 if number == 0: return '0' in range(0,len(number)): if number[i]!= [a-z]: num = num + number[i]*pow(i,base) else : num = num + (9 + ord(number[i])) *pow(i,base) return num = baseencode('20',5) print errors traceback (most recent call last): file "doubtrob.py", line 19, in <module> = baseencode('20',5) file "doubtrob.py", line 13, in baseencode if number[i]!= [a-z]: nameerror: global name 'a' not defined isn't int(x, base) need? int('20',5) # returns integer 10

objective c - What are the iPhone activities that change the height of the status bar? -

what activities/events trigger height of status bar change on iphone? for example: when application visited while in phone call height of status bar [[uiapplication sharedapplication] statusbarframe] 40 instead of it's normal height of 20. the ios simulator has option hardware>toggle in-call status bar. when selected uiapplicationwillchangestatusbarframenotification , uiapplicationdidchangestatusbarframenotification posted. what user actions and/or phone actions cause happen? there activities besides phone calls cause status bar taller 20 pts? @bogatyr right, internet tethering one. audio recording (such voicememos.app) another.

java - Create instances using one generic factory method -

i trying find easy extend way create objects @ runtime based on static string class attribute, called name. how can improve code, uses simple if construct? public class flowerfactory { private final garden g; public flowerfactory(garden g) { this.g = g; } public flower createflower(final string name) { flower result = null; if (rose.name.equals(name)) { result = new rose(g); } else if (oleander.name.equals(name)) { result = new oleander(g); } else if ... { ... } ... return result; } newinstance() can not used on these classes, unless remove constructor argument. should build map (map) of supported flower class references, , move contructor argument property setter method, or there other simple solutions? background information: goal implement kind of 'self-registering' of new flower classes, flowerfactory.getinstance().register(this.name, this.class) , means answers far introspection-based solutions fit best. you can use

video - ffmpeg -r / fps over time? -

ok - going round in circles here welcome... using ffmpeg generate frames movie. want limit total frames 10 per movie. so im trying figure out -r (fps) use in code. so if video 10secs long want 10 files -r 1 fps. but if video 100 secs long , want 10 files th -r should 0.1 fps. i can't seem figure out formula?! please help! ok r = frameswanted / totalseconds

php - Is one letter to short for $_GET? (used for a wordpress plugin) -

i'm working on wordpress theme-switching plugin relies on on php $_get, want keep url simple , clean. 1 letter short? example ('t'): "foo.com/? t =theme_1" what chances conflicts other stuff? of course subjective, , there obvious "p" should not attempt use, best practice in situation , in general? there no specific problem using 1 letter vars, because using wordpress, might want bit carefull: not p , future and/or other plugins i advise use quite unique in environment don't have complete control on (updates etc.). use prefix vars, maybe 2 chars + '_', or that.

php - filter metacharacters from user input in xss attack -

on site on admin login page if this http://www.domain.com/admin/index.php/%22onclick=document.location="http://www.google.com"> and click somewhere page redirects. read somewhere need filter metacharacters. after hours of googling cant find out how can stop this. above see isnt doing or post. how can block this? no, don't character filtering / massaging. need treat user input, regardless of how sent you, evil virus , handle such. how link being generated? wrote or user put sort of cms? i'm not sure there enough information directly should never redirect data user passes page. instead, use information pass determine should go.

javascript - Check if SWF has focus -

how can check if swf element on page has focus? in ie, onkeydown events not detected in javascript if swf has focus firefox detects onkeydown . detect javascript? javascript has onfocus , onblur events, var hasfocus=false; domelem.addeventlistener('focus', function(e){ hasfocus=true; },false); domelem.addeventlistener('blur', function(e){ hasfocus=false; },false); i'm not sure how in as...

Setting http headers RSpec 2.4 / Rails 3 -

i getting started rspec. have new rails 3 app uses http_accept_header or request 2 letter subdomain set application language , redirect accordingly. testing redirection code using cucumber. now want write controller specs , need set request subdomain before test. in cucumber steps, can specify: header 'http_host', 'es.mysite.local' visit '/' but when try in spec file header 'http_host', 'es.mysite.local' 'index' i error: failure/error: header 'http_host', "es.mysite.local" loaderror: no such file load -- action_controller/integration any clue on how solve this? try this: request.env['http_host'] = 'es.mysite.local' 'index'

uitableview - How to realize an UiTableWiev with placeholders? -

how can realize uitablewiev this? http://i.stack.imgur.com/8qvb4.jpg i appreciate gives me tutorial. also table fb fine http://img688.imageshack.us/img688/4162/photocr.jpg thanks add uitextfield uitableviewcell. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { /* standard uitableview setup code */ uitextfield *mytextfield = [[uitextfield alloc] initwithframe: cgrectmake(60, 12.7, 250, 20)]; /* other textfield code want add */ [cell addsubview: customtextfield]; return cell; } at bottom of the list , find tableview file-based persistence demonstrates how this.

java - Need sample Android REST Client project which implements Virgil Dobjanschi REST implementation pattern -

i want build rest client on android phone. the rest server exposes several resources, e.g. (get) http://foo.bar/customer list of customer http://foo.bar/customer/4711 customer id 4711 http://foo.bar/customer/vip list of vip customer http://foo.bar/company list of companys http://foo.bar/company/4711 company id 4711 http://foo.bar/company/vip list of vip companys i (think) know how talk rest server , information need. implement rest client class api this public list<customer> getcustomers(); public customer getcustomer(final string id); public list<customer> getvipcustomer(); public list<company> getcompanies(); public customer getcompany(final string id); public list<customer> getvipcompanies(); referred presentation " developing android rest client applications " virgil dobjanschi learned no idea handle rest request in worker thread of activity. instead should use service api. i idea of having singleto

Easiest way to cause memory leak in Java? -

possible duplicate: creating memory leak java what's easiest way cause java memory leak? you cannot "leak memory" in java unless you: intern strings generate classes leak memory in native code called jni keep references things not want in forgotten or obscure place. i take interested in last case. common scenarios are: listeners, done inner classes caches. a nice example to: build swing gui launches potentially unlimited number of modal windows; have modal window during initialization: staticguihelper.getmainapplicationframe().getoneofthebuttons().addactionlistener(new actionlistener(){ public void actionperformed(actionevent e){ // nothing... } }) the registered action nothing, cause modal window linger in memory forever, after closing, causing leak - since listeners never unregistered, , each anonymous inner class object holds reference (invisible) outer object. what's more - object referenced modal windows

c# - How to Programatically FTP a file to Adcenter? -

i created data feed adcenter.com. know how upload file want ftp via ftp client, however, need know if can programatically uploads every night. how this? i assume done in batch file. and use windows schedulter, should in batch file? you console application runs on schedule, or make windows service. can use ftpwebrequest ftp files server.

c# - convert this code to linq -

please convert code linq "select * tell name 'n%" + textbox1.text + "'" edit: given "answer" you've posted, looks maybe want contains instead. it's helpful take time in explaining you're trying in question - see question-writing guide advice. so may want: var query = list.where(item => item.name.contains(textbox1.text)); looks me like: var query = item in db.tell item.name.startswith("n") && item.name.endswith(textbox1.text) select item; that's if meant query wrote. if include "n" in attempt make unicode string, want: var query = item in db.tell item.name.endswith(textbox1.text) select item; another alternative - if you're using linq sql - use sqlmethods.like : var query = item in db.tell sqlmethods.like(item.name, "n%" + textbox1.text) select item; you can use "fluent notati

many to many - Django, overriding ManyToManyField -

i sorta building own widget, based on manytomanyrawidwidget. but try following in modeladmin: formfield_overrides = { manytomanyfield: {'widget': manytomanyrawidwidget}, } it'll prompt me __init__() takes 2 arguments (1 given) i figured needed fill rel argument something, relation model (which tag model) but run templatesyntaxerror: caught attributeerror while rendering: type object 'tag' has no attribute 'to' this lose oversight. me out? just want make sure heeded warning in documentation formfield_overrides : warning if want use custom widget relation field (i.e. foreignkey or manytomanyfield), make sure haven't included field's name in raw_id_fields or radio_fields. formfield_overrides won't let change widget on relation fields have raw_id_fields or radio_fields set. that's because raw_id_fields , radio_fields imply custom widgets of own. i'm not aware of manytoma

c - How can I call a library function just from its name? -

i want able use char *function_name = "foo" call foo() c program. foo() routine in shared library. don't have access dlopen, etc, load step regular executable. there way resolve name , load shared library? no. either use dlopen , dlsym , or make own array of function names , function pointers , way.

large graph data visualization with JDBC/ODBC -

i have looked @ gephi , tried play around it, supports mysql, sqlserver, , postgresql. database connectivity jdbc/odbc. other graph visualization software able connect such database? graphviz magnificent, can handle enormously big data sets , draw graphs. standalone tool draws graphs based on own dsl, e.g.: digraph g { a->b; a->c } so have produce such file first , feed graphviz it.

Entity Framework 4 Linq help - Pulling data from multiple tables filtered -

Image
not sure how done, have .edmx set navigation properties match foreign key relationships on tables. not sure if still need perform joins or if ef give me access related table data through navigational properties automatically. what need contentsections , associated contentitems based on contentview , filtered diversionprogram.crimenumber. i ienumerable, each contentsection should have access it's contentitems via navigation property contentitems thanks something like: using(entities context = new entities()) { ienumerable<contentsection> enumerator = context.contentsections .include("contentitems") .where<contentsection>(cs => cs.contentview.contentviewid == someid && cs.contentitems.where<contentitem>(ci => ci.diversionprogram.crimenumber == somecrimenumber)) .asenumerable<contentsection> } i've interpreted based on contentview as cs.contentview.contentviewid == someid this give contentse

c# - Using DateTime in Dynamic LINQ to Entities -

i using linq entities retrieve item purchase dates follows: where entityfunctions.truncatetime(order.purchasedate) == mypurchasedate.date the key here db column contains date , time time must stripped compare. code works fine. now, want same thing using dynamic linq entities. using dynamic.cs vs2010 code samples folder. when code: .where("entityfunctions.truncatetime(purchasedate) == @0", mypurchasedate.date); or variant of same error message. have code string value make work? (since can use .startswith or .contains inside string hoping there date function dynamic linq recognize). i know can create dynamic linq query date range, conceptually: purchasedate >= mypurchasedate@midnight , purchasedate <= mypurchasedate+23:59:59 in fact, maybe date range more efficient sql server perspective know if truncatetime or toshortdate exists within dynamic linq entities. i started using dynamic linq project , wanted compare dates without time component. m

Architecture Java EE ? many ressources : database, xml -

i have java application , want make web app. think how make architecture of app. in fact, have many resources, matlab, exe files , xml files , mysql database. have 3-tier architecture. client: browser treatment: java ee server (maybe servlet , ejb container) data: matlab, exe files , xml files , mysql database so, how can create application without having problem if have several clients connected sends many queries @ same time? knowing processing calling exe , reading , writing xml files, , execute matlab. more details input -ressource-> output image(query) -exe-> xml xml -jdom-> java objects (list) java objects -jdom-> n xml files n xml files -jdom-> txt files txt files -matlab-> txt files txt files -mysql-> java objects (list) txt files --> images (results) this pretty broad question. keep answer @ high level , can dig deeper have more questions. initially how structure application. pick mvc framework. pick jsf2

silverlight - "BindingExpression path error" using ItemsControl and VirtualizingStackPanel -

i'm using silverlight on windows phone 7. is normal loads of "bindingexpression path error" debug messages when using virtualizingstackpanel? think happening because visual items temporarily unbound data items collection recycled ... i have itemscontrol itemspanel's itemspaneltemplate virtualizingstackpanel. binds "notes" observablecollection on viewmodel. <itemscontrol x:name="listview" itemssource="{binding notes}" itemtemplate="{staticresource listdatatemplate}"> <itemscontrol.itemspanel> <itemspaneltemplate> <virtualizingstackpanel/> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.template> <controltemplate> <scrollviewer x:name="scrollviewer" padding="{templatebinding padding}"> <itemspresenter/> </scrollviewer>

mobile - Google's Geolocation API and "My Location" feature -

i trying find out , can not find answer... while using google's geolocation api in mobile application, can use "my location" feature? or, in other words, can use the geolocation api find phone's location without gps? many many thanx ran shortly, yes i don't have gps on nokia, , location on google maps works fine. so, consider proven experiment.

ClickOnce taking long to download and install -

has else experience this...on machines have application updated via clickonce, takes 10-20 mins download , install 2mb install...this working fine until reached 26th build...and after that.i checked network , it's normal...i ran installer on new machine , lightening fast! thinking might have prior installations on machines. is clickonce maintaining cache on client machines, perhaps needs cleaning? clickonce keeps current version , 1 previous. shouldn't issue. the first place check server files deployed. run fiddler while app updates see going on network traffic. in addition, may want compressing clickonce traffic . can make huge difference in download sizes.

python - Error creating table with foreign key constraint using SQLAlchemy-Migrate -

i'm building app in python. i'm using sqlalchemy-migrate track database schema. have table, user_category, has 2 columns: id , name. i'm trying create user table foreign key user_category table. change script creating user table follows: from sqlalchemy import * migrate import * migrate.changeset import * meta = metadata() user_category = table('user_category', meta) user = table('user', meta, column('id', integer, primary_key=true), column('email', string(255)), column('first_name', string(40)), column('surname', string(40)), column('password', string(255)), column('user_category', integer, foreignkey("user_category.id")), ) def upgrade(migrate_engine): # upgrade operations go here. don't create own engine; bind migrate_engine # metadata meta.bind = migrate_engine user.create() def downgrade(migrate_engine): # operations reverse above upg

How to go from a symbolic expression to a vector in MATLAB -

i working on function generate polynomial interpolants given set of ordered pairs. input indexes of node points in 1 vector, , values of function interpolated in second vector. generate symbolic expression lagrange polynomial interpolates set of points. able go symbolic form vector form comparison test functions , such. is, have generates polynomial p(x) in terms of symbolic variable x. sample polynomial vector, , values polynomial on (for example) linspace(-1,1,1000). if possible, how do it? i guess i'll include code have far: function l_poly = lpoly(x,f) % returns polynomial interpolant computed lagrange's formula syms n=size(x,2); l_poly_vec = 1; l_poly=0; k=1:n, l=1:n, if (k ~= l) l_poly_vec=l_poly_vec*(a-x(l))/(x(k)-x(l)); end end l_poly=l_poly+f(k)*l_poly_vec; l_poly_vec = 1; end i plan on adding third (or possibly fourth) input depending on how can solve issue. i'm guessing need length of vector want samp

php - Watermark 2000+ images at once? -

i have image hosting service , people upload offline (they upload computer station without internet access) , sync images (they aren't watermarked @ stage) , not approved @ point. there admin area user go approve image, , apply watermark @ stage. i wondering method best watermark 2000ish images using php (at time). creating system daemon , waiting response idea or? performing such tasks on such high number of files not idea php, @ least when plan execute script via http. reason timeout of php script, 30s (and shouldn't set high). the best option solve such things create script or daemon runs directly on server , converts new image automatically (or after being told so). continue run when current php script has finished. background process example update statistics database php script can fetch information process. another way, use thumbnail generation of private gallery, split high number of tasks smaller jobs can worked in 30s limit. in case, limit 50 pict

compilation - Java Will Not Compile Objects Created by Me -

i have been getting java compile error every time try compile code creates instance of class have created. i've tried compiling manually, compiling different location, , tried compiling in safe mode. have reinstalled java on computer. here's example of code write , error get: instance creator class: public class nothing { public static void main(string args[]) { can world = new can(); } } instantiated class: public class can { public can() { system.out.println("test"); } } the compile error: nothing.java:4: cannot find symbol symbol : class can location: class nothing can world = new can(); ^ nothing.java:4: cannot find symbol symbol : class can location: class nothing can world = new can(); ^ 2 errors someone knows java better me has tried compile files have had problems with no success. also, when run code within eclipse, ide, runs should. any suggestions @ or