Posts

Showing posts from June, 2015

how to format 2013-05-15T10:00:00-07:00 to Date android -

i trying format date string date, , month/day it: string strdate="2013-05-15t10:00:00-07:00"; simpledateformat dateformat = new simpledateformat( "yyyy-mm-dd hh:mm:ss-z"); date converteddate = new date(); try { converteddate = dateformat.parse(strdate); } catch (parseexception e) { e.printstacktrace(); } simpledateformat sdfmonth = new simpledateformat("mm/dd"); string monthday= sdfmonth.format(converteddate); but returns me current month/day i.e 5/18. whats wrong? 3 things : there mistake in format : 2013-05-15t10:00:00-07:00 has no meaning, should 2013-05-15t10:00:00-0700 (with no colon @ end, timezone defined in rfc 822. (look @ docs z). change format yyyy-mm-dd't'hh:mm:ssz mentionned @blackbelt you bad date because re-format date whatever happens during parsing. re-format in try block, if , if parsing worked. ----------update string strdate = "2013-05-1

groovy - Testing action with spock in Grails -

i have action test when content-type application/json my action looks this: def save () { request.withformat { json { def colorinstance = new color(params.colors) render "${colorinstance.name}" } html { //do html stuff } } i've got following doesn't seem work: def "js test" () { when: controller.save() request.contenttype = "application/json" request.content = '{"colors": {"name": "red"} }' then: response.contentasstring == "red" } i believe problem in way i'm sending json controller in test. correct way? error is: response.contentasstring == "red" | | | | null false if modify controller be: json { def colorinstance = new color(params.colors) render "${params.colors}" } then error same: response.contentasstring == &q

php - Passing property to next method -

i have following code within class class mail { function addattachment($path, $name = '', $filetype = 'application/octet-stream') { if (!@is_file($path)){ echo'<pre>filepath not found.</pre>'; } if (empty($name)) { echo 'no filename'; } //store attachment in array if(!isset($attachments)) { $attachments = array(); } $attachments[] = array('path' => $path,'name' => $name,'type' => $filetype); //echo '<pre>';print_r($attachment); return $attachments; } function setmail() { foreach ($this->$attachments $attachment) { echo '<pre>';print_r($attachment); } } } $mail = new mail; $mail->addattachment('../images/logo.png','filename'); $mail->addattachment('../images/logo.png','filensame

stored procedures - Incorrect date value: '0000-00-00' for column 'req_dt' at row in mysql -

i working on mysql stored procedure executes call statement following parametrs call getabsentreportdata('2011-11-01','2011-11-30',3); it shows error statement call getabsentreportdata('2013-04-01','2013-05-01',1) ; error is error code: 1292. incorrect date value: '0000-00-00' column 'req_dt' @ row 1 0.374 sec please me how resolve it. in advance you server use no_zero_date mode. table emp_leaves has req_dt field. records of table has 0000-00-00 in field. query tells me about create temporary table templvdata select * emp_leaves leave_txn_code = 'abs' , from_dt >= fromdate , to_dt <= todate order to_dt desc so can disable mode. read documentation mysql modes . or change select query.

ide - Anyone with luck on getting KDevelop work under OSX 10.8.3 -

i got kdevelop install through macports no issues, unstable , crashes straightaway. tried getting through fink, fink not able find package anymore? so pretty stuck no solution. maybe alternative ide suggestions? do not want textmate, have sublime2 running, not happy eclipse , xcode. see people working vert efficiently gvim, lots of custom plugins. know steep learning curve mat try it. maybe suggestion way gvim smooth , functional under osx? (python, c++, bash, etc) thanks.

Rails accesskeys for left and right arrows? -

does rails support left , right arrow keys in :accesskey attribute? = link_to "< previous", @vehicle.previous, :accesskey => "left arrow" = link_to "next >", @vehicle.next, :accesskey => "right arrow" it's not rails responsibility. need js plugin binds key presses links. if want add attributes generated <a> tag, use :html_options key = link_to "< previous", @vehicle.previous, :html_options => {:accesskey => "left arrow"}

What are the limitations of buffer size of textBufferSetView in haskell using gtk? -

what buffer size? can set buffer take in vc "cons" [vc "z" [],vc "cons" [vc "s" [vc "z" []],vc "cons" [vc "s" [vc "s" [vc "z" []]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "z" []]]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "s" [vc "z" []]]]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "z" []]]]]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "z" []]]]]]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "s" [vc "z" []]]]]]]],vc "cons" [vc "s" [vc "s" [vc "s" [vc "s&

database - Which postgres data type should I use for large XML message come from network? -

i have incoming xml potentially big 5m , need store it postgres 9.1. data type should use ? bytea character varying text or else ? btw xml contains binary data in base64 format, make difference when choosing data type in postgres ? thank you have 2 options: varchar or text . allow store , retrieve xml file db. nothing more. xml . allow store, retrieve, validate, edit, search ... xml files, may (or may not) involve overhead on storing files db. there no reason store xml files bytea @ all. 5 mb size nothing special postgres. in last project worked strings 0.5 gb length in postgres.

html - Change color of bootstrap navbar on hover link? -

i want know how change color of links when hover on them in nav bar, ugly color. thanks suggestions? html: <div class="container"> <div class="navbar"> <div class="navbar-inner"> <ul class="nav"> <li class="active"><a href="#">home</a></li> <li><a href="#">link one</a></li> <li><a href="#">link two</a></li> <li><a href="#">link three</a></li> </ul> </div> </div> </div> for bootstrap 3 how did based on default navbar structure: .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { background-color: #ffff00; color: #ffc0cb; }

css - Dynamically align on center divs inside another div with dynamically changing height -

i cant find solution problem, asking help... have 1 div changing height depending on browser window height. inside of div 5 divs 4 per line, when resize window size smaller size divs fall down on line 2, 3, etc. that´s good, these divs arent in middle of main div resized , looking for... thank you html: <div id="main"> <!--div1--> <div class="mosaic-block fade"> </div> <!--div2--> <div class="mosaic-block fade"> </div> <!--div3--> <div class="mosaic-block fade"> </div> <!--div4--> <div class="mosaic-block fade"> </div> <!--div5--> <div class="mosaic-block fade"> </div> </div> <!--main--> css: div#main { border: #cccccc thin solid; max width: 840px; height:600px; min-width: 210px; border: #cccccc thin solid; margin:0 auto; max-width: 840px; } .mosaic-block { margin-bottom:50px; position: relative; float

python - Dynamically change scrapy Request scheduler priority -

i'm using scrapy perform test on internal web app. once tests done, use crawlspider check everywhere, , run each response html validator , 404 media files. it work except this: crawl @ end, get things in random order... so, url perform delete operation being executed before other operations. i schedule delete @ end. tried many way, such kind of scheduler: from scrapy import log class deletedelayer(object): def enqueue_request(self, spider, request): if request.url.find('delete') != -1: log.msg("delay %s" % request.url, log.debug) request.priority = 50 but not work... see delete being "delay" in log executed during execution. i thought of using middleware can pile in memory delete url , when spider_idle signal called put them in, i'm not sure on how this. what best way acheive this? default priority request 0, set priority 50 not work you can use middleware collect (insert requests own

ios - UIImagepicker works for camera but not for photo album -

i have following code let user take photo or select album. while taking picture camera works perfect, when choose button triggers action choose album album comes cant select photo. warning in console when launching choose album method not when launch take camera method. below relvant code , warning. .h @interface sitespectakephoto : uiviewcontroller <uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate> @property (strong, nonatomic) nsstring *pbvlocname; @property (strong, nonatomic) iboutlet uitextfield *desctextfield; @property (strong, nonatomic) iboutlet uiimageview *imagefield; @property (strong, nonatomic) uiimagepickercontroller *imagepicker; @property (nonatomic, strong) iboutlet uilabel *successlabel; @property uiimage *imagetosend; @property nsstring *desc; - (ibaction)imagefromcamera:(id)sender; - (ibaction)resignkeyboard:(id)sender; -(ibaction)uploadbuttonclicked:(id)sender; @end .m - (ibaction)imagefromcamera:(id)sender

Strange behaviour of tellg() function c++ -

i got problem tellg() function std::fstream class. typically should return position of current character in input stream. however, works strange me. below short sample code: #include <iostream> #include <fstream> using namespace std; int main(void) { char c; ifstream czytaj; czytaj.open("test_file.txt"); cout << czytaj.tellg() << endl; //is 0 should 0 czytaj.peek(); //is 0 should 0 cout << czytaj.tellg() << endl; //is 2 should 0 !! czytaj.get(c); //is 3 should 3 czytaj.get(c); //is 4 should 4 cout << czytaj.tellg() << endl; //is 6 should 4 !! int r; cin >> r; return 0; } while txt file looks follows: abcdefghij kturjbkfvd after compilation output like: 0 2 6 first use of tellg() works properly, returns position 0 beginning of file. unfortunatelly, each next use works adds +2 position. result letters 'c' , 'd'

java - Spring3 mybatis 3 mapper no such bean found exception -

i trying spring 3 + mybatis3 + mysql didn't work out, tried of tutorials getting same exception, may 1 here can me out following error trace output , have attached list down source code please me out caused by: org.springframework.beans.factory.beancreationexception: not autowire field: private com.triage.persistance.userservice com.triage.persistance.userserviceimpl.userservice; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no matching bean of type [com.triage.persistance.userservice] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:506) @ org.springframework.beans.factory.annotation.injectionmetadata.inject(injectionmetadata.java:87)

algorithm - Smart sorting by function of geo and int -

i'm thinking ways solve following task. we developing service (website) has objects. each object has geo field (lat , long). it's 200-300 cities objects can connected. amount of objects thousands , tens of thousands. also each object has date of creation. we need search objects sorting function of distance , freshness. e.g. have 2 close cities , b. user city authorizes , should see objects city , then, on next pages, city b (because objects closer). but, if there object added year ago, , object b added today, b's object should displayed befare a's one. so, peoeple city can create special field relevant index = 100*distance + age_in_days , sort field , data need. the problem such relevant index not work other people other places. in example used linear function it's example, need fit correct function. the site work on our servers, can use database or other software (i supposed use mongodb) i have following ideas recacl relevant index e

objective c - Error Message no visible @interface for UIToolbar declares the selector 'setItems:animated:' -

Image
i'm building uisplitviewcontroller code: - (void)splitviewcontroller:(uisplitviewcontroller *)svc willhideviewcontroller:(uiviewcontroller *)aviewcontroller withbarbuttonitem:(uibarbuttonitem *)barbuttonitem forpopovercontroller:(uipopovercontroller *)pc { barbuttonitem.title = @"customers"; nsmutablearray *items = [[self.toolbar items] mutablecopy]; [items insert0bject:barbuttonitem atlndex:0]: [self.toolbar setitems:items animatd:yes]; masterpopovercontroller = pc; } - (void)splitviewcontroller: (uisplitviewcontroller *)svc willshowviewcontroller: (uiviewcontroller *)aviewcontroller invalidatingbarbuttonitem: (uibarbuttonitem *)button { nsmutablearray *items = [[self.toolbar items] mutablecopy]; [items removeobject:button]; [self.toolbar setitems:items animatied:yes]; masterpopovercontroller = nil; } i'm getting same error on 2 different lines: on line masterpopovercontroller = pc; and

javascript - Injecting multiple files into bookmarklets -

at moment, using code here: http://benalman.com/projects/run-jquery-code-bookmarklet/ write bookmarklets jquery. now, jquery isn't enough , want include other libraries/css files, isn't prettiest example. there framework creating bookmarklets available anywhere? what best way go creating bookmarklets ability inject multiple scripts/files? better alternatives? is there framework creating bookmarklets available anywhere? short: not. long: not possible "no" , sure, because can know subject. can keep eye on subject of bookmarklets (you'll see of answers related), , i've not yet seen such thing. start imagine how 1 might created, - depending on goals - doubt effort wold worthwhile. what best way go creating bookmarklets ability inject multiple scripts/files? well, no matter what, need load things sequentially, requires using onload or similar state change events trigger next steps. depending on goals, might load files sequentially o

Google apps: tracking user email or name changes -

i'm working on application, uses google apps api. in application google domain's admin can add users domain , manipulation them. parts works well. but google apps admin can change email or name of domain's users. , here problem. i'm trying investigate, what's best way figure out user's email changed. thinking best way check user's nicknames(when admin changes user's email old email attached him 'nickname'), there's posibility delete nickname, there can nothing check. which suggestions have? thanks in advance. you should replace google provisioning api calls new directory admin sdk api calls. new directory api calls provide immutable id (the id attribute) user accounts not change when admin renames user's primary email address.

c - syscalls with PTRACE_ATTACH -

i have simple question ptrace please. here simple source code in c: ptrace(ptrace_attach, pid, 0, 0); int status; waitpid(pid, &status, wstopped); while (1) { ptrace(ptrace_singlestep, pid, 0, 0); "here must display message when syscall executed." } i want know must add in loop write message (for example "ok") when process associated pid in parameter uses syscall, without using ptrace_syscall...does have idea? example return value of call ptrace(ptrace_peekuser...) , if value not equal -1... i want return value of each syscall in process pid without using ptrace_sycall , using ptrace_attach. give thanks.

php - Sort array by keys numeric first than ascending by string -

i have array: array(1,'test','jonathan') and id end with: array(1,'jonathan','test') how accomplish using php? one possible approach ( demo ): $arr = array(10,'foo', 'abc', 5, 3.2, 'test','jonathan'); usort($arr, function($a, $b) { if (is_int($a) || is_float($a)) { if (is_int($b) || is_float($b)) { return $a - $b; } else return -1; } elseif (is_int($b) || is_float($b)) { return 1; } else { return strcmp($a, $b); } }); print_r($arr); output: array ( [0] => 3.2 [1] => 5 [2] => 10 [3] => abc [4] => foo [5] => jonathan [6] => test )

ios - UIActionSheet - "init" changes button style -

Image
why button style on uiactionsheet "cancel" button change when add "init" after allocating , initializing once? if use code shows properly: uiactionsheet *popupquery = [[uiactionsheet alloc] initwithtitle:@"photo/camera" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"capture - camera", @"upload - photo library", nil]; popupquery.actionsheetstyle = uiactionsheetstyleblackopaque; [popupquery showinview:self.view]; if use code (with ...init] added) shows im-properly , "cancel" button style changed: uiactionsheet *popupquery = [[[uiactionsheet alloc] initwithtitle:@"photo/camera" delegate:nil cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"capture - camera", @"upload - photo library", nil] init]; popupquery.actionsheetstyle = uiactionsheetstyleblackopaque; [popupquery showinview:self.view];

WPF Combobox Styling -

below combobox style code. idea put border around combobox , reuse style. <application x:class="wpfapplication1.app" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" startupuri="window1.xaml"> <application.resources> <style x:key="userinputcomboboxstyle" targettype="{x:type combobox}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type combobox}"> <grid> <border borderbrush="black" borderthickness="2" verticalalignment="stretch" horizontalalignment="stretch" /> <combobox horizontalalignment="stretch"

javascript - "new" Before Anonymous Function Invocation Returning Object -

this question has answer here: javascript new object (function ) vs inline invocation 3 answers i'm reading knockoutjs source code. i ran following line i'm not sure understand... ko.utils = new (function () { generally, structure seems along lines of: ko.utils = new (function () { // variables declared var return { export:value, export:value }; })(); i don't understand construct, why new needed? do? useful for? (i thought if function called new before name invoked constructor, , if returns object it's identical invokation without new .) update: asked knockoutjs team on github , got back: my guess steve didn't know wasn't needed. looking @ original commit, see lot of unnecessary news have since been removed. it might pattern prevents this reach global context (not in case, since ever

Tabular Form for Insertion ASP.net -

i want create tabular form in asp.net multiple insertions @ time. can help? there not go on there question, perhaps looking listview or gridview controls? suggest @ , see if want, or update question further details.

c# - AppDomain.CurrentDomain.BaseDirectory changes according to the app's target platform -

i have path set path root dir of application. worked until decided change system.data.sqlite.dll lib , application 32bit instead of 64bit (which changed because downloaded 64bit version of sqlite lib. private string fullpath = path.combine(appdomain.currentdomain.basedirectory, "testdb.db"); the problem on launch, there error saying access "c:/program files (x86)/microsoft visual studio 11.0/ide/test.db" denied , means somehow appdomain.currentdomain.basedirectory references directory instead of application's root directory. what cause of this? update : apparently, changing applications platform target x64, , using 64b version of sqlite fixes problem... i think it's because started application in debug mode hosted in visual studio hitting f5!

eclipse - static keyword by itself in Java -

i know static is.. globally. so looking through code, better in coding myself. i'm looking through minecraft source code, , interested there in files "tileentity.java" , "entitylist.java". not necessary on there, because manner of programming. so, have regular class method: public class entitylist{ public static void addmapping( /* variables dont matter */ ){ //call other methods, unimportant } } after there class imported entitylist , this: import the.path.to.entitylist; public class tileentity{ static{ addmapping( /* vars */ ); addmapping( /* vars */ ); } } now i'm wondering: how work? please let me know if need know more background of code, cannot redistribute file due copyright , stuff. have decompile minecraft if have yourself. we can't see real code, guess contains static import: import static the.path.to.entitylist.addmapping; or import static the.path.to.entitylist.*; a sta

ios - How do I use Reachability to check if there's an internet connection, and if not, do something. (Basically use as a boolean.) -

i've read on code on reachability 's page, i'm unclear how i'd use in if statement type scenario. for example, user taps refresh button, firing refresh method (go figure, eh?) , if there internet connection, want refresh of data occur, if not, want send notification of no internet. how achieve reachability? would use code following have variable set value in each block depending on result, , @ after. seems less elegant, if it's way, it. // allocate reachability object reachability* reach = [reachability reachabilitywithhostname:@"www.google.com"]; // set blocks reach.reachableblock = ^(reachability*reach) { nslog(@"reachable!"); }; reach.unreachableblock = ^(reachability*reach) { nslog(@"unreachable!"); }; // start notifier cause reachability object retain itself! [reach startnotifier]; my app did - send message in block self on main thread - hostchanged:(bool)state. self class can maintain public ivar

javascript - Forcing login autofill on a site where autofill is broken or disabled -

i daily visit couple of sites devs whatever reason have respectively mangled , disabled login submittal, neither autofill nor onepassword can fill login , password fields. how can avoid typing name , login on every single visit? i'm open approach autofill working - greasemonkey, or spoofing form submittal page. the simple way bookmarklet: javascript:document.forms[0].username.value = 'username'; document.forms[0].password.value = 'password'; document.forms[0].submit(); make bookmark of random page, edit , put text instead of "http://...". may need play if it's not first form on page, or if fields named differently. (view source, and/or right-click , select "inspect element" find name) when page, click bookmarklet login.

excel - Unsure of how to use cell data to get data from another worksheet -

this weird sort of function i've never tried use before, i'm not sure how go asking without using example. essentially, have column of strings represent datasheets in .xls file. each row has data in corresponds datasheet named in said column. in case explanation insufficient, here's example: worksheet 1 : worksheet 1 value 1 : worksheet 1 value 2 : ....... worksheet 2 : worksheet 2 value 1 : worksheet 2 value 2 : ....... etc... at moment, spreadsheet requires manually update worksheet reference each column populate data, i.e. every cell, need manually fill out worksheet name in equation: ='worksheet 1'!b111 this works, suboptimal, have large number of worksheets. want able able fill out cell 1 (the worksheet name) , have every other cell use worksheet name reference, so: column : column b : column c : ... "worksheet 1" : =a1!b111 : =a1!b34 : ... "worksheet 2" : =a2!b111 : =a2!b34 : ... first question: possible? second q

Haskell System is a member of unusable hidden package -

system absolutely brimming handy useful io stuff, apparently it's been deprecated understand (presuming because moved deprecated haskell98 package), said; there info out there it's components have been dispersed to? i want use system.timeout , since can't use system , guessing timeout has been moved different module. module moved to? modules of other system bits moved to? the old system module has been split several hierarchical modules under system namespace. example, timeout in system.timeout module. you can see of system.* modules--and more besides--on documentation base . for specific functions, can search on hoogle .

java - Unknown Recursive Algorithm -

i have found answer problem while ago have since forgotten it. after hours of searching again, cannot seem find it. have recursive method: public static int f(int x, int y) { if (x==0) return 1+y; if (y==0) return f(x-1,1); return f(x-1, f(x,y-1)); } i know formula determining return is: when x = 0 , formula y + 1 when x = 1 , formula y + 2 when x = 2 , formula 2y + 3 . i don't know beyond that. my question(s) recursive algorithm called , there way determine simplified function value of x , y ? in advance! that looks ackermann function: http://en.wikipedia.org/wiki/ackermann_function according wikipedia multiply recursive problem think there no non-recursive way represent it.

json - Stuck with HTTP GET authentication in Ruby -

i trying write short script http authentication using request this makes request. def try_login(u, p) path1 = '/index.php' path2 = '?uuser=#{myuser}&ppass=#{mypass}' r = send_request_raw({ 'uri' => "#{path1}#{path2}", 'method' => 'get' }) ...continued... but code not work because error says: undefined local variable or method `myuser' --> trying send 1 (1) request login parameters, , app responds specific data. , not know how put placeholders user , pass in request. ... next, checking http response. response comes in json mime this: success response {"param1":1,"param2"="auth success","menu":0,"userdesc":"my user","user":"uuser","pass":"ppass","check":"success"} fail response {"param1":-1,"param2"="

android - AndroidAnnotations processing fails in IntelliJ because R.java isn't generated -

Image
i think there's problem intellij when generates r.java file, leads problem in androidannotations because can't resolve resource id layout. here's activity: package com.airlocksoftware.canvastest; import android.app.activity; import android.os.bundle; import com.googlecode.androidannotations.annotations.eactivity; @eactivity(r.layout.main) public class myactivity extends activity { /** * called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } } what's weird if comment out annotation, , setcontentview(r.layout.main) , works fine though r.java never imported. by way, layout simple "hello world". nothing weird going on there. no matter do, can't androidannotations generate canvasactivity_.java . pom.xml looks this: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom

c# - RestSharp Accept header change -

i using restsharp developing on client side. using ruby grape gem custom api on server side. grape gem can versioning setting accept http header f.e application/vnd.twitter-v1+json and test command via console works perfect curl -h accept=application/vnd.twitter-v1+json /statuses/public_timeline but when trying set header restrequest getting error 404 on server. i have no idea why so. have found issue server returns 406 error - in case 404. how can put custom value accept header? you can set custom accept header addheader method... var client = new restclient("http://example.com/api"); var request = new restrequest("statuses/public_timeline", method.get); request.addheader("accept", "application/vnd.twitter-v1+json"); var response = client.execute(request); var json = response.content; this should work fine if willing deserialize json yourself. if want make use of generic execute<t> method, automatic dese

javascript - Queries not retaining in Internet Explorer -

can't figure out why queries made in search box not being retained in ie (of course). can please open link below in ie http://www.adhuntr.com/p/results.html?ie=utf-8&q=ipad+mini&min=&max=&l=all&c=all&t=&p= the error due addloadevent() function, calling fillsearchbox() ie dev console fires function correctly , populate input box query. specially, error in call: addloadevent(fillsearchbox); i tried using updated suggestion addloadevent function in jsfiddle without success. since using jquery little further down code can use instead. sample in jsfiddle : jquery(document).ready(function () { fillsearchbox() }); btw, have typo on input.result , why search not submit automatically when select suggestion: input .attr ("autocomplete", "off") .autocomplete ("http://clients1.google.com/complete/search", options) .result (function () { searchform.submit(); }); //<== typo in line, should

Why doesn't this code work? i am just trying to slice.(in python) -

when enter code, there error in way slice works...it won't let me enter it, , overall wont work. verb_1 = raw_input("enter word") verb_2 = verb_1.lower() verb_2_ending = verb_2[-2:] if verb_2_ending == "ar": ar_verb = raw_input("you've chosen ar verb. tense like") elif verb_2_ending == "er": er_verb = raw_input("you've chosen er verb. tense like") else : ir_verb = raw_input("you've chosen ir verb. tense like") if ar_verb == "subjunctive": subject_1 = raw_input("what subject") elif ar_verb == "present": subject_2 = raw_input("what subject") else : subject_3 = raw_input("what subject") yields error: enter word : hablar traceback (most recent call last): file "<stdin>", line 4, in <module> typeerror: unsupported operand type(s) -: 'str' , 'str' i believe you're looking cal

java - How to put data into HashMap<key, Object> -

i new programming. have program iterates excel file , put values hashmap hashmapbut object in hash map has last record. i'll post code , may can tell me mistakes, or better yet post code how should done. please help, stuck here. my excel file: doc seq acc status notes 1111 2 account test value1 22222 3 account test2 value2 my object .... public class account{ int docnumber; int docsequence; string docacccode; string docstatus; string docnotes; //getters , setters bellow ...... } my iterate method... public void readfile() throws ioexception{ inputstream excelfiletoread = new fileinputstream(inputfile); xssfworkbook wb = new xssfworkbook(excelfiletoread); xssfsheet sheet = wb.getsheetat(0); xssfrow row = null; xssfcell cell = null; int recordnumber = 0; iterator rows = sheet.rowiterator(); while (rows.hasnext()){ row=(xssfrow) rows.next(); int rownum = row.getrownum(); int cellnum = 0;

jquery - How do I allow users to enlarge or decrease the size of a html table? -

well im working on little sound board project , added thing create website more dynamic when click increase/decrease increases/descreases text size in buttons. unfortunately useless unless includes table resize , button resize. here code in action: http://serverbc.ucoz.com/main.html scroll bottom of page see buttons! what need add work nicely? btw! here code how did text: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </script> <div id="box1"> <font color=white>rrrr</font> </div> <script type="text/javascript"> $(document).ready(function(){ $(".increasefont,.decreasefont").click(function(){ var type= $(this).val(); var curfontsize = $('#box1').css('font-size'); if(type=='increase'){ $('#box1').css('font-size', parseint(curfontsize)+1); } els

android - Error parsing XML: not well-formed (invalid token) andElement type "LinearLayout" must be followed by either attribute specifications, ">" or "/>" -

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" <edittext android:id="@+id/editmessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/edit_message" <button android:layout_width="wrap_content" android:layout_height="wrap_conent" android:text="@string/button_send"/> <?xml version"1.0" encoding="utf-8"?> <rescources> <string android:name="app_name">becreativebuddy</string> <string android:name="edit_message">enter message</string> <string android:name="button_send">send</string>

NoMethodError on line ["32"] in Rails 3.2 with latest Compass and Sass -

i have been searching around bit find solution error message getting , based on research appear error should have been fixed in latest compass-rails and/or sass-rails gem releases. however, still getting error message , because missing silly. i getting error message when running compass compile command. the full error message is: nomethoderror on line ["32"] of /home/mike/.rvm/gems/ruby-1.9.3-p392/gems/sass-rails-3.2.6/lib/sass/rails/helpers.rb: undefined method `[]' nil:nilclass my .scss file looks this: @import "base"; #container { @include background-image(linear-gradient(#cbd7e2, #00aeef)); @include background-size(auto); padding: $container-pad; } #header { background-image: image-url("logo.gif"); } logo.gif located in rails project directory in app/assets/images. what missing / doing wrong here? please let me know if need more information. thanks, meebix update: seems needed url. still not able image

c# - How to check if dictionary contains a value in a generic list -

i have list of coordinates stored in generic list. want able iterate through list , check if coordinates adjacent each other. if are, know same groups versus if aren't. know how properly? update: here's updated code far. grouping coordinates in new generic list , adding them dictionary if adjacent , same type. now want know if dictionary contains coordinate in group. doesn't run same process again. how access values of generic list in dictionary? private void groupmatchtile(list<int[]> matchtile){ int = 0; dictionary<int, list<int[]>> groups = new dictionary<int, list<int[]>>(); foreach(int[] coord in matchtile){ if(groups.containsvalue( // how check if coords belong in group )) return; groups.add(i, new list<int[]>()); groups[i].add(coord); foreach(int[] nextcoord in matchtile){ if (coord == nextcoor

php - Is $argc interchangeable with count($argv)? -

are there functional differences need make note of? assume $argc bit faster since it's pre-counted value in memory. it's splitting hairs, yes, $argc few nanoseconds faster. (remember file name argument too.)

android - Create Group in ASmack -

i'm newbie in asmack.. how create group in group tab in asmack? have tried creategroup(string name) shown here link but seems makes group in user tab. does know how make it? advice. i'm not clear question if use creategroup(string groupname), try way: roster.creategroup(groupname).addentry(rosterentry) because when create roster group have add @ least 1 entry(rosterentry) group or won't save. hope answer question

tsql - Currency Conversion Logic for multiple rows -

i have question regarding currency conversion logic. currently, return result set has got many currency fields. now, requirement says users should have option select output currency format eg: account name | actual amount | estimated amount | target amount xyz | $ 2000 | $ 456.78 | $ 890.45 abc | sd 2000 | sd 456.78 | sd 890.45 if user selects yen output format, result set should account name | actual amount | estimated amount | target amount xyz | ¥ 2233 | ¥ 42356.78 | ¥ 82390.45 abc | ¥ 21213000 | ¥ 41156.78 | ¥ 82390.45 the exchange rate available, , know have function call in select statement convert currency columns. but, making function call each record increases execution time. is there other logic used improve execution time. when use function conversions, have know every single record function executed. when @ overhead of executing function, you'll have executio

scala - Patch Seq using Queue -

i'm writing simulation number of operators take work single queue. @ each time step need sequentially check elements of sequence, , if condition passes replace current value item queue. remains in queue must retained later iterations. i've written routine called patch this, doesn't seem neat. there more idiomatic way achieve same thing? i'd fast still functional in style. import scala.annotation.tailrec import scala.collection.immutable.queue object seqpimp extends app{ val myseq = seq('a', 'b', 'c', 'd', 'e') val shortq = queue('+','-') val longq = queue('+','-','*','/','%') println(patch(myseq)(_.isupper, shortq)) //output: (list(a, +, -, d, e),queue()) println(patch(myseq)(_.isupper, longq)) //output: (list(a, +, -, d, *),queue(/, %)) def patch[t](to: seq[t])(condition: t => boolean, from: queue[t]): (seq[t], queue[t

haskell - Compiler switch to turn debugging messages on/off? -

ok, here's simple question. i've written function debug :: string -> io () . i'd set things when compile program 1 way, function writes standard error, , if compile program way, function becomes no-op. there easy compile-time switch that? or have implement myself? i don't think involving trace right approach solve problem. instead, use preprocessor disable/enable debug messages. put following in separate file: {-# language cpp #-} import system.io debug :: string -> io () debug message = #ifdef debug hputstrln stderr message #else return () #endif the {-# language cpp #-} line enables c preprocessor current file. can compile file with/without debugging using ghc -ddebug or ghc .

C# Looking for pattern ideas - Inheritance w/ constructor issue -

i have multiple layered application i'm rewriting using entity framework 4 w/ code first. important things: in data layer, on context, have: public dbset<mobileserialcontainer> mobiles { get; set; } this context has static instance. know, know, terrible practice. there reasons aren't relevant post why i'm doing this. mobileserialcontainer consists of following: [table("mobiles")] public sealed class mobileserialcontainer { [key] public long serial { get; set; } [stringlength(32)] public string name { get; set; } public mobileserialcontainer() { } public mobileserialcontainer(mobile mobile) { mobile = mobile; lecontext.instance.mobiles.add(this); } [stringlength(1024)] public string fullclassname { { return mobile == null ? "" : mobile.gettype().assemblyqualifiedname; } set { if (string.isnullorempty(value) || value == fullclassname)

java - How to parse array returned from php to String array in android -

i following response after executing http post php in android. new array("1:excellent","2:good","3:average","4:not good","5:disappointing") i want parse result string array, can fill spinner these values. i dont see string constructor can take array maybe check java string documentation. check array's size, create string array of size, manually copy in array string array via loop value value. not familiar copying array object seem object , typecast string. i'm not sure see array in java collections, use few languages, if have not managed data java object yet not yet apply.