Search Results

Search found 9254 results on 371 pages for 'approach'.

Page 57/371 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • Printing python tkinter output

    - by Eric
    I am trying to print the contents of a python tkinter canvas. I have tried using the postscript method of canvas to create a postscript file, but I get a blank page. I know this is because I have embedded widgets, and these do not get rendered by the postscript method. Before I rewrite my program to create a more printer-friendly layout, can someone suggest a way to approach this problem? All of the programming books I have ever read approach the problem of sending output to a printer with a bit of hand-waving, something along the lines of: "It's a difficult problem that depends on interacting with the operating system." I also have a hard time finding resources about this because of all the pages related to printing to the screen. I am using Python 2.6, on Ubuntu 9.04.

    Read the article

  • How to store data to Excel from DataSet without going cell-by-cell?

    - by Jason Barnwell
    Duplicate of: What’s the simplest way to import a System.Data.DataSet into Excel? Using c# under VS2008, we can create an excel app, workbook, and then worksheet fine by doing this: Application excelApp = new Application(); Workbook excelWb = excelApp.Workbooks.Add(template); Worksheet excelWs = (Worksheet)this.Application.ActiveSheet; Then we can access each cell by "excelWs.Cells[i,j]" and write/save without problems. However with large numbers of rows/columns, we are expecting a loss in efficiency. Is there a way to "data bind" from a DataSet object into the worksheet without using the cell-by-cell approach? Most of the methods we have seen at some point revert to the cell-by-cell approach. Thanks for any suggestions.

    Read the article

  • How to implement a set ?

    - by nomemory
    I want to implement a Set in C. Is it OK to use a linked list, when creating the SET, or should I use another approach ? How do you usually implement your own set (if needed). NOTE: If I use the Linked List approach, I will probably have the following complexities for my operations: init : O(1); destroy: O(n); insert: O(n); remove: O(n); union: O(n*m); intersection: O(n*m); difference: O(n*m); ismember: O(n); issubset: O(n*m); setisequal: O(n*m); O(n*m) seems may be a little to big especially for huge data... Is there a way to implement my Set more efficient ?

    Read the article

  • varnish invalidate url REGEX from backend

    - by ooouuiii
    Say I have some highly-visited front-page, which displays number of some items by categories. When some item is added / deleted I need to invalidate this front-page/url and some 2 others. What is the best practice how to invalidate those urls from backend in Varnish (4.x)? From what I captured, I can: implement my HTTP PURGE handler in VCL configuration file, that "bans" urls matching received regex from backend to Varnish, send 3x HTTP PURGE requests for those 3 urls. But is this approach safe for this automatic usage? Basicly I need to invalidate some views everytime some related entity is inserted/updated/deleted. Can it lead to ban list cumulation and increasing CPU consumption? Is there any other approach? Thanks.

    Read the article

  • iPhone Server Mirror Functionality

    - by hecta
    My app reads a from decentralized (so I have the ability to change servers if I have to) xml file with TBXML parser. The xml file consists of only a few lines like this <xml> <mirror url="http://www.someserverabc.com/data.xml" priority="1"/> <mirror url="http://www.someservermirror.com/data.xml" priority="2"/> <mirror url="http://www.anotherserver.com/data.xml/" priority="3"/> </xml> So I have the corresponding priority to the url. Now I want to check if server with priority 1 is reachable, and if not, try the 2nd one and so forth. If a server is reachable I'm parsing XML with the url from the mirror list How could I implement this approach and is it even a good approach or how can this be tweaked? (is XML even desirable in the first scenario)

    Read the article

  • Class views in Django

    - by Sebastjan Trepca
    Django view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if statements in the function, but I was thinking more of an object oriented approach. For example, I have a page that displays a user. This page is very similar to page that displays a group, but it's still not so similar to just use another data model. Group also has members etc... One way would be to point views to class methods and then extend that class. Has anyone tried this approach or has any other idea?

    Read the article

  • Communication between .net winform and webform

    - by Pablo
    Hi, I need to make a webform communicate with a winform and back to the webform. The reason for this is it exists a webform software already made, and now it's needed the behavior of a .net component only available for winforms. We've tried going with Process.Start and shell.execute but with this approach the software hangs or it takes too long to respond. The webform also needs to be called from client pcs in the network, I think this adds another problem due to the non possibility of calling the execution of a file from a webform remotelly, but I dont know much about this technical issue we've read some articles about embedding a winform in a webform, sending data from a winform to a webform, etc. and we would like to know what's the recommend approach (if there is any) for handdling a situation like this.

    Read the article

  • Loading jQuery multiple times in the same page

    - by Winaji
    I'm implementing a plug-in that's embeddable in different sites (a la Meebo, Wibiya), and I want to use jQuery. Problem is, the site I'm embedding to, may already have a jQuery script loaded. The question is, what's the best approach for this kind of problem: Should I just check if jQuery is already loaded and if so, use the original site's jQuery, otherwise load it myself? If I use this approach, am I not risking comaptibility problems (i.e. the site uses an old version of jQuery)? Should I load jQuery myself (whether it's already loaded or not) and call "jQuery.noConflict(true)" when it's finished loading? If so, how can I make sure that my jQuery has finished loading (hooking to the onLoad event doesn't seem to work all the time, and polling for "jQuery" won't work for obvious reasons)? Should I do something else? Thanks.

    Read the article

  • Does a servlet-based stack have significant overheads?

    - by John
    I don't know if it's simply because page-loads take a little time, or the way servlets have an abstraction framework above the 'bare metal' of HTTP, or just because of the "Enterprise" in Jave-EE, but in my head I have the notion that a servlet-based app is inherently adding overhead compared to a Java app which simply deals with sockets directly. Forget web-pages, imagine instead a Java server app where you send it a question over an HTTP request and it looks up an answer from memory and returns the answer in the response. You can easily write a Java socket-based app which does this, you can also do a servlet approach and get away from the "bare metal" of sockets. Is there any measurable performance impact to be expected implementing the same approach using Servlets rather than a custom socket-based HTTP listening app? And yes, I am hazy on the exact data sent in HTTP requests and I know it's a vague question. It's really about whether servlet implementations have lots of layers of indirection or anything else that would add up to a significant overhead per call, where by significant I mean maybe an additional 0.1s or more.

    Read the article

  • select from multiple tables with different columns

    - by Qaiser Iftikhar
    Say I got this sql schema. Table Job: id,title, type, is_enabled Table JobFileCopy: job_id,from_path,to_path Table JobFileDelete: job_id, file_path Table JobStartProcess: job_id, file_path, arguments, working_directory There are many other tables with varying number of columns and they all got foreign key job_id which is linked to id in table Job. My questions: Is this the right approach? I don't have requirement to delete anything at anytime. I will require to select and insert mostly. Secondly, what is the best approach to get the list of jobs with relevant details from all the different tables in a single database hit? e.g I would like to select top 20 jobs with details, their details can be in any table (depends on column type in table Job) which I don't know until runtime. Thanks in advance. Regards,

    Read the article

  • MYSQL - Adding result set A to result set B? Please see my example

    - by BlackberryFan
    I have two mysql tables. They are laid out in this manner: user_info id | emailContact _______________________ 1 | [email protected] 3 | [email protected] user_biz_info id | emailContact _________________________ 8 | [email protected] 9 | [email protected] What kind of join would I use to create a result set of information like this: id | emailContact ________________________________ 1 - [email protected] 3 - [email protected] 8 - [email protected] 9 - [email protected] I have tried the following: SELECT p.id, p.emailContact, b.id, b.emailContact FROM user_info p, user_business_info b But it seems that this is an incorrect approach. Would someone be able to suggest the correct approach in this or possibly point me in the direction of some tutorials that cover this type of mysql join, as this is what I assume is needed in this case. Thanks for your time in reading through my question!!

    Read the article

  • How to split the chance to display SWFs evenly among banner collection?

    - by Michael Mao
    Hi all: I am working on The ausdcf.org to try adding several banner ads in swf format to the top. Everything starts to work, but I've got several questions that need your help: The client chose not to go with Google AdManager, but prefer a "minimal approach" to do this task. What I am trying to do is sort of "mimicking" the way Google AdManager does for banners, that is, to split the chance of each particular swf to be shown to the visitor evenly among the banner collection. Definitely I can add some jQuery code to do this from client-side, a random number generator and if-else statement would work - just $.load() it! However, what if I'd like to make sure those disabled Javascript (is there any now btw?) still be able to see different swfs in each visit. Any suggestion on how to approach this? Many thanks in advance.

    Read the article

  • Optimal search queries

    - by Macros
    Following on from my last question http://stackoverflow.com/questions/2788082/sql-server-query-performance, and discovering that my method of allowing optional parameters in a search query is sub optimal, does anyone have guidelines on how to approach this? For example, say I have an application table, a customer table and a contact details table, and I want to create an SP which allows searching on some, none or all of surname, homephone, mobile and app ID, I may use something like the following: select * from application a inner join customer c on a.customerid = a.id left join contact hp on (c.id = hp.customerid and hp.contacttype = 'homephone') left join contact mob on (c.id = mob.customerid and mob.contacttype = 'mobile') where (a.ID = @ID or @ID is null) and (c.Surname = @Surname or @Surname is null) and (HP.phonenumber = @Homphone or @Homephone is null) and (MOB.phonenumber = @Mobile or @Mobile is null) The schema used above isn't real, and I wouldn't be using select * in a real world scenario, it is the construction of the where clause I am interested in. Is there a better approach, either dynamic sql or an alternative which can achieve the same result, without the need for many nested conditionals. Some SPs may have 10 - 15 criteria used in this way

    Read the article

  • String contains all the elements of a list

    - by CSSS
    I am shifting to Python, and am still relatively new to the pythonic approach. I want to write a function that takes a string and a list and returns true if all the elements in the list occur in the string. This seemed fairly simple. However, I am facing some difficulties with it. The code goes something like this: def myfun(str,list): for a in list: if not a in str: return False return True Example : myfun('tomato',['t','o','m','a']) should return true myfun('potato',['t','o','m','a']) should return false myfun('tomato',['t','o','m']) should return true Also, I was hoping if someone could suggest a possible regex approach here. I am trying out my hands on them too.

    Read the article

  • Running script constantly in background: daemon, lock file with crontab, or simply loop?

    - by Mauritz Hansen
    I have a Perl script that queries a database for a list of files to process processes the files and then exits Upon startup this script creates a file (let's say script.lock), and upon exit it removes this file. I have a crontab entry that runs this script every minute. If the lockfile exists then the script exits, assuming that another instance of itself is running. The above process works fine but I am not very happy with the robustness of this approach. Specifically, if for some reason the script exits prematurely and the lockfile is not removed then a new instance will not execute properly. I would appreciate some advice on the following: Is using the lock file a good approach or is there a better/more robust way to do this? Is using crontab for this a good idea or could I better write an endless loop with sleep()? Should I use the GNU 'daemon' program or the Perl Proc::Daemon module (or some other equivalent) for this?

    Read the article

  • What's the recommended way to create an HTML elemnt and bind a listener to it using jQuery?

    - by Bytecode Ninja
    At the moment I achieve this using something like this: var myElem = "<tr id='tr-1'><td>content</td></tr>"; $("#myTable").append(myElem); $("#tr-1").click(function() { // blah blah }); Traditionally, when I wasn't using jQuery, I used to do something like this: var myElem = document.createElement(...); var myTable = document.getElementById("myTable"); myTable.appendChild(myElem); myElem.onclick = function() { // blah blah } The thing is, in the second approach I already have a reference to myElem and I don't have to scan the DOM ($("#tr-1")) to find it, like the jQuery approach, and hence it should be much faster especially in big pages. Isn't there a better jQuery-ish way to accomplish this task?

    Read the article

  • overriding callbacks avoiding attribute pollution

    - by pygabriel
    I've a class that has some callbacks and its own interface, something like: class Service: def __init__(self): connect("service_resolved", self.service_resolved) def service_resolved(self, a,b c): ''' This function is called when it's triggered service resolved signal and has a lot of parameters''' the connect function is for example the gtkwidget.connect, but I want that this connection is something more general, so I've decided to use a "twisted like" approach: class MyService(Service): def my_on_service_resolved(self, little_param): ''' it's a decorated version of srvice_resolved ''' def service_resolved(self,a,b,c): super(MyService,self).service_resolved(a,b,c) little_param = "something that's obtained from a,b,c" self.my_on_service_resolved(little_param) So I can use MyService by overriding my_on_service_resolved. The problem is the "attributes" pollution. In the real implementation, Service has some attributes that can accidentally be overriden in MyService and those who subclass MyService. How can I avoid attribute pollution? What I've thought is a "wrapper" like approach but I don't know if it's a good solution: class WrapperService(): def __init__(self): self._service = service_resolved # how to override self._service.service_resolved callback? def my_on_service_resolved(self,param): ''' '''

    Read the article

  • Resize a DIV when its text changes

    - by Antonios
    I wanted to build a custom html button without using any solution like bootstrap etc. but from scratch. I decided to use a div to build my button with very good results. However, when the text changes its length that does not mean the div will change its width as well. Should I approach this using javascript or is there a CSS solution I am missing. Apologies for missing code: div { position: relative; width: 121px; height: 30px; } I need a minimum width and not a dynamic this is why I used a fixed one. In case there is not a CSS alternative then I will use a javascript approach.

    Read the article

  • "Zooming" elements on a page while keeping the centre of enlargement in the centre of the window

    - by Acorn
    I'm trying to work out how to enlarge all elements on a page, but keep the centre of enlargement in the centre of the window. Example Page (up and down arrows to resize the image, you can also drag the image around) On this page, once the image reaches the top or the left side of the window the centre of enlargement changes. It also changes when you move the image. (exactly what you would expect) I'm thinking I'd need to take a completely different approach to achieve what I want. But I'm not sure what that approach is.. Any ideas?

    Read the article

  • Ruby on Rails: Best way to save search queries in a database

    - by Adam Templeton
    For a RoR app I'm helping develop, I need to save all search queries in a database so I can analyze them later. My plan right now is to create a Result model and table, and just save each search query's text in that table, along with a user's ID, the time, etc. However, the app has about 15,000 users, so I'm afraid the single table approach won't be super efficient when it comes time to parse that data. (The database is setup via MySQL, if that factors in at all.) Am I just being paranoid? Is there a Ruby gem that handles this sort of thing, or a better approach I could take? Any input would be appreciated.

    Read the article

  • What is the best, python or bash for selectively concatenating lots of files?

    - by Werner
    Hi, I have around 20000 files coming from the output of some program, and their names follow the format: data1.txt data2.txt ... data99.txt data100.txt ... data999.txt data1000.txt ... data20000.txt I would like to write a script that gets as input argument the number N. Then it makes blocks of N concatenated files, so if N=5, it would make the following new files: data_new_1.txt: it would contain (concatenated) data1.txt to data5.txt (like cat data1.txt data2.txt ... data_new_1.txt ) data_new_2.txt: it would contain (concatenated) data6.txt to data10.txt ..... I wonder what do you think would be the best approach to do this, whether bash, python or another one like awk, perl, etc. The best approach I mean in terms of simplest code. Thanks

    Read the article

  • How to organize Windows Phone code base to target both 7.x and 8 platforms

    - by ljubomir
    I took over a Windows Phone project which was previously targeting WP 7.1 platform, and with the recent announcement of the new platform it should target WP 8 as well. My VS 2010 solution consists on several projects (Data access, Model, Tests and WP7 client app) and i am wandering on how to include support for WP8. I have to note that the code-base is not compatible with WP8, due to usage of Toolkit controls and other 3rd party libraries targeted for WP7.1 specifically. Also there is another problem with the Visual Studio versions - WP7.1 can work with VS 2010, but WP8 requires VS 2012. Should i move the whole code-base to VS 2012? Any good advice on how to organize code-base in a most meaningful way in order to avoid duplication and possible painful maintenance? I am thinking between one solution - multiple projects vs. multiple solutions - reusable projects approach. Code duplication (like two separate folders/solutions) should be the least possible approach (fallback).

    Read the article

  • How can I implement log4j logging to an existing J2EE Struts web application?

    - by Ruepen
    I have recently inherited a J2EE Struts web app that was written back in 2002. There is no logging in the application other than the odd System.out.println(). I have added log4j logging so that I can write out some info to the console, but I'm concerned on how best to approach this. Any suggestions, tips, best practices would be welcome as I don't want to spend too much time adding logging to every method or class (or trying to find what places where logging would be best - ie. bad code blocks/defects). My current approach is to just add some logging to the few classes that I have been looking at to understand the code, but are there a few key places where I can add logging to maximize my use of adding log4j?

    Read the article

  • facelet - nested <ui:insert>

    - by user321350
    I have multiple templates which differs with each other only by few containers. The most complex one contains superset of all containers used in all other one thus to avoid creating multiple templates I created the most complex one in following format some layout stuff (div and all) defining nested insert for each container and content. Now in client template based on what is needed I turn off container which is not needed as else if container is needed, just define content as doSomething Please let me know if you guys see any issues with this approach, any potential problem or alternate approach for similar scenario. thanks a lot. Maddy

    Read the article

  • sports league database design

    - by John
    Hello, I'm developing a database to store statistics for a sports league. I'd like to show several tables: - league table that indicates the position of the team in the current and previous fixture - table that shows the position of a team in every fixture in the championship I have a matches table: Matches (IdMatch, IdTeam1, IdTeam2, GoalsTeam1, GoalsTeam2) Whith this table I can calculate the total points of every team based on the matches the team played. But every time I want to show the league table I have to calculate the points. Also I have a problem to calculate in which position classified a team in the last 10 fixtures cause I have to make 10 queries. To store the league table for every fixture in a database table is another approach, but every time I change a match already played I have to recalculate every fixture from there... Is there a better approach for this problem? Thanks

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >