Posts

Showing posts from April, 2015

asp.net - Entity Framework migrations and refactor model into separate project -

i started out asp.net mvc project entity framework code first , migrations enabled. using standard template got model in same project rest of web site. want re-use model in project, cannot find step-by-step recipe how move model , migrations history, separate project. biggest concerns database comes out of sync model, or data in database lost. maybe it's nothing afraid of, i'll happy if can share experience! ok when have migrations turned on can move context, associated entities , migration configurations new project no problem. if leave of namespaces should not need change anything. because key migration history in database based on namespace + class of migration configuration file. example in web application have migrations @ codemigrations.migrations so contextkey in __migrationhistory table ends being codemigrations.migrations.configuration if move code new project , leave namespaces nothing need changed, if want namespaces updated reflect new base ...

python 2.7 - Writing a list of creation time of items in a folder -

i'm trying write text file creation date of each file in directory. had @ this question, i'm still in need of help, besides being curious why code below doesn't work. i think i'm close. kind of works creation date of folder , want know when files created. import os, os.path, time, datetime mydir = '/home/user/ebay/' mydir2 = '/home/user/' def writefiles(): open(mydir2 + '/items.txt', "wb") a: path, subdirs, files in os.walk(mydir): file in files: a.write(file+' , '+(time.ctime(os.path.getctime(file))) + os.linesep) writefiles() i error message: oserror: [errno 2] no such file or directory: 'pkv20zrzms' this odd, because there file called 'pkv20zrzms'. tried add directory location didn't make difference. the reason think i'm close when change (os.path.getctime(file) (os.path.getctime(path) creation date of folder, this: pkv20zrzms , fri mar ...

c# - ado.net OdbcCommand string -

i have database accessible via odbc , trying connect using ado.net's odbcconnection class. when try execute query dbcommand.commandtext = "select top 5 * table limit order column1" it returns entire table , not top 5. i tried using limit @ end of query, , yet not filter down query. how can limit result of query down couple few? thanks

How do I choose a branch other than "default" for "master" when converting a repo from Mercurial to Git? -

i need convert long-standing mercurial repo git repo (one-way, one-time conversion), , i'd pick mercurial branch other default master branch in git repo. i've converted mercurial git on smaller repo before, , after few gotchas easy google , fix, went well. in case, made sense map default branch master . (the other branch mapping "dev" "dev".) in new case, repository have inherited uses default branch development, , merges approved changes stable branch. so, when comes on git, i'd git master branch reflect stable mercurial branch, , branch reflect default mercurial branch. is possible? of course it's possible. just convert mercurial repo git, using whatever tools convenient you. if end final branches not liking, can rename them. use git rename . for example, rename branches "master" "dev" (that is, swap branches each other): git rename -m master master-old git rename -m dev master git rename -m ma...

sql - Number of palindromes in character strings -

i'm trying gather list of 6 letter palindromes , number of times occur using postgres 9.3.5. this query i've tried: select word, count(*) ( select regexp_split_to_table(read_sequence, '([atcg])([atcg])([atcg])(\3)(\2)(\1)') word reads ) t group word; however brings results a) aren't palindromic , b) greater or less 6 letters long. \d reads table "public.reads" column | type | modifiers --------------+---------+----------- read_header | text | not null read_sequence | text | option | text | quality_score | text | pair_end | text | not null species_id | integer | indexes: "reads_pkey" primary key, btree (read_header, pair_end) read_sequence contains dna sequences, 'atgctgatgcggcgtagctggatcga' example. i'd see number of palindromes in each sequence example contain 1 sequence have 4 3 , on. count per row: select read_header, pair_end, substr(read_sequence,...

graph - match colors with categories r -

upd: added reproducible code. dear all, trying match colors , categories. have 7 spreadsheets data. each spreadsheet data on population numbers of given species in several countries. i'd plot population number of each spp in each country against time, every country in different color (see below). thing is, list of countries varies each species, can't make loop: in case of wild boar, poland first color, in case of red deer, third one. example: year lv lt pl uk es 1974 21578 9250 2700 17610 8900 1975 19955 8800 3300 14280 9300 i created spreadsheet match colors , country names: code col.num cz 1 hu 2 pl 3 sl 4 lv 5 lt 6 es 7 ro 8 uk 9 here code match colors , country names (it creates 3 graphs, first 1 % of numbers relatively number in year of 1990): par(mar=c(5.1, 3.5, 4.5, 2), mfrow = c(3,3)) col.num <- 1:9 code <- c('cz', 'hu', 'pl', 'sl', 'lv', ...

sql - MySQL: Calculate 4 Week Average with 4 Week Offset -

this question related post made earlier: mysql: calculating data table 1 month offset but need build procedure queries table of contact data stored week. here's simplified example of table working with: +-----------------+------------+ | week_start_date | contacts | +-----------------+------------+ | 2015-03-08 | 12 | | 2015-03-01 | 20 | | 2015-02-22 | 5 | | 2015-02-15 | 17 | | 2015-02-08 | 8 | | 2015-02-01 | 2 | | 2015-01-25 | 16 | | 2015-01-18 | 10 | | 2015-01-11 | 4 | | ... | ... | +-----------------+------------+ what need figure out how calculate 4 week moving average has 4 week offset on top of that. instance, if wanted average contacts week of march 8, 2015, average of january 18 through february 8. in example above, average be: (10 + 16 + 2 + 8 ) / 4 = 9. , if wanted find average week of march 1, 2015, average of january 11...

java - Getting the size on an array from one method into another method where I will be filling the array with numbers -

i must ask user size of array. method must integer. must pass value method user fill array, method must float. it's throwing error in line float[] arraysize = new float [getlengthofarray()]; in second method. the error says "int[] cannot converted int". don't know do. here's entire code package exercise; import javax.swing.joptionpane; public class exercise3 { public static int[] arraylenght(){ int arraysize = integer.parseint(joptionpane.showinputdialog("enter array size")); int[] totalarraysize = new int[arraysize]; return totalarraysize; } public static float[] fillarray(){ float[] arraysize = new float [arraylenght()]; (int = 0; < arraysize.length; i++) { arraysize[i] = float.parsefloat(joptionpane.showinputdialog("enter number")); } return arraysize; } public static void calculatearithmeticaverage(float[] numbers){ int...

php - MySQL 1064 error for alter table -

this driving me nuts, can't figure out what's wrong. here query passed in mysqli_query: alter table `lc_products` add `default_category_id` int(11) not null after `sold_out_status_id`; this fatal error php throws: fatal error: 1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'alter table `lc_products` add `default_category_id` int(11) not null after `s' @ line 1 the exact same query works when inserted phpmyadmin. using xamp windows php 5.4 + mysql 5.5.4. does know what's going on, or wrong? $query = "alter table `lc_products` add `default_category_id` int(11) not null after `sold_out_status_id`;"; $result = mysqli_query($link, $query) or $this->_error($query, mysqli_errno($link), mysqli_error($link)); delete semi-colon query. $query = "alter table `lc_products` add `default_category_id` int(11) not null after `sold_out_status_id`";

python - Get Local File name after ZipFile extract() -

how local file name after zipfile extract() runs? when this: zipfile.zipfile(localzipfilepath, "r") zf: name in zf.namelist(): localfilepath = zf.extract(name, '/tmp/') print localfilepath the file exists in zip file is: src/xyz/somefile.txt localfilepath outputs this: /tmp/src the file written here: /tmp/src/xyz/somefile.txt , in graceful way. i think misunderstood something. zipfile.extract() method returns either full path either directory or file created specific zipfile member. the documentation doesn't state explicitly, source code method quite clear here: if member.filename[-1] == '/': if not os.path.isdir(targetpath): os.mkdir(targetpath) return targetpath self.open(member, pwd=pwd) source, \ file(targetpath, "wb") target: shutil.copyfileobj(source, target) return targetpath so either member filename ends in / (a directory), in case direct...

jquery - Javascript get element background image BUT eliminate the "url()" -

ive been working on image gallery ive been creating myself , im adding "zoom in" feature it. i know im close succeeding have 1 tiny issue. in javascript managed background property of image enlarged grabs image including url() . want url (http:.../) excluding url() . i hope isn't confusing if are, link project. click on image zoom in, alerts background-image property because wanted see fetches first. check out is possible? the simple solution slice method. first parameter specifies start selection, second specifies end selection end of string if it's negative. so, code should be: var bkimg = window.getcomputedstyle(sourceimg,null).getpropertyvalue("background-image"); var bkimgurl = bkimg.slice(4, -1);

Python Matrix Exponentiation -

this question has answer here: nth fibonacci number n big 10^19? 4 answers i use python 2.x or 3.x raise 2x2 matrix initially 0 1 1 1 to exponent of 10 19 or less. (that is, let m = matrix, m 10 19 ). however, don't want use numpy . (by way, is fibonacci generator ) ok, way you're asking question means stand no chance of achieving this. i'll explain; please don't offended: python wrong tool, , you're trying exclude helpers make little less wrong. you're trying numerical math in purest form -- , python scripting language can take advantage of numerical efficiency when using native libraries. 1 of these numpy , you've noticed (but didn't write) doesn't work, because numbers big fast when calculating m n larger n. even if there magic way optimize algorithm in matter allow matrix-matrix multiplication in single ...

spring - How can I parse a property and inject values back into the Environment? -

i have property parse , inject values environment. make these values available using @value annotation. eg. properties file or system property: settings.compoundproperty=abc.xyz.123 i parse , inject prop1=abc prop2=xyz prop3=123 back environment. able inject these new properties in bean follows: @value("${prop1}") prop1; @value("${prop2}") prop2; i tried this: @configurationproperties (prefix="settings") public class environmentproperties { @inject configurableenvironment env; public void setcompoundproperty(string s) { // parse s , inject prop1, prop2 , prop3 using env } however works if include @inject environmentproperties envprops; in class @value("${prop1}") prop1; attributes. how can without needing include envprops mentioned above ? you can use spring expression language (spel) all properties can accessed using environment in code below accessing prop1 , inject in v...

java - Retrieve rows even if value equal null -

i want retrieve database if 1 of fields has null this query @query("{'origin.airport.iatacode' : ?0,'scores.value' : ?1,'carriername' : ?2,'scores.datetimedimension' : ?3}") set<route> findbyall(string iatacode,integer value,string carriername,string datetimedimension); controller @requestmapping(value = "/filter", method = requestmethod.get, produces = mediatype.application_json_value) @timed public set<route> gettome() { return routerepository.findbyall("sow", null, "great lakes airlines", "201503"); } this query filter route collection depending on values(iatacode,value,carriername,datetimedimension) sometime 1 of values or more 1 has null ,so need filter other values , ignore values have null. can 1 me please or give me other idea filter available values?

What's wrong with my SQL code? Getting an error on line 9 -

i'm trying import code below mysql database. says have error on line 9 involving ')' token. idea how fix it? error message is: you have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 9 have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 6 have error in sql syntax; check manual corresponds mysql server version right syntax use near ')' @ line 10 create table user_types ( id int unsigned not null primary key auto_increment, name varchar(64), description varchar(255), rank int unsigned not null default 1 ); create table users ( id int unsigned not null primary key auto_increment, username varchar(64), email varchar(64) not null, password varchar(255) not null, ip_address varchar(255), user_agent varchar(255), type int unsigned not null default 1, first_name varchar(64), last_name...

android - TextView value from Row Position ListView -

what have setup listview has 1 textview , 2 buttons. trying when first button clicked, want give me value in textview. i have spent lot of time looking can't find answer work. have code in onclick button method: // position of button int position = pendinglist.getpositionforview((view) view.getparent()); //extract text string pendingusertext = pendingusers.get(position).get(r.id.name); something note use arraylist map populate listview , simple adapter. when this, problem when try toast.make , pass "pendingusertext" through it, null value. appreciated! here xml file <textview android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingbottom="2dip" android:paddingtop="6dip" android:textsize="16sp" android:textstyle="bold" android:height="30dp" /> <button android:id="@+id/addbutto...

spotify - LibSpotify login with oAuth Token -

i built web app (among other things) provides access spotify library. obtaining spotify oauth token works fine web api . my app allow stream music device while controlling web (or phone). sending (encrypted) oauth token device use libspotify play song. unfortunately, can see, libspotify can't authenticate oauth token , requires plain text password instead ? force me additionally ask user's password (bad ux) , store myself (bad idea in general). @spotify there plan change , add support login via oauth token in libspotify? other way avoid asking both, oauth , plain text password user? android sdk accepts oauth token playback. p.s. aware of similar question , facebook oauth token , quite old now. i reached out spotify , got following answer: there no plans on implementing this. they not accepting feature requests or bug reports libspotify. sounds bit discontinued @ point. anyways, answer question above: spotify seems force ask user authenticate via oau...

html5 - prefixed - what does this means -

when run html5 compatibility test in android native browser see indexeddb support marked "prefixed", while in chrome , other marked "yes". understand chrome latest version has full support indexeddb indexeddb support "prefixed" means? according mozilla page: https://developer.mozilla.org/en-us/docs/web/api/indexeddb_api/using_indexeddb "because specification still evolving, current implementations of indexeddb hide under browser prefixes. browser vendors may have different implementations of standard indexeddb api until specification has solidified. once consensus reached on standard, vendors implement without prefix tags. implementations have removed prefix: internet explorer 10, firefox 16, chrome 24. when use prefix, gecko-based browsers use moz prefix, while webkit-based browsers use webkit prefix." as per josh's comment: use following statement ensure compatibility: window.indexeddb = window.indexeddb || window.webki...

python - key error value 0 on modelformset when queryset is empty -

i want create multiple instances of model using modelformset. when queryset empty , parameter extra greater 0 raises error: environment: request method: request url: http://localhost:8000/alta_socies/proces_alta_projecte_autoocupat/adreces/ django version: 1.7.7 python version: 2.7.9 installed applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.formtools', 'inici', 'alta_socies', 'empreses', 'socies') installed middleware: ('django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contri...

c# - MSIL - Can I find the Visual Studio version that was used to build/compile a .NET assembly? -

is program name used build assembly written assembly available anywhere in msil code? visual studio doesn't build anything - visual studio uses msbuild building 1 : visual studio hosts msbuild load , build managed projects. in fact can build msil code without visual studio downloading microsoft build tools : if don't have visual studio installed on computer, can use build tools 2013 build managed applications. visual basic , c# compilers included in download. (in earlier versions, these tools included in stand-alone .net framework.) any compiler satisfies ecma 335 standard can compile valid common language infrastructure (cli) applications - mono c# compiler 1 such example. in other words, don't think it's possible obtain information visual studio version assembly. unless additional metadata added assembly visual studio (i don't think is), find out version of visual studio built specific assembly, you'd have adding own cu...

angularjs - angular select $touched validation -

i have form select , button enabled when form validated. works fine input box. however, $touched not seem working select. button enabled when select touched. supposed turn invalid when select touched. turns invalid , button disabled when select option , select default value. want work when select touched , user mouse pointer away. here html: <form role="form" name="frameversioneditor" novalidate class="form-horizontal col-md-12"> <div class="row"> <div class="form-group col-lg-2 col-lg-push-1" ng-class="{'has-error' : frameversioneditor.distributor.$invalid && frameversioneditor.distributor.$touched}"> <label>distributor</label> <select name="distributor" data-ng-model="mydistr" data-ng-options="distributors.key distributors.value distributors in distributoroptions" class="form-control" required> ...

c# - Linear Carousel with wrap enabled -

i want make carousel that's linear wrap enabled (so can scroll indefinitely in either direction , it'll wrap around) have carouseltype.linear, isn't wrap enabled. know of how either icarousel or uicollectionviews? can't find resources on how make custom icarousel layout... references there? alliance carousel this.carousel = new carouselview(frame) { datasource = new cylindericaldatasource(this), delegate = new cylindericaldelegate(this) }; this.carousel.carouseltype = carouseltype.linear; this.carousel.configureview(); this.view.addsubview(this.carousel); ------------edit-------------- to answer @rahul's question public override void didscroll (carouselview carouselview) { base.didscroll (carouselview); nint numofitems = carouselview.numberofitems; if (this._parentcontroller != null && this._parentcontroller._studioviewcontr...

how to send a pdf file through http-post -

i need send pdf file through http post. i'm sending using third party (nsoftware) dll. but question is, how receive @ server end , save it. i tried httplistener, unable do. can 1 me on this.. thanks, maddy i tried below.. public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { listener = new httplistener(); listener.prefixes.add("http://localhost:122/"); listener.authenticationschemes = authenticationschemes.anonymous; listener.start(); this.listenthread1 = new thread(new parameterizedthreadstart(startlistener)); listenthread1.start(); } private void startlistener(object s) { while (true) { processrequest(); } } private void processrequest() { var result = listener.begingetcontext(listenercallback, listener); result.asyncwaithandle.waitone();...

ios - How to do Auto Layout XIB being added programmatically? -

Image
i'm trying add subview programmatically people can horizontally scroll section. looks subview doesn't fit superview , content not showing here's code viewcontroller.m - (void)viewdidlayoutsubviews { [super viewdidlayoutsubviews]; (int = 0; < 2; i++) { cgrect frame; frame.origin.x = self.scrollview.frame.size.width * i; frame.size = self.scrollview.frame.size; self.scrollview.pagingenabled = yes; newssection *sectionview = [[newssection alloc] initwithframe:frame]; [self.scrollview addsubview:sectionview]; } self.scrollview.contentsize = cgsizemake(self.scrollview.frame.size.width * 2, self.scrollview.frame.size.height); } this storyboard , constraints. and newssection.xib this code of newssection.m -(id) initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if(self) { [[nsbundle mainbundle] loadnibnamed:@"newssection" owner:self o...

version control - Publishing a Project on GitHub -

i want use way upload project github ( source ): to publish project sources on github on main menu, choose vcs | import version control | share project on github . if have registered login , password, phpstorm establishes connection github using these credentials. if have not registered github credentials in phpstorm, login gitgub dialog box. specify github login , password or create account there. upon establishing connection, share project on github dialog box opens. specify name of repository store project sources in. default, phpstorm suggests name of current project. provide brief description of project functionality. click share button. phpstorm initiates creation of new repository on github , uploads project sources it. first step works, added github login data, test connection , works. upon step 2, after clicking share project on github link error shows up: error running git. cannot run program ...

css - vanilla bootstrap: 12 columns go beyond the screen -

Image
with vanilla bootstrap, run issue 12 columns go beyond full width, end having 1 fewer column. have solved issue time time without understanding why ran issue. know why happens? if using container-fluid, need use row-fluid too, see if works , stops columns misbehaving. plus have twon containers 1 should fine multiple rows.

css - li absolute postion in IE -

i having issue ie positioning li items position:absolute; . structure works fine in other browsers this: html <div class="container"> <div class="container-nav"> <ul class="nav"> <a href="#"> <li id="an-item">hi</li> </a> <ul> </div> <div> all parent containers position:relative , work fine in other browsers. in ie format items start positioning relative outside container. way got right adding position:absolute; <a> tag. when though throws off other browsers. way fix this? should use conditional css or not standard anymore?? you can't put anchor tag inside ul ie doesn't allow other browser way friendly invalid html structure not case ie can following : <div class="container"> <div class="container-nav"> <ul class="nav"> <li id="a...

java - ArrayExceptionOutOfBounds when returning the method -

i attempting create fillarray method fills , array 20 random values , sums every third value. getting arrayexceptionoutofbounds @ line 21 when method called. through debug have watched array fill proper values , sum calculated. wondering error is. public static void fillarray(){ //adding a[0], a[3], a[6}, ... double[] = new double[20]; for(int = 0; < a.length; i++) a[i] = math.random(); double sum = 0; int k = 0; do{ k += 3; sum += a[k]; }while(k < 20); system.out.println("sum = " + sum); } again looking determine reason error not way fix it. here problem: do{ k += 3; sum += a[k]; }while(k < 20); k equal 0, 3, 6, etc, until reaches 21 , try , access a[21] out of bounds. this because when k = 18 on 6th iteration of while loop, (k < 20) true , therefore while loop continues , adds 3 k making 21. after that, while loop stops k not less 20 anymore leaving k value of 21.

electron - Keyboard events in atom-shell -

i trying use atom-shell, don't understand how dom events differ normal browser. can't find doc either. if add: document.onkeydown = function() { alert('...'); } to index.html, seems atom-shell doesn't capture event, , instead forwards call terminal in ran atom-shell myapp. is there documentation somewhere how dom events work in atom-shell? edit: happens when run atom-shell terminal window (in osx). if run app first starting atom application , dragging app inside drag area, works fine... it's bug: here github issue

c# - Why can't I retrieve the value for parameters of type out or ref using Type.InvokeMember? -

a long title, wanted specific. title question. though method invokemember calling has out parameter , assigning value to parameter can't grab value. here code using: string parameter = ""; int result = convert.toint32(typeof(ability).invokemember(selectedmove, bindingflags.invokemethod | bindingflags.public | bindingflags.static, null, null, new object[] { parameter })); i changed this, makes work intended don't know why: object[] args = new object[1]; //necessary retrieve ref/out parameter int result = convert.toint32(typeof(ability).invokemember(selectedmove, bindingflags.invokemethod | bindingflags.public | bindingflags.static, null, null, args)); in first code example, call invokemember doesn't modify value of parameter variable, replaces first item in parameter array (which points different string instance). since didn't keep reference array, can't retrieve value of output parameter. in other words: array contains cop...

Database Health - SQL Server -

if asks me check database health in particular sql server database, has been running couple of years, possible areas need check? have tools support that? kindly provide recommended links refer. you need 2 things (at bare minimum): make sure backups being taken on regular basis , @ least once full restore done backups , restore verified contain valid, date, data. https://msdn.microsoft.com/en-us/library/ms187510.aspx run 'dbcc checkdb' on instance. take while , can resource hog (you may want run @ night or on weekend.) careful in reading results , figuring out if detects errors. https://msdn.microsoft.com/en-us/library/ms176064.aspx http://www.sqlskills.com/blogs/paul/category/checkdb-from-every-angle/ if above may held responsible any, , all, issues ever occur sql server including data entry errors.

c++ - Loading an image from a URL into a variable/opencv Mat -

bool loadimage(string inputname, mat &image) { bool from_net = true; if (inputname.find("http") != string::npos) { string url = inputname; if (inputname.find("\"") == 0) { url = inputname.substr(1,inputname.length()-2); } ofstream myfile; myfile.open ("test.jpg"); // create writer handle stream curl_writer writer(myfile); // pass easy constructor , watch content returned in file! curl_easy easy(writer); // add option easy handle easy.add(curl_pair<curloption,string>(curlopt_url,url)); easy.add(curl_pair<curloption,long>(curlopt_followlocation,1l)); try { easy.perform(); } catch (curl_easy_exception error) { // if want entire error stack can do: vector<pair<string,string>> errors = error.what(); // otherwise print stack this: //error.print_traceback(); } m...

ruby - Embed a Rails form partial into another page -

i'm building rails 4.2.0 app contact page (this page have semi-empty controller). i'm trying embed form partial controller. here code (minus text): <% if user_signed_in? %> <% render 'enquiries/form' %> <% end %> when run error 'first argument in form cannot contain nil or empty'. my enquiries form looks basic rails form: <%= form_for @enquiry |f| %> <% if @enquiry.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@enquiry.errors.count, "error") %> prohibited enquiry being saved:</h2> <ul> <% @enquiry.errors.full_messages.each |message| %> <li><%= message %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :subject, "subject:" %><br> <%= f.text_field :subject %> </div> <div class="field...

javascript - Intel xdk $.getJson fail on apk -

i'm developing app intel xdk, , have make json request website. works if try app xdk emulator , if try app preview if build apk file, install it, request fail. this example call: $.getjson("http://time.jsontest.com", function(data){ alert(data);}); and response: get http://time.jsontest.com/ 404 (not found) my device connected. in index.html have included "intelxdk.js" , "xhr.js" this page says ok, solved.i had add <access origin="*" /> config.xml file. more info here: https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html

html - positioning in having multiple background images in css -

i had image had used background in css. want have 2 images, 1 after other. think, earlier website had 1 sponsor, there 2 sponsors, , so, 2 logos. i able add 2 background images googling around bit, position of second image right on top of first. when give pixel values, goes off well. this code far .app-header-logo { background-image: url("../images/image1.png"),url("../images/image2.png"); background-position: center center, 200px center; background-repeat: no-repeat; float: left; height: 50px; vertical-align: middle; width: 265px; } .app-header-logo { float:left; width:190px; height:50px; text-indent:-999px; } how can have image2 right after image1? this can accomplished using css sprites, sprites you'll able combine multiple images 1 single .png or .jpg file. there's great online tool combine images 1 single file , use them need call class example .sponsor-1 contain background-position ...

html - Is it possible to make <script> tags visible? -

i make script tag visible. possible? i don't know why want that, simple css should trick: <!doctype html> <head> <title>sample page</title> <style type="text/css"> script { display:block; } </style> </head> <body> <script type="text/javascript"> (var = 0; < 10; i++) { console.log("why?"); } </script> </body> https://jsfiddle.net/0v2wo3a2/ edit: if script in <head> , you'll have make head visible, too: <style type="text/css"> head, script { display:block; } </style> also, mike pointed out in comments, looking option: &lt;script type="text/javascript"&gt;<br/> &nbsp;&nbsp;for (var = 0; < 10; i++) {<br/> &nbsp;&nbsp;&nbsp;&nbsp;console.log("why?");<br/> &nbsp;&nbsp;}<br/> &lt;/script&gt; t...

python - why would I be getting Invalid block tag: 'static' error? -

this head of of base.html: {% load staticfiles %} <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!-- css foundation - base of client side --> <link rel="stylesheet" href="{% static 'css/foundation.css' %}" /> <!-- css smooth div scroll --> <link rel="stylesheet" type="text/cs' %}" href="{% static 'top_scroll/css/smoothdivscroll.css' %}" /> <!-- css custom --> <link rel="stylesheet" href="{% static 'css/custom.css' %} /> <script src="{% static 'js/vendor/modernizr.js' %}"></script> </head>` this part body, statics files above loading correctly, have images in body want load, located in same folder have written code in file , used {% include "images.html" %} add them base. ex. <im...

Display progress in a long loop in Unity3d -

i'm building space game, populated thousands of star systems. right now, there function generates these thousands of systems. takes 5-10 seconds generate, , have simple progress bar updating user in progress. after searching i've decided use coroutine, there little problem: when call function generate star systems, code called function keeps on going, reporting 0 stars (because haven't been generated yet). i have feeling coroutines not answer me. basically, looking way simulate application.doevents update gui. here sample of code: // start generating thousands of systems startcoroutine(galacticmap.generaterandomgalaxy()); // after universe generated... game.mygalaxy.starsystems = galacticmap.mygalaxy.starsystems; // report number of systems print(string.format("generated {0} systems", game.mygalaxy.starsystems.count)); in galacticmap.generaterandomgalaxy() yielding yield return new waitforseconds(0.1f); however, effect not looking for: execution go...

php - Selecting multiple fields from <option> and adding them to database -

background: i creating 3 tier e commerce website sells books. within website have created form (only accessible staff members) allows staff member add new book system (the database). at moment have table within database records following data: book_isdn // unique identifier of each book. book_cat book_title book_author etc.. along this, have created table book categories stores following: cat_id cat_title i have defined following rows in categories table: cat_id 1 = business books cat_id 2 = computing books cat_id 3 = science books cat_id 4 = history books etc the problem: in form allows staff member add new book, have list: <select multiple name="b_category" style = "width:150px" required> <?php $get_cats = "select * categories"; $run_cats = mysqli_query($connect, $get_cats); while ($row_cats = mysqli_fetch_array($run_cats)) { $cat_id = $row_cats['cat_id']; $cat_title = $row_cats[...

php - query was empty error and I can't work out why -

i'm starting build simple product display system, build own skills, use on website work. list.php <html> <head> <title>retrieve data database</title> <?php $username=''; $password=''; $database=''; ?> </head> <body> <ul> <?php // connect database server mysql_connect(localhost,$username,$password); // select database @mysql_select_db($database) or die( 'unable select database'); // sql query $sql = "select * products category = 30"; // execute query (the recordset $rs contains result) $result = mysql_query($sql); // loop recordset $rs while($row = mysql_fetch_array($result)) { // name of person $strname = $row['make']; // create link person.php id-value in url $strlink = "<a href = 'product.php?id = " . $row['id'] . "'>" . $strname . "</a>"; // list link echo "<li>" ...

android - How to pass extra data from this activity to the next activity? -

how pass data activity? public class detailactivity extends activity { @override public void onbackpressed() { } @suppresslint("nextapi") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_detail); button btnforum = (button) findviewbyid(r.id.btnforum); button btnkuis = (button) findviewbyid(r.id.btnkuis); if (android.os.build.version.sdk_int > 9) { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy); } showinfo(); final button btnlogout = (button) findviewbyid(r.id.btnback); btnlogout.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { intent newactivity = new intent(detailactivity.this,mainactivity.class); startactivity(newa...

Why is my python program not running the code in the right order? -

Image
i started out in python , programming hangman game base on book. may know why code below not running in order want run? when execute program, letter guessed in guess suppose go used indicate letters has player guessed find out right word. however, happens every 2 turns , not every 1 turn. i've indicated hangman acsii art @ start of program in image file reference, below image code. gladly appreciate help. thanks! max_wrong = len(hangman)-1 words = ("book","toy","paper","school","house","computer","television") word=random.choice(words) so_far = "-"*len(word) wrong = 0 used = [] print "welcome hangman! guess the word before the man hang dead!" print "you can guess 1 letter @ time!" while wrong < max_wrong , so_far!=word: print hangman[wrong] print "\nyou've used following letters:\n",used print "\nso far, word is:\n", so_far ...