Posts

Basic C programming.. logical error while converting Celsius to kelvin -

this question has answer here: c: converting farenheit celsius 3 answers #include <stdio.h> #include <stdlib.h> int main(void) { int celsius = 0, kelvin = 0; float farenheit; printf("enter boiling of water in celcius \n"); scanf("%d", &celsius); kelvin = 273 + celsius; farenheit = celsius * (9 / 5) + 32; printf("the boiling point of water in kelvin %d \n , in farenheit %f \n \n", kelvin, farenheit); printf("enter freezing point of water in celcius \n"); scanf("%d", &celsius); kelvin = 273 + celsius; farenheit = celsius * (9 / 5) + 32; printf("the freezing point of water in kelvin %d \n , in farenheit %f \n \n", kelvin, farenheit); return 0; } in eclipse, type code , i'm expecting ask me on console "enter boiling of water i...

javascript - How to concatenate (or union) the results of find() from two mongodb collections in Meteor JS? -

how can concatenate (or merge or union) results of find() 2 mongodb collections in meteor js? preferably want join them single cursor object, fetching , converting array acceptable. should use instead of union in following code? note: don't need remove repeated elements. concatenation enough. alllocations: function(){ location_set_1 = tablea.find({'loc':{$exists:1}},{loc:1,limit:300}); location_set_2 = tableb.find({'loc':{$exists:1}},{loc:1,limit:300}); combined_location_set = ??union??(location_set_1,location_set_2) return combined_location_set; } a (n incomplete) solution may following return array. instead need return cursor object "helper" in meteor: a=tablea.find() b=tableb.find() c=_.extend({},a.fetch(),b.fetch()) // c=[].concat(a.fetch()).concat(b.fetch()); return c; something ? alllocations: function(){ var location_set_1 = tablea.find({'loc':{$exists:1}},{loc:1,limit:300}).fetch(); var location_set_...

html - jquery-ui, draggable item : does'nt work when position is absolute -

i'm trying make draggable items contained in position:absolute div. works when dragged on div declared earlier in code, item never appear on [position:absolute] div declared later in code, when setting lower z-index div... here's example $(function(){ $(".myclass").draggable({stack:".bg"}); }(jquery)); <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <div style="position:absolute;background-color:#3ff;width:200px;height:200px;border:1px solid #000;left:0px;top:0px;z-index:10;"> <div class="myclass" style="position:absolute;left:10px;top:10px;width:70px;height:70px;background-color:#0f6;border:1px solid #000;z-index:100;">draggable</div> </div> <div style="position:absolute;backgrou...

d3.js - Shiny R : D3HeatMap triggered after click button - ReactiveEvent or ObserveEvent -

i'd trigger heatmap display after has clicked button. initially, heapmap generated each time interacting wigdet. example, if changed color, heapmap regenerated directly. want first select color , click button generate heapmap picture. don't succeed make works reactiveevent or observeevent. server.r library(shiny) library(d3heatmap) library(shinythemes) require(rcolorbrewer) library(dplyr) shinyserver( function(input, output,session) { output$heatmap<- renderd3heatmap({ loading_effect() infile <-input$file1 if (is.null(input$file1)) return(null) nba_players <- read.csv(infile$datapath, sep=";",row.names=1,na.strings = c("undef")) rownamesfiltered <- grep(paste0("^",input$gene,"-.*$", collapse = null),rownames(nba_players),ignore.case = true,value = true) data_filtered = filter(nba_players, grepl(paste0("^",input$gene, collapse = null),rownames(nba_players) )) row.names(...

java - Error in initialization - Expected ":" at line -

i'm doing item. got error: expected ':' @ line 7 column 11 i'm looking mistake , can't find it. log: [14:05:31] [client thread/error] [fml]: exception loading model utm:item/uraniumingot loader instance, skipping com.google.gson.jsonsyntaxexception: com.google.gson.stream.malformedjsonexception: expected ':' @ line 7 column 11 @ com.google.gson.internal.streams.parse(streams.java:56) ~[streams.class:?] @ com.google.gson.treetypeadapter.read(treetypeadapter.java:54) ~[treetypeadapter.class:?] @ com.google.gson.gson.fromjson(gson.java:803) ~[gson.class:?] @ com.google.gson.gson.fromjson(gson.java:741) ~[gson.class:?] @ net.minecraft.client.renderer.block.model.modelblock.deserialize(modelblock.java:47) ~[modelblock.class:?] @ net.minecraft.client.resources.model.modelbakery.loadmodel(modelbakery.java:269) ~[modelbakery.class:?] @ net.minecraftforge.client.model.modelloader.access$800(modelloader.java:73) ~[modelloader.class:?] @ net.minecraftf...

java - refresh apache camel routes -

i using spring camel standalone application builds many routes depending on returned psql database : private void addendpoint(string urlname, string type, string host, string port, string username, string password) { string endpointurl = string.format("https://%s:%s?username=%s&password=%s", host, port, username, password); from("direct:endpoint_" + urlname) .throttle(1).timeperiodmillis(60000) .to(endpointurl); } and route created in loop depends on returned database this: @override public void configure() throws exception { final list<url> url= dburldao.geturl(); (url urlinfo : urls) { addendpoint(urlinfo.getname(), urlinfo.gettype(), urlinfo.getip(), urlinfo.getport(),urlinfo.getusername(), urlinfo.getpassword()); } what acheive able add route without restarting application (route builder being initialized camel-context.xml). is there anyway fo...

javascript - Performance of jQuery script which dynamically shows/removes images -

i'm thinking best way attach image button each row of list. want every row have button. after click, script should append div image (and run lightbox). do think optimal way of doing is: onclick -> append , hide them run lightbox onexit -> .remove() images i'm worried performance of that. slow browser or rather not? fast written code: function test(){ $.post(url, {id:'1'}, function(data){ $("#cache").append(data).children("a").first().trigger("click"); //returns sth <a href="" rel="lightbox"></a> }); } and in lightbox.js @ function closing down script: $("#cache").empty();