Search Results

Search found 7501 results on 301 pages for 'charms bar'.

Page 26/301 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Is it okay to define a [] method in ruby's NilClass?

    - by Silasj
    Ruby by default does not include the method [] for NilClass For example, to check if foo["bar"] exists when foo may be nil, I have to do: foo = something_that_may_or_may_not_return_nil if foo && foo["bar"] # do something with foo["bar"] here end If I define this method: class NilClass def [](arg) nil end end Something like that would make this possible, even if foo is nil: if foo["bar"] # do something with foo["bar"] end Or even: if foo["bar"]["baz"] # do something with foo["bar"]["baz"] here end Question: Is this a good idea or is there some reason ruby doesn't include this functionality by default?

    Read the article

  • Progress bar in a Flash MP3 Player

    - by Deryck
    Hi I have coded a simple XML driven MP3 player. I have used Sound and SoundChannel objects and method but I can´t find a way of make a progress bar. I don´t need a loading progress I need a song progress status bar. Canbd anybody help me? Thanks. UPDATE: Theres is the code. var musicReq: URLRequest; var thumbReq: URLRequest; var music:Sound = new Sound(); var sndC:SoundChannel; var currentSnd:Sound = music; var position:Number; var currentIndex:Number = 0; var songPaused:Boolean; var songStopped:Boolean; var lineClr:uint; var changeClr:Boolean; var xml:XML; var songList:XMLList; var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, Loaded); loader.load(new URLRequest("musiclist.xml")); var thumbHd:MovieClip = new MovieClip(); thumbHd.x = 50; thumbHd.y = 70; addChild(thumbHd); function Loaded(e:Event):void{ xml = new XML(e.target.data); songList = xml.song; musicReq = new URLRequest(songList[0].url); thumbReq = new URLRequest(songList[0].thumb); music.load(musicReq); sndC = music.play(); title_txt.text = songList[0].title + " - " + songList[0].artist; loadThumb(); sndC.addEventListener(Event.SOUND_COMPLETE, nextSong); } function loadThumb():void{ var thumbLoader:Loader = new Loader(); thumbReq = new URLRequest(songList[currentIndex].thumb); thumbLoader.load(thumbReq); thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded); } function thumbLoaded(e:Event):void { var thumb:Bitmap = (Bitmap)(e.target.content); var holder:MovieClip = thumbHd; holder.addChild(thumb); } prevBtn.addEventListener(MouseEvent.CLICK, prevSong); nextBtn.addEventListener(MouseEvent.CLICK, nextSong); playBtn.addEventListener(MouseEvent.CLICK, playSong); function prevSong(e:Event):void{ if(currentIndex 0){ currentIndex--; } else{ currentIndex = songList.length() - 1; } var prevReq:URLRequest = new URLRequest(songList[currentIndex].url); var prevPlay:Sound = new Sound(prevReq); sndC.stop(); title_txt.text = songList[currentIndex].title + " - " + songList[currentIndex].artist; sndC = prevPlay.play(); currentSnd = prevPlay; songPaused = false; loadThumb(); sndC.addEventListener(Event.SOUND_COMPLETE, nextSong); } function nextSong(e:Event):void { if(currentIndex And here the code for the lenght and position. It´s inside a MovieClip. That´s why I use absolute path for find the Sound object. this.addEventListener(Event.ENTER_FRAME, moveSpeaker); var initWidth:Number = this.SpkCone.width; var initHeight:Number = this.SpkCone.height; var rootObj:Object = root; function moveSpeaker(eventArgs:Event) { var average:Number = ((rootObj.audioPlayer_mc.sndC.leftPeak + rootObj.audioPlayer_mc.sndC.rightPeak) / 2) * 10; // trace(average); // trace(initWidth + ":" + initHeight); trace(rootObj.audioPlayer_mc.sndC.position + "/" + rootObj.audioPlayer_mc.music.length); this.SpkCone.width = initWidth + average; this.SpkCone.height = initHeight + average; }

    Read the article

  • Action bar with Search View. Reverse compatibility issues

    - by suresh
    I am building a sample app to demonstrate SearchView with filter and other Action Bar items. I am able to successfully run this app on 4.2(Nexus 7). But it is not running on 2.3. I googled about the issue. Came to know that i should use SherLock Action bar. I just went to http://actionbarsherlock.com/download.html, downloaded the zip file and added the library as informed in the video: http://www.youtube.com/watch?v=4GJ6yY1lNNY&feature=player_embedde by WiseManDesigns. But still I am unable to figure out the issue. Here is my code: SearchViewActionBar.java public class SearchViewActionBar extends Activity implements SearchView.OnQueryTextListener { private SearchView mSearchView; private TextView mStatusView; int mSortMode = -1; private ListView mListView; private ArrayAdapter<String> mAdapter; protected CharSequence[] _options = { "Wild Life", "River", "Hill Station", "Temple", "Bird Sanctuary", "Hill", "Amusement Park"}; protected boolean[] _selections = new boolean[ _options.length ]; private final String[] mStrings = Cheeses.sCheeseStrings; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.activity_main); // mStatusView = (TextView) findViewById(R.id.status_text); // mSearchView = (SearchView) findViewById(R.id.search_view); mListView = (ListView) findViewById(R.id.list_view); mListView.setAdapter(mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mStrings)); mListView.setTextFilterEnabled(true); //setupSearchView(); } private void setupSearchView() { mSearchView.setIconifiedByDefault(true); mSearchView.setOnQueryTextListener(this); mSearchView.setSubmitButtonEnabled(false); //mSearchView.setQueryHint(getString(R.string.cheese_hunt_hint)); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.searchview_in_menu, menu); MenuItem searchItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) searchItem.getActionView(); //setupSearchView(searchItem); setupSearchView(); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { if (mSortMode != -1) { Drawable icon = menu.findItem(mSortMode).getIcon(); menu.findItem(R.id.action_sort).setIcon(icon); } return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { String c="Category"; String s=(String) item.getTitle(); if(s.equals(c)) { System.out.println("same"); showDialog( 0 ); } //System.out.println(s); Toast.makeText(this, "Selected Item: " + item.getTitle(), Toast.LENGTH_SHORT).show(); return true; } protected Dialog onCreateDialog( int id ) { return new AlertDialog.Builder( this ) .setTitle( "Category" ) .setMultiChoiceItems( _options, _selections, new DialogSelectionClickHandler() ) .setPositiveButton( "SAVE", new DialogButtonClickHandler() ) .create(); } public class DialogSelectionClickHandler implements DialogInterface.OnMultiChoiceClickListener { public void onClick( DialogInterface dialog, int clicked, boolean selected ) { Log.i( "ME", _options[ clicked ] + " selected: " + selected ); } } public class DialogButtonClickHandler implements DialogInterface.OnClickListener { public void onClick( DialogInterface dialog, int clicked ) { switch( clicked ) { case DialogInterface.BUTTON_POSITIVE: printSelectedPlanets(); break; } } } protected void printSelectedPlanets() { for( int i = 0; i < _options.length; i++ ){ Log.i( "ME", _options[ i ] + " selected: " + _selections[i] ); } } public void onSort(MenuItem item) { mSortMode = item.getItemId(); invalidateOptionsMenu(); } public boolean onQueryTextChange(String newText) { if (TextUtils.isEmpty(newText)) { mListView.clearTextFilter(); } else { mListView.setFilterText(newText.toString()); } return true; } public boolean onQueryTextSubmit(String query) { mStatusView.setText("Query = " + query + " : submitted"); return false; } public boolean onClose() { mStatusView.setText("Closed!"); return false; } protected boolean isAlwaysExpanded() { return false; } }

    Read the article

  • MPMoviePlayerController and status bar in iPad

    - by hgpc
    I want to show a MPMoviePlayerController in a view controller and let the user toggle full screen with the default controls. I'm using the following code in a bare-bones example: - (void)viewDidLoad { [super viewDidLoad]; self.player = [[MPMoviePlayerController alloc] init]; self.player.contentURL = theURL; self.player.view.frame = self.viewForMovie.bounds; self.player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.viewForMovie addSubview:player.view]; [self.player play]; } This works well until the user makes the video full screen, rotates the device and taps on the screen. The status bar is shown in the wrong position, as shown in the screenshot below. http://www.freeimagehosting.net/image.php?be371fe3e8.png What am I doing wrong?

    Read the article

  • jQuery to add vertical scroll bar for a fixed height div container

    - by Michael Mao
    Hi all: This is uni homework so sorry about :my password protected url Please enter usersame as "uts" and password as "10479475", without the wrapper quotes. It it almost completed, please follow simple steps to see where my problem dwells: step1: click on any continent highlighted on world map; step2: click on any city marked on continent map; step3: enter quantity ranging from 1 to 6 into the upper-right table; step4 : there you go, in the table below, once row is equal or greater than 3, then the size of table starts to "overlap" on top of the footer section and continues to grow, which is not what I want. I want to achieve the effect that the table size has a limited max-height, so once actual height exceeds the threshold, then I can have a vertical scroll bar so to "stack up" my table and not to break the overall structure. It turns out that my lazy initial design now gets myself stuck in a problem... Any suggestion and hint on how to get this?

    Read the article

  • iphone custom navigation bar edit button

    - by Sarah
    Hi all, I use custom image for my navigation bar buttons using the following code, that allows me to make custom add button. I want to be able to do the same for the edit button item. UIImage *image=[UIImage imageNamed:@"Plus.png"]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.bounds = CGRectMake( 0, 0, image.size.width, image.size.height ); [button setBackgroundImage:image forState:UIControlStateNormal]; [button addTarget:self action:@selector(add) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.rightBarButtonItem = barButtonItem; [barButtonItem release]; self.navigationItem.leftBarButtonItem = self.editButtonItem; I'm doing this because I want to change the button text color.I would appreciate your help, Sarah

    Read the article

  • iPad SplitView changes main navigation bar color

    - by JustinXXVII
    Weird problem: After rotating my app to portrait, picking the toolbar item and exposing the uipopovercontroller, if I rotate back to landscape, the UINavigationController on the right side (objectAtIndex:0 of the SplitView) changes the color of the navigation bar. I am not sure why. I have it set in Interface Builder to be barStyle = UIBarStyleBlackOpaque; It turns silver after it returns to landscape mode. This only happens if I rotate it to portrait, create the popover, and select something in the navigation controller, which pushes another tableViewController. Even setting the properties in the viewDidLoad method does nothing. Anyone have an idea?

    Read the article

  • $.Ajax send with progress bar using jquery

    - by kamiar3001
    Hi folks I use $.ajax functionality to send data to server and with this method I removed most of postback pages it works but I need some progress bar to show visitors there are some progress now it shows nothing after some second it shows result but i think a message or small picture is need in my web site. How I can implement it with simple jquery code ? something popup and shows the page is in the progress. And also I need to add some other jquery to prevent other click during the progress is it possible ?

    Read the article

  • Javascript: Mediaplayer and its Progress Bar

    - by Geetha
    Hi All, In my asp.net application i am using mediaplayer to paly the audio and video. i am controling volume using javascript code. I want to display a userdefined progress bar. How to create it. Code: <object id="mediaPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" height="1" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="1"> <param name="fileName" value="" /> <param name="animationatStart" value="true" /> <param name="transparentatStart" value="true" /> <param name="autoStart" value="true" /> <param name="showControls" value="true" /> <param name="volume" value="100" /> <param name="loop" value="true" /> </object>

    Read the article

  • log4j.xml show com.foo, but hide com.foo.bar

    - by Bas Hendriks
    Hi, I have the following log4j.xml configuration: <log4j:configuration> <appender name = "CONSOLE" class = "org.apache.log4j.ConsoleAppender"> <param name = "Target" value = "System.out"/> <param name = "Threshold" value = "DEBUG"/> </appender> <category name = "com.foo"> <appender-ref ref = "CONSOLE"/> </category> </log4j:configuration> This displays every log in com.foo.* . I want to disable logging in com.foo.bar.* . How do i do this.

    Read the article

  • iphone tab bar controller and core data.

    - by Sway
    Ok bit of a newbie type question. I want to use Core Data, together with Tab and Navigation controllers. In XCode if I create a Navigation Based Application I get the option to choose Core Data. Whereas If I create a Tab Bar Application I don't get the choice. I understand that Tab Bars display view controllers so it kinda makes sense. However given that by default it sticks the basic Core Data code in the Application delegate I don't see why this isn't offered. At the moment I'm creating the two projects and cutting and pasting between them. Does this omission in XCode seem weird to you? Is it some sort of oversight? Thanks, Matt

    Read the article

  • JNA and ZBar(library for bar code reader)

    - by user219120
    I'm creating Java Interface with JNA for ZBar(library for bar code reader). In JNA, structures in C are needed to declare. For example:: // In C typedef struct { char* id; char* name; int age; char* sectionId } EMPLOYEE; to // In Java with JNA public static class Employee extends Structure { // com.sun.jna.Structure String id; String name; int age; String sectionId; } But in ZBar, structures have no members. For example:: // zbar-0.10/include/zbar.h // line:1009-1011 struct zbar_image_scanner_s; /** opaque image scanner object. */ typedef struct zbar_image_scanner_s zbar_image_scanner_t; That doesn't declare size or members of the structures. How can I write interfaces for these structures in JNA?

    Read the article

  • Outputting a bar chart to an iPhone application?

    - by Moddy
    Right, I really want to output a Bar Graph to an Obj-C iPhone application - now I may be missing a vital SDK class or something; but right now my solution is to embed a WebView and inside that have a JQuery/Flot based graph - not totally ideal I know! Just wondering if anybody has any other creative solutions or whether a WebView/AJAX solution is the way to go? (For the record; my data source will be figures returned from an external source - i.e downloaded from the internet. So I was even toying with having a PHP Proxy/script do all the work on that, return the figures AND a graph to the application - but then I risk placing extra strain on the server!)

    Read the article

  • PowerBuilder Indeterminate Progress Bar

    - by Adam Hawkes
    I have a somewhat-long-running stored procedure being called from a PB application. I want the UI to show an indicator that it is processing, but I don't know the exact progress. That is, I can't say whether it is 10% or 90% done. All I know is when it is done. To give the user something to look at I'd like to put a "Inderterminate" (horizontal) progress bar on the window somewhere. I've looked at the documentation for the built-in HProgressBar control and don't see how to force this behavior. Short of writing my own control or importing another one, is there a way to accomplish this?

    Read the article

  • Scroll bar does not appear in UITableView

    - by user335398
    Hi there, When I create UITableView with UITableViewController, all the right - scroll bar is present on UITableView. But I'd like to place some more controls apart from table on the area, so I have to use UIViewController instead. I create UITableView *tableView as controller's member, and set controller as its delegate conforming to UITableViewDelegate and UITableViewDataSource protocols. All the OK now, except of scroll bars do not appear at all. tableView.showsVerticalScrollIndicator is set to YES. Where might be a problem? Much thanks! WBR, Timur

    Read the article

  • Make Apache to show different index.html also in browser's address bar

    - by Marco Demaio
    I have the following foloder tree on my shared hosting server: www.somesite.com | |_ public_html (document folder) |_ .htaccess (Apache file) |_ inde.html (page shown by server now when someone looks for www.somesite.com) | |_ site_editor (folder) | |_login.html (site editor control panel) | |_file1.php | |_file2.php | |_ ... | |_ website (folder) |_ index.html (website HOME PAGE) |_ page1.html |_ page2.html |_ etc. Now when someone looks for www.somesite.com the webserver look for index.html in public_html folder. I would like the web server to show website/index.html when someone looks for www.somesite.com and I would like his browser bar to show only www.somesite.com/index.html and not www.somesite.com/website/index.html I would also like the web server to show site_editor/login.html when someone looks for www.somesite.com/site_editor/ Is it possible to accomplish both task by setting .htaccess files in some ways??? Thanks!

    Read the article

  • Get twitter bootstrap btn-group to operate like grouped navigation bar with drop down menus

    - by Jeremy Child
    I have been trying to get Twitter Bootstrap btn-group with dropdown to work for multiple buttons that have a drop down menu. Example: <div class="btn-group"> <a href="#" class="btn">1</a> <a href="#" class="btn">2</a> <a href="#" class="btn">3</a> <a href="#" class="btn">4</a> <a href="#" class="btn">5</a> </div> And also my attempt: http://jsfiddle.net/x2BGB/ This displays a button group. I would like some of the buttons in that group to have drop down menus. An example of what I am trying to achieve is: Note: the grouped button "bar" should not have rounded cornes when a button is next to another button. (right side).

    Read the article

  • How can I block based on URL (from address bar) in a safari extension

    - by PerilousApricot
    I'm trying to write an extension that will block access to (configurable) list of URLs if they are accessed more than N times per hour. From what I understand, I need to have a start script pass a "should I load this" message to a global HTML page (who can access the settings object to get the list of URLs), who will give a thumbs up/thumbs down message back to the start script to deny/allow loading. That works out fine for me, but when I use the usual beforeLoad/canLoad handlers, I get messages for all the sub-items that need to be loaded (images/etc..), which screws up the #accesses/hour limit I'm trying to make. Is there a way to synchronously pass messages back and forth between the two sandboxes so I can tell the global HTML page, "this is the URL in the window bar and the timestamp for when this request came in", so I can limit duplicate requests? Thanks!

    Read the article

  • C# ProgressBar design pattern

    - by MadSeb
    Hi, I'm working on a database upgrader application. The upgrader updates the schema of a database ( adds new columns, renames columns , adds new tables, new views to an existing database by executing SQL statements ). When a user wants to upgrade from version 1.0 to 2.0 , "Upgrader" objects are taken from an object factory and the "Execute" method of each "Upgrader" is called. The GUI of the application has a progress bar and each time an upgrader object performs a SQL statement the progress bar gets incremented. while (!version.Equal(CurrentVersion)) { IUpgrader myUpgrader = UpgraderFactory.GetUpgrader(version); myUpgrader.Execute(UpgradedFile,progressbar); version.Increment(); } My question is very simple : how should the upgrader object communicate with the progressbar. In the code above, the upgrader object is given direct access to the progressbar but I'm wondering if some better way of doing this or better design pattern exists. Regards, Seb

    Read the article

  • Possible to do rounded corners in custom Progressbar progressDrawable?

    - by b-ryce
    I have a progress bar that is supposed to look like the attached image: And I've made it a long way. I'm very close the only part that isn't working is the rounded corners for the progressDrawable. Here is what mine looks like. (Notice, circled in red, that the fill inside the white outline does not have rounded corners): So, I've found a couple of ways to make this work when the progress bar is colored in with a shape, gradient, or color. BUT, I can't get it with an image as the progressDrawable. Here is my class that extends ProgressBar public class RoundedProgressBar extends ProgressBar{ private Paint paint; public RoundedProgressBar(Context context) { super(context); setup(); } public RoundedProgressBar(Context context, AttributeSet attrs) { super(context, attrs); setup(); } public RoundedProgressBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setup(); ; } protected void setup() { paint = new Paint(); } @Override protected synchronized void onDraw(Canvas canvas) { // First draw the regular progress bar, then custom draw our text super.onDraw(canvas); paint.setColor(Color.WHITE); paint.setStyle(Paint.Style.STROKE); RectF r = new RectF(0,0,getWidth()-1,getHeight()-1); canvas.drawRoundRect(r,getHeight()/2,getHeight()/2, paint); } } Here is my selector: <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/background" android:drawable="@drawable/slider_track" /> <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/slider_track" /> <item android:id="@android:id/progress" android:drawable="@drawable/slider_track_progress" /> </layer-list> Here are the images used in the selector: slider_track- slider_track_progress- Here is where I embed my progressbar in the layout for my activity <com.android.component.RoundedProgressBar android:id="@+id/player_hp_bar" android:layout_width="fill_parent" android:layout_height="36dip" android:layout_marginLeft="30dip" android:layout_marginRight="30dip" android:max="100" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/slider_layer_list" android:progress="20" android:maxHeight="12dip" android:minHeight="12dip" /> Anyone know how to make this work?

    Read the article

  • ShareThis causing "Transfering Data From" in Firefox status bar

    - by JackIT
    There is a conflict with the ShareThis script and another script I have on my site. I've set up a test example here: http://jbrlsr.com/help.html to reproduce the issue, use FireFox and mouseover a few of the links, you'll notice "Transferring Data From" in the status bar area. To clear that message click on the ShareThis icon. There is one post I've found on the ShareThis Forums: forums.sharethis.com/topic.php?id=2415#post-4199 but no resolution. If you can pinpoint the issue and suggest a realistic/workable resolution I will PayPal you $100.

    Read the article

  • Slide in the second tab bar view by clicking on item in the first

    - by Henrik Erlandsson
    I have an app with three tabs that switch views instantaneously when the user taps them. The first view is a table view selecting which 'location type' to filter by, to only show those pins (add those annotations) to the second view, a MapView. When a table cell is clicked, it switches instantaneously to the mapview, using this code: self.tabBarController.selectedIndex=1; However, I would like to do this with a slide-in-from-right animation, like the one you get when drilling down a hierarchy of table views. I tried this: [self.navigationController pushViewController:[self.tabBarController.viewControllers objectAtIndex:1] animated:YES]; which compiles without error or warning, but does not switch views. How do I 'apply' a navigation controller 'onto' a tab bar controller? Or is there some way to select another viewcontroller and specify an animation?

    Read the article

  • White bar at the bottom of root view!

    - by Sam
    Hi, I have two view controllers in the app. When the app starts, the layout of the root view controller's view is just fine. When a button is clicked, the view controller switches to the other one - which shows fine too. However, when the view is switched back to the root view, the contents are shifted UP by about 20 pixels, leaving a white bar at the bottom! - and it was not there when the app had started. Has anyone seen this? Any idea what's going on there? Thanks, Sam.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >