Daily Archives

Articles indexed Monday April 12 2010

Page 11/116 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Force maximum width and height for PHPThumb images

    - by Peter
    PHPThumb provides two great variables setting the output maximum width and height BUT "This is always overridden by ?w=_ GETstring parameter" $PHPTHUMB_CONFIG['output_maxwidth'] = 720; $PHPTHUMB_CONFIG['output_maxheight'] = 720; You can also set defaults, and for landscape/portrait: $PHPTHUMB_DEFAULTS['w'] = 720; $PHPTHUMB_DEFAULTS['h'] = 720; $PHPTHUMB_DEFAULTS['hp'] = 720; $PHPTHUMB_DEFAULTS['wl'] = 720; You can set the getsringoverride to enforce the default width/height but then you can't have width/height smaller than the default. $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = false; There doesn't seem to be a way to allow the get paramaters to be used but if entering a value higher than the output_maxwidth/height it outputs that size, not the maximum. How can the output be explicitly restricted to a maximum size, hence protecting the source images?

    Read the article

  • What is it that automatically checks config changes (such as those in /etc) into git?

    - by Brandon
    I remember reading on the ubuntu forums some time ago about a program to automatically check configuration changes into version control for you. It was (of course) not Ubuntu-specific. I'm pretty sure it used git, though it may have been svn, or perhaps even able to work with multiple different VCSs. My Googling has turned up nothing, and I'd rather not roll my own script if someone has already done this well. Of course I could just manually check things in, but there are reasons I'd like it done automatically. (I'm actually planning to use this for my LastSession.plist file for Safari, so when the #@$%^*&! thing crashes, and I don't restore everything, and then Leopard crashes, the fact that it has such lousy session management won't mean I lose the dozens of windows with dozens of tabs I had open.)

    Read the article

  • minimal rsync installation on windows xp?

    - by Aman Jain
    Hi I want to install rsync on windows xp. I have searched the web, but most of the solutions suggest using cygwin, but is there any other way to do this? I don't want to install cygwin because it takes lot of space. Moreover, I need to make it communicate with a rsync daemon on Linux, therefore alternatives to rsync on windows won't help. Thanks

    Read the article

  • Specify additional files to clean when doing a "make clean" with autoconf

    - by vy32
    I am using autoconf. Right now I have an intermediate .cpp file that is generated. I want to have the .cpp file deleted when I do a "make clean". I tried specifying the file in a CONFIG_CLEAN_FILES variable, but that only takes effect when I do a make distlclean. Is there a variable to set to delete the file when I do a make clean? If not, how do I do it? Thanks

    Read the article

  • How do you make an in-place construction of a struct casted to array compile in Visual C++ 2008?

    - by Irwin1138
    I'm working with quite a big codebase which compiles fine in linux but vc++ 2008 spits errors. The problem code goes like this: Declaration: typedef float vec_t; typedef vec_t vec2_t[2]; The codebase is littered with in-place construction like this one: (vec2_t){0, divs} Or more complex: (vec2_t){ 1/(float)Vid_GetScreenW(), 1/(float)Vid_GetScreenH()} As far as I know, this code constructs a struct, then converts it to an array and passes the address to the function. I personally never used in-place construction like this so I have no clue how to make this one work. I don't maintain the linux build, only the windows one. And I can't get it to compile. Is there some switch, some macro to make vc++ compile it? Maybe there is a similar nifty way to construct those arrays and pass them to the functions in-place that compiles just fine in vc++?

    Read the article

  • Server Controls in ASP.NET MVC without ViewState

    - by imran_ku07
      Introduction :           ASP.NET Web Forms provides a development environment just like GUI or windows application and try to hide statelessness nature of HTTP protocol. For accomplishing this target, Web Forms uses ViewState (a hidden field) to remove the gap between HTTP statelessness and GUI applications. But the problem with this technique is that ViewState size which grows quickly and also go back and forth with every request, as a result it will degrade application performance. In this article i will try to use existing ASP.NET server controls without ViewState.   Description :           When you add a server control which needs viewstate, in the presentation view in ASP.NET MVC application without a form tag, for example,            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>            It will shows the following exception,            Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server             When you place this textbox inside a form tag with runat=server, this will add the following ViewState even when you disable ViewState by using EnableViewState="false"            <input type="hidden" value="/wEPDwUJMjgzMDgzOTgzZGQ6u9CwikhHEW39ObrHyLTPFSboPA==" id="__VIEWSTATE" name="__VIEWSTATE"/>             The solution to this problem is to use the RenderControl method of server control which is simply renders HTML without any ViewState hidden field.         <% TextBox txt = new TextBox();          txt.Text = "abc";          StringBuilder sb = new StringBuilder();          System.IO.StringWriter textwriter = new System.IO.StringWriter(sb);          HtmlTextWriter htmlwriter = new HtmlTextWriter(textwriter);          txt.RenderControl(htmlwriter);  %>        <%= sb.ToString() %>             This will render <input type="text" > without any View State. This technique become very useful when you are using rich server controls like GridView. For example, let's say you have List of Recalls in Model.Recalls, then you will show your tabular data as,     <%  GridView gv = new GridView();          gv.AutoGenerateColumns = true;          gv.DataSource = Model.Recalls;          gv.DataBind();         StringBuilder sb = new StringBuilder();         System.IO.StringWriter textwriter = new System.IO.StringWriter(sb);         HtmlTextWriter htmlwriter = new HtmlTextWriter(textwriter);         gv.RenderControl(htmlwriter);%>            <%= sb.ToString() %>             This code might looks odd in your presentation view. A more better approach is to create a HTML Helper method which contains the above code. Summary :        In some cases you might needs to use existing ASP.NET Web Forms server controls but also dislikes ViewState. In this article i try to solve this gap by using the RenderControl method of Control class. Hopefully you enjoyed and become ready to create HTML helpers for many of the existing server controls.

    Read the article

  • minimal rsync installation on windows xp?

    - by Aman Jain
    Hi I want to install rsync on windows xp. I have searched the web, but most of the solutions suggest using cygwin, but is there any other way to do this? I don't want to install cygwin because it takes lot of space. Moreover, I need to make it communicate with a rsync daemon on Linux, therefore alternatives to rsync on windows won't help. Thanks

    Read the article

  • Only allow access of FIle From embed.

    - by KyleT
    Hey All, So I am embedding a PDF file on my page: <embed src="http://www.mywebsite.com/files/ebook.pdf" width="500" height="375"> Is there anyway to prevent any and all access to that file except for when it is being accessed via this embed? Thanks!

    Read the article

  • Creating a Blog ruby on Rails - Problem Deleting Comments

    - by bgadoci
    As I always type I am new to rails and programming in general so go easy. Thanks in advance. I have successfully followed the initial tutorial from Ryan Bates on how to build a weblog in 15 minutes. If you don't know this tutorial takes you through creating posts and allowing for comments on those post. It even introduces AJAX through the creating and displaying comments on the posts show.html.erb page. All works great. Here's the hiccup, when Ryan takes you though this tutorial he clears out the comments_controller and only shows the code for creating comments. I am trying to add back the ability to edit and destroy comments. Can't see to get it to work, keeps deleting the actual post not the comment (log shows that I keep sending DELETE request to PostsController). Here is my code: class CommentsController < ApplicationController def create @post = Post.find(params[:post_id]) @comment = @post.comments.create!(params[:comment]) respond_to do |format| format.html { redirect_to @post } format.js end end def destroy @comment = Comment.find(params[:id]) @comment.destroy respond_to do |format| format.html { redirect_to(posts_url) } format.xml { head :ok } end end end /views/posts/show.html.erb <%= render :partial => @post %> <p> <%= link_to 'Edit', edit_post_path (@post) %> | <%= link_to 'Destroy', @post, :method => :delete, :confirm => "Are you sure?" %> | <%= link_to 'See All Posts', posts_path %> </p> <h2>Comments</h2> <div id="comments"> <%= render :partial => @post.comments %> </div> <% remote_form_for [@post, Comment.new] do |f| %> <p> <%= f.label :body, "New Comment" %><br/> <%= f.text_area :body %> </p> <p> <%= f.submit "Add Comment" %></p> <% end %> /views/comments/_comment.html.erb <% div_for comment do %> <p> <strong>Posted <%= time_ago_in_words(comment.created_at) %> ago </strong><br/> <%= h(comment.body) %><br/> <%= link_to 'Destroy', @comments, :method => :delete, :confirm => "Are you sure?" %> </p> <% end %>

    Read the article

  • extract day from Date

    - by Daniel
    i receive a timestamp from a soap service in miliseconds.. so i do Date date = new Date(mar.getEventDate()); how can i extract the day of the month from date, since getDay() and so are deprecated? im using a small hack, but i dont think this is the proper way.. SimpleDateFormat sdf = new SimpleDateFormat("dd"); int day = Integer.parseInt(sdf.format(date));

    Read the article

  • keep HTMLformat after replace some text (using PHP and JS)

    - by Sadi
    I would like modify HTML like I am <b>Sadi, novice</b> programmer. to I am <b>Sadi, learner</b> programmer. To do it I will search using a string "novice programmer". How can I do it please? Any idea? Thank you Sadi More clarification: I get some nice reply with possible solution. But please keep posting if you have any idea in mind. I would like to more clarify the problem just in case anyone missed it. Main post shows the problem as an example scenario. 1) Now the problem is find and replace some string without considering the tags. The tags may shows up within a single word. String may contain multiple word. Tag only appear in the content string or the document. The search phrase never contain any tags. We can easily remove all tags and do some text operation. But here the another problem shows up. 2) The tags must be preserve, even after replacing the text. That is what the example shows. Thank you Again for helping

    Read the article

  • Programmatically Insert Page Break in Active Report

    - by Kevin Babcock
    I've been scouring the web for a good example, but cannot figure out how to add a page break to an Active Reports report programmatically. The reports I'm working with usually require 1-2 pages for each record. In order to support dual-sided printing of the reports I want to insert a blank page for each record that uses an odd number of pages, ensuring that each new record is printed on the front of each printed page. I'm very new to Active Reports, so any suggestions, code samples, or links are much appreciated!

    Read the article

  • gem install permission problem

    - by qichunren
    qichunren@zhaobak:~ gem install hpricot ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8 directory. current ligin user is qichunren, and qichunre user have write permission with .gem dir.I would like to know why gem not install files into my home .gem dir first?????Why my gem common first want to install files into /opt/ruby-enterprise-1.8.7/lib/ruby/gems/1.8

    Read the article

  • what's the purpose of fcntl with parameter F_DUPFD

    - by Daniel
    I traced an oracle process, and find it first open a file /etc/netconfig as file handle 11, and then duplicate it as 256 by calling fcntl with parameter F_DUPFD, and then close the original file handle 11. Later it read using file handle 256. So what's the point to duplicate the file handle? Why not just work on the original file handle? 12931: 0.0006 open("/etc/netconfig", O_RDONLY|O_LARGEFILE) = 11 12931: 0.0002 fcntl(11, F_DUPFD, 0x00000100) = 256 12931: 0.0001 close(11) = 0 12931: 0.0002 read(256, " # p r a g m a i d e n".., 1024) = 1024 12931: 0.0003 read(256, " t s t p i _ c".., 1024) = 215 12931: 0.0002 read(256, 0x106957054, 1024) = 0 12931: 0.0001 lseek(256, 0, SEEK_SET) = 0 12931: 0.0002 read(256, " # p r a g m a i d e n".., 1024) = 1024 12931: 0.0003 read(256, " t s t p i _ c".., 1024) = 215 12931: 0.0003 read(256, 0x106957054, 1024) = 0 12931: 0.0001 close(256) = 0

    Read the article

  • How can an object not be compared to null?

    - by ProfK
    I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error: Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>. How can I not be allowed to check if an object is null?

    Read the article

  • Should entry level programmers be able to answer FizzBuzz?

    - by Bryan Rowe
    When interviewing entry level developers, I have used the FizzBuzz question as a type of acid test. Generally, I ask for a solution in pseudo-code or any language of their choice. If someone can't answer this question -- or get reasonably close, the interview generally ends shortly thereafter and we don't progress to more interesting code questions. In your opinion, is it fair/appropriate/accurate to filter entry-level staff in this manner? Should the average four year college graduate have a reasonable enough foundation to be able to throw up a pseudo-code solution of FizzBuzz?

    Read the article

  • Calculation with RESTful web service with MySQL database

    - by Dobby
    I am now making some RESTful web services with MySQL database. I used NetBeans to create the resources of RESTful service with MySQL, and now I can now use GET and POST/PUT to list and add/modify data entities in the MySQL server. Currently, I wish to make some calculations right after a client makes the POST activities, then the posted data with calculated results will be inserted into the MySQL database. I am very new to this, I guess I need to add some functions and call them to calculate but I don't know where and how to do that : ( Could any one help me on this issue? Thanks a lot in advance! : )

    Read the article

  • Which hosting will let me execute my own EXE with PHP?

    - by guitar-
    I have a task that PHP (or any server-side scripting language) isn't practical for. It involves a lot of file I/O, processing, etc. and it will execute a lot faster using the program I made in C instead of PHP. Do any hosts allow you to upload your own EXE files and run them on the server using PHP's exec, shell_exec, etc. functions? Do you need a dedicated server to do this? Also, I don't know if Facebook's PHP HipHop is out yet, but I really don't want to use that.

    Read the article

  • Problem when waking the computer from sleep mode.

    - by Octa
    I have a HP Pavilion dv6-2188la and when it wakes from sleep the monitor flashes (screen flickers), and every time it flashes (2 seconds) it returns me to the beginning of the password field making it almost impossible input the password. Does anyone knows what causes this problem?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >