Posts

Showing posts from March, 2014

actionscript 3 - AS3 Rasterizing Movie Clip into Sprite for Printing -

actionscript 3 - AS3 Rasterizing Movie Clip into Sprite for Printing - i'm having frustrating issue printing multi-page document. have 1 movieclip on stage (printarea) contains several elements including image loaded using loader component, datagrid component, , other assorted elements. this film clip acts template single page; adjust options, click "add page" , alter 1 time again sec page , on. issue i'm having adding page array looped through later using addpage(). far understand, sprite or film clip best pass addpage. sense it's total overkill duplicate film clip, reinitialize components data, sizing, , positioning set. can't pass movieclip since need several pages modeled 1 instance. there way rasterize film clip pass addpage()? solution i've found, quality of printout miserable: //so let's want add together film clip's current state array : multipages.push(duplicatemc(printarea)); function duplicatemc(mc) { var tempim...

python - Virtualenv : packages lost after restart -

python - Virtualenv : packages lost after restart - this question has reply here: python virtualenv - no module named virtualenvwrapper.hook_loader 5 answers i installed packages using pip on virtualenv , got running @ 1 time : $ sudo apt-get install python-virtualenv $ sudo pip install virtualenvwrapper $ export workon_home=~/projects $ source /usr/local/bin/virtualenvwrapper.s $ mkvirtualenv pa after installed packages, ran perfectly, sat in morning work on these, none of packages there . there wrong doing ? update : this error getting if seek create env : importerror: no module named virtualenvwrapper.hook_loader i think should write export @ .bashrc file, can active when run terminal. in ~/projects file there file holds envs in case export has point file. this .bashrc setting export workon_home=$home/dev/envs # directory envs sour...

How to implement websocket in Dropwizard -

How to implement websocket in Dropwizard - this question has reply here: implementing long polling server using dropwizard 0.7.0 2 answers i have requirement implement websocket dropwizard project. unable find document related it. can 1 point out resources same. i've been dealing same problem, , thought share solution: http://cvwjensen.wordpress.com/2014/08/02/websockets-in-dropwizard/ i utilize atmosphere framework , solution defaults using websockets, can downgrade long-polling if required. that should plenty started... websocket dropwizard

javascript - Highchart y axis min interval -

javascript - Highchart y axis min interval - i show positive, negative spline chart different intervals let positive 0 50 , interval has increment 5 negative 0 1000 interval has increment 100 is there way can in highcharts here series im trying display series: [{ id: 'error1', name: 'errors one', color:'red', data: [5, 3, 4, 7, 2], }, { id: 'errorsone', color: 'red', data: [-222, -234, -123, -189, -289], showinlegend: false }, { id:'error2', name: 'errors two', color:'blue', data: [3, 4, 4, 2, 5], }, { id:'errorstwo', color:'blue', data: [-300, -245, -122, -245, -166], showinlegend: false }] here url jsfiddle thanks you can utilize tickpostions or tickposit...

xml - XSL match node on multiple values -

xml - XSL match node on multiple values - i have xml document looks abit like <a> <somenode att="1"></somenode> </a> <a01> <apple att="2"></apple> <somenode att="1"></somenode> </a01> what im trying match when node name 'a' or followed 1 number (a0) , followed 2 number (a01), ideas on how can ? i have next far <xsl:apply-templates select="node()[starts-with(name(),'a')]"> but select apple aswell, how multiple matches , or/and ? in xslt 2.0 pretty simple: <xsl:apply-templates select="node()[matches(name(),'^a\d?\d?$')]"> in xslt 1.0, regex isn't available, it's little trickier, next should work: <xsl:apply-templates select="node()[starts-with(name(), 'a') , string-length(name()) &lt;= 3 , translate(name(), ...

javascript - image slider code, can anyone elaborate it -

javascript - image slider code, can anyone elaborate it - hi there iam new javascript , wanted imageslider, came across code mentioned below. can explain me, code within **. appreciate it, thanks. var blocks = $(".blocks li"); var image = $(".imageholder li"); var imgholder = $(".imageholder"); var imagew = $(".imageholder li").width(); var speed = 300; blocks.removeclass('selected').first().addclass('selected'); **blocks.click(function() { var target = $(this).index();** **imgholder.animate({"left": "-"+imagew*target+"px"}, speed);** blocks.removeclass('selected'); $(this).addclass('selected'); blocks.click means when click on element li within element class of blocks , execute function in parameters. var target = $(this).index(); means getting number of element, clicking on sec element assign 2 target. imgholder.animate({"left": "-"...

java - How to find an angle from 2 points? -

java - How to find an angle from 2 points? - i have method in java program: public static float findangle(float x1, float y1, float x2, float y2) { float deltax = math.abs(x1 - x2); float deltay = math.abs(y1 - y2); homecoming (float)(math.atan2(deltay, deltax) * 180 / math.pi); } i got googling issue. however, when set practice, splits 1-180, , after 180 goes 1. how prepare this? don't phone call math.abs . negative numbers , positive numbers give different results, want preserve sign of deltax , deltay . java math

Upload image to existing folder PHP -

Upload image to existing folder PHP - <?php include('includes/db.php'); $drinks_cat = $_post['drinks_cat']; $drinks_name = $_post['drinks_name']; $drinks_shot = $_post['drinks_shot']; $drinks_bottle = $_post['drinks_bottle']; $drinks_availability = 'available'; $msg = "error: "; $itemimageload="true"; $itemimage_size=$_files['image']['size']; $iname = $_files['image']['name']; if ($_files['image']['size']>250000){$msg=$msg."your uploaded file size more 250kb please cut down file size , upload.<br>"; $itemimageload="false";} if (!($_files['image']['type'] =="image/jpeg" or $_files['image']['type'] =="image/gif" or $_files['image']['type'] =="image/png")) {$msg=$msg."your uploaded file must of jpg , png or gif. other file types not allowed<br>...

Excel Conditional Formatting Loop -

Excel Conditional Formatting Loop - i have code: selection.formatconditions.add type:=xlexpression, formula1:= _ "=if($b5=""arc"",1,0)" selection.formatconditions(selection.formatconditions.count).setfirstpriority selection.formatconditions(1).interior .patterncolorindex = xlautomatic .color = colorsheet.range("arc_color").interior.color .tintandshade = 0 end selection.formatconditions(1).stopiftrue = false selection.formatconditions.add type:=xlexpression, formula1:= _ "=if($b5=""all"",1,0)" selection.formatconditions(selection.formatconditions.count).setfirstpriority selection.formatconditions(1).interior .patterncolorindex = xlautomatic .color = colorsheet.range("all_color").interior.color .tintandshade = 0 end selection.formatconditions(1).stopiftrue = false there more blocks , changes named ranges referenced within conditional formatting conditions. =if(...

java - How to save your high-score -

java - How to save your high-score - i want save best, 1 high-score file, , if game on show on menu screen. like this: best: points. i have points , count until die, don't know how save them. heard share preferences. can give me example, best way it. have code checking if points isn't improve best high-score, don't know how save them properly. advise or help appreciated! here's quick sample, assuming want store , load preferences activity . to store values in preferences: sharedpreferences sharedpreferences = getpreferences(mode_private); sharedpreferences.editor editor = sharedpreferences.edit(); editor.putint("best_score", numberofpoints); editor.commit(); to load value: sharedpreferences sharedpreferences = getpreferences(mode_private); if (sharedpreferences.contains("best_score")) { // have high score saved, load it... int numberofpoints = sharedpreferences.getint("best_score", -1); // here ...

sql server - SQL Table not locked even using tablock & holdlock -

sql server - SQL Table not locked even using tablock & holdlock - i using sql lock on table. here query: set transaction isolation level serializable go begin transaction select * emp waitfor delay '00:00:40' rollback transaction now, when seek access table 'emp' somewhere else (by opening query analyzer , firing select query on emp table), still data. should not homecoming data, table locked 40 seconds. note: i'd tried "with (tablock,holdlock)" , still not working. how can create table inaccessible 40 seconds??? i had got answer set transaction isolation level serializable go begin transaction select * emp (tablockx,holdlock) waitfor delay '00:00:40' rollback transaction it locks table, no 1 else can access thenafter 40 seconds. sql sql-server database

Css menu instead of flash if viewer is unable to use flash -

Css menu instead of flash if viewer is unable to use flash - i have nice flash menu on website: http://www.teachertrainer.info know of customers unable see menu if lack flash. instead prompted download it. might turn them off want able give them css equivalent. if insert link local css menu file run if didn't have flash. great. know don't have room code embed flash menu can see if @ page source of webpage. thanks, paul css

servlets - java.lang.OutOfMemoryError: -

servlets - java.lang.OutOfMemoryError: - i'm trying create video files bytes retrieved database. programme worked before few hours. after uploading big file, when seek retrieve it, producing error java.lang.outofmemoryerror: my code is: conn = prepareconnection(); stringbuilder sb=new stringbuilder(1024); sb.append("select videoname,videoid,videofull ").append(uname.trim()).append("video"); string sql=sb.tostring(); stmt = conn.preparestatement(sql); resultset rs = stmt.executequery(); while(rs.next()){ byte[] videodata = rs.getbytes("videofull"); //#57 int vid=rs.getint("videoid"); stringbuilder sb1 = new stringbuilder(); sb1.append(vid); string videoid=sb1.tostring(); string vname=rs.getstring("videoname"); file file=new file("c:/users/jamespj/documents/skypark/skypark/webcontent/sp/resources/videos/"+vname+...

How do I read the file content from the Internal storage -Android APP -

How do I read the file content from the Internal storage -Android APP - iam newbie- working android, file created in location data/data/myapp/files/hello.txt the content of file :"hello" take how utilize storages in android http://developer.android.com/guide/topics/data/data-storage.html#filesinternal to read info internal storage need app files folder , read content here string yourfilepath = context.getfilesdir() + "/" + "hello.txt"; file yourfile = new file( yourfilepath ); also can utilize approach fileinputstream fis = context.openfileinput("hello.txt", context.mode_private); inputstreamreader isr = new inputstreamreader(fis); bufferedreader bufferedreader = new bufferedreader(isr); stringbuilder sb = new stringbuilder(); string line; while ((line = bufferedreader.readline()) != null) { sb.append(line); } android internal

php - How to display title of page in body content under h1 tag -

php - How to display title of page in body content under h1 tag - i have used rsseo plugin optimizing joomla site, want h1 tag in custom components , pages similar page title. tried below <h1> <script type="text/javascript"> <!-- document.write(document.title); //--> </script></h1> the above script able display h1 tag, when checks source code not seo friendly display script i think need server side php code, have tried using <h1><?php echo $pagetitle ?></h1> but above not displaying value. leading blank h1 tags can suggest , advise pls effectively thanks try this: html: <h1 id="pagetitle"></h1> javascript: document.getelementbyid('pagetitle').innerhtml = document.title; if want script inline: <h1 id="pagetitle"></h1> <script> document.getelementbyid('pagetitle').innerhtml = document.title; </script...

ctree plot decision tree in party package in R , terminal node occurs some weird numbers - issue? -

ctree plot decision tree in party package in R , terminal node occurs some weird numbers - issue? - i came across odd.. , couldn't figured out why.. i utilize same code here below : library(party) r_tree <- ctree(readingskills$nativespeaker ~ readingskills$age + readingskills$shoesize + readingskills$shoesize + readingskills$score,data = readingskills) plot(r_tree,type = "simple") r_tree two week ago got normal graph .. today terminal nodes have odd numbers in them showing in image below.. have tried restarted pc , uninstalled packet , reinstall 1 time again , 1 time again , still not working.. wondering if see same issue , or have done wrong , or how can prepare ? thanks this bug caused bundle "partykit". if you'll reopen r start or do: detach("package:partykit", unload=true) , run library(party) r_tree <- ctree(readingskills$nativespeaker ~ readingskills$age + ...

ini4j reading registry values causes Java to crash -

ini4j reading registry values causes Java to crash - i have couple of methods i've written here read values registry , populate text fields in swing gui. here first method: public void loadregvalues() throws ioexception { scripts sc = new scripts(); //set configuration tab come forwards settabfolderselection(1); //set prebackup first selected tab setconfigtabfolderselection(0); // [global] setclientnametext(sc.readvaluefromreg("[global]", "clientname")); // [prebackup] boolean prebackupboolean = boolean.valueof(sc.readvaluefromreg("[prebackup]", "prebackup-enabled")); setprebackupenabledselection(prebackupboolean); // [openvpn] setovpnprofiletext(sc.readvaluefromreg("[openvpn]", "ovpnprofilename")); setopenvpngatewayiptext(sc.readvaluefromreg("[openvpn]", "remotegatewayip")); // [network drive] setnetworkdrivelet...

linux - allow php rwx on created dir using mkdir() -

linux - allow php rwx on created dir using mkdir() - when ever user "apache" creates directory, cannot add together new files onto via php upload, have alter folder's permissions work. how ensure when user uploads file , folder created automatically php, file added onto folder after creation, without giving me unwrittable folder error? try following: mkdir($newdirectory); chmod($newdirectory, 0777); php linux

How to feed a DB PostgreSQL/PostGIS through data that are in Informix DB? -

How to feed a DB PostgreSQL/PostGIS through data that are in Informix DB? - i not have much experience in postgresql clues on how following: i intend feed db postgresql/postgis through info in informix db, have access via odbc. in short, intend "select" in informix db , able import info straight db postgresql/postgis. from understood seems possible via dblink. so? can detailed info process? i suggest dump info whatever db have in text format csv, utilize re-create command load info postgresql. postgresql

android - Storing dates-time scales in a SQLite database table but in only one row -

android - Storing dates-time scales in a SQLite database table but in only one row - i'm trying 1 patient programme veterinary use. i'm creating sqlite database table includes patient name, owner name, address etc. table should include when patient should made check-up, when should vaccinated, when take surgery.(we can time scale)... name, address etc unique data's; there 1 name, 1 address. "time scale" not unique. store not 1 data. can now? should made new database table every patient store these time scales? or should store more 1 info within 1 database row using string arrays or else? think best selection storing new database within database table row possible? help great. thanks. why not this: user_schedule ------------- create table user_schedule ( user_id integer, event_type text, event_date text // because it's sqlite ) this way every user can have n number of events , can give each event name query like, "give ...

javascript - IE 9 - Object doesn't support property or method 'Format' -

javascript - IE 9 - Object doesn't support property or method 'Format' - need little help here. i decided transfer of javascript function in 1 .js file. functions working in other browser except ie. note: code below store in separate js file "my_js.js" var dialogconfirmed = false; function dialogconfirmation(obj, title, dialogtext) { if (!dialogconfirmed) { $('body').append("<div id='dialog' title='" + title + "'>'" + dialogtext + "'</div>"); $('#dialog').dialog ({ height: 150, modal: true, resizable: false, draggable: false, close: function(event, ui) { $('body').find('#dialog').remove(); }, buttons: { 'yes': function() { $(this).dialog('close'); dialogconfirme...

ruby on rails - rspec not saving to database -

ruby on rails - rspec not saving to database - i'm trying test login method below, not seem saving data_provider_user database. i've checked using debugger , works until leaves method , goes rspec code, shown below. i've checked see if object valid after save using .valid? , i'm bit lost! def login require 'twitteroauth' @data_provider_user = dataprovideruser.find(params[:id]) if @data_provider_user.twitter? @request_token = twitteroauth.request_url @data_provider_user.access_token = @request_token.token @data_provider_user.oauth_token_secret = @request_token.secret if @data_provider_user.save debugger redirect_to @request_token.authorize_url end end end test: it "should update tokens" require 'twitteroauth' twitteroauth.stub(:request_url).and_return(@token) debugger :login, {id: @data_provider_user.id} debugger @data_provider_user.access_token.should_not eq(...

google chrome extension - onBeforeNavigate returns tabId which doesn't exist -

google chrome extension - onBeforeNavigate returns tabId which doesn't exist - i'm trying create theses line work: chrome.webnavigation.onbeforenavigate.addlistener(function(details) { chrome.tabs.update(details.tabid, {url: "http://www.google.com"}, function() {}); }, {url: [{hostequals: 'yahoo.com'}]}); sometimes, error: error during tabs.update: no tab id: 294. strange, have reason that? thanks in advance help it seems onbeforenavigate works autocomplete url prefetch maybe ... using onbeforenavigate instead of onbeforenavigate removes bug! google-chrome-extension

xml - How do I save settings data in processing then load it in later for use -

xml - How do I save settings data in processing then load it in later for use - i'm using processing , controlp5 project. have number of fields user fils out. when user done, way save info setting file, preferably json, xml or plist file, can loaded in @ later time. best way go doing this. for offline use, should able savestrings() , loadstrings(). long have written settings object has tostring() function, , constructor can build kind of string (so t.equals(new thing(t.tostring()) true) can write , read serialized version disk. xml save processing

Rails I18n not working properly on Heroku -

Rails I18n not working properly on Heroku - i18n works expected locally not on heroku. shows english language if browser set pt-br. set locale in before filter: class applicationcontroller < actioncontroller::base before_filter :set_locale private def set_locale i18n.set_preferred_locale(env.http_accept_language) end end module i18n class << self def set_preferred_locale(http_accept_language) locale = http_accept_language.preferred_language_from(i18n.available_locales) if locale.present? i18n.locale = locale i18n.default_locale = locale #added based on stackflow reply heroku , i18n end end end end i have confirmed through logger i18n.locale has right value (pt-br) in views translations still coming in english. i have tried test setting straight 'pt-br' , still same result: class applicationcontroller < actioncontroller::base before_filter :set_locale private def set_lo...

checkbox - Sub selecting (checking) checkboxes that have a specified tag in Jquery -

checkbox - Sub selecting (checking) checkboxes that have a specified tag in Jquery - i have tricky jquery question; want able select childs of specific checkbox when has span class identer , content '-- ' in illustration below; want when check 'alarme' both 'alarmes domestiques' , 'contrôle d'accès' checked; reverse action when unselect it. must damn easy i'm not jquery expert. thanks ! i have next code : <tbody> <tr class="odd"> <td> <div class="form-item-2-0-checkboxes-1--1"> <input type="checkbox" name="2[0][checkboxes][1][-1]" value="1"> </div> </td> <td> <span class="indenter"></span> <a href="/taxonomy/term/1" class="depth-0">alarmes</a> </td> </tr> <tr class="even"> <td> ...

scala - Does accessing type of a lazy val cause it to be evaluated? -

scala - Does accessing type of a lazy val cause it to be evaluated? - as question title states, accessing type of lazy val fellow member result in evaluation of member? or utilize static type? here illustration code in have implicit lazy val , , utilize type in method take implicit val type: implicit lazy val nonspaces: array[(point, part)] ... def randomnonspacecoordinate(implicit nonspaces: this.nonspaces.type): point = nonspaces(utils.random.randupto(nonspaces.length))._1 let's check out: scala> object test { | lazy val test: string = {println("bang!"); "value"} | val p: this.test.type = null | def testdef(p: this.test.type) = println(p) | } defined module test scala> test.testdef(test.p) null scala> test.testdef(test.test) bang! value so can see accessing type not require lazy val evaluated. scala types lazy-evaluation

linux - How do i start to learn asm (gas)? -

linux - How do i start to learn asm (gas)? - i found "hello world" , wrote it. nano hello.s this code .data msg: .string "hello, world!\n" len = . - msg .text global _start _start: movl $len,%edx movl $msg,%ecx movl $1,%ebx movl $4,%eax int $0x80 movl $0,%ebx movl $1,%eax int $0x80 i've done as -o hello.o hello.s i've given error hello.s:6: error: no such instruction: global _start delete global _start. i've done ld -s -o hello.o hello* error ld: hello: no such file: no such file or directory where mistaking? p/s debian, amd64. try .globl _start or .global _start . you may seek ununderscored start in case run problem entry point. finally, if you're making 64-bit executable, need utilize different scheme phone call interface, not int 0x80 syscall . more on here. linux assembly x86-64 gas

java - select odd/even elements of array using recursion -

java - select odd/even elements of array using recursion - am working on programming homework , bit lost. project select even/odd elements of listarray , store in array. not numbers in each element, elements if array had values "1,2,5,7,9" , returned elements give "1, 5, 9". have utilize recursion. able give me starting point or advice. though starting 2 elements , taking 2nd element , building that, don't know how add together on 2nd pass public static arraylist<integer> even(arraylist<integer> list) arraylist<integer> evenlist = listmethods.deepclone(tlist);//make re-create of list if (evenlist.size()<=1) // list empty or has 1 element { // homecoming null;// homecoming list } if (evenlist.size()==2) { //return right element //call method 1 time again //add list } this sounds similar homework completed, if (and you're in class!), i'll not tell utilize terminology haven't covered know ...

seo - Remove subdomain from google and yahoo -

seo - Remove subdomain from google and yahoo - if have subdomain named abc.aaa.com and have move aaa.com/abc more server admin has help me create redirect on abc.aaa.com aaa.com/abc so no matter access page/section/file in abc.aaa.com forcefulness home page of aaa.com/abc therefore cant utilize robots.txt disallow subdomain and cant submit both yahoo , google webmaster any idea? redirecting subdomain right course of study of action. don't want utilize robots.txt. if did, googlebot couldn't crawl anymore , see resides in new home. your redirect sounds problematic though. should not redirecting home page. should redirecting each document new location of document. when redirect home page, google considers redirect same 404. phone call "soft 404". redirecting homepage lose search engine rankings pages have , lose credit have inbound links coming sub-domain. having implemented redirect without robots.txt, both google , yahoo pick o...

c# - How create directory on my local machine -

c# - How create directory on my local machine - i love inquire ,what wrong th next code ,because i've been trying create folder on local machine not work according expectactions. gives me error saying : access path 'c:\inetpub\wwwroot//printlabels/' denied code: directory.createdirectory(apppath + "//printlabels/"); if using windows vista or above, first close visual studio, right-click icon , select run administrator option. when execute code, should stop giving access denied exception. c#

proxy - Make one server use another server to get access to the web -

proxy - Make one server use another server to get access to the web - i have next question. have 2 servers running centos 6.2. let's name them , b. our network constructed in such way, server has access net via proxy. can access proxy. however, server b may access server in way possible, not proxy directly. therefore, there way configure both servers server b utilize server in order retrieve net required packages. more specifically, server uses cntlm access proxy (since proxy in windows domain). need configure yum @ server b able download remote repositories, , should done via server a, since cannot access straight proxy in windows domain itself. how achieved? it sounds want set proxy. servera proxy requests serverb serverb's traffic must go through servera (somehow). this article explains it: http://www.faqs.org/docs/linux-mini/transparentproxy.html#ss6.1 proxy yum

javascript - How to reload correctly a route in Ember JS -

javascript - How to reload correctly a route in Ember JS - i'm working latest release of ember js (rc1), , have architectural problem : i have simple utilize case : list of users, , form add together users. router: app.router.map(function () { this.resource('users', function () { this.route('new'); }); }); my routes: app.usersroute = em.route.extend({ model:function () { homecoming app.user.findall(); } }); my controller: app.usersnewcontroller = em.objectcontroller.extend({ saveuser:function () { //'content' contains user app.user.save(this.content); // here want reload list of users, doesn't work // application goes correctly url /users // doesn't phone call 'model' function this.transitiontoroute('users'); } }); as in above comment, when create new user, i'd redirect list of users (that part works) , reload u...

java - Get the full path of a file at change set -

java - Get the full path of a file at change set - i searching .txt file located @ alter set. need create locally on pc total path directory of file. for illustration if there file called"test.txt" it's located at: project1-->folder1-->folder2-->test.txt till have managed search file. need fetch total directory , create similar 1 on pc: result @ pc: folder1-->folder2-->test.txt that's did search file within changeset , retrieve it: public ifileitem gettextfilefile(ichangeset changeset, iteamrepository repository) throws teamrepositoryexception{ iversionablemanager vm = scmplatform.getworkspacemanager(repository).versionablemanager(); list changes = changeset.changes(); ifileitem toreturn = null; for(int i=0;i<changes.size();i++) {="" <br=""> alter change = (change) changes.get(i); iversionablehandle after = change.afterstate(); if( after != null && afte...

box api - Box API Automatic Login for Authentication -

box api - Box API Automatic Login for Authentication - this question asked here op never responded comment left , hence left unanswered. i'm looking sign specific box business relationship via api , hoping there's way automatically set login , password instead of asking users theirs. i'm coding app in php , far i'm using basic oauth2 process asks user login (/auth/ticket&api_key). far suggestions i've found requires saving files local storage that's not alternative need app users little work possible in. need tweak authentication process. suggestions?? thanks! this reply got box api technical support: unfortunately, there's no way @ point. have go through web based login authenticate, 1 time authenticate first time, can automate refresh token won't have again. apologize , allow me know if have anymore questions this. api box-api

android - OnDetach/onAttach fragment recreate fragment activity -

android - OnDetach/onAttach fragment recreate fragment activity - i want detach/attach fragments, how set, fragment not recreate, after attach. in fragment have webview; when select , unselect tabs, webview load startpage. there code: public class mainactivity extends activity implements onclicklistener, onmenuitemclicklistener { actionbar bar; view v; public static textview tilt; layoutinflater inflater; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); setrequestedorientation(activityinfo.screen_orientation_landscape); onaddtab(); view v=getlayoutinflater().inflate(r.layout.action_bar, null); imagebutton im = (imagebutton)v.findviewbyid(r.id.tab_toggle); im.setonclicklistener(this); getactionbar().setbackgrounddrawable(getresources().getdrawable(r.drawable.shape_layout)); getactionbar().s...

facebook graph api - Error when posting achievements with user messages -

facebook graph api - Error when posting achievements with user messages - when posting achievement user message gives next error: {"error":{"message":"(#100) haven't enabled user messages action type (127701393971353) yet. please update open graph settings in app dashboard","type":"oauthexception","code":100}} no clue enable that. managed access setting modifying url manually id. https://developers.facebook.com/apps/your_app_id_here/opengraph/action_type/127701393971353/ facebook-graph-api achievements

runtime error - Python, several callings of function containing recursions cause "RuntimeError: maximum recursion depth exceeded" -

runtime error - Python, several callings of function containing recursions cause "RuntimeError: maximum recursion depth exceeded" - i taking online course of study in coursera "algorithms: design , analysis, part 1", , completed sec homework. during doing it, cannot explain phenomenon caused python runtime error. i not supposed distribute solution code... write excerpts. def quick_sort_count (arr, index, median=false): # operations ...... # termination if len(arr)==0 or len(arr)==1: homecoming arr, 0 ........ arr[:i-1], t1 = quick_sort_count(arr[:i-1], index, median) arr[i:], t2 = quick_sort_count(arr[i:], index, median) homecoming arr, len(arr)+t1+t2-1 the programme should analyze info file 10,000 unique number , calculate how many "comparisons" there in quicksort. question contains 3 part: using 1st element pivot of comparison; using lastly one; , using "median" one. the we...

android - LibGDX Saving textures to avoid context loss -

android - LibGDX Saving textures to avoid context loss - i have texture in libgdx based android app created procedurally through framebuffers need preserve through context loss, , seems efficient way save data, whether total image or raw data, out, , load in when time comes. i'm struggling find way accomplish though, every route i've taken has lead finish failure in 1 way or another. i've searched around quite bit, nil i've come across has worked out. looking hint right direction, rather aimless searching , attempts have been doing far. assume best thing convert of info texture "buffer" of sort, save info internally, , reload , recreate texture, i'm not sure best way go doing is. the pixmapio class supposed help writing run-time generated pixmap out. not quite you're looking fbo texture, though. (its easy go pixmap texture , not easy go other way.) if primitives utilize generate info in fbo available on pixmap (e.g., b...

javascript test method not working as expected -

javascript test method not working as expected - i have conditional logic based on os version no. in browser useragent string. here code tried. var useragent = "linux; u; android 2.2.1; en-gb; htc_desirez_a7272 build/frg83d"; if((/2.3/).test(useragent)){ alert("2"); } else if((/3./).test(useragent)){ alert("3"); } else if((/4./).test(useragent)){ alert("4"); } else { alert("5"); } i alert 3 . i tried replacing test method indexof , alert 5 . can explain why (/3./).test(useragent) returns true? you because regex /3./ means - match 3 , symbol behind it. have escape . . for illustration seek /3\./ , , respectively others: /2\.3/ , /4\./ . your code should that: var useragent = "linux; u; android 2.2.1; en-gb; htc_desirez_a7272 build/frg83d"; if ((/android 2\./).test(useragent)){ alert("2"); } else if((/android 3\./).test(useragent)){ alert("3"); } else...

Run command while key is held down in bash script -

Run command while key is held down in bash script - i'm trying write bash script plays tone while key held down. here's have far: https://github.com/thelazymastermind/pcspkr_keyboard/blob/master/keyboard.sh it works, note can't played continously while key held down. if can't done in bash, how can done c or python? look projects at: http://www.shellscriptgames.com/ they utilize getch.c in order key input user... seems pure shell doesn't provide need. bash

ant - SONAR - java.lang.IllegalStateException: Infinite loop in property interpolation of ${SQLSCRIPT}: SQLSCRIPT -

ant - SONAR - java.lang.IllegalStateException: Infinite loop in property interpolation of ${SQLSCRIPT}: SQLSCRIPT - i have simple sonar configuration ant task: <target name="upload_to_sonar"> <property name="sonar.jdbc.url" value="jdbc:oracle:thin:@server:1521:sid"/> <property name="sonar.host.url" value="http://sonar:80"/> <property name="sonar.jdbc.username" value="sonar"/> <property name="sonar.jdbc.password" value="sonar"/> <property name="sonar.projectkey" value="test"/> <property name="sonar.projectname" value="test"/> <property name="sonar.projectversion" value="trunk"/> <property name="sonar.language" value="java"/> <property name="sonar.sources" value="sources_for_sonar"/> <property name="sonar.b...

Make django url tag fail silently -

Make django url tag fail silently - the django {% url %} templatetag raises noreversematch error when can't reverse provided url. useful in development, in production, stops user dead in tracks ugly 500 error, blocking whole page, , leading them think our site broken. template developers shouldn't able bring downwards whole site typo. want transparently override behavior that, in production only, if reverse match can't found, outputs default url, "#", , reports error our exception tracking scheme in background, still lets user go on doing without raising 500 error. is there way replace default {% url %} tag own safer version, transparently? don't want have add together {% load my_custom_url_tag %} @ top of every single template on site, because @ point people forget, , behavior of tag otherwise same, difference how handles errors. you can utilize built-in url tag in silent mode, seek lookup, , utilize url finds—if finds something. ...

PHP: while (time() < time()+2;){ echo "why does this not work ?"}; -

PHP: while (time() < time()+2;){ echo "why does this not work ?"}; - $zeit = time(); $zeit60 = time()+2; while ($zeit < $zeit60){ sleep (1); echo time(); } why not work ? thanks answers! your code print time every second... forever. because status while x < x+2 , of course of study true ∀ x ∈ ℝ you should update value of $zeit , after time expires loop exit. that said, unless have particularly complex code, may sufficient following: $seconds = 2; while($seconds) { sleep(1); echo time(); $seconds--; } php time while-loop

How do I duplicate an xcode project without red text? -

How do I duplicate an xcode project without red text? - i have duplicated xcode project create project 80% of same coding there files on left in reddish text. mean , how prepare it? the files displayed in reddish missing directory project located. in other words, exist in project, not @ expected location on disk. the solution, since said projects aren't identical (80% overlap), delete reddish files project if don't need them. alternatively, providing xcode re-create of missing file in appropriate spot alter color black. xcode

java - Running code before and after all tests in a surefire execution -

java - Running code before and after all tests in a surefire execution - i have grizzly httpserver want run entire duration of test grouping execution. additionally, want interact global httpserver instance @rule within tests themselves. since i'm using maven surefire rather using junit test suites, can't utilize @beforeclass / @afterclass on test suite itself. right now, can think of lazily initialising static field , stopping server runtime.addshutdownhook() -- not nice! there 2 options, maven solution , surefire solution. to the lowest degree coupled solution execute plugin in pre-integration-test , post-integration-test phase. see introduction build lifecycle - lifecycle reference. i'm not familiar grizzly, here illustration using jetty: <build> <plugins> <plugin> <groupid>org.mortbay.jetty</groupid> <artifactid>maven-jetty-plugin</artifactid> <configuration> <contex...

JavaFX Scene Builder and fx:include -

JavaFX Scene Builder and fx:include - i wondering how 1 can utilize fx:include in conjunction javafx scene builder, therefore: imagine have borderpane (file borderpane.fxml ). in center section want set label shall defined in separate fxml file, e.g. label.fxml . first problem of this: label.fxml integrated container (the borderpane) doesn't need 1 itself. scenebuilder offers alternative create layouts beingness container? second problem: can create label.fxml manually , adapt borderpane.fxml manually include label.fxml . can load borderpane.fxml file using scenebuilder without problems. when alter text of label , take "save", not label.fxml modified, instead borderpane.fxml modified this: # borderpane.fxml <fx:include source="label.fxml" text="the new label text" /> the new label text should written label.fxml , not borderpane.fxml , done. am doing wrong? is scenebuilder not intended used in conjunction fx:in...

url - How can I get query string values in JavaScript? -

url - How can I get query string values in JavaScript? - is there plugin-less way of retrieving query string values via jquery (or without)? if so, how? if not, there plugin can so? you don't need jquery purpose. can utilize pure javascript: function getparameterbyname(name, url) { if (!url) url = window.location.href; url = url.tolowercase(); // avoid case sensitiveness name = name.replace(/[\[\]]/g, "\\$&").tolowercase();// avoid case sensitiveness query parameter name var regex = new regexp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) homecoming null; if (!results[2]) homecoming ''; homecoming decodeuricomponent(results[2].replace(/\+/g, " ")); } usage: // query string: ?foo=lorem&bar=&baz var foo = getparameterbyname('foo'); // "lorem" var bar = getparameterbyname('bar'); // "...

html - How to provide multiple levels of support in css with progressive enhancement -

html - How to provide multiple levels of support in css with progressive enhancement - recently finished reading designing progressive enhancement filament group. in book talk providing 2 levels of back upwards based on testing browser features. if browser passes tests gets enhanced experience built on top of basic. if browser fails, gets basic experience. on paper makes perfect sense , drives home how websites should built. after finished book looked @ enhance.js script go on in book tests browser features (https://github.com/filamentgroup/enhancejs , new version since book https://github.com/filamentgroup/enhance). in script, there isn't way test specific css features expected. sure, you're able test box-model support, if layout relies on display: table? there testing features this? practical so? modernizr popular library provides similar capability testing. there wide selection of pre-built tests can selected on download page, including 1 test display: table ...

polymorphism - Does a member of a C++ base class really needs to be virtual to be overridden by a derived class? -

polymorphism - Does a member of a C++ base class really needs to be virtual to be overridden by a derived class? - class { public: virtual int test()=0; }; class b : public { public: int test(){return 10;} }; b *b = new b(); b->test(); // homecoming 10; whereas: class { public: int test(){return 0;} }; class b : public { public: int test(){return 10;} }; b *b = new b(); b->test(); // **would homecoming 0**; why homecoming "0" here? makes 0 sense me, because assume (kind of overloaded) members of derived class (b) come first! happening here? apart invalid syntax ( b->test(); should b->test(); ), sec 1 homecoming 10. if instead have written: a* = new b(); a->test(); it have returned 0 or 10 depending on whether a::test virtual. c++ polymorphism virtual members

javascript - How to display a Web Page's Stylesheet -

javascript - How to display a Web Page's Stylesheet - is there way display total css stylesheet of web page, other fetching every style each element this: document.write("width:"+document.getelementbyid("to").style.width+";"); the css can in external file, or within <style> tag. you can utilize document.stylesheets like in document.stylesheets[0].cssrules[0].csstext javascript html css stylesheet

google chrome - Loading internal files over ssl/https -

google chrome - Loading internal files over ssl/https - i having serious issue.. trying load page on https , fails. chrome says 'the page @ ... ran insecure content http:www.mysite...' firefox doesn't give error issue if forcefulness https on page.. css/js/images including in page loading on http reason.. when run on local version (my machine) , create page https.. includes css/js/images on https well.. when same on live site.. doesn't utilize https , hence erros.. all includes relative , not including file using http:// i totally lost.. help appreciated. i had same issue, able solve first testing connection (if secure or not): $protocol = 'http://'; if (!empty($_server['https'])) { $protocol = 'https://'; } and before every include add together instead of protocol: <script type="text/javascript" src="<?php echo $protocol; ?>url.com/jquery-1.7.1.min.js"></script> http...

asp.net mvc - passing user input in url -

asp.net mvc - passing user input in url - i need pass user inputs url. coursecontroller action is: public actionresult parameter(datetime start, datetime end) { //some operations homecoming view(); } i start , end time user in view. want see url this: course/parameter/start=userinput && end=userinput help appreciated. my model is: public class machinesql{ public list<machines> sqlaccessparameter(datetime startdate, datetime enddate) { sqlconnection myconnection = new sqlconnection(connstr); myconnection.open(); sqlcommand mycommand = new sqlcommand("daterange",myconnection); mycommand.commandtype = commandtype.storedprocedure; mycommand.parameters.add("@sp_startdate", sqldbtype.datetime).value = startdate; mycommand.parameters.add("@sp_enddate", sqldbtype.datetime).value = enddate; sqldataadapter dataadapter = new sqldataadap...

asp.net mvc - "Cannot Resolve IProjectServices" with Interfaces for Service Layer in MVC -

asp.net mvc - "Cannot Resolve IProjectServices" with Interfaces for Service Layer in MVC - i'm not sure if i'm doing right. have project called project.services contains bunch of services controllers in mvc application leverage. in terms of exposing services project web project - have interface defined in web project called "iprojectservices" bunch of blank methods correspond need. i effort implement interface in services project using syntax public class projectservices : iprojectservices i'm getting "cannot resolve iprojectservices" error - before start digging this, using interfaces correctly here? i'm thinking web project saying "hey need kind of services don't want depend straight on services project i'll create interface" , services project saying "hey no problem i'll implement that, maybe project (like tests) implement differently in future we're not tightly coupled". thinkin...

c# - Mifare DESFIRE EV1 GetCardUid -

c# - Mifare DESFIRE EV1 GetCardUid - the next code works , allows me uid of mifare 1k card. unfortunately, not work desfire cards. public byte[] getuid() { byte[] uid = new byte[6]; int rc = communicate(new byte[]{0xff, 0xca, 0x00, 0x00, 0x04}, ref uid); if (rc != 0) throw new exception("failure: " + rc); int rc1, rc2; if (uid.length == 2) { rc1 = uid[0]; rc2 = uid[1]; } else { rc1 = uid[4]; rc2 = uid[5]; } if (rc1 != 0x90 || rc2 != 0x00) throw new exception("failure: " + rc1 + "/" + rc2); byte[] result = new byte[4]; array.copy(uid, result, 4); homecoming result; } i had @ next resources http://ridrix.wordpress.com/2009/09/19/mifare-desfire-communication-example/ http://code.google.com/p/nfc-tools/source/browse/trunk/libfreefare/libfreefare/mi...

javascript - Tab onto ASP button and press enter to fire button doesn't fire onClick -

javascript - Tab onto ASP button and press enter to fire button doesn't fire onClick - i have asp button created server side , have set onclientclick event fire javascript function. renders on page onclick event correctly containing phone call javascript function , when click button works should. the problem occurs when tab onto button , press come in key. submits form, doesn't fire onclick event, javascript isn't beingness called. i have tried assign onkeypress , onkeydown button, that's not worked. must simple i've missed, i'm drawing blank here. any help gratefully accepted, thanks. here html generated button: <input type="submit" name="savebuttontop" value="save" onclick="javascript:return clicksubmitbtn();webform_dopostbackwithoptions(new webform_postbackoptions(&quot;savebuttontop&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="...

jquery - What am I doing wrong trying to center this div? (its a little off) -

jquery - What am I doing wrong trying to center this div? (its a little off) - i trying center div horizontally marker can see here http://jsfiddle.net/rkejg/8/, it's little more right should be. this code $("#infobox").css({ marginleft: (parseint($("#content").width(), 10) / 2) - (parseint($("#infobox").width(), 10) / 2) + 'px' }); then realized should add together halves of content , infobox , set them in negative margin, made whole lot worse: $("#infobox").css({ marginleft: '-' + (parseint($("#content").width(), 10) / 2) + (parseint($("#infobox").width(), 10) / 2) + 'px' }); result: margin-left: -16110.5px what doing wrong here? thanks! i cleaned html , set marker class position: relative . seems have resolved issue. out padding, , removed additional margin in marker class. think did couple other changes in css, you'll have compare original. there ...