Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 54/604 | < Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >

  • Adding a external jar reference in Android.mk

    - by Karan
    I want to add a external third party jar file in the inbuilt android app. I've added the LOCAL_CLASSPATH variable in Android.mk due to which the compilation goes fine. But during runtime, it is not able to find the class definiation which is in the JAR. Which is the variable I need to set to add the third party JARs in the .dex/.apk ? TIA.

    Read the article

  • Entity Framework: insert with one-to-one reference

    - by bomortensen
    Hi 'overflow! I'm having a bit trouble inserting into a mssql database using Entity Framework. There's two tables that I want to insert into, where one of table 1s fields is a foreign key in table2. This is the code I have so far: Media media = null; foreach(POI p in poiList) { media = new Media() { Path = p.ImagePath, Title = p.Title }; if (media != null && !context.Media.Any(me => me.Title == p.ImageTitle)) { context.AddToMedia(media); context.SaveChanges(); } PointOfInterest poi = new PointOfInterest() { Altitude = 2000.0, ID = p.ID, Latitude = p.Latitude, Longitude = p.Longitude, LatitudeRoute = p.LatitudeRoute, LongitudeRoute = p.LongitudeRoute, Description = p.Description, Title = p.Title, DefaultImageID = media.ID, }; context.AddToPointOfInterest(poi); } context.SaveChanges(); The following gives me this error: An object with the same key already exists in the ObjectStateManagerAn object with the same key already exists in the ObjectStateManager I'm still learning how to use the entity framework, so I don't even know if this would be the right approach to insert into two referenced tables. Can anyone enlighten me on this? :) Any help would be greatly appreciated! Thanks!

    Read the article

  • passing timezone from client (GWT) to server (Joda Time)

    - by Caffeine Coma
    I'm using GWT on the client (browser) and Joda Time on the server. I'd like to perform some DB lookups bounded by the day (i.e. 00:00:00 until 23:59:59) that a request comes in, with the time boundaries based on the user's (i.e. browser) timezone. So I have the GWT code do a new java.util.Date() to get the time of the request, and send that to the server. Then I use Joda Time like so: new DateTime(clientDate).toDateMidnight().toDateTime() The trouble of course is that toDateMidnight(), in the absence of a specified TimeZone, will use the system's (i.e. the server's) TimeZone. I've been trying to find a simple way to pass the TimeZone from the browser to the server without much luck. In GWT I can get the GMT offset with: DateTimeFormat.getFormat("Z").fmt(new Date()) which results in something like "-0400". But Joda Time's DateTimeZone.forID() wants strings formatted like "America/New_York", or an integer argument of hours and minutes. Of course I can parse "-0400" into -4 hours and 0 minutes, but I'm wondering if there is not a more straightforward way of doing this.

    Read the article

  • Am i passing values or adresses? [Java]

    - by Samuel
    Hello World, I am new to java and i was asking myself, if i have a class 'Example' and somewhere i make a: Example example1 = new Example(); and i add some stuff to it, lets say example1.setExampleBoolean(false); and now i make: Example example2 = example1; example2.setExampleBoolean(true); Did i say with Example example2 = example1 let example2 point to the same adress as example1? Because than i would have altered example1. In other words would, using something like: Boolean exampleBoolean = example1.getExampleBoolean(); exampleBoolean be true of false? Might be a stupid questions but for me it would change the way i'd handle problems in my programs :) Thanks in advance -Samuel

    Read the article

  • Installing Python Script, Maintaining Reference to Python 2.6

    - by zfranciscus
    Hi, I am writing a Python program that relies on version 2.6. I went through the distribution documentation: http://docs.python.org/distutils/index.html and what I have figure out so far is that I basically need to write a setup.py script. Something like: setup(name='Distutils', version='1.0', description='Python Distribution Utilities', author='My Name', author_email='My Email', url='some URL', package_dir={'': 'src'}, packages=[''], ) I would like to ensure that my program uses 2.6 interpreter library. What would be the best approach to ensure that my program uses 2.6 ? Shall I distribute python 2.6 library along with my program ? Is there any alternative approach ?

    Read the article

  • Spring security - Reach users ID without passing it through every controller

    - by nilsi
    I have a design issue that I don't know how to solve. I'm using Spring 3.2.4 and Spring security 3.1.4. I have a Account table in my database that looks like this: create table Account (id identity, username varchar unique, password varchar not null, firstName varchar not null, lastName varchar not null, university varchar not null, primary key (id)); Until recently my username was just only a username but I changed it to be the email address instead since many users want to login with that instead. I have a header that I include on all my pages which got a link to the users profile like this: <a href="/project/users/<%= request.getUserPrincipal().getName()%>" class="navbar-link"><strong><%= request.getUserPrincipal().getName()%></strong></a> The problem is that <%= request.getUserPrincipal().getName()%> returns the email now, I don't want to link the user's with thier emails. Instead I want to use the id every user have to link to the profile. How do I reach the users id's from every page? I have been thinking of two solutions but I'm not sure: Change the principal to contain the id as well, don't know how to do this and having problem finding good information on the topic. Add a model attribute to all my controllers that contain the whole user but this would be really ugly, like this. Account account = entityManager.find(Account.class, email); model.addAttribute("account", account); There are more way's as well and I have no clue which one is to prefer. I hope it's clear enough and thank you for any help on this. ====== Edit according to answer ======= I edited Account to implement UserDetails, it now looks like this (will fix the auto generated stuff later): @Entity @Table(name="Account") public class Account implements UserDetails { @Id private int id; private String username; private String password; private String firstName; private String lastName; @ManyToOne private University university; public Account() { } public Account(String username, String password, String firstName, String lastName, University university) { this.username = username; this.password = password; this.firstName = firstName; this.lastName = lastName; this.university = university; } public String getUsername() { return username; } public String getPassword() { return password; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public void setUsername(String username) { this.username = username; } public void setPassword(String password) { this.password = password; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public University getUniversity() { return university; } public void setUniversity(University university) { this.university = university; } public int getId() { return id; } public void setId(int id) { this.id = id; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { // TODO Auto-generated method stub return null; } @Override public boolean isAccountNonExpired() { // TODO Auto-generated method stub return false; } @Override public boolean isAccountNonLocked() { // TODO Auto-generated method stub return false; } @Override public boolean isCredentialsNonExpired() { // TODO Auto-generated method stub return false; } @Override public boolean isEnabled() { // TODO Auto-generated method stub return true; } } I also added <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> To my jsp files and trying to reach the id by <sec:authentication property="principal.id" /> This gives me the following org.springframework.beans.NotReadablePropertyException: Invalid property 'principal.id' of bean class [org.springframework.security.authentication.UsernamePasswordAuthenticationToken]: Bean property 'principal.id' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? ====== Edit 2 according to answer ======= I based my application on spring social samples and I never had to change anything until now. This are the files I think are relevant, please tell me if theres something you need to see besides this. AccountRepository.java public interface AccountRepository { void createAccount(Account account) throws UsernameAlreadyInUseException; Account findAccountByUsername(String username); } JdbcAccountRepository.java @Repository public class JdbcAccountRepository implements AccountRepository { private final JdbcTemplate jdbcTemplate; private final PasswordEncoder passwordEncoder; @Inject public JdbcAccountRepository(JdbcTemplate jdbcTemplate, PasswordEncoder passwordEncoder) { this.jdbcTemplate = jdbcTemplate; this.passwordEncoder = passwordEncoder; } @Transactional public void createAccount(Account user) throws UsernameAlreadyInUseException { try { jdbcTemplate.update( "insert into Account (firstName, lastName, username, university, password) values (?, ?, ?, ?, ?)", user.getFirstName(), user.getLastName(), user.getUsername(), user.getUniversity(), passwordEncoder.encode(user.getPassword())); } catch (DuplicateKeyException e) { throw new UsernameAlreadyInUseException(user.getUsername()); } } public Account findAccountByUsername(String username) { return jdbcTemplate.queryForObject("select username, firstName, lastName, university from Account where username = ?", new RowMapper<Account>() { public Account mapRow(ResultSet rs, int rowNum) throws SQLException { return new Account(rs.getString("username"), null, rs.getString("firstName"), rs.getString("lastName"), new University("test")); } }, username); } } security.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <http pattern="/resources/**" security="none" /> <http pattern="/project/" security="none" /> <http use-expressions="true"> <!-- Authentication policy --> <form-login login-page="/signin" login-processing-url="/signin/authenticate" authentication-failure-url="/signin?error=bad_credentials" /> <logout logout-url="/signout" delete-cookies="JSESSIONID" /> <intercept-url pattern="/addcourse" access="isAuthenticated()" /> <intercept-url pattern="/courses/**/**/edit" access="isAuthenticated()" /> <intercept-url pattern="/users/**/edit" access="isAuthenticated()" /> </http> <authentication-manager alias="authenticationManager"> <authentication-provider> <password-encoder ref="passwordEncoder" /> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select username, password, true from Account where username = ?" authorities-by-username-query="select username, 'ROLE_USER' from Account where username = ?"/> </authentication-provider> <authentication-provider> <user-service> <user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" /> </user-service> </authentication-provider> </authentication-manager> </beans:beans> And this is my try of implementing a UserDetailsService public class RepositoryUserDetailsService implements UserDetailsService { private final AccountRepository accountRepository; @Autowired public RepositoryUserDetailsService(AccountRepository repository) { this.accountRepository = repository; } @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Account user = accountRepository.findAccountByUsername(username); if (user == null) { throw new UsernameNotFoundException("No user found with username: " + username); } return user; } } Still gives me the same error, do I need to add the UserDetailsService somewhere? This is starting to be something else compared to my initial question, I should maybe start another question. Sorry for my lack of experience in this. I have to read up.

    Read the article

  • passing json from servlet to dojo

    - by Moev4
    I am currently trying to pass a generated JSON string to dojo for parsing and am having some issues. The servlet simply writes it as a string as so: response.getWriter().append("{ \"data\": {"); response.getWriter().append("\"type\": \"facing\","); response.getWriter().append("\"score\": " + "\"" + score + "\","); response.getWriter().append("\"count\":" + "\"" + count + "\"" ); response.getWriter().append("}}"); which prints as: {"data":{"type":"facing","score":"10","count":"24"}} And the parsing on the dojo end looks as so: dojo.xhrPost({ url: url, handleAs: "json", load: function(data) { alert(data); /* Parse Not working */ alert(data.data[0].type); }, error: function(error) { alert("No dice") } }); The main issue is the data.data[0].type is returning nothing but when i print this out as text the json seems to be correctly formatted. Any help with this would be appreciated.

    Read the article

  • Passing in defaults within window.onload?

    - by Matrym
    I now understand that the following code will not work because I'm assigning window.onload to the result of the function, not the function itself. But if I remove the parens, I suspect that I have to explicitly call a separate function to process the config before the onload. So, where I now have: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <script type="text/javascript" src="lb-core.js"></script> <script type="application/javascript"> var lbp = { defaults: { color: "blue" }, init: function(config) { if(config) { for(prop in config){ setBgcolor.defaults[prop] = config[prop]; } } var bod = document.body; bod.style.backgroundColor = setBgcolor.defaults.color; } } var config = { color: "green" } window.onload = lbp.init(config); </script> </HEAD> <body> <div id="container">test</div> </body> </HTML> I imagine I would have to change it to: var lbp = { defaults: { color: "blue" }, configs: function(config){ for(prop in config){ setBgcolor.defaults[prop] = config[prop]; } }, init: function() { var bod = document.body; bod.style.backgroundColor = setBgcolor.defaults.color; } } var config = { color: "green" } lbp.configs(config); window.onload = lbp.init; Then, for people to use this script and pass in a configuration, they would need to call both of those bottom lines separately (configs and init). Is there a better way of doing this? Note: If your answer is to bundle a function of window.onload, please also confirm that it is not hazardous to assign window.onload within scripts. It's my understanding that another script coming after my own could, in fact, overwrite what I'd assigned to onload.

    Read the article

  • Avoiding unsafe cast for generic situation involving runtime passing of class

    - by Bart van Heukelom
    public class AutoKeyMap<K,V> { public interface KeyGenerator<K> { public K generate(); } private KeyGenerator<K> generator; public AutoKeyMap(Class<K> keyType) { // WARNING: Unchecked cast from AutoKeyMap.IntKeyGen to AutoKeyMap.KeyGenerator<K> if (keyType == Integer.class) generator = (KeyGenerator<K>) new IntKeyGen(); else throw new RuntimeException("Cannot generate keys for " + keyType); } public void put(V value) { K key = generator.generate(); ... } private static class IntKeyGen implements KeyGenerator<Integer> { private final AtomicInteger ai = new AtomicInteger(1); @Override public Integer generate() { return ai.getAndIncrement(); } } } In the code sample above, what is the correct way to prevent the given warning, without adding a @SuppressWarnings, if any?

    Read the article

  • Passing a custom variable to the PayPal API

    - by Michael
    Gday All, I am developing a site that uses PayPal to take online payments. I need to be able to send my client an email with the link to PayPal in order to pay. In this link I need a way to set a unique value (for example bookingId) that I can use to add the receipt number to the correct booking via PayPal's payment notification feature. Does anyone know what custom value I can set in order to achieve this? Cheers, Michael

    Read the article

  • Python Class which checks input before passing to console (C) program

    - by Joseph Melettukunnel
    Hello, We are asked to write a web-frontend (in python) for a very complex (and old) console application, written in C. Since we have no access to the C Source Code, and we assume that there might be some unsafe methods, we'd like to check the input which will the passed to the console application. WebClient - Python Module - Console Application Do you have any suggestions or tips what we should check for? Right now we are only limiting the string length and filtering some (program specific) unallowed keywords. Thanks, Joseph EDIT: Will remove strings like %s because of format string attacks

    Read the article

  • Ruby: Passing optional objects to method

    - by Sam
    Class TShirt def size(suggested_size) if suggested_size == nil size = "please choose a size" else size = suggested end end end tshirt = TShirt.new tshirt.size("M") == "M" tshirt = TShirt.new size = tshirt.size(nil) == "please choose a size" What is a better way to have optional objects in a method? Procs?

    Read the article

  • Uploadify - Passing Information Back to The Original Form

    - by CccTrash
    I have an Send.aspx page that has an uploadify control on it. Upload.ashx handles the file upload. I am adding a file record to a sql database in the Upload.ashx file and I need to get the ID of that record back from Upload.aspx when it is done. Can't get it working with Sessions. =( Something to do with an Adobe bug? What would the best way to handle this be? Here is the uploadify control: <script type="text/javascript"> // <![CDATA[ var contestID = $('[id$=HiddenFieldContestID]').val(); var maxEntries = $('[id$=HiddenFieldMaxEntries]').val(); var userID = $('[id$=HiddenFieldUserID]').val(); $(document).ready(function() { $('#fileInput').uploadify({ 'uploader': '../uploadify/uploadify.swf', 'script': '../uploadify/Upload.ashx', 'scriptData': { 'contestID': contestID, 'maxEntries': maxEntries, 'userID': userID }, 'cancelImg': '../uploadify/cancel.png', 'auto': true, 'multi': false, 'fileDesc': 'Image Files', 'fileExt': '*.jpg;*.png;*.jpeg', 'queueSizeLimit': 1, 'sizeLimit': 4000000, 'buttonText': 'Choose Image', 'folder': '/uploads', 'onAllComplete': function(event, queueID, fileObj, response, data) { document.getElementById('<%= ButtonCleanup.ClientID %>').click(); } }); }); // ]]></script> Edit: See Answer below... Video Tutorial from start to finish: http://casonclagg.com/articles/6/video-tutorial-uploadify-asp-net-c-sharp.aspx

    Read the article

  • link_to passing paramater and display problem - tag feature - Ruby on Rails

    - by bgadoci
    I have gotten a great deal of help from KandadaBoggu on my last question and very very thankful for that. As we were getting buried in the comments I wanted to break this part out. I am attempting to create a tag feature on the rails blog I am developing. The relationship is Post has_many :tags and Tag belongs_to :post. Adding and deleting tags to posts are working great. In my /view/posts/index.html.erb I have a section called tags where I am successfully querying the Tags table, grouping them and displaying the count next to the tag_name (as a side note, I mistakenly called the column containing the tag name, 'tag_name' instead of just 'name' as I should have) . In addition the display of these groups are a link that is referencing the index method in the PostsController. That is where the problem is. When you navigate to /posts you get an error because there is no parameter being passed (without clicking the tag group link). I have the .empty? in there so not sure what is going wrong here. Here is the error and code: Error You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.empty? /views/posts/index.html.erb <% @tag_counts.each do |tag_name, tag_count| %> <tr> <td><%= link_to(tag_name, posts_path(:tag_name => tag_name)) %></td> <td>(<%=tag_count%>)</td> </tr> <% end %> PostsController def index @tag_counts = Tag.count(:group => :tag_name, :order => 'updated_at DESC', :limit => 10) @posts=Post.all(:joins => :tags,:conditions=>(params[:tag_name].empty? ? {}: { :tags => { :tag_name => params[:tag_name] }} ) ) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } format.json { render :json => @posts } format.atom end end

    Read the article

  • Passing Multiple parameters from Custome WebPart to Reporting services Report Viewer webpart

    - by venkatcitigori
    I working with Reporting services in Sharepoint Mode, I am able to show the report in Sql Server Reporting services report viwer , the report has multiple parameters , My question is how do I pass more thatn one parameter from a custome web part to this report. I am able to pass one parameter by implementing the ITransformableFilterValues interface in the custom webpart , what I want to do is pass more than one parameter . Ex: If there are 2 parameters on report then i should able to map each from the control in webpart. Any help or guidance is appreciated.

    Read the article

  • Passing integer lists in a sql query, best practices

    - by Artiom Chilaru
    I'm currently looking at ways to pass lists of integers in a SQL query, and try to decide which of them is best in which situation, what are the benefots of each, and what are the pitfalls, what should be avoided :) Right now I know of 3 ways that we currently use in our application. 1) Table valued parameter: Create a new Table Valued Parameter in sql server: CREATE TYPE [dbo].[TVP_INT] AS TABLE( [ID] [int] NOT NULL ) Then run the query against it: using (var conn = new SqlConnection(DataContext.GetDefaultConnectionString)) { var comm = conn.CreateCommand(); comm.CommandType = CommandType.Text; comm.CommandText = @" UPDATE DA SET [tsLastImportAttempt] = CURRENT_TIMESTAMP FROM [Account] DA JOIN @values IDs ON DA.ID = IDs.ID"; comm.Parameters.Add(new SqlParameter("values", downloadResults.Select(d => d.ID).ToDataTable()) { TypeName = "TVP_INT" }); conn.Open(); comm.ExecuteScalar(); } The major disadvantages of this method is the fact that Linq doesn't support table valued params (if you create an SP with a TVP param, linq won't be able to run it) :( 2) Convert the list to Binary and use it in Linq! This is a bit better.. Create an SP, and you can run it within linq :) To do this, the SP will have an IMAGE parameter, and we'll be using a user defined function (udf) to convert this to a table.. We currently have implementations of this function written in C++ and in assembly, both have pretty much the same performance :) Basically, each integer is represented by 4 bytes, and passed to the SP. In .NET we have an extension method that convers an IEnumerable to a byte array The extension method: public static Byte[] ToBinary(this IEnumerable intList) { return ToBinaryEnum(intList).ToArray(); } private static IEnumerable<Byte> ToBinaryEnum(IEnumerable<Int32> intList) { IEnumerator<Int32> marker = intList.GetEnumerator(); while (marker.MoveNext()) { Byte[] result = BitConverter.GetBytes(marker.Current); Array.Reverse(result); foreach (byte b in result) yield return b; } } The SP: CREATE PROCEDURE [Accounts-UpdateImportAttempts] @values IMAGE AS BEGIN UPDATE DA SET [tsLastImportAttempt] = CURRENT_TIMESTAMP FROM [Account] DA JOIN dbo.udfIntegerArray(@values, 4) IDs ON DA.ID = IDs.Value4 END And we can use it by running the SP directly, or in any linq query we need using (var db = new DataContext()) { db.Accounts_UpdateImportAttempts(downloadResults.Select(d => d.ID).ToBinary()); // or var accounts = db.Accounts .Where(a => db.udfIntegerArray(downloadResults.Select(d => d.ID).ToBinary(), 4) .Select(i => i.Value4) .Contains(a.ID)); } This method has the benefit of using compiled queries in linq (which will have the same sql definition, and query plan, so will also be cached), and can be used in SPs as well. Both these methods are theoretically unlimited, so you can pass millions of ints at a time :) 3) The simple linq .Contains() It's a more simple approach, and is perfect in simple scenarios. But is of course limited by this. using (var db = new DataContext()) { var accounts = db.Accounts .Where(a => downloadResults.Select(d => d.ID).Contains(a.ID)); } The biggest drawback of this method is that each integer in the downloadResults variable will be passed as a separate int.. In this case, the query is limited by sql (max allowed parameters in a sql query, which is a couple of thousand, if I remember right). So I'd like to ask.. What do you think is the best of these, and what other methods and approaches have I missed?

    Read the article

  • Passing a string in Html.ActionLink in MVC 2

    - by 109221793
    I have completed the MVC Music Store application, and now am making my own modifications for practice, and also to prepare me to do similar tasks in my job. What I have done, is create a view that displays the current list of users. I have done this as I want to be able to change the passwords of users should they forget them. Here is a snippet from my view: <% foreach (MembershipUser user in Model) { %> <tr> <td><%: Html.ActionLink(user.UserName, "changeUserPassword", "StoreManager", new { username = user.UserName }) %></td> <td><%: user.LastActivityDate %></td> <td><%: user.IsLockedOut %></td> </tr> <% }%> What I want to know, is it possible to pass the username through the actionlink as I have done above. I have registered the following route in the global.asax.cs file, however I am unsure if I have done it correctly: routes.MapRoute( "AdminPassword", //Route name "{controller}/{action}/{username}", //URL with parameters new { controller = "StoreManager", action = "changeUserPassword", username = UrlParameter.Optional }); Here is my GET action: public ActionResult changeUserPassword(string username) { ViewData["username"] = username; return View(); } I have debugged through the code to find that ViewData["username"] = username doesn't populate so it looks like either I have not registered the routes properly, or I simply cannot pass the username using the actionlink like I have. I'd be grateful if someone could point me in the right direction.

    Read the article

  • WiX - Passing parameters to a CustomAction (DLL)

    - by glenneroo
    I've got a DLL from an old WiSE installer that i'm trying to get working in WiX, so i'm pretty sure the DLL works with MSI-based installers. Here is my definition: <Binary Id="SetupDLL" SourceFile="../Tools/Setup.dll" /> <CustomAction Id="ReadConfigFiles" BinaryKey="SetupDLL" DllEntry="readConfigFiles" /> and usage: <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="ReadConfigFiles" Order="3">1</Publish> Where exactly can I pass in parameters?

    Read the article

  • Adding rows to UItableview and passing data between Viewcontrollers

    - by Jonathan
    I have a list of websites in a plist, when the app loads this populates a tableview (which is inside a navigation controller) But I have added an add button to the navigation bar and then created another View Controller to deal with inputting of the new website (Like Title and URL). It is very similar to how the contacts app looks. There is a table view and when you tap add, the add UI slides up. I have got all this working great so far. My Problem is what happens when the user taps Done. I can add the website to the plist (each website is a dictionary in the plist with 2 keys, atm) But then how do I tell the tableView to update? The table view has not been removed from the main window, just the add view has been added on top of the "screen". Another way of asking is, when you tap Save on Add a Contact screen: (not my image) How does the new contact's data (Xyz's data) get shown on the tableview?

    Read the article

  • Passing context between templatetags, django

    - by Kasper Gadensgaard
    Hi overflowers, I am using django to create a web-application. I have created a template in where I load a templatetag. In this templatetag i load another templatetag. From the template I pass context to the first templatetag, but the context is not available from the second templatetag (inside the first templatetag) - see below. I hope this makes sense, and that one of you have the answer. Thanks in advance Regards Kasper Gadensgaard Template snippit: {% load templatetags %} {% some_tag argument %} some_tag Templatetag: {% load templatetags %} {% some_other_tag another_argument %} some_other_tag Templatetag: In this templatetag i am trying to access context to get user info i.e. using request = context['request'] request.user

    Read the article

  • invalid property id error while passing data in json format

    - by robezy
    I have a some data in JSON format(which comes from php) to be passed to a javascript function. I'm getting 'invalid property id' error when I try to do this. Error: invalid property id Source File: http://localhost/MathVoyager/index.php/test Line: 1, Column: 15 Source Code: draw_quadratic({ Below is the js function signature(both data and options are in JSON format) function draw_quadratic(data, options, alpha, beta) Below is a sample function call. `draw_quadratic({"label":"(((1)*x^((1))+(4))*((1)*x^((1))+(6))) = (0)","data":[[-8,8],[-7.5,5.25],[-7,3],[-6.5,1.25],[-6,0],[-5.5,-0.75],[-5,-1],[-4.5,-0.75],[-4,0],[-3.5,1.25],[-3,3],[-2.5,5.25],[-2,8]],"xaxis":1,"yaxis":1}, {"series":{"points":{"show":true},"lines":{"show":true}},"grid":{"hoverable":true,"clickable":true}}, 4, 8); ` (I'm trying to plot some graph using flot js library) Thanks in advance

    Read the article

  • passing a fortran int array to C++ by calling C++ function in fortran

    - by cppb
    hi, I am trying to call a C++ function in FORTRAN subroutine. This C+ function is supposed to update an integer array. Here is a non-working code I wrote. Can someone please let me know what the issue is: ! FORTRAN function that calls a C++ function subroutine my_function() integer(4) ar(*) integer(4) get_filled_ar ! Need correct syntax here. ar = get_filled_ar() end // C++ function: extern "C" { void get_filled_ar(int *ar){ ar[0] = 1; ar[1] = 10; ar[3] = 100; } }

    Read the article

  • WCF - Passing CurrentPrincipal in the Header

    - by David Ward
    I have a WCF service that needs to know the Principal of the calling user. In the constructor of the service I have: Principal = OperationContext.Current.IncomingMessageHeaders.GetHeader<MyPrincipal>("myPrincipal", "ns"); and in the calling code I have something like: using (var factory = new ChannelFactory<IMyService>(localBinding, endpoint)) { var proxy = factory.CreateChannel(); using (var scope = new OperationContextScope((IContextChannel)proxy)) { var customHeader = MessageHeader.CreateHeader("myPrincipal", "ns", Thread.CurrentPrincipal); OperationContext.Current.OutgoingMessageHeaders.Add(customHeader); newList = proxy.CreateList(); } } This all works fine. My question is, how can I avoid having to wrap all proxy method calls in the using (var scope...{ [create header and add to OperationContext]? Could I create a custom ChannelFactory that will handle adding the myPrincipal header to the operation context? Something like that would save a whole load of copy/paste which I'd rather not do but I'm not sure how to achieve it:) Thanks

    Read the article

  • Custom IIdentity and passing data from an attribute to a controller

    - by DM
    Here's my scenario: I've successfully created a custom IIdentity that I pass to a GenericPrincipal. When I access that IIdentity in my controller I have to cast the IIdentity in order to use the custom properties. example: public ActionResult Test() { MyCustomIdentity identity = (MyCustomIdentity)User.Identity; int userID = identity.UserID; ...etc... } Since I need to do this casting for nearly every action I would like to wrap this functionality in an ActionFilterAttribute. I can't do it in the controller's constructor because the context isn't initialized yet. My thought would be to have the ActionFilterAttribute populate a private property on the controller that I can use in each action method. example: public class TestController : Controller { private MyCustomIdentity identity; [CastCustomIdentity] public ActionResult() { int userID = identity.UserID; ...etc... } } Question: Is this possible and how? Is there a better solution? I've racked my brain trying to figure out how to pass public properties that are populated in an attribute to the controller and I can't get it.

    Read the article

  • Japanese text garbled while passing to a http restlet service

    - by satish-gunuputi
    Hi , I have a perl client which is calling a http restlet service (put method). Some of the parameters in this call contain japanese text. when I printed the contents of these request parameters in the restlet service I found these chars garbled ! This is my PERL client code: my %request_headers = ( 'DocumentName' => $document_name, --> This name is a JAPANESE String 'DocumentDescription' => 'Test Japanese Chars', 'content-length' => 200, 'Content-Type' => 'application/octet-stream; charset=utf-8', 'User-Agent' => "JPCharTester", ); $s-write_request('PUT', '/test-document/TEST/TEST_DOCUMENT' , %request_headers, $content); in this call both the values of $context and $document_name are JAPANESE Strings. But ONLY the document_name is received as garbled in my backend service. Here goes the Service code: String URL_ENCODING = "UTF-8"; String documentName = requestHeaders.getFirstValue("DocumentName"); System.out.println("Encoded Document Name : "+documentName+" <<<"); --> documentName is garbled here try { documentName = URLDecoder.decode(documentName, URL_ENCODING); System.out.println(>>> Decoded Document Name : "+documentName+" <<<"); --> documentName is garbled here } catch (java.io.UnsupportedEncodingException ex) { throwException(ex.getMessage(), Status.SERVER_ERROR_INTERNAL, ex); } both the above log statements printed GARBLED TEXT !! Can someone tell me what is the mistake I am doing and how to fix this ? Thanks in advance for your help. Regards, Satish.

    Read the article

< Previous Page | 50 51 52 53 54 55 56 57 58 59 60 61  | Next Page >