Daily Archives

Articles indexed Wednesday May 5 2010

Page 7/119 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Can I compare a template variable to an integer in App Engine templates?

    - by matt b
    Using Django templates in Google App Engine (on Python), is it possible to compare a template variable to an integer in an {% if %} block? views.py: class MyHandler(webapp.RequestHandler): def get(self): foo_list = db.GqlQuery(...) ... template_values['foos'] = foo_list template_values['foo_count'] = len(foo_list) handler.response.out.write(template.render(...)) My template: {% if foo_count == 1 %} There is one foo. {% endif %} This blows up with 'if' statement improperly formatted. What I was attempting to do in my template was build a simple if/elif/else tree to be grammatically correct to be able to state #foo_count == 0: There are no foos. #foo_count == 1: There is one foo. #else: There are {{ foos|length }} foos. Browsing the Django template documents (this link provided in the GAE documentation appears to be for versions of Django far newer than what is supported on GAE), it appears as if I can only actually use boolean operators (if in fact boolean operators are supported in this older version of Django) with strings or other template variables. Is it not possible to compare variables to integers or non-strings with Django templates? I'm sure there is an easy way to workaround this - built up the message string on the Python side rather than within the template - but this seems like such a simple operation you ought to be able to handle in a template. It sounds like I should be switching to a more advanced templating engine, but as I am new to Django (templates or any part of it), I'd just like some confirmation first.

    Read the article

  • jquery selectors (finding tag)

    - by matthewsteiner
    I'm sure this is simple, but I can't seem to figure it out. I need to be able to pass a function an element id, and know what element tag it is. For example: <a id="first"></a> <input id="last" /> If I know the id is "first", how can I get that the tag is "a"?

    Read the article

  • Can't seem to load a webview from xml, why?

    - by Bilthon
    Well, I'm trying to follow the tutorial from http://rapidandroid.org/wiki/Graphing. But I found a problem just in the first part of it. I'll describe the problem here, I just cannot understand how this could be wrong, it's pretty simple stuff. What am I doing wrong here? First I created a xml file called statistics.xml, in it among other things I put this code: <WebView android:id="@+id/webview" android:layout_height="fill_parent" android:layout_width="fill_parent"/> Now in the activity that is supposed to display this webview I'm doing this: public class DisplayStatistics extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView wv = (WebView) findViewById(R.id.webview); The problem arises here, as I seem to be getting null for wv whenever I test for it. Which means of course that findViewById(R.id.webview) couldn't find the view. But again, what am I doing wrong?? Of course I know I could also instantiate the webview directly from code without the need to specify it from the xml, but I was just wondering what was wrong about this way of doing it. Just in case I also added the following line in my android manifest file: <uses-permission android:name="android.permission.INTERNET" /> I'm not really sure if it's necessary for displaying the webview (I think not) but I just put it there to see if that was the problem, and it turned out it isn't. Thanks Nelson

    Read the article

  • Picker in UINavigationController

    - by william-hu
    Hi , i use a UIPickerView in my root view of UINavigationController . And i used one button, when i pressed it, pass the data(shows in picker) to the next level view of navigation controller. How should i do this? Thank you!

    Read the article

  • ActiveMQ broker configuration error when specifying persistenceAdapter: "One of '{WC[##other:"http:/

    - by Joe
    I am setting up a simple ActiveMQ embedded broker. It works fine, until I try to configure a persistence adapter. I am basically just copying the configuration from http://activemq.apache.org/persistence.html#Persistence-ConfiguringKahaPersistence. When I add this configuration to my Spring configuration, like so: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amq="http://activemq.apache.org/schema/core" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd"> <amq:broker useJmx="true" persistent="true" brokerName="localhost"> <amq:transportConnectors> <amq:transportConnector name="vm" uri="vm://localhost"/> </amq:transportConnectors> <amq:persistenceAdapter> <amq:kahaPersistenceAdapter directory="activemq-data" maxDataFileLength="33554432"/> </amq:persistenceAdapter> </amq:broker> </beans> I get the error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'amq:persistenceAdapter'. One of '{WC[##other:"http://activemq.apache.org/schema/core"]}' is expected. When I take out the amq:persistenceAdapter element, it works fine. The same error happens no matter which persistence adapter I include in the body, e.g. jdbc, journal, etc. Any help would be greatly appreciated. Thanks.

    Read the article

  • Oracle VM Slides and Replay

    - by Alex Blyth
    Thanks everyone for attending the webcast on "Oracle VM and Virtualisation" last week. I know I got some useful info out of the session and on behalf of all those who attended I'll say Thank You to Dean Samuels for spending some time talking to us.Slides are available here Oracle VM - 28/04/2010 View more presentations from Oracle Australia. You can download the replay here. Next week's session is on Oracle Database Security and will cover briefly all the big guns like Transparent Data Encryption, Database Vault, Audit Vault, Flashback Data Archive as well as touching on some of the features that are so often skipped over. You can enroll for this session here. Thanks again Cheers Alex

    Read the article

  • How to create item templates for SQL files, for Visual Studio Database Projects

    - by jonathanconway
    It's possible to define your own custom templates for normal project types, such as templates for C# files, for a Class Library project. What about a 'Database Project' scenario? I would like to define a standard template for adding a stored procedure, which uses the company's conventions for all stored procedures, such as standard comments at the top. Which folder contains Visual Studio templates for Database projects?

    Read the article

  • Appstore approval - Using activation codes.

    - by Tejaswi Yerukalapudi
    Hi, I'm in the process of building an app related to healthcare IT. My company wants to be able to distribute it through the appstore, but only if a device identified by the UDID of is specifically provisioned in the database. I've got all that built, but I was wondering if Apple might reject something like this. Has anyone had any experience with activation codes? Thanks, Teja.

    Read the article

  • Focus In An ItemsControl

    - by Andrew
    I have an ItemsControl that uses a DataTemplate. The DataTemplate contains a TextBox, which can receive keyboard focus. I need to be able to move the keyboard focus from the currently focused TextBox in the DataTemplate to the next TextBox, as if the Tab key has been pressed. I've noticed that there is a UIElement.MoveFocus() method, but this begs the question as to which UIElement should be used to call the method. This is probably the reason why I haven't gotten this method to work for me... Any help would be really appreciated! Thanks, Andrew

    Read the article

  • How to declare a(n) vector/array of reducer objects in Cilk++?

    - by Jin
    Hi All, I had a problem when I am using Cilk++, an extension to C++ for parallel computing. I found that I can't declare a vector of reducer objects: typedef cilk::reducer_opadd<int> T_reducer; vector<T_reducer> bitmiss_vec; for (int i = 0; i < 24; ++i) { T_reducer r; bitmiss_vec.push_back(r); } However, when I compile the code with Cilk++, it complains at the push_back() line: cilk++ geneAttack.cilk -O1 -g -lcilkutil -o geneAttack /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = cilk::reducer_opadd<int>]’: /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_vector.h:601: instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ geneAttack.cilk:667: instantiated from here /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h:229: error: ‘cilk::reducer_opadd<Type>::reducer_opadd(const cilk::reducer_opadd<Type>&) [with Type = int]’ is private /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/ext/new_allocator.h:107: error: within this context /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’: /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_vector.h:605: instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ geneAttack.cilk:667: instantiated from here /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h:229: error: ‘cilk::reducer_opadd<Type>::reducer_opadd(const cilk::reducer_opadd<Type>&) [with Type = int]’ is private /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/vector.tcc:252: error: within this context /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_vector.h:605: instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ geneAttack.cilk:667: instantiated from here /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h:230: error: ‘cilk::reducer_opadd<Type>& cilk::reducer_opadd<Type>::operator=(const cilk::reducer_opadd<Type>&) [with Type = int]’ is private /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/vector.tcc:256: error: within this context /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h: In static member function ‘static _BI2 std::__copy_backward<_BoolType, std::random_access_iterator_tag>::__copy_b(_BI1, _BI1, _BI2) [with _BI1 = cilk::reducer_opadd<int>*, _BI2 = cilk::reducer_opadd<int>*, bool _BoolType = false]’: /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_algobase.h:465: instantiated from ‘_BI2 std::__copy_backward_aux(_BI1, _BI1, _BI2) [with _BI1 = cilk::reducer_opadd<int>*, _BI2 = cilk::reducer_opadd<int>*]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_algobase.h:474: instantiated from ‘static _BI2 std::__copy_backward_normal<<anonymous>, <anonymous> >::__copy_b_n(_BI1, _BI1, _BI2) [with _BI1 = cilk::reducer_opadd<int>*, _BI2 = cilk::reducer_opadd<int>*, bool <anonymous> = false, bool <anonymous> = false]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_algobase.h:540: instantiated from ‘_BI2 std::copy_backward(_BI1, _BI1, _BI2) [with _BI1 = cilk::reducer_opadd<int>*, _BI2 = cilk::reducer_opadd<int>*]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/vector.tcc:253: instantiated from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_vector.h:605: instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ geneAttack.cilk:667: instantiated from here /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h:230: error: ‘cilk::reducer_opadd<Type>& cilk::reducer_opadd<Type>::operator=(const cilk::reducer_opadd<Type>&) [with Type = int]’ is private /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_algobase.h:433: error: within this context /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h: In function ‘void std::_Construct(_T1*, const _T2&) [with _T1 = cilk::reducer_opadd<int>, _T2 = cilk::reducer_opadd<int>]’: /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_uninitialized.h:87: instantiated from ‘_ForwardIterator std::__uninitialized_copy_aux(_InputIterator, _InputIterator, _ForwardIterator, std::__false_type) [with _InputIterator = cilk::reducer_opadd<int>*, _ForwardIterator = cilk::reducer_opadd<int>*]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_uninitialized.h:114: instantiated from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = cilk::reducer_opadd<int>*, _ForwardIterator = cilk::reducer_opadd<int>*]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_uninitialized.h:254: instantiated from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>) [with _InputIterator = cilk::reducer_opadd<int>*, _ForwardIterator = cilk::reducer_opadd<int>*, _Tp = cilk::reducer_opadd<int>]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/vector.tcc:275: instantiated from ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_vector.h:605: instantiated from ‘void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = cilk::reducer_opadd<int>, _Alloc = std::allocator<cilk::reducer_opadd<int> >]’ geneAttack.cilk:667: instantiated from here /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/cilk++/reducer_opadd.h:229: error: ‘cilk::reducer_opadd<Type>::reducer_opadd(const cilk::reducer_opadd<Type>&) [with Type = int]’ is private /usr/local/cilk/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/stl_construct.h:81: error: within this context make: *** [geneAttack] Error 1 jinchen@galactica:~/workspace/biometrics/genAttack$ make cilk++ geneAttack.cilk -O1 -g -lcilkutil -o geneAttack geneAttack.cilk: In function ‘int cilk cilk_main(int, char**)’: geneAttack.cilk:670: error: expected primary-expression before ‘,’ token geneAttack.cilk:670: error: expected primary-expression before ‘}’ token geneAttack.cilk:674: error: ‘bitmiss_vec’ was not declared in this scope make: *** [geneAttack] Error 1 The Cilk++ manule says it supports array/vector of reducers, although there are performance issues to consider: "If you create a large number of reducers (for example, an array or vector of reducers) you must be aware that there is an overhead at steal and reduce that is proportional to the number of reducers in the program. " Anyone knows what is going on? How should I declare/use vector of reducers? Thank you

    Read the article

  • Problems compiling libjingle/gtk+-2.0 for Mac OS X

    - by mindthief
    Hi All, I'm trying to compile libjingle on Mac OSX Snow Leopard. The INSTALL file said to './configure', 'make' and 'make install', as usual. But make fails for me. Initially it gave some messages indicating that I didn't have pkg-config installed (I guess OSX doesn't come with it installed?), so I downloaded pkg-config from http://pkgconfig.freedesktop.org/releases/ Now I get this message: Package gtk+-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+-2.0' found I tried to install gtk by using the script at SourceForge: http://sourceforge.net/projects/gtk-osx/ (this is the website pointed to by the gtk website) Running the script didn't really seem to do anything, here is the output: $./gtk-osx-build-setup.sh Checking out jhbuild (2.27.3) from git... From git://git.gnome.org/jhbuild * tag 2.27.3 -> FETCH_HEAD Installing jhbuild... Installing jhbuild configuration... Installing gtk-osx moduleset files... Done. $ And I still get that error message about "Package gtk+-2.0 not found" while make-ing libjingle. Help will be appreciated, thanks!

    Read the article

  • How to use Regex Replace to conditionally remove blocks of text?

    - by lauren meyers
    I would like to conditionally remove a block of text between specifed start and stop delimiters. The code below does not work, but hopefully it suggests enough of what I am trying to accomplish. If dr("ReferralPoints") > 0 Then Dim objRegex As Regex = New Regex("[HASNOVALUE:REFERRALPOINTS](.*)[/HASNOVALUE:REFERRALPOINTS]", RegexOptions.IgnoreCase + RegexOptions.Singleline) Dim result As String = objRegex.Replace(strBody, "") End If

    Read the article

  • Can I compare a template variable to an integer in Django/App Engine templates?

    - by matt b
    Using Django templates in Google App Engine (on Python), is it possible to compare a template variable to an integer in an {% if %} block? views.py: class MyHandler(webapp.RequestHandler): def get(self): foo_list = db.GqlQuery(...) ... template_values['foos'] = foo_list template_values['foo_count'] = len(foo_list) handler.response.out.write(template.render(...)) My template: {% if foo_count == 1 %} There is one foo. {% endif %} This blows up with 'if' statement improperly formatted. What I was attempting to do in my template was build a simple if/elif/else tree to be grammatically correct to be able to state #foo_count == 0: There are no foos. #foo_count == 1: There is one foo. #else: There are {{ foos|length }} foos. Browsing the Django template documents (this link provided in the GAE documentation appears to be for versions of Django far newer than what is supported on GAE), it appears as if I can only actually use boolean operators (if in fact boolean operators are supported in this older version of Django) with strings or other template variables. Is it not possible to compare variables to integers or non-strings with Django templates? I'm sure there is an easy way to workaround this - built up the message string on the Python side rather than within the template - but this seems like such a simple operation you ought to be able to handle in a template. It sounds like I should be switching to a more advanced templating engine, but as I am new to Django (templates or any part of it), I'd just like some confirmation first.

    Read the article

  • Recommended (remote) backup technique for SQL Compact?

    - by Cool Jon
    Hello. Is there a generally recommended approach to backing up an SQL CE/SQLite database over the Internet? The client source is .NET/Windows based, the backup destination runs Ubuntu. I am using a small SQL CE database and have been trying to figure out the most reasonable approach to doing this. The file size (in terms of transfer time/bandwidth) isn't a big deal. I had a look around, and so far the things I've given thought are: Online backup services (Dropbox, Mozy) Opening an FTP/SFTP connection Writing a custom protocol with public/private keys Unsure regarding #1 because I doubt they would like it if somebody transferred gigabytes of data using a POST; and they do not seem to offer native (or .NET) APIs. FTP/SFTP seems risky in terms of security and privileges (as the password/key would need to be stored on the client side). With the right user group/user privileges this may work. Custom protocol seems overkill, which is why I am hoping somebody has already defined a reasonable API for language/platform-independent backups over the Internet. Any hints S.O.?

    Read the article

  • I can not add navigation item to navigation bar

    - by user262325
    Hello everyone I add a Navigation Bar to an view, I noticed that there is no left side arrow(Navigation Item). so I drag a Navigation Item from library to Navigation Bar, the green mark "+" displayed, but the Navigation Item was not added to the Navigation Bar actually. Welcome any comment Thanks interdev

    Read the article

  • Executing Powershell from Perl

    - by Marlin
    Hi, I have a bunch of Powershell scripts which I need to run from Perl. I have the following code but for some reason the Powershell scripts dont get invoked. I have tried both the backtick and the system command $path = "C:/Users/PSScript.ps1"; $pwspath = "c:/windows/system32/windowspowershell/v1.0/powershell.exe"; $output = $pwspath -command $path; system($pwspath -command $path); Please help me out here.

    Read the article

  • Is it a good idea to use .Net for commercial software?

    - by user146780
    I was playing around with .Net reflector today and realized that Miicrosoft's entire Expression suite is written in .Net. As a result I was pretty much able to see the underlying code for expression. This makes it far easier than binary to break copy protection. I think that that's a big deal. Is it generally recommended to make commercial software in .Net where it is fairly easy to see the source code down to the variable names? I was surprised that Microsoft didn't at least dotfescate it. Thanks

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >