Posts

Showing posts from May, 2010

osx - Prompt_git_and_status error -

something strange happened git , terminal. terminal shows command not found error after every execution of commands under root. user's terminals ok. sh: prompt_git_and_status: command not found i running mac os x 10.10.3, git version 2.4.3 kernel: darwin 14.3.0 darwin kernel version 14.3.0: mon mar 23 11:59:05 pdt 2015; root:xnu-2782.20.48~5/release_x86_64 x86_64 where can problem? in advance.

Ansible git clone as root -

i'm using following role ansible in order clone project in vagrant setup: - name: clone repository git: repo: https://login:pwd@bitbucket.org/team/repo.git dest: /home/vagrant/workspace/ accept_hostkey: true the cloning working expected, main issue directory workspace , it's content owned root: drwxr-xr-x 7 root root 4096 jun 10 12:35 workspace i thinking command executed 'vagrant' user defined in playbook: - hosts: vagrant sudo: yes remote_user: vagrant roles: - git can guys me issue? thank you. remote_user: vagrant means ssh host user vagrant . sudo: yes means before executing each task sudo , default root. need remove sudo: yes .

Webpack: silence output -

Image
i know if there's configuration option tell webpack log "important information" terminal. pretty errors , warnings, not of this: there's output! love suppress common stuff , have webpack output warnings/errors. solution webpack , webpack-dev-server , , karma-webpack . note : tried noinfo: true , quiet: true didn't seem trick. edit: i'm thinking may not possible, i've created issue on github: https://github.com/webpack/webpack/issues/1191 in webpack config, doing reduced incremental build time 8 seconds , silenced output. main 1 chunks: false play fit needs module.exports = { devserver: { stats: { colors: true, hash: false, version: false, timings: false, assets: false, chunks: false, modules: false, reasons: false, children: false, source: false, errors: false, errordetails: false, warnings: false, publicpath: false } } }

regex - Remove simple HTML-Tags from String in Oracle via RegExp, Explanation needed -

i not understand, why columns reg1 , reg2 remove "bbb" string, , reg3 works expected. with t (select 'aaa <b>bbb</b> ccc' teststring dual) select teststring, regexp_replace(teststring, '<.+>') reg1, regexp_replace(teststring, '<.*>') reg2, regexp_replace(teststring, '<.*?>') reg3 t teststring reg1 reg2 reg3 aaa <b>bbb</b> ccc aaa ccc aaa ccc aaa bbb ccc thanks lot! because regex greedy default. i.e. expressions .* or .+ try take many characters possible. therefore <.+> span first < last > . make lazy using lazy operator ? : regexp_replace(teststring, '<.+?>') or regexp_replace(teststring, '<.*?>') now, search > stop @ first > encountered. note . includes > well, therefore greedy variant (without ? ) swallows > last.

php - Fatal error: Call to undefined function json_encode() -

i using php 5.1.6 , wamp5 version 1.6.5 . not support json getting error: fatal error: call undefined function json_encode() in c:\wamp\www\myproject\application\controllers\auth\auth.php on line 142 how can solve please me out. you have use library if check php.net page see function not available until v5.2. json_encode (php 5 >= 5.2.0, pecl json >= 1.2.0, php 7) http://php.net/manual/en/function.json-encode.php

How to show text area when check box is checked in android -

is there way show text-area when check-box checked in android. appreciated. the below code <label><input type="checkbox" value="2d animation"> the text area can added layout xml , hidden until needed android:visibility="gone" once checkbox checked, can check state , show text area checkbox checkbox = (checkbox) findviewbyid(r.id.checkboxid); if(checkbox.ischecked()){ textarea.setvisiblity(view.visible); } you can load of onclicklistener action fires when box checked/unchecked.

ios - Crashlytics : stuck on "Verifying Installation..." step -

Image
i want use crashlytics on application. followed every step i'm stuck on "verifying installation..." step. what problem ? setdebugmode = yes set below code before [fabric with:@[ twitterkit ]]; if applied twitter kit. or can past below code in didfinishlaunchingwithoptions. // swift crashlytics().debugmode = true fabric.with([crashlytics.self()]) // objective-c [[crashlytics sharedinstance] setdebugmode:yes]; [fabric with:@[[crashlytics class]]]; now build , run app , check fabric ui window, move ahead complete screen.

multithreading - Creating threads to process multiple objects C++ -

first of let me you're great community. i've visited website hundreds of times , got help! but still, quite new @ programming , there can't find answer in internet, going ask here see if can help. also, english not apology in advance, hope guys understand question: i need multithread program in c++ create maximum 5 threads process std::vector 100 objects within it. here question: how should create loops? in order create 5 threads, each 1 process single object. when thread finishes can continue next one. void * threaded_objectprocessor (void *voidarg) { //process object } main() { //beginning of code (std::vector<myobject>::iterator = myvector.begin(); != myvector.end(); it++) { //don't know here } //rest of code } i hope explained myself enough, , thank guys in advance, welcome. antirreni91 simple solution use openmp library. needs -fopenmp compiler flag , application must linked libgomp library. code need mod

r - Download.file function does not seem to work -

i want extract data .csv online r. therefore im doing (ive created dir called "data") fileurl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accesstype=download" download.file(fileurl, destfile = "./data/cameras.csv", method="curl") it gives following error however: warning messages: 1: running command 'curl "https://data.baltimorecity.gov/api/views/dz54- 2aru/rows.csv?accesstype=download" -o "./data/cameras.csv"' had status 127 2: in download.file(fileurl, destfile = "./data/cameras.csv", method = "curl") download had nonzero exit status and if remove method= "curl" error in download.file(fileurl, destfile = "./data/cameras.csv") : unsupported url scheme any thoughts on goes wrong? i had problem. changing method = "curl" method = "auto" worked me.

jquery - PHP read array object from javascript data object -

i create data object in jquery , pass php post method var pd = { currentpage : 1, rowcount : 10, search : 5 }; post method --> data = pd in php page if superglobal $_post have this var_dump($_post) --> array ( [data] => [object object] ) in php how can read $ _post ['data'] values ? edit (full code) var pd = { currentpage : 1, rowcount : 10, search : 5 }; pd = json.stringify(pd); redirectpost('index.php', { data : pd }); var redirectpost = function(location, args) { var form = ''; $.each(args, function(key, value) { form += '<input type="hidden" name="'+key+'" value="'+value+'">'; }); $('<form action="'+location+'" method="post">'+form+'</form>').appendto('body').submit(); }; php $data = json_decode($_post['data']); var_dump($data); <-- null it looks you&#

javascript - Amending req.options in a sailsjs policy -

i have policy being used randomly assign modified view files sake of split testing. in routes.js file have along lines of: '/some-page': { controller: 'pagecontroller', action: 'viewpage', locals: { view: 'some-page.handlebars' } } i have policy, splits.js that, if detects split test active on path, amends req.options.locals.view "some-split-test.handlebars". however, when app gets controller req.options.locals.view has reverted value assigned in routes.js (ie "some-page.handlebars"). policy being called , working expected - if log req.options.locals.view @ end, has updated value. am fundamentally misunderstanding relationship here between policies , controllers , ability manipulate req.options ?

php - How can I work with Paypal sandbox mode in CI Merchant -

i using following code paypal express . $settings = array( 'username' => 'xxxx', 'password' => 'xxx', 'signature' => 'xxxx', 'test_mode' => true ); while using above code, following error message shown merchant_response object ( [_status:protected] => failed [_message:protected] => security header not valid [_reference:protected] => [_data:protected] => [_redirect_url:protected] => [_redirect_method:protected] => [_redirect_message:protected] => [_redirect_data:protected] => ) but, if changed test_mode false, working fine (redirect paypal payment page). can 1 tell me how can work test_mode? i created api using following steps profile -> selling tools -> selling online – api access -> update -> request api credentials – request api signature -> agree , submit while crea

java - Performance Improvement For Using BigInteger While Calculating Square Root -

i trying calculate square root of integers below 100 precision of 10000 digits. tried using newton's method big decimal, eats lot of time. so using jarvis method finding square root using biginteger.(i think method involves less number of calculations , gets rid of maintenance of decimal digits). code takes lot of time.the following piece of code depicts calculations. public class squareroothackerrankjarvis { static biginteger limit; static biginteger a; static biginteger b; private static biginteger squareroot(int n, int digits, biginteger ten, biginteger hundred, biginteger five) { limit = ten.pow(digits + 1); = biginteger.valueof(n * 5); b = biginteger.valueof(5); while (b.compareto(limit) == -1) { if (a.compareto(b) != -1) { = a.subtract(b); b = b.add(ten); } else { = a.multiply(hundred); b = (b.divide(ten)).multiply(hundred).add(five); } } return b.divide(hundred

Android Focus issue between EditText and CheckBox -

i have edittext field , checkbox. behavior looking 'one or other should valid'. (1) if there's text in edittext , if user clicks checkbox, edittext field should automatically set "". code if checkbox.ischecked() edittext.settext("") , , works expected. (2) likewise, if checkbox checked , if user starts entering text in edittext, checkbox needs unchecked. code on edittext..aftertextchanged listener, if checkbox.ischecked() checkbox.toggle() . sort of seems happen, edittext field doesn't let go of focus. next time, try click checkbox (#1), edittext receives focus first though clicked checkbox, , clears checkbox, never able check checkbox, because edittext keeps receiving focus , keeps unchecking checkbox. is there anyway make happen? please let me know. thanks.

javascript - How do I unbind events on elements that are not the last -

i'm trying make form input appends empty input field end of series, if value of previous field true. i'v gotten pretty far i'm having trouble re-binding last element. function removeempty(){ $('p:last').remove() } function init(){ $('p:last input').focus(function(event){ $(event.target).closest('p').append("<p class=''><label>middlename: </label><input></input></p>") init() }) $('p:last input').blur(function(event){ console.log($(event.target).val()) if(!$(event.target).val()){ removeempty() } }) } init() <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <p class="first"> <label>middlename: </label><input></input> </p> you use event delegation instead. instead of using this: $('p

mouseevent - Mouse press event called twice -

the following code not working properly, want happen call placing_shapes_in_screen function mouse press , wait press place object on screen, happening first key press registering twice!! please help? boolean cont = false; void setup(){ size(500,400); background(0,0,53); } void draw(){ if(mousepressed){ placing_shapes_in_screen(); println("done"); } } void placing_shapes_in_screen(){ fill(204,0,102); text("hello", 60, 90); nofill(); while(cont == false){ if(mousepressed){ ellipse(mousex,mousey,20,20); cont=true; } } cont=false; } probably issue default draw called 60 time each second. makes relying in var mousepressed control user interaction, not precise, perhaps button still pressed, 1/60th seconds later... the way go use function mousepressed() or mouseclicked() callback functions called once when 1 of events ocour. some thing this: void mousepressed(){ place

asp.net - XML Parsing Error, running .NET 3.5 application in VS 2013 -

i took on dormant asp.net web forms project. project uses ms sql server end -- enterprise edition, v10.50 (i think that's 2008); development environment vm of ms server 2008 r2 hosting both visual studio , ms sql server. the first thing tried run project. error page with: xml parsing error: no element found location: http://localhost :{port}/{page}.aspx line number 1, column 1: and html source blank. on test system, project has been deployed. i've looked through similar questions , google results. typical problem unclosed tag in web.config -- checked that, , tags closed. else might causing problem? i think problem in sql server connection. connection string is: <add name="foo" connectionstring="data source=.\sqlserver2008r2;initial catalog=foobar;integrated security=true" providername="system.data.sqlclient" /> update: opened server explorer , attempted expand database. got error: "could not loa

java - Switch off DispatcherServlet on Spring Boot -

how can disable dispatcherservlet on springboot, trying disable via servlet registration uri mapping appears on log: @bean public servletregistrationbean servletregistrationbean(final dispatcherservlet dispatcherservlet) { final servletregistrationbean servletregistrationbean = new servletregistrationbean(dispatcherservlet); servletregistrationbean.setenabled(false); return servletregistrationbean; } log 2015-06-10 10:39:57.552 info 7032 --- [ main] o.s.b.c.e.servletregistrationbean : servlet dispatcherservlet not registered (disabled) 2015-06-10 10:39:57.553 info 7032 --- [ main] o.s.b.c.e.servletregistrationbean : mapping servlet: 'dispatcherservlet' [/] thanks help! i added below code main class, , servlet removed log. @springbootapplication(exclude = { dispatcherservletautoconfiguration.class })

camera - UICollectionView not showing images from CameraImage - Objective C -

searched forum , not find suitable answer works. suspect wrong code. taking pictures camera , trying show them in uicollectionview. collectionview has cell uiimageview inside of it. when setting static image , background colour still don't see (not colour). code follows: #import "camerapageviewcontroller.h" @interface camerapageviewcontroller () @end @implementation camerapageviewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view. _imagelist = [[nsmutablearray alloc] init]; _collectionview.delegate = self; _collectionview.datasource = self; [_collectionview registerclass:[uicollectionviewcell class] forcellwithreuseidentifier:@"picturecell"]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (ibaction)takephoto:(id)sender { uiimagepickercontroller *imagepickcontroller=[[uiimagepickercontroller alloc]init]; imagepickcontroller.sourcetyp

Keyerror while using pandas in PYTHON 2.7 -

7 , while running on command window getting problem. have updated pandas , have double checked please me how resolve problem. have twitter data using generated through tweepy. import json import pandas pd import matplotlib.pyplot plt tweets_data_path = 'c:/users/e2sn7cy/documents/github/twitter_data.txt' tweets_data = [] tweets_file = open(tweets_data_path, 'r') line in tweets_file: try: tweet = json.loads(line) tweets_data.append(tweet) except: continue #print len(tweets_data) #dataframe tweets = pd.dataframe() #adding columns tweets['text'] = map(lambda tweet: tweet['text'], tweets_data) tweets['lang'] = map(lambda tweet: tweet['lang'], tweets_data) tweets['country'] = map(lambda tweet: tweet['place']['country'] if tweet['place'] != none else none, tweets_data) #adding charts tweets_by_lang = tweets['lang'].value_count() fig, ax = plt.subplots() ax.tick_params(axi

mysql - PHP-SQL. Non-recursive way to select Categories and multiple Subcategories from DB -

i'm trying find way every subcategory parent category, in case, dont know how many subcategories have, so, solution found using recursion. i used: public function recursivesel(&$tree, $db, $parent = 0){ $query = $db->query("select id, catname categories parentcategory=".$parent); while($category = $db->fetch_array($query)){ $tree .= $category['catname']; if($category['id'] != $parent){ $this->treeselcategories($tree,$db,$category['id']); } } } but think if 1000 users navegating through categories , have 500 categories, can mess. my category table builted this: ||||||||||||||||||||||||||||| || id || name || parent || ||||||||||||||||||||||||||||| || 1 || games || 0 || || 2 || courses || 0 || || 3 || cooking || 2 || || 4 || diy || 2 || || 5 || action || 1 || || 6 || new || 5 || || 7 || tutorial|| 3 || || 8 || easy ||

visual studio 2010 - unable to display contents byte[] properly on to a text box in c# -

Image
i trying display byte[] in text box, first reading encrypted info file temp.enc byte array filestream f = file.openread("temp.enc"); byte[] b = new byte[f.length];//length 32 bytes f.read(b, 0, convert.toint32(f.length)); f.close(); second try display content on text box, when run program dont see complete data. displays first 23 bytes of data outputfiletextbox.text = system.text.encoding.default.getstring(b); how ever if use same byte array again write info file, have 32bytes written on file binarywriter swenc = new binarywriter(file.openwrite("encypt.txt")); swenc.write(b); swenc.close(); this c# windows application, m not sure doing wrong. be sure read , write in same format. looks reading in text using whatever default encoding is, write in binary format. here sample code writes in same format reads in: private string readfile(string filename) { var sb = new stringbuilder(); if (system.io.file.exists(filename)

java - JCA Glassfish to JBoss/Wildfly -

i need able deploy .ear file containing .rar resource adapter jboss/wildfly . has been working gf. problem in .war file (which part of .ear) have web.xml : <resource-ref> <res-ref-name>eis/host</res-ref-name> <res-type>javax.resource.cci.connectionfactory</res-type> <res-auth>container</res-auth> <res-sharing-scope>shareable</res-sharing-scope> <lookup-name>java:/env/eis/host-somehost</lookup-name> </resource-ref> and jboss cannot find resource: services missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"hostconnector-ear-1.17-snapshot\".\"hostconnector-war-1.17-snapshot\".env.eis.host missing [jboss.naming.context.java.jboss.resources.eis.host]"]} i have created element in standalone.xml, seams naming wrong or what: <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0"> <resource-adapters

function - C++ - Variable Decrement -

heys. i have code, sets table mystery reason. size 6x60. means sizey defined 6, , sizex 60. void set_table(char** table) { int i,j,k=0; for(i=0;i<sizey;i+=3){ for(j=0;j<sizex;j++){ switch(k++%5){ case 0: table[i][j]='|'; break; case 1: table[i][j]=' '; break; case 2: table[i][j]=(char)((((k-2)/50)%10)+48); break; case 3: table[i][j]=(char)((((k-3)/5)%10)+48); break; case 4: table[i][j]=' '; break; default: continue; } } } } i doing 3 variables, can see. question is, can 2 variables, or 1 ? thanks in advance. here's simplification you: switch(k++%5){ case

css - Bootstrap center image -

i trying center image on webpage. want appear above footer. no matter have tried far nothing works here html <div class="center-block"> <img alt="footer" title="footer" class="image-footer" src="./img/demo.png"/> </div> <div class="navbar-fixed-bottom footer"> <ul class="foot-left"> <li><a href="#" class="menu_buttons" >home</a></li> <li><a href="#" class="menu_buttons" >about</a></li> <li><a href="#" class="menu_buttons" >support</a></li> </ul> <ul class="foot-right"> <li><a href="#" class="menu_buttons" >powered demo</a></li> </ul> </div> and image-footer class : .image-footer { position:ab

How to perform synchronized grouping/filtering of ListViews and DataGrids in WPF? -

Image
i trying create, in application, same effect used software musicbee in music selection interface (screenshot below). there lower panel datagrid, , upper panel listviews displaying grouped rows. when click, say, "rock" on "genre" list in upper panel, other lists updated , datagrid filtered accordingly. if go on clicking on other lists in upper panel, datagrid filtering becomes more , more restrictive , goes on being updated accordingly (displaying rows matching filters above). also, there rows: all (n items) , [empty] , imagine have added view source somehow. i started read listcollectionview class, since documentation says: "when bind data collection, may want sort, filter, or group data. that, use collection views." it seems me grouping , filtering want accomplish here, found lack of examples , don't know start this, either viewmodel-side or xaml-side. this broad question, show 1 way go implementing looking for. there

eclipse - Cannot use System.getProperty -

i trying use system.getproperty("foo") , read variables in eclipse. 2 ways have tried specify in run configuration in environment tab specicy -d in eclipse.ini file i using windows machine, me this

ruby on rails - ActiveRecord on create, update of any model -

without sti (single table inheritance), there way check if model has been created or updated , determine model , attributes changed/updated on model? i.e. output of running rails server shows http traffic , queries being run on db. cache invalidation purposes, i'm trying write code requires me know this. i'm looking after_create , after_update, rather on 1 model, need have universal after create , after update , have ability determine model created or updated. can done in activerecord? if so, how? if you're not changing logic of models, isn't universal hook, wouldn't want in activerecord::base . duck typing bad. it sounds have common behavior , way handle module (or activesupport::concern ). example modified here (assuming you're running rails 3+) module maintainaninvariant # common logic goes here extend activesupport::concern included after_save :maintain_invariant_i_care_about end def maintain_invariant_i_care_abou

delphi - String.Split works strange when last value is empty -

i'd split string array works bad when last "value" empty. see example please. bug or feature? there way how use function without workarounds? var arr: tarray<string>; arr:='a;b;c'.split([';']); //length of array = 3, it's ok arr:='a;b;c;'.split([';']); //length of array = 3, expect 4 arr:='a;b;;c'.split([';']); //length of array = 4 since empty value inside arr:=('a;b;c;'+' ').split([';']); //length of array = 4 (primitive workaround space) this behaviour can't changed. there's no way customise how split function works. suspect you'll need provide own split implementation. michael erikkson helpfully points out in comment system.strutils.splitstring behaves in manner desire. the design seems me poor. instance length('a;'.split([';'])) = 1 and yet length(';a'.split([';'])) = 2 this asymmetry clear indication of po

elasticsearch - Filtered Query in Elastic Search -

filtered query query not working in elastic search. gives error query parsing exception filter malformed, no field after start_object { "query": { "filtered": { "query": { "match_all": {} }, "filter": { "bool": { "must": [], "should": [ { "_expires": null }, { "_expires": { "gte": 1433947304884 } } ], "must_not": [ { "term": { "age": 19 } } ] } } } }, "size": 10, "from": 0 } can me this? your should s should using filter. yours have "_expires": null . not filter. for example, try: { "missing": { "field": "_expires"

php - Laravel - can I control routes by rule? -

so have laravel controller ( maincontroller.php ) following lines: ... public function _settings_a(){ return view('_settings_a'); } public function _settings_b(){ return view('_settings_b'); } public function _settings_c(){ return view('_settings_c'); } public function _settings_d(){ return view('_settings_d'); } public function _staff_a(){ return view('_staff_a'); } public function _staff_b(){ return view('_staff_b'); } public function _staff_c(){ return view('_staff_c'); } ... and routes.php follows: route::any('_staff_a''maincontroller@_staff_a'); route::any('_staff_b''maincontroller@_staff_b'); ... etc. it seems there lot of lines , lot of things change if change mind... i wondering if can have regex in routes.php , equivalent regex in maincontroller.php handling routes begin underscore ( _ )? can laravel experts share tips/suggestions? i'm quite

asp.net mvc - Azure deployment from source without TFS? -

does knows if deployment source feature of azure intended work .net projects ? mean, if put source code in local git repository of azure , trigger deploy, source code going compiled , deployed or source files going copied ? we managing our source code, tasks etc... on codebasehq , use azure deployment platform only. i'm trying achieve push release-ready code on azure git repository, , built , deployed. relevant resources welcome, haven't been able find answer far. thanks you can build , deploy git azure, try link https://azure.microsoft.com/en-gb/documentation/articles/web-sites-publish-source-control/ update take back, link setup , build project http://blogs.msdn.com/b/kaevans/archive/2014/03/31/deploying-an-azure-web-site-using-git-and-continuous-integration.aspx or setup teamcity building of project , use ms deploy team city push build azure update 2 there difference between tfs , tfs online, answer no if question referring tfs online , particular f

php - How do I compare object values that are inside an array? -

i have array containing several objects. $products = [ {"id":"1","random":"sadasd","mergethis":"ding"}, {"id":"2","random":"assdfsadf","mergethis":"ding"}, {"id":"2","random":"assdfsadf","mergethis":"flop"}, {"id":"2","random":"assdfsadf","mergethis":"bips"}, {"id":"3","random":"sdfss","mergethis":"flung"}, {"id":"3","random":"sdfss","mergethis":"rorg"}, {"id":"4","random":"asdasdddaf","mergethis":"shwung"} ] i'm trying iterate trough array , when id allready present

A couple questions about REST -

i have 2 questions rest 1) should try avoid sending input data when using rest? should requests try pass data possible through uri , not through post? 2) of 2 formats below more "restful"? /tasks/delete/{task_id} or /tasks/{task_id}/delete/ 1) should try avoid sending input data when using rest? should requests try pass data possible through uri , not through post? if post large resource, that's fine. if need conceptually, turn post can encode parameters in request body, conflicts rest. 2) of 2 formats below more "restful"? neither /tasks/delete/{task_id} nor /tasks/{task_id}/delete correct. "delete" verb, url should noun. if want delete task, use delete /tasks/{task_id} , rather somthing post /tasks/{task_id}/delete .

html - Moving Divs in JavaScript with key presses -

i'm doing html/javascript based game, game objective 2 monsters collecting cakes , avoid other thing cakes. i've created 2 divs each 1 zone want characters move around. first i'm starting basic (space key jump), 1 of games if 1 character goes up, other 1 comes down. now, i'm testing code 1 character see if works, if i'm planning program other character opposite. code got key presses: function onkeypressed(event) { if(event.keycode == 37) { left = true; } if(event.keycode == 39) { right = true; } if(event.keycode == 38) { = true; } if(event.keycode == 40) { down = true; } if(event.keycode == 32) { updatemonster1place(); updatemonster2place(); } } // function called when key, in keyboard, released function onkeyreleased(event) { if(event.keycode == 37) { left = false; } if(event.keycode == 39) { right = false; } if(event.keycode == 38) { =

excel - VBA - Pull changing exchange rates from Oanda -

i'm doing project , need getting started. essentially doing pulling data changing parameters every single day , need exchange rate average period. example: today june 10th. need period average june 1st june 9th of various exchange rates. the difficult part every day, need update period range , change exchange rates being viewed. tomorrow, 11th, need pa 1st 10th. anyone have ideas on how started? arrange data how want , use excel macro recorder record actions want take. give starting point. can examine code, work out doing , change required.

jquery - javascript element ":last" confusion -

i have question interaction of javascript code html code. in part of lecture i'm working on, i'm put in work info .js file using for-loop, interacts other .js , .html file output job/role onto index.html , did so: for (var = 0; < work.length; i++) { var role = htmlworktitle.replace("%data%",work[i].role); var employer = htmlworkemployer.replace("%data%",work[i].name); var description = htmlworkdescription.replace("%data%",work[i].description); var employerinfo = employer + role; $("#workexperience").append(htmlworkstart); $(".work-entry:last").append(employerinfo); } the code works fine, i'm trying understand why need ":last" in ".work-entry:last". other file, helper.js has 1 element entry "work-entry" begin with, shown below: var htmlworkstart = '<div class="work-entry"></div>'; var htmlworkemployer = '<a href="#

javascript - Hiding overflowing element based on its height -

Image
i'm writing (using pure javascript = no jquery) custom control container collapses it's contents when span multiple lines , show first one. when click button in control (down arrow), container expands of it's content. if content spans 1 line, don't show button @ all , behaves regular container. the 2 pictures below show control collapsed (upper one) , expanded (bottom one). the problem face how know when show button , when not = how detect if content multiline or spans single line. approach getting height of element, collapsing , seeing if height changed (if did, must multiline). the problem approach inside function createcollapsingpanel() element i'm creating hasn't been yet appended dom - function returns element, appended dom (illustrated architecture 1 below). if concern 1 function, of course move appending inside function ( architecture 2 below). unfortunately way wrote of functions (they return elements, appended parent elements in outer

How can I avoid that this java.sql.SQLException: ORA-01704: string literal too long is thrown? -

i working on old legacy java application , have problem method perform simple insert query on oracle database: private boolean insertflussoxmlsdi(dboperatore op, string numerofattura, string datafattura, string fatturaxml) { stringbuffer query = new stringbuffer(); query.append("insert flusso_xmlsdi (numero_fattura, data_emissione, xml) values ("); query.append(numerofattura); query.append(", date'"); query.append(datafattura); query.append("', '"); query.append(fatturaxml); query.append("')"); try { statement stmt = op.getconnessione().createstatement(); stmt.execute(query.tostring()); } catch (sqlexception e) { // todo auto-generated catch block e.printstacktrace(); tracelog.scrivi("inserimento fattura", "errore inserimento fattura con numero fattura: " + numerofattura, false, tracelog.lowconsole + tracelog.hightrace +

Accessing Multiple pages in a User locked excel document -

i trying create budget document in each department has access particular page - have part working - having trouble allowing admin access of pages. have code userform far: (i "scott" able open of pages not "overview") dim bok2use boolean private sub btnok_click() dim berror boolean dim ssname string dim ws worksheet dim p documentproperty dim bsetit boolean bok2use = false berror = true if len(txtuser.text) > 0 , len(txtpass.text) > 0 berror = false select case txtuser.text case "scott" ssname = "overview" if txtpass.text <> "act2" berror = true case "chris" ssname = "run crew" if txtpass.text <> "act2" berror = true case else berror = true end select end if if berror msgbox "invalid user name or password" else 'set document property bsetit = false each p in

ember.js - Defining buildURL depending on what properties have changed -

i redefine buildurl depending on properties changed on same model. example, if status changed, put route, , if subuser changed, put route. example : this.store.find('conversation', conv.id).then(function(conversation){ conversation.set('status', 'opened'); conversation.save(); }); this use put route , : this.store.find('conversation', this.get('selectedconv').id).then(function(conversation){ conversation.set('subuser', subuser); conversation.set('url', subuser.get('email')); conversation.save(); }); and use put route tho changes made on same model. happening in controller. you need customize conversation adapter, urlforupdaterecord method. the original method looks this: urlforupdaterecord: function(id, modelname, snapshot) { return this._buildurl(modelname, id); }, in method, need examine snapshot , adjust url accordingly. the latest version of em

sql - One column maps to mutiple columns from different table -

just wondering if there problem in design or has ever broke rules in database normalization. the major table has column mapped two(or more) different tables, data in reference column may mix primary key multiple tables. is better design create different association tables (major -> , major -> b)? table major item id | reference ----------------------- id 1 | a1 pk tb id 2 | b1 pk tb b id 3 | a2 pk tb id 4 | b2 pk tb b id 5 | a3 pk tb id 6 | a4 pk tb id 7 | b3 pk tb b id 8 | b4 pk tb b ...... table a sub item id | ----------------------- id a1 | ..... id a2 | ..... id a3 | ..... id a4 | ..... ...... table b sub item id | ----------------------- id b1 | ..... id b2 | ..... id b3 | ..... id b4 | ..... ...... your table major violates boyce-codd normal form (3nf+) , because don't know table being referenced key. it's semantic difference, , each column should describe 1 thing (and in case, conte

Notable to link javascript object and angularjs in controllers -

i trying develop mobile application in getting json object using javascript page main.js,now trying print object using angualjs controllers,but not find way.can me out on this? function written in main.js` function getviewcolumnssuccess(result){ var httpstatuscode = result.status; if (200 == httpstatuscode) { var invocationresult = result.invocationresult; var issuccessful = invocationresult.issuccessful; if (true == issuccessful) { var result = invocationresult.text; //var finalcol=reult; } else { alert("error. httpstatuscode=" + httpstatuscode); } } } the var result want in democontroller in page app.controller('tablectrlnew', function($scope,$http) { }); first controllers not print data, should databinding, in views. for example: in controller have var; $scope.name="john doe"; so, print in view, shoud print in view has scope, print in 1 view(html) simple like: <span class="labelname"

html - Responsive table with equal width and height TDs -

how can create responsive html table each cell/td has equal width , height? when resize browser window or resize table's container, table resize, each cell have equal height , width. foundation doesn't take care of that. when initialize td fixed width , height in pixels, when resize width of browser, shrinks td horizontally, doesn't keep same aspect ratio. i using foundation my base responsive framework. below way of doing work . https://jsfiddle.net/ocp36ulb/32/ table { border-collapse: collapse; width: 100%; } td { width: 50%; padding-bottom: 50%; display: inline-block; } by setting padding same width create square maintains it's aspect ratio on resize. need use display: inline-block; override default display: table-cell; make cell expand fit it's parent table. border-collapse: collapse; important overrides table related border rendering. however, method may pixel out @ sizes due way tables render. works divs (which

encoding - jQuery autoNumeric plugin replace euro sign with question mark -

i'm using autonumeric , jquery plugin automatically formats currency. works fine, euro sign (€) replaced question mark (�). i have read this , this , not seems encoding problem couse i'm using following meta tags on page: <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> also replacing exotic characters html friendly such &euro; code in autonumeric options, did not solve problem, show &euro; 123,00 in field input $('#import').autonumeric('init', { asep: '.', adec: ',', vmin: '-999999999.99', vmax: '999999999.99', asign: '€' // tried '&euro;' }); if replace euro sign dollar sign ( asign: '$' ) works fine! thanks in advance the problem might due character encoding m

forms - Django override-able abstract field for inlineformset -

intro hello!!!!! i've looked solution problem - nearest thing i've found far this , , doesn't have full enough answer me. background the following contrived example make question clearer. i interested in using inlineformset_factory in situation each entry in form can correspond different subclasses of same parent model. example, have form model has number of input items: class form(models.model): name = models.charfield(max_length=30) then, have input model , subclasses: class input(models.model): class meta: abstract = true form = models.foreignkey(form) name = models.charfield(max_length=30) class shortinput(input): value = models.charfield(max_length=20) class tweetinput(input): value = models.charfield(max_length=140) class binaryinput(input): value = models.textfield(blank=true) essentially, it's form various types of data. it's important shortinput instances take 20 characters of space in backend,

ruby on rails - Delete values of row when import csv -

i have import csv file method carrierwave , it's works. , want delete values of row when have been successful imported database. csv_text = file.read(file_csv.current_path) csv = csv.parse(csv_text) csv.each_with_index |row, index| @foo = foo.new(bar: row[0]) if @foo.save # delete values of row else next end end example have file csv containing : lenovo z360, black, 14 asus a46, blue, nil macbook pro, silver lenovo z360 , macbook pro has been successful import, , end of process import file : asus a46, blue, nil is possible ? how able read, write/delete , manipule file many of row?

sql server - Failed to open a connection to the database" While creating a Table Adapter in C# -

Image
so, i'm mantaining software ex co-worker did. uses xsd create tableadapters reports , other stuff. the thing is, need add new tableadapter , aforementioned error. says dread "a network-related or instance-specific error occurred while establishing connection sql server." i @ loss here , don't know do. here facts: i have 2 connection strings, 1 production environment , 1 development environment (my computer). when go settings , edit window of connection string, hit "test connection" , says works fine. both sql server 2008r2 , visual studio 2010 on same machine, machine. i not have named instance. i right click on xsd design view , click "add -> tableadapter" , use local connection string (the 1 tested , worked) i click "use existing stored procedures" , hit [next]. able pick stored procedure select section , can see columns. i click finish, system locks while , error. named pipes, tcp/ip enabled in sql server configur