Posts

Showing posts from August, 2013

android - Firebase Save Notification to DB not working when app is not running -

i handling fcm notifications in app. in public void onmessagereceived(remotemessage remotemessage) { notification notification = new notification(); notification.settitle(remotemessage.getnotification().gettitle()); notification.setdescription(remotemessage.getnotification().getbody()); dateformat simpledateformat = new simpledateformat("dd/mm/yyyy"); dateformat simpletimeformat = new simpledateformat("hh:mm"); date date = new date(remotemessage.getsenttime()); notification.settime(simpletimeformat.format(date)); date date2 = new date(); notification.setdate(simpledateformat.format(date2)); databasehelper databasehelper = new databasehelper(getapplicationcontext()); databasehelper.savenotification(notification); //calling method generate notification sendnotification(remotemessage.getnotification().getbody()); } but when app not running or in b

reactjs - React-router universal. Why Root component does not re-renders? -

i have universal app (server rendering). routes.js looks this routes.js <route path="/" component={root}> <route path="sales/:id" component={view} /> ... </route> -- root.js class root extends component { ... render() { return ( <div> <header {...someprops} /> {this.props.children} </div> ); } } -- server.js app.use((req, res) => { match({ routes, location: req.url }, (error, redirectlocation, renderprops) => { if (error) { ... } else if (redirectlocation) { ... } else if (renderprops) { const initialstate = {}; const store = configurestore(initialstate); fetchcomponentdata(store.dispatch, renderprops.components, renderprops.params).then(() => { const html = rendertostring( <provider store={store}> <routercontext {...renderprops} /> </provider>

javascript - show button reset when input file have value -

i try create button reset input file. everytime input file have value button show reset input file. problem is, have 6 input file. , when upload image on 1 of input file, button show up, other input file didnt have value yet. how make specific button? my code this $("#inputfile1").change(function(){ if($(this).val() == "") $('.reset').css({"display": "none"}); else $('.reset').css({"display": "block"}); }) $("#inputfile2").change(function(){ if($(this).val() == "") $('.reset').css({"display": "none"}); else $('.reset').css({"display": "block"}); }) $("#inputfile3").change(function(){ if($(this).val() == "") $('.reset').css({"display": "none"}); else $('.reset').css({"display": "block"}); }) heres jsfiddle https://js

build - cocos2d errors when changing iOS target -

i have ios app has been using cocos2dx. app works fine when app , cocos library both target ios 6 when change 7 or 8 error appearing. libc++abi.dylib: terminating uncaught exception of type std::out_of_range: basic_string why appear of sudden this crash in code, iterating on string , accessing out of bounds. try debugging application in xcode , adding breakpoint exceptions: http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions you can follow call stack offending code.

jquery - How to loop over elements in a json list Ajax/Javascript -

i have issue ajax can see data i've given flask, doesn't seem parsing inside when loop it. 1 item loop, more when data fed it. json string is: { "routers" : {"dnsrootserver": {"os": "4.4.4.4", "name": "dnsrootserver"}}} so understands data.routers, , understands data.routers.dnsrootserver.name (as you'll see in console.log), when use loop on data.routers, looped item displays (el), seems fail when try el.name, saying it's undefined. javascript below: $(document).ready(function(){ $.ajax({ url: "{{ url_for('.gui_form') }}", datatype: 'json', success: function(data, textstatus, xhr){ console.log(data) $(data.routers).each(function(i, el) { console.log(el) console.log(el.os) console.log(data.routers.dnsrootserver.os) var listem = "<br>" + el.name; $("#routers").append(&qu

amazon web services - "aws s3 ls" command throwing "InvalidRequest" error message. How to solve it? -

after run aws s3 ls command below error message:- a client error (invalidrequest) occurred when calling listbuckets operation: attempting operate on bucket in region requires signature version 4. can fix issue explicitly providing correct region location using --region argument, aws_default_region environment variable, or region variable in aws cli configuration file. can bucket's location running "aws s3api get-bucket-location --bucket bucket". below more details , findings may answer question:- the command being executed ec2 instance running in ap-south-1 region. this amazon doc says new region created after jan 30 2014 support signature version 4. as suggested error message tried giving command aws --region ap-south-1 s3 ls command gives same error message. i have run yum update , aws cli version latest aws-cli/1.10.33 python/2.7.10 linux/4.4.11-23.53.amzn1.x86_64 botocore/1.4.23 the above aws s3 ls command works absolutely fine , l

c# - Fully qualified interface name in inheritance -

this question has answer here: why explicit implementation of interface can not public? 2 answers there 2 interfaces defined as: interface calc1 { int add(int a, int b); } interface calc2 { int add(int x, int y); } a class implements both these interfaces as: class calculation : calc1, calc2 { public int result1; public virtual int add(int a, int b) { return result1 = + b; } } everything works fine. when change class definition as: class calculation : calc1, calc2 { public int result1; public int result2; public virtual int calc1.add(int a, int b) { return result1 = + b; } public int calc2.add(int x, int y) { return result2 = x - y; } } i see errors: the modifier 'virtual' not valid item and the modifier 'public' not valid item what wrong in la

java - Can't read image URL from RSS using Rome API -

my question same in topic found - unable read image url feed using rome api except 2 conditions. so, how read image url: <item> <title>dementia in care homes 'more common'</title> <description>eight out of 10 residents in care homes thought have dementia or severe memory problems, new data shows.</description> <link>http://www.bbc.co.uk/news/health-21579394#sa-ns_mchannel=rss&amp;ns_source=publicrss20-sa</link> <guid ispermalink="false">http://www.bbc.co.uk/news/health-21579394</guid> <pubdate>tue, 26 feb 2013 00:28:31 gmt</pubdate> <media:thumbnail width="66" height="49" url="http://news.bbcimg.co.uk/media/images/66064000/jpg/_66064884_c0016428-geriatric_care-spl.jpg"/> <media:thumbnail width="144" height="81" url="http://news.bbcimg.co.uk/media/images/66064000/jpg/_66064885_c0016428-geriatric_care-spl

continuous integration - Android Library & CI -

i want run tests in android library project gitlab ci: . gitlab-ci.yml file: before_script: - export android_home="/opt/android-sdk" - export gradle_home="/opt/gradle" - export path="/opt/gradle/bin:$path" - export path=$path:/opt/android-sdk/tools - export path=$path:/opt/android-sdk/platform-tools build: script: - gradle clean build i get plugin id 'com.android.library' not found. what wrong? thanks. added next android library build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } }

Replace letters in a string using Python -

this question has answer here: how swapping of members in python tuples (a,b)=(b,a) work internally? 1 answer i'm new python , i'm trying understand basic thing. have code: def mix_up(a, b): a,b=b[0:2]+a[2:], a[0:3]+b[3:] print (a,b) mix_up("abcd","efgh") why b doesn't "new" 3 letters of (i.e, "efch")? there elegant of doing in 1 line, or have use other variables? thanks! the reason not working because assignment (the left hand side of = ) happens after entire right hand side evaluated. so a , b still "old" a , b in statement, , not new ones. to fix it, split 2 statements: a = b[0:2]+a[2:] b = a[0:3]+b[3:] # "new"

javascript - Failing to inject an angular component -

Image
so trying here make angular component , injected angular app. here code angular component: (function(angular) { 'use strict'; angular.module('some.somemodule', ['bm.component.templates']) .directive('somesomemodule', somesomemodule); somesomemodule.$inject = []; function somesomemodule() { return { restrict:'ea', templateurl : 'components/document_preview/document-preview1.html' }; } })(window.angular); i have app.js inject new component app module. var someapp = angular.module('some.app', [ 'bm.component.templates', 'some.hello', 'some.somemodule', ]) .config(config) .run(run); i console: strange thing have some.hello angular component same sort of code , working fine. how fix this? appreciated. you not declaring custom module dependency of application module. please try following : var someapp = angular.module('some.app', [ &#

android - How to pass onClick from view pager to view below it? -

i have view pager above tablayout, pages have hide tablayout, cannot click on tabs. <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="50dip" android:layout_alignparentbottom="true" app:tabbackground="@drawable/bg_tab" app:tabgravity="fill" app:tabindicatorcolor="@null" app:tabindicatorheight="0dip" app:tabminwidth="0dip" app:tabmode="fixed" app:tabselectedtextcolor="@color/white" app:tabtextappearance="@style/minecustomtabtext" app:tabtextcolor="@color/white" /> <android.support.v4.view.viewpager android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="match_parent" /> </relative

c# - Visual Studio solution properties: Debug|Mixed Platforms.ActiveCfg = Debug|.NET -

i'm looking in .sln file of old code, , see various lines end debug|.net . <- '.net' mean? (as opposed 'any cpu' or 'x86')? full line: {f9e9f25d-1008-4098-a4a7-179a0512f745}.debug|mixed platforms.activecfg = debug|.net examples can seen here (line 56): https://github.com/apereo/dotnet-cas-client/blob/master/dotnetcasclient.sln these settings can found in gui (solution explorer -> right click on solution -> properties -> configuration properties) - , if change them ".net" "any cpu" stuck there , .net no longer option. (visual studio 2008, targeting .net 3.5) thanks. the part right can named person writing project wants. "platform configuration name" , customize-able in gui. need choose <new> "active solution platform" drop-down (this how in visual studio 2013, earliest version have installed). as why can't change , disappearing, because place used project id {f9e9f25d-100

How to show option saved in array in drop down list in php -

i created dynamic drop down box(on change function of other textbox)and have retrieved drop down options according condition ,from sql database,which saved in array. data saved in array want display array values option in drop down list. success: function(result){ var pch=result.split('//'); var plen=pch.length; var options=''; $('#fid').html(''); $('#fid').append('<tr><td><br><b>process name</b><br><br></td></tr><tr><td><select name="process_name" label="" id="prc" style="height:30px; margin-top:-5px; min-width:190px; width:auto;" ><option value="">select any</option>'); for(var j2=0;j2<plen-1;j2++){ $('#fid').append('<option value="'+pch[j2]+'">'+pch[j2]+'</option>'); } $('#fid').append(

ruby on rails - Devise sign up either by email or by mobile number -

i can register user getting both email address , mobile number in application. want register user using either email or mobile primary authentication key. if user provides email address, must saved in email field in database , if user provides mobile number, must saved in mobile field in database. and overwrite confirmation method of mobile user , send message activation key , inter key in application activate registration. think not hard, didn't start. please suggest me favourable way accomplish task. yes, can minor setting. like this modify application_controller.rb class applicationcontroller < actioncontroller::base before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters added_attrs = [:mobile_no, :email, :password, :password_confirmation, :remember_me] devise_parameter_sanitizer.permit :sign_up, keys: added_attrs devise_parameter_sanitizer.permit :account_update, keys: a

vb.net - Passing data between forms DIRECTLY -

i'm making "preference form" hold users preferences , when go apply/save want new values transfer main form , updateand close form2. in past have done this: private sub preferencestoolstripmenuitem_click(sender object, e eventargs) handles preferencestoolstripmenuitem.click preferences.show() end sub and when click "apply/save" button before closes transfer data this: form1.textbox.text = form2.textbox.text is there wrong doing way?? what have been reading should doing this: private sub preferencestoolstripmenuitem_click(sender object, e eventargs) handles preferencestoolstripmenuitem.click dim dialog new preferences dialog.showdialog() end sub and when when click "apply/save" take values form2 , store them in private variable (or property) in form2 , when form closes access value this: private sub preferencestoolstripmenuitem_click(sender object, e eventargs) handles preferencestoolstripmenuitem.click dim dialog new

ruby on rails - How to get static link from assets pipeline -

i new in rails , still got stuck @ link javascript file. using bower rails install xdlocalstorage , after installed, received folder xdlocalstorage @ vendor/assets/bower_component . in app/assets/javascript/xdlocalstorage/application.js : //= require xdlocalstorage //= require_tree . in config/initializers/assets.rb rails.application.config.assets.precompile += %w( xdlocalstorage/application.js ) now, want url file in xdlocalstorage . not. had tried follow: = asset_url 'xdlocalstorage/dist/scripts/xdlocalstorage.min.js' but return 404. some people ask me why have url. xdlocalstorage.min.js not using website, embed on website , dynamically load jquery. need url file. and people ask me why not move xdlocalstorage public folder. because need able upgrade xdlocalstorage bower easier. please me above url. rails version: 4 there's no xdlocalstorage/dist/scripts/xdlocalstorage.min.js because not precompiled. if need - add rails.application.con

windows - How to link kernel32.lib and user32.lib using a combination of `nasm` and `alink`? -

how link kernel32.lib , user32.lib using combination of nasm , alink ? i'm following tutorials on assembly programming , guide wants me execute following commands: nasm -fobj hello.asm alink -ope hello \lib\kernel32.lib \lib\user32.lib the first command executes expected, second command fails. to link .lib files, i've copied them c:\program files (x86)\microsoft sdks\windows\v7.1a\lib into current folder. the error messages when executing second command is: loading file hello.obj loading file kernel32.lib 2327 symbols loaded first linker member loading file user32.lib 1385 symbols loaded first linker member matched externs matched comdefs unresolved external messageboxa unresolved external exitprocess now, i've 2 questions: 1) kernel32.lib , user32.lib located? 2) how can link these library files properly? the operating system windows 10 (64-bit). update: ; coded nasm

android - Collapsing toolbar anchored view is hidding when collapse -

Image
i need display textview (the circular shape "0") anchored toolbar, fab, must visible. my problem when collapse toolbar (scrolling recyclerview), @ collapsed state, hides half of view... textview layout has properties: app:layout_anchor="@id/appbar" app:layout_anchorgravity="bottom|center_horizontal" anyone knows how solve it? if want textview on toolbar, in case, can try set higher elevation value textview. in cases, worked me. for example: android:elevation="15dp"

javascript - jQuery detect if div is outside of view port vertically -

i'm trying detect when div gets opened top of outside of view-port & if add class adjust css. so in example on hover half of div missing should add class turn div green. because code meant detect div outside viewport. but cant sync. i'm doing wrong here. update i have noticed technically working happening if both top , bottom of div goes outside of both bottom , top of view port triggers. need trigger when goes out of top. jsfiddle $(document).on("mouseenter", ":has('.infotip')", function() { $(this).children(".infotip").addclass("active"); }); $(document).on("mouseleave", ":has('.infotip')", function() { $(this).children(".infotip").removeclass("active"); }); // infotip on screen $(document).on("mouseenter", ":has('.infotip.onscreen')", function() { var $target = $(this).children(".infotip"); if ($target

php - can't connect to db in my sql -

i using mamp on mac connect localhost ,i can connect server problem cant connect db, don't know in part of query making mistake since 1 line query.i searched different solutions here on stack overflow couldnt helpful $username = 'root'; $password = 'root'; $host = 'localhost'; $database = 'trendnow'; $link = mysqli_connect($host, $username, $password); if (!$link) { echo 'can not connect server'; } $db_selected = mysqli_select_db($database,$link); echo $db_selected; if (!$db_selected) { echo 'can not connect trend '; } felippe duarte correct. database trying connect to? mysqli_connect("localhost","my_user","my_password","my_db"); localhost means connect server program running on. people connect database located on server not local, ip address. my_db name of database. if database called webstore, may have table located on database called, computers. webstore name of

precision - What happens to the potentially inaccurate digits in floating point arithmetic? -

according wikipedia, floating point arithmetic using double precision accurate minimum of 15 digits. i'm in process of reading: what every computer scientist should know floating-point arithmetic but i'm still bit confused on how digits past 15th handled. understand can accurate , not. an example: 15th digit ^ 0.111222333444555xx.. due potential inaccuracy, makes sense me these digits ignored. if that's not case how handled?

java - Catch LeaveFullscreen in JavaFx -

i'm writing javafx-application , want force fullscreen. tried mainview.getlayout().setonkeypressed(event -> { if(event.getcode() == keycode.escape){ mainview.getstage().setfullscreen(true); } }); mainview.getlayout() returns stackpane but that's not clean solution, when leaves fullscreen automatically switches fullscreen. want catch leavefullscreen , nothing instead of leave , switch back. the fullscreenexitkey property of stage can set keycombination.no_match . prevents combination of keys exiting full screen mode. stage.setfullscreenexitkeycombination(keycombination.no_match); stage.setfullscreen(true);

ruby on rails - Record Not Found Error: Couldn't find List without an ID -

i'm building basic type app lists , each of has_many items . i'm trying construct view delegated tasks ( sharing/tasks.html.erb ) show items have been marked delegated. here relevant code on tasks.html.erb page: <h2 class="text-center">delegated me</h2> <% @deligated_to_me.each |item| %> <p><%= link_to list_path(@list) %> <%= item.name %> <% end %> (deligated <%= item.user_id %>)</p> <% end %> and here sharing_controller section tasks page: def tasks @lists = list.all @list = list.friendly.find(params[:list_id]) <<<<error called on line @items = item.all @delegated_to_me = @items.where(:delegated_to == current_user.email) @delegated_by_me = current_user.items.where.not(delegated_to: "") end when try view page record not found error saying couldn't find list without id . i've seen on other posts problem var

C# Linq and lambda -

how select(int.parse) work in such linq expression? "1,2,3,4,5".split(',').select(int.parse).tolist(); //ok "1,2,3,4,5".split(',').select(x => int.parse(x)).tolist(); //ok why example console.writeline returns compilation error? "1,2,3,4,5".split(',').select(console.writeline).tolist(); //error "1,2,3,4,5".split(',').select(x => console.writeline(x)).tolist(); //ok when allowed omit lambda (x => ....(x)) console.writeline int.parse so-called method groups . groups of methods. because of various overloads of methods. can 1 method, or multiple methods. a method group can converted delegate if compiler can infer method of group meant. example method group int.parse can delegate int.parse(string) if func<string, int> is expected. this works in first example. select expects func<t, t2> , t set of type string . however, not work second

php - url decode is not working on my server -

this code using decode url. getting output on local machine when uploaded code on server not getting output , data not coming in $data variable. there other alternate way <img src="tmp.jpg"> <?php function base64_to_jpeg($base64_string, $output_file) { $data = explode(',', $base64_string); //print_r($data); $a = base64_decode($data[0]); } // $my_base64_string = $final_result['packages'][0]['cod']; $my_base64_string = 'ivborw0kggoaaaansuheugaaamyaaab4caiaaaamoropaaann0leqvr4no3ae0xt5xsh8eobfjpewqoirfy01bwdgupykk5dn/acgrhlchsyeqdxmzmcm5tdzcsyuqwdji1zwcieuoyuyrumsbiiggyikwxhruy4lmvgfjfbyzqlt/1xfnlzdk5ba/v+/ns+f/u8fc7znnp8sk8p+dkcdulb7d+/n3yhuqkignj77bevsqvcosaioru7u7gxexw6qppuajvzz84hnthxgicio0epnjy2dnd3ozrqr3pqw1ntu8w6mopa0lrr0deeqad5covcqvqy56djj4mjqxoy14g57utkpnprqjud1iwrx8ocg5d9tdrzerq/ptq5totmo54h4pak2r2vr6+vr48gijqagvktmpoa6nxxdbq6wwfoisuljsuljtkcjpkseuqoqj95fk7raa6c1iu30fyskhknc

heroku - Express error when trying to send static file: path must be absolute -

i have code works fine locally, when running in heroku error var express = require('express') var app = express() var path = require('path') app.use(express.static('public')); var bodyparser = require('body-parser') app.use(bodyparser.urlencoded({ extended: true })); // parse application/json app.use(bodyparser.json()) const portnum = 8080 var port = process.env.port || portnum; app.get('/', function (req, res) { res.sendfile('index.html') }) however when running in heroku error: typeerror: path must absolute or specify root res.sendfile any ideas? you can absolute path using: path.join(__dirname, myfilename) reference - https://nodejs.org/api/globals.html#globals_dirname

angularjs - JSON Response with infinite scroll -

i have troubles infinite scroll function. every time when scroll down loadmore function called twice , every time load 2 page instead of 1 page. in log see loading 2 , 3 page: loadmore 2 loadmore 3 then load 4 , 5 page: loadmore 4 loadmore 5 this controller: .controller('postsctrl', function( $scope, $http, dataloader, $timeout, $ionicslideboxdelegate, $rootscope, $log ) { var postsapi = $rootscope.url + 'posts'; $scope.moreitems = false; $scope.loadposts = function() { // of our posts dataloader.get( postsapi ).then(function(response) { $scope.posts = response.data; $scope.moreitems = true; $log.log(postsapi, response.data); }, function(response) { $log.log(postsapi, response.data); }); } // load posts on page load $scope.loadposts(); paged = 2; // load more (infinite scroll) $scope.loadmore = function() { if( !$scope.moreitems ) { return; } var pg = paged++;

android - How do I pass value from one Activity to another and show it in adapter? -

Image
i have recyclervieweractivity custom adapter inside it. there product categories in recyclerviewer , adapter holds name each category like: category 1 = "drinks", category 2 - "dairy", category 3 = "pasta". when user clicks on "drinks" - new activitydrinks called list view add items category- can add soda, cola. if clicks on "dairy" - activitydairy opens , can add milk, yogurt... now try implement indicator of existing items in list , pass adapter.so if there @ least 1 item in activitydrinks - want display image above name of category in adapter (in recyclerviewer activity). user see if has items in category or no. i added boolean variable checking arraylist in every activity (activitydrinks, activitydairy): if (arraylist == null) { return false; } else { return true; } this part works, want display image above the name of category in adapter (adapter holds name of each category + imageview hold indica

php - Mysql returns no values when null values are present In the subquery -

i have 2 tables table1 , table2 . , content follows mysql> select id table1; +------+ | id | +------+ | 1 | | 2 | | 3 | | 4 | +------+ 4 rows in set (0.00 sec) mysql> select id table2; +------+ | id | +------+ | 301 | | 2 | | null | +------+ 3 rows in set (0.00 sec) when hit below query in mysql console returns empty set select id table1 id not in (select id table2); empty set (0.00 sec) is there reason when there null values in sub query in , not in malfunction....? i've solved using below query select id table1 id not in (select id table2 id not null); +------+ | id | +------+ | 1 | | 3 | | 4 | +------+ 3 rows in set (0.00 sec) just want know thanks in advance :) edit: this question tries clear air not enough that how not in works. recommend use not exists instead: select id table1 t1 not exists (select 1 table2 t2 t1.id = t2.id); why not in work way? because of semantics of not in . rem

python - how to join three tables and show the items based on timestamps in django -

friends, working on site shows registered user his/her customized news feed based on users follow. want should see items 3 models question, answer , document, based on these items' timestamps.all models have timestamps field. how can implement it? here views.py def index(request): questions = question.objects.all() answers = answer.objects.all() docs = document.objects.all() return render(request,"welcome/index.html",locals()) i've kept views.py simple on here. want idea on how manipulate 3 models @ once. you can chain objects, , sort using common timestamp field of models: from itertools import chain def index(request): items = sorted(chain(question.objects.all(), answer.objects.all(), document.objects.all()), key=lambda obj: obj.timestamp) return render(request, "welcome/index.html", {'items': items})

c# - How to resolve a missing System.Core assembly? -

i have web application using new asp.net core rc2 , i'm getting "could not load file or assembly 'system.core, version=2.0.5.0" error message. where can reference assembly? project.json "dependencies": { "microsoft.netcore.app": { "version": "1.0.0-rc2-3002702", "type": "platform" }, "microsoft.applicationinsights.aspnetcore": "1.0.0-rc2-final", "microsoft.aspnetcore.authorization": "1.0.0-rc2-final", "microsoft.aspnetcore.authentication.cookies": "1.0.0-rc2-final", "microsoft.aspnetcore.diagnostics": "1.0.0-rc2-final", "microsoft.aspnetcore.diagnostics.entityframeworkcore": "1.0.0-rc2-final", "microsoft.aspnetcore.identity.entityframeworkcore": "1.0.0-rc2-final", "microsoft.aspnetcore.mvc": "1.0.0-rc2-final",

javascript - Bootstrap nav pills with / sign in the tab link don't works -

i'm using bootstrap nav pills. if put / sign link of tab, tab not work, throws javascript error in jquery own code if click it. how can fix this? <ul class="nav nav-pills"> <li class="active"><a data-toggle="pill" href="#ax">first</a></li> <li><a data-toggle="pill" href="#b/x">second / sign</a></li> <li><a data-toggle="pill" href="#cx">third</a></li> </ul> jsfiddle the character / special character, means have escape it. adding \ in front of it. your final code like: <ul class="nav nav-pills"> <li class="active"><a data-toggle="pill" href="#ax">first</a></li> <li><a data-toggle="pill" href="#b\/x">second / sign</a></li> <li><a data-toggle="pill" href=&q

YAML to C# with Yaml.net for Unity -

i making game have file full of strings , different translations inside of yaml file. here example of looks like. en: player: hello: hello thanks: enemy: hello: hello es: player: hello: hola thanks: gracias enemy: hello: hola as can see, have 3 nested dictionaries. first shows language - en , es , cn , or whatever national prefix. next, have list of dictionaries character names. these can player bob . lastly, each character has list of dictionary of lines. i using yaml.net (a version unity - using seems no different normal). here's example of how objects laid out. class translation { public dictionary<string, language> language { get; set; } } class language { public dictionary<string, character> character { get; set; } } class character { public dictionary<string, line> line; } class line { public string text { get; set; } } however, doesn't work sin

javascript - Jquery: add iteration index to the name of the class of child/parent <divs> dynamically -

i have html page has, 3 div class name " xyz ", now, on page load ($(document).ready(function()) each occurring of div "xyz" want introduce inner html/child element " <div class="childxyz###"></div> " ### represents position number of occurrence of parent class xyz . instance, first occurrence of parent class xyz child class name " childxyz1 ", second occurrence childxyz2 , on. can suggest simple solution this? initial page <div class="xyz"> //appending inner html , pass value 1 xyz first occurrence </div> <div class="xyz"> //appending inner html , pass value 2 xyz first occurrence </div> <div class="xyz"> //appending inner html , pass value 3 xyz first occurrence </div> the final page when jquery/js script runs should this. <div class="xyz"> <div class="childxyz1"> </d

ios - Cannot Play "m4a" in swift 2. -

i new swift. trying run audio file using avfoundation in swift 2. codes run file format "mp3" xcode crashes "m4a". whats mistake? using xcode 7.3.1. class viewcontroller: uiviewcontroller { var myaudioplayer = avaudioplayer() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let myfilepathstring = nsbundle.mainbundle().pathforresource("par30", oftype:"m4a") if let myfilepathstring = myfilepathstring { let myfilepathurl = nsurl(fileurlwithpath: myfilepathstring) do{ try myaudioplayer = avaudioplayer(contentsofurl: myfilepathurl) //myaudioplayer.play() }catch { print("error") } } } @ibaction func play(sender: anyobject) { myaudioplayer.play() } @ibaction func stop(sender: anyobject) { myaudioplayer.stop() myaudioplayer.currenttime = 0 } }

python - Add columns to pandas dataframe containing max of each row, AND corresponding column name -

my system windows 7, 64 bit python 3.5.1 the challenge i guess should easy, best of abilities it's hard accomplish , difficult explain. hope reproducible example below sheds light on problem. similar question has been asked , answered r in this post . i've got pandas dataframe, , know maximum value each row, , append info new column. know name of column maximum value located. , add column existing dataframe containing name of column max value can found. reproducible example in[1]: # make pandas dataframe df = pd.dataframe({'a':[1,0,0,1,3], 'b':[0,0,1,0,1], 'c':[0,0,0,0,0]}) # calculate max my_series = df.max(numeric_only=true, axis = 1) my_series.name = "maxval" # include maxval in df df = df.join(my_series) df out[1]: b c maxval 0 1 0 0 1 1 0 0 0 0 2 0 1 0 1 3 1 0 0 1 4 3 1 0 3 so far good. add column existing dataframe containing name of column part: in[2]: ? ? ? # i'd a

python - Error in the coding : TypeError : list indices must be integer, not str -

code importing file, working perfectly. but, there problem in line try import csv file, column called 'account key', returning typeerror above. import file_import fi function collectively finding data necessary csv file. def unique_students(csv_file): unique_students_list = set() information in csv_file: unique_students_list.add(csv_file["account_key"]) return len(unique_students_list) #enrollment_num_rows = len(fi.enrollments) #engagement_num_rows = len(fi.daily_engagement) #submission_num_rows = len(fi.project_submissions) #enrollment_num_unique_students = unique_students(fi.enrollments) #engagement_num_unique_students = unique_students(fi.daily_engagement) #submission_num_unique_students = unique_students(fi.project_submissions) csv_file["account_key"] lists expect numeric index. far know, dictionaries accept string indices. i'm not entirely sure supposed do; think logic flawed. bind info

c# - When using DataGrid, how to bind DataGridComboBoxColumn to other column contents -

i have datagrid, itemssource binding observablecollection. and: the 1st column binding name property; the 2nd column binding age property; example image now want add 3rd column, using datagridcomboboxcolumn control. , it's content shall names of column 1. when adding or removing row, content of datagridcomboboxcolumn shall add or remove name correspondingly. the way thought out silly: create new observablecollection called namelist. , everytime adding or removing row datagrid, add or remove name namelist @ same time. is there better way? add new property has getter , bind visibility property of first column. do not forget execute onpropertychanged added property when value of third column modified.

how to show confirmation dialogue box on mobile back button in android app? -

i want set confirmation dialogue box when user press button of mobile. there should asked user "do want exit?". add code: @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { showdialog(); } return super.onkeydown(keycode, event); } then add below: public void showpausedialog() { new alertdialog.builder(exerciseactivity.this) .settitle("are sure want exit?") .setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { //leave activity this.finish(); } }) .setnegativebutton("no", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { //do nothing } }) .setic

ios - Set two UIButton constraints? -

Image
i not able set constraints of 2 button next each other. need 2 button in middle of uiview. see below image can know how set these buttons constraints? here have set constraint same: 1)embed buttons in uiview & set constraint view. 2)set constraint first button 3)set constraint second button

c++ - recursion without base case and statements following recursion function -

when statements after recursion executed if there no base case ? void fun(int x,int y){ statement 1; statement 2; fun(x',y'); statement 3; statement 4; } here statement 1 , 2 not base cases.when statements 3 , 4 executed if every recursion sends control recursive function ? my question in reference code https://ideone.com/lekxw5 .in link have given, when statement after line 24 or after recursion executed ? @ link of code before answering . void dfsbipartitecolor(int x, int y, int c) { // if got paint cell: if ( (board[x][y] == 'x') && (color[x][y] == -1) ) { // color it: color[x][y] = c; // special case: have foudn there @ least 1 x: result = std::max(result, 1); // try adjacent hexagons: (int nx = ma

html5 - How do I enable a submit button if 1 or more checkboxes are checked? -

i went through mark's solution here : angular2, disable button if no checkbox selected have more 1 array, how modify code in link? or other solution doing this? want in angularjs 2. i have number of classes(arrays) & number of subjects in classes, & each subject corresponds checkbox, if 1 or more checkboxes selected no matter belong same or different class, button should enabled. here's code, right considers class1: import {bootstrap} 'angular2/platform/browser'; import {component} 'angular2/core' @component({ selector: 'my-app', template: ` <label *ngfor="let cb of class1"> <input type="checkbox" [(ngmodel)]="cb.state">{{cb.label}}<br/> </label><br/> <label *ngfor="let cb of class6"> <input type="checkbox" [(ngmodel)]="cb.state">{{cb.label}}<br/> <