Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 58/1194 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • sorl-thumbnail: random name in Thumbnail field

    - by xRobot
    I want to use str(uuid.uuid4()) instead of the name uploaded. I have this model: class foo(models.Model): pic = ThumbnailField(upload_to='pics', size=(200, 200)) I am uploading hello_world.jpg and I should save these named versions should be saved for example in 4ba9b397-da69-4307-9bce-e92887e84d2f.jpg. How can I do that?

    Read the article

  • regular expression for indian vehicle number

    - by I Like PHP
    i need validation for indian vehicle NUMBER here are condition list let expression is (x)(y)(z)(m)(a)(b)(c) 1. (x) contains only alphabets of length 2. 2. (y) may be - or single space ' ' 3. (z) contains only numbers of length 2 4. (m) may be or , or single space ' ' 5. length of (a) can be 2 or 3. contains alphanumeric value with minimum one alphabetic character. 6. (b) may be - or single space ' ' ( similar to (y) ) 7. (c) contains only numbers of length 4 i show you the various examples of vehicle number valid number RJ-14,NL-1234 RJ-01,4M-5874 RJ-07,14M-2345 RJ 07,3M 2345 RJ-07,3M-8888 RJ 07 4M 2345 RJ 07,4M 2933 invalid number RJ-07 3M 1234 ( both (y) and (b) should be same). RJ-07 M3-1234 ((a) must ends with alphabat). rj-07 M3-123 ( length of (c) must be 4).

    Read the article

  • MySQL vs PHP when retrieving a random item

    - by andufo
    Hi, which is more efficient (when managing over 100K records): A. Mysql SELECT * FROM user ORDER BY RAND(); of course, after that i would already have all the fields from that record. B. PHP use memcached to have $cache_array hold all the data from "SELECT id_user FROM user ORDER BY id_user" for 1 hour or so... and then: $id = array_rand($cache_array); of course, after that i have to make a MYSQL call with: SELECT * FROM user WHERE id_user = $id; so... which is more efficient? A or B?

    Read the article

  • WPF - Random hanging with file browser attached behaviour.

    - by Stimul8d
    Hi, I have an attached behavior defined thusly,.. public static class FileBrowserBehaviour { public static bool GetBrowsesOnClick(DependencyObject obj) { return (bool)obj.GetValue(BrowsesOnClickProperty); } public static void SetBrowsesOnClick(DependencyObject obj, bool value) { obj.SetValue(BrowsesOnClickProperty, value); } // Using a DependencyProperty as the backing store for BrowsesOnClick. This enables animation, styling, binding, etc... public static readonly DependencyProperty BrowsesOnClickProperty = DependencyProperty.RegisterAttached("BrowsesOnClick", typeof(bool), typeof(FileBrowserBehaviour), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(BrowsesOnClickChanged))); public static void BrowsesOnClickChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { FrameworkElement fe = obj as FrameworkElement; if ((bool)args.NewValue) { fe.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(OpenFileBrowser); } else { fe.PreviewMouseLeftButtonDown -= new MouseButtonEventHandler(OpenFileBrowser); } } static void OpenFileBrowser(object sender, MouseButtonEventArgs e) { var tb = sender as TextBox; if (tb.Text.Length < 1 || tb.Text=="Click to browse..") { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Executables | *.exe"; if (ofd.ShowDialog() == true) { Debug.WriteLine("Setting textbox text-" + ofd.FileName); tb.Text = ofd.FileName; Debug.WriteLine("Set textbox text"); } } } } It's a nice simple attached behavior which pops open an OpenFileDialog when you click on a textbox and puts the filename in the box when you're done. It works maybe 40% of the time but the rest of the time the whole app hangs. The call stack at this point looks like this - [Managed to Native Transition] WindowsBase.dll!MS.Win32.UnsafeNativeMethods.GetMessageW(ref System.Windows.Interop.MSG msg, System.Runtime.InteropServices.HandleRef hWnd, int uMsgFilterMin, int uMsgFilterMax) + 0x15 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessage(ref System.Windows.Interop.MSG msg, System.IntPtr hwnd, int minMessage, int maxMessage) + 0x48 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0x8b bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes Debugatron.exe!Debugatron.App.Main() + 0x5e bytes C# [Native to Managed Transition] [Managed to Native Transition] mscorlib.dll!System.AppDomain.nExecuteAssembly(System.Reflection.Assembly assembly, string[] args) + 0x19 bytes mscorlib.dll!System.Runtime.Hosting.ManifestRunner.Run(bool checkAptModel) + 0x6e bytes mscorlib.dll!System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() + 0x84 bytes mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext, string[] activationCustomData) + 0x65 bytes mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext) + 0xa bytes mscorlib.dll!System.Activator.CreateInstance(System.ActivationContext activationContext) + 0x3e bytes Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() + 0x23 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes Now, I've seen this kind of thing before when doing some asynchronous stuff but there's none of that going on at that point. The only thread alive is the UI thread! Also, I always get that last debug statement when it does hang. Can anyone point me in the right direction? This one's driving me crazy!

    Read the article

  • deploying WAMP -> live site - any random tips?

    - by Haroldo
    In the next few weeks I'll be taking my site from the localhost (WAMP) and puting it on a new server. This will be the first site, on my first server, so basically...i'm a noob! This must be an important moment for any independent web developer / small business so i'd love to hear about some experiences, mistakes and system default security holes that one should fix straight away... I'm using php, mysql, cpanel and WHM, and looking for tips like "Turn off error reporting in PHP"

    Read the article

  • Help, my CentOS servers keep going down , No route to host after a random uptime [closed]

    - by user249071
    Hello , I have a couple of Centos linux servers, that have a very simple task, they run nginx + fastcgi for php , and some NFS mounts between them, readonly They have some RPC commands to start some downloading processes with wget, nothing fancy , from a main server, but their behavior is very unstable, they simply go down, we tried to monitor ram , processor usage, even network connections, they don't load up so much, max network connections up to... 250 max, 15% processor usage and memory , well, doesn't even fill up, 2.5GB from 8GB max , I have no ideea why can a linux server go down like that, they aren't even public servers, no domain names installed no public serving, for sites. The only thing that I've discovered was that if i didn't restart the network service every couple of hours or so... the servers were becoming very slow, starting apps very slow, but not repoting a high usage of resources...Maybe Centos doesn't free the timeout connections, or something like that...It's based on Red Hat right? I'm not a linux expert , but I'm sure that there are a few guys out there that can easily have an answer to this , or even have some leads to what i can do ... I haven't installed snort, or other things to view if we have some DOS attacks, still the scheduled script that restarts the network each hour should put the system back online, and it doesn't.... Thank you in advance

    Read the article

  • as3 tracking number value of variables

    - by Wade D Ouellet
    Hi, I have a bunch an as3 game going. In my game when newCrag hits egg_mc the score gets added. // Add the score var newScore:score_mc; newScore = new score_mc(); addChild(newScore); newScore.x = 20; newScore.y = 20; newScore.score_txt.text='0/15'; var score:Number=0; function getEggs(event:Event):void { if(event.target.hitTestObject(MovieClip(root).newCrag) && event.target is egg_mc) { sndEgg.play(); if(event.target.stage) { event.target.parent.removeChild(event.target); } // Increase score score++; newScore.score_txt.text = "" + score + '/15'; } } I am trying to refer to the number value of the score using if statements. I need to change the speed variables based off the number that is inside the score box. var speed:Number if(score > 10 || score == 10) { speed=20; trace("speed3"); } else if(score > 5 || score == 5 && score < 10) { speed=18; trace("speed2"); } else { speed=14; trace("speed1"); } However, this part of the code is not working. Any help would be much appreciated. Thanks, Wade

    Read the article

  • Getting a NullPointerException at seemingly random intervals, not sure why

    - by Miles
    I'm running an example from a Kinect library for Processing (http://www.shiffman.net/2010/11/14/kinect-and-processing/) and sometimes get a NullPointerException pointing to this line: int rawDepth = depth[offset]; The depth array is created in this line: int[] depth = kinect.getRawDepth(); I'm not exactly sure what a NullPointerException is, and much googling hasn't really helped. It seems odd to me that the code compiles 70% of the time and returns the error unpredictably. Could the hardware itself be affecting it? Here's the whole example if it helps: // Daniel Shiffman // Kinect Point Cloud example // http://www.shiffman.net // https://github.com/shiffman/libfreenect/tree/master/wrappers/java/processing import org.openkinect.*; import org.openkinect.processing.*; // Kinect Library object Kinect kinect; float a = 0; // Size of kinect image int w = 640; int h = 480; // We'll use a lookup table so that we don't have to repeat the math over and over float[] depthLookUp = new float[2048]; void setup() { size(800,600,P3D); kinect = new Kinect(this); kinect.start(); kinect.enableDepth(true); // We don't need the grayscale image in this example // so this makes it more efficient kinect.processDepthImage(false); // Lookup table for all possible depth values (0 - 2047) for (int i = 0; i < depthLookUp.length; i++) { depthLookUp[i] = rawDepthToMeters(i); } } void draw() { background(0); fill(255); textMode(SCREEN); text("Kinect FR: " + (int)kinect.getDepthFPS() + "\nProcessing FR: " + (int)frameRate,10,16); // Get the raw depth as array of integers int[] depth = kinect.getRawDepth(); // We're just going to calculate and draw every 4th pixel (equivalent of 160x120) int skip = 4; // Translate and rotate translate(width/2,height/2,-50); rotateY(a); for(int x=0; x<w; x+=skip) { for(int y=0; y<h; y+=skip) { int offset = x+y*w; // Convert kinect data to world xyz coordinate int rawDepth = depth[offset]; PVector v = depthToWorld(x,y,rawDepth); stroke(255); pushMatrix(); // Scale up by 200 float factor = 200; translate(v.x*factor,v.y*factor,factor-v.z*factor); // Draw a point point(0,0); popMatrix(); } } // Rotate a += 0.015f; } // These functions come from: http://graphics.stanford.edu/~mdfisher/Kinect.html float rawDepthToMeters(int depthValue) { if (depthValue < 2047) { return (float)(1.0 / ((double)(depthValue) * -0.0030711016 + 3.3309495161)); } return 0.0f; } PVector depthToWorld(int x, int y, int depthValue) { final double fx_d = 1.0 / 5.9421434211923247e+02; final double fy_d = 1.0 / 5.9104053696870778e+02; final double cx_d = 3.3930780975300314e+02; final double cy_d = 2.4273913761751615e+02; PVector result = new PVector(); double depth = depthLookUp[depthValue];//rawDepthToMeters(depthValue); result.x = (float)((x - cx_d) * depth * fx_d); result.y = (float)((y - cy_d) * depth * fy_d); result.z = (float)(depth); return result; } void stop() { kinect.quit(); super.stop(); } And here are the errors: processing.app.debug.RunnerException: NullPointerException at processing.app.Sketch.placeException(Sketch.java:1543) at processing.app.debug.Runner.findException(Runner.java:583) at processing.app.debug.Runner.reportException(Runner.java:558) at processing.app.debug.Runner.exception(Runner.java:498) at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367) at processing.app.debug.EventThread.handleEvent(EventThread.java:255) at processing.app.debug.EventThread.run(EventThread.java:89) Exception in thread "Animation Thread" java.lang.NullPointerException at org.openkinect.processing.Kinect.enableDepth(Kinect.java:70) at PointCloud.setup(PointCloud.java:48) at processing.core.PApplet.handleDraw(PApplet.java:1583) at processing.core.PApplet.run(PApplet.java:1503) at java.lang.Thread.run(Thread.java:637)

    Read the article

  • jQuery: random active tab??

    - by tomwolber
    Hey there- I need to have a tab interface that has a different "active" tab every time the page loads. There will be advertiser content in each of the 4 tabs, so this is a way to keep things "fair". I am familiar with the tabs part...just need pointed in the right direction getting different "active" tabs to display on page load. Thanks!

    Read the article

  • How to generate random numbers of lognormal distribution within specific range in Matlab

    - by Harpreet
    My grain sizes are defined as D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42]. The problem is described below in steps. Grain sizes should follow lognormal distribution. The mean of the grain sizes is fixed as 0.84 and the standard deviation should be as low as possible but not zero. 90% of the grains (by weight %) fall in the size range of 1.19 to 0.59, and the rest 10% fall in size range of 0.50 to 0.42. Now I want to find the probabilities (weight percentage) of the grains falling in each grain size. It is allowable to split this grain size distribution into further small sizes but it must always be in the range of 1.19 and 0.42, i.e. 'D' can be continuous but 0.42 < D < 1.19. I need it fast. I tried on my own but I am not able to get the correct result. I am getting negative probabilities (weight percentages). Thanks to anyone who helps. I didn't incorporate the point 3 as I came to know about that condition later. Here are simple steps I tried: %% D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42]; s=0.30; % std dev of the lognormal distribution m=0.84; % mean of the lognormal distribution mu=log(m^2/sqrt(s^2+m^2)); % mean of the associated normal dist. sigma=sqrt(log((s^2/m^2)+1)); % std dev of the associated normal dist. [r,c]=size(D); for i=1:c D(i)=mu+(sigma.*randn(1)); w(i)=(log(D(i))-mu)/sigma; % the probability or the wt. percentage of the grain sizes end grain_size=exp(D); %%

    Read the article

  • Database model for saving random boolean expressions

    - by zarko.susnjar
    I have expressions like this: (cat OR cats OR kitten OR kitty) AND (dog OR dogs) NOT (pigeon OR firefly) Anyone having idea how to make tables to save those? Before I got request for usage of brackets, I limited usage of operators to avoid ambiguous situations. So only ANDs and NOTs or only ORs and saved those in this manner: operators id | name 1 | AND 2 | OR 3 | NOT keywords id | keyword 1 | cat 2 | dog 3 | firefly expressions id | operator | keywordId 1 | 0 | 1 1 | 1 | 2 1 | 3 | 3 which was: cat AND dog NOT firefly But now, I'm really puzzled...

    Read the article

  • Random Complete System Unresponsiveness Running Mathematical Functions

    - by Computer Guru
    I have a program that loads a file (anywhere from 10MB to 5GB) a chunk at a time (ReadFile), and for each chunk performs a set of mathematical operations (basically calculates the hash). After calculating the hash, it stores info about the chunk in an STL map (basically <chunkID, hash>) and then writes the chunk itself to another file (WriteFile). That's all it does. This program will cause certain PCs to choke and die. The mouse begins to stutter, the task manager takes 2 min to show, ctrl+alt+del is unresponsive, running programs are slow.... the works. I've done literally everything I can think of to optimize the program, and have triple-checked all objects. What I've done: Tried different (less intensive) hashing algorithms. Switched all allocations to nedmalloc instead of the default new operator Switched from stl::map to unordered_set, found the performance to still be abysmal, so I switched again to Google's dense_hash_map. Converted all objects to store pointers to objects instead of the objects themselves. Caching all Read and Write operations. Instead of reading a 16k chunk of the file and performing the math on it, I read 4MB into a buffer and read 16k chunks from there instead. Same for all write operations - they are coalesced into 4MB blocks before being written to disk. Run extensive profiling with Visual Studio 2010, AMD Code Analyst, and perfmon. Set the thread priority to THREAD_MODE_BACKGROUND_BEGIN Set the thread priority to THREAD_PRIORITY_IDLE Added a Sleep(100) call after every loop. Even after all this, the application still results in a system-wide hang on certain machines under certain circumstances. Perfmon and Process Explorer show minimal CPU usage (with the sleep), no constant reads/writes from disk, few hard pagefaults (and only ~30k pagefaults in the lifetime of the application on a 5GB input file), little virtual memory (never more than 150MB), no leaked handles, no memory leaks. The machines I've tested it on run Windows XP - Windows 7, x86 and x64 versions included. None have less than 2GB RAM, though the problem is always exacerbated under lower memory conditions. I'm at a loss as to what to do next. I don't know what's causing it - I'm torn between CPU or Memory as the culprit. CPU because without the sleep and under different thread priorities the system performances changes noticeably. Memory because there's a huge difference in how often the issue occurs when using unordered_set vs Google's dense_hash_map. What's really weird? Obviously, the NT kernel design is supposed to prevent this sort of behavior from ever occurring (a user-mode application driving the system to this sort of extreme poor performance!?)..... but when I compile the code and run it on OS X or Linux (it's fairly standard C++ throughout) it performs excellently even on poor machines with little RAM and weaker CPUs. What am I supposed to do next? How do I know what the hell it is that Windows is doing behind the scenes that's killing system performance, when all the indicators are that the application itself isn't doing anything extreme? Any advice would be most welcome.

    Read the article

  • Sudden drop in Total Indexed pages and increase in 'Not Selected' number.

    - by Pravin
    My blog is around 1 year old and have PR2. The average daily pageviews upto last 1 week were 1800. The total number of posts are 180. Though I have only 180 total posts, the total number of Indexed URL was increasing and it was as high as 510. But in the month of Sept2012, the total number of Indexed pages dropped from 510 to 214. The drop was sudden and it is now increasing very slowly. Also, the other main concern is huge increase in 'Not Selected' number. It is currently 814. I have never posted any post again and never copied any idea from any other blog. But I do use internal linking to some older post those are related to the new posts. The questions are:; Why there is sudden drop in the 'Total Indexed' pages. Why there was increase in total indexed pages to 500 even though the total posts were only 180. As the drop in 'Total Indexed' was in the month of sept2012, I was getting same organic traffic and it was steadily increasing till last week and then there was a 50 drop in the total pageviews. Why. Now, again the traffic is becoming to normal but still there is a problem. Is increase in the 'Not selected' number is a cause of drop in 'Total Indexed'? How to prevent or reduce the number of 'Not Selected' even though I do not have any duplicate post withing blog. Is the 'internal linking' to older post creating 'Not selected' problem? Should I edit my 'Robot.txt' to avoid crawling of labes that may be creating duplicate posts or something like that, if so, what is correct robot.txt. I have uploaded the screenshot of the graph of Webmaster Tools. Please take a look and give suggestions. Please help. Thank you in advance.

    Read the article

  • Implementing scroll view that is much larger than the screen view with random images

    - by pulegium
    What I'm trying to do is to implement something like the fruit machine scroll view. Basically I have a sequence of images (randomly generated on the fly) and I want to allow the users to scroll through this line. There can fit approx 10 images on the screen, but the line is virtually unlimited. My question is what would be the best approach in implementing this? So far I've thought of having a UIImageView going across the screen (with width equal to the sum of 10 images) and the image associated with it would be a combination of 12 or so images, with two images falling out of the visible area, this would allow for smooth scrolling. If the user scrolls further, then I would reconstruct the image associated with the view so the new images are appended and the old one's are discarded. This image reconstruction business sounds bit complicated, so I was wondering if there's a more logical way to implement this. There's one more thing, I want to have two lines crossing each other with images, bit like conveyor belts crossing. If that makes any sense... Bit like below: V1 V2 H1 H2 H3 H4 H5 V4 V5 So if the vertical belt is moved it'd be like: V2 H3 H1 H2 V4 H4 H5 V5 V6 H1-H5, V1-V6 being automatically generated images. I'm not asking for the implementation code, just the thoughts on the principles how to implement this. Thanks!! :)

    Read the article

  • pass a number value to a Timer, XML and AS3

    - by VideoDnd
    I want to pass a number value to a Timer. How do I do this? My number and integer values for other variables work fine. Error I get null object reference and coercion of value, because I'm not passing to 'timer' properly. I don't want to say my variable's a number, I want to say it has a number value. Variable //what I have now var timer:Timer; timer = new Timer(100); Path myXML.COUNT.text(); XML <?xml version="1.0" encoding="utf-8"?> <SESSION> <TIMER TITLE="speed">100</TIMER> </SESSION> Parse and Load //LOAD XML var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("time.xml")); myLoader.addEventListener(Event.COMPLETE, processXML); //PARSE XML function processXML(e:Event):void { myXML = new XML(e.target.data);

    Read the article

  • Efficient data structure for fast random access, search, insertion and deletion

    - by Leonel
    I'm looking for a data structure (or structures) that would allow me keep me an ordered list of integers, no duplicates, with indexes and values in the same range. I need four main operations to be efficient, in rough order of importance: taking the value from a given index finding the index of a given value inserting a value at a given index deleting a value at a given index Using an array I have 1 at O(1), but 2 is O(N) and insertion and deletions are expensive (O(N) as well, I believe). A Linked List has O(1) insertion and deletion (once you have the node), but 1 and 2 are O(N) thus negating the gains. I tried keeping two arrays a[index]=value and b[value]=index, which turn 1 and 2 into O(1) but turn 3 and 4 into even more costly operations. Is there a data structure better suited for this?

    Read the article

  • Pyparsing CSV string with random quotes

    - by gtfx
    Hey, I have a string like the following: <118date=2010-05-09,time=16:41:27,device_id=FE-2KA3F09000049,log_id=0400147717,log_part=00,type=statistics,subtype=n/a,pri=information,session_id=o49CedRc021772,from="[email protected]",mailer="mta",client_name="example.org,[194.177.17.24]",resolved=OK,to="[email protected]",direction="in",message_length=6832079,virus="",disposition="Accept",classifier="Not,Spam",subject="=?windows-1255?B?Rlc6IEZ3OiDg5fDp5fog+fno5fog7Pf46eHp7S3u4+Tp7SE=?=" I tried using CSV module and it didn't fit, cause i haven't found a way to ignore what's quoted. Pyparsing looked like a better answer but i haven't found a way to declare all the grammars. Currently, i am using my old Perl script to parse it, but i want this written in Python. if you need my Perl snippet i will be glad to provide it. Any help is appreciated.

    Read the article

  • UIImagePickerController random behavior

    - by pion
    I have the following code snippets: @interface PinRecordNewTableViewController : UITableViewController { } ... @implementation PinRecordNewTableViewController ... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... PinRecordNewPicture *pinRecordNewPicture = [[PinRecordNewPicture alloc] initWithNibName:@"PinRecordNewPicture" bundle:nil]; pinRecordNewPicture.delegate = self; [self.navigationController pushViewController:pinRecordNewPicture animated:YES]; [pinRecordNewPicture release]; ... } @interface PinRecordNewPicture : UIViewController ... @implementation PinRecordNewPicture ... - (void)picturePicker:(UIImagePickerControllerSourceType)theSource { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = theSource; picker.allowsEditing = YES; [self presentModalViewController:picker animated:YES]; [picker release]; } - (IBAction) takePicture:(id)sender { UIImagePickerControllerSourceType source = UIImagePickerControllerSourceTypeCamera; if ([UIImagePickerController isSourceTypeAvailable:source]) { [self picturePicker:source]; } It works 80% of the time -- I could get the picture correctly. The problem is that it occasionally failed to take a picture. When tracing the code, I found out that it occasionally goes to -PinRecordNewTableViewController:viewDidUnload. This is where it fails because it set nil to all ivars. What did I do wrong? Did I miss something so it behaves "randomly"? Thanks in advance for your help.

    Read the article

  • getting number from console!

    - by Johanna
    Hi this is my method that will be called if I want to get a number from user. but if the user also enter a right number just the "else" part will be run ,why? please help me tahnsk. public static int chooseTheTypeOfSorting() { System.out.println("Enter 0 for merge sorting OR enter 1 for bubble sorting"); int numberFromConsole = 0; try { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String s = br.readLine(); DecimalFormat df = new DecimalFormat(); Number n = df.parse(s); numberFromConsole = n.intValue(); } catch (ParseException ex) { Logger.getLogger(DoublyLinkedList.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(DoublyLinkedList.class.getName()).log(Level.SEVERE, null, ex); } return numberFromConsole; } and in my main method: public static void main(String[] args) { int i = 0; i = getRandomNumber(10, 10000); int p = chooseTheTypeOfSorting(); DoublyLinkedList list = new DoublyLinkedList(); for (int j = 0; j < i; j++) { list.add(j, getRandomNumber(10, 10000)); if (p == 0) { //do something.... } if (p == 1) { //do something..... } else { System.out.println("write the correct number "); chooseTheTypeOfSorting(); }

    Read the article

  • FLEX: fade in/out, random positioning, text

    - by Patrick
    hi, I want to fade in / fade out some text placing it randomly on the screen in a flex module. I have 2 questions: 1) What Flex container should I use to display the actionscript text animations into it ? 2) What type should I use for text ? I need to set the textFormat on it. Is UITextField the correct solution ? thanks

    Read the article

  • Oracle ODBC x64 - getting 0 when selecting a number(9) column

    - by MatsL
    I'm having a really weird problem with a third party web service that uses an ODBC connection to Oracle 10.2.0.3.0. I've written a .NET client that generates the same SQL as the web service so I can find out what's going on. The web service is hosted by IIS 6 that's in x64 mode so we use Oracle x64 client. The oracle client version is 10.2.0.1.0. I have a table that looks like this (I've removed some columns and names): SQL> describe tablename; Name Null? Type ----------------------------------------- -------- ---------------------------- KOD VARCHAR2(30) ORDNING NUMBER(5) AVGIFT NUMBER(9) I then in SQL*Plus issue the following statement: SELECT KOD as kod, AVGIFT as riskPoang FROM tablename Where upper(KODTYP) = 'OBJLIVSV_RISKVERKSAMTYP' ORDER BY ORDNING And I get the following result: KOD RISKPOANG ------------------------------ ---------- Hög risk 55 Mellan risk 35 Låg risk 15 Mycket låg risk 5 But when I execute the exact same SQL using the same DSN on the same machine I get this: Values Kod: Hög risk RiskPoäng: 0 Kod: Mellan risk RiskPoäng: 0 Kod: Låg risk RiskPoäng: 0 Kod: Mycket låg risk RiskPoäng: 0 If I first cast the number to varchar and then back again to number, like this: SELECT KOD as kod, to_number(to_char(AVGIFT, '99'), '9999999999') as riskPoang FROM tablename Where upper(KODTYP) = 'OBJLIVSV_RISKVERKSAMTYP' ORDER BY ORDNING I get the correct result: Values Kod: Hög risk RiskPoäng: 55 Kod: Mellan risk RiskPoäng: 35 Kod: Låg risk RiskPoäng: 15 Kod: Mycket låg risk RiskPoäng: 5 Has anyone else experiences this? It's incredibly annoying and I'm completely stuck and not sure what to do next. We have a third party web service that use these tables so I must get the original SQL-statement to work since I can't modify its code. And pointers are greatly appreciated! :-) Best regards, Mats

    Read the article

  • regular expression for indian vehicle number in javascript and php

    - by I Like PHP
    i need regular expression in java script as well as in PHP for Indian vehicle NUMBER here are conditions list let expression is (x)(y)(z)(m)(a)(b)(c) 1. (x) contains only alphabets of length 2. 2. (y) may be - or single space ' ' 3. (z) contains only numbers of length 2 4. (m) may be or , or single space ' ' 5. length of (a) can be 2 or 3. contains alphanumeric value with minimum one alphabetic character. 6. (b) may be - or single space ' ' ( similar to (y) ) 7. (c) contains only numbers of length 4 i show you the various examples of vehicle number valid number RJ-14,NL-1234 RJ-01,4M-5874 RJ-07,14M-2345 RJ 07,3M 2345 RJ-07,3M-8888 RJ 07 4M 2345 RJ 07,4M 2933 invalid number RJ-07 3M 1234 ( both (y) and (b) should be same). RJ-07 M3-1234 ((a) must ends with alphabat). rj-07 M3-123 ( length of (c) must be 4).

    Read the article

  • C++ Greatest Number Verification

    - by Daniel
    Hey guys, I was assigned to create a program that creates n arrays composed by 10 random integers. The the program should sum all the integers and display the result. After, it has to verify which of the sums is the greatest and it has to display that array and the result. Im having troubles getting it done and would like to get some help! Thanks once again. Here is my code so far: #include <iostream> #include <iomanip> #include <cmath> using namespace std; double random(unsigned int &seed); unsigned int seed = 5; void generateData(int set[10]); int sumData(int set[10]); void checkData(int sumResult, int arrayNumber); int main (int argc, char * const argv[]) { int arrayNumber, sumResult; int set[10]; do { cout << "Number of Arrays to Compare: " << endl; cin >> arrayNumber; } while (arrayNumber < 0); for (int i = 0; i < arrayNumber; ++i) { generateData(set); sumResult = sumData(set); cout << "Sum --> " << sumResult << endl; checkData(sumResult, arrayNumber); } return 0; } double random(unsigned int &seed) { const int MODULUS = 15749; const int MULTIPLIER = 69069; const int INCREMENT = 1; seed = ((MULTIPLIER * seed) + INCREMENT) % MODULUS; return double(seed) / double(MODULUS); } void generateData(int set[10]) { for (int i = 0; i < 10; ++i) { set[i] = int (5 + 6 * random(seed)); cout << set[i] << " || "; } } int sumData(int set[10]) { int sumTotal = 0; for (int i = 0; i < 10; ++i) sumTotal = sumTotal + set[i]; return sumTotal; } void checkData(int sumResult, int arrayNumber) { int largerNumber; int tempSet[2]; for (int i = 0; i < arrayNumber; ++i) { if (sumResult > largerNumber) { tempSet[i] = sumResult; } } }

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >