Posts

Showing posts from April, 2012

python - Redefining a variable inside a loop -

i having problem getting 'undefined' error in code or, variable being incorrectly redefined. trying redefine variable inside loop each time loop executed. problem either (when variable defined outside loop) 'variable undefined' error, or variable not change and/or reset 0 when loop reinitialized. def game(): scoreplayer = 0 scoreai = 0 #if define here latter of 2 errors explained. number = random.randint(1, 6) print ("your score ", scoreplayer, ". opponent's score ", scoreai, ".") #this tells me referenced before defined if define outside loop. print (" ") print ("rolling...") print (" ") time.sleep(2) print ("you have rolled ", number, ".") print (" ") print ("player, hold (enter 'hold') or roll (enter 'roll')?") print (" ") decide = raw_input(" ") if decide == 'hold...

ruby on rails - on Linux, how can I resolve WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0 ? -

mac users, see: mac user , getting warning: nokogiri built against libxml version 2.7.8, has dynamically loaded 2.7.3 i'm using linux (opensuse 12.3) , running nokogiri -v shows: warning: nokogiri built against libxml version 2.8.0, dynamically loaded 2.9.0 # nokogiri (1.6.0) --- warnings: - nokogiri built against libxml version 2.8.0, dynamically loaded 2.9.0 nokogiri: 1.6.0 ruby: version: 2.0.0 platform: x86_64-linux description: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] engine: ruby libxml: binding: extension source: packaged libxml2_path: /home/william/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-suse-linux/libxml2/2.8.0 libxslt_path: /home/william/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/ports/x86_64-suse-linux/libxslt/1.1.26 compiled: 2.8.0 loaded: 2.9.0 the implicit question here seems "why getting warning, , can it?" you getting warning because nokogiri built (it largely native-extensio...

r - What does raster$fun do? -

i trying use code referenced in this post can't figure out why necessary run raster.list$fun = mean . (see answers in link) can tell me does? when using do.call() have supply arguments list : in provided link do.call function used mosaic list of raster images. first argument of function do.call() function want use (in case mosaic ), , sencond argument list of additional parameters. in case raster images plus function should used overlapping areas during mosaicing (here mean). so typing raster.list$fun = mean add new element called "fun" list, contains r-base function mean() . used input mosaic function invoked do.call. for more information please pages ?do.call , ?mosaic . hope helps.

css3 - Webkit keyframe not working in chrome -

why keyframes animation ( http://jsfiddle.net/zcfre/ ) not working in chrome? my css is: .circle1 { -webkit-animation: spinoffpulse 1s infinite linear; } @-webkit-keyframes spinoffpulse { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); }; } you've put semicolon after last curly brace of animation declaration. firefox accepted it, chrome didn't. after fixing it, animation spins again: http://jsfiddle.net/zcfre/1/ @-webkit-keyframes spinoffpulse { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } ; <--remove semicolon }

java - Can't hear any sounds from MIDI -

i'm starting java, , tryin' play sounds using midi. i'm following "head first" book. problem can't hear sound, here's code package pakedz; import javax.sound.midi.*; public class odtwarzaczmuzyki { public void graj(){ try { sequencer sekwenser = midisystem.getsequencer(); system.out.println("mamy sekwenser"); sekwenser.open(); sequence sekwencja = new sequence(sequence.ppq,4); track sciezka = sekwencja.createtrack(); shortmessage = new shortmessage(); a.setmessage(144, 1, 20, 100); midievent nutap = new midievent(a, 1); sciezka.add(nutap); shortmessage b = new shortmessage(); b.setmessage(128, 1, 44, 100); midievent nutak = new midievent(b, 16); sciezka.add(nutak); sekwenser.setsequence(sekwencja); } catch (exception ex) { system.out.println("kutasmarian"); } }; public static void main (string[] args){ odtwarzaczmuzyki radio = new odtwarzaczmuzyki(); ra...

PHP Oauth Client (1.0a & 2.0): App Keeps Asking Authorization -

i new oauth implementation , has been searching web libraries use , have found manuel lemos' oauth client . anyway, problem have right re-authorization everytime session expires. i implement oauth project using facebook, twitter, yahoo , google. i have managed working think lost in point after access token obtained , app has been authorized user. i encounter issue yahoo , twitter , google (except facebook) wherein when access token (or session) expires , using these "severs" again redirects authorization page , asks user authorize app (again). what should yahoo, twitter , google authorize once (except on revoked permissions) , when user returns , use again automatically obtain user data without asking authorization again? here's part of code performs request: if( ( $success = $client->initialize() ) ) { if( ( $success = $client->process() ) ) { if( strle...

How to Add a file to Google Drive via Docs Add On using App Script? -

this question has answer here: uploading multiple files google drive google app script 5 answers here scenario. i've created add-on google docs acts video toolbox. a feature i'm trying add ability record video using built in web cam (using videojs-recorder) , link video within doc. i've got video part working, not sure how webm js blob converted google blob can create file on users google drive sharing , linking. just figure out how might work i've done far without luck. client side code //event handler video recording finish vidrecorder.on('finishrecord', function() { // blob object contains recorded data // can downloaded user, stored on server etc. console.log('finished recording: ', vidrecorder.recordeddata); google.script.run.withsuccesshandler(function(){ console.log("winning"); }...

verilog - How to alternate two always blocks? -

i'd design simple verilog code, contains 2 blocks, executing alternatively, handshake. want use 2 flags, do_a , do_b control 2 blocks, block_a , block_b. expected result must ababab... there way correct following code? helping me. module tb; reg clock, reset, do_a, do_b; initial begin clock = 0; reset = 0; #50; reset = 150; #50; reset = 0; end #50 clock = ~clock; @(posedge clock) begin: block_a if (reset) do_b <= 0; else if (do_a) begin do_b <= 0; $display("a"); end end @(posedge clock) begin:block_b if (reset) do_a <= 1; else if (do_b) begin do_a <= 0; $display("b"); end end endmodule thanks vesiliy, following codes work desired results. always @(posedge clock) begin: block_a if (reset) do_b = 0; else if (do_a) begin do_b = 0; $display("a"); end ...

javascript - Can someone explain to me: appending elements to a target vs. assigning elements to a target? -

i made 2 simple functions can see in link . when first button clicked, create h3 element, create text, append text in element, , append element in id called results. but, when click on second button pretty same thing, except asked innerhtml of results , assign h3 element. but, when " [object htmlheadingelement] ". wondering why response though feel they're both doing same thing html: <button id="click"> click </button> <button id="click2"> click 2 </button> <div id="results"> hello </div> javascript: document.getelementbyid('click').onclick = function() { var = document.createelement('h3'); var b = document.createtextnode('this text!'); a.appendchild(b); document.getelementbyid('results').appendchild(a); } document.getelementbyid('click2').onclick = function() { var = document.createtextnode('this other text'); var b = document.createelem...

android - I have custom certain items in my listview but i want different textview in all the item in textview -

this list view , can see same text view in front of items , want change want different textview every item in list view. this activity contains 3 classes mainactivity1 , singlerow2 , shivvadapter package com.example.shivnandan.fit; import android.app.alertdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.res.resources; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.view.contextmenu; import android.view.layoutinflater; import android.view.view; import android.support.design.widget.navigationview; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import androi...

java - PDFbox runs into error (how to calculate the position for non-simple fonts) -

i using pdfbox fill form in pdf file, application able show number of available fields on form returns following error messages: error: don't know how calculate position non-simple fonts file: org/apache/pdfbox/pdmodel/interactive/form/pdappearance.java line number: 616 code ..... while (fieldsiter.hasnext()) { pdfield field = (pdfield) fieldsiter.next(); setfield(pdf, field.getpartialname(), "my input"); //setfield(pdf, field.getfullyqualifiedname(), "my input"); } ..... public void setfield(pddocument pdfdocument, string name, string value) throws ioexception { pddocumentcatalog doccatalog = pdfdocument.getdocumentcatalog(); pdacroform acroform = doccatalog.getacroform(); pdfield field = acroform.getfield(name); if (field != null) { field.setvalue(value); } else { system.err.println("no field found nam...

javascript - Website turns to landscape with keyboard -

Image
i've ran interesting problem. on website have 2 versions of navigation bar mobiles - landscape , portrait. detect these 2 use css media orientation. @media (orientation: landscape) { /* inline menu */ } @media (orientation: portrait) { /* multiple rows menu */ } however, when open keyboard page turns landscape, because actual page size becomes smaller. can me how fix this? can think focus event on inputs, whenever they're focused portrait manu turned on, change menu on landscape. here's illustrative image thanks! if check media queries w3c recommendation you find interesting sentence: the ‘orientation’ media feature ‘portrait’ when value of ‘height’ media feature greater or equal value of ‘width’ media feature. otherwise ‘orientation’ ‘landscape’. so, when keyboard opened, page turn landscape mode. there multiple ways overcome problem, can check this answer.

How to remove all products that are not in any category from catalog search result magento -

today i'm trying remove product not in category catalog search result collection. in mage\catalog\model\resource\product\collection.php tried add list of categories ids in search query in function _applyproductlimitations(): if (!isset($filters['category_ids'])) { $conditions[] = $this->getconnection() ->quoteinto('cat_index.category_id=?', $filters['category_id']); if (isset($filters['category_is_anchor'])) { $conditions[] = $this->getconnection() ->quoteinto('cat_index.is_parent=?', $filters['category_is_anchor']); } } else { $conditions[] = $this->getconnection()->quoteinto('cat_index.category_id in(' . implode(',', $filters['category_ids']) . ')', ""); // $conditions[] = $this->getconnection()->quoteinto('cat_index.category_id = 102'); // $conditions[] = $t...

How to save and open file order Java GUI -

so problem is last buttonpanel. don't know how save , open file gui, can total yea appreciated. "the user should able click button labeled total displays total purchase price in label (the total should include michigan 6% sales tax). button allows user save order file. yet button allows user open order file." for saving "additionally, before save committed, program should ask user if sure want save file. should able indicate if want save or not pop dialog. if user indicates not want save file, order not saved. if indicate want save it, file created (or overwritten) new order. name of order file order.txt." for opening "your program should able open file saving it. when program opens order, gui components should set appropriate values reflect order in file. if order.txt file not yet exist (i.e., order has never been saved), dialog box displayed telling user "no saved order available", , main gui remains unchanged." import java...

osx - ANT build script not working in Sublime Text 3 on Mac using El Capitan -

i'm using ant build script i've used in previous versions of osx. since upgrading el capitan i've been getting following error displayed in sublime console. java_home exist, reason sublime , sublime has issue using it: error: java_home not defined correctly. cannot execute java [finished in 0.0s exit code 1] running same ant build script terminal window works fine. wondering if knew why sublime having issue finding java_home build script i'm attempting run: "cmd" : ["ant", "-buildfile", "${project_path}/ant/build/ant_build.xml", "build-and-copy-to-deploy-debug"], "osx": { "path": "/usr/local/bin" } thanks!

bash - awk script works on pure file, but dont work with tail+2 -

i have script gets maximum value of 3 columns of selected file. if file pure works good, if try pipe file tail+2 doesnt work anymore. there code: begin {max1 = 0; max2 = 0; max3 = 0} { if(max1 < $1) max1 = $1 if(max2 < $2) max2 = $2 if(max3 < $3) max3 = $3 } end {print max1, max2, max3;} i execute code : awk -f [codefilename] [targetfile] works 100% good i execute code (want remove first line before counting): awk -f [codefilename] [targetfile] | tail+2 it fails thank , time. consider example: awk -f codefilename targetfile | tail+2 first of need space between tail , +2 . secondly happening output awk command piped tail writing: awk -f codefilename targetfile > tmp1 tail +2 tmp1 what guess want take first line targetfile , run awk code on it, if that's case need: tail +2 targetfile | awk -f codefilename afaik tail +n not supported distros, , need sed -n '2,$p' instead. if can clarify, please do.

java - Android: Save view that was added in RecyclerView with SharedPrefs -

i'm adding views recyclerview clicking on button, want views saved, preferably in sharedprefrences how , need json? here's adapter: public class subjectsadapter extends recyclerview.adapter<subjectsadapter.viewholder> { public list<string> items = new arraylist<>(); public activity mcontext; public subjectsadapter(activity context) { this.mcontext=context; } public void additem(string name) { items.add(name); notifyiteminserted(items.size() - 1); } public void removeitem(int position) { items.remove(position); notifyitemremoved(position); } @override public viewholder oncreateviewholder(viewgroup parent, int viewtype) { layoutinflater inflater = layoutinflater.from(parent.getcontext()); view view = inflater.inflate(r.layout.grid_item_button, parent, false); view.requestfocus(); return new viewholder(view); } @override public...

Python class inheritance and super() behavior? -

i'm attempting teach myself super() , class inheritance in python unsuccessfully. given following code, can tell me why expect happen...isn't? import random enemy_list = [] class entity(object): def __init__(self, name=''): self.name = name self.health = 1 self.attack_power = .05 class enemy(entity): def __init__(self, name, target): super(enemy, self).__init__(name) self.lvl = random.randint(target.lvl - 2, target.lvl + 2) self.health *= self.lvl * target.health self.attack_power *= self.lvl def createenemy(enemy): enemy_list.append(enemy(enemy, player)) return enemy_list enemy_amount = random.randint(1, 5) while enemy_amount > 0: createenemy(enemy("goblin", player)) enemy_amount -= 1 in enemy_list: print "(", i.lvl, i.name, i.attack_power, i.health, ")" why code outputting: ( 2 <__main__.enemy object @ 0x7faa040b3050> 0.1 80 ) ( ...

Unavailable language analyzers in Elasticsearch -

i working on analyzing text documents different languages (mostly in european languages) using elasticsearch, helps how deal languages don't have dedicated analyzer such croatian, polish, slovenian , on? some time ago, working on text search application in slovenian language elasticsearch , python. here have blog post efficient search in local language , sample code . hope helps

c# - Return DataRow whose field is the max for specified column -

i want able datarow datarow array datarow has maximum value specified column in of datarows. i imagine follow suit linq statement dim minrow datarow = mydatarows.asenumerable.min(function(row) row.field(of decimal)("mycolumnname")) however max function returns decimal instead of datarow. there easy syntax handles such query me? and before asks, tag c# since in winforms can converted between each other using website. if can use morelinq , can done using maxby() : var maxrow = mydatarows.maxby(r => r.field<decimal>("mycolumnname")); but using regular linq : var minrow = mydatarows.orderby(r => r.field<decimal>("mycolumnname")).firstordefault(); var maxrow = mydatarows.orderby(r => r.field<decimal>("mycolumnname")).lastordefault();

ios - Xcode 7 - /n vs. /u2028 in Strings within plist -

having weird issue can't seem figure out. have plist contains strings line breaks. i'm using xcode plist editor. perform line break, pressed option+return within strings want them, , shows fine in editor. the weird behavior: when have app parse these strings, of strings show \n put break, , other strings show \u2028 instead. understand reading these both escapes, can't figure out why xcode gives me 1 or other. there way can force give me \n instead of \u2028? i'd rather not have manually process strings after-the-fact change it example: "hello\nworld!" - want , this... "hello\u2028world!" - don't want , this... pulling hair out. thanks! edit: here's how i'm getting strings. in .plist editor: in .plist, have dictionary. in dictionary strings. "created , defined" in editor. in code: //get config variables nsstring *path = [[nsbundle mainbundle] pathforresource:@"variables" oftype:@"plist...

c - Redirect STDOUT and STDERR to file ">&" -

i've coded , i'm unsure how work other way. appreciate example code of how test correctness. thanks help dup2(stdout_fileno, stderr_fileno); dup2(fd, stdout_fileno); you close, need 2 dup2 calls in opposite order. dup2(fd, stdout_fileno); dup2(stdout_fileno, stderr_fileno); close(fd); your code equivalent posix shell syntax (which available in shells syntax based on bourne shell): 2>&1 >filename which makes stderr go old stdout while redirecting stdout file.

html5 - How to clear localstorage in IE11? -

i want clear local storage in ie11, know in previous versions have network tab, there can select local storage , delete objects, in ie 11 can see localstorage objects console of ie11, not able clear using "localstorage.clear()" please let me know how delete local cache in ie11 try calling localstorage.clear(); and/or sessionstorage.clear(); in console of ie developer tools (you can hit f12 key open developer tools) 'console' tab, run javascript function calls there.

php - new article is not getting submitted in codeigniter -

<?php class admin extends my_controller { public function dashboard() { /* if(! $this->session->userdata('user_id')) // condition check condition show dashboard if person logged in else redirect login page. return redirect('login'); */ $this->load->model('articlesmodel','articles'); // "articles" secondary name have given here , refering to. $articles = $this->articles->articles_list(); // if have given secondary name need use seconary name here too. // in above line, titles/title stored in $articles. $this->load->view('admin/dashboard.php',['articles'=>$articles]); // passing received articles in here. // above 'articles' received "dashboard.php" in form of "$articles". } ...

wordpress - mulitiple audio files javascript on single page -

so found snippet of code quick audio play button https://siongui.github.io/2012/10/12/javascript-toggle-sound-onclick/ . want incorporate multiple audio files on page load, audio buttons created play last audio file. enter code here play audio browser not support audio format. <script type="text/javascript"> function togglesound() { var audioelem = document.getelementbyid('creditcardfem'); if (audioelem.paused) audioelem.play(); else audioelem.pause(); } function togglesoun() { var audiocreditm = document.getelementbyid('creditcardma'); if (audiocreditm.paused) audiocreditm.play(); else audiocreditm.pause(); } </script> <div class="audioplayer"> <button id="player" type="button" onclick="javascript:togglesound();"> play audio </button> <audio id="creditcardfem"> <source src="http://www...

amazon web services - StatusCheckFailed Cloud Watch Alarm for Auto Scaling Group remains in INSUFFICIENT_DATA after being created with terraform -

i trying add cloud watch alarm existing auto scaling group. after running terraform apply, can see alarm listed under cloudwatch section of aws console. however, alarm's state stay in insufficient_data . state details contains message state changed insufficient_data @ 2016/04/19. reason: unchecked: initial alarm creation the terraform resource i've used create alarm below: resource "aws_cloudwatch_metric_alarm" "dwalters_status_check_failed" { alarm_name = "dwaltersstatuscheckfailedtest" alarm_description = "test if alarm goes insufficient_date -> ok after being initialized" comparison_operator = "greaterthanorequaltothreshold" dimensions = { autoscalinggroupname = "test-autoscaling-group" } evaluation_periods = "1" metric_name = "statuscheckfailed" namespace = "aws/ec2" period = "300" statistic = "maximum" ...

SQL ORACLE Sub query. need to fix my outcomes -

i have database thousands of data. name of table person11 i need select concatenated name, jobtitle , salary of people have cat value of n , salary @ least 30 percent higher average salary of people jobtitle , cat value of n. 3 column headings should name, jobtitle , salary. rows should sorted in traditional phonebook order. so far code: select initcap(fname || ' ' || lname) name, initcap(jobtitle) jobtitle, salary person11 upper(cat) = 'n' , salary >= 1.30 * ( select avg(salary) person11 upper(cat) = 'n') order upper(lname), upper(fname); this gives me output of people 30 percent higher average salary cat value of n. how can find of people 30 percent higher average salary of people job title , has cat value of 'n'? you need add codition jobtitle : select initcap(fname || ' ' || lname) name, initcap(jobtitle) jobtitle, salary person11 p upper(cat) = 'n' , salary >= 1.30 * ( select avg(s...

How do I add waze incident markers to a google maps javascript API-generated map with traffic? -

i created map showing traffic google maps javascript api using trafficlayer object. googlmaps.com-generated map of same area displays waze incident icons, not show on map. there way include incident markers when generating traffic map? here code: <script> var map; function initmap() { map = new google.maps.map(document.getelementbyid('map'), { center: {lat: 37.794086, lng: -122.400445}, zoom: 12 }); var trafficlayer = new google.maps.trafficlayer(); trafficlayer.setmap(map); } </script> <script src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxx&callback=initmap" async defer></script> at present impossible add layer incidents / constructions markers on google traffic map. discussion on topic takes place since 2010 , available on site: https://code.google.com/p/gmaps-api-issues/issues/detail?id=2411 it remains wait response of google developers.

mocking - Mock flask.request in python nosetests -

i'm writing test cases code called via route under flask. don't want test code setting test app , calling url hits route, want call function directly. make work need mock flask.request , can't seem manage it. google / stackoverflow searches lead lot of answers show how set test application again not want do. the code list this. somefile.py ----------- flask import request def method_called_from_route(): data = request.values # data here test_somefile.py ---------------- import unittest import somefile class somefiletestcase(unittest.testcase): @patch('somefile.request') def test_method_called_from_route(self, mock_request): # want mock request.values here i'm having 2 issues. (1) patching request i've sketched out above not work. error similar "attributeerror: 'blueprint' object has no attribute 'somefile'" (2) don't know how mock request object if patch it. doesn't have return_value...

java - Retrofit 2 - URL Query Parameter -

i using query parameters set values needed google maps api. the issue not need & sign first query parameter. @get("/maps/api/geocode/json?") call<jsonobject> getlocationinfo(@query("address") string zipcode, @query("sensor") boolean sensor, @query("client") string client, @query("signature") string signature); retrofit generates: &address=90210&sensor=false&client=gme-client&signature=signkey which causes call fail when need be address=90210&sensor=false&client=gme-client&signature=signkey how fix this? if specify @get("foobar?a=5") , @query("b") must appended using & , producing foobar?a=5&b=7 . if specify @get("foobar") , first @query must appended using ? , producing foobar?b=7 . that'...

Phishing alert in Magento admin -

i have strange phishing alert in magento admin of website. appear on "my account" page, without additionnal information on origin of problem. except page, entire website work perfectly, cms date (1.7.0.2) , have no alert in google webmaster tools. capture du 2013-07-01 10 47 06 sur imagesia http://img.imagesia.com/fichiers/9h/capture-du-2013-07-01-10-47-06_imagesia-com_9hnc_large.png thank help.

javascript - How to get return value on onLoad event -

<html> <head><title>body onload example</title> </head> <body onload="sum(2,3)"> welcome page </body> </html> function sum(var x,var y){ var z=x+y; return z; } my problem want store return value of function sum in variable can use later make global : var z; function sum(x,y) { z=x+y; } now should available anywhere else in script. i believe trying do: script : var z; function sum(x,y) { z = x + y; document.getelementbyid("mysum").innertext = z; } html : <body onload="sum(2,3)"> welcome page value of <p>sum : <span id="mysum"></span></p> </body> demo

javascript - How and when to use preventDefault()? -

from tutorial , said: preventdefault(); 1 thing: stops browsers default behaviour. i searched online examples of preventdefault() , can see in 2 situations (link, form) use preventdefault() : prevent submit button submitting form , prevent link following url. so, question is: in other situations can use preventdefault() ? how find out browsers default behaviour? e.g. if click button, browsers default behaviour? 1.in else situation can use preventdefault()? actually type of event, can stop default behavior preventdefault(); not submit buttons, keypresses, scrolling events, name , can prevent happening. or if you'd add own logic default behavior, think of logging event or of choice. 2.how find out browsers default behaviour? e.g. if click button, browsers default behaviour? what mean this? default behavior kind of implied. when click button, onclick event fires. when click submit button, form submitted. when windows scrolls, onscroll event fires...

javascript - Place a horizontal rule in a div -

i have div used display users data. this div used simulate how users data printed. users printed data can 1 or many pages long. i trying simulate page break on div each time height of div reaches height of 3507px. i have searched & google find solution, stumped. unsure if can accomplished using css or jquery. how display horizontal rule or other such line break indicator in div (to indicate page break) each time height of div reaches height of 3507px? here html code of div: <div style="border: 2px dashed red;"> <div id="live_preview" class="livepreview_resumewrapper2"></div> </div> here css: .livepreview_resumewrapper2 { background: #fff; border: 1px solid #000; box-shadow: 10px 10px 5px 0 #888; direction: ltr; padding: 20px; width: 100% } i appreciate suggestion. thanks. the idea occures me is: 1)get height of page var page_height = $('.page').height(); 2...

java - exception handing -

i created program should let user enter loan amount , loan period in number of years text fields, , should display monthly , total payments each interest rate starting 5 percent 8 percent, increments of one-eighth, in text area. may sound stupid not sure how add exception handling add exception handling when non-numeric value entered.for example instead of entering 5 number of years, user enters five.the application should display error message. in advance. package loan; import javafx.application.application; import javafx.scene.scene; import javafx.stage.stage; import javafx.scene.control.label; import javafx.scene.control.textfield; import javafx.scene.control.textarea; import javafx.scene.control.button; import javafx.scene.control.scrollpane; import javafx.scene.layout.hbox; import javafx.scene.layout.borderpane; import javafx.geometry.pos; public class loan extends application { protected textfield tfloanamount = new textfield(); protected textfield tfnumberofyears ...

How to put different columns together in SQL Server -

Image
i have table showing in picture. how make file bp1~pt1~clm1~p1~p2~p3~**clm2~p1~p2~|~pt2~clm1~p1~p2~**~clm2~p1~\n bp2~pt1~clm1~p1~pt2~clm1~p1~\n thank you

python - How to dispose of an observable on completion of another observable? -

i have source observable subscribe logger observer logging purposes. i subscribe source can perform computations. when computations completed, i'm done source , want dispose of logger : +-------------------+ | | +---------+ source observable +--------+ | | | | | +-------------------+ | | | | | +--v---------------+ +------------v--------+ | | | | | logger | | computations | | (observer) | | (observable) | +-------^----------+ +-----------+---------+ | | | | | dispose logger | +--------------------------------+ when computations completed however, logger doesn't ...

Commons Configuration2 ReloadingFileBasedConfiguration -

i trying implement apache configuration 2 in codebase import java.io.file; import java.util.concurrent.timeunit; import org.apache.commons.configuration2.propertiesconfiguration; import org.apache.commons.configuration2.builder.configurationbuilderevent; import org.apache.commons.configuration2.builder.reloadingfilebasedconfigurationbuilder; import org.apache.commons.configuration2.builder.fluent.parameters; import org.apache.commons.configuration2.convert.defaultlistdelimiterhandler; import org.apache.commons.configuration2.event.eventlistener; import org.apache.commons.configuration2.ex.configurationexception; import org.apache.commons.configuration2.reloading.periodicreloadingtrigger; import org.apache.commons.configuration2.compositeconfiguration; public class test { private static final long delay_millis = 10 * 60 * 5; public static void main(string[] args) { // todo auto-generated method stub compositeconfiguration compositeconfiguration = new ...

http - Facebook graph API response size limiting (error code 1) -

just sharing information came across while testing application. facebook graph api implements rate limiting described on documentation page . today trying retrieve feed cnn facebook page , got following 500 error: {"error":{"code":1,"message":"please reduce amount of data you're asking for, retry request"}} this query trying test: https://graph.facebook.com/v2.3/5550296508/feed?fields=id,actions,application,caption,created_time,description,from,icon,is_hidden,link,message,message_tags,name,object_id,picture,place,privacy,properties,source,status_type,story,story_tags,to,type,updated_time,with_tags,shares,likes.limit(50),comments.filter(stream).limit(50){attachment,created_time,from,id,like_count,message,message_tags,comments{attachment,created_time,from,id,like_count,message,message_tags}}&access_token=xxxxxxx i tried set different limit values reduce size, , worked. inspecting response size , playing around bit, ...

dnx - How to determine output folder of dnu/dotnet publish -

when publish project dotnet publish it outputs folder bin/debug/dnxcore50/osx.10.11-x64/publish (or perhaps release equivalent) is possible determine folder location postpublish script specified in project.json file? thanks fast response on dotnet/cli gitter channel, can. following variables available: %publish:projectpath% %publish:configuration% %publish:outputpath% %publish:targetframework% %publish:fulltargetframework% %publish:runtime% source and here ones pre/postcompile: %compile:targetframework% %compile:fulltargetframework% %compile:configuration% %compile:outputfile% %compile:outputdir% %compile:responsefile% %compile:runtimeoutputdir% %compile:runtimeidentifier% %compile:compilerexitcode% // postcompile source

python - Converting expression involving tranpose of vector to numerical function with lambdify -

i have written script in python uses sympy compute couple of vector/matrix formulas. however, when try convert functions can evaluate sympy.lambdify, a syntaxerror : eol while scanning string literal here's code same error, can see mean. import sympy x = sympy.matrixsymbol('x',3,1) f = sympy.lambdify(x, x.t*x) so, syntax error has expression "x'.dot(x)" , conversion of ".t" '. how can work around correctly define f above lambdify? found work around, although not cleanest looking solution... works. use implemented_function() method sympy define function. read full documentation here: http://docs.sympy.org/latest/modules/utilities/lambdify.html here code: import sympy import numpy np sympy.utilities.lambdify import implemented_function x = sympy.matrixsymbol('x',3,1) f = implemented_function(sympy.function('f'), lambda x: x.t*x) lam_f= sympy.lambdify(x, f(x)) hope solves problem :)

How to disable clipboard in Vim -

vim on ssh linux system taking long time @ startup. profiling vim --startuptime found problem setting clipboard: clock elapsed: 5042.066 5041.140: setup clipboard is there way disable step? never use anyway , i'd rather have quicker startup. found solution more googling: set clipboard=exclude:.* now startup time quick!

javascript - chart.js v2: how to add tooltips of metadata? -

i want add metadata each tooltips. data is x.label=['jan.', 'feb.','mar.','apr.','may','jun'] x.data=[-30,-24,-10,4,12,15] x.metadata=['extrmely cold','exreme cold too','mostlry spring','spring has come!', 'sakura blooming' ,'hot!'] when click (apr., 4) tooltip shows 'apr., 4°c \n spring has come!' how can edit tooltip function? this works me. created array (myarr variable) tooltip.callbacks.label function, , appended return value. think, if put x.metadata values myarr, works. var options = { tooltips: { enabled:false, callbacks:{ label: function(tooltipitem, data) { var myarr = [11,22,33,44,55] var datasetlabel = data.datasets[tooltipitem.datasetindex].label || ''; ...

android - Gradle runs fine under interactive account but not under NT service -

we have batch file build our android application. runs gradlew.bat assemble . when remote desktop build machine (windows 8) , run batch file, builds expected. however, when invoke batch file through nt service, start getting errors. the account service runs under have administrative privileges on machine. the first error javax.net.ssl.sslhandshakeexception . based on post android studio gradle build failed. error:cause: peer not authenticated , modified gradle-wrapper.properties use http instead of https distribution url. took care of problem. the next error similar time downloading pom file. based on post android- gradle: issue occurred configuring root project android studio , modified build.gradle use http://jcenter.bintray.com/ url instead of default https . now getting following error: could not parse pom http://jcenter.bintray.com/com/android/tools/build/gradle/1.1.0/gradle-1.1.0.pom i wondering why https cause problem in nt service account not in normal...

vba - Getting an error when trying to use the Controls() function on an access form -

i'm trying build sql insert statement several form control values in access. i've read use controls() function dynamically reference controls. i've tried this: private sub insertcoeff(byval prov string, byval region string) dim strsql string dim insertsql string dim valuessql string insertsql = "insert 'coefficient de fermage'" valuessql = "(" valuessql = valuessql & "('1f','2f')" valuessql = valuessql & ",('" & me.controls(prov & region & "lbl") & "','" & me.controls(prov & region & "lbl") & "')" valuessql = valuessql & ",('" & me.controls(prov & "lbl") & "','" & me.controls(prov & "lbl") & "')" valuessql = valuessql & ",('" & me.controls(prov & regi...

php - Mongodb and Twitter array -

code : $m = new mongoclient(); $db = $m->selectdb('twitter'); $collection = new mongocollection($db, 'status'); $cursor = $collection->find(); foreach ($cursor $document) { echo $document['statuses'][0]['text']; } array : array ( [_id] => mongoid object ( [$id] => 123 ) [statuses] => array ( [0] => array ( [text] => tweet no 1 ) [1] => array ( [text] => tweet no 2 ) [1] => array ( [text] => tweet no 3 ) ) ) the output : tweet no 1. how whole 'text' array? should return 'tweet no 1, tweet no 2, tweet no 3' instead. i've tried echo $document['statuses']['text'] doesn't work. right query returning collection, iterating correctly. issue is collection single document , printing first status in ...

javascript - jQuery drag and drop extend item -

i trying create html table in can drag , drop items cell cell. managed find related code , modified example , result: html: <table id="#our_table" border="1"> <tr> <th>column 1</th> <th>column 2</th> <th>column 3</th> </tr> <tr> <td><span class="event" id="item1" draggable="true">item 1</span> </td> <td><span class="event" id="item2" draggable="true">item 2</span> <span class="event" id="item3" draggable="true">item 3</span> </td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> css: table th, table td { width: 200px; height:70px; padding: 5px; } table span { display:block; background-color: #ccc; ...

javascript - How to put sequence number in first column in bootgrid table with php server side -

i tried practice examples on bootgrid command buttons , having trouble when putting sequence number in first column. please me. thank you. <table id="bootgrid" class="table table-bordered"> <thead> <tr> <th>number ?? </th> <th data-column-id="barcode" data-type="numeric">barcode</th> <th data-column-id="name_equipment">name eqp</th> <th data-column-id="commands" data-formatter="commands" data-sortable="false">action</th> </tr> </thead> <script type="text/javascript"> var grid = $("#bootgrid").bootgrid({ ajax: true, post: function () { return { id: "b0df282a-0d67-40e5-8558-c9e93b7befed" }; }, url: "response.php", formatters: { "commands": function (column, row) ...

php - Count number of uploaded file -

i want count number of uploaded file i'm unable error if no file had been uploaded. here code reference: html <input type="file" name="file[]" class="filestyle" data-buttontext="quotation 1" multiple="multiple"> php $total = count($_files['file']['name']); if($total > '2'){ for($i=0; $i<$total; $i++){ $tmpfilepath = $_files['file']['tmp_name'][$i]; if($tmpfilepath != ""){ $shortname = $_files['file']['name'][$i]; $filepath = "uploads/" . date('d-m-y-h-i-s').'-'.$_files['file']['name'][$i]; if(!$msgerror && move_uploaded_file($tmpfilepath, $filepath)){ // insert db , success msg } } } elseif($total < '4') { $msgerror[] = "need upload 3 quotations"; } if(isset($msgerror)){ $msge...