Posts

Showing posts from April, 2015

checkbox variable in rails always true -

i have rails app using checkbox on view determine part of if statement runs. thought easy task though response in console after clicking submit button shows both: "adult"=>"0" (when not checked) , "adult"=>"1" (when checked) if try puts @application.adult the console prints true here's relevant part of .html.haml file...this recent attempt =simple_form_for( :application, :url => users_partner_acceptance_path( application ), :method => :put ) | f | .clearfix .column =f.input :full_name, label: 'full name', placeholder: 'full name' .help-block * please enter legal name =f.input :address_1, label: 'address', placeholder: 'apartment, street' =f.check_box_tag :adult, inline_label: 'i on 18 years old.', as: :boolean, checked = true .guardian =f.input :guardian_full_name, label: 'guardian full name', placeholder: 'full n...

sql - Efficient way to check for inequality -

i'm writing trigger doing if (@a <> @b) ... but not work null values on either @a or @b. way it's done if (@a <> @b) or (@a not null , @b null) or (@a null , @b not null) but involves 9 comparisons versus 1! i set ansi_nulls off but apparently not recommended (and deprecated). so best solution this? take 9 comparisons simple inequality check when should 1? trigger not performance critical, need fast. when batch loading, slow down considerably. peformance tests here results of performance test checks inequality million times such 90% of time values not equal, 10% of time each value may null. if (@a <> @b) or (@a null , @b not null) or (@a not null , @b null) result: average 3848ms if (isnull(@a, 0) <> isnull(@b, 0)) result: average 3942ms if (@a = @b) goto equal else if @a null , @b null goto equal result: average 4140ms if exists (select @a except select @b) result: average 7795ms the times don't matter...

django - Form Field not displaying in Template -

i'm new django , having bit of trouble forms. i'm trying display single text input users can enter phone number , sent email. i'm going have stored in postgre database want basics down first. submit button being displayed text input field isn't. tried putting forms.py inside of views.py see if phoneform() function , file wasn't importing didn't anything. views.py from django.shortcuts import render, redirect django.http import httpresponse, httpresponseredirect django.core.mail import send_mail .forms import phoneform # create views here. def index(request): # render index.html template context dictionary return render(request, "index.html") def get_number(request): # if post request need process form data if request.method == 'post': #create form instance form = phoneform(request.post) if form.is_valid(): cd = form.cleaned_data send_mail( cd['phone_...

javascript - Continually fire mouseover event while dragging over an element jquery ui? -

hopefully makes sense. i'm creating drag , drop modal jquery ui. have code set fire function adjusts styling using "over" option. here's code. function makedraggable(){ $(function(){ $( "tr[role='row']" ).draggable({ cursor: "none", cursorat: { top: 50, left: 50 }, containment: "body", scroll: false, delay: 200, start: function() { openmodal(); }, stop: function() { closemodal(); }, helper: function( event ) { return $( "<div class='drag-folder'><img src=<?php echo site_url("imgs/processicons/file_icon.svg");?>></div>" ); } }) }); makedroppable(); } function makedroppable(){ $(function(){ $( ".flex-item" ).droppable({ tolerance: 'pointer', ove...

ios - Google Maps services and traffic limits -

i'm planing create app locate user favorite place in ios. think use google maps more accurate. simple app , don't think give me enough money purchase paid version of google maps plan. checked in previous answers in stack-overflow , in terms of usage of google, seems tracking user location should contract plan or other option 1.000 request per day. got confused @ point. if has experience google maps tell me if simple app can use free maps service or should change apple mapskit? how should calculate number of request app if tracks position of user see if near someplace? thanks,

Fillna in multiple columns in place in Python Pandas -

i have pandas dataframe of mixed types, strings , numbers. replace nan values in string columns '.', , nan values in float columns 0. consider small fictitious example: df = pd.dataframe({'name':['jack','sue',pd.np.nan,'bob','alice','john'], 'a': [1, 2.1, pd.np.nan, 4.7, 5.6, 6.8], 'b': [.25, pd.np.nan, pd.np.nan, 4, 12.2, 14.4], 'city':['seattle','sf','la','oc',pd.np.nan,pd.np.nan]}) now, can in 3 lines: df['name'].fillna('.',inplace=true) df['city'].fillna('.',inplace=true) df.fillna(0,inplace=true) since small dataframe, 3 lines ok. in real example (which cannot share here due data confidentiality reasons), have many more string columns , numeric columns. end writing many lines fillna. there concise way of doing this? you use apply columns checking dtype whether it's numeric or not checking dtype.kin...

object - How to iterate (keys, values) in javascript? -

i have dictionary has format of dictionary = {0: {object}, 1:{object}, 2:{object}} how can iterate through dictionary doing like for((key,value) in dictionary){ //do stuff key 0 , value object } no, not possible javascript objects. you should either iterate for..in , or object.keys , this for (var key in dictionary) { if (dictionary.hasownproperty(key) { console.log(key, dictionary[key]); } } note: if condition above necessary, if want iterate properties dictionary object's own. because for..in iterate through inherited enumerable properties. or object.keys(dictionary).foreach(function(currentkey) { console.log(key, dictionary[key]); }); in ecma script 2015, can use map objects , iterate them map.prototype.entries . quoting example page, var mymap = new map(); mymap.set("0", "foo"); mymap.set(1, "bar"); mymap.set({}, "baz"); var mapiter = mymap.entries(); console.log(mapiter.next...

How can I reformat a series of dates in a vector in R -

i have vector of dates i'm trying convert date i'm not getting expected output, when sapply as.date instead of getting series of reformatted dates names dates , odd value. dates = c("20-mar-2015", "25-jun-2015", "23-sep-2015", "22-dec-2015") sapply(dates, as.date, format = "%d-%b-%y") 20-mar-2015 25-jun-2015 23-sep-2015 22-dec-2015 16514 16611 16701 16791 i each of values in vector showing new formated value. e.g. happen if as.date shown applied each element as.date("20-mar-2015", format = "%d-%b-%y") [1] "2015-03-20" you can directly use as.date(dates, format = "%d-%b-%y") . as.date vectorized, i.e. can take vector input, not single entry. in case: dates <- c("20-mar-2015", "25-jun-2015", "23-sep-2015", "22-dec-2015") as.date(dates, format = "%d-%b-%y") # [1] "2015-03-20" ...

javascript - Graphical pattern generation in jQuery -

i trying build -primitive- pattern generator in jquery goes on 1x1 pixel , determines, depending on value in preceding pixel, 1 in question going like. seeing relatively proficient in jquery unfortunately rather oblivious ways of requestanimframe api, realizing 1x1 pixel approach results in extremely slowed down execution, making browsers assume script has crashed (?) though in fact working, essentially, slow. i have therefore tested in bigger tile sizes because naturally easier generate. question @ point - should throw jquery approach aside , revise script in abovementioned api or there way make more efficient , realistically working jquery? link code: http://codepen.io/grovelli/pen/yepmrz/ ps: please excuse trivial comments in code <html> <head> <script type="text/javascript" src="jquery-1.11.1.min.js"></script> <script type="text/javascript"> // run once $(function() { //############...

Safely setting keys with StackExchange.Redis while allowing deletes -

i trying use redis cache sits in front of sql database. @ high level want implement these operations: read value redis, if it's not there generate value via querying sql, , push in redis don't have compute again. write value redis, because made change our sql database , know might have cached , it's invalid. delete value, because know value in redis stale, suspect nobody want it, it's work recompute now. we're ok letting next client operation #1 compute again. my challenge understanding how implement #1 , #3, if attempt stackexchange.redis. if naively implement #1 simple read of key , push, it's entirely possible between me computing value sql , pushing in number of other sql operations may have happened , tried push values redis via #2 or #3. example, consider ordering: client #1 wants operation #1 [read] above. tries read key, sees it's not there. client #1 calls sql database generate value. client #2 sql , operation #2 [write] above. push...

javascript - $.getJSON() call within $.each() loop not executing in order -

i looping on html table , performing $.getjson() call based on data read each row. want take data $.getjson call , insert row variables read. however, when run code seems execute out of sync. changes made last row of table instead of in order. here's working jsfiddle code here's table reading data from: <table id="isa-table"> <thead> <tr> <th>date</th> <th>fund / stock</th> <th>buy price (£)</th> <th>amount</th> <th>%</th> <th>value</th> </tr> </thead> <tbody> <tr data-quantity="3.5071" data-symbol="b41xg30" data-type="fund"> <td>27 oct 15</td> <td>vanguard inv uk lt lifestrategy 100 perc eqty</td> <td>142.56914</td> <td cl...

angularjs - $interval inside of a for loop -

i'm looking way count down 3 , save picture video element series of 4 times. countdowntimer 3,2,1,3,2,1,3,2,1,3,2,1. see code below. right code sets countdowntimer "3", 4 times in row , counts down -9. think understand why happening there way timer reset 3 desired output? //counts down 3 before each picture , adds each picture canvas for(i = 0; < 4; i++){ $scope.countdowntimer = 3 //reset timer 3 console.log($scope.countdowntimer); //counts down 3 $interval(function(){ $scope.countdowntimer = $scope.countdowntimer - 1; console.log($scope.countdowntimer); }, 1000, 3) //takes picture , adds canvas .then(function(){ canvas.getcontext('2d').drawimage(video, dx[i], dy[i], picwidth, picheight); }) } if don't care printing countdown may can try this. //counts down 3 before each picture , adds each picture canvas for(i = 0; <= 4; i++){ ...

c++ - C++11: conditional compilation: members -

i'm trying make struct conditional members, means, different members exists specific specializations. but, want classes fastest possible. i've tried in 3 differents ways: way 1: template<typename t, bool with_int = false> struct foo { template<typename... args> foo(args&&... args) : m_t(forward<args>(args)...) {} t m_t; } template<typename t> struct foo<t, true> { template<typename... args> foo(args&&... args) : m_t(forward<args>(args)...), m_id(0) {} t m_t; int m_id; }; disadventage: repeated code each specialization. way 2: template<typename t, bool with_int = false> struct foo { template<typename... args> foo(args&&... args) : m_t(forward<args>(args)...) {} virtual ~foo() {} t m_t; } template<typename t> struct foo<t, false> : public foo<t> { using foo<t>:...

javascript - How to get checkboxes to initialize based on model? -

Image
i writing first non-tutorial angular.js web app. using 2 smart-tables , checklist-model. here first 1 uses st-safe-src of all_types array of json objects ... [ { "_id": "56417a9603aba26400fcdb6a", "type": "beer", "__v": 0 }, { "_id": "56456140cb5c3e8f004f4c49", "type": "skiing", "__v": 0 }, ... here html table use display data: <table st-table="displayedcollection" st-safe-src="all_types" class="table table-striped"> <thead> <tr> <th st-sort="type">types</th> </tr> </thead> <tbody> <tr ng-repeat="x in displayedcollection"> <td><input type="checkbox" checklist-model="vendor.types" checklist-value="x.type">{{x.type}}</td...

Setting local variable of a global function via kwargs in Python -

not being able overload functions in python brought me *args , **kwargs pass undefined amounts of arguments , variable definitions called function. tried apply concept simple function prints arguments screen using seperator (and without nasty "" around while). can find code snippet @ end of post. my problem don't know correct way assign values of kwargs respective parameters outside classes. if want use setattr takes in 3 arguments ( setatt(self, key, value) ) will, of course, give me error when try pass key , value. there proper way assign values parameters global functions outside classes? i hope can clear skies me. here not working code example wanna work finding alternative setattr(self, key, value) : import sys def printall(*args, **kwargs): sep = "" key, value in kwargs.items(): setattr(key, value) arg in args: sys.stdout.write(str(arg)) sys.stdout.write(sep) nr = 9876543210 printall("how many...

reactjs - Please explain this abbreviated ES6 JSX declaration -

an example in survivejs handbook in chapter on react , webpack has me confused. in note.jsx : import react 'react'; export default () => <div>learn webpack</div>; this deviates in number of ways appears standard way of declaring react components using jsx: import react 'react'; class note extends react.component { render() { return <div>learn webpack</div>; } } how first example work? how know component called note can referred <note/> in parent component? filename match (removing .jsx part?) where's render() function? , how possible omit it? what limitations of approach? guessing works wrapping simple rendered output, mapping properties html... where style documented? can't seem find official documentation it doesn't, when <note /> looking variable named note in local scope. when component imported file, can name whatever want. e.g. import note './note'; import ...

php - Getting swiftmailer to work -

im new php , trying desperately simple contact form on website work using swiftmailer. have library installed right location, , form opens this: <form action="mailhandler_girls.php" method="post" enctype="multipart/form-data"> then in "mailhandler_girls.php" file have following: <?php $_session["post"] = $_post; $name = $_post["name"]; $email = $_post["email"]; $phone = $_post["phone"]; $dob = $_post['dobday'] ."\t" .$_post['dobmonth'] ."\t" .$_post['dobyear'];$address = $_post['addressline1'] ."\n" .$_post['addressline2'] ."\n" .$_post['postcode'];$experience = $_post["experience"];$height = $_post["height"]; $size = $_post["dresssize"];$bra = $_post["bra"];$waist = $_post["waist"];$hipwidest = $_post["hipwidest"];$bicep = $_post["...

javascript - node JS POST using soap in apigee -

i having trouble in posting using node js in apigee. the response blank []. if push error, error [error: connect einval] i guess can't read soap when call it. used post reference, doesn't seem work. var http = require('http'); var request = require('request'); var async = require('async'); var querystring = require('querystring'); var body = '<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:over="http://oversea.interfaceboss.iptv.sample.com" xmlns:over1="http://oversea.common.iptv.sample.com" xmlns:bean="http://bean.oversea.interfaceboss.iptv.sample.com">'+ '<soapenv:header/>'+ '<soapenv:body>'+ '<over:changeorderinfo>'+ '<over:changeorderinforeq>'+ ' <!--optional:-->'+ '<over1:extensioninfo>'+ ' <!--optional:-->...

ruby on rails - I've overwritten a table in my database (locally), How can I stop this from deploying -

i have table named impressions , (in dev branch) installed impressionist gem has overwritten table. my master branch showing overwritten version , not original. fortunately, haven't deployed, still have data. other exporting data live, creating new table , importing again.. there way can fix this? it's worth saying schema on master branch kept old table columns, when renamed table (in effort stop being overwritten when merge dev branch) renamed table had columns impressionist gem. why this? have schema checked in version control , feel uncomfortable knowing things i'm editing on dev branches having , effect on master branch. rollback database 1 step using below command: rake db:rollback step=1 & exceute below command rails d impressionist

Persisting a DenseMatrix in Apache Spark -

is there recommended/proven efficient format or mechanism persist densematrix in apache spark? or should write file? i generating densematrix post svd operation , need refer , when user queries come in , hence looked often. any appreciated. if densematrix mean org.apache.spark.mllib.linalg.densematrix (v) local data structure , there no spark specific way handle type of objects. one way handle write serialized object directly file: val oos = new java.io.objectoutputstream( new java.io.fileinputstream("/tmp/foo"))) oos.writeobject(svd.v) oos.close() and read later using fileinputstream , objectinputstream.readobject . can use human readable serialization of choice json: import net.liftweb.json.{notypehints, serialization} import net.liftweb.json.serialization.{read, write} implicit val formats = serialization.formats(notypehints) val serialized: string = write(svd.v) // write file , read if needed ... // deserialize val deserialized = read[de...

php - CakePHP shift and reindex associative array -

i have problem. maybe simple solve. there array looking this: (int) 0 => array( (int) 0 => array( 'post' => array( 'name' => 'value' ) ) ), (int) 1 => array( (int) 0 => array( 'post' => array( 'name' => 'value' ) ), (int) 1 => array( 'post' => array( 'name' => 'value' ) ) ) that needs this: (int) 0 => array( 'post' => array( 'name' => 'value' ) ) (int) 1 => array( 'post' => array( 'name' => 'value' ) ) (int) 2 => array( 'post' => array( 'name' => 'value' ) ) i tried array_shift() , directly after that, array_values() , gave me first post. i assume order "0, 0, 1...

php - Notice: Undefined property: WP_Error::$term_id -

hello facing problem . notice: undefined property: wp_error::$term_id search.php on line 53 and here code. if($category_name != "all") { $thiscat = get_category(get_query_var('cat'),false); if(isset($thiscat)){ $catsearchid = $thiscat->term_id; } } else { $catsearchid = '-1'; } any body please? thanks notice: undefined property: wp_error::$term_id search.php on line 53 this error clear, term_id property not part of $thiscat. for solution , do not pass second parameter in get_query_var() function. optional parameter default empty.

php - Wordpress: Comments keep showing on the page -

i have code display posts specific category. works fine problem keeps showing comments section below ever paste shortcode. discussion: allow comments unchecked. please help. thanks. <?php function get_blog_post_category(){ global $post; global $post_id; $content = ""; $content .= '<div class="blog_post_wrap">'; $content .= '<ul class="blog_post_ul">'; $args = array( 'numberposts' => -1, 'category' => 10, 'orderby' => 'date', 'order' => 'asc', 'paged' => $paged ); $posts = get_posts( $args ); foreach( $posts $post ): setup_postdata($post); $content .= '<li class="col-md-3 blog_post_li">'; $content .= '<a href="...

java - How to divide the web page in different segment.? -

hi working in web project. there self designing website mobile device. here want know behalf of can use pixel footer,header.and default height , width mobile device. here sample code there <body> <div id="header"> <h1>books gallery</h1> </div> <div id="footer"> **copyright © 2016* </div> </body> these top-most responsive design css frameworks, provide functionality, built-in: bootstrap foundation materializecss google material design lite also, remember not google. website out if code somehow not working , cannot find solution, or want else @ code , tell solution. gotta research on problem , first. i again state it: not google. search queries these, go google.com read media queries here: using media queries mdn media queries means, modifying website make usable on different devices. all above listed frameworks you, though.

How to store the images to the app in swift ios? -

@ibaction func btnclicked(){ let alertcontroller = uialertcontroller(title: "choose option", message: "", preferredstyle: .alert) let camerarollaction = uialertaction(title: "camera roll", style: .default) { (action) in self.imagepicker.delegate = self self.imagepicker.sourcetype = uiimagepickercontrollersourcetype.savedphotosalbum; self.imagepicker.allowsediting = true self.presentviewcontroller(self.imagepicker, animated: true, completion: nil) } alertcontroller.addaction(camerarollaction) let takepictureaction = uialertaction(title: "take picture", style: .default) { (action) in self.imagepicker.delegate = self self.imagepicker.allowsediting = true self.imagepicker.sourcetype = uiimagepickercontrollersourcetype.camera self.imagepicker.cameracapturemode = .photo self.imagepicker.modalpresentationstyle = .fullscreen self.presentviewco...

angularjs - Check in every controller, can it be converted in reusable module? -

i working on angular app has around 3-4 controllers. on each controller need check several things authentication / compatible browsers , redirect error controller. right now, have code block @ start of every controller.. i have ui router in place.. code block @ start of every controller. help me best possible way make code modular.. if (is.ios() || is.windowsphone()) { $scope.errorlog = { 'message': 'this app not compatible browser using', 'time': new date() }; $state.go('error', { errorlog: $scope.errorlog }); return; } assuming is service or factory. mentioned use ui router makes task pretty easy. .state('onlyandroidandwindows', { url: '/hateiphone', platforms: ['android', 'windows'] //add state platform needs checked }); then @ run stage insert route change listene...

javascript - Website jquery click not work on iphone -

i trigger click event when clicking on button using jquery(".classname").click() , not working using safari on iphone. example: jquery(".button1").click(function(){ jquery(".button2").click(); }) try use .trigger() method. jquery(".button1").click(function(){ jquery(".button2").trigger("click"); })

parse.com - Parse: How to share a relation between two Parse objects? -

i have parse object community has relation people list of people ( user object) in community. i've parse object role has relation people . want both these people relations identical, whenever add/remove user to people relation in community automatically added/removed people relation in role .

javascript - Don't allow the div to block parent events -

i've elments that, on dispatching mouseenter, creates div cover selected element using div borders. something this: function attachselectorbarto(el){ var bar = $('#editor-selection-bar'); bar.css({ top:el.offset().top, left:el.offset().left width:el.outerwidth(), height:el.outerheight() }).show(); } $(function(){ $('[editordata]').mouseenter(function(event){ event.stoppropagation(); attachselectorbarto($(this)); }).mouseleave(function(){ //hideselectorbar(); }); }); but, selector div on absolute position , z-index greather other ones. so, when try select elment, under ones don't mouseneter events of course. qyestion is: there method selector div not block other elemnts events ? nevermind! found css property! pointer-events:none;

java - Is instantiating non final static variables Thread-Safe? -

is 2 class same? public class singletone { // yes bug if change class way // private static singletone instance = new singletone(); // , empty constructor? private static singletone instance; private singletone() { instance = new singletone(); } public static singletone getinstance(){ return instance; } } and public class singletone { private final static singletone instance = new singletone(); private singletone() { } public static singletone getinstance(){ return instance; } } is there thread-safety issue in none final variable instantiated constructor? question 2: what differences between private final static singletone instance = new singletone(); private singletone() { } and this: private final static singletone instance; private singletone() { instance = new singletone(); } queston 1 your first example doesnt work. as if make ca...

pyqt4 - importing a python function from a file in other directory which depends on another file -

this directory structure -directory1 |-currentlywritingcode -directory2 |-__init__.py |-helper.py |-view.ui the helper.py ui pyqt4 framework. needs view.ui file . has following code load ui data viewbase, viewform = uic.loaduitype("view.ui") now in directory1 in writing code did this import directory2.helper when run code in currentlywritingcode throwing error filenotfounderror: [errno 2] no such file or directory: 'view.ui' what now? using python3.5 anaconda on centos 7 use os.path.join(os.path.dirname(os.path.realpath(__file__)),'view.ui') in place of view.ui . ensure correctly reference folder python file lives in, regardless of code imports it. note: make sure have import os other imports. how work? __file__ attribute of module importing. contains path module file. see this answer . however, path not absolute path. os.path.realpath returns absolute path (it follows symlinks if there any). @ point have full...

javascript - jsPDF plugin not working in firefox: images showing black box -

i trying use jspdf plugin git generate pdf of part of application. link pdf plugin: https://github.com/mrrio/jspdf doing 1) generating combinations of text , images of parts of application using svg , canvas (jpeg format) 2) adding images pdf 3) likewise : var doc = new jspdf(); doc.setfontsize(40); doc.text(35, 25, "paranyan loves jspdf"); doc.addimage(imgdata, 'jpeg', 15, 40, 180, 160); 4) not able pdf images on it, displaying text , showing black box in place of image (cannot paste code here) tried changing image format png, shows white box instead of black box. update cleaning svg solution problem. not able how clean svg solution add tag create svg element in code. firefox not understand svg element being created until externally specify tag. var svg = '<svg>' + chartarea.innerhtml + '</svg>'; update add viewport, , viewbox attributes svg render svg on ff correctly. **p.s. : for no reason, admins banned a...

c - Why __lib_start_main appear in array of string -

following code , example strok #include "stdio.h" #include "string.h" #include "stdlib.h" #define number_of_strings 10 int main(){ char str[] = " select cid acn acn=:c1 , acctname=:c2#/rows=30/using=(c1=70,c2='od100s')"; char *strs[number_of_strings]; int = 0; (char *p = strtok(str," "); p != null; p = strtok(null, " ")) { if(i < number_of_strings){ strs[i] = malloc(strlen(p)+1); strcpy(strs[i], p); i++; } else { break; } } for(i = 0 ; < number_of_strings ; i++){ if(strs[i] != null) printf("%s\n",strs[i]); } return 0; } when print array of strs , [root@prf01 /]# ./test select cid acn acn=:c1 , acctname=:c2#/rows=30/using=(c1=70,c2='od100s') __libc_start_main i have no idea why "__libc_start_main" string store in array please me clear ,thanks ! you read...

ecmascript 6 - ES6 Generator functions cause error: Uncaught ReferenceError: regeneratorRuntime is not defined -

if put generator function like function* somewords() { yield "hello"; yield "world"; } (var word of somewords()) { alert(word); } in app.js, code produces uncaught reference error. if run same code within script tag in app.html.eex, runs fine. the code in app.html.eex not passed through babel. if using browser supports generators work. since app.js code transpiled babel, need use https://babeljs.io/docs/usage/polyfill/ generators work. app.js import "phoenix_html" import "babel-polyfill" function* somewords() { yield "hello"; yield "world"; } (var word of somewords()) { alert(word); } brunch_config.js exports.config = { files: { javascripts: { jointo: "js/app.js" }, stylesheets: { jointo: "css/app.css" }, templates: { jointo: "js/app.js" } }, conventions: { assets: /^(web\/static\/assets)/ }, ...

php - File or directory not found error on apache 1.3 but works on apache 2.x -

so there problem, have hardware devices running apache servers, older run 1.3 , newer ones run 2.x. updating html/php stuff , using relative paths in our includes include_once("../stuff/other_file.php") this works fine on 2.x apache servers on 1.3 server returns file not found errors(even tho file exists), tried setting include_path root directory still didnt work. what did work setting include_once this include_once($_server['document_root']."/stuff/other_file.php"); which works fine on both, problem there lot of files includes on system take days go through , fix this. so why doesnt work under apache 1.3? there can issue httpd , module path correctly defined apache2.x not apache1.x. use httpd-switcher install 1.x scratch. should resolved issue. for more information use below command httpd-switcher -h

Get removed item's key from child_removed firebase event -

is possible retrieve key of removed child's key in firbase's on('child_removed') callback function? from firebase documentation on('value' : this event triggered once every time child removed. datasnapshot passed callback old data child removed. firebaseref.on('child_removed', function(oldchildsnapshot) { console.log('child '+oldchildsnapshot.key()+' removed'); });

c - find all the possible combination of coins, implementing by recursion -

solve problem recursion: using 3 type coins include 1 yuan, 2 yuan , 5 yuan, plus 10 yuan, how many combinations? the following code : int coinnum(int num){ if(num>=0){ if(num==0) return 1; else return coinnum(num-5)+coinnum(num-2)+coinnum(num-1); }else return 0; } int main(){ int num=coinnum(10); printf("%d\n",num);//the result 128 system("pause"); return 0; } what's error of recursion algorithm or what's right code ? question supplement : 1. (5,2,2,1) , (2,5,2,1) should counted 1 combination . 2. following code of enumeration algorithm . void coin(){ int i,j,k,count=0; for(i=0;i<=10;i++) for(j=0;j<=5;j++) for(k=0;k<=2;k++) if((i+2*j+5*k)==10){ count++; printf("one yuan :%d,2 yuan :%d,5 yuan :%d\n",i,j,k); } printf("总方法数%d\n",count);//the result 10 } your code co...

asp.net - How to Change RadioButton State from code behind -

i have radiobutton declared in page below : <asp:radiobutton id="radiosalesmanager" runat="server" groupname="radiosales" /> <asp:radiobutton id="radiosalesuser" runat="server" groupname="radiosales"/> in code behind based on value of dropdown want change state of radiobutton protected void radiobuttonlist1_selectedindexchanged(object sender, eventargs e) { strrole = ((radiobuttonlist)createuserwizard1.createuserstep.contenttemplatecontainer.findcontrol("radiobuttonlist1")).selectedvalue; if (strrole.contains("administrator")) { ((dropdownlist)createuserwizard1.createuserstep.contenttemplatecontainer.findcontrol("drpgrplist")).selectedvalue = strrole.trim(); ((dropdownlist)createuserwizard1.createuserstep.contenttemplatecontainer.findcontrol("drpgrplist")).enabled = false; ((system.web.ui.htmlcon...

javascript - How to invoke the adapter(SQL or HTTP) call for every few seconds in IBM MobileFirstPlatform -

in application(using jquerymobile) invoking sql adapter call getting data enterprise database , storing in jsonstore in mobile app, need update real time data automatically in jsonstore whenever enterprise db updated, without disturbing mobile ui(means not showing jsonstore refreshing). please give me suggestions on this. if feature available in mfp, suggest sample or tutorial in ibmkc. in advance. this not related mobilefirst. it sound want implement setinterval . see usage examples here: http://www.sitepoint.com/setinterval-example/ simply call whichever function have sync jsonstore , don't in callbacks interfere application's ui.

Meteor Users collection vs additional collection -

Image
i'n trying figure out, what's best practice building collections associated user's data.(in terms of reactive, queries speed, or other.) example, what's better? meteor.users.profile: {friends, likes, previous orders, locations, favorites, etc"}. or create additional collection keep data, example: meteor.userinfo.user{friends, locations, previous orders, etc"). thanks. meteor share | improve question asked jan 21 '16 @ 8:33 avi a 93 1 8 closed broad paul stenne , tushar , mogsdad , paul roub , jal jan 28 '16 @ 23:06 please edit question limit specific problem enough detail identify adequate answer. avoid asking multiple distinct questions ...