Search Results

Search found 1958 results on 79 pages for 'tom wheeler'.

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

  • Evaluation of environment variables in command run by Java's Runtime.exec()

    - by Tom Duckering
    Hi, I have a scenarios where I have a Java "agent" that runs on a couple of platforms (specifically Windows, Solaris & AIX). I'd like to factor out the differences in filesystem structure by using environment variables in the command line I execute. As far as I can tell there is no way to get the Runtime.exec() method to resolve/evaluate any environment variables referenced in the command String (or array of Strings). I know that if push comes to shove I can write some code to pre-process the command String(s) and resolve enviroment variables by hand (using getEnv() etc). However I'm wondering if there is a smarter way to do this since I'm sure I'm not the only person wanting to do this and I'm sure there are pitfalls in "knocking up" my own implementation. Your guidance and suggestions are most welcome. edit: I would like to refer to environment variables in the command string using some consistent notation such as $VAR and/or %VAR%. Not fussed which. edit: To be clear I'd like to be able to execute a command such as: perl $SCRIPT_ROOT/somePerlScript.pl args on Windows and Unix hosts using Runtime.exec(). I specify the command in config file that describes a list of jobs to run and it has to be able to work cross platform, hence my thought that an environment variable would be useful to factor out the filesystem differences (/home/username/scripts vs C:\foo\scripts). Hope that helps clarify it. Thanks. Tom

    Read the article

  • How do I perform an HSL transform on a texture?

    - by Mason Wheeler
    If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look? I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and saturation and lightness multipliers between 0 and 2, and then have it call a shader that will apply these transformations to the texture before it renders. The interface would look something like this: procedure HSLTransform(texture: GLuint; hShift: integer; sMult, lMult: GLfloat); I have no idea what's supposed to go inside the routine, though. I understand the basic math involved in HSL/RGB conversions, but I don't know how to write a shader or how to apply it. Can someone point me in the right direction? Delphi examples preferred, but I can also read C if I have to.

    Read the article

  • Flex service in debug

    - by Tom
    Hello everybody, I am trying to learn the new services method in flex 4. but i can´t get it work. A test oparation near the service in flash builder 4 works. But when i run the code i get NetConnection.Call.Failed: HTTP: Failed. Does somebody knows what the problem can be? Tom CODE: PHP <?php class AuthService { public function login($username, $password) { return 'ok'; } public function logout() { return true; } } ?> FLEX <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:authservice="services.authservice.*"> <fx:Script> <![CDATA[ import mx.controls.Alert; protected function button_clickHandler(event:MouseEvent):void { loginResult.token = authService.login(username, password); } ]]> </fx:Script> <fx:Declarations> <s:CallResponder id="loginResult"/> <authservice:AuthService id="authService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:Button x="97" y="193" label="Button" id="button" click="button_clickHandler(event)"/> <s:TextInput x="91" y="87" id="username"/> <s:TextInput x="97" y="117" id="password"/> </s:Application

    Read the article

  • How does heap compaction work quickly?

    - by Mason Wheeler
    They say that compacting garbage collectors are faster than traditional memory management because they only have to collect live objects, and by rearranging them in memory so everything's in one contiguous block, you end up with no heap fragmentation. But how can that be done quickly? It seems to me that that's equivalent to the bin-packing problem, which is NP-hard and can't be completed in a reasonable amount of time on a large dataset within the current limits of our knowledge about computation. What am I missing?

    Read the article

  • How do you unit test a LINQ expression using Moq and Machine.Specifications?

    - by Phil.Wheeler
    I'm struggling to get my head around how to accommodate a mocked repository's method that only accepts a Linq expression as its argument. Specifically, the repository has a First() method that looks like this: public T First(Expression<Func<T, bool>> expression) { return All().Where(expression).FirstOrDefault(); } The difficulty I'm encountering is with my MSpec tests, where I'm (probably incorrectly) trying to mock that call: public abstract class with_userprofile_repository { protected static Mock<IRepository<UserProfile>> repository; Establish context = () => { repository = new Mock<IRepository<UserProfile>>(); repository.Setup<UserProfile>(x => x.First(up => up.OpenID == @"http://testuser.myopenid.com")).Returns(GetDummyUser()); }; protected static UserProfile GetDummyUser() { UserProfile p = new UserProfile(); p.OpenID = @"http://testuser.myopenid.com"; p.FirstName = "Joe"; p.LastLogin = DateTime.Now.Date.AddDays(-7); p.LastName = "Bloggs"; p.Email = "[email protected]"; return p; } } I run into trouble because it's not enjoying the Linq expression: System.NotSupportedException: Expression up = (up.OpenID = "http://testuser.myopenid.com") is not supported. So how does one test these sorts of scenarios?

    Read the article

  • Java NIO (Netty): How does Encryption or GZIPping work in theory (with filters)

    - by Tom
    Hello Experts, i would be very thankfull if you can explain to me, how in theory the "Interceptor/Filter" Pattern in ByteStreams (over Sockets/Channels) work (in Asynchronous IO with netty) in regard to encryption or compression of data. Given I have a Filter that does GZIPPING. How is this internally implemented? Does the Filter "collect" so many bytes form the channel, that this is a usefull number of bytes that can then be en/decoded? What is in general the minimal "blocksize(data to encode/decode in a chunk)" of socket based gzipping? Does this "blocksize" have to be negotiated in advance between server and client? What happens if the client does not send enough data to "fill" the blocksize (due to a network conquestion) but does not close the connection. Does this mean the other side will simply wait until it gets enough bytes to decode or until a timeout occoures...How is the Filter pattern the applied? The compression filter will de/compress the blocksize of bytes and then store them again in the same buffer would (in the case of netty) i normally be using the ChannelHanlderContext to pass the de/encoded data to the next filter?... Any explanations/links/tutorials (for beginners;-) will be very much appreciated to help me understand how for example encryption/compressing are implemented in socket based communication with filters/interceptor pattern. thank you very much tom

    Read the article

  • android - using resources drawable in content provider

    - by Russ Wheeler
    I am trying to pass back an image through a content provider in a separate app. I have two apps, one with the activity in (app a), the other with content provider (app b) I have app a reading an image off my SD card via app b using the following code. App a: public void but_update(View view) { ContentResolver resolver = getContentResolver(); Uri uri = Uri.parse("content://com.jash.cp_source_two.provider/note/1"); InputStream inStream = null; try { inStream = resolver.openInputStream(uri); Bitmap bitmap = BitmapFactory.decodeStream(inStream); image = (ImageView) findViewById(R.id.imageView1); image.setImageBitmap(bitmap); } catch(FileNotFoundException e) { Toast.makeText(getBaseContext(), "error = "+e, Toast.LENGTH_LONG).show(); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { Log.e("test", "could not close stream", e); } } } }; App b: @Override public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException { try { File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"pic2.png"); return ParcelFileDescriptor.open(path,ParcelFileDescriptor.MODE_READ_ONLY); } catch (FileNotFoundException e) { Log.i("r", "File not found"); throw new FileNotFoundException(); } } In app a I am able to display an image from app a's resources folder, using setImageURi and constructing a URI using the following code. int id = R.drawable.a2; Resources resources = getBaseContext().getResources(); Uri uri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(id) + '/' + resources.getResourceTypeName(id) + '/' + resources.getResourceEntryName(id) ); image = (ImageView) findViewById(R.id.imageView1); image.setImageURI(uri); However, if I try to do the same in app b (read from app b's resources folder rather than the image on the SD card) it doesn't work, saying it can't find the file, even though I am creating the path of the file from the resource, so it is definitely there. Any ideas? Does it restrict sending resources over the content provider somehow? P.S. I also got an error when I tried to create the file with File path = new File(uri); saying 'there is no applicable constructor to '(android.net.Uri)' though http://developer.android.com/reference/java/io/File.html#File(java.net.URI) Seems to think it's possible...unless java.net.URI is different to android.net.URI, in which case can I convert them? Thanks Russ

    Read the article

  • Majordomo/Mailman - Yahoo/Google Groups

    - by tom smith
    Hi. Not an app question, but thought that I might ask here anyway! The responses might help someone. I've got an app where we're going to be dealing with 5000-10000 people in a group/pool. Periodically, different subsets of people will break off in their own group. I'm looking for thoughts on how to manage/approach this situation. (For now, all of this is being managed on a few servers in the garage, with dynamic IP) I've looked into the Yahoo/google groups, and they seem to be reasonable. The primary issue that I see with this approach, is that I don't have a good way of quickly/easily alowing a subset of the group to form their own group for a given project. This kind of function is critical. The upside to this though, I wouldn't have to really set anything up. And the hosted groups could send emails to the user all day along, without running into cap/bandwidth limits The other approach is a managed list, like mailman/majordomo. This approach appears to be more flexible, and looks like ti could be modified to handle the quick creation of lists, allowing users to quickly be assigned to different lists on the fly.. The downside, I'd have to run my own Mailman/Majordomo instance, as well as the associated mail server. Or I could look at possibly using one of the hosted service.. But this is for a project on the cheap, so we're really trying to keep costs down. Thoughts/Comments/Pointers would be greatly appreciated. Thanks in advance -tom

    Read the article

  • How do I convert a TimeSpan to a formatted string?

    - by Michael Wheeler
    Exact Duplicate Timespan formatting First question here: I have two DateTime vars, beginTime and endTime. I have gotten the difference of them by doing the following: TimeSpan dateDifference = endTime.Subtract(beginTime); How can I now return a string of this in hh hrs, mm mins, ss secs format using C#. If the difference was 00:06:32.4458750 It should return this 00 hrs, 06 mins, 32 secs Thanks for the help

    Read the article

  • Examples of usability disasters?

    - by Willie Wheeler
    Anybody have good examples of usability disasters? Here's an example. Hector is a manager with a large team. Department admin wants to send Hector a spreadsheet with his team's salaries. She types "Hector" in the Outlook "To:" field. It autocompletes to "Hector's Team" but she doesn't notice that until after she sends it.

    Read the article

  • Workflow engine BPMN, Drools, etc or ESB?

    - by Tom
    We currently have an application that is based on an in-house developed workflow engine with YAML based DSL. We are looking to move parts of it to Java. I have discovered a number of java solutions like Intalio, JBPM, Drools Expert, Drools Flow etc. They appear to be aimed at businesses where the business analyst creates the workflows using a graphical editor and submits them to the workflow engine. They seem geared towards ease of use for non-technical people rather than for developers with a focus on human interaction. The workflows tend to look like. Discover-a-file -\ -> join -> process-file -> move-file -> register-file Discover-some-metadata -/ If any step fails we need to retry it X times. We also need to be able to stop the system and be able to restart it and have it continue from where it was (durable). Some of our workflows can be defined by a set of goals we need to achieve so Jess's backwards rule chaining sounds interesting but it is not open source. It might be that what we are after is a Finite State Machine engine or just an Enterprise Service Bus and do everything as JMS queues. Is there a good open source workflow engine that is both standards-based but also geared towards developers. We don't particular want to use a graphical workflow designer or write reams of XML and it should ideally be in Java or language agnostic (makes REST/Soap calls to external services). Thanks, Tom

    Read the article

  • How do you unit test a method containing a LINQ expression?

    - by Phil.Wheeler
    I'm struggling to get my head around how to accommodate a mocked method that only accepts a Linq expression as its argument. Specifically, the repository I'm using has a First() method that looks like this: public T First(Expression<Func<T, bool>> expression) { return All().Where(expression).FirstOrDefault(); } The difficulty I'm encountering is with my MSpec tests, where I'm (probably incorrectly) trying to mock that call: public abstract class with_userprofile_repository { protected static Mock<IRepository<UserProfile>> repository; Establish context = () => { repository = new Mock<IRepository<UserProfile>>(); repository.Setup<UserProfile>(x => x.First(up => up.OpenID == @"http://testuser.myopenid.com")).Returns(GetDummyUser()); }; protected static UserProfile GetDummyUser() { UserProfile p = new UserProfile(); p.OpenID = @"http://testuser.myopenid.com"; p.FirstName = "Joe"; p.LastLogin = DateTime.Now.Date.AddDays(-7); p.LastName = "Bloggs"; p.Email = "[email protected]"; return p; } } I run into trouble because it's not enjoying the Linq expression: System.NotSupportedException: Expression up = (up.OpenID = "http://testuser.myopenid.com") is not supported. So how does one test these sorts of scenarios?

    Read the article

  • How to simulate a fake MouseOver on a Flash applet in a webpage?

    - by Mason Wheeler
    I listen to internet radio at http://player.play.it/player/player.htm and it works pretty well, except for one minor issue. The Flash applet that runs the radio player has a timer on it, where if you don't move the mouse over the player every once in a while, it decides you're idle and shuts off the stream, even if you're not actually idle, but just working on something else with the radio player running in the background. Is there any way I can send a fake MouseOver message to this applet to keep it from cutting me off in the middle of a song, maybe with a GreaseMonkey script? I'm using Firefox.

    Read the article

  • Creating VSTO Excel Template fails

    - by Phil.Wheeler
    I have been trying for ages in all sorts of ways (short of ritual incantations and sacrifices) to get Visual Studio Team Edition 2008 to allow me to create Office 2003 solutions, whether those be templates or documents. No matter what I try, I'm always presented with an error which basically says "You've got the wrong version of Office installed. Try installing something compatible". I have the complete installation of Office 2003 Pro installed along with the Office 2003 Primary Interop Assemblies (which I put on after I installed Office) and then VS2008TE as already mentioned. There has to be some reason why this refuses to work, but I'm out of ideas. Help appreciated.

    Read the article

  • Using java2d user space measurements with TextLayout and LineBreakMeasurer

    - by Andrew Wheeler
    I have a java2d image defined in user space (mm) to print an identity card. The transformation to pixels is by using an AffineTransform for the required DPI (Screen or print). I want to wrap text across several lines but the the TextLayout does not respect user space co-ordinates. private void drawParagraph(Graphics2D g2d, Rectangle2D area, String text) { LineBreakMeasurer lineMeasurer; AttributedString string = new AttributedString(text); AttributedCharacterIterator paragraph = string.getIterator(); int paragraphStart = paragraph.getBeginIndex(); int paragraphEnd = paragraph.getEndIndex(); FontRenderContext frc = g2d.getFontRenderContext(); lineMeasurer = new LineBreakMeasurer(paragraph, frc); float breakWidth = (float)area.getWidth(); float drawPosY = (float)area.getY(); float drawPosX = (float)area.getX(); lineMeasurer.setPosition(paragraphStart); while (lineMeasurer.getPosition() < paragraphEnd) { TextLayout layout = lineMeasurer.nextLayout(breakWidth); drawPosY += layout.getAscent(); layout.draw(g2d, drawPosX, drawPosY); drawPosY += layout.getDescent() + layout.getLeading(); } } The above code determines font metrics using user space sizing of the Font and thus turn out rather large. The font size is calculated as best vertical fit for the number of lines in an area with the calculation as below. E.g. attr.put(TextAttribute.SIZE, (geTextArea().getHeight() / noOfLines - LINE_SPACING) ); When using g2d.drawString("Some text to display", x, y); the font size appears correct. Does anyone have a better way of doing text layout in user space co-ords?

    Read the article

  • Testing a wide variety of computers with a small company

    - by Tom the Junglist
    Hello everyone, I work for a small dotcom which will soon be launching a reasonably-complicated Windows program. We have uncovered a number of "WTF?" type scenarios that have turned up as the program has been passed around to the various not-technical-types that we've been unable to replicate. One of the biggest problems we're facing is that of testing: there are a total of three programmers -- only one working on this particular project, me -- no testers, and a handful of assorted other staff (sales, etc). We are also geographically isolated. The "testing lab" consists of a handful of VMWare and VPC images running sort-of fresh installs of Windows XP and Vista, which runs on my personal computer. The non-technical types try to be helpful when problems arise, we have trained them on how to most effectively report problems, and the software itself sports a wide array of diagnostic features, but since they aren't computer nerds like us their reporting is only so useful, and arranging remote control sessions to dig into the guts of their computers is time-consuming. I am looking for resources that allow us to amplify our testing abilities without having to put together an actual lab and hire beta testers. My boss mentioned rental VPS services and asked me to look in to them, however they are still largely very much self-service and I was wondering if there were any better ways. How have you, or any other companies in a similar situation handled this sort of thing? EDIT: According to the lingo, our goal here is to expand our systems testing capacity via an elastic computing platform such as Amazon EC2. At this point I am not sure suggestions of beefing up our unit/integration testing are going to help very much as we are consistently hitting walls at the systems testing phase. Has anyone attempted to do this kind of software testing on a cloud-type service like EC2? Tom

    Read the article

  • What does it mean that "Lisp can be written in itself?"

    - by Mason Wheeler
    Paul Graham wrote that "The unusual thing about Lisp-- in fact, the defining quality of Lisp-- is that it can be written in itself." But that doesn't seem the least bit unusual or definitive to me. ISTM that a programming language is defined by two things: Its compiler or interpreter, which defines the syntax and the semantics for the language by fiat, and its standard library, which defines to a large degree the idioms and techniques that skilled users will use when writing code in the language. With a few specific exceptions, (the non-C# members of the .NET family, for example,) most languages' standard libraries are written in that language for two very good reasons: because it will share the same set of syntactical definitions, function calling conventions, and the general "look and feel" of the language, and because the people who are likely to write a standard library for a programming language are its users, and particularly its designer(s). So there's nothing unique there; that's pretty standard. And again, there's nothing unique or unusual about a language's compiler being written in itself. C compilers are written in C. Pascal compilers are written in Pascal. Mono's C# compiler is written in C#. Heck, even some scripting languages have implementations "written in itself". So what does it mean that Lisp is unusual in being written in itself?

    Read the article

  • Is there any simple way to test two PNGs for equality?

    - by Mason Wheeler
    I've got a bunch of PNG images, and I'm looking for a way to identify duplicates. By duplicates I mean, specifically, two PNG files whose uncompressed image data are identical, not necessarily whose files are identical. This means I can't do something simple like compare CRC hash values. I figure this can actually be done reliably since PNGs use lossless compression, but I'm worried about speed. I know I can winnow things down a little by testing for equal dimensions first, but when it comes time to actually compare the images against each other, is there any way to do it reasonably efficiently? (ie. faster than the "double-for-loop checking pixel values against each other" brute-force method?)

    Read the article

  • Solr associations

    - by Tom
    Hi all, The last couple of days we are thinking of using Solr as our search engine of choice. Most of the features we need are out of the box or can be easily configured. There is however one feature that we absolutely need that seems to be well hidden (or missing) in Solr. I'll try to explain with an example. We have lots of documents that are actually businesses: <document> <name>Apache</name> <cat>1</cat> ... </document> <document> <name>McDonalds</name> <cat>2</cat> ... </document> In addition we have another xml file with all the categories and synonyms: <cat id=1> <name>software</name> <synonym>IT<synonym> </cat> <cat id=2> <name>fast food</name> <synonym>restaurant<synonym> </cat> We want to associate both businesses and categories so we can search using the name and/or synonyms of the category. But we do not want to merge these files at indexing time because we should update the categories (adding.remioving synonyms...) without indexing all the businesses again. Is there anything in Solr that does this kind of associations or do we need to develop some specific pieces? All feedback and suggestions are welcome. Thanks in advance, Tom

    Read the article

  • Is there a Delphi dropdown notification component?

    - by Mason Wheeler
    You know how in Firefox, if something happens that requires your attention but isn't immediately urgent enough to require a modal dialog, it will drop down a little strip at the top of the tab with a question on it? I'd like to be able to put functionality like that in a Delphi app, but I don't know if there's a component for that. Does anyone know of one?

    Read the article

  • Entity framework memory leak after detaching newly created object

    - by Tom Peplow
    Hi, Here's a test: WeakReference ref1; WeakReference ref2; TestRepositoryEntitiesContainer context; int i = 0; using (context = GetContext<TestRepositoryEntitiesContainer>()) { context.ObjectMaterialized += (o, s) => i++; var item = context.SomeEntities.Where(e => e.SomePropertyToLookupOn == "some property").First(); context.Detach(item); ref1 = new WeakReference(item); var newItem = new SomeEntity {SomePropertyToLookupOn = "another value"}; context.SomeEntities.AddObject(newItem); ref2 = new WeakReference(newItem); context.SaveChanges(); context.SomeEntities.Detach(newItem); newItem = null; item = null; } context = null; GC.Collect(); Assert.IsFalse(ref1.IsAlive); Assert.IsFalse(ref2.IsAlive); First assert passes, second fails... I hope I'm missing something, it is late... But it appears that detaching a fetched item will actually release all handles on the object letting it be collected. However, for new objects something keeps a pointer and creates a memory leak. NB - this is EF 4.0 Anyone seen this before and worked around it? Thanks for your help! Tom

    Read the article

  • Should methods containing LINQ expressions be tested / mocked?

    - by Phil.Wheeler
    Assuming I have a class with a method that takes a System.Linq.Expressions.Expression as a parameter, how much value is there in unit testing it? public void IEnumerable<T> Find(Expression expression) { return someCollection.Where(expression).ToList(); } Unit testing or mocking these sorts of methods has been a mind-frying experience for me and I'm now at the point where I have to wonder whether it's all just not worth it. How would I unit test this method using some arbitrary expression like List<Animal> = myAnimalRepository.Find(x => x.Species == "Cat");

    Read the article

  • Managing Unique IDs in stateless (web) DB4O applications

    - by Phil.Wheeler
    I'm playing around with building a new web application using DB4O - piles of fun and some really interesting stuff learned. The one thing I'm struggling with is DB4O's current lack of support for stateless applications (i.e. web apps, mostly) and the need for automatically-generated IDs. There are a number of creative and interesting approaches that I've been able to find that hook into DB4O's events, use GUIDs rather than numeric IDs or for whatever reason avoid using any system of ID at all. While each approach has its merits, I'm wondering if the less-elegant approach might equally be the best fit. Consider the following pseudo-code: If ID == 0 or null Set ID = (typeof(myObject)).Count myObject.Save It seems like such a blindingly simple approach, it's usually about here that I start thinking, "I've missed something really obvious". Have I?

    Read the article

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