Daily Archives

Articles indexed Wednesday June 9 2010

Page 11/126 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • WPF data-bound ComboBox only shows first item of ItemsSource list

    - by Mark
    Hi all, I'm sure I'm doing something stupid but for the life of me I can't think of right now. I have a ComboBox that is data-bound to a list of Layout objects. The list is initially empty but things are added over time. When the list is updated by the model the first time, this update reflects properly in the ComboBox. However, subsequent updates never show up in the ComboBox even though I can see that the list itself contains these items. Since the first update works, I know the data-binding is OK - so what am I doing wrong here? Here's the XAML (abridged): <Grid HorizontalAlignment="Stretch"> <ComboBox ItemsSource="{Binding Path=SavedLayouts, diagnostics:PresentationTraceSources.TraceLevel=High}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedItem="{Binding LoadLayout}" Height="25" Grid.Row="1" Grid.Column="0"></ComboBox> </Grid> And the related part of the model: public IList<Layout> SavedLayouts { get { return _layouts; } } public Layout SaveLayout( String data_ ) { Layout theLayout = new Layout( SaveLayoutName ); _layouts.Add( theLayout ); try { return theLayout; } finally { PropertyChangedEventHandler handler = PropertyChanged; if( handler != null ) { handler( this, new PropertyChangedEventArgs( "SavedLayouts" ) ); } } } And finally, the layout class (abridged): public class Layout { public String Name { get; private set; } } In the output window, I can see the update occurring: System.Windows.Data Warning: 91 : BindingExpression (hash=64564967): Got PropertyChanged event from TickerzModel (hash=43624632) System.Windows.Data Warning: 97 : BindingExpression (hash=64564967): GetValue at level 0 from TickerzModel (hash=43624632) using RuntimePropertyInfo(SavedLayouts): List`1 (hash=16951421 Count=11) System.Windows.Data Warning: 76 : BindingExpression (hash=64564967): TransferValue - got raw value List`1 (hash=16951421 Count=11) System.Windows.Data Warning: 85 : BindingExpression (hash=64564967): TransferValue - using final value List`1 (hash=16951421 Count=11) But I get do not get this 11th item in the ComboBox. Any ideas?

    Read the article

  • Fuzzy Date algorithm in Objective-C

    - by Brock Woolf
    I would like to write a fuzzy date method for calculating dates in Objective-C for iPhone. There is a popular explanation here: http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time However it contains missing arguments. How could this be used in Objective-C?. Thanks. const int SECOND = 1; const int MINUTE = 60 * SECOND; const int HOUR = 60 * MINUTE; const int DAY = 24 * HOUR; const int MONTH = 30 * DAY; if (delta < 1 * MINUTE) { return ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; } if (delta < 2 * MINUTE) { return "a minute ago"; } if (delta < 45 * MINUTE) { return ts.Minutes + " minutes ago"; } if (delta < 90 * MINUTE) { return "an hour ago"; } if (delta < 24 * HOUR) { return ts.Hours + " hours ago"; } if (delta < 48 * HOUR) { return "yesterday"; } if (delta < 30 * DAY) { return ts.Days + " days ago"; } if (delta < 12 * MONTH) { int months = Convert.ToInt32(Math.Floor((double)ts.Days / 30)); return months <= 1 ? "one month ago" : months + " months ago"; } else { int years = Convert.ToInt32(Math.Floor((double)ts.Days / 365)); return years <= 1 ? "one year ago" : years + " years ago"; }

    Read the article

  • echo/print specific element

    - by gin
    hi everyone,, i tried this example on ajax here and i wonder if i can echo/print a specific element of the array at the php side let's say i just want to print the second element which is "lastName" i tried echo $t2lpostData[1] it gives me error "Undefined offset: 1 in C:\wamp\www\thank-you.php on line 12" help plz,,

    Read the article

  • Error connecting to SQL Server 2008 with Django

    - by qq263020776
    I am using django-mssql and SQL Server 2008, but I found that it always errors when I do some commands,for example: python manage.py syncdb the error is below: raise OperationalError(e, "Error opening connection: " + connection_string) ngo.db.backends.sqlserver_ado.dbapi.OperationalError: (com_error(-2147352567, xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3', (0, u'Microsoft OLE DB Provider for L Server', u'[DBNETLIB][ConnectionOpen (Connect()).]SQL Server \u4e0d \u5b58\u 8\u6216\u62d2\u7edd\u8bbf\u95ee\u3002', None, 0, -2147467259), None), 'Error ning connection: PROVIDER=SQLOLEDB;DATA SOURCE=115.238.106.100,60433;Network rary=DBMSSOCN;Initial Catalog=rvdb_1;UID=sa;PWD=xxxx') When I use Microsoft SQL Server Management studio client, I can successfully connect the database. I got some infomation from: http://code.google.com/p/django-mssql/issues/detail?id=76 but I still tried I got wrong and I think the solution provided is wrong.

    Read the article

  • Changing the HTML of CKEditor form elements (in the dialog window)

    - by Kenny Meyers
    I'm trying to modify the HTML of the dialog boxes in CKEditor. The HTML inside each of those boxes is an absolute nightmare, and even worse, the source code is compressed and it's unclear what the path of execution is. I want to take something like this: <div class="cke_dialog_ui_select" id="44_uiElement" role="presentation"><label style="" for="42_select" id="43_label" class="cke_dialog_ui_labeled_label">Link Type</label><div role="presentation" class="cke_dialog_ui_labeled_content"><select aria-labelledby="43_label" class="cke_dialog_ui_input_select" id="42_select"><option value="url"> URL</option><option value="anchor"> Link to anchor in the text</option><option value="email"> E-mail</option></select></div></div> and turn it into something more legible and easier to style, removing one of the divs. These are for the Image and Anchor dialog boxes (Modal dialogues) respectively. Thanks for your help.

    Read the article

  • Need to map classes to different databases at runtime in Hibernate

    - by serg555
    I have MainDB database and unknown number (at compile time) of UserDB_1, ..., UserDB_N databases. MainDB contains names of those UserDB databases in some table (new UserDB can be created at runtime). All UserDB have exactly the same table names and fields. How to handle such situation in Hibernate? (database structure cannot be changed). Currently I am planning to create generic User classes not mapped to anything and just use native SQL for all queries: session.createSQLQuery("select * from " + db + ".user where id=1") .setResultTransformer(Transformers.aliasToBean(User.class)); Is there anything better I can do? Ideally I would want to have mappings for UserDB tables and relations and use HQL on required database.

    Read the article

  • In Django, using __init__() method of non-abstract parent model to record class name of child model

    - by k-g-f
    In my Django project, I have a non-abstract parent model defined as follows: class Parent(models.Model): classType = models.CharField(editable=False,max_length=50) and, say, two children models defined as follows: class ChildA(Parent): parent = models.OneToOneField(Parent,parent_link=True) class ChildB(Parent): parent = models.OneToOneField(Parent,parent_link=True) Each time I create an instance of ChildA or of ChildB, I'd like the classType attribute to be set to the strings "ChildA" or "ChildB" respectively. What I have done is added an _ _ init_ _() method to Parent as follows: class Parent(models.Model): classType = models.CharField(editable=False,max_length=50) def __init__(self,*args,**kwargs): super(Parent,self).__init__(*args,**kwargs) self.classType = self.__class__.__name__ Is there a better way to implement and achieve my desired result? One downside of this implementation is that when I have an instance of the Parent, say "parent", and I want to get the type of the child object linked with "parent", calling "parent.classType" gives me "Parent". In order to get the appropriate "ChildA" or "ChildB" value, I need to write a "_getClassType()" method to wrap a custom sql query.

    Read the article

  • Problem deleting folder and files from "Program Files" folder in Win 7

    - by Craig Johnston
    How do you delete folders and files from the "Program Files" folder in Win 7? I am trying to do this on someone else's computer and I don't know what rights their user account is. It says that I don't have permission to delete the folder. I thought it was an administrator account because when I do "Run as Administrator" for other things it doesn't ask for a password, so it must be an administrator account. Should I be able to delete a folder out of "Program Files" if the account has administrator rights? Or do I need to do something else, such as "Take Ownership" of the folder.

    Read the article

  • Works in Firefox & Opera, but not IE 8

    - by Ai Pragma
    1) This issue involves just one html webpage, lets call it "ajax.html".2) I have AJAX functions in this webpage that work in both Firefox and IE8.3) I now attempt generating just the option values of a dropdown list of dates using my ajax functions, and it works in Firefox & Opera, but not IE8.4) The surrounding html code for the dropdown looks like this:<select name="entry_7_single" id="entry_7" onChange="Ajax_PhpResultsWithVar('./secure/db/SummaryCls.php','entry_8','dateval',this.value)"></select>The onchange call refers to an ajax function that successfully(both Firefox & IE8) populates a textarea(entry_8) with a description of an event associated with the date selected in this dropdown. 5) An onload call initiates the ajax function to generate the dropdown list values:<body class="ss-base-body" onLoad="OnLoadWebPage()">6) The js script that calls the ajax function is as follows:function OnLoadWebPage(){    Ajax_PhpResults('./secure/db/GenDateListCls.php','entry_7');}7) Since it works in Firefox, but not IE8, I throw the output of the ajax function into a Firefox large textbox and I get the following:<option selected value="8 JUN 2010">8 JUN 2010</option>                   <option value="9 JUN 2010">9 JUN 2010</option>                   <option value="10 JUN 2010">10 JUN 2010</option>                   <option value="11 JUN 2010">11 JUN 2010</option> 8 ) There are over a hundred generated but you get the gist of what the ajax function generates. Next I will list the PHP function that outputs the above dropdown values://///////////////////////////////////////////////////////////////////////////////////////////////////////<?phpinclude_once 'SPSQLite.class.php';include_once 'misc_funcs.php';class GenDateListCls {    var $dbName;    var $sqlite;        function GenDateListCls()    {        $this->dbName = 'accrsc.db';        $this->ConstructEventDates();    }        function ConstructEventDates()    {         $this->sqlite = new SPSQLite($this->dbName);         $todayarr = getdate();         $today = $todayarr[mday] . " " . substr($todayarr[month],0,3) . " " . $todayarr[year];                  $ICalDate = ChangeToICalDate($today);         $dateQuery = "SELECT dtstart from events where substr(dtstart,1,8) >= '" . $ICalDate . "';";         $this->sqlite->query($dateQuery);         $datesResult = $this->sqlite->returnRows();                      foreach (array_reverse($datesResult) as $indx => $row)         {                       $normDate = NormalizeICalDate(substr($row[dtstart],0,8));              if ($indx==0)              { ?>                 <option selected value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option><?php                               }                          else              {?>                  <option value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option><?php                                   }                       }                   $this->sqlite->close();     }}$dateList = new GenDateListCls();    ?>/////////////////////////////////////////////////////////////////////////////////////////////////////////////<<< I appreciate any assistance on this matter. Aipragma >>> My Background: To let you all know, I am a complete newbie to PHP, Ajax, & javascript, and learning it all on my own, no classes. My background is in Linux, Windows, C++, Java, VB,VBA,MS XML, & some html.

    Read the article

  • PHP Switch and Login

    - by Steve Rivera
    I'm fairly new with PHP and I am messing around with a login/registration system. I setup my sample website using a PHP-SWITCH script I found a while back: <?php switch($_GET['id']) { default: include('home.php'); /* LOGIN PAGES */ break; case "register_form": include ('includes/user_system/register_form.php'); } ? On the registration page the form links to my "register.php" which checks the validity of the form and to check for any blank fields and so on. "register.php" is supposed to refresh the page and add a reason to what the user did wrong when submitting the form. On my "register_form.php" page, which holds the actual form. This field is hidden until the user makes a mistake. <?php if (isset($reg_error)) { ?> , please try again. My "register.php" checks the form for all the errors. Here's the bit of code that will refresh the page with the reason for the error: // Check if any of the fields are missing if (empty($_POST['username']) || empty($_POST['password']) || empty($_POST['confirmpass'])) { // Reshow the form with an error $reg_error = 'One or more fields missing'; include 'register_form.php'; Now after I submit the form without any fields filled out I get the error code, but it refreshes to the actual "register_form.php". The problem with this is that because of my PHP-SWITCH script (helps me manage the site a lot easier) I don't have any formatting on that page. The actual URL to my "register_form.php" would be: "index.php?id=register_form.php". Now I have tried several different things such as changing it to: include 'index.php?id=register_form.php' And also changing it to: header(location:index.php?id=register_form.php') Unfortunately all this does is refresh the page without the reason for the error. I know this can be easily solved by just adding a Javascript Validator but I'd like to know if it is possible to refresh the page with the error using either "include" or "header()" while having a PHP-SWITCH script on the website.

    Read the article

  • Converting c pointer types

    - by bobbyb
    I have a c pointer to a structre type called uchar4 which looks like { uchar x; uchar y; uchar z; uchar w; } I also have data passed in as uint8*. I'd like to create a uchar* pointing to the data at the uint8* so I've tried doing this: uint8 *data_in; uchar4 *temp = (uchar4*)data_in; However, the first 8 bytes always seem to be wrong. Is there another way of doing this?

    Read the article

  • How do I change careers to become a programmer with little money

    - by bgc83
    I'm currently a network engineer, but find myself wanting to get into the world of development. I took a little bit of Java in college, am 27 years old and have been network engineering for 4 years now. I have a mortgage and student loans so going back to school would be difficult. I'm willing to put in however much hardwork is needed around my full time job to learn, but part of me feels I may need actuall schooling to get down some of the advanced concepts. Just looking for a little advice and direction. I have purchased a bunch of the Head First programming books and have begun reading through some of them as I figure out my way into this transition.

    Read the article

  • How can I compile some parts of C++/CLI code as Native and some part as Managed?

    - by Usman
    Hello, I am calling LoadTypeLib for loading unmanaged type libraries in C++/CLI. I need to compile some code(some code areas) as managed and some code areas as unmanaged(native) code and form a mixed mode class library as executable. What i need to mention between the lines of code so that whatever the part i need to be compiled as managed should compiled as managed and what part I need to be unmanaged(native) should be compiled as native? Regards Usman

    Read the article

  • Would Python's Twisted library be the best case for an observer type pattern?

    - by beagleguy
    hi all, I'm developing a system where a queue will be filled with millions of items I need a process that reads items from the queue constantly and then sends those items out to registered clients. I'm thinking about using twisted for this, having the queue reader be a twisted server listening on a tcp port then clients can connect on that port and when an item is pulled from the queue the server writes it out to all the clients. Does that sound like something that twisted would be ideal for? Does anyone know of any sample code out there that may do something similar? thanks

    Read the article

  • Hibernate query for multiple items in a collection

    - by aarestad
    I have a data model that looks something like this: public class Item { private List<ItemAttribute> attributes; // other stuff } public class ItemAttribute { private String name; private String value; } (this obviously simplifies away a lot of the extraneous stuff) What I want to do is create a query to ask for all Items with one OR MORE particular attributes, ideally joined with arbitrary ANDs and ORs. Right now I'm keeping it simple and just trying to implement the AND case. In pseudo-SQL (or pseudo-HQL if you would), it would be something like: select all items where attributes contains(ItemAttribute(name="foo1", value="bar1")) AND attributes contains(ItemAttribute(name="foo2", value="bar2")) The examples in the Hibernate docs didn't seem to address this particular use case, but it seems like a fairly common one. The disjunction case would also be useful, especially so I could specify a list of possible values, i.e. where attributes contains(ItemAttribute(name="foo", value="bar1")) OR attributes contains(ItemAttribute(name="foo", value="bar2")) -- etc. Here's an example that works OK for a single attribute: return getSession().createCriteria(Item.class) .createAlias("itemAttributes", "ia") .add(Restrictions.conjunction() .add(Restrictions.eq("ia.name", "foo")) .add(Restrictions.eq("ia.attributeValue", "bar"))) .list(); Learning how to do this would go a long ways towards expanding my understanding of Hibernate's potential. :)

    Read the article

  • How to call memcmp() on two parts of byte[] (with offset)?

    - by brickner
    Hi, I want to compare parts of byte[] efficiently - so I understand memcmp() should be used. I know I can using PInvoke to call memcmp() - http://stackoverflow.com/questions/43289/comparing-two-byte-arrays-in-net But, I want to compare only parts of the byte[] - using offset, and there is no memcmp() with offset since it uses pointers. int CompareBuffers(byte[] buffer1, int offset1, byte[] buffer2, int offset2, int count) { // Somehow call memcmp(&buffer1+offset1, &buffer2+offset2, count) } Should I use C++/CLI to do that? Should I use PInvoke with IntPtr? How? Thank you.

    Read the article

  • Android and SQLite using the SQLiteOpenHelper

    - by tunneling
    I have a SQLite database, and several tables within that database. I am developing a DBAdapter for each table within the database. (reference Reto Meier's Professional Android 2 Application Development, Listing 7.1). I am using the adb shell to interface with the database from the command line and see that the database is being populated as I expect. Occasionally, I want to drop a table so that I can ensure it's being built properly, from scratch. The problem is that SQLiteOpenHelper only checks to see if the database exists. Is there a typical solution to writing a helper to also see that the table(s) exists? Basically once I drop a table, the helper checks to see that the database exists and assumes all is well. Also, the CREATE_DATABASE string used in the reference above only creates the one table. Should I consider using the DBAdapter for an adapter to ALL of my tables? That doesn't seem as clean to me. Reference Material

    Read the article

  • core-plot and NSDate (iPhone)

    - by Urizen
    I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days. I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-plot distribution but have found it a little confusing. Does anyone know of a tutorial, or code sample, which might asist me in this regard? Thank you in advance.

    Read the article

  • Dynamic Database connection

    - by gsieranski
    I have multiple client databases that I need to hit on the fly and I am having trouble getting the code I have to work. At first I was just storing a connection string in a clinet object in the db, pulling it out based on logged-in user, and passing it to linq data context constructor. This works fine in my development enviorment but is failing on the Winhost server I am using. It is running SQL 2008. I am getting a "The current configuration system does not support user scoped settings." error. Any help or guidance on this issue is greatly appreciated. Greg

    Read the article

  • detect pdf tampering

    - by sean717
    Hi, the web app I am currently working on generates a PDF file and sends to user who will use this PDF as a certificate. My question is, how to make sure that this PDF file is impossible to be tampered by the user? Thanks,

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >