Search Results

Search found 5364 results on 215 pages for 'equation editor'.

Page 70/215 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Facebook android app keeps crashing even though there are no errors in my code. Why?

    - by user1554479
    If you import the facebook SDK library, the code works (ignore the deprecated methods for now lol) and there are no errors or warnings. However, when I run my facebook app on my Android 2.2 or 4.2 emulator, the app crashes either upon opening or after the log on screen. Why? Is it because I'm not implementing Async Task? If so, how does that work? Here's my code: package com.sara.facebookappl; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.os.StrictMode; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.facebook.android.DialogError; import com.facebook.android.Facebook; import com.facebook.android.Facebook.DialogListener; import com.facebook.android.FacebookError; import com.facebook.android.Util; public class MainActivity extends Activity implements OnClickListener, DialogListener { Facebook fb; ImageView button; SharedPreferences sp; TextView welcome; Button post; @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); post=(Button)findViewById(R.id.button1); String APP_ID = getString(R.string.APP_ID); fb= new Facebook(APP_ID); sp =getPreferences(MODE_PRIVATE); String access_token=sp.getString("access_token", null); long expires=sp.getLong("access_expires", 0); if (access_token !=null) { fb.setAccessToken(access_token); } if(expires !=0) { fb.setAccessExpires(expires); } button=(ImageView)findViewById(R.id.login); button.setOnClickListener((OnClickListener) this); updateButtonImage(); } @SuppressWarnings("deprecation") private void updateButtonImage() { // TODO Auto-generated method stub post.setVisibility(Button.VISIBLE); button.setImageResource(R.drawable.com_facebook_loginbutton_blue); //logout button if (fb.isSessionValid()) { button.setImageResource(R.drawable.com_facebook_loginbutton_blue); // ^logout button JSONObject obj=null; URL img_url =null; try { String jsonUser= fb.request("me"); obj = Util.parseJson(jsonUser); String id=obj.optString("id"); String name = obj.optString("name"); welcome.setText("Welcome, " + name); }catch(FacebookError e) { e.printStackTrace(); }catch (JSONException e) { e.printStackTrace(); }catch (MalformedURLException e) { e.printStackTrace(); }catch (IOException e) { e.printStackTrace(); } }else { post.setVisibility(Button.VISIBLE); button.setImageResource(R.drawable.com_facebook_loginbutton_blue); } } @SuppressWarnings("deprecation") public void buttonClicks(View v) { switch (v.getId()) { case R.id.button1: //post Bundle params= new Bundle(); params.putString("name", "User X"); params.putString("caption", "Rating"); params.putString("description", "User X Rated"); params.putString("link", "http://..."); fb.dialog(MainActivity.this, "feed", params, new Facebook.DialogListener() { @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } }); break; } } @SuppressWarnings("deprecation") public void onClick(View v) { if(fb.isSessionValid()) { try { fb.logout(getApplicationContext()); updateButtonImage(); //button will close our our session }catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } }else{ //login into facebook fb.authorize(MainActivity.this, new String[] {"email"}, new Facebook.DialogListener() { @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "fbError", Toast.LENGTH_SHORT).show(); } @Override public void onError(DialogError e) { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "onError", Toast.LENGTH_SHORT).show(); } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub Editor editor=sp.edit(); editor.putString("access_token", fb.getAccessToken()); editor.putLong("access_expires", fb.getAccessExpires()); editor.commit(); updateButtonImage(); } @Override public void onCancel() { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "onCancel", Toast.LENGTH_SHORT).show(); } }); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @SuppressWarnings("deprecation") @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); fb.authorizeCallback(requestCode, resultCode, data); } @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } } LogCat Errors: 12-16 04:56:59.070: E/AndroidRuntime(822): FATAL EXCEPTION: main 12-16 04:56:59.070: E/AndroidRuntime(822): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sara.facebookappl/com.sara.facebookappl.MainActivity}: android.os.NetworkOnMainThreadException 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.Handler.dispatchMessage(Handler.java:99) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.Looper.loop(Looper.java:137) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.main(ActivityThread.java:5039) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.lang.reflect.Method.invokeNative(Native Method) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.lang.reflect.Method.invoke(Method.java:511) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-16 04:56:59.070: E/AndroidRuntime(822): at dalvik.system.NativeStart.main(Native Method) 12-16 04:56:59.070: E/AndroidRuntime(822): Caused by: android.os.NetworkOnMainThreadException 12-16 04:56:59.070: E/AndroidRuntime(822): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 12-16 04:56:59.070: E/AndroidRuntime(822): at java.net.InetAddress.getAllByName(InetAddress.java:214) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.(HttpConnection.java:70) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.(HttpConnection.java:50) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:461) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:282) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177) 12-16 04:56:59.070: E/AndroidRuntime(822): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Util.openUrl(Util.java:219) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Facebook.requestImpl(Facebook.java:806) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.facebook.android.Facebook.request(Facebook.java:732) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.sara.facebookappl.MainActivity.updateButtonImage(MainActivity.java:83) 12-16 04:56:59.070: E/AndroidRuntime(822): at com.sara.facebookappl.MainActivity.onCreate(MainActivity.java:63) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.Activity.performCreate(Activity.java:5104) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-16 04:56:59.070: E/AndroidRuntime(822): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 12-16 04:56:59.070: E/AndroidRuntime(822): ... 11 more 12-16 04:56:59.090: D/dalvikvm(822): GC_CONCURRENT freed 150K, 9% free 2723K/2988K, paused 7ms+58ms, total 239ms

    Read the article

  • Why would the same web form control render different "onclick" logic based on the page structure?

    - by zk812
    It was hard to title this question. :) I have a user control that is used to display a list of lookup items in my database and a delete button for each item (Editor User Control below). The delete button has an onClientClick event used to display a confirmation dialog in JavaScript. On page one, the confirmation pops up and functions correctly. The overall structure is: Master Page Page Editor User Control List of items with delete button On page two, the confirmation pops up but regardless of the answer, the page posts back anyway. The structure of this page is: Master Page Page User Control Editor User Control List of items with delete button For some reason, this makes a difference in how the delete button is rendered. Page one: <input type="image" name="ctl00...RequestTypesDataList$ctl01$ctl01" src="Images/Disable.png" alt="Delete" onclick="return ProcessDeleteCommand(1);" /> Page two: <input type="image" name="ctl00...RequestTypesDataList$ctl07$ctl01" src="Images/Disable.png" alt="Delete" onclick="return ProcessDeleteCommand(2);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$RequestCreator1$RequestTypeEditor1$RequestTypesDataList$ctl07$ctl01&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" /> Does anyone know why page two renders WebForm_DoPostBackWithOptions after my JS check? It's causing the postback regardless of the confirmation choice.

    Read the article

  • Could someone explain gtk2hs drag and drop to me, the listDND.hs demo just isn't doing it for me?

    - by Tom Carstens
    As the title says, I just don't get DND (or rather I understand the concept and I understand the order of callbacks, I just don't understand how to setup DND for actual usage.) I'd like to say that I've done DND stuff before in C, but considering I never really got that working... So I'm trying (and mostly succeeding, save DND) to write a text editor (using gtksourceview, because it has built in code highlighting.) Reasons are below if you want them. Anyways, there's not really a good DND demo or tutorial available for gtk2hs (listDND.hs just doesn't translate well in my head.) So what I'm asking is for code that demonstrates simple DND on a window widget (for example.) Ideally, it should accept drops from other windows (such as Thunar) and print out the information in string form. I think I can take it from there... Reasons: I'm running a fairly light weight setup, dwm and a few gtk+2 programs. I really don't want to have to pull in gtk+3 to get the current gedit from the repos (Arch Linux.) Currently, I'm using geany for all of my text editing needs, however, geany is a bit heavy for editing config files. Further, geany doesn't care for my terminal of choice (st;) so I don't even get the benefit of using it as an IDE. Meaning I'd like a lightweight text editor with syntax highlighting. I could configure emacs or vim or something, but that seems to me to be more of a hack then a proper solution. Thus my project was born. It's mostly working (aside from DND, all that's left is proper multi-tab support.) Admittedly, I could probably work this out if I wrote it in C, but there isn't that much state in a text editor so Haskell's been working fine with almost no need for mutable variables.

    Read the article

  • Move iFrame in the DOM using jQuery

    - by Josh
    My overall aim is to create an editor which I can skin using jQuery UI (by creating a custom toolbar which uses integration calls), using TinyMCE. Lets say I have a TinyMCE editor on a page. The actual editor is an iFrame contained inside a lot of horrible table code, which is also where the current (to be scrapped) toolbar is. I want just the iframe inside a div - ideally get rid of the table code. So...I want to transform: <table> <tr> <td><iframe id="xyz"></iframe></td> </tr> </table> into <div id="test"> <iframe id="xyz"></iframe> </div> So far, I've tried using: $('#xyz').clone(true).appendTo('#test'); Which clones the iframe, but no content inside it. Is there a way to make this work? If not, can I somehow strip the table code from around the iFrame away? If I cant do that, I'll think I'll have to keep the table code.

    Read the article

  • Mercurial "server"

    - by user85116
    I've been using mercurial for a little while, but mainly for my own usage. Now though, I have a project I'm working on where two of us are building the same project, and we will probably be modifiying each other's files. I would like to setup a mercurial repo on a server, make that repo the "server", so my changes and the other editor's changes both push to that server (so basically the subversion / cvs model); I like mercurial though, and don't want to switch to something like subversion. Here in my own network, everything is done on linux, and my "server" has openssh installed. So pushing my changes (I work on multiple computers) from one computer to the server is just a matter of "hg push"; the protocol used is ssh for transfering the changes. The problem is that I use linux, the server will be windows (so no openssh, right?) and the other editor will be using windows too. As far as I know, the best way of working in mercurial in these types of setups is for the repo to pull changes from the source, rather then the source pushing to the "server". I'm behind several firewall's (not entirely my network) and my computer won't be visible from the server, and I'm assuming the other editor will be behind a firewall too (so we can't just start up the local mercurial http server and get the "server" computer to pull from that). What's the best way for both editors to get our changes to the server repo? (I should add that the server is a server on the internet, so just as visible as something like google.com. It's a hosted windows server, but I would probably have permission to install software if needed for this)

    Read the article

  • How do I unbind another jQuery function on .click()?

    - by Mike Barwick
    I have this script that run to fix my menu bar to the browser on scroll. Nothing really needs to change here (works as it should). However, you may need it... var div = $('#wizMenuWrap'); var editor = $('#main_wrapper'); var start = $(div).offset().top; $(function fixedPackage(){ $.event.add(window, "scroll", function() { var p = $(window).scrollTop(); $(div).css('position',((p)>start) ? 'fixed' : 'static'); $(div).css('top',((p)>start) ? '0px' : ''); //Adds TOP margin to #main_wrapper (required) $(editor).css('position',((p)>start) ? 'relative' : 'static'); $(editor).css('top',((p)>start) ? '88px' : ''); }); }); Now for the issue at hand. I have another script function that calls a modal pop-up (which again works as it should). However, it's not slick from a UI perspective when I scroll the page when the modals open. So I want to disable the script above when the modal script below is called. In other words, when I click to open the modal pop-up, the script above shouldn't work. $(function () { var setUp = $('.setupButton'); // SHOWS SPECIFIED VIEW $(setUp).click(function () { $('#setupPanel').modal('show'); //PREVENTS PACKAGE SELECT FIXED POSITION ON SCROLL $(setUp).unbind('click',fixedPackage); }); }) As you can see above, I tried to unbind the scroll function (the first code snippet), but this is not correct. These two scripts are in two separate js libraries.

    Read the article

  • How much is a subscriber worth?

    - by Tom Lewin
    This year at Red Gate, we’ve started providing a way to back up SQL Azure databases and Azure storage. We decided to sell this as a service, instead of a product, which means customers only pay for what they use. Unfortunately for us, it makes figuring out revenue much trickier. With a product like SQL Compare, a customer pays for it, and it’s theirs for good. Sure, we offer support and upgrades, but, fundamentally, the sale is a simple, upfront transaction: we’ve made this product, you need this product, we swap product for money and everyone is happy. With software as a service, it isn’t that easy. The money and product don’t change hands up front. Instead, we provide a service in exchange for a recurring fee. We know someone buying SQL Compare will pay us $X, but we don’t know how long service customers will stay with us, or how much they will spend. How do we find this out? We use lifetime value analysis. What is lifetime value? Lifetime value, or LTV, is how much a customer is worth to the business. For Entrepreneurs has a brilliant write up that we followed to conduct our analysis. Basically, it all boils down to this equation: LTV = ARPU x ALC To make it a bit less of an alphabet-soup and a bit more understandable, we can write it out in full: The lifetime value of a customer equals the average revenue per customer per month, times the average time a customer spends with the service Simple, right? A customer is worth the average spend times the average stay. If customers pay on average $50/month, and stay on average for ten months, then a new customer will, on average, bring in $500 over the time they are a customer! Average spend is easy to work out; it’s revenue divided by customers. The problem comes when we realise that we don’t know exactly how long a customer will stay with us. How can we figure out the average lifetime of a customer, if we only have six months’ worth of data? The answer lies in the fact that: Average Lifetime of a Customer = 1 / Churn Rate The churn rate is the percentage of customers that cancel in a month. If half of your customers cancel each month, then your average customer lifetime is two months. The problem we faced was that we didn’t have enough data to make an estimate of one month’s cancellations reliable (because barely anybody cancels)! To deal with this data problem, we can take data from the last three months instead. This means we have more data to play with. We can still use the equation above, we just need to multiply the final result by three (as we worked out how many three month periods customers stay for, and we want our answer to be in months). Now these estimates are likely to be fairly unreliable; when there’s not a lot of data it pays to be cautious with inference. That said, the numbers we have look fairly consistent, and it’s super easy to revise our estimates when new data comes in. At the very least, these numbers give us a vague idea of whether a subscription business is viable. As far as Cloud Services goes, the business looks very viable indeed, and the low cancellation rates are much more than just data points in LTV equations; they show that the product is working out great for our customers, which is exactly what we’re looking for!

    Read the article

  • MVC 2 Ajax.Beginform passes returned Html to javascript function

    - by Joe
    Hi, I have a small partial Create Person form in a page above a table of results. I want to be able to post the form to the server, which I can do no problem with ajax.Beginform. <% using (Ajax.BeginForm("Create", new AjaxOptions { OnComplete = "ProcessResponse" })) {%> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%=Html.LabelFor(model => model.FirstName)%> </div> <div class="editor-field"> <%=Html.TextBoxFor(model => model.FirstName)%> <%=Html.ValidationMessageFor(model => model.FirstName)%> </div> <div class="editor-label"> <%=Html.LabelFor(model => model.LastName)%> </div> <div class="editor-field"> <%=Html.TextBoxFor(model => model.LastName)%> <%=Html.ValidationMessageFor(model => model.LastName)%> </div> <p> <input type="submit" /> </p> </fieldset> <% } %> Then in my controller I want to be able to post back a partial which is just a table row if the create is successful and append it to the table, which I can do easily with jquery. $('#personTable tr:last').after(data); However, if server validation fails I want to pass back my partial create person form with the validation errors and replace the existing Create Person form. I have tried returning a Json array Controller: return Json(new { Success = true, Html= this.RenderViewToString("PersonSubform",person) }); Javascript: var json_data = response.get_response().get_object(); with a pass/fail flag and the partial rendered as a string using the solition below but that doesnt render the mvc validation controls when the form fails. SO RenderPartialToString So, is there any way I can hand my javascript the out of the box PartialView("PersonForm") as its returned from my ajax.form? Can I pass some addition info as a Json array so I can tell if its pass or fail and maybe add a message? UPDATE I can now pass the HTML of a PartialView to my javascript but I need to pass some additional data pairs like ServerValidation : true/false and ActionMessage : "you have just created a Person Bill". Ideally I would pass a Json array rather than hidden fields in my partial. function ProcessResponse(response) { var html = response.get_data(); $("#campaignSubform").html(html); } Many thanks in advance

    Read the article

  • Efficient Multiple Linear Regression in C# / .Net

    - by mrnye
    Does anyone know of an efficient way to do multiple linear regression in C#, where the number of simultaneous equations may be in the 1000's (with 3 or 4 different inputs). After reading this article on multiple linear regression I tried implementing it with a matrix equation: Matrix y = new Matrix( new double[,]{{745}, {895}, {442}, {440}, {1598}}); Matrix x = new Matrix( new double[,]{{1, 36, 66}, {1, 37, 68}, {1, 47, 64}, {1, 32, 53}, {1, 1, 101}}); Matrix b = (x.Transpose() * x).Inverse() * x.Transpose() * y; for (int i = 0; i < b.Rows; i++) { Trace.WriteLine("INFO: " + b[i, 0].ToDouble()); } However it does not scale well to the scale of 1000's of equations due to the matrix inversion operation. I can call the R language and use that, however I was hoping there would be a pure .Net solution which will scale to these large sets. Any suggestions? EDIT #1: I have settled using R for the time being. By using statconn (downloaded here) I have found it to be both fast & relatively easy to use this method. I.e. here is a small code snippet, it really isn't much code at all to use the R statconn library (note: this is not all the code!). _StatConn.EvaluateNoReturn(string.Format("output <- lm({0})", equation)); object intercept = _StatConn.Evaluate("coefficients(output)['(Intercept)']"); parameters[0] = (double)intercept; for (int i = 0; i < xColCount; i++) { object parameter = _StatConn.Evaluate(string.Format("coefficients(output)['x{0}']", i)); parameters[i + 1] = (double)parameter; }

    Read the article

  • How to Add, Edit and Display one to many relationship entities in ASP.Net MVC 2?

    - by Picflight
    I am looking for best practices conforming to the MVC design pattern. My Entities have the following relationship. tblPortal PortalId PrortalName tblPortalAlias AliasId PortalId HttpAlias Each Portal can have many PortalAlias. I want to Add a New Portal and then Add the associated PortalAlias. I am confused on how I should structure the Views and how I should present the Views to the user. I am looking for some sample code on how to accomplish this. My thoughts are first present the Portal View, let the user add the Portal. Then click the Edit link on the Portal List View and on the Portal Edit View let them Add the PortalAlias. If so, what should the Edit View look like? So far I have: Edit <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyProject.Mvc.Models.PortalFormViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Edit </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Edit</h2> <% Html.RenderPartial("PortalForm", Model); %> <div> <%= Html.ActionLink("Back to List", "Index") %> </div> </asp:Content> PortalForm <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProject.Mvc.Models.PortalFormViewModel>" %> <%= Html.ValidationSummary("Please correct the errors and try again.") %> <% using (Html.BeginForm()) {%> <%= Html.ValidationSummary(true) %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%= Html.LabelFor(model => model.Portal.PortalId) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.Portal.PortalId) %> <%= Html.ValidationMessageFor(model => model.Portal.PortalId) %> </div> <div class="editor-label"> <%= Html.LabelFor(model => model.Portal.PortalName) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.Portal.PortalName) %> <%= Html.ValidationMessageFor(model => model.Portal.PortalName) %> </div> <p> <input type="submit" value="Save" /> </p> </fieldset> <% } %> Alias<br /><%-- This display is for debug --%> <% foreach (var item in Model.PortalAlias) { %> <%= item.HTTPAlias %><br /> <% } %> PortalFormViewModel public class PortalFormViewModel { public Portal Portal { get; private set; } public IEnumerable<PortalAlias> PortalAlias { get; private set; } public PortalFormViewModel() { Portal = new Portal(); } public PortalFormViewModel(Portal portal) { Portal = portal; PortalAlias = portal.PortalAlias; } }

    Read the article

  • Accurate least-squares fit algorithm needed

    - by ggkmath
    I've experimented with the two ways of implementing a least-squares fit (LSF) algorithm shown here. The first code is simply the textbook approach, as described by Wolfram's page on LSF. The second code re-arranges the equation to minimize machine errors. Both codes produce similar results for my data. I compared these results with Matlab's p=polyfit(x,y,1) function, using correlation coefficients to measure the "goodness" of fit and compare each of the 3 routines. I observed that while all 3 methods produced good results, at least for my data, Matlab's routine had the best fit (the other 2 routines had similar results to each other). Matlab's p=polyfit(x,y,1) function uses a Vandermonde matrix, V (n x 2 matrix) and QR factorization to solve the least-squares problem. In Matlab code, it looks like: V = [x1,1; x2,1; x3,1; ... xn,1] % this line is pseudo-code [Q,R] = qr(V,0); p = R\(Q'*y); % performs same as p = V\y I'm not a mathematician, so I don't understand why it would be more accurate. Although the difference is slight, in my case I need to obtain the slope from the LSF and multiply it by a large number, so any improvement in accuracy shows up in my results. For reasons I can't get into, I cannot use Matlab's routine in my work. So, I'm wondering if anyone has a more accurate equation-based approach recommendation I could use that is an improvement over the above two approaches, in terms of rounding errors/machine accuracy/etc. Any comments appreciated! thanks in advance.

    Read the article

  • Sorting emails with no To: tags in Outlook

    - by user29589
    Lately people at work have been sending with mailing lists in blind copies instead of just sending to the mailing lists. I think the intent is to prevent people from accidentally replying to all, but it means that these emails aren't sorted into their proper folders when they arrive. I'd like to at least be able to sort them into a common folder, but these emails arrive with no "To:" line in the headers. I'm using Outlook 2007, and I can't figure out a way to use their built-in rule editor to create a rule that sorts these emails. Is there a plugin that will allow me to sort emails like this, or a better rule editor? Updated: I know this is very old, but this is still very annoying to me. Is there any way to sort these kinds of emails to their own folder?

    Read the article

  • Authenticating Mountain Lion over Ubuntu 12 LDAP [closed]

    - by Sam Hammamy
    Possible Duplicate: Ubuntu OpenLDAP and Mac OS X Roaming Profiles I've installed slapd on Ubuntu 12 after a long long day of trial and error. I've added the apple.ldif schema, and the samba.ldif schema, plus a test user. Last week, I had installed slapd on Ubuntu 11, and was able to authenticate against it from OS X Lion after finding the following blog post: Fixing OpenLDAP Authentication on OS X Lion This suggests running the following commands to fix the authentication problem /usr/libexec/PlistBuddy -c "add ':module options:ldap:Denied SASL Methods:' string CRAM-MD5" /Library/Preferences/OpenDirectory/Configurations/LDAPv3/yourldapserver.plist /usr/libexec/PlistBuddy -c "add ':module options:ldap:Denied SASL Methods:' string NTLM" /Library/Preferences/OpenDirectory/Configurations/LDAPv3/yourldapserver.plist /usr/libexec/PlistBuddy -c "add ':module options:ldap:Denied SASL Methods:' string GSSAPI" /Library/Preferences/OpenDirectory/Configurations/LDAPv3/yourldapserver.plist However, I ran these commands on OS X Mountain Lion, and I am still unable to authenticate. I can't even use the Directory Editor app to examine the AD. I am however able to bind to the server via python-ldap's ldap.simple_bind_s('cn=admin,dc=foo,dc=net,'secret'). The error I am getting when trying to use Director Editor is Error Code (5000)

    Read the article

  • Properties!Details (run-time length)

    - by user33666
    When you take clips and turn them into computer playable files, whether .TS or .MOV or .MPG, .MP4, .VOB, etc., do you as the producer actually manually write into some field in a "Details" section of your video editor what the video length is, so that it can be read by the eventual user's video player? Or is this activity performed automatically by the video editor? I'm asking because: when a mouse is passed over a file line item in Windows 7 Shell (Windows Explorer) a little box is displayed where the mouse meets the file line item and provides simple name and size properties, one of which (if it's a media file) is run length. How does that figure get there into the file (later to be read be Windows or OS X)? Thanks for any info.

    Read the article

  • Attempting my first fortran 95 program, to solve quadratic eqn. Getting weird errors.

    - by Damon
    So, I'm attempting my first program in Fortran, trying to solve quadratic eqn. I have double and triple checked my code and don't see anything wrong. I keep getting "Invalid character in name at (1)" and "Unclassifiable statement at (1)" at various locations. Any help would be greatly appreciated... ! This program solves quadratic equations ! of the form ax^2 + bx + c = 0. ! Record: ! Name: Date: Notes: ! Damon Robles 4/3/10 Original Code PROGRAM quad_solv IMPLICIT NONE ! Variables REAL :: a, b, c REAL :: discrim, root1, root2, COMPLEX :: comp1, comp2 CHARACTER(len=1) :: correct ! Prompt user for coefficients. WRITE(*,*) "This program solves quadratic equations " WRITE(*,*) "of the form ax^2 + bx + c = 0. " WRITE(*,*) "Please enter the coefficients a, b, and " WRITE(*,*) "c, separated by commas:" READ(*,*) a, b, c WRITE(*,*) "Is this correct: a = ", a, " b = ", b WRITE(*,*) " c = ", c, " [Y/N]? " READ(*,*) correct IF correct = N STOP IF correct = Y THEN ! Definition discrim = b**2 - 4*a*c ! Calculations IF discrim > 0 THEN root1 = (-b + sqrt(discrim))/(2*a) root2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "This equation has two real roots. " WRITE(*,*) "x1 = ", root1 WRITE(*,*) "x2 = ", root2 IF discrim = 0 THEN root1 = -b/(2*a) WRITE(*,*) "This equation has a double root. " WRITE(*,*) "x1 = ", root1 IF discrim < 0 THEN comp1 = (-b + sqrt(discrim))/(2*a) comp2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "x1 = ", comp1 WRITE(*,*) "x2 = ", comp2 PROGRAM END quad_solv Thanks in advance!

    Read the article

  • Preference List only shows first element

    - by jmunoz
    I am developing a PreferenceActivity with custom Preference views. My problem is that I created a view with a ListView and it only shows the first element. I post my code and an image: http://imageshack.us/photo/my-images/545/sc20120307161530.png/ xml: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:key="player_settings" android:title="@string/settings_player_config" > <EditTextPreference android:defaultValue="@string/settings_player_default_name" android:dialogMessage="@string/settings_player_summary" android:dialogTitle="@string/settings_playersname" android:key="player_name" android:summary="@string/settings_player_summary" android:title="@string/settings_playersname" /> </PreferenceCategory> <PreferenceCategory android:key="volume" android:title="@string/settings_volume" > <com.battleship.preferences.SeekBarPreferences android:defaultValue="50" android:key="volume" android:title="@string/settings_volume" /> </PreferenceCategory> <PreferenceCategory android:key="shine" android:title="@string/settings_shine" > <com.battleship.preferences.SeekBarPreferences android:defaultValue="50" android:key="shine" android:title="@string/settings_shine" /> </PreferenceCategory> <PreferenceCategory android:key="themeTitle" android:title="@string/settings_group_themes" > <com.battleship.preferences.ListPreferences android:key="theme" /> </PreferenceCategory> <PreferenceCategory android:key="fontsTitle" android:title="@string/settings_group_font_size" > <com.battleship.preferences.ListPreferences android:key="font" /> </PreferenceCategory> </PreferenceScreen> The Custom ListPreference: package com.battleship.preferences; import com.battleship.R; import android.content.Context; import android.content.SharedPreferences; import android.media.AudioManager; import android.preference.Preference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.Toast; public class ListPreferences extends Preference implements OnCheckedChangeListener { public ListPreferences(Context context) { super(context); } public ListPreferences(Context context, AttributeSet attrs) { super(context, attrs); } public ListPreferences(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onClick() { super.onClick(); Toast t = Toast.makeText(getContext(), "HOLA!", 3); t.show(); } @Override protected View onCreateView(ViewGroup parent) { String[] contentString = new String[3]; if (getKey().equals("theme")) { contentString = new String[] { (getContext().getString(R.string.settings_theme_default)), (getContext().getString(R.string.settings_theme_black)), (getContext().getString(R.string.settings_theme_white)) }; } else { contentString = new String[] { (getContext().getString(R.string.settings_font_big)), (getContext().getString(R.string.settings_font_medium)), (getContext().getString(R.string.settings_font_little)) }; } ListView listView = new ListView(getContext()); ArrayAdapter<String> array = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_single_choice, android.R.id.text1, contentString); listView.setAdapter(array); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); return listView; } private void updatePreference(int intRadio) { SharedPreferences.Editor editor = getEditor(); editor.putInt(getKey(), intRadio); editor.commit(); } }

    Read the article

  • File association for editing on a mac

    - by Agos
    I'm quite experienced with how file association works for opening files on Mac OS X. I recall reading somewhere that OS X keeps not only the information about which apps can open a file, but also which apps can edit a specific file type. I'm having problems with those applications (Coda, Espresso, Forklift, Flow) that have an “edit with external editor” feature, since issuing this command on HTML files opens them with Dashcode. Dashcode of course is not the current association for opening these files (Safari is), so it's clearly looking for apps that can edit HTML. Since I'd like to use TextMate as my editor in these cases, how can I set this preference?

    Read the article

  • Problem removing registry key with .reg file

    - by TMRW
    Didnt notice this being asked so here i am. I have a problem with specific registry key: NvCplDaemon"="RUNDLL32.EXE C:\\Windows\\system32\\NvCpl.dll,NvStartup" Problem is that i have tried many variations of the reg file like: Windows Registry Editor Version 5.00 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run "NvCplDaemon"=-"RUNDLL32.EXE C:\\Windows\\system32\\NvCpl.dll,NvStartup" and Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] "NvCplDaemon"=-"RUNDLL32.EXE C:\\Windows\\system32\\NvCpl.dll,NvStartup" And they all seemingly complete but the key remains.It is not locked or something.I can delete and recreate it manually any time.Im guessing there is some small spelling error on my file because i think i have followed MS instructions: http://support.microsoft.com/kb/310516 This is how it looks in Registry: Someone?

    Read the article

  • Use launchctl to fire an AppleScript script periodically

    - by Daktari
    I have written an AppleScript that lets me back up a particular file. The script runs fine inside AppleScript Editor: it does what it's supposed to do perfectly. So far so good. Now I'd like to run this script at timed intervals. So I use launchctl & .plist to make this happen. That's where the trouble starts. the script is loaded at set interval by launchctl the AppleScript Editor (when open) brings its window (with that script) to the foreground but no code is executed when AppleScript Editor is not running, nothing seems to be happening at all Any ideas as to why this is not working? -- After editing (as per Daniel Beck's suggestions) my plist now looks like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <false/> <key>Label</key> <string>com.opera.autosave</string> <key>ProgramArguments</key> <array> <string>osascript</string> <string>/Users/user_name/Library/Scripts/opera_autosave_bak.scpt</string> </array> <key>StartInterval</key> <integer>30</integer> </dict> </plist> and the AppleScript I'm trying to run: on appIsRunning(appName) tell application "System Events" to (name of processes) contains appName end appIsRunning --only run this script when Opera is running if appIsRunning("Opera") then set base_path to "user_name:Library:Preferences:Opera Preferences:sessions:" set autosave_file to "test.txt" set autosave_file_old to "test_old.txt" set autosave_file_older to "test_older.txt" set autosave_file_oldest to "test_oldest.txt" set autosave_path to base_path & autosave_file set autosave_path_old to base_path & autosave_file_old set autosave_path_older to base_path & autosave_file_older set autosave_path_oldest to base_path & autosave_file_oldest set copied_file to "test copy.txt" set copied_path to base_path & copied_file tell application "Finder" duplicate file autosave_path delete file autosave_path_oldest set name of file autosave_path_older to autosave_file_oldest set name of file autosave_path_old to autosave_file_older set name of file copied_path to autosave_file_old end tell end if

    Read the article

  • LaTex, align alignment characters between align blocks

    - by ccook
    I would like to align two alignment characters between two align blocks so that I can have some text in the middle of a derivation with equations maintaining the horizontal alignment. For example the following excerpt of latex using align \begin{align*} \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\ & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] \end{align*} some text in the middle \begin{align*} & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] \end{align*} Ideally I would like the left of the equation in the second block to line up with that of the second equation in the first block. I could do a workaround by not having text in the middle, however, I would like this functionality. EDIT I would like to have a good amount of text between. Say three to four lines that line up as normal paragraphs. Adding text in the alignment block is the workaround I poorly alluded to.

    Read the article

  • Scheme Infix to Postfix

    - by Cody
    Let me establish that this is part of a class assignment, so I'm definitely not looking for a complete code answer. Essentially we need to write a converter in Scheme that takes a list representing a mathematical equation in infix format and then output a list with the equation in postfix format. We've been provided with the algorithm to do so, simple enough. The issue is that there is a restriction against using any of the available imperative language features. I can't figure out how to do this in a purely functional manner. This is our fist introduction to functional programming in my program. I know I'm going to be using recursion to iterate over the list of items in the infix expression like such. (define (itp ifExpr) ( ; do some processing using cond statement (itp (cdr ifExpr)) )) I have all of the processing implemented (at least as best I can without knowing how to do the rest) but the algorithm I'm using to implement this requires that operators be pushed onto a stack and used later. My question is how do I implement a stack in this function that is available to all of the recursive calls as well?

    Read the article

  • Applescript cannot find sed during application install

    - by jsmorris
    I am attempting to install an application, but the installer fails with the following error message: sh: sed: command not found and there is an Edit and OK button in the dialog, so I click the Edit button which launches the AppleScript Editor to show me the script that is executing. Running it from within the Editor doesn't work either. The first line of the script with sed is set currdir_modified to do shell script ("echo " & currdir & " | sed 's/ /\\ /g'") I went to the terminal to make sure sed was available, and it is, in /usr/bin. This sounds like a path problem, but I am not sure where to go from here. What can I do to further troubleshoot or solution this issue? I have successfully installed this app on another mac running the same OS X version, so it is specific to my mac and the application's support is not providing any more help because it is my mac's problem, not theirs.

    Read the article

  • Paint.NET equivalent for Linux?

    - by Macha
    On Windows, my favorite image editor is Paint.NET. However, on Linux, GIMP is as unfriendly as photoshop despite having less features. (i.e. It takes ages to load, their's far too much stuff). Most of my image editing is simple things where Photoshop or GIMP would be overkill. Paint.NET does not run on Wine or Mono. So is there any similar fast and simple but powerful image editor available for Linux? EDIT: There is a Mono version available, but I don't want to have to deal with installing svn versions of mono, and compiling the version myself.

    Read the article

  • Extjs4: editable rowbody

    - by peter
    in my first ExtJs4 project i use a editable grid with the feature rowbody to have a big textfield displayed under each row. I want it to be editable on a dblclick. I succeeded in doing so by replacing the innerHTML of the rowbody by a textarea but the special keys don't do what they are supposed to do (move the cursor). If a use the textarea in a normal field i don't have this probem. Same problem in IE7 and FF4 gridInfo = Ext.create('Ext.ux.LiveSearchGridPanel', { id: 'gridInfo', height: '100%', width: '100%', store: storeInfo, columnLines: true, selType: 'cellmodel', columns: [ {text: "Titel", flex: 1, dataIndex: 'titel', field:{xtype:'textfield'}}, {text: "Tags", id: "tags", flex: 1, dataIndex: 'tags', field:{xtype:'textfield'}}, {text: "Hits", dataIndex: 'hits'}, {text: "Last Updated", renderer: Ext.util.Format.dateRenderer('d/m/Y'), dataIndex: 'lastChange'} ], plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ], features: [ { ftype: 'rowbody', getAdditionalData: function(data, idx, record, orig) { var headerCt = this.view.headerCt, colspan = headerCt.getColumnCount(); return { rowBody: data.desc, //the big textfieldvalue, can't use a textarea here 8< rowBodyCls: this.rowBodyCls, rowBodyColspan: colspan }; } }, {ftype: 'rowwrap'} ] }); me.on('rowbodydblclick', function(gridView, el, event, o) { ... rb = td.down('.x-grid-rowbody').dom; var value = rb.innerText?rb.innerText:rb.textContent; rb.innerHTML = ''; Ext.create('Ext.form.field.TextArea', { id: 'textarea1', value : value, renderTo: rb, border: false, enterIsSpecial: true, enableKeyEvents: true, disableKeyFilter: true, listeners: { 'blur': function(el, o) { rb.innerHTML = el.value; }, 'specialkey': function(field, e){ console.log(e.keyCode); //captured but nothing happens } } }).show(); damn, can't publish my own solution, looks like somebody else has to answer, anyway, here is the function that works function editDesc(me, gridView, el, event, o) { var width = Ext.fly(el).up('table').getWidth(); var rb = event.target; var value = rb.innerText?rb.innerText:rb.textContent; rb.innerHTML = '' var txt = Ext.create('Ext.form.field.TextArea', { value : value, renderTo: rb, border: false, width: width, height: 300, enterIsSpecial: true, disableKeyFilter: true, listeners: { 'blur': function(el, o) { var value = el.value.replace('\n','<br>') rb.innerHTML = value; }, 'specialkey': function(field, e){ e.stopPropagation(); } } }); var txtTextarea = Ext.fly(rb).down('textarea'); txtTextarea.dom.style.color = 'blue'; txtTextarea.dom.style.fontSize = '11px'; } Hi Molecule Man, as an alternative to the approach above i tried the Ext.Editor. It works but i want it inline but when i render it to the rowbody, the field blanks and i have no editor, any ideas ? gridInfo = Ext.create('Ext.grid.Panel', { id: 'gridInfo', height: '100%', width: '100%', store: storeInfo, columnLines: true, selType: 'cellmodel', viewConfig: {stripeRows: false, trackOver: true}, columns: [ {text: "Titel", flex: 1, dataIndex: 'titel', field:{xtype:'textfield'}}, ... {text: "Last Updated", renderer: Ext.util.Format.dateRenderer('d/m/Y'), dataIndex: 'lastChange'} ], plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ], features: [ { ftype: 'rowbody', getAdditionalData: function(data, idx, record, orig) { var headerCt = this.view.headerCt, colspan = headerCt.getColumnCount(); return { rowBody: data.desc, rowBodyCls: this.rowBodyCls, rowBodyColspan: colspan }; } } ], listeners:{ rowbodyclick: function(gridView, el, event) { //werkt editDesc(this, gridView, el, event); } } }); function editDesc(me, gridView, el, event, o) { var rb = event.target; me.txt = new Ext.Editor({ field: {xtype: 'textarea'}, updateEl: true, cancelOnEsc: true, floating: true, renderTo: rb //when i do this, the field becomes empty and i don't get the editor }); me.txt.startEdit(el); }

    Read the article

  • Cropped thumbnails in WordPress

    - by codethief
    Quote from Wordpress' image editor: The thumbnail image can be cropped differently. For example it can be square or contain only a portion of the original image to showcase it better. Here you can select whether to apply changes to all image sizes or make the thumbnail different. This is exactly what I'd like to do, except for the fact that I don't want Wordpress to scale it down to 150x150 pixels (or another predefined resolution). I'd just like to display a cropped (and therefore smaller) version of the picture which is then linked to the (uncropped) original. I also tried to set the thumbnails' width and height to 0 in the preferences. Then, however, I don't even get the chance to assign a cropped version as thumbnail in the editor. Could you tell me how to achieve that? Or isn't it possible at all?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >