Posts

Showing posts from April, 2015

c++ - Substitute fully instantiated classes with partially instantiated ancestor classes -

i want accepted_dense_vector<??>::value return 'true' when give template parameters in form: c<t> when c uvector , dynamic_array , t std::is_arithmetic . std::array<t,s> when t std::is_arithmetic . container_reference<c> when accepted_dense_vector<c>::value 'true'. all works fine, in derived, instantiated classes a, c, d, want remove workaround parent definition. how can this? #include <iostream> #include <array> using namespace std; // definition of used types. template<typename t> struct dynamic_array {}; template<typename t> struct uvector {}; struct : public uvector<double> { typedef uvector<double> parent; }; struct c : public { typedef parent; }; struct d : public std::array<double,5> { typedef std::array<double,5> parent; }; template<typename t> struct b : public uvector<t> { typedef uvector<t> parent; }; template<typename t> struct co

apache spark - How many RDDs does DStream generate for a batch interval? -

does 1 batch interval of data generate one , one rdd in dstream regardless of how big quantity of data? yes, there 1 rdd per batch interval, produced @ every batch interval independent of number of records (that included in rdd -- there 0 records inside). if there wasn't, , rdd creation conditioned on number of elements, wouldn't have synchronous (micro-batching) streaming, rather form of asynchronous processing.

python - Pass choices from views to form -

i use form bannerform create new banner object trough add_banner views (and template). use class options definite affiliation objects permit in form bannerform ( affiliation field). i'm trying pass choices views form give me valueerror: many values unpack (expected 2) my code worked when new_affiliation foreignkey need more values. think must definite 'choices' in views or have problem on first migration (it appear call database tables models.py not views.py , if put options.objects.get(id=1) on models.py give error because tables don't exist yet). my form.py : from django import forms core.models import options, banner, affiliation #somethings other class bannerform(forms.modelform): name = forms.charfield(max_length=32) affiliation = forms.choicefield('choices') #affiliation = forms.modelchoicefield('choices') #same error class meta: model = banner exclude = (#some fields) my models.py : from

ios - UIImageView not loading image on all devices -

this first time posting questions here. far have been able find solution issues have had. 2 weeks i'm struggling strange issue. issue description: i'm developing universal application ios 5+. i'm having issue 1 image, not displayed everywhere. background image , displays correctly on iphones (3gs, 4, 4s, 5) , ipad retina. unfortunately there 3 screens on doesn't displays. happens on ipad without retina display. images appears on other screens , can't determine different doesn't display on these 3 screens. what have tested: i have tried delete image , add again - nothing changes. have double checked naming of file - fine. have tried load image in view controller , loads. have cleaned application , deleted devices - issue stays. if happen have suggestions on can cause of strange behavior please give me hint. ok, since image in project , target, here's couple of other reasons cause issue the file extension , type of file don't matc

asp.net mvc - When pushlishing MVC project to server, bootstrap.css edits don't migrate -

i have mvc project built in visual studio 2013 , when publish project windows server 2012, changes made in bootstrap.css file don't migrate. know file because changes made site.css file appear on server. else works except 1 bootstrap.css file. i don't want have pull out changes in bootstrap.css, take lot of searching. problem common? has heard issue? i had idea take code bootstrap.css file , minify manually, copy boostrap.min.css file. after doing that, published project server , working expected.

sql - derived columns in sybase -

i writing query define view on sybase database . consider following example select a, (b+c+d-e) derived_1, (b+c+d-e)+2 derived_2, (b+c+d-e)+4 derived_3 tablename you can see calculate value using logic(b+c+d-e), apply more logic , return values different derived columns. there way can write (b+c+d-e) once ? something select a, (b+c+d-e) derived_1, derived_1+2 derived_2, derived_1+4 derived_3 tablename wrap calculation in subquery, select a, derived_1 + 2 derived_2, derived_1 + 4 derived_3 ( select a, (b+c+d-e) derived_1 tablename ) x

rich text editor - wiris plugin with tinymce working on localhost, but not online -

i have embedded wiris plugin tinymce editor. on clicking "tiny_mce_wiris_formulaeditor" button of wiris in tool bar, formula editor window opening in local-host not online, have hosted site. please tell solution. by default wiris plugin uses wiris editor services hosted @ our servers in www.wiris.net. please check server can connect our servers. additionaly, if have proxy/firewall in server need include configuration details in plugin's configuration.ini file ( http://www.wiris.com/plugins/docs/resources/configuration-table ) uncommenting , setting wirisproxy* variables. please check wiris plugin test pages too: http://www.wiris.com/plugins/docs/resources/test

Loading QML Elements to ListView from database -

i'm writing app n9 , have database problem. i'm not using main.cpp or other c++ file app. create,delete,add etc. data database using javscript within qml. right i'm putting out string entries. works fine. want show entries in database listview. how can that? you can create model listview dynamically. these: import qtquick 2.0 import "main.js" main rectangle { id: root listview { width: 180; height: 200 model: main.createmodel(root) delegate: text { text: name + ": " + number } } } and main.js function createmodel(parent) { var s = 'import qtquick 2.0; listmodel {\n'; var data = ["a", "b"]; // data database here for(var x in data) { var s2 = "listelement {name: \"" + x+ "\"; number: \"" + x + "\" }\n"; s += s2; } s += "}\n"; console.log(s);

callback - Node.js. Confused with non-blocking approach -

ok, seems it's hard me start thinking.. um.. functional way.. or asynchronous way. i rather new node.js, have many years of experience in c#, java, c++.. image have simple task. idea of task each line should executed after previous line finishes (blocking operations). normal approach in, let me say, c#. also, (that reason of post) let's imagine have 1 conditional line in our code. pseudocode following: f = openfile("aaa.txt") if f.readline(1) == "bbb" // read first line line = f.readline(2) // read second line else line = readline(3) // read third line database.insert(line) // store line in database, lets in mysql deletefile(f) pretty simple. now, understand, node.js uses non-blocking approach adding callbacks each function. so, simple task seems become nightmare me. if try reproduce code above, this: openfile(f, function() { readline(f, 1, function(line) { if line == "bbb" { readline(f,2, funct

javascript - Stopping AngularJS from not executing HTML tags -

so wondering how compute html in angularjs object (like this: {{names}} ) have '<a>' element inside object. it comes out this: <a href="http://www.example.com">link text</a> i want this: link text want links in this page ones. im pretty sure answer looking can found here ng-href allow use {{}} syntax dynamically generate url angular controller.

javascript - Replace string everywhere except if its within quotes -

i replace :) :d , except if within quotes " example 1: hey man :d, how're you? :) friend told me "this can't true :)" becomes hey man :d, how're you? :d friend told me "this can't true :)" as see, :) not replaced if it's enclosed " . if condition wouldn't there, quite simple, right? using javascript (jquery) this. if not plainly possible regex, alternate suggestion? assuming no double quote unbalanced, regex should work you: :\)(?=(?:(?:[^"]*"){2})*[^"]*$) explanation: regex using positive lookahead matching 0 or more occurrences of pair of some text until double quote found i.e. ([^"]*"){2} on right hand side (rhs) of every match of :) . which in simple term means replace :) if outside double quotes since matches inside double quotes have odd number of [^"]*" matches on rhs. live demo: 1. http://www.rubular.com/r/3aixzy5byr live demo: 2. http://ideone.com

How to edit default dark theme for Visual Studio Code? -

i'm using windows 7 64-bit. is there way edit default dark theme in visual studio code? in %userprofile%.vscode folder there themes extensions, while in installation path (i used default, c:\program files (x86)\microsoft vs code) there files of standard themes in \resources\app\extensions, kimbie dark, solarized dark/light or variants of monokai, there no default dark theme. but if after there possibility edit it, blocks of code responsible colour of member of object, member of pointer , name of class , structure in c++ language? the file looking at, microsoft vs code\resources\app\extensions\theme-defaults\themes on windows , search file name dark_vs.json locate on other system.

adding '+' to all the numbers as a prefix (numbers are stored in a csv file) using a python script -

goal all numbers in csv file exported hotmail stored 91123456789 whereas complete call need dial +91123456789 . these contacts converted batch of vcf files , exported phone. want add + contacts @ beginning. approach write python script can indefinite number of contacts. pre-conditions none of numbers in csv file have + in them. problem (a) there posibility number may have 91 in like: +919658912365 . makes adding plus difficult. explanation:i adding problem, if 91 there @ beginning of number can add simple checking 2 consecutive digits , if match 91 can add + else don't need add + , can move on next pair of digits. (b) fields seprated comma's. want add + prefix in front of field has header mobile , not in other field set of digits 91 may appear(like in landline numbers or fax numbers) research i tried excel, process take unreasonable amount of time(like 2 hours!) specs i have 400 contacts. windows xp sp 3 please me solve problem.

javascript - Hammer JS undefined -

i trying use yepnope modernizr , hammer.js detect , trigger touch events slider. code. have 2 errors in console , don't manage debug. plus don't understand < error comes from. if remove following bit of code, both errors disappear. any clue? var slider = $('#featured'); yepnope({ test: modernizr.touch, yep: [ "/assets/javascripts/jquery.hammer.js", "/assets/javascripts/hammer.js"], nope: [''], complete: function () { slider.hammer({drag: false}).bind("swipe", function (ev) { if(ev.direction === 'left'){ slider.trigger("orbit.next"); } else if(ev.direction === 'right'){ slider.trigger("orbit.prev"); } }); } }); i have following errors in console. syntaxerror: unexpected token '<' typeerror: 'undefined' not function (evaluating 'slider.hammer({drag: false})') check these 2 u

google chrome extension - Post-processing a page using javascript -

is possible ? <script type="text/javascript"> $(document).ready(function () { window.location = "http://example.com"; settimeout("", 10000); $("#some_div_element").empty(); }) </script> i trying setup page redirects url , post processing on redirected page. know there chrome/firefox extensions runs javascript after page loaded. wanted know if achieve same result using webserver did think passing params via target page , on page actions according params ?

java - Is there a non-proprietary equivalent to FontUtilities.getCompositeFontUIResource(Font)? -

Image
if create font using new font("arial", font.plain, 10) , later, when try display missing glyphs in font, familiar squares indicating missing glyphs. a long time ago, found workaround - pass font fontutilities.getcompositefontuiresource(font) , font handles fallback characters aren't in font itself. problem is, utility in sun.font , , eliminate compiler warning. given many years have passed in meantime, there proper way this? demo: import java.awt.font; import java.awt.gridlayout; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.swingutilities; import sun.font.fontutilities; public class testfonts implements runnable { @override public void run() { font font = new font("arial", font.plain, 20); jlabel label1 = new jlabel("before \u30c6\u30b9\u30c8"); label1.setfont(font); jlabel label2 = new jlabel("after \u30c6\u30b9\u30c8"); label2.setfont(fontut

C++: Can you return values of 0 or 1 as false and true in boolean functions? -

this question has answer here: when c++ return true / false if data type integer or double value 2 answers can c++ bool functions return 0 false , 1 true so: bool foo() { return 1; } bool foobar = foo(); ? yes, because 0 implicitly converted false , 1 (or other nonzero value) implicitly converted true . not legal idea, however.

c++ - std::map of string and regex -

i'm working on c++ project small language implemented. in fact, main consists on kind of "pseudo-instructions" use preprocessor translate them valid c++ code. project assignment course , code in main has in format. this part of line in main.cpp: program_start regex(name): start text(a) text(b) end //text(a) text(b) gives string "ab" . . //more regex definitions here . . program_end and on .h file have: std::map<std::string, std::regex> regex_map; std::string regex_name; #define program_begin int main(){ #define program_end return 0;} #define regex(name) \ std::regex name; \ regex_map[#name] = name; \ //exception here (1) ? (regex_name = #name) \ #define start (regex_name = ""); \ #define end \ regex_map.find(regex_name)->second.assign(currstr,std::regex::ecmascript); \ #define text(a) getregex(#a); ... i want create map containing regex , string representing regex's name string value of regex isn't know

android - OnClick() on buttons not working after I do something and return back to button's activity -

i have debugged , found flow of control never reaches onclick() method in main activity after come activity launched main activity. suspecting gotta 'paused' or 'resumed' state. in other words, main activity a. , activity launched b. so, launch , work on b. , when return (using hardware button 'back') onclick function doesnt seem called. for privacy purpose have removed code displayed below give error if compiled, in actual code activity b , listviews call run fine . please help! :) my code: import java.io.serializable; import java.util.arraylist; import org.json.jsonobject; import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; public class main extends activity implements serializable, onclicklistener { // fetch data in form of string url public string internetdata;

c# - ConcurrentDictionary AddOrUpdate a list -

i'm trying use concurrentdictionary filtering task. if number appears in list, want copy entry 1 dictionary another. but part of addorupdate not right - v.add(number) i "cannot implicitly convert type 'void' 'system.collections.generic.list' and 2 more errors. class program { static void main(string[] args) { program p = new program(); list<int> filter = new list<int> {1,2}; p.filter(filter); } private void filter(list<int> filter) { dictionary<string, list<int>> unfilteredresults = new dictionary<string, list<int>>(); unfilteredresults.add("key1", new list<int> { 1,2,3,4,5}); concurrentdictionary<string, list<int>> filteredresults = new concurrentdictionary<string, list<int>>(); foreach (keyvaluepair<string, list<int>> unfilteredresult in unfilteredresults)

jsf - JBoss is taking a long time to read faces-config on the startup -

the startup of local application (jsf 1.1 on jboss 4.0.5 ga) taking forever (over 9 minutes!). stops while reading faces-config.xml: ==> info [facesconfigurator] reading config /web-inf/faces-config.xml (it gets stuck here) a few days ago working fine. tried revert few changes made faces-config file problem persists. any ideas on can going on or things me troubleshooting? thanks oh, found out problem schema validation. removed following line faces-config.xml , worked: xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd "

PHP DateTime->sub() wont bubble up to days -

if datetime $servertime e.g. 2016-02-03 00:30:00 , subtract 90 minutes this $servertime->sub(new dateinterval("pt1h30m")); the $servertime 2016-02-03 23:00:00 . notice date remains february 3rd. while it's exepcted goes down 1 - should 2016-02-02 23:00:00 . there way achieve this? you doing wrong or modifying along way: $servertime = datetime::createfromformat('y-m-d h:i:s', '2016-02-03 00:30:00'); print_r($servertime); $servertime->sub(new dateinterval("pt1h30m")); print_r($servertime); works fine me: demo .

Ubuntu spyder sys.prefix which python? -

i using ubuntu 15.10 , have installed spyder after having installed anaconda. have pip installed packages import fine in command line, in spyder console not found. when sys.prefix on command line get: '/home/rick/anaconda2' and in spyder console get: '/usr' command line: rick@rick-laptop:~$ -a python /home/rick/anaconda2/bin/python /usr/bin/python shouldn't these same? or kept different allow multiple envs? i'm kind of new python , understand fix here. thanks simple solution, removing second version of spyder installed did trick! thought needed installed separately

r - Making contingency table -

Image
i'm having trouble contingency table. i want convert kind of table: dat <- read.csv(text="gatunek,obecnosc,lokalizacja,frekwencja koń dziki,tak,polska,11 koń dziki,nie,polska,14 koń dziki,tak,kujawy,39 koń dziki,nie,kujawy,31",header=true) # gatunek obecnosc lokalizacja frekwencja #koń dziki tak polska 11 #koń dziki nie polska 14 #koń dziki tak kujawy 39 #koń dziki nie kujawy 31 to this: don't afraid, it's polish language. moment have table this: xtabs should trick: x <- data.frame(a = c(1, 2, 1, 2), b = c("a", "a", "b", "b"), c = c(11, 14, 39, 31)) xtabs(c ~ + b, data = x) # b #a b # 1 11 39 # 2 14 31

php - Server Setup: How to get emails working -

this question has answer here: how send email using php? 9 answers i have vps running on ubuntu 14.04. apache, mysql , php installed , working fine. the server used host website, has contact form. contact form getting variables users such email, subject , body (using post). message processed using php's standard mail() function. well, working fine on old hosting provider, not anymore in "self-made" server. i tried configuring sendmail , adding path php.ini, whithout success. i've tried using library phpmailer hoping use external smtp server without having configure local one. works fine (phpmailer great), long sender same identity user authenticated smtp server... never going happen such form sender different. something apparently easy becoming headache now. question is... how form work, without having setup local mail server , without ha

c++ - cv::flann::index::knnsearch values of indices and dists -

ok given following code index.knnsearch(mat,indices,dists,3); (int = 0; < indices.rows; i++ ) { indices.at<int>(i,0) // index of match indices.at<int>(i,1) // ????? this? indices.at<int>(i,2) // , this? } also dists, do 3 values in each row? how make useful ratio or percentage match? in indices need know how many descriptors out of 500 matched, i'm sure data shows somehow, don't understand it. please help suppose call:- knnsearch(mat,indices,dists,n); note - n value passed caller. on return, " indices " refer array having "n" closest neighbours found algorithm. " dists " refers distance of same indices. so, in case mentioned in question, n=3 , , 3 closest neighbours returned along distances. how use it upto use-case.

jquery - How to keep variable's value using localstorage? -

for example have draggable here , once if statement true store 1 in winner variable. after refreshing page or going page still keep value because i'm planning call variable again. how keep variable's value in local storage? set variable local storage : //you store key ie. "winner" , value (your variable) localstorage.setitem("winner", winner) //then value winner = localstorage.getitem("winner")

javascript - Why does my child function require a 'return' statement to avoid erroring out? The parent function has no 'return' and no error -

var = function(param1) { var b = function(param2) { console.log(param1 + param2); }; return b; }; a(4)(5); // logs "9" is return statement (in case "return b") necessary? why need 1 function here, not other? when necessary, , why? the expression a(4)(5) first calls function a parameter 4 ( a(4) ), returns b (which function). returned function called parameter 5 . same if did c = a(4); c(5); so, need outer function a return function - because treat it's result function. , don't care if inner function b returns don't use result, doesn't matter if returns anything.

php - How to input a value from a drop down list into an SQL statement -

i obtain value selected drop down box. has entries database using jquery. i add value drop down box sql statement query. i tried using submit button work struggled. any appreciated. here option box: <select id="combobox"> <?php echo '<option class="option">type/select room</option>'; while ($row = $res->fetchrow()) { $code = $row['roomcode']; $titles[] = $row['park']; echo '<option class="option" name="codedrop">'.$code.'</option>'; here sql statement trying add data into: $resql = "select * 'rooms' 'roomcode' '$code%'"; $res1 = mysql_query($resql); html 0) add form tags aroun

node.js - Converting a shell script to javascript using node js -

i have following shell script created modify plist of facebook plugin cordova applications. #!/bin/bash # put in /hooks/after_prepare/ plist=platforms/ios/*/*-info.plist cat << eof | add :nsapptransportsecurity dict add :nsapptransportsecurity:nsallowsarbitraryloads bool yes add :nsapptransportsecurity:nsexceptiondomains:facebook.com:nsincludessubdomains bool yes add :nsapptransportsecurity:nsexceptiondomains:facebook.com:nsthirdpartyexceptionrequiresforwardsecrecy bool no add :nsapptransportsecurity:nsexceptiondomains:fbcdn.net:nsincludessubdomains b

javascript - In vanilla JS, how can I add or remove a class from an element based on whether the scroll is at the top? -

i'm trying make sticky nav have particular class when not scrolled @ top, , not have class when scrolled @ top. sorry if that's confusing. what i'm stuck on right fact in bottom piece of code doc.scrolltop == 0 evaluating true whenever scroll mouse. doing wrong? htmlelement.prototype.removeclass = function(remove) { var newclassname = ""; var i; var classes = this.classname.split(" "); for(i = 0; < classes.length; i++) { if(classes[i] !== remove) { newclassname += classes[i] + " "; } } this.classname = newclassname; } window.onscroll = function() { var body = document.body; //ie 'quirks' var doc = document.documentelement; //ie doctype doc = (doc.clientheight) ? doc : body; if ( doc.scrolltop == 0 ) { document.getelementbyid('top').removeclass('scrolling');

android - google map getting current position and draw path -

how current position in android , draw path or line between current position , location touched. to know current location require latitude , longitude of current loacation. public void getlatilongi() { locationmanager lm = (locationmanager) getsystemservice(context.location_service); location location = lm.getlastknownlocation(locationmanager.gps_provider); if (location != null) { flati = location.getlatitude(); flongi = location.getlongitude(); system.out.println("hello....................+lati+longi"); } } @override protected void onstart() { super.onstart(); locationmanager locationmanager = (locationmanager) getsystemservice(context.location_service); final boolean gpsenabled = locationmanager.isproviderenabled(locationmanager.gps_provider); if (!gpsenabled) { gpsalert(); } } public v

Process States in Operating System -

are there situations process can directly go blocked running(skipping ready) or ready blocked(skipping running)? i think, in single tasking system 1 process runs @ time, process can directly go blocked running state because has ready state when there other process using cpu @ moment. but not sure other situation (ready blocked).

Apache Hadoop and Eclipse integration -

i trying integrate hadoop eclipse. followed instructions here . however, when attempt run eclipse project following output: 13/04/01 14:55:11 warn util.nativecodeloader: unable load native-hadoop library platform... using builtin-java classes applicable 13/04/01 14:55:11 warn mapred.jobclient: no job jar file set. user classes may not found. see jobconf(class) or jobconf#setjar(string). 13/04/01 14:55:11 info input.fileinputformat: total input paths process : 1 13/04/01 14:55:11 warn snappy.loadsnappy: snappy native library not loaded 13/04/01 14:55:11 info mapred.jobclient: running job: job_local_0001 13/04/01 14:55:11 info util.processtree: setsid exited exit code 0 13/04/01 14:55:11 info mapred.task: using resourcecalculatorplugin : org.apache.hadoop.util.linuxresourcecalculatorplugin@6ea920ad 13/04/01 14:55:11 info mapred.maptask: io.sort.mb = 100 13/04/01 14:55:11 info mapred.maptask: data buffer = 79691776/99614720 13/04/01 14:55:11 info mapred.maptask: record buffer = 2

python - Finding Date difference in list of dates [Pandas] -

Image
assuming following dataset has sorted list of dates: dates=pd.dataframe(data={'client':['1','2'], 'date':[['2012-3-10','2012-3-11','2012-3-12','2012-3-13','2012-3-14'], ['2012-3-12','2012-3-13','2012-3-16','2012-3-23']]}) i want find average date difference in terms of days so, eg, client '2' , average timelag 2.75 starting with: client date 0 1 [2012-3-10, 2012-3-11, 2012-3-12, 2012-3-13, 2... 1 2 [2012-3-12, 2012-3-13, 2012-3-16, 2012-3-23] you could dates.groupby('client')['date'].apply(lambda x: [i / np.timedelta64(1, 'd') in np.diff([pd.to_datetime(c) c in x])[0]]) to timedelta in days : client 1 [1.0, 1.0, 1.0, 1.0] 2 [1.0, 3.0, 7.0] or dates.groupby('client')['date&#

Python: How do I compare all items in one list as a string to all items in another list? -

for each_word1 in list_a: ###compare values to...### each_word2 in list_b: if each_word2 in list_b == any_word in list_a: add each_word2 list_c ###something that### python have figure of set s ideal situation this. these data structures excel in fast comparison of containment, , has same primitive operations have in basic math in first school grades. just convert 1 of lists set (this remove duplcates if any), , use intersection operation. convert result list if need: list_c = list(set(list_a).intersection(list_b))

swift - Add custom cell to only one case of Segmented Controller -

i have question adding additional custom cell 1 case segmented controller. want add "add item" action cell tableview on case 3 segmented controller. know how implement or can find resource (besides apple documentation) see how this. thanks! import uikit class viewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet weak var mysegmentedcontrol: uisegmentedcontrol! @iboutlet weak var mytableview: uitableview! let globallist: [string] = ["global item 1","global item 2", "global item 3"] let friendslist: [string] = ["friend 1", "friend 2", "friend 3"] let melist: [string] = ["milan, italy", "rome, italy", "napoli, italy", "paris, france"] let addbutton: [string] = ["+ add item"] override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarni

oop - Why can't I overload a function by its return type? -

this question has answer here: function overloading return type? 11 answers why can't function not overloaded return types, there should no language support such overloading. want know reason happening if allow, or why not allowing such function overloading return type. int func(); bool func(); int main() { int iret = func(); bool bret = func(); } always arise quetion in mind. hoping satisfied answer. a function double function fn1() { int = 2; return a; } in above e.g. implicitly converted double when returned. int function fn1() { double = 2; return a; } in above e.g. implicitly converted int when returned. a fn call fn int = fn1(); or double = fn1(); . in either case both definitions can cause ambiguity called. fact returned values stored in int or double doesn't make difference in determining fn called. functio

ruby - Method to front capitalized words -

i trying move capitalized words front of sentence. expect this: capsort(["a", "this", "test.", "is"]) #=> ["this", "is", "a", "test."] capsort(["to", "return", "i" , "something", "want", "it", "like", "this."]) #=> ["i", "want", "it", "to", "return", "something", "like", "this."] the key maintaining word order. i feel i'm close. def capsort(words) array_cap = [] array_lowcase = [] words.each { |x| x.start_with? ~/[a-z]/ ? array_cap.push(x) : array_lowcase.push(x) } words= array_cap << array_lowcase end curious see other elegant solutions might be. def capsort(words) words.partition{|s| s =~ /\a[a-z]/}.flatten end capsort(["a", "this", "test.", "is"]) # => [&q

java - Checking object of wrapper class Float is null -

i need check object of wrapper class null.for have written checking statements float a=null; a==null; a.tostring().equals(null) but these wrong.please advice me a == null right way it attempting a.tostring().equals(null) throw nullpointerexception , because can not invoke method (in case tostring() on null object (the equals() never executed)

asp.net mvc 3 - MVC3 C# Disabling the Validation Messages on Cancel -

i have mvc2 c# .net web app. using built in mvc3 validation using domain class properties [required(errormessage = "start required.")] , in html @html.validationmessagefor(model => model.startfrom) however, when submit page using cancel button, validation fired stating "start required" , therefore not exiting page. how can disable validation on cancel button? or submit page without firing validation? i think need override default behaviour of submit button i.e., cancel button in case. say have cancel button this: <input type="submit" id="btncancel" value="cancel"/> now write jquery override default behaviour $(function(){ $('#btncancel').click(function(e){ e.preventdefault(); //or can return false method. //return false; }); });

vb.net - parsing database columns and values to MySQL statement in module -

i'm trying create dynamic mysql insert into...where not exist statement parsing table name, array of columns, array of values , conditional column , value subroutine in separate module keep hitting column count doesn't match value count @ row 1 error. below code: sub insertrecord(byval tbl string, byval cols() string, byval params() string, _ byval colcondition string, byval paramcondition string) 'as string 'create new string of columns dim mycols string = "" each col string in cols mycols &= col & ", " next dim newcols string = mycols.remove(mycols.count - 2, 2) msgbox(newcols) dim scols string = newcols.insert(0, "`").replace(", ", "`, `") & "`" msgbox(scols) 'create new string of parameters dim myparams string = "" each param in params myparams &= param & ", " next

css - Content DIV hidden by footer -

i've noticed when have long text on web page can not see full text when scrolling down max. in example http://jsfiddle.net/grek/yybe5/ looks end of paragraph hidden (behind footer?). how can fix , have text zone (div content-right) stop footer begins? many thanks css: @charset"utf-8"; /* css document */ html, body { padding: 0; margin: 0; height: 100%; font-family: tahoma, geneva, sans-serif; background: rgb(255,255,255); /* old browsers */ /* ie9 svg, needs conditional override of 'filter' 'none' */ background: url(data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiia/pgo8c3znihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyigd2lkdgg9ijewmcuiighlawdodd0imtawjsigdmlld0jved0imcawidegmsigchjlc2vydmvbc3bly3rsyxrpbz0ibm9uzsi+ciagphjhzglhbedyywrpzw50iglkpsjncmfklxvjz2ctz2vuzxjhdgvkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijuwjsigy3k9ijuwjsigcj0inzulij4kicagidxzdg9wig9mznnldd0imcuiihn0b3aty29sb3i9iinmzmzmzmyiihn0b3atb3b

sql server - SQL (TSQL) - Select values in a column where another column is not null? -

i keep simple- know if there way select values in column when never has null in column. example. b ----- ----- 1 7 2 7 null 7 4 9 1 9 2 9 from above set want 9 b , not 7 because 7 has null in a. wrap subquery , use in clause etc. part of pretty unique set , looking keep efficient. i should note purposes one-way comparison... returning values in b , examining a. i imagine there easy way missing, being in thick of things don't see right now. you can this: select * t t.b not in (select b t null); if want distinct b values, can do: select b t group b having sum(case when null 1 else 0 end) = 0; and, finally, use window functions: select a, b (select t.*, sum(case when null 1 else 0 end) on (partition b) nullcnt t ) t nullcnt = 0;

hadoop - How TO Filter by _id in mongodb using pig -

i have mongo documents this: db.activity_days.findone() { "_id" : objectid("54b4ee617acf9ce0440a3185"), "aca" : 0, "ca" : 0, "cbdw" : true, "day" : isodate("2014-12-10t00:00:00z"), "dm" : 0, "fbc" : 0, "go" : 2500, "gs" : [ ], "its" : [ { "_id" : objectid("551ac8d44f9f322e2b055d3a"), "at" : 2000, "atn" : "running", "cas" : 386.514909469507, "dis" : 2.788989730832084, "du" : 1472, "ibr" : false, "ide" : false, "lcs" : false, "pt" : 0, "rpt" : 0, "src" : 1001, "stp" : 0, "tcs" : [ ],

c++ - Locking when accessing shared memory for reading -

if accessing shared memory reading only, check condition if() block, should still lock mutex? e.g. mutex_lock(); if (var /* shared memory */) { } mutex_unlock(); is locking here needed , practice? if variable reading written concurrently, yes, should acquire lock on mutex. you read atomically if compiler provides necessary primitives that; either atomic features come c11 , c++11 or other language extension provided compiler. move mutex acquisition conditional, if wait until after test acquire mutex else may change between time test , time acquire mutex: if (example) { // "example" variable changed here thread. mutex_lock(); // condition might false! mutex_unlock(); } therefore, suggest acquiring mutex before conditional, unless profiling has pinpointed mutex acquisition bottleneck. (and in case tested variable larger cpu register -- 64-bit number on 32-bit cpu, example -- don't have option of delaying mutex acquisition withou

coldfusion - CF ORM: Filter data using composite/FK -

i having difficulty in filtering table tab1 had fk key tab2 (tab1 had many 1 relation tab2) using orm.i wanted filter data in tab1 using fk column. used var items= entityload("tab1",{fk_col_name=value_variable}). now getting error: have attempted dereference scalar variable of type class java.lang.string structure members. let me share solution below if there better alternatives please share. the solution paved way through lot googling usual. seems because entityload() convenience function works against defined properties. entityload(), breedid not property. instead, breed property, being of type breed. around can use hql instead. so ref: http://blog.nictunney.com/2011/02/coldfusion-orm-filtering-on-composite.html

c# - How to create a Project Template without requiring PacMan (or refresh)? -

if create new windows uwp project in visual studio 2015 using out-of-the-box blank template find intellisense works without having build or refresh project. now, create custom project template based on blank template. find new project template creates project fine. however, new project not have intellisense until pacman (the nuget package manager) fetches microsoft.netcore.universalwindowsplatform package cache. after invoke pacman , fetch microsoft.netcore.universalwindowsplatform , new project still not have intellisense. is, until refresh project in solution explorer. @ point, in business. my question. setting in vstemplate.xml enables custom project template create project , work? say, can tell visual studio go ahead , run pacman , refresh project? there 1 requirement scenario. important custom template not have custom project wizard. not viable solution problem. believe can solved configuration, not code. please note, question involves nuget v3, not 2 or 1. do

php - How do I fix these errors for the symfony framework demo? -

i have symfony installed , learning it. should note using ubuntu 15.04 on system. so ran following command create demo: symfony demo then run php app/console server:run which lets me run demo. go given url server. click "browse application". app has errors on place. on page gives me following errors: an exception occured in driver: not find driver 500 internal server error - driverexception 2 linked exceptions: pdoexception » pdoexception » [3/3] driverexception: exception occured in driver: not find driver + logs - 1 error info - matched route "blog_index". info - populated tokenstorage anonymous token. debug - notified event "kernel.request" listener "symfony\component\httpkernel\eventlistener\debughandlerslistener::configure". debug - notified event "kernel.request" listener "symfony\component\httpkernel\eventlistener\profilerlistener::onkernelrequest". debug - notified event "kernel.request&quo