w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to configure opacity based CSS overlay to not effect spacing of surrounding elements?
Change your .item_overlay style to: .item_overlay { height: auto; width: auto; margin: 0 auto; margin-top: -95px; position: absolute; z-index: 1; background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s linear; -o-transition: all 0.3s linear; transition: all 0.3s linear; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); } Making the position absolute ignores the other elements position, then setting a negative to

Categories : HTML

String gsub - Replace characters between two elements, but leave surrounding elements
You can do it using this character class : [^/] (all that is not a slash) and lookarounds mystring.gsub(/(?<=start/)[^/]+(?=/end)/,"7")

Categories : Ruby

Check the surrounding neighbors of a matrix element in Matlab
The simplest way to proceed is just to pad your array with with values that do not return true for whatever you are checking (say, if you're looking for nonzeros, pad with zeros, or if you're looking for finite values, pad with NaN.) The padarray function can do this for you, but requires the Image Processing Toolbox*. Otherwise, you can pad arrays yourself. For example, an unoptimized way to proceed might be A = rand(m,n); Apadded = [zeros(N,2*N+n); [zeros(m,N), A, zeros(m,N)]; zeros(N,2*N+n)]; for i = N+1:N+m+1 for j = N+1:N+n+1 % Process neighborhood of A(i,j) end end *Also note that these sorts of "sliding neighborhood" operations, being common in image processing, are implemented for you in the Image Processing Toolbox.

Categories : Matlab

How to grab the surrounding td elements?
Here is a rudimentary solution to your problem, using jQuery: http://jsfiddle.net/ujDsS/9/ $(function() { $("td").css("cursor","pointer").click(function() { $("td").css("background","white"); var $i, $j; var cell = $(this), parentRow = cell.parent(), container = parentRow.parent(); var x = parentRow.children("td").index(cell), y = container.children("tr").index(parentRow); var myID = cell.attr("id"); for ($i = -1; $i <= 1; $i++) { if (y-$i < 0) continue; var row = container.children("tr").eq(y-$i); if (!row.length) continue; for ($j = -1; $j <= 1; $j++) { if (x-$j < 0) continue; var cell2 = row.children("td").eq(x-$j); if (!cell2.length) continue; cell2.css("backgro

Categories : Javascript

How to change origin of elements based on another elements in ios
You could use the previous frame, since you are using [label1 sizeToFit]; Example below for label 2: UILabel *label2 =[[ UILabel alloc]init]; label2.frame=CGRectMake(10, label1.frame.origin.y+label1.frame.size.height+30, 10, 150); label2.text=@"Preferred Dress Style";

Categories : IOS

Get rid of surrounding elements in Backbone.Marionette
The surrounding element is required for backbone to work. It is essentially a container/placeholder for your view to sit in, whether its contents have been rendered or not. If you really insist on not having the container then I would consider resorting to the following: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.region.md#set-how-views-el-is-attached Marionette.Region.prototype.open = function(view){ this.$el.empty().append(view.$el.children()); } I say 'resorting' because, in my opinion, this is not how Backbone is supposed to be used and may have side-effects. (im not quite sure what will happen when the view in that region tries to re render; what will it's el element be pointing to?)

Categories : Backbone Js

Change matrix elements from vectors in MATLAB
Simple: mat_A(vec_indices) = vec_values Note that this only works like this for linear indices, so when you flatten your 50x50 matrix into one 2500x1 vector.

Categories : Matlab

Query for "surrounding hex tiles" based on axial coordinates
From the diagrams in the linked article, it seems that something like where (x between tile_x and tile_x + 1) and (y between tile_y - 1 and tile_y + 1) or (x = tile_x - 1) and (y = tile_y) should work If you want to find the tiles (tile_x, tile_y) within a distance n from a given tile (x, y), it will be easier if the x coordinate is modified by adding 0.5 to the x coordinate of each row having an odd distance from the given tile, such that the symmetry is increased: -1.5 -0.5 0.5 1.5 -2 -1 0 1 2 -2.5 -1.5 -0.5 0.5 1.5 2.5 -3 -2 -1 0 1 2 3 -2.5 -1.5 -0.5 0.5

Categories : SQL

Change the opacity based on elements current offset
you can try var $win = $(window); var $img = $('img'); $win.on('scroll', function () { var scrollTop = $win.scrollTop(); $img.each(function () { var $self = $(this); var prev=$self.prev().offset(); var pt=0; if(prev){ pt=prev.top; } $self.css({ opacity: (scrollTop-pt)/ ($self.offset().top-pt) }); console.log(scrollTop+" / "+$self.offset().top+"-"+pt); }); }).scroll(); http://jsfiddle.net/mQHEs/ EDIT var $win = $(window); var $img = $('img'); $win.on('scroll', function () { var scrollTop = $win.scrollTop(); $img.each(function () { var $self = $(this); var prev=$self.prev().offset(); if(prev){ var pt=0; pt=prev.top; $self.css({ opacity: (scrollTop-pt)/ ($self.offs

Categories : Jquery

Detect focus on select box to change class/style in surrounding DIV
I think you only need to change each to focusin : $('#Title').focusin(function(){ $(this).parent().addClass('focus'); }); DEMO HERE

Categories : Jquery

I want change margins of link elements based on browser height
You can use css height percentages to do all this. You can use css3 calc to calculate the height of the menu above the image and give the li elements a 16% height to fill the split the menu evenly: HTML <div id="sideMenu" class="sidebar"> <nav id="sidebarLink"> <ul class="sidebarLinkList"> <li><a href="home.html">Home</a></li> <li><a href="about.html">About Us</a></li> <li><a href="link.html">link</a></li> <li><a href="Destination.html">Destination</a></li> <li><a href="homepage.html">Home</a></li> <li><a href="homepage.html">Home</a></li>

Categories : Javascript

Can I update DOM elements in a D3 selector based on a data join to a different data object?
To make this a little easier, I'd suggest changing the naming convention a little bit: var facilityCircleContainer = svg.append("svg:g") .attr("id", "facilities"); Since the svg:g object isn't actually the circles, it is just holding them. So then: var facilityCircles = facilityCircleContainer.selectAll("circle") .data(facilities, function(d) { return d.id; }) .enter().append("svg:circle") .attr("data-facility-id", function(d, i) { return d.id; }) .ect(...) facilityCircles now refers to the circles with their attached data now. Updating the fill based on the array is pretty simple: facilityCircles.attr("fill", function(d){ facilitiesSubset.indexOf(d.id) != -1 ? "green" : "red"});

Categories : Javascript

How to change the row color based on data that can change in a tableview?
try this its perfectly worked... tablecol.setCellFactory(new Callback<TableColumn<CheckDo, String>, TableCell<CheckDo, String>>() { @Override public TableCell<CheckDo, String> call(TableColumn<CheckDo, String> p) { return new TableCell<CheckDo, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) this.setStyle("-fx-background-color:red"); this.getTableRow().setStyle("-fx-background-color:red"); setText(item); } } };

Categories : CSS

Change the dimensionality of a 3-D data type in matlab
If A is your 100x100x100 matrix, you can use: B = A(:,2:10,:); B is then a 100x9x100 matrix consisting of A's data of the corresponding entries.

Categories : Matlab

How do I change the data type in an HDF5 file from MATLAB?
According to This post which is a similar problem there is no mechanism for deleting a dataset in an HDF5 file. It also indicates that it is possible to Modify in place.

Categories : Matlab

Scraping data based on the text of other neighboring elements?
The Pet Supplies li would be: puts doc.at('li:has(a span[text()="Pet Supplies"])') The following sibling li's would be (skipping the first one): puts doc.search('li:has(a span[text()="Pet Supplies"]) ~ li:gt(1)')

Categories : Ruby

How to Change data based on key press
try following: echo your list in "li" format, and then copy paste below code to your editor // on keydown on text box $txtInput.on("keyup", function (e) { var txt = $(this).val().toLowerCase(); //for backspace if (e.which == 8) { if (txt.length == 0) { renderList(arrText); } } if (txt.length >= 1) { var filterList = searchInList(arrText, txt); if (filterList.length > 0) { renderList(filterList); } else { console.log("Not Found"); renderList(arrText); } } }); see full example here: http://jsfiddle.net/m25UW/ i hope it helps.

Categories : PHP

Regular Expressions Change Tags Surrounding Text, Keep Text
The difficulty with this would arrive if you have multiple of these in a row, and they are not clearly delineated. What you have described could be done with this regex though: </a>([^<]*</a>) Then replace with: $1

Categories : Regex

Change UICollectionViewCell content and nib layout based on data
You should register each nib file you need in viewDidLoad, something like this (substituting the correct names for the nib file and the identifier): [self.collectionView registerNib:[UINib nibWithNibName:@"RDCell" bundle:nil] forCellWithReuseIdentifier:@"FirstType"]; Then, in itemForRowAtIndexPath, test for type and return the correct type of cell: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { if (type = @"firstType") { FirstCell *cell = (FirstCell *) [collectionView dequeueReusableCellWithReuseIdentifier:@"FirstType" forIndexPath:indexPath]; return cell; }else{ SecondCell *cell = (SecondCell *) [collectionView dequeueReusableCellWithReuseIdentifier:@"Sec

Categories : Iphone

Change cell value of DataGrid based on column data type
Use the event AutoGeneratingColumn and attach a converter to the column's binding. Event private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) { if (e.PropertyType.Equals(typeof(DateTime))) { var column = (DataGridTextColumn)e.Column; var dateTimeConverter = new DateTimeConverter(); ((Binding)column.Binding).Converter = dateTimeConverter; } } Converter public class DateTimeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return "Override This"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.C

Categories : C#

R: How to change the column names in a data frame based on a specification
One way, where x is your df: controls <- which(substring(names(x),4,4) %in% c("H","K")) cases <- which(substring(names(x),4,4) %in% c("X","V")) names(x)[controls] <- gsub("SM","Control",names(x)[controls]) names(x)[cases] <- gsub("SM","Case",names(x)[cases]) Alternatively: names(x) <- sapply(names(x),function(z) { if(substring(z,4,4) %in% c("H","K")) sub("SM","Control",z) else if(substring(z,4,4) %in% c("X","V")) sub("SM","Case",z) })

Categories : String

I need to change the color some data in the ListView rows based on value of a special column
Are you using a DataTemplate and Binding for your ListBox? If so, you can just bind the background of your DataTemplate's main container(eg. grid) to a property in your model. The first answer in this question should work:- How to add different background colors to alternate rows to list box items windows phone 8

Categories : C#

Change background/highlight-color of selected ListBox item based on data
You can use a Trigger to achieve that: <Style TargetType="ListBoxItem"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="{Binding Color}" /> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> Note that for this binding to work, you must have a property called Color on the data item objects that are set as the ListBox.ItemsSource. UPDATE >>> Ok, so that was my bad... I forgot that SolidColorBrush is not a FrameworkElement and is Freezable, so they cannot be used in a Binding... you have a few options: Either create your colour(

Categories : Wpf

Change Label Control Property Based on Data from SqlDataSource Inside a Repeater
Try chaning your code from this: <asp:Label ID="lbl_category" runat="server" CssClass="<%# Eval("CommentType") %>" to this: <asp:Label ID="lbl_category" runat="server" CssClass='<%# Eval("CommentType") %>' />

Categories : C#

query based on matching elements in DBRef list for mongodb using spring-data-mongodb
Querying for one element on an array is exactly like query for a field equality. You could read the MongoDB documentation here. So your query will be: new Query(Criteria.where("users.$id").is(new ObjectId(userId)))

Categories : Mongodb

MatLab-->csv: Export data to csv file using dlmwrite in Matlab
I think the problem is that you write the names to a file at the local folder and not the other folder. fldr = fullfile('c:','Data_Analysis'); nomFile=fullfile( fldr, 'Test.csv' ); fid=fopen(nomFile,'w'); fprintf(fid,'%s,',names{:}); fprintf(fid,' '); dlmwrite(nomFile,A,'-append'); fclose(fid);

Categories : Matlab

MATLAB Average Every 5 Elements
You can use blockproc for that. For example, fun = @(block_struct) mean(block_struct.data); new_matrix = blockproc(old_matrix,[5 5],fun);

Categories : Matlab

Matlab Bug -- Matrix Elements Keep Maxing Out
It's not a bug - it sounds like you are using a uint8 datatype. If you convert to a datatype with more bits - e.g. uint16, uint32, single, double, etc - you will not run into this problem. I guess you are working with images, as images read using imread are read in as uint8 by default to save memory. Quickest fix: use I=double(I); either at the start of your function, or on the variable I before you put it into the functions.

Categories : Matlab

Matlab, extract some cell elements to another one
I think this is what you are after... labels = {'aaaa','bbbb','cccc','dddd'}; idx = [1,2]; newlabels = labels(idx); disp(newlabels) disp(iscell(newlabels)) output: 'aaaa' 'bbbb' 1 Therefore, newlables is a cell object

Categories : String

Matlab, Find cell elements
You can do this really simply, use the code below indices = cell(size(B)); for i = 1:numel(B) indices{i} = find(strcmpi(A,B(i))); end While I do recommend using ismember or intersect, those solutions will not handle case insensitive solutions. Also, those methods will not indicate how many times a specific index was matched, where my solution, will return all indices that match for each comparison. UPDATE Code I am running to test this. A={'aaaa','bbbb','cccc','dddd','ffff','aaaa'}; B={'ffff','aaaa','cccc','qwerty'}; indices = cell(size(B)); for i = 1:numel(B) indices{i} = find(strcmpi(A,B(i))); end indices Which returns the following indices = [5] [1x2 double] [3] [1x0 double] I do not see where you are having problems

Categories : String

How can I replace non zero elements randomly with zero in matlab?
The function find is your friend: indices = find(A); This will return an array of the indices of 1 elements in your matrix A and you can use your method of replacing a percent of elements with zero on a subset of this array. Then, A(subsetIndices) = 0; will replace the remaining indices of A with zero.

Categories : Matlab

MATLAB: Remove semicolon from all matrix elements
There are still some things unclear, but suppose you generate the matrix with this piece of code: textscan(ToF_File_ID,'%s %s %s') If you want to parse this to get rid of semicolumns, you can change it into this: strrep(textscan(ToF_File_ID,'%s %s %s'), ';', '')

Categories : Matlab

In an assignment A(I) = B, the number of elements in B and I must be the same. Halp. Matlab
Maybe the line find(ismember(code128B,phrase(1))) is returning more than 1 index. p(1) wants exactly one element. If you just want the first index, then do something like this: Idx = find(ismember(code128B,phrase(1))); Idx = sort(Idx); % Am just assuming you need to sort! p(1) = Idx(1) - 109; p(1) = code128B{p(1),3}

Categories : Matlab

remove elements with corresponding zeros in another matrix matlab
You can do it using logical indexing like so: B(A==0) = 0 EDIT: You can also do it like this: B.*(A~=0) which will be easier to generalise to higher dimensions using bsxfun as per your comment below.

Categories : Matlab

Delete elements within cells of array MATLAB
I'm not near a MATLAB pc at the moment, but try: for i=1:11 inter2{i}(1,newinter{i})=[]; end Note that if you're trying to remove the contents of the cell rather than the cell itself, you've got it backwards. {} accesses the contents of the cell, while () returns the cell itself, so you should use {} if you want to keep the cell intact. See this link for an example case.

Categories : Arrays

Inputting images into array or matrix elements in MATLAB
The most stright-forward way would be to store the images in a cell array with n cells: filenames = uigetfiles('*.tiff','Select the image files', 'multiselect', 'on' ); n = numel(filenames); % number of files selected imgs = cell( n , 1 ); % pre-allocate space for ii=1:n imgs{ii} = imread( filenames{ii} ); end If all your images are of the same size, you may stack them into a 4D (color images) / 3D (gray-scale images) arrays.

Categories : Image

Efficient method for finding elements in MATLAB matrix
Try doing something like this: for i = 1:1000 x = (a >= 0.5); x = (x < 0.6); end I found it to be faster than: for i = 1:1000 x = (a >= 0.5 & a < 0.6); end by about 4 seconds: Elapsed time is 0.985001 seconds. (first one) Elapsed time is 4.888243 seconds. (second one) I think the reason for your slowing is the element wise & operation.

Categories : Matlab

MATLAB: repeat elements in vector with increasing timestamp
You can use a combination of diff and sum to include the 'missing' entries via weighted averaging: % time step step = 1; % Example data (with repeated elements) A = [... 1 80.6 2 79.8 3 40.3 4 40.3 5 81.9 6 83.6 7 83.7 8 95.4 9 14.8 10 14.8 11 14.8 12 14.8 13 14.8 14 44.3]; % Example data, with the repeated elements removed B = [... 1 80.6 2 79.8 3 40.3 5 81.9 6 83.6 7 83.7 8 95.4 9 14.8 14 44.3]; % The correct value M = mean(A(:,2)) % The correct value for the pruned data D = diff(B(:,1)); W = [D/step; 1]; M = sum( W .* B(:,2))/sum(W) Results: M1 = 5.027857142857141e+001 M2 = 5.027857142857143e+001 Alternatively, you can re-create the full vector A from

Categories : Matlab

Comparing two matrices of different size to get common elements in Matlab
Use: [C, ia, ib] = intersect(A,B); C is the common elements vector, ia contains the indices of A and ib contains the indices of B, such that C = A(ia) and C = B(ib). If you don't want indices, simply use: C = intersect(A,B); To search for every elements in A matrix in B matrix You can convert them to row vectors as follows: A1 = reshape(A, 1, length(A)); B1 = reshape(B, 1, length(B)); And then use intersect.

Categories : Matlab

matlab plot markers based on third parameter
Here's an example how to accomplish that for z values that go from 1 to 3 ... x=rand(1,10); y=rand(1,10); z=randi(3,1,10); plot(x(z==1),y(z==1),'o',... x(z==2),y(z==2),'x',... x(z==3),y(z==3),'s') I think you can see how it can be generalized using a for loop quite easily. Edit - here's a for loop implementation: markerlist='sox'; colorlist='rgb'; for n=1:max(z) plot(x(z==n), y(z==n), markerlist(n),'MarkerSize',5, 'MarkerEdgeColor', 'k', 'MarkerFaceColor',colorlist(n)) hold on end hold off

Categories : Matlab



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