Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 42/196 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Scala newbie vproducer/consumer attempt running out of memory

    - by Nick
    I am trying to create a producer/consumer type Scala app. The LoopControl just sends a message to the MessageReceiver continually. The MessageReceiver then delegates work to the MessageCreatorActor (whose work is to check a map for an object, and if not found create one and start it up). Each MessageActor created by this MessageCreatorActor is associated with an Id. Eventually this is where I want to do business logic. But I run out of memory after 15 minutes. Its finding the cached actors,but quickly runs out of memory. Any help is appreciated. Or any one has any good code on producers consumers doing real stuff (not just adding numbers), please post. import scala.actors.Actor import java.util.HashMap import scala.actors.Actor._ case object LoopControl case object MessageReceiver case object MessageActor case object MessageActorCreator class MessageReceiver(msg: String) extends Actor { var messageActorMap = new HashMap[String, MessageActor] val messageCreatorActor = new MessageActorCreator(null, null) def act() { messageCreatorActor.start loop { react { case MessageActor(messageId) => if (msg.length() > 0) { var messageActor = messageActorMap.get(messageId); if(messageActor == null) { messageCreatorActor ! MessageActorCreator(messageId, messageActorMap) }else { messageActor ! MessageActor } } } } } } case class MessageActorCreator(msg:String, messageActorMap: HashMap[String, MessageActor]) extends Actor { def act() { loop { react { case MessageActorCreator(messageId, messageActorMap) => if(messageId != null ) { var messageActor = new MessageActor(messageId); messageActorMap.put(messageId, messageActor) println(messageActorMap) messageActor.start messageActor ! MessageActor } } } } } class LoopControl(messageReceiver:MessageReceiver) extends Actor { var count : Int = 0; def act() { while (true) { messageReceiver ! MessageActor ("00-122-0X95-FEC0" + count) //Thread.sleep(100) count = count +1; if(count > 5) { count = 0; } } } } case class MessageActor(msg: String) extends Actor { def act() { loop { react { case MessageActor => println() println("MessageActor: Got something-> " + msg) } } } } object messages extends Application { val messageReceiver = new MessageReceiver("bootstrap") val loopControl = new LoopControl(messageReceiver) messageReceiver.start loopControl.start }

    Read the article

  • A Newbie question regarding Software Development

    - by Sharif
    Hi, I'm going to complete my B.pharm (Hons.) degree and, you know, I don't have much knowledge about programing. I was wondering to build a software on my own. Could you guys tell me what to learn first for that? Is it too hard for a student of other discipline to build a software? Let me know please. The software I want to make is like a dictionary (or more specifically like "Physician's Desk Reference"). It should find the generic name, company name, indication, price etc. of a drug when I enter the brand name and vice versa. To build a software like that what programing language could help me most and what (and how many) language should I learn first? In my country, there is no practice of Community pharmacy (most of the pharmacy stores are run by unskilled people), that's why this type of thing could help them sell drugs. Would you please tell me what I'm to do and how tough it is? I'm very keen to learn programming. Thanks in advance NB: I started this post in ASKREDDIT section but it seems that was not the right place for poll type question, so I post it again in this section

    Read the article

  • Newbie C# Question about float/int/text type formatting

    - by user563501
    Hey everybody, I'm a total C# newb with a light (first year CS) background in Python. I wrote a console program in Python for doing marathon pace running calculations and I'm trying to figure out the syntax for this in C# using Visual Studio 2010. Here's a chunk of what I've got so far: string total_seconds = ((float.Parse(textBox_Hours.Text) * 60 * 60) + (float.Parse(textBox_Minutes.Text) * 60) + float.Parse(textBox_Seconds.Text)).ToString(); float secs_per_unit = ((float)(total_seconds) / (float)(textBox_Distance.Text)); float mins_per_unit = (secs_per_unit / 60); string pace_mins = (int)mins_per_unit.ToString(); string pace_secs = (float.Parse(mins_per_unit) - int.Parse(mins_per_unit) * 60).ToString(); textBox_Final_Mins.Text = pace_mins; textBox_Final_Secs.Text = pace_mins; Imagine you have a running pace of 8 minutes and 30 seconds per mile. secs_per_unit would be 510, mins_per_unit would be 8.5. pace_mins would simply be 8 and pace_secs would be 30. In Python I'd just convert variables from a float to a string to get 8 instead of 8.5, for example; hopefully the rest of the code gives you an idea of what I've been doing. Any input would be appreciated.

    Read the article

  • need help with Java solution /newbie

    - by Racket
    Hi, I'm new to programming in general so i'm trying to be as specific as possible in this question. There's this book that i'm doing some exercises on. I managed to do more than half of what they say, but it's just one input that I have been struggling to find out. I'll write the question and thereafter my code, "Write an application that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first three digits contain an 8 or 9 (but don't be more restrictive than that), and make sure that the second set of three digits is not greater than 742. Hint: Think through the easiest way to construct the phone number. Each diigit does not have to be determined separately." OK, the highlighted sentence is what i'm looking at. Here's my code: import java.util.Random; public class PP33 { public static void main (String[] args) { Random rand = new Random(); int num1, num2, num3; num1 = rand.nextInt(900) + 100; num2 = rand.nextInt(643) + 100; num3 = rand.nextInt(9000) + 1000; System.out.println(num1+"-"+num2+"-"+num3); } } How am I suppose to do this? I'm on chapter 3 so we have not yet discussed if statements etcetera, but Aliases, String class, Packages, Import declaration, Random Class, Math Class, Formatting output (decimal- & numberFormat), Printf, Enumeration & Wrapper classes + autoboxing. So consider answer the question based only on these assumptions, please. The code doesn't have any errors. Thank you!

    Read the article

  • Drawing Sprites for iOS games on iPad

    - by TheGamingArt
    So, I'm quite new and confused on the way to tackle creating sprites/sprite sheets for iOS games. I own the full CS5 sweet and have been told that fireworks is the best way to go for creating these (although I don't have the slightest idea in how yet and would love some tutorials/books specifying sprite sheet creation). My thoughts directed me towards tablet drawing, as I am awful at drawing with a mouse and/or tablet without a screen on it (such as a basic wacom). I was thinking about getting an iPad, as this would provide me with an iPad for testing purposes and a tablet. Does anyone know if it's possible (or even a good idea) to draw out your sprites on the iPad. Is it possible to export them out into Fireworks and such?

    Read the article

  • Newbie Question: Read and Process a List of Text Files

    - by johnv
    I'm completely new to .NET and am trying as a first step to write a text processing program. The task is simple: I have a list of 10,000 text files stored in one folder, and I'm trying to read each one, store it as a string variable, then run it through a series of functions, then save the final output to another folder. So far I can only manage to manually input the file path like this (in VB.NET): Dim tRead As System.IO.StreamReader Public Function ReadFile() As String Dim EntireFile As String tRead = File.OpenText("c:\textexample\00001.txt") EntireFile = tRead.ReadToEnd Return EntireFile End Function Public Function Step1() ..... End Function Public Function Step2() ..... End Function .............. I'm wondering, therefore, if there's a way to automate this process. Perhaps for example store all input file path into a text file then read each entry at a time, then save the final output into the save path, again listed in a text file. Any help is greatly appreciated. ReplyQuote

    Read the article

  • ARC, worth it or not?

    - by MSK
    When I moved to Objective C (iOS) from C++ (and little Java) I had hard time understanding memory management in iOS. But now all this seems natural and I know retain, autorelease, copy and release stuff. After reading about ARC, I am wondering is there more benefits of using ARC or it is just that you dont have to worry about memory management. Before moving to ARC I wanted to know how worth is moving to ARC. XCode has "Convert to Objective C ARC" menu. Is the conversion is that simple (nothing to worry about)? Does it help me in reducing my apps memory foot-print, memory leaks etc (somehow ?) Does it has much testing impact on my apps ? What are non-obvious advantages? Any Disadvantage os moving to it?

    Read the article

  • Newbie question on MvcContrib TestHelpers

    - by Simon Lomax
    Hi, I'm just starting to use the TestHelpers in MvcContrib. I want to try and test an action method on my controller that itself tests if IsAjaxRequest() is true. I've used the same code that is shown in the TestHelper samples to set up the TestControllerBuilder _controller = new StarsController(); _builder = new TestControllerBuilder(); _builder.InitializeController(_controller); So that _controller has all the faked/mocked HttpContext inside it, which is really great. But what do I do now to force IsAjaxRequest() on the internally faked Request object to return true?

    Read the article

  • Best C# Tutorials for a newbie?

    - by N00b
    Were there any awesome C# tutorials you found that helped you learn it? Or any books that you thought were particularly successful? Any that should be avoided? UPDATE: Tons of good answers, thank you all! To clarify the earlier question, hobbyist with only light programming experience previous. Working through online tutorials currently, probably going to pick up Head First C#.

    Read the article

  • Oracle Forms 6i master-detail question from a painfully new newbie

    - by Murasaki
    Hello, I have a form that contains 3 blocks (block a, b, c). There is a master-detail relationship between b (detail) and c (master). Data-flow: you enter an ID in block a, which in turn populates block c and corresponding details in block b. Control goes immediately to block c. Objective: I need to be able to update details of block b. Issue: I cannot navigate to block b. Keep in Mind: --In the Property Palette Keyboard Navigable is set to "Yes" --Insert Allowed and Update Allowed are set to "Yes." If someone could respond ASAP I would really appreciate it. Thank you.

    Read the article

  • jQuery arrays - newbie needs a kick start

    - by Jonny Wood
    I've only really started using this site and alredy I am very impressed by the community here! This is my third question in less than three days. Hopefully I'll be able to start answering questions soon instead of just asking them! I'm fairly new to jQuery and can't find a decent tutorial on Arrays. I'd like to be able to create an array that targets several ID's on my page and performs the same effect for each. For example I have tabs set up with the following: $('.tabs div.tab').hide(); $('.tabs div:first').show(); $('.tabs ul li:first a').addClass('current'); $('.tabs ul li a').click(function(){ $('.tabs ul li a').removeClass('current'); $(this).addClass('current'); var currentTab = $(this).attr('href'); $('.tabs div.tab').hide(); $(currentTab).show(); return false; }); I've used the class .tag to target the tabs as there are several sets on the same page, but I've heard jQuery works much faster when targetting ID's How would I add an array to the above code to target 4 different ID's? I've looked at var myArray = new Array('#id1', 'id2', 'id3', 'id4'); And also var myValues = [ '#id1', 'id2', 'id3', 'id4' ]; Which is correct and how do I then use the array in the code for my tabs...?

    Read the article

  • Java EE - newbie question (not related to learning JEE)

    - by UnCon
    I've read lot of articles saying, that Java EE is most popular enterprise solution nowadays. Let's not argue if it is most popular or second most popular or what. The thing is : I see almost all web pages with extension like .html, .php and .aspx. Why there is (almost) none .JSP ? Why so ease to find ASP.NET pages if it is supposed to be less popular? Please I am not programming with Java EE (yet) so don't blame me, if I am completely wrong. The answer with patience would be greatly appreciated!

    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

  • Does background iOS require specific provisioning?

    - by Moshe
    I've added the appropriate XML to my PLIST ("audio key") and my app did stream audio in the background. I installed the app on to an iPhone 3GS running iOS 4 via Ad Hoc distribution. I played audio in my app and pressed the home key. It was still playing. Then I switched computers and reset my provisioning profile. I recompiled and exported with a generic provisioning profile. I sent the app to someone else to test on their 3GS via Ad Hoc and the app does not work in the background.

    Read the article

  • Multiple layouts in rails [Newbie Q]

    - by BriteLite
    Hi. As a newb, I decided to build a "home inventory" application. I am now stuck on how to programmatically select a layout based on what type of item it is when viewing it in a browser. According to my planning, so far I should have created a few models to represent types of items I can find in my home: Furniture, Electronics and Books. class Book < ActiveRecord::Base end class Furniture < ActiveRecord::Base end class Electronic < ActiveRecord::Base end Now the Books model has things like isbn, pages, address, and category. Furniture model has things like color, price, address, and category. Electronics has things like name, voltage, address, and category. Here is where I got confused. I know the property address is going to be the same for all of them. I also know that, I will need to create multiple "layouts" for 3 different types of items to show the different properties of said items with appropriate graphics and stylesheets. But how will I go about deciding which category the item is so I can determine which layout to render. According to me, this is how I will do it: class DisplayController < ApplicationController def display @item = Params[:item] if @item.category = "electronics" render :layout => 'electronics' end end In my routes.rb map.display ':item', :controller => 'display', :action => 'display' I only seem to have one concern with this, I probably will add a lot of categories later on and think there should be a more DRY-esque way of dealing, rather than hardcoding them. I understand that I need to add into my layout html tags to display relevant information for that particular category. ----Questions---- Is this the right way to approach this type of problem. Will this approach be compatible when I decide to add a gem like *thinking_sphinx* to run search. What issues do you see with my approach and how can I make it better. I was reading something about "Polymorphic Assoc", does that apply in this case, since category exist for all items? Also, I was trying to get a routes to render a URL like "http://localhost/living-room-tv"

    Read the article

  • Newbie : installing and upgrading python module.

    - by iamgopal
    I have downloaded and install a python library, via setup.py , python2.5 setup.py install ... now the version is changed at the source . a newer library is available. originally , i have clone it via mercurial, and install it. right now , i have updated repository. how do i use the newer version ? overwrite the installation ? by simply doing setup.py install again ?

    Read the article

  • Java Newbie can't do simple Math, operator error

    - by elguapo-85
    Trying to do some really basic math here, but my lack of understanding of Java is causing some problems for me. double[][] handProbability = new double[][] {{0,0,0},{0,0,0},{0,0,0}}; double[] handProbabilityTotal = new double[] {0,0,0}; double positivePot = 0; double negativePot = 0; int localAhead = 0; int localTied = 1; int localBehind = 2; //do some stuff that adds values to handProbability and handProbabilityTotal positivePot = (handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0)); negativePot = (handProbability[localAhead][localBehind] + (handProbability[localAhead][localTied] / 2.0) + (handProbability[localTied][localBehind] / 2.0) ) / (handProbabilityTotal[localAhead] + (handProbabilityTotal[localTied] / 2.0)); The last two lines are giving me problems (sorry for their lengthiness). Compiler Errors: src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double[],double positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); ^ src/MyPokerClient/MyPokerClient.java:180: operator + cannot be applied to double, positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); ^ src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double, positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) ); Not really sure what the problem is. You shouldn't need anything special for basic math, right?

    Read the article

  • iPhone memory management, a newbie question

    - by Reuven
    Hi, I've seen in (Apple) sample code two types of ways of allocation memory, and am not sure I understand the difference and resulting behavior. // FAILS NSMutableArray *anArray = [NSMutableArray array]; [anArray release]; // WORKS NSMutableArray *anArray1 = [[NSMutableArray alloc] init]; [anArray release]; By "FAILS" I mean I get crashes/runtime warnings etc., and not always as soon as I call the release... Any explanation appreciated. Thanks

    Read the article

  • Is support for recovering purchases mandatory for consumable products?

    - by Drux
    Apple's documentation for iOS 7 makes me think it is not, for it makes a distinction between "restored by the system" (i.e. built into iOS 7), "restored by your app" (i.e. functionality required inside app"), and "not required". The fact there being three (and not two) options and product type "consumable" being marked as "not restored" makes me think that an app that does not support restoring consumable product may still pass Apple's review process. However this popular question and answer seem to suggest that such support is required ("I read somewhere ...") But would this not amount to "consumable" taking on "restored by your app" semantics, which seems to contradict the quoted piece of Apple documentation.

    Read the article

  • Newbie question about file formatting in Python

    - by user568041
    I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin. Here's the code of the program: #!/usr/bin/env python2 import pycurl, os def send(file): print "Sending file to pastebin...." curl = pycurl.Curl() curl.setopt(pycurl.URL, "http://pastebin.com/api_public.php") curl.setopt(pycurl.POST, True) curl.setopt(pycurl.POSTFIELDS, "paste_code=%s" % file) curl.setopt(pycurl.NOPROGRESS, True) curl.perform() def main(): content = raw_input("Provide the FULL path to the file: ") open = file(content, 'r') send(open.readlines()) return 0 main() The output pastebin looks like standard Python list: ['string\n', 'line of text\n', ...] etc. Is there any way I could format it so it looks better and it's actually human-readable? Also, I would be very happy if someone could tell me how to use multiple data inputs in POSTFIELDS. Pastebin API uses paste_code as its main data input, but it can use optional things like paste_name that sets the name of the upload or paste_private that sets it private.

    Read the article

  • IOS SDK : first advices for beginners

    - by VdesmedT
    I too often answer the same kind of questions regarding basic topics like memory management, UITableView, Interface Orientation, MVC, etc... I understand very well that everyone starting with that SDK is too exited about getting its hand on it but a few reading would save them hours of debugging and the frustration that come along with the feeling that "We miss something here". I'd like experience users to share the few small articles, white papers, docs, book chapters that helps other save their time and avoid frustration. My first vote would be for : IOS Memory Management Guide View Controller Programming Guide Table View Guide And as a General recommendation, read the Overview section that come along with every class documention in the reference library, they contains most of what you need to know to avoid big traps !

    Read the article

  • Connecting to an MQ: Newbie question

    - by deltamatrix
    Hi, I am a novice with Websphere MQ and require some novice help. I am using Websphere MQ Explorer to connect to a queue but do not know how to write the connection string. I have all the details (host, port, channel, queue manager name) but do not know how to put them together correctly as a connection string. Can any help this novice? Thanks

    Read the article

  • C newbie malloc question

    - by roufamatic
    Why doesn't this print 5? void writeValue(int* value) { value = malloc(sizeof(int)); *value = 5; } int main(int argc, char * argv) { int* value = NULL; writeValue(value); printf("value = %d\n", *value); // error trying to access 0x00000000 } and how can I modify this so it would work while still using a pointer as an argument to writeValue?

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >