Daily Archives

Articles indexed Monday May 17 2010

Page 1/112 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • use stream_socket_client to retrieve 2 remote files at the same time

    - by Hintswen
    I have a script in PHP which retrieves two very similar files and performs some tasks on the data then outputs a result. I'm currently using curl and getting one, processing it, then getting the other and processing it. I want to switch to stream_socket_client as I've heard you can retrieve both files at the same time and do the processing once they have been retrieved but I am unsure how to do this.

    Read the article

  • How to define a function in ghci across multiple lines

    - by Peter McGrattan
    I'm trying to define any simple function that spans multiple lines in ghci, take the following as an example: let abs n | n >= 0 = n | otherwise = -n So far I've tried pressing Enter after the first line: Prelude> let abs n | n >= 0 = n Prelude> | otherwise = -n <interactive>:1:0: parse error on input `|' I've also attempted to use the :{ and :} commands but I don't get far: Prelude> :{ unknown command ':{' use :? for help. I'm using GHC Interactive version 6.6 for Haskell 98 on Linux, what am I missing?

    Read the article

  • firefox: How to enable local javascript to read/write files on my PC?

    - by Nok Imchen
    well, since greasemonkey cant read/write files from local hard disk. I've heard people suggesting Google gears but i've no idea obout gears :( So, what i've decided is to add a script type="text/javascript" src="file:///c:/test.js"/script Now, this test will use FileSystemObject to read/write file. Since, the "file:///c:/test.js" is a javascript file from local hard disk, so it should probable be able to read/write file on my local hard disk. I tried it but firefox prevented the "file:///c:/test.js" script to read/write files from local diak :( What i want to know is: Is there any setting in firefox about:config where we can specify to let a particular script, say from localfile or xyz.com, to have read/write permission on my local disk files??

    Read the article

  • Escape apostrophe when passing parameter in onclick event

    - by RememberME
    I'm passing the company name to an onclick event. Some company names have apostrophes in them. I added '.Replace("'", "'")' to the company_name field. This allows the onclick event to fire, but the confirm message displays as "Jane's Welding Company". <a href="#" onclick="return Actionclick('<%= Url.Action("Activate", new {id = item.company_id}) %>', '<%= Html.Encode(item.company1.company_name.Replace("'", "&#39;")) %>');" class="fg-button fg-button-icon-solo ui-state-default ui-corner-all"><span class="ui-icon ui-icon-refresh"></span></a> <script type="text/javascript"> function Actionclick(url, companyName) { if (confirm('This action will activate this company\'s primary company ('+companyName+') and all of its other subsidiaries. Continue?')) { location.href = url; }; };

    Read the article

  • Dreaded python encoding errors, how to stop them?

    - by Rhubarb
    These have been plaguing me endlessly. Why? It seems that my console can't handle the encoding. I take it that the my browser and word processor can handle it. I don't have a master list of all the possible characters that it's choking on. What is the best way to relieve this without modifying my data? 'charmap' codec can't encode character u'\xca'

    Read the article

  • Facebook Like button working but not sharing

    - by Victor P
    Im using the XFBML version of the Like button but the "Share it" box with the space to leave a comment doesn't show up after clicking "Recommend". The rest works fine. Im using this code: <fb:like href="www.google.cl" width="300" action="recommend" font="lucida grande"></fb:like> And, in the end of the page </body> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId: '1234567890', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.sessionChange', function(response) { if (response.session) { // A user has logged in, and a new cookie has been saved } else { // The user has logged out, and the cookie has been cleared } }); </script> </html> Do you know what is happening? Any advice is warmly received. Thanks

    Read the article

  • Google maps : How to open an InfoWindow for a Polygon by clicking on it?

    - by JB
    Hello ! I have a simple question, but i can't find the answer in the Google Maps API documentation... I have a map with 13 polygons drawed by the API. Here is an exemple of one of these polygons : var zone_up_montblanc = new GPolygon([ new GLatLng(46.21270329318585, 6.134903900311617), new GLatLng(46.20538443787925, 6.136844716370282), new GLatLng(46.20525043957647, 6.141375978638086), new GLatLng(46.20698751554006, 6.148050266912262), new GLatLng(46.21110286985207, 6.153203229026629), new GLatLng(46.21730757985668, 6.151718301267355), new GLatLng(46.22092122197341, 6.153676364285801), new GLatLng(46.22615123408969, 6.149844858907489), new GLatLng(46.22851200024137, 6.149876939987202), new GLatLng(46.22945159836955, 6.142758190170017), new GLatLng(46.21735908463437, 6.141457132705133), new GLatLng(46.21753573755057, 6.138058122426195), new GLatLng(46.21270329318585, 6.134903900311617) ], "#6b1f43", 2, 0.9, "#92c87f", 0.5); then : map.addOverlay(zone_up_montblanc); Polygons appears on my map, no problem. But the thing I have to do now is to open an "InfoWindow" by clicking on each polygons (with a different content for each polygons). Did someone have an idea or an example? Thanks a lot for your help !

    Read the article

  • Pagination in Tab Content of Jquery UI

    - by DR.GEWA
    I am making a page with Jquery UI TABS. In one of tabs I want to make pagination for comments. I want such thing. When user clicks on the number of the page, the data of the page , which is linked will load via ajax in the tab. Here is my code <script type="text/javascript"> $(function() { $("#tabs").tabs(); }); $('#demo').tabs({ load: function(event, ui) { $('a', ui.panel).click(function() { $(ui.panel).load(this.href); return false; }); } }); </script> How can I change this , so that any link inside the content with lets say with id "pagination" <a href="/coments?page=12&user_id=12" id="pagination">12</a> ?? Thanks beforehand I tried recently like this even and no luck. This is from http://www.bannerite.com/jquerytest/index2.php Here it work <script type="text/javascript"> $(function() { $("#tabs").tabs(); var hijax = function(panel){ $('a', panel).click(function() { /**makes children 'a' on panel load via ajax, hence hijax*/ $(panel).load(this.href, null, function(){ /**recursively apply the hijax to newly loaded panels*/ hijax(panel); }); /**prevents propagation of click to document*/ return false; }); $('form', panel).css({background: 'yellow'}).ajaxForm({ target: panel, }); }; $('#demo ul').tabs({ /**initialize the tabs hijax pattern*/ load: function(tab, panel) { hijax(panel); } }); }); </script> HEre are the HTML part as Karl gived , but no succes. When clicking on Test link its going to another page........ When clicking on I wanted to post HTML here but because of users with less reputation <10 cant give HTML with links I have posted it here http://gevork.ru/2009/12/31/jquery-ui-tab-and-pagination-html/#more-58

    Read the article

  • Reinforcement learning toy project

    - by Betamoo
    My toy project to learn & apply Reinforcement Learning is: - An agent tries to reach a goal state "safely" & "quickly".... - But there are projectiles and rockets that are launched upon the agent in the way. - The agent can determine rockets position -with some noise- only if they are "near" - The agent then must learn to avoid crashing into these rockets.. - The agent has -rechargable with time- fuel which is consumed in agent motion - Continuous Actions: Accelerating forward - Turning with angle I need some hints and names of RL algorithms that suit that case.. - I think it is POMDP , but can I model it as MDP and just ignore noise? - In case POMDP, What is the recommended way for evaluating probability? - Which is better to use in this case: Value functions or Policy Iterations? - Can I use NN to model environment dynamics instead of using explicit equations? - If yes, Is there a specific type/model of NN to be recommended? - I think Actions must be discretized, right? I know it will take time and effort to learn such a topic, but I am eager to.. You may answer some of the questions if you can not answer all... Thanks

    Read the article

  • does Entity Framework have a caching mechanism like DataSet/DataTables have?

    - by Greg
    Hi, does Entity Framework have a caching mechanism like DataSet/DataTables have? In other words if you start using EF is it really just a way to easily get data in/out of the database without providing an additional caching layer like DataSet/DataTables did where you have an in-memory representation (on-line/off-line) and which at some point you could say to "persist all changes to database"

    Read the article

  • sitemesh vs jsp-config (<include-prelude>)

    - by Nrj
    Please help clarifying : In web.xml I have the following <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> <page-encoding>utf-8</page-encoding> <include-prelude>/jstlTaglibs.jspf</include-prelude> </jsp-property-group> </jsp-config> Also in decorators.xml I have <decorator name="footer" page="footer.jsp"> <pattern>*.action</pattern> </decorator> which is used via sitemesh.xml. The footer.jsp which says ... <decorator:body /> <@include .. "footer.jsp"/> So what I gather is, both of the codes above in a sense inject some jspf. Please help highlighting the differences and benefits of both the approaches. Also which one is more used across industry ?

    Read the article

  • How can I locate the indexpath of the UITableviewCell a certain button is in when I click that butto

    - by Jake
    I've added a button as an accessory view to uitableviewcell, and I when I press it, I'd like to be able to access the index path of the table view cell it's currently inside of so I can delete/modify the contents of that cell. Should I subclass UIbutton and add make it have it's own index path property? If so, do I need to implement any specific button methods in that subclass of will they automatically be loaded? Any help would be greatly appreciated. Sorry if this is a noobie question.

    Read the article

  • Application Interface between a PC and an embedded device

    - by sasayins
    Hi, How can I make an application interface so that a PC application can communicate to an embedded device like a POS terminal? Like for example, an embedded device like POS terminal that has an embedded linux as an OS. Then I want a PC application to communicate in that POS terminal and access its module hardware like for example its magnetic stripe reader. What implementation should I create in the device, should I use CORBA or something related in that technology so that a PC application can communicate in the POS terminal? Many thanks.

    Read the article

  • jQuery, insertBefore, validation, Placement of error message

    - by Steve
    I am using insertBefore under errorplacement to add validation messages, each one below each other as I want the order of the messages to go from top to bottom. I am using a hidden input at the very bottom of a parent element in order to supply an element for the insertBefore argument. Is there a way to insert from the bottom without using the dummy hidden element? If I use absolute positioning, there is a possibility for white space, for example 3 stacked messages, the middle one missing since there is no collapsing with absolute positioning.

    Read the article

  • Portable shebang line

    - by Mike
    #!/usr/bin/perl This is the shebang line to a lot of scripts I'm writing lately. Hard coding the path of the binary seems like it could create some problems. For instance, if one of my users has Perl installed at /something_else/bin then they'd have to change all the shebangs. I've seen some tools that will automatically replace the shebangs, but I'm wondering if there is something simpler.

    Read the article

  • 1136: Incorrect number of arguments. Expected 0.? AS3 Flash Cs4

    - by charmaine
    Basically i am working through a book called..Foundation Actionscript 3.0 Animation, making things move. i am now on Chapter 9 - collision detection. On two lines of my code i get the 1135 error, letting me know that i have an incorrect number of arguments. Can anybody help me out on why this may be? package { import flash.display.Sprite; import flash.events.Event; public class Bubbles extends Sprite { private var balls:Array; private var numBalls:Number = 10; private var centerBall:Ball; private var bounce:Number = -1; private var spring:Number = 0.2; public function Bubbles() { init(); } private function init():void { balls = new Array(); centerBall = new Ball(100, 0xcccccc); addChild(centerBall); centerBall.x = stage.stageWidth / 2; centerBall.y = stage.stageHeight / 2; for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = new Ball(Math.random() * 40 + 5, Math.random() * 0xffffff); ball.x = Math.random() * stage.stageWidth; ball.y = Math.random() * stage.stageHeight; ball.vx = Math.random() * 6 - 3; ball.vy = Math.random() * 6 - 3; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { for(var i:uint = 0; i < numBalls; i++) { var ball:Ball = balls[i]; move(ball); var dx:Number = ball.x - centerBall.x; var dy:Number = ball.y - centerBall.y; var dist:Number = Math.sqrt(dx * dx + dy * dy); var minDist:Number = ball.radius + centerBall.radius; if(dist < minDist) { var angle:Number = Math.atan2(dy, dx); var tx:Number = centerBall.x + Math.cos(angle) * minDist; var ty:Number = centerBall.y + Math.sin(angle) * minDist; ball.vx += (tx - ball.x) * spring; ball.vy += (ty - ball.y) * spring; } } } ***private function move(ball:Ball):void*** { ball.x += ball.vx; ball.y += ball.vy; if(ball.x + ball.radius > stage.stageWidth) { ball.x = stage.stageWidth - ball.radius; ball.vx *= bounce; } else if(ball.x - ball.radius < 0) { ball.x = ball.radius; ball.vx *= bounce; } ***if(ball.y + ball.radius > stage.stageHeight)*** { ball.y = stage.stageHeight - ball.radius; ball.vy *= bounce; } else if(ball.y - ball.radius < 0) { ball.y = ball.radius; ball.vy *= bounce; } } } } The bold parts are the lines im having trouble with! please help..thanks in advance!!

    Read the article

  • Stack Overflows in the Eclipse JSP Editor

    - by stevedbrown
    When editing JSPs in Eclipse, I periodically get stack overflows. Once I get one, each time I click a character I get a pop-up telling me there was another stack overflow. This continues until I close the JSP and re-open it, at which time it's fine for a while. org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser: input could not be parsed correctly at position 1 java.lang.StackOverflowError Has anyone else seen this issue, do you know the cause, and is there a way to fix it?

    Read the article

  • CGBitmapContextCreate issue while trying to resize images

    - by Jeff
    Hello! I'm running into an issue when I try to create a CGContextRef while attempting to resize some images: There are the errors Sun May 16 20:07:18 new-host.home app [7406] <Error>: Unable to create bitmap delegate device Sun May 16 20:07:18 new-host.home app [7406] <Error>: createBitmapContext: failed to create delegate. My code looks like this - (UIImage*) resizeImage:(UIImage*)originalImage withSize:(CGSize)newSize { CGSize originalSize = originalImage.size; CGFloat originalAspectRatio = originalSize.width / originalSize.height; CGImageRef cgImage = nil; int bitmapWidth = newSize.width; int bitmapHeight = newSize.height; CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(nil, bitmapWidth, bitmapHeight, 8, bitmapWidth * 4, colorspace, kCGImageAlphaPremultipliedLast); if (context != nil) { // Flip the coordinate system //CGContextScaleCTM(context, 1.0, -1.0); //CGContextTranslateCTM(context, 0.0, -bitmapHeight); // Black background CGRect rect = CGRectMake(0, 0, bitmapWidth, bitmapHeight); CGContextSetRGBFillColor (context, 0, 0, 0, 1); CGContextFillRect (context, rect); // Resize box to maintain aspect ratio if (originalAspectRatio < 1.0) { rect.origin.y += (rect.size.height - rect.size.width / originalAspectRatio) * 0.5; rect.size.height = rect.size.width / originalAspectRatio; } else { rect.origin.x += (rect.size.width - rect.size.height * originalAspectRatio) * 0.5; rect.size.width = rect.size.height * originalAspectRatio; } CGContextSetInterpolationQuality(context, kCGInterpolationHigh); // Draw image CGContextDrawImage (context, rect, [originalImage CGImage]); // Get image cgImage = CGBitmapContextCreateImage (context); // Release context CGContextRelease(context); } CGColorSpaceRelease(colorspace); UIImage *result = [UIImage imageWithCGImage:cgImage]; CGImageRelease (cgImage); return result; }

    Read the article

  • VB.NET 2008 - Anonymous Function

    - by James Brauman
    Hi, On Form Load I populate a menu with all possible colors so they user can pick a color. However when they pick a color the forecolor of my label is not changed. Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' When the form loads, we want to populate the color menu item with all the possible colors that we could change the label to. For Each currentColor As KnownColor In [Enum].GetValues(GetType(KnownColor)) ' Declare the knowColor again - we must do this to be able to do anonymous delegates in VB.NET Dim actualCurrentColor As KnownColor = currentColor ' Get the name for this color Dim colorName As String = [Enum].GetName(GetType(KnownColor), actualCurrentColor) ' Create a new menu item for this color Dim newMenuItem As ToolStripMenuItem = New ToolStripMenuItem(colorName) ' Add a handler to this menu item so when it is clicked, we change the heading color AddHandler newMenuItem.Click, Function(s As System.Object, events As System.EventArgs) (HeadingLabel.ForeColor = Color.FromKnownColor(actualCurrentColor)) ' Add the menu item to the colors menu ColorToolStripMenuItem.DropDownItems.Add(newMenuItem) Next End Sub What am I doing wrong? Thanks

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >