Posts

Showing posts from January, 2012

php - Ridiculously slow MySQL Queries in Joomla 3.x -

Image
before go further, let me say, i've done that's recommended when google "slow joomla" or "optimize joomla". is, site gzipped, of css , js optimized , minified, i'm not running unnecessary components, plugins, or modules (hardly any, in fact), images optimized, caching turned on (both page , progressive) , i'm on supah-fast cloud hosting rackspace, sql database on separate rackspace server. all of that, , i'm still getting load times upwards of 10-12 seconds, as 14-15. from joomla debug: application 0.000 seconds (+0.000); 0.75 mb (+0.755) - afterload application 0.027 seconds (+0.027); 2.25 mb (+1.491) - afterinitialise application 0.040 seconds (+0.013); 3.26 mb (+1.010) - afterroute application 11.986 seconds (+11.947); 5.09 mb (+1.833) - afterdispatch application 12.000 seconds (+0.014); 5.63 mb (+0.539) - beforerendermodule mod_chronoforms (tip line) application 12.006 seconds (+0.005); 5.85 mb (+0.225) - afterrendermodule mod_chron

C# Task.Factory.NewTask and WCF. Why I'm doing wrong? -

i have application in wcf runs in machines on customer. 1 works server in net. in model, every time wcf "client" called, call wcf "server" obtain response. so, have configuration on interface: [webinvoke(bodystyle = webmessagebodystyle.wrappedrequest)] [operationcontract] myobjectreturn checkupdate(string foo1, string foo2, string foo3); in code, this: myobjectreturn myobjreturn = new myobjectreturn(); if (this.master) { myobjreturn.code = 15000; myobjreturn.message = "new update found"; return myobjreturn; } else { var mytask = task<myobjectreturn >.factory.startnew(() => { servercontractclient server = new servercontractclient(master.url); return server.checkupdate(foo1, foo2, foo3); } return mytask.result; } when wcf "client" calls "server", return null! if not use "task . factory.startnew", bad request error any tip? uh, first, "server" , &quo

java - Printing applet GUI -

Image
i'm trying print same have in applet gui. the things it's when print it's not same... size of each component changes in disproportionately way. the gui: printed: the margins not problem, can fix them easily... can see barcode , vertical text has not proper size. main class: public class impresion extends applet{ printerjob job = printerjob.getprinterjob(); panel test; label test2; label test3; string copyparam = null; string dialogparam = null; string codeparam = null; string descparam = null; public void init(){ copyparam = this.getparameter("copias"); dialogparam = this.getparameter("ventanita"); codeparam = this.getparameter("codigo"); descparam = this.getparameter("descripcion"); copyparam = "1"; dialogparam = "1"; codeparam = "0

java - ForeignCollection auto load with queryRaw() -

i have card class, has eager foreigncollection in it. have query instances of class dao.queryraw() , because select complicated built simple querybuilder (see other question ). how query , build objects rawrowmapper : genericrawresults<string[]> rawresults = getcarddao().queryraw(statement); list<card> results = new arraylist<card>(); (string[] row : rawresults) { results.add(getcarddao().getrawrowmapper().maprow(rawresults.getcolumnnames(), row)); } rawresults.close(); unfortunately when try foreigncollection on objects, returns null. if query objects simple dao.queryforfirst , foreigncollection ok. i have had same problem today. solution has been call dao.refresh(<card object>) for every object returned queryraw function (and accumulated "results" list). trick me, reloading objects db filled foreign collection.

javascript - Arrows navigation based on which section are you in -

does know if there exists plugin or similar achieve navigation on website: http://discover.store.sony.com/tablet/#entertainment i talking , down arrows appear when hovering on top pr bottom part of screen. in theory, shouldn't difficult write yourself. here's starting point achieve arrows when hovering on parts of page. need handle attaching specific links arrows depending on section user looking at. see comments more details. fiddle note in fiddle have used event.pagex , event.pagey current mouse position, in reality should use event.screenx , event.screeny . because demo in fiddle embedded small window actual page, using latter not work. // define how wide areas should // arrow appears var top_nav_height = 70; var bottom_nav_height = 70; // dimensions var page_height = $(document).height(); var half_arrow_size = $('.uparrow').width() / 2; // listen user moving mouse $(document).mousemove(function(event) { // mouse? var pos_y = even

c# - Converting hexadecimal color to integer -

this integer color in database : "8689404". i change color following: color = colorhelper.fromargb(255, byte.parse(event.labelcolor.value.tostring("x8").substring(6, 2), numberstyles.hexnumber), byte.parse(event.labelcolor.value.tostring("x8").substring(4, 2), numberstyles.hexnumber), byte.parse(event.labelcolor.value.tostring("x8").substring(2, 2), numberstyles.hexnumber)) this gives me color string "#fffc9684" now problem unable parse color string integer, can save in database. have yet is: byte = byte.parse(labelcolor.color.trimstart('#').substring(0, 2), system.globalization.numberstyles.hexnumber); byte b = byte.parse(labelcolor.color.trimstart('#').substring(6, 2), system.globalization.numberstyles.hexnumber); byte g = byte.parse(labelcolor.color.trimstart('#').substring(4, 2), system.globalization.numberstyles.hexnumber); byte r = byte.parse(labelcolor.color.trimstart(

html - Need a dynamic PHP gallery -

Image
so, i've made login page user gets redirected folder on server corresponds registered username if login info correct. now need way dynamically (or need admin page deal adding new content) page list images , or videos available user. this should presented thumbnails in gallery. each of these thumbnails represent "project", , if user clicks of these page can see content (multiple images/videos, details, , ability download images wants). also, want able sort main content. can tag each project multiple tags, , later sort them show me related projects. now, how do this? :p i'm not @ php, hoping point me in right direction? guess sql database here, simpler better. :) i dont know begin this, , i've spend time looking through web see if there exists scripts can use this. far i'm still left working login page :p in case i'm not clear, want: the user presented projects available him. can click of images , or videos in particular project. can do

vba - Gah!! Error 424 runtime error : Object required Word Visual Basic -

im trying load contents of textfile variable titular error, searching vba knowledgebase led me belive that set mysql = my.computer.filesystem.readalltext("c:\sql_query_temp.res") would solve produces 'error : object required' when run. heres code, have missed? 'requires microsoft activex data objects x.x library in references public sub connecttoodbc() dim myconn new adodb.connection dim myrs new recordset dim mysql string dim myrows long 'open file containing sql query mysql = my.computer.filesystem.readalltext("c:\sql_query_temp.res") <----- bad! 'open connection myconn.open "dsn=database" 'do query myrs.source = mysql set myrs.activeconnection = myconn myrs.cursorlocation = aduseclient myrs.open 'count rows myrows = myrs.recordcount 'add text word document! selection.typetext (myrows) 'close connection myrs.

maintaining order in json (python flask) -

this question has answer here: items in json object out of order using “json.dumps”? 5 answers simplejson returns values not in order [duplicate] 4 answers i made sorted dictionary pass through json javascript, however, seems whenever throw json.dumps() changes order alphabetical keys. critical keep in order or else not work. there way achieve this? objects in json unordered collection of key:value pairs (same dictionaries in python), should use different data structure if order relevant. a structure (in json) work: { "columns" : [ "id", "name", "age"], "rows" : [[ "john", "john doe", 42], [ "jane", "jane miller", 28] ] }

c# - PayPal Windows 8 Checkout SDK -

i reading documentation paypal windows 8 checkout sdk windows phone 8 on: https://developer.paypal.com/webapps/developer/docs/classic/windows-8-checkout-sdk/gs_win8xo/ https://developer.paypal.com/webapps/developer/docs/classic/windows-8-checkout-sdk/ht_win8xo-examples/ now, have 3 questions: 1) api redirect buyer paypal's web page on button click, buyer can log-into account using paypal username , password , authorize transaction? 2) if answer question 1 no, api make use of browser control? 3) if api not make use of browser control, specify buyer's paypal account in code (see second link)? code on page pointed second link specifies merchant's paypal account. thank :) yes question #1. not sure if browser related answer expecting: user redirected either mobile or desktop friendly site them authorize transaction. if looking more specific related browser control please comment , can clarify further.

php - insert data with add previous row data in a column -

may easy way cant this.i try sum() in insert operation not working. have table name amount . id total_amount 1 200 2 400 3 600 4 800 5 1000 i want when i'll insert value in total_amount it'll insert , sum previous data. suppose if want add 500 in total amount it'll insert 1500 . id total_amount 6 1500 if want add 300 insert 1800 id total_amount 7 1800 how can this? you want use insert statement along query: insert t(id, total_amount) select max(id)+1, sum(total_amount) + 300 t; this setting value of id . if auto_increment , unnecessary.

unix - remove first line if there is a duplicate -

i know how remove duplicate lines using sort , uniq there way remove first line duplicate not second? for example, if have file following lines in it: aaaaaaa bbbbbbb bbbbbbb ccccccc aaaaaaa ccccccc the output needs be: bbbbbbb aaaaaaa ccccccc do need run loop of sort or can done uniq ? and, yes, know sorting backwards give me output that's not want. thanks. add sequential field beginning of each line using paste (1,2,3...), reverse list based on field, , run uniq ignoring field. sort field insure have remained in right order. remove field using cut or colrm.

sql server - SSRS Report takes longer to display than the Execution Long Indicates -

i've got report running on ssrs 2008 r2. report pretty simple tablix report; no subreports or that, not subtotalling. users want report "clean" when export excel can manipulate easily. query report stored procedure accepts 3 parameters. in development, runs in 30 seconds or less. stored procedure completes in less time that, depending upon parameters chosen. (client number, year , month.) it's been running on production server few weeks, now. , client has run specific set of parameters there takes 30 minutes complete! i've gone through usual debugging. sp takes 9 seconds parameters. i've read the article parameter sniffing , , that's not it. , i've checked values in reportserver.dbo.executionlog3 view. show results following: timestart: 2013-08-07 08:36:45.173 timeend: 2013-08-07 08:37:08.943 timedataretrieval: 11598 timeprocessing: 3408 timerendering: 8171 all of seems indicate report completed ,

How to get Euler–Mascheroni's constant in R? -

is euler–mascheroni's constant $\gamma \approx 0.577$ available in r, $\pi$ pi or $e$ exp(1) ? mathmatically can write constant of interest negative of derivative of gamma function evaluated @ 1. r has derivative of gamma function digamma it's matter of plugging in. -digamma(1) #[1] 0.5772157

command line interface - Checking installed Yeoman generators -

Image
what powershell command run see yeoman generators have installed? i'm assuming it's npm command, have no idea since i'm new cli. this i'm seeing when enter "yo" command line. i'm on version 1.0.0-rc.1.3. you should able use yo -h in 1.0.0-rc.1.3 , list installed generators along generator tasks provide.

c++ - How to access the address of a static const member of a class? -

this code does't compile, , error information " undefined reference `a::a' ": code 1: #include <iostream> using namespace std; class { public: static const int a=0; }; int main() { cout<<&a::a<<endl; return 0; } but non-const static member compiles: code 2: #include <iostream> using namespace std; class { public: static int a; }; int a::a=0; int main() { cout<<&a::a<<endl; return 0; } is there no way of accessing address of static const member of class? if there is, how? , why code 1 not compile? put const int a::a; in source file, otherwise compiler doesn't generate address a. note value not repeated here.

jquery - Reload an iframe without flickering/flash (in Javascript) -

i ask if has simple solution allow me reload/refresh iframe without flickering/flash when page reloads, possible ? maybe animate blur-out , blur-in instead of flickering/flash? don't know input helpful, thanks. here how reload iframe now document.getelementbyid("frameid").contentdocument.location.reload(true); thanks help. easiest approach: create new iframe outside of dom or in hidden element. load page inside hidden frame once load fires within hidden frame, swap them around! swapping to swap them, have them next each other , toggle display: none / block css of each one.

JSONP Ajax Call with JQuery causes memory leak -

Image
i searched complete day , cannot find issue why such big memory leaks in phonegap application, uses lot of ajax-jsonp requests server. therefore broke down simplest example. can find here on jsfiddle . the main content of is: function run(){ $.ajax({ datatype: 'jsonp', url: "http://thawing-bayou-7281.herokuapp.com/test.js", success: function (res) { // stuff here settimeout(run, 250); } }); }; run(); so code calls jsonp api request endless time every 250ms. please note: know example never implement that! it's detecting memory leak. when run example used memory increases rapidly (you can see best in chromes timeline tab). number of dom nodes increasing rapidly. @ point breaks down (maybe gc?) elements , needed memory increases rapidly. has of idea how fix problem? thanks! this not memory leak, sawtooth type graphs common in java. memory usage ramps up, garbage collector

mod rewrite - remove dynamic part of url .htaccess -

i need remove dynamic part of url: example.com/pagename/?btag=a_233b_230c_&affid=201 so remove after , including "?" but don't want rule apply directory: example.com/wp-content/?attr=1345 is possible .htaccess? thanks, appreciated jon rewritecond %{request_uri} !^/wp-content that might help:-d repeat other folders.

android - How to convert ASCII char* to wchar_t* in C++ without using mbstowcs? -

i'd convert ascii char* wchar_t* in c++ on linux without using mbstowcs() . on ios , windows, works perfectly. on android, however, mbstowcs seems convert things quite literally, one-to-one. using different variations of setlocale() , i've been unable convert. i might end manually converting on android copying 1 byte, , filling rest zeroes. proper ascii? first 255 characters of utf-32/unicode same ascii (iso 8859-1/iso latin-1) character set? if don't mind taking stl dependency , using string , wstring instead of raw char * , wchar_t * pointers, can use function following perform string conversions: template<typename target, typename source> target convertstring(const source &s) { target result; result.assign(s.begin(), s.end()); return result; } use follows: #include <string> #include <iostream> using namespace std; int main() { wstring wstr(l"hello world"); string str(convertstring<strin

Drag and zoom with canvas kineticjs -

i've made draggable stage kineticjs , made zoom function means of scaling canvas. when using zoom factor, canvas zooming center of screen. after dragging canvas , using zoom function, canvas still zooming point on center @ beginning dragged aside. what want zoom new point on center of screen after dragging. can please explain how handle this? thanks in advance! you need set offset fixed point (the centre of screen) canvas knows zoom. if not, zoom towards original point. var stage = new kinetic.stage({ container: 'container', width: 400, height: 300, offset: [200, 150] //zoom towards point (200,150) }; also, see answers here scaling fixed point in kineticjs juan.facorro , eric rowell (kineticjs developer) more information.

graphics - Matlab -plot a vector field -

Image
i have written function in matlab gives me vector @ position (x,y,z). now looking easiest way make colored map of field on grid , color should related norm of vector. what easiest way define such grid $x \in [x_0,x_1],y \in [y_0,y_1], z \in [z_0,z_1]$? linspace each component possible, maybe there command gives me grid. now need evaluate function. problem is, gives me 2 vectors, interested in first one. when first tried thought $[a(i,j,k),~]=function(x(i),y(j),z(k))$ work, did not(my goal was: choose first vector(a) , mark him reference(i,j,k), later on know coordinates vector belongs to). so highly interested in kind of ideas. instead of [a(i,j,k),~]=function(x(i),y(j),z(k)); try [a(i,j,k,:),~]=function(x(i),y(j),z(k)); so can fit entire size of 3-coordinate vector. also, if want preallocate space use = zeros(nx,ny,nz,3); where nx,... dims of coordinate space. @moly explains, use meshgrid generate 3d grid, [x y z] = meshgrid(x,y,z); and loop or

zend framework - Callback functions in PHP < 5.3 -

i have multidimensional array , want usort in zendframework.** following code work in php 5.3+, not lower versions because of callback function in usort . usort($array, function (array $a, array $b) { return date('ymdhis',$a['time']) - date('ymdhis',$b['time']); }); so instead of callback function how can divide , use external function call in zend framework. in normal php script individual call working below. usort($array, 'usortcallback'); function usortcallback(array $a, array $b) { return date('ymdhis',$a['time']) - date('ymdhis',$b['time']); }); but want workable code zend framework. thanks, sandeep you can use create_function() , fork older php too. $callback = create_function( '$a, $b', 'return date("ymdhis",$a["time"]) - date("ymdhis",$b["time"]);' ); usort($array, $callback);

How to use Bootstrap accordion with a radio button list -

i trying build ui combines html radio button list accordion functionality offered bootstrap's collapse component. goal selecting radio button expands accordion panel below it. here's jsfiddle demonstrates partially working implementation. unfortunately, although accordion functionality works, radio buttons not selected (apart initial selection, subsequently never changes). please excuse invalid html in sample. aware input element doesn't have href attribute, don't believe cause of problem. i have seen this answer similar question, prefer avoid editing bootstrap code , hope there might purely declarative way of making work. many suggestions, tim edit: else facing same issue, functionality works out-of-the-box in bootstrap v3.0. i got work little jquery. jsfiddle i'm sure there more elegant ways of doing this. works. $('#collapseone').on('shown', function(){ $('#radio1').prop('checked', true); }); $(

vb.net - Only Shows Error List For One vb File -

i'm kind of new visual studio. i've built few simple programs in it, i'm in process of rewriting huge system wrote in vba. frustrating me error list in vs listing errors 1 .vb file in project, lets call vbfile1 . now, when work on vb file, vbfile2 , in same project vbfile1 no red squiggles or errors listed vbfile2. don't understand how happen. i've tried/checked: filter set 'current project' , played around other filter settings no change. checked text editor under options , according research i've done fine. plus, have never changed of these settings anyway. closed , re-opened visual studio. closed open files in project , still displays same error list close files except vbfile2 still shows same error list of vbfile1. i have visual studio 2012 ultimate. feel should easy fix...i confused what's going on. hope makes sense! update: excluded project, vbfile1 , errors listed vbfile2...why be? i not sure if has been fixed

localization - How to localize ActiveReport 7.0 XML PageReports rdlx -

we have huge number of page reports created using activereport (*.rdlx files) use them our asp.net mvc web appolication. all captions , other stuff created on english now need add multilanguage support there so, somehow need existing texts inserted in resource file , can add translations is there way achive task quickly, without going each report field , manually extracting resource file? documentation says once change language property, resource files created, seems not working xml reports, or there shouldbe trick for reports designed code-behind, resource files created pretty same if create windows form... fail find out how xml reports. page reports support localization; doesn't resource file. this mentioned off-hand in single sentence on page localization activereports 7 . setting localized value in page report done same in section report. change report's language property , set new textbox values. @ report runtime appropriate value textbox used.

Windows path doesn't contain C:\WINDOWS\system32, can I add it using batch script? -

i writing batch script that, quite reasonably, depends on "c:\windows\system32" being part of path environment variable. encountered (developer's) machine had weird path didn't include system32, , therefore batch script didn't work. i looked ways batch script check path variable , add system32 if not there. however, solution found used setx ironically enough depends on system32 in path variable. there programmatic ways add system32 path without being there? also please let me know if such edge case doesn't make sense make script robust against it. i'm not expecting of typical users have such borked path variable. should bother? try this: for /f "delims=" %%a in ("%comspec%") set "path=%path%;%%~dpa" or this: for /f "delims=" %%a in ("%comspec%") set "compath=%%~dpa" set "path=%path%;%compath:~0,-1%"

C++ standard sort documentation issue -

my copy of c++ standard document documents standard sort function. 25.4.1.1 sort template<class randomaccessiterator> void sort(randomaccessiterator first, randomaccessiterator last); ... effects: sorts elements in range [first,last). requires: randomaccessiterator shall satisfy requirements of valueswappable (17.6.3.2). type of *first shall satisfy requirements of moveconstructible (table 20) , of moveassignable ok - shouldn't require elements referred comparable? i expect "requires" clause include like: "type results dereferencing randomaccessiterator should satisfy requirements of lessthancomparable ." or better yet " iterator_traits<randomaccessiterator>::value_type should satisfy requirements of lessthancomparable." since 24.4.1 says in part "it required if iterator type of iterator, types ... iterator_traits<iterator>::value_type defined" why isn't such language included. surely

Opening source code instead of decompiled class in eclipse 3.5 and jd-eclipse plugin -

i have set eclipse (eclipse 3.5) associate java run time jars source code. have accomplished associating jdk rt.jar source code ships jdk (c:\program files\java\jdk1.6.0_37\src.zip). i happen have jd-eclipse decompiler plugin setup. when click on hashmap class, opens decompiled hashmap class; wanted see source code (from jdk src.zip file). possible tell eclipse to: open associated source code library class if available. if source code not available; , decompile class? system info: eclipse 3.5 jd-eclipse 0.1.3 os: windows 7, 64 bit enterprise edition thanks in blog post , author describes 2 problems jd-eclipse plugin has: the generated source code doesn’t line debug line numbers because generated code can’t include original comments. if choose associate “*.class” file type within eclipse “class file editor” decompiled output if have real source attached. i guess 2. problem facing , appears jd-eclipse not capable of need. it looks mchr3k

angularjs - Carousel slide effect with ng hide/show and ng-animate? -

i have slider type carousel 2 section containers can slide left , right. in developed version have images inside 1 section container. problem i'm experiencing because images server take while load i'm finding when user clicks button page being added dom again (due ng switch) , having reload images. my question: there way use ngif or hide/show instead page setting display: none when hidden page containers not shown not removed dom? <!--animate--> <div ng-animate="{enter: 'enter', leave: 'leave';}" ng-switch on="par.selection"> <!--page1--> <div class="page page1" ng-switch-when="settings"> <b>page 1</b><br><br> <button ng-click="par.selection = 'home'; go('front');" >go page 2</button> </div> <!--page2--> <div class="page page2" ng-switch-when="home">

java - JSON deserialization with Gson -

this json data: { "boards": [ { "board": "3", "title": "3dcg", "ws_board": 1, "per_page": 15, "pages": 11 }, { "board": "a", "title": "anime & manga", "ws_board": 1, "per_page": 15, "pages": 11 }, { "board": "adv", "title": "advice", "ws_board": 1, "per_page": 15, "pages": 11 }, ... ] } this code deserialization: jsonobject json = readjsonfromurl("http://api.4chan.org/boards.json"); string jsonboards = json.tostring(); gson gson = new gson(); map<string, object> map = new hashmap<string,object>(); map = (map<string,object>) gson.fromjson(jsonboards, map.getclass()); but doesn&#

Use PayPal's own "Thank you" page -

does paypal include own "thank purchase" page? want show thank page after successful payment. currently, return url getting opened in popup, want avoid. how can accomplish this? you should see paypal's thank page default unless have set settings show own. in case, can set back.

c# - Remove extra white spaces on string with special characters -

i having trouble removing white spaces following: abc\ae.exe 1 b 2%% acu > log.txt i using following code remove spaces (that found on s.o.): regex.replace(cmdline, @"^\s*$\n", string.empty, regexoptions.multiline).trimend(); the above code removing white spaces between abc\ae.exe & fine; however, not removing white space 2%% acu (has 2 spaces in between). i not familiar reg expressions assuming has fact % sign might reg ex key word. any guidance appreciated. regex.replace(cmdline,@"\s+"," "); will replace multiple spaces single space the + means match character 1 or more times here's regex guide c#

node.js - Mongoose upsert duplicate key error -

i'm trying upsert using mongoose, i'm getting duplicate key error key should trigger upsert. schema: "resource": {type: schema.objectid, ref: "resource"}, "skill": {type: schema.objectid, ref: "skill"}, "level": {type: number, min: 1, max: 5} .index({skill: 1, resource: 1}, {unique: true}); then make call: //self resource instance resourceskilllevel.update({ resource: self._id, skill: skill._id, level: level }, {$set: {level: level}}, {upsert: true}, cb); if (resource, skill) not exist, call works fine , creates resourceskilllevel entry. however, when call again duplicate key error index . listed duplicate key tuple resource/skill key. why isn't upserting when finds duplicate? you're including level in update query criteria parameter, if doesn't match existi

javascript - Regex to get parameters of Embed -

code: var = [ /<b\>(.*?)<\/b\>/ig, /<i\>(.*?)<\/i\>/ig, /<u\>(.*?)<\/u\>/ig, /<br\/\>(.*?)/ig, /<embed(.*?)/ig ]; var b = [ '[b]$1[/b]', '[i]$1[/i]', '[u]$1[/u]', '\r', '[flash($2,$3)]$1[/flash]' ]; (var =0;i<a.length;i++) { ele = ele.replace(a[i], b[i]); } html: <embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.youtube.com/v/dm0vrhuu6ei" width="500" height="500" type="application/x-shockwave-flash" wmode="transparent" quality="high" scale="exactfit"> what is $1 starting position of [flash] $2 width parameter $3 height parameter the beginning of code change html elements bbcodes. should go regex different in embed regex? see example here better understand! http://jsbin.com/ajeqog/2/edit as turns out

javascript - I can't get mouse input in my HTML5 game -

i'm trying mouse input in game; appreciated. i call event listeners in init() function, , have both mousemoved() , mouseclicked() functions. haven't been able response. (i asked make jsfiddle project, here is. it's not rendering images, reason. once there's input, there should text on top left shows mouse coordinates. also, when click on canvas, should alert.) var canvasbg = document.getelementbyid('canvasbg'); var ctxbg = canvasbg.getcontext('2d'); var canvasentities = document.getelementbyid('entities'); var entitiesctx = canvasentities.getcontext('2d'); var isplaying = false; var player; var enemy; var mousex, mousey; var playerimg = new image(); playerimg.src = 'http://placekitten.com/g/50/50'; var enemyimg = new image(); enemyimg.src = 'http://placehold.it/50x50'; window.onload = init; var requestanimframe = window.requestanimationframe || window.webkitrequestanimationframe ||

.htaccess - Don't spider certain pages on multiple domains same hosting -

i have hosting account 2 domains parked on it, websites shows different content reading domain being used. google spider , list 2 domains different websites. so have these listed on google:- www.blue.com/index.php www.pink.com/index.php then lets have page want on blue domain: www.blue.com/test.php, domains parked still work @ www.pink.com/test.php this means spidered, don't want do. how can stop this? is possible have multiple htaccess rules depending on domain? or maybe robots.txt stop spidering - how work multiple domains? what best solution me? redirect different domain specific robots_(blue|pink).txt in .htaccess: <ifmodule mod_write.c> rewriteengine on # internal redirect robots_blue.txt rewritecond %{http_host} =www.blue.com rewriterule ^robots\.txt$ /robots_blue.txt [l] # internal redirect robots_pink.txt rewritecond %{http_host} =www.pink.com rewriterule ^robots\.txt$ /robots_pink.txt [l] # internal redirct index_blu

sql server - How can i nest these SQL statements without a group by clause error? -

i trying query database has these params: transaction date, user email address what have done use query: select [user email address], count(*) 'count' [database].[table] group [user email address] which displays table params: email address, count in case count column shows number of occurrences of user email in original table. what trying next @ transaction date column last year today, , compare count column subset count column of orginal (which goes 3 years). specifically, want end resultant table be: user user email address, countdiff where countdiff difference in counts 1 year subset , original subset. i have tried: select [user email address], [transaction date], [count - count(*)] 'countddifference' ( select [user email address], count(*) 'count' [database].[table] group [user email address] ) a.[transaction date] >= '2011-08-07 00:00:00.000' order [count] desc but error [transa

javascript - Rotated line is offset -

i've been trying rotate line originates @ center of circle towards cursor in javascript. have moving offset actual direction. there reason this? i'd rather not have add direction until syncs up. this how direction: var deltay = pointery - chary; var deltax = pointerx - chary; chardirection = math.atan2(deltay,deltax) * 180/ math.pi; and how i'm calculating new point want 100 points away center. var directioninradians = chardirection * (math.pi/180); var newx = 100 * math.cos(directioninradians) - 100 * math.sin(directioninradians); var newy = 100 * math.cos(directioninradians) + 100 * math.sin(directioninradians); jsfiddle post i not sure why perform newx/y calculation way do. proper calculation lot simpler: var newx = 100 * math.cos(directioninradians); var newy = 100 * math.sin(directioninradians); demo .

php - First value in implode returning different? -

i not sure why first value in array adds <p> tags, , rest works inside li tags. //user posted variable $checks = $_post['personalization_result']; //handling form data , outputting list if(!empty($checks)){ $checkvalues = array_values($checks); $checkstring = implode('<li style="list-style: none;">'.get_post_meta($post->id, '_moon_question', true).'', $checkvalues); } // need filter can parse html in email add_filter('wp_mail_content_type',create_function('', 'return "text/html";')); //e-mailing form data here $sent = wp_mail($to, $subject, $checkstring, $headers); this works, email sent, reason looks this. <p>1</p> //this first value should below <li style="list-style: none;">suits1</li> <li style="list-style: none;">suits1</li> <li style="list-style: none;">suits1</li> <li style="list-s

SASS set variable depending on CSS class -

i've got website that's using few different 'main' colors. general html layout stays same, colors change depending on content. i wondering if set color variable depending on css-class. way can theme website few variables , let sass fill in colors. for example: $color-1: #444; $color-2: #555; $color-3: #666; $color-4: #777; body.class-1 { color-default: $color-1; color-main: $color-2; } body.class-2 { color-default: $color-3; color-main: $color-4; } /* content css */ .content { background: $color-default; color: $color-main; } i thinking of using mixin this, wondering if there's better way this, function maybe? i'm not great sass, if me out. appreciated. thanks. i think mixin answer. ( as wrote , variables won’t work.) @mixin content($color-default, $color-main) { background: $color-default; color: $color-main; } body.class-1 { @include content(#444, #555); } body.class-2 { @include content(#666, #777); } that

jquery - Alternative to JavaScript's setInterval? -

i need contents shown in real-time, when loading many things takes cpu , laggy. is there alternative code below? $(document).ready(function() { var refresh_bal = setinterval( function (){ $.get('./php/get_balance.php', function(balance) { $('.balance').html(balance); }); }, 1000); var refresh_total = setinterval( function (){ $.get('./php/get_total_bets.php', function(total) { $('.total').html(total); }); }, 1000); var refresh_profit = setinterval( function (){ $.get('./php/get_profit.php', function(profit) { $('.profit').html(profit); }); }, 1000); $('.haa').on('click', function() { var refresh_bets = setinterval( function (){ $.get('./php/get_bets.php', function(bets) {

Error in pushing files to a git bare repo using ssh -

i trying push files git bare repo on ssh. these steps have performed. setup cygwin , sshd on windows machine. created bare git repo on windows server machine. client machine try push code server , not work. following error bash: git-receive-pack: command not found fatal: not read remote repository. please make sure have correct access rights , repository exists. so git repo named samplerepo on windows server, , on client machine adding origin using following command, git remote add origin username@192.168.1.56:~/gitrepo/samplerepo the command has same relative path of repo on server. have clue doing wrong.

c# - Get a new result from a List -

i have detailed list , want new 1 elements of 1 property no duplicates this. list<class1> list = list<class1>(); list.add(new class1("1", "walmart", 13.54)); list.add(new class1("2", "target", 12.54)); list.add(new class1("3", "walmart", 14.54)); list.add(new class1("4", "bestbuy", 16.54)); list.add(new class1("5", "walmart", 19.54)); list.add(new class1("6", "amazon", 12.33)); my new list list<stores> newlist = list.select / findall / group ? i want collection newlist = "walmart", "target", "bestbuy", "amazon" you need distinct , select . var newlist = list.select(x => x.name).distinct().tolist(); if want original class, have bit more fancy. either morelinq , use distinctby method: var newlist = list.distinctby(x => x.name).tolist(); or use clever groupby hack: var

How to handle every request in a Firefox extension? -

i'm trying capture , handle every single request web page, or plugin in make. example, if open console, , enable net logging, when http request sent, console shows there. want capture every link , call function when video loaded flash player (which logged in console also, if http ). can guide me should do, or should started? edit: want able cancel request , handle way if needed. you can use jetpack sdk of need, believe. if register system events , listen http-on-modify-request , can use nsihttpchannel methods modify response , request let { ci } = require('chrome'); let { on } = require('sdk/system/events'); let { newuri } = require('sdk/url/utils'); on('http-on-modify-request', function ({subject, type, data}) { if (/google/.test(subject.uri.spec)) { subject.queryinterface(ci.nsihttpchannel); subject.redirectto(newuri('http://mozilla.org')); } }); additional info, " intercepting page loads "

Using Yahoo Pipes, how can I do the equivalent of "Loop: assign first two"? -

the loop operator in yahoo pipes has 2 choices output: emit (first/all) results, , assign (first/all) results _ . what need loop assign first 2 results element. there way accomplish this? background: i've got csv file, column 1 feed url , column 2 internal feed id. start "fetch csv", , connect "loop" inside "fetch feed" , assign results item.feed. outputs close need, since of feeds in list huge , display first 2 elements of each feed, want eliminate unused data in output json file. sounds should easy, right? can't seem right. ok, figured out. created new pipe called truncate2 pipes "fetch feed" "truncate" , outputs result. wired "url input" fetch feed url source, , original pipe, pulled truncate2 inside loop , assigned results.

html - Sometimes DIVs are making like a ladder -

Image
i developing chrome extension. sometimes when i'm clicking on extension icon, div s making "ladder": i want this: how can ensure currency fields aligned properly? here markup: <div class="calc"> <div class="in"> <img id="cur-img-in" src="img/amd.gif"/> <select name="currency-calc-cur" id="in-select"> <option selected="selected" value="amd">amd</option> <option value="eur">eur</option> <option value="rur">rur</option> <option value="usd">usd</option> </select> <input type="text" id="in"/> </div> <img id='swap-cur' src="img/swap.png" alt="swap"/> <div class="out"> <img id="cur-img-

html - Unable to display inline forms with bootstrap CSS -

Image
i started using bootstrap css setting form designing. the form has 3 top level settings, radio1 (y or n), topsettings (which has 3 sub-settings: enable , textbox1 , textbox2 ) , mediadir (textbox). trying align these 3 top level labels on left, , align 3 sub-settings of topsettings on right. before bootstrap, able achieve these using hard-coded html tables. (in image: top - wanted, , achieved hard-coded tables in html. bottom - looks bootstrap) <form name="serversetting"> <fieldset> <legend> <b>settings</b> </legend> <div> <table class="code"> <tr> <td class="padded"> radio1= </td> <td class="padded"> <input type="radio" name="radio1" value="y">y <input type="radio" name="radio1" value="n">n </td>

Bootstrap 3RC1 + Side Panel + Affix -

can me implementing lateral panel stays visible when scrolling page using bootstrap v3 rc1? this code bootply . my problem when scroll down page panel shrinks, , want keep size when page on top. if write , style affix ( .affix{width:10%} ) can set width. if way i'll have put exact size panel. is right approach? the affix plugin sets different classes element based on scroll position (and offset). before offset class affix-top , between affix-offset-top , affix-offset-bottom class affix . position defined css affix-top static (default, see: http://www.w3schools.com/cssref/pr_class_position.asp ) while position of affix class set fixed. when element has position:absolute it's width max width of it's parent. in case panel 100% width of col-lg-3 (due box-sizing: border-box, see why did bootstrap 3 switch box-sizing: border-box? ). width of class 25% (3/12*100) parent .container div. (max-)width of .container depends on screen / viewport's width. th