Search Results

Search found 2579 results on 104 pages for 'mike peshka'.

Page 70/104 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Remove adjacent identical elements in a Ruby Array?

    - by Mike Woodhouse
    Ruby 1.8.6 I have an array containing numerical values. I want to reduce it such that sequences of the same value are reduced to a single instance of that value. So I want a = [1, 1, 1, 2, 2, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3] to reduce to [1, 2, 3, 2, 3] As you can see, Array#uniq won't work in this case. I have the following, which works: (a.size - 1).downto(1) { |i| a[i] = nil if a[i - 1] == a[i] } Can anyone come up with something less ugly?

    Read the article

  • Android Apps Not Showing Up In AVD

    - by Mike
    I recently started messing with Android Apps, but I have had nothing but problems trying to get them into the Virtual Device for testing. For some reason, they never seem to show up in the AVD. It has worked one time, but that's it out of hours spent just trying to test one or two very simple apps. I've redone the AVD setup many, many times, trying different settings and what not to no avail. I've followed multiple guides and tutorials to the letter to get it working, but they just refuse to show up in the list. :( Any insight would be appreciated, thank you.

    Read the article

  • Adding label and text box control to GUI

    - by Mike
    I would like to know what code to insert and where to add a simple label that can just say the word "Label" and a input text box that I can enter a number. public CalculateDimensions() { JTabbedPane Tab = new JTabbedPane(); JPanel jplInnerPanel1 = createInnerPanel("First Tab"); Tab.addTab("One", jplInnerPanel1); Tab.setSelectedIndex(0); JPanel jplInnerPanel2 = createInnerPanel("Second Tab"); Tab.addTab("Two", jplInnerPanel2); JPanel jplInnerPanel3 = createInnerPanel("Third Tab"); Tab.addTab("Three", jplInnerPanel3); JPanel jplInnerPanel4 = createInnerPanel("Fourth Tab"); Tab.addTab("Four", jplInnerPanel4); JPanel jplInnerPanel5 = createInnerPanel("Fifth Tab"); Tab.addTab("Five", jplInnerPanel5); setLayout(new GridLayout(1, 1)); add(Tab); } protected JPanel createInnerPanel(String text) { JPanel jplPanel = new JPanel(); JLabel jlbDisplay = new JLabel(text); jlbDisplay.setHorizontalAlignment(JLabel.CENTER); jplPanel.setLayout(new GridLayout(1, 1)); jplPanel.add(jlbDisplay); return jplPanel; } public static void main(String[] args) { JFrame frame = new JFrame("Calculations"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.getContentPane().add(new CalculateDimensions(), BorderLayout.CENTER); frame.setSize(400, 400); frame.setVisible(true); } }

    Read the article

  • How to call a method withgin a vector?

    - by Mike Dooley
    Hi! How do I call a method of an object which is stored within a vector? The following code fails... ClassA* class_derived_a = new ClassDerivedA; ClassA* class_another_a = new ClassAnotherDerivedA; vector<ClassA*> test_vector; test_vector.push_back(class_derived_a); test_vector.push_back(class_another_a); for (vector<ClassA*>::iterator it = test_vector.begin(); it != test_vector.end(); it++) it->printOutput(); The code retrieves the following error: test3.cpp:47: error: request for member ‘printOutput’ in ‘* it.__gnu_cxx::__normal_iterator<_Iterator, _Container::operator- with _Iterator = ClassA**, _Container = std::vector ’, which is of non-class type ‘ClassA*’ The problem seems to be it->printOutput(); but at the moment I don't know how to call the method properly, does anyone know? regards mikey

    Read the article

  • How can I tell Phusion Passenger which python to use?

    - by Mike
    I'm using Phusion Passenger with a ruby app and I'd also like to set it up to work with an django appengine app I'm working on. Googling for "passenger_wsgi.py" I was able to get the following very simple non-django app working on passenger: passenger_wsgi.py: def application(environ, start_response): response_headers = [('Content-type','text/plain')] start_response('200 OK', response_headers) return ['Hello World!\n'] However, if I add the line import django.core.handlers.wsgi into the mix, I get 'An error occurred importing your passenger_wsgi.py'. By printing out the sys.path I've discovered that at least part of the reason is because Passenger is using the wrong python installation on my machine. How can I configure Passenger (on apache) to use /opt/local/bin/python2.5 instead of the system default python?

    Read the article

  • Creating a Linq->HQL provider

    - by Mike Q
    Hi all, I have a client application that connects to a server. The server uses hibernate for persistence and querying so it has a set of annotated hibernate objects for persistence. The client sends HQL queries to the server and gets responses back. The client has an auto-generated set of objects that match the server hibernate objects for query results and basic persistence. I would like to support using Linq to query as well as Hql as it makes the queries typesafe and quicker to build (no more typos in HQL string queries). I've looked around at the following but I can't see how to get them to fit with what I have. NHibernate's Linq provider - requires using NHibernate ISession and ISessionFactory, which I don't have LinqExtender - requires a lot of annotations on the objects and extending a base type, too invasive What I really want is something that will generate give me a nice easy to process structure to build the HQL queries from. I've read most of a 15 page article written by one of the C# developers on how to create custom providers and it's pretty fraught, mainly because of the complexity of the expression tree. Can anyone suggest an approach for implementing Linq - HQL translation? Perhaps a library that will the cleanup of the expression tree into something more SQL/HQLish. I would like to support select/from/where/group by/order by/joins. Not too worried about subqueries.

    Read the article

  • How to get site context/information during the PreapplicationStartMethod

    - by Mike
    When you run the same web based application as a multi-tenant application for different clients is there a way during the PreapplicationStartMethod to gain some kind of context to the site that is being started? More specifically I'd like to get the host header information (the "bindingInformation" attribute value from the applicationHost.config); I have found ways to get this information at the time of a specific request long after the application has started. Is there a way to get the information during the application startup process? This is an MVC 3 application and IIS 7.5.

    Read the article

  • Combining 2 Linq queries into 1

    - by Mike Fielden
    Given the following information, how can I combine these 2 linq queries into 1. Having a bit of trouble with the join statement. 'projectDetails' is just a list of ProjectDetails ProjectDetails (1 to many) PCardAuthorizations ProjectDetails (1 to many) ExpenditureDetails Notice I am grouping by the same information and selecting the same type of information var pCardAccount = from c in PCardAuthorizations where projectDetails.Contains(c.ProjectDetail) && c.RequestStatusId == 2 group c by new { c.ProjectDetail, c.ProgramFund } into g select new { Key = g.Key, Sum = g.Sum(x => x.Amount) }; var expenditures = from d in ExpenditureDetails where projectDetails.Contains(d.ProjectDetails) && d.Expenditures.ExpenditureTypeEnum == 0 group d by new { d.ProjectDetails, d.ProgramFunds } into g select new { Key = g.Key, Sum = g.Sum(y => y.ExpenditureAmounts.FirstOrDefault(a => a.IsCurrent && !a.RequiresAudit).CommittedMonthlyRecords.ProjectedEac) };

    Read the article

  • How do set default values in django for an HttpRequest.GET?

    - by Mike
    I have a webpage that displays data based on a default date. The user can then change their view of the data by slecting a date with a date picker and clicking a submit button. I already have a variable set so that if no date is chosen, a default date is used.... so what's the problem? The problem comes if the user trys to type in the url page without a parameter... like so: http://mywebpage/viewdata (example A) instead of http://mywebpage/viewdata?date= (example B) I tried using: if request.method == 'GET': but apparently, even example A still returns true. I'm sure I'm doing some obvious beginner's mistake but I'll ask anyway... Is there a simpler way to handle example A other than passing the url to a string and checking the string for "?date="?

    Read the article

  • How is this Perl code selecting two different elements from an array?

    - 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

  • WiX: .Net 3.5 prerequisite

    - by Mike Pateras
    I have a WiX installer that I would like to check for .Net 3.5, and install it if it does not exist. I have the following lines in my wixproj file: <BootstrapperFile Include="Microsoft.Net.Framework.3.5"> <ProductName>.NET Framework 3.5</ProductName> </BootstrapperFile> <BootstrapperFile Include="Microsoft.Windows.Installer.3.1"> <ProductName>WIndows Installer 3.1</ProductName> </BootstrapperFile> When I create the installer, a DotNetFX35 folder is created, and in it are 4 different versions of .Net (including 3.5), and an installer file. I have two questions: How do I have it only bring in version 3.5 (so that the user doesn't have to install 100+ MB of files)? How do I tell WiX to package these files up into the MSI file, so that the user only has to download 1 file?

    Read the article

  • Codebase for making a Flash-based interactive map with SVG vector data?

    - by Mike
    I'm looking for a way to take SVG path info (basically a string of coordinates) and dynamically draw it with Actionscript. Icing on the cake would be if those shapes could detect mouse events to trigger JS and dynamically change their appearance (fill, stroke, etc...). I'm currently trying something similar to this (http://raphaeljs.com/australia.html) using SVG but it's just too slow in IE. I've also tried Google's SVG Web (http://code.google.com/p/svgweb/) which basically does exactly what I'm looking for (it converts SVG to Flash in IE) but again, it's sloooooow - which is why I'm considering doing the whole shebang in Flash. Anyone know of some links to point me in the right direction?

    Read the article

  • Perl, dereference array of references

    - by Mike
    In the following Perl code, I would expect to be referencing an array reference inside an array #!/usr/bin/perl use strict; use warnings; my @a=([1,2],[3,4]); my @b = @$a[0]; print $b[0]; However it doesn't seem to work. I would expect it to output 1. @a is an array of references @b is $a[1] dereferenced (I think) So what's the problem?

    Read the article

  • Google Chrome Printing Page Breaks

    - by Mike Valstar
    I'm trying to get google chrome to do page breaks. I've been told via a bunch of websites that page-break-after: always; is valid in chrome but I can not seem to get it to work even with a very simple example. is there any way to force a page break when printing in chrome?

    Read the article

  • Why Instruments report a leak?

    - by mike
    Hi, I am developing an iphone app. Instruments reported a leaked object ServiceTypes. Below is the relevant code. Does anyone have any ideas? Thanks a lot for your help. ServiceTypes *serviceTypes = [[ServiceTypes alloc] init]; if ([userConnection getServiceTypes:serviceTypes]) { if ([serviceTypes.types length] 0) { NSArray *array = [[NSArray alloc] initWithArray:[serviceTypes.types componentsSeparatedByString: SERVICE_TYPE_DELIMITOR]]; serviceRequestTypes = [[NSMutableArray alloc] initWithArray:array]; [array release]; } } [[self typesTableView] reloadData]; [serviceTypes release];

    Read the article

  • Set height of Flex Accordion to height of tallest child

    - by Mike Deck
    By default the height of an Flex Accordion container is the height of the initially selected child. I'd like to be able to set the height to the tallest child so that no resizing or scrolling is necessary when other children are selected. I do not want to use the resizeToContent property. I want the size of the container to stay constant no matter what child is selected. My current thought is to extend the accordion class setting the creation policy to "all" and then override the measure function to loop through all the children and find the tallest one and use that for the height. This seems a little kludgy though, so I'd like to know if there is a better approach. Ultimately my question is: is there a way to set the size of an accordion container such that the container never resizes and scoll bars are never necessary to display any of the children?

    Read the article

  • How to rotate a drawable with anti-aliasing enabled

    - by Mike
    I need to rotate an ImageView by a few degrees. I'm doing this by subclassing ImageView and overloading onDraw() @Override protected void onDraw(Canvas canvas) { canvas.save(); canvas.scale(0.92f,0.92f); canvas.translate(14, 0); canvas.rotate(1,0,0); super.onDraw(canvas); canvas.restore(); } The problem is that the image that results shows a bunch of jaggies. How can I antialias an ImageView that I need to rotate in order to eliminate jaggies? Is there a better way to do this?

    Read the article

  • Javascript parent and child window functions

    - by Mike Thornley
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Lab 9-3</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function myFunction(){ myWin = open("","","width=200,height=200"); with(myWin.document){ open(); write("<HTML><HEAD><TITLE>Child Window</TITLE>"); write("<SCRIPT>function myTest(){"); write("alert('This function is defined in the child window "); write("and is called from the parent window.'); this.focus();}"); write("</SCRIPT></HEAD><BODY><H3>Child Window</H3><HR>"); write("<FORM><INPUT TYPE='button' VALUE='parent window function' "); // Use opener property write("onClick='opener.winFunction();'>"); write("<P><INPUT TYPE='button' VALUE='close window' "); write("onClick='window.close();'>"); write("</FORM></BODY></HTML>"); close(); } } function winFunction(){ alert("This function is defined in the parent window\n" + "and is called from the child window."); myWin.focus(); } //--> </SCRIPT> </HEAD> <BODY> <H3>CIW Web Languages</H3> <HR> <FORM NAME="myForm"> <INPUT TYPE="button" VALUE="open new window" onClick="myFunction();"> <!-- Invoke child window function --> <input type="button" value="Click to open child window" onclick="javascript:void(myWin.myTest());"/> </FORM> <P> </BODY> </HTML> To explain further what my initial query was, the code above, should open the child window (myWin) with the second button, the 'Open child window' button without the need to open the window with the first button or do anything else. It should simply call the myWin.myTest()function The child window will open when the second button is pressed but needs to have the child window open first (first button push) before it'll work. This is not the intended purpose, the 'Open child window' button should work without anything else needing to be done. For some reason the parent window isn't communicating with the myWin window and myTest fucntion. It's not homework, it's part of a certification course lab and is coded in the manner I have been shown to understand as correct. DTD isn't included as the focus is the JavaScript. I code correctly with regards to that and other W3C requirements.

    Read the article

  • Infinite loop in haskell? (newbie)

    - by Mike
    I'm just learning Haskell. I thought this would produce a factorial function... (within ghci) Prelude let ft 0 = 1 Prelude let ft n = n * ft (n - 1) Prelude ft 5 (hangs indefinitely, until ^C). Can someone point me in the right direction? Thanks!

    Read the article

  • How do I export a package symbol to a namespace in Perl?

    - by Mike
    I'm having trouble understanding how to export a package symbol to a namespace. I've followed the documentation almost identically, but it seems to not know about any of the exporting symbols. mod.pm #!/usr/bin/perl package mod; use strict; use warnings; require Exporter; @ISA = qw(Exporter); @EXPORT=qw($a); our $a=(1); 1; test.pl $ cat test.pl #!/usr/bin/perl use mod; print($a); This is the result of running it $ ./test.pl Global symbol "@ISA" requires explicit package name at mod.pm line 10. Global symbol "@EXPORT" requires explicit package name at mod.pm line 11. Compilation failed in require at ./test.pl line 3. BEGIN failed--compilation aborted at ./test.pl line 3. $ perl -version This is perl, v5.8.4 built for sun4-solaris-64int

    Read the article

  • JUnit4 + Eclipse "An internal error occured during Launching"

    - by Mike
    Hello I'm trying to run JUnit4 test cases on Eclipse 3.4.2 but it's not even starting for me. I am sure that I properly have junit-4.7.jar in my build path and the test application. Here is a simple example that illustrates my problem package test; import org.junit.Before; import org.junit.Test; public class UTest { @Test public void test() { } @Before public void setUp() throws Exception { } } This compiles fine Then I do "Run JUnit Test case" from Eclipse and I get an error dialog with this message "Launching UTest' has encountered a problem An internal error occurred during: "Launching UTest". java.lang.NullPointerException I'm not sure how to figure out what exactly generating this NullPointerException. Some pointers would be appreciated

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >