Posts

Showing posts from May, 2012

ios - Use Core Data With UITableView With Sections That Have A Different Number Of Cells -

Image
so have tableview contains sections can possibly hold different amount of cells depending on user input rows detail. trying learn more saving , want make simple app allows user save recipe ingredients. example can have 5 different sections containing 5 different types of food -> banana: amount-2 calories-10 details-slice, apple amount-3 calories-20 details-mash <-. user click done , or recipe name saved , displayed on cell in table view. once user clicks on he/she can see he/she put , can edit if he/she desires. told core data best type of saving. how save info in organized way. know how save individual cells using core data hard each section can contain unique number of cells , data saved 1 data entry. it's array inside of array inside of array. have feeling have use dictionaries. can't seem structure of data. can or have tips on how should attack this? i'm using swift way. picture of 1 section of tableview might like: there's several ways can

java - SQLIte syntax error but I do not see one -

it working before changed integer not null integer on scores table. the error "e/sqlitelog﹕ (1) near "(": syntax error" and statement in question - create table "runs" ("_id" integer primary key, "run_number" integer not null, "total_time" real, "stroop_on" integer not null, "successful" integer not null, "successful_run_number" integer not null, "training_run" integer not null, "score_id" integer not null, foreign_key (score_id) references scores(_id)); update: turns out silly mistake, added '_' in "foreign key" remove underscore foreign key

leaflet - WMS filter by Date -

i have wms layer getting served geoserver. layer exposes date property stored in database date type. filter layer date range. example: cql_filter=date>2015-07-01t00:00:00.000z. i having difficult time getting work , unable find working examples. does 1 have working cql date range example? or filter date range examples? thanks, nathan this link has examples. intro cql one thing have run cql case sensitivity , field naming. in example reference date field. maybe date reserved word? try bumping logging in geoserver , check errors or see sql gets generated. double check field name in layer definition.

hiveql - Joining table on previous month with Hive -

i trying join table based on previous month after several failed attempts i'm not sure how solve this. i have larger query join section pretty simple, first attempt this: left outer join (select user_id, coalesce(count(*),0) count_m,mth table_name group user_id,mth ) m on month(main_table.local_date) -1 = m.mth , m.user_id = main_table.user_id but of course if have date in january , subtract 1 0, not 12. the next attempt hive's datesub function: left outer join (select user_id, coalesce(count(*),0) count_m,mth table_name group user_id,mth ) m on month(date_sub(main_table.local_date,31)) = m.mth , m.user_id = main_table.user_id but again problem obvious - not every month has 31 days end problems dates previous month not correctly matched (although @ least solves january - december problem previous approach. i tried use case approach in on command, handle jan-dec problem, before realizing hive accept equi-joins. any appreciated. subtract number of

How do I select a merge strategy for a git rebase? -

git-rebase man page mentions -x<option> can passed git-merge . when/how exactly? i'd rebase applying patches recursive strategy , theirs option (apply whatever sticks, rather skipping entire conflicting commits). don't want merge, want make history linear. i've tried: git rebase -xtheirs and git rebase -s 'recursive -xtheirs' but git rejects -x in both cases. git rebase -xtheirs works in recent versions, except tree conflicts need resolved manually. need run git rebase -xtheirs --continue (with -x repeated) after resolving conflicts. you can use git v1.7.3 or later versions. git rebase -s recursive -x theirs ${branch} from git v1.7.3 release notes: git rebase --strategy <s> learned -x option pass options understood chosen merge strategy. nb: "ours" , "theirs" mean opposite of during straight merge. in other words, "theirs" favors commits on current branch. update: edited cl

html - Javascript code getElementByID for loop -

i can't figure out why loop below doesn't work. i've created function work html not issue. here function works: function deactivatealltabs() { document.getelementbyid('tab-header-1').classname = 'tab-header'; document.getelementbyid('tab-header-2').classname = 'tab-header'; document.getelementbyid('tab-header-3').classname = 'tab-header'; document.getelementbyid('tab-content-1').classname = 'tab-content'; document.getelementbyid('tab-content-2').classname = 'tab-content'; document.getelementbyid('tab-content-3').classname = 'tab-content'; } instead of hard-coding tab-headers , tab-contents ids, thought i'd create loop automatically take care of future additional tabs. if respectively add set of: document.getelementbyid('tab-header-4').classname = 'tab-header'; document.getelementbyid('tab-content-4').classname =

How to get relationships to show on dbvisualizer? -

i have tables inside schema inside db. need dbvis graph/show actual lines show relationships among pks in link below. https://www.dbvis.com/features/tour/references-graphs/ for reason, can dbvis display column name , type in diagram, no pks or links show up. how can these show on graph/diagram?

chat - Is Graph Database a good use case for a messaging system? -

i diving in universe of graph databases , i'm amazed how powerful is. chose orientdb start first use case i'm not if domain applies specific section of app. an user follows user . an user can be part of conversation . a message can sent (with timestamp) conversation . a message can read (with timestamp) user . i'm worried end millions (even billions) of message nodes , sent or read edges affecting overall performance of system. messaging section not main concept of app, small portion of it. would problem orientdb handle? application graph database? thank patience, vinicius take @ suggested way use orientdb similar use case: http://orientdb.com/docs/last/chat-use-case.html

php - Moving config directory above app folder -

is there way move config app (app/config) above app folder? want deploy app folder without override config files on multiple instances of app. i not sure if possible. can adding (set of) custom config(s) config.php's always_load section. can add custom paths can loaded file, outside of application. while (partly) solves problem, might have better solution you: you can configure application per environment. apppath/config/production/*.php override default configuration. if don't want version control folder, can add .gitignore. if deployment process smart enough, can configure preserve configuration files between deployments. activate production environment, need set fuel_env environment variable production.

c++ - List of breakpoints in Visual Studio 2013 -

Image
is there way view list of breakpoints (enabled , disabled) set in project in visual studio 2013 pro? it seems older versions have feature , don't see "breakpoints" option under debug menu (screenshot below) - see options dealing individual breakpoints once you're looking @ them. yes, list still available debug / windows / breakpoints. the shortcut ctrl-d, b

java - When JRE is a subset of JDK, why do we have to download JRE separately in a PC? -

when jdk includes jre execution of code, why have download jre separately execute java code doubt that's bothering me as far remember depends on os, browser , jdk version. eg. if you're using 64-bit os , installed 64-bit jdk, using 32-bit browser, might have install 32-bit jre if need java support in browser. otherwise separate jre installation should not required, since jdk installation installs jre.

How to handling row level permissions in hbase -

obviously hbase has no implicit way of doing this. next thought using acls @ cell level. unfortunately i've seen setting acls specific user or map of users/permissions. there way allow users specific group have permissions? group names prefixed using @ in grant command. grant '@mygroup', 'rw' this , this talks in more detail. in documentation given how manage group roles not info implementation, below 8.2.2 - point 3 hbase managed "roles" collections of permissions: not model "roles" internally in hbase begin with. instead allow group names granted permissions, allows external modeling of roles via group membership. groups created , manipulated externally hbase, via hadoop group mapping service.

jQuery plugin returning its init function rather than the result of calling the plugin -

i'm working snackbarjs jquery plugin. i'm calling in django template so: <script> var options = { content: "testing some snackbar text", // style: "toast", timeout: 0, //htmlallowed: true }; var test = $.snackbar(options); console.log('test is: '); console.log(test); </script> i'm requiring plugin using browserify: var $ = require('jquery'); require('snackbarjs'); right now, output of test variable is jquery.fn.init[1] ...which believe result of initializing snackbarjs itself. should returning html of snackbar. when run same snackbar initialization code browser console after page has loaded, runs fine, , test returns <div> of snackbar i'm trying load. how can snackbar jquery plugin work inside template, , what's going wrong? thanks! the javascript function calling before dom ready. plugin appends div produces end of dom

javascript - convert array of numbers that are strings into array of numbers -

ids_nn ["50348", "18646", "17963", "18184", "30703", "18016", "23225"] how make it: [50348, 18646, 17963, 18184, 30703, 18016, 23225] i read these 2 posts: how convert elements in array integer in javascript? convert string array of integers so, tried: var bla = ids_nn.map(function (x) { return parseint(x, 10}) vm4765:2 uncaught syntaxerror: unexpected token }message: "unexpected token }"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: errorvm3550:847 injectedscript._evaluateonvm3550:780 injectedscript._evaluateandwrapvm3550:646 injectedscript.evaluate and var bla = ids_nn.split(',').map(number) vm4648:2 uncaught typeerror: undefined not function this works me var bla = ids_nn.map(function (x) { return parseint(x) }); you had mistake } , ), anyway don't need pass base

Python tkinter GUI freezing/crashing -

from tkinter import * import tkfiledialog import tkmessagebox import os import ttk import serial import timeit import time ###################################################################################### class myapp: def __init__(self, parent): ######################################################## #setup frames self.middleframe = frame(parent) #middle frame self.middleframe.pack() #global variables self.chip_number = 0 #number of chip testing ########################################### #middle frame setup label(self.middleframe, text='done').grid(row=8, column=1, sticky = e) self.done = canvas(self.middleframe, bg="yellow", width=10, height=10) self.done.grid(row=8, column=2) label(self.middleframe, text='chip number:').grid(row=9, column=1, sticky = e) #start button self.button1 = button(self.middleframe,state=normal, command= self.start_pre)

php - Faster navigation through SQL table using limits -

my website has menu items, , there 3 pages. using jquery ajax, make post request php script page number, page 1, page 2 or page 3. i use following select appropriate rows. $page = intval($_post["page"]); $perpage = 56; $calc = $perpage * $page; $start = $calc - $perpage; $sql = "select market_items.id, market_items.market_hash_name, market_items.icon_url_large, market_items.name_color, market_items.inprogress, item_price.market_name, item_price.avg_price_7_days market_items join item_price on market_items.market_hash_name=item_price.market_name inprogress='0' , pending='0' , avg_price_7_days >= '0.50' order avg_price_7_days desc limit $start, $perpage"; $result = mysqli_query($conn, $sql); as can see, post input of page=1 display rows 1 56, page = 2 57 112, , on. the thing is, have make 3 queries see 3 pages, 1 each. there faster way this? lag load page quite noticeable (about 1.5 seconds execute query). thinking if execute

r - Is there a way to guess the size of data.frame based on rows, columns and variable types -

i expecting generate lot of data , catch r. how can estimate size of data.frame ( , memory needed) number of rows, number of columns , variable types. example. if have 10000 rows , 150 columns out of 120 numeric, 20 strings , 10 factor level, size of data frame can expect. results change depending on data stored in columns ( in max(nchar(column)) ) > m <- matrix(1,nrow=1e5,ncol=150) > m <- as.data.frame(m) > object.size(m) 120009920 bytes > a=object.size(m)/(nrow(m)*ncol(m)) > 8.00066133333333 bytes > m[,1:150] <- sapply(m[,1:150],as.character) > b=object.size(m)/(nrow(m)*ncol(m)) > b 4.00098133333333 bytes > m[,1:150] <- sapply(m[,1:150],as.factor) > c=object.size(m)/(nrow(m)*ncol(m)) > c 4.00098133333333 bytes > m <- matrix("ajayajay",nrow=1e5,ncol=150) > > m <- as.data.frame(m) > object.size(m) 60047120 bytes > d=object.size(m)/(nrow(m)*ncol(m)) > d 4.00314133333333 bytes you can simul

How does the CSS specificity work? -

this question has answer here: points in css specificity 7 answers i have css classes chained. can 1 explain how following code works? displays text green. can explain? <html> <head> <style> .a .c { color: red; } .b .c { color: green; } .c { color: blue; } </style> </head> <body> <div class="a"> <div class="b"> <div class="c"> hi </div> </div> </div> </body> </html> the first says item class c inside of item of class a colored red . .a .c { color: red; } the second says item class c inside of item of class b colored green . takes precedence on first rule deep first rule, defined after rule. .b .c { color: gree

javascript - Swipe jquery event -

somebody know how create function "swiperight" event using jquery? know plug-in this? $(function(){ $(".container").swiperight(function(){ ***simple add class funcctions*** } }); }); not plugin, jquery mobile library has swipe event listeners (with addclass example in link). https://api.jquerymobile.com/swiperight/

php - Getting Image Source from RSS CDATA -

i have function grab image src field cdata in rss feed. function echo_url($string) { preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $string, $match); return $match[0][0]; } only bad thing it's picking first url appears in cdata instead of image src itself, there anyway can access or return image src instead of first url? here's example of cdata get. ![cdata[duration: 357 sec<br>url: http://www.test.com/videos/999682/test-test-video<br><img src="http://test.com/images/test.jpg"><br><iframe src="http://embeds.test.com/embed/999682" frameborder=0 width=650 height=518 scrolling=no></iframe>]] all i'm after in getting 'img src'. any brilliant (bit of beginner @ php) thanks if want return image source, function work: /** * @param string $cdata * @return string|false */ function getimgsrc($cdata) { $found = preg_match("/img src=\&q

java - Keeping a component in a fixed position within a BoxLayout -

Image
i have jpanel uses horizontal box layout , contains jlabel keep in exact same position other components within jpanel setvisible(false) . currently, jlabel moves left other components become invisible. what's easiest way go this? edit: pics added so jpanel components visible when set 3 jtextfields on right invisible, jlabel set text x moves left this: but stay this: edit2 : i'm using netbeans gui editor's free design particular jlabel . i'm sorry mistake - i've been using lot of boxlayouts , got confused! currently, jlabel moves left other components become invisible. yes, layout managers designed work visible components. i'm not sure if of default layout manager work, using gridbaglayout , since layout based on grid structure long have components in grid on row label should not shift. otherwise, dislay "other components" in panel using cardlayout . instead of making components invisible, swap panel empty

java - openshift: maven compiler error : Base64 can not find the symbol -

i deploying webapp openshift cloud. while compiling resources maven automatically after deploying, shows base64: symbol not found when maven compile on pc, no errors , build successfull. tried change base64 java.util apache.commons.codecs . error still there while deploying , runs @ local machine following pom.xml <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.5.1</version> <inherited>true</inherited> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> <dependencies> <dependency> <groupid>commons-codec</groupid> <artifactid>commons-codec</artifactid> <version>1.4</version&

html - Css code why the div class going down? -

i have posted question..but nobody answered question..my code is: * { margin: 0; padding: 0; } body { width: 100%; font-family: 'cabin', sans-serif; background-color: #333; } .firstnav { margin:auto; height: 1500px; display: block; width: 70%; -webkit-flex: 3 1 60%; flex: 3 1 60%; -webkit-order: 2; order: 2; } #third { background: #f00; position:relative; display:inline-block; width: 30%; margin-left:auto; margin-right:auto; height: 500px; -webkit-flex: 1 6 20%; flex: 1 6 20%; -webkit-order: 3; order: 3; } #second { background: #fff; position:relative; display:inline-block; margin-left:auto; margin-right:auto; width: 67%; height: 1500px; -webkit-flex: 1 6 20%; flex: 1 6 20%; -webkit-order: 3; order: 3; } #registration-form { font-family:'open sans condensed', sa

angularjs - Items in ng-options not updating to selected language -

my issue options in dropdown menus not changing correct language. example if go english chinese else update fine, items in drop down won't until after select 1 of options in list, change appropriate language. however, of other dropdown menus remain untranslated until interacted first one. there way me force them update after change language it's being displayed in? here's example of 1 of dropdown menus <label class="col-md-3 col-xs-6"> <span translate="chart"></span> <select class="form-control" ng-model="report.chart" ng-options="c | translate c in charts" ng-change="setcharttype(report)"> </select> </label>

java - Jedis Returning same value even though the lua script removes it -

i using jedis , jedis connection pooling in app. using redis sorted set collection store data. in app using lua script poping data (remove). lua script contains 5 6 commands. app in multithreaded 1 used akka actor , attached jedis pool it. each thread have own jedis instance. @ point jedis returns same data more 1 akka thread. here code, public class xoredissortedsetcache<t> extends xorediscollectioncache<t> { private static final string zpop = "local function zpop(tempkey) local val = redis.pcall('zrevrangebyscore', tempkey, 1, 0, 'withscores' , 'limit' , '0' , '1' ) if val redis.call('zrem', tempkey, val[1]) end return val end return zpop(keys[1])"; private static final byte[] zpop_bytes = zpop.getbytes(); private static final string zrandom_weighted_pop = "local function zrandomweightedpop(tempkey) local totalsize = redis.pcall('zcard', tempkey) if totalsize > 0 local maxscore = redis.pcal

xml - MySQL: Importing timestamp from file name -

i not able find preliminary asked question topic yet. i have several xml files named "measurement_2015_06_09_14_53_04.xml". file having following structure: <?xml version="1.0"?> -<dataentry> -<messwertarray index="0"> <pressbase1>3540</pressbase1> <pressbase2>87524</pressbase2> <pressbasemain>32456</pressbasemain> ... -<messwertarray index="1"> <pressbase1>246</pressbase1> <pressbase2>9852</pressbase2> <pressbasemain>4568</pressbasemain> etc. i have table in mysql columns xml files, including 1 index. want add timestamp column @ beginning timestamp file namne --> date 2015_06_09, time 14_53_04. there way tell mysql use date in file timestamp , assign measurements xml file? thanks lot in advance support! what if add entries in xml date of file?

parallel processing - Which are the common causes for non scalability of shared memory programs? -

whenever paralelizes application expected outcome decent speedup, not case. it usual program runs in x seconds, parallelized use 8 cores not achieve x/8 seconds (optimal speedup). in extreme cases, takes more time original sequential program. why? , importantly, how improve scalability? there few common causes of non scalability: too synchronization : problems (and conservative programmers) require lots of synchronization between parallel tasks, eliminates of parallelism in algorithm, making slower. 1.1. make sure use minimum synchronization possible algorithm. openmp instance, simple change synchronized atomic can result in relevant difference. 1.2 worse sequential algorithm might offer better parallelism opportunities, if have chance try else might worth shot. memory bandwidth limitation : common "trivial" implementation of algorithm not optimized locality, implies heavy communication costs between processors , main memory. 2.1 optimize

c# - Implement docking on wpf MaterialDesignInXamlToolkit and Dragablz -

i have been using excellent materialdesigninxamltoolkit . have followed example mahmaterialdragablzmashup . looking @ example, allows drag , drop not allow docking. have been trying implement without success. followed guide intertabclient . would possible post example of docking using intertabclient? thanks,

sift - runtime error of vlsift: input image contains a malformed PGM header -

i trying test sift detector of vlfeat computer vision library running sift.c file in src folder. have compiled , run program. however, got error: the input image contains malformed pgm header. sure not problem of image file inputed. explain that. this corresponds vl_err_pgm_inv_head error code issued pgm decoder if file less 2 bytes or has not supported or invalid magic number . please note vlfeat supports p2 (ascii) , p5 (binary) formats. should inspect magic control if fits these requirements, e.g.: $ xxd -c 1 -l 2 foo.pgm 0000000: 50 p 0000001: 35 5 $ xxd -c 1 -l 2 bar.pbm 0000000: 50 p 0000001: 34 4 here foo.pgm valid (graymap in binary format) bar.pbm not supported vlfeat (black & white bitmap in binary format).

ios - addPeriodicTimeObserverForInterval called extra time -

i have avplayer 4 sec video ( nstimeinterval duration = cmtimegetseconds(self.playeritem.asset.duration) = 4). i'd update ui changes: self.periodictimeobserver = [self.player addperiodictimeobserverforinterval:cmtimemake(1, 1) queue:dispatch_get_main_queue() usingblock:^(cmtime time) { [weakself currenttimedidchange:cmtimegetseconds(time)]; }]; but reasons calls ui: - (void)currenttimedidchange:(nstimeinterval)currenttime { nslog(@"timepassed %f, total: %f", currenttime, self.duration); } logs: 2015-07-23 13:47:07.412 timepassed 0.000000, total: 4.000000 2015-07-23 13:47:07.448 timepassed 0.002814, total: 4.000000 2015-07-23 13:47:07.450 timepassed 0.005481, total: 4.000000 2015-07-23 13:47:08.447 timepassed 1.001473, total: 4.000000 2015-07-23 13:47:09.446 timepassed 2.001612, total: 4.000000 2015-07-23 13:47:10.446 timepassed 3.002021, total: 4.000000 2015-07-23 13:47:11.446 timepassed 4.002139, total: 4.000000 2015-07-23 13:47:1

ruby on rails - Interpreting output from query -

i have been stuck few hours on little problem have , thankful if help. my ultimate goal here unique states , link each of states it's page show communities state belongs_to. i have tried fiddling around 2 alternatives, alt.1 gives me array makes easy fit .each loop no id find communities with. alt.2 gives me id & state output in format don't recognize. # model class community... has_one :location class location... belongs_to :community # view # alt.1 location.pluck("distinct state") # alt.2 location.select('distinct on(state) id, state') => [#<location id: 2, state: "oakland">, #<location id:4, state: "south carolina">] solution both or alternative alternatives appreciated. a couple of things: 1) athar said, second correct, , activerecord objects. more activerecord way location.select('state').uniq.map(&:state) , return array of states. 2) read http://guides.rubyonrails.org/active_

background - Is there a callback interface in android.view.View which indicate that the view itself turned unseen? -

view.ondetachedfromwindow means view no longer has surface drawing, view.onwindowfocuschanged means window containing view gains or loses focus. i need callback means view turns unseen. there more 1 case of turning unseen, maybe visibility of view changed or view go background. there callback this? can give me advice? this viewtreeobserver.ongloballayoutlistener seems looking for. as says here : interface definition callback invoked when global layout state or visibility of views within view tree changes.

php - Iterating through foreach loop - group sorting effiiceny -

i have loop running in project not happy , wondered if there more efficient way of achieving this? i have array so $myarray = ["value1", "value2", "value3"]; then want go through object ($sponsors) , print out values on has field matches value in $myarray[]. so: <?php foreach ($myarray $value): ?> <?php foreach ($sponsors $post) : setup_postdata( $post );?> <?php if($post['somevalue'] == $value): ?> //do work <?php endif; ?> <?php endforeach; ?> <?php endforeach; ?> this working fine, might mean 50-60 loops grab , print out few bits of markup. there better way this? edit note: (based on initial replies) order of $myarray important, allows me group 'value1' , 'value2' etc you can rid of outer foreach loop <?php foreach ($sponsors $post) : setup_postdata( $post );?> <?php if(in_array($post['somevalue'], $myarray)): ?&

Canvas size in pixels (Javascript)? -

Image
i creating application web browsers. user clicks on position of screen. position stored x-value , y-value in pixels. now draw rectangle on canvas method: ctx.rect(x,x,50,50); unfortunately these values not fit pixels in web browser. do know how change pixel in webbrowser create rect @ right position? your canvas size have match style size. for ex. if canvas 100px x 100px must have mycanvas.width = 100 mycanvas.height= 100 mycanvas.style.width = '100px' mycanvas.style.height = '100px' only in case "your canvas bits size match screen bits size"

java - The import javax.ws cannot be resolved on Eclipse -

i developing restful's webservice on java using eclipse next steps: file>new>dynamic web project then configured these options: target runtime: apache tomcat v7.0; dynamic web module version: 2.5 (because using axis2); configuration: default configuration apache tomcat v7.0 , (both options) in label "modify" added "axis2 web services" , "jax-rs (rest web services)" next, when created new class, added import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.pathparam; import javax.ws.rs.produces; import javax.ws.rs.core.mediatype; but eclipse launches notice the import javax.ws cannot resolved i don't know the next question is necessary add files .jar path webcontent/web-inf/lib ? or can create, example, new path webcontent/web-inf/lib-restproyect? if choose second option, have problem in future project? import jar file: javax.ws.rs-api-2.0.jar , add jav

informatica is taking the source file as the indirect file -

i had made source file data type change in source analyzer. did realize had made mapping invalid. ran mapping , failed. reverted change, validated mapping, check in mapping, validated workflow, check in workflow. getting error: severity timestamp node thread message code message info 7/23/2015 10:40:03 node01_csadevelopment reader_1_4_1 fr_3055 reading input filenames indirect file [<input_directory_folder>/<input_file>]. severity timestamp node thread message code message error 7/23/2015 10:40:03 node01_csadevelopment reader_1_4_1 fr_3000 error opening file [<input_file_folder>/<header_of_the_input_file>]. operating system error message [no such file or directory]. here term "input file" file wanted load , "header_of_the_input_file" header of input file. i don't understand, why happening. had made small change , reverted it. the error saying filenames mentioned in indirect file not found. so, need make sure source fil

javascript - How to detect microphone type -

i use webrtc (getusermedia) recording sound , uploading backend server. works except unable determine microphone type (is built-in mic, usb mic, headset mic, sth else?) does know how can detect type? you can use navigator.mediadevices.enumeratedevices() list user's cameras , microphones, , try infer types labels (there's no mic-type field unfortunately). the following code works in firefox 39 , chrome 45 *: var stream; navigator.mediadevices.getusermedia({ audio:true }) .then(s => (stream = s), e => console.log(e.message)) .then(() => navigator.mediadevices.enumeratedevices()) .then(devices => { stream && stream.stop(); console.log(devices.length + " devices."); devices.foreach(d => console.log(d.kind + ": " + d.label)); }) .catch(e => console.log(e)); var console = { log: msg => div.innerhtml += msg + "<br>" }; <div id="div"></div> in firef

javascript - AngularJS + Django: URL refresh or direct access not loading correctly -

we have angularjs embedded our django application, url routing handled angularjs ui-router . working fine navigating between partials using ui-sref , clicking around within application. return $stateprovider.state('root.dashboard', { abstract: true, url: 'dashboard/' }).state('root.dashboard.profile', { url: 'profile/', views: { '@': { templateurl: urls['dashboard:profile'](), controller: 'profilecontroller' } } }).state('root.dashboard.home', { url: '', views: { '@': { templateurl: urls['dashboard:dashboard_home'](), controller: 'dashboardcontroller' } } ... the problem when user has navigated non-root page (say example http://example.com/dashboard/profile/ ), , user refreshes browser, re-loads browser's url or pastes

How to change query from SQL Server 2012 to SQL Server 2008 R2 -

select @principal= iif(optionfieldvalue='', null, cast(optionfieldvalue decimal(38, 18))) @data templatefieldid = 47 this query written in sql server 2012. want change sql server 2008 r2. can 1 convert code just rid of iif new in sql server 2012 : select @principal = case when optionfieldvalue = '' cast(null decimal(38,18)) else cast(optionfieldvalue decimal(38, 18)) end @data templatefieldid = 47

elasticsearch - Average of top n terms -

in index documents have keyword, rank , timestamp. rank keyword may differ time time. means dataset may this: {"keywords": "piano", "rank" 1, "timestamp": 1437642812} {"keywords": "piano", "rank" 2, "timestamp": 1437642813} {"keywords": "electric guitar", "rank" 5, "timestamp": 1437644326} i average rank of top 500 occuring keywords. cannot find out how this. my current try-outs seem give average results individually, want average entire dataset of top results of aggregation. post _search { "aggs": { "top_keywords": { "terms": { "field": "keywords", "size": 1 } }, "avg_rank": { "avg": {"field": "rank"} } }, "size": 0 } attempts using to

odata - How can I update entity with its children? Patch method doesn't work -

i must update entity children list shown here: public class entity1 { int id{get;set;} observablecollection<child1> childrenlist {get;set;} string name{get;set;} } public class child1 { string nome{get;set;} string cognome {get;set;} } i implemented patch method in way: [acceptverbs("patch", "merge")] public async task<ihttpactionresult> patch([fromodatauri] int key, delta<entity1> entitydelta) { if (!modelstate.isvalid) { return badrequest(modelstate); } var entity = await context.entity1.findasync(key); if (entity == null) { return notfound(); } entitydelta.patch(entity); try { await context.savechangesasync(); } catch (dbupdateconcurrencyexception) { return notfound(); }

php - create custom authenticate controller with different database filed in Laravel -

auth::attempt(['u_email'=>$credentials['email'],'u_password'=>sha1($credentials['password'])]) i'm use code authentication i'm getting undefined index: password error can 1 create custom authentication control without changing in vendor library thank in advance me... there 3 things need do. pass plain-text password auth::attempt() laravel hash before verifying against hash stored in database. auth::attempt(['u_email'=>$credentials['email'],'password' => $credentials['password']]); pass password password , not u_password auth::attempt() . key doesn't need match password column name (why? see point 3.), must equal password - see point 1 example. implement getauthpassword() method in user model, return value of u_password column. method used user provider fetch password hash later verified against passed auth::attempt() //in user.php public function getauthpassword() {

android - InstanceID and Regid GCM -

as read, function gcm.register() deprecated. , may use instanceid.gettoken() instead... i use described here every time run app, new regid (instance id).. here how registered : @override protected string doinbackground(object[] voids) { string msg = ""; if (gcm == null) { gcm = googlecloudmessaging.getinstance(myapp.getcontext()); } instanceid instanceid = instanceid.getinstance(context1); entryactivity. regid = null; try { entryactivity.regid = instanceid.gettoken(constantsgcm.senderid_projectid, googlecloudmessaging.instance_id_scope, null); log.d("reg---", "========================>>>- regid= " + entryactivity.regid); } catch (ioexception e) { e.printstacktrace(); } if (entryactivity.regid != null) try { sto

want to change Velocity template to other new technology give technology name and give differences also if possible? -

i want change product existing technology of email template in new email template technology.so please suggest technology name , difference velocity. want less dependencies no use of xml xslt languages should less hectic , more easy understand , write. you can use freemarker . there (old) discussion how better velocity. anyway, not recommend use velocity. last stable release 2010.

PHP handling form inputs -

looking find out best way handle form inputs. firstly, form validated using javascript. presume validation done in php users disable javascript. @ moment getting inputs so <?php $title = $_post['inputtitle']; $name = $_post["inputname"]; $surname = $_post["inputsurname"]; $email = $_post["inputemail"]; $link = $_post["inputlinks"]; if (isset($title) && isset($name) && isset($surname) && isset($email) && isset($link)) { //do } is enough that? or should doing proper validation on email though done in javascript? also, best add these inputs array? cant via html because needed give each input own unique name. thanks you should treat javascript validation "bonus" php validation must. is better use empty() instead of isset() on input validation, since return true user not key in value. if( !( empty($_post['inputtitle']) || empty($_po

css - Show HTML table header only on page break, set display none for 1st occurence -

i have table this:- <table> <thead><tr><td>heading1</td><td>heading2</td></tr></thead> <tbody> <tr><td>data1</td><td>data2</td></tr> <tr><td>data1</td><td>data2</td></tr> <tr><td>data1</td><td>data2</td></tr> </tbody> </table> the number of rows in tbody might when printing table, might have page break. need need display table header on page break, i.e. should not printed on first page, on pages load due page break. i know can repeat table header on pages in ie, using css: table thead {display: table-header-group;} but how can achieve scenario?

function - A while loop to add the digits of a multi-digit number together? (Javascript) -

i need add digits of number (e.g. 21 2+1) number reduced 1 digit (3). figured out how part. however, 1) may need call function more once on same variable (e.g. 99 9+9 = 18, still >= 10) and 2) need exclude numbers 11 , 22 function's ambit. where going wrong below? var x = 123; var y = 456; var z = 789; var numbermagic = function (num) { var proc = num.tostring().split(""); var total = 0; (var i=0; i<proc.length; i++) { total += +proc[i]; }; }; while(x > 9 && x != 11 && x != 22) { numbermagic(x); }; } else { xresult = x; }; console.log(xresult); //repeat while loop y , z here problems code var x = 123; var y = 456; var z = 789; var numbermagic = function (num) { var proc = num.tostring().split(""); var total = 0; (var i=0; i<proc.length; i++) { total += +proc[i]; // indentation want awry }; // don't need ; - not show stopper //

binding - How to bind an action to the heading of a tkinter treeview in python? -

i using tkinter treeview widget show database. command when clicking on 1 of headings used sorting table based on clicked column. additionally want tooltip box show hover (or right click) on 1 of headings. tooltips aren't problem other widgets heading of treeview isn't full widget of course. how can bind action headings except usual command? you can bind events treeview widget itself. widget has method named identify can used determine part of treeview event occurred over. for example: ... self.tree = ttk.treeview(...) self.tree.bind("<double-1>", self.on_double_click) ... def on_double_click(self, event): region = self.tree.identify("region", event.x, event.y) if region == "heading": ...

iphone - iOS - is possible to record audio from Bluetooth headset mic and play in device speaker -

i trying record audio bluetooth headset mic , play device speaker. have seen few stack-overflow post regrading same still not getting possible or not ? , if possible how it? if have idea please inform me. it's possible. use bluetooth option when setting audio session category. let audiosession = avaudiosession.sharedinstance() _ = try? audiosession.setcategory(avaudiosessioncategoryplayandrecord, with: .allowbluetooth) _ = try? audiosession.setactive(true)

linux - Multi-input files for awk -

i have 2 csv files, first 1 looks below: file1: 3124,3124,0,2,,1,0,1,1,0,0,0,0,0,0,0,0,1106,11 6118,6118,0,0,,0,0,1,0,0,0,0,1,1,1,1,1,5156,51 6679,6679,0,0,,1,0,1,0,0,0,0,0,1,0,1,0,1106,11 5249,5249,0,0,,0,0,1,1,0,0,0,0,0,0,0,0,1106,13 2658,2658,0,0,,1,0,1,1,0,0,0,0,0,0,0,0,1197,11 4322,4322,0,0,,1,0,1,1,0,0,0,0,0,0,0,0,1307,13 file2: 7792,1307,2012-06-07,,,, 5249,4001,2016-07-02,,,, 6001,1334,2017-01-23,,,, 2658,4001,2009-02-09,,,, 9279,1326,2014-12-20,,,, what need: if $2 in file2 = 4001 , has match $1 of file2 file1 , if $18 in file1 = 1106 matched $1 print line. the expected output: 5249,5249,0,0,,0,0,1,1,0,0,0,0,0,0,0,0,1106,13 i have tried following, no success. awk 'nr=fnr {a[$1]=$1;next} {print $1}' p.s: files compressed, have use zcat command i try like: $ cat t.awk begin { fs = "," } # processing first file nr == fnr && $18 == 1106 { a[$1] = $0; next } # processing second file $2 == 4001 && $1

android - Realm and Runtime.getRuntime().exit(0) -

i have restart app in order refresh app state private reasons. using processpheonix doing well. library calling runtime.getruntime().exit(0); in order close process , before opening new activities... the problem... the thing whenever have realm instance activity , call reboot method, app seems stopped , new activity started blank. tried lot of options seems doing when have realm object instantiated. is there realm using , should closed or can make work? (i tried closing realm instance before triggering restart , didn't work) edit: here sample activity. there superclass of activity3 has realm instance. yes, realm using native resources need handled properly. that's why requires calling of realm.close() . able shut down realm instances (all of them!) before rebooting app?

ios - show alertview after progressbar done -

i have app upload images server.image uploading server , progressbar working.but want show alertview after progressbar done... here code progressbar. - (void)connection:(nsurlconnection *)connection didsendbodydata:(nsinteger)byteswritten totalbyteswritten:(nsinteger)totalbyteswritten totalbytesexpectedtowrite:(nsinteger)totalbytesexpectedtowrite { float progress = [[nsnumber numberwithinteger:totalbyteswritten] floatvalue]; float total = [[nsnumber numberwithinteger: totalbytesexpectedtowrite] floatvalue]; progress_bar.progress = progress/total; nslog(@"%f",progress/total); } so question how show alertview after progressbar 100%. try this.. - (void)connection:(nsurlconnection *)connection didsendbodydata:(nsinteger)byteswritten totalbyteswritten:(nsinteger)totalbyteswritten totalbytesexpectedtowrite:(nsinteger)totalbytesexpectedtowrite { float progress = [[nsnumber numberwithinteger:totalbyteswritten] floatvalue]; float total

Current Location Android using WebView -

i have designed simple browser android using webview. working fine when open google maps browser can't access current location of device. don't understand going wrong. in manifest have given permission access fine location code is: @suppresslint("setjavascriptenabled") public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final webview ourbrow=(webview)findviewbyid(r.id.wvbrowser); button bgo=(button)findviewbyid(r.id.button3); button res=(button)findviewbyid(r.id.button4); button gfo=(button)findviewbyid(r.id.button2); ourbrow.getsettings().setjavascriptenabled(true); try{ ourbrow.loadurl("https://www.google.co.in/maps/dir///@20.3464436,85.8127819,15z"); } catch(exception e) { e.printstacktrace(); /*string myhtml = "<html><body>a basic

shape - What's the ST_GEOMETRY type in Oracle? -

table description is... column name / data type ------------------------------------------ mnum varchar2(33) alias varchar2(200) remark varchar2(200) ntfdate varchar2(8) sgg_oid integer col_adm_sect_cd varchar2(5) objectid integer **shape st_geometry** does know spatial information processing? first of all, 1 of column's type in oracle "st_geometry" . kind of type? , how can migrate these kind of data other oracle databse system? st_geometry spatial data type. use of data type along other supported data types part of oracle database's spatial technology. apparently st_geometry part of iso standard oracle supports. you can migrate these objects , other data oracle database database using data pump. oracle spatial oracle spatial data pump

php - how to retrieve a value that is entered on localhost from another model -

first of all, let me clarify myself. baked on cakephp , entering values on localhost in application. basicly, there 2 models called location , temp_readings . in location model, there temperature limits called high_temp , low_temp . , name of location. enter values, (e.g. name= fridge, low_temp= 3, high_temp= 7 ) in temp_readings model, enter temperature value specific location, (e.g. temperature= 10, location= frigde ). if temp value out of limits, app sending warning email me. i work on temp_readings.php script doing , need put condition sending email. i think, can value of temperature writing; $temperature = $this->data['temp_readings']['temperature']; since working in temp_readings.php . however, cannot values of low_temp , high_temp , saved under location model. how can low_temp , high_temp values work in temp_readings.php? here part of temp_readings.php (i dont know if helps) class temp_readings extends appmodel { function aft

javascript - Countdown timer update on other window when i press pause on main window -

Image
i have 1 window admin pannel can adjust time pause or stop countdown , window user seeing same timer. when press admin pannel on pause time or adjust time +- want user see time paused or adjusted. how can make that? tryed iframe doesnt change, try autoreload @ every 1 sec don't think that's good. want manipulate time window , show time on other window. can me this? html <div id="defaultcountdown"></div> <button type="button" id="pausebutton">pause</button> <button type="button" id="togglebutton">toggle</button> js <script> $(function () { var austday = new date(); austday = new date(austday.getfullyear() + 1, 1 - 1, 26); $('#defaultcountdown').countdown({until: austday}); $('#year').text(austday.getfullyear()); $('#defaultcountdown').countdown({until: austday, ontick: showpausetime}); $('#pausebutton').click(function() {

mysql - Invalid text content for insertion to database in Java? -

i trying store comments facebook post. there 25 comments , can them in json array , print console loop in java. when try store them mysql database, occurs 14th element of array. program ends without error or exception. stores 13 elements database , prints them console. if not connected database prints 25 elements console. control if clause, changing comment content this: string content; (int j = 0; j < array.size(); j++){ if (j==13) { content = "changed content"; } else { content = ((jsonobject)array.get(j)).get("message").tostring(); } and store elements db. of course 14th elements content stored "changed content." i store them code: string addcomments = "insert comments values("+commentid+",'"+commentfrom+"','" +content+"',"+likecount+",'"+createddate+&quo

php - Symfony2 create new entity element in the form itself -

i using sonataadminbundle , in form want display mapped information. main object skin mapped cmselemnt, in witch content saved. need acces in form able update it. i have mapped information: skin.php /** * @orm\onetomany(targetentity="cmselement", mappedby="content") */ private $navbar; cmselement.php /** * @orm\manytoone(targetentity="skin", inversedby="navbar") * @orm\joincolumn(name="page_id", referencedcolumnname="id") */ private $content; i tried using symfony dcumentation here: http://symfony.com/doc/current/book/forms.html#embedding-a-single-object so created service load cmselement information: class skinelementtype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('content', 'textarea'); } public function setdefaultoptions(optionsresolverinterface $resolver) { $reso

php - uploading files to BOX using v2 API -

i'm trying upload file box using curl, can create , view folders not upload file. according documentation curl request is: curl https://upload.box.com/api/2.0/files/content \ -h "authorization: bearer access_token" -x post \ -f attributes='{"name":"tigers.jpeg", "parent":{"id":"11446498"}}' \ -f file=@myfile.jpg i'm using method: public function put_file($filename, $name, $parent_id) { $url = $this->upload_url . '/files/content'; $attributes = array('name' => $name, 'parent' => array('id' => $parent_id)); $params = array('attributes' => json_encode($attributes), 'file' => "@".realpath($filename)); $headers = array("authorization: bearer ".$this->access_token); $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlopt_returntransfer, true);