Posts

Showing posts from September, 2014

java - Two overlapping rectangles -

i'm having lot of trouble figuring out wrong code. actually, i'm having difficult time solving problem of 2 rectangles overlapping. following code should, theoretically, work following rectangles: rect1: (2.5, 4) width = 2.5, height = 43 rect2: (1.5, 5) width = 0.5, height = 3 keep in mind can't use rectangle class solve problem. i've done calculated x-values left , right edges , y-values top , bottom edges of both rectangles. i'm first considering -- , know not cover possible cases -- scenario in r2 within r1. note (x1, y1) , (x2, y2) signify centers of rectangles 1 , 2, respectively. right1 = x1 + w1/2; left1 = x1 - w1/2; bottom1 = y1 - h1/2; top1 = y1 + h1/2; right2 = x2 + w2/2; left2 = x2 - w2/2; bottom2 = y2 - h2/2; top2 = y2 + h2/2; overlap = ( (right2 < right1 && right2 > left1) && (bottom2 > bottom1 && bottom2 < top1) && (left2 > left1 && left2 < right1) && (top2 < top1

algorithm - Faster Queries in plane -

problem have support q queries of set of n 2-d points in cartesian plane lying in [0,m]x[0,m]. points given in advance. each query ask me count number of points enclosed in rectangle (x1,y1)*(x2,y2). (axis aligned rectangle). constraints 0 < m < 10000 i want know more algorithms used. can perform these queries more efficiently using information points , queries given in advance , coordinates of points bounded etc. variant : instead of n points begin with, can add n axis-aligned rectangular patches of points n add operation in our data structure , answer same queries. [lazy segment trees kind of approach]. this classic 2d binary indexed tree problem. binary indexed tree can give how many dots in rectangle (0,0) (x,y), if want find out how many dots in rectangle indicated (x1,y1) , (x2,y2), first have find coordinates of other 2 corner points of rectangle. let pul, pur, pbl, pbr 4 corner points of rectangle representing upper left corner, upper right corn

c# - Generic property-list with any generic argument -

i need instantiate list-property generic type can anything. so main -method looks this: (in real, parsingobject<t> objects service) public static void main() { parser parser = new parser(); parser.addanobject( new parsingobject<int>{propertyname = "firstproperty", active=true, defaultvalue=1} ); parser.addanobject( new parsingobject<bool>{propertyname = "secondproperty", active=false, defaultvalue=false} ); parser.parse(); } parsingobject gets type (i think string, bool, int,...) generic. in parser need add object list<parsingobject<t>> like: public class parser { private readonly list<parsingobject<t>> _listofobjects = new list<parsingobject<t>>(); public void addanobject<t>(parsingobject<t> item) { _listofobjects.add(item); } public void parse() { foreach(var item in _listofobjects.where(w=>active))

sql - Oracle Query not Working -

oracle query not working. please specify wrong in query? (select hacker_id,challenge_id, max(score) soc submissions group hacker_id,challenge_id having max(score)>0) t2; please read @oldprogrammer comments. anyway, think should work you select hacker_id,challenge_id, max(score) soc submissions group hacker_id,challenge_id having max(score)>0;

javascript - RxJS the switch function -

could please explain switch function in rxjs do? read documentation not configure out, how works exactly. if have observable stream of observable values, switch flatten nested observable single stream of observable values. feed values recent inner stream produced outer stream. it easier example. have textbox controls data receive ajax query. lets call textbox page number. goal display results of ajax query page user types text box. can use switch construct observable stream of data: function getpagedata(pagenumber) { // return ajax query page return $.ajax("/url?page=" + pagenumber)); } var pagenumbervalue = // observable of page number values coming text box // observable of observables of page data var datastreamofstreams = pagenumbervalue .map(pagenumber => getpagedata(pagenumber); // everytime change pages, "switch" new ajax call // , return results new call. var datastream = datastreamofstreams.switch(); i hope helps.

java - Android Data binding issue Binding adapter call twice -

i have simple imageview in layout , have api gives me image url. integrate data binding in layout. after parsing api i'm setting model through line binding.setuserinfo(memberobj.getmemberdata()); now have binding adapter imgurl code written. custom binding adapter calls twice when activity start , after parsing api. now want notify ui after api has been parsed. here code of xml activity_main.xml : <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"> <data class="mainbinding"> <variable name="userinfo" type="com.myapplication.retrofit.pojo.imgtest"/> </data> <relativelayout android:layout_width="match_parent" android:layout_height=&quo

c# - FileHelper can't handle ReSharper sorting variables in its classes -

i have code doing this: var engine = new filehelperengine<sampletype>(); var records = engine.readstring("asdf|fdsa"); var showstring = records[0].field1 + records[0].field2; the sampletype class looks this: [delimitedrecord("|")] public class sampletype { public string field2; public string field1; } the resultset follows: records[0].field1 has value fdsa records[0].field2 has value asdf if run resharper cleanup sort variables alphabetically. , sampletype class this: [delimitedrecord("|")] public class sampletype { public string field1; public string field2; } but logic of program has changed. records[0].field1 has value asdf records[0].field2 has value fdsa is there way tell classes order of defined variables irrelevant? defining order of variables relevant, contrary other class have ever seen, find disturbing , strange. i'm not sure, think want way make filehelpers use explicitly-speci

mongodb - Export data by following JSON Schema -

i have many fields on mongodb, want export these out appear on json schema. this json schema, want these fields .csv: { "names": [ { "source": 0, "order": 0, "version": 0, "registrationdate": "", "enddate": "", "name": "", "language": "" } ], "auxiliarynames": [ { "source": 0, "order": 0, "version": 0, "registrationdate": "", "enddate": "", "name": "", "language": "" } ], "addresses": [ { "source": 0, "version": 0, "registrationdate": "", "enddate": "", "careof": "", "street": "",

Is Android device's locale based solely on Language setting? -

if device chooses french language, locale automatically set french well? or depend on user's current location? for ios, language , region separate settings while in android, seems choose language not region. comparison: android - chooses french language, locale becomes fr-fr ios - chooses english language, french region, locale becomes en-fr for android there other way retrieve device's region? i have been googling around couldn't find source of information on topic yet. in android can select portuguese (portugal) or portuguese (brasil) translates pt-pt , pt-br. in case there 2 different languages, find redundant, because better way of handling separate languages , regions. however can programmatically change language , region, setting: new locale("pt, "pt"); you can read more programmatically changing language here: http://gunhansancar.com/change-language-programmatically-in-android/ http://www.sureshjoshi.com/mobile/changing-a

apache - PHP code is not being executed, instead code shows on the page -

Image
i'm trying execute php code on project (using dreamweaver) code isn't being run. when check source code, php code appears html tags (i can see in source code). apache running (i'm working xampp), php pages being opened php code isn't being executed. does have suggestion happening? note: file named filename.php edit: code..: <? include_once("/code/configs.php"); ?> sounds there wrong configuration, here few things can check: make sure php installed , running correctly. may sound silly, never know. easy way check run php -v command line , see if returns version information or errors. make sure php module listed and uncommented inside of apache's httpd.conf should loadmodule php5_module "c:/php/php5apache2_2.dll" in file. search loadmodule php , , make sure there no comment ( ; ) in front of it. make sure apache's httpd.conf file has php mime type in it. should addtype application/x-httpd-php .php . tells

hadoop - Unable to Read JSON file using Elephant Bird -

trying load json file having null values in using elephant-bird jsonloader . sample.json {"created_at": "mon aug 22 10:48:23 +0000 2016","id": 767674772662607873,"id_str": "767674772662607873","text": "kpit image result https:\/\/t.co\/nas2znf1zz... https:\/\/t.co\/9tnelwtivm","source": "\u003ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003etwitter web client\u003c\/a\u003e","truncated": false,"in_reply_to_status_id": 123,"in_reply_to_status_id_str": null,"in_reply_to_user_id": null,"in_reply_to_user_id_str": null,"in_reply_to_screen_name": null,"geo": null,"coordinates": null,"place": null,"contributors": null,"is_quote_status": false,"retweet_count": 0,"favorite_count": 0,"entities": {"hashtags": [],"urls"

Telnet commands automation through File or String in Java -

i automating telnet commands using apache.commons.net in java. able run program standalone, nature of telnet interactive, how can run telnet commands through file or string variable? there 2 ways handle interactive command-based interface programatically. the simple way: have list of commands, , send 1 after small delay between them. the complicated way: have simple rule-based system, read remote system , matches text against 1 or more rules. depending on matching rule, perform action, sending command. the first way indeed simple, doesn't handle errors or problems well. if there problem, not notice, continuing send commands may make problems worse. the second way in turn implemented simple, reading text remote system, , if doesn't match expect bail. handled simple finite state machine . suitably designed , implemented might able handle connection troubles gracefully.

powershell - The term 'cpdf' is not recognized as the name of a cmdlet, function, script file, or operable program -

i have downloaded cpdf because have batch work on large number on pdfs. the executable on desktop: c:\users\admin\desktop\cpdf.exe i running powershell ise on windows 7 administrator. have set set-executionpolicy unrestricted . my prompt @ desktop location: ps c:\users\ftsadmin\desktop> if try run cpdf: ps c:\users\ftsadmin\desktop> cpdf or ps c:\users\ftsadmin\desktop> cpdf.exe , following error: the term 'cpdf.exe' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ line:1 char:9 + cpdf.exe <<<< + categoryinfo : objectnotfound: (cpdf.exe:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception i don't understand. when doing same in windows xp vm, works (but prefer windows 7+ because of powershell ise). any ideas i'm missing? unlike cmd powershell not automatically includ

c# - Can't add value into Dictionary containing dictionaries of dictionaries -

i have dictionary: public dictionary<string,dictionary<string, dictionary<datetime, float>>> cpuresults = new dictionary<string,dictionary<string, dictionary<datetime, float>>>(); now, i'd add data: cpuresults.add("key 1", new dictionary<string, dictionary <datetime, float>>().add("key 1", new dictionary<datetime,float>())); actually, don't want keys be: key 1, key 2, etc. - not complicate named keys this. well, important thing is, won't compile. have no idea did wrong - took me while come this, still doesn't work. the dictionary<tkey, tvalue>.add method doesn't return dictionary. instead, initialize inner dictionary this: cpuresults.add( "key 1", new dictionary<string, dictionary <datetime, float>> { { "key 1", new dictionary<datetime,float>() } });

javascript - Phone number validation for specific format -

i have below regex check valid phone number in different formats, support arabic numbers: /^(\+?\s{0,2}([0-9\u0660-\u0669]{1,3}))?[-,.\s]{0,2}\(?[0-9\u0660-\u0669]{1,5}\)?[-,.\s]{0,2}[0-9\u0660-\u0669]{1,5}[-,.\s]{0,2}[0-9\u0660-\u0669]{1,6}\s{0,2}\+?/ but returning false 1 of valid number +(91)-20-xxxxxxxx the first optional group matches + needs optional ( , ) : ^(\+?\(?\s{0,2}[0-9\u0660-\u0669]{1,3}\)?)?[-,.\s]{0,2}\(?[0-9\u0660-\u0669]{1,5}\)?[-,.\s]{0,2}[0-9\u0660-\u0669]{1,5}[-,.\s]{0,2}[0-9\u0660-\u0669]{1,6}\s{0,2}\+? ^^^ ^^^ see regex demo note might re-check pattern, trailing \+? looks rather suspicious, , there no $ (end of string anchor) @ end of pattern (if plan match whole string, need anchor).

javascript - how to hide this notice -

this question has answer here: php sessions have been started 11 answers i want ask how hide below notice. notice: session had been started - ignoring session_start() in c:\xampp\secxampp\htdocs\mksfinalasd\web\check.php on line 2 my first code check1.php <?php session_start(); if(isset($_session['username'])) include ("preorder.php"); else include("login.php"); ?> this sec code check.php. <?php session_start(); if(isset($_session['username'])) include ("top2.php"); else include("top.php"); ?> the problem start when click book button in code <!-- author: w3layouts author url: http://w3layouts.com license: creative commons attribution 3.0 unported license url: http://creativecommons.org/licenses/by/3.0/ --> <!doctype html> <html> <head&g

ruby - Float with 'unnecessary' digits -

i need make number out of string. use known maneuver looking this: float(string_var) rescue nil this works nicely, have tiny, little problem. if string "2.50" , variable 2.5 . possible create float object 'unnecessary' 0 digit @ end? can literally translate "2.50" 2.50 ? in short, answer no, given question, float, when examined, use float's to_s function, eliciting answer without trailing zeroes. float give numeric value can interpreted way wish, though. in example, will float value (given string parsable float). asking then, how display value with trailing zeroes. that, turning float value string. easiest way accomplish use format given 1 of respondents, namely string_var = "2.50" float_value = float(string_var) rescue nil # 2.5 with_trailing_zeroes = "%0.2f" % float_value # '2.50'

linux - Find string in tar.gz and extract result -

is there way find files in tar.gz archive containing specific 'string', , extract these files specified folder? zgrep -a 'stringtofind' inarchive.tar.gz gives me result in files string can found, cannot without extracting entire archive. is there way around this? edit: dont need use zgrep, option out there suffice me, relatively fast operations (assuming gnu tar, think) try like zgrep -a 'stringtofind' inarchive.tar.gz > your.list then tar zxf inarchive.tar.gz --files-from=your.list

javascript - Showing message before page refresh using jQuery -

i want display ajax result message before page refresh, wrong. code this: $.ajax({ cache: false, type: "post", url: "@(url.routeurl("dummyrequest"))", success: function (data) { if (data.success) { $('#dummy-notification').text(data.result).fadein("slow").delay(3000).fadeout("slow"); setinterval(function () { location.reload(); }, 5000); } else { $('#dummy-notification').text(data.result).fadein("slow").delay(3000).fadeout("slow"); /*setinterval(function () { location.reload(); }, 5000);*/ } }, error: function (xhr, ajaxoptions, thrownerror) { $('#dummy-notification').text("something went wrong.").fadein("slow").delay(3000).fadeout("slow"); } }); my code working fine on else situation.

encryption - Send an encrypted data through kafka -

i using aes - cbc mode encrypt message, send through kafka. how can consumer decrypt message while does't have key , initial vector. i have confused if have use key exchange here, , can consumer send producer? any advise thanks

c# - Flatten xml with text and element nodes using LINQ to XML -

i need process/flatten incoming xml in fashion. source xml: <paragraph> <content stylecode="underline">is</content> <content stylecode="italic"> <content stylecode="underline"> <content stylecode="bold">hello</content> world </content> test</content> <content stylecode="bold">example</content> here. </paragraph> target xml: <paragraph> <content stylecode="underline">is</content> <content stylecode="italic underline bold">hello</content> <content stylecode="italic underline">world</content> <content stylecode="italic">test</content> <content stylecode="bold">example</content> here. </paragraph> i prefer use linq xml realize children text nodes next content element nod

gradle - Android: Does changing API level to 23 affect the way a permission in the manifest is set up? -

this question has answer here: android permission doesn't work if have declared it 10 answers i not expert in android development please bear me. i change app android 19 23. android api 23 changed way permissions work. happens in api 23 instead of asking permissions in app installation, asks permission on run time. my question need change way permission set in andoid manifest? because tried change api 23 in build.gradle , seems still work no differences. no. targetsdkversion , minsdkversion etc set in code has no effect on how permissions handled, rather dependent on device target app running. android changed way permissions asked in android 6.0(api 24 devices). have make ask permissions @ runtime. official documentation asking runtime permissions user.

javascript - drag lines in html map and display difference between lines -

Image
i've been checking different questions topic none of them gives me convincing answer. have map in i've plotted 4 axis doing following: function axis() { var bounds = map.getbounds(); var necorner = bounds.getnortheast(); var swcorner = bounds.getsouthwest(); // horizontal top axis var polylinecoordinates = [ new google.maps.latlng(necorner.lat()-0.0002, necorner.lng()), new google.maps.latlng(necorner.lat()-0.0002, swcorner.lng()), ]; var path = new google.maps.polyline({ clickable: false, geodesic: true, path: polylinecoordinates, strokecolor: "#ff0000", strokeopacity: 1.000000, strokeweight: 0.8 }); path.setmap(map); // horizontal low axis var polylinecoordinates = [ new google.maps.latlng(swcorner.lat()+0.0002, necorner.lng()), new google.maps.latlng(swcorner.lat()+0.0002, swcorner.lng()), ]; var path = new google.maps.pol

Disable cygwin temporarily -

i want disable cygwin temporarily without uninstalling (e.g. duration of batch script). i hoping there simple way, e.g. environment variable like $> set cygwin=off or internal cygwin command like $> cygset off right using quick , dirty solution invalidates cygwin directory in windows path with set path=%path:cygwin=% of course corrupt other pathes have cygwin in it.

regex - How to improve the Xpath using the regular expression -

i using seleniumwebdriver identify elements , in 1 of instance, have defined 1 of xpath mentione below. //div[contains(@id,'confirm1_container') or contains (@id,'confirm2_container') or contains(@id,'confirm3_container') or contains (@id,'confirm4_container')or contains (@id,'permanentsuppressionpopup_container')] the reason this, should pass 1 of them , identify element. the question here, there easy way or suggestion improve xpath instead of having multiple or operators.if see theid's change "number" in between confirm , _container. i did go through old suggestion talk xpath 2.0 functions cannot used in case. //div[contains(@id,'confirm1_container') or contains (@id,'confirm2_container') or contains(@id,'confirm3_container') or contains (@id,'confirm4_container')or contains (@id,'permanentsuppressionpopup_container')] since above mentioned xpath uses or expression,

Divide queryset on 'read' / 'unread' in Django -

i'm trying create badge flag status 'read'/ 'unread' depending on users action (request). models class post(models.model): title = models.charfield(max_length=120) body = models.textfield() def get_absolute_url(self): return "/%s" %(self.id) ... class comment(models.model): post = models.foreignkey(post) ... view def list(request): qs_posts = post.object.all() ... template {% post in qs_posts %} <a href="{{ post.get_absolute_url }}" class="btn btn-primary">view</a> <p>{{ post.body }}</p> <p> messages: <span class="badge">{{ post.comment_set.count }}</span></p> <p> unread messages: <span class="badge red">{{ post.comment_set.count }}</span></p> {% endfor %} i'm trying display count of 'unread'. don't need display specific user request. so there few d

javascript - Loading issue on Google Place Autocomplete API Html -

i have use google map place autocomplete api web. for code , output click here. <form> <input id="origin-input" type="text" class="form-control" placeholder="from"/> <br/> <input id="destination-input" type="text" class="form-control" placeholder="to"/> <br/> <div> <button id="now" onclick="selectdatetime(this.id)">now</button> <button id="later" onclick="selectdatetime(this.id)">later</button> </div> <br/> <div id="now_later" > </div> <button onclick="handlemap()">submit</button> <script> function selectdatetime(elemid){ var html = ''; if (elemid == "now") { html += '<div class="btn-group btn-group-justified" id=&

vb.net - How would I refactor my code to stop passing a class object everywhere? -

i working on improving design of insurance quote engine. there no design documentation involves passing in 'quotedata' class object every sub, , because of design choice object has have number of variables 'reset' doesn't accidentally carry on other scheme-specific code blocks. after processing input data calls out each scheme engine block, example: pcengine: call engine201611pc71(pobjquote) engine201611pc71: call scheme1(pobjquote) scheme1: call arearating(pobjquote) call vehiclegrouprating(pobjquote) call checkouteachdriver(pobjquote) it should noted there several scheme subs, each on dozen other sub calls related scheme rules. ideally want have quotedata instance each scheme quote we're reusing same 1 everything; that's thousands of scheme quotes 1 instance of quotedata. how go refactoring? struct being passed byref everywhere (with 1000+ members)!

angularjs - Directive causing $scope to go undefined when it fires off -

today tried hand @ writing directive in angular purely means make own "check if email exists" validation. however, when directive runs, clears out scope - rendering undefined , have no cooking-clue why. disabling directive causes scope not go lost when try submit form. can explain me why this? my html: <form class='form-horizontal' name="userform" novalidate> <div class='form-group' ng-class="{ 'has-error' : userform.emailaddress.$invalid && !userform.emailaddress.$pristine }"> <div class="col-sm-3"> <label class="control-label" for='emailaddress'>email address: </label> </div> <div class="col-sm-6"> <input class='form-control' type='email' id='emailaddress' name='emailaddress' ng-model='letmeknowemail' email-exists required/> <p n

How to check if all input values are empty in jquery each? -

i have each , need check if input fields empty , action. did following jquery(".page-template-sitecheckout .mainwrapper .shipping_addresses_checkout_view.checkout_shipping_column_withoutmargin .form-row.validate-required input").each(function () { var checkoutfieldsvalue = jquery(this).val(); if(checkoutfieldsvalue === ''){ jquery(this).parent().addclass('checkout_invalid_fields_parent'); jquery(this).addclass('checkout_invalid_fields'); }else{ jquery(this).parent().removeclass('checkout_invalid_fields_parent'); jquery(this).removeclass('checkout_invalid_fields'); jquery('.checkout_btn_prev_to_shipping').fadein().show(); jquery('.page-template-sitecheckout .mainwrapper .shipping_addresses_checkout_view').fadeout().hide(); jquery('.page-template-sitecheckout .mainwrapper .billing_info_checkout_view').fad

javascript - Looping through returned objects with Ajax success function, outputting to table -

Image
the console output current data being returned through ajax. in instance, 2 objects returned. basically, each object returned, want output/append values new table row. in instance, there 2 <tr> ... </tr> instances. my current success function far looks this: success: function(data){ // console.log(data); $.each(data, function(index, value) { $("tbody").append("<tr><td></td><td></td><td></td><td></td><td></td><td></td></tr>"); }); } i'm having trouble trying access each value in each object. know relatively simple .each function, i'm having trouble wrapping brain around in instance. you have inner loop again generate td records. $.each(data, function(index, values) { var tr="<tr>"; $.each(values, function(i,v){ tr= tr+ "<td>"+v+"</td>"; }); tr=

java - How to to get a concrete class from an hierarchical database structure -

Image
this database structure: i have abstractuser table common properties of role tables: nurse , doctor or other roles may added in future. i event table use abstract_user_id fk. i can associated abstractuser of event , question how can concrete class of abstractuser , way can come go through role tables(nurse, doctor, , more), , use fk(abstract_user_id) in tables check if abstractuser.id exist. is there better way this? i ask better ways cause seems have every time when need concrete class abstractuser , , cannot put method cuz return type not determined. repeat everywhere makes me feel code smell: abstractuser absuser = event.getabsuser(); if(existinnursetable(absuser)){ nurse n = getnursebyabsuser(absuser); ... //business logic }else if(...){ ... }else{ ... }

java - Maximum wait time in queue in ExecutorService -

is there way set maximum wait time on executor services ?! for example when pass 2 while true runnable singlethreadexecutor first 1 work forever , , second 1 wait ever. i expect got timeoutexception second runnable. public static void main(string[] args) throws ioexception { executorservice executor = executors.newsinglethreadexecutor(); (int = 0; < 2; i++) { int finali = i; executor.execute(new runnable() { @override public void run() { while (true) { try { system.out.println("#"+ finali + " runnable !"); thread.sleep(1000); } catch (exception e) { e.printstacktrace(); } } } }); } } is there way set maximum wait time on executor services

c# - Make entity framework available in all projects -

i have solution 3 class library's, 1 main , 2 referenced main. installed entity framework 6 nuget , can use ok in main project. models etc in other project when add: using system.data.entity; to top of other project error , cant use : dbcontext etc. when install via nuget on individual project basis? thanks you can manage nuget references single project or entire solution. right click on solution, click on "manage nuget packages solution..." install/remove/upgrade on entire solution.

PHP PDO Transaction Management across multiple write methods on different classes -

i need architecting appropriate approach managing transaction across multiple writes on multiple data access methods on different classes. consider following example code. pdo connection class class dbservice { private static $instance = null; public static function connect() { if(self::$instance === null) { try { self::$instance = new pdo("mysql:host=myservername;dbname=mydbname", 'myusername', 'mypassword'); } catch (\exception $e) { return null; } } return self::$instance; } protected function __construct() {} // prevent creating new instance (faking singleton) } order repository database access class orderrepository { public static function insert($data) { $con = dbservice::connect(); $stmt = $con->prepare('insert orders (customer_id, order_date) values (:custid, now())'); $stmt->execute(array(

java - How to snapshot a file in meantime modify it? -

now try conquer problem. problem have file may update in random time, clients download it, when clients download log file, need snapshot file. however, file may update when downing. how make sure copy of log file same user downed one? you need alter download process. when click download, should first copy file (your snapshot). then send them copy of file, not active one.

java - Magic Square program stuck in loop -

public static void main(string[] args) { printmagic(1); } public static void printmagic(int n) { int count = 1; int[] array = new int[n]; int magic = 0; while(count<=n) { for(int = 0; <= count; i++) { magic += i; if(math.sqrt(magic) == ((int)math.sqrt(magic))) { array[i] = magic; count++; } } } for(int = 0; i<array.length; i++) { system.out.println(array[i]); } } this program supposed print n number of magic squares(a number has integer square root, , sum of consecutive numbers.) ex. square root of 36 6 , 1+2+3+4+5+6+7+8=36 i passing method number 3 in main function, getting stuck in loop(the candy cane looking bar in bluej) is there im not seeing? try this: public static void printmagic(int n) { int count =

java - Can you explain the output of the following source code? -

as strings objects immutable in java how code output coming now heat , why not how neat ? in advance. class solution { public static void main(string args[]) { string[] words = {"how", "neat"}; twist(words); system.out.println(words[0] + " " + words[1]); } public static void twist(string[] w) { string temp = w[0].substring(0, 1); w[0] = w[1].substring(0, 1) + w[0].substring(1); w[1] = temp + w[1].substring(1); } } basically code doing is switching first characters of both first letters of each string. here step step explanation temp = 'h' w[0] = (temp + "ow") w[1] = heat (temp + "eat") edit : duffymo said: the array reference immutable, array points not. created new strings , made array point them. this means everytime reassigned, created new string.

ember.js - EmberJS Testing always passes -

new emberjs. i'm trying testing going.. having basic trouble seems. generated acceptance test -- taken straight ember site. import { test } 'qunit'; import moduleforacceptance 'ssd-admin-ember/tests/helpers/module-for-acceptance'; moduleforacceptance('acceptance | login'); test('visiting /login', function(assert) { visit('/xxxlogin'); andthen(function() { assert.equal(currenturl(), '/abclogin'); }); }); i run with: ember test --filter 'acceptance/login-test' this yields... ok 1 phantomjs 2.1 - jshint | acceptance/login-test.js: should pass jshint 1..1 # tests 1 # pass 1 # skip 0 # fail 0 # ok how can possibly pass? there no xxxlogin route etc. i must doing wrong (clearly). thanks in advance... you not running test. run jshint checks. , ok file. you not running test because filter statement wrong. should be: ember test --filter "acceptance | login"

excel - updated to IE explorer 11. Marco update is not working -

i updated ie11. made update report (macro) , it's giving me run time error... run-time error'13': type mismatch. when debug, below it's taking me - set pdocument = ie.document... can please. thank much set ie = createobject("internetexplorer.application") ie.navigate "https://famis.web.fedex.com/fwr/menus/menu-15-a.cfm?chgdiv=1&division=09" ie .top = 1 .left = 1 .height = 400 .width = 600 end ie.visible = true while ie.busy loop dim pdocument ihtmldocument2 dim pelements ihtmlelementcollection dim pelement ihtmlelement set pdocument = ie.document set pelements = pdocument.all worksheets("setup").range("a10").value = ie.locationname if ie.locationname = "sso login" make sure reference : microsoft html object library checked. you can go in tools/references in vba editor.

c - Use ImageWand component of ImageMagick lib with CMake -

i'm programming in c. want use imagemagick library fuction can't resolved. this cmakelist.txt file: cmake_minimum_required(version 3.3) project(webserver) set(cmake_c_compiler "/usr/bin/gcc") set(source_files io.c server.c lock_fcntl.c sig_handler.c thread_job.c msg_parser.c) set(lib http-parser-master/http_parser.c ) set(cmake_use_pthreads_init true) set(cmake_use_pthreads_init on) find_package(threads required) find_package(imagemagick components imagewand) include_directories(header) include_directories(http-parser-master) #include_directories(/usr/local/include/imagemagick-7/magickwand) include_directories(${imagemagick_include_dirs}) add_executable(server ${source_files} ${lib}) add_executable(client client.c io.c) add_executable(main main.c io.c) target_link_libraries(main ${imagemagick_libraries}) target_link_libraries(server threads::threads) and source main.c: #include <imagemagick-7/magickwand/magickwand.h> #include "basic.h

java - Incorrect multiplication result by XSLT with javax.xml.transform (0.2*0.8*0.8) -

i have xslt below : <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" encoding="utf-8" indent="yes"/> <xsl:template match="test"> <result> <xsl:value-of select="number(depth)*number(width)*number(height)"/> </result> </xsl:template> when test xslt against below sample file in altova xml or in w3cschool here , result 0.128 sample file: <?xml version="1.0" encoding="utf-8"?> <test> <depth>.8</depth> <width>.8</width> <height>.2</height> </test> however, things change when use java invoke xslt. result <result>0.12800000000000003</result> below simple code i'm using: import javax.xml.transform.*; import javax.xml.t

python - Odoo is not starting -

after database restore (from production server development one) local odoo server not starting not have other error message 2016-09-07 16:34:28,737 28304 info ? openerp: openerp version 8.0-20150625 2016-09-07 16:34:28,739 28304 info ? openerp: addons paths: [u'c:\\users\\nyulg\\appdata\\local\\openerp s.a.\\odoo\\addons\\8.0', u'c:\\users\\nyulg\\documents\\projects\\python\\odoo-8.0\\openerp\\addons', u'c:\\users\\nyulg\\documents\\projects\\python\\odoo'] 2016-09-07 16:34:28,739 28304 info ? openerp: database hostname: localhost 2016-09-07 16:34:28,739 28304 info ? openerp: database port: 5432 2016-09-07 16:34:28,739 28304 info ? openerp: database user: odoo 2016-09-07 16:34:28,956 28304 info ? openerp.service.server: http service (werkzeug) running on 0.0.0.0:8069 2016-09-07 16:34:44,471 28304 info ? openerp.addons.bus.bus: bus.loop listen imbus on db postgres 2016-09-07 16:34:54,956 28304 info ? openerp.addons.report.models.report: use wkhtmltopdf bin

php - Laravel 5.3, Class cant be found, While the route is correct -

i working on view composer : the problem right have, route im calling inside composerserviceprovider.php says cant find route viewcomposers/lespakketcomposer.php in config\app.php did add correct app\providers\composerserviceprovider::class, here code in composerserviceprovider.php <?php namespace app\providers; use illuminate\support\serviceprovider; use illuminate\support\facades\view; class composerserviceprovider extends serviceprovider { /** * bootstrap application services. * * @return void */ public function boot() { view::composer('*','app\http\viewcomposer\lespakketcomposer'); } /** * register application services. * * @return void */ public function register() { // } } here error: reflectionexception in container.php line 734: class app\http\viewcomposer\lespakketcomposer not exist the routes in folder structure does has solution problem? ( file