Posts

gnuplot - Manage X label in GNU -

i have x-label range this: 2.0237*e^10 15.055*e^10. when draw graph x-label values overlap. how can manage without changing font size? use "set xtics" define larger distance between xlabel major tics. can use "set format x " define more suitable format x-axes: for example: draws xlabel tics @ 2*e^10, 4*e^10, 6*e^10... set xtics 2e10 this display label tics in more compact form: set format x "%1.0e" you might find helpful: http://heim.ifi.uio.no/inf3330/scripting/doc/gnuplot/kawano/tics-e.html#3.1

Java - generic types -

i trying create binary tree using generic typing , have error not understand. tried 2 ways of coding , second worked. not understand why first failing. i have following common code: public class mytreea <t extends comparable<t>> { class bt_node<t extends comparable<t>> { t value; bt_node<t> left; bt_node<t> right; bt_node(t node_value) { this.value = node_value ; left = null; right = null; } } the difference in insert procedure: works: private bt_node<t> insert(bt_node<t> node, bt_node<t> newnode) { if ((node.value).compareto(newnode.value) == 0) { . . . } but fails private bt_node insert(bt_node node, t value) { if (value.compareto(node.value) == 0) { . . with: mytreea.java:28:...

Can I access the colours of the R console, from R code? -

i have 4 sessions of r, each running different piece of software, between must change often. helpful if colour of console background (or text) different depending on code loaded, automatically, locate window on (cluttered) desktop , avoid typing in wrong commands wrong console in fast moving financial activities. any way within r code? menuing , changing colours manually it's tedious, that, under windows, r colour dialogue box 4 lines deep , there 500 colours. this not direct answer question, might still helpful. using multiple workspaces solve problem. if have different r sessions running, having them on different workspaces (or desktops) separates them nicely. platforms work on (os x , linux) have native support workflow, there must tools windows (a few years there @ least).

PHP Geek needs Database Design Assistance -

like developers think striving create optimal code , database schemas. however - ive got feeling, im on engineering database schema want create. i have web app that, in short space of time, hold lot of users. users in form of customers, suppliers, system users. in industry grow rapidly. in previous schemas have users separated in different tables. however, thinking of going down route of having 1 table called: people. there these tables: people, contact details, residences they related via pivottables ie: pivotcontacts pivotresidences. my question considered good/bad design.? on thinking, on engineering simple setup. the table people grow exponentially , hold alot of data - , other tables relate it. i welcome opinions. will design scale 100 thousand records , maintain moderate speed.? * start 1000 records , grow approx 100,000 in 1 year. for users can log-in, , maybe traced (last login, failed password retries) optimal have small table , maybe separa...

sml - Counting how many elements in a sorted list, that are larger than a given predicate -

i'm trying create function finds how many elements bigger first element divided 2 in given sorted list. example given list [3,3,4,5,6,7,8,9,11] , first element 3 , numbers larger divided 2 7,8,9,11 function returns 4 . i have done far doesn't work. a element first of list , given in order easier. fun findlarger [] = | findlarger [] = 0 | findlarger [x] = 0 | findlarger (x::xs) = let val = ref a; in if !a < x/2 length (xs) + 1 else findlarger (a, xs) end i don't know start pointing out issues code. seems have misunderstood basics of functional programming. first off should not using references (unless know doing, @ still wrong), should use recursion. you haven't declared function take same number of arguments. in first clause, have defined 2 curried arguments, in rest of clauses have 1 argument, , in second last line of code, calling function pair argument. your first function clause don't have body. ...

java - getting exception when retrieving data from database org.hibernate.hql.ast.QuerySyntaxException: -

Image
iam new jpa, iam trying create ejb 3.0 + jpa (hibernate) application. when iam persisting data database getting below exception. sessionbean method: @persistencecontext private entitymanager em; public void showcustdetails(){ //system.out.println(em.getproperties()); //entitymanager em = emf.createentitymanager(); list customer = em.createquery("select c customer c").getresultlist(); system.out.println("list size:::"+ customer.size()); for(object c:customer){ customer customers = (customer) c; system.out.println("name ::::" + customers.getname() + "::customer id ::"+customers.getcustomer_id()+"::email::"+customers.getemail_id()+"::address::"+customers.getaddress()+ ":::ph number::"+customers.getphnumber()); } } customer class(entity class) package retail.model.vo; import java.io.serializable; import...

c# - Getting specific value from specific key of Document inside document -

i have document this { "_id": { "$oid" : "51776bca40bcc60038000001" }, "username": "domi55", "password": "test", "character": { "job": "warrior", "level": 1, "skill": { "skillid": "1001", "skillname": "blade dance", "levelrequirment": 1 } } } } how "job" value , "skillname" value in c#? i'm using mongodb , mongodb c# driver using json.net dynamic obj = jsonconvert.deserializeobject(yourdoc); console.writeline("{0} {1}", obj.character.job, obj.character.skill.skillname); or using javascriptserializer var obj = new javascriptserializer().deserialize<dynamic>(json); console.writeline("{0} {1}",obj["character...

sql - COUNT ifnull mysql query -

i have 2 tables in database, fleets , personnel_onboard_fleets. trying list of of fleets (which works) , count how many personnel onboard each fleet (which doesn't). however, isn't showing results if there aren't personnel onboard. select f.*, count(pof.id) onboard fleets f, personnel_onboard_fleets pof f.fleet_id = pof.fleet_id order f.status i expecting 2 results, 1 fleet 2 people on board , 1 0 people onboard. 1 result. have tried use following select f.*, ifnull(count(pof.id), 0) onboard fleets f, personnel_onboard_fleets pof f.fleet_id = pof.fleet_id order f.status i cant see wrong query, there else needs added show fleets 0 persons onboard. my original query before count shows fleets fine, know count. this driving me crazy! appreciated!! try: select f.fleet_id, count(pof.id) onboard fleets f left join personnel_onboard_fleets pof on f.fleet_id = pof.fleet_id group f.fleet_id order f.status;

internet explorer - Run silverlight application with a specific past date -

i run silverlight application inside internet explorer browser date other current system time. required in order use functionality of silverlight application available using particular date in past. i cannot change actual system time triggers automatic system restart after 15 minutes. don’t have control on since pc within corporate network. i’m not attempting circumvent security measures. there legitimate reason , current approach of working within 15 minute timeslot before system restart unacceptable. so far i’ve tried runasdate utility nir sofer worked command line not ie browser. any appreciated. alternatives if there no such tool how 1 go writting it. how intercept call system api , override custom code ?

c# - How do I upload to dropbox using dropnet? -

i using dropnet. have problem upload file dropbox. sure connection dropbox in fine. when changed method of upload create file , delete file method works fine. can not see problem why not uploading? use same api dropnet. protected void btn_upload_click(object sender, eventargs e) { if (fileupload1.hasfile) { if (session["dropnetuserlogin"] != null) { try { _client.usesandbox = true; _client.uploadfile("/", fileupload1.filename, fileupload1.filebytes); } catch (exception ex) { litoutput.text = "error in upload user login in session " + ex.message; } } else { litoutput.text = "session expired..."; } } else { litoutput.text = "you did not spec...

MVC 3 Razor treating string within javascript as html -

i have javascript function within cshtml file builds table, , adds div on page using jquery. i made couple of changes recently, , seems visual studio treating below html needs parsed. (error: unterminated string literal) footer = footer + "</td></tr></tfoot>"; i'm looking understand why happening - worked previously, , there other tags in function not show errors, below. var footer = "<tfoot><tr><td colspan='7'>"; i can around using code below instead, i'd rather find cause can fix properly. footer = footer + '@html.raw("</td></tr></tfoot>")';

How to use th SUM function to return the values from sqlite DB in android? -

in application, store amount details of company in sq lite db.for example om first position of db in name column-company 1,total column - 400,second position of db in name column-company 2,total column - 800,third position of db in name column-company 1,total column - 500.how sum company 1 details return total amount. my main coding is, string str = db.company_amount("company 1"); log.v("total", ""+str); my db coding is, string company_amount(string name){ sqlitedatabase db = this.getreadabledatabase(); string s = ""; cursor cursor = db.rawquery("select sum(key_amount) table_bill_details = ?", new string[] {string.valueof(name)}); if (cursor != null) { if (cursor.movetonext()) { s = cursor.getstring(1); return cursor.getstring(1); } cursor.close(); } return s; } it shows error,i don't know how return values.can 1 know please me solve problem. my logcat error 04-25 14:54:06.701: e/a...

multithreading - Is Java socket multi-thread safe? -

if have multiple java threads writing same socket instance simultaneously, affect integrity of objects read same socket? i.e., whether contents of objects messed etc. it's fine ordering of objects random. in general, there no guarantees. bits of different objects end getting interleaved on wire, rendering result indecipherable. therefore, need provide external synchronization. it interesting note single socket write @ os level not atomic. further discussion, see is safe issue blocking write() calls on same tcp socket multiple threads? , be careful sendmsg() family of functions .