Search Results

Search found 1799 results on 72 pages for 'tim joseph'.

Page 60/72 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • Why does this simple bash code give a syntax error?

    - by Tim
    I have the following bash code, which is copied and pasted from "bash cookbook" (1st edition): #!/bin/bash VERBOSE=0; if [[ $1 =-v ]] then VERBOSE=1; shift; fi When I run this (bash 4.0.33), I get the following syntax error: ./test.sh: line 4: conditional binary operator expected ./test.sh: line 4: syntax error near `=-v' ./test.sh: line 4: `if [[ $1 =-v ]]' Is this as simple as a misprint in the bash cookbook, or is there a version incompatibility or something else here? What would the most obvious fix be? I've tried various combinations of changing the operator, but I'm not really familiar with bash scripting.

    Read the article

  • jQuery - Drag of elements in areas - then not draggable any more

    - by Tim
    Hello! I have three div areas. Creating an element, which is draggable() with jQuery UI, I can drag it all over the screen. Dropping it in a special area, then I can not drag it any more. I created a full working demo: http://jsbin.com/enusu4/2/ There you can create a draggable element which is placed into the left green area. Dragging it to the middle or right green area, I can not drag the element. I increment the zIndex of the elements, but it does not work. Does anyone can help me, what's wrong? Best Regards.

    Read the article

  • Client Server Assembly Missing? Db4Objects 7.4

    - by Tim Jarvis
    I have downloaded the current version of Db4Objects (7.4) and installed it. It appears to be missing the Client Server assembly Db4objects.Db4o.CS.dll Does anyone know if Client Server has changed with this version? If it has, does anyone have some details about creating a simple Server?

    Read the article

  • JavaScript sorting array from nested array?

    - by Tim
    I have an array: letterFrequency = [["a", 12], ["b", 25], ["c", 34], ["d", 1], ["e", 35], ["f", 8], ["g", 7], ["h", 67], ["i", 35], ["j", 0], ["k", 53], ["l", 0], ["m", 0], ["n", 3], ["o", 0], ["p", 0], ["q", 3], ["r", 153], ["s", 0], ["t", 0], ["u", 15], ["v", 0], ["w", 0], ["x", 3], ["y", 0], ["z", 0]] and I want to sort it in descending order based on the number within the nested array i.e. letterFrequency[i][1]. So I want the most popular letter to be first. How would I do this?

    Read the article

  • Visual C++ application/libarary size anomoly

    - by Tim Ring
    This is just a bit of a general question regading app/lib file sizes. When I build a particular library in my C++ solution I notice that the .lib file size is larger in the release build than in the debug (1.2mb Vs 800k). However when I build an app in the same solution, using the aforementioned library, the release .exe is always smaller (as I'd expect) than thew debug .exe (50k vs 200k). I would always have expected the release verisons of anything to be smaller than the debug versions. What gives?

    Read the article

  • C++ Euler-Problem 14 Program Freezing

    - by Tim
    I'm working on Euler Problem 14: http://projecteuler.net/index.php?section=problems&id=14 I figured the best way would be to create a vector of numbers that kept track of how big the series was for that number... for example from 5 there are 6 steps to 1, so if ever reach the number 5 in a series, I know I have 6 steps to go and I have no need to calculate those steps. With this idea I coded up the following: #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { vector<int> sizes(1); sizes.push_back(1); sizes.push_back(2); int series, largest = 0, j; for (int i = 3; i <= 1000000; i++) { series = 0; j = i; while (j > (sizes.size()-1)) { if (j%2) { j=(3*j+1)/2; series+=2; } else { j=j/2; series++; } } series+=sizes[j]; sizes.push_back(series); if (series>largest) largest=series; cout << setw(7) << right << i << "::" << setw(5) << right << series << endl; } cout << largest << endl; return 0; } It seems to work relatively well for smaller numbers but this specific program stalls at the number 113382. Can anyone explain to me how I would go about figuring out why it freezes at this number? Is there some way I could modify my algorithim to be better? I realize that I am creating duplicates with the current way I'm doing it: for example, the series of 3 is 3,10,5,16,8,4,2,1. So I already figured out the sizes for 10,5,16,8,4,2,1 but I will duplicate those solutions later. Thanks for your help!

    Read the article

  • List content of tar file or a directory only down to some level

    - by Tim
    I wonder how to list content of tar file only down to some level? I understand "tar tvf mytar.tar" will list all files, but sometimes I wish I can just see directories down to some level. Similarly for command "ls" how to control the level of subdirectories that will be displayed? By default, it will only show the direct subdirectories, but not further. Thanks and regards

    Read the article

  • Connection to embedded device with Windows and .Net

    - by tim
    I am building a .net application(xp, vista, 7) that will communicate with an embedded device. I will be able to connect via IP, serial port and modem. Question: Should I allow some type of open connection within my application that will allow me to connect to the device through some other channels that may be set up in the operating system just to allow future extensibility without really having to change anything on the device? I was just imagining that the operating system would be able to serve all communication channels that may be setup through the operating system to the device. Like would an admin setup some channel through SMTP or other protocol. I just didn’t want to box myself in and ignore some more open architecture. Thanks.

    Read the article

  • Make an abstract class or use a processor?

    - by Tim Murphy
    I'm developing a class to compare two directories and run an action when a directory/file in the source directory does not exist in destination directory. Here is a prototype of the class: public abstract class IdenticalDirectories { private DirectoryInfo _sourceDirectory; private DirectoryInfo _destinationDirectory; protected abstract void DirectoryExists(DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory); protected abstract void DirectoryDoesNotExist(DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory); protected abstract void FileExists(DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory); protected abstract void FileDoesNotExist(DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory); public IdenticalDirectories(DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory) { ... } public void Run() { foreach (DirectoryInfo sourceSubDirectory in _sourceDirectory.GetDirectories()) { DirectoryInfo destinationSubDirectory = this.GetDestinationDirectoryInfo(subDirectory); if (destinationSubDirectory.Exists()) { this.DirectoryExists(sourceSubDirectory, destinationSubDirectory); } else { this.DirectoryDoesNotExist(sourceSubDirectory, destinationSubDirectory); } foreach (FileInfo sourceFile in sourceSubDirectory.GetFiles()) { FileInfo destinationFile = this.GetDestinationFileInfo(sourceFile); if (destinationFile.Exists()) { this.FileExists(sourceFile, destinationFile); } else { this.FileDoesNotExist(sourceFile, destinationFile); } } } } } The above prototype is an abstract class. I'm wondering if it would be better to make the class non-abstract and have the Run method receiver a processor? eg. public void Run(IIdenticalDirectoriesProcessor processor) { foreach (DirectoryInfo sourceSubDirectory in _sourceDirectory.GetDirectories()) { DirectoryInfo destinationSubDirectory = this.GetDestinationDirectoryInfo(subDirectory); if (destinationSubDirectory.Exists()) { processor.DirectoryExists(sourceSubDirectory, destinationSubDirectory); } else { processor.DirectoryDoesNotExist(sourceSubDirectory, destinationSubDirectory); } foreach (FileInfo sourceFile in sourceSubDirectory.GetFiles()) { FileInfo destinationFile = this.GetDestinationFileInfo(sourceFile); if (destinationFile.Exists()) { processor.FileExists(sourceFile, destinationFile); } else { processor.FileDoesNotExist(sourceFile, destinationFile); } } } } What do you see as the pros and cons of each implementation?

    Read the article

  • How can I use io.StringIO() with the csv module?

    - by Tim Pietzcker
    I tried to backport a Python 3 program to 2.7, and I'm stuck with a strange problem: >>> import io >>> import csv >>> output = io.StringIO() >>> output.write("Hello!") # Fail: io.StringIO expects Unicode Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unicode argument expected, got 'str' >>> output.write(u"Hello!") # This works as expected. 6L >>> writer = csv.writer(output) # Now let's try this with the csv module: >>> csvdata = [u"Hello", u"Goodbye"] # Look ma, all Unicode! (?) >>> writer.writerow(csvdata) # Sadly, no. Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unicode argument expected, got 'str' According to the docs, io.StringIO() returns an in-memory stream for Unicode text. It works correctly when I try and feed it a Unicode string manually. Why does it fail in conjunction with the csv module, even if all the strings being written are Unicode strings? Where does the str come from that causes the Exception? (I do know that I can use StringIO.StringIO() instead, but I'm wondering what's wrong with io.StringIO() in this scenario)

    Read the article

  • How do I build two different installers from the same script in inno?

    - by Tim
    I want to make a "standard" install for external use, but I also want to use the same script and tell it (with a command line param perhaps?) to include another set of files (PDB files for debugging) for our lab installations. How can I do this? Is it possible? I don't see how to set this in the [files] section. NOTE - this is not for having an option during the install. It is for static build time. I suppose it is just best to create a separate installer for the pdbs.

    Read the article

  • How do I rewrite a request by hostname unless it is a specified value?

    - by Tim
    My app will have a regular domain - let's say example.com - which will have information about logging in, signing up, etc. It will also host numerous other domains dynamically. My app serves the webpage for these at http://example.com/site/foobar.com/ So, I need to redirect all requests where the hostname is not example.com to /site/[hostname]/ I'm writing this in Django and hosting with Apache. How do I set up a rewrite rule to do this? The user must not know they are on any other site but foobar.com and if the user browses to foobar.com/something - the URL must be rewritten to /site/foobar.com/something

    Read the article

  • jquery/ajax load new content when available

    - by Tim
    I know this is quite a vague question -- sorry about that. If I have a forum, shoutbox or something similar where users enter and submit data, running on PHP and MySQL, what is the best way to have the newly submitted content automatically display on the page for all users when it is submitted? Much like a live newsfeed, if you like... The effect sort-of works here at stackoverflow, when you are answering a question you are told when new answer is submitted. I want to test for newly submitted content and then display it automatically. Any suggestions? Many thanks :)

    Read the article

  • How can I change the color of build output in a shell window?

    - by Tim Gradwell
    I have a build process which runs from a batch file. It produces a large volume of text. Sometimes it prints the word "Error" or "Warning" followed by a message. The errors and warnings are getting lost among a sea of text. Can I highlight those words in a different color, maybe in a dos window, or a cygwin shell window, possibly by piping them through some string manipulation program before posting them to the screen? Thanks.

    Read the article

  • How can a property resolve its own name and type with reflection?

    - by Tim Santeford
    Is there a way for a property to access its own name and type at runtime using reflection? I want to access this info without hard coding the name or index of the property in the class. Simple Example Code: Private ReadOnly Property MyProperyName() As String Get Console.WriteLine((Get Current Property Info).Type.ToString) Console.WriteLine((Get Current Property Info).Name) Return "" End Get End Property Expected output: System.String MyPropertyName

    Read the article

  • Convert DOMElement Array to jQuery Object

    - by Tim N
    I am using the DataTables plugin for jQuery and need to get one of the table rows. DataTables has a fnGetNodes function that returns an Array with all of the DOMElements of the table. I would like to use a jQuery selector to find that row (I know the id of the row), but I need to convert the Array to a jQuery Object, is this possible?

    Read the article

  • How do I choose what and when to cache data with ob_start rather than query the database?

    - by Tim Santeford
    I have a home page that has several independent dynamic parts. The parts consist of a list of recent news from the company, a site statistics panel, and the online status of certain employees. The recent news changes monthly, site statistics change daily, and online statuses change on a per minute bases. I would like to cache these panels so that the db is not hit on every page load. Is using ob_start() then ob_get_contents() to cache these parts to a file the correct way to do this or is there a better method in PHP5 for doing this? In asking this question I'm trying to answer these additional questions: How can I determine the correct approach for caching this data without doing extensive benchmarking? Does it make sense to cache these parts in different files and then join them together per requests or should I re-query the data and cache once per minute? I'm looking for a rule of thumb for planning pages and for situations where doing testing is not cost effective (The client is not paying enough for it I mean). Thanks!

    Read the article

  • Monotouch auto resizing views in iphone

    - by Tim Bassett
    I have created a view in interface builder that contains another view (content area) and a button bar at the bottom. The hierarchy is as: ->View --->mapContainer UIView ----->map MKMapView ----->OverlayView UIView --->ToolBar UIToolBar I would like the mapContainer to resize to full window when the ToolBar is hidden. I would like the map and the OverlayView to resize to the mapContainer size I have attempted the following code, but it has no effect. Please advise? public override void ViewDidLoad () { base.ViewDidLoad (); this.mapContainer.AutosizesSubviews = true ; this.View.AutosizesSubviews = true ; try { this.mapContainer.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth ; this.map.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth ; this.map.SizeToFit(); this.mapContainer.SizeToFit(); this.map.SizeToFit(); this.View.Frame = new System.Drawing.RectangleF(0,0,this.View.Frame.Width, this.View.Frame.Height ); this.mapContainer.LayoutSubviews(); } catch(Exception ex) { Console.Write(ex.ToString()); } }

    Read the article

  • Change Dll loaded with MEF

    - by Tim
    Hi all, I'm using MEF and the System.ComponentModel.Composition.dll to load some dll. I'm doing something like : AggregateCatalog catalog = new AggregateCatalog(new AssemblyCatalog(Assembly.GetExecutingAssembly()), new DirectoryCatalog(directory)); _container = new CompositionContainer(catalog); _container.ComposeParts(this); to import my dll. After some times, I would like to update my dll but if I try to delete it, I have an access denied, because it's alrealdy used by the program. How can I release the dll, replace with a new dll and load the dll again ? (without closing the program) Thanks in advance for your help

    Read the article

  • I built my rails app with sqlite and without specifying any db field sizes, Is my app now foobared for production?

    - by Tim Santeford
    I've been following a lot of good tutorials on building rails apps but I seem to be missing the whole specifying and validating db field sizes part. I love not needing to have to think about it when roughing out an app (I would have never done this with a PHP or ASP.net app). However, now that I'm ready to go to production, I think I might have done myself a disservice by not specifying field sizes as I went. My production db will be MySQL. What is the best practice here? Do I need to go through all of my migration files and specify sizes, update all the models with validation, and update all my form partial views with input max widths? or am I missing a critical step in my development process?

    Read the article

  • Java / Spring MVC 3 validation of an email address

    - by Tim
    I have a Java backend with Spring MVC and I am using validation in this way on my domain object for an email address: import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; ... @NotNull @Size(min = 1, max = 100) @Pattern(regexp="^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$") private String email; But all I get with these lines of code Set<ConstraintViolation<Person>> failures = validator.validate(personObject); ... Map<String, String> failureMessages = new HashMap<String, String>(); for (ConstraintViolation<Person> failure : failures) { failureMessages.put(failure.getPropertyPath().toString(), failure.getMessage()); System.out.println(failure.getPropertyPath().toString()+" - "+failure.getMessage()) } I get this on the console: email - must match "^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$" but I have as email address [email protected], so the regexp does not match. So I have two prolems: What's wrong here? And how can I define a error message on my own, because display this to the user, that is not a good thing :-) Thank you in advance for your help and Best Regards.

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >