Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,515,185 | 1 | 5,515,749 | null | 0 | 660 |
I am fighting with myself trying to model a DB to fulfill certain requirements.
- - - - - -
Here are four possibilities that I have come up with. As I said I don't really know in what direction I should go. It might be that none of my options are ideal. I would appreciate any feedback that can help sort this out.
Thanks

|
Subtype / SuperType Relationships: How to fulfill these requirements
|
CC BY-SA 2.5
| null |
2011-04-01T15:03:10.433
|
2011-04-01T15:50:08.333
| null | null | 527,298 |
[
"database",
"relational-database",
"database-schema",
"database-design"
] |
5,515,174 | 1 | 5,515,296 | null | 13 | 28,250 |
I am trying to create a TabeLayout with a grid of CheckBoxes. Across the top are 2 headers, and each additional row consists of a label and 2 CheckBoxes. I would like the table to fill all available space, the first column to be oriented to the left, and the CheckBoxes and their headers to be centered within their columns. In the below layout, the headers appear centered properly, but the CheckBoxes are not. I added a background color to one of the CheckBoxes, this demonstrates that the CheckBox actually grew to fill its column (which is why it won't center as desired); despite the "wrap_content" layout param.
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TableLayout
android:stretchColumns="1,2"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView
android:text=""
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<TextView
android:text="First category"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<TextView
android:text="2nd category"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</TableRow>
<TableRow>
<TextView
android:text="Row 1: "
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<CheckBox
android:background="#FF001122"
android:layout_height="50dip"
android:layout_width="wrap_content"
android:gravity="center_horizontal">
</CheckBox>
<CheckBox
android:layout_height="50dip"
android:layout_width="wrap_content"
android:gravity="center_horizontal">
</CheckBox>
</TableRow>
</TableLayout>
</LinearLayout>
```

|
Android: how to center view within column of TableLayout?
|
CC BY-SA 2.5
| 0 |
2011-04-01T15:02:15.290
|
2015-02-11T10:19:08.040
| null | null | 426,493 |
[
"android",
"tablelayout"
] |
5,515,192 | 1 | 5,516,117 | null | 2 | 2,000 |
I dont quite get the layout of my List View Item doesnt show like I want it to.
I hope somone would give me some hints since i cannot make it work for quite some time now.
What i want is as follows:

Here is my approach:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="20dip"
android:padding="6dip">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="3dip">
<TextView
android:id="@+id/nametext"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="7dip">
<ImageView
android:id="@+id/photo"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent">
<TextView
android:id="@+id/toptext"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/middletext"
android:singleLine="true"
android:ellipsize="marquee"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/bottomtext"
android:singleLine="true"
android:ellipsize="marquee"
/>
</LinearLayout>
<ImageView
android:id="@+id/stars"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="6dip"
android:src="@drawable/icon" />
</LinearLayout>
```
Any help would be appreciated.
I already tried different sizes and a RelativeLayout. No change.
It doesnt look anythik like i thought it should.
edit three blanks missing
edit2 added pic
|
Android Custom ListViewItem Layout
|
CC BY-SA 2.5
| 0 |
2011-04-01T15:04:06.127
|
2011-04-01T16:36:27.420
|
2011-04-01T15:31:26.197
| 423,862 | 423,862 |
[
"java",
"android",
"xml",
"intellij-idea"
] |
5,515,268 | 1 | null | null | 0 | 947 |
I want to put a ASP.NET button when the dropdownlist checklist opens. I am using the [jQuery-UI dropdownlist](http://dropdown-checklist.googlecode.com/svn/trunk/doc/dropdownchecklist.html) checklist. There is an example of what I want below.
Any help is appreciated, thanks.

|
Add custom button to jquery dropdown checklist
|
CC BY-SA 2.5
| null |
2011-04-01T15:10:18.913
|
2011-04-01T19:16:13.020
|
2011-04-01T19:16:13.020
| 9,453 | 69,963 |
[
"jquery",
"asp.net",
"jquery-ui",
"drop-down-menu"
] |
5,515,417 | 1 | 5,515,546 | null | 0 | 197 |

(1) How does flash animation work? What's the difference between flash animation and pure JavaScript animation? And I heard about HTML5?
(2) How does external action-script files (*.as) work? how do they work together along with .fla file to make the final swf file?
I have some basic understanding of HTML/CSS/JAVASCRIPT/XML stuff, but I want a little bit more detailed explanation with some very simple and intuitive example is highly appreciated!!
Noted with thanks!!
|
Very Basic Flash Animation Issues, Please Help!
|
CC BY-SA 2.5
| null |
2011-04-01T15:23:34.757
|
2011-04-01T16:23:54.250
| null | null | 577,363 |
[
"flash",
"actionscript",
"animation"
] |
5,515,522 | 1 | 5,516,027 | null | 6 | 12,626 |
In my App I want to disable the Copy/Paste/Cut of contents that are showed by a UIWebView object. To achieve this, I created a UIWebView subclass and overrode the `- (BOOL)canPerformAction:(SEL)action withSender:(id)sender` method:
```
#pragma mark - UIResponderStandardEditActions
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(copy:) ||
action == @selector(paste:)||
action == @selector(cut:)) {
return _copyCutAndPasteEnabled;
}
return [super canPerformAction:action withSender:sender];
}
```
Now the user no longer can make such operations, however the UIWebView still shows the "selection rectangle", as you can see in the following screenshot:

NOTE: The content being showed in the UIWebView is not HTML pages. I'm showing document files (PDF, DOC, PPT), loaded from a file using:
```
NSURL *fileURL = [NSURL fileURLWithPath:<document file path..>];
NSURLRequest *fileRequest = [NSURLRequest requestWithURL:fileURL];
[<uiwebView> loadRequest:fileRequest];
```
Is there any way to disable/hide this selection rectangle feature too?
[]s,
|
UIWebView without Copy/Paste and selection rectangle when showing documents
|
CC BY-SA 3.0
| 0 |
2011-04-01T15:32:07.543
|
2014-01-01T22:35:05.630
|
2011-04-09T19:35:00.567
| 151,883 | 151,883 |
[
"iphone",
"ipad",
"uiwebview",
"selection",
"uiresponder"
] |
5,515,617 | 1 | 5,551,925 | null | 7 | 1,465 |
In my app users choose images and program lets users to make changes on images. Since there are a lot of different android devices out there my program crashes on some of devices which less heap size. I want to calculate the best fit dimensions for user's phone so it won't crash because of VM budget. I have added a screenshot from "Picsay Pro" which is making exactly what i am looking for. I do know about the "BitmapFactory.Options" my only problem is to find a way to decide image dimensions which won't let crash the app because of VM budget.

|
How to choose optimum image size to not exceed VM budget?
|
CC BY-SA 2.5
| 0 |
2011-04-01T15:38:32.867
|
2012-10-31T20:53:15.470
| null | null | 426,815 |
[
"android",
"image",
"memory",
"bitmap",
"virtual-machine"
] |
5,515,791 | 1 | null | null | 4 | 367 |
Crunch crunch.
Using the calculations from [Getting End Point in ArcSegment with Start X/Y and Start+Sweep Angles](https://stackoverflow.com/questions/5441061/getting-end-point-in-arcsegment-with-start-x-y-and-startsweep-angles), how could I scrunchify or inflate(-ify) angles.
See images below. Green box is original. The yellow lines depict what the scrunchy or inflated start/end angle should become, but red line is if the original angle of start=169, end=293 is maintained on the scrunched or inflated elliptical arcs.
I need a way to figure out how to create the new angles of start/end based off the original values in the green box and the height/width/xRadius/yRadius values in the blue and orange boxes.

Does anyone know the calculation to figure out what the new angle should be?
|
How to Scrunchify Angles?
|
CC BY-SA 2.5
| null |
2011-04-01T15:53:54.480
|
2013-03-08T18:11:22.210
|
2020-06-20T09:12:55.060
| -1 | 353,716 |
[
".net",
"wpf",
"geometry",
"drawing",
"angle"
] |
5,515,898 | 1 | 5,515,981 | null | 1 | 549 |
I am using tiny MCE as editor. As you can see in image below from google blogger when ever you mouse over an image it shows up that div below image which is having "Small","Medium","Large" options .Any advice / samples how will I be able to do with JQuery ?

|
Attach Div to Image on mouse over
|
CC BY-SA 2.5
| null |
2011-04-01T16:02:01.337
|
2011-04-01T16:08:55.913
| null | null | 608,576 |
[
"jquery",
"tinymce"
] |
5,515,957 | 1 | 5,517,387 | null | 0 | 1,393 |
When i try to stretch a div 100% there is a little line at the end in iOS and Android. Here's a pic for better view:

I searched all over the net but i didn't find a solution.
```
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=0.666" />
<style>
html, body {
position:relative;
height:100%;
width:100%;
padding:0;
margin:0;
overflow-x:hidden;
}
header {
width: 100%;
background: red;
height: 50px;
display: block;
margin: 0;
padding: 0;
overflow-x:hidden;
}
</style>
</head>
<body>
<header>asdasd</header>
</body>
</html>
```
|
CSS android and iOS problem
|
CC BY-SA 2.5
| null |
2011-04-01T16:06:51.400
|
2011-06-13T05:32:29.100
|
2011-04-01T17:50:50.947
| 256,728 | 687,918 |
[
"android",
"css",
"ios",
"mobile",
"mobile-safari"
] |
5,516,066 | 1 | 5,516,116 | null | 1 | 1,512 |
in my app, I have buttons with icons. The icons are provided as PNG images in the three densities in drawable-ldpi-v4/, drawable/ and drawable-hdpi-v4/. Here's a sample:

Each icon is displayed in an ImageButton:
```
<ImageButton style="@style/Shortcut" android:id="@+id/open_button"
android:src="@drawable/shortcut_open" android:layout_marginRight="4dp"/>
```
Where the `Shortcut` style is:
```
<style name="Shortcut">
<item name="android:layout_width">65dp</item>
<item name="android:layout_height">45dp</item>
<item name="android:scaleType">center</item>
<item name="android:background">@drawable/shortcut_background</item>
</style>
```
However, on certain devices/platform versions, certain icons get altered, blurred or something. I'm not sure that it's scaling, it's more like a rendering bug I think. I have tried to disable anti aliasing on the BitmapDrawable, but that didn't help.
As shown on the image below, on Android 2.1 LDPI, one icon gets broken/cropped, and on both Android 1.6 MDPI and Android 2.1 HDPI an extra line seems to be randomly added at the bottom of the icon (look closely).

In the manifest, I have an empty `<supports-screens />` as recommended in the docs about [supporting multiple screens in legacy apps](http://developer.android.com/guide/practices/screens_support.html#strategies). Adding `anyDensity="true"` doesn't help.
Apparently, as of Froyo, things get better as you can see on the image above. But how can I solve this on Android <= 2.1?
|
How to display icons without alteration in an ImageButton/ImageView?
|
CC BY-SA 2.5
| 0 |
2011-04-01T16:18:46.643
|
2012-05-06T15:40:34.757
|
2012-05-06T15:40:34.757
| 1,140,748 | 377,478 |
[
"android",
"image",
"icons"
] |
5,516,214 | 1 | 5,585,451 | null | 10 | 6,158 |
One of my projects was under SourceSafe and I am using VS2008.
Recently I switched to SVN. I removed all SS related files and committed the source files into SVN. Anyway, when I open my solution I'm still getting this inoffensive but annoying message (see picture below):
```
The source control provider associated with this solution could not be found. The projects will be treated as not under source control.
Do you want to permanently remove the source control bindings from the projects?
```

I answered multiple time Yes and saved all the files, the I closed the solution and reopen it. I always get this message.
Where can I manually remove any binding left there?
|
Get rid of SourceSafe source control
|
CC BY-SA 2.5
| 0 |
2011-04-01T16:32:08.953
|
2012-09-23T09:10:43.253
| null | null | 274,589 |
[
"visual-studio-2008",
"visual-sourcesafe"
] |
5,516,420 | 1 | null | null | 0 | 1,585 |
In my Appliaction I use a CursorAdapter. This displays a list, which is part of a RelativeLayout. This List includes several elements(TextView, Button, EditText). The EditText does not normally appear on the screen.The problem: I import any data to a EditText and scroll the screen. In this moment I see the imported data in another EditText. OR:
Another case. There are 3 EditText. I use the virtual Keyboard (For example use the second editText). I get in the data to the Edit Text. Push the Back Button. And the data goes to the Edit Text below. (So the data go to the third Edit Text)
Here is the CursorAdapter Code:
```
class OOSListadapter extends CursorAdapter{
OOSListadapter(Cursor c){
super(OOS.this,c);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
OOSRow newRow = (OOSRow)view.getTag();
newRow.populateRow(cursor);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row=inflater.inflate(R.layout.oos_row, parent, false);
OOSRow newRow = new OOSRow(row);
row.setTag(newRow);
return (row);
}
}
```
And here is one row from my application list.
```
class OOSRow {
private TextView row_Action = null;;
private TextView row_Must = null;;
private TextView row_Lack = null;;
private TextView row_itemName = null;;
private EditText row_price = null;;
private Button row_detail = null;
private View row = null;
OOSRow (View row){
this.row = row;
row_Action = (TextView)row.findViewById(R.id.oos_row_SignalA);
row_Must = (TextView)row.findViewById(R.id.oos_row_SignalK);
row_Lack = (TextView)row.findViewById(R.id.oos_row_SignalO);
row_itemName = (TextView)row.findViewById(R.id.oos_row_itemLabel);
row_price = (EditText)row.findViewById(R.id.oos_row_EditText);
row_detail = (Button)row.findViewById(R.id.oos_row_detailButton);
}
void populateRow (Cursor c){
Cursor specCursor = dbLoc.Query("SELECT PRICE, LACK, ORDERED FROM ORDERED WHERE ITEMID='"+ c.getString(1) +"'", null);
specCursor.moveToFirst();
row_itemName.setText(c.getString(2));
row_itemName.setContentDescription(c.getString(1));
if (specCursor.getString(1).toString().equals("Y")){
row_itemName.setBackgroundColor(Color.parseColor("#FF0000"));
row_itemName.setTextColor(Color.parseColor("#FFFFFF"));
}else{
row_itemName.setBackgroundColor(Color.parseColor("#000000"));
row_itemName.setTextColor(Color.parseColor("#FFFFFF"));
}
row_itemName.setOnClickListener(SelectedLackItem);
if (c.getString(5).toString().equals("I")){
row_Action.setTextColor(Color.parseColor("#000000"));
row_Action.setBackgroundColor(Color.parseColor("#FF0000"));
}
else{
row_Action.setTextColor(Color.parseColor("#FFFFFF"));
row_Action.setBackgroundColor(Color.parseColor("#000000"));
}
if (c.getString(4).toString().equals("I")){
row_Must.setTextColor(Color.parseColor("#000000"));
row_Must.setBackgroundColor(Color.parseColor("#00FF00"));
}
else{
row_Must.setTextColor(Color.parseColor("#FFFFFF"));
row_Must.setBackgroundColor(Color.parseColor("#000000"));
}
specCursor = dbLoc.Query("SELECT LACK FROM LASTORDERED WHERE ITEMID='"+c.getString(1)+"' AND COMPANYID ='"+dbLoc.GetCompanyId()+"'", null);
if (specCursor.moveToFirst())
{
if (specCursor.getString(0).toString().equals("I")){
row_Lack.setTextColor(Color.parseColor("#000000"));
row_Lack.setBackgroundColor(Color.parseColor("#0000FF"));
}else{
row_Lack.setTextColor(Color.parseColor("#FFFFFF"));
row_Lack.setBackgroundColor(Color.parseColor("#000000"));
}
}
row_detail.setOnClickListener(OpenDetailScreenButton);
row_detail.setContentDescription(c.getString(1));
row_price.setContentDescription(c.getString(1));
row_price.setInputType(0);
/*row_price.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
row_price.setInputType(InputType.TYPE_CLASS_NUMBER);
}
@Override
public void afterTextChanged(Editable s) {
}
});*/
specCursor.close();
specCursor = null;
}
}
```
And some pictures:

After Back Button:

Any Idea?
|
Android CursorAdapter with EditText problem
|
CC BY-SA 2.5
| null |
2011-04-01T16:52:55.740
|
2011-09-28T13:09:19.373
|
2011-04-01T17:11:15.980
| 239,074 | 311,146 |
[
"android",
"android-edittext",
"android-cursoradapter"
] |
5,516,524 | 1 | 5,516,562 | null | 2 | 1,188 |
I'm having an issue in one of my activities with text being cut-off at the first letter.
The issue is, whenever navigating away from this activity to another (via the tabs at the top), and then going back to this activity, all of the text except the first letter in all of the textviews gets cut-off:

The funny thing is that every time I repeat this process (leaving the activity and going back), the text comes back, gets cut-off, comes back, gets cut off....repeating.
My table layout is defined as follows:
```
<TableLayout
android:id="@+id/statisticsMiddleTableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/statisticsMiddleTextTitleLayout"
android:stretchColumns="1">
```
With all rows having the following structure:
```
<TableRow
android:id="@+id/tableRow1Statistics">
<!-- TitleRow -->
<TextView
android:id="@+id/statisticsTableR1CLText"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:text="@string/statisticsTableR1CLText"
android:textStyle="bold"
android:textColor="#FF6600"
android:paddingTop="0dip"
android:layout_margin="0dip"
android:gravity="center_horizontal"
android:layout_weight="1"/>
<TextView
android:id="@+id/statisticsTableR1CRText"
android:text="@string/statisticsTableR1CRText"
android:textStyle="bold"
android:textColor="#FFFF66"
android:gravity="center_horizontal"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:paddingTop="0dip"
android:layout_margin="0dip"
android:layout_weight="1"/>
</TableRow>
```
I have found that setting "android:layout_width" to something other than "0dip" for the textviews solves this problem and the text doesn't get cut-off, but then I can't get an equal width between the textviews. I'd have to rebuild the entire activity UI without a table, which I don't want to do.
The more interesting factor is that this does not happen on a real device (I only have one to test it on though) and I had never seen this bug before upgrading the android SDK tools to Revision 10.
So now I wonder, is this a bug in the SDK revision 10 tools, or should I rework the entire UI for this activity? Has anyone else experienced this issue with using "0dip" for the "layout_width" textview attribute inside of a table?
|
Textview Width of "0dip" cutting off text inside of a TableLayout
|
CC BY-SA 3.0
| null |
2011-04-01T17:03:31.783
|
2011-04-25T05:18:12.610
|
2011-04-25T05:18:12.610
| 239,932 | 239,932 |
[
"android",
"textview",
"tablelayout"
] |
5,516,733 | 1 | 5,517,102 | null | 1 | 72 |
I want build a lightweight cached system (few server-resources) for easy serve pages (without SQL queries, without heavy-functions...), but end result depends of multiple user profiles.

I know existence of APC, memcached and other third-systems... The purpose of this question is learn the most efficient way (and theorical explanations) in a specific coding-scene.
What method I should use? (more efficient in end-process)
A) Multiple and different static html file-part readings (show in image, I think that bad performance for several read access to hard disk)
B) A single-file reading (dynamic script), that include data needed and reorder self (with strpos, str_replace ...)
C) Other better solution
Very thanks,
Note: Sorry for my bad english.
Suppose I have applied APC and memcached on my system. I'm interested in system scheme/coding/structure.
|
Efficient reorder and serve data
|
CC BY-SA 3.0
| null |
2011-04-01T17:26:42.693
|
2011-10-24T22:11:18.587
|
2011-10-24T22:11:18.587
| 500,214 | 500,214 |
[
"php",
"html",
"caching",
"performance"
] |
5,516,774 | 1 | null | null | 3 | 544 |
I can't find out how to get all metrics of a given glyph with RMagick.
I know there is a get_type_metrics method which gives the baseline, height, ascent, descent, etc, but I would also like to get the x-height, cap-height, bounding rectangle for a given glyph, etc. Is that possible?

|
RMagick: get glyph metrics
|
CC BY-SA 2.5
| 0 |
2011-04-01T17:30:11.087
|
2011-11-29T18:44:48.717
|
2011-11-21T09:33:27.743
| 6,899 | 485,005 |
[
"ruby",
"imagemagick",
"rmagick",
"glyph"
] |
5,517,026 | 1 | 5,517,296 | null | 0 | 378 |
I'm at the very beginning of Android.
While I've been playing around with the views, I've encountered this problem, googled a little bit but couldn't find anything. I've listed some rows(textviews) horizontally.(See the picture). My problem is I cannot slide down the list to see the elements below. For slide to work, should I add some library/function/xml value?
What am i missing?
This is part of my java code (i take the data from the db and put it on screen with a while loop)
```
LinearLayout l = (LinearLayout)findViewById(R.id.myList);
TextView t = new TextView( getApplicationContext() );
t.setText("some text");
t.setClickable(true);
l.addView(t, 250, 30);
```
and my xml
```
<?xml version="1.0" encoding="utf-8"?>
```
```
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Add"
/>
<EditText
android:id="@+id/title"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/body"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/myList"
>
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok -----------> "
/>
<Button
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete All"
/>
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/list"
/>
</LinearLayout>
```

|
Android List doesn't slide down
|
CC BY-SA 2.5
| null |
2011-04-01T17:56:23.683
|
2011-04-01T18:36:12.117
| null | null | 238,514 |
[
"android",
"textview",
"android-linearlayout"
] |
5,517,644 | 1 | null | null | 1 | 1,503 |
I'm currently building a site for a client who wants a or something. Basically it's a site with a signupform and every member has a that contains their referral-id so when someone joins they are placed as in a sort of .
The , so the person who just joins will be in the downline of someone and will be shown the with the for the .
these decide to and he/she can to these sites for the MLM programs. This is all pretty straightforward and relatively easy to build.
The is , if that's the case of this new member who did enter his referral-url.
For example in the image below, his sees all three programs but one of them this means that .(see purple line).

It's this part that I'm unsure about how can I do this, without complex recursive lookup and what if someone quits or leaves the site?
Is there a way to do such a lookup with . I thought of of a table for each new member so it's relatively easy to find the parent, grandparent and so on. But still you need to go through this path to find the first one with a referral-url. Also if you someone from the tree to reflect the new situation.
There's no limit to how deep or wide the tree can become.
I hope this is not too confusing. And btw it's NOT an April fools joke, I really wish it was...
|
SQL & database setup for downline-builder application
|
CC BY-SA 2.5
| null |
2011-04-01T18:59:00.307
|
2011-09-04T17:15:57.660
| null | null | 584,634 |
[
"mysql",
"database",
"database-design"
] |
5,517,744 | 1 | 5,518,143 | null | 81 | 54,033 |
See this code example: [http://jsfiddle.net/Z2BMK/](http://jsfiddle.net/Z2BMK/)
Chrome/IE8 look like this

Firefox looks like this

My CSS is
```
button {
padding:0;
background:#080;
color:white;
border:solid 2px;
border-color: #0c0 #030 #030 #0c0;
margin:0;
}
```
How can I change the code sample to make the button the same in both browsers? I do not want to use JavaScript based hyperlinks because they do not work with space bar on keyboard and it has to have an `href` URL which is not a clean way to handle things.
## My solution, since Firefox 13
`button::-moz-focus-inner { margin: -1px; padding: 0; border-width: 1px; }`
|
Remove extra button spacing/padding in Firefox
|
CC BY-SA 3.0
| 0 |
2011-04-01T19:08:21.237
|
2021-04-14T00:05:13.743
|
2016-03-07T11:36:51.033
| 607,004 | 463,304 |
[
"css",
"firefox",
"button",
"spacing"
] |
5,517,847 | 1 | 5,518,002 | null | 1 | 477 |
When plotting oscillations in R, e.g., using the package desolve,
```
df1 <-function(t,y,mu)( list(c(y[2],mu*y[1]^3-y[1]+0.005*cos(t))))
library (deSolve)
yini<-c(y1=0,y2=0)
df2 <-ode(y=yini,func=df1, times=0:520,parms=0.1667)
plot(df2,type="l",which="y1",ylab="Displacement",xlab="Time", main="")
```
I get raggedy plots such as:

instead of a smooth plot (not done in R) such as:

Does anyone know of a way to obtain a smoother plot in R instead of a raggedy one when displaying oscillations? Note that it is not just a matter of the difference in scale and I am not looking for a smoothing filter.
Thanks,
|
R How to make smoother looking plots of oscillations
|
CC BY-SA 2.5
| null |
2011-04-01T19:19:15.190
|
2011-04-01T20:48:01.793
|
2011-04-01T20:48:01.793
| 552,642 | 552,642 |
[
"r"
] |
5,517,926 | 1 | 16,879,079 | null | 1 | 17,891 |
Here is my Emgu.CV code for getting an image and drawing the circles found in it (mostly code from the ShapeDetection project in Emgu.CV.Examples solution that came with the EmguCV download):
```
//Load the image from file
Image<Bgr, Byte> img = new Image<Bgr, byte>(myImageFile);
//Get and sharpen gray image (don't remember where I found this code; prob here on SO)
Image<Gray, Byte> graySoft = img.Convert<Gray, Byte>().PyrDown().PyrUp();
Image<Gray, Byte> gray = graySoft.SmoothGaussian(3);
gray = gray.AddWeighted(graySoft, 1.5, -0.5, 0);
Image<Gray, Byte> bin = gray.ThresholdBinary(new Gray(149), new Gray(255));
Gray cannyThreshold = new Gray(149);
Gray cannyThresholdLinking = new Gray(149);
Gray circleAccumulatorThreshold = new Gray(1000);
Image<Gray, Byte> cannyEdges = bin.Canny(cannyThreshold, cannyThresholdLinking);
//Circles
CircleF[] circles = cannyEdges.HoughCircles(
cannyThreshold,
circleAccumulatorThreshold,
4.0, //Resolution of the accumulator used to detect centers of the circles
15.0, //min distance
5, //min radius
0 //max radius
)[0]; //Get the circles from the first channel
//draw circles (on original image)
foreach (CircleF circle in circles)
img.Draw(circle, new Bgr(Color.Brown), 2);
```
Here is the image:

1. OK, so I know what the threshold in ThresholdBinary is. Since I am getting the binary image from the gray-scale image it is the intensity of the gray in the picture. This works as the intensity of the gray-scale circle in the pic is 150 to 185. I assume this is the same for the first argument to HoughCircles. What I don't know is what circleAccumulatorThreshold, Resolution of the accumulator, and min distance (2nd, 3rd, and 4th args to HoughCircles) are or what values should go there. I obviously do not have the correct values because the circle in the pic is not 'houghed' correctly.
2. My second question is, is there a better way to find the circle? I need to be able to detect this circle in many types of light (i.e. the circle color intensity may be low, like 80 or lower) and to get its dimensions in the pic. What is the best way to match a circle? Should I make the circle another color and look in the original image for that color? Any other ideas?
Thanks
|
In Emgu.CV what do these threshold values mean and is there a better way to detect a circle?
|
CC BY-SA 2.5
| 0 |
2011-04-01T19:28:14.550
|
2013-06-02T02:00:41.663
|
2020-06-20T09:12:55.060
| -1 | 273,723 |
[
"c#",
"emgucv",
"edge-detection"
] |
5,518,195 | 1 | 5,518,651 | null | 2 | 1,839 |
I'm writing a messaging system like Facebook's new Messages system, where the entire back and forth between two users is considered one conversation. (As opposed to traditional email where each reply is a separate message or gMail's conversations where replies are all together in a conversation but you can still have multiple conversations between people). MySQL version is 5.0.92.
I can't for the life of me figure out how to write the query for the "inbox" type view. All I would need is the very last message between two people, which [would be easy](https://stackoverflow.com/questions/3811750/get-the-last-entries-using-group-by) except I don't know how to take into account both the "from_id" and "to_id" fileds.
My messages table looks like this:

The highlighted rows are the ones I'd like returned (#2 wouldn't be returned because the last message between users 42 and 43 is #8, for instance). Is it possible to do this? Or would I be better off using two queries (one for to_id and one for from_id) then working them out in PHP?
Thanks for your help
SQL to replicate the table:
```
CREATE TABLE `messages` (
`message_id` bigint(20) NOT NULL auto_increment,
`to_id` int(11) NOT NULL,
`from_id` int(11) NOT NULL,
`message_sent` datetime NOT NULL,
`message_body` text NOT NULL,
`is_read` tinyint(1) NOT NULL default '0' COMMENT '0 = no, 1 = yes',
PRIMARY KEY (`message_id`),
KEY `to` (`to_id`),
KEY `is_read` (`is_read`),
KEY `sent` (`message_sent`),
KEY `from` (`from_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `messages` (`message_id`, `to_id`, `from_id`, `message_sent`, `message_body`, `is_read`) VALUES
(1, 42, 43, '2011-04-01 11:54:05', 'message 1', 0),
(2, 43, 42, '2011-04-01 11:54:05', 'message 1.2', 0),
(3, 42, 44, '2011-04-01 11:55:05', 'message 2', 1),
(4, 44, 42, '2011-04-01 11:55:02', 'message 2.1', 0),
(5, 43, 44, '2011-04-01 15:05:42', 'Message 3', 0),
(6, 44, 43, '2011-04-01 15:05:58', 'Message 3.1', 0),
(7, 42, 43, '2011-04-02 11:54:05', 'message x', 0),
(8, 43, 42, '2011-04-02 11:54:05', 'message x.2', 0);
```
Edit: for those interested:
```
select `m`.`message_id` AS `message_id`,`m`.`to_id` AS `to_id`,`ut`.`name` AS `to_name`,`m`.`from_id` AS `from_id`,`uf`.`name` AS `from_name`,`m`.`message_sent` AS `message_sent`,`m`.`message_body` AS `message_body`,`m`.`is_read` AS `is_read` from ((`messages` `m` join `users` `ut` on((`m`.`to_id` = `ut`.`id`))) join `users` `uf` on((`m`.`from_id` = `uf`.`id`))) where `m`.`message_id` in (select max(`messages`.`message_id`) AS `MAX(message_id)` from `messages` group by greatest(`messages`.`to_id`,`messages`.`from_id`),least(`messages`.`to_id`,`messages`.`from_id`));
```
|
MySQL: Return only last message in flat/conversation message table
|
CC BY-SA 2.5
| 0 |
2011-04-01T19:57:28.327
|
2011-04-01T21:21:39.537
|
2017-05-23T12:30:37.427
| -1 | 420,172 |
[
"mysql",
"group-by"
] |
5,518,225 | 1 | 5,519,388 | null | 3 | 782 |
I have a program that takes in a zip code and makes a google map. The `div` that the map is set to`hidden` until the map is made. Once the map is made the `div` is set to `display : block`. The problem is that the first time the map is generated (and only the first time) it looks like this:

Once I hit the find a store button again it looks like this:

I have already tried to make a initial call to the map method (which I kept hidden until a real call is made) but this does not fix the issue. I don't want to show all my code (there is a lot) but here is how I make the map.
```
<div id = "map_canvas" style = " height: 300px; width: 300px;"></div>
//Creates a new center location for the google map
var latlng = new google.maps.LatLng(lat, lng);
//The options for the google map
var mapOptions = {
zoom: 7,
maxZoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Creates the new map
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
```
Also note that both images below have the correct markers in the correct place.
Any suggestions?
|
Google map generating incorrectly
|
CC BY-SA 2.5
| null |
2011-04-01T20:00:58.867
|
2011-04-01T22:09:37.430
| null | null | 650,489 |
[
"javascript",
"google-maps"
] |
5,518,746 | 1 | 5,518,893 | null | 4 | 3,206 |
i recently upgraded VS 2005 to 2010 and am fairly new to LinQ. Maybe somebody can put me in the right way.
:
I have a typed dataset and have the standard SQLMembershipProvider extended with a Table AccessRule. So a role can have infinitely AccessRules(f.e. "Administrator" has "DeleteCustomer"). I use a custom membership provider that inherits from SqlMemberShipProvider and has an overloaded function hasAccess(one with a memory-dataset as parameter and the other uses the database directly).
This is the complete Model:

Now i need to know f.e. if a User with UserID=`'89f9ea8d-8ae1-460b-a430-aa433261feec'` has AccessRule "DeleteCustomer".
In SQL it would be something like this:
```
SELECT CASE WHEN aspnet_AccessRule.idAccessRule IS NULL THEN 0 ELSE 1 END AS Access
FROM aspnet_RoleAccessRule INNER JOIN
aspnet_AccessRule ON aspnet_RoleAccessRule.fiAccessRule = aspnet_AccessRule.idAccessRule INNER JOIN
aspnet_Roles ON aspnet_RoleAccessRule.fiRole = aspnet_Roles.RoleId INNER JOIN
aspnet_UsersInRoles ON aspnet_Roles.RoleId = aspnet_UsersInRoles.RoleId
WHERE (aspnet_UsersInRoles.UserId = @UserID) AND (aspnet_AccessRule.RuleName =@RuleName)
```
:
how do i get from `aspnet_UsersInRoles` to`aspnet_AccessRule` with LinQ?
Thank you in advance...
:
Although C# is also welcome, i'm preferring VB.Net.
This is what i have, but it doesn't work.
```
Dim query = From accRule In dsAuth.aspnet_AccessRule _
From roleAccRule In dsAuth.aspnet_RoleAccessRule _
From role In dsAuth.aspnet_Roles _
From userRole In dsAuth.aspnet_UsersInRoles _
Where roleAccRule.fiAccessRule = accRule.idAccessRule _
And roleAccRule.fiRole = role.RoleId _
And userRole.RoleId = role.RoleId _
And userRole.UserId = userID And accRule.RuleName = accessRule
Select accRule.idAccessRule
Return query.Any
```
I get a `"Definition of method SelectMany is not accessible in this context"` compiler warning and the second`From` is highlighted.
I assume it has something to do with the composite-keys in aspnet_RoleAccessRule and aspnet_UsersInRoles. Any suggestions?
This gives the same exception on the first comma:
```
Dim query = From accRule In dsAuth.aspnet_AccessRule, _
roleAccRule In dsAuth.aspnet_RoleAccessRule, _
role In dsAuth.aspnet_Roles, _
userRole In dsAuth.aspnet_UsersInRoles _
Where accRule.idAccessRule = roleAccRule.fiAccessRule _
And roleAccRule.fiRole = role.RoleId _
And userRole.RoleId = role.RoleId _
And userRole.UserId = userID And accRule.RuleName = accessRule
Select accRule.idAccessRule
Return query.Any
```
This is the join syntax but with similar error(`Join` is not accessible in context..):
```
Dim userID As Guid = DirectCast(Membership.GetUser.ProviderUserKey, Guid)
Dim query = From accRule In dsAuth.aspnet_AccessRule _
Join roleAccRule In dsAuth.aspnet_RoleAccessRule _
On accRule.idAccessRule Equals roleAccRule.fiAccessRule _
Join role In dsAuth.aspnet_Roles _
On role.RoleId Equals roleAccRule.fiRole _
Join userRole In dsAuth.aspnet_UsersInRoles _
On userRole.RoleId Equals role.RoleId _
Where userRole.UserId = userID And accRule.RuleName = accessRule
Select accRule.idAccessRule
Return query.Any
```
---
: I've forgotten to import the Namespace `System.LinQ`. All these queries are working.
Side note: the Join-Syntax is by far the fastest query. Have a look at my followup-question: [Why is LINQ JOIN so much faster than linking with WHERE?](https://stackoverflow.com/questions/5551264/why-is-linq-join-so-much-faster-than-linking-with-where)
|
How to join with LinQ to (typed) dataset?
|
CC BY-SA 2.5
| 0 |
2011-04-01T20:54:15.977
|
2011-04-05T20:53:18.220
|
2017-05-23T10:32:36.017
| -1 | 284,240 |
[
".net",
"linq",
"sqlmembershipprovider",
"linq-to-dataset"
] |
5,518,918 | 1 | 18,370,505 | null | 26 | 8,677 |
As can been seen in this screen shot from instruments, Allocations thinks my application (Ongo) is only using 7.55 MBs of memory, while Memory Monitor says 53.30. Further more the free system memory has little to no correlation to the amount of memory that the app is using. Does anyone know why there is such a big disagreement between these two tools? Additionally is it possible to find the source of the low system memory or how to keep it from running out so quickly? My app doesn't appear to be leaking memory but somehow it's exhausting the system resources.
Thanks

|
instruments with iOS: Why does Memory Monitor disagree with Allocations?
|
CC BY-SA 2.5
| 0 |
2011-04-01T21:11:57.727
|
2016-11-04T00:12:32.243
| null | null | 113,538 |
[
"iphone",
"ios",
"ipad",
"memory-management",
"xcode-instruments"
] |
5,518,992 | 1 | 5,519,151 | null | 8 | 14,278 |
Example: [http://jsfiddle.net/wCFBw/25/](http://jsfiddle.net/wCFBw/25/)

```
input {
color: black;
}
```
```
<input type="text" value="This is black" />
<input type="text" disabled="disabled" value="Why this is not black?" />
```
|
How can I fully override Chromium disabled input field colours?
|
CC BY-SA 3.0
| 0 |
2011-04-01T21:19:35.573
|
2011-09-08T11:40:06.450
|
2011-09-08T11:40:06.450
| 405,015 | 569,061 |
[
"html",
"css",
"google-chrome",
"w3c",
"chromium"
] |
5,519,766 | 1 | 5,664,438 | null | 8 | 14,559 |
I'm developping an application on android!
Well I have a little conflict now, I want to execute an XPath query but I didn't arrive to solve this problem.

This an example of XML filethat I use:
```
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England.</description>
</book>
</catalog>
```
How can I do??
Thanks in advance!!
|
Search in XML File with XPath in Android
|
CC BY-SA 4.0
| 0 |
2011-04-01T23:02:15.850
|
2020-05-29T13:36:51.683
|
2020-05-29T13:36:51.683
| 604,156 | 604,156 |
[
"android",
"xml",
"xpath"
] |
5,519,742 | 1 | 5,520,430 | null | 8 | 13,106 |
I need to draw a checkbox in a particular column in a`TListView`, so i check this question [How can I setup TListView with CheckBoxes in only certain columns?](https://stackoverflow.com/questions/5478972/how-can-i-setup-tlistview-with-checkboxes-in-only-certain-columns) and in the accepted answer suggest use the method described in this another question [How to set a Checkbox TStringGrid in Delphi?](https://stackoverflow.com/questions/5306037/how-to-set-a-checkbox-tstringgrid-in-delphi), now porting that code to work with a ListView i come with this :
```
procedure TForm15.ListView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);
const
PADDING = 4;
var
h : HTHEME;
s : TSize;
r : TRect;
Rect : TRect;
i : Integer;
Dx : Integer;
begin
if (SubItem=1) then
begin
DefaultDraw:=True;
Rect :=Item.DisplayRect(drBounds);
Dx:=0;
for i := 0 to SubItem do
Inc(Dx,Sender.Column[i].Width);
Rect.Left :=Rect.Left+Dx;
Rect.Right :=Rect.Left+Sender.Column[SubItem+1].Width;
FillRect(Sender.Canvas.Handle, Rect, GetStockObject(WHITE_BRUSH));
s.cx := GetSystemMetrics(SM_CXMENUCHECK);
s.cy := GetSystemMetrics(SM_CYMENUCHECK);
if UseThemes then
begin
h := OpenThemeData(Sender.Handle, 'BUTTON');
if h <> 0 then
try
GetThemePartSize(h, Sender.Canvas.Handle, BP_CHECKBOX, CBS_CHECKEDNORMAL, nil, TS_DRAW, s);
r.Top := Rect.Top + (Rect.Bottom - Rect.Top - s.cy) div 2;
r.Bottom := r.Top + s.cy;
r.Left := Rect.Left + PADDING;
r.Right := r.Left + s.cx;
DrawThemeBackground(h, Sender.Canvas.Handle, BP_CHECKBOX, IfThen(CompareText(Item.SubItems[1],'True')=0, CBS_CHECKEDNORMAL, CBS_UNCHECKEDNORMAL), r, nil);
finally
CloseThemeData(h);
end;
end
else
begin
r.Top := Rect.Top + (Rect.Bottom - Rect.Top - s.cy) div 2;
r.Bottom := r.Top + s.cy;
r.Left := Rect.Left + PADDING;
r.Right := r.Left + s.cx;
DrawFrameControl(Sender.Canvas.Handle, r, DFC_BUTTON, IfThen(CompareText(Item.SubItems[1],'True')=0, DFCS_CHECKED, DFCS_BUTTONCHECK));
end;
//r := Classes.Rect(r.Right + PADDING, Rect.Top, Rect.Right, Rect.Bottom);
// DrawText(Sender.Canvas.Handle, StringGrid1.Cells[ACol, ARow], length(StringGrid1.Cells[ACol, ARow]), r, DT_SINGLELINE or DT_VCENTER or DT_LEFT or DT_END_ELLIPSIS);
end
else
DefaultDraw:=False;
end;
```
but i fail miserably in my attempt to draw a checkbox :(, can someone point me in the right direction to draw the checkbox in the listview, (the code does not draw any checkbox in the listview).
The listview is in vsReport mode and had 3 columns, i want put the checkbox in the third column. please don't suggest which use a thrid party component, i want use the TlistView control.
: thanks to the sertac recomendattion setting the `DefaultDraw` value now the checkboxes are shown, but the another columns looks awfull.

, following the Andreas suggestions the listview now look better, but still shown the black box;

```
procedure TForm15.ListView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);
var
h : HTHEME;
s : TSize;
r : TRect;
Rect : TRect;
i : Integer;
Dx : Integer;
begin
if (SubItem=2) then
begin
DefaultDraw:=False;
Rect :=Item.DisplayRect(drBounds);
Dx:=0;
for i := 0 to SubItem-1 do
Inc(Dx,Sender.Column[i].Width);
Rect.Left :=Rect.Left+Dx;
Rect.Right :=Rect.Left+Sender.Column[SubItem].Width;
FillRect(Sender.Canvas.Handle, Rect, GetStockObject(WHITE_BRUSH));
s.cx := GetSystemMetrics(SM_CXMENUCHECK);
s.cy := GetSystemMetrics(SM_CYMENUCHECK);
Dx := (Sender.Column[SubItem].Width-GetSystemMetrics(SM_CXMENUCHECK)) div 2;
if UseThemes then
begin
h := OpenThemeData(Sender.Handle, 'BUTTON');
if h <> 0 then
try
GetThemePartSize(h, Sender.Canvas.Handle, BP_CHECKBOX, CBS_CHECKEDNORMAL, nil, TS_DRAW, s);
r.Top := Rect.Top + (Rect.Bottom - Rect.Top - s.cy) div 2;
r.Bottom := r.Top + s.cy;
r.Left := Rect.Left + Dx;
r.Right := r.Left + s.cx;
DrawThemeBackground(h, Sender.Canvas.Handle, BP_CHECKBOX, IfThen(CompareText(Item.SubItems[SubItem-1],'True')=0, CBS_CHECKEDNORMAL, CBS_UNCHECKEDNORMAL), r, nil);
finally
CloseThemeData(h);
end;
end
else
begin
r.Top := Rect.Top + (Rect.Bottom - Rect.Top - s.cy) div 2;
r.Bottom := r.Top + s.cy;
r.Left := Rect.Left + Dx;
r.Right := r.Left + s.cx;
DrawFrameControl(Sender.Canvas.Handle, r, DFC_BUTTON, IfThen(CompareText(Item.SubItems[SubItem-1],'True')=0, DFCS_CHECKED, DFCS_BUTTONCHECK));
end;
end;
end;
```
|
drawing a checkbox in a TListView
|
CC BY-SA 2.5
| 0 |
2011-04-01T23:00:00.487
|
2019-07-30T11:00:09.753
|
2017-05-23T12:25:10.563
| -1 | 167,454 |
[
"delphi",
"listview",
"checkbox",
"delphi-xe",
"tlistview"
] |
5,519,944 | 1 | 5,520,576 | null | 0 | 104 |

Boxes are some objects(button, label, textarea). Green's size is dynamic. Especially I have a problem with the blue box stick to bottom.
|
How to do such layout with html+css?
|
CC BY-SA 2.5
| null |
2011-04-01T23:33:30.013
|
2011-04-02T10:01:05.203
|
2011-04-01T23:36:56.843
| 139,010 | 688,208 |
[
"html",
"css"
] |
5,519,987 | 1 | 5,520,149 | null | 3 | 3,908 |
I am making an Android app and one of the activities in the app is a List Activity. I want the ListView to have the slide out options menu for the list items like you often see in apps like twitter:

I thought I read a while back that Android had a feature like this included in the sdk, but I can't seem to find any documentation or tutorials on it. Part of my problem is that I don't know exactly what the feature is called. I have done quite a bit of searching, but I haven't come up with anything useful. I am hoping that someone with a bit of Android development experience has seen this before and could recommend a resource or two.
Thanks!
|
How can I create a slide out options menu for Android ListView items?
|
CC BY-SA 2.5
| 0 |
2011-04-01T23:42:02.633
|
2013-08-12T18:01:51.183
|
2013-08-12T18:01:51.183
| null | 535,590 |
[
"android",
"android-listview"
] |
5,520,125 | 1 | 5,541,132 | null | 1 | 4,123 |
I've successfully implemented In App Purchasing and 99,9% of the users successfully buy the IAP product. However, one user with a jailbroken phone gets this error:

Is there anything I can suggest to this user? I don't think the problem exists for all jailbroken iPhones because the number of complaints should be statistically higher, then.
There's another [similar question](https://stackoverflow.com/q/2058978/235297) though it wasn't clear about the jailbreaking status of affected users. I'm searching for an actual solution for those jailbroken device users (other than recommending not to jailbreak - since that'd mean lost business).
|
In App Purchase error "This is not a Test User account"
|
CC BY-SA 2.5
| null |
2011-04-02T00:06:27.143
|
2018-09-25T17:52:30.907
|
2018-09-25T17:52:30.907
| 235,297 | 235,297 |
[
"ios",
"iphone",
"in-app-purchase",
"jailbreak",
"storekit"
] |
5,520,343 | 1 | null | null | 0 | 163 |
I have two tables:
```
CREATE TABLE `bb_index` (
`bb_id` smallint(5) unsigned NOT NULL,
`object_id` bigint(10) unsigned NOT NULL,
`in_object_id` bigint(10) unsigned NOT NULL,
`f` int(10) unsigned DEFAULT NULL,
`length` decimal(10,5) DEFAULT NULL,
PRIMARY KEY (`bb_id`,`object_id`,`in_object_id`),
KEY `in_obj_key` (`bb_id`,`in_object_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
CREATE TABLE `obj_bb_relation` (`bb_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`object_id` bigint(10) unsigned NOT NULL DEFAULT '0',
`object_bb_f` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`bb_id`,`object_id`),
KEY `object_id` (`object_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
```
Which is better:
Option 1:
```
SELECT object_id, f, length , object_bb_freq as C
FROM (select object_id, f, length
from bb_index use index (in_obj_key)
where bb_id = 14
and in_object_id = XXX
) as a join obj_bb_relation as b using (object_id)
```
EXPLAIN:

Option 2:
```
SELECT object_id, f, length, object_bb_f AS C
FROM bb_index AS a
JOIN obj_bb_relation AS b USING ( object_id )
WHERE in_object_id = XXX
AND a.bb_id =YY
AND b.bb_id =YY
```

OR?
Another option..?
|
Slow join? NULL ref which is better
|
CC BY-SA 2.5
| null |
2011-04-02T00:53:40.310
|
2011-04-02T21:47:23.583
|
2011-04-02T21:47:23.583
| 472,226 | 615,058 |
[
"mysql",
"join"
] |
5,520,443 | 1 | null | null | 0 | 3,048 |
Ive only messed with InvokeMember Click afew times and ive been having problems with this one.
Here is a Firebug screenshot of the HTML.

I am trying to WebBrowser1 InvokeMember "Click" on the OK button, but I have no idea how to work it with classes, and 2 of them at that. So obviously Im going to have to do some loop and get the second one.
I don't know where to even start SO i was wondering if someone could provide a basic snippit if possible, please and thanks :).
|
vb.net Webbrowser InvokeMember Click Help
|
CC BY-SA 2.5
| null |
2011-04-02T01:14:52.827
|
2011-04-02T01:59:14.367
| null | null | 637,130 |
[
"vb.net",
"browser",
"invoke"
] |
5,520,637 | 1 | 5,521,440 | null | 6 | 5,284 |
I have a plot with overlapping shaded confidence intervals that looks like this:

and I would like very much to annotate the legend with the color of the confidence interval. Something like:

except, I'd like two things:
1. for the boxes not to show up on the first two entries.
2. for the boxes to stretch across the dot and the rightmost portion of the line on the last three entries.
(And I'm using base R instead of ggplot2 for a couple of reasons specific to this application that aren't really relevant to explain.)
Here is a code example that reproduces the legend:
```
#Build a fake plot so that legend has somewhere to sit
xx <- seq(0,10,by=.1)
yy <- 2*xx + rnorm(length(xx),0,1)
plot(xx,yy)
#Build the legend
estNames <- c('est1','est2','est3')
legend('bottomright',
c("no box, no point","no box, no point",estNames) ,
lty=c(rep('dotted',2),rep('solid',3)),
col=c('black','red',1,2,4),
pch=c(-1,-1,rep(16,3)),
lwd=1,
fill=c( 0, 0,
rep( c( rgb(0.5,0.5,0.1,0.25),
rgb(0.5,0.1,0.1,0.25),
rgb(0.1,0.1,0.5,0.25)), 2)),
inset=0,bg='white')
```
Any help would be appreciated. Thanks!
|
Legend in Base R: Can fill refrain from drawing boxes on some lines? Can fill draw boxes that cover the whole symbol?
|
CC BY-SA 2.5
| 0 |
2011-04-02T02:06:26.143
|
2011-04-02T05:46:36.530
| null | null | 419,842 |
[
"r",
"graphics",
"fill",
"legend"
] |
5,520,678 | 1 | 5,520,717 | null | 0 | 263 |
I've got this mock up:

As you can see, it's a sort of navigation-menu. It's functionality should be the same as a segmented control, and i am going to change the tableView based on the item active.
What would be the easiest way to implement this?
I have started makin my UIView-subclass, but found out that i had to then make a delegate, watch for tap-events and stuff.
?
Please, point me in the right direction. I feel confident in Obj-c, but making these kinds of stuff makes my mind goes crazy.
|
Making a custom UISegmentControl(sort of)
|
CC BY-SA 2.5
| null |
2011-04-02T02:15:29.200
|
2011-04-02T02:45:22.897
| null | null | 458,973 |
[
"iphone",
"objective-c",
"uiview",
"menu",
"custom-controls"
] |
5,520,845 | 1 | null | null | 6 | 12,892 |
this is my xlsx file :

and i want to get change this data to a like this :
```
{
0:{
'a':1,
'b':100,
'c':2,
'd':10
},
1:{
'a':8,
'b':480,
'c':3,
'd':14
}
...
}
```
so did somebody know a python lib to do this , and start from the line 124, and end of the line 141 ,
thanks
|
How to load data from an xlsx file using python
|
CC BY-SA 2.5
| 0 |
2011-04-02T03:05:00.257
|
2014-09-21T21:29:20.917
|
2011-04-02T04:19:58.400
| 84,270 | 420,840 |
[
"python",
"xlsx"
] |
5,520,893 | 1 | 5,521,200 | null | 0 | 699 |
I am editing a php code in netbeans and so far the process is super slow and laggy. It always shows this:

what should I do to resolve this slowness?
|
netbeans 6.9.1 very slow
|
CC BY-SA 2.5
| null |
2011-04-02T03:21:53.707
|
2011-04-02T04:39:29.293
| null | null | 95,265 |
[
"netbeans"
] |
5,521,125 | 1 | null | null | 0 | 437 |
How do I make QGridLayout maintain the set 'ColumnStretch' value for this [form](http://www.sendspace.com/file/tf5nsv).
In Windows, the caption label on top of treeview is small because the font is small and it doesn't push the first column of QGridLayout to take more space from the second column of QGridLayout.
In Ubuntu Linux though, I get the following:

|
QGridLayout didn't maintain ColumnStretch ratio
|
CC BY-SA 2.5
| null |
2011-04-02T04:21:51.853
|
2011-04-02T11:08:36.833
| null | null | 393,702 |
[
"qt4",
"qt-designer"
] |
5,521,309 | 1 | 5,521,592 | null | 13 | 9,119 |
Objective-c is learn-able; Cocoa is learn-able; I find Interface Builder and its descendant Xcode 4 to be completely inscrutable! There is no text (as the equivalent of C or Obj-c source code) to refer to. All descriptions are all "drag here; connect that; Ctl drag there" and I remain lost....
I have been trying to go through the various Apple examples of key technologies. I have been going through Cocoa Bindings and the example file in the example [NSTableViewBinding](http://developer.apple.com/library/mac/#samplecode/NSTableViewBinding/Introduction/Intro.html) in Apple developer. To try and understand it, I have been trying to replicate it.
Referring now to the comments at the top of the `awakeFromNib` method in the file [MyWindowController.m](http://developer.apple.com/library/mac/#samplecode/NSTableViewBinding/Listings/MyWindowController_m.html#//apple_ref/doc/uid/DTS40010522-MyWindowController_m-DontLinkElementID_8) How do I make these connections in Xcode 4???

1. The Object called TableArray does not exist either in the Object library or in the source code; where does that come from?
2. The Referencing Bindings on the right; how are these created?
3. The various Key / Value pairs mentioned in the top of the awakeFromNib method; how are these created?
I know that Xcode 4 is supposed to be a more straightforward improvement, but I am very confused by the replacement for IB. All the IB materials on the web refer to the completely different earlier versions, so I cannot find much in the way of help.
I did succeed in figuring out Cocoa Bindings in Xcode 4. I was able to duplicate the functionality of the example program in a few lines of code.
Here are the issues that took me a while to figure out:
1. TableArray is the Array Controller Object dragged over from the Object Library to the Objects list in the XIB and then renamed. (Note to Apple: a base object class would be nice in the right-click HUD view)
2. Stephen Poletto's answer was an invaluable guide to connecting it all.
3. It was not immediately apparent to me how the connection interface works in the right-click HUD:
4. The storage array myContentArray is implicit in the instantiation of Array Controller Object
5. Click and drag from the HUD of the TableArray to the AppDelegate's definition in the .h file to create the connection there.
|
Cocoa Bindings in Xcode 4
|
CC BY-SA 2.5
| 0 |
2011-04-02T05:09:25.647
|
2011-04-03T07:28:36.653
|
2017-05-23T12:24:14.737
| -1 | 298,607 |
[
"objective-c",
"macos",
"interface-builder",
"xcode4"
] |
5,521,537 | 1 | 5,521,814 | null | 2 | 1,802 |
How can I simulate the dialog box that pops up after you do a replace all into a VBA code for Word 2007?


What i want is to get the return value of the replacement count that happened after the replace all button was clicked (in this case the value 9 replacements).
|
Word VBA count replacements made
|
CC BY-SA 3.0
| null |
2011-04-02T06:13:21.413
|
2015-02-25T20:00:30.893
|
2015-02-25T20:00:30.893
| 3,204,551 | 653,541 |
[
"vba",
"ms-word"
] |
5,521,829 | 1 | 5,522,519 | null | 3 | 938 |
I created a simple page with a series of divs. In all of the modern browsers, it appears fine, but in Internet Explorer 6, it falls apart. I have no idea what is causing it to happen.
You can view the page here: [IE 6 Test Page](http://idea-palette.com/ie6test/)
If you have IE6 installed, I included the Firebug Lite JS file on the page, so just click the firebug icon in the bottom right corner to inspect an element.
Here's a screenshot using Browserlab to view the page in Firefox and IE6: [Comparison Screenshot](http://idea-palette.com/ie6test/comparison.jpg)

The 3rd div named 'content'(With the Manager Email field) moves everything to the right forcing the next div to the next line. Also, none of the row div's reach all the way across as they should(see [Comparison Screenshot](http://idea-palette.com/ie6test/comparison.jpg))
I did some research and have found that there is some problems in IE6 using floats which I use here, but I'm not sure how to fix it.
Why does my page not display correctly in Internet Explorer 6? And better yet, how can I fix it? :)
|
Why does my page not display correctly in Internet Explorer 6?
|
CC BY-SA 2.5
| null |
2011-04-02T07:21:51.463
|
2012-05-31T15:51:57.007
|
2012-05-31T15:51:57.007
| 44,390 | 83,916 |
[
"css",
"css-float",
"internet-explorer-6"
] |
5,522,109 | 1 | 5,523,915 | null | 0 | 1,114 |
I am thinking if it is possible to show an item in java swing controls "item".
What I want to do is to show Names from my database in a java swing controls "Item" so user can choose among the lists who's information they want to see.
Is this possible?
something like this:

|
how can I show a list of names from my database in Swing Control "Item" in Java netbeans
|
CC BY-SA 2.5
| null |
2011-04-02T08:28:03.263
|
2011-04-02T17:05:04.457
|
2011-04-02T13:21:16.340
| 513,838 | 528,125 |
[
"java",
"swing"
] |
5,522,259 | 1 | 5,522,418 | null | 1 | 216 |
Goal:
Have a right click menu with a right style
Problem:
How should i retrieve this style when I'm right clicking:

and not this style:

I'm using the component ContextMenuStrip to display menu by right clicking.
|
Right style menu by right clicking
|
CC BY-SA 3.0
| null |
2011-04-02T09:05:05.637
|
2011-12-13T14:22:00.417
|
2011-12-13T14:22:00.417
| 142,162 | 484,390 |
[
"c#",
"winforms",
"contextmenustrip"
] |
5,522,689 | 1 | 5,522,729 | null | 0 | 82 |
I am just starting with Ruby on Rails, because I was told that it is a powerful framework to build web applications.
Maybe it is true, but I can not test it (yet).
My problem is that even if in the tutorials everything seem to be clear and easy, I think I am missing steps during configuration.
I have a xampp1.7.4 server running on my Ubuntu10.10 system, which is loocated in
```
/opt/lampp
```
Then, following this [tutorial](http://rails.homelinux.org/) or any other, I made the first step:
```
rails myProyect
```
It generates a new folder with a structure of a RoR project. Then I paste that folder on /opt/lampp/htdocs and just going to [http://localhost/myProject/](http://localhost/myProject/) it should appear the RoR welcome message, but instead I am getting the tree of the folder, as the image attached shows.

Can anybody help me to figure out what I have missed?? Thanks in advance
|
Application is not shown in browser
|
CC BY-SA 2.5
| null |
2011-04-02T10:50:19.703
|
2011-04-02T11:00:08.950
| null | null | 457,208 |
[
"ruby-on-rails",
"xampp"
] |
5,522,978 | 1 | 5,523,002 | null | 0 | 51 |
I am having a problem on my viewing function in my desktop application.
The program lets the user view the names and corresponding details by clicking the "view all" button.
The problem is if the user clicks the "View all" button again it will add another set of the list stored in the database.
This is what happened after the second click

Can you help me stop this problem?
|
Can't control the view function
|
CC BY-SA 2.5
| null |
2011-04-02T11:51:00.043
|
2011-04-02T15:48:56.227
|
2011-04-02T13:14:18.763
| 513,838 | 528,125 |
[
"java",
"swing",
"desktop-application"
] |
5,523,458 | 1 | 5,523,775 | null | 0 | 512 |
Is it possible to make a poup screen with high opacity around the popup screen in winform? If yes, how?
How do I make the pop up message or GUI screen to be in the middle of the computer screen?
Please remember that I don't have any source code yet.
An example:

|
opacity around the message
|
CC BY-SA 3.0
| null |
2011-04-02T13:31:52.670
|
2011-12-13T14:27:33.933
|
2011-12-13T14:27:33.933
| 142,162 | 484,390 |
[
"c#",
"winforms"
] |
5,523,467 | 1 | 5,523,675 | null | 2 | 2,210 |
I have a User entity in my entity model:

Username and Email should be unique but for now EF4 doesn't support this.
So I wrote this code to ensure uniqueness :
```
public void CreateNewUser(string i_UserName, string i_Email)
{
using (ModelContainer context = new ModelContainer())
{
User usr;
usr = context.UserSet.Where(u => u.Username == i_UserName).SingleOrDefault();
if (usr != null)
throw new Exception("Username not unique");
usr = context.UserSet.Where(u => u.Email == i_Email).SingleOrDefault();
if (usr != null)
throw new Exception("Email not unique");
context.UserSet.AddObject(new User() { Username = i_UserName, Email = i_Email });
context.SaveChanges();
}
}
```
If this is right approach, do I have way to automatically preform this code whenever `context.UserSet.AddObject()` is called? Or a more elegant way does exist?
|
Entity Framework 4 - Username and Email columns unique problem
|
CC BY-SA 2.5
| null |
2011-04-02T13:35:19.377
|
2011-10-26T16:41:22.970
|
2011-04-02T14:22:23.293
| 41,956 | 412,992 |
[
"c#",
".net",
"entity-framework",
"entity-framework-4",
"unique-constraint"
] |
5,523,566 | 1 | 5,523,655 | null | 0 | 238 |
I'm trying to select UserID, FirstName, SecondName, PicturePath(from Pictures table) LIKE FirstName (string search = textbox.text)
```
OdbcCommand("SELECT UserID, FirstName, SecondName, p.PicturePath FROM User LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE FirstName LIKE '%" + search + "%' ORDER BY UserID DESC", cn))
```
My syntax is way messed up.
My table structure:

|
Help with SQL Syntax for LIKE
|
CC BY-SA 2.5
| null |
2011-04-02T13:55:51.607
|
2011-04-02T14:47:27.893
|
2011-04-02T14:03:25.550
| 7,872 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,523,606 | 1 | 5,523,719 | null | 1 | 60 |
```
<?php
// Filter our input.
$dID = filter_input(INPUT_GET, 'dID', FILTER_SANITIZE_NUMBER_INT);
if(!$dID) {
echo "<h2 style='color:red;'>Invalid Department</h2>";
exit;
}
$username = "###";
$password = "####";
$pdo = new PDO('mysql:host=localhost;dbname=####', $username, $password);
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth = $pdo->prepare('
```
$sth = $pdo->prepare('
SELECT name, fname, lname, picpath, email
FROM Department, Professor
WHERE Department.dID = ?
');
');
$sth->execute(array(
$dID
));
```
?>
```
```
<?php
echo "<span>{$row['name']}";
// Did we get any professors in this dept?
while($row2 = $sth->fetch(PDO::FETCH_ASSOC)) {
echo "<span>{$row['fname']} | {$row['lname']} | </span>"
; // echo
}
unset($sth);
?>
```
```
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
```
Dept Table:

Prof Table:

It doesnt seem to like my query, not sure why though, its not pulling anything from the database. Could it be an sql error? I'm stumped
When I test in PhpmyAdmin it gives me:

SELECT name, fname, lname, picpath, email
FROM Department, Professor
WHERE Department.dID = Professor.dID
AND Department.dID = ?
It still doesnt work though. Basically the page has for example in the url: '/dept.php?dID=30' it grabs the dID and is supposed to display all professors in a department. Anyone???
|
Php Error on Query
|
CC BY-SA 2.5
| null |
2011-04-02T14:06:12.907
|
2011-04-02T14:27:32.300
|
2011-04-02T14:27:31.133
| 700,070 | 700,070 |
[
"php",
"sql"
] |
5,523,623 | 1 | 5,525,328 | null | 1 | 1,040 |
## I want to test the performance of the splice() syscall. I compare it with the traditional read/write.
```
/* wr.cpp
* it use read/write
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define BUF_SIZE 4096
int main(int argc, char *argv[])
{
char buf[BUF_SIZE];
int in = open("1.rmvb",O_RDONLY);
int out = open("1.cp.rmvb",O_WRONLY|O_CREAT,0766);
ssize_t nread;
while( (nread = read(in,buf,BUF_SIZE)) > 0 )
{
write(out,buf,nread);
}
return 0;
}
```
//
```
/* splice.cpp
* it use splice
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define BUF_SIZE 4096
int main(int argc, char *argv[])
{
char buf[BUF_SIZE];
int in = open("1.rmvb",O_RDONLY);
int out = open("1.cp.rmvb",O_WRONLY|O_CREAT,0766);
ssize_t nread;
while( (nread = splice(in,NULL,p[1],NULL,BUF_SIZE,0)) > 0)
splice(p[0],NULL,out,NULL,BUF_SIZE,0);
return 0;
}
```
## here is the result:

## It seems that spilce() didn't improve the performance and didn't reduce the CPU time. Why? My kernel version is 2.6.35-28, ubuntu 10.10.
|
why splice() performs so bad on my system?
|
CC BY-SA 2.5
| null |
2011-04-02T14:08:21.027
|
2011-04-02T19:21:06.077
| null | null | 614,951 |
[
"linux",
"linux-kernel",
"sockets"
] |
5,523,658 | 1 | 5,523,683 | null | 0 | 368 |
I get an error unsure how to fix it:
```
ERROR [HY000] [MySQL][ODBC 3.51 Driver][mysqld-5.5.9]Column 'UserID' in field list is ambiguous
```
My code:
```
using System.Data.Odbc;
public partial class Search : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private void PopulateWallPosts(string search)
{
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("SELECT UserID, FirstName, SecondName, p.PicturePath FROM User LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE FirstName LIKE '%" + search + "%' ORDER BY UserID DESC", cn))
{
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
div.ID = String.Format("{0}", reader.GetString(0)); //userid
string id = Convert.ToString(div.ID);
//store the div id as a string
Image img = new Image();
img.ImageUrl = String.Format("{0}", reader.GetString(3)); //p.picturepath
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format("   " + "{0} {1}", reader.GetString(1), reader.GetString(2)))); // FirstName, SecondName
div.Attributes.Add("onclick", "confirm_delete(" + id + ");");
// send the div id to javascript
div.Style["clear"] = "both";
test1.Controls.Add(div);
}
}
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
string search = TextBox2.Text;
PopulateWallPosts(search);
}
}
```
Table Structure:

|
mysql syntax error
|
CC BY-SA 2.5
| null |
2011-04-02T14:13:42.267
|
2011-04-02T14:24:13.730
| null | null | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql"
] |
5,523,906 | 1 | 5,525,057 | null | 4 | 10,797 |
I am refactoring three related but different DataGrids from xaml into code and hitting an issue updating the header text of a context menu.
The command and text need to update according to which data grid cell is the current cell. The header text updated fine in xaml, but as you can see from the picture below, it now shows up as an empty string. The command itself does work properly, and works on the correct grid cell.
The setter for the header text fires property changed, but I suspect my code is not replicating the binding the way the xaml equivalent does. I'm also not sure if the Shared attribute is something I need account for in code.
Does anyone see how I can improve the code I am using?
Cheers,
Berryl

# XAML style to establish bindings
```
<ContextMenu x:Key="NonProjectActivityContextMenu" x:Shared="true">
<MenuItem
DataContext="{Binding MakeEachWeekDayFullDayCommand}" Command="{Binding .}"
Header="{Binding HeaderText}" InputGestureText="{Binding InputGestureText}"
/>
<MenuItem
DataContext="{Binding MakeFullDayCommand}" Command="{Binding .}"
Header="{Binding HeaderText}" InputGestureText="{Binding InputGestureText}"
/>
</ContextMenu>
<!-- Bindings assumes a VmMenuItem (Command Reference) -->
<Style x:Key="ContextMenuItemStyle" TargetType="{x:Type MenuItem}">
<Setter Property="Header" Value="{Binding HeaderText}"/>
<Setter Property="InputGestureText" Value="{Binding InputGestureText}" />
<Setter Property="Command" Value="{Binding Command}" />
<Setter Property="Icon" Value="{Binding Icon}" />
<Setter Property="Tag" Value="{Binding IdTag}" />
<Setter Property="ItemsSource" Value="{Binding Children}"/>
</Style>
```
# CODE
```
protected virtual ContextMenu _GetContextMenu() {
var menuItems = _dataContext.MenuItems.Select(menuItem => menuItem.ToMenuItem());
var cm = new ContextMenu();
foreach (var item in menuItems) {
cm.Items.Add(item);
}
return cm;
}
```
# UPDATE
Well the empty string part was just my own stupidity - I hadn't initialized the header text! The picture below is what I get now, which is an improvement. The text should update to say the day of the week tho, ie, "Make Monday a full day"

# EDIT for Erno
I am setting columns and the style for the grid itself as below, so I thought I can just fetch the resource for the context menu and set it.
Am getting an odd result however, as you can see from the pic - it's like the context menu is covering the whole grid!

```
private void OnDataGridLoaded(object sender, RoutedEventArgs e)
{
_dataContext = (ActivityCollectionViewModel)DataContext;
IsSynchronizedWithCurrentItem = true;
Style = (Style)FindResource(GRID_STYLE_NAME);
_AddColumns();
var timeSheetColumns = Columns.Cast<TimesheetGridColumn>();
foreach (var col in timeSheetColumns)
{
col.SetHeader();
col.SetCellStyle(this);
col.SetBinding();
}
if(DesignerProperties.GetIsInDesignMode(this)) {
// just so the designer doesn't hit a null reference on the data context
ItemsSource = new ObservableCollection<ActivityViewModel>();
}
else {
// ok, we have a runtime data context to work with
ItemsSource = _dataContext.ActivityVms;
InputBindings.AddRange(_GetKeyBindings());
ContextMenu = _GetContextMenu();
ContextMenu.Style = (Style)FindResource("ContextMenuItemStyle");
}
}
private void OnDataGridLoaded(object sender, RoutedEventArgs e)
{
_dataContext = (ActivityCollectionViewModel)DataContext;
IsSynchronizedWithCurrentItem = true;
Style = (Style)FindResource(GRID_STYLE_NAME);
_AddColumns();
var timeSheetColumns = Columns.Cast<TimesheetGridColumn>();
foreach (var col in timeSheetColumns)
{
col.SetHeader();
col.SetCellStyle(this);
col.SetBinding();
}
if(DesignerProperties.GetIsInDesignMode(this)) {
// just so the designer doesn't hit a null reference on the data context
ItemsSource = new ObservableCollection<ActivityViewModel>();
}
else {
// ok, we have a runtime data context to work with
ItemsSource = _dataContext.ActivityVms;
InputBindings.AddRange(_GetKeyBindings());
ContextMenu = _GetContextMenu();
ContextMenu.Style = (Style)FindResource("ContextMenuItemStyle");
}
}
```
# Latest Update
I tried making my binding relative per [this SO post](https://stackoverflow.com/questions/662164/wpf-context-menu-doesnt-bind-to-right-databound-item) but no dice. My command updated, meaning it executed on the correct cell, but I couldn't get the text to reflect which cell it was. I finally just decided to build the context menu on the fly as below. It work fine, although it seems I should have been able to do better.
Am going to give the answer to Erno and close this out.
```
private void OnCurrentCellChanged(object sender, EventArgs e)
{
if (ReferenceEquals(null, sender)) return;
var grid = (DataGrid)sender;
var selectedActivity = (ActivityViewModel)grid.CurrentItem;
if (ReferenceEquals(selectedActivity, null)) return;
if (_isEditableDayOfTheWeekColumn(grid.CurrentColumn))
{
var dowCol = (DayOfTheWeekColumn)grid.CurrentColumn;
var index = Convert.ToInt32(dowCol.DowIndex);
selectedActivity.SetSelectedAllocationVm(index);
}
else
{
selectedActivity.SetSelectedAllocationVm(-1);
}
var commands = selectedActivity
.AllCommands
.Select(vmMenuItem => vmMenuItem.Command.ToMenuItem());
var cm = new ContextMenu();
foreach (var item in commands)
{
//item.SetResourceReference(StyleProperty, "ContextMenuItemStyle");
cm.Items.Add(item);
}
grid.ContextMenu = cm;
}
```
|
context menu creation in code
|
CC BY-SA 2.5
| null |
2011-04-02T15:02:15.887
|
2011-04-03T15:50:46.320
|
2017-05-23T12:01:16.000
| -1 | 95,245 |
[
"wpf",
"silverlight",
"contextmenu",
"headereditemscontrol"
] |
5,524,178 | 1 | 5,524,291 | null | 1 | 82 |
Guys back to being stuck with my sql layout on my tables, I just cant seem to understand how to do this.
I need Users to be able to be friends with other Users (Users are kept in the User table) im trying to create a "Friends" table so they can relate to one another.
I need the UserID stored along with FriendID, UserID is of the current user and FriendID is related to the UserID of the friend. ARGh so confusing.
Im getting lost even talking about it again, basically the way ive written my code i need the FriendID to relate to the UserID of the user table so i can find the person im after so I can display there credentials on the current "UserID" page but I also need some way to find out all the current UserIDs friends
UserID relates to all current friends (FriendID)
FriendID relates to a user in the User table (UserID)
So far all I have is this. How do I refrence FriendID back to UserID? If thats even the way.

|
help with relationship of users
|
CC BY-SA 2.5
| null |
2011-04-02T15:53:19.247
|
2011-04-02T17:03:51.507
| null | null | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,524,188 | 1 | 5,524,261 | null | 0 | 205 |
So, I tried using this query:
```
SELECT name, pID, fname, lname, picpath, email
FROM Department, Professor
WHERE Department.dID = Professor.dID
AND Department.dID = ?
AND Professor_Comment.pcID = Professor.pcID
AND Professor_Comment.pcID = Comment.pcID;
```
This did not work. It returns 0 results
My tables look like:
Department - 
Professor - 
Professor Comment - 
Comment - 
|
Get Professors in Each Departments :: Comment Count SQL
|
CC BY-SA 2.5
| null |
2011-04-02T15:54:46.643
|
2011-04-02T16:20:01.753
|
2011-04-02T15:58:58.970
| 149,053 | 700,070 |
[
"sql"
] |
5,524,376 | 1 | 5,526,537 | null | 0 | 1,768 |
I've been looking around and searching all over the internet on how to do this. I am really baffled here because I don't think this is a built-in widget for the android API. What I am trying to build is a "list" of items that when an item is clicked, it shows a series of check boxes below it. An example on my EVO is the "News" application when you go to "Add Feeds". I'll try and draw it out here:
```
BEFORE NEWS IS PRESSED:
News >
AFTER NEWS IS PRESSED:
News (arrow points down)
CNN.com (checkbox)
Yahoo.com (checkbox)
```
I'm sure this has to be custom made but I don't know where to start. Any help is appreciated.
Here are the links to the images:
Before: 
After: 
|
Slide down menu with check boxes in android
|
CC BY-SA 3.0
| null |
2011-04-02T16:27:15.650
|
2011-11-23T21:43:16.430
|
2011-11-23T21:43:16.430
| 234,976 | 422,140 |
[
"android",
"list",
"checkbox",
"drop-down-menu"
] |
5,524,360 | 1 | 5,524,385 | null | 2 | 2,927 |
How to post back selected Category item from html.dropdownlist to the browse action method in the event controller? I am thinking of AJAX and JQuery.

EVENT CONTROLLER
EventController.cs
```
//
// GET: /Event/CategoryMenu
[ChildActionOnly]
public ActionResult CategoryMenu()
{
int id = 400;
ViewBag.Categories = storeDB.Categories.OrderBy(g => g.Name).ToList();
var cevent = storeDB.Events.Single(a => a.EventId == id);
return PartialView(cevent);
//var categories = storeDB.Categories.ToList();
//return PartialView(categories);
}
//
// GET: /Store/Browse
public ActionResult Browse(string category)
{
// Retrieve Category and its Associated Events from database
var categoryModel = storeDB.Categories.Include("Events").Single(g => g.Name == category);
return View(categoryModel);
}
```
MODEL
EventCalendarEntities.cs
```
public class EventCalendarEntities : DbContext
{
public DbSet<Event> Events { get; set; }
public DbSet<Category> Categories { get; set; }
public DbSet<Place> Places { get; set; }
public DbSet<Cart> Carts { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
}
```
Category.cs
```
public partial class Category
{
public int CategoryId { get; set; }
public string Name { get; set; }
public List<Event> Events { get; set; }
}
```
Event.cs
```
[Bind(Exclude = "EventId")]
public class Event
{
[ScaffoldColumn(false)]
public int EventId { get; set; }
[DisplayName("Category")]
public int CategoryId { get; set; }
[DisplayName("Place")]
public int PlaceId { get; set; }
[Required(ErrorMessage = "An Event Title is required")]
[StringLength(160)]
public string Title { get; set; }
[Required(ErrorMessage = "Price is required")]
[Range(0.01, 100.00, ErrorMessage = "Price must be between 0.01 and 100.00")]
public decimal Price { get; set; }
[Required(ErrorMessage = "Event Date is required")]
[DisplayName("Event Date")]
public DateTime EventDate { get; set; }
[Required(ErrorMessage = "Start Time is required")]
[DisplayName("Start Time")]
public TimeSpan StartTime { get; set; }
[Required(ErrorMessage = "End Time is required")]
[DisplayName("End Time")]
public TimeSpan EndTime { get; set; }
[Required(ErrorMessage = "Description is required")]
[StringLength(1000)]
public string Description { get; set; }
[DisplayName("Event Place URL")]
[StringLength(1024)]
public string EventPlaceUrl { get; set; }
public virtual Category Category { get; set; }
public virtual Place Place { get; set; }
}
```
VIEW
CategoryMenu.cshtml
```
@model MvcEventCalendar.Models.Event
<p id="categories">
@Html.LabelFor(model => model.Category)
@Html.DropDownListFor(model => model.Category, new SelectList(ViewBag.Categories, "CategoryId", "Name", Model.CategoryId), "-- Select Category --")
@Html.ValidationMessageFor(model => model.Category)
</p>
```
Browse.cshtml
```
@model MvcEventCalendar.Models.Category
@{
ViewBag.Title = "Browse Events";
}
<div class="genre">
<h3><em>@Model.Name</em> Events</h3>
<ul id="album-list">
@foreach (var theEvent in Model.Events)
{
<li><a href="@Url.Action("Details", new
{
id = theEvent.EventId
})">
<img alt="@theEvent.Title" src="@theEvent.EventPlaceUrl"/>
<span>@theEvent.Title</span> </a>
</li>
}
</ul>
</div>
```
I am getting Object reference not set to an instance of an object. NullReference exception was unhandled by user code in line Events
|
C# ASP.NET MVC 3 SQL database to html.dropdownlistfor and AutoPostBack to Browse action on selecting and item
|
CC BY-SA 3.0
| 0 |
2011-04-02T16:24:55.887
|
2012-09-28T20:00:23.700
|
2012-09-28T20:00:23.700
| 718,050 | 522,767 |
[
"c#",
"asp.net-mvc",
"asp.net-mvc-3",
"asp.net-ajax",
"code-first"
] |
5,524,495 | 1 | null | null | 1 | 751 |
I have two controls stacked on top of each other as such:

Button1 is ZIndex 2, Button2 is ZIndex 1.
Both need to be hit testable, as I need to listen to Button1's MouseEnter event for other system functions. But I also need to be able to have Button2 be clickable. I'm not quite sure how I can get this functionality to pan out (since I can't just set the Button1 to IsHitTestableFalse). Is there some sort of way I can say, in Button1's Click event
```
if (hasElementBeneath):
click that element instead
```
|
Allowing click-through with two hit testable controls
|
CC BY-SA 3.0
| null |
2011-04-02T16:49:34.017
|
2012-10-10T10:02:01.420
|
2012-10-10T10:02:01.420
| 677,014 | 689,084 |
[
"wpf"
] |
5,524,554 | 1 | 5,524,705 | null | 8 | 6,418 |
I'm just starting out working on my first iOS app. How do you create a `UITableViewCell` that contains a `UITextField` that looks like the Title and Location fields when adding an event within the Calendar application? Are there any handy third-party components for doing this?
I can see that the table view has two grouped items and that the text fields have some placeholder text, it's more about how to go about making the text fields take up 100% of their parent table view cells.
Thanks in advance for any help.

|
How to nest a UITextField within a UITableViewCell?
|
CC BY-SA 2.5
| 0 |
2011-04-02T17:00:29.237
|
2011-04-03T23:01:35.280
| null | null | 1,450 |
[
"iphone",
"ios",
"uitableview",
"uikit",
"uitextfield"
] |
5,524,602 | 1 | 5,526,003 | null | 11 | 7,532 |
I've searched without finding an exact solution for this... Does anyone know how to override Mathematica's default Monospaced font so all StandardForm Input/Output, including in the help browser, render in 'Consolas'?
The option inspector isn't helping much (probably because I don't know what I'm looking for?). There is also a 'font substitutions' list --- which I find confusing because of what appear to be circular references (i.e., includes things like: Courier -> New Courier and New Courier -> Courier)
Here's a screenshot comparing the two fonts at 125%.

|
Changing the default font for StandardForm I/O from 'New Courier' to 'Consolas'?
|
CC BY-SA 2.5
| 0 |
2011-04-02T17:08:42.057
|
2011-04-02T21:27:31.557
|
2011-04-02T17:14:27.163
| 667,867 | 667,867 |
[
"fonts",
"wolfram-mathematica",
"frontend"
] |
5,524,627 | 1 | 5,524,669 | null | 0 | 214 |
Here he comes to confuse his day! (should be my handle from now on)
Im confused and very much lost.
I need to figure out how to make a select statement for getting FriendID to relate to there UserID


As you can see FriendID relates to the UserID of my User table, so if FriendID = 2 then display UserID 2 details.
What im trying to do is if im UserID 1 I want to display all my friends, my userid is set by a session,
What I need to do is find out who my friends are so Select FriendID from freinds where SessionID = UserID then some how figure out who friendsID belongs to in the User table and display his firstname, secondname and his picturepath.
Very confusing...
My table structure looks like this:

So to sum it up what I need in my select command:
To find out who im friends with (currentsession UserID has FriendID's)
Display FirstName, SecondName, picturepath of friendID related to his own UserID
Example:
I (userID=1) have FriendID 2 = UserID 2 so select firstname, secondname from User where UserID=2
I could have relational problems with my table structure tho not sure.
I hope u can understand my confusion:
for those that cant see the images of my db
```
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `gymwebsite2` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `gymwebsite2` ;
-- -----------------------------------------------------
-- Table `gymwebsite2`.`User`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `gymwebsite2`.`User` (
`UserID` INT NOT NULL AUTO_INCREMENT ,
`Email` VARCHAR(245) NULL ,
`FirstName` VARCHAR(45) NULL ,
`SecondName` VARCHAR(45) NULL ,
`DOB` VARCHAR(45) NULL ,
`Location` VARCHAR(45) NULL ,
`Aboutme` VARCHAR(1045) NULL ,
`username` VARCHAR(45) NULL ,
`password` VARCHAR(45) NULL ,
PRIMARY KEY (`UserID`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `gymwebsite2`.`WallPosting`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `gymwebsite2`.`WallPosting` (
`idWallPosting` INT NOT NULL AUTO_INCREMENT ,
`UserID` INT NOT NULL ,
`Wallpostings` VARCHAR(2045) NULL ,
PRIMARY KEY (`idWallPosting`) ,
INDEX `fk_WallPosting_User` (`UserID` ASC) ,
CONSTRAINT `fk_WallPosting_User`
FOREIGN KEY (`UserID` )
REFERENCES `gymwebsite2`.`User` (`UserID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `gymwebsite2`.`Pictures`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `gymwebsite2`.`Pictures` (
`idPictures` INT NOT NULL AUTO_INCREMENT ,
`UserID` INT NOT NULL ,
`picturepath` VARCHAR(1045) NULL ,
PRIMARY KEY (`idPictures`) ,
INDEX `fk_Pictures_User1` (`UserID` ASC) ,
CONSTRAINT `fk_Pictures_User1`
FOREIGN KEY (`UserID` )
REFERENCES `gymwebsite2`.`User` (`UserID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `gymwebsite2`.`Friends`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `gymwebsite2`.`Friends` (
`idFriends` INT NOT NULL AUTO_INCREMENT ,
`UserID` INT NOT NULL ,
`FriendID` INT NOT NULL ,
PRIMARY KEY (`idFriends`) ,
INDEX `fk_Friends_User2` (`FriendID` ASC) ,
INDEX `fk_Friends_User1` (`UserID` ASC) ,
UNIQUE INDEX `FriendID_UNIQUE` (`FriendID` ASC) ,
CONSTRAINT `fk_Friends_User2`
FOREIGN KEY (`FriendID` )
REFERENCES `gymwebsite2`.`User` (`UserID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Friends_User1`
FOREIGN KEY (`UserID` )
REFERENCES `gymwebsite2`.`User` (`UserID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
```
|
help with sql select syntax
|
CC BY-SA 2.5
| null |
2011-04-02T17:15:54.383
|
2012-07-30T21:25:20.997
|
2011-04-02T17:23:41.787
| 477,228 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,524,872 | 1 | 5,524,936 | null | 3 | 17,707 |
How can I append a string to the end of an existing table value? Let's say I have the table below:

And let's say that Maria Anders not only lived in Berlin but also Tokyo. How would I append the string " Tokyo" onto the City column where ContactName = Maria Anders?
P.S. I want to be able to append on to a null value as well. Thus ending up with just the one city.
|
MySQL append string
|
CC BY-SA 2.5
| 0 |
2011-04-02T17:57:14.637
|
2011-04-02T18:11:20.870
| null | null | 552,067 |
[
"php",
"mysql",
"prepared-statement"
] |
5,525,005 | 1 | 5,525,028 | null | 1 | 3,818 |
What would be the best, most portable, simplest way to create a GUI-like feeling in the command line?
Basically I'm asking for a library that allows you to change background and text colors, have a text input area on the bottom of the console, and be able to edit a certain area in the command line without having to clear the whole screen. Does such a library exist?

Thank you.
|
Cross platform, open source, console GUI
|
CC BY-SA 2.5
| 0 |
2011-04-02T18:19:54.607
|
2011-08-30T15:56:05.887
| null | null | 656,224 |
[
"c++",
"console"
] |
5,525,114 | 1 | 5,566,424 | null | 3 | 1,507 |
I have a question about how dynamic the Y axis of a burn down chart in Scrum should be. We plot the chart in the beginning of a sprint having the total number of estimated story points on the Y axis, and the planned days on the X axis.

Usually, during the sprint, we have a fair amount of:
- -
Questions:
-

-

I would prefer to ignore the unplanned items and the re-estimations as they will show up in the actual focus factor calculation anyway. Is it wrong?

|
Dynamics of burn down charts in Scrum
|
CC BY-SA 3.0
| 0 |
2011-04-02T18:42:51.047
|
2017-02-21T19:19:57.327
|
2017-02-21T19:19:57.327
| 4,284,627 | 477,212 |
[
"scrum",
"burndowncharts"
] |
5,525,196 | 1 | 5,525,235 | null | 3 | 1,409 |
I reverted to a previous commit and made some changes.
Now I want to commit my changes and GIT says "You are not working on a branch. This commit will be unreferenced when switching to another branch and can be lost."
I don't care about any commits I made after this one, how do I commit now?

|
Committing after checkout. Git says "You are not working on a branch."
|
CC BY-SA 2.5
| null |
2011-04-02T18:56:44.047
|
2011-04-02T19:34:15.960
|
2011-04-02T19:34:15.960
| 555,242 | 555,242 |
[
"git"
] |
5,525,322 | 1 | 5,525,937 | null | 2 | 660 |
Someone's sent me a Word file full off address labels separated by tabs. See 
I'm trying to figure out the best way to import the addresses into individual records. Probably just go with NameLine, Address1, Address2 for each one (3 fields that I can parse later).
What can I do easily with C# or VBA? Or UltraEdit?
|
parsing address "label" fields in Excel, C#, VBA, other?
|
CC BY-SA 2.5
| null |
2011-04-02T19:19:52.927
|
2013-06-28T20:04:32.177
|
2013-06-28T20:04:32.177
| 1,048,862 | 335,036 |
[
"c#",
"parsing",
"street-address"
] |
5,525,349 | 1 | 5,525,499 | null | 0 | 1,344 |
I have a Mac App already created and distributed on the App Store to many customers, and I need to add an attribute to the Core Data Model. I read the documentation provided by Apple, available [here](https://i.stack.imgur.com/7vdUd.png).
However, it gives this block of code to enable automatic migration:
```
NSError *error;
NSPersistentStoreCoordinator *psc = <#The coordinator#>;
NSURL *storeURL = <#The URL of a persistent store#>;
NSDictionary *optionsDictionary =
[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
forKey:NSMigratePersistentStoresAutomaticallyOption];
NSPersistentStore *store = [psc addPersistentStoreWithType:<#Store type#>
configuration:<#Configuration or nil#>
URL:storeURL
options:optionsDictionary
error:&error];
```
.. And I have no idea where to put that. Someone mentioned (in another thread) that it goes into a PersistentStoreCoordinator, however, I simply used the default Cocoa App Template with "Use Core Data for Storage" enabled. I had to create my own AppDelegate and never saw anything about a PersistentStoreCoordinator (and still don't. I've tried creating a new app just to check). Any help here? I'm new to Cocoa but my app works perfectly fine without a PersistentStoreCoordinator, which is why I haven't implemented one yet.. I do have an AppDelegate I created, but when I put this code in there it throws many errors. HELP :/
EDIT (for nick): Here is the new code:

And my header file:

|
Where to Put Code Configuring Persistent Store for Migration
|
CC BY-SA 2.5
| 0 |
2011-04-02T19:26:18.037
|
2011-04-04T20:24:41.373
|
2011-04-04T20:24:41.373
| 190,807 | 578,388 |
[
"objective-c",
"cocoa",
"core-data",
"core-data-migration"
] |
5,525,602 | 1 | 5,527,645 | null | 80 | 31,271 |
I have an MVC3 site using Razor as its view engine. I want my site to be skinnable. Most of the possible skins are similar enough that they can derive from a shared master layout.
Therefore, I am considering this design:

However, I would like to be able to call `RenderSection` in the bottom layer, `_Common.cshtml`, and have it render a section that is defined in the top layer, `Detail.cshtml`. This doesn't work: `RenderSection` apparently only renders sections that are defined the next layer up.
Of course, I can define each section in each skin. For instance, if `_Common` needs to call `RenderSection("hd")` for a section defined in `Detail`, I just place this in each `_Skin` and it works:
```
@section hd {
@RenderSection("hd")
}
```
This results in some duplication of code (since each skin must now have this same section) and generally feels messy. I'm still new to Razor, and it seems like I might be missing something obvious.
When debugging, I can see the complete list of defined sections in WebViewPage.SectionWritersStack. If I could just tell RenderSection to look through the entire list before giving up, it would find the section I need. Alas, SectionWritersStack is non-public.
Alternatively, if I could access the hierarchy of layout pages and attempt execution of RenderSection in each different context, I could locate the section I need. I'm probably missing something, but I don't see any way to do this.
Is there some way to accomplish this goal, other than the method I've already outlined?
|
Razor Nested Layouts with Cascading Sections
|
CC BY-SA 2.5
| 0 |
2011-04-02T20:16:47.953
|
2014-12-09T20:46:04.707
| null | null | 110,164 |
[
"asp.net-mvc-3",
"razor",
"viewengine"
] |
5,525,628 | 1 | null | null | 1 | 327 |
I am developing a kind a translator from language A to B (yeah, it kinda is like a compiler). A translation is generally from several different files and each one of them has the same 3 sections to translate. So, the way I did it, I kind of have it the following way:

When I instantiate a translator and give it some data, it will need to generate all the needed FileTranslator classes. As I shouldn't do the `new` in Translator, I should ask for a factory from above. The same happens in the Sections translators. This poses the problem that I'm forced to create a lot of boilerplate factories. Moreover, each one of the translators might need even more factories to generate some other classes they might want to use.
Am I thinking this the wrong way or is it just the way it is? I am not allowed to use any kind of DI/IoC framework in this project, btw.
## Edit:
I'm afraid I am not getting my message get sent across.
In this specific case, as my Translator class needs to be able to generate at any moment some FileTranslator, it would need a FileTranslatorFactory. I know I can have an IoC Container do the wiring for me, but the IoC Container in itself will not save me for the problem of having to code up the code of the FileTranslatorFactory itself. Am I right?
Now, the problem is that a FileTranslator will also have to be able to generate whenever it needs SectionATranslators, SectionBTranslators and SectionCTranslators (and do not think they are any similar because their names are -- they are totally different and have nothing to do with each other!). So I'd have to define factories for each one of them. So for such a simple 5 classes system, I'd need to create 4 (!!!) factories.
Being that I don't want my domain objects to depend on an IoC-Container and that I don't want to have a single factory for all the 4 kinds of objects that seem to need one, am I still missing something?
|
Dependency Injection in projects that have lots of classes that need to generate on the fly other classes
|
CC BY-SA 2.5
| 0 |
2011-04-02T20:22:41.300
|
2011-04-03T18:45:43.130
|
2011-04-03T17:32:59.350
| 130,758 | 130,758 |
[
"c#",
"java",
"oop",
"dependency-injection",
"factory"
] |
5,525,641 | 1 | 5,525,713 | null | -2 | 345 |
Hey guys I think I've just royally shot myself in the foot. I have a website where users have their own profile and can post on their walls but I'm getting to the point where I want to implement that friends can post on my wall and I can post on my friends wall.
This is what my site looks like so far:

My database design is like so:

And here is a code snippet of how I achieve posting on walls:
```
protected void Button1_Click(object sender, EventArgs e)
{
string theUserId = Session["UserID"].ToString();
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=******;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("INSERT INTO WallPosting (UserID, Wallpostings) VALUES (" + theUserId + ", '" + TextBox1.Text + "')", cn))
{
cmd.ExecuteNonQuery();
}
}
PopulateWallPosts(theUserId);
}
}
```
Now my problem is how on earth do I get friends posts on my wall AHHHHH... runs in fear!!!
Have I shot myself in the foot?
Also this is how I generate my content on the page:
```
private void PopulateWallPosts(string userId)
{
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("SELECT idWallPosting, wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN User u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
{
//("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN [User] u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
div.ID = String.Format("{0}", reader.GetString(0));
string id = Convert.ToString(div.ID);
//store the div id as a string
Image img = new Image();
img.ImageUrl = String.Format("{0}", reader.GetString(2));
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format("   " + "{0}", reader.GetString(1))));
div.Attributes.Add("onclick", "confirm_delete(" + id + ");");
// send the div id to javascript
div.Style["clear"] = "both";
test1.Controls.Add(div);
}
}
}
}
}
```
|
have I shot myself in the foot... that is the question!
|
CC BY-SA 2.5
| null |
2011-04-02T20:24:33.727
|
2011-04-02T21:48:02.033
|
2011-04-02T21:29:51.380
| 9,436 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql"
] |
5,525,728 | 1 | 5,532,241 | null | 1 | 1,777 |
I tried to put background image to linearlayout in my android project. All is working nicely except those fading edges in the left and right on the screen. My background image dimensions are 52x602 and don't have such fading edge originally. I want the background image to cover all the area. Also it has done by designer and using 9-patch I think (black border around image). How can I set the background correctly without those edges?
In emulator it looks like this:

XML:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/login_background"
android:orientation="vertical"
>
</LinearLayout>
```
|
Background image with fading edges
|
CC BY-SA 2.5
| null |
2011-04-02T20:42:45.403
|
2011-04-03T20:23:08.073
|
2011-04-03T20:22:08.307
| 526,217 | 526,217 |
[
"android",
"user-interface"
] |
5,525,758 | 1 | 5,526,464 | null | 8 | 6,163 |
I am trying to profile my application to monitor the effects of a function, both before and after refactoring. I have performed an analysis of my application and having looked at the Summary I've noticed that the [Hot Path](http://msdn.microsoft.com/en-us/library/ms182398.aspx) list does not mention any of my functions used, it only mentions functions up to Application.Run()
I'm fairly new to profiling and would like to know how I could get more information about the Hot Path as demonstrated via the [MSDN documentation](http://msdn.microsoft.com/en-us/library/ms242741.aspx);


I've noticed in the Output Window there are a lot of messages relating to a failure when loading symbols, a few of them are below;
```
Failed to load symbols for C:\Windows\system32\USP10.dll.
Failed to load symbols for C:\Windows\system32\CRYPTSP.dll.
Failed to load symbols for (Omitted)\WindowsFormsApplication1\bin\Debug\System.Data.SQLite.dll.
Failed to load symbols for C:\Windows\system32\GDI32.dll.
Failed to load symbols for C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll.
Failed to load symbols for C:\Windows\system32\msvcrt.dll.
Failed to load symbols for C:\Windows\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll.
Failed to load symbols for C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll. Failed to load symbols for
C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll.
Unable to open file to serialize symbols: Error VSP1737: File could not be opened due to sharing violation: - D:\(Omitted)\WindowsFormsApplication1110402.vsp
```
Thanks for any pointers.
|
Function profiling woes - Visual Studio 2010 Ultimate
|
CC BY-SA 3.0
| 0 |
2011-04-02T20:48:47.203
|
2015-01-07T22:55:12.820
|
2015-01-07T22:55:12.820
| 394,167 | 218,159 |
[
"c#",
"visual-studio-2010",
"refactoring",
"profiling"
] |
5,525,972 | 1 | 5,525,984 | null | 10 | 27,732 |
How to select multiple files for upload :

|
How to select multiple files for upload?
|
CC BY-SA 2.5
| 0 |
2011-04-02T21:22:11.103
|
2014-09-17T12:51:45.530
| null | null | 98,204 |
[
"php",
"javascript",
"html",
"file-upload",
"upload"
] |
5,526,005 | 1 | 5,526,114 | null | 18 | 3,535 |
I have problem but I don't know how to describe it so I have drawn it.

As you can see ball bounces when collision is detected. Nevermind the angle - I have just drawn it that way.
But sometimes ball goes through the paddle leaving it other way.
Why that happens ? Becase when I detect the collision I change vx to -vx. What should I do in that case ? Change also y ? But how to check which side of the paddle ball hit?
Maybe other ideas?
|
Pong physics problem
|
CC BY-SA 2.5
| 0 |
2011-04-02T21:28:08.930
|
2017-08-13T18:03:11.810
|
2011-05-10T20:42:26.380
| 21,234 | 670,700 |
[
"c++",
"math",
"physics",
"sfml"
] |
5,526,047 | 1 | 6,784,073 | null | 5 | 3,554 |
I have encountered the weirdest display bug with my `UISearchBar`.
Here is my code that works perfectly in another app. (I create the search bar in code because a xib file is not feasible.)
```
searchBar = [[UISearchBar alloc] initWithFrame:
CGRectMake(0, 0, self.tableView.frame.size.width, 44)];
searchBar.delegate = self;
searchController = [[UISearchDisplayController alloc]
initWithSearchBar:searchBar contentsController:self];
searchController.delegate = self;
searchController.searchResultsDataSource = self;
searchController.searchResultsDelegate = self;
self.tableView.tableHeaderView = searchBar;
```
The search functionality etc. works fine. But strangely, the search bar looks like this, both on the device and the simulator:

- - - `searchBar.placeholder``searchBar.prompt``@""``nil``searchBar.placeholder = @"FooBar";`-
Any help? The most pressing problem is to get the text to over the right.
|
UISearchBar display bug: text too far left, overlapping the magnifying glass icon
|
CC BY-SA 3.0
| 0 |
2011-04-02T21:34:48.430
|
2017-11-01T09:02:43.533
|
2017-11-01T09:02:43.533
| 1,000,551 | 427,083 |
[
"ios",
"objective-c",
"uisearchbar"
] |
5,526,062 | 1 | 5,526,152 | null | 1 | 204 |
I had to do some refactoring to my database it did look like this:

But I had to change WallPosting to this:

Now my problem is how to fix my sql syntax so my code works again, I made a few manual entries for now to see if I can get them to be displayed:

The FriendUserID relates to another UserID in the usertable who has obviously a different picture and information but I don't know how to display to concurrent WallPosting's from different users atm.
my code creates a dynamic div gives the div an ID = to the userid and input the wallpost messages named wallpostings, it takes the information stored about the userid and applys the image related to that userid, is there any way this can be changed with sql? or have I went down a one way alley? atm I just want to see if I can get the populatewallposts select statement to work.
My code:
```
public partial class UserProfileWall : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
//It is a postback so check if it was by div click (NOT WORKING because the javascript isnt posting back)
string target = Request["__EVENTTARGET"];
if (target == "DivClicked")
{
string id = Request["__EVENTARGUMENT"];
//Call my delete function passing record id
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("DELETE FROM WallPosting WHERE idWallPosting="+id, cn))
{
cmd.ExecuteNonQuery();
}
}
}
}
string theUserId = Session["UserID"].ToString();
PopulateWallPosts(theUserId);
}
private void PopulateWallPosts(string userId)
{
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("SELECT idWallPosting, wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN User u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
{
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
div.ID = String.Format("{0}", reader.GetString(0));
string id = Convert.ToString(div.ID);
//store the div id as a string
Image img = new Image();
img.ImageUrl = String.Format("{0}", reader.GetString(2));
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format("   " + "{0}", reader.GetString(1))));
div.Attributes.Add("onclick", "confirm_delete(" + id + ");");
// send the div id to javascript
div.Style["clear"] = "both";
test1.Controls.Add(div);
}
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string theUserId = Session["UserID"].ToString();
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("INSERT INTO WallPosting (UserID, Wallpostings) VALUES (" + theUserId + ", '" + TextBox1.Text + "')", cn))
{
cmd.ExecuteNonQuery();
}
}
PopulateWallPosts(theUserId);
}
}
```
I get the error: Index was outside the bounds of the array.
```
using (OdbcCommand cmd = new OdbcCommand("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp INNER JOIN User u ON u.UserID = wp.FriendUserID INNER JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
```
|
sql syntax problem and or code problem? "Index was outside the bounds of the array."
|
CC BY-SA 4.0
| 0 |
2011-04-02T21:38:01.493
|
2018-10-27T19:05:28.883
|
2018-10-27T19:05:28.883
| 1,033,581 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,526,158 | 1 | 5,526,306 | null | 1 | 2,557 |
I can't seem to figure out how to scale pixels on an html5 canvas. Here's where I am so far.
```
function draw_rect(data, n, sizex, sizey, color, pitch) {
var c = Color2RGB(color);
for( var y = 0; y < sizey; y++) {
var nn = n * 4 * sizex;
for( var x = 0; x < sizex; x++) {
data[nn++] = c[0];
data[nn++] = c[1];
data[nn++] = c[2];
data[nn++] = 0xff;
}
n = n + pitch;;
}
}
function buffer_blit(buffer, width, height) {
var c_canvas = document.getElementById("canvas1");
var context = c_canvas.getContext("2d");
context.scale(2, 2);
var imageData = context.getImageData(0, 0, context.canvas.width, context.canvas.height);
var n = width * height - 1;
while((n--)>=0) draw_rect(imageData.data, n, pixel, pixel, buffer[n], width);
context.putImageData(imageData, 0, 0);
}
```
Edits:
I updated the code here. Not sure what changed.
Maybe some images will help.
First image has pixel size of one, second pixel size of 2. Note that the image doubles and only fills half the canvas.


Edit2:
I made a webpage showing at least one of the strange behaviors I'm experiencing.
[Live example](http://jsbin.com/ofila6/edit)
|
javascript html5 scaling pixels
|
CC BY-SA 2.5
| null |
2011-04-02T21:55:07.380
|
2011-04-03T01:10:15.170
|
2011-04-03T01:10:15.170
| 104,304 | 104,304 |
[
"javascript",
"html",
"html5-animation"
] |
5,526,226 | 1 | 5,526,604 | null | 3 | 885 |
FFT and changing frequency and vectorizing for loop
Greetings All
I can increase and decrease the frequency of a
signal using the combination of fft and a Fourier series expansion FOR loop in
the code below
but if the signal/array is to large it becomes extremely
slow (an array that's 1x44100 takes about 2 mins to complete) I'm sure
it has to do with the for loop but
I'm not exactly sure how to vectorize it to improve performance. Please note that this will be used with audio signals that are 3 to 6 mins long. The 1x44100 array is only a second and it takes about 2 mins to complete
Any recommendations
```
%create signal
clear all, clc,clf,tic
x= linspace(0,2*pi,44100)';
%Used in exporting to ycalc audio file make sure in sync with above
freq_orig=1;
freq_new=4
vertoff=0;
vertoffConj=0;
vertoffInv=0;
vertoffInvConj=0;
phaseshift=(0)*pi/180 ; %can use mod to limit to 180 degrees
y=sin(freq_orig*(x));
[size_r,size_c]=size(y);
N=size_r; %to test make 50
T=2*pi;
dt=T/N;
t=linspace(0,T-dt,N)';
phase = 0;
f0 = 1/T; % Exactly, one period
y=(y/max(abs(y))*.8)/2; %make the max amplitude here
C = fft(y)/N; % No semicolon to display output
A = real(C);
B = imag(C)*-1; %I needed to multiply by -1 to get the correct sign
% Single-Sided (f >= 0)
An = [A(1); 2*A(2:round(N/2)); A(round(N/2)+1)];
Bn = [B(1); 2*B(2:round(N/2)); B(round(N/2)+1)];
pmax=N/2;
ycalc=zeros(N,1); %preallocating space for ycalc
w=0;
for p=2:pmax
%
%%1 step) re-create signal using equation
ycalc=ycalc+An(p)*cos(freq_new*(p-1).*t-phaseshift)
+Bn(p)*sin(freq_new*(p-1).*t-phaseshift)+(vertoff/pmax);
w=w+(360/(pmax-1)); %used to create phaseshift
phaseshift=w;
end;
fprintf('\n- Completed in %4.4fsec or %4.4fmins\n',toc,toc/60);
subplot(2,1,1), plot(y),title('Orginal Signal');
subplot(2,1,2),plot(ycalc),title('FFT new signal');
```
Here's a pic of the plot if some one wants to see the output, which is correct the FOR loop is just really really slow

|
FFT and changing frequency and vectorizing a FOR loop
|
CC BY-SA 2.5
| 0 |
2011-04-02T22:09:19.817
|
2011-04-03T02:05:17.367
|
2011-04-03T02:05:17.367
| 676,430 | 676,430 |
[
"matlab",
"audio",
"for-loop",
"fft",
"vectorization"
] |
5,526,283 | 1 | 5,526,304 | null | 0 | 199 |
This is my MySQL table:

- - -
I am inserting data into the table like so:
```
$stmt = $db->prepare("INSERT INTO likes (user_id,post_id) VALUES (?,?)");
$stmt->execute(array($_SESSION['user'],$_POST['id']));
```
This works fine, but as you can see the MySQL table has two identical rows (id's 3 & 4) which both have a user_id of 5 and a post_id of 196. In other words my MySQL table records that the user with id = 5 likes the post with id = 196 how do I disallow a situation where there are two rows that have identical user_id's identical post_id's
|
MySQL disallow row that has 2 identical column values with another row
|
CC BY-SA 2.5
| null |
2011-04-02T22:21:23.413
|
2011-04-02T22:57:32.393
| null | null | 552,067 |
[
"php",
"mysql"
] |
5,526,314 | 1 | null | null | 1 | 278 |
I have the same solution like in Uber app. I want to locate myself (this is simple) and put some pin on the center of screen. When I scroll map, red pin stays in center of screen, and in text field is updated street name where is red pin.
I found that I must to use overlay map for this centered pin, but I don't know what to do with reverse geocoding and text field.
There is some example of this behavior or can you give some sample, or anything how to make this?

|
MKReverseGeocoder updating text field
|
CC BY-SA 2.5
| null |
2011-04-02T22:28:39.407
|
2011-04-25T23:50:44.337
| null | null | 483,753 |
[
"ios",
"ios4",
"mkmapview"
] |
5,526,323 | 1 | 5,528,206 | null | 1 | 1,814 |
I am trying to create some simple ajax rating using [rate it jquery](http://www.radioactivethinking.com/rateit/example/example.htm) .
I am able to see the stars and press them. But my form does not submit.
How do I submit the rating with ajax?
In my table I have two columns:
```
rating_score => The current score
ratings => The number of ratings which led to the score
```
My kategori show view:
```
<h1><%= @kategori.h2.force_encoding("UTF-8") %></h1>
<div id="konkurrancer"><%= render 'konkurrencer', :remote => true %></div>
```
My konkurrencer partial:
```
<div id="tabel">
<table id="tabel1">
<tr id="toptr">
<td><%= sortable "name", "Navn" %></td>
</tr>
<% @konkurrancer.each do |vind| %>
<tr class="thumbnail-item" onclick="window.open('<%= vind.tracking %>')">
<td><%= truncate(vind.name.force_encoding("UTF-8"), :length => 45) %></td>
<td>
<div id="container">
<%= render :partial => "rating", :remote => true, :locals => { :vind => vind } %>
</div>
</td>
</tr>
<% end %>
</table>
<div id="pagenavi">
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
</div>
</div>
```
My ratings partial:
```
<%= form_for(:vind, :url => rate_path(vind.id), :remote => true, :html => { :method => 'put', :id => "rateform"}) do |f| %>
<%= f.text_field :ratings, :size => 1, :min => 1, :max => 6, :value => 1, :type => 'range', :step => '1', :id => "#{vind.id}" %>
<div class="rateit" id="rateit10b" data-rateit-backingfld="#<%= vind.id %>" data-rateit-resetable="false" ></div>
<% end %>
<script type ="text/javascript">
$('.rateit').bind('rated reset', function (e) {
var ri = $(this);
//if the use pressed reset, it will get value: 0 (to be compatible with the HTML range control), we could check if e.type == 'reset', and then set the value to null .
var value = ri.rateit('value');
var frmurl = ri.closest('form').attr('action'); //get the url from the form
$.ajax({
url: frmurl, //your server side script
data: { ratings: value }, //our data
type: 'PUT',
success: function (data) {
//write here something when everything went ok
},
error: function (jxhr, msg, err) {
alert(msg); //something went wrong.
}
});
});
</script>
```
My rate.js:
```
$('#<%= @container %>').html('<%= escape_javascript(render(partial: 'rating', locals: { konkurrancer: @konkurrancer })) %>');
```
My Controller:
```
class KonkurrancersController < ApplicationController
def rate
@konkurrancer = Konkurrancer.find(params[:id])
@container = "Konkurrancer"[email protected]_s
@theme.rating_score += params[:rating].to_i
@theme.ratings += 1
@theme.save
respond_to do |format|
format.js
end
end
end
```
Here is my rating in my browser. When I press gem Vind the params rating is send with ajax with the value 5. The problem is that I want it to send when pressed on the stars instead using the submit button.

My console when the form is submitted:
```
Started POST "/konkurrancers/rate/12" for 127.0.0.1 at 2011-04-04 23:37:56 +0200
Processing by KonkurrancersController#rate as JS
Parameters: {"utf8"=>"Ô£ô", "authenticity_token"=>"3IqZ6IfvaFYQnVeMYu2a09PcCnm
VW52vaEp2KjfJ1g8=", "vind"=>{"rating"=>"6"}, "commit"=>"Gem Vind", "id"=>"12"}
←[1m←[35mKonkurrancer Load (1.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurr
ancers`
←[1m←[36mCACHE (0.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `konkurrancers`←
[0m
←[1m←[35mCACHE (0.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurrancers`
←[1m←[36mKonkurrancer Load (1.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers` WHERE (`konkurrancers`.`cached_slug` = '12') LIMIT 1←[0m
←[1m←[35mSQL (1.0ms)←[0m SELECT sluggable_id FROM slugs WHERE ((slugs.sluggab
le_type = 'Konkurrancer' AND slugs.name = '12' AND slugs.sequence = 1))
←[1m←[36mKonkurrancer Load (0.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers` WHERE (`konkurrancers`.`id` = 12) LIMIT 1←[0m
←[1m←[35mSQL (0.0ms)←[0m BEGIN
←[1m←[36mSlug Load (22.0ms)←[0m ←[1mSELECT `slugs`.* FROM `slugs` WHERE (`slu
gs`.sluggable_id = 12 AND `slugs`.sluggable_type = 'Konkurrancer') ORDER BY id D
ESC LIMIT 1←[0m
←[1m←[35mAREL (14.0ms)←[0m UPDATE `konkurrancers` SET `rating_score` = 17, `r
atings` = 5, `updated_at` = '2011-04-04 21:37:57' WHERE (`konkurrancers`.`id` =
12)
←[1m←[36mSQL (16.0ms)←[0m ←[1mCOMMIT←[0m
Rendered konkurrancers/_rating.html.erb (1.0ms)
Rendered konkurrancers/rate.js.erb (24.0ms)
Completed 200 OK in 439ms (Views: 226.0ms | ActiveRecord: 55.0ms)
```
My html in view: [http://pastie.org/1756195](http://pastie.org/1756195)
|
Rails How to create ajax star rating
|
CC BY-SA 2.5
| 0 |
2011-04-02T22:29:52.280
|
2015-03-25T18:22:52.940
|
2011-04-04T21:39:05.737
| 557,527 | 557,527 |
[
"jquery",
"ruby-on-rails",
"ruby",
"ruby-on-rails-3"
] |
5,526,369 | 1 | 5,526,414 | null | 0 | 162 |
I'm working on a very simple flash but having problem compiling to the swf file. The detailed error info are roughly translated as follows:
Line 47 : DisplayObject variable cannot be "undefined"
Line 51 : DisplayObject variable cannot be "undefined"
Line 101 : DisplayObject variable cannot be "undefined"

Line 10 : void method has been used where Boolean value was required
Line 60 : displace problem(I suspect it means some files has been moved to elsewhere) ,clearInterval method is no longer supported,it has been moved to flash.utils pack
Line 243 : setInterval method is no longer supported, it has been moved to flash.utils. please consider Timer class

Please refer to the screen-shots and the code line in question has been highlighted.
|
Flash compilation error
|
CC BY-SA 3.0
| null |
2011-04-02T22:41:42.960
|
2017-07-30T07:12:16.160
|
2017-07-30T07:12:16.160
| 1,033,581 | 577,363 |
[
"flash",
"actionscript-3",
"actionscript",
"animation"
] |
5,526,432 | 1 | 10,679,247 | null | 16 | 9,282 |
I've just tried using gdb on [BackTrack Linux](http://www.backtrack-linux.org/) and I must say that its awesome. I wonder how gdb in backtrack is configured to act this way.

When I set a breakpoint, all the register values, a part of the stack, a part of the data section and the next 10-15 instructions to be executed are printed. The same happens when I `step` or `next` through the instructions.
I find this amazing and would love to have this on my Ubuntu machine too; how could I go about doing this?
|
gdb in backtrack
|
CC BY-SA 2.5
| 0 |
2011-04-02T22:54:00.747
|
2015-08-16T12:26:47.690
|
2011-04-04T01:52:05.767
| 50,617 | null |
[
"linux",
"gdb"
] |
5,526,484 | 1 | 5,526,496 | null | 1 | 3,149 |
I am getting this error:
> Index was outside the bounds of the array.
Code:
```
private void PopulateWallPosts(string userId)
{
using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
{
cn.Open();
using (OdbcCommand cmd = new OdbcCommand("SELECT wp.WallPostings, p.PicturePath FROM WallPosting wp INNER JOIN User u ON u.UserID = wp.FriendUserID INNER JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC", cn))
{
//SELECT idWallPosting, wp.WallPostings, p.PicturePath FROM WallPosting wp LEFT JOIN User u ON u.UserID = wp.UserID LEFT JOIN Pictures p ON p.UserID = u.UserID WHERE wp.UserID=" + userId + " ORDER BY idWallPosting DESC
using (OdbcDataReader reader = cmd.ExecuteReader())
{
test1.Controls.Clear();
while (reader.Read())
{
System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
div.Attributes["class"] = "test";
div.ID = String.Format("{0}", reader.GetString(0)); //idwallposting
string id = Convert.ToString(div.ID);
//store the div id as a string
Image img = new Image();
img.ImageUrl = String.Format("{0}", reader.GetString(2)); //p.picturepath
img.AlternateText = "Test image";
div.Controls.Add(img);
div.Controls.Add(ParseControl(String.Format("   " + "{0}", reader.GetString(1)))); //wp.wallpostings
div.Attributes.Add("onclick", "confirm_delete(" + id + ");");
// send the div id to javascript
div.Style["clear"] = "both";
test1.Controls.Add(div);
}
}
}
}
}
```

|
Index was outside the bounds of the array
|
CC BY-SA 4.0
| null |
2011-04-02T23:04:25.337
|
2019-02-10T21:21:29.447
|
2019-02-10T21:21:29.447
| 472,495 | 477,228 |
[
"c#",
"asp.net",
"mysql",
"sql",
"html"
] |
5,526,543 | 1 | 5,526,555 | null | 2 | 1,684 |
I'm using some PHP to display the last time a blog post was updated on WordPress using the `get_the_time` and `get_the_modified_time` functions. However, I can't get the last modified time to display inline in the paragraph.
```
<?php
$x = get_the_time('U');
$m = get_the_modified_time('U');
if ($m != $x) {
$t = the_modified_time('F d, Y');
echo "<p class=\"lastupdated\">Updated on $t </p>";
}
?>
```
Here's a screenshot of the result:

|
Display last date a post was updated on WordPress
|
CC BY-SA 2.5
| 0 |
2011-04-02T23:19:33.840
|
2021-03-13T21:45:21.700
|
2011-04-02T23:24:04.587
| 333,786 | 689,345 |
[
"php",
"wordpress"
] |
5,526,551 | 1 | 5,526,586 | null | 1 | 153 |
I have a simple Document based Core Data app (built around the standard Apple tutorials). At the moment I have a button connected to the add: method of a controller (Sheet Controller) that drops down a modal sheet from the main document window. The connection is made in IB (see below from MyDocument.xib). There is also another controller (Another Controller)

My question is how do I programatically change the buttons action method to point to a method in 'Another Controller' instead of the 'Sheet Controller it is wired up to in IB
Many Thanks
|
Programmatically changing a connection made in IB (OSX)
|
CC BY-SA 2.5
| null |
2011-04-02T23:21:55.740
|
2011-04-02T23:38:29.397
| null | null | 265,369 |
[
"cocoa",
"macos"
] |
5,526,764 | 1 | null | null | 11 | 6,037 |
I'm having trouble with this page: [http://seatgeek.com/atlanta-hawks-tickets/](http://seatgeek.com/atlanta-hawks-tickets/). If you zoom out one level from the "normal" setting in Firefox, the page looks like this: . This happens with both versions 3.6 and 4.0 of FF. It does not happen with Webkit.
Clearly the problem lies in the elements within the "list_details" div. The problem can be fixed by decreasing the width of the "col1" or "col2" spans by 1px or by increasing the "vevent" li element by 1px, but these fixes cause the design to render improperly.
If you add up the width of "col1" and "col2", also taking into account their horizontal padding and border, the total width is 647px. But it only displays properly in Firefox (when zoomed out one level) when the "vevent" element, which contains the two, has a width of 648px. Why is that?
|
Zooming in Firefox Causes Page Layout to Break
|
CC BY-SA 3.0
| 0 |
2011-04-03T00:25:50.043
|
2019-11-07T20:32:41.873
|
2012-06-05T13:41:32.503
| 319,931 | 135,156 |
[
"html",
"firefox",
"layout",
"css"
] |
5,526,873 | 1 | 5,527,192 | null | 5 | 4,321 |
This is a bit tough, and I would love some help with this. I have researched forever and cannot find a way to do so, nor know how to write it. I am looking to create an iPhone folder-like design for the web. The design is like this:

For those of you who have iDevices, I want that "slide out" effect when you click on the folder as well.
For those of you who do not have iPhones/ipads/itouch (I dont know how you live with yourself first off!) but its a nice flowing opening menu when you click on it.
When you click the "login" button I want it to look like an the opening of the iphone folder, and kind of "split" the page in half like the iDevices do.
I'd love help writing this to work, as I'm sure a ton of people would benefit from it as well. It doesn't have to be exact, I just want the underlying animation. I can write everything else myself. Everything you need should be on that site if you view the source.
Click "Browse all Features" on:
[http://www.apple.com/ipodtouch/features/](http://www.apple.com/ipodtouch/features/)
Thats exactly what I want.
Thanks for all your help everyone!
|
iPhone like folder opened design on the web
|
CC BY-SA 2.5
| 0 |
2011-04-03T01:04:22.763
|
2012-08-03T05:42:42.250
|
2011-04-03T02:47:40.133
| 686,581 | 686,581 |
[
"jquery",
"iphone",
"css",
"stylesheet"
] |
5,526,988 | 1 | 5,529,428 | null | 4 | 6,944 |
I'm wondering if this is something somewhat simple, but I'm having a problem ONLY on iPad with my sprited images. I have an tag that I use a sprite for to display an image of a star (similar to gmail or picasa) to indicate a favorite. On every other browser (including safari) on a computer, it's all completely fine.
The problem is on an iPad, it's showing more of the sprite than it should and it looks strange. What's even stranger is that this image is repeated several times and it doesn't seem to happen consistently.
Is this some sort of zoom issue or viewport setting problem specifically for iPad? It's driving me crazy, and anything I do to fix it cuts off some of the image and ruins the normal browser look.
Here's an example of what I mean since I can't put up the page I'm currently working on.
On this site I've worked on in the past, the viewing options look strange on an iPad:
[http://demo.qlikview.com/index.aspx?section=Life](http://demo.qlikview.com/index.aspx?section=Life)
For example the "Download" viewing option looks different on the FEMA app than on the Kick It app so it doesn't even appear to be consistent.

Any help would be appreciated.
Thanks!
|
ipad showing my sprite images incorrectly
|
CC BY-SA 2.5
| 0 |
2011-04-03T01:32:23.263
|
2012-11-30T07:20:24.700
|
2011-04-03T12:28:25.000
| 157,397 | 387,885 |
[
"css",
"ipad",
"safari",
"mobile-safari",
"css-sprites"
] |
5,527,047 | 1 | 5,532,965 | null | 1 | 5,909 |
I've been working OpenGL's Superbible (5th Edition) point light examples.
I found them missing the constant, linear and quadratic attenuation values integrated into the old lighting model, so I went and wrote a point light shader with attenuation values based on this [ogre guide](http://www.ogre3d.org/tikiwiki/-Point+Light+Attenuation).
The results have been completely bizarre.
-sphere is black, light is blue-

-sphere is black, light is blue-

-sphere is black, light is blue-

-sphere is black, light is blue-

Vertex program:
```
//point light per pixel vertex program
#version 130
// Incoming per vertex... position and normal
in vec4 vVertex;
in vec3 vNormal;
uniform mat4 mvpMatrix;
uniform mat4 mvMatrix;
uniform mat3 normalMatrix;
uniform vec3 vLightPosition;
// Color to fragment program
smooth out vec3 vVaryingNormal;
smooth out vec3 vVaryingLightDir;
out float dist;
out float constantAttenuation;
out float linearAttenuation;
out float quadraticAttenuation;
void main(void)
{
// Get surface normal in eye coordinates
vVaryingNormal = normalMatrix * vNormal;
// Get vertex position in eye coordinates
vec4 vPosition4 = mvMatrix * vVertex;
vec3 vPosition3 = vPosition4.xyz / vPosition4.w;
//get distance to light source
dist=length(vLightPosition-vPosition3);
//write proper attenuation values
if (dist<7.0){
constantAttenuation=1.0;
linearAttenuation=0.7;
quadraticAttenuation=1.8;
}
else if (dist<13.0){
constantAttenuation=1.0;
linearAttenuation=0.35;
quadraticAttenuation=0.44;
}
else if (dist<20.0){
constantAttenuation=1.0;
linearAttenuation=0.22;
quadraticAttenuation=0.20;
}
if (dist<32.0){
constantAttenuation=1.0;
linearAttenuation=0.14;
quadraticAttenuation=0.07;
}
if (dist<50.0){
constantAttenuation=1.0;
linearAttenuation=0.09;
quadraticAttenuation=0.32;
}
if (dist<65.0){
constantAttenuation=1.0;
linearAttenuation=0.07;
quadraticAttenuation=0.017;
}
if (dist<100.0){
constantAttenuation=1.0;
linearAttenuation=0.045;
quadraticAttenuation=0.0075;
}
// Get vector to light source
vVaryingLightDir = normalize(vLightPosition - vPosition3);
// Don't forget to transform the geometry!
gl_Position = mvpMatrix * vVertex;
}
```
Fragment program:
```
//point light per pixel fragment program
#version 130
out vec4 vFragColor;
uniform vec4 ambientColor;
uniform vec4 diffuseColor;
uniform vec4 specularColor;
smooth in vec3 vVaryingNormal;
smooth in vec3 vVaryingLightDir;
in float dist;
in float constantAttenuation;
in float linearAttenuation;
in float quadraticAttenuation;
void main(void){
float att;
att = 1.0 / constantAttenuation + linearAttenuation*dist +quadraticAttenuation*dist*dist;
// Dot product gives us diffuse intensity
float diff = max(0.0, dot(normalize(vVaryingNormal), normalize(vVaryingLightDir)));
// Multiply intensity by diffuse color, force alpha to 1.0
vFragColor = att*(diff * diffuseColor +ambientColor); // attenuation affects the diffuse component
// Specular Light
vec3 vReflection = normalize(reflect(-normalize(vVaryingLightDir), normalize(vVaryingNormal)));
float spec = max(0.0, dot(normalize(vVaryingNormal), vReflection));
if(diff != 0) {
float fSpec = pow(spec, 128.0);
vFragColor.rgb += (att*vec3 (fSpec, fSpec, fSpec)); // attenuation affects the specular component
}
}
```
|
Point light/spotlight attenuation in glsl 1.3+?
|
CC BY-SA 2.5
| null |
2011-04-03T01:46:34.960
|
2011-04-10T12:00:17.277
|
2011-04-03T02:10:20.710
| 45,963 | 45,963 |
[
"glsl"
] |
5,527,179 | 1 | 5,527,276 | null | 2 | 121 |
I have an app that downloads ZIP files from my server, and can download plugins from other servers. Before being able to open these files, I would like to present one of the classic '"Filename.html" is a (file type) downloaded from the internet. Are you sure you want to open it?" messages when first attempting to open the file, much like Google Chrome does when you save a HTML file and attempt to open it:

I've read that this is enabled by setting a special file attribute, but I'm not entirely sure what attribute it is, and how to set it on these files.
|
Enable "Filename was downloaded from the internet..." prompt in Cocoa
|
CC BY-SA 2.5
| 0 |
2011-04-03T02:26:00.733
|
2012-01-26T04:57:42.590
|
2012-01-26T04:57:42.590
| 30,461 | 219,515 |
[
"cocoa",
"security",
"alert",
"core-services",
"launch-services"
] |
5,527,279 | 1 | 5,527,442 | null | 0 | 640 |

Can someone tell me what element from the toolbox builds this kind of menu? And I guess I can "skin" it, right? I mean, the background image etc...
|
Menu bar in vb.net
|
CC BY-SA 2.5
| null |
2011-04-03T03:01:23.520
|
2011-04-03T03:48:51.647
| null | null | 555,690 |
[
"vb.net",
"winforms",
"visual-studio"
] |
5,527,408 | 1 | null | null | 3 | 4,640 |
I am not able to set the contentsize with size(650,400).But even i create popoverController with same width & height it is getting created.
No idea what is worry ?
On tapping Enter it shows as below

```
- (IBAction)setButtonTapped:(id)sender
{
popover *mpopover = [[popover alloc] init];
UINavigationController *NavController = [[UINavigationController alloc] initWithRootViewController:mpopover];
//NavController.navigationBar.backgroundColor = [UIColor darkGrayColor];
mPickerPopover = [[[UIPopoverController alloc] initWithContentViewController:NavController] retain];
CGSize popoversize = CGSizeMake(400, 90);
[mpopover setparent:mPickerPopover];
[mpopover setToolBarFrame:popoversize];
mPickerPopover.popoverContentSize = popoversize;
[mPickerPopover presentPopoverFromRect:CGRectMake([sender frame].origin.x, [sender frame].origin.y, 20, 20) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[mpopover release];
}
```

```
-(void)buttonView:(id)sender
{
CGSize popoversize = CGSizeMake(650, 320);
[parent setPopoverContentSize:popoversize animated:YES];
[toolbar setFrame:CGRectMake(0, popoversize.height- 90, popoversize.width, 60)];
CATransition *transition = [CATransition animation];
transition.type = kCATransitionPush;
transition.duration = 1.0f;
transition.timingFunction = UIViewAnimationCurveEaseInOut;
[self.view.layer addAnimation:transition forKey:@"transitionViewAnimation"];
}
```
|
problem in setting PopoverContentSize
|
CC BY-SA 3.0
| 0 |
2011-04-03T03:36:58.833
|
2013-01-23T12:10:08.510
|
2011-04-27T13:34:43.017
| 249,916 | 687,331 |
[
"ipad",
"uipopovercontroller"
] |
5,527,522 | 1 | 5,528,465 | null | 2 | 3,249 |
I have 4 tables:

but when I create an entity framework model, why is `tblRoleInProfile` not generated?

I have a Linq TO SQL model that want to convert it to EF and now my table is not generated. How can I solve that?
You consider we have some profiles and some roles. If we want Profile A has role 1 Insert a record in `tblRoleInProperty` and if we want Profile B has not Role 2 (If it exists) delete it's record from `tblRoleInProperty`. I don't want delete a profile. another problem is select new projection. Can any body guide me to write this query in EF:
```
var prs = from p in dc.tblProfiles
join rp in dc.tblRoleInProfiles
on p.ProfileId equals rp.ProfileId
join r in dc.tblRoles
on rp.RoleId equals r.RoleId
select new
{
ProfileName = p.ProfileName,
ProfileId = p.ProfileId,
RoleName = r.RoleName,
RoleId = r.RoleId
};
```
Thanks
|
Entity Framework Does not Import Table with Super Key
|
CC BY-SA 3.0
| 0 |
2011-04-03T04:13:43.170
|
2017-03-09T15:31:54.740
|
2014-03-17T17:57:22.613
| 3,215,948 | 648,723 |
[
"c#",
"entity-framework",
"entity-framework-4",
"linq-to-entities",
"many-to-many"
] |
5,527,544 | 1 | 5,527,620 | null | 1 | 530 |
Ignoring internet explorer 6 and latter, how do I script the css to achieve the following results:


It would hide the information until UpgradeI, UpgradeII or UpgradeIII is hovered. Site link is [Here](http://bfcards.edicypages.com/list-of-cards/abyssal-warder-fire)
There is around 500 pages like that, so tweaking or adding javascript in the html is not feasible. I think CSS is the way to go to do this, but I've tried:
```
div.UpgradeI {display:none;}
div.UpgradeI:hover {display:inline;}
```
but it just hides everything and doesn't show the information when hovered. Anyway, if its not possible to achieve the same result using css only, please show me what code to add. Thanks!
|
How to script CSS to achieve hide/appear effect based on hover
|
CC BY-SA 2.5
| null |
2011-04-03T04:21:31.500
|
2011-04-03T05:15:18.173
|
2011-04-03T04:30:55.780
| 106,224 | 615,106 |
[
"html",
"css"
] |
5,527,567 | 1 | 5,529,244 | null | 0 | 497 |
I am trying to test php-activerecord, it has some tests. When run:
phpunit sometestname
nothing happened. I checked the code,
```
include 'helpers/config.php';
require_once dirname(__FILE__) . '/../lib/Inflector.php';
class InflectorTest extends SnakeCase_PHPUnit_Framework_TestCase
{
public function set_up()
{
$this->inflector = ActiveRecord\Inflector::instance();
}
public function testOne()
{
$this->assertTrue(2+2==4);
}
```
Any idea?

|
run phpunit of php-activerecord failed
|
CC BY-SA 2.5
| null |
2011-04-03T04:28:48.080
|
2012-03-14T14:08:23.623
|
2012-03-14T14:08:23.623
| 546,999 | 361,248 |
[
"php",
"phpunit",
"phpactiverecord"
] |
5,527,573 | 1 | null | null | 1 | 4,821 |
I would like to learn how to use SQL Server. My school offers the software as part of its enrollment package so I decided to download it and try installing it. Unfortunately, I get stuck at the following installation screen:

No matter what name and password I enter for any of the fields, it comes back telling me that these are invalid. Where and how do I get valid login credentials? Am I supposed to register somewhere somehow?
Any help appreciated! Thank you!
|
How do you get SQL Server 2008 Server Agent login credentials?
|
CC BY-SA 2.5
| null |
2011-04-03T04:30:11.780
|
2011-04-03T08:12:41.343
|
2011-04-03T08:12:41.343
| 13,302 | 689,520 |
[
"sql-server",
"installation"
] |
5,527,648 | 1 | 5,528,037 | null | 1 | 547 |
I want to have a setting in an iphone app that uses a toggle switch to allow something to be turned on or off. I have seen tutorials, but they only show how to do this in the iPhone's settings place. I want this done inside the application. Any guides, help advice. I'm going for something similar to the picture below.

|
iPhone and Application Settings
|
CC BY-SA 2.5
| null |
2011-04-03T04:49:41.517
|
2011-04-03T06:49:33.600
| null | null | 597,775 |
[
"iphone",
"objective-c",
"ios4",
"iphone-sdk-3.0"
] |
5,527,723 | 1 | 5,527,751 | null | 0 | 734 |
I am trying get my first simple project in rails to run. I have installed wamp. And trying to make use of that same mysql db server installed with wamp. But I decided to make use of webrick, and not apache. Hoping that the configuration would be easier.
I edited the database.yml file and the gemfile under my projects directory:
```
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql
encoding: utf8
reconnect: false
database: rubybeg_test
pool: 5
username: root
password: 1234
host: localhost
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
encoding: utf8
reconnect: false
database: rubybeg_test
pool: 5
username: root
password: 1234
host: localhost
production:
adapter: mysql
encoding: utf8
reconnect: false
database: rubybeg_test
pool: 5
username: root
password: 1234
host: localhost
```
And here's gemfile:
```
source 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
```
I used the command gem install mysql because mysql2 doesn't work for me.

What I did was to launch wampserver and stopped the apache service. It would take forever to load:
[http://localhost:3000/rails/info/properties](http://localhost:3000/rails/info/properties)
Then webrick would crash. But if I do not launch wamp, I get this:

|
Cannot access mysql on ruby on rails
|
CC BY-SA 2.5
| null |
2011-04-03T05:09:35.167
|
2011-04-03T05:17:01.823
| null | null | 225,269 |
[
"mysql",
"ruby-on-rails"
] |
5,527,792 | 1 | 5,530,045 | null | 5 | 6,442 |
On a "normal" size screen hdpi device, I understand that 72 x 72 pixels graphics should be used, and they should otherwise follow [the Icon Design Guidelines](http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html) (which some of the platform graphics interestingly do not do). When I try to do this by creating my own new graphics or by copying a graphics file from the Android SDK, however, the graphic in the menu is too big, and it forces the text label, i.e., the title, that should be below it to not appear. If I "force" the use of a 48 x 48 pixels graphic, then the size looks good and the text label has room to appear, but this doesn't seem like the right solution, since the graphic display quality is diminished, and the documentation clearly says a 72 x 72 graphic should be used.
I understand the 9-patch graphics should be used to help ensure proper-looking scaling, but none of the menu icon graphics in the platform drawable folders appear to actually be 9-patch, as they don't have any 9-patch markers. For these screenshots, I did add 9-patch markers to a copy of the Android SDK platform 10 72 x 72 hdpi ic_menu_share.png graphic. (The draw9patch.bat tool unexpectedly changed the colors of the graphic.)
In the following four screenshots, I'm showing nine menu icon displays, running on my G2, and running on an emulator with G2-like qualities: Android 2.2 API 8 WVGA800 240dpi. (Both of these devices have "normal" sized hdpi screens.) Since the menu icon graphics will only show six at a time, there are two screenshots for each device: v1 and v2. Following the screenshots are the code components used to generate this application, along with a link to the complete project with all of the graphics files I used.

(Note: In the above screenshot of the emulator, the icon labeled "G2 Platform" should probably instead be labeled "Running Platform", since the displayed graphic is from the currently running Android platform - not from the G2 platform. I was just too lazy to correct this.)



(Please note I carefully followed [the Icon Design Guidelines](http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html) when creating and copying these graphics.)
:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="fubar.guiexamples"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name">
<activity
android:name=".MenuIconConfusion"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
```
```
public class MenuIconConfusion extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_options_menu, menu);
return true;
}
}
```
```
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/g2_platform_with_title"
android:icon="@android:drawable/ic_menu_share"
android:title="G2 Platform" />
<item
android:id="@+id/g2_platform_no_title"
android:icon="@android:drawable/ic_menu_share" />
<item
android:id="@+id/platform_10_auto_selection_with_title"
android:icon="@drawable/ic_menu_share"
android:title="Platform 10 Auto" />
<item
android:id="@+id/platform_10_auto_selection_no_title"
android:icon="@drawable/ic_menu_share" />
<item
android:id="@+id/pixels_auto_selection"
android:icon="@drawable/ic_menu_pixels"
android:title="Pixels" />
</menu>
```
```
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/platform_10_hdpi_72_with_title"
android:icon="@drawable/ic_menu_share_p10_hdpi_72"
android:title="Platform 10 72 Copy" />
<item
android:id="@+id/platform_10_hdpi_72_no_title"
android:icon="@drawable/ic_menu_share_p10_hdpi_72" />
<item
android:id="@+id/platform_10_mdpi_48_with_title"
android:icon="@drawable/ic_menu_share_p10_mdpi_48"
android:title="Platform 10 48 Copy" />
<item
android:id="@+id/platform_10_hdpi_72_9_patch_with_title"
android:icon="@drawable/ic_menu_share_p10_hdpi_72_nine_patch"
android:title="Platform 10 72 9p Copy" />
<item
android:id="@+id/platform_10_hdpi_72_9_patch_no_title"
android:icon="@drawable/ic_menu_share_p10_hdpi_72_nine_patch" />
<item
android:id="@+id/pixels_auto_selection"
android:icon="@drawable/ic_menu_pixels"
android:title="Pixels" />
</menu>
```
As I did for this demo, I understand that we're not supposed to use graphics from android:drawable, for the reasons described in [the menu icon design guidelines](http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html).
For some of the icons, I dislayed them each twice - once each with a title, and once each without a title - to see whether having a title influenced which graphic was selected and whether the selected graphic was scaled.
The icon labeled "Platform 10 48 Copy" is a 48 x 48 pixel graphic, copied from the Android SDK platform 10 drawable-mdpi folder.
The two lighter colored icons are from the nine patch image. Note they exhibit no scaling characteristics.
The "72" icon was included to show that drawable-hdpi resources are indeed being auto-selected by the running platform, as expected. Were the drawable-hdmi resources instead used, then the displayed number would be "48".
In a nutshell, I didn't expect much of the results displayed in these screenshots. While I did expect the drawable-hdpi 72 x 72 graphics to be used, I also expected them to display with enough room for the associated titles. So...
I might be asking, "How do I get the menu icon graphics to scale, in order to leave room to dislay the associated title?"
I might be asking, "What size graphics are we supposed to use for menu icons, nevermind what [the official documentation](http://developer.android.com/guide/practices/ui_guidelines/icon_design_menu.html) says?"
I might be asking, "What the hell is going on here? What don't I understand?"
The Android project files with the graphics I used can be downloaded from [https://sites.google.com/site/androidguiexamples/home/downloads/MenuIconConfusion.zip](https://sites.google.com/site/androidguiexamples/home/downloads/MenuIconConfusion.zip)
|
Menu Icon Confusion - They're too big!
|
CC BY-SA 2.5
| 0 |
2011-04-03T05:32:35.550
|
2011-04-03T14:08:03.717
|
2011-04-03T05:42:10.877
| 519,818 | 519,818 |
[
"android",
"graphics",
"icons"
] |
5,527,837 | 1 | 5,527,871 | null | 0 | 199 |
I am trying to write a simple desktop application for managing accounts. I am in the beginning phase.
I am running it in my old computer and I sometimes get strange behavior.
Java Version
> java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
My computer configuration
> Microsoft Windows XP SP2
Intel(R) Celeron(R) CPU 2.53GHz 1.96GHz 736MB of RAM
I get behaviour. When I compile my program and the jframe loads, i sometimes get menu and sometimes I don't get menu as shown in the figure. Also when I try to resize my jframe, jframe shows menu.
My code
```
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.AWTException;
public class Main {
public static void main(String[] args) {
new Login();
}
}
class Login extends JFrame{
private int height=450;
private int width=300;
private Container container;
private GridBagLayout layout;
private GridBagConstraints constraints;
JTextArea textArea1, textArea2;
public Login()
{
initWindow();
initMenu();
}
private void initWindow()
{
setVisible(true);
setSize(this.height, this.width);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Toolkit toolkit = Toolkit.getDefaultToolkit ();
Dimension dim = toolkit.getScreenSize();
setLocation((dim.width-this.width)/2, (dim.height-this.height)/2);
Image image = toolkit.createImage("account.gif");
setIconImage(image);
}
private void initMenu()
{
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu fileMenu = new JMenu("File");
JMenu helpMenu = new JMenu("Help");
menuBar.add(fileMenu);
menuBar.add(helpMenu);
JMenuItem configureAction = new JMenuItem("Configure");
JMenuItem exitAction = new JMenuItem("Exit");
fileMenu.add(configureAction);
fileMenu.add(exitAction);
JMenuItem helpAction = new JMenuItem("Help");
JMenuItem aboutAction = new JMenuItem("About");
helpMenu.add(helpAction);
helpMenu.add(aboutAction);
}
}
```
Window with no menu

Window with menu

Any suggestion to improve code with be highly appreciated.
Thank you
|
strange java window behaviour
|
CC BY-SA 2.5
| null |
2011-04-03T05:49:29.780
|
2011-04-03T06:36:25.140
| null | null | 447,023 |
[
"java",
"jframe"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.