Daily Archives

Articles indexed Thursday June 17 2010

Page 16/121 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Is it ok to hardcode dynamic links in a permanent view?

    - by meder
    Let's say I wanted to showcase 2-3 clickable buttons on my homepage which will be there permanently. These are links to the css, html, and javascript tag listing pages. Is it fine to just hardcode href=/tags/css and href=/tags/html right in my django templates/view? I won't change them for at least a year or so, meaning I don't think I need to add a column to the tags table to distinguish them - is this common or should I try to make it somewhat dynamic? These tags are in a table but so are 1000 other tags.

    Read the article

  • Objective C code to handle large amount of data processing in iPhone

    - by user167662
    I had the following code that takes in 14 mb or more of image data encoded in base4 string and converts them to jpeg before writing to a file in iphone. It crashes my program giving the following error : Program received signal: “0”. warning: check_safe_call: could not restore current frame I tweak my program and it can process a few more images before the error appear again. My coding is as follows: // parameters is an array where the fourth element contains a list of images in base64 >encoded string NSMutableArray *imageStrList = (NSMutableArray*) [parameters objectAtIndex:5]; while (imageStrList.count != 0) { NSString *imgString = [imageStrList objectAtIndex:0]; // Create a file name using my own Utility class NSString *fileName = [Utility generateFileNName]; NSData *restoredImg = [NSData decodeWebSafeBase64ForString:imgString]; UIImage *img = [UIImage imageWithData: restoredImg]; NSData *imgJPEG = UIImageJPEGRepresentation(img, 0.4f); [imgJPEG writeToFile:fileName atomically:YES]; [imageStrList removeObjectAtIndex:0]; } I tried playing around with UIImageJPEGRepresentation and found out that the lower the value, the more image it can processed but this should not be the way. I am wondering if there is anyway to free up memory of the imageStrList immediately after processing each image so that it can be used by the next one in the line.

    Read the article

  • Overriding rubies spaceship operator <=>

    - by ericsteen1
    I am trying to override rubies <= (spaceship) operator to sort apples and oranges so that apples come first sorted by weight, and oranges second, sorted by sweetness. Like so: module Fruity attr_accessor :weight, :sweetness def <=>(other) # use Array#<=> to compare the attributes [self.weight, self.sweetness] <=> [other.weight, other.sweetness] end include Comparable end class Apple include Fruity def initialize(w) self.weight = w end end class Orange include Fruity def initialize(s) self.sweetness = s end end fruits = [Apple.new(2),Orange.new(4),Apple.new(6),Orange.new(9),Apple.new(1),Orange.new(22)] p fruits #should work? p fruits.sort But this does not work, can someone tell what I am doing wrong here, or a better way to do this?

    Read the article

  • NSString simple pattern matching

    - by SirRatty
    Hi all, Mac OS 10.6, Cocoa project, 10.4 compatibility required. (Please note: my knowledge of regex is quite slight) I need to parse NSStrings, for matching cases where the string contains an embedded tag, where the tag format is: [xxxx] Where xxxx are random characters. e.g. "The quick brown [foxy] fox likes sox". In the above case, I need to grab the string "foxy". (Or nil if no tag is found.) Each string will only have one tag, and the tag can appear anywhere within the string, or may not appear at all. Could someone please help with a way to do that, preferably without having to include another library such as RegexKit. Thank you for any help.

    Read the article

  • apache cxf: multiple endpoint /multipleCXFServlet servlet

    - by robinmag
    Hi, I've a cxf webservice with multiple endpoint. I've succesfully deploy it. The problem is all endpoint's WSDL appear in the same servlet URL. Can i have 2 org.apache.cxf.transport.servlet.CXFServlet servlet in the same web.xml and each servlet serve one endpoint so that i have endpoint1 at http:/locahost/app/endpoint1 and endpoint2 at http:/locahost/app/endpoint2 . Thank you.

    Read the article

  • Single-Page Web Apps: Client-side datastores & server persistence

    - by fig-gnuton
    How should client-side datastores & persistence be handled in a single-page web application? Global vars vs. DI/IoC: Should datastores be assigned to global variables so any part of the application can access them? Or should they be dependency injected where required? Server persistence: Assuming a datastore's data needn't always be persisted to the server immediately, should the datastore itself handle persistence? If not, then what class should handle persistence and how should the persistence class fit into the client-side architecture overall? Is the datastore considered the model in MVC, or is it something else since it just stores raw data?

    Read the article

  • Windows Network Programming

    - by bdhar
    I am planning to get some good book for Windows Socket Programming in VC++. I have 2+ years of experience in working with VC++/ATL/COM/MFC; but not in the networking domain. I have been doing some search in Google for "Windows network programming" books. There are few but they have both good and bad comments scattered all over; and I am not able to decide anything. Please recommend some good book with Pros and Cons. The books I found are below. Windows Sockets Network programming Network Programming for Microsoft Windows Thanks.

    Read the article

  • Opening of files referred to in the aspx file in Visual Studio

    - by Harihara Vinayakaram
    Hi I am a new entrant in the .NET world . I am using Visual Studio 2008 . I have the following code <%@ MasterType VirtualPath="~/Themes/xyz/Common/splash.Master" %> <%@ Reference VirtualPath="~/Themes/abc/Common/master.Master" %> <%@ Import Namespace="MyServer.Components" %> <%@ Import Namespace="MyServer.Discussions.Components" %> <%@ Register TagPrefix="ATE" TagName="AskTheExpert" Src="~/Themes/xyz/Controls/AskTheExpert/AskTheExpert.ascx" %> I have the following questions : Is it possible to open the splash,Master , master.Master , AskTheExpert.ascx In the java world I can do a Ctrl+ click in IntelliJ to open the file . Is there a similar facility in VS Thanks Hari

    Read the article

  • Open GL ES 2.0 co-ordinate systems

    - by Chris
    Hi, I want to use Open GL ES 2.0 for a new game, but I have two questions. Q: The first is how do I set up perspective views in Open GL ES 2.0 - do I need to include Open GL ES 1.0 and use glOrtho, or is there a new way? Q: I want to use the 4th quadrant of a Cartesian co-ordinate system for my game and not use -0.5 to +0.5 for values on screen, how once the first question is answered can I achieve this? Other resources: http://iphonedevelopment.blogspot.com/2009/04/opengl-es-from-ground-up-part-3.html Thanks Chris

    Read the article

  • How do I initialize attributes when I instantiate objects in Rails?

    - by nfm
    Clients have many Invoices. Invoices have a number attribute that I want to initialize by incrementing the client's previous invoice number. For example: @client = Client.find(1) @client.last_invoice_number > 14 @invoice = @client.invoices.build @invoice.number > 15 I want to get this functionality into my Invoice model, but I'm not sure how to. Here's what I'm imagining the code to be like: class Invoice < ActiveRecord::Base ... def initialize(attributes = {}) client = Client.find(attributes[:client_id]) attributes[:number] = client.last_invoice_number + 1 client.update_attributes(:last_invoice_number => client.last_invoice_number + 1) end end However, attributes[:client_id] isn't set when I call @client.invoices.build. How and when is the invoice's client_id initialized, and when can I use it to initialize the invoice's number? Can I get this logic into the model, or will I have to put it in the controller?

    Read the article

  • Maximizing Adobe Air windows on multiple monitors

    - by Andrew
    In an Adobe Air AJAX application with multiple windows running on a system with multiple (three or more) monitors, can you maximize the windows in each monitor? I've seen posts by others trying to do this, but I've not seen anyone saying how it worked out. I basically need to build a 'status monitor' system (similar to, say, an airport departures monitor) in which there are public-facing displays that need to look and feel like single-purpose, embedded applications -- no window chrome and no visible desktop. I don't think this should be any different from any other windows application, but I don't know about Air. I have a dual-monitor Mac setup right now, but I can't easily test Windows and I likely will never be able to test three monitors at once. This application will be run as an AJAX Air application written in Aptana (or DW if it makes a difference).

    Read the article

  • How long would this file transfer take?

    - by CT
    I have 12 hours to backup 2 TB of data. I would like to backup to a network share to a computer using consumer WD 2TB Black 7200rpm hard drives. Gigabit Ethernet. What other variables would I need to consider to see if this is feasible? How would I set up this calculation?

    Read the article

  • mysql left outer join

    - by tirso
    hi to all I have two tables employee and timecard, employee table has fields employee_id,firstname,middlename,lastname and timecard table has fields employee_id,time-in,time-out,tc_date_transaction. I want to select all employee records which have the same employee_id with timecard and date is equal with the current date. If there are no records equal with the current date then return also the records of employee even without time-in,timeout and tc_date_transaction. I have query like this SELECT * FROM employee LEFT OUTER JOIN timecard ON employee.employee_id = timecard.employee_id WHERE tc_date_transaction = "17/06/2010"; result should like this: employee_id,firstname, middlename, lastname,time-in,time-out,tc_date_transaction 1,john,t,cruz,08:00,05:00,17/06/2010 2,mary,j,von,null,null,null any help would greatly appreciated Thanks in advance

    Read the article

  • How to get the title and subtitle for a pin when we are implementing the MKAnnotation?

    - by wolverine
    I have implemented the MKAnnotation as below. I will put a lot of pins and the information for each of those pins are stored in an array. Each member of this array is an object whose properties will give the values for the title and subtitle of the pin. Each object corresponds to a pin. But how can I display these values for the pin when I click a pin?? @interface UserAnnotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *title; NSString *subtitle; NSString *city; NSString *province; } @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, retain) NSString *title; @property (nonatomic, retain) NSString *subtitle; @property (nonatomic, retain) NSString *city; @property (nonatomic, retain) NSString *province; -(id)initWithCoordinate:(CLLocationCoordinate2D)c; And .m is @implementation UserAnnotation @synthesize coordinate, title, subtitle, city, province; - (NSString *)title { return title; } - (NSString *)subtitle { return subtitle; } - (NSString *)city { return city; } - (NSString *)province { return province; } -(id)initWithCoordinate:(CLLocationCoordinate2D)c { coordinate=c; NSLog(@"%f,%f",c.latitude,c.longitude); return self; } @end

    Read the article

  • Login screen delay in CentOS 5.4 x64

    - by user208728
    I was happily running my CentOS 5.4 before something bad happened that somehow corrupted the 'nautilus' package. It stopped me from using the default Gnome Desktop. Then I installed (using yum) the KDE and nautilus later on. Now, KDE is running perfectly with one exception that it takes around 10 minutes before showing up the Login Screen and only a blue screen with mouse pointer keeps showing during those 10 minutes. Thanks in Anticipation. Regards, Talal

    Read the article

  • IE ignores added onclick attribute

    - by user357034
    The Jquery code below works ok with firefox, Safari, Opera but not with IE. I kinda know why this isn't working in IE after reading a lot about it but I do not know how to fix it. My understanding (I think) is that this method will assign a attribute of "onclick" in IE rather than an event method. Therefore it will not fire in IE and the href fires instead which in this case is "#" which is exactly what is happening. What is the correct way of adding the onclick event. <a id="product_photo_zoom_url" href="/PhotoGallery.asp?ProductCode=9857%2D116%2D003" title="9857-116-003 Ignition box"><img id="product_photo" src="/v/vspfiles/photos/9857-116-003-2T.jpg" border="0" alt="9857-116-003 Ignition box" /></a> <br /><a id="product_photo_zoom_url2" href="/PhotoGallery.asp?ProductCode=9857%2D116%2D003" title="9857-116-003 Ignition box"> <img src="/v/vspfiles/templates/100/images/buttons/btn_largerphoto.gif" border="0"></a> var global_URL_Encode_Current_ProductCode; var global_Config_ProductPhotosFolder; var global_Current_ProductCode; var titleattr = $("a#product_photo_zoom_url").attr("title"); var picurl='tb_show(titleattr, \'/PhotoDetails.asp?ShowDESC=N&ProductCode=\' + global_URL_Encode_Current_ProductCode + \'&TB_iframe=true&height=600&width=520\');return false;' $("a#product_photo_zoom_url").attr('onclick', picurl); $("a#product_photo_zoom_url").attr('href', '#'); $("a#product_photo_zoom_url2").attr('onclick', picurl); $("a#product_photo_zoom_url2").attr('href', '#');

    Read the article

  • Objective-C ref count and autorelease

    - by turbovince
    Hey guys, suppose the following code: int main (int argc, const char * argv[]) { //[...] Rectangle* myRect = [[Rectangle alloc] init]; Vector2* newOrigin = [[[Vector2 alloc] init] autorelease]; // ref count 1 [newOrigin setX: 50.0f]; [myRect setOrigin: newOrigin]; // ref count 2 [myRect.origin setXY: 25.0f :100.0f]; // ref count goes to 3... why ? [myRect release]; [pool drain]; return 0; } Rectangle's origin is declared as a (retain) synthesized property. Just wondering 2 things: Why does ref count goes to 3 when using the getter accessor of Rectangle's origin? Am I doing something wrong ? With a ref count of 3, I don't understand how this snippet of code cannot leak. Calling release on myRect will make it go down to 2 since I call release on the origin in dealloc(). But then, when does autorelease take effect? Thanks!

    Read the article

  • Using Alarmmanager to start a service at specific time

    - by Javadid
    Hi friends, I have searched a lot of places but couldnt find a clean sequential explanation of how to start a service (or if thats not possible then an activity) at a specific time daily using the AlarmManager?? I want to register several such alarms and triggering them should result in a service to be started. I'll be having a small piece of code in the service which can then execute and i can finish the service for good.... Calendar cal = Calendar.getInstance(); Calendar cur_cal = Calendar.getInstance(); cur_cal.setTimeInMillis(System.currentTimeMillis()); Date date = new Date(cur_cal.get(Calendar.YEAR), cur_cal.get(Calendar.MONTH), cur_cal.get(Calendar.DATE), 16, 45); cal.setTime(date); Intent intent = new Intent(ProfileList.this, ActivateOnTime.class); intent.putExtra("profile_id", 2); PendingIntent pintent = PendingIntent.getService(ProfileList.this, 0, intent, 0); AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE); alarm.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pintent); System.out.println("The alarm set!!"); i tried this code to activate the alarm at 4.45... but its not firing the service... do i have to keep the process running?? M i doing anything wrong??? One more thing, my service gets perfectly executed in case i use the following code: long firstTime = SystemClock.elapsedRealtime(); alarm.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, 30*1000,pintent);

    Read the article

  • strenge exception phenomenon in win7

    - by Level 2
    Hello all, I spot some interesting artcles about exception handle in codeproject http://www.codeproject.com/KB/cpp/seexception.aspx after reading, I decided to do some experiment. The first time I try to excute the following code char *p; p[0] = 0; The program died without question. But After serveral time I execute the same problem binary code. It magically did fine. even the following code is doing well. any clue or explain? char *p p[1000] = 'd'; cout<<p[1000]<<endl; my os is windows 7 64bit and compiler is vs2008 rc1.

    Read the article

  • How can I access this nested array within my JSON object?

    - by Charles
    I'm using PHP to return a json_encode()'d array for use in my Javascript code. It's being returned as: {"parent1[]":["child1","child2","child2"],"parent2[]":["child1"]} By using the following code, I am able to access parent2 > child1 $.getJSON('myfile.php', function(data) { for (var key in data) { alert(data[key]); } } However, this doesn't give me access to child1, child2, child, of parent1. Alerting the key by itself shows 'parent1' but when I try to alert it's contents, I get undefined. I figured it would give me an object/array? How do I access the children of parent1? data[key][0] ?

    Read the article

  • Haskell Write Computation result to file

    - by peterwkc
    Hello to all, i have function which create a tuple after computation but i would like to write it to file. I know how to write file using writeFile but did not know how to combine computation and monads IO together in the type signature This is my code. invest :: ([Char]->Int->Int->([Char], Int) ) -> [Char]->Int->Int->([Char], Int) invest myinvest x y = myinvest x y myinvest :: [Char]->Int->Int->([Char], Int) myinvest w x y | y > 0 = (w, x + y) | otherwise = error "Invest amount must greater than zero" where I have a function which computes the maximum value from list but i want to these function receive input from file then perform the computation of maximum value. maximuminvest :: (Ord a) => [a] -> a maximuminvest [] = error "Empty Invest Amount List" maximuminvest [x] = x maximuminvest (x:xs) | x > maxTail = x | otherwise = maxTail where maxTail = maximuminvest xs Please help. Thanks.

    Read the article

  • Error with Drools .brl to .drl rule conversion - Adding dynamic rules

    - by jillika iyer
    Hi, I want to add rules dynamically in drools. What is the main plus point of using KNowledge builder?? Or is it better to just list the Files in the rules directory and add it to my program?? But in this case when I convert from a .brl to .drl file at runtime - my new created .drl is not detected. How can I update the new rule and add it at runtime?? Please help. Thank you J

    Read the article

  • How to resolve warning about does not implement the 'UIActionSheetDelegate' protocol

    - by RAGOpoR
    here is my .h code @interface ROSettingViewController : UITableViewController { UISwitch *switchCtl; UISwitch *switchCtl1; NSArray *dataSourceArray; } @property (nonatomic, retain, readonly) UISwitch *switchCtl; @property (nonatomic, retain, readonly) UISwitch *switchCtl1; @property (nonatomic, retain) NSArray *dataSourceArray; - (void)dialogOKCancelAction; - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex; @end /Users/ragopor/Desktop/Power Spot beta 2/code/Classes/ROSettingViewController.m:321: warning: class 'ROSettingViewController' does not implement the 'UIActionSheetDelegate' protocol

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >