Search Results

Search found 341 results on 14 pages for 'brett w thompson'.

Page 11/14 | < Previous Page | 7 8 9 10 11 12 13 14  | Next Page >

  • How can I manually interpolate string escapes in a Perl string?

    - by Ryan Thompson
    In perl suppose I have a string like 'hello\tworld\n', and what I want is: 'hello world ' That is, "hello", then a literal tab character, then "world", then a literal newline. Or equivalently, "hello\tworld\n" (note the double quotes). In other words, is there a function for taking a string with escape sequences and returning an equivalent string with all the escape sequences interpolated?

    Read the article

  • More efficient way to find & tar millions of files

    - by Stu Thompson
    I've got a job running on my server at the command line prompt for a two days now: find data/ -name filepattern-*2009* -exec tar uf 2008.tar {} ; It is taking forever, and then some. Yes, there are millions of files in the target directory. But just running... find data/ -name filepattern-*2009* -print > filesOfInterest.txt ...takes only two hours or so. At the rate my job is running, it won't be finished for a couple of weeks.. That seems unreasonable. Is there a more efficient to do this? Maybe with a more complicated bash script? A secondary questions is "why is my current approach so slow?"

    Read the article

  • Checking if parsed date is within a date range

    - by Brett Powell
    So I am using a scripting language with c++-like syntax, and I am trying to think of the best way to check if a date is within range. The problem I am running into is that if the current day is in a new month, the check is failing. Here is what my code looks like: if(iMonth >= iStartMonth && iMonth <= iEndMonth) { if(iDay >= iStartDay && iDay <= iEndDay) { if(iYear >= iStartYear && iYear <= iEndYear) { bEnabled = true; return; When I have something like this: Start date: 3 27 2010 End Date: 4 15 2010 Current Date: 3 31 2010 The day check fails because if (iDay <= iEndDay) does not pass. The scripting language doesn't have a lot of time related functions, and I can't compare timestamps because I'm allowing users to put like "03:27:2010" and "04:15:2010" as start/end dates in a config file. I'm assuming I am just not thinking straight and missing an easy fix.

    Read the article

  • Showing renames in hg log?

    - by Ryan Thompson
    I know that Mercurial can track renames of files, but how do I get it to show me renames instead of adds/removes when I do hg log? For instance, instead of: A bin/extract-csv-column.pl A bin/find-mirna-binding.pl A bin/xls2csv-separate-sheets.pl A lib/Text/CSV/Euclid.pm R src/extract-csv-column.pl R src/find-mirna-binding.pl R src/modules/Text/CSV/Euclid.pm R src/xls2csv-separate-sheets.pl I want some indication that four files have been moved. I think I read somewhere that the output is like this to preserve backward-compatibility with something-or-other, but I'm not worried about that.

    Read the article

  • C# .NET Controls for docked tool windows?

    - by Brett Powell
    I was using Qt with C++ to develop my GUI applications, but I have recently switched to try out C# .NET as it is much easier to do what I need to. I was wondering what controls I need to be using for a few things and if they exist for C# .NET or if I need to do something custom/special. If you look in that screenshot, I want to do something similar to how they have each tool window grouped into its own docking area with the option of closing it or breaking it out of the layout so it can be dragged. I am talking about the tool windows titled "Groups", "Resources", "Tools", etc. I also want to make these tool windows stay in the same place when the main window is resized. Qt has spring like widgets that will let you create a UI that keeps its shape when the window is resized. Does anything like this exist in C# .NET?

    Read the article

  • jQuery getting these functions to work together

    - by brett
    I'm new to jQuery and have tried looking around for an answer on how to do this. I have 2 functions and I would like both to work together. The one function is submitHandler and its used to hide a form and at the same time add a class to a hidden element to unhide it - ie a thank you for submitting h1. The other function is to grab the input data and display it onsubmit in the form. So the problem is that I can get that one to work but then the other doesnt. Ie on form submit I can see the data input but not the h1 Thank you message. Here are the functions: SubmitHandler: submitHandler: function() { $("#content").empty(); $("#content").append( "<p>If you want to be kept in the loop...</p>" + "<p>Or you can contact...</p>" ); $('h1.success_').removeClass('success_').addClass('success_form'); $('#contactform').hide(); }, onsubmit="return inputdata()" function inputdata(){ var usr = document.getElementById('contactname').value; var eml = document.getElementById('email').value; var msg = document.getElementById('message').value; document.getElementById('out').innerHTML = usr + " " + eml + msg; document.getElementById('out').style.display = "block"; return true; }, The form uses PHP and jQuery - I dont know about AJAX but after some reading even less sure. Please help me out I dont know what I'm doing and at the moment I am learning but its a long road for me still. Thank you The form: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform" onsubmit="return inputdata()"> <div class="_required"><p class="label_left">Name*</p><input type="text" size="50" name="contactname" id="contactname" value="" class="required" /></div><br/><br/> <div class="_required"><p class="label_left">E-mail address*</p><input type="text" size="50" name="email" id="email" value="" class="required email" /></div><br/><br/> <p class="label_left">Message</p><textarea rows="5" cols="50" name="message" id="message" class="required"></textarea><br/> <input type="submit" value="submit" name="submit" id="submit" /> </form> The PHP bit: <?php $subject = "Website Contact Form Enquiry"; //If the form is submitted if(isset($_POST['submit'])) { //Check to make sure that the name field is not empty if(trim($_POST['contactname']) == '') { $hasError = true; } else { $name = trim($_POST['contactname']); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) == '') { $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $hasError = true; } else { $email = trim($_POST['email']); } //Check to make sure comments were entered if(trim($_POST['message']) == '') { $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['message'])); } else { $comments = trim($_POST['message']); } } //If there is no error, send the email if(!isset($hasError)) { $emailTo = '[email protected]'; //Put your own email address here $body = "Name: $name \n\nEmail: $email \n\nComments:\n $comments"; $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ? The Jquery Validate bit: $(document).ready(function(){ $('#contactform').validate({ showErrors: function(errorMap, errorList) { //restore the normal look $('#contactform div.xrequired').removeClass('xrequired').addClass('_required'); //stop if everything is ok if (errorList.length == 0) return; //Iterate over the errors for(var i = 0;i < errorList.length; i++) $(errorList[i].element).parent().removeClass('_required').addClass('xrequired'); }, Here is the full jQuery bit: $(document).ready(function(){ $('#contactform').validate({ showErrors: function(errorMap, errorList) { //restore the normal look $('#contactform div.xrequired').removeClass('xrequired').addClass('_required'); //stop if everything is ok if (errorList.length == 0) return; //Iterate over the errors for(var i = 0;i < errorList.length; i++) $(errorList[i].element).parent().removeClass('_required').addClass('xrequired'); }, submitHandler: function() { $('h1.success_').removeClass('success_').addClass('success_form'); $("#content").empty(); $("#content").append('#sadhu'); $('#contactform').hide(); }, }); }); Latest edit - Looks like this: $(document).ready(function(){ $('#contactform').validate({ showErrors: function(errorMap, errorList) { //restore the normal look $('#contactform div.xrequired').removeClass('xrequired').addClass('_required'); //stop if everything is ok if (errorList.length == 0) return; //Iterate over the errors for(var i = 0;i < errorList.length; i++) $(errorList[i].element).parent().removeClass('_required').addClass('xrequired'); }, function submitHandler() { $('h1.success_').removeClass('success_').addClass('success_form'); $("#content").empty(); $("#content").append('#sadhu'); $('#contactform').hide(); }, function inputdata() { var usr = document.getElementById('contactname').value; var eml = document.getElementById('email').value; var msg = document.getElementById('message').value; document.getElementById('out').innerHTML = usr + " " + eml + msg; document.getElementById('out').style.display = "block"; }, $(document).ready(function(){ $('#contactForm').submit(function() { inputdata(); submitHandler(); }); }); });

    Read the article

  • What database table structure should I use for versions, codebases, deployables?

    - by Zac Thompson
    I'm having doubts about my table structure, and I wonder if there is a better approach. I've got a little database for version control repositories (e.g. SVN), the packages (e.g. Linux RPMs) built therefrom, and the versions (e.g. 1.2.3-4) thereof. A given repository might produce no packages, or several, but if there are more than one for a given repository then a particular version for that repository will indicate a single "tag" of the codebase. A particular version "string" might be used to tag a version of the source code in more than one repository, but there may be no relationship between "1.0" for two different repos. So if packages P and Q both come from repo R, then P 1.0 and Q 1.0 are both built from the 1.0 tag of repo R. But if package X comes from repo Y, then X 1.0 has no relationship to P 1.0. In my (simplified) model, I have the following tables (the x_id columns are auto-incrementing surrogate keys; you can pretend I'm using a different primary key if you wish, it's not really important): repository - repository_id - repository_name (unique) ... version - version_id - version_string (unique for a particular repository) - repository_id ... package - package_id - package_name (unique) - repository_id ... This makes it easy for me to see, for example, what are valid versions of a given package: I can join with the version table using the repository_id. However, suppose I would like to add some information to this database, e.g., to indicate which package versions have been approved for release. I certainly need a new table: package_version - version_id - package_id - package_version_released ... Again, the nature of the keys that I use are not really important to my problem, and you can imagine that the data column is "promotion_level" or something if that helps. My doubts arise when I realize that there's really a very close relationship between the version_id and the package_id in my new table ... they must share the same repository_id. Only a small subset of package/version combinations are valid. So I should have some kind of constraint on those columns, enforcing that ... ... I don't know, it just feels off, somehow. Like I'm including somehow more information than I really need? I don't know how to explain my hesitance here. I can't figure out which (if any) normal form I'm violating, but I also can't find an example of a schema with this sort of structure ... not being a DBA by profession I'm not sure where to look. So I'm asking: am I just being overly sensitive?

    Read the article

  • jQuery sibling selector?

    - by Brett
    Hi, I have a table which I'm trying to do a pricing list, that auto-computes the tax component.. I'm getting the value from price_1, applying a math cal, and saving it to tax_1. I could read the number of the end of the id, but hopefully there is a cleaner way with jQuery. E.g. I would have a lot of fields like.. price_1 price_2 price_3 tax_1 tax_2 tax_3 etc... I can use the following code to call jQuery on change of a price, and get the value of that price. How do I update the tax field next to it? should I use a sibling selector or something?? $('#pricing').delegate("input", "change", function(){ $(this).val() /* the value of the price */; })

    Read the article

  • does the condition after && always get evaluated

    - by brett
    I have this if statement that tests for the 2 conditions below. The second one is a function `goodToGo() so I want to call it unless the first condition is already true $value = 2239; if ($value < 2000 && goodToGo($value)){ //do stuff } function goodToGo($value){ $ret = //some processing of the value return $ret; } My question is about the 2 if conditions $value < 2000 && goodToGo($value). Do they both get evaluated or does the second one only get evaluated when the first one is true? In other words, are the following 2 blocks the same? if($value < 2000 && goodToGo($value)) { //stuff to do } if($value < 2000) { if (goodToGo($value)){ //stuff to do } }

    Read the article

  • Help Using NetuserAdd() and NetLocalGroupAddMembers() in C++

    - by Brett Powell
    So I think I almost got it. I create my dummy account with one function, and wrote a second function to add it to the Remote Desktop group. Problem is, the Administrator account is the one logged in, so I am not sure how to specify what account to add to the group. Here is my code... The user is being created properly... void AddRDPUser() { USER_INFO_1 ui; DWORD dwLevel = 1; DWORD dwError = 0; NET_API_STATUS nStatus; ui.usri1_name = L"BrettXFactor"; ui.usri1_password = L"XfactorsServer96"; ui.usri1_priv = USER_PRIV_USER; ui.usri1_home_dir = NULL; ui.usri1_comment = NULL; ui.usri1_flags = UF_SCRIPT; ui.usri1_script_path = NULL; nStatus = NetUserAdd(NULL, dwLevel, (LPBYTE)&ui, &dwError); } But I dont know how to specify to add them to this group since they are not logged in. Any help would be appreciated void AddToGroup() { LOCALGROUP_MEMBERS_INFO_3 lgmi3; DWORD dwLevel = 3; DWORD totalEntries = 1; NET_API_STATUS nStatus; LPCWSTR TargetGroup = L"Remote Desktop Users"; LPSTR sBuffer = NULL; memset(sBuffer, 0, 255); DWORD nBuffSize = sizeof(sBuffer); if(GetUserNameEx(NameDnsDomain, sBuffer, &nBuffSize)==0) { Msg("Failed to add User to Group\n"); return; } LPWSTR user_name = (LPWSTR)sBuffer; lgmi3.lgrmi3_domainandname = user_name; nStatus = NetLocalGroupAddMembers(NULL, TargetGroup, 3, (LPBYTE)&lgmi3, totalEntries); }

    Read the article

  • Using NSPredicate to filter on both Core attribute and entity

    - by Ben Thompson
    I have two entities in core data (call them entityOne and entityTwo). I have a entityOne<---entityTwo relationship between them. I am now trying to code an NSPredicate to fetch entityTwo objects on the following basis: Fetch entityTwo objects that have a relationship with a specified entityOne object. Filter out those entityTwo objects which have no value for one of their attributes. I am best doing both of these in an NSPredicate or is there a better way? I am trying the following: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(attribute <> "") AND (relationship == entityOne"]; [request setPredicate:predicate]; Any pointers on coding great fully received.

    Read the article

  • Javascript click function

    - by Gordon Carpenter-Thompson
    I've got some code which works fine in IE but unfortunately not in Google Chrome/Firefox. It relies upon calling a click() event on a button from javascript. Reading around it seems that this is an IE specific extension (doh). Is there any way I can do a similar thing in chrome + firefox? Thanks

    Read the article

  • Is there a way to write System.Drawing.Graphics to PDF from C#?

    - by Brett Ryan
    I have a whole bunch of 2D graphics that is being used for both rendering controls on screen and used to print, it's pretty custom graphics that couldn't be done by any 3rd party reporting tools or off the shelf controls. The program can generate PDF files of the printed content but when I wrote it I cheated and just print the Graphics object to an in memory image and then embed that into the PDF page. Since the users are emailing the documents they're finding they are too large. I've started writing the PDF from scratch using iText, however is there a way to get System.Drawing.Graphics content directly into PDF? The way iText works and Graphics works is completely different.

    Read the article

  • CI Build status output alternatives

    - by Brett Rigby
    We currently use Cradiator to display the status of our continuous integration (CI) builds from CruseControl.net, on a 42" Samsung television on display high-up in our IT department. Cradiator is a great starting place, but we're getting to the point whereby we're having lots of projects on there and it's starting to get a bit 'full'. What I'd like to know is, what do you use to display your build statuses? Custom software? Off the shelf stuff? etc. Alternatively, I'm looking for ideas on how we improve on Cradiator.

    Read the article

  • C++ NetUserAdd() not working?

    - by Brett Powell
    I posted earlier about how to do this, and got some great replies, and have managed to get the code written based off the MSDN example. However, it does not seem to be working properly. Its printing out the ERROR_ACCESS_DENIED message, but im not sure why as I am running it as a full admin. I was initially trying to create a USER_PRIV_ADMIN, but the MSDN said it can only use USER_PRIV_USER, but sadly neither work. Im hoping someone can spot a mistake or has an idea. Thanks! void AddRDPUser() { USER_INFO_1 ui; DWORD dwLevel = 1; DWORD dwError = 0; NET_API_STATUS nStatus; ui.usri1_name = L"DummyUserAccount"; ui.usri1_password = L"a2cDz3rQpG8"; //ignored by NetUserAdd //ui.usri1_password_age = -1; ui.usri1_priv = USER_PRIV_USER; //USER_PRIV_ADMIN; ui.usri1_home_dir = NULL; ui.usri1_comment = NULL; ui.usri1_flags = UF_SCRIPT; ui.usri1_script_path = NULL; nStatus = NetUserAdd(NULL, dwLevel, (LPBYTE)&ui, &dwError); switch (nStatus) { case NERR_Success: { Msg("SUCCESS!\n"); break; } case NERR_InvalidComputer: { fprintf(stderr, "A system error has occurred: NERR_InvalidComputer\n"); break; } case NERR_NotPrimary: { fprintf(stderr, "A system error has occurred: NERR_NotPrimary\n"); break; } case NERR_GroupExists: { fprintf(stderr, "A system error has occurred: NERR_GroupExists\n"); break; } case NERR_UserExists: { fprintf(stderr, "A system error has occurred: NERR_UserExists\n"); break; } case NERR_PasswordTooShort: { fprintf(stderr, "A system error has occurred: NERR_PasswordTooShort\n"); break; } case ERROR_ACCESS_DENIED: { fprintf(stderr, "A system error has occurred: ERROR_ACCESS_DENIED\n"); break; } } }

    Read the article

  • In perl, how can I call a method whose name I have in a string?

    - by Ryan Thompson
    I'm trying to write some abstract code for searching through a list of similar objects for the first one whose attributes match specific values. In order to do this, I need to call a bunch of accessor methods and check all their values one by one. I'd like to use an abstraction like this: sub verify_attribute { my ($object, $attribute_method, $wanted_value) = @_; if ( call_method($object, $attribute_method) ~~ $wanted_value ) { return 1; } else { return; } } Then I can loop through a hash whose keys are accessor method names and whose values are the values I'm looking for for those attributes. For example, if that hash is called %wanted, I might use code like this to find the object I want: my $found_object; FINDOBJ: foreach my $obj (@list_of_objects) { foreach my $accessor (keys %wanted) { next FINDOBJ unless verify_attribute($obj, $accessor, $wanted{$accessor}); } # All attrs verified $found_object = $obj; last FINDOBJ; } Of course, the only problem is that call_method does not exsit. Or does it? How can I call a method if I have a string containing its name? Or is there a better solution to this whole problem?

    Read the article

  • Feedback on Optimizing C# NET Code Block

    - by Brett Powell
    I just spent quite a few hours reading up on TCP servers and my desired protocol I was trying to implement, and finally got everything working great. I noticed the code looks like absolute bollocks (is the the correct usage? Im not a brit) and would like some feedback on optimizing it, mostly for reuse and readability. The packet formats are always int, int, int, string, string. try { BinaryReader reader = new BinaryReader(clientStream); int packetsize = reader.ReadInt32(); int requestid = reader.ReadInt32(); int serverdata = reader.ReadInt32(); Console.WriteLine("Packet Size: {0} RequestID: {1} ServerData: {2}", packetsize, requestid, serverdata); List<byte> str = new List<byte>(); byte nextByte = reader.ReadByte(); while (nextByte != 0) { str.Add(nextByte); nextByte = reader.ReadByte(); } // Password Sent to be Authenticated string string1 = Encoding.UTF8.GetString(str.ToArray()); str.Clear(); nextByte = reader.ReadByte(); while (nextByte != 0) { str.Add(nextByte); nextByte = reader.ReadByte(); } // NULL string string string2 = Encoding.UTF8.GetString(str.ToArray()); Console.WriteLine("String1: {0} String2: {1}", string1, string2); // Reply to Authentication Request MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write((int)(1)); // Packet Size writer.Write((int)(requestid)); // Mirror RequestID if Authenticated, -1 if Failed byte[] buffer = stream.ToArray(); clientStream.Write(buffer, 0, buffer.Length); clientStream.Flush(); } I am going to be dealing with other packet types as well that are formatted the same (int/int/int/str/str), but different values. I could probably create a packet class, but this is a bit outside my scope of knowledge for how to apply it to this scenario. If it makes any difference, this is the Protocol I am implementing. http://developer.valvesoftware.com/wiki/Source_RCON_Protocol

    Read the article

  • Do I have to worry about escaping XML reserved characters before I return a DataContract object from

    - by Brett Widmeier
    Hi, I am pretty inexperienced with WCF. I have a DataContract that implements the IExtensibleDataObject interface. Some of the members of this object are populated from freetext input and could contain XML reserved characters ('', for example). I imagine that I get escaping of these characters for free with WCF, but I have been looking around and could not find anything commenting on this one way or another. Is this the case? I have set my service to log the messages that it sends and receives for viewing in the Trace Viewer. Part of a message that my service returns looks like this: <sInstructions>"></sInstructions> Now, I have a couple questions about this. 1) Is it actually transmitting "&gt; and just showing it in a more readable form in the trace viewer? 2) If it is actually is transmitting ">, is this legal XML?

    Read the article

  • Fulltext and composite indexes and how they affect the query

    - by Brett
    Just say I had a query as below.. SELECT name,category,address,city,state FROM table WHERE MATCH(name,subcategory,category,tag1) AGAINST('education') AND city='Oakland' AND state='CA' LIMIT 0, 10; ..and I had a fulltext index as name,subcategory,category,tag1 and a composite index as city,state; is this good enough for this query? Just wondering if something extra is needed when mixing additional AND's when making use of the fulltext index with the MATCH/AGAINST. Edit: What I am trying to understand is, what happens with the additional columns that are within the query but are not indexed in the chosen index (the fulltext index), the above example being city and state. How does MySQL now find the matching rows for these since it can't use two indexes (or can it?) - so, basically, I'm trying to understand how MySQL goes about finding the data optimally for the columns NOT in the chosen fulltext index and if there is anything I can or should do to optimize the query.

    Read the article

  • How can I make the output from tapply() into a data.frame

    - by James Thompson
    I have a data.frame in R that looks like this: score rms template aln_id description 1 -261.410 4.951 2f22A.pdb 2F22A_1 S_00001_0000002_0 2 -231.987 21.813 1wb9A.pdb 1WB9A_4 S_00002_0000002_0 3 -263.722 4.903 2f22A.pdb 2F22A_3 S_00003_0000002_0 4 -269.681 17.732 1wbbA.pdb 1WBBA_6 S_00004_0000002_0 5 -258.621 19.098 1rxqA.pdb 1RXQA_3 S_00005_0000002_0 6 -246.805 6.889 1rxqA.pdb 1RXQA_15 S_00006_0000002_0 7 -281.300 16.262 1wbdA.pdb 1WBDA_11 S_00007_0000002_0 8 -271.666 4.193 2f22A.pdb 2F22A_2 S_00008_0000002_0 9 -277.964 13.066 1wb9A.pdb 1WB9A_5 S_00009_0000002_0 10 -261.024 17.153 1yy9A.pdb 1YY9A_2 S_00001_0000003_0 I can calculate summary statistics on the data.frame like this: > tapply( d$score, d$template, mean ) 1rxqA.pdb 1wb9A.pdb 1wbbA.pdb 1wbdA.pdb 1yy9A.pdb 2f22A.pdb -252.7130 -254.9755 -269.6810 -281.3000 -261.0240 -265.5993 Is there an easy way that I coerce this output back into a data.frame? I'd like for it to have these two columns: d$template mean I love tapply, but right now I'm cutting and pasting the results from tapply into a text file and hacking it up a bit to get the summary statistics that I want with appropriate names. This feels very wrong, and I'd like to do something better!

    Read the article

  • How do I use the additional Silverlight Toolkit controls?

    - by Brett Rigby
    I've got VS2010 installed, I've downloaded the Windows Phone add-in and the Silverlight Toolkit from CodePlex, but I cannot work out for the life of me how to actually use the controls in a Windows Phone 7 application... How do I add the controls into the toolbox, or link them so that the XAML doesn't give me errors all the time? For instance, using the Viewbox - the controls aren't implemented, and the XAML does not compile.

    Read the article

  • Giving my function access to outside variable

    - by brett
    I have an array outside: $myArr = array(); I would like to give my function access to the array outside it so it can add values to it function someFuntion(){ $myVal = //some processing here to determine value of $myVal $myArr[] = $myVal; } How do I give the function the right scoping to the variable?

    Read the article

  • Excel VBA File not Found

    - by Brett
    During development of some Excel vba code about every other iteration where I go in and add some code then save the file, the next time I open the thing (it is automatically set to run the code on open) I get a spurious "File not Found" error. To fix it I copy all the code- modules and classes plus the startup code, to a fresh blank excel file save it and it runs fine. This happens in both Excel 2003 and 2007. What is happening here?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14  | Next Page >