Posts

How to style radio button inside alert dialog in android? -

i change text color of radio buttons inside dialog, , other attributes well. how do? the code used create radio buttons inside dialog: alertdialog.builder builder = new alertdialog.builder(this); builder.setsinglechoiceitems(somearray, -1, somelistener); i have tried new contextthemewrapper(this, r.style.alertdialogcustom) , works on dialog itself, not work on embedded radio buttons(say text color). alertdialog.builder builder = new alertdialog.builder(new contextthemewrapper(this, r.style.alertdialogcustom)); builder.setsinglechoiceitems(somearray, -1, somelistener); r.style.alertdialogcustom example: (tried other attributes well, none works) <?xml version="1.0" encoding="utf-8"?> <resources> <style name="alertdialogcustom" parent="@android:style/theme.dialog"> <item name="android:textcolor">@color/colorgray</item> <item name="android:typeface"...

php - File download function fails to attach complete file name and extension -

i have function use prompt csv files download. however, filename fails complete in mozilla browser works chrome. instance, if file name should f1_open_marksheet.csv, mozilla prompt download f1 (missing rest of file name , extension. code buggy? <?php function pushdownloadfile($filename){ header('content-description: file transfer'); header('content-type: text/csv; charset=utf-8'); header('content-disposition: attachment; filename='.$filename); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . filesize($filename)); ob_clean(); flush(); readfile($filename); unlink($filename); } ?> the flaw caused white space in file name eg f 1_open_marksheet.csv replaced hyphen f_1_open_marksheet.csv . credits @cbroe sharing link in comment above.

c# - Unable to access methods and classes from my project in Windows Runtime Component in UWP -

i create background task synchronize data server background task using windows runtime component in uwp app. but, unable access methods , classes project in windows runtime component in uwp. is there alternate way create background task without windows runtime component? or how can able access classes. you can create class library , add reference winmd , project class. code of class library like: public class bridgeclass { public static event action<string> messagereceived; public static void broadcast(string message) { if (messagereceived != null) messagereceived(message); } } inside project class can subscribe event bridgeclass.messagereceived += showmessage; and make realization: void showmessage(string msg) { } now winmd class call it: bridgeclass.broadcast("some value");

bash - Wait for last created process (daemon which forks) to end -

i'm writing wrapper script use in inittab. script starts daemon , waits terminate. here's have currently: #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here while kill -0 `echo $!` 2> /dev/null; sleep 1; done; the problem second line; returns immediately. if instead do: while kill -0 `pgrep mydaemon` 2> /dev/null; sleep 1; done; it works fine, isn't solution me have other scripts prefix mydaemon . what doing wrong? edit: the problem seems related daemon fork(). so, parent pid in $! . i'm looking ways solve problem. maybe should use pid files , have mydaemon write pid there. you can following way through issue. #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here & wait $! wait command wait till process completes , comes out. if looking wait after other commands can store pid in other variable , use that. #!/bin/bash /usr/local/bin/mydaemon --lots_of_params_here & mypid=$! ### other commands wait $mypid ...

ruby on rails - URL replacement from submitted comment -

i displaying users website url in comments. works correctly on view page, wondering if can change how url displayed. can display http://google.com website? or remove http, https , display google.com? here current code: <%= link_to comment.website, url_for(comment.website), target: '_blank' %> if comment.website returns string as: " http://google.com " can use regex trim "//" using: comment.website.remove(/.*\/\//) this crash if comment.website nil can use different syntax write same code comment.website.try(:remove, /.*\/\//) so: <%= link_to comment.website.try(:remove, /.*\/\//), url_for(comment.website), target: '_blank' %> go , check http://rubular.com/r/ufmy2djohw play regex

android - How to set the size of vector drawable as drawableLeft drawable? -

i try use vector drawables in android app. have used http://android-developers.blogspot.com/2016/02/android-support-library-232.html . need set vector drawble in drawableleft. here vector drawable <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportwidth="24.0" android:viewportheight="24.0"> <path android:fillcolor="@color/colorprimary" android:pathdata="m12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zm18,8h-1l17,6c0,-2.76 -2.24,-5 -5,-5s7,3.24 7,6v2l6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2l20,10c0,-1.1 -0.9,-2 -2,-2zm8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1s3.1,1.39 3.1,3.1v2l8.9,8l8.9,6zm18,20l6,20l6,10h12v10z"/> in layout <android.support.design.widget.textinputlayout android:id="@+id/textinputlayoutpassword" android:layout_width...

python 3.x - TypeError: unorderable types: int() > Guessing_game() -

i studying python , trying make guessing number program connected gui. however, there bug , don't know how fix, please me. my code from tkinter import* import random class application(frame): def __init__(self, master): super(application, self).__init__(master) self.grid() self.widgets() self.answer = guessing_game(starting_number = 0, ending_number = 100) def widgets(self): label(self, text = "hello welcome new_version of guess number!" ).grid(row = 0, column = 0, sticky = w) label(self, text = "guess number(0-100):" ).grid(row = 1, column = 0, sticky = w) self.user_answer = entry(self) self.user_answer.grid(row = 1, column = 1, sticky = w) button(self, text = "submit", command = self.submit ).grid(row = 3, column = 0, stic...