Posts

Showing posts from May, 2015

Java array to input student names according to their number -

i need create array prompts professor input how many students in class. prompts them input names until number of students met. have wrong hoping insight. system.out.println("please enter number of students in class: "); int numberofstudents = console.nextint(); string [] studentname = new string [numberofstudents]; (int i=0; i<studentname.length; i++) { system.out.println("enter name of student " + (i+1) + " in class. "); studentname[i] = console.nextline(); system.out.println("student name entered: " + studentname[i]); } edit: changed code bit, array. loop intending have go through each number , assign student name it. last line of code gives me error saying confusing indentation. edit 2: after proofreading question , code myself i've noticed basic mistakes , have dealt them, 1 last question. right while code works, when asks me input name, skips student 1, leaves blank moves onto student

java - Binding nested objects in SPRING MVC -

i new spring mvc. not getting details of employee contains phone , address object well. actually, object not being binded employee. follow code: //(controller) employeecontroller.java @controller @requestmapping(value = "/employee") public class employeecontroller { @autowired employeeservice employeeservice; @requestmapping("/employee") public modelandview registeremployeer(@modelattribute employee employee) { map<string, object> modelmap = new hashmap<>(); modelmap.put("employee", new employee()); return new modelandview("employee", modelmap); } @requestmapping("/add") public string addemployee(@modelattribute employee employee) { employeeservice.save(employee); return "result"; } @modelattribute("phonetypelist") public map<string,string> populatephonetypelist() { return phone.getphonetypes(); } @modelattribute("addresstypelist") public map<string,string> p

c# - XElement XML ToString malformed [ ] -

so m parsing xml. create xelement , run tostring() method. @ results , wrong. <root>[elementname, elementvalue ]</root> when should like <root> <data name="name"> <value>value</value> </data> </root> this really weird. ive used xml plenty of times , have never run this. have looked on web , cant find anything. when step through xdocument creation process tostring() each element correct. going on ? how can troubleshoot ? here code string writexml(dictionary<string, string> dic) { var root = new xelement("root"); foreach (var pair in dic) { var element = new xelement("data", pair.value); element.add(new xattribute("name", pair.key)); root.add(pair); } var doc = new xdocument(new xdeclaration("1.0", "utf-8", null), root); var s = doc.tostring(); consol

Android drawables : Is there any way to somehow link the int IDs to the R drawable IDs? -

i have 718 drawables in drawable-mdpi , drawable-hdpi and drawable-xhdpi folders, names 1.png, 2.png... 718.png. (they pokémon sprites) so, depending on pokémon, want load 1 of them show it. however, cannot use number directly identify r drawable id. is there way (besides of 718-case switch or hashmap<integer,integer> ) somehow link int ids r drawable ids? you try: string sprite = "drawable/"+number; int imageresource = getresources().getidentifier(sprite, null, getpackagename()); the drawable folder image in. number number of image want. e.g. 1.png

bash - Count specific numbers from a column from an input file linux -

i trying read file , count specific number @ specific place , show how many times appears, example: 1st field numbers, 2nd field brand name, 3rd field group belong to, 4th , 5th not important. 1:audi:2:1990:5 2:bmw:2:1987:4 3:bugatti:3:1988:19 4.buick:4:2000:12 5:dodge:2:1999:4 6:ferrari:2:2000:4 as output, want search column 3, , group 2's(by brand name) , count how many of them have. output looking should this: 1:audi:2:1990:5 2:bmw:2:1987:4 5:dodge:2:1999:4 6:ferrari:2:2000:4 4 -> showing how many lines there are. have tried taken approach can't figure out: file="cars.txt"; sort -t ":" -k3 $file #sorting 3rd field grep -c '2' cars.txt # counts 2's in file including number 2. i hope understand. , thank in advance. i not sure mean "group brand name", following output describe. awk -f':' '$3 == 2' input.txt if want line count, can pipe wc -l . awk -f':' '$3 == 2' i

jquery - colorbox doesn't close after sumbit form -

i have issues colorbox if try submit form, colorbox remains opened on success. tried add colorbox.close(); on success, worked, if try click link again open form, form not displaying - can see close button , overlay. tried hide form , overlay after success, again - form didn't open on second click. i tried tweek js file - assign same functionality submit button close button has, of course didn't work properly. how make form close on submit - please suggest. the popup form: <div class="body" id="inline-popup"> <form action="index" method="post" id="form"> <fieldset> <label>name</label> <input type="text" id="name" name="name" /> </fieldset> <fieldset> <label>url (optional)</label> <input type="text" name="url" id="url" />

c++ - How to obtain the changed file names from the QFileSystemWatcher `directoryChanged` event -

how can 1 obtain changed file names qfilesystemwatcher directorychanged event? you need connect slot filechanged() signal instead of directorychanged() if more interested in file names. connect(&myfilesystemwatcher, signal(filechanged(const qstring&)), slot(handlefilechanged(const qstring&))); then, can use slot argument desired. here, printing out stdout: void handlefilechanged(const qstring &path) { qdebug() << path; } please see documentation further details: void qfilesystemwatcher::filechanged(const qstring & path) [signal] this signal emitted when file @ specified path modified, renamed or removed disk. not sure how familiar qt signal/slot system, if not enough, please go through this, too: qt signals & slots

node.js - About arbitrary data -

what arbitrary data ? found here https://www.dropbox.com/developers/core/docs#oa2-authorize state 200 bytes of arbitrary data passed redirect uri. parameter should used protect against cross-site request forgery (csrf). see sections 4.4.1.8 , 4.4.2.5 of oauth 2.0 threat model spec. so types of value send state ? using nodejs . "arbitrary data" means anything. string, number, binary data, whatever. since it's used csrf token, needs unpredictable value that's associated user's session. here guidelines on csrf tokens.

object - How can i a string use as a objectname in javascript? -

how can use string object name? var = "hello", b = { hello : "word" }; alert(b.a); this give in empty box. want still use variable a. how can string use objectname in javascript? this how it. window["obj"] = { hello:"word"};

javascript - Turn.js (flipbook effect) is not working -

sorry, not getting did mistake (as newbie javascript). wrote code flipbook effect using turn.js of tutorial. output in browser showing blank screen. guess, there must awkward mistake m still not getting . plz help. <html> <head> <script type="text/javascript" src="jquery-1.5.1.min.js"></script> <script type="text/javascript" src="turn.js"></script> <style type="text/css"> body{ background: #9988aa; } #book{ width: 1152px; height: 400px; } #book .turn-page{ background-color: #ddd; background-size: 100% 100%; } </style> </head> <body> <div id="book"> <div style="background-image:url('images/1.jpg');"></div> <div style="background-image:url('images/2.jpg');"></div> <div style="background-image:url('images/3.jp

multithreading - Suitable Design Pattern for Multi Threaded Java Application -

i newbie java technology , have little idea design patterns. have write java application contains 3 independent threads: the first thread used write on file "a" the second 1 used write on file "b" and when writing on file done independent thread "c" merge these 2 file. i have write application efficient possible. thinking using design pattern. there design pattern fits scenario best?

java - Play framework + Ebean: [error] ... not found: type Finder -

i developed java application in play 2.0 , trying deploy aws. first trying run same way did on local computer. copied play sources virtual ec2 server (ubuntu 12.04), exported play classpath, , copied project. when run play compile, following error [info] loading project definition /home/ubuntu/play-2.0/samples/java/test-crud/project [info] set current project computer-database (in build file:/home/ubuntu/play-2.0/samples/java/test-crud/) [info] updating {file:/home/ubuntu/play-2.0/samples/java/test-crud/}computer-database... [info] done updating. [info] compiling 21 scala sources , 16 java sources /home/ubuntu/play-2.0/samples /java/test-crud/target/scala-2.9.1/classes... [error] /home/ubuntu/play-2.0/samples/java/test-crud/app/models/dealership.java:32: not found: type finder [error] public static finder<long,dealership> find = new finder<long,dealership>(long.class, dealership.class); [error]

sql - Max Function of Mysql not returning maximum value of coloumn. Order by limit also not working -

i have table structure follows: history_card +----+-----------+---------+--------------+ | idhistory_card |equipment_id | sr_num | +----+-----------+---------+--------------+ | 1 | du 201 | 9 | | 2 | du 201 | 2 | | 3 | du 201 | 12 | | 4 | ext 99 | 10 | | 5 | ext 99 | 13 | | 6 | ext 99 | 7 | | 7 | ext 99 | 9 | +----+-----------+---------+--------------+ i return maximum value of coloumn(sr_num) particular euipment_id. eg. equipment_id = du 201 , maximum value 12 below mentioned queries returning wrong value i.e 9 equipment_id = ext 99 , maximum value 13 below mentioned queries returning wrong value i.e 9 . have searched lot in internet on manual of no use till now.kindly help! queries follows select * new_schema.history_card equipment_id

html - The Javascript onclick event only fire on the second click -

i have onclick problem. searched internet, people had same problem not explain how fixed problem. cannot figure out goes on here. i supposed make button called "load new", when clicked showed allow user select file. html <input type="button" class="clear-button" onclick="clearb()" value="clear board" /><br /><br /> <input type="button" value="load game board" onclick="loadgame()" /> <input type="button" id="get_file" onclick="n();" value="load new game"> <input type="file" id="my_file"> css #my_file { display: none; } javascript function n() { if (document.getelementbyid('get_file') != null) { document.getelementbyid('get_file').onclick = function() { document.getelementbyid('my_file').click(); } //loadgame(); //triggers func

c# - How to get all Forms and User Controls in WinForms project? -

i have winforms project, using visual studio 2013, dotnet framework 4.0. how can list of of created forms , user controls in project, preferably @ runtime? edit: reply. example, want forms , user controls under namespace "myapp.forms" , "myapp.usercontrols", how can assemblies? here's how it: ienumerable<assembly> currentdomainassemblies = appdomain.currentdomain.getassemblies().where(a => a.fullname.startswith("myappnamespace")); foreach (assembly in currentdomainassemblies) { ienumerable<type> assembliestypes = a.gettypes().where(t => (typeof(form).isassignablefrom(t) || typeof(usercontrol).isassignablefrom(t)) && t.isclass); foreach (type t in assembliestypes) { if (t.fullname.contains("usercontrol")) { listuc.beginupdate(); listuc.items.add(t.name); listuc.endupda

math - Check existence of solution Matlab -

i have 2 functions return 2 arrays t1 , t2, want calculate h=t1/t2 , if there no solution {do something}. t1 vector , t2 jacobian matrix. (i need solve equation t2*d=t1) try if isempty(t1\t2) {doing something} end but isempty function returns 0. how can check exestence of solution t1\t2? in command window matlab says warning: system inconsistent. solution not exist. update: try d=inv(h)*phi it works, difference , how can use command '\'? you use rank judge if system not have unique solution: if rank([t2,d]) ~= rank(t2) {doing something} end

setuptools - List of standard modules and packages in any python release -

i have release python application works pretty on python 2.7.3 (becuase developed on version). it 1 of requirement should work standard python modules/packages available out of box after python installation. how know which least python version on application supported. need mention information in release notes , it's not practical me install python releases , test application. just information, uses following modules , packages standard in python 2.7.3 urllib2 cookielib urllib ast sys sqlite3 os argparse logging re the trick 1st check documents each of imports: urllib2 - beginning in python 2.3.. cookielib - new in version 2.4. urllib - changed in version 2.3: added proxies support. changed in version 2.6: added getcode() returned object , support no_proxy environment variable. ast - new in version 2.6: high-level ast module containing helpers. sys - been there 1.0 sqlite3 - new in version 2.5. os - been there 1.0 argparse - new in version 2.7 loggin

assembly - mov DS,[BX] and mov DS,[1234] -

hi i'm starting assembly language , sorry basic question. are these 2 instructions valid in assembly language? (8086 mov instruction). mov ds,[bx] mov ds,[1234] if no,why not?! they both valid, examples 8e /r mov sreg,r/m16 move r/m16 segment register . 8e 1f mov ds,[bx] 8e 1e d2 04 mov ds,[1234] next time please consult instruction set reference.

c# - Store list of pairs in one table EF -

i used following class : public class point { [required] public double x { get; set; } [required] public double y { get; set; } } and model containing: public list<point> vertices { get; set; } but ef tries create separate table based on message : entitytype 'point' has no key defined. define key entitytype. i'll have large number of points related model , think it's not optimal solution have separate table. is there way embed point array inside table or thinking wrong? highly appreciate time. thanks. the following should work - not sure if recommend approach (as think table point ok) having said did seem work me. use verticedatatext store point data in string, stored in db: public class vertice { public int verticeid { get; set; } [notmapped] public point[] data { { string[] rawinternaldata = this.verticedatatext.split(';'); point[] dataresult = new

javascript - How do I implement nested #each blocks with Meteor and MongoDB reference? -

so, have following handlebarsjs helper: <ul class="list-unstyled"> {{#each gralskills}} <li class="pl-14"><i class="flaticon-checkmark4"></i> <a data-toggle="collapse" href="#collapse{{number}}"> {{gralskillname}} </a> <div id="collapse{{number}}" class="panel-collapse collapse small pl-21"> <span class="block">{{gralskilldescription}}</span> <span class="uppercase block">indicadores - <a href="#" class="flaticon-plus34 text-danger not-underline" id="new-gral-skill-indicator"></a></span> <ul class="list-unstyled pl-14"> {{#each gralskillindicators}} <li>- {{indicatorname}}</li> {{/each}}

Retrive json Data in javascript for Phonegap Project -

i trying retrieve json data wordpress blog. used json api plugin json object. please check code. showing error status 0. , not able retrieve data. var xmlhttp; window.onload = function(){ document.addeventlistener("deviceready",init,false); } function init(){ xmlhttp = new xmlhttprequest(); xmlhttp.open("get","http://www.foduu.com/api/get_recent_posts/", false); xmlhttp.send(); xmlhttp.onreadystatechange = datareturn; } function datareturn(){ if(xmlhttp.readystate==4 && xmlhttp.status == 200){ var jsonresponse = xmlhttp.responsetext; jsonresponse = eval("("+jsonresponse+")") alert("jsonresponse.count_total"); } else { alert("could not connect , status:" + xmlhttp.status); } } please me this.

java - How can I get different data types from the keyboard in just one line? -

i need keyboard in 1 line this: create 1000 john 4000 (for cinema program, include function create users) where "create" command create new user (create class, , contains client information), "1000" id of user (int), "john" name(string), , "4000" points(int) how can different data types in 1 line stored in different attributes client? i use scanner object based on system.in read line in, using if (myscanner.hasnextline()) , myscanner.nextline() method pairs. then line need parsed, , here i'd offer 2 possible ways: consider using new scanner based on line read in, string variable called line , "line scanner" speak, scanner linescanner = new scanner(line) , , tokens via linescanner.next() , linescanner.nextint() , linescanner.next() , , linescanner.nextint() , in order. don't forget close() linescanner when done using it. or use string#split(" ") split string array of 4 substrings separ

python 2.7 - Scrapy Request callback method never called -

i building crawlspider using scrapy 0.22.2 python 2.7.3 , having problems requests, callback method specify never called. here snippet parsing method initiates request within elif block: elif current_status == "superseded": #need more work here. have check whether there replacement unit available. if there isn't, download whatever outline there # need <td> element contains "is superseded " , follow link updated_unit = hxs.xpath('/html/body/div[@id="page"]/div[@id="layoutwrapper"]/div[@id="twocollayoutwrapper"]/div[@id="twocollayoutleft"]/div[@class="layoutcontentwrapper"]/div[@class="outer"]/div[@class="fieldset"]/div[@class="display-row"]/div[@class="display-row"]/div[@class="display-field-info"]/div[@class="t-widget t-grid"]/table/tbody/tr[1]/td[contains(., "is superseded ")]/a') # need chil

R - XML of natural language corpus into dataframe -

i handling xml file in r using xml package. final goal create dataframe containing following information. luwpos luwdictionaryform luwlemma orthographictranscription phonetictranscription plainorthographictranscription devoiced moraid toneclass moraid 動詞 ダイスル 題する 題し ダイシ 題し 1 3 accent 1 luwpos, luwdictionaryform, luwlemma atts of luw node. orthographictranscription, phonetictranscriptio, plainorthographictranscription in suw, daughter of luw. devoiced in phone node, descendant of suw. moraid att of mora node, grandmother of phone. toneclass attribute of node xjtobilabeltone, descendant of phone. second moraid closest ancestor of xjtobilabeltone containing toneclass=accent. not phone nodes contain att devoiced. in case, don't need first moraid. when xjtobilabeltone not contain toneclass="accent", don't need second moraid either. so far, following: doc= xmlinternaltreeparse(file="a01f0122.xml") #opens file luw <- xpathsapply(doc, "//luw

c - Field ' ' could not be resolved -

currently trying compile kernel module in userspace. module is aes_generic.c so far commented kernel headers , started fixing compile errors u8 not available simpyl replaced uint8_t these errors gone now i struggling error field '' not resolved this error appears in various fields here's example: #define loop8(i) { \ loop8tophalf(i); \ t = ctx->key_enc[8 * + 4] ^ ls_box(t); \ ctx->key_enc[8 * + 12] = t; \ t ^= ctx->key_enc[8 * + 5]; \ ctx->key_enc[8 * + 13] = t; \ t ^= ctx->key_enc[8 * + 6]; \ ctx->key_enc[8 * + 14] = t; \ t ^= ctx->key_enc[8 * + 7]; \ ctx->key_enc[8 * + 15] = t; \ } while (0) error: field 'loop8(i)' not resolved more code same error message: int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const uint8_t *in_key, unsigned int key_len) { const __le32 *key = (const __le32 *)in_key; uint32_t i, t, u, v, w, j; if (key_

latex - Automatically launch a command with Emacs when it's a .tex file -

i want launch command when start emacs .tex file. command is: m-x flyspell-mode is possible , how? perhaps can add hook latex-mode . can add following line .emacs file. (add-hook 'latex-mode-hook 'flyspell-mode) i didn't test this, however, think should work. enable flyspell-mode whenever enter latex-mode .

python - Prioritizing Greenlet workers for parallel read/writes/db access -

i need read 3 csv files of size 10gb each , write parts of file 3 files. in middle, there minor conditions involved , mongo query(6bil collection, indexed) each row. i thinking using gevent pools task not sure how prioritize read tasks on writes,ensuring read finished before writers exit out. i dont want block writers until read finished. i can spawn 3 readers put in queue. i can spawn 20-25 io-processors read queue, mongodb call , write writer queue. i can spawn 3 writers read write queue , write files. i can joinall on pool. now can keep queue timeout in io-processors , writers. ensure of readers have put complete data in queue? or possible put join on readers @ end of io-processors? in short, want learn if there optimal approach use perform task efficiently.

ruby on rails - How can the value get updated in update_attribute -

i have test, needs set database-state: before site.first.update_attribute(:primary_domain, @params[:order][:primary_domain]) end but, reason, modifies @params: before @params[:order][:primary_domain].must_equal "example.com" site.first.update_attribute(:primary_domain, @params[:order][:primary_domain]) @params[:order][:primary_domain].must_equal "example.com" end this fails, second @params[:order][:primary_domain].must_equal "example.com" fails, updates @params[:order][:primary_domain] there. weird, have expected update_attribute(name, value) not touch value , somehow, does. it can circumvented .dup . interested cause this. maybe scope issue? fact normalising site.primary_domain on save , maybe? # override primary_domain setter. # allows normalise domain def primary_domain=(primary_domain) return primary_domain unless primary_domain.is_a?(string) write_attribute(:primary_domain, site.parse_uri(primary_domain.dup).host) end

search from json datasource through jsp and servlets -

how search json data source through jsp , servlets. sorry question being broad , not adhering stack overflow rules, yet kindly me if u can. web-links/ links of tutorials helpful. thank ! this blog json jsp & servlets. json-jsp-servlets and if looking particular search functionily json. use ajax , parse json response ajax , easy use , fast too.

javascript - JS drawing a line from the edge of a circle to another circle edge -

i'm trying draw line edges of 2 circles in html5 canvas. so, know coordinates of centers of 2 circles , radius. circles drawn randomly. line should move edge of 1 circle other. please help! p.s. sorry english :) update: i'm trying this, how know angle? from_line_x = circle1.x + circle1.radius * math.cos(math.pi * angle); from_line_y = circle1.y + cirlce1.radius * math.sin(math.pi * angle); to_line_x = circle2.x - circle2.radius * math.cos(math.pi * angle); to_line_y = circle2.y - circle2.radius * math.sin(math.pi * angle); update2: i think found how find angle. circle drawn randomly, line drawn not true. how should algorithm? sorry english again. here's solution achieve you've asked for. i've declared 3 'classes' make things clearer read. first, define generic shape class. next, define basic circle class. finally, define vec2 class. extend have done, , add other shapes inherit shape class - i.e square triangle, etc. i cr

c# - Antlr generated classes access modifier to internal -

i building library contains parsers. these parsers internally built antlr4. since generated classes public, users of library able see classes not need see. sandcastle documentation contains these classes. there way can tell antlr make generated classes internal instead of public? we have not implemented public/private on generated classes yet don't think.

matplotlib - Python: Return coordinate info on mouse click -

i display image in python , allow user click on specific pixel. want use x , y coordinates perform further calculations. so far, i've been using event picker: def onpick1(event): artist = event.artist if isinstance(artist, axesimage): mouseevent = event.mouseevent x = mouseevent.xdata y = mouseevent.ydata print x,y xaxis = frame.shape[1] yaxis = frame.shape[0] fig = plt.figure(figsize=(6,9)) ax = fig.add_subplot(111) line, = [ax.imshow(frame[::-1,:], cmap='jet', extent=(0,xaxis,0,yaxis), picker=5)] fig.canvas.mpl_connect('pick_event', onpick1) plt.show() now function onpick1() return x , y can use after plt.show() perform further calculations. any suggestions? a lesson gui programming go object oriented. problem right have asynchronous callback , want keep values. should consider packing together, like: class myclickableimage(object): def __init__(self,frame): self.x = none self.y

sqlite3 - sqlite boolean 't' and 'f' with rails active record -

i use mysql on production , sqlite3 on development. when querying database on development e.g. @follow_ups = followup.where(is_complete: false) i sql below in console select "follow_ups".* "follow_ups" "follow_ups"."is_complete" = 'f' sqlite evaluates 'f' truthy value no follow_ups.is_complete = false returned. in database stored true/false. investigations found. https://github.com/rails/rails/issues/10720 rails 3 sqlite3 boolean false what should boolean filters working? have thought happening more people. see schema below create_table "follow_ups", force: true |t| t.integer "contact_id" t.integer "owner_id" t.datetime "due_date" t.string "comment" t.boolean "is_complete", default: false t.integer "created_by_user_id" t.integer "updated_by_user_id" t.datetime "created_at"

java - Single Stateless Servlet in Spring Maven App -

i have 1 spring maven application, i want add new servlet, have added that, need servlet stateless, i.e. example, simple servlet souts hello, user needs login that, if user not logged in redirects login page offcourse due session validation, so question can exclude 1 particular servlet session check?? possible? if yes how? just add new servlet mapping url exclusion urls not need session validation. per question login.jsp must configured not require authentication token present in session, add new servlet url configuration

java - How to update a text file based on values within it -

i want edit values(a row values) of csv file based on specific value of row (an id). able read , write (append) values in cannot figure out how edit , delete them. here small fragment of code doing reading file , appending values: filewriter writer = new filewriter("file.csv", true); try { fileinputstream fstream = new fileinputstream("file.csv"); bufferedreader br = new bufferedreader(new inputstreamreader(fstream)); string strline; while ((strline = br.readline()) != null) { string[] fields = strline.split(","); if (fields[1].equals("value") { fields[1] = "different value"; } writer.append(fields); } catch(...) } but can't work out how write values same spot in file. unfortunately can't open single file both reading , writing @ same time. need read file , close before opening writing. the potential solutions are: write out

php - Register & Login password hashing method the same but not working -

i saw similar questions here don't think answers apply me, i'm sorry if do.. heres sniplet of code containing both procedures: note: the login , register works fine without hashing element. if (isset($_post['username']) && ($_post['password'])) { $username = trim($_post['username']); $username = strtolower($username); $password = trim($_post['password']); $salt = hash('md5', "$username"); $password = hash('sha256', "$password"."$salt"); $stmt = $dbh->prepare("select `id` `1_users` username=? , password=? limit 1"); $stmt->bindvalue(1, $username, pdo::param_str); $stmt->bindvalue(2, $password, pdo::param_str); $stmt->execute(); if ($stmt->rowcount()) { // match $results = $stmt->fetch(pdo::fetch_assoc); $_session['id'] = $results['id']; $_session['logged_in'] =

javascript - Posting data to PHP using AJAX -

i new ajax , javascript please forgive me if acting stupid trying pass variable routemid php page processing.php(preferable automatically 1 routemid has been calculated) tried out code breaks entire webpage. attached snippet ajax part having trouble , php code on next page appreciated. again in advance! <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type ="text/javascript" src="http://www.geocodezip.com/scripts/v3_epoly.js"></script> <script type="text/javascript"> var directiondisplay; var directionsservice = new google.maps.directionsservice(); var map; var polyline = null; var infowindow = new google.maps.infowindow(); var addresses = <?php echo json_encode($addresses); ?>; function createmarker(latlng, label, html) { var contentstring = '<b>'+label+'</b><br>'+html; var marker = ne

c# - Sending screenshots taking too much memory -

i trying make small application serve screenshot of entire screen through network. want able serve 1 every 1-2 seconds through lan. thought won't big problem, chose c# , nancy www self host (as easiest option). now, speed allright needs, seems taking way memory, , grows time. seems settle on taking 3.5 gb ram , no longer grows, that's not acceptable amount - big resolution (mine 2560x1440). is code bad, or nancy not suitable handling many big responses, or maybe c# method of capturing screen poorly optimized , should try pinvoke methods? or maybe it's terrible way , should try more advanced, using vnc library? currently code looks this: public class homemodule : nancymodule { private bitmap bitmapscreencapture; private graphics graphics; private object lockme = new object(); private memorystream memorystream = new memorystream(); public homemodule() { get["image"] = parameters => { lock (lockme)

c# - Stream to byte array conversion -

i have selected image stream , want convert byte. how can that? void photochoosertask_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { messagebox.show(e.chosenphoto.length.tostring()); var image = new bitmapimage(); image.setsource(e.chosenphoto); /// ???? //code display photo on page in image control named myimage. //system.windows.media.imaging.bitmapimage bmp = new system.windows.media.imaging.bitmapimage(); //bmp.setsource(e.chosenphoto); //myimage.source = bmp; } }

android - Emulator stops responding, tables not created -

the application starts , database created. application stops responding when table created. error message: table magazine has no column named key_m_name. here code helper: import com.example.projectdbms.model.magazine; import android.content.contentvalues; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class helper extends sqliteopenhelper { // logcat tag private static final string log = "helper"; // database version private static final int database_version = 1; // database name private static final string database_name = "magazine publishers db"; // table names private static final string table_magazine = "magazine"; private static final string table_article = "article"; private static final string table_editor = "editor"; private static final string table_author = "author"; pri

jquery not working after ajax post asp.net mvc4 -

here jquery function not working after jquery ajax call. here code ajax call <input type="button" value="comment" class="submitcomment" onclick="additem(this);" /> and <script type="text/javascript"> function additem(data) { postdata = $(data).parents().find("textarea"); var input = { "prdhierkey": postdata.parents().find('input[data-attr="prodkey"]').val(), "geohierkey": postdata.parents().find('input[data-attr="geokey"]').val(), "period": postdata.parents().find('input[data-attr="period"]').val(), "comment": postdata.val() }; $.ajax({ url: '@url.action("addcomments", "card")', type: "post", data: json.stringify(in

c# - How to make continuous WebJob? -

i create azure webjob shown in following script dequeues item azure storage queue, , stores azure table. process finished running within 1 or 2 seconds, runs few times in minute (and halted in approximately 10 minutes). overall, not work well. what missing? maybe i'm mixing trigger job , continuous job, hard find appropriate sample. class program { static void main(string[] args) { console.writeline("started @ {0}", datetime.now.tostring("s")); // continuous job should have infinite loop. while(true){ var host = new jobhost(); host.runandblock(); } } public static void processqueuemessage([queueinput("blogqueue")] string json) { var storageaccount = cloudstorageaccount.parse(configurationmanager.connectionstrings ["storageconnectionstring"].connectionstring); var tableclient = storageaccount.createcloudtableclient(); // store azur