Search Results

Search found 2581 results on 104 pages for 'mike gifford'.

Page 61/104 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • Yet another "What is this code doing"-type of Perl code

    - by Mike
    I have inherited some code from a guy whose favorite past time was to shorten every line to its absolute minimum (and sometimes only to make it look cool). His code is hard to understand but I managed to understand (and rewrite) most of it. Now I have stumbled on a piece of code which, no matter how hard I try, I cannot understand. my @heads = grep {s/\.txt$//} OSA::Fast::IO::Ls->ls($SysKey,'fo','osr/tiparlo',qr{^\d+\.txt$}) || (); my @selected_heads = (); for my $i (0..1) { $selected_heads[$i] = int rand scalar @heads; for my $j (0..@heads-1) { last if (!grep $j eq $_, @selected_heads[0..$i-1]); $selected_heads[$i] = ($selected_heads[$i] + 1) % @heads; #WTF? } my $head_nr = sprintf "%04d", $i; OSA::Fast::IO::Cp->cp($SysKey,'',"osr/tiparlo/$heads[$selected_heads[$i]].txt","$recdir/heads/$head_nr.txt"); OSA::Fast::IO::Cp->cp($SysKey,'',"osr/tiparlo/$heads[$selected_heads[$i]].cache","$recdir/heads/$head_nr.cache"); } From what I can understand, this is supposed to be some kind of randomizer, but I never saw a more complex way to achieve randomness. Or are my assumptions wrong? At least, that's what this code is supposed to do. Select 2 random files and copy them. === NOTES === The OSA Framework is a Framework of our own. They are named after their UNIX counterparts and do some basic testing so that the application does not need to bother with that.

    Read the article

  • MySQL database - backup problem

    - by Mike
    Hi I need to backup MySQL database and then deploy it on another MySQL server. The problem is, I need it backup without data , just script which creates database, tables, procedures, users, resets autoincrements etc. ... I tried MySQL administrator tool (Windows) and UNchecked "complete inserts check box", but it still created it ... Thanks in advance

    Read the article

  • What tech needed to run JSP and Servlets?

    - by Mike
    If I want to build a site with PHP, all I have to do is install the PHP package and make sure mod_php is enabled in my apache web server. Voila! a PHP environment. Now, if I want to build a site with equivalent Java tech, i.e. JSP and Servlets, What do I have to install?

    Read the article

  • How should child views of UIScrollView report their bounds for contentSize?

    - by Mike
    I'm looking more for advice on the correct design for a view. What I have is a UIScrollView that contains one or more custom Views I have created. My problem is, who reports to the scrollview what it's contentSize should be? I have the following: UIView +-UIScrollView +-CustomView 1 with dynamic height depending on data +-CustomView 2 with dynamic Height depending on data The UIViewController creates new instances of the custom views with data and then adds them as subviews to the UIScrollView. The problem I'm having is how to set the value of the scrollview's contentSize? Right now, I'm not doing that and the contents of the scrollview are clipped with no scrolling possible. Should the custom view call [parent setContentSize:] in its drawRect:? Should the UIViewController query the custom view after creation to get its bounds and then call setContentSize? Should I subclass the UIScrollView to override addSubView to query each subview's height? Is there something else I'm missing? I hope I explained that properly. I'm new to this and still getting a handle on things.

    Read the article

  • .net equivalent of htmlunit?

    - by mike
    Does anybody know if there is a .net equivalent of htmlunit or similar library? I've heard that people have used IKVM to convert the htmlunit library. But I have also heard that the converted code is slow. Requirements: Headless browser Support javascript Handle cookies .Net

    Read the article

  • Can't read query string if default index file name is omitted?

    - by Mike
    Is there an issue with IIS or ASP Classic where *Request.ServerVariables("QUERY_STRING")* returns blank if no default file name is given in the URL? On my local developer machine, I can do http://localhost/xslt/?opcs/abc which returns "opcs/abc". However, on our ancient web server, it returns nothing. I have to explicitly give it the default file name in the URL. Like so http://localhost/xslt/default.asp?opcs/abc While nothing too major, it is a little bit of a annoyance. One way I can maybe think of remidying the problem is have Javascript read the URL and return everything after the ?. Unfortunately, I do not know what version of IIS or ASP we are using. Thank you.

    Read the article

  • Deleting first item of a $_COOKIE array

    - by Mike Burke
    if I add an item to the $_COOKIE array as such: setcookie("favorites[]", "value", time()+3600); I can delete any item from the $_COOKIE[favorites] array like this: setcookie("favorites[$deletekey]", "", time()+3600); EXCEPT the first one added so this does not work: setcookie("favorites[0]", "", time()+3600*24); How can I delete the first one and leave others intact?

    Read the article

  • One IBOutlet for two UILabels

    - by Mike Rychev
    I have two views within one .xib (one view for landscape, another for portrait). How can I use the same IBOutlet I've defined in @interface section for both labels if they have the same functionality. (ctrl+dragging to both of them does'n help-each time I drag to second, the first one loses its outlet).

    Read the article

  • Could my forms be hacked.

    - by Mike Sandman
    Hi there, I posted a question yesterday, which I intend to get back to today however I wrote some JavaScript as a first line of prevention against XSS. However when testing this on my live server I catch some invalid input as the javascript catches the php section. My form uses post and php isn't in my form items (i haven't typed it in). Could this be picking up the form action or something? I'm baffeled, Any ideas Here is my code, it is triggered on the submit button. function validateForBadNess(){ var theShit = new Array("*","^", "$", "(",")","{", "}","[", "]","\", "|", "'","/","?",",","=","","gt","lt", "<","script","`","´","php"); var tagName = new Array(); tagName[0] = "input"; tagName[1] = "select"; tagName[2] = "textbox"; tagName[3] = "textarea"; for (ms=0;ms // loop through the elements of the form var formItems = document.getElementsByTagName(tagName[ms]); for (var xs=0;xs var thisString = formItems[xs].value; // loop through bad array for (zs in theShit){ //alert(thisString + " " + thisString.indexOf(theShit[zs])) if(thisString.indexOf(theShit[zs]) >= 0){ alert("Sorry but the following character: " + theShit[zs] + " is not permitted. Please omit it from your input.\nIf this is part of your password please contact us to heave your password reset.") return false; } } // loop for formitems } // tagName toop } // original condition }

    Read the article

  • accessing view controller's view

    - by Mike
    I am inside a class on a view-based app, one that was creating with one view controller. WHen I am inside the view controller I can access its view using self.view, but how do I access the same view if I am inside a class? [[UIApplication sharedApplication] delegate]... //??? what do I put here? thanks

    Read the article

  • R:how to get grep to return the match, rather than the whole string

    - by Mike Dewar
    Hi, I have what is probably a really dumb grep in R question. Apologies, because this seems like it should be so easy - I'm obviously just missing something. I have a vector of strings, let's call it alice. Some of alice is printed out below: T.8EFF.SP.OT1.D5.VSVOVA#4 T.8EFF.SP.OT1.D6.LISOVA#1 T.8EFF.SP.OT1.D6.LISOVA#2 T.8EFF.SP.OT1.D6.LISOVA#3 T.8EFF.SP.OT1.D6.VSVOVA#4 T.8EFF.SP.OT1.D8.VSVOVA#3 T.8EFF.SP.OT1.D8.VSVOVA#4 T.8MEM.SP#1 T.8MEM.SP#3 T.8MEM.SP.OT1.D106.VSVOVA#2 T.8MEM.SP.OT1.D45.LISOVA#1 T.8MEM.SP.OT1.D45.LISOVA#3 I'd like grep to give me the number after the D that appears in some of these strings, conditional on the string containing "LIS" and an empty string or something otherwise. I was hoping that grep would return me the value of a capturing group rather than the whole string. Here's my R-flavoured regexp: pattern <- (?<=\\.D)([0-9]+)(?=.LIS) nothing too complicated. But in order to get what I'm after, rather than just using grep(pattern, alice, value = TRUE, perl = TRUE) I'm doing the following, which seems bad: reg.out <- regexpr( "(?<=\\.D)[0-9]+(?=.LIS)", alice, perl=TRUE ) substr(alice,reg.out,reg.out + attr(reg.out,"match.length")-1) Looking at it now it doesn't seem too ugly, but the amount of messing about it's taken to get this utterly trivial thing working has been embarrassing. Anyone any pointers about how to go about this properly? Bonus marks for pointing me to a webpage that explains the difference between whatever I access with $,@ and attr.

    Read the article

  • XSLT Select all nodes containing a specific substing

    - by Mike
    I'm trying to write an XPath that will select certain nodes that contain a specific word. In this case the word is, "Lockwood". The correct answer is 3. Both of these paths give me 3. count(//*[contains(./*,'Lockwood')]) count(BusinessLetter/*[contains(../*,'Lockwood')]) But when I try to output the text of each specific node //*[contains(./*,'Lockwood')][1] //*[contains(./*,'Lockwood')][2] //*[contains(./*,'Lockwood')][3] Node 1 ends up containing all the text and nodes 2 and 3 are blank. Can some one please tell me what's happening or what I'm doing wrong. Thanks. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="XPathFunctions.xsl"?> <BusinessLetter> <Head> <SendDate>November 29, 2005</SendDate> <Recipient> <Name Title="Mr."> <FirstName>Joshua</FirstName> <LastName>Lockwood</LastName> </Name> <Company>Lockwood &amp; Lockwood</Company> <Address> <Street>291 Broadway Ave.</Street> <City>New York</City> <State>NY</State> <Zip>10007</Zip> <Country>United States</Country> </Address> </Recipient> </Head> <Body> <List> <Heading>Along with this letter, I have enclosed the following items:</Heading> <ListItem>two original, execution copies of the Webucator Master Services Agreement</ListItem> <ListItem>two original, execution copies of the Webucator Premier Support for Developers Services Description between Lockwood &amp; Lockwood and Webucator, Inc.</ListItem> </List> <Para>Please sign and return all four original, execution copies to me at your earliest convenience. Upon receipt of the executed copies, we will immediately return a fully executed, original copy of both agreements to you.</Para> <Para>Please send all four original, execution copies to my attention as follows: <Person> <Name> <FirstName>Bill</FirstName> <LastName>Smith</LastName> </Name> <Address> <Company>Webucator, Inc.</Company> <Street>4933 Jamesville Rd.</Street> <City>Jamesville</City> <State>NY</State> <Zip>13078</Zip> <Country>USA</Country> </Address> </Person> </Para> <Para>If you have any questions, feel free to call me at <Phone>800-555-1000 x123</Phone> or e-mail me at <Email>[email protected]</Email>.</Para> </Body> <Foot> <Closing> <Name> <FirstName>Bill</FirstName> <LastName>Smith</LastName> </Name> <JobTitle>VP of Operations</JobTitle> </Closing> </Foot> </BusinessLetter>

    Read the article

  • Standard Android Button with a different color

    - by Mike
    I'd like to change the color of a standard Android button slightly in order to better match a client's branding. For example, see the "Find a Table" button for the OpenTable application: The best way I've found to do this so far is to change the Button's drawable to the following drawable located in res/drawable/red_button.xml: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/red_button_pressed" /> <item android:state_focused="true" android:drawable="@drawable/red_button_focus" /> <item android:drawable="@drawable/red_button_rest" /> </selector> But doing that requires that I actually create three different drawables for each button I want to customize (one for the button at rest, one when focused, and one when pressed). That seems more complicated and non-DRY than I need. All I really want to do is apply some sort of color transform to the button. Is there an easier way to go about changing a button's color than I'm doing?

    Read the article

  • Which key value store is the most promising/stable?

    - by Mike Trpcic
    I'm looking to start using a key/value store for some side projects (mostly as a learning experience), but so many have popped up in the recent past that I've got no idea where to begin. Just listing from memory, I can think of: CouchDB MongoDB Riak Redis Tokyo Cabinet Berkeley DB Cassandra MemcacheDB And I'm sure that there are more out there that have slipped through my search efforts. With all the information out there, it's hard to find solid comparisons between all of the competitors. My criteria and questions are: (Most Important) Which do you recommend, and why? Which one is the fastest? Which one is the most stable? Which one is the easiest to set up and install? Which ones have bindings for Python and/or Ruby? Edit: So far it looks like Redis is the best solution, but that's only because I've gotten one solid response (from ardsrk). I'm looking for more answers like his, because they point me in the direction of useful, quantitative information. Which Key-Value store do you use, and why? Edit 2: If anyone has experience with CouchDB, Riak, or MongoDB, I'd love to hear your experiences with them (and even more so if you can offer a comparative analysis of several of them)

    Read the article

  • C# pulling out columns from combobox text

    - by Mike
    What i have is four comboboxes and two files. If the column matches the combobox i need to write it out to a file but it has to appened with the second combobox. So for example Combobox1: Apple | Orange Combobox2: Pineapple | Plum I have selected Apple Plum I need to search threw a text file and find whatever columns is Apple or Plum: Orange|Pear|Peach|Turnip|Monkey|Apple|Grape|Plum and then i need to write out just the columns Apple|Plum to a new text file. Any help would be awesome! Better example Combobox1 selected item:Apple Combobox2 selected item:Plum Text FILE: APPLE|Pear|Plum|Orange 1|2|3|4 215|3|45|98 125|498|76|4 4165|465|4|65 Resulting File: 1|3 215|45 125|76 4165|4 Thanks for the advice, i dont need help on adding to combobox or reading the files, just how to create a file from a delimited file having multiple columns.

    Read the article

  • How do I maintain coherency between model and view-model in MVVM pattern?

    - by Mike Garrett
    Problem Statement I'm writing a very basic WPF application to alter the contents of a configuration file. The data format is an XML file with a schema. I want to use it as a learning project for MVVM, so I have duly divided the code into Model: C# classes auto-generated from xsd.exe View-Model: View-friendly representation of the Model. View: Xaml and empty code behind I understand how the View-Model can make View-binding a breeze. However, doesn't that leave the View-Model <- Model semantics very awkward? Xsd.exe generates C# classes with arrays for multiple XML elements. However, at the V-VM level you need Observable Collections. Questions: Does this really mean I have to keep two completely different collection types representing the same data in coherence? What are the best practices for maintaining coherence between the Model and the View-Model?

    Read the article

  • Weird background offset of UIToolbar when in formSheet.

    - by Mike A
    As you can see in the pic, the buttons from the toolbar on the right align perfectly with the segmented control on the left. They are displayed on the navigation bar. For some reason though, the background of the toolbar seems to be offset 1px to the bottom. What is especially weird, is this exact same view controller, in fullScreen or even pageSheet, displays everything properly. Segmented control is being allocated: UISegmentedControl* segmentControl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(0,0,300,30)]; Toolbar is being allocated: UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100,44)]; I've spent hours trying to fix this, it's driving me crazy.

    Read the article

  • .htaccess twitter or facebook URL naming convention

    - by Mike Silvis
    For my Social Networking Site, I would like to build a facebook, or twitter similar URL rewriting naming convention. Using Twitter as an example, they have pages labeled twitter.com/about and another page labeled twitter.com/{$username} However, how do you differentiate between say a user who has registers on to our site as "about" then. From this we are going to have a server conflict between the user "about" and the page about. What is the best way to handle this?

    Read the article

  • Synchronizing reading and writing with synchronous NamedPipes

    - by Mike Trader
    A Named Pipe Server is created with hPipe = CreateNamedPipe( zPipePath, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_READMODE_BYTE, PIPE_UNLIMITED_INSTANCES, 8192, 8192, NMPWAIT_USE_DEFAULT_WAIT, NULL) Then we immediately call: ConnectNamedPipe( hPipe, BYVAL %NULL ) Which blocks until the client connects. Then we proceed directly to ReadFile( hPipe, ... The problem is that it takes the Client takes a finite amount of time to prepare and write all the fcgi request parameters. This has usually not completed before the Pipe Server performs its ReadFile(). The Read file operation thus finds no data in the pipe and the process fails. Is there a mechanism to tell when a Write() has occurred/finished after a client has connected to a NamedPipe? If I had control of the Client process, I could use a common Mutex, but I don't, and I really do not want to get into I/O completion ports just to solve this problem! I can of course use a simple timer to wait 60m/s or so which is usually plenty of time for the wrote to complete, but that is a horrible hack.

    Read the article

  • Redimming arrays in VBA

    - by Mike
    I have 3 arrays of data, that are filled by reading off of an excel sheet, some of the points of data are missing and as such have just been entered into excel as "NA" so I want to look through my array and find each instance of these NA's and remove them from the array since the information is useless. I need to update all three arrays at the same time. Sub group_data() Dim country(), roe(), iCap() As String Dim i As Integer For i = 1 To 3357 country(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("C1").Offset(i, 0) roe(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("AP1").Offset(i, 0) iCap(i) = Workbooks("restcompfirm.xls").Worksheets("Sheet1").Range("BM1").Offset(i, 0) Next i End Sub So if I find a "NA" as one of the values in roe or iCap I want to get rid of that piece of data in all there arrays.

    Read the article

  • SQL Complicated Group / Join by Category

    - by Mike Silvis
    I currently have a database structure with two important tables. 1) Food Types (Fruit, Vegetables, Meat) 2) Specific Foods (Apple, Oranges, Carrots, Lettuce, Steak, Pork) I am currently trying to build a SQL statement such that I can have the following. Fruit < Apple, Orange Vegetables < Carrots, Lettuce Meat < Steak, Port I have tried using a statement like the following Select * From Food_Type join (Select * From Foods) as Foods on Food_Type.Type_ID = Foods.Type_ID but this returns every Specific Food, while I only want the first 2 per category. So I basically need my subquery to have a limit statement in it so that it finds only the first 2 per category. However if I simply do the following Select * From Food_Type join (Select * From Foods LIMIT 2) as Foods on Food_Type.Type_ID = Foods.Type_ID My statement only returns 2 results total.

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >