Daily Archives

Articles indexed Tuesday June 15 2010

Page 21/118 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • To find first N prime numbers in python

    - by Rahul Tripathi
    Hi All, I am new to the programming world. I was just writing this code in python to generate N prime numbers. User should input the value for N which is the total number of prime numbers to print out. I have written this code but it doesn't throw the desired output. Instead it prints the prime numbers till the Nth number. For eg.: User enters the value of N = 7. Desired output: 2, 3, 5, 7, 11, 13, 19 Actual output: 2, 3, 5, 7 Kindly advise. i=1 x = int(input("Enter the number:")) for k in range (1, (x+1), 1): c=0 for j in range (1, (i+1), 1): a = i%j if (a==0): c = c+1 if (c==2): print (i) else: k = k-1 i=i+1

    Read the article

  • Blackberry app development - Drawing graphics on top of rendered text/buttons etc

    - by paullb
    Based off the one of the demos I have the following code. Currently what displays in the simulator is just hte contents of the paint function, however the ObjectChoiceField is still selectable if one happens to click in the right location. I would like both the text contents and the paint function contents to appear. Is this possible? public CityInfoScreen() { //invoke the MainScreen constructor super(); //add a screen title LabelField title = new LabelField("City Information Kiosk", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); setTitle(title); //add a text label add(new RichTextField("Major U.S. Cities")); //add a drop-down list with three choices: //Los Angeles, Chicago, or New York //... String choices[] = {"Los Angeles","Chicago","New York"}; choiceField = new ObjectChoiceField("select a city", choices); add(choiceField); Manager man = this.getMainManager(); } ... public void paint(Graphics g){ super.paint(g); // g.drawRect(0,left,500,500+left); g.setGlobalAlpha(0); g.drawRect(100-left,100-top,200,200); String text = new Integer(left).toString(); String text2 = new Integer(top).toString(); g.drawText(text + " " + text2,120-left,120-top); }

    Read the article

  • how to animate a menu item into a large div (window) using jquery's animate?

    - by ijjo
    i'm pretty sure this can be done pretty easily with jquery's animate api, but i'm not good enough to figure it out. what i want to do is this: i have a menu item at the top of the viewport that the user will click on. when the user clicks on it, you'll see something that looks like the div "popping" out of the menu and float to a particular location on the screen. when i say popping i don't mean anything fancy - i just mean it appears to be originating from the menu item and settling somewhere on the screen that i specify. but the important part is that this animation happens really fast. fast enough where you don't have to actually wait for the window to appear, but slow enough so the eye sees the animation start from the menu item and end up at a new location where the window will actually appear, and appear with a specify height and width. hope that all made sense?

    Read the article

  • c#: how to send ctrl+z

    - by I__
    how do i convert ctrl+z to a string? i am sending this as an AT COMMAND to an attached device to this computer basically i just to put some chars in a string and ctrl+z in that string as well

    Read the article

  • Create image from RAID images

    - by myforwik
    I have 3 raw images of what was once a 3 disk RAID5 setup. The hardware has been lost and the configuration is unknown. Does anyone know of some software that can automatically detect the raid configuration and write a single image out?

    Read the article

  • Help with this compile error

    - by Scott
    I just picked up an old project and I'm not sure what the following error could mean. g++ -o BufferedReader.o -c -g -Wall -std=c++0x -I/usr/include/xmms2 -Ijsoncpp/include/json/ -fopenmp -I/usr/include/ImageMagick -I/usr/include/xmms2 -I/usr/include/libvisual-0.4 -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SCRIPT_LIB -DQT_SHARED -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtScript BufferedReader.cpp In file included from BufferedReader.cpp:23: /usr/include/string.h:36:42: error: missing binary operator before token "(" In file included from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/cwchar:47, from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/bits/postypes.h:42, from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/iosfwd:42, from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/ios:39, from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/istream:40, from /usr/lib/gcc/i686-redhat-linux/4.4.3/../../../../include/c++/4.4.3/sstream:39, from BufferedReader.cpp:24: At line 24 of BufferedReader.cpp is #include <string.h>. I've tried it with just <string> but get the same thing. Any clue? Here's the snippet of code from string.h /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) //line 36 # define __CORRECT_ISO_CPP_STRING_H_PROTO #endif Does that mean __GNUC_PREREQ isn't defined?

    Read the article

  • Video packet capture over multiple IP cameras

    - by nimals1986
    Hello We are working on a C language application which is simple RTSP/RTP client to record video from Axis a number of Cameras . We launch a pthread for each of the camera which establishes the RTP session and begins to record the packets captured suing the recvfrom() call... A single camera single pthread records fine for well over a day without issues.. but testing with more cameras available,about 25(so 25 pthreads), the recording to file goes fine for like 15 to 20 mins and then the recording just stops ..the application still keeps running .. Its been over a month and a half we have been trying with varied implementations but nothing seems to help .. Please provide suggestions.. We are using CentOS 5 platform

    Read the article

  • How to send ctrl+z

    - by I__
    How do I convert ctrl+z to a string? I am sending this as an AT COMMAND to an attached device to this computer. Basically, I just to put some chars in a string and ctrl+z in that string as well

    Read the article

  • regarding object recycling

    - by ajaycv
    I have a question. What is wrong with regards to the below code: ArrayList tempList2 = new ArrayList(); tempList2 = getXYZ(tempList1, tempList2); //method getXYZ getXYZ(ArrayList tempList1, ArrayList tempList2) { //does some logic and adds objects into tempList2 return tempList2; } The code will get executed but it seems by passing tempList2 to the getXYZ method argument, it is doing object recycling. My question is, Is recycling the tempList2 arraylist object correct?

    Read the article

  • Disable globbing in PHP exec()

    - by wxs
    I have a PHP script which calls another script in order to add IP addresses to a whitelist. I sometimes want to whitelist all addresses, in which case I have it call exec("otherscript *.*.*.*", output, retval); This worked fine, adding the string "*.*.*.*" to the whitelist until I happened to have another file in the directory of the php script that matched that pattern ("foo.1.tar.gz"), at which point the wildcards were expanded, and I ended up with the filename in my whitelist. Is there some way to disable globbing in php's exec? It isn't mentioned in the PHP docs as far as I can tell.

    Read the article

  • How to assign class property as display data memeber in datagridview

    - by KoolKabin
    hi guys, I am trying to display my data in datagridview. I created a class with different property and used its list as the datasource. it worked fine. but i got confused how to do that in case we have nested class. My Classes are as follows: class Category property UIN as integer property Name as string end class class item property uin as integer property name as string property mycategory as category end class my data list as follows: dim myDataList as list(of Item) = new List(of Item) myDataList.Add(new Item(1,"item1",new category(1,"cat1"))) myDataList.Add(new Item(2,"item2",new category(1,"cat1"))) myDataList.Add(new Item(3,"item3",new category(1,"cat1"))) myDataList.Add(new Item(4,"item4",new category(2,"cat2"))) myDataList.Add(new Item(5,"item5",new category(2,"cat2"))) myDataList.Add(new Item(6,"item6",new category(2,"cat2"))) Now I binded the datagridview control like: DGVMain.AutoGenerateColumns = False DGVMain.ColumnCount = 3 DGVMain.Columns(0).DataPropertyName = "UIN" DGVMain.Columns(0).HeaderText = "ID" DGVMain.Columns(1).DataPropertyName = "Name" DGVMain.Columns(1).HeaderText = "Name" DGVMain.Columns(2).DataPropertyName = "" **'here i want my category name** DGVMain.Columns(2).HeaderText = "category" DGVMain.datasource = myDataList DGVMain.refresh() I have tried using mycategory.name but it didn't worked. What can be done to get expected result? Is there any better idea other than this to accomplish the same task?

    Read the article

  • How to upload multiple files to a SharePoint List

    - by AboutDev
    I am trying to upload multiple files into a SharePoint LIST as attachments. (can't use Document Libraries). I'm trying to use jquery to accomplish this but I'd appreciate any help or advise you may have concerning how best to upload to a list. For instance, can multi-uploads be accomplished when creating a new item? If you have code or examples/url's I can refer to I would welcome that. Cheers. PS - I need to select multiple files to upload at one go too...I know you can do this with flash-uploaders but can this be done for ASP.NET and specifically for SharePoint?

    Read the article

  • Zend Framework modular app, can't load models for each module, autoloading models?

    - by EricP
    Is there a way to have models for each module? I have 3 modules, one is a "contacts" module. I created a model for it in modules/contacts/models/Codes.php Codes Controller class Contacts_CodesController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ $this->view->messages = $this->_helper->flashMessenger->getMessages(); } public function indexAction() { $codesTable = new Contacts_Model_Codes(); } Codes Model: class Contacts_Model_Codes extends Zend_Db_Table { protected $_name = 'codes'; } The error I get: Fatal error: Class 'Contacts_Model_Codes' not found in /Applications/MAMP/htdocs/zf_site/application/modules/contacts/controllers/CodesController.php on line 26 thanks

    Read the article

  • Sharepoint Filter

    - by Albert
    Hi All, I have two lists, Status Name (string) Active (yes/no) Task Name (string) Status (Lookup to Status list) I have the following statuses (These can be changed at any time by the client): New, Active = Yes Open, Active = Yes Not Resolved, Active = No Resolved, Active = No I want to create a view for the Projects list, that shows all active tasks... How would I go about this? Thanks! Albert

    Read the article

  • SELECT INTO or Stored Procedure?

    - by Kerry
    Would this be better as a stored procedure or leave it as is? INSERT INTO `user_permissions` ( `user_id`, `object_id`, `type`, `view`, `add`, `edit`, `delete`, `admin`, `updated_by_user_id` ) SELECT `user_id`, $object_id, '$type', 1, 1, 1, 1, 1, $user_id FROM `user_permissions` WHERE `object_id` = $object_id_2 AND `type` = '$type_2' AND `admin` = 1 You can think of this with different objects, lets say you have groups and subgroups. If someone creates a subgroup, it is making everyone who had access to the parent group now also have access to the subgroup. I've never made a stored procedure before, but this looks like it might be time. This call be probably be called very often. Should I be creating a procedure or will the performance be insignificant?

    Read the article

  • ASP.NET - How can I cache user details for the duration of their visit?

    - by rockinthesixstring
    I've built a Repository that gets user details Public Function GetUserByOpenID(ByVal openid As String) As User Implements IUserRepository.GetUserByOpenID Dim user = (From u In dc.Users Where u.OpenID = openid Select u).FirstOrDefault Return user End Function And I'd like to be able to pull those details down IF the user is logged in AND IF the cached data is null. What is the best way to create a User object that contains all of the users details, and persist it across the entire site for the duration of their visit? I Was trying this in my Global.asax, but I'm not really happy using Session variables. I'd rather have a single object with all the details inside. Private Sub BaseGlobal_AcquireRequestState(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.AcquireRequestState If Session("UserName") Is Nothing AndAlso User.Identity.IsAuthenticated Then Dim repo As UrbanNow.Core.IUserRepository = New UrbanNow.Core.UserRepository Dim _user As New UrbanNow.Core.User _user = repo.GetUserByOpenID(User.Identity.Name) Session("UserName") = _user.UserName() Session("UserID") = _user.ID End If End Sub

    Read the article

  • Error when doing git pull, unable to resolve

    - by nubela
    Hi, I'm getting this git error and I don't really get what it means, nor how I can fix it: (v_env)[nubela@nubela-desktop searchplus]$ git pull origin master From file:///home/nubela/Workspace/_git/searchplus * branch master -> FETCH_HEAD Updating 38f3d5b..fe6028c error: Untracked working tree file 'searchplus/.project' would be overwritten by merge. Aborting (v_env)[nubela@nubela-desktop searchplus]$ I've done the following but to no avail: git clean -f -d git reset --hard HEAD Anyone can help enlighten me? Thanks :)

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >