Posts

Showing posts from May, 2011

Using wordpress shortcodes to render PHP -

i'm trying create shortcode render custom php pages. i'm getting odd behaviour i'm not getting if used wordpress template. for example. if create template code: <article id="post-<?php the_id(); ?>" <?php post_class(); ?> <?php generate_article_schema( 'blogposting' ); ?>> <div class="inside-article"> <?php $content = apply_filters( 'the_content', get_the_content() ); global $post; $post_info = get_post($post->id); $content = $post_info->post_content; $ind = strrpos($content, "/"); $page = substr($content, $ind+1); $path = substr($content, 0, $ind+1); $olddir = getcwd(); chdir($_server["document_root"].$path); include($page); chdir($olddir); ?> </div><!-- .inside-article --> </article><!-- #post-## --> then in wordpress page enter location of file, e.g. /contact/contact_form.php. contact_form.php page...

android - HTML image doesn't show up on mobile web browser -

i'm tinkering html first time , running issue. in basic page, image shows fine on pc. i've transferred file samsung tablet , image doesn't load. html file , gif saved in same folder on tablet. works fine using chrome/firefox on laptop. assumed using same browser on tablet. there tag need add use on mobile devices? thanks <!doctype html> <html> <head> <title>image map</title> </head> <body> <img src="dial_face.png" alt="image map" border="0" width="300" height="300"> </body> </html> can't reproduce since it's basic, i'll try wild guess: 1) check image name proper uppercase , lowercase letters - must match exactly. 2) remove usemap="#map1" attribute.

python - How to overide web_kanban Js file to project_inherit? -

i customize number of items kanban view shows before user has click 'show more' button. in addons/web_kanban/static/src/js/kanban.js there following snippet of code: want example override js file customized module instance.web_kanban.kanbanview = instance.web.view.extend({ template: "kanbanview", ... init: function (parent, dataset, view_id, options) { this._super(parent, dataset, view_id, options); ... this.limit = options.limit || 40; ... },

OpenLayers 3 : DragZoom, change shortcut from [Click + Shift] to [Click + Ctrl] -

i'm trying change default behavior of ol3 on dragzoom event: want feature, default configured on [click + shift], working instead [click + ctrl]. do have idea of how perform that? already consulted online doc: http://openlayers.org/en/latest/apidoc/ol.interaction.dragzoom.html seems "condition" property, can't figure out how that. the "condition" value has function called when event occurs. openlayers doesn't come ol.events.condition.ctrlkeyonly , define own. you'd need disable default dragzoom interaction first, add own: var interactions = ol.interaction.defaults({ shiftdragzoom: false }); interactions.push(new ol.interaction.dragzoom({ duration: 200, condition: function(mapbrowserevent) { var originalevent = mapbrowserevent.originalevent; return ( originalevent.ctrlkey && !(originalevent.metakey || originalevent.altkey) && !originalevent.shiftkey); } })); see in action in jsf...

Using Declare in SQL Server view -

i have query this: declare @year_start int declare @year_end int set @year_start = 2005 set @year_end = 2014 ; p_year ( select p_year = @year_start union select p_year = p_year + 1 p_year p_year < @year_end ), interval (--- ), cte (--- ), cte_1 (--- ) select cte_1 rank <= 3 order i tried using creating table valued function can't how manipulate variables in table valued function declaration. whereas tried creating table valued function as: create function p_count() returns table declare ... ... i want make view declare statement not allows me. how can make view? your create function script misses begin : create function p_count() returns @tablename table (structure here) begin declare... ... return; end; here syntax reference on msdn

c++ - Error: std::bad_alloc Rstudio -

after running code: t1 <-sys.time() df.m <- left_join(df.h,darta3,by=c("year","month","ma","day")) t2 <- sys.time() difftime(t2,t1) i have error. error: std::bad_alloc the dimension of matrix have tried create 74495*2695 = 180.10^6 rows. the computer in run code has 20 gb of ram i tried memory.limit() did not solve issue.

How to get value from canvas using selenium webdriver -

i want check whether balance amount correctly deducted bet amount using selenium webdriver. game in canvas, how can value canvas. below canvas code: <canvas width="3123" height="736" style="position: absolute; left: 0px; top: 0px; width: 3123px;height: 736px;"> </canvas>

It is possible to use glassfish as front end to other servers? How? -

as done apache , mod_jk access applications without need type port numbers, want glassfish. ff possible how it? no not possible because doesn't make sense. glassfish application server , not intended use reverse proxy. there other tools fit job, apache, nginx or squid. without need type port numbers, want glassfish for applications running on glassfish, can changing port of specific http-listener 80 (http) or 443 (https). see also: how can use glassfish under linux reverse-proxy?

windows - Proper SpreadsheetML file extension -

i want create a spreadsheetml file on local drive can opened in ms excel or open office clicking on file in windows explorer. i tried filename extensions registered microsoft excel find far. of them ( .xls example) allows file opened, after "file in different format specified file extension" warning dialog. extensions (like .xlsx ) causes excel show format error dialog without opening file. wikipedia tells extension should .xml , registered opened web browser default. this , this , this similar questions downloading file web , setting proper content-type. can not change content-type local file. this article explains how annoying extension hardening mechanism works , how disable it, think wrong force user disable security features allow spreadsheet file opened. so there no solution or missing something? now open office can open .xlsx (and read) files , excel can open (and read) .ods files. suggestion pick 1 of them best suits audience , understand...

c# - write to file read operations -

i have read text file has millions of records. while reading file have implement "tracker" write last read linenumber log file. don't want log file open , write operation affect application performance. can suggest me how implement it? p.s. using yield read big file, , have multiple files that. want stop reading operation if file has invalid record...while read operation going on want somehow want let end users know far has read , number of line - file read in progress. using (streamreader reader = new streamreader(_filenameandpath)) { while (reader.endofstream == false) { string data = reader.readline(); _filelinenumber = _filelinenumber + 1; //this line number should go tracker file logger.trace(_filelinenumber ) //............ } } logger class : public static class logger { .......

c++ - Finding the index of a string inside a field of strings -

my apologies basic question, i'm new rcpp , c++ r. i have field ( arma::field ) have initialized hold strings ( arma::field<std::string> my_vector ). have string std::string id somewhere inside field of strings, , find position of is. i'm used doing vectors , numbers similar below: arma::vec fun(arma::vec input_vector){ // find vector equals 5 (for example) uvec index = arma::find(input_vector == 5); return index; } i tried exact same thing, given string instead of number compare: arma::uvec fun(arma::vec input_vector, std::string id){ // find vector string id uvec index = arma::find(input_vector == id); return index; } this returns error error: invalid operands binary expression ('arma::vec' (aka 'col<double>') , 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >')) which made sense because vector not initialized contain strings. though d...

Python Import error while running through apache -

actually i've included python script inside cgi script back-ticks. while running script have error "importerror: no module named skimage" through apache web server. when run via command line working properly. os: rhel 6.5 python: 2.7.8 $pythonpath = /usr/local/bin httpd conf (only cgi part): <directory /home/*/public_html/cgi-bin> options execcgi addhandler cgi-script .py .cgi sethandler cgi-script </directory> scriptalias /cgi-bin/ "/var/www/cgi-bin/" <directory "/var/www/cgi-bin"> allowoverride none options execcgi order allow,deny allow </directory> note: 1. selinux disabled 2. shebang lines included. can help?. thanks in advance. maybe library installed , not root. put library script in same folder of main script , try.

javascript - window.location.hostname results in t.sharethis.com why? -

i running .net site locally on localhost. when run command window.location.hostname t.sharethis.com. have sharethis widget, why commands results in text? the url http://localhost:54687/ update: when remove sharethis widget, staticxx.facebook.com .

.net - polymorphism for external package -

Image
in project included external package control autocompletetextbox ( https://wpfautocomplete.codeplex.com/ ). i have on screen keyboard. whenever user clicks on textbox, keyboard assigns keybord property has , each click on number adds number textbox. some textbox must autocomplete , others must usual textbox. the problem here autocompletetextbox doesn't inherits textbox, therefore cannot make unique "assign textbox" keyboard. both controls share property "text", need use. public partial class keypad : usercontrol { private autocompletetextbox _controlasignado; //this should generic class or interface public keypad() { } public void asignarcontrol(autocompletetextbox control) { _controlasignado = control; } private void button_click(object sender, routedeventargs e) { button button = sender button; switch (button.commandparameter.tostring()) { case "back": ...

Liferay URL problems -

i little confused liferay's friendly url mechanism , utility classes. can please explain url me in detail? http://127.0.0.1:8080/web/guest/home ^ ^ ^ ^ ^ ^ prot. hostname | | | layout friendlyurl port | sitename ??? part 4 web miracle me , seems indicating if site staged, public or private? the next question be, utilclass use guarantee layout exists in site. you're right, web part indicates the site public , private pages ot group . check if layout exists friendlyurl of layout use : layoutlocalserviceutil.getfriendlyurllayout(long groupid, boolean privatelayout, string friendlyurl) if doesn't suit there other methods in class may. liferay doc: layoutlocalserviceutil

javascript - How to determine is the customer from outside the country? -

i'm wondering how can check if customer outside country before logged in? display popup message depending on it. you have 2 options : use geolocation api (but can refuse it) , resolve gps coordinates get location ip address service ip2location

Root directory of my git project deleted, and I have no idea why -

this question has answer here: how revert uncommitted changes including files , folders? 10 answers this output of git status : changes not staged commit: (use "git add/rm <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) deleted: freecodecamp no changes added commit (use "git add" and/or "git commit -a") freecodecamp root directory of git project, , such can't perform git commands. have no idea how happened, may helpful know common git commands are. on regular basis, add files git repo , push them remote @ end of day. does know how happened? freecodecamp root directory of git project, , such can't perform git commands. i don't think that's true. if freecodecamp root directory wouldn't able run g...

vba - Referring to a range based on variables in excel? -

i trying set macro will, @ point, end setting cell sum of few cells. cells summed, however, variable, , based on other things (and change on each iteration of macro). have coded macro such know row cells on, column of beginning cell , column of ending cell (ie. perhaps a600 a606 summed). however, have set these column , row assignments variables, y, xstart, , xend. how have sum select these ranges, of cells purely defined variables? set rng = "=sum(& y & xstart &, & y & xend &)" this initial guess? use set when setting reference object. range.formaula take string argument , "=sum()". sub example() dim xstart long, xend long dim targetrange range, sumrange range dim y string y = "b" xstart = 2 xend = 100 set sumrange = range(" & y & & xstart & ":" & y & xend) set targetrange = range("a1") targetrange.formula = "=sum(...

android - Type_linear_acceleration sensor not working but TYPE_ACCELEROMETER is working -

when use sensor.type_accelerometer working fine , giving me acceleration values when use type_linear_acceleration not found in list (see code). here mainactivity.java public class mainactivity extends appcompatactivity { sensormanager sm = null; textview textview1 = null; list list; sensoreventlistener sel = new sensoreventlistener(){ public void onaccuracychanged(sensor sensor, int accuracy) {} public void onsensorchanged(sensorevent event) { log.i("tag","inside sensor listener"); textview1.settext("x:"+event.values[0]+"\ny:"+event.values[1]+"\nz:"+event.values[2]); } }; @override protected void onresume() { super.onresume(); sm = (sensormanager)getsystemservice(sensor_service); list = sm.getsensorlist(sensor.type_linear_acceleration); //log.i("tag",sensor.type_accelerometer); if(list.size()>0){ sm.registerlistener(sel,sm.getdefaultsensor(sensor.type_li...

python - How to assert that a type equals a given value -

i writing test method , want validate method returns specific type. however, when try error. def search_emails(mail): data = mail.uid('search') raw_email = data[0][1] return raw_email the type(raw_email) is: <class 'bytes'> when run test: def test_search_emails_returns_bytes(): result = email_handler.search_emails(mail) assert type(result) == "<class 'bytes'>" i error. how can state assertion test pass? or there better way write test? e assert <class 'bytes'> == "<class 'bytes'>" you can use is operator check variable of specific type my_var = 'hello world' assert type(my_var) str

java - Finding the original index after stripping a string -

i have function following: int getindex(string noisystring) { string quietstring = noisystring.replaceall("[^a-z]", ""); int quietstringindex = findindexinquietstring(quietstring); return originalindexinnoisystring; // ??? } after stripping string of non alphabetical characters, find arbitrarily chosen index inside stripped string. how can convert index 1 can used unstripped string? it sounds trying index in non-filtered string of same character @ chosen index in filtered string. (ie. have string s1 = "abc123def" s1.replaceall() = "abcdef". want original index of character @ index 4 in filtered string. character @ index 4 in filtered string e. index value in unfiltered string 7.) the simplest brute force way use counter go through string keeping track of index to, meanwhile having separate counter variable keep track of how many characters have been passed valid filtered string. public static int getoriginalin...

c# - .NET Core exclude a class from project -

how can exclude class project in .net core i don't see context-menu option in visual studio 2015 excluding file. read couple of areas on how exclude https://github.com/aspnet/home/issues/1464 , tried following { "version": "1.0.0-*", "dependencies": { "htmlagilitypack.netcore": "1.5.0.1", "microsoft.entityframeworkcore": "1.0.0", "microsoft.entityframeworkcore.sqlserver": "1.0.0", "microsoft.extensions.configuration": "1.0.0", "microsoft.extensions.configuration.abstractions": "1.0.0", "microsoft.extensions.configuration.json": "1.0.0", "microsoft.extensions.dependencyinjection": "1.0.0", "netstandard.library": "1.6.0", "system.linq": "4.1.0", "system.xml.xmlserializer": "4.0.11" }, "frame...

tensorflow - You must feed a value for placeholder tensor 'c_1' with dtype float and shape [1] -

i read issue same problem, looks issue different. want freeze graph , use it. here simple example how this. first, create session , save both checkpoint , graphdef: a = tf.variable(tf.constant(1.), name='a') b = tf.variable(tf.constant(2.), name='b') c = tf.placeholder(tf.float32, shape =[1], name="c") add = tf.add(a, b, 'sum') add2 = tf.add(add, c, 'sum2') dir_path = "<full_path>/simple_store" tf.session() sess: tf.initialize_all_variables().run() sess.run([add2], feed_dict={c:[7.]}) tf.train.saver().save(sess, dir_path + "/" + 'simple.ckpt') tf.train.write_graph(graph_def=sess.graph.as_graph_def(), logdir=dir_path, name='simple_as_text.pb') then use bazel tool freezing such way: ../tensorflow/bazel-bin/tensorflow/python/tools/freeze_graph --input_graph=simple_store/simple_as_text.pb --input_checkpoint=simple_store/simple.ckpt --output_graph=simple_store/freeze_out.pb --ou...

javascript - JS Countdown timer for website counts from opening of page -

i'm working on html file, , working on countdown timer in middle of page counts down until site released. screenshot: http://image.prntscr.com/image/4fd8693f6df14261aacb8333ee4a4859.png (i linked because it's on 2mb) var targetdate = new date().gettime() + 2592000000 //time in milliseconds, in case it's 1 month. slidechanges = [ { days:0, hours:0, minutes:0, seconds:6, slide:2}, { days:0, hours:0, minutes:0, seconds:0, slide:3} ], quickjump = 10000, api = revapi432; !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jquery)}(function(t){"use strict";function e(t){if(t instanceof date)return t;if(string(t).match(o))return string(t).match(/^[0-9]*$/)&&(t=number(t)),string(t).match(/\-/)&&(t...

Google Autocomplete address form is not working in yii2 -

i creating 1 application using yii2 in want use google autocomplete form search zip code or location. have include contains still script not working there mistake doing? below code. view file <script src="https://maps.googleapis.com/maps/api/js?key=aizasydo_sej0fdet4kx7dvnsutoulir_1zuvu4&libraries=places&callback=initautocomplete" async defer></script> <div class="search-form"> <?php $form = activeform::begin(['id' => 'form-search']); ?> <?= $form->field($modelsearchform, 'location')->textinput(['placeholder' => 'select location'])->label(false) ?> <?php echo $form->field($modelsearchform, 'search')->textinput(['placeholder' => 'start typing looking out for'])->label(false); echo html::hiddeninput('searchid', '', [ 'id' => 'searchid' ]); echo html::hiddeninput('locat...

c# - Paramterized Queries -

i new visual c#, , confused on how write parameterized queries. here code without them, using system; using system.windows.forms; using system.data.sqlclient; namespace insert_data { public partial class form1 : form { private void button1_click(object sender, eventargs e) { sqlconnection con = new sqlconnection("data source=ztabassum\\sqlexpress01;initial catalog=introdatabase;integrated security=true"); con.open(); sqlcommand sc = new sqlcommand("insert employee values ('"+ textbox1.text +"' , " + textbox2.text + ", '" + textbox3.text + "', " + textbox4.text + ", " + textbox5.text + ");", con); int o = sc.executenonquery(); messagebox.show(o + ":record has been inserted"); con.close(); } } } i not sure on how write parameterized queries each of text boxes. i added ...

html - Jquery, .length + 1 seems to be adding multiples of 7 -

i have jquery script add input fields @ click of button, need these numbering up, there 4 fields called first: jsfiddle link http://jsfiddle.net/1orkxk2y/ ptno1 desc1 qty1 amnt1 when add field clicked expected ended numbers in brackets: ptno2(7) desc2(7) qty2(7) amnt2(7) code below: $(document).ready(function() { $("#add").click(function() { var intid = $("#test div").length + 1; var fieldwrapper = $("<div id=\"test\" class=\"row\"/>"); var fptno = $("<div class=\"col-md-2\"><input type=\"text\" name=\"ptno" + intid + "\" class=\"form-control\" /></>"); var fdesc = $("<div class=\"col-md-2\"><input type=\"text\" name=\"desc" + intid + "\" class=\"form-control\" /></>"); var fqty = $("<div class=\"col-md-2...

javascript - Not able to create a clicking slideshow -

i'm having problems creating clicking slideshow in jquery. have 5 image display can click on of them , image cover screen. after having image pop up, want click controllers display next image without coming out of current image. here code in html images <div class="img-container"> <div class="box-img" > <img src="images/cold.jpg" alt="kikilidesigns" id="1"> </div> <div class="box-img "> <img src="images/dear.jpg" alt="kikilidesigns" id="2"> </div> <div class="box-img"> <img src="images/polar.jpg" alt="kikilidesigns" id="3"> </div> <div class="box-img "> <img src="images/fishing.jpg" alt="kikilidesigns" id="4"> </div> <div class="box-img"> ...

java ee - Openjpa slice with spring issue -

i have been trying configure openjpa-slice spring boot. configuration shared follows: @configuration public class datasourceconfiguration extends jpabaseconfiguration{ @bean(name = "slice1") public datasource datasource() { jndidatasourcelookup datasourcelookup = new jndidatasourcelookup(); datasource datasource = datasourcelookup.getdatasource("java:/mysqlxads"); return datasource; } @bean(name = "slice2") public datasource datasource2() { jndidatasourcelookup datasourcelookup = new jndidatasourcelookup(); datasource datasource = datasourcelookup.getdatasource("java:/mysqlxads2"); return datasource; } @override protected map<string, object> getvendorproperties() { hashmap<string, object> map = new hashmap<string, object>(); return map; } public localcontainerentitymanagerfactorybean entitymanagerfactory( entitymanagerfactorybuilder builder) { map<string, object> proper...

node.js - Re-render a page without old data -

in application if call res.render so res.render( 'index', {list:output1}) it display correctly first page. if example first page ouputs this 1 2 3 and press button , load other page calls res.render should this a b the result have first output, so a b 3 is there way 'refresh' no old data included? thank you stupid mistake on part.... i realized output variable global. declaring in function (making new, empty output each time) didnt have problem

Repetitions in MYSQL -

following mysql query, i'm hoping repeat data in result. i've tried union , throws syntax error. select attribute_name attribute (select attribute_id platform_metadata_map ); any appreciated ! this wrong beacuse select attribute_name attribute (select attribute_id platform_metadata_map ); the clause don't match (you shoudl use attribute_id = (select ....)) anyway want repeat should repet teh query using union select attribute_name attribute union select attribute_name attribute union select attribute_name attribute union select attribute_name attribute

arrays - Script terminates prematurely after do loop. Last "echo" is not executed. -

i looking execute following script below. issue encountering not execute after loop. doesn't matter happen have after loop, never executes, def missing somewhere. also, suggestions on more efficient way or writing script? new scripting environment , open better ways of going things. #!/bin/bash # mcidas environment path=$home/bin: path=$path:/usr/sww/bin:/usr/local/bin:$home/mcidas/bin path=$path:/home/mcidas/bin:/bin:/usr/bin:/etc:/usr/ucb path=$path:/usr/bin/x11:/common/tool/bin:. export path mcpath=$home/mcidas/data mcpath=$mcpath:/home/mcidas/data export mcpath #variables basedir1="ftp://ladsweb.nascom.nasa.gov/alldata/6/mod02qkm" #terra basedir2="ftp://ladsweb.nascom.nasa.gov/alldata/6/myd02qkm" #aqua day=`date +%j` day1=`date +"%j" -d "-1 day"` hour=`date -u +"%h"` min=`date -u +"%m"` year=`date -u +"%y"` segment=1 count=$(ls /satellite/modis_processed/ | grep -v ^d | wc -l) count_max=25 file...

Error compiling C code for python hmmlearn package -

i'm having trouble getting hmmlearn package install (in virtual environment); seems have underlying c code. package installs fine pip , when try import core class, error: in [1]: import hmmlearn in [2]: hmmlearn import hmm --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-2-8b8c029fb053> in <module>() ----> 1 hmmlearn import hmm /export/hdi3/home/krono/envs/sd/lib/python2.7/site-packages/hmmlearn/hmm.py in <module>() 19 sklearn.utils import check_random_state 20 ---> 21 .base import _basehmm 22 .utils import iter_from_x_lengths, normalize 23 /export/hdi3/home/krono/envs/sd/lib/python2.7/site-packages/hmmlearn/base.py in <module>() 11 sklearn.utils.validation import check_is_fitted 12 ---> 13 . import _hmmc 14 .utils import normalize, log_normalize, iter_from_x_lengths 15 importerror: ...

javascript bookmarklet with input -

i trying create javascript bookmarklet iterate values within. basically i'm trying input { "type": "collection", "id": "home_featured_collections_7" }, then input values current iteration 7 , final iteration 10 , output like { "type": "collection", "id": "home_featured_collections_7" }, { "type": "collection", "id": "home_featured_collections_8" }, { "type": "collection", "id": "home_featured_collections_9" }, { "type": "collection", "id": "home_featured_collections_10" }, my first instinct have copy original text clipboard , output clipboard couldn't figure out how this. i've set using prompts javascript:(function(){ text=prompt("expand text", ""); current=prompt("current iteration", ""); final=prompt("final iterat...

html - Sync a FileReader in a for loop: Javascript -

i trying implement javascript program read bunch of csv files particular directory containing sub-directories. so, thinking of using javascript read multiple files using webkitdirectory , reading files , using java push them. html form <input id="csv" type="file" multiple webkitdirectory directory> <input type="button" onclick="readcsv()" value="submit"> javascript read files function readcsv(){ var fileinput = document.getelementbyid("csv"); var filecount = fileinput.files.length; if( filecount != 0) { alert(filecount); var reader; (var = 0; < filecount; i++) { reader = new filereader(); reader.onload = function () { document.getelementbyid('out').innerhtml = reader.result; // once file read, send javaservlet save on server. }; reader.readasbinarystring(fileinput.files[i]); ...

excel vba - VBA to prompt for DAT with no delimitation, add new sheet, and import the DAT -

the code prompts user select excel file , 5 different dat files. excel file loaded onto sheet, , new sheets supposed added each of dat files imported to. excel file loads correctly, program errors out @ first dat file import attempt. the error: "run-time error '1004': application-defined or object-defined error". this error occurs: activesheet.querytables.add(connection:= _ difn, destination _ this rest of code: ' prompt user files cafn = application.getopenfilename("excel files (*.xlsx), *.xlsx") difn = application.getopenfilename("esdi dat file (*.dat), *.dat") fofn = application.getopenfilename("esfo dat file (*.dat), *.dat") fsfn = application.getopenfilename("esfs dat file (*.dat), *.dat") ipfn = application.getopenfilename("esip dat file (*.dat), *.dat") ppfn = application.getopenfilename("espp dat file (*.dat), *.dat") ' load combined dim x workboo...

c# - Hub with dynamic HubSections with GridViews and DataBinding -

i create hub several hubsections via code. each hubsection owns single gridview every hubsection table (fullscreen) , swipe left/right view every table. in xaml page hub other stuff should done code. hubsections should created @ runtime. use local settings storage save information this, how many hubsections etc. creating new hubsections no problem i'm stuck @ adding gridview each hubsection because don't understand logic here. looks have add datatemplate , gridview attempts failed. note: each gridview has it's own databinding observable collection. so how add (?datatemplate?) gridview databinding hubsection ? with datatemplate build layout. have used in project following template show few data per day , create 1 section each day: <page.resources> <collectionviewsource x:name="hubviewmodel"/> <datatemplate x:key="datatemplate"> <grid background="transparent" width="300" horizontalalig...

Android Firebase getKey() returning child instead -

i have firebase database looks this: appname: chat: [id]: child1:value child2:value i'm querying this: databasereference ref = rootreference.child("chat").child([id]); ref.addlistenerforsinglevalueevent(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { if (datasnapshot.exists()) { long index = long.parselong(datasnapshot.getkey()); } } the problem is, query doesn't work because datasnapshot.getkey() returns "child1" instead of id. same thing datasnapshot.getref().getkey() . if use datasnapshot.getref().getparent().getkey() "chat" back. how key datasnapshot ? i'm extremely confused right now. it turns out problem not in above code. further valueeventlistener made query , accidentally set listener this instead of myclass.this . valueeventlistener in this looking else, query incompatible.

ios - Is there any way to create and use an unwind segue programmatically? -

i have series of 3 view controllers, first 2 of wrapped in uinavigationcontroller, , managed default main.storyboard file. let's call them a , b , respectively. have more view controllers throughout file, each instantiated , managed separately, though working on moving them all-code solutions. aforementioned third view controller have in code ( c ) 1 @ various times instantiated , presented b . a , b have normal segue relationship setup in interface builder , called via code. same c b , via code (instantiate , presentviewcontroller(_:) ). there few cases action in c invalidates b 's raison d'ĂȘtre, , must dismiss both. so far, have been calling dismissviewcontrolleranimated(_:) c , , checking in b 's viewdidappear(_:) whether should dismissed, , dismissing same way if so. during process, user thrown though vc hierarchy, watching empty views fly whence came, leaving time them experiment controls no longer work, , may crash app. rather disconcerting user ex...

ios - Tableview doesn't display data in swift 2 -

i'm working on tableview in swift 2.2 in xcode 7.3.1 , i'm sure code because it's not first time me deal tableview , i'm pulling data correctly server , stored in array notice 2 function related table view not called table view appear empty me ! added cell , linked tableview view layout. i don't know problem! class studentteacherlist: uiviewcontroller , uitableviewdatasource,uitableviewdelegate { @iboutlet weak var studentparenttable: uitableview! @iboutlet weak var loadindicator: uiactivityindicatorview! var username:string! var fromsender: string? var torec: string? var student_id = [int]() var parent_id = [string]() var student_names = [string]() var parent_name = [string]() //sent data var s_id:int = 0 var s_name = "" var p_id = "" var p_name = "" override func viewdidload() { super.viewdidload() studentparenttable.delegate = self studentparenttable.datasource = self let prefs:nsuserdefaults = ...

javascript - App Module Not Found AngularJS -

for reason giving me errors when try run code. (i post code error @ bottom): index.html: <!doctype html> <html> <head> <meta id="meta" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <link href='https://fonts.googleapis.com/css?family=robotodraft:400,500,700,400italic' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="assets/dist/css/vendor.min.css" type="text/css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.9/angular-material.min.css" /> <script type="text/javascript" src="assets/dist/js/vendor.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script> <script src="https://ajax.googleapi...