Search Results

Search found 2046 results on 82 pages for 'sam dark'.

Page 38/82 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • rails, rest, render different action with responds to

    - by Sam
    Maybe my logic is not restful or know if this is how you would do it but this is what I am trying to do. I'm getting a category inside a category controller and then once I get that category I want to return to an index page in a different controller but keep that @category and the Category.busineses. Before rest I would have just done this: render :controller = "businesses" and it would have rendered the view of the index action in that controller. now in my respond_to block I have this format.html {redirect_to(business_path)} # index.html.erb format.xml { render :xml => @businesses } but of course with a render it looses the instance variable and starts with a new action. So what I want to do is render the action instead of redirecting to that action. is this possible?

    Read the article

  • Sign in as different user when using Integrated Windows Authentication

    - by Sam
    I have restricted access to a site by using Integrated Windows Authentication and turning off anonymous access. This way I can then show them their real name (from looking up on Active Directory and using the server variable LOGON_USER) and do other related Active Directory tasks. How can I then prompt again for their user credentials, through a 'sign in as other user' link , showing the browser prompt (like you would get on a browser like Chrome or Firefox, or if the site was not in the 'Intranet' zone in IE) rather than a Web Form? Since SharePoint offers this functionality, I assume there is a way to do this through code, but I don't know what code can do this (using C#). I can send a 401 header which makes the prompt appear, but how do you then confirm if they are logged in?

    Read the article

  • Copying Data to a Master sheet from other sheets without duplicates

    - by sam
    I have four workbooks, three of which are for data entries, and the latter which hosts all data entered in the other workbooks; as a matter of fact, it serves as a master workbook. I need code to copy data entered in each workbook in sheet 1 to be copied to the next available row on sheet 1 of the master workbook, but if the data to be copied from these individual workbooks are duplicates, then a message box should pop up displaying that its a duplicate. To be precise, I want the users to type p in column j indicating process, and click a button in the spreadsheet to copy the data to the master sheet. I would be glad for any assistance. Thanks a million for any help.

    Read the article

  • PHP Thumbnail Image Resizing with proportions

    - by Sam
    Hi all. As a brief run down, I am currently making a dating type site. Users can create accounts and upload profile pictures (up to 8). In order to display these in the browse area of the website, I am looking for a way in PHP (with third party processor/scripts) to resize all images uploaded to have thumbnails that adhere to certain dimensions. As an example, I will want "profile" images (thumbnails) to be NO larger than 120*150px. The scripting needs to resize uploaded images (regardless of whether they are portrait or landscape, and regardless of proportions) to adhere to these dimensions without getting stretched. The width (eg. 120pixels) should always remain the same, but the height (eg. 150px) can vary in order to keep the image in proportion. If it's a landscape photo, I'm assuming the script would need to take a chunk out of the middle of the image? The reason that all images to be resized is so that when profiles are display in a grid that all thumbnails are roughly the same size. Any input would be greatly appreciated.

    Read the article

  • Where to put constants in Rails

    - by Sam
    I have a few constants which are arrays that I don't want to create db's for but I don't know where to store the constants without getting errors. For example CONTAINER_SIZES = [["20 foot"],["40 foot"]] Where can I store this so all models and controller have access to this?

    Read the article

  • Email from an app, but not use a a pop up controller, just text inside a text box.

    - by Sam Jarman
    Hey is there any way to send whats in a text view (im trying to make a suggestion box) to my email address? example user types in the box " I think you should add twitter support" then that is sent in the background to my email address [email protected] then a message is popped up on the screen saying "suggestion sent" just an example of what i mean Any ideas, tutorial links would be greatly appreciated guys Thanks

    Read the article

  • how to save sitecore webpage in html file on local disk or server

    - by Sam
    WebRequest mywebReq ; WebResponse mywebResp ; StreamReader sr ; string strHTML ; StreamWriter sw; mywebReq = WebRequest.Create("http://domain/sitecore/content/test/page10.aspx"); mywebResp = mywebReq.GetResponse(); sr = new StreamReader(mywebResp.GetResponseStream()); strHTML = sr.ReadToEnd(); sw = File.CreateText(Server.MapPath("hello.html")); sw.WriteLine(strHTML); sw.Close(); Hi , I want to save sitecore .aspx page into html file on local disk , but i am getting exception. But if i use any other webpage example(google.com) it works fine. The exception : System.Net.WebException was caught HResult=-2146233079 Message=The remote server returned an error: (404) Not Found. Source=System StackTrace: at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName) at BlueDiamond.addmodule.btnSubmit(Object sender, EventArgs e) in c:\inetpub\wwwroot\STGLocal\Website\addmodule.aspx.cs:line 97 InnerException: Any help. Thanks in advance

    Read the article

  • c# xml string special characters

    - by sam
    Please help explain why the dataset cannot read the encoded xml? string xml = "<?xml version=\"1.0\" standalone=\"yes\" ?> <DataSet><node>it's my \"node\" & i like it</node></DataSet>"; string encodedXml = System.Security.SecurityElement.Escape(xml); DataSet ds = new DataSet(); ds.ReadXml(New XmlTextReader(new StringReader(encodedXml))); I have checked the link http://weblogs.sqlteam.com/mladenp/archive/2008/10/21/Different-ways-how-to-escape-an-XML-string-in-C.aspx What i want to do is to read a string with special characters into a dataset. But the code cannot locate the special characters in the string, c# added all the \ so the linenumber is not accurate generated by XmlException object. Anyone could provide the code to read a string with special characters into a dataset. thanks very much

    Read the article

  • msysGit: Why does git log output blank lines?

    - by Sam
    It appears to insert less blank lines the closer I type the command to the bottom of the terminal window. If I type it at the top of the terminal window, it inserts nearly a full window height of blank lines; if I type it at the very bottom, no blank lines are inserted. It seems like the pager program is pushing output to the bottom of the terminal window, but I want the output to be right below my command or at the top, like in Linux git. I can get expected behavior by using git --no-pager log, but what if I want to use a pager?

    Read the article

  • Points in CSS specificity

    - by Sam
    Researching specificity I stumbled upon this blog - http://www.htmldog.com/guides/cssadvanced/specificity/ It states that specificity is a point-scoring system for CSS. It tells us that elements are worth 1 point, classes are worth 10 points and IDs are worth 100 points. It also goes on top say that these points are totaled and the overall amount is that selector's specificity. For example: body = 1 point body .wrapper = 11 points body .wrapper #container = 111 points So, using these points surely the following CSS and HTML will result in the text being blue: CSS: #a { color: red; } .a .b .c .d .e .f .g .h .i .j .k .l .m .n .o { color: blue; } HTML: <div class="a"> <div class="b"> <div class="c"> <div class="d"> <div class="e"> <div class="f"> <div class="g"> <div class="h"> <div class="i"> <div class="j"> <div class="k"> <div class="l"> <div class="m"> <div class="n"> <div class="o" id="a"> This should be blue. </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> RESULT: http://jsfiddle.net/hkqCF/ Why is the text red when 15 classes would equal 150 points compared to 1 ID which equals 100 points?

    Read the article

  • How can I overlay images over one another in Java?

    - by Sam
    So I have been posting all over and have yet to get a solid answer: I have created an image resizing class, with a crop method. The cropping works great. The issue that I am having is the background color that I specify in the drawImage function of Graphics is not working correctly. It defaults to black as the background regardless of what I supply (in this case Color.WHITE). Also, the overlaying image or top most image (comes from a file) is being inverted (I think it is) or otherwise discolored. Just so you can conceptualize this a little bit better, I am taking a jpeg and overlaying it on top of a new BufferedImage, the new buffered image's background is not being set. Here is the code below that I am working with: public void Crop(int Height, int Width, int SourceX, int SourceY) throws Exception { //output height and width int OutputWidth = this.OutputImage.getWidth(); int OutputHeight = this.OutputImage.getHeight(); //create output streams ByteArrayOutputStream MyByteArrayOutputStream = new ByteArrayOutputStream(); MemoryCacheImageOutputStream MyMemoryCacheImageOutputStream = new MemoryCacheImageOutputStream(MyByteArrayOutputStream); //Create a new BufferedImage BufferedImage NewImage = new BufferedImage(Width, Height, BufferedImage.TYPE_INT_RGB); Graphics MyGraphics = NewImage.createGraphics(); MyGraphics.drawImage(this.OutputImage, -SourceX, -SourceY, OutputWidth, OutputHeight, Color.WHITE, null); // Get Writer and set compression Iterator MyIterator = ImageIO.getImageWritersByFormatName("png"); if (MyIterator.hasNext()) { //get image writer ImageWriter MyImageWriter = (ImageWriter)MyIterator.next(); //get params ImageWriteParam MyImageWriteParam = MyImageWriter.getDefaultWriteParam(); //set outputstream MyImageWriter.setOutput(MyMemoryCacheImageOutputStream); //create new ioimage IIOImage MyIIOImage = new IIOImage(NewImage, null, null); //write new image MyImageWriter.write(null, MyIIOImage, MyImageWriteParam); } //convert output stream back to inputstream ByteArrayInputStream MyByteArrayInputStream = new ByteArrayInputStream(MyByteArrayOutputStream.toByteArray()); MemoryCacheImageInputStream MyMemoryCacheImageInputStream = new MemoryCacheImageInputStream(MyByteArrayInputStream); //resassign as a buffered image this.OutputImage = ImageIO.read(MyMemoryCacheImageInputStream); }

    Read the article

  • How to increment counters based on a printed array

    - by Sam Liew
    I managed to developed a simple board of 5x5 using random numbers and array. Big achievement for someone like me! :) Now I have to increment the counters depending on the frequency of the numbers. If the value within 0-49 is printed..then nCounter++ If the value within 50-75 is printed..then pCounter++ something like that. The problem is that I don't know how to increase the counters based on the printed board. Here is the code: #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { //Initialize Variables int randomNumber; int rows; int columns; int hdCounter =0; int hCounter = 0; int cCounter = 0; int pCounter = 0; int nCounter = 0; //Declare board size int board[5][5]; //size of board is 5 x 5 //Create the random number generator seed srand(time(NULL)); //Assign the random numbers from 1 - 25 into variable randomNumber //Create the rows for the board for ( rows = 1; rows <= 5 ; rows++ ) { //Create the colimns for the board for ( columns = 1; columns <= 5 ; columns++ ) { //Assign variable randomNumber into variable board randomNumber = rand() %100 + 1; board[rows][columns] = randomNumber; //print the board printf("%d\t", board[rows][columns]); //calculate the frequency of numbers on the printed board if (randomNumber >= 85 && randomNumber <= 100 ) hdCounter++; else if ( randomNumber >= 75 ) hCounter++; else if ( randomNumber >= 65 ) cCounter++; else if ( randomNumber >= 50 ) pCounter++; else if ( randomNumber >= 1 ) nCounter++; else continue; } //Newline after the end of 5th column. printf("\n\n"); } printf( "N \t P \t C \t H \t HD\n\n" ); printf("%d \t %d \t %d \t %d \t %d \t", nCounter, pCounter, cCounter, hCounter, hdCounter); }//end main I tried replacing randomNumber in the if-statement with board[rows][columns] but I seem to get the same undesired results.

    Read the article

  • Rails form with a better URL

    - by Sam
    Wow, switching to REST is a different paradigm for sure and is mainly a headache right now. view <% form_tag (businesses_path, :method => "get") do %> <%= select_tag :business_category_id, options_for_select(@business_categories.collect {|bc| [bc.name, bc.id ]}.insert(0, ["All Containers", 0]), which_business_category(@business_category) ), { :onchange => "this.form.submit();"} %> <% end %> controller def index @business_categories = BusinessCategory.find(:all) if params[:business_category_id].to_i != 0 @business_category = BusinessCategory.find(params[:business_category_id]) @businesses = @business_category.businesses else @businesses = Business.all end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @businesses } end end routes map.resources What I want to to is get a better URL than what this form is presenting which is the following: http://localhost:3000/businesses?business_category_id=1 Without REST I would have do something like http://localhost:3000/business/view/bbq bbq as permalink or I would have done http://localhost:300/business_categories/view/bbq and get the business that are associated with the category but I don't really know the best way of doing this. So the two questions are what is the best logic of finding a business by its categories using the latter form and number two how to get that in a pretty URL all through RESTful routes in Rails.

    Read the article

  • Facebook Connect for iPhone persistant login

    - by Sam
    Hi, I have implemented Facebook Connect in my iPhone project and it is working great. The only problem I have is that every time the user closes the app, the next time they load it they have to re-enter their username and password to login even if the 'keep me logged in' box is checked. My question is is there a way to save the user's session so next time the app is launched they are automatically logged into Facebook Connect without any prompts? Thanks!

    Read the article

  • check property existence

    - by sam
    hello folks., in umbraco, is it possible to check if certain property exist for particular node ? for example, i am having 5 nodes and i am having media picker property for first node alone.. i need to check all the nodes whether media picker property is available for nodes or not? thank you

    Read the article

  • Expression.Call() to String.Equals() throws error

    - by Sam
    The following code: var constant = Expression.Constant("find me", typeof(string)); // memberExpression evaluates to a string var predicate = Expression.Call(memberExpression, "Equals", null, constant); is throwing the error More than one method 'Equals' on type 'System.String' is compatible with the supplied arguments. I'm guessing that's because there's Equals(Object) and Equals(String) - is there any way for me to specify which method I mean to use via the overload of Expression.Call() that takes an instance method name as a string? Or do I have to make a special case for calls to Equals() to take a MethodInfo instead?

    Read the article

  • How to interpolate in MatLab

    - by G Sam
    I have a 1x1 Matrix of points which specifies speed of a drive with respect to time. This speed changes throughout the operation; which means that the difference between two points is changing. To give you an example: M = [1; 2; 3; 5; 7; 9; 11; 15; 19]. (Only that this is a 892x1 matrix) I want to make this matrix twice as long (so changing the relative speed per timestep), while retaining the way the speeds change. Eg: M' = [1; 1.5; 2; 2.5; 3; 4; 5; 6; 7; 8; 9; 10; 11; 13; 15; 17; 19]. Is there an easy way to do this in MatLab? So far I have tried upsampling (which fills the time step with zeros); interp (which fills it with low-pass interpolation. Thanks!

    Read the article

  • Strange Behaviour in Swift: constant defined with LET but behaving like a variable defined with VAR

    - by Sam
    Stuck on the below for a day! Any insight would be greatly appreciated. The constant in the first block match0 behaves as expected. The constant defined in the second block does not behave as nicely in the face of a change to its "source": var str = "+y+z*1.0*sum(A1:A3)" if let range0 = str.rangeOfString("^\\+|^\\-|^\\*|^\\/", options: NSStringCompareOptions.RegularExpressionSearch){ let match0 = str[range0] println(match0) //yields "+" - as expexted str.removeRange(range0) println(match0) //yields "+" - as expected str.removeRange(range0) println(match0) //yields "+" - as expected } if let range1 = str.rangeOfString("^\\+|^\\-|^\\*|^\\/", options: NSStringCompareOptions.RegularExpressionSearch){ let match1 = str[range1] println(match1) //yields "+" as expected str.removeRange(range1) println(match1) //!@#$ OMG!!!!!!!!!!! a constant variable has changed! This prints "z" } The following are the options I can see: match1 has somehow obtained a reference to its source instead of being copied by value [Problem: Strings are value types in Swift] match1 has somehow obtained a closure to its source instead of just being a normal constant/variable? [Problem: sounds like science fiction & then why does match0 behave so well?] Could there be a bug in the Swift compiler? [Problem: Experience has taught me that this is very very very rarely the solution to your problem...but it is still in beta]

    Read the article

  • How to handle SOAP response in FLEX 3

    - by Sam Rudolph
    SOAP Request<?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:deleteDataView xmlns:ns2="http://ws.$$$$$.@@@@@.####.com/"> <identifier>5</identifier> </ns2:deleteDataView> &lt;/S:Body&gt; </S:Envelope> SOAP Response<?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:deleteDataViewResponse xmlns:ns2="http://ws.$$$$$.@@@@@.####.com/"> <return>ERROR: A bug has been encountered,please try later</return&gt </ns2:deleteDataViewResponse> </S:Body> </S:Envelope> I want to read SOAP response in flex,am some what new to FLEX,pls help,even good resources will work.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >