Posts

Showing posts from June, 2010

css - Unexpected resulting box height -

i'm setting: font-size: 13.44px line-height: 1.4881 multiplying those, gives 20.000064 but rendered/calculated height of box 19px why? http://jsbin.com/vokesukeye/2/edit?html,output as wrote in comment earlier: pixel values being rounded, first font-size 13px , result 19px, due nature of pixels (which whole pixel or no pixel, except possibly on retina displays)

How to check a checkbox in a jsTree (JavaScript) -

i'm using jstree , having problem preset checkboxes via data stored in cookie. i'm able store clicked checkboxes in cookie not know how check checkboxes data saved within cookie. maybe problem way create jstree because none of samples tried work. to give code understand did have @ submit function. iterates on of checked checkboxes , creates array of id's id field stored in metadata way , maybe that's reason why not work way expected. <script> $(document).ready(function() { $("#treeviewdiv").jstree({ "core": { // core options go here "multiple": true, // no multiselection "themes": { "dots": false // no connecting dots between dots } }, "json_data": { "data": [{ "data": "options", "metadata": { "group": "1" }, "ch...

compiler construction - llvm ir not behaving as expected -

i have following llvm ir , having spent best part of day trying debug cannot seem handle on it. program freezes (with) segfault @ loop when run on windows machine. ; standard declaration etc %gen__list__0 = type { i8*, i64, i64 } %const_array_offset = type { i64, i64 } ; other declaration etc @gbl_constant_59 = common constant [20 x i8] c"aaaaaaaaaaaaaaaaaaaa", align ; more function declarations etc define internal %gen__list__0 @gen__fun__elevate12(%const_array_offset*) { entry: %1 = alloca %gen__list__0 %2 = getelementptr %const_array_offset, %const_array_offset* %0, i32 0, i32 0 %3 = load i64, i64* %2 %4 = getelementptr %const_array_offset, %const_array_offset* %0, i32 0, i32 1 %5 = load i64, i64* %4 %6 = sub i64 %5, %3 %7 = mul i64 %6, i64 2 %8 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 0 %9 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 1 %10 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 2 store...

c++ - Can't access protected member variables of the most base class through std::unique_ptr in diamond -

i not advanced programmer. suppose there classic diamond inheritance: class base class a: virtual public base class b: virtual public base class last: public a, public b suppose base has variable, m_x , common both a , b , such 1 of a , or b , can called @ time, not both (which needed). around this, used: class last: public a, public b { private: std::unique_ptr<base> m_p; public: last(int i) { if (i) m_p = std::unique_ptr<base>(new a()); else m_p = std::unique_ptr<base>(new b()); } }; this fine, m_p->m_x cannot accessed anymore because says it's protected, both a , b call m_x in constructors directly, no problems. is known limitation or wrong way it? if it's wrong, solutions there? here code based on diagram found here (a bit lower on page): #include <iostream> #include <memory> class power { protected: double m_x; public: power() {} power(double x):...

scala map in a method argument can not add key-value -

in scala , how pass map method reference object can add key-value map. tried code, doesn't work. var rtnmap = map[int, string]() def getuserinputs(rtnmap: map[int, string]) { rtnmap += (1-> "ss") //wrong here } i understand, default, argument in method val, final in java, can provide safety. @ least should allow insert new entry. have idea ? welcome functional programming first of use case possible mutable map . have using immutable map because default available in scala. package scala.predef default available in scala , don't need import default. below code works excepted. import scala.collection.mutable.map val gmap = map[int, string]() def getuserinputs(lmap: map[int, string]) = { lmap += (1-> "ss") } below call change contents of gmap getuserinputs(gmap) here proof scala> import scala.collection.mutable.map import scala.collection.mutable.map scala> | val gmap = map[int, string]() gmap: scala...

assembly - Compare two values from the stack? -

this question has answer here: gas: many memory reference 3 answers i stuck in assembler code want compare 2 values of stack. x86, syntax at&t cmpl -4(%ebp), 4(%ebp) error: many memory references `cmp' i think not possible compare 2 values based on multiplier , ebp. suggestions ? you can compare 2 values in memory using cmpsd instruction. op wants equivalent to: cmpl -4(%ebp), 4(%ebp) he can placing addresses of memory locations of interest in esi , edi respectively, , using cmpsd memory-to-memory string-compare instruction : lea -4(%ebp), %esi lea 4(%ebp), %edi cmpsd (forgive non-expert abuse of at&t syntax). that's different in practice. other answers provided here (load value register , compare) more practical. if nothing else, solutions burn 1 register, , hack burns two. lesson: in assembler, ther...

join - IndexedRDD used in streaming context? -

i want use fast join operation in spark streaming context, such join b, fixed dataset reading file, b small streaming rdd read socket. i've tried common way provided spark, 5,000,000 rdd joining 10 streaming rdd costs 4 seconds. later i've tried using indexedrdd, can't make it. have following questions: is 4 seconds slow? can use performance tuning method such broadcast join improve? if slow, why? heard rdd's join operation linear search, true? can indexedrdd's join operation faster common way? how use indexedrdd in streaming context? i've tried way: streaming_rdd.transform{ rdd => indexed_data.innerjoin(indexedrdd(rdd)){(id, a, b) => (a, b)} it pass compile when running got error: java.lang.classcastexception: scala.collection.immutable.$colon$colon cannot cast [lscala.tuple2; i don't know if proper way use indexedrdd, , don't know caused error either. can 1 me?

c++ - is it possible for MurmurHash3 to produce a 64 bit hash where the upper 32 bits are all 0? -

looking @ https://github.com/aappleby/smhasher/blob/master/src/murmurhash3.cpp don't think wanted check. the situation this, if have key of 1,2,3 or 4 bytes, reliable take numeric value of bytes instead of hashing 8 bytes, or cause collision keys greater 4 bytes hashed murmur3? such property bad property hash function. shrinks function co-domain, increasing collision chance, seems unlikely. moreover, this blog post provides inversion function murmurhash: uint64 murmur_hash_64(const void * key, int len, uint64 seed) { const uint64 m = 0xc6a4a7935bd1e995ull; const int r = 47; uint64 h = seed ^ (len * m); const uint64 * data = (const uint64 *)key; const uint64 * end = data + (len / 8); while (data != end) { #ifdef platform_big_endian uint64 k = *data++; char *p = (char *)&k; char c; c = p[0]; p[0] = p[7]; p[7] = c; c = p[1]; p[1] = p[6]; p[6] = c; c = p[2]; p[2] = p[5]; p[5] = c; ...

osx - Mac Terminal, find and replace spaces command -

i'm writting list of commands within atom plugin, 1 of commands changes terminals working directory. however issue if there space within url not work, gets directory location current working path, can't slash spaces manually. you can set variables within terminal, there way replace spaces , slash them within terminal command? ** edit: ** following error code: the files /users/imac/dropbox/_themev2-folder-1157, /users/imac/we, /users/imac/finance, /users/imac/poor, , /users/imac/credit not exist. this code, %(project.root) get's replaced project file path. "command": [ "pkill -9 gulp", "echo 'quit: gulp process terminated!'", "echo 'start: new gulp process started, please wait...'", "open %(project.root)", "cd \"%(project.root)\"", "gulp" ] ** edit 2 ** quotes work now. please add answer. as alternative backslash escaping troublesom...

android - how do I transform a string of url's into drawable? -

i have arraylist follows: private void loadimages() { images = new arraylist<>(); images.add(getresources().getdrawable(r.drawable.imag1)); images.add(getresources().getdrawable(r.drawable.imag2)); images.add(getresources().getdrawable(r.drawable.imag3)); } i want able convert url these drawables such that: drawable1 = "http.someimage.com/image.png" drawable2 = "http.someimage.com/newimage.png" followed private void loadimages() { images = new arraylist<>(); images.add(getresources().getdrawable(drawable1)); images.add(getresources().getdrawable(drawable2)); ...etc } is there easy way go around this? want stick drawables ,but cant find way convert url drawable ideas? thanks! if have url of picture need download first. you can't "convert" url drawable. you need this: url url = new url("http.someimage.com/image.png"); bitmap bm...

Netlogo - Ordered Movement -

i have following error in netlogo , i'm unsure why. trying make turtles move around in ordered fashion keep getting error when change d angle: "face expected input agent got nobody instead". appreciated. globals [angles] setup clear-all create-turtles amount [ setxy random-xcor random-ycor ] ask turtles [ set angles (random 360) ] reset-ticks end monitor show count patches show ticks end go if (all? patches [pcolor = yellow]) [stop] ask turtles [ face min-one-of patches [ pcolor = black ] [ distance myself ] ;; line of code tells turtle head towards nearest patch containing colour of black. set angle d angle * 1 - angle rightt angle forwardd 1 ifelse show-travel-line? [pen-down][pen-up] set color red if pcolor = black [ set pcolor yellow ] ] tick end you can unveil problem running test: to test ca crt 1 let x -10e307 * 10 show x ask turtle 0 [rt x] inspect tur...

asp.net mvc - throws HTTP Error 403.14 - Forbidden after create new record -

1- authorizeuserattribute.cs class costume authorize attribute public class authorizeuserattribute : authorizeattribute { public string accesslevel { get; set; } protected override bool authorizecore(httpcontextbase httpcontext) { var isauthorized = base.authorizecore(httpcontext); if (!isauthorized) return false; if (this.accesslevel.contains("admin")) { return true; } else return false; } 2- controller [authorizeuser(accesslevel = "admin")] public class productscontroller : controller { private databasecontext db = new databasecontext(); public actionresult index() { var product = db.product.include(p => p.productgroup); return view(product.tolist()); } } [authorizeuser(accesslevel = "admin")] public actionresult create([bind(include = "product_id,productname,description,picurl,group_id")] product product) ...

c# - Missing ASP.NET Core templates in VS Enterprise 15 Preview 5 -

i installed preview 5. i've been doing front-end work past year, figured i'd start checking out .net core finally, seems more stable. i've got msdn subscription, grabbed enterprise preview 5 download , installed it. here options framework version when go start new project. here options new web project. if reopen installer manage installation, here .net components have installed. here compilers , build activities. far can tell, i've got need have installed in order use dnc, it's not showing up. any ideas? i've got .net core tab under visual c# after i've followed instructions here although i'm not sure if it's same vs 15, i've been using vs 2015 update 3. however appears templates have been published here , maybe you're looking for. i'm not sure "it seems more stable" still didn't move project.json .csproj (scheduled end of year) luck , have fun. patient, there :).

image - making user-edited profile pictures html -

okay, have been having trouble creating html site user-changeable profile picture. example, being able upload , change profile picture on social media. i'm rather new, not complete noob. so, please keep terms plain-ish. i've tried many methods, can't put code down revision, here's thought should work: <p><img src="my_file" alt="my_file" style="float:left;width:100px;height:100px;">your profile picture</p> <input type="file" name="my_file" id="my-file"> <div id="update"> - save picture</div> <center> <div id="edit" contenteditable="true" style="text-size:150%"> </center> <input type="button" value="save changes" onclick="saveedits()"/> previewing image html: <img id="profile-pic" alt="profile picture" /> <h2> profile picture ...

Draw autofocus rectangle in preview using camera2 android -

Image
i using camera2 api of android. able capture image , save it. using autofocus mode focus , capture images. capturebuilder.set(capturerequest.control_af_mode, capturerequest.control_af_mode_continuous_picture); where capturebuilder is private capturerequest.builder capturebuilder; i want show rectangle or circle in autofocus area in camera preview happens in default camera application. instance rectangle in middle of preview here. i have seen this not want on touching anywhere in preview. i have searched through lot of examples of them illustrate use of deprecated camera class, nothing useful on camera2 api. how can focus rectangle can achieved new camera api? it looks want static rectangle in center of preview. you can via xml layout adding image layout. taking camera2basic example ( https://github.com/googlesamples/android-camera2basic ) , adding this, example below adds rectangle, text , control buttons on side (it landscape orientation): <rel...

javascript - getting source maps of dependencies to work with angular2 and webpack -

my goal have angular2 project setup can debug source code of dependencies (present in node_modules directory). more precise want able debug (e.g. set breakpoints) in actual typescript files (i don't mean own typescript files files of dependency) in chrome dev tools. should possible if dependency contains source maps. i tried use angular-cli apparently not yet possible, see debugging angular 2 typescript source code . so tried start basic angular-seed project , adjusting it. project using webpack , added following webpack.config.js: ... module: { preloaders: [ { test: /\.js$/, loader: 'source-map-loader' } ], ... this works packages rxjs not work @angular packages because bundled files (e.g. core.umd.js etc) not contain source maps (the angular 2 team removed them due bug ). bundled files lack source maps, non-bundled files in src folder contain source maps. how can tell webpack use non-bundled files instead of bundled files? this arti...

Passing value with request.setAttribute does not work in struts 1.3 -

i working in project in struts 1.3. have action in have set variable test . mapping.findforward() redirects page log.jsp. want pass value of test action class jsp page. in action class have passed follows : public actionforward execute(actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse response) throws exception { request.setattribute("test", "hello world!!!"); return mapping.findforward("success"); } now in jsp page tried access follows: not print value : <% logger logger = logger.getlogger("ipname"); logger.debug("value of test : "); logger.debug((string)request.getattribute("test")); %> how can solve problem ?

java - Prioritizing Network call in android using AsyncTask -

i looking prioritize network calls in android application in order download content in order of priority. problem: making app downloads feeds (involves images , text) , comments (only on requests , contain texts, images has been download already). on displaying feed send request image of feed takes time download. meanwhile user can request comment corresponding feed. current implementation waits until image gets downloaded sends request comment make user wait long time. current solution: have used singleton class send network call , factory design service classes. downloading feed: have used viewholder displaying feeds (which contains images) code downloading image (manually) if(ioutil.fileexists(itemview.getcontext(), feed.getproductimagename())) { if(application.ismemoryavailableinheap()) { int height= constant.feed_image_height; log.v(constant.tag,"feed:"+feed.getname()+" has height:"+height+" not resizing"...

sql - How to combine two rows in one in PostgreSQL? -

i'm selecting data 2 tables in postgres in way: select matches.id id, first_team_id t1, second_team_id t2, name matches join teams on matches.first_team_id = teams.id union select matches.id id, first_team_id t1, second_team_id t2, name matches join teams on matches.second_team_id = teams.id that's how table looks now: id t1 t2 name 1 1 2 team1 1 1 2 team2 2 1 3 team2 2 1 3 team1 that's need id t1 t2 name1 name2 1 1 2 team1 team2 2 1 3 team2 team1 i need easiest way it. i've seen solutions in similar questions, didn't manage them. please me you can want 2 joins: select m.id, m.first_team_id, m.second_team_id, t1.name, t2.name matches m join teams t1 on m.first_team_id = t1.id join teams t2 on m.second_team_id = t2.id;

javascript - Saving a blob to the server? -

so have program grabs meta data out of sound file. if sound file has album image able turn blob object url , use locally, how able save blob image server? right have 2 file input fields, 1 select sound file , 1 select image if there none pulled sound file. i using musicmetadata ( https://github.com/leetreveil/musicmetadata ) , how pull image sound file. musicmetadata(data, function(err, result){ if(err) console.log(err); if(result.picture.length > 0){ var picture = result.picture[0]; var url = url.createobjecturl(new blob([picture.data], {'type':'image/' + picture.format})); var image = document.getelementbyid('albumimage'); imagelist.innerhtml = "<p>" + result.title + "." + picture.format + "</p>"; image.style.backgroundimage = "url(" + url + ")"; i...

c++ - DB (MYSQL) command to query in c ++ -

sprintf_s(query, "update point set p%d=%d hakbun='%d';", no, point, hakbun); the data in database not output reason of sentence. what problem? void updatepoint(mysql *con) { mysql * connection = null, conn; mysql_res * sql_result; mysql_row sql_row; int hakbun, field, j, query_stat, no, point; char query[1024]; cout << "student id > "; cin >> hakbun; cout << " ┌────────────────────────────┐" << endl; cout << " └────────────────────────────┘" << endl; cout << " num > "; cin >> no; cout << " point > "; cin >> point; sprintf_s(query, "update point set p%d='%d' hakbun='%d';", no, point, hakbun); sprintf_s(query, "select * point hakbun = '%d';", hakbun); cout << si...

game physics - UE4: PhAt is acting weird -

Image
you can see problem in image: my mesh ist deforming crazy , dont know fix this. geat if woud have solution this. it seems ragdolls not correctly set, should set ragdolls in maya or phat. check out tutorials if want figure out rigid body wrong set, can set physics type kinematic , see if other rigid body act right.

Netsuite Sitebuilder My Reference Checkout -

we're trying setup netsuite reference checkout, we're running typical netsuite issue of great lack of documentation. has been through before, , have links or reading material? we're using site builder rather commerce advance. thanks!

c++ - No Matching Constructor for Initialization on Mac -

i learning c++ programming: principles , practice using c++ / edition 2 , i've run problem vectors. i'm using included header file provided stroustrup's book here . when compile following vector program, error. #include "std_lib_facilities.h" int main() { vector<int> v = {5, 7, 9, 4, 6, 8}; (int i=0; i<v.size(); ++i) cout << v[i] << endl; } error vector.cpp:5:21 error: no matching constructor initialization of 'vector<int>' vector<int> v = {5, 7, 9, 4, 6, 8}; ^ ~~~~~~~~~~~~~~~~~~ ./std_lib_facilities.h:82:5: note: candidate constructor template not viable: requires 2 arguments, 6 provided vector(i first, last) :std::vector<t>(first, last) {} ^ ./std_lib_facilities.h:79:14: note: candidate constructor not viable: requires 2 arguments 6 provided vector(size_type n, const t& v) :std::vector<t>(n,v) {} ^ ./std_lib_facilities.h:79:14: ...

and operator on Python lists -

i've found strange behavior in python. 1 of students made kind of mistake trying find elements belong 2 lists, wrote: list1 , list2 the strange behavior no error fired python 3! list1 , list2 has got value list2 . is there known reason this? and evaluates truthness of 2 values provided. if first true (see bool(list1) ) second evaluated , returned. if first argument false (e.g [] , list2 ) value returned immediately. in documentation on boolean operations rationale behavior stated clearly: note neither and nor or restrict value , type return false , true , rather return last evaluated argument . useful, e.g., if s string should replaced default value if empty, expression s or 'foo' yields desired value. (emphasis mine) note behavior isn't found not which, instead, returns true / false value based on argument provided.

eval - Parallel computing using Matlab -

i executing windows '.exe' file in 'cmd' prompt various inputs through matlab. commands follows. = 1:n filename = sprintf('input_%d.dat',i); string = sprintf('!sfbox.exe %s', filename); eval(string) end all input files present , independent of each other. if attempt parallelize execution using 'parfor' follows, parfor = 1:n filename = sprintf('input_%d.dat',i); string = sprintf('!sfbox.exe %s', filename); eval(string) end i error, code runs serially without stopping explanation matlab runs parfor loops on multiple matlab workers have multiple workspaces. indicated function might not access correct workspace; therefore, usage invalid. is there correct way execute eval using parfor? (ps: tried manually executing several .exe files in cmd prompt , feasible run several .exe files @ same time in command prompt. problem way attempt in matlab. please suggest...

css - Bootstrap and Telerik RadPageLayout DIVs overlap at certain browser widths -

Image
i using telerik radpagelayout, generates bootstrap html tags. problem when user stretches expand or contract browser width, @ widths, divs begin overlap. believe happening because divs use fixed widths, mandatory because don't want internal content of divs stretch or contract. are span tags configured incorrectly? there can fix without changing div's fixed widths? <telerik:radpagelayout runat="server" gridtype="fluid" showgrid="true" htmltag="none" cssclass="radlayout" > <telerik:layoutrow rowtype="generic"> <rows> <telerik:layoutrow rowtype="generic" cssclass="content"> <rows> <telerik:layoutrow rowtype="container" wrapperhtmltag="div"> <columns> <telerik:layoutcolumn span="12"> ...

retrofit2 - Android OKHttp and Retrofit return 304 error -

i'm develop android application using okhttp , retrofit send request skyscanner api. but sometime got 304 response , response have no body content. can't parse body content object , that's why listview show nothing. can me avoid 304 error. 304 not error. 304 refers redirect, , responsibility of client handle it. http://www.checkupdown.com/status/e304.html you doing request on document has not changed, , should depend on cache handle you.

objective c - NSWindowCollectionBehaviorCanJoinAllSpaces window not showing if other process is fullscreen -

i trying make window floating, stays on top across workspaces. workspace thing key. my example: in process (firefox) have 2 windows ( wina , winb ). made 1 window ( wina ) join spaces , floating this: nswindowcollectionbehavior newbehavior = [wina collectionbehavior]; newbehavior |= nswindowcollectionbehaviorcanjoinallspaces; [wina setcollectionbehavior: newbheavior] [wina setlevel: nsmainmenuwindowlevel] now, when make 2nd window ( winb ) full screen, wina shown on floating on top, expected. if focus app, , make full screen, wina not seen on top. here screencast - https://www.youtube.com/watch?v=zq5ysjvu8pq does know how can make join spaces window on top of "fullscreen windows of other process"

c# - Is this correct for calculating the nth root? -

for positive real numbers rth root given e^(ln(x)/r) negative real numbers if r odd rth root given -e^(ln|x|/r) if r real rth root of negative number not exist static double rthroot (double r, double x) { double y; if (x > 0) { y = math.exp((math.log(x)) / r); } if (r+1 % 2 == 0) { if (x < 0) { y = -(math.exp((math.log(math.abs(x))) / r)); } } } there 2 errors in code: you not returning value in rthroot . need return y oblige solve additional issue; call rthroot(2, -4) . want return specific value ( double.nan ), want throw argumentexception or...? if (r + 1 % 2 == 0) not doing think doing. code equivalent if (r + (1 % 2) == 0) not want. correct code should if ((r + 1) % 2 == 0) or simpler , more readable if (r % 2 != 0) standard way check oddity.

Android: Multi-Directional view pager -

i need implement following app design: user can swipe 'columns' left , and right (horizontal page viewer style) in each 'column', user can swipe , down (vertical page viewer style) on ios, uipageviewcontroller can vertical or horizontal. implemented design follow: @ top, there 1 horizontal page view controller every view returned controller managed vertical page view controller. worked great. however on android, there no vertical view pager followed suggestion in vertical-view-pager faced problem: if column contain pages p1 , p2, can swip left if p1 shown @ top , can swipe right if p2 shown @ bottom. want swipe left/right page. i did browse other implementations of vertical/directional view pagers implementations obsolete directional-view-pager question: know of solid (latest , greatest) implementation of vertical view pager on android? max

c# - Scaling image to canvas parent height in WPF -

i'm new wpf , trying simple. i'm making custom control canvas have image higher canvas. when displays overflows canvas, want scale parent height. there's easy answer haven't found yet. here's xaml: <usercontrol x:class="wpfusercontrol.instance" name="instancebox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" width="448" height="99.2"> <grid name="instancegrid" background="white" x:fieldmodifier="public" margin="0,0,0,0.2"> <canvas> <image horizontalalignment...

css - How to move sidebar to the right-side of the page? -

i'm developing first webpage , move sidebar right-side of page. it's stock bottom , can't seem move it. should change in code? thank you. /*sidebar*/ #sidebar{ margin:0; width:250px; float: right !important; margin-right:50px; position:relative; padding: 0; text-align: left; } #sidebarcontents{ padding:5px 0px 5px 0px; } make sure maincontent div float left , size controlled (as in, make sure not 100%). check width of maincontent div left , set overflow hidden

swift - Print evens app error help - cannot convert to type string -

i've been trying take number , display of numbers said number in string. currently, think have working i'm having trouble getting display in label. the error i'm getting on: label.text = factor . error states: "cannot assign value of type '()' type 'string?' i wonder if had idea how fix or improve code , explain did wrong? i'm still kind of new swift. here's code: import uikit class viewcontroller: uiviewcontroller { @iboutlet var input1 : uitextfield! @iboutlet var label : uilabel! @ibaction func factoraction(sender: uibutton) { if let text = input1.text { if let num = int(text) { // text int let factor = getevens(<#t##input: int##int#>) label.text = factor } else { // show user entered text isn't number } } else { // there's no text } } // notifies user when no text or if non number string/whole integer has been entered. // ...

escaping - Easygui equivalent of raw_input()? -

i getting user input in easygui : title, author name , webpage address. far, good. once in while, when webpage input, there escaped string, return error. guess there must way specify equivalent of raw_input, don't know how. here's relevent (?) part of code : if menubiblio == 0: msg = "remplissez le formulaire puis clickez sur ok" title = "ajouter un nouveau livre" fieldnames = ["titre","auteur","webpage"] fieldvalues = [] # commencer avec toutes les valeurs = 'blank' fieldvalues = easygui.multenterbox(msg,title,fieldnames) try: titre = fieldvalues[0] auteur = fieldvalues[1] webpage = fieldvalues[2] #calculer le numéro du livre en fonction du nbr de lignes dans le doc txt number = open('bookiddatabase.txt', 'r').read().count("\n") + 1 ...

C double not working as expect -

i writing need divide 29 10. when , store in double, outputs 2.0000 instead of 2.9. can explain why happening , how fix it? double = 29/10; output: 2.0000 the double works expected, it's not assigning expression of type double . what assign int , result of dividing 29 , int , 10 , int . 2 , because remainder discarded when divide integers. changing 29 29.0 or 10 10.0 fix problem.

Slideshows in HTML/Javascript -

i have tried making slideshow in js , not working, images displayed on screen in order , next , previous links send me top of page. can't work out why, know solutions work don't understand why solution not working. there many solutions have found online similar 1 , work, yet 1 doesn't, have started js imagine silly have missed. here html: (edit: moved bottom of html body) <html> <head> <title></title> <link type="text/css" rel="stylesheet" href="css/mainpagestyle.css"> </head> <body style="background-color:white"> <div id="titlelogo"><h1>custom motorbikes</h1></div> <nav> <ul> <li><a href="">home</a></li> <li><a href="">about us</a></li> <li><a href="">full ride list</a></li> ...

Convert Integer to Double in MIPS -

i want divide 2 values in $tn registers. i have divide these 2 values double result function div returns integer part of division can out? do need convert $t1 , $t2 $f0 , $f2 ? how do that? li $t1,2 li $t2,5 div $f0,$t2,$t1 this gives me error because expects $tn value not $fn value... you have move , convert integer stored in general purpose register floating point or double register. assuming number stored in $a1 , convert double pair ( $f12 , $f13 ) have issue: mtc1.d $a1, $f12 cvt.d.w $f12, $f12 and convert single precision float ( $f12 ) you'd do: mtc1 $a1, $f12 cvt.s.w $f12, $f12

sql - How do I get this query result in a single query instead of N+1 -

a pool_tournament has many pool_tournament_matches , each match belongs multiple users . user has_many pool_tournaments , has_many pool_tournament_matches . pool_tournament.rb has_many :pool_tournament_matches pool_tournament_match.rb belongs_to :pool_tournament has_many :pool_tournament_match_users, class_name: 'pooltournamentmatchuser' has_many :users, through: :pool_tournament_match_users user.rb has_many :pool_tournament_users, class_name: 'pooltournamentuser' has_many :pool_tournaments, through: :pool_tournament_users has_many :pool_tournament_match_users, class_name: 'pooltournamentmatchuser' has_many :pool_tournament_matches, through: :pool_tournament_match_users there 2 has_many through associations here. 1 between user , pool_tournament . other between pool_tournament_match , user . my query figure out pool_tournament_matches have 1 user. query got me list of matches it's doing n+1 query each pool_tournament_match . tour...

Manipulate bytes in arduino -

void setup() { // open serial communications , wait port open: serial.begin(2400); } void loop() { while(!serial.available()); // wait character int incomingbyte = serial.read(); serial.print(incomingbyte,hex); serial.print(' ');` } i using code above "train of bytes" in arduino, each pulse of bytes give me this: 3 packets 1),2) , 3) ------a-------------b-------------- c-------d----------e-----------f 1) aa 55 || 01 03 05 07 09 || 05 || 0a 02 || 02 22 22 || b3 d0 2) aa 55 || 01 03 05 07 09 || 05 || 0a 07 || 03 33 33 || 2e 80 3) aa 55 || 01 03 05 07 09 || 05 || 0a 0c || 04 44 44 || fa b3 a => first 2 bytes (aa 55) means beginning of each packet. b => 5 next bytes (01 03 05 07 09) identificator. c => number of bytes of d + e (is equal 05 in example above) d => kind of measuring (0a 02, 0a 07 or 0a 0c) e => data, number of measuring, example: 02 22 22 means 22.222 w f => crc i need separate each part ...

javascript - Update disabled Chrome Extension -

from know chrome extensions, if have installed , enabled extension in chrome, , there new version on chrome web store requires new permissions, chrome download new version , install extension disabled , user prompt evaluate new permissions , re-enable extension. i wondering happen if in meantime, new, second update published on store, not require new permissions , user has not yet re-evaluated previous update, extension still disabled. new update same permission set before cause chrome automatically re-enables extension ?

java - How to place data from a file with Strings and Ints into an Array / How to compare arrays? -

i'm little confused , seeking direction in how achieve goal. want read file has name of mini golf player, age, , scores 9 holes of playing. want find par each hole using age. (if it's younger player par scores higher) my input file practice.txt following content: jay 57 4 3 2 3 5 3 2 3 4 gloria 39 4 4 3 4 3 4 3 3 5 manny 14 5 6 4 6 5 6 4 4 6 joe 3 9 8 8 7 6 6 7 5 7 the player's age denoted second number (ex: manny 14 years old.) i placed par score information 2d array. however, can't figure out how compare 2d array of numbers array list of strings? what's way can fix or way of thinking should have solve problem? here have far! import java.io.file; import java.util.scanner; import java.util.list; import java.io.filenotfoundexception; import java.util.arraylist; public class imtryinghere { public static void main (string[] args) throws filenotfoundexception { int [][] agegroups = { {4}, {7}, {...