w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
C++ Bubble Sorting and Selection Sorting
#include <iostream> #include <string> #include <iomanip> using namespace std; void sortArray (int [ ], int ) ; void showArray (int [ ], int ) ; int count = 0; int main () { const int SIZE = 6; int values[SIZE] = {7, 2, 3, 8, 9, 1} ; cout << "The unsorted values are: "; showArray (values, SIZE) ; sortArray (values, SIZE) ; cout<< "The sorted values are: " ; showArray (values, SIZE) ; return 0; } void sortArray (int array [ ], int SIZE) { int temp; bool swap; do { swap = false; for (int count = 0 ; count < (size - 1 ) ; count ++) { if (array [count] > array [count + 1] ) { temp = array [count] ; array [count] = array [count + 1] ; array [count + 1] = temp ; swap = true ; count++; dispCount(); } } } while (swap) ; } void dispCount(){ cout <<

Categories : C++

Trouble bubble sorting (recursion) an array of integers in Java
Your algorithm moves the smallest value to the start of the array each time, then ignores the last element on subsequent calls. Unfortunately the last element isn't guaranteed to be the largest. One way to fix it might be to initialise index to arr.length - 1, and continue the loop while index > arr.length - n.

Categories : Java

Bubble Chart in ZingChart library: Making Bubble size scale independent of y-axis value
I'm on the team here at ZingChart. There is an attribute you can use to adjust the bubble radius that is not dependent on "scale-y":{}. Here is some code that will be helpful. { "type":"bubble", "plot":{ "max-size":200 */the "max-size": attribute accepts numeric values and will adjust the radius of the bubbles independently from the y axis values/* }, "scale-y":{ "values":"0:20:5", }, "series":[ { "values":[[1,15,4], [2,4,2], [5,10,1], [6,7,3], [3,6,2], [7,15,1], [8,2,4], [1,7,3], [2,12,3], [4,4,4], [5,1,2], [6,3,1], [8,16,2]] }, { "values":[[3,5,1], [2,17,2], [8,8,3], [4,6,2], [7,3,4], [2,12,1], [1,4,1]

Categories : Misc

Defining Multiple Comparators for Sorting and Reverse Sorting Appcelerator Backbone Models
To sort in descending order for strings(case insensitive) or just numbers, try this: var sort_descending = false; /* assuming you are able to set this variable when you need to sort */ var sort_attribute_name = "title"; /* assuming you can set the attribute name on which you want to sort */ book_list.comparator = function(book){ /* book_list is an instance of book_collection */ if(sort_descending){ if(isNaN(book.get(sort_attribute_name)){ var str = book.get(sort_attribute_name); str = str.toLowerCase(); str = str.split(""); str = _.map(str, function(letter){ return String.fromCharCode(-(letter.charCodeAt(0))); /* from an SO answer*/ }); } return -book.get(sort_attribute_name); } return book.get(sort_attribute_name); };

Categories : Sorting

CUDA parallel sorting algorithm vs single thread sorting algorithms
Sorting is an operation that has received a lot of attention. Writing your own sort isn't advisable if you are interested in high performance. I would consider something like thrust, back40computing, moderngpu, or CUB for sorting on the GPU. Most of the above will be handling an array at a time, using the full GPU to sort an array. There are techniques within thrust to do a vectorized sort which can handle multiple arrays "at once", and CUB may also be an option for doing a "per-thread" sort (let's say, "per thread block"). Generally I would say the same thing about CPU sorting code. Don't write your own. EDIT: I guess one more comment. I would lean heavily towards the first approach you mention (i.e. not doing a sort per thread.) There are two related reasons for this: Most

Categories : Sorting

How to fix the css red notification bubble
Position your badge with left instead of right: .noti_bubble { position: absolute; top: 2px; /* this will anchor your badge from its left-hand edge at the midpoint of your icon */ left: 8px; background-color: red; color: white; font-weight: bold; font-size: 14px; border-radius: 2px; }

Categories : CSS

How to create Bubble map
Tags and menus have tree structure as you need. Maybe you can use some of those? Or do a custom hierarchy by using node reference field type. I.e. every node of your content type would have some "Parent" field of node reference type..

Categories : PHP

JS object sorting date sorting
Both console.log show the same array because when you use console.log(sortable), sortable is passed by reference, and console output happens AFTER finishing your script - when sortable has been already sorted. Making your code simple: var arr = [3,2,1]; console.log(arr); // Produces `[1,2,3]` because its printed // to the console after `arr.sort();` arr.sort(); console.log(arr); // Produces `[1,2,3]`, as expected Demo: http://jsfiddle.net/Rfwph/ Workaround If you want to be able to do console.log with an array to see it before being modifyed, you can use .slice(0) to copy the array, i.e. to obtain another array which contains the same elements as your array. var arr = [3,2,1]; console.log(arr.slice(0)); // [3,2,1] arr.sort(); console.log(arr); // [1,2,3] Demo:

Categories : Javascript

Bubble Chat layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/background" android:layout_width="wrap_content" android:layout_height="fill_parent" <!-- android:layout_gravity="left" --> android:orientation="horizontal"> <ImageView android:id="@+id/avatar" android:layout_width="32dip" android:layout_height="32dip" android:layout_marginRight="4dip" android:src="@drawable/controller" /> <TextView android:id="@+id/text" android:text="asd" android:textColor="#FFFFFF" android:

Categories : Android

CSS3 - top notification bubble
See this fiddle. CSS: .outer { width:103px; height:113px; display:inline-block; padding:5px; margin:25px 14px 15px 14px; font-size: 14px; font-weight:bold; color:#8E9FA9; text-transform: uppercase; border:1px solid #cccece; text-align:center; background-color:#f8f8f8; letter-spacing: -0.06em; -webkit-text-shadow: #ffffff 1px 1px; moz-text-shadow: #ffffff 1px 1px; text-shadow: #ffffff 1px 1px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; -webkit-box-shadow: 0 3px 2px 1px rgba(0, 0, 0, 0.03); -moz-box-shadow: 0 3px 2px 1px rgba(0, 0, 0, 0.03); box-shadow: 0 3px 2px 1px rgba(0, 0, 0, 0.03); } .outer:hover { color:#7D878E !important; -webkit-box-shadow: 0px 3px 2px 1px rgb

Categories : HTML

using VBA for a pie bubble chart in excel
The simplest route will be to just change the theme colors before you copy each chart. Recorded macro will give you something like this (for Excel 2010 on Windows 7), I choose just two, but you could use any number of them, or you could create your own custom themes to use, too: ActiveWorkbook.Theme.ThemeColorScheme.Load ( _ "C:Program Files (x86)Microsoft OfficeDocument Themes 14Theme ColorsApex.xml" _ ) ActiveWorkbook.Theme.ThemeColorScheme.Load ( _ "C:Program Files (x86)Microsoft OfficeDocument Themes 14Theme ColorsEssential.xml" _ ) To replicate these, turn on your macro recorder, and then select a few color schemes from the Ribbon (Page Layout | Colors). I think this should work for Excel 2007+, although the file path will be different for 2007 than it is in my ex

Categories : Excel

relative css only speech bubble
you have useful this css /* Bubble with an isoceles triangle ------------------------------------------ */ .triangle-isosceles { position:relative; padding:15px; margin:1em 0 3em; color:#000; background:#f3961c; /* css3 */ -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; background:-moz-linear-gradient(top, #f9d835, #f3961c); background:linear-gradient(top, #f9d835, #f3961c); } /* creates triangle */ .triangle-isosceles:after { content:""; display:block; /* reduce the damage in FF3.0 */ position:absolute; bottom:-15px; left:50px; width:0; border-width:15px 15px 0; border-style:solid; border-color:#f3961c transparent; }

Categories : CSS

PyQt sms bubble widget
This example shows how to custom paint in an overloaded QLabel. Set a different pen/brush on the painter in the paintEvent to change the color of the bubbles. from PyQt4 import QtCore, QtGui class Bubble(QtGui.QLabel): def __init__(self,text): super(Bubble,self).__init__(text) self.setContentsMargins(5,5,5,5) def paintEvent(self, e): p = QtGui.QPainter(self) p.setRenderHint(QtGui.QPainter.Antialiasing,True) p.drawRoundedRect(0,0,self.width()-1,self.height()-1,5,5) super(Bubble,self).paintEvent(e) class MyWidget(QtGui.QWidget): def __init__(self,text,left=True): super(MyWidget,self).__init__() hbox = QtGui.QHBoxLayout() label = Bubble(text) if left is not True: hbox.add

Categories : Python

Bubble Sort Algorithm in C
void sortArray (int arr[], int size) { int num, number, d; for(num=0;num<size-1;num++) { for(d=0; d<size-num-1; d++) { number=d+1; checkBigger(arr, d, number); } } }

Categories : C

Qt - Pop up a bubble when mouse is over QRect object
Unfortunately QPainter can't do that for you, the drawText(..) flags don't support it. Thankfully, you can pre-elide the text for it ("eliding" is where you truncate with an elipsis) using QFontMetrics: QFontMetrics fontM( QApplication::font() ); QRect r( 0, 0, 30, 10 ); QString text = "Longlonglonglong"; QString elidedText = fontM.elidedText( text, Qt::ElideRight, r.width() ); painter->drawText( r, Qt::AlignLeft, elidedText ); When you say "text in a bubble when mouse pointer is over", I presume you mean a tooltip - in which case implement it for the widget as normal and give the full text rather than the elided.

Categories : C++

Dealing with Bubble Chart overlap
Unfortunately we have no solution for controling positions of the bubbles. But you can request your propositin in our uservoice system http://highcharts.uservoice.com/

Categories : Highcharts

notification bubble badge in ajax
You want something like that? Here is the css & jquery solution, if you like. DEMO http://jsfiddle.net/yeyene/DfSda/1/ Add <span class="ballons"></span> inside your button, and replace the dynamic count value. .ballons { float:right; margin:-20px 8px 0 0; line-height:30px; padding:0 10px; border-radius: 30px; border:3px solid #fff; border-radius: 30px; -moz-border-radius: 30px; -webkit-border-radius: 30px; -ms-border-radius: 30px; -o-border-radius: 30px; background:red; color:#fff; text-align:center; -moz-box-shadow: 1px 1px 3px 3px #ccc; -webkit-box-shadow: 1px 1px 3px 3px #ccc; box-shadow: 1px 1px 3px 3px #ccc; }

Categories : PHP

How to add AdMob to a Frozen Bubble like game?
You never called setContentView with your layout file. As a result, AdView adview = (AdView)findViewById(R.id.adView); will return null, and adview.loadAd(re); will crash. Attach your layout file to your activity prior to calling findViewById.

Categories : Android

How to align a speech bubble with an image
You might be better off setting the speech bubble to display: relative; and controlling the top and left properties to position the bubble exactly where you want it on the image: <blockquote class="oval-thought" style="position: relative; top: 250px; left: 150px;"><p>yay</p></blockquote> <img src="http://th00.deviantart.net/fs70/PRE/f/2010/310/7/4/super_sonic_sa2_by_mephilez-d329bcu.png" height="600" width="400"/>

Categories : HTML

Sort out Bubble with Jquery Effect
You can manually trigger mouseover event by calling: $(".box").trigger("mouseover"); After all the handlers are applied. Demo

Categories : Jquery

bubble up events and html/dom structure?
it's just called event bubbling or event propagation, the direction does not really matter... But it's often called bubble up because they represent the tree in the following way: document div table tr td button p div p span and thus like that, it bubbles 'up' again.... until it reaches the root. Note how the tree representation follows how you actually write the HTML structure itself.

Categories : Javascript

WPF if sizechanged event does not bubble, does it tunnel?
There is actually 3rd routing strategy. Direct events which neither bubble nor tunnel and are raised only by one control and FrameworkElement.SizeChanged is exactly one of these events.

Categories : C#

speech bubble pointer missing
Add this to the CSS: #box { position: relative; } The elements which have a position absolute will only be positioned with respect to the closest parent which also has a position other than the default (static) or if none of the parents have a non-static position, then the position is determined wrt the viewport. I suspect when an element is animated, the browser doesn't treat is as a statically positioned object anymore.

Categories : HTML

How to add a Bubble Notification to a WordPress plugin?
If you had researched for "bubble" at WordPress Answers, you'd have found, if not a solution, very good hints. From this Answer, an adapted example to add 10 to Advanced Custom Field plugin menu. Check the code comments: add_filter( 'add_menu_classes', 'add_plugin_bubble_so_17525062'); function add_plugin_bubble_so_17525062( $menu ) { $pending_count = 10; // Use your code to create this number foreach( $menu as $menu_key => $menu_data ) { // From the plugin URL http://example.com/wp-admin/edit.php?post_type=acf if( 'edit.php?post_type=acf' != $menu_data[2] ) continue; $menu[$menu_key][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n($pending_count) . '</span&g

Categories : PHP

:before element not displaying outside div speech-bubble
If you have overflow: hidden on the image element, nothing will be shown outside of it. That's what hidden does. You can: Remove the overflow: hidden, and change the image to a sized div element, and use the image as a background image, or Wrap the image in another element, and apply the :before styling to the wrapper element

Categories : HTML

Speech bubble background for arrow as well
is this similar to what you wanted? .bubble { position: relative; width: 250px; height: 120px; padding: 0px; background: #FFFFFF; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background: url(border.jpg) repeat 0 0; } .bubble:after { content: ""; position: absolute; top: 45px; left: -15px; border-style: solid; border-width: 15px 15px 15px 0; border-color: transparent #FFFFFF; display: block; width: 0; z-index: 1; border-image: url(border.jpg); } EDIT: This link can help you: http://www.sitepoint.com/pure-css3-speech-bubbles/

Categories : HTML

Open an html bubble dialog in IE BHO (C++)
You could create own dialog with browse control and put desired HTML here. Check codeproject article how to do such dialog.

Categories : C++

vb.net - Why do I get this error when trying to bubble sort a csv file?
I think in this line is the problem arrayone(one) = currentField Here it trys to cast the string to a double. You have to use something like this: arrayone(one) = Double.Parse(currentField) or to have it a saver way: Dim dbl As Double If Double.TryParse(currentField, dbl) Then arrayone(one) = dbl Else arrayone(one) = 0.0 End If

Categories : Vb.Net

Alternative to bubble sort in MySQL
Interesting problem, it depends how you resolve the priority clashes of imported records. Let's assume that, if there's a clash, then imported records get priority. Before import multiply all priorities by 2, then import the new records but multiply their priorities by 2 and add 1 during the import. Now you'll have: 1, "John A", 6 2, "John B", 4 5, "John E", 3 3, "John C", 2 4, "John D", 0 If you need your priorities to be continuous, or you do a lot of imports, then you'll have to do some work to reset the numbers but at least the order is correct. You can use the same solution for a priority change where there's a clash, multiply by two then set the new priority to be new priority + 1. So to move ID4 to before ID5 it's new priority would be (3 * 2) + 1 and you'd have: 1, "John A",

Categories : PHP

Bubble a failed request validation to a controller in MVC
Here is the way I resolved this issue: Create a validation rule, say potentiallyDangerousRequestRule: var potentiallyDangerousRequestRegex = /[<>]|&#/, // <, >, &# potentiallyDangerousRequestErrorMessage = 'The error message'; $.validator.addMethod('potentiallyDangerousRequestRule', function (value) { if (value == '') return true; return !potentiallyDangerousRequestRegex.test(value); }, potentiallyDangerousRequestErrorMessage); $.validator.unobtrusive.adapters.addBool('potentiallyDangerousRequestRule'); Call validate method on the form element you want to validate: $('form').validate({errorClass: 'input-validation-error'}); Add the rule to elements, for instance all text inputs and textareas: $('input:text, textarea').each(function () {

Categories : Asp Net

Custom MKAnnotation callout bubble with button
There are several approaches to customizing callouts: The easiest approach is to use the existing right and left callout accessories, and put your button in one of those. For example: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { static NSString *identifier = @"MyAnnotationView"; if ([annotation isKindOfClass:[MKUserLocation class]]) { return nil; } MKPinAnnotationView *view = (id)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (view) { view.annotation = annotation; } else { view = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; view.canShowCallout = true; view.animatesDrop = true; view.rightCal

Categories : IOS

Promotion/bubble-wrap TableScreen data
You can't do that because BW::HTTP.get is asynchronous ! Instead try something like this: def on_init @data = [] end def table_data [ { title: nil, cells: @data } ] end def on_refresh BW::HTTP.get(URL) do |response| @data = [] json = BW::JSON.parse(response.body.to_str) json.each do |hash| @data << { title: hash["val_for_title"]} end update_table_data end_refreshing end end Hope it helps :-)

Categories : Ruby

Data from annotation callout bubble on map view in ios
You will have the function calloutAccessoryControlTapped called when tapped on Callout. Here you normally must be creating an instance of the Next View - Controller and navigating to it via push or model. You will pass all the information to be passed to the Next view in this function NextViewController.locationdetails= someLocationObject; Hope this is clear.Let me know if your question was different.

Categories : IOS

Creating a speech bubble with dynamic height using CSS
Here is JSBin Make top: 40%; bottom: 50%; in your .bubble:after in CSS script You have to check it by changing the .bubble height

Categories : CSS

Pointer to void*, And generic BUBBLE SORT
It's not a generic sort, it's a sorter for arrays of void *. Thus, the array is void **, meaning "pointer to pointer to void *". You can dereference it once, array[0] is the first void * to be sorted. Of course you can't dereference that though, since void * doesn't support that. By the way, the standard library's qsort() is a better example of a generic sort.

Categories : C

d3.js: click event in a bubble/scatter chart
Transitions in D3 don't support the 'on' function They only exist on selections. So you'll need to move that event listener above your transition and after your append. Like this: svg.selectAll("circle") .data(data) .enter() .append("circle") .on("click", function(d){click(d)}) .attr("class", "bubble") .attr("cx", function (d) { return x(d.Number);}) .attr("cy", function (d) { return y(d.Avg);}) .transition() .duration(800) .attr("r", function (d) { return r(d.Size); }); This should be the behavior you want anyways as you wouldn't want to add a click event listener each time you re-render your circles if you were to call renderBubbleGraph at a later time with different drawing parameters.

Categories : D3 Js

Google Maps Api v3 Firefox bug in Info Bubble
It is an issue (or designed behavior, though why that would differ with Firefox is hard to explain) with the "experimental" version. If I set the "release" version <script src="https://maps.googleapis.com/maps/api/js?sensor=false&v=3"></script> It shows the complete text.

Categories : Javascript

MASM bubble sort in descending order
The second problem is that this implementation sorts in ascending order, and I cannot figure out how to fix it to do the oppossite. Invert the branching condition after comparing the two elements. That is, instead of jb $F, do jae @F.

Categories : Assembly

How can I make touch events (on the dom) bubble in javascript?
You're not understanding event bubbling. It doesn't mean that the even touches all surrounding elements. It means that the event goes from the most deeply nested element, all the way up through its ancestors to the document, and invokes handlers it finds on the way. In your HTML, you have siblings. <div id="a"></div> <div id="b"></div> To make use of bubbling, they would need to be nested. <div id="a"> <div id="b"></div> </div>

Categories : Javascript

Javascript bubble sort of an array with objects
The only problem was that you were not using the "par" argument correctly. The obj.prop syntax will always try to look for property named "prop" so to have it dynamic you need to use square brackets e.g. obj["prop"] which can get variable instead of "prop". You didn't get any errors as a[i].par and a[i+1].par both returned undefined which can be compared to itself. (hence a[i].par > a[i+1].par always returns false) Here is revised code that works: function bubbleSort(a, par) { var swapped; do { swapped = false; for (var i = 0; i < a.length - 1; i++) { if (a[i][par] > a[i + 1][par]) { var temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; swapped = true; } } }

Categories : Javascript



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