Search Results

Search found 541 results on 22 pages for 'novice'.

Page 18/22 | < Previous Page | 14 15 16 17 18 19 20 21 22  | Next Page >

  • Spring upload file

    - by benaissa
    hi every one, I'm a novice in Spring, i started to develop an application to upload files,i used the official spring documentation but, i have this error: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:823) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:143) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream at org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:191) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:350) at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:155) at org.springframework.web.multipart.commons.CommonsMultipartResolver.resolveMultipart(CommonsMultipartResolver.java:138) at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:907) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:750)

    Read the article

  • [Apache Camel] Generating multiple files based on DB query in a nice way

    - by chantingwolf
    Dear all, I have a following question. I have to generate many files based on sql query. Let's say for example, I have get from database a list of orders made today and genarate file for each order and later store each file on ftp. Ideally I would like to get follewing. Not quite sure how to get it. from(MyBean).to(Ftp) The problem and main question is how to generate multiple messages by custom bean (for example). I am not sure if splitter EIP is ok in this case because in my case I have not just one message to split, but I just have to generate and send many messages. http://camel.apache.org/splitter.html I hope, someone meet this problem before. If the task will be to generate just one file - everything is quite simple - you need just fill Exchange.OutMessage (or something like this). But what about multiple files - I really can't get, how to manage this situation. P.S. Sorry if this question is stupid. I am novice in Camel (working with it just for coupe weeks). It's a great tool. Actually, that's why I want to use in in the best way. Thanks a lot.

    Read the article

  • Eclipse (Aptana) Typing Lag

    - by Zack
    Hello SO, I've been using Aptana for some time now, and as of recent I've been dealing with files that are really, really big (500+ lines of code, which is huge for me, being a novice developer). Whenever I deal with smaller files, I get that weird sensation that I'm "in front of" what's typing, but now I'm quite sure of it--there is a significant lag between when I type something and when I see the text appear on screen. I don't have this issue with Dreamweaver CS3, so I know my computer has the capability to edit these files without this happening, but Eclipse still lags. I also don't see when something is being deleted if I hold down backspace, I see the first few characters get deleted, but then everything "hangs." Once I release the backspace key, the characters that would've been shown deleting instantly vanish all at once. The same thing happens with the forward delete key. I'm beginning to think this is an issue with Java, since I have the same feeling that everything is slightly "behind me" when I'm using -any- Java application. The computer is an intel Pentium 4 3.2 GHz Prescott, with 2GB's of DDR400 RAM and a Radeon HD3650 graphics card. If anyone knows how to fix this lagging issue, I'm all ears (eyes?); if anyone can recommend a different IDE with capabilities similar to Aptana (I do Python, HTML, CSS and JS; I use Git for SCM), I'd be glad to give it a try. Thanks!

    Read the article

  • preg_match_all and newlines inside quotes

    - by David
    Another noob regex problem/question. I'm probably doing something silly so I thought I'd exploit the general ingenuity of the SO regulars ;) Trying to match newlines but only if they occur within either double quotes or single quotes. I also want to catch strings that are between quotes but contain no newlines. Okay so there's what i got, with output. Below that, will be the output I would like to get. Any help would be greatly appreciated! :) I use Regex Coach to help me create my patterns, being a novice and all. According to RC, The pattern I supply does match all occurances within the data, but in my PHP, it skips over the multi-line part. I have tried with the 'm' pattern modifier already, to no avail. Contents of $CompressedData: <?php $Var = "test"; $Var2 = "test2"; $Var3 = "blah blah blah blah blah blah blah blah blah"; $Var4 = "hello"; ?> Pattern / Code: preg_match_all('!(\'|")(\b.*\b\n*)*(\'|")!', $CompressedData, $Matches); Current print_r output of $Matches: Array ( [0] => Array ( [0] => "test" [1] => "test2" [2] => "hello" ) ... } DESIRED print_r output of $Matches: Array ( [0] => Array ( [0] => "test" [1] => "test2" [2] => "blah blah blah blah blah blah blah blah blah" [3] => "hello" ) ... }

    Read the article

  • regex php: find everything in div

    - by Fifth-Edition
    I'm trying to find eveything inside a div using regexp. I'm aware that there probably is a smarter way to do this - but I've chosen regexp. so currently my regexp pattern looks like this: $gallery_pattern = '/([\s\S]*)<\/div/'; And it does the trick - somewhat. the problem is if i have two divs after each other - like this. <div class="gallery">text to extract here</div> <div class="gallery">text to extract from here as well</div> I want to extract the information from both divs, but my problem, when testing, is that im not getting the text in between as a result but instead: "text to extract here text to extract from here as well" So . to sum up. It skips the first end of the div. and continues on to the next. The text inside the div can contain "<", "/" and linebreaks. just so you know! Does anyone have a simple solution to this problem? Im still a regexp novice.

    Read the article

  • Form values in a list item

    - by Tri
    Here is the site mock-up I'm working on for my job: http://dev.arm.gov/~noensie/dqhands/cgi-bin/explorer. I'm still a novice in web developing and I need help with placing form values in a list item to pass on to another page. I'd rather not go in great detail the purpose of this website, but in terms of its basic use, select the parameters in the middle column for a request and add it to the list on the right column by pressing on "add request" button when it appears. After the list have been populated, a user would submit the selected requests, which will direct them to another page based on the requests selected (or added to the list, same thing). That last sentence is where I'm having a problem. Right now, each of request in the list in the right column are <li> elements and I assign them attribute values that needed to be passed on to the next page. I tried inserting a hidden input with same values, but I'm still not sure how to utilize that; I'm not even sure using the hidden input is the correct way. Also the "submit request" button is located outside the <form> block. I was going to utilize javascript and jQuery to enable the button to serialize the values in the <form> block, but I don't know quite how to do that. Go ahead and take a look at my javascript code (index.js) and slay me, or, I mean, my code. It's still pretty elementary and short (~260 lines, that's short right?). I will take any help for this problem (as the matter of fact, if you see any other problems or a better way of implementation of something, go ahead and mention that too); tips, advice, code samples, or whatever else you can contribute, it will be greatly appreciated. Tri

    Read the article

  • Why my test xml is failing with very simple XSD Schema?

    - by JSteve
    Hi all, I am a bit novice in xml schema. I would be grateful if somebody help me out to understand why my xml is not being validated with the schema: Here is my Schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/testSchema" xmlns="http://www.example.org/testSchema"> <xs:element name="Employee"> <xs:complexType> <xs:sequence> <xs:element name="Name"> <xs:complexType> <xs:sequence> <xs:element name="FirstName" /> <xs:element name="LastName" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Here is my test xml: <?xml version="1.0" encoding="UTF-8"?> <Employee xmlns="http://www.example.org/testSchema"> <Name> <FirstName>John</FirstName> <LastName>Smith</LastName> </Name> </Employee> I am getting following error by Eclipse xml editor/validator: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Name'. One of '{Name}' is expected. I could not understand what is wrong with this schema or my xml.

    Read the article

  • Creating dynamic jQuery tooltips for dynamic content

    - by Mel
    I'm using the qTip jQuery plugin to create tooltips for a set of links. Two problems: How do I create a set of tooltips for three dynamically generated links where the content of the tooltip will also be dynamic: a href="books.cfm?bookID=11"Book One a href="books.cfm?bookID=22"Book Two a href="books.cfm?bookID=33"Book Three I would like to create a tooltip for each link. Each tooltip will then load details about each book. Thus I must pass the bookID to the tooltip: $('#catalog a[href]').each(function() { $(this).qtip( { content: { URL: 'cfcs/viewbooks.cfc?method=bookDetails', data: { bookID: <cfoutput>#indexView.bookID#</cfoutput> }, method: 'get' } }); }); Unfortunately the above code is not working correctly. I've gotten it to work when I've used a static 'bookID' instead of a dynamically generated number. Even when it does work (by using a static number for 'bookID', I can't format the data correctly. It comes back as a query result, or a bunch of text strings. Should I send back the results as HTML? Unsure. PS: I am an absolute NOVICE to Javascript and jQuery, so please try not to be as technical. Many thanks!

    Read the article

  • Deleting a non-owned dynamic array through a pointer

    - by ayanzo
    Hello all, I'm relatively novice when it comes to C++ as I was weened on Java for much of my undergraduate curriculum (tis a shame). Memory management has been a hassle, but I've purchased a number books on ansi C and C++. I've poked around the related questions, but couldn't find one that matched this particular criteria. Maybe it's so obvious nobody mentions it? This question has been bugging me, but I feel as if there's a conceptual point i'm not utilizing. Suppose: char original[56]; cstr[0] = 'a'; cstr[1] = 'b'; cstr[2] = 'c'; cstr[3] = 'd'; cstr[4] = 'e'; cstr[5] = '\0'; char *shaved = shavecstr(cstr); delete[] cstrn; where char* shavecstr(char* cstr) { size_t len = strlen(cstr); char* ncstr = new char[len]; strcpy(ncstr,cstr); return ncstr; } In that the whole point is to have 'original' be a buffer that fills with characters and routinely has its copy shaved and used elsewhere. To prevent leaks, I want to free up the memory held by 'shaved' to be used again after it passes through some arguments. There is probably a good reason for why this is restricted, but there should be some way to free the memory as by this configuration, there is no way to access the original owner (pointer) of the data.

    Read the article

  • How do I find, count, and display unique elements of an array using Perl?

    - by Luke
    I am a novice Perl programmer and would like some help. I have an array list that I am trying to split each element based on the pipe into two scalar elements. From there I would like to spike out only the lines that read ‘PJ RER Apts to Share’ as the first element. Then I want to print out the second element only once while counting each time the element appears. I wrote the piece of code below but can’t figure out where I am going wrong. It might be something small that I am just overlooking. Any help would be greatly appreciated. ## CODE ## my @data = ('PJ RER Apts to Share|PROVIDENCE', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Condo|WEST WARWICK', 'PJ RER Condo|WARWICK'); foreach my $line (@data) { $count = @data; chomp($line); @fields = split(/\|/,$line); if (($fields[0] =~ /PJ RER Apts to Share/g)){ @array2 = $fields[1]; my %seen; my @uniq = grep { ! $seen{$_}++ } @array2; my $count2 = scalar(@uniq); print "$array2[0] ($count2)","\n" } } print "$count","\n"; ## OUTPUT ## PROVIDENCE (1) JOHNSTON (1) JOHNSTON (1) JOHNSTON (1) 6

    Read the article

  • SO what RDF database do i use for product attribute situation initially i thought about using EAV?

    - by keisimone
    Hi, i have a similar issue as espoused in http://stackoverflow.com/questions/695752/product-table-many-kinds-of-product-each-product-has-many-parameters i am convinced to use RDF now. only because of one of the comments made by Bill Karwin in the answer to the above issue but i already have a database in mysql and the code is in php. 1) So what RDF database should I use? 2) do i combine the approach? meaning i have a class table inheritance in the mysql database and just the weird product attributes in the RDF? I dont think i should move everything to a RDF database since it is only just products and the wide array of possible attributes and value that is giving me the problem. 3) what php resources, articles should i look at that will help me better in the creation of this? 4) more articles or resources that helps me to better understand RDF in the context of the above challenge of building something that will better hold all sorts of products' attributes and values will be greatly appreciated. i tend to work better when i have a conceptual understanding of what is going on. Do bear in mind i am a complete novice to this and my knowledge of programming and database is average at best.

    Read the article

  • Java problem: Could not find main class HelloWorld

    - by Newbie
    I am new to java(a real novice). I installed Java 1.7.0 in the following folder C:\Program Files\Java The environment variable which I set are CLASSPATH : C:\Program Files\Java\jdk1.7.0\jre\lib\rt.jar; Path : C:\Program Files\Java\jdk1.7.0\bin; JAVA_HOME : C:\Program Files\Java; I have presented here the class names which are in my system. Next I wrote a program(HelloWorld.java) import java.io.*; class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } When I am compiling using javac HelloWorld.java it is compiling fine. But after I issue java HelloWorld I am encountering the below error Error: Could not find main class HelloWorld Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:198) Caused by: java.lang.ClassNotFoundException: HelloWorld at java.net.URLClassLoader$1.run(URLClassLoader.java:299) at java.net.URLClassLoader$1.run(URLClassLoader.java:288) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:287) at java.lang.ClassLoader.loadClass(ClassLoader.java:422) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325) at java.lang.ClassLoader.loadClass(ClassLoader.java:355) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:195) After a bit of google search I found that may be something wrong in the environment variable. I tried to play with that but no luck. I know that it may be a very simple thing for the real java developers(actually basic) but for me as of now no luck! I even RESTARTED the machine and then again I tried to run but with same fate. OS: Windows XP(Version 2002) with Service pack 3 Help needed . Thanks .

    Read the article

  • How to generate an ear file from a maven-archetype-webapp artifact?

    - by Mike
    I currently have a project built with maven-archetype-webapp artifact. The default packaging for this project is war. Is it possible for me to insert the maven-ear-plugin in this webapp pom.xml generate an ear file that contains this project war? I tried that, but the war file doesn't get embedded in the generated ear file. It has everything except the war file. I read many Maven related articles, and perhaps I could use maven-archetype-j2ee-simple artifact. However, I'm reluctant to this use for 2 reasons:- This artifact handles ejbs and all the extra features that I don't use. It makes my project looks bloated. Second, it seems like it requires me to install the web module into the repository first before I can create the ear file. Is this the preferred way to create an ear file? How do I create an ear file that contains the war file using maven-ear-plugin from my webapp's pom.xml? If this way is not possible, what's the preferred way? I'm sorry if my questions sound a little novice, I realized I have whole lot more to learn about Maven. Thanks much.

    Read the article

  • My perl script is acting funny...

    - by TheGNUGuy
    I am trying to make a jabber bot from scratch and my script is acting funny. I was originally developing the bot on a remote CentOS box, but I have switched to a local Win7 machine. Right now I'm using ActiveState Perl and I'm using Eclipse with the perl plugin to run a debug the script. The funny behavior I'm experiencing occurs when I run or debug the script. If I run the script using the debugger it works fine, meaning I can send messages to the bot and it can send messages to me. However when I just execute the script normally the bot sends the successful connection message then it disconnects from my jabber server and the script ends. I'm a novice when it comes to perl and I can't figure out what I'm doing wrong. My guess is it has something to do with the subroutines and sending the presence of the bot. (I know for sure that it has something to do with sending the bot's presence because if the presence code is removed, the script behaves as expected except the bot doesn't appear to be online.) If anyone can help me with this that would be great. I originally had everything in 1 file but separated them into several trying to figure out my problem here are the pastebin links to my source code. jabberBot.pl: http://pastebin.com/cVifv0mm chatRoutine.pm: http://pastebin.com/JXmMT7av trimSpaces.pm: http://pastebin.com/SkeuWtu1 Thanks again for any help!

    Read the article

  • SQL Concurrent test update question

    - by ptoinson
    Howdy Folks, I have a SQLServer 2008 database in which I have a table for Tags. A tag is just an id and a name. The definition of the tags table looks like: CREATE TABLE [dbo].[Tag]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](255) NOT NULL CONSTRAINT [PK_Tag] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) Name is also a unique index. further I have several processes adding data to this table at a pretty rapid rate. These processes use a stored proc that looks like: ALTER PROC [dbo].[lg_Tag_Insert] @Name varchar(255) AS DECLARE @ID int SET @ID = (select ID from Tag where Name=@Name ) if @ID is null begin INSERT Tag(Name) VALUES (@Name) RETURN SCOPE_IDENTITY() end else begin return @ID end My issues is that, other than being a novice at concurrent database design, there seems to be a race condition that is causing me to occasionally get an error that I'm trying to enter duplicate keys (Name) into the DB. The error is: Cannot insert duplicate key row in object 'dbo.Tag' with unique index 'IX_Tag_Name'. This makes sense, I'm just not sure how to fix this. If it where code I would know how to lock the right areas. SQLServer is quite a different beast. First question is what is the proper way to code this 'check, then update pattern'? It seems I need to get an exclusive lock on the row during the check, rather than a shared lock, but it's not clear to me the best way to do that. Any help in the right direction will be greatly appreciated. Thanks in advance.

    Read the article

  • Accessing functions in a swf-file through javascript [chatroulette.com]

    - by RadiantHeart
    Lately I have been interested in the code behind chatroulette.com. As you probably know it is a peer-to-peer webcam-chat-service written in actionscript, as I understand. What i have been wondering about is weather its possible to extract the ip-address of whomever you are currently communicating with. I have seen services that do that, but they require that you install a program that runs alongside on your computer sniffing UDP-packages. I was wondering if there was a simpler method. What I do know is that the javascript on the page communicates with the application via "ExternalInterface". On this area I am pretty much a novice but according to my limited understanding you cant get information from the flash-application unless you have configured a listener for a call from javascript and then attach a callback to that event. Is this correct or can you access public functions and variables directly through javascript? There is for example a public function like this: public function get outgoingAddress():String{ return (this.__info.outgoingAddress); } Can it be accessed directly through javascript? If it cant be done so easily, is it possible to decompile the .swf-file, change it (add some functions) and recompile it and run it instead? I am hoping someone can satisfy my curiosity here. Here are two links to a decompiled version of the swf-file. The first with line numbering and one without. With line numbering ˜ 3.5 Mbyte Without line numbering ˜ 2.1 Mbyte

    Read the article

  • PHP (CodeIgniter) Pass Object Through Session

    - by FranticPedantic
    I am using PHP5 and CodeIgniter and I am trying to implement a single-sign on feature with facebook (although I don't think that facebook is relevant to the question). I am somewhat of a novice with PHP and definitely one with CodeIgniter, so if you think my approach is just completely off telling me that would be helpful too. So here is in short what I am doing: //Controller 1 $this->load->plugin("facebook"); $facebook = new Facebook(array ( 'appId' => $fbconfig['appid'], 'secret' => $fbconfig['secret'], 'cookie' => true, ) ); $fbsession = $facebook->getSession(); //works fine $this->session->set_userdata('facebook', serialize($facebook); Now I would like to grab that facebook object in a different controller. //Controller 2 $facebook = unserialize($this->session->userdata('facebook')); $fbsession = $facebook->getSession(); Produces the error: Call to undefined method getSession. So I look up more about serialization and think that maybe it just doesn't know what the facebook object's attributes are. So I add in a $this->load->plugin('facebook'); To controller 2 as well and I get a "Cannot redeclare class facebook." I am strongly suspecting that I am misunderstanding sessions here. Do I have to somehow tell PHP what kind of object it is? Thanks for the help.

    Read the article

  • R: outlier cleaning for each column in a dataframe by using quantiles 0.05 and 0.95

    - by Rainer
    hi, I am a R-novice. I want to do some outlier cleaning and over-all-scaling from 0 to 1 before putting the sample into a random forest. g<-c(1000,60,50,60,50,40,50,60,70,60,40,70,50,60,50,70,10) If i do a simple scaling from 0 - 1 the result would be: > round((g - min(g))/abs(max(g) - min(g)),1) [1] 1.0 0.1 0.0 0.1 0.0 0.0 0.0 0.1 0.1 0.1 0.0 0.1 0.0 0.1 0.0 0.1 0.0 So my idea is to replace the values of each column that are greater than the 0.95-quantile with the next value smaller than the 0.95-quantile - and the same for the 0.05-quantile. So the pre-scaled result would be: g<-c(**70**,60,50,60,50,40,50,60,70,60,40,70,50,60,50,70,**40**) and scaled: > round((g - min(g))/abs(max(g) - min(g)),1) [1] 1.0 0.7 0.3 0.7 0.3 0.0 0.3 0.7 1.0 0.7 0.0 1.0 0.3 0.7 0.3 1.0 0.0 I need this formula for a whole dataframe, so the functional implementation within R should be something like: > apply(c, 2, function(x) x[x`<quantile(x, 0.95)]`<-max(x[x, ... max without the quantile(x, 0.95)) Can anyone help? Spoken beside: if there exists a function that does this job directly, please let me know. I already checked out cut and cut2. cut fails because of not-unique breaks; cut2 would work, but only gives back string values or the mean value, and I need a numeric vector from 0 - 1. for trial: a<-c(100,6,5,6,5,4,5,6,7,6,4,7,5,6,5,7,1) b<-c(1000,60,50,60,50,40,50,60,70,60,40,70,50,60,50,70,10) c<-cbind(a,b) c<-as.data.frame(c) Regards and thanks for help, Rainer

    Read the article

  • if/else statement in a function: using onclick as a switch

    - by Aurora Schmidt
    I have looked for solutions to this on google for what seems like an eternity, but I can't seem to formulate my search correctly, or nobody has posted the code I'm looking for earlier. I am currently trying to make a function that will modify one or several margins of a div element. I want to use an if/else statement within the function, so that the onclick event will switch between the two conditions. This is what I have been working on so far; function facebookToggle() { if($('#facebooktab').style.margin-left == "-250px";) { document.getElementById("facebooktab").style.marginLeft="0px"; } else { document.getElementById("facebooktab").style.marginLeft="-250px"; } } I have tried twisting it around a little, like switching between "marginLeft" and "margin-left", to see if I was just using the wrong terms.. I'm starting to wonder if it might not be possible to combine jQuery and regular javascript? I don't know.. It's all just guesses on my part at this point. Anyway, I have a div, which is now positioned (fixed) so almost all of it is hidden outside the borders of the browser. I want the margin to change onclick so that it will be fully shown on the page. And when it is shown, I want to be able to hide it again by clicking it. I might be approaching this in the wrong way, but I really hope someone can help me out, or even tell me another way to get the same results. Thank you for any help you can give me. You can see it in action at: http://www.torucon.no/test/ (EDIT: By the way, I am a complete javascript novice, I have no experience with javascript prior to this experiment. Please don't be too harsh, as I am aware I probably made some really stupid mistakes in this short code.) EDITED CODE: function facebookToggle() { if($('#facebooktab').css('margin-left', '-250px') { $('#facebooktab').css('margin-left', '0px'); } else { $('#facebooktab').css('margin-left', '-250px'); } }

    Read the article

  • Creating a class Hierarchy for Atoms,neutrons,protons,chemical reationc

    - by Smart Zulu
    I need help to create a program that can show the hierarchy of any Atoms and its components (neutrons,protons,electrons,and chemical reaction) Here is a code of what i have done so far,being a novice at the subject using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Atoms { public class Atoms { protected string name = "Sodium"; protected string element ="Metal"; public virtual void GetInfo() { Console.WriteLine("name: {0}",name); Console.WriteLine("element: {0}", element); } } class Proton : Atoms { public int number = 11 ; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Proton number: {0}",number); } } class Electron : Atoms { public int number = 11; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Electron number: {0}", number); } class Neutrons : Atoms { public int number = 12; public override void GetInfo() { base.GetInfo(); Console.WriteLine("Neutron number: {0}", number); } class TestClass { static void Main() { Proton P = new Proton(); P.GetInfo(); Neutrons N = new Neutrons(); N.GetInfo(); Electron E = new Electron(); E.GetInfo(); Console.WriteLine("click any key to exit"); Console.ReadLine(); } } } } }

    Read the article

  • C++ cin whitespace question

    - by buddyfox
    Programming novice here. I'm trying to allow a user to enter their name, firstName middleName lastName on one line in the console (ex. "John Jane Doe"). I want to make the middleName optional. So if the user enters "John Doe" it only saves the first and last name strings. If the user enters "John Jane Doe" it will save all three. I was going to use this: cin >> firstName >> middleName >> lastName; then I realized that if the user chooses to omit their middle name and enters "John Doe" the console will just wait for the user to enter a third string... I know I could accomplish this with one large string and breaking it up into two or three, but isn't there a simpler way to do it with three strings like above? I feel like I'm missing something simple here... Thanks in advance.

    Read the article

  • Which Stroustrup book should I use?

    - by Chris Simmons
    I'm a C# programmer that is looking to branch out. I'm bored of writing business software and want to start getting into graphics programming and games/simulators. So I figured, although writing that stuff isn't impossible in managed code, the "right" way to do that would be to look to C++, of course focussing on the language first, then getting into OpenGL or DirectX (or whatever). Way way back ('98? '99?) I had tried and failed to really grasp Stroustrup's The C++ Programming Language. I know that this book is often not recommended for the beginner. Anyway, I picked it back up (in a much more recent printing) and I'm actually getting it and enjoying it. I also have a copy of his textbook, Programming: Principles and Practice Using C++, which, as I understand it, is really geared toward teaching programming, not necessarily C++. I'm certainly not arrogant enough to claim I don't have anything more to learn about programming, data structures, algoriths, etc., however I'm not a novice there either. So my question is, with the goal of gaining the broader and more real-world-useful understanding of C++ and given my background, on which should I focus? The denser (as I perceive it) TCPPPL or the gentler Programming? EDIT: I thank everyone for the responses. However, I've got a personal choice here to make between these two books. Granted there are other very good books out there, but I'm already a good length into both of the books I mention and I'd like to finish one. So, can anyone respond on which would be the better and why? Time is not an issue; I'm not looking (at this point) at an "accelerated" read.

    Read the article

  • too much recursion in javascript with jquery mouseover

    - by Stacia
    I am a JS novice. Using some code I found here to help me with mouseover scale/rotate images but now when I try to apply it to more than one object I'm getting errors saying "too much recursion". Before the function didn't take any arguments, it just was on s_1 and it worked fine. I am tempted to just write different code for each object but that isn't very good programming practice. var over = false; $(function(){ $("#s_1").hover(function(){ over = true; swing_left_anim("#s_1"); }, function(){ over = false; }); $("#np_1").hover(function(){ over = true; swing_left_anim("np_1"); }, function(){ over = false; }); }); function swing_left_anim(obj){ $(obj).animate({ rotate: '0deg' }, { duration: 500 }); if (over) { $(obj).animate({ rotate: '25deg' }, 500, swing_right_anim(obj)); } } function swing_right_anim(obj){ $(obj).animate({ rotate: '-25deg' }, 500, swing_left_anim(obj)); }

    Read the article

  • MYSQL not running on Ubuntu OS - Error 2002.

    - by mgj
    Hi, I am a novice to mysql DB. I am trying to run the MYSQL Server on Ubuntu 10.04. Through Synaptic Package Manager I am have installed the mysql version: mysql-client-5.1 I wonder that how was the database password set for the mysql-client software that I installed through the above way.It would be nice if you could enlighten me on this. When I tried running this database, I encountered the error given below: mohnish@mohnish-laptop:/var/lib$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) mohnish@mohnish-laptop:/var/lib$ I referred to a similar question posted by another user. I didn't find a solution through the proposed answers. For instance when I tried the solutions posted for the similar question I got the following: mohnish@mohnish-laptop:/var/lib$ service start mysqld start: unrecognized service mohnish@mohnish-laptop:/var/lib$ ps -u mysql ERROR: User name does not exist. ********* simple selection ********* ********* selection by list ********* -A all processes -C by command name -N negate selection -G by real group ID (supports names) -a all w/ tty except session leaders -U by real user ID (supports names) -d all except session leaders -g by session OR by effective group name -e all processes -p by process ID T all processes on this terminal -s processes in the sessions given a all w/ tty, including other users -t by tty g OBSOLETE -- DO NOT USE -u by effective user ID (supports names) r only running processes U processes for specified users x processes w/o controlling ttys t by tty *********** output format ********** *********** long options *********** -o,o user-defined -f full --Group --User --pid --cols --ppid -j,j job control s signal --group --user --sid --rows --info -O,O preloaded -o v virtual memory --cumulative --format --deselect -l,l long u user-oriented --sort --tty --forest --version -F extra full X registers --heading --no-heading --context ********* misc options ********* -V,V show version L list format codes f ASCII art forest -m,m,-L,-T,H threads S children in sum -y change -l format -M,Z security data c true command name -c scheduling class -w,w wide output n numeric WCHAN,UID -H process hierarchy mohnish@mohnish-laptop:/var/lib$ which mysql /usr/bin/mysql mohnish@mohnish-laptop:/var/lib$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) I even tried referring to http://forums.mysql.com/read.php?11,27769,84713#msg-84713 but couldn't find anything useful. Please let me know how I could tackle this error. Thank you very much..

    Read the article

  • OpenCL - incremental summation during compute

    - by user1721997
    I'm absolutelly novice in OpenCL programming. For my app. (molecular simulaton) I wrote a kernel for calculate intermolecular potential of lennard-jones liquid. In this kernel I need to compute cumulative value of the potential of all particles with one: __kernel void Molsim(__global const float* inmatrix, __global float* fi, const int c, const float r1, const float r2, const float r3, const float rc, const float epsilon, const float sigma, const float h1, const float h23) { float fi0; float fi1; float d; unsigned int i = get_global_id(0); //number of particles (typically 2000) if(c!=i) { // potential before particle movement d=sqrt(pow((0.5*h1-fabs(0.5*h1-fabs(inmatrix[c*3]-inmatrix[i*3]))),2.0)+pow((0.5*h23-fabs(0.5*h23-fabs(inmatrix[c*3+1]-inmatrix[i*3+1]))),2.0)+pow((0.5*h23-fabs(0.5*h23-fabs(inmatrix[c*3+2]-inmatrix[i*3+2]))),2.0)); if(d<rc) { fi0=4.0*epsilon*(pow(sigma/d,12.0)-pow(sigma/d,6.0)); } else { fi0=0; } // potential after particle movement d=sqrt(pow((0.5*h1-fabs(0.5*h1-fabs(r1-inmatrix[i*3]))),2.0)+pow((0.5*h23-fabs(0.5*h23-fabs(r2-inmatrix[i*3+1]))),2.0)+pow((0.5*h23-fabs(0.5*h23-fabs(r3-inmatrix[i*3+2]))),2.0)); if(d<rc) { fi1=4.0*epsilon*(pow(sigma/d,12.0)-pow(sigma/d,6.0)); } else { fi1=0; } // cumulative difference of potentials fi[0]+=fi1-fi0; } } My problem is in the line: fi[0]+=fi1-fi0;. In the one-element vector fi[0] are wrong results. I read something about sum reduction, but I do not know how to do it during the calculation. Exist any simple solution of my problem?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22  | Next Page >