Posts

Showing posts from August, 2012

IMDB API to retrieve character information -

is there imdb api retrieve character information ? assuming know exact name of character ? there 2 public, undocumented api's may change @ time since undocumented , unsupported one of them gives json relevant information actor: http://www.imdb.com/xml/find?json=1&nr=1&nm=on&q= {name+of+actor} as example: http://www.imdb.com/xml/find?json=1&nr=1&nm=on&q=jessica+simpson more details can found question , answer in particular does imdb provide api?

java - Using ObjectOutput with Externalizable -

i have class implementing externalizable interface. attribute of class map , values of objects of other classes implement externalizable interface. i'm not able serialize map using objectoutput , , wondering if that's possible?

Clojure: Java FileSystem Primitives for Implementing Database Persistence -

context this purely education purposes. want write primitive database. focus not on performance; principles behind databases. have material on locking / mutexes / transactions. know nothing writing disk / guaranteeing persistence in unexpected hardware (say power) failures. in order have proper recovery / persistence, need guarantees when writing files disk. question: for above purposes, types of file primitives (guarantees file written disk? leaving file open , appending log?) need? jvm offer? thanks! it's huge area talk because of many layers of abstraction surrounding discs these days, though jvm's perspective pretty depend on fsync write bits disc once call fsync depend on these bits being on disc. rest built on this.

python - Split quadrilateral into sub-regions of a maximum area -

it pretty easy split rectangle/square smaller regions , enforce maximum area of each sub-region. can divide region regions sides length sqrt(max_area) , treat leftovers care. with quadrilateral stumped. let's assume don't know angle of of corners. let's assume 4 points on same plane. also, don't need the small regions same size. requirement have area of each individual region less max area. is there particular data structure use make easier? there algorithm i'm not finding? could use quadtrees this? i'm not incredibly versed in trees know how implement structure. i have gis work in mind when i'm doing this, confident that have no impact on algorithm split quad. you recursively split quad in half on long sides until resulting area small enough.

android - when I try to get admob in my app, My app get force close -

hi trying add admob app first time. have read many information (including stackoverflow). still have not got luck. app force close. here how tried far. androidmanifest.xml i have added these lines within application tag <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> and aslo added following line before <meta-data android:value="a14f9xxxxx(id admob)" android:name="admob_publisher_id"/> attr.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="com.admob.android.ads.adview"> <attr name="backgroundcolor" format="color" /> <attr name="primarytextcolor" format="color" /> <attr name="secondarytextcolor" format="color" /> <attr nam...

xslt - How do you only display a piece of a template on certain pages in Umbraco CMS? -

i have site built umbraco has sidebar several widgets setup. need set 1 of widgets (done xslt) display on page. i've looked @ using xsl:if test , matches , can't figure out. you're on right track, habit of including have tried in question (code etc). the quick + dirty method find out id of page (found on properties tab of node in content section) , use following code: <xsl:if test="$currentpage/@id = 1234"> <!-- widget here --> </xsl:if> the cleaner method always try build code scalable, instance may find want include widget on page in future, or deploying content staging production might involve node ids changing without realizing (not often, can happen). add property page in question (let's call showmyfancywidget ) true/false data type, flick on in content section use following code: <xsl:if test="$currentpage/showmyfancywidget = 1"> <!-- widget here --> </xsl:if> this c...

hbase - the number of regionservers is not expected as configured -

in hbase cluster, set 5 hadoop datanode s1,s2,s3,s4,s5 in regionservers file, , set hadoops namenode m1 in master file, when start hbase cluster, can see 2 regionservers s1,s3 on hbase-status page? what's problem? far hbase cluster working properly. i've checked dns found no probelm. check if regionservers on not doing "sudo jps" on each host, if not go , start individual rses init script

javascript - is this valid js oop? -

i wondering if okay put html dom references in js oop. although there many js oop tutorials online, haven't seen similar referring to. code below referring to. var form = { fname : document.getelementbyid("fname").value; }; say, example document.getelementbyid("fname").value textbox value of "jacob". form.fname = "jacob" ? is okay do? common practice do? i not sure you're trying accomplish here. if need retrieve value in input field, 1 time, ever, ought fine. if you're expecting value of form.fname continually update when input value changes, you're not going see happen. you'd either need handler tied change event of input, or you'd need more this: var form = { fname: function () { return document.getelementbyid('fname').value; } }; // retrieving form.fname() note have invoke fname function now, can't refer form.fname . if don't want ever have retype things ever,...

What are the differences between Clojure, Scheme/Racket and Common Lisp? -

i know dialects of same family of language called lisp, differences? give overview, if possible, covering topics such syntax, characteristics, features , resources. they have lot in common: dynamic languages strongly typed compiled lisp-style syntax, i.e. code written lisp data structures (forms) common pattern being function calls like: (function-name arg1 arg2) powerful macro systems allow treat code data , generate arbitrary code @ runtime (often used either "extend language" new syntax or create dsls) often used in functional programming style, although have ability accommodate other paradigms emphasis in interactive development repl (i.e. interactively develop in running instance of code) common lisp distinctive features: a powerful oop subsystem ( common lisp object system ) probably best compiler (common lisp fastest lisp according http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html although there isn't in it.....

How to implement a Java compiler and DEX converter into an Android app? -

while trying find answer android jasper reporting found out there 2 other questions answered therefor, been asked ask question, not answer ;): my questions now: "is there compiler use directly on device" , "how execute such without rooting device. if give me hint appreciate it... i looked little time forward on approach, , found apps makes possible create apks directly on android device not rooted: terminalide - https://play.google.com/store/apps/details?id=com.spartacusrex.spartacuside&hl=de javaidedroid - http://code.google.com/p/java-ide-droid/ aide - https://play.google.com/store/apps/details?id=com.aide.ui&hl=en looks they're using compiler eclipse , ported dex converter. i'm trying figure out how same. sure: source code , it. while i'm having curious problems connection servers , trying solve it, follow plea ask question here. hoping both others , getting answer myself ;) i took org.eclipse.jdt.core_3.7.3.v20120119-1537....

r - How can I Insert images into .rnw document -

i work in r , deliver pdf file sweave, sweave(.rnw document) . need put text jpeg image. didn't find function on web , have no ideas how that. you include include image in other latex document: http://amath.colorado.edu/documentation/latex/reference/figures.html#pdf \includegraphics{myimage.jpg} put in latex block not r code block. link points out, you'll need compile pdflatex .

objective c - Sort NSMutableArray Of multiple Objects without keys -

i have nsmutablearray of objects, below struct: //object @ index locations { nsstring* address; nsstring* state; nsnumber* distance; } i have 10000 object above structure in nsmutablearray. how order array locations in order nsnumber distance? i tried this: lowtohigh = [nssortdescriptor sortdescriptorwithkey:@"distance" ascending:yes]; [locationarray sortusingdescriptors:[nsarray arraywithobject:lowtohigh]]; is using sortdescriptorwithkey:@"distance" wrong? since distance isn't key, nsnumber* distance. edit in header @property (strong, nonatomic)nsnumber* _distance; , @synthesize _distance = distance; in methods file in locationobjects.* object class. import in current class doing sorting. issue? how import locationobjects* locobj = [[locationobjects alloc] init]; this use: nssortdescriptor *lowtohigh = [[nssortdescriptor alloc] initwithkey:@"distance" ascending:yes]...

PHP Regex pulling text after period and before space -

i'm attempting pull part out of different varying strings, , having hard time getting correct regex so. here few examples of trying pull from: ag055.ma - magnum (want return ma) wi460.16 - (want return 16) ag055.qb (want return qb) so basically, want pull characters after period, before space. nothing else before or after. can give me hand getting correct regex? this should work: <?php preg_match( '/\.([^ ]+)/', $text, $matches ); print_r( $matches ); ?> output: array ( [0] => .ma [1] => ma ) array ( [0] => .16 [1] => 16 ) array ( [0] => .qb [1] => qb ) the regex saying find . character, characters after not space character. + makes return matches there non-space character after dot.

Python multiprocessing speed -

i wrote bit of code test out python's multiprocessing on computer: from multiprocessing import pool var = range(5000000) def test_func(i): return i+1 if __name__ == '__main__': p = pool() var = p.map(test_func, var) i timed using unix's time command , results were: real 0m2.914s user 0m4.705s sys 0m1.406s then, using same var , test_func() timed: var = map(test_func, var) and results were real 0m1.785s user 0m1.548s sys 0m0.214s shouldn't multiprocessing code faster plain old map ? why should. in map function, calling function sequentially. multiprocessing pool creates set of workers task mapped. coordinating multiple worker processes run these functions. try doing significant work inside function , time them , see if multiprocessing helps compute faster. you have understand there overheads in using multiprocessing. when computing effort greater these overheads see it's benefits. see last example in excel...

iphone - Image file name stored in a constant -

i have tableview image in each cell. i'm pulling data each cell plist including textlabel detailtextlabel , image file name. using cell.imageview.image = [uiimage imagenamed:image_key]; the image_key constant set image. doesn't work. work if type image file name in message. have double checked file name stored in plist , double checked declaration inside of constants file. spelled correctly. there different way use constants set image? do this: #define image_key "apple.jpg" // now: cell.imageview.image = [uiimage imagenamed:@image_key]; if #define image_key @"apple.jpg" // now: cell.imageview.image = [uiimage imagenamed:image_key];

vba - Make my button say hello -

i'm trying started vba excel , have added "developer" tab ribbon. have in module1 added small sub: sub hello() msgbox ("hello world!") end sub then i've created button in spreadsheet 1, right click , assigned hello it's macro. by i'm thinking should work, when click on nothing happens. further more, if open vba editor window again module1 have been edited, not containing actions? sub hello() msgbox ("hello world!") end sub activesheet.shapes.range(array("button 2")).select selection.onaction = "hello" range("g15").select activesheet.shapes.range(array("button 2")).select application.goto reference:="hello" whats mambo jambo? , why button not work? :( and try messagebox without parantheses, quotes. so: msgbox "blabla" delete code after sub routine: accidentally generated macro recorder (without purpose).

.net - Error calling web service 401: Unauthorized -

i get the request failed http status 401: unauthorized my web service .net 4 running on iis6. client .net 2 running on iis6 when run both client , serivce on local host works. when move service web server above error. have set allow an i have tried every combination of anonymous access & integrated windows authentication within iis can access web service via brower , call using web service studio ok, not work when call .net service update i have checked iusr account has ntfs file permissions , added in local security policy user can access server on network. when call webservice studio makes 2 request first called gets 401, calls again passing 'authorization' , works. see below. reason anonymous access not working. when have anonymous access ticked , integrated windows authentication unticked cannot access brower content-type: text/xml; charset=utf-8 soapaction: "http://tempuri.org/helloworld" host: webdev1 content-length: 314 expect: 100...

android - How to hidden all application shortcut from in home screen? -

my android emulator displays lot of application shortcut. how hidden application shortcut in home screen. you can't . can not control third party application behavior within application. don't have rights home screen within application. manually deletion applications setting application 1 option.

java - how to automatically populate a 2d array with numbers -

hi trying auto populate 2d array based on user input. user enter 1 number, number set size of 2d array. want print out numbers of array. example , if user enters number 4 . 2d array 4 rows 4 colums, , should contain number 1 16, , print out follows. 1-2-3-4 5-6-7-8 9-10-11-12 13-14-15-16 but struggling think of right statement this. moment code prints out 2d array containing *. has ideas how print out numbers , i'm stuck. code follows: public static void main(string args[]){ scanner input = new scanner(system.in); system.out.println("enter room length"); int num1 = input.nextint(); int num2 = num1; int length = num1 * num2; system.out.println("room "+num1+"x"+num2+"="+length); int[][] grid = new int[num1][num2]; for(int row=0;row<grid.length;row++){ for(int col=0;col<grid[row].length;col++){ system.out.print("*"); } system.out.println(); ...

select - mysql using calculated column at where/having -

i have question how use "alias" column @ where/having clause. know there question related topic. search trough web , on stackoverfolw , doesn't find solution. so hope @ way.. the following statement works well: select phrase,count(*) my_statistics timestamp>now()-interval 7 day group phrase order desc limit 16; phrase , timestamp are columns @ table. code selects top 16 phrases, inserts users on last 7 days. there exist column user , select top 16 phrases inserted more 1 user. tried this: select phrase,count(*) a, count(distinct(user)) b my_statistics timestamp>now()-interval 7 day , b>1 group phrase order desc limit 16; on other questions on stackoverflow fond info, have use having select phrase,count(*) a, count(distinct(user)) b my_statistics timestamp>now()-interval 7 day group phrase order desc having b>1 limit 16; but returns error: you have error in sq...

ibm midrange - AS400 RPGLE Defining a display file in a module -

i have been reading on creating modules , service programs in ile, can't find on defining display window (prompt screen) inside module. have tried following, keep getting error recno parameter (rrn here) not defined (*rnf7004). idea doing wrong....or can more info... h nomain fwdwfacv cf e workstn f sfile(facsfl:rrn) fzmfl01 if e k disk d/copy cussrcv6/qcpysrc,tools p wdwfac b export dwdwfac pi dwfac 2a dwfdesc 20a options(*nopass) d rrn s 3s 0 inz(0) d wkflag s 1s 0 /free ...

visual studio 2010 - Is there a way to generate a documentation wiki for github from my XML documentation comments in C#? -

i want generate api documentation open source project on github. i'd create them automatically xml documentation comments in c# projects. feeble googling has turned bubkiss. there way this? i'd prefer in github-style markdown . after searching around bit, found gem of gist: generates markdown vs xml documentation file it prints c# xml -> markdown console. i'm sure can refined further, great start. i've tested it, , it's totally working.

mysql - 2 tables in 2 different databases with different structures with same type of data to be synced -

my problem have website customers place orders on. information goes orders, ordersproducts, ...etc tables. have reporting database on different server staff processing orders from. tables on server need order information , additional columns can add information , update current information what best way information 1 server (order website) other (reporting website) efficiently without risk of data loss? not want reporting database connecting website information. implement solution on order website push data. thoughts mysql replication - problem - replicated tables strictly reporting , not manipulation. example if customer address changes? need products added order? mess replicated table. double inserts - insert local tables , insert reporting database. problem - if whatever reason reporting database goes down there chance lose data because mysql connection wont able push data. implement sort of query log? both servers use mysql , php mysql replicat...

xml - Interacting with .net SOAP services using PHP -

i have working soap request website .net based api. reason, php seems having issues parsing response. when dump response, of retrieved data in string named "any". string seems copy of returned xml. big paste in question, can view response content here: http://pastie.org/4165973 i have tried loading string in simplexml, error: "extra content @ end of document ". has experienced similar issues? how can parse response? edit saved __getlastresponse() file raw output possible. new xml here http://pastebin.com/3ztjdbjw the xml looks malformed. <shiptoaddress> incorrect, contains cdata might breaking parser. in case, run through xml linter (http://xmlsoft.org/xmllint.html) , see has say. however, guess source api either spitting out incorrectly or you're doing before printing out, provided isn't live output.

ASP.NET MVC3 Custom Model Binder Issues -

i have applicant model contains list of tags: public class applicant { public virtual ilist<tag> tags { get; protected set; } } when form submitted, there input field contains comma-delimited list of tags user has input. have custom model binder convert list collection: public class taglistmodelbinder : imodelbinder { public object bindmodel(controllercontext controllercontext, modelbindingcontext bindingcontext) { var incomingdata = bindingcontext.valueprovider.getvalue("tags").attemptedvalue; ilist<tag> tags = incomingdata.split(',').select(data => new tag { tagname = data.trim() }).tolist(); return tags; } } however, when model populated , passed controller action on post, tags property still empty list. idea why isn't populating list correctly? the problem have protected set accessor in tags property. if change public below things work fine. public class applicant { public vir...

asp.net - Cannot FindControl within dynamically generated table -

i have dynamically generated table , each row in table there form textboxes user complete , submit form. problem i'm having accessing values within these fields once submitted. the table has id=tableassigneechildren this html produced 1 of textboxes i'm attempting access: <input name="ctl00$contentplaceholder1$tchildname1" type="text" value="test name" id="tchildname1" /> the code below using test if can access above textbox: protected sub btnsubmit_click(sender object, e system.eventargs) handles btnsubmit.click dim childid integer childid = 1 cint(ichild.value) response.write(directcast(tableassigneechildren.findcontrol("tchildname" & childid), textbox).text & "<br />") next end sub thanks in advance help. j. dynamically created controls lost on every postback. recommend adding table markup because of following reasons: people run problems there...

sql - Can I alias multiple columns? How? -

i'm using pyodbc , postgres. can alias multiple columns? here's description of problem: data structure: data id | c1 | c2 ------------- 1 | 11 | 12 2 | 21 | 22 notation: c column dictionary id | key | value ---------------- 1 | k1 | v11 1 | k2 | v12 2 | k1 | v21 2 | k2 | v22 notation: k key, v value you can think of k1 , k2 2 more columns. data structure way because it's changing. didn't design it, have go it. i can't figure out sql query give me following (most importantly, row, can access k1 , k2 columns name): data id | c1 | c2 | k1 | k2 ------------------------- 1 | 11 | 12 | v11 | v12 2 | 21 | 22 | v21 | v22 the problem keep running if alias tables, sql result contain 2 "key" columns dictionary table, meaning can't control column access of two, if alias rows, can't control tables being referenced inside sql statement. the fix i'm thinking alias 2 columns: select * data full join dictionar...

java - Passing Class to a method to instantiate a generic -

the following code doesn't work, because marked line not compile: myclass { //singleton stuff private static myclass instance; private myclass () {} public static myclass getinstance() { if(instance==null) { instance = new myclass (); } return instance; } // method creating problems public nongenericsuperclassofgenericclass create(class<?> c1, class<?> c2) { return new genericclass<c1,c2>; // not compile!!! } } i not want myclass generic. why? because actual implementation of method create similar following: // method creating problems public nongenericsuperclassofgenericclass create(class<?>... classes) { if(somecondition) return new genericclass<classes[0],classes[1]>; else return new othergenericclass<classes[0]>; } therefore, cannot couple myclass particular generics. there way instantiate genericclass pas...

extjs4.1 - How to set the column layout in ext4.1 -

i have problem extjs 4.1 layout. how set column layout panel in ext 4.1. in mozilla working fine. but in ie, not rendering , moreover, ie trying close. the sample code is, var panel1 = getpanel1(); var panel2 = getpanel2(); var panel3 = ext.create('ext.panel',{ layout:{type:'table',columns:2}, title:'panel3', items:[panel1,panel2], renderto:ext.getbody() }); please give me solution render panels in columns in ext4.1 .... a way know works because in code use hbox layout. believe equivalent layout example: var panel1 = getpanel1();//make sure panel contains flex: .5 var panel2 = getpanel2();//make sure panel contains flex: .5 var panel3 = ext.create('ext.panel',{ layout:{type:'hbox'}, title:'panel3', items:[panel1,panel2], renderto:ext.getbody() });

send huge data from Java servlet to Android application -

i want sent large data server client, server tomcat java , client android application , working servlets server servlet protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { servletoutputstream out = response.getoutputstream(); celldatabase cdb = new celldatabase(); string[] cells = cdb.getallcells(); (int = 0; < cells.length; i++) out.write(cells[i].getbytes()); out.flush(); } my question : how can got data on android , because didn't find like response.getoutputstream(); android httpclient client = new defaulthttpclient(); website = new uri( "http://10.0.2.2:8080/localizedbasedcomptitionserver/getcells"); httppost request = new httppost(); request.seturi(website); httpresponse response = client.execute(request); this may you public static string getdata(strin...

php - Joomla site security -

how can secure our joomla site outsider user. is there security feature available in joomla prevent hacking outsider user. use following steps : change default database prefix (jos_) use sef component use correct chmod each folder , file. password protect administrative area. keep website up-to-date. use .htaccess file secure joomla. passwords - use unique , strong password. install jsecure authentication plugin.

c - Conversion from iso-8859-15 (Latin9) to UTF-8? -

i need convert strings formated latin9 charset utf-8. cannot use iconv not included in embedded system. know if there available code it? it should relatively easy create conversion table 128-255 latin9 codes utf-8 sequences of bytes. can use iconv this. or can create file 128-255 latin9 codes , convert utf-8 using appropriate text editor. can use data build conversion table.

nsstring - iOS decode umlaut &$ -

i have example of need decoded: @"f&#252r" how can decoded nsstring looks like fūr i tried number of things including [@"f&#252r" stringbydecodinghtmlentities] > f&#252r [@"f&#252r" gtm_stringbyunescapingfromhtml] > f&#252r but no luck. thanks! update based on vikingosegundo's solution nslog(@"möchte decoded : > %@", [@"möchte" stringbyencodinghtmlentities] ); nslog(@"m&ouml;chte decoded to: > %@", [@"m&ouml;chte" stringbydecodinghtmlentities] ); nslog(@"für decoded : > %@", [@"für" stringbyencodinghtmlentities] ); nslog(@"f&uuml;r decoded to: > %@", [@"f&uuml;r" stringbydecodinghtmlentities] ); nslog(@"m&#246chte decoded:%@", [@"m&#246chte" stringbydecodinghtmlentitiescomma] ); nslog(@"f&#252r decoded:%@", [...

java - Using Android ProgressDialog with AsyncTask and odd Activity Lifecycle -

i couldn't think of way form title make issue obvious, here goes: i'm little on head diving asynctask first time. have app sends tweet. must kick out webview twitter authorization, comes onnewintent(). what i'm trying throw simple spinner progressdialog while it's connecting site/performing accesstoken work, , again while it's sending tweet. i've discovered need new thread progress bar. or rather, should doing "time-intensive work" in it's own separate thread make using progressdialog viable. question this: how can have progress spinner in foreground while authorization code works in background, , opens webview , comes back, , starts on @ onresume()? i'm sure i'm not doing else in proper fashion. i'm new android, not java. i've put in create- , dismissdialog(int) calls should be, procedurally. as-is, otherwise works way should, dialogs not able show themselves. i'm thinking should put entire authorize() , tweet() met...

actionscript 3 - Save JPG from CDROM to PC -

i using following function save output swf , send php page creates jpg, problem if there not internet connection , swf in cdrom can save function used in flash outputs jpg , save on computer. in short can save movieclip output jpg /** screenshot , jpg output **/ import flash.display.bitmapdata; import flash.geom.matrix; //buttons handlers. should add function because delegate doesn't allow pass parameters shaf.onpress = mx.utils.delegate.create(this,makeshadow); //helper functions pass parameters function makeshadow() { capture(0) } /* create function takes snapshot of video object whenever called , shows in different clips */ function capture(nr){ this["snapshot"+nr] = new bitmapdata(abc._width,abc._height); //the bitmap object no transformations applied this["snapshot"+nr].draw(abc,new matrix()); var t:movieclip = createemptymovieclip("bitmap_mc"+nr,nr); //po...

How to catch device back button event in android? -

i have open pdf file through application.when click on device button automatically come application .it working fine.here want catch button event in device.i override button.but not working.please me. this example of asking: @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back ) { //do stuff } return super.onkeydown(keycode, event); }

Unable to edit Tomcat Java options in XAMPP -

i'm looking instance of solr search running on localhost. directions call pointing tomcat solr home directory editing c://xampp/tomcat/bin/tomcat7w.exe and modifying java options tab. when try open file error: "the specified service not exist installed service. unable open service 'tomcat7'" when initiate tomcat on xampp , navigate localhost:8080, seems well. it installed, installed as windows service ? check in control panel/administrative/services. if is, open properties , note short name. rename tomcat7w.exe xxxxxw.exe xxxxx short name. if isn't installed service, go tomcat bin directory , run 'service install tomcat7'.

java - Automate login to a website -

i want make application logs web site filling form, perform basic operations such button click etc , log out. package / external jars available this? you need @ java.net.url, java.net.httpurlconnection, , java.net.authenticator.

.net - How to sign my VB.NET application? -

Image
i'd avoid scary messages when users install application: i understand have buy certification or that. can tell me should buy , should after? i'd sign exe application automatically. furthermore, use innosetup , i'd add signature automatically when creating new package (exe file) if want "known publisher" need certificate authority verisign, etc. it's not cheap (verisign charges ~$400/yr). https://www.symantec.com/verisign/code-signing/microsoft-authenticode/buy see : http://msdn.microsoft.com/en-us/library/ms247066 https://stackoverflow.com/a/1191152/327083 basically there 2 things can - strong name signing , authenticode signing. strong name signing alone not identify publisher of assembly associate assembly trusted key , can detect assemblies have been tampered with. have distribute own key/certificate users , have them install them. there no third-party system in place handle this. authenticode (ie: verisign, etc) costs mone...

ruby on rails - How to show select menu for two models? -

i'm using simple form , don't how show values of 2 associations. a price can belong service or product not both @ same time. price # service_id, product_id belongs_to :services # service.name belongs_to :products # product.name end instead having simple form this: <%= f.association :product, :input_html => { :class => "span5 } %> <%= f.association :service, :input_html => { :class => "span5 } %> i want turn 1 field instead. what way simple_form_for ? what regular form_for ? i think better way use polymorphic association. class price belongs_to :pricable, polymorphic: true end class product has_one :price, as: :priceable end class service has_one :price, as: :priceable end then, in form, can use: <%= form_for [@priceable, price.new] where @priceable product or service.

ruby on rails - Why does my delayed_job fail without RVM? -

i have delayed_job installed, , start daemon run jobs ruby script: require 'rubygems' require 'daemon_spawn' $: << '.' rails_root = file.expand_path(file.join(file.dirname(__file__), '..')) class delayedjobworker < daemonspawn::base def start(args) env['rails_env'] ||= args.first || 'development' dir.chdir rails_root require file.join('config', 'environment') delayed::worker.new.start end def stop system("kill `cat #{rails_root}/tmp/pids/delayed_job.pid`") end end delayedjobworker.spawn!(:log_file => file.join(rails_root, "log", "delayed_job.log"), :pid_file => file.join(rails_root, 'tmp', 'pids', 'delayed_job.pid'), :sync_log => true, :working_dir => rails_root) if run command rvmsudo works perfectly. if use ruby command without rvm fails , outp...

javascript - Jquery deferred from callback of ajax calls -

i'm trying write procedure after 2 objects returned result of callback of ajax function. i know classic example of using jquery when(): $.when($.get("http://localhost:3000/url1"), $.get("http://localhost:3000/url2").done(//do something)); but in case, don't want trigger when on execution of ajax function, want when trigger callback execution of ajax function. like: $.get("http://localhost:3000/url1", function(data){ function(){ //do data, , return myobj1; } }); $.get("http://localhost:3000/url2", function(data){ function(){ //do data, , return myobj2; } }); $.when(obj1, obj2).done(function(){ //do these 2 objects }); but of course, doesn't work. ideas? that should work. jquery.when() takes multiple arguments , fires once have completed returning each results arguments array: var req1 = $.get("http://localhost:3000/url1"); var req2 = $.get("http://localhost:3000/url2"...

jdbc - OJDBC code issue in Java Eclipse -

i have made registration table reg1 , stored values every registered users html file. have made log-in page in html users can give username , see datas entered them. have made user "bbb" , want show username only.so made general java code follows: import java.io.ioexception; import java.io.printwriter; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; public class check extends httpservlet { private static final long serialversionuid = 1l; /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse res...

How do I get the current time in a different TimeZone in Delphi? -

how current time different time zones in delphi. if use tidsntp give me time zone in locale. you can convert local time different time zone delphi-tzdb (time zone database delphi) . following example documentation . var lsydney: ttimezone; lmadeuplocaltime, luniversaltime, lsydneytime: tdatetime; begin // sydney time zone lsydney := tbundledtimezone.gettimezone('australia/sydney'); // encode local date/time value -- 14th march 2009 @ 12:45:00 pm lmadeuplocaltime := encodedatetime(2009, 03, 14, 12, 45, 00, 00); // find out time in sydney @ moment luniversaltime := ttimezone.local.touniversaltime(lmadeuplocaltime); lsydneytime := lsydney.tolocaltime(luniversaltime); writeln(format('when in time zone time %s, in sydney %s.', [datetimetostr(lmadeuplocaltime), datetimetostr(lsydneytime)])); end;

c# - How to report standard exceptions to the user? -

consider c# gui application uses filestream read file, chosen user through "open file" dialog. in case read fails one of exceptions , correct way report failure user, in user-friendly manner? should invent own message each of exceptions, or there way of obtaining localized, user-friendly message present verbatim user? edit i'm asking whether .net able provide me descriptive string can present (and consistent other .net programs). know can roll own, i'd avoid if there's standard alternative . you can have set of localizable user exceptions 1 of them being fileuploaderror . can put localized general information there. throwing few technical details might bit challenging, can quite hard right balance between technical details , simple step user needs take fix error. my suggestion be: have 1 user level fileuploaderrorexception have details property in it depending on actual exception, suggest user try few things

objective c - NSCFType keeps occurring, something is not being released? -

i'm attempting delete files documents directory using tableview/array combination. reason, nsstring pointing documents directory path being converted nscftype (which after research, understand happening because variable not being released). because of this, application crashes @ line nsstring *lastpath = [documentsdirectory stringbyappendingpathcomponent:temp]; claiming nscftype cannot recognize method stringbyappendingpathcomponent . i appreciate if me out (i hope have explained enough). - (void) tableview: (uitableview *) tableview commiteditingstyle: (uitableviewcelleditingstyle) editingstyle forrowatindexpath: (nsindexpath *) indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { nsstring *temp = [directorycontent objectatindex:indexpath.row]; nslog(temp); nsstring *lastpath = [documentsdirectory stringbyappendingpathcomponent:temp]; [[nsfilemanager defaultmanager] removeitematpath:lastpath error:nil]...

How change text width in table cell using autocad .net api C#? -

i create table using autocad .net api c#. var table = new table(); in single text(class dbtext), change text width of property - widthfactor. how change text width in table cell using autocad .net api c#? [image - different text width in cells table] this answered at: http://forums.autodesk.com/t5/net/how-change-text-width-in-table-cell-using-autocad-net-api-c/td-p/3522862

css - Targeting specific column in table -

i have table of class players 5 columns , 40 rows. want make second column have width: 200px . i can not figure out how select specific column in table. far have narrowed down this, of rows in table. can me set column width specific column? table.players td { } this should work (except on ie8 , below): table.players td:nth-child(2) { width: 200px; }

android - Add multiple rows to ListView per item -

i have listview has custom arrayadapter custom xml row. i passing in objects , words fine. however, want repeat each row 5 times within arrayadapter. in adapter, make minor adjustments each , current setup isn't feasible make adjustments prior passing in adapter. is possible this? can't seem conjure correct search terms find hints. there 2 ways know: 1. add repeated items dataset multiple times. since referencing same object pretty cheap. you can store number of repetitions in objects, , implement methods getcount(), getobject(), getview(), getitemid() remembering count of repetitions. f.e. if have foo object 2 repetitions , bar no repetitions getcount should return (2 + 1) + 1. count values in constructor or maybe when data set changes speed ui litle bit.

c# - split values separated by comma's in different lines -

hi trying retrieve values database. have row has multiple image names separated ",". want display them in different lines. using following code working fine 2 values. when have 3 or more values gives two. query: ;with tmp(imageurl,heritageid) ( select  left(imageurl, charindex(',',imageurl+',')-1),    stuff(imageurl, 1, charindex(',',imageurl+','), '') shop.dbo.images heritageid=@heritageid union select  right(imageurl, charindex(',',imageurl+',')-1),    stuff(imageurl, 1, charindex(',',imageurl+','), '') images imageurl > '' , heritageid=@heritageid ) select  imageurl tmp your query looks attempt use recursive cte split string. case should this. ;with tmp(imageurl,rest) ( select left(imageurl, charindex(',',imageurl+',')-1), stuff(imageurl, 1, charindex(',',imageurl+','), '') images heritageid=@heritageid union select ...

Blurry images in Android browser and WebView -

for android application, need show images in webview . application runs on android 2.1 (api 7) , onward. images contain table soft text , problem facing in android versions 2.1, 2.2, 2.3 etc, blurry while in newer versions, such 4.0.3, sharp. have tested high/low resolution images results same. why so?

ruby on rails - Cant show the invitation box for inviting in homepage -

i want make beta invites. cant see invitation form on homepage. /static_pages/home.html.erb:( shortly) <% if signed_in? %> <div class="row"> <aside class="span2"> <section> <%= render 'shared/invitation_form' %> </section> </aside> <div class="span6 hero-unit"> <ol class="topics-signedin"> <%= render 'shared/topics' %> </ol> </div> </div> <% else %> <div class="row"> <div class="span10"> <div class="center hero-unit"> <h2>giripedia</h2> <ol class="topics"> <%= render 'shared/topics' %> </ol> <%= link_to "Üye olun!", ...

Create SVN branch from specific Tag and merge to trunk -

recently moved svn. i have 2 questions here, we had release , created tag tag1. after week there production issue , prod code base tag1, later on trunk made several changes don't want push production, best way here take code tag1 , change, have exported data tag not able commit , don't want commit tag, need separate branch after release make tag(tag2) based on branch merge trunk. merge trunk not issue. issue here how create branch tag based code , commit changes? we have releases every 2 months, these changes made directly on trunk, after release create tag , continues next release. other end, going start new project xyz release @ year end(date not yet decided), here, branch needs create previous tag not trunk because made changes on trunk coming release, how we can achieve it?. thanks kv svn copy your.repo.url/tags/your-tag-name your.repo.url/branches/your-new-branch-name -m "message" then work on it svn checkout your.repo.url/branches/your...

java - Add a background image to JPanel with rounded corners -

Image
i've extended jpanel use in project want appear more "3d". that's bosses' way of requiring shadowing , rounded corners on components. that's been accomplished shown on many online examples. did this: public class roundedpanel extends jpanel { protected int _strokesize = 1; protected color _shadowcolor = color.black; protected boolean _shadowed = true; protected boolean _highquality = true; protected dimension _arcs = new dimension(30, 30); protected int _shadowgap = 5; protected int _shadowoffset = 4; protected int _shadowalpha = 150; protected color _backgroundcolor = color.light_gray; public roundedpanel() { super(); setopaque(false); } @override public void setbackground(color c) { _backgroundcolor = c; } @override protected void paintcomponent(graphics g) { super.paintcomponent(g); int width = getwidth(); int height = ge...