Daily Archives

Articles indexed Monday April 26 2010

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

  • Rails: link_to with block and GET params?

    - by bobthabuilda
    How can I achieve query string and URL parameters in a link_to block declaration? Right now, I have this, which works: <%= link_to 'Edit', :edit, :type => 'book', :id => book %> The above works, and outputs: http://localhost:3000/books/edit/1?type=book What I want to do is something like this: <% link_to :edit, :type => 'book', :id => book do %> ... <% end %> But the above format outputs: http://localhost:3000/books/edit/ Which isn't what I'm looking for... I want it to output a URL like the previous example. How can I achieve this?

    Read the article

  • java servlet:response.sendRedirect() not giving illegal state exception if called after commit of re

    - by sahil garg
    after commit of response as here redirect statement should give exception but it is not doing so if this redirect statemnet is in if block.but it does give exception in case it is out of if block.i have shown same statement(with marked stars ) at two places below.can u please tell me reason for it. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub synchronized (noOfRequests) { noOfRequests++; } PrintWriter pw=null; response.setContentType("text/html"); response.setHeader("foo","bar"); //response is commited because of above statement pw=response.getWriter(); pw.print("hello : "+noOfRequests); //if i remove below statement this same statement is present in if block.so statement in if block should also give exception as this one do, but its not doing so.why? ***response.sendRedirect("http://localhost:8625/ServletPrc/login% 20page.html"); if(true) { //same statement as above ***response.sendRedirect("http://localhost:8625/ServletPrc/login%20page.html"); } else{ request.setAttribute("noOfReq", noOfRequests); request.setAttribute("name", new Name().getName()); request.setAttribute("GmailId",this.getServletConfig().getInitParameter("GmailId") ); request.setAttribute("YahooId",this.getServletConfig().getInitParameter("YahooId") ); RequestDispatcher view1=request.getRequestDispatcher("HomePage.jsp"); view1.forward(request, response); } }

    Read the article

  • Read Windows event logs using Enterprise Library

    - by Sathish
    I am using Enterprise library 3.1 to log application logs in Windows event logs, and I want to read this log by passing the date parameter. Please note that I will be accessing the remote machine and the performance should be good. Is there any method that can be used to read these logs using Ent Lib, or please suggest some good method.

    Read the article

  • How to add padding for background image

    - by michael
    Hi, I have a linear layout which has a background image (a 9 patched png file). How can I add padding to left and right so that the background image does not take up the whole width? I have tried 'android:paddingLeft' and 'android:paddingRight', but that does not change anything. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="25dip" android:paddingRight="25dip" android:background="@drawable/background"> The whole background still stretches the whole screen width. Thank you for any help.

    Read the article

  • Update query in sqlite3 problem

    - by user271753
    [sqlite executeQuery:@"UPDATE UserAccess SET Answer ='Positano';"]; NSArray *query2 = [sqlite executeQuery:@"SELECT Answer FROM UserAccess;"]; NSDictionary *dict = [query2 objectAtIndex:0]; NSString *itemValue = [dict objectForKey:@"Answer"]; NSLog(@"%@",itemValue); It does print Positano at this point .. But when I just print without the update query again . I get the old entry which is Paris. What am I doing wrong ??? I am using http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/ wrapper. Regards , Novice

    Read the article

  • Out of memory error

    - by Rahul Varma
    Hi, I am trying to retrieve a list of images and text from a web service. I have first coded to get the images to a list using Simple Adapter. The images are getting displayed the app is showing an error and in the Logcat the following errors occur... 04-26 10:55:39.483: ERROR/dalvikvm-heap(1047): 8850-byte external allocation too large for this process. 04-26 10:55:39.493: ERROR/(1047): VM won't let us allocate 8850 bytes 04-26 10:55:39.563: ERROR/AndroidRuntime(1047): Uncaught handler: thread Thread-96 exiting due to uncaught exception 04-26 10:55:39.573: ERROR/AndroidRuntime(1047): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 04-26 10:55:39.573: ERROR/AndroidRuntime(1047): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 04-26 10:55:39.573: ERROR/AndroidRuntime(1047): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:451) 04-26 10:55:39.573: ERROR/AndroidRuntime(1047): at com.stellent.gorinka.AsyncImageLoaderv.loadImageFromUrl(AsyncImageLoaderv.java:57) 04-26 10:55:39.573: ERROR/AndroidRuntime(1047): at com.stellent.gorinka.AsyncImageLoaderv$2.run(AsyncImageLoaderv.java:41) 04-26 10:55:40.393: ERROR/dalvikvm-heap(1047): 14600-byte external allocation too large for this process. 04-26 10:55:40.403: ERROR/(1047): VM won't let us allocate 14600 bytes 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): Uncaught handler: thread Thread-93 exiting due to uncaught exception 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:451) 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): at com.stellent.gorinka.AsyncImageLoaderv.loadImageFromUrl(AsyncImageLoaderv.java:57) 04-26 10:55:40.493: ERROR/AndroidRuntime(1047): at com.stellent.gorinka.AsyncImageLoaderv$2.run(AsyncImageLoaderv.java:41) 04-26 10:55:40.594: INFO/Process(584): Sending signal. PID: 1047 SIG: 3 Here's the coding in the adapter... final ImageView imageView = (ImageView) rowView.findViewById(R.id.image); AsyncImageLoaderv asyncImageLoader=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoader.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { imageView.setImageBitmap(imageDrawable); } }); imageView.setImageBitmap(cachedImage); .......... ........... ............ //To load the image... public static Bitmap loadImageFromUrl(String url) { InputStream inputStream;Bitmap b; try { inputStream = (InputStream) new URL(url).getContent(); BitmapFactory.Options bpo= new BitmapFactory.Options(); bpo.inSampleSize=2; b=BitmapFactory.decodeStream(inputStream, null,bpo ); return b; } catch (IOException e) { throw new RuntimeException(e); } // return null; } Please tell me how to fix the error....

    Read the article

  • Programmatically forward-lock an Android APK

    - by String
    Doing a bit of advance research, and am stuck on the point summarized in the title. Namely, is there any way to forward-lock an APK installed programmatically, from another app? I've not come across anything beyond a hint in the following post: http://groups.google.com/group/android-developers/msg/e39941389d4a4cf8 I can't see anything in the docs for PackageManager about forward- locking, but I readily confess that this is an unfamiliar area of the SDK for me. [Cross-posted with the Android-Developers Google group]

    Read the article

  • underline text in UIlabel

    - by semix
    How to underline a text that could be multiple lines of string? I find some people suggest UIWebView, but it is obviously too heave a class for just text rendering. My thoughts was to figure out the start point and length of each string in each line. And draw a line under it accordingly. I meet problems at how to figure out the length and start point forthe string. Can anybody help me on this? I try to use UILable::textRectForBounds, this should be the drawing bounding rect for the text right? Then I have to work on the aligment ? How can I get the start point of each line when it is center-justified and right justfied? I am new here, so thank in advance.

    Read the article

  • Printing to Power point

    - by manojpcw
    Hi, Similar to the print to pdf option, where we can choose PDF to be the output format in the print dialog box when printing something from a browser or other applications, I am searching for something which can print to a Power Point file. Is there any such plugin or tool? Also link to a relilable print to pdf tool would be helpful. This essentially would eliminate the export to power point option that the users are asking for in my Silverlight application. Thanks...

    Read the article

  • How to hide graph on button click ?

    - by aman-gupta
    Hi, In my application I m using following codes to draw a graph but I want that graph will be displayed on button click :- import @interface frmGraphView : UIView { } @end ///////////////////// // // frmGraphView.m // UV Alarm // // Created by Aman on 4/4/10. // Copyright 2010 MyCompanyName. All rights reserved. // import "frmGraphView.h" @implementation frmGraphView struct TCo_ordinates { float x; float y; }; (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } /* // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; } */ /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ -(void)drawHGrid { //struct gridForXYaxis *gridForX = (struct gridForX *) calloc(sizeof(struct gridFor)) } (void)drawRect:(CGRect)rect { ifdef _DEBUG NSLog(@"frmGraph_drawRect_start"); endif CGContextRef ctx = UIGraphicsGetCurrentContext(); struct TCo_ordinates *tCoordianates; //creating the object of structure. float fltX1,fltX2,fltY1,fltY2=0; //Dividing the Y-axis ifdef _DEBUG NSLog(@"Start drawing Y-Axis"); endif fltX1 = 25; fltY1 = 2; fltX2 = fltX1; fltY2 = 254; //CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0); CGContextSetLineWidth(ctx, 2.0); CGContextMoveToPoint(ctx, fltX1, fltY1); CGContextAddLineToPoint(ctx, fltX2, fltY2); NSArray *hoursInDays = [[NSArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", nil]; NSMutableArray *yAxisCoordinates = [[[NSMutableArray alloc] init] autorelease]; for(int intIndex = 0 ; intIndex < [hoursInDays count] ; fltY2-=20, intIndex++) { ifdef _DEBUG NSLog(@"Start of the partition of y axis"); endif //CGContextSetRGBStrokeColor(ctx, 2, 2, 2, 1); //CGContextSetRGBStrokeColor(ctx, 1.0f/255.0f, 1.0f/255.0f, 1.0f/255.0f, 1.0f); //to draw the black line. CGContextMoveToPoint(ctx, fltX1-3 , fltY2-20); CGContextAddLineToPoint(ctx, fltX1+3, fltY2-20); CGContextSelectFont(ctx, "Helvetica", 12.0, kCGEncodingMacRoman); CGContextSetTextDrawingMode(ctx, kCGTextFill); //CGContextSetRGBFillColor(ctx, 0, 255, 255, 1); CGContextSetStrokeColorWithColor(ctx, [UIColor blueColor].CGColor); CGAffineTransform xform = CGAffineTransformMake( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0); CGContextSetTextMatrix(ctx, xform); const char *arrayDataForYAxis = [[hoursInDays objectAtIndex:intIndex] UTF8String]; CGContextShowTextAtPoint(ctx,fltX1-20 , fltY2-15, arrayDataForYAxis, strlen(arrayDataForYAxis)); CGContextStrokePath(ctx); ifdef _DEBUG NSLog(@"End of the partition of graph"); endif //NSValue *yAxis = [NSValue valueWithCGPoint:CGPointMake((tCoordianates-x = fltX1-21), (tCoordianates-y = fltY2-20))]; // [yAxisCoordinates addObject:yAxis]; ifdef _DEBUG // NSLog(@"The value of yAxisCoordintes: %@", yAxisCoordinates); endif } ifdef _DEBUG NSLog(@"End of drawing Y-Axis"); endif //Dividing the X-axis ifdef _DEBUG NSLog(@"Start drawing X-Axis"); endif fltX1 = 25; fltY1 = 255; fltX2 = 320; fltY2 = fltY1; CGContextMoveToPoint(ctx, fltX1, fltY1); CGContextAddLineToPoint(ctx, fltX2, fltY2); //CGContextSetRGBStrokeColor(ctx, 2, 2, 2, 1); CGContextSetLineWidth(ctx, 2.0); NSArray *weekDays =[[NSArray alloc] initWithObjects:@"Sun", @"Mon", @"Tue", @"Wed", @"Thu", @"Fri", @"Sat", nil]; NSMutableArray *xAxisCoordinates = [[[NSMutableArray alloc] init] autorelease]; for(int intIndex = 0 ; intIndex < [weekDays count] ; fltX1+=40, intIndex++) { //CGContextSetRGBStrokeColor(ctx, 2, 2, 2, 1); //CGContextSetStrokeColorWithColor(ctx, [UIColor orangeColor].CGColor); CGContextMoveToPoint(ctx, fltX1+40 , fltY2-3); CGContextAddLineToPoint(ctx, fltX1+40, fltY2+3); CGContextSelectFont(ctx, "Italic", 12.0, kCGEncodingMacRoman); CGContextSetTextDrawingMode(ctx, kCGTextFill); CGContextSetStrokeColorWithColor(ctx, [UIColor blueColor].CGColor); CGAffineTransform xform = CGAffineTransformMake( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0); CGContextSetTextMatrix(ctx, xform); const char *arrayDataForXAxis = [[weekDays objectAtIndex:intIndex] UTF8String]; CGContextShowTextAtPoint(ctx, fltX1+27, fltY2+20 , arrayDataForXAxis, strlen(arrayDataForXAxis)); CGContextStrokePath(ctx); ifdef _DEBUG NSLog(@"End of drawing X-Axis"); endif //NSValue *xAxis = [NSValue valueWithCGPoint:CGPointMake((tCoordianates->x = fltX1+40), (tCoordianates->y = fltY2+18))]; // [xAxisCoordinates addObject:xAxis]; ifdef _DEBUG //NSLog(@"The value of xAxisCoordintes: %@", xAxisCoordinates); NSLog(@"frmGraph_drawRect_end"); endif } CGContextSetLineWidth(ctx, 10.0); fltX1 = 25; fltY1 = 235; fltX2 = 320; fltY2 = fltY1; NSArray *coordinate1 = [[NSArray alloc] initWithObjects:@"65",@"105",@"145",@"185",@"225",@"265",@"305",nil]; NSArray *coordinate2 = [[NSArray alloc] initWithObjects:@"214",@"174",@"154",@"134",@"114",@"74",@"34",nil]; ifdef _DEBUG NSLog(@"Fuction of Bar_start"); endif for(int intIndex = 0; intIndex < [coordinate1 count], intIndex < [coordinate2 count]; fltX1+=40, intIndex++) { //CGContextSetRGBFillColor(ctx, 0, 0, 245, 1); CGContextMoveToPoint(ctx, fltX1+40, fltY2+19); const char *arrayDataForCoordinate1 = [[coordinate1 objectAtIndex:intIndex] UTF8String]; const char *arrayDataForCoordinate2 = [[coordinate2 objectAtIndex:intIndex] UTF8String]; CGContextAddLineToPoint(ctx, (atof(arrayDataForCoordinate1)), atof(arrayDataForCoordinate2)); } ifdef _DEBUG NSLog(@"Fuction of Bar_end"); endif CGContextClosePath(ctx); CGContextStrokePath(ctx); [hoursInDays release]; [weekDays release]; [coordinate1 release]; [coordinate2 release]; hoursInDays = nil; weekDays = nil; coordinate1 = nil; coordinate2 = nil; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } (void)dealloc { [super dealloc]; } @end please help me out its urgent

    Read the article

  • Multiple controls with the same ID 'xxx' were found

    - by swapna
    Hi, I have a enterprise application converted from VS2003 to vs2005 . The converted application, in one page i do edit and save i am getting this error. 'Multiple controls with the same ID 'hidWIPID0' were found But the same work fine in the code of vs2003 version without any error. Its a huge application with dynamic master pages and usercontrols etc..So i cant paste the exact code here. But the origin of the error is master page content control. eg: page code MasterPageStrategy:Content id="pnlMain" Error Multiple controls with the same ID 'hidWIPID0' were found View Source MasterPage:pnlMain:_ctl2:hidWIPID0 I Microsoft support there is an article explaining the same issue.But it applies to 1.1 version. I have already converted code in 2.0 version and the error appears in convertd code. http://support.microsoft.com/kb/834608 someone please look into this issue and provide me a solution as it is very urgent. Thanks SNA

    Read the article

  • C++ Questions about vectors

    - by xbonez
    Hey guys, I have a CS exam tomorrow. Just want to get a few questions cleared up. Thanks a lot, and I really appreciate the help. Que 1. What are parallel vectors? Vectors of the same length that contain data that is meant to be processed together Vectors that are all of the same data type Vectors that are of the same length Any vector of data type parallel Que 2. Arrays are faster and more efficient than vectors. True False Que 3. Arrays can be a return type of a function call. True False Que 4. Vectors can be a return type of a function call. True False

    Read the article

  • User authorization in DB2

    - by Daziplqa
    Hi Folks, I am using win Vista, and I am trying to backup some Database under DB2. I am logged in using the Administrator user, and whenever I try to issue the backup command in the "command line processor", I get the following message: SQL1092N "ADMINISTRATOR" does not have the authority to perform the requested command. SQLSTATE=00000 BTW, I have created a username/password pair (db2admin) while installing the DB2 server. So, Will this problem will be get solved if I use the db2admin user? And how to connect to the server (local server BTW) using the db2admin user ?

    Read the article

  • Unable to incorporate Eclispe JDT codeAssist facilities outside a Plug-in

    - by shi kui
    Using Eclipse jdt facilities, you can traverse the AST of java code snippets as follows: ASTParser ASTparser = ASTParser.newParser(AST.JLS3); ASTparser.setSource("package x;class X{}".toCharArray()); ASTparser.createAST(null).accept(...); But when trying to perform code complete & code selection it seems that I have to do it in a plug-in application since I have to write codes like IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(somePath)); ICodeAssist i = JavaCore.createCompilationUnitFrom(f); i.codeComplete/codeSelect(...) Is there anyway that I can finally get a stand-alone java application which incorporates the jdt code complete/select facilities? thx a lot! shi kui

    Read the article

  • setTitle displays black background in Blackberry Bold

    - by SWATI
    hey i have made an application for BlackBerry Curve 8300 where i use setTitle() i have put in an image as background for setTitle() It works perfectly fine on curve simulator but when i deploy this app on bold(device and simulator both) for testing the setTitle() shows black background. i dont have curve device to test n check can any body suggest what could be the problem

    Read the article

  • What development technologies or technology stack is typically used in the security industry?

    - by vfilby
    In this case security means building security (access control, alarm systems, etc). And I am not talking about working directly with the hardware, more focused on web based applications/api's that clients or companies can use? Are there technologies that are commonly used? Are there technologies that shouldn't be used? Are there any real benefits to a linux based stack as opposed to a windows based stack for exposing web based applications?

    Read the article

  • Context migration in CUDA.NET

    - by Vyacheslav
    I'm currently using CUDA.NET library by GASS. I need to initialize cuda arrays (actually cublas vectors, but it doesn't matters) in one CPU thread and use them in other CPU thread. But CUDA context which holding all initialized arrays and loaded functions, can be attached to only one CPU thread. There is mechanism called context migration API to detach context from one thread and attach it to another. But i don't how to properly use it in CUDA.NET. I tried something like this: class Program { private static float[] vector1, vector2; private static CUDA cuda; private static CUBLAS cublas; private static CUdeviceptr ptr; static void Main(string[] args) { cuda = new CUDA(false); cublas = new CUBLAS(cuda); cuda.Init(); cuda.CreateContext(0); AllocateVectors(); cuda.DetachContext(); CUcontext context = cuda.PopCurrentContext(); GetVectorFromDeviceAsync(context); } private static void AllocateVectors() { vector1 = new float[]{1f, 2f, 3f, 4f, 5f}; ptr = cublas.Allocate(vector1.Length, sizeof (float)); cublas.SetVector(vector1, ptr); vector2 = new float[5]; } private static void GetVectorFromDevice(object objContext) { CUcontext localContext = (CUcontext) objContext; cuda.PushCurrentContext(localContext); cuda.AttachContext(localContext); //change vector somehow vector1[0] = -1; //copy changed vector to device cublas.SetVector(vector1, ptr); cublas.GetVector(ptr, vector2); CUDADriver.cuCtxPopCurrent(ref localContext); } private static void GetVectorFromDeviceAsync(CUcontext cUcontext) { Thread thread = new Thread(GetVectorFromDevice); thread.IsBackground = false; thread.Start(cUcontext); } } But execution fails on attempt to copy changed vector to device because context is not attached? Any ideas how i can get it work?

    Read the article

  • Anti-virus for Ubuntu Hardy 8.04

    - by April
    I am using Ubuntu hardy with Scalr and AWS, the Ubuntu instance does not come with any antivirus software. Can anyone recommend a good ant-virus software for Ubuntu? I would also need installation and config steps. Thanks.

    Read the article

  • SSL Not Working on other network

    - by Yan
    Hi I am running windows server 2003 standard and have installed the ssl cert for the company website . Attempting to access the website securely outside of our network the page does not load. Thanks in advance!

    Read the article

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