Daily Archives

Articles indexed Tuesday April 6 2010

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

  • Creating a closeable tab in Mono/GTK

    - by Chumpy
    I'm trying to create new GTK Notebook tabs that contain both a name (as a Label) and a close button (as a Button with an Image) with the following code: Label headerLabel = new Label(); headerLabel.Text = "Header"; HBox headerBox = new HBox(); Button closeBtn = new Button(); Image closeImg = new Image(Stock.Close, IconSize.Menu); closeBtn.Image = closeImg; closeBtn.Relief = ReliefStyle.None; headerBox.Add(headerLabel); headerBox.Add(closeBtn); headerBox.ShowAll(); MyNotebook.AppendPage(childWidget, headerBox); This seems to work just fine; however, the button is about 1.5 - 2 times the size is needs to be, so there is a lot of extra space around the image inside the button. Having looked at remove inner border on gtk.Button I now see that the culprit is the "inner-border" style property of the GtkButton, but (being new to GTK) I can't seem to figure out how to override its value. Is there some method of doing this that I'm missing? I don't have any reservations about not using a Button/Image combination, so any more obvious suggestions are welcome. Note: I have seen the suggestion in the linked question to use an EventBox, but I was not able to add the Relief and mouseover effects to that Widget.

    Read the article

  • NSDate - GMT on iPhone

    - by Mick Walker
    I have the following code in a production application which calculates a GMT date from the date the user enters: NSDate *localDate = pickedDate; NSTimeInterval timeZoneOffset = [[NSTimeZone defaultTimeZone] secondsFromGMT]; // You could also use the systemTimeZone method NSTimeInterval gmtTimeInterval = [localDate timeIntervalSinceReferenceDate] - timeZoneOffset; NSDate *gmtDate = [NSDate dateWithTimeIntervalSinceReferenceDate:gmtTimeInterval]; The code was working fine, until the dreaded daylight savings time came into force in the UK last week. How can I convert the date into GMT whilst taking into account daylight savings?

    Read the article

  • Can aptitude for learning Programming paradigms be influenced by culture or native language's gramma

    - by DVK
    It is well known that different people have different aptitudes regarding various programming paradigms (e.g. some people have trouble learning non-procedural, especially functional languages. Some people have trouble understanding pointers - see Joel Spolsky's blog for musings on that. Some people have trouble grasping recursion). I was recently reading about a study that looked at how the grammar of someone's native language affected their speed of learning math. Can't find that article now but a quick googling found this reference. That led me to wondering whether someone's native culture or first language might affect their aptitude towards various programming paradigms. I'm more curious about positive influences - e.g. some trait that make it easier/faster for someone to learn a particular paradigm, for example native language grammar being very recursion-oriented. To be clear, I'm looking for how culture/language grammare may affect the difference between aptitude of the same person towards various paradigms as opposed to how it affects overall aptitude towards programming between different persons. Important: the only answers I'm interested in are either references to scientific studies, or personal observations from someone intimately familiar with a particular culture/language, including from their own experience. E.g. I'm not interested in your opinion of how Chinese being your first language affects anything unless you speak Chinese or worked with extremely large set of Chinese-native programmers extensively. I'm OK with your guesstimates not based on scientific studies, but please be sure to supply your reasoning about plausible causes of your observation. I'm not interested in culture-bashing (any such commends will be deleted or flagged for deletion). I'm also not particularly interested in culture-building - we all know Linus is from Finland and Tetris was written in Russia and Larry Wall is an American. Any culture/nation can produce a brilliant mind in any discipline. I'm interested in averages.

    Read the article

  • Schliemann's method of programming language learning

    - by DVK
    Background: 19th-century German archeologist Heinrich Schliemann was of course famous for his successful quest to find and excavate the city of Troy (an actual archeological site for the Troy of Homer's Iliad). However, he is just as famous for being an astonishing learner of languages - within the space of two years, he taught himself fluent Dutch, English, French, Spanish, Italian and Portuguese, and later went on to learn seven more, including both modern and ancient Greek. One of the methods he famously used was comparison of a known text, e.g. take a book in a language one is fluent in, take a good translation of a book in a language you wish to learn, and go over them in parallel. (various sources cited the book used by Schliemann to be the Bible, or, as the link above states, a novel). Now, for the actual question. Has anyone used (or heard of) an equivalent of Schliemann's method for learning a new programming language? E.g. instead of basing the leaning on references and tutorials, take a somewhat comprehensive set of programs known to have high-quality code in both languages implementing similar/identical algorithms and learn by comparing them? I'm curious about either personal experiences of applying such an approach, or references to something published, or existance of codebases which could be used for such an approach? What got me thinking about the idea was Project Euler and some code snippets I saw on SO, in C++, Perl and Lisp.

    Read the article

  • How to Transform a user's search string into a MS SQL Full-Text Search Phrase

    - by Atomiton
    I've search for answers for this and I can't seem to find an answer to what should be somewhat simple. This is related to another question I asked, but it's different. What's the best way to take a user's search phrase and throw it into a CONTAINSTABLE(table, column, @phrase, topN ) phrase? Say, for example the user inputs: Books by "Dr. Seuss" What's the best way to turn that into something that will return results in my ContainsTAble() phrase? I was previously parsing the search phrase and writing something like ISABOUT("Books" WEIGHT(1.0), "by" WEIGHT(0.9), "Dr. Seuss" WEIGHT(0.8)) as my @phrase but ISABOUT seems to be returning odd results... especially when one word searches are entered. Any Ideas?

    Read the article

  • PHP to C/C++ through CGI script

    - by Peterim
    Hi guys! I realize it's probably something strange, but here is what I have. I have an application (handwriting recognition engine) written in C/C++. This application has Perl wrapper which was made by application's authors using SWIG. My website is written in PHP, so I'm looking for some ways to make PHP work with C/C++ application. The only way I can think of now is to create a CGI script (perl script) which accepts POST request from my website (AJAX request), sends it to the recognition engine through it's Perl wrapper, gets the required data and returns the required data as a response to AJAX request. Do you think it could be done this way? Are there any better solutions? Thank you!

    Read the article

  • Access Internet From My Blackberry App

    - by Ankit
    Hi all, This is my first attemp to code a blackberry app so please bear with me. I am developing an app to make it easy to access certain information from certain websites using screenscrapping. Now I am done with the ui part of the application onto the internet access part. My question is how do i access internet from my app ? I see that blackberry offers http, wifi and some other forms to access the internet ... does my app need to be worried about what mode is being used ? or as far as my app is concerned theres a general api to access the net with the logic of connecting to the internet being handled by the device itself ..? any pointers with some sample code would be much appreciated. thank you, ankit

    Read the article

  • jQuery Plugin for TinyMCE callback

    - by SomewhereThere
    I am using the jQuery plugin from the jQuery build of TinyMCE. This simplified code initializes the editor: $('textarea.tinymce').tinymce({ script_url : '../js/libraries/tiny_mce/tiny_mce.js' }); This loads tiny_mce.js via AJAX. I have code that I want to run once this file is loaded. I essentially want to specify a callback function, but there is no mention of this in the documentation for the plugin. Any ideas? I would be up for adding the functionality if it is not there but I cannot find an uncompressed version of the plugin.

    Read the article

  • Simple form not working anymore, since adding jquery tablesorter on same page

    - by Michael
    Hi, I'm using jquery and tablesorter plugin to sort a table in a php-page, which works flawless. Further I have this form in it: <form name="newrs" id="newrs" action="edit.php" enctype="multipart/form-data" method="POST" onSubmit=""> <input class="btn" id="bbtnNew" name="button" type="submit" value="New Recordset" /> </form> But since I added the jquery/tablesorter functionality, the form doesn't work anymore. (If I click on submit, nothing happens. What causes this behaviour? And how can I overcome this? Thanks in advance for your suggestions! .... Initializing the tablesorter with this code: <script type="text/javascript"> $(document).ready(function() { $("#myTable").tablesorter( { sortList: [ [4,1] ] , widgets: ['zebra'] } ); } ); </script>

    Read the article

  • iPhone UITextField - Change placeholder text color

    - by adam
    I'd like to change the color of the placeholder text I set in my UITextField controls, to make it black. I'd prefer to do this without using normal text as the placeholder and having to override all the methods to imitate the behaviour of a placeholder. I believe if I override this method.. - (void)drawPlaceholderInRect:(CGRect)rect ..then I should be able to do this. But I'm unsure how to access the actual placeholder object from within this method.

    Read the article

  • Parsing GeoRSS Feed with jQuery

    - by senfo
    I'm attempting to use the jQuery jFeed plugin for parsing an Atom, GeoRSS feed and I'm running into issues extracting the information I need. For example, I need to extract the summary element and I would like to render the contents in a div on my HTML page. Additionally, I'd like to extract the contents from the georss:point elements and pass them into Google Maps to render them as points on a map. The problem is that it seems jFeed is stripping out the GeoRSS-related information. For example, I can extract the title element without issues, but it seems it doesn't extract the summary or georss:point elements, at all. Following is a snippet of the XML I'm working with: <feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss"> <title>Search Results from DataWarehouse.HRSA.gov</title> <link rel="self" href="http://datawarehouse.hrsa.gov/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10"/> <link rel="alternate" href="http://datawarehouse.hrsa.gov/"/> <author> <name>HRSA Geospatial Data Warehouse</name> </author> <id>tag:datawarehouse.hrsa.gov,2010-04-05:/</id> <updated>2010-04-05T19:25:28-05:00</updated> <entry> <title>Christ House</title> <link href="http://www.christhouse.org" /> <id>tag:datawarehouse.hrsa.gov,2010-04-05:/D388C4C6-FFA4-4091-819B-64D67DC64931</id> <summary type="xhtml"> <div xmlns="http://www.w3.org/1999/xhtml"> <div class="vcard"> <div class="fn org">Christ House</div> <div class="adr"> <div class="street-address">1717 Columbia Rd. N.W.</div> <span class="locality">Washington</span>, <span class="region">District of Columbia</span>, <span class="postal-code">20009-2803</span> </div> <div class="tel">202-328-1100</div> </div> <div> Categories: <span class="category">Service Delivery Site</span> </div> </div> </summary> <georss:point>38.9243636363636 -77.0395636363637</georss:point> <updated>2010-04-04T00:00:00-05:00</updated> </entry> </feed> Following is the jQuery code that I'm using: $(document).ready(function() { $.getFeed({ //url: 'http://datawarehouse.hrsa.gov/HGDWDataWebService/HGDWDataService.aspx?service=HC&zip=20002&radius=10', url: 'test.xml', success: function(feed) { $.each(feed.items, function(index, value) { $('#rssContent').append(value.title); // Set breakpoint here }); } }); }); I set a breakpoint on the line that appends to the rssContent div and noticed the objects in feed.items don't have the properties I'm after. Am I doing something wrong or was jFeed simply not designed to work the way I want it to?

    Read the article

  • How can you replace the src of an image that points to mjpeg?

    - by user165623
    I have an application that displays images from network cameras. The application will show multiple images on a single page. Each image container has a button on it that causes jQuery to scale that image up to fill a 64x480 div vs much smaller when multiple images are present. I change the src in the image with jquery as you'd expect: $("#imageId").attr("src", "http://cameraUrl.com:6000?width=640&height=480&d="+date.getTime()); the date.getTime() is intended to override the caching in a browser. It works for retrieving still images. Sometimes the video changes to the larger resolution. Other times it just sticks with the original image scaled up to fit the larger div as if it is not loading the new URL. This is evident by the fact it's grainy and the text overlay from the camera is scaled up. Occasionally the image finally loads in the higher resolution version and it works evidenced by the image clarity and the text overlay scaling to what it should be. Is there a correct way to force the setting of an image src where the src points to a motion jpeg stream to reload?

    Read the article

  • insert radiobox in menu in forms

    - by netmajor
    Hey, How can I insert radiobutton in Menu as Menu item. I use WinForms and there I see only few option to insert other controls, but no radio :/ Also it's impossible to drag it from Controls and drop in menu in Design View :/

    Read the article

  • Runtime-error in wpf with Window.AllowsTransparent set to true.

    - by Alxandr
    I get an exception thrown at runtime when I set AllowsTransparent="True" I get an exception saying the WindowStyle can not be set to None if AllowsTransparent is set to true. Even if I explicitly say that WindowStyle is set to SingleBorder I get this error. However, if I set WindowStyle to SingleBorder and remove the AllowsTransparent-tag, I get no error, and the top of the window (the icon, name and close, minimize and maximize-buttons) disappears. Anyone knows what can cause this? Or is it just a bug in .Net 4.0 rc?

    Read the article

  • xcode 3.2 c++: how can i enable a proper code completion?

    - by ufk
    Hiya. I have snow leopard and I'm building a cpp Application with xcode. I would like to be able to get proper code completion with xcode, and by that i mean the following: std::string f; f. just when I type f. i would like to see all the relevant functions to that string class. is it possible in xcode ?

    Read the article

  • growl example windows 7

    - by acidzombie24
    I grabbed the growl for .NET on this page http://www.growlforwindows.com/gfw/developers.aspx i ran the examples and nothing happened. Am i suppose to do something before running the example? I am using windows 7.

    Read the article

  • Org-mode properties for Emacs diary anniversaries?

    - by lecodesportif
    I am trying to have the "Birthday" property of an Org-mode contact entry added to the agenda automatically: * John :PROPERTIES: :Name: John :Birthday: 5 4 1900 :END: This can be done manually for each entry using: %%(diary-anniversary 5 4 1900) John's birthday But I don't want to type the date twice. I would like to use the org-entry-get functionality to make diary-anniversary take the values of the Birthday and Name (see the bold text above) properties. This is how I get the correct property values. %%(org-entry-get nil "Name") %%(org-entry-get nil "Birthday") But after several attempts, I still haven't managed to put the values in variables and pass them correctly to diary-anniversary. Any ideas how to do it?

    Read the article

  • iPhone Safari does not auto scale back down on portrait->landscape->portrait

    - by Tom
    Hi, I have a very simple HTML page with this META tag for the iPhone: <meta name="viewport" content="height=device-height,width=device-width,initial-scale=1.0,user-scalable=no" /> When the page loads in portrait mode it looks fine and the width fits the screen. When I rotate the iPhone to landscape mode the web page is auto resized to fit the landscape width. Good, this is what I want. But when I rotate back to landscape, the page is not resized back to fit the portrait width like it was before. It remains in the landscape width. I want the iPhone to set it back to the right width automatically, just like it did for the landscape mode. I don't think this should involve orientation listeners because it is all done automatically and I don't have any special styling for the different modes. Why doesn't the iPhone resize the web page back in portrait mode? How do I fix this? Thanks! Tom.

    Read the article

  • Is this so bad when using MySQL queries in PHP?

    - by alex
    I need to update a lot of rows, per a user request. It is a site with products. I could... Delete all old rows for that product, then loop through string building a new INSERT query. This however will lose all data if the INSERT fails. Perform an UPDATE through each loop. This loop currently iterates over 8 items, but in the future it may get up to 15. This many UPDATEs doesn't sound like too good an idea. Change DB Schema, and add an auto_increment Id to the rows. Then first do a SELECT, get all old rows ids in a variable, perform one INSERT, and then a DELETE WHERE IN SET. What is the usual practice here? Thanks

    Read the article

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