Search Results

Search found 43 results on 2 pages for 'mridang'.

Page 1/2 | 1 2  | Next Page >

  • Get the currently saved object in a view in Django

    - by mridang
    Hi, I has a Django view which is accessed through an AJAX call. It's a pretty simple one — all it does is simply pass the request to a form object and save the data. Here's a snippet from my view: form = AddSiteForm(request.user, request.POST) if form.is_valid(): obj = form.save(commit=False) obj.user = request.user obj.save() data['status'] = 'success' data['html'] = render_to_string('site.html', locals(), context_instance=RequestContext(request)) return HttpResponse(simplejson.dumps(data), mimetype='application/json') How do I get the currently saved object (including the internally generated id column) and pass it to the template? Any help guys? Mridang

    Read the article

  • Regex pattern problem in python

    - by mridang
    I need to extract parts of a string using regex in Python. I'm good with basic regex but I'm terrible at lookarounds. I've shown two sample records below. The last big is always a currency field e.g. in the first one it is 4,76. In the second one it is 2,00. The second has an account number that is the pattern of \d{6}-\d{6}. Anything after that is the currency. 24.02 24.02VALINTATALO MEGAHERTSI4,76- 24.02 24.02DOE MRIDANG 157235-1234582,00- Could you help me out with this regex? What I've written so far is given below but it considers everything after the 'dash' in the account number to be the currency. .*?(\d\d\.\d\d)(.*?)\s*(?<!\d{6}-\d{6})(\d*,\d\d) Thanks in advance

    Read the article

  • Freezing a dual-mode (GUI and console) application using cx_Freeze

    - by Mridang Agarwalla
    Hi, I've developed a Python application that runs both in the GUI mode and the console mode. If any arguments are specified, it runs in a console mode else it runs in the GUI mode. I've managed to freeze this using cx_Freeze. I had some problems hiding the black console window that would pop up with wxPython and so I modified my setup.py script like this: import sys from cx_Freeze import setup, Executable base = None if sys.platform == "win32": base = "Win32GUI" setup( name = "simple_PyQt4", version = "0.1", description = "Sample cx_Freeze PyQt4 script", executables = [Executable("PyQt4app.py", base = base)]) This works fine but now when I try to open up my console and run the executable from there, it doesn't output anything. I don't get any errors or messages so it seems that cx_Feeze is redirecting the stdout somewhere else. Is is possible to get it to work with both mode? Nothing similar to this seems to be documented anywhere. :( Thanks in advance. Mridang

    Read the article

  • Tips/Process for web-development using Django in a small team

    - by Mridang Agarwalla
    We're developing a web app uing Django and we're a small team of 3-4 programmers — some doing the UI stuff and some doing the Backend stuff. I'd love some tips and suggestions from the people here. This is out current setup: We're using Git as as our SCM tool and following this branching model. We're following the PEP8 for your style guide. Agile is our software development methodology and we're using Jira for that. We're using the Confluence plugin for Jira for documentation and I'm going to be writing a script that also dumps the PyDocs into Confluence. We're using virtualenv for sandboxing We're using zc.buildout for building This is whatever I can think of off the top of my head. Any other suggestions/tips would be welcome. I feel that we have a pretty good set up but I'm also confident that we could do more. Thanks.

    Read the article

  • How does the PPA fit into the scenario of publishing an application to the Ubuntu Software Center?

    - by Mridang Agarwalla
    I've been going through docs for the past couple of hours but I haven't understood what the PPA is? I have a cross-platform Java application that I'd like to publish to the Ubuntu Software Center. My application is open-source and I'm using Github. Apparently, publishing applications to the store isn't as simple as uploading a deb package - am I right? I need to create an account on Launchpad and put all my code there. I don't intend to move from Git to Bzr merely for the sake of publishing to the app store but luckily, one is able to set up source-code mirroring from Github to Launchpad. Since my application is still very premature, it'll have updates fairly often. When I build my application on my machine, do I simply go my Ubuntu App Developer page and upload the new DEB package or do they build my application from source? What exactly is the PPA for? I don't think I'll need too many of the Launchpad features so I'd like to stick to Github if possible. (Publishing for Ubuntu really isn't trivial. I can see why there are so many developers out there who haven't published their applications to the Ubuntu Software Center. Publishing an Android applications has been the easiest so far.)

    Read the article

  • Tips/Process for web-development using Django in a small team

    - by Mridang Agarwalla
    We're developing a web app uing Django and we're a small team of 3-4 programmers — some doing the UI stuff and some doing the Backend stuff. I'd love some tips and suggestions from the people here. This is out current setup: We're using Git as as our SCM tool and following this branching model. We're following the PEP8 for your style guide. Agile is our software development methodology and we're using Jira for that. We're using the Confluence plugin for Jira for documentation and I'm going to be writing a script that also dumps the PyDocs into Confluence. We're using virtualenv for sandboxing We're using zc.buildout for building This is whatever I can think of off the top of my head. Any other suggestions/tips would be welcome. I feel that we have a pretty good set up but I'm also confident that we could do more. Thanks.

    Read the article

  • Convert JSON to HashMap using Gson in Java

    - by mridang
    Hi, I'm requesting data from a server which returns data in the JSON format. Casting a HashMap into JSON when making the request wasn't hard at all but the other way seems to be a little tricky. The JSON response looks like this: { "header" : { "alerts" : [ { "AlertID" : "2", "TSExpires" : null, "Target" : "1", "Text" : "woot", "Type" : "1" }, { "AlertID" : "3", "TSExpires" : null, "Target" : "1", "Text" : "woot", "Type" : "1" } ], "session" : "0bc8d0835f93ac3ebbf11560b2c5be9a" }, "result" : "4be26bc400d3c" } What way would be easiest to access this data? I'm using the GSON module. Cheers.

    Read the article

  • Change user email in Django without using django-profiles

    - by mridang
    Hi guys, In my Django application I would like the user to be able to change the email address. I've seen solution of StackOverflow pointing people to django-profiles. Unfortunately I don't want to use a full fledged profile module to accomplish a tiny feat of changing the users email. Has anyone seen this implemented anywhere. The email address verification procedure by sending a confirmation email is a requisite in this scenario. I've spent a great a deal of time trying to a find a solution that works but to no avail. Cheers.

    Read the article

  • Redirect logging output using custom logging handler

    - by mridang
    Hi Guys, I'm using a module in my python app that writes a lot a of messages using the logging module. Initially I was using this in a console application and it was pretty easy to get the logging output to display on the console using a console handler. Now I've developed a GUI version of my app using wxPython and I'd like to display all the logging output to a custom control — a multi-line textCtrl. Is there a way i could create a custom logging handler so i can redirect all the logging output there and display the logging messages wherever/however I want — in this case, a wxPython app. Thanks

    Read the article

  • What should I use - Mako or Django?

    - by mridang
    Hi guys, I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks

    Read the article

  • Returning form errors for AJAX request in Django

    - by mridang
    Hi Guys, I've been finding my way around Django and jQuery. I've built a basic form in Django. On clicking submit, I'm using jQuey to make an AJAX request to the sever to post my data. This bit seems to work fine and I've managed to save the data. Django returns a ValidatioError when a form is invalid. Could anyone tell me how to return this set of error messages as a response to my AJAX request so i can easily iterate through it using JS and do whatever? I found this snippet. Looking at the JS bit (processJson) you'll see that he seems to get the error messages by extracting them from the response HTML. It seems kinda kludgy to me. Is this a best way to go about it? My apologies for any vagueness. Thanks in advance.

    Read the article

  • Sort list of items in Django

    - by mridang
    Hi Guys, I have a Django view called change_priority. I'm posting a request to this view with a commas separated list of values which is basically the order of the items in my model. The data looks like this: 1,4,11,31,2,4,7 I have a model called Items which has two values - id and priority. Upon getting this post request, how can I set the priority of the Item depending upon the list order. So my data in the db would look like. 1,1 4,2 11,3 31,4 2,5 4,6 7,7 Thanks guys.

    Read the article

  • Reflection Permission problems when using the GSON library in a applet.

    - by mridang
    I'm writing an Applet that makes some JSON-RPC calls. I'm using the Google JSON library (GSON) to cast the response JSON into a class. Thsi seems to work fine as is but when I use this code in my Applet, I'm hit with a java.lang.reflect.reflectpermission. From what I read on this thread on SO, it seems that since GSON uses Reflection, I cannot use it in Applets unless I explicitly modify the security policy. How can I get around this? I've created a bunch of classes in my application and was using the Gson.fromJson method to cast it into the class. Is there any way to achieve the same functionality without having to re-write half my code. (The complexity of dealing with JSON in Java seems to be in a league of its own!) Thanks in advance guys.

    Read the article

  • Display image in Django Form

    - by Mridang Agarwalla
    I need to display an image in a Django form. My Django form is quite simple - a single text input field. When I initialise my Django form in a view, I would like to pass the image path as a parameter, and the form when rendered in the template displays the image. Is is possible with Django forms or would i have to display the image separately? Thanks.

    Read the article

  • Marquee style progressbar in wxPython

    - by Mridang Agarwalla
    Hi, Could anyone tell me how to implement a marquee style progress bar in wxPython? As stated on MSDN: you can animate it in a way that shows activity but does not indicate what proportion of the task is complete. Thank you. I tried this but it doesn't seem to work. The timer ticks but the gauge doesn't scroll. Any help? import wx import time class MyForm(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Timer Tutorial 1", size=(500,500)) # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.update, self.timer) self.gauProgress = wx.Gauge(panel, range=1000, pos=(30, 50), size=(440, 20)) self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start") self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle) def onToggle(self, event): btnLabel = self.toggleBtn.GetLabel() if btnLabel == "Start": print "starting timer..." self.timer.Start(1000) self.toggleBtn.SetLabel("Stop") else: print "timer stopped!" self.timer.Stop() self.toggleBtn.SetLabel("Start") def update(self, event): print "\nupdated: ", print time.ctime() self.gauProgress.Pulse() # Run the program if __name__ == "__main__": app = wx.PySimpleApp() frame = MyForm().Show() app.MainLoop()

    Read the article

  • Get parent directory in Python

    - by Mridang Agarwalla
    Hi, Could someone tell me how to get the parent directory of a path in Python in a cross platform way. E.g. C:\Program Files --- C:\ and C:\ --- C:\ If the directory doesn't have a parent directory, it returns the directory itself. The question might seem simple but I couldn't dig it up through Google. Thanks.

    Read the article

  • Accessing nested HashMaps in Java

    - by mridang
    Hi, I have a HashMap in Java, the contents of which (as you all probably know) can be accessed by HashMap.get("keyname"); If a have a HashMap inside another HashMap i.e. a nested HashMap, how would i access the contents? Can i do this like this, inline: HashMap.get("keyname").get("nestedkeyname"); Thank you.

    Read the article

  • Regex to match the first file in a rar archive file set in Python

    - by mridang
    I need to uncompress all the files in a directory and for this I need to find the first file in the set. I'm currently doing this using a bunch of if statements and loops. Can i do this this using regex? Here's a list of files that i need to match: yes.rar yes.part1.rar yes.part01.rar yes.part001.rar yes.r01 yes.r001 These should NOT be matched: no.part2.rar no.part02.rar no.part002.rar no.part011.rar no.r002 no.r02 I found a similar regex on this thread but it seems that Python doesn't support varible length lookarounds. A single line regex would be complicated but I'll document it well and it's not a problem. It's just one of those problems you beat your heap up, over. Thanks in advance guys. :)

    Read the article

  • making urllib request in Python from the client side

    - by mridang
    Hi Guys, I've written a Python application that makes web requests using the urllib2 library after which it scrapes the data. I could deploy this as a web application which means all urllib2 requests go through my web-server. This leads to the danger of the server's IP being banned due to the high number of web requests for many users. The other option is to create an desktop application which I don't want to do. Is there any way I could deploy my application so that I can get my web-requests through the client side. One way was to use Jython to create an applet but I've read that Java applets can only make web-requests to the server it is deployed on and the only way to to circumvent this is to create a server side proxy which leads us back to the problem of the server's ip getting banned. This might sounds sound like and impossible situation and I'll probably end up creating a desktop application but I thought I'd ask if anyone knew of an alternate solution. Thanks.

    Read the article

  • Fuzzy string matching algorithm in Python

    - by Mridang Agarwalla
    Hi guys, I'm trying to find some sort of a good, fuzzy string matching algorithm. Direct matching doesn't work for me — this isn't too good because unless my strings are a 100% similar, the match fails. The Levenshtein method doesn't work too well for strings as it works on a character level. I was looking for something along the lines of word level matching e.g. String A: The quick brown fox. String B: The quick brown fox jumped over the lazy dog. These should match as all words in string A are in string B. Now, this is an oversimplified example but would anyone know a good, fuzzy string matching algorithm that works on a word level. Thanks in advance.

    Read the article

  • How can i bundle other files when using cx_freeze?

    - by Mridang Agarwalla
    I'm using Python 2.6 and cx_Freeze 4.1.2 on a Windows system. I've created the setup.py to build my executable and everything works fine. When cx_Freeze runs it movies everything to the build directory. I have some other files that i would like included in my build directory. How can i do this? Here's my structure. src\ setup.py janitor.py README.txt CHNAGELOG.txt helpers\ uncompress\ unRAR.exe unzip.exe Here's my snippet: setup ( name='Janitor', version='1.0', description='Janitor', author='John Doe', author_email='[email protected]', url='http://www.this-page-intentionally-left-blank.org/', data_files = [ ('helpers\uncompress', ['helpers\uncompress\unzip.exe']), ('helpers\uncompress', ['helpers\uncompress\unRAR.exe']), ('', ['README.txt']) ], executables = [ Executable\ ( 'janitor.py', #initScript ) ] ) I can't seem to get this to work. Do i need a MANIFEST.in file? Thank you.

    Read the article

  • Including libraries in project. Best practise.

    - by mridang
    Hi guys, I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this information into a README file informing the use about the other required libraries. I've placed all these libraries into a libs sub folder in my source directory. When checking my code into SVN, should I use something called svn:externals to link to other sources? Is there a way to dynamically update my libraries to the latest version or is this something I have to do manually when I release a new version. My sincerest apologies if my question sounds vague but I'm pretty lost in this matter and I don't know what to Google for. Thanks all.

    Read the article

  • strip extra quotes from html using uTidy

    - by mridang
    Hi, Could anyone tell me how I could remove extra-quotes from my HTML using uTidy. The malformed HTML tag looks like this: <th align="left""> <input type="submit" style="font-weight: bold;" value="Go"> </th> I would also like to remove some empty attributes in the HTML that looks like this (notice the alt tag): <img src="http://static.foobar.org/images/blank.gif" width="1" height="1" alt="" border="0"> Thank you.

    Read the article

  • Jythonc missing

    - by mridang
    Hi Guys, I just installed Jython 2.5.1. I want to convert my Python file into Java class file and it is instructed on the website to use the jythonc command-line tool but I can't find it. Does anyone know where I could find it? Basically what i was trying to accomplish is to get my Python code running client-side in a browser and the best way seemed to be by creating an applet using Jython. I don't want to create a desktop application and using Silverlight/IronPython is out of the question. Any other ideas are welcomed. Cheers!

    Read the article

1 2  | Next Page >