|
Why would you even do this? Regexes are not fast, they are fairly slow, that's the price you pay for them being so flexible ... and when you want something simple that is already provided by a framework method, just use that.
|
|
|
|
|
Hi Experts,
Can anyone explain to me what is the graphicsDeviceservice in XNA? For what I know it serve the same function as CSS.
Can someone explain to me pls?
Thank you
|
|
|
|
|
Take a look here[^].
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
hi all , i want to sent latitude & longitude on click on map
to c# windows form textbox_latitude & textbox_longitude
this code send latitude & longitude on click on map but it send it to html input type="text" name="lat" ,input type="text" name="lng"
i want to transfer var lat , var lng to c# windows form textbox_latitude & textbox_longitude
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Dragable and clickable marker with lat and lang in form</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;
function initialize() {
var myLatlng = new google.maps.LatLng(30.050077, 31.238594);
var myOptions = {
zoom: 7,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var infowindow = new google.maps.InfoWindow({
content: "Drag marker to position or click to place"
});
infowindow.open(map);
google.maps.event.addListener(map, 'click', function(event) {
var clickedLocation = new google.maps.LatLng(event.latLng);
var marker = new google.maps.Marker({
position: event.latLng,
title:"Marker position",
draggable: true,
map: map
});
infowindow.open(map,marker);
map.setCenter(event.latLng);
google.maps.event.addListener(map, 'click', function(event) {
marker.setMap(null);
});
google.maps.event.addListener(marker, 'dragend', function(event) {
var point = event.latLng;
var lat = point.lat();
var lng = point.lng();
document.getElementById("frmLat").value = lat;
document.getElementById("frmLon").value = lng;
});
var point = event.latLng;
var lat = point.lat();
var lng = point.lng();
document.getElementById("frmLat").value = lat;
document.getElementById("frmLon").value = lng;
});
}
</script>
</head>
<body onLoad="initialize()">
Lat: <input type="text" name="lat" id="frmLat" >
Lng: <input type="text" name="lng" id="frmLon" >
iW3B.info
</body>
</html>
thanks in advance
|
|
|
|
|
Are you using the WebBrowser control?
If so, add a script to the HTML document that returns the values of interest; then (from the Windows Form) call the WebBrowser.InvokeScript method with the name of the script and populate the form's controls / properties with the returned values.
|
|
|
|
|
|
|
I failed to mention that you need to specify that the WinForm object is going to be used for the scripting from JavaScript. The following property should be updated from your WinForm class:
webBrowser1.ObjectForScripting = this; Sorry for this oversight.
|
|
|
|
|
hey all,
i am new to c#
what am i trying to do is
make a panel in form1 and free hand draw on that and it should automatically display on the panel in form2.
can i do that?
and can anyone post some examples i can use?
please thanks a lot
|
|
|
|
|
You should capture the drawing elements and their parameters into some data structures, and paint the drawing from that data; if you want to see more than one instance, just paint as many as you like.
This article[^] could offer some useful guide lines.
|
|
|
|
|
thanks for the reply
i mean do you have any examples that i can work with
i am really really new to c#
|
|
|
|
|
Then go to a book store, look at a range of C# books, choose one or two that look interesting to you, buy them, and study them. Once you got the fundamentals, start reading some articles, a lot of good stuff can be found on this very site. Programming is work, it isn't finger painting.
|
|
|
|
|
Luc Pattyn wrote: Programming is work, it isn't finger painting. Killer sig material.
/ravi
|
|
|
|
|
0down votefavorite
I have a collection of NodeModel objects:
public class NodeModel : ViewModelBase
{
public Guid Id { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public NodeType Type { get; set; }
public List<NodeModel> Children { get; set; }
}
I need to provide Move Up and Move Down functions. To move an item up in the collection, it seems like I would need to know the the item's parent.
True is, I'm not really sure how to implement this. Anyone done this? Can you point me in the right direction?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
|
Mark, I don't think a linked list is a good basis for a model of a hierarchy.
best, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
Your objects seems akin to Controls on a WinForm, so why not use their model? Each Control has a ControlCollection holding its children, and a Parent property pointing to its parent (null for any topmost Control).
When in doubt, look for similar situations and reuse existing concepts.
|
|
|
|
|
|
Yes, I'm using WPF and ObservableCollections. The question then is, in a hierchical collection, how do you know a node's index position? Seems like I'll need to recurse.
If it's not broken, fix it until it is
|
|
|
|
|
See my comments a couple of threads down. You need to be crystal clear about what your hierarchy (and the internal relationships - parent/child/sibling/etc) represent, so you can clearly define your add/delete/move/whatever operations.
Yes, given that a hierarchical structure is involved, you will be up for recursion (or possibly an equivalent iteration). For a many-children "tree", search the big G or Wikip for "trie". That might just hand it to you on a platter.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Give a node a reference to its parent? That's what I've done in every tree-like data structure I've ever built.
|
|
|
|
|
Sounds like a good idea. Do you worry at all about dangling references?
If it's not broken, fix it until it is
|
|
|
|
|
No. .Net's garbage collector will clean up for me. If I remove a child, the fact that it still references its parent is irrelevant, as the child will be collected, and then it's no longer sitting on a reference.
|
|
|
|
|
Kevin Marois wrote: I need to provide Move Up and Move Down functions. I think Bob Janova's suggestion that you include in your Node-whatever base class a 'Parent field is the correct solution, and it will have so much additional functionality, in the long run, it's the "only" solution.
What you leave unspecified in your question are the interesting cases such as:
You wish to move up a child Node of a Parent Node:
a. assuming the Parent Node has other siblings prior to the the Node to be "promoted:" the "promoted node" then remains a sibling of the Parent node, but now precedes the prior sibling in the collection ?
b. assuming the node to be "promoted" is the first child of its Parent Node: the "promoted node" then becomes a sibling of its former Parent node, preceding its former Parent node in the collection ?
I think you can also easily see that you will need to think through other "edge cases" involving moving a Node "down" in the collection/tree.
Also consider that some tree data structures (in computer science algorithmic theory) are based on having a single root node from which all other Nodes descend, and other trees, as you see in the typical TreeView Control in .NET, are based on having an arbitrary collection in which any number of Nodes can be root-level.
Since you use the word "collection" here, I would assume you are allowing multiple root-nodes. In that case the top root-node cannot be moved up, and the last root-node cannot be moved down.
imho it's a useful convention to make the design choice that if the 'Parent field of a Node, in a collection-based tree, contains 'null, then the given Node is a "root-level" node.
Now if you are constructing your own "hierarchic visual display" of this collection/tree structure ... not using some existing TreeView control ... then ... welcome to recursion.
best, Bill
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis
|
|
|
|
|
Hi All,
What it is i would like to do is add a new item into an existing sharepoint list. The fields in this item will be filled out using variables existing in my program.
I've had a look around the internet and its not making much sense so i was hoping one of you guys could shed some light on me?
Many thanks in advance!
|
|
|
|