Posts

datetime - date time in Android inconsistencies -

i stuck example running on android: simpledateformat sdf = new simpledateformat("dd-mm-yyyy kkmm"); sdf.settimezone(timezone.gettimezone(time.timezone_utc)); date scheduleddatetime = sdf.parse(sms.getscheduleddatetime()); log.i(tag, "scheduleddatetime : " + scheduleddatetime); // scheduleddatetime : fri jan 06 23:58:00 hnec 2012 log.i(tag, "scheduleddatetime milli : " + scheduleddatetime.gettime()); // scheduleddatetime milli : 1325890680000 calendar calendar = calendar.getinstance(); calendar defaulttzcalendar = calendar.getinstance(timezone.getdefault()); calendar utctzcalendar = calendar.getinstance(timezone.gettimezone(time.timezone_utc)); calendar.settime(scheduleddatetime); defaulttzcalendar.settime(scheduleddatetime); utctzcalendar.settime(scheduleddatetime); log.i(tag, "calendar : " + calendar.gettimeinmillis()); // calendar : 1325890680000 log.i(tag, "defaulttzcalendar : " + defaulttzcalendar.gettimeinmillis()); // defaulttzc...

Django Template being rendered differently for different urls -

i'm using static_url in 1 of templates , works if use 1 url , fails if use another. in both cases, exact same view being run exact same template. template code: <link href="{{ static_url }}css/form.css" type="text/css" rel="stylesheet" /> <!-- rest of page... --> view code: def myform(request): if request.method == 'post': form = myform(request.post, request.files) obj = save_form(form) if obj: send_confirmation_email(obj) return redirect('done-page') else: form = myform() return render(request, 'template.html', {'form': form,}) urls # site urls.py urlpatterns = patterns('', url(r'^$', 'site.app.views.myform'), url(r'^app/', include('site.app.urls'), #... ) # app urls.py urlpatterns('site.app.views', url(r'^$', 'myform'), #... ) the above snippet of django site. if page accessed via "mydomain.com/" (the index of site), static_ur...

c++ - class template, with template function, specialization -

i'm trying write template class aids programmer in writing correct code. calculate route san francisco new york via washington, given route san francisco washington , route washington new york. when given route san francisco los angeles , washington new york, compiler report error. here class (without normal workhorse function): extern const char miami[] = "miami"; template< const char* finish, const char* start> class route { public: route(); ~route() {}; template<const char* otherplace> route<start, otherplace> alterfinish() const; }; template<const char* start> // specialisation template<const char* otherplace> // allow miami finish changed else. route<start, otherplace> route<start, miami>::alterfinish() const{ return route<start, otherplace>(); } unfortunately not work. 'invalid use of incomplete type' error. same sort of function without specialisation compile. doing wrong? invalid use of incomplete typ...

sql - Postgres: Selecting Distinct on a column is not returning distinct results with Joins -

Image
i'm building system in there following tables: song broadcast station follow user a user follows stations, have songs on them through broadcasts. i'm building "feed" of songs user based on stations follow. here's query: select distinct on ("broadcasts"."created_at", "songs"."id") songs.* "songs" inner join "broadcasts" on "songs"."shared_id" = "broadcasts"."song_id" inner join "stations" on "broadcasts"."station_id" = "stations"."id" inner join "follows" on "stations"."id" = "follows"."station_id" "follows"."user_id" = 2 order broadcasts.created_at desc limit 18 as can see here, i'm getting duplicate songs happening because i'm following 2 stations both have broadcasted same song: note: shared_id same id. my question is: how...

php - line breaks not showing on output? -

for longest time, i've been outputting comments , using function below in order put in line breaks. it's been working great. echo str_replace(chr(13),"<br />",$com_text); however, of late, code has not been working new comments. still functions older comments in database. new being submitted database not being outputted correctly. no code has changed, i'm aware of. suggestions? try using echo nl2br($com_text); or regex looks new lines: echo preg_replace('/$\r?^/m', '<br />', $com_text);

ruby - Rails mailer links improperly rendering -

Image
has else had issues rails img src links being improperly rendered, i.e. http://host.s3.amazonaws.com/images/account_welcome_button.png is being rendered as http://host.s3.amazonaws.com/images/+account_welcome_button.png in e-mail clients? i'm testing particularly on gmail inbox client. if you've experienced this, has been fix remove these characters? ruby - rails mailer links improperly rendering - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads log in sign ...

objective c - Bare bones Facebook integration demo app -

so started looking integrating fb app , whipped little test app. wanted have bare bones app without of bs that's in hackbook demo app. basically, it's overly complicated want. the problem i'm doing isn't working. app tries authenticate fb, doesn't return auth tokens. else noticed that... if have facebook app installed... switches it, shows white loading screen second, dismisses , pops app. if facebook app isn't installed... open in safari , show app approval window, let me login , pops app. both ways fail getting , storing auth tokens however. what heck doing wrong? mind seeing if code works them? full source here: deleted. thanks looking. it sounds don't have app registered in facebook developer portal. https://developers.facebook.com/apps