Search Results

Search found 1112 results on 45 pages for 'robert koritnik'.

Page 22/45 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Python 'datetime.datetime' object is unsubscriptable

    - by Robert
    First, I am NOT a python developer. I am trying to fix an issue within a python script that is being executed from the command line. This script was written by someone who is no longer around, and no longer willing to help with issues. This is python 2.5, and for the moment it cannot be upgraded. Here are the lines of code in question: start_time = datetime.strptime(str(paf.Start),"%Y-%m-%d %H:%M:%S") dict_start = datetime(*start_time[:6]) end_time = datetime.strptime(str(paf.End),"%Y-%m-%d %H:%M:%S") dict_end = datetime(*end_time[:6]) When this code is ran, it generates an error with the description: 'datetime.datetime' object is unsubscriptable. This is the import statement: from datetime import datetime I have a feeling that this is something simple, but not being my native language and Google not yielding any valuable results, I am stuck. I have tried a couple of different import methods, yielding different errors, but all with these statements. Any help on this would be greatly appreciated.

    Read the article

  • Help with JPQL query

    - by Robert
    I have to query a Message that is in a provided list of Groups and has not been Deactivated by the current user. Here is some pseudo code to illustrate the properties and entities: class Message { private int messageId; private String messageText; } class Group { private String groupId; private int messageId; } class Deactivated { private String userId; private int messageId; } Here is an idea of what I need to query for, it's the last AND clause that I don't know how to do (I made up the compound NOT IN expression). Filtering the deactivated messages by userId can result in multiple messageIds, how can I check if that subset of rows does not contain the messageId? SELECT msg FROM Message msg, Group group, Deactivated unactive WHERE group.messageId = msg.messageId AND (group.groupId = 'groupA' OR group.groupId = 'groupB' OR ...) AND ('someUserId', msg.messageId) NOT IN (unactive.userId, unactive.messageId) I don't know the number of groupIds ahead of time -- I receive them as a Collection<String> so I'll need to traverse them and add them to the JPQL dynamically.

    Read the article

  • When should I use Perl's AUTOLOAD?

    - by Robert S. Barnes
    In "Perl Best Practices" the very first line in the section on AUTOLOAD is: Don't use AUTOLOAD However all the cases he describes are dealing with OO or Modules. I have a stand alone script in which some command line switches control which versions of particular functions get defined. Now I know I could just take the conditionals and the evals and stick them naked at the top of my file before everything else, but I find it convenient and cleaner to put them in AUTOLOAD at the end of the file. Is this bad practice / style? If you think so why, and is there a another way to do it? As per brian's request I'm basically using this to do conditional compilation based on command line switches. I don't mind some constructive criticism. sub AUTOLOAD { our $AUTOLOAD; (my $method = $AUTOLOAD) =~ s/.*:://s; # remove package name if ($method eq 'tcpdump' && $tcpdump) { eval q( sub tcpdump { my $msg = shift; warn gf_time()." Thread ".threads->tid().": $msg\n"; } ); } elsif ($method eq 'loginfo' && $debug) { eval q( sub loginfo { my $msg = shift; $msg =~ s/$CRLF/\n/g; print gf_time()." Thread ".threads->tid().": $msg\n"; } ); } elsif ($method eq 'build_get') { if ($pipelining) { eval q( sub build_get { my $url = shift; my $base = shift; $url = "http://".$url unless $url =~ /^http/; return "GET $url HTTP/1.1${CRLF}Host: $base$CRLF$CRLF"; } ); } else { eval q( sub build_get { my $url = shift; my $base = shift; $url = "http://".$url unless $url =~ /^http/; return "GET $url HTTP/1.1${CRLF}Host: $base${CRLF}Connection: close$CRLF$CRLF"; } ); } } elsif ($method eq 'grow') { eval q{ require Convert::Scalar qw(grow); }; if ($@) { eval q( sub grow {} ); } goto &$method; } else { eval "sub $method {}"; return; } die $@ if $@; goto &$method; }

    Read the article

  • CSS / HTML centering a textbox

    - by Robert
    This should be easy but its proving difficult... My element I want centred is exactly this <input type="text"> I don't want the text centred, just the text box within the outer div. This is my attempt which is not working <div class ="temp123"> <input type="text" /> </div> Where: .temp123 { margin: 0 auto; margin-left: auto; margin-right: auto; } The text box remains on the left. The outer div has a fixed with of 300px and itself is centered using margin: 0 auto;

    Read the article

  • Importing Conditionally Compiled Functions From a Perl Module

    - by Robert S. Barnes
    I have a set of logging and debugging functions which I want to use across multiple modules / objects. I'd like to be able to turn them on / off globally using a command line switch. The following code does this, however, I would like to be able to omit the package name and keep everything in a single file. This is related to two previous questions I asked, here and here. #! /usr/bin/perl -w use strict; use Getopt::Long; { package LogFuncs; use threads; use Time::HiRes qw( gettimeofday ); # provide tcpdump style time stamp sub _gf_time { my ( $seconds, $microseconds ) = gettimeofday(); my @time = localtime($seconds); return sprintf( "%02d:%02d:%02d.%06ld", $time[2], $time[1], $time[0], $microseconds ); } sub logerr; sub compile { my %params = @_; *logerr = $params{do_logging} ? sub { my $msg = shift; warn _gf_time() . " Thread " . threads->tid() . ": $msg\n"; } : sub { }; } } { package FooObj; sub new { my $class = shift; bless {}, $class; }; sub foo_work { my $self = shift; # do some foo work LogFuncs::logerr($self); } } { package BarObj; sub new { my $class = shift; my $data = { fooObj => FooObj->new() }; bless $data, $class; } sub bar_work { my $self = shift; $self->{fooObj}->foo_work(); LogFuncs::logerr($self); } } my $do_logging = 0; GetOptions( "do_logging" => \$do_logging, ); LogFuncs::compile(do_logging => $do_logging); my $bar = BarObj->new(); LogFuncs::logerr("Created $bar"); $bar->bar_work();

    Read the article

  • Speed improvements for Perl's chameneos-redux in the Computer Language Benchmarks Game

    - by Robert P
    Ever looked at the Computer Language Benchmarks Game (formerly known as the Great Language Shootout)? Perl has some pretty healthy competition there at the moment. It also occurs to me that there's probably some places that Perl's scores could be improved. The biggest one is in the chameneos-redux script right now—the Perl version runs the worst out of any language: 1,626 times slower than the C baseline solution! There are some restrictions on how the programs can be made and optimized, and there is Perl's interpreted runtime penalty, but 1,626 times? There's got to be something that can get the runtime of this program way down. Taking a look at the source code and the challenge, how can the speed be improved?

    Read the article

  • Help with InvalidCastException

    - by Robert
    I have a gridview and, when a record is double-clicked, I want it to open up a new detail-view form for that particular record. As an example, I have created a Customer class: using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.ComponentModel; using System.Data.SqlClient; using System.Collections; namespace SyncTest { #region Customer Collection public class CustomerCollection : BindingListView<Customer> { public CustomerCollection() : base() { } public CustomerCollection(List<Customer> customers) : base(customers) { } public CustomerCollection(DataTable dt) { foreach (DataRow oRow in dt.Rows) { Customer c = new Customer(oRow); this.Add(c); } } } #endregion public class Customer : INotifyPropertyChanged, IEditableObject, IDataErrorInfo { private string _CustomerID; private string _CompanyName; private string _ContactName; private string _ContactTitle; private string _OldCustomerID; private string _OldCompanyName; private string _OldContactName; private string _OldContactTitle; private bool _Editing; private string _Error = string.Empty; private EntityStateEnum _EntityState; private Hashtable _PropErrors = new Hashtable(); public event PropertyChangedEventHandler PropertyChanged; private void FirePropertyChangeNotification(string propName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propName)); } } public Customer() { this.EntityState = EntityStateEnum.Unchanged; } public Customer(DataRow dr) { //Populates the business object item from a data row this.CustomerID = dr["CustomerID"].ToString(); this.CompanyName = dr["CompanyName"].ToString(); this.ContactName = dr["ContactName"].ToString(); this.ContactTitle = dr["ContactTitle"].ToString(); this.EntityState = EntityStateEnum.Unchanged; } public string CustomerID { get { return _CustomerID; } set { _CustomerID = value; FirePropertyChangeNotification("CustomerID"); } } public string CompanyName { get { return _CompanyName; } set { _CompanyName = value; FirePropertyChangeNotification("CompanyName"); } } public string ContactName { get { return _ContactName; } set { _ContactName = value; FirePropertyChangeNotification("ContactName"); } } public string ContactTitle { get { return _ContactTitle; } set { _ContactTitle = value; FirePropertyChangeNotification("ContactTitle"); } } public Boolean IsDirty { get { return ((this.EntityState != EntityStateEnum.Unchanged) || (this.EntityState != EntityStateEnum.Deleted)); } } public enum EntityStateEnum { Unchanged, Added, Deleted, Modified } void IEditableObject.BeginEdit() { if (!_Editing) { _OldCustomerID = _CustomerID; _OldCompanyName = _CompanyName; _OldContactName = _ContactName; _OldContactTitle = _ContactTitle; } this.EntityState = EntityStateEnum.Modified; _Editing = true; } void IEditableObject.CancelEdit() { if (_Editing) { _CustomerID = _OldCustomerID; _CompanyName = _OldCompanyName; _ContactName = _OldContactName; _ContactTitle = _OldContactTitle; } this.EntityState = EntityStateEnum.Unchanged; _Editing = false; } void IEditableObject.EndEdit() { _Editing = false; } public EntityStateEnum EntityState { get { return _EntityState; } set { _EntityState = value; } } string IDataErrorInfo.Error { get { return _Error; } } string IDataErrorInfo.this[string columnName] { get { return (string)_PropErrors[columnName]; } } private void DataStateChanged(EntityStateEnum dataState, string propertyName) { //Raise the event if (PropertyChanged != null && propertyName != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } //If the state is deleted, mark it as deleted if (dataState == EntityStateEnum.Deleted) { this.EntityState = dataState; } if (this.EntityState == EntityStateEnum.Unchanged) { this.EntityState = dataState; } } } } Here is my the code for the double-click event: private void customersDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position]; CustomerForm oForm = new CustomerForm(); oForm.NewCustomer = oCustomer; oForm.ShowDialog(this); oForm.Dispose(); oForm = null; } Unfortunately, when this code runs, I receive an InvalidCastException error stating "Unable to cast object to type 'System.Data.DataRowView' to type 'SyncTest.Customer'". This error occurs on the very first line of that event: Customer oCustomer = (Customer)customersBindingSource.CurrencyManager.List[customersBindingSource.CurrencyManager.Position]; What am I doing wrong?... and what can I do to fix this? Any help is greatly appreciated. Thanks!

    Read the article

  • show all tables in DB2 using the LIST command

    - by Robert
    This is embarrassing, but I can't seem to find a way to list the names of the tables in our DB2 database. Here is what I tried: root@VO11555:~# su - db2inst1 root@VO11555:~# . ~db2inst1/sqllib/db2profile root@VO11555:~# LIST ACTIVE DATABASES We receive this error: SQL1092N "ROOT" does not have the authority to perform the requested command or operation. The DB2 version number follows. root@VO11555:~# db2level DB21085I Instance "db2inst1" uses "64" bits and DB2 code release "SQL09071" with level identifier "08020107". Informational tokens are "DB2 v9.7.0.1", "s091114", "IP23034", and Fix Pack "1". Product is installed at "/opt/db2V9.7".

    Read the article

  • Boost.Thread Linking - boost_thread vs. boost_thread-mt

    - by Robert S. Barnes
    It's not clear to me what linking options exist for the Boost.Thread 1.34.1 library. I'm on Ubuntu 8.04 and I've found that using eitherr boost_thread or boost_thread-mt during linking both compile and run, but I don't see any documentation on these or any other linking options in above link. What Boost.Thread linking options are available and what do the mean?

    Read the article

  • Round-robin assignment

    - by Robert
    Hi, I have a Customers table and would like to assign a Salesperson to each customer in a round-robin fashion. Customers --CustomerID --FName --SalespersonID Salesperson --SalespersonID --FName So, if I have 15 customers and 5 salespeople, I would like the end result to look something like this: CustomerID -- FName -- SalespersonID 1 -- A -- 1 2 -- B -- 2 3 -- C -- 3 4 -- D -- 4 5 -- E -- 5 6 -- F -- 1 7 -- G -- 2 8 -- H -- 3 9 -- I -- 4 10 -- J -- 5 11 -- K -- 1 12 -- L -- 2 13 -- M -- 3 14 -- N -- 4 15 -- 0 -- 5 etc... I've been playing around with this for a bit and am trying to write some SQL to update my Customers table with the appropriate SalespersonID, but am having some trouble getting it to work. Any ideas are greatly appreciated!

    Read the article

  • Process results of conditional split in SSIS

    - by Robert
    I have a Data Flow Task and am connecting to a database via an OLE DB Source component to extract data. This data feeds into a Conditional Split component to separate the data based on a simple expression. After the evaluation of this expression, the data will end up in either of two locations: LocationA or LocationB. Alright, I have that all set up and working properly. Once the data is separated into these two locations, additional processing is to be done on the records. Here's where I am stuck: I need the the processing of records in LocationA to occur before the processing of records in LocationB. Is there a way to set precedence of which tasks occur before others? If not, what is the best way to handle this? I was thinking I may need to write the data in LocationA and LocationB back out to the database and create a new data flow task in the control flow to handle the order of which these records must be dealt with. Any help is greatly appreciated!

    Read the article

  • Lua Patterns,Tips and Tricks

    - by Robert Gould
    This is a Tips & Tricks question with the purpose of letting people accumulate their patterns, tips and tricks for Lua. Lua is a great scripting language, however there is a lack of documented patterns, and I'm sure everyone has their favorites, so newcomers and people wondering if they should use it or not can actually appreciate the language's beauty.

    Read the article

  • What is "Virtual Size" in sysinternals process explorer

    - by robert
    Hi My application runs for few hours, There is no increase in any value ( vmsize, memory) of Task Manager. But after few hours i get out of memory errors. In sysinternals i see that "Virtual Size" is contineously increasing, and when it reach around 2 GB i start getting memory errors. So what kind of memory leak is that ? How can i demonstrate it with a code ? Is it possible to reproduce same thing with any piece of code where none of the memory value increase but only the Virtual Size in sysinternsl process explorer increase ? thanks for any suggestions

    Read the article

  • How to actually query Chinese address in Googlemap API geocoding??

    - by Robert
    I'm following the demo code from article of phpsqlgeocode.html In the db, I inserted some Chinese addresses, which is utf8 encode. I found after urlencode the Chinese address, the output of the address will be wrong.Like this one: http://maps.google.com.tw/maps/geo?output=csv&key=ABQIAAAAfG3KxFZXjEslq8VNxMBpKRR08snBovzCxLQZ9DWwpnzxH-ROPxSAS9Q36m-6OOy0qlwTL6Ht9qp87w&q=%3F%3F%3F%3F%3F%3F%3F%3F%3F132%3F Then output(can't query from php, it have to test as browser url link), 200,5,59.3266963,18.2733433 Whose address is actually located in Taichung Taiwan, but turn out to in Sweden Europe. But when I paste the Chinese address(such as ???????? ?131?56?58?60?) in the url, the result turn out to be fine!!! So my question is how to make sure it send out the original Chiness address?? how to prevent urlencode()??? I found take urlencode() away not change anything. (I've change the MAPS_HOST from maps.google.com to maps.google.com.tw.) (I'm sure my key is right, and other English address geocoding are fine.) Thanks!!

    Read the article

  • Where does the version number come from?

    - by Robert Schneider
    I have a version control system (e.g. Subversion) and now I'd like to set up a build process. Now I have to create a version number and insert it into the system. But where does the version number come from and get into? Assume I want to use this common <major.<minor.<bugfix/revision scheme. Should I pass a number to the build script? Or should I pass arguments like increaseMajor, increaseMinor, increaseRevision? Or would you recommend to create a branch with the number which will be detected by the build script? I could imagine that the major and minor version number have to be put in manually somewhere. The revision number could be increased automaically. But still I don't know where I would place the major and minor number. In my case I have some php files that I would like to zip, but before I have to insert some version numbers into php file. I have edited this post to try to make my request clearer: I do not use Subversion, that was just an example. And I don't want to discuss the version number scheme. Imagine I want to create version 3.5.0 or 3.5.1. Would I pass this version number to a build script? Would the script create the branch in the repository with this number or would it expect that someone has already created this branch? Manually? Or would the build script look for name of the branch (e.g. '3.5.1) and use it for further things? And does the version number come from my brain or is it automatically created (I guess the major/minor number it comes from my little brain and revision number is created)? Or would you place the number into a file that may gets inserted into the repository? I guess if would use a release management tool I would insert the version number there. But I don't use one yet.

    Read the article

  • TextToSpeech setOnUtteranceCompletedListener always returns -1 error?

    - by Robert Nekic
    I've been working with Android's TTS functions with general success however, one piece of it refuses to work for me; I can not successfully assign an OnUtteranceCompletedListener to my TextToSpeech object. I've tried implementing OnUtteranceCompletedListener in one of my classes and I've tried creating a new, stand-alone OnUtteranceCompletedListener instance. Both approaches are simple enough to implement and appear to yield proper listeners without exceptions...yet setOnUtteranceCompleteListener(myListener) ALWAYS returns -1 (ERROR). The documentation for this seems straight forward. Has anyone gotten this to work? I'm targeting SDK 4. Are there known issues with this with SDK4/v1.6?

    Read the article

  • Grails easygrid plugin, Datatable implementation

    - by Robert Morning
    I'm playing with the datatable implementation in the Easygrid plugin and I have to say i love it but I have a question . If i use datatable directly (ie outside of Easygrid) to decorate a table i get a global search box defined above my table . If i use the Easygrid implementation and define my grid in a controller I get filters added for each column but no search box - it is added but then removed somehow either by easygrid itself or some parameter passed to datatable . How can I restore the search box and is this a bug as i would have thought the default implementation of datatable supplied via easygrid should match the default implementation supplied by the vanilla datatable itself? I'm using Grails 2.3.7 and Easygrid 1.6.2 .. Thanks

    Read the article

  • Keyboard for programmers

    - by Robert Höglund
    I'm trying to improve my working environment and I'm still searching for that perfect keyboard that practically types bug-free code all by itself. At the moment I'm using a Logitech Wave for my Windows need and an Apple Wireless Keyboard (the one without a numeric keypad) when doing OS X stuff. I'm quite happy with the Logitech Wave but I would prefer one without all the extra multimedia buttons. What I like most about the Apple Wireless Keyboard is that it is very similar to the Macbook's keyboard which for me makes it easier to write code when on my Macbook. What kind of keyboard would you recommend for going all out writing code until your fingers bleed? I have remapped the Caps Lock key to Ctrl which after a while feels really good, until I have to sit at another computer or when someone at work is going to show me something on my computer. Are there other little keyboard tricks that you use to get a little bit more productive? I have looked into switching to Dvorak but I have decided it's not for me.

    Read the article

  • Adding JBoss repository to m2eclipse, no latest Hibernate version

    - by Robert
    I'm trying to add JBoss repository to m2eclipse, mainly for Hibernate. It seems to work, but it can't find the latest version of Hibernate (3.5.1), only 3.5.0beta. I looked at some other packages, and they all seem a couple of months behind. What could be causing this? I'm running latest m2eclipse, and i guess latest Eclipse (it just says 20100218-1602, eclipse people think it's funny to not include version in the about dialog), on ubuntu 9.10. This is my settings.xml <settings> <profiles> <profile> <id>jboss-maven2-release-repository</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>jboss-maven2-release-repository</id> <url>http://repository.jboss.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>jboss-snapshots</id> <url>http://snapshots.jboss.org/maven2</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-releases</id> <url>http://repository.jboss.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>jboss-snapshots</id> <url>http://snapshots.jboss.org/maven2</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles>

    Read the article

  • IE 8 Compatibility Mode Causes Form Submit Button to Wrap

    - by Robert
    The below code does what I want in browsers I check with except IE when using compatibility mode. In compatibility mode the submit (Remove) button wraps to the next line. Can anyone help? It should look like it does in Firefox or IE when not using compatibility mode. Can't use float:left/right because I cannot specify length beforehand. Thanks for any help. Name: Test Name That is Longer Than The Other Qty: 1 Name: Short Test Name Qty: 1

    Read the article

  • WFP: How do you properly Bind a DependencyProperty to the GUI

    - by Robert Ross
    I have the following class (abreviated for simplicity). The app it multi-threaded so the Set and Get are a bit more complicated but should be ok. namespace News.RSS { public class FeedEngine : DependencyObject { public static readonly DependencyProperty _processing = DependencyProperty.Register("Processing", typeof(bool), typeof(FeedEngine), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender)); public bool Processing { get { return (bool)this.Dispatcher.Invoke( DispatcherPriority.Normal, (DispatcherOperationCallback)delegate { return GetValue(_processing); }, Processing); } set { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate { SetValue(_processing, value); }, value); } } public void Poll() { while (Running) { Processing = true; //Do my work to read the data feed from remote source Processing = false; Thread.Sleep(PollRate); } // } } } Next I have my main form as the following: <Window x:Class="News.Main" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converter="clr-namespace:News.Converters" xmlns:local="clr-namespace:News.Lookup" xmlns:rss="clr-namespace:News.RSS" Title="News" Height="521" Width="927" Initialized="Window_Initialized" Closing="Window_Closing" > <Window.Resources> <ResourceDictionary> <converter:BooleanConverter x:Key="boolConverter" /> <converter:ArithmeticConverter x:Key="arithConverter" /> ... </ResourceDictionary> </Window.Resources> <DockPanel Name="dockPanel1" SnapsToDevicePixels="False" > <ToolBarPanel Height="37" Name="toolBarPanel" Orientation="Horizontal" DockPanel.Dock="Top" > <ToolBarPanel.Children> <Button DataContext="{DynamicResource FeedEngine}" HorizontalAlignment="Right" Name="btnSearch" ToolTip="Search" Click="btnSearch_Click" IsEnabled="{Binding Path=Processing, Converter={StaticResource boolConverter}}"> <Image Width="32" Height="32" Name="imgSearch" Source="{Resx ResxName=News.Properties.Resources, Key=Search}" /> </Button> ... </DockPanel> </Window> As you can see I set the DataContext to FeedEngine and Bind IsEnabled to Processing. I have also tested the boolConverter separately and it functions (just applies ! (Not) to a bool). Here is my Main window code behind in case it helps to debug. namespace News { /// <summary> /// Interaction logic for Main.xaml /// </summary> public partial class Main : Window { public FeedEngine _engine; List<NewsItemControl> _newsItems = new List<NewsItemControl>(); Thread _pollingThread; public Main() { InitializeComponent(); this.Show(); } private void Window_Initialized(object sender, EventArgs e) { // Load current Feed data. _engine = new FeedEngine(); ThreadStart start = new ThreadStart(_engine.Poll); _pollingThread = new Thread(start); _pollingThread.Start(); } } } Hope someone can see where I missed a step. Thanks.

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >