Posts

Showing posts from March, 2014

jquery - Need help making Django + Ajax like button -

i new coding , have implemented button online book - tango django: http://www.tangowithdjango.com/book17/chapters/ajax.html#add-a-like-button however project need record users have liked , ensure can item once (similar instagram/facebook). have looked @ other related questions online have found there no laid out answer other beginners follow. if easy follow answer me , other people trying achieve same in future, appreciated! my current code follows: models class userproject(models.model): user = models.foreignkey(user) title = models.charfield(max_length=100) date_created = models.datetimefield(auto_now_add=true) project_likes = models.integerfield(default=0) slug = models.slugfield(max_length=100, unique=true) views @login_required def like_project(request): proj_id = none if request.method == 'get': proj_id = request.get['project_id'] likes = 0 if proj_id: proj = userproject.objects.get(id=int(p

html - How to classify li tags when we want it 2 times -

i wanted use li tags 2 times first time used class li tag <ul *class="2"*> <li *class="!"*><.......jpg" width="280" height="280" \></li> <li class="!"><img src="......jpg" width="280" height="280" \></li> and 2nd time... did this <ul> <li><a href="........html">home</a></li> <li><a href="........html">songs</a></li> <li><a href="........html">games</a></li> <li><a class="active" href=".........html">gallery</a></li> </ul> my css ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; position: fixed; bottom: 0; width: 100%; } li { float: left; } li { display: block; color: white; text-align: cente

angular-cli, Google Visualization Charts, SystemJS -

i'm building charts app angular 2 (angular-cli) , google charts. just putting google-loader script tags in index.html works in development mode, when building production (everything bundled) error typeerror: cannot read property 'arraytodatatable' of undefined when calling google.visualization.arraytodatatable(data); the next thing tried putting loader.js in systemjs config: const map: = { 'google-visualization': 'https://www.gstatic.com/charts/loader.js' }; importing in main.ts import 'google-visualization'; and loading corechart package in app.ts google.charts.load('current', { 'packages': ['corechart'], 'language': 'pl' }); now error saying xmlhttprequest cannot load https://www.gstatic.com/charts/loader.js. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:4200' therefore not allowed access. is there othe

javascript - Selectize load function is not triggered on typing -

i have following selectize element: $('#my_selectize').selectize({ valuefield: 'value', labelfield: 'text', options: [{'value':1,'text':'abc','inn':123}], render: { option: function(data, escape) { //return .... }, load: function(query, callback) { if (!query.length) // breakpoint not triggered return callback(); $.ajax({ url: '{% url my_url %}', type: 'get', data: {q: query}, error: function() { callback(); }, success: function(res) { callback(json.parse(vendor_options_json.f)); } }); } }}); according docs , once user starts typing, should see browser sto

sql server - Select statement with a where clause and add 'comment' in another column -

i need add ‘comment’ in additional column select statement clause. current code first statement select * [table] [dep] = 'm' , ([join m] <> [join b] or [resign m] <> [resign date beneficiary]) go second statement select * [table] [join b] < [resign b] , ([join m] > [join b] or [resign m] < [resign b]) go this 2 different select statements, combine both outputs 1 table. wrong code - (example explain) first statement select * [table] [dep] = 'm' , ([join m] <> [join b] or [resign m] <> [resign date beneficiary]) set [comment] = 'main' go second statement select * [table] [join b] < [resign b] , ([join m] > [join b] or [resign

Read JSON file with different format -

Image
i have custom platform upload files. platform content of files (mapping) , have screen can see content. my problem specific json file. original format : {"schema:actor:image":"https://link.png","schema:activity.timestamp:timestamp":"01/06/2016 19:23:01","schema:metadata:datatype":"text","schema:actor:name":"aaaa","schema:metadata.tags:key":null,"schema:activity.content:value":"value1","schema:activity.content:language":["english"],"schema:activity.location:placename":"city of london, united kingdom","schema:actor:followers_count":1518,"schema:activity.content:sentiment":"positive","schema:activity.content:opinion":"neutral","schema:activity.content:gender":"unknown","schema:activity.content:age":"35-49","schema:actor:synthetic":

java - How to get updated entities from JPA resultList .? -

i have updated object within transaction, updated , sync database...but whenever i'm retrieving entities using query.getresultlist() , not returning list updated objects , values. here code refers how i'm doing... javax.persistence.entitymanager entitymanager = java.beans.beans.isdesigntime() ? null : javax.persistence.persistence.createentitymanagerfactory("jdbc:oracle:thin:@siddhant-pc:1521:xepu").createentitymanager(); javax.persistence.query professionalworkquery = java.beans.beans.isdesigntime() ? null : entitymanager.createquery("select p professionalwork p order p.jobno"); java.util.list<professionalwork> professionalworklist = java.beans.beans.isdesigntime() ? java.util.collections.emptylist() : professionalworkquery.getresultlist(); code updating object... professionalwork prowork = entitymanager.find(professionalwork.class, jobno); entitymanager.gettransaction().begin(); prowork.se

css - Border-image gradient pattern in triangle shape -

i want create odd shaped triangle css. first thought use transparent borders transform: rotate , worked (see left triangle). want use gradient border image pattern background same triangle can't make work. tried many things changing border-width , using wrappers , overflow:hidden among others, nothing worked. here post 1 of tries (see right shape) see pattern takes space, not following triangle shape. ideas? #top-left { position:absolute; left:78px; width: 0; height: 0; border-top: 100px solid transparent; border-right: 80px solid black; border-bottom: 50px solid transparent; -webkit-transform: rotate(-20deg); } #top-right { position:absolute; left:300px; width: 0; height: 0; border-image: repeating-linear-gradient( 0deg, pink, pink 1%, purple 1%, purple 8%) 10; border-image-width: 100px 80px 50px 0px; border-width: 100px 80px 50px 0px; border-style: solid; -webkit-transform: rotate(-20deg); } <div id=&quo

php - substr_count and strtolower used together give inconsistent results -

i trying use substr_count check occurrence of particular string. code seems giving inconsistent results. sometimes echoes 1 , 0. wonder if can explain me why happening? thanks! $val = "hello world ansprüche theme park"; $ne = "ansprüche"; echo substr_count(strtolower($val),$ne); in string latin charter "ansprüche" . first have convert string iso-8859-1 characters encoded utf-8 single-byte iso-8859-1. use below code. it's working fine. <?php $val = "hello world ansprüche theme park hello"; $ne = "ansprüche"; echo substr_count(strtolower(utf8_decode($val)), utf8_decode($ne)); ?>

c# - In mono, when i run my console app, how can I save the stdout to a file? -

when run (precompiled) c# program in mono - how output save file. the process seems open new console window - simple > , | dont work for it's worth, program irc bot (benign) , i'm trying make work on linux (ubuntu 14.04) mono.

d - How do I specialize templates across different modules? -

module a; void foo(t)(){ import std.stdio; writeln(t.stringof); } module b; import a; private alias foo = a.foo; void foo(t: int)(){ import std.stdio; writeln("special int"); } //app.d void main() { import a; import b; foo!int(); } this prints int instead of special int . possible specialize templates across different modules? can assume answer d template specialization in different source file still relevant today? your alias wrong , import introduces ambiguities. if want publicly overloadable, don't make alias private! once alias made public (the default btw), compiling spit out name conflict error: iii.d(6): error: a.foo(t)() @ ii.d(2) conflicts b.foo @ i.d then, simple matter of disambiguating (specifying b.foo!int() ), or better yet, removing unnecessary import a usage point. //app.d void main() { import b; foo!int(); } special int! for more complex cases, can make wrapper template , forward argume

symfony - Adding properties to/extending Sonata Media entity -

i want add properties sonata media entity, can't work. i'm using sonata media bundle 2.3, , have installed according manual. extended sonata easy extends bundle. when add property application\sonata\mediabundle\entity\media , doesn't picked when run doctrine:generate:diff ('no changes detected in mapping information.'). overriding media class in config.yml won't make difference well. this code in application\sonata\mediabundle\entity\media.php : <?php namespace application\sonata\mediabundle\entity; use doctrine\orm\mapping orm; use sonata\mediabundle\entity\basemedia basemedia; /** * @orm\entity */ class media extends basemedia { /** * @var integer $id */ protected $id; /** * @orm\column(type="string", nullable=true) */ protected $test; /** * @return mixed */ public function gettest() { return $this->test; } /** * @param mixed $test */ p

nmap - Jenkins cli connection timed out -

i trying access jenkins server 1 it's installed one. when try run java -jar jenkins-cli.jar -s http://remote:port/jenkins i have, after few dozens of seconds, java.io.ioexception: failed connect connect http://remote:port/jenkins/ error. pinging remote works, , running nmap -p port remote gives me starting nmap 5.51 ( http://nmap.org ) @ 2016-07-28 11:51 cest nmap scan report [remote] host (0.00047s latency). port state service [port]/tcp filtered m2mservices nmap done: 1 ip address (1 host up) scanned in 0.27 seconds is problem related filtered state? thanks. yes . need check firewall settings.

azure service fabric - Incremental actor state replication? -

i'm wondering whether actor state, in service farbic, replicated using kind of incremental delta/diff mechanism or whether full state replicated each change. let's have actor quite large state payload, 100kb. let's counter value embedded in state. counter changed on high frequency while rest of state changed on low frequency. in case, wasteful if full state replicated each change , should consider design. however, if service farbric capable of doing incremental replication approach attractive. does know details on this? perhaps service fabric use binary delta/diff algorithm on serialized state during replication, or perhaps state changes incremental per state name ? it's per state name. if @ method iactorstateprovider.savestateasync method, you'll see accepts list of actorstatechange . persisted provider ( kvsactorstateprovider ) serializes each of values in list (except in case of remove), , updates store.

Running multi-statement query using JDBC on DB2 windows -

i trying run multi-statement queries using jdbc on db2 10.1 windows fails syntax error. following query- select * schemaname.tablename; exception in thread "main" com.ibm.db2.jcc.am.sqlsyntaxerrorexception: unexpected token "" found following "". expected tokens may include: "schemaname.tablename".. sqlcode=-104, sqlstate=42601, driver=4.13.127 i understand comes due semi-colon @ end of query not understand database. how can set query separator semicolon through this. with jdbc execute 1 statement @ time; looks of db2 doesn't support it. drivers/databases have way around this, non-standard. so instead of trying execute 2 statements in 1 go, need execute them 1 after other.

arrays - How to parse Dictionary value and pass into class modal in swift? -

my json data { "addon_items" : [ { "aname" : "", "id" : "2588", "name" : "plain nan", "order" : "1", "aid" : "259", "sub_add_items" : "", "icon" : "", "status" : "1", "next" : "0", "price" : "0.60" }, { "aname" : "", "id" : "2589", "name" : "pitta bread", "order" : "2", "aid" : "259",

javascript - To apply css to the elements retrieved from database based on their value in database -

here trying do- have mysql table fields namely- clientname, urgent, complete.and displaying values fields have html table fields- clientname,urgent , complete.each row consist of clientname ,button urgent , button complete.if click on button urgent in table row button's color changes red , if again click on button again attains original color. in short,it toggles between 2 classes.at moment ,in database urgent field value gets updated 0(initial value) 1.now when reload page want display urgent button value 1 in red color.i.e. want apply css elements based on value in database. able toggle classes change color of urgent button on click , update value refresh page again attains default color.please let me know how able retain color if value in database 1 ,even if refresh page. jquery code- $(".u").click(function () { $(this).toggleclass("urgent"); var id = $(this).attr('id'); $.ajax({ type:"post", url:"urgent.php&quo

bash - how to extract the PID of a process by command line -

i want pid of process namely "cron" command line. tried following script. ps ax|grep 'cron' but getting part of table, 1427 ? ss 0:00 /usr/sbin/cron -f 24160 pts/5 s+ 0:00 grep --color=auto cron how extract pid ? just use pidof , rather use other commands , apply post-processing actions on them. $ pidof cron 22434 to make command return 1 pid pertaining to process, use -s flag -s single shot - instructs program return 1 pid.

javascript - Why does the clientX and Y change on scroll? -

i created shape follows mouse x , y coordinates on mouse movement. can check result here: http://codepen.io/anon/pen/qnkgqo this work fine , shape in center of mouse cursor. unfortunately have problems it. as can see in demo have 1 section , positioned @ top of screen. @ top of of html markup notice comment out section. if remove comment markup, new section set. when hover on items, result same before, when scroll next section - 1 3 thumbs, notice shape not centered mouse, it's way offset. when hover on bottom, see little piece of shape. to center circle center of mouse cursor use following script: var target = $(this); var dot = target.find('.pointer'); var height = dot.height(); var width = dot.width(); var offset = target.offset(); var top = offset.top; var left = offset.left; var mx = (event.clientx - left) - width / 2; var = (event.clienty - top) - height / 2; above code mousemove function, triggered on mouse movement. my question

winforms - Creating bottom and right cell borders in C# DataGridView -

Image
i'm looking in creating custom border datagridview . i'm looking create style column header cells have solid, bottom border , row headers have solid, right border only. i have managed draw columns headers border adapting this question . however, struggling draw row headers border. the image below shows have far. can see, column headers have solid black line border. red line i've managed draw row headers, can't seem line extend on rows in table. in other words, how red line draw in row headers cell rows? this event handler i'm using private void transitiontable_cellpainting(object sender, datagridviewcellpaintingeventargs e) { if (e.rowindex == -1 && e.columnindex > -1){ e.handled = true; using (brush b = new solidbrush(activetable.defaultcellstyle.backcolor)){ e.graphics.fillrectangle(b, e.cellbounds); } using (pen p = new pen(brushes.black)){ p.dashstyle = system.drawing.drawin

r - How to reverse the order of data.frame object in the list that let them have same pattern? -

this question has answer here: how group set of data.frame objects in nested list different order? 1 answer i have 3 list has data.frame object different order fore sure. want let them have same order either list1, list2 or list 3. how can reverse order of data.frame object in different list has same pattern/order? give me possible idea doing sort of manipulation easily? lot. with variable in list, can use public data airquality, iris, cars, co2 quick run in r; data list1 <- list(pass=list(alpha.df1_yes, beta.df1_yes, gamma.df1_yes, theta.df1_yes), fail=list(alpha.df1_no, beta.df1_no, gamma.df1_no, theta.df1_no)) list2 <- list(pass=list(beta.df2_yes, alpha.df2_yes, gamma.df2_yes, theta.df2_yes), fail=list(beta.df2_no, alpha.df2_no, gamma.df2_no, theta.df2_no)) list3 <- list(pass=list(gamma.df3_yes, alpha.df3_yes, beta.df3

android source - /system/bin/screencap is not working with emulator with option "-no-window" -

i build aosp , generate emulator on remote computer. reason, have launch emulator “-no-window” option. (without option, emulator failed launch error text “no available vide device”) [terminal 0 (launch emulator)] emulator -no-window -noaudio [terminal 1 (attach it)] adb -s emulator-554 shell then, /system/bin/screencap not working correctly generate empty 320x480 image. there way take screen capture option? or, idea launch emulator without “-no-window” option in spite of launch remotely welcome. (for example, force recognize dummy screen emulator) thanks big helps!

sql - MySQL filtering out a criteria -

i thought simple guys here, little bit hard me figure out how this. have tried did not result wanted consult every 1 here. here have 3 columns: state, store, laptop_brand wanted filter out how many store have amount of hp < 3 ( group state). my idea on this: select state, count(laptop_brand) sample_survey count(select store sample_survey laptop_brand = "hp") <3 group state but not make real. sample_survey attached pic snippet data reference. thank suggestions. please try this: select state, store, count(laptop_brand) total_laptop sample_survey laptop_brand = "hp" group state, store having count(laptop_brand)<3

android - Warning in Google Map -

this question has answer here: android logcat flooded “w/google maps android api: glhudoverlay deprecated; draw(): no-op” 3 answers i getting weird log in logcat : w/google maps android api: glhudoverlay deprecated; getdraworder(): no-op, return draworder.heads_up_display how solve ? think render time log widget : supportmapfragment it known bug rendered google-maps library. resolved in next version

java - How to access Azure Storage Table using REST API (ARM) -

by looking following link it's not clear signature should contain or how form canonical string create signature can encrypted using hmac-sh256 alogrithm. https://msdn.microsoft.com/en-us/library/azure/dd179428.aspx i using following url get https://mystorageaccount.table.core.windows.net/tables headers: authorization sharedkeylite mystorrageaccount:<<encrypted signature>> x-ms-date thu 28 jul 2016 11:19:33 gmt getting following error: server failed authenticate request. make sure value of authorization header formed correctly including signature. @prit, please see code below generating shared key lite of table storage reference. import java.security.invalidkeyexception; import java.security.nosuchalgorithmexception; import java.text.simpledateformat; import java.util.calendar; import java.util.locale; import java.util.timezone; import javax.crypto.mac; import javax.crypto.spec.secretkeyspec; import org.apache.commons.codec.binary

Does silverstripe have recursive data relationships? -

does silverstripe have recursive data relationships? tried implement , gives no errors page blank on modeladmin. example has_one recursive relation on product itself: class product extends dataobject { private static $db = array( 'name' => 'varchar', 'productcode' => 'varchar', 'price' => 'currency' ); private static $has_one = array( 'product' => 'product' ); } yes, possible. there can problems when doing many_many relationships, though.

selenium webdriver - Method created in 2nd class skipped while running 2 classes in Testng using xml -

i had created 2 classes having 3 methods/test in these 2 classes. 2 methods/test in 1st class , 3rd method/test in 2nd class. when run these using xml 1st class runs both tests , tests pass method/test in 2nd class skips. xml: <?xml version="1.0" encoding="utf-8"?> <suite name= "expedia call tracker"> <test name="expedia home smoke testcases"> <classes> <class name="expediacalltracker.expedia"/> <class name="expediacalltracker.expediacreatesale" /> </classes> </test> </suite> first class : package expediacalltracker; import java.util.concurrent.timeunit; import org.openqa.selenium.by; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.support.ui.select; import org.testng.annotations.test; public class expedia {

ubuntu 14.04 - Postgres PG::ConnectionBad error coming while starting rails server -

i tried starting rails server , giving following issue: neha@scs-i82:~/work/code/$ rails s => booting puma => rails 3.2.22 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server exiting /home/neha/.rvm/gems/ruby-2.2.2@canvas/gems/activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize': fatal: no pg_hba.conf entry host "[local]", user "postgres", database "dev2", ssl off (pg::connectionbad) when try start postgresql service giving following error: neha@scs-i82:~/work/code/$ sudo service postgresql start * starting postgresql 9.3 database server * error: port conflict: instance running on /var/run/postgresql port 5432

c# - EntityFramework 6 Code-based configuration of connection string for database-first -

i'm attempting make existing application without app.config (it required due specific environment). problem it's heavily relying on entityframework 6 work sql-server. i'm trying utilize of code-based configuration can't figuar out how provide correct connection string through configuration. i've made configuration class: public class myconfiguration : dbconfiguration { public myconfiguration() { setdefaultconnectionfactory(new myconnectionfactory()); setproviderservices("system.data.sqlclient", system.data.entity.sqlserver.sqlproviderservices.instance); } } then providing dbcontext (generated ef automaticaly bd): [dbconfigurationtype(typeof(myconfiguration))] public partial class testmodelentities { } with custom connection factory: public class myconnectionfactory : idbconnectionfactory { public dbconnection createconnection(string nameorconnectionstring) { var newconnstringbuilder

appcelerator - Titanium -- set top/bottom padding on Ti.UI.TextField -

Image
i'm struggling android theme issue text fields. there's padding above/below have set textfields tall in order see text within. in shot, "1" label in box above; green text cursor pointing little black dot -- that's text inside text field (borders added clarity here). field tall can't see text. layout calls these text fields pretty close can't make things taller text field fits. need remove padding. ektheme.xml: <style name="ektheme" parent="@style/theme.appcompat.notitlebar"> <item name="android:windowactionbar">false</item> <item name="android:windownotitle">true</item> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> <item name="android:edittextstyle">@style/edittextektheme</item> </style> ekstyles.xml: <style name="edittextektheme&quo

c# - Getting rid of unnecessary text Regex -

alright having trouble this: have string looks this <a class="l _hid" href="http://www.cnbc.com/2016/07/28/royal-dutch-shell-second-quarter-net-profit-comes-in-at-118-billion.html" onmousedown="return rwt(this,&#39;&#39;,&#39;&#39;,&#39;&#39;,&#39;1&#39;,&#39;afqjcnhzdjmd9kznazjkrec-famndp8ujw&#39;,&#39;mb_qkv1zfbnfljbx-jncea&#39;,&#39;0ahukewiwmbpoljboahvj6xqkht1qdfkqqqiigigamaa&#39;,&#39;&#39;,&#39;&#39;,event)">shell sees quarterly profits plummet 70% low <em>oil price</em> bites</a> which, simplified, looks essentially: <a class="l _hid" href="link" onmousedown="some gibberish">the string need <em>i guessing searched</em> bites</a> it have been helpful if new how achieved. form of appreciated. thanks in advance. indeed link post answered questions: regex match open tags except xht

Generate HTML/XML Markup in C# Console Application? -

i working console application generates xml/html output. have code below includes hard-coded spaghetti markup. is possible use razor or tool improve , make cleaner? foreach (var file in _files) { taglib.file f = taglib.file.create(file.fullname); string title = f.tag.title; string url = _urlprefix + file.name; stringbuilder sb = new stringbuilder(); sb.append("<item>\n"); sb.appendformat("\t<title>{0}</title>\n", httputility.htmlencode(title)); sb.appendformat("\t<pubdate>{0}</pubdate>\n", file.creationtimeutc.tostring("r")); sb.appendformat("\t<guid ispermalink=\"false\">{0}</guid>\n", url); sb.appendformat("\t<enclosure url=\"{0}\" length=\"{1}\" type=\"audio/mpeg\" />\n", url, file.length); sb.append("\t<itunes:subtitle></itunes:subtitle>\n"); sb.append("\t

tibco - Spotfire: Custom Expressions How to learn? -

Image
i working spotfire , not find documentation custom expression. bummer, since custom expressions seem mighty, has been constant struggle trial , error. here great places start. also, syntax sql-ish, if familiar sql server or mysql syntax help, though sql language help. on web overview introduction basic expressions advanced expressions details on expressions axes in expressions some other overview... and lastly... demo's in spotfire within spotfire, when attempt insert custom expression on column, can browse of functions can used in custom expression, , find on 1 choose within processional client. below image detailing this. notice yellow highlighted areas if click button on bottom left, taken updated documentation:

sql - Php select fields query error -

can me understand why update query isn't updating fields in database? have in php page retrieve current values database: ok select assuming mean isn't setting $id, $username etc. it because not fetching associative array mysql_fetch_array function. need reference columns $row[0], $row[1] etc. change while line to: while ($row = mysql_fetch_array ($query, mysql_assoc)) you'll able reference columns in $row name. ie. $row['id']

php - doctrine manyToMany SQLSTATE[HY000]: General error: 1005 Can't create table (errno: 150) -

i have issue /** * @package entity * @orm\entity * @orm\table(name="r_country") */ class rcountry { /** * @orm\column(type="string", length=2) * @orm\id */ protected $id; ... /** * * @orm\manytomany(targetentity="rlanguage") * @orm\jointable(name="prohibited_language_display", * joincolumns={@orm\joincolumn(name="country_id", referencedcolumnname="id", ondelete="cascade")}, * inversejoincolumns={@orm\joincolumn(name="language_id", referencedcolumnname="id", ondelete="cascade")} * ) * */ protected $prohibitedlanguagedisplay; ... } /** * @package entity * @orm\entity * @orm\table(name="r_language") */ class rlanguage { /** * @orm\column(type="string", length=20) * @orm\id * */ protected $id; ... } i'm trying manytomany relation doctrine when update fires error [doctrine\dbal\excepti

android - AltBeacon Minor & Major -

how can minor , major in monitoring mode when beacon detected (background) ? i check https://altbeacon.github.io/android-beacon-library/samples.html didn't find solution. monitoring apis not return exact identifiers of matched beacons detected. return reference region object used monitoring, , if contains null values identifiers (wildcards), won't know beacon identifiers seen. when need know identifiers, standard approach use ranging api s triggered beaconmanager.startrangingbeaconsinregion(region) . callback these apis didrangebeaconsinregion(region region, collection<beacon>) which gives list of every beacon matched in last scan interval. you can see examples of how use ranging in same samples page here: https://altbeacon.github.io/android-beacon-library/samples.html

sql - Why sometime adding conditions to query accelerate it in Postgresql? -

i have 2 tables, generated django orm - core_instauser , core_instauser_followers . please see below create table statements query getting followers few accounts , ordering column (counts_followed_by) taking more 30 seconds: # select # t3."id" # "core_instauser_followers" # inner join "core_instauser" t3 on ("core_instauser_followers"."to_instauser_id" = t3."id") # "core_instauser_followers"."from_instauser_id" in (14275, 30533081) # order t3."counts_followed_by" desc # limit 10; id -------- 23358 17461 34360 34201 30624 12475 306799 19215 21042 27073 (10 rows) time: 32850.160 ms but if add conditions, not changing result, query take 0.3 seconds - faster in 100: # select # t3."id" # "core_instauser_followers" # inner join "core_instauser" t3 on ("core_instauser_followers"."to_instauser_id" = t3."i

ios - Could not configure Firebase InstanceID -

hi i'm trying include firebase in app , followed documentation, when i'm trying google sign in, not configure firebase instanceid error occurs .please advice how overcome error you have add project created on https://developers.google.com/mobile/add?platform=ios or fire base console firebase dashboard. now can download googleservice-info.plist firebase , import project.

sql - How to concatenate Multiple Rows from Multiple Tables Efficiently -

i have multiple tables foreign key main table. tables this: sisters mainid idno .... 111111 1 .... 111111 1 .... 111111 1 .... 222222 1 .... 111111 2 .... brothers mainid idno .... 111111 555 .... 111111 333 .... 111111 111 .... 222222 222 .... 111111 321 .... uncles mainid idno .... 111111 561 .... 111111 121 .... 111111 331 .... 222222 451 .... 111111 672 .... i need concatenate idno s in can't seem example maybe can't 672 select ',' + s1.idno + ',' + b1.idno + ',' + u1.idno [text()] sisters s1, brothers b1, uncles u1, maintable d1.mainid = maintable.id , s1.mainid = maintable.id , b1.mainid = maintable.id xml path('') i tried seperate tables , concanate later getting slowe

c++1z - alloca() with VLAs and C++ -

the alloca() replacement c++ have found on internet looks this: template <typename f> void alloca_(::std::size_t const n, f&& f) noexcept(noexcept(f({}))) { alignas(::std::max_align_t) char p[n]; f(p); } but, obviously, not alloca() know , love, not function, nor macro. can alloca() implementation resembles alloca() function call semantics more closely, written? perhaps macro? whether macro or function, should allocate space stack, not heap.

php - read json object clean and sanitize for database storage -

hi need send json data php script , unpack, clean , sanitize insertion in database problem not know how data php script , read, says index undefined. ajax request looks like $.ajax({ type: "post", url: "save.php", data:{param:my_people}, success: function(data){ //success here means ajax call succeeded, not data works alert(data); } }); this php looks like $data = json_decode($_post['my_people']); the truth not know how work json ajax , php. highly welcome! if variable my_people javasript valid, $_post['param'] should contain my_people datas.... did try write die(json_ecode($_post)); or die(json_ecode($_get)); in first line of save.php see coming ajax ? aahh.. save.php file editing , code using $.ajax on same directory ?

import - Getting error while trying to connect to mysql server from sqoop -

i using cloudera cdh practising sqoop. when try connect cloudera mysql database through sqoop. getting error - "use --table or --query import" i followed instruction described in sqoop documentation. http://sqoop.apache.org/docs/1.4.6/sqoopuserguide.html#_connecting_to_a_database_server is there anyway connect mysql server sqoop other using import statement. [cloudera@quickstart ~]$ sqoop import --connect \ > jdbc:mysql://quickstart.cloudera/retail_db \ > --username cloudera --password cloudera warning: /usr/lib/sqoop/../accumulo not exist! accumulo imports fail. please set $accumulo_home root of accumulo installation. 16/07/28 07:07:31 info sqoop.sqoop: running sqoop version: 1.4.6-cdh5.5.0 16/07/28 07:07:31 warn tool.basesqooptool: setting password on command-line insecure. consider using -p instead. --table or --query required import. (or use sqoop import-all-tables.) sqoop import used import data rdbms hdfs. import data need tell name of

typescript - Loading some json objects -

i load json: [{ "id": "0a4bf3b5bb5f47ece9284052389ae02f6c9dba989ca34086a30e049ee3d8eb47", "name": "celery", "status": "offline", "servicecontrolled": true }, { "id": "ec9471ec001c10b9fa286e1f52e39c5dc9485a7c2cfbf55145c26242bb98ec4d", "name": "nginx", "status": "online", "servicecontrolled": false }] and show servicecontrolled in html: <td> <span>{{ service_rec.servicecontrolled }}</span> </td> how show "servicecontrolled": true in html code? edit: now question more precise, is: <td> <span *ngif="!!service_rec.servicecontrolled">"servicecontrolled": {{ service_rec.servicecontrolled | json }}</span> </td> old answer (thought wanted display “true” or “false”): about:

How can I use Gulp to add a line of text to a file -

i've been trying figure out how add line of text type of file using gulp. for instance add: @import 'plugins' to main.sass file. or add cdn index.html file. i did try: gulp.task('inject-plugins', function(){ gulp.src('src/css/main.sass') .pipe(inject.after('// add imports', '\n@import \'plugins\'\n')); }); with no joy. idea how achieve please? depends on want do. if want add text beginning or end of file gulp-header , gulp-footer friends: var header = require('gulp-header'); var footer = require('gulp-footer'); gulp.task('add-text-to-beginning', function() { return gulp.src('src/css/main.sass') .pipe(header('@import \'plugins\'\n')) .pipe(gulp.dest('dist')); }); gulp.task('add-text-to-end', function() { return gulp.src('src/css/main.sass') .pipe(footer('@import \'plugins\'')) .pipe(gulp.