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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,527,899 | 1 | 5,527,943 | null | 16 | 7,919 |
Can you create an Mac OS X Service with Python? How ?
What I want to do is to know hook my Python-fu to the service system provided by Mac OS X.
Anyone knows how? If yes any working code snippet? Will work only on text or also on a given mimetype - defined object?

|
Can you create an Mac OS X Service with Python? How?
|
CC BY-SA 3.0
| 0 |
2011-04-03T06:04:37.560
|
2021-01-27T12:28:28.837
|
2011-07-06T20:46:01.847
| 4,766 | 121,687 |
[
"python",
"cocoa",
"macos",
"service"
] |
5,527,917 | 1 | 5,528,322 | null | 4 | 2,419 |
I having a hard trying to properly display Vietnamese text in ColdFusion. I've proper charset set to UTF-8 but still no luck. The same texts work fine in a HTML page. What else am I missing? Any suggestion would be much appreciated.


Thanks!
|
How can I properly display Vietnamese characters in ColdFusion?
|
CC BY-SA 2.5
| null |
2011-04-03T06:08:15.870
|
2011-04-03T09:38:30.633
| null | null | 281,867 |
[
"unicode",
"text",
"coldfusion"
] |
5,528,115 | 1 | 5,528,262 | null | 0 | 2,630 |
I try to create a tab interface:

So on each layer in frame 1 I added
```
this.stop();
```
but when running it says:
```
1180: Call to a possibly undefined method addFrameScript.
```
main.as is currently useless but I can show it in case it would have impact:
```
package {
import flash.display.Sprite;
import flash.events.*;
import fl.controls.CheckBox;
public class main extends Sprite {
public function main() {
addEventListener( Event.ADDED_TO_STAGE, init );
}
public function init( e:Event ):void {
removeEventListener( Event.ADDED_TO_STAGE, init );
}
public function hello(target:MouseEvent) {
trace(target);
}
}
}
```
|
Why can't I stop on frame 1 of Flash timeline?
|
CC BY-SA 2.5
| 0 |
2011-04-03T07:04:18.863
|
2011-04-03T10:49:52.893
| null | null | 310,291 |
[
"flash",
"actionscript-3"
] |
5,528,293 | 1 | null | null | 1 | 260 |
I'm having a problem creating a basic round corner box using divs. I'm pretty sure I'm missing something small, but I've spent a pretty much all day working and am exhausted. Was hoping somebody could spot my issue and help me out.
Here is an image of what happens -- I want the 'header' and 'footer to expand as well.

Here is the code for the divs..
```
<div>
<div style="">
<div style="height:44px; width:20px; background-image:url(images/boxes/tl.png); background-repeat:no-repeat; float:left;"></div>
<div style="min-height:34px; min-width:100px; background-image:url(images/boxes/tc.png); background-repeat:repeat-x; float:left; color:#FFFFFF; padding-top:10px;">Search</div>
<div style="height:44px; width:27px; background-image:url(images/boxes/tr.png); background-repeat:no-repeat; float:left;"></div>
<div style="clear:both;"></div>
</div>
<div style="">
<div style="background-image:url(images/boxes/ml.png); min-height:20px; width:20px; background-repeat:repeat-y; float:left;"></div>
<div style="background-color:#3F8FD2; min-width:100px; min-height:20px; float:left;" class="regularText2">Testing Content Expand Here --></div>
<div style="background-image:url(images/boxes/mr.png); min-height:20px; width:27px; background-repeat:repeat-y; float:left;"></div>
<div style="clear:both;"></div>
</div>
<div style="">
<div style="width:20px; height:31px; background-image:url(images/boxes/bl.png); background-repeat:no-repeat; float:left;"></div>
<div style="height:31px; min-width:100px; background-image:url(images/boxes/bc.png); background-repeat:repeat-x; float:left;"></div>
<div style="width:27px; height:31px; background-image:url(images/boxes/br.png); background-repeat:no-repeat; float:left;"></div>
<div style="clear:both;"></div>
</div>
```
Any/all help very appreciated! Thanks in advance.
Dima
|
Issue having DIVs expand horizontally together
|
CC BY-SA 3.0
| null |
2011-04-03T07:42:51.557
|
2011-11-26T22:59:49.667
|
2011-11-26T22:59:49.667
| 234,976 | 689,611 |
[
"php",
"css",
"xhtml",
"html",
"alignment"
] |
5,528,427 | 1 | 5,528,466 | null | 7 | 4,075 |
I am building an MVVM application. I'm trying to structure my application like this:

I don't know if this approach is common in MVVM. Anyways, the ViewModel uses the Service Layer to e.g populate the Model or ObservableCollection it is wrapping. To make use of its services, the ViewModel has a field that holds an abstraction of the service, like so:
```
IService service;
```
Because I use Linq to query the database, I have entities that have the same names as my domain names. To let the ViewModel be unaware of the Service Layer/Database entities, I need the Service Layer to give back a Domain Model instead of a Linq generated database entity. I do that by doing the following (an example of something I am working on at work):
```
ObservableCollection<ItemTypeViewModel> GetItemTypes()
{
DataContextLocalDB dc = new DataContextLocalDB();
ObservableCollection<ItemTypeViewModel> itemTypes = new ObservableCollection<ItemTypeViewModel>();
foreach (ItemType itemType in dc.ItemTypes)
{
Models.ItemType type = new Models.ItemType();
type.Name = itemType.Name;
type.Description = itemType.Description;
ItemTypeViewModel itemTypeViewModel = new ItemTypeViewModel(type);
itemTypes.Add(itemTypeViewModel);
}
}
```
There are a couple of things I am unhappy/unsure about:
- - - -
Thanks :-)
|
MVVM and layering, implementing the Service Layer
|
CC BY-SA 2.5
| 0 |
2011-04-03T08:14:59.113
|
2011-04-03T08:54:02.587
| null | null | 543,269 |
[
"wpf",
"architecture",
"mvvm"
] |
5,528,501 | 1 | 5,528,527 | null | 0 | 71 |
I don't know why, but after I move all my files to the server and run it. There seems to be an error with the javascript.. It's adding an extra `</br>` as you can see on the image below. Reason is why and how do I fix it?

|
javascript loading error
|
CC BY-SA 2.5
| null |
2011-04-03T08:31:18.783
|
2011-04-03T08:37:32.193
| null | null | 95,265 |
[
"javascript"
] |
5,528,543 | 1 | 5,528,629 | null | 8 | 27,169 |
It is very easy to get the position of cursor out side the form's boundary by just dragaging the mouse it sends many values to the form when ever the position changes, form the following line of code.
```
MessageBox.Show(Cursor.Position.ToString());
```

But I need to get the mouse position when user out side the forms boundary.
Not by just hovering the mouse. I used the following line of Code to do this:
```
private void Form1_Deactivate(object sender, EventArgs e)
{
MessageBox.Show(Cursor.Position.ToString());
}
```
I placed into forms Deactivate event. When user click outside the form this event definitely occures. But it also sends wrong values when user does not click outside but changes the program by using key combination.
Actually I have to capture screen shot of the area starting from the position of first click. Therefore I need the position of the cursor when it is clicked outside the form.
like:

|
Getting Position of mouse cursor when clicked out side the form's boundary
|
CC BY-SA 4.0
| 0 |
2011-04-03T08:39:33.567
|
2020-04-04T23:33:46.757
|
2020-04-04T23:26:29.423
| 3,800,096 | 574,917 |
[
"c#",
"mouse-position"
] |
5,528,709 | 1 | 5,538,519 | null | 24 | 32,658 |
Is there a way to add labels to each point in a plot? I did this on an image editor just to convey the idea: [1](https://i.stack.imgur.com/bbB4O.png).
The original one was generated with:
`qplot(pcomments, gcomments , data = topbtw, colour = username)`

|
how to add labels to a plot
|
CC BY-SA 3.0
| 0 |
2011-04-03T08:57:47.153
|
2011-12-30T05:04:23.250
|
2011-12-30T05:04:23.250
| 114,989 | 114,989 |
[
"r",
"ggplot2"
] |
5,528,736 | 1 | 5,528,917 | null | 2 | 458 |
My matrix math is a bit rusty, so I'm having some trouble figuring out the proper transformation process that I need to apply here.
I have a full-screen quad with coordinates ranging from `[-1, 1]` in both directions. I texture this quad with a non-square texture and then scale my modelview matrix to resize and preserve the aspect ratio. I want to also rotate the resized quad, but I'm getting stretched/distorted results.
Here's the process that I'm going through:
```
_gl.viewport(0, 0, _gl.viewportWidth, _gl.viewportHeight); // full-screen viewport
mat4.rotate(_modelview_matrix, degToRad(-1.0 * _desired_rotation), [0, 0, 1]); // rotate around z
mat4.scale(_modelview_matrix, [_shape.width / _gl.viewportWidth, _shape.height / _gl.viewportHeight, 1]); // scale down
```
Note that this is implemented in WebGL, but the process should be universal.
For simplicity's sake, this is all being done at the origin. I'm pretty sure I'm missing some relationship between the scaling down and the rotation, but I'm not sure what it is.

If I want the size of the quad to be `_shape.width, _shape.height` and have a rotation by an arbitrary angle, what am I missing?
Thanks!
|
Proper transformation setup for scale and then rotation
|
CC BY-SA 2.5
| null |
2011-04-03T09:32:37.930
|
2011-04-03T21:27:41.797
|
2011-04-03T21:27:41.797
| 44,729 | 555,322 |
[
"graphics",
"opengl-es",
"matrix",
"webgl"
] |
5,528,803 | 1 | 5,541,948 | null | 2 | 321 |
I have a code in Python that draws wave functions and energy for different potentials:
```
# -*- coding: cp1250 -*-
from math import *
from scipy.special import *
from pylab import *
from scipy.linalg import *
firebrick=(178./255.,34./255.,34./255.)
indianred=(176./255.,23./255.,31./255.)
steelblue=(70./255.,130./255.,180./255.)
slategray1=(198./255.,226./255.,255./255.)
slategray4=(108./255.,123./255.,139./255.)
lavender=(230./255.,230./255.,230./255.)
cobalt=(61./255.,89./255.,171./255.)
midnightblue=(25./255.,25./255.,112./255.)
forestgreen=(34./255.,139./255.,34./255.)
#definiranje mreze
Nmesh=512
L=4.0
dx=L/Nmesh
Xmax=L
x=arange(-L,L+0.0001,dx)
Npts=len(x)
numwav=0 #redni broj valne funkcije koji se iscrtava
V=zeros([Npts],float)
for i in range(Npts):
V[i]=x[i]**50
a=zeros([2,Npts-2],float)
wave=zeros([Npts],float)
wave1=zeros([Npts],float)
encor=3.0/4*(3.0/4)**(1.0/3)
#numericko rjesenje
for i in range(1,Npts-1,1):
a[0,i-1]= 1.0/dx**2+V[i] #dijagonalni elementi
a[1,i-1]=-1.0/dx**2/2 #elementi ispod dijagonale
a[1,Npts-3]=-99.0 #element se ne koristi
eig,vec=eig_banded(a,lower=1) #rutina koja dijagonalizira tridijagonalnu matricu
for i in range(1,Npts-1,1):
wave[i]=vec[i-1,numwav]
wave[0]=0.0 #valna funkcija u prvoj tocki na mrezi ima vrijednost nula
wave[Npts-1]=0.0 #valna funkcija u zadnjoj tocki na mrezi ima vrijednost nula
for i in range(1,Npts-1,1):
wave1[i]=(2.0/pi*(3.0/4)**(1.0/3))**0.25*exp(-(3.0/4)**(1.0/3)*x[i]**2)
wave1[0]=0.0 #valna funkcija u prvoj tocki na mrezi ima vrijednost nula
#wave1[Npts-1]=0.0 #valna funkcija u zadnjoj tocki na mrezi ima vrijednost nula
#wave1=omjer*150*wave1+encor
wave=150*wave+eig[numwav]
#graf potencijala
line=plt.plot(x,V)
plt.setp(line,color='firebrick',linewidth=2)
#crtanje odabranog nivoa i odgovarajuce valne funkcije
plt.axhline(y=eig[numwav],linewidth=2,color='steelblue')
#plt.axhline(y=encor,linewidth=2,color='midnightblue')
#crtanje tocaka valne funkcije
plt.plot(x,wave,"b-",linewidth=2,color='forestgreen')
#plt.plot(x,wave1,"-",linewidth=2,color='indianred')
plt.xlabel(r'$x$',size=14)
plt.ylabel(r'$V(x)$',size=14)
plt.title(r'Valna funkcija i energija 3. pobuđenog stanja za $V(x)=x^{50}$')
plt.axis([-3.0,3.0,-8.0,100.0]) #raspon x i y osi
plt.grid(True)
plt.legend((r'$V(x)$',r'$E_0$',r'$\psi_0$'))
plt.show()
```
Ignore the ignored lines, they are not important for this case, and the language :D
Anyhow, I have a problem. If I draw the potentials (the `V` part), for let's say up to `x^20` it draws nice, like this for `x^6`:

If I put the potential, say `x^50` it becomes this:

So what seems to be the problem? Why is he making such big mistake? It should be smooth, and from the theory as I reach the point `V(x)=x^p` for very large `p` (p → ∞) the potential should go to the famous infinite square well, which looks like this:

So I'm suspecting that for bigger potentials I need more points to draw it in the given range. So should I just increase the number of the `Nmesh` (grid)? Since he says that the `Npts=len(x)` - the number of points he's taking. Am I right? That seems logical, but I want to be certain.
Thanks for any advice and help
EDIT: I tried expanding the `Nmesh` but at very large numbers I either get that grid is too big, or that there is memory problems.
If I take, say 2048 I get the same picture but just shifted a bit and narrower.
|
Discretization of a diff. equation gives weird results
|
CC BY-SA 3.0
| 0 |
2011-04-03T09:47:53.693
|
2016-04-14T20:46:52.707
|
2016-04-14T20:46:52.707
| 559,745 | 629,127 |
[
"python",
"scipy"
] |
5,528,953 | 1 | null | null | 2 | 4,141 |
When I try to post a link from my blog on Facebook, either directly by copy/pasting the url or using a Wordpress plugin, Facebook "refuses" to pick up the title and the thumbnail picture of the post.
I've had this problem from time to time for a couple of months, but for the past 3 days I haven't been able to post a single post from my blog to Facebook and I can't see what would be the problem.
This is how it should work:

This is what actually happens when I post a link from my blog:

Has anyone experienced something like this or has any idea of why this isn't working for me? I can post other links on Facebook, it's just my blog that's screwing with me :o
|
When posting a link on Facebook, the title and thumbnail are missing
|
CC BY-SA 2.5
| null |
2011-04-03T10:15:10.973
|
2016-03-12T11:00:24.123
| null | null | 270,273 |
[
"facebook",
"wordpress",
"url",
"post",
"linker"
] |
5,528,982 | 1 | 5,530,462 | null | 4 | 6,069 |
I would like to calculate the area of a polygon that I get from a GPS track. So basically I store the position of the device/user after a period of time, let's say 5 seconds.
Out of this track polygon I would like to calculate the area the track is in.
For convex polygons this shouldn't be a problem since I guess I just need to calculate the area of the triangles (when each triangly has one starting point in the first point). Basically as it's shown in the left image. (Yellow Polygon is the polygon made of the GPS-Locations, dark lines show triangles for area calculation, light-yellow is the desired area)
But last night I discovered a backdraw on that idea which is when the polygon is not convex. Not only will a part that is outside the polygon (upper left side) being calculated in the area, also will some area of the polygon be measured more than once (look at the overlapping triangles in the bottom left).

Does anybody have an idea on how I can achieve this? I mean it's still difficult to even know which area should be calculated if my polygon is like S-shaped... (but I could live with that... as long as it gets a fair enough result on polygons that are (almost) closed.
My other idea of calculating the convex hull of the polygon and then doing the area calculation on that won't work well either if the polygon is non-convex. I then wouldn't count some areas more than once but as in the right image I would calculate a bigger area than it is.
Would be great if anyone could help me with this! Thanks!
|
Calculate area out of geo-coordinates on non-convex polygons
|
CC BY-SA 2.5
| 0 |
2011-04-03T10:20:54.760
|
2013-04-29T15:45:35.877
|
2011-04-03T13:37:15.170
| 475,944 | 475,944 |
[
"algorithm",
"geometry",
"geolocation",
"polygon"
] |
5,528,997 | 1 | 5,529,112 | null | 0 | 938 |
Im stuck with a common mistake of duplicate content that I want to solve:
A hyperlink in the browser shows: `http://website.org/nl/amsterdam`
Now, thats not the canonical URL and I would wish to have the webpage redirect to its known canonical url (on the condition that the current page is not already the canonical page)
```
<?php $canonical = "http://website.org/nl/amsterdam-grass-is-greener;
header("HTTP/1.1 301 Moved Permanently" );
header("Status: 301 Moved Permanently" );
header("Location: " . $canonical); // shows below picture, while url looks good
exit(0);
<html><head><link rel="canonical" href="<?=$canonical?></head>...</html>
```
Currently the non canonical url seems to wanna direct to the canonical url (tested via HEAD info) but once it arrives there PHP gets stuck and shows:

Since search engines do not use canonical so strictly and only use it as a hint, often saving the wrong, non canonical url. Does the above rule make it more strong via the 301 redirect for search engines to save the good versions in search results? Does this also solve my duplicate content url problem?
|
PHP5: how to Check & Set pre-defined canonical URL as header location via redirect 301?
|
CC BY-SA 3.0
| 0 |
2011-04-03T10:22:58.823
|
2013-02-19T06:15:27.703
|
2013-02-19T06:15:27.703
| 319,403 | 509,670 |
[
"php",
"apache",
"redirect"
] |
5,529,140 | 1 | 5,535,963 | null | 1 | 596 |
I need to show some treeview item text striked out text into a QT treeview from Ruby.
After some reading on QT documentation and much coding, I found that only when rendering font in bold, also the strikeout was rendered.

So I wonder, where I'm doing wrong?
This is the code to achive the result shown above. Note as I set strikeout for every even row item.
I'm using Ruby 1.8.7 and Qt 4.6.2 and qt4ruby 4.4.3-6 on Mandriva Linux.
```
require 'Qt4'
require 'date'
class MyStandardItem < Qt::StandardItem
def initialize(str = nil)
super str
end
def data(role = Qt::UserRole + 1)
return super(role) unless role == Qt::FontRole
ret_val = Qt::Font.new()
#parameters for "fromString":font family, pointSizeF, pixelSize, QFont::StyleHint, QFont::Weight, QFont::Style, underline, strikeOut, fixedPitch, rawMode
ret_val.fromString "sans serif,-1,-1,0,0,0,0,0,0,0"
case role
when Qt::FontRole
ret_val.setStrikeOut(true) if (index.row % 2) == 0
if index.column == 1
ret_val.weight = Qt::Font.Bold
else
ret_val.weight = Qt::Font.Normal
end
return Qt::Variant.fromValue(ret_val)
end
return ret_val
end
end
Qt::Application.new(ARGV) do
treeview = Qt::TreeView.new do
model = Qt::StandardItemModel.new self
head = [MyStandardItem.new "Qt v. #{Qt.version}"]
head << MyStandardItem.new("Ruby v. #{VERSION}")
head << MyStandardItem.new("Qt4Ruby v. 4.4.3-6 (Mandriva)")
model.append_row head
(1..10).each do |i|
col0 = MyStandardItem.new 'some text'
col0.check_state = ((i % 3) == 0)? Qt.Checked : Qt.Unchecked
col0.checkable = true
col0.editable= false
col1 = MyStandardItem.new "line ##{i}"
col2 = MyStandardItem.new((Date.today + i).strftime '%d/%m/%y')
model.append_row [col0, col1, col2]
end
self.model = model
show
end
exec
end
```
|
Strange treeview behaviour: strikeout text only if bold
|
CC BY-SA 2.5
| null |
2011-04-03T10:52:38.363
|
2011-04-04T08:07:00.340
| null | null | 11,594 |
[
"ruby",
"qt4",
"qtruby"
] |
5,529,142 | 1 | null | null | 0 | 780 |
problem was caused by loading wrong page in browser. Solved now.
In the image you can see the front page of an iPhone webpage I am developing using the O'Reilly book by Jonathan Stark. The image shows iphone.html (see below) which is just a bunch of links, which, when clicked will load the content from index.html (see below) using the ajax in the jquery.js (see below). A live version of the site is available at www.quoraquora.com
At the very bottom of the jquery file, there is a function which removes the content of the h2 and puts it in the h1. The operative code is this.
```
var title = $('h2').html() || 'Hello!';
$('h1').html(title);
$('h2').remove();
$('#progress').remove();
}
```
So if you were to click "About" link, then "About" will appear in the toolbar. On the first page, it's supposed to show "hello" because none of the links will be clicked.
However, as you can see in my image, there is no "h1" saying "hello" and when I click on the links, there is no "h1" showing the "About" in the header etc.
Can you tell me why?

HTML
```
<html>
<head>
<title>Jonathan Stark</title>
<meta name="viewport" content="user-scalable=no, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- <link rel="apple-touch-icon" href="myCustomIcon.png" /> -->
<link rel="apple-touch-icon-precomposed" href="myCustomIcon.png" />
<link rel="apple-touch-startup-image" href="myCustomStartupGraphic.png" />
<link rel="stylesheet" href="iphone.css" type="text/css" media="screen" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="iphone.js"></script>
</head>
<body>
<div id="header">
<h1>Jonathan Stark</h1>
</div>
<div id="container"></div>
</body>
</html>
```
```
<html>
<head>
<title>Jonathan Stark</title>
<meta name="viewport" content="user-scalable=no, width=device-width" />
<link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-width: 480px)" />
<link rel="stylesheet" type="text/css" href="desktop.css" media="screen and (min-width: 481px)" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="explorer.css" media="all" />
<![endif]-->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="iphone.js"></script>
</head>
<body>
<div id="container">
<div id="header">
<h1><a href="./">Jonathan Stark</a></h1>
<div id="utility">
<ul>
<li><a href="about.html">About</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div>
<div id="nav">
<ul>
<li><a href="consulting-clinic.html">Consulting Clinic</a></li>
<li><a href="on-call.html">On Call</a></li>
<li><a href="development.html">Development</a></li>
</ul>
</div>
</div>
<div id="content">
<h2>About</h2>
<p>Jonathan Stark is a web developer, speaker, and author. His consulting firm, Jonathan Stark Consulting, Inc., has attracted clients such as Staples, Turner Broadcasting, and the PGA Tour. ...</p>
</div>
<div id="sidebar">
<img alt="Manga Portrait of Jonathan Stark" src="images/manga.png"/>
<p>Jonathan Stark is a mobile and web application developer who the Wall Street Journal has called an expert on publishing desktop data to the web.</p>
</div>
<div id="footer">
<ul>
<li><a href="services.html">Services</a></li>
<li><a href="about.html">About</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
<p class="subtle">Jonathan Stark Consulting, Inc.</p>
</div>
</div>
</body>
</html>
```
CSS
```
body {
background-color: #ddd;
color: #222;
font-family: Helvetica;
font-size: 14px;
margin: 0;
padding: 0;
}
#header {
background-color: #ccc;
background-image: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#999));
border-color: #666;
border-style: solid;
border-width: 0 0 1px 0;
}
#header h1 {
color: #222;
font-size: 20px;
font-weight: bold;
margin: 0 auto;
padding: 10px 0;
text-align: center;
text-shadow: 0px 1px 0px #fff;
max-width: 160px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
ul {
list-style: none;
margin: 10px;
padding: 0;
}
ul li a {
background-color: #FFFFFF;
border: 1px solid #999999;
color: #222222;
display: block;
font-size: 17px;
font-weight: bold;
margin-bottom: -1px;
padding: 12px 10px;
text-decoration: none;
}
ul li:first-child a {
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
}
ul li:last-child a {
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
ul li a:active,ul li a:hover {
background-color: blue;
color: white;
}
#content {
padding: 10px;
text-shadow: 0px 1px 0px #fff;
}
#content a {
color: blue;
}
#progress {
-webkit-border-radius: 10px;
background-color: rgba(0,0,0,.7);
color: white;
font-size: 18px;
font-weight: bold;
height: 80px;
left: 60px;
line-height: 80px;
margin: 0 auto;
position: absolute;
text-align: center;
top: 120px;
width: 200px;
}
#header div.leftButton {
font-weight: bold;
text-align: center;
line-height: 28px;
color: white;
text-shadow: rgba(0,0,0,0.6) 0px -1px 0px;
position: absolute;
top: 7px;
left: 6px;
max-width: 50px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-width: 0 8px 0 14px;
-webkit-border-image: url(images/back_button.png) 0 8 0 14;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
#header div.leftButton.clicked {
-webkit-border-image: url(images/back_button_clicked.png) 0 8 0 14;
}
```
JQuery
```
if (window.innerWidth && window.innerWidth <= 480) {
$(document).ready(function(){
$('#header ul').addClass('hide');
$('#header').append('<div class="leftButton" onclick="toggleMenu()">Menu</div>');
});
function toggleMenu() {
$('#header ul').toggleClass('hide');
$('#header .leftButton').toggleClass('pressed');
}
}
$(document).ready(function(){
loadPage();
});
function loadPage(url) {
$('body').append('<div id="progress">Loading...</div>');
scrollTo(0,0);
if (url == undefined) {
$('#container').load('index.html #header ul', hijackLinks);
} else {
$('#container').load(url + ' #content', hijackLinks);
}
}
function hijackLinks() {
$('#container a').click(function(e){
var url = e.target.href;
if (url.match(/quoraquora.com/)) {
e.preventDefault();
loadPage(e.target.href);
}
});
var title = $('h2').html() || 'Hello!';
$('h1').html(title);
$('h2').remove();
$('#progress').remove();
}
```
RE: Is this how I'd use setTimeout starting from $(document) ready until it removes the h2?
```
function hijackLinks() {
$('#container a').click(function(e){
var url = e.target.href;
if (url.match(/quoraquora.com/)) {
e.preventDefault();
loadPage(e.target.href);
}
});
var title = $('h2').html() || 'Hello!';
$(document).ready
(
function()
{
setTimeout
(
function()
{
$('h1').html(title);
},
5000
);
}
);
$('h2').remove();
$('#progress').remove();
}
```
|
h1 not showing in iPhone web app
|
CC BY-SA 2.5
| null |
2011-04-03T10:54:27.783
|
2011-06-02T16:18:36.113
|
2011-04-03T21:27:24.517
| 577,455 | 577,455 |
[
"jquery",
"iphone"
] |
5,529,225 | 1 | 5,531,428 | null | 2 | 2,595 |
I have this problem with the jQuery autocomplete.
I use JSON data, retrieved from a mySQL db, by PHP function.
```
$.ajax({
dataType: 'json',
async: false,
method: 'post',
success: function(data) {
test = data;
},
url: '<?php echo site_url('products/autocomplete/'); ?>'
});
```
So, my JSON data is stored into the variable: 'test'.
This is my autocomplete code:
```
$( "#prodname" ).autocomplete({
minLenght: 2,
source: test,
focus: function( event, ui ) {
$( "#prodname" ).val( ui.item.prodname );
return false;
},
select: function( event, ui ) {
$( "#prodname" ).val( ui.item.prodname );
$( "#uname" ).val( ui.item.uname );
$( "input[name=prodname_fk]" ).val( ui.item.id );
return false;
}
})
.data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( "<a>" + item.prodname + "</a>" )
.appendTo( ul );
};
```
The data loads properly and all, but the autocomplete field doesn't seem to work properly. The first item of my JSON object starts with 'b', so only when I press the letter 'b', the autocomplete(suggestions) appear.
How can I fix this? My guess is maybe because I use async: false, but that the only way I made it work a little at first place.
I need the autocomplete on my Product field, so when a user selects product, a hidden field (prodname_fk) receives the corresponding ID of the product. And the uname field (unit of measure) is only used for displaying purposes.
I attach picture for your reference.
Thank you in advance.

|
jQuery autocomplete doesn't work properly
|
CC BY-SA 2.5
| null |
2011-04-03T11:10:56.880
|
2011-04-03T18:06:01.157
|
2020-06-20T09:12:55.060
| -1 | 641,048 |
[
"php",
"javascript",
"jquery",
"ajax"
] |
5,529,307 | 1 | 5,539,402 | null | 2 | 1,137 |
Source codes files are getting committed but images are not.
Error message
error:pathscpec '' did not match any file(s) known to git.

|
XCode 4 with Git/Github, can't commit images
|
CC BY-SA 3.0
| null |
2011-04-03T11:29:35.410
|
2013-12-24T16:30:57.937
|
2013-12-24T16:30:57.937
| 1,829,219 | null |
[
"iphone",
"git",
"ipad",
"github",
"xcode4"
] |
5,529,476 | 1 | 5,530,041 | null | 17 | 12,720 |
A few days ago, the attach button in "Attach to process" dialogue became disabled in VS 2010 and VS 2008 likewise. At first I thought that it is just an extension I've installed in VS 2010 but then I noticed it is the same in VS 2008. The both VS's a re running in administrative mode and on Windows 7.
I looked around but I can't seem to find a solution to this.
If anybody has encountered an similar problem, a little help would do great.
Thanks upfront.
EDIT: Attached a picture of the dialogue!

|
VS attaching to process disabled
|
CC BY-SA 2.5
| 0 |
2011-04-03T12:06:58.127
|
2016-10-31T10:24:30.847
|
2011-04-03T14:00:28.443
| 366,904 | 674,914 |
[
"visual-studio",
"visual-studio-2008",
"visual-studio-2010",
"debugging",
"attach-to-process"
] |
5,529,685 | 1 | 5,529,700 | null | 41 | 85,910 |
This one is really weird. I have multiple `$.post()` in the code, but there is one don't know why sends the json parameters as `x-www-form-urlencoded` instead and therefore doesn't work.
Here's the code:
```
$.post("/Route/SaveTransportProperties", { properties: JSON.stringify(propArray), currTravelBox: JSON.stringify(travelBoxObj), accessToken: getAccessToken()}, function(data)
{
//DO STUFF
});
```
The XHR looks like this in Firefox:

Any ideas why is this happening? I also enforced the type as 'json' but doesn't work either.
|
$.post() doesn't send data as json but as x-www-form-urlencoded instead
|
CC BY-SA 4.0
| 0 |
2011-04-03T12:53:24.647
|
2021-02-21T21:18:59.133
|
2021-02-21T21:18:59.133
| 1,783,163 | 188,476 |
[
"jquery",
"post"
] |
5,529,839 | 1 | null | null | 1 | 4,025 |
Why converting / parsing string to int return 0 / zero?
On debug, using the breakpoint, I could see "3" posted to browse action as a string value but when i convert to int as above, the value is converted to 0 value of int type.
```
//
// GET: /Event/Browse
public ActionResult Browse(string category)
{
int id = Convert.ToInt32(category);
// Retrieve Category and its Associated Events from database
var categoryModel = storeDB.Categories.Include("Events").Single(g => g.CategoryId == id);
return View(categoryModel);
}
```
Take a look at the image below for better understanding:

Another image - categoryModel getting null on LINQ query.

|
why converting or parsing string to int return zero?
|
CC BY-SA 2.5
| null |
2011-04-03T13:24:58.813
|
2011-04-03T15:27:20.520
|
2011-04-03T15:27:20.520
| 522,767 | 522,767 |
[
"c#",
"asp.net-mvc",
"asp.net-mvc-3",
"entity-framework-4"
] |
5,529,895 | 1 | null | null | 6 | 1,356 |
Is this by design?
Here's the code:
```
class FileRenamer
def RenameFiles(folder_path)
files = Dir.glob(folder_path + "/*")
end
end
puts "Renaming files..."
renamer = FileRenamer.new()
files = renamer.RenameFiles("/home/papuccino1/Desktop/Test")
puts files
puts "Renaming complete."
```
It seems to be fetching the files is random order, not as they are displayed in Nautilus.

Is this by design? I'm just curious.
|
Why does Ruby seem to access files in a directory randomly?
|
CC BY-SA 2.5
| 0 |
2011-04-03T13:34:44.993
|
2020-08-12T12:56:51.227
|
2011-04-03T13:56:20.257
| null | null |
[
"ruby",
"dir"
] |
5,529,938 | 1 | 5,599,329 | null | 0 | 130 |
Hia, got a one to many relation for chars and items. one char can hold a specific item, same item can be used by others.
The CharInfo is defined as follows:
```
@property (nonatomic, retain) ItemInfo * slotEar;
```
CharInfo.slotEar is a reference to the item. It is optional, min count 1, max count 1 and delete rule Nulify.
ItemInfo is defined as:
```
@property (nonatomic, retain) NSSet* slotEar;
```
ItemInfo.slotEar is a reference to the char. It is optional, one to many and delete rule Nulify.
They are referencing to each other.
There is an additional class that works with the data. It does hold the reference as well and provide it for storing.
```
ItemInfo *slotEar;
```
CharInfo get created before saving like this:
When I save the CharInfo, I set the ItemInfo (from my structure) in the aproviate slot.
```
CharInfo *charInfo = [NSEntityDescription
insertNewObjectForEntityForName:@"CharInfo"
inManagedObjectContext:managedObjectContext];
charInfo.slotEar = currentChar.slotEar;
```
Saving the context works.
When I try to load the CharInfo from store, it works most of the time from now. After relaunching he does crash at this line.
```
curentChar.slotEar = charInfo.slotEar;
```
If there was no item reference (nil) then all is fine.
Unfortunately the crash is more a halt. No error is given, he just stops at that line in the debugger and the green description next to the link says: EXC_BAD_ACCESS
Seems something is wrong with the reference I save or the way how I try to take it from the CharInfo to my class. Any idea?
Screenshot added:

|
Core Data: odd crash when getting data from store
|
CC BY-SA 2.5
| null |
2011-04-03T13:44:50.807
|
2011-04-08T18:31:18.500
|
2011-04-03T14:49:18.243
| 620,790 | 620,790 |
[
"ios",
"core-data",
"reference",
"entity-relationship",
"one-to-many"
] |
5,529,936 | 1 | 5,564,206 | null | 3 | 955 |
Does something like `-moz-background-inline-policy` exist in Webkit? This property basically gives you the opportunity to specify how should background render for each line of an inline element. I attach to images of the same element on different browsers.
This is the result on firefox (with `-moz-background-inline-policy: each-box;`)

This is on Google Chrome (I've tried `-webkit-background-inline-policy`, but it seems it doesn't exist)

### UPDATE
Since there is no background policy property on Webkit, I'm trying to find a different solution using jQuery. I'm adding an extra span behind each line of text. It's ok, except for the fact that text is not measured properly. You can see both examples in action here:
1. Original solution (background inline policy): http://jsfiddle.net/notme/mCnGy/5/
2. New solution (jQuery spans): http://jsfiddle.net/notme/my3br/1/
### SOLUTION
```
//thanks @Peter Bailey - http://stackoverflow.com/questions/2456442/how-can-i-highlight-the-line-of-text-that-is-closest-to-the-mouse/2456582#2456582
jQuery.fn.wrapLines = function(openTag, closeTag) {
var dummy = this.clone().css({
top: -9999,
left: -9999,
position: 'absolute',
width: this.width()
}).appendTo(this.parent()),
text = dummy.text().match(/\S+\s+/g);
var words = text.length,
lastTopOffset = 0,
lines = [],
lineText = '';
for (var i = 0; i < words; ++i) {
dummy.html(
text.slice(0, i).join('') + text[i].replace(/(\S)/, '$1<span/>') + text.slice(i + 1).join(''));
var topOffset = jQuery('span', dummy).offset().top;
if (topOffset !== lastTopOffset && i != 0) {
lines.push(lineText);
lineText = text[i];
} else {
lineText += text[i];
}
lastTopOffset = topOffset;
}
lines.push(lineText);
this.html(openTag + lines.join(closeTag + openTag) + closeTag);
dummy.remove();
};
//thanks @thirtydot
var fixIt = function() {
//remove previous .dummy
$('.dummy').remove();
$('div.node-title-text').each(function(index) {
var dummy = $(this).clone().removeClass().addClass('dummy').appendTo($(this).parent());
console.log(dummy);
$(dummy).wrapLines('<span><span>', '</span></span>');
var padding = 15;
dummy.css({
left: -padding,
right: -padding
}).find(' > span').css('padding-left', padding*2);
});
};
$(window).load(function(){
$(window).resize(fixIt).resize(); //trigger resize event onLoad
});
```
|
-moz-background-inline-policy on webkit
|
CC BY-SA 3.0
| null |
2011-04-03T13:44:33.463
|
2011-04-12T21:54:31.963
|
2011-04-12T21:54:31.963
| 171,168 | 171,168 |
[
"css",
"firefox",
"google-chrome",
"webkit",
"cross-browser"
] |
5,530,088 | 1 | 5,530,400 | null | 2 | 1,843 |
I want to show a form when i click on edit button on the JTable. The form that is displayed should overlap the JTable and should darken the jTable (just like a black background with transparency). How do i do this ? Do i have to add the jPanel to the window during creation of JFrame or shall i create the panel as a separate file and make it visible when the button is clicked. Tell me how to do this ?
EDIT
Something similar to this

EDIT 2
You have used JOption pane and the other suggestion was to use JDialog. But if i use either of those i cant create child window. I just need to call virtual keyboard from the popped up Jdialog window. I cant access the keyboard as the JDialog is holding the focus. How to solve this issue ?
EDIT 3
The current problem is, i am using virtual keyboard for typing the values in the form displayed by using JDialog. Now i cant able to open the virtual Keyboard and make it active. Even if i open it it is behind the JDialog and the focus is still with JDialog. I need to close the JDialog for using the virtual keyboard.
|
Transparency and JPanel
|
CC BY-SA 2.5
| 0 |
2011-04-03T14:16:19.250
|
2011-04-03T16:50:21.697
|
2011-04-03T16:50:21.697
| 402,610 | 402,610 |
[
"java",
"swing",
"jframe",
"jpanel"
] |
5,530,434 | 1 | 5,530,524 | null | 1 | 220 |
I am struggling with geolocation on simulator, but recently, I have tested it directly on device (iPhone) but the same issue remains, here is what I got when my app finish launching and the code of geolocation suppose to give me my location on the map (remember the picture above is for my app on iPhone and not with the simulator) :

so for my code, my app actually have a lot of views, but concerning this function, I have worked on the appdelegate(.m and .h) and the view concerning of showing the location on the map (PositionActuelleViewController).
appdelegate.m :
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
sleep(3);
// Override point for customization after application launch.
self.locationManager=[[[CLLocationManager alloc] init] autorelease];
if([CLLocationManager locationServicesEnabled]) {
self.locationManager.delegate=self;
self.locationManager.distanceFilter=100;
[self.locationManager startUpdatingLocation];
}
// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
```
and in the same file after the dealloc method :
```
#pragma mark CLLocationManagerDelegate Methods
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
MKCoordinateSpan span;
span.latitudeDelta=0.2;
span.longitudeDelta=0.2;
MKCoordinateRegion region;
region.span=span;
region.center=newLocation.coordinate;
[viewCont.mapView setRegion:region animated:YES];
viewCont.mapView.showsUserLocation=YES;
viewCont.latitude.text=[NSString stringWithFormat:@"%f",newLocation.coordinate.latitude];
viewCont.longitude.text=[NSString stringWithFormat:@"%f",newLocation.coordinate.longitude];
}
```
my PositionActuelleViewController.m file :
```
#import "PositionActuelleViewController.h"
@implementation PositionActuelleViewController
@synthesize mapView;
@synthesize latitude;
@synthesize longitude;
-(IBAction)goBackToMenu {
[self dismissModalViewControllerAnimated:YES];
}
-(IBAction)goToRechercherView;
{
rechercherViewController.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:rechercherViewController animated:YES];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[mapView release];
[latitude release];
[longitude release];
[super dealloc];
}
@end
```
What am I missing here?
|
Geolocation doesn't work even on device
|
CC BY-SA 3.0
| null |
2011-04-03T15:14:00.973
|
2014-03-03T20:12:17.047
|
2014-03-03T20:12:17.047
| 578,411 | 602,257 |
[
"iphone",
"objective-c",
"geolocation"
] |
5,530,571 | 1 | 5,531,127 | null | 1 | 1,346 |
I have a normal website page that looks like this:

How can I get the difference between the browser screen width and the right edge of `#stuff` relative to the browser screen width?
Basically I want to somehow change the width of `#stuff` to this value:

|
jQuery / CSS - Fit element to screen (without h-scroll bar)
|
CC BY-SA 2.5
| null |
2011-04-03T15:38:39.570
|
2011-04-03T17:13:11.680
| null | null | 376,947 |
[
"javascript",
"jquery",
"css",
"css-position"
] |
5,530,581 | 1 | null | null | 1 | 556 |
Some months ago I installed Lazarus 0.9.28 + FPC 2.2.4 to work on a new project. Some time after it I ran into some bugs related with image loading on a TImage. After googling a bit I found some information pointing to the fact that the bugs I was facing were already solved in a later version of FPC (can't remember the link now).
So I decided to download and install a newer version. This was around January and the latest stable version was not released yet, so I choose to install the snapshot Lazarus 0.9.31-29128 + FPC 2.4.2-2011-01-20. I opened my project with the new IDE and compiled it.
Luckily the bugs I faced were gone, but I have run into an IDE (?) one. After the upgrade, when I am on the code tab of some of my forms I do not see the code formatted. Instead I only see plain text, like this:

But on some forms I see the code formatted correctly, like this:

Anyone has run into this before? If yes, could you solve it and how? Or can anyone tell me what the correct way to upgrade a Lazarus project between versions is?
It is more of a nuisance than a real problem but still I would like to solve it. Any help would be appreciated.
I noticed that in the forms where the code shows correctly highlighted the LCLVersion in the .lfm file is 0.9.28.2, while in the forms where the code shows like plain text that property in the .lfm file is 0.9.31. Could have something to do with the problem? I tried changing the value but it did not change anything.
Thanks in advance and best regards
|
What is the correct way to upgrade a Lazarus project?
|
CC BY-SA 3.0
| null |
2011-04-03T15:40:54.437
|
2011-04-17T17:37:38.957
|
2011-04-17T17:37:38.957
| 279,592 | 279,592 |
[
"formatting",
"lazarus"
] |
5,530,595 | 1 | 5,530,704 | null | 2 | 6,933 |
I have a quite small list of numbers (a few hundred max) like for example this one:
> 117 99 91 93 95 95 91 97 89 99 89 99
91 95 89 99 89 99 89 95 95 95 89 948
189 99 89 189 189 95 186 95 93 189 95
189 89 193 189 93 91 193 89 193 185 95
89 194 185 99 89 189 95 189 189 95 89
189 189 95 189 95 89 193 101 180 189
95 89 195 185 95 89 193 89 193 185 99
185 95 189 95 89 193 91 190 94 190 185
99 89 189 95 189 189 95 185 95 185 99
89 189 95 189 186 99 89 189 191 95 185
99 89 189 189 96 89 193 189 95 185 95
89 193 95 189 185 95 93 189 189 95 186
97 185 95 189 95 185 99 185 95 185 99
185 95 190 95 185 95 95 189 185 95 189
2451
If you create a graph with X=the number and Y=number of times we see the number, we'll have something like this:

What I want is to know the average number of each group of numbers. In the example, there's 4 groups and the resulting numbers are
The number of groups of number is not known.
Do you have any idea of how to create a (simple if possible) algorithm do extract these resulting numbers (if possible in c or pseudo code or English :)
|
Algorithm to find average of group of numbers
|
CC BY-SA 2.5
| 0 |
2011-04-03T15:42:57.313
|
2011-04-03T16:24:54.807
|
2011-04-03T16:01:12.643
| 6,605 | 6,605 |
[
"algorithm"
] |
5,530,625 | 1 | null | null | 2 | 1,025 |
I'm trying to use the `QuickContactBadge`. I would like to get an effect like this:

But when I write this code:
```
QuickContactBadge badge = (QuickContactBadge) findViewById(R.id.badge_small);
badge.assignContactFromPhone("831-555-1212", true);
```
I don't see the badge but I am redirected to the Contact page.
Here is layout.xml:
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<QuickContactBadge
android:id="@+id/badge_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon" />
</LinearLayout>
```
How can I see the badge?
|
Android: strange behaviour in QuickContactBadge
|
CC BY-SA 4.0
| 0 |
2011-04-03T15:49:21.703
|
2020-07-13T17:40:12.707
|
2020-07-13T17:40:12.707
| 13,363,205 | 339,500 |
[
"android",
"quickcontact"
] |
5,530,681 | 1 | 5,530,849 | null | 5 | 14,237 |
I am trying to normalize an address.
The diagram below shows the relevant tables for this question I believe. I want to know how ZipCodes should be integrated into the model. This would be for international addresses so I know that a Zip/PostalCode is not used everywhere. I think City::ZipCode is 1::0-n (I have read others saying this is not always the case but they never provided evidence). If they are correct then I guess this would be a many-to-many relationship. Since each Address can only have at most one ZipCode while a ZipCode can contain many addresses I am lost at how to normalize this model.
Since the Address may or may not contain a contain a ZipCode I need to refrain from having that as a nullable FK in the Address table.
Just want to emphasize that . It is only used as a reference and to address my concern of where to include zipcodes into the model.

|
Normalize an Address
|
CC BY-SA 2.5
| 0 |
2011-04-03T15:57:24.593
|
2020-05-18T21:29:43.403
|
2011-04-03T17:03:32.437
| 527,298 | 527,298 |
[
"database",
"database-design",
"relational-database",
"normalization",
"zipcode"
] |
5,530,672 | 1 | null | null | 7 | 22,914 |
I have been trying out the tutorial shown on various websites on connecting a MySQL database using php to android. I dont know whats wrong with my code below. Can anyone tell me what i need to do.
This is my php code
```
<?php
mysql_connect("localhost","root","sugi");
mysql_select_db("android");
$q=mysql_query("SELECT * FROM people
WHERE
birthyear>'".$_REQUEST['year']."'");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close(); ?>
```
This is my sql query
```
CREATE TABLE `people` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 100 ) NOT NULL ,
`sex` BOOL NOT NULL DEFAULT '1',
`birthyear` INT NOT NULL
)
```
This is my java code in android
```
public class main extends Activity {
InputStream is;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String result = "";
//the year data to send
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("year","1990"));
//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost/index.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
Log.e("log_tag", "connection success ");
Toast.makeText(getApplicationContext(), "pass", Toast.LENGTH_SHORT).show();
}catch(Exception e){
Log.e("log_tag", "Error in http connection "+e.toString());
Toast.makeText(getApplicationContext(), "fail", Toast.LENGTH_SHORT).show();
}
//convert response to string
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
Toast.makeText(getApplicationContext(), "pass", Toast.LENGTH_SHORT).show();
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag", "Error converting result "+e.toString());
Toast.makeText(getApplicationContext(), "fail", Toast.LENGTH_SHORT).show();
}
//parse json data
try{
JSONArray jArray = new JSONArray(result);
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
Log.i("log_tag","id: "+json_data.getInt("id")+
", name: "+json_data.getString("name")+
", sex: "+json_data.getInt("sex")+
", birthyear: "+json_data.getInt("birthyear")
);
Toast.makeText(getApplicationContext(), "pass", Toast.LENGTH_SHORT).show();
}
}catch(JSONException e){
Log.e("log_tag", "Error parsing data "+e.toString());
Toast.makeText(getApplicationContext(), "fail", Toast.LENGTH_SHORT).show();
}
}
}
```
The program work fine. but i cant connect to `http://localhost/index.php`. The program display fail 3 times. Can help me see where i goes wrong?
Thank everyone for the help. Now i am able to connect to mysql. But i cant get the value of json data. The prog toast a msg 2 pass and 1 fail. Can anyone help me? The image below is when i type `http://localhost/index.php` in my IE. And line 6 is all this
```
$q=mysql_query("SELECT * FROM people WHERE birthyear>'".$_REQUEST['year']."'");
```
I dont know where i goes wrong.

|
connecting android apps to mysql database
|
CC BY-SA 3.0
| 0 |
2011-04-03T15:55:55.113
|
2013-04-21T07:36:53.483
|
2012-07-04T09:00:51.453
| 569,101 | 546,829 |
[
"php",
"android",
"mysql",
"json"
] |
5,530,908 | 1 | 5,531,280 | null | 0 | 197 |
I am trying to find collision detection between Two Sprits ( encircle with black color in below picture)
here is the code from which i m trying to find with the help by compairing x cordinate of both sprits but unsuccessful
have a look and tell me what is the mistake
```
- (void)update:(ccTime)dt {
NSLog(@"Target y %f, player y %f",target.position.y, player.position.y);
if(target.position.y==player.position.y)
// if((target.position.x==player.position.x)&&(target.position.y==player.position.y))
// if((sprite.position.y==player.position.y)||(sprite.position.y==player.position.y))
{
Nslog (@"Matched");
//do Something
}
}
```

|
How to Find Collision Detection between CCSprits?
|
CC BY-SA 2.5
| null |
2011-04-03T16:36:42.930
|
2011-04-04T19:02:59.877
|
2011-04-03T16:41:17.013
| 377,780 | 377,780 |
[
"iphone",
"cocos2d-iphone",
"collision-detection"
] |
5,530,877 | 1 | null | null | 3 | 862 |
I am trying to put lights, materials and shadows to my robot arm but unfortunately something weird happens (please compile or see the below picture), now I am still annoying by

1) Not showing correct lighting and reflection properties as well as material properties
2) No shadow painted, although I have done the shadow casting in function "void showobj(void)"
I appreciate if anyone can help, I have already working for it 2 days with no progress :(
The following is my code
```
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <GL/glut.h>
#include "gsrc.h"
#include <Windows.h>
const double PI = 3.14159265;
// angles to rotate the base, lower and upper arms of the robot arm
static GLfloat theta, phi, psi = 0.0;
//Starting time
double startT;
//Time Diff variable
double dif,startTime,endTime,deltaT;
//define n
double n = 3;
//Set the parameters of the light number one
GLfloat Xs = 35.0;
GLfloat Ys = 35.0;
GLfloat Zs = 35.0;
//Shadow color
GLfloat shadowcolor[] = {0.0,0.0,0.0};
//initialize the window and everything to prepare for display
void init_gl() {
//set display color to white
glClearColor(1,1,1,0);
//clear and enable z-buffer
glClear (GL_DEPTH_BUFFER_BIT);
glEnable (GL_DEPTH_TEST);
//clear display window
glClear(GL_COLOR_BUFFER_BIT);
}
//Draw the base of the robot arm
void draw_base(){
glPushMatrix();
//to create the quadric objects
GLUquadric *qobj,*qobjl,*qobju;
qobj = gluNewQuadric();
qobjl = gluNewQuadric();
qobju = gluNewQuadric();
//set the color of the cylinder
glColor3f(1.0,0.0,0.0);
//Re-position the cylinder (x-z plane is the base)
glRotatef(-90,1.0,0.0,0.0);
//Draw the cylinder
gluCylinder(qobj, 30.0, 30.0, 40.0, 40.0, 40.0);
//Draw the upper disk of the base
gluDisk(qobju,0,30,40,40);
glPushMatrix();
//Change the M(lowdisk<updisk)
glTranslatef(0,0,40);
glColor3f(0,0,0);
//Draw the lower disk of the base
gluDisk(qobjl,0,30,40,40);
glPopMatrix();
glPopMatrix();
}
/***********************Texture Work Starts************************************/
//Load the raw file for texture
/* Global Declarations */
#define IW 256 // Image Width
#define IH 256 // Image Height
//3D array to store image data
unsigned char InputImage [IW][IH][4];
// Read an input image from a .raw file with double
void ReadRawImage ( unsigned char Image[][IH][4] )
{
FILE *fp;
int i, j, k;
char* filename;
unsigned char temp;
filename = "floor.raw";
if ((fp = fopen (filename, "rb")) == NULL)
{
printf("Error (ReadImage) : Cannot read the file!!\n");
exit(1);
}
for ( i=0; i<IW; i++)
{
for ( j=0; j<IH; j++)
{
for (k = 0; k < 3; k++) // k = 0 is Red k = 1 is Green K = 2 is Blue
{
fscanf(fp, "%c", &temp);
Image[i][j][k] = (unsigned char) temp;
}
Image[i][j][3] = (unsigned char) 0; // alpha = 0.0
}
}
fclose(fp);
}
/****************************Texture Work Ends***************************************/
/****************************Light and Shadows***************************************/
void lightsrc(){
GLfloat light1PosType [] = {Xs, Ys, Zs, 1.0};
//GLfloat light2PosType [] = {0.0, 100.0, 0.0, 0.0};
glLightfv(GL_LIGHT1, GL_POSITION, light1PosType);
//glEnable(GL_LIGHT1);
//glLightfv(GL_LIGHT2, GL_POSITION, light2PosType);
//glEnable(GL_LIGHT2);
GLfloat whiteColor[] = {1.0, 1.0, 1.0, 1.0};
GLfloat blackColor[] = {0.0, 0.0, 0.0, 1.0};
glLightfv(GL_LIGHT1, GL_AMBIENT, blackColor);
glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteColor);
glLightfv(GL_LIGHT1, GL_SPECULAR, whiteColor);
glEnable(GL_LIGHT1);
glEnable( GL_LIGHTING );
}
/****************************Light and Shadows work ends***************************************/
//Draw the 2x2x2 cube with center (0,1,0)
void cube(){
glPushMatrix();
glTranslatef(0,1,0);
glutSolidCube(2);
glPopMatrix();
}
//Draw the lower arm
void draw_lower_arm(){
glPushMatrix();
glScalef(15.0/2.0,70.0/2.0,15.0/2.0);//scale half is enough (some part is in the negative side)
cube();
glPopMatrix();
}
//Draw the upper arm
void draw_upper_arm(){
glPushMatrix();
glScalef(15.0/2.0,40.0/2.0,15.0/2.0);//scale half is enough (some part is in the negative side)
cube();
glPopMatrix();
}
void drawCoordinates(){
glBegin (GL_LINES);
glColor3f (1,0,0);
glVertex3f (0,0,0);
glVertex3f (600,0,0);
glColor3f (0,1,0);
glVertex3f (0,0,0);
glVertex3f (0,600,0);
glColor3f (0,0,1);
glVertex3f (0,0,0);
glVertex3f (0,0,600);
glEnd();
}
//To draw the whole robot arm
void drawRobot(){
//Robot Drawing Starts
//Rotate the base by theta degrees
glRotatef(theta,0.0,1.0,0.0);
//Draw the base
draw_base();
//M(B<La)
glTranslatef(0.0,40.0,0.0);
//Rotate the lower arm by phi degree
glRotatef(phi,0.0,0.0,1.0);
//change the color of the lower arm
glColor3f(0.0,0.0,1.0);
//Draw the lower arm
draw_lower_arm();
//M(La<Ua)
glTranslatef(0.0,70.0,0.0);
//Rotate the upper arm by psi degree
glRotatef(psi,0.0,0.0,1.0);
//change the color of the upper arm
glColor3f(0.0,1.0,0.0);
//Draw the upper arm
draw_upper_arm();
//Drawing Finish
glutSwapBuffers();
}
void showobj(void) {
//set the projection and perspective parameters/arguments
GLint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective( 45, double(viewport[2])/viewport[3], 0.1, 1000 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(-200, 300, 200, 0, 0, 0, 0,1,0 );
// get the rotation matrix from the rotation user-interface
glMultMatrixf(gsrc_getmo() );
//Clear the display and ready to show the robot arm
init_gl();
//put the light source
lightsrc();
//Draw coordinates
drawCoordinates();
//give material properties
GLfloat diffuseCoeff[] = {0.2, 0.4, 0.9, 1.0}; // kdR= 0.2, kdG= 0.4, kdB= 0.9
GLfloat specularCoeff[] = {1.0, 1.0, 1.0, 1.0}; //
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, diffuseCoeff);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularCoeff);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0 ); // ns= 25
//Draw the ground floor
glColor3f(0.4,0.4,0.4);
glPushMatrix();
glRotatef(90,1,0,0);
glRectf(-500,-500,500,500);
glPopMatrix();
int i,j;
GLfloat M[4][4];
for (i=0; i<4; i++){
for (j=0; j<4; j++){
M[i][j] = 0;
}
M[0][0]=M[1][1]=M[2][2]=1;
M[2][3]=-1.0/Zs;
}
//Start drawing shadow
drawRobot(); // draw the objects
glPushMatrix( ); // save state
glMatrixMode(GL_MODELVIEW);
glTranslatef(Xs, Ys, Zs);// Mwc←s
glMultMatrixf(M[4]);// perspective project
glTranslatef(-Xs, -Ys, -Zs);// Ms←wc
glColor3fv (shadowcolor);
//Draw the robot arm
drawRobot();
glPopMatrix(); // restore state
//Shadow drawing ends
glFlush ();
}
//To animate the robot arm
void animate(void)
{
//get the end time
endTime = timeGetTime();
//float angle;
//calculate deltaT
deltaT = (endTime - startTime); //in msecs
//float test;
float deltaTSecs = deltaT/1000.0f; //in secs
//apply moving equation
psi = (90.0) * 0.50 * (1-cos((deltaTSecs/(n+1)) * PI));
glutPostRedisplay ();
}
void main (int argc, char** argv)
{
glutInit(&argc, argv);
//DOUBLE mode better for animation
// Set display mode.
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB);
glutInitWindowPosition( 50, 100 ); // Set top-left display-window position.
glutInitWindowSize( 400, 300 ); // Set display-window width and height.
glutCreateWindow( "Robot arm : my first self-learning opengl program" ); // Create display window.
// Register mouse-click and mouse-move glut callback functions
// for the rotation user-interface.
//Allow user to drag the mouse and view the object
glutMouseFunc( gsrc_mousebutton );
glutMotionFunc( gsrc_mousemove );
//record the starting time
startTime = timeGetTime();
// Display everything in showobj function
glutDisplayFunc(showobj);
//Perform background processing tasks or continuous animation
glutIdleFunc(animate);
glutMainLoop();
}
```
|
Problems when dealing with lighting and shadowing in opengl
|
CC BY-SA 2.5
| null |
2011-04-03T16:31:35.833
|
2012-01-18T19:48:15.013
|
2011-04-04T13:43:24.310
| 44,729 | 484,059 |
[
"c",
"opengl",
"glut"
] |
5,531,143 | 1 | 8,357,863 | null | 5 | 938 |
I am doing first steps with `KCachegrind/Cachegrind`.
I run `Cachegrind` on machine A then I moved the output files on machine B where I have KCachegrind installed.
I don't know why but I have always first function displayed as `(unknown)` and it is bad because I have there the `19.46` of the usage as displayed in the picture.
What I am doing wrong? Is the output file supposed to have all necessary information?
1. I am using compilation flag -g is it enough? I would like to use the ptimized version by the way but I don't know if it works.
2. Could it be that it is best if I run Kcachegrind on the same machine where I do my profiling?

|
first function unknown
|
CC BY-SA 3.0
| null |
2011-04-03T17:16:38.447
|
2013-06-28T19:32:00.010
|
2013-06-28T19:32:00.010
| 229,044 | 245,416 |
[
"c++",
"c",
"profiling",
"kcachegrind"
] |
5,531,697 | 1 | null | null | 1 | 1,285 |
Ok I have another pong related question. Now I'm trying to improve "AI". I read on the internet that I should predict ball's x and y and move there paddle.
Heres my equations.

```
y=ax+b
a1=(y1-y2)/(x1-x2) - a of the circles line, x1, y1 are taken before movent and x2 y2 after.
b1=y1-ax1
```
then I calculated coord for the line of paddle movement using constants like pos 0 0 and screen height, width.
To calculate point of intersetcion I made equation: `a1x4+b1=a2x4+b2`. `a1 b1 b2 a2` are things I calculated before. And it doesnt work :P What's wrong ?
|
How to extrapolate position in pong?
|
CC BY-SA 2.5
| null |
2011-04-03T18:51:35.603
|
2011-04-06T02:06:12.213
|
2011-04-03T19:35:24.147
| 670,700 | 670,700 |
[
"math",
"pong"
] |
5,531,801 | 1 | null | null | 0 | 157 |
How to implement something like this in android ?

There are three different panels ( I need one to implement), I will have matrix of this stuffs, so I need first to figure out how to draw one . I need to implement panel (not popup) which react on click and which contains three smaller panels 1st type ( O or F ), second id ( and change color ) and third name. I know this implement in Java easy but how in android ?
|
Clickable panel problem
|
CC BY-SA 2.5
| null |
2011-04-03T19:10:43.677
|
2011-04-03T19:50:54.600
|
2011-04-03T19:50:54.600
| 486,578 | 690,086 |
[
"android"
] |
5,531,839 | 1 | 5,531,906 | null | 0 | 5,713 |
I have tested with frame number it works, it doesn't with label name. Is it possible ?
In main.as:
```
public function gotoTab1(target:MouseEvent) {
gotoAndStop(1);
}
public function gotoTab2(target:MouseEvent) {
gotoAndStop("tab2");
}
```
first works, second doesn't. Second works with
```
public function gotoTab2(target:MouseEvent) {
gotoAndStop(5);
}
```
of course I give tab2 as label name to the frame at position 5.
no error shows up.

|
Flash gotoAndStop instruction by label name instead of frame number?
|
CC BY-SA 2.5
| null |
2011-04-03T19:17:45.870
|
2014-01-01T17:22:12.323
|
2011-04-03T19:41:34.113
| 310,291 | 310,291 |
[
"flash",
"actionscript-3"
] |
5,531,840 | 1 | null | null | 0 | 1,505 |
hey guys something is going wrong with my content placeholder:

My stuff is outside of the placeholder yet in my asp code its inside it:
```
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="css/style.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<%--<div class="workout-article-table">--%>
<asp:Panel ID="Panel1" CssClass="workout-article-table" runat="server"> <%--takes place of div--%>
<asp:Panel ID="Panel2" CssClass="workout-article-table-column" runat="server"> <%--takes place of span--%>
<%--<span class="workout-article-table-column">--%>
<div class="workout-article-table-blue">
<div class="workout-article-table-title">beginner workout programs »</div>
</div>
<div class="workout-article-table-link-black">
<div class="workout-article-table-link"><a href="#">Beginning Bodybuilding Comprehensive Guide</a></div>
</div>
<div class="workout-article-table-link-gray">
<div class="workout-article-table-link"><a href="#">Resistance-Training For Total Beginners!</a></div>
</div>
<div class="workout-article-table-link-black">
<div class="workout-article-table-link"><a href="#">Best Mass-Building Workout For Beginners</a></div>
</div>
<div class="workout-article-table-link-black">
<div align="center"><span class="workout-blue-links"><a href="#">View All Beginner Programs »</a></span></div>
</div>
<%--</span>--%>
</asp:Panel> <%--takes place of inner span--%>
<asp:Panel ID="Panel3" CssClass="workout-article-table-column2" runat="server"> <%--takes place of span--%>
<%--<span class="workout-article-table-column2">--%>
<div class="workout-article-table-blue">
<div class="workout-article-table-title">intermediate workout programs »</div>
</div>
<div class="workout-article-table-link-black">
<div class="workout-article-table-link"><a href="#">No Longer A Beginner</a></div>
</div>
<div class="workout-article-table-link-gray">
<div class="workout-article-table-link"><a href="#">You're Not A 'Newbie' Anymore!</a></div>
</div>
<div class="workout-article-table-link-black">
<div class="workout-article-table-link"><a href="#">Novice Intermediate Workout!</a></div>
</div>
<div class="workout-article-table-link-black">
<div align="center"><span class="workout-blue-links"><a href="#">View More Workout Programs »</a></span></div>
</div>
<%--</span>--%>
</asp:Panel> <%--takes the place of inner span--%>
</asp:Panel> <%--takes the place of div--%>
</asp:Content>
```
```
.workout-article-table {
height: 40px;
position: relative;
width: 483pxpx
}
.workout-article-table-column {
float: left;
left: 0;
position: absolute;
top: 0;
width: 229px
}
.workout-article-table-column2 {
float: left;
left: 254px;
position: absolute;
top: 0;
width: 229px
}
.workout-article-table-blue {
background-color: #0F709B;
height: 40px;
width: 229px
}
.workout-article-table-blue-wide {
background-color: #0F709B;
height: 40px;
margin-bottom: 10px;
width: 483px
}
.workout-article-table-link-black {
background-color: #000000;
height: 40px;
width: 229px
}
.workout-article-table-link-gray {
background-color: #27282A;
height: 40px;
width: 229px
}
```
|
content placeholder problem asp/css/html
|
CC BY-SA 2.5
| null |
2011-04-03T19:17:59.133
|
2013-12-07T21:20:49.743
|
2011-04-03T19:23:24.217
| 477,228 | 477,228 |
[
"c#",
"asp.net",
"html",
"css"
] |
5,531,874 | 1 | 5,531,901 | null | 3 | 9,322 |
I'm not 100% this is meant to go in stackoverflow but I'm sure it'll be moved if necessary.
I have a hex header file I just screen grabbed and would like to know what extension the file really is. The file was originally an exe but didn't seem to work, but looking at the hex information showed that it was an mzp, I just need it to be confirmed.

Thanks.
|
Help with finding Hex header information of file
|
CC BY-SA 2.5
| null |
2011-04-03T19:24:18.890
|
2016-08-10T17:41:43.337
| null | null | 251,671 |
[
"header",
"hex"
] |
5,532,008 | 1 | null | null | 0 | 717 |
I'm looking for a form validation plugin which displays a tip on the side to show if the input was valid or not.
Something like the following, that Yahoo! uses for their signup:

|
jQuery form validation with tips
|
CC BY-SA 2.5
| null |
2011-04-03T19:45:44.867
|
2011-04-03T20:10:38.250
| null | null | 496,669 |
[
"jquery",
"validation",
"forms"
] |
5,532,229 | 1 | 5,532,331 | null | 1 | 500 |
I am currently building an app for the iPhone and cannot figure out why I keep getting a memory leak to appear in the Leaks Instrument tool.
Here is the code and I have added comments to two places of where it is happening.
```
NSString *pathname = [[NSBundle mainBundle] pathForResource:self.toUseFile ofType:@"txt" inDirectory:@"/"];
//Line below causes a leak
self.rawCrayons = [[NSString stringWithContentsOfFile:pathname encoding:NSUTF8StringEncoding error:nil] componentsSeparatedByString:@"\n"];
self.sectionArray = [NSMutableArray array];
for (int i = 0; i < 26; i++) [self.sectionArray addObject:[NSMutableArray array]];
for(int i=0; i<self.rawCrayons.count; i++)
{
self.string = [self.rawCrayons objectAtIndex:i];
NSUInteger firstLetter = [ALPHA rangeOfString:[string substringToIndex:1]].location;
if (firstLetter != NSNotFound)
{
NSInteger audio = AUDIONUM(self.string);
NSInteger pictures = PICTURESNUM(self.string);
NSInteger videos = VIDEOSNUM(self.string);
//Line below causes a leak
[[self.sectionArray objectAtIndex:firstLetter] addObject:[[Term alloc] initToCall:NAME(self.string):audio:pictures:videos]];
}
[self.string release];
}
```
Thanks in advance!
Here are my property declarations.
```
@property (nonatomic, retain) NSArray *filteredArray;
@property (nonatomic, retain) NSMutableArray *sectionArray;
@property (nonatomic, retain) UISearchBar *searchBar;
@property (nonatomic, retain) UISearchDisplayController *searchDC;
@property (nonatomic, retain) NSString *toUseFile;
@property (nonatomic, retain) NSArray *rawCrayons;
@property (nonatomic, retain) NSString *string;
@property (nonatomic, retain) TermViewController *childController;
```
Here are the leaks that are occurring after follow Nick Weaver's fixes.

Here is an expanded version of one of the NSCFString. 
And another image. 
Image with the Responsible Caller: 
Also, because this may be useful, here are the properties for Term:
```
@property (nonatomic, retain) NSString *name;
@property (nonatomic) NSInteger numberAudio;
@property (nonatomic) NSInteger numberPictures;
@property (nonatomic) NSInteger numberVideos;
```
And the implementation:
```
@implementation Term
@synthesize name, numberAudio, numberPictures, numberVideos;
- (Term*)initToCall:(NSString*) toSetName:(NSInteger) audio:(NSInteger) pictures:(NSInteger) videos
{
self.name = [toSetName retain];
self.numberAudio = audio;
self.numberPictures = pictures;
self.numberVideos = videos;
return self;
}
- (NSString*)getName
{
return [[name retain] autorelease];
}
-(void)dealloc
{
[name release];
[super dealloc];
}
@end
```
|
Unknown Memory Leak in iPhone
|
CC BY-SA 2.5
| null |
2011-04-03T20:22:09.960
|
2011-04-05T14:27:18.717
|
2011-04-05T13:42:36.973
| 556,935 | 556,935 |
[
"iphone",
"string",
"memory-leaks",
"autorelease"
] |
5,532,165 | 1 | 5,532,462 | null | 2 | 3,743 |
I'm very new to JBoss, EJB3, hibernate, and MySQL.
I am trying to write a sample code to persist a bean using JPA and hibernate.
I am following in [http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/](http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/), chapter two [http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html#d0e215](http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html#d0e215) on how to configure hibernate.
After going through the configuration guide for hibernate, MySQL and JBoss, I am getting the error below (when I set `<property name="hibernate.hbm2ddl.auto" value="validate"/>`) which indicates that it is not able to connect/find the schema and/or table.
12:08:31,486 INFO [DatabaseMetadata] table not found: users
If I remove the above property, then JBoss won't complain during startup but it will once I try to call persist() on the bean, complaining that the table doesn't exist.
As I understood the guides, I do NOT need an orm.xml or hibernate.cfg.xml as long as I indicate all the necessary properties in the persistence.xml file which is what I did (trying to keep it simple and manageable). However, after days of troubleshooting, I am not able to successfully persist the bean.
Here is my persistence.xml file:
```
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="ejb3-persistence-unit" transaction-type="JTA">
<jta-data-source>java:/DefaultDS</jta-data-source>
<class>com.sf.bean.UserBean</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/HRIS"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
<!-- JDBC connection pool (use the built-in) -->
<property name="hibernate.connection.pool_size" value="1"/>
<!-- SQL dialect -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<!-- Enable Hibernate's automatic session context management -->
<property name="hibernate.current_session_context_class" value="thread"/>
<!-- Disable the second-level cache -->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<!-- Echo all executed SQL to stdout -->
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.show_sql" value="true"/>
<!-- validate the database schema on startup -->
<property name="hibernate.transaction.auto_close_session" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>
```
and here is the output from server.log
```
12:08:05,110 INFO [AbstractServer] Starting: JBossAS [6.0.0.Final "Neo"]
12:08:06,914 INFO [ServerInfo] Java version: 1.6.0_24,Apple Inc.
12:08:06,915 INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
12:08:06,915 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 19.1-b02-334,Apple Inc.
12:08:06,915 INFO [ServerInfo] OS-System: Mac OS X 10.6.7,x86_64
12:08:06,916 INFO [ServerInfo] VM arguments: -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Xdebug -Xrunjdwp:transport=dt_socket,address=8989,suspend=n,server=y -Dhibernate.show_sql=true -Dprogram.name=run.sh -Djava.library.path=/Users/sfdeveloper/dev/jboss-6.0.0.Final/bin/native/lib64 -Djava.endorsed.dirs=/Users/sfdeveloper/dev/jboss-6.0.0.Final/lib/endorsed
12:08:06,978 INFO [JMXKernel] Legacy JMX core initialized
12:08:12,915 INFO [AbstractServerConfig] JBoss Web Services - Stack CXF Server 3.4.1.GA
.............
............. {lines deleted}
.............
12:08:26,628 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
12:08:26,866 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:27,133 INFO [Version] Hibernate Commons Annotations 3.2.0.Final
12:08:27,145 INFO [Environment] Hibernate 3.6.0.Final
**12:08:27,148 INFO [Environment] hibernate.properties not found**
12:08:27,152 INFO [Environment] Bytecode provider name : javassist
12:08:27,158 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
12:08:27,309 INFO [Version] Hibernate EntityManager 3.6.0.Final
12:08:27,342 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: timerdb
...]
12:08:27,399 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly.PersistenceUnitInfo.getNewTempClassLoader() is null.
12:08:27,495 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.TimerEntity
12:08:27,608 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.TimerEntity on table timer
12:08:28,433 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.TimeoutMethod
12:08:28,442 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.TimeoutMethod on table timeout_method
12:08:28,511 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.CalendarTimerEntity
12:08:28,513 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.CalendarTimerEntity on table calendar_timer
12:08:28,590 INFO [Version] Hibernate Validator 3.1.0.GA
12:08:28,670 INFO [Version] Hibernate Validator 4.1.0.Final
12:08:28,693 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,936 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,942 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,950 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:08:28,963 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
12:08:28,968 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
12:08:28,973 INFO [SettingsFactory] Database ->
name : HSQL Database Engine
version : 1.8.0
major : 1
minor : 8
12:08:28,974 INFO [SettingsFactory] Driver ->
name : HSQL Database Engine Driver
version : 1.8.0
major : 1
minor : 8
12:08:29,048 INFO [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
12:08:29,077 INFO [JdbcSupportLoader] Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
12:08:29,105 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
12:08:29,111 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
12:08:29,114 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:08:29,114 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
12:08:29,114 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
12:08:29,114 INFO [SettingsFactory] JDBC batch size: 15
12:08:29,114 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
12:08:29,116 INFO [SettingsFactory] Scrollable result sets: enabled
12:08:29,116 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
12:08:29,116 INFO [SettingsFactory] Connection release mode: auto
12:08:29,118 INFO [SettingsFactory] Default batch fetch size: 1
12:08:29,118 INFO [SettingsFactory] Generate SQL with comments: disabled
12:08:29,118 INFO [SettingsFactory] Order SQL updates by primary key: disabled
12:08:29,118 INFO [SettingsFactory] Order SQL inserts for batching: disabled
12:08:29,119 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:08:29,123 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
12:08:29,123 INFO [SettingsFactory] Query language substitutions: {}
12:08:29,123 INFO [SettingsFactory] JPA-QL strict compliance: enabled
12:08:29,123 INFO [SettingsFactory] Second-level cache: enabled
12:08:29,124 INFO [SettingsFactory] Query cache: disabled
12:08:29,125 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
12:08:29,134 INFO [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
12:08:29,136 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
12:08:29,136 INFO [SettingsFactory] Cache region prefix: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,136 INFO [SettingsFactory] Structured second-level cache entries: disabled
12:08:29,149 INFO [SettingsFactory] Echoing all SQL to stdout
12:08:29,151 INFO [SettingsFactory] Statistics: disabled
12:08:29,151 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
12:08:29,151 INFO [SettingsFactory] Default entity-mode: pojo
12:08:29,151 INFO [SettingsFactory] Named query checking : enabled
12:08:29,151 INFO [SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled
12:08:29,188 INFO [SessionFactoryImpl] building session factory
12:08:29,520 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,523 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:29,527 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,527 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
12:08:29,537 INFO [SchemaUpdate] Running hbm2ddl schema update
12:08:29,538 INFO [SchemaUpdate] fetching database metadata
12:08:29,540 INFO [SchemaUpdate] updating schema
12:08:29,544 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:29,584 INFO [TableMetadata] table found: PUBLIC.TIMEOUTMETHOD_METHODPARAMS
12:08:29,584 INFO [TableMetadata] columns: [methodparams, timeoutmethod_id]
12:08:29,585 INFO [TableMetadata] foreign keys: [fkf294c964b7de2d8a]
12:08:29,585 INFO [TableMetadata] indexes: [sys_idx_55]
12:08:29,610 INFO [TableMetadata] table found: PUBLIC.CALENDAR_TIMER
12:08:29,610 INFO [TableMetadata] columns: [scheduleexprtimezone, scheduleexprsecond, autotimer, scheduleexprstartdate, scheduleexprminute, scheduleexprhour, timeoutmethod_id, id, scheduleexprdayofmonth, scheduleexprenddate, scheduleexprmonth, scheduleexprdayofweek, scheduleexpryear]
12:08:29,611 INFO [TableMetadata] foreign keys: [fk2b697f04b7de2d8a, fk2b697f04e6e6ef93]
12:08:29,611 INFO [TableMetadata] indexes: [sys_idx_57, sys_idx_48, sys_idx_59]
12:08:29,627 INFO [TableMetadata] table found: PUBLIC.TIMEOUT_METHOD
12:08:29,628 INFO [TableMetadata] columns: [id, methodname, declaringclass]
12:08:29,628 INFO [TableMetadata] foreign keys: []
12:08:29,628 INFO [TableMetadata] indexes: [sys_idx_50]
12:08:29,647 INFO [TableMetadata] table found: PUBLIC.TIMER
12:08:29,647 INFO [TableMetadata] columns: [id, previousrun, initialdate, repeatinterval, timedobjectid, timerstate, nextdate, info]
12:08:29,647 INFO [TableMetadata] foreign keys: []
12:08:29,648 INFO [TableMetadata] indexes: [sys_idx_52]
12:08:29,650 INFO [SchemaUpdate] schema update complete
12:08:29,656 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:29,879 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
12:08:29,920 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MySQLDB' to JNDI name 'java:MySQLDB'
12:08:30,140 INFO [xnio] XNIO Version 2.1.0.CR2
12:08:30,149 INFO [nio] XNIO NIO Implementation Version 2.1.0.CR2
12:08:30,408 INFO [remoting] JBoss Remoting version 3.1.0.Beta2
12:08:30,569 INFO [TomcatDeployment] deploy, ctxPath=/
12:08:30,661 INFO [BeanInstantiatorDeployerBase] Installed org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator@7760116b into MC at org.jboss.ejb.bean.instantiator/Simple/Simple-server/UserServiceImpl
12:08:30,672 WARN [InterceptorInfoRepository] EJBTHREE-1852: InterceptorInfoRepository is deprecated
12:08:31,216 INFO [JBossASKernel] Created KernelDeployment for: Simple-server.jar
12:08:31,220 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3
12:08:31,221 INFO [JBossASKernel] with dependencies:
12:08:31,221 INFO [JBossASKernel] and demands:
12:08:31,221 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
12:08:31,221 INFO [JBossASKernel] jboss-injector:topLevelUnit=Simple.ear,unit=Simple-server.jar,bean=UserServiceImpl; Required: Described
12:08:31,222 INFO [JBossASKernel] jboss-switchboard:appName=Simple,module=Simple-server,name=UserServiceImpl; Required: Create
12:08:31,222 INFO [JBossASKernel] persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit; Required: Described
12:08:31,222 INFO [JBossASKernel] and supplies:
12:08:31,222 INFO [JBossASKernel] jndi:Simple/UserServiceImpl/local-com.sf.service.user.UserService
12:08:31,222 INFO [JBossASKernel] jndi:UserServiceImpl
12:08:31,222 INFO [JBossASKernel] jndi:Simple/UserServiceImpl/local
12:08:31,222 INFO [JBossASKernel] Class:com.sf.service.user.UserService
12:08:31,227 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3) to KernelDeployment of: Simple-server.jar
12:08:31,366 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,368 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: ejb3-persistence-unit
...]
12:08:31,369 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly.PersistenceUnitInfo.getNewTempClassLoader() is null.
12:08:31,370 INFO [AnnotationBinder] Binding entity from annotated class: com.sf.bean.UserBean
12:08:31,370 INFO [EntityBinder] Bind entity com.sf.bean.UserBean on table users
12:08:31,379 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,386 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,389 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,405 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:08:31,407 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
12:08:31,407 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
12:08:31,439 INFO [SettingsFactory] Database ->
name : HSQL Database Engine
version : 1.8.0
major : 1
minor : 8
12:08:31,440 INFO [SettingsFactory] Driver ->
name : HSQL Database Engine Driver
version : 1.8.0
major : 1
minor : 8
12:08:31,442 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
12:08:31,443 INFO [JdbcSupportLoader] Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
12:08:31,444 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
12:08:31,444 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
12:08:31,445 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:08:31,445 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
12:08:31,445 INFO [SettingsFactory] Automatic session close at end of transaction: enabled
12:08:31,445 INFO [SettingsFactory] JDBC batch size: 15
12:08:31,445 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
12:08:31,446 INFO [SettingsFactory] Scrollable result sets: enabled
12:08:31,446 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
12:08:31,446 INFO [SettingsFactory] Connection release mode: auto
12:08:31,446 INFO [SettingsFactory] Maximum outer join fetch depth: 2
12:08:31,446 INFO [SettingsFactory] Default batch fetch size: 1
12:08:31,447 INFO [SettingsFactory] Generate SQL with comments: enabled
12:08:31,447 INFO [SettingsFactory] Order SQL updates by primary key: disabled
12:08:31,447 INFO [SettingsFactory] Order SQL inserts for batching: disabled
12:08:31,447 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:08:31,448 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
12:08:31,448 INFO [SettingsFactory] Query language substitutions: {}
12:08:31,448 INFO [SettingsFactory] JPA-QL strict compliance: enabled
12:08:31,448 INFO [SettingsFactory] Second-level cache: enabled
12:08:31,449 INFO [SettingsFactory] Query cache: disabled
12:08:31,449 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
12:08:31,449 INFO [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.NoCacheProvider
12:08:31,452 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
12:08:31,453 INFO [SettingsFactory] Cache region prefix: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,453 INFO [SettingsFactory] Structured second-level cache entries: disabled
12:08:31,453 INFO [SettingsFactory] Echoing all SQL to stdout
12:08:31,453 INFO [SettingsFactory] Statistics: disabled
12:08:31,454 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
12:08:31,454 INFO [SettingsFactory] Default entity-mode: pojo
12:08:31,454 INFO [SettingsFactory] Named query checking : enabled
12:08:31,454 INFO [SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled
12:08:31,461 INFO [SessionFactoryImpl] building session factory
12:08:31,472 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,472 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:31,475 INFO [NamingHelper] Creating subcontext: persistence.unit:unitName=Simple.ear
12:08:31,476 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,476 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
12:08:31,480 INFO [SchemaValidator] Running schema validator
12:08:31,480 INFO [SchemaValidator] fetching database metadata
12:08:31,482 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
**12:08:31,486 INFO [DatabaseMetadata] table not found: users
12:08:31,488 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit state=Create: javax.persistence.PersistenceException: [PersistenceUnit: ejb3-persistence-unit] Unable to build EntityManagerFactory**
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:911) [:3.6.0.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [:3.6.0.Final]
at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-3]
at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0.Final]
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
………..
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: org.hibernate.HibernateException: Missing table: users
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1310) [:3.6.0.Final]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) [:3.6.0.Final]
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:376) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) [:3.6.0.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) [:3.6.0.Final]
... 79 more
12:08:31,541 INFO [service] Removing bootstrap log handlers
12:08:31,645 ERROR [ProfileServiceBootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss-switchboard:appName=Simple,module=Simple-web" is missing the following dependencies:
Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit' **")
Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
Deployment "jboss.web.deployment:war=/ejb3" is missing the following dependencies:
Dependency "jboss-switchboard:appName=Simple,module=Simple-web" (should be in state "Installed", but is actually in state "Deploy")
DEPLOYMENTS IN ERROR:
Deployment "persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit" is in error due to the following reason(s): org.hibernate.HibernateException: Missing table: users
Deployment "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
12:08:31,669 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
12:08:31,672 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
12:08:31,672 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.Final "Neo"] Started in 26s:559ms
```
and here is a screenshot of workbench showing the schema and table:

Any help is greatly appreciated,
- Developer in San Francisco.
|
table not found : users during JBoss 6 startup
|
CC BY-SA 2.5
| null |
2011-04-03T20:09:59.717
|
2011-04-05T11:11:20.143
|
2011-04-05T11:11:20.143
| 203,907 | 515,461 |
[
"mysql",
"hibernate",
"jpa",
"jboss",
"jboss6.x"
] |
5,532,473 | 1 | 5,532,551 | null | 1 | 1,363 |
I recently tried applying a gradient background to a webpage using only CSS3.
while testing out the following code:
```
body {background: -moz-linear-gradient(top, blue, white);}
```
The result was:

Not exactly what I was looking for...
Any idea what is going on?
OS is Win7 64bit and Firefox 4.
Thanks!
|
Linear gradients not working in Firefox 4
|
CC BY-SA 2.5
| null |
2011-04-03T20:58:38.277
|
2011-04-03T21:10:35.627
| null | null | 324,628 |
[
"firefox",
"css",
"linear-gradients"
] |
5,532,696 | 1 | 5,533,535 | null | 3 | 3,206 |
I have a div wrapped in another div.
The parent div is set to:
> display:table
The child div is set to
> div:table-cell
This is in order to vertically and horizontally centre some text.
But I aslo need to define the size of that text. This is becasue the div needs to float in the centre of the browser window, and the window itself is on a long page too.
I have uploaded a screenshot to show you what i mean.
So, this is why i need to define the height and width of my table-cell div too. It needs to fit within that circle.
I'm at a loss as to why i cant set the height or width of this table-cell.
I also need to do this in CSS, not jquery as it'll be the first thing that people see when the page loads, and there will be a lot of content on the landing page.
I've put the code here:
[http://jsfiddle.net/Kpr9k/](http://jsfiddle.net/Kpr9k/)
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Div as Table-Cell Width/Height Mystery</title>
<style type="text/css">
body, html {
width:100%;
height: 100%;
background-color: gray;
margin: 0;
padding: 0;
}
#myTable {
margin: 0;
display: table;
width: 100%;
height: 100%;
border: 1px red solid;
}
#myCell {
display: table-cell;
max-height: 500px;
max-width: 500px;
min-height: 500px;
min-width: 500px;
height: 500px;
width: 500px;
text-align: center;
color: #000000;
line-height: 36px;
vertical-align: middle;
border: 1px yellow solid;
}
</style>
</head>
<body>
<div id="myTable">
<div id="myCell">I cannot define the width of a table cell and its driving me insane! The yellow border is the table-cell, however its been defined to be (min, max AND regular!!) as a 500px square.Instead, it's just defaulting to be 100%.</div>
</div>
</body>
</html>
```

|
Cannot define the height or width of a DIv set to display:table-cell
|
CC BY-SA 3.0
| null |
2011-04-03T21:35:13.763
|
2017-07-06T19:53:44.393
|
2017-07-06T19:53:44.393
| 4,370,109 | 394,117 |
[
"html",
"css",
"vertical-alignment",
"css-tables"
] |
5,532,725 | 1 | null | null | 0 | 42 |
```
<?php
// Filter our input.
$pID = filter_input(INPUT_GET, 'pID', FILTER_SANITIZE_NUMBER_INT);
if(!$pID) {
echo "No pID specified.";
exit;
}
$username = "##";
$password = "####";
$pdo = new PDO('mysql:host=localhost;dbname=###', $username, $password);
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth = $pdo->prepare('
SELECT name, lname, fname, picpath, email
FROM Department, Professor
WHERE pID = ?
;');
$sth->execute(array(
$pID
));
```
```
if($sth->rowCount() > 0) {
$row = $sth->fetch(PDO::FETCH_ASSOC);
<div class='professor_pic'>
<img src='{$row['picpath']}' />
</div><!-- /professor_pic -->
<div class='professor_desc'>
<span class='one' style='float:left; padding:5px 0 0 5px;'><strong>Department:</strong> {$row['name']} </span><br>
} else {
echo "No results.";
}
unset($sth);
?>
```


Why arent these two fields 'picpath' and 'name' being pulled?? Its not throwing any error. Above are the two db fields:
|
Sql failing to calling fields correctly
|
CC BY-SA 2.5
| null |
2011-04-03T21:41:58.670
|
2011-04-03T22:12:51.560
| null | null | 700,070 |
[
"php",
"sql"
] |
5,532,765 | 1 | 5,532,947 | null | 0 | 903 |
I am receiving input via a serial port and displaying the data in a RichTextBox. That works okay, except for the fact that, when I display the data, there is a lot of extra (non-consistently occurring) spacing. See the image below:

In this case, it is showing every two ticks, but sometimes it is three or sometimes none. I can't figure out why this is. Does anybody have any idea?
: Here is how I am displaying the data (code-wise).
```
void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string msg = port.ReadExisting();
DisplayWindow.AppendText(msg);
DisplayWindow.ScrollToCaret();
}
```
|
Why the Weird Spacing in RichTextBox
|
CC BY-SA 2.5
| null |
2011-04-03T21:49:39.187
|
2012-10-20T01:19:06.270
|
2011-04-03T22:03:12.730
| 132,528 | 132,528 |
[
"c#",
"winforms",
"richtextbox"
] |
5,532,753 | 1 | 5,550,741 | null | 1 | 1,202 |
i'm suddenly experiencing errors in font rendering in my project.
the following image is a square sprite with a texture and 2 dynamic text fields as children.

the text itself is correct. the bottom field is a 32-bit hexadecimal color ("H: 0xFFFFF4A1"), but as you can see some of the characters are stretched ("x", "4" and "1"). it's the same in the first text field which lists each color in ARGB format.
the font being used is Myriad Pro Condensed. i was originally using Myriad Pro Bold Condensed, which i was using for months, but suddenly yesterday the font became even crazier than what's visible here so i switched. now this font is being rendered incorrectly also.
i've validated the fonts.
i've deleted my ASO files.
i'm using cacheAsBitmapMatrix on the parent sprite object, but cacheAsBitmapMatrix is suppose to only affect mobile devices so i'm not sure why it would be rendering the font like this (if it's the problem) while running under ADL on my desktop.
```
newSwatch.cacheAsBitmapMatrix = new Matrix();
newSwatch.cacheAsBitmap = true;
```
this is how i'm calling the font, which is embedded in my library.
```
//Create Text Field
private function swatchTextField():TextField
{
var myFont:Font = new MyFont();
var textFormat:TextFormat = new TextFormat();
textFormat.bold = true;
textFormat.color = 0xFFFFFF;
textFormat.font = myFont.fontName;
textFormat.size = swatchSize / 10;
var result:TextField = new TextField();
result.antiAliasType = AntiAliasType.ADVANCED;
result.blendMode = BlendMode.ERASE;
result.autoSize = TextFieldAutoSize.LEFT;
result.defaultTextFormat = textFormat;
result.embedFonts = true;
result.multiline = true;
result.selectable = false;
result.type = TextFieldType.DYNAMIC;
return result;
}
```
i don't know what else to do. if i switch to another font it will probably just mess up again. when i click on the object it zoomed in. while zooming in it also rotates a bit. while doing so i can see the font errors are slightly changing. i'm almost convinced it's a problem with cacheAsBitmapMatrix, but the error still persistas even removing that from the code.
here's the same object with a different rotation:

any clues at all would be greatly appreciated!
---
this error was indeed not a problem with Flash but a bug Apple introduced in Mac OS X 10.6.7 that affected the display and printing of some open-type fonts. the bug has since been addressed and a fix is now available for download: [http://support.apple.com/kb/HT4605](http://support.apple.com/kb/HT4605)
|
Font Rendering Errors in Flash CS5?
|
CC BY-SA 3.0
| null |
2011-04-03T21:48:31.387
|
2011-06-05T00:58:20.240
|
2011-06-05T00:58:20.240
| 336,929 | 336,929 |
[
"flash",
"actionscript-3",
"fonts",
"matrix",
"rendering"
] |
5,533,048 | 1 | 5,533,304 | null | 1 | 493 |
I've been hacking together a pathtracer in pure Python, just for fun, and since my previous shading-thing wasn't too pretty ([Lambert's cosine law](http://en.wikipedia.org/wiki/Lambert%27s_cosine_law)), I'm trying to implement recursive pathtracing.
My engine gives an abortive output:

My pathtracing function is defined recursively, like this:
```
def TracePath2(ray, scene, bounce_count):
result = 100000.0
hit = False
answer = Color(0.0, 0.0, 0.0)
for object in scene.objects:
test = object.intersection(ray)
if test and test < result:
result = test
hit = object
if not hit:
return answer
if hit.emittance:
return hit.diffuse * hit.emittance
if hit.diffuse:
direction = RandomDirectionInHemisphere(hit.normal(ray.position(result)))
n = Ray(ray.position(result), direction)
dp = direction.dot(hit.normal(ray.position(result)))
answer += TracePath2(n, scene, bounce_count + 1) * hit.diffuse * dp
return answer
```
And my scene (I made a custom XML description format) is this:
```
<?xml version="1.0" ?>
<scene>
<camera name="camera">
<position x="0" y="-5" z="0" />
<direction x="0" y="1" z="0" />
<focalplane width="0.5" height="0.5" offset="1.0" pixeldensity="1600" />
</camera>
<objects>
<sphere name="sphere1" radius="1.0">
<material emittance="0.9" reflectance="0">
<diffuse r="0.5" g="0.5" b="0.5" />
</material>
<position x="1" y="0" z="0" />
</sphere>
<sphere name="sphere2" radius="1.0">
<material emittance="0.0" reflectance="0">
<diffuse r="0.8" g="0.5" b="0.5" />
</material>
<position x="-1" y="0" z="0" />
</sphere>
</objects>
</scene>
```
I'm pretty sure that there's some fundamental flaw in my engine, but I just can't find it...
---
Here's my new-ish tracing function:
```
def Trace(ray, scene, n):
if n > 10: # Max raydepth of 10. In my scene, the max should be around 4, since there are only a few objects to bounce off, but I agree, there should be a cap.
return Color(0.0, 0.0, 0.0)
result = 1000000.0 # It's close to infinity...
hit = False
for object in scene.objects:
test = object.intersection(ray)
if test and test < result:
result = test
hit = object
if not hit:
return Color(0.0, 0.0, 0.0)
point = ray.position(result)
normal = hit.normal(point)
direction = RandomNormalInHemisphere(normal) # I won't post that code, but rest assured, it *does* work.
if direction.dot(ray.direction) > 0.0:
point = ray.origin + ray.direction * (result + 0.0000001) # We're going inside an object (for use when tracing glass), so move a tad bit inside to prevent floating-point errors.
else:
point = ray.origin + ray.direction * (result - 0.0000001) # We're bouncing off. Move away from surface a little bit for same reason.
newray = Ray(point, direction)
return Trace(newray, scene, n + 1) * hit.diffuse + Color(hit.emittance, hit.emittance, hit.emittance) # Haven't implemented colored lights, so it's a shade of gray for now.
```
---
I'm pretty sure that the pathtracing code works, as I manually casted some rays and got pretty legitimate results. The problem I'm having (now) is that the camera doesn't shoot rays through the pixels in the image plane. I made this code to find the ray intersecting a pixel, but it's not working properly:
```
origin = scene.camera.pos # + 0.5 because it #
# puts the ray in the # This calculates the width of one "unit"
# *middle* of the pixel #
worldX = scene.camera.focalplane.width - (x + 0.5) * (2 * scene.camera.focalplane.width / scene.camera.focalplane.canvasWidth)
worldY = scene.camera.pos.y - scene.camera.focalplane.offset # Offset of the imaging plane is know, and it's normal to the camera's direction (directly along the Y-axis in this case).
worldZ = scene.camera.focalplane.height - (y + 0.5) * (2 * scene.camera.focalplane.height / scene.camera.focalplane.canvasHeight)
ray = Ray(origin, (scene.camera.pos + Point(worldX, worldY, worldZ)).norm())
```
|
Why isn't my pathtracing code working?
|
CC BY-SA 2.5
| null |
2011-04-03T22:48:17.733
|
2011-04-07T15:23:14.433
|
2011-04-07T15:23:14.433
| 464,744 | 464,744 |
[
"python",
"raytracing"
] |
5,533,131 | 1 | 5,534,688 | null | 27 | 4,304 |
When I began programming (some 10+ years ago), three things amazed me:
- - -
Back then, I accepted all of them as facts of life. I was able to make my own special-purpose programs, but "programs that made my programs work", code editors and form editors were made by the Gods and there was no way I could mess with them.
Then I went to university, and took a course on formal language processing. After learning formal grammars, parsers, abstract syntax trees, etc.; all the magic about compilers, interpreters and code editors was soon gone. Compilers and interpreters could be written in sane and simple ways, and the only non-sane thing a syntax highlighting code editor could require were Windows API hacks.
However, to this day, form editors remain a mystery to me. Either I lack the technical knowledge required to make a form designer, or I have such knowledge, but cannot find a way to use it to implement a form designer.
Using Visual C++ and the MFC, I would like to implement a form designer inspired by the best form designer ever:

In particular, I would like to imitate its two features that I like the most:
- The form being designed is inside a container. Thus, an arbitrarily large form may be designed without wasting too much screen real estate, by simply resizing the container to an appropriate size.- The "Align to Grid" option makes designing professional-looking user interfaces a lot less
frustrating. In fact, I would go as far as saying creating professional-looking user interfaces using Visual Basic's form designer is actually easy, fun and enjoyable. Even for left-brained programmers like me.
So, I have the following questions:
1. How do I make a form designer, in which the form being designed is inside a container? Is the form being designed an actual window contained inside another window? Or is it just a mockup "manually" painted by the form designer?
2. Do the Windows API and/or the MFC contain functions, classes, whatever that make it easy to create "selectable" items (surrounded by little white or blue boxes when they are selected, resizable when they are "grabbed" by one of these "edges")?
3. How do I implement the "Align to Grid" functionality?
|
Creating a professional-looking (and behaving!) form designer
|
CC BY-SA 2.5
| 0 |
2011-04-03T23:05:19.320
|
2012-01-06T17:30:54.323
| null | null | 46,571 |
[
"c++",
"windows",
"winapi",
"mfc",
"form-designer"
] |
5,533,169 | 1 | 5,533,204 | null | 0 | 49 |
Trying to pull fields 'info' and 'date' from Comment table.
Two Tables:


```
<?php
$pID2 = filter_input(INPUT_GET, 'pID', FILTER_SANITIZE_NUMBER_INT);
$username = "###";
$password = "####";
$pdo2 = new PDO('mysql:host=localhost;dbname=###', $username, $password);
$pdo2->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth2 = $pdo2->prepare('
SELECT info, date
FROM Professor, Comment
WHERE Professor.pID = ?');
$sth2->execute(array(
$pID2
));
?>
```
```
while($row = $sth2->fetch(PDO::FETCH_ASSOC)) {
echo "<div class='comment'>by Anonymous on {$row['date']}: <br> {$row['info']} </div>";
}
```
The problem is, . Is there an error here with not calling a unique professor given the `pID=[somenumber]` in the url??
|
Error Pulling A Field - Php / Sql
|
CC BY-SA 2.5
| null |
2011-04-03T23:16:33.367
|
2011-04-03T23:45:38.160
| null | null | 700,070 |
[
"php",
"sql"
] |
5,533,240 | 1 | 5,885,885 | null | 10 | 19,710 |
I have a rich HTML email. I was wondering how, in Outlook 2010 and 2007, you get the table in the layout to sit flush with the edge of the browser?
Have a look at this pic:

The pink is the background color of the body tag and the grey is the bg of the table. They both have 0 everything (margin, paddting ect). But there is still some space. The pink should not be visible.
Does anyone know how to get rid of this space on the body?
Also here’s some CSS for the start of the email:
```
<html>
<head>
<style type="text/css">
html, body{ width:100%; }
body{ background-color:#ff00ff; }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test</title>
</head>
<body topmargin="0" style="margin:0; padding:0; width:100%; background-color:#ff00ff;" >
<table topmargin="0" align="center" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;border-spacing: 0;border: 0; margin:0; padding:0; background-color:#eee;" >
```
Cheers!
|
Rich HTML emails in Outlook 2007 and 2010... how do you remove the top margin?
|
CC BY-SA 2.5
| 0 |
2011-04-03T23:30:00.850
|
2015-08-31T15:43:41.010
|
2011-04-03T23:33:54.707
| 20,578 | 269,404 |
[
"html",
"css",
"email",
"layout",
"outlook-2007"
] |
5,533,439 | 1 | 5,533,492 | null | 2 | 87 |

I have entity NhanVienQuanLy inherit from entity NhanVien.
```
var context = new Model1Container();
var result = context.NhanViens;
var resultNV = context.NhanVienQuanLys // not exist
```
How to get data of entity set NhanVienQuanLy?
|
Inherit in Ado.net Entity Framework
|
CC BY-SA 2.5
| 0 |
2011-04-04T00:15:33.263
|
2011-04-04T00:24:05.020
| null | null | 1,633,855 |
[
"entity-framework"
] |
5,533,656 | 1 | null | null | 1 | 1,019 |
my browser (Firefox v3.6.13) is having problems rendering the text making the color greenish and crispy (please see the image below). Is there a solution to this problem?

This is the code I'm using:
```
<script language="javascript">
function showProjects(){
var index = 0;
$(".parent_div").children().each(function(i) {
$(this).delay(250*index++).fadeIn(3500);
});
};
</script>
<body>
<div class="parent_div">
<a id="test1" href="#" style="display:none">Something 1</a>
<a id="test2" href="#" style="display:none">Something 2</a>
<a id="test3" href="#" style="display:none">Something 3</a>
</div>
</body>
```
Also, I tried changing my jquery script to:
```
$(this).delay(250*index++).fadeIn(3500, function(){
this.style.removeAttribute("filter"); // Suggested on other websites, but still doesn't work :(
});
```
Thanks,
partizan
|
JQuery FadeIn/Out & Delay rendering problem in Firefox and IE
|
CC BY-SA 2.5
| null |
2011-04-04T01:04:45.750
|
2011-04-05T00:44:54.377
|
2011-04-04T03:11:48.200
| 543,825 | 543,825 |
[
"jquery",
"delay",
"fadein",
"fadeout"
] |
5,533,799 | 1 | 5,540,607 | null | 8 | 8,294 |
I have a fairly simple project with only two XIBs, 5 custom classes and 5 frameworks (CFNetwork, QuartzCore, UIKit, Foundation, CoreGraphics). I was using XCode 3.x before and recently updated to XCode 4. After I did, build times are sometimes up to a minute, typically about 30 seconds. I have an 2.4 GHz MBP with 4GB of memory.

Looking at the build log in log navigator, I see "check dependencies..." come up for a long time, everything else happens nearly instantly. However clicking on this log entry doesn't reveal any more details. Where could I find more detailed info about what is causing this?
After rebooting, build returned to normal speed. There was possibly something happening in the background that was causing the slowdown.
|
Build slow on XCode4 because of "check dependencies"
|
CC BY-SA 2.5
| 0 |
2011-04-04T01:40:50.877
|
2011-04-27T15:50:23.023
|
2011-04-06T20:06:51.000
| 8,005 | 8,005 |
[
"xcode",
"xcode4"
] |
5,533,987 | 1 | 5,534,046 | null | 4 | 3,281 |
I have some text field and I need refresh button like in Safari navigation bar.

|
iOS Safari refresh button. Can I use it?
|
CC BY-SA 2.5
| 0 |
2011-04-04T02:21:22.083
|
2011-04-04T02:48:25.877
| null | null | 483,753 |
[
"iphone",
"ios",
"ios4"
] |
5,534,114 | 1 | 5,534,154 | null | 0 | 647 |
I would like to replicate the down arrow that appears next to a username on several sites such as Twitter.

I believe there are two ways of doing this: create a down arrow image and set it as some sort of background image, or use CSS to create the arrow. I believe Google uses the CSS approach for their top bar.
Which option is preferred and how would I go about doing it?
|
Twitter-style user account down arrow
|
CC BY-SA 2.5
| null |
2011-04-04T02:46:29.793
|
2011-04-04T02:59:43.653
| null | null | 445,403 |
[
"css",
"menubar",
"drop-down-menu"
] |
5,534,235 | 1 | 5,587,855 | null | 32 | 17,356 |
I want to manage projects in workspaces using Xcode 4 with Cocoa Touch Static Library projects which contain shared code that I could reference from other projects. According to WWDC 2010 videos and the Xcode 4 documentation there is a feature for "implicit dependencies" for workspaces in Xcode 4. I have been trying to make it work and I am not having much success.
Sample Workspace: [DependenciesInXcode4.zip](http://www.smallsharptools.com/downloads/iOS/DependenciesInXcode4.zip)
You can see the very basic sample project has 2 static library projects which I named Library1 and Library2. I then have a single class in each project which I reference from the iPhone project called PrimaryApp. I get support from Code Sense when adding the import statement but the build fails.

You can see how the build fails because it cannot find the dependencies.

To resolve these issues I added manually linked the Library1 and Library2 projects.

I also had to add the path to these projects as Header Search Paths.

Now when I build both of the dependency libraries and then run PrimaryApp in the iPhone Simulator it builds successfully and runs. I have found that it does not always ensure that the dependency projects are built when necessary and this is clearly a manual process. This is not what I consider "implicit dependencies" as the Xcode videos and documentation imply that it should work. I have been looking for more concrete examples but so far I have had no luck. Even here on Stackoverflow I do not see a satisfactory answer yet.
- [How should I manage dependencies across projects in an Xcode workspace?](https://stackoverflow.com/questions/5483909/how-should-i-manage-dependencies-across-projects-in-an-xcode-workspace)- [What's the correct way to configure XCode 4 workspaces to build dependencies when needed?](https://stackoverflow.com/questions/5427396/whats-the-correct-way-to-configure-xcode-4-workspaces-to-build-dependencies-when)
It appears that developers are falling back to old techniques and not truly using the new "implicit dependencies" features.
I'd appreciate some help with understanding how to get "implicit dependencies" to work with workspaces in Xcode 4.
Here are my questions:
- - -
|
How do you get implicit dependencies to work with workspaces in Xcode 4?
|
CC BY-SA 2.5
| 0 |
2011-04-04T03:11:54.740
|
2013-05-07T04:49:18.150
|
2017-05-23T10:30:23.117
| -1 | 10,366 |
[
"ios4",
"xcode4"
] |
5,534,779 | 1 | 5,534,850 | null | 3 | 545 |
I am sorry to ask this but i've been working on this for hours and I can't figure it out on my own.
I have to use json for part of a project and I was able to get it to work but now it's not returning it back to the right jsp but instead just displaying the json jsp. I am pretty sure it is how I am receiving the json.
here are screen shots of what is happening:
this is the jsp that I need to use ajax on, I am wanting to populate the second dropdown using ajax:

this is what is happening instead, (it's the right data):

here is the code(sorry it's long):
-the jsp I am doing ajax on
```
<script type="text/javascript">
/**
* Utility function to create the Ajax request object in a cross-browser way.
* The cool thing about this function is you can send the parameters in a two-dimensional
* array. It also lets you send the name of the function to call when the response
* comes back.
*
* This is a generalized function you can copy directly into your code. *
*/
function doAjax(responseFunc, url, parameters) {
// create the AJAX object
var xmlHttp = undefined;
if (window.ActiveXObject){
try {
xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
} catch (othermicrosoft){
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {}
}
}
if (xmlHttp == undefined && window.XMLHttpRequest) {
// If IE7+, Mozilla, Safari, etc: Use native object
xmlHttp = new XMLHttpRequest();
}
if (xmlHttp != undefined) {
// open the connections
xmlHttp.open("POST", url, true);
// callback handler
xmlHttp.onreadystatechange = function() {
// test if the response is finished coming down
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
// create a JS object out of the response text
var obj = eval("(" + xmlHttp.responseText + ")");
// call the response function
responseFunc(obj);
}
}
// create the parameter string
// iterate the parameters array
var parameterString = "";
for (var i = 0; i < parameters.length; i++) {
parameterString += (i > 0 ? "&" : "") + parameters[i][0] + "=" + encodeURI(parameters[i][1]);
}
// set the necessary request headers
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", parameterString.length);
xmlHttp.setRequestHeader("Connection", "close");
// send the parameters
xmlHttp.send(parameterString);
}
}//doAjax
/**
* Submits the guess to the server. This is the event code, very much
* like an actionPerformed in Java.
*/
function getSeats() {
// this is how you get a reference to any part of the page
var packInput = document.getElementById("pack");
var pack = packInput.value;
// while (packInput.childNodes.length > 0) { // clear it out
// aSeats.removeChild(aSeats.childNodes[0]);
// }
// an example of how to do an alert (use these for debugging)
// I've just got this here so that we know the event was triggered
//alert("You guessed " + seat);
// send to the server (this is relative to our current page)
// THIS IS THE EXAMPLE OF HOW TO CALL AJAX
doAjax(receiveAnswer, "ttp.actions.Sale3PackAction.action",
[["pack", pack]]);
// change the history div color, just 'cause we can
// var randhex = (Math.round(0xFFFFFF * Math.random()).toString(16) + "000000").replace(/([a-f0-9]{6}).+/, "#$1").toUpperCase();
// document.getElementById("history").style.background = randhex;
}
/**
* Receives the response from the server. Our doAjax() function above
* turns the response text into a Javascript object, which it sends as the
* single parameter to this method.
*/
function receiveAnswer(response) {
// show the response pack. For this one, I'll use the innerHTML property,
// which simply replaces all HTML under a tag. This is the lazy way to do
// it, and I personally don't use it. But it's really popular and you are
// welcome to use it. Just know your shame if you do it...
var messageDiv = document.getElementById("aSeats");
messageDiv.innerHTML = response.aSeats;
// replace our history by modifying the dom -- this is the right way
// for simplicity, I'm just erasing the list and then repopulating it
var aSeats = document.getElementById("aSeats");
while (aSeats.childNodes.length > 0) { // clear it out
aSeats.removeChild(aSeats.childNodes[0]);
}
for (var i = 0; i < response.history.length; i++) { // add the items back in
var option = aSeats.appendChild(document.createElement("option"));
option.appendChild(document.createTextNode(response.history[i]));
}
// reset the input box
//document.getElementById("pack").value = "";
}
</script>
<% Venue v = (Venue)session.getAttribute("currentVenue"); %>
<% List<Conceptual_Package> cpList = Conceptual_PackageDAO.getInstance().getByVenue(v.getId()); %>
What Packages do you want to see?
<form method="post" action="ttp.actions.Sale3PackAction.action">
<select name="packid" id="pack">
<% for (Conceptual_Package cp: cpList) { %>
<option value="<%=cp.getId()%>"><%=cp.getName1()%></option>
<% } %>
</select>
<input type="submit" value=" next " onclick="getSeats();"/>
</form>
<!--new-->
Available Seats:
<select name="eventSeatid" id="aSeats">
<option value="aSeats"></option>
</select>
<input type="button" value=" Add "/>
Selected Seats:
<form method="post" action="ttp.actions.sale4Action.action">
<select name="eventSeat2id" size="10" id="seat2">
<option value="seat2"></option>
</select>
</form>
<jsp:include page="/footer.jsp"/>
```
-the json jsp
```
<%@page contentType="text/plain" pageEncoding="UTF-8"%>
<jsp:directive.page import="java.util.*"/>
{
"history": [
<% for (String newSeats: (List<String>)session.getAttribute("newSeats")) { %>
"<%=newSeats%>",
<% } %>
]
}
```
-the action class
```
public class Sale3PackAction implements Action{
public String process(HttpServletRequest request, HttpServletResponse response) throws Exception {
HttpSession session = request.getSession();
String packid = request.getParameter("packid");
System.out.println("packid is: " + packid);
Conceptual_Package cp = Conceptual_PackageDAO.getInstance().read(packid);
request.setAttribute("cp", cp);
List<Physical_Package> ppList = Physical_PackageDAO.getInstance().getByConceptual_Package(cp.getId());
request.setAttribute("currentPack", ppList);
session.setAttribute("aSeats", null);
//return "sale3Pack_ajax.jsp";
//new
//HttpSession session = request.getSession();
// ensure we have a history
for (Physical_Package pPack: ppList){
try {
if (session.getAttribute("aSeats") == null) {
LinkedList aSeatsList = new LinkedList<String>();
session.setAttribute("aSeats", aSeatsList);
aSeatsList.add("Sec: " + pPack.getVenueSeat().getRowInVenue().getSectionInVenue().getSectionNumber() + " Row: " + pPack.getVenueSeat().getRowInVenue().getRowNumber() + " Seat: " + pPack.getVenueSeat().getSeatNumber());
session.setAttribute("newSeats", aSeatsList);
} else {
LinkedList aSeatsList = (LinkedList) session.getAttribute("aSeats");
aSeatsList.add("Sec: " + pPack.getVenueSeat().getRowInVenue().getSectionInVenue().getSectionNumber() + " Row: " + pPack.getVenueSeat().getRowInVenue().getRowNumber() + " Seat: " + pPack.getVenueSeat().getSeatNumber());
session.setAttribute("newSeats", aSeatsList);
}
} catch (DataException ex) {
Logger.getLogger(Sale3PackAction.class.getName()).log(Level.SEVERE, null, ex);
}
}
// next jsp page to go to
return "AjaxPack_json.jsp";
}
}
```
|
json ajax problem
|
CC BY-SA 2.5
| null |
2011-04-04T05:10:12.650
|
2011-04-05T05:28:51.323
|
2011-04-04T05:45:04.203
| 474,980 | 474,980 |
[
"java",
"javascript",
"ajax",
"json",
"jsp"
] |
5,534,854 | 1 | 5,545,047 | null | 2 | 371 |
After reading this article [http://camendesign.com/code/developpeurs_sans_frontieres](http://camendesign.com/code/developpeurs_sans_frontieres)
I have decided to follow what it says and eliminate wrappers from my site design. Gave my body element a width, give html and css different background colours.etc
Things are working fine, I'm really impressed by it until I need to add a footer. At this moment, I'm kind of stuck. Since my footer tag has to be inside the body element, it's width only extend to the width of the body element (which is 600px). and the white box still surrounds my footer instead of ending before my footer as expected.
Is there a way I can get the footer to be like any footer you see on other sites (where the footer span the full width of the page in a different colour, without going back to wrapper divs?
Here's a screenshot:

|
Centre and Layout Pages without a wrapper and having a footer
|
CC BY-SA 2.5
| null |
2011-04-04T05:20:59.910
|
2011-04-04T22:28:08.393
|
2011-04-04T05:23:42.767
| 464,744 | 502,734 |
[
"css"
] |
5,535,033 | 1 | 5,535,218 | null | 2 | 1,530 |
Here is a HTML markup
```
<tr><td><b>Effective Date</b></td><td colspan="2"><input class="datepicker " value="01/04/2011" ></td></tr>
```
(Unfortunately I have little control over the markup. So 'an INPUT in a TD in a TR' is a given)
In the javascript I do the standard
```
$('.datepicker').datepicker();
```
And it is the outcome

The datepicker somehow blocks half of the INPUT box.
Why it is the case? And what is a possible solution?
Same result in Chrome and FF4
|
Jquery datepicker positioning problem: date picker blocks half of a text field
|
CC BY-SA 2.5
| 0 |
2011-04-04T05:55:09.623
|
2011-04-04T06:26:57.477
| null | null | 58,129 |
[
"jquery",
"jquery-ui"
] |
5,535,524 | 1 | 5,536,299 | null | 4 | 5,044 |
When I resize image using imagemagick then it shown like cropped.
I using below code for resize image
```
ImageMagickObject.MagickImage imgLarge = new ImageMagickObject.MagickImage();
object[] o = new object[] { "image_Input.jpg", "-resize", size, "-gravity", "center", "-colorspace", "RGB", "-extent", "100x100", "image_Output.jpg" };
imgLarge.Convert(ref o);
```
See the below image before image resize

See the below image after image resize it shown below

I exactly want that resize image shown full image as shown before re-sized.
in my output image it goes to like cropped not shown full view of the input image.. How I can do?
|
How to resize image using imagemagick?
|
CC BY-SA 2.5
| 0 |
2011-04-04T07:07:06.593
|
2013-05-23T15:29:10.460
|
2011-04-04T08:47:34.623
| 11,343 | 568,085 |
[
"c#",
"imagemagick",
"image-manipulation",
"image-resizing"
] |
5,535,681 | 1 | 5,538,001 | null | 0 | 208 |
Well, this is surely a most annoying bug I've encountered with IE.
First thing to note is that the problem (?!??), and I simply can't wrap my head around it.
This is the screenshot of what happens:

When testing locally, on Cassini or local IIS (even with Fiddler limiting speed on localhost to simulate network latency) there is no problem in IE.
The menu has a 1px white line effect at the bottom. When in IE 7, there is a 1px of empty space added magically on the top of elements of the menu (they are blocks inside list item elements which are of course in list)
You can see that the element is lowered by 1px from the top. I can fix this IE7 issue by adding -1px negative top margin (isn't really a solution if everything works locally, right?).
In IE6, there is also 1px added to the bottom as well on the top (this bottom white line is added to the main menu div (again, only on remote server?!)
The last thing is the problem with the menu out of place in IE6 ...
Again, none of these problems occur on the remote test server (shared hosting)...

EDIT1:
I've managed to fix some of the problems with IE only fixes, but those fixes work on live server, while breaking the site in local IE testing ...
I've added negative -1px margin for IE7, and width 1% for li elements of the menu (fixed the IE6 menu jumping out problem), but this problem makes no sense to me ... :/
|
Weird IE6 and 7 bug when deployed on server
|
CC BY-SA 2.5
| null |
2011-04-04T07:29:02.290
|
2011-04-04T11:47:36.650
|
2011-04-04T10:03:13.393
| 155,666 | 155,666 |
[
"asp.net",
"css",
"internet-explorer-7",
"internet-explorer-6"
] |
5,535,952 | 1 | 5,543,958 | null | -1 | 230 |
Does someone knows how this profiler is called?

|
PHP: Zend code profiler
|
CC BY-SA 2.5
| null |
2011-04-04T08:05:11.240
|
2011-04-04T20:29:23.187
|
2011-04-04T20:24:40.900
| 168,868 | 247,889 |
[
"php",
"profiling"
] |
5,536,108 | 1 | 5,536,231 | null | 2 | 5,455 |
I have a problem where I need to search for unique paths in an undirected graph of degree <=4. The graph is basically a grid, and all connections are between direct neighbors only (4-way).
- - -
How do I go about this problem?

|
Finding all unique paths in an undirected graph
|
CC BY-SA 2.5
| 0 |
2011-04-04T08:24:14.200
|
2011-04-04T08:55:08.990
|
2011-04-04T08:45:10.080
| 256,405 | 256,405 |
[
"algorithm",
"language-agnostic",
"graph"
] |
5,536,482 | 1 | null | null | 3 | 626 |

zIndex issues are a [common problem](http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/) in Internet Explorer. My question basically is, I've been trying but IE keeps putting the `#middle` div above or below...
|
zIndex issue in IE
|
CC BY-SA 2.5
| 0 |
2011-04-04T09:05:10.320
|
2012-12-13T00:08:19.623
| null | null | 158,477 |
[
"css",
"internet-explorer-7",
"z-index"
] |
5,536,491 | 1 | 5,536,582 | null | 0 | 110 |
I am not getting how to design such a layput from interface builder.What i am planning is that :make two subviews in a single view
In one view put uitable view
and in another view put from and to labels and corresponding dropdownlists

i am not having any idea on how to do that.Can i do all above stuff in a single UItableView but how?
Thanks
|
How to design a view consisting of a table row ,label and dropdownlist
|
CC BY-SA 2.5
| null |
2011-04-04T09:05:47.803
|
2011-04-04T09:30:27.063
| null | null | 490,953 |
[
"iphone"
] |
5,536,697 | 1 | null | null | 0 | 141 |
I have to make some hot spots on my image , so that when i click anyone of them they zoom.
For example consider the image

When i click that butterfly then it zoom
Please provide a good solution
Following are my thinking
- -
Both ideas have their limitations.In first i have to create a saperate image and also my app size will become very large.
and limitation of second is that it will not zoom exact required image.
I was also thinking of masking but i think that is also not very good way, because this is just a sample, i have many images like this and can be many hot spots on a single image.
please guide.
|
Zooming a hotspot when it clicked
|
CC BY-SA 2.5
| null |
2011-04-04T09:28:23.617
|
2011-04-04T09:37:42.883
| null | null | 554,865 |
[
"iphone",
"uiimage",
"zooming"
] |
5,536,754 | 1 | 5,536,952 | null | 0 | 1,456 |
I wrote a query as :
```
select tbl1.Id, tbl1.FirstName, tbl1.MiddleInit, tbl1.LastName, tbl1.SocialSecNum, tbl1.DateOfBirth,
tbl1.EyeColor, tbl1.Sex, tbl1.AlertNotes, tbl1.RiskNotes, tbl1.Height, tbl1.[Weight], tbl1.AllergyNotes,
tbl2.HairColor, tbl3.SexualConsent, tbl4.MaritalStatus, tbl5.Ethnicity, tbl6.Veteran, tbl7.Religion, tbl8.Race,
tbl9.[Language] as [Language]
from
(SELECT C.Id, C.FirstName, C.MiddleInit, C.LastName, C.SocialSecNum, C.DateOfBirth, C.Sex,
GL.LookupItem as EyeColor, CC.AlertNotes, CC.RiskNotes, CC.Height, CC.[Weight], CC.AllergyNotes
FROM dbo.Client C INNER JOIN dbo.ClientCharacteristic CC ON C.Id = CC.ClientId INNER JOIN dbo.GeneralLookup GL ON
GL.Id=CC.glEyeColorId) tbl1,
(SELECT GL.LookupItem as HairColor
FROM dbo.ClientCharacteristic CC INNER JOIN dbo.GeneralLookup GL ON
GL.Id=CC.glHairColorId) tbl2,
(SELECT GL.LookupItem as SexualConsent
FROM dbo.ClientCharacteristic CC INNER JOIN dbo.GeneralLookup GL ON
GL.Id=CC.glSexConsentId) tbl3,
(SELECT GL.LookupItem as MaritalStatus
FROM dbo.Client C INNER JOIN dbo.GeneralLookup GL ON
GL.Id=C.glMaritalStatusId where C.Id=2) tbl4,
(SELECT GL.LookupItem as Ethnicity
FROM dbo.GeneralLookupTransition GLT INNER JOIN dbo.GeneralLookup GL ON
GL.Id=GLT.glValueId where GLT.ParentRecordId=2 and GLT.ControlName='CONSUMER_ETHNICITY_LIST') tbl5,
(SELECT GL.LookupItem as Veteran
FROM dbo.Client C INNER JOIN dbo.GeneralLookup GL ON
GL.Id=C.glVeteranId where C.Id=2) tbl6,
(SELECT GL.LookupItem as Religion
FROM dbo.GeneralLookupTransition GLT INNER JOIN dbo.GeneralLookup GL ON
GL.Id=GLT.glValueId where GLT.ParentRecordId=2 and GLT.ControlName='CONSUMER_RELIGION_DROPDOWN') tbl7,
(SELECT GL.LookupItem as Race
FROM dbo.GeneralLookupTransition GLT INNER JOIN dbo.GeneralLookup GL ON
GL.Id=GLT.glValueId where GLT.ParentRecordId=2 and GLT.ControlName='CONSUMER_RACE_DROPDOWN') tbl8,
(SELECT GL.LookupItem as [Language]
FROM dbo.GeneralLookupTransition GLT INNER JOIN dbo.GeneralLookup GL ON
GL.Id=GLT.glValueId where GLT.ParentRecordId=2 and GLT.ControlName='CONSUMER_CHARACTERISTIC_LANGUAGE_DROPDOWN') tbl9
```
The result is:

These some of the columns I got from this query. See the column Ethnicity.
It has 3 different records against a single client. Please tell me how can I convert these three records in a single comma separated records in the same column and these 3 rows become a single row.
Please save the image and then see. May be it is not visible here!
|
How to Comma separate multiple rows obtained from a SQL Query
|
CC BY-SA 2.5
| null |
2011-04-04T09:35:15.903
|
2022-06-09T18:04:28.453
|
2022-06-09T18:04:28.453
| 15,168 | 669,448 |
[
"sql",
"asp.net",
"csv"
] |
5,536,826 | 1 | 5,536,867 | null | 7 | 3,139 |
How we can get the processor name and registered to informations from PC? How is it possible through Java? I'm using windows OS.
Refer this image.

|
How to get the processor name and registered to informations using java?
|
CC BY-SA 3.0
| 0 |
2011-04-04T09:42:28.407
|
2016-10-06T19:54:14.193
|
2017-02-08T14:31:54.403
| -1 | 488,433 |
[
"java",
"system-information"
] |
5,536,872 | 1 | 5,536,946 | null | 0 | 1,204 |
how to change shape of rectangular `UITableViewCell (showing customer1 in screenshot) to round rect?
|
to change the UITAbleVIewCell shape to round rect
|
CC BY-SA 2.5
| null |
2011-04-04T09:50:40.727
|
2012-03-02T12:09:01.500
|
2011-04-04T09:52:07.037
| 606,586 | 10,441,561 |
[
"iphone"
] |
5,537,152 | 1 | 5,537,247 | null | 7 | 18,233 |
I have been struggling with this annoying piece of code. You'd think I'd had enough practice with css, but as always, it is temperamental with me.
My problem is as follows, I have the following css:
```
.FORM ul li label {
margin-top: 50px; //<--------------THE PROBLEM
height: 20px;
max-height: 20px;
width: 100px;
min-width: 100px;
}
.FORM ul li {
list-style: none;
width: 500px;
height: 100px;
min-width: 500px;
min-height: 100px;
background: #ddd;
border-top: #eee 1px solid;
border-bottom: #bbb 1px solid;
padding: 10px 10px;
margin: auto;
}
ul {
background: #ccc;
padding: 10px 10px 10px 10px;
width: 530px;
margin: auto;
}
body {
background: #cfc;
padding: 0px;
margin: 0px;
}
.FORM {
background: #fcc;
}
```
the html it controls is:
```
<form class="FORM">
<ul>
<li>
<label for="workersAddr">Worker's Address:</label>
<input type='text' id='workersAddr' class='validate[required,minSize[5]]'/>
</li>
</ul>
</form>
```
notice how in the image below the `margin-top: 50px;` have no effect at all?

how do I solve this issue?
|
Why css margins don't work?
|
CC BY-SA 2.5
| 0 |
2011-04-04T10:20:49.447
|
2013-05-22T15:54:26.407
| null | null | 418,575 |
[
"html",
"css"
] |
5,537,268 | 1 | 5,626,064 | null | 25 | 24,046 |
I saw this [question](https://stackoverflow.com/questions/3271731/djangos-admin-pages-are-missing-their-typical-formatting-style-have-i-set-it-up) and recommendation from Django Projects [here](http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from=olddocs#id3) but still can't get this to work. My Django Admin pages are not displaying the CSS at all.

This is my current configuration.
```
ADMIN_MEDIA_PREFIX = '/media/admin/'
```
```
<VirtualHost *:80>
DocumentRoot /home/django/sgel
ServerName ec2-***-**-***-***.ap-**********-1.compute.amazonaws.com
ErrorLog /home/django/sgel/logs/apache_error.log
CustomLog /home/django/sgel/logs/apache_access.log combined
WSGIScriptAlias / /home/django/sgel/apache/django.wsgi
<Directory /home/django/sgel/media>
Order deny,allow
Allow from all
</Directory>
<Directory /home/django/sgel/apache>
Order deny,allow
Allow from all
</Directory>
LogLevel warn
Alias /media/ /home/django/sgel/media/
</VirtualHost>
<VirtualHost *:80>
ServerName sgel.com
Redirect permanent / http://www.sgel.com/
</VirtualHost>
```
In addition, I also ran the following to create (I think) the symbolic link
`ln -s /home/djangotest/sgel/media/admin/ /usr/lib/python2.6/site-packages/django/contrib/admin/media/`
In my httpd.conf file,
```
User django
Group django
```
When I run ls -l in my `/media` directory
```
drwxr-xr-x 2 root root 4096 Apr 4 11:03 admin
-rw-r--r-- 1 root root 9 Apr 8 09:02 test.txt
```
Should that root user be django instead?
When I enter `ls -la` in my `/media/admin` folder
```
total 12
drwxr-xr-x 2 root root 4096 Apr 13 03:33 .
drwxr-xr-x 3 root root 4096 Apr 8 09:02 ..
lrwxrwxrwx 1 root root 60 Apr 13 03:33 media -> /usr/lib/python2.6/site-packages/django/contrib/admin/media/
```
The thing is, when I navigate to `/usr/lib/python2.6/site-packages/django/contrib/admin/media/`, the folder was empty. So I copied the CSS, IMG and JS folders from my Django installation into `/usr/lib/python2.6/site-packages/django/contrib/admin/media/` and it still didn't work
|
Django Admin Page missing CSS
|
CC BY-SA 3.0
| 0 |
2011-04-04T10:33:13.290
|
2022-09-14T19:22:57.727
|
2017-05-23T11:47:22.050
| -1 | 131,238 |
[
"python",
"css",
"django",
"django-admin"
] |
5,537,302 | 1 | 5,537,379 | null | 0 | 101 |
I'm trying to create a web design and there are a bit strange forms, something like this:

when the user hover on 1 section the background should change only for it:

the same for the second and third one:
Hope I'm clear...
I have no idea what technology should I use in order to achieve this affect. Can anyone please help?
|
div with rounded forms
|
CC BY-SA 2.5
| null |
2011-04-04T10:37:21.983
|
2011-04-04T11:13:19.690
|
2011-04-04T10:42:34.180
| 352,959 | 352,959 |
[
"javascript",
"html",
"css"
] |
5,537,356 | 1 | 5,538,023 | null | 1 | 232 |
Why isn't the actually simulator rendering of my view not matching that in interface builder. I have a UIPickerView next to UIDatePicker looking good in IB, but not in the simulator. In particular the large gap inbetween, and the fact the right hand side fo the time picker goes off the edge of the screen.
Any ideas?

|
UIPickerView next to UIDatePicker not rendering per IB?
|
CC BY-SA 2.5
| null |
2011-04-04T10:42:38.800
|
2011-04-04T11:49:22.793
|
2011-04-04T11:31:54.063
| 173,520 | 173,520 |
[
"iphone",
"ios",
"interface-builder",
"uipickerview",
"uidatepicker"
] |
5,537,391 | 1 | 5,537,428 | null | 0 | 783 |
I am trying to use Impact Font in my website for heading and it reders like this in the browsers.

In Photoshop it looks like this
[http://variable3.com/files/screenshots/2011-04-04_1612.png](http://variable3.com/files/screenshots/2011-04-04_1612.png)
CSS CODE
```
h1{
font-family: Impact, Haettenschweiler, Arial Narrow Bold, sans-serif;
font-size:30px;
}
h2{
font-family: Impact;
font-size:24px;
}
```
|
Font Rendering in Browsers
|
CC BY-SA 2.5
| null |
2011-04-04T10:45:45.973
|
2011-04-04T11:05:07.507
|
2011-04-04T10:48:16.357
| 271,725 | 155,196 |
[
"css",
"fonts"
] |
5,537,861 | 1 | 5,538,625 | null | 0 | 64 |
Sometimes the DataTips look like this....

and sometimes like this...

the code for each screenshot is (crude but) the same
```
var list = new List<DateTime>();
list.Add(DateTime.Now);
list.Add(new DateTime());
```
Is a project setting or something else?
|
Why do Visual Studio 2010 DataTips look different between projects/solutions?
|
CC BY-SA 2.5
| null |
2011-04-04T11:33:16.503
|
2011-04-04T13:04:40.053
|
2011-04-04T13:04:40.053
| 198,187 | 198,187 |
[
"visual-studio-2010"
] |
5,537,864 | 1 | 5,538,818 | null | 4 | 2,452 |

No matter what I try and do when it comes to WCF Routing I constantly get this error (via WCF Test Client). I cannot then see any Methods within my service(s)?
At first I just assumed it was my code, so I've downloaded almost all examples I could find of WCF + Routing and just ran those as-is. Same error happens!
I've checked the Event Viewer Logs etc to see if there is an error sneaking into there? nothing. I've tried Googling and Searching here for others (as surely i'm not alone) nothing.
Note:
1. I am using IIS7 with AppFabric Installed.
2. I am using .NET 4.0
3. I am using WCF Service Application Template (default in VS2010)
4. I am losing my mind over this one :)
This one has me absolutely lost as to what is going on?
Here's what the WCF Test Client brings back -

|
Getting IRequestReplyRouter does not match service contract or no valid method contract error?
|
CC BY-SA 2.5
| 0 |
2011-04-04T11:33:29.530
|
2012-02-22T15:37:45.967
| null | null | 94,167 |
[
"wcf",
"iis-7",
"routes"
] |
5,537,920 | 1 | 5,538,253 | null | 0 | 513 |
I am trying to validate an email address user has entered. I've done the validation in model but its not working. I have used the following in model...
```
class Employee < ActiveRecord::Base
belongs_to :department
validates_presence_of :emp_name_official
validates_presence_of :emp_name_full
validates_format_of :emp_email_personal, :with=>/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message=>"Not a valid email format"
end
```
I am using version 2.0.2 of rails.
And it works fine when I comment the validation line in my model. And also works fine when I give correct email address.
Can anyone tell where I am going wrong.
Following is the error page.

|
Validating email address in RoR
|
CC BY-SA 2.5
| null |
2011-04-04T11:39:30.923
|
2011-04-04T13:03:30.620
|
2011-04-04T12:49:52.107
| 524,990 | 524,990 |
[
"ruby-on-rails"
] |
5,538,125 | 1 | 5,538,194 | null | 0 | 787 |
I need to create the radio group as shown in diagram. Two thing i don`t know how to implement
1) the hint string below Main String(Ex: here 1 Minutes ,below some description is provided) , i don`t know how to put the description under the string.
2)separator line between two radio button. How to describe such separator line.
I don`t know whether it is possible or not.Anyone suggest some idea here.

|
Radio group layout design in android?
|
CC BY-SA 2.5
| null |
2011-04-04T11:59:18.953
|
2011-04-04T12:06:35.143
| null | null | 555,806 |
[
"android",
"android-layout"
] |
5,538,301 | 1 | null | null | 1 | 323 |
```
hello guys i am facing this error
```

How to fix it.
My ASP.net website is running fine locally.
|
deploying web application on server results in this error
|
CC BY-SA 2.5
| 0 |
2011-04-04T12:16:38.440
|
2011-04-06T11:22:08.770
|
2020-06-20T09:12:55.060
| -1 | 395,661 |
[
"asp.net",
"iis"
] |
5,538,381 | 1 | 5,551,786 | null | 1 | 496 |
I'm searching for a solution/alternative for my JButton Problem. My buttontext isn't matching correctly with my "keyboard key picture". The text is a little too low..
```
JToggleButton tglbtn_newLine = new JToggleButton("0");
tglbtn_newLine.setBackground(new Color(240,240,240));
tglbtn_newLine.setBorderPainted(false);
tglbtn_newLine.setIcon(new ImageIcon(/*Picture of a key*/);
//should be 2..3 pix above the CENTER position:
tglbtn_newLine.setVerticalTextPosition(SwingConstants.CENTER);
tglbtn_newLine.setHorizontalTextPosition(SwingConstants.CENTER);
GridBagConstraints gbc_tglbtn_newLine = new GridBagConstraints();
gbc_tglbtn_newLine.insets = new Insets( 0, 0, 5, 5);
tglbtn_newLine.setMargin(new Insets(-2, -2, -2, -2));
gbc_tglbtn_newLine.gridx = 4;
gbc_tglbtn_newLine.gridy = 5;
controlPanel.add(tglbtn_newLine, gbc_tglbtn_newLine);
```
Is there a possibility to set the text to a specific y-position.
Example pic:

|
JButton move text
|
CC BY-SA 2.5
| null |
2011-04-04T12:23:22.913
|
2011-04-05T18:54:44.417
|
2011-04-05T18:54:44.417
| 1,288 | 503,471 |
[
"java",
"swing",
"jbutton"
] |
5,538,565 | 1 | 5,538,816 | null | 2 | 4,019 |
I'm trying to create a page with two columns of images that scroll independently. I've built a simple two-column div layout with each column floating with 50% width and 100% height. The overflow is set to auto, so the content scrolls independently, but images wider than the container are cut off within the div.
Is there any way to achieve such an effect where the divs scroll independently and are able to have images that extend beyond the container? Or is there perhaps another direction to pursue?
Thank you!
--
Edit: Image for better explanation
What I mean by the overflow cutting off is that images wider are essentially cut off at the scrollbar, what I'm trying to achieve can be seen in this image, with each column being able to scroll independently ( I suppose with the mousehweel):

|
Independently scrolling div columns with images that extend beyond div width?
|
CC BY-SA 2.5
| 0 |
2011-04-04T12:38:02.197
|
2011-04-04T14:21:39.037
|
2011-04-04T14:21:39.037
| 436,014 | 436,014 |
[
"html",
"css",
"scroll"
] |
5,538,714 | 1 | 5,538,731 | null | 9 | 1,300 |
I'm developing Wicket applications in Eclipse 3.6. Is there a way to block out some packages from Eclipse autocomplete, so that I don't see suggestions for the unwanted AWT classes with the same name? I'd like to see the `org.apache.wicket` result below, but not the `java.awt` result.

|
How to hide some Eclipse autocomplete results
|
CC BY-SA 2.5
| 0 |
2011-04-04T12:52:15.200
|
2020-03-25T11:55:12.850
| null | null | 184,998 |
[
"java",
"eclipse",
"autocomplete"
] |
5,538,864 | 1 | 5,542,628 | null | 0 | 621 |
I have an ItemType that is coming from EF. This ItemType is wrapped in a ItemTypeViewModel. Many ItemTypes are wrapped in ItemTypeViewModels and are being put in a ObservableCollection in the ViewModel for the user control that will display them:

I use the CollectionView so I can page through them. The screen looks like this:

Now I'm thinking that the buttons that are used for paging that are in the user control could better be placed in the Window that will contain the user control. So, in my user control I know have commands like this:

But I want them to be in the window. I don't know if this will be good design, but if I will go through with this, how to relay the commands from the window to the usercontrol?
Another question I have is how to fill the combobox in the user control. They will always have the same values, but the selected item will change per ItemType.
|
MVVM - Filling a combobox and how to relay commands from window to user control
|
CC BY-SA 2.5
| null |
2011-04-04T13:05:20.210
|
2011-04-04T18:25:06.340
| null | null | 523,689 |
[
"wpf",
"mvvm"
] |
5,539,061 | 1 | 5,540,630 | null | 3 | 3,429 |
information:
I have an order form.

With "keuze" and "aantal" it wright a new line. The Orderline gets an OrderID.
But the user may only see the orderline from his OrderID.
How can i make it work that it only shows, for example the OrderID "47" ?
```
procedure TfmOrder.btInvoerenClick(Sender: TObject);
begin
dm.atOrder.open;
dm.atOrder.Append;
dm.atOrder ['OrderStatus'] := ('Aangemeld');
dm.atOrder ['klantID'] := fminloggen.userid;
dm.atOrder ['OrderDatum'] := Kalender.date;
dm.atOrder ['Opmerkingen'] := leOpmerkingen.text;
dm.atOrder.post;
cbkeuze.Visible := true;
dbRegel.Visible := true;
leAantal.visible := true;
btOpslaan.Visible:= true;
end;
```
This is the code for making a new Order
```
procedure TfmOrder.btOpslaanClick(Sender: TObject);
var orderid:string;
begin
dm.atOrderregel.Open;
dm.atDier.open;
dm.atorderregel.Append;
dm.atOrderregel ['AantalDieren'] := leAantal.text;
dm.atOrderregel ['OrderID'] := dm.atOrder ['OrderID'];
dm.atOrderregel ['Diernaam'] := cbKeuze.Text;
dm.atOrderregel.Post;
leaantal.clear;
cbkeuze.ClearSelection;
end;
```
And this for a new orderline
thanks in advance
I know got a different error using this code:
```
begin
dm.atorder.Open;
dm.atorder.filter := 'KlantID = ' + (fminloggen.userid);
dm.atorder.filtered := true;
while not dm.atorder.Eof do
begin
cbOrder.Items.Add (dm.atorder['OrderID']);
dm.atOrder.Next;
end;
dm.atOrder.Close;
end;
```
It gives an error: The arguments are from the wrong type, or doesn't have right reach or are in conflict with each other.
here is userid declared.
```
var Gevonden: boolean;
userid : string;
begin
dm.atInlog.open;
Gevonden := false;
while (not Gevonden) and (not dm.atInlog.eof) do
begin
if dm.atInlog['email'] = leUser.Text
then
begin
Gevonden := true ;
inlognaam := dm.atInlog['email'];
userid := dm.atInlog['KlantID'];
end
else
dm.atInlog.Next
end;
```
this is obviously in another form
|
how to show Only relevant information in dbgrid delphi
|
CC BY-SA 2.5
| null |
2011-04-04T13:19:37.677
|
2011-04-05T00:31:01.317
|
2011-04-04T17:47:59.177
| 1,638,432 | 1,638,432 |
[
"delphi"
] |
5,539,092 | 1 | null | null | 3 | 307 |
I'm trying to use HXT to read in some big XML data files (hundreds of MB.)
My code has a space-leak , but I can't seem to find it. I do have a little bit of a clue as to what is happening thanks to my very limited knowledge of the ghc profiling tool chain.
Basically, the document is parsed, but not evaluated.
Here's some code:
```
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
import Text.XML.HXT.Core
import System.Environment (getArgs)
import Control.Monad (liftM)
main = do file <- (liftM head getArgs) >>= parseTuba
case file of(Left m) -> print "Failed."
(Right _) -> print "Success."
data Sentence t = Sentence [Node t] deriving Show
data Node t = Word { wSurface :: !t } deriving Show
parseTuba :: FilePath -> IO (Either String ([Sentence String]))
parseTuba f = do r <- runX (readDocument [] f >>> process)
case r of
[] -> return $ Left "No parse result."
[pr] -> return $ Right pr
_ -> return $ Left "Ambiguous parse result!"
process :: (ArrowXml a) => a XmlTree ([Sentence String])
process = getChildren >>> listA (tag "sentence" >>> listA word >>> arr (\ns -> Sentence ns))
word :: (ArrowXml a) => a XmlTree (Node String)
word = tag "word" >>> getAttrValue "form" >>> arr (\s -> Word s)
-- | Gets the tag with the given name below the node.
tag :: (ArrowXml a) => String -> a XmlTree XmlTree
tag s = getChildren >>> isElem >>> hasName s
```
I'm trying to read a corpus file, and the structure is obviously something like `<corpus><sentence><word form="Hello"/><word form="world"/></sentence></corpus>`.
Even on the very small development corpus, the program takes ~15 secs to read it in, of which around 20% are GC time (that's way too much.)
In particular, a lot of data is spending way too much time in DRAG state. This is the profile:

monitoring DRAG culprits. You can see that decodeDocument gets called a lot, and its data is then stalled until the very end of the execution.
Now, I think this should be easily fixed by folding all this decodeDocument stuff into my data structures (`Sentence` and `Word`) and then the RT can forget about these thunks. The way it's currently happening though, is that the folding happens at the when I force evaluation by deconstruction of `Either` in the `IO` monad, where it could easily happen . I see no reason for this, and my attempts to strictify the program have so far been in vain. I hope somebody can help me :-)
I just can't even figure out too many places to put `seq`s and `$!`s in…
|
Debugging HXT performance problems
|
CC BY-SA 3.0
| null |
2011-04-04T13:22:17.813
|
2014-01-03T12:28:00.850
|
2014-01-03T12:28:00.850
| 11,797 | 11,797 |
[
"performance",
"debugging",
"haskell",
"memory-leaks",
"hxt"
] |
5,539,311 | 1 | 5,539,522 | null | 0 | 498 |
I'd like to create a custom view of "Player" for a card game.
1. Semi-transparent rectangle (this is my main problem, I don't know how i can do that).
2. Player's avatar in the middle of that rectangle.
3. The players card below (overlapping the rectangle).
Something like that:

Is that possible without drawing on canvas (only using xml and classes)?
Because i'd like to create one component and reuse it for different players.
Thanks.
|
Designing a custom view on android
|
CC BY-SA 2.5
| null |
2011-04-04T13:38:34.257
|
2011-04-04T13:55:49.153
| null | null | 410,548 |
[
"android",
"user-interface"
] |
5,539,431 | 1 | null | null | 1 | 620 |
I have urgent and unexplainable problem so any help would be appreciated. I haave 2 different databases which are exactly the same except there is different data in each of them.
I have a web application using LINQ-To-EF and until I've changed the database in connection string everything was working fine. Even though the databases are exactly the same I receive the error: "Invalid column name 'tema_id'." The problem is that "tema_id" doesn't exist in any of those two databases, however, somehow it does exist in .edmx file. The name of the mapping should be "aktivnost_id" and not "tema_id" how it is now.
I've tried updating the model from the database, but in that case everything gets wrong and I get dozens of different errors in Error List.
I've provided the screenshot of mapping details for the problematic table (you can see "tema_id" which should be "aktivnost_id").
I know my explanation might be a bit confusing, but if any additional info is needed I will provide it.

|
Invalid column name in my web application
|
CC BY-SA 2.5
| null |
2011-04-04T13:48:47.527
|
2011-04-04T13:55:44.130
| null | null | 621,665 |
[
"c#",
"asp.net",
"linq-to-sql",
"linq-to-entities"
] |
5,539,469 | 1 | 20,081,566 | null | 8 | 18,113 |
Does anybody know How to set the size of an AutoCompleteTextView Result ?

I try `android:textSize="12sp"` But it only modify the size of the text in the TextView, not in the result.
|
How to set the size of an AutoCompleteTextView Result?
|
CC BY-SA 2.5
| 0 |
2011-04-04T13:51:26.323
|
2021-10-05T10:14:18.227
| null | null | 198,843 |
[
"android",
"autocompletetextview"
] |
5,539,476 | 1 | 5,539,896 | null | 2 | 4,420 |
I have this GUI that counts the occurances of the first letter in a string. I would like it to count all letters in column format like:

Here is what I have so far:
```
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
public class Index2 extends JFrame implements ActionListener
{
private JTabbedPane jtabbedPane;
private JPanel characterFinder;
JTextField enterText, countText;
public Index2()
{
setSize(400, 250);
setVisible(true);
setSize(400, 250);
setVisible(true);
setTitle("Total Characters");
setSize(300, 200);
JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
getContentPane().add(topPanel);
createCharacterFinder();
jtabbedPane = new JTabbedPane();
jtabbedPane.addTab("Count Characters", characterFinder);
topPanel.add(jtabbedPane, BorderLayout.CENTER);
}
public void createCharacterFinder()
{
characterFinder = new JPanel();
characterFinder.setLayout(null);
JLabel enterLabel = new JLabel(
"Enter Some Text");
enterLabel.setBounds(90, 5, 260, 20);
characterFinder.add(enterLabel);
enterText = new JTextField();
enterText.setBounds(10, 30, 270, 70);
characterFinder.add(enterText);
JButton search = new JButton("Count Occurences of Each Letter");
search.setBounds(15, 100, 260, 20);
search.addActionListener(this);
characterFinder.add(search);
countText = new JTextField();
countText.setBounds(80, 130, 120, 500);
characterFinder.add(countText);
}
public void actionPerformed(ActionEvent e){
String st=enterText.getText();
char searchedChar=enterText.getText().charAt(0);
count(searchedChar,st);
}
public int count(char c, String str) {
if (str == null) return 0;
int cnt = 0;
for (int i = 0;; cnt++) {
if ((i = str.indexOf(c,i)+1) == 0) break;
}
countText.setText("Character "+c+" occurs "+cnt+" times");
return cnt;
}
public static void main(String[] args)
{
JFrame frame = new Index2();
frame.setSize(300, 700);
frame.setVisible(true);
}
}
```
|
Counting character occurrences in a String (frequency)
|
CC BY-SA 3.0
| 0 |
2011-04-04T13:52:04.810
|
2013-02-22T14:15:24.713
|
2013-02-22T14:10:26.747
| 1,624,376 | 640,015 |
[
"java",
"swing",
"user-interface"
] |
5,539,538 | 1 | 5,609,156 | null | 4 | 1,711 |
[this link](https://stackoverflow.com/questions/5300947/how-do-i-switch-between-the-header-and-implementation-file-in-xcode-4)
indicates that it is ctrl+cmd+up or down just like xcode says but mine seems to be revealing in finder even though the shortcut says otherwise.

Anyone else having this issue? How do you fix it.
|
xcode 4 switch between header and source
|
CC BY-SA 2.5
| null |
2011-04-04T13:56:57.550
|
2011-05-09T09:51:14.223
|
2017-05-23T12:01:09.963
| -1 | 251,420 |
[
"xcode4"
] |
5,539,907 | 1 | 5,540,005 | null | 2 | 4,729 |
>
[Show a Copying-files dialog/form while manually copying files in C#?](https://stackoverflow.com/questions/3041211/show-a-copying-files-dialog-form-while-manually-copying-files-in-c)
In C# windows forms programming, is there a way to include in my own application the animation windows always uses when copying files. As shown in picture below:

|
Using a windows file copying or file moving animation?
|
CC BY-SA 2.5
| null |
2011-04-04T14:25:32.220
|
2011-04-04T14:31:09.797
|
2017-05-23T12:01:11.803
| -1 | 214,470 |
[
"c#",
".net",
"winforms"
] |
5,540,027 | 1 | 5,543,150 | null | 17 | 15,475 |
The width of a UITabBarItem varies, depending on how many there are.
I'm looking for a property if possible, as opposed to a mathematical formula, since on the iPad, there is also an issue of padding on either side of the tab bar. Consider these screenshots. Notice the padding on either side of the tab bar items on the iPad (highlighted with the red boxes). This padding does not exist on the iPhone.

The iPhone:

|
How do I get the width of a UITabBarItem?
|
CC BY-SA 2.5
| 0 |
2011-04-04T14:33:37.050
|
2017-07-20T16:23:22.027
|
2011-04-04T18:00:28.133
| 224,988 | 224,988 |
[
"iphone",
"ios",
"uitabbar",
"uitabbaritem"
] |
5,540,057 | 1 | 5,544,044 | null | 2 | 2,667 |
I'm in the process of migrating from my old 32-bit Windows XP development machine to a new one that's running 64-bit Windows 7. I have the same stuff (VS 2010 + Silverlight Tools 4) installed and working on my old development machine.
I get a build error on my new development machine in VS 2010 when trying to build my F# Silverlight 4 project:
```
C:\Program Files (x86)\Microsoft F#\v4.0\Microsoft.FSharp.Targets(138,9): error : F# runtime for Silverlight version v4.0 is not installed. Please go to http://go.microsoft.com/fwlink/?LinkId=177463 to download and install matching F# runtime
Done building project "FCBuySideSilverlight.fsproj" -- FAILED.
```
I follow the link provided in the error, and download MS Silverlight Tools 4: [http://go.microsoft.com/fwlink/?LinkId=177463](http://go.microsoft.com/fwlink/?LinkId=177463)
However, when I try to it, I get this strange error:

All of my installations are in the English language, so it's very strange. What's more is that the link they provide ([http://go.microsoft.com/fwlink/?LinkId=177432](http://go.microsoft.com/fwlink/?LinkId=177432)) doesn't actually go anywhere useful.
Any thoughts? Thanks.
|
Error When Installing Silverlight 4 Tools for Visual Studio 2010
|
CC BY-SA 2.5
| null |
2011-04-04T14:36:01.743
|
2015-11-09T01:35:03.867
|
2015-11-09T01:35:03.867
| 1,505,120 | 107,877 |
[
"visual-studio",
"silverlight",
"silverlight-4.0"
] |
5,540,423 | 1 | 5,540,568 | null | 1 | 235 |
```
public static List<PreviewSchedule> BuildPreviewSchedule(Chatham.Business.Objects.Transaction transaction)
{
List<PreviewSchedule> items = new List<PreviewSchedule>();
List<ScheduleItem> scheduleItems = new List<ScheduleItem>(transaction.ScheduleCollection.FindAll(row => row.IsDeleted == false));
bool allFromDateFilledIn = !scheduleItems.Exists(item => !item.FromDate.HasValue);
bool allFloatingFromDateFilledIn = !scheduleItems.Exists(item => !item.FloatingFromDate.HasValue);
scheduleItems.Sort((a, b) => a.FromDate.GetValueOrDefault().CompareTo(b.FromDate.GetValueOrDefault()));
scheduleItems.Sort((a, b) => SortIt(a, b, allFromDateFilledIn, allFloatingFromDateFilledIn));
for (int i = 0; i < scheduleItems.Count; i++)
{
items.Add(new PreviewSchedule
{
Drop = i == 0 ? "$0.00" :
((scheduleItems[i - 1].PrincipalNotionalAmount - scheduleItems[i].PrincipalNotionalAmount)).Value.ToString(Format.CurrencyCentsIncludedFormatStringDollarSign),
EndDate = GetDateOrNull(scheduleItems[i].ToDate),
StartDate = GetDateOrNull(scheduleItems[i].FromDate),
Notional = scheduleItems[i].PrincipalNotionalAmount.Value.ToString(Format.CurrencyCentsIncludedFormatStringDollarSign),
FloatingEndDate = GetDateOrNull(scheduleItems[i].FloatingToDate),
FloatingStartDate = GetDateOrNull(scheduleItems[i].FloatingFromDate)
});
}
return items;
}
```
Here is the method that we call to return our schedule to the front end in our mvc app. Now, this list has been mixing up the last two rows on a specific model the same way each time. Look at the pic:

Last two rows of the table, you can obviously see the last two rows are switched around, because the dates don't follow each other. This method is spitting back those mixed up dates, and I'm thinking it's a problem with the sorting. Can any of you guys see where the sorting would cause this?
Thanks ahead of time.
Edit:
SortIt() code:
```
private static int SortIt(
Chatham.Business.Objects.ScheduleItem a,
Chatham.Business.Objects.ScheduleItem b,
bool allFromDateFilledIn,
bool allFloatingFromDateFilledIn)
{
return SortIt(a.FromDate, a.FloatingFromDate, b.FromDate, b.FloatingFromDate, allFromDateFilledIn, allFloatingFromDateFilledIn);
}
private static int SortIt(DateTime? aFrom,
DateTime? aFloatingFrom,
DateTime? bFrom,
DateTime? bFloatingFrom,
bool allFromDateFilledIn,
bool allFloatingFromDateFilledIn)
{
DateTime? a = null;
DateTime? b = null;
if (allFromDateFilledIn == false && allFloatingFromDateFilledIn == false)
{
a = aFrom ?? aFloatingFrom;
b = bFrom ?? bFloatingFrom;
}
else
{
a = allFromDateFilledIn ? aFrom : aFloatingFrom;
b = allFromDateFilledIn ? bFrom : bFloatingFrom;
}
if (a.HasValue && b.HasValue)
return a.Value.CompareTo(b.Value);
return 0;
}
```
|
List sorting issue in c#
|
CC BY-SA 2.5
| null |
2011-04-04T15:06:01.047
|
2011-04-04T17:16:46.513
|
2011-04-04T15:11:27.437
| 534,101 | 534,101 |
[
"c#",
"sorting"
] |
5,540,639 | 1 | 5,540,746 | null | 0 | 1,641 |
Hey guys bit of a complication here, I have a create account page and it just inserts data into a mysql db:
```
protected void Button1_Click(object sender, EventArgs e)
{
OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;");
cn.Open();
OdbcCommand cmd = new OdbcCommand("INSERT INTO User (Email, FirstName, SecondName, DOB, Location, Aboutme, username, password) VALUES ('" + TextBox1.Text + "', '" + TextBox2.Text + "', '" + TextBox3.Text + "', '" + TextBox4.Text + "', '" + TextBox5.Text + "', '" + TextBox6.Text + "', '" + TextBox7.Text + "', '" + TextBox8.Text + "')", cn);
cmd.ExecuteNonQuery();
{
//e.Authenticated = true;
Response.Redirect("Login.aspx");
// Event useradded is true forward to login
}
}
}
```
But here is my problem on the create account page I have added a fileupload control and I would like to upload a image and save the imageurl in the pictures table:
```
string filenameDB = Path.GetFileName(FileUploadControl.FileName);
string fileuploadpath = Server.MapPath("~/userdata/" + theUserId + "/uploadedimage/") + Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(fileuploadpath);
string fileuploadpaths = ("~/userdata/" + theUserId + "/uploadedimage/") + filenameDB;
StatusLabel.Text = "Upload status: File uploaded!";
OdbcCommand cmd = new OdbcCommand("INSERT INTO Pictures VALUES picturepath ='" + fileuploadpaths + "' WHERE UserId = '" + theuserid + "'", cn);
cmd.ExecuteNonQuery();
```
The first problem is the sql syntax I need to combine the fileupload with my buttonclick so it would be INSERT INTO two tables User and Pictures but the problem after that is how on earth do I get the userid if the account isnt created yet? AHHH lol
Table structure:

So to sum it up I need to Insert user details into the user table and upload to the project file AND insert the imageUrl into the pictures table (stored like so ~/userdata/2/uploadedimages/bla.jpg) as you can see the pictures table is a 1-1 relationship to the user table so its dependant on the userid which be4 the account is created there is no userid so not sure if there is a way to stagger the code so the user details are inserted first then use a session to retrieve that userid then insert the imageurl into the pictures table?
Or Maybe there is some funky function that some clever person has already came upon this issue or maybe its just a simple sql syntax decombobulator.
```
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
try
{
OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;");
cn.Open();
OdbcCommand cmd = new OdbcCommand("INSERT INTO User (Email, FirstName, SecondName, DOB, Location, Aboutme, username, password) VALUES ('" + TextBox1.Text + "', '" + TextBox2.Text + "', '" + TextBox3.Text + "', '" + TextBox4.Text + "', '" + TextBox5.Text + "', '" + TextBox6.Text + "', '" + TextBox7.Text + "', '" + TextBox8.Text + "')", cn);
OdbcCommand sc = new OdbcCommand("SELECT LAST_INSERT_ID()", cn);
//convert LAST INSERT into string theUserId
string filenameDB = Path.GetFileName(FileUpload1.FileName);
string fileuploadpath = Server.MapPath("~/userdata/" + theUserId + "/uploadedimage/") + Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(fileuploadpath);
string fileuploadpaths = ("~/userdata/" + theUserId + "/uploadedimage/") + filenameDB;
Label10.Text = "Upload status: File uploaded!";
OdbcCommand cm = new OdbcCommand("INSERT INTO Pictures (picturepath, UserId) VALUES ('" + fileuploadpaths + "', " + theUserId + ")", cn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Label10.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
//e.Authenticated = true;
//Response.Redirect("Login.aspx");
// Event useradded is true forward to login
}
}
}
```
|
insert into multiple tables without knowing the primary key
|
CC BY-SA 2.5
| null |
2011-04-04T15:20:02.117
|
2011-04-04T15:53:34.830
|
2011-04-04T15:53:34.830
| 477,228 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,540,685 | 1 | null | null | 0 | 1,052 |
I am trying to upgrade to Fluent NHibernate 2.1 (Build #694). As a result, I am also upgrading to NHibernate 3.0. I am having an issue with a "Table-Per-Subclass" mapping, which results in error when trying to retrieve data.
these tables and classes worked with the now deprecated version of "Joined-Subclass" mapping which existed in a previous version of FluentNhibernate, which allowed the subclass to have its own unique id.
I have whittled the code down to its smallest parts, so let me explain, via code and it will become more clear:
Here are the tables involved:

Here are the classes representing the tables:
```
public class Field
{
public virtual int Id { get; set; }
public virtual string Code { get; set; }
public virtual string Description { get; set; }
}
public class MenuItem : Field
{
public virtual string NavigateUrl { get; set; }
}
public class UserLink
{
public virtual int Id { get; set; }
public virtual string ExternalLinkName { get; set; }
public virtual MenuItem MenuItem { get; set; }
public virtual int UserId { get; set; }
}
```
Here are the corresponding Mappings:
```
public class FieldMap : ClassMap<Field>
{
public FieldMap()
{
Table("Field");
Id(x => x.Id, "ID").GeneratedBy.Identity();
Map(x => x.Code, "Code");
Map(x => x.Description, "Description");
}
}
public class MenuItemMap : SubclassMap<MenuItem>
{
public MenuItemMap()
{
Table("MenuItem");
Map(x => x.NavigateUrl, "NavigateUrl");
}
}
public class UserLinkMap : ClassMap<UserLink>
{
public UserLinkMap()
{
Table("UserLink");
Id(x => x.Id, "ID").GeneratedBy.Identity();
Map(x => x.ExternalLinkName, "ExternalLinkName");
Map(x => x.UserId, "User_ID");
References(x => x.MenuItem).Column("ID");
}
}
```
Here is the test:
```
[Test]
public void CanRetrieveUserLinks()
{
ISession session = GetSession();
DetachedCriteria criteria = DetachedCriteria.For(typeof (UserLink))
.Add(Restrictions.Eq("UserId", 1));
ICriteria executableCriteria = criteria.GetExecutableCriteria(session);
var userLinks = executableCriteria.List<UserLink>();
Assert.IsFalse(string.IsNullOrEmpty(userLinks[0].MenuItem.NavigateUrl));
session.Close();
}
```
When the Assert line is executed, the SQL generated is incorrect as it . Therefore, I receive the error: `NHibernate.ObjectNotFoundException: No row with the given identifier exists[AS.AIMS.DomainModel.MenuItem#11]`
First the sql is generated to retrieve the userLinks, which is correct:
```
SELECT this_.ID as ID2_0_,
this_.ExternalLinkName as External2_2_0_,
this_.User_ID as User3_2_0_
FROM UserLink this_
WHERE this_.User_ID = 1 /* @p0 */
```
Then to retrieve the Menu Item, it uses Field_Id instead of ID:
```
SELECT menuitem0_.Field_id as ID0_0_,
menuitem0_1_.Code as Code0_0_,
menuitem0_1_.Description as Descript3_0_0_,
menuitem0_.NavigateUrl as Navigate2_1_0_
FROM MenuItem menuitem0_
inner join Field menuitem0_1_
on menuitem0_.Field_id = menuitem0_1_.ID
WHERE menuitem0_.Field_id = 11 /* @p0 */
```
|
Fluent NHibernate 1.2 with SubclassMap causes "No row with the given identifier" error
|
CC BY-SA 2.5
| null |
2011-04-04T15:23:20.050
|
2011-04-05T21:11:30.713
|
2011-04-05T21:11:30.713
| 156,807 | 156,807 |
[
"nhibernate",
"fluent-nhibernate",
"mapping"
] |
5,540,735 | 1 | null | null | 2 | 1,083 |
I am using the view models in the class diagram below for a time sheet presentation using a DataGrid.
The top class (ActivityCollectionViewModel) is the DataContext for the grid; the collection of activities (ActivityViewModel) it holds are line items in the grid. The activity has a collection of allocations (AllocationViewModel) which are the majority of the line item DataGrid cells (columns).
Please notice that the AllocationVm (cell) has it's own command, the MakeFullDayCommand. In the current design I have equivalent commands in both the AllocationVm's parent as well as its grandparent. I did it this way thinking I could bind the grandparent's command and then use the collectionViewSource's ability to maintain the selected chiild vms so that the correct cell's command would always be the one invoked.
In practice, it is confusing to track and I am having trouble getting binding alone to keep everything synchronized, so I have resorted to several code behind hacks in the DataGrid, as shown below.
So I thought I'd step back and see if maybe someone could suggest a simpler more effective design than what I've got, or confirm that this is a viable solution and help me get a better data binding strategy in place.
Cheers,
Berryl
# How it works
The bottom command in the context menu below is that nested command I am referring to.

# Code Behind
This code is butt ugly and tough to test!
```
/// <summary>
/// Synchronize the <see cref="ActivityViewModel.SelectedAllocationVm"/> here so the input binding
/// key (F8) is always working on the correct command.
/// </summary>
private void OnCurrentCellChanged(object sender, EventArgs e)
{
if (sender == null) return;
var grid = (DataGrid)sender;
if (grid.CurrentColumn == null) return;
var selectedActivity = (ActivityViewModel)grid.CurrentItem;
if (_isEditableDayOfTheWeekColumn(grid.CurrentColumn))
{
var dowCol = (DayOfTheWeekColumn)grid.CurrentColumn;
var index = Convert.ToInt32(dowCol.DowIndex);
selectedActivity.SetSelectedAllocationVm(index);
}
else
{
selectedActivity.SetSelectedAllocationVm(-1);
}
}
/// <summary>
/// Invoke the MakeFullDayCommand when the user double clicks an editable cell;
/// synchronize the selected allocation view model first.
/// </summary>
private void OnDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender == null) return;
var grid = (DataGrid)sender;
if (grid.CurrentColumn == null) return;
if (!_isEditableDayOfTheWeekColumn(grid.CurrentColumn)) return;
var selectedActivity = (ActivityViewModel) grid.CurrentItem;
var dowCol = (DayOfTheWeekColumn)grid.CurrentColumn;
var index = Convert.ToInt32(dowCol.DowIndex);
var allocationVm = selectedActivity.SetSelectedAllocationVm(index);
if (allocationVm.MakeFullDayCommand.CanExecute(null))
{
allocationVm.MakeFullDayCommand.Execute(null);
}
}
/// <summary>
/// Manipululate the context menu to show the correct description of the MakeFullDayCommand.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.Windows.Controls.ContextMenuEventArgs"/> instance containing the event data.</param>
void OnContextMenuOpening(object sender, ContextMenuEventArgs e) {
if (sender == null) return;
var grid = (DataGrid)sender;
if (grid.CurrentColumn == null) return;
const int INDEX_OF_MAKE_FULL_DAY_CMD = 1;
if (_isEditableDayOfTheWeekColumn(grid.CurrentColumn)) {
var selectedActivity = (ActivityViewModel) grid.CurrentItem;
var dowCol = (DayOfTheWeekColumn) grid.CurrentColumn;
var index = Convert.ToInt32(dowCol.DowIndex);
var allocationVm = selectedActivity.SetSelectedAllocationVm(index);
var menuItem = allocationVm.MakeFullDayCommand.ToMenuItem();
if (grid.ContextMenu.Items.Count == 1) {
Log.Info("{0}", allocationVm.MakeFullDayCommand.HeaderText);
grid.ContextMenu.Items.Add(menuItem);
}
else {
var currentItem = (MenuItem) grid.ContextMenu.Items.GetItemAt(INDEX_OF_MAKE_FULL_DAY_CMD);
if (currentItem.Command != menuItem.Command) {
// remove the outdated menu item before adding back the new one
grid.ContextMenu.Items.Remove(currentItem);
grid.ContextMenu.Items.Add(menuItem);
}
}
}
else
{
if (grid.ContextMenu.Items.Count == 2)
{
// we aren't on an editable cell - remove the command altogether
grid.ContextMenu.Items.RemoveAt(INDEX_OF_MAKE_FULL_DAY_CMD);
}
}
}
```

|
MVVM command binding of nested view models
|
CC BY-SA 2.5
| null |
2011-04-04T15:27:08.260
|
2011-04-04T15:38:08.660
| null | null | 95,245 |
[
"wpf",
"silverlight",
"data-binding",
"mvvm"
] |
5,540,932 | 1 | 5,541,021 | null | 0 | 262 |
In Android I'm trying to get a layout looking like [this image](http://oi51.tinypic.com/fuw7tj.jpg) using xml.

What I've been trying to do is to separate the view vertical into two parts. One for the blue part and one for the white. For the blue part I use a shape as background to get the gradient and for the white part just a white background. It works good for the "Title" and "Some text" part. But as the image view should overlay both layouts it isn't working.
I can't figure out how to setup the xml layout to get it working, any ideas?
|
How to setup this layout in android?
|
CC BY-SA 2.5
| null |
2011-04-04T15:42:47.313
|
2011-04-04T15:51:04.177
| null | null | 611,494 |
[
"android",
"layout"
] |
5,541,083 | 1 | 5,544,978 | null | 1 | 1,148 |
I've seen this issue a few times and haven't found a fix for it. The contents of my ScrollView blur when scrolling. Below are the xml layout for the view, and images showing the issue.
```
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TableLayout
android:stretchColumns="1,2"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView
android:text=""
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<TextView
android:text="Column 1"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<TextView
android:text="Column 2"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</TableRow>
<TableRow>
<TextView
android:text="Row1: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row2: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row3: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row4: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row5: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row6: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row7: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row8: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
<TableRow>
<TextView
android:text="Row9: "
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</TextView>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:layout_gravity="center">
</CheckBox>
</TableRow>
</TableLayout>
</ScrollView>
```


|
Android: ScrollView gets messy when scrolling?
|
CC BY-SA 2.5
| null |
2011-04-04T15:55:54.333
|
2015-06-08T09:21:51.600
| null | null | 426,493 |
[
"android",
"scrollview"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.