w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Change 3D perspective while scrolling - fixed vanishing point
My solution was that I reset the vanishing-point every time the user scrolls. $(window).scroll(function() { var scrollloaction = $(document).scrollTop(); var vanishingpoint = scrollloaction + window.innerHeight / 2; $("#wrapper").css('-webkit-perspective-origin', ' 50% ' + vanishingpoint + 'px'); })

Categories : CSS

Draw lines that end in a brush shape?
The lines are not joined, so the CGLineJoin style does not take effect. It should be fine with the following code: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2.0); CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor); CGContextMoveToPoint(context, self.width - 20, (self.height / 2) - 5); CGContextAddLineToPoint(context, self.width - 12, self.height / 2); CGContextAddLineToPoint(context, self.width - 20, self.height / 2 + 5); CGContextStrokePath(context);

Categories : IOS

How do you get selected datums in brush "brush" event handler?
You'll need to do some kind of iteration to figure out what points live inside the brush extent. D3 doesn't automatically do this for you, probably because it can't know what shapes you're using to represent your data points. How detailed you get about what is considered "selected" and what isn't is quite application specific. There are a few ways you can go about this: As you suggest, you can iterate your data. The downside to this is that you would need to derive the shape information from the data again the same way you did when you created the <rect> elements. Do a timeline.selectAll("rect") to grab all elements you potentially care about and use selection.filter to pare it down based on the x, y, height and width attributes. If performance is a concern because you have an ver

Categories : D3 Js

change brush color with combobox
Just use the combo box SelectedIndex property to retrieve the color from your colors array: private void colorCB_SelectedIndexChanged(object sender, EventArgs e) { brush = new SolidBrush(colors[colorCB.SelectedIndex]); }

Categories : C#

wpf listbox selecteditem background colour change without changing system brush
Apply the style directly to the ListBox <ListBox ... > <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Yellow"/> </Style.Resources> </Style> </ListBox.ItemContainerStyle>

Categories : Wpf

How to find coordinates for a point on a shape in AS3?
Hmm. (telepath mode on) I expect that you are drawing a shape that's attached to a player somewhere. If so, you'd better draw it once, then assign it rotation to face the correct side. Otherwise, and if you badly need to have a point on the player to connect to a point in another shape elsewhere, put this shape on stage level untransformed, and use localToGlobal() and globalToLocal() accordingly to transform coordinate spaces. The manual on both functions (scroll down to find the second)

Categories : Actionscript

An old quesition, how to determine a point in a irregular shape?
I see no reason why you can't use the built-in functions: var isInPath = context.isPointInPath(x, y) For strokes you can use - strokes are separate as a path can be an open line or you can have stroke widths that expands outside the actual polygon: var isInStroke = context.isPointInStroke(x, y) Note that this will only work for the last path (after using beginPath()). If you need to iterate several paths (ie. shapes) you need to re-construct the paths (no need to stroke or fill though). This is perhaps a reason why some don't use it. Transparency is not an issue as checking paths involves the vectors, not the rendered output of those (color information is not part of the check). In the future you will be able to use the Path object directly. Currently this is not implemented in any

Categories : Javascript

Finding a simple shape within a 3D point cloud
You can select 5 points and find a shape. 100C5 will do the trick. Now how to compute the combinations efficiently you can find algorithms for it. A sample implementation is available here

Categories : Algorithm

How to detect if a point is on the boundary( i.e 'edges') of a shape
you have 2 coordinates of the shape position. shape.X shape.Y you have also the size of the shape shape.Height shape.Width You have the coordinates of the mouse position mouse.X mouse.Y If mouse.X is between shape.X and shape.X+shape.Width and mouse.Y is equal to shape.Y or shape.Y+shape.Heigh and so on for a rectangle For different but "regular" shapes you should calculate it in a similarway For complex and irregular shape you should discompose it to smal pieces and do the same calculation: check this: determine if a point sits inside an arbitrary shape? If the shape can be converted to a bitmap another way could be to check for pixel color but this will work only if the shape edge color are different from other pixel in the shape

Categories : C#

Change orientation of a shape
A Delphi TShape is nothing more than drawing a bunch of vector graphics. You can "rotate" the X/Y coordinates themselves with a 2-D transformation matrix. Computer Graphics 101: http://www.cs.uic.edu/~jbell/CourseNotes/ComputerGraphics/2DTransforms.html http://www.willamette.edu/~gorr/classes/GeneralGraphics/Transforms/transforms2d.htm

Categories : Delphi

How to change the shape of a Geofence
Good question. Alas, you probably won't be pleased with the answer. Location Services doesn't support non-circular geofences, nor can you monitor only a segment of the circle. Since Geofence.Builder doesn't have a method for creating a non-circular Geofence, there's no way to provide your own extension. If you post a description of your use case, perhaps someone can figure out an answer.

Categories : Android

Change the form of a shape
Lets say you have a collection of points,p, that represent the convex hull of your object, that which your string would rest against. You provided a constraint such that the total perimeter is to be constant, but without giving more info, there are a multitude of ways those points could be rearranged given your single constraint. Take a triangle for example, if I pull a point away from the centroid of the triangle, should the other 2 vertices simply move closer together, or should 1 move closer to the pulled vertex. I would suggest looking into spring based particles, which is how cloth and rope are simulated in video games.

Categories : C++

In jQuery toggle I want to change shape of the button
you can use slideToggle function for showing and hiding div and for changing class usetoggleClass function demo you cant have href attr in button but you can use data attr <button data-href="collapse1" class="nav-toggle">Show</button> $(".nav-toggle") .click(function(){ $(this).toggleClass("active"); var h =$(this).data('href'); $("#"+h).slideToggle(300); return false; });

Categories : Jquery

Python beginner -- change shape of a matrix
If you want the first third, you want newimg = img[..., 0] If you'll never need the other two thirds again, but you'll be keeping the first third around for a while, you may want img = img[..., 0].copy() so you don't keep the other parts of the array around.

Categories : Python

Android change color without changing shape
I see that for layout three you use @style/layout_three which is different from @style/layout_one. So why don't you go to your style folder and put item with background white in layout_three style It should look something like this: <style name="layout_three"> <item name="android:background">#FFFFFF</item> <!-- ... other stuff here... --> </style> EDIT: Sorry I did not understand your question well, reading that comment now. There is only one way that comes to my mind right now to help you fix that. Create an .xml file in your drawable folder and name it layout_three.xml or whatever. And use this code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <

Categories : Android

how can i change the shape mouse cursor in gWidgets RGtk2?
gtkWidgetModifyCursor modifies the colors of the cursor. You need to set the cursor through gdkWindowSetCursor. For that you need to grab the window associated with the widget: getToolkitWidget(g)$getWindow()$setCursor(c)

Categories : R

Css: Menu hover create custom shape background image?(parallelogram shape using css)
Elaborating on the comment that slash197 gave here is a working fiddle i created earlier for a link button. FIDDLE This demonstrates the Hover as well as gradient property in CSS ... This is being applied to a DIV HTML <div > <div class="testClass">HOME</div> <div class="testClass">ABOUT US</div> <div class="testClass">CONTACT</div> <div class="testClass">LOGIN</div> <div class="testClass">SERVICES</div> CSS div { float:left; background-color:#fff; } .testClass { margin-top: 0px; margin-left: 0px; width: 100px; height: 63px; zoom: 1; display: block; background-repeat: no-repeat; background: #fff; } .testClass:hover { background: #eaebea; -webkit-transform: ske

Categories : HTML

Shape unknown member: invalid request. To select a shape, its view must be active
Assuming that you want to add your pictures when slide show is running you could do it this way, too: Dim fileName, filename1, filename2 fileName = "c:PROJEKT....Hydrangeas.jpg" 'your path +file name here fileName1 = ... 'add other file path fileName2 = ... 'add other file path With ActivePresentation.SlideShowWindow.View.Slide.Shapes .AddPicture fileName, True, True, 10, 10, 100, 100 .AddPicture fileName1, True, True, 30, 30, 100, 100 .AddPicture fileName2, True, True, 50, 50, 100, 100 '...etc. End With Hope it will help...

Categories : Vba

What does this error mean: ValueError: shape mismatch: objects cannot be broadcast to a single shape?
This particular error implies that one of the variables being used in the arithmetic on the line has a shape incompatible with another on the same line (i.e., both different and non-scalar). Since n and the output of np.add.reduce() are both scalars, this implies that the problem lies with xm and ym, the two of which are simply your x and y inputs minus their respective means. Based on this, my guess is that your x and y inputs have different shapes from one another, making them incompatible for element-wise multiplication. ** Technically, it's not that variables on the same line have incompatible shapes. The only problem is when two variables being added, multiplied, etc., have incompatible shapes, whether the variables are temporary (e.g., function output) or not. Two variables with d

Categories : Python

Turn.js: Pages with class="fixed" vanishing during animation in Internet Explorer
After hours of trial and error I've found a fix: I applied an 'innerCover' class to all the pages, and used the following code to remove that class from the pages that are being turned at the start of the turn, so that they look like an inner page as you make the turn. It's a bit hacky but it works: $('.flipbook').turn({ when: { start: function(e, page, view) { var book = $(this), currentPage = book.turn('page'), pages = book.turn('pages'); for(var i=3; i<pages; i++){ if(i==page.page || i==page.next) { $('.p'+i).removeClass('innerCover'); } else { $('.p'+i).addClass('innerCover'); } } } } });

Categories : Internet Explorer

Canvas with shape on it - MouseUp events fire on both of them when I click shape
Mark the one you want to process e.Handled = True; http://msdn.microsoft.com/en-us/library/system.windows.input.mousebuttoneventargs.aspx EDIT as an example the following should work: void Ellipse_MouseUp(object sender, MouseButtonEventArgs e) { e.Handled = True; MessageBox.Show("Ellipse click"); }

Categories : C#

How can I create a transparent shape within an existing shape using KineticJS
You can use a Kinetic Shape Object to do custom drawing, including your star cut-out The Shape gives you access to a context which gives you access to the full range of canvas operations. The operation needed for “cutting” your star from your background is globalCompositeOperation. The “destination-out” composite will cut out the next drawn shape (your star) from any existing drawings (your green rect). Here is how you draw the green rect and use composition to cut out the star. var rect = new Kinetic.Shape({ drawFunc: function(canvas){ context=canvas.getContext("2d"); context.save(); context.beginPath(); context.rect(0,0,96,96); context.fillStyle="green"; context.fill(); context.globalCompositeOperation="destination

Categories : Javascript

How do I set shape.fill.userpicture from one shape to another
UserPicture is a method and it seems it is not possible to take the information of shape picture applied with this method. What I could suggest, which is working in the simple test I made, to go this direction- by calling this two lines: Sheet1.shapes("Rectangle 3").PickUp Sheet1.shapes("Rectangle 5").Apply As a result picture from 'Rectangle 3' will be applied to 'Rectangle 5'. However, some of other properties could be changed too while dimensions are kept.

Categories : Excel

Change the reference point for CSS position
You need to put the point inside the square, then give the square position: relative. The position of the point will then be relative to the square (i.e. left will be the distance from the left edge of the square.) #point { position: absolute; top: 50%; left: 50%; } #square { position: relative; border: solid black 1px; height: 100px; width: 100px; position: absolute; top: 50%; left: 50%; } <div id="square"> <div id="point">+</div> </div> If you want to use a different corner for positioning, use the right or bottom properties instead of left or top. If you wish to position from the center, do what I suggested with the square, but give it a 0 width and height. The square will now be at the center and the point is positioned relative to it. Obviously you

Categories : HTML

R: Calculating change of point accumulative sum?
Why not a simple for-loop? Like this, for example: set.seed(20) x <- rnorm(10, 1, 3) mx <- mean(x) CUMSUM <- function(x) { res <- numeric(length(x)) for (i in seq_along(x) + 1) { res[i] <- max(0, res[i-1] + x[i-1] - mx) } res } CUMSUM(x)

Categories : R

Why does returning a floating-point value change its value?
It's worth noting first of all that since the function is implicitly pure and called twice with a constant argument the compiler would be within its rights to elide the computation and the comparison altogether. clang-3.0-6ubuntu3 does eliminate the pure function call with -O9, and does all the floating-point calculations at compile time, so the program succeeds. The C99 standard, ISO/IEC 9899, says The values of floating operands and the results of floating expressions may be represented in greater precision and range than that required by the type; the types are not changed thereby. So the compiler is free to pass back an 80-bit value, as others have described. However, the standard goes on to say: The cast and assignment operators are still required to perform their spe

Categories : C++

specify a point where to change from static to fixed
That is because when you reach the .footer $(window).scrollTop() is still bigger than stickyRibbonTop and your code will never get to the part where it sets position back to static. Try switch conditions jQuery(window).scroll(function(){ if(jQuery(window).scrollTop() > jQuery('.footer').offset().top) { jQuery('.content_to_stick').css({position: 'static', top: '0px'}); } else if(jQuery(window).scrollTop() > stickyRibbonTop) { jQuery('.content_to_stick').css({position: 'fixed', top: '0px'}); } else { jQuery('.content_to_stick').css({position: 'static', top: '0px'}); } });

Categories : Javascript

How to change setTimeout start time point?
Call the second setTimeout from the callback of the first (more versatile): setTimeout (-> DISPLAY_AREA.append("<p>" + "> " + message + "</p>") setTimeout (-> DISPLAY_AREA.append("<p>" + "> " + message + "</p>") ), 1000 ), 1000 Or simply adjust the timeout values: setTimeout ( -> DISPLAY_AREA.append("<p>" + "> " + message + "</p>") ), 1000 setTimeout ( -> DISPLAY_AREA.append("<p>" + "> " + message + "</p>") ), 2000

Categories : Javascript

change font size after decimal point
Try like this var my_price = $(".price").text(); var dol_smbl = "<span style='font-size:16px;'>"+my_price[0]+"</span>"; var price = split(" ",my_price); var price_arr = split('.',price[1]); befr_dec = "<span style='font-size:22px;'>"+price_arr[0]+"</span>"; aftr_dec = "<span style='font-size:14px;'>."+price_arr[1]+"</span>"; $(".price").html(dol_smbl + " " + befr_dec + aftr_dec);

Categories : Javascript

Choose Brush by name
You could do it with reflection easily enough: // TODO: Validation :) Brush brush = (Brush) typeof(Brushes).GetProperty(name) .GetValue(null); Alternatively, you could use reflection once to populate a dictionary: Dictionary<string, Brush> = typeof(Brushes).GetProperties(BindingFlags.Public | BindingFlags.Static) .ToDictionary(p => p.Name, p => (Brush) p.GetValue(null));

Categories : C#

Bootstrap dropdown position fixed with container border-radius vanishing beyond border in IE
Instead of setting overflow for the container, I set it to the ul and made that fill it's parent. See fiddle http://jsfiddle.net/b3XA2/11/ .one > ul{ overflow-y:scroll; margin:0; height: 100%; }

Categories : CSS

How can I change my connection string to point to SQL Server instead of SQLEXPRESS?
So my project was using the default database (SQL Express) even though I didn’t have a connection string pointing to it. The EF uses convention to attach the default database if you don’t specify by using a constructor like this: public class BloggingContext : DbContext { public BloggingContext() : base("BloggingDatabase") { } } Then this: <configuration> <connectionStrings> <add name="BloggingCompactDatabase" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=Blogging.sdf"/> </connectionStrings> </configuration> I found it all here… http://msdn.microsoft.com/en-us/data/jj592674.aspx.

Categories : Sql Server

Change UIImageView center point on scroll of UIScrollView
Figured it out, I actually needed to grab the instance of the ImageView within the ScrollView using. Anyone else trying to figure this out, I did it a little hacky but it works. /* Paralax Scrolling */ -(void)scrollViewDidScroll:(UIScrollView *)body { float y = body.contentOffset.y; // When adding (body) image view to scroll view I assigned a tag of 100 to it. [body viewWithTag:100].center = CGPointMake([body viewWithTag:100].bounds.size.width/2, ([body viewWithTag:100].bounds.size.height/2) + y/2); }

Categories : IOS

Radial Sweeping of a Brush
How about this to draw a few concentric circles by use of a Brush? <Rectangle> <Rectangle.Fill> <DrawingBrush Stretch="Uniform"> <DrawingBrush.Drawing> <GeometryDrawing> <GeometryDrawing.Pen> <Pen Brush="Black" Thickness="1"/> </GeometryDrawing.Pen> <GeometryDrawing.Geometry> <GeometryGroup> <EllipseGeometry RadiusX="1" RadiusY="1"/> <EllipseGeometry RadiusX="3" RadiusY="3"/> <EllipseGeometry RadiusX="5" RadiusY="5"/> <EllipseGeometry RadiusX="7" RadiusY

Categories : C#

D3 Brush (multiple brushes)
I updated your code to work as intended: http://jsfiddle.net/N32CS/2/ var brushG = currentG.append("g") .attr("id", "g_" + val.curNum) .attr("class", "x brush"); var brush = d3.svg.brush(); brushG.datum({brush: brush}); ... brush.on("brushstart", function (p) { d3.selectAll(".x.brush") .filter(function(d) { console.log(d, d.brush != brush);return d.brush != brush; }) .each(function(d) { d3.select(this).call(d.brush.clear()) }); }) Basically I'm storing the brush function as data on each of the brush groups. when you start brushing it clears the brushes for all the other bars and not it's own. This is a pretty common thing, where it really helps to get used to binding data to the elements. If you bind stuff rather than keeping around global variables you

Categories : Javascript

Brush from color code
First get a color from the color code, the create a brush from that: Brush brush = new SolidBrush((Color)ColorConverter.ConvertFromString("#FFFFE4C4"));

Categories : Dotnet

Set color levels of Brush in wpf
You could create your own brush: private readonly Pen p = new Pen(new SolidColorBrush(Color.FromARGB(...)), 6); You can then define the color exactly by passing alpha, red, green and blue components to Color.FromARGB.

Categories : C#

Disable clearing of D3.js brush
d3 brush by design calls 'brushmove()' once a user presses a mouse on the brush element (i.e. on 'mousedown.brush' event). If effectively leads to resetting the previous brush extent. A possible workaround is to replace the original mousedown.brush handler with the custom one. The custom handler will only call the original handlers once the mouse was moved after initial mousedown. var brushNode = chart.append("g") .call(brush); brushNode .selectAll("rect") .attr("y", -10) .attr("height", 10); // store the reference to the original handler var oldMousedown = brushNode.on('mousedown.brush'); // and replace it with our custom handler brushNode.on('mousedown.brush', function () { brushNode.on('mouseup.brush', function () { clearHandlers(); }); brushNod

Categories : Javascript

Change the position of Map point without changing zoom level or span
Get the current region and just change the center point. // get current region MKCoordinateRegion region = self.mapView.region; // Update the center region.center = CLLocationCoordinate2DMake(annView.annotation.coordinate.latitude, annView.annotation.coordinate.longitude - .04); // apply the new region self.mapView.region = region;

Categories : IOS

How Do I Deep Copy a Set of Data, and Change FK References to Point to All the Copies?
Here is an example with three tables that can probably get you started. DB schema CREATE TABLE users (user_id int auto_increment PRIMARY KEY, user_name varchar(32)); CREATE TABLE agenda (agenda_id int auto_increment PRIMARY KEY, `user_id` int, `agenda_name` varchar(7)); CREATE TABLE events (event_id int auto_increment PRIMARY KEY, `agenda_id` int, `event_name` varchar(8)); An SP to clone a user with his agenda and events records DELIMITER $$ CREATE PROCEDURE clone_user(IN uid INT) BEGIN DECLARE last_user_id INT DEFAULT 0; INSERT INTO users (user_name) SELECT user_name FROM users WHERE user_id = uid; SET last_user_id = LAST_INSERT_ID(); INSERT INTO agenda (user_id, agenda_name) SELECT last_user_id, agenda_name

Categories : SQL



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