Search Results

Search found 2126 results on 86 pages for 'wrapper'.

Page 28/86 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • HTML coding style: attribute starts on a new line

    - by Matty
    sublvl's front end developer seems to have a strange coding style that I've never seen before. Every time they begin a new element, immediately after the element name they insert a line break. The first thing that appears on the next line is the first attribute of the element. For example: id="player-container"><div id="player-bar"><div id="player-controls-wrapper"><div id="player-controls"><div id ="player-controls-buttons"> <a The above code was found here. I've never seen this kind of coding style before. What's going on here? Is this just a quirky style or is there some reasoning behind it?

    Read the article

  • Graffiti is a Sinatra-inspired Groovy Framework

    - by kerry
    Playing around with Sinatra the other day and realized I could really use something like this for Groovy. Thus, Graffiti was born. It’s basically a thin wrapper around Jetty. At first, I thought I might write my own server for it (everybody needs to do that once, don’t they?), but decided to invoke the ’simplest thing that could possibly work’ principle. Here is the requisite ‘Hello World’ example: import graffiti.* @Grab('com.goodercode:graffiti:1.0-SNAPSHOT') @Get('/helloworld') def hello() { 'Hello World' } Graffiti.serve this The code, plus more documentation is hosted under my github account.

    Read the article

  • Most efficient way to rebuild a tree structure from data

    - by Ahsan
    Have a question on recursively populating JsTree using the .NET wrapper available via NuGet. Any help would be greatly appreciated. the .NET class JsTree3Node has a property named Children which holds a list of JsTree3Nodes, and the pre-existing table which contains the node structure looks like this NodeId ParentNodeId Data AbsolutePath 1 NULL News /News 2 1 Financial /News/Financial 3 2 StockMarket /News/Financial/StockMarket I have a EF data context from the the database, so my code currently looks like this. var parentNode = new JsTree3Node(Guid.NewGuid().ToString()); foreach(var nodeItem in context.Nodes) { parentNode.Children.Add(nodeItem.Data); // What is the most efficient logic to do this recursively? } as the inline comment says in the above code, what would be the most efficient way to load the JStree data on to the parentNode object. I can change the existing node table to suite the logic so feel free to suggest any changes to improve performance.

    Read the article

  • Some non-generic collections

    - by Simon Cooper
    Although the collections classes introduced in .NET 2, 3.5 and 4 cover most scenarios, there are still some .NET 1 collections that don't have generic counterparts. In this post, I'll be examining what they do, why you might use them, and some things you'll need to bear in mind when doing so. BitArray System.Collections.BitArray is conceptually the same as a List<bool>, but whereas List<bool> stores each boolean in a single byte (as that's what the backing bool[] does), BitArray uses a single bit to store each value, and uses various bitmasks to access each bit individually. This means that BitArray is eight times smaller than a List<bool>. Furthermore, BitArray has some useful functions for bitmasks, like And, Xor and Not, and it's not limited to 32 or 64 bits; a BitArray can hold as many bits as you need. However, it's not all roses and kittens. There are some fundamental limitations you have to bear in mind when using BitArray: It's a non-generic collection. The enumerator returns object (a boxed boolean), rather than an unboxed bool. This means that if you do this: foreach (bool b in bitArray) { ... } Every single boolean value will be boxed, then unboxed. And if you do this: foreach (var b in bitArray) { ... } you'll have to manually unbox b on every iteration, as it'll come out of the enumerator an object. Instead, you should manually iterate over the collection using a for loop: for (int i=0; i<bitArray.Length; i++) { bool b = bitArray[i]; ... } Following on from that, if you want to use BitArray in the context of an IEnumerable<bool>, ICollection<bool> or IList<bool>, you'll need to write a wrapper class, or use the Enumerable.Cast<bool> extension method (although Cast would box and unbox every value you get out of it). There is no Add or Remove method. You specify the number of bits you need in the constructor, and that's what you get. You can change the length yourself using the Length property setter though. It doesn't implement IList. Although not really important if you're writing a generic wrapper around it, it is something to bear in mind if you're using it with pre-generic code. However, if you use BitArray carefully, it can provide significant gains over a List<bool> for functionality and efficiency of space. OrderedDictionary System.Collections.Specialized.OrderedDictionary does exactly what you would expect - it's an IDictionary that maintains items in the order they are added. It does this by storing key/value pairs in a Hashtable (to get O(1) key lookup) and an ArrayList (to maintain the order). You can access values by key or index, and insert or remove items at a particular index. The enumerator returns items in index order. However, the Keys and Values properties return ICollection, not IList, as you might expect; CopyTo doesn't maintain the same ordering, as it copies from the backing Hashtable, not ArrayList; and any operations that insert or remove items from the middle of the collection are O(n), just like a normal list. In short; don't use this class. If you need some sort of ordered dictionary, it would be better to write your own generic dictionary combining a Dictionary<TKey, TValue> and List<KeyValuePair<TKey, TValue>> or List<TKey> for your specific situation. ListDictionary and HybridDictionary To look at why you might want to use ListDictionary or HybridDictionary, we need to examine the performance of these dictionaries compared to Hashtable and Dictionary<object, object>. For this test, I added n items to each collection, then randomly accessed n/2 items: So, what's going on here? Well, ListDictionary is implemented as a linked list of key/value pairs; all operations on the dictionary require an O(n) search through the list. However, for small n, the constant factor that big-o notation doesn't measure is much lower than the hashing overhead of Hashtable or Dictionary. HybridDictionary combines a Hashtable and ListDictionary; for small n, it uses a backing ListDictionary, but switches to a Hashtable when it gets to 9 items (you can see the point it switches from a ListDictionary to Hashtable in the graph). Apart from that, it's got very similar performance to Hashtable. So why would you want to use either of these? In short, you wouldn't. Any gain in performance by using ListDictionary over Dictionary<TKey, TValue> would be offset by the generic dictionary not having to cast or box the items you store, something the graphs above don't measure. Only if the performance of the dictionary is vital, the dictionary will hold less than 30 items, and you don't need type safety, would you use ListDictionary over the generic Dictionary. And even then, there's probably more useful performance gains you can make elsewhere.

    Read the article

  • Problems with brother printer drivers on 64bit 12.04

    - by Jeff Klein
    I'm running 12.04 64bit on a toshiba satellite laptop. I have a Brotrher MFC-J825dw printer. I've installed brothers driver for it and the cupswrapper but it won't print. I says it is receiving data but it never shows up in the queue. I've also tried the text only generic driver and the same thing happens. I think some dependencies are missing for the cups wrapper and when I try to find it it says it can't be installed. Nopt sure if that's the problem because it doesn't explain the generic driver failure. In any case, any ideas?

    Read the article

  • Is LightDM is broken? Autologin works

    - by Ben
    I recently upgraded my Mythbuntu box to 11.10. LightDM worked for a while and then I configured autologin on my user account. After some time, I've removed some packages to lean down the system. Now when I log out (from either Unity or Gnome Shell) I lose the X session, LightDM doesn't start back up. If I disable autologin through /etc/lightdm/lightdm.conf I get no login screen & no X. As I said, autologin works and gives me a Ubuntu Classic desktop. This is the only reference in dmesg to lightdm; [ 17.351023] type=1400 audit(1329530135.420:19): apparmor="STATUS" operation="profile_load" name="/usr/lib/lightdm/lightdm-guest-session-wrapper" pid=1097 comm="apparmor_parser" Can anyone help?

    Read the article

  • Can I use DllImport/PInvoke in libraries loaded as Assets in Unity Free?

    - by sebf
    I am interested in using utilising third-party libraries in Unity Free. I know Unity can use managed libraries as Assets, but only the Pro version supports using native libraries. (DllImport within scripts). This thread however suggests that it is possible to import DLLs in the free version. I would like to utilise native libraries (as a hobbyist I cannot afford Pro), but want to do it the supported way so I don't have to worry about Unity 'fixing' this hole if that is what it is. Is there any supported way to use native libraries with Unity free? (i.e. does that thread suggest a workaround or is it a 'bug'? Is it supported to use DllImport/PInvoke in libraries loaded as assets? (could I create a wrapper myself?)

    Read the article

  • How do I programatically determine which port a SQL Server is running on?

    - by Ralph Willgoss
    How do I programatically determine which port a SQL Server is running on?/*Wrapper script for xp_readerrorlogAuthor: Ralph WillgossDate: 2nd Oct 2012This script cycles through all logs files, looking for the listening port.Normally you have to specify the log file one by one, the script removes the need for that.Param ref for: xp_readerrorlog1. Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc...2. Log file type: 1 or NULL = error log, 2 = SQL Agent log3. Search string 1: String one you want to search for4. Search string 2: String two you want to search for to further refine the results5. Search from start time6. Search to end time7. Sort order for results: N'asc' = ascending, N'desc' = descending*/USE MasterGO--  Get log countDECLARE @logcount intDROP TABLE #ResultCREATE TABLE #Result (ArchiveNo int, Date datetime, Size int)INSERT INTO #ResultEXEC xp_enumerrorlogsSET @logcount = (SELECT COUNT(*) FROM #Result)-- Search the available logsDECLARE @counter intSET @counter = 0WHILE @counter <= @logcountBEGIN   EXEC xp_readerrorlog @counter, 1, N'Server is listening on', 'any', NULL, NULL, N'asc'   SET @counter = @counter + 1ENDGO

    Read the article

  • Should I use both WCF and ASP.NET Web API

    - by Mithir
    We already have a WCF API with basichttpbinding. Some of the calls have complex objects in both the response and request. We need to add RESTful abilities to the API. at first I tried adding a webHttp endpoint, but I got At most one body parameter can be serialized without wrapper elements If I made it Wrapped it wasn't pure as I need it to be. I got to read this, and this (which states "ASP.NET Web API is the new way to build RESTful service on .NET"). So my question is, should I make 2 APIs(2 different projects)? one for SOAP with WCF and one RESTful with ASP.NET Web API? is there anything wrong architecturally speaking with this approach?

    Read the article

  • Simplest way to use Steam Leaderboards from C# [on hold]

    - by Miau
    We are about to integrate steamworks for leaderboards and achievements into our game. I see there are many open and closed source libraries that can be used to use SteamWorks from C#. Rolling our own wrapper can be done, but if the other libraries are reliable then it would be better to use and perhaps contribute back if we see any obvious gaps. Have you used any and if so what was your experience with the different libraries? Specifically for Leaderboards and achievements The ones I found are: SteamWorks.net Steam4Net Ludosity (can be used outside of Unity apparently)

    Read the article

  • What to call objects that may delete cached data to meet memory constraints?

    - by Brent
    I'm developing some cross-platform software which is intended to run on mobile devices. Both iOS and Android provide low memory warnings. I plan to make a wrapper class that will free cached resources (like textures) when low memory warnings are issued (assuming the resource is not in use). If the resource returns to use, it'll re-cache it, etc... I'm trying to think of what this is called. In .Net, it's similar to a "weak reference" but that only really makes sense when dealing with garbage collection, and since I'm using c++ and shared_ptr, a weak reference already has a meaning which is distinct from the one I'm thinking of. There's also the difference that this class will be able to rebuild the cache when needed. What is this pattern/whatever is called? Edit: Feel free to recommend tags for this question.

    Read the article

  • How do I store the OAuth v1 consumer key and secret for an open source desktop Twitter client without revealing it to the user?

    - by Justin Dearing
    I want to make a thick-client, desktop, open source twitter client. I happen to be using .NET as my language and Twitterizer as my OAuth/Twitter wrapper, and my app will likely be released as open source. To get an OAuth token, four pieces of information are required: Access Token (twitter user name) Access Secret (twitter password) Consumer Key Consumer Secret The second two pieces of information are not to be shared, like a PGP private key. However, due to the way the OAuth authorization flow is designed, these need to be on the native app. Even if the application was not open source, and the consumer key/secret were encrypted, a reasonably skilled user could gain access to the consumer key/secret pair. So my question is, how do I get around this problem? What is the proper strategy for a desktop Twitter client to protect its consumer key and secret?

    Read the article

  • Python response parse [migrated]

    - by Pavel Shevelyov
    When I'm sending some data on host: r = urllib2.Request(url, data = data, headers = headers) page = urllib2.urlopen(r) print page.read() I have something like this: [{"command":"settings","settings":{"basePath":"\/","ajaxPageState":{"theme":"spsr","theme_token":"kRHUhchUVpxAMYL8Y8IoyYIcX0cPrUstziAi8gSmMYk","css":[]},"ajax":{"edit-submit":{"callback":"spsr_calculator_form_ajax","wrapper":"calculator_form","method":"replaceWith","event":"mousedown","keypress":true,"url":"\/ru\/system\/ajax","submit":{"_triggering_element_name":"submit"}}}},"merge":true},{"command":"insert","method":null,"selector":null,"data":"\u003cdiv id=\"calculator_form\"\u003e\u003cform action=\"\/ru\/service\/calculator\" method=\"post\" id=\"spsr-calculator-form\" accept-charset=\"UTF-8\"\u003e\u003cdiv\u003e\u003cinput id=\"edit-from-ship-region-id\" type=\"hidden\" name=\"from_ship_region_id\" value=\"\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_build_id\" value=\"form-0RK_WFli4b2kUDTxpoqsGPp14B_0yf6Fz9x7UK-T3w8\" \/\u003e\n\u003cinput type=\"hidden\" name=\"form_id\" value=\"spsr_calculator_form\" \/\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"bg_p\"\u003e \n\u0421\u0435\u0439\u0447\u0430\u0441 \u0412\u044b... bla bla bla but I want have something, like this: <html><h1>bla bla bla</h1></html> How can I do it?

    Read the article

  • Exposing warnings\errors from data objects (that are also list returned)

    - by Oren Schwartz
    I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, some services return one objects, others retrieve a list of them (thus disables throwing exceptions). I now want to expose data flow warnings and wondering what's the best way to do it having to things to consider: (1) seperation (2) ease of access. On the one hand, i want the UI team to be able to access a fields warnings (or errors) without having them mapping the field names to an external source but on the other hand, i don't want the warnings "hanged" on the object itself (as i don't see it a correct design). I tought of creating a new type of wrapper for each field, that'll expose events and they'll have to register the one's they care about (but totally not sure) I'll be happy to hear your thoughts. Could you please direct me to a respectful design pattern ? what dp will do best here ? Thank you very much!

    Read the article

  • Howto have thunderbird/lightning open ics files

    - by berkes
    Some websites offer .ics files, calendar files. I would like thunrbird to open these with Lightning so it can add the events in the ics-file to its calendar. When I use /usr/bin/thunderbird to open the file with, it starts a new message with the ics file attached. I could download the file, then import it from lightning, But I rather have lightning just open the file. Is there a commandline-option for this? Some wrapper-script maybe? Should I change something in firefox?

    Read the article

  • Google Maps in .NET Problem

    - by H(at)Ni
    Hello, I've been struggling with Google maps till I found that someone implemented a wrapper so that you can use Google Map as an ASP.Net user control which is a great effort indeed. You can download it from this link. However, after using it for a while, I've found out that it is storing the Google map object only once in the session and getting it from there whenever needed which was a problem for me that when you update the map in some page, you'll find it updated on another page. So, I've digged deep in the code and updated it so that it stores the map object with a unique identifier that you set it as a property in the user control object like that: this.googleMapCtrl.ControlID = Guid.NewGuid().ToString(); You can download the updated control files from here. Cheers,

    Read the article

  • Less is More Redux

    In my short happy life as a developer, Ive run into all kinds of development efforts that include frameworks, libraries, web sites, and much more.The one thing that stands out as an irritant to me is complexity. Specifically, unnecessary complexity. Ive seen developers author entire library assemblies that provide wrapper utility methods consisting of calls to .NET BCL methods that take one line of code methods that could have been called inline without even the need for the helper classes.Ive seen...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Access Control Management Tool ACM.exe

    - by kaleidoscope
    The Access Control Management Tool (Acm.exe) is a command-line tool you can use to perform management operations (CREATE, UPDATE, GET, GET ALL, and DELETE) on the AppFabric Access Control entities (scopes, issuers, token policies, and rules). Basic Syntax The command line for Acm.exe follows the basic pattern of verb-noun. For example: acm.exe <command> <resource> [-option:<option value>] This tool will automatically generate random keys, which helps ensure that they can't easily be guessed by an attacker. Note that ACM.EXE is a thin wrapper around a REST Web Service (the AC management service). That helps to remember the commands it accepts, which are the typical resource management commands for a REST service: · Get(All) · Create · Update · Delete ACM.EXE.config file can be used to configure Host, Service and the Management key for a Service Namespace. Geeta, G

    Read the article

  • What is considered third party code?

    - by Songo
    Inspired by this question Using third-party libraries - always use a wrapper? I wanted to know what people actually consider as third-party libraries. Example from PHP: If I'm building an application using Zend framework, should I treat Zend framework libraries as third party code? Example from C#: If I'm building a desktop application, should I treat all .Net classes as third party code? Example from Java: Should I treat all libraries in the JDK as third party libraries? Some people say that if a library is stable and won't change often then one doesn't need to wrap it. However I fail to see how one would test a class that depends on a third party code without wrapping it.

    Read the article

  • Is having a class have a handleAction(type) method bad practice?

    - by zhenka
    My web application became a little too complicated to do everything in a controller so I had to build large wrapper classes for ORM models. The possible actions a user can trigger are all similar and after a certain point I realized that the best way to go would be to just have constructor method receive action type as a parameter to take care of the small differences internally, as opposed to either passing many arguments or doing a lot of things in the controller. Is this a good practice? I can't really give details for privacy issues.

    Read the article

  • Jquery Carousel - Need A Script Hack to Customize

    - by Leah
    I hope someone can help me out here. I am coding a site for a client using the carouFredsel. I am using this because it allows for variable widths with in the slideshow as seen here: http://2938.sandbox.i3dthemes.net/index-old.html. My problems are as follows: to use the built in auto center script the scrolling changes the white space in between images during the transition to fit the width of the wrapper. I need a hack to keep the white space during transition the same, like this: http://2938.sandbox.i3dthemes.net/index.html. Also, I can't figure out how to put this snippet into my code and make it work scroll: { onAfter: function() { if ( $(this).triggerHandler( "currentPosition" ) == 0 ) { $(this).trigger( "pause" ); } } }

    Read the article

  • How to make custom libraries accessible?

    - by Milen Bilyanov
    I am trying to compile and install every custom module under it's own designated folder. (ex: /myApps/myLinux/compiled_app) I had luck with python so far, where my python is compiled from source and lives in: /myApps/myLinux/python2.5 and "python2.5" - /myApps/myLinux/python2.5.6-gcc463 so I can access this python through a wrapper script that sets the right environment. The question is recently I had to compile and add something called gperf3.0.4. So now it lives: /myApps/myLinux/gperf3.0 and "gperf3.0" - /myApps/myLinux/gperf3.0.4-gcc463 The question is: How will I point to this lib if some other app needs to access it? Is it done through the LD_LIBRARY_PATH variable? Thanks.

    Read the article

  • Oracle Database 12c

    - by David Allan
    Exciting day today as Oracle Database 12c is released. You can find lots of information on the release on OTN here. With this release comes another milestone on Oracle's Data Integration roadmap - OWB is no longer shipped with the database. You will notice that the OWB documentation is no longer included with the Oracle Database documentation, you can compare and contrast the 11.2 and 12.1 documentation below. OWB 11gR2 is still supported with Oracle Database 12c, you will need 11.2.0.3 plus at least CP2 which has been certified with Oracle Database 12c. The 11.2.0.4 release will wrapper this into one install.

    Read the article

  • wget not respecting my robots.txt. Is there an interceptor?

    - by Jane Wilkie
    I have a website where I post csv files as a free service. Recently I have noticed that wget and libwww have been scraping pretty hard and I was wondering how to circumvent that even if only a little. I have implemented a robots.txt policy. I posted it below.. User-agent: wget Disallow: / User-agent: libwww Disallow: / User-agent: * Disallow: / Issuing a wget from my totally independent ubuntu box shows that wget against my server just doesn't seem to work like so.... http://myserver.com/file.csv Anyway I don't mind people just grabbing the info, I just want to implement some sort of flood control, like a wrapper or an interceptor. Does anyone have a thought about this or could point me in the direction of a resource. I realize that it might not even be possible. Just after some ideas. Janie

    Read the article

  • How should I write new code when the old codebase and the environment uses lots of globals in PHP

    - by Nicola Peluchetti
    I'm working in the Wordpress environment which itself heavily relies on globals and the codebase I'm maintaining introduces some more. I want this to change and so I'm trying to think how should I handle this. For the globals our code has introduced I think I will set them as dependencies in the constructor or in getter / setter so that I don't rely on them being globals and then refactor the old codebase little by little so that we have no globals. With Wordpress globals I was thinking to wrap all WP globals inside a Wrapper class and hide them in there. Like this class WpGlobals { public static function getDb() { global $wpdb; return $wpdb; } } Would this be of any help? The idea is that I centralize all globals in one class and do not scatter them through the code, so that if Wordpress kills one of them I need to modify code only in one place. What would you do?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >