Posts

Showing posts from August, 2013

python - Redirecting Django built-in login View to a URL taking user's pk as argument -

i trying redirect url taking user's pk argument after successful log-in using django's built-in login view. instead of dynamic {{ next }} variable in login.html have generic landing view of logged-in users; <input type="submit" value="login" /> <input type="hidden" name="next" value="{% url 'userredirect' %}" /> in urls.py have; url(r'^users/', views.users, name='userredirect'), url(r'^(?p<pk>\d+)/', userhome.as_view(), name='userhome'), and in views.py have @login_required def users(request): url = reverse('userhome', kwargs={'pk':request.user.id}) return httpresponseredirect(url) what doing here redirect detail view have named userhome on user model after successful login using 2 redirects not know of way redirect userhome directly (it takes user's pk argument). works , indeed redirected user's homepage when checking v

selenium - webdriver won't cooperate with firefox -

i have been trying use webdriver run front-end selenium tests, refusing cooperate firefox. try start new firefoxdriver no arguments, , error message. it says selenium.webdriverexception: failed connect firefoxbinary(/usr/bin/firefox) on port 7055. then, says: disabling foreign installed add-on fxdriver@googlecode.com in app-profile. i have not installed add-ons since starting vm i'm running in. these errors mean? please check compatibility between firefox , selenium webdriver versions.

Populate Silverlight fields with javascript -

i've done searching answer , couldn't locate anything, if duplicate post feel free hound me , point me existing 1 :) i'm using silverlight web application doesn't have import feature user information. don't have access source code can't modify it. right i'm forced enter hand (copy/paste each field). have of user data electronically stored in database. what i'm looking able open page user information (name, address, height, etc) , able use javascript in browser auto-populate these information database. i'm pretty javascript let's put aside. the main question here: there way names of fields of silverlight application running in browser able this? looking @ page source don't see field names. script references actual silverlight app , initparams (not sure if these can modified js guess it's late time page has loaded). appreciate can provide. first encounter silverlight coding perspective. thanks, kris

SCons delete $TARGET on failure of any Action -

is there way emulate make's .delete_on_failure behavior? if have builder executes series of actions produce target, expect them operate atomically. if earlier action produces (incomplete) file, , later action fails modify it, target file deleted, instead of remaining in incomplete state. consider sconstruct file: def example(target, source, env): raise exception('failure') # more processing never happens... action_list = [ copy('$target', '$source'), chmod('$target', 0755), example, ] command( action = action_list, target = 'foo.out', source = 'foo.in', ) if example action fails, foo.out still exists, because first 2 actions successful. however, incomplete. interestingly, running scons again causes again retry build foo.out , though exists in filesystem. yes, looking getbuildfailures . expanding on example include feature... import atexit import os def delete_on_failure(

android - Open camera directly in the Activity without clicking on button and without intent? -

Image
i trying open camera without clicking on button doesn't work... i follow instructions here : http://developer.android.com/guide/topics/media/camera.html#custom-camera here result : when press button "capture", activates camera want activate camera before , record when click on button snapchat. think miss somewhere when open camera don't find mistakes... here class : @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); preview = (framelayout) findviewbyid(r.id.camera_preview); if (checkcamerahardware(this)) { mcamera = getcamerainstance(); mpreview = new camerapreview(this, mcamera); mcamera.setdisplayorientation(90); initbutton(); preview.addview(mpreview); preview.removeallviews(); preview.addview(mpreview); preview.addview(capturebutton); } } after that, have method initia

javascript - Simple Schema error in Meteor -

i using meteor accounts , simple schema users register , enter profile information in app. defined schema users , attached schema address it. however, when go register account, keep getting error "address required" although filled out required fields address. here's schema: schemas.useraddress = new simpleschema({ //useraddress schema defined streetaddress: { type: string, max: 100, optional: false }, city: { type: string, max: 50, optional: false }, state: { type: string, regex: /^a[lkszraep]|c[aot]|d[ec]|f[lm]|g[au]|hi|i[adln]|k[sy]|la|m[adehinopst]|n[cdehjmvy]|o[hkr]|p[arw]|ri|s[cd]|t[nx]|ut|v[ait]|w[aivy]$/, optional: false }, zipcode: { type: string, regex: /^[0-9]{5}$/, optional: false } }); var schemas = {}; schemas.userprofile = new simpleschema({ companyname: { type: string, regex: /^[a-za-z-]{2,25}$/, optional: false }, tiremarkup: { type: number, optional: true, min: 1 }, phonenum: {

javascript - Ember routing and application design -

This summary is not available. Please click here to view the post.

javascript - Output query results in HTML table to image -

this question has answer here: save html table image 5 answers i've done quite bit of searching no luck , i'm not sure if possible if can point me in right direction. i have php script queries database , places results html table. output table image (jpg, png, bmp, whatever...) i imagine have in js or ajax suggestion appreciated. thanks, i advise using gd. http://php.net/manual/en/ref.image.php also found: save html table image the issue have render html table , convert rendered html image. have example of table? if it's not complex, draw table results in it.

ios - remove object if string starts with @"type(music)" -

if have nsmutablearray many strings in it. possible remove objects start "type(music)"? array looks like: [0] = type(movie),name... [1] = type(music),name... [2] = type(movie),name... [3] = type(movie),name... [4] = type(music),name... you can use loop remove objects start "type(music)". nsmutablearray *array = ...; (nsstring *string in array) { if ([string hasprefix:@"type(music)"]) { [array removeobject:string]; } }

Trying to compare files opened using 'with open...' in Python 2.4 gives a SyntaxError -

how can compare 2 files in python 2.4.4? files different lengths. we have python 2.4.4 on our servers. use difflib.unified_diff() function can't find examples work python 2.4.4. all versions have seen on stack overflow contain following: with open("filename1","r+") f1: open ("filename2","r+") f2: difflib.unified_diff(..........) the problem have within version 2.4.4 with open ... generates syntaxerror. stay away using system call diff or sdiff possible. the with statement introduced in python 2.5 . it's straightforward want without it, though: a.txt this file 'a'. lines common, lines unique, want pony, poetry awful. b.txt this file 'b'. lines common, want pony, nice 1 swishy tail, poetry awful. python import sys difflib import unified_diff = 'a.txt' b = 'b.txt' a_list = open(a).readlines() b_list = open(b).readlines() line in unified_diff(a_list, b_list, f

postgresql - Permission denied when I try to restore postgres backup -

recently used command make backup of postgres databases pg_dumpall > bkpoldpg.sql after removing old version of postgres downloaded last version 9.4 , have tried restore old data using : mody@debian:~$ su postgres password: postgres@debian:/home/mody$ postgres@debian:/home/mody$ /usr/lib/postgresql/9.4/bin/psql -d postgres -f documents/bkp01dpg.sql documents/bkp01dpg.sql: permission denied as can see permission denied tried using sudo doesn't work : postgres@debian:/home/mody$ sudo /usr/lib/postgresql/9.4/bin/psql -d postgres -f documents/bkp01dpg.sql [sudo] password postgres: postgres not in sudoers file. incident reported. any please ? thanks! your backup file, or documents folder within, have permissions not permit access postgres user. you can give postgres user (and other users on system) right read them with: chmod a+x documents chmod a+r documents/bkp01dpg.sql alternately, copy bkp01dpg.sql location postgres user has access to

css3 - CSS blend mode for Bootstrap carousel caption -

i using carousel component bootstrap , want use css blend-mode background-blend-mode: multiply; caption. unfortunately, blend mode doesn't work. the code following: <div class="carousel-inner" role="listbox"> <div class="item"> <div class="carousel-caption"> caption content </div> <img src="imgage.png" class="img-responsive" /> </div> </div> the css following: .carousel-caption { background-color: rgba(0, 119, 137, 0.7); background-blend-mode: multiply; } is wrong way? you need assign background-image property same selector assigning background-blend-mode . may not work in case. from docs the background-blend-mode css property describes how element's background images should blend each other , element's background color. syntax example: .blended { background-image: url(face.jp

c# - How to Use AutoMapper for Find Method? -

how map method using automapper ? example: public ienumerable<paisviewmodel> find(expression<func<paisviewmodel, bool>> predicate) { return mapper.map<pais, paisviewmodel>( _paisservice.find(predicate)); } if it's 1 1 mapping of simple objects then: public ienumerable<paisviewmodel> find(expression<func<paisviewmodel, bool>> predicate) { return _paisservice.find(predicate).select(p => mapper.map(p, pais.gettype(), paisviewmodel.gettype())); } if objects complex or properties not 1 1 have make calls map.createmap define object mapping.

mysql - Inserting data from text files into pre-existing columns -

i trying insert data text file (18.9gb large) looks this: as8dyta89sd6892yhgeui2eg asoidyaos8yd98t2y492g4n2 as8agfuigf98safg82b1hfdy they length of 32 characters. have database named hashmasher , table called combinations columns named unhashed , sha256. have data stored in unhashed columns. looking like: unhashed | sha256 data | (completely empty) now wondering, how insert data existing columns aswell adding data second column, example above become unhashed | sha256 data | firstlineoftextfile data | secondlineoftextfile if use load data infile load new rows (that's i've been told) , load unhashed column aswell sha256 column. tl;dr want insert data text file second column of pre-existing rows. insert data load data infile new table. may temporary, speed thing bit. use insert ... select ... join merge 2 tables. i understand can take few hours 19g table. things more complicated, since original fi

google chrome devtools - Stop meteor live reload for particular folder -

is there hack or other method set ignore list of folders meteor's hot reload. example want prevent page reloading, when changing files in public folder you can use ".#name_of_folder". meteor ignores directories begin ".#"

python - Django 1.8 Migrations - "NoneType" object has no attribute "_meta" -

attempting migrate project django 1.7 1.8. after wrestling code errors, i'm able migrations run. however, when try migrate, i'm given error "'nonetype' object has no attribute '_meta'" there's no reference in traceback of apps, i'm unsure of go looking bug (as code include here can more helpful trying me) here's full text of traceback (venv)rtownley@ubuntu:~/projects/sparrow1/nj$ ./manage.py makemigrations no changes detected (venv)rtownley@ubuntu:~/projects/sparrow1/nj$ ./manage.py migrate operations perform: synchronize unmigrated apps: staticfiles, editor, djcelery, messages, getty, kombu_transport_django, debug_toolbar, utils, locking, petro, tokenapi, grappelli, django_extensions, selectable apply migrations: adops, taxonomy, issues, editorial, contenttypes, authors, auth, comms, membership, sessions, bento, urlalias, accounts, breaking_news, easy_thumbnails, images, admin, pages, documents, events synchronizing apps with

Functions as parameters in C -

i'm working on project intro c class, creating hash table implementation in c current question pertains how function written in code skeleton provided professor. here header definition of create method: table* create(long (*hash)(void* key), bool (*equals)(void* key1, void* key2), void (*print)(void* key1, void* key2)); this appears pointers functions parameters? i'm not sure how call this, or happens when called. i'm not sure these methods (hash, equals, , print) coming from. appreciated. thanks this appears pointers functions parameters? yes. i'm not sure how call this to invoke function create , pass addresses of functions right types call create : create(&f1, &f2, &f3); or happens when called. any place in body of create where(*) pointed function invoked, actual function (for instance f1 ) ends being called provided arguments. (*equals)(k1, k2); fictional example have occurred inside cre

windows - insert an application between microphone and other applications -

to best of knowledge, hasn't been asked or addressed before. here question: i using windows 8.1 , want write application work between microphone , other application uses microphone skype, hangout .... can further exemplify the application in mind follows: simple case add noise input of microphone whether being used skype or hangout or voice recording app. can think of signal processing method possible candidate application aside noise. i have make microphone input go through application whatever requests usage of microphone. know sounds overwriting microphone firmware @ application level. want redirect microphone input through application , give output of application microphone source other microphone dependent applications. do know of way or similar application? thanks help!

java - Time taken during memory profiling using yourkit -

how time take profile java application @ 100g memory consumption on 150g machine? started profiling 2 hours , 20% done of now. total memory used jvm since started profiling has gone 150g (close ram size). normal high memory processes take huge amount of time while profiling using yourkit or doing wrong. possible since memory has reached ram memory lots of disk swapping happening slowing down memory profiling. how can make process faster. if not possible make faster, other ways investigate memory leak in java application? well jvm is big :) if have running jvm, fastest way informations objects in heap take jmap histogram : jmap -histo:live <pid> it print live objects (:live gc) in heap, instances number, , (shallow) size. of course isn't suited complicated analysis, enough find leak, if leak big : compare histogram 1 have before leak. see doc @ http://docs.oracle.com/javase/7/docs/technotes/tools/share/jmap.html .

Split many ArcGIS rasters in parallel using Python multiprocessing -

i looking split 10 images 2 parts each (20 resulting images). images 4-band (r,g,b,nir) naip imagery available this website . using arcpy package arcgis split 1 image @ time: import arcpy, os inws = r'd:\temp\temp_naip' #contains ~10 .tif images outws = r'd:\temp\temp_naip_tiles' arcpy.env.workspace = inws rasters = arcpy.listrasters() ras in rasters: arcpy.splitraster_management( ras, outws, os.path.basename(ras).split('.')[0], split_method='number_of_tiles', format='tiff', num_rasters='1 2', overlap=50, units='pixels) how can integrate multiprocessing module above script process, say, 4 images @ time? btw, aware of blog post combines multiprocessing , arcpy , although examples specific vector data , cannot figure out how utilize tools process imagery. barring resource sharing issues, converting simple for-loop multiprocessing easy multiprocessing.po

r - Function on data.table environment errors -

can explain me why bar doesn't work? bug in data.table ? circles<-data.table(radius=1:10) foo<-function(circ){ circ[,diameter:=2*radius] } dput(x = foo,file = 'func.r') bar<-dget(file = 'func.r') foo(circles) bar(circles) it has fact dget function sets environment of object returns other .globalenv . there's easy enough work around, it'll drive rookie me nuts trying figure out why broke in first place. mydget<-function(file){ temp<-dget(file=file) environment(temp)<-.globalenv return(temp) } bar<-mydget(file = 'func.r') from dput : if x function associated environment stripped. hence scoping information can lost. parent.env(environment(bar)) # <environment: namespace:base> both foo(circles) , bar(circles) result in [.data.table getting dispatched, in case bar() , looking @ traceback() : traceback() # 6: stop("check is.data.table(dt) == true. otherwise, := , `:=`(...) defin

ios - How do I use auto layout to align images horizontal to each other -

Image
so here's problem, i'm attempting align 2 green images relative superview, retain same position on possible iphone screen sizes, noticed when pin trailing, leading, bottom , top edges of both superview, left image appears correctly right image appears squashed on iphones smaller widths (e.g 5, 4s, 5s). i can assume constraints of left image inevitably affecting constraints of 1 on right. although i'm not new auto layouts, i've never had deal situation of nature before, changes need make ensure images appear on screens, ones smaller widths. ps: reducing actual sizes of both images didn't solve issue either. thanks. update: space between images shrink/grow according screen size. space between them isn't goal, goal getting images appear trailing , leading superview shown in screenshot, not relative each other. i haven't tried this, is: left image: pin "left" , "top" edges superview. pin width , height right im

delphi - I need help on how to implement class that can be shown in object Inspector -

i have ... tdisppitch = class private ilinesize: integer; ilinecolor: tcolor; bdisplayaccent: boolean; bvisible: boolean; published property linesize : integer read ilinesize write ilinesize; ...etc end; ... and wanted feature shown in object insepector edit settings. i try adding property disppitch: tdisppitch read fdisppitch write fdisppitch. the disppitch can shown cannot see properties. linesize, linecolor etc. you must derive class tpersistent , or descendant, in order make available in object inspector: tdisppitch = class(tpersistent) private ... published property ... ... end; from delphi documentation: tpersistent ancestor objects have assignment , streaming capabilities.

CSS Table layout: make rows span full width without centering cells -

i have layout shown in fiddle: https://jsfiddle.net/4dbgnqha/4/ . reasons can read in this post, don't want change way page laid out. now, works well, issue when add border bottom of .item divs, realize don't span full width of page. can see in above fiddle, second .item down doesn't have enough content fill width, border doesn't reach full width. i thought fix adding .item { width: 100%; } , when that, image gets added enough additional width center p , looks weird. demo of that: https://jsfiddle.net/4dbgnqha/7/ i know fix if add set width image, mentioned in original post, want flexible, able have many image widths. know if wrap image in element , set element small width, 1px , work, seems hack, , reason i'm doing stupid table layout in first place i'm trying avoid such hacks. how can fix issue? you can add css, it's hack, works table layout. .item p { width: 100%; } https://jsfiddle.net/4dbgnqha/8/

Parse linux "top" in PHP? -

i'm working on monitoring tool in php. should display % cpu usage of single process pid . keep in mind can't use ps because takes total usage , divides time process has been running. that's average usage. need usage in moment php file ran. here's i'm trying, seems close need in terminal php won't print anything. $cmd = "top -n 1 -p 30100"; echo exec($cmd); is there maybe better way of doing this? can install utilities if provide functionality need. tl;dr need %cpu of process pid, simple possible avoid parsing top -n1 -p 30100 |grep -e 30100 | awk '{print $10}'

python - Compare two spreadsheets and extract the values -

i have 2 spreadsheets different number of rows , columns. what compare both , extract values of , b a1.xlsx match column names of a2.xlsx , copy values columns c , d in a2.xlsx. know how in excel index-match not using python's pandas. spreadsheet 1 ( a1.xlsx ) index b c 0 s 0.2 new york 1 d 1 vienna 2 g 2 london 3 c 3 tokyo 4 r 2 paris 5 d 1 berlin 6 8 madrid 7 f 10 seattle spreadsheet 2 ( a2.xlsx ) index b c d 0 dublin 34 x x 1 seoul 36 x x 2 london 12 x x 3 berlin 4 x x 4 tokyo 6 x x 5 seatte 22 x x assuming spreadsheet1 loaded pandas df , spreadsheet 2 loaded df1 can assign values result of merge : in [20]: df1[['c','d']] = df1.merge(df, left_on='a', right_on='c',how='left')[['a_y','b_y']] df1 out[20]: b c d index 0 dublin 34 nan nan 1 seoul

select - SQL - Finding if a single value meets criteria from one column -

this question has answer here: how return rows have same column values in mysql 2 answers i have these 2 groups of data cnu rent nbed category --- ---------- ---------- ---------- 101 200 2 3 102 220 3 3 103 180 2 2 104 120 1 1 105 300 3 4 106 350 3 4 107 360 3 4 108 400 4 4 109 500 3 5 110 600 4 5 aid eid cnu sid adate hours --- --- --- --- --------- ---------- a01 e08 101 s02 15-may-14 3 a02 e03 101 s03 16-may-14 4 a03 e02 102 s02 17-may-14 2 a04 e09 103 s01 14-may-14 3 a05 e06 105 s05 18-may-14 5 a06 e06 107 s04 15-may-14 3 a07 e03 108 s0

android - Populate the ListView of a CursorAdapter with running totals -

i have listview shows list of transactions bank account, recent @ top down oldest @ bottom. have each listview item display snapshot of account balance after specific transaction, way down footerview show starting balance account. example, suppose open account $300, , make 2 $50 withdrawals , $10 deposit. see this: | transdate | transamount | accountbalance | +-----------+-------------+----------------+ | 04/09/15 | +$10 | $210 | | 04/05/15 | -$50 | $200 | | 04/03/15 | -$50 | $250 | | 04/01/15 | start | $300 | currently, transactions table holds transaction date, amount, , whether withdrawal or deposit, able display first 2 columns above. i wrong, don't think it's safe hold account balance snapshot in database, field manipulated, , want best ensure counts reflective of current balance. for same reason, i'd third column calculated value when listview populates, don't know how adjust cursor

c - X11/xlib.h giving me XClearWindow errors -

i have program written in c code. fork of hsetroot. took add lot more options 1 can manipulate image , colors set ones desktop. user has more control on it. compiled , installed no errors whatsoever. i did on 32 bit debian linux os. went out , got me dual core 64 bit laptop ($50) install linux 64 bit. took program out dust off , maybe clean bit more, gp (general purpose). when tried compile on command line getting errors , no longer compile. code has not been changed whatsoever. therefore no error should seen. nevertheless getting error fails compile. funnier thing if use -m32 arg different fail compile error if use or not use -m46 arg. i compile using command or without -m64 arg following error. gcc `imlib2-config --cflags` `imlib2-config --libs` mhsetroot-v1.6.2.c -o myapp then error /usr/bin/ld: /tmp/cclrrrbo.o: undefined reference symbol 'xclearwindow' //usr/lib/x86_64-linux-gnu/libx11.so.6: error adding symbols: dso missing command line collect2: error

html - How to make a div that overflows parent div horizontally -

Image
i want make message stackoverflow informing can't vote in own questions. inspecting html of message div, overflows of it's parents. how can achieve bootstrap parent col div ? edit: in addition provided answer, had use white-space: nowrap ; because text inside message kept wraping parent's width you can use same stackoverflow: html <div class="message message-error message-dismissable"> <div class="message-inner"> <div title="close message (or hit esc)" class="message-close">×</div> <div class="message-text" style="padding-right: 35px;"> can't vote own post </div> </div> </div> css z-index: 1; display: none; color: #fff; background-color: #c04848; text-align: left; box-shadow: 0 2px 5px rgba(0,0,0,0.3); position: absolute; jquery and own jquery, because guess not doing own stackoverflow right? $(document).ready(fun

html - Does displaying none on duplicate content affect SEO/Semantics? -

does display: none on duplicate content affect seo/semantics? suppose you're building mobile-first, responsive site. @ smaller breakpoints, you've opted show page's heading tagline ( <h1> ) in main hero banner. however, later, you'd display company logo in same spot, , display tagline in sub banner. example: <!-- assuming following markup --> <header class="hero-banner"> <h1 class="hide-on-lg">company tagline</h1> <img src="..." class="show-on-lg" /> </header> <div class="subhead-banner"> <h1 class="show-on-lg">company tagline</h1> </div> ...with following css: .hide-on-lg { display: block; } .show-on-lg { display: none; } @media (min-width: 1200px) { .show-on-lg { display: block; } .hide-on-lg { display: none; } } the semantic rule should never have more single h1 on page, que

unix - Convert new lines to blanks within blocks of text separated by empty lines -

i have file below. block of data starts zone , after block of lines there horizontal white space, blank line. foo.txt zone name z_zebra_tiger vsan 900 * fcid 0x801e00 [device-alias test] * fcid 0x3d8b40 [device-alias tiger1] * fcid 0x3d8bc0 [device-alias tiger2] * fcid 0x3d8b60 [device-alias cat] zone name z_chili_yahoo vsan 100 * fcid 0x801400 [device-alias chilli] * fcid 0x803500 [device-alias yahoo] zone name z_tom_tommy vsan 100 * fcid 0x801400 [device-alias toma] pwwn 0x803460 [device-alias tommya] i want print below — starting zone word till blank line convert line print side side. zone name z_zebra_tiger vsan 900 * fcid 0x801e00 [device-alias test] * fcid 0x3d8b40 [device-alias tiger1] * fcid 0x3d8bc0 [device-alias tiger2] * fcid 0x3d8b60 [device-alias cat] zone name z_chili_yahoo vsan 100 * fcid 0x801400 [device-alias chilli] * fcid 0x803500 [device-alias yahoo] zone name z_tom_tommy vsan 100 * fcid 0x801400 [device-alias toma] pwwn 0x803460 [device-al

MySQL: start group by after a value is reached -

i'm trying group column 'new_treads' @ value 'response' first equals 1. id |treads |response ------------------ 1 | 1 | 0 2 | 1 | 1 3 | 2 | 0 4 | 2 | 0 5 | 2 | 1 6 | 2 | 1 7 | 2 | 1 ... | ... | ... 15 | 9 | 0 16 | 9 | 1 17 | 9 | 0 18 | 9 | 1 19 | 10 | 0 currently can use: select thread, count(response), sum(response) messages group thread to get: treads |count(response) | sum(response) ------------------------------------------ 1 | 2 | 1 2 | 5 | 3 9 | 4 | 2 10 | 1 | 0 but want start group by, or count(response), 'response' = 1. giving: treads |count(response) | sum(response) ------------------------------------------ 1 | 1 | 1 2 | 3 | 3 9 | 3

javascript - jQuery Sticky Plugin Variable Top Spacing -

i'm using jquery sticky plugin stick menu , contact information top. site responsive, spacing top menu changes. i'm trying different spacing based on css value of contact info, it's not working. pretty sure jquery correct... $(document).ready(function(){ function checkforfloat() { settimeout(checkforfloat, 100); if($("#contact").css("float") === "none") { $("#headerbg2").sticky({topspacing:180}); } else if (!$("#contact").css("float") === "none") { $("#headerbg2").sticky({topspacing:120}); } } }); http://jsfiddle.net/1j9cdsro/ to make dynamic changes sticky documentation needs unstick first , updated $("#headerbg2").unstick() & $("#headerbg2").sticky('update') this needs change (!$("#contact").css("float") === "none") either ($("#contact").css("float&qu

Rails - Number of POST request equals number of GET requests -

i'm trying make shopping cart app happen, reason seems number of post request equals sum of past requests. results in quite annoying behaviour! can't figure out why.. have idea? applicationcontroller: before_filter :current_delivery def current_delivery if session[:delivery_id] @delivery = delivery.find(session[:delivery_id]) else @delivery = delivery.create session[:delivery_id] = @delivery.id end end orderitemscontroller: def create @delivery.order_items.new(order_item_params) @delivery.save end productscontroller: def index @products = product.all @order_item = orderitem.new end products index: <% @products.each |product| %> <%= render "product_row", product: product %> <% end %> => partial product_row: <%= form_for @order_item, remote: true |f| %> <%= f.number_field :quantity, value: 1, class: "form-control", min: 1 %> <%= f.hidden_field :pro

Does template caching exist in Meteor or Iron-Router? -

is there way can cache templates or pages in meteor or iron-router? i'm trying build mobile application , issue scroll position lost , dom elements need recreated on page changes. so question not clear having trouble scroll position? quick answer no there no cacheing of elements because iron router (ir) destroying them, thing. meteor single page app scroll position can controlled ir. see if package help: https://atmospherejs.com/okgrow/iron-router-autoscroll again hard give clear answer because question vague.

mysql loop to create single output -

the problem i have table 'purchase' index salespersonnumber , productcode , purchaseid . productcode acts foreign key table 'product' there index price . there table 'purchase info' key offerprice . table composed of composite key keys productcode , purchaseid . i wanting able add every price salespersonnumber = x if offerprice > 0 row add total (instead of price ). is there way go doing mysql ? the atempt setting connections other tables: select * `purchase` inner join `product` on purchase.productcode = product.productcode inner join `purchase info` pi on purchase.productcode = pi.productcode , purchase.purchaseid = pi.purchaseid the final statement where salespersonnumber = "'.$x.'" now need come loop? pseudo code for each(number of rows belonging salespersonnumberx row){ if(row['offerprice'] > 0){ row['price'] = row['offerprice']; } total += row['

java - .alias file type for Android Studio? -

does know .alias far file type option goes android studio? 1 i'm working coming null because android studio associated text file. resource files placed in wrong folder, , can lead subtle bugs hard understand. check looks problems in area, such attempting place layout "alias" file in layout/ folder rather values/ folder belongs. as per reference this android documentation. there earlier reference alias file well, in same documentation. @ rate, suggest refer documentation , other official android documentation can find simple tidbits such 1 requested here.. when generate resource alias, resource pointing must of same type alias effectively, stating alias pointer 1 false location separate true location.. when using google search information, can more specific using keywords "or" , "and" quoting. find above information, searched google for: "android studio" , "alias file" which brought

css - Have side column appear in the middle on small screens -

i'm trying create layout using twitter bootstrap's grid 3 blocks a, b , c appear in order when stacked on small screens. on larger screens however, middle block b should move right , , c appear stacked left. the catch is, blocks have unknown heights , in fact, heights can change dynamically due collapsibles, tabs, etc. in particular, trouble when b higher a. the small screen layout supposed this: (in picture b high block indicated using 2 brackets.). [a] [b] [b] [c] on wider screens want render this: [a][b] [c][b] the straight forward code this: <div class="row"> <div class="col-md-6">a</div> <div class="col-md-6">b</div> <div class="col-md-6">c</div> </div> but layout contains ugly gap between , c because c placed below end of b. [a][b] [b] [c] .row { display: flex; flex-wrap: wrap } will solution, in addition can define order style every di

richfaces - Alternative for rich:page component in primefaces UI -

i working on migrating project in primefaces 5.1. the project done in rich faces. in our previous project use rich:page component page. need alternative component in primefaces 5.1 ui. kindly me on it. in advance. that simple answer. there none. if use facelets templating mechanism defines title etc, there no real need such component in bit humbl opinion

python - How to sort similar values in a sorted list (based on second value) of tuples based on another value(third value) in the tuple in descending order -

i have list of tuples of format [("d",21,5),(e,21,4),("a",20,1),("b",20,3),("c",20,2),...] where first values (a,b,c etc) unique , other 2 values in tuple might repeat.(like 20) i want sort list based on 2nd element(here 20,21) in tuple in ascending order, like [a,b,c,d,e] then want values sorted based on same numbers (a,b,c) sorted based on 20 , (d,e) based on 21 sorted based on 3rd value(here 1,2,3,4,5) of tuple in descending order, like [b,c,a,d,e] if original list looks this: l = [("d",21,5),(e,21,4),("a",20,1),("b",20,3),("c",20,2),...] then, can sort way want, defining 2-tuple key in sort function: l.sort(key=lambda t: (t[1],-t[2])) this ensures list sorted second element in tuple, while ties broken negated value of third element in tuple (i.e. in descending order third element)

html - Why does my header and navigation act differently on different pages with same CSS -

why header , navigation act differently on different pages? im trying make page has same navigation , header main page reason acts differently on second page i'm trying make though using same css. page one <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>amanda farrington</title> <link rel="stylesheet" href="css/demo.css" /> <link href='http://fonts.googleapis.com/css?family=roboto:400,300,500' rel='stylesheet' type='text/css'> </head> <body> <div id="header"> <div id="leftheader"> <img src="assets/logo2.jpg" alt="logo" style="width:65px;height:65px"> <h1>amanda farrington</h1> </div> <div id="nav"> <ul> <li><a href="index.html">about</a&

Azure WebJob - take parameters and create instances of the same webjob -

i have following scenario. have console app (let's call consoleapp.exe) takes parameter value , runs continuously. if have consoleapp.exe "cars" -- have app run "cars" now let's say, need "animals"' consoleapp.exe "animals" -- have app run "animals" essentially, need webjob created , run continuously each time there need new parameter value. consoleapp.exe "cars" --> webjob_cars consoleapp.exe "animals" --> webjob_animals consoleapp.exe "robots" --> webjob_robots which means, webjob gets created same consoleapp.exe except different parameter values. how go accomplishing this? copying amit's answer other question: this not possible out of box. there way though @ cost, can have 1 directory binaries (at place on site example: d:\home\site\wwwroot\app_data\jobs\common ) , have webjobs 1 run.cmd script each proper arguments calling common directory

javascript - css (or jQuery) fade on hover? -

i've been self-teaching myself css , javascript/jquery lately, however. i'm more sort learns dissecting code that's there. current "project" this: http://jsfiddle.net/wqc42v6p/ i've tried soemthing this: #premise {visibility:hidden;} #premise:hover {visibility: visibile;} with no results. i got thinking if premise div hidden, perhaps it's impossible hover on it. i'm not sure how make hovering on 1 div affect visibility property of another, either. if worked, imagine mouse isn't hovering on div :hover psuedo... might fade back... or theory. don't know. said, i'm self-taught. i'd have fade in when area's hovered on , out when hover leaves area. you may use opacity:0 , opacity:1 http://jsfiddle.net/p289a03w/

How to update a MySQL Database using a PHP form using MVC -

i doing school project. here link project http://www.dsu-class.com/zito82/lab10/ i need use mvc model code php application. i've gotten steps done except one. required add update input button list of customers. input button launch update form. when submit form supposed update customer data. i having 2 problems. created list of customers via foreach loop , assigns customerid each update button once pass through form cannot pull customerid pass through form. the second problem form not update mysql database. to clear, have follow mvc structure. easier me build php files instead of functions how supposed this. here code. have controller listed first, model(s) second, , view last. <?php require('../model/database.php'); require('../model/customer-db.php'); if (isset($_post['action'])) { $action = $_post['action']; } else if (isset($_get['action'])) { $action = $_get['action']; } else { $action = 'disp