Search Results

Search found 1453 results on 59 pages for 'adam libonatti roche'.

Page 28/59 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • How do I sort an array of Person Objects by using compareto()?

    - by Adam
    Here is my code: > import java.util.Scanner; import java.util.Arrays; /** This class tests the Person class. */ public class PersonDemo { public static void main(String[] args) { int count = 0; Scanner in = new Scanner(System.in); boolean more = false; Person first = null; Person last = null; while (more) { System.out.println( "Please enter the person's name or a blank line to quit"); String name = in.nextLine(); if (name.equals("")) more = false; else { Person p = new Person(name); //new person object created with inputted name Person[] people = new Person[10]; //new array of 10 person objects people[count] = p; //declare person object with index of variable count as the new person object first = people[count]; // I have no idea what to do here. This is where I'm stuck. last = people[count]; // I can't figure out what to do with this either. first.compareTo(p); //call compareTo method on first and new person object last.compareTo(p); //call compareTo method on last and new person object count++; // increase count variable } } System.out.println("First: " + first.toString()); System.out.println("Last: " + last.toString()); } } And the Person class: /** A person with a name. */ public class Person implements Comparable { /** * Constructs a Person with a name. * @param aName the person's name */ public Person(String aName) { name = aName; } public String getName() { return name; } @Override public int compareTo(Object otherObject) { Person other = (Person)otherObject; if (name.compareTo(other.name) < 0) return -1; if (name.compareTo(other.name) > 0) return 1; return 0; } /** Returns a string representation of the object. @return name of Person */ public String toString() { return "[name=" + name + "]"; } private String name; }

    Read the article

  • How to best implement Version Control for Web Development?

    - by Adam Taylor
    Version control systems are obviously important in development projects but there use in web development projects appears to be more complex, what with the requirement of having a web server to run all but the simplest of web applications. With that in mind, I have looked around and discovered a few different methods of using version control in web development projects: Provide each developer with a virtual machine which is a replication of the development server and have the developer run their working copy of the application in the virtual machine. Have each developer use a sub domain on the development server, e.g. john.project.com and checkout their working copy of the app to the directories the sub domain points to. Use the version control system to checkout code, make a change, commit the code and then check it on the development server (which points to the head of the repository). I can see a drawback of 1 being the added time required to create the virtual machines and ensure that the virtual machines are kept insync with the development server (also the need(?) to continuously change the developers host file to point at the virtual machine not the development server). I can see 2 possibly being a problem if absolute URLs are used within the site unless there is an easy way to update the configuration to use the new subdomains as well. 3 is the easiest to set up but is rather primitive and it will presumably become quite tedious for a developer to keep checking in the code after every time change. How have the users of stackoverflow used version control with web development projects and which method/workflow was most effective. Please also include extra methods I haven't thought of / read about.

    Read the article

  • Python script is exiting with no output and I have no idea why

    - by Adam Tuttle
    I'm attempting to debug a Subversion post-commit hook that calls some python scripts. What I've been able to determine so far is that when I run post-commit.bat manually (I've created a wrapper for it to make it easier) everything succeeds, but when SVN runs it one particular step doesn't work. We're using CollabNet SVNServe, which I know from the documentation removes all environment variables. This had caused some problems earlier, but shouldn't be an issue now. Before Subversion calls a hook script, it removes all variables - including $PATH on Unix, and %PATH% on Windows - from the environment. Therefore, your script can only run another program if you spell out that program's absolute name. The relevant portion of post-commit.bat is: echo -------------------------- >> c:\svn-repos\company\hooks\svn2ftp.out.log set SITENAME=staging set SVNPATH=branches/staging/wwwroot/ "C:\Python3\python.exe" C:\svn-repos\company\hooks\svn2ftp.py ^ --svnUser="svnusername" ^ --svnPass="svnpassword" ^ --ftp-user=ftpuser ^ --ftp-password=ftppassword ^ --ftp-remote-dir=/ ^ --access-url=svn://10.0.100.6/company ^ --status-file="C:\svn-repos\company\hooks\svn2ftp-%SITENAME%.dat" ^ --project-directory=%SVNPATH% "staging.company.com" %1 %2 >> c:\svn-repos\company\hooks\svn2ftp.out.log echo -------------------------- >> c:\svn-repos\company\hooks\svn2ftp.out.log When I run post-commit.bat manually, for example: post-commit c:\svn-repos\company 12345, I see output like the following in svn2ftp.out.log: -------------------------- args1: c:\svn-repos\company args0: staging.company.com abspath: c:\svn-repos\company project_dir: branches/staging/wwwroot/ local_repos_path: c:\svn-repos\company getting youngest revision... done, up-to-date -------------------------- However, when I commit something to the repo and it runs automatically, the output is: -------------------------- -------------------------- svn2ftp.py is a bit long, so I apologize but here goes. I'll have some notes/disclaimers about its contents below it. #!/usr/bin/env python """Usage: svn2ftp.py [OPTION...] FTP-HOST REPOS-PATH Upload to FTP-HOST changes committed to the Subversion repository at REPOS-PATH. Uses svn diff --summarize to only propagate the changed files Options: -?, --help Show this help message. -u, --ftp-user=USER The username for the FTP server. Default: 'anonymous' -p, --ftp-password=P The password for the FTP server. Default: '@' -P, --ftp-port=X Port number for the FTP server. Default: 21 -r, --ftp-remote-dir=DIR The remote directory that is expected to resemble the repository project directory -a, --access-url=URL This is the URL that should be used when trying to SVN export files so that they can be uploaded to the FTP server -s, --status-file=PATH Required. This script needs to store the last successful revision that was transferred to the server. PATH is the location of this file. -d, --project-directory=DIR If the project you are interested in sending to the FTP server is not under the root of the repository (/), set this parameter. Example: -d 'project1/trunk/' This should NOT start with a '/'. 2008.5.2 CKS Fixed possible Windows-related bug with tempfile, where the script didn't have permission to write to the tempfile. Replaced this with a open()-created file created in the CWD. 2008.5.13 CKS Added error logging. Added exception for file-not-found errors when deleting files. 2008.5.14 CKS Change file open to 'rb' mode, to prevent Python's universal newline support from stripping CR characters, causing later comparisons between FTP and SVN to report changes. """ try: import sys, os import logging logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='svn2ftp.debug.log', filemode='a' ) console = logging.StreamHandler() console.setLevel(logging.ERROR) logging.getLogger('').addHandler(console) import getopt, tempfile, smtplib, traceback, subprocess from io import StringIO import pysvn import ftplib import inspect except Exception as e: logging.error(e) #capture the location of the error frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) logging.debug(stack_trace) print(stack_trace) #end capture sys.exit(1) #defaults host = "" user = "anonymous" password = "@" port = 21 repo_path = "" local_repos_path = "" status_file = "" project_directory = "" remote_base_directory = "" toAddrs = "[email protected]" youngest_revision = "" def email(toAddrs, message, subject, fromAddr='[email protected]'): headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromAddr, toAddrs, subject) message = headers + message logging.info('sending email to %s...' % toAddrs) server = smtplib.SMTP('smtp.company.com') server.set_debuglevel(1) server.sendmail(fromAddr, toAddrs, message) server.quit() logging.info('email sent') def captureErrorMessage(e): sout = StringIO() traceback.print_exc(file=sout) errorMessage = '\n'+('*'*80)+('\n%s'%e)+('\n%s\n'%sout.getvalue())+('*'*80) return errorMessage def usage_and_exit(errmsg): """Print a usage message, plus an ERRMSG (if provided), then exit. If ERRMSG is provided, the usage message is printed to stderr and the script exits with a non-zero error code. Otherwise, the usage message goes to stdout, and the script exits with a zero errorcode.""" if errmsg is None: stream = sys.stdout else: stream = sys.stderr print(__doc__, file=stream) if errmsg: print("\nError: %s" % (errmsg), file=stream) sys.exit(2) sys.exit(0) def read_args(): global host global user global password global port global repo_path global local_repos_path global status_file global project_directory global remote_base_directory global youngest_revision try: opts, args = getopt.gnu_getopt(sys.argv[1:], "?u:p:P:r:a:s:d:SU:SP:", ["help", "ftp-user=", "ftp-password=", "ftp-port=", "ftp-remote-dir=", "access-url=", "status-file=", "project-directory=", "svnUser=", "svnPass=" ]) except getopt.GetoptError as msg: usage_and_exit(msg) for opt, arg in opts: if opt in ("-?", "--help"): usage_and_exit() elif opt in ("-u", "--ftp-user"): user = arg elif opt in ("-p", "--ftp-password"): password = arg elif opt in ("-SU", "--svnUser"): svnUser = arg elif opt in ("-SP", "--svnPass"): svnPass = arg elif opt in ("-P", "--ftp-port"): try: port = int(arg) except ValueError as msg: usage_and_exit("Invalid value '%s' for --ftp-port." % (arg)) if port < 1 or port > 65535: usage_and_exit("Value for --ftp-port must be a positive integer less than 65536.") elif opt in ("-r", "--ftp-remote-dir"): remote_base_directory = arg elif opt in ("-a", "--access-url"): repo_path = arg elif opt in ("-s", "--status-file"): status_file = os.path.abspath(arg) elif opt in ("-d", "--project-directory"): project_directory = arg if len(args) != 3: print(str(args)) usage_and_exit("host and/or local_repos_path not specified (" + len(args) + ")") host = args[0] print("args1: " + args[1]) print("args0: " + args[0]) print("abspath: " + os.path.abspath(args[1])) local_repos_path = os.path.abspath(args[1]) print('project_dir:',project_directory) youngest_revision = int(args[2]) if status_file == "" : usage_and_exit("No status file specified") def main(): global host global user global password global port global repo_path global local_repos_path global status_file global project_directory global remote_base_directory global youngest_revision read_args() #repository,fs_ptr #get youngest revision print("local_repos_path: " + local_repos_path) print('getting youngest revision...') #youngest_revision = fs.youngest_rev(fs_ptr) assert youngest_revision, "Unable to lookup youngest revision." last_sent_revision = get_last_revision() if youngest_revision == last_sent_revision: # no need to continue. we should be up to date. print('done, up-to-date') return if last_sent_revision or youngest_revision < 10: # Only compare revisions if the DAT file contains a valid # revision number. Otherwise we risk waiting forever while # we parse and uploading every revision in the repo in the case # where a repository is retroactively configured to sync with ftp. pysvn_client = pysvn.Client() pysvn_client.callback_get_login = get_login rev1 = pysvn.Revision(pysvn.opt_revision_kind.number, last_sent_revision) rev2 = pysvn.Revision(pysvn.opt_revision_kind.number, youngest_revision) summary = pysvn_client.diff_summarize(repo_path, rev1, repo_path, rev2, True, False) print('summary len:',len(summary)) if len(summary) > 0 : print('connecting to %s...' % host) ftp = FTPClient(host, user, password) print('connected to %s' % host) ftp.base_path = remote_base_directory print('set remote base directory to %s' % remote_base_directory) #iterate through all the differences between revisions for change in summary : #determine whether the path of the change is relevant to the path that is being sent, and modify the path as appropriate. print('change path:',change.path) ftp_relative_path = apply_basedir(change.path) print('ftp rel path:',ftp_relative_path) #only try to sync path if the path is in our project_directory if ftp_relative_path != "" : is_file = (change.node_kind == pysvn.node_kind.file) if str(change.summarize_kind) == "delete" : print("deleting: " + ftp_relative_path) try: ftp.delete_path("/" + ftp_relative_path, is_file) except ftplib.error_perm as e: if 'cannot find the' in str(e) or 'not found' in str(e): # Log, but otherwise ignore path-not-found errors # when deleting, since it's not a disaster if the file # we want to delete is already gone. logging.error(captureErrorMessage(e)) else: raise elif str(change.summarize_kind) == "added" or str(change.summarize_kind) == "modified" : local_file = "" if is_file : local_file = svn_export_temp(pysvn_client, repo_path, rev2, change.path) print("uploading file: " + ftp_relative_path) ftp.upload_path("/" + ftp_relative_path, is_file, local_file) if is_file : os.remove(local_file) elif str(change.summarize_kind) == "normal" : print("skipping 'normal' element: " + ftp_relative_path) else : raise str("Unknown change summarize kind: " + str(change.summarize_kind) + ", path: " + ftp_relative_path) ftp.close() #write back the last revision that was synced print("writing last revision: " + str(youngest_revision)) set_last_revision(youngest_revision) # todo: undo def get_login(a,b,c,d): #arguments don't matter, we're always going to return the same thing try: return True, "svnUsername", "svnPassword", True except Exception as e: logging.error(e) #capture the location of the error frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) logging.debug(stack_trace) #end capture sys.exit(1) #functions for persisting the last successfully synced revision def get_last_revision(): if os.path.isfile(status_file) : f=open(status_file, 'r') line = f.readline() f.close() try: i = int(line) except ValueError: i = 0 else: i = 0 f = open(status_file, 'w') f.write(str(i)) f.close() return i def set_last_revision(rev) : f = open(status_file, 'w') f.write(str(rev)) f.close() #augmented ftp client class that can work off a base directory class FTPClient(ftplib.FTP) : def __init__(self, host, username, password) : self.base_path = "" self.current_path = "" ftplib.FTP.__init__(self, host, username, password) def cwd(self, path) : debug_path = path if self.current_path == "" : self.current_path = self.pwd() print("pwd: " + self.current_path) if not os.path.isabs(path) : debug_path = self.base_path + "<" + path path = os.path.join(self.current_path, path) elif self.base_path != "" : debug_path = self.base_path + ">" + path.lstrip("/") path = os.path.join(self.base_path, path.lstrip("/")) path = os.path.normpath(path) #by this point the path should be absolute. if path != self.current_path : print("change from " + self.current_path + " to " + debug_path) ftplib.FTP.cwd(self, path) self.current_path = path else : print("staying put : " + self.current_path) def cd_or_create(self, path) : assert os.path.isabs(path), "absolute path expected (" + path + ")" try: self.cwd(path) except ftplib.error_perm as e: for folder in path.split('/'): if folder == "" : self.cwd("/") continue try: self.cwd(folder) except: print("mkd: (" + path + "):" + folder) self.mkd(folder) self.cwd(folder) def upload_path(self, path, is_file, local_path) : if is_file: (path, filename) = os.path.split(path) self.cd_or_create(path) # Use read-binary to avoid universal newline support from stripping CR characters. f = open(local_path, 'rb') self.storbinary("STOR " + filename, f) f.close() else: self.cd_or_create(path) def delete_path(self, path, is_file) : (path, filename) = os.path.split(path) print("trying to delete: " + path + ", " + filename) self.cwd(path) try: if is_file : self.delete(filename) else: self.delete_path_recursive(filename) except ftplib.error_perm as e: if 'The system cannot find the' in str(e) or '550 File not found' in str(e): # Log, but otherwise ignore path-not-found errors # when deleting, since it's not a disaster if the file # we want to delete is already gone. logging.error(captureErrorMessage(e)) else: raise def delete_path_recursive(self, path): if path == "/" : raise "WARNING: trying to delete '/'!" for node in self.nlst(path) : if node == path : #it's a file. delete and return self.delete(path) return if node != "." and node != ".." : self.delete_path_recursive(os.path.join(path, node)) try: self.rmd(path) except ftplib.error_perm as msg : sys.stderr.write("Error deleting directory " + os.path.join(self.current_path, path) + " : " + str(msg)) # apply the project_directory setting def apply_basedir(path) : #remove any leading stuff (in this case, "trunk/") and decide whether file should be propagated if not path.startswith(project_directory) : return "" return path.replace(project_directory, "", 1) def svn_export_temp(pysvn_client, base_path, rev, path) : # Causes access denied error. Couldn't deduce Windows-perm issue. # It's possible Python isn't garbage-collecting the open file-handle in time for pysvn to re-open it. # Regardless, just generating a simple filename seems to work. #(fd, dest_path) = tempfile.mkstemp() dest_path = tmpName = '%s.tmp' % __file__ exportPath = os.path.join(base_path, path).replace('\\','/') print('exporting %s to %s' % (exportPath, dest_path)) pysvn_client.export( exportPath, dest_path, force=False, revision=rev, native_eol=None, ignore_externals=False, recurse=True, peg_revision=rev ) return dest_path if __name__ == "__main__": logging.info('svnftp.start') try: main() logging.info('svnftp.done') except Exception as e: # capture the location of the error for debug purposes frame = inspect.currentframe() stack_trace = traceback.format_stack(frame) logging.debug(stack_trace[:-1]) print(stack_trace) # end capture error_text = '\nFATAL EXCEPTION!!!\n'+captureErrorMessage(e) subject = "ALERT: SVN2FTP Error" message = """An Error occurred while trying to FTP an SVN commit. repo_path = %(repo_path)s\n local_repos_path = %(local_repos_path)s\n project_directory = %(project_directory)s\n remote_base_directory = %(remote_base_directory)s\n error_text = %(error_text)s """ % globals() email(toAddrs, message, subject) logging.error(e) Notes/Disclaimers: I have basically no python training so I'm learning as I go and spending lots of time reading docs to figure stuff out. The body of get_login is in a try block because I was getting strange errors saying there was an unhandled exception in callback_get_login. Never figured out why, but it seems fine now. Let sleeping dogs lie, right? The username and password for get_login are currently hard-coded (but correct) just to eliminate variables and try to change as little as possible at once. (I added the svnuser and svnpass arguments to the existing argument parsing.) So that's where I am. I can't figure out why on earth it's not printing anything into svn2ftp.out.log. If you're wondering, the output for one of these failed attempts in svn2ftp.debug.log is: 2012-09-06 15:18:12,496 INFO svnftp.start 2012-09-06 15:18:12,496 INFO svnftp.done And it's no different on a successful run. So there's nothing useful being logged. I'm lost. I've gone way down the rabbit hole on this one, and don't know where to go from here. Any ideas?

    Read the article

  • Selectively configuring Apache 2 mod_headers for Google Chrome Frame

    - by Adam Cobb
    I am currently evaluating Google Chrome Frame and so far i'm happy with it, but what i'd like to do is selectively use it for certain sections of my website. Some sections require ActiveX so need to be viewed in native IE, whereas others benefit greatly, and may end up requiring, Chrome Frame. I've currently got the following configured in my apache httpd.conf file - <IfModule mod_setenvif.c> <IfModule mod_headers.c> BrowserMatch chromeframe gcf Header append X-UA-Compatible "chrome=1" env=gcf </IfModule> </IfModule> This causes anything coming in via Apache to get the chrome frame stuff added to the headers. What I need is to make this only happen when a user visits particular URL's / particular pages, which i'm currently controlling via RewriteRules. Could anybody explain how I would go about this, as my understanding of the Apache config files isn't brilliant. Thanks.

    Read the article

  • How to Convert Non-English Characters to English Using JavaScript

    - by Adam Right
    I have a c# function which converts all non-english characters to proper characters for a given text. like as follows public static string convertString(string phrase) { int maxLength = 100; string str = phrase.ToLower(); int i = str.IndexOfAny( new char[] { 's','ç','ö','g','ü','i'}); //if any non-english charr exists,replace it with proper char if (i > -1) { StringBuilder outPut = new StringBuilder(str); outPut.Replace('ö', 'o'); outPut.Replace('ç', 'c'); outPut.Replace('s', 's'); outPut.Replace('i', 'i'); outPut.Replace('g', 'g'); outPut.Replace('ü', 'u'); str = outPut.ToString(); } // if there are other invalid chars, convert them into blank spaces str = Regex.Replace(str, @"[^a-z0-9\s-]", ""); // convert multiple spaces and hyphens into one space str = Regex.Replace(str, @"[\s-]+", " ").Trim(); // cut and trim string str = str.Substring(0, str.Length <= maxLength ? str.Length : maxLength).Trim(); // add hyphens str = Regex.Replace(str, @"\s", "-"); return str; } but i should use same function on client side with javascript. is it possible to convert above function to js ? waiting all kinds of suggestion. thanks in advance..

    Read the article

  • PowerBuilder Indeterminate Progress Bar

    - by Adam Hawkes
    I have a somewhat-long-running stored procedure being called from a PB application. I want the UI to show an indicator that it is processing, but I don't know the exact progress. That is, I can't say whether it is 10% or 90% done. All I know is when it is done. To give the user something to look at I'd like to put a "Inderterminate" (horizontal) progress bar on the window somewhere. I've looked at the documentation for the built-in HProgressBar control and don't see how to force this behavior. Short of writing my own control or importing another one, is there a way to accomplish this?

    Read the article

  • DoubleAnimation in ScaleTransform

    - by Adam S
    I'm trying, as an exhibition, to use a DoubleAnimation on the ScaleX and ScaleY properties of a ScaleTransform. I have a rectangle (144x144) which I want to make rectangular over five seconds. My XAML: <Window x:Class="ScaleTransformTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" Loaded="Window_Loaded"> <Grid> <Rectangle Name="rect1" Width="144" Height="144" Fill="Aqua"> <Rectangle.RenderTransform> <ScaleTransform ScaleX="1" ScaleY="1" /> </Rectangle.RenderTransform> </Rectangle> </Grid> </Window> My C#: private void Window_Loaded(object sender, RoutedEventArgs e) { ScaleTransform scaly = new ScaleTransform(1, 1); rect1.RenderTransform = scaly; Duration mytime = new Duration(TimeSpan.FromSeconds(5)); Storyboard sb = new Storyboard(); DoubleAnimation danim1 = new DoubleAnimation(1, 1.5, mytime); DoubleAnimation danim2 = new DoubleAnimation(1, 0.5, mytime); sb.Children.Add(danim1); sb.Children.Add(danim2); Storyboard.SetTarget(danim1, scaly); Storyboard.SetTargetProperty(danim1, new PropertyPath(ScaleTransform.ScaleXProperty)); Storyboard.SetTarget(danim2, scaly); Storyboard.SetTargetProperty(danim2, new PropertyPath(ScaleTransform.ScaleYProperty)); sb.Begin(); } Unfortunately, when I run this program, it does nothing. The rectangle stays at 144x144. If I do away with the animation, and just ScaleTransform scaly = new ScaleTransform(1.5, 0.5); rect1.RenderTransform = scaly; it will elongate it instantly, no problem. There is a problem elsewhere. Any suggestions? I have read the discussion at http://www.eggheadcafe.com/software/aspnet/29220878/how-to-animate-tofrom-an.aspx in which someone seems to have gotten a pure-XAML version working, but the code is not shown there. EDIT: At http://stackoverflow.com/questions/2131797/applying-animated-scaletransform-in-code-problem it seems someone had a very similar problem, I am fine with using his method that worked, but what the heck is that string thePath = "(0).(1)[0].(2)"; all about? What are those numbers representing?

    Read the article

  • How to Determine the Size of MSADO Command Parameters

    - by Adam
    I am new to MS ADO and trying to understand how to set the size on command parameters as created by the command.CreateParameter (Name, Type, Direction, Size, Value) The documentation says the following: Size Optional. A Long value that specifies the maximum length for the parameter value in characters or bytes. ... If you specify a variable-length data type in the Type argument, you must either pass a Size argument or set the Size property of the Parameter object before appending it to the Parameters collection; otherwise, an error occurs. 1.) What should one pass for fixed-size parameters? Is it a "don't care"? I was a bit confused by the example found here, in which they set size to 3 for an adInteger parameter with Value set to a variant of type VT_I2 pPrmByRoyalty->Type = adInteger; pPrmByRoyalty->Size = 3; pPrmByRoyalty->Direction = adParamInput; pPrmByRoyalty->Value = vtroyal; VT_I2 implies two bytes. A tagVARIANT struct is 16 bytes. How did they land on three? I see that the enum value for adInteger happens to be three, but I suspect that is just a coincidence. So it's a bit confusing what to pass for fixed-size parameters. The team I'm working with has always passed sizeof(int) for adInteger, and it seems to work. Is that correct? Now, for "variable-length" parameters: we are instructed by the documentation to pass "the maximum length .. in characters or bytes". 2.) For adVarChar, is it sufficient to pass the max width as defined in the database? 3.) What about the Wide types (e.g. adVarWChar)? Is it characters or bytes? 4.) How about adVariant, which could contain fixed- or variable-length data? 5.) Do arrays ever come into play here? (we don't pass them as parameters, just curious) Any references or personal insights are welcome.

    Read the article

  • search results filter effects - flex

    - by Adam
    I've created a search with a couple of comboboxes that allow users to filter their search results. The results are currently using a TileList & itemRenderer to display, and now I'd like to add an animation effect when the user filters their results. I know that you can use the itemsChangeEffect to create an animation effect when the user drags and moves result itmes. So I'd like to know if there's a way to create a similar effect triggered by the filtering on the comboboxes? Thanks.

    Read the article

  • Returning the value of an identity column during/after INSERT command

    - by Adam Kane
    Using VS 2010, with ASP.NET, and .NET 3.0, and C#... When I use a System.Web.UI.WebControls.SqlDataSource and call its Insert() method to insert a new row, and that table has an identity column, I'd like my method to return the value of that column. For example, in my SQL 2005 table, I've got: Customer.Id Customer.FirstName Customer.LastName Where Customer.Id is an identity colum. When I call my method InsertNewCustomerRecord( "John", "Smith" ), I'd like to be able to return the Customer.Id that gets automatically generated in the database. Sorry for such a roughly posed question. Let me know if I can add better detail. Thanks.

    Read the article

  • Using TextWraping within a TextBox, inside a Grid for use within a ListBox in WP7

    - by Adam Goodchild
    I am trying to get my data to display properly within a GridLayout, which is to be used as a DataTemplate for an Item within ListBox. Here is the code associated with what I am doing: <Grid Name="FeedItemTemplate"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Image Source="{Binding ProfileImage}" Grid.RowSpan="2" Height="75" Width="75" VerticalAlignment="Center" Margin="1" /> <TextBlock Text="{Binding UserName}" Grid.Column="1" Foreground="#FFC8AB14" FontSize="28" HorizontalAlignment="Left"/> <TextBlock Text="{Binding TimeStamp}" Grid.Column="2" TextWrapping="Wrap" FontSize="18" HorizontalAlignment="Center"/> <TextBlock Text="{Binding Message}" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" TextWrapping="Wrap" FontSize="24" /> </Grid> The issue is that using this layout, when TextWrapping is set to Wrap, the Item is displayed correctly, but when scrolling through the ListBox everything is really jittery, you cannot scroll in small increments, and it just jumps all over the place. Any reason why it does this? As I said, only when TextWrapping is set to Wrap it does this. When its not used, it scrolls fine, but the text is all along one line and off the screen.

    Read the article

  • twitter bootstrap typeahead 2.0.4 ajax error

    - by Adam Levitt
    I have the following code which definitely returns a proper data result if I use the 2.0.0 version, but for some reason bootstrap's typeahead plugin is giving me an error. I pasted it below the code sample: <input id="test" type="text" /> $('#test').typeahead({ source: function(typeahead, query) { return $.post('/Profile/searchFor', { query: query }, function(data) { return typeahead.process(data); }); } }); When I run this example I'm getting a jQuery bug that says the following: ** item is undefined matcher(item=undefined)bootst...head.js (line 104) <br/>(?)(item=undefined)bootst...head.js (line 91) <br/>f(a=function(), b=function(), c=false)jquery....min.js (line 2) <br/>lookup(event=undefined)bootst...head.js (line 90) <br/>keyup(e=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, more...})bootst...head.js (line 198) <br/>f()jquery....min.js (line 2) <br/>add(c=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, <br/>more...})jquery....min.js (line 3) <br/>add(a=keyup charCode=0, keyCode=70)jquery....min.js (line 3) <br/>[Break On This Error] <br/>return item.toLowerCase().indexOf(this.query.toLowerCase())** Any thoughts? ... The same code works in the 2.0.0 version of the plugin, but fails to write to my knockout object model.

    Read the article

  • Setting up Eloquent relationships in Laravel for existing InnoDB relationships

    - by adam
    I have an initial migration that sets up two tables (users and projects), with a relationship (innoDB). $table->foreign('user_id')->references('id')->on('users'); I have two Eloquent models set up, blank except for the relationship: return $this->has_many('Project'); Do i definitely need to tell eloquent about the relationship in the models and the database? I'd assumed something as comprehensive as Laravel would infer it from the Schema? Is there something I'm missing?

    Read the article

  • TFS Template Customization - SharePointPortal site

    - by Adam Jenkin
    I am customizing a Process Template for TFS2008. I am using the "MSF for Agile... v4.2" template as the base template and would like to set the version control settings of the "Project Management" document library todo the following: Major Versions : Enabled Documents must be checked our before they can be edited I'm using the editor GUI provided by the tfs powertools, however it does not appear these settings are available. Is it possible to define these settings in the WssTasks.XML file or do I need to approach this from a different angle.

    Read the article

  • Multi page ordering form php or ajax

    - by Adam
    I'm looking to create a multi page ordering form the first page would contain some dropdown and text fields, the second page would contain more text fields, the third page would be an order summery with paypal payment option. I'm just wondering what the best way to create this order form is. I've used sessions in the past but never with users entering in text and picking items from drop downs, does anyone have any resources for doing this? Or does anyone know of a jquery or other ajax example or plugin I might be able to use and modify. any insight would be a big help. thanks

    Read the article

  • Rotate webpage via code?

    - by Adam Davis
    I'm hoping that there's a relatively simple way to rotate a webpage a little bit, 30 degrees or so, while still leaving it fully functional and usable. I completely control the page, and can modify it to make this easier if needed. I'd rather not re-write the whole thing in SVG, though, but perhaps javascript and canvas will work? Is there a way using CSS, Javascript, or some other cross browser method that would allow me to accomplish this?

    Read the article

  • Create new field in a table that already exists - flex/air sqlite?

    - by Adam
    I've got a flex/air app I've been working on, it uses a local sqlite database that is created on the initial application start. I've added some features to the application and in the process I had to add a new field to one of the database tables. My questions is how to I go about getting the application to create one new field that is located in a table that already exists? this is a the line that creates the table stmt.text = "CREATE TABLE IF NOT EXISTS tbl_status ("+"status_id INTEGER PRIMARY KEY AUTOINCREMENT,"+" status_status TEXT)"; And now I'd like to add a status_default field. thanks! Thanks - MPelletier I've add the code you provided and it does add the field, but now the next time I restart my app I get an error - 'status_default' already exists'. So how can I go about adding some sort of a IF NOT EXISTS statement to the line you provided?

    Read the article

  • glitchy stuttery iphone game loop

    - by Adam
    This is a problem I've been trying to solve for a few days now, and I've looked at the various solutions on stackoverflow and nothing has really seemed to work for me. I'm making an iPhone game with OpenGLES graphics and accelerometer input, at this point it's very simple, but the rendering is already pretty bad... it stutters and seems to jump back or forward in time. It doesn't happen a lot, but it happens enough to be a problem. I mean, who wants to play a game where a bullet gets magically transported into the player, and then it's game over? No one. I've tried using NSTimer for the game loop, I've tried using a separate thread (with a frame rate and continuously) I've tried using different frame rates, from 30FPS to 60FPS (It seems to have a max frame rate around 45FPS, but no problems at 30FPS) I've tried using timeIntervalSince1970 and CFGetAbsoluteTime to measure loop time, with no noticeable diffence Anyone have any ideas on what is the best way to get this looking better? One of the posts I've read suggested running the simulation at a fixed frame rate and then just render as fast as possible, does that seem like a good idea?

    Read the article

  • Incremental Backups / Versioned backups using PHP

    - by Adam
    I'm trying to backup a folder containing several folders and files to a remote location (will be uploading zipped files). Is there any existing scripts that may help me, which checks if the files have been modified after the date of the last backup, and only backs up files created / modified after that? The current size of the data is around 1gb, and I expect adding 50mb-200mb each month Also, what would be the best way to extract the state of the files on a specific date?

    Read the article

  • Code Golf: Finite-state machine!

    - by Adam Matan
    Finite state machine A deterministic finite state machine is a simple computation model, widely used as an introduction to automata theory in basic CS courses. It is a simple model, equivalent to regular expression, which determines of a certain input string is Accepted or Rejected. Leaving some formalities aside, A run of a finite state machine is composed of: alphabet, a set of characters. states, usually visualized as circles. One of the states must be the start state. Some of the states might be accepting, usually visualized as double circles. transitions, usually visualized as directed arches between states, are directed links between states associated with an alphabet letter. input string, a list of alphabet characters. A run on the machine begins at the starting state. Each letter of the input string is read; If there is a transition between the current state and another state which corresponds to the letter, the current state is changed to the new state. After the last letter was read, if the current state is an accepting state, the input string is accepted. If the last state was not an accepting state, or a letter had no corresponding arch from a state during the run, the input string is rejected. Note: This short descruption is far from being a full, formal definition of a FSM; Wikipedia's fine article is a great introduction to the subject. Example For example, the following machine tells if a binary number, read from left to right, has an even number of 0s: The alphabet is the set {0,1}. The states are S1 and S2. The transitions are (S1, 0) -> S2, (S1, 1) -> S1, (S2, 0) -> S1 and (S2, 1) -> S2. The input string is any binary number, including an empty string. The rules: Implement a FSM in a language of your choice. Input The FSM should accept the following input: <States> List of state, separated by space mark. The first state in the list is the start state. Accepting states begin with a capital letter. <transitions> One or more lines. Each line is a three-tuple: origin state, letter, destination state) <input word> Zero or more characters, followed by a newline. For example, the aforementioned machine with 1001010 as an input string, would be written as: S1 s2 S1 0 s2 S1 1 S1 s2 0 S1 s2 1 s2 1001010 Output The FSM's run, written as <State> <letter> -> <state>, followed by the final state. The output for the example input would be: S1 1 -> S1 S1 0 -> s2 s2 0 -> S1 S1 1 -> S1 S1 0 -> s2 s2 1 -> s2 s2 0 -> S1 ACCEPT For the empty input '': S1 ACCEPT For 101: S1 1 -> S1 S1 0 -> s2 s2 1 -> s2 REJECT For '10X': S1 1 -> S1 S1 0 -> s2 s2 X REJECT Prize A nice bounty will be given to the most elegant and short solution. Reference implementation A reference Python implementation will be published soon.

    Read the article

  • Objective-C: How to create a method that will return a UInt8 array from an int

    - by Adam
    I need to create an Objective-C method that converts an int into a byte array. In this instance, I can't use NSArray as a return type, it must be an UInt8 array. I've written a simple method to do this, but it has errors during compile and tells me that I have incompatible return types. Here is the code snippet. Any ideas? - (UInt8[])ConvertToBytes:(int) i { UInt8 *retVal[4]; retVal[0] = i >> 24; retVal[1] = i >> 16; retVal[2] = i >> 8; retVal[3] = i >> 0; return retVal; }

    Read the article

  • UITableView, force to snap to whole UITableViewCell at top of table

    - by Adam Eberbach
    I have a need to make a UITableView only display whole cells at the top of the cell, so when the table is moved or scrolled it should animate to make a whole cell visible at the top of the table if it has happened to stop with a cell partially off the top. This can be easily done using visibleCells and scrollToRowAtIndexPath methods of UITableView, BUT the cell should not always scroll down to move the partial cell into view - if the cell at top is more than 50% gone it should go completely with the next cell (i.e. index 1 in the array returned by visibleCells) moving to the top of the table. I've tried a few things to make this happen but I don't think I am understanding the way frame and bounds work between a UITableView and its UITableViewCells. Any help?

    Read the article

  • Set query FROM table using report parameter in BIRT

    - by Adam
    Hi, I am using the BIRT report writer, and I have multiple tables with the same data structure. In my report design, I want to select the table my query uses as a report parameter (as part of a mysql query in the data set) -- but I can't figure it out. When I create the data set, it's great that I can use parameters in the form of SELECT * FROM WHERE ?, and set these to report parameters, but I get an error if I set the ? to the table, such as: SELECT * FROM ? WHERE 1 Is there another way I can do this? As it's java, I assume the syntax follows that of a PreparedStatement. In BIRT 2.5 there is a property binding option under the data set dialog... and I've tried setting my query as: "SELECT * FROM "+params["DataTable"].value+" WHERE 1", but that was also results in an error.

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >