Search Results

Search found 4763 results on 191 pages for 'adams john'.

Page 107/191 | < Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >

  • Rails / JBuilder - Entity array with has_many attributes

    - by seufagner
    I have two models, Person and Image and I want return an json array of Persons with your Images. But I dont want return all Image attributes, but produces a different result. Code below: class Person < ActiveRecord::Base has_many :images, as: :imageable validates :name, presence: true accepts_nested_attributes_for :images, :reject_if => lambda { |img| img['asset'].blank? } end class Image < ActiveRecord::Base belongs_to :imageable, polymorphic: true mount_uploader :asset, ImageUploader validates :asset, presence: true end zzz.jbuilder.json template json.persons(@rodas, :id, :name, :images) json produced: { "rodas": [{ "id": 4, "name": "John", "images": [ { "asset": { "url": "/uploads/image/xxxx.png" } }, { "asset": { "url": "/uploads/image/yyyyy.jpeg" } } ]}, { "id": 19, "name": "Mary", "images": [ { "asset": { "url": "/uploads/image/kkkkkkk.png" } } ] }] } I want something like: { "rodas": [ { "id": 4, "name": "John", "images": [ "/uploads/image/xxxx.png" , "/uploads/image/yyyy.jpeg" ] }, { "id": 10, "name": "Mary", "images": [ "/uploads/image/dddd.png" , "/uploads/image/xxxx.jpeg" ] } ]}

    Read the article

  • Lack of security in many PHP applications?

    - by John
    Over the past year of freelancing, I inherited two web projects, both of them built in PHP, both of them with sensitive information like credit card info, bank info, etc... In one application, when I typed http://thecompany.com/admin/, and without being asked for a username and password, I saw every user's sensitive information, including credit card numbers, bank account numbers etc... In another application, I was able to bypass the login screen by simply typing http://the2ndcompany.com/customer.php?user_id=777, and again, without any prompts for username and password, i was able to see user 777's credit card info. I cycled through a few more user_ids (any integer) and saw each person's credit card info. Is something wrong here? Or is this the quality of work that the "average" programmer produces? Because if this is what the average programmer produces, does that means I'm an...gasp...elite programmer?? No..that can't be right....something doesn't make sense. So my question is, is it just coincidence that I inherited two applications both of which are dangerously lacking in security? Or are there are a lot of bad PHP programmers out there?

    Read the article

  • How to resolve “Unit JclCompression was compiled with a different version of sevenzip.IOutArchive”?

    - by John
    Hello, There is already a similar question(link).The thing is I don't understand what unit I have to delete. I have installed the latest JCL library and added 'JclCompression' to the uses list in a unit and I get the error: "Unit JclCompression was compiled with a different version of sevenzip.IOutArchive". Please explain to me in a simpler way how to resolve the problem. Thanks in advance!

    Read the article

  • Why does Rake task enhancement differ between my local environment and when deploying to Heroku Cedar?

    - by John Bachir
    I have this in lib/tasks/foo.rake: Rake::Task["assets:precompile"].enhance do print ">>>>>>>> hello from precompile" end Rake::Task["assets:precompile:nondigest"].enhance do print ">>>>>>>> hello from precompile:nondigest" end When I run rake assets:precompile locally, both messages are printed. When I push to heroku, only the nondigest message is printed. However, according to the buildpack, the push is executing the exact same command as I am locally. Why does the enhancement to the base assets:precompile case not work on heroku but does work locally?

    Read the article

  • Is there a way to morph / convert a circular sprite into a square programmatically?

    - by John
    I have a sprite which is basically just an image of a circle and some content inside. Is there a way that I can programmatically stretch / distort it into something like: I don't care so much about the distortion. The original circular image is 100x100px, and the modified image should also be 100x100px. So its really the content that is being distorted. Can this be done using shaders or some other programmatic way ? The initial circular image is most likely determined at run time, which is why I need to programmatically convert the circular sprite to square. Please do not edit the tags, as the question applies to both versions of cocos2d (iPhone & x), and the solution will most likely work in both regardless of whether one uses C or C++ since the apis are similar, and OpenGL commands work similarly.

    Read the article

  • How can I start a TCP server in the background during a Perl unit test?

    - by John
    I am trying to write a unit test for a client server application. To test the client, in my unit test, I want to first start my tcp server (which itself is another perl file). I tried to start the TCP server by forking: if (! fork()) { system ("$^X server.pl") == 0 or die "couldn't start server" } So when I call make test after perl Makefile.PL, this test starts and I can see the server starting but after that the unit test just hangs there. So I guess I need to start this server in background and I tried the & at the end to force it to start in background and then test to continue. But, I still couldn't succeed. What am I doing wrong? Thanks.

    Read the article

  • DNS resolve without depending on router for asterisk system

    - by john
    Hello, Basically I have a Debian box running asterisk assigned an IP via DHCP with host-name XXX. My windows browser can resolve the host-name but if I use host-name in X-Lite or my SPA922 phone it fails to resolve. Is there any way of getting this to work without depending on the router or assigning a static IP (request is to make it portable). I was thinking zero-conf but am unsure (box has limited HDD too). Any help is most appreciated.

    Read the article

  • iPhone UISlider not visible

    - by John Qualis
    I want to add a UISlider to my app programmatically without using the IB. I am adding a UISlider to my UIViewController using the code below. However I don't see the slider when the view comes up. What am I missing? I am using iPhone SDK 3.1.2. Appreciate any help. @synthesize slider; .... - (void)viewDidLoad { ... ... slider = [[UISlider alloc] initWithFrame: CGRectMake(0, 480 - 80, 300, 20)]; slider.minimumValue = 0.0; slider.maximumValue = 100.0; slider.tag = 0; slider.value = 50; slider.continuous = YES; slider.enabled = YES; [slider addTarget:selfaction:@selector(handleSlider:)forControlEvents:UIControlEventValueChanged]; self.view addSubview:slider]; In the .h file ... UISlider *slider; ... @property (nonatomic, retain) UISlider *slider; - (void) handleSlider:(id)sender;

    Read the article

  • NSXMLParser with multiple attributes

    - by mitb67
    Hi. I have the following XML (doing an app for iPhone): <Row> <Field name="employee_id_disp">00070431</Field> <Field name="given_name">John</Field> <Field name="family_name">Doe</Field> </Row> ... How can I retrieve values only for one of the attributes, for example value "John" for attribute name="given_name" ? Thanks for answers.

    Read the article

  • I am trying to find how many vowels and consonants in my string in C

    - by John Walter
    #include <stdio.h> #include <string.h> int main() { int i; int counter=0, counter2=0; char *s; char name[30]; char vowel[6] = "AEIOU"; char consonants[21] = "BCDFGHJKLMNPQRSTVWXYZ"; printf ("input the string: "); scanf ("%s", name); printf ("The string is %s\n", name); for (i=0; name[i]!='\0'; i++) { if (s = strchr(vowel, name[i])) { counter++; } else if (s =strchr(consonants, name[i])) { counter2++; } printf ("First counter is %d\n", counter); printf ("The second counter is %d\n", counter2); return 0; } } And the question is, what is wrong with my code? why counter is not working? Because I tried a lot of ways, and nothing works, maybe someone can explain for me.

    Read the article

  • replace values in form.data when form fails validation

    - by John
    Hi I have a form field which requires a json object as its value when it is rendered. When the form is submitted it returns a comma seperated string of ids as its value (not a json string). however if the form does not validate i want to turn this string of ids back into a json string so it will display properly (is uses jquery to render the json object correctly). how would i do this? I was thinking of overwriting the form.clean method but when I tried to change self.data['fieldname'] I got the error 'This QueryDict instance is immutable' and when i tried to change self.cleaned_data['fieldname'] it didn't make a difference to the value of the field. Thanks

    Read the article

  • Brilliant features of C++

    - by John
    (Following Features to remove from C++ and Desired features for C++, I thought why not complete the trio...) What C++ features would you not change? What features are elegantly and brilliantly implemented and still look better than other popular languages?

    Read the article

  • Jquery autocomplete for input form, using Textpattern category list as a source

    - by John Stephens
    I'm using the Textpattern CMS to build a discussion site-- I have a firm grasp of XHTML and CSS, as well as Textpattern's template language, but PHP and Javascript are a bit beyond my cunning. On the input form to begin a new topic, users need to select a category from a list of over 5,000 options. Using the HTML select-type input element is very unwieldy, but it works. I would like to use some kind of Javascript magic to display a text-type input element that will read user input and display matches or autocomplete from the available categories, passing the required option's value into the appropriate database field. I've seen several autocomplete plugins for jquery, but the instructions presuppose that you understand how Javascript works. As I mentioned above, it's easy for me to generate the category list as a select-type input element, and I can hide that element using CSS. Is it possible to control select-list input using an autocomplete mechanism in a text-type input element? How would I do that?

    Read the article

  • C++ operator lookup rules / Koenig lookup

    - by John Bartholomew
    While writing a test suite, I needed to provide an implementation of operator<<(std::ostream&... for Boost unit test to use. This worked: namespace theseus { namespace core { std::ostream& operator<<(std::ostream& ss, const PixelRGB& p) { return (ss << "PixelRGB(" << (int)p.r << "," << (int)p.g << "," << (int)p.b << ")"); } }} This didn't: std::ostream& operator<<(std::ostream& ss, const theseus::core::PixelRGB& p) { return (ss << "PixelRGB(" << (int)p.r << "," << (int)p.g << "," << (int)p.b << ")"); } Apparently, the second wasn't included in the candidate matches when g++ tried to resolve the use of the operator. Why (what rule causes this)? The code calling operator<< is deep within the Boost unit test framework, but here's the test code: BOOST_AUTO_TEST_SUITE(core_image) BOOST_AUTO_TEST_CASE(test_output) { using namespace theseus::core; BOOST_TEST_MESSAGE(PixelRGB(5,5,5)); // only compiles with operator<< definition inside theseus::core std::cout << PixelRGB(5,5,5) << "\n"; // works with either definition BOOST_CHECK(true); // prevent no-assertion error } BOOST_AUTO_TEST_SUITE_END() For reference, I'm using g++ 4.4 (though for the moment I'm assuming this behaviour is standards-conformant).

    Read the article

  • Error in my OO Generics design. How do I workaround it?

    - by John
    I get "E2511 Type parameter 'T' must be a class type" on the third class. type TSomeClass=class end; ParentParentClass<T>=class end; ParentClass<T: class> = class(ParentParentClass<T>) end; ChildClass<T: TSomeClass> = class(ParentClass<T>) end; I'm trying to write a lite Generic Array wrapper for any data type(ParentParentClass) ,but because I'm unable to free type idenitifiers( if T is TObject then Tobject(T).Free) , I created the second class, which is useful for class types, so I can free the objects. The third class is where I use my wrapper, but the compiler throws that error. How do I make it compile?

    Read the article

  • Is there an equivalent for the Zip function in Clojure Core or Contrib?

    - by John Kane
    In Clojure, I want to combine two lists to give a list of pairs, > (zip '(1 2 3) '(4 5 6)) ((1 4) (2 5) (3 6)) In Haskell or Ruby the function is called zip. Implementing it is not difficult, but I wanted to make sure I wasn't missing a function in Core or Contrib. There is a zip namespace in Core, but it is described as providing access to the Zipper functional technique, which does not appear to be what I am after. Is there an equivalent function for combining 2 or more lists, in this way, in Core? If there is not, is it because there is an idiomatic approach that renders the function unneeded?

    Read the article

  • How should important terms be emphasized in documentation?

    - by John Rasch
    Software will often introduce and formalize concepts that may have ambiguous definitions in the real world. For example, in an attendance tracking system, an Occurrence refers to an Excused Absence, an Unexcused Absence, or a Tardy. In technical documentation (both in helper text and in user guides, etc), should these concepts be proper nouns, and as such, should they be capitalized in usage? In other words, which of the following examples is more appropriate: After an Occurrence has been created, it may be converted into an Excused Absence once the Approval Form has been uploaded. or After an occurrence has been created, it may be converted into an excused absence once the approval form has been uploaded.

    Read the article

  • Best way to test a batch email script

    - by John
    I have a php mail script sitting on a LAMP vps server. The script grabs about 1000 emails and sends them each an html email. I tested the script with about half a dozen of my own test email accounts and things worked fine. But I am concerned something may go wrong when I actually use this script for 1000 emails. Some things I would like to test for are 1) Confirm all 1000 emails were sent and received 2) Test to make sure emails did not end up in people's spam folders 3) Detect any other general failures Does anyone have suggestions on how I can test for the above cases? I would like to read about your experiences building batch email scripts.

    Read the article

  • Alternative to Windows Azure tables out of the cloud

    - by John Grey
    Hi :) I'm developing a .NET app, which needs to run both on Azure and on regular Windows Servers(2003). It needs to store a few GB of data and SQL Azure is too expensive for me, so I'll use Azure tables in the cloud version. Can you recommend a storage solution, which will run on standalone servers and have an API and behavior similar to Azure tables? From what I've seen Server AppFabric does not include Tables. TIA

    Read the article

  • How to maintain a persistant network-connection between two applications over a network?

    - by John
    I was recently approached by my management with an interesting problem - where I am pretty sure I am telling my bosses the correct information but I really want to make sure I am telling them the correct stuff. I am being asked to develop some software that has this function: An application at one location is constantly processing real-time data every second and only generates data if the underlying data has changed in any way. On the event that the data has changed send the results to another box over a network Maintains a persistent connection between the both machines, altering the remote box if for some reason the network connection went down From what I understand, I imagine that I need to do some reading on doing some sort of TCP/IP socket-level stuff. That way if the connection is dropped the remote location will be aware that the data it has received may be stale. However management seems to be very convinced that this can be accomplished using SOAP. I was under the impression that SOAP is more or less a way for a client to initiate a procedure from a server and get some results via the HTTP protocol. Am I wrong in assuming this? I haven't been able to find much information on how SOAP might be able to solve a problem like this. I feel like a lot of people around my office are using SOAP as a buzzword and that has generated a bit of confusion over what SOAP actually is - and is capable of. Any thoughts on how to accomplish this task would be appreciated!

    Read the article

  • BULK SMS, Long Codes (VMN MSIDN), T-mobile?

    - by John
    Does any US wireless carrier offer individuals or companies with a direct connection to the SMSC? The number is 747-772-3101 (repalce 7's with 6's) This number is registered to t-mobile, also verified by t-mobile to be a valid subscriber sending 160,000+ text messages monthly and that all they have is an unlimited text messaging plan on top of the cheapest voice plan. This company of the number verified to me that they don't use gsm modems as they are too slow. So I know it's possible but who would I contact, Sales or anyone else reachable through a 1-800 is ignorant to these services and developer.t-mobile is worthless and doesn't reply to emails. Any info??

    Read the article

< Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >