Daily Archives

Articles indexed Wednesday May 5 2010

Page 24/119 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Use Java and RegEx to convert casing in a string

    - by Andreas
    Problem: Turn "my testtext TARGETSTRING my testtext" into "my testtext targetstring my testtext" Perl supports the "\L"-operation which can be used in the replacement-string. The Pattern-Class does not support this operation: Perl constructs not supported by this class: [...] The preprocessing operations \l \u, \L, and \U. http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html

    Read the article

  • Unique view count.

    - by alokswain
    I have a collection of links which are being displayed on the index page. Whenever a user clicks a link I want to keep a track of the number of unique views. I know it can be done by tracking the ips whenever a click happens by request.remote_ip and then the link of the page that was clicked. Is there any better approach ? Any plugins etc.

    Read the article

  • need help with 301 redirect and seo urls

    - by tyler
    Ok, i used the below to "seoize" my urls. It works great..the only problem is when i go to the old page it doesnt redirect to the new page.. so i have a feeling i will get two pages indexed in google... how can i just permenantly redirect the old pages eto new urls... RewriteRule ^city/([^/]+)/([^/]+) /rate-page.php?state=$1&city=$2 [NC] http: / / www.ratemycommunity.com/city/Kansas/Independence and old page = http://www.ratemycommunity.com/rate-page.php?state=Kansas&city=Independence

    Read the article

  • How do I add animation to an iPhone app?

    - by james p
    So I came from a Flash background where I can animate in timeline. I've completed the Beginning iPhone Development book and just realized that I still don't know how to get an animation in. I'm guessing I need to import png sequences? Can anyone point me to an appropriate place to learn more about this topic? I want to make a game and my game objects need to animate. Thanks in advance!!

    Read the article

  • Is there any certification in simple SQL

    - by Mirage
    I want to do sql certification but specific like mysql , postgresql , mSsql . Is there any simple sql certification If not which one would be good to do for company level. which covers all topics I am thinking of going in data warehousing, if that helps.

    Read the article

  • Multithreaded java cache for objects that are heavy to create ?

    - by krosenvold
    I need a cache some objects with fairly heavy creation times, and I need exactly-once creation semantics. It should be possible to create objects for different CacheKeys concurrently. I think I need something that (under the hood) does something like this: ConcurrentHashMap<CacheKey, Future<HeavyObject>> Are there any existing open-source implementations of this that I can re-use ?

    Read the article

  • How do you get and set a class property across multiple functions in Objective-C?

    - by editor
    Following up on this question about sharing objects between classes, I now need to figure out how to share the objects across various functions in a class. First, the setup: In my App Delegate I load menu information from JSON into a NSMutableDictionary and message that through to a view controller using a function called initWithData. I need to use this dictionary to populate a new Table View, which has methods like numberOfRowsInSection and cellForRowAtIndexPath. I'd like to use the dictionary count to return numberOfRowsInSection and info in the dictionary to populate each cell. Unfortunately, my code never gets beyond the init stage and the dictionary is empty so numberOfRowsInSection always returns zero. I thought I could create a class property, synthesize it and then set it. But it doesn't seem to want to retain the property's value. What am I doing wrong here? In the header .h: @interface FirstViewController:UIViewController <UITableViewDataSource, UITableViewDelegate, UITabBarControllerDelegate> { NSMutableDictionary *sectorDictionary; NSInteger sectorCount; } @property (nonatomic, retain) NSMutableDictionary *sectorDictionary; - (id)initWithData:(NSMutableDictionary*)data; @end in the implementation .m: - (id) testFunction:(NSMutableDictionary*)dictionary { NSLog(@"Count #1: %d", [dictionary count]); return nil; } - (id)initWithData:(NSMutableDictionary *)data { if (!(self=[super init])) { return nil; } [self testFunction:data]; // this is where I'd like to set a retained property self.sectorDictionary = data; return nil; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"Count #2: %d", [self.sectorDictionary count]); return [self.sectorDictionary count]; } Output from NSLog: 2010-05-04 23:00:06.255 JSONApp[15890:207] Count #1: 9 2010-05-04 23:00:06.259 JSONApp[15890:207] Count #2: 0

    Read the article

  • Efficient calculation of matrix cumulative standard deviation in r

    - by Abiel
    I recently posted this question on the r-help mailing list but got no answers, so I thought I would post it here as well and see if there were any suggestions. I am trying to calculate the cumulative standard deviation of a matrix. I want a function that accepts a matrix and returns a matrix of the same size where output cell (i,j) is set to the standard deviation of input column j between rows 1 and i. NAs should be ignored, unless cell (i,j) of the input matrix itself is NA, in which case cell (i,j) of the output matrix should also be NA. I could not find a built-in function, so I implemented the following code. Unfortunately, this uses a loop that ends up being somewhat slow for large matrices. Is there a faster built-in function or can someone suggest a better approach? cumsd <- function(mat) { retval <- mat*NA for (i in 2:nrow(mat)) retval[i,] <- sd(mat[1:i,], na.rm=T) retval[is.na(mat)] <- NA retval } Thanks.

    Read the article

  • Can't get my object to point at the mouse.

    - by melignus
    I'm using a combination of SDL and OpenGL in a sort of crash course project to teach myself how this all works. I'm really only interested in OpenGL as a way to use acceleration in 2D games so I just need this to work in a 2D plane. I have been having a lot of problems today with my current issue, I would like an object to point towards the mouse while the mouse button is clicked and then of course stay pointing in that direction after the mouse is lifted. void Square::handle_input() { //If a key was pressed if( event.type == SDL_KEYDOWN ) { //Adjust the velocity switch( event.key.keysym.sym ) { case SDLK_UP: upUp = false; yVel = -1; break; case SDLK_DOWN: downUp = false; yVel = 1; break; case SDLK_LEFT: leftUp = false; xVel = -1; break; case SDLK_RIGHT: rightUp = false; xVel = 1; break; case SDLK_w: wUp = false; sAng = 1; break; case SDLK_s: sUp = false; sAng = -1; break; } } //If a key was released else if( event.type == SDL_KEYUP ) { //Adjust the velocity switch( event.key.keysym.sym ) { case SDLK_UP: upUp = true; yVel = 0; break; case SDLK_DOWN: downUp = true; yVel = 0; break; case SDLK_LEFT: leftUp = true; xVel = 0; break; case SDLK_RIGHT: rightUp = true; xVel = 0; break; case SDLK_w: wUp = true; sAng = 0; break; case SDLK_s: sUp = true; sAng = 0; break; } } //If a mouse button was pressed if( event.type == SDL_MOUSEBUTTONDOWN ) { switch ( event.type ) { case SDL_MOUSEBUTTONDOWN: mouseUp = false; mousex == event.button.x; mousey == event.button.y; break; case SDL_MOUSEBUTTONUP: mouseUp = true; break; } } } And then this is called at the end of my Object::Move call which also handles x and y translation if (!mouseUp) { xVect = mousex - x; yVect = mousey - y; radAng = atan2 ( mousey - y, mousex - x ); sAng = radAng * 180 / 3.1415926l; } Right now when I click the object turns and faces down to the bottom left but then no longer changes direction. I'd really appreciate any help I could get here. I'm guessing there might be an issue here with state versus polled events but from all the tutorials that I've been through I was pretty sure I had fixed that. I've just hit a wall and I need some advice!

    Read the article

  • How to Add Control Panel to “My Computer” in Windows 7 or Vista

    - by The Geek
    Back in the Windows XP days, you could easily add Control Panel to My Computer with a simple checkbox in the folder view settings. Windows 7 and Vista don’t make this quite as easy, but there’s still a way to get it back. To make this tweak, we’ll be doing a quick registry hack, but there’s a downloadable version provided as well. Manual Registry Tweak to Add Control Panel Open up regedit.exe through the start menu search or run box, and then browse down to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace Now that you’re there, you’ll need to right-click and create a new key… If you want to add the regular Control Panel view, with the categories, you’ll need to use one GUID as the name of the key. If you want the icon view instead, you can use the other key. Here they are: Category View:  {26EE0668-A00A-44D7-9371-BEB064C98683} Icon View: {21EC2020-3AEA-1069-A2DD-08002B30309D} Once you’re done, it should look like this: Now over in the Computer view, just hit the F5 key to refresh the panel, and you should see the new icon pop up in the list: Now when you click on the icon you’ll be taken to Control Panel. If you didn’t know how to change the view before, you can use the drop-down box on the right-hand side to switch between Category and icon view. Downloadable Registry Hack Rather than deal with manual registry editing, you can simply download the file, extract it, and then either double-click on the AddCategoryControlPanel.reg to add the Category view icon, or AddIconControlPanel.reg to add the other icon. There’s an uninstall script provided for each. Download ControlPanelMyComputer Registry Hack from howtogeek.com Similar Articles Productive Geek Tips Disable User Account Control (UAC) the Easy Way on Win 7 or VistaHow To Figure Out Your PC’s Host Name From the Command PromptRestore Missing Desktop Icons in Windows 7 or VistaNew Vista Syntax for Opening Control Panel Items from the Command-lineAdd Registry Editor to Control Panel TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Have Fun Editing Photo Editing with Citrify Outlook Connector Upgrade Error Gadfly is a cool Twitter/Silverlight app Enable DreamScene in Windows 7 Microsoft’s “How Do I ?” Videos Home Networks – How do they look like & the problems they cause

    Read the article

  • C99 strict aliasing rules in C++ (GCC)

    - by Checkers
    As far as I understand, GCC supports all of its C99 features in C++. But how is C99 strict aliasing handled in C++ code? I know that casting with C casts between unrelated types is not strict-aliasing-safe and may generate incorrect code, but what about C++? Since strict aliasing is not part of C++ standard (is that correct?), GCC must be specifying the semantics itself. I figure const_cast and static_cast cast between related types, hence they are safe, while reinterpret_cast can break strict aliasing rules. Is this a correct understanding?

    Read the article

  • partially connected application using asp.net 3.5 (not mobile apps)

    - by Hari
    We had a requirement to build a ASP.NET 3.5 web application using web forms, WCF, ADO.NET and SQL Server. The users would connect via Internet. Recently we understood that it is possible that users would often remain disconnected and would have Internet access intermittently. I need to understand if we can create occasionally connected web application using asp.net 3.5 - what all technologies/features we need to use? Is MS Sync Framework the answer to the problem - is it a viable option to use with web application? Is windows application the right approach instead of web applications - where the business logic would be run at the client itself, using local SQL Express editions with data then been synced up with Enterprise SQL server at server end when connection is established using replication and/or MS Sync framework. In that case is there a need to use WCF? Does Silverlight applications help in this context -building paritally connected web apps? Really appreciate if you can give pointers to how to go about this task of creating .net partially connected apps (not mobile apps)?

    Read the article

  • Is there image phase correlation libraries available for Python?

    - by kamasudra
    A project that involves image processing, i.e. to calculate the angular shift of the same image when shifted by a medium of certain Refractive Index. We have to build an app that correlates the 2 images (phase/2D correlation?) and then plot using Chaco and Mayavi (2 libraries in Python). Is there any other existing template software (FOSS) that we can base our app on, or use it as a reference?

    Read the article

  • Matlab - applying low-pass filter to a vector?

    - by waitinforatrain
    If I have a simple low-pass filter, e.g. filt = fir1(20, 0.2); and a matrix with a list of numbers (a signal), e.g. [0.1, -0.2, 0.3, -0.4] etc, how do I actually apply the filter I've created to this signal? Seems like a simple question but I've been stuck for hours. Do I need to manually calculate it from the filter coefficients?

    Read the article

  • what is difference between WSDL and SPML?

    - by mad sammy
    Hi, Can somebody please tell me whether there is any difference between SPML and WSDL? Are they related to each other? I have read things saying that WSDL is generic, used for any service, while SPML is only for provisioning services. I have tried googling for things but I am still not getting what is the exact difference between WSDL and SPML. Thanks..

    Read the article

  • ASP.NET MVC IoC usability

    - by Andrew Florko
    Hello everybody, How often do you use IoC for controllers/DAL in real projects? IoC allows to abstract application from concrete implementation with additional layer of interfaces that should be implemented. But how often concrete implementation changes? Should we really have to do job twice adding method to interface then the implementation if implementation hardly will ever be changed? I took part in about 10 asp.net projects and DAL (ORM-like and not) was never rewritten completely. Watching lots of videos I clearly understand that IoC "is cool" and the really nice way to program, but does it really needed?

    Read the article

  • Why is there a sizeof... operator in C++0x?

    - by Motti
    I saw that @GMan implemented a version of sizeof... for variadic templates which (as far as I can tell) is equivalent to the built in sizeof.... Doesn't this go against the design principle of not adding anything to the core language if it can be implemented as a library function[citation needed]?

    Read the article

  • Create sqlite3 database at prompt

    - by user15432
    I tried using the following commands to create a database file at prompt, but none of them would work. $ sqlite3 test.db sqlite3 test.db test.db does it require a semi-colon at the end or is it that hard to create a database file using sqlite3 prompt?

    Read the article

  • Hibernate saveOrUpdate problem on char data type

    - by Yashwant Chavan
    Hi I am using Hibernate 3.0 , facing issue related to the char datatype field. I am trying to save Client pojo in the database, using following method. Problem is my client_id field is char(10) in the database. when client_id is 10 characters it works fine. but when client_id is less than ten characters it gives problem at the time of update. Rather than updating data it try to insert cleint record again and gives the unquie key exeception. i drill down the problem because of char(10) client_id field. it keeps space after client_id value upto 10 characters. Is there is any confuguration to overcome this problem. rather than modifying client_id to varchar2. public boolean saveClient(Clnt client) { boolean lReturnValue = false; SessionFactory sessionFactory = null; Session session = null; Transaction transaction = null; try { HibernateTemplate hibernateTemplate = getHibernateTemplate(); sessionFactory = hibernateTemplate.getSessionFactory(); session = sessionFactory.getCurrentSession(); transaction = session.beginTransaction(); session.saveOrUpdate(client); transaction.commit(); lReturnValue = true; } catch (HibernateException e) { lReturnValue = false; // TODO Auto-generated catch block if (transaction != null) { transaction.rollback(); } e.printStackTrace(); } return lReturnValue; }

    Read the article

  • Error : while creating a file.

    - by Harikrishna
    I am storing records of datatable to csv file with the help of the following code : // we'll use these to check for rows with nulls var columns = yourTable.Columns .Cast<DataColumn>(); using (var writer = new StreamWriter(yourPath)) { for (int i = 0; i < yourTable.Rows.Count; i++) { DataRow row = yourTable.Rows[i]; // check for any null cells if (columns.Any(column => row.IsNull(column))) continue; string[] textCells = row.ItemArray .Select(cell => cell.ToString()) // may need to pick a text qualifier here .ToArray(); // check for non-null but EMPTY cells if (textCells.Any(text => string.IsNullOrEmpty(text))) continue; writer.WriteLine(string.Join(",", textCells)); } } But I get the error like System.UnauthorizedAccessException was unhandled Message="Access to the path 'D:\\Harikrishna\\Monthly Reports' is denied." What can be the problem and solution ?

    Read the article

  • How to calculate deceleration rate of a flipping coin (in c)?

    - by Horace Ho
    A flipping coin on table will slow down and drop to the table surface, facing up or down. How can I calculate the flip-per-second declaration rate over time? For example, assuming the coin is at 10 flipping per second when it starts how long will it take to stop? For each second (9, 8, 7, 6 ... 3, 2, 1, stop), how is the flipping rate changed? Friction can be approximated as some real world objects (say, a metallic coin on a wooden table). Thanks!

    Read the article

  • Confusion with MIDlet attributes in a JAD file

    - by Mithun
    "MicroEdition-Profile" can have multiple values separated by space in the JAD file, where as "MicroEdtion-Configuration" can have only one value. According to JTWI specifications, Minimum requirement for MIDP is 2.0, so this gives us only one option (MIDP 2.0) to put in the JAD file Minimum requirement for CLDC is 1.0, so this gives us two options to put in the JAD file ie: CLDC1.0 and CLDC2.0 I can create an application which is compatible with CLDC1.0 and 1.1. Why are multiple values allowed for Profile attribute but only one value is allowed for Configuration attribute?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >