Search Results

Search found 12222 results on 489 pages for 'initial context'.

Page 167/489 | < Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >

  • ASP.NET Response Filter to Reformat the rendered output of ASPX pages?

    - by PropellerHead
    I've created a simple HttpModule and response stream to reformat the rendered output of web pages (see code snippets below). In the HttpModule I set the Response.Filter to my PageStream: m_Application.Context.Response.Filter = new PageStream(m_Application.Context); In the PageStream I overwrite the Write method in order to do my reformatting of the rendered output: public override void Write(byte[] buffer, int offset, int count) { string html = System.Text.Encoding.UTF8.GetString(buffer); //Do some string resplace operations here... byte[] input = System.Text.Encoding.UTF8.GetBytes(html); m_DefaultStream.Write(input, 0, input.Length); } And this work fine when using it on simple HTML pages (.html), but when I use this method on ASPX pages (.aspx), the Write method is called several times, splitting up the reformatting into different steps, and potentially destroying the string replacement operations. How do I solve this? Is there a way to let the ASPX page NOT call Write several times, e.g. by changing its buffer size, or have I chosen the wrong approach entirely, by using this Response.Filter method to manipulate the rendered output?

    Read the article

  • Streaming content to JSF UI

    - by Mark Lewis
    Hello, I was quite happy with my JSF app which read the contents of MQ messages received and supplied them to the UI like this: <rich:panel> <snip> <rich:panelMenuItem label="mylabel" action="#{MyBacking.updateCurrent}"> <f:param name="current" value="mylog.log" /> </rich:panelMenuItem> </snip> </rich:panel> <rich:panel> <a4j:outputPanel ajaxRendered="true"> <rich:insert content="#{MyBacking.log}" highlight="groovy" /> </a4j:outputPanel> </rich:panel> and in MyBacking.java private String logFile = null; ... public String updateCurrent() { FacesContext context=FacesContext.getCurrentInstance(); setCurrent((String)context.getExternalContext().getRequestParameterMap().get("current")); setLog(getCurrent()); return null; } public void setLog(String log) { sendMsg(log); msgBody = receiveMsg(moreargs); logFile = msgBody; } public String getLog() { return logFile; } until the contents of one of the messages was too big and tomcat fell over. Obviously, I thought, I need to change the way it works so that I return some form of stream so that no one object grows so big that the container dies and the content returned by successive messages is streamed to the UI as it comes in. Am I right in thinking that I can replace the work I'm doing now on a String object with a BufferedOutputStream object ie no change to the JSF code and something like this changing at the back end: private BufferedOutputStream logFile = null; public void setLog(String log) { sendMsg(args); logFile = (BufferedOutputStream) receiveMsg(moreargs); } public String getLog() { return logFile; }

    Read the article

  • C# IE Proxy Detection not working from a Windows Service

    - by mytwocents
    This is very odd. I've written a windows form tool in C# to return the default IE proxy. It works (See code snippets below). I've created a service to return the proxy using the same code, it works when I step into the debugger, BUT it doesn't work when the service is running as binary code. This must be some sort of permissions or context thing that I cannot recreate. Further, if I call the tool from the windows service, it still doesn't return the proxy information.... this seems isolated to the service somehow. I don't see any permission errors in the events log, it's as if a service has a totally different context than a regular windows form exe. I've tride both: WebRequest.GetSystemWebProxy() and Uri requestUri = new Uri(urlOfDomain); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri); IWebProxy proxy = request.Proxy; if (!proxy.IsBypassed(requestUri)){ Uri uri2 = proxy.GetProxy(request.RequestUri); } Thanks for any help!

    Read the article

  • LINQ to SQL: Reusable expression for property?

    - by coenvdwel
    Pardon me for being unable to phrase the title more exact. Basically, I have three LINQ objects linked to tables. One is Product, the other is Company and the last is a mapping table Mapping to store what Company sells which products and by which ID this Company refers to this Product. I am now retrieving a list of products as follows: var options = new DataLoadOptions(); options.LoadWith<Product>(p => p.Mappings); context.LoadOptions = options; var products = ( from p in context.Products select new { ProductID = p.ProductID, //BackendProductID = p.BackendProductID, BackendProductID = (p.Mappings.Count == 0) ? "None" : (p.Mappings.Count > 1) ? "Multiple" : p.Mappings.First().BackendProductID, Description = p.Description } ).ToList(); This does a single query retrieving the information I want. But I want to be able to move the logic behind the BackendProductID into the LINQ object so I can use the commented line instead of the annoyingly nested ternary operator statements for neatness and re-usability. So I added the following property to the Product object: public string BackendProductID { get { if (Mappings.Count == 0) return "None"; if (Mappings.Count > 1) return "Multiple"; return Mappings.First().BackendProductID; } } The list is still the same, but it now does a query for every single Product to get it's BackendProductID. The code is neater and re-usable, but the performance now is terrible. What I need is some kind of Expression or Delegate but I couldn't get my head around writing one. It always ended up querying for every single product, still. Any help would be appreciated!

    Read the article

  • Newbie: Render RGB to GTK widget -- howto?

    - by Billy Pilgrim
    Hi All, Big picture: I want to render an RGB image via GTK on a linux box. I'm a frustrated GTK newbie, so please forgive me. I assume that I should create a Drawable_area in which to render the image -- correct? Do I then have to create a graphics context attached to that area? How? my simple app (which doesn't even address the rgb issue yet is this: int main(int argc, char** argv) { GdkGC * gc = NULL; GtkWidget * window = NULL; GtkDrawingArea * dpage = NULL; GtkWidget * page = NULL; gtk_init( &argc, & argv ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); page = gtk_drawing_area_new( ); dpage = GTK_DRAWING_AREA( page ); gtk_widget_set_size_request( page, PAGE_WIDTH, PAGE_HEIGHT ); gc = gdk_gc_new( GTK_DRAWABLE( dpage ) ); gtk_widget_show( window ); gtk_main(); return (EXIT_SUCCESS); } my dpage is apparently not a 'drawable' (though it is a drawing area). I am confused as to a) how do I get/create the graphics context which is required in subsequent function calls? b) am I close to a solution, or am I so completely *#&@& wrong that there is no hope c) a baby steps tutorial. (I started with hello world as my base, so I got that far). any and all help appreciated. bp

    Read the article

  • Insert and delete SIM contacs working but it needs to be phone restart to update the changes

    - by girishgm08
    Hi All, I am able to insert the contacts into SIM card and delete from it. But it needs to be phone restart to update the changes. The below is the code woks for delete the conatcs, Uri simUri = Uri.parse("content://icc/adn"); Cursor cur = context.getContentResolver().query(simUri, null, null, null, null); prn("Number of SIM Contacts are.."+cur.getCount()); int row =0; while(cur.moveToNext()){ String name = cur.getString(cur.getColumnIndex("name")); prn("Name..."+name); String data = cur.getString(cur.getColumnIndex("number")); if(!data.equals("")) prn("Number.."+data); String where = null; if(!name.equals("") && !data.equals("")){ where = "tag =" + name + "AND" + "number =" +data; } else if(name.equals("") && !data.equals("")){ where = "number ="+data; } else { where = "tag ="+name+ "AND" +"number="+null; } context.getContentResolver().delete(simUri, where, null); row++; } prn(row+" are deleted"); cur.close(); cur = null; Please look into this issue and give suggestions on this. Thanks, Girish G M

    Read the article

  • No GPS Update retrieved? Problem in Code?

    - by poeschlorn
    Hello mates, I've got a serious problem with my GPS on my Nexus One: I wrote a kind of hello world with GPS, but the Toast that should be displayed isn't :( I don't know what I'm doing wrong...maybe you could help me getting this work. Here's my code: package gps.test; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.widget.Toast; public class GPS extends Activity { private LocationManager lm; private LocationListener locationListener; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // ---use the LocationManager class to obtain GPS locations--- lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationListener = new MyLocationListener(); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 1, locationListener); } private class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { if (loc != null) { Toast.makeText( getBaseContext(), "Location changed : Lat: " + loc.getLatitude() + " Lng: " + loc.getLongitude(), Toast.LENGTH_SHORT).show(); } } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } } } Theoretically there should be a new toast every 100 milliseconds, shouldn't it? Or at least, when I change my position by one meter!? I've no idea why it doesn't. I must admit I'm new to the topic, maybe I've missed something? It would be great if you could give me a hint :) nice greetings, poeschlorn

    Read the article

  • Entity Framework - Many to Many Subquery

    - by Jorin
    I asked a question about this previously but my database structure has changed, and while it made other things simpler, now this part is more complicated. Here is the previous question. At the time, my EF Context had a UsersProjects object because there were other properties. Now that I've simplified that table, it is just the keys, so all my EF context knows about is Users and Projects and the M2M relationship between them. There is no more UsersProjects as far as EF knows. So my goal is to say "show me all the users who are working on projects with me." in SQL, this would go something like: SELECT * FROM Users INNER JOIN UsersProjects ON Users.ID=UsersProjects.UserID WHERE ProjectID IN (SELECT ProjectID FROM UsersProjects WHERE UserID=@UserID) and I started in EF with something like this: var myProjects = (from p in edmx.Projects where p.Users.Contains(edmx.Users.FirstOrDefault(u => u.Email == UserEmail)) orderby p.Name select p).ToList(); var associatedUsers = (from u in edmx.Users where myProjects.Contains(?????????) //where myProjects.Any(????????) select u); The trick is finding what to put in the ????????. Anyone help here?

    Read the article

  • LINQ - Querying a list filtered via a Many-to-Many reltionship

    - by user118190
    Please excuse the context of my question for I did not know how to exactly word it. To not complicate things further, here's my business requirement: "bring me back all the Employees where they belong in Department "X". So when I view this, it will display all of the Employees that belong to this Department. Here's my environment: Silverlight 3 with Entity Framework 1.0 and WCF Data Services 1.0. I am able to load and bind all kinds of lists (simple), no problem. I don't feel that my environment matters and that's why I feel it is a LINQ question more than the technologies. My question is for scenarios where I have 3 tables linked, i.e. entities (collections). For example, I have this in my EDM: Employee--EmployeeProject--Project. Here's the table design from the Database: Employee (table1) ------------- EmployeeID (PK) FirstName other Attributes ... EmployeeProject (table2) ------------- EmployeeProjectID (PK) EmployeeID (FK) ProjectID (FK) AssignedDate other Attributes ... Project (table3) ------------- ProjectID (PK) Name other Attributes ... Here's the EDM design from Entity Framework: ------------------------ Employee (entity1) ------------------------ (Scalar Properties) ------------------- EmployeeID (PK) FirstName other Attributes ... ------------------- (Navigation Properties) ------------------- EmployeeProjects ------------------------ EmployeeProject (entity2) ------------------------ (Scalar Properties) ------------------- EmployeeProjectID (PK) AssignedDate other Attributes ... ------------------- (Navigation Properties) ------------------- Employee Project ------------------------ Project (entity3) ------------------------ (Scalar Properties) ------------------- ProjectID (PK) Name other Attributes ... ------------------- (Navigation Properties) ------------------- EmployeeProjects So far, I have only been able to do: var filteredList = Context.Employees .Where(e => e.EmployeeProjects.Where(ep => ep.Project.Name == "ProjectX")) NOTE: I have updated the syntax of the query after John's post. As you can see, I can only query, the related entity (EmployeeProjects). All I want is being able to filter to Project from the Employee entity. Thanks for any advice.

    Read the article

  • EXEC_BAD_ACCESS error comes in my applicatoin in iphone

    - by Jaimin
    when i print dictionary i got this error.. here my dictTf is mutabledictionay.. when i m in home page i selct few fields and click find. so new view comes with the result.. now i go back and again click find without changing anything.. now comes proper.. now at this moment when i go back it shows this in the dictionay and EXEC_BAD_ACCESS eror comes... Printing description of dictTf: The program being debugged was signaled while in a function called from GDB. GDB has restored the context to what it was before the call. To change this behavior use "set unwindonsignal off" Evaluation of the expression containing the function (CFShow) will be abandoned. The program being debugged was signaled while in a function called from GDB. GDB has restored the context to what it was before the call. To change this behavior use "set unwindonsignal off" Evaluation of the expression containing the function (CFShow) will be abandoned. (gdb)

    Read the article

  • adding a token onto a webservice or wcf call

    - by duncanUK
    I have an httphandler which I am using to log the http soap request and response for each webservice that is called from my application as a comms log. i would like to inject a token ont he 1st call (possibly the 1st call to invoke the service that is being logged) and then be able to track all subsequent webservice calls run in the same context with this token so i can tie the subsequent calls back up to the original call. so for example. main webservice -> 2nd web service -> another web service [token] [token] [token] -> nth web service [token] I would like to inject the token on the first call to the main webservice (http handler checks if no token, add it), I would like to use the same http handler to intercept each call to the subsequent webservices and pass on the token if it exists already (the job of the httphandler is to log the in/out soap with the token to reference with. I have managed to inject the first token, but my problem is how do I add the token on the subsequent calls.. can I make it stick on the same context or session? My worry is that when we call a new webservice, we create a whole new proxy/http request which will not inhrit the token... or will it?! Ideally I would like it to persist on the http header as I am setting the token as a header at the moment? has anyone got any ideas or a better way of doing this? I would be most greatful for you comments!

    Read the article

  • Is it possible to replace values in a queryset before sending it to your template?

    - by Issy
    Hi Guys, Wondering if it's possible to change a value returned from a queryset before sending it off to the template. Say for example you have a bunch of records Date | Time | Description 10/05/2010 | 13:30 | Testing... etc... However, based on the day of the week the time may change. However this is static. For example on a monday the time is ALWAYS 15:00. Now you could add another table to configure special cases but to me it seems overkill, as this is a rule. How would you replace that value before sending it to the template? I thought about using the new if tags (if day=1), but this is more of business logic rather then presentation. Tested this in a custom template tag def render(self, context): result = self.model._default_manager.filter(from_date__lte=self.now).filter(to_date__gte=self.now) if self.day == 4: result = result.exclude(type__exact=2).order_by('time') else: result = result.order_by('type') result[0].time = '23:23:23' context[self.varname] = result return '' However it still displays the results from the DB, is this some how related to 'lazy' evaluation of templates? Thanks! Update Responding to comments below: It's not stored wrong in the DB, its stored Correctly However there is a small side case where the value needs to change. So for example I have a From Date & To date, my query checks if todays date is between those. Now with this they could setup a from date - to date for an entire year, and the special cases (like mondays as an example) is taken care off. However if you want to store in the DB you would have to capture several more records to cater for the side case. I.e you would be capturing the same information just to cater for that 1 day when the time changes. (And the time always changes on the same day, and is always the same)

    Read the article

  • Entity framework generates values for NOT NULL columns which has default defined in db.

    - by Muhammad Kashif Nadeem
    Hi I have a table Customer. One of the columns in table is DateCreated. This column is NOT NULL but default values is defined for this column in db. When I add new Customer using EF4 from my code. var customer = new Customer(); customer.CustomerName = "Hello"; customer.Email = "[email protected]"; // Watch out commented out. //customer.DateCreated = DateTime.Now; context.AddToCustomers(customer); context.SaveChanges(); Above code generates following query. exec sp_executesql N'insert [dbo].[Customers]([CustomerName], [Email], [Phone], [DateCreated], [DateUpdated]) values (@0, @1, null, @2, null) select [CustomerId] from [dbo].[Customers] where @@ROWCOUNT > 0 and [CustomerId] = scope_identity() ',N'@0 varchar(100),@1 varchar(100),@2 datetime2(7) ',@0='Hello',@1='[email protected]',@2='0001-01-01 00:00:00' And throws following error The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. The statement has been terminated. Can you please tell me how NOT NULL columns which has default values at db level should not have values generated by EF? DB: DateCreated DATETIME NOT NULL DateCreated Properties in EF: Nullable: False Getter/Setter: public Type: DateTime DefaultValue: None Thanks.

    Read the article

  • Using reflection to find all linq2sql tables and ensure they match the database

    - by Jake Stevenson
    I'm trying to use reflection to automatically test that all my linq2sql entities match the test database. I thought I'd do this by getting all the classes that inherit from DataContext from my assembly: var contexttypes = Assembly.GetAssembly(typeof (BaseRepository<,>)).GetTypes().Where( t => t.IsSubclassOf(typeof(DataContext))); foreach (var contexttype in contexttypes) { var context = Activator.CreateInstance(contexttype); var tableProperties = type.GetProperties().Where(t=> t.PropertyType.Name == typeof(ITable<>).Name); foreach (var propertyInfo in tableProperties) { var table = (propertyInfo.GetValue(context, null)); } } So far so good, this loops through each ITable< in each datacontext in the project. If I debug the code, "table" is properly instantiated, and if I expand the results view in the debugger I can see actual data. BUT, I can't figure out how to get my code to actually query that table. I'd really like to just be able to do table.FirstOrDefault() to get the top row out of each table and make sure the SQL fetch doesn't fail. But I cant cast that table to be anything I can query. Any suggestions on how I can make this queryable? Just the ability to call .Count() would be enough for me to ensure the entities don't have anything that doesn't match the table columns.

    Read the article

  • C#; On casting to the SAME class that came from another assembly

    - by G. Stoynev
    For complete separation/decoupling, I've implemented a DAL in an assebly that is simply being copied over via post-build event to the website BIN folder. The website then on Application Start loads that assembly via System.Reflection.Assembly.LoadFile. Again, using reflection, I construct a couple of instances from classes in that assembly. I then store a reference to these instances in the session (HttpContext.Current.Items) Later, when I try to get the object stored in the session, I am not able to cast them to their own types (was trying interfaces initially, but for debugging tried to cast to THEIR OWN TYPES), getting this error: [A]DAL_QSYSCamper.NHibernateSessionBuilder cannot be cast to [B] DAL_QSYSCamper.NHibernateSessionBuilder. Type A originates from 'DAL_QSYSCamper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Users\dull.anomal\AppData\Local\Temp\Temporary ASP.NET Files\root\ad6e8bff\70fa2384\assembly\dl3\aaf7a5b0\84f01b09_b10acb01\DAL_QSYSCamper.DLL'. Type B originates from 'DAL_QSYSCamper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location 'C:\Users\dull.anomal\Documents\Projects\QSYS\Deleteme\UI\MVCClient\bin\DAL_QSYSCa mper.DLL'. This is happening while debugging in VS - VS manages to stop into the source DAL project even though I've loaded from assembly and the project is not refferenced by the website project (they're both in the solution). I do understand the error, but I don't understand how and why the assembly is being used/loaded from two locations - I only load it once from the file and there's no referrence to the project. Should mention that I also use Windsor for DI. The object that tries to extract the object from the session is A) from a class from that DAL assembly; B) is injected into a website class by Windsor. I will work on adding some sample code to this question, but wanted to put it out in case it's obvious what I do wrong.

    Read the article

  • stop android emulator call

    - by Shahzad Younis
    I am working on an Android application, having functionality like voicemail. I am using BroadcastReceiver to get dialing events. I have to get the event "WHEN CALL IS UNANSWERED (not picked after few rings) FROM RECEIVER". I will do some actions on caller end against this event. I am using AVD emulator, and I do call from one instance to another instance and it calls perfectly, but the problem is: It continuously calls until I reject or accept the call. This way I cannot detect that "CALL IS UNANSWERED AFTER A NUMBER OF RINGS". So I want the Caller emulator to drop the call after a number of rings (if unanswered) like a normal phone. I can do it (drop the call after some time) by writing some code, but I need the natural functionality of phone in the emulator. Can anyone please guide me? Is there any settings in the emulator? Or something else? The code is shown below in case it helps: public class MyPhoneReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { String state = "my call state = " + extras.getString(TelephonyManager.EXTRA_STATE); Log.w("DEBUG", state); } }

    Read the article

  • How to re-prompt after a trap return in bash?

    - by verbose
    I have a script that is supposed to trap SIGTERM and SIGTSTP. This is what I have in the main block: trap 'killHandling' TERM And in the function: killHandling () { echo received kill signal, ignoring return } ... and similar for SIGINT. The problem is one of user interface. The script prompts the user for some input, and if the SIGTERM or SIGINT occurs when the script is waiting for input, it's confusing. Here is the output in that case: Enter something: # SIGTERM received received kill signal, ignoring # shell waits at blank line for user input, user gets confused # user hits "return", which then gets read as blank input from the user # bad things happen because of the blank input I have definitely seen scripts which handle this more elegantly, like so: Enter something: # SIGTERM received received kill signal, ignoring Enter something: # re-prompts user for user input, user is not confused What is the mechanism used to accomplish the latter? Unfortunately I can't simply change my trap code to do the re-prompt as the script prompts the user for several things and what the prompt says is context-dependent. And there has to be a better way than writing context-dependent trap functions. I'd be very grateful for any pointers. Thanks!

    Read the article

  • rotating a circle in UIView?

    - by senthilmuthu
    HI, i want to draw a circle in DrawRect through context like pie chart(took from tutorial) thorugh UITouch? i have given the code as follows,how can i rotate ? any help please? define PI 3.14159265358979323846 define snapshot_start 360 define snapshot_finish 360 static inline float radians(double degrees) { return degrees * PI / 180; } - (void)drawRect:(CGRect)rect { // Drawing code CGRect parentViewBounds = self.bounds; CGFloat x = CGRectGetWidth(parentViewBounds)/2; CGFloat y = CGRectGetHeight(parentViewBounds)*0.55; // Get the graphics context and clear it CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextClearRect(ctx, rect); // define stroke color CGContextSetRGBStrokeColor(ctx, 1, 1, 1, 1.0); // define line width CGContextSetLineWidth(ctx, 4.0); // need some values to draw pie charts double snapshotCapacity =20; double rawCapacity = 100; double systemCapacity = 1; int offset = 5; double pie1_start = 315.0; double pie1_finish = snapshotCapacity *360.0/rawCapacity; double system_finish = systemCapacity*360.0/rawCapacity; CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor greenColor] CGColor])); CGContextMoveToPoint(ctx, x+2*offset, y); CGContextAddArc(ctx, x+2*offset, y, 100, radians(snapshot_start), radians(snapshot_start+snapshot_finish), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); // system capacity CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor colorWithRed:15 green:165/255 blue:0 alpha:1 ] CGColor])); CGContextMoveToPoint(ctx, x+offset,y); CGContextAddArc(ctx, x+offset, y, 100, radians(snapshot_start+snapshot_finish+offset), radians(snapshot_start+snapshot_finish+system_finish), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); /* data capacity */ CGContextSetFillColor(ctx, CGColorGetComponents( [[UIColor colorWithRed:99/255 green:184/255 blue:255/255 alpha:1 ] CGColor])); CGContextMoveToPoint(ctx, x, y); CGContextAddArc(ctx, x, y, 100, radians(snapshot_start+snapshot_finish+system_finish+offset), radians(snapshot_start), 0); CGContextClosePath(ctx); CGContextFillPath(ctx); }

    Read the article

  • How to set a EditText in a certain column of a TableLayout?

    - by Nick
    I have a TableLayout on one Android Activity UI. It has two columns. Now I need to add a new row, and put an EditText box in second column of that new row. And also, I want that EditText full fill the whole cell. I have some code like this: TableRow tr = new TableRow(context); EditText et = new EditText(context); et.SetMaxLines(4); etText.setLayoutParams(new TableRow.LayoutParams(1)); //set it to the second coloumn tr.addView(et); tl.addView(tr); //tl is the tableLayout It puts the EditText in the second column fine, but the EditText is too small. I tried to use etText.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); but that seems to disabled the TableRow.LayoutParams setting. I guess each control can only have one LayoutParamas setting. So, how to make the EditText as a 4 lines text editor and also make sure it is in the second column of that row? Thanks.

    Read the article

  • How to change CSS color values in real-time off a javascript slider?

    - by bflora
    I'm making a page where the user gets a javascript slider that goes from 0 to 100 and can use it to set the opacity of a div on the page. I want the opacity of that div to change in real-time as they work the slider. I've not done this before. What's the best approach? There cursor in the slider displays the slider's current value as you move it. It seems to be that I just need to find a way to display that value in any arbitrary other place on the page so I can display it in the style settings for the div. The .js file that generates the slider has a line that (I think) is setting the current value in the cursor: $(this).children(".ui-slider-handle", context).html(parseInt(settings[index]['default'])); TO get this changing number to display somewhere else at the same time, do I just need to add a div somewhere and then add a line like this? $("#newDivId").children(".ui-slider-handle", context).html(parseInt(settings[index]['default'])); That seems like it would give me the number showing up in a div. How then would I get it into a form I could put into the style settings for a div? If this was a php variable, I would do something like this, style="opacity:<?php print $value ?>;" What would be the .js equivalent?

    Read the article

  • How can i fetch the large image from url

    - by Kutbi
    i used below code to fetch the image from url.but its not working for large image.. i missing something to add for that type of image to fetch. imgView = (ImageView)findViewById(R.id.ImageView01); imgView.setImageBitmap(loadBitmap("http://www.360technosoft.com/mx4.jpg")); //imgView.setImageBitmap(loadBitmap("http://sugardaddydiaries.com/wp-content/uploads/2010/12/how_do_i_get_sugar_daddy.jpg")); //setImageDrawable("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg"); //Drawable drawable = LoadImageFromWebOperations("http://www.androidpeople.com/wp-content/uploads/2010/03/android.png"); //imgView.setImageDrawable(drawable); /* try { ImageView i = (ImageView)findViewById(R.id.ImageView01); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://sugardaddydiaries.com/wp-content/uploads/2010/12/holding-money-copy.jpg").getContent()); i.setImageBitmap(bitmap); } catch (MalformedURLException e) { System.out.println("hello"); } catch (IOException e) { System.out.println("hello"); }*/ } protected Drawable ImageOperations(Context context, String string, String string2) { // TODO Auto-generated method stub try { InputStream is = (InputStream) this.fetch(string); Drawable d = Drawable.createFromStream(is, "src"); return d; } catch (MalformedURLException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } }

    Read the article

  • How to filter node list based on the contents of another node list

    - by ~otakuj462
    Hi, I'd like to use XSLT to filter a node list based on the contents of another node list. Specifically, I'd like to filter a node list such that elements with identical id attributes are eliminated from the resulting node list. Priority should be given to one of the two node lists. The way I originally imagined implementing this was to do something like this: <xsl:variable name="filteredList1" select="$list1[not($list2[@id_from_list1 = @id_from_list2])]"/> The problem is that the context node changes in the predicate for $list2, so I don't have access to attribute @id_from_list1. Due to these scoping constraints, it's not clear to me how I would be able to refer to an attribute from the outer node list using nested predicates in this fashion. To get around the issue of the context node, I've tried to create a solution involving a for-each loop, like the following: <xsl:variable name="filteredList1"> <xsl:for-each select="$list1"> <xsl:variable name="id_from_list1" select="@id_from_list1"/> <xsl:if test="not($list2[@id_from_list2 = $id_from_list1])"> <xsl:copy-of select="."/> </xsl:if> </xsl:for-each> </xsl:variable> But this doesn't work correctly. It's also not clear to me how it fails... Using the above technique, filteredList1 has a length of 1, but appears to be empty. It's strange behaviour, and anyhow, I feel there must be a more elegant approach. I'd appreciate any guidance anyone can offer. Thanks.

    Read the article

  • Entity Framework POCO objects

    - by Dan
    I'm struggling with understanding Entity Framework and POCO objects. Here's what I'm trying to achieve. 1) Separate the DAL from the Business Layer by having my business layer use an interface to my DAL. Maybe use Unity to create my context. 2) Use Entity Framework inside my DAL. I have a Domain model with objects that reside in my business layer. I also have a database full of tables that doesn't really represent my domain model. I setup Entity Framework and generated POCO objects by using the ADO.NET POCO Generator extension. This gave me an object for each table in my database. Now I want to be able to say context.GetAll<User>(); and have it return a list of my User objects. The User object is in my business layer. Is that possible? Does that make sense or am I totally off and should start over? I'm guessing I need to use the repository pattern to achieve this, but I'm not sure. Can anyone help?

    Read the article

  • .NET, ASHX, "Server cannot append header after HTTP headers have been sent" after sending PDF Streem

    - by Inturbidus
    I visit my ASHX file, and it outputs a PDF perfectly. If I visit the very same ASHX with a different query string (I append DateTime.Now.Ticks to the end each visit), and I get this error: Server cannot append hader after HTTP headers have been sent. My code is below: copy.CloseStream = false; document.Close(); var r = context.Response; r.ExpiresAbsolute = DateTime.Now; r.BufferOutput = true; r.ContentType = "application/pdf"; r.AppendHeader("Content-Type", r.ContentType); r.AppendHeader("Content-disposition", "inline; filename=" + context.Server.UrlEncode(formType.File_Name)); r.BinaryWrite(copyStream.ToArray()); r.StatusCode = 200; r.End(); originalReader.Close(); copy.CloseStream = true; copy.Close(); There is no other place in this code that headers are sent. You are seeing the entire interaction with the Response object. I've tried to use r.Flush(); and r.End(); I've also tried not sending them if they are already there, but this causes other issues.

    Read the article

  • Can I use properties in an ivy.xml file to avoid repeating version numbers of dependencies?

    - by scompt.com
    Here's what part of my ivy.xml looks like right now: <dependency org="org.springframework" name="org.springframework.core" rev="3.0.2.RELEASE" /> <dependency org="org.springframework" name="org.springframework.context" rev="3.0.2.RELEASE" /> <dependency org="org.springframework" name="org.springframework.jdbc" rev="3.0.2.RELEASE" /> <dependency org="org.springframework" name="org.springframework.beans" rev="3.0.2.RELEASE" /> <dependency org="org.springframework" name="org.springframework.jms" rev="3.0.2.RELEASE" /> Here's what I'd like it to look like: <dependency org="org.springframework" name="org.springframework.core" rev="${spring.version}" /> <dependency org="org.springframework" name="org.springframework.context" rev="${spring.version}" /> <dependency org="org.springframework" name="org.springframework.jdbc" rev="${spring.version}" /> <dependency org="org.springframework" name="org.springframework.beans" rev="${spring.version}" /> <dependency org="org.springframework" name="org.springframework.jms" rev="${spring.version}" /> Is this possible? What's the syntax?

    Read the article

< Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >