Search Results

Search found 2965 results on 119 pages for 'bill james'.

Page 77/119 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • What's the difference between these two calls to a function taking a collection of structural types?

    - by James Moore
    Why does the call to fn(Iterator("foo") compile, but the call to fn(fooIterator) fail with an error "type mismatch; found : Iterator[java.lang.String] required: scala.Iterator[com.banshee.Qx.HasLength]" object Qx { type HasLength = {def length: Int} def fn(xs: Iterator[HasLength]) = 3 var tn = fn(Iterator("foo")) var fooIterator = Iterator("foo") var tnFails = fn(fooIterator) //doesn't compile } Aren't they the same thing?

    Read the article

  • Using EhCache for session.createCriteria(...).list()

    - by James Smith
    I'm benchmarking the performance gains from using a 2nd level cache in Hibernate (enabling EhCache), but it doesn't seem to improve performance. In fact, the time to perform the query slightly increases. The query is: session.createCriteria(MyEntity.class).list(); The entity is: @Entity @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class MyEntity { @Id @GeneratedValue private long id; @Column(length=5000) private String data; //---SNIP getters and setters--- } My hibernate.cfg.xml is: <!-- all the normal stuff to get it to connect & map the entities plus:--> <property name="hibernate.cache.region.factory_class"> net.sf.ehcache.hibernate.EhCacheRegionFactory </property> The MyEntity table contains about 2000 rows. The problem is that before adding in the cache, the query above to list all entities took an average of 65 ms. After the cache, they take an average of 74 ms. Is there something I'm missing? Is there something extra that needs to be done that will increase performance?

    Read the article

  • C++ Builder 2010 Exception Dead Lock ???

    - by James
    Hello Is this some kind of exception dead lock i am facing? How to avoid it ? Have a look at below line where i have TIdContext objects of connected clients stored in an objlist and at times i need to process it. But if one user is disconnected while another thread is processing the list, then for that freed TIdContext-Data object I am getting Access voilation, Ok its fine i am using try/catch but problem is that at below line there is some kind of dead lock and process hangs , if i attach a debuger it show Access voilation Again and Again and Again, and cpu coonsumption goes up because of that exception dead lock. AnsiString UserID = ((Tmyobject*) ((TIdContext*) ObjList->Objects[i])->Data)->UserID; i know i can check before accessing the object, if object is not Null, It works.. But my question is what if once in a blue moon the Data object is freed at the point when NULL check is performed and on next line when again i am accessing the object i get same dead lock ??? So how to avoid/handle this dead lock exception ? Here is the call stack... :005F07C0 System::AnsiStringBase::AnsiStringBase(this=:0285FCE0, src=????) :0040223F System::AnsiStringT<0>::AnsiStringT<0>(this=:0285FCE0, src=:00000008) :00457996 TSomeClass::SomeFunction(this=:009D8230, UserID={ }, DataSize={ }, ) :0047BFF1 __linkproc__ ThreadProc(Thread=:009561C0) :004AD00E __linkproc__ ThreadWrapper(Parameter=:009EAA30) :7c80b729 ; C:\WINDOWS\system32\kernel32.dll Please helppppppppppppppppppppp Thanks

    Read the article

  • Abnormally disconnected TCP sockets and write timeout

    - by James
    Hello I will try to explain the problem in shortest possible words. I am using c++ builder 2010. I am using TIdTCPServer and sending voice packets to a list of connected clients. Everything works ok untill any client is disconnected abnormally, For example power failure etc. I can reproduce similar disconnect by cutting the ethernet connection of a connected client. So now we have a disconnected socket but as you know it is not yet detected at server side so server will continue to try to send data to that client too. But when server try to write data to that disconnected client ...... Write() or WriteLn() HANGS there in trying to write, It is like it is wating for somekind of Write timeout. This hangs the hole packet distribution process as a result creating a lag in data transmission to all other clients. After few seconds "Socket Connection Closed" Exception is raised and data flow continues. Here is the code try { EnterCriticalSection(&SlotListenersCriticalSection); for(int i=0;i<SlotListeners->Count;i++) { try { //Here the process will HANG for several seconds on a disconnected socket ((TIdContext*) SlotListeners->Objects[i])->Connection->IOHandler->WriteLn("Some DATA"); }catch(Exception &e) { SlotListeners->Delete(i); } } }__finally { LeaveCriticalSection(&SlotListenersCriticalSection); } Ok i already have a keep alive mechanism which disconnect the socket after n seconds of inactivity. But as you can imagine, still this mechnism cant sync exactly with this braodcasting loop because this braodcasting loop is running almost all the time. So is there any Write timeouts i can specify may be through iohandler or something ? I have seen many many threads about "Detecting disconnected tcp socket" but my problem is little different, i need to avoid that hangup for few seconds during the write attempt. So is there any solution ? Or should i consider using some different mechanism for such data broadcasting for example the broadcasting loop put the data packet in some kind of FIFO buffer and client threads continuously check for available data and pick and deliver it to themselves ? This way if one thread hangs it will not stop/delay the over all distribution thread. Any ideas please ? Thanks for your time and help. Regards Jams

    Read the article

  • While using ConcurrentQueue, trying to dequeue while looping through in parallel

    - by James Black
    I am using the parallel data structures in my .NET 4 application and I have a ConcurrentQueue that gets added to while I am processing through it. I want to do something like: personqueue.AsParallel().WithDegreeOfParallelism(20).ForAll(i => ... ); as I make database calls to save the data, so I am limiting the number of concurrent threads. But, I expect that the ForAll isn't going to dequeue, and I am concerned about just doing ForAll(i => { personqueue.personqueue.TryDequeue(...); ... }); as there is no guarantee that I am popping off the correct one. So, how can I iterate through the collection and dequeue, in a parallel fashion. Or, would it be better to use PLINQ to do this processing, in parallel?

    Read the article

  • Adding a Line Break in mySQL INSERT INTO text

    - by james
    Hi Could someone tell me how to add a new line in a text that i enter in a mySql table. I tried using the '\n in the line i entered with INSERT INTO statement but '\n is shown as it is. Actually i have created a table in Ms Access with some data. Ms Access adds new line with '\n. I am converting Ms Access table data into mySql . But when i convert, the '\n is ignored and all the text is shown in one single line when i display it from mySql table on a php form. Can anyone tell me how mySQL can add a new line in a text ? Awaiting response Thanks !!

    Read the article

  • CFPreferences for another (or all) users

    - by James Turner
    I'm working on a background service which needs to ask several users' iTunes settings (the users will opt-in via a helper application which they run from their login). Is there an easy way to read the preferences for another user, than the current one, using CFPreferences? The docs, for example for CFPreferencesCopyValue, explicitly state: 'Do not use arbitrary user and host names, instead pass the pre-defined domain qualifier constants.', when passing the 'userName' argument to the various functions.

    Read the article

  • acts-as-taggable-on: find tags with name LIKE, sort by tag_counts?

    - by James
    Hi I'm using the rails plugin acts-as-taggable-onand I'm trying to find the top 5 most used tags whose names match and partially match a given query. When I do User.skill_counts.order('count DESC').limit(5).where('name LIKE ?', params[:query]) This return the following error: ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: name: SELECT tags.*, COUNT(*) AS count FROM "tags" INNER JOIN users ON users.id = taggings.taggable_id LEFT OUTER JOIN taggings ON tags.id = taggings.tag_id AND taggings.context = 'skills' WHERE (taggings.taggable_type = 'User') AND (taggings.taggable_id IN(SELECT users.id FROM "users")) AND (name LIKE 'asd') GROUP BY tags.id, tags.name HAVING COUNT(*) > 0 ORDER BY count DESC LIMIT 5 But when I do User.skill_counts.first.name this returns "alliteration" I'd appreciate any help on this matter.

    Read the article

  • How can I redirect directory using htaccess including files with spaces in the names

    - by James
    Hi, I am dealing with a situation where someone has handed me a bunch of old files on the server which already have a lot of incoming links directly to them (mostly pdf files). I now have the files organized but in a different directory. Before it was 'domain/manuals/file' now it is 'domain/media/manual/file'. I am trying to resolve this issue using an htaccess file. Many of the files have spaces in the names (not something I can control) and because they already have links to them I can't just go through renaming them. I have found that I can redirect files individually when they have spaces in the names by using quotes such as: redirect 301 "/manuals/file 123.pdf" "http://www.domain.com/manuals/file 123.pdf" However, there are loads of these files and I wondered if there is a way to create a regular expression that will handle spaces in file names that I could use to redirect the entire directory. I should add that some files contain decent file names with no spaces in, some have one space and others more than one space. It's not pretty. If you've encountered this problem before I would really appreciate hearing your advice, I'm running out of ideas. Thanks.

    Read the article

  • Searching algorithmics: Parsing and processing a request

    - by James P.
    Say you were to create a search engine that can accept a query statement under the form of a String. The statement can be used to retrieve different types of objects with a given set of characteristics and possibly linked to other objects. In plain english or pseudo-code using an OOP approach, how would you go about parsing and processing statements as follows to get the series of desired objects ? get fruit with colour green get variety of apples, pears from Andy get strawberry with colour "deep red" and origin not Spain get total of sales of melons between 2010-10-10 and 2010-12-30 get last deliverydate of bananas from "Pete" and state not sold Hope the question is clear. If not I'll be more than happy to reformulate. P.S: This isn't homework ;)

    Read the article

  • What is a good generic sibling control Javascript communication strategy?

    - by James
    I'm building a webpage that is composed of several controls, and trying to come up with an effective somewhat generic client side sibling control communication model. One of the controls is the menu control. Whenever an item is clicked in here I wanted to expose a custom client side event that other controls can subscribe to, so that I can achieve a loosely coupled sibling control communication model. To that end I've created a simple Javascript event collection class (code below) that acts as like a hub for control event registration and event subscription. This code certainly gets the job done, but my question is is there a better more elegant way to do this in terms of best practices or tools, or is this just a fools errand? /// Event collection object - acts as the hub for control communication. function ClientEventCollection() { this.ClientEvents = {}; this.RegisterEvent = _RegisterEvent; this.AttachToEvent = _AttachToEvent; this.FireEvent = _FireEvent; function _RegisterEvent(eventKey) { if (!this.ClientEvents[eventKey]) this.ClientEvents[eventKey] = []; } function _AttachToEvent(eventKey, handlerFunc) { if (this.ClientEvents[eventKey]) this.ClientEvents[eventKey][this.ClientEvents[eventKey].length] = handlerFunc; } function _FireEvent(eventKey, triggerId, contextData ) { if (this.ClientEvents[eventKey]) { for (var i = 0; i < this.ClientEvents[eventKey].length; i++) { var fn = this.ClientEvents[eventKey][i]; if (fn) fn(triggerId, contextData); } } } } // load new collection instance. var myClientEvents = new bsdClientEventCollection(); // register events specific to the control that owns it, this will be emitted by each respective control. myClientEvents.RegisterEvent("menu-item-clicked"); Here is the part where this code above is consumed by source and subscriber controls. // menu control $(document).ready(function() { $(".menu > a").click( function(event) { //event.preventDefault(); myClientEvents.FireEvent("menu-item-clicked", $(this).attr("id"), null); }); }); <div style="float: left;" class="menu"> <a id="1" href="#">Menu Item1</a><br /> <a id="2" href="#">Menu Item2</a><br /> <a id="3" href="#">Menu Item3</a><br /> <a id="4" href="#">Menu Item4</a><br /> </div> // event subscriber control $(document).ready(function() { myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged); myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged2); myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged3); }); function menuItemChanged(id, contextData) { alert('menuItemChanged ' + id); } function menuItemChanged2(id, contextData) { alert('menuItemChanged2 ' + id); } function menuItemChanged3(id, contextData) { alert('menuItemChanged3 ' + id); }

    Read the article

  • Blackberry RichTextField preferred height during layout

    - by James Veenstra
    This is using the Backberry JDK (5.0 if needed). I have a custom Manager that contains a RichTextField. I want the height of the field to vary by the amount of text in the RichTextField. The sublayout code looks like this (rtf is a RichTextField object): protected void sublayout(int width, int height) { int h = rtf.getPreferredHeight(); setExtent(Display.getWidth(), h); layoutChild(rtf, Display.getWidth(), h); setPositionChild(rtf, 0, 0); setExtent(Display.getWidth(), h); } The call to rtf.getPreferredHeight always returns the same value, no matter how much text (and therefore how many lines on the screen). Any clues on how to get the height of a RichTextField when the content and width are known?

    Read the article

  • Iphone: controlling text with delay problem with UIWebView

    - by James B.
    Hi, I've opted to use UIWebView so I can control the layout of text I've got contained in a local html document in my bundle. I want the text to display within a UIWebView I've got contained within my view. So the text isn't the whole view, just part of it. Everything runs fine, but when the web page loads I get a blank screen for a second before the text appears. This looks really bad. can anyone give me an example of how to stop this happening? I'm assuming I have to somehow hide the web view until it has fully loaded? Could someone one tell me how to do this? At the moment I'm calling my code through the viewDidLoad like this: [myUIWebView loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"localwebpage" ofType:@"html"] isDirectory:NO]]]; Any help is much appreciated. I've read round a few forums and not seen a good answer to this question, and it seems like it recurs a lot as an issue for beginners like myself. Thanks for taking the time to read this post! UPDATED info Thanks for your response. The suggestions below solves the problem but creates a new one for me as now when my view loads it is totally hidden until I click on my toggle switch. to understand this it's maybe most helpful if I post all my code. Before this though let me explain the setup of my view. I've got a standard view within which I've also got two web views, one on top of the other. each web view contains different text with different styling. the user flicks between views using a toggle switch, which hides/reveals the web views. I'm using the web views because I want to control the style/layout of the text. Below is my full .m code, I can't figure out where it's going wrong. My web views are called oxford & harvard I'm sure its something to do with how/when I'm hiding/revealing views. I've played around with this but can't seem to get it right. Maybe my approach is wrong. A bit of advice ironing this out would be really appreciated: @implementation ReferenceViewController @synthesize oxford; @synthesize harvard; // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; [oxford loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Oxford" ofType:@"html"] isDirectory:NO]]]; [harvard loadRequest: [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"Harvard" ofType:@"html"] isDirectory:NO]]]; [oxford setHidden:YES]; [harvard setHidden:YES]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { if([webView hidden]) { [oxford setHidden:NO]; [harvard setHidden:NO]; } } //Toggle controls for toggle switch in UIView to swap between webviews - (IBAction)toggleControls:(id)sender { if ([sender selectedSegmentIndex] == kSwitchesSegmentIndex) { oxford.hidden = NO; harvard.hidden = YES; } else { oxford.hidden = YES; harvard.hidden = NO; } } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; [oxford release]; [harvard release]; } @end

    Read the article

  • Ship maritime AIS information API

    - by James Cadd
    Is there an API or Web Service that can be used to read AIS data? Most links I read starting at Wikipedia (http://en.wikipedia.org/wiki/Automatic_Identification_System) say that AIS data is freely available but I'm having a hard time finding a provider of the data. A C# example or language agnostic web service would be helpful.

    Read the article

  • ASP.NET - Accessing copied content

    - by James Kolpack
    I have a class library project which contains some content files configured with the "Copy if newer" copy build action. This results in the files being copied to a folder under ...\bin\ for every project in the solution. In this same solution, I've got a ASP.NET web project (which is MVC, by the way). In the library I have a static constructor load the files into data structures accessible by the web project. Previously I've been including the content as an embedded resource. I now need to be able to replace them without recompiling. I want to access the data in three different contexts: Unit testing the library assembly Debugging the web application Hosting the site in IIS For unit testing, Environment.CurrentDirectory points to a path containing the copied content. When debugging however, it points to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. I've also looked at Assembly.GetExecutingAssembly().Location which points to C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\c44f9da4\9238ccc\assembly\dl3\eb4c23b4\9bd39460_f7d4ca01\. What I need is to the physical location of the webroot \bin folder, but since I'm in a static constructor in the library project, I don't have access to a Request.PhysicalApplicationPath. Is there some other environment variable or structure where I can always find my "Copy if newer" files?

    Read the article

  • Versioning CommonAssemblyInfo.cs and MSBuild

    - by James Thigpen
    So I have a CommonAssemblyInfo.cs linked into all the projects in my solution and is dynamically generated by my rake/albacore scripts which is not checked into source control. I also have a CommonAssemblyInfo.cs.local for use when there is no ruby available, mainly to be used by devs. Is it possible to have a msbuild task or something that runs before any of the other project compilation that will copy CommonAssemblyInfo.cs.local to CommonAssemblyInfo.cs before trying to compile my solution? I hate having to have a command you have to just know about and type in order to open and buidl the solution in Visual Studio.

    Read the article

  • "Intercepting" user input into text box and removing it

    - by James P
    I have a text box that I would like to do some validation on. At the moment I have this code: function updateChanger() { // Validate input var likeMessage = validateInput($("#like").val()); alert(likeMessage); } function validateInput(input) { input = input.replace(/[^a-zA-Z0-9:\(\/\)\s\.,!~]/g, ""); return input; } This successfully trims out unwanted characters in the likeMessage variable, but the character still gets entered into the text box. I would like to stop that from happening. I know it will have something to do with $("#like").val() but the only thing I can think of is just chopping off the end character from the text box value, would this suffice? Thanks for any help!

    Read the article

  • ReWriteRule is redirecting rather rewriting

    - by James Doc
    At the moment I have two machines that I do web development on; an iMac for work at the office and a MacBook for when I have to work on the move. They both running OS X 10.6 have the same version of PHP, Apache, etc running on them. Both computers have the same files of the website, including the .htaccess file (see below). On the MacBook the URLs are rewritten nicely, masking the URL they are pointing to (eg site/page/page-name), however on the iMac they simply redirect to the page (eg site/index.php?method=page&value=page-name) which is making switching back and forth between machines a bit of a pain! I'm sure it must be a config setting somewhere, but I can't for the life of me find it. Has anyone got a remedy? Many thanks. I'm fairly convinced there is a much nice way of writing this htaccess file without loosing access several key folders as well! Options +FollowSymlinks RewriteEngine on RewriteBase /In%20Progress/Vila%20Maninga/ RewriteRule ^page/([a-z|0-9_&;=-]+) index.php?method=page&value=$1 [NC] RewriteRule ^tag/([a-z|0-9_]+) index.php?method=tag&value=$1 [NC] RewriteRule ^search/([a-z|0-9_"]+) index.php?method=search&value=$1 [NC] RewriteRule ^modpage/([con0-9-]+) index.php?method=modpage&value=$1 [NC] RewriteRule ^login index.php?method=login [NC] RewriteRule ^logout index.php?method=logout [NC] RewriteRule ^useraccounts index.php?method=useraccounts [NC]

    Read the article

  • Visual C++: Invalid allocation size. How to force the debugger to stop on this message?

    - by James Roth
    The MFC program I am debugging is printing this message in the "Output" window in Visual Studio 9.0: HEAP[AppName.exe]: Invalid allocation size - 99999998 (exceeded 7ffdefff) I'm pretty sure this is due to a bad "new", uninitialized variable or similar error. The question is: how do I get the debugger to stop on this message so that I can view the stack trace and solve the problem?

    Read the article

  • Using virtual fields in Doctrine_Query

    - by James Maroney
    Is there a way to insert logic based on virtual fields into a Doctrine_Query? I have defined a virtual field in my model, "getStatus()" which I would ultimately like to utilize in a Where clause in my Doctrine_Query. ... ->AndWhere('x.status = ?',$status); "status", however, is not a column in the table it is instead computed by business logic in the model. Filtering the Collection after executing the query works in some situations, but not when a Doctrine_Pager is thrown in the mix, as it computes it's offsets and such before you have access to the Collection. Am I best off ditching Doctrine_Pager and rebuilding that functionality after modifying the Doctrine_Collection?

    Read the article

  • chdir programmatically

    - by james owen
    Friday, March 12, 2010 1:18 pm. In windows -- and probably unix for that matter -- using the chdir() function in a (32-bit) program doesn't change the directory when the program exits. (It does in a 16-bit windows program.) Does anybody know how to do that in a windows 32-bit program?

    Read the article

  • How do I DRY up business logic between sever-side Ruby and client-side Javascript?

    - by James A. Rosen
    I have a Widget model with inheritance (I'm using Single-Table Inheritance, but it's equally valid for Class-per-Table). Some of the subclasses require a particular field; others do not. class Widget < ActiveRecord ALL_WIDGET_TYPES = [FooWidget, BarWidget, BazWidget] end class FooWidget < Widget validates_presence_of :color end class BarWidget < Widget # no color field end class BazWidget < Widget validates_presence_of :color end I'm building a "New Widget" form (app/views/widgets/new.html.erb) and would like to dynamically show/hide the color field based on a <select> for widget_type. <% form_for @widget do |f| %> <%= f.select :type, Widget::ALL_WIDGET_TYPES %> <div class='hiddenUnlessWidgetTypeIsFooOrBaz'> <%= f.label :color %> <%= f.text_field :color %> </div> <% end %> I can easily write some jQuery to watch for onChange events on widget_type, but that would mean putting some sort of WidgetTypesThatRequireColor constant in my Javascript. Easy enough to do manually, but it is likely to get disconnected from the Widget model classes. I would prefer not to output Javascript directly in my view, though I have considered using content_for(:js) and have a yield :js in my template footer. Any better ideas?

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >