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
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,073,224 | 1 | 4,084,401 | null | 1 | 2,878 | I have created a startcam from my app.. and this is how the cam activity looks like.. I don't know how to klick to take a picture, where is the button?
What I want to do is also that when he has taken the picture and he is statiesfied, he click on a "finished button" so the picture will be shown on my app.

| Android: using camera help, take a picture and use it on my app | CC BY-SA 2.5 | 0 | 2010-11-01T21:30:43.107 | 2012-11-04T21:06:24.053 | null | null | 371,301 | [
"android",
"camera",
"android-emulator"
] |
4,073,296 | 1 | 4,082,095 | null | 4 | 1,392 | I created a custom UserControl that functions much like a numbericUpDown but with various enhancements. For example, it can display fractions. However, this control does not scale as well as some of my other controls on my form, forcing my UI to look awkward.
I played around with the AutoScaleMode of both the control and it's parent control. Nothing seems to work, though setting the AutoScaleMode to None seems to have less impact than the other settings. I also tried manually to lessen the size of the control in relation to the dropdown next to it. It didn't work. I'm pretty much stuck and I don't know how to counter this.

Any suggestions?
I am enabling DPI awareness for Win7 and higher.
| DPI not scaling properly | CC BY-SA 2.5 | null | 2010-11-01T21:40:24.050 | 2010-11-02T21:05:28.683 | 2010-11-01T21:46:07.123 | 23,199 | 318,811 | [
"c#",
"winforms",
"dpi"
] |
4,073,998 | 1 | 4,076,937 | null | 1 | 5,746 | Here's what I got so far. I rewrote the code to simplify things a bit. Previous code wasn't actually the real, basic algorithm. It had fluff that I didn't need. I answered the question about pitch, and below you'll see some images of my test results.
```
local function Line (buf, x1, y1, x2, y2, color, pitch)
-- identify the first pixel
local n = x1 + y1 * pitch
-- // difference between starting and ending points
local dx = x2 - x1;
local dy = y2 - y1;
local m = dy / dx
local err = m - 1
if (dx > dy) then -- // dx is the major axis
local j = y1
local i = x1
while i < x2 do
buf.buffer[j * pitch + i] = color
if (err >= 0) then
i = i + 1
err = err - 1
end
j = j + 1
err = err + m
end
else -- // dy is the major axis
local j = x1
local i = y1
while i < y2 do
buf.buffer[i * pitch + j] = color
if (err >= 0) then
i = i + 1
err = err - 1
end
j = j + 1
err = err + m
end
end
end
-- (visdata[2][1][576], int isBeat, int *framebuffer, int *fbout, int w, int h
function LibAVSSuperScope:Render(visdata, isBeat, framebuffer, fbout, w, h)
local size = 5
Line (self.buffer, 0, 0, 24, 24, 0xffff00, 24)
do return end
end
```
Edit: Oh I just realized something. 0,0 is in the lower left-hand corner. So the function's sort of working, but it's overlapping and slanted.
Edit2:
Yeah, this whole thing's broken. I'm plugging numbers into Line() and getting all sort of results. Let me show you some.
Here's `Line (self.buffer, 0, 0, 23, 23, 0x00ffff, 24 * 2)`

And here's `Line (self.buffer, 0, 1, 23, 23, 0x00ffff, 24 * 2)`

Edit: Wow, doing `Line (self.buffer, 0, 24, 24, 24, 0x00ffff, 24 * 2)` uses way too much CPU time.
Edit: Here's another image using this algorithm. The yellow dots are starting points.
```
Line (self.buffer, 0, 0, 24, 24, 0xff0000, 24)
Line (self.buffer, 0, 12, 23, 23, 0x00ff00, 24)
Line (self.buffer, 12, 0, 23, 23, 0x0000ff, 24)
```

Edit: And yes, that blue line wraps around.
| Drawing a line between two points | CC BY-SA 2.5 | 0 | 2010-11-01T23:39:02.330 | 2010-11-02T10:59:58.543 | 2010-11-02T04:34:06.733 | 104,304 | 104,304 | [
"lua",
"line"
] |
4,074,017 | 1 | 4,074,825 | null | 2 | 5,061 | I've found the solution, it was more simple than I could have hoped. Thanks for your time. =) (Answered my own question with full solution)
My apologies that my post was not transparent enough.. I will try to iterate for a little more clarity. I am not simply trying to contain things and have the container resize without the contents resizing. I would just use a simple MovieClip for that.. . I'm trying to make a repeating background image for a container; thus far I'm able to draw my BitmapFill sprite to the size I want. (Which is the stage's height) but when the stage is resized, I want to re-size my container but have my containers BitmapFill crop or add more as the window is resized bigger or smaller. Allow me to illustrate what I mean:

I hope this clears up any confusion and helps with any straighter answers.
I've got a simple rectangle sprite that fills with a bitmap from the library and a simple resize handler function that detects when the window has been resized.
What I would like to do is have my rectangle resize to the height of the stage.stageHeight maintaining its bitmap fill, but the bitmap fill or any children within the sprite.
From what I've read, this is a little tricky because the sprite resizes in relation to what it contains.. or.. something like that.. I really don't know any more.. I saw one example where a person extended the sprite class but I don't know why or how..
in my library there is an image called 'pattern' and my code looks like this:
```
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);
var bgData:pattern = new pattern(0,0);
var bg:Sprite = new Sprite();
bg.graphics.beginBitmapFill(bgData, null, true, false);
bg.graphics.drawRect( 0, 0, 80, stage.stageHeight);
bg.graphics.endFill();
addChild(bg);
function resizeHandler(e:Event=null):void
{
trace("dimensions are: " + stage.stageWidth + " x " + stage.stageHeight);
bg.height = stage.stageHeight; //simply makes the fill resize also
}
```
| AS3: Resizing a sprite without resizing its BitmapFill (or its contents for that matter)? | CC BY-SA 3.0 | 0 | 2010-11-01T23:43:43.947 | 2013-07-17T03:57:57.697 | 2013-07-17T03:57:57.697 | 229,044 | 478,222 | [
"actionscript-3",
"actionscript",
"resize",
"bitmap",
"sprite"
] |
4,074,181 | 1 | null | null | 0 | 840 | I have problem with width of ImageButtons, it isn't the same size. I have experimented with all attributes for two hours and nothing. I create buttons at runtime and put inside row (also created at runtime). Does anybody know any solution for this ?

```
public static TableRow[] Create(List<Apartment> list){
TableRow[] rows=null;
try{
rows=new TableRow[list.size()*3];
int i=0;
for(final Apartment ap : list){
rows[3*i]=new TableRow(activity);
rows[3*i+1]=new TableRow(activity);
rows[3*i+2]=new TableRow(activity);
rows[3*i].setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.FILL_PARENT));
rows[3*i+1].setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.FILL_PARENT));
rows[3*i+2].setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.FILL_PARENT));
rows[3*i].setBackgroundColor(color_background[(i%2)]);
rows[3*i+1].setBackgroundColor(color_background[(i%2)]);
rows[3*i+2].setBackgroundColor(color_background[(i%2)]);
TextView txtMainInform=new TextView(activity);
txtMainInform.setText(ap.GetMainInformation());
txtMainInform.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
rows[3*i].addView(txtMainInform);
rows[3*i].setVisibility(1);
TextView txtMoreInform=new TextView(activity);
txtMoreInform.setText(ap.GetMoreInformation());
txtMoreInform.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
rows[3*i+1].addView(txtMoreInform);
ImageButton imbCall=new ImageButton(activity);
imbCall.setImageResource(R.drawable.phone);
imbCall.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if(ap.GetContact()!=null){
try {
activity.startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + ap.GetContact())));
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
imbCall.setMaxWidth(24);
imbCall.setMinimumWidth(22);
ImageButton imbGallery=new ImageButton(activity);
imbGallery.setMaxWidth(24);
imbGallery.setMinimumWidth(22);
imbGallery.setImageResource(R.drawable.gallery_icon);
ImageButton imbMap=new ImageButton(activity);
imbMap.setImageResource(R.drawable.map);
imbMap.setMaxWidth(24);
imbMap.setMinimumWidth(22);
imbMap.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(activity,ResultMap.class);
activity.startActivity(i);
}
});
ImageButton imbWay=new ImageButton(activity);
imbWay.setMaxWidth(24);
imbWay.setMinimumWidth(22);
imbWay.setImageResource(R.drawable.walker);
rows[3*i+2].addView(imbCall);
rows[3*i+2].addView(imbGallery);
rows[3*i+2].addView(imbMap);
rows[3*i+2].addView(imbWay);
i++;
}
}
catch(Exception e){
}
return rows;
}
```
| ImageButton isn't the same size | CC BY-SA 2.5 | null | 2010-11-02T00:34:49.733 | 2013-07-11T08:46:12.373 | 2013-07-11T08:46:12.373 | null | 486,578 | [
"android",
"android-button",
"android-image"
] |
4,074,565 | 1 | 4,074,765 | null | 4 | 5,826 | >
[Read/Write 'Extended' file properties (C#)](https://stackoverflow.com/questions/220097/read-write-extended-file-properties-c)
Does anyone know how to get the information contained in the tab of a File's properties window? Any .NET library I'm overlooking?
This is the window/information I'm talking about:

It seems like there would be a better way to access these data rather than having to employ various methods to extract metadata of various file types, since there's certainly some overlap on the categories of information available under this tab, even for different file types. But search as I might, I haven't come across anyone wanting to do this for any (or many) file types -- quite a few discussions on grabbing metadata for specific file types though.
Any suggestions you may have would be most welcome :)
| How do I get details from File Properties? | CC BY-SA 2.5 | 0 | 2010-11-02T02:42:12.317 | 2010-11-02T03:38:05.257 | 2017-05-23T12:07:02.087 | -1 | 326,450 | [
"c#",
"windows",
"filesystems"
] |
4,074,950 | 1 | null | null | 4 | 19,700 | How to use border-radius.htc with IE to make rounded corners
I am using [border-radius.htc](http://www.htmlremix.com/css/curved-corner-border-radius-cross-browser) to fix border-radius in IE
It is works very well here
[http://www.faressoft.org/eshterakat/border-radius/border-radius.html](http://www.faressoft.org/eshterakat/border-radius/border-radius.html)
But it doesn't work in my html page ! I don't know why !
[http://www.faressoft.org/eshterakat/](http://www.faressoft.org/eshterakat/)
```
-moz-border-radius:5px;
-khtml-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
behavior:url('Js/border-radius.htc');
```

```
/* I tried '../Js/border-radius.htc' it didn't work too */
/* I tried '/Js/border-radius.htc' it didn't work too */
/* I tried 'Js/border-radius.htc' it didn't work too */
```
| How to use border-radius.htc with IE to make rounded corners | CC BY-SA 2.5 | 0 | 2010-11-02T04:38:24.313 | 2012-05-02T09:16:08.320 | 2010-11-02T04:58:35.963 | 423,903 | 423,903 | [
"html",
"internet-explorer",
"rounded-corners",
"css"
] |
4,075,397 | 1 | 4,078,130 | null | 1 | 334 | When drawing arc segment using Core Graphics I noticed that zero angle is not what I was expecting to be, so to draw the segment arc like in picture, I used 330 and 210 as starting and ending values.
```
CGContextSetFillColorWithColor(ctx, [[UIColor grayColor] CGColor]);
CGContextMoveToPoint(ctx, 300, 300);
CGContextAddArc(ctx, 300, 300, 300, radians(330), radians(210), 1);
CGContextClosePath(ctx);
CGContextFillPath(ctx);
```
Can anyone shed light on the origin of those numbers? I would actually expect something like 300 and 60... Could it be related to the axis rotation for iPhone?

| Zero degree when drawing segment | CC BY-SA 2.5 | 0 | 2010-11-02T06:26:53.437 | 2010-11-02T13:30:57.037 | null | null | 315,427 | [
"iphone",
"core-graphics"
] |
4,075,412 | 1 | 4,075,757 | null | 8 | 10,443 | K guys, so I created this up/down vote script (basically like the one here on stackoverflow), and I'm trying to add some Ajax to it, so that the page doesn't reload everytime you vote.
I have two controllers, one called grinders, and one called votes. (Grinders are basically posts)
So here's the index of all the grinders (Looks like this ) 
and here's the code to that page.
```
</head>
<body>
<h1>Listing grinders</h1>
<%= render(:partial => "grinders/grinders")%>
<br />
<%= link_to 'New grinder', new_grinder_path %>
</body>
</html>
```
and this is what I have in the views/grinders/_grinders.erb
```
<% @grinders.each do |grinder| %>
<div id="main">
<div style="float:left; height:80px; width:50px">
<div class='up'>
<% form_for(@vote, :remote => true) do |u|%>
<%= u.hidden_field :grinder_id, :value => grinder.id %>
<%= u.hidden_field :choice, :value => "up" %>
<%= image_submit_tag("http://i13.photobucket.com/albums/a287/Rickmasta185/arrow-small-green-up.png", :class => 'create') %>
<% end %>
</div>
<center><%= grinder.votes_sum %></center>
<div class='down'>
<% form_for(@vote, :remote => true) do |d|%>
<%= d.hidden_field :grinder_id, :value => grinder.id %>
<%= d.hidden_field :choice, :value => "down" %>
<%= image_submit_tag("http://i13.photobucket.com/albums/a287/Rickmasta185/arrow-small-red-down.png", :class => 'create') %>
<% end %>
</div>
</div>
<div class='box' >"<strong>It grinds our gears </strong><%=h grinder.grinder %>"</div>
</div>
</div>
<% end %>
```
But everytime I try to vote for one, I get the following error:
> You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

I've tried soo many things, and I just cannot get it to work! (Larger screenshot - [http://grab.by/7bgb](http://grab.by/7bgb))
Any help? If you need anymore information, just ask!
| How do I pass data to a partial? | CC BY-SA 2.5 | 0 | 2010-11-02T06:30:19.723 | 2013-06-27T18:22:53.520 | 2010-11-02T06:36:19.870 | 407,702 | 407,702 | [
"ruby-on-rails",
"ruby"
] |
4,075,657 | 1 | 4,082,459 | null | 5 | 11,470 | I wish to implement a zoom-to-mouse-position-with-scrollwheel-algorithm for a CAD application I work on.
Similar question have been asked ([This one](https://stackoverflow.com/questions/2982985/algorithm-to-zoom-into-mouseopengl) for example), but all the solutions i found used the
1. Translate to origin
2. Scale to zoom
3. Translate back
approach. While this works in principle, it leads to objects being clipped away on high zoom levels since they become bigger then the viewing volume is. A more elegant solution would be to modify the projection matrix for the zooming.
I tried to implement this, but only got a zoom to the center of the window working.
```
glGetIntegerv(GL_VIEWPORT, @fViewport);
//convert window coordinates of the mouse to gl's coordinates
zoomtoxgl := mouse.zoomtox;
zoomtoygl := (fviewport[3] - (mouse.zoomtoy));
//set up projection matrix
glMatrixMode(GL_PROJECTION);
glLoadidentiy;
left := -width / 2 * scale;
right := width / 2 * scale;
top := height / 2 * scale;
bottom := -height / 2 * scale;
glOrtho(left, right, bottom, top, near, far);
```
My questions are: Is it possible to perform a zoom on an arbitrary point using the projection matrix alone in an orthographic view, and if so, How can the zoom target position be factored into the projection matrix?
I changed my code to
```
zoomtoxgl := camera.zoomtox;
zoomtoygl := (fviewport[3] - camera.zoomtoy);
dx := zoomtoxgl-width/2;
dy := zoomtoygl-height/2;
a := width * 0.5 * scale;
b := width * 0.5 * scale;
c := height * 0.5 * scale;
d := height * 0.5 * scale;
left := - a - dx * scale;
right := +b - dx * scale;
bottom := -c - dy * scale;
top := d - dy * scale;
glOrtho(left, right, bottom, top, -10000.5, Camera.viewdepth);
```
which gave this result:

Instead of scaling around the cursor position, i can know shift the world origin to any screen location i wish. Nice to have, but not what i want.
Since i am stuck on this for quite some time now, I wonder : Can a zoom relative to an arbitrary screen position be generated just by modifying the projection matrix? Or will I have to modify my Modelview matrix after all?
| Zooming in on mouse position in OpenGl | CC BY-SA 2.5 | 0 | 2010-11-02T07:22:38.597 | 2010-11-03T13:58:59.313 | 2017-05-23T12:30:36.590 | -1 | 264,347 | [
"math",
"opengl",
"zooming"
] |
4,075,674 | 1 | 4,076,567 | null | 1 | 1,161 | Greetings all,
As seen in the image , I draw lots of contours using GL_LINE_STRIP.
But the contours look like a mess and I wondering how I can make this look good.(to see the depth..etc )
I must render contours so , i have to stick with GL_LINE_STRIP.I am wondering how I can enable lighting for this?
Thanks in advance
Original image
[http://oi53.tinypic.com/287je40.jpg](http://oi53.tinypic.com/287je40.jpg)

| OpenGL lighting question? | CC BY-SA 2.5 | null | 2010-11-02T07:26:45.177 | 2010-11-02T18:38:51.890 | null | null | 180,904 | [
"opengl",
"graphics",
"3d",
"lighting"
] |
4,076,091 | 1 | 6,643,208 | null | 4 | 2,177 | I have a very strange issue and I have no idea how to debug it. (Side note: I hate creating GUI's! Anyway... :)
I have been following [this](http://timheuer.com/blog/archive/2009/10/19/silverlight-toolkit-adds-drag-drop-support.aspx) guide to using drag 'n drop on Silverlight.
Right now, what I'm interested in is the reordering in a list.
If I follow the example from the site exactly, everything is fine. It works as expected.
Consider the following XAML:
```
<toolkit:ListBoxDragDropTarget AllowDrop="True">
<ListBox Width="200" Height="500" x:Name="FromBox" DisplayMemberPath="Label">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</toolkit:ListBoxDragDropTarget>
```
aside from the DisplayMemberPath which is here "Label", this is the same as in the article I'm following.
In the code-behind I now do the following:
```
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
FromBox.ItemsSource = GetElements();
}
public static ObservableCollection<Element> GetElements()
{
ObservableCollection<Element> Elements = new ObservableCollection<Element>();
var Label = new Label();
Label.Label = "Label me";
Elements.Add(Label);
var IntegerBox = new IntegerBox();
IntegerBox.Label = "Størrelsen på en gennemsnits svale:";
IntegerBox.Description = "cm";
Elements.Add(IntegerBox);
var TextBox = new TextBox();
TextBox.Label = "QTTextBox";
Elements.Add(TextBox);
return Elements;
}
```
(Apologies for containing special Danish characters in this bit, but I thought it was better to show the exact code I'm using than editing it out)
As you can see, I return an ObservableCollection of Element's, each of which has a Label property (and they all inherit from the Element class, obviously).
To me, this ought to work the same as the code provided in the link.
But it doesn't. It's as if I can no longer drop items!?
This is how it looks in the article:

And this is how it looks with my elements:

Is there some demand on the kind of things that can be reordered? The article uses Person-objects, but these are ultra simple and do not implement any further interfaces. I'm also, as you can see, making sure to use an ObservableCollection with the right type. Is it just because it can't handle inheritance?!
... Or have I simply been stupid? :-)
Thanks in advance!
EDIT:
I've narrowed down the problem to having to do with inheritance.
The following code cannot be reordered either:
```
public class People
{
public static ObservableCollection<Person> GetListOfPeople()
{
ObservableCollection<Person> ppl = new ObservableCollection<Person>();
for (int i = 0; i < 15; i++)
{
if (i % 2 == 0)
{
SomePerson p = new SomePerson() { Firstname = "First " + i.ToString(), Lastname = "Last " + i.ToString() };
ppl.Add(p);
}
else
{
OtherPerson p = new OtherPerson() {Firstname = "First " + i.ToString(), Lastname = "Last " + i.ToString()};
ppl.Add(p);
}
}
return ppl;
}
}
public class Person
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public string FullName
{
get
{
return string.Concat(Firstname, " ", Lastname);
}
}
}
public class SomePerson : Person
{
}
public class OtherPerson : Person
{
}
```
WTF?!
It seems you can only reorder elementes that have the type declared as the type-parameter on the ObservableCollection. Thus, if I declare it contains "Person" objects and mix in Person-objects rather than SomePerson and OtherPerson, I can move .
| ListBoxDragDropTarget won't reorder elements that use inheritance | CC BY-SA 2.5 | 0 | 2010-11-02T08:46:59.583 | 2014-02-01T18:30:42.317 | 2010-11-02T10:20:46.767 | 159,407 | 159,407 | [
"silverlight",
"silverlight-4.0",
"silverlight-toolkit"
] |
4,076,126 | 1 | 4,076,205 | null | 2 | 1,142 | If I create a toolbar with a label and a button like this:
```
<ToolBar Height="26" >
<Label>Hi mom</Label>
<Button>Press me</Button>
</ToolBar>
```
The button text centers on the toolbar and does not get clipped.

How can I make the text on the label appear with an equal apperance as the button?
| wpf: Label in toolbar gets clipped | CC BY-SA 2.5 | 0 | 2010-11-02T08:51:21.030 | 2010-11-02T10:01:19.163 | 2010-11-02T09:04:05.350 | 240,040 | 240,040 | [
"wpf"
] |
4,076,312 | 1 | 4,076,887 | null | 0 | 1,032 | In my "Team discussion" list we ask user to select "Departments" from the drop down. Now, I'm creating view for each department so that they can only see their own discussions. But, When I add "Team discussion" list in a web part, I don't get my custom views in "Select View" drop down list. I'm getting only "Subject" view ,

I can do same for "Announcements" list but not for "Discussion" .
View must be created from "Subject" type and it works.. Don't find such restrictions anywhere.
| SharePoint team discussion list question | CC BY-SA 2.5 | 0 | 2010-11-02T09:22:25.197 | 2010-11-03T05:54:59.910 | 2010-11-03T05:54:59.910 | 263,357 | 263,357 | [
"sharepoint",
"sharepoint-2010"
] |
4,076,398 | 1 | 4,076,426 | null | 1 | 1,057 | I've been working in a multilanguage site build with asp.net and visual c#.
I'm using Local_resources to get my aspx files in Spanish and english.
If a use my aspx in the root of the website the Local_resources folder find the aproppiate resx for my aspx (because both have the same name). But if i put all my aspx into a folder created in the root directory, everything stop working:

as you can see i have a folder named "Inventario" and inside that folder i have Productos.aspx.
In App_LocalResources i have two files, one for spanish and one for english.
If i put Productos.aspx in the root directory they work fine, but i need them like in the image and like that is not working.
What should i do to the resx files to point to Inventario/Productos.aspx ?
Thank you very much.
| Multilanguage asp.net site with aspx in different levels | CC BY-SA 2.5 | null | 2010-11-02T09:35:49.503 | 2010-12-03T07:29:15.637 | 2010-12-03T07:29:15.637 | 41,956 | 280,501 | [
"c#",
"asp.net",
"localization",
"web-site-project"
] |
4,076,502 | 1 | 4,077,321 | null | 3 | 543 | I have the following Fluent Mappings:
```
public ScanDeliverySessionMap()
{
Id(x => x.Id);
...
...
HasManyToMany(x => x.ToScanForms) <--- IList<Form> ToScanForms --->
.Table("ToScanForm")
.ParentKeyColumn("SessionId")
.ChildKeyColumn("FormId").Cascade.SaveUpdate();
}
public FormMap()
{
Id(x => x.Id).Column("FormID").GeneratedBy.Foreign("Log");
....
....
HasManyToMany(x => x.ScanDeliverySessions)
.Table("ToScanForm")
.ParentKeyColumn("FormId")
.ChildKeyColumn("SessionId").Inverse();
}
```
When I try to insert new Form to the ToScanForms collection
Everything seemingly works properly but watching on NHProf
I see that NH casacde DELETE over all ToScanForms items
and then NH INSERT the ToScanForms items including the new item.
Some screenshots:


| NHibernate cascade collection delete when insert new item to not empty collection | CC BY-SA 2.5 | null | 2010-11-02T09:51:32.743 | 2010-11-02T11:50:08.663 | null | null | 54,801 | [
"nhibernate",
"fluent-nhibernate"
] |
4,076,638 | 1 | 4,076,813 | null | 1 | 1,862 | 
I'm trying to write an algorithm that will detect the space between 'RF' and 'WOOLF in the image below.
I need something like Scanline for COLUMNS not rows.
My algorithm will be scanning each column for the presence of black pixels, if it finds any it will store '1', else it will store '0', so for example the image above might be:
000001111111111111111111100000000000000000000000011111111111111111111111111111111111111111111111111
so I will know that the space starts on pixel 30.
| Delphi> Vertical scanline? (Get columns instead of rows?) | CC BY-SA 2.5 | 0 | 2010-11-02T10:10:10.633 | 2010-11-02T14:22:49.700 | null | null | 491,455 | [
"delphi",
"image-processing"
] |
4,076,688 | 1 | 4,076,737 | null | 1 | 1,514 | I have several projects in a solution in visual studio 2010. This is the structure:

In the WebSite project called TerapiaFisica i'm using localResources for multilanguage support, and that's ok.
My problem is in the ModelosEF folder where i have several entityFramework projects.
Here's exactly my problem:
```
public void ModificarProducto(Dictionary<string, string> valores)
{
#region Obtencion de Datos y Validaciones de estos
int productoID;
try
{
productoID = Convert.ToInt32(valores["ProductoID"]);
}
catch (Exception)
{
throw new Exception("Debe seleccionarse una Categoría válida.");
}
```
in this method i'm using plain spanish in the exception, i need a way of changing that text to english in the simpliest way possible if the lang is set to EN (Productos.aspx?lang=EN).
How can i do that? How can i know which language is being used in the Website so i can use the aproppiate language in the ModeloInventarioLogica.cs class? Should i send the current culture by parameter to know wich is? and if so, how can i use Visual C# to pick the corresponding language text from where?
A lot of questions but only one matter, make a class project multilanguage!
Thank you very much.
| Multilanguage asp.net class project | CC BY-SA 2.5 | 0 | 2010-11-02T10:15:35.740 | 2010-11-23T13:56:47.677 | 2010-11-02T10:30:22.557 | 280,501 | 280,501 | [
"c#",
"asp.net",
"visual-studio-2010",
"multilingual"
] |
4,077,128 | 1 | null | null | 2 | 381 | Why is the 1st button "active" when I am not hovering over the button or anything. This seems to happen after I change tabs.

I suspect that when I change tabs, it focuses the 1st control. Is that the case? I am developing a MVVM app, so from my view model, how might I focus the text box instead?
| Focus control from ViewModel | CC BY-SA 2.5 | 0 | 2010-11-02T11:22:58.503 | 2011-03-15T19:35:12.903 | null | null | 292,291 | [
"c#",
"wpf",
"mvvm",
"tabcontrol"
] |
4,077,140 | 1 | 4,077,399 | null | 7 | 10,656 | Just like the tabbar, I want to show badge on `UISegmentedControl`. As I cant see any predefined methods for `UISegmentedControl` just like available for `UITabBar`.

I thought about adding the badge as an image just on top of it, but maybe there is some better way.
| UISegmentedControl with badge number | CC BY-SA 3.0 | 0 | 2010-11-02T11:24:43.527 | 2016-10-25T05:34:21.003 | 2015-01-28T13:08:37.237 | 239,219 | 213,532 | [
"iphone",
"uitabbar",
"uisegmentedcontrol",
"badge"
] |
4,077,195 | 1 | 4,112,848 | null | 3 | 312 | 
how to load view in the above picture.
this code will flipHorizontal.....
```
SubclassViewController *bNavigation = [[BusinessViewController alloc] initWithNibName:@"bNavigation" bundle:nil];
bNavigation = self;
bNavigation.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:bNavigation animated:YES];
[bNavigation release];
```
Is there any pattern to do..... as show in picture.
Thanks in advance
| how to load nib with different transition style model. has show in figure | CC BY-SA 2.5 | 0 | 2010-11-02T11:33:24.983 | 2010-11-06T11:09:38.210 | null | null | 465,800 | [
"iphone"
] |
4,077,206 | 1 | 4,077,244 | null | 3 | 5,207 | I'm writing a kind of "generic container dialog", which will ensure that all modal dialogs in an app will have the exact same "chrome" (namely, buttons, icons, etc.). I came up with the following:

The `containerPanel` is just a `System.Windows.Forms.Panel`.
Now what I want is as follows: for each dialog in an app, I want to create a separate `UserControl` (not a full-blown `Form`) and then "host" it inside this generic dialog. To do so, I need to somehow make this dialog self-adjustable so that it would shrink or grow depending on the size of a control hosted inside it.
How can I do that? Do I need some kind of layout control, or is there some special magical property to do this?
| Autosizing WinForms Dialog to fit inner content | CC BY-SA 2.5 | null | 2010-11-02T11:35:35.383 | 2010-11-02T16:02:13.090 | null | null | 60,188 | [
"winforms",
"modal-dialog"
] |
4,077,363 | 1 | 4,744,358 | null | 0 | 627 | I have been using nagios + pnp4nagios for a while and am happy with the images rrdtool creates. My current task is to create a panel that has some statistics generated by nagios and after a while the statistics change. I'm looking for something like that: 
But also able to switch screens automatically. I do know that I can make a timed javascript function that switches the layout after a determined time, but I also want to add effects and other stuff to the picture. Any good javascript library that has it?
| Javascript library for dynamically switching pages/views | CC BY-SA 2.5 | null | 2010-11-02T11:56:44.027 | 2011-01-20T07:05:57.120 | null | null | 487,649 | [
"javascript",
"nagios",
"rrdtool",
"graphic-effects"
] |
4,077,392 | 1 | 4,077,409 | null | 8 | 27,719 | i'm having a ListView control with no columns.
an a list
```
List<String> MyList=new List<string>();
```
i need to create columns for each list `MyList` item in the `ListView` along with one another column for Serial Number.
For example if `MyList` contains `"A", "B" ,"C"`
then the list view will be like

I know that we can do this using `for` or `foreach` loop like
```
listView1.Columns.Add("S.No")
for(int i=0;i<MyList.Count;i++)
{
listView1.Columns.Add(MyList[i])
}
```
but is there any way to do this using `LINQ` or `LAMBDA Expression`?
| How to add Column header to a ListView in C# | CC BY-SA 2.5 | 0 | 2010-11-02T12:00:30.543 | 2010-11-02T13:41:44.317 | null | null | 336,940 | [
"c#",
"linq",
"listview",
"lambda"
] |
4,077,882 | 1 | null | null | 1 | 239 | i'm programming in QT. I encountered a problem. i would
like to activate adjustsize() for a layout from the cpp
file. i can't find the function, which exist on the designer.
designer screenshot:

cpp:ui->gridLayout->no matched function!!!
| how to activate adjustsize() for a layout | CC BY-SA 2.5 | null | 2010-11-02T13:03:02.603 | 2010-11-02T13:09:27.857 | null | null | 487,305 | [
"c++",
"qt",
"layout"
] |
4,078,437 | 1 | 4,078,527 | null | 4 | 1,742 | I downloaded the SynEdit Unicode Vervion ( UniSynEdit ) , it contains packages of D5-D2009 , but i want to install it in Delphi 2010 ! , I loaded D2009 Package in D2010 IDE , It compiles successfully but there is no Menu item for Installing Package ! :

How can i install it in Delphi 2010 ? ( Notice that it compiles successfully )
thanks a lot ...
| How to Install a Delphi 2009 Component Package in Delphi 2010 ( UniSynEdit Package )? | CC BY-SA 2.5 | null | 2010-11-02T14:02:41.443 | 2011-04-23T00:48:48.260 | 2011-04-23T00:48:48.260 | 91,299 | 420,972 | [
"delphi",
"delphi-2009",
"delphi-2010",
"synedit"
] |
4,078,598 | 1 | 4,079,536 | null | 0 | 892 | I'm trying to add a DataGrid inside a spark TitleWindow and for some reason its not showing up correctly.
When I put the same code in the main mxml, it comes up correctly. The exact same code shows up weird in the TitleWindow.
```
<mx:DataGrid x="10" y="51" width="535" height="215" id="musicianGrid">
<mx:columns>
<mx:DataGridColumn headerText="First Name" dataField="firstName" width="90"/>
<mx:DataGridColumn headerText="Last Name" dataField="lastName" width="90"/>
<mx:DataGridColumn headerText="Band/Group" dataField="bandName" />
<mx:DataGridColumn headerText="Record Label" dataField="recordLabel" width="135"/>
</mx:columns>
</mx:DataGrid>
```
Within the titlewindow it looks like this - 
In the main mxml it looks like this - 
There is no change in the code...
Can you please tell me whats happening?
| Flex - Unable to show datagrid inside a TitleWindow | CC BY-SA 2.5 | null | 2010-11-02T14:21:17.383 | 2011-05-05T08:03:02.743 | null | null | 133,946 | [
"apache-flex",
"actionscript-3",
"datagrid",
"flex4"
] |
4,078,746 | 1 | 4,100,837 | null | 2 | 229 | Trying not to select same connection multiple times I have tried to use charindex() = 0 condition the following way:
```
WITH Cluster(calling_party, called_party, link_strength, Path)
AS
(SELECT
calling_party,
called_party,
link_strength,
CONVERT(varchar(max), calling_party + '.' + called_party) AS Path
FROM
monthly_connections_test
WHERE
link_strength > 0.1 AND
calling_party = 'b'
UNION ALL
SELECT
mc.calling_party,
mc.called_party,
mc.link_strength,
CONVERT(varchar(max), cl.Path + '.' + mc.calling_party + '.' + mc.called_party) AS Path
FROM
monthly_connections_test mc
INNER JOIN Cluster cl ON
(
mc.called_party = cl.called_party OR
mc.called_party = cl.calling_party
) AND
(
CHARINDEX(cl.called_party + '.' + mc.calling_party, Path) = 0 AND
CHARINDEX(cl.called_party + '.' + mc.called_party, Path) = 0
)
WHERE
mc.link_strength > 0.1
)
SELECT
calling_party,
called_party,
link_strength,
Path
FROM
Cluster OPTION (maxrecursion 30000)
```
The condition however does not fulfill its purpose as the same rows are selected multiple times.
The actual aim here is to retrieve the whole cluster of connections to which the selected user (in the example user b) belongs.
I tried to modify the query the following way:
```
With combined_users AS
(SELECT calling_party CALLING, called_party CALLED, link_strength FROM dbo.monthly_connections_test WHERE link_strength > 0.1),
related_users1 AS
(
SELECT c.CALLING, c.CALLED, c.link_strength, CONVERT(varchar(max), '.' + c.CALLING + '.' + c.CALLED + '.') path from combined_users c where CALLING = 'a1'
UNION ALL
SELECT c.CALLING, c.CALLED, c.link_strength,
convert(varchar(max),r.path + c.CALLED + '.') path
from combined_users c
join related_users1 r
ON (c.CALLING = r.CALLED) and CHARINDEX(c.CALLING + '.' + c.CALLED + '.', r.path)= 0
),
related_users2 AS
(
SELECT c.CALLING, c.CALLED, c.link_strength, CONVERT(varchar(max), '.' + c.CALLING + '.' + c.CALLED + '.') path from combined_users c where CALLED = 'a1'
UNION ALL
SELECT c.CALLING, c.CALLED, c.link_strength,
convert(varchar(max),r.path + c.CALLING + '.') path
from combined_users c
join related_users2 r
ON c.CALLED = r.CALLING and CHARINDEX('.' + c.CALLING + '.' + c.CALLED, r.path)= 0
)
SELECT CALLING, CALLED, link_strength, path FROM
(SELECT CALLING, CALLED, link_strength, path FROM related_users1 UNION SELECT CALLING, CALLED, link_strength, path FROM related_users2) r OPTION (MAXRECURSION 30000)
```
To test the query I created the cluster below:

The query above returned the following table:
```
a1 a2 1.0000000 .a1.a2.
a11 a13 1.0000000 .a12.a1.a13.a11.
a12 a1 1.0000000 .a12.a1.
a13 a12 1.0000000 .a12.a1.a13.
a14 a13 1.0000000 .a12.a1.a13.a14.
a15 a14 1.0000000 .a12.a1.a13.a14.a15.
a2 a10 1.0000000 .a1.a2.a10.
a2 a3 1.0000000 .a1.a2.a3.
a3 a4 1.0000000 .a1.a2.a3.a4.
a3 a6 1.0000000 .a1.a2.a3.a6.
a4 a8 1.0000000 .a1.a2.a3.a4.a8.
a4 a9 1.0000000 .a1.a2.a3.a4.a9.
```
The query obviously returns connections toward the selected node and the connections in the opposite direction. The problem is the change of direction: for example the connections a7, a4 and a11, a10 are not selected because the direction is changed (relative to starting node).
Does anyone know how to modify the query in order to include all connections?
Thank you
| recursive query problem - retrieving cluster of directed connections | CC BY-SA 2.5 | null | 2010-11-02T14:39:42.890 | 2010-11-05T09:53:41.493 | 2010-11-04T15:25:50.573 | 22,996 | 22,996 | [
"sql",
"recursion",
"social-networking"
] |
4,079,253 | 1 | 4,080,927 | null | 26 | 6,356 | I'm having a hard time fixing memory related issues in my iPad application, but, good thing is, that I've learned about "heapshots" because of that. Bad thing is, I'm still unable to figure out what some of the information provided to me means.

So, what are these non-objects which are still alive and takes most of the memory described in Heap Growth? Is it possible to get rid of them? It looks like that most of them are related to various drawing operations, CALayer, context and etc (Category:"Malloc" or "Realloc"). I can provide more details if needed.
| What does <non-object> in Allocation "heapshots" mean? | CC BY-SA 2.5 | 0 | 2010-11-02T15:33:42.110 | 2010-11-02T19:44:51.993 | 2010-11-02T19:44:51.993 | 19,679 | 90,571 | [
"iphone",
"objective-c",
"xcode",
"ipad",
"instruments"
] |
4,079,394 | 1 | 4,090,677 | null | 1 | 999 | I've been using this [book](https://rads.stackoverflow.com/amzn/click/com/1849690200) as reference to creating my Blackberry application. So far I have a list of items and when I select one I get the side menu but next to my list item:

Just looking through my methods, I'm not sure which one causes this as I can remove the custom item (GetValue) from the Menu and it will still appear here when I select the list item!
I guess my question is, how can I stop this menu appearing and have a method fire instead? I can provide code if necessary but I don't know where to start with this one!
Thanks
| Selecing an item in a Blackberry ListField | CC BY-SA 2.5 | 0 | 2010-11-02T15:45:44.540 | 2010-11-03T19:07:36.833 | 2010-11-02T16:05:45.820 | 143,979 | 143,979 | [
"java",
"blackberry",
"menu",
"smartphone",
"listfield"
] |
4,079,679 | 1 | 4,079,774 | null | 23 | 83,913 | How do I create a similar “search” element to the one in [this site](https://web.archive.org/web/20101029141935/https://www.53.com/wps/portal/personal)?

If we view source, he has one textbox followed by a `<span>` tag.
```
<input type="text" name="q" id="site-search-input" autocomplete="off" value="Search" class="gray" />
<span id="g-search-button"></span>
```
Where do I get a similar "magnifying glass" image?
| How do I add a "search" button in a text input field? | CC BY-SA 3.0 | 0 | 2010-11-02T16:13:43.637 | 2021-12-13T15:10:35.593 | 2015-06-30T05:38:02.837 | 1,269,037 | 400,440 | [
"html",
"css",
"icons"
] |
4,079,830 | 1 | 4,079,876 | null | 6 | 5,060 | I use `mercurial.el` mode with Emacs. When I run `vc-diff`, I can see the diff, but, unlike the source code, it is not nicely highlighted:

Reading such diffs is difficult. How do I configure Emacs,
1. to highlight - and + lines with different colors? (red and blue, for example)
2. to highlight word difference (like BitBucket and GitHub do)
| How to configure highlighting in Emacs diff mode? | CC BY-SA 2.5 | 0 | 2010-11-02T16:29:17.563 | 2010-11-02T16:40:17.470 | null | null | 25,450 | [
"version-control",
"emacs",
"diff",
"syntax-highlighting"
] |
4,080,362 | 1 | null | null | 0 | 226 | What is the name of this font? :

| What is the name of this font? | CC BY-SA 2.5 | null | 2010-11-02T17:25:53.290 | 2010-11-02T19:53:58.727 | null | null | 244,413 | [
"graphics",
"fonts"
] |
4,080,363 | 1 | null | null | 4 | 8,248 | I have the following model:

But when i compile with VS2010, i get the following error:
Error 2 Error 3007: Problem in mapping fragments starting at lines 1784, 2018:Column(s) [createdby] are being mapped in both fragments to different conceptual side properties.
What do i want ? Actually i want the Note entity to have FK to User entity.
When does the error appear ? When i add the FK User to Note i have the error. If i remove the link, no problem.
What is the problem ?
Thanks
John
| Problem in mapping fragments in EF4 | CC BY-SA 2.5 | null | 2010-11-02T17:25:55.693 | 2011-05-03T03:30:35.743 | 2010-11-02T17:33:31.680 | 96,547 | 96,547 | [
"entity-framework",
"entity-framework-4"
] |
4,080,393 | 1 | 4,082,142 | null | 2 | 2,629 | In my ASP.Net web application, I have a base page that implements functionality that spans all pages of the web application and my web pages derive from this base page.
Since there is a single master page for the entire website, I don't want to attach the master page in each of the web pages. So I attached the Master page via the basepage's OnPreInit method as follows:
```
protected override void OnPreInit(EventArgs e)
{
this.MasterPageFile = "~/Site.master";
base.OnPreInit(e);
}
```
However, when I switch to Designer view, I get the "Master Page Error"; The page has controls that require a Master Page reference, but noe is specified. Correct the problem in Code View.

When I run the application, the webpage shows up correctly.
What should be done so that the designer shows up correctly without having to go and set the master page explicitly in each of the web pages?
BTW, I am on Visual Studio 2010 and .Net 4.0
| How to work with Master Page that is attached to the page via the page's basepage? | CC BY-SA 2.5 | null | 2010-11-02T17:28:20.623 | 2012-12-04T10:46:24.313 | null | null | 199,745 | [
"asp.net",
"visual-studio-2010",
"master-pages",
"designer",
"onpreinit"
] |
4,080,441 | 1 | 4,080,446 | null | 0 | 255 | If i give iPhone application name maximum 12 characters then all characters will be displayed. But if I give more than 12 characters, then my application name display with (....). as below.

I want to need display fullname without showing (...). in my project. Or is there is any possible way to change application font size?
| IChange Application Displayname's Font in IPhone | CC BY-SA 3.0 | null | 2010-11-02T17:34:06.360 | 2017-11-26T22:32:49.917 | 2017-11-26T22:32:49.917 | 472,495 | 409,571 | [
"iphone"
] |
4,080,548 | 1 | 4,080,943 | null | 1 | 556 | In my rails3 app I've got an image gallery where:
```
gallery has many images
image belongs to gallery
```
I'm using carrierwave to upload images to S3.
My gallery page ('show' action) displays thumbnails for each image in that gallery.
I use colorbox to display the images modally when a user clicks on the thumbnail.
Quite often, I see this after clicking on an image:

what I want to see is this:

I've done a LOT of troubleshooting:
- - - - - - - - -
This tends to although I've noticed it happening with images I've not clicked on in over an hour or so too. The problem goes away if I click on the thumbnail again immediately after the failure.... I never have any trouble with the thumbnails, they all load fine. It seems as though the large (original) version of the image is not getting downloaded on the first attempt.
- - -
What else can I do here? What more troubleshooting can I try? Any help would be appreciated.
Here's some of my code:
```
class Image < ActiveRecord::Base
belongs_to :gallery
mount_uploader :photo, ImageUploader
attr_accessible :photo, :gallery_id
validates_presence_of :photo
end
class Gallery < ActiveRecord::Base
default_scope order("id DESC")
has_many :images
attr_accessible :name, :images_attributes, :description
accepts_nested_attributes_for :images, :reject_if => :all_blank, :allow_destroy => true
validates_presence_of :name
end
#images/show.html.haml
= image_tag @image.photo_url if @image.photo_url
#galleries/show.html.haml
- for image in gallery.images
.image
= link_to image_tag(image.photo_url(:thumb)), image_path(image), :name=>"modal", :class=>"group" if image.photo_url(:thumb)
#layouts/images.html.haml
!!! 5
%html
%body
#image
= yield
```
| Rails 3 - images not rendering correctly on first page view | CC BY-SA 2.5 | 0 | 2010-11-02T17:46:27.960 | 2010-11-02T18:30:45.777 | 2017-02-08T14:30:47.993 | -1 | 227,863 | [
"jquery",
"ruby-on-rails",
"amazon-s3"
] |
4,080,845 | 1 | 4,086,662 | null | 1 | 450 | if by any means I happen to have
```
public class DoorsModel
{
public DoorsModel() { }
public HttpPostedFileBase Image { get; set; }
public String DoorLayout { get; set; }
public bool ReplicateSettings { get; set; }
public List<DoorDesignModel> Doors { get; set; }
}
public class DoorDesignModel
{
public DoorDesignModel() { }
public HttpPostedFileBase FrontFile { get; set; }
public HttpPostedFileBase BorderFile { get; set; }
}
```
and in my `View` I have a normal form to populate the Model Properties but the `List<DoorDesignModel>` I'm using a User Control and use
```
<%Html.RenderPartial("DoorDesign", Model.Doors); %>
```
inside `DoorDesign.ascx` I have:
```
<%@ Control
Language="C#" AutoEventWireup="true"
Inherits="System.Web.Mvc.ViewUserControl<List<MyProject.Backend.Models.DoorDesignModel>>" %>
```
to display all form I have a `for` clause
```
MyProject.Backend.Models.DoorDesignModel field;
for (i = 0; i < Model.Count; i++) {
field = Model[i];
...
}
```
and I'm using the HTML
```
<input type="file" value="Upload file"
name="Doors.FrontFile[<%: i %>]" id="Doors.FrontFile[<%: i %>]">
```
but soon I press the submit button, my model returns a `null` List :(
and I'm creating and setting a new list when starting the View as
```
public ActionResult Doors()
{
DoorsModel model = new DoorsModel();
model.Doors = new List<DoorDesignModel>();
for (int i= 1; i<= 24; i++) // Add 24 Doors
model.Doors.Add(new DoorDesignModel());
return View(model);
}
[HttpPost]
public ActionResult Doors(DoorsModel model)
{
// model.Doors is always null !!!
if (ModelState.IsValid)
ViewData["General-post"] = "Valid";
else
ViewData["General-post"] = "NOT Valid";
return View(model);
}
```
What do I need to have in order to return the Doors List from the `RenderPartial` part?
a simple mockup of the View

| How to handle `PartialRender` Models? | CC BY-SA 2.5 | 0 | 2010-11-02T18:21:02.093 | 2010-11-03T11:42:12.560 | null | null | 28,004 | [
"asp.net-mvc-2",
"user-controls",
"viewmodel"
] |
4,081,074 | 1 | 4,217,410 | null | 1 | 444 | I am currently able to get my location pinned down on the MapView using the MAPKIT.
I wanted to get the traffic info embedded on the same MapView around the same location.
I have attached a sample screenshot of the desired view.
Could anyone please let me know what Api or how I need to go about getting this done.
Here is the image of the desired output:

Thanks!!
| HOW TO embedd traffic information in a Custom MapView | CC BY-SA 2.5 | null | 2010-11-02T18:47:16.427 | 2010-11-18T16:52:52.863 | null | null | 224,640 | [
"iphone",
"google-maps",
"mkmapview"
] |
4,081,610 | 1 | 4,081,914 | null | 0 | 533 | I am using httpwebrequest and httpwebresponse to send request and get response respectively.
For some reason my connection gets closed before the response is recieved.
Here is my code :
```
WebRequest webRequest = WebRequest.Create (uri);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes (parameters);
Stream os = null;
try
{ // send the Post
webRequest.ContentLength = bytes.Length; //Count bytes to send
os = webRequest.GetRequestStream();
os.Write (bytes, 0, bytes.Length); //Send it
}
catch (WebException ex)
{
MessageBox.Show ( ex.Message, "HttpPost: Request error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
}
try
{ // get the response
WebResponse webResponse = webRequest.GetResponse();
if (webResponse == null)
{ return null; }
StreamReader sr = new StreamReader (webResponse.GetResponseStream());
return sr.ReadToEnd ().Trim ();
}
catch (WebException ex)
{
MessageBox.Show ( ex.Message, "HttpPost: Response error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
}
return null;
}
```
Error :

| how to keep connection live while using httpwebrequest? | CC BY-SA 2.5 | null | 2010-11-02T19:58:06.150 | 2010-11-02T20:42:59.193 | 2020-06-20T09:12:55.060 | -1 | 196,810 | [
"httpwebrequest",
"httpwebresponse"
] |
4,081,811 | 1 | 4,082,220 | null | 158 | 59,302 | I'm using [_viewstart.cshtml to automagically assign the same Razor Layout](http://weblogs.asp.net/scottgu/archive/2010/10/22/asp-net-mvc-3-layouts.aspx) to my views.
It's a dead simple file in the root of my Views folder that looks like this:
```
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
```
This is more DRY than adding the @Layout directive to every single view.
However, this poses a problem for Razor views, because they run the contents of _viewstart.cshtml and therefore incorrectly assign themselves a layout, which makes them, um, no longer partial.
Here's a hypothetical project, showing the _viewstart.cshtml file, the shared _layout.shtml file, and a partial view ("AnonBar.cshtml").

Currently, the way that I'm getting around this is by adding the following line to every partial view:
```
@{
Layout = "";
}
```
This seems like the wrong way to denote a view as a partial in Razor. (Note that unlike the web forms view engine, the file extension is the same for partial views.)
Other options I considered but that are even worse:
- -
Is this something that is still being fleshed out by the Razor view engine team, or am I missing a fundamental concept?
| Correct way to use _viewstart.cshtml and partial Razor views? | CC BY-SA 2.5 | 0 | 2010-11-02T20:29:01.760 | 2010-11-02T23:01:15.323 | 2017-02-08T14:30:48.337 | -1 | 1,690 | [
"razor",
"asp.net-mvc-3"
] |
4,081,898 | 1 | 4,082,020 | null | 32 | 33,189 | i am looking for an algorithm ( in pseudo code) that generates the 3d coordinates of a sphere mesh like this:

the number of horizontal and lateral slices should be configurable
| procedurally generate a sphere mesh | CC BY-SA 3.0 | 0 | 2010-11-02T20:40:38.307 | 2019-11-28T09:00:54.923 | 2016-01-20T17:23:23.927 | 242,924 | 97,688 | [
"3d",
"mesh"
] |
4,082,832 | 1 | 4,082,946 | null | 1 | 3,630 | I am currently working on an OpenGL procedural planet generator. I hope to use it for a space RPG, that will not allow players to go down to the surface of a planet so I have ignored anything ROAM related. At the momement I am drawing a cube with VBOs and mapping onto a sphere as shown [here](http://iquilezles.org/www/articles/patchedsphere/patchedsphere.htm).
I am familiar with most fractal heightmap generating techniques and have already implemented my own version of midpoint displacement(not that useful in this case I know).
My question is, what is the best way to procedurally generate the heightmap. I have looked at [libnoise](http://libnoise.sourceforge.net/index.html) which allows me to make tilable heightmaps/textures, but as far as I can see I would need to generate a net like:

Leaving the tiling obvious.
Could anyone advise me on the best route to take?
Any input would be much appreciated.
Thanks,
Henry.
| Procedural Planets, Heightmaps and textures | CC BY-SA 2.5 | 0 | 2010-11-02T22:53:01.313 | 2016-04-18T22:27:52.847 | null | null | 483,609 | [
"opengl",
"texture-mapping",
"fractals",
"procedural-generation",
"perlin-noise"
] |
4,083,118 | 1 | 4,083,171 | null | 3 | 117 | 
My image says it all.
At #1 screenshot is how it is right now
At #2 is how I want it to be
How can i do this?
Here's my current html:
```
<div>
<span style='float: left; margin: 10px; width: 60px; display: block;'>
<img style='border: 1px solid #FFF; width: 61px; height: 80px;' src='images/profilePhoto/thumbs/104.jpg'>
<br>Rafo O.
</span>
<h1>(inget ämne)</h1>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec fringilla urna eget urna euismod aliquet. Duis porta volutpat blandit. Phasellus bibendum bibendum porta. Nunc molestie tristique leo, sed euismod orci ultricies vitae. Mauris non libero a leo ultricies laoreet. Suspendisse luctus urna vel sapien tristique vitae semper nulla eleifend. Integer congue aliquam pharetra. Phasellus diam neque, tincidunt vel elementum vel, ornare sit amet mi. Nulla tincidunt purus in odio vulputate mollis. Nunc urna odio, rutrum eu ultricies a, facilisis ullamcorper nunc. In purus velit, varius vel laoreet eu, tincidunt non purus. Nulla facilisi. Sed ac lectus nibh. Praesent non velit nibh.<br />
........
</div>
<p style='float: right; color: grey; font-weight: bold;'>1-11-2010 kl. 13:28</p></div>
<div class='clearfloat'></div>
```
| HTML: Text at the same spot | CC BY-SA 2.5 | null | 2010-11-02T23:51:21.163 | 2010-11-03T00:03:28.713 | null | null | 457,827 | [
"html",
"css"
] |
4,083,168 | 1 | 4,083,212 | null | 0 | 1,609 | I'm having to store a user account locally on a machine, what would be the best method to store this? (Needs to be reversable encryption rather than hash)
I'm accessing a UNC share as mentioned here:
[Accessing UNC Share from outside domain for file transfer](https://stackoverflow.com/questions/4077467/accessing-unc-share-from-outside-domain-for-file-transfer)
Using this suggested method:
[http://www.codeproject.com/KB/IP/ConnectUNCPathCredentials.aspx](http://www.codeproject.com/KB/IP/ConnectUNCPathCredentials.aspx)
This will be an automated process so no option of human entered credentials.
I'm currently encrypting the details and storing them in the registry using TripleDES:
[http://www.devarticles.com/c/a/VB.Net/String-Encryption-With-Visual-Basic-.NET/4/](http://www.devarticles.com/c/a/VB.Net/String-Encryption-With-Visual-Basic-.NET/4/)
With the key and initialization vector hard coded within the application.
Can anyone suggest a better method or changes to the above to secure the credentials as much as possible?

| Storing credentials locally in registry - encryption methods? | CC BY-SA 2.5 | 0 | 2010-11-03T00:02:18.060 | 2010-11-03T17:53:06.503 | 2017-05-23T12:01:16.000 | -1 | 2,278,201 | [
"vb.net"
] |
4,083,475 | 1 | 4,083,705 | null | 13 | 16,399 | How to remove the default context menu of a `TextBox` Control?

Is there a property to disable it?
Thanks :)
| How to remove the default context menu of a TextBox Control? C# | CC BY-SA 2.5 | 0 | 2010-11-03T01:16:20.083 | 2010-11-03T02:08:12.890 | null | null | 396,335 | [
"c#",
"winforms"
] |
4,083,485 | 1 | 4,111,569 | null | 4 | 640 | Can anyone help me understand why the displayed labels for a TListView are truncated with an ellipsis at program startup, but are completely displayed after switching to vsIcon and back
again? I don't want any truncation or ellipse...
Edit 1: Columns[0].AutoSize is TRUE, MaxWidth is 50, Width is 50.
Edit 2: Left hand screen capture corrected so source text is the same as the right side's.
TIA

| Why is TListView's Node text truncated with an ellipsis until I toggle ViewStyle? | CC BY-SA 2.5 | 0 | 2010-11-03T01:18:13.037 | 2010-11-06T02:26:18.097 | 2010-11-03T04:12:20.193 | 246,057 | 246,057 | [
"delphi",
"vcl"
] |
4,083,542 | 1 | 4,085,108 | null | 0 | 224 | Previously, we have a legacy system, which we are using C++ code to generate reports in Text file and Excel file. However, it is a pain to perform manual coding to perform all the raw data processing and report format rendering.
Recently, we had success to migrate all the raw data into SQL database.
To avoid writing manual code, we decide to evaluate the following tool.
1. JasperReports - Able to help us perform report format rendering?
2. OpenReport - Provides us web access to the generated report?
Currently, our raw data looks something like :

Based on the demo provided by OpenReport and JasperReports, I believe we can generate a report like
```
Summary Report for Lot 2
------------------------
Measurement Type Value
----------------------------------
Lead 1 Average 1.30
Lead 1 StdDev 0.16
.
.
Lead 2 Average 2.08
Lead 2 StdDev 0.55
```
However, this is a little far than what we want. What we want is to able
1. Take the multiple rows of Lead 1, 2, 3... under Average category, and have a logic code function to recalculate them into a single Lead row.
2. Do the same for rest of the statistics like StdDev...
3. Have a report format like :
---
```
Summary Report for Lot 2
------------------------
Measurement Average StdDev
----------------------------------
Lead 2.33 1.23
```
---
So far for the demo that I had seen, most of them are just `1 to 1 mapping` from raw database to report. In the middle of `1 to 1 mapping`, I know there can be some simple SQL statement for filtering and manipulation. I haven't seen an example which can perform a `sophisticated` processing.
The reason I call it `sophisticated`, as in C++ code, we require to perform std::string processing, making use of std::vector, std::map data structure and arithmetic operation. I am doubt SQL statement can perform similar.
Based on my listed requirement, is it possible that I can use available reporting tool in the market to generate report? Or we need to develop our own middle-ware to perform such task? (Perl/ Python/ ... whatever)
| Do we need to write our own middle-ware, or we can make use of available reporting tool | CC BY-SA 2.5 | null | 2010-11-03T01:28:50.487 | 2010-11-03T08:04:55.240 | null | null | 72,437 | [
"reporting-services",
"crystal-reports",
"jasper-reports",
"report"
] |
4,083,751 | 1 | 4,083,903 | null | 0 | 53 | Here is a question that I have to face a lot when doing the design of my little apps. Is there a reason I should prefer

over

?
If yes, why? If not, are there any specific circunstances where there is a clear advantage in one approach over the other?
I tend to use the first approach, although I am not too sure why. I guess maybe it is because there may be some concrete implementation of IBonus that might not need a dependency at all, while the second approach is tieing me to something. A stub/mock class, for example.
Thanks!
| Preferable to embeb dependencies on interfaces or let that job to the concrete classes? | CC BY-SA 2.5 | null | 2010-11-03T02:18:59.440 | 2010-11-03T03:05:29.127 | null | null | 130,758 | [
"c#",
"java",
"c++",
"oop"
] |
4,083,776 | 1 | null | null | 3 | 3,432 | I was wondering if it is possible to create a filled line graph, like below, using matplotlib?
I have matplotlib 0.91.2 and pylab installed.

[http://test1.xsports.co.nz/media/Forecast.png](http://test1.xsports.co.nz/media/Forecast.png)
| Is it possible to use matplotlib and pylab to create filled line graph? | CC BY-SA 3.0 | null | 2010-11-03T02:24:21.353 | 2011-12-12T09:23:04.843 | 2011-12-12T09:23:04.843 | 1,022,826 | 495,459 | [
"python",
"matplotlib"
] |
4,083,882 | 1 | 4,084,164 | null | 1 | 1,966 | This post is actually divided in two questions:
## Which kinds of associations classes/interfaces usually have?
I'd say there are at least 3 kinds of dependencies:
- - `class A``class B``class A``class B`- `class A``class B``class B``class A`
Are these the only kind of associations between classes? Are my interpretations of what they mean correct?
## Which kind of dependencies are of our interest to show on UML diagrams (mostly class/package diagrams)?
Up until now, I've mostly only put in class diagrams arrows depicting dependencies associations. But now that I think of it, most of the time I look at class diagrams, I'll find something along the lines of

where only `Inherits` and `Uses` associations are shown. But those `Uses` in the class diagram aren't really the same kind of `Uses` I've defined above. They are just a way of telling you there's a getter on a class of a type that's not a primitive.
I guess that if I had to look to some system's documentation I'd like to know how different classes in the system depend on each other. I'd definetely like to have some sort of `Dependency Graph` to look at.
Would it better to restrict class diagrams to `Inherits/Uses` associations and then have other diagram/graph that shows `Depends/Uses` associations?
How do you prefer it, and why?
Thanks
| Which kinds of associations do classes have in a system? How to best represent them in UML? | CC BY-SA 2.5 | null | 2010-11-03T02:51:59.623 | 2010-11-03T14:20:50.507 | 2020-06-20T09:12:55.060 | -1 | 130,758 | [
"c#",
"java",
"oop",
"uml"
] |
4,084,013 | 1 | 4,084,475 | null | 18 | 17,558 | So one of my coworkers accidentally made a merge that actually only kept one side of the tree. So he started a merge, deleted all the changes introduced by the merge, and then committed the merge.
Here is a simple test case I did on a test repo. This repo has three branches. idx is the topic branch that was accidentally merged, and master is the mainline. dev is just a test of how revert -m works so you can ignore it.

What I want to do is revert the faulty merge. So from master I try to run `git revert -m 1 <sha1sum of faulty merge>` but then git responds with:
```
# On branch master
nothing to commit (working directory clean)
```
So it doesn't actually create a revert commit that undoes the merge. I believe that this happens because the merge didn't actually contain any real changes.
Is this a git bug, or am I missing something?
| How do you revert a faulty git merge commit | CC BY-SA 4.0 | 0 | 2010-11-03T03:32:15.317 | 2021-12-01T23:53:50.107 | 2021-12-01T23:53:50.107 | 175,830 | 175,830 | [
"git",
"version-control",
"merge"
] |
4,084,216 | 1 | null | null | -1 | 774 | ```
function searchsong_block($op='list',$delta=0){
$block = array();
switch($op){
case "list":
$block[0][info] = t('Search song');
return $block;
case "view":
$block['subject']='THIS IS SONG SEARCH MODULE';
$block['content']=drupal_get_form('custom1_default_form');
return $block;
}
}
function custom1_default_form () {
$form = array();
$form['txt_name'] =
array('#type' => 'textfield',
'#title' => t('Please enter your name'),
'#default_value' => variable_get('webservice_user_url',''),
'#maxlength' => '40',
'#size' => '20',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Details'),
);
return $form;
}
function custom1_default_form_validate (&$form, &$form_state) {
if(($form_state['values']['txt_name']) == '') {
form_set_error('user_webservice', t('Enter a name'));
}
}
function custom1_default_form_submit ($form_id, $form_values) {
$GET_TXT_VAL = $_POST['txt_name'];
$result = db_query('SELECT title FROM {node} WHERE type = "%s" AND title LIKE "%%%s%%"', 'song', $GET_TXT_VAL);
$output='';
while ($row = db_fetch_object($result)) {
// drupal_set_message($row->title);----IF I ENABLE THIS LINE THEN MY SEARCH RESULT DISPLAYING IN THE GREEN BLOCK, YES I KNOW THIS FUNCTION SOMETHING LIKE ECHO JUST FOR TESTING PURPOSE WE SHOULD USE
$output .=$row->title;
}
$block['content'] = $output;
}
```
How to print my output ,
Above module does not display anything , even error also,
i thing i should use theme('itemlist') somthing , but i am not sure how to use this , and where i should use this ,
So what i want is , i want to display my search result , in the content region ,
Please find my question picture view below..

| With custom module, display result , | CC BY-SA 2.5 | null | 2010-11-03T04:23:51.300 | 2010-11-03T04:51:56.150 | null | null | 246,963 | [
"drupal",
"drupal-6",
"drupal-modules"
] |
4,084,527 | 1 | 4,085,763 | null | 0 | 224 | I've the following HTML```
<html>
<body>
<div style="background:white;width:620px; height: 464px; overflow: hidden;">
<style>.v{width:100%;background: red;border:0px; color:#FFFFFF;text-align:
center; font-size: 11px;font-family:arial; vertical-align: middle;}</style>
<a target="_blank" href="http://www.google.com/">
<div style="height:28px;width:620px;display:table-cell" class="v">Video</div>
</a><video style="background:black" height="408px" width="100%" ></video>
<a target="_blank" >
<div class="v" style="height:28px;width:620px;display:table-cell">Bottom</div></a></div>
```
When I use a DOCTYPE with this I get a white line below the Video, otherwise it renders fine. This is without DOCTYPE.And this is with doctype `<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">`I tried tweaking CSS, but with no luck. Am I missing something?
| xhtml/mobile 1.2 DOCTYPE is causing weird artifacts | CC BY-SA 2.5 | null | 2010-11-03T05:53:53.590 | 2010-11-03T09:50:57.550 | null | null | 195,802 | [
"html",
"css",
"video",
"dtd"
] |
4,084,524 | 1 | 4,084,691 | null | 0 | 406 | (Its a continution fo my [question](https://stackoverflow.com/questions/4084393/how-to-read-xml-file-to-a-dictionarystring-liststring-with-empty-strings-for/4084407#4084407).
Now i'm having a dictionary
```
Dictionary<String, List<String>>MyDict = new Dictioanary<String, List<String>>();
```
and which contains
```
"A" { "A1", "", "" }
"B" { "B1", "B2", "" }
"C" { "C1", "C2", "C3" }
```
i need to add tthis data to a list view

Here the dictionary key is the Column header and Value is the item in each cell
so finally the `ListView` will be like

Using nested `for` loop we can do this, but is there any way to do this using LINQ.
| How to add Data from a Dictionary to a List View Control | CC BY-SA 3.0 | 0 | 2010-11-03T05:53:29.367 | 2017-07-05T07:29:51.290 | 2017-07-05T07:29:51.290 | 2,885,376 | 336,940 | [
"c#",
"linq",
"listview"
] |
4,085,115 | 1 | 4,085,147 | null | 0 | 1,396 | I want to implement a function in java that finds the null points of the sinus function. I know how to do that but I do not really understand the following definition of that problem:

Why halving the interval? Any ideas?
| Find null points of sinus function | CC BY-SA 2.5 | 0 | 2010-11-03T08:06:40.173 | 2014-02-24T03:22:32.417 | 2010-11-03T08:41:03.727 | 401,025 | 401,025 | [
"java",
"function",
"math"
] |
4,085,186 | 1 | null | null | 13 | 13,483 | How can I create a `ListPreference` with `checkbox`?
I know how to use `ListPreference`, but I need multiple selection like in Alarm application on "repeat" preference.
like this screenshot:

| How make a ListPreference with checkbox | CC BY-SA 3.0 | 0 | 2010-11-03T08:21:29.627 | 2019-09-19T04:18:29.050 | 2013-02-05T20:04:16.193 | 2,015,318 | 453,407 | [
"android",
"checkbox",
"preference",
"listpreference"
] |
4,085,373 | 1 | null | null | 8 | 4,485 | I have a function in my application which requires admin rights.
What I want is when I click the button to execute that function, it should ask for admin username and password. (Launch UAC dialog. Also show icon on that button.)
Is it possible?

PS: I know about launching the application with admin right by making modifications in manifest file.
Also this function is a part of a large program and it cannot be transferred to a separate program.
| Admin rights prompt popup in C# application | CC BY-SA 2.5 | 0 | 2010-11-03T08:52:13.507 | 2010-11-03T12:25:24.903 | 2010-11-03T09:18:25.657 | 495,680 | 495,680 | [
"c#",
"wpf",
"c#-3.0",
"uac"
] |
4,085,610 | 1 | 4,086,103 | null | 0 | 1,650 | i'm attempting to make a purchase ordering system for work in php, mysql and jquery. I've got a "running total" working great but i've come to the point where if the user is happy and wants to proceed to order the products they've selected i want to take the items at the bottom of the screen (attached picture to see what i mean) and send the values to a php script which will insert them into a db called "orders". what i imagined happening was they press "save" and jquery grabs all the values from the rows in the table at the bottom and sends them via "GET" to the waiting PHP, the php would insert all data it receives into the db, all with a unique "id" so people can pull back orders at a later date...I know what i want to do but i'm struggling to plan out the specific mysql querys/jquery stuff! Any help appreciated! 
| jquery/php/mysql purchase ordering system help needed | CC BY-SA 2.5 | null | 2010-11-03T09:24:23.703 | 2010-11-03T10:30:59.807 | null | null | 478,144 | [
"php",
"jquery",
"mysql",
"database",
"get"
] |
4,085,978 | 1 | 4,090,663 | null | 11 | 35,478 | I have a WCF service hosted and I'm trying to use it within an iPhone app as a JSON POST request. I plan on using the JSON serializer later, but this is what I have for the request:
```
NSString *jsonRequest = @"{\"username\":\"user\",\"password\":\"letmein\"}";
NSLog(@"Request: %@", jsonRequest);
NSURL *url = [NSURL URLWithString:@"https://mydomain.com/Method/"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];
[NSURLConnection connectionWithRequest:[request autorelease] delegate:self];
```
In my data received I'm just printing it to the console:
```
- (void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSMutableData *d = [[NSMutableData data] retain];
[d appendData:data];
NSString *a = [[NSString alloc] initWithData:d encoding:NSASCIIStringEncoding];
NSLog(@"Data: %@", a);
}
```
And within this response I get this message:
```
Data: <?xml version="1.0" encoding="utf-8"?>
<!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>Request Error</title>
<style>
<!-- I've took this out as there's lots of it and it's not relevant! -->
</style>
</head>
<body>
<div id="content">
<p class="heading1">Request Error</p>
<p xmlns="">The server encountered an error processing the request. Please see the <a rel="help-page" href="https://mydomain.com/Method/help">service help page</a> for constructing valid requests to the service.</p>
</div>
</body>
</html>
```
Does anyone know why this happens and where I'm going wrong?
I've read about using [ASIHTTPPost](http://allseeing-i.com/ASIHTTPRequest/) instead but I can't get the demo to run in iOS4 :(
Thanks
EDIT:
I've just used to [CharlesProxy](http://www.charlesproxy.com/) to sniff out what's happening when I call from the iPhone (Simulator) and this is what it gave me:

(This also happens in my working windows client).
I've just ran this on my windows client and the only thing that is different is the Request and Response text which is encrypted. Am I missing something in order to use a secure HTTP connection to do this?
NEW EDIT:
This works with a non-HTTPS request such as:
[http://maps.googleapis.com/maps/api/geocode/json?address=UK&sensor=true](http://maps.googleapis.com/maps/api/geocode/json?address=UK&sensor=true). So I guess the problem is getting the iPhone to send the POST properly over SSL?
I am also using these methods:
```
- (void) connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
forAuthenticationChallenge:challenge];
}
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
- (void) connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
if([[protectionSpace authenticationMethod] isEqualToString:NSURLAuthenticationMethodServerTrust])
{
return YES;
}
}
```
This allows me to get this far. If I don't use them I get an error sent back saying:
> The certificate for this server is invalid. You might be connecting to a server that is pretending to be “mydomain.com” which could put your confidential information at risk.
| JSON POST Request on the iPhone (Using HTTPS) | CC BY-SA 2.5 | 0 | 2010-11-03T10:17:24.917 | 2014-12-24T05:28:16.503 | 2010-11-03T18:49:46.677 | 143,979 | 143,979 | [
"iphone",
"objective-c",
"json",
"ssl",
"https"
] |
4,086,420 | 1 | 4,086,467 | null | 1 | 143 | I tried Build and Analyze tool of Xcode very first time today.
and found some thing in this function
Please check the image:

```
-(IBAction)completeSessionButAct:(id)sender{
NSDictionary *tempDic = [[NSDictionary alloc] initWithObjectsAndKeys:[self view],@"mainview",
congratulationScreen,@"screen",
congScreenLabel,@"cong_screen_label",
congScrStatusLabel,@"cong_scr_status_label",
[sender superview],@"last_screen",nil];
[functionality completeSession:tempDic];
}
```
this function start from line 64 and end at 71
Can Any one explain me the memory leakage in this function.
| Build and Analyze tool Cocoa Xcode | CC BY-SA 3.0 | null | 2010-11-03T11:09:34.983 | 2013-04-18T09:48:00.910 | 2013-04-18T09:48:00.910 | 664,177 | 488,506 | [
"cocoa",
"xcode",
"memory-management"
] |
4,086,717 | 1 | 4,086,770 | null | 39 | 172,056 | A website I've made has a few problems... On one of the pages, wherever there's an apostrophe (`'`) or a dash (`-`), the symbol gets replaced with a weird black diamond with a question mark in the center of it
Here's what I mean

It seems this is happening all over the site wherever these symbols appear. I've never seen this before, can anyone explain it to me?
Suggestions on how to fix it would also be greatly appreciated.
See [http://test.rfinvestments.co.za/index.php?c=team](http://test.rfinvestments.co.za/index.php?c=team) for a clear look at the problem.
| Why do symbols like apostrophes and hyphens get replaced with black diamonds on my website? | CC BY-SA 2.5 | 0 | 2010-11-03T11:49:53.390 | 2019-08-06T11:13:16.630 | 2010-11-03T12:31:38.320 | 20,578 | 475,766 | [
"html",
"character-encoding"
] |
4,086,722 | 1 | null | null | 1 | 532 | I have an image with yellow background containing a random figure as shown in figure:

The random figure is divided by black lines into image pieces. Now each piece can be represented separately as a square containing that piece image with transparent background.
My question if it possible to find the coordinates of each piece algorithmically in the original image?
I am writing this application in Java.
I don't have much idea about the graphics. If its possible then please elaborate little bit.
| Dividing the image and getting coordinates | CC BY-SA 2.5 | null | 2010-11-03T11:50:21.330 | 2010-11-03T12:14:54.440 | 2010-11-03T11:51:50.413 | 50,476 | 33,411 | [
"java",
"graphics",
"image-processing"
] |
4,086,761 | 1 | 4,086,836 | null | 0 | 641 | ```
<span style='float: left; margin: 10px; width: 60px; display: block;'>
<img style='border: 1px solid #FFF; width: 61px; height: 80px;' src='images/profilePhoto/thumbs/86.jpg'>
<br>
<a href='profil.php?id=86'>Megan F.</a>
<br><br>
</span>
<div style='margin-left: 90px;'>
<h1>(inget ämne)</h1>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec fringilla urna eget urna euismod aliquet. Duis porta volutpat blandit. Phasellus bibendum bibendum porta. Nunc molestie tristique leo, sed euismod orci ultricies vitae. Mauris non libero a leo ultricies laoreet. Suspendisse luctus urna vel sapien tristique vitae semper nulla eleifend. Integer congue aliquam pharetra. Phasellus diam neque, tincidunt vel elementum vel, ornare sit amet mi. Nulla tincidunt purus in odio vulputate mollis. Nunc urna odio, rutrum eu ultricies a, facilisis ullamcorper nunc. In purus velit, varius vel laoreet eu, tincidunt non purus. Nulla facilisi. Sed ac lectus nibh. Praesent non velit nibh.<br />
...
</div>
```
This is what i have right now for this:

How can i apply text there like showed in the image?
| CSS/HTML: Have text at left side | CC BY-SA 2.5 | null | 2010-11-03T11:53:59.020 | 2010-11-03T12:02:44.787 | null | null | 457,827 | [
"html",
"css"
] |
4,087,759 | 1 | null | null | 0 | 870 | In this web page [EntityCube](http://entitycube.research.microsoft.com/Guanxi.aspx) we can type in a person's name then we will get a relationship graph describing the social network of this person, for example we type in bill gates we will get like this:

Does anybody know the algorithm behind this?
| How to calculate the relation ship graph between people? | CC BY-SA 2.5 | null | 2010-11-03T13:59:15.963 | 2022-05-30T18:14:56.850 | 2022-05-30T18:14:56.850 | 3,689,450 | 437,472 | [
"algorithm",
"graph",
"social-networking"
] |
4,087,745 | 1 | 4,087,805 | null | 2 | 292 | i'm attempting to draw a red stroke (1 thickness) around a rounded rectangle but the stroke is not lining up correctly around the rounded corners.
my rounded rectangle's corners have an ellipseWidth and ellipseHeight of 40. since they are equal i'm confident in assuming that the curvature of each corner begins at minus half of the corner size. so instead of drawing my stroke all the way to the corner i will end the stroke at 20 pixels before the corner and curve it to 20 pixels after the corner. clear as mud?
interestingly, if i draw my stroke all the way around the rounded rectangle following the same code, the stroke is only inaccurately drawn around these two corners. additionally, if the stroke is increased to 2, the gaps are no longer visible.
```
//Rounded Rectangle
var rectWidth:uint = 300;
var rectHeight:uint = 100;
var rectCorners:uint = 40;
var rect:Shape = new Shape();
rect.graphics.beginFill(0);
rect.graphics.drawRoundRect(-rectWidth / 2, -rectHeight / 2, rectWidth, rectHeight, rectCorners, rectCorners);
//Stroke
var stroke:Shape = new Shape();
stroke.graphics.lineStyle(1, 0xFF0000, 1, true, "normal", "none", "miter", 3);
//Stroke Around Top Right Corner
stroke.graphics.moveTo(rect.x + rectWidth / 2 - rectCorners / 2, rect.y - rectHeight / 2);
stroke.graphics.curveTo(rect.x + rectWidth / 2, rect.y - rectHeight / 2, rect.x + rectWidth / 2, rect.y - rectHeight / 2 + rectCorners / 2);
//Stroke Around Bottom Right Corner
stroke.graphics.lineTo(rect.x + rectWidth / 2, rect.y + rectHeight / 2 - rectCorners / 2);
stroke.graphics.curveTo(rect.x + rectWidth / 2, rect.y + rectHeight / 2, rect.x + rectWidth / 2 - rectCorners / 2, rect.y + rectHeight / 2);
//Add To Display List
addChild(rect);
addChild(stroke);
```

---
## UPDATE
the larger the round rect and its corners become, the more displaced my stroke becomes. i am no longer confident that my curvature/anchor points for my curveTo() functions are correct. any thoughts?

| ActionScript - Inaccurate Graphics? | CC BY-SA 2.5 | null | 2010-11-03T13:57:40.593 | 2010-11-05T00:31:36.143 | 2010-11-05T00:31:36.143 | 336,929 | 336,929 | [
"flash",
"actionscript-3",
"graphics",
"stroke"
] |
4,087,919 | 1 | 4,092,160 | null | 202 | 15,369 | After my previous question on [finding toes within each paw](https://stackoverflow.com/questions/3684484), I started loading up other measurements to see how it would hold up. Unfortunately, I quickly ran into a problem with one of the preceding steps: recognizing the paws.
You see, my proof of concept basically took the maximal pressure of each sensor over time and would start looking for the sum of each row, until it finds on that != 0.0. Then it does the same for the columns and as soon as it finds more than 2 rows with that are zero again. It stores the minimal and maximal row and column values to some index.

As you can see in the figure, this works quite well in most cases. However, there are a lot of downsides to this approach (other than being very primitive):
- Humans can have 'hollow feet' which means there are several empty rows within the footprint itself. Since I feared this could happen with (large) dogs too, I waited for at least 2 or 3 empty rows before cutting off the paw. This creates a problem if another contact made in a different column before it reaches several empty rows, thus expanding the area. I figure I could compare the columns and see if they exceed a certain value, they must be separate paws.- The problem gets worse when the dog is very small or walks at a higher pace. What happens is that the front paw's toes are still making contact, while the hind paw's toes just start to make contact within the same area as the front paw!With my simple script, it won't be able to split these two, because it would have to determine which frames of that area belong to which paw, while currently I would only have to look at the maximal values over all frames.
Examples of where it starts going wrong:


(after which I'll get to the problem of deciding which paw it is!).
I've been tinkering to get Joe's (awesome!) answer implemented, but I'm having difficulties extracting the actual paw data from my files.

The coded_paws shows me all the different paws, when applied to the maximal pressure image (see above). However, the solution goes over each frame (to separate overlapping paws) and sets the four Rectangle attributes, such as coordinates or height/width.
I can't figure out how to take these attributes and store them in some variable that I can apply to the measurement data. Since I need to know for each paw, what its location is during which frames and couple this to which paw it is (front/hind, left/right).
I have the measurements I used in the question setup in my public Dropbox folder ([example 1](http://dl.dropbox.com/u/5207386/Examples/Normal%20measurement), [example 2](http://dl.dropbox.com/u/5207386/Examples/Grouped%20up%20paws), [example 3](http://dl.dropbox.com/u/5207386/Examples/Overlapping%20paws)). [For anyone interested I also set up a blog](http://flipserd.com/blog) to keep you up to date :-)
| How can I improve my paw detection? | CC BY-SA 3.0 | 0 | 2010-11-03T14:13:05.677 | 2013-01-28T16:54:01.520 | 2017-05-23T12:03:01.573 | -1 | 77,595 | [
"python",
"image-processing"
] |
4,088,066 | 1 | 4,088,949 | null | 0 | 686 | Right, so I'm new to Castle and I'm trying to figure out how far I need to go to wire up a service. Below is a sample of the classes I'm working with and where they sit in the world I've created.

What I'm trying to accomplish it to properly wire up Castle so that I can call the TemplateEmailViaSalesforce class to do the work, and have the dependent classes wired up via DI from Castle. But I'm unsure of how far I have to go when registering components. Below is my first attempt (I'm registering via code as a trial, and this is a mashup of a couple methods to create the container)
```
IWindsorContainer container = new WindsorContainer();
container.AddFacility<FactorySupportFacility>();
// add the DAL mapper factory
container.AddComponent<ITemplateMapperFactory>();
// individual mappers
container.Register(Component.For<ICSGEmailTemplateMapper>().UsingFactory((ITemplateMapperFactory f) => f.CSGEMailTemplate));
container.Register(Component.For<IUserMapper>().UsingFactory((ITemplateMapperFactory f) => f.User));
container.Register(Component.For<IGoupMapper>().UsingFactory((ITemplateMapperFactory f) => f.Group));
container.Register(Component.For<IAccountTeamMapper>().UsingFactory((ITemplateMapperFactory f) => f.AccountTeam));
container.Register(Component.For<ISalesTeamMapper>().UsingFactory((ITemplateMapperFactory f) => f.SalesTeam));
container.Register(Component.For<ICSGFormulaMapper>().UsingFactory((ITemplateMapperFactory f) => f.CSGFormula));
container.Register(Component.For<ISFObjectDefinitionMapper>().UsingFactory((ITemplateMapperFactory f) => f.SFDCObjectDefinition));
container.Register(Component.For<ISFObjectValueMapper>().UsingFactory((ITemplateMapperFactory f) => f.SFDCObjectValue));
container.Register(Component.For<ISalesforceTemplateMapper>().UsingFactory((ITemplateMapperFactory f) => f.Template));
container.Register(Component.For<IRecipientMapper>().UsingFactory((ITemplateMapperFactory f) => f.Recipient));
// BLL stuff (domain components)...general
container.AddComponent<CSGEmailTemplateRepository, CSGEmailTemplateRepository>();
container.AddComponent<RecipientRepository, RecipientRepository>();
container.AddComponent<SFObjectDefinitionRepository, SFObjectDefinitionRepository>();
container.AddComponent<SFObjectValueRepository, SFObjectValueRepository>();
container.AddComponent<TemplateRepository, TemplateRepository>();
container.AddComponent<UserRepository, UserRepository>();
container.AddComponent<ITemplateService, TemplateService>();
// specific for this action
container.AddComponent<TemplateEmailerViaSalesforce>();
container.AddComponent<TemplateParse>();
// Aspects
container.AddComponent<TraceAspect>();
```
Now, I get an error later at: `container.Resolve<TemplateEmailerViaSalesforce>();`
```
AssemblerTests.ShouldCreateTemplateService : FailedTest method Tests.AssemblerTests.ShouldCreateTemplateService threw exception: Castle.MicroKernel.Facilities.FacilityException: You have specified a factory ('Castle.MicroKernel.Registration.GenericFactory`1[[CSG.Salesforce.TemplateEmailer.DAL.Access.IUserMapper, CSG.Salesforce.TemplateEmailer.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' - method to be called: Create) for the component 'CSG.Salesforce.TemplateEmailer.DAL.Access.IUserMapper' CSG.Salesforce.TemplateEmailer.DAL.Access.IUserMapper that failed during invoke. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Castle.MicroKernel.ComponentRegistrationException: Type CSG.Salesforce.TemplateEmailer.DAL.ITemplateMapperFactory is abstract.
```
The failure seems to be with IUserMapper which is defined as `class UserMapper:BaseSalesforceMapper<UserData>,IUserMapper`
The other mappers work but I get an error that not all dependencies were satisfied, which I need the IUserMapper registration to satisfy fully.
How far down the rabbit hole do I have to go to get this wired? At this point I'm looking though the BLL into the DAL and into a base class that app mappers are built from and it doesn't seem right. I'm struggling with figuring out what I have to get registered and what will be implicitly done with DI by Castle itself.
Any help at all would be appreciated. Thanks.`enter code here`
| How deep must I go in the classes to properly wire up Castle Windsor for DI? | CC BY-SA 2.5 | null | 2010-11-03T14:28:37.227 | 2010-11-03T16:04:40.247 | 2010-11-03T16:04:40.247 | 120,526 | 120,526 | [
"c#",
"castle-windsor",
"ioc-container"
] |
4,088,562 | 1 | 4,088,957 | null | 1 | 374 | Given an original image of:

This resizes to look as such:

ALL the images being stores on the server are correct with BLUE gradient background. But when it is resized and served it shows with black background! And darkened considerably.
On my local server there is no problem, it only does this on the live server!
My thumbnailing code is:
```
<%@ WebHandler Language="C#" Class="Thumbnail" %>
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Web;
public class Thumbnail : IHttpHandler {
private int _thumbnailSize = 150;
public void ProcessRequest(HttpContext context) {
// Name of photo file
string photoName = context.Request.QueryString["p"];
// Size index
string sizeIndex = context.Request.QueryString["s"];
string saveAction = context.Request.QueryString["a"];
int width;
int height;
int maxWidth = 0;
int maxHeight = 0;
Bitmap photo;
bool customResize = false;
//Get original path of picture
string photoPath = "";
if (photoName.IndexOf('/') > 0)
{
photoPath = context.Server.MapPath(photoName);
}
else
{
photoPath = context.Server.MapPath("../uploads/originals/" + photoName);
}
// Create new bitmap
try {
photo = new Bitmap(photoPath);
}
catch (ArgumentException) {
throw new HttpException(404, "Photo not found.");
}
context.Response.ContentType = "image/png";
// Initialise width as native
width = photo.Width;
height = photo.Height;
// Slideshow image (big)
if (sizeIndex == "1")
{
// Set max widths and heights
maxWidth = 500;
maxHeight = 300;
customResize = true;
}
// Big(ger) thumbnail
else if (sizeIndex == "3")
{
// Set max widths and heights
maxWidth = 150;
maxHeight = 150;
customResize = true;
}
// Big(ger) thumbnail
else if (sizeIndex == "4")
{
// Set max widths and heights
maxWidth = 30;
maxHeight = 30;
customResize = true;
}
// Standard thumbnail
else
{
maxHeight = 75;
// Normalise height
if (photo.Height > maxHeight)
{
height = maxHeight;
double newWidth = photo.Width / (photo.Height / height);
width = int.Parse(newWidth.ToString());
}
else
{
height = photo.Height;
width = photo.Width;
}
}
// Resize
if (customResize && (width > maxWidth || height > maxHeight))
{
double scale = Math.Min(1, Math.Min((double)maxWidth / (double)photo.Width, (double)maxHeight / (double)photo.Height));
width = int.Parse((Math.Round((double)photo.Width * scale,0)).ToString());
height = int.Parse((Math.Round((double)photo.Height * scale,0)).ToString());
}
// Generate and show image
Bitmap target = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(target)) {
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.DrawImage(photo, 0, 0, width, height);
using (MemoryStream memoryStream = new MemoryStream()) {
target.Save(memoryStream, ImageFormat.Png);
//OutputCacheResponse(context, File.GetLastWriteTime(photoPath));
//using (FileStream diskCacheStream = new FileStream(cachePath, FileMode.CreateNew)) {
// memoryStream.WriteTo(diskCacheStream);
//}
// If savinf
if (saveAction == "s")
{
FileStream outStream = File.OpenWrite(context.Server.MapPath("../uploads/gallery/" + photoName));
memoryStream.WriteTo(outStream);
outStream.Flush();
outStream.Close();
}
else{
memoryStream.WriteTo(context.Response.OutputStream);
}
}
}
}
private static void OutputCacheResponse(HttpContext context, DateTime lastModified) {
/* HttpCachePolicy cachePolicy = context.Response.Cache;
cachePolicy.SetCacheability(HttpCacheability.Public);
cachePolicy.VaryByParams["p"] = true;
cachePolicy.SetOmitVaryStar(true);
cachePolicy.SetExpires(DateTime.Now + TimeSpan.FromDays(7));
cachePolicy.SetValidUntilExpires(true);
cachePolicy.SetLastModified(lastModified);*/
}
public bool IsReusable {
get {
return false;
}
}
}
```
| ASP.net image thumbnails go greyscale(ish) - Weird! | CC BY-SA 2.5 | null | 2010-11-03T15:14:29.227 | 2010-11-03T16:10:18.737 | null | null | 356,635 | [
"asp.net",
"image-processing",
"thumbnails",
"ashx",
"image-resizing"
] |
4,088,702 | 1 | 4,089,936 | null | 2 | 664 | When I run a query in Toad, sometimes it splits the output into blocks. How do I get the whole dataset as a single set?

| toad splits my output | CC BY-SA 2.5 | null | 2010-11-03T15:28:34.467 | 2010-11-04T10:53:13.797 | 2010-11-03T17:29:09.207 | 109,035 | 109,035 | [
"oracle",
"plsql",
"toad"
] |
4,088,711 | 1 | 4,088,763 | null | 31 | 17,370 | I've a `ListView` that can have inside (like "My Downloads").
Is there anyway to show a default text "" ?
Thanks !
: here is my solution,
```
TextView emptyView = new TextView(getApplicationContext());
emptyView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
emptyView.setTextColor(R.color.black);
emptyView.setText(R.string.no_purchased_item);
emptyView.setTextSize(20);
emptyView.setVisibility(View.GONE);
emptyView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
((ViewGroup)getListView().getParent()).addView(emptyView);
getListView().setEmptyView(emptyView);
```

| Android ListView : default text when no items | CC BY-SA 2.5 | 0 | 2010-11-03T15:29:09.133 | 2015-06-08T12:02:03.283 | 2010-11-03T19:12:18.347 | 406,761 | 406,761 | [
"android",
"listview"
] |
4,089,400 | 1 | null | null | 7 | 5,245 | What's a good (preferably free) software tool for creating data structure diagrams? For example, something like this:

| Software for creating data structure diagrams? | CC BY-SA 2.5 | 0 | 2010-11-03T16:44:59.197 | 2013-12-12T06:46:04.210 | 2013-12-12T06:46:04.210 | 881,229 | 83,280 | [
"data-structures",
"visualization"
] |
4,089,450 | 1 | 4,380,017 | null | 14 | 30,281 | I use xcode 3.2.4 on snow leopard. Today when I tried to save a file on my project I get an error message saying: The document "nameOfFile.m" could not be saved. I tried reinstalling xcode but no luck. The file can be edited with other editors and I see the same behavior on all my projects as well as newly created projects. Any ideas?

| xcode The document "..." could not be saved | CC BY-SA 3.0 | 0 | 2010-11-03T16:50:14.683 | 2021-01-05T20:56:56.790 | 2014-10-14T05:49:58.777 | 1,753,005 | 268,604 | [
"xcode",
"save"
] |
4,089,656 | 1 | 4,089,698 | null | 4 | 4,802 | I have a table in SQL Server 2005 whose primary key is an identity column (increment 1), and I also have a default value set for one of the other columns.
When I open the table in SQL Server Management Studio and type in a new record into the table, the inserted values are not displayed, and I get the following message on save:

However, if the table has an identity column, one or more columns with a default value specified, the inserted value(s) will be displayed in the table after a save. And can be edited.
I frequently create test data in ssms this way and this issue makes it cumbersome to do some things I would like to.
Is there any way around this?
| Message: This row was successfully committed to the database. However, a problem occurred | CC BY-SA 2.5 | null | 2010-11-03T17:13:01.940 | 2010-11-03T17:26:14.363 | 2010-11-03T17:26:14.363 | 13,302 | 105,407 | [
"sql-server"
] |
4,089,717 | 1 | null | null | 4 | 11,085 | Can anyone explain why Nimbius treats the setOpaque() differently than other java LaF's. Its breaking my code because components that are normally transparent no longer are.
EDIT: The problem seems to only deal with JTextAreas (which is what I need) or similar components.
EDIT EDIT: This is a screen of the actual application. When applying trashgod's solution, the background still does not show through.

EDIT EDIT EDIT: I tried trashgod's suggestion to override the paint(). I toiled with this for hours, and could not get it to work. I was able to get the background to show through, but the JinternalFrame was unable to be moved, resized, and have its text selected. Calling super.paint(g) failed to solve the solution. Is there an easy way to do this that I might be missing?
Ive taken a new approach to this. Inside the JInternalFrame is a JLayeredPane.
Layer 0 - JLabel
Layer 1 - JTextArea
When the JInternalFrame is moved or resized:
1. Makes itself invisible
2. Takes a screen shot of where it was in the container its contained in
3. Paints the JLabel with the image it took
4. Makes itself visible again.
Since I could not get the JInternalFrame to be transparent at all. I simulated its transpaency. The only issue is, there is a lot of overhead associated with this. Any thoughts?

```
package newpackage;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
/**
* Example of how to create a transparent internal frame.
* @author dvargo
*/
public class TransparentInternalFrame extends JInternalFrame {
JLayeredPane container;
/**
* Defualt constructor to set the frame up
* @param container The container for the frame
* @param opacity The opacity of the frame
*/
public TransparentInternalFrame(JLayeredPane container, int opacity) {
super("", true, true, true, true);
this.container = container;
initComponents();
setSize(200, 200);
putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
scrollPane.setBackground(new Color(0, 0, 0, opacity));
scrollPane.getViewport().setBackground(new Color(0, 0, 0, opacity));
textArea.setBackground(new Color(0, 0, 0, opacity));
setBG();
}
/**
* Builds the GUI
*/
private void initComponents() {
layeredPane = new javax.swing.JLayeredPane();
imageLabel = new javax.swing.JLabel();
scrollPane = new javax.swing.JScrollPane();
textArea = new javax.swing.JTextArea();
imageLabel.setBounds(0, 0, 360, 260);
layeredPane.add(imageLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);
scrollPane.setBorder(null);
textArea.setColumns(20);
textArea.setRows(5);
textArea.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
textAreaKeyPressed(evt);
}
public void keyReleased(java.awt.event.KeyEvent evt) {
textAreaKeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
textAreaKeyTyped(evt);
}
});
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentMoved(java.awt.event.ComponentEvent evt) {
frameMoved();
}
public void componentResized(java.awt.event.ComponentEvent evt) {
frameResized();
}
});
scrollPane.setViewportView(textArea);
scrollPane.setBounds(0, 0, 360, 260);
layeredPane.add(scrollPane, javax.swing.JLayeredPane.PALETTE_LAYER);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(layeredPane, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE));
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(layeredPane, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE));
}
/**
* The text will be blurred with out this
* @param evt
*/
private void textAreaKeyTyped(java.awt.event.KeyEvent evt) {
repaintAll();
}
/**
* The text will be blurred with out this
* @param evt
*/
private void textAreaKeyPressed(java.awt.event.KeyEvent evt) {
repaintAll();
}
/**
* The text will be blurred with out this
* @param evt
*/
private void textAreaKeyReleased(java.awt.event.KeyEvent evt) {
repaintAll();
}
/**
* Capture whats behind the frame and paint it to the image label
*/
private void setBG() {
setVisible(false);
Rectangle location = new Rectangle(this.getX() + container.getX(),
this.getY() + container.getY(),
(int) this.getSize().getWidth() + 8 + ((javax.swing.plaf.basic.BasicInternalFrameUI) getUI()).getNorthPane().getWidth(),
(int) this.getSize().getHeight() + ((javax.swing.plaf.basic.BasicInternalFrameUI) getUI()).getNorthPane().getHeight() + 4);
ImageIcon newIcon = new ImageIcon(createImage((JComponent) container, location));
setVisible(true);
imageLabel.setIcon(newIcon);
repaint();
}
/**
* Only need to update the image label if the frame is moved or resized
*/
private void frameResized() {
setBG();
textArea.repaint();
}
/**
* Only need to update the image label if the frame is moved or resized
*/
private void frameMoved() {
setBG();
for(Component x : container.getComponents())
{
//see if its a jinternalframe
if(x.getClass().getName().equals(this.getClass().getName()))
{
//cast it
TransparentInternalFrame temp = (TransparentInternalFrame)x;
//make sure its not the same one as this
if(x.getBounds().equals(this.getBounds()))
{
return;
}
//if they intersect
if(x.getBounds().intersects(this.getBounds()))
{
this.setVisible(false);
temp.setBG();
this.setVisible(true);
}
}
}
textArea.repaint();
}
private void repaintAll() {
textArea.repaint();
imageLabel.repaint();
layeredPane.repaint();
scrollPane.repaint();
scrollPane.getViewport().repaint();
textArea.repaint();
repaint();
}
/**
* Create a BufferedImage for Swing components.
* All or part of the component can be captured to an image.
*
* @param component Swing component to create image from
* @param region The region of the component to be captured to an image
* @return image the image for the given region
*/
public static BufferedImage createImage(JComponent component, Rectangle region) {
// Make sure the component has a size and has been layed out.
// (necessary check for components not added to a realized frame)
if (!component.isDisplayable()) {
Dimension d = component.getSize();
if (d.width == 0 || d.height == 0) {
d = component.getPreferredSize();
component.setSize(d);
}
layoutComponent(component);
}
BufferedImage image = new BufferedImage(region.width, region.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = image.createGraphics();
// Paint a background for non-opaque components,
// otherwise the background will be black
if (!component.isOpaque()) {
g2d.setColor(component.getBackground());
g2d.fillRect(region.x, region.y, region.width, region.height);
}
g2d.translate(-region.x, -region.y);
component.paint(g2d);
g2d.dispose();
return image;
}
public static void layoutComponent(Component component) {
synchronized (component.getTreeLock()) {
component.doLayout();
if (component instanceof Container) {
for (Component child : ((Container) component).getComponents()) {
layoutComponent(child);
}
}
}
}
private javax.swing.JLabel imageLabel;
private javax.swing.JScrollPane scrollPane;
private javax.swing.JLayeredPane layeredPane;
private javax.swing.JTextArea textArea;
public static void main(String args[])
{
try
{
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception e)
{
e.printStackTrace();
}
JFrame container = new JFrame();
container.setSize(800, 800);
JLayeredPane layerPanel = new JLayeredPane();
layerPanel.setSize(800, 800);
container.getContentPane().add(layerPanel);
layerPanel.setVisible(true);
JPanel colorPanel = new JPanel();
colorPanel.setSize(800,800);
colorPanel.setBackground(Color.red);
layerPanel.add(colorPanel);
layerPanel.setLayer(colorPanel, JLayeredPane.DEFAULT_LAYER);
TransparentInternalFrame frameA = new TransparentInternalFrame(layerPanel,0);
frameA.setVisible(true);
layerPanel.add(frameA);
layerPanel.setLayer(frameA, 1);
frameA.setSize(282,282);
TransparentInternalFrame frameB = new TransparentInternalFrame(layerPanel, 0);
frameB.setVisible(true);
layerPanel.add(frameB);
layerPanel.add(frameB,1);
frameB.setLocation(300, 300);
frameB.setSize(282,282);
container.repaint();
container.setVisible(true);
}
}
```
| setOpaque() in java | CC BY-SA 2.5 | 0 | 2010-11-03T17:19:11.600 | 2016-03-19T12:28:13.993 | 2010-11-09T17:33:11.017 | 489,041 | 489,041 | [
"java",
"swing",
"look-and-feel",
"nimbus"
] |
4,089,994 | 1 | 4,090,030 | null | 0 | 81 | I've downloaded Subsonic 3 from the website.
I added a connnectionstring section to my webconfig and updated the settings file as suggested on the website.
When It builds the code The Context.cs errors with the following:

All the other classes that it's built look ok. The correct table names are there etc. I'm sure this is a noob type question.. so I'm hoping an easy one for a subsonic guru out there.
Dave
| Subsonic 3 t4 template fails to compile | CC BY-SA 2.5 | null | 2010-11-03T17:48:12.117 | 2010-11-03T17:52:34.740 | null | null | 30,317 | [
"subsonic",
"subsonic3"
] |
4,090,044 | 1 | 4,092,090 | null | 2 | 1,886 | Scenario: A user has asked me to provide them a button where they can select a .xls and it will import the data into the corresponding columns in a table.
Question: I will provide the code below, but basically once it tries to open the workbook it gives me the error below. I have googled for a number of solutions but I'm still getting this error.

```
Private Sub Command20_Click()
Dim fdg As FileDialog, vrtSelectedItem As Variant
Dim strSelectedFile As String
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
With fdg
.AllowMultiSelect = False
.ButtonName = "Select"
.InitialView = msoFileDialogViewList
.Title = "Select Input Files"
'add filter for excel
With .Filters
.Clear
.Add "Excel Spreadsheets", "*.xls"
End With
.FilterIndex = 1
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems 'onby be 1
Dim app As New Excel.Application
app.Workbooks.Open (vrtSelectedItem)
app.Worksheets(1).Activate
For Each rwRow In ActiveWorkbook.Worksheets(1).Rows
' Do things with the rwRow object
Next rwRow
strSelectedFile = vrtSelectedItem
Next vrtSelectedItem
Me![txtSelectedFile] = strSelectedFile
Else 'The user pressed Cancel.
End If
End With
Set fd = Nothing
End Sub
```
| Import Excel file into Access table Run-time Error '-2147352565 (8002000b)' | CC BY-SA 2.5 | null | 2010-11-03T17:55:16.823 | 2010-11-03T22:05:14.580 | null | null | 337,422 | [
"ms-access",
"vba",
"import-from-excel"
] |
4,090,107 | 1 | 4,107,590 | null | 1 | 969 | I'm currently trying to create a procedural planet generating tool. I have started off by mapping a cube to a sphere like so:

Next I'm using Libnoise to a heightmap cube using 3D Perlian noise. I am able to generate a seamless cubmap. I have checked this in photoshop and though I had to rotate the heightmap images to get them to fit in the net I think they are the correct orientation.
I have tried getting the perlin value for the co ordinates before they are mapped to a sphere and after, but I am unable to make the edges match up:

At the moment I am creating geometry between -0.8 and +0.8 and then adding 0.2 * heightmap percentage.
Either I am making use of the heightmap data wrongly or the heightmaps are not orientated correctly (I suspect it is a little of both).
| Problems mapping cubemaps to a sphere | CC BY-SA 3.0 | 0 | 2010-11-03T18:02:31.070 | 2015-03-14T06:01:52.877 | 2015-03-14T06:01:52.877 | 44,729 | 483,609 | [
"opengl",
"geometry",
"texture-mapping",
"procedural-programming",
"procedural-generation"
] |
4,090,139 | 1 | 4,100,576 | null | 2 | 103 | I have a host application that controls various factory classes which produce implementations of a common data contract. Also, all the factories derive from a particular factory contract. The factories may need particular implementations of the data contract to generate their own objects... so the host can generically pass data via a function in the factory contract that has one argument of the data contract type. The factories then try to cast it to the type they are interested in... ignoring it if it doesn't match. This all works ok so far.
I wanted to extend this to allow users to create add-in factories using the .NET add-in framework, but I'm concerned about the isolation boundaries... For instance, if a factory produces an IData instance, can another factory cast objects produced by the add-in to the shared concrete implementation type? It looks like the need for adaptors in the add-in pipeline may screw this up?
For instance, in the diagram below, the concrete class DataA would be shared between PluginA and PluginB, and the concrete class DataB would be shared between PluginB and PluginC.

---
So far I only knew about the System.Addin functionality for creating add-ins... and the older methods involving direct reflection. I've just discovered MEF, which supposedly doesn't concern itself with the isolation boundaries that are core to the System.Addin stuff. Does anyone with experience with MEF know how this might impact my scenario?
| .NET add-ins for factory classes where the data can be casted back to the concrete | CC BY-SA 2.5 | 0 | 2010-11-03T18:05:40.173 | 2010-11-04T19:40:41.370 | 2010-11-04T16:47:52.047 | 124,034 | 124,034 | [
"c#",
"interface",
"casting",
"add-in"
] |
4,090,153 | 1 | 4,090,400 | null | -2 | 2,523 | I have following challenge:
Implement a function that searches for a null point of the sinus function in a interval between a and b. The search-interval[lower limit, upper limit] should be halved until lower limit and upper limit are less then 0.0001 away from each other.
1. Find a condition to decide in which halved interval the search has to be continued. So after cutting the interval into two intervals we have to choose one to get on with our search.
2. We assume that there is just one zero point in the interval between a and b.

I am struggling with point 1. I already had some questions on that topic that helped me a lot but now I need to implement it in java but it is not working yet.
Here is my code so far:
```
private static double nullstelle(double a, double b){
double middle = (a + b)/2;
double result = middle;
if(Math.abs(a-b) > 0.0001){
double sin = Math.sin(middle);
if(sin > 0){
result = nullstelle(a, middle);
}else{
result = nullstelle(middle, b);
}
}
return result;
}
```
I tried to implement using recursion but maybe an other way would be better, I don't know.
Any ideas?
| Algorithm for finding a zero point | CC BY-SA 2.5 | 0 | 2010-11-03T18:07:17.613 | 2010-11-03T21:15:00.467 | null | null | 401,025 | [
"java",
"algorithm",
"recursion",
"iteration"
] |
4,090,178 | 1 | 4,090,217 | null | 0 | 251 | I'm designing a MySQL database and a corresponding RoR app that will hold various businesses, each business will have an address.
A requirement of this application is to search the database by City/Country (this will hold businesses across Europe/UK). The search results will be returned by the nearest city in that country.
Here is a rough ERD: 
What is the best way to organize the DB? Should I move the city field into its own table? Should I store GPS coordinates for each business?
Thanks!
| Search DB (of businesses) by location | CC BY-SA 2.5 | 0 | 2010-11-03T18:09:59.250 | 2010-11-03T18:44:35.833 | 2010-11-03T18:11:15.643 | 1,450 | 114,696 | [
"mysql",
"ruby-on-rails",
"database",
"database-design",
"geolocation"
] |
4,090,287 | 1 | 4,090,621 | null | 0 | 1,156 | I have a card game (screenshot below) in which I display player avatars.
For the avatars I've written a short proxy.php script, which would take an image URL passed to it as parameter, download it and save under at my CentOS 5 machine. Next time the script is called with the same URL, it will find that image in the dir and serve it directly to STDOUT.
This works mostly well, but for some avatars the initial download fails (I suppose it times out) and you don't see the lower part of the player picture:

I'd like to detect this image download failure and delete the cached partial file, so that it is re-downloaded on the next proxy.php call.
I've tried detecting STREAM_NOTIFY_FAILURE or STREAM_NOTIFY_COMPLETED events in my callback, but they are not fired. The only events I see are: STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_MIME_TYPE_IS, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_REDIRECTED, STREAM_NOTIFY_PROGRESS:
```
Nov 3 18:48:27 httpd: 2 0
Nov 3 18:48:27 httpd: 4 image/jpeg 0
Nov 3 18:48:27 httpd: 5 Content-Length: 45842 0
Nov 3 18:48:27 httpd: 7 0
Nov 3 18:48:27 last message repeated 16 times
Nov 3 18:48:39 httpd: 2 0
Nov 3 18:48:40 httpd: 4 image/jpeg 0
Nov 3 18:48:40 httpd: 5 Content-Length: 124537 0
Nov 3 18:48:40 httpd: 7 0
```
And my even bigger problem is, that I can't pass variables like $img or $cached into the callback or I can't set a $length variable in the callback on a STREAM_NOTIFY_FILE_SIZE_IS event and then compare it with filesize($cached) in the main script (I could detect the mismatch and delete the file):
```
Nov 3 18:50:17 httpd: PHP Notice: Undefined variable: length in /var/www/html/proxy.php on line 58
Nov 3 18:50:17 httpd: length=
```
Does anybody have a solution for my problem?
I've looked at the PHP curl library, but don't see how could it help me here.
Below is my script, I've omitted the URL sanity checks for brevity:
```
<?php
define('MAX_SIZE', 1024 * 1024);
define('CACHE_DIR', '/var/www/cached_avatars/');
$img = urldecode($_GET['img']);
$opts = array(
'http' => array(
'method' => 'GET'
)
);
$cached = CACHE_DIR . md5($img);
$finfo = finfo_open(FILEINFO_MIME);
$readfh = @fopen($cached, 'rb');
if ($readfh) {
header('Content-Type: ' . finfo_file($finfo, $cached));
header('Content-Length: ' . filesize($cached));
while (!feof($readfh)) {
$buf = fread($readfh, 8192);
echo $buf;
}
fclose($readfh);
finfo_close($finfo);
exit();
}
$ctx = stream_context_create($opts);
stream_context_set_params($ctx, array('notification' => 'callback'));
$writefh = fopen($cached, 'xb');
$webfh = fopen($img, 'r', FALSE, $ctx);
if ($webfh) {
$completed = TRUE;
while (!feof($webfh)) {
$buf = fread($webfh, 8192);
echo $buf;
if ($writefh)
fwrite($writefh, $buf);
}
fclose($webfh);
if ($writefh)
fclose($writefh);
# XXX can't access $length in callback
error_log('length=' . $length);
# XXX can't access $completed in callback
if (!$completed)
unlink($cached);
}
function callback($code, $severity, $message, $message_code, $bytes_transferred, $bytes_total) {
error_log(join(' ', array($code, $message, $message_code)));
if ($code == STREAM_NOTIFY_PROGRESS && $bytes_transferred > MAX_SIZE) {
exit('File is too big: ' . $bytes_transferred);
} else if ($code == STREAM_NOTIFY_FILE_SIZE_IS) {
if ($bytes_total > MAX_SIZE)
exit('File is too big: ' . $bytes_total);
else {
header('Content-Length: ' . $bytes_total);
# XXX can't pass to main script
$length = $bytes_total;
}
} else if ($code == STREAM_NOTIFY_MIME_TYPE_IS) {
if (stripos($message, 'image/gif') !== FALSE ||
stripos($message, 'image/png') !== FALSE ||
stripos($message, 'image/jpg') !== FALSE ||
stripos($message, 'image/jpeg') !== FALSE) {
header('Content-Type: ' . $message);
} else {
exit('File is not image: ' . $mime);
}
} else if ($code == STREAM_NOTIFY_FAILURE) {
$completed = FALSE;
}
}
?>
```
I don't use any file locking in my script: it's ok for a read from cache to return an incomplete file (because it is still being downloaded) once in a while. But I want to keep my cache free of any partially downloaded images. Also if you look at my script I use "xb" which should prevent from several scripts writing into 1 file, so this simultaneous writing is not a problem here.
| PHP: Detecting fopen() failures when downloading images | CC BY-SA 3.0 | null | 2010-11-03T18:22:25.030 | 2012-12-24T19:41:01.180 | 2012-12-24T19:41:01.180 | 367,456 | 165,071 | [
"php",
"stream",
"fopen"
] |
4,090,329 | 1 | null | null | 2 | 97 | I'm trying to implement a multiline textbox on a website. The textbox should offer a kind of autocompletion while the user is typing. The autocompletion should work similar to what is known as 'Intellisense' in ms visual studio (see screenshot below) and display the autocompletion selection (the list containing "bar", and "foo_bar") just below the textcursor.
I have started with a simple html textarea. I have found several jQuery-Plugins that help me in manipulating the textarea but one very basic problem remains.
How can I know where to position the autocompletion selection (the list containing "bar", and "foo_bar" in the screenshot)?
What html-element,text-editor,technique or plugin could help me to position the autocompletion selection right below the text cursor?
Thanks a lot
JJ
Following an example of how "intellisense" looks like:

| how can I determine the absolute position of a textcursor on a website? | CC BY-SA 2.5 | null | 2010-11-03T18:27:52.333 | 2010-11-04T04:02:42.117 | null | null | 283,096 | [
"javascript",
"jquery",
"prototype"
] |
4,090,534 | 1 | 4,090,723 | null | 2 | 5,534 | I need a control where user can pick a number from a list like one in below image.
This image is from myTouch 3g Slide. If this is part of android source, can somebody provide me the link?
Thanks

| Spin wheel control in Android | CC BY-SA 2.5 | 0 | 2010-11-03T18:50:30.367 | 2012-09-07T07:29:37.853 | null | null | 339,725 | [
"android"
] |
4,090,734 | 1 | null | null | 2 | 15,061 | I'm creating an inventory system with Ruby on Rails as the application server and having java clients as the frontend.
Part of the project mandates that we create an integrated class diagram (a class diagram that includes all classes and shows the relationships). The way the class has been designed and what we've been taught before was to use the (BCE) pattern to create appropriate classes, however, since we're using Rails which uses an MVC architecture, they directly conflict since there is not a 1:1 correlation between the two patterns, especially considering that the 'views' in our case is just XML, so there will be no class diagram for the views and a class shares the of the controller and the of a view.
So far, our class diagram just features the Rails related classes (since the client classes are mostly just UI). Here is the result of what we've done so far (ignore the fact that we have a million getters and setters -- it's a requirement for the project that we won't actually be implementing in that way; we'll use `attr_accessor`):

So, are we on the right track? Anything to add/edit/move? How exactly do we model correctly the built in ActiveRecord validator methods that we'll be using (such as `validates_numericality_of :price`)?
Any help is greatly appreciated! Thanks.
| Creating a Class Diagram to model a MVC application | CC BY-SA 2.5 | null | 2010-11-03T19:14:03.420 | 2023-01-30T08:01:30.160 | 2020-06-20T09:12:55.060 | -1 | 269,694 | [
"ruby-on-rails",
"model-view-controller",
"uml",
"class-diagram"
] |
4,090,763 | 1 | 4,091,031 | null | 3 | 849 | i want to customize my tableview, like the tipulator app for the iphone.

And heres my app:

| how do i fully customize a tableview | CC BY-SA 2.5 | 0 | 2010-11-03T19:16:56.770 | 2011-09-16T02:14:38.873 | 2010-11-29T15:41:49.000 | 488,876 | 488,876 | [
"iphone",
"objective-c",
"uitableview"
] |
4,090,967 | 1 | null | null | 30 | 11,979 | What's the difference between setting the platform -->

over setting the platform target in Build -->

| Difference between platform and platform target in VS | CC BY-SA 3.0 | 0 | 2010-11-03T19:40:07.097 | 2021-06-25T00:58:00.647 | 2015-08-03T14:48:58.190 | 4,840,746 | 62,245 | [
"visual-studio",
"visual-studio-2010",
"configuration",
"build"
] |
4,091,033 | 1 | 15,801,007 | null | 2 | 637 | Is it possible to highlight the content of a tag in Aptana with some key combination?
| How to select content of a tag in Aptana? | CC BY-SA 2.5 | null | 2010-11-03T19:48:40.053 | 2013-04-04T01:45:27.360 | null | null | 263,050 | [
"select",
"tags",
"aptana"
] |
4,091,129 | 1 | 4,091,179 | null | 3 | 1,341 | I have an image loaded from disk as a texture, and a same-sized matrix d which has the corresponding depths.
How can I use `surf` to show me the image as a 3d-model? Simply taking
```
surf(depthMatrix, img);
```
doesn't give a nice result since
1. the camera looks not from the x-y plane in z-direction
2. It looks fairly black
3. It doesn't look that smooth although my depth matrix is actually smoothed out when I show it using imshow(depthMatrix, []);

| How to visualize a 3d scene using surf | CC BY-SA 2.5 | null | 2010-11-03T19:59:48.690 | 2010-11-03T20:29:30.633 | null | null | 151,706 | [
"matlab",
"3d",
"surf"
] |
4,091,172 | 1 | 4,091,383 | null | 4 | 447 | What I am supposed to do. I have an black and white image (100x100px):

I am supposed to train a [backpropagation](http://en.wikipedia.org/wiki/Backpropagation) neural network with this image. The inputs are x, y coordinates of the image (from 0 to 99) and output is either 1 (white color) or 0 (black color).
Once the network has learned, I would like it to reproduce the image based on its weights and get the closest possible image to the original.
Here is my backprop implementation:
```
import os
import math
import Image
import random
from random import sample
#------------------------------ class definitions
class Weight:
def __init__(self, fromNeuron, toNeuron):
self.value = random.uniform(-0.5, 0.5)
self.fromNeuron = fromNeuron
self.toNeuron = toNeuron
fromNeuron.outputWeights.append(self)
toNeuron.inputWeights.append(self)
self.delta = 0.0 # delta value, this will accumulate and after each training cycle used to adjust the weight value
def calculateDelta(self, network):
self.delta += self.fromNeuron.value * self.toNeuron.error
class Neuron:
def __init__(self):
self.value = 0.0 # the output
self.idealValue = 0.0 # the ideal output
self.error = 0.0 # error between output and ideal output
self.inputWeights = []
self.outputWeights = []
def activate(self, network):
x = 0.0;
for weight in self.inputWeights:
x += weight.value * weight.fromNeuron.value
# sigmoid function
if x < -320:
self.value = 0
elif x > 320:
self.value = 1
else:
self.value = 1 / (1 + math.exp(-x))
class Layer:
def __init__(self, neurons):
self.neurons = neurons
def activate(self, network):
for neuron in self.neurons:
neuron.activate(network)
class Network:
def __init__(self, layers, learningRate):
self.layers = layers
self.learningRate = learningRate # the rate at which the network learns
self.weights = []
for hiddenNeuron in self.layers[1].neurons:
for inputNeuron in self.layers[0].neurons:
self.weights.append(Weight(inputNeuron, hiddenNeuron))
for outputNeuron in self.layers[2].neurons:
self.weights.append(Weight(hiddenNeuron, outputNeuron))
def setInputs(self, inputs):
self.layers[0].neurons[0].value = float(inputs[0])
self.layers[0].neurons[1].value = float(inputs[1])
def setExpectedOutputs(self, expectedOutputs):
self.layers[2].neurons[0].idealValue = expectedOutputs[0]
def calculateOutputs(self, expectedOutputs):
self.setExpectedOutputs(expectedOutputs)
self.layers[1].activate(self) # activation function for hidden layer
self.layers[2].activate(self) # activation function for output layer
def calculateOutputErrors(self):
for neuron in self.layers[2].neurons:
neuron.error = (neuron.idealValue - neuron.value) * neuron.value * (1 - neuron.value)
def calculateHiddenErrors(self):
for neuron in self.layers[1].neurons:
error = 0.0
for weight in neuron.outputWeights:
error += weight.toNeuron.error * weight.value
neuron.error = error * neuron.value * (1 - neuron.value)
def calculateDeltas(self):
for weight in self.weights:
weight.calculateDelta(self)
def train(self, inputs, expectedOutputs):
self.setInputs(inputs)
self.calculateOutputs(expectedOutputs)
self.calculateOutputErrors()
self.calculateHiddenErrors()
self.calculateDeltas()
def learn(self):
for weight in self.weights:
weight.value += self.learningRate * weight.delta
def calculateSingleOutput(self, inputs):
self.setInputs(inputs)
self.layers[1].activate(self)
self.layers[2].activate(self)
#return round(self.layers[2].neurons[0].value, 0)
return self.layers[2].neurons[0].value
#------------------------------ initialize objects etc
inputLayer = Layer([Neuron() for n in range(2)])
hiddenLayer = Layer([Neuron() for n in range(10)])
outputLayer = Layer([Neuron() for n in range(1)])
learningRate = 0.4
network = Network([inputLayer, hiddenLayer, outputLayer], learningRate)
# let's get the training set
os.chdir("D:/stuff")
image = Image.open("backprop-input.gif")
pixels = image.load()
bbox = image.getbbox()
width = 5#bbox[2] # image width
height = 5#bbox[3] # image height
trainingInputs = []
trainingOutputs = []
b = w = 0
for x in range(0, width):
for y in range(0, height):
if (0, 0, 0, 255) == pixels[x, y]:
color = 0
b += 1
elif (255, 255, 255, 255) == pixels[x, y]:
color = 1
w += 1
trainingInputs.append([float(x), float(y)])
trainingOutputs.append([float(color)])
print "\nOriginal image ... Black:"+str(b)+" White:"+str(w)+"\n"
#------------------------------ let's train
for i in range(500):
for j in range(len(trainingOutputs)):
network.train(trainingInputs[j], trainingOutputs[j])
network.learn()
for w in network.weights:
w.delta = 0.0
#------------------------------ let's check
b = w = 0
for x in range(0, width):
for y in range(0, height):
out = network.calculateSingleOutput([float(x), float(y)])
if 0.0 == round(out):
color = (0, 0, 0, 255)
b += 1
elif 1.0 == round(out):
color = (255, 255, 255, 255)
w += 1
pixels[x, y] = color
#print out
print "\nAfter learning the network thinks ... Black:"+str(b)+" White:"+str(w)+"\n"
```
Obviously, there is some issue with my implementation. The above code returns:
> Original image ... Black:21 White:4After learning the network thinks ...
Black:25 White:0
It does the same thing if I try to use larger training set (I'm testing just 25 pixels from the image above for testing purposes). It returns that all pixels should be black after learning.
Now, if I use a manual training set like this instead:
```
trainingInputs = [
[0.0,0.0],
[1.0,0.0],
[2.0,0.0],
[0.0,1.0],
[1.0,1.0],
[2.0,1.0],
[0.0,2.0],
[1.0,2.0],
[2.0,2.0]
]
trainingOutputs = [
[0.0],
[1.0],
[1.0],
[0.0],
[1.0],
[0.0],
[0.0],
[0.0],
[1.0]
]
#------------------------------ let's train
for i in range(500):
for j in range(len(trainingOutputs)):
network.train(trainingInputs[j], trainingOutputs[j])
network.learn()
for w in network.weights:
w.delta = 0.0
#------------------------------ let's check
for inputs in trainingInputs:
print network.calculateSingleOutput(inputs)
```
The output is for example:
```
0.0330125791296 # this should be 0, OK
0.953539182136 # this should be 1, OK
0.971854575477 # this should be 1, OK
0.00046146137467 # this should be 0, OK
0.896699762781 # this should be 1, OK
0.112909223162 # this should be 0, OK
0.00034058462280 # this should be 0, OK
0.0929886299643 # this should be 0, OK
0.940489647869 # this should be 1, OK
```
In other words the network guessed all pixels right (both black and white). Why does it say all pixels should be black if I use actual pixels from the image instead of hard coded training set like the above?
I tried changing the amount of neurons in the hidden layers (up to 100 neurons) with no success.
This is a homework.
This is also a continuation of my [previous question](https://stackoverflow.com/questions/3988238/help-me-with-my-backprop-implementation-in-python) about backprop.
| Backprop implementation issue | CC BY-SA 2.5 | 0 | 2010-11-03T20:04:42.140 | 2012-09-10T21:13:14.323 | 2017-05-23T12:13:26.330 | -1 | 95,944 | [
"python",
"matlab",
"artificial-intelligence",
"machine-learning",
"neural-network"
] |
4,091,324 | 1 | 4,091,407 | null | 0 | 307 | I'm working on a script to put watermarks on images uploaded by users. Because every user wants his own user name on his picture, I decided to make a transparent PNG first with the name of the user. After that I use a simple watermark technique to merge the PNG and uploaded files together.
I got the script working, but it keeps showing me my current address every time a PNG is created.
This is the code so far:
```
<?php
session_start();
$username = $_SESSION['login'];
$filename = "watermarks/$username.png";
if (file_exists($filename)) {
exit;
} elseif ($filename == "undefined") {
exit;
}else{
header("Content-type: image/png"); //Picture Format
header("Expires: Mon, 01 Jul 2003 00:00:00 GMT"); // Past date
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Consitnuously modified
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // NO CACHE
/*image generation code*/
//create Image of size 350px x 75px
$bg = imagecreatetruecolor(500, 100);
//This will make it transparent
imagesavealpha($bg, true);
$trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127);
imagefill($bg, 0, 0, $trans_colour);
//Text to be written
$text = $username;
// White text
$white = imagecolorallocate($bg, 255, 255, 255);
// Grey Text
$grey = imagecolorallocate($bg, 128, 128, 128);
// Black Text
$black = imagecolorallocate($bg, 0,0,0);
$font = 'fonts/LiberationSans.ttf'; //path to font you want to use
$fontsize = 20; //size of font
//Writes text to the image using fonts using FreeType 2
imagettftext($bg, $fontsize, 0, 125, 50, $black, $font, $text);
imagettftext($bg, $fontsize, 0, 127, 52, $white, $font, $text);
//Create image
header( "Content-type: image/png" );
//imagepng($bg);
$save = $filename;
imagepng($bg, $save, 0, NULL);
//destroy image
imagedestroy($bg);
}
?>
```
I'm sure I missed something, but I can't figure out what.
My second problem is that I can not figure out how to get the text to the center and get rid of the white space around the text.

Please download the image to see what I mean.
Thanks in advance for your help.
| Watermark png keeps showing current URL | CC BY-SA 2.5 | null | 2010-11-03T20:22:18.683 | 2010-11-03T20:39:51.843 | null | null | 483,262 | [
"php",
"gd"
] |
4,091,345 | 1 | null | null | 0 | 678 | This shows up in both .NET and in VBA. The male sign:

You'll notice on lines 4, 5, 6, 8, 10 and 12 there is an extra character there. This is from a paragraph mark. On line 3 is a tab character, but that just shows up as spaces.
This happens when I try to grab the text of a `.TextRange.Text` in PowerPoint. Above is the Immediate Window in the VBE, but it also shows up .NET controls when I try to put the text in a control, such as a ListView.
It can be replicated by opening a new PowerPoint presentation and then in the VBE running:
```
Sub Replicate()
Dim ap As Presentation: Set ap = ActivePresentation
Dim sl As Slide: Set sl = ap.Slides(1)
sl.Shapes.Title.TextFrame.TextRange.Text = "One bad" & vbCrLf & "MOFO"
Debug.Print s.Shapes.Title.TextFrame.TextRange.Text
End Sub
```
How can I get rid of this (i.e. just show nothing in place of the male sign)? Is this some kind of Unicode setting for my controls or RegEx on the string or...?
| What is this strange character and how can I get rid of It? | CC BY-SA 2.5 | null | 2010-11-03T20:24:15.387 | 2011-03-12T18:02:40.400 | 2011-03-12T18:02:40.400 | 149,573 | 149,573 | [
".net",
"string",
"vba",
"powerpoint"
] |
4,092,119 | 1 | null | null | 4 | 1,342 | I manage to make Mac OS X Application Menu work on Java using com.apple.eawt API and added handlers for "About App", "Preferences..." and "Quit App" menu item.
But is it possible to add some custom menu option in this Application Menu in Java?
By example, Safari have "Report Bugs...", "Block Pop-Up", "Private Browsing...", etc. :

Any idea ?
| Custom Application Menu in Mac OS X | CC BY-SA 2.5 | null | 2010-11-03T22:09:27.003 | 2015-07-28T15:07:39.710 | null | null | 301,189 | [
"java",
"macos",
"menu"
] |
4,092,761 | 1 | 4,093,091 | null | 1 | 521 | I've been trying to get my game engine to display textures, and I finally got it working. I used the UV coordinates from the 3ds model, however the textures are displaying differently.
This is the rendering in 3ds max:

and this is the opengl rendering in my game engine:

why are the textures layed out like that? I supplied texture coordinates from the 3ds file generated... does anyone know why this is happening?
| 3ds Max renders textures differently than my game engine? | CC BY-SA 2.5 | null | 2010-11-03T23:59:03.897 | 2010-11-04T01:11:14.610 | 2010-11-04T00:08:44.240 | 129,570 | 434,565 | [
"opengl",
"texture-mapping",
"3dsmax"
] |
4,092,951 | 1 | 4,229,497 | null | 2 | 2,288 | In my case I have an .adp app that is pointing to a sql server database.
I created a form (with a subform) so that I can have a quick way to put some records in a child table. (there is a join between the parent and the child)
I've deduced that (unless I want to write some code, which shouldn't be necessary) I just need to populate the "Resync Command" field in the subform's Property Sheet
MSDN about it, but gives no examples.
[http://msdn.microsoft.com/en-us/library/bb213742(office.12).aspx](http://msdn.microsoft.com/en-us/library/bb213742(office.12).aspx)
without it, when I update my subform (enters a record into the child table) I get the error:
"Key value for this row was changed or deleted at the data store. The local row is now deleted."
update:
> Error While Inserting Records to a FormSometimes when adding a record to an
ADP form an error message appears:“The data was added to the database
but the data won't be displayed in the
form because it doesn't satisfy the
criteria in the underlying record
source.”For this we have to set the
ResyncCommand Property of the Form in
the design view to a SQL statement.For Example: Resync Command: Select *
From tblName where FieldName = ?If the Rowsource contains a stored
procedure with multiple tables joined
together then the Resync Command
Property of the form should be set to
an SQL statement that selects the same
fields as the stored procedure and
parameterize the primary key of the
table that is designated as the Unique
Table.Table.
btw, I found it here: [http://aspalliance.com/989_Migrating_Access_Database_to_SQL_Server.4Table](http://aspalliance.com/989_Migrating_Access_Database_to_SQL_Server.4Table).
| ACCESS 2007 Does anyone have an example on how to use the Form.ResyncCommand property? | CC BY-SA 2.5 | 0 | 2010-11-04T00:35:02.123 | 2010-11-19T21:23:24.460 | 2010-11-04T17:02:46.937 | 129,565 | 129,565 | [
"ms-access-2007"
] |
4,093,139 | 1 | 4,102,354 | null | 1 | 1,276 | I have this code to get the caller of my function's file name, line number, and function. It seems to be leaking frames though and I don't understand why. Is this just throwing me off and my leak must be elsewhere?
```
rv = "(unknown file)", 0, "(unknown function)"
for f in inspect.stack()[1:]:
if __file__ in f:
continue
else:
rv = f[1:4]
break
return rv
```
I'm not saving a reference to the frame anywhere. But it's definitely frames that are leaking:
:
My frames are definitely being leaked. I did the suggestion about gc.set_debug() and frames are very slowly going into the gc.garbage list. Not even close to how many are being created though as show in show_most_common_types(). I have a question about scope though, in the above, doesn't `f` go out of scope after the for loop? Because I just tried this:
```
for f in range(20):
l = 1
print f
```
and it printed 19. So could it be my `f` in the for loop leaking? This is a reference graph of a frame reference that was in my gc.garbage list:

:
It looks like the inspect module itself is holding references to the frames. This is an objectgraph of a backreference from a live frame, not one on the garbage list.

Link [here](https://i.stack.imgur.com/UfjQ4.png) because it's too wide.
Is there a way to clear the inspect module? Where the hell are these frames being saved =\
| python memory leak, leaking frames | CC BY-SA 2.5 | 0 | 2010-11-04T01:26:30.887 | 2010-11-04T23:31:57.803 | 2010-11-04T21:20:22.820 | 375,874 | 375,874 | [
"python",
"memory-leaks"
] |
4,093,190 | 1 | 4,093,242 | null | 3 | 3,354 | Why are these not displaying the same colors?
Original Image:

Plane with above Image as texture:

WTF is happening?
The original image is 100x100 pixels, made in paint and saved as a 24 bit bitmap.
Here is my opengl initialization code:
```
_hdc = GetDC(_hwnd);
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int iFormat = ChoosePixelFormat( _hdc, &pfd );
SetPixelFormat( _hdc, iFormat, &pfd );
_hrc = wglCreateContext(_hdc);
wglMakeCurrent(_hdc, _hrc);
GLHelper* helper = GLHelper::get();
helper->initialize(_hwnd, _hdc, _hrc);
changeScreenResolution(_settings.windowWidth, _settings.windowHeight,
_settings.sceneWidth, _settings.sceneHeight);
// Initialize OpenGL Settings
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
glEnable(GL_TEXTURE_2D);
glDepthFunc(GL_LEQUAL);
float globalAmbient[4] = {0, 0, 0, 1};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, globalAmbient);
```
I use the library FreeImage, which looks pretty well tested and widely used.
Here is the image loading code:
```
//image format
FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
//pointer to the image, once loaded
FIBITMAP *dib(0);
//pointer to the image data
BYTE* bits(0);
//image width and height
unsigned int width(0), height(0);
//OpenGL's image ID to map to
GLuint gl_texID;
//check the file signature and deduce its format
fif = FreeImage_GetFileType(filename, 0);
//if still unknown, try to guess the file format from the file extension
if(fif == FIF_UNKNOWN)
fif = FreeImage_GetFIFFromFilename(filename);
//if still unkown, return failure
if(fif == FIF_UNKNOWN)
return false;
//check that the plugin has reading capabilities and load the file
if(FreeImage_FIFSupportsReading(fif))
dib = FreeImage_Load(fif, filename);
//if the image failed to load, return failure
if(!dib)
return false;
//retrieve the image data
bits = FreeImage_GetBits(dib);
//get the image width and height
width = FreeImage_GetWidth(dib);
height = FreeImage_GetHeight(dib);
//if this somehow one of these failed (they shouldn't), return failure
if((bits == 0) || (width == 0) || (height == 0))
return false;
//if this texture ID is in use, unload the current texture
if(m_texID.find(texID) != m_texID.end())
glDeleteTextures(1, &(m_texID[texID]));
//generate an OpenGL texture ID for this texture
glGenTextures(1, &gl_texID);
//store the texture ID mapping
m_texID[texID] = gl_texID;
//bind to the new texture ID
glBindTexture(GL_TEXTURE_2D, gl_texID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
//store the texture data for OpenGL use
glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height,
border, image_format, GL_UNSIGNED_BYTE, bits);
//Free FreeImage's copy of the data
FreeImage_Unload(dib);
```
| OpenGL Renders texture with different color than original image? | CC BY-SA 2.5 | null | 2010-11-04T01:38:25.180 | 2010-11-04T01:52:12.413 | 2010-11-04T01:49:18.820 | 434,565 | 434,565 | [
"c++",
"image",
"opengl",
"bitmap",
"textures"
] |
4,093,395 | 1 | 4,126,404 | null | 2 | 8,000 | Yesterday, I've downloaded and install the free trial version of WAS v7. The version I've downloaded is `7.0.0.9` but I need to certify my application against `7.0.0.3`.
Where can I get this version?
---
UPDATED: It turns out that what I really needed was
It's working!

| Old versions of WebSphere Application Server v7 (Free Trial) | CC BY-SA 2.5 | 0 | 2010-11-04T02:24:08.903 | 2013-07-08T10:15:03.027 | 2010-11-08T21:38:01.180 | 138,830 | 138,830 | [
"websphere",
"websphere-7"
] |
4,093,640 | 1 | 4,094,772 | null | 1 | 601 | Is there a standard way to add a to a , in which I can add a to make the selected option the default one?
Similar to the context menu that comes up when choosing the default home screen for example.

From the Api docs for ContextMenu I see that you can set a header view, but not a footer view. Also the `setCheckable` / `setGroupCheckable` methods don't seem to help much here.
Does this need to be done via a custom (alert) dialog? I would be wondering if nobody has yet developed such a component yet in case it's not possible through the standard SDK api. Any standalone open source component out there (beside the Android source itself)?
| ContextMenu with footer view (to add checkbox for 'make default' option) | CC BY-SA 2.5 | 0 | 2010-11-04T03:23:00.657 | 2010-11-04T08:00:40.080 | 2010-11-04T05:36:51.583 | 241,475 | 241,475 | [
"android",
"contextmenu"
] |
4,093,685 | 1 | 4,095,728 | null | 1 | 5,195 | I want a simple filter form, and a table below it. When the user changes the option on the select form, the table automaticaly changes. I think thats done with ahah.
I want this (some things can change, like the fieldset containing the table, and other stuff):

But working.. of course..
I'm currently showing that page using one function. It's a complete mess and something like "NEVER DO THIS", but i'm researching and trying some stuff as i'm a drupal learner.
This is the relevant code:
```
form = array();
ahah_helper_register($form, $form_state);
//query here, build $options for the select
$form['listar_veics'] = array(
'#type' => 'fieldset',
'#prefix' => '<div id="listar-veics-wrapper">',
'#suffix' => '</div>',
'#tree' => TRUE,
);
if (!isset($form_state['values']['listar_veics']['filial']))
$choice = 1;
else
$choice = $form_state['values']['listar_veics']['filial'];
$form['listar_veics']['filial'] = array(
'#type' => 'select',
'#title' => "Listar veículos da filial",
'#options' => $filiais,
'#default_value' => $choice,
'#ahah' => array(
'event' => 'change',
'path' => ahah_helper_path(array('listar_veics')),
'wrapper' => 'listar-veics-wrapper',
'method' => 'replace',
),
);
//query for the rows i wanna show
//building $data array, the rows array
//building $header, as an array of strings
$table = theme_table($header, $data);
$page = drupal_render($form);
$page .= $table;
return $page;
```
So in this code, drupal will only replace the form itself, when i change the option on the select, it shows the new value on the select, but the table isnt rendered again thus not changing.
Thanks, apreciate every suggestion.
| Drupal: how to show a form (select) acting as filter options, then show a table of stuff from the database? | CC BY-SA 4.0 | 0 | 2010-11-04T03:31:33.160 | 2019-08-07T11:21:09.360 | 2019-08-07T11:21:09.360 | 4,751,173 | 481,232 | [
"php",
"drupal",
"drupal-6",
"drupal-fapi"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.