Daily Archives

Articles indexed Tuesday May 25 2010

Page 19/118 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • why are read only form fields in django a bad idea?

    - by jamida
    I've been looking for a way to create a read-only form field and every article I've found on the subject comes with a statement that "this is a bad idea". Now for an individual form, I can understand that there are other ways to solve the problem, but using a read only form field in a modelformset seems like a completely natural idea. Consider a teacher grade book application where the teacher would like to be able to enter all the students' (note the plural students) grades with a single SUBMIT. A modelformset could iterate over all the student-grades in such a way that the student name is read-only and the grade is the editable field. I like the power and convenience of the error checking and error reporting you get with a modelformset but leaving the student name editable in such a formset is crazy. Since the expert django consensus is that read-only form fields are a bad idea, I was wondering what the standard django best practice is for the example student-grade example above?

    Read the article

  • Distribute budget over for ranked components in SQL

    - by Lee
    Assume I have a budget of $10 (any integer) and I want to distribute it over records which have rank field with varying needs. Example: rank Req. Fulfilled? 1 $3 Y 2 $4 Y 3 $2 Y 4 $3 N Those ranks from 1 to 3 should be fulfilled because they are within budget. whereas, the one ranked 4 should not. I want an SQL query to solve that. Below is my initial script: CREATE TABLE budget ( id VARCHAR (32), budget INTEGER, PRIMARY KEY (id)); CREATE TABLE component ( id VARCHAR (32), rank INTEGER, req INTEGER, satisfied BOOLEAN, PRIMARY KEY (id)); INSERT INTO budget (id,budget) VALUES ('1',10); INSERT INTO component (id,rank,req) VALUES ('1',1,3); INSERT INTO component (id,rank,req) VALUES ('2',2,4); INSERT INTO component (id,rank,req) VALUES ('3',3,2); INSERT INTO component (id,rank,req) VALUES ('4',4,3); Thanks in advance for your help. Lee

    Read the article

  • Migrating Data to MSSQL 2008

    - by Fred Clown
    I am trying to migrate data from an Informix database to MSSQL 2008. I've got quite a lot of data to move. I've been try multiple methods to get the data over, and so far SQLBulkCopy in multiple chunks seems to be the fastest that I can find. Does anyone know of a faster means of getting the data over? I'm trying to cut down on the transfer time so that on my cut-over date I don't run out of time to do the full cut-over. Thanks.

    Read the article

  • Event 4098, 0x80070533 Logon failure: account currently disabled?

    - by Josh King
    Having started to upgrade our PCs to Windows 7 we have noticed that we are getting group policy warnings in Event Viewer such as: "The user 'Word.qat' preference item in the 'a_Office2007_Users {A084A37B-6D4C-41C0-8AF7-B891B87FC53B}' Group Policy object did not apply because it failed with error code '0x80070533 Logon failure: account currently disabled.' This error was suppressed." 15 of these warnings appear every two hours on every Windows 7 PC, most of which are to do with core office applications and two are for plug-ins to out document management system. These warnings aren't afecting the users, but it would be nice to track down the source of them before we rollout Win7 to the rest of the Organisation. Any ideas as to where the login issue could be comming from (All users are connecting to the domain and proxy, etc fine)?

    Read the article

  • Use only external monitor at screen's native resolution

    - by joaoc
    My laptop's screen lamp just died (I can see content on the screen if I point a light at it) and I was using it with an external monitor. I can switch from extended desktop to mirrored mode but, and here is where I need help, the resolutions don't match. The laptop's resolution is 1600x1200 and the external monitor is 1680x1050. I am ok with just using one screen ATM but I would like for it to at least use the native resolution of the external monitor. This is Windows XP and under Monitor settings I only get the resolutions for the original monitor under mirrored mode. How can I force the screen into a resolution not supported by the laptop screen but that is a native resolution for the external monitor?

    Read the article

  • Simple 2 column CSS layout with nested divs

    - by Dan
    Hello, I have good familiarity with CSS but for some reason I am unable to achieve the result I want in this case. Here is the link to my test site http://danberinger.com/test.html Keep in mind that I want a 2 column layout and that the background wrapper color (gray) is not showing. Instead the body background color image is being put in place of where the wrapper background should be. Any suggestions would be greatly appreciated.

    Read the article

  • $.ajax is not working

    - by Geetha
    Hi All, In my web page there is a textbox to get the scanned barcode value. Once we scan the barcode it has to get details from the database. I am creating the change event for the textbox. Problem: $.ajax is not working. Code: var target = $('#txtBarcode'), val = target.val(); target.change(monitor()); function monitor() { var xx = $('#txtBarcode').val(); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{}", url: "HomePage.aspx/SearchProduct", dataType: "json", success: function(data) { alert("Success!!!"); } }); }

    Read the article

  • What is a de-compiler how does it work?

    - by thyrgle
    So is a decompiler really a thing that gives gives the source of a compiled/interpreted piece of code? Because to me that sounds impossible. How would you get the names of the functions, variables, classes, etc if it is compiled. Or am I misinterpreting the definition? How does it work? And what is the general principal behind making one?

    Read the article

  • Text piped to PowerShell.exe isn't recieved when using [Console]::ReadLine()

    - by crtracy
    I'm getting itermittent data loss when calling .NET [Console]::ReadLine() to read piped input to PowerShell.exe: >ping localhost | powershell -NonInteractive -NoProfile -C "do {$line = [Console]::ReadLine(); ('' + (Get-Date -f 'HH:mm :ss') + $line) | Write-Host; } while ($line -ne $null)" 23:56:45time<1ms 23:56:45 23:56:46time<1ms 23:56:46 23:56:47time<1ms 23:56:47 23:56:47 Normally 'ping localhost' from Vista64 looks like this, so there is a lot of data missing from the output above: Pinging WORLNTEC02.bnysecurities.corp.local [::1] from ::1 with 32 bytes of data: Reply from ::1: time<1ms Reply from ::1: time<1ms Reply from ::1: time<1ms Reply from ::1: time<1ms Ping statistics for ::1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms But using the same API from C# recieves all the data sent to the process (excluding some newline differences). Code: namespace ConOutTime { class Program { static void Main (string[] args) { string s; while ((s = Console.ReadLine ()) != null) { if (s.Length > 0) // don't write time for empty lines Console.WriteLine("{0:HH:mm:ss} {1}", DateTime.Now, s); } } } } Output: 00:44:30 Pinging WORLNTEC02.bnysecurities.corp.local [::1] from ::1 with 32 bytes of data: 00:44:30 Reply from ::1: time<1ms 00:44:31 Reply from ::1: time<1ms 00:44:32 Reply from ::1: time<1ms 00:44:33 Reply from ::1: time<1ms 00:44:33 Ping statistics for ::1: 00:44:33 Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 00:44:33 Approximate round trip times in milli-seconds: 00:44:33 Minimum = 0ms, Maximum = 0ms, Average = 0ms So, if calling the same API from PowerShell instead of C# many parts of StdIn get 'eaten'. Is the PowerShell host reading string from StdIn even though I didn't use 'PowerShell.exe -Command -'?

    Read the article

  • How can I get returning data from jquery ajax request?

    - by Oguz
    function isNewUsername(str){ var result; $.post('/api/isnewusername', {username:str}, function(data) { result = data.result; }, "json"); return result; } So , my problem is very simple but I can not figure it out . I want to access result from the isnewusername function . I am very curious about answer because I spent 1 hour on it . Thank you

    Read the article

  • The height and width properties on my Flex 4 app arn't working

    - by ben
    In the opening application tag of my Flex 4 app, I set the width and height properties as follows: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()" backgroundColor.mainState="0x303030" xmlns:components="components.*" width="798" height="240"> What I go into Design mode in Flash Builder 4, the app is the correct size. But when I embed the .swf file into a HTML page, the application's background color covers the whole screen, and when the Flash Player Settings message box pops up it is outside of the area I defined in the code above. What am I doing wrong? Thanks for reading.

    Read the article

  • java console input

    - by Bipul
    The data type of the any input through console (as i do using BufferedReader class) is String.After that we type cast it to requered data type(as Inter.parseInt() for integer).But in C we can take input of any primitive data type whereas in java all input types are neccerily String.why it is so????

    Read the article

  • [AS 3.0] How to use the string.match method to find multiple occurrences of the same word in a strin

    - by Steven
    In Actionscript and Adobe Flex, I'm using a pattern and regexp (with the global flag) with the string.match method and it works how I'd like except when the match returns multiple occurrences of the same word in the text. In that case, all the matches for that word point only to the index for the first occurrence of that word. For example, if the text is "cat dog cat cat cow" and the pattern is a search for cat*, the match method returns an array of three occurrences of "cat", however, they all point to only the index of the first occurrence of cat when i use indexOf on a loop through the array. I'm assuming this is just how the string.match method is (although please let me know if i'm doing something wrong or missing something!). I want to find the specific indices of every occurrence of a match, even if it is of a word that was already previously matched. I'm wondering if that is just how the string.match method is and if so, if anyone has any idea what the best way to do this would be. Thanks.

    Read the article

  • Port 53 UDP Outgoing flood

    - by DanSpd
    Hello I am experiencing very huge problem. I have 4 computers in network, and from each a lot of data is being sent to ISP name servers. Sometimes data is being sent a little from each computer in network, sometimes it is just a lot of data from one computer. I have antivirus (Avast) and malware scan (SpyBot) I know port 53 UDP is dns which resolves domain IP so its' needed. Also I have read that ISP name server might have been infected. So what is the best thing to do in this situation. Also sometimes internet starts to lag really because of port 53

    Read the article

  • Combine multiple dataset columns to one dataset

    - by Matt
    I have multiple datasets that I would like to combine into one. There is a common ID field that can be associated to each row. Calling Merge on the dataset will add additional rows to the dataset, but I would like to combine the additional columns. There are too many fields to do this in one query and therefore would make it unmanageable. Each individual query would be able to handle ordering to ensure the data is placed in the correct row. For Example lets say I have two queries resulting in two datasets: SELECT ID, colA, colB SELECT colC, colD The resulting dataset would look like ID colA colB colC colD 1 a b c d 2 e f g h Any ideas on ways to accomplish this?

    Read the article

  • Sub reports find the sub total and grand total of each sub report in the main report

    - by sonia
    i want to find the grand total from sub report subtotal. i have three subreports. 1. itemreport 2.laborreport 3. machine report. i have find total of that reports using shared variable. like using formula: shared numbervar totalitem=sum({storedprocedrename.columnname}) i have done dis in all the sbreports. now i m want the grand total of all these. i have written the formula in main report is: shared numbervar totalitem; // same variable used in subreport item shared numbervar labtotal; // same variable sed in subreport labor shared numbervar machinetotal; // same variable used in subreport machine numbervar total; total=totalitem+labtotal+machinetotal; total but it is not giving correct result.. it is not giving result in correct format plz tell me code of main report in detail.. thanks

    Read the article

  • Configurable Values in Enum

    - by Omer Akhter
    I often use this design in my code to maintain configurable values. Consider this code: public enum Options { REGEX_STRING("Some Regex"), REGEX_PATTERN(Pattern.compile(REGEX_STRING.getString()), false), THREAD_COUNT(2), OPTIONS_PATH("options.config", false), DEBUG(true), ALWAYS_SAVE_OPTIONS(true), THREAD_WAIT_MILLIS(1000); Object value; boolean saveValue = true; private Options(Object value) { this.value = value; } private Options(Object value, boolean saveValue) { this.value = value; this.saveValue = saveValue; } public void setValue(Object value) { this.value = value; } public Object getValue() { return value; } public String getString() { return value.toString(); } public boolean getBoolean() { Boolean booleanValue = (value instanceof Boolean) ? (Boolean) value : null; if (value == null) { try { booleanValue = Boolean.valueOf(value.toString()); } catch (Throwable t) { } } // We want a NullPointerException here return booleanValue.booleanValue(); } public int getInteger() { Integer integerValue = (value instanceof Number) ? ((Number) value).intValue() : null; if (integerValue == null) { try { integerValue = Integer.valueOf(value.toString()); } catch (Throwable t) { } } return integerValue.intValue(); } public float getFloat() { Float floatValue = (value instanceof Number) ? ((Number) value).floatValue() : null; if (floatValue == null) { try { floatValue = Float.valueOf(value.toString()); } catch (Throwable t) { } } return floatValue.floatValue(); } public static void saveToFile(String path) throws IOException { FileWriter fw = new FileWriter(path); Properties properties = new Properties(); for (Options option : Options.values()) { if (option.saveValue) { properties.setProperty(option.name(), option.getString()); } } if (DEBUG.getBoolean()) { properties.list(System.out); } properties.store(fw, null); } public static void loadFromFile(String path) throws IOException { FileReader fr = new FileReader(path); Properties properties = new Properties(); properties.load(fr); if (DEBUG.getBoolean()) { properties.list(System.out); } Object value = null; for (Options option : Options.values()) { if (option.saveValue) { Class<?> clazz = option.value.getClass(); try { if (String.class.equals(clazz)) { value = properties.getProperty(option.name()); } else { value = clazz.getConstructor(String.class).newInstance(properties.getProperty(option.name())); } } catch (NoSuchMethodException ex) { Debug.log(ex); } catch (InstantiationException ex) { Debug.log(ex); } catch (IllegalAccessException ex) { Debug.log(ex); } catch (IllegalArgumentException ex) { Debug.log(ex); } catch (InvocationTargetException ex) { Debug.log(ex); } if (value != null) { option.setValue(value); } } } } } This way, I can save and retrieve values from files easily. The problem is that I don't want to repeat this code everywhere. Like as we know, enums can't be extended; so wherever I use this, I have to put all these methods there. I want only to declare the values and that if they should be persisted. No method definitions each time; any ideas?

    Read the article

  • How to compare dictonary key with xml attribute value in xml using LINQ in c #?

    - by Pramodh
    Dear all, i've a dictonary " dictSample " which contains 1 data1 2 data2 3 data3 4 data4 and an xml file"sample.xml" in the form of: <node> <element id="1" value="val1"/> <element id="2" value="val2"/> <element id="3" value="val3"/> <element id="4" value="val4"/> <element id="5" value="val5"/> <element id="6" value="val6"/> <element id="7" value="val7"/> </node> i need to match the dictonary keys with the xml attribute id and to insert the matching id and the value of attribute"value" into another dictonary now i'm using like: XmlDocument XDOC = new XmlDocument(); XDOC.Load("Sample.xml"); XmlNodeList NodeList = XDOC.SelectNodes("//element"); Dictionary<string, string> dictTwo = new Dictionary<string, string>(); foreach (string l_strIndex in dictSample .Keys) { foreach (XmlNode XNode in NodeList) { XmlElement XEle = (XmlElement)XNode; if (dictSample[l_strIndex] == XEle.GetAttribute("id")) dictTwo.Add(dictSample[l_strIndex], XEle.GetAttribute("value").ToString()); } } please help me to do this in a simple way using LINQ

    Read the article

  • Sharepoint List redirect with new id

    - by TheRealQuagmire
    I have a list within Sharepoint, using a custom new form i have added a custom list form control ("New item form" for the list) and changed the SaveButton to a standard input HTML button, and added an 'onclick' event that is as follows: onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={NewFormWizard2.aspx?id=}')}" this works as in saves the data and redirects to the NewFormWizard2.aspx?id= page. the question is how do i get the ID of the created item to be passed to the redirected page? thus once the form is completed it would redirect to NewFormWizard2.aspx?id=23 Thanks in advanced.

    Read the article

  • Question about "ASP.NET 3.5 Social Networking" by Andrew Siemer (from Packt Publishing)

    - by user287745
    am currently reading a book, which has explanation of making a social website. ASP.NET 3.5 Social Networking https://www.packtpub.com/expert-guide-for-social-networking-with-asp-.net-3.5/book On page 41 I noticed that the images of the solution explorer given in the text, indicate that windowsformapplication[PROJECT] has been used instead of WebForms[create new website]. there are no webforms? how would the end result be a site? what is happening here?? the name of the book is, ASP.NET 3.5 Social Networking, please refer to page 41, thanks note:- i have always made websites which needs hosting and be accessible from other computers using webforms[create new website] which has web.config file app_data etc..... please help thank you.

    Read the article

  • iPhone WebApp Question

    - by Henry D'Andrea
    I have this code- /** Save the web view as a screenshot. Currently only supports saving to the photo library. / - (void)saveScreenshot:(NSArray)arguments withDict:(NSDictionary*)options { CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect imageRect = CGRectMake(0, 0, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect)); UIGraphicsBeginImageContext(imageRect.size); [webView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil); UIAlertView *alert= [[UIAlertView alloc] initWithTitle:nil message:@"Image Saved" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } This is for saving whatever you drew in my app. How would I add the button for this in the HTML code. How do i call from it?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >