Search Results

Search found 518 results on 21 pages for 'fred wilson'.

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

  • When is a scala partial function not a partial function?

    - by Fred Haslam
    While creating a map of String to partial functions I ran into unexpected behavior. When I create a partial function as a map element it works fine. When I allocate to a val it invokes instead. Trying to invoke the check generates an error. Is this expected? Am I doing something dumb? Comment out the check() to see the invocation. I am using scala 2.7.7 def PartialFunctionProblem() = { def dream()() = { println("~Dream~"); new Exception().printStackTrace() } val map = scala.collection.mutable.HashMap[String,()=>Unit]() map("dream") = dream() // partial function map("dream")() // invokes as expected val check = dream() // unexpected invocation check() // error: check of type Unit does not take parameters }

    Read the article

  • Are Maybes a good pattern for scala?

    - by Fred Haslam
    For a while I have been struggling to integrate scala with java methods that might return null. I came up with the following utility which helps a lot: // produce an Option, nulls become None object Maybe { def apply[T](t:T) = if (t==null) None else Some(t) } Maybe(javaClass.getResultCouldBeNull()).map( result => doSomeWork(result) ) I have a few questions about this solution: Is there a better or more standard pattern to use? Am I duplicating something that already exists? Does this functionality have hidden gotchas?

    Read the article

  • Automatic VM deployment

    - by Robert Wilson
    I have an idea to streamline deployments of prototypes within our team using VMs. The idea would be that a developer would be able to deploy their artifacts to Maven, then use a Web interface to pull them onto a development VM for integration/regression testing. They would then be able to to push those artifacts to a reference system, and finally onto production. I'm currently thinking of doing this myself using the vSphere Java API ( http://vijava.sourceforge.net/ ), and some simple scripting to grab artifacts from the Maven repository, configuration from SVN, and then start up a JBoss server. It feels like the kind of thing that may already be available though, has anyone heard of something similar?

    Read the article

  • Extract parts of html using regex

    - by Fred Yang
    I have a simple requirement to extract text in html. Suppose the html is <h1>hello</h1> ... <img moduleType="calendar" /> ...<h2>bye</h2> I want to convert it into three parts <h1>hello</h1> <img moduleType="calendar" /> <h2>bye</h2> The aim is to extract text in two categories, simple html and special tags with <img moduleType="Calender".

    Read the article

  • Owner Vs PArent and Taction shortcuts on Frames

    - by Fred
    I have a form with a panel. I create frames at runtime and display them on the panel by setting frame's parent property to the panel. When creating panels I do not set the owner property because i manage myself the lifetime of the frame. Until now i got no problem. Next I put an TActionList on the frame with some shortcuts on the actions. I found that my actions did not execute until I set the owner property of the frame to the panel. Can someone can explain me that ? I thought that owner property was just about wich component is responsible to free the children components, and not responsible to forward key events.

    Read the article

  • Determine which process (b)locks a file, programmatically (under Windows >= XP)

    - by fred-hh
    How to programmatically determine from a process P, which other process P' has a lock on a file, that prevents P from recreating that file ? I know there are tools to do that, but how do they achieve that ? (Context: a batch program that runs overnight fails because of a locked file. Running an admin tool the next day may be too late to get useful information. So it would be nice if the batch program itself was able to determine the culprit.) EDIT: Added complexity: the file resides on a DFS and P' might not run on the same machine as P (but maybe does). But a solution that works locally would be a good beginning.

    Read the article

  • Javascript callback with AJAX + jQuery

    - by Fred
    Hey! I have this jQuery code (function () { function load_page (pagename) { $.ajax({ url: "/backend/index.php/frontend/pull_page/", type: "POST", data: {page: pagename}, success: function (json) { var parsed = $.parseJSON(json); console.log(parsed); return parsed; }, error: function (error) { $('#content').html('Sorry, there was an error: <br>' + error); return false; } }); } ... var json = load_page(page); console.log(json); if (json == false) { $('body').fadeIn(); } else { document.title = json.pagename + ' | The Other Half | freddum.com'; $("#content").html(json.content); $('#header-navigation-ul a:Contains('+page+')').addClass('nav-selected'); $('body').fadeIn(); } })(); and, guessed it, it doesn't work. The AJAX fires fine, the server returns valid JSON but the console.log(json); returns undefined and the js crashes when it gets to json.pagename. The first console.log(parsed) also returns good data so it's just a problem with the return (I think). I knew I was clutching at straws and would be extremely if this worked, but it doesn't. To be honest, I don't know how to program callback functions for this situation. Any help is greatly appreciated!

    Read the article

  • iPhone NSTimer OpenGL problem

    - by Toby Wilson
    I've got a problem that only seems to occur on the device, not in the simulator. My app's animation is started and stopped using these methods: NSTimer* animationTimer; -(void)startAnimation { if(animationTimer = nil) animationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f/60.0f target:self selector:@selector(drawView) userInfo:nil repeats:YES]; } -(void)stopAnimation { [animationTimer invalidate]; animationTimer = nil; } In the simulator this works fine and drawView starts being called at 60fps. On the device (testing on iPod Touch), the scheduleTimerWithTimeInterval method doesn't seem to work. Furthermore, [animationTimer invalidate] causes EXC_BAD_ACCESS. I've spotted an obvious but minor flaw; adding if(animationTimer != nil) to the stopAnimation method will prevent the crash, but doesn't solve the problem of the animation timer not being properly initialised. Edit: The above doesn't prevent a crash. animationTimer != nil yet calling invalidate causes EXC_BAD_ACCESS. Should also add, this problem doesn't occur all the time on the device. Maybe 40% of the time.

    Read the article

  • Open Source 2D Game Engine that supports Hexagon Maps for .NET

    - by Fred F.
    Hello, I cannot find a 2D game engine to create hexagon maps for .net. The best I can find is Xconq (http://sourceforge.net/projects/xconq/) and pygame. Does anybody where I can find any? preferrably one like xconq. Thank you for your time and effort. I really apprecate it. Edit: I would like to have feature of a strategic nature. Like adding custom AIs, path finding, etc. Xcong is an engine for turn-based strategy games.

    Read the article

  • Is it faster to do the pages first and CSS second, or should I do them at the same time?

    - by Fred Haslam
    I have been tasked with building a new web project from scratch, with the exception of reusing CSS files (the look and feel) from an existing project. In the past I have always completed development of the functionality and the web-ui before considering the appearance. This is mostly due to CSS development overlapping with the tail end of the project. I now have the opportunity to integrate a static set of CSS as I build the application. I have no experience with this circumstance. Would it be faster to develop the project and web-pages first, then integrate the CSS; or would it be faster to integrate the CSS as part of page development?

    Read the article

  • entity framework vNext wish list

    - by Fred Yang
    I have been intensively studying and use ef4 in my project. I do feel the improvement that it has over version 1. But I found that I have something I cannot get around easily. Here is a list I want it to be better in ef vNext. the model designer should allow multiple view of the same model, so that I don't need cram all my entity into a single view. respect user's manual edit of edmx. Currently, the some database view object simply can not be imported to the model because the designer "smartly" think that the view does not have a primary key, so that I have to manually edit the edmx to correct designer's behavior. But in the next "update from database" task, designer will revert my customization. For now, I simply fallback to manually edit the edmx file at all, or I have to use compare tool to keep the new update, and rollback and put the new update into my old edmx file manually. Designer should be improved to allow default behavior and user's manual control. I want control not to let the designer refresh the change of imported object. support user defined table function. linq is about Composability, stored proc dos not support composability. I wish I could use user defined table function which support this. What are you wishes for EF vNext?

    Read the article

  • Why do I get a nullpointerexception at line ds.getPort in class L1?

    - by Fred
    import java.awt.; import java.awt.event.; import javax.swing.; import java.io.; import java.net.; import java.util.; public class Draw extends JFrame { /* * Socket stuff */ static String host; static int port; static int localport; DatagramSocket ds; Socket socket; Draw d; Paper p = new Paper(ds); public Draw(int localport, String host, int port) { d = this; this.localport = localport; this.host = host; this.port = port; try { ds = new DatagramSocket(localport); InetAddress ia = InetAddress.getByName(host); System.out.println("Attempting to connect DatagramSocket. Local port " + localport + " , foreign host " + host + ", foreign port " + port + "..."); ds.connect(ia, port); System.out.println("Success, ds.localport: " + ds.getLocalPort() + ", ds.port: " + ds.getPort() + ", address: " + ds.getInetAddress()); Reciever r = new Reciever(ds); r.start(); } catch (Exception e) { e.printStackTrace(); } setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().add(p, BorderLayout.CENTER); setSize(640, 480); setVisible(true); } public static void main(String[] args) { int x = 0; for (String s : args){ if (x==0){ localport = Integer.parseInt(s); x++; } else if (x==1){ host = s; x++; } else if (x==2){ port = Integer.parseInt(s); } } Draw d = new Draw(localport, host, port); } } class Paper extends JPanel { DatagramSocket ds; private HashSet hs = new HashSet(); public Paper(DatagramSocket ds) { this.ds=ds; setBackground(Color.white); addMouseListener(new L1(ds)); addMouseMotionListener(new L2()); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.black); Iterator i = hs.iterator(); while(i.hasNext()) { Point p = (Point)i.next(); g.fillOval(p.x, p.y, 2, 2); } } private void addPoint(Point p) { hs.add(p); repaint(); } class L1 extends MouseAdapter { DatagramSocket ds; public L1(DatagramSocket ds){ this.ds=ds; } public void mousePressed(MouseEvent me) { addPoint(me.getPoint()); Point p = me.getPoint(); String message = Integer.toString(p.x) + " " + Integer.toString(p.y); System.out.println(message); try{ byte[] data = message.getBytes("UTF-8"); //InetAddress ia = InetAddress.getByName(ds.host); String convertedMessage = new String(data, "UTF-8"); System.out.println("The converted string is " + convertedMessage); DatagramPacket dp = new DatagramPacket(data, data.length); System.out.println(ds.getPort()); //System.out.println(message); //System.out.println(ds.toString()); //ds.send(dp); /*System.out.println("2Sending a packet containing data: " +data +" to " + ia + ":" + d.port + "...");*/ } catch (Exception e){ e.printStackTrace(); } } } class L2 extends MouseMotionAdapter { public void mouseDragged(MouseEvent me) { addPoint(me.getPoint()); Point p = me.getPoint(); String message = Integer.toString(p.x) + " " + Integer.toString(p.y); //System.out.println(message); } } } class Reciever extends Thread{ DatagramSocket ds; byte[] buffer; Reciever(DatagramSocket ds){ this.ds = ds; buffer = new byte[65507]; } public void run(){ try { DatagramPacket packet = new DatagramPacket(buffer, buffer.length); while(true){ try { ds.receive(packet); String s = new String(packet.getData()); System.out.println(s); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } }

    Read the article

  • Modifications in default document (ASP.NET+IIS7) won't take effect

    - by Wilson
    We have a website developed by ASP.NET+IIS7 and its default document is default.aspx. It works fine. But when we tried to switch the default to index.html, weird things happened. We have modified web.config as follows: <defaultDocument> <files> <clear /> <add value="index.html" /> </files> </defaultDocument> and we have clear everything under C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files``, and restart the worker process. We even changed the name of Default.aspx to dddd.aspx. But everything stays the same when accessing with http://localhost/<MyAppName>/! And when we tried to access with http://localhost/<MyAppName>/index.html, it works fine. Any suggestions would be highly appreciated.

    Read the article

  • Contributing to the Status Bar/Trim in Eclipse RCP

    - by Robert Wilson
    I have a requirement to show a status indicator in the status bar of an Eclipse application. I can't contribute through the ApplicationWindowAdviser (another team owns the core product), but I feel sure that I should be able to contribute through an extension point. Despite much googling, I can't find anything describing how to do this.

    Read the article

  • how come we need not close the handle returned by ShellExecute ?

    - by fred-hh
    On success, ShellExecute returns a handle. Do we need to close this handle, and if so, how ? According to examples published my Microsoft, we need not close this handle. But the doc of ShellExecute itself is mute on the subject. Can you confirm we indeed do not need to close this handle ? But then, how can a handle be valid and in no need of being closed ??? Which of the following statements is/are true: the handle is invalid and we can't do anything with it; the handle is never freed and there is a (Microsoft-sponsored) memory leak (until the caller program ends); the handle is automatically freed by the system at some time and never reused afterwards (- another kind of resource leak). Only on trying to use it can we know whether it still points to something. what else ?

    Read the article

  • How do I use a custom cookie session serializer in Rack?

    - by Damien Wilson
    Hello SO. I'm currently integrating Warden into a new Rack application I'm building. I'd like to implement a recent patch to Rack that allows me to specify how sessions are serialized; specifically, I'd like to use Rack::Session::Cookie::Identity as the session processor. Unfortunately, the documentation is a little unclear as to what syntax I should use to configure Rack::Session::Cookie in my rackup file, can anyone here tell me what I'm doing wrong? config.ru require 'my_sinatra_app' app = self use Rack::Session::Cookie.new(app, Rack::Session::Cookie::Identity.new), {:key => "auth_token"} use Warden::Manager do |warden| # Must come AFTER Rack::Session warden.default_strategies :password warden.failure_app Jelli::Auth.run! end run MySinatraApp error message from thin !! Unexpected error while processing request: undefined method `new' for #<Rack::Session::Cookie:0x00000110124128> PS: I'm using bundler to manage my gem dependencies and I've likewise included rack's master branch as the desired version. Update: As suggested in the comments below, I have read the documentation; sadly the suggested syntax in the docs is not working. Update: Still no luck on my end; offering up a bounty to whoever can help me figure this out.

    Read the article

  • Animating UIImageView iPhone

    - by Fred Dpn
    Hi, i'm having trouble about animating an Image in a UIImageView. I've created an image view in interface builder and linked it to its iboutlet. Here is my code. @interface Game : UIViewController <UIAccelerometerDelegate>{ IBOutlet UIImageView *diying; } @property (nonatomic, retain) UIImageView *diying; In the viewDidLoad method i've written this code NSArray * imageArray = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"Die1.gif"], [UIImage imageNamed:@"Die2.gif"], [UIImage imageNamed:@"Die3.gif"], [UIImage imageNamed:@"Die4.gif"], nil]; diying.animationImages = imageArray; diying.animationDuration = 1.1; diying.contentMode = UIViewContentModeBottomLeft; [diying startAnimating]; [super viewDidLoad]; which is a adaptation of what i've found here : http://icodeblog.com/2009/07/24/iphone-programming-tutorial-animating-a-game-sprite/ NB : those .gif files are simple images and are not animated. I did the tutorial and it worked fine but i can't figure out why it my adaptation doesn't work !

    Read the article

  • Calling app_code folder from web application project

    - by Fred
    I am developing a module for DotNetNuke and have used a DotNetNuke Compiled Module template to create the module in the DesktopModule folder. I then get a Web Application Project under the DNN website in my Visual Studio 2008. Now I want to use DAL and BLL which are created in DNN app_code folder. But when I add them in code behind it can't find them. How do I tell my Web Application Project to access the app_code folder in the website "projcet"? Thanks in advance!

    Read the article

  • Getting Excel add ins to modify array formula parameters; or perform 'ctrl-shift-enter'

    - by Toby Wilson
    I am trying to make a C# Excel add in change the parameters of an array formula in-place; i.e. do the same as a user modifying an array formula and hitting ctrl-shift-enter. Setting the activeCell.FormulaArray property does not achieve this; it throws a 'You cannot change part of an array' error. Does anyone know how I can achieve this? A solution that also works in VBA would be brilliant. I've tried creating some logic that 'walks' to the perimeter of the array formula and deletes it first, but it doesn't account for adjacent array formulas and I believe this is unnecessarily drastic.

    Read the article

  • Overloading '-' for array subtraction

    - by Chris Wilson
    I am attempting to subtract two int arrays, stored as class members, using an overloaded - operator, but I'm getting some peculiar output when I run tests. The overload definition is Number& Number :: operator-(const Number& NumberObject) { for (int count = 0; count < NumberSize; count ++) { Value[count] -= NumberObject.Value[count]; } return *this; } Whenever I run tests on this, NumberObject.Value[count] always seems to be returning a zero value. Can anyone see where I'm going wrong with this? The line in main() where this subtraction is being carried out is cout << "The difference is: " << ArrayOfNumbers[0] - ArrayOfNumbers[1] << endl; ArrayOfNumbers contains two Number objects. The class declaration is #include <iostream> using namespace std; class Number { private: int Value[50]; int NumberSize; public: Number(); // Default constructor Number(const Number&); // Copy constructor Number(int, int); // Non-default constructor void SetMemberValues(int, int); // Manually set member values int GetNumberSize() const; // Return NumberSize member int GetValue() const; // Return Value[] member Number& operator-=(const Number&); }; inline Number operator-(Number Lhs, const Number& Rhs); ostream& operator<<(ostream&, const Number&); The full class definition is as follows: #include <iostream> #include "../headers/number.h" using namespace std; // Default constructor Number :: Number() {} // Copy constructor Number :: Number(const Number& NumberObject) { int Temp[NumberSize]; NumberSize = NumberObject.GetNumberSize(); for (int count = 0; count < NumberObject.GetNumberSize(); count ++) { Temp[count] = Value[count] - NumberObject.GetValue(); } } // Manually set member values void Number :: SetMemberValues(int NewNumberValue, int NewNumberSize) { NumberSize = NewNumberSize; for (int count = NewNumberSize - 1; count >= 0; count --) { Value[count] = NewNumberValue % 10; NewNumberValue = NewNumberValue / 10; } } // Non-default constructor Number :: Number(int NumberValue, int NewNumberSize) { NumberSize = NewNumberSize; for (int count = NewNumberSize - 1; count >= 0; count --) { Value[count] = NumberValue % 10; NumberValue = NumberValue / 10; } } // Return the NumberSize member int Number :: GetNumberSize() const { return NumberSize; } // Return the Value[] member int Number :: GetValue() const { int ResultSoFar; for (int count2 = 0; count2 < NumberSize; count2 ++) { ResultSoFar = ResultSoFar * 10 + Value[count2]; } return ResultSoFar; } Number& operator-=(const Number& Rhs) { for (int count = 0; count < NumberSize; count ++) { Value[count] -= Rhs.Value[count]; } return *this; } inline Number operator-(Number Lhs, const Number& Rhs) { Lhs -= Rhs; return Lhs; } // Overloaded output operator ostream& operator<<(ostream& OutputStream, const Number& NumberObject) { OutputStream << NumberObject.GetValue(); return OutputStream; }

    Read the article

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