Posts

Showing posts from June, 2012

ruby on rails - How to debug/fix random occurring Redis::TimeoutError? -

i have rails app running using redis quite lot - - i'm seeing quite few redis::timeouterror occurring here , there, time time. there no pattern in circumstances. occurs both in web app , in background jobs (which being processed using sidekiq ) - not time time. now have no idea how track down root cause of , hence no idea how fix it. here little background on setup: the redis instance running on separate physical server connected both web server , background server in private local 1gbit network. servers running ubuntu 12.04. redis version 2.6.10. i'm connecting rails app (which 3.2) using initializer so: require 'redis' require 'redis/objects' redis = redis.new(:url => app_config['redis_url']) redis.current = redis this output of redis-cli info : # server redis_version:2.6.10 redis_git_sha1:00000000 redis_git_dirty:0 redis_mode:standalone os:linux 3.2.0-38-generic x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.6.3 process_i

python - combining 2D arrays to 3D arrays -

hello have 3 numpy arrays given below. >>> print [[ 1. 0. 0.] [ 3. 0. 0.] [ 5. 2. 0.] [ 2. 0. 0.] [ 1. 2. 1.]] >>> print b [[ 5. 9. 9.] [ 37. 8. 9.] [ 49. 8. 3.] [ 3. 3. 1.] [ 4. 4. 5.]] >>> >>> print c [[ 0. 0. 0.] [ 0. 6. 0.] [ 1. 4. 6.] [ 6. 2. 0.] [ 0. 5. 4.]] i combine them [[[ 1. 0. 0.] [ 5. 9. 9.] [ 0. 0. 0.]] [[ 3. 0. 0.] [ 37. 8. 9.] [ 0. 6. 0.]] [[ 5. 2. 0.] [ 49. 8. 3.] [ 1. 4. 6.]] [[ 2. 0. 0.] [ 3. 3. 1.] [ 6. 2. 0.]] [[ 1. 2. 1.] [ 4. 4. 5.] [ 0. 5. 4.]]] that take 1 row each array. tell me simple way it? tried hstack , vstack . not giving desired result. thanks ! a solution using numpy dstack : >>> import numpy np >>> np.dstack((a,b,c)).swapaxes(1,2) array([[[ 1, 0, 0], [ 5, 9, 9], [ 0, 0, 0]], [[ 3, 0, 0],

cordova - Deploying to Android emulator fails when space in path? -

when run "phonegap local run android", install part fails 3 errors. the first 1 references /platforms/android/cordova/run: line 69 no such file or directory. however path shown truncated space occurs. it's though phonegap cannot read path contains space. two further errors reference same file lines 32 , 36. same path error again. has got round path error?

java - Camel 2.12 routing with RabbitMQ -

i've been attempting camel route using rabbitmqcomponent releases in 2.12.1-snapshot. in doing so, i've been able consume easily, have ad issues when routing queues. camelcontext context = new defaultcamelcontext(); context.addcomponent("rabbit-mq", factorycomponent()); from("rabbit-mq://localhost/test.exchange&queue=test.queue&username=guest&password=guest&autodelete=false&durable=true") .log("${in.body}") .to("rabbit-mq://localhost/out.queue&routingkey=out.queue&durable=true&autoack=false&autodelete=false&username=guest&password=guest") .end(); in this, i've verified there specified exchanges configured appropriate routing keys. i've noted i'm able consume in volume, not able produce out.queue. the following reference rabbitmqproducer process message. 09:10:28,119 debug rabbitmqproducer[main]: - starting producer: producer[rabbit-mq://localhost/out.queue?autoack=

How do I select nodes in a Drupal View that share a field value with the current logged in user? -

it seems me missing obvious. i have set of profiles authored 2 separate groups of people identical fields. i want current user able run view find nodes of type profile have same value of field primary area of interest logged in user. logged in user , authors of other nodes have different roles. i have tried contextual filters , using views field views module little effect. appreciated. thank you

In a pickle with pickling in python -

i have gone through website , many others no 1 seems give me simplest possible answer. in scrip bellow there 2 different variables need placed single pickle (aka 'test1' , 'test2'); wholly unable simpler 1 of 2 load. there no error messages or anything, , appear being written pickle close 'program', re open it, try load pickle value of 'test1' not change. the second question how save both same pickle? @ first tried using allstuff variable store both test1 , test2 dumping allstuff...the dump seems success loading jack. ive tried variation list each file should loaded caused whole lot of errors , caused me assault poor old keyboard... please help. import pickle class testing(): test1 = 1000 test2 = {'dogs' : 0, 'cats' : 0, 'birds' : 0, 'mive' : 0} def saveload(): check = int(input(' 1. save : 2. load : 3. print : 4. add')) allstuff = testing.test1, testing.test2

python - ImportError: No module named mpl_toolkits with maptlotlib 1.3.0 and py2exe -

i can't figure out how able package via py2exe now: i running command: python setup2.py py2exe via python 2.7.5 , matplotlib 1.3.0 , py2exe 0.6.9 , 0.6.10dev this worked matplotlib 1.2.x i have read http://www.py2exe.org/index.cgi/exewitheggs , tried implement suggestions handling mpl_toolkits since it's having become namespace package. i'm trying answer here too: http://matplotlib.1069221.n5.nabble.com/1-3-0-and-py2exe-regression-td41723.html adding empty __init__.py mpl_toolkits makes work, workaround problem. can suggest need make py2exe work mpl_toolkits.axes_grid1 in matplotlib 1.3.0 ?: test_mpl.py is: from mpl_toolkits.axes_grid1 import make_axes_locatable, axes_size if __name__ == '__main__': print make_axes_locatable, axes_size setup2.py is: import py2exe import distutils.sysconfig distutils.core import setup # attempts work import modulefinder import matplotlib import mpl_toolkits.axes_grid1 __import__('pkg_resour

javascript - Close aloha editor -

i have iframe in turn contains html , aloha libraries editing. when click on content blue-border editor toolbar, of course hides when mouse clicked outside of editable area. however when click outside of iframe editor toolbar still shows. i thought adding dummy element outside of editable area focus upon, doesn't hide it. is there event fire hide it? have tried searching docs , google not find anything... here's part called when deactivate editable click outside of editable (blur) https://github.com/alohaeditor/aloha-editor/blob/release/src/lib/aloha/editable.js#l771 to manually "destroy" editable use .mahalo() -- use .aloha() blur mentioned first want do hope helps /rene

sql - Oracle query with pipelined - performance issue -

i'd create view based on following query: create or replace view my_view select a.* my_table a, table(my_package.pipelined_function(a.my_date)) p a.my_field1 = p.my_field1 , ... and view should used way: select * my_view v v.my_date = trunc(sysdate) as can see, request bit tricky since pipelined_function called fields a ! , request slow, suspect because oracle tries compute p possible dates. of course if fix date (for instance my_package.pipelined_function(trunc(sysdate)) ), answer immediate. here execution plan ( my_table view: fo.v_trading_pool_inout_prd , , pipelined name pool_inout_elig_best_rank @ bottom): select statement, goal = all_rows 211 2 16576 191 view fo v_trading_pool_inout_candidate 211 2 16576 191 nested loops 130 1 8290 115 view fo v_trading_pool_inout_prd 63 1 8288 56 sort group 63 1 941 56 nested loops outer 62 1 941 56 nested loops outer

activerecord - Validate uniqueness only on create - what am I typing wrong? Example provided -

i have code : class member extends activerecord\model { static $validates_uniqueness_of = array( array('name', 'message' => "that name has been registered. please choose another", 'on' => 'create'), array('email', 'message' => "that email has been registered. please choose another", 'on' => 'create') ); } the problem checks uniqueness when update . don't want that. when create . what typing wrong? try like validates_uniqueness_of :name, :on => :create validates_uniqueness_of :email, :on => :create this should trick already, give try =)

javascript - Google.Load ['table'] does nothing in Chrome content-script -

Image
i creating chrome extension utilises content-script insert google visualisation table page once has finished loading. problem though table never displayed - not in html can seen images below. manifest.json { "manifest_version": 2, "name": "blah", "version": "1.0", "permissions": [ "tabs", "http://*/*" ], "web_accessible_resources": [ "jquery-1.10.2.min.js", "jquery-1.10.2.min.map" ], "content_scripts": [ { "matches": ["http://*.ebay.co.uk/*"], "js": ["jquery-1.10.2.min.js", "jsapi.js", "myscript.js"], "run_at": "document_end" }] } myscript.js $('#cbrt').after('<div id=\'google_table_div\'></div>'); google.load('visualization', '1', { packa

Gradle - SIngle with Multiple Jars into Maven Repository -

i have gradle project when build creates multiple jar files based on rules classes a,b , c goto a.jar, classes d,e , f goto b.jar , on. now want upload these jar files maven repository. though able want put each of these jars in maven repository standalone artifact. for ex: right if have project named myproject , has produces 2 jar files : a.jar , b.jar, in maven repository have following structure ------- repo | |----com | |--- project | |---- myproject | |---- version 1 | |--- a.jar |--- b.jar but want following structure ------- repo | |----com | |--- project | |---- myproject | |----

tsql - SQL Server Management Studio - trouble restoring from bak and trn -

i trying restore database .bak , trn files. not able see .bak , .trn files through sql server management studio. when go folder see them. used t-sql says access denied. sysadmin on server. can please me it. script: restore database [xyz] disk = n'r:\mssql10_50.mssqlserver\mssql\restore\xyz_full.bak' file = 1 go error: msg 3201, level 16, state 2, line 3 cannot open backup device 'r:..."operating system error 5(access denied.). make sure account (windows or sql server) in ssms has right backup/restore, sysadmin, db_backoperator, etc. the backup , restore processes runs under sql server (engine) service account since might running ssms on laptop working files on server. it doesn't matter logged in as, service account needs access directory , files. is service account domain account or local service? use domain account can work files on unc path. also, there 2 system stored procedures executed during browse dialog: master.dbo.xp_di

installer - Delete a file AFTER installation in InnoSetup -

i need delete files after installation finishes. i using [run] section call cmd delete files wanted improve deletions using innosetup code , not batch i've seen [installdelete] section delete files before [run] section so... there can delete files after [run] section? here script: #define installername "virtualbox-4.2.16-r86992-multiarch_amd64.msi" #define extensionname "oracle_vm_virtualbox_extension_pack-4.2.16-86992.vbox-extpack" [setup] appname=virtualbox blah blah blah... blah blah blah... [files] source: {tmp}\*; destdir: {tmp}; flags: deleteafterinstall recursesubdirs createallsubdirs ignoreversion [run] filename: {tmp}\{#installername}; parameters: "/passive /norestart addlocal=vboxapplication installdir=""{app}"""; statusmsg: instalando virtualbox...; flags: shellexec runhidden waituntilterminated filename: {tmp}\xml.exe; parameters: "ed --inplace -n n=""http://www.innotek.de/virtualbox-settings&

jQuery Validate Issue with form.reset and validator.resetForm -

i have form required fields. if user clicks button, validation should fire, , input processed. however, after processing, want reset/clear form , allow them enter more information. after call form.reset() , validator.resetform() though, validation messages shown because form has been cleared. proper way clear form , ensure no validation messages appear? here's complete fiddle illustrating issue. here's code snippet i'd working: $('#btngo').click(function(){ // clear form $('#frmfoo')[0].reset(); // after call resetform, validation message shown again. why? validator.resetform(); }); thanks, andy the jquery validate plugin, default, treats button element submit, why validation messages come right during/after reset. you need add type="button" button doesn't trigger submit. <button type="button" id="btngo">do , clear form</button> demo : http://jsfiddle.net/axucf/

r - Character limit for ODE solver -

i'm trying solve odes in r. currently i'm using package desolve, running problems there appears character limit on length of equations, error tells me there's unexpected symbol. initially solved storing half of offending equation in vector combining... ideally not every equation. does know way around character limit package, or of ode solver in r without character limit? as requested, here equation causes error unexpected symbol: dyx31 <- -c_2*yx14*(-6*c_6^2*y_0 + 4*c_6^2 - 12*c_6*y_0^2 + 4*c_6*y_0 + 4*c_6*yx16 + c_6 - 6*y_0^3)/(c_6^3 + 3*c_6^2*y_0 + 3*c_6*y_0^2 + y_0^3) + c_2*yx29*(-4*c_6^3*y_0 + 6*c_6^3 - 12*c_6^2*y_0^2 + 12*c_6^2*y_0 + 4*c_6^2 - 12*c_6*y_0^3 + 6*c_6*y_0^2 + 4*c_6*y_0 + 4*c_6*yx16 + c_6 - 4*y_0^4)/(c_6^4 + 4*c_6^3*y_0 + 6*c_6^2*y_0^2 + 4*c_6*y_0^3 + y_0^4) - c_2*yx4*(4*c_6*y_0 - 4*c_6*yx16 - c_6 + 4*y_0^2)/(c_6^2 + 2*c_6*y_0 + y_0^2) + yx16*(4*c_0*c_6^4 + 16*c_0*c_6^3*y_0 + 24*c_0*c_6^2*y_0^2 + 16*c_0*c_6*y_0^3 + 4*c_0*y_0^4 - 4*c_1*c_6^4

ruby - Rails 4: How to check validation errors from inside a controller -

i have basic model validations triggered when form gets submitted ajax. if validations fail, want pass validation errors view can tell user. def save logger.debug( params ) @video = video.new( video_params ) if @video.save render json: @video else render json: errors.messages end end this throws error because errors undefined. doing wrong? read the docs on this , shows errors.messages used in view. errors instance method activerecord . correct way use in case this: @video.errors.messages

PHP script and MYSQL query return different (and undesirable) data -

i have table select "project managers" , pull data them. each of them has number of "clients" manage. clients linked project manager name. for example: john smith has 3 clients. each of clients have name in row called "manager". here's simple version of table looks like: name | type | manager -------------------------------------- john smith | manager | client 1 | client | john smith client 2 | client | john smith client 3 | client | john smith john carry | manager | client 4 | client | john carry client 5 | client | john carry client 6 | client | john carry i want return following data: john smith - 3 clients john carry - 3 clients i used query return data: select t.name, count(t1.name) totalclients yourtable t inner join yourtable t1 on t.name = t1.manager group t.name; http://sqlfiddle.com/#!2/d72a87/2 which worked correctly in phpmyadmin , on fiddle, when used the php script (a simple query

css - What is the right way to use relative paths in less stylesheets in Rails? -

i'm upgrading rails3.1 application use asset pipeline. i'm using less-rails gem compile assets (before using asset pipeline, more plugin used). a few of existing less stylesheets reference other stylesheets in @import directive relative paths. there problem arises, since lookup via relative paths doesn't work. example: first stylesheet: app/assets/stylesheets/shared/env.less second stylesheet: app/assets/stylesheets/shared/colours.less the first stylesheet referencing other one: @import "colours.less"; this fails. start working when modify reference using asset helpers: @import asset_path("colours.less") is way make relative paths work? mean changing lot of stylesheets references... or problem in setup of less-rails , should work? edit : even using asset helpers doesn't work me. way working using paths starting in assets root, this: @import "shared/colours.less"; after more research found ok use relativ

java - How to access Spring context from a depending project? -

suppose have 2 projects: projecta , projectb projecta depends on projectb and have context.xml locates @ projectb/target/test-classes/context.xml . need loat context projecta. in projectb have accesser class: class contextaccessor{ applicationcontext context = new classpathxmlapplicationcontext("context.xml"); public static applicationcontext getcontext(){ return context; } } while in projecta, i'm trying context using: contextaccessor.getcontext(); but throws exception message: caused by: org.springframework.beans.factory.beandefinitionstoreexception: ioexception parsing xml document class path resource [context.xml]; nested exception java.io.filenotfoundexception: class path resource [context.xml] cannot opened because not exist @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:341) @ please give suggestions. appreciation. you need make sure pro

Generate combinations of set inside set without intersection with values of current set in C# -

what (easy read , fast runtime) way of generating combinations of set (set of items) inside other set (set of groups) without intersection values of current set (items in same group)? for example have 2 simple classes. group contains set of item public class group { public string name { get; set; } public iset<item> items { get; set; } } public class item { public string name { get; set; } } as result have set of groups each 1 contains set of items configured like: var groupa = new group { name = "a", items = new hashset<item> { new item { name = "a1" }, new item { name = "a2" }, new item { name = "a3" } } }; var groupb = new group { name = "b", items = new hashset<item> { new item { name = "b1" }, new item { name = "b2" }, } }; var groupc = new group { name = "c", items = new hashset<

Silently handle errors in powershell -

i writing troubleshooting script determine ip addresses in our domain accessible wmi, , not. script read list of input parameters (about 18,000 lines), , output file ip address , username ip address, username problem is, when wmi error thrown, writes file ip address, get-wmiobject : rpc server unavailable. .....numerous lines of error i make such when wmi error thrown, writes following ip address, "wmi error" and here modified code reference #script_modified.ps1 $abc = $args $startinfo = $null $process = $null $standardout = $null <#previously created password file in c:\script\cred.txt, read-host -assecurestring | convertfrom-securestring | out-file c:\script\cred.txt#> $password = get-content c:\script\cred.txt | convertto-securestring $a = get-content "c:\script\test_input.txt" foreach ($b in $a){ $startinfo = new-object system.diagnostics.processstartinfo $startinfo.filename = "powershell.exe" $startinfo.argume

bash - How to write a tail script without the tail command -

how achieve in bash. it's question got asked in interview , think of answers in high level languages not in shell. as understand it, real implementation of tail seeks end of file , reads backwards. the main idea keep fixed-size buffer , remember last lines. here's quick way tail using shell: #!/bin/bash size=5 idx=0 while read line arr[$idx]=$line idx=$(( ( idx + 1 ) % size )) done < text ((i=0; i<size; i++)) echo ${arr[$idx]} idx=$(( ( idx + 1 ) % size )) done

firefox - How to add location-aware browsing in website? -

if open website http://www.reebok.com/ru-ru/search/?q=mens in firefox there popup asking me share location. here link http://www.mozilla.org/en/firefox/geolocation/ how can add in website? i guess reebok site using html5 geolocation api. try code below , should recreate behaviour. code taken directly page. https://developer.mozilla.org/en-us/docs/web/api/geolocation.getcurrentposition var options = { enablehighaccuracy: true, timeout: 5000, maximumage: 0 }; function success(pos) { var crd = pos.coords; console.log('your current position is:'); console.log('latitude : ' + crd.latitude); console.log('longitude: ' + crd.longitude); console.log('more or less ' + crd.accuracy + ' meters.'); }; function error(err) { console.warn('error(' + err.code + '): ' + err.message); }; navigator.geolocation.getcurrentposition(success, error, options);

java - Android: downloading large zipped file -

i've got problem in downloading large zipped file in android. when i'm downloading small file (i.e. 20 mb) ok, when trying download large file (i.e 100 mb) cannot unzip after downloading because corrupt. here code: final url url = new url(url)); final httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); file file = new file(mcontext.getfilesdir(), params[0]); file.getparentfile().mkdirs(); fileoutputstream fos; fos = new fileoutputstream(file); inputstream input = urlconnection.getinputstream(); bufferedinputstream bis = new bufferedinputstream(input); byte[] buffer = new byte[1024]; int read = bis.read(buffer); while(read != -1){     fos.write(buffer, 0, read);     read = bis.read(buffer); } fos.close(); bis.close();

performance - How accurate are JMeter results -

i using jmeter test web application. able run test , can see results using various listener. reduce resource when run more 1000 thread run jmeter in non gui mode , after completion of test view result in graph mode. want know how accurate jmeter results(average/median response time). let suppose if 1000 users using web application , have response time of 20 ms. if simulate 1000 users using jmeter , see average ,median time in jmeter. since jmeter creating lot of threads , has own processing , possible average/media response time in jmeter higher actual. as every load tool, need control injector : regarding os config (tcp, system tuning ...) machine power injector runtime behaviour of cpu, swap ... if injector in state, results accurate. see: http://www.dzone.com/links/see_how_to_make_jmeter_run_thousands_of_threads_w.html

c# - How to draw rectangle on screen showing where appbar window will dock -

i'm working on class descends wpf window class implements application toolbar functionality available in window 7 + shell (that is, calls win32 shappbarwindow dock edge of desktop , undock). idea can drag window around screen , when within distance of desktop edge, docks itself. because of need call win32 shappbarwindow function, , because working through wpf events not helpful, i've written window procedure works @ win32 level & hooked in using hwndsource.addhook method. procedure gets called first , processes needs process, , passes rest on wpf. i've been working on dragging logic , i'd give user visual indication window dock edge it's closest to, without docking it. end, i'd display transparent rectangle dashed border size window after docking in location be. if user releases left mouse button @ point, window docked @ edge. once mouse moved away edge, rectangle go away. i know how compute rectangle's size & location. how display

java - How do I use Jackrabbit when it is part of a global transaction? -

i using jackrabbit datastore , separate database rest of data. have deployed jackrabbit jca jboss 7.1.1. have debugged application , see session instance of type xasessionimpl . i getting session this: final credentials credentials = new simplecredentials("admin", "admin".tochararray()); try { final session session = repository.login(credentials); return session; } catch (repositoryexception e) { throw new runtimeexception(e); } i invoke session.save(); , session.logout() when done each time access it. correct when part of global transaction. not have knowledge distributed transactions etc please correct me if wrong. tried throw runtime exception inside 1 of methods annotated @transactional (using spring 3.2), data in datastore not removed. correct? doesn't data being added in data store removed if transaction rolled back? "testing" enviroment was: add content jackrabbit, database , throw runtime ex

migration - Django migrate model with user in a foreignkey fails -

im trying migrate django model: from django.contrib.auth.models import user class post(models.model): headline = models.charfield(max_length=200) slug = models.slugfield(max_length=200) body = models.textfield(blank=true, null=true) author = models.foreignkey(user, null=true, blank=true) i added author field after created model. here migration django creates: # encoding: utf8 django.db import models, migrations class migration(migrations.migration): dependencies = [('articles', '0002_auto')] operations = [ migrations.addfield( field = models.foreignkey(to_field=u'id', to=u'auth.user', blank=true, null=true), name = 'author', model_name = 'post', ), ] here traceback when try run ./manage.py migrate: operations perform: synchronize unmigrated apps: ckeditor, sessions, admin, messages, auth, staticfiles, contenttypes, django_extensions a

c# - Preventing overflow on agreggated measures -

according links below, there issue ssas produces silent overflowing on agreggated measures: http://gqbi.wordpress.com/2013/08/14/ssas-getting-a-negative-value-for-measure-that-has-been-used-in-a-sum/ http://social.msdn.microsoft.com/forums/sqlserver/en-us/01dc2413-e2f8-4d40-88fa-2faeb4f5dd1b/ is there way preventing programmatically changing source's datatype according measure's aggregationfunction property? intention "shift" types greater type when required. is, want know whether need perform change every aggregationfunction or not. thank you there no automatism anywhere prevent this. have know if maximum value can result aggregation may bigger data type using allows, e. g. if use smallint , if aggregated values between -2^15 (-32,768) , 2^15-1 (32,767) , or between -2^31 (-2,147,483,648) , 2^31-1 (2,147,483,647) integer . data types have restrictions. in case of used aggregation sum , simple case if have positive or 0 values input. in case,

uitableview - different height of section header in grouped tableview -

Image
got default grouped style table left screenshot in below, looks having different height of section header, top first 69 px measured, while rest 40 px. why? supposed same height, aren't they? so i'd make them method of tableview:heightforheaderinsection: , return 40 but.....it looks more worse! amplifies heights below middle one, if putting section title on...like below right pic. i wanna have same height of section header. how make work? yea strange. able make them adjusting height of section footers instead: - (cgfloat)tableview:(uitableview *)tableview heightforfooterinsection:(nsinteger)section { return 24; }

Python encoding issue involving special characters -

i running win7 x64 , have python 2.7.5 x64 installed. using wing ide 101 4.1. for reason, encoding messed up. special_str = "sauté" print string # saut├⌐ string # 'saut\xc3\xa9' i don't understand why when try print it, comes out weird. when write notepad text file, comes out right ("sauté"). problem when use beautifulsoup on string, comes out containing weird string "saut├⌐" , when output csv file, end html chunk containing weird bit. help! you need declare encoding of source file python can decode string literals. you can special comment @ top of file (first or second line). # coding:<coding> where <coding> encoding used when saving file, example utf-8 .

html - Safari on iPhone 5 not displaying slider on website -

Image
a friend of mine has asked me take @ website - http://www.nails-more.co.uk the slider right @ top of homepage isn't showing on safari on iphone 5 running ios 6.1.4. gets strange. works fine on iphone, not friend's - same same settings etc. have tried usual clearing history, rebooting etc. this comparison of how works on 1 device not other identical 1 - it seems work in other browsers. have tried safari iphone simulator online , works fine (found link on here somewhere). does know issue can be? bit hard tell screenshots can replicate you're describing disabling javascript (settings > safari > javascript off).

puppet - node definition is not being enforced -

i'm trying ramped on puppet (2.7.x), i'm encountering strange behavior node definitions. documentation, thought 'default' node catchall node wasn't explicitly matched elsewhere. however, i'm seeing default seems apply there exact match. example, have following in site.pp: import "services/*" node "cuda-farm-ljf1" { include hello } node default { include ntp } the thing in hello.pp is: class hello { notify { "hello test": } } what i'd expect 'ntp' class not apply 'cuda-farm-ljf1' node, isn't behavior i'm seeing. if uninstall ntp on node, reinstalled & started next time syncs master. missing obvious here? yes, missing obvious... when include classes under node default applies puppet client machines. learn more node default . http://docs.puppetlabs.com/puppet/2.7/reference/lang_node_definitions.html

jquery - image carousel showing all images -

for flipping reason image carousel showing images @ once. don't know why think has css. #full_image { overflow:hidden; position:absolute; } #full_image ul li img { width:100%; max-width:100%; list-style: none outside none; position: relative; overflow: hidden; } #full_image .full_close { background: url('icons/zoom-on.png') no-repeat; top: 10px; cursor: pointer; height: 29px; opacity: 1; position: absolute; width: 29px; z-index: 999; right: 10px; } #full_image .next_big { background: url('icons/arrow-right.png') no-repeat; top: 50%; cursor: pointer; height: 29px; opacity: 1; position: absolute; width: 29px; z-index: 999; right: 0px; } #full_image .prev_big { background: url('icons/arrow-left.png') no-repeat; top: 50%; cursor: pointer; height: 29px; opacity: 1; position: absolute; width: 29px; z-index: 999; left: 0px; color: #222; } <div id="full_image"> <ul><li><img src="&#

facebook - FB - Like - GeoIP Issues -

i have site has geoip redirect rules attached it. if user in usa , tries view canadian version of website, redirect them canadian version. each locale have own version of content , language (ie - our taiwan site has chinese, whereas our canadian site supports english , french). my problem when user likes our canadian site, facebook scrapes our american locale. similarly, happens other locales such britain. facebook scraping servers located in america? there way fix this? use facebook's debug tool see meta tags you're returning facebook, , stop redirecting facebook's crawler usa page; let access whichever geography-specific site asked , give meta tags describe site

sql server - C# - Determining if a Stored Procedure exists -

this question has answer here: stored procedure doesn't exist, or it? 3 answers i've written dbcontext extension try , determine if stored procedure exists within associated database. public static bool storedprocedureexists(this dbcontext input, string name) { int exists = input.database.executesqlcommand(string.format("select top 1 * [sys].[objects] [type_desc] = 'sql_stored_procedure' , [name] = '{0}';", name)); //return true; // if exists, else false } the problem is: regardless of whether stored procedure name exists or not, exists variable (returned execsqlcommand ) contains '-1'. unable determine if stored procedure in database or not. executing generated query in sql server management studio works expected, returning 1 row if stored procedure exists , no rows if if not. does ha

android - Automatically disable/enable a listener based on its Fragment visibility -

in android app, have two fragments : a fragment listview of items a fragment imageview through callback onlistitemselected, when user clicks on listview item, mainactivity pushes imageview on stack , fragment image appears on screen. @ point expect that, since listview fragment no longer visible, events associated fragment no longer fired. not case. if touch imageview, listeners of listview items still fire. two questions: is there way automatically enable/disable listeners based on fragment visibility? if not, guess way go disable listview fragment view , re-enable when backbutton pressed. how can capture backbutton event in mainactivity re-enable disabled view? public class mainactivity extends fragmentactivity implements listviewfragment.callbacks { [...] public void onlistitemselected(string str) { fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.

Search Engine Bug PHP&Mysql -

hi guys i've got problem in search engine. here's code: $types = mysql_real_escape_string($_get['type']); //convertion de if ($types = "air") { $searchq = "lf"; }elseif ($types = "huile") { $searchq = "of"; }elseif ($types = "carburant") { $searchq = "kf"; }elseif ($types = "habitacle") { $searchq = "cf"; }elseif ($types = "eau") { $searchq = "wf"; }else{ $searchq = "df"; } $searchq = preg_replace("#[^0-9a-z]#i", "", $searchq); $query = mysql_query("select * tproduct ssearch '%$searchq%'") or die("la recherche est impossible"); $count = mysql_num_rows($query); $result = mysql_query("select * tproduct ssearch '%$searchq%'"); but problem searchq takes value of lf . where problem in code please? if ($types == "air") { $searchq = "

Java ZK+Javascript JQuery Galleria IO FullScreenMode -

i using galleria plugin javascript need show image in full screen mode i have checked api and have method. .enterfullscreen( [callback] ) returns galleria set gallery in fullscreen mode. temporary manipulate document styles , blow gallery cover browser screen. note fill browser window, not client screen (javascript can’t that). api i using zk framework responding button click using code. public void imagezoomer() { clients.evaljavascript("$('#galleria').data('galleria').enterfullscreen(function() {alert('full screen mode');})"); } but nothing happens have try using clients.evaljavascript("imagezoomer()"); and javascript function this function imagezoomer() { alert('before'); $('#galleria').data('galleria').enterfullscreen(function(){alert('full screen mode');}) alert('after'); } the above function called nothing happens if try code on firebug console $('#gal

javascript - Uncaught Error: Error calling method on NPObject Error with embedded Youtube Video -

i have html page embedd youtube video following code: <iframe width="600" height="338" src="http://www.youtube-nocookie.com/embed/auhdhfghhahly?autohide=1&amp;theme=light&loop=1&playlist=edkaijxqwhq&amp;hd=1&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0&amp;wmode=transparent&amp;autoplay=1" > </iframe> the video runs fine, following error in console. blocked frame origin "https://www.youtube-nocookie.com" accessing frame origin "http://www.domain.com". frame requesting access has protocol of "https", frame being accessed has protocol of "http". protocols must match. uncaught error: error calling method on npobject. how can avoid error? "youtube-nocookie.com" redirects http request https uses sources inside of page, not secure. if don't have access source of "youtube-nocookie.com" there noth

javascript - Store table data using localstorage and passing it to a form -

right trying use html5's localstorage api grab value table, , pass value form. for example, when user clicks on "sign today" on form: http://yft.ac/upcoming-workshops/ , want information given row (date, time, location), heading above (ex: yft admissions insights) stored, , displayed in field "workshop interested in" on page: http://yft.ac/contact-us/ . i'm not best javascript here have far: contact us: $('input#workshop').text( localstorage.getitem('workshop') ); upcoming workshops page: $('body').on('click', 'a.button', function(){ var index = $(this).parents('table').index('table'); var cur_workshop = $(this).parents('.innercontent').find('h3').eq(index).text(); localstorage.setitem('workshop', cur_workshop); }); i tried piece above code isn't working, hope jump start might more well-versed in javascript. you have few problems in page

c# 4.0 - xml error: Non white space characters cannot be added to content -

i trying open xmldocument this: var doc = new xdocument("c:\\temp\\contacts.xml"); var reader = doc.createreader(); var namespacemanager = new xmlnamespacemanager(reader.nametable); namespacemanager.addnamespace("g", g.namespacename); var node = doc.xpathselectelement("/contacts/contact/g:name[text()='patrick hines']", namespacemanager); node.value = "new name richard"; doc.save("c:\\temp\\newcontacts.xml"); i returns error in first line: non whitespace characters cannot added content. the xmlfile looks this: <?xml version="1.0" encoding="utf-8"?> <contacts xmlns:g="http://something.com"> <contact> <g:name>patrick hines</g:name> <phone>206-555-0144</phone> <address> <street>this street</street> </address> </contact> </contacts> it looks you're attempting load xml file xd

node.js - Test if a function is asynchronous or not? -

i want test whether function in node.js asynchronous or not? the author of module says asynchronous want sure. hoping there way find out if asynchronous or not. how can check whether asynchronous or not? here's simple way test if code async: modify variable in callback , check if has changed after function call: var async_check = 0; maybe_async(function(){ async_check = 1; }); if(async_check){ console.log("maybe_async synchronous"); } else { console.log("maybe_async asynchronous"); }

Casting java.util.LinkedHashMap to scala.collection.mutable.Map -

import scala.collection.javaconversions._ val m = new java.util.linkedhashmap[string,int] val s: scala.collection.mutable.map[string,int] = m.asinstanceof[scala.collection.mutable.map[string,int]] returns following error java.lang.classcastexception: java.util.linkedhashmap cannot cast scala.collection.mutable.map what wrong here , how casting? tried scala.collection.javaconverters._ getting same error. importing javaconversions stuff doesn't make java's collection types instaces of scala collection types, provides handy conversion methods between 2 distinct collection hierarchies. in case, given import in question, can mutable scala map java linkedhashmap line: val s = mapasscalamap(m)

c++ - How to demonstrate the impact of instruction cache limitations -

Image
my orginial idea give elegant code example, demonstrate impact of instruction cache limitations. wrote following piece of code, creates large amount of identical functions, using template metaprogramming. volatile int checksum; void (*funcs[max_funcs])(void); template <unsigned t> __attribute__ ((noinline)) static void work(void) { ++checksum; } template <unsigned t> static void create(void) { funcs[t - 1] = &work<t - 1>; create<t - 1>(); } template <> void create<0>(void) { } int main() { create<max_funcs>(); (unsigned range = 1; range <= max_funcs; range *= 2) { checksum = 0; (unsigned = 0; < workload; ++i) { funcs[i % range](); } } return 0; } the outer loop varies amount of different functions called using jump table. each loop pass, time taken invoke workload functions measured. results? following chart shows average run time per function call in re

email - PHP - Send E-Mail From Any Address -

i working on website, , website, need have form can filled out sending e-mail. form must have place first , last name, place e-mail address e-mail being sent from, , place e-mail address message being sent to, place message subject, , of course, place message. know possible because have seen done in past, not know how it. please offer me this? appreciated. edit html <div id="contact" align="center"> <!--contact instructions--> <h1 align="center">contact us</h1> <p style="font-size:20px"> @ bottom of page find contact form in can submit questions. please describe problem best of ability, more details give us, faster response, , solution. </p> <form action="notphp.php" method="post" id="contact form" style="font-size:18px"> first name: <input type="text" name="first" r

jquery - toggleClass animation not working? or need help toggling animation -

i working code: $('#products h2').click( function() { $('.well').toggleclass('margin-left260', 100000); return false; } ); what want slide div on 260 using left margin, , have slide on click 0. don't understand why .toggleclass not animating me. i did earlier using .animate(margin-left,'260px); life of me figure out how use toggle have return margin of 0. missing here? i have added jsfiddle example here - http://jsfiddle.net/baxyr/ basically $('.clickme').click(function(){ if($('#moveme').hasclass('marginleft260')){ $('#moveme').animate({ marginleft: "-=260px", }, 5000, function() { $(this).removeclass('marginleft260'); }); }else{ $('#moveme').animate({ marginleft: "+=260px", }, 5000, function() { $(this).addclass('marginleft260'); });

c - why nginx don't use basic types directly? -

the code ngx_config.h typedef intptr_t ngx_int_t; typedef uintptr_t ngx_uint_t; typedef intptr_t ngx_flag_t; the prototype of intptr_t int, , corresponding uintptr_t u_int. seems sophisticated type hierarchy set nginx designer. confused why don't use basic type directly? in fact kind of type hierarchy makes code bit sophisticated. i know hierarchy can make easy when try modify type b change 1 line of code can lead better portability , change typedef xxtype typedef b xxtype, wonder if kind of type hierarchy on used in nginx? here clues on use staff? what's more, can tell more benefits or tricks kind of design:)