Search Results

Search found 521 results on 21 pages for 'alexander cohen'.

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

  • Help with possible Haskell type inference quiz questions

    - by Linda Cohen
    foldr:: (a -> b -> b) -> b -> [a] -> b map :: (a -> b) -> [a] -> [b] mys :: a -> a (.) :: (a -> b) -> (c -> a) -> c -> b what is inferred type of: a.map mys :: b.mys map :: c.foldr map :: d.foldr map.mys :: I've tried to create mys myself using mys n = n + 2 but the type of that is mys :: Num a => a -> a What's the difference between Num a = a - a and just a - a? Or what does 'Num a =' mean? Is it that mys would only take Num type? So anyways, a) I got [a] - [a] I think because it would just take a list and return it +2'd according to my definition of mys b) (a - b) - [a] - [b] I think because map still needs take both arguments like (*3) and a list then returns [a] which goes to mys and returns [b] c) I'm not sure how to do this 1. d) I'm not sure how to do this 1 either but map.mys means do mys first then map right? Are my answers and thoughts correct? If not, why not? THANKS!

    Read the article

  • How are binding specified for Interface Builder plugins?

    - by Benedict Cohen
    I'm creating an Interface Builder plugin for an NSView subclass. I've been following the Interface Builder Plug-in Programming Guide but it's not answer all my questions. My class has one NSString property and 4 NSColor properties which I want to create bindings for at design time. I can't figure out where the bindings are specified in the plugin project. The documentation states that the Inspector Object is only for creating the Attribute Inspector. The class description file (.classdescription) lists outlets and actions but not bindings. Where do I specify the bindings for my class?

    Read the article

  • Javascript works great locally, but not on my server

    - by Jonathan Cohen
    I'm teaching myself javascript by creating a script for displaying an external rss feed on a webpage. The code I patched together works great locally. This is a screen grab of the code producing exactly the desired behavior. The code is populating all the information inside the section "Blog: Shades of Gray", except for "tagged" which I hard coded: But when I upload the site files to my server, the code doesn't work at all. This is a screen grab of the code on my site NOT producing the desired behavior... This feels like I'm not getting something really basic about how javascript works locally vs. on the server. I did my half hour of googling for an answer and no trails look promising. So I'd really appreciate your help. This is my site (under construction) http://jonathangcohen.com Below is the code, which can also be found at http://jonathangcohen.com/grabFeeds.js. /*Javascript for Displaying an External RSS Feed on a Webpage Wrote some code that’ll grab attributes from an rss feed and assign IDs for displaying on a webpage. The code references my Tumblr blog but it’ll extend to any RSS feed.*/ window.onload = writeRSS; function writeRSS(){ writeBlog(); } function writeBlog(){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","http://blog.jonathangcohen.com/rss.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("item"); //append category to link for (i=0;i<3;i++) { if (i == 0){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory1").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate1").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle1").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } if (i == 1){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory2").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate2").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle2").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } if (i == 2){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory3").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate3").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle3").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } } } function formatTumblrDate(k){ d = new Date(k); var curr_date = d.getDate(); var curr_month = d.getMonth(); curr_month++; var curr_year = d.getFullYear(); printDate = (curr_month + "/" + curr_date + "/" + curr_year); return printDate; } Thank you!

    Read the article

  • ObjectiveFlickr - how to call getSizes on a photo ID not known until the response?

    - by Jonathan Cohen
    Hi guys, I'm building a free music instrument iPhone app with the Flickr API and ObjectiveFlickr.A random photo from the interestingness list is displayed in the background, but I can't center it without knowing its size. (so I can reset the UIWebView frame) I've been researching this for awhile, and if the answer is super easy, please have some mercy on a noob - it's my first time playing with a web service API. =) Since I don't know the photo ID until after I receive the response from the interestingness feed, how would I call flickr.photo.getSizes on the response? This is what I have so far: - (void)flickrAPIRequest:(OFFlickrAPIRequest *)inRequest didCompleteWithResponse:(NSDictionary *)inResponseDictionary{ int randomResponse = arc4random() % 49; photoDict = [[inResponseDictionary valueForKeyPath:@"photos.photo"] objectAtIndex:randomResponse]; NSString *photoID = [photoDict valueForKeyPath:@"id"]; NSLog(@"%@",photoID); NSURL *photoURL = [flickrContext photoSourceURLFromDictionary:photoDict size:OFFlickrMediumSize]; NSString *htmlSource = [NSString stringWithFormat: @"<html>" @"<head>" @" <style>body { margin: 0; padding: 0; } </style>" @"</head>" @"<body>" @"<img src=\"%@\" />" @"</body>" @"</html>" , photoURL]; [webView loadHTMLString:htmlSource baseURL:nil]; }

    Read the article

  • How do you solve this Haskell problem using a fold map and take?

    - by Linda Cohen
    Define a function replicate which given a list of numbers returns a list with each number duplicated its value. Use a fold, map, and take .. replicate [5,1,3,2,8,1,2] output: [5,5,5,5,5,1,3,3,3,2,2,8,8,8,8,8,8,8,8,1,2,2] I've figure this out using List comprehension and recursion: replicate2 [] = [] replicate2 (n:nn) = take n(repeat n) ++ replicate2 nn but how would you use fold and map to do this? so far I have: replicate n = map (foldl1 (take n(repeat n)) n) n which is obviously wrong, but I think I am close.. so any help would be nice, THANKS!

    Read the article

  • How to determine if code is running in Foundation or GUI?

    - by Mitch Cohen
    I'm writing a Mac app with two targets - a regular Cocoa GUI and a Foundation command-line tool. They do very similar things other than the GUI, so I'm sharing most of the code between the two. I'd like to do a few things slightly differently depending on which target is running. I can think of many ways to do this (#define something in the pch, check for existence of GUI definitions...). I'm curious if there's a standard or recommended way to do this. Thanks!

    Read the article

  • Is there a way to send a blog post to wordpress via an api?

    - by Yuval Cohen
    In more details: I want to build a web service to which users register and by browsing my site, users can send blog posts to their own blogs. Initially wordpress.org is discussed. However, I'll be happy to hear solutions for typepad or wordpress.com as well. The ideal solution would be a way for my server to simply "tell" their blog what to post (as a draft of course for them to confirm). A good solution would be for my users to install a plugin in their blog that will allow my server the above functionality. Lacking any other solution, I would give my users text to copy-paste into their blog editor. Help me find a solution and feel free to be creative!

    Read the article

  • android: how to create multiply views screen?

    - by avi cohen
    hello, i'm beginner at android development. i want to create an activity, which shows a question with 4 answers, and at the bottom of the screen i want to place a timer. i have already found timer example, and i created a question with the answers. the problem that they are 2 different projects and activities, and i am looking for the best way to implement it. i think i can't show 2 activities on one screen, but i can show 2 views or shell i use the ViewGroup, or maybe to copy-paste one of the activities code to another ( its the easiest way but probably the most ugliest way to implement it). please tell me what is the best way, that i will study and not to waste time to study all the ways and only then to choose one of them. thanks!

    Read the article

  • C++ for Ruby scripters

    - by Aaron Cohen
    I am a fairly capable Ruby scripter/programmer, but have been feeling pressure to branch out into C++. I haven't been able to find any sites along the lines of "C++ for Ruby Programmers". This site exists for Python (which is quite similar, I know). Does anyone know of a guide that can help me translate my Ruby 'thoughts' into C++?

    Read the article

  • Disable page redirects using Greasemonkey

    - by Tomer Cohen
    A website I wish to tweak is using window.location in order to redirect specific users to a blocking page. That website is doing it in plain <script> tag, so it is impossible to bypass it by overriding the onload event using document.body.setAttribute('onload','');. Is there another way to inject my code to the page without using Firefox extensions such as NoScript? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> if (1) window.location="http://example.net" </script> </head> <body></body> </html>

    Read the article

  • Types in Haskell

    - by Linda Cohen
    I'm kind of new in Haskell and I have difficulty understanding how inferred types and such works. map :: (a -> b) -> [a] -> [b] (.) :: (a -> b) -> (c -> a) -> c -> b What EXACTLY does that mean? foldr :: (a -> b -> b) -> b -> [a] -> b foldl :: (a -> b -> a) -> a -> [b] -> a foldl1 :: (a -> a -> a) -> [a] -> a What are the differences between these? And how would I define the inferred type of something like foldr map THANKS!

    Read the article

  • Regular Expression to isolate an html tag

    - by orit cohen
    I'm looking for a regular expression to isolate an html tag. This includes the TAG the ATTRIBUTES and the CONTNET inside. Let's say I have this: <html> <body> aajsdfkjaskd <TAGNAME name="bla" context="non">hfdfhdj </TAGNAME> </body> </html> I need a regular expression that would return: <TAGNAME name="bla" context="non">hfdfhdj </TAGNAME> Thank, Joe

    Read the article

  • Fetch a Rails ActiveRecord 'datetime' attribute as a DateTime object.

    - by Tobias Cohen
    I have an attribute in one of my models that contains a Date/Time value, and is declared using t.datetime :ended_on in my migrations. When I fetch this value using myevent.ended_on, I get a Time object. The problem is that when I try to use this attribute as an axis in a Flotilla chart, it doesn't work properly because Flotilla only recognizes dates as Date or DateTime objects. I thought about writing a virtual attribute that will convert the existing Time value to a DateTime, but I'm wary of doing this, since I've heard that Time can't handle dates later than 2040, and I don't wish to risk creating a "2040 bug" to worry about later. Is there any way I can persuade ActiveRecord to return DateTime objects for this attribute instead of Time objects?

    Read the article

  • Dreamweaver CS4 - How do you preview in Browser?

    - by Linda Cohen
    I'm new to Dreamweaver CS4 and making my first website. I've watched a lot of tutorials and they all just click the Preview in Browser button and they can see what their page looks like in Firefox/IE/etc. But when I click Preview in Browser a new Firefox window opens up and it goes to my homepage and that's it. What do I need to setup in order be able to preview in firefox? THANKS!

    Read the article

  • How do you solve this Haskell problem?

    - by Linda Cohen
    I want to define a function replicate to replicate a list of numbers by its value using only list comprehension, for example: replicate [5,1,3,2,8,1,2] output: [5,5,5,5,5,1,3,3,3,2,2,8,8,8,8,8,8,8,8,1,2,2] I know this would be easy to use the 'replicate' built in function but only list comprehension is allow, how can I do this? THANKS!

    Read the article

  • python search replace using wildcards

    - by tom smith
    hi somewhat confused.. but trying to do a search/repace using wildcards if i have something like: <blah.... ssf ff> <bl.... ssf dfggg ff> <b.... ssf ghhjj fhf> and i want to replace all of the above strings with say, <hh >t any thoughts/comments on how this can be accomplished? thanks update (thanks for the comments!) i'm missing something... my initial sample text are: Soo Choi</span>LONGEDITBOX">Apryl Berney Soo Choi</span>LONGEDITBOX">Joel Franks Joel Franks</span>GEDITBOX">Alexander Yamato and i'm trying to get Soo Choi foo Apryl Berney Soo Choi foo Joel Franks Joel Franks foo Alexander Yamato i've tried derivations of name=re.sub("</s[^>]*\">"," foo ",name) but i'm missing something... thoughts... thanks

    Read the article

  • How can I superimpose modified loess lines on a ggplot2 qplot?

    - by briandk
    Background Right now, I'm creating a multiple-predictor linear model and generating diagnostic plots to assess regression assumptions. (It's for a multiple regression analysis stats class that I'm loving at the moment :-) My textbook (Cohen, Cohen, West, and Aiken 2003) recommends plotting each predictor against the residuals to make sure that: The residuals don't systematically covary with the predictor The residuals are homoscedastic with respect to each predictor in the model On point (2), my textbook has this to say: Some statistical packages allow the analyst to plot lowess fit lines at the mean of the residuals (0-line), 1 standard deviation above the mean, and 1 standard deviation below the mean of the residuals....In the present case {their example}, the two lines {mean + 1sd and mean - 1sd} remain roughly parallel to the lowess {0} line, consistent with the interpretation that the variance of the residuals does not change as a function of X. (p. 131) How can I modify loess lines? I know how to generate a scatterplot with a "0-line,": # First, I'll make a simple linear model and get its diagnostic stats library(ggplot2) data(cars) mod <- fortify(lm(speed ~ dist, data = cars)) attach(mod) str(mod) # Now I want to make sure the residuals are homoscedastic qplot (x = dist, y = .resid, data = mod) + geom_smooth(se = FALSE) # "se = FALSE" Removes the standard error bands But does anyone know how I can use ggplot2 and qplot to generate plots where the 0-line, "mean + 1sd" AND "mean - 1sd" lines would be superimposed? Is that a weird/complex question to be asking?

    Read the article

  • Silverlight Cream for April 28, 2010 -- #850

    - by Dave Campbell
    In this Issue: Giorgetti Alessandro, Alexander Strauss, Mahesh Sabnis, Andrea Boschin, Maxim Goldin, Peter Torr, Wolf Schmidt, and Marlon Grech. Shoutout: Koen Zwikstra announced a SL4 update: Silverlight Spy 3.0.0.11 Adam Kinney posted a WTF Step by Step guide to installing Silverlight Tools David Makogon posted his materials from a presentation: RockNUG April 2010 Materials: Silverlight 4 From SilverlightCream.com: Silverlight, M-V-VM ... and IoC - part 4 Giorgetti Alessandro isn't wasting any time... he's already gotten Part 4 of his MVVM, IoC, and Silverlight series up. He's discussing commanding. He gives some good external links and develops in his own direction as well. Application Partitioning with MEF, Silverlight and Windows Azure – Part II Alexander Strauss has the second and final part of his MEF/Silverlight/Azuer posts up, describing getting XAP information from Azure Blob storage. Simple Databinding and 3-D Features using Silverlight in Windows Phone 7 (WP7) Mahesh Sabnis has a post up combining DataBinding and 3D displays on WP7 ... good long tutorial and source. Keeping an ObservableCollection sorted with a method override Andrea Boschin details the reasons behind his need for having a sorted ObservableCollection, then hands over the code he used to do so. VS2010: Silverlight 4 profiling Maxim Goldin posted about profiling Silverlight 4 in VS2010. It's not overly straightforward but once you do it a couple times, not a big deal ... check out the comments as well. Peter Torr: Mock Location APIs from my Mix10 Talk A discussion came up on the insider's list this morning asking about Location Service in the emulator. Laurent Bugnion pointed us at Peter Torr's Mock Location from his MIX10 talk. Finding the "real" templates and generic.xaml in Silverlight core or library assemblies, by using .NET Reflector Wolf Schmidt at the Silverlight SDK has a post up about using .NET Reflector to rat around in Silverlight core or library assemblies. How does MEFedMVVM compose the catalogs and how can I override the behavior? – MEFedMVVM Part 4 Marlon Grech has Part 4 of his MEFedMVVM series up and this one is for advanced use of MEFedMVVM... where you're writing a composer and how that would be different for Silverlight and WPF... oh yeah, and what is a composer as well :) Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • La NSA dément avoir espionné l'Europe et ses dirigeants, « ce sont les Européens qui surveillent leurs citoyens dans le cadre des missions de l'OTAN »

    La NSA n'espionne pas l'Europe et ses dirigeants, ce sont les européens qui espionnent leurs citoyens dans le cadre de missions de l'OTAN» Le chef de la NSA, le général Keith Alexander, a vivement démenti tout ce que l'on pouvait voir sur les médias du monde jusqu'à maintenant. Profitant d'une audition devant la commission du renseignement de la Chambre des représentants il a annoncé calmement, mais fermement que la NSA n'avait rien mis en place pour espionner les citoyens européens.Si la NSA...

    Read the article

  • How to Convert Your Nice Designs to Wordpress

    If you already spent ample time on the net, you have probably heard about WordPress before. It is an easy to use blog platform that also seconds as a fully competent content management system all ove... [Author: Kewin Alexander - Web Design and Development - April 12, 2010]

    Read the article

  • Silverlight Cream for April 27, 2010 -- #849

    - by Dave Campbell
    In this Issue: Mike Snow, Kunal Chowdhury, Giorgetti Alessandro, Alexander Strauss, Corey Schuman, Kirupa, John Papa, Miro Miroslavov, Michael Washington, and Jeremy Likness. Shoutouts: Erik Mork and crew have posted their latest This Week In Silverlight April 23 2010 The Silverlight Team announced Microsoft releases Silverlight-powered Windows Intune beta Jesse Liberty has posted his UK and Ireland Slides and Links The Expression Blend and Design Blog reports a Minor Update to The Expression Blend 4 Release Candidate From SilverlightCream.com: Silverlight Tip of the Day #6 – Toast Notifications Mike Snow has Tip #6 up today and it's about Toast notifications in OOB apps: Restrictions, creation, showing, and the code. Silverlight Tutorials Chapter 2: Introduction to Silverlight Application Development Part 2 of Kunal Chowdhury's Introductory tutorial set is up ... he's covering how to create a Silverlight project, what's contained in it, and creating a User Control. Silverlight, M-V-VM ... and IoC - part 3 Giorgetti Alessandro has part 3 of his Silverlight, IOC, and MVVM series up... this one with an example using the code discussed previously. The project is on CodePlex, and he's not done with the series. Application Partitioning with MEF, Silverlight and Windows Azure – Part I Alexander Strauss is discussing Silverlight and MEF for loosely-coupled and partitioned apps. He's also using Azure in this discussion. geekSpeak Recording - Five Key Developer Features in Expression Blend with Corey Schuman Check out the latest geekSpeak on Channel 9 where Corey Schuman talks about the 5 key Developer Features in Expression Blend that will improve your productivity. Using the ChangePropertyAction Kirupa is discussing and demonstrating ChangePropertyAction. Check out the demo near the top of the post, then read how to do it, and download the source. 3 Free Silverlight Demos John Papa blogged about the 2 demos (with source) that have been updated to SL4, and a new one all by Microsoft Luminaries Karen Corby, Adam Kinney, Mark Rideout, Jesse Bishop, and John Papa: "ScrapBook", "HTML and Video Puzzle", and "Rich Notepad". Floating Visual Elements I like Miro Miroslavov's comment: "every Silverlight application “must” have some objects floating around in a quite 3D manner" :) ... well they do that on the CompletIT site, and this is part 2 of their explanation of how all that goodness works. MVVM – A Total Design Change Of Your Application With No Code With some Blend goodness, Michael Washington completely reorganizes the UI of an MVVM application without touching any code ... project included MVVM with Transaction and View Locator Example Jeremy Likness responded to reader requests and has an example up, with explanation, of marrying his last two posts: transactions with MVVM and View Model Locator. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

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