Search Results

Search found 322 results on 13 pages for 'victor rodrigues'.

Page 10/13 | < Previous Page | 6 7 8 9 10 11 12 13  | Next Page >

  • How to corelate gtk.ListStore items with my own models

    - by Victor Stanciu
    Hello, I have a list of Project objects, that I display in a GTK TreeView. I am trying to open a dialog with a Project's details when the user double-clicks on the item's row in the TreeView. Right now I get the selected value from the TreeView (which is the name of the Project) via get_selection(), and search for that Project by name in my own list to corelate the selection with my own model. However, this doesn't feel quite right (plus, it assumes that a Project's name is unique), and I was wondering if there is a more elegant way of doing it.

    Read the article

  • Question about best practices and Macros from the book 'C++ Coding Standards'

    - by Victor T.
    From Herb Sutter and Andrei Alexandrescu's 'C++ Coding Standards', Item 16: Avoid Macros under Exceptions for this guideline they wrote: For conditional compilation (e.g., system-dependent parts), avoid littering your code with #ifdefs. Instead, prefer to organize code such that the use of macros drives alternative implementations of one common interface, and then use the interface throughout. I'm having trouble understanding exactly what they mean by this. How can you drive alternate implementations without the use of #ifdef conditional compile macro directives? Can someone provide an example to help illustrate what's being proposed by the above paragraph? Thanks

    Read the article

  • fastest way to search through this data object? (python)

    - by victor
    I have a data object that looks like this: { 'node-16': { 'tags': ['cuda'], 'localNodes': [ { 'name': 'nC', 'consumesFrom': ['nA', 'nB'], 'classType': 'VectorAdder.VectorAdder' }, { 'name': 'nB', 'consumesFrom': None, 'classType': 'RandomVector' } ] }, 'node-17': { 'tags': ['boring'], 'localNodes': [ { 'name': 'nA', 'consumesFrom': None, 'classType': 'RandomVector' } ] } } Notice that node nA is a producer for nC. What's the fastest way to find out if a given localNode is a producer for another localnode in the data structure (and not within the same list)? For example, I would like to know that nA (node-17) produces for nC (exists on node-16). But I don't need to know that nB produces for nC, since they exist in the same localNodes list.

    Read the article

  • Loop throught form inputs

    - by Victor
    I have a form with lots of inputs. I want to get each id and value and then put them in $.load method. I tried this: $("#form input").each(function() { var name = $(this).attr("id"); var value = $(this).attr("value"); $.extend(params, { name, value }); }); and then use $.load("script.php", params); But obviously it doesn't work. In params I have only one element "name". And I'm not sure I should use extend method too.

    Read the article

  • How to install python package without copy everything into lib/site-packages?

    - by Victor Lin
    I want to develop a common python package, I got other packages depends on it. For example: packageA/ packageB/ packageC/ commonPackage/ packageA, packageB and packageC can all be executed directly, but they are all depend on commonPackage. I want to install the commonPackage into lib/site-packages, but I don't want it copys the source code. Instead, I want it creates a commonPackage.pth in lib/site-packages with the path of where the commonPackage at. So that when I modify commonPackage or update it from SVN, I don't need to install it again. Here comes the problem, how can I write the setup.py or use the options of python setup.py install so that it would do what I want?

    Read the article

  • Algorithm to split an article without breaking the reading flow or HTML code

    - by Victor Stanciu
    Hello, I have a very large database of articles, of varying lengths. The articles have HTML elements in them. I have to insert some ads (simple <script> elements) in the body of each article when it is displayed (I know, I hate ads that interrupt my reading too). Now, the problem is that each ad must be inserted at about the same position in each article. The simplest solution is to simply split the article on a fixed number of characters (without breaking words), and insert the ad code. This, however, runs the risk of inserting the ad in the middle of a HTML tag. I could go the regex way, but I was thinking about the following solution, using JS: Establish a character count threshold. For example, "the add should be inserted at about 200 words" Set accepted deviations in each direction, say -20, +20 characters. Loop through each text node inside the article, and while doing so, keep count of the total number of characters so far Once the count exceeds the threshold, make the following decision: 4.1. If count exceeds the threshold by a value lower that the positive accepted deviation (for example, 17 characters), insert the ad code just after the current text node. 4.2. If the count is greater than the sum of the threshold and the deviation, roll back to the previous text node, and make the same decision, only this time use the previous count and check if it's lower than the difference between the threshold and the deviation, and if not, insert the ad between the current node and the previous one. 4.3. If the 4.1 and 4.2 fail (which means that the previous node reached a too low character count and the current node a too high one), insert the ad after whatever character count is needed inside the current element. I know it's convoluted, but it's the first thing out of my mind and it has the advantage that, by trying to insert the ad between text nodes, perhaps it will not break the flow of the article as bad as it would if I would just stick it in (like the final 4.3 case) Here is some pseudo-code I put together, I don't trust my english-explaining skills: threshold = 200 deviation = 20 current_count = 0 for each node in article_nodes { previous_count = current_count current_count = current_count + node.length if current_count < threshold { continue // next interation } if current_count > threshold + deviation { if previous_count < threshdold - deviation { // insert ad in current node } else { // insert ad between the current and previous nodes } } else { // insert ad after the current node } break; } Am I over-complicating stuff, or am I missing a simpler, more elegant solution?

    Read the article

  • jQuery/JavaScript Date form validation

    - by Victor Jackson
    I am using the jQuery date picker calendar in a form. Once submitted the form passes params along via the url to a third party site. Everything works fine, except for one thing. If the value inserted into the date field by the datepicker calendar is subsequently deleted, or if the default date, that is in the form on page load, is deleted and the form is submitted I get the following error: "Conversion from string "" to type 'Date' is not valid." The solution to my problem is really simple, I want to validate the text field where the date is submitted and send out a default date (current date) if the field is empty for any reason. The problem is I am terrible at Javascript and cannot figure out how to do this. Here is the form code for my date field. [var('default_date' = date)] <input type="text" id="datepicker" name="txtdate" value="[$default_date]" onfocus="if (this.value == '[$default_date]') this.value = '';" onchange="form.BeginDate.value = this.value; form.EndDate.value = this.value;" /> <input type="hidden" name="BeginDate" value="[$default_date]"/> <input type="hidden" name="EndDate" value="[$default_date]"/>

    Read the article

  • Twitter bootstrap modal loads wrong remote data

    - by Victor S
    I'm using Twitter Bootstrap modal featurs and loading data from remote locations. I'm providing the remote url for a set of thumbnails with the hope that once the thumbnail is clicked, the appropriate data (a large version of the image) is displayed. I'm using the html declarative style to define the remote urls and all the features of the modal. What I find is that Twitter bootstrap modal loads first remote url then does not display subsequent remote data, (although a request to the proper url is made in Chrome) but displays first loaded data always. How do I get it to show the proper data? View: #gallery-navigation %ul - @profile.background_images.each do |image| %li = link_to image_tag(image.background_image.url(:thumb)), remote_image_path(image.id), :role => "button", :data => {:toggle => "modal", :target => "#image-modal", :remote => remote_image_path(image.id)}, :id => "image-modal" / Modal #image-modal.modal.hide.fade(role="dialog" aria-hidden="true" data-backdrop="true") .modal-body Controller: def remote_image @image = current_user.profile.background_images.find(params[:image_id]) respond_to do |format| format.html { render :partial => "remote_image", :locals => { :image => @image } } end end

    Read the article

  • Javascript obfuscation help

    - by Victor
    I need some help to understand how this code was obfuscated. The code is: <a id="suggest" href="#" ajaxify="/ajax/social_graph/invite_dialog.php?class=FanManager&amp;node_id=108463912505356" class=" profile_action actionspro_a" rel="dialog-post">Suggest to Friends</a> And the obfuscation is: \x3c\x61\x20\x69\x64\x3d\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x23\x22\x20\x61\x6a\x61\x78\x69\x66\x79\x3d\x22\x2f\x61\x6a\x61\x78\x2f\x73\x6f\x63\x69\x61\x6c\x5f\x67\x72\x61\x70\x68\x2f\x69\x6e\x76\x69\x74\x65\x5f\x64\x69\x61\x6c\x6f\x67\x2e\x70\x68\x70\x3f\x63\x6c\x61\x73\x73\x3d\x46\x61\x6e\x4d\x61\x6e\x61\x67\x65\x72\x26\x61\x6d\x70\x3b\x6e\x6f\x64\x65\x5f\x69\x64\x3d\x31\x30\x38\x34\x36\x33\x39\x31\x32\x35\x30\x35\x33\x35\x36\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x20\x70\x72\x6f\x66\x69\x6c\x65\x5f\x61\x63\x74\x69\x6f\x6e\x20\x61\x63\x74\x69\x6f\x6e\x73\x70\x72\x6f\x5f\x61\x22\x20\x72\x65\x6c\x3d\x22\x64\x69\x61\x6c\x6f\x67\x2d\x70\x6f\x73\x74\x22\x3e\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6f\x20\x46\x72\x69\x65\x6e\x64\x73\x3c\x2f\x61\x3e","\x73\x75\x67\x67\x65\x73\x74 Now I used unescape on the above obfuscated code to read it. What I want to know is what exactly was used to obfuscate the code like that? Basically, I need to customize the readable code to the same obfuscation. Any help would be greatly appreciated.

    Read the article

  • How to output floating point numbers with a custom output format in C++?

    - by Victor Liu
    The problem is that I want to output Mathematica compatible floating point numbers. The only difference with the standard IOStream or printf output format is that the exponential e is replaced by *^: Standard C/C++ output format: 1.23e-4 Mathematica format: 1.23*^-4 Is there a way to manipulate streams to achieve this effect? My original idea was just to use istringstream and dump it to a string and then replace all the e's. I would also be okay if someone posted code to parse through the bits of the floating point number and output it directly (i.e. a printf("%e") replacement).

    Read the article

  • Deployment of a .NET application making use of SQL Server 2008

    - by Victor John Saliba
    I have searched the internet thoroughly for this type of issue, there were responses but hasn't really found a concrete solution yet. I have an application which makes use of SQL Server 2008 R2 and thus it makes connections with a database file which I have set up. The application executes successfully, makes connections with the database and retrieves/inserts/updates data to and fro the database. However when I come to create a deployment project i.e. a setup project, I fail to transfer my database files to other computers and make database connections. I have checked the SQL Server 2008 prerequisite in the publish settings of the application and has also included the database files. Can anyone suggest the best way to this type of setup? Thanks

    Read the article

  • Designing template for Ruby on Rails view. What and where to learn?

    - by Victor
    Hi. I have a project going on, and I am in charge of the front-end design, whereas my developers will work on the back-end with Ruby on Rails. I do not know Ruby on Rails, and am designing front-end using XHTML, CSS, jQuery, 960.gs CSS Framework. My developer is supposed to take my design and connect the elements of back-end to it, with Ajax too. What are the things that I should know while designing the template/view so that I won't kick my developers' asses with my design? How to help the connecting of elements painless? I understand I must avoid . Some Ruby on Rails developers also prefer Blueprint CSS Framework over 960.gs. Any guidance? Thanks.

    Read the article

  • MinGW-gcc PCH not speeding up wxWidget build times. Is my setup correct?

    - by Victor T.
    Hi all, I've been building wxMSW 2.8.11 with the latest stable release of mingw-gcc 4.5.1 and I'm trying to see if the build could be sped up using precompiled headers. My initial attempts at this doesn't seem to work. I basically followed the given instructions here. I created a wxprec.h precompiled header with the following: g++ -O2 -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -I..\..\lib\gcc_dll\mswu -I..\..\include -W -Wall -DWXBUILDING -I..\.. \src\tiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src \regex -I..\..\src\expat\lib -DwxUSE_BASE=1 -DWXMAKINGDLL -Wno-ctor- dtor-privacy ../../include/wx/wxprec.h That does successfully create a wxprec.h.gch that's about ~1.6meg in size. Now I proceed to build wxmsw using the follow make command from cmd.exe shell: mingw32-make -f makefile.gcc While, the build does succeed I noticed no speedup whatsoever then if pch wasn't used. To make sure gcc was actually using the pch I added -H in the config.gcc and did another rebuild. Indeed, the outputted include list does show a '!' next to the wxprec.h so gcc is supposely using it. What's the reason for pch not working? Did I setup the precompiled headers correctly or am I missing a step? Just for reference comparison, here's the compile times I get when building wxmsw 2.8.11 with the other compilers(visual studio 2010 and C++ Builder 2007). The time savings is pretty significant. | | release, pch | release, nopch | debug, nopch ------------------------------------------------------- | gcc451 | 8min 33sec | 8min 17sec | 8min 49sec | msc_1600 | 2min 23sec | 13min 11sec | -- | bcc593 | 0min 59sec | 2min 29sec | -- Thanks

    Read the article

  • Getting "stack level too deep" error when deploying with Capistrano, Rails 3.1 ruby 1.9.2

    - by Victor S
    Here is the log for the cap deploy script output around where the error occurs. Anny suggestions why this might be happening? Thanks! [yup.la] executing command [yup.la] sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile' ** [out :: yup.la] rake aborted! ** [out :: yup.la] ** [out :: yup.la] stack level too deep ** [out :: yup.la] (in /srv/www/portrait/releases/20120406051647/app/assets/stylesheets/mobile.css.scss) ** [out :: yup.la] ** [out :: yup.la] Tasks: TOP => assets:precompile:primary ** [out :: yup.la] (See full trace by running task with --trace) ** [out :: yup.la] command finished in 30868ms *** [deploy:update_code] rolling back * executing "rm -rf /srv/www/portrait/releases/20120406051647; true" servers: ["yup.la"] [yup.la] executing command [yup.la] sh -c 'rm -rf /srv/www/portrait/releases/20120406051647; true' command finished in 288ms failed: "sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on yup.la /Users/victorstan/Sites/portrait ?

    Read the article

  • Load a list of localized strings at once in IOS

    - by Victor Ronin
    I want to show a table with the list of strings which are localized. The straightforward method would be: a) Point data source to my ViewController b) Define an array c) Allocate the array in my ViewController and init (arrayWithObjects) it with the strings from localized resources (NSLocalizedString) d) Use this array in UITableViewDataSource delegated methods Mainly my concern is item b). The construction looks quite heavy and I wonder whether I can somehow specify and load whole list of localized string at once.

    Read the article

  • Googlebot substitutes the links of Rails app with subdomain.

    - by Victor
    I have this Rails app, with domain name abc.com. I am also having a separate subdomain for Piwik stats, in this subdomain stats.abc.com. Googlebot somehow listed some of the links with my subdomain too. http://abc.com/login http://stats.abc.com/login http://abc.com/signup http://stats.abc.com/signup The ones with stats will reference to the same page in the app, but are treated entirely different website. I have put in robots.txt in stats after this matter, but wondering if there is any appropriate way to block this because I may have new subdomains in future. Here's my content in robots.txt User-agent: * Disallow: / Thanks.

    Read the article

  • Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

    - by Victor Liu
    I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed certain optimizations. I was trying to look at the assembly listing generated with g++ (g++ -c -g -O2 -Wa,-ahl=file.s file.c) to possibly see what is going on under the hood, but the output is too cryptic to me. What techniques do people use to tackle this problem, and are there any good references on how to interpret the assembly listings of optimized code or articles specific to the GCC toolchain that talk about this problem?

    Read the article

  • Convert image color space and output separate channels in OpenCV

    - by Victor May
    I'm trying to reduce the runtime of a routine that converts an RGB image to a YCbCr image. My code looks like this: cv::Mat input(BGR->m_height, BGR->m_width, CV_8UC3, BGR->m_imageData); cv::Mat output(BGR->m_height, BGR->m_width, CV_8UC3); cv::cvtColor(input, output, CV_BGR2YCrCb); cv::Mat outputArr[3]; outputArr[0] = cv::Mat(BGR->m_height, BGR->m_width, CV_8UC1, Y->m_imageData); outputArr[1] = cv::Mat(BGR->m_height, BGR->m_width, CV_8UC1, Cr->m_imageData); outputArr[2] = cv::Mat(BGR->m_height, BGR->m_width, CV_8UC1, Cb->m_imageData); split(output,outputArr); But, this code is slow because there is a redundant split operation which copies the interleaved RGB image into the separate channel images. Is there a way to make the cvtColor function create an output that is already split into channel images? I tried to use constructors of the _OutputArray class that accepts a vector or array of matrices as an input, but it didn't work.

    Read the article

  • What should I read to improve my C++ style

    - by Victor Ronin
    I was developing for quite long time already on C/C++ (mostly C, which makes style poorer). So, I know how to use it. However, quite often I stuck with style decisions like: - should I return error code here, throw exceptions, return error through a parameter - should I have all this stuff in constructor or should I create separate init function for that. and so on. Any solutions WILL work. However, each of them has cons and pros, which I know and most importantly which I don't know. It would be very nice to read something regarding overall C++ development style, coding practices and so forth. What do you recommend?

    Read the article

  • saving nested attributes

    - by Victor Martins
    I have a form that has a nested form like this: <%- for subscription in @task.subscriptions -% <%- semantic_fields_for "task[subscription_attributes][]", subscription do |subscription_form|% <%- subscription_form.inputs do -% <%= subscription_form.input :workhours, :label = subscription.user.full_name% <%- end -% <%- end -% <%- end -% And on the task model I have: accepts_nested_attributes_for :subscriptions attr_accessible :mission_id, :statuscode_id, :name, :objectives, :start_at , :end_at, :hours, :testimony ,:subscriptions_attributes In the form (view) I get the correct values on the workhours fields. But when I change the values and hit the submit button, the values are never changed. I can't figure out why...

    Read the article

  • Authentication in Rails, where to start?

    - by Victor P
    Hello. Im learning Rails by building apps. I want to make my first authenticated app: users signup, login, do some changes in models they have access to and logout. I did the Google search but it is quite confusing: many plugins, many tutorials. Don't know where to start. Is there a state-of-the-art authentication method for Rails? What do you use in Production to authenticate your users? Any help in this will be helpful. Thanks

    Read the article

  • jquery attribute indexOf

    - by Victor
    When I am getting at an attribute onclick of custom(Reporting Services) checkbox it gives me correct result. However when I am trying to use indexOf on that result it says "Object doesn't support this property or method", i.e. this is fine, gives me a long string $('input[id*=CustomCheckBox]').click(function() { alert( $(this).attr("onclick") ); }); But this gives an error(object doesn't support this property or method): $('input[id*=CustomCheckBox]').click(function() { if ($(this).attr("onclick").indexOf("SomeString") > -1 ) { //do some processing here } } What would I need to modify so that indexOf is working properly?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13  | Next Page >