Posts

java - Searching entire storage of phone and SD Card for Music Player -

back when started make music player , searching in sd card work , show music , player work properly. couple weeks ago, bought new phone , decided install app onto it, when loaded app, couldn't find music, need way change current code search every folder of phone, , micro sd card , file ends in ".mp3". main activity.java class mp3filter implements filenamefilter { public boolean accept(file dir, string name) { return (name.endswith(".mp3")); } } public class mainactivity extends listactivity implements oncompletionlistener { private static final string sd_path = new string(environment.getexternalstoragedirectory().getpath() + "/"); private static final string phone_storage = new string(environment.getrootdirectory().getpath() + "/"); private list<string> songs = new arraylist<string>(); private mediaplayer mp = new mediaplayer(); private view play; private view pause; private view stop; private view next; private...

chat - How to save variable after closing mIRC? -

i'm new language , i'm trying code own bot. alredy got basics , manage use variables , aliases, looking forward mini-game in chat in have own pet, name , level up. i this, problem resides in @ end of day, close program , pets go away, , kind of destroys purpose of it. i wondering if there way in save these variables , reload them each time open program, maybe save them on .txt? any suggestion appreciated. i agree 1 of comments it's best go .ini files problem. an example of syntax, taken url linked above: writeini reminder.ini birthday jenna 2/28/1983 writeini reminder.ini birthday mike 10/10/1990 this produces following file: [birthday] jenna = 2/28/1983 mike = 10/10/1990 and read this: echo -a mike: $readini(reminder.ini, n, birthday, mike) echo -a jenna: $readini(reminder.ini, n, birthday, jenna) if want more flexibility define own data format, can revert plain text files. basic /write , $read functions have pretty neat functionality...

coldfusion - Sessions w/CFWheels not sticking -

i having difficulty having session values stick when create them. default value exists @ times. below rudimentary login tool. the compare function works fine, when after cflock , redirect, session.userid , session.isloggedin still 0 , false, respectively. config/app.cfm <cfset this.name = "xxx"> <cfset this.sessionmanagement = true /> <cfset this.sessiontimeout= createtimespan(0,2,0,0) /> <cfset this.setclientcookies = false /> <cfset this.datasource = "xxx" /> events/onrequeststart.cfc <cfscript> if ( !structkeyexists(session, "userid") ) { session.userid = 0; session.isloggedin = false; } </cfscript> controllers/admin.cfc <cfcomponent extends="controller"> <cffunction name="init"> </cffunction> <cffunction name="login"> </cffunction> <cffunction name="main"> </cffun...

php - Use DreamFactory SQL with SSL Connection -

just installed dreamfactory on server , have connecting correctly database. when trying send curl request, i'm receiving error: curl: (35) unknown ssl protocol error in connection [api.domain.net]. i'm not sure start work ssl connection database. incredible @ point because searching issue isn't helping much. are forcing ssl3? since dreamfactory docs "using ssl our api requires ssl3" may need use -3 or --sslv3 curl options, indicated on the curl man page . dreamfactory docs page of curl examples uses -3 option repeatedly. need ensure sslv3 support enabled in web server of choice, well. this answer indicates curl error message "unknown ssl protocol error" can caused using wrong ssl/tls protocol version, above resolution given details provided. you need ensure you've installed , enabled ssl cert. if deployed dreamfactory using bitnami, may want review their documentation on enabling ssl . if installed dreamfactory manually...

ruby - I am not able to increment string contains integer value? -

how increment last string based on last integer ?for eg."foo" = "f001", "foo9" = "foo10", "foo99" = "foo100","foo001" = "foo002" one way this... def increment_string(string) old_digits = string.scan(/\d+$/).first || '' string.sub(/\d+$/,'') + (old_digits.to_i+1).to_s.rjust(old_digits.size, '0') end p increment_string("beep") => "beep1" p increment_string("beep5") => "beep6" p increment_string("beep99") => "beep100" p increment_string("beep004") => "beep005"

ruby on rails - How do I link my bids to posts? -

i'm having trouble linking bids posts. have created post_id column in bids table (via adding resources:posts in migration). i want able go /posts/:id/new_bid create new bid post. currently, can create new bid going /posts/2/new_bid (for example), still says 'post_id: nil' in database. routes root 'static_pages#home' 'add' => 'posts#new' 'posts' => 'posts#index' '/posts/:id/new_bid' => 'bids#new' resources :posts resources :bids bid controller class bidscontroller < applicationcontroller def new @bid = bid.new @post = post.find(params[:id]) end def show @bid = bids.find(params[:id]) end def index @bid = bids.all end def create @bid = bid.new(bid_params) @post = post.find(params[:post_id]) if @bid.save redirect_to root_path flash[:notice] = 'bid received!' else render 'new' end end def bid_params p...

html - innerHTML and conditional (ternary) operator- "unexpected string" -

can please me? trying enable program load page numbers separated hr tag, except last number (#10). right there appears "unexpected string" in code block after if statement. i've tried several different permutations line, i'm stumped how working. thank in advance! var n = 1, str = "" while (n <= 10) { if (n % 2 === 0) { str += "<p class='even'>" + n + (n === 10 ? "" : "<hr>") "</p>" } else { str += "<p class='odd'>" + n + "</p><hr>" } n++ } document.queryselector("#target").innerhtml = str !doctype html> <html> <head> <style> .even { color:blue; } .odd { color:red; } </style> </head> <body> <div id="target"></div> </body> </html> don't need change: s...