Search Results

Search found 1976 results on 80 pages for 'helper'.

Page 35/80 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Stateless singleton VS Static methods

    - by Sebastien Lorber
    Hey, Don't find any good answer to this simple question about helper/utils classes: Why would i create a singleton (stateless) rather than static methods? Why an object instance could be needed while the object has no state? Sometimes i really don't know what to use...

    Read the article

  • numerical computation locks up ruby

    - by kolosy
    i'm trying to implement an id obfuscation scheme, with a simple hash borrowed elsewhere. i've added a method on the application helper: @@M_ID = 2**31-1 @@PRIME = 1580030173 @@PRIME_INVERSE = 59260789 # (calculated from MAXID and PRIME offline) def obfuscate_id(x) if x return ((x * @@PRIME) & @@M_ID) else x end end for some reason, whenever this is called, ruby locks up, and starts eating up disk space on my mac... like - gigs of it. any ideas?

    Read the article

  • Where to put common setUp-code for differen testclasses?

    - by Benedikt
    I have several different test classes that require that certain objects are created before those tests can be run. Now I'm wondering if I should put the object initialization code into a separate helper class or superclass. Doing so would surely reduce the amount of duplicate code in my test classes but it would also make them less readable. Is there a guideline or pattern how to deal with common setUp-code for unit tests?

    Read the article

  • Visual Studio stack trace in notepad++

    - by LoveMeSomeCode
    This is probably just a setting I'm not seeing, but when I get a stack trace out of Visual Studio's exception helper dialog, it has \r\n after each "line" in the call stack. When I copy this and paste it into Notepad++, it shows up as literally \r\n, visible in the document. Of course I'd like these to be interpreted as CR LF, so everything's on a different line. Anyone know how to do this?

    Read the article

  • jquery ui is not scaling text properly!

    - by Stephen Belanger
    I'm trying use jquery ui to scale a div that I'm dragging around to make it easier to see what's behind it, but any text inside it is scaling strangely. The text itself becomes smaller, but it seems to have a bunch of padding around it and is floating now. The text extends past the bottom of the div even though it should be contained properly by the div. I put a red border around the lines of text and the borders are the same size as the original text. I'm not really sure what to do to get this to work... HTML: <div class="item draggable" id="item-1'"> <div class="image-block"> <a class="delete-button" title="delete me!" href="/remove/1" onclick="return $(this).confirm(\'Really remove this image?\');">X</a> <a class="image" href="/edit/1"><img src="/someimage.jpg" /></a> <div class="clear-block"></div> </div> <h3>Some title</h3> </div> CSS: div.image-list div.item { float:left; background:#fff; width:150px; padding:5px; margin:4px; border:1px solid #d3d5d6; } div.image-list div.item h3 { margin:0; padding:0; border:solid 1px #F00; } div.image-list div.item div.image-block a.delete-button { float:right; position:relative; background:#fff; display:none; top:0.8em; margin-bottom:-20.0em; width:3em; height:1.8em; padding:0.2em 1em; } div.image-list div.item div.image-block a.image { float:left; display:block; } .clear-block { clear:both; } jquery: $(".draggable").draggable({ helper: 'clone', start: function(ev, ui) { $(ui.helper).effect( "scale", { percent: 50 }, 200 ); } });

    Read the article

  • Converting DTOs to View Models

    - by illvm
    Does anyone know of a good (read: quick to code) method for converting DTOs to View Models or mapping DTO members to View Model members? Lately I've been finding myself writing many conversion and helper methods but this is a very arduous and tedious task. Moreover, it will often needs to be done twice (DTO - View Model, View Model - DTO). Is there a methodology, technique, or technology which would allow me to do this more quickly and efficiently?

    Read the article

  • How do I embed a binary within a Delphi executable and extract at runtime?

    - by Mick
    I'd like to embed an executable inside of my Delphi binary and extract it at runtime. The purpose of this is to ensure that a helper utility is always available on the system, without having to distribute multiple files. With Delphi 2007 I have used JvDataEmbedded, but I am building a console application and I want to know if anyone knows of another way to do it without having to add a hidden form for JvDataEmbedded. I am using Delphi 2010.

    Read the article

  • Getting the id of child element based on the parents class name

    - by sea_1987
    I am currently playing around with jqueries drag and drop, basically I currently have a div (.drag_check) that holds a checkbox, I have the drag and drop working but I want to alert out the checkbox's ID once the element is dropped, I assume I have to use child but all my attempts have returned 'undefined'. Below is my code, $('.drag_check').draggable({ containment: 'document', opacity:0.6, revert: 'invalid', helper: 'clone', zIndex: 100 }); $("ul.searchPage").droppable({ drop: function(e, ui) { var param = $(ui.draggable).attr('class') addlist(param) alert(param) } })

    Read the article

  • set/add view from controller action

    - by user359650
    Hi all, I'm trying to set a view script to be executed in addition to the currently requested action view script. I want to do this from the controller action itself in a way that this new view script output will be available from the layout $this-layout()-content helper. I found the setView() method but don't know how to use it from the controller. Thanks a lot.

    Read the article

  • javascript instanceof get type from string name

    - by dcp
    Let's say I have this (assume the name variable is "receiver"): if (!(receiver instanceof com.HTMLReceiver)) { throw new com.IllegalArgumentException( name + " is not an instance of com.HTMLReceiver."); } I'd like to factor this code out into a common method so I could call it like this: Helper.checkInstance(receiver, "com.HTMLReceiver"); But I don't know of a way to convert the com.HTMLReceiver from a string to its actual type so I can use instanceof on it. Is there a way?

    Read the article

  • Should enumerations be placed in a separate file or within another class?

    - by Icono123
    I currently have a class file with the following enumeration: using System; namespace Helper { public enum ProcessType { Word = 0, Adobe = 1, } } Or should I include the enumeration in the class where it's being used? I noticed Microsoft creates a new class file for DockStyle: using System; using System.ComponentModel; using System.Drawing.Design; namespace System.Windows.Forms { public enum DockStyle { None = 0, Top = 1, Bottom = 2, Left = 3, Right = 4,. Fill = 5, } }

    Read the article

  • [ZF] set/add view from controller action

    - by user359650
    Hi all, I'm trying to set a view script to be executed in addition to the currently requested action view script. I want to do this from the controller action itself in a way that this new view script output will be available from the layout $this-layout()-content helper. I found the setView() method but don't know how to use it from the controller. Thanks a lot.

    Read the article

  • Does it make sense to have a model with only static methods?

    - by Jamie Dixon
    Hey everyone, I have an ASP.NET MVC 2 project that I'm working on and I'm wondering where I should place some of my code. I currently have a UsersModel which consists of a bunch of static methods that operate against my data context. These methods include such things as: UserExistsInDatabase, UserIsRegisteredForActivity, GetUserIdFromFacebookId etc etc. Should these methods be inside a UsersModel class or would they be more suited to a user helper class outside of the models context? Cheers for any pointers.

    Read the article

  • How do I change the auto complete behavior in the VS 2010 editor?

    - by pinkmuppet
    How do I stop VS 2010 (RC) from autocompleting html helpers with new object { ... } when I just want to pass in an anonymous type? Backspacing is driving me crazy. e.g., VS wants: <%=Html.ActionLink("Register", "Register", new object { controller = "Account" }) %> I know the helper is declared expecting object, which is why it does this, but can I change this behavior just for mvc helpers?

    Read the article

  • how to get the list of Function and Sub of a given module name in Excel VBA

    - by Kratz
    I am working on a helper macro that look into the list function on a given module name on the active excel workbook. Ex: I have a module name "Module1". Inside this module has the following function or sub Sub Sub1() End Sub Sub Sub2() End Sub Function Func1() End Function Function Func2() End Function Is there a command or routine that can return the list of Function and Sub names?

    Read the article

  • SQLiteOpenHelper getWritableDatabse() fails with no Exception

    - by Michal K
    I have a very strange problem. It only shows from time to time, on several devices. Can't seem to reproduce it when I want, but had it so many times, that I think I know where I get it. So I have a Loader which connects to sqlite through a singleton SQLiteOpenHelper: try{ Log.i(TAG, "Get details offline / db helper: "+DatabaseHelper.getInstance(getContext())); SQLiteDatabase db=DatabaseHelper.getInstance(this.getContext()).getWritableDatabase(); Log.i(TAG, "Get details offline / db: "+db); //doing some work on the db //... } catch(SQLiteException e){ e.printStackTrace(); return null; } catch(Exception e){ e.printStackTrace(); return null; //trying everything to grab some exception or whatever } My SQLIteOpenHelper looks something like this: public class DatabaseHelper extends SQLiteOpenHelper { private static DatabaseHelper mInstance = null; private static Context mCxt; public static DatabaseHelper getInstance(Context cxt) { //using app context ass suggested by CommonsWare Log.i("DBHELPER1", "cxt"+mCxt+" / instance: "+mInstance); if (mInstance == null) { mInstance = new DatabaseHelper(cxt.getApplicationContext()); } Log.i("DBHELPER2", "cxt"+mCxt+" / instance: "+mInstance); mCxt = cxt; return mInstance; } //private constructor private DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); this.mCxt = context; } @Override public void onCreate(SQLiteDatabase db) { //some tables created here } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { //upgrade code here } It really works great in most cases. But from time to time I get a log similar to this: 06-10 23:49:59.621: I/DBHELPER1(26499): cxtcom.bananout.Bananout@407152c8 / instance: com.bananout.helpers.DatabaseHelper@40827560 06-10 23:49:59.631: I/DBHELPER2(26499): cxtcom.bananout.Bananout@407152c8 / instance: com.bananout.helpers.DatabaseHelper@40827560 06-10 23:49:59.631: I/DetailsLoader(26499): Get event details offline / db helper: com.bananout.helpers.DatabaseHelper@40827560 06-10 23:49:59.631: I/DBHELPER1(26499): cxtcom.bananout.Bananout@407152c8 / instance: com.bananout.helpers.DatabaseHelper@40827560 06-10 23:49:59.651: I/DBHELPER2(26499): cxtcom.bananout.Bananout@407152c8 / instance: com.bananout.helpers.DatabaseHelper@40827560 This line Log.i(TAG, "Get details offline / db: "+db); never gets called! No Exceptions, silence. Plus, the thread with the Loader is not running anymore. So nothing past this line SQLiteDatabase db=DatabaseHelper.getInstance(this.getContext()).getWritableDatabase(); gets executed. What can possibly go wrong on this line?

    Read the article

  • TextMate can show definition of a function easily?

    - by Jian Lin
    I am using TextMate on a Ruby on Rails project and wonder if you can put the mouse on link_to, and then press a key and it will show the definition of link_to, or does this for any other helper functions? Or, click open a box and type in a function name and it will show you the definition?

    Read the article

  • how to selectively filter items in a collection

    - by Samuel
    I use the following snippet to filter the list of selected users, where isSelected is a boolean variable. Is there a simpler way (helper function) to populate the selectedUsers collection instead of writing the following lines of code. List<User> selectedUsers = new ArrayList<User>(0); for (User user : this.getUsers()) { if (user.isSelected()) { selectedUsers.add(user.getId()); } }

    Read the article

  • Is it possible to drag an HTML element out of another element and trigger a change with jQuery?

    - by blackrobot
    I have a container element that you can drag objects around in. I want it it so that if you drag an element out of the container (when the mouse crosses the border of the containing div) the element you're dragging to change. How do I arrange this? $("#container img").draggable({ helper: 'clone', zIndex: 100 }); Once the image crosses the bounds of "#container" I should be able to change the image source.

    Read the article

  • Why is cakephp form input stored in $this->data and POST data stored in $this->params['form'] ?

    - by spudnik1979
    the cakephp rest tutorial says that post data should be in $this-data, but I am finding that it is not, but instead inside $this-params['form'] However, when using cakephp form helper in a view, the data is in $this-data. Am I correct to have to check both locations in my controller? It just seems a bit of a waste of extra code. Shouldnt the data appear in one place for whether it came from a rest rest requestor or Cakephp form post? ps im using cakephp 1.3

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >