Search Results

Search found 633 results on 26 pages for 'peril brain'.

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

  • Rails RJS template displays code instead of the html page

    - by Anand
    After having Googled and hurting my brain for hours on this, I finally decided to post this question. Here's the code... view1.html.erb -------------- <%=link_to_remote_redbox "Link", :url => {:action => :action1, :id => @some.id} some_controller.rb ------------------ def action1 render :layout => false end def action2 do some processing end action1.html.erb -------------------- <form onsubmit="new Ajax.Request('/some_controller/action2', {asynchronous:true, evalScripts:true, onComplete:function(request){RedBox.close(); return false;}, parameters:Form.serialize(this)}); return false;}" method="post" action="/some_controller/action2"> <input type=text name='username'> <input type='submit' value='submit'> </form> action2.rjs ----------- page.replace_html("some_div", (render(:partial => "some_partial"))) with that code in place when action2.rjs kicks in it should display the html page instead I am getting this Element.update("some_div", "<style type=\"text/css\">\n\n.............. As suggested on other posts I read, they say its caused because of the ":update = some_div" in the link_to_remote_redbox function but clearly my code doesn't have that. Help is always appreciated. Many Thanks

    Read the article

  • Numpy: Sorting a multidimensional array by a multidimensional array

    - by JD Long
    Forgive me if this is redundant or super basic. I'm coming to Python/Numpy from R and having a hard time flipping things around in my head. I have a n dimensional array which I want to sort using another n dimensional array of index values. I know I could wrap this in a loop but it seems like there should be a really concise Numpyonic way of beating this into submission. Here's my example code to set up the problem where n=2: a1 = random.standard_normal(size=[2,5]) index = array([[0,1,2,4,3] , [0,1,2,3,4] ]) so now I have a 2 x 5 array of random numbers and a 2 x 5 index. I've read the help for take() about 10 times now but my brain is not groking it, obviously. I thought this might get me there: take(a1, index) array([[ 0.29589188, -0.71279375, -0.18154864, -1.12184984, 0.25698875], [ 0.29589188, -0.71279375, -0.18154864, 0.25698875, -1.12184984]]) but that's clearly reordering only the first element (I presume because of flattening). Any tips on how I get from where I am to a solution that sorts element 0 of a1 by element 0 of the index ... element n?

    Read the article

  • F# Class with Generics : 'constructor deprecated' error

    - by akaphenom
    I am trying to create a a class that will store a time series of data - organized by groups, but I had some compile errors so I stripped down to the basics (just a simple instantiation) and still can't overcome the compile error. I was hoping some one may have seen this issue before. Clas is defined as: type TimeSeriesQueue<'V, 'K when 'K: comparison> = class val private m_daysInCache: int val private m_cache: Map<'K, 'V list ref > ref; val private m_getKey: ('V -> 'K) ; private new(getKey) = { m_cache = ref Map.empty m_daysInCache = 7 ; m_getKey = getKey ; } end So that looks OK to me (it may not be, but doesnt have any errors or warnings) - the instantiation gets the error: type tempRec = { someKey: string ; someVal1: int ; someVal2: int ; } let keyFunc r:tempRec = r.someKey // error occurs on the following line let q = new TimeSeriesQueue<tempRec, string> keyFunc This construct is deprecated: The use of the type syntax 'int C' and 'C ' is not permitted here. Consider adjusting this type to be written in the form 'C' NOTE This may be simple stupidity - I am just getting back from holiday and my brain is still on time zone lag...

    Read the article

  • update variable based upon results from .NET backgroundworker

    - by Bruce
    I've got a C# program that talks to an instrument (spectrum analyzer) over a network. I need to be able to change a large number of parameters in the instrument and read them back into my program. I want to use backgroundworker to do the actual talking to the instrument so that UI performance doesn't suffer. The way this works is - 1) send command to the instrument with new parameter value, 2) read parameter back from the instrument so I can see what actually happened (for example, I try to set the center frequency above the max that the instrument will handle and it tells me what it will actually handle), and 3) update a program variable with the actual value received from the instrument. Because there are quite a few parameters to be updated I'd like to use a generic routine. The part I can't seem to get my brain around is updating the variable in my code with what comes back from the instrument via backgroundworker. If I used a separate RunWorkerCompleted event for each parameter I could hardwire the update directly to the variable. I'd like to come up with a way of using a single routine that's capable of updating any of the variables. All I can come up with is passing a reference number (different for each parameter) and using a switch statement in the RunWorkerCompleted handler to direct the result. There has to be a better way.

    Read the article

  • Single value data to multiple values of data in database relation

    - by Sofiane Merah
    I have such a hard time picturing this. I just don't have the brain to do it. I have a table called reports. --------------------------------------------- | report_id | set_of_bads | field1 | field2 | --------------------------------------------- | 123 | set1 | qwe | qwe | --------------------------------------------- | 321 | 123112 | ewq | ewq | --------------------------------------------- I have another table called bads. This table contains a list of bad data. ------------------------------------- | bad_id | set_it_belongs_to | field2 | field3 | ------------------------------------- | 1 | set1 | qwe | qwe | ------------------------------------- | 2 | set1 | qee | tte | ------------------------------------- | 3 | set1 | q44w | 3qwe | ------------------------------------- | 4 | 234 | qoow | 3qwe | ------------------------------------- Now I have set the first field of every table as the primary key. My question is, how do I connect the field set_of_bads to set_it_belongs_to in the bads table. This way if I want to get the entire set of data that is set1 by calling on the reports table I can do it. Example: hey reports table.. bring up the row that has the report_id 123. Okay thank you.. Now get all the rows from bads that has the set_of_bads value from the row with the report_id 123. Thanks.

    Read the article

  • Exam Questions that use .Demand or .LinkDemand COULD NOT BE ANY MORE CONFUSING OR AMBIGIOUS ????

    - by IbrarMumtaz
    I am 110% sure this is WRONG !!!! Q.12) You develop a library, and want to ensure that the functions in the library cannot be either directly or indirectly invoked by applications that are not running on the local intranet. What attribute would you add to each method? A. [UrlIdentityPermission(SecurityAction.RequestRefuse, Url="http://myintranet")] B. [UrlIdentityPermission(SecurityAction.LinkDemand, Url="http://myintranet")] (correct answer) C. [UrlIdentityPermission(SecurityAction.Demand, Url="http://myintranet")] D. [UrlIdentityPermission(SecurityAction.Assert, Url="http://myintranet")] Explanation Link-Demand should be used as it ensures that all callers in the call stack have the necessary permission. In this case it ensures that all callers in the call stack are on the local intranet. There is an indentical question on Transencer so I already had a clue what was goin but Transcender was much more informative that this drivel as it mentioned class level and not assembly level. It also mentioned that some callers maybe coming externally from the company intranet via authroised and authenticated credentials. With information is easy to see why .Demand on would be wong option to go for? So Transcender was right .... so I thgt fine, that makes sense. With think information still fresh in my brain I had a good idea was was going on in the question. To my surprise .Demand was wrong agin !!!! WHAT? I am really starting to hate this setting now? I cannot be any more p*ssed right now!!! :@ Thanks For Reading, Ibrar

    Read the article

  • Fastest Method to Learn Web Design for a Developer

    - by hekevintran
    I am a Web developer and in my projects I have noticed that my weakest point is not being good at the front-end design. Relying on other designers can be annoying if they are not able to produce as quickly as I want. My perspective on HTML/CSS is that it is basically a big hack that amazingly works. There are too many CSS and browser specific bugs/quirks to learn and remember them all without spending extreme amounts of time trying to untangle everything. Is there a fast track route to getting CSS into my brain? I have looked at some CSS books, but to me they really read as long lists of how to render things correctly in IE6 and how to make corners rounded. (Seriously why does it require so many tricks to make a sharp corner round? On any platform but the Web this would be called a major oversight.) Does there exist something that does the analogous to CSS that jQuery does for JavaScript? Using jQuery you don't need to know JavaScript well to make things that work. I am not interested in learning why IE6 does things in weird ways because I don't care about supporting it at all. I am more interested in a method of learning how to use CSS to do what I want without spending hours and hours reading obscure blogs.

    Read the article

  • Gravatar XML-RPC request problem in Objective-C

    - by Erik
    Hi all, I'm trying to incorporate some Gravatar functionality using its XML-RPC API in an iPhone app I'm writing. I grabbed the Cocoa XML-RPC Framework by Eric Czarny (http://github.com/eczarny/xmlrpc) and it works well when I tested it with some of the Wordpress methods. However, when I try to use the Gravatar API, I always receive a response of "Error code: -9 Authentication error". I think I'm constructing the request correctly, but I've been wracking my brain and can't seem to figure it out. Maybe someone has some experience with this API or can see what I'm doing wrong. Here's the call: <?xml version="1.0"> <methodCall> <methodName>grav.addresses</methodName> <params> <param><value><string>PASSWORD_HERE</string></value></param> </params> </methodCall> Again, the Cocoa XML-RPC Framework worked like a dream with Wordpress, but it's choking on the Gravatar API for some reason. Thanks for your help.

    Read the article

  • Is there a better way to refresh WebView?

    - by cdg
    Hi all. Ok. I have looked EVERYWHERE and my little brain just can't understand a better way to refresh an activity. Any suggestions that I can understand would be great. :) Here is the java code: package com.dge.dges; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.webkit.WebView; import android.widget.Button; public class dgeActivity extends Activity { WebView mWebView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings(); mWebView.loadUrl("http://www.websitehere.php"); Button newButton = (Button)findViewById(R.id.new_button); newButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(dgeActivity.this, dgeActivity.class); startActivity(intent); } }); } } And here is the main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" > <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" /> <Button android:id="@+id/new_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:text="Refresh" /> </RelativeLayout> I don't like the idea of just re-stacking activity after activity. There has to be an easier way to refresh the webview. Please help. :)

    Read the article

  • Sorting by dates (including nil) with NSFetchedResultsController

    - by glorifiedHacker
    In my NSFetchedResultsController, I set a sortDescriptor that sorts based on the date property of my managed objects. The problem that I have encountered (along with several others according to Google) is that nil values are sorted at the earliest end rather than the latest end of the date spectrum. I want my list to be sorted earliest, earlier, now, later, latest, nil. As I understand it, this sorting is done at the database level in SQLite and so I cannot construct my own compare: method to provide the sorting I want. I don't want to manually sort in memory, because I would have to give up all of the benefits of NSFetchedResultsController. I can't do compound sorting because the sectionNameKeyPaths are tightly coupled to the date ranges. I could write a routine that redirects indexPath requests so that section 0 in the results controller gets mapped to the last section of the tableView, but I fear that would add a lot of overhead, severely increase the complexity of my code, and be very, very error-prone. The latest idea that I am considering is to map all nil dates to the furthest future date that NSDate supports. My left brain hates this idea, as it feels more like a hack. It will also take a bit of work to implement, since checking for nil factors heavily into how I process dates in my app. I don't want to go this route without first checking for better options. Can anyone think of a better way to get around this problem?

    Read the article

  • how to match var/id to class

    - by circey
    Hi. I'm new to jquery and, in addition, I think I'm having a brain freeze. I have a number of links with different ids. I want to match the clicked link with a div with the corresponding class so the div will show/hide/toggle as appropriate. I have: <script type="text/javascript"> $(document).ready(function() { $('.folioBox').hide(); $('a.interface').click(function(){ var currentId = $(this).attr('id'); var currentBox = $('.folioBox .' + currentId); $(currentBox).toggle(400); }); }); </script> <a class="interface" id="apple">Apple flavor</a> <a class="interface" id="banana">Banana flavor</a> <a class="interface" id="cherry">Cherry flavor</a> <div class="folioBox apple">content</div> <div class="folioBox banana">content</div> <div class="folioBox cherry">content</div> I just can't get it to work and I can't figure out whether I would be best using match or find or filter. Some assistance would be much appreciated!

    Read the article

  • Javascript/PHP and timezones

    - by James
    Hi, I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here: http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/ So this gives me the offset along with the DST indicator. Now, I want to use these in my PHP scripts in order to ouput the local date/time for the user....but what's best for this? I figure I have 2 options: a) Pick a random timezone which has the same offset and DST setting from the output of timezone_abbreviations_list(). Then call date_timezone_set() with this in order to apply the correct treatment to the time. b) Continue treating the date as UTC but just do some timestamp addition to add the appropriate number of hours on. My feeling is that option B is the best way. The reason for this is that with A, I could be using a timezone which although correct in terms of offset/dst, may have some obscur rules in place behind the scene that could give surprising results (I don't know of any but nonetheless I don't think I can rule it out). I'd then re-check the timezone using Javascript at the start of each session in order to capture when either the user's timezone changes (very unlikely) or they pass in to the DST period. Sorry for the brain dump - I'm really just after some sort of reassurance that the approaches above are valid. Thanks, James.

    Read the article

  • Trouble Shoot JavaScript Function in IE

    - by CreativeNotice
    So this function works fine in geko and webkit browsers, but not IE7. I've busted my brain trying to spot the issue. Anything stick out for you? Basic premise is you pass in a data object (in this case a response from jQuery's $.getJSON) we check for a response code, set the notification's class, append a layer and show it to the user. Then reverse the process after a time limit. function userNotice(data){ // change class based on error code returned var myClass = ''; if(data.code == 200){ myClass='success'; } else if(data.code == 400){ myClass='error'; } else{ myClass='notice'; } // create message html, add to DOM, FadeIn var myNotice = '<div id="notice" class="ajaxMsg '+myClass+'">'+data.msg+'</div>'; $("body").append(myNotice); $("#notice").fadeIn('fast'); // fadeout and remove from DOM after delay var t = setTimeout(function(){ $("#notice").fadeOut('slow',function(){ $(this).remove(); }); },5000); }

    Read the article

  • Liferay hook: filter url giving filterstart error and current url generates exception null

    - by jack
    I'm trying to make an autologinfilter in Eclipse using a liferay hook. Now I've added the: <filter> <filter-name>myautologinfilter</filter-name> <filter-class>bla.bla.xyz</filter-class> </filter> <filter-mapping> <filter-name>myautologinfilter</filter-name> <url-pattern>/c/login/myurl</url-pattern> </filter-mapping> To the liferay hook's web.xml. In the liferay-hook.xml I added: portal.properties And in that hook.xml I added: auto.login.hooks=bla.bla.xyz bla.bla.xyz implements AutoLogin, but for now it's pretty gutted: @Override public String[] login(HttpServletRequest request, HttpServletResponse response) throws AutoLoginException { Object parameters = request.getAttribute("javax.servlet.forward.query_string"); Map<String, String> x = parserClass.parsing(parameters.toString()); System.out.println("voornaam: " + geparsdeParameters.get("tokenvalue1")); try { return null; } catch (Exception e) { throw new AutoLoginException(e); } } Since the hook doesn't start when I add the filtering I removed it and just tried: http://localhost:8080/c/portal/login?tokenvalue1=55 but when I check my tomcat I see: Error XYZ Url: url myUsedUrl exception null Also I tried adding some util classes but I got: classnotfoundexceptions. Is there anything specific I have to do when I add extra classes in a hook? Any advice/input would be appreciated. Or someone's ear I could lend so I could mail them a little bit so I could pick their brain a bit would be really appreciated since I don't know anyone who programs for liferay.

    Read the article

  • Filling SWT table object using a separated thread class ...

    - by erlord
    Hi all I've got a code snippet by the swt team that does exactly what I need. However, there is a part I want to separate into another class, in particular, the whole inline stuff. In response to my former question, it has been suggested that Callable should be used in order to implement threaded objects. It is suggested to make use of an implementation of runnable or better callable, since I do need some kind of return. However, I don't get it. My problems are: In the original code, within the inline implementation of the method run, some of the parents objects are called. How would I do this when the thread is separated? Pass the object via the C'tor's parameter? In the original code, another runnable object is nested within the runnable implementation. What is it good for? How to implement this when having separated the code? Furthermore, this nested runnable again calls objects created by the main method. Please, have mercy with me, but I am still quite a beginner and my brain is near collapsing :-( All I want is to separate all the threaded stuff into another class and make the program do just the same thing as it already does. Help please! Again thank you very much in advance for any useful suggestions, hints, examples etc... Regs Me

    Read the article

  • Refresh a Div that has a Google ad inside it

    - by Abs
    Hello all, I have a div that holds a google ad. My website is mostly AJAX and there is no need for a browser refresh. That means my ads will not refresh either, which isnt ideal, a user staring at one ad all day. So I wanted a way to refresh a particular div on a page. I found many solutions but they didnt work. For example, using JQuery's html function: $("#ads").html("google ad script here"); This managed to refresh the whole page no idea how. I can also make an AJAX request to a HTML page that contains the google ad but I am guessing it will have the same effect as the above attempt. I do not want to use iFrames. Is there any other option open to me? My pea brain can not think of anymore. :) Thanks you for any help. EDIT: It is allowed since I will be initiating the refresh only when a user clicks a link. A prime example is Yahoo Mail - their new AJAX mailbox uses this same method, when a user clicks a link then a new ad is shown.

    Read the article

  • Subsonic in a VS2008 Add-In woes

    - by Michael Smit
    Hi, I am writing a VS2008 add-in that connects to a remote database blah blah. I am having a problem with the app.config in this project. When I use SubSonic in my code, it moans that is cannot find the SubSonicServer section. This is because the .config file cannot be found. This appears to a problem with paths as the add-in is a DLL running in the context of VS2008 and the working directory is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. Is there a way to get the app.config to deploy properly with the application so my add-in (and SubSonic) can find what it needs in the .config file, or is there a way to get SubSonic to work without the need for the .config? I am very experienced in SubSonic projects now, but only winforms, web, web service, and WPF applications. This is the first time I have tried to use SubSonic in a VS2008 Add-In project. I also have AppSettings in the config file which the ConfigurationManager cannot read because it cannot see the .config file. 2AM now and brain is tired of trying to figure this one out. Hopefully there is an answer when I wake up :) TIA

    Read the article

  • How to restrain one's self from the overwhelming urge to rewrite everything?

    - by Scott Saad
    Setup Have you ever had the experience of going into a piece of code to make a seemingly simple change and then realizing that you've just stepped into a wasteland that deserves some serious attention? This usually gets followed up with an official FREAK OUT moment, where the overwhelming feeling of rewriting everything in sight starts to creep up. It's important to note that this bad code does not necessarily come from others as it may indeed be something we've written or contributed to in the past. Problem It's obvious that there is some serious code rot, horrible architecture, etc. that needs to be dealt with. The real problem, as it relates to this question, is that it's not the right time to rewrite the code. There could be many reasons for this: Currently in the middle of a release cycle, therefore any changes should be minimal. It's 2:00 AM in the morning, and the brain is starting to shut down. It could have seemingly adverse affects on the schedule. The rabbit hole could go much deeper than our eyes are able to see at this time. etc... Question So how should we balance the duty of continuously improving the code, while also being a responsible developer? How do we refrain from contributing to the broken window theory, while also being aware of actions and the potential recklessness they may cause? Update Great answers! For the most part, there seems to be two schools of thought: Don't resist the urge as it's a good one to have. Don't give in to the temptation as it will burn you to the ground. It would be interesting to know if more people feel any balance exists.

    Read the article

  • MySQL Query That Can Pull the Data I am Seeking?

    - by Amy
    On the project I am working on, I am stuck with the table structure from Hades. Two things to keep in mind: I can't change the table structure right now. I'm stuck with it for the time being. The queries are dynamically generated and not hard coded. So, while I am asking for a query that can pull this data, what I am really working toward is an algorithm that will generate the query I need. Hopefully, I can explain the problem without making your eyes glaze over and your brain implode. We have an instance table that looks (simplified) along these lines: Instances InstanceID active 1 Y 2 Y 3 Y 4 N 5 Y 6 Y Then, there are multiple data tables along these lines: Table1 InstanceID field1 reference_field2 1 John 5 2 Sally NULL 3 Fred 6 4 Joe NULL Table2 InstanceID field3 5 1 6 1 Table3 InstanceID fieldID field4 5 1 Howard 5 2 James 6 2 Betty Please note that reference_field2 in Table1 contains a reference to another instance. Field3 in Table2 is a bit more complicated. It contains a fieldID for Table 3. What I need is a query that will get me a list as follows: InstanceID field1 field4 1 John Howard 2 Sally 3 Fred The problem is, in the query I currently have, I do not get Fred because there is no entry in Table3 for fieldID 1 and InstanceID 6. So, the very best list I have been able to get thus far is InstanceID field1 field4 1 John Howard 2 Sally In essence, if there is an entry in Table1 for Field 2, and there is not an entry in Table 3 that has the instanceID contained in field2 and the field ID contained in field3, I don't get the data from field1. I have looked at joins till I'm blue in the face, and I can't see a way to handle the case when table3 has no entry.

    Read the article

  • how useful is Turing completeness? are neural nets turing complete?

    - by Albert
    While reading some papers about the Turing completeness of recurrent neural nets (for example: Turing computability with neural nets, Hava T. Siegelmann and Eduardo D. Sontag, 1991), I got the feeling that the proof which was given there was not really that practical. For example the referenced paper needs a neural network which neuron activity must be of infinity exactness (to reliable represent any rational number). Other proofs need a neural network of infinite size. Clearly, that is not really that practical. But I started to wonder now if it does make sense at all to ask for Turing completeness. By the strict definition, no computer system nowadays is Turing complete because none of them will be able to simulate the infinite tape. Interestingly, programming language specification leaves it most often open if they are turing complete or not. It all boils down to the question if they will always be able to allocate more memory and if the function call stack size is infinite. Most specification don't really specify this. Of course all available implementations are limited here, so all practical implementations of programming languages are not Turing complete. So, what you can say is that all computer systems are just equally powerful as finite state machines and not more. And that brings me to the question: How useful is the term Turing complete at all? And back to neural nets: For any practical implementation of a neural net (including our own brain), they will not be able to represent an infinite number of states, i.e. by the strict definition of Turing completeness, they are not Turing complete. So does the question if neural nets are Turing complete make sense at all? The question if they are as powerful as finite state machines was answered already much earlier (1954 by Minsky, the answer of course: yes) and also seems easier to answer. I.e., at least in theory, that was already the proof that they are as powerful as any computer.

    Read the article

  • Question about making Asynchronous call in C# (WPF) to COM object

    - by Andrew
    Hi, Sorry to ask such a basic question but I seem to have a brain freeze on this one! I'm calling a COM (ATL) object from my WPF project. The COM method might take a long time to complete. I thought I'd try and call it asychronously. I have a few demo lines that show the problem. private void checkBox1_Checked(object sender, RoutedEventArgs e) { //DoSomeWork(); AsyncDoWork caller = new AsyncDoWork(DoSomeWork); IAsyncResult result = caller.BeginInvoke(null, null); } private delegate void AsyncDoWork(); private void DoSomeWork() { _Server.DoWork(); } The ATL method DoWork is very exciting. It is: STDMETHODIMP CSimpleObject::DoWork(void) { Sleep(5000); return S_OK; } I had expectations that running this way would result in the checkbox being checked right away (instead of in 5 seconds) and me being able to move the WPF gui around the screen. I can't - for 5 seconds. What am I doing wrong? I'm sure it's something pretty simple. Delegate signature wrong? Thanks.

    Read the article

  • Errors when creating a custom Querable object with MVC and Subsonic pagedlist

    - by minus4
    hiya, i have the following code but when i try and create a new IQuerable i get an error that the interface cannot be implemented, if i take away the new i get a not implemented exception, have had to jump back and work on some old ASP classic sites for past month and for the life of me i can not wake my brain up into C# mode. Could you please have a look at below and give me some clues on where i'm going wrong: The code is to create a list of priceItems, but instead of a categoryID (int) i am going to be showing the name as string. public ActionResult ViewPriceItems(int? page) { var crm = 0; page = GetPage(page); // try and create items2 IQueryable<ViewPriceItemsModel> items2 = new IQueryable<ViewPriceItemsModel>(); // the data to be paged,but unmodified var olditems = PriceItem.All().OrderBy(x => x.PriceItemID); foreach (var item in olditems) { // set category as the name not the ID for easier reading items2.Concat(new [] {new ViewPriceItemsModel {ID = item.PriceItemID, Name = item.PriceItem_Name, Category = PriceCategory.SingleOrDefault( x => x.PriceCategoryID == item.PriceItem_PriceCategory_ID).PriceCategory_Name, Display = item.PriceItems_DisplayMethod}}); } crm = olditems.Count() / MaxResultsPerPage; ViewData["numtpages"] = crm; ViewData["curtpage"] = page + 1; // return a paged result set return View(new PagedList<ViewPriceItemsModel>(items2, page ?? 0, MaxResultsPerPage)); } many thanks

    Read the article

  • Streamlining my javascript with a function

    - by liz
    i have a series of select lists, that i am using to populate text boxes with ids. so you click a select option and another text box is filled with its id. with just one select/id pair this works fine, but i have multiples, and the only thing that changes is the id of the select and input.. in fact just the ending changes, the inputs all start with featredproductid and the select ids all start with recipesproduct and then both end with the category. i know that listing this over and over for each category is not the way to do it. i think i need to make an array of the categories var cats = ['olive oil', "grains", "pasta"] and then use a forEach function? maybe? here is the clunky code window.addEvent('domready', function() { $('recipesproductoliveoil').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidoliveoil").setProperties({ value: pidselected}); ; }); $('recipesproductgrains').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidgrains").setProperties({ value: pidselected}); ; }); $('recipesproductpasta').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidpasta").setProperties({ value: pidselected}); ; }); $('recipesproductpantry').addEvent('change', function(e){ pidselected = this.options[this.selectedIndex].getProperty('value') ; $("featuredproductidpantry").setProperties({ value: pidselected}); ; }); }); keep in mind this is mootools 1.1 (no i cant update it sorry). i am sure this is kind of basic, something i seem to have wrapping my brain around. but i am quite sure doing it as above is not really good...

    Read the article

  • Select * from 'many to many' SQL relationship

    - by Rampant Creative Group
    I'm still learning SQL and my brain is having a hard time with this one. Say I have 3 tables: teams players and teams_players as my link table All I want to do is run a query to get each team and the players on them. I tried this: SELECT * FROM teams INNER JOIN teams_players ON teams.id = teams_players.team_id INNER JOIN players ON teams_players.player_id = players.id But it returned a separate row for each player on each team. Is JOIN the right way to do it or should I be doing something else? ----------------------------------------- Edit Ok, so from what I'm hearing, this isn't necessarily a bad way to do it. I'll just have to group the data by team while I'm doing my loop. I have not yet tried the modified SQL statements provided, but I will today and get back to you. To answer the question about structure - I guess I wasn't thinking about the returned row structure which is part of what lead to my confusion. In this particular case, each team is limited to 4 players (or less) so I guess the structure that would be helpful to me is something like the following: teams.id, teams.name, players.id, players.name, players.id, players.name, players.id, players.name, players.id, players.name, 1 Team ABC 1 Jim 2 Bob 3 Ned 4 Roy 2 Team XYZ 2 Bob 3 Ned 5 Ralph 6 Tom

    Read the article

  • What's the best way to learn .NET?

    - by duffymo
    I've been developing Java EE for quite a while now. I've used WebLogic, Tomcat, Spring, and Hibernate extensively, so I have a mental model of what features are available and how things are developed and deployed. The problem that I have with .NET is that I don't have a clear mapping of its features onto Java EE. Here's what I know so far: Java EE - .NET Java - C# JAR - DLL WAR - ? (deployment in general) EAR - ? (deployment in general) Tomcat - IIS web server JSP - ASP? JDBC - ODBC JMS - MSMQ JTA - Microsoft Transaction Manager So much of the functionality that WebLogic handles appears to be dispersed throughout the Windows OS. My confusion kicks in when I see the waves of books at Borders - VB.NET, ASP.NET, C#, etc. If I'm not a VB programmer, would it be possible to stick with C# and write enterprise apps that are the equivalent of what I'm used to with Java EE? If there were a Top Three list of books to learn from, what would they be? The "Head First" series has certainly been successful for Java. http://www.amazon.com/Head-First-C-Brain-Friendly-Guides/dp/0596514824/ref=sr_1_1?ie=UTF8&s=books&qid=1224121193&sr=8-1 Equally well recommended for .NET learning? Thanks. - %

    Read the article

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