Search Results

Search found 4300 results on 172 pages for 'mark virtue'.

Page 76/172 | < Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >

  • How can I print N array elements with delimiters per line?

    - by Mark B
    I have an array in Perl I want to print with space delimiters between each element, except every 10th element which should be newline delimited. There aren't any spaces in the elements if that matters. I've written a function to do it with for and a counter, but I wondered if there's a better/shorter/canonical Perl way, perhaps a special join syntax or similar. My function to illustrate: sub PrintArrayWithNewlines { my $counter = 0; my $newlineIndex = shift @_; foreach my $item (@_) { ++$counter; print "$item"; if($counter == $newlineIndex) { $counter = 0; print "\n"; } else { print " "; } } }

    Read the article

  • Getting HIERARCHY_REQUEST_ERR when using Javascript to recursively generate a nested list

    - by Mark
    I have a method that is trying to take in a list. This list can contain data and other lists. The end goal is to try to convert something like this ["a", "b", ["c", "d"]] into <ol> <li> <b>a</a> </li> <li> <b>b</a> </li> <ol> <li> <b>c</a> </li> <li> <b>d</a> </li> </ol> </ol> The code is: function $(tagName) { return document.createElement(tagName); } //returns an html element representing data //data should be an array or some sort of value function tagMaker(data) { tag = null; if(data instanceof Array) { //data is an array, represent using <ol> tag = $("ol"); for(i=0; i<data.length; i++) { //construct one <li> for each item in the array listItem = $("li"); //get the html element representing this particular item in the array child = tagMaker(data[i]); //<li>*html for child*</li> listItem.appendChild(child); //add this item to the list tag.appendChild(listItem); } } else { //data is not an array, represent using <b>data</b> tag = $("b"); tag.innerHTML = data.toString(); } return tag; } Calling tagMaker throws HIERARCHY_REQUEST_ERR: DOM Exception 3, rather than generating a helpful HTML element object which I was planning to append to document.body.

    Read the article

  • Javascript/Jquery pop-up window in Asp.Net MVC4

    - by Mark
    Below I have a "button" (just a span with an icon) that creates a pop-up view of a div in my application to allow users to compare information in seperate windows. However, I get and Asp.Net Error as follows: **Server Error in '/' Application. The resource cannot be found. Requested URL: /Home/[object Object]** Does anyone have an Idea of why this is happending? Below is my code: <div class="module_actions"> <div class="actions"> <span class="icon-expand2 pop-out"></span> </div> </div> <script> $(document).ajaxSuccess(function () { var Clone = $(".pop-out").click(function () { $(this).parents(".module").clone().appendTo("#NewWindow"); }); $(".pop-out").click(function popitup(url) { LeftPosition = (screen.width) ? (screen.width - 400) / 1 : 0; TopPosition = (screen.height) ? (screen.height - 700) / 1 : 0; var sheight = (screen.height) * 0.5; var swidth = (screen.width) * 0.5; settings = 'height=' + sheight + ',width=' + swidth + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no, directories=no,titlebar=no,location=no,addressbar=no' newwindow = window.open(url, '/Index', settings); if (window.focus) { newwindow.focus() } return false; }); });

    Read the article

  • C++: Overload != When == Overloaded

    - by Mark W
    Say I have a class where I overloaded the operator == as such: Class A { ... public: bool operator== (const A &rhs) const; ... }; ... bool A::operator== (const A &rhs) const { .. return isEqual; } I already have the operator == return the proper Boolean value. Now I want to extend this to the simple opposite (!=). I would like to call the overloaded == operator and return the opposite, i.e. something of the nature bool A::operator!= (const A &rhs) const { return !( this == A ); } Is this possible? I know this will not work, but it exemplifies what I would like to have. I would like to keep only one parameter for the call: rhs. Any help would be appreciated, because I could not come up with an answer after several search attempts.

    Read the article

  • Curl download image not working

    - by mark
    I would like to check whether a remote image is not older than 2 days and then download it. The image is not downloaded in anycase. What is wrong here? $ch = curl_init($file_source); // the file we are downloading curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FILETIME, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_exec($ch); $headers = curl_getinfo($ch); $last_modified = $headers['filetime']; if ($last_modified != -1) { if ($last_modifiedtime()-86400*2) { $ch2 = curl_init($file_source); $wh = fopen($file_target, 'wb') or errorIMG('003'); curl_setopt($ch2, CURLOPT_FILE, $wh); curl_setopt($ch2, CURLOPT_TIMEOUT, 25); curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch2, CURLOPT_HEADER, true); curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true); curl_exec($ch2); curl_close($ch2); fclose($wh); } } curl_close($ch);

    Read the article

  • How to display a date time in 16 Nov 2011 15:12 format

    - by Mark
    I have a grid view column in which I give the datefomat as dd MMM yyyy HH:mm and in code behind databound I change the time, the same time in database is not shown in the gridview, because of that the date is not displayed in 16 Nov 2011 15:12 format, it is displayed in 16/11/2011 15:12 format, how can i display it in 16 Nov 2011 15:12 format asp <asp:BoundField DataField="SendDate" ItemStyle-Width="15%" HeaderText="Sent At" DataFormatString="{0:dd MMM yyyy HH:mm}" SortExpression="SendDate" /> c# double timeDifference = Convert.ToDouble(Session["utimezone"].ToString()); e.Row.Cells[5].Text = Convert.ToString(senddate.AddMinutes(timeDifference * 60));

    Read the article

  • What stackoverflow questions bring out the best in you? [closed]

    - by Mark Robinson
    This question is to help me (us) ask better questions of this community to encourage better working together. What questions here bring out the best in you? I don't mean which are the best / most appropriate questions but which bring the best out of you? That is, it brings out your best thinking and most constructive behaviour. Consider, for example, questions that make you think or that are asked in a certain way. Or consider specific a question should be. Or more abstractly, questions asked on a certain day / time, ... So I'm not necessarily asking about specific subjects but rather how a question is asked. What inspires you to drop everything and start answering? This comes from my observing questions that get highest points - I’m graduating with a Computer Science degree but I don’t feel like I know how to program. is very positive but my first ever question caused a minor storm. Ironically, I'm nervous posting this question so please don't attack if this is inappropriate.

    Read the article

  • How can one change the primary key using NHibernate.

    - by mark
    Dear ladies and sirs. I want to change the primary key of an entity in database, so that all the relevant foreign key constraints are updated as well./We are using NHibenate as our ORM. Is it possible to do it? Thanks. P.S. I know the practice of changing the primary key is highly discouraged. My problem is that my primary key is backed by a natural Id of the entity, which may sometimes change. We could, theoretically, utilize a unique primary key, unrelated to the natural key of the entity, but this complicates things too much in other places, so this is not an option.

    Read the article

  • script to sum all numbers in a file (linux)

    - by Mark Roberts
    I have a file which contains several thousand numbers, each on it's own line: 34 42 11 6 2 99 ... I'm looking to write a script which will print the sum of all numbers in the file. I've got a solution, but it's not very efficient. (It takes several minutes to run.) I'm looking for a more efficient solution. Any suggestions?

    Read the article

  • Oracle: how to "group by" over a range?

    - by Mark Harrison
    If I have a table like this: pkey age ---- --- 1 8 2 5 3 12 4 12 5 22 I can "group by" to get a count of each age. select age,count(*) n from tbl group by age; age n --- - 5 1 8 1 12 2 22 1 What query can I use to group by age ranges? age n ----- - 1-10 2 11-20 2 20+ 1

    Read the article

  • Non-trivial desktop apps that use Ruby?

    - by Mark A. Nicolosi
    I'm about to start a project developing a Ruby desktop application. I expect to to be fairly big and I want to learn techniques for dividing code among modules and other techniques for managing complexity. Most large apps I've looked at are Rails apps, but these aren't very helpful, because most of the work is done by Rails itself. What source code would you recommend I take a look at? I'm not interested in libraries or Rails apps, because I get how they do things. CLI apps are OK, but I'm mostly interested in GUI apps (I'm using Gtk+, but I can learn just as much from apps using other GUI toolkits).

    Read the article

  • Should I allow my clients to open tickets/access trac?

    - by Mark
    I just installed trac for this project I'm working on, since it's turned out to be a bit bigger than I anticipated. I've added a bunch of tickets with my clients requests which come in the form of emails, phone calls, and meetings. I've also added some stuff I know needs to be done/fixed but they haven't specifically requested. Should I grant them access to trac so they can submit the tickets themselves so I don't have to keep translating (words into tickets) for them? They're very non-technical, so I'm not sure how well it would work; they might open tickets and not provide enough detail, or get confused by all the different fields. If your answer is "no", should I at least let them view the tickets, so they can see what I'm working on, what's been done, hasn't been done? So they can stop calling me to say "xxx doesn't work" when it's already a ticket? (Not that this would work, but I could at least respond "see ticket #42")

    Read the article

  • What is the proper way to handle a fully qualified domain in a GET request?

    - by Mark P Neyer
    I'm writing a proxy server. When I use curl to fetch a page, say http://www.foo.com/pants, curl makes the following request: GET /pants HTTP/1.1 When I have curl send that request through my local proxy, curl changes the GET request to: GET http://www.foo.com/pants HTTP/1.1 This change causes the foo.com server return a 404. Is foo.com broken? Or is the fully qualified domain name only meaningful to proxy servers? Should I always strip http://domain from the requests I send out? Thanks!

    Read the article

  • Reversed Sorted Dictionary?

    - by Mark
    I have a SortedDictionary as defined like this: SortedDictionary<TPriority, Queue<TValue>> dict; But I want to sort the keys in reverse order. I assume I need set the Comparer, but what comparer do I use for a generic TPriority? Note that TPriority implements IComparable.

    Read the article

  • Is a https query string secure?

    - by Mark
    I am creating a secure web based API that uses HTTPS however if I allow the users to configure it (include sending password) using a query string will this also be secure or should I force it to be done via a POST?

    Read the article

  • PHPUnit test for error thrown with wrong argument type

    - by Spencer Mark
    I'm just starting with PHPUnit and am ok with all assert* methods, but can't figure out how to test for error thrown when the wrong argument is provided to the method - say hinted with array like so: public function(array $list) { } and then tested with null as argument. Could someone please provide an example of how to test for this sort of errors? I've checked quite a few posts on stackoverflow, but couldn't find the answer to this specific issue. Edit Ok - just to give you an idea of what I'm testing - here's the ArrayHelper::removeIfValueIsEmpty() method: public static function removeIfValueIsEmpty(array $array) { if (empty($array)) { return array(); } return array_filter($array, function($value) { return !Helper::isEmpty($value); }); } and now test: class ArrayHelperTest extends PHPUnit_Framework_TestCase { public function testRemoveIfValueIsEmpty() { $this->assertEmpty( \Cmd\Helper\ArrayHelper::removeIfValueIsEmpty(null), '\Cmd\Helper\ArrayHelper::removeIfValueIsEmpty method failed (checking with null as argument)' ); } } This throws an error: PHPUnit_Framework_Error : Argument 1 passed to Cmd\Helper\ArrayHelper::removeIfValueIsEmpty() must be of the type array, null given

    Read the article

  • Python sort 2-D list by time string

    - by Mark Kennedy
    How do I sort a multi dimensional list like this based on a time string? The sublists can be of different sizes (i.e. 4 and 5, here) I want to sort by comparing the first time string in each sublist (sublist[-4]) x = (['1513', '08:19PM', '10:21PM', 1, 4], ['1290', '09:45PM', '11:43PM', 1, 4], ['0690', '07:25AM', '09:19AM', 1, 4], ['0201', '08:50AM', '10:50AM', 1, 4], ['1166', '04:35PM', '06:36PM', 1, 4], ['0845', '05:40PM', '07:44PM', 1, 4], ['1267', '07:05PM', '09:07PM', 1, 4], ['1513', '08:19PM', '10:21PM', 1, 4], ['1290', '09:45PM', '11:43PM', 1, 4], ['8772', '0159', '12:33PM', '02:43PM', 1, 5], ['0888', '0570', '09:42PM', '12:20AM', 1, 5], ['2086', '2231', '04:10PM', '06:20PM', 1, 5]) The sorted result would be sortedX = (['0690', '07:25AM', '09:19AM', 1, 4], ['0201', '08:50AM', '10:50AM', 1, 4], ['1166', '04:35PM', '06:36PM', 1, 4], ['0845', '05:40PM', '07:44PM', 1, 4], ['1267', '07:05PM', '09:07PM', 1, 4], ['1513', '08:19PM', '10:21PM', 1, 4], ['1513', '08:19PM', '10:21PM', 1, 4], ['1290', '09:45PM', '11:43PM', 1, 4], ['1290', '09:45PM', '11:43PM', 1, 4], ['8772', '0159', '12:33PM', '02:43PM', 1, 5], ['2086', '2231', '04:10PM', '06:20PM', 1, 5], ['0888', '0570', '09:42PM', '12:20AM', 1, 5]) I tried the following: sortedX = sorted(x, key=lambda k : k[-4]) #k[-4] is the first time string and it works but it doesn't respect the sublist size ordering

    Read the article

  • Django: Staff Decorator

    - by Mark
    I'm trying to write a "staff only" decorator for Django, but I can't seem to get it to work: def staff_only(error='Only staff may view this page.'): def _dec(view_func): def _view(request, *args, **kwargs): u = request.user if u.is_authenticated() and u.is_staff: return view_func(request, *args, **kwargs) messages.error(request, error) return HttpResponseRedirect(request.META.get('HTTP_REFERER', reverse('home'))) _view.__name__ = view_func.__name__ _view.__dict__ = view_func.__dict__ _view.__doc__ = view_func.__doc__ return _view return _dec Trying to follow lead from here. I'm getting: 'WSGIRequest' object has no attribute '__name__' But if I take those 3 lines out, I just get a useless "Internal Server Error". What am I doing wrong here?

    Read the article

  • Radio buttons + array elements

    - by Mark
    I have a form that can be dynamically duplicated (with JS) so that the user can enter as much data as he wants. This works great for text inputs, because I just leave the name attribute the same (ending with a []) and then when the values are posted, it just returns me an array. Now I just realized that this doesn't work so well for radio buttons, because the names actually need to be unique for each set. But from the data standpoint, each set only returns one value, so retrieving the data from the POST data wouldn't be a problem, it just screws up the functionality of my form. There's no way around this, is there? I'm just screwed and I can't use arrays?

    Read the article

  • Ability to Choose From Multiple SQLite DBs for Iphone Application

    - by Mark
    I am working on the design and implementation of an iPhone application ( a newbie, but I am getting the hang of it) where a person can download specific contact information about teachers based on their majors. The information is currently on different edu websites. And I have exported the information into SQLite databases. Is it possible to develop the application that when it is first initiated, it can give the user the option of which particular SQLite database they want for their application? Or if not, would it be better to merge all the DBs into one DB, and allow the user the option of downloading specific information from the SQLite db. I see that the db's can be downloaded into an app, but have yet to find a solution where there can be an option to download from different SQLite dbs. Thanks!

    Read the article

  • How to get out information from a DataGridView?

    - by ghost_j1
    I am working on program that calculate the GPAs for university students in C#. I have made a gridview that contains columns for each subject. Its mark as letter and number. After the user "student" insert his/her subject I want to let the user click a button that will get the mark and the number of the credit hours of each subject. Calculate the GPA for the student and put the result in a textbox. I am having trouble getting started. Any advice for a good place to start?

    Read the article

  • How do you preserve the viewstate while using strongly typed views in asp MVC 2?

    - by Mark Kadlec
    I have an ActionResult returning from a strongly typed view where I manually validate some conditions, pass in an error message, but would like to preserve the users responses. Since my View is strongly typed, I am calling it like this: return View("PrincipalInvestigatorForm", new SmartFormViewModel(sections, questions)); My problem though, is that the error message is displayed but all the users data is wiped. How do I preserve the "ViewState" in MVC? Is there an easy way?

    Read the article

  • Making a PHP object behave like an array?

    - by Mark Biek
    I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting & setting. For example (where Foo is a PHP class of my making): $foo = new Foo(); $foo['fooKey'] = 'foo value'; echo $foo['fooKey']; I know that PHP has the _get and _set magic methods but those don't let you use array notation to access items. Python handles it by overloading __getitem__ and __setitem__. Is there a way to do this in PHP? If it makes a difference, I'm running PHP 5.2.

    Read the article

< Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >