Posts

Showing posts from April, 2011

javascript - Uncaught typeerror: Object #<object> has no method 'method' -

so here's object 'playerturnobj' function playerturnobj(set_turn) { this.playerturn=set_turn; function setturn(turntoset) { this.playerturn=turntoset; } function getturn() { return this.playerturn; } } and here i'm doing it var turn = new playerturnobj(); turn.setturn(1); so try make script setturn() method in playerturnobj() save 'turn' in game i'm making. problem is, not turn.setturn(1); part because keep getting error above what doing wrong? searched, not find exact answer question. this not way javascript works. "constructor" function contains inline functions not visible outside of scope of playerturnobj . variable turn not have method setturn defined, error message states correctly. want this: function playerturnobj(set_turn) { this.playerturn=set_turn; } playerturnobj.prototype = { setturn: function(turntoset) { this.playerturn=turntoset; }, getturn: func

jsp - Compare specific row or column of xls sheet using java and Apache POI -

my jsp file (to upload excel file) : <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <form method="post" action="uploadaction" enctype="multipart/form-data"> upload *.xls file: <input type="file" name="file" value="file"> <br><br> <input type="submit" value="submit"> </body> </html> my servlet code ( process excel file) import javax.servlet.servletexception; import javax.servlet.http.*; import java.io.fileinputstream; import java.io.fi

jquery - Is inline/block Javascript executed before document-ready? -

assuming 1 has inline javascript code in html document (the body example), piece of javascript executed before jquery document-ready code? for example, following safe? ... <body> <script type="text/javascript"> var myvar = 2; </script> ... </body> ... $(document).ready(function() { alert('my var = ' + myvar); } if not, how can make safe knowing myvar defined in inline/block code? yes, above code safe. inline js executed encountered while document being parsed top bottom. document ready handler executed when document ready (obviously), , won't ready until whole document has been parsed including inline scripts. note don't need document ready handler if include code wraps last thing in document body, because @ point not other inline js have executed of document elements have been added dom , accessible js.

python - i have stored the streaming twitter data in an o1.json file but i am unable to read all tweets -

import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"] o1.json contains streaming twitter data, when read data in python object, data type of data object dict, interested in finding value of text key, code give me 1 tweet interested in printing tweets may know how can tweets, working on data science assignment of coursea.org you're overwriting data on every iteration of loop, print text after loop finishes - of course you're printing 1 value (the last one). put print statement inside of loop: import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"]

excel - How to clear duplicate-named columns? -

actually have find column named "account" , have delete data entered in column. lets column name "account" in cell "b9" , values have been entered till "b30"(it variable), have delete data "b10"to "b30". , if have 1 more column in name of "account", have same column also. i have coded 1 column. want write multiple columns. here coding, private sub commandbutton1_click() dim xlapp excel.application dim wb workbook dim findrow range dim ad string dim accell string dim de string dim lad string dim col integer dim rw integer dim r integer dim rw2 integer dim myrange range on error goto errhandler: msgbox "please browse document" set xlapp = createobject("excel.application") filestr1 = application.getopenfilename() workbooks.open filename:=filestr1 , notify:=false xlapp set rng1 = activesheet.usedrange.

mysql - How to move all data from one SQL table to another -

this question has answer here: sql mass insert based off of data pulled table 3 answers i want move data 1 sql table another, both tables have identical structures. sample data : table | id | name | address| table b | id | name | address| requirement : move data table b table a, don't want use select on table b , insert on table data. preferably, alter table structures, achieve this. initial thoughts : deleted table a, , renamed table b table a. worked. problem cannot append data in table a. want retain data in table a, , append data in table b table a. so, solution didn't work. any pointers on how proceed this, appreciated. edit : apologies all, stupid question. best way use insert ... select... apologies, again! you should able rename both tables in single mysql rename table statement rename table tablea tableb, tableb tabl

android - Admob ads displaying on emulator but not real device -

i have simple activity test display of ads: public class adtestactivity extends activity { private adview adview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); thread.setdefaultuncaughtexceptionhandler(new exceptionhandler(this)); setcontentview(r.layout.ad_test); adview = new adview(this, adsize.banner, "[my ad id]"); linearlayout layout = (linearlayout)findviewbyid(r.id.layout_at_1); layout.addview(adview); adview.loadad(new adrequest()); } @override public void ondestroy() { if (adview != null) { adview.destroy(); } super.ondestroy(); } } ads working fine on emulators, , on phone on adb. however, if create .apk of project , install on same phone (after uninstalling 1 adb), force closes open adtestactivity. activity declared in manifest: <activity android:name=".adtestactivity" android:label="@string/title_activity_main"

php - Pulling currency values from other websites -

i pull values of specific currencies websites update them regularly. because need convert euro few foreign currencies. possible or should create own database , update it? by calling xml http://themoneyconverter.com/rss-feed/eur/rss.xml $url = "http://themoneyconverter.com/rss-feed/eur/rss.xml"; $cont = file_get_contents($url); $xml = new simplexmlelement($cont); $feeds = "aed/eur"; //// currency rate united arab emirates dirham ///// can use session foreach ($xml->channel->item $xml2){ if ($xml2->title==$feeds){ $xml2->description."<br>"; preg_match('/([0-9]+\.[0-9]+)/', $xml2->description, $matches); $rate = $matches[0]; } } i hope :)

editing .bat file to open folders -

first, here have: %systemroot%\explorer.exe "x:\cnc\2_newprograms" %systemroot%\explorer.exe "x:\prints" %systemroot%\explorer.exe "x:" this opens 3 folders regularly use. want specify in monitor should appear, , height , width of each window. there way specify such thing? thanks in advance. i don't think possible using .bat file. mean, knowledge, windows not come out of box allow this. you may need create small app it. believe function you'll need use setconsolewindowinfo() : http://msdn.microsoft.com/en-us/library/ms686125%28vs.85%29.aspx

sql server - create a file system group pointing at a SAN -

i working creating filetable in sql server 2012. want store files on san (storage area network). have mapped drive on sql server. to use filetable, need set file system group. using following script failing correct: alter database [mydatabase] add file ( name = filestreamfile, filename= '\\123.456.789.001\myfolder', maxsize = unlimited ) filegroup myfilestreamgroup end the entry have filename seems fail. how can set filestreamgroup point @ san , in turn use create file table it? as have found, can't put filestream files onto remote drive using unc path. best bet create lun on san , connect via iscsi, way drive appear local sql server still physically located on san. you want have chat storage admin doing really.

cordova - where to place the php & html files when building Phonegap app and how to make ajax calls for them -

i trying build android app existing php web application using phonegap. have php files logic , html files rendering ui. these files placed in webserver (wampserver) in system. have seen of sources, saying -> make ajax calls php files in webserver phonegap project. based on created index.html file has ajax call target txt.php file , tried run on android virtual device manager. see index.html loaded onto avd, have given input in textarea , clicked on 'save message' button. don't see response on avd. can please guide me on how place these html fils, php files , how make ajax calls.. hope question lot many beginners me.. as of now, below code named index.html , placed in assets/www/index.html of phonegap project. loading index.html page using super.loadurl("file:///android_asset/www/index.html"); index.html page looks this.. <html> <head> <script language=javascript> function chk_length(myform) { maxlen=767; if(myform.txt.v

php - using inner join and 4 tables is that possible -

i have members table contain 3 field foreign key 3 tables so want join between them possible ?? member table : governorate district village each field foreign key table governorate table : governorate_id governorat_name district table : district_id district_name village table : id village_name can in 1 query ???? yes can. select b.governorat_name, c.district_name, d.village_name member inner join governorate b on a.governorate = b.governorate_id inner join district c on a.district = c.district_id inner join village d on a.village = d.id to further gain more knowledge joins, kindly visit link below: visual representation of sql joins the query uses inner join in results should have atleast 1 matching record on every parent table ( governorate , district , village ). when columns nullable , want show records on table member table whether has no

combinations - How to combine correlated signals? -

there 11 signals: s_main : original signal s1 ~ s10 : 10 signals correlated s_main different correlation coefficients (coeff1 ~ coeff10) now here's question: how can combine signals s1, s2, ..., s10 in order generate s_main !!? (the correlation not linear.) thanks billion upcoming help.

python - Why does Fabric usually output an extra empty line? -

in fabric deployments, there empty response line output. ie, after running run('pwd') fabric return [mydomain] out: /mydir [mydomain] out: why this? this related old issue maintainer marked fixed. https://github.com/fabric/fabric/issues/219

php - setting a limit to a income every 15 minutes error -

ok file runs every 15 minutes income, farming , energy bonus @ stages don't want them go on $storagecap don't stop , keep adding more , more food, gold, energy account , never stops. what trying add income , if income goes on $storagecap put gold $storagecap doesnt work here code <?php include("functions.php"); connect(); include("user_stats.php"); ?> <?php if(isset($_session['uid'])){ include("safe.php"); include("storagecap.php");?> <?php $get_users = mysql_query("select * `stats`") or die(mysql_error()); while($user = mysql_fetch_assoc($get_users)) { //get $gold = $user["gold"]; $food = $user["food"]; $energy = $user["energy"]; //increment $gold += $user["income"]; $food += $user["farming"]; $energy += 5; //verify , correct if($energy > 100) $energy = 100; if($gold > $storagecap)

VS 2012: Change color of selected text when context-menu is open -

in visual studio 2012, know color scheme text editor can changed @ tools -> options -> environment -> fonts , colors. however, can't find this: when selecting chunk of text mouse, , right clicking on selection, background color selection changes. right now, color matches dark background of text editor, makes nothing selected. how can change background color of selected text when right-click context menu open? i think looking inactiveselectedtext option. a part this, want inform @ this site can find many premade themes accurately choosen colors

ElasticSearch: mappings for fields that are sorted often -

suppose have field "epoch_date" sorted when elastic search queries. how should map field? right now, have stored: yes. should index though field not count towards relevancy scoring? should add field if intend sort on field often, more efficient? { "tweet" : { "properties" : { "epoch_date" : { "type" : "integer", "store" : "yes" } } } } there's nothing need change sort on field given mapping. can sort on field if it's indexed, , default "index":"yes" numeric or dates. can not set numeric type analyzed , since there's no text analyze. also, better use date type date instead of integer. sorting can memory expensive if field sorting on has lot of unique terms. make sure have enough memory it. also, keep in mind sorting on specific field throw away relevance ranking, big part of searc

c++ - Vtable ran away -

class medicinerepository { public: virtual medicine* findbyid(int medid) ; virtual vector<medicine*> getall() ; virtual int getnrmeds() ; virtual void addmed(medicine s) ; virtual void removemed(int medid) ; virtual ~medicinerepository() ; }; undefined reference vtable medicinerepository' error in class.i'm inheriting class in module , looks in header: class medrepo : public medicinerepository{ public: ~medrepo(); ... }; and in cpp it's defined : medrepo::~medrepo() {} i don't understand , i've looked usefull in undefined reference vtable i don't think you've posted enough of error output meaningfully determine problem - getting in every file includes header, or getting on specific line of code? in file? did implement body ~medicinerepository? i suggest take copy of code, remove functionality implementations possible, strip down minimum set of definitions still generates error, , if doesn't solve it

c# - Out of bounds exception on incrementing variable -

i've been while out of c# , mvc. , struggling following error, don't see it. have list of restrictions , want add keys string[]. int cntr = 0; //loop through restrictions , add array foreach (var restriction in this.admingrouprepository.context.adminrestrictions.tolist()) { currentrestrictionkeys[cntr] = restriction.key; cntr += 1; } this error on cntr += 1 line: index outside bounds of array. i don't understand comes from, foreach breaks before cntr out of array's bounds right? you have allocated little space currentrestrictionkeys . don't need preallocate @ all; can use trivial projection linq: var currentrestrictionkeys = this.admingrouprepository.context.adminrestrictions .select(r => r.key) .toarray();

php - Force a form to send in UTF8 to my MySQL -

this question has answer here: utf-8 way through 14 answers i'm designing backend of web dreamweaver , mysql. when send form, content weird (like Áa(c)) , not show de correct charset. put charset utf8 in header (in php , html too), , tried utf8_encode in each post. still don't work... knows something? characters shown in mysql (and it's utf8). lot. use header('content-type: text/html; charset=utf-8'); in php file

javascript - Calling asynchronous function in callback -

i'm having trouble understanding asynchronous functions. i've read chapter in mixu's node book still can't wrap head around it. basically want request ressource (using node package cheerio ), parse valid urls , add every match redis set setname . the problem in end it's adding first match redis set. function parse(url, setname) { request(url, function (error, response, body) { if (!error && response.statuscode == 200) { $ = cheerio.load(body) // every 'a' tag in body $('a').each(function() { // add blog url redis if not there. var blog = $(this).attr('href') console.log("test [all]: " + blog); // filter valid urls var regex = /http:\/\/[^www]*.example.com\// var result = blog.match(regex); if(result != null) {

Create a swipe between pages with CSS and JQuery -

i'm trying mock smartphone swipe navigation in html+css+jquery. i'm setting few iframes includes html pages , swipe between them navigation menu. that's nice, want swipe activated buttons inside iframes (the "back menu" buttons on example) this did far: example the code used create swipe effect is: jquery: $(document).ready(function() { $('#slide1_controls').on('click', 'button', function(){ $("#slide1_images").css("transform","translatex("+($(this).index()-2) * -475+"px)"); }); }); can buttons inside iframes? note: in each page i'll have inside swipe effect well: implemented swiping between divs , not iframes, changing given iframes divs won't work. you can turn wrote function, , call function inside iframe. //// on parent page function slidepage(){ // slide logic goes here } //// inside iframe $('#slide-control').on('click'

stl - Implement Iterators Even When Not Needed? C++ -

i have container called "ntuple" c array , length. it's main purpose argument of multi-dimensional math functions. of now, it's fast , utilizes several constructors of form ntuple(double x, double y, double z) { size = 3; vec = new double[size]; vec[0] = x; vec[1] = y; vec[2] = z; } and every time work higher dimensional, yet known function, add new constructor. have on array well: ntuple(double* invec, long unsigned insizesize) in order make code more compatible regular c++ code, should implement ntuple iterator class? nothing i've done has needed 1 , seems slow down. more read, more vital seems use iterators sake of compatibility standard c++ code. i worry when tries work code, won't mesh standard techniques expect use. purpose of ntuple class take arguments functions. should implement iterators precaution (if else try use stl on it) @ cost of slowing code? thanks. implementing iterators wrapper around c array t

jcarousel auto cycle / turn -

i used jcarousel doing somemthing that: carousel autoscrolling not. i created custom.js file add js. , jcarousel part used code: $(function() { $.fn.startcarousel = function() { var bodywidth = $('body').width(), itemwidth = $('.mycarousel li').outerwidth(true), mycontwidth = bodywidth > itemwidth ? bodywidth - bodywidth%itemwidth : itemwidth, licount = $('.mycarousel li').size(), jscroll = 1; if(licount > mycontwidth/itemwidth){ jscroll = mycontwidth/itemwidth; } else { jscroll = 0; mycontwidth = licount * itemwidth; } $('.mycont').width(mycontwidth); $('.mycarousel').jcarousel({ scroll:jscroll }); }; $(this).startcarousel(); $(window).resize(function(){ $(this).startcarousel(); }); var carousel = $('.mycarousel'); $(c

ios - TextFields and labels not align correctly -

Image
i'm new ios development , can't figure out how fix problem. have few textfields , labels added, 2 of them appear 1 top of other in picture when run app: gender textfield , type textfield. what can align them correctly on runtime ? thanks. aligning issues caused (on interface builder); a) autosizing (auto layout since ios 6) messing aligned objects, when design app regular size , use iphone 5 size, or vice versa. b) when use tabbar or navigation bar , not select relevant 'status bar' / 'top bar' / 'bottom bar' attributes inspector > simulated metrics, messes aligned objects.

spring - Generic DAO - "Never go full generic!" -

ive seen allot of usages of generic dao on internet. gotta love it: public interface genericdao <t, pk extends serializable> {} public class genericdaohibernateimpl <t, pk extends serializable> implements genericdao<t, pk> a new class appeared? no problem: public interface newclassdao extends genericdao<newclass, long> and we're set. now, how bad if go "full-generic" , like: public interface fullgenericdao public class fullgenericdaohibernateimpl now can use 1 dao (of object casting!) a new class appeared again? no problem: newclassapperedagain newclassappeared = (newclassapperedagain) fullgenericdao.getitembyid(20, newclassapperedagain.class); two questions comes mind: 1) possible go "full-generic" , create such dao? mean dont see why not passing every method of dao classname , casting neccessary? save(object,classname); delete(object,classname); etc.. 2) cons (i'm sure there are) of such practice?

mongodb - How to download mongo database from website hosted at origin.meteor.com -

is possible download complete mongo db app hosted on meteor's servers in order transfer heroku, other download each collection individually? i wrote quick script this, meteor-download . easy ./download.sh origin.meteor.com

php - JSON encode unicode issue on PHP5.3 -

a string in hebrew after json_encode looks this: [{"id":"1","value":"\u05d1\u05dc\u05d0\u05d2\u05df"} idea encoding , how either work or readable again? btw, joomla system runs on php 5.3, string post request, not database , utf-8 meta tag exist. that's how json encodes non-ascii characters. text readable again when pass through json parser . php 5.4 defines new option json_encode , json_unescaped_unicode , pass utf-8 text through as-is without converting escape codes. since using php 5.3 can't use it, if had 5.4 how used: $json = json_encode($obj, json_unescaped_unicode); // php 5.4 required however, should not needed because json parser decode escape codes.

osx - How to create a QGLWidget from a CGLContextObj? -

i'm using qt 4.8.4 on mac os 10.8. i have cglcontextobj (created outside control). i create qglwidget (or @ least shared with) existing cglcontextobj — can render textures created on cglcontextobj . how can create qglcontext existing cglcontextobj ? already tried i found qglcontext::fromplatformglcontext() , method appears available when qt built in qpa mode (...but ./configure -qpa cocoa fails build, , haven't been able find documentation on -qpa flag does). qpa (qt platform abstraction) still work in progress in qt 4. it's fully integrated qt 5 . if have option upgrade qt 5, things might easier. in qt 5, can construct qcocoaglcontext (a derived class of qplatformopenglcontext ), , qopenglcontext ( qplatformopenglcontext::context() ), , qglcontext ( qglcontext::fromopenglcontext(qopenglcontext *) ). gets pretty close, how cglcontextobj qcocoaglcontext ? unfortunately, don't see option construct qcocoaglcontext cglcontextobj .

android - Scroll view with Button, ImageView and viedoView -

i try make scroll view button, imageview , viedoview. i create dynamically code. when put button video, can see both of them. same button , imageview. my problem when there videview , imageview. when have both of them cant see vidoview , seeo imageview. thank helping :) here code: xml scrollview code: <scrollview android:layout_width="match_parent" android:layout_height="fill_parent" android:fillviewport="true" > <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:id="@+id/datemain" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > </linearlayout> </relativelayout> </scrollview> my java code: private void addpics() { ext

java - Send a parameter for every result -

i want send specific parameter every result. struts.xml : <action name="modifierpara" method="modifierpara" class="ma.ensao.evalmetrics.view.parametrageaction"> <interceptor-ref name="loginstack" /> <result name="sscara"> <param name="etat">sscara</param> /web-inf/admin/projets/parametrer/modifiersubcara.jsp </result> <result name="metric"> <param name="etat">metric</param> /web-inf/admin/projets/parametrer/modifiermetric.jsp </result> </action> depends on value of etat , execute linkcontroller.modifier different arguments. ma.ensao.evalmetrics.view.parametrageaction : public class parametrageaction extends actionsupport { private static final long serialversionuid = 9149826260758390091l; private parametrage para; private long id; private paramanager linkcontroller;

c# - Response.Write on shared hosting -

on asp.net site, build 2-3 mb csv file , try send response, do: stringbuilder sb = new stringbuilder(); sb.appendline("name\ttype\tnumber\tstatus"); foreach (string county in getcounties()) { list<stationitem> list = getstationitems(county); foreach (stationitem item in list) { sb.appendline( string.format( "{0}\t{1}\t{2}\t{3}", item.name, item.type, item.number, item.status)); } } response.clear(); response.contenttype = "text/csv"; response.appendheader("content-disposition", "attachment; filename=stations.csv"); response.output.write(sb.tostring()); response.end(); it works perfect on loca

Setting the authenticated user on a Django model -

i have number of models need refer user created/updated them. involves passing request.user relevant attribute, i'd make automatic if possible. there's extension doctrine (a php orm) called blameable set reference authenticated user when persisting model instance, e.g.: class post { /** * set authenticated user on first persist($model) * @orm\manytoone(targetentity="user", inversedby="posts") * @gedmo\blameable(on="create") */ private $createdby; /** * sets authenticated user on first , subsequent persists * @orm\manytoone(targetentity="user") * @gedmo\blameable(on="update") */ private $updatedby; } to same functionality in django, first thought try , use pre_save signal hooks emulate - i'd need access request outside of view function ( looks possible middleware bit hacky). is there similar available django? better off explicitly passing authenticated

ggplot2 - Stacked bar plot in r with summarized data -

i'm new r. im trying make stacked bar plot. make work using barplot function. not work out how make legend nice. i'm trying use ggplot2 cant make chart correctly. the data represents simulation comparing bootstrap confidence interval against standard parametric confidence interval based on t-distribution. data summarized. how data.frame like: test cr type2 1 bootstrap 0.406 0.596 2 t-test 0.382 0.618 cr = correct rejection, type2 = type 2 errors what want make stacked bar chart 1 bar each test. bars should stacked cr , type2 height should both summarize 1. any help/suggestions appreciated! espen you should reshape data long format, library(ggplot2) d <- read.table(textconnection("test cr type2 bootstrap 0.406 0.596 t-test 0.382 0.618"),head=true) library(reshape2) ggplot(melt(d, id="test"), aes(test, value, fill=variable)) + geom_bar(stat="identity", position="stack")

performance - R: Why is the [[ ]] approach for subsetting a list faster than using $? -

i've been working on few projects have required me lot of list subsetting , while profiling code realised object[["namehere"]] approach subsetting lists faster object$namehere approach. as example if create list named components: a.long.list <- as.list(rep(1:1000)) names(a.long.list) <- paste0("something",1:1000) why this: system.time ( (i in 1:10000) { a.long.list[["something997"]] } ) user system elapsed 0.15 0.00 0.16 faster this: system.time ( (i in 1:10000) { a.long.list$something997 } ) user system elapsed 0.23 0.00 0.23 my question whether behaviour true universally , should avoid $ subset wherever possible or efficient choice depend on other factors? function [[ first goes through elements trying exact match, then tries partial match. $ function tries both exact , partial match on each element in turn. if execute: system.time ( (i in 1:10000) { a.long.list[[

php - Why is jquery dialog-message refreshing my page unwantedly (inside form) -

i trying embed simple jquery dialog-message form. dialog should show additional information , not interact form in way except beeing called via button inside form. my problem following: if dialog called inside form whole page gets refreshed instantly, not showing dialog @ , clearing form fields. if button outside form working fine. the dialog content being loaded via templates this: <script> $(function() { var dlg = $( "#dialog-message" ).dialog({ autoopen: false, width: '80%', closeonescape: false, modal: true, buttons: { ok: function() { $( ).dialog( "close" ); } }, open: function() { // content laden... $("#dialog-message").load('template.html', function() {}).dialog() } }); $( "#opener" ).click(function() { $( "#dialog-message" ).dialog( "open" )

android - Progress Bar not loading? -

i have small game i'm working on , i'm trying have progress bar xp bar. have set thing won't move private static final int progress = 0x1; private progressbar mprogress; private handler mhandler = new handler(); private int mprogressstatus; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.play_screen); mprogress = (progressbar) findviewbyid(r.id.xpbar); mprogress.setmax(integer.parseint(textviewxpnextlevel.gettext().tostring())); new thread(new runnable() { public void run() { int xp = integer.parseint(textviewxpvalue.gettext().tostring()); int xpnext = integer.parseint(textviewxpnextlevel.gettext().tostring()); while (mprogressstatus < xpnext) { mprogressstatus = xp; mhandler.post(new runnable() { public void run() { mprogress.setprogress(mprogresss

ios - MKMapView is not showing annotated points -

i trying show location of current location , random 5 points points this: - (void)viewdidload { [super viewdidload]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; [locationmanager startupdatinglocation]; otherlat = [nsnumber numberwithdouble:[currentlatitude doublevalue]]; otherlong = [nsnumber numberwithdouble:[currentlongitude doublevalue]]; [self.mapview setshowsuserlocation:yes]; mapview.delegate = self; longi = [[nsmutablearray alloc] init]; lati = [[nsmutablearray alloc] init]; nsmutablearray *la = [[nsmutablearray alloc] init]; nsmutablearray *lo = [[nsmutablearray alloc] init]; la = [nsmutablearray arraywithobjects:@"20", @"21", @"42", @"51", @"75", nil]; lo = [nsmutablearray arraywithobjects:@"60", @"21", @"82", @"181", @"35", nil]; (int x = 0; x < [la count];

regex - use sed to search and replace patterns via regular expressions -

trying replace within file including password space. password=xx%40%25pkz3l2jta http tried following sed command, using regular expression http://en.wikipedia.org/wiki/regular_expression sed 's/password=(.)+/ /g' $file and sed 's/password=[^ ]+/ /g' $file none of above works. why? try -r argument: sed -r 's/password=[^ ]+/ /g' $file

Fabric 'contains' not finding text properly -

i trying run following command in fabric contains('~/.bash_profile', 'bind' , exact=false) it keeps returning 'false' when words 'bind' present. here bash file: # .bash_profile # aliases , functions if [ -f ~/.bashrc ]; . ~/.bashrc fi # user specific environment , startup programs path=$path:$home/bin export path bind '"\e[a": history-search-backward' bind '"\e[b": history-search-forward' why unable find words 'bind'? when search '#' returns false??

javascript - [PHP]Why did the filled appended row didn't display and show? -

Image
this question has answer here: why appended row's data didn't displayed after being submitted? 2 answers this page got button add append row.once appended row filled,when submit,it connect/link page ,then filled information display @ page.but problem how display filled information of appended row on 2nd page had been done in 1st page using php.(sorry poor english , hope understand). <table width="600px" id="project"> <tr> <td>1</td> <td><textarea name="pro_1" cols="100" rows="2"></textarea></td> </tr> <tr> <td>2</td> <td><textarea name="pro_2" cols="100" rows="2"></textarea></td>

node.js - How to configure the port of the server (process.env.PORT) in cloud9? -

i use cloud9 locally , able configure port when running node server (because using socket.io on client side , it's not convenient have update path after each starts). i have seen can start server command line, guess there didn't find on node -help when connecting socket.io in browser, io.connect(location.host) . location.host automatically hostname:port current web page served, no need ever change regardless of deployment. i'm not familiar cloud9 in particular, in node web servers, explicitly specify port listen on when calling server.listen(port, optionalip) .

jpa - entityManager.persist(entity) hibernate Exception -

i'm getting following hibernate exception when trying use entitymanager.persist(entity) method. , i've made sure i've correctly formated date or time attributes in show class. javax.persistence.persistenceexception: org.hibernate.exception.sqlgrammarexception: not execute statement @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1387) @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1310) @ org.hibernate.ejb.abstractentitymanagerimpl.convert(abstractentitymanagerimpl.java:1316) @ org.hibernate.ejb.abstractentitymanagerimpl.persist(abstractentitymanagerimpl.java:881) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.springfra

python - Tkinter Toplevel width and height not working -

i have following code, when method run toplevel window displays correct title , contents, remains it's tiny default size. doing stupidly , wrong here? def new_game(self): self.top = tk.toplevel(width=300, height=200) self.top.title("new game settings") title_msg = tk.message(self.top, text="which players wish controlled ai?") msg_ai_1 = tk.message(self.top, text="player 1") msg_ai_2 = tk.message(self.top, text="player 2") title_msg.pack() msg_ai_1.pack() msg_ai_2.pack() self.confirm_button = tk.button(self.top, text="okay", command=self.top.destroy) self.confirm_button.pack() tk() , toplevel() geometry can set self.top.geometry("%dx%d%+d%+d" % (300, 200, 250, 125)) . first 2 numbers represent dimensions of window. third , fourth number say, window appear.

java - WritableRaster in android -

i have following piece of code: private static byte[] accessbytes(bitmap image) // access data bytes in image { writableraster raster = image.getraster(); databufferbyte buffer = (databufferbyte) raster.getdatabuffer(); return buffer.getdata(); } // end of accessbytes() i want convert code work in android application, there way can that? have working code in java, can make class library of code , import in android? work? yes, android supports java. can use java code in android event library. try starting @ developer.android.com .

php - joomla installing new language DateTime::__construct(): Failed to parse time string (jerror) -

Image
i fresh installation of joomla 3.1 running on home computer. environment ubuntu 12.10 apache server, php 5.4.6 installed. since installing system, no trying install more languages through language manager: as can see, 2 additional languages wanted show in list, after selecting each language, , clicking "install", led page message: datetime::__construct(): failed parse time string (jerror) @ position 0 (j): timezone not found in database with button go control panel. suprised see these languages show in list. i saw message when tried (and failed) install first component - component embed google maps in articles. anyway, haven't been able find solution problem online, wondering if out there knows problem is. appreciated! thanks! edit the problem in case turned out on directories un-writable. went "directory permissions" tab under "system information", , tried make sure directories writable. when first opened it, direct

Linux zip command - adding date elements to file name -

occasionally run backup of phpbb forum files shell command line: zip -r forum_backup ~/public_html/forum/* i'd add date elements file name, zip file created automatically formed as forum_backup_05182013.zip any other similar current date format acceptable now=$(date +"%m%d%y") zip -r forum_backup_$now ~/public_html/forum/

Xpath multiple attributes from different nodes -

what's wrong xpath line added below: /holiday[starts-with(@code,'a')/holidaytype[1]/duration[@period=(15)] i'm trying filter holiday code , number of day(period). you missing / , ] . look: /holiday[starts-with(@code,'a')/holidaytype[1]/duration[@period=(15)] ^ ^ ^-- missing here ^-- , "]" here in first case, can // or //*/ . so, try: //holiday[starts-with(@code,'a')]/holidaytype[1]/duration[@period=(15)]

javascript - should I add ns_return / ns_respond to my code? -

i new learning tcl , adp ,, ajax code not returning result tcl file though sends request thought maybe should add command response , please assist me below code : <html> <body> <form action=""> <input value="get time" type="button" onclick="showcurrenttime();" name="gettime"> <div id="result" align="center"></div> </form> <script language="javascript"> function showcurrenttime() { var xmlhttp; if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("result").innerhtml=xmlhttp.responsetext; } xmlhttp.open("get","time.tcl",true); xmlhttp.send(); } } </script> </body> please note tcl file working p

Java Generic Classes Arrays -

i reading this answer , , got confused normal array declaration , piece of code used create arrays generic classes: gen<?> gens[] = new gen<?>[10]; what exactly, , how different normal array declaration? i'm beginner might wrong, take on declaration you've written: gen generic class, template. question mark signifies wildcard. therefore, have initialized array of 10 gen templates may configured type of object.

c++ - The following prime generator code shows an error when i want prime numbers greater than 1000000.Why? -

the following prime generator code shows error when want prime numbers greater 1000000.why?? @ first seemed occur b'cuz of int changed long error still there.... technically speaking nit error program after running displays message "primegen.exe has stopped working" #include <iostream> using namespace std; int main() { long int a,c,k,d; k=0; cin>>a; cin>>d; long int b[a]; b[a-1]=0; for(long int i=2;i<=a;i++) { for(long int j=2;j<=(i/2);j++) { c=1; if ( i%j!=0 ) { continue; } else { c=0; break; } } if (c!=0) { b[k]=i; //++k; } else b[k]=0; ++k; } for(long int i=d;i<a;i++) { if (b[i]!=0) { cout<<b[i]<<"\t"; } } cin.ignore(); cin.get(); return 0; } defining static array won't in case. becaus

c - Always print EAGAIN when calling accept after epoll_wait -

i'm using epoll monitor listen fd event, after epollin event occur call accept process, eagain error. can give me suggestions? thanks! [log] print information below time info jan 01 00:02:08:924 [385] poll_loop: epoll has 1 event info jan 01 00:02:08:925 [385] poll_loop: event fd 0, event type:1 info jan 01 00:02:08:925 [385] handle_connect: fd 0, error jan 01 00:02:08:925 [385] handle_connect: accept returned error 11 resource temporarily unavailable ... retrying, listen fd:0. [code] ................ listenfd = listen_sock (port, &addrlen); socket_nonblocking(listenfd); g_epollfd = epoll_create(max_events); register_read(listenfd); ................. while (!config.quit) { int fds = epoll_wait(g_epollfd, g_events, max_events, -1); if (fds < 0) { log_message(log_crit, "epoll wait error %d %s, continue", errno, str