Posts

Showing posts from August, 2010

Android: Time delay in a loop with updating UI -

Android: Time delay in a loop with updating UI - what i'm trying create simple progress bar, load ~10 sec. want loop this: for(int = 1; <= 100; i++) { progressdialog.setprogress(i); //100ms delay } thanks the next code may helpful you. public void startprogress(view view) { // long runnable runnable = new runnable() { @override public void run() { (int = 0; <= 10; i++) { final int value = i; seek { thread.sleep(1000); } grab (interruptedexception e) { e.printstacktrace(); } handler.post(new runnable() { @override public void run() { progressdialog.setprogress(value); } }); } } }; new thread(runnable).start(); } ...

wcf - Configuring SSL (https) for ws2007FederationHttpBinding Endpoint 404 No Endpoint found -

wcf - Configuring SSL (https) for ws2007FederationHttpBinding Endpoint 404 No Endpoint found - another wif related problem - can point me in direction of how configure https in wcf ws2007federationhttpbinding endpoint. have certificates , bindings set-up in iis, whenever seek connect endpoint 404 error. binding looks this <bindings> <ws2007federationhttpbinding> <binding name="bindingconfigname"> <security mode="transportwithmessagecredential"> <message establishsecuritycontext="false"> <issuermetadata address="https://identity.localhost/issue/wstrust/mex" /> <claimtyperequirements> <add claimtype="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isoptional="true" /> <add claimtype="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" iso...

java - how to pass dynamic parameters to jquery function -

java - how to pass dynamic parameters to jquery function - i want pass dynamic paramters jquery onclick event. before, used html , javascript: class="lang-html prettyprint-override"> <!-- html --> <a id="link123" href="link1" onclick="javascript:func1(${param1},${param2});">123</a> class="lang-js prettyprint-override"> /* javascript */ func1(param1,param2) { // } the parameters param1 , param2 come backend code , dynamic. how not of import here. after using jquery, have html , js: class="lang-html prettyprint-override"> <a href="link123"> <input type="hidden" id="param1" value="${param1}"/> <input type="hidden" id="param2" value="${param2}"/> class="lang-js prettyprint-override"> $(document).ready(function() { $("#link123").click(function() { var param...

c# - Replicating the Win7 network flyout refresh button -

c# - Replicating the Win7 network flyout refresh button - i'm trying create screen similar this: using this tool browse visual style parts , states, found bottom area flyout_linkpanel. but refresh button? can't find buttons have same behaviour; no background until hover. in addition, i've tried looking through dlls in shell32 icons replicating refresh icon – no dice. refresh icon bitmap in explorerframe.dll. i tried giving winspy++ go poke around window, won't work since disappears on disactivation. advice? this looks standard toolstrip 1 refresh button. you can utilize method outlined in c# toolstrip transparent border still visible? create transparent. i did check %systemroot%\system32\shell32.dll , there icon similar may able use. c# winforms windows-7

php - if else shorthand solution -

php - if else shorthand solution - i not sure if next validation can done if shorthand. //if $error set, echo $errro or echo blank string. (isset($error)) ? echo $error:echo ''; i know got wrong, here can help me right code? lot. echo isset($error) ? $error : ''; php if-statement shorthand

html - 100% of content, not of browser height using CSS -

html - 100% of content, not of browser height using CSS - i have min-height 100% div contains content of website: #sitewrap { min-height: 100%; width: 100%; } the above div contains - header, content , footer. what need overlay absolute positioned div on top (with semi-transparent .png background) sits above entire site, 'fading out' slightly. i can't seem absolute div fit 100% of site content. spans 100% of browser height. when scroll downwards bottom section of content below height of browser not spanned div. i have tried div set within sitewrap div won't work: #loginpopup-background { position: absolute; width: 100%; min-height: 100%; height: 100%; z-index: 1100; background-color: #f39c11; } (the background colour testing purposes). any ideas? use position: fixed instead of position: absolute . login still not 100% size of document cover content when scroll. also ie should set top: 0; left: 0 prevent unusual layout errors. ...

Is modular approach in Drupal good for performance? -

Is modular approach in Drupal good for performance? - suppose have create functionalities a, b , c through custom coding in drupal using hooks. either can club 3 of them in custom1.module or can create 3 separate modules them, custom1.module, custom2.module , custom3.module. benefits of creating 3 modules: clean code easily searchable mutually independent easy commit in multi-developer projects cons: every module entry gets stored in database , requires query. to extent mar performance of site? is improve create single big custom module file sake of reducing database queries or break different smaller ones? this issue might negligible little scale websites, allow case big scale performance oriented sites. drupal .module files loaded every page load. there little performance related can gained or lost separating functions different .module files. if not using op code cache, can improved performance creating .inc files , referencing files in menu ite...

cordova - cannot open sqlite database from JavaScript -

cordova - cannot open sqlite database from JavaScript - i'm trying read sqlite database js side created/updated android activity or service. but when phone call window.opendatabase() method message below appear on logcat, , query returns 'no such table' error. physical .db file there , seems accessible within java code, cannot access javascript code. uninstall or clear info , reinstall app did no help this. i have no clue solve error please help & suggestions appreciated. phonegap sqlite error code=14 i/database(2138): sqlite returned: error code = 14, msg = cannot open file @ line 27205 if trying access database created activity javascript code, next thread might reply question: how phone call window.opendatabase webview hosted in android application? sqlite cordova

spring - Tomcat 7 connection pool / JPA : Getting a specific connection -

spring - Tomcat 7 connection pool / JPA : Getting a specific connection - i using jpa tomcat 7 connection pool. how possible specify entitymanager injected (by spring in case) info access object should utilize specific connection pool, not 1 taken @ random? in other words, requirement initialize specific connections in pool (so these connections see database pre-configured in various states), 'label' these connections , entitymanager / transaction utilize connection specific label. i know oracle ucp offers similar functionality, have had issues want same thing tomcat pool. ! spring tomcat jpa jpa-2.0

android - City public transport routes application -

android - City public transport routes application - i've decided create android localization application diploma , i'm thinking functionality. want application store city's public transport routes , draw them on map. i'm kinda new android localization mechanisms , don't now, if it's possible implement. here questions i'd ask: how can store routes? how can draw them? is possible localize route crosses point on map? any links posts, documentation, sources highly appreciated. i've decided create android localization application i fail see how here relates localization term tends used in software development. if have different definition of term in mind, may wish edit question , provide definition. how can store routes? store them in file. in whatever file format them in city (to simplify synchronization) or in converted format (to simplify rendering). how can draw them? you failed indicate using maps. there multipl...

drupal - Add parameter to pager link url -

drupal - Add parameter to pager link url - pager link points www.example.com/node/100?page=1 . need pass addtional parameters through link: www.example.com/node/100?page=1&my_param_1=1&my_param_2=2 . illustration have view pager. want every link in pager point anchor (for illustration quicktabs tab). how can done? you need include 'parameters' in pager theme array: ... ['tablepager'] = array( '#type' => 'markup', '#markup' => theme('pager', array( 'element' => 0, 'parameters' => array( 'name' => 'value' ) )) ), taken from: https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7 drupal drupal-6 pager

JavaScript: RIA toolkit -

JavaScript: RIA toolkit - i'm looking javascript ria toolkit. requirements are: look, free license , sane api. ideas? thats i've found far: extjs pros perfect look lots of widgets support mobile platforms modular system embraces html5 , css3 cons costs money, expensive ($500+) very flat lurning curve. no quickstart guide (but thats doesn't matter because of point #1) qooxdoo cons just ugly. looks survived 90s , didn't alter @ all dojo pros good (not much themes, thundra looks good) free licensing cons too asynchronous (their amd stuff) very unusual , cumbersome api can hardly phone call sane messy docs (i've found out amd #dojo irc channel) sproutcode pros mvc generators docs cons templating don't need didn't find way set in production w/o lots of dependencies still can't figure out how create ria w/o writing own styles , layouting wijmo pros jquery-based cons costs money doesn't have l...

c# - Does RavenDB internally optimise "get document by id" type of queries? -

c# - Does RavenDB internally optimise "get document by id" type of queries? - when performing dynamic query, ravendb typically create temp index. retrieving document id doesn't trigger behaviour: var entity = documentsession.query<entity>().single(x => x.id == 1); does ravendb have built-in optimisation type of query? arnold, no, not optimize behavior. c# ravendb

using in-memory data-structures -

using in-memory data-structures - i have client requirement of not utilize rdbms, instead using in-memory data-structures if server restarted application state revert lastly state saved. i don't have thought of using in-memory info , used work mysql ,but not in memory if please guide me bit , tutorial or something below examples ... public object save(object object, class c) { database.ofy().put(object); homecoming object; } public void delete(long id, class c) { database.ofy().delete(c, id); } public object findbyid(string id, class c) { homecoming database.ofy().find(c, id); } public iterable<object> findall(class c) { iterable<object> models = database.ofy().query(c).fetch(); homecoming models; } } thanks you can utilize sqlite, has hooks lot of languages. the default utilize sqlite file-based, can used in-memory. in-memory-database

naming - Exclamation point in bash function name - should I? -

naming - Exclamation point in bash function name - should I? - i'm writing bash script , it's convenient utilize exclamation point in function name. example: class="lang-bsh prettyprint-override"> function hello! { echo goodbye } function hello { echo hello } and works! after looking through specs, found this: name word consisting solely of letters, numbers, , underscores, , origin letter or underscore. names used shell variable , function names. referred identifier. i sense i'm breaking rules here. wrong? mess in future? what's going on? out of burning curiousity, why much more convenient utilize exclamation point in function name? generally, portability reasons, may not want utilize bang; because interpreter on particular os accepts it, if need deploy script elsewhere, other interpreters of different flavors/versions may not accepting. bash naming

javascript - Changing an html "for" label with java script -

javascript - Changing an html "for" label with java script - i need alter "for" label extension using javascript. unsure how this. give thanks in advance help! <input id="thecheckboxid" type="checkbox" name="thecheckboxname" /> <label for="thecheckbox">the text want change</label> demo first give label id <label id="lbl1" for="thecheckbox">the text want change</label> then do document.getelementbyid("lbl1").setattribute("for", "thecheckboxid"); edit wait, did want alter for value, or alter actual text of label? in event, here's how alter text: if (label.textcontent) label.textcontent = "new text"; else if (label.innertext) label.innertext = "new text" else label.innerhtml = "new text"; javascript

Android app accessing the android dialer -

Android app accessing the android dialer - is possible access dialer of android (mobile phone) android app. if user enters 001 in app next telephone number, app should create dialer of android(mobile phone) dial number after 001...? you can send intent open de phone dialer supplied phonenumber. http://developer.android.com/reference/android/content/intent.html#action_dial string url = "tel:1234"; intent intent = new intent(intent.action_call, uri.parse(url)); don't forget add together permission manifest <uses-permission android:name="android.permission.call_phone"></uses-permission> android

VB.net connection string to sql databse -

VB.net connection string to sql databse - after using next code, no errors shown, database not updated 1 time have made alter using management scheme application. recommendations ? dim constring string = application.startuppath.tostring() + "\mydatabasename.mdf" public c string = "data source=.\sqlexpress;attachdbfilename=" + constring + ";integrated security=true;user instance=true" sub openconnection() conn.connectionstring = c conn.open() end sub use next code: dim constring string = application.startuppath.tostring() + "\mydatabasename.mdf" public c string = "data source=.\sqlexpress;attachdbfilename=" + constring + ";integrated security=true;user instance=true" dim conn new sqlconnection(c) dim comm new sqlcommand dim strquery new string = "sql update query" seek comm.commandtext = strquery comm.connection = conn conn.open() ...

opcode - How are variable length arguments parsed while parsing dalvik instructions? -

opcode - How are variable length arguments parsed while parsing dalvik instructions? - both move va, vb , move-wide va, vb involve same operations , same operands. except opcodes same. in situation need print operands used instructions in application. when see instruction move va, vb should print move va(*contents of va*), vb(*contents of vb*) . this works fine in case of 4-byte registers. when encounter move-wide instructions, should print contents of va , contents of next virtual register., contents of vb , contents of next virtual register. standard way of parsing these? since both dalvik , dx open source, best way reply questions involving dex files inspect source. dx parses instructions in decodedinstruction.java. decodes opcode first, , uses opcode inform decoding rest of instruction. public static decodedinstruction decode(codeinput in) throws eofexception { int opcodeunit = in.read(); int opcode = opcodes.extractopcodefromunit(opcodeunit); inst...

Android, Gridview and Touch and drag events -

Android, Gridview and Touch and drag events - i trying set gridview of images responds ontouch. example, if swipe finger across screen horizontally, vertically or diagonally want buttons touched selected. tried setting ontouchlistener's imageview, didn't work, first imageview in drag event received ontouch events. android gridview android-gridview

android - Error when refreshing View on top of SurfaceView -

android - Error when refreshing View on top of SurfaceView - i met problem when want display normal view object on top surfaceview. problem is: if set visibility of normal view invisible in layout xml file, refreshing of view not right - overlapped area of view , surface view cannot updated. if set visibility of normal view visible in layout xml, there no problem. here test code: package com.test; import java.io.ioexception; import android.app.activity; import android.media.mediaplayer; import android.media.mediaplayer.onpreparedlistener; import android.os.bundle; import android.os.handler; import android.os.message; import android.util.log; import android.view.surfaceholder; import android.view.surfaceholder.callback; import android.view.surfaceview; import android.view.view; import android.widget.linearlayout; public class testactivity extends activity implements callback, onpreparedlistener { private surfaceview msurface1; private surfaceholder msurfaceholder...

python - QGraphicsTextItem RightToLeft text -

python - QGraphicsTextItem RightToLeft text - i have write farsi texts qgraphicstextitem , cant find how can create qgraphicstextitem wirte righttoleft ! can 1 help me ? i tryed way didnt worked me class diagramtextitem(qtgui.qgraphicstextitem): def __init__(self, parent=none, scene=none): super(diagramtextitem, self).__init__(parent, scene) doc =qtgui.qtextdocument ('''شسشس یییییگ''') txtopt = qtgui.qtextoption() txtopt.setalignment(qtcore.qt.alignright) doc.setdefaulttextoption(txtopt) ty it looks utilize qtextoption.settextdirection qt.righttoleft. but note may need set direction before set text: class diagramtextitem(qtgui.qgraphicstextitem): def __init__(self, parent=none, scene=none): super(diagramtextitem, self).__init__(parent, scene) doc = qtgui.qtextdocument() txtopt = qtgui.qtextoption() txtopt.settextdirection(qtcore.qt.righttoleft) ...

.net - Could synchronous garbage collection be the cause of regular spikes in performance? -

.net - Could synchronous garbage collection be the cause of regular spikes in performance? - i testing simple .net webservice hosted in iis. web-service single method performing simple calculation , returning integer. have configured jmeter on separate server test method using 500 threads, each looping 500 times. method hence beingness called 250,000 times , graph throughput , response times. my graphs hence contains 250,000 points showing throughput , response time. however, both throughput , response time graphs show highly regular outliers in dataset. @ regular intervals there brief drop in throughput , corresponding rising in response time. out of 250,000 points on each chart there between 50 , 75 such outliers. although little percentage, , effect on overall performance not issue, understand cause of outliers be. theory far synchronous garbage collection in asp.net causes application pause fraction of sec @ regular intervals. i know whether garbage collector respo...

ios - encoding information in filenames (iPhone/mac) -

ios - encoding information in filenames (iPhone/mac) - i want encode short title in filenames. problem title contain character such colon or slash. there standard encoding typical/appropriate this? edit: clarify, want encode title in such way encoded title used filename. or called percent escaping? the way category on nsurl, utilize nsurl filename in particular directory. 1 time have nsurl, can fetch or save file using url after performing usual checks whether or not file exists , handling cases accordingly. the relevant code snippet is: + (nsurl *)adnurlforfilename:(nsstring *)filename indirectory:(nssearchpathdirectory)searchdirectory { nsstring *percentescapedfilename = [filename stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsfilemanager *filemanager = [[nsfilemanager alloc] init]; nsurl *urlfordirectory = [[filemanager urlsfordirectory:searchdirectory indomains:nsuserdomainmask] objectatindex:0]; homecoming [nsurl urlw...

.net - Allow only one updater to customer in SQL Server 2008 -

.net - Allow only one updater to customer in SQL Server 2008 - i've done searching, haven't found reply sense must mutual situation, , should have "best practice" pattern solution: i have application written in .net 4 (c#) sql server 2008 end. have finish control, , there no outside processes or applications worry about. essentially, want following: allow see customers , orders (returned main search form). as user adds new order or picks order @ or edit, lock placed on entire customer. other users able "read-only" client , orders. when user exits order, lock removed (by exiting screen or logging out of app). also, , may hard part, lock removed if user crashes (perhaps locks have finite time ensure this?). i saw application locks, , transactions, don't know use, each seem have problems. so best practice locking customer, , way other users know client locked user? a manually way adding 2 columns in table: boolean locked ,...

c++ - template specialization implementation -

c++ - template specialization implementation - i have implement template specialization, in implementing constructor specialized template class compiler generates errors. next code: #include <iostream> using namespace std; // class template template <typename t> class mycontainer { t element; public: mycontainer (t arg); t increment () {return ++element;} }; // class template specialization template <> class mycontainer <void> { int element; public: mycontainer (int arg); char uppercase () { homecoming element; } }; template<typename t> mycontainer<t>::mycontainer(t arg){ cout << "hello t" << endl; } template<typename t> mycontainer<void>::mycontainer(int arg){ cout << "hello empty" << endl; } int main () { mycontainer<int> myint (7); mycontainer<void> myvoid (6); cout << myint.increase() << endl; ...

Getting java.io.IOException when running JUnit test case in Eclipse -

Getting java.io.IOException when running JUnit test case in Eclipse - here's code public class jwebunittest extends webtestcase { public jwebunittest(string name) { super(name); } public void setup() { gettestcontext().setbaseurl("http://www.google.com"); } public void testsearch() { beginat("/"); setformelement("q", "httpunit"); submit("btng"); clicklinkwithtext("httpunit"); asserttitleequals("httpunit"); assertlinkpresentwithtext("user's manual"); } } in failure trace, see next error: java.lang.runtimeexception: java.io.ioexception (moving down..) caused by: java.net.socketexception: operation timed out: connect: due invalid address why "http://www.google.com/" invalid address? why getting ioexception? i suggest seek of these options 1.) clean project 1 time . project - c...

android - Disable single user -

android - Disable single user - hiho, there solution disable app 1 single user? there 1 person, buys app every few days utilize app calculations, , deinstalls app within 15 minuts window. over 10 times did , next update want create method, checks user mail service market , if these person, app should close instantly. help alex are sure same user (and not usage trend of 1 refund every few days)? user should able refund app once. according app refund article in android market support: you have 15 minutes time of download homecoming application purchased through android market total refund. may homecoming given application once; if subsequently purchase same app again, may not homecoming sec time. edit: if looks it's same user, please contact android market support , allow them know. follow relevant "contact us" link @ bottom, , include relevant information: app name, user's email address, order id's, etc. abusing refund policy sho...

python - How to have Django return a template but keep executing a process after the template is returned? -

python - How to have Django return a template but keep executing a process after the template is returned? - i'm pretty new web development, i'm trying see if have big image right trying do. forgive me if terminology wrong. django app needs following: user uploads file through browser file processed server (can take hour) user sees results in browser i'm having problem on how accomplish step 2...here thinking: 1.user uploads file (pretty straightforward) 2.file processed - view function go this: def process(request): a. (get file request) b. (return page says "the server running job, results available in {eta}") c. (start processing data) 3.user sees results in browser - browser queries server @ regular intervals see if job done. when job ready, browser gets results. my question is, in step 2 parts b , c, how can homecoming response browser without waiting process finish? or, how can ensure process keeps running after home...

Useragent parsing with Hadoop -

Useragent parsing with Hadoop - i'm looking library help mi extracting features useragents utilize hadoop (pig or hive). i'm interested in mobile users. able extract features like: os version browser version screen size vendor name model name etc ... (features not explicitly given in useragent) i considering using projects wurlf or openddr, provide api can used within hadoop jobs not effective because need of external server serve api. if aware of such project please allow me know, alternatively i'm looking solution how utilize wurlf or openddr hadoop effectively. this bundle contains udf pig may help. https://github.com/tobie/ua-parser parsing hadoop user-agent

c# - HtmlAgilityPack - get all nodes in a document -

c# - HtmlAgilityPack - get all nodes in a document - i traverse nodes in documnet using htmlagilitypack will foreach (htmlnode node in myhtml.documentnode.selectnodes("//@")) do? you can loop through myhtml.documentnode.descendants() . c# xpath html-agility-pack

android - Cannot load tab activity via activity group -

android - Cannot load tab activity via activity group - i'm trying load activity tab via activity grouping activity isn't loading culminates in illegalstateexception error: here re-create of log information: 01-10 11:01:06.201: info/weatherclockwidgetprovider(582): updatetime 01-10 11:01:06.201: info/weatherclockwidgetprovider(582): setcalendarinstance 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): ontimechanged 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): mhour01handindex = 1 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): mhour01handindex = 1 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): mhour01handindex = 0 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): mhour01handindex = 1 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): updatetime id = 3 01-10 11:01:06.211: info/weatherclockwidgetprovider(582): updatecurrenttemperature 01-10 11:01:06.221: info/weatherclockwidgetprovider(582): changeftoc 01-10 11:...

android - can i give OnclickListener and onCreateContextmenu to a single Text view? -

android - can i give OnclickListener and onCreateContextmenu to a single Text view? - thanks in advance.... can 1 knows, have requirement perfrom onclicklistener ans oncreatecontextmenu single text view. possible if yes? can 1 help me out this..... thanks ravi yes can it. before have register textview context menu after can open context menu when click on textview. android

Moved from iis6 to 7.5 asp.net session timeouts -

Moved from iis6 to 7.5 asp.net session timeouts - after moving on new platform site logging people out after time of inactivity. never used happen , wish set timeout larger value. i've changed settings no effect , in code session.timeout set 1440. any ideas can find setting or might start problem. thanks the app pool recycling worker process set expire after 20 minutes of inactivity. asp.net session

iphone - Initialize 2 dim array NSMutableArray -

iphone - Initialize 2 dim array NSMutableArray - for c init array this: nsinteger x[3][10]; works. below have 1 dim array works. move of 2 dim array, how init it? in other words take code below , create work 2 dimensions. nsmutablearray *srdata; srdata = [[nsmutablearray alloc] init]; nsmutabledictionary *srrow; srrow = [[nsmutabledictionary alloc] init]; [srrow setobject:@"read" forkey:@"descr"]; [srrow setobject:@"read2.png" forkey:@"img"]; [srrow setobject:@"read codes" forkey:@"det"]; [srdata addobject:srrow] ; [srrow release]; in objective-c, have have array of arrays sec dimension. knowledge, there no shorthand, you're stuck doing following: nsmutablearray *firstdimension = [[nsmutablearray alloc] init]; (int = 0; < rows; i++) { nsmutablearray *seconddimension = [[nsmutablearray alloc] init]; [firstdimension addobject:seconddimension]; } so add together other ob...

Well-formed XML error when saving the sharepoint custom web part using web services -

Well-formed XML error when saving the sharepoint custom web part using web services - i created custom web part has custom collection property (tabs). web part works when edit , save custom property on edit mode (via browser). want update custom web part using web services,so exported web part , took xml content , passed (so test it), error occured the file imported not valid. verify file web part description file (*.webpart or *.dwp) , contains well-formed xml. i have validated xml using online xml validator , removed statement <?xml version="1.0" encoding="utf-16"?> as 1 causing not well-formex xml according xml validator, still no luck, same error occured. any ideas? not figured out what's wrong xml specially on tabs property. code: string webpartxml = string.empty; string pageurl = currenturl; guid storagekey = new guid(webpartid); using (streamreader sr = new streamreader(@"c:\tab.txt")) ...

rest - Javascript code using xhr is not working? -

rest - Javascript code using xhr is not working? - below response server (as per google chrome rest-client): below code snippet i'm using post info our server. want info xml ouput. keeping in mind concept of same origin policy uploaded piece of code onto our sever html page, not getting response. is there wrong code or approach wrong? <html> <head> <script type="text/javascript"> function gettoken() { var xmlhttp; var txt,x,i; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } alert("stage 1"); xmlhttp.onreadystatechange=function() { alert("stage 2"); if (xmlhttp.readystate==4 && xmlhttp.status==200) { alert("stage 3"); xmldoc=xmlhttp.responsexml; txt=""; x=xmldoc.getelementsbytagname("token"); ...

mobile - paypal chained payment (or adaptive) inside iOS app + server integration -

mobile - paypal chained payment (or adaptive) inside iOS app + server integration - i want implement paypal chained payment (is't 1 of adaptive payment methods) within marketplace iphone app , want server able track payment steps avoid multiple concurrent purchases on same product (it's physical product , can't purchased twice). i read docs paypal adaptive payment flow, mobile integration , ipn server side implementation. now way accomplish seems doing following: when user clicks on pay button, client calls our server create "pending" transaction product. the client calls native paypal sdk nowadays payment view user info returned our server. paypal calls our server notify completed payment , here server completes pending transaction created. paypal calls client notify completed payment , here shown "thank-you" screen. i wouldn't create kind of things these reasons: i have set "lock" on product avoid duplicate purchase:...

Command "timing out" during Sitecore automated item creation -

Command "timing out" during Sitecore automated item creation - i have command i've added "national" node in sitecore editor. command generates list of 50 state nodes beneath it. goes through state nodes (1 @ time) , generates list of local nodes under each state node. within lists of local nodes, iterate through them , check if new item exists - if not, add together (create) kid under local node. ultimately, there 300 local items beingness added during course of study of command. is there more efficient way (fast query 300 local nodes 1 list, check if item exists, , create it)? if so, i'm not sure how that... i'm not sure costly part of operation. ultimately, i'm still doing 300 separate queries check if it's there, followed insert statements, may still take while run. if so, setting in web config increment applicable "timeout" setting in sitecore? sample construction follows: //derive template name of item (page)...

reverse engineering - how to unpack a dll file which is UPX packed but also the headers are changed? -

reverse engineering - how to unpack a dll file which is UPX packed but also the headers are changed? - i have file upx packed. there way can alter headers , still find upx packed? , how unpack ? tried lot of tutorials , fed explain same method doesnt work me. same problem mentioned in next : http://www.reteam.org/board/showthread.php?t=2670 not versed reverse engg.. :( jst noob .. ideas helpful. to find packing, utilize peid, protectionid etc. for correcting headers, need open file in hexeditor , prepare offsets in binary manually. utilize upx.exe file decrypt upx -d reverse-engineering pe packing upx

asp.net - IIS permission/authentication issue -

asp.net - IIS permission/authentication issue - recently reset iis service , project stop working properly. i kept 2 authentication: anonymous authentication , windows authentication. when disable windows, project error access database. (anonymous user can not access) when disable anonymous,project keeps windows name login name. when enableboth, login in ok userid null pages. using system; using system.collections.generic; using system.linq; using system.web; using system.web.security; namespace worldsmart.smart.cardholder.portal.models { public class claimmodel { public static guid getuserid(httpcontextbase context) { guid userid; seek { userid = (guid)membership.getuser().provideruserkey; } grab (exception) { userid = new guid(); } homecoming userid; } } } is there can help me this? because when transfer project machine works, therefore, prob...

scaffolding - rails 3.1 scaffold generator broke for project, just stopped working: no such file to load -- rails_generator (LoadError) -

scaffolding - rails 3.1 scaffold generator broke for project, just stopped working: no such file to load -- rails_generator (LoadError) - solved, see comment below, discovered 'enumerated_attribute' gem breaks rails scaffold my rails 3.1 scaffolding broke project. (scaffolding still works fine in other 3.0 , 3.1 projects-- 1 project has broken scaffold generator!) in rail 3.1 project, have scaffolded multiple models past few days, today out of bluish rails g scaffold mymodel failing error message: /users/johndoe/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': no such file load -- rails_generator (loaderror) i didn't switch rails versions mid-way or anything, project has been rails 3.1.3, , it's been working fine until tried 1 time again today new model. does have thought how prepare and/or might have caused break? (rails g migration works fine... it's scaffolding broken!) ...

Java - static initialization -

Java - static initialization - i have written piece of code : public class child{ int y ; private static final int z = getz(); static { system.out.println("the value of z "+z); } public int getx(){ system.out.println("get x"); homecoming 10; } public int gety(){ kid ch = new child(); system.out.println("get y"); ch.y = getx(); homecoming y; } public static int getz(){ system.out.println("get z"); homecoming new child().gety(); } public child(){ system.out.println("child constructor"); } public static void main(string...args){ kid ch = new child(); system.out.println("the value of z in main "+z); } } and output : get z kid constructor kid constructor y x value of z 0 kid constructor value of z in main 0 can please explain me why value of z 0 , not 10 ? edit:- , got reply first question . still have uncertainty , far know static blocks executed aft...

activerecord - rails 3.1 - has_one, through -

activerecord - rails 3.1 - has_one, through - is possible create has_one relationship work this? i able able load records this: @person = person.find(1) => {person id: 1, favorite_house_id: 10} @person.favorite_house => {house id: 10....) class person < activerecord::base has_many :houses, through: :person_houses has_one :favorite_house, through: :person_houses end class personhouse < activerecord::base belongs_to :house belongs_to :person end class house < activerecord::base has_many :people, through: :person_houses end replace has_one relation of person by: belongs_to :favorite_house, :class_name => "house" do not forget create column favorite_house_id in table of person. ruby-on-rails-3 activerecord

how do i configure my android emulator to start running in intelij? -

how do i configure my android emulator to start running in intelij? - i getting error whenever seek run emulator: failed start emulator: cannot run programme "/home/sypher/android-sdk-linux/tools/emulator": java.io.ioexception: error=2, no such file or directory i had same problem, , harper89 mentioned, found reply in this question. had install ia32-libs package. assuming running distro apt: sudo apt-get install ia32-libs thanks, hertzsprung. android

c# - FormsAuthentication Login refuses to redirect after setting auth ticket -

c# - FormsAuthentication Login refuses to redirect after setting auth ticket - so have login page set own cookie , formsauthenticationticket. however, when take redirect user new homepage after logging in, refuses. redirects right login page no reason. don't understand why. my web.config part of machinekey removed: <authentication mode="forms"> <forms loginurl="~/login.aspx" defaulturl="~/default.aspx" cookieless="usecookies" name=".aspxformsauth" timeout="50" /> </authentication> <authorization> <allow users="*" /> </authorization> <machinekey decryption="aes" validation="sha1" ........ /> my login click event after entering username/pass , authenticating true: if (authenticated) { //create form authentication ticket formsauthenticationticket ticket = new formsauthenticationticket(1, username, datetime.now, dat...

Get extra information from ActiveRecord::RecordNotFound in Rails -

Get extra information from ActiveRecord::RecordNotFound in Rails - i handle recordnotfound error in application_controller.rb follow: rescue_from activerecord::recordnotfound, :with => :record_not_found private def record_not_found flash[:error] = "oops, cannot find record" redirect_to :back end but more information, such class/table name of record not found. how should go it? thank you. say example, begin @user = user.find(params[:id]) rescue activerecord::recordnotfound flash[:notice] = "#no such record in user id :: {params[:id]} on #{action_name}" end update flash[:notice] = t('flash.recordnotfound',:class_name => self.class.name, :column_name => params[:id], :action_name => action_name) now in config/locales/en.yml (this help translate, refer i18n here) flash: recordnotfound: "sorry, no record od %{column_name} in class %{class_name} found on action %{action_name}" ...

oracle - How to generate Multi-row for each row in a table using SQL only -

oracle - How to generate Multi-row for each row in a table using SQL only - possible duplicate: split column multiple rows i have table contains next data:- name --------- mouse,keyboard,screen harddisk,cable processor i need create query retrieve info table follow:- name -------- mouse keyboard screen harddisk cable processor first need split function like: http://blog.logiclabz.com/sql-server/split-function-in-sql-server-to-break-comma-separated-strings-into-table.aspx then can run: select * mytable t cross apply dbo.split(t.name) s and s.items contain want. sql oracle

jquery mobile - Opening dialog programmatically causes pageInit event to fire -

jquery mobile - Opening dialog programmatically causes pageInit event to fire - i'm opening dialog programmatically piece of code: $.mobile.changepage('#about', { transition: 'pop', changehash: false }); #about block on same page: <div id="about" data-role="dialog"> <!-- --> </div> but every time that, pageinit event called, unwanted behavior. is there way around this? i'm not sure mean "which unwanted behavior" if want run code 1 time dialog add together check see if has been initialized yet: $(document).delegate('#about', 'pageinit', function () { if ($(this).hasclass('ui-dialog') === false) { //code in here run 1 time per page load/refresh } }); jquery mobile adds classes each of widgets initializes, can check widgets these classes test if have been initialized yet or not. jquery-mobile

python - Sending 'secure' financial statements on S3 -

python - Sending 'secure' financial statements on S3 - i need provide individuals financial statement, , using s3. far doing making file public-read , creating unique key , using uuid.uuid4() . would acceptable, or how else create more secure? sending authentication keys each individual not option. have considered generating expiring urls files on s3. from boto.s3.connection import s3connection conn = s3connection(aws_access_key_id, aws_secret_access_key, is_secure=false) # generated temp_url remains valid 60 seconds in case temp_url = conn.generate_url(60, 'get', bucket=bucket_name, key=file_name, force_http=true) python security amazon-s3

Unable to debug Silverlight Project -

Unable to debug Silverlight Project - in sharepoint project(solution file) having silverlight project(project a) , class library(project b).in class library have referred silverlight project(project a) in project b. here code in project b <object id="sample_id" data="data:application/x-silverlight-2," type="application/x-silverlight-2" > <param name="source" value="/_layouts/clientbin/sample.xap"> <param name="onerror" value="onsilverlighterror"> <param name="background" value="transparent"> <param name="initparams" value="name=sample"> <param name="iswindowless" value="true"> <param name="minruntimeversion" value="4.0.50826.0"> <param name="autoupgrade...

php - what is the best way to check if string consist of alphanumeric characters only? -

php - what is the best way to check if string consist of alphanumeric characters only? - possible duplicate: php function determine if string consist of alphanumerical characters? i need validate string using php , regexpresisons string can min. 4 chars, 64 , needs aplphanumeric all got far: /^[a-za-z0-9]{4,64}$/ your regex right (assuming want match ascii alphanumerics), you're using incorrectly. check whether string $subject matches regex, use if (preg_match('/^[a-z0-9]{4,64}$/i', $subject)) { # successful match } else { # match effort failed } note /i alternative create regex case-insensitive. if want match other letters/digits, utilize /^[\p{l}\p{n}]{4,64}$/ regex. php regex

.net - RavenDb MapReduce index with three from cases in Map -

.net - RavenDb MapReduce index with three from cases in Map - i have next post entity: public class post { public string id {get;set;} public string text {get;set;} public ilist<vote> votes {get;set;} public ilist<comment> comments {get;set;} } for list of posts need retrieve id, text, rating (sum of votes), commentscount. tried create next mapreduce index: public class postsforlist: abstractindexcreationtask<post, postsforlist.reduceresult> { public class reduceresult { public string id { get; set; } public string text { get; set; } public long rating { get; set; } public long commentscount { get; set; } } public postsforlist() { map = posts => post in posts comment in post.comments vote in post.votes select new { id = po...

c++ - How to wrap with boost-python a virtual class with a method returning a reference -

c++ - How to wrap with boost-python a virtual class with a method returning a reference - i have 2 virtual classes wrap in boost python, want able write python class extends them. thing is, 1 of classes has method homecoming reference of other class, , can't figure how do. here simplified version of code of class wrapped. class foo { public: virtual ~foo() {} virtual int a() = 0; }; class bar { public: virtual ~bar() {} virtual foo const& b() = 0; }; so started wrapping way. class foowrap : public foo, public wrapper<foo> { public: int a() { homecoming this->get_override("a")(); } }; class barwrap : public bar, public wrapper<bar> { public: foo const& b() { homecoming this->get_override("b")(); } }; boost_python_module(foobar) { class_<foowrap, boost::noncopyable>("foo") .def("a", pure_virtual(&foo::a))...

html - css margin/aligning issue -

html - css margin/aligning issue - i'll seek explain best can ;) basically, have sidebar <div id="sidebar"></div> floated leftside , has fixed position. planned have div after contain content, problem that, because sidebar has fixed position div expect after (to right side) appearing behind sidebar. issue, because need utilize margin-left: 310px (310px width of sidebar) create div appear after sidebar, instead of occupying 100% width left on page without sidebar's 310px occupies total page , causes align problems. it's hard explain, if visit page http://freshbeer.lv/development/en/ can see white div, has margin-left: 310px; , width: 100%; within there gray div width:700px; , margin: 0 auto; . expect gray div aligned in middle between 2 images @ background, white div occupying more space needed doesn't happen. suggest solution please? maybe misunderstanding question, in #container can either remove width: 100% or alter w...

Android: Taking a picture using camera intent and saving it to a java.io.File -

Android: Taking a picture using camera intent and saving it to a java.io.File - i'm trying image user , send our server. provide 2 options: choosing gallery or taking new image using default photographic camera in phones. gallery thing works correctly, can photo selected , send without problem. in photographic camera option, photographic camera opens, takes picture, saves on sd card location specified, no problem, when returns application, nullpointerexception , application forced close. here do: private string tempfilepath = ""; ... public void addphotousingcamera() { intent intent = new intent(mediastore.action_image_capture); tempfilepath = getoutputmediafilepath(media_type_image); intent.putextra(mediastore.extra_output, uri.fromfile(new file(tempfilepath))); startactivityforresult(intent, camera_activity_code); } and utilize next photo taken: @override public void onactivityresult(int requestcode, int resultcode, inten...

database - Combine data from multiple Access tables to produce address label, preferring PO box to Physical Address -

database - Combine data from multiple Access tables to produce address label, preferring PO box to Physical Address - i have access 2007 database has 3 tables, each same. each of these tables different telemarketer come in leads. necessary there multiple tables each marketer must treated separate entity. each of these tables has next fields relevant question: poboxnumber poboxsuburb poboxcity poboxpostcode addressbuilding addressstreet addresssuburb addresscity addresspostcode now need create query label printing prefer po box physical address, if po box empty utilize physical. i need displayed as addrline1 addrline2 addrline3 addrline4 addrline5 ie addrline1 if pobox filled po box number, otherwise building... , on. i have tried unions , conditional selects far no avail! how do this? perhaps: select t.poboxnumber addrline1, t.poboxsuburb addrline2, t.poboxcity addrline3, t.poboxpostcode addrline4, "" addrline5 thetable t...

zend framework - APC installation -

zend framework - APC installation - i'm trying install apc on mac. i'm using xampp. ran command /applications/xampp/xamppfiles/bin directory sudo ./pecl install apc --alldeps i got ton of errors. there several yes/no options typed in suggested. not sure i'm doing wrong here utilize advice if there give. i'll post entire installation log. parsepackagename(): invalid bundle name "--alldeps" in "--alldeps" invalid bundle name/package file "--alldeps" downloading apc-3.1.9.tar ... starting download apc-3.1.9.tar (unknown size) .................................................done: 801,792 bytes 54 source files, building running: phpize-5.3.1 grep: /applications/xampp/xamppfiles/include/php/php-5.3.1/php/main/php.h: no such file or directory grep: /applications/xampp/xamppfiles/include/php/php-5.3.1/php/zend/zend_modules.h: no such file or directory grep: /applications/xampp/xamppfiles/include/php/php-5.3.1/php/zend/zend_ex...