Posts

Showing posts from March, 2015

html5 - video.js fallback is not working -

this code <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script src="javascripts/video.js-stable/dist/video-js/video.js"></script> <link rel="stylesheet" type="text/css" href="javascripts/video.js-stable/dist/video-js/video-js.css" /> <script> videojs.options.flash.swf ="http://localhost/site/public/javascripts/video.js-stable/dist/video-js/video-js.swf"; </script> <title>video</title> </head> <body> <video id="example_video_1" class="video-js vjs-default-skin" controls="" preload="auto" width="640" height="264" poster="" data-setup='{"example_option":true}'> <source src="http://localhost/s

javascript - Login slider with jQuery issues -

i want make login slider jquery. have div @ top of page plus image. want plus image changed minus image , div slide down. here code there problem. <script src="_js/jquery-1.7.2.min.js"></script> <script> $(document).ready(function() { $("form").hide(); $(".open").click(function() { $("form").slidedown("slow"); $(".open").addclass("close"); $(".close").removeclass("open"); $(".close").click(function() { $("form").slideup("slow"); $(".close").addclass("open"); $(".open").removeclass("close"); }); }); }); </script> it works once if want slide down second theme doesn't work anymore.. can please? tnx! working jsfiddle try different following: $('.open').click(function () { $('form').s

How to make a Button Clickable in a ListView generated using a SimpleAdapter in Android? -

i have generated listview using simpleadapter in android. have placed few textviews , button in xml file these widgets displayed on row of listview. want make button clickable in listview. don't want use baseadapter or customadapter or arrayadapter .can suggest me how simpleadapter? my codes follows: final listview l=(listview)findviewbyid(r.id.listview1); listadapter k=new simpleadapter(this,val1,r.layout.mytask,new string[]{"taskid","heading","status"},new int[]{r.id.view1,r.id.view2,r.id.viewstatus}); button b=(button)findviewbyid(r.id.mytask); l.setadapter(k); my xml file follows: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:id="@+id/t

php - How to upload mp3 files -

im trying form upload mp3 or image files folder. using below code can upload image files ok, when try upload mp3 error undefined index: file in c:\wamp\www\recordlabel\inc\soundclips.php on line 6 , code echos invalid file else block. can offer assistance? $allowedexts = array("mp3", "jpeg", "jpg", "png"); $temp = explode(".", $_files["file"]["name"]); $extension = end($temp); if ((($_files["file"]["type"] == "audio/mp3") || ($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/jpg") || ($_files["file"]["type"] == "image/pjpeg") || ($_files["file"]["type"] == "image/x-png") || ($_files["file"]["type"] == "image/png")) && in_array($extension, $all

asp.net - C# Web Application memory overflow? -

c# web application memory overhead .. happen follows 1-i have web application on server called xxx.xxx.xxx.xxx web application performance bad cpu memory , usage overflow.. 2-i moved web application iis on machine works fine without leaks , no overhead memory. and performance pretty good. what maybe cause problem ? if hard has bad sector may affect or have used microsoft tool called debug diagnostic tool v1.2 debug diagnostic no luck ?

objective c - Obj-C editor with a bad MVC pattern, how to clean this up? -

Image
i've been working on game engine in obj-c , decided build editor in obj-c. how i've done now, rid of "glue code" , follow "best practises". time being spent on "glue code" , code base getting large maintain objects depending on each other , keeping referances. typical old-school scenario :-) the view contains lot of options i.e. checkboxes, sliders & textfields. 1) when "stars" number changed 2000, action sent controller. 2) controller verifies input, numeric textfields have number formatter text input file names or other names input verified running code check if name valid. 3) number stars (2000) sent next layer, game engine scene (which has starfield object member). 4) game engine scene applies new amount of stars starfield object member. *) if number of stars changes inside of game engine scene or starfield object, call made controller updates ui textfield. how can make right , more efficient, rid of glue code

node.js - Use socket.get when disconnect event is fired -

i'm making little game. when client disconnects, want others clients notified, delete user in client-side. socket.on('disconnect', function () { socket.get('player', function (error, player) { console.log(player.pseudo + ' disconnected.'); socket.broadcast.emit('removeplayer', player.pseudo); }); }); sometimes, error: console.log(player.pseudo + ' disconnected.'); ^ typeerror: cannot read property 'pseudo' of null is because player removed ? way player's username ? edit: oh got it. bug appened when user hadn't sent pseudo. so, player.pseudo wasn't set. check first if player known. socket.on('disconnect', function (disconnect) { socket.get('player', function (error, player) { if (player) { console.log(player.pseudo + ' disconnected.'); socket.broadcast.emit('removeplayer', p

java - Remove first character if it is comma using array also -

i have wrote code, has string consist email addresses, , going put array getting , (comma). here code: string getemail = "abeywicrema@gmail.com,shan.a@jinasena.com.lk,yasasjayanga@gmail.com"; string[] srr = getemail.split(","); //string tsd = ""; (int = 0; < srr.length; i++) { string string = srr[i]; string[] getemaillist = {",\"" + string + "\""}; system.out.print(getemaillist[0]); } this output ,"abeywicrema@gmail.com","shan.a@jinasena.com.lk","yasasjayanga@gmail.com" comma comes in first, need remove first comma, please me resolve this. first of all, don't need string[] hold email string , it's enough in case have string instead. getemaillist should of type string . second, should reconsider variable's names. getemaillist suitable name method , not variable, suggest example using c

ms access 2007 - VB.NET Event Properties -

guys have event onlick in vb.net in properties of combo list(dropdown menu)? i'm trying use select query select single employee data , display on text box, possible? please guide me thanks. thanks dim mydb dao.database, myrec dao.recordset, mylist string dim afn string, aln string, acn double, aage integer, aadd string, dropdownvalue long dropdownvalue = adropdown.value set mydb = currentdb set myrec = mydb.openrecordset("select * agentinfo agentinchargeid=" & dropdownvalue & " ") while not myrec.eof afn = myrec![firstname] aln = myrec![lastname] aage = myrec![age] acn = myrec![contactnumber] aadd = myrec![address] myrec.movenext loop afntextbox.value = afn alntextbox.value = aln aagetextbox.value = aage acntextbox = acn aaddresstextbox = aadd

android - phonegap 3.4 unable to set an application name other than HelloWorld -

i followed docs , trying create new project command phonegap create project --name "myproject" --id "com.app.myproject" no matter how many times try, app getting installed "hellworld" name. had explicitly change res/values/strings.xml <string name="app_name">myproject</string> alter app name on device. thanks in advance the way solve; create project 3.4 , in adt right clicked on helloworld folder , refactor -> change name. typed new application name. if adt have null exception errors, hit f5 couple of times refresh folders of newly created project. close , restarted adt , voila! started work. , change application namespace com.phonegap.helloworld -> com.mydomain.myappname. know not logical way how did. hope helps.

javascript - Fancybox custom parameters will not work -

i calling fancy box " onclick " in php/html code , pass location of image or video depending on item user clicks so: $txt= $row['location']; $ext="openfancybox('$txt')"; so have 2 fancy box functions, 1 images , 1 videos (because displaying different content. fancy box code: $(document).ready(function () { $('.fancybox').fancybox(); }); function openfancybox(vid) { $.fancybox({ 'content': '<video id="abc" width="320" height="240" controls><source src="urltosite' + vid + '" type="video/mp4"></video>' }); } function openfancyboximg(img) { $.fancybox({ 'content': '<img src="urltosite' + img + '" />', 'autosize': true }); } so works me , fancybox opens on click , displays given media. want add additional parameters fancy box... alike autosize ,

c++11 - Tricky callback realization (C++) -

i have been trying think out lightweight class delegate static/member functions, functors, closures, etc. in project, necessary pass such entities function arguments, , in addition, used in other cases. the first time, decided use templates , inheritance , got this: template<class returntype, class ...args> class callback { private: // struct abstract_invoker { virtual returntype invoke(args...) = 0; }; // template<class function> class sf_invoker : public abstract_invoker { public: sf_invoker(function function) : _function(function) { }; returntype invoke(args ...args) override { return _function(args...); } private: function _function; }; // template<class class> class mf_invoker : public abstract_invoker { using function = returntype (class::*)(args...); public: mf_invoker(class& target, function function) : _target(target), _fun

Cordova cli adds res folder to /www with 7.5mb of default splash screens / icons -

i'm using cordova 3.4. when use cordova build ios build app, cli adds folder called 'res' platform /www folder. contains default splash screens , icons platforms, including ios, android, tizen, bada, blackberry, etc etc. uncompressed folder 7.5mb. adds folder every time run build. i can manually remove folder platform /www folder after building without problem (splash screens , icons on ios defined in xcode project anyway) doing hand every time want push build our testing distribution system or itunes seems huge hassle. is there way can prevent cordova adding folder? seems cordova 3.4 adds folder default when cordova platform add <platform> . didn't in previous versions why didn't caught earlier. remove folder /www folder without cordova build failing. well.

Grails Domain Class String List -

i try make string list in grails. part therefore are: class name{ static hasmany = [names: string] } i created controller class , added there: static scaffold = name so far working on in view there name of string can not add inputs list. so therefore i'm looking solution, hope can help. thanks in advance! you question not clear because of want. if have understood question here answers : 1.if use scaffolding true grails automatically generate pages , codes based on domain configuration , if need more inputs said add more domain variables like .i.e class name{ static hasmany = [names: string] //to see more inputs add them here string description } you have 1 domain called name , did expect see other more inputs need other more member variables or property's.. if not satisfied component grails created fro can change on .gsp file. great resource here http://goo.gl/f7xv8i let me know of further assistance...

javascript - jQuery validation engine js daterange custom function needed -

am using following validation plugin: https://github.com/posabsolute/jquery-validation-engine i have 2 fields start date , end date. i want start date choose future/past dates. however, want end date compare start date , should able choose same date , future dates based on start date. so, if select start date march 12,2014 end date should able choose same date march 12,2014 , future dates march 12,2014. so, used below code validate: <input type="text" class="validate[required,daterange[grp1],custom[date] text-input datepicker" name="daterange" id="start_date" value=""> <input type="text" class="validate[required,daterange[grp1],custom[date] text-input datepicker" name="daterange" id="end_date" value=""> however, above code not validating same day. also done methods in following link https://stackoverflow.com/questions/22339338/start-and-end-date-validation

java - what does the multithreaded connection pool means? -

hi can please enlighten mind what multithreaded connection pool means? because heard httpclient can allow multithreaded connection pool. mean? thank in advance. connection pooling concept of maintaining particular no of connection objects in pool.so there decrease in runtime overhead.instead of creating objects @ runtime when request comes connection object pulled pool , used, after completion object sent pool. we not supposed open or close connection take place automatically costly operation. you can refer link sample code http://javaprogramming.language-tutorial.com/2012/09/a-sample-java-code-for-connection.html

Function with parameter in Haskell -

i'm trying write function has parameter in can specify want function. example: first create few shapes following functions: circle1 :: radius -> shape circle r = shape (circle r) circle2 :: radius -> shape circle2 r = shape (circle r) rectangle :: side -> side -> shape rectangle x y = shape (rectangle x y) now let's want function in can specify want see circles, how create such function? function this: getshapes(circle) and output this: circle1 circle2 at first restructure shape type: data shape = circle {r :: double} | rectangle {l :: double, w :: double} deriving (show) now let think bit type of function getshapes , in opinion should have 2 things input 1 predicate of shapes i'd back, , 2 shapes choose, so getshapes :: (shape -> bool) -> [shapes] -> [shapes] would reasonable choice - next step - hoogle stuff , see second function ( filter ) seems suitable candidate our task. getshapes = filte

android - Listener for Leaderboard in Google game services -

i have setup leaderboard using google game services. using following statement submitting statistics after finishing game. games.leaderboards.submitscore(mhelper.getapiclient(),leaderboardidforhits, totalchancetaken); question : there may situation there not internet services or failure during execution of above submit statement. on successful submit of statistics need show toast "statistics updated". know if there listener method this. define class: class myleaderboardsubmitscorecallback implements resultcallback<submitscoreresult> { @override public void onresult(submitscoreresult res) { if (res.getstatus().getstatuscode() == 0) { // data sent server. // display toast. } } } then submit score this: games.leaderboards.submitscoreimmediate(mhelper.getapiclient(),leaderboardidforhits, totalchancetaken).setresultcallback(new myleader

hibernate - java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Calendar -

i trying convert string calendar,but giving exception. here code:- public list<classa> getdata(string fromdatetime, string todatetime, integer apiid) throws daoexception, parseexception { calendar cal1 = calendar.getinstance(); calendar cal2 = calendar.getinstance(); dateformat df=new simpledateformat("yyyy-mm-dd hh:mm:ss"); cal1.settime(df.parse(fromdatetime)); cal2.settime(df.parse(todatetime)); return findbycriteria(restrictions.eq("apiid", apiid), restrictions.between("searchgenerationtime", fromdatetime, todatetime)); } please can told me wrong in code ?? lets assume fromdatetime & todatetime user input 2014-04-02 19:24:43 & 2014-04-03 12:03:51 respectively. thanks. edited:- here stack trace java.lang.classcastexception: java.lang.string cannot cast java.util.calendar @ org.hibernate.type.descriptor.java.calendartypedescriptor.unwrap(calendartype

sql - Android AUTOINCREMENT column besides PRIMARY KEY column -

i have table varchar column primary key. furthermore want have autoincremented id each row. column id called "id" not "_id". when try create database, error have syntax error near "autonincrement". public static final string sql_create_entries = "create table " + contactentry.table_name + " (" + contactentry.column_name_entry_username + " varchar(20) primary key," + contactentry.column_name_entry_id + " integer autoincrement," + contactentry.column_name_entry_display_name + " varchar(25))"; please note following : 1. using string primary key not idea in general, since strings not natural cluster indices. 2. autoincemrent possible integer primary key omitted in case

r - OAuth Pin Returns [1] -

i've been pulling twitter month using following code library (rcurl) library (twitter) library (streamr) library (roauth) requesturl<-"https://api.twitter.com/oauth/request_token" accessurl <- "https://api.twitter.com/oauth/access_token" authurl ="https://api.twitter.com/oauth/authorize" consumerkey= "my key" consumersecret = "my secret" cred <-oauthfactory$new(consumerkey=consumerkey,consumersecret=consumersecret,requesturl=requesturl,accessurl=accessurl,authurl=authurl) cred$handshake (cainfo=system.file("curlssl","cacert.pem",package ="rcurl")) usually works, times follow hyperlink pin, paste pin , [1] in return. no matter write, keep getting [1]. when try submit request, i'm told requires oauth (below). doing wrong? thank help! error in twinterfaceobj$doapicall(cmd, params, "get", ...) : oauth authentication required twitter's api v1.1 i

data structures - Initialise C Struct in Order to Be Used Globally -

i have following struct: dict.c typedef struct dictionary { int key; char *word; char *desc; } dict; main.c #include "dict.c" dict * d; function() { d->key = 1; } this throws error: dereferencing pointer incomplete type. how allow struct read in other functions? you allocating global pointer, don't. alloc real struct , initialize on declaration: #include "dict.c" dict d = {.key = 1, .word = &word_data, .desc = &desc_data};

javascript - JQuery Mobile how to fix $(document).ready(function(){ to $(document).bind("pageinit", function(){ -

i have been making app while , whole time have been using $(document).ready(function(){ start javascript , have run problem using ajax call in json arrays , organize them lists. after research found need use $(document).bind("pageinit", function(){ when change stop getting console errors getting before ajax calls not work. there else have besides changing $(document).ready(function(){ $(document).bind("pageinit", function(){

java - Handling global search box in Play Framework -

on webpage i'd have global search box i.e. search box available on every subpage (let's in header of web page on so). this, putting search form in "base" template used every subpage , works fine. problems start when want show page displays search results. on such page i'd achieve 1 of: have query string value appear in global search box. hide global search box (so can put more advanced 1 in result page itself). to first thing, have provide query string base template. means, have add new parameter base templete every view need such parameter (which empty string of time). right? there simpler way this? for second thing have detect current url , check if search result page. seems achieve this, have add request parameter base template (which means it's same problem providing query string). is there simpler approach this? by way, using java. first can use optionall parameter in base layout like @(title: string, query: string = null)

javascript - switching play/pause button images -

i have html, video , div add play/pause button, , javascript remove control, , toggle between play/pause. javascript function works toggle between text play , pause, cannot figure out how switch image. in advance, current code included below function playpause() { if (video.paused || video.ended) { if (video.ended) video.currenttime=0; ppbutton.title="pause"; ppbutton.innerhtml="pause" video.play() } else { ppbutton.title="play"; ppbutton.innerhtml="play" video.pause() } } <div id="controls"> <div id="playpause" title="play" onclick="playpause()"><img src="media/playbutton.png"></div> </div> <script> var video = document.getelementsbytagname("video")[0]; video.controls = false; var ppbutton = document.getelementbyid("playpause"); </script> could use same method setting te

osx - Dreamweaver svn commit failed-out of date -

i using dreamweaver cs5 , apache subversion. until today, setup had been error-free. however, when attempted check in file had revised, got following error message dreamweaver: svn: #160024, commit failed (details follow): file or directory ‘about.html’ out of date; try updating resource out of date; try updating background: user. svn hosted on mac on home network running os x 10.7. set way because never svn working on macbook pro, running mavericks. have tried getting current version, re-editing, checking in, have same problem. reverting file , re-editing fails on check-in. in terminal on mac running svn, tried svn cleanup (& sudo svn cleanup ), both of produced following response: svn: '.' not working copy directory . svn update produces 1 message: skipped '.' i have used dreamweaver regularly on 15 years, started using svn couple of months ago. svn novice , followed great , detailed instructions on adobe website , running , connect dreamweaver. other

javascript - Alerts not opening from if statements -

i making rock paper scissors game, , want alerts determine picked , won, alerts dont pop up. found multiple errors going , fixed them, double checked everything, , gave triple check, alerts still not pop up? this 1 of 3 functions (they similar): function rock() { var computerchoice = math.random(); if (computerchoice < 0.34) { computerchoice = "rock"; } else if (computerchoice < 0.67) { computerchoice = "paper"; } else { computerchoice = "scissors"; } } if (computerchoice === "rock") { alert("link , computer both chose rock! it's tie!"); } else if (computerchoice === "scissors") { alert("link chose rock , computer chose scissors! computer took heart of damage!"); } else { alert("link chose rock , computer chose paper! link took heart of damage!"); } } i think problem on line indicated: function rock() { var computerchoice = math.random(); if (c

c++ - Number of swaps in a permutation -

this question has answer here: counting adjacent swaps required convert 1 permutation another 6 answers is there efficient algorithm (efficient in terms of big o notation) find number of swaps convert permutation p identity permutation i? swaps not need on adjacent elements, on elements. so example: i = {0, 1, 2, 3, 4, 5}, number of swaps 0 p = {0, 1, 5, 3, 4, 2}, number of swaps 1 (2 , 5) p = {4, 1, 3, 5, 0, 2}, number of swaps 3 (2 5, 3 5, 4 0) one idea write algorithm this: int count = 0; for(int = 0; < n; ++ i) { for(; p[i] != i; ++ count) { // permuted multiple times std::swap(p[p[i]], p[i]); // number @ hand should } } but not clear me whether guaranteed terminate or whether finds correct number of swaps. works on examples above. tried generating permutation on 5 , on 12 numbers , terminates on those. this problem arises i

ruby - Create a Binding whose only variables are keys from a Hash -

i know can create binding hash using ostruct , this: require 'ostruct' not_in_locals = "we don't want this" locals = {a: 1, b: 2} my_binding = openstruct.new(locals).instance_eval { binding } p my_binding p eval("a", my_binding) #good, want p eval("b", my_binding) #good, want p eval("not_in_locals", my_binding) #bad, don't want access this, can you can see output here, confirms comments in code: https://eval.in/132925 as can see, problem binding binds variables in local context not in hash. i'd method creating binding objects hash, bound nothing besides keys hash. you try this. bypasses straight eval() call helper class method call. helper class method called evaluate(), works simple values (only strings , integers tested far) , relies on inspect(). but if types of values dealing known ahead of time, modify work. class hashbinding def initialize(hash) @hash = hash end def evaluate(str)

r - Manipulating x axis in panel plot when a factor is used -

Image
the code i've used is: mcgc <- ggplot(sam, aes(x = person,y = m, colour = x)) + geom_point(size = 0.75) + scale_colour_gradient2(high="red", mid="green", limits=c(0,1), guide = "colourbar") + geom_hline(aes(yintercept = mad, linetype = "mad"), colour = "blue", size=0.75, show_guide = true) + geom_hline(aes(yintercept = mmad, linetype = "mmad"), colour = "black", size=0.75, show_guide = true) + facet_wrap(~ plan, scales = "free", ncol = 4) + scale_linetype_manual(name = "plan of health care", values = c("mad" = 1, "mmad" = 1),guide = "legend") for data: plan person x m mad mmad 1 1 95 0.323000 0.400303 0.12 1 2 275 0.341818 0.400303 0.12 1 3 2 0.618000 0.400303 0.12 1 4 75 0.320000 0.400303 0.12 1 5 13 0.399000 0.400303 0.12 1 6 20 0.400000 0.400303 0.1

c - If I malloc(1) twice in a row, why do the values differ by 32? -

in c, if run malloc(1) twice , print out 2 values casted uintptr_t , values differ 32. example, void * last = malloc(1); void * next = malloc(1); printf("orig %lu\n", ((uintptr_t)last)); printf("next %lu\n", ((uintptr_t)next)); prints out orig 30572560 next 30572592 malloc(size_t size) allocates size bytes, according this . expect value increase 8 when malloc 1 byte, another. why differ 32 instead? thanks! this implementation detail differ between different compilers/standard libriaries. in general, there no guarantee subsequent malloc calls return adjacent memory regions. note each memory region associated additional metadata, including not limited region size (otherwise wouldn't possible know how memory deallocate when free run). metadata put inside of allocated region, making bigger requested. there other factors influence how memory allocated - memory alignment , "hole" finding algorithm used malloc implementation, etc.

java - JSON with HttpURLConnection not working on PUT -

i stuck when working json in java application. quite newbie both json , httpurlconnection, doing basic wrong. have tried quite lot of things , i'm not able find error, can me. i trying put call aganist server. code. //desired json string: [{"type":"url", "parsed_data":"testdata"}] string infotojson = "[{\"type\":\"url\",\"parsed_data\":\"testdata\"}]"; string uri = "www.myuri.com" string user = "myuser"; string password = "mypass"; string userpass = user + ":" + password; string encoded = new sun.misc.base64encoder().encode(userpass.getbytes("utf-8")); url url = new url(uri); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setrequestproperty ("authorization", "basic " + encoded); connection.addrequestproperty("accept", "application/json"); connection.addreques

html - PHP - Create a Schedule table in relation to time -

i'm doing school project , have create schedule array. sorted array day & time. know how create simple table , insert data - wanted make more defined table in relation time: the array monday looks this: array ( [0] => array ( [courseid] => comp275 [lectureid] => gg [day] => monday [stime] => 12:15 [etime] => 15:16 [term] => winter [year] => 2014 ) [1] => array ( [courseid] => comp345 [lectureid] => ss [day] => monday [stime] => 18:20 [etime] => 20:30 [term] => winter [year] => 2014 ) ) i want table column "monday" table type http://4.ii.gl/mthvqn.png this code @ moment (its bit broken haven't figured out how want yet.) <table> <tr> <th>monday</th> <th>tuesday</th> <th>wednesday</th> <th>thursday</th> <th>friday</th>

How to update multiple MongoDB subdocuments in one shot? -

i have created couple of documents in mongodb: > db.mycollection.insert( {"bucket": [{"field1":"x"},{"field2":{"a":"b","c":"d","e":"f"}}]} ) > db.mycollection.insert( {"bucket": [{"field1":"y"},{"field2":{"g":"h","i":"j","k":"l"}}]} ) > db.mycollection.find() { "_id" : objectid("534102c492970f1b06b1edc8"), "bucket" : [ { "field1" : "x" }, { "field2" : { "a" : "b", "c" : "d", "e" : "f" } } ] } { "_id" : objectid("5341054e92970f1b06b1edc9"), "bucket" : [ { "field1" : "t" }, { "field2" : { "g" : "h", "i" : "j", "k" : "

web scraping - Having issue extracting java data from NASA website -

http://disc2.nascom.nasa.gov/giovanni/tovas/realtime.3b42rt.2.shtml i working on project , trying extract data project on rainfall throughout world. experimental real-time trmm multi-satellite precipitation analysis (tmpa-rt): 3b42rt i cannot figure out how view , manipulate data, java or non-java version. not have experience w/ java. any tips or ideas appreciated.

datetime - Sort dates file python -

i have file contains dates , tasks in form (datetime.datetime(2014, 5, 20, 0, 0), 'laundry') (datetime.datetime(2014, 6, 1, 0, 0), 'exam ') how can display tasks due within date ( ex. due within week ) in format ? 20/05/2014: laundry thanks assuming data list of tuples this: date_list = [(datetime.datetime(2014, 5, 20, 0, 0), 'laundry'), (datetime.datetime(2014, 6, 1, 0, 0), 'exam '), (datetime.datetime(2014, 4, 20, 0, 0), 'grocery'), (datetime.datetime(2013, 5, 20, 0, 0), 'tv')] you can sorted list based on dates doing: sorted_dates = sorted(date_list, key=lambda x: str(x[1]), reverse=true) here, passing string representation of dates key sorted function translates sorting dates sorting of strings. gives you: [(datetime.datetime(2013, 5, 20, 0, 0), 'tv'), (datetime.datetime(2014, 5, 20, 0, 0), 'laundry'), (datetime.datetime(2014, 4, 20, 0, 0), 'grocery'), (datetime.datetime(2014, 6

filesystems - How to list directories on an OpenVMS volume -

i've been searching google openvms system administrator's guide , user guide, , still can't find regarding listing directories present on openvms volume. can't see how taken granted in docs, since else specific, either i'm failing see or can't done. if can't done, i'm missing incredibly large chunk of picture in regards using vms. suggestions appreciated. tia, grobe0ba by "listing", assume mean via command such dir... see directories on volume like, $ dir volumeid:[000000...]*.dir of course, need enough privilege able see directories on volume.

gnu make - Makefile rule always been processed -

my recipe $(hdaimg) been processed, when there $(hdaimg) file in folder. what doing wrong? hdaimg := $(testdir)/$(project)-hda.img hdaimg value, actually, test/project-hda.img phony: $(project) all: $(project) $(hdaimg) $(project): check-env $(call v_exec, 1, $(make) -c $(srcdir) $@) $(hdaimg): $(project) check-env $(call print_white_init, hdaimg) $(call print, creating $@) $(call v_exec, 2, dd if=/dev/zero of=$@ count=0 bs=1 seek=$(hdaimgsize) &> /dev/null) $(call print, partitioning $@) $(call v_exec, 2, parted --script $@ mklabel msdos mkpart primary ext4 1 100%) $(call print, creating $@ device maps) $(call v_exec, 2, sudo kpartx -a $@ -s) $(call v_exec, 2, sudo mkfs.ext4 /dev/mapper/loop0p1 -q) $(call v_exec, 2, sudo mount /dev/mapper/loop0p1 $(testdir)/mnt) $(call v_exec, 2, sudo umount $(testdir)/mnt) $(call v_exec, 2, sudo kpartx -d $@) $(call print_white_done, hdaimg) check-env: ifneq ($(error),)

node.js - Meteor DDP to ODATA -

what need replace server side mongo db via ddp read/write set of odata services within ddp. would best create ddp client subscribes meteor ddp or how should go implementing this. or node ddp server? if so, examples of ddp servers? cheers

java - Validating text fields completeness with logical conditions -

i'm coding javafx app, have 6 textfields required fields. have default button innactive @ first. i want use logic check wether fields have been filled. have variable estado initiated false . coded: if (!((textfield)event.getsource()).gettext().trim().isempty()) estado = estado | true; else estado = false; if (estado) button.setdisabled(false) all textfields got method after keyreleased event. i've got not results fo far. this basic solution if need more plz tell... /* * change template, choose tools | templates * , open template in editor. */ package textfieldlogic; import java.util.regex.matcher; import java.util.regex.pattern; import javafx.application.application; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.textfield; import javafx.scene.input.keyevent; import javafx.scene.layout.stackpane; import javafx.scene.layout.vbox; import javafx.stage.stage; /** * *

Use try_files to redirect /dir1 to /dir2 in nginx -

i have part of websites still using old urls. essentially, want: http://hostname/app1/static/dir1 --> http://hostname/app1/static/dir2 . the static directory may contain other resources being used. i tried following getting cycle caused nginx abort: location ^~ /app1/static/ { alias /home/app1_user/app1/static/; try_files /app1/static/dir1 /app1/static/dir2; } what should instead? if understand correctly, - a file, e.g. /app1/static/file.jpg try_files in /home/app1_user/app1/dir1/file.jpg , /home/app1_user/app1/dir2/file.jpg , lastly 404 if can't found. location ~ ^/app1/static/(.*)$ { alias /home/app1_user/app1/static/; try_files dir1/$1 dir2/$1 =404; }

Square Connect API Refund Clarification -

if merchant issues refund, show in both refunds list , retrieve payment endpoint? there situations in may show in one, not other (such cash, check, or other tender types)? the use case external app storing / caching payments refunds need update stored payments keep accurate sales figures. if refunds show in both places, seems best way update stored payments in use case load refunds list periodically , update stored payment using retrieve payment endpoint. regardless of tender type, every refund available both list refunds endpoint , list/retrieve payment endpoints. solution sounds one, since list refunds endpoint chronological date of refund, opposed date of original payment. you can use payment_id included in returned refund objects stored copy of corresponding payment.

qt - How to switch to another state at the end of a transition in QML? -

i'm trying implement fitness application displays current exercise name shows progress bar during resting periods. when progress bar filled, name of next exercise displayed, progress bar shown when completed, , on. note i'm using progress bar example i'll have own widget in real application. my system has 2 states : exercise value of progress bar 0 , stays 0 rest value of progress bar goes 0 maximumvalue on duration of resting period so goes : the application in "exercise" state , shows name of current exercicse the user execute exercise , click on progress bar when he's done the application switches "rest" state the user rests while progress bar being completed after progress bar completed application switches "exercise" state , displays name of next exercise my issue step 5 : not know how switch state @ end of transition. i've tried change "state" property during propertychanges , time @ end of tra

java - Cant find file using FileReader -

i'm working on project class , supposed read in file called samplesearch.txt included below code i'm working with. problem through eclipse can't seem able load file in. comes file not found though text file in same directory rest of code. import java.util.*; import java.io.*; public class driver{ public static void main (string[] args){ // try block needed read in file try { //open file "samplesearch.txt" filereader filename = new filereader("samplesearch.txt"); scanner fileread = new scanner(filename); //read in number of rows int numrow = fileread.nextint(); fileread.nextline(); //read in number of columns int numcol = fileread.nextint(); fileread.nextline(); //create 2d array hold characters in file char[][] array = new char[numrow][numcol]; //for each row in file (int r = 0; r < numrow; r++) {

c# - JpegBitmapDecoder decode jpeg failed? -

Image
i'm using following code decode jpge image unmanagedmemorystream^ mstream = gcnew unmanagedmemorystream(_jpegdatabuff, _bufflength); jpegbitmapdecoder^ decoder = gcnew jpegbitmapdecoder(mstream, bitmapcreateoptions::preservepixelformat, bitmapcacheoption::onload); bitmapsource^ bitmapsource = decoder->frames[0]; i use bitmapsource display on control of wpf, the result below i have searched on internet, did not solve yet! someone can me? many thanks, t&t from looks of either jpeg source incomplete or invalid. exceptions jpegbitmapdecoder throws argumentnullexception (stream null ) , fileformatexception . file format detected analyzing file header. jif/ jfif file structure holds image description information in relatively small header followed "raw" data. i guess decoder built resilient ignore invalid (rendered last before gray) and/or missing (rendered gray) blocks. think way detect either analyze final image (maybe checking last 8x8

algorithm - Space Complexity and Modifying the Data Set -

what space complexity of following algorithm? given array of n 32-bit signed integers, each value positive , less 2 power of 30, negate values in array, negate values in array second time. the question arose me out of discussion in comment section here: rearrange array arr[i] becomes arr[arr[i]] o(1) space i interested in different opinions , definitions. think subtle distinctions , definitions may missing in stackoverflow discussions on subject. space complexity refers added space requirements algorithm, on , above original data set itself. in case, original data set n 32-bit signed integers, you're concerned storage above that. in case, storage is nothing, translates constant o(1) space complexity. if required create separate array (negated, negated again), o(n) since space required in proportion original data set. but, since you're doing negations in-place, that's not case.

android - How to write a switch statement inside a method -

i have 7 activities a.b,c,d,e,f,g. when click of these buttons, ex:if click a, want go activity. want in switch case using method. tried doing this,but app crashed: what's wrong in code.y crashing? package com.example.assignment2; import android.content.intent; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.view; import android.widget.button; import android.widget.textview; public class act_a extends actionbaractivity { textview text; button btn; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_activity_); text = (textview) findviewbyid(r.id.display); text.settext("this activity a"); text.settextsize(20); } public void display(view v) { switch (btn.getid()) { case r.id.buta: intent intent = new intent(this, act_a.class); startactiv

How to perform load testing using Selenium WebDriver? -

i have perform load testing application using selenium webdriver 100 users. 100 users login , hit server @ time. how process using selenium webdriver? update mentioned in comments, bad idea. if considering load testing selenium grid, reconsider purpose , verify whether selenium grid option have. for free solution: selenium provides scalable testing framework called selenium grid. can use in conjunction testng create scalable load-testing framework. from link: scale distributing tests on several machines ( parallel execution ) manage multiple environments central point, making easy run tests against vast combination of browsers / os. minimize maintenance time grid allowing implement custom hooks leverage virtual infrastructure instance. i have leveraged selenium grid load-test our web-app dozen concurrent browser sessions (so far). used several references achieve this: http://testng.org/doc/documentation-main.html#parallel-tests http://b

How do I use this query in vb.net - I cannot get my head around converting from c# to vb.net -

objectquery query = new objectquery("select * win32_battery"); foreach (managementobject o in new managementobjectsearcher(query).get()) { uint level = (uint)o.properties["estimatedchargeremaining"].value; } simple in c# - cannot head around in vb.net -> tried online , manual conversion , keep getting stuck for each o managementobject in new managementobjectsearcher(query2) <- getting stuck @ point think -> not sure how .get if can me convert wonderful - preferably full conversion have found parts of answer on , seem 'miss step' pretty you'd expect: dim query new objectquery("select * win32_battery") each o managementobject in new managementobjectsearcher(query).get() dim level = cuint(o.properties("estimatedchargeremaining").value) next

c++ - Splitting an STL list? -

i have circular linked list looks this: 4 -> 3 -> 2 -> 5 -> 0 -> 1 -> beginning i want split list 2 segments, reverse 1 of segments, , rejoin list. this: split, o(1) operation 4 ** 3 -> 2 -> 5 ** 0 -> 1 -> beginning reverse, o(n) operation 0 ** 3 -> 2 -> 5 ** 4 -> 1 -> beginning rejoin, o(1) operation 0 -> 3 -> 2 -> 5 -> 4 -> 1 -> beginning the stl not appear have circular linked list, i'm hoping can away representing list (forward) list. this, requires: * way split lists sublists * way merge lists together merging sublists should easy using std::list::splice , , should o(1) operation. yay! however, can't find o(1) way split lists sublists. one approach use iterators, don't think works in case because sublist goes off end of list , resumes @ beginning of list. is there efficient way implement algorithm using stl? or should give , write own circular linked list library? thanks! i no

java - System.out messed up after Jackson serialization -

i've been trying serialize objects system.out (for debugging). call final jsonserializer serializer = new jsonserializer(); serializer.serialize( system.out, myobj ); system.out.println("done"); it prints out json, "done" never gets printed. debugging these lines, shows 3rd line gets executed, output never shows up. is jackson bug, or doing wrong? edit: public class jsonserializer { private objectmapper getconfiguredobjectmapper() { final objectmapper mapper = new objectmapper(); mapper.enable( serializationconfig.feature.indent_output ); mapper.setvisibility( jsonmethod.field, visibility.any ); mapper.setvisibility( jsonmethod.getter, visibility.none ); mapper.configure( serializationconfig.feature.auto_detect_getters, false ); mapper.configure( serializationconfig.feature.auto_detect_is_getters, false ); mapper.configure( serializationconfig.feature.auto_detect_fields, false ); final simplemodule module = new simplemodule( &qu