Hi all
I am invoking camera from my application. i want to remove few menu items that is provided by the camera application. how to do that.
Thanks alot
I have a list of items sorted alphabetically:
list = [a,b,c,d,e,f,g,h,i,j]
I'm able to output the list in an html table horizonally like so:
| a , b , c , d |
| e , f , g , h |
| i , j , , |
What's the algorithm to create the table vertically like this:
| a , d , g , j |
| b , e , h , |
| c , f , i , |
I'm using python, but your answer can be in any language or even pseudocode.
Thanks
Hi,
Can any body provide me sample code or sample applications to retrieve list of items and list of objects from web service and to parse it.
Thanks in advance
Regards,
Malleswar
hi,
I'm using a Repeater object in Flex. Would be possible to stop the repeater after 50 iterations.. even if my dataProvider is bigger ?
I want to display only the first 50 items. I'm using MXML to implement the repeater.
thanks
Is there a simple way to invert a WPF GridView so that items are bound to columns instead of rows? Or would it be necessary to write a custom view mode?
I am trying to use checkboxes to select the items in a Listview. I have added a checkbox control in the , and they are displayed properly.
The problem is that Checked property never changes when I click on them. Why does this happen? And is there a workaround?
In CSharp its as simple as writting :
listBox1.Items.Add("Hello");
listBox1.Items.Add("There");
foreach (string item in listBox1.Items )
{
MessageBox.Show(item.ToString());
}
and i can easily add different objects to a list box and then retrieve them using foreach.
I tried the same approach in Qt 4.8.2 but it seems they are different.though they look very similar at first.I found that Qt supports foreach so i went on and tried
something like :
foreach(QListWidgetItem& item,ui->listWidget->items())
{
item.setTextColor(QColor::blue());
}
which failed clearly.It says the items() needs a parameter which confuses me.I am trying to iterate through the ListBox itself, so what does this mean?
I tried passing the ListBox object as the parameter itself this again failed too:
foreach(QListWidgetItem& item,ui->listWidget->items(ui->listWidget))
{
item.setTextColor(QColor::blue());
}
So here are my questions:
How can I iterate through a QListWidget items in Qt?
Can i store objects as items in QListWidgets like C#?
How can i convert an object in QListWidgets to string(C#s ToString counter part in Qt) ?
(suppose i want to use a QMessagBox instead of that setTextColor and want to print out all string items in the QlistWidget.)
So I have a custom ListView object. The list items have two textviews stacked on top of each other, plus a horizontal progress bar that I want to remain hidden until I actually do something. To the far right is a checkbox that I only want to display when the user needs to download updates to their database(s). When I disable the checkbox by setting the visibility to Visibility.GONE, I am able to click on the list items. When the checkbox is visible, I am unable to click on anything in the list except the checkboxes. I've done some searching but haven't found anything relevant to my current situation. I found this question but I'm using an overridden ArrayAdapter since I'm using ArrayLists to contain the list of databases internally. Do I just need to get the LinearLayout view and add an onClickListener like Tom did? I'm not sure.
Here's the listview row layout 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="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent">
<TextView
android:id="@+id/UpdateNameText"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:textSize="18sp"
android:gravity="center_vertical"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:id="@+id/UpdateStatusText"
android:singleLine="true"
android:ellipsize="marquee"
/>
<ProgressBar android:id="@+id/UpdateProgress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminateOnly="false"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:minHeight="10dip"
android:maxHeight="10dip"
/>
</LinearLayout>
<CheckBox android:text=""
android:id="@+id/UpdateCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
And here's the class that extends the ListActivity. Obviously it's still in development so forgive the things that are missing or might be left laying around:
import java.util.List;
import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.xxxx.android.R;
import com.xxxx.android.DAO.AccountManager;
import com.xxxx.android.model.UpdateItem;
public class UpdateActivity extends ListActivity {
AccountManager lookupDb;
boolean allSelected;
UpdateListAdapter list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lookupDb = new AccountManager(this);
lookupDb.loadUpdates();
setContentView(R.layout.update);
allSelected = false;
list = new UpdateListAdapter(this, R.layout.update_row, lookupDb.getUpdateItems());
setListAdapter(list);
I've see this question asked a couple of other times, and I followed this after I tried things on my own with the MS music store demo to no avail, but I still can't get this to work. I've also noticed when I look at my MultiSelectList object in the viewmodel, it has the correct items in the selected items property, but if I expand the results view, it doesn't have any listboxitem with the selected value. What am I missing here? I feel like I'm taking crazy pills! Thanks in advance.
model:
public class Article
{
public int ArticleID { get; set; }
public DateTime? DatePurchased { get; set; }
public DateTime? LastWorn { get; set; }
public string ThumbnailImg { get; set; }
public string LargeImg { get; set; }
public virtual List<Outfit> Outfits { get; set; }
public virtual List<Tag> Tags { get; set; }
}
viewmodel:
public class ArticleViewModel
{
public int ArticleID { get; set; }
public List<Tag> Tags { get; set; }
public MultiSelectList mslTags { get; set; }
public virtual Article Article { get; set; }
public ArticleViewModel(int ArticleID)
{
using (ctContext db = new ctContext())
{
this.Article = db.Articles.Find(ArticleID);
this.Tags = db.Tags.ToList();
this.mslTags = new MultiSelectList(this.Tags, "TagID", "Name", this.Article.Tags);
}
}
}
controller:
public ActionResult Index()
{
ArticleIndexViewModel vm = new ArticleIndexViewModel(db);
return View(vm);
}
view:
@model ClosetTracker.ArticleViewModel
@using (Html.BeginForm())
{
<img id="bigImg" src="@Model.Article.ThumbnailImg" alt="img" />
@Html.HiddenFor(m => m.ArticleID);
@Html.LabelFor(m => m.Article.Tags)
@* @Html.ListBoxFor(m => m.Article.Tags, Model.Tags.Select(t => new SelectListItem { Text = t.Name, Value = t.TagID.ToString() }), new { Multiple = "multiple" })
*@
@Html.ListBoxFor(m => m.Article.Tags, Model.mslTags);
@Html.LabelFor(m => m.Article.LastWorn)
@Html.TextBoxFor(m => m.Article.LastWorn, new { @class = "datepicker" })
@Html.LabelFor(m => m.Article.DatePurchased)
@Html.TextBoxFor(m => m.Article.DatePurchased, new { @class = "datepicker" })
<p>
<input type="submit" value="Save" />
</p>
}
EDITED
Ok, I changed around the constructor of the MultiSelectList to have a list of TagID in the selected value arg instead of a list of Tag objects. This shows the correct tags as selected in the results view when I watch the mslTags object in debug mode. However, it still isn't rendering correctly to the page.
public class ArticleViewModel
{
public int ArticleID { get; set; }
public List<Tag> Tags { get; set; }
public MultiSelectList mslTags { get; set; }
public virtual Article Article { get; set; }
public ArticleViewModel(int ArticleID)
{
using (ctContext db = new ctContext())
{
this.Article = db.Articles.Find(ArticleID);
this.Tags = db.Tags.ToList();
this.mslTags = new MultiSelectList(this.Tags, "TagID", "Name", this.Article.Tags.Select(t => t.TagID).ToList());
}
}
}
Hi everyone,
I have some problems with sizing row's height in QTreeWidget. I use QStyledItemDelegate with QPlainTextEdit. During editing text in QPlainTextEdit i check for changes with a help of:
rect = self.blockBoundingRect(self.firstVisibleBlock())
and if text it's height changes i need row in QTreeWidget also resizing. But i don't know how to inform TreeWidget or a Delegate about changes, i even tried to initialize editor with index, that i could use in a future, but it suddenly changes:
class MyEditor(QPlainTextEdit):
def __init__(self, index = None, parent=None):
super(MyEditor, self).__init__(parent)
self.index = index
self.connect(self, SIGNAL("textChanged()"), self.setHeight)
def setHeight(self):
if self.index:
rect = self.blockBoundingRect(self.firstVisibleBlock())
self.resize(rect.width(), rect.height())
self.emit(SIGNAL("set_height"), QSize(rect.width(), rect.height()), self.index)
How can i bound editor's size changes with TreeWidget?
And one more thing, by default all items (cells) in TreeWidget have -1 or some big value as default width. I need whole text in cell to be visible, so how can i limit it only by visible range and expand it in height?
Thank you in advance,
Serge
I have a schedule table I'm using jQuiry Sortable for editing.
Each day is a UL, and each event is an LI.
My jQuery is:
$("#colSun, #colMon, #colTue, #colWed, #colThu").sortable({
connectWith: '.timePieces',
items: 'li:not(.lith)'
}).disableSelection();
To make all LI's sortable except those with class "lith" (day names).
User can drag an event from day to day, or add new events by clicking a button, which appends a new dragable event (LI) to the fist UL (Sunday).
I want to make each day accept only up to 10 events.
How do I do this?
Thanks in advance!
I have been trying to use nanoc for generating a static website. I need to organize a complex arrangement pages I want to keep my content DRY.
How does the concept of includes or merges work within the nanoc system? I have read the docs but I can't seem to find what I want.
For example: how can I take two partial content items and merge them together into a new content item.
In staticmatic you can do some like the following inside your page.
= partial('partials/shared/navigation')
How would a similar convention work within nanoc?
I have a ListView that is sandwiched between two buttons. The entire screen is in a ScrollView
<Button
android:text="Take a Picture"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/btnPicture"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:textSize="25dp"/>
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/lstPhotos"
android:visibility="gone" />
<Button
android:text="Location Type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/btnLocationType"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:textSize="25dp" />
As I add items to the listview in code, how can I get the listview to take up enough space to be visible. It does expand to show 1 item but after I add the second item it doesn't expand any more.
You can see here after I added a second picture row to the listview, it's not visible.
I'm developing a site that requires some duplication of links within the menu:
Section A
-- Introduction
-- Testimonials
Section B
-- Introduction
-- Testimonials
Testimonials
-- Section A
-- Section B
So 'Section A Testimonials' and 'Testimonials Section A' point to the same node. But regardless of which menu link people use, I want the person to be in Section A.
The problem is that D6 doesn't like duplicate menu items, and it assigns the active and active-trail classes rather unpredictably.
So my thought was to create a placeholder node for each item in the Testimonials menu, and then set the URL to something like "testimonials/redirect/section-a", and then use mod_rewrite to redirect over to "section-a/testimonials".
With this solution, I will have no duplicate paths in the menu. I'm just hoping this doesn't somehow hurt my SEO.
Does anyone know a better solution?
Hello, I have a problem with sorting items in table in PHP. Here is what I want to achieve :
Item Item Item
Item Item Item
Item Item Item
Item Item Item
Item Item Item
How I mean to achieve this, well since I have a for each loop I can insert counter, and say after 5th item is listed write to another column, the thing is I'm not good with tables, I've tried something like :
for(...)
$counter++;
if(($counter%5) == 0){
echo "";
}
Not happening .. I hope you understood what I meant .. tnx
I have defined a collection in Hibernate like this:
...
public class Item {
...
@ElementCollection
List<Object> relatedObjects;
}
It creates a mapping table with colums item_id and object_id.
The problem is that object_id seems to be unique. In other words I can not have two different items being related to the same object. But that is what I want.
I would like the combination of item_id and object_id to be unique. How do I do that?
In my Cocoa program, I want to examine what programs are registered to run at startup and modify that list as I feel appropriate. In order to be compatible with Tiger it seems like I need to work through AppleScript. I currently have the following code:
NSDictionary* errorDict;
NSAppleEventDescriptor* returnDescriptor = NULL;
NSString *appleSource = @"tell application \"System Events\"\n\
get every login item\n\
end tell";
NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource: appleSource];
returnDescriptor = [appleScript executeAndReturnError: &errorDict];
If I run that command in AppleScript, I get back an array of login items. However, I can't figure out how to iterate through this array in Objective-C. More specifically, I want to examine the names and paths of the programs registered to run at startup.
Any ideas?
Getting multiple data items in an element with linq to xml
I have an xml file like this
<TopLevel>
<Inside>
Jibba
</Inside>
<Inside>
Jabba
</Inside>
</TopLevel>
I was given said xml and and want to get all the elements. Here is the code I have.
var q = from c in loaded.Descendants("TopLevel")
select (XElement)c.Element("Inside");
I tried c.Elements but that did not work. What do I need to do to get all of the internal elements? This code just gets the first "Inside" tag.
First of all I'm new to cocoa development so I suppose I'm probably trying to do this the wrong way, but here goes: I have a NSOutlineView which loads the data from a NSOutlineViewDataSource imnplementation. I want all the items to be expanded after they are loaded, but i can't seem to find an event fired when the data has finished loading, so I can send a [outlineView expandItem:nil expandChildren: YES] to it. I looked into the NSOutlineViewDelegate protocol but I was unable to find a sutable place for this call. What would be the best approach for this problem ?
Hi
I am getting a list of image URLs and corresponding names at run time in my app. I would like to add these images to a TTLauncherView object that I have.
Cannot add these in loadView. I am making a call to the method for getting my data in a separate thread. Once the thread completes, I add the TTLauncherItem objects to an array and set the "pages" variable of the LauncherView.
But for some reason, the view is not updated and I don't see anything on it.
Can someone please let me know how to refresh the launcherview after adding items to it in methods other than loadView?
Thanks.
I'm working with a custom DropDownList control in ASP.Net and there's been a request to display certain items in the list with a bold typeface (NOTE - the control inherits from CompositeDataBoundControl so it can be data bound... not DropDownListBox). The control is bound to a table and there's a column in the table named IsUsed - if this is set to true, the corresponding item in the list should be rendered bold. (It should be noted here that this will only ever be viewed in FireFox.)
My experience is all in the middle \ backend tiers so the presentation layer is very new to me - can someone point me in the right direction? My initial thought was that somewhere in the custom control I would have access to all the rows that are returned from the data source which I could cycle through etc but I'm not sure if that's possible... There's also RenderContents which I can override... looks interesting!
Any help appreciated - cheers.
James
I have an IEnumerable, listOfOnes, and an IEnumerable, listOfTwos.
Assuming that I can compare objects of V against objects of T, I'd like to find which items are in listOfOnes but, not in listOfTwos. And vice versa.
ex:
var listOfOnes = new List<One>
{
new One
{
name = "chris",
type = "user"
},
new One
{
name = "foo",
type = "group"
},
new One
{
name = "john",
type = "user"
},
};
var listOfTwos = new[]
{
new Two
{
name = "chris",
type = "user"
},
new Two
{
name = "john",
type = "user"
},
new Two
{
name = "the Steves",
type = "group"
}
};
var notInTwos; //= listOfOnes.FindDifferences(listOfTwos);
//find all objects not in listOfTwos. Should find 'foo'.
var notInOnes; //= listOfTwos.FindDifferences(listOfOnes)
//find all objects not in listOfOnes. Should find 'the Steves'.
My Flash designer is reading an XML stream I'm sending back to the browser (I'm a C# dev). We have this working fine.
He is then selecting into an XMLList where a element has its id a certain value i.e. . This is also working just fine.
In this XmlList, are Events, that look a little something like this:
event
startdate
enddate
end event
I don't know how to use the formatting here - but each of those items is an element. startdate would have a value such as 04/02/2010 and enddate 6/30/2010.
Now, from this XmlList I do have of Events, I need to select all Events where a new variable myDate, falls in between the startdate and enddate.
I'm not sure how to do this in AS3 - can anyone help me?
Thank you very much in advance!
I am trying to implement a new class inherited from List<string>, to load the contents from a text file to the items.
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class ListExt: List<string>
{
string baseDirectory;
public LoadFromFile(string FileName)
{
this._items = File.ReadAllLines(FileName).ToList();//does not work because _list is private
}
}
but i dont knew how to load the lines into the _items property because is private.
any suggestions?