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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,021,111 | 1 | 12,740,626 | null | 0 | 5,014 |
I have develop web application and use Crystal Report.
The problem occur when i use Thai language.
Thai symbol cannot read and its replace with square symbol.
The result have no problem when use CrystalReportViewer on window application (figure 1).
But the problem occur on web site (figure 2), when user request a report, i send the report back with pdf file format.
figure 1: Expecated Result

figure 2: Problem Result

The code look like below.
```
rptExternalTransferReport rptH = new rptExternalTransferReport();
rptH.FileName = Server.MapPath("/Reports/rptExternalTransferReport.rpt");
rptH.Load();
rptH.SetDataSource([datatable]);
Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
return File(stream, "application/pdf");
```
How to fixed this problem.
Help me please.
Edit 17-May, 2011:
Look like the problem is occur when i export to pdf file.
Because i try use CrystalReportViewer, it have no problem.
But when export to pdf, the problem occurred.
PS. Sorry for my english writing :)
|
How to fix Crystal Report Thai language problem
|
CC BY-SA 3.0
| 0 |
2011-05-16T17:34:06.003
|
2012-10-05T06:22:16.840
|
2011-05-17T15:22:50.830
| 448,646 | 448,646 |
[
"asp.net",
"crystal-reports"
] |
6,021,108 | 1 | 6,021,143 | null | 0 | 581 |
First of all I am sorry to ask a stupid question, this is because I am novice in ASP.NET.
I am following asp.net MVC music store tutorial and here is what I have made:
```
namespace MvcMusicStore.Controllers
{
public class StoreController : Controller
{
//
// GET: /Store/
public ActionResult Index()
{
var genre = new List<Genre>
{
new Genre{ Name = "Disco"},
new Genre{ Name = "Jazz"},
new Genre{ Name = "Rock"}
};
return View();
}
```
............
Genre Class
```
namespace MvcMusicStore.Models
{
public class Genre
{
public string Name {get; set;}
}
}
```
Album Class
```
namespace MvcMusicStore.Models
{
public class Album
{
public string Title { get; set; }
public Genre Genre { get; set; }
}
}
```
Index.cshtml
```
@model IEnumerable<MvcMusicStore.Models.Genre>
@{
ViewBag.Title = "Store";
}
<h2>Browse Genre</h2>
<p>Select from @Model.Count() genres:</p>
<ul>
@foreach (var genre in Model)
{
<li>@genre.Name</li>
}
</ul>
```
Error I am getting is this
|
Error while running Mvc Music store
|
CC BY-SA 3.0
| null |
2011-05-16T17:33:58.263
|
2014-08-23T19:16:00.837
| null | null | 609,582 |
[
"asp.net-mvc-3"
] |
6,021,138 | 1 | 7,042,201 | null | 64 | 47,156 |
I create one UIToolbar with code and another with interface builder. But, found out the two toolbar having different left and right padding which shown below:
From Interface Builder:

From Code:

```
UIImage *buttonImage = [[UIImage imageNamed:@"button.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
UIButton *btnTest = [UIButton buttonWithType:UIButtonTypeCustom];
[btnTest setBackgroundImage:buttonImage forState:UIControlStateNormal];
[btnTest setTitle:@"Back" forState:UIControlStateNormal];
[btnTest.titleLabel setFont:[UIFont boldSystemFontOfSize:13]];
[btnTest setBackgroundImage:[imgToolbarButton stretchableImageWithLeftCapWidth:5 topCapHeight:0] forState:UIControlStateNormal];
[btnTest addTarget:self action:@selector(clearDateEdit:) forControlEvents:UIControlEventTouchUpInside];
btnTest.frame = CGRectMake(0.0, 0.0, 50, 30);
UIBarButtonItem *btnTestItem = [[UIBarButtonItem alloc] initWithCustomView:btnTest];
[self.toolbar setItems:[NSArray arrayWithObjects:btnTestItem,nil]];
[btnTestItem release];
```
My question is how can I adjust the left and right padding of UIToolbar by code?
I discovered this alignment issue only happen to UIBarButtonItem with customView of UIButton, the alignment is fine with UIBarButtonItem. Any idea what cause this or to resolve this.
The only solution I can think of right now is to manually set the frame.
|
How to adjust UIToolBar left and right padding
|
CC BY-SA 3.0
| 0 |
2011-05-16T17:36:28.317
|
2022-08-12T14:13:47.433
|
2011-05-17T09:34:02.123
| 572,438 | 572,438 |
[
"iphone",
"objective-c"
] |
6,021,247 | 1 | 6,022,727 | null | 0 | 199 |
I'm using SVN via AnkhSVN for my project and whenever I go to commit I get the following error(s) then when I click the Stacktrace button this is what it's showing . I have no idea what this path is that it's looking for, so what can I do to resolve this?
This is weird because that directory has never existed, not removed or deleted either. No files appear to be in conflict either, so this one has me stimpted.
|
AnkhSVN error, looking for strange path
|
CC BY-SA 3.0
| null |
2011-05-16T17:47:56.053
|
2011-05-17T02:55:42.307
|
2011-05-17T02:55:42.307
| 88,230 | 88,230 |
[
"svn",
"ankhsvn"
] |
6,021,370 | 1 | null | null | 1 | 938 |
Hi all,
I'm a newbie to Android and having problems displaying items using a Linear layout and wondering if anyone can help me. The item list and pictures display fine but the textbox and search button are displayed for each item rather than getting displayed once. My code looks like:
```
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
<TextView
android:id="@+id/selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/searchHeader"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/searchItem"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/search"
android:onClick="Search"/>
</LinearLayout>
</LinearLayout>
```
|
Android Linear Layout Problem
|
CC BY-SA 3.0
| 0 |
2011-05-16T17:56:55.900
|
2018-04-02T13:11:09.027
|
2011-05-16T18:41:39.517
| 676,567 | 676,567 |
[
"android",
"android-linearlayout"
] |
6,021,646 | 1 | 6,022,024 | null | 2 | 1,858 |
## Example
I basically need something close to :

## Existing Libraries
I already tried [GWT Planning](http://code.google.com/p/gwt-planning/), but I couldn't get it working. Right now I'm looking into [GWT Simile Timeline](http://code.google.com/p/gwtsimiletimeline/).
## Implementation
If there aren't any other usable timeline libraries, do you have any ideas
Is using a good idea?
Won't there be some ? (due to the fact that GWT already uses a lot of tables for the layouts and it takes some time until the browser renders the page).
---
## EDIT
## Final decision
I reviewed GWT Simile Timeline, but it doesn't do what I want and besides that the documentation is not finished and it seems to me that the project is discontinued.
I'll follow [Daniel Kurka](https://stackoverflow.com/questions/6021646/are-there-any-decent-gwt-timeline-libraries-out-there/6022024#6022024)'s suggestion (using cellTable).
## Open to suggestions
If there are any other suggestions I'm open to them...
---
## ANOTHER EDIT
Is it better if I use for this type of things? I saw that it allows me to use any type of widget (but I think it has performance issues). I want to have up to 100-150 widgets on the timeline. Will performance be affected by this number of widgets?
|
Are there any decent GWT Timeline libraries out there?
|
CC BY-SA 3.0
| 0 |
2011-05-16T18:23:12.903
|
2011-05-17T15:05:42.310
|
2017-05-23T11:53:28.290
| -1 | 354,009 |
[
"web-applications",
"gwt",
"timeline"
] |
6,021,888 | 1 | 6,083,053 | null | 2 | 1,900 |
I have an application in C++ Builder 2010 that has Visual Styles/Runtime Themes enabled to use the runtime look for buttons and tabs. However, I have a set of checkboxes (TCheckBox) for which I would like to override the runtime style, if possible.
My checkboxes are used to toggle some graphical overlays for various colors. When I have runtime themes disabled, I can set the background of the checkbox to show which color it will enable, like so:

Is there a way I can achieve this same effect when runtime themes are enabled?
Thanks to stukelly, I can selectively disable visual styles for individual controls, but I seem unable to modify the color or other styling of that control after I call SetWindowTheme as below:
```
SetWindowTheme(CheckBox1->Handle, L" ", "");
```
|
Can I override the color of a control when Visual Styles are enabled?
|
CC BY-SA 3.0
| null |
2011-05-16T18:45:09.957
|
2011-05-21T19:25:28.147
|
2011-05-16T21:48:44.410
| 538,247 | 538,247 |
[
"c++",
"c++builder",
"vcl"
] |
6,022,136 | 1 | 6,022,199 | null | 2 | 1,684 |
Hello i'm trying to make an equalizer for my app but i can't figure out how to make the buttons. I don't really know how to explain myself so here is a picture that reveals more than my words:

Do i need animations? Can you guys point me in the right direction?
Thanks in advance.
|
how to make scrollable button in android
|
CC BY-SA 3.0
| 0 |
2011-05-16T19:09:15.603
|
2011-10-25T12:41:18.787
| null | null | 526,924 |
[
"android"
] |
6,022,305 | 1 | null | null | 5 | 4,882 |
Is [ITaskScheduler](http://msdn.microsoft.com/en-us/library/aa381811%28v=vs.85%29.aspx) supported in Windows 7?
I've used the Task Scheduler in Windows XP and Windows Vista to create scheduled tasks.
On Windows 7 the job gets (correctly) created, for example:
```
C:\Windows\Tasks\Foo Test Task.job
```
But the task never runs and doesn't appear in the Task Scheduler UI (Start -> Task Scheduler):

According to MSDN, `ITaskScheduler` is part of the now deprecated . New applications should use [ITaskService](http://msdn.microsoft.com/en-us/library/aa381832%28v=vs.85%29.aspx), part of .
Since `ITaskScheduler` doesn't work (for me) under Windows 7 (but did work under Windows Vista) I wonder if it's no longer supported (even though the the COM objects exist, the code causes no errors, and it creates the job).
While MSDN doesn't include in the list of supported OS's for Task Scheduler 1.0, it also doesn't even say that Windows 7 supports Task Scheduler 2.0:
> [Run-Time Requirements](http://msdn.microsoft.com/en-us/library/aa383614%28v=VS.85%29.aspx)The Task Scheduler requires the
following operating systems.- -
So officially no task scheduler API is supported on Windows 7.
But is `ITaskScheduler` supported on Windows 7?
Is it expected to work?
Judging by the community comments on the [Task Scheduler homepage](http://msdn.microsoft.com/en-us/library/aa383614%28v=VS.85%29.aspx), I guess not:
>
Is it really possible to use Task Scheduler 1,0 under Windows Vista and Windows 7? How can it be done?
I have the same trouble with Win7 Task Scheduler - Creating a simple task to launch a script/program does not work.I exported my non-working task as well
as a working MS task and compared
them. I changed the following
parameter in my exported task and
re-imported it and now it works:
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>This work-around is getting me by for
now.Other thoughts: There does not appear
to be a Task Scheduler GUI setting to
affect this parameter? The API
description implied a setting of false
should work, but for some reason it
doesn't? It's hard to believe such a
fundemental overshight exists; could
it be something else with my Win7
setup that requires the true setting?
I seem to recall the same problem with
a fresh Vista install in the past that
was mysteriously resolved before I
investigated a work-around. Hmmm... I
think I read also that the new
scheduling engine associated with the
true setting curiously does not
support things like monthly
scheduling....?
I have a
scheduled task that executes perfectly
well in Windows XP Pro but the same
task in Windows 7 returns a "0x2"
under "Last Run Result". According to
the command line command, "net helpmsg
2", "0x2" equates to "The system
cannot find the file specified." I can certainly find the file, and the
path I use in the Actions tab has been
checked, re-checked, double-checked
and triple-checked.I have read countless posts in
multiple forums about this issue. I
have yet to find a satisfactory
answer.The action that the task is supposed
to execute is a .bat file that calls a
Perl script. The Perl script writes
one each of the following file types,
.txt, .csv, and .xml. Execution of the
.bat file from the command line works
perfectly well; however, once it is
put into a Windows 7 scheduled task,
it returns 0x2. This same task under
Windows XP Pro works like a champ.
What is it about Windows 7 tasks that
make it so difficult to execute
successfully?
|
Is ITaskScheduler supported in Windows 7?
|
CC BY-SA 3.0
| 0 |
2011-05-16T19:25:15.990
|
2013-04-11T14:06:43.107
|
2011-07-23T18:54:45.300
| 63,550 | 12,597 |
[
"windows-7",
"scheduled-tasks",
"task",
"windows-7-x64"
] |
6,022,553 | 1 | null | null | 2 | 3,420 |
I have a problem with laying out a Relative Layout. Here is the test code
```
<RelativeLayout
android:background="@drawable/bg_controls"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/controls_layout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/controls_layout" />
</RelativeLayout>
```
The result of that is 
If I remove android:layout_centerInParent="true" everything works OK. Why does RelativeLayout fails to do that otherwise?
UPD: the intended result is that a second button appears under the LinearLayout.
|
RelativeLayout layout_centerInParent and layout_below issue
|
CC BY-SA 3.0
| null |
2011-05-16T19:51:27.847
|
2016-07-11T07:29:17.247
| null | null | 230,466 |
[
"android",
"android-layout",
"android-relativelayout"
] |
6,022,606 | 1 | 6,030,872 | null | 0 | 295 |
I need your help to implement horizontal table splitting but not for inherited class(es). I need just to "move" some attributes to new entity, separate them. This new entity should have an association (1 <-> 1..0)
But I catch the "...Their primary keys may collide" error. Where is the secret?
But there is still one open question: what to use horizontal classes or derived entities?
I have table Records (with PK RecordID) where there are several attributes with "duplicated information" that means this information can be "accessed" also by using/joining other referenced table (let say Dictionary) and is just "backuped" information from it.
Referred information could differ from "backuped/duplicated" and this have sense in my domain model, so in general I need both, but most of select and update statements do not involve those "duplicated attributes", so I want to support this fact somehow in the conceptual model. Is this the normal desire or the direct way to get "overdesigned" model ?
OK. This is the scheme. On the left what I have, on the right what I want to have.

|
EF4 : horizontal splitting or complex types?
|
CC BY-SA 3.0
| null |
2011-05-16T19:56:21.353
|
2011-05-17T19:46:07.083
|
2011-05-17T19:46:07.083
| 506,147 | 506,147 |
[
"entity-framework",
"entity-framework-4"
] |
6,022,687 | 1 | 6,023,708 | null | 0 | 1,317 |
I'm having an issue with Firefox. It displays differently in Windows than on OSX. It looks to be a font spacing issue, or font size, but I can't figure it out. Both use the exact same properties.
Top Window: Mac OSX, Bottom: WinXP

Here's the basic HTML/Computed Style:

Any ideas from anyone?
|
Firefox CSS spacing issues cross-os
|
CC BY-SA 3.0
| null |
2011-05-16T20:04:40.940
|
2011-05-16T21:32:55.787
|
2011-05-16T20:45:01.310
| 328,430 | 328,430 |
[
"css",
"firefox"
] |
6,022,906 | 1 | 6,023,076 | null | 0 | 83 |
I am developing ASP.NET MVC 3 music store site from the tutorial, Page 45.
When I am trying to install the EFCodeFirst I am getting the below error
Please help

|
Error while Indtalling EFCodeFirst
|
CC BY-SA 3.0
| null |
2011-05-16T20:22:39.033
|
2011-05-17T14:27:42.300
| null | null | 609,582 |
[
"asp.net-mvc-3",
"ef-code-first"
] |
6,022,884 | 1 | 6,023,289 | null | 2 | 6,646 |
I am fetching data from the following database:

I have arduino-box that send that data.
And display the data with this CSS & HTML code:
```
<div class="event">
<img src="http://dummyimage.com/80x70/f00/fff.png" alt="picture" />
<p>Room 2</p>
<p class="patient-name">Jon Harris</p>
<p class="event-text">This is a pixel. A flying pixel!</p>
<p class="event-timestamp">feb 2 2011 - 23:01</p>
</div>
.event {
display:block;
background: #ececec;
width:380px;
padding:10px;
margin:10px;
overflow:hidden;
text-align: left;
}
.event img {
display:block;
float:left;
margin-right:10px;
}
.event p {
font-weight: bold;
}
.event img + p {
display:inline;
}
.patient-name {
display:inline;
color: #999999;
font-size: 9px;
line-height:inherit;
padding-left: 5px;
}
.event-text{
color: #999999;
font-size: 12px;
padding-left: 5px;
}
.event-timestamp{
color: #000;
padding-left: 5px;
font-size: 9px;
}
```
Here is my PHP code:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DASHBOARD - Arduino 3</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php
$con = mysql_connect("localhost","*****","***");
if(!con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("arduino_db",$con);
$result = mysql_query("SELECT * FROM events");
//Start container
echo " <div id='background_container'> ";
while($row = mysql_fetch_array($result))
{
echo "<div class='event'>";
echo "<img src='img/ev_img/red.jpg' alt='picture' />";
echo "<p>" . $row['inneboende'] . "</p>";
echo "<p class='patient-name'>" . "$row['overvakare']" . "</p>";
echo "<p class='event-text'>" . "$row['handelse']" . "</p>";
echo "<p class='event-timestamp'>" . "$row['tid']" . "</p>";
echo "</div>";
}
//end container
echo "</div>"
mysql_close($con);
?>
</body>
</html>
```
The arduino box is sending data to the database.. lets say every 3sec. I dont want to press F5 every 5sec to get the new data. Should I use AJAX for this? I have read some AJAX on the net, but I haven´t find any good tuts for it.
|
fetching data from a database in realtime, with ajax?
|
CC BY-SA 3.0
| 0 |
2011-05-16T20:21:14.657
|
2011-05-16T20:53:13.253
| null | null | null |
[
"php",
"mysql",
"html",
"ajax",
"jquery"
] |
6,023,039 | 1 | 6,023,110 | null | 9 | 33,129 |
I was writing a small application and when I tried to create an ImageIcon I always got an exception. The exception was caused by this line of code:
```
prayerLevel.setIcon(new ImageIcon(getClass().getResource("/icons/icon_prayer.png")));
```
Now within my program, the folder /icons/ does exist. I don't know if it makes the difference but the class file is within a package, where as the icons folder is within the project folder (when you would see the bin and src folder).
I have looked around for a bit and I couldn't find a solution that could help me solve the problem. Perhaps any of you guys could help?
Edit: someone asked for my folder hierarchy:

I know the class file is not in the same folder as the icons are, but I've made applications where I had to load files from a different folder and doing /folder/ always used to work.
Edit 2:
```
System.out.println(getClass().getResource("/icons/icon_prayer.png") == null);
```
Prints true.
|
Java: NullPointerException from class.getResource( ... )
|
CC BY-SA 3.0
| 0 |
2011-05-16T20:32:50.807
|
2016-11-11T09:25:46.383
|
2011-05-16T20:47:28.643
| 754,161 | 754,161 |
[
"java",
"classpath"
] |
6,023,065 | 1 | 6,023,103 | null | 1 | 1,780 |
I have a simple form based on jquery -
```
<center>
<form id="form1">
<div id="registerDiv" data-role="fieldcontain" >
<input type="button" value="Register" id="registerButton" data-inline="true"/>
</div>
</form>
</center>
```
Id like to modify the form so that it has two background images, one background covers the button (number 1 in attachment - layout.png), the second is a background image that act as a border(number 2 in attachment - layout.png). What is the best method of achieving this ?
Thanks
|
Add background image and border image to form
|
CC BY-SA 3.0
| 0 |
2011-05-16T20:34:55.657
|
2011-05-16T20:41:52.603
| null | null | 701,254 |
[
"jquery",
"html",
"css",
"jquery-mobile"
] |
6,023,179 | 1 | 6,023,887 | null | 35 | 14,707 |
is there a way to plot anti-aliased graphics from the Windows version of R? As you can see from the two versions below the Mac version of R prints graphics anti aliased....

....whereas while the Windows version anti-aliases text, it does not anti-alias the actual graphic, as can be seen from the riser points, and the grid:

Here is the code by the way:
```
library(scatterplot3d)
attach(mtcars)
s3d <-scatterplot3d(wt,disp,mpg, pch=16, highlight.3d=TRUE,
type="h", main="3D Scatterplot")
fit <- lm(mpg ~ wt+disp)
s3d$plane3d(fit)
```
I need the highest quality possible, for web page publication. I am running Windows 7 and pulling data from RBloomberg, which only works under Windows.
|
Anti-aliasing in R graphics under Windows (as per Mac)
|
CC BY-SA 3.0
| 0 |
2011-05-16T20:44:58.963
|
2016-01-13T05:55:36.000
|
2011-05-16T20:51:11.630
| 122,792 | 122,792 |
[
"r",
"antialiasing"
] |
6,023,400 | 1 | 6,051,557 | null | 12 | 6,341 |
I'm trying to draw a subregion of a texture in OpenGL by specifying the coordinates I want. What's happening though is that, depending on the size of the image, it seems there's a slight offset in the origin of where it selects the texture coordinates. The offset amount seems to be less than the size of a pixel & the output is is blurred combination of neighboring pixels.
Here's an idea of what I'm describing. In this case I'd want to select the 6x5 green/white region but what OpenGL is rendering includes a slight pink tint to the top & left pixels.

What the output would look like:

I can fix it by adding an offset to the texture coordinates before passing them to glTexCoordPointer but the problem is that I have no way to calculate what the offset is and it seems different for different textures.
Pseudocode:
```
float uFactor = regionWidth / textureWidth; // For the example: 0.6f
float vFactor = regionHeight / textureHeight; // For the example: 0.5f
data[0].t[0] = 0.0f * uFactor;
data[0].t[1] = 0.0f * vFactor;
data[1].t[0] = 1.0f * uFactor;
data[1].t[1] = 0.0f * vFactor;
data[2].t[0] = 0.0f * uFactor;
data[2].t[1] = 1.0f * vFactor;
data[3].t[0] = 1.0f * uFactor;
data[3].t[1] = 1.0f * vFactor;
glPushMatrix();
// translate/scale/bind operations
glTexCoordPointer(2, GL_FLOAT, 0, data[0].t);
```
|
OpenGL ES Texture Coordinates Slightly Off
|
CC BY-SA 3.0
| 0 |
2011-05-16T21:02:26.823
|
2012-11-03T19:51:05.503
|
2011-05-16T21:35:19.380
| 38,258 | 38,258 |
[
"c++",
"opengl-es",
"textures"
] |
6,023,421 | 1 | 6,023,563 | null | 23 | 48,531 |
i'm new to django so i'm sorry for my newbie question
i have a model and i need to let user edit data inside it using django forms or any other way.

look at the image above , i want to show this form ready populated with the data and let user update it.
what is the best way to do this ?
EDIT : here is my views.py code
```
def exam_Edit(request,examName,number=0):
numner = int(number)
number = int(number)
questionNo = int(numner)
Myexam = models.Exam.objects.get(name = examName)
QuestionsAll = models.Question.objects.filter(exam = Myexam)
myQeustion = Question.objects.filter(exam = Myexam)[nextQuestion]
answer1 = models.Asnwers.objects.filter(question=myQeustion)[0]
answer2 = models.Asnwers.objects.filter(question=myQeustion)[1]
answer3 = models.Asnwers.objects.filter(question=myQeustion)[2]
answer4 = models.Asnwers.objects.filter(question=myQeustion)[3]
# HERE IS MY PROBLEM : the line below creates a form with a data but it doesn't save it to the save object
form = QuestionsEditForm(initial = {'questionText':myQeustion.__unicode__() , 'firstChoiceText':answer1.__unicode__(),'secondChoiceText':answer2.__unicode__(),'thirdChoiceText':answer3.__unicode__(),'forthChoiceText':answer4.__unicode__()})
if request.method =='POST':
#if post
if form.is_valid():
questionText = form.cleaned_data['questionText']
Myexam = Exam.objects.get(name = examName)
myQeustion.questionText = form.cleaned_data['questionText']
answer1.answerText = form.cleaned_data['firstChoiceText']
answer1.save()
answer2.answerText = form.cleaned_data['secondChoiceText']
answer2.save()
answer3.answerText = form.cleaned_data['thirdChoiceText']
answer3.save()
answer4.answerText = form.cleaned_data['forthChoiceText']
answer4.save()
variables = RequestContext(request, {'form':form,'examName':examName,'questionNo':str(nextQuestion)})
return render_to_response('exam_edit.html',variables)
```
please help
|
how to edit model data using django forms
|
CC BY-SA 3.0
| 0 |
2011-05-16T21:05:03.383
|
2015-04-15T17:25:02.260
|
2011-05-16T21:26:00.673
| 222,829 | 222,829 |
[
"python",
"django",
"django-forms"
] |
6,023,549 | 1 | 6,130,915 | null | 19 | 38,773 |
If i have an ImageView that fills the screen.
The ImageView background is set to green color.
I place a bitmap in the ImageView, keeping bitmap proportions.
A portrait photo in this layout will show green on both left and right side
(Phone orientation= portrait).
Now, How do i get the left side x/y position of the edge when the green ends and bitmap begins.
The background for this endeavor project is that i want to write text on the image and save the image back to a new image with the text. The problem is..
Since I scale the image inSampleSize = 4; and the ImageView shrinking it even more, saving this new picture will give a small small approx 250x350 image.
What i want is to use the x/y positions and transfer the written text to the original inSampleSize = 4 image or to the sdcard 1500x3000 image
I know and read other questions about this that i have to "Do the math calculations" myself
I just need this small answer.
I forgot i can take a screenshot to clarify.
this is what it look like: (I get a new pen on pressing the button "pen" each pen hold its own unique text and position on the screen

Here is the imageview
```
import java.util.HashMap;
import java.util.UUID;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.util.AttributeSet;
import android.view.Display;
import android.view.MotionEvent;
import android.widget.EditText;
import android.widget.ImageView;
public class DrawView2 extends ImageView {
private HashMap<String, ColorBall2> HashBall ;
private String balID = ""; // variable to know what ball is being dragged
public final String PTPPSERVICE_DERECTORY = "/PTPPservice/";
private Bitmap bitmap;
private EditText ed;
private Paint paint = new Paint();
private Paint paint2 = new Paint();
private Paint pTouch = new Paint();
private EditText addtext;
private Context ctx;
private String imagePath;
private boolean removeBall = false;
int viewWidth = 0;
int viewHeight = 0;
double bitmapHight =0;
double bitmapWidth =0;
double ratio =0;
double startX = 0;
double endX= 0;
double startY= 0;
double endY = 0;
public DrawView2(Context context, AttributeSet atts,String image1) {
super(context, atts);
this.ctx = context;
this.imagePath = image1;
setFocusable(true);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setColor(Color.BLACK);
paint.setTypeface(Typeface.DEFAULT_BOLD);
paint2.setStyle(Paint.Style.FILL_AND_STROKE);
paint2.setColor(Color.RED);
addtext = (EditText) ((Activity) ctx).findViewById(R.id.edittextaddtext);
String filePath = Environment.getExternalStorageDirectory().toString() + imagePath;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
bitmap = BitmapFactory.decodeFile(filePath,options);
// SAVE RATIO
int x = bitmap.getWidth();
int y = bitmap.getHeight();
if(y>x)
ratio = ((double)y)/x;
if(x>y)
ratio = ((double)x)/y;
if(y==x)
ratio = 1;
Drawable bit = new BitmapDrawable(bitmap);
setImageDrawable(bit);
}
public double getRatio() {
return ratio;
}
public HashMap<String, ColorBall2> getHashBall() {
return HashBall;
}
// RETURN THE ON SCREEN RESIZED BITMAP
public double getOnScreenBitmapHight(){
return bitmapHight;
}
public double getOnScreenBitmapWidth(){
return bitmapWidth;
}
// BITMAP SIZE
public int getBitmapHight(){
return bitmap.getHeight();
}
public int getBitmapWidth(){
return bitmap.getWidth();
}
// GET IMAGEVIEW HIGHT WIDTH
public int getViewWidth() {
return viewWidth;
}
public int getViewHeight() {
return viewHeight;
}
// START END X Y
public double getStartX() {
return startX;
}
public double getEndX() {
return endX;
}
public double getStartY() {
return startY;
}
public double getEndY() {
return endY;
}
// SET BALL TEXT
public void addTextToBall(String text) {
if(balID != "")
HashBall.get(balID).setText(text);
}
// PATH
public String getImagePath() {
return imagePath;
}
// THE ORIGINAL INSAMPELSIZE=4 BITMAP
public Bitmap getBitmap() {
return bitmap;
}
// STOP DRAWAING THE BALL
public void removeBall(boolean value) {
removeBall = value;
}
// THE RECT THAT RETURN WRONG VALUE
public Rect getRect(){
Rect r = getDrawable().copyBounds();
int drawLeft = r.left;
int drawTop = r.top;
int drawRight = r.right;
int drawBottom = r.bottom;
return r;
}
@Override
protected void onSizeChanged(int xNew, int yNew, int xOld, int yOld){
super.onSizeChanged(xNew, yNew, xOld, yOld);
viewWidth = xNew;
viewHeight = yNew;
}
public void addBall(){
// HERE I TRY TO CALCULATE THE BOUNDS LEFT,RIGHT,TOP AND BOTTOM EDGE OF THE BITMAP
//NOT GOING THAT GOOD
if(HashBall == null)
HashBall = new HashMap<String,ColorBall2>();
//X
double drawAbleWidth = viewWidth/ratio;
startX = (viewWidth-drawAbleWidth)/2;
double drawAbleHight = viewHeight/ratio;
startY = drawAbleHight/2;
int ballY = (viewHeight/2);
int ballX = (viewWidth/2);
Point point1 = new Point();
point1.x = (int) ballX;
point1.y = (int) ballY;
String uuId = UUID.randomUUID().toString();
HashBall.put(uuId,(new ColorBall2(ctx,R.drawable.pen1, point1,uuId)));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//canvas.drawCircle(10,10,10,null);
if(!removeBall && HashBall != null){
for (String key : HashBall.keySet()) {
//System.out.println("Key: " + key + ", Value: " + map.get(key));
if(addtext!=null)
//canvas.drawCircle(HashBall.get(key).getX(), HashBall.get(key).getY(), 10, paint2);
canvas.drawBitmap(HashBall.get(key).getBitmap(), HashBall.get(key).getX()-10, HashBall.get(key).getY()-80, null);
canvas.drawText (HashBall.get(key).getText() + " X="+HashBall.get(key).getX() + " Y="+HashBall.get(key).getY()
, HashBall.get(key).getX(), HashBall.get(key).getY(), paint);
}
}
}
// events when touching the screen
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX();
int Y = (int)event.getY();
switch (eventaction )
{
case MotionEvent.ACTION_DOWN: // touch down so check if the finger is on a ball
balID = "";
for (String key : HashBall.keySet()) {
// check if inside the bounds of the ball (circle)
// get the center for the ball
int centerX = HashBall.get(key).getX() + 15;
int centerY = HashBall.get(key).getY() + 15;
// calculate the radius from the touch to the center of the ball
double radCircle = Math.sqrt( (((centerX-X)*(centerX-X)) + (centerY-Y)*(centerY-Y)));
// if the radius is smaller then 23 (radius of a ball is 22), then it must be on the ball
if (radCircle < 33){
balID = HashBall.get(key).getID();
addtext.setText(HashBall.get(key).getText());
break;
}
}
break;
case MotionEvent.ACTION_MOVE: // touch drag with the ball
// move the balls the same as the finger
if (balID != "") {
HashBall.get(balID).setX(X-25);
HashBall.get(balID).setY(Y-25);
}
break;
case MotionEvent.ACTION_UP:
// touch drop - just do things here after dropping
break;
}
// redraw the canvas
invalidate();
return true;
}
}
```
|
android - how to get the image edge x/y position inside imageview
|
CC BY-SA 3.0
| 0 |
2011-05-16T21:16:19.810
|
2019-10-03T07:15:32.703
|
2011-05-19T17:39:02.060
| 538,837 | 538,837 |
[
"android",
"imageview"
] |
6,023,598 | 1 | 6,025,580 | null | 4 | 1,964 |
Ok ( the title may be misleading ) however it is the best i can come up with.
What we want to achieve ?
Ok we have an svg map, of Australia.
On click of a state on that map, the map state changes colour to selected. ( in our case Pink )
At the same time ( a useless button ) which is on page load blank, changes its value to that of the state.
Simultaneously a drop down menu, with the state names in, which on page load has the value , Please Select , changes its value to that of the state.
So : here is what happens.
User visits page and sees map. They also see drop down select box.
They can choose to either click the select dropdown, or click the map.
Scenario 1.
They click the map, and click on the state QUEENSLAND , which has a value of QLD.
On clicking the state, the state changes from grey to .
The select drop down, changes from Please select, to
The gray button changes from blank to
Here is an image:

Ok what we have working is.
The map click events work, and propagate the grey button values, so thats all fine.
The select element works, in so far as if we select a state on the map it changes select box value.
What we dont have working is.
1. on click of map, we cannot propagate BOTH the select drop down and the gray button values.
2. we cannot on using the select drop down box, change the "select" state of the map , ie, doesnt change from grey to pink. Also it doesnt change the value of the button from its current value.
So here is some code:
Its SVG so here is the wrap element for the map.
```
<a xlink:href="javascript:void goToOption(document.australia.state,'WA')" target="_top">
<path
id="WA"
class="territory"
fill="#a9a9a9"
onmouseup="clickTerritory(evt)"
d="m 38.318056,168.24244 c -4.79245,0.99662 -8.64245,1.61598 l -7,1.12612 -8.18526,4.91727 -8.18526,4.91727 -5.31474,-0.0902 c -2.92311,-0.0496 -6.88974,-0.54005 -8.81474,-1.08988 z"/></a>
```
Here is the JS that controls the map click events:
```
function prepare(){}
function ready(){
svgdoc = document.sv.getSVGDocument();
svgRoot = svgdoc.documentElement;
}
function onTerritoryClick(territory){
document.getElementById("territory-name").innerHTML=territory;
}
var selected_territory = "None";
function init(evt) {
if (window.svgDocument == null)
{
svgDocument = evt.target.ownerDocument;
}
}
function clickTerritory(evt) {
var clicked_territory;
if (evt.target.parentNode.getAttributeNS(null, "id") != "australia-map")
{
// Hack to deal with groups
clicked_territory = evt.target.parentNode;
} else {
clicked_territory = evt.target;
}
if (selected_territory != clicked_territory) {
if (selected_territory != "None") {
// Unselect previous territory
selected_territory.setAttributeNS(null, "fill", "#a9a9a9");
}
selected_territory = clicked_territory;
selected_territory.setAttributeNS(null, "fill", "#ec008c");
top.onTerritoryClick(selected_territory.getAttributeNS(null, "id"));
}
}
```
Here is the JS to handle the select box, which fires the href.
```
function goToOption(sel, val) {
var opt, o = 0;
while (opt = sel[o++]) if (opt.value == val) sel.selectedIndex = o - 1;
}
```
Here is the button html:
```
<div class="selected-state left">
<button id="territory-name" class="mystate grayNohover button" style="position:absolute;top:250px;left:50px">ALL</button>
</div>
```
Here is the select menu html:
```
<select name="state" id="speedF" style="width:180px;">
<option value="">Please Select</option>
<option value="QLD">Queensland</option>
<option value="NT">Northern Territory</option>
<option value="WA">Western Australia</option>
<option value="SA">South Australia</option>
<option value="NSW">New South Wales</option>
<option value="VIC">Victoria</option>
<option value="ACT">A.C.T.</option>
<option value="TAS">Tasmania</option>
</select>
```
sample: [http://sitehelp.com.au/demos/svgmap2/](http://sitehelp.com.au/demos/svgmap2/)
Version 2: [http://dev.30.com.au/422-svg/](http://dev.30.com.au/422-svg/)
|
Complex JS onclick events from multiple elements
|
CC BY-SA 3.0
| null |
2011-05-16T21:21:11.597
|
2011-05-17T02:34:24.097
|
2011-05-16T21:45:56.047
| 501,173 | 501,173 |
[
"javascript"
] |
6,023,643 | 1 | 6,023,684 | null | 3 | 1,228 |

How can I make the cursor start at the top left of the JTextField? The text just stays centered when I adjust the height with .setPreferredSize(). Here is the code for the fields and buttons.
```
public class GUIWindow extends JFrame{
private JTextField inputBox = new JTextField(20);
private JTextField outputBox = new JTextField(20);
private JButton encodeButton = new JButton("Encode");
private JButton decodeButton = new JButton("Decode");
public GUIWindow(){
JPanel mainPanel = new JPanel(new FlowLayout());
outputBox.setPreferredSize(new Dimension(80, 80));
inputBox.setPreferredSize(new Dimension(80, 80));
outputBox.setEditable(false);
mainPanel.add(inputBox);
mainPanel.add(encodeButton);
mainPanel.add(decodeButton);
mainPanel.add(outputBox);
Container container = getContentPane();
container.add(mainPanel);
}
}
```
|
How to make the cursor in a JTextField span multiple rows in FlowLayout?
|
CC BY-SA 3.0
| null |
2011-05-16T21:26:14.403
|
2011-05-16T21:32:40.533
|
2011-05-16T21:32:40.533
| 714,968 | 737,188 |
[
"java",
"swing",
"jtextfield",
"flowlayout"
] |
6,023,689 | 1 | 6,024,586 | null | 0 | 123 |
Several days i mused about the three-folded job of
a. getting
b. parsing
c. storing a number of pages.
Two days ago i thought that getting the pages would be the major-task. No this isnt the case - i guess that the parser-job would be a heroic task. Each of the pages that are intended to be parsed is a png-image.
So the question is - after getting all them. How to parse them!? This seems to be the issue. Guess that there are some perl-modules out there - that can help in doing this...
Well - i think that this job only can be done with some OCR embedded! Question: is there a perl-module that can be use here to support this task:
BTW: see the result-pages.

BTW;: and as i thought i can find all 790 resultpages within a certain range between
Id= 0 and Id= 100000 i thought, that i can go the way with a loop:
[http://www.foundationfinder.ch/ShowDetails.php?Id=11233&InterfaceLanguage=&Type=Html](http://www.foundationfinder.ch/ShowDetails.php?Id=11233&InterfaceLanguage=&Type=Html)
[http://www.foundationfinder.ch/ShowDetails.php?Id=927&InterfaceLanguage=1&Type=Html](http://www.foundationfinder.ch/ShowDetails.php?Id=927&InterfaceLanguage=1&Type=Html)
[http://www.foundationfinder.ch/ShowDetails.php?Id=949&InterfaceLanguage=1&Type=Html](http://www.foundationfinder.ch/ShowDetails.php?Id=949&InterfaceLanguage=1&Type=Html)
[http://www.foundationfinder.ch/ShowDetails.php?Id=20011&InterfaceLanguage=1&Type=Html](http://www.foundationfinder.ch/ShowDetails.php?Id=20011&InterfaceLanguage=1&Type=Html)
[http://www.foundationfinder.ch/ShowDetails.php?Id=10579&InterfaceLanguage=1&Type=Html](http://www.foundationfinder.ch/ShowDetails.php?Id=10579&InterfaceLanguage=1&Type=Html)
i thought i can go the Perl-Way but i am not very very sure:
I was trying to use LWP::UserAgent on the same URLs [see below]
with different query arguments, and i am wondering if LWP::UserAgent provides a
way for us to loop through the query arguments? I am not sure that LWP::UserAgent has a method for us to do that. Well - i sometimes heard that it is easier to use Mechanize. But is it really easier!?
But - to be frank; The is not very difficult - if we compare this task with ... How !?
Any ideas - suggestions -
look forward to hear from you...
zero
|
parsing an image in order to get the information out of it
|
CC BY-SA 3.0
| null |
2011-05-16T21:30:39.280
|
2011-05-16T23:29:17.067
|
2011-05-16T21:50:36.533
| 479,863 | 525,865 |
[
"mysql",
"perl",
"image",
"ocr"
] |
6,023,804 | 1 | null | null | 3 | 3,468 |
Seems a simple upload file link I have on a website is grayed out and not working/allowing user to click it to upload a file on the iPad.
> 
|
Web page upload file not working on iPad
|
CC BY-SA 3.0
| 0 |
2011-05-16T21:44:20.093
|
2015-06-15T23:47:10.407
|
2014-05-21T13:29:41.733
| 996,493 | 151,438 |
[
"ipad"
] |
6,024,223 | 1 | 6,024,379 | null | 5 | 479 |
[Mixed Effects Models in S and S-Plus](http://books.google.com/books?id=y54QDUTmvDcC&printsec=frontcover#v=onepage&q&f=false)[238](http://books.google.com/books?id=y54QDUTmvDcC&printsec=frontcover&dq=pinheiro+bates&hl=en&ei=I6LRTauWDIXagQeq4byxDA&sa=X&oi=book_result&ct=result&resnum=1&ved=0CCoQ6AEwAA#v=onepage&q=corSpher&f=false)
---


---
```
library(nlme)
spatDat <- data.frame(x = c(0,0.25,0.5,0.75,1), y = c(0,0.25,0.5,0.50,0.75))
cs1Exp <- corExp(1, form = ~x+y)
cs1Exp <- initialize(cs1Exp, spatDat)
```
```
Error in getClass(Class) :
c("\"corExp\" is not a defined class", "\"corSpatial\" is not a defined class", "\"corStruct\" is not a defined class")
In addition: Warning message:
In if (!is.na(match(Class, .BasicClasses))) return(newBasic(Class, :
the condition has length > 1 and only the first element will be used
```
---
```
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-linux-gnu (64-bit)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nlme_3.1-101
loaded via a namespace (and not attached):
[1] grid_2.13.0 lattice_0.19-26
```
|
Why do I get an error when I try to model autocorrelation, even when exactly following this example in Pinheiro and Bates (2009)?
|
CC BY-SA 3.0
| null |
2011-05-16T22:36:34.483
|
2011-05-17T16:04:33.650
|
2011-05-16T22:53:35.147
| 199,217 | 199,217 |
[
"r"
] |
6,024,566 | 1 | null | null | 1 | 580 |
I'm trying to test an app on a 3G with 4.2.1 installed, but I'm unable to select the device in the scheme in Xcode (4.0.2). The app is built on the 4.3 SDK, but targeted for deployment to 4.2.

Any ideas?
|
Device selection disabled in Xcode 4, green light in organizer
|
CC BY-SA 3.0
| null |
2011-05-16T23:26:38.860
|
2011-05-17T18:56:14.040
|
2017-02-08T14:32:13.150
| -1 | 3,279 |
[
"xcode",
"ios",
"ios4"
] |
6,024,590 | 1 | 6,024,789 | null | 0 | 107 |
I'm trying to get PHP to echo this:
```
http://production.shippingapis.com/ShippingAPI.dll?API=TrackV2&XML=<TrackRequest USERID=\"123456\"><TrackID ID=".$trackno."></TrackID></TrackRequest>";
```
However, when I open this page in my browser (FF4), only this shows up:
```
http://production.shippingapis.com/ShippingAPI.dll?API=TrackV2&XML=
```
The browser thinks that onwards is part of a XML document so it does not render it, as shown here:

(parts blanked out for obvious reasons :D)
How do I fix this issue?
Thanks!
|
How to keep XML in URLs from being interpreted?
|
CC BY-SA 3.0
| null |
2011-05-16T23:29:36.563
|
2011-05-17T00:01:07.393
|
2011-05-16T23:34:51.433
| 476 | 622,481 |
[
"php",
"xml",
"echo"
] |
6,024,671 | 1 | null | null | 113 | 266,722 |
When I ran:
```
brew update
```
I got a message saying it initialized an empty repository in `/usr/local/.git/`, then I got this error:

|
How do I update Homebrew?
|
CC BY-SA 3.0
| 0 |
2011-05-16T23:41:54.050
|
2021-05-05T14:10:48.503
|
2016-04-07T22:23:41.090
| 128,421 | 528,576 |
[
"git",
"homebrew"
] |
6,024,742 | 1 | null | null | 1 | 11,848 |
I am programming for my End Project an application that should have VoIP capabilities. I have started testing with the new SIP API that android 2.3 includes. The problem is that I am actually living in a student's dormitory, so I am connected to the internet through the building's proxy and it seems to have a strict firewall that doesn't let anything pass.
I have tried several free SIP servers and clients and the result is always the same: from my UAC I can see if other clients are online, I even can send text messages, but it is impossible to establish an actual call. I never get any response from the client called. Using a Linphone client I can't even connect to the SIP server to authenticate.
The thing is, that it seems I cannot make calls outside my building, but I have successfully contacted a Linphone client installed on my PC from another Linphone client installed on an emulator. Apparently I can make calls inside my local network without any SIP server, just by using the local address of the receiver instead of its SIP domain.


The question is: Can I do the same with the new android 2.3 SIP API? Can I make a call just by calling the receiver's local address, without the necessity of authenticate with any SIP server outside my building?
As my application is for demonstration purposes, this will be enough for me. I have been looking for a solution to this problem during the past three days but I haven't come up with anything useful. :/
Thanks in advance.
|
Direct SIP call to IP
|
CC BY-SA 3.0
| 0 |
2011-05-16T23:53:25.873
|
2022-12-20T19:05:10.730
|
2011-05-17T01:52:18.013
| 318,465 | 756,533 |
[
"android",
"ip",
"call",
"sip"
] |
6,024,800 | 1 | 6,024,883 | null | 9 | 94,223 |
I want to display both the user table and users_profiles table in 1 table :
I want to link them both so that usrpID = usrID,
Before this process I tried displaying only users table using this code and it works great.
Controller:
```
$data['query'] = $this->db->query('SELECT * FROM users_profiles');
$this->load->view('users/users_view',$data);
```
View:
```
<?php foreach($query->result_array() as $row): ?>
<tr class="even gradeC">
<td><?php echo $row['usrID']</td>
<td><?php echo $row['usrName'];?></td>
</tr>
<? endforeach; ?>
```
but when I try to join two tables, it returns me an error: this is my code
```
$this->db->select('users.usrID, users_profiles.usrpID');
$this->db->from('users', 'users_profiles');
$this->db->join('users', 'users.usrID = users_profiles.usrpID');
$result = $this->db->get();
```
users table has fields like username,password, etc. and every user has his own profile in users_profiles table

I tried selecting the fields but when I tried this
```
<td><?php echo $row['usrID'];?></td>
<td><?php echo $row['usrName'];?></td>
<td><?php echo $row['usrpFirstName'].' '.$row['usrpLastName'];?></td>
<td><?php echo $row['usrpBday'];?></td>
<td><?php echo $row['usrpSex'];?></td>
<td><?php echo $row['usrpAddress'];?></td>
```
it returns me the first value in users profiles in which it should not
|
codeigniter table join
|
CC BY-SA 3.0
| 0 |
2011-05-17T00:02:57.003
|
2017-09-26T08:07:08.647
|
2017-07-19T07:40:08.460
| 4,370,109 | 464,425 |
[
"codeigniter",
"join",
"html-table"
] |
6,024,840 | 1 | 6,025,218 | null | 6 | 5,250 |
I am using SpringSource Tool Suite (essentially Eclipse Helios ++) and I just started using Subversive. I've been using all of the tools except Subversive for quite a while and I've never seen these red arrow icons before (or are these called "adornments"?), so I suspect Subversive is the source, but I can't find anything on line that says what they mean.

|
What does the red arrow pointing up and right mean in the Package Explorer in Eclipse?
|
CC BY-SA 3.0
| null |
2011-05-17T00:09:02.760
|
2011-05-17T01:05:27.520
| null | null | 316,745 |
[
"eclipse",
"svn",
"subversive",
"sts-springsourcetoolsuite"
] |
6,025,069 | 1 | 6,025,201 | null | 0 | 274 |
I have successfully created a UITableView/UITableViewCell that is able to slide up and down and adjusting the height to show options. To see what this means, I have created a video [here](http://www.screenr.com/EUy). The code is as follows:
```
- (void)swipe:(UISwipeGestureRecognizer *)recognizer direction:(UISwipeGestureRecognizerDirection)direction
{
if (recognizer && recognizer.state == UIGestureRecognizerStateEnded)
{
// Get the table view cell where the swipe occured
CGPoint location = [recognizer locationInView:self.tableView];
NSIndexPath* indexPath = [self.tableView indexPathForRowAtPoint:location];
MyCell* cell = (MyCell *) [self.tableView cellForRowAtIndexPath:indexPath];
[self.tableView beginUpdates];
//removing the options view at the other cell before adding a new one
if (global != nil && global.row != indexPath.row){
[sideSwipeView removeFromSuperview];
sideSwipeView = nil;
}
//options already exist, we need to remove it
if (sideSwipeView != nil){
[sideSwipeView removeFromSuperview];
sideSwipeView = nil;
slide = NO;
} else {
//options do not exist and therefore we need to add it
NSArray * buttonData = [[NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:@"Mark Read", @"title", @"mark.png", @"image", nil],
[NSDictionary dictionaryWithObjectsAndKeys:@"Track", @"title", @"play.png", @"image", nil],
nil] retain];
NSMutableArray * buttons = [[NSMutableArray alloc] initWithCapacity:buttonData.count];
sideSwipeView = [[UIView alloc] initWithFrame:CGRectMake(0, cell.frame.size.height-25, 320, 25)];
[sideSwipeView setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
[sideSwipeView setBackgroundColor:[UIColor colorWithPatternImage: [UIImage imageNamed:@"dotted-pattern.png"]]];
[sideSwipeView setTag:-10];
CGFloat leftEdge = BUTTON_LEFT_MARGIN;
for (NSDictionary* buttonInfo in buttonData)
{
if (!([[buttonInfo objectForKey:@"title"] isEqualToString:@"Mark Read"] && [[[topics objectAtIndex:indexPath.row] unread] intValue] == 0))
{
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin;
UIImage* buttonImage = [UIImage imageNamed:[buttonInfo objectForKey:@"image"]];
if ([[topics objectAtIndex:indexPath.row] tracked] && [[buttonInfo objectForKey:@"title"] isEqualToString:@"Track"]){
buttonImage = [UIImage imageNamed:@"pause.png"];
[button setSelected:YES];
} else {
[button setSelected:NO];
}
button.frame = CGRectMake(leftEdge, 0, buttonImage.size.width, buttonImage.size.height);
UIImage* grayImage = [self imageFilledWith:[UIColor colorWithWhite:0.9 alpha:1.0] using:buttonImage];
[button setImage:grayImage forState:UIControlStateNormal];
if ([[buttonInfo objectForKey:@"title"] isEqualToString:@"Mark Read"]){
[button addTarget:self action:@selector(markRead:) forControlEvents:UIControlEventTouchUpInside];
} else if ([[buttonInfo objectForKey:@"title"] isEqualToString:@"Track"]){
[button addTarget:self action:@selector(track:) forControlEvents:UIControlEventTouchUpInside];
}
[button setTag:indexPath.row];
[buttons addObject:button];
[sideSwipeView addSubview:button];
leftEdge = leftEdge + buttonImage.size.width + BUTTON_SPACING;
}
}
[cell.contentView addSubview:sideSwipeView];
[sideSwipeView release];
global = indexPath;
slide = YES;
}
[self.tableView endUpdates];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
```
However, I am not confident that the code is memory correct (i.e: ther's no memory leak and I am not misusing anything). I am mostly not confident in the alloc, dealloc, and setting it up to nil. I think the others are fine. Can someone give me any pointers?
Profiler result:

|
are there any memory leaks in this code?
|
CC BY-SA 3.0
| null |
2011-05-17T00:44:32.717
|
2011-05-17T07:05:18.737
|
2011-05-17T01:06:59.997
| 95,265 | 95,265 |
[
"iphone",
"objective-c",
"memory"
] |
6,025,156 | 1 | null | null | 2 | 844 |
Do you know if an emboss effect like this can be done with a programming package. Can someone suggest something

|
How to make this image effect, any library that can help with it
|
CC BY-SA 3.0
| null |
2011-05-17T00:55:37.823
|
2011-05-18T00:29:58.163
| null | null | 710,316 |
[
"php",
"image-processing",
"imagemagick",
"image-manipulation",
"gd"
] |
6,025,252 | 1 | 6,025,481 | null | 4 | 2,583 |
I'm looking for the best way of implementing random number generator, that will allow me to have control over probability from what range the generated number will be returned. To visualize what I'm trying to achieve I have a picture :

So to summarize :
Let's say that my range is 400. At the beginning I'd like to have 5% probability of getting number 0-20. But at some moment in time I'd like to have this probability increased up to 50%. Hope you get the idea.
|
Different probability for ranges of random numbers
|
CC BY-SA 3.0
| 0 |
2011-05-17T01:15:56.823
|
2012-07-24T01:31:44.990
| null | null | 255,494 |
[
"javascript",
"random",
"distribution",
"probability"
] |
6,026,194 | 1 | null | null | 0 | 645 |
Hi I have a spinner, which contains radio button elements. My spinner loads the elements, but everything is invisible. I think you can understand my situation from the image. an I get any suggestions.
This is the code I am using,
```
String[] reminder={"5 minutes","10 minutes","15 minutes","20 minutes","25 minutes","30 minutes","35 minutes","45 minutes"};
spinnerAdapter = new ArrayAdapter<String>(mContext,
android.R.layout.simple_spinner_item, reminder);
spinnerAdapter
.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
reminder_spinner.setPrompt("Reminders");
reminder_spinner.setAdapter(spinnerAdapter);
reminder_spinner.setOnItemSelectedListener(new ItemSelect());
```
|
My spinner items are invisble
|
CC BY-SA 3.0
| null |
2011-05-17T04:18:55.040
|
2012-08-03T04:25:16.870
| null | null | 603,744 |
[
"android",
"spinner"
] |
6,026,420 | 1 | 6,027,817 | null | 11 | 18,449 |
I want to place a symbol o a Map. E.g.

So far I have used OpenLayers with `OpenLayers.Layer.Markers`. The code looks like this:
```
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayer(layer);
map.setCenter(
new OpenLayers.LonLat({{ location.lon }}, {{ location.lat }}).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 15);
var lonLat = new OpenLayers.LonLat({{ location.lon }}, {{ location.lat }})
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(lonLat));
```
This works as excepted and shows the map above. But I can't get it to work with Vectors replacing the last 3 lines with:
```
vectors = new OpenLayers.Layer.Vector("Vector Layer");
vectors.addFeatures([new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonLat))]);
map.addLayer(vectors);
```
Is there any special magic needed to use `OpenLayers.Feature.Vector`?
|
Openlayers: Vector Features instead of Markers
|
CC BY-SA 3.0
| 0 |
2011-05-17T04:59:18.443
|
2011-05-18T07:14:47.540
| null | null | 49,407 |
[
"openlayers"
] |
6,026,377 | 1 | 6,026,430 | null | 9 | 2,090 |
I have been working on a college C assignment, and have been trying to make sense of a bug I seem to be having with my code. Basically, it seems like something is wrong with my pointers (and or memory allocation).
This assignment is primarily about linked lists, so the structs contain pointers to the next element in the list. Obviously, to traverse the list until I find that the current element has a NULL pointer to the next element (and then I change that to be the pointer to the 'new' element I want to add.
The problem I have though, is for some reason my code seems to be completely screwing with my memory pointers, because they're getting garbled somehow. They seem fine for moment but very soon go rubbish.
Here is what my watches in XCode's debugger are showing me:

The first circle shows me the values as the first element in the list, which as far as I can tell are initially set correctly, and should be "C0001\0". The second circle shows the `current->nextCategory` pointer which should be NULL (0x0) but instead show that weird memory address (look at the size of it!). I assume that these problems are related, but as I am new to C, I don't know how or why.
In either case, when I check `current->nextCategory != NULL` in my while statement, it throws EXC_BAD_ACCESS:

I've spent the past few hours pulling my hair out becasue I cannot work out what the heck is happening to my program. Am I doing something wrong with my pointers, or using `malloc()` improperly?
Here is the relevant part of my program:
```
/****************************************************************************
* Initialises the system to a safe empty state.
****************************************************************************/
void systemInit(GJCType* menu)
{
if (menu == NULL) {
fprintf(stderr, "can't initialize system with a null menu pointer.\n");
exit(EXIT_FAILURE);
}
menu->headCategory = NULL;
menu->numCategories = 0;
}
/****************************************************************************
* Loads all data into the system.
****************************************************************************/
int loadData(GJCType* menu, char* menuFile, char* submenuFile)
{
FILE *fp;
size_t len;
char *line;
char *buffer;
CategoryTypePtr category_p;
ItemTypePtr item_p;
char *catId;
if (menu == NULL)
return FALSE;
fp = fopen(menuFile, "r");
if(fp == NULL) {
fprintf(stderr, "can't open %s\n", menuFile);
return FALSE;
}
buffer = malloc(MAX_BUFFER_SIZE);
len = MAX_BUFFER_SIZE;
catId = malloc(ID_LEN + 1);
while((buffer = fgetln(fp, &len))) {
line = strtok(buffer, "\n\0");
category_p = malloc(sizeof(CategoryTypePtr));
if (!tokenizeCategory(line, category_p)) {
fprintf(stderr, "can't tokenize category:> %s\n", line);
free(category_p);
category_p = NULL;
free(buffer);
free(catId);
return FALSE;
}
pushCategory(menu, category_p);
free(category_p);
category_p = NULL;
}
fp = fopen(submenuFile, "r");
if(fp == NULL) {
fprintf(stderr, "can't open %s\n", submenuFile);
return FALSE;
}
while((buffer = fgetln(fp, &len))) {
line = strtok(buffer, "\n\0");
item_p = malloc(sizeof(ItemTypePtr));
if (!tokenizeItem(line, item_p, catId)) {
fprintf(stderr, "can't tokenize item:> %s\n", line);
free(item_p);
item_p = NULL;
free(buffer);
free(catId);
return FALSE;
}
category_p = findCategory(menu, catId);
pushItem(category_p, item_p);
free(item_p);
item_p = NULL;
}
free(buffer);
free(catId);
return TRUE;
}
void pushItem(CategoryTypePtr category, ItemTypePtr item)
{
ItemTypePtr current;
ItemTypePtr new;
if ((new = malloc(sizeof(ItemTypePtr))) == NULL) {
fprintf(stderr, "can't malloc enough memory for new item pointer.\n");
exit(EXIT_FAILURE);
}
*new = *item;
if (category->headItem == NULL) {
category->headItem = new;
} else {
current = category->headItem;
while (current->nextItem != NULL) {
current = current->nextItem;
}
current->nextItem = new;
}
category->numItems++;
}
void pushCategory(GJCType* menu, CategoryTypePtr category)
{
CategoryTypePtr current;
CategoryTypePtr new;
if ((new = malloc(sizeof(CategoryTypePtr))) == NULL) {
fprintf(stderr, "can't malloc enough memory for new category pointer.\n");
exit(EXIT_FAILURE);
}
*new = *category;
if (menu->headCategory == NULL) {
menu->headCategory = new;
} else {
current = menu->headCategory;
while (current->nextCategory != NULL) {
current = current->nextCategory;
}
current->nextCategory = new;
}
menu->numCategories++;
}
CategoryTypePtr findCategory(GJCType* menu, char* id)
{
CategoryTypePtr current;
current = menu->headCategory;
while (current != NULL) {
if (!strcmp(current->categoryID, id))
return current;
current = current->nextCategory;
}
return NULL;
}
/* This function takes the character delimited string and converts it into
* a category structure at the location of the category pointer supplied.
*/
int tokenizeCategory(char *data, CategoryTypePtr category)
{
char* buffer;
if (category == NULL || strlen(data) < 1)
return FALSE;
buffer = malloc(MAX_BUFFER_SIZE);
strcpy(buffer, data);
strcpy(category->categoryID, strtok(buffer, "|\n"));
category->drinkType = *(strtok(NULL, "|\n"));
strcpy(category->categoryName, strtok(NULL, "|\n"));
strcpy(category->categoryDescription, strtok(NULL, "|\n"));
category->numItems = 0;
category->nextCategory = NULL;
category->headItem = NULL;
free(buffer);
return TRUE;
}
/* This function takes the character delimited string and converts it into
* an item structure at the location of the item pointer supplied.
*/
int tokenizeItem(char *data, ItemTypePtr item, char* categoryId)
{
char* buffer;
int i;
if (item == NULL || strlen(data) < 1)
return FALSE;
buffer = malloc(MAX_BUFFER_SIZE);
strcpy(buffer, data);
strcpy(item->itemID, strtok(buffer, "|\n"));
strcpy(categoryId, strtok(NULL, "|\n"));
strcat(categoryId, "\0");
strcpy(item->itemName, strtok(NULL, "|\n"));
for (i = 0; i < NUM_PRICES; i++)
sscanf(strtok(NULL, "|\n"),"%d.%d",&(item->prices[i].dollars),&(item->prices[i].cents));
strcpy(item->itemDescription, strtok(NULL, "|\n"));
item->nextItem = NULL;
free(buffer);
return TRUE;
}
```
Header definitions:
```
/* System-wide constants. */
#define ID_LEN 5
#define MIN_NAME_LEN 1
#define MAX_NAME_LEN 25
#define MIN_DESC_LEN 1
#define MAX_DESC_LEN 250
#define NUM_PRICES 3
#define HOT 'H'
#define COLD 'C'
#define FALSE 0
#define TRUE 1
#define MAX_BUFFER_SIZE 1024
typedef struct category* CategoryTypePtr;
typedef struct item* ItemTypePtr;
/* Structure definitions. */
typedef struct price
{
unsigned dollars;
unsigned cents;
} PriceType;
typedef struct item
{
char itemID[ID_LEN + 1];
char itemName[MAX_NAME_LEN + 1];
PriceType prices[NUM_PRICES];
char itemDescription[MAX_DESC_LEN + 1];
ItemTypePtr nextItem;
} ItemType;
typedef struct category
{
char categoryID[ID_LEN + 1];
char categoryName[MAX_NAME_LEN + 1];
char drinkType; /* (H)ot or (C)old. */
char categoryDescription[MAX_DESC_LEN + 1];
CategoryTypePtr nextCategory;
ItemTypePtr headItem;
unsigned numItems;
} CategoryType;
typedef struct gjc
{
CategoryTypePtr headCategory;
unsigned numCategories;
} GJCType;
```
|
Desperately seeking the answer to my pointer problem
|
CC BY-SA 3.0
| null |
2011-05-17T04:52:05.333
|
2012-09-16T23:56:02.983
|
2012-09-16T23:56:02.983
| 893 | 11,194 |
[
"c",
"memory",
"pointers",
"linked-list"
] |
6,026,585 | 1 | 6,026,784 | null | 1 | 1,379 |
I have to create an RDLC report in asp.net. For which I am writing a stored procedure using different scalar functions.
I have a GUI from which I have to select a criteria and collect data according to that criteria. The GUI is here:

I have implemented all cases like "All Staff", "All services", etc but the problem comes when I have to select specific records from list box and bring data according to that. For example I select specfic Staff records from list and my report should display the records only having that selected records.
How can I handle this? I mean when I select some records from listbox, how can I take these records to the where clause of my stored procedure and how to use it there?
I am using SQL SERVER 2008.
My Stored Procedure is:
```
USE [PC_Rewrite]
```
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[spGetClients]
(
@orderBy varchar(50)
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
```
-- Insert statements for procedure here
IF(@orderBy = 'Consumer Name')
BEGIN
SELECT c.Id, c.LastName, c.FirstName, c.MiddleInit,
c.DateOfBirth, dbo.GetAge(c.DateOfBirth, GETDATE()) AS Age, c.Sex, cs.Status, ca.Address, co.Phone,
dbo.GetEthnicity(c.Id) AS Ethnicity, dbo.GetDevelopmentalDisabilities(c.Id) AS Disabilities,
dbo.GetClientStaffContacts(c.Id) AS Staff, dbo.GetClientContacts(c.Id) AS Contact,
dbo.GetClientInsuranceProviders(c.Id) AS InsuranceProvider FROM Client c
LEFT OUTER JOIN ClientStatus cs ON cs.Id = c.StatusId
LEFT OUTER JOIN(
SELECT ca.ParentEntityId, ca.Address
FROM ContactAddress ca
INNER JOIN EntityName en ON en.Id = ca.EntityNameId AND en.Name = 'Client'
INNER JOIN GeneralLookup gl ON ca.glAddressTypeId = gl.Id AND gl.LookupItem = 'Primary'
) ca ON c.Id = ca.ParentEntityId
LEFT OUTER JOIN(
SELECT co.ParentEntityId, co.ContactData Phone
FROM ContactOther co
INNER JOIN EntityName en ON en.Id = co.EntityNameId AND en.Name = 'Client'
INNER JOIN GeneralLookup gl ON co.glContactTypeId = gl.Id AND gl.LookupItem = 'Home'
) co ON c.Id = co.ParentEntityId
ORDER BY c.LastName, c.FirstName, c.MiddleInit
END
ELSE IF(@orderBy = 'Consumer Address')
BEGIN
SELECT c.Id, c.LastName, c.FirstName, c.MiddleInit,
c.DateOfBirth, dbo.GetAge(c.DateOfBirth, GETDATE()) AS Age, c.Sex, cs.Status, ca.Address, co.Phone,
dbo.GetEthnicity(c.Id) AS Ethnicity, dbo.GetDevelopmentalDisabilities(c.Id) AS Disabilities,
dbo.GetClientStaffContacts(c.Id) AS Staff, dbo.GetClientContacts(c.Id) AS Contact,
dbo.GetClientInsuranceProviders(c.Id) AS InsuranceProvider FROM Client c
LEFT OUTER JOIN ClientStatus cs ON cs.Id = c.StatusId
LEFT OUTER JOIN(
SELECT ca.ParentEntityId, ca.Address
FROM ContactAddress ca
INNER JOIN EntityName en ON en.Id = ca.EntityNameId AND en.Name = 'Client'
INNER JOIN GeneralLookup gl ON ca.glAddressTypeId = gl.Id AND gl.LookupItem = 'Primary'
) ca on c.Id = ca.ParentEntityId
LEFT OUTER JOIN(
SELECT co.ParentEntityId, co.ContactData Phone
FROM ContactOther co
INNER JOIN EntityName en ON en.Id = co.EntityNameId AND en.Name = 'Client'
INNER JOIN GeneralLookup gl ON co.glContactTypeId = gl.Id AND gl.LookupItem = 'Home'
) co ON c.Id = co.ParentEntityId
ORDER BY ca.Address
END
```
END
Any help would be appreciated.
|
How to take data from aspx page to stored procedure?
|
CC BY-SA 3.0
| null |
2011-05-17T05:26:39.767
|
2011-05-17T08:10:13.767
|
2011-05-17T06:18:15.720
| 669,448 | 669,448 |
[
"asp.net",
"sql",
"sql-server",
"criteria",
"user-defined-functions"
] |
6,026,767 | 1 | null | null | 0 | 104 |
CSS CODE:
```
.search {
float: left;
width: 100%;
display: block;
}
.search ul.tabs {
height: 23px;
margin: 50px 0 0 0;
padding: 0px;
}
/* FF ONLY */
.search ul.tabs, x:-moz-any-link {
height: 26px;
margin: 50px 0 0 0;
padding: 0px;
}
.search ul.tabs li {
float: left;
display: inline;
margin: 0;
padding: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
-moz-border-top-left-radius: 3px;
-moz-border-top-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
}
.search ul.tabs li.second {
padding: 0 0 0 2px;
}
.search ul.tabs li a {
padding: 7px 10px 7px 10px;
background: #ffa63c;
font: normal normal bold 12px/1.5 "Arial", Helvetica, sans;
text-decoration: none;
color: #fdf9f1;
font-weight: bold;
}
.search ul.tabs li a:hover {
color: #fff;
}
```
HTML CODE:
```
<div style="float:left">
<ul class="tabs">
<li id="ctl00_ctl00_cplMPBody_liRestaurnat" class="first">
<a title="Poišči po imenu" class="activeRestaurant" href="x">Poišči restavracijo</a>
</li>
<li id="ctl00_ctl00_cplMPBody_liAddress" class="second">
<a title="Poišči po imenu kraja" href="x">Poišči po krajih</a>
</li>
</ul>
</div>
```
And i have problem with IE:
FF

IE 7

what to do in IE 7?
|
IE 7 CSS problem
|
CC BY-SA 3.0
| null |
2011-05-17T05:51:48.367
|
2011-05-17T15:49:07.113
| null | null | 267,679 |
[
"html",
"css"
] |
6,026,803 | 1 | 6,031,581 | null | 0 | 1,007 |
I'm working in a apps where I'm using mongodb with replicaset.
In my replicaset I've 2 db servers and 1 arbiter. I'm creating my mongo object as follows
```
List<ServerAddress> servers = new ArrayList<ServerAddress>();
servers.add( new ServerAddress( "192.168.1.42", 27017 ) );
servers.add( new ServerAddress( "192.168.1.187", 27017 ) );
servers.add( new ServerAddress( "192.168.1.189", 27017 ) ); //Arbiter
MongoOptions mongoOptions = new MongoOptions();
mongoOptions.autoConnectRetry = true;
mongo = new Mongo(servers, mongoOptions);
mongo.slaveOk();
```
When all the servers are up then there are no problems but when any one of the server goes down the system starts to through endless error messages as shown below
```
May 17, 2011 11:24:19 AM com.mongodb.ReplicaSetStatus$Node update
SEVERE: can't update node: 192.168.1.42:27017
java.io.IOException: couldn't connect to [/192.168.1.42:27017] bc:java.net.ConnectException: Connection refused: connect
at com.mongodb.DBPort._open(DBPort.java:206)
at com.mongodb.DBPort.go(DBPort.java:94)
at com.mongodb.DBPort.go(DBPort.java:75)
at com.mongodb.DBPort.findOne(DBPort.java:129)
at com.mongodb.DBPort.runCommand(DBPort.java:138)
at com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:149)
at com.mongodb.ReplicaSetStatus.updateAll(ReplicaSetStatus.java:314)
at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:263)
```
Can you help me to resolve this?
Since I'm using a replica set, if one server is down isn't suppose to use the new primary and ignore the older primary?
Please find the below images to check the replica set status
All servers up and 192.168.1.42 is the primary server

192.168.1.42 is down(manually teminated) and 192.168.1.187 is the new primary(The errors happens now)

192.168.1.42 is up again and actings as a secondary server(error goes off)

UPDATED:
The database works even if the error messages get logged. Is there a mechanism to reduce/suppress the error messages?
|
Endless replicaset connection error with spring data support and mongodb
|
CC BY-SA 3.0
| null |
2011-05-17T05:56:41.603
|
2011-05-17T13:33:57.717
|
2011-05-17T06:14:02.187
| 114,251 | 114,251 |
[
"spring",
"mongodb",
"mongodb-java"
] |
6,026,973 | 1 | null | null | 4 | 945 |
I am making an Android game and I would like to have a nice menu. I have only every used the combination of `<LinearLayout>` and `<ImageView>` for placing my buttons, which sets them up in a straight line. Here are my buttons:


I want to place them as seen below. Is it possible to place a button like that and still make it click-able?

|
Getting fancy with Android menu button layouts
|
CC BY-SA 3.0
| 0 |
2011-05-17T06:17:41.733
|
2011-05-17T06:59:01.423
| null | null | 288,341 |
[
"android",
"button"
] |
6,027,145 | 1 | 6,027,306 | null | 0 | 2,369 |
I have created a group folder in my Xcode project named USER_PHOTO

Then I store some images into that folder.

In my application, I open the camera mode.
How can I save the captured images into the "USER_PHOTO" folder? Also, how can I read all images from the folder?
Please give me ideas to solve these issues. Thanks in advance.
|
How to read images from a specific folder?
|
CC BY-SA 3.0
| 0 |
2011-05-17T06:37:53.553
|
2011-05-17T10:01:03.247
|
2011-05-17T06:47:06.047
| 603,977 | 510,814 |
[
"objective-c",
"ios",
"camera",
"file-management"
] |
6,027,150 | 1 | null | null | 0 | 142 |
Is there a way of setting up a job, that builds using the latest tag from a SVN repository?
The project structure is as follows
```
Project
|
|\trunk
|\branches
|\tags
|
|\REL_1.0.1
|\REL_1.0.2
|\REL_1.0.3
|\REL_1.1.0
|\REL_1.1.1
```

I would like to replace REL_1.1.1, such that it always uses the latest tag.
: This is using Jenkins.
|
Automatically build using the latest tag
|
CC BY-SA 3.0
| null |
2011-05-17T06:38:50.247
|
2011-05-17T11:07:32.413
|
2011-05-17T11:07:32.413
| 458,493 | 458,493 |
[
"java",
"jenkins"
] |
6,027,196 | 1 | 6,028,513 | null | 0 | 6,621 |
I have this xml, i took it in xml `a GPathResult object` how can I get `Microsoft(R) Windows(R) Server 2003 Enterprise x64 Edition` based on checking with the `field` value as `OS Name` using groovy xml slurping
```
<client productname="abp">
<machine>
<env>
<variable name='ALLUSERSPROFILE' value='C:\Documents and Settings\All Users' />
<variable name='APPDATA' value='C:\Documents and Settings\Administrator\Application Data' />
<variable name='OS' value='Windows_NT' />
<variable name='COMPUTERNAME' value='AbhishekPC' />
</env>
<osinfo>
<osinfo field='OS Name' information='Microsoft(R) Windows(R) Server 2003 Enterprise x64 Edition' />
<osinfo field='OS Version' information='5.2.3790 Service Pack 2 Build 3790' />
<osinfo field='OS Manufacturer' information='Microsoft Corporation' />
<osinfo field='OS Configuration' information='Standalone Server' />
<osinfo field='OS Build Type' information='Multiprocessor Free' />
</osinfo>
</machine>
</client>
```
Here is the parsing code
```
def file = new File(filepath)
def gpathResult = new XmlSlurper().parse(file)
[email protected]()
log.info [email protected]()
System.out.println("HI 1"[email protected]());
System.out.println("HI 2"[email protected]());
if([email protected]().equals("OS"))
{
summary.osname=gpathResult.machine.environment.variable.@value.text()
}
if([email protected]().equals("COMPUTERNAME"))
{
summary.hostname=gpathResult.machine.environment.variable.@value.text()
}
```
Here `HI 1` prints all the environments name attribut values but `HI 2` only prints `HI 2`
here is the snapshot

here is what solved after i traversed
```
def vals1=gpathResult.machine.env.variable.findAll{it.@name=='COMPUTERNAME'}[email protected]()
println vals1
csmSummary.hostname=vals1
def vals2=gpathResult.machine.env.variable.findAll{it.@name=='OS'}[email protected]()
println vals2
csmSummary.osname=vals2
```
|
how to traverse inside a xml node and check for an attribute value?
|
CC BY-SA 3.0
| 0 |
2011-05-17T06:44:35.380
|
2011-05-17T09:53:42.530
|
2011-05-17T09:53:42.530
| 707,414 | 707,414 |
[
"xml",
"groovy",
"xmlslurper"
] |
6,027,291 | 1 | 6,027,782 | null | 1 | 83 |
I'm trying to get the images to move from right to left one-by-one when the mouse is over the arrow button, but I am unable to understand how and which jQuery class I can implement to execute the exact result.

My code is as follows:
```
<div id="logos">
<ul>
<li style="float:left; margin-left:0px; margin-right:40px; "><img src="images/logo&typography_porjects.png" width="300" height="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<div class="clear"></div>
<li style="float:left; margin-left:0px;"><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
<li><img src="images/logo-no-image.jpg" height="130" width="130" /></li>
</ul>
</div>
```
and the CSS code is:
```
#logos { width:1200px; float:right; }
#logos ul { list-style:none; float:right; overflow:hidden; }
#logos ul li { display:inline; margin:0 0 0 10px; }
.clear { height:30px; width:100%; clear:both; }
```
|
which jQuery Class should i use in this scenario?
|
CC BY-SA 3.0
| null |
2011-05-17T06:54:31.423
|
2016-02-04T06:57:28.257
|
2011-05-17T09:19:10.937
| 345,078 | 698,668 |
[
"jquery",
"html",
"css"
] |
6,027,307 | 1 | 6,135,704 | null | 0 | 2,876 |
Some of my jqGrids have a strange behavior on the navigation bar.
On some of them I use the default Search and Refresh buttons and on there ones the navigation area floats left appearing right next to these buttons (not centered as it should).
The biggest problem happens when I add text to the search button "Search". This makes the button margins being wrongly calculated making the hober effect border shorter than the actual button width.
But like I said, this only happens in some cases and I can't figure out the difference between the ones working correctly and the ones that don't. This is not a browser issue as it happens the same in all browsers.
Heres's a screenshot (notice the search button with focus and the navigation controls position!):

Have anyone faced this problem before?
This is my configuration os a grid that have this problem:
```
$('#ProductBrandListGrid').jqGrid({
url: '<%= ResolveUrl("~/Controls/ProductsControls/Controllers/ProductBrandController.ashx?method=GridDataList") %>',
datatype: 'json',
mtype: 'GET',
colNames: ['Name', 'Description', 'Actions'],
colModel: [
{ name: 'Name', index: 'Name', width: 100, align: 'left', resizable: true, sortable: true, searchoptions: { sopt: ['cn']} },
{ name: 'Description', index: 'Description', align: 'left', resizable: true, sortable: true, searchoptions: { sopt: ['cn']} },
{ name: 'act', index: 'act', width: 25, sortable: false, search: false },
],
pager: $('#ProductBrandListGridPager'),
rowNum: 15,
rowList: [10, 15, 20, 30, 50, 100],
sortname: 'Name',
sortorder: 'asc',
viewrecords: true,
imgpath: '',
caption: '',
width: 200,
height: 400,
gridComplete: function () {
var ids = jQuery("#ProductBrandListGrid").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
ce2 = "<input type='button' value='details' onclick='ProductBrandItemOpen(\"" + cl + "\")' />";
$("#ProductBrandListGrid").setRowData(ids[i], { act: ce2 });
}
}
});
/* Add this line to show search boxes on the header */
$('#ProductBrandListGrid').jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false });
/* Add this line to allow advanced search using the toolbar button */
$("#ProductBrandListGrid").jqGrid('navGrid', "#ProductBrandListGridPager", { search: true, edit: false, add: false, del: false, searchtext:"Search" });
```
Thanks,
Alex
|
jqgrid navigation bar not rendering correctly
|
CC BY-SA 3.0
| 0 |
2011-05-17T06:56:27.040
|
2014-08-05T23:07:24.277
|
2011-05-17T07:20:09.853
| 242,076 | 140,472 |
[
"javascript",
"jquery",
"jquery-plugins",
"jqgrid"
] |
6,027,388 | 1 | 6,219,096 | null | 1 | 90 |
I want to enable "Check-out" feature of "git local repository".
As shown in following image.

How do I enable that?
|
Xcode4 : How do I enable following feature of Xcode4?
|
CC BY-SA 3.0
| null |
2011-05-17T07:05:21.187
|
2014-05-03T22:05:30.387
|
2014-05-03T22:05:30.387
| 759,866 | 664,067 |
[
"git",
"ios4",
"xcode4"
] |
6,027,363 | 1 | null | null | 14 | 21,488 |
I have implemented a file upload for images using and the . The implementation is quit simple as it allows you to browse for a file and upload it to a specified directory.
Here is what I have for my image upload solution using and the Microsoft.Web.Helpers plugin.

Now the code
```
namespace MvcImageUpload.Models {
public class ImageUploadViewModel {
[UIHint("UploadedImage")]
public string ImageUrl { get; set; }
public string ImageAltText { get; set; }
}
}
```
Now for the I've simply dropped this into the Home controller, since this is just a mock project to get it working. I just added an `ActionResult` which takes an ImageUploadViewModel as a parameter.
```
public ActionResult Upload(ImageUploadViewModel model) {
var image = WebImage.GetImageFromRequest();
if (image != null) {
if (image.Width > 500) {
image.Resize(500, ((500 * image.Height) / image.Width));
}
var filename = Path.GetFileName(image.FileName);
image.Save(Path.Combine("../Uploads/Images", filename));
filename = Path.Combine("~/Uploads/Images", filename);
model.ImageUrl = Url.Content(filename);
model.ImageAltText = image.FileName.Substring(0, image.FileName.Length - 4);
}
return View("Index", model);
}
```
My view for the uploading of images is simple, it has an Html.BeginForm, which handles the Post form method and has the encoding type set to be "multipart/form-data".
Then using The Microsoft.Web.Helpers.FileUpload helper, I request an image from the HTTP post and then display it using a custom DisplayFor template, called ImageViewer.
```
@model MvcImageUpload.Models.ImageUploadViewModel
@using Microsoft.Web.Helpers;
@{
ViewBag.Title = "Index";
}
<h2>Image Uploader</h2>
@using (Html.BeginForm("Upload", "Home", FormMethod.Post,
new { @encType = "multipart/form-data" })) {
@FileUpload.GetHtml(initialNumberOfFiles: 1, allowMoreFilesToBeAdded: false,
includeFormTag: false, addText: "Add Files", uploadText: "Upload File") <br />
<input type="submit" name="submit"
value="Upload Image" text="Upload Images"
style="font-size: .9em;" />
@Html.DisplayFor(x => x, "ImageViewer")<br />
}
```
Here is what the custom DisplayTemplate looks like
```
@model MvcImageUpload.Models.ImageUploadViewModel
@if (Model != null) {
<h4 style="color:Green;">Upload Success!</h4>
<p>
Alt Text has been set to <strong>@Model.ImageAltText</strong>
</p>
<img style="padding: 20px;"
src="@(String.IsNullOrEmpty(Model.ImageUrl) ? "" : Model.ImageUrl)"
id="uploadedImage" alt="@Model.ImageAltText"/>
}
```
This all works and the image gets successfully uploaded to the /Uploads/Images/FileName.extension on the form post.
# My question
How can I now have another view to display all the images in that directory, paged and be able to select and delete and image, from the view and the directory?
Also I know the Microsoft.Web.Helpers.FileUpload, supports uploading of multiple files, but I can't find how to implement this with my current solution. Any help would be greatly appriceated.
|
Mvc 3 Image Upload Gallery
|
CC BY-SA 3.0
| 0 |
2011-05-17T07:02:48.480
|
2012-11-29T20:39:44.830
|
2020-06-20T09:12:55.060
| -1 | 416,056 |
[
"asp.net-mvc-3",
"image-uploading"
] |
6,027,508 | 1 | 6,028,028 | null | 4 | 505 |
Assuming I have a form and paint an oval on it. I then want to take a control (such as a picturebox) and (while keeping the top left corner of the control exactly on the line) I want to move the control pixel by pixel following the drawn oval.
Basically I want to calculate the Top/Left point for each position/pixel in my oval. I know its a basic formula but cant for the life of me remember what its called or how its accomplished.
Anyone care to help?

|
Basic maths for animation
|
CC BY-SA 3.0
| 0 |
2011-05-17T07:17:22.197
|
2011-05-18T09:12:42.797
| null | null | 314,661 |
[
"c#",
".net",
"animation",
"graphics",
"geometry"
] |
6,027,529 | 1 | 6,027,962 | null | 0 | 1,601 |
how can i add a refresh button in the nav bar of jq grid.
i tried to add it and the result is shown below. the refresh button goes down the no records to view line.Please help me to align my refresh button.

thanks,
Devan
|
Aligning the nav bar
|
CC BY-SA 3.0
| null |
2011-05-17T07:20:00.040
|
2011-05-17T08:05:20.237
| null | null | 730,453 |
[
"jqgrid"
] |
6,027,576 | 1 | 6,027,798 | null | 2 | 3,249 |
I have a page in ASP.net that has a table that gets autogenerated based upon a datatable and shown using a Telerik RadGrid, I want the page size to remain unchanged and if the table is too wide it should have its own scroll bars.
I have tested using IE9 and Firefox and they both put a scroll bar on the page instead of the table.

if I use the web dev toolbar in IE9 and set the mode to IE7 it renders how I want with the scroll on the table!
The ASP markup code looks as follows:
```
<%@ Page Title="Data Audit" Language="C#" Theme="Editor" MasterPageFile="~/MasterPages/MasterPlanEditor.Master"
AutoEventWireup="True" CodeBehind="DataAudit.aspx.cs" Inherits="IFMA.MasterPlan.Web.Modules.Administrator.DataAuditing.DataAudit" %>
<%@ Register Src="../../../Common/Controls/ContentTitleBar.ascx" TagName="ContentTitleBar"
TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/CMSSection.ascx" TagName="CMSSection"
TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/PageMessage.ascx" TagName="PageMessage"
TagPrefix="IFMA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<!-- AJAX --->
<telerik:RadAjaxManager ID="AjaxManager" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxPanel">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel" LoadingPanelID="AjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" />
<telerik:RadTabStrip ID="TabStrip" runat="server" Skin="Default">
<Tabs>
<telerik:RadTab Text="Data Audit" Selected="true">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<div class="BlueContentContainer">
<div class="PaddingContentContainer">
<IFMA:PageMessage ID="pageMessage" runat="server" />
Please select the audit entity:
<telerik:RadComboBox ID="cmbAuditSelection" runat="server" AllowCustomText="false"
OnItemsRequested="cmdAuditSelection_OnItemsRequested" EnableLoadOnDemand="true"
Width="350px" OnSelectedIndexChanged="cmbAuditSelection_OnSelectedIndexChanged"
CausesValidation="false" AppendDataBoundItems="true" EmptyMessage="Please Select"
AutoPostBack="true" Skin="Office2007" />
<br />
<br />
<asp:Panel ID="GridPanel" BorderderStyle="Solid" BorderColor="MenuBar" ScrollBars="Auto"
Height="98%" runat="server">
<telerik:RadGrid ID="Grid" Skin="Office2007" AllowPaging="false" Style="width: auto"
ShowGroupPanel="false" runat="server" OnColumnCreated="Grid_OnColumnCreated"
GridLines="Both">
<MasterTableView AutoGenerateColumns="True" HeaderStyle-Wrap="false" ShowHeadersWhenNoRecords="false" />
</telerik:RadGrid>
</asp:Panel>
</div>
</div>
</asp:Content>
```
and the [css](http://pastebin.com/pX0gZKDL)
I'm going crazy trying to figure this out, I haven't done a lot of CSS so hopefully someone here might know.
|
stop table expanding off screen
|
CC BY-SA 3.0
| null |
2011-05-17T07:25:07.353
|
2011-05-17T07:48:16.270
|
2020-06-20T09:12:55.060
| -1 | 351,614 |
[
"asp.net",
"html",
"css",
"layout"
] |
6,028,128 | 1 | 6,028,199 | null | 66 | 222,056 |
How do I rotate text in CSS to get following output:

The problem I am facing is that when we rotate the text then it breaks the alignment and positions. So what is causing that, and how can I manage them?
HTML:
```
<div class="mainWrapper">
<div class="rotateObj">
<div class="title active">First Text Title</div>
<div class="content">
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
</div>
<div class="title">First Text Title</div>
<div class="content hide">
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
</div>
<div class="title">First Text Title</div>
<div class="content hide">
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
</div>
<div class="title">First Text Title</div>
<div class="content hide">
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
</div>
<div class="title">First Text Title</div>
<div class="content hide">
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
Here goes my bla bla bla text and more stuffs...
</div>
</div>
</div>
```
CSS:
```
.mainWrapper{margin:0 auto; width:960px; background:#EFEFEF;}
.rotateObj{position:relative; height:400px;}
.rotateObj .title{
float:left;
background:gray;
width:50px;
height:100%;
/** Rounded Border */
border-radius:5px;-moz-border-radius:5px;
/** Rotation */
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
transform:rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
.rotateObj .active{background:green;}
.rotateObj .content{float:left;width:600px;height:100%;padding:20px;}
.hide{display:none;}
```
[http://jsfiddle.net/koolkabin/yawYM/](http://jsfiddle.net/koolkabin/yawYM/)
|
How do I rotate text in css?
|
CC BY-SA 4.0
| 0 |
2011-05-17T08:25:02.697
|
2023-02-23T17:43:55.740
|
2023-02-23T17:43:55.740
| 2,756,409 | 178,301 |
[
"css",
"text-rotation"
] |
6,028,297 | 1 | 6,028,462 | null | -1 | 202 |
On [this page](http://www.glamourunderground.com/the-ultimate-one-day-makeover/), the title says it has a margin top & bottom of 25px (when I use inspect element in Chrome 10) - but the CSS looks like this:
```
.post h2 {
margin:0;
text-align: left;
font-size: 18px;
overflow:hidden;
font-weight:normal;
}
```
I'm trying to decrease the top and bottom margins around the title.
Here's a screenshot of the problem:
|
Unspecified Margin Problem?
|
CC BY-SA 3.0
| null |
2011-05-17T08:39:32.440
|
2011-05-17T09:01:44.713
|
2011-05-17T09:00:20.567
| 725,430 | 725,430 |
[
"html",
"css",
"wordpress"
] |
6,028,749 | 1 | 6,028,861 | null | 0 | 109 |
In the image below, it says JAVA_HOME is set to an invalid directory. However, that is where my Java folder is located.. in `C:\Program Files\Java`... I don't think it is case sensitive, right? What would you deduce is wrong with running mvn?
Thanks for any thoughts and ideas. :)

|
Problems running mvn for apache-maven
|
CC BY-SA 3.0
| null |
2011-05-17T09:20:30.037
|
2011-05-17T09:29:11.350
| null | null | 556,282 |
[
"apache",
"maven"
] |
6,028,921 | 1 | 6,029,067 | null | 31 | 15,965 |
I am trying to show cancel button in `UIActionSheet` but it's not showing, is that an acceptable behavior? please advice.
```
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Are you sure you want to clear the cache?"
delegate:self
cancelButtonTitle:@"No"
destructiveButtonTitle:@"Yes"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
```

|
UIActionSheet on iPad is not showing cancel button
|
CC BY-SA 3.0
| 0 |
2011-05-17T09:34:10.543
|
2014-06-15T12:03:58.433
|
2017-02-08T14:32:13.497
| -1 | 488,434 |
[
"objective-c",
"ipad",
"ios4",
"uiactionsheet"
] |
6,029,273 | 1 | 6,029,340 | null | 2 | 709 |
I have a custom UserControl that have a StatusStrip. So, I resize this control when user drags the corner of this status strip. However, the resizing is not pretty good: temporary white areas can be observed on the parent control during the resize, and sometimes if the resizing are too fast user "loses" the control(that stops resizing).

```
Option Infer On
Public Class FloattingGrid
Inherits System.Windows.Forms.UserControl
Dim mouseDownLocation As Nullable(Of Point)
Private Sub StatusStrip1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StatusStrip1.MouseMove
If mouseDownLocation.HasValue Then
Dim newPosition = Cursor.Position
Dim dx = newPosition.X - mouseDownLocation.Value.X
Dim dy = newPosition.Y - mouseDownLocation.Value.Y
'Dim oldRect = New Rectangle(Me.Location, Me.Size)'
Me.Size = New Size(Me.Width + dx, Me.Height + dy)
mouseDownLocation = newPosition
If Me.Parent IsNot Nothing Then
'Me.Parent.Invalidate(oldRect) '
Me.Parent.Refresh()
End If
Else
If e.X > Me.Width - 20 Then
If Cursor <> Cursors.SizeNWSE Then Cursor = Cursors.SizeNWSE
Else
If Cursor = Cursors.SizeNWSE Then Cursor = Cursors.Default
End If
End If
End Sub
Private Sub StatusStrip1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusStrip1.MouseLeave
Cursor = Cursors.Default
mouseDownLocation = Nothing
'Me.ResumeLayout() '
End Sub
Private Sub StatusStrip1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StatusStrip1.MouseDown
If Cursor = Cursors.SizeNWSE Then
'Me.SuspendLayout() '
mouseDownLocation = Cursor.Position
End If
End Sub
Private Sub StatusStrip1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StatusStrip1.MouseUp
mouseDownLocation = Nothing
'Me.ResumeLayout()'
End Sub
' Private Sub FloattingGrid_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove '
' End Sub '
Private Sub FloattingGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ResizeRedraw = True
End Sub
End Class
```
I think that behavior could be caused by the parent's Invalidate. Is there a way to just BeginInvalidate and not wait till parent invalidates all the region?
|
Optimizing control resizing
|
CC BY-SA 3.0
| null |
2011-05-17T10:07:29.870
|
2011-05-17T10:41:04.410
|
2011-05-17T10:41:04.410
| 185,593 | 185,593 |
[
".net",
"winforms",
"user-controls"
] |
6,029,517 | 1 | null | null | 1 | 509 |
Is it possible to create (without images), really cool looking linear gradients like the ones you see in the Ribbon menu controls?
Does anyone know of any tutorials, articles resources or samples that demonstrate/show off this kinda gradient?
|
Uber cool Linear Gradients in CSS3
|
CC BY-SA 3.0
| null |
2011-05-17T10:29:35.120
|
2011-05-17T10:33:09.420
| null | null | 696,091 |
[
"html",
"css",
"gradient"
] |
6,029,558 | 1 | null | null | 0 | 78 |
I'm currently developing a toolbar, but i'm having a problem with something.
Well the think is that if my window is on full screen everything is ok, but when the windows is redimensioned, then my buttons go on the bottom line of my toolbar...

Something important is that my toolbar have a height of 20px. So normally button can't go farther then 20px
Somebody know how i can fix this bug ?
yourToolbar Code:

CSS Code :
```
.yourToolbarBody
{
height: 20px;
-webkit-user-select: none;
}
body
{
/* This step is to escape all the top css style from body webpage */
position: fixed;
width: 100%;
height: 100%;
/* Then reset it to relative to show the scrollbar */
position:relative;
}
a
{
margin-left: 4px;
float: left;
}
.button
{
position:relative;
float: left;
top: -3px;
border-radius: 3px;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
border-width: thin;
padding-bottom: 2px;
padding-top: 2px;
display: inline-block;
outline: none;
cursor: pointer;
text-shadow: 0 1px 1px rgba(0,0,0,.5);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
color: #000;
border: solid 1px #000;
}
button label
{
vertical-align: super;
cursor: pointer;
}
#clear
{
clear: both;
display: none;
}
#closeButton
{
float: right;
}
#closeButton a
{
padding-left: 30px;
background-image: url(../images/close.png);
background-repeat: no-repeat;
}
#dropMenu
{
top: 39px;
left: 0;
overflow: hidden;
/*background-color: #E5E5E5;*/
margin: 0;
padding: 0;
position: fixed; !To do not move the toolbar when scrolling
border: none;
/*-webkit-box-sizing: content-box;*/
z-index: 99999999;
border-radius: 0 0 6px 6px;
background: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#E5E5E5));
background: -moz-linear-gradient(top, #ffffff, #E5E5E5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffffff", endColorstr="#E5E5E5");
}
.dropMenuButton input
{
vertical-align : super;
padding-left : 2px;
padding-right : 2px;
}
.dropMenuButton
{
position:relative;
float: left;
top: -1px;
height: 20px;
border-radius: 3px;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
border-width: thin;
padding-bottom: 2px;
padding-top: 2px;
display: inline-block;
outline: none;
cursor: pointer;
text-shadow: 0 1px 1px rgba(0,0,0,.5);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
color: #000;
border: solid 1px #000;
text-decoration: none;
display: inline-block;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 80%;
background: white;
background: -webkit-gradient(linear, left top, left bottom, from(white), to(#D7D7D7));
background: -moz-linear-gradient(top, white, #D7D7D7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="white", endColorstr="#D7D7D7");
}
.dropMenuButton:hover
{
background: #D7D7D7;
background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D7), to(white));
background: -moz-linear-gradient(top, #D7D7D7, white);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#D7D7D7", endColorstr="white");
}
/* To center the text with the image */
.dropMenuLabel
{
/* Changer Later */
color: white;
text-shadow: 0 1px 1px rgba(0,0,0,.5);
cursor: pointer;
padding: 0 5px 0 5px;
vertical-align:super ;
}
/* To hide the border */
iframe
{
border: 0px solid #ffffff;
}
input
{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
}
.go
{
cursor: pointer;
margin-left: -4px;
height: 24px;
}
.imageButton
{
float: left;
}
.inButtonImage
{
height: 15px;
}
#searchForm
{
float: left;
vertical-align: middle;
margin-left: -3px;
}
#searchForm img
{
margin-left : 10px;
vertical-align: middle;
margin-bottom: 2px;
}
#searchForm input
{
vertical-align: middle;
}
.separator
{
width: 1px;
height: 16px;
margin: 5px 3px 0;
border-left: 1px solid #ABC6D7;
background:#fff;
float: left;
}
.textButton
{
position:relative;
float: left;
cursor: pointer;
top: -2px;
margin-left: 4px;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
border-width: thin;
padding-bottom: 2px;
padding-top: 2px;
border-style: none;
}
#YourToolbarFrame
{
top: 0;
left: 0;
width: 100%;
height: 39px;
overflow: hidden;
background-color: #E5E5E5;
margin: 0;
padding: 0;
position: fixed;
/*border: 1px solid #BDC8D6;*/
border: none;
-webkit-box-sizing: content-box;
z-index: 99999999;
}
```
|
Manage window redimension
|
CC BY-SA 3.0
| null |
2011-05-17T10:34:01.777
|
2011-05-17T10:40:26.160
|
2011-05-17T10:40:26.160
| 632,950 | 632,950 |
[
"javascript",
"jquery",
"css"
] |
6,029,730 | 1 | null | null | 2 | 869 |
I'm using the RowEditor extension to edit a GridPanel. My ExtJS version is 3.3.0. I need some fields to be editable, others not no be edited at all and I do this by ignoring the `editor` property on those columns. The problem is that when an editor is not found, it is artificially generated in [RowEditor.js](http://trac.geoext.org/browser/ext/3.1.1/examples/ux/RowEditor.js?rev=2159) this way:
```
for(var i = 0, len = cm.getColumnCount(); i < len; i++){
var c = cm.getColumnAt(i),
ed = c.getEditor();
if(!ed){
ed = c.displayEditor || new Ext.form.DisplayField();
}else{
ed = ed.field;
}
//uninteresting code...
this.insert(i, ed);
}
```
The data is double displayed because of that, as you can see in the image below.

Is there a quick solution to get rid of that unnecessary text but still view the existing data on the grid? Thanks in advance.
|
Display problem when using RowEditor extension on an ExtJS GridPanel
|
CC BY-SA 3.0
| null |
2011-05-17T10:48:48.367
|
2011-06-07T07:15:06.187
| null | null | 575,395 |
[
"extjs",
"gridpanel"
] |
6,030,044 | 1 | 6,030,272 | null | 3 | 14,913 |
Solution here: [http://jsfiddle.net/kralco626/E9XVr/53/](http://jsfiddle.net/kralco626/E9XVr/53/)
Note: I think this is a duplicate of this question: [how to show text area on button click?](https://stackoverflow.com/questions/4814588/how-to-show-text-area-on-button-click) However, the OP of that question never followed up and I don't think any of the answers actually answer the question. I think Tomalak's comment on that question
> Seems to me that, if anything, he wanted to pop up a textarea, wait for input into it, have the user press some 'OK' button then store the result in a variable.
Pretty much sums it up.
When the user clicks a button, I would like a text area to open in which the user can enter some text click an OK button and then the text area will close.
I don't want a dialog box, it's too intrusive, I want just a plain simple textarea or similar to open so that the top left of the text area is positioned at the bottom left of the button.
Thanks!
```
<span style="width:20px;height:20px" class="remarkButton"></span>
$(".remarkButton").button({ icons: { primary: "ui-icon-pencil" }, text: false }).click(function () {
$(...something to show text area...).data("$clickedButton",$(this));
});
//called when the OK button on the text area is clicked
function saveRemark($referenceToTextArea)
{
$referenceToTextArea.data("$clickedButton").data("remark",$referenceToTextArea.text());
}
```

|
open a text area on click of a button - Jquery
|
CC BY-SA 3.0
| 0 |
2011-05-17T11:23:13.577
|
2011-05-17T13:47:13.843
|
2017-05-23T11:48:23.740
| -1 | 351,980 |
[
"javascript",
"jquery",
"html"
] |
6,030,207 | 1 | null | null | 4 | 4,574 |
I would like to create a layout which could make the UI look like as shown in figure.
All comments and pointers welcome.
---
Adding my current Layout :
```
<?xml version="1.0" encoding="utf-8"?>
```
```
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:id="@+id/video_panel">
<RelativeLayout android:layout_width="fill_parent"
android:id="@+id/top_panel" android:gravity="top"
android:orientation="horizontal" android:alwaysDrawnWithCache="true"
android:layout_height="fill_parent" android:layout_gravity="top"
android:layout_weight="14" android:background="@drawable/top_bg1">
<TextView android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/date"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
android:text="@string/space" />
<RelativeLayout android:layout_centerHorizontal="true"
android:id="@+id/button_panel" android:layout_height="fill_parent"
android:layout_width="wrap_content" android:gravity="center_horizontal"
android:layout_centerInParent="true">
</RelativeLayout>
<TextView android:layout_height="fill_parent"
android:layout_width="wrap_content" android:layout_alignParentRight="true"
android:layout_alignParentTop="true" android:id="@+id/time"
android:text="@string/space" />
</RelativeLayout>
<LinearLayout android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_gravity="center_horizontal"
android:layout_weight="4" android:id="@+id/screen">
</LinearLayout>
<RelativeLayout android:layout_width="fill_parent"
android:id="@+id/bottom_panel" android:layout_height="fill_parent"
android:layout_gravity="bottom" android:layout_weight="13"
android:orientation="vertical" android:background="@drawable/bottom_bg1"
android:duplicateParentState="true" android:alwaysDrawnWithCache="true">
<LinearLayout android:foregroundGravity="center"
android:id="@+id/album_art" android:layout_alignParentLeft="true"
android:layout_width="256dip" android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_gravity="center"
android:id="@+id/thumbnail"></ImageView>
</LinearLayout>
<LinearLayout android:layout_toRightOf="@+id/album_art"
android:layout_height="fill_parent" android:orientation="vertical"
android:paddingTop="10dip" android:layout_width="wrap_content"
android:layout_centerHorizontal="true" android:layout_toLeftOf="@+id/status_frame"
android:id="@+id/info_panel">
</LinearLayout>
<FrameLayout android:layout_width="wrap_content"
android:id="@+id/status_frame" android:layout_height="fill_parent"
android:visibility="visible" android:foregroundGravity="center"
android:layout_alignParentRight="true" android:paddingTop="50dip">
<ImageView android:id="@+id/status" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:scaleType="fitCenter"
android:layout_gravity="center" />
</FrameLayout>
</RelativeLayout>
</LinearLayout>
```
How Should i change this layout to make it look like in my picture?
|
How to place an Imageview on top of anothe Layout as shown in the figure?
|
CC BY-SA 3.0
| 0 |
2011-05-17T11:38:37.337
|
2011-05-17T14:32:09.430
|
2011-05-17T14:32:09.430
| 449,378 | 449,378 |
[
"android",
"layout"
] |
6,030,459 | 1 | null | null | 14 | 16,955 |
How I can add a Alphabet section to the Table View?
Many thanks.

|
iPhone Table View with alphabet
|
CC BY-SA 3.0
| 0 |
2011-05-17T12:00:51.707
|
2014-06-01T05:01:04.703
|
2014-01-02T11:27:39.717
| 2,265,218 | 149,245 |
[
"ios",
"iphone",
"uitableview"
] |
6,030,474 | 1 | 6,047,946 | null | 26 | 18,907 |
When is "Browse To Find source" enabled in Visual Studio 2010? (see below)

In addition, I want to have it enabled so that I could browse to already-downloaded source code
files from [http://referencesource.microsoft.com/](http://referencesource.microsoft.com/).
This would be useful since Microsoft doesn't always release [PDB](http://en.wikipedia.org/wiki/Program_database)/source code at the same time with their latest patches. So if I want to step for example into DateTime, I really don't care about the latest patches which didn't involve DateTime. I just want to browse to its code which I downloaded from [http://referencesource.microsoft.com/](http://referencesource.microsoft.com/).
After some investigations I found which is a useful tool to view PDB file contents. (It's in `C:\Program Files (x86)\Microsoft Visual Studio 10.0\DIA SDK\Samples\DIA2Dump\`)
It looks like when I can't see source code for something like DateTime, using .NET Framework stepping, a `mscorlib.pdb` file actually gets downloaded.
But if you look inside it with it doesn't contain source file mappings. In other words useless, because even if you could browse to the source code like my initial idea, it wouldn't work because there are no source file mappings and no start addresses of the functions, and a lot of stuff missing :(
I think the solutions here are to use [.NET Reflector](http://en.wikipedia.org/wiki/.NET_Reflector) Pro for or keep a virtual machine at hand, with releases of the framework which have source code and then disable updates.
|
"Browse To Find Source" in Visual Studio 2010
|
CC BY-SA 3.0
| 0 |
2011-05-17T12:02:54.167
|
2020-08-20T16:05:56.783
|
2013-08-13T08:31:02.143
| 63,550 | 327,075 |
[
"c#",
".net",
"visual-studio-2010",
"debugging",
"pdb"
] |
6,030,684 | 1 | 6,030,847 | null | 8 | 4,570 |
When I create a histogram, it looks a lot like this:
```
set.seed(1)
x <- 1:100
y <- x + rnorm(50)
y=round(y)
hist(y)
```
Is there a way to make a histogram look a bit like this? I can only get a histogram with bins, which I don't need for my plot.

I don't want the black bins, I actually only want the blue, green and red lines. Can stackoverflow point me in the right direction?
|
histogram without vertical lines
|
CC BY-SA 3.0
| null |
2011-05-17T12:20:24.647
|
2018-06-15T12:52:47.780
|
2011-05-17T12:36:47.613
| 717,132 | 717,132 |
[
"r",
"histogram",
"bin"
] |
6,030,897 | 1 | 6,034,231 | null | 0 | 289 |
I am not sure if this is a setup issue from my side or some bug, but I am facing a really wierd problem.
I am developing against SQL Server CE 4.0 in a VS 2010 Winforms Project. It is kept in the project like so

Now what happens is, for some strange reason, whenever I encounter an exception in my application or do a schema update for database, I lose all my test data. Not just one table, all of it, entire database except for the schema objects.
Remember, I am not doing anything to regenerate the database from the model or anything. It just deletes all the data, and currently it is not even fully reproducible. Completely unpredictable. The schema remains intact even after the data is deleted.
Can any one help?
|
Sql server CE 4.0 in a Visual studio project suddenly losing data
|
CC BY-SA 3.0
| null |
2011-05-17T12:41:52.343
|
2012-10-26T19:32:26.937
| null | null | 297,964 |
[
".net",
"winforms",
"visual-studio-2010",
"sql-server-ce-4"
] |
6,030,934 | 1 | 6,343,282 | null | 2 | 780 |
we are building a new website, which will reuse an existing symfony-software used by another website. I'm moving reusable components into a plugin ("app-plugin"), in order to avoid duplicating code and data. The plugin will be configured as svn-external in the websites' svn repositories.
The existing symfony instance contains overridden doctrine classes (models, forms, form-filters) which are originally defined in other plugins (e.g. sfDoctrineGuardPlugin). The overridden classes can be reused by both symfony-instances, therefore I'm going to move them to the "app-plugin". But this causes problems:
If someone, for instance, runs `symfony doctrine:build-forms`, the moved files will be re-created by the task inside lib/form/doctrine and will contain empty class-definitions. The reason is very clear to me: How was symfony supposed to know that the "app-plugin" is already defining those form-classes? The only way would be to autoload all classes before executing the task and checking whether classes are already available.
A workaround would be to exclude those classes in the app-plugin's config/autoload.yml. But is there a better way?
I'm using the term "app-plugin" to avoid confusion between normal plugin (e.g. sfGuard) and our plugin which contains shared components.
---
Before:

---
After:

|
Symfony: Override plugin-model in other plugin
|
CC BY-SA 3.0
| null |
2011-05-17T12:43:51.713
|
2011-06-14T12:12:48.950
|
2011-05-18T09:58:14.810
| 395,879 | 395,879 |
[
"php",
"symfony1",
"doctrine",
"symfony-1.4",
"symfony-plugins"
] |
6,031,155 | 1 | 6,034,564 | null | 0 | 2,482 |
I'm using magento 1.5. I have a requirement to install a third-party ecommerce package. When i log into Magento Connect, i do not see "Direct package file upload" as an option.
In 1.5 how do i upload a zip/tgz etc?

|
how to install file packages in magento 1.5
|
CC BY-SA 3.0
| null |
2011-05-17T13:03:42.227
|
2011-07-07T05:47:11.667
|
2011-07-07T05:47:11.667
| 336,905 | 461,880 |
[
"php",
"magento",
"magento-1.5"
] |
6,031,222 | 1 | 6,031,427 | null | 2 | 906 |
Hi i'm getting encoding problems with the code below any ideas?
```
string url = "http://www.google.com/ig/api?weather=istanbul,TR&hl=tr";
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string retVal = reader.ReadToEnd();
Response.Write(retVal);
}
```
My Screenshoot is like that;

Thanks for your help!
|
Web Request Encoding Problem
|
CC BY-SA 3.0
| 0 |
2011-05-17T13:09:21.093
|
2011-05-17T13:24:29.817
| null | null | 331,798 |
[
"asp.net",
"character-encoding",
"httpwebrequest"
] |
6,031,275 | 1 | 6,031,341 | null | 1 | 1,385 |
I am trying to upload an image from the android device to a LAMP server where i will handle the form through PHP.
i have an image view which has been set with the image path from the SD card
i want to upload this image on click of a button

|
Upload an Image from SD card to a Lamp Server
|
CC BY-SA 3.0
| null |
2011-05-17T13:13:46.440
|
2011-05-17T13:19:37.407
| null | null | 155,196 |
[
"android",
"upload",
"httpwebrequest"
] |
6,031,343 | 1 | 6,032,015 | null | 6 | 873 |
```
private void UserControl1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawEllipse(Pens.Black, new Rectangle(-200, -500, this.Width + 400, this.Height + 420));
}
```
Paste the above code into a usercontrol. Drop the usercontrol onto a form and anchor it to all 4 points.
In the designer (Under Visual Studio 2010) it renders perfectly (even as you resize). Run it and try and resize the form and the ellipse becomes skewed.
Here are two examples the first while running, the second in the designer.


Obviously the behavior in the designer can't always be assumed to be the same (Although it would be nice) but my understanding is that the code above is completely legal. Am I wrong?
|
Bug or am I doing something wrong? Usercontrol Painting
|
CC BY-SA 3.0
| null |
2011-05-17T13:18:45.003
|
2011-05-17T14:06:04.780
|
2011-05-17T14:06:04.780
| 366,904 | 314,661 |
[
"c#",
".net",
"winforms",
"windows-forms-designer",
"paint"
] |
6,031,498 | 1 | 6,031,789 | null | 0 | 3,043 |
## The Mission: Apply a generic template to chart series.
```
<Chart BackColor="211, 223, 240" Width="250" Height="100" BackGradientStyle="TopBottom" BackSecondaryColor="Blue" BorderColor="26, 59, 105" BorderWidth="2">
<Series>
<series _Template_="All" Color="Black" BorderColor="180, 26, 59, 105">
</series>
</Series>
</Chart>
```
The styles applied to "Chart" work just fine. However, nothing applied to the Series template works; it merely contains the default styling.
```
private FileContentResult ImageCall(string config)
{
System.Web.UI.DataVisualization.Charting.Chart chart = new System.Web.UI.DataVisualization.Charting.Chart();
if (config.Length > 0)
{
chart.Serializer.IsTemplateMode = true;
chart.Serializer.IsResetWhenLoading = false;
chart.Serializer.SerializableContent = "*.*";
chart.Serializer.Load(config);
}
Series s2 = new Series("Series1");
s2.ChartArea = "Area1";
s2.ChartType = SeriesChartType.Column;
s2.Points.Add(new DataPoint
{
AxisLabel = "Value1",
YValues = new double[] { 1 }
});
s2.Points.Add(new DataPoint
{
AxisLabel = "Value2",
YValues = new double[] { 2 }
});
chart.Series.Add(s2);
ChartArea ca1 = new ChartArea("Area1");
chart.ChartAreas.Add(ca1);
using (var ms = new MemoryStream())
{
chart.SaveImage(ms, ChartImageFormat.Png);
ms.Seek(0, SeekOrigin.Begin);
return File(ms.ToArray(), "image/png", "mychart.png");
}
}
```
Here's what it looks like (crappy, I know... it's merely illustrative):

Note that the bars are unstyled while the chart seems to style just fine.
The documentation regarding built-in .NET charting is woefully thin. Can anyone help me get my generic templates to work? There's a big green check mark in it for you!
I'm probably missing something obvious. Thanks!
|
.NET Charting - Series Template
|
CC BY-SA 3.0
| null |
2011-05-17T13:29:01.180
|
2011-05-17T14:00:59.467
|
2011-05-17T13:51:19.253
| 650,094 | 650,094 |
[
"c#",
".net",
"vb.net",
"charts"
] |
6,031,569 | 1 | null | null | 0 | 531 |
I have an image which I want to use as a sprite. Let's say the image has r x c rectangles of the same size which are to be used as backgrounds. Given the dimensions in the following image, how could we generate css for containers with classes through to ? The symbols used are defined below the image.

= Outer Height, = Outer Width,
= Inner Height, = Inner Width,
= Vertical Gutter, = Horizontal Gutter
P.S. I am not sure if I have used VG and HG correctly or they should be swapped in the image, please ignore this if the latter is the case.
|
CSS Sprite Generator: I have the bundled image
|
CC BY-SA 3.0
| null |
2011-05-17T13:33:15.097
|
2011-05-17T17:10:10.920
|
2011-05-17T13:44:13.847
| 66,580 | 66,580 |
[
"css",
"code-generation",
"css-sprites"
] |
6,031,630 | 1 | 6,033,336 | null | 0 | 3,680 |
I'm trying to join a table to retreive and set a property on a POCO. Here's the scenario...
*NOTE - An application can belong to many user sessions.

## UserSession (Table)
```
UserSessionId PK
ApplicationId FK
UserName
```
## Application (Table)
```
ApplicationId PK
Name
```
## UserSession (Poco)
```
string UserName get;
string ApplicationName get;
```
I've tried a join like this:
```
Join("Application", j => j.Inverse().KeyColumn("ApplicationId").Map(x => x.ApplicationName));
```
However, this uses the primary column of the UserSessionTable for the join column. The part of the query looks like this:
```
/**SNIP**/
inner join
Auditing.UserSession US
on this_.UserSessionId=US.UserSessionId
left outer join
Auditing.Application A
on US.UserSessionId=A.ApplicationId
/**SNIP**/
```
How can i configure nhibernate fluently to use the correct join column from the left table(UserSession)?
|
Fluent NHibernate join for property value
|
CC BY-SA 3.0
| null |
2011-05-17T13:38:11.133
|
2011-05-17T15:36:32.177
|
2011-05-17T13:55:30.973
| 150,722 | 150,722 |
[
"c#",
"nhibernate",
"fluent-nhibernate",
"nhibernate-mapping"
] |
6,031,706 | 1 | 6,031,874 | null | 1 | 112 |
I would like to draw a grid in perspective and draw a circle in in te left bottom corner.
But I am not able to get it right.
So, first I draw the grid and circle without perspective.
```
public class test extends MovieClip
{
private var _gridSprite:Sprite;
private var _xLineHolder:Sprite;
private var _yLineHolder:Sprite;
private var _circle:Sprite;
public function test()
{
init();
}
private function init()
{
_gridSprite = new Sprite();
this.addChild(_gridSprite);
_xLineHolder = new Sprite();
_gridSprite.addChild(_xLineHolder);
_yLineHolder = new Sprite();
_gridSprite.addChild(_yLineHolder);
draw();
_circle = new Sprite();
_circle.graphics.beginFill(0xFF0000);
_circle.graphics.drawCircle(0, 0, 5);
this.addChild(_circle);
//Here do I set the position of the circle
_circle.x = _gridSprite.width + _gridSprite.x;
_circle.y = _gridSprite.height + _gridSprite.y;
}
private function draw()
{
var spaceXDiv:Number = 160/20;
var spaceYDiv:Number = 160/20;
_xLineHolder.graphics.clear();
_yLineHolder.graphics.clear();
_xLineHolder.graphics.lineStyle(1);
_yLineHolder.graphics.lineStyle(1);
for(var i:int = 0; i <= spaceXDiv; i++){
_xLineHolder.graphics.moveTo(i * 20, 0);
_xLineHolder.graphics.lineTo(i * 20, 160);
}
for(var j:int = 0; j <= spaceYDiv; j++){
_yLineHolder.graphics.moveTo( 0, j * 20);
_yLineHolder.graphics.lineTo(160, j * 20);
}
}
}
```
With this code, I get the following result

This is all ok, the circle is in te bottom left corner.
Now I set the perspective of the grid in `init()`. I use rotationY (I don't know if this is the proper way). The angle is 20 degrees.
```
_gridSprite = new Sprite();
this.addChild(_gridSprite);
_gridSprite.rotationY = -20;
```
The result is not ok anymore. The circle isn't anymore in the bottom left corner of the grid.


I tried a lot, but my mathematics aren't that good anymore.
This is example code that doesn't put the circle at the bottom left corner.
```
var gridLeft:Number = _gridSprite.width + _gridSprite.x;
_circle.x = gridLeft - gridLeft * Math.tan(20 * Math.PI / 180);
var gridBottom:Number = _gridSprite.height + _gridSprite.y;
_circle.y = gridBottom - gridBottom * Math.tan(20 * Math.PI / 180);
```
I hope you understand my question and that you can help me.
Thanks,
Vincent
|
Change position when something is in perspective
|
CC BY-SA 3.0
| null |
2011-05-17T13:44:10.710
|
2011-05-17T13:59:05.893
|
2011-05-17T13:59:05.893
| 512,715 | 99,360 |
[
"actionscript-3",
"geometry",
"flash-builder"
] |
6,031,730 | 1 | null | null | 0 | 219 |
I have stored some of my information in an HTML file and put it in asset folder. However, when I want to show it, web page starts but it says that "Web page not available", while I have stored it in assets folder.
This is my code:
```
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.am_culture);
final FrameLayout frame01 = (FrameLayout) findViewById(R.id.ch_frame01);
final WebView wv = new WebView(this);
frame01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
wv.loadUrl("file:///android_asset/people.html");
setContentView(wv);
}
});
}
```

|
Android, Why my html file doesn't show?
|
CC BY-SA 3.0
| null |
2011-05-17T13:45:53.677
|
2012-02-09T11:15:41.280
| null | null | 513,413 |
[
"android",
"html",
"view"
] |
6,031,784 | 1 | 6,032,094 | null | 7 | 2,779 |
Let's say I've got this dataframe with 2 levels. LC and HC.
Now i want to get 2 plots like below on top of eachother.
```
data <- data.frame(
welltype=c("LC","LC","LC","LC","LC","HC","HC","HC","HC","HC"),
value=c(1,2,1,2,1,5,4,5,4,5))
```
The code to get following plot =
```
x <- rnorm(1000)
y <- hist(x)
plot(y$breaks,
c(y$counts,0),
type="s",col="blue")
```
(with thanks to Joris Meys)
So, how do I even start on this. Since I'm used to java I was thinking of a for loop, but I've been told not to do it this way.

|
multiple histograms on top of eachother without bins
|
CC BY-SA 3.0
| 0 |
2011-05-17T13:50:21.927
|
2011-05-18T12:08:36.107
|
2011-05-18T12:08:36.107
| 717,132 | 717,132 |
[
"r",
"plot",
"histogram"
] |
6,031,832 | 1 | 6,036,359 | null | 1 | 5,374 |
I am currently working on migrating from Office 2002 SP3 to Office 2010.
In an Excel Workbook with heavy use of VBA i am running into the following Problem:
The following function is working like a charme in 2002, but crashes when opened with 2010.
```
Private Function fktSeeall()
Dim pPage As Page, cCont As Control, mpMultiPage As Control
If Seeall Then
cbButton2.Caption = "Leere ausblenden"
Else
cbButton2.Caption = "Alle anzeigen"
End If
For Each mpMultiPage In Me.Controls
If TypeName(mpMultiPage) = "MultiPage" Then
For Each pPage In mpMultiPage.Pages
pPage.Visible = Seeall
For Each cCont In pPage.Controls
If TypeName(cCont) = "TextBox" And cCont.Text <> "" Then
pPage.Visible = True
mpMultiPage.Value = Right(pPage.Name, 1) - 1
End If
Next cCont
Next pPage
End If
Next
End Function
```
The boolean `Seeall` is set outside the function.
All pages are containing one textbox. If seeall is set to false, every Page exept the ones with filled Textboxes are hidden. If set to true, all Pages are shown again.
Office 2010 fails at the line
`For Each pPage In mpMultiPage.Pages` with error message code 13 "Type Dismatch"
It also fails if i use
```
For Each pPage In MultiPage1.Pages
pPage.Visible = Seeall
For Each cCont In pPage.Controls
If TypeName(cCont) = "TextBox" And cCont.Text <> "" Then
pPage.Visible = True
MultiPage1.Value = Right(pPage.Name, 1) - 1
End If
Next cCont
Next pPage
```
I dont get the point, why the new office version fails at this stage of my code.
This is a screenshot of the UserForm:

|
Office 2010 UserForm handling Pages in MultiPage Control
|
CC BY-SA 3.0
| null |
2011-05-17T13:53:29.170
|
2011-05-17T19:56:48.137
| null | null | 540,247 |
[
"vba",
"ms-office"
] |
6,031,869 | 1 | 6,130,577 | null | 3 | 1,427 |
I'm trying to move [an app](https://stackoverflow.com/questions/5937623/displaying-extra-rows-in-a-listfield) from using a KeywordFilterField to ListField and I'm struggling since several hours to find out, why is drawListRow() called with different values - depending on which of these two ListField's I use:
If getRowHeight() returns 40, then the values will be -
For are: (i.e. as expected)
But for I see: (i.e. offset by for some reason)
Where is the 9 coming from? Is there a method in ListField or ListFieldCallback which I could call to get this value? I'm just trying to draw a light gray line between items of the list.

Below is my test code and the border.png (used as BasicEditField border) is attached:

```
package mypackage;
import java.util.*;
import net.rim.device.api.collection.*;
import net.rim.device.api.collection.util.*;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;
import net.rim.device.api.util.*;
public class MyList extends UiApplication {
public static void main(String args[]) {
MyList app = new MyList();
app.enterEventDispatcher();
}
public MyList() {
pushScreen(new MyScreen());
}
}
class MyScreen extends MainScreen {
static final int EXTRA_ROWS = 2;
MyItemList myItems = new MyItemList();
ListField myList = new ListField(EXTRA_ROWS);
Border myBorder = BorderFactory.createBitmapBorder(
new XYEdges(12, 12, 12, 12),
Bitmap.getBitmapResource("border.png"));
Background myBg = BackgroundFactory.createSolidBackground(0x111111);
StringProvider myProvider = new StringProvider("Search");
BasicEditField myFind = new BasicEditField(USE_ALL_WIDTH) {
protected void paint(Graphics g) {
if (getTextLength() == 0) {
g.setColor(Color.LIGHTGRAY);
g.drawText(myProvider.toString(), 0, 0);
}
g.setColor(Color.BLACK);
super.paint(g);
}
};
public MyScreen() {
getMainManager().setBackground(myBg);
myFind.setBorder(myBorder);
setTitle(myFind);
myItems.doAdd(new MyItem(1, "Eins"));
myItems.doAdd(new MyItem(2, "Zwei"));
myItems.doAdd(new MyItem(3, "Drei"));
myItems.doAdd(new MyItem(4, "Vier"));
myList.setCallback(new MyListFieldCallback());
add(myList);
}
private class MyListFieldCallback implements ListFieldCallback {
public void drawListRow(ListField list, Graphics g, int index, int y, int width) {
System.err.println("XXX index=" + index+ ", y=" + y + ", width=" + width);
g.setColor(Color.WHITE);
if (index < EXTRA_ROWS) {
Font i = getFont().derive(Font.ITALIC);
g.setFont(i);
g.drawText("Add Item", 0, y);
return;
}
if (index >= EXTRA_ROWS) {
MyItem item = (MyItem) myItems.getAt(index - EXTRA_ROWS);
g.drawText(item.toString(), 0, y);
g.setColor(0x333333);
// XXX why do I need to subtract 9 here?
g.drawLine(0, y-9, width, y-9);
return;
}
g.drawText(list.getEmptyString(), 0, y);
}
public Object get(ListField list, int index) {
return myItems.getAt(index);
}
public int getPreferredWidth(ListField list) {
return Display.getWidth();
}
public int indexOfList(ListField list, String prefix, int start) {
return 0;
}
}
class MyItemList extends SortedReadableList {
public MyItemList() {
super(new MyItem.MyComparator());
}
protected void doAdd(Object obj) {
super.doAdd(obj);
myList.setSize(size() + EXTRA_ROWS);
}
protected boolean doRemove(Object obj) {
myList.setSize(size() - 1 + EXTRA_ROWS);
return super.doRemove(obj);
}
}
}
class MyItem {
int _num;
String _name;
public MyItem(int num, String name) {
_num = num;
_name = name;
}
public String toString() {
return _num + ": " + _name;
}
static class MyComparator implements Comparator {
public int compare(Object obj1, Object obj2) {
MyItem item1 = (MyItem) obj1;
MyItem item2 = (MyItem) obj2;
return item1.toString().compareTo(item2.toString());
}
}
static class MyProvider implements KeywordProvider {
public String[] getKeywords(Object obj) {
MyItem item = (MyItem) obj;
return new String[]{ Integer.toString(item._num), item._name };
}
}
}
```
The produced output is:
```
[ 64,890] XXX index=0, y=9, width=360
[ 64,890] XXX index=1, y=49, width=360
[ 64,898] XXX index=2, y=89, width=360
[ 64,898] XXX index=3, y=129, width=360
[ 64,906] XXX index=4, y=169, width=360
[ 64,906] XXX index=5, y=209, width=360
```
When I try your suggestion (I use red color for your text and lines):
```
if (index >= EXTRA_ROWS) {
MyItem item = (MyItem) myItems.getAt(index - EXTRA_ROWS);
g.drawText(item.toString(), 0, y);
g.setColor(Color.RED);
g.drawText("XXX", 0, y + (list.getRowHeight() - list.getFont().getHeight())/2);
g.setColor(0x333333);
// XXX why do I need to subtract 9 here?
g.drawLine(0, y-9, width, y-9);
g.setColor(Color.RED);
g.drawLine(0, y, width, y);
return;
}
```
Then it doesn't really work - because the blue focus line does not align with your suggested (red) lines. It aligns with my (gray) lines, which means you really need to subtract -9 for some reason:

Thank you!
Alex
|
Blackberry: why is drawListRow() called with different y for ListField and KeywordFilterField
|
CC BY-SA 3.0
| null |
2011-05-17T13:55:41.077
|
2011-05-25T20:35:22.917
|
2017-05-23T11:48:22.880
| -1 | 165,071 |
[
"blackberry",
"listfield",
"draw-list"
] |
6,031,962 | 1 | 6,139,515 | null | 2 | 484 |
My control is being kept alive because of command it is bound to. How can I break this reference? This is causing a major memory leak in my application. The control is inside of a DataTemplate so I have no direct access to it.
Here is my ANTS memory profile:

How on earth do I break this connection?
|
Silverlight control not being garbage collected because of command
|
CC BY-SA 3.0
| 0 |
2011-05-17T14:02:43.253
|
2011-05-26T13:45:10.700
|
2011-05-17T15:53:25.133
| 443,602 | 443,602 |
[
"silverlight",
"memory-leaks"
] |
6,032,032 | 1 | 6,032,318 | null | 37 | 10,557 |
WPF has the [SystemParameters class](http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.aspx) that exposes a great number of system metrics. On my computer I have noticed that a normal window has a title that is 30 pixels high and a border that is 8 pixels wide. This is on Windows 7 with the Aero theme enabled:

However, `SystemParameters` return the following values:
```
SystemParameters.BorderWidth = 5
SystemParameters.CaptionHeight = 21
```
Here I have disabled the Aero theme:

Now, `SystemParameters` return the following values:
```
SystemParameters.BorderWidth = 1
SystemParameters.CaptionHeight = 18
```
How do I compute the actual observed values by using `SystemParameters`?
|
How do I compute the non-client window size in WPF?
|
CC BY-SA 3.0
| 0 |
2011-05-17T14:06:57.270
|
2020-05-29T10:01:42.947
|
2011-05-17T17:47:18.783
| 98,607 | 98,607 |
[
"c#",
".net",
"wpf",
"windows",
"winapi"
] |
6,032,385 | 1 | 6,033,308 | null | 6 | 5,055 |
I am new in WPF.
What the way to change a togglebutton behavior.

to 
with black baground and no border.
Is need to use Control Template?
|
Change custom behavior of togglebutton in WPF
|
CC BY-SA 3.0
| null |
2011-05-17T14:31:02.480
|
2011-05-17T15:34:27.217
|
2011-05-17T14:36:30.710
| 546,730 | 34,588 |
[
"wpf"
] |
6,032,858 | 1 | 6,032,999 | null | 1 | 200 |
I have noticed that in some apps they use what appears to be the the native display screen for a contact, it shows the contact photo, name, phone numbers and options to text message and add to favourites.
But it also will have some customized fields in it also like missed calls or some other non native contact information,
Here is an example screen shot taken from the Viber application:

I am quite new to iPhone development and I was wondering if this screen is made available to developers so that a contacts information can be presented from within an application with custom fields or if it is not and has to be developed from scratch?
Thanks for the help, with it I have successfully recreated the screen in a static manner, I have one more question and that is how would I make the cell that has the outgoing calls in it react to dymanic data?
So for instance there could be 10 calls there, so how do I adjust the size of the cell on the fly? And also whats the best object to use to allow the calls to be displayed? At the moment I'm using a UITextView to display the static data but I dont think this will work for dynamic data?
|
iPhone - is this screen available and customisable or do I need to create it from scratch?
|
CC BY-SA 3.0
| null |
2011-05-17T15:03:04.720
|
2011-05-19T08:46:53.280
|
2011-05-19T08:46:53.280
| 243,999 | 243,999 |
[
"iphone",
"ios",
"contacts",
"custom-fields"
] |
6,032,897 | 1 | 6,033,023 | null | 5 | 606 |
I have a botanical tree with some leaves. I want to extract the leaf A. However, leaf A stays on top of leaf B so that I could not find any method to tract the leaf A. Is there any suggestion?
Thank you very much
|
How can I extract a leaf from this image?
|
CC BY-SA 3.0
| null |
2011-05-17T15:05:34.053
|
2011-05-17T15:14:17.020
| null | null | 496,837 |
[
"matlab",
"image-processing",
"image-manipulation",
"computer-vision"
] |
6,033,005 | 1 | null | null | 2 | 499 |
I have created my own account type, like it's described [here](http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/). Everything works fine on emulator or on my LG GT-540 with standard android contacts application. In Contacts application I can see proper custom contact while editing:

But when my colleague tried this app with HTC device (with its own contacts-management application), he saw the string "company_name.program_name.android.profile" (i.e. android:accountType) instead of "GeneDroid Profile" (i.e. android:label) of my xml/account-authenticator.xml file:
```
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:accountType="com.companyname.proframname.account"
android:icon="@drawable/ic_launcher"
android:smallIcon="@drawable/geni_logo"
android:accountPreferences="@xml/account_preferences"/>
```

I cannot understand why it happens. What am I doing wrong?
|
Wrong representation of custom account
|
CC BY-SA 3.0
| null |
2011-05-17T15:12:53.847
|
2011-05-25T19:38:12.000
|
2011-05-24T23:59:10.877
| 677,022 | 467,750 |
[
"android",
"contacts",
"account"
] |
6,033,125 | 1 | null | null | 2 | 455 |
I have a query l.q. l is var scoped:
```
var l = {};
```
If I dump l:
```
writeDump(var:l, abort:true);
```
I get 
You can see that q (l.q) shows [undefined struct element]. However if I do:
```
writeDump(var:isQuery(l.q), abort:true);
```
I get yes as the output? Dumping l.q.recordCount returns 1.
If I dump l.q I get an error: java.lang.ArrayIndexOutOfBoundsException : [N/A].
This is causing me quite a headache as on my website I get variables randomly disappearing like this all the time.
Any ideas of what could be going on here? CF9.0.1 Ent running on Windows Server 2005.
|
Coldfusion: conflicting cfdump statements
|
CC BY-SA 3.0
| 0 |
2011-05-17T15:21:05.170
|
2013-11-18T12:01:04.690
|
2013-11-18T12:01:04.690
| 9,360 | 325,399 |
[
"coldfusion",
"coldfusion-9"
] |
6,033,195 | 1 | 6,033,431 | null | 1 | 1,054 |
I have to calculate dx and dy so player1 has a circular movement.

I thin it is cos and sin related !
regards
|
circular movement: simple math algorithm
|
CC BY-SA 3.0
| 0 |
2011-05-17T15:25:12.907
|
2011-05-17T16:08:44.027
| null | null | 300,675 |
[
"flash",
"math"
] |
6,033,232 | 1 | 6,034,205 | null | 0 | 598 |
I know how to use Admob in iphone apps infact I have used in many application. But I am completely unaware about from website.
Today I have registered a new account with admob.com. Now where I have to go further for publisher id ?
I have just click this link: [http://www.admob.com/my_sites/create_site](http://www.admob.com/my_sites/create_site).
Please see below screenshot. There is a field to enter Appstore URL. My application is still in development phase.
Am I at the wrong place ? Or only publisher id is required from any other place.
Please help.

|
Admob for iphone Apps?
|
CC BY-SA 3.0
| 0 |
2011-05-17T15:28:08.690
|
2011-05-17T16:42:42.403
| null | null | 213,532 |
[
"iphone",
"objective-c",
"admob",
"ads",
"adwhirl"
] |
6,033,318 | 1 | 6,035,266 | null | 1 | 1,317 |
I'm trying to create an app displaying few extra rows on the top of a list of items with a "live search" field on the top:

Of course I've tried using [a KeywordFilterField with overriden setSize()](https://stackoverflow.com/questions/5937623/displaying-extra-rows-in-a-listfield) for that at first. But this didn't work well - because I couldn't control, when and how setSize() was called by the KeywordFilterField and this has given me drawing issues (a row was not drawn when I had a keyword entered and added a new item to the list, etc.)
So I am trying to "go back to the roots" and use a (and a BasicEditField on the top) this time, because there I can control myself, when and how setSize() is called.
Below is my simplified test code - and .
The code works well, except for the filtering issue - which I will describe below.

```
package mypackage;
import java.util.*;
import net.rim.device.api.collection.*;
import net.rim.device.api.collection.util.*;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;
import net.rim.device.api.util.*;
public class MyList extends UiApplication {
public static void main(String args[]) {
MyList app = new MyList();
app.enterEventDispatcher();
}
public MyList() {
pushScreen(new MyScreen());
}
}
class MyScreen extends MainScreen {
static final int EXTRA_ROWS = 3;
BasicFilteredList myFilter = new BasicFilteredList();
Background myBg = BackgroundFactory.createSolidBackground(0x111111);
StringProvider myProvider = new StringProvider("Search");
BasicEditField myFind = new BasicEditField(USE_ALL_WIDTH) {
protected void paint(Graphics g) {
if (getTextLength() == 0) {
g.setColor(Color.LIGHTGRAY);
g.drawText(myProvider.toString(), 0, 0);
}
g.setColor(Color.BLACK);
super.paint(g);
}
};
MyItemList myItems = new MyItemList();
// add 1 row for the "* Empty *" string
ListField myList = new ListField(EXTRA_ROWS + 1) {
protected boolean navigationClick(int status, int time) {
int index = getSelectedIndex();
if (index >= EXTRA_ROWS && myItems.size() > 0) {
String str = ((MyItem) myItems.getAt(
index - EXTRA_ROWS)).toString();
Status.show("You have clicked - " + str);
}
return true;
}
};
Border myBorder = BorderFactory.createBitmapBorder(
new XYEdges(12, 12, 12, 12),
Bitmap.getBitmapResource("border.png"));
public MyScreen() {
getMainManager().setBackground(myBg);
myFind.setBorder(myBorder);
setTitle(myFind);
myItems.doAdd(new MyItem(1, "Eins"));
myItems.doAdd(new MyItem(2, "Zwei"));
myItems.doAdd(new MyItem(3, "Drei"));
myItems.doAdd(new MyItem(4, "Vier"));
myList.setCallback(new MyListFieldCallback());
add(myList);
myFilter.addDataSet(1, myItems.getElements(), "Test",
BasicFilteredList.COMPARISON_IGNORE_CASE);
}
protected boolean keyChar(char key, int status, int time) {
if (key == Characters.BACKSPACE && myFind.getTextLength() == 0) {
Status.show("Kill kill kill!");
return true;
}
if (myFind.getTextLength() > 0) {
System.err.println("XXX filter for " + myFind.getText());
}
return super.keyChar(key, status, time);
}
private class MyListFieldCallback implements ListFieldCallback {
public void drawListRow(ListField list, Graphics g, int index, int y, int width) {
Font i = getFont().derive(Font.ITALIC);
g.setColor(Color.DIMGRAY);
g.drawLine(0, y-9, width, y-9);
g.setColor(Color.WHITE);
if (index < EXTRA_ROWS) {
g.setFont(i);
g.drawText("Add Item", 0, y, DrawStyle.ELLIPSIS|DrawStyle.HCENTER, width);
return;
}
if (myItems.size() == 0) {
g.setFont(i);
g.drawText(list.getEmptyString(), 0, y, DrawStyle.ELLIPSIS|DrawStyle.HCENTER, width);
return;
}
MyItem item = (MyItem) myItems.getAt(index - EXTRA_ROWS);
g.drawText(item.toString(), 0, y, DrawStyle.ELLIPSIS|DrawStyle.HCENTER, width);
}
public Object get(ListField list, int index) {
return myItems.getAt(index);
}
public int getPreferredWidth(ListField list) {
return Display.getWidth();
}
public int indexOfList(ListField list, String prefix, int start) {
return 0;
}
}
class MyItemList extends SortedReadableList {
public MyItemList() {
super(new MyItem.MyComparator());
}
protected void doAdd(Object obj) {
super.doAdd(obj);
myList.setSize(size() + EXTRA_ROWS);
}
protected boolean doRemove(Object obj) {
// if the list is empty, add 1 row for "* Empty *" string
int size = (size() == 0 ? EXTRA_ROWS + 1 : size() - 1 + EXTRA_ROWS);
myList.setSize(size);
return super.doRemove(obj);
}
protected Object[] getElements() {
return super.getElements();
}
}
}
class MyItem {
int _num;
String _name;
public MyItem(int num, String name) {
_num = num;
_name = name;
}
public String toString() {
return _num + ": " + _name;
}
static class MyComparator implements Comparator {
public int compare(Object obj1, Object obj2) {
MyItem item1 = (MyItem) obj1;
MyItem item2 = (MyItem) obj2;
return item1.toString().compareTo(item2.toString());
}
}
static class MyProvider implements KeywordProvider {
public String[] getKeywords(Object obj) {
MyItem item = (MyItem) obj;
return new String[]{ Integer.toString(item._num), item._name };
}
}
}
```
My problem is that I do not know how to add filtering.
For example when a user enters "E" into myFind, my code will detect this event in the keyChar() and also I understand, that I will have to call myList.setSize(EXTRA_ROWS + 1) because there will be 1 filtered result.
But how do I filter the items displayed by myList, how to implement this?
Maybe I could use [BasicFilteredList](http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/collection/util/BasicFilteredList.html) and its method
```
public void addDataSet(int id,
Object[] objects,
String name,
long style)
```
but I'm not sure how to apply it here?
|
Blackberry: how to filter rows represented by a ListField?
|
CC BY-SA 3.0
| 0 |
2011-05-17T15:35:20.747
|
2014-10-30T12:15:56.903
|
2017-05-23T12:01:16.000
| -1 | 165,071 |
[
"blackberry",
"collections",
"filtering",
"listfield"
] |
6,033,328 | 1 | 6,036,508 | null | 1 | 266 |
I am getting this one error when I use the Mozilla validator:

This is the JS file:
```
const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;
// Version changes:
// It used to get the lists from a PHP file, but that was putting too much of a strain on the servers
// now it uses xml files.
// Randomizes the servers to load balance
// Mozilla editor suggested no synchronous file gets, so changed it to asynchronous
// Added one more server to help with the updates (Ilovemafiaafire.net)
// Edited some redirect code that some idiots were spreading FUD about.
var xmlDoc = null;
var quickFilter_100_count_redirect_url='http://www.mafiaafire.com/help_us.php';
var countXmlUrl = 0;
//var xmlUrl = 'http://elxotica.com/xml-update/xml-list.php';
var xmlUrl = new Array(4);
xmlUrl[0] = 'http://mafiaafire.com/xml-update/mf_xml_list.xml';
xmlUrl[1] = 'http://ifucksexygirls.com/xml-update/mf_xml_list.xml';
xmlUrl[2] = 'http://ezee.se/xml-update/mf_xml_list.xml';
xmlUrl[3] = 'http://ilovemafiaafire.net/mf_xml_list.xml';
xmlUrl.sort(function() {return 0.5 - Math.random()})
var realXmlUrl = xmlUrl[countXmlUrl];
var notificationUrl = 'http://mafiaafire.com/xml-update/click_here_for_details.php';
var root_node = null;
var second_node = null;
var timervar = null;
var mafiaafireFilterUrl = '';
//Calling the interface for preferences
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var quickfilter_mafiaafire =
{
// get the domain name from the current url
get_domain_name:function()
{
var urlbar = window.content.location.href;
domain_name_parts = urlbar.match(/:\/\/(.[^/]+)/)[1].split('.');
if(domain_name_parts.length >= 3){
domain_name_parts[0] = '';
}
var dn = domain_name_parts.join('.');
if(dn.indexOf('.') == 0)
return dn.substr(1);
else
return dn;
},
// send ajax request to server for loading the xml
request_xml:function ()
{
//alert(countXmlUrl);
http_request = false;
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
if (!http_request)
{
return false;
}
http_request.onreadystatechange = this.response_xml;
http_request.open('GET', realXmlUrl, true);
http_request.send(null);
xmlDoc = http_request.responseXML;
},
// receive the ajax response
response_xml:function ()
{
if (http_request.readyState == 4)
{
if(http_request.status == 404 && countXmlUrl<=3)
{
countXmlUrl++;
//alert(xmlUrl[countXmlUrl]);
realXmlUrl = xmlUrl[countXmlUrl];
quickfilter_mafiaafire.request_xml();
}
if (http_request.status == 200)
{
xmlDoc = http_request.responseXML;
}
}
},
filterUrl:function()
{
var urlBar = window.content.location.href;
//check if url bar is blank or empty
if (urlBar == 'about:blank' || urlBar == '' || urlBar.indexOf('http')<0)
return false;
//1. get domain
processing_domain = this.get_domain_name();
//alert(processing_domain);
//Couldn't fetch the XML config, so returning gracefully
if(xmlDoc == null)
return false;
try
{
root_node = '';
// Parsing the xml
root_node = xmlDoc.getElementsByTagName('filter');
for(i=0;i<=root_node.length;i++)
{
second_node = '';
second_node = root_node[i];
if(second_node.getElementsByTagName('realdomain')[0].firstChild.nodeValue == processing_domain)
{
this.notificationBox();
mafiaafireFilterUrl = '';
mafiaafireFilterUrl = second_node.getElementsByTagName('filterdomain')[0].firstChild.nodeValue;
timervar = setTimeout("quickfilter_mafiaafire.redirectToAnotherUrl()",1500);
//window.content.location.href = second_node.getElementsByTagName('filterdomain')[0].firstChild.nodeValue;
//this.redirectToAnotherUrl(this.filterUrl);
//timervar = setInterval("quickfilter_mafiaafire.redirectToAnotherUrl(quickfilter_mafiaafire.filterUrl)",1000);
}
}
}
catch(e){
//alert(e.toString());
}
},
// This function is called for showing the notification
notificationBox:function()
{
try{
// Firefox default notification interface
var notificationBox = gBrowser.getNotificationBox();
notificationBox.removeAllNotifications(false);
notificationBox.appendNotification('You are being redirected', "", "chrome://quickfilter/content/filter.png", notificationBox.PRIORITY_INFO_HIGH, [{
accessKey: '',
label: ' click here for details',
callback: function() {
// Showing the notification Bar
window.content.location.href = notificationUrl;
}
}]);
}catch(e){}
},
redirectToAnotherUrl:function()
{
var qucikFilterRedirectCount = '';
//Read the value from preferrences
qucikFilterRedirectCount = prefManager.getCharPref("extensions.quickfilter_redirect_count");
//alert(qucikFilterRedirectCount);
if(qucikFilterRedirectCount % 15 == 0)
{
// Disable for now, can comment this entire section but this is the easier fix incase we decide to enable it later
//window.content.location.href = quickFilter_100_count_redirect_url+"?d="+mafiaafireFilterUrl;
window.content.location.href = mafiaafireFilterUrl;
}
else
{
window.content.location.href = mafiaafireFilterUrl;
}
qucikFilterRedirectCount = parseInt(qucikFilterRedirectCount)+1;
prefManager.setCharPref("extensions.quickfilter_redirect_count",qucikFilterRedirectCount);
}
}
var quickfilter_urlBarListener = {
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
//Called when the location of the window being watched changes
onLocationChange: function(aProgress, aRequest, aURI)
{
// This fires when the location bar changes; that is load event is confirmed
// or when the user switches tabs. If you use myListener for more than one tab/window,
// use aProgress.DOMWindow to obtain the tab/window which triggered the change.
quickfilter_mafiaafire.filterUrl();
},
//Notification indicating the state has changed for one of the requests associated with aWebProgress.
onStateChange: function(aProgress, aRequest, aFlag, aStatus)
{
if(aFlag & STATE_START)
{
// This fires when the load event is initiated
}
if(aFlag & STATE_STOP)
{
// This fires when the load finishes
}
},
//Notification that the progress has changed for one of the requests associated with aWebProgress
onProgressChange: function() {},
//Notification that the status of a request has changed. The status message is intended to be displayed to the user.
onStatusChange: function() {},
//Notification called for security progress
onSecurityChange: function() {},
onLinkIconAvailable: function() {}
};
var quickfilter_extension = {
init: function()
{
//Initiating the progressListerner
gBrowser.addProgressListener(quickfilter_urlBarListener, Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
//Load the block list xml form server
quickfilter_mafiaafire.request_xml();
},
uninit: function()
{
// Remove the progressListerner
gBrowser.removeProgressListener(quickfilter_urlBarListener);
}
};
// window.addEventListener("load", function () { TheGreatTest1.onFirefoxLoad(); }, false);
// this function is Called on window Onload event
window.addEventListener("load", function(e) {
quickfilter_extension.init();
}, false);
window.addEventListener("unload", function(e) {
quickfilter_extension.uninit();
}, false);
```
Can you tell me how to squash that error please?
|
Firefox, Mozilla validator error
|
CC BY-SA 3.0
| null |
2011-05-17T15:36:09.233
|
2012-06-12T19:56:56.880
|
2012-06-12T19:56:56.880
| 785,541 | 604,843 |
[
"firefox",
"firefox-addon",
"mozilla"
] |
6,033,944 | 1 | 6,284,993 | null | 30 | 2,903 |
# Background
I, like scores of programmers before me, am working on an application that deals with money. I'm relatively new to Cocoa programming, but after reading through the manuals I decided that I would try to use Core Data because it provides a number of features that I want and save me from re-inventing the wheel. Anyway, my question doesn't have anything to do with whether or not I should use Core Data: it has to do with the behavior of Core Data and XCode themselves.
I filed a bug report with Apple and was informed that it is a duplicate of problem ID 9405079. They are aware of the issue, but I have no idea when or if they are going to fix it.
# The Problem
For some reason that I cannot understand, (I'm using Decimal properties for [the reasons described here](https://stackoverflow.com/questions/421463/should-i-use-nsdecimalnumber-to-deal-with-money/422513#422513).)
Assume that I have a Core Data entity with a Decimal attribute named `value` (this is merely for illustration; I've used other attribute names, as well). I want it to have a value greater than 0, but because XCode will only allow me to specify a minimum value (inclusive), I set equal to `0.01`. Much to my surprise, this results in a validation predicate of `SELF >= 0`! I get the same result when I change the minimum value: all fractional values are truncated (the minimum value is floored). The maximum value has the same behavior.
By way of illustration, the `value` property in the following screenshot will result in validation predicates of `SELF >= 0` and `SELF <= 1`.

Strangely enough, though, , the validation predicates will change to `SELF >= 0.5` and `SELF <= 1.2`, as expected. Stranger still, if I create my own data model following the [Core Data Utility Tutorial](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html), the validation predicates are set correctly .
# Original Workaround
Since I can't find any way to fix this problem in XCode's managed object model editor, I have added the following code—indicated by the `begin workaround` and `end workaround` comments—to my application delegate's `managedObjectModel` method (this is the same application delegate that XCode provides by default when you create a new project that uses Core Data). Note that I am adding a constraint to keep the `Transaction` entity's `amount` property greater than 0.
```
- (NSManagedObjectModel *)managedObjectModel {
if (managedObjectModel) return managedObjectModel;
managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
// begin workaround
NSEntityDescription *transactionEntity = [[managedObjectModel entitiesByName] objectForKey:@"Transaction"];
NSAttributeDescription *amountAttribute = [[transactionEntity attributesByName] objectForKey:@"amount"];
[amountAttribute setValidationPredicates:[NSArray arrayWithObject:[NSPredicate predicateWithFormat:@"SELF > 0"]]
withValidationWarnings:[NSArray arrayWithObject:@"amount is not greater than 0"]];
// end workaround
return managedObjectModel;
}
```
# Questions
1. Is this really a bug in how XCode generates validation predicates for decimal properties in managed object models for Core Data?
2. If so, is there a better way to work around it than the ones I have described here?
# Repro Code
You should be able to reproduce this issue with the following sample code for a `DebugController` class, which prints out the constraints on every property in a managed object model to a label. This code makes the following assumptions.
- `DecimalTest_AppDelegate`- `managedObjectContext`-
Take the following steps to use this code.
1. Instantiate the DebugController in Interface Builder.
2. Connect the controller's appDelegate outlet to your application delegate.
3. Add a wrapping label (NSTextField) to your user interface and connect the controller's debugLabel outlet to it.
4. Add a button to your user interface and connect its selector to the controller's updateLabel action.
5. Launch your application and press the button connected to the updateLabel action. This prints your managed object model's constraints to debugLabel and should illustrate the behavior that I've described here.
```
#import <Cocoa/Cocoa.h>
// TODO: Replace 'DecimalTest_AppDelegate' with the name of your application delegate
#import "DecimalTest_AppDelegate.h"
@interface DebugController : NSObject {
NSManagedObjectContext *context;
// TODO: Replace 'DecimalTest_AppDelegate' with the name of your application delegate
IBOutlet DecimalTest_AppDelegate *appDelegate;
IBOutlet NSTextField *debugLabel;
}
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;
- (IBAction)updateLabel:sender;
@end
```
```
#import "DebugController.h"
@implementation DebugController
- (NSManagedObjectContext *)managedObjectContext
{
if (context == nil)
{
context = [[NSManagedObjectContext alloc] init];
[context setPersistentStoreCoordinator:[[appDelegate managedObjectContext] persistentStoreCoordinator]];
}
return context;
}
- (IBAction)updateLabel:sender
{
NSString *debugString = @"";
// TODO: Replace 'Wallet' with the name of your managed object model
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Wallet" inManagedObjectContext:[self managedObjectContext]];
NSArray *properties = [entity properties];
for (NSAttributeDescription *attribute in properties)
{
debugString = [debugString stringByAppendingFormat:@"\n%@: \n", [attribute name]];
NSArray *validationPredicates = [attribute validationPredicates];
for (NSPredicate *predicate in validationPredicates)
{
debugString = [debugString stringByAppendingFormat:@"%@\n", [predicate predicateFormat]];
}
}
// NSPredicate *validationPredicate = [validationPredicates objectAtIndex:1];
[debugLabel setStringValue:debugString];
}
@end
```
Thanks everyone.
|
Does XCode Floor "Min Value" and "Max Value" for Core Data Decimal Attributes?
|
CC BY-SA 3.0
| 0 |
2011-05-17T16:19:34.850
|
2011-07-06T06:33:39.670
|
2017-05-23T12:19:48.617
| -1 | 709,202 |
[
"objective-c",
"xcode",
"cocoa",
"core-data"
] |
6,034,336 | 1 | null | null | 1 | 523 |
I'm trying to use the Profiler for the first time so I don't know much about it. But it doesn't seem to work.
I run my project under profiler, it says it is running, but no window shows up. Nothing. I can see the project's icon down there but I see no window at all.
Can this be cause by the fact that I'm using Flex 4.5? Or am I missing something?
Updated: Here's a screenshot of the Profiler running the an app. You can the app in the dock and it shows its live objects, but I don't see the apps' window and cannot interact with it. The app is just a simple 400x400 window with some black shapes in it.

Thanks in advance,
Nuno
|
Does Flash Builder 4 Profiler work with a Flex 4.5 project?
|
CC BY-SA 3.0
| null |
2011-05-17T16:54:26.243
|
2011-10-18T23:31:19.430
|
2011-05-18T13:10:48.120
| 202,545 | 202,545 |
[
"apache-flex",
"flex4",
"profiler"
] |
6,034,580 | 1 | 6,039,629 | null | 1 | 3,806 |
I'm testing this code that I found somewhere on the web. I also tried code that I found in [this](https://stackoverflow.com/questions/2198470/javascript-uploading-a-file-without-a-file) answer, but nothing seems to be working as I want it to. Here is my javascript:
```
function fileUpload(url, fileData, fileName)
{
var fileSize = fileData.length,
boundary = "---------------------------7da24f2e50046",
xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
// simulate a file MIME POST request.
xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary);
xhr.setRequestHeader("Content-Length", fileSize);
var body = "--" + boundary + "\r\n";
body += "Content-Disposition: form-data; name='file'; filename='" + fileName + "'\r\n";
body += "Content-Type: application/octet-stream\r\n\r\n";
body += fileData + "\r\n";
body += "--" + boundary + "--";
alert(body);
xhr.onreadystatechange = function ()
{
if (xhr.readyState == 4 && xhr.status == 200)
{
alert(xhr.responseText);
}
}
xhr.send(body);
return true;
}
function send()
{
fileUpload("receive.php", "abcdefg", "foo.txt");
}
```
And this is my "receive.php" file:
```
<html>
<head>
</head>
<body>
<?php
foreach ($_POST as $var => $value) echo "$var = $value<br>n";
?>
</body>
</html>
```
I'm getting the "receive.php" HTML back but without anything being `echo`ed. But if I actually send a file from an HTML form it `echo`s the file name.
I'm also trying to use Fiddler2 to intercept some real file uploads to see what the POST message is, but I can't seem to find the file content anywhere in the message. I figured the file's content might be encoded somehow so I tried sending a pretty large file, about 2MB, to see if I can find some big chunk of data anywhere in the message being sent, but I didn't. I just see the header and the file name.
Am I missing something?
I really feel I'm missing something obvious. Here is a screenshot of Fiddler2 when I upload a real file:

The content length is the size of the string at the bottom, which doesn't include the file's content but just the file name. The function I'm using and every javascript code that does what I'm trying to do set the content length to a string that includes the file's content and the boundary and other information as you can see in my code above. So my function is creating a POST message that has a different structure that the POST message that Fiddler is showing me.
And where in the world is the file content. Another weird thing is that when I send a 2MB size file from IE, the page navigates to the page that receives the file almost instantaneously, as if nothing is being really sent. I'm very confused.
I messed up. There was something wrong with the FORM I was using to test uploads. I'm using another form and now I can see the file contents in Fiddler. I think is probably because I was missing the "enctype='multipart/form-data'" So now I can see why is my javascript not working. I'll let you know when I find a solution.
|
Emulate a type="file" INPUT with XMLHttpRequest
|
CC BY-SA 3.0
| 0 |
2011-05-17T17:16:26.763
|
2011-05-18T03:45:10.937
|
2017-05-23T10:32:35.693
| -1 | 1,219,414 |
[
"php",
"javascript",
"post",
"fiddler"
] |
6,034,605 | 1 | null | null | 0 | 1,170 |
I have a grid-like view with QPushButtons. The buttons content isn't static, so the column sizes expands dynamically. And I want same column size for each column for aesthetical reasons.
Now I'm using an adjust_sizes function after showing the widget, because I noticed If I call it before showing the widget, nothing changes. But my solutions seems ugly to me. Is there a better way for that?
My function:
```
def adjust_sizes(self):
max_width=0
for i in self.buttons:
if i.geometry().width() > max_width :
max_width=i.geometry().width()
for i in self.buttons: i.setMinimumSize(max_width,0)
```
And thats how I use it:
```
g=launcher()
g.show()
g.adjust_sizes()
```
Is there a better way for doing that?
As for clarify here is the desired screenshots(Look at Raceyman's answer):
Desired Look:

Here is what I get:

My System:
Arch Linux x86_64, Python 3.2 or 2.7.1, PyQt 4.8.4, Qt 4.7.3
|
Connecting QPushButton's sizes
|
CC BY-SA 3.0
| null |
2011-05-17T17:17:37.213
|
2011-05-31T20:09:34.287
|
2011-05-31T20:09:34.287
| 472,416 | 472,416 |
[
"python",
"pyqt"
] |
6,035,076 | 1 | 6,144,915 | null | 0 | 162 |
Hard to put in words, so here is an screen of this in action:

As the text says, it "stopped at breakpoint". The problem is, that if case is false. It shouldn't break, since the breakpoint is within the if case.
I tried putting the int a = 1; and a = 2 around the BriefLog (which is a NSLog style macro) as sometimes it gets confused about lines, but no luck. Any idea what's up with this? Making debugging really hard cause this method is called quite a lot. :(
|
Xcode breakpoint triggers despite wrapping if case being false
|
CC BY-SA 3.0
| null |
2011-05-17T17:59:43.630
|
2011-05-26T20:52:16.430
| null | null | 271,166 |
[
"xcode",
"ios",
"debugging",
"xcode4",
"breakpoints"
] |
6,035,064 | 1 | null | null | 1 | 661 |
I have an `NSOperation` which updates the apps data. This operation has its own context and changes are passed back to the context on the main thread via the `contextDidSave` notification.
The update operation deletes objects. These deletions are inadvertently causing a crash. The crash occurs when the main thread is reloading a `UITableView` at the same time that the update context is saving. The datasource for the tableview is backed by a `NSFetchedResultsController`.
Neither CoreData or UIKit output any logging. The crash is a SIG_ABRT that occurs in `tableView:cellForRowAtIndexPath:` while accessing an attribute of managedObject. Here's the result of a successful update. You can see that the table is populate once, then the context saves, which in turn causes the table to be reloaded:
```
tableView:numberOfRowsInSection: rowCount = 29
tableView:cellForRowAtIndexPath: row: 0
tableView:cellForRowAtIndexPath: row: 1
tableView:cellForRowAtIndexPath: row: 2
tableView:cellForRowAtIndexPath: row: 3
tableView:cellForRowAtIndexPath: row: 4
tableView:cellForRowAtIndexPath: row: 5
tableView:cellForRowAtIndexPath: row: 6
tableView:cellForRowAtIndexPath: row: 7
tableView:cellForRowAtIndexPath: row: 8
tableView:cellForRowAtIndexPath: row: 9
Will saved update context
Did saved update context
Will merge update context
tableView:numberOfRowsInSection: rowCount = 58
Did merge update context
tableView:numberOfRowsInSection: rowCount = 29
tableView:cellForRowAtIndexPath: row: 0
tableView:cellForRowAtIndexPath: row: 1
tableView:cellForRowAtIndexPath: row: 2
tableView:cellForRowAtIndexPath: row: 3
tableView:cellForRowAtIndexPath: row: 4
tableView:cellForRowAtIndexPath: row: 5
tableView:cellForRowAtIndexPath: row: 6
tableView:cellForRowAtIndexPath: row: 7
tableView:cellForRowAtIndexPath: row: 8
tableView:cellForRowAtIndexPath: row: 9
```
And here's an the output when a crash occurred:
```
tableView:numberOfRowsInSection: rowCount = 29
tableView:cellForRowAtIndexPath: row: 0
tableView:cellForRowAtIndexPath: row: 1
tableView:cellForRowAtIndexPath: row: 2
Will saved update context
tableView:cellForRowAtIndexPath: row: 3
tableView:cellForRowAtIndexPath: row: 4
tableView:cellForRowAtIndexPath: row: 5
```

I can think of two potential solutions:
1. lock the persitentStoreCoordinator while the table view is refreshing. (This could be done by subclassing UITableView and overriding reloadData to provide a location to lock and unlock the store)
2. Defer the deletion to a later date, eg, when the app quits. (This could be done by adding a isStale attrib to the entities or by creating a new Trash entity and adding objects to that.)
However, both of these solutions seem really hacky. Am I missing something? My first though was to try and make the `NSFetchedResultsController` pre fetch all objects, but this isn't possible. Another possible solution was to lock the store when using `controllerDidChangeContent:` but the problem still occurs when the table reload is not triggered by the fetchedResultsController.
|
Core Data saving race condition bug
|
CC BY-SA 3.0
| null |
2011-05-17T17:59:13.113
|
2011-05-17T22:09:36.960
|
2011-05-17T22:09:36.960
| 2,799 | 2,799 |
[
"multithreading",
"ios",
"core-data",
"concurrency"
] |
6,035,092 | 1 | null | null | 1 | 457 |
I have a SQL database that looks like this:
With this database...
If I have a product, say a cotton shirt and this product is available in three options, say Size, Colour and Long or Short sleeves.
From my CMS I say the product is available in the following:
Large - White - Long Sleeves
Large - Green - Long Sleeves
Large - Green - Short Sleeves
Small - White - Long Sleeves
So on the front end of my site (in Javascript) I can say when Large is checked, enable White & Green check boxes. But when Small is checked, I need to only enable White check box etc.
The ideal results would look like this:
dependencies['Large'] = [ White, Green ]
dependencies['Large, White'] = [ Long Sleeves ]
dependencies['Large, Green'] = [ Long Sleeves, Short Sleeves ]
dependencies['Small'] = [ White ]
dependencies['Small, White'] = [ Long Sleeves ]
What might the SQL look like to achieve this?
Very grateful of any help
Thank you
|
SQL Product Combinations
|
CC BY-SA 3.0
| 0 |
2011-05-17T18:00:51.563
|
2013-02-03T17:11:54.660
|
2013-02-03T17:11:54.660
| 394,322 | 513,450 |
[
"sql"
] |
6,035,210 | 1 | 6,035,294 | null | 4 | 2,095 |
I would like to add a menu button in the System bar of Android 3.0, attached is a picture of the Firefox app on Android 3.0 which gives the system bar menu button and on clicking the button you see 4 options(Site Options, Preferences, Add-ons, Downloads). I would like to know how do I add this button(marked in red) in the system bar and also its corresponding options.

P.S: I have already tried adding the methods `nCreateOptionsMenu(Menu menu)` and `onOptionsItemSelected(MenuItem item)`, but these methods give me menu button in the action bar, which I dont' want.
Thanks
|
Menu in System bar of Android 3.0
|
CC BY-SA 3.0
| 0 |
2011-05-17T18:11:24.207
|
2011-05-29T07:36:53.983
|
2011-05-29T07:36:53.983
| 750,987 | 402,637 |
[
"java",
"android",
"android-3.0-honeycomb"
] |
6,035,815 | 1 | 6,036,140 | null | 2 | 1,401 |
I want to sort the items inside column of ListView, i already made it, but... i can't made it with the type of data in column (see picture), someone knows the way for do it?

|
How to sort a listview column that contains file size data? C#
|
CC BY-SA 3.0
| 0 |
2011-05-17T19:06:07.660
|
2012-07-02T06:00:43.017
|
2011-05-18T04:20:29.747
| 362,218 | 744,159 |
[
"c#",
"winforms",
"sorting",
"listview"
] |
6,036,119 | 1 | 6,036,250 | null | 4 | 9,266 |
I am not a CSS guy as you can see and I need little help on how to make this div with two images, like the drawing below

|
How to position two images in opposite corners of one div
|
CC BY-SA 3.0
| 0 |
2011-05-17T19:32:21.780
|
2022-05-27T12:37:09.610
|
2011-05-17T19:48:02.137
| 669,044 | 275,390 |
[
"css",
"image",
"positioning"
] |
6,036,194 | 1 | null | null | 0 | 2,871 |
Could someone tell me the how to draw the differences in a sequence diagram with the following C++ code example. I tried to be as clear as possible:)
## main
```
#include "classa.h"
int main()
{
ClassA a;
return 0;
}
```
## classa.h
```
#ifndef CLASSA_H
#define CLASSA_H
#include "classb.h"
class ClassA
{
public:
ClassA();
~ClassA();
private:
ClassB *var1;
ClassB var2;
};
#endif // CLASSA_H
```
## classb.h
```
#ifndef CLASSB_H
#define CLASSB_H
class ClassB
{
public:
ClassB();
void test();
};
#endif // CLASSB_H
```
## classa.cpp
```
#include "classa.h"
ClassA::ClassA()
{
var1 = new ClassB;
var1->test();
var2.test();
}
ClassA::~ClassA()
{
delete var1;
}
```
## classb.ccp
```
#include "classb.h"
ClassB::ClassB()
{
}
void ClassB::test()
{
//Here some code
}
```
I Think the image below is used for the new operator (var1), but how is var2 drawn?

|
Uml Sequence Diagram: Drawing new operator in comparison with default constructor
|
CC BY-SA 3.0
| null |
2011-05-17T19:39:29.363
|
2011-05-17T21:03:20.313
|
2011-05-17T21:03:20.313
| 528,724 | 758,010 |
[
"c++",
"constructor",
"uml",
"sequence-diagram",
"new-operator"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.