Posts

Showing posts from June, 2014

asp.net - Remove ASPX FILE Extention in Web.config But Negate Rewrite if URL Contains Period -

all right, of use standard rule below remove aspx extention in urls. <rule name="remove"> <!--removes .aspx extension pages.--> <match url="(.*)" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="{r:1}.aspx" /> </rule> however modify rule prevent write rule catching url period in it. that way if tries type in http://www.domain.com/picture.jpg rule doesn't catch it. luckily isfile , isdirectory conditions prevent actual files being hit rule whenever have case types in file doesn't exist on server rule catches , asp.net this: http://www.domain.com/404error.aspx?aspxerrorpath=/pictur

Mysql Select Where id<100 -

i'm trying query in php: $sql= "select pcampo6 productos id >= 100"; this error get: invalid query: have error in sql syntax; check manual corresponds mysql server version right syntax use near '= 100' @ line 1 i tried : $sql = "select `pcampo6` productos eliminado=0 , `id` >= 101"; $sql = "select 'pcampo6' productos eliminado=0 , 'id' >= 101"; $sql = "select pcampo6 productos eliminado=0 , id >= '101'"; there nothing wrong query posted. see demo if id column not integer type, try using single quotes around value the error coming elsewhere in code not showing us.

php - xcode ios split nsarray object into two separate objects -

hi im making mysql database user can search other users, when searching want return user "id" , "name" since there users same name, include id. here .php edit : since didn't answer wanted, thought didn't make clear enough, i'm thinking in other way try it. let's id in index 0 , name in index 1, , on.. see php edit comment. $result = mysql_query("select `id`,`name` `user` `name` '$search%'"); mysql_close($con); $numrows = mysql_num_rows($result); if ($numrows!=0){ while ($row = mysql_fetch_assoc ($result)){ $id = $row['id']; $name = $row['name']; echo ("$id,$name///"); above on first attempt, note: edit example, i'm thinking make id, , name separate, in xcode separate them again 2 different arrays lets say, id's in id array kinda jumping on 1 index every time "jumping on names", , names in name array again jumping on ids. // edit:

input - While loop and if statement trouble -

when put in account number in terminal window error the data put correct, put string such as"ste251" accountand int such 500 balance. also when try stop loop when throws mismatch exeption get: java.util.inputmismatchexception: null (in java.util.scanner) java.util.inputmismatchexception @ java.util.scanner.throwfor(scanner.java:909) @ java.util.scanner.next(scanner.java:1530) @ java.util.scanner.nextint(scanner.java:2160) @ java.util.scanner.nextint(scanner.java:2119) @ writeaccountbalances.writetofile(writeaccountbalances.java:58) from the docs inputmismatchexception : thrown scanner indicate token retrieved not match pattern expected type, or token out of range expected type. that pretty says needs said. check unexpected input.

awk - Spliting a file into multiple files based on common line prefix -

suppose have file following format. prefix1: line 1 prefix1: line 2 prefix1: line 3 prefix2: line 4 prefix2: line 5 prefix3: line 6 prefix3: line 7 prefix3: line 8 prefix3: line 9 prefix3: line 10 i split 3 files names prefix1 , prefix2 , prefix3 , newlines intact part of whichever file either entirely contains them. in real file, there might n prefixes , not 3. i write python script implement functionality directly, wonder if there's shorter way in awk . this one-liner works job: awk -f: '{f=$1?$1:f; print > f}' file with example: kent$ cat file prefix1: line 1 prefix1: line 2 prefix1: line 3 prefix2: line 4 prefix2: line 5 prefix3: line 6 prefix3: line 7 prefix3: line 8 prefix3: line 9 prefix3: line 10 kent$ awk -f: '{f=$1?$1:f; print > f}' file kent$ head prefix* ==> prefix1 <== prefix1: line 1 prefix1: line 2 prefix1: line 3 ==> prefix2 <== prefix2: line 4 prefix2: line 5 ==> prefix3 <== prefix3: l

c# - Conditionally creating new collections with output parameters -

this program purely illustrative purposes. wanted take integer input , if greater zero, create arraylist integer in arraylist. tried numerous (incorrect) ways , settled on see below. however, don't looks of it. using system; using system.collections.generic; using system.linq; using system.text; using system.collections; class program { static void main(string[] args) { console.write("enter in number of size of arraylist want: "); int arraysize = int.parse(console.readline()); if (arraysize > 0) { arraylist newlist = createlist(arraysize,out newlist); newlist.add(arraysize); console.writeline("the size of array {0}",newlist.count); console.readline(); } else { console.writeline("you did not create arraylist"); } console.writeline(&

oracle - Sql query using multiple left outer joins taking more time to complete -

create materialized view mv_sd_sipl_bomlevelsalt_5 refresh force on demand ( select 'id-' || rownum id, t1.l1 l0, t1.l0 l1, t1.alternateitem l1ai, t1.effstartdate l1sd, t1.effenddate l1ed, t1.qtyper l1q, t1.siteid l1s, t1.transittime l1tt, t2.l0 l2, t2.alternateitem l2ai, t2.effstartdate l2sd, t2.effenddate l2ed, t2.qtyper l2q, t2.siteid l2s, t2.transittime l2tt, t3.l0 l3, t3.alternateitem l3ai, t3.effstartdate l3sd, t3.effenddate l3ed, t3.qtyper l3q, t3.siteid l3s,t3.transittime l3tt, t4.l0 l4, t4.alternateitem l4ai, t4.effstartdate l4sd, t4.effenddate l4ed, t4.qtyper l4q, t4.siteid l4s,t4.transittime l4tt, t5.l0 l5, t5.alternateitem l5ai, t5.effstartdate l5sd, t5.effenddate l5ed, t5.qtyper l5q, t5.siteid l5s,t5.transittime l5tt, t6.l0 l6, t6.alternateitem l6ai, t6.effstartdate l6sd, t6.effenddate l6ed, t6.qtyper l6q, t6.siteid l6s,t6.transittime l6tt, t7.l0

c++ - Variable sized packet -

i trying define packet length determined during ns-3 simulation (think of packet sent on downlink containing schedule information length depends on number of nodes in network can join/leave network during simulation). have idea how approach this? the traditional solution send length first, followed data: +------------+---------------------+ | uint32_t n | n - 4 bytes of data | +------------+---------------------+ to decode, read first 4 bytes, , use value in bytes determine how more data there is.

java - How do I get paintComponent(Graphics g) to call? repaint() won't work every time -

the following in java se6 program tic tac toe game: i have class minipanel extends jpanel have in grid. if user clicks 1 of these, listener stuff then... eventually, calls method placex() or placeo() on minipanel clicked. stuff prints out message saying method called, , next line calls animatepanel() method, calls repaint() inside, printing out message right before. the class minipanel overrides paintcomponent(graphics g) method first prints out message saying paintcomponent called super.paintcomponent(g) , other stuff. the problem when click minipanel , first 2 messages saying placex() or placeo() , animatepanel() called appears, means repaint() must have been called. paintcomponent(graphics g) never called! weird thing works if call placex() directly when minipanel initialized not otherwise. i have paintcomponent(graphics g) overridden, nothing else. here paintcomponent: public void paintcomponent(graphics g){ if (controller.debug) system.out.pri

python - Getting config variables outside of the application context -

i've extracted several of sqlalchemy models separate , installable package (../lib/site-packages), use across several applications. need to: from models_package import mymodel from application needing access these models. everything ok far, except cannot find satisfactory way of getting several application dependent config variables used of models, may vary application application. model need aware of variables, i've used application in. neither current_app.config['xyz'] or config = localproxy(lambda: current_app.config['xyz']) have worked ( outside of application context errors) i'm stuck right now. maybe poor programming and/or design on behalf, how clear up? there must way, haven't reasoned myself toward yet. solution: avoiding setting items occur on module load (like constant containing api key), both of above should work, , do. not using in context of model-in-the-application use of course error, methods returning values ne

ruby - STDIN.getch as a non block event (it's possible?) -

i'm trying read character instantly command line without use of enter. ruby (ruby 1.9.3p374) code i'm using following: require 'io/console' ch = stdin.getch puts ch until everithing working fine want put code inside infinite loop doing other stuff, loop puts "..doing stuff.." ch = stdin.getch if ch == 'q' break end end but code force press key between each printing. want behaviour similar stdin.read_nonblock method without having press enter key after pressing 1 char. basically want print "..doing stuff.." until press key on keyboard don't want use enter. any appreciated. thanks you use built-in curses library handle interaction. it's powerful , used construct keyboard-driven tools such text editors. the alternative use select poll if stdin readable. terminal might in line-buffered state, you'd need adjust before single keystrokes received. curses can handle you.

android - How to force Gallery to open in landscape orientation? -

my app runs in landscape mode. have android:screenorientation="landscape" set in androidmanifest.xml file. if screen orientation of device locked portrait mode, app still runs in landscape mode. gallery activity started within app runs in portrait mode. there way force gallery activity run in landscape mode? as long device locked portrait mode, there no way achieve this. of course try change the device orientation landscape (in app) gallery runs in landscape cause confusion user.

model view controller - CustomErrors not redirecting to custom page but MVC default error page -

i have new mvc 4.0 solution created scratch using vs2012 web express , iis express. tile says changed web.config , added following in : <customerrors defaultredirect="errors/genericerror.html" mode="on"> <error statuscode="404" redirect="errors/error404.html"/> </customerrors> basically when exception in controller default mvc error.cshtml showing error instead of custom page genericerror.html. if go url doesn't exist, error404.html showing correctly not generic scenario. any ideas how can change behavior? sounds don't have error attribute in global filters. in mvc 4 project should able search class filterconfig generated you: public class filterconfig { public static void registerglobalfilters(globalfiltercollection filters) { filters.add(new handleerrorattribute()); } } update: the handleerrorattribute global filter errors occur in mvc pipeline, such errors in contro

python - Django hit counts Class-based views -

i'm trying youtube views: models.py class video(models.model): title = models.charfield(max_length=100) embed = models.textfield created_at = models.datetimefield(auto_now_add=true,editable=false) updated_at = models.datetimefield(auto_add=true,editable=false) visit_count = models.integerfield(default=0) def add_visit(self): if self.visit_count not none: self.visit_count += 1 else: self.visit_count = 0 views.py class videodetail(detailview): model = video def get_context_data(self, **kwargs): context = super(videodetail, self).get_context_data(**kwargs) self.object.add_visit() self.object.save() return context example use: video.objects.order_by('-visit_count') so working properly, not quite, can count limit ip. class video(models.model): title = models.charfield(max_length=100) embed = models.textfield created_at = models.datetimefield(auto_

java - Trusting an expired certificate -

this question has answer here: java - ignore expired ssl certificate 3 answers my client failing below error while communicating https server expired cert. while in process of waiting fixed on server side renewing, wondering if can pass error adding expired cert our own trust store? allows gain testing time while waiting cert renewed. us has end date thu sep 08 19:59:59 edt 2011 no longer valid. [4/17/13 19:22:55:618 edt] 00000021 systemout o webcontainer : 0, send tlsv1 alert: fatal, description = certificate_unknown [4/17/13 19:22:55:620 edt] 00000021 systemout o webcontainer : 0, write: tlsv1 alert, length = 2 [4/17/13 19:22:55:620 edt] 00000021 systemout o webcontainer : 0, called closesocket() [4/17/13 19:22:55:620 edt] 00000021 systemout o webcontainer : 0, handling exception: javax.net.ssl.sslhandshakeexception: com.ibm.jsse2.util.g:

Archiva or Artifactory using something other than localhost -

i want use either archiva or artifactory in stand-alone mode, want configure listen on other 'localhost'. my internal repository on system between internal network , internet. i want configure either of these listen on internal ip address. is possible? tia, dave for archiva have @ file called jetty.xml find line <set name="host"><systemproperty name="jetty.host"/></set> normally can set ip or host. hth

ruby - how to count all page impressions from two different models into one number? (rails 3) -

i'm using impressionist gem , works well. i using in user/show.html.erb view count impressions of person's profile (user.rb impressionable) <%= @user.impressionist_count %> i decided break out each micropost user , decided count (micropost.rb impressionable) in micropost/show.html.erb - using code count how many times particular post viewed <%= @micropost.impressionist_count %> i trying sum of @micropost.impressionist_count fall under same user , add user/show.html.erb. how can that? so in mathematical terms, i'm trying do total = user.impressionist_count + sum(micropost.impressionist_count)s you haven't specified database using gem. it's compatible rdbms database, mongodb. summing may perform differently depending on choice. in rdbms-backed system, can eager load of related microposts given user through use of join (:joins in ar parlance). having grabbed of related microposts, can do: @user.impressionist_count + @user.

c# - Similar property names in ViewModel not binding in controller action method -

recently updated our application mvc3 mvc4. in mvc4 have discovered having property names studio , studioexecutive in our viewmodel cause problems when posting. in controller method studio = null when studioexecutive being populated. here example of our issue , hope there answer problem. data classes: public class testcontact { public list<testcontactitem> studio { get; set; } public list<testcontactitem> studioexecutive { get; set; } public testcontact() { studio = new list<testcontactitem>(); studioexecutive = new list<testcontactitem>(); } } public class testcontactitem { public int id { get; set; } public string name { get; set; } } controller methods: public actionresult testcontactview() { var vm = new testcontact(); vm.studio.add(new testcontactitem(){id=1, name = "studio contact id=1"}); vm.studioexecutive.add(new testcontactitem() { id = 2, name = "studio exec co

Gstreamer elements memory leak -

how find memory leak problem in gstreamer elements/plugins? how analyse gst refcount memory/object leak/refcount? examples? using appsrc , appsink push , pull buffer , gstreamer pipeline. seems there memory issue these elements. have live source feeds data pipeline, typically properties set on appsrc , appsink live source? thanks-opensid you can use tools valgrind (memcheck) or asan (address sanitizer) check such issues. refcount issues tricky find.

javascript - Can't get text to change with a button click -

i'm trying change line of text, inside form; more specifically, want text change under conditions. conditions check when user clicks button. in case want text change when user leave input field blank. code includes entire form i'm working , script. problem i'm having text seem change when button clicked second or long alert message up. afterwards, goes original text. line in script accessing 5th line of code. <div id="userregistration"> <!-- registration form shell --> <form name="registration"> <div id="leftsideform"> <!-- left side of registration form --> <span style="color:red">*</span> enter username: <input type="text" name="username" /> <br /> <b id="yy">test </b> <br /> <span style="color:red">*</span>

flash - Array elements (MovieClips) are being deleted as I add new ones. Why? -

i'm having trouble odd behavior in actionscript 2.0. i'm trying add number of pages (movieclips) stage, , @ same time store references in convenient array later access. here code (assume variables have been declared): _adpages = new array(); _adpages[0] = adpagetrack.attachmovie("adpage", "adpage0" + 0, getnexthighestdepth()); _adpages[0].init( _aditems[0] ); _adpages[0]._x = 0 * 10; _adpages[1] = adpagetrack.attachmovie("adpage", "adpage0" + 1, getnexthighestdepth()); _adpages[1].init( _aditems[1] ); _adpages[1]._x = 1 * 10; _adpages[2] = adpagetrack.attachmovie("adpage", "adpage0" + 2, getnexthighestdepth()); _adpages[2].init( _aditems[2] ); _adpages[2]._x = 2 * 10; _adpages[3] = adpagetrack.attachmovie("adpage", "adpage0" + 3, getnexthighestdepth()); _adpages[3].init( _aditems[3] ); _adpages[3]._x = 3 * 10; trace(_adpages); (v

django - Python variable scope and lazy querysets -

i'm using django , out-of-the-box orm. if there module level variables, evaluated when app starts? or evaluated on every request if it's modified in view? example: from news.models import news # module level variables draft_news = news.objects.filter(status='draft') live_news = news.objects.filter(status='prod') def view(request): # outputs 10 10, respectively. print 'there %d news objects , %d live objects. adding draft article' % (draft_news.count(), live_news.count()) n = news( content='this test content', status='draft', slug='this-is-a-test3', pubdatetime=datetime.now(), ) n.save() print '...done. there %d draft news objects.' % draft_news.count() # 11 objects print 'changing status live...' n.status='prod' n.save() print 'there %d live objects.' % live_news.count() # 11 objects since querysets lazy, matter

Matlab: variable values shows "error displaying values" -

i have saved number of output variable .mat file. showed values in workspace properly. unfortunately variable values in workspace show "error displaying values" instead of appropriate size values showed previously. same program executed in computer there see right values.

chromium - How can I get IHtmlDocument2 in chrome browser? -

in internet explorer, can use ihtmldocument2 html document. function getcurrentbrowserdom: widestring; var hr: hresult; currentie: iwebbrowser2; wnd: hwnd; wndchild:hwnd; document: idispatch; rootnode: ihtmldocument2; innerhtml: widestring; begin result := ''; wnd := getforegroundwindow; wndchild := findwindowex(wnd, 0,'frame tab', nil); wndchild := findwindowex(wndchild, 0,'tabwindowclass', nil); wndchild := findwindowex(wndchild, 0, 'shell docobject view', nil); wndchild := findwindowex(wndchild, 0, 'internet explorer_server', nil);//find internet coinitialize(nil); try hr := getiefromhwnd(wndchild, currentie); if hr = s_ok begin document := currentie.document; document.queryinterface(iid_ihtmldocument2, rootnode); innerhtml := rootnode.body.innerhtml; end; couninitialize; end; end; function getiefromhwnd(whandle: hwnd; var ie: iwebbrowser2): hresult; type tobjectf

Python- Finding average -

i trying find average number of times user guesses number. user asked how many problems want , program give them many problems. having trouble recording amount of times guess , wrong , guess , right , finding average between two. have far print("hello!") random import randint def hooblah(): randoma = randint(0,12) randomb = randint(0,12) answer = 0 correctanswer = (randoma*randomb) realanswer = (randoma*randomb) avgcounter = 0 avgcorrect = 0 average = 0 print("what {0} * {1} ?".format(randoma,randomb)) while answer != realanswer: = input("what's answer? ") answer = int(an) if answer == correctanswer: avgcorrect+=1 print("correct!") average+=((avgcorrect+avgcounter)/avgcorrect) else: avgcounter+=1 if answer > correctanswer: print("too high!") else: pr

javascript - Autocomplete AJAX request based on input instead of returning all results -

i using autocomplete plugin called fcbkcomplete , works charm. problem , concern is, apparently (that how think) when ever enter char in input result in drop down, result returned json response , response searched display results on drop down. in other word, following url: http://this.com/usersapi.do the search query like: select * user_table when request gets sent url results , size not small @ all. what looking way can search chars enter in input field. url this: http://this.com/usersapi.do?name=? so query executed select * user_table name xxx xxx chars have entered far. next char enter y query changes to select * user_table name xxxy and on this result in lighter json response , less load on servers. so please me out thanks, hi can use this. $( "#fieldid").autocomplete({ source: function( request, response ) { $.ajax({ url: "test.do", data : {"s

How to protect the Apps Script code in a Google spreadsheet? -

i have written code google spreadsheet script editor. i want share spreadsheet clients don't want share code have written. this code adds menu spreadsheet contains useful functions should work/run when clients open spreadsheet condition applied that: shouldn't able see code. this easy excel, google spreadsheet don't know. . have searched lot on google gives idea how share spreadsheet. example in "view" mode, in case there problem: menu function, adds menu, "onopen" , doesn't start when clients open it. how implement in google spreadsheet? make use of library documentation explains how use , there few interesting post on the subject well

how does this line function: require_once('Zend/Registry.php');? -

i have installed zend framework 2(zend framework + zend server) on win 7. in zend/apache2/htdocs/hello1.php , put below script: <?php require_once('zend/registry.php'); $registry = zend_registry::getinstance(); $registry['name'] = 'quentin zervaas'; echo sprintf('my name %s', $registry['name']); ?> then run http://localhost/hello1.php , shows: name quentin zervaas my question is: line require_once('zend/registry.php'); under htdocs folder, dummy.php, favicon.ico, index.html,hello1.php, there no zend folder, how line function? in php.ini check include_path it have default location of zend directory.

Shows exception in java code (Selenium + Jsoup) -

i working on project. in that, have html page source code. that, invoke firefox driver using selenium , , store page source code in string, , parse using jsoup my code worked fine single url . when put code in testing, has numbers of urls 1 one, @ end throws 1 exception, , project fails. please see exception , tell me why occurs, , give me solution overcome exception. my selenium code follows, private static firefoxprofile createfirefoxprofile() { file profiledir = new file("/tmp/firefox-profile-dir"); if (profiledir.exists()) { return new firefoxprofile(profiledir); } firefoxprofile firefoxprofile = new firefoxprofile(); file dir = firefoxprofile.layoutondisk(); try { profiledir.mkdirs(); fileutils.copydirectory(dir, profiledir); } catch (ioexception e) { e.printstacktrace(); } return firefoxprofile; } // below code in main function (url1 , url2 2 urls ) webdriver driver = new firefoxdriver(

Submit PHP form to MYSQL database using AJAX -

i have php page displays records mysql database in table. want able edit record in table cell clicking on cell. process picture go this: 1) onclick() event on table cell triggers ajaxfunction() 2) ajaxfunction() sends cell data php page querys database , displays drop down list of options. 3) user selects option drop down list 4) onchange() event submits form database 5) table cell or page refreshed show current table cell data. (not in existing code) right i've got 2 php pages ac_sched.php , modsched.php . here structure of each page: ac_sched.php : php created table displaying mysql records ajaxfunction query database available cell options modsched.php : php code select available cell options database , create dropdown. php code update database selected option dropdown. here relevant sections of code each page: ac_sched.php: <script> function acschedquery(reg) { if (window.xmlhttprequest) {// code ie7+, firefox,

c - Trouble with endpoints of my wcf -

my wcf service web.config. <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionstrings> <add name="zesdaagseresultscontext" connectionstring="data source=194.33.112.88\partywhere;initial catalog=zesdaagseresults;persist security info=true;user id=*********;password=******************/;multipleactiveresultsets=true" providername="system.data.sqlclient" /> </connectionstrings> <system.servicemodel> <services> <service name="wcfopzet.mobileservice" behaviorconfiguration="mexbehavior"> <endpoint binding="webhttpbinding" contract="wcfopzet.imobileservice" behaviorconfiguration="webhttpbehavior" /> <endpoint contract="imetadataexchange" binding="mexhttpbinding" address="mex" /> </service> </services> <behaviors>

Can an Azure Website have multiple bindings? -

we host our site on iis on our own virtual machine. works great. our main website has around 30 or bindings, use customize html output. each binding theme, us. red.mywebsite.com have red background, example. if move on azure web site, azure allow also? if yes, can programatically? yes, azure web sites support multiple bindings per single web site. this feature is, however, available shared , reserved instances scale mode. configuring the bindings done via custom domain management targeted web site. can add multiple custom domains, edit bindings in iis. must aware ssl not yet available azure web sites. there programmatic way of managing bindings, not documented yet, feature preview. can manage azure web sites via windows azure powershell management cmdlets . not yet documented. if latest windows azure powershell here have these commands: new-azurewebsite get-azurewebsite remove-azurewebsite set-azurewebsite show-azurewebsite start-azurewebsite stop-

selenium - isElementPresent is very slow in case if element does not exist. -

i using below code check element on web page private boolean iselementpresent(by by) { try { driver.findelement(by); return true; } catch (nosuchelementexception e) { return false; } catch (exception e) { return false; } } i need check in program if particular region appears in result below iselementpresent(by.xpath(".//*[@id='header']"))); if present function completes if above not present run long. could 1 please me in resolving issue check can performed quickly? here missing somethings why waiting if there not element. findelement wait element implicitly specified time. need set time 0 in method. iselementpresent(webdriver driver,by by) { driver.manage().timeouts().implicitlywait(0, timeunit.seconds); try { driver.findelement(by); return true; } ca

hive - Hadoop: FSCK result shows missing replicas -

could let me know how fix missing replicas? ============================================================================ total size: 3447348383 b total dirs: 120 total files: 98 total blocks (validated): 133 (avg. block size 25919912 b) minimally replicated blocks: 133 (100.0 %) over-replicated blocks: 0 (0.0 %) under-replicated blocks: 21 (15.789474 %) mis-replicated blocks: 0 (0.0 %) default replication factor: 3 average block replication: 2.3834586 corrupt blocks: 0 missing replicas: 147 (46.37224 %) number of data-nodes: 3 number of racks: 1 ============================================================================ as per indefinite guide, corrupt or missing blocks biggest cause concern, means data has been lost. default, fsck leaves files corrupt or missing blocks, can tell perform 1 of following actions on them: • move affected files /lost+foun

performance - WPF poor perfomance of loading images on WindowsXP -

i have code load image thumbs , display them in listbox. works on win7. on windows xp takes seven-ten minutes load few big images, while on 7 takes seconds. how can speed up? public static string addimage(string file) { string key = "img_" + (++_counter).tostring("00000"); imageinfo inf = new imageinfo(); inf.originalpath = file; inf.id = key; inf.originalpath = file; bitmapimage bi = new bitmapimage(); bi.begininit(); bi.decodepixelwidth = thumb_size; bi.cacheoption = bitmapcacheoption.onload; bi.urisource = new uri(file); bi.endinit(); inf.thumbbitmap = bi; _storedimageinfo.add(key, inf); return key; } imageinfo own class containing references bitmapimages , images' path. not think has major influence on loading times.

java me - Showing Google Map in j2me -

string url = "http://maps.google.com/maps/api/staticmap";url += "?zoom=13&size=" + width + "x" + height;url += "&maptype=roadmap";url += "&markers=color:red|label:a|" + lat + "," + lon; url += "&sensor=true"; my first attempt static map center location , zoom level , worked when i'm adding markers url i'm getting same image no markers. i'm doing same google map api doc cant figure out whats wrong. is there other way show map in j2me application?? there fundamentally 2 ways show maps in java me application. method of making http request map server best suited situations need 1 single map image. since each map update require more network traffic. if need series of images, add custom markers or want dynamically update map, better off using dedicated library uses tile server , caches map tiles , ov

javascript - django dropdownlist onchange submission -

i showing user dropdown list form: class cronform(forms.form): days = forms.modelchoicefield(queryset=day.objects.all().order_by('day')) class day(models.model): day = models.charfield(max_length=200, default='') month = models.charfield(max_length=200, default='') def __unicode__(self): return self.day and shown @ template way: <form method="post" onchange=change()> {{ days }} </form> what want submit form when user selects option dropdown list. example, user redirected new url, , internally program capture post data. find related <select> tag, calling javascript function onchange of select element. select element in modelchoicefield form, don't know how it. appreciated! solved following link days = forms.modelchoicefield(queryset=day.objects.all().order_by('alias'), widget=forms.select(attrs={"onchange":'refresh()'}))

linux - Compilng libgcc xgcc error -

i'm trying install cross compiler, this tutorial , , when want make libgcc put make all-target-libgcc in terminal. make throws error checking whether ln -s works... yes checking i586-elf-gcc... /usr/src/build-gcc/./gcc/xgcc -b/usr/src/build-gcc/./gcc/ -b/usr/local/cross/i586-elf/bin/ -b/usr/local/cross/i586-elf/lib/ -isystem /usr/local/cross/i586-elf/include -isystem /usr/local/cross/i586-elf/sys-include checking suffix of object files... configure: error: in `/usr/src/build-gcc/i586-elf/libgcc': configure: error: cannot compute suffix of object files: cannot compile see `config.log' more details. make: *** [configure-target-libgcc] error 1 in config.log found target: i586-elf configured with: ../gcc-4.8.0/configure --target=i586-elf --prefix=/usr/local/cross -- disable-nls --enable-languages=c,c++ --without-headers : (reconfigured) ../gcc-4.8.0/configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --enable-languages=c,c++ --witho

Quality Loss When storing images into SD card from GridView Android -

to images gallery used follwing code, string[] projection = new string[]{ mediastore.images.media._id, mediastore.images.media.bucket_display_name, mediastore.images.media.date_taken, mediastore.images.media.data, mediastore.images.media.default_sort_order }; uri images = mediastore.images.media.external_content_uri; cursor cur = managedquery(images, projection, // columns return "", // rows return (all rows) null, // selection arguments (none) "" // ordering ); if (cur.movetofirst()) { string bucket; string id; string filepath; int bucketcolumn = cur.getcolumnindex( mediastore.images.media.bucket_display_name); int datecolumn = cur.getcolumnindex( mediastore.images.media._id); int datacolumnindex = cur.getcolumnindex(mediastore.images.media.data); { // field values bucket = cur.getstring(bucketcolumn); id = cur.getstring(datecolumn); data=cur.getstring(datacolumnindex)

How to monitor file transfer in Windows using Java? -

i writing utility check whether big file has been transferred. from found online, understand best way have sender send bite-sized file indicate file transfer complete. instance, after sending 10gb video file bigfile.mov , sender sends 1kb bigfile.txt containing checksum or identify file; receiver polls bigfile.txt . however, in case, approach not open me because have no control of files being sent me. therefore resorting more unreliable approach of polling file number of times in specified intervals, file size , last-modified time. public static boolean hasfinished(string sfilename, int polls, int interval) { boolean isdone = true; file file = new file(sfilename); long size = file.length(); long lastmodified = file.lastmodified(); if (file.isfile()) { (int = 0; < polls; i++) { // sleep bit try { timeunit.seconds.sleep(interval); } catch (interruptedexception e) { e.printsta

postgresql - Handling Exception From C Function -

i have function calling function c library. there anyway can catch exception postgres function that's calling c function? here's function i'm calling: -- function: public.st_makevalid(geometry) -- drop function public.st_makevalid(geometry); create or replace function public.st_makevalid(geometry) returns geometry '$libdir/postgis-2.0', 'st_makevalid' language c immutable strict cost 100; alter function public.st_makevalid(geometry) owner postgres; comment on function public.st_makevalid(geometry) 'args: input - attempts make invalid geometry valid w/out loosing vertices.'; here function i'm calling from: create or replace function public.mango_repair(geometry) returns geometry $body$ declare the_geom geometry := $1; reason text := st_isvalidreason(the_geom); begin if reason 'self-intersection%' the_geom = st_makevalid(st_boundary(the_geom)); end if;

javascript - setInterval behaviour in TypeScript -

i started play around typescript. i´ve created sample project visual studio 2012 express web , sample has line of code has behaviour cannot explain myself. first typescript code: start() { this.timertoken = setinterval(() => this.span.innerhtml = new date().toutcstring(), 500); } so line sets value of timertoken every 500ms , updates html element current date/time. in javascript equivalent this: greeter.prototype.start = function () { this.timertoken = setinterval(this.span.innerhtml = new date().toutcstring(), 500); }; so wondered lambda expression in typescript code line , removed date/time string won't updated anymore. so easy question ... why? i assuming span property in same class start method... correct me if wrong on this. so fat-arrow syntax has special meaning in typescript. when use () => typescript preserves lexical scope... means this means same inside expression outside of expression. can see in compiled javascr

math - Three.js Precision Terrain Collision -

Image
've been working on game engine using webgl library three.js. have basic terrain collision working point can find face user standing on. using average or maximum y position of faces vertices not sufficient. what formula can use find exact y position of object relative terrain face "standing" on? assuming know faces 4 vertex positions , objects vector position. the plane three.planegeometry(2000,2000,128,128) augmented heightmap. image above 1 of it's faces. i cannot put code in comment putting here. dont need math. let three.js you. can following: var plane = new three.plane(); plane.setfromcoplanarpoints (v1, v2, v3); // x, y, z: position of object var ray = new three.ray (new three.vector3(x, y, z), new three.vector3(0, 1, 0)); var = ray.intersectplane (plane); and vector3 'where' use y component change position of object.

How do I use shared view script paths for partials in Zend Framework 2? -

i'm using zend framework 2 (v2.1.4) , have partials template want use in several modules. according the documentation can access partials in other modules, but that said, it’s better practice put re-usable partials in shared view script paths. this sounds idea, can't find documentation on "share view script path". find it, , when i've set it, how tell partial() helper use them? in module.config.php 'view_manager' => array( 'template_path_stack' => array( 'mymodule' => __dir__ . '/../view', ), 'template_map' => array( 'snippets/mypartial' => __dir__ . '/../view/snippets/mypartial.phtml', ), ), and use that <?php echo $this->partial("snippets/mypartial"); ?>

c# - Windows Forms FolderBrowserDialog hangs the application -

with winforms, when right click on folder or try delete folder within folderbrowserdialog window becomes irresponsive , i've force-close it. here's code: private void btnopenfiledialog_click(object sender, eventargs e) { folderbrowserdialog1.selectedpath = txtboxlog.text; folderbrowserdialog1.rootfolder = environment.specialfolder.mycomputer; if (folderbrowserdialog1.showdialog()==dialogresult.ok) { txtboxlog.text = folderbrowserdialog1.selectedpath; } } the problem system wide, control correctly behaving in incorrect way (irony).

c# - How to validate a user control loaded in the page programatically? -

i want ask how validate client side , server side in following case : i have web page load user control in programatically : in page_load : if (request.querystring["pagenew"] != null && !string.isnullorempty(request.querystring["pagenew"])) { page_new_name = request.querystring["pagenew"]; ctrl = (mybasecontrol)loadcontrol("usercontrols/" + page_new_name); } if (ctrl != null) { pnl_pagenew_uc.controls.add(ctrl); } this page contains button(confirm) . want button validate controls in user control before confirming ,how ,some explanation please?