w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Changing tableView Cell Image on selection shows multple selected cell images
If you're writing for iOS 5.0 and up, you can appeal to allowsMultipleSelection if you have this setup well. Set this to NO. Otherwise, use –deselectRowAtIndexPath:animated: say to clear the first selection. Call either of these in your implementation of -tableView:didSelectRowAtIndexPath:.

Categories : Iphone

Building custom mp3 player for website - can't figure out how to write play last song, play next song functions
This is fully working code (for compatibility with old browsers you can use some flash fallback): HTML: <div class="mp3Player"> <audio id="music"></audio> <a id="last" class="last" class="button">◄◄</a> <a id="play" class="play" class="button">►</a> <a id="pause" class="pause" class="button">ll</a> <span id="info"></span> <a id="next" class="next" class="button">►►</a> </div> JS: function run() { var i = 0; // current song index var songList = [ 'a.mp3', 'b.mp3', 'c.mp3', 'd.mp3']; var audiocontainer = document.getElementById('mp3Player'); var ae = document.getElementById('music'); ae.src = songList[0]; var info

Categories : Javascript

Populating table from array only shows up on the first cell
I am not sure that I understand what you mean by: I am sending all the strings in one combined string then populating an array with it. Do you mean that you wish to split the string that contains all substrings and make an array out of it? From what I get from your code, you take the concatenated string, where all values are separated by spaces and you store it as the first element of an array: destination.arrayToBePopulatedString = [myStrings componentsJoinedByString:@" "]; ... [bostonArray addObject:arrayToBePopulatedString]; This simply adds the complete string in the array. If you want to split the concatenated string back into an array, you should probably use something like bostonArray = [[destination.arrayToBePopulatedString componentsSeparatedByString: @" "] retain];

Categories : Iphone

iOS UITableView shows content of an old custom cell after reload but selecting it pushes to correct data
You can try this , [tableView reloadData]; You can write this in cellForRowAtIndexPath BANFCell *cell = (BANFCell *)[tableView dequeueReusableCellWithIdentifier:nil forIndexPath:indexPath];

Categories : IOS

How can I tell when `hg push` failed (as opposed to "no changes")
As @iamnotmaynard indicated in the comments, hg push exits with 255 for errors. So you can do something like this set +e hg push -R $repo status=$? set -e if [[ ! "01" =~ $status ]]; then exit 1 fi It still makes no sense to me, but moving on.

Categories : Bash

list.getchildAt(i) return null pointer ,only shows visible views not shows more
I guess you should think fo a better approach than iterating over the EditTexts with getChildAt() to collect all the value. I take it that the user can change the values in the EditTexts, you can have an Array of size 30 of Values and everytime the user enters / changes a value you change the according value in the Array. Use a listener that changes the values in your Array like this.

Categories : Android

My horizontal navigation menu shows as 1 line in chrome, others shows 2 lines
you are aware that in: .mainnav ul li a:link,.mainnav ul li a:visited there are double padding decalarations? padding:4px; padding: 0 0.73em; You can combine those: padding: 4px 0.73em; Seems that the issue with the navigation list is that there is too much spacing in between them in combination with the amount of items. I there are too much items, the normal behavior is the wrapping, you could decrease spacing, font-size to fix this.

Categories : HTML

My hibernate application shows message in console and shows session closed error on browser
At first look it seems like a possibility of 2 issues ContactManager object which you are trying to save is null Your variable name 'Contact' is incorrect, it should be 'contact' (some hibernate thingy) Where is your hbm.xml file ? There may be a reference of 'Contact' the class in that file still around somewhere Edit Solutions Put a if (developer != null) before your 'save(developer)' Rename Contact to contact Put the hbm file contents on the question, without that cant review the mapping Hope it clear now. Edit 2 : Do a clean build. Its possible your build is not updated.

Categories : Hibernate

Why use Core Api of dropbox as opposed to Sync API
The Core API is designed to work with server-side apps. The Sync API is specifically designed to work with mobile clients, has SDK's for iOS and Android and is much simpler and easier to use. Sync API's do not support the more advanced features of Core API's such as full permissions, file revisions etc. But for simple file syncing and retrieval purpose like yours, Sync API's are perfect.

Categories : Android

Using the git api to list get unmerged as opposed to merged?
If you simply are looking for a way to discern the difference between two branches you can use the Repository > Commits > Compare two commits part of the API. In the hash returned to you, you simply need to grab the list of files and you'll have your files which were changed.

Categories : GIT

Is it possible to register and log in my users with the Soundcloud API as opposed to just connecting to it?
I've done this with IMGUR OAuth2 API. After you get the access token, make a new request to their /me endpoint. This way, you'll have the SoundCloud id for that particular user. Now you can check if you already saved this user in your database. If you have, just save the new token to make sure this user has granted your app access to their SoundCloud. I'm not sure if I were clear enough. Let me know if you need any further help .

Categories : PHP

Java - naming convention for can-do interface as opposed to can-be-done-to
It is common to use agent nouns or noun phrases for classes and interfaces that do things to other objects: Serializer ClassLoader

Categories : Java

substr cut text end of sentence as opposed to end of word
Shortening HTML text is not so simple. Sure would like to have the actual length of text, not the text with HTML tags. In your example, 25 characters occupy <p> <ul> <li>. But let's leave it at the end. The best solution would be a two-stage operation. Find '. ' and 2: close tags. $description_excerpt = preg_replace('/(.)s+[^.]*$/', '1', substr($description_excerpt, 0, 200)); preg_match_all('/<(?P<close>/)?(?P<tag>w+)(?P<atr>[^>]*)>/', $description_excerpt, $m, PREG_SET_ORDER); print_r($m); Now you just have to see which tags require closing. I recommend queue using array_shift and array_unshift. (and remember, the tags that do not require closure) If you want to be closer to the exact l

Categories : PHP

Why is this Fizzbuzz program failing with 100 numbers as opposed to 25?
while numCount < 100: means while numCount is less than 100. If numCount == 100 or a higher number, the while loop will not run. Did you mean <=? <= is the operator for "is less than or equal to".

Categories : Python

Making a DIV expand with content as opposed to scroll
remove overflow: auto; from all your classes. They should expand with what is inside them on their own. http://jsfiddle.net/BGLMJ/4/

Categories : HTML

String variable shows as empty but length shows it to not be
.NET uses BStrings, which are length-prefixed and null-terminated. So if the first character in RecievedString is the null character (''), then it will not be printed, since strings end at their first null character.

Categories : Vb.Net

Is there any way to get a macro or module to change the copy destination cell from one cell to another cell in the next row with each run?
In order to do that, you can do it a couple of different ways: Method 1 In your macro, you will need code that counts how many sheets exist in the workbook. Then use that number to determine what cell on Sheet1 should be copied to cell B10 on the new sheet. This method has some pitfalls if you have other sheets in your workbook. Method 2 Store the row number of the cell you want to copy in a cell somewhere on Sheet1. Every time your macro runs, retrieve that value to determine which cell to copy to the new sheet, then increment that value, so the next time the macro runs, it will get the next cell. This method is probably the most straight-forward, but you need to make sure that you don't accidentally erase or alter the cell containing your current row number.

Categories : Excel

Any reason not to use Redis 32bit (as opposed to 64bit) except for the 4GB limit?
Using multiple 32 bits Redis instances generally works well. There are a few drawbacks you need to consider though: most people run the 64 bits version, so the 32 bits version is much less tested and deployed. It makes it less reliable, since it increases the probably you hit an undetected bug. some operations are less efficient in 32 bits. For instance the BITOP, BITCOUNT operations should be more efficient when they run on a 64 bits CPU. it is difficult to set a memory limit. Setting the maxmemory parameter is tricky because you also have to consider more than the size of your data (but also internal communication buffers , master/slave replication buffers, I/O buffers, etc ...). If you are too optimistic (i.e. if you have set maxmemory too close to 4 GB), you will have random crash wh

Categories : Ubuntu

Can I get couchbase to work in class library as opposed to just my webapp
Without knowing more about your specific error it's hard to say. Your class library, if referenced correctly, would live with the web app and so you would not need the app.config, the details in web.config should suffice: the section declaration and the couchbase section populated with your database details. Check also if the library is setup to use the full .net version as it cannot run under the ".NET Framework Client Profile". Personaly I would create another project for your data access layer and have your web app and domain library access it, you will have a better design that way and avoid having 2 instances of couchbase client which is not recommended.

Categories : C#

How to detect navigation in TWebBrowser as opposed to clicking URLs?
Please note that the following is undocumented. Some people say and it works for me (on Windows 7 64-bit, with Internet Explorer 10) to check for a magical constant of the Flags parameter. If the Flags parameter of the OnBeforeNavigate2 event equals to 64, it was the user, who navigated through the link. If the Flags parameter equals to 0, it was the IWebBrowser2::Navigate method, who invoked the navigation. In code it would be: procedure TForm1.WebBrowser1BeforeNavigate2(ASender: TObject; const pDisp: IDispatch; const URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool); begin if (Flags and navHyperlink) = navHyperlink then ShowMessage('User clicked a link...') else ShowMessage('IWebBrowser2::Navigate has been invoked...'); end; I wouldn't b

Categories : Delphi

give a crawler pure html as opposed to trigger ajax
Google has specifications on this utilizing hashbangs (#!). See here: http://moz.com/blog/how-to-allow-google-to-crawl-ajax-content Also note that <noscript> is an option, although PHP inserted will be transmitted regardless of JavaScript. Finally, there are the general principles of Progressive Enhancement. Make your page fully functional without AJAX: pagination with actual links, PHP insertion of results, etc. Then if JavaScript is available, hijack the links to pull in content without navigating away from the page.

Categories : HTML

How to let a user select quantity on website as opposed to on the shopping cart
You can create a text box or drop down to allow the buyer to select the quantity. Then you would just populate the value into the variable "quantity" and pass it over with the rest of your variables. You dont need to pass it over using the variable "on0".

Categories : PHP

Opening a document in PDF as opposed to Word with code on a button click
I cannot say for certain, but I am going to assume you're trying to save your data as a pdf and have it open in whatever application the system uses to read pdf files? //Note the change from application/msword to application/pdf Response.AppendHeader("Content-Type", "application/pdf; charset=utf-8"); Make sure to change the mime type as well as the doc ending (See here for full list of mime types): That being said, I cant guarantee it will open properly in your PDF reader

Categories : C#

Find value from one cell, copy value from cell near to that cell and paste it to another sheet
Use a VLOOKUP along with an IFERROR. =IFERROR(VLOOKUP(A1, Sheet1!A:B, 2, 0), "") This will do what you described (well described, by the way!) in your question. Drag the formula down in Sheet2 till the bottom. VLOOKUP takes the value of A1 in sheet 2 (no sheet reference because the value is in the same sheet as the formula) and looks it up in column A of Sheet1. It returns the second value (hence why 2) of the table selected in the formula (column A is 1, column B is 2). The 0 tells the VLOOKUP to look for exact matches. You don't need approximate match here. And IFFERROR is there in case VLOOKUP doesn't find anything (like with ada) and instead of giving #N/A, returns an empty cell, "".

Categories : Excel

Why does UpdateView need to have model/queryset/get_queryset defined when using form_class as opposed to CreateView?
Currently (django 1.5.1 official release) UpdateView is calling self.get_object() to be able to provide instance object to Form. From https://github.com/django/django/blob/1.5c2/django/views/generic/edit.py#L217: def get(self, request, *args, **kwargs): self.object = self.get_object() return super(BaseUpdateView, self).get(request, *args, **kwargs) def post(self, request, *args, **kwargs): self.object = self.get_object() return super(BaseUpdateView, self).post(request, *args, **kwargs) And self.get_object method needs one of this properties declared: model, queryset or get_queryset Whereas CreateView don't call self.get_object(). From https://github.com/django/django/blob/1.5c2/django/views/generic/edit.py#L194: def get(self, request, *args, **kwargs): self.obje

Categories : Django

Check whether application is running under Terminal Services as opposed to Remote Desktop
One way is to use the below code: string s = System.Environment.GetEnvironmentVariable("SessionName"); If the value of s is "Console", it could be running in terminal services. On the other hand, if the value is something like "RDP-Tcp#01", it is running under Remote Desktop.

Categories : C#

WP7 how to get current song
to play a song MediaPlayer.Play(SongCollection songs); MediaPlayer.Play(SongCollection songs,int index); and to get songs MediaLibrary mLibrary = new MediaLibrary(); songs = mLibrary.Songs; to check current state if(MediaPlayer.State == MediaState.Playing || MediaPlayer.State == MediaState.Paused) and to check active song Microsoft.Xna.Framework.Media.MediaPlayer.Queue.ActiveSong.Name;

Categories : C#

How to play a song when mouseover?
You need to declare your soundChannel variable with the var keyword. Try adding this near the top of your file, after your import statements. var soundChannel:SoundChannel;

Categories : Actionscript

Regex get song h:m:s when h and m is optional
The following seems to work for all of your examples, replace matches of: (.*?) (d+:)?(d+):(d+) with: the song "$1" is $3min and $4sec

Categories : Regex

Play specific song
You don't have to do this by looping through all the items in the library. It can be done via MPMediaQuery, something like this: NSNumber *persistentIDNumber = [NSNumber numberWithInteger:4238475234]; MPMusicPlayerController *player = [MPMusicPlayerController applicationMusicPlayer]; MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:persistentIDNumber forProperty:MPMediaEntityPropertyPersistentID]; MPMediaQuery *query = [[MPMediaQuery alloc] init]; [query addFilterPredicate: predicate]; [player setQueueWithQuery:query]; [player prepareToPlay]; [player play];

Categories : IOS

Resume song in Android
To prevent this you should use a service for playing sounds while your activity goes to background. Refer to the android's documentation about the life-cycle of an activity to see what actually happens: https://developer.android.com/training/basics/activity-lifecycle/index.html

Categories : Java

Getting song meta data
First, you can download the mp3 file to local using this: WebClient Client = new WebClient (); Client.DownloadFile("http://myserver.com/indie/band1.mp3", "band1.mp3"); Then, use TagLibSharp https://github.com/mono/taglib-sharp //Local reference to the file TagLib.File file = TagLib.File.Create("band1.mp3"); //Get the file metadata Console.WriteLine("Tags on disk: " + file.TagTypesOnDisk); Console.WriteLine("Tags in object: " + file.TagTypes); Write ("Grouping", file.Tag.Grouping); Write ("Title", file.Tag.Title); Write ("Album Artists", file.Tag.AlbumArtists); Write ("Performers", file.Tag.Performers); Write ("Composers", file.Tag.Composers); Write ("Conductor", file.Tag.Conductor); Write ("Album", file.Tag.Album); Write ("Genres", file.Tag.Genres); Write ("BPM", file.Tag.BeatsPerMin

Categories : C#

How to add a song progress bar in SoundManager2?
The logic seems to be fine - what you need to is to call the modify width snippet while the track is playing, using the whileplaying method (I think): soundManager.setup({ url: '/swf', preferFlash: false, waitForWindowLoad: true, onready: function() { var myTrack1 = soundManager.createSound({ id: 'trackOne', url: 'msamples/beep-1.mp3', volume: 80, autoPlay: false,}); $("li.a5 a").click(function(event){soundManager.play('trackOne');}); }, whileplaying: function() { $(".progBar").css('width', ((this.position/this.duration) * 100) + '%'); }, ontimeout: function() { // Uh-oh. SWF missing, Flash blocked or other issue } });

Categories : Javascript

I want to move the value from Cell B to Cell C if Cell A values is changed
Private Sub Worksheet_Change(ByVal Target As Range) CR = Target.Address SplitCR = Split(CR, "$") CC = SplitCR(1) CR = SplitCR(2) If CC = "A" Then CellBValue = Range("B" & CR) CellCValue = Range("C" & CR) Range("B" & CR).Value = CellCValue Range("C" & CR).Value = CellBValue End If End Sub Paste the above code in your sheet.

Categories : Excel

JSON Serialization song information
For every MPMediaItem, create an NSDictionary with key/value pairings equivalent to title, artist, etc. Then add each one to a mutable array. Finally, serialize the array to JSON. For example: NSMutableArray *mutableSongsToSerialize = [NSMutableArray array]; NSArray *songs = [playlist items]; for (MPMediaItem *song in songs){ NSString *title =[song valueForProperty: MPMediaItemPropertyTitle]; NSString *artist =[song valueForProperty: MPMediaItemPropertyAlbumArtist]; NSString *album =[song valueForProperty: MPMediaItemPropertyAlbumTitle]; NSString *length =[song valueForProperty: MPMediaItemPropertyPlaybackDuration]; NSDictionary *songDictionary = @{@"title": title, @"artist": artist, @"album":album, @"length":length}; [mutableSongsTo

Categories : IOS

How to get the volume of a playing song continuously?
have you try this : value = audioManager.getStreamVolume(audioManager.STREAM_MUSIC); and this is the info link http://developer.android.com/reference/android/media/AudioManager.html

Categories : Android

Using RegEx in VB.Net to get song information from filename
I believe this will work for you: ^(?<drive>[^:]+):\(?<folder>Music)\(?<subfolder>[^\]+)\(?<group>[^(]+)\((?<year>[^)]+))s+(?<album>[^\]+)\(?<track>[^.]+).s*(?<artist>.+?) - (?<title>[^.]+).mp3$ Breaking it down for an explanation: ^ 'start of string (?<drive>[^:]+) 'named capture group "drive", captures any character except : :\ 'finds : followed by "" ("" has to be escaped to be a literal "", so \ is needed here) (?<folder>Music) 'named capture group "folder", captures Music \ 'finds "" (?<subfolder>[^\]+) 'named capture group "subfolder", captures any character except "" \ 'finds "" (?<group>[^(]+)

Categories : Regex

playing a song on another device using bluetooth
GameKit is meant for inter-device games. For this, you'd probably want to look at CBPeripheralManager or CBCentralManager depending on the device you're interacting with. It's lower level, so you'll have to do more work to set up the connection, but there's tons of tutorials and sample code to help you out.

Categories : Iphone

How to identify AVAudioPlayer is streaming the song
Your problem is this: NSData *data = [NSData dataWithContentsOfURL:url]; This is one of the worst possible ways to download data on iOS, for a number of reasons. Firstly, it's synchronous, so if you're calling it on the main thread it's a blocking operation (meaning your entire UI will freeze). What only takes a few seconds on a fast WiFi connection could take a minute or longer on a cellular connection. It's also bad because it doesn't provide you with any sort of progress or status update. If the download fails you won't know why it's gone wrong. You'll be in the dark as to whether it's your user's network connection, the server, something completely different... So even if you were running dataWithContentsOfURL on a background thread, it's still far from ideal since it doesn't provi

Categories : IOS

How I get the song of image using MediaPicker iPhone
try this: NSMutableArray *arr = [NSMutableArray arrayWithArray:mediaItemCollection.items]; for (int i =0; i<=[arr count]-1; i++) { MPMediaItem *selectedSong = [[mediaItemCollection items] objectAtIndex:i]; titleString = [selectedSong valueForProperty:MPMediaItemPropertyTitle]; MPMediaItemArtwork *artWorkItem = [selectedSong valueForProperty:MPMediaItemPropertyArtwork]; UIImage *coverImage = NULL; if(artWorkItem) coverImage = [artWorkItem imageWithSize:CGSizeMake(100, 100)]; if(coverImage) myImageView.image = coverImage; else { NSLog(@"No album Artwork!!!"); myImageView.image = [UIImage imageNamed:@"default"]; } }

Categories : Iphone



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.