Posts

Showing posts from May, 2015

excel - Display text in cell relative to matching cells in chosen area -

this problem have has been bother , nice if possible. have list of numbers (1-58) (a6:a63) , next them list of names (b6:b63) need formula in cell e4 , looks cells in range a6:a63 match cell e3, once found display in cell next cell matched e3. need work e3:bj3 way can see use if function. =if(e$3=1,"a",if(e$3=2,"b",if(e$3=3,"c",etc))) there easier way? have pictures here : http://imgur.com/a/nj4h9 try this: e4=index($b$6:$b$63,match(e3,$a$6:$a$63,0)) or this e4=vlookup(e3,$a$6:$b$63,2,0) then copy e5 , right.

click() function on selenium not working in C# -

i fed problem , not finding solution. the problem trying test website using test automation in c#. need sign in, sign-in button not button, it's span tag property set 'role=button' . i using selenium chrome web driver , using unit extensions automate test. problem whenever run test in test explorer click event performed, page not navigate next page, , nothing happens. however, when set break point , run same test through main function works fine. i have set break point perform click operation , perform login operation. i using visual studio console application. here pic of web site html tag . the problem click function not loaded @ time run test "quick", when debug. try load page. wait 1 second. getelement , click it. normal in pages add javascript function elements dynamically.

python - SQLite not recognising django table- or the other way around? -

i have researched problem lot can't seem result. trying insert new values , query tables django established table-database. seems number of people have had reoccurring problem on years. have tried rectify both on mac , on desk linux server both on django 1.8 , 1.9 problem remains after migrations... based on advice have seen on similar posts have tried following: # update database establish inputs ./manage.py # inserting installed_apps django.contrib.sites # modifying settings.py below... import os project_path = os.path.dirname(os.path.abspath(__file__)) 'name': os.path.join(project_path,'mysite.sqlite3'), # specifying full pathname database in settings.py 'name': os.path.join(base_dir, '/project/homemsc/username/trydjango19/mysite/db.sqlite3') however in case of each of these modifications when inserting values in sqlite "error: no such table exists" returned. know

javascript - Ionic modal- keep navbar/menu visible -

Image
i want put page modal-slide up,that keeps menu bar static (as in, when modal opens, menu/top bar not slide up). the modal slide's up- nav-bar/menu bar should white. space created (with class="has-header") white. by clicking on magnify glass, modal activated on site- click here . unsuccessfully tried making plunker ( here ). here code: to open modal (in .html) <i class="ion-ios-search-strong" ng-click="refineevent()"></i> part of js $ionicmodal.fromtemplateurl('app/components/stores/stores.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal){$scope.modal = modal;}); $scope.refineevent = function(){$scope.modal.show();}; $scope.closemodal = function(){$scope.modal.hide();}; $scope.$on('modal.shown', function(){console.log('modal shown!');}); } and modal.html file: <ion-modal-view> <ion-view name="stores"><ion-pane ng-controll

python - Importing extern declaration from other Cython declaration file -

i writing cython extension use in python. i have cython declaration .pxd file declares c struct defined in other c header file: # cython definitions parameters.h cdef extern "parameters.h": ctypedef struct control_par: int num_cams # other struct fields.... now want same thing other header file here have use defined above: control_par c struct in cython .pxd file: from optv cimport parameters, calibration # no error here during setup cdef extern "optv/trafo.h": void pixel_to_metric(# other parameters... control_par * parameters); during cythonizing error: 'control_par' not type identifier like not defined @ all. what doing wrong? the correct way import c definitions parameters.control_par . do: from optv.parameters cimport control_par, whatever_else_you_need

c# - How to make a global property that is visible within all pages in a Windows 10 app? -

i thinking of app represents store, using gridview view items , data represented observablecollection. my xaml code : xmlns:data="using:itemsstore.models" <gridview itemssource="{x:bind itemslist}"> <gridview.itemtemplate> <datatemplate x:datatype="data:item"> <stackpanel orientation="vertical"> <image source="{x:bind imagesource}"/> <textblock text="{x:bind name}"/> <textblock text="{x:bind disc}"/> </stackpanel> </datatemplate> </gridview.itemtemplate> </gridview> the c# code in mainpage : public sealed partial class mainpage : page { public observablecollection<item> itemslist; public mainpage() { this.initializecomponent(); itemslist

android - How to enlarge a picture in Gridview when it is clicked using a new activity? -

so have activity inflates gridview, , want clickable, , upon click, opens new activity, shows whole image, along texts i've written in activity. note confirmed txt file written written successfully, , in sd card. here code gridview activity public class gridview extends appcompatactivity { android.widget.gridview gv; arraylist<file> list,list2; @override protected void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.gallery); file dir = new file(environment.getexternalstoragedirectory().getabsolutepath() + "/mycameraapp"); file dir2 = new file(environment.getexternalstoragedirectory().getabsolutepath() + "/mycameraapp"); list = imagereader(dir); list2 = locationreader(dir2); gv = (android.widget.gridview) findviewbyid(r.id.gridview); gv.setadapter(new gridadapter()); gv.setonitemclicklistener(new adapterview.onitemclicklistener() { @overrid

How WPF layout deals with text wrapping -

wpf layout works first asking controls measure themselves, , arranges controls based on desired size produced during measure stage. i not see how possible deal text wrapping in case. a control contains text wrapped must know width before can calculate height. @ measure stage width unknown. assigned arrange stage, when measuring completed. height cannot calculated during measure. how text wrapping work in wpf? this simple custom textblock shows how works: public class mytextblock : frameworkelement { private formattedtext formattedtext; public static readonly dependencyproperty textproperty = dependencyproperty.register( "text", typeof(string), typeof(mytextblock), new frameworkpropertymetadata( null, frameworkpropertymetadataoptions.affectsmeasure, (o, e) => { ((mytextblock)o).formattedtext = new formattedtext(

javascript - ASP.NET AJAX--styleSheet.insertRule() not working as expected -

my application generates animations dynamically in server code. element animated, apply animation styles in-line, (the element ids guids letter prefix prevent collision): <div class="scrollingdiv" style="width: 100%; height: 27px;"> <p id="p9a6960428d594935b2540b1f8466f47a" style="animation:scroll-p9a6960428d594935b2540b1f8466f47a 10s linear infinite; width: 131px; height: 27px; transform: translatex(640px); -moz-transform: translatex(640px); -webkit-transform: translatex(640px); -moz-animation: scroll-p9a6960428d594935b2540b1f8466f47a 10s linear infinite; -webkit-animation: scroll-p9a6960428d594935b2540b1f8466f47a 10s linear infinite;"> test </p> </div> and assign innerhtml of container. generate on server side keyframes, so: @keyframes scroll-p9a6960428d594935b2540b1f8466f47a { 0% { transform: translatex(640px); } 100% { transform: translatex(-131px); } } and put them in hidden field on for

persistent listview in Jquery Mobile -

in jquery mobile can have navbar has class of persistent makes nav button chosen highlight in different colour. indicates user he/she located within menu. possible have same effect on listview? trying when user selects anchor within list stays highlighted. if user goes same list user can see option in list selected. here's working example: http://jsfiddle.net/gajotres/wa7qz/ i think want. unfortunately there isn't jquery mobile built in functionality has done manually. html: <!doctype html> <html> <head> <title></title>`enter code here` <link href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css" /> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js" type="text/javascript"></script> </head> <body> <div data-role="page" id="profile">

java - How to ALTER TABLE using UCanAccess -

i using ucanaccess jdbc-driver (version 3.0.3.1) connect mdb-file. , need add column existing table. problem statement alter table temployee add column notificationsenabled binary throws exception: net.ucanaccess.jdbc.ucanaccesssqlexception: ucaexc:::3.x.x feature not supported yet. and seems there no newer versions of ucanaccess. what can in such situation? don`t want use odbc driver many reasons (described here - manipulating access database java without odbc ) the solution see create copy of table (e.g. temployeebackup) save data, drop , recreate original table new field, , move data temployeebackup temployee. solution seems awful me. ucanaccess versions 4.0.0 , above support alter table, e.g., statement stmt = conn.createstatement(); stmt.execute("alter table tablename add column newcol long");

Basic Java, OOP -

i'm stuck @ moment, program works should except returning value of 0.0 bmi output , i'm sure i'm overlooking, cannot seem figure out. i've posted same code on question different issue that's solved. below class code... pointers appreciated! have not gotten calcompu method yet, wanting resultbmi work first... import java.util.scanner; public class myperson { double weight; double height; int age; string gender; double calcompu; final double kg_weight_conv = 2.2; final double mt_height_conv = 0.0254; public myperson () { weight = 0; height = 0; age = 0; gender = " "; } public void setweight (double weight) { this.weight = weight; } public void setheight (double height) { this.height = height; } public void setage (int age) { this.age = age; } public void setgender (string gender) { this.gender = gender; } public double getweight () { return weight / kg_weight_conv; } public double getheigh

jquery - Error in Accessing exrenal database file using ajax call in Phonegap app -

i developing phonegap app in accessing database hosted on server ajax calls. working fine in local, when make apk , run app generates 404 error. error: post http://mywebsite.com/mobileapp/function.php 404 (not found)** app html file: <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <meta name="msapplication-tap-highlight" content="no" /> <!-- warning: ios 7, remove width=device-width , height=device-height attributes. see https://issues.apache.org/jira/browse/cb-4323 --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'sel

Pass urls stored in array to window.open in for loop - Javascript -

this question has answer here: asynchronous process inside javascript loop 5 answers i'm trying step through array , pass urls stored there window.open function. have. $('a.linked').click(function(e) { e.preventdefault(); var i; var urls = ['http://example.com', 'http://example2.com', 'http://example3.com']; (i = 0; < urls.length; i++) { var ts = i*3500; settimeout(function(){window.open(urls[i]); }, ts); } }); this opening new windows @ correct timing i'm getting about:blank. thought might not escaping quotes. the duplicate answer says i'm losing value of i however, when remove settimeout new windows correct urls. following code demonstrates not losing value of i. $('a.linkedinprofiles').click(function(e) { e.preventdefault(); var i; var urls = ['http

java - In my "Millionaire" Game Program, the questions are not showing -

i made "who wants millionare" kind of app it's not working. questions , choices not showing. use borderpane contains listview stages($0-$1000000),a gridpane question choices, , 2 hbox es question , start button. here's code. game package game; import javafx.application.application; import javafx.collections.fxcollections; import javafx.collections.observablelist; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.listview; import javafx.scene.layout.borderpane; import javafx.scene.layout.gridpane; import javafx.scene.layout.hbox; import javafx.scene.text.text; import javafx.stage.stage; public class game extends application{ @override public void start(stage primarystage){ primarystage.settitle("millionare"); question[] questions=new question[14]; string[] questionnames={ "13425",

java - Package android.os. does not exist Libgdx Netbeans -

when trying create android libgdx application in default imports import android.os.bundle; , netbeans says can't find package named android.os . why happen , how work? package com.mygdx.game.android; import android.os.bundle; import com.badlogic.gdx.backends.android.androidapplication; import com.badlogic.gdx.backends.android.androidapplicationconfiguration; import com.mygdx.game.mygdxgame; public class androidlauncher extends androidapplication { protected void oncreate (bundle savedinstancestate) { super.oncreate(savedinstancestate); androidapplicationconfiguration config = new androidapplicationconfiguration(); initialize(new mygdxgame(), config); } } it has gradle configuration setup have. you'd better off using either android studio or eclipse. you'll find lot more libgdx support ides. i'd recommend installing android studio , importing project opening gradle config file in android studio. android studio made gra

Google PageSpeed Insights results jQuery slows down loading -

Image
i'm trying speed website applying google pagespeed insights recommendations, things don't make sense me. results get: https://goo.gl/gsq6zs it says above fold content couldn't loaded without delay because of jquery, jquery script reference placed before closing body tag, interesting if copy/paste source code jquery file , put directly index.html inline code works perfectly, solution looks dirty me. fast ways determine javascript/css files responsible displaying above fold content? have many css files , it's inconvenient go through every file , determine parts responsible. any suggestions welcome first read 2 articles: https://developers.google.com/speed/docs/insights/blockingjs https://developers.google.com/speed/docs/insights/optimizecssdelivery the problems have following files: render blocking javascript you can few things fix such inline js, using async or in cases putting .js files @ bottom of script below else. inline js simply cop

python - Scipy ndimage median_filter origin -

i have binary array, say, a = np.random.binomial(n=1, p=1/2, size=(9, 9)) . perform median filtering on using 3 x 3 kernel on it, say, b = nd.median_filter(a, 3) . expect should perform median filter based on pixel , 8 neighbours. however, not sure placement of kernel. documentation says, origin : scalar, optional. the origin parameter controls placement of filter. default 0.0. if default zero, should taking current pixel , 3 x 3 grid right , bottom, no? shouldn't default center of footprint ? in our 3 x 3 example correspond (1, 1) opposed (0, 0) ? thanks. origin says accepts scalar, me accepts array-like input case scipy.ndimage.filters.convolve function. passing 0 indeed center of footprint. origin's value relative center. 3x3 footprint, can specify values -1.0 1.0. here examples. notice in example origin not specified filter centered expected. import numpy np import scipy.ndimage a= np.zeros((5, 5)) a[1:4, 1:4] = np.arange(3*3).reshape((3, 3

ruby on rails - Error "Could not find rake-10.5.0 in any of the sources" on Phusion Passenger Docker image -

i trying deploy rails app using docker , phusion passenger ruby base image , whenever try access app browser error: web_1 | [ 2016-02-08 04:18:44.6861 31/7ff292141700 age/cor/app/implementation.cpp:304 ]: not spawn process application /home/app/webapp: error occurred while starting preloader. web_1 | error id: d3103e16 web_1 | error details saved to: /tmp/passenger-error-ewymlw.html web_1 | message application: <p>it looks bundler not find gem. maybe didn't install gems application needs. install gems, please run:</p> web_1 | web_1 | <pre class="commands">bundle install</pre> web_1 | web_1 | <p>if didn't work, problem caused application being run under different environment it's supposed to. please check following:</p> web_1 | web_1 | <ol> web_1 | <li>is app supposed run <code>app</code> user?</li> web_1 | <li>is app being run on correct ruby interpreter? below web_1 |

javascript - What is "Dirty" in React.js? -

i trying understand react.js , come across term "dirty" dirty checker/checking, dirty data ,dirty model i followed this question not make out term dirty convey & why call dirty. dirty data - data, have been changed , dom haven't been re-rendered according changes yet. dirty checking diff between next state , current state.

android - SQLite no such column even though everything spelled right and there is correct spacing -

this question has answer here: when sqliteopenhelper oncreate() / onupgrade() run? 10 answers i learning android programming , sqlite @ same time. creating table like: private static final string database_create = "create table " + book_table + " (" + bookcontract._id + " integer primary key autoincrement, " + bookcontract.title + " text not null, " + bookcontract.authors + " text not null, " + bookcontract.isbn + " text not null, " + bookcontract.price + " text not null );"; in function fetches books in database, query is: string query = "select " + book_table + "." + bookcontract._id + ", " + bookcontract.title + ", " + bookcontract.price + ", " +

datetime - Get value by date -

i have data frame df : price 2004-03-19 36.250000 2004-03-20 36.237500 2004-03-21 36.225000 2004-03-22 36.212500 etc... the index of type: datetimeindex(['2004-03-19', '2004-03-20', '2004-03-21', ...], dtype='datetime64[ns]', length=1691, freq='d') i want retrieve price @ day using df[datetime.date(2004,3,19)] . pandas does: keyerror: datetime.date(2004, 3, 19) the following works, can't way supposed work: df[df.index.isin(pd.datetimeindex([datetime.date(2004,3,19)]))].price.values[0] the problem here comparison being performed exact match, none of times 00:00:00 no matches occur. you can use loc datetimeindex : print df.loc[pd.datetimeindex(['2004-3-19'])] price 2004-03-19 36.25 or can use loc , convert string 2004-3-19 to_datetime , date of datetimeindex : print df.loc[pd.to_datetime('2004-3-19').date()] price 36.25 name: 200

push notification - Echo Device Token Using Php -

Image
how can echo $token value in api.php file? app uses push notifications , thusly $token variable in api file gets set 64 character device token each user gets when app downloaded. far token gets posted database, need able echo out. ultimate goal set $token global variable , pass new file use in additional php statements. echo can make sure can explicitly first. <?php // server api pushchat iphone app. use api, app // sends http post request our url. post data contains field "cmd" // indicates api command should executed. try { // running in development or production mode? can switch // between these 2 in apache virtualhost configuration. if (!defined('application_env')) define('application_env', getenv('application_env') ? getenv('application_env') : 'production'); // development // in development mode, show errors because want // know them. don't in production mode because might // expose critical details of

d3.js - Reducing the number of anonymous functions needed in calls to D3's `attr` and the like -

so i've got rudimentary code works fine [btw i'm not using scales yet]: svg.selectall("rect") .data(dataset) .enter() .append("rect") .attr("x", function(d, i) { return * (w / dataset.length); }) .attr("y", function(d) { return h - (d.close * 4); }) .attr("width", w / dataset.length - barpadding) .attr("height", function(d) { return d.close * 4; }) .attr("fill", function(d) { return "rgb(0, 0, " + (d.close * 10) + ")"; }) .append("title").text(function(d) { if (d.date == null) { return "close: " + d.close; } else { return "date: " + datefmt(d.date)

ios - How can I make my bombs either fall faster or spawn faster the longer the game lasts? -

how can make bombs either fall faster or spawn faster longer game lasts? trying make game harder longer stay alive. harder every 10 bombs. have been researching days , have tried multiple answers similar questions. believe way had make bombs making harder me this. in advance! var bombspawnspeed : nstimeinterval = 0.40 var bombcounter : int = 0 this in update func. understanding regular update func of whole scene. override func update(currenttime: cftimeinterval) { /* called before each frame rendered */ if bombcounter >= 10 { if bombspawnspeed > 0.15 { bombspawnspeed -= 0.05 bombcounter = 0 } else { bombspawnspeed = 0.1 } } here bombs func enemies() { let bomb1 = skspritenode(imagenamed: "atomicbomb") let bomb2 = skspritenode(imagenamed: "emp") let bomb3 = skspritenode(imagenamed: "biobomb") let bomb4 = skspritenode(imagenamed: "che

sql server - Error when exeuting BCP: BCP host-files must at least contain one column -

Image
i want use bcp in database. purpose wrote query: exec xp_cmdshell 'bcp "select rtrim(ltrim(anumber)),rtrim(ltrim(bnumber)),rtrim(ltrim(duration)) [cdrdb].[dbo].[cdrtable]" queryout d:\myout.txt -s . -ucdrlogin -pbeh1368421 -f "d:\myformat.fmt" ' the format file myformat.fmt detail this: 9.0 3 1 sqlnchar 0 5 "," 1 anumber "" 2 sqlnchar 0 10 "," 2 bnumber "" 3 sqlnchar 0 10 "\r\n" 3 duration "" when run bcp command error: how can solve problem? you have -s . switch. don't think that's enough sql server. execute following in ssms: select @@servername; and use output of query instead of . . second, there need format file? supply following switches instead: -w -t, -r\r\n declare @stmt varchar(8000)='bcp "select rtrim(ltrim(anumber)),rtrim(ltrim(bnumber)),rtrim(ltrim(duration)) [cdrdb].[dbo].[cdrtable]" queryout "d:\myout.txt" -ucdrlog

Error when pasting from jGrasp to OneNote then back to jGrasp - Java -

this first time post stack on flow. so, i'm having techinical problem when copying code onenote. so, watch video lectures professor has on youtube, , create copy of code on jgrasp on mac, copy onenote 2016 store future reference. well, other day tried copy code jgrasp onenote, , when try compile it, following error, 15 times: mathfun.java:2: error: illegal character: '\u00a0' {   ^ i have found way around - if copy textedit first, doesn't have formating, , onenote, , jgrasp, works. so, jgrasp --> onenote --> jgrasp = error jgrasp --> textedit --> onenote --> jgrasp != error (no error) i can use work around, way nice if didn't have retype code have written run in jgrasp again. susjestions? thanks. p.s.: code example: public class mathfun { public static void main (string[] args) { system.out.println("test."); } } that character non-breaking space, onenote substituting ordinary s

sql - MySQL Boolean search with wildcard character not working -

i have used mysql boolean search mode on table using "fulltext" key on value. using engine=myisam. when search value 16-asdf using 16* not returning me in result . if i have value 16asdf returned when search using 16* here query: select * my_search ms match (ms.value) against ('16*' in boolean mode) order ms.id limit 100 it returns result values 1612345 , or 16asdf no result returned rows having value 16-asdf or 16-xxxx can please let me know why happening?

javascript - How to fix Wkhtmltopdf incorrect page count -

i trying merge multiple bills single pdf. every bill has multiple pages , every bill has unique header , footer. print out page count use javascript code documentation example. when build pdf single bill, page count correct, when pass in bills, page count total sum of every bill page. headers printed ok, unique every bill, page count summed together. there way fix page count? no, because each page processed separately. first webpages never total page count correct anyways, because other webpages not processed yet , footer on pdfs.

javascript - Coffeescript: How to import express module in one line -

currently, have write app = require 'express' app() to equivalent javascript: var app; app = require('express'); app(); how can in 1 line? i want clear thing here. first of all, here common way import express module , create application: express = require 'express' app = express() app variable here holds freshly created express application, while express variable holds framework itself. now, let's don't need express framework here, application. in case write: app = require 'express' and if don't need variable holding application, write that: do express = require 'express' though can't imagine why want it. of course, chain everything: do express = require 'express' .use(express.static('public')) .listen(3000) but me looks mess.