Posts

Showing posts from June, 2010

c# - MVC dropdownlist don't select item with value pass from ng-model - hope get reply? -

i here try edit data though angularjs , got data in view - problem dropdownlist don't select value passed , don't know why ? js code: function getcustomer() { var promisegetstudent = spacrudservice.getcustomer(sharedata.value); promisegetstudent.then(function (pl) { pl.data.miragedate = $filter('date')(pl.data.miragedate, 'yyyy-mm- dd'); $scope.cust = pl.data; }, function (errorpl) { $scope.error = 'failure loading student', errorpl; }); } html code: <table class="table"> <td style="width:200px; text-align:center; vertical-align:central">إسم العميل</td> <td> <table class="table" style="margin-bottom: -3px;"> <tr> <td style="padding:0; vertical-align:central; width:50%;"> ...

apache - php - function()[] syntax -

this question has answer here: php syntax dereferencing function result 22 answers i have strange syntax problem in php. at point in code, mysql query (which send 1 line 1 value), , query result following way : $myvar = mysql_fetch_assoc($result)["something"]; $result being mysql result, of course. works fine, both locally , on site. however, when colleague took latest version of site local test of own, got following error : parse error: syntax error, unexpected '[' in c:\wamp\www\mysite\ref\myfile.php on line 33 line 33 being line defined $myvar. fixed doing following : $myvar = mysql_fetch_assoc($result); $myvar = $manif["something"]; it seems pretty obvious me problem comes wamp (i running apache server), question "why?". i got web development (i more of c++ developer until now) , i've been using syntax whi...

python - If, Else inside html using Django templates -

i have django project consists of many html pages. i want add if else condition inside html tag return "none" whenever time stamp = 0000-00-00 00:00:00 , return time when it's not. code shown below, used tag time in date format. <td>{{ table.start_time|date:"y-m-d g:i:s"}}</td> i used tag: <td>{{ table.start_time|date:"y-m-d g:i:s"|default:"none"}}</td> thanks all!!

java - Sending HTTP command in browser works, not when sent with httppost -

when in browser send following string control unit have http://192.168.0.215/i_activate/aterm?40~00 , relay activated. i have tried many variations of following: httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://192.168.0.215/i_activate/aterm?40~00"); // execute http post request httpresponse response = httpclient.execute(httppost); with html response "fail" unit i have tried adding 40~00 in many ways (namevaluepair, etc) , encoded in different forms without success sure problem lies there. any thoughts? the problem browser sends get request, parameter in url query string, sending post request without body data. use httpget instead of httppost send get request: httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget("http://192.168.0.215/i_activate/aterm?40~00"); // execute http request httpresponse response = httpclient.execute(httpget);

Remote access in Apache Cassandra -

i have 2 machines installed apache cassandra, ips (192.168.1.101 , 192.168.1.102). i want remote login 192.168.1.102 192.168.1.101 i edited rpc_address= 0.0.0.0 , cassandra.yaml file in 192.168.1.101 when iam trying connect 192.168.1.102 using cqlsh 192.168.1.101 9061 iam getting error this connection error: ('unable connect servers', {'192.168.1.107': error(111, "tried connecting [('192.168.1.107', 9160)]. last error: connection refused")}) is there configuration want in 192.168.1.102 or missed anything. please me thanks in advance i see multiple issues here: cqlsh uses port 9042 access cassandra, not 9061. it's declared in cassandra.yaml native_transport_port by default cassandra listens cql connections on localhost . see listen_address in cassandra.yaml , set node's public ip address. i suggest: double-check cassandra logs completed startup without errors. try connect localhost cqlsh

javascript - WhatsApp share button on website. Easy way to detect if WhatsApp exists? -

i'm adding whatsapp share button on website , hide button when whatsapp functionality not exists (is not supported) on user device. there easy way? or way? i found http://whatsapp-sharing.com , has disadvantages me. - no custom buttons/icons supported - looks it's detecting android , ios (what windows phone?) - hard maintain on bigger project i'm searching js/jquery or maybe cssonly (mediaqueries?) solution, without success now. advice helpfull, thanks. demo try this $(document).ready(function() { var ismobile = { android: function() { return navigator.useragent.match(/android/i); }, blackberry: function() { return navigator.useragent.match(/blackberry/i); }, ios: function() { return navigator.useragent.match(/iphone|ipad|ipod/i); }, opera: function() { return navigator.useragent.match(/opera mini/i); }, windows: function() { return navigator.useragent.match(/iemobile/i); }...

python - Only writing to a file certain columns of a line (seperated by spaces) -

i reading log line line. trying print columns of line. bash script use awk , $ seperate it. however, cant figure out how python. tried using split, doesnt want. my code right now: for line in file: if stored_procs_begin in line: log.write(line) elif stored_procs_finished in line: log.write(line) elif stored_task_begin in line: log.write(line) elif stored_task_finished in line: log.write(line) elif actuate_report_schedule in line: break so when trying format line being passed write(). example of want: date time info junk1 junk2 name => date time info name edit: got idea split , extract fields want , them join them together.. there has better what. you can split line words using split() , that's right. can index columns want have in output: line = 'date time info junk1 junk2 name' parts = line.split() parts_i_want = parts[0:3] + parts[5:6] print ' '.join(parts_i_want) if wan...

Bootstrap modal not showing on xs devices -

i have few modals on page. work fine except 1 of them, displays on sm, md , lg devices, not on xs. when shrink screen, see darkened screen, no modal. if click on button trigger it, while i'm on xs screen, same darkened screen. be? <a href="mailto:?subject={$title}&body={$item_url}" class="btn btn-social-icon btn-reddit btn-xs" data-toggle="modal" data-target="#shareemail"><i class="fa fa-envelope-o"></i></a> and modal itself: <div id="shareemail" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"><form class="form-horizontal"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;<...

php - Changing PmWiki user profiles links? -

i have existing website own user-management incorporating pmwiki into. i therefore using externauth recipe in pmwiki handle authentication. works fine, allowing me authenticate users based on session variables set existing user authentication system. however, there single shortcoming: pmwiki on several pages make links user profile pages. e.g. when showing edited pages. these links instead of pointing non-existing wiki-pages of form profiles/username point existing user profile pages. is there way change way pmwiki [[~username]] links rendered on page "external" link http://example.com/profiles/username instead of normal pmwiki behavior? i think figured out myself... trick use markup command define markup change user-profile links @ same time other "inline" markup external link. link later in markup-chain converted real html link point externally. // set author information: $authid = $_session['userid']; $author = $_session['na...

session cookies - User logout after non-persistent login in Asp.Net Identity 2 -

i trying configure asp.net identity 2.2 able login , permanently. know there 2 settings account, validateinterval of cookieauthenticationprovider , expiretimespan of cookieauthenticationoptions. here standard configuration comes new mvc 5 application, expiretimespan , slidingexpiration set explicitly default values have them in mind: app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = defaultauthenticationtypes.applicationcookie, loginpath = new pathstring("/account/login"), provider = new cookieauthenticationprovider { // enables application validate security stamp when user logs in. // security feature used when change password or add external login account. onvalidateidentity = securitystampvalidator.onvalidateidentity<applicationusermanager, applicationuser>( validateinterval: timespan.fromminutes(30), regenerateidentity: (manager, user) => user.generateuseriden...

arrays - OR query in rethink -

is possible or search on values of array in rethink. eg: have table called "post" field "tags" array. want or search on values of tags. post1 { tags : ["young","agreesive"] } post2 { tags : ["cricket","india"] } give me posts contains tags "young" or "cricket" should return both posts. as mlucy said, can use filter in conjunction or , contains documents specific tag. if have array of tags, can following too: var tags = ["young", "cricket"]; r.table('posts').filter(function (row) { return r.expr(tags).contains(function (value) { return row("tags").contains(value) }); }) this more extensible using or . multi index you can create multi-index property. multi-indexes let lookup data of values in array. so, example: r.table("posts").indexcreate("tags", {multi: true}) r.table("posts").getall("you...

c# - How robust is repeating a piece of code to measure it's execution time? -

let's want measure how long myfunction() executes. let's myfunction() executes fast (a few milliseconds) , stopwatch cannot measure function time enough precision. i put myfunction() inside of loop executes 1,000,000 times , measure that. time execution of loop , divide result number of times loop executed. the questions are: how accurate measurement? want know how long first execution of myfunction() takes, not how long average takes. does time executing same function scale linearly? depend on properties of myfunction() (so kind of caching used)? properties? let's run myfunction() 1,000,000 times in 3 seconds. you know: you can @ least run myfunction() in time less or equal 3μs, on similar data , similar cache , jitter situations. it runs faster equivalent method takes 3.5 seconds, long tests equivalent. (but 3.01 close sure unless repeats consistently). it runs slower equivalent method takes 2.5 seconds, long tests equivalent. (but 2...

node.js - Protecting Node Server with Basic HTTP Auth -

i'm running mean.js app on server, want run test environment password protected. tried doing http-auth set so var basic = auth.basic({ realm: "simon area.", file: __dirname + "/data/users.htpasswd" // gevorg:gpass, sarah:testpass ... }); // init express application var app = require('./config/express')(db); app.use(auth.connect(basic)); when this, there no authentication done on front end. sanity check changed var basic to var basic = auth.basic({ realm: "simon area.", }, function(username, password, callback) { console.log("authenticating"); callback(username === "username" && password === "password"); }); and nothing printed console. i'm thinking method of authentication not working. in past have used apache passwordbasicauth protect application, simple. there way comparable authentication in node?

java - Get specific Data from inside a HashMap -

first of must apologies uncertain how word title well. however problem facing continuation of question brought me 1 step closer completing particular program. onto problem though. here current output: income {jack=46, mike=52, joe=191} these inside hashmap , printed out, need though make output more presentable , guess leads needing manipulate/get data inside map , make presentable. the goal aiming output this: jack: $191 mike: $52 joe: $46 i'm still new java , programming in general i'm wondering if possible or if have tackled wrong way in beginning? below code: public static void main(string[] args) { string name; int leftnum, rightnum; //scan text file scanner scan = new scanner(test3.class.getresourceasstream("pay.txt")); map < string, long > namesummap = new hashmap < > (3); while (scan.hasnext()) { //finds next line name = scan.next(); //find name on line leftnum = scan.nextint(); //get price rightnum ...

php - Converting array to an object with an array inside it -

i have array 3 keys , values. need convert first 2 keys object , 3rd must remain array , object inside it. my array: $person = array( 'name' => 'bob', 'surname' => 'white', 'address' => array( 'street' => 'green road', 'houseno' => '89', 'city' => 'liverpool' ) ); i want convert array object so: $personinformation = json_decode(json_encode($person)); which gives me this: object(stdclass)(3) { 'name' => 'bob', 'surname' => 'white', 'address' => object(stdclass)(3) { 'street' => 'green road', 'houseno' => '89', 'city' => 'liverpool' } } but after this: object(stdclass)(3) { 'name' => 'bob', 'surname' => 'white', ...

How to filter results for specific languages within a ruby RDF.rb gem DBPedia query -

i'm stuck problem reducing delivered result set of dbpedia query did rdf gem. works fine "non-language specific" results when try reduce delivered literals "abstract" relation i'm struggling limiting results languages. the code follows: require 'linkeddata' graph = rdf::graph.new graph.load('http://dbpedia.org/resource/nbc') query_abstract = rdf::query.new({ :wiki_abstract => { rdf::uri('http://dbpedia.org/ontology/abstract') => :abstract, } }) results_abstract = query_abstract.execute(graph) results_abstract.each |result| puts "#{result.wiki_abstract} - abstract: #{result.abstract}" end i tried same sparql query , able filter output @en language without problem. when try find solution using rdf gem failed , couldn't find helpful hint in rdf documentation. have idea how add filters above query languages? you need select results have language need, following: results_abstract.to...

python - Pandas: Filter dataframe for values that are too frequent or too rare -

on pandas dataframe, know can groupby on 1 or more columns , filter values occur more/less given number. but want on every column on dataframe. want remove values infrequent (let's occur less 5% of times) or frequent. example, consider dataframe following columns: city of origin, city of destination, distance, type of transport (air/car/foot), time of day, price-interval . import pandas pd import string import numpy np vals = [(c, np.random.choice(list(string.lowercase), 100, replace=true)) c in 'city of origin', 'city of destination', 'distance, type of transport (air/car/foot)', 'time of day, price-interval'] df = pd.dataframe(dict(vals)) >> df.head() city of destination city of origin distance, type of transport (air/car/foot) time of day, price-interval 0 f p n 1 k b f 2 q s n j 3 h c g u 4 w d m h if big dataframe, makes sense remove rows have spurious items, example, if time...

javascript - Converting an <audio> tags track time into Mins:Secs -

i created frankensteined audio player, , need little track timing. have counts 0 -> whatever track time is, in seconds. can't seem figure out how convert seconds mins:secs. i'm new timing/converting js, appreciated! html <audio src="" id="player" ontimeupdate="document.getelementbyid('tracktime').innerhtml = math.floor(this.currenttime) + ' ' + math.floor(this.duration);">\ </audio> <span id="tracktime">0 0:00</span> code update alright, have shows minutes single digit (ie: 1:00 = 1, 2:00 = 2, 3:00=3, etc) i need show 3 digits, ie: 1:00 = 1:00, 2:00 = 2:00, etc. here current audio tag: <audio src="http://dosh.dk/bb/track.mp3" id="player" ontimeupdate="document.getelementbyid('tracktime').innerhtml = math.floor(this.currenttime / 60) + ' ' + math.floor(this.duration / 60);"> <script> var min...

ruby on rails - query phone number with different format in the model -

there's table named "person" attribute id primary key , phone_number user input formatted in different ways. need query id phone number. example, person.where(:phone_number => 4155332321) however, number in model 415-533-2321 or 4155332321. how write query that? btw, can't change phone number format in model. otherwise, can convert phone in query , model same format. thanks i think you'll need two-part approach this. first, you'll want save "normalized" phone number database. contains no formatting @ -- numbers. require add new column database, say, normalized_phone_number , write before_save callback store value. class person before_save :normalize_phone_number def self.normalize_number(number) number.gsub(/[^\d]/, '') if string.present? end def normalize_phone_number self.normalized_phone_number = person.normalize_number(self.phone_number) end end next, you'll want write custom class method f...

java - Groovy in android - launcher activity cant be found -

Image
i'm trying run simple android program. issue launcher activity groovy file, it's called mainactivity.groovy , resides in java source folder. here photo of gradle dependencies , project structure: and here android manifest file: <?xml version="1.0" encoding="utf-8"?> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> and lastly here error when run program: 07-08 17:11:49.297 20173-20173/com.ex...

javascript - How to make an iframe responsive full height and full width -

i'm embedding youtube/dailymotion videos , want make iframe responsive , full height , same height window : i made responsive iframe not full height ! here code <div class="video-container"> <iframe height="100%" width="100%" src="https://www.youtube.com/embed/7ipiybrlqzc" frameborder="0" allowfullscreen></iframe> </div> css : .video-container { position: relative; padding-bottom: 100%; height:100%; } .video-container iframe, .video-container object, .video-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin:0px; } demo + code js fiddle use viewport percentage lengths , vw , vh set height , width of iframe . optionally, use calc subtract 4px player seems add this. viewport-percentage lengths defined length relatively size of viewport, visible portion of do...

Is there an algorithm to determine the number of elements in contiguous regions? -

Image
i have set of points placed in 2 dimensional euclidean space. if distance between 2 points closer predetermined cut-off radius, considered neighbours. calculate number of elements in contiguous regions (for example, let's 1 , 2 neighbours. if 2 , 3 neighbours, 3 , 4, have 4 elements next each other). i have been googling hell day , have run lot of keywords kd-tree, k means clustering, graph traversal, flood fill , connected-component analysis, can't learn them @ point. need direction focus efforts in correct direction. your problem seems connected component analysis! the first thing represent data graph , there tons of libraries that. let's take example in python: can use networkx or graph-tool . straightforward point can represented node. concerning edges have several solutions. you can brute-force comparisons compares points each others. run in o(n * (n-1) /2), ok if dataset small. if dataset big can use different approximate algorithms (kd-tree, ball...

android - Spreading a push notification batch over a time period -

i'm looking way spread sending of push notification messages on time period using parse (or service of king). here use case : want send daily messages large user base, , don't want these messages generate burst of connections our infrastructure have difficulties handle. for reason need able specify "duration" of push while sending message. any idea? thanks from parse.com point of view can construct push target query in way selects subset of recipient using skip , limit . divide audience batches of x recipients , schedule these pushes sent out @ specific time. you can send out pushes "at once" set delivered in users' time zone. user in europe receive notification @ 10am in local time zone, translates 2am pst, user in pst timezone won't receive notification until 8h later spread out well.

apache - Vagrant provisioning fails -

so after created similar vm, vagrant fails provision: vagrant ... verbose: ==> default: info: /stage[main]/apache::mod::worker/apache::mpm[worker]/file[/etc/apache2/mods-enabled/worker.load]: scheduling refresh of class[apache::service] ==> default: notice: /stage[main]/apache::mod::worker/file[/etc/apache2/mods-available/worker.conf]/ensure: defined content '{md5}59cf27b20f14393692303b41f3071df6' ==> default: info: /stage[main]/apache::mod::worker/file[/etc/apache2/mods-available/worker.conf]: scheduling refresh of class[apache::service] ==> default: notice: /stage[main]/apache::mod::worker/apache::mpm[worker]/file[/etc/apache2/mods-enabled/worker.conf]/ensure: created ==> default: info: /stage[main]/apache::mod::worker/apache::mpm[worker]/file[/etc/apache2/mods-enabled/worker.conf]: scheduling refresh of class[apache::service] ==> default: info: /stage[main]/apache::mod::cgid/file[cgid.conf]: filebucketed /etc/apache2/mods-available/cgid.conf pup...

android - Using Static Application Context -

i having issue handler returning during screen rotation, meaning activity had not been created yet , causing error. i solved via post: static way 'context' on android? which sets application level static context use. wanted know how safe use , if there instances shouldn't use this, don't entirely understand it. thanks, kevin. no, horrible way solve it. means you're using application context instead of activity context, wrong , can cause memory leaks. correct way either check condition before ding can cause error, or catch exception caused , eat it. really best way solve turn off activity recreation on rotation , has been stupid idiotic idea google.

http - Streaming of intranet silverlight page to brightauthor video stream -

i have intranet silverlight page , digital signage solution called brightsign. ds plyers have hd222. unfortunately not support silverlight , re creating site take resources dont have atm. quickest solution found have pc stream webpage on network , having ds player connect it. using windows media encoder stream site. unfortunately feed not working , im starting think problem media encoder. there better system or way work on brightsign player? regards , thanks!

javascript - MongoDB -- client.open() returns "undefined in not a function" -

here's have: var express = require('express'); var mongoclient = require('mongodb').mongoclient; var server = require('mongodb').server; var app = express(); var client = new mongoclient(new server('localhost', 27017, {}), {}); client.open(function(err, client){ //callback }); and when run it, points line open method on , says "undefined not function". doing wrong? from mongo docs : var mongoclient = require('mongodb').mongoclient // connection url var url = 'mongodb://localhost:27017/myproject'; // use connect method connect server mongoclient.connect(url, function(err, db) { console.log("connected correctly server"); db.close(); });

php - CAKEPHP 2.0, fill find condition array with variable conditions -

i making filter 1 of views. want fill conditions array based on if/else statements check data received url. i trying build this. creating multiple if/else statements. if statement true want condition filled demonstrated below, else keep condition empty. find() query in else statement being ran , creating error. //$set , $kleur variables come url, work public function seriesfilter($foil='search', $color, $set, $name){ $this->loadmodel('cards'); $this->loadmodel('magicsets'); $setname = $this->magicsets->findbycode($set); $this->card->recursive=-1; $this->layout = 'ajax'; $kleur = "%".$color."%"; $condition = "'manacost like' => $kleur"; $conditions = array( 'set' => $set, $condition ); if ($foil == 'nonfoil'){ if($color == 'all'){ $cards= $this->cards->find('all',array...

javascript - jQuery / JS - add div to div per x seconds -

i have problem. don’t know enough javascript. can know nothing. need 1 script add ‘div’ ‘p’ per 1-5 seconds. tried did mistakes. :/ what want add (per seconds), it's one: <img src="/flags/{random flag/number (1-100)}</.png" alt=""> user stole <i>{random number (1000, 2000, 3000) array)}</i> <img src="strawberry.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="orange.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="apple.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="banana.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="sandwich.png" class="nob img-rounded "> wher...

html5 - How to set scroll for responsive table body -

i want view limited records in table body if limits exceeds should have scroll , thead should remains fixed. finally got answer this... #custom-table th { text-align: left; width: 14.75%; border-bottom: 0; } #custom-table td { width: 15%; } #custom-table tr { display: block; width: 100%; } #custom-table tbody { display: block; height: 158px; overflow: auto; }

Android resize image from gallery before upload via php -

i've application uploading image choosen gallery. before upload show selected image in imageview , let user choose image or upload current. downscale image if widht or height bigger 1000 i'm able scale bitmap in imageview. me or give me suggestion? here code, appreciated, in advance. protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == 1 && resultcode == result_ok) { //bitmap photo = (bitmap) data.getdata().getpath(); //uri imagename=data.getdata(); uri selectedimageuri = data.getdata(); imagepath = getpath(selectedimageuri); bitmap bitmap=bitmapfactory.decodefile(imagepath); int width = bitmap.getwidth(); int height = bitmap.getheight(); if(width>=1000 || height >= 1000){ width = width/3; height = height/3; bitmap = bitmap.createscaledbitmap(bitmap, width, height, false); } imageview....

ios - How to make pagination in tableView? -

Image
i have implemented tableview in app, have large number of data, want show data in pagination, means 10 rows in 1 screen, user can paginate , show 10 rows in next screen. paging means want scrolling is possible using existing component? or have create custom controller? if process it? var allobjectarray: nsmutablearray = [] var elements: nsmutablearray = [] var currentpage = 0 var nextpage = 0 override func viewdidload() { super.viewdidload() var = 0; <= 500; i++ { allobjectarray.addobject(i) } elements.addobjectsfromarray(allobjectarray.subarraywithrange(nsmakerange(0, 20))) } override func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) { println(indexpath.row) nextpage = elements.count - 5 if indexpath.row == nextpage { currentpage++ nextpage = elements.count - 5 elements.addobjectsfromarray(allobjectarray.suba...

jvm arguments - Is it possible to "fool" java that an environment variable is set from the command line -

i'm running in environment can pass parameters not set environment variables using normal commandline. i set environment variables nevertheless. there alternative way "fool" java environment variable set, e.g. using -d parameters? (i'm running spark in oozie through hue; in cloudera stack). the java command doesn't seem allow that. has -d parameter, sets java 'system properties' : $ java -help 2>&1 | grep -a1 '\-d' -d<name>=<value> set system property java system properties sort of java properties. environment variables, java properties key-value pairs , aren't same thing environment variables: if java application reacts specific environment variable, setting system property of same name won't have effect unless application explicitly reacts property, too. if environment allows run arbitrary java applications , if allows java applications execute other processes, can write l...

Weird behavior on cqlsh while creating table in cassandra from putty -

Image
i trying create 1 table in cassandra using cqlsh having following syntax. create table usertracking ( cwc text, cur_visit_id text, cur_visit_datetime timestamp, cur_visit_last_ts bigint, prev_visit_datetime timestamp, prev_visit_last_ts bigint, tot_page_view bigint, tot_time_spent bigint, tot_visit_count bigint, primary key (cwc) ); but reason when paste syntax on cqlsh automatically converted following syntax. can please explain behavior. using putty connect cassandra cluster. running on ubuntu. the problem copy pasting editor newline character @ end of every line. write query in single line , copy , paste putty. also if on *nix machine use terminal ssh rather using putty. have better text editing features putty

java - Integer / Double value -

i trying write code says whether cheapskate, patron, etc depending on amount donate. this code: public class donor { public static void main(string [] args) { system.out.println(" % java donor"); system.out.print("enter amount of contribution: $"); java.util.scanner sc = new java.util.scanner(system.in); double money = sc.nextint(); if ( money >= 0) { if ( money < 15 ) { system.out.println("cheapskate!"); } if ( money >= 15 && money < 200) { system.out.print("friend!"); } if ( money >= 200 && money < 1000) { system.out.println("supporter!"); } if ( money >= 1000 && money < 10000) { system.out.println("patron!"); } if (money >= 10000) { system.out.println("benefactor!"); } } else { system.out.println("you have entered invalid value!"); } ...

java - RMI error while trying to get an applet from the server -

i'm working on simple rmi example, client try calling applet server. i've defined class called "simpleapplet" (the extends applet), on client side have 2 files: java files of server interface , 1 client code. on server side, have 3 files: 1 applet, 1 server interface , 1 implementation. server runs fine, error on client side, here is: java.rmi.unmarshalexception: error unmarshalling return; nested exception is: java.lang.classnotfoundexception: simpleapplet (no security manager: rmi class loader disabled) i think there's issue applet object, it's not recognized client, tried using casts (with applet) still have issue. happen know how solve problem ? ! here client side code public class swingcall { static applet a; public static void main(string[] args) throws exception { myrmiserverintf obj = (myrmiserverintf) naming.lookup("rmi://10.100.162.203:1100/newrmiserver"); a= (applet) obj.getapplet(); ...

Is there any way to control the duration of Interactive Mode on Android Wear watch faces? -

i creating custom watch face android wear, feature animations , transitions. problem is, when going interactive mode, watch reverts ambient mode shortly after, not allowing animations complete. know there battery , performance considerations, experimental project. so, there way control how long watch face stays on interactive mode, or somehow delay reverting ambient mode? thanks! you can hold partial wake lock , keep animating. if keep 200ms after enter ambient, not end of world. lighting off, display should continue work , finish animation. after release wake lock.

python - How to read field from JSON encoding of XML message -

is there way can errormessage tag response using code in python? { "movies_search":{ "@xmlns":"http://www.ourmoviest.com/mv", "@xmlns:xsi":"http://www.w3.org/2001/xmlschema-instance", "@xsi:schemalocation":"http://www.ourmoviest.com/mv mv.xsd ", "error":{ "errormessage":"we cannot proceed search", "statuscode":"00004" } } } the following python script, import json respstr = """ { "movies_search":{ "@xmlns":"http://www.ourmoviest.com/mv", "@xmlns:xsi":"http://www.w3.org/2001/xmlschema-instance", "@xsi:schemalocation":"http://www.ourmoviest.com/mv mv.xsd ", "error":{ "errormessage":"we cannot proceed search", "statuscode...

field - Woocommerce checkout add information after country -

maybe can me. looking way add field or div-container additional information after country selection in checkout section. "for shipping other countries, please contact at..." is there way in functions.php? thanks in advance! i don't know functions.php, if don't mind use jquery can add code scripts $('#billing_country_field').after('<span>for shipping other countries, please contact at...</span>');

opengl - Voxel rendering optimization with geometry shader -

i programming c++ + sdl2 + glew + opengl 4.1 small voxel game little bit minecraft. i trying optimize voxel rendering can. i slide world chunks , chunks blocks. each chunk contains 16x16x16 blocks. now if edit chunk(remove/place block) rebuild complete chunk , neighbor chunk , upload vao's , vbo's graphic card. now minimize vertex data have transfer cpu gpu use geometry shaders. first of all, idea? i mean every frame geometry shader has calculate primitive each voxel face. however, programmed vertex shader so, have pass 1 vertex each block face. to make possible used vec4. the first 3 elements(x, y, z) used block position , 4. element (w) used indicate in direction face showing. 0 means back, 1 means front, 2 means left, 3 means right, 4 means bottom, 5 means top. please ignore uv , normal now. further more upload glbyte's instead of glfloat's. is idea? what better/faster way? #version 410 uniform mat4 un_combined; lay...

dns - Is it possible to have a custom domain on Heroku but handle the email accounts on another service? -

i apologize in advance if stupid question. have app hosted on heroku custom domain , setting outgoing email seems bad time. i have web hosting account host gator. curious if it's possible still have custom domain on heroku while handling sites email accounts elsewhere? thanks, ryan yes. heroku doesn't handle dns itself. point domain's and/or cname records heroku's servers using current dns handler; mx (mail) records set independently of , cname records (also using current dns handler).

Java Swing - NullPointerException when adding widgets with constraints -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i started learn swing , , encountered nullpointerexception when try use constraints in adding widgets content. error trace: nullpointerexception @ chapter.pkg6.improvedforcecalculator.<init>(improvedforcecalculator.java:56) @ chapter.pkg6.improvedforcecalculator.main(improvedforcecalculator.java:36) here code: import java.awt.container; import java.awt.gridbaglayout; import java.awt.gridbagconstraints; import java.awt.font; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jtextfield; import javax.swing.jbutton; import javax.swing.joptionpane; public class improvedforcecalculator { private jframe frame; private container content; private gridbagconstraints const...