Search Results

Search found 8664 results on 347 pages for 'lost with coding'.

Page 33/347 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • Signed_request lost in ASP.NET session, confusing my website

    - by Csabi
    I have an ASP.NET MVC 3 website which is available both from a specific public url, and I'm also making be available as a Facebook App. Inside my website logic, in some places I have to determine whether the current request is from the Facebook-app, or from the public website, because I want to display content based on this environment. So, for eg. if the user is using my site as a facebook-app, then I want to display a picture, and if the user is using my site normally, then I don't wanna display a picture. To determine whether I'm from a Facebook app, I check the "signed_request" in the HttpContext.Request, and store it in the HttpSession to be available for my other actions, not just for that action (url) which is defined for my Facebook app. So when a child-action is executed, I can determine based on the Session, that the website is used as a FB-app or not. The problem happens, when the Session times out, because then althought the logic is still running inside Facebook, my logic thinks it's not inside Facebook. Any advice?

    Read the article

  • perl: added hash entry in a subroutine is lost

    - by hansi
    Why is the hash empty on the second call of printHash? my %hash = (); addToHash(\%hash); printHash(\%hash); sub addToHash { my %hash = %{$_[0]}; $hash{"test"} = "test"; printHash(\%hash); } sub printHash { print "printHash: \n"; my %hash = %{$_[0]}; foreach my $key (keys %hash) { print "key: $key, value: $hash{$key}\n"; } } Output: printHash: key: test, value: test printHash:

    Read the article

  • issue with vhdl structural coding

    - by user3699982
    The code below is a simple vhdl structural architecture, however, the concurrent assignment to the signal, comb1, is upsetting the simulation with the outputs (tb_lfsr_out) and comb1 becoming undefined. Please, please help, thank you, Louise. library IEEE; use IEEE.STD_LOGIC_1164.all; entity testbench is end testbench; architecture behavioural of testbench is CONSTANT clock_frequency : REAL := 1.0e9; CONSTANT clock_period : REAL := (1.0/clock_frequency)/2.0; signal tb_master_clk, comb1: STD_LOGIC := '0'; signal tb_lfsr_out : std_logic_vector(2 DOWNTO 0) := "111"; component dff port ( q: out STD_LOGIC; d, clk: in STD_LOGIC ); end component; begin -- Clock/Start Conversion Generator tb_master_clk <= (NOT tb_master_clk) AFTER (1 SEC * clock_period); comb1 <= tb_lfsr_out(0) xor tb_lfsr_out(2); dff6: dff port map (tb_lfsr_out(2), tb_lfsr_out(1), tb_master_clk); dff7: dff port map (tb_lfsr_out(1), tb_lfsr_out(0), tb_master_clk); dff8: dff port map (tb_lfsr_out(0), comb1, tb_master_clk); end behavioural;

    Read the article

  • JQuery performance issue (Or just bad CODING!)

    - by ferronrsmith
    function getItemDialogContent(planItemType) { var oDialogContent = $('<div/>').append($('#cardDialogHelper').html()).addClass("card"); if (planItemType) { oDialogContent.find('#cardDialogHeader').addClass(planItemType).find('#dialogTitle').html(planItemType); oDialogContent.find('#cardDialogCustomFields').html($('#' + planItemType + 'DialogFields').html()); if (planItemType == 'announcement' || planItemType == 'question') { oDialogContent.find("#dialogPin").remove(); } } return oDialogContent; } I am doing some code cleanup for a web application I am working on. The above method lags in IE and most of our user base use IE. Can someone help me. I figure the find() method is very expensive because of the DOM traversal and I am thinking of optimizing. Any ideas anyone? Thanks in advance :D Been doing some profiling on the application and the following line seems to be causing alot of problems. help me please. is there any way I can optimize ? $('').append($('#cardDialogHelper').html()).addClass("card"); This is the ajax call that does the work. Is there a way to do some of this after the call. Please help me. (Added some functions I thought would be helpful in the diagnosis) GetAllPlansTemp = function() { $.getJSON("/SAMPLE/GetAllPlanItems",processData); } processData = function(data) { _throbber = showThrobber(); var sortedPlanItems = $(data.d).sort("Sequence", "asc"); // hideThrobber(_throbber); $(sortedPlanItems).each(createCardSkipTimelime); doCardStacks(); doTimelineFormat(); if (boolViewAblePlans == 'false') { $("p").show(); } hideThrobber(_throbber); } function createCardSkipTimelime() { boolViewAblePlans = 'false'; if (this.__Deleted == 'true' || IsPastPlanItem(this)) { return; } boolViewAblePlans = 'true'; fixer += "\n" + this.TempKey; // fixes what looks like a js threading issue. var value = CreatePlanCard2(this, GetPlanCardStackContainer(this.__type)); UpdatePlanCardNoTimeLine(value, this); } function CreatePlanCard2(carddata, sContainer) { var sCardclass = GetPlanCardClass(carddata.__type); var editdialog = getItemDialogContent(sCardclass); return $('<div/>').attr('id', carddata.TempKey).card({ 'container': $(sContainer), 'cardclass': sCardclass, 'editdialog': editdialog, 'readonly': GetCardMode(carddata) }); }

    Read the article

  • Is scala functional programming slower than traditional coding?

    - by Fred Haslam
    In one of my first attempts to create functional code, I ran into a performance issue. I started with a common task - multiply the elements of two arrays and sum up the results: var first:Array[Float] ... var second:Array[Float] ... var sum=0f; for(ix<-0 until first.length) sum += first(ix) * second(ix); Here is how I reformed the work: sum = first.zip(second).map{ case (a,b) => a*b }.reduceLeft(_+_) When I benchmarked the two approaches, the second method takes 40 times as long to complete! Why does the second method take so much longer? How can I reform the work to be both speed efficient and use functional programming style?

    Read the article

  • Enjoy bug fixing more than coding from scratch

    - by kylex
    As I get more and more into my job I've had a lot of opportunity to code new projects from scratch. Almost every programmer I know really appreciates that opportunity. But the further I go into it, the more I enjoy bug fixing. In fact, if I can spend a whole day looking over code, whether it be mine or someone else's code, and find some obscure bug, I feel much more accomplished than when I create code. Does anyone else feel this way, and are there any job advantages to this?

    Read the article

  • How to start coding the "Dining Philosophers" simulation?

    - by GrizzlyGuru
    I'm not a beginner at C# but I really need to increase my understanding, so I've picked a classic deadlock problem to code to help teach myself some of the more advanced concepts of C#. The Dining Philosophers Problem seems like a good one, but I need a little help to get started. I know I need to approach the "diners" as objects, but to simulate the random delays between eating, should I look to threading with each diner in a separate thread? Do I need some kind of "master" to monitor all the actions? Any general design concept advice is welcome, but I'd like to do the grunt programming as an exercise. Thanks!

    Read the article

  • JavaScript Coding for Finding Shipping Total

    - by user2913279
    I am having a very hard time with this code. I have been working on it for days and cannot seem to figure it out. Please help!! Here are the specific I need for the code: Many companies normally charge a shipping and handling charge for purchases. Create a Web page that allows a user to enter a purchase price into a text box and includes a JavaScript function that calculates shipping and handling. Add functionality to the script that adds a minimum shipping and handling charge of $1.50 for any purchase that is less than or equal to $25.00. For any orders over $25.00, add 10% to the total purchase price for shipping and handling, but do not include the $1.50 minimum shipping and handling charge. The formula for calculating a percentage is price * percent / 100. For example, the formula for calculating 10% of a $50.00 purchase price is 50 * 10 / 100, which results in a shipping and handling charge of $5.00. After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box. Here is the code I have: <!DOCTYPE> <head> <title>Calculate Shipping</title> <script type="text/javascript"> function parseInt() { var salesPrice = document.salesForm.Price.value; var minCharge = salesPrice + 1.50; var shipping = salesPrice * 10/100; if (salesPrice <= 25) window.alert('Your sales total including shipping is $' + minCharge); else window.alert('Your sales total including shipping is $' + salesPrice + shipping); } </script> </head> <body> <form name="salesForm"> <div > <p>Enter Your Purchase Price</p> <input type="text" name="Price" /><br /><br /> <input type="button" name="Calculate" value="Calculate Shipping" onclick="parseInt ()" /> </div> </form> </body> </html> Everything works except for the math in the alert box. It will show an incorrect total...

    Read the article

  • Coding the R-ight way - avoiding the for loop

    - by mropa
    I am going through one of my .R files and by cleaning it up a little bit I am trying to get more familiar with writing the code the r-ight way. As a beginner, one of my favorite starting points is to get rid of the for() loops and try to transform the expression into a functional programming form. So here is the scenario: I am assembling a bunch of data.frames into a list for later usage. dataList <- list (dataA, dataB, dataC, dataD, dataE ) Now I like to take a look at each data.frame's column names and substitute certain character strings. Eg I like to substitute each "foo" and "bar" with "baz". At the moment I am getting the job done with a for() loop which looks a bit awkward. colnames(dataList[[1]]) [1] "foo" "code" "lp15" "bar" "lh15" colnames(dataList[[2]]) [1] "a" "code" "lp50" "ls50" "foo" matchVec <- c("foo", "bar") for (i in seq(dataList)) { for (j in seq(matchVec)) { colnames (dataList[[i]])[grep(pattern=matchVec[j], x=colnames (dataList[[i]]))] <- c("baz") } } Since I am working here with a list I thought about the lapply function. My attempts handling the job with the lapply function all seem to look alright but only at first sight. If I write f <- function(i, xList) { gsub(pattern=c("foo"), replacement=c("baz"), x=colnames(xList[[i]])) } lapply(seq(dataList), f, xList=dataList) the last line prints out almost what I am looking for. However, if i take another look at the actual names of the data.frames in dataList: lapply (dataList, colnames) I see that no changes have been made to the initial character strings. So how can I rewrite the for() loop and transform it into a functional programming form? And how do I substitute both strings, "foo" and "bar", in an efficient way? Since the gsub() function takes as its pattern argument only a character vector of length one.

    Read the article

  • Caller property of JS for "foo = function()" style of coding

    - by arvind
    I want to use the property of "caller" for a function which is defined here It works fine for this style of function declaration function g() { alert(g.caller.name) // f } function f() { alert(f.caller.name) // undefined g() } f() JSfiddle for this But then my function declaration is something like g = function() { alert(g.caller.name) // expected f, getting undefined } f = function() { alert("calling f") alert(f.caller.name) // undefined g() } f() and I am getting undefined (basically not getting anything) JSfiddle for this Is there any way that I can use the caller property without having to rewrite my code? Also, I hope I have not made any mistakes in usage and function declaration since I am quite new to using JS.

    Read the article

  • Order of execution and style of coding in Python

    - by Jason
    Hi guys. I am new to Python so please don't flame me if the question is too basic :) I have read that Python is executed from top - to - bottom. If this is the case, why do programs go like this: def func2(): def func1(): #call func2() def func() #call func1() if __name__ == '__main__': call func() So from what I have seen, the main function goes at last and the other functions are stacked on top of it. Am I wrong in saying this? If no, why isn't the main function or the function definitions written from top to bottom?

    Read the article

  • Smart coding on ActionScript 2 (importing vars from a php)

    - by DomingoSL
    Hello, i have a php who when is executed it give me a couple of vars in this format: &lVar1=DATA1&&lVar2=DATA2&&lVar3=DATA3 and soo... The problem is that i dont know the quantity of lVar the php script is gonna give in any time, so i cant figure out a smart script in AS2 to import all of them into a array to my flash. Can you help me?

    Read the article

  • Ajax response seems to be getting lost

    - by Ringo Blancke
    I'm using the ddslick jquery dropdown plugin in conjunction with my Rails app. In view1, I have $('#challenges_dropdown').ddslick({ <snipped> onSelected: function (data) { $.ajax({ url: "/load_data", type: "GET", data: {"id": data.selectedData.value} }); } }); I.e., I make a call to my controller to load_data. The controller receives this correctly and then at the end, makes a call to render a separate view render "data" This view contains a script snippet that needs to run in order to update some elements of my original view. For some reason, this script snippet is just not running. I'm very confused. When I use a regular link with data-remote="true", then the whole process works perfectly. However, when I make an AJAX call, it fails. What's going on?? Thanks! Ringo

    Read the article

  • NoSQL vs Relational Coding Styles

    - by Chris Henry
    When building objects that make use of data stored in a RDBMS, it's normally pretty clear what you're getting back, as dictated by the tables and columns being queried. However, when dealing with NoSQL, document-based systems, it's less clear what is being retrieved. What are common methods of keeping track of structure in which data is stored?

    Read the article

  • HTML Purifier Coding Help?

    - by TaG
    I read the http://htmlpurifier.org/docs/enduser-youtube.html doc, but I still can't figure out where to put the code to allow object, param and embed tags and Use experimental features with my htmlpurifier. Can someone please show me how to do this?

    Read the article

  • WPF inherited UserControl lost VS designer support

    - by PaN1C_Showt1Me
    Hi ! I' written this UserControl: <my:MyUserControl x:Class="MyClass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:my="clr-namespace:MyNameSpace.MyControls;assembly=MyAssembly"> </my:MyUserControl> public partial class Editor : MyNameSpace.MyControls.MyUserControl {} Everything works, the control is shown in the VS 2008 Designer, but I cannot click directly in the elements and select them as it was with UserControl. Any idea how to solve it?

    Read the article

  • Mouse Events lost on zoom in silverlight

    - by Ged
    Hi All, I'm running into an issue where I seem to be losing mouse events. Essentially I have a grid with a bunch of controls that get refreshed (removed/re-added via Grid.Children.Clear and Grid.Children.Add(control) ) via a WCF_Service. If I zoom in to a part of the grid where no control exists, I'm unable to zoom out. I have implemented zoom to mouse position but have logic to ensure the coordinates of the grid are never beyond the window of screen. (Eg: Grid.ActualWidth must be 0 and Translate.X must be < Grid.ActualWidth - 200) I have also experienced this where I can still see a section of one of the controls, but it still is not able to zoom out (unless I'm over the control). Appreciate any and all help.

    Read the article

  • C# ATM Bank coding help needed please

    - by user1735692
    if anyone can help with with I would be grateful. I am trying to make a program in c# that acts like an ATM with withdrawing, depositing money, displayed in Program.cs that is connected to Account.cs linked class programs. At the moment it works if I manually input the data and tell it what to display, but I what to do is - Allow users to enter amounts to deposit and withdraw using overloaded implementations of the methods makeDeposit and makeWithdrawal. I have tried many things, and can not get it to work, if anyone can help, I would be grateful if anyone can, thanks again Program.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Tut9 { class Program { static void Main(string[] args) { Account myAcc = new Account(); myAcc.makeDeposit(10000); myAcc.showBalance(); Console.WriteLine("Attempting to withdraw £" + 90); myAcc.makeWithdrawal(90); myAcc.showBalance(); myAcc.giveOverdraft(50); myAcc.showBalance(); Account student = new Account(30, -100); student.giveOverdraft(-500); } } } Account.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Tut9 { class Account { ////Need to know the balance & ovedraft private int balance; private int overdraft; ////Constructor public Account() { balance = 0; overdraft = 0; } public Account(int initial) { balance = initial; } public Account(int intial, int over) { balance = intial; overdraft = over; } public void giveOverdraft(int amount) { overdraft = amount; } ////Method to display the balance & overdraft public void showBalance() { Console.WriteLine("The balance is now £" + balance); if (overdraft != 0) { Console.WriteLine("You have an overdraft of £" + overdraft); } } ////Method to make a withdrawl public void makeWithdrawal(int y) { balance = balance - y; Console.WriteLine("Withdrew £" + y); } ////Method to make deposit public void makeDeposit(int x) { balance = balance + x; Console.WriteLine("Desposited £" + x); } } }

    Read the article

  • Coding alternative shaded rows?

    - by ming yeow
    I want alternative rows in my table to be shaded. what is the best way to do this, javascript, rails? Today, i do a simple <% num % 2%, but this is such a common operation that i think there should be a smarter way to do it

    Read the article

  • Lost in Nodester Installation

    - by jslamka
    I am trying to install my own version of Nodester. I have tried on Ubuntu 12.04 LTS and now with CentOS. I am not the most skilled Linux user (~2 months use) so I am at a loss at this point. The instructions are located at https://github.com/nodester/nodester/wiki/Install-nodester#wiki-a. They ask you to "export paths (to make npm work)" with the lines necessary to accomplish this. cd ~ echo -e "root = ~/.node_libraries\nmanroot = ~/local/share/man\nbinroot = ~/bin" > ~/.npmrc echo -e "export PATH=3d9c7cfd35d3628e0aa233dec9ce9a44d2231afcquot;\${PATH}:~/bin3d9c7cfd35d3628e0aa233dec9ce9a44d2231afcquot;;" >> ~/.bashrc source ~/.bashrc I can accomplish all of this until I get to the source ~/.bashrc line. When I run that, I get the following: [root@MYSERVER ~]# source ~/.bashrc -bash: /root/.bashrc: line 13: syntax error near unexpected token ';;' -bash: /root/.bashrc: line 13: 'export PATH=3d9c7cfd35d3628e0aa233dec9ce9a44d2231afcquot;${PATH}:~/bin3d9c7cfd35d3628e0aa233dec9ce9a44d2231afcquot;; I have tried changing the quot; to " and that didn't help. I tried changing quot; to colons and that didn't help. I also removed that and it didn't help (I am sure many of you at this point are probably wondering why I would even try those things). Does anyone have any insight as to what I need to do to get this to run properly?

    Read the article

  • A way to "improve" write coding in vs2008 experience

    - by stighy
    Hi SO gurus. I would like to try to automize some recurrent job when i develop asp.net application. For example, for each <asp:button> I create, I would like to insert the classical code onomouseover="...something" onmouseout=" ..something-again.." Is there a way to automatically add this code "piece" in vs 2008? Some key combination to add "pre-ready" piece of code? Thank you

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >