Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 126/171 | < Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >

  • vim autopopulate file

    - by David Oneill
    Is it possible to have VIM auto populate a file based on the extension? For example, when I open a new .sh file, I would like VIM to automatically type #!/bin/bash as the first line. (This example simplified down to the essentials)

    Read the article

  • Simple servlet or filter to process form

    - by David
    Is there a simple framework for processing form submissions via a servlet? For my needs, a framework like STRUTS seems like over kill. My ideal processor would be a servlet that converts form elements into a bean object, possibly using typing information in the form to help with the conversion. Does something like this exist or is there another solution out there geared toward simpler needs? Thanks!

    Read the article

  • (php) regexto remove comments but ignore occurances within strings

    - by David
    Hi there, I am writing a comment-stripper and trying to accommodate for all needs here. I have the below stack of code which removes pretty much all comments, but it actually goes too far. A lot of time was spent trying and testing and researching the regex patterns to match, but I don't claim that they are the best at each. My problem is that I also have situation where I have 'PHP comments' (that aren't really comments' in standard code, or even in PHP strings, that I don't actually want to have removed. Example: <?php $Var = "Blah blah //this must not comment"; // this must comment. ?> What ends up happening is that it strips out religiously, which is fine, but it leaves certain problems: <?php $Var = "Blah blah ?> Also: will also cause problems, as the comment removes the rest of the line, including the ending ? See the problem? So this is what I need... Comment characters within '' or "" need to be ignored PHP Comments on the same line, that use double-slashes, should remove perhaps only the comment itself, or should remove the entire php codeblock. Here's the patterns I use at the moment, feel free to tell me if there's improvement I can make in my existing patterns? :) $CompressedData = $OriginalData; $CompressedData = preg_replace('!/\*.*?\*/!s', '', $CompressedData); // removes /* comments */ $CompressedData = preg_replace('!//.*?\n!', '', $CompressedData); // removes //comments $CompressedData = preg_replace('!#.*?\n!', '', $CompressedData); // removes # comments $CompressedData = preg_replace('/<!--(.*?)-->/', '', $CompressedData); // removes HTML comments Any help that you can give me would be greatly appreciated! :)

    Read the article

  • Tips / Resources for building a Google Chrome plugin

    - by David
    After test driving Google Chrome for 30 minutes or so, I like it, even if it seems bare-bones at the moment. The obvious way to add a few things I can't live without would be through plugins. Does anyone have any links to resources on how to get started building a plugin/addon for Chrome? Thanks.

    Read the article

  • Replacing mysql user authentication with openid

    - by David
    So, I'm working with a really old system which uses a person's mysql database credentials to authenticate to a web site (the database was originally only accessed from the command line, but is now accessed from a php frontend). Because of some internal reasons (and to preserve the user's history), I have to leave the old authentication intact. I've been charged with adding openid authentication to this system. Somehow I need to be able to retrieve a users mysql username and password upon logging into the site through openid (using the Zend framework, by the way). I've thought of simply requiring registration at the first login, where the user must provide their mysql credentials, but I'd rather not store the password plain text. I've also considered blanking everyone's mysql passwords, and just setting the user's mysql username manually (rather than having the user provide this, since they could provide any username). This is turning into a security nightmare. Does anyone have any suggestions for alternatives? This is running on a Linux server, by the way. Also, I can't use mysql pluggable authentication because the mysql version is 5.0 (pluggable authentication requires mysql 5.5), and no, I can't update it.

    Read the article

  • ASP.NET Ajax Calendar

    - by David Bonnici
    I am using MS AJAX ASP.NET Components (Calendar Extender) and I'm finding this problem. Some weekdays are not being displayed.... I uploaded a picture so you can view exactly how it is being displayed... The one on the right (calnder) in the picture is taken from microsoft's sample. Have you got any idea what is causing this problem? See screenshot: http://www.sajtkik.com/calendar.jpg Thanks Alot!

    Read the article

  • Whats the difference between a C++ and a Cocoa Project in Xcode?

    - by david
    I need to work with TagLib for my project. I've created a framework (and I tried using it as a lib) but the compiler cannot find #include < strings on compiling (No such file or Directory). I've created a test C++ project and it #includes < strings just fine. I've looked at the project settings and I cannot find a difference between them. But the standard cocoa projects obviously so not have the search path set to include C++ libraries (Or am I completely getting it wrong?). I've searched for a solution but no one else seems to have run into this problem.

    Read the article

  • How to randomly assign a partner?

    - by David
    I asked a question some time ago about creating a random circular partner assignment using php and mysql. This is a related issue. I am working from the following code to try to give two users new, randomly selected partners: $q = "SELECT user_id FROM users WHERE partner='$quit_partner' AND status='1'"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); while ($row = mysqli_fetch_array($r)) { $users[] = $row[0]; } $current = end($users); $partners = array(); foreach ($users as $user) { $partners[$user] = $current; $current = $user; $q = "UPDATE users SET partner='{$partners[$user]}' WHERE user_id='{$user}'"; mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); } Basically, a particular user (lets say user #4) quits the activity, leaving multiple other users without a partner (hypothetically, users # 5,6,7). I need to find out who those users are, hence the first query. Once I find them, I throw them into an array. Then comes the difficult part. I want those newly partnerless users (5,6,7) to be randomly assigned new partners from everyone in the table. The current code is flawed in that it only assigns the newly partnerless users eachother. Thanks for your help.

    Read the article

  • Problems with 'while' loop and 'for' loop when reading through file

    - by David Beckham
    I wasted plenty of hours trying to figure out the problem but no luck. Tried asking the TA at my school, but he was useless. I am a beginner and I know there are a lot of mistakes in it, so it would be great if I can get some detail explanation as well. Anyways, basically what I am trying to do with the following function is: Use while loop to check and see if random_string is in TEXT, if not return NoneType if yes, then use a for loop to read lines from that TEXT and put it in list, l1. then, write an if statement to see if random_string is in l1. if it is, then do some calculations. else read the next line Finally, return the calculations as a whole. TEXT = open('randomfile.txt') def random (TEXT, random_string): while random_string in TEXT: for lines in TEXT: l1=TEXT.readline().rsplit() if random_string in l1: ''' do some calculations ''' else: TEXT.readline() #read next line??? return #calculations return None

    Read the article

  • What should I put in the href when I prototype?

    - by David
    When protyping we often do empty anchors. A very common way to do this is to do something like: <a href="#">Go here</a> But if the client clicks this link, the page will scroll to the top. But if we leave out the href attribute, the link won't behave like a link. I've see stuff like: <a href="javascript;">Go here</a> But it doesn't look right. Any other ideas?

    Read the article

  • Avaliable parallel technologies in .Net

    - by David
    I am new to .Net platform. I did a search and found that there are several ways to do parallel computing in .Net: Parallel task in Task Parallel Library, which is .Net 3.5. PLINQ, .Net 4.0 Asynchounous Programming, .Net 2.0, (async is mainly used to do I/O heavy tasks, F# has a concise syntax supporting this). I list this because in Mono, there seem to be no TPL or PLINQ. Thus if I need to write cross platform parallel programs, I can use async. .Net threads. No version limitation. Could you give some short comments on these or add more methods in this list? Thanks.

    Read the article

  • Django: Save an uploaded file to a FileField

    - by David Wolever
    I feel a little stupid for having to ask this… But I can't seem find it documented anywhere. If I've got a Model with FileField, how can I stuff an uploaded FILE into that FileField? For example, I'd like to do something like this: class MyModel(Model): file = FileField(...) def handle_post(request, ...): mymodel = MyModel.objects.get(...) if request.FILES.get("newfile"): mymodel.file = request.FILES["newfile"] But that doesn't appear to work.

    Read the article

  • Basic string and value functions in Objective-C for iPhone

    - by David Maitland
    I have very little programming knowledge; only a fair bit in Visual Basic. How do I take a value from a text field, then do some simple math such as divide the value by two, then display it back to the user in the same field? In Visual Basic you could just do txtBoxOne.text = txtBoxOne.text / 2 I understand this question is more than one question and is very basic stuff, but I need to get my head out of Visual Basic and into where I should be :)

    Read the article

  • How to troubleshoot "The server tag is not well formed. " error on sharepoint?

    - by David Lay
    I'm trying to edit a legacy wss3 sharepoint site. Messing around with a 700+ code lines aspx page I got a "The server tag is not well formed." error on sharepoint and The ?content=1 trick does not work. Anyone has a tip on how to get to the line that's causing the problem? I'm expecting something like the aspnet ysod, at least that's usefull. If it's worth something, I have access to the actual server.

    Read the article

  • list external drives

    - by Asaf David
    in java, you can use File.listRoots() to get all drives in the system. I'm looking to get only the external drives, i.e. USB drives, external hard disks, optical drives, floppy etc'. is there any way to do it in java? if not, native c++ code would be good as well. in that case, i need both windows and linux code thanks

    Read the article

  • division problems

    - by David
    This line of code: System.out.println ("aray[j], "+aray[j]+", divided by sum, "+sum+", equals: aray[j]/sum: "+ aray[j]/sum) ; is yeilding this line of text: aray[j], 21, divided by sum, 100, equals: aray[j]/sum: 0 why is it doing this? (everything is right eccept that the answer should be .21)

    Read the article

  • C# Passing objects and list of objects by reference

    - by David Liddle
    I have a delegate that modifies an object. I pass an object to the delegate from a calling method, however the calling method does not pickup these changes. The same code works if I pass a List as the object. I thought all objects were passed by reference so any modifications would be reflected in the calling method? I can modify my code to pass a ref object to the delegate but am wondering why this is necessary? public class Binder { protected delegate int MyBinder<T>(object reader, T myObject); public void BindIt<T>(object reader, T myObject) { //m_binders is a hashtable of binder objects MyBinder<T> binder = m_binders["test"] as MyBinder<T>; int i = binder(reader, myObject); } } public class MyObjectBinder { public MyObjectBinder() { m_delegates["test"] = new MyBinder<MyObject>(BindMyObject); } private int BindMyObject(object reader, MyObject obj) { //make changes to obj in here } } ///calling method in some other class public void CallingMethod() { MyObject obj = new MyObject(); MyBinder binder = new MyBinder(); binder.BindIt(myReader, obj); //don't worry about myReader //obj should show reflected changes }

    Read the article

  • Access to and availability of private member functions in C++

    - by David
    I am wandering the desert of my brain. I'm trying to write something like the following: class MyClass { // Peripherally Related Stuff public: void TakeAnAction(int oneThing, int anotherThing) { switch(oneThing){ case THING_A: TakeThisActionWith(anotherThing); break; //cases THINGS_NOT_A: }; }; private: void TakeThisActionWith(int thing) { string outcome = new string; outcome = LookUpOutcome(thing); // Do some stuff based on outcome return; } string LookUpOutcome(int key) { string oc = new string; oc = MyPrivateMap[key]; return oc; } map<int, string> MyPrivateMap; Then in the .cc file where I am actually using these things, while compiling the TakeAnAction section, it [CC, the solaris compiler] throws an an error: 'The function LookUpOutcome must have a prototype' and bombs out. In my header file, I have declared 'string LookUpOutcome(int key);' in the private section of the class. I have tried all sorts of variations. I tried to use 'this' for a little while, and it gave me 'Can only use this in non-static member function.' Sadly, I haven't declared anything static and these are all, putatively, member functions. I tried it [on TakeAnAction and LookUp] when I got the error, but I got something like, 'Can't access MyPrivateMap from LookUp'. MyPrivateMap could be made public and I could refer to it directly, I guess, but my sensibility says that is not the right way to go about this [that means that namespace scoped helper functions are out, I think]. I also guess I could just inline the lookup and subsequent other stuff, but my line-o-meter goes on tilt. I'm trying desperately not to kludge it.

    Read the article

  • When is BIG, big enough for a database?

    - by David ???
    I'm developing a Java application that has performance at its core. I have a list of some 40,000 "final" objects, i.e., I have an initialization input data of 40,000 vectors. This data is unchanged throughout the program's run. I am always preforming lookups against a single ID property to retrieve the proper vectors. Currently I am using a HashMap over a sub-sample of a 1,000 vectors, but I'm not sure it will scale to production. When is BIG, actually big enough for a use of DB? One more thing, an SQLite DB is a viable option as no concurrency is involved, so I guess the "threshold" for db use, is perhaps lower.

    Read the article

  • populating a gridview with a button's click event

    - by david padi
    hi I have a page that has two dropdownlists(one for the locations, and the other for departments), an employee search textbox and a button. On the other page, I have a gridview. Now, what i want to archieve is that when a user types an employee's name in the textbox control, selects a location from the location dropdownlist, and a department from the departments dropdownlist, and click the button(search), the gridview on the other page must show the reqiured information of a SINGLE employee. Only one row must show. I have created a database for the employees. I know how to do this with the autopostback but i have not tried it using a button's click. NB: the gridview should show only one row of a selected employee. I'm using ASP.NET VB Your help will high apprecaited.

    Read the article

  • Continue Drupal processing after page send.

    - by David
    I need to do some additional processing after a Drupal page has been sent. I know I could fire a background shell command, but I need the current Drupal execution context to be maintained. I've spent a lot of time looking, but I can't find any documentation in this regard. This is surprising because it must surely be a common requirement. The only real idea I have is to fire up Drupal (again) via a shell command (exec, etc) and supply it with a pseudo path which would invoke the continued processing. But this seems unnecessarily complex/wasteful. Any pointers greatly appreciated, tks.

    Read the article

  • C++ hook process and show status

    - by David
    Ok so I am learning C++ slowly. I am familiar with all the console syntax and everything, but now I'm moving on to windows programming. Now what im trying to do, is create a DLL that I inject into a process, so it's hooked in. All I want the C++ application to do, is have text in it, that says "Hooked" if it's successfully injected, and an error if something wrong happened. Or even if I can do it without a DLL, Just open an executable, and when the certain process I'm trying to hook is opened, the status is changed to "Hooked". Also I have a safaribooksonline.com account so if there is any good reads you would recommend, just write it down. thanks

    Read the article

< Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >