Posts

Showing posts from February, 2011

homebrew - How to remove all versions of a formula with brew -

$ brew remove hadoop error: hadoop has multiple installed versions i can not seem find way how remove versions (they 1.0.4 , 1.1.2 ). brew cleanup hadoop seems way go, uninstalls versions installed! hope helps somebody.

javascript - (moment.js) format dates retrieved from mongo -

is there way format date objects stored in mongodb after retrieve them? i tried (updated) tests.find({}, {roomid: 1, teacher: 1, created: 1}, function(err, result) { if (err) {console.log(err);} result = result.map(function (doc) { console.dir(typeof doc.created); console.dir(doc.created); doc.created = doc.created.format("mm.dd.yyyy"); return doc; }); res.render('showtests', {tests: result}); }); but cannot read property 'format' of undefined (which odd, because in jade each test in tests p.col-md-3 #{test.roomid} p.col-md-3 #{test.teacher} p.col-md-3 #{test.created} prints date "correctly" (as mile-long string).) i tried add format directly in jade, didn't work either. do have store formatted? can't solution? console output (updated) 'object' tue feb 02 2016 20:58:36 gmt+0100 (m

segmentation fault - MySQL multithreading app and segfault when reconnect to MySQL into worker thread -

i have multithreading application client mysql , use mysql c-client (libmysqlclient_r). have db connections pool, open connection before create thread workers (pthread_create). the each worker gets single connection connections pool before starting work , puts pool after finishing work. each worker use it's unique connection. but, database server overload, , mysql client have errors: mysql " lost connection mysql server during query" or " mysql server has gone away". application make reconnect in worker thread: my_bool res = mysql_ping(c->mysql); if (res) { mysql_close(c->mysql); mysql_thread_end(); c->mysql = mysql_init(null); mysql_thread_init(); struct conn_desc *cd = &c->db->cds[c->num]; syslog(log_err, "reconnect :[%s:%d]\t%s\tnew mysql=%x tid=%x\n", cd->host, cd->port, c->db->default_db_name, c->mysql, pthread_self()); res = mysql_real_connect(c->mys

java - Spring MVC ModelAttribute as Interface -

using spring mvc @controller, how have @requestmapping endpoint have @modelattribute declared interface? i want have 3 different forms being posted mapping underlying classes of interface type. so example, can have 3 different form objects action following: @requestmapping(path="/dosomething", method=requestmethod.post) public string dosomething(objectinterface forminfo) { ... } (where objectinterface interface, not concrete class.) figured out. write , register custom handlermethodargumentresolver. below core code. need figure out concrete bean class pass webdatabinderfactory. controller can written accept interface , provided concrete implementing bean behind interface. public class messageresolvertest implements handlermethodargumentresolver { public boolean supportsparameter(methodparameter methodparameter) { return methodparameter.getparametertype().equals(<interface>.class); } public object resolveargument(method

c++ - why would cin.fail() pass input=100a if 'input' is an int? -

Image
int main(void) { int valid_input(); int ll_input=0; int resp; hash_table obj; int bucket; while(1) { ll_input=valid_input(); if(ll_input>10) { break; } obj.insert(ll_input); } obj.print_ll(); return 0; } int valid_input() { int input; printf("\n\renter value: "); std::cin >> input; while(std::cin.fail()) { std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n'); printf("\n\rbad entry!\n\renter value: "); std::cin>>input; } return input; } the above code, works correctly alphanumeric combinations, rejects user inputs a,10aa,1003abc, etc. however, on inputs 100a, 100b, etc, passes. reason this? the following output in snapshot cin >> input stops reading finds non number, "100a" interpreted 2 tokens: "100" , "a". "100" converted int , exit

dart - Pub install failed, [1] Class '_File' has no instance method 'readAsStringSync' with matching arguments -

i did update dart m3 (20602) , have problem pubspec.yaml. when try install packages receive message error : pub install failed, [1] class '_file' has no instance method 'readasstringsync' matching arguments. any workaround appreciate, in advance.

r - Loading ggplot2 package, missing 'munsell' package -

i trying load ggplot2. using windows 7. r tells me ggplot2 has loaded when try use library function says cannot find ggplot2. here says. install.packages("ggplot2") installing package ‘c:/users/owner/documents/r/win-library/3.1’ (as ‘lib’ unspecified) trying url 'http://cran.rstudio.com/bin/windows/contrib/3.1/ggplot2_1.0.0.zip' content type 'application/zip' length 2675581 bytes (2.6 mb) opened url downloaded 2.6 mb package ‘ggplot2’ unpacked , md5 sums checked downloaded binary packages in c:\users\owner\appdata\local\temp\rtmpyess1j\downloaded_packages i tried use library function , got message: library("ggplot2") error in loadnamespace(i, c(lib.loc, .libpaths()), versioncheck = vi[[i]]) : there no package called ‘munsell’ error: package or namespace load failed ‘ggplot2’ > head(diamonds) error in head(diamonds) : object 'diamonds' not found i hope has idea have done wrong. you should have executed t

java - Can guava cache help me with storing results of approx. 100 records? -

i've been searching solution cache following: 1) have small mysql table (~100 rows) 2) there 2 different select queries hitting table 2 different servlets (i need random order of items every time order rand ) select sku, category, title, item_image_url_small itemdata display = 'on' , category = 'table' , customer = ? , parameter = ? order rand() limit 2 select sku, category, title, manufacturer, price, list_price, star_rating, model, item_image_url_small, item_image_url_medium itemdata display = 'on' , available = 'yes' , category not in ('table', 'case', 'chair') order rand() limit 3 3) table getting updated every 8 hours 4) majority of fields varchar type i'd cache results of both queries. guava right solution , if so, there example check has caching multiple columns? thanks!

android - How to stop Touch To Explore feature of TalkBack in my app -

i'm working on project blind people, there're lot of troubles need fix if user activates talkbalk on phone. i'm creating soft keyboard blind people, blind tap single finger on circles "braille cell dots" generate braille code, types character/number/symbols wants presented in braille language. my problem touch explore feature of talkback, user not able make single tap on screen because action handled talkback, user must double tap on dot , not app! how generate single tap if touch explore feature enabled in talkback? you don't. it's terrible idea. come gestures , mechanisms fit within talkback allows. if annotate specific feature or mechanism of app not allowed work talkback, recommend alternative. gesture that's not working?

java - Textured Sphere in LWJGL -

i want draw glu sphere,which works, dont know how can texture it. there no point gltexcoord2f go. if you're using lwjgl, don't think there way easily. on windows documentation of glusphere() says: if texturing turned on (with gluquadrictexture): texture coordinates generated t ranges 0.0 @ z = -radius 1.0 @ z = radius (t increases linearly along longitudinal lines); , s ranges 0.0 @ positive y-axis, 0.25 @ positive x-axis, 0.5 @ negative y-axis, 0.75 @ negative x-axis, , 1.0 @ positive y-axis. but gluquadrictexture not included in lwjgl (or @ least haven't found it). try importing obj sphere uv coords, or make custom sphere class generate uvs. for not using lwjgl, here's nice little tutorial found on texturing glusphere : http://acidleaf.com/texture-mapping-the-glusphere/

python - Print List with Number of Players (Blackjack) -

so i'm writing blackjack program, i'm stuck on 1 part (which killing me arrghh). i'm trying print multiple hands (list) corresponding players. phands = [['9d', '2h'], ['ts', '2d], etc..] #this shuffled deck ex. player n: [3h, ts] here's code: def print_blackjack(phands, num_of_players): in phands: num in range(num_of_players): print('player' + str(num) + ':', i) return it returns hands, each hand has multiple players associated it. i know simple problem, mind giving me blank. any help? thanks! edit*** here's full code far def make_deck(): # randomly shuffle deck import random cards = [] suit in ['h', 'c', 's', 'd']: num in ['a', '2', '3', '4', '5', '6', '7', '8', '9', 't', 'j', 'q', 'k']:

mysql - Two ORDER BY clauses and a LIMIT -

this sorting: have table ids, names , ratings. want list 10 best items based on ratings, that's fine: select id items order ratings desc limit 10 but here comes hard part: want list 10 best items based on ratings order them alphabetically. tried select id items order ratings desc, names asc limit 10 and select id items order names asc, ratings desc limit 10 but neither gives desired result. you use subquery: select * ( select id, names items order ratings desc limit 10 ) t order names edit: further explanation your original query sorts ratings desc, , names -- sort names same ratings. if 2 items had same rating, you'd 2 sorted name. it's going sort records rating first , , name afterwards (within same ratings).

function - layering up Canvas to make a background -

Image
with of other stack overflow members. i've created animated canvas section of website building. i'm pretty new canvas, want have animated arc/circle function animate(elementid, endpercent) { var canvas = document.getelementbyid(elementid); var context = canvas.getcontext('2d'); var x = canvas.width / 2; var y = canvas.height / 2; var radius = 43.5; var curperc = 0; var counterclockwise = false; var circ = math.pi * 2; var quart = math.pi / 2; context.linewidth = 9; context.strokestyle = '#c51414'; context.linecap = 'butt'; context.shadowoffsetx = 1; context.shadowoffsety = 1; context.shadowblur = 1; context.shadowcolor = "#c51414"; function render(current) { context.clearrect(0, 0, canvas.width, canvas.height); context.beginpath(); context.arc(x, y, radius, -(quart), ((circ) * current) - quart, false); context.str

How to share custom getter and setter methods across models in Ruby on Rails? -

i have these custom getter , setter methods in of models: def hourly_rate hourly_rate_in_cents.to_d / 100 if hourly_rate_in_cents end def hourly_rate=(number) self.hourly_rate_in_cents = number.to_d * 100 if number.present? end is possible share these across models? if put them , how include them in models need them? thanks help. you pull them out separate module, can defined in module directory, e.g. app/modules then include them in model, e.g. include 'hourly_rate'

c# - Correct format to input date with time of the day -

i want able calculate time in hours , minutes elapsed between, say, 12:35pm 02/13/2016 1:45pm 02/14/2016, can't figure out correct format input it. edit: should add span between times stored in arraylist, 1 span per customer. basically, need this: var datea = new datetime(2016,2,13,12,35,0); var dateb = new datetime(2016,2,14,1,45,0); var timespan = dateb - datea; var hours = timespan.hours; bar minutes = timespan.minutes;

java - What is the prefered method for opening starting a swing interface and what's difference? -

this question has answer here: extends jframe vs. creating inside program 6 answers so i've found multiple ways of implementing swing gui in java don't know each , teacher isn't able me. 1 method of creating jframe is: import javax.swing.*; import java.awt.*; public class ui extends jframe{ public ui() { initalisegui(); } private void initalisegui(){ settitle("my title"); setbackground(color.red); setsize(800,500); setlocationrelativeto(null); setdefaultcloseoperation(exit_on_close); } public static void main(string[] args){ eventqueue.invokelater(new runnable(){ @override public void run(){ ui m = new ui(); m.setvisible(true); } }); } but way of implementing is: import javax.swing.*; import java.awt.*; public cl

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

i use delphi xe2 , indy10 udp protocol. can't receive server echo on client side if use receivebuffer method. got "socket error # 10040" although send small echo message server client. console application illustrate problem below. in advance. program project1; {$apptype console} {$r *.res} uses system.sysutils, idglobal, idbasecomponent, idcomponent, idsockethandle, idudpclient, idudpserver, idudpbase, idstack; type tudp_serv = class(tidudpserver) procedure udpsvudpread(athread: tidudplistenerthread; adata: tidbytes; abinding: tidsockethandle); end; var udpserver: tudp_serv; udpcl: tidudpclient; bsnd, brcv: tbytes; s: string; k: integer; //============================================================================== procedure tudp_serv.udpsvudpread(athread: tidudplistenerthread; adata: tidbytes; abinding: tidsockethandle); begin writeln(' server read: ' + tohex(adata, length(adata))); abinding sendto(peerip, peerport, adat

android - Issue drawing custom item in a ListView -

i need create custom listview item textview , colored rectangle. to have arrayadapter: public class jobquicklistadapter extends arrayadapter<job>{ private int resource; public jobquicklistadapter(context context, int resource, list<job> items) { super(context, resource, items); this.resource = resource; } @override public view getview(int position, view convertview, viewgroup parent) { jobtagview jobview; job item = getitem(position); string jobtitle = item.gettitle(); if (convertview == null) { jobview = new jobtagview(getcontext()); string inflater = context.layout_inflater_service; layoutinflater vi = (layoutinflater)getcontext().getsystemservice(inflater); vi.inflate(resource, jobview, true); } else { jobview = (jobtagview) convertview; } jobview.setcolor(color.blue); textview jobtitletext = (tex

facebook - cURL issue with php -

when tryin manualy fetch php page passing url, exception appearing says javax.servlet.servletexception: java.lang.runtimeexception: php fatal error: uncaught exception 'exception' message 'facebook needs curl php extension. but when searched php curl in insatllation directory, found there. [ashish@hpproliant ~]$ php /usr/local/bin/php [ashish@hpproliant ~]$ curl /usr/local/bin/curl i have modified php.ini file line related curl commented..what need do now?? thanks maybe sudo apt-get install php5-curl

Azure Triggered Webjob - Detecting when webjob stops -

i developing triggered webjob use timertrigger . before webjob stops, need dispose objects don't know how trigger "webjob stop". having noautomatictrigger function, know can use webjobsshutdownwatcher class handle when webjob stopping triggered job need help... i had @ extensible triggers , binders azure webjobs sdk 1.1.0-alpha1 . is idea create custom trigger (stoptrigger) used webjobsshutdownwatcher class fire action before webjob stops ? ok answer in question : yes can use webjobsshutdownwatcher class because has register function called when cancellation token canceled, in other words when webjob stopping. static void main() { var cancellationtoken = new webjobsshutdownwatcher().token; cancellationtoken.register(() => { console.out.writeline("do whatever want before webjob stopped..."); }); var host = new jobhost(); // following code ensures webjob running continuously host.runandblock();

javascript - node.js - can someone explain this callback? -

there's more 1 node.js tutorial out there, demonstrating how create server. but, they're coded in different ways. so, how know when write 1 way, versus another? none of tutorials explain why wrote way did. for example... example 1: // create http server, passing in function reason: http.createserver(function(request, response) { versus example 2: // create http server, , start var server = http.createserver(handlerequest); server.listen(port, function () { thanks in advance. i'm having trouble understanding this. they're no different, really. in first, you're defining function handling request on spot have start listening @ end. http.createserver(function(request, response) { ... }).listen(port, function() { ... }); in second, define function handling request elsewhere , don't use chaining. function handlerequest(request, response) { ... } var server = http.createserver(handlerequest); server.listen(port, function() { ...

Where can I create images from? Locally at all? (Docker remote API) -

may/may not easy question here, can pull images create new docker image via api? documentation my (unsuccessful) attempts have been trying build image local. using docker images list of images, trying use image id or repository has not worked me while using fromimage query param so: curl --data '' host:port/images/create?fromimage=test/hello-world&tag=webtesting i consistently following error: {"errordetail":{"message":"error: image test/hello-world not found"},"error":"error: image test/hello-world not found"} in running docker images , can see following: repository tag image id created virtual size test/hello-world latest 6d9bd5e6da4e 2 days ago 556.9 mb in combinations of using repository/tag/id error still displays. understand can create images urls fromsrc , , there alternative create image routes uploading .tar files, is possible in case create image 1 exists locally?

vb.net For loop in If statement - shorten the ElseIf -

how shorten this: information: %washv% constant coming outer loop %loop%. i tried loop in elseif / new if statement failed thanks. code: |if [%loop%] = "1" return "true" elseif [%loop%] =96-(96-round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-2*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-3*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-4*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-5*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-6*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-7*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-8*round([5000/%washv%])) return "true" elseif [%loop%] =96-(96-9*round([5000/%washv%])) return "true" else return "false“ end if| if vb.net, simplification can done this: for integer = 1 9 if [%loop%] =96-(96-i*ro

web config - JSON Limited to 1180 Characters -

i have simple javascript json request stringify's object send via json request c# web server. whenever string returned stringy on 1180 characters, webmethod not called on server. from understanding, there no limit on how string data client can send via json. understand limitation on server end, trying accept paramaterized request. is there somewhere in web.config can increase limit of 1180? my current config; <?xml version="1.0"?> <configuration> <connectionstrings> <add name="applicationservices" connectionstring="data source=.\sqlexpress;integrated security=sspi;initial catalog=aspnetdb" providername="system.data.sqlclient"/> <add name="applicationservices2" connectionstring="data source=.\sqlexpress;integrated security=sspi;initial catalog=trimweb" providername="system.data.sqlclient"/> <add name="applicationservices3" connectionstring=&qu

sql server - How to get column values in one comma separated value -

i have table contains rows below id user department 1 user1 admin 2 user1 accounts 3 user2 finance 4 user3 sales 5 user3 finance i need select query results following format id user department 1 user1 admin,accounts 2 user2 finance 3 user3 sales, finance you tagged question both sql-server , plsql provide answers both sql server , oracle. in sql server can use for xml path concatenate multiple rows together: select distinct t.[user], stuff((select distinct ', ' + t1.department yourtable t1 t.[user] = t1.[user] xml path(''), type ).value('.', 'nvarchar(max)') ,1,2,'') department yourtable t; see sql fiddle demo . in oracle 11g+ can use listagg : select "user", listagg(department, ',') within group (order "user") departments yourtable group "user" see sql fiddle demo

PHP Sorting issue -

this question has answer here: sort multi-dimensional array built csv data using php 4 answers i'd ask help. have csv file in there values stored in 4 different categories. ( b c d ) have these values displayed in order date, however, i'd page display them category, , after sort them date. $_news_date date stored, , $news_category category stored. for example: i'd want category first , b secound, c third, etc. than, if i'd have 2 items a, i'd want in order date, recent on top of list. mean category item above category b item, if it's older. if (!count($news_headlines)>0){ echo 'nothing display moment. '; }else{ foreach ($news_headlines $key => $item){ list($news_id,$news_date,$news_title,$news_body,$news_category) = $item; $formatted_date = date

php - Link from Lightbox to Lightbox of different sizes -

i have login , sign forms. both opening in lightbox. login have link sign , vice versa. links working properly, issue sign box's height 600px while of login 250px. so, when navigating login sign up, opening 250 height , scroll bar appears gives ugly look. i want sign should open 600px height when clicking login have 250px height. i using thickbox.js lightbox what tried is: function signup() { window.location="sign_up.php?tb_iframe=true&height=600&width=330"; } if forms same domain can try code before navigating iframe link: window.parent.$('#tb_window').animate({ height: 600 }); so if changing iframe location signup function should modify it function signup() { window.parent.$('#tb_window').animate({ width: 330 height: 600 }); window.location="sign_up.php?tb_iframe=true&height=600&width=330"; }

html - Passing params to EXE on a download link click from browser -

i have exe file. placed on server [https://mydoain.donaim.com/installer.exe]. this avilable user html download link. when user clicks on , popup shall display , ask run or save. exe has option run in different languages.so reqirment read parameter [example:language l1] server , start exe in selected language. exe has got command lins args invoke exe in desird language. the problem is, how can send command line args download link html tag ? or can download batch file on click event , ask exe run in desired lang.? if case if user downloads exe. on click on exe, installer should popup in download language. please help..

c# - Need to get the pie chart with % values -

my aspx part <div runat="server" id="divmain"> <asp:chart id="chart1" runat="server" datasourceid="sqldatasource1"> <series> <asp:series name="series1" charttype="pie"> <points> //i want part come code-behind //<asp:datapoint axislabel="1 star" yvalues="100" /> //<asp:datapoint axislabel="2 star" yvalues="123" /> //<asp:datapoint axislabel="3 star" yvalues="155" /> //<asp:datapoint axislabel="4 star" yvalues="245" /> </points> </asp:series> </series> <chartareas> <asp:chartarea name="chartarea1"> </asp:chartarea> </chartareas> <

html - Angularjs value not updating -

i know similar questions have been asked don't apply case. have defined variables in controller , display values in panel. controller related part this: var vm = this; vm.wellid = "id"; vm.wellseq = "sequence"; vm.onwellselected = onwellselected; ... function onwellselected(wells) { ... vm.wellid = wells[0]["id"]; vm.wellseq = wells[0]["sequence"]; ... } and html component this: <div plate id="plate-layout" on-well-selected="vm.onwellselected(wells)"> </div> <ul class="list-group" style="width: 400px; overflow: auto"> <li class="list-group-item">{{vm.wellid}}</li> <li class="list-group-item">{{vm.wellseq}}</li> </ul> i checked source , set break points in function onwellselected: vm.wellid , vm.wellseq indeed changed correct values after operation, new value cannot displayed. definition of plate i

javascript - HTML, jQuery, CSS - Width() returning entire page width instead of div on page load? -

so i'm trying have function apply "padding-bottom" in div when page loaded, problem width returns entire document value instead of div value. when use function (that changes between images) function works fine. $(window).load(function () { $('.photoset').each(function () { $items = $(this).find('img') function get_height(target) { return (($items.eq(target).height() / $(this).width()) * 100) + '%'; } $items.css({ paddingbottom: get_height(0) }); }); } the css follow: .photowrapper{ width:60%; margin:auto; } .photoset { position: relative; display: block; margin:auto; overflow:hidden; } .photoset figure{ width: 100%; margin: 0; padding: 0; position: absolute; top: 0; left: 0; overflow: hidden; text-align:center; } .photoset img { opacity: 0; transition:opacity 1.2s; max-width:100%; } .photoset .photoset-show img{ opacity: 1; } and

Restore PostgreSQL database using java -

im using following code restore postgresql database using java runtime r = runtime.getruntime(); process p; string cmd ="d:/program files/postgresql/9.1/bin/pg_restore.exe --host localhost --port 5432 --username postgres --dbname mytestqq --role postgres --no-password --verbose d:\sathish\rawdatabase.backup"; p = r.exec(cmd); i have 42 tables in rawdatabase.backup file 1 table getting restored why rest of tables not happening whats wrong in code? in advance!!!! it's surprising command show works @ all, since you're failing quote spaces in command path. try: string[] cmd = { "d:\\program files\\postgresql\\9.1\\bin\\pg_restore.exe", "--host", "localhost", "--port", "5432", "--username", "postgres", "--dbname", "mytestqq", "--role", "postgres", "--no-password", "--verbose", "d:\

msbuild - Visual C++ 2010 "system property sheet" and "user property sheet", key difference? -

Image
i'm reading inside msbuild 2nd-edition ms press. when comes chapter 10 introducing concept of "user property sheet" , "system property sheet", come question: determines whether property sheet "user" or "system"? as told book(p284), user property sheet , system property sheet displayed different icons inside visual studio 2010 ide. so, upgrade vc 6.0 , microsoft.cpp.win32.user "user". application , core windows libraries "system". i first thought .props %localappdata%\microsoft\msbuild\v4.0 "user " .props c:\program files (x86)\msbuild\microsoft.cpp\v4.0 "system" but that's not case, because upgrade vc 6.0 c:\program files (x86) while user property sheet. then what's key determination factor? well, maybe author has answered have guessed, in vague , ambiguous way. on page 284, there is: the system property sheets pulled visual c++ project via foll

how to split JSON array in php -

i manage data want database using array_push , encode json in php . results below, { "name":[ "lucky draw ticket", "kip voucher rm10", "kip voucher rm20", "kip voucher rm50" ], "image":[ "\/l\/u\/lucky_draw_ticket_1.jpg", "\/c\/a\/cash-voucher.jpg", "\/c\/a\/cash-voucher2.jpg", "\/c\/a\/cash-voucher50_1.jpg" ], "price":[ "50.0000", "1500.0000", "2500.0000", "5000.0000" ]} but want separate below, don't know how do. { "catalog":[ { "name": "lucky draw ticket", "image": "\/l\/u\/lucky_draw_ticket_1.jpg", "price": "50.0000" }, { "name": "kip voucher rm10", "image": "\/c\/a\/cash-voucher.jpg", "price": "1500.0000" }, {

unix - Questions on mov command in assembly -

i have few issues using registers , storing data. before read in character want buffer of size 100 register esi points to. use this? mov esi, 100 store buffer size 100, , then mov esi, [al] inc esi to store current character entered esi , move next location store new character? i can't find out how check if null terminated character entered. i've tried cmp al, 0xa check new line , cmp eax, -1 check eof. note: have function called read_char read in character put al register to define buffer in nasm can use buffer times 100 db 0 you address mov esi, buffer to store character in al in it, , raise address write mov [esi], al inc esi how check if null terminated character entered the null byte following character. need compare word that. read character , following byte, compare: mov ax, [esi] cmp ax, 0x000a this tests if linefeed last item in zero-terminated string.

javascript - Django - reloading element through AJAX -

i trying alter selection options on page dynamically without reloading page. alteration shall depend on id received dynamically value of element on same page. trying use ajax element fails dynamically updated. wish render update through end. models.py class exptype(models.model): exp_type = models.charfield(max_length=40) def __unicode__(self): return self.exp_type class subtype(models.model): exptype = models.foreignkey(exptype, related_name= 'exptypes') exp_subtype = models.charfield(max_length=40) def __unicode__(self): return self.exp_subtype class payer(models.model): exp_payer = models.charfield(max_length=40) def __unicode__(self): return self.exp_payer views.py def recording(request): typex = exptype.objects.all() subtype = subtype.objects.all() payer = payer.objects.all() if request.is_ajax(): expval = int(request.post.get("formdata", "")) subtype = subtype.objects.filter(exptype=expval)

ibm bluemix - What is the proper way to integrate server-side code with IBM's dialog api? -

i want integrate web application ibm's dialog api. basically, want send pure text result ibm dialog api, set in xml, , other times, such when user wants dynamic response, might involve me querying database find account balance, example. current thought include sort of syntax in dialog xml can parse know if response conversation requires me change it. thinking of like: <input> <grammar> <item>what account balance?</item> </grammar> <output> <prompt selectiontype="random"> <item>{action_getbalance}</item> </prompt> </output> </input> so if got response {action_***} take own action. appropriate way of doing this? there way might better? this indeed recommended method see example line 1358 on movie application demo dialog file provided on wdc git repo <prompt selectiontype="random"> <item>"{search

Is it possible to develop a console mode application for Windows Phone 8? -

i have console application port windows phone 8. possible run console mode on wp8 ? saw ms-dos mobile app wonder if simulated console mode. i saw this question doesn't answer question. there nothing text mode windows phone. have simulate yourself.

javascript - AngularJS codes structure. Are they any difference? -

new in angularjs, know pros , cons between codes below? recommended use? $routeprovider.when('foo', { templateurl: 'foo.html', controller: fooctrl function fooctrl() { //something here } }); or $routeprovider.when('foo', { templateurl: 'foo.html' }); app.controller("fooctrl", function() { //something here }); //in html <div ng-controller="fooctrl"></div> i prefer second approach, , use when developing our application. elegant way of coding , seperating routes-configuration, module-wiring etc controllers. can write routes-config in main file app.coffee [i use coffeescript] defining routesconfig = ($route) -> $route.when('/employees', {templateurl: 'employee.employeeview.html'}) define routesconfig , wiring modules [eg: employee.employeecontroller] here. modules = ['employee.employeecontroller', 'user.usercontroller']

Create highcharts chart using AJAX/JSON -

i building website uses highcharts library display single line series chart. using ajax retrieve historical financial data yahoo finance using yql. the ajax call working correctly , can view returned data in console example console.log( data.query.results.quote[0].close ); returns closing price value 457.84 how build single line series chart using data? i cannot find simple explanation anywhere of how create chart using ajax data. thanks edit: fetching data in ajax , works correctly trying make chart work json im having difficulties. this code looks like: http://jsfiddle.net/jbgvx/ this demo code off highstocks website: http://jsfiddle.net/xdhkz/ i think problem date formatting of ajax request. date being returned 2013-02-25 chart wants js timestamps. there way can extract date ajax, convert using date.utc , make chart using converted data? if considering stock data, consider using highstocks instead of highcharts. can handle many data points faster

java - How to set filter to AutoCompleteTextView? -

i have data in in arraylist alldoctorsandspecialities. in oncreate method have set adapter , threshold(3) autotxt(autocompletetextview) however,my problem don't want show dropdown strings entered in edittext "dr.","dr. ",etc. following solutions tried 1) code: autotxt.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) { // todo auto-generated method stub } @override public void beforetextchanged(charsequence s, int start, int count, int after) { // todo auto-generated method stub } @override public void aftertextchanged(editable s) { // todo auto-generated method stub if(autotxt.gettext().tostring().equals("dr.")){ autotxt.dismissdropdown(); } } }); problem- not work combinatio

mysql - PHPMyAdmin EDIT and EXECUTE buttons disabled for Stored Procedures -

Image
i created couple of stored procedures in remote mysql database (web) week ago... during session created them able edit them, export them, etc... now, week later, wanted edit them, , find edit , execute buttons in routines tab 2 disabled... my web server running phpmyadmin 4.0.10.7 i found out that, reason, in routines table of information_schema db, routines (procedures) have different definer (well, not different, db considers them different) this why can't edit them... so, finally, scenario this. logged in cpanel , phpmyadmin usual, created procedures, , definer them user@icario.servidoraweb.net (my user + domain hosting provider)... then, when tried edit them week later, log in, , find user (running select current_user();) "user@10.0.5.47"... i open ticket hosting provider find out why login cpanel contains ip address instead of domain name, , have no idea, didn't change anything. now, yesterday logged in again, , can edit procedures, check user

amazon ec2 - Apache ServerAlias not redirecting to correct ServerName -

i'm try setup multiple wordpress sites on amazon ec2 instance. here's how httpd.conf file looks like: <virtualhost *:80> servername www.domain1.com serveralias domain1.com documentroot /var/www/html/domain1 </virtualhost> <virtualhost *:80> servername www.domain2.co serveralias domain2.co documentroot /var/www/html/domain2 </virtualhost> so, when entered domain1.com or www.domain1.com in browser, redirects correctly content wanted , www.domain2.co . however, when entered domain2.co, doesn't directs servername www.domain2.co first virtualhost settings www.domain1.com. anything i'm missing out here? try this. apache default 1st virtual host if doesn't find virtualhost match means second virtualhost being ignored. use www. alias , domain server name. see if helps. <virtualhost *:80> servername domain1.com serveralias www.domain1.com documentroot /var/www/html/domain1 </virtualhost>

c# - int.TryParse returning false on the first line of data from StreamReader -

long time reader, first time poster. i'm reading numbers text file integer array, 1 integer per line, using streamreader class. read through file once number of lines can define destination array. reset pointer beginning of text file , read again, time using int.tryparse covert strings integers , write array. first line file returns 'false' tryparse - though string merely '3. subsequent lines return 'true' fine. here's snippet ... _numbersinmemory = new int[linecount]; thefilestream.discardbuffereddata(); thefilestream.basestream.seek(0, 0); linecount = 0; { string thelinefromthefle = thefilestream.readline(); int numberinmemorytemporarily = 0; bool result = int.tryparse(thelinefromthefle, out numberinmemorytemporarily); if (result) { _numbersinmemory[linecount] = numberinmemorytemporarily; } linecoun

jquery - Unexpected token when doing remote json call -

i've searched everywhere can't solve problem: when copy content of json file locally works (without callback=?) however when crossdomain call following error in console: uncaught syntaxerror: unexpected token : this code: var url='http://www.motor-forum.nl/json.php?type=json&callback=?'; $.getjson(url,function(json){ $.each(json.globals, function(i,data){ $("#results").html(data.board_reactid); }); }); hopefully can me out here i've tried api - not support jsonp. getting stuff remote servers isn't simple going &callback=? on urls - remote server needs openly support it. jsonp works across cross-domain restrictions loading return in script tag. means object must evaluable script. jsonp, user provides callback name in url, , return json object wrapped in function call ( mycallbackname({object}); ).

Using local SQL Server Database vs Access with Excel Addin -

i have excel addin reads/writes from/to ms access db installed on user's local machine. each user installs addin needs own stand alone access db well. i'd sql server db instead. how can without needing install sql server instance on every computer. possible? i jsut want add mdf file on local/client machine drivers , via vba read/write from/to mdf file

Get Ipv6 Full Format In Java -

i have ipv6 like: "2001:cdba::3257:9652". want ipv6 in full format like: 2001:cdba:0000:0000:0000:0000:3257:9652 . has function in java that? , how compress ipv6 full format? all. there no method in standard java libraries that. the ipaddress java library has methods produce formats , various other string formats. here code sample: ipaddressstring addrstring = new ipaddressstring("2001:cdba::3257:9652"); ipaddress addr = addrstring.getaddress(); string string = addr.tofullstring(); system.out.println(string); string = addr.tocanonicalstring(); system.out.println(string); the output is: 2001:cdba:0000:0000:0000:0000:3257:9652 2001:cdba::3257:9652

xsl fo - xsl-fo loop with counter -

i using xsl-fo , xml generate report. have query gets values table place on pdf. easy enough. querying based on parent-child relationship. example, pdf displays 2 sections: job title , responsibilities. @ first 1 one relationship. has turned 1 many relationship. need way of displaying on pdf job title , responsibilities , responsibilites 2, , on. responsibilities section has mod_num (1,2,3...). wondering if there way loop through in xsl-fo grab responsibilites specific job title. thinking of using clause in query pull right information where mod_num = 'xsl-counter' something that hope example wasn't sketchy. appreciated though. thanks i don't know if can using xsl-fo. if it's using ftl (as in moqui or ofbiz), can this: you can use <#assign x = 0/> set variable. then use <#list responsibilities r> in <#list>, can <#assign x = x+1/>. just inside <#list>, can use <#if>. like: <#assign x = 0/> <#l

html - IE9: how to forces 2 pages to display the same why? The first is in Quirks mode, the other IE7 Compatible -

no matter try do, pages keep looking different depending on whether local machine or development server. when pressing f12, i've finaly noticed pages have different instructions on top: 1) pages displayed local machine have following values: browser mode: ie9 compatible view document mode: quirks html starts line of code <html xmlns="http://www.w3.org/1999/xhtml"> 2) whereas pages displayed development server have following values: browser mode: ie9 compatible view document mode: ie7 standards html starts line of code <!-- doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" --> <html xmlns="http://www.w3.org/1999/xhtml"> it looks the first line of instruction that's making pages display differently. do need add line pages coming local machines well? why , how that? thanks helping without doctype, in quirks mode

regex - Include surrounding lines of text file match in output using Python 2.7.3 -

i've been working on program assists in log analysis. finds error or fail messages using regex , prints them new .txt file. however, more beneficial if program including top , bottom 4 lines around match is. can't figure out how this! here part of existing program: def error_finder(filepath): source = open(filepath, "r").readlines() error_logs = set() my_data = [] line in source: line = line.strip() if re.search(exp, line): error_logs.add(line) i'm assuming needs added last line, i've been working on bit , either not applying myself or can't figure out. any advice or on appreciated. thank you! why python? grep -c4 '^your_regex$' logfile > outfile.txt

c# - Invalid length parameter passed to LEFT or SUBSTRING function -

i got error mess "invalid length parameter passed left or substring function" below. can give me hint cause this, , how can solve it? string cmdtext = @"declare @sqlstring nvarchar(2500) , @areadelimiter char(1) , @areafilter nvarchar(max); select @areadelimiter = ',' if (@areaname not '*') begin set @areaname = @areaname + @areadelimiter set @areafilter = '' while len(@areaname) > 0 begin if (len(@areafilter) > 0) begin set @areafilter = @areafilter + ' or area ''' + ltrim(substring(@areaname, 1, charindex(@areadelimiter, @areaname) - 1)) + '%''' end else begin set @areafilter = 'area ''' + ltrim(substring(@areaname, 1, charindex(@areadelimiter, @areaname) - 1)) + '%''' end select @areaname = substri