Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
618,894 | 1 | null | null | 4 | 1,203 | We are facing a weird problem in IE6. The page works fine in Firefox and IE7.
We have a page which has a div and a iframe within that div
Example:
```
<html>
<body>
...
<div>
<iframe src="page.aspx" />
</div>
</body>
</html>
```
Now assume page.aspx has this code:
```
<html>
<body>
..
<a href="#" onclick="alert('just an alert');">click me</a>
</body>
</html>
```
Now if user clicks on the link 'click me' then the iframe moves!
Here is a depiction of the behavior:
![](https://i.stack.imgur.com/8yHyE.jpg)
![](https://i.stack.imgur.com/0K0hG.jpg)
It seems like none of the code written by us is causing an issue, as the only thing that happens when the user clicks on the link 'click me' is to just show an alert box.
has anybody faced a similar issue? Any pointers about how to resolve this problem?
PS: It is difficult for me to reproduce the problem with a simple example.
| IE6 anchor click moves the iframe | CC BY-SA 4.0 | null | 2009-03-06T13:42:05.580 | 2019-03-05T11:00:26.473 | 2019-03-05T11:00:26.473 | 4,751,173 | 46,279 | [
"internet-explorer",
"internet-explorer-6"
] |
619,618 | 1 | 619,919 | null | 7 | 4,325 | I am creating images using PIL that contain numerous exactly placed text strings. My first attempt was to convert pixel fonts into the pil-compatible format as described [here](http://llbb.wordpress.com/2006/11/24/making-pil-font-for-python-image-library/). For example, I download the Silkscreen font and convert it:
```
otf2bdf -p 8pt -o fonts/slkscr.bdf fonts/slkscr.ttf
pilfont.py fonts/slkscr.bdf
```
I can then use the font in PIL like so:
```
import Image, ImageDraw, os, sys, ImageFont
im = Image.new("RGB", (40,10))
draw = ImageDraw.Draw(im)
fn = ImageFont.load('fonts/slkscr.pil')
draw.text((0,0), "Hello", font=fn)
del draw
# write to stdout
im.save(sys.stdout, "PNG")
```
However, the resulting image (![alt text](https://i.stack.imgur.com/L4koP.png)) does not reflect what the font [should look like](http://kottke.org/plus/type/silkscreen/).
What procedure should I be using to convert and use pixel fonts so that they render as intended?
Thanks in advance.
| Using pixel fonts in PIL | CC BY-SA 4.0 | 0 | 2009-03-06T17:05:11.160 | 2020-03-30T08:09:24.600 | 2020-03-30T08:09:24.600 | 349,333 | 1,515,117 | [
"python",
"imaging"
] |
620,138 | 1 | 620,235 | null | 4 | 2,692 | My question is about the [Visual Studio Image Library](http://msdn.microsoft.com/en-us/library/ms247035.aspx) that comes with VS2008. In the _Common Elements\Annotations folder, there are PNGs with multiple sizes and I was wondering what the intended use of these is. Is there an standard way to implement these images, e.g. in a Windows Forms status bar?
Here are three of the PNGs as an example:
![alt text](https://lh6.ggpht.com/_OZWxOfjIgdA/SbF6ZwoRzVI/AAAAAAAAEIs/86H7LzBIH9I/Complete_OK.png)
![alt text](https://lh6.ggpht.com/_OZWxOfjIgdA/SbF6aC14YPI/AAAAAAAAEI0/3iK306ZRjxI/Blocked.png)
![alt text](https://lh5.ggpht.com/_OZWxOfjIgdA/SbF6aSIOW6I/AAAAAAAAEI8/m0-f1SI7nYU/Warning.png)
| Using Visual Studio Image Library PNGs in a Windows Form app | CC BY-SA 2.5 | null | 2009-03-06T19:39:25.317 | 2009-03-06T20:07:23.953 | 2017-02-08T14:10:46.440 | -1 | 16,454 | [
"winforms",
"visual-studio-2008",
"image",
"png"
] |
622,167 | 1 | null | null | 0 | 249 | On NTFS, any file can have extended file information based on an Alternate Data Stream. Explorer displays this as a tab in the file properties dialog.
I am quite sure there is a COM-Interface for reading/modifying this information, but I seem to be unable to come up with the right terms for my search.
Can anyone give me a short pointer?
Thanks in advance!
Best regards,
Martin
![Screenshot](https://www.dont-panic.cc/capi/files/stackoverflow/file-properties-screenshot.png)
| COM-Interface for accessing file information (title, subject, author)? | CC BY-SA 2.5 | null | 2009-03-07T17:18:38.390 | 2009-03-07T17:29:47.943 | 2017-02-08T14:10:47.130 | -1 | 19,246 | [
"winapi",
"file",
"shell",
"properties"
] |
622,471 | 1 | 622,500 | null | 8 | 14,771 | So I'm building the pacman game in Java to teach myself game programming.
I have the basic game window with the pacman sprite and the ghost sprites drawn, the pacman moves with the arrow keys, doesn't move beyond the walls of the window, etc. Now I'm trying to build the maze, as in this picture:
![Pacman maze](https://upload.wikimedia.org/wikipedia/en/5/59/Pac-man.png)
Without giving me the direct/complete solution to this, can someone guide me as to how this can be built? I'm talking only about the boundaries and the pipes('T' marks) here which you can't go through and you have to go around. Not the dots which the pacman eats yet.
Here are my questions:
1) What's the most efficient algorithm/method for creating this maze? Will it have to be drawn each time the paint() method is called or is there a way to draw it only at the start of the game and never again?
2) How will this actually be drawn to the screen? I assume the `fillRect()` will be used?
3) Any hints on collision detection (so the pacman/ghosts can't go through the walls) would be helpful.
4) Any hints on how the vacant space between the pipes will be calculated so the dots can be filled between them will also be very helpful.
Thanks
| Pacman maze in Java | CC BY-SA 2.5 | 0 | 2009-03-07T20:45:08.987 | 2009-03-17T22:12:54.393 | 2017-02-08T14:10:47.803 | -1 | 49,153 | [
"java",
"algorithm",
"2d",
"maze"
] |
624,041 | 1 | 624,052 | null | 1 | 300 | I am working on an ASP.NET MVC RC2 app using Entity Framework.
This is my Entity diagram.
![](https://i.stack.imgur.com/NFAc4.png)
In my repository I get the entity like this:
```
public Product GetProduct(int id)
{
return (from c in _entities.ProductSet.Include("User")
where c.Id == id
select c).FirstOrDefault();
}
```
My view:
```
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SampleApp.Models.Product>" %>
```
Edit product
```
<h2>Edit product</h2>
<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
<% using (Html.BeginForm()) {%>
<fieldset>
<legend>Fields</legend>
<p>
<label for="Id">Id:</label>
<%= Model.Id %>
</p>
<p>
<label for="Title">Title:</label>
<%= Html.TextBox("Title", Model.Title) %>
<%= Html.ValidationMessage("Title", "*") %>
</p>
<p>
<label for="Body">Body:</label>
<%= Html.TextBox("Body", Model.Body) %>
<%= Html.ValidationMessage("Body", "*") %>
</p>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>
<div>
<%=Html.ActionLink("Back to List", "Index") %>
</div>
```
Problem and my question is: When the "Product" entity is returned from the view on post, the linked entity "User" is null. Why is that and is there any way to get around this?
![](https://i.stack.imgur.com/ZADHo.png)
| How to keep related entities on object when returned from ASP.NET MVC view | CC BY-SA 3.0 | null | 2009-03-08T18:22:55.747 | 2018-04-24T05:34:40.863 | 2018-04-24T05:34:40.863 | 6,083,675 | 33,349 | [
"asp.net-mvc",
"entity-framework"
] |
626,149 | 1 | 626,171 | null | 0 | 2,308 | My automatic test-framework tests a bunch of Excel sheets required by our customers with the excel plugins that my team provides. In order to test the sheet I need to call some macros, this in turn requires macro security to be set to lowest on the testing servers. (In production macro security will be on). In particular I need to supress this dialog:
![alt text](https://farm4.static.flickr.com/3332/3340582143_d4891850a3.jpg?v=0)
One particular PC seems to resist my attempts to configure it, having set macro security to low from Tools->Macro->Secyrity... I exit Excel and return to it, only to find out that macro security has been reverted to "medium"
I'm guessing that I've inherited a PC which has a registry setting that prevents me from downgrading the security, I've searched around and found "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Excel\Security]", however this does not seem to do the trick.
I wonder if there is another way to force macro security to it's lowest setting, either programmatically (via COM) or through a simple registry edit.
UPDATE: I'm on Office 2003. My PCs were pre-owned by other users and may have all kinds of configuration inconsistencies. Of all the PC's under my care this issue only affects one machine. I have full admin rights.
| Help me find the reg-key which is preventing me from chaning excel macro security-level? | CC BY-SA 2.5 | 0 | 2009-03-09T13:07:00.100 | 2020-02-28T13:23:42.197 | 2017-02-08T14:10:49.253 | -1 | 46,411 | [
"windows",
"excel",
"com"
] |
626,541 | 1 | 9,174,392 | null | 8 | 25,822 | I have a SIP application that needs to send UDP packets to set up the SIP calls. SIP has a timeout mechanism to cope with delivery failures. An additional thing I would like to be able to do is detect whether a UDP socket is closed in order having to wait the 32s retransmit interval SIP uses.
The cases I am referring to are when an attempt to send to a UDP socket results in an ICMP Destination Unreachable packet being generated by the remote host. If I attempt to send a UDP packet to a host that's up but that the port is not listening I can see the ICMP message arriving back with a packet tracer but the question is how do I get access to that from my C# code?
I'm playing around with raw sockets but as yet have not been able to get the ICMP packets to be received by my program. The sample below never receives a packet even though ICMP messages are arriving on my PC.
```
Socket icmpListener = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp);
icmpListener.Bind(new IPEndPoint(IPAddress.Any, 0));
byte[] buffer = new byte[4096];
EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
int bytesRead = icmpListener.ReceiveFrom(buffer, ref remoteEndPoint);
logger.Debug("ICMPListener received " + bytesRead + " from " + remoteEndPoint.ToString());
```
Below is a wireshark trace showing the ICMP responses coming into my PC from an attempt to send a UDP packet from 10.0.0.100 (my PC) to 10.0.0.138 (my router) on a port I know it's not listening on. My problem is how to make use of those ICMP packets to realise the UDP send has failed rather than just waiting for the application to timeout after an arbitrary period?
![ICMP responses to UDP send](https://i.stack.imgur.com/lmb4J.png)
| Listen for ICMP packets in C# | CC BY-SA 3.0 | 0 | 2009-03-09T14:51:46.637 | 2015-06-19T20:42:20.657 | 2015-06-19T20:42:20.657 | 1,159,643 | 75,658 | [
"c#",
"icmp"
] |
628,500 | 1 | 631,114 | null | 186 | 114,210 | Lets say I have a text box that I want to fill a whole line. I would give it a style like this:
```
input.wide {display:block; width: 100%}
```
This causes problems because the width is based on the content of the text box. Text boxes have margin, borders, & padding by default, which makes a 100% width text box larger than its container.
For example, here on the right:
![enter image description here](https://i.stack.imgur.com/IvcQx.png)
Is there any way to make a text box fill the width of its container without expanding beyond it?
Here is some example HTML to show what I mean:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">
#outer{border: 1px solid #000; width: 320px; margin: 0px;padding:0px}
#inner{margin: 20px; padding: 20px; background: #999;border: 1px solid #000;}
input.wide {display:block; margin: 0px}
input.normal {display:block; float: right}
</style>
</head>
<body>
<div id="outer">
<div id="inner">
<input type="text" class="wide" />
<input type="text" class="normal" />
<div style="clear:both;"></div>
</div>
</div>
</body>
</html>
```
If this is run, you can see by looking at the "normal" text box that the "wide" text box is sticking out beyond the container. The "normal" text box floats to the actual edge of the container. I'm trying to make the "wide" text box fill its container, without expanding beyond edge like the "normal" text box is.
| Can I stop 100% Width Text Boxes from extending beyond their containers? | CC BY-SA 3.0 | 0 | 2009-03-10T00:05:43.980 | 2018-02-06T20:47:09.257 | 2013-01-11T18:21:48.120 | 1,779,823 | 392 | [
"html",
"css"
] |
630,779 | 1 | 630,807 | null | 2 | 4,889 | I have a fixed toolbar at the bottom of my page where users are going to be able to change their online status and load a listing of their favorites among other things.
In the toolbar, I have parent div elements that when clicked, pop up child div elements that need to be positioned directly above the parent element.
For the online status part, I think I'm doing it right since the height of the pop-up for the online status is always the same height.
CSS:
```
#toolbar
{
background:url('/_assets/img/toolbar.gif') repeat-x;
height:25px;
position:fixed;
bottom:0px;
left:1%;
right:1%;
border-left:1px solid #000000;
border-right:1px solid #000000;
z-index:100;
font-size:0.8em;
}
#toolbar #onlineStatus
{
float:left;
width:30px;
padding-top:5px;
height:21px;
text-align:center;
border-right:1px solid #606060;
}
#toolbar #onlineStatusPopUp
{
display:none;
border:1px solid #000000;
height:50px;
width:211px;
background:#2b2b2b;
float:left;
position:absolute;
left:-1px;
top:-51px;
}
```
HTML:
```
<div id="toolbar">
<div id="onlineStatus">
<a href="javascript:onlineStatusClick();"><img id="onlineStatusIcon" src="/_assets/img/icons/<?php if ($onlinestatus == 0) { echo "online.gif"; } else { echo "hidden.gif"; } ?>" /></a>
<div id="onlineStatusPopUp">
<div id="popUpTitleBar">
<div id="popUpTitle">Online Status</div>
<div id="popUpAction"><a href="javascript:closeOnlineStatus();">x</a></div>
</div>
<div id="onlineStatusMessage">
<?php if ($onlinestatus == 0) { echo "You're online, <a href=\"javascript:changeOnlineStatus();\">go hide</a>"; } else { echo "You're hidden, <a href=\"javascript:changeOnlineStatus();\">go online</a>"; } ?>
</div>
</div>
</div>
</div>
```
Is that the correct way of positioning the pop-up element or should I be doing it differently (i.e., position: relative instead of absolute with some tweaks)?
Here's a screen shot of how it looks:
![Online status screenshot.](https://i.stack.imgur.com/Z6MIH.jpg)
If that's correct, it brings me to my next problem which is a pop up div element whose size changes based on content returned from an AJAX call. Right now I'm positioning the element based on the number of items returned via JavaScript and JQuery and it's really ugly.
Is there a better way to do it?
First, here's a screen shot of the dynamically filled div element:
![Dynamically filled div element.](https://i.stack.imgur.com/mPyIW.jpg)
CSS:
```
#toolbar #favoritesOnline
{
float:left;
height:21px;
width:180px;
padding-top:4px;
border-right:1px solid #606060;
text-align:center;
}
#toolbar #favoritesOnline .favoritesOnlineIcon
{
padding-right:5px;
}
#toolbar #favoritesOnlinePopUp
{
display:none;
border:1px solid #000000;
width:211px;
background:#2b2b2b;
float:left;
position:absolute;
left:-1px;
}
#toolbar #favoritesOnlineListing
{
overflow:auto;
}
```
HTML (note: it's wrapped in the toolbar div as well):
```
<div id="favoritesOnline" style=" <?php if ($onlinestatus == -1) { echo "display:none;"; } ?> ">
<img class="favoritesOnlineIcon" src="/_assets/img/icons/favorite-small.gif" /><a href="javascript:favoritesOnlineClick();">Favorites Online (<span id="favoritesOnlineCount"><?php echo $favonlinecount; ?></span>)</a>
<div id="favoritesOnlinePopUp">
<div id="popUpTitleBar">
<div id="popUpTitle">Favorites Online</div>
<div id="popUpAction"><a href="javascript:closeFavoritesOnline();">x</a></div>
</div>
<div id="favoritesOnlineListing"></div>
</div>
```
And here's the ugly JavaScript I'm using to position it above the parent element based on the number of items in the list (array[0] is the number of elements).
```
$("#favoritesOnlinePopUp").css('top', ((parseInt(array[0]) * 39) - 5 + 1) * -1);
```
| Dynamically positioning pop-up "windows" (div elements) | CC BY-SA 3.0 | null | 2009-03-10T15:26:39.697 | 2011-12-23T05:48:35.903 | 2011-12-23T05:48:35.903 | 937,870 | 74,238 | [
"javascript",
"jquery",
"html",
"css"
] |
632,622 | 1 | 641,836 | null | 3 | 9,863 | I've offered a bounty, since I doubt I'll be getting any answers otherwise.
Lately I've been working with listviews and I've decided to add an for each item indicating whether it's input or output. The icons add fine, but they're not transparent:
![Example of icon not being transparent](https://i.stack.imgur.com/o9Gzq.png)
As can be seen, the icons are clearly not transparent. I'm currently doing something like this load the icons:
```
hImageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 2);
if (hImageList != NULL)
{
iIN = ImageList_AddIcon(hImageList, LoadIcon(hInstance, MAKEINTRESOURCE(101)));
iOUT = ImageList_AddIcon(hImageList, LoadIcon(hInstance, MAKEINTRESOURCE(102)));
}
```
I've tried messing with the flags for `ImageList_Create` & `LoadIcon`/`LoadImage` but have had no luck and to be honest I've run out of ideas.
Any help would be very appreciated.
| ImageList Transparency on Listviews? | CC BY-SA 3.0 | 0 | 2009-03-10T23:00:14.380 | 2022-03-26T11:55:00.003 | 2015-06-19T20:47:36.240 | 1,159,643 | 31,150 | [
"windows",
"winapi",
"transparency"
] |
633,251 | 1 | 633,382 | null | 2 | 2,505 | This is a snippet of my code.
```
Declare Function ReadProcessMemory Lib "kernel32" _
(ByVal hProcess As Long, _
ByVal lpBaseAddress As Long, _
lpBuffer As Any, _
ByVal nSize As Long, _
lpNumberOfBytesRead As Long) As Long
Dim bytearray As String * 65526
Dim GetWindowsFormsID
ReadProcessMemory(processHandle, bufferMem, ByVal bytearray, size, lp)
GetWindowsFormsID = ByteArrayToString(bytearray, retLength)
Function ByteArrayToString(bytes As String, length As Long) As String
Dim retValStr As String
Dim l As Long
retValStr = String$(length + 1, Chr(0))
l = WideCharToMultiByte(CP_ACP, 0, bytes, -1, retValStr, length + 1, Null, Null)
ByteArrayToString = retValStr
End Function
```
I got '94 null' error while calling WideCharToMultiByte. But I'm sure bytes is not empty.
![alt text](https://farm4.static.flickr.com/3322/3346099164_d9ab874e80_o.jpg)
Is this the exact procedure to convert this output into String?
| How to get string from the output of ReadProcessMemory | CC BY-SA 2.5 | 0 | 2009-03-11T03:41:02.690 | 2009-03-11T05:00:35.353 | 2017-02-08T14:10:51.003 | -1 | 405,472 | [
"vb6",
"readprocessmemory"
] |
633,350 | 1 | 635,141 | null | 1 | 577 | Is there a way that you can change the colour of the country borders in a map provided by Google Chart API?
As you can see, the borders stand out a bit too much for my liking.
![](https://chart.apis.google.com/chart?cht=t&chs=440x220&chtm=world&chco=404F64,DDFFDD,006600&chf=bg,s,344152&chld=AEAUBECAFRILITJPMXMYNLNZSEUKUSZA&chd=s:BbENBKBBBBNCBDfC)
Here's the URL if you wanted to play with it:
```
http://chart.apis.google.com/chart
?cht=t
&chs=440x220
&chtm=world
&chco=404F64,DDFFDD,006600
&chf=bg,s,344152
&chld=AEAUBECAFRILITJPMXMYNLNZSEUKUSZA
&chd=s:BbENBKBBBBNCBDfC
```
| How do I change the colour of map borders in Google Chart API? | CC BY-SA 2.5 | null | 2009-03-11T04:39:57.853 | 2009-03-11T15:49:24.610 | 2017-02-08T14:10:51.347 | -1 | 9,021 | [
"google-visualization"
] |
634,964 | 1 | 635,149 | null | 21 | 27,675 | I am looking for a library to generate svg diagrams in python (I fetch data from a sql database). I have found [python-gd](http://newcenturycomputers.net/projects/gdmodule.html), but it has not much documentation and last update was in 2005 so I wonder if there are any other libraries that are good for this purpose.
I am mostly thinking about simple line graphs, something like [this](https://edynblog.files.wordpress.com/2007/07/line-graph-days-on-market.jpg):
![example line graph](https://edynblog.files.wordpress.com/2007/07/line-graph-days-on-market.jpg)
| svg diagrams using python | CC BY-SA 2.5 | 0 | 2009-03-11T15:07:39.093 | 2020-09-13T00:00:53.193 | 2017-02-08T14:10:52.367 | -1 | 11,722 | [
"python",
"svg",
"diagram"
] |
638,299 | 1 | null | null | 38 | 39,573 | I would like to have scroll view with an image content view. The image is actually map which is much bigger than the screen. The map should be initially in the center of the scroll view, like photos in Photos app when you turn iPhone to landscape orientation.
![alt text](https://lh4.ggpht.com/_bowYsy0VxgU/Sbj0Vjz5twI/AAAAAAAAAy0/CHM6LRsNkTo/scrollView.png)
I did not manage to have the map in the center with correct zooming and scrolling at the same time.
Provided that the map image starts from the top of the screen (in portrait orientation), the code looks something like:
```
- (void)loadView {
mapView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"map.jpg"]];
CGFloat mapHeight = MAP_HEIGHT * SCREEN_WIDTH / MAP_WIDTH;
mapView.frame = CGRectMake(0, 0, SCREEN_WIDTH, mapHeight);
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
scrollView.delegate = self;
scrollView.contentSize = mapView.frame.size;
scrollView.maximumZoomScale = MAP_WIDTH / SCREEN_WIDTH;
scrollView.minimumZoomScale = 1;
[scrollView addSubview:mapView];
self.view = scrollView;
}
```
When I move the image frame to the center, the image grows only from the top of its frame down. I tried to play around with mapView transform, with dynamically changing frame of the imageView. Nothing works for me so far.
| UIScrollView with centered UIImageView, like Photos app | CC BY-SA 2.5 | 0 | 2009-03-12T11:56:06.017 | 2016-05-05T09:56:02.867 | 2017-02-08T14:10:53.047 | -1 | 77,143 | [
"ios",
"objective-c",
"iphone",
"cocoa-touch",
"uiscrollview"
] |
640,633 | 1 | 640,649 | null | 21 | 33,082 | For a brand new application, is it better to use WPF over Windows Forms? I used Windows Forms before but not much WPF. As far as I know, WPF is the successor to Windows Forms, right?
The application is going to host DirectX Windows (not WPF 3D, but [Managed DirectX](http://en.wikipedia.org/wiki/Managed_DirectX) and [SlimDX](http://en.wikipedia.org/wiki/SlimDX)) with lots of custom controls.
EDIT: The application is a 3D related application, editor, such as [modo](http://en.wikipedia.org/wiki/Modo_%28software%29):
![Image created using the 3D painting program modo.](https://i.stack.imgur.com/l6Gk3.jpg)
| Is it better to use WPF over Windows Forms? | CC BY-SA 3.0 | 0 | 2009-03-12T21:49:05.037 | 2020-10-20T17:32:45.520 | 2011-09-20T18:52:00.003 | 63,550 | 51,816 | [
"c#",
".net",
"wpf",
"winforms",
"user-interface"
] |
640,641 | 1 | null | null | 1 | 989 | Our web services are accessed through a router which uses port forwarding to connect to the actual web server. When we are trying to establish a web reference in Visual Studio it seems the .NET framework returns the full URL with a port to Visual Studio for the reference during discovery. Visual Studio then tries to make a connection back to that web service to create a proxy object (or whatever) and is denied because we don't allow access on that non-standard port.
Original web service URL
```
http://webservices.example.com/SomeService.asmx
```
Returned web service URL from router
```
http://webservices.example.com:25001/SomeService.asmx
```
My question is if you know how to make the .NET framework NOT include the port when returning the URL from the discovery call. Here's a diagram depicting this process:
![diagram](https://www.websequencediagrams.com/cgi-bin/cdraw?lz=VlMtPlJvdXRlcjogUmVxdWVzdCB3ZWIgc2VydmljZSBvbiBwb3J0IDgwCgAhBi0-V2ViIFNlcnZlcjogRm9yd2FyZHMAHwkyNTAwMQoAGQotAFUKRnVsbCBVUkwgZm9yAFcNaW5jbHVkaW5nAGYFAGAILT5WUwALKgCBPAwANDVZb3UgY2Fubm90IGFjY2VzAIFOBXRoYXQAgXsF&s=rose)
| How can I use .NET web services from non-standard ports? | CC BY-SA 2.5 | null | 2009-03-12T21:52:05.293 | 2013-11-24T07:58:05.683 | 2017-02-08T14:10:53.740 | -1 | 19,421 | [
".net",
"visual-studio-2008",
"web-services"
] |
644,378 | 1 | 649,303 | null | 11 | 22,374 | I realize this might be more of a math problem.
To draw the lines for my rectangles I need to solve for their corners.
I have a rectangle center at (x,y) With a defined Width and Height.
![](https://i31.photobucket.com/albums/c399/Bolt986/Rectangle-Drawing.jpg)
To find the blue points on a non rotated rectangle on top (angle = 0)
It is
`UL = (x-Width/2),(y+height/2)`
`UR = (x+Width/2),(y+height/2)`
`LR = (x+Width/2),(y-height/2)`
`LL = (x-Width/2),(y-height/2)`
How do I find the points if the angle isn't 0?
Thanks in advance.
---
Update: although I have (0,0) in my picture as the center point most likely the center point won't be at that location.
| Drawing a Rotated Rectangle | CC BY-SA 2.5 | 0 | 2009-03-13T20:02:02.740 | 2015-11-16T13:07:28.023 | 2017-02-08T14:10:55.090 | -1 | 64,460 | [
"math",
"graphics"
] |
645,354 | 1 | null | null | 22 | 11,161 | I would like to implement a nodal-interface, basically a [DAG](http://en.wikipedia.org/wiki/Directed_acyclic_graph) where each node performs an operation on it's input connections, and outputs something (which you can connect to another node)
Some example applications:
- [Apples "Shake"](http://www.apple.com/shake/)[screenshot](http://images.apple.com/es/shake/images/index_hero.jpg)- [The Foundrys "Nuke"](http://www.thefoundry.co.uk/pkg_overview.aspx?ui=CBC2593A-2C9F-4EF9-84BE-C198B0171453)[screenshot](http://upload.wikimedia.org/wikipedia/en/5/5a/Nuke_screenshot.png)- [MindNode](http://www.mindnode.com/)[screenshot](http://www.mindnode.com/wordpress/wp-content/uploads/2007/12/mn-screen-2.png)- [vvvv](http://vvvv.org/)[screenshots](http://vvvv.org/tiki-index.php?page=screenshots)- [Quartz Composer](http://developer.apple.com/graphicsimaging/quartz/quartzcomposer.html)[screenshot](http://img24.imageshack.us/img24/8969/quartzcomposer.png)
---
As a first goal, I would like to have an with only 2 nodes. A "number" which simply outputs a fixed number, and an "Add" node, which takes two inputs and outputs the sum of the two.
As people have answered so-far, I have a rough idea of how to represent the data in code, for example in Python'y looking pseudo-code:
```
class Number:
def __init__(self, value):
self.value = value
def eval(self):
return self.value
class Add:
def __init__(self, input1, input2):
self.input1 = input1
self.input2 = input2
def eval(self):
return self.input1.eval() + self.input2.eval()
a = Number(20)
b = Number(72)
adder = Add(a, b)
print adder.eval()
```
How would I got about wrapping a custom GUI around this? Something like the following, but slightly less hand-drawn!
![nodal UI mockup](https://i.stack.imgur.com/h0l6N.png)
Where would I begin? I currently plan to write it in Objective-C/Cocoa, although I'm more than open to suggestions for other languages.
| Implementing a node-based graphical interface? | CC BY-SA 3.0 | 0 | 2009-03-14T04:16:37.217 | 2018-04-30T00:07:04.357 | 2018-04-30T00:07:04.357 | 3,938,208 | 745 | [
"python",
"user-interface",
"directed-graph"
] |
645,471 | 1 | 645,515 | null | -2 | 2,625 | I'm an ICT student, I've gotten classes on several subjects: coding(C#, Java), webdevelopment(XHTML, CSS, JavaScript, PHP), databases(MySQL), Computertech(ASM coding, pc-architecture), Datacom(Cisco networking).
But I still wonder, how do you go about setting up a real big webproject, which requires dedicated servers.
I've been doing this for 2 years now, I'll probably graduate in another year or 2, but I haven't come about setting up something big and having to spend loads of time to configure it.
I don't even know how to set up a dedicated server. It'll probably live after its namesake: being dedicated to one task. But still, what does that look like? How do I work with it when I have to check things on it? How do I optimize it? How do I set up swift interaction with the other server(s) and how do I keep server load and bandwidth usage down.
These are all questions my school can't answer for me, simply because they have a set of courses to give and can't step outside that. As for me doing it myself, I can't afford stuff like that. And I don't like renting stuff like that either. You give money for some servers that are located several hundred miles away. I don't want that, I want the server within walking distance. I need to be able to walk up to that machine and configure it myself. Yet that's pretty unrealistic, financially speaking.
Also, when I think of servers, I think of this stuff:
![alt text](https://farm1.static.flickr.com/59/208812013_9fda8f6a75.jpg)
Is it cliche to think all good servers look like that?
| Learning to work with dedicated servers | CC BY-SA 2.5 | null | 2009-03-14T05:49:06.933 | 2013-11-27T14:51:34.150 | 2020-06-20T09:12:55.060 | -1 | 11,795 | [
"language-agnostic"
] |
646,997 | 1 | 647,026 | null | 4 | 3,212 | I'm trying to produce a timeline for my real-time embedded code.
I need to show all the interrupts, what triggers them, when they are serviced, how long they execute, etc. I have done the profiling and have the raw data, now I need a way to show the timeline graphically, to scale.
I've been searching for a good tool, but haven't come up with anything great yet. Everything that I've found works on timelines of days and years. I want a graph showing a single 2-millisecond cycle. For now I'm using Visio, but I keep thinking there must be something easier. Any ideas?
I'm hoping to produce something like this: ![](https://www.keil.com/support/man/docs/mcbstr7/mcbstr7_interrupt_func1.png).
Unfortunately, mine is more complicated, but that's the general idea.
| What is a good tool for graphing sub-millisecond timelines? | CC BY-SA 2.5 | 0 | 2009-03-15T00:16:23.833 | 2009-05-27T04:58:50.723 | 2017-02-08T14:10:56.097 | -1 | 10,396 | [
"embedded",
"visualization",
"real-time",
"timeline",
"graphing"
] |
647,978 | 1 | null | null | 2 | 1,094 | I really love the 9-slice feature in Flash/Flex. It is a great quick way to make liquid vector layouts. Take a look at:
![image](https://i.stack.imgur.com/oOIwc.png)
I am using the selected object in AI file to setup a 9-slice grid (I am not using 9s to scale corners!). I only want that right part to stay static and the rest to scale. Now, also be aware that it must scale, so it must be vector. I cannot tile the part I want to repeat as a rasterized graphic.
So Flex this is easy, WPF not so much. My question to the WPF community is how can you replicate the 9-slice in WPF? I've toyed with exporting these with the AI->XAML Exporter. Embedding the path object into a grid row behaves way too odd and inconsistent.
This is taking an exported path and trying to drop it into a Grid. I should note this Grid is not being used to mimic a 9-slice. I am just using it to layout objects. I simply want the path below to fit into the right-most top corner. It does not even do that....
```
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid ShowGridLines="True">
<Path Fill="Red" Data="F1 M 200.0,42.5 L -200.0,42.5 L -200.0,-42.5 L 200.0,-42.5 L 200.0,42.5 Z" Grid.Row="0" Grid.Column="1"/>
</Grid>
</Page>
```
| Replicating 9-slice functionality in WPF | CC BY-SA 4.0 | 0 | 2009-03-15T15:24:22.730 | 2019-12-15T21:27:26.683 | 2019-12-15T21:27:26.683 | 1,350,209 | 78,291 | [
"wpf",
"xaml"
] |
649,454 | 1 | 649,545 | null | 49 | 30,475 | If I have two colors defined by their RGB values, can I average the Red, Green and Blue values and then combine to define a third color that looks like a visual average of the two?
ie NewColor = (R1+R2)/2,(G1+G2)/2,(B1+B2)/2
EDIT1: Thanks for all the responses. For my current needs, I am only dealing with color pairs that are shades of the same color so I think that averaging them will work. However, I will try converting to Lab Space to make sure that assumption is true and the technique will be useful in the future.
EDIT2: Here are my results FWIW. Color1 and Color2 are my two colors and the two middle columns are the results of averaging in Lb space and averaging RGB respectively. In this case there is not a lot of difference between the two color and so the differences in the output from the averaging techniques is subtle.
![visual comparison of color averaging techniques](https://i.stack.imgur.com/MSqNt.jpg)
| What is the best way to average two colors that define a linear gradient? | CC BY-SA 3.0 | 0 | 2009-03-16T06:35:08.907 | 2023-02-07T19:58:18.667 | 2015-07-27T14:42:56.903 | 411,022 | 2,680,373 | [
"colors",
"rgb"
] |
651,317 | 1 | 651,440 | null | 351 | 285,409 | How can I achieve the following structure without using tables or JavaScript? The white borders represent edges of divs and aren't relevant to the question.
![Structure 1](https://i.stack.imgur.com/zH7rf.png)
The size of the area in the middle is going to vary, but it will have exact pixel values and the whole structure should scale according to those values. To simplify it, I'd need a way to set "100% - n px" width to the top-middle and bottom-middle divs.
I'd appreciate a clean cross-browser solution, but in case it's not possible, CSS hacks will do.
Here's a bonus. Another structure I've been struggling with and end up using tables or JavaScript. It's slightly different, but introduces new problems. I've been mainly using it in jQuery-based windowing system, but I'd like to keep the layout out of the script and only control the size of one element (the middle one).
![Structure 2](https://i.stack.imgur.com/oe3GE.png)
| Div width 100% minus fixed amount of pixels | CC BY-SA 2.5 | 0 | 2009-03-16T17:14:24.720 | 2021-08-14T10:17:44.563 | 2011-03-02T10:35:42.120 | 73,605 | 73,605 | [
"html",
"css",
"height",
"width"
] |
651,462 | 1 | 651,467 | null | 5 | 6,373 | Duplicate question to :
> [Should I always/ever/never initialize object fields to default values?](https://stackoverflow.com/questions/636102/should-i-always-ever-never-initialize-object-fields-to-default-values)
Environment: Visual Studio 2008 w/ Resharper 4.1 w/ 32bit .NET Framework 3.5
Resharper reports that
> Initializing field by default value is redundant
![alt text](https://farm4.static.flickr.com/3540/3360595348_023c27dd5e_o.png)
Is it a bad practice to declare a default value, explicitly?
I find explicitly declaring default value to be more readable.
By the way this is not a duplication of this question
[Are default parameters bad practice in OOP?](https://stackoverflow.com/questions/624057/are-default-parameters-bad-practice-in-oop)
For those wondering on where to change Resharper 4.1 setting to change the warning to hint/suggestion; Changing following setting
![alt text](https://farm4.static.flickr.com/3657/3359827611_602713a927.jpg)
will change Visual Studio 2008
![alt text](https://farm4.static.flickr.com/3458/3359827603_a7da59ce1d_o.png)
| Is it a bad practice to explicitly declare a default field value? | CC BY-SA 2.5 | null | 2009-03-16T17:50:34.180 | 2020-03-26T21:05:29.980 | 2017-05-23T12:03:04.477 | -1 | 4,035 | [
"c#",
"resharper"
] |
652,078 | 1 | 652,097 | null | 0 | 1,462 | I was wondering if anyone knew of a scrollable gridview control that works similar to the yahoo email gridview.
![alt text](https://ruturajv.files.wordpress.com/2006/10/yahoo-mail-ajax.gif)
| Scrollable Grid (Yahoo email like) | CC BY-SA 2.5 | null | 2009-03-16T20:40:00.217 | 2009-03-17T07:32:06.687 | 2017-02-08T14:10:57.810 | -1 | 56,509 | [
"grid",
"scrollbar"
] |
652,857 | 1 | 7,085,049 | null | 8 | 17,025 | I'm looking for a iPhone-like "picker" control that I'm able to use on the web.
Accessibility is not a concern. JavaScript will be available on all clients and the web app will be run on an environment provided to the user. If the solution could gracefully degrade to a select box though, that would be great. Flash & Silverlight are not ideal (for reasons I don't care to jump into) but similar solutions in Flash & Silverlight may be appreciated by others.
Here's an example of the control on an iPhone:
![Screenshot](https://farm4.static.flickr.com/3647/3360349695_c9d123e6fd.jpg)
| iPhone-like (slot machine) 'picker' select box for the web? | CC BY-SA 2.5 | 0 | 2009-03-17T02:36:22.497 | 2012-01-24T08:51:27.343 | 2017-02-08T14:10:58.273 | -1 | 55,321 | [
"javascript",
"user-interface",
"picker"
] |
655,954 | 1 | 655,971 | null | 3 | 3,185 | I'm using the ASP.NET MVC in my web application. It uses AJAX (MicrosoftAjax.js, MicrosoftMvcAjax.js, jquery-1.3.1.min.js) to make the call from the view to the Delete action with this code:
```
<%= Ajax.ActionLink("Delete", "Delete", new { id=item.id }, new AjaxOptions { Confirm = "Are you sure you want to delete the record?", HttpMethod = "Delete", UpdateTargetId = "divAttributeList" }) %>
```
In the controller I uses this code to process the view request:
```
[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult Delete(int id)
{
_service.DeleteAttribute(id);
return PartialView("List", _service.ListAttributes());
}
```
It works great when I run it on the ASP.NET Development Server but when I try to run the application on a IIS7 (Windows Vista or Windows Server 2008) I get the error
![alt text](https://i561.photobucket.com/albums/ss59/segaco/Error.png)
If i press Continue, the browser show me the next message
Thanks for your help.
| "'Sys' is undefined" error running ASP.NET MVC application in IIS7 | CC BY-SA 2.5 | 0 | 2009-03-17T20:44:21.517 | 2009-04-21T21:40:23.483 | 2017-02-08T14:10:59.310 | -1 | 24,506 | [
"asp.net-mvc",
"iis",
"iis-7"
] |
658,428 | 1 | 658,613 | null | 3 | 2,139 |
# SOLUTION:
Thanks to [Patrick](https://stackoverflow.com/questions/658428/custom-watermarked-textbox-behaving-strangely/658613#658613) below, I have refactored the C# CodeProject version into a VB.NET version that works for me. Hopefully it can help you guys as well:
```
Partial Public Class WatermarkedTextBox
Inherits TextBox
Private _waterMarkColor As Color = Color.LightGray
Public Property WaterMarkColor() As Color
Get
Return _waterMarkColor
End Get
Set(ByVal value As Color)
_waterMarkColor = value
End Set
End Property
Private _waterMarkText As String = "Watermark"
Public Property WaterMarkText() As String
Get
Return _waterMarkText
End Get
Set(ByVal value As String)
_waterMarkText = value
End Set
End Property
Sub New()
End Sub
Protected Overloads Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
Const WM_PAINT As Integer = &HF
If m.Msg = WM_PAINT Then
If Text.Length <> 0 Then
Return
End If
Using g As Graphics = Me.CreateGraphics
g.DrawString(WaterMarkText, Me.Font, New SolidBrush(WaterMarkColor), 0, 0)
End Using
End If
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnLostFocus(ByVal e As System.EventArgs)
MyBase.OnLostFocus(e)
Invalidate()
End Sub
Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
MyBase.OnFontChanged(e)
Invalidate()
End Sub
Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
'' added so the watermark is not cleared until text is entered
MyBase.OnGotFocus(e)
Invalidate()
End Sub
End Class
```
---
I am building a kiosk application, and in order to keep it aesthetically pleasing I decided to implement a watermarked textbox as the entry fields. I found [this project](http://www.codeproject.com/KB/miscctrl/WaterMark.aspx) on [CodeProject](http://www.codeproject.com/), converted it over to VB.NET and put it into my application. It works, in the sense that it watermarks and clears them just fine, but when I go to enter text this happens:
Empty:
![alt text](https://i.stack.imgur.com/4qaOg.jpg)
Filled:
![alt text](https://i.stack.imgur.com/VxrAh.jpg)
So basically it is not clearing the whole watermark, just the space appropriated for the default height of a textbox. here is the converted code:
```
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing
Partial Public Class WatermarkedTextBox
Inherits TextBox
Private oldFont As Font = Nothing
Private waterMarkTextEnabled As Boolean = False
#Region "Attributes"
Private _waterMarkColor As Color = Color.LightGray
Public Property WaterMarkColor() As Color
Get
Return _waterMarkColor
End Get
Set(ByVal value As Color)
_waterMarkColor = value
Invalidate()
End Set
End Property
Private _waterMarkText As String = "Water Mark"
Public Property WaterMarkText() As String
Get
Return _waterMarkText
End Get
Set(ByVal value As String)
_waterMarkText = value
Invalidate()
End Set
End Property
#End Region
Public Sub New()
JoinEvents(True)
End Sub
Protected Overloads Overrides Sub OnCreateControl()
MyBase.OnCreateControl()
WaterMark_Toggle(Nothing, Nothing)
End Sub
Protected Overloads Overrides Sub OnPaint(ByVal args As PaintEventArgs)
'Dim drawFont As New System.Drawing.Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit)
Dim drawFont As New Font("Arial", 28, FontStyle.Bold) 'New System.Drawing.Font(oldFont.FontFamily, oldFont.Size, oldFont.Style, oldFont.Unit)
Dim drawBrush As New SolidBrush(WaterMarkColor)
args.Graphics.DrawString((If(waterMarkTextEnabled, WaterMarkText, Text)), drawFont, drawBrush, New PointF(0.0F, 0.0F))
MyBase.OnPaint(args)
End Sub
Private Sub JoinEvents(ByVal join As Boolean)
If join Then
AddHandler Me.TextChanged, AddressOf WaterMark_Toggle
AddHandler Me.LostFocus, AddressOf Me.WaterMark_Toggle
AddHandler Me.FontChanged, AddressOf Me.WaterMark_FontChanged
End If
End Sub
Private Sub WaterMark_Toggle(ByVal sender As Object, ByVal args As EventArgs)
If Me.Text.Length <= 0 Then
EnableWaterMark()
Else
DisableWaterMark()
End If
End Sub
Private Sub EnableWaterMark()
oldFont = New System.Drawing.Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.waterMarkTextEnabled = True
Refresh()
End Sub
Private Sub DisableWaterMark()
Me.waterMarkTextEnabled = False
Me.SetStyle(ControlStyles.UserPaint, False)
If oldFont IsNot Nothing Then
Me.Font = New System.Drawing.Font(oldFont.FontFamily, oldFont.Size, oldFont.Style, oldFont.Unit)
End If
End Sub
Private Sub WaterMark_FontChanged(ByVal sender As Object, ByVal args As EventArgs)
If waterMarkTextEnabled Then
oldFont = New System.Drawing.Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit)
Refresh()
End If
End Sub
End Class
```
I attempted to force the class to use my set font size in the OnPaint event, but no luck with that. Is there something else that I am missing that is making this more difficult than it should be?
Thanks!
| Custom Watermarked Textbox behaving strangely | CC BY-SA 3.0 | 0 | 2009-03-18T14:17:16.807 | 2015-01-16T12:43:35.957 | 2020-06-20T09:12:55.060 | -1 | 25,515 | [
"vb.net",
"visual-studio-2008",
"custom-controls"
] |
659,303 | 1 | 659,394 | null | 3 | 3,591 | I'm trying to build a Editable GridView like control (Order column) with this code in the view:
```
<table>
<tr>
<th>
Name
</th>
<th>
Order
</th>
<th>
<img alt="Save order" src="<%= Url.Content("~/Content/minisave.png") %>" />
</th>
<th></th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.Name) %>
</td>
<td colspan="2">
<%= Html.TextBox("Order", item.Order, new { size = "3" }) %>
</td>
<td>
<%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> |
<%= Html.ActionLink("Details", "Details", new { id=item.id })%>
</td>
</tr>
<% } %>
</table>
```
The result table look like:
![alt text](https://i561.photobucket.com/albums/ss59/segaco/EditableTable.png)
: How I receive this data in my controller? I need a form tag around the table? How I know which Order value belongs to which record?
: If you see the code I add the size attribute to the input tab but when the browser renders it, the input is larger, how can I fix it?
Thanks for your help!
| Editable "GridView" like control in ASP.NET MVC | CC BY-SA 2.5 | null | 2009-03-18T17:26:09.177 | 2012-06-18T13:48:21.780 | 2017-02-08T14:11:02.247 | -1 | 24,506 | [
"asp.net-mvc",
"gridview"
] |
663,620 | 1 | null | null | 19 | 5,552 | In a multi-touch environment, how does gesture recognition work? What mathematical methods or algorithms are utilized to recognize or reject data for possible gestures?
I've created some retro-reflective gloves and an IR LED array, coupled with a Wii remote. The Wii remote does internal blob detection and tracks 4 points of IR light and transmits this information to my computer via a bluetooth dongle.
This is based off [Johnny Chung Lee's Wii Research](http://johnnylee.net/projects/wii/). My precise setup is exactly like the graduate students from the Netherlands displayed [here](http://www.cs.rug.nl/~isenberg/VideosAndDemos/Vlaming2008PTI). I can easily track 4 point's positions in 2d space and I've written my basic software to receive and visualize these points.
![alt text](https://i.stack.imgur.com/7B3JO.png)![alt text](https://i.stack.imgur.com/ZSGnQ.png)![alt text](https://i.stack.imgur.com/XF5Lx.png)
The Netherlands students have gotten a lot of functionality out of their basic pinch-click recognition. I'd like to take it a step further if I could, and implement some other gestures.
How is gesture recognition usually implemented? Beyond anything trivial, how could I write software to recognize and identify a variety of gestures: various swipes, circular movements, letter tracing, etc.
| What methods/algorithms are used for gesture recognition in a multi-touch environment? | CC BY-SA 4.0 | 0 | 2009-03-19T19:13:54.657 | 2019-03-07T16:44:24.413 | 2019-03-07T16:44:24.413 | 4,751,173 | 2,635 | [
"gesture-recognition",
"wiimote"
] |
667,539 | 1 | 667,565 | null | 9 | 953 | When presented with a simple table view (or even a list view I suppose) what is your preferred method of entering new data.
With add/delete buttons like this:
![with buttons](https://i575.photobucket.com/albums/ss192/darkadept/withAddDelete.jpg)
Or with a blank line indicating a new record like this:
![alt text](https://i575.photobucket.com/albums/ss192/darkadept/blankLine.jpg)
| What's best when inserting into a table view, and add button or a blank line? | CC BY-SA 2.5 | null | 2009-03-20T19:11:03.207 | 2009-03-21T13:11:22.017 | 2017-02-08T14:11:05.800 | -1 | 76,885 | [
"user-interface"
] |
670,764 | 1 | 672,755 | null | 13 | 3,891 | If I have run a long line in IPython, and try and recall it (using the up-arrow) or backspace beyond the start of the current line, it displays incorrectly (all smushed into one line)
For example, in the following session I wrote a long line `[1]`, entered a somewhat-blank line `[2]`, then up-arrowed twice to get the `print` statement on line `[3]`, and the following happened:
![Line wrap issue](https://i.stack.imgur.com/jUjhy.png)
Happens in both iTerm and Terminal.app.. I had a similar problem with regular terminal sessions, which was fixed by properly terminating colour codes, but I'm not sure how to fix it with IPython
| Line-wrapping problems with IPython shell | CC BY-SA 3.0 | 0 | 2009-03-22T09:40:21.657 | 2017-08-15T11:43:10.020 | 2012-10-23T12:38:08.647 | 745 | 745 | [
"python",
"terminal",
"ipython"
] |
676,159 | 1 | 676,208 | null | 10 | 15,553 | I'd like to create a graphic image on the fly based on user input, and then present that image as a PNG file (or jpg or gif if necessary, but PNG is preferred).
This is actually for an astrology application; what I'd like to do is generate the chart in PNG for display.
Python or Ruby is fine; in fact, the library available may determine the language I use.
### Update
Here's an example image:
![Example horoscope graphic chart](https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Astrological_Chart_-_New_Millennium.JPG/400px-Astrological_Chart_-_New_Millennium.JPG)
| Create static graphics files (png, gif, jpg) using Ruby or Python | CC BY-SA 2.5 | 0 | 2009-03-24T04:25:21.617 | 2020-01-12T00:36:26.103 | 2020-06-20T09:12:55.060 | -1 | 35,092 | [
"python",
"ruby",
"graphics",
"png"
] |
683,863 | 1 | 683,943 | null | 193 | 184,223 | I'm trying to get images to display in a WPF ListView styled like a WrapPanel as described in this old ATC Avalon Team article: [How to Create a Custom View](http://blogs.msdn.com/atc_avalon_team/archive/2006/04/28/585844.aspx).
![](https://i.stack.imgur.com/IFIg5.png)
When I try to populate the ListView with a LINQ-to-Entities queried collection of ADO.NET Entity Framework objects I get the following exception:
> Items collection must be empty before
using ItemsSource.
My code…
```
Private Sub Window1_Loaded(...) Handles MyBase.Loaded
ListViewImages.ItemsSource = From g In db.Graphic _
Order By g.DateAdded Ascending _
Select g
End Sub
```
```
<ListView Name="ListViewImages"
SelectionMode="Single"
ItemsSource="{Binding}">
<local:ImageView />
</ListView>
```
I put a breakpoint on that line. `ListViewImages.ItemsSource` is `Nothing` just before the LINQ assignment.
| "Items collection must be empty before using ItemsSource." | CC BY-SA 4.0 | 0 | 2009-03-25T23:02:11.533 | 2022-10-03T13:21:49.667 | 2020-02-11T19:25:25.407 | 285,795 | 83 | [
".net",
"wpf",
"vb.net",
"entity-framework",
"binding"
] |
684,438 | 1 | 723,349 | null | 1 | 7,882 | I am working on a shared addin for MS Word 2007. I would like to add a button which pops up when selected text is right clicked. The attached snapshot should make this clear.
Currently, the user has to select the text and then click a button on a custom control. It would be a lot easier if after selecting the text, s/he could right click it and press the relevant button in the popup.
![alt text](https://i.stack.imgur.com/hoKCP.jpg)
| MS Word Plugin, Adding a button which pops up on right click on selected text | CC BY-SA 3.0 | 0 | 2009-03-26T03:43:12.310 | 2015-06-19T20:34:40.027 | 2020-06-20T09:12:55.060 | -1 | 66,455 | [
"c#",
"word-2007",
"shared-addin"
] |
685,828 | 1 | 686,020 | null | 5 | 15,953 | : SQL Server 2005 w/ SP3 and 2008
Is there a built-in SQL Server stored procedures that will retrieve following information?
Or a DMV (Dynamic Management View) would be great as well.
I am interested mainly on how to find out data of a table specifically.
But it'd be better if there was a sproc that will return all of following result.
![alt text](https://farm4.static.flickr.com/3418/3387609076_af538b3386_o.png)
By the way, is there any documents that shows one-to-one matching of how to retrieve data that SQL Server UI displays?
| How to get a table storage information | CC BY-SA 2.5 | 0 | 2009-03-26T13:38:09.977 | 2018-02-15T06:34:13.477 | 2017-02-08T14:11:14.733 | -1 | 4,035 | [
"sql-server",
"sql-server-2005",
"sql-server-2008"
] |
688,359 | 1 | 688,710 | null | 1 | 7,499 | I am trying to get zIndexing working on a custom UserControl but, it clips the bottom of the control when it pops up inside a TabControl as shown:
![Demo of Control](https://i.stack.imgur.com/Ucnjz.jpg)
This is my XAML
```
<StackPanel Panel.ZIndex="1">
<TabControl Name="TabCtrlMain" Panel.ZIndex="2">
<TabItem Name="TabItmOrdrLst" Visibility="Collapsed" Panel.ZIndex="3" >
<StackPanel Panel.ZIndex="4">
<ri:OrderList x:Name="OrderList" Panel.ZIndex="5" />
<Rectangle Fill="Orange" Height="80" Width="300" />
</StackPanel>
</TabItem>
</TabControl>
<Rectangle Fill="Blue" Height="80" Width="300" />
</StackPanel>
```
| WPF zIndex in TabControl | CC BY-SA 3.0 | 0 | 2009-03-27T02:50:57.403 | 2013-07-20T04:53:28.193 | 2013-07-20T04:53:28.193 | 2,556,654 | 42,707 | [
".net",
"wpf",
"popup",
"z-index"
] |
689,341 | 1 | 689,481 | null | 6 | 21,653 |
### Duplicate
> [How do I improve my Typing Skills?](https://stackoverflow.com/questions/410880/how-do-i-improve-my-typing-skills).**
I tried the test on [http://speedtest.10-fast-fingers.com/](http://speedtest.10-fast-fingers.com/). I reach only:
> `You type 337 characters per minute You`
`have 58 correct words and you have 1`
`wrong words`
How can I improve my typing speed? What free resources do you know of?
Should I learn the Dvorak Keyboard?
![enter image description here](https://i.stack.imgur.com/ILXCx.jpg)
| What is the best way to learn Touch Typing? | CC BY-SA 3.0 | 0 | 2009-03-27T11:10:28.000 | 2014-12-10T18:18:24.930 | 2020-06-20T09:12:55.060 | -1 | 77,212 | [
"keyboard",
"performance",
"dvorak"
] |
689,343 | 1 | 689,393 | null | 1 | 1,953 | I'm using , and trying to enable access to the calendar on my website.
The problem is that I get `This feed is read-only` error every time I try to add an event to the calendar. Here's where I post to: [Link](https://www.google.com/calendar/feeds/mydomain.com_oaiat5pq6l6dsfnmrodn8susvc@group.calendar.google.com/private/basic) (dead link)
![Screenshot of error](https://i.stack.imgur.com/8Xv76.jpg)
| gData API - "This feed is read-only" error when adding to Google Calendar | CC BY-SA 3.0 | null | 2009-03-27T11:11:16.187 | 2013-07-20T04:49:23.897 | 2013-07-20T04:49:23.897 | 2,556,654 | 3,661 | [
"gdata-api",
"google-calendar-api"
] |
690,049 | 1 | 690,062 | null | 2 | 721 | Instead of passing many arguments to a method, I was encapsulating it into an argument object.
: simplied for demo
![alt text](https://farm4.static.flickr.com/3461/3390095308_6f5dccc4cd_o.png)
For such a case, what would be a better practice?
> • Create a class and it as `InventorySaveArgs`?
-- or --
• Create a nested class and it as `SaveArgs`?
And would you also explain why one would choose one or the other?
: That argument type will be used in another assemblies, as well.
: Just curious, if there is a pattern name for encapsulating multiple parameters to a single object by chance.
: [Found Nested Type Usage Guidelines](http://msdn.microsoft.com/en-us/library/tdz1bea9(VS.71).aspx) on MSDN
`InventorySaveArgs` should be available from another assemblies, so I am going with a regular class.
| Create a regular class or an Inner class for a Parameter Object? | CC BY-SA 2.5 | null | 2009-03-27T14:44:43.943 | 2016-04-29T23:24:10.217 | 2017-02-08T14:11:15.810 | -1 | 4,035 | [
"c#",
".net",
"naming-conventions",
"inner-classes",
"parameter-object"
] |
691,423 | 1 | 691,433 | null | 0 | 1,010 | This might be trivial for some of you, but I have two screenshots from the Lose It! app in which I'm curious how two different screens were put together.
The first:
![http://dl-client.getdropbox.com/u/57676/screenshots/loseit1.jpg](https://i.stack.imgur.com/ybcm3.jpg)
That middle graph which shows the statistics chart. Is that a custom image being drawn on top of with Core Graphics / Quartz to achieve the desired numbers? Is the yellow line that's being dynamically allocated all the work of Quartz?
And second:
![http://dl-client.getdropbox.com/u/57676/screenshots/loseit2.jpg](https://i.stack.imgur.com/1C3QO.jpg)
This one might be a bit easier, but the whole bar which looks like a native UIKit widget, which contains [Budget, Food, Exercise, Net, Under]. There appears to be a drop shadow above it. Are they doing a drop shadow on the UINavigationBar? Is the menu below it just a UIImage that a designer was able to craft to look like the UINavigationBar?
If there's a blog out there which teaches UI tricks such as these, I'd love to read more.
| How are these two iPhone UI pieces accomplished? | CC BY-SA 3.0 | null | 2009-03-27T20:58:49.507 | 2013-07-19T13:56:42.487 | 2013-07-19T13:56:42.487 | 2,556,654 | 40,882 | [
"iphone",
"cocoa",
"cocoa-touch"
] |
692,443 | 1 | null | null | 0 | 10,848 | My blog suddenly popup this error today, I searched around on google but still haven't found anything. But it doesn't happen on Firefox, only on IE7 and IE8.
I have deactivated all wordpress's plugins but still get the still error.
I have uploaded the screenshot
![alt text](https://img2.pict.com/ba/dd/f6/db396a6f27b1aa240e5a37c6e5/ObyuD/20090328160649.png)
| "Stack overflow at line: 0" on Internet Explorer | CC BY-SA 3.0 | null | 2009-03-28T08:23:10.983 | 2017-05-06T08:12:04.293 | 2017-05-06T08:12:04.293 | 4,284,627 | 83,952 | [
"internet-explorer",
"stack-overflow"
] |
692,631 | 1 | null | null | 0 | 1,900 | I have two tables, a car table which contains different properties for a car, and a `carmodeldefinition` which is a foreign key to a table with the same name. The `cardefinition` table contains the different cars and models. I have mapped them in the entity framework.
![image](https://i.stack.imgur.com/fFWUY.jpg)
When I try to add a new car within `carmodeldefinition` it simply adds a new `cardefinition` instead of just using the one it finds. The code for it can be found below:
```
DataLayer.Car car = new DataLayer.Car();
car.URL = carBulk.URL;
car.SellerCity = carBulk.SellerCity.ToString();
car.Color = carBulk.Color.ToString();
car.SellerStreet = carBulk.SellerStreet;
car.SellerName = carBulk.SellerName;
car.SellerCountry = carBulk.SellerCountry.ToString();
if (cdDTO != null && cdDTO.CarDefinitionId > 0)
{
car.CarModelDefinition = cdDTO.Transform(cdDTO);
}
mee.AddToCar(car);
mee.SaveChanges();
```
The `cdDTO.Transform(cdDTO)` transforms the `datatransferobject` to an object that can be mapped to the database. The weird thing it that `cdDTO.Transform(cdDTO);` returns the correct object with the correct `cardefintionId`, but when it is inserted, it is just inserted in the bottom with a new `cardefinitionid` (which is the pk).
| Entity framework and foreign keys | CC BY-SA 3.0 | null | 2009-03-28T11:23:36.727 | 2013-07-20T04:35:59.320 | 2013-07-20T04:35:59.320 | 2,556,654 | null | [
"entity-framework",
"foreign-keys",
"entity"
] |
693,446 | 1 | null | null | 1 | 1,765 | I'm trying to build a simple application to test the idea of having multiple forms in one application. For example, in Visual Studio, you have the IDE - design area, and on the right hand side, you have a form called Properties and Solution Explorer
When you click on something in the design area, i.e. Textbox, on the right hand side, the properties for that object selected automatically changes.
I do not want to add the PropertyGrid ontop of the same form where the objects are, it must be independant on its own.
My ultimate goal is to have a 3D viewer/WPF and on the right hand side, a form. When you click in the 3D viewer on a line, or point, the selected object's properties must be displayed in the PropertyGrid
Second to that, I want to be able to dock the forms, or reset to default layout.
Screesnhot:
![screenshot](https://i.stack.imgur.com/Sn0an.jpg) (properties should be docked inside the main form - not like screenshot)
Example: [http://dan.virgesystems.com/images/CPVimage.JPG](http://dan.virgesystems.com/images/CPVimage.JPG) (Dead Link)
| Multiple Forms in C# Window | CC BY-SA 3.0 | null | 2009-03-28T20:15:46.183 | 2013-07-20T04:28:30.363 | 2013-07-20T04:28:30.363 | 2,556,654 | 75,727 | [
"winforms"
] |
694,108 | 1 | 723,727 | null | 13 | 9,232 | This question is a little involved. I wrote an algorithm for breaking up a [simple polygon](http://en.wikipedia.org/wiki/Simple_polygon) into convex subpolygons, but now I'm having trouble proving that it's optimal (i.e. minimal number of convex polygons using (added vertices)). My prof is adamant that it can't be done with a greedy algorithm such as this one, but I can't think of a counterexample.
So, if anyone can prove my algorithm is suboptimal (or optimal), I would appreciate it.
The easiest way to explain my algorithm with pictures (these are from an older suboptimal version)
![](https://i.stack.imgur.com/jECBK.png)
What my algorithm does, is extends the line segments around the point i across until it hits a point on the opposite edge.
If there is no vertex within this range, it creates a new one (the red point) and connects to that:
![](https://i.stack.imgur.com/SQRpU.png)
If there one or more vertices in the range, it connects to the closest one. This produces a decomposition with the fewest number of convex polygons:
![](https://i.stack.imgur.com/Jj9Vh.png)
However, in some cases it can fail -- in the following figure, if it happens to connect the middle green line first, this will create an extra unneeded polygon. To this I propose double checking all the edges (diagonals) we've added, and check that they are all still necessary. If not, remove it:
![](https://i.stack.imgur.com/SkGN8.png)
In some cases, however, this is not enough. See this figure:
![](https://i.stack.imgur.com/Pqw5F.png)
Replacing a-b and c-d with a-c would yield a better solution. In this scenario though, there's no edges to remove so this poses a problem. In this case I suggest an order of preference: when deciding which vertex to connect a reflex vertex to, it should choose the vertex with the highest priority:
lowest) closest vertex
med) closest reflex vertex
highest) closest reflex that is also in range when working backwards (hard to explain) --
In [this figure](http://www.sfu.ca/~mnb2/conv/case4.png), we can see that the reflex vertex 9 chose to connect to 12 (because it was closest), when it would have been better to connect to 5. Both vertices 5 and 12 are in the range as defined by the extended line segments 10-9 and 8-9, but vertex 5 should be given preference because 9 is within the range given by 4-5 and 6-5, but NOT in the range given by 13-12 and 11-12. i.e., the edge 9-12 elimates the reflex vertex at 9, but does NOT eliminate the reflex vertex at 12, but it CAN eliminate the reflex vertex at 5, so 5 should be given preference.
It is possible that the edge 5-12 will still exist with this modified version, but it can be removed during post-processing.
Are there any cases I've missed?
---
Pseudo-code (requested by John Feminella) -- this is missing the bits under Figures 3 and 5
```
assume vertices in `poly` are given in CCW order
let 'good reflex' (better term??) mean that if poly[i] is being compared with poly[j], then poly[i] is in the range given by the rays poly[j-1], poly[j] and poly[j+1], poly[j]
for each vertex poly[i]
if poly[i] is reflex
find the closest point of intersection given by the ray starting at poly[i-1] and extending in the direction of poly[i] (call this lower bound)
repeat for the ray given by poly[i+1], poly[i] (call this upper bound)
if there are no vertices along boundary of the polygon in the range given by the upper and lower bounds
create a new vertex exactly half way between the lower and upper bound points (lower and upper will lie on the same edge)
connect poly[i] to this new point
else
iterate along the vertices in the range given by the lower and upper bounds, for each vertex poly[j]
if poly[j] is a 'good reflex'
if no other good reflexes have been found
save it (overwrite any other vertex found)
else
if it is closer then the other good reflexes vertices, save it
else
if no good reflexes have been found and it is closer than the other vertices found, save it
connect poly[i] to the best candidate
repeat entire algorithm for both halves of the polygon that was just split
// no reflex vertices found, then `poly` is convex
save poly
```
---
Turns out there is one more case I didn't anticipate: [Figure 5]
My algorithm will attempt to connect vertex 1 to 4, unless I add another check to make sure it can. So I propose stuffing everything "in the range" onto a priority queue using the priority scheme I mentioned above, then take the highest priority one, check if it can connect, if not, pop it off and use the next. I this makes my algorithm O(r n log n) if I optimize it right.
---
I've put together [a website](https://mpen.ca/406/) that loosely describes my findings. I tend to move stuff around, so get it while it's hot.
| Decomposition to Convex Polygons | CC BY-SA 3.0 | 0 | 2009-03-29T04:41:34.190 | 2015-08-18T15:49:09.143 | 2015-08-18T15:46:48.890 | 65,387 | 65,387 | [
"geometry"
] |
694,971 | 1 | 694,979 | null | 0 | 618 | I am currently making a program with the AWT GUI and I'm running into a problem. I basically want an image in the top left hand corner of the screen, and a column of buttons on the right of the image. This isn't what's happening though. When I run the applet, I click a popup saying "Start Program" and then the picture I want is in the applet window itself and the column of buttons is in another window by itself. This is what it looks like:
![screenshot](https://i.stack.imgur.com/pQboq.jpg)
Is there anyway to fix this so that the image and the buttons are in the same window?
| Working with frames and Java AWT | CC BY-SA 3.0 | null | 2009-03-29T17:07:18.687 | 2013-07-20T04:13:57.273 | 2013-07-20T04:13:57.273 | 2,556,654 | 84,314 | [
"java",
"layout",
"awt"
] |
695,458 | 1 | null | null | 4 | 10,458 | I posted earlier about having a really messed up panel but, I fixed that by simply changing the layout (thank you to Charlie Martin for helping me). Now, I'm trying to add an image to a panel, so I can add that panel to the frame. This is part of the class that I am messing around with.
[http://friendpaste.com/13zibFC4oVxCbm83500KVj](http://friendpaste.com/13zibFC4oVxCbm83500KVj)
(dead link)
This is what comes up when I run the program and hit start game (on the startup popup)..
![screenshot](https://i.stack.imgur.com/WnKCw.jpg)
Essentially, there is supposed to be an image on the main window along with the buttons and I'm not exactly sure how I would go about implementing this.
| Adding an image to a panel using Java AWT | CC BY-SA 3.0 | null | 2009-03-29T21:52:47.347 | 2013-07-20T04:09:51.527 | 2013-07-20T04:09:51.527 | 319,204 | 84,314 | [
"java",
"image",
"awt",
"frames",
"panels"
] |
696,669 | 1 | 696,894 | null | 1 | 312 | I have the following tables within a database, that I am using to store the results of surveys:
![alt text](https://i.stack.imgur.com/091sC.jpg)
Each time I speak to someone at a store (read Shop), I create a new transaction, with a date/time (tblTransaction.Created). Each transaction can have many question answers associated with it.
My problem is that 2 transactions could both contain different answers to the same question and I am trying to create an SQL query/procedure to return only the latest question answers for a given store.
Here's an example:
I speak with someone at Some Shop Plc. and create a transaction on the 01/01/09 (transaction ID 1). In this transaction, I ask QuestionIDs 1 and 2. Then on the 10/01/09 I speak to them again, creating a new transaction (transaction ID 2) and answer questions 2 and 3.
I want to be able to show the list of latest answers; Question 1 from the first transaction and questions 2 and 3 from the second transaction.
| MySQL - Combining questions and answers from multiple transactions | CC BY-SA 3.0 | null | 2009-03-30T10:11:53.810 | 2013-07-20T04:06:39.843 | 2013-07-20T04:06:39.843 | 2,556,654 | 84,549 | [
"sql",
"mysql"
] |
697,345 | 1 | null | null | 6 | 12,620 | I need help for a dynamic where clause in LinqToSql.
User select conditions from page. (there is 4 input that user select the clauses)
But interface and dynamic query will be generated at codebehind and select From LinqToSql.
You can give similar type of example from another web pages.
![alt text](https://i.stack.imgur.com/nOMC4.jpg)
| Dynamic Where Clause over relational tables with LINQ to SQL | CC BY-SA 4.0 | 0 | 2009-03-30T14:03:48.073 | 2019-03-09T10:15:40.400 | 2019-03-09T10:15:40.400 | 4,751,173 | null | [
".net",
"linq",
"linq-to-sql",
"dynamic",
"where-clause"
] |
702,519 | 1 | 702,528 | null | 1 | 234 | I have many projects that are named after namespaces types are under
![alt text](https://farm4.static.flickr.com/3635/3401652745_4d942700e0_o.png)
When adding a new sub-namespace, how do you decide whether to
• create a new folder in a project
-- or --
• create a new project in a solution?
What are some of dis/advantages I should consider for each scenario?
| When do you add a new project for a nested namespace? | CC BY-SA 2.5 | null | 2009-03-31T18:50:06.847 | 2009-03-31T21:01:52.817 | 2017-02-08T14:11:17.613 | -1 | 4,035 | [
".net",
"project-management",
"namespaces"
] |
704,602 | 1 | 704,626 | null | 2 | 2,991 | I'm working on a small little thing here for school. After hours of researching, and a ton of errors and logic reworking I've almost completed my little program here.
I'm trying to take user input, store it into the string, get a character array from the string ( dont ask why, I just have to put this into a character array ), then get the reversed order of the phrase that the user entered. Here is my code:
```
#include "stdafx.h"
#include <iostream>
#include <String>
#include <cstring>
using namespace std;
using namespace System;
#pragma hdrstop
char* getCharArray(string);
string reversePhrase( int, char* );
void main(void)
{
string sPhrase = "";
int sSize = 0;
string sReversed = "";
char* cPhrase = NULL;
cout << "Welcome to the You Type It & We'll Reverse it! [Version 1.0] " << endl;
cout << "This program will reverse your phrase, and count how many characters are in it!" << endl;
cout << "To begin just enter a phrase." << endl;
cout << "Enter a phrase: ";
getline( cin, sPhrase);
sSize = sPhrase.length();
cout << endl;
cPhrase = getCharArray(sPhrase);
sReversed = reversePhrase( sSize, cPhrase );
cout << sReversed;
system("pause");
}
string reversePhrase(int size , char* cPhrase)
{
string sReversed = "";
int place = size;
for ( int i = 0; i < size ; i ++ )
{
sReversed.append(1, cPhrase[place]);
cout << "Current string: " << sReversed << endl;
cout << "Current character: " << cPhrase[place] << endl;
place--;
}
return sReversed;
}
char* getCharArray(string sPhrase)
{
int size = 1;
size = sPhrase.length();
char* cArray = NULL;
cArray = new char[size];
for (int i = 0 ; i < size ; i++)
{
cArray[size] = sPhrase.at(i);
}
return cArray;
}
```
When I type in "ownage" into the program, this is what I get returned:
![Error Screenshot](https://i.stack.imgur.com/tJOHZ.jpg)
It is almost like my Character Array is getting garbage collected before it can use all of the characters. This is probably an easy fix but, I just don't see how I can get around this one.
| I am trying to return a Character Array but, I'm only getting the first letter returned | CC BY-SA 3.0 | null | 2009-04-01T08:33:43.593 | 2016-03-24T21:08:02.757 | 2013-07-20T03:54:55.667 | 2,556,654 | 60,615 | [
"c++",
"arrays",
"string",
"pointers",
"return-value"
] |
704,681 | 1 | 704,693 | null | 2 | 910 | I have a read-only database, so I am turning off ObjectTracking (thus implicitly turning off DeferredLoading).
I wish to do lazy loading and not use LoadWith<>.
What is the simplest way to explicitly tell Linq to go and lazy fetch a relation just before I need the data itself.
For example: a simple dbml
![alt text](https://i.stack.imgur.com/bvyxV.jpg)
If I have the following code:
```
TestDbDataContext context = new TestDbDataContext(Settings.Default.TestersConnectionString);
context.ObjectTrackingEnabled = false;
var result = context.Employees.ToList();
foreach (var employee in result)
{
// HERE Should load gift list
foreach (var gift in employee.Gifts)
{
Console.WriteLine(gift.Name);
}
}
```
I know I can write a full query again, but I hope we can find together a better way.
| Simplest way to do Lazy Loading with LINQ2SQL | CC BY-SA 4.0 | null | 2009-04-01T09:04:04.067 | 2019-03-09T10:13:06.613 | 2019-03-09T10:13:06.613 | 4,751,173 | 11,659 | [
"c#",
"linq-to-sql",
"optimization",
"lazy-loading"
] |
707,657 | 1 | 718,200 | null | 24 | 12,399 | We are trying to come up with a numbering system for the asset system that we are creating, there has been a few heated discussions on this topic in the office so I decided to ask the experts of SO.
Considering the database design below what would be the better option.
![alt text](https://i.stack.imgur.com/av4vO.png)
Using auto surrogate keys.
```
================= ==================
Road_Number(PK) Segment_Number(PK)
================= ==================
1 1
```
Using program generated PK
```
================= ==================
Road_Number(PK) Segment_Number(PK)
================= ==================
"RD00000001WCK" "00000001.1"
```
(the `00000001.1` means it's the segment of the road. This everytime you add a new segment e.g. `00000001.2`)
Using a bit of both(adding a new column)
```
======================= ==========================
ID(PK) Road_Number(UK) ID(PK) Segment_Number(UK)
======================= ==========================
1 "RD00000001WCK" 1 "00000001.1"
```
Just a bit of background information, we will be using the `Road Number` and `Segment Number` in reports and other documents, so they have to be .
I have always liked keeping things simple so I example 1, but I have been reading that you should not expose your primary keys in reports/documents. So now I'm thinking more along the lines of example 3.
I am also leaning towards example 3 because if we decide to change how our asset numbering is generated it won't have to do cascade updates on a primary key.
What do you think we should do?
Thanks.
EDIT: Thanks everyone for the great answers, has help me a lot.
| Picking the best primary key + numbering system | CC BY-SA 3.0 | 0 | 2009-04-01T22:55:08.063 | 2016-08-03T12:45:56.087 | 2016-08-03T12:45:56.087 | 2,856,839 | 6,335 | [
"database",
"database-design",
"primary-key"
] |
708,868 | 1 | 714,011 | null | 0 | 1,062 | I have a chart created with Birt and I want to add some label on it to specify the 4 regions delimited by the 2 red markers (see image below), one label in each quadrant (centered if possible).
I am looking for a solution to do that, directly using birt chart editor or by using a javascript (like I have done for the red markers).
![alt text](https://i.stack.imgur.com/iHUsj.jpg)
| How to display an overlay label on a chart? | CC BY-SA 3.0 | null | 2009-04-02T08:53:54.177 | 2015-06-19T20:32:56.047 | 2015-06-19T20:32:56.047 | 1,159,643 | 12,248 | [
"javascript",
"reporting",
"birt"
] |
709,857 | 1 | 709,867 | null | 7 | 4,887 | ([PDF](http://www.google.com/url?sa=t&source=web&ct=res&cd=6&url=http%3A%2F%2Fwww.objectmentor.com%2Fresources%2Farticles%2Fsrp.pdf&ei=fsTUSdXFGt2MtgeYtYXhDw&usg=AFQjCNHQQ1Aw-2yCciEbERpJn3VdHBCmQw&sig2=SfZ5lixoD1iPnM8KnQ_W2A) version; [HTML](http://www.google.com/url?sa=t&source=web&ct=html&cd=6&url=http%3A%2F%2F74.125.47.132%2Fsearch%3Fq%3Dcache%3AMW-oZKBBOMYJ%3Awww.objectmentor.com%2Fresources%2Farticles%2Fsrp.pdf%2Bsrp%26cd%3D6%26hl%3Den%26ct%3Dclnk%26gl%3Dus%26client%3Dfirefox-a&ei=fsTUSdXFGt2MtgeYtYXhDw&usg=AFQjCNExM43HwdCHHSpd-r8VlVlymNF7lw&sig2=Y38RET_adHjn-kjzY7fq8A) version) states that
> There should never be more than one reason for a class to change
When you take a look at Outlook, Calendar Event window, it has "Save Close" button.
![alt text](https://farm4.static.flickr.com/3604/3406305729_783218cae6_o.png)
So when the functionalities of either or both or changes, that button should change. It obviously violates SRP.
This functionality both saves time and convinient since that is what most of users to do when they save an appoint on a calendar.
But now, my question is, when do you violate SRP other than when the feature need to be usuable in Outlook?
| When do you violate SRP (Single Reponsibility Principle)? | CC BY-SA 2.5 | 0 | 2009-04-02T14:04:55.007 | 2009-04-02T18:38:35.607 | 2017-02-08T14:11:18.970 | -1 | 4,035 | [
"single-responsibility-principle",
"design-guidelines"
] |
710,665 | 1 | 710,858 | null | 8 | 962 | When you right click on a method in a code file in Visual Studio 2008 you get this
![alt text](https://lh4.ggpht.com/_UhTaY5FX8Kk/SdTt375M-PI/AAAAAAAAGSA/QTSWdORoK9c/Clipboard01.jpg)
which creates the unit test skeleton for that method.
Is there a way (by means of a template change or some nifty hack) by which I can change this to create unit tests based on [Nunit](http://www.nunit.org/index.php) rather than [Visual Studio unit testing tools](http://msdn.microsoft.com/en-us/library/ms379625.aspx)?
Something like this…
```
using System.Collections;
using NUnit.Framework;
namespace Domain.UnitTest
{
[TestFixture]
public class ManagerTest
{
[Test]
public void SomethingTest()
{
string expected = null;
string acutal = Something.Create();
Assert.AreEqual(expected, acutal);
}
```
| Visual Studio 2008 unit tests and nunit | CC BY-SA 2.5 | 0 | 2009-04-02T17:06:44.907 | 2009-04-14T11:16:03.093 | 2017-02-08T14:11:19.310 | -1 | 22,039 | [
".net",
"visual-studio",
"visual-studio-2008",
"unit-testing",
"nunit"
] |
711,948 | 1 | 712,037 | null | 0 | 554 | In Flex, I'm using an HBox to hold thumbnails. When more thumbnails are added than can be shown, the HBox becomes scrollable.
When I add more than, say, 80 images, when I scroll back to the first image, the images begin "tearing", until I hover my mouse over them.
This is how it looks when few images are added:
![Expected](https://imgur.com/1EMTF.png)
When many images are added:
![Buggy](https://imgur.com/1EMW7.png)
Should I be using something other than an HBox to accomplish this?
| Adding many images to HBox causes display problems in Flex | CC BY-SA 2.5 | null | 2009-04-02T22:51:05.657 | 2009-08-25T15:52:18.917 | null | null | 52,791 | [
"apache-flex",
"flash",
"actionscript-3"
] |
713,508 | 1 | 713,579 | null | 49 | 143,084 | Say I have nodes connected in the below fashion, how do I arrive at the number of paths that exist between given points, and path details?
```
1,2 //node 1 and 2 are connected
2,3
2,5
4,2
5,11
11,12
6,7
5,6
3,6
6,8
8,10
8,9
```
Find the paths from 1 to 7:
Answer:
2 paths found and they are
```
1,2,3,6,7
1,2,5,6,7
```
![alt text](https://farm4.static.flickr.com/3120/3409325514_68840abcb8.jpg)
implementation found [here](http://code.activestate.com/recipes/576675/) is nice I am going to use the same
Here is the snippet from the above link in python
```
# a sample graph
graph = {'A': ['B', 'C','E'],
'B': ['A','C', 'D'],
'C': ['D'],
'D': ['C'],
'E': ['F','D'],
'F': ['C']}
class MyQUEUE: # just an implementation of a queue
def __init__(self):
self.holder = []
def enqueue(self,val):
self.holder.append(val)
def dequeue(self):
val = None
try:
val = self.holder[0]
if len(self.holder) == 1:
self.holder = []
else:
self.holder = self.holder[1:]
except:
pass
return val
def IsEmpty(self):
result = False
if len(self.holder) == 0:
result = True
return result
path_queue = MyQUEUE() # now we make a queue
def BFS(graph,start,end,q):
temp_path = [start]
q.enqueue(temp_path)
while q.IsEmpty() == False:
tmp_path = q.dequeue()
last_node = tmp_path[len(tmp_path)-1]
print tmp_path
if last_node == end:
print "VALID_PATH : ",tmp_path
for link_node in graph[last_node]:
if link_node not in tmp_path:
#new_path = []
new_path = tmp_path + [link_node]
q.enqueue(new_path)
BFS(graph,"A","D",path_queue)
-------------results-------------------
['A']
['A', 'B']
['A', 'C']
['A', 'E']
['A', 'B', 'C']
['A', 'B', 'D']
VALID_PATH : ['A', 'B', 'D']
['A', 'C', 'D']
VALID_PATH : ['A', 'C', 'D']
['A', 'E', 'F']
['A', 'E', 'D']
VALID_PATH : ['A', 'E', 'D']
['A', 'B', 'C', 'D']
VALID_PATH : ['A', 'B', 'C', 'D']
['A', 'E', 'F', 'C']
['A', 'E', 'F', 'C', 'D']
VALID_PATH : ['A', 'E', 'F', 'C', 'D']
```
| Find the paths between two given nodes? | CC BY-SA 2.5 | 0 | 2009-04-03T11:09:18.033 | 2017-04-04T20:17:22.497 | 2017-04-04T20:17:22.497 | 1,571,709 | 22,076 | [
"algorithm",
"path",
"graph-theory",
"pseudocode"
] |
716,970 | 1 | 717,102 | null | 35 | 36,146 | This looks like it should be possible with the following:
```
.verticalText
{
/* IE-only DX filter */
writing-mode: tb-rl;
filter: flipv fliph;
/* Safari/Chrome function */
-webkit-transform: rotate(270deg);
/* works in latest FX builds */
-moz-transform: rotate(270deg);
}
```
This works in IE.
It goes wrong in a bizarre way in Safari, Chrome and FX - the cell's size is calculated the text is rotated!
![screenshot of bug](https://i.stack.imgur.com/QT50z.png)
Here is a demo: [http://jsfiddle.net/HSKws/](http://jsfiddle.net/HSKws/)
I'm using dynamic images as a workaround, although that [also has its problems](https://stackoverflow.com/questions/388677). I'm happy with that as a fall-back, but it seems like there should be a way to make this CSS work - it's almost there.
Anyone know a way to make the cells fit the content after the transform has been applied?
| Rotating table header text with CSS transforms | CC BY-SA 3.0 | 0 | 2009-04-04T12:11:34.333 | 2014-01-29T20:32:58.577 | 2017-05-23T12:17:33.783 | -1 | 905 | [
"css",
"cross-browser"
] |
717,155 | 1 | 717,225 | null | 2 | 10,576 | Going to make an applications wich will be used on a device without a physical keyboard
Looking for best practices for touch-screen applications.
Which commercial/free on-screen keyboard or on-screen numeric keypads do you use on Windows devices?
Or should we use a library to implement our own input devices?
Currently using the standard windows osk.exe, but I think it is too small for making a good touch-screen experience.
Update: We decided to make our own keyboard, num keypad controls (although the windows7 keypad looks better)
![alt text](https://i.stack.imgur.com/tOEkX.jpg)
| On-screen keyboard for Windows apps (C++/C#) with touch-screen capability | CC BY-SA 3.0 | null | 2009-04-04T14:09:16.797 | 2015-06-19T20:05:19.253 | 2015-06-19T20:05:19.253 | 1,159,643 | 49,544 | [
"c#",
"windows",
"touchscreen",
"on-screen-keyboard"
] |
717,174 | 1 | 717,189 | null | 1 | 1,491 | My question is simple. What is the best way to achieve what you see the pic below in WPF?
At the moment this is a horizontal StackPanel, with the right padding of the checkbox set to 90. This works okay, but if you resize the window it's no good anymore, unless maybe you re-adjust the padding in the window's resize event, but that seems clunky when using a layout manager.
I am coming from a Qt background, and in Qt I would use a "stretch" element between the buttons and the checkbox to push them apart dynamically. Is there a similar concept in WPF? If not, how do I achieve this so that it will support dynamic resizing?
![alt text](https://i209.photobucket.com/albums/bb277/bresson29/details_two.png)
Thanks!
| How do I add dynamic spacing between controls? (with pics) | CC BY-SA 2.5 | null | 2009-04-04T14:22:10.837 | 2011-09-27T15:22:47.187 | 2017-02-08T14:11:20.070 | -1 | 63 | [
"c#",
"wpf",
"xaml",
"layout"
] |
717,973 | 1 | 717,979 | null | 4 | 4,387 | Can someone explain Breadth-first search to solve the below kind of problems
![alt text](https://farm4.static.flickr.com/3120/3409325514_68840abcb8.jpg)
I need to find all the paths between 4 and 7
| Can someone explain Breadth-first search? | CC BY-SA 2.5 | 0 | 2009-04-04T22:44:42.097 | 2017-04-04T23:52:05.857 | 2017-04-04T23:52:05.857 | 1,571,709 | 22,076 | [
"algorithm",
"graph-theory",
"breadth-first-search"
] |
718,386 | 1 | 720,364 | null | 5 | 1,770 | I'm working with a `NotifyIcon` and `ContextMenuStrip`, I don't want to use the default menu look and feel which is shipped out of the box with this control which is different to Windows (Vista in my case) by using `contextMenu.RenderMode = ToolStripRenderMode.ManagerRenderMode` or `contextMenu.RenderMode = ToolStripRenderMode.Professional`:
![alt text](https://dl.getdropbox.com/u/477279/Stackoverflow/cm_professional.gif)
I don't want this using `contextMenu.RenderMode = ToolStripRenderMode.System`:
![alt text](https://dl.getdropbox.com/u/477279/Stackoverflow/cm_system.gif)
I just want to use the standard, normal Windows "look and feel" as seen in countless, probably non-.net applications *grumble*:
![alt text](https://dl.getdropbox.com/u/477279/Stackoverflow/cm_windows-style1.gif)
![alt text](https://dl.getdropbox.com/u/477279/Stackoverflow/cm_windows-style2.gif)
Any ideas guys on how to achieve this?
| How can I use the Windows look'n'feel for a system tray context menu? | CC BY-SA 2.5 | 0 | 2009-04-05T05:20:07.467 | 2012-11-28T06:15:02.110 | 2017-02-08T14:11:21.763 | -1 | 41,211 | [
"c#",
".net",
"winforms"
] |
719,319 | 1 | null | null | 2 | 1,044 | I'm taking a look at some basic UI principles that the mint.com team put into the iPhone application. A quick screenshot that I'm referencing:
![enter image description here](https://i.stack.imgur.com/Ixuos.png)
I have two questions regarding this UI:
1) There is an elegant space between the UITableViewCell's in which you can see the mint green background of the UITableView. I don't happen to see any delegate method that allows to set a spacer between cells. How is this typically done?
2) The last cell has what appears to be a UIView with the last updated time from the server. This UIView scrolls in sync with the table. Is it just an additional UITableViewCell styled differently from the rest of the cells and appended to the table?
| Two questions regarding this iPhone UI | CC BY-SA 3.0 | 0 | 2009-04-05T17:19:22.340 | 2011-07-21T10:32:19.863 | 2011-07-21T10:32:19.863 | 128,662 | 40,882 | [
"iphone",
"cocoa-touch"
] |
721,526 | 1 | null | null | 2 | 1,284 | In my Google Maps application, which is supposed to be run on mainly on iPhones, hence the 480/320 window resolution, I am displaying some "stuff" in the GInfoWindow information bubbles. The problem is that, sometimes the bubble is too filled with contents that it doesn't fit onto the screen quite the way I'd like it to.
Here's an example
[Too big a bubble http://www.perhac.com/Capture.PNG](http://www.perhac.com/Capture.PNG)
It's not exactly a catastrophe, but as in this case, the marker was pushed slightly off screen and the top of the bubble is not completely displayed too. But then I noticed the "tail" of the bubble (connects the info window to the marker) is toooooooo long.
Does anyone know of a simple way of making it shorter? Is there some property in `GInfoWindowOptions` that could help me with this? I don't thing `pixelOffset` is the way to go...
---
This is going to make the question awfully long, but I want you to notice that in the images downloaded from Google, there a short tail, AND its short shadow... That's why I still believe there must be a way of using that one...
![bubble image](https://maps.google.com/intl/en_ALL/mapfiles/iw3.png)
![shadows](https://maps.google.com/intl/en_ALL/mapfiles/iws3.png)
| How to force the GInfoWindow to shorten its tail? | CC BY-SA 2.5 | null | 2009-04-06T13:49:32.600 | 2009-07-07T21:27:07.957 | 2017-02-08T14:11:23.110 | -1 | 81,520 | [
"javascript",
"json",
"google-maps",
"openinfowindowhtml"
] |
722,700 | 1 | null | null | 19 | 34,123 | I'm trying to put a TreeView inside a ComboBox in WPF so that when the combo box is dropped, instead of a flat list the user gets a hierarchical list and whatever node they select becomes the selected value of the ComboBox.
I've searched quite a bit for how to accomplish this but the best I could find was only peices of potential soltuions that, because I'm ridiculously new to WPF, I couldn't make work.
I have enough knowledge of WPF and databinding that I can get my data into the treeview and I can even get the treeview inside of the combo box, however what I've been able to accomplish doesn't behave properly at all. I've attached a screenshot to show what I mean. In the screenshot the combo box is "open", so the treeview on the bottom is where I can select a node and the treeview "on top" is being drawn on top of the combobox where I want the text/value of the selected node in the tree to be displayed.
Basically what I don't know how to do is how do I get the treeview's currrently selected node to return its value back up to the combobox which then uses it as its selected value?
Here is the xaml code I'm currently using:
```
<ComboBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Top">
<ComboBoxItem>
<TreeView ItemsSource="{Binding Children}" x:Name="TheTree">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type Core:LookupGroupItem}" ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Path=Display}"/>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
</ComboBoxItem>
</ComboBox>
```
Screenshot: ![TreeView](https://i.stack.imgur.com/oi95R.jpg)
| WPF: TreeView inside a ComboBox | CC BY-SA 2.5 | 0 | 2009-04-06T18:55:52.817 | 2020-07-17T04:25:52.710 | 2011-01-24T22:47:31.000 | 107,718 | null | [
"wpf",
"combobox",
"treeview"
] |
724,878 | 1 | 724,915 | null | 4 | 11,816 | I'm using [960 grid system](http://960.gs/) to create a layout prototype.
I would like to set the color between and to #000 (solid black), but I can't figure out how. What I currently get is:
![alt text](https://imgur.com/1NM0Y.png)
Using this code:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/text.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/960.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/custom.css" />
<title>The system</title>
</head>
<body>
<div class="container_16" id="base">
<div class="grid_16" id="header">Graphical banner</div>
<div class="grid_16" id="logoutrow">Logout row</div>
<div class="grid_3" id="navigation">Navigation</div>
<div class="grid_13" id="content">Content</div>
<div class="grid_16" id="footer">Footer</div>
</div>
</body>
</html>
```
My two questions:
- - [this](http://nettuts.com/tutorials/html-css-techniques/prototyping-with-the-grid-960-css-framework/)
For the in between color I've tried putting this in custom.css without success:
```
div#base {
background-color: #000;
}
```
If you are unfamiliar with 960 grid system but still would like to try and help the whole 960.css can be found [here](http://pastebin.com/f6e31aef1).
---
-
My current code looks like this:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/text.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/960.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/custom.css" />
<title>The system</title>
</head>
<body>
<div class="container_16" id="base">
<div class="grid_16" id="header">Graphical banner</div>
<div class="clear"> </div>
<div class="grid_16" id="logoutrow">Logout row</div>
<div class="clear"> </div>
<div class="grid_16" id="navigation-content>
<div class="grid_3 alpha" id="navigation">Navigation</div>
<div class="grid_13 omega" id="content">Content</div>
</div>
<div class="clear"> </div>
<div class="grid_16" id="footer">Footer</div>
<div class="clear"> </div>
</div>
</body>
</html>
```
The [960 grid system](http://960.gs/) says grid child nodes should follow certain rules. The first child node should have the class and the last one the class. Which is what I'm doing above. It's the difference from the answer GateKiller gave below, which provided a solution.
| Questions regarding CSS design using 960 grid system | CC BY-SA 2.5 | 0 | 2009-04-07T09:50:22.073 | 2009-04-07T11:33:45.803 | 2009-04-07T11:33:45.803 | null | null | [
"html",
"css",
"960.gs"
] |
727,163 | 1 | 727,270 | null | 1 | 2,805 | The scenario is that the client wants a floating div (the gray box) with text that wraps around it. However some of that text includes ul's and ol's, which hide behind the floating div in IE6.
I tried wrapping the ul's/ol's in a div to see if that would help, but have been unsuccessful. Has anyone experienced this problem before and found a suitable solution?
(note: This is an old site with limited ability to be able to modify much else within the layout)
![enter image description here](https://i.stack.imgur.com/DuNJ6.jpg)
| CSS: UL's/OL's vs. Div floating left in IE | CC BY-SA 3.0 | null | 2009-04-07T19:04:22.927 | 2012-06-05T16:08:30.610 | 2012-06-05T16:08:30.610 | 44,390 | null | [
"html",
"css",
"html-lists",
"css-float"
] |
733,721 | 1 | 4,077,170 | null | 10 | 13,752 | I have to activate android's system key lock (the one you get when you press the / button). See here:
![img](https://farm4.static.flickr.com/3202/2849046033_fd42359cef.jpg)
I already browsed the docs but everything I found was [PowerManager](http://developer.android.com/reference/android/os/PowerManager.html) and [KeyguardManager](http://developer.android.com/reference/android/app/KeyguardManager.html). Both seem not to be the solution :-(.
So, does everyone know how to achieve that from a android application? (If special permissions are required, that is no problem but changing the device's settings is not a solution...)
: Or does someone know that this is definitely not possible at all? Btw. craigs solution with sending keys does not work anymore (see comments).
| Android - Activation of the system key lock (aka lock screen) | CC BY-SA 3.0 | 0 | 2009-04-09T10:58:27.383 | 2012-04-03T10:52:09.890 | 2017-02-08T14:11:24.480 | -1 | 55,925 | [
"java",
"android",
"keyboard",
"locking",
"device-admin"
] |
735,282 | 1 | 735,434 | null | 5 | 1,143 | This is really annoying when you try to follow the documentation [Squeak by Example](http://squeakbyexample.org/).
Instead of calling the mouse buttons left, right, and middle, like in any other documentation, they give them colors. It's even suggested to label the mouse to help you learning.
It's 2009 and there are 3 dominant systems left: Windows, MacOS X, Linux
Why do they still stick to this naming scheme? How should I be able to sell this to co-workers, or even customers?
From Squeak by Example:
> [Squeak](http://www.squeak.org/) avoids terms like “left mouse
click” because different computers,
mice, keyboards and personal
configurations mean that different
users will need to press different
physical buttons to achieve the same
effect. Instead, the mouse buttons are
labeled with colors. The mouse button
that you pressed to get the “World”
menu is called the red button; it is
most often used for selecting items in
lists, selecting text, and selecting
menu items. When you start using
Squeak, it can be surprisingly helpful
to actually label your mouse, as shown
in Figure 1.4.
![Figure 1.4](https://i.imgur.com/SucRVpF.png)
| Why does Squeak use Colors to identify Mouse Buttons? | CC BY-SA 3.0 | null | 2009-04-09T18:01:22.507 | 2015-01-08T20:36:31.563 | 2015-01-08T20:36:31.563 | 41,860 | 41,860 | [
"documentation",
"smalltalk",
"squeak"
] |
735,445 | 1 | null | null | 0 | 141 | (moved here from a combined question)
I'm wondering if there are any software tools projects to:
- - - - -
![https://farm4.static.flickr.com/3335/3426085255_a5266b4435.jpg?v=0](https://farm4.static.flickr.com/3335/3426085255_a5266b4435.jpg?v=0)
I know I manually generate the MD5 and compare the MD5 hash, but it's a very repetitive series of steps that can be error prone, and computers are great at automating things like this.
@cynoclast's answer got me curious and I ran across [this bugtrack item in DownThemAll](http://bugs.code.downthemall.net/trac/ticket/123) and [this microformat](http://microformats.org/wiki/hash-examples) and [this firefox idea](http://mdhashtool.mozdev.org/lfinfo.html), which at least leads me to believe other people are also thinking along these lines.
| tools for downloading software + automatically verifying integrity | CC BY-SA 2.5 | null | 2009-04-09T18:45:48.360 | 2009-04-09T19:52:35.670 | 2017-02-08T14:11:25.150 | -1 | 44,330 | [
"data-integrity"
] |
736,730 | 1 | 738,105 | null | 5 | 1,857 | How does the DiggBar work?
I'm trying to make an ASP.NET MVC DiggBar clone just for learning purposes and does anyone have a suggestion on how to specify the url of the content for the lower frame? How would you go about constructing that in MVC?
Also, I know that it is an iFrame, but how do they position it so regardless of scrolling it stays positioned at the top? Is it CSS magic?
![alt text](https://imgur.com/IBFBW.png)
Edit: I'm not interested in whether or not you like them. I am not putting one into production and I'm not asking for whether they are good design or not. I simply ~want~ to make one.
I find the DiggBar useful and I like it. Hell, you can turn it off in two clicks! Similarly, reddit has a reddit bar which is opt-in (probably better approach).
| How does the DiggBar work? | CC BY-SA 2.5 | 0 | 2009-04-10T04:47:10.143 | 2011-06-03T15:21:13.990 | 2009-04-10T04:55:13.603 | 64,878 | 64,878 | [
"asp.net-mvc",
"css",
"digg"
] |
739,867 | 1 | 764,688 | null | 1 | 353 | I’m on the learning curve up the Silverlight trail. I’m a data-centric developer so I naturally picked up the ADO.NET Data Services client along the way. I’m scratching my head over a real-world scenario and can’t seem to find any help in documentation, blogs etc.
I’ve got a complex Tutor entity with related entity sets for Addresses, PhoneNumbers, and EmailAddresses. I’ve also got a couple other sets like Subjects and Certifications. Along with all this come foreign keys to lookup tables for things like StatusCodes, AddressTypes (like Home, Business etc), EmailTypes and so on. All this is encapsulated in an edmx in my Model project. Here’s a portion of the structure.
![alt text](https://pqgd7w.bay.livefilestore.com/y1msuZUam9y4h52ek7DvFQt_MDGXSdxpncm5jffDz-wYaVanAL9cF5m8x3pXLn57DZkDQOBjMN6eC07FJglepwj7IzoD1LGpxp_bqKZ2lv5xpQXCCYzAyt3jK3EzBZwnpyJKGY9-AmByWubry6gYSrTiQ/image[4].png)
In Silverlight I’ve got a UserControl that is a data entry form for this tutor. I’ve created a DTO like object for the data binding to the client’s TextBox controls. All’s well till the user clicks Save.
The Save routine creates and adds a Tutor and Person objects and adds them to the DataServiceContext and links them properly. Where I’m running into trouble is that I have to add a related entity that’s ALREADY stored in the context on the database such as code tables.
For example, the person may have multiple Subject specialties: Elementary Math, Elementary Science etc. The TutorSubjectSet has to relate to 3 other sets: Subject (e.g.. Math), SubjectLevel (e.g.. Elementary) and then to the Tutor. My DTO has a list of combined Subject_With_Level items that presents a sub-set of a true Cartesian selection (there’s no such thing as Elementary (school) Calculus at least not where I went to school :-). That list shows up as a checkbox list on the UI. So, when the user clicks Save I pick up the checked items and I try to do a lookup on the combined Subject_With_Level.SubjectId and .SubjectLevelId values against the code tables that have those values.
This is where I’m lost. In a server-side function, I’d be OK because I can do those lookups in-line and get the entity immediately. In an Async situation, how do I get the related entities while I’m busy assembling the person graph? Doing an Async call in the middle of the Save process doesn’t work.
I’ve tried various things: I tried making an ad-hoc replica of the SubjectLevel using the Subject_With_Level.SubjectLevelId and attaching that to the context as follows:
```
public static SubjectLevel MakeFakeSubjectLevelFor(TutoringEntities ctx, Subject_With_Level subjectAndLevel)
{
var subjectLevel = new SubjectLevel()
{
SubjectLevelId = subjectAndLevel.SubjectLevelId,
Description = subjectAndLevel.SubjectLevel,
EffectiveDate = DateTime.Now,
EnteredBy = "",
EnteredDate = DateTime.Now,
Type = subjectAndLevel.SubjectLevel
};
try { ctx.AttachTo("SubjectLevelSet", subjectLevel); }
catch { //this tries to catch situations where the level (eg. Elementary) has already been created }
return subjectLevel;
}
```
This approach works for situations where there are no duplicates (it also has the advantage that I don’t have to do an additional call.) For example in Addresses, there will be only one Home address (I have a similar function: MakeAFakeAddressTypeFor()). You’ll notice I have a try/catch that catches the error if the items is already inserted into the SubjectLevelSet. If the item has already been inserted and I hit that error, the returned subjectLevel is not attached to the context. I get an error since the item is not being tracked. However, I can’t retrieve an existing subjectLevel without issuing an Async query against the SubjectLevelSet even if it’s in my local context.
What I'd like to do is:
```
var lev = ctx.SubjectLevelSet.Where(l => l.SubjectLevelId == subjectAndLevel.SubjectLevelId).FirstOrDefault();
if(lev == null )
lev = Helpers.MakeFakeSubjectLevelFor(ctx, subjectAndLevel);
```
but I get: "Specified method is not supported" which I assume means I have to do the query Async so I'm back to the same situation.
I’ve also tried to retrieve a list of SubjectLevels in the Loaded event delegate. That way I’d have the set of SubjectElements on hand when the Save button is pushed. Same problem, I have to issue an Async call to do a search even if I’ve got it in-hand. I tried iterating through the list for the one I needed but that gave me an error saying that the entity was not being tracked by the context.
So… clearly I’m not understanding this and am doing it wrong but I can’t find any practical examples that do this kind of thing. The how-to examples just happily load primitives into the entity to be stored. No examples that I’ve seen show related entities and how to retrieve them. I could make it simple and just store integer values for the codeId and not relate them via FK’s but that would be too much of a compromise.
Thanks for any help you can provide me.
| Client-Side entity creation with related code tables | CC BY-SA 2.5 | null | 2009-04-11T10:58:26.907 | 2010-11-19T13:10:04.913 | 2009-04-13T17:45:44.087 | 48,172 | 48,172 | [
"entity-framework",
"asynchronous"
] |
741,293 | 1 | 741,454 | null | 2 | 2,300 | I'm attempting to make a TinyURL clone in ASP.NET MVC as a learning project.
Right now, all I want is to be able to submit new URLs to my /Home/Create action via a form.
![alt text](https://imgur.com/JJOP0.png)
I have my LINQ expression all setup, I have my routing setup, and I have my view setup but something is wrong with my setup.
Routing:
```
routes.MapRoute(
"Default", // Route name
"", // URL with parameters
new { controller = "Home", action = "Index" } // Parameter defaults
);
routes.MapRoute(
"Redirect",
"{hash}",
new { controller = "Home", action = "RequestLink", hash = "" }
);
```
These routes allow me to be able to go to my website, www.tinyurlclone.com/ and if nothing is passed ti will simply go to my Home/Index() action. However, if you put anything after the slash, it will consider that a Link Hash and attempt to retrieve the hash.
My HomeController is as follows:
```
[HandleError]
public class HomeController : Controller
{
TinyGetRepository repo = new TinyGetRepository();
public ActionResult Index()
{
return View();
}
public ActionResult Create(String url)
{
String hash = repo.addLink(url);
ViewData["LinkHash"] = hash;
return View();
}
public ActionResult RequestLink(String hash)
{
String url = repo.getLink(hash);
return Redirect(url);
}
}
```
My repo class has all my LINQ expressions in it for dealing with the database and I don't really need to include them because it isn't relevant to this question.
Finally, my basic Home/Index() view (used for submitting urls) is as follows:
```
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Index</title>
</head>
<body>
<div>
<center>
<span style="font-size: 14pt">TinyGet <em>(beta)</em></span><br />
<span style="font-family: Tahoma">Reduce your long links to smaller ones to keep them more memorable....<br />
</span>
<% using(Html.BeginForm("Create", "Home")) %>
<% { %>
<%= Html.TextBox("url") %>
<input type="submit" name="submitButton" value="Shorten Link!" />
<% } %>
</center>
</div>
</body>
</html>
```
However, my form simply isn't firing any methods when I click submit.
Furthermore, if I view the source of my generated HTML I can see that it didn't make my Form's action correctly, it reads:
```
<form action="" method="post"><input id="url" name="url" type="text" value="" />
<input type="submit" name="submitButton" value="Shorten Link!" />
</form>
```
Why is the HTML helper putting "" as the action when it ~should~ be putting /Home/Create? Why isn't my /Home/Create action method being called? Even if I don't use the Html helpers and specify the `<form`> tag manually it throws errors.
What is wrong here?
Source for project: [here](http://www.filedropper.com/tinyget)
| Why doesn't this form call my controller action in ASP.NET MVC? | CC BY-SA 2.5 | 0 | 2009-04-12T05:10:11.680 | 2009-04-12T08:17:53.647 | 2009-04-12T05:16:12.507 | 88,470 | 88,470 | [
"asp.net-mvc",
"webforms"
] |
741,985 | 1 | 742,069 | null | 343 | 243,358 | How should a latex source code listing look like to produce an output like in known books, for example one for the Spring Framework? I've tried with the latex listings package but wasn't able to produce something that looked as nice as the one below. So I'm primarely interested in the formatting instructions to produce something like the sample below (from Manning's [sample chapter](http://www.manning.com/walls3/sample-ch01.pdf) for ):
![From Manning's Spring in Action](https://i.stack.imgur.com/GhMUK.png)
With the help especially of [Tormod Fjeldskår](https://stackoverflow.com/users/27220/tormod-fjeldsk229r) here's the complete snippet to produce the desired look:
```
\usepackage{listings}
\usepackage{courier}
\lstset{
basicstyle=\footnotesize\ttfamily, % Default font
% numbers=left, % Location of line numbers
numberstyle=\tiny, % Style of line numbers
% stepnumber=2, % Margin between line numbers
numbersep=5pt, % Margin between line numbers and text
tabsize=2, % Size of tabs
extendedchars=true,
breaklines=true, % Lines will be wrapped
keywordstyle=\color{red},
frame=b,
% keywordstyle=[1]\textbf,
% keywordstyle=[2]\textbf,
% keywordstyle=[3]\textbf,
% keywordstyle=[4]\textbf, \sqrt{\sqrt{}}
stringstyle=\color{white}\ttfamily, % Color of strings
showspaces=false,
showtabs=false,
xleftmargin=17pt,
framexleftmargin=17pt,
framexrightmargin=5pt,
framexbottommargin=4pt,
% backgroundcolor=\color{lightgray},
showstringspaces=false
}
\lstloadlanguages{ % Check documentation for further languages ...
% [Visual]Basic,
% Pascal,
% C,
% C++,
% XML,
% HTML,
Java
}
% \DeclareCaptionFont{blue}{\color{blue}}
% \captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}
```
Use it with this in your document:
```
\lstinputlisting[label=samplecode, caption=A sample]{sourceCode/HelloWorld.java}
```
| LaTeX source code listing like in professional books | CC BY-SA 4.0 | 0 | 2009-04-12T16:15:51.500 | 2018-08-27T11:59:54.067 | 2018-08-27T11:59:54.067 | 10,224,740 | 77,184 | [
"latex"
] |
746,353 | 1 | null | null | 19 | 33,055 | I would like to include a flip counter on my site, similar to what Apple was using for their [1 billion app countdown](http://www.macrumors.com/2009/04/10/apple-launches-1-billion-app-countdown-promotion/).
![enter image description here](https://i.stack.imgur.com/cHLPq.jpg)
Can anyone get their JavaScript to work standalone?
| JavaScript Flip Counter | CC BY-SA 3.0 | 0 | 2009-04-14T04:30:03.897 | 2021-04-08T08:16:52.433 | 2011-11-29T17:37:02.590 | 325,514 | null | [
"javascript",
"animation",
"counter",
"flip"
] |
750,419 | 1 | 750,493 | null | 1 | 1,875 | I have two computers. One computer is an old XP and the other is a new Vista.
I have dowloaded and pretty much tested an installation of VS2008ProEdition90dayTrialENUX1435622.iso without any problems on the XP computer.
The Vista computer (where I need to do my work and where I have all the hard drive space, etc) has been pretty eventful -- in a bad way.
It seemed that the iso file, itself did not download correctly. So I did it a few times. When I ran the installer, it did some sort of file extraction on a first step (71 files, I remember) and it seemd to die on the same file.
My Vista computer has a brand new OS and a brand new hard drive. I do not understand why it is giving me so much trouble.
Eventually I resorted to FTP'ing the iso file along with all the extracted files from my XP computer to my Vista computer.
Then I managed to get further.
But it still behaves strangely.
One thing I notice is that the license agreement is missing.
![alt text](https://i67.photobucket.com/albums/h292/Athono/wtf.jpg)
That is pretty wierd.
When I get to the point where I am supposed to start the installation, the installer lights up with errors.
There are so many that I do not know where to begin.
![alt text](https://i67.photobucket.com/albums/h292/Athono/wtf2.jpg)
Where do I begin?
I have tried running the iso from a virtual drive with the DAEMON toolset. That did not make a difference.
I have tried running as an Administrator. That did not make a difference.
I have tried shutting down all programs and even uninstalling anti-virus programs. That did not make a difference.
I have used the windows DVD burn utility to burn the files onto a DVD and run it from there. That did not make a difference.
And the wierdness continues. The C:\Users...\AppData\Local\Temp\dd_error_vs_procore_90.txt
has error messages that read that there is a problem copying from the F drive. Well, I do not have an F drive.
I have even gone so far is to create a virtual F drive through a network connection to myself pointing to the DVD drive.
That did not work either.
Any suggestions?
Yes, I have posted this question with the Microsoft People. I am waiting for an answer. Maybe StackOverflow can beat them.
| Problems With VS2008 Pro Edition 90 day Trial | CC BY-SA 2.5 | null | 2009-04-15T05:26:49.260 | 2011-05-22T19:01:53.870 | 2017-02-08T14:11:28.210 | -1 | 54,760 | [
"visual-studio-2008",
"windows-vista",
"installation"
] |
751,567 | 1 | 1,330,933 | null | 5 | 9,114 | I'm trying to make a plot with pylab/matplotlib, and I have two different sets of units for the x axis. So what I would like the plot to have is two axis with different ticks, one on the top and one on the bottom. (E.g. one with miles and one with km or so.)
Something like the graph below (but than I would like multiple X axes, but that doesn't really matter.)
![Multiple axis with JpGraph](https://i.stack.imgur.com/gCIBN.png)
Anyone an idea whether this is possible with pylab?
| both a top and a bottom axis in pylab (e.g. w/ different units) (or left and right) | CC BY-SA 3.0 | 0 | 2009-04-15T12:57:27.913 | 2020-02-29T12:38:15.807 | 2020-02-29T11:19:44.030 | 1,621,041 | 2,097 | [
"python",
"matplotlib",
"plot",
"axes"
] |
751,624 | 1 | 751,917 | null | 0 | 12,006 | I need to put 2 divs side by side. But what's more important, I want this to display correctly in IE6/7. I have managed to succeed this with Firefox though.
My code:
```
#container{
padding:10px;
}
#left{
float:left;
width:500px;
}
#right{
width: 300px;
float:right;
padding:7px;
background-color:#F0FCEB;
}
<div id="box">
<div id="left">Some content here</div>
<div id="right">Some content here 2</div>
<div style="clear:both;"></div>
</div>
```
The results are as shown below:
Desired Output (FF Output):
![Desired output](https://i.stack.imgur.com/PCGnT.gif)
IE6/7 Output:
![IE6/7 output](https://i.stack.imgur.com/XK5Ca.gif)
How can I get rid of this unnecessary padding in IE, or is there any other method?
Note: I use jQuery and Nifty for jQuery to create rounded corners.
| Putting 2 divs side by side / Internet Explorer 6/7 float and padding (?) bug fix | CC BY-SA 3.0 | null | 2009-04-15T13:11:06.227 | 2015-06-19T20:46:22.590 | 2015-06-19T20:46:22.590 | 1,159,643 | 87,997 | [
"html",
"internet-explorer",
"css-float",
"css"
] |
751,840 | 1 | 752,458 | null | 5 | 15,805 | I've tried to research this on Google but there doesn't appear to me to be any coherent simple answers. Is this because it's not simple, or because I'm not using the correct keywords?
Nevertheless, this is the progress I've made so far.
1. Created 8 vertices to form 2 squares.
2. Created a texture with a 200 bit alpha value (so, about 80% transparent).
3. Assigned the same texture to each square, which shows correctly.
4. Noticed that when I use a texture with 255 alpha, it appears brighter.
The init is something like the following:
```
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, textureIds);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
int i, j;
GLubyte pixel;
for (i = 0; i < TEXTURE_HEIGHT; i++)
{
for (j = 0; j < TEXTURE_WIDTH; j++)
{
pixel = ((((i & 0x8) == 0) ^ ((j & 0x8) == 0)) * 255);
texture[i][j][0] = pixel;
texture[i][j][1] = pixel;
texture[i][j][2] = pixel;
texture[i][j][3] = 200;
}
}
glBindTexture(GL_TEXTURE_2D, textureIds[0]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA,
TEXTURE_WIDTH, TEXTURE_HEIGHT,
0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
```
This is somewhat similar to the code snippet from page 417 in the book, , and creates a check pattern.
And then, the display function contains...
```
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
// Use model view so that rotation value is literal, not added.
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// ... translation, etc ...
glBindTexture(GL_TEXTURE_2D, textureIds[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, +1.0, 0.0); // top left
glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, -1.0, 0.0); // bottom left
glTexCoord2f(1.0, 1.0); glVertex3f(+1.0, -1.0, 0.0); // bottom right
glTexCoord2f(1.0, 0.0); glVertex3f(+1.0, +1.0, 0.0); // top right
glEnd();
// not neccecary to repeat, just good practice
glBindTexture(GL_TEXTURE_2D, textureIds[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-0.5, +1.0, -1.0); // top left
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, -1.0, -1.0); // bottom left
glTexCoord2f(1.0, 1.0); glVertex3f(+1.5, -1.0, -1.0); // bottom right
glTexCoord2f(1.0, 0.0); glVertex3f(+1.5, +1.0, -1.0); // top right
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);
glPopMatrix();
SwapBuffers();
```
So, this renders a 2nd square in the background; I can see this but it looks like they're being blended with the background (I assume this because they are darker with 200 bit alpha than 255 bit) instead of the texture behind...
![Transparent textures not working](https://i.stack.imgur.com/ducoN.png)
As you can see, no transparency... How can I fix this?
| How do I make textures transparent in OpenGL? | CC BY-SA 3.0 | 0 | 2009-04-15T14:01:16.650 | 2015-06-19T20:48:55.530 | 2015-06-19T20:48:55.530 | 1,159,643 | 47,775 | [
"c++",
"opengl",
"textures",
"opacity"
] |
752,182 | 1 | 752,212 | null | 1 | 924 | I've got the following ADO.NET Entity Framework Entity Data Model:
![ADO.NET Entity Data Model](https://i.stack.imgur.com/4lEIL.gif)
I want to find all the Policyholders with both a Service of a given Id and also a Keyword of a given Status.
This LINQ Does Not Work:
```
Dim ServicesId As Integer = ...
Dim KeywordStatus As Integer = ...
Dim FoundPolicyholders = From p As Policyholder In db.PolicyholderSet.Include("Keywords").Include("Services") _
Where p.Services.Id = ServicesId _
And p.Keywords.Status = KeywordStatus _
Select p
```
The Where clause cannot search the p.Services and p.Keywords EntityCollections in that way.
> 'Id' is not a member of
'System.Data.Objects.DataClasses.EntityCollection(Of
....Service)'.
What is the correct LINQ syntax to do what I want?
| How do I search the collection of a collection in my LINQ Where clause? | CC BY-SA 3.0 | null | 2009-04-15T15:16:39.420 | 2015-06-19T20:34:19.387 | 2015-06-19T20:34:19.387 | 1,159,643 | 83 | [
".net",
"vb.net",
"linq",
"entity-framework",
"lambda"
] |
753,140 | 1 | 753,214 | null | 23 | 48,535 | Suppose there are a number of convex polygons on a plane, perhaps a map. These polygons can bump up against each other and share an edge, but cannot overlap.
![alt text](https://i.stack.imgur.com/AkGPs.jpg)
To test if two polygons and overlap, first I can test each edge in to see if it intersects with any of the edges in . If an intersection is found, I declare that and intersect. If none intersect, I then have to test for the case that is completely contained by , and vice versa. Next, there's the case that ==. Finally, there's the case that share a few edges, but not all of them. (These last two cases can probably be thought of as the same general case, but that might not be important.)
I have an algorithm that detects where two line segments intersect. If the two segments are co-linear, they are not considered to intersect for my purposes.
Have I properly enumerated the cases? Any suggestions for testing for these cases?
Note that I'm not looking to find the new convex polygon that is the intersection, I just want to know if an intersection exists. There are many well documented algorithms for finding the intersection, but I don't need to go through all the effort.
| How do I determine if two convex polygons intersect? | CC BY-SA 3.0 | 0 | 2009-04-15T18:49:42.167 | 2017-11-29T21:16:34.497 | 2017-06-15T11:54:06.893 | 5,769,497 | 6,688 | [
"geometry",
"polygon",
"convex"
] |
757,009 | 1 | 758,121 | null | 1 | 3,397 | There are two QTreeViews in the screenshot below. For the one on the right, I've add a css customization:
```
setStyleSheet(
"background-color: #EAF5FF;"
"alternate-background-color: #D5EAFF;"
);
```
Notice however, the scrollbar appearance has changed. It went to the "windows" style, not the "windowsxp" style (which is the default, since I'm developing under Xp).
I'm using QT 4.5 and Windows XP.
![ScreenShot](https://farm4.static.flickr.com/3354/3448020876_614237a58e_o.jpg)
| QTreeView stylesheet customization problem with scrollbar | CC BY-SA 2.5 | null | 2009-04-16T16:45:36.980 | 2013-09-11T00:01:40.433 | 2017-02-08T14:11:29.903 | -1 | 45,799 | [
"qt"
] |
758,638 | 1 | 762,755 | null | 5 | 3,738 | I'm trying to load a texture with RGBA values but the alpha values just seem to make the texture more white, not adjust the transparency. I've heard about this problem with 3D scenes, but I'm just using OpenGL for 2D. Is there anyway I can fix this?
I'm initializing OpenGL with
```
glViewport(0, 0, winWidth, winHeight);
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST);
glClearColor(0, 0, 0, 0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, winWidth, 0, winHeight); // set origin to bottom left corner
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1, 1, 1);
```
---
Screenshot:
![](https://i.stack.imgur.com/2HnoT.png)
That washed out dotty image should be semitransparent. The black bits are supposed to be completely transparent. As you can see, there's an image behind it that isn't showing through.
The code to generate that texture is rather lengthy, so I'll describe what I did. It's a 40*30*4 array of type unsigned char. Every 4th char is set to 128 (should be 50% transparent, right?).
I then pass it into this function, loads the data into a texture:
```
void Texture::Load(unsigned char* data, GLenum format) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, _texID);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _w, _h, format, GL_UNSIGNED_BYTE, data);
glDisable(GL_TEXTURE_2D);
}
```
And...I think I just found the problem. Was initializing the full-sized texture with this code:
```
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, _texID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tw, th, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable(GL_TEXTURE_2D);
```
But I guess glTexImage2D needs to be GL_RGBA too? I can't use two different internal formats? Or at least not ones of different sizes (3 bytes vs 4 bytes)? GL_BGR works fine even when its initialized like this...
| OpenGL alpha value makes texture whiter? | CC BY-SA 3.0 | 0 | 2009-04-17T00:56:20.607 | 2015-06-19T20:44:17.303 | 2015-06-19T20:44:17.303 | 1,159,643 | 65,387 | [
"opengl",
"textures"
] |
760,363 | 1 | 765,465 | null | 1 | 745 | I created a custom lookup field type which works fine. However, there is a context menu for every item in columns of this type.
![the unwanted SharePoint drop-down menu](https://i.stack.imgur.com/hOfby.png)
I to add this context menu.
How to get rid of it?
| Unwanted SharePoint context menu | CC BY-SA 3.0 | null | 2009-04-17T13:16:10.657 | 2011-12-02T13:21:44.033 | 2011-12-02T13:21:44.033 | 95 | 95 | [
"sharepoint"
] |
763,056 | 1 | null | null | 0 | 747 | Right now, Reddit is down. Every time you go to it, it displays a logo and below it a funny message. Every time you refresh the page it displays a new message.
![alt text](https://imgur.com/NS87G.png)
How could I write something simple that ~rotates~ (not random) a line of text on the page every refresh?
I'm using ASP.NET MVC but if there is a JavaScript solution to this problem that is fine too.
| How can I rotate a line of text each page refresh? | CC BY-SA 2.5 | null | 2009-04-18T06:59:14.983 | 2009-04-19T01:57:04.280 | 2009-04-18T18:57:57.033 | 88,470 | 88,470 | [
"asp.net",
"asp.net-mvc"
] |
764,042 | 1 | 764,123 | null | 2 | 2,684 | ![alt text](https://www.reddit.com/static/aupgray.gif)![alt text](https://www.reddit.com/static/adowngray.gif)
uparrow.gif and downarrow.gif
So, it would look like so:
![alt text](https://www.reddit.com/static/aupgray.gif)
![alt text](https://www.reddit.com/static/adowngray.gif)
How can I create 3 divs and style them with CSS so those arrows are positions with the top arrow above the bottom arrow?
```
<div class="vote">
<div class="uparrow" />
<div class="downarrow" />
</div>
```
Should I create a "vote" div with restricted width? Would I float: top and float: bottom the two arrow divs with the background set as my two images? I plan on having content directly to the right of the vote arrows so it needs to be restricted and tight.
| How can I stack two arrow images (upvote/downvote) on top of eachother using CSS? | CC BY-SA 2.5 | 0 | 2009-04-18T19:43:07.613 | 2009-04-18T20:29:43.523 | 2017-02-08T14:11:31.603 | -1 | 88,470 | [
"css"
] |
764,183 | 1 | null | null | 1 | 3,103 | I have a content type with a CCK integer field which takes a unix timestamp. I would like to create a view with a filter that takes the MySQL function "UNIX_TIMESTAMP":
![screenshot](https://i.stack.imgur.com/EOJur.png)
If there is no way of doing this, how can I alter the SQL generated for the view?
| Use SQL to Filter Drupal Views | CC BY-SA 3.0 | 0 | 2009-04-18T20:53:36.397 | 2013-05-31T01:01:21.210 | 2013-05-31T01:01:21.210 | 225,647 | 80,857 | [
"php",
"drupal",
"drupal-views",
"cck",
"drupal-exposed-filter"
] |
764,415 | 1 | 773,516 | null | 4 | 1,823 | I know there are methods to [approximate cubic Bezier curves](https://stackoverflow.com/questions/427796/approximating-nonparametric-cubic-bezier) ([this page](http://www.timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm) was also a good reference), but is there a quicker method to approximate a bezier curve of degree N? Or can you only use the generalization below?
From wikipedia:
The Bézier curve of degree n can be generalized as follows. Given points P0, P1,..., Pn, the Bézier curve is:
![alt text](https://upload.wikimedia.org/math/e/e/5/ee540a45155c347d28adddfcb0486b42.png)
| Approximating Bezier Curves of Degree N | CC BY-SA 2.5 | 0 | 2009-04-18T22:58:00.187 | 2013-07-09T21:58:25.777 | 2017-05-23T10:29:37.043 | -1 | 24,717 | [
"bezier"
] |
766,662 | 1 | 766,677 | null | 5 | 533 | Is pressing only way to indent for F# in #light mode?
This seems like a serious hindrance while using #light mode.
Is there a better way than keep on pressing space bar in VS 2008?
![alt text](https://farm4.static.flickr.com/3568/3457340817_669bf150e8_o.png)
by Brian ([answer](https://stackoverflow.com/questions/766662/how-to-indent-f-code-in-visual-studio-2008-in-light-mode/766677#766677))
1. Go to `Tools -> Options -> Text Editor -> F# -> Tabs`
2. Select Insert Spaces
![alt text](https://farm4.static.flickr.com/3632/3458809921_1c9a94f6ff_o.png)
| How to indent F# code in Visual Studio 2008 in #light mode | CC BY-SA 2.5 | null | 2009-04-20T02:31:26.547 | 2009-04-20T14:21:36.887 | 2017-05-23T11:53:27.760 | -1 | 4,035 | [
"visual-studio",
"f#",
"indentation"
] |
768,282 | 1 | 768,307 | null | 64 | 69,504 | I am trying to delete files in my `$(TargetDir)` within visual studio before building a project.
How do you have to format command line to get around this problem I am getting below?
![alt text](https://farm4.static.flickr.com/3575/3459516474_65f59767d4_o.png)
| How to delete files in Visual Studio Pre-build event command line | CC BY-SA 2.5 | 0 | 2009-04-20T13:35:27.603 | 2022-09-20T07:49:51.470 | 2017-02-08T14:11:33.323 | -1 | 4,035 | [
"visual-studio",
"command-line",
"build-process",
"pre-build-event"
] |
768,304 | 1 | 789,315 | null | 7 | 5,080 |
---
In the wiki spirit of StackOverflow, here's an update:
I spiked Joe White's IValueConverter suggestion below. It works like a charm.
I've written a "quickstart" example of this that automates the mapping of ViewModels->Views using some cheap string replacement. If no View is found to represent the ViewModel, it defaults to an "Under Construction" page. I'm dubbing this approach "WPF MVVM White" since it was Joe White's idea. Here are a couple screenshots.
The first image is a case of "[SomeControlName]ViewModel" has a corresponding "[SomeControlName]View", based on . The second is a case where the ModelView doesn't have any views to represent it. No more ResourceDictionaries with long ViewModel to View mappings. It's pure naming convention now.
![Wpf Mvvm White](https://i.stack.imgur.com/vnZOm.jpg)
I posted a download of the project here:
[Mvvm.White.Quickstart.zip](https://dl.dropbox.com/u/19646117/Mvvm.White.Quickstart.zip)
---
I read Josh Smith's [fantastic MSDN article](http://msdn.microsoft.com/en-us/magazine/dd419663.aspx) on WPF MVVM over the weekend. It's destined to be a cult classic.
It took me a while to wrap my head around the magic of asking WPF to render the .
It's like saying "Here's a class, WPF. Go figure out which UI to use to present it."
For those who missed this magic, WPF can do this by looking up the for in the ResourceDictionary mapping and pulling out the corresponding . (Scroll down to [Figure 10 Supplying a View](http://msdn.microsoft.com/en-us/magazine/dd419663.aspx)).
The first thing that jumps out at me immediately is that there's already a strong naming convention of:
```
classNameView ("View" suffix)
classNameViewModel ("ViewModel" suffix)
```
My question is:
Since the [ResourceDictionary](http://msdn.microsoft.com/en-us/library/system.windows.resourcedictionary.aspx) can be manipulated programatically, I"m wondering if anyone has managed to Regex.Replace the whole thing away, , and any new View/ViewModels get resolved by virtue of their naming convention?
[Edit] What I'm imagining is a hook/interception into ResourceDictionary.
... Also considering a method at startup that uses interop to pull out `*View$` and `*ViewModel$` class names to build the DataTemplate dictionary in code:
```
//build list
foreach ....
String.Format("<DataTemplate DataType=\"{x:Type vm:{0} }\"><v:{1} /></DataTemplate>", ...)
```
| WPF MVVM: Convention over Configuration for ResourceDictionary? | CC BY-SA 3.0 | 0 | 2009-04-20T13:40:26.923 | 2015-06-19T20:44:06.890 | 2015-06-19T20:44:06.890 | 1,159,643 | 83,418 | [
"wpf",
"mvvm"
] |
769,531 | 1 | 796,013 | null | 0 | 1,732 | I have been playing with some of the imaging functionality in Java, trying to superimpose one image over another. Like so:
```
BufferedImage background = javax.imageio.ImageIO.read(
new ByteArrayInputStream(getDataFromUrl(
"https://www.google.com/intl/en_ALL/images/logo.gif"
))
);
BufferedImage foreground = javax.imageio.ImageIO.read(
new ByteArrayInputStream(getDataFromUrl(
"https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif"
))
);
WritableRaster backgroundRaster = background.getRaster();
Raster foregroundRaster = foreground.getRaster();
backgroundRaster.setRect(foregroundRaster);
```
Basically, I was attempting to superimpose this: [https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif](https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif)
![flower](https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif)
on this: [https://www.google.com/intl/en_ALL/images/logo.gif](https://www.google.com/intl/en_ALL/images/logo.gif)
![alt text](https://www.google.com/intl/en_ALL/images/logo.gif)
The product appears as: [http://imgur.com/xnpfp.png](https://imgur.com/xnpfp.png)
![crappy image](https://imgur.com/xnpfp.png)
From the examples I have seen, this seems to be the appropriate method. Am I missing a step? Is there a better way to handle this? Thank you for your responses.
| Java: using WritableRaster.setRect to superimpose an image? | CC BY-SA 2.5 | 0 | 2009-04-20T18:33:01.697 | 2009-11-14T03:33:16.717 | 2017-02-08T14:11:34.010 | -1 | 93,328 | [
"java",
"image",
"image-manipulation",
"raster"
] |
770,726 | 1 | 772,728 | null | 179 | 51,205 | I'm using Team Foundation Server 2008 (SP 1) and I need to move multiple files from one folder to another (to retain file history). In addition to Team Explorer (with SP 1) I've also got the latest TFS Power Tools (October 2008) installed (for Windows Shell integration).
Now, the problem is that I can't seem to select and move multiple files via either the shell or the Source Control Explorer window. I can move individual files (by right clicking + "Move") and I can move whole folders (same operation) but when I select multiple files (in a folder) the "Move" context item is grayed/disabled.
Does anyone know if this is possible.. and if not.. why not!?
Can anyone suggest a workaround which isn't overly complicated?
[https://connect.microsoft.com/VisualStudio/feedback/details/715041/support-moving-multiple-files-in-tfs-source-control-explorer](https://connect.microsoft.com/VisualStudio/feedback/details/715041/support-moving-multiple-files-in-tfs-source-control-explorer) [http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2271540-allow-to-move-more-than-one-file-at-once-in-tfs-so](http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2271540-allow-to-move-more-than-one-file-at-once-in-tfs-so)
![enter image description here](https://i.stack.imgur.com/QQWi4.png)
![enter image description here](https://i.stack.imgur.com/8t53e.png)
| Moving multiple files in TFS Source Control | CC BY-SA 3.0 | 0 | 2009-04-21T01:36:43.267 | 2022-05-03T11:24:45.760 | 2014-08-14T10:06:15.167 | 248,616 | 18,471 | [
"version-control",
"tfs"
] |
771,148 | 1 | 771,168 | null | 3 | 724 | I'm having some trouble identifying the problem with my html code. I've created a table and it is like this on Internet Explorer (which is the result I'm looking for):
![IE](https://i260.photobucket.com/albums/ii17/rawpinions/01-3.png)
But it comes up like this on Firefox:
![Firefox](https://i260.photobucket.com/albums/ii17/rawpinions/02-3.png)
...and I don't know how to fix this. Please help, thanks.
| HTML border differences in FF and IE | CC BY-SA 2.5 | 0 | 2009-04-21T05:25:16.667 | 2009-04-21T05:36:16.470 | 2017-02-08T14:11:34.680 | -1 | 92,881 | [
"html",
"css",
"cross-browser",
"browser"
] |
775,284 | 1 | 775,319 | null | 0 | 852 | I'm trying to understand the difference between using a `UINavigationController` inside a Nib (via the library window) and subclassing the `UINavigationController`. (For the purposes of this question, I'm not just specifically referring to a Navigation Controller; I'm referring to any Controller that is contained in the Library window in Interface Builder.)
To start, I suppose my first question is: Does adding a 'Controller' from the library to a nib create an instance of that controller? If not, what is the purpose or the normal end goal in doing that. I've had trouble finding any material that truly explains that part of IB. Here is a screen shot to help illustrate my question.
![Xcode nib window](https://i.stack.imgur.com/ylVZM.jpg)
In my screen shot of the nib window, what happens when I add the `UITabBarController` to the nib? Does that give me an instances of a `UITabBarController`?
The final part of my question is (assuming my initial assumption is correct), why would I subclass the `UITabBarController` class (in this case) instead of adding it to the nib?
![Xcode library](https://i.stack.imgur.com/42qTu.jpg)
| iPhone - Difference between a Library UINavigationController and my subclassing UINavigationController | CC BY-SA 3.0 | null | 2009-04-22T00:39:54.630 | 2012-03-09T04:56:23.667 | 2012-03-09T04:56:23.667 | 19,329 | 18,196 | [
"iphone",
"cocoa-touch",
"uinavigationcontroller",
"controller",
"uitabbarcontroller"
] |
776,071 | 1 | 776,077 | null | 16 | 5,961 | I noticed that the bash shell can suggest command line switches for your command.
Just type your command, a dash (-) and type tab. The shell will show you available switches.
For example, try:
```
andy@andyx:~$ java -
```
and press tab - Surprise!
![Screenshot](https://i.stack.imgur.com/TYqIS.png)
The question is:
| Surprise! the shell suggests command line switches | CC BY-SA 3.0 | 0 | 2009-04-22T07:48:38.450 | 2017-01-02T10:30:03.993 | 2017-01-02T10:30:03.993 | 660,921 | 63,051 | [
"linux",
"bash",
"shell",
"command-line"
] |
777,834 | 1 | 777,972 | null | 0 | 433 | I would like to create a similar effect to Apple's Safari 4 Beta Top Sites page -
![http://farm4.static.flickr.com/3644/3323438140_10b62d40f4.jpg](https://i.stack.imgur.com/PXqUN.jpg)
when when you view it and a page's content has changed since you last visited, it displays a blue star in the top right hand corner to notify you.
I would like to do the very same, but only within my website and instead of an image I would like to append a '*' or some other character to the menu item's link.
I'm sure you would use the jQuery Cookie Plugin, but my scripting is not that advanced and I do not know how to dynamically change the cookie's content. Have I explained properly? How would I do it?
Many thanks in advance
| Use jQuery to append star to menu item if the linked page's content has changed since last visit | CC BY-SA 3.0 | null | 2009-04-22T15:29:09.203 | 2013-07-19T14:05:55.387 | 2013-07-19T14:05:55.387 | 2,556,654 | 91,359 | [
"javascript",
"jquery",
"cookies",
"append"
] |
780,977 | 1 | 781,025 | null | 1 | 1,680 | I'm currently facing huge problem i.e I'm showing Image and some text in a image the problem is when I change content property of button from code, my image disappears and only assigned text is shown, I wan to retain image and just wann change the text, Any suggetions how to handle it
```
<Button x:Name="btnPrescan" Margin="8" Grid.Column="2" Click="btnPrescan_Click">
<StackPanel Orientation="Horizontal">
<Image Source="Icons\Scan_Start_Icon.png" Height="14" Width="23"/>
<TextBlock x:Name="tbButtonText" Text=" Prescan"/>
</StackPanel>
</Button>
```
and button looks something like this
![alt text](https://lh6.ggpht.com/_M5W2QFQgto4/SfA09QAs2dI/AAAAAAAADTw/5nAY2qgUwtU/Button.jpg)
Thanks
| Handling Content property in WPF | CC BY-SA 2.5 | null | 2009-04-23T09:34:01.387 | 2011-09-27T16:55:58.740 | 2017-02-08T14:11:37.720 | -1 | 85,606 | [
"c#",
"wpf",
"wpf-controls"
] |