Search Results

Search found 1685 results on 68 pages for 'no more guessing'.

Page 35/68 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • NSUserDefaults: detecting nil

    - by alJaree
    I have some code in my classes to read from NSUserDefaults NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; score = [defs integerForKey:@"score"]; this causes a crash. Im guessing it is because the score value is nil or doesnt exist. How can I check if it is nil? EDIT. The following code causes a crash when storing to NSUserDefaults. NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; [defs setInteger:0 forKey:@"score"]; [defs setInteger:3 forKey:@"lives"]; [defs release]; Im not sure what the issue is On some crashes there isnt even a crash report in the console. Thanks

    Read the article

  • Binning into timeslots - Is there a better way than using list comp?

    - by flyingcrab
    I have a dataset of events (tweets to be specific) that I am trying to bin / discretize. The following code seems to work fine so far (assuming 100 bins): HOUR = timedelta(hours=1) start = datetime.datetime(2009,01,01) z = [dt + x*HOUR for x in xrange(1, 100)] But then, I came across this fateful line at python docs 'This makes possible an idiom for clustering a data series into n-length groups using zip(*[iter(s)]*n)'. The zip idiom does indeed work - but I can't understand how (what is the * operator for instance?). How could I use to make my code prettier? I'm guessing this means I should make a generator / iterable for time that yields the time in graduations of an HOUR?

    Read the article

  • Determining a Flex event's default behavior

    - by Jeremy Mitchell
    How can I tell what the default behavior for a cancelable event is? For example, I read somewhere that the TextEvent.TEXT_INPUT has a default behavior and that default behavior includes adding a text character associated with the key that was pressed to a TextInput. That makes perfect sense. But if I hadn't read that, how would I know what the default behavior is? Other than guessing. In this case, it's probably obvious. But in other situations, it might not be. For example, in the docs, look at DataGridEvent.HEADER_RELEASE's cancelable property. It says: cancelable: true so, there appears to be a "default behavior" associated with a DataGridEvent.HEADER_RELEASE event. But what is it? And why would I cancel it if I'm not really sure what it is? :) thanks.

    Read the article

  • C# Linq: Restructuring object

    - by Ben
    I'd like to take an object like this: SortedList<string, SortedList<int, SortedList<DateTime, double>>> Data and, for a given 'int' value (key of first nested sorted list), restructure it like this: SortedList<DateTime, SortedList<string, double>> or, better yet, this: SortedList<DateTime, double[]> where each 'double[]' has as many elements as there are KeyValue pairs in the SortedList. I'm guessing Linq is the way to go, but can't figure it out. Thanks for any suggestions.

    Read the article

  • Why is it so hard to build a gtk programe without console using gtk in windows?

    - by Runner
    I'm following the tuto: http://zetcode.com/tutorials/gtktutorial/firstprograms/ It works but each time I double click on the executable,there is a console which I don't want it there. How do I get rid of that console? I tried this: add_executable(Cmd WIN32 cmd.c) But got this fatal error: MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup Cmd.exe : fatal error LNK1120: 1 unresolved externals While using gcc directly works: gcc -o Cmd cmd.c -mwindows .. I'm guessing it has something to do with the entry function: int main( int argc, char *argv[]),but why gcc works? How can I make it work with cmake?

    Read the article

  • Is there a Javascript library for editing PDFs?

    - by Fletcher Moore
    Based on my Google and stackoverflow search I'm guessing no, but it can't hurt to ask. The goal is: store some blank forms on my server. Then present these to the user, who edits the form in the browser with Javascript and submits the form back to the server. The client wants to reuse parts of an old system (the forms) in which users would download an editable PDF, edit it, and email it back to a secretary. Our users aren't very computer savvy and many don't realize they need to email the forms back, assuming instead the forms somehow get submitted when they save their local changes (or something). I haven't seen the forms yet, so I cannot assess the viability of an alternative.

    Read the article

  • Illegal offset type

    - by BFTrick
    Hello, I am having trouble uploading a file through php. I check the file type at the beginning of the process and I get an error. This is the error I am getting: Warning: Illegal offset type in /balblabla/DBfunctions.inc.php on line 183 This is the printed out $_FILES var Array ( [Picture] = Array ( [name] = JPG.jpg [type] = image/jpeg [tmp_name] = /tmp/phpHlrNY8 [error] = 0 [size] = 192221 ) ) Here is the segment of code I am using that is giving me issues: function checkFile($file, $type) { if( in_array($_FILES[$file]['type'], $type) ){ // <--- LINE 183 return true; }//if return false; } // end checkFile() This is the line of code that calls the function if( checkFile( $_FILES['Picture'], array("image/jpeg") ) == true ){ //do stuff }// end if I have used this piece of code on dozens of websites on my own server so i am guessing that this is some different configuration option. How can i modify my code so that it works on this different server?

    Read the article

  • PHP Value Object auto create

    - by JonoB
    Assume that I have a class value object defined in php, where each variable in the class is defined. Something like: class UserVO { public $id; public $name; } I now have a function in another class, which is expecting an array ($data). function save_user($data) { //run code to save the user } How do I tell php that the $data parameter should be typed as a UserVO? I could then have code completion to do something like: $something = $data->id; //typed as UserVO.id $else = $data->name; //typed as UserVO.name I'm guessing something like the following, but this obviously doesnt work $my_var = $data as new userVO();

    Read the article

  • Copy Rows in a One to Many with LINQ (2 SQL)

    - by Refracted Paladin
    I have a table that stores a bunch of diagnosis for a single plan. When the users create a new plan I need to copy over all existing diagnosis's as well. I had thought to try the below but this is obviously not correct. I am guessing that I will need to loop through my oldDiagnosis part, but how? Thanks! My Attempt so far... public static void CopyPlanDiagnosis(int newPlanID, int oldPlanID) { using (var context = McpDataContext.Create()) { var oldDiagnosis = from planDiagnosi in context.tblPlanDiagnosis where planDiagnosi.PlanID == oldPlanID select planDiagnosi; var newDiagnosis = new tblPlanDiagnosi { PlanID = newPlanID, DiagnosisCueID = oldDiagnosis.DiagnosisCueID, DiagnosisOther = oldDiagnosis.DiagnosisOther, AdditionalInfo = oldDiagnosis.AdditionalInfo, rowguid = Guid.NewGuid() }; context.tblPlanDiagnosis.InsertOnSubmit(newDiagnosis); context.SubmitChanges(); } }

    Read the article

  • How to be notified when a script's background job completes?

    - by Keith Bentrup
    My question is very similar to this one except that my background process was started from a script. I could be doing something wrong but when I try this simple example: #!/bin/bash set -mb # enable job control and notification sleep 5 & I never receive notification when the sleep background command finishes. However, if I execute the same directly in the terminal, $ set -mb $ sleep 5 & [1]+ Done sleep 5 I see the output that I expect. I'm using bash on cygwin. I'm guessing that it might have something to do with where the output is directed, but trying various output redirection, I'm not getting any closer?

    Read the article

  • Analyzing Python Code: Modulus Operator

    - by Bhubhu Hbuhdbus
    I was looking at some code in Python (I know nothing about Python) and I came across this portion: def do_req(body): global host, req data = "" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, 80)) s.sendall(req % (len(body), body)) tmpdata = s.recv(8192) while len(tmpdata) > 0: data += tmpdata tmpdata = s.recv(8192) s.close() return data This is then called later on with body of huge size, as in over 500,000 bytes. This is sent to an Apache server that has the max request size on the default 8190 bytes. My question is what is happening at the "s.sendall()" part? Obviously the entire body cannot be sent at once and I'm guessing it is reduced by way of the modulus operator. I don't know how it works in Python, though. Can anyone explain? Thanks.

    Read the article

  • Monitoring .NET ASP.NET Applications

    - by James Hollingworth
    I have a number of applications running on top of ASP.NET I want to monitor. The main things I care about are: Exceptions: We currently some custom code which will email us when an exception occurs. If the application is failing hard it will crash our outlook... I know (and use) elmah which partly solves the problem however it is still just a big table of exceptions with a pretty(ish) UI. I want something that makes sense of all of these exceptions (e.g. groups exceptions, alerts when new ones occur, tells me what the common ones are that I should fix, etc) Logging: We currently log to files which are then accessible via a shared folder which dev's grep & tail. Does anyone know of better ways of presenting this information. In an ideal world I want to associate it with exceptions. Performance: Request times, memory usage, cpu, etc. whatever stats I can get I'm guessing this is probably going to be solved by a number of tools, has anyone got any suggestions?

    Read the article

  • Make user object available to all Controllers in Zend?

    - by Sled
    Hey guys, I'm using Zend_Auth to identify a user in my application. This creates a session with the userobject. My question is how do I make this object available to every Controller and action, so I don't have to pull it out of the session every time I need data from this object? I'm guessing this should be done in bootstrap.php or index.php but I don't really know how to makte it available to every controller.. so any code examples would be appreciated! Thanks!

    Read the article

  • CodeIgniter Validation in Library does not accept callback.

    - by Lukas Oppermann
    Hey guys, my problem is the following: I am writing a login library. This library has a function _validation() and this uses the validation library to validate the data. With using normal validation methods it works just fine, but using a callback function just does not work. It is not called. I call it like this. $this->CI->form_validation->set_rules('user', 'Username', 'required|callback__check_user'); The functions name is _check_user and it uses the username _check_user($user). The function itself works fine and I can also call it in the class ($this-_check_user('username')) with a working result. I am guessing, there might be a problem because I am not workin in a controller so I have a CI instance $this-CI instead of just the original instance $this- Does anyone have a clue how to fix this? Thanks in advance.

    Read the article

  • JQuery Validation Plugin not working when used on page that includes another page via AJAX

    - by droidy
    We have a long page that contains a bunch of different form elements. One part of the form is called remotely via AJAX and is populated in an empty div. This is the part which JQuery Validation plugin is not working correctly on. We have class="required" on the elements on this page, but they do not show up as required. I'm guessing it's because the Validation plugin is looking for class="required" on our main page, and since the content from the AJAX page is put into the empty div behind the scenes, it's not detected the required fields. Any help is greatly appreciated.

    Read the article

  • Custom iPad keyboard backspace method last character crash

    - by isaaclimdc
    I'm making a custom UI iPad keyboard app, and I'm doing something similar to this post for the backspace method: custom backspace button crashes iPhone app However, the app will always crash when I "backspace" for the last character in the UITextView. I know -substringToIndex won't work for an empty string, but I tried using a temporary mutable string then using -deleteCharactersInRange, and that crashed it too. I'm guessing the crash is due to me manually setting the -selectedRange property for the text view after deleting a character? But even if I do: textView.selectedRange = NSMakeRange(0, 0); the app will crash. Any ideas?

    Read the article

  • C++ - how does Sleep() and cin work?

    - by quano
    Just curious. How does actually the function Sleep() work (declared in windows.h)? Maybe not just that implementation, but anyone. With that I mean - how is it implemented? How can it make the code "stop" for a specific time? Also curious about how cin and those actually work. What do they do exactly? The only way I know how to "block" something from continuing to run is with a while loop, but considering that that takes a huge amount of processing power in comparison to what's happening when you're invoking methods to read from stdin (just compare a while (true) to a read from stdin), I'm guessing that isn't what they do.

    Read the article

  • asp.net and Visual studio root directory question

    - by Mark Kadlec
    I am seeing something very odd and thought I would ask the Stackoverflow community if they knew the answer. I have an asp.net project that runs fine in one environment, but couldn't figure out what happened to the styles in another environment. In the first environment (Windows 2008 Server), the following link worked fine: <link href="/Styles/09/style.css" rel="stylesheet" type="text/css" /> but in the other environment (it's a Windows 7), I had to change it to work: <link href="../Styles/09/style.css" rel="stylesheet" type="text/css" /> Notice that the directories seemed to shift ahead one directory in the Win7, what's going on? It's like the "running" directory seems now be the \bin directory instead of the home! Which environment is configured correctly? How do I determine execution directory level? My concern going forward is pushing to a prod environment and guessing which configuration is correct. Any insight would be appreciated!

    Read the article

  • Hide other domains' menus from node edit form on a Drupal site using domain access

    - by monkeyninja
    I'm in the process of making some improvements to a live Drupal site that's using the Domain Access module to run a number of microsites. I'm trying to find a way of restricting the menus a user can post content to from the node edit screen. A user on one of the domains should only be able to post content to menus associated with that domain. Is there a simple way of achieving this? I'm guessing there are some hooks I could use, but so far I have been unable to identify them. I'd prefer not to have to install further modules to achieve this and to be able to add some code to the current site to alter the forms. The site is struggling with the large number of modules we've had to install on it already.

    Read the article

  • Wordpress IIS directory problem

    - by Haluk
    Hi, I'm trying to install wordpress on a Windows IIS server. I've extracted the wordpress file to a path like the following: www.domain.com/home I've setup the mysql database and configured the necessary wp-config.php. All is good so far. When I open the install php at: http://www.domain.com/home/wp-admin/install.php The page looks for its stylesheet at: http://www.domain.com/wp-admin/css/install.css That is wrong, it should look for the stylesheet at: http://www.domain.com/home/wp-admin/css/install.css I'm guessing the problem is with IIS but I have no clue how to tackle it and google did not help so far. I hope someone would know why this is happening. Thanks!

    Read the article

  • how to add column in SQL Query that incl. LEFT OUTER JOIN

    - by radbyx
    I have this Query: SELECT p.ProductName, dt.MaxTimeStamp, p.Responsible FROM Product p LEFT JOIN (SELECT ProductID, MAX(TimeStamp) AS MaxTimeStamp FROM StateLog WHERE State = 0 GROUP BY ProductID, Status) dt ON p.ProductID = dt.ProductID ORDER BY p.ProductName; It works like it should, but now I need to SELECT "State" out too. The tricky part is, that I only want the lastest "TimeStamp" where "State" was false. But now I also need the "State" for the lastest "TimeStamp". I tried this: SELECT p.ProductName, dt.State, dt.MaxTimeStamp, p.Responsible FROM Product p LEFT JOIN (SELECT ProductID, MAX(TimeStamp) AS MaxTimeStamp, State FROM StateLog WHERE State = 0 GROUP BY ProductID, Status) dt ON p.ProductID =dt.ProductID ORDER BY p.ProductName; But it didn't work, because it gave me the "State" for the lastest "TimeStamp". So I hope there is some clever heads out there that can help me. I'm guessing that this is either very simple or very hard to solve.

    Read the article

  • Finding a sequence in a List

    - by user113164
    I have a list of integers that I would like to search for a sequence. For example, if i have a master list: 1, 2, 3, 4, 9, 2, 39, 482, 19283, 19, 23, 1, 29 And I want to find sequence: 1, 2, 3, 4 I would like some easy way to fill a subset list with: 1, 2, 3, 4 + the next five integers in the master list And then remove the integers in the subset list from the master list so at the end of the operation, my lists would look like this: Master list: 19, 23, 1, 29 Subset list: 1, 2, 3, 4, 9, 2, 39, 482, 19283 Hope that makes sense. I'm guessing maybe linq would be good for something like this, but I've never used it before. Can anyone help?

    Read the article

  • Rails Load Data into Application every time a New User is Created

    - by looloobs
    Hi I am trying to figure out the "right" way to do this. In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those lists have many items. Some of those Items I want to be loaded when the User is created. I really don't know how to go about doing this but I am guessing something like: create User after_create: create Lists (need already existing data for the list names) after_create List then populate Items table with existing data for these Lists. Should I be using seed data for this? Is that alright for production and if so how exactly would I go about doing that. Any guidance or other recommendations are greatly appreciated.

    Read the article

  • As a scrum master introducing scrum to an organization, how do avoid also being product owner?

    - by Michael Rosario
    As a scrum master introducing scrum to an organization, how do avoid also being product owner? problem facts: List item I am working on a project as scrum master. Since the organization is new to scrum, I have assumed the role of setting meetings with stakeholders to form their system vision into user stories. At present, the stakeholders are not writing user stories. At present, our team is guessing what the most important stories should be with light confirmation from stakeholders. Is there anything more that I can do to move the product owner role away from myself?

    Read the article

  • WPF Labels look fine in XP, but are cut off at the bottom in Vista and Windows 7.

    - by juharr
    The following xaml looks fine in XP, but the bottom of the text gets cut off in Vista and Windows 7. <Grid> <Border Height="86" Margin="10,54,10,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"/> <Label Height="22" Width="100" Margin="15,43,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="White">Text Over Border</Label> </Grid> I realize that I could just increase the Height of the label, but I'm guessing I'll have problems with systems that have different resolution settings, or large text settings. Is there a better way to lay this out?

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >