Daily Archives

Articles indexed Monday May 31 2010

Page 14/98 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Use javascript variables in Rails view helpers

    - by Horacio
    Using jqGrid I want to generate delete links for each row in the grid. The standard way to do this is to add the links in the gridComplete callback like shown below: gridComplete: function() { var ids = jQuery("#jobs_table").jqGrid('getDataIDs'); for(var i=0;i < ids.length;i++){ var cl = ids[i]; be = '<%= link_to(image_tag("delete.gif", :border=>0, :size=>"20x22", :alt => "delete"),· { :action => 'destroy', :id => 'cl', :method => :delete}, :class => 'ajax') -%>'; jQuery("#jobs_table").jqGrid('setRowData',ids[i],{workflow_state:be}); } }, Using getDataIDs I get a list of IDs that I can use to generate the delete links. The problem is that this is a javascript call that results in a javascript variable. The question is how can I use this variable "cl" inside rails link_to view helper?

    Read the article

  • Facebook Logout causes logout from my application

    - by pallab
    I have created simple javascript widget where login happens using Facebook Single Sign On. It logins the person whenever he is logged in to facebook (after authorization for the first time). However, it also logs out the user when Facebook logout happens. I want the person to not get logged out when the person logs out of Facebook? Suggest me what is the way around.

    Read the article

  • Why does do this code do if(sz !=sz2) sz = sz2 !?!

    - by acidzombie24
    For the first time i created a linq to sql classes. I decided to look at the class and found this. What... why is it doing if(sz !=sz2) { sz = sz2; }. I dont understand. Why isnt the set generated as this._Property1 = value? private string _Property1; [Column(Storage="_Property1", CanBeNull=false)] public string Property1 { get { return this._Property1; } set { if ((this._Property1 != value)) { this._Property1 = value; } } }

    Read the article

  • sorting names in a linked list

    - by sil3nt
    Hi there, I'm trying to sort names into alphabetical order inside a linked list but am getting a run time error. what have I done wrong here? #include <iostream> #include <string> using namespace std; struct node{ string name; node *next; }; node *A; void addnode(node *&listpointer,string newname){ node *temp; temp = new node; if (listpointer == NULL){ temp->name = newname; temp->next = listpointer; listpointer = temp; }else{ node *add; add = new node; while (true){ if(listpointer->name > newname){ add->name = newname; add->next = listpointer->next; break; } listpointer = listpointer->next; } } } int main(){ A = NULL; string name1 = "bob"; string name2 = "tod"; string name3 = "thomas"; string name4 = "kate"; string name5 = "alex"; string name6 = "jimmy"; addnode(A,name1); addnode(A,name2); addnode(A,name3); addnode(A,name4); addnode(A,name5); addnode(A,name6); while(true){ if(A == NULL){break;} cout<< "name is: " << A->name << endl; A = A->next; } return 0; }

    Read the article

  • vs2010 Linq to SQL -- adding an entity from my DBML

    - by Matt
    I think I may be going crazy here... Anyways, I have a DBML with a table 'User' in it. Pretty simple stuff -- From within a class, I have the following: BusinessDataContext businessDataContext = new BusinessDataContext(); var user = new User(); user.FirstName = FirstName; user.LastName = LastName; user.MiddleInitial = MiddleInitial; user.DateCreated = DateTime.UtcNow; /* There's no businessDataContext.User.Add method -- There's a bunch of generic collection methods with the <> symbols (Aggregate, All, Any...) Am I just too tired and missing something basic or did something simple change with vs 2010? */ businessDataContext.SubmitChanges(); I think I really just need sleep. :-)

    Read the article

  • [Objective-C] Primitive question, (void) init method.

    - by user354289
    Hi, I have a question in Objective-C. I'm using init method Apple recommended style. - (id)initMyClass: (int)a { if (self = [super init]) { // a... } return self; } Init method returns own object pointer. Then, if the object will not be refered from any objects, can empty return method(void) be better? - (void)initMyClass: (int)a { if ([super init] != nil) { // a... } } I want to know about that, if init method doesn't return self, what problem will occur?

    Read the article

  • Need to access the Page object in Global.asax in the PreRequestHandlerExecute

    - by Taher
    I have a huge website (containing around 5000+) pages. There is a theme functionality in the website where user can choose different colors for their profile. Now i want to use the ASP.net theme feature and put different CSS (for different colors) in the theme folder and in Global.asax i want check the user theme and render appropriate link element with the css. But my problem is, i am not able to access the Page element for adding the link in the page. Here is my code Dim page As System.Web.UI.Page = TryCast(System.Web.HttpContext.Current.Handler,System.Web.UI.Page) page.StyleSheetTheme = "Black" But when i run this code I get a Null reference error. P.s : My application is very huge so its not possible to have a master page or a base class and inherit it in every page. Please suggest.

    Read the article

  • Removing Design Outlining

    - by Kevin
    Is there a way to remove the outlining in Visual Studio in the design page of a form? If it is possible, it would save me some time so that I would not have to keep compiling and running the program every time I wanted to see if I put my form together correctly without any caps between images, etc. For example, something like this. I want to remove the lines that surround each image (yes, those are separate images put together).

    Read the article

  • Monitoring GPS Coordinates

    - by Suriyan Suresh
    I need to monitor GPS Coordinates changes at every 15 min and take action based on that. as per bada developer guide report "only one application allowed to run at a time if another application try to run first one is closed" .so that how do i monitor GPS coordinates without interruption from other applications. how do i keep my application running at all times

    Read the article

  • Is ToString() optimized by compiler?

    - by TheVillageIdiot
    Suppose I've following Code: Console.WriteLine("Value1: " + SomeEnum.Value1.ToString() + "\r\nValue2: " + SomeOtherEnum.Value2.ToString()); Will Compiler Optimize this to: Console.WriteLine("Value1: " + SomeEnum.Value1 + "\r\nValue2: " + SomeOtherEnum.Value2); I've checked it with IL Disassembler and there are calls to IL_005a: callvirt instance string [mscorlib]System.Object::ToString() I don't know if JIT optimizes this.

    Read the article

  • Is there a tool to generate MVC code in C#?

    - by Rity
    I was working on a project with a colleague and went out for lunch one day. Given that we only spent a few days doing design and no coding, I was surprised to find out that after lunch, he had over 40 files completed (various classes, interfaces, DTOs, etc). He told me he is just a fast typist but I need to know the real deal. He hasn't been able to sustain that kind of productivity just the initial skeletal code but still, any ideas how he did this?

    Read the article

  • Overriding setter on domain class in grails 1.1.2

    - by Pavel P
    I have following two domain classes in Grails 1.1.2: class A implements Serializable { MyEnumType myField Date fieldChanged void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() } } } class B extends A { List children void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() children.each { child -> child.myField = val } } } When I set B instance's myField, I get the setter into the cycle... myField = val line calls setter again instead of assiging the new value. Any hint how to override the setter correctly? Thanks

    Read the article

  • Bit Flipping in Hex

    - by freyrs
    I have an 8 digit hexadecimal number of which I need certain digits to be either 0 or f. Given the specific place of the digits is there a quick way to generate the hex number with those places "flipped" to f. For example: flip_digits(1) = 0x000000f flip_digits(1,2,4) = 0x0000f0ff flip_digits(1,7,8) = 0xff00000f I'm doing this on an embedded device so I can't call any math libraries, I suspect it can be done with just bit shifts but I can't quite figure out the method. Any sort of solution (Python, C, Pseudocode) will work. Thanks in advance.

    Read the article

  • Multilanguage Support In C#

    - by Pramodh
    Dear All, I've developed a sample software in c# windows Appliation. How to make it a multilingual supporting software. For Example: One of the message boxes display " Welcome to sample application" i installed the software in a chinees os , but it displays the message in english only. i'm using "string table" for this problem. In string table i need to create entry for each messages in english and Chinees. its a timely process. is there any other way to do this?

    Read the article

  • Why is EventListenerList traversed backwards in fireFooXXX()?

    - by Joonas Pulakka
    I don't understand the rationale of this code, taken from javax.swing.event.EventListenerList docs: protected void fireFooXXX() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==FooListener.class) { // Lazily create the event: if (fooEvent == null) fooEvent = new FooEvent(this); ((FooListener)listeners[i+1]).fooXXX(fooEvent); } } } Why is the list traversed backwards? Why is only every second listener called? The event firing is implemented exactly this way in javax.swing.tree.DefaultTreeModel among others, so it's obviously me who's just not getting something.

    Read the article

  • How to handle this string in json?

    - by Pandiya Chendur
    I am storing a multiline textbox value in my db table... When i converted this value to json it gives me an error Error: unterminated string literal... My sample data was , I am fetching the row to my datatable and then converting it to json, public string GetJSONString(DataTable table) { StringBuilder headStrBuilder = new StringBuilder(table.Columns.Count * 5); for (int i = 0; i < table.Columns.Count; i++) { headStrBuilder.AppendFormat("\"{0}\" : \"{0}{1}¾\",", table.Columns[i].Caption, i); } headStrBuilder.Remove(headStrBuilder.Length - 1, 1); StringBuilder sb = new StringBuilder(table.Rows.Count * 5); sb.Append("{\""); sb.Append(table.TableName); sb.Append("\" : ["); for (int i = 0; i < table.Rows.Count; i++) { string tempStr = headStrBuilder.ToString(); sb.Append("{"); for (int j = 0; j < table.Columns.Count; j++) { table.Rows[i][j] = table.Rows[i][j].ToString().Replace("'", ""); tempStr = tempStr.Replace(table.Columns[j] + j.ToString() + "¾", table.Rows[i][j].ToString()); } sb.Append(tempStr + "},"); } sb.Remove(sb.Length - 1, 1); // trim last , sb.Append("]}"); return sb.ToString(); } The above method doen't seem to handle newline character... Any suggestion...

    Read the article

  • What are Bridge and Synthetic methods in Java?

    - by kunjaan
    Returns : true if and only if this method is a bridge method as defined by the Java Language Specification. Since: 1.5 Returns: true if and only if this method is a synthetic method as defined by the Java Language Specification. Since: 1.5 I saw these in my Reflection doc. I saw couple of docs but I couldn't fully understand the usage of them. Could Somebody expalin these methods for a layperson?

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >