Posts

Showing posts from May, 2010

c - Struct Definition on Include Not Recognized -

it must way professor declared typedef s, because haven't run problem yet. i have following (piece) of header file, , accompanying code uses it: polynomial.h - #ifndef polynomial_h_ #define polynomial_h_ struct term { int coef; int exp; struct term *next; }; typedef struct term term; typedef term * polynomial; #endif polynomial.c - #include "polynomial.h" void display(polynomial p) { if (p == null) printf("there no terms in polynomial..."); while (p != null) { // print term if (p.exp > 1) printf(abs(p.coef) + "x^" + p.exp); else if (p.exp == 1) printf(abs(p.coef) + "x"); else printf(p.coef); // print sign of next term, if applies if (p.next != null) { if (p.next->coef > 0) printf(" + "); else printf(" - "); } } } but following every time try access property of struct: error: request

Does Django natively support migrations -

i've heard new web frameworks ror, django etc. follow general principle of agile , tdd. 1 part of following agile , tdd make own design go 1 iteration other. means models , schema evolve different versions of app. know ror supports schema migrations natively, i'm not sure django. major concern how can decide upfront schema related issues. isn't going waterfall kind of design philosophy. i know there external packages 'south' schema migrations. question inquiring why django doesn't support migrations natively ror django 1.7 first version providing schema migrations in core source. check dev. version of docs regarding topic. andrew godwin, creator of south, did work, backed kickstarter project .

go - How can I clear the console with golang in windows? -

i've tried lot of ways, like package main import ( "os" "os/exec" ) func main() { c := exec.command("cls") c.stdout = os.stdout c.run() } and c.system(c.cstring("cls")) and escape sequence doesn't work either all need : package main import ( "os" "os/exec" ) func main() { cmd := exec.command("cmd", "/c", "cls") cmd.stdout = os.stdout cmd.run() }

python - More Efficient Way of Reading Large List of dicts -

for project use mutagen library read id3 tags 5000+ mp3 files. after reading them construct following objects using them. class track: def __init__(self, artist, title, album=none): self.artist = artist self.title = title self.album = none def __str__(self): return "track: %s : %s" % (self.artist,self.title, ) def set_album(self,album): self.album = album class album: def __init__(self, artist, title, year='', genre='', tracks=none): self.artist = artist self.year = year self.genre = genre self.title = title self.tracks = [] def __str__(self): return "album: %s : %s [%d]" % (self.artist,self.title,len(self.tracks)) def add_track(self,track): self.tracks.append(track) the problem files missing required tags(title missing,artist missing, or both), causing keyvalueerror #'talb' (album title), 'tit2'

How come most people are on Android 4.1 and not 4.2 or 4.3? -

i seeing errors on android 4.3 numbers highest version, see of installs on 4.1, 4.0.3-4.0.4, 4.2 3rd installs. so wrong 4.3 (jellybean)? have crashes happen on it, not other versions. jellybean buggy android verison? or wrong it? unless you're power user installs own roms, @ whim of manufacturer os updates. in many cases have not been prompt update (or want update @ all). this chart gives layout of versions people using in general on android: http://developer.android.com/about/dashboards/index.html

php - how a website user interacts with a database? -

Image
i'm new this, , can't seem find right search on google answer i'm looking for. have front end user use create new transaction. there drop down menu tied "categories" table has 1:m relationship "transaction" (see image). question is, if user submits form save new transaction, don't know id categories table, they'll doing selecting 1 drop down that's pulling categories table. know how @ point take input drop down , store field in transaction table. i'm trying understand how use relationships, in limited understanding of how keys work, seems unless knew id number was, relationship no good. if you're doing taking submission drop down , storing in transaction table, you've still got category name stored in 2 different tables, what's point? i'm missing step in here somewhere , i'm hoping can make sense out of this. the user wouldn't know category id. (though if wanted to. it's in markup.) more

javascript - Values from Servlet Shows Through direct link Browser But not through code -

i using jquery mobile. when use link in browser : http:// * *192/mlite/transferin2?imei=0000&username=usman&password=shafi, code shows accurate result servlet when pass values ajax , not alert(data), 1 thing make sure servlet recieving request , following ajax not showing values ajax. ...connection successful ginesh bro question is.. when put servlet in same localhost works..but when run other pc stops working in ajax,..but works through direct url please me.. $.ajax({ url : "http://19****/mlite/transferin2", type : "post", datatype : "json", data : { "username": amt, "password":imei2 }, success : function(data) { alert(data); }, error : function(xhr, ajaxoptions, thrownerror) { alert(xhr); //setmessage("#transferout-msg", "connection server failed"); //

php - Undefined variable of print_r -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers i got code in php: purpose of $errors display error when execute them in php. sadly says $errors not defined variable.. how come? me please? if (empty($username) === true || empty($password) === true) { $errors[] = 'you need enter username , password'; } else { //here } print_r ($errors); } and got error.. notice: undefined variable: error in c:\xampp\htdocs\shaven\login.php on line 28 may know how solved this? if $username and $password isn't empty, code inside if block won't executed , $errors won't defined. in case, you'll trying print_r() undefined variable. initialize $errors empty array before doing comparison: $errors = array(); and before doing print_r() , make s

php - how to get image path of highest vote -

my table schema follows: id || image1 || image2 || image1vote || image2vote || uid 1 abc.jpb adc.jpg 50 40 12 2 bc.jpb dc.jpg 20 70 13 3 kjc.jpb ydc.jpg 20 10 10 4 pjc.jpb mkc.jpg 80 60 10 i using mysql phpmyadmin back-end. from front-end uploading 2 images storing in database. both images saving votes separately. votes image1 stored in column image1vote , while votes image2 stored in column image2vote . my problem following: want image path of image has votes. so, if image1 has more votes image2, want value of image1 , other way around. for example: in first row, want value of image1 since value in image1vote bigger value in image2vote . in second row, want value of image2 . i haven't tested it, if understood question correctly, should this: select if(image1vote >= image2vote, image1, image2

javascript - Accessing element attributes of "Object #<HTMLDivElement>" -

i can't figure out - i'm trying retrieve attribute of active slide in royalslider. managed active slide's html content in htmldivelement object. in chrome's console shows tree view of html element want , children. want access either id of element or own custom attribute, error keep getting is: uncaught typeerror: object #<htmldivelement> has no method 'attr' this line outputs it: console.log(jquery('.royalslider').data('royalslider').currslide.content.first()[0].attr("id")); i know need use jquery('.royalslider').data('royalslider').currslide.content don't know rest. how can access custom attribute slideid ? in statement: console.log(jquery('.royalslider').data('royalslider').currslide.content.first()[0].attr("id")); the [0] gives access html dom object (using jquery get() method), not jquery version of it. rid of [0] , should able call attr . so follow

.htaccess - Why is RewriteCond needed for this rule to work? -

if have re-write rule: rewriterule ([^?]*) /script.php?path=$1 [l,qsa] it return 500 internal error unless have condition: rewritecond %{request_filename} !-f why this? under impression conditions didn't change how rule works rather exceptions rule. the -f tests if given argument file , if exists (it 0 bytes in size). reason why 500 internal server error because rewrite engine loops through rules until uri stops changing. example, if had this: rewriterule ([^?]*) /script.php?path=$1 [l,qsa] and request comes in /foobar uri "foobar" "foobar" matches ([^?]*) , uri gets rewritten "/script.php?path=foobar" rewrite engine loops "script.php" matches ([^?]*) , uri gets rewritten "/script.php?path=script" rewrite engine loops etc. now if add condition: rewritecond %{request_filename} !-f rewriterule ([^?]*) /script.php?path=$1 [l,qsa] and request comes in /foobar uri "foobar" "foob

go - Golang smtp.SendMail blocking -

i tried use smtp.sendmail() in go program. blocks , doesn't return until times out. prevents me finding out wrong. my code: to := []string{"recepient@example.com"} err := smtp.sendmail("smtp.web.de:25", smtp.crammd5auth("example@web.de", "password"), "example@web.de", to, []byte("hi")) if err != nil { fmt.println(err) }else{ fmt.println("success") } after long time following error: dial tcp 213.165.67.124:25: connection timed out any ideas might real problem? if seeing timeout can try using net.dial directly verify connectivity : conn, err := net.dial("tcp", "smtp.web.de:25") if err != nil { fmt.println(err) } if not connecting there local blocking socket. ask local network guys firewall setup or if there network proxy type devices intercepting outgoing traffic.

linux - How can I quickly see into complex structures during debugging with g++ and c++ -

this question has answer here: inspecting standard container (std::map) contents gdb 6 answers modern c++ has lot of templated , wrapped elements become hassle during debugging because gdb generic debugger, without specific c++ features. there's no way list elements in stl container. when using boost::shared_ptr shared pointer there's no way de-reference referent see what's going on. is there set of gdb macros, or more advanced version of gdb can make stuff easier see? there's no way list elements in stl container. yes there is, if you're using gdb 7 , recent gcc last 4 years or should have python pretty printers available show contents of containers, smart pointers , other standard library types. see answer @ https://stackoverflow.com/a/15329434/981959 you can write own python printers non-standard types, such boost::shared_

java - how to pass htmlunit page as a modelandview (Spring) -

i wanted make proxy site. when user request url. on server side wanted request url , make object containing page details (html source, request response etc.) i found htmlunit can fit requirements. wanted pass response htmlunit's object users browser. (as modelandview (spring) if possible. ) how can achieved? @test public void getelements() throws exception { final webclient webclient = new webclient(); final htmlpage page = webclient.getpage("http://some_url"); //i wanted pass "htmlpage" user's browser. } that's not how spring works. modelandview object holder view name , model . view name used in conjunction viewresolver render response. model serves hold attributes might needed during rendering process. if want return content of separate http request/response, you'll need execute http request, response body , stream http response. follow these steps http request application your handler method invoked you use http

ios - How to test if keyboard is covering UITextField in UITableView? -

how can check if keyboard covering first responder inside uiscrollview may or may not uitableview ? note uiscrollview not cover entire viewcontroller's view , may contained in modal view ( uimodalpresentationformsheet ). i'm using modified code apple's reference documentation , example , cgrectcontainspoint return false when keyboard covering first responder. it's obvious i'm not using convertrect:toview correctly. also, apple's code not take account view not full-screen, setting scrollview's contentinset full height of keyboard isn't great solution -- should inset portion of keyboard covering firstresponder. - (void)keyboardwasshown:(nsnotification*)anotification { // self.scrollview can tableview or not. need handle both uiview *firstresponderview = [self.scrollview findfirstresponder]; if (!firstresponderview) return; nsdictionary* info = [anotification userinfo]; cgrect rect = [[info objectforkey:uikeyboard

java - Android quiz app crashing -

i developing simple quiz app , i'm having problem think codes. crashes when click submit button if text fields left blank. here's code. public class quiz extends activity { button submit; edittext e1,e2,e3,e4,e5; int ctr; string msg = "", msg1 = ""; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_quiz); submit=(button)findviewbyid(r.id.button1); e1=(edittext)findviewbyid(r.id.edittext1); e2=(edittext)findviewbyid(r.id.edittext2); e3=(edittext)findviewbyid(r.id.edittext3); e4=(edittext)findviewbyid(r.id.edittext4); e5=(edittext)findviewbyid(r.id.edittext5); submit.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0){ string ans1 = string.valueof(e1.gettext()); int ans11 = integer.parseint(ans1); string ans2 = string.valueof(e2.gettext()

vb.net - Getting an error when I check a check box -

i have pretty basic program assignment (i'm beginner it's still tricky me) requires enter decimal value, , have check box calculation , show result in different labels. i'm getting errors when checkthe check box no values added. private sub chkgst_checkedchanged(sender object, e eventargs) handles chkgst.checkedchanged 'get txtdollaramt*const dgst (0.07d) display lblgstoutput. txtdollaramt+dgst, display lbltotaloutput dim damt string damt = decimal.parse(txtdollaramt.text) if chkgst.checked = true lblgstoutput.text = damt * dgst end if end sub dim damt decimal if decimal.tryparse(txtdollaramt.text, damt) if chkgst.checked = true lblgstoutput.text = damt * dgst end if end if

javascript - Auto-Generate Color in Flot not working -

when add new series chart dynamically same initial colour applied, should generate new color per documentation doesnt, bug or doing wrong? i using flot 0.8.2. update : saw this, might related: flot 0.8.2 line chart - color bug var serie1 ={label:"test",data:[[12,123],[15,125]]}; var serie2 ={label:"jonas",data:[[12,125],[15,123]]}; var flot = $.plot($("#container"),[serie1]); var alldata = flot.getdata(); alldata.push(serie2); flot.setdata(alldata); flot.setupgrid(); flot.draw(); fiddle: http://jsfiddle.net/luisvsilva/knj8c/1/ yeah, that's little bit of bug if use flot in way. when use setdata() add second series, flot won't add new color because starts again beginning of automated color array used first series. (i add more details bug ticket opened.) if use flot = $.plot($("#container"), [serie1, serie2]); instead normal behavior want. alternatively can specify colors in data like var serie1 = { label: "

Why do asynchronous channels in Java's NIO.2 require these pauses? -

i've written minimal example, it's still long, let me know should post link pastebin instead. server: import java.io.ioexception; import java.net.inetsocketaddress; import java.net.standardsocketoptions; import java.nio.bytebuffer; import java.nio.channels.asynchronousserversocketchannel; import java.nio.channels.asynchronoussocketchannel; import java.nio.channels.completionhandler; public class srv { static final int port = 9001; static final string host = "127.0.0.1"; public static void runinstance() { try (asynchronousserversocketchannel asynchronousserversocketchannel = asynchronousserversocketchannel.open()) { if (asynchronousserversocketchannel.isopen()) { asynchronousserversocketchannel.setoption(standardsocketoptions.so_rcvbuf, 1024); asynchronousserversocketchannel.setoption(standardsocketoptions.so_reuseaddr, true); asynchronousserversocketchannel

django - Get all ManyToManyField-Entries of an object in models.py -

i want have tag list in admin panel of simple blog app. manytomanyfields aren't allowed input list_display want create method getting tags , put method in list. my problem don't know how can access in model other class. my models.py class tag(models.model): tag = models.charfield(max_length=25) def __unicode__(self): return self.tag class post(models.model): author = models.foreignkey(user) publication = models.datetimefield() title = models.charfield(max_length=100) summary = models.textfield(max_length=150) content = models.textfield(max_length=9999) tag = models.manytomanyfield(tag) commentsallowed = models.booleanfield() def gettags(self): return post.tag.all() <----------------------------------- def __unicode__(self): return self.title my admin.py class postadmin(admin.modeladmin): date_hierarchy = 'publication' list_display = ('author', 'title'

java - save radio button selection int string -

sry bad title don't know how looking for. my idea: want develop app 10 questions à 3 answers. should this: question 1st answer (radio button) 2nd answer (radio button) 3rd answer (radio button) next question (button) one of these answers gives 0 points, 1 5 points , 1 10 points. can reach miminum of 0 points , maximum of 100 points. question: can save points string/int , later total? can create last activity with: you reached x/y/z points text x/text y/text z and specific text that. let me 0-50 points: text z "try luck again" 50-80 point: text y "not bad" 80+ points: text z "you awesome!" i tryed search solution don't know search for. started developing 3 month ago. awesome if can me example codes in java because i'm in proceed of learning. thanks lot! create public fields in each activity , count in oncreate method

compiler construction - C# Console Error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement -

i new programming , attempting learn c#. having think simple problem console application(the code below). error appears if statement reads follows: //evaluate subtotals results if (subtotalone == subtotaltwo) { console.writeline("="); } else if (subtotalone < subtotaltwo) { console.writeline("<"); } else (subtotalone > subtotaltwo); { console.writeline(">"); } the error is: assignment, call, increment, decrement, , new object expressions can used statement. any appreciated. have read through forums here , seen may similar questions understanding isn't enough yet map solutions i've seen problem. full application code: using system; namespace itc110_a02_grocerycomparison { class program { static void main(string[] args) { console.writeline("compare grocery stores &

javascript - Can I get the current URL without an address bar? -

i use code below current url, , hash id has after forward slash domain. current url of page loaded in iframe means there's no address bar of course. how go doing this? the code i'm using now: var currenturl = (document.url); var part = currenturl.split("slash")[1]; alert(part); // alerts "xdas2" !!! for security reasons, can url long contents of iframe, , referencing javascript, served same domain. long true, work: document.getelementbyid("iframe_id").contentwindow.location.href if 2 domains mismatched, you'll run cross site reference scripting security restrictions.

ruby on rails - How to have a route accessed only from code and not from URL -

i see when name route in config file, like: match 'controller/posts' => 'controller#posts', :as => 'posts' it creates named route controller action. but route needs accessed code. when click on posts button view, should execute user. but when executes www.xyz.com/posts, should not try execute this. possible ? i'm not sure why go way. sounds want able call specific bit of code controller. route won't work reasons mentioned (it available on browser). instead, should extract bit of code , put in it's own library. lib/foobar.rb: module foobar def my_method # add code here end end then can call whereever want in code.

c# - Why is Dictionary.ToLookup() not working? -

i have dictionary<ttype, list<tdata>> represents kind of internal data container. tdata elements grouped ttype. a user may query dictionary , should given ilookup<ttype, tdata> result. simplest query return whole data container: public ilookup<ttype, tdata> queryeverything () { return _data.tolookup(kvp => kvp.key, kvp => kvp.value); } however, not work. why? isn't lookup nothing more dictionary of key => ienumerable<value> ? you try this: public ilookup<ttype, tdata> queryeverything () { return _data.selectmany(kvp => p.value.select(x => new { kvp.key, value = x })) .tolookup(kvp => kvp.key, kvp => kvp.value); } of course, instead of anonymous type, create keyvaluepair<ttype, tdata> or tuple<ttype, tdata> easily. or perhaps better solution (if can manage refactor code) change private _data dictionary ilookup<ttype, tdata> , there no need convert dictiona

Paypal SDK and IPN callback not working -

i'm developing affiliate script paypal adaptive payments sdk. have following code: $payrequest = new payrequest(new requestenvelope("en_us"), 'pay',$arrpaypal ['paypal_return'] , 'usd', $receiverlist, $arrpaypal['paypal_return']); $payrequest->ipnnotificationurl = $arrpaypal['paypal_callback']; $payrequest->memo = 'payment ' . $arruserinfo['plan_title']; $payrequest->trackingid = $intid; however not firing callback script. url http:// ipaddress /script.php. if set in paypal sandbox hit it's not adaptive payments response detailed in sdk. please explain how enable it? you may have gotten case of ipn setter wrong. try ipnnotificationurl instead of ipnnotificationurl

java - Hibernate vs EclipseLink -

i'm starting new web project , i've chosen jpa persistence orm engine. although i've used openjpa in last project, want use eclipselink. why? jpa reference implementation, has lot of documentation , support in eclipse ide. also, can't found benchmark declares none of them best, performance not factor (all implementations has own strength points). but, want use jsr-303 validation spec, , i've chosen hibernate-validator (witch reference implementation of bean validation spec). moreover, i'm using spring, , there lot of examples spring+hibernate, haven't found opinion said spring better hibernate. is there problem mixing 2 implementations? better use hibernate jpa hibernate bean validation? i have been using eclipselink implementation of jpa spring , hibernate-validation-4.2.0.final . , no problem far. answer question: is there problem mixing 2 implementations? i don't think there problem using eclipselink jpa implementation

vb.net - Arrow keys don't seem to work? -

i trying make maze game code can't seem work. want picture box (the player) move in direction of arrow keys. have tried code: private sub blevel1_keydown(byval sender object, byval e system.windows.forms.keyeventargs) handles me.keydown if e.keycode = 37 pictureboxplayer.left = pictureboxplayer.left - 10 elseif e.keycode = 38 pictureboxplayer.top = pictureboxplayer.top - 10 elseif e.keycode = 39 pictureboxplayer.left = pictureboxplayer.left + 10 elseif e.keycode = 40 pictureboxplayer.top = pictureboxplayer.top + 10 end if end sub i have tried location codes arrow keys don't seem move picture box. issue running into. ideas on how can resolve this? the cursor keys special, used navigate focus 1 control another. intercepted before control has focus. furthermore, wrote keydown event form, won't have focus when form has other controls won't keydown event. unclear whether applies here. the best way go i

arduino - Cannot upload data get xivelyclient.put returned -1 -

background: trying upload data simple on off sensor learn xively methods. using arduino uno wifi shield. made simple alterations example sketch xively library keep simple. have read documentation , faq's plus searched web. there similar question (can't connect xively using arduino + wifi shield, "ret = -1 no sockets available) , answer reduce number of libraries loaded. i'm using same library list recommended in post.i have updated arduino ide , downloaded latest xively , http library. code compiles without error. re-loaded device on xively website , got new api key , number well. plus, ensured channel added correct sensor name. have checked router , ensured wifi shield connecting properly. problem: can't see data on xively website , keep getting following error messages on serial monitor arduino: xivelyclint.put returned -1 also, after several tries, "no socket available" question: there problem code or else? current arduino code (actual ss

I get python errors with installing pre-requisites onto a node.js project -

Image
i installing packages needed in node.js project downloaded , getting ton of errors have no idea how resolve them. seems involved getting python run. have both 2.7 , 3.3 on computer. here images of errors the issue python 2.7 either not on path or else after python 3.3. can solve problem either: passing path python 2.7 using --python flag (as states in error) or by adding path python 2.7 (c:\python27, likely) path (or moving before c:\python33 in list).

java - Unable to connect RMI client to host, unmarshalexception caused by eofexception -

i have following files open in netbeans. server: package server; import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; import java.sql.*; public class server implements serverinterface { private connection con; private statement st; public server(string db, string username, string password) { try { con = drivermanager.getconnection(db, username, password); st = con.createstatement(); } catch(exception e) { system.out.println(e); } } public static void main(string[] args) { try { server server = new server("jdbc:mysql://localhost:3306/db", "root", "password"); system.setsecuritymanager(new rmisecuritymanager()); serverinterface stub = (serverinterface) unicastremoteobject.exportobject(server, 0); registry registry = locateregistry.createregistry(1099); registry.rebind("server

JavaScript not executing in my HTML -

so i've begun learning html/css/javascript , came across issue while trying make exceedingly simple version of rock-paper-scissors. believe code works fine, can't check because it refuses execute. have looked extensively answers on internet, can't seem find any. i have little experience in javascript , learning off of codecademy think resource may outdated other websites appear have conflicting syntax. in short, what doing wrong, , website has right? <html> <head> <title>r,p,s!</title> <script type="text/javascript"> function whole(){ function game(play){ if (play="yes"){ var userchoice = prompt("do choose rock, paper or scissors?"); var computerchoice = math.random(); if (computerchoice < 0.34) { computerchoice = "rock";} else if(computerchoice &l

iphone - Trouble and needed clarification for Itunes Connect -

i adding game center application , feel lost. first of all,, app nmot game, want people see thier friends "score". have classify app game? working on adding app itunes connect dont quite it. when add , select distribution date, have distribute it? happens when day reached? need use gamecenter in beta version? how app know connected itunes connect? sorrty if these stupid questiopns, dont quite understand. if app uses game center, typical thing classified game. don't know how, , who, review app, pass review process, though. let's see 2 things: - if need show leaderboard, app not game, create own leaderboard, or use third party leaderboard (eg google's). - different questions pose in end of multiple "question". suggest each 1 of in internet. shortly, date of public release depends on app submission , approval. if date public release 1/1/2011 , send app apple, when approved automatically published. shouldn't send beta versions apple. game

css - Sass Placeholders with @font-face -

sass placeholders hoisted top of compiled stylesheets. i'd harness force @font-face declarations top of stylesheets (before other compiled placeholders). but when try this: %font-face { font-family: 'fontname'; src:url('fonts/fontname.eot'); // other font files } @font-face { @extend %font-face; } sass gives me error: extend directives may used within rules. does know way make sass placeholders work @font-face or workaround have same result? you should use mixin handle font-face import. isn't going work placeholder. @include font-face;

python - Split string confusion -

i need split string: example: str = 'mink.microctr.fit.edu - - [21/jun/2000:20:21:36 -0400] "get / http/1.1" 200 1786' from above string need extract "21/jun/2000" . using: str.rstrip().split()[3] the output "[21/jun/2000" . any on how go this? str.split()[3][1:].split(':')[0]

java - Unique Characters -

i working on project class. have find number of unique hashtags in tweet input java. relatively new coding, stuck how find out unique hashtags. far, have scanner. package edu.bsu.cs121.jmgibson; import java.util.arraylist; import java.util.list; import java.util.scanner; public class hashtag { public static void main(string args[]) { arraylist<string> hashtag = new arraylist<string>(); scanner tweet = new scanner(system.in); while (true) { system.out.println("please enter name: "); hashtag.add(tweet.next()); } } } here link usage of scanner: http://docs.oracle.com/javase/7/docs/api/java/util/scanner.html you firstly want identify how create needed delimiter. there example in link, looking substring begins # , ends whitespace. since homework assignment exact answer cannot given - however, custom delimiter need be.

css - Attaching a Sass/SCSS to HTML docs -

hello new web design , have many questions it. want learn how attach sass or scss file html file in head tag : <link href="example" rel="stylesheet/sass" type="text/css"> <link href="example" rel="stylesheet/scss" type="text/css"> i tried did not see result. guess it's less framework. , question: if want use sass or scss should compile hosting or not? you can not "attach" sass/scss file html document. sass/scss css preprocessor runs on server , compiles css code browser understands. there client-side alternatives sass can compiled in browser using javascript such less css , though advise compile css production use. it's simple adding 2 lines of code html file. <link rel="stylesheet/less" type="text/css" href="styles.less" /> <script src="less.js" type="text/javascript"></script>

objective c - Periodically call to a web service in ios -

i have nstimer this: [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(sliderupdate:) userinfo:nil repeats:yes]; -(void)sliderupdate:(id)sender { int currenttime = (int)((newplayer.currenttime.value)/newplayer.currenttime.timescale); slider.value=currenttime; nslog(@"%i",currenttime); song.currenttime=currenttime; int currentpoint=(int)((newplayer.currenttime.value)/newplayer.currenttime.timescale); int pointmins=(int)(currentpoint/60); int pointsec=(int)(currentpoint%60); nsstring *strminlabel=[nsstring stringwithformat:@"%02d:%02d",pointmins,pointsec]; lblslidermin.text=strminlabel; song.strslidermin=strminlabel; } what want do, is, in each , every 45 seconds, call web service: example: 1st call in 45 seconds, second in 90 seconds, etc. how can in nstimer? you have modify nstimer 45 seconds: [nstimer scheduledtimerwithtimeinterval:45 target:self selector:@selector(sliderupdat

ios - In Objective C, how to make a button with the location arrow? -

Image
i want add bar button item navigation bar. button used show users current location on map. how make button looks this? simple...get image looks arrow. add bar button navigation bar , add image bar button. you can download image at: http://www.glyphish.com

mobile - View Switcher for ServiceStack? -

in mvc, there's viewswitcher, , can add _layout, _layout.mobile; myview , optional myview.mobile what's best way accomplish in servicestack razor view? thanks servicestack doesn't implicitly switch layouts @ runtime, instead preferred layout needs explicitly set. servicestack's razorrockstars demo website explains how dynamically switch views, i.e: change views , layout templates @ runtime the above convention overrideable can change both view , layout template used @ runtime returning response inside decorated httpresult: return new httpresult(dto) { view = {viewname}, template = {layoutname}, }; this useful whenever want display same page in specialized mobile , print preview website templates. can let client change view , template gets used attributing service clientcanswaptemplates request filter attribute: [clientcanswaptemplates] public class rockstarsservice : restservicebase { ... } which simple implementation shows can can

php - How to change the keys/first row in this CSV library import Codeigniter -

class csvreader { var $fields; /** columns names retrieved after parsing */ var $separator = ';'; /** separator used explode each line */ var $enclosure = '"'; /** enclosure used decorate each field */ var $max_row_size = 4096; /** maximum row size used decoding */ function parse_file($p_filepath) { $file = fopen($p_filepath, 'r'); $this->fields = fgetcsv($file, $this->max_row_size, $this->separator, $this->enclosure); $keys_values = explode(',',$this->fields[0]); $content = array(); $keys = $this->escape_string($keys_values); $i = 1; while( ($row = fgetcsv($file, $this->max_row_size, $this->separator, $this->enclosure)) != false ) { if( $row != null ) { // skip empty lines $values = explode(',',$row[0]); if(count($keys) == count($values)){

php - how to pass array value to excel -

i have array array(4) { [0]=> string(2) "12" [1]=> string(2) "17" [2]=> string(2) "1.0" [3]=> string(2) "1.7" } array(4) { [0]=> string(1) "3" [1]=> string(1) "1" [2]=> string(2) "4.1" [3]=> string(2) "4.6" } i need pass value excel(start column c) code foreach ($rate $row) { $i = 0; $j = 2; foreach ($row $item) { $myxls->write_string($i, $j++, $row); } $i++; } but why can wrote second array(3,1,4.1,4.6) in first line. first row missing. wrong in foreach ? stating column c $this->load->library('phpexcel/phpexcel'); $objphpexcel = new phpexcel; $objphpexcel->getdefaultstyle()->getfont()->setname('arial'); $objphpexcel->getdefaultstyle()->getfont()->setsize(11); $objwriter = phpexcel_iofactory::createwriter($objphpexc

bash - How do I remove a character from a string in a Unix shell script? -

i have several files named this: file - name.txt how remove " - " using bash script in unix files? use parameter expansion remove part of string want rid of. make sure use double-quotes prevent mv misinterpreting input. for in ./*' - '*; mv "$i" "${i// - }" done

ios - Disabling Custom Appearance For MFMessageComposeViewController -

when user inputs name recipients portion of mfmessagecomposeviewcontroller, recipients bar, turns black , vanishes. user can still send message, input text , other stuff, can't see recipients bar. i have feeling may (or may not) because navigation bar of mfmessagecomposeviewcontroller customized (background image , custom font). 1. navigation bar's custom appearance set entire app, how disable mfmessagecomposeviewcontroller? 2. there other reason glitch? ios7 bug? so yes, problem here because using uiappearance proxy uinavigationbars . so solved problem? rather trying change mfmessagecomposeviewcontroller, more of app on own, customized own app. rather using [uinavigationbar appearance] , used [uinavigationbar appearancewhencontainedin:[somenavigationcontroller class], nil] i think simple if can this, because trying customize mfmessagecomposeviewcontroller can pretty annoying. everything above applies mfmailcomposeviewcontroller.

perl - Can't Parsing Log Linux File Today -

i'd monitor linux logs , pull information logs process files activities of workers do, in company. #!/bin/bash #if [[ -z "$1" ]]; # echo "error: usage: autoparsemd5enczip [device_id]" #else yearcalc=`perl -e 'use date::calc qw(today add_delta_days); ($y)=add_delta_days(today(), -1); print "$y"'` monthcalc=`perl -e 'use date::calc qw(today add_delta_days); ($y,$m)=add_delta_days(today(), -1); if ($m<=9) {$m = "0".$m;} print "$m"'` prefixcalc=`perl -e 'use date::calc qw(today add_delta_days); ($y, $m, $d)=add_delta_days(today(), -1); if ($m<=9) {$m = "0".$m;} if ($d<=9) {$d = "0".$d;} print "$y$m$d"'` secaudit=`perl -e 'use date::calc qw(today add_delta_days); ($y, $m, $d)=add_delta_days(today(), -1); if ($m<=9) {$m = "0".$m;} if ($d<=9) {$d = "0".$d;} print "$d-$m-$y"'` paths

php - Insert query for new information -

what im trying here is, @ spouse field can update data, , working. @ child field, im trying insert/add new child store in database. insert query not working. html spouse <td colspan="2" class="title_all_u">family member 1 (spouse)</td> </tr> <tr> <td class="pk">family type</td> <td width="50%" class="pk_2"><input name="spouse_type" type="text" class="textfield_word" id="spouse_type" value="<?php echo $spouse_type ?>" /></td> </tr> <tr> <td class="pk">name</td> <td width="50%" class="pk_2"><input name="spouse_name" type="text" class="textfield_word" id="spouse_name" value="<?php echo $spouse_name ?>" /></td> </tr> <tr> <td clas