Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 135/448 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • LINQ extention SelectMany in 3.5 vs 4.0?

    - by Moberg
    Hi When I saw Darins suggestion here .. IEnumerable<Process> processes = new[] { "process1", "process2" } .SelectMany(Process.GetProcessesByName); ( http://stackoverflow.com/questions/3059667/process-getprocessesbyname/3059733#3059733 ) .. I was a bit intrigued and I tried it in VS2008 with .NET 3.5 - and it did not compiling unless I changed it to .. IEnumerable<Process> res = new string[] { "notepad", "firefox", "outlook" } .SelectMany(s => Process.GetProcessesByName(s)); Having read some Darins answers before I suspected that it was me that were the problem, and when I later got my hands on a VS2010 with.NET 4.0 - as expected - the original suggestion worked beautifully. My question is : What have happend from 3.5 to 4.0 that makes this (new syntax) possible? Is it the extentionmethods that have been extended(hmm) or new rules for lambda syntax or? I've tried to search but my google-fu was not strong enough. Please forgive if the question is a bit naive and note that I've taged it as beginner :)

    Read the article

  • Commenting out portions of code in Scala

    - by akauppi
    I am looking for a C(++) #if 0 -like way of being able to comment out whole pieces of Scala source code, for keeping around experimental or expired code for a while. I tried out a couple of alternatives and would like to hear what you use, and if you have come up with something better? // Simply block-marking N lines by '//' is one way... // <tags> """ anything My editor makes this easy, but it's not really The Thing. It gets easily mixed with actual one-line comments. Then I figured there's native XML support, so: <!-- ... did not work --> Wrapping in XML works, unless you have <tags> within the block: class none { val a= <ignore> ... cannot have //<tags> <here> (not even in end-of-line comments!) </ignore> } The same for multi-line strings seems kind of best, but there's an awful lot of boilerplate (not fashionable in Scala) to please the compiler (less if you're doing this within a class or an object): object none { val ignore= """ This seems like ... <truly> <anything goes> but three "'s of course """ } The 'right' way to do this might be: /*** /* ... works but not properly syntax highlighed in SubEthaEdit (or StackOverflow) */ ***/ ..but that matches the /* and */ only, not i.e. /*** to ***/. This means the comments within the block need to be balanced. And - the current Scala syntax highlighting mode for SubEthaEdit fails miserably on this. As a comparison, Lua has --[==[ matching ]==] and so forth. I think I'm spoilt? So - is there some useful trick I'm overseeing?

    Read the article

  • Issue selenium code maintenance

    - by Rajasankar
    I want to group the common methods in one file and use it. For example, login to a page using selenium may be used in multiple times. Define that in class A and call it in class B. However, it throws null pointer exception. class A has public void test_Login() throws Exception { try{ selenium.setTimeout("60000"); selenium.open("http://localhost"); selenium.windowFocus(); selenium.windowMaximize(); selenium.windowFocus(); selenium.type("userName", "admin"); selenium.type("password", "admin"); Result=selenium.isElementPresent("//input[@type='image']"); selenium.click("//input[@type='image']"); selenium.waitForPageToLoad(Timeout); } catch(Exception ex) { System.out.println(ex); ex.printStackTrace(); } } with all other java syntax in class B public void test_kk() throws Exception { try { a.test_Login(); } catch(Exception ex) { System.out.println(ex); ex.printStackTrace(); } } with all syntax. When I execute class B, I got this error, java.lang.NullPointerException at A.test_Login(A.java:32) at B.test_kk(savefile.java:58) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.j ava:212) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.textui.TestRunner.doRun(TestRunner.java:116) at junit.textui.TestRunner.doRun(TestRunner.java:109) at junit.textui.TestRunner.run(TestRunner.java:77) at B.main(B.java:77) I hope someone must have tried this before. I may miss something here.

    Read the article

  • Prevent Word from Reformatting my HTML

    - by Jonathan
    I have an HTML page that needs to open in word. I created the document in word and saved the document as an HTML document. So word spits out all its nasty HTML syntax. This is the opened through internet explorer which will display the word document within the browser. When I view the page word modifies some of the tags. More specifically it adds a Width and Height tag and ignores the width and height within the style tag. If I try setting the Width and Height tags it overrides with new values. I have tested on different environments and get different results as word makes decision how to handle. A bit of background this img starts off as this, and is rendered via data rendering syntax. <asp:Image id="as" runat="server" Src"<%# ImgSource %>" style="width:178px;height:130px" /> It ends up like this in word <img width=32 height=32 id=barCodeImage src="http://myurl/BarcodeImages/1136574_129180418198008169.png" style='border-bottom-width:0px;border-left-width:0px;border-right-width:0px; border-top-width:0px;height:130px;width:178px'> I want to stop word from reformatting the HTML.

    Read the article

  • Checkboxes in ADF are initially null, where I want them to be 0

    - by Mark Tielemans
    I am using ADF in JDeveloper and don´t have any experience with either of the two. Now I´ve run into quite some trouble yet, but for this particular thing I decided to consult the wisom of stackoverflow. The thing is, I have an edit form for an object that contains 3 checkboxes. The checked values are set to 1, unchecked to 0. In my database, the values are NOT NULL, and I want to keep it that way. The thing is, in the edit form, if the user submits the form leaving any boxes unchecked, it will result in an error, because the unchecked box values apparently remain null. Only after checking and then unchecking the boxes again, their values will be '0' rather than null. I've tried some things, including making the attributes mandatory in the domain BCD, but that just gives a bit more neat error message.. Any help would be greatly appreciated!! EDIT I made a little progress thanks to the guide provided by Joe, but still run into problems. I changed the values that should be checkboxes in my model, making them BOOLEANs where the table columns are NUMBERs (All are also mandatory and have a default value of 0). This automatically changed the corresponding View Object too. In the Application module, this now works great. It shows checkboxes, a checked one will return 1, an untouched one will return 0. However, I deleted the old form, and inserted a new one using the corresponding Data Control. I gave these values the checkbox type. I still had to edit the bindings (which I think reflects the problem, as this is not the case with, say, a model-level defined LOV) and gave them 1 for checked and 0 for unchecked. However, now apart from the original problem still occurring, also the checkboxes cannot be unchecked after checking, and return 0 when checked (and null when left untouched). Even though this has created new problems, it works correctly in my AM. Does someone know what I'm doing wrong in my Swing form?

    Read the article

  • Visual SourceSafe (VSS): "Access to file (filename) denied" error

    - by tk-421
    Hi, can anybody help with the above SourceSafe error? I've spent hours trying to find a fix. I've also Googled the heck out of it but couldn't find a scenario matching mine, because in my case only a few files (not all) are affected. Here's what I found: only a few files in my project generate this error other files in the same directory (for example, App_Code has one of the problem files) work fine I've tried checking out from both the VSS client and Visual Studio another developer can check out the main problem file without any problems This sounds like a permission issue for my user, right? However: I found the location of one of the problem files in VSS's data directory (using VSS's naming format, as in 'fddaaaaa.a') and checked its permissions; everything looks fine and its permissions match those of other files I can check out successfully I can see no differences in the file properties between working and non-working files What else can I check? Has anyone encountered this problem before and found a solution? Thanks. P.S.: SourceGear, svn or git are not options, unfortunately. P.P.S.: Tried unsuccessfully to add tag "sourcesafe." EDIT: Hey Paddy, I tried to click 'add comment' to respond to your comment, but I'm getting a javascript error when loading this page in IE8 ("jquery undefined," etc.) so this isn't working. This is when checking out files, and yes, I've obliterated my local copy more times than I can remember. ;) EDIT 2: Thanks for the responses, guys (again I can't 'add comment' due to jQuery not loading, maybe blocked as discussed in Meta). If the problem was caused by antivirus or a bad disk, would other users still be able to check out the file(s)? That's the case here, which makes me think it's a permission issue specific to my account. However I've looked at the permissions and they match both other users' settings and settings on other files which I can check out.

    Read the article

  • What programming language do you wish would quietly retire? [closed]

    - by Gregory Higley
    This is the inverse of the "What programming language do you wish would catch on?" question. I was a Delphi programmer for many years, and I still appreciate its power, but I dislike verbose programming languages. So I would love to see Pascal put out to pasture. The same goes for BASIC in any form, despite the fact that it's the language I cut my teeth on. When I look at cathedrals of beauty like Haskell and REBOL, BASIC just makes me cringe. (VB.NET is tolerable, but barely. It has a few nice language features I'd like to see moved to C#.) My dislike of Pascal and VB.NET is subjective. They are powerful languages, but I dislike their syntax esthetically. Try to explain your reasoning, if you can, even if it's just "I don't like its syntax." This question is not meant to be a flame war, argumentative, or hateful. It's meant to be a straightforward, honest discussion of programmers' dislikes.

    Read the article

  • emacs: How to intelligently handle buffer-modified when setting text properties?

    - by Cheeso
    The documentation on Text Properties says: Since text properties are considered part of the contents of the buffer (or string), and can affect how a buffer looks on the screen, any change in buffer text properties marks the buffer as modified. First, I don't understand that policy. Can anyone explain? The text props are not actually saved in the file, when the buffer is saved. So why mark the buffer as modified? For me, buffer-modified indicates "some changes have not yet been saved." but understanding the policy is just for my own amusement. More importantly, is there an already-established way that, in code, I can change syntax text properties on the text in a buffer, while keeping the buffer-modified flag set to whatever it was, prior to those changes? I'm thinking of something like save-excursion. It would be pretty easy to write, but this seems like a common case and I'd like to use the standard function, if possible. For more on the scenario - I have a mode that does a full text scan and sets syntax-tabe properties on the text. After opening a buffer, the scan runs, but it results in a buffer with buffer-modified set to t . As always, thanks.

    Read the article

  • Invalid Argument javascript error only on certain computers

    - by Jen
    Getting an error whenever we click a particular button/link on our site. It is generating a javascript "Invalid Argument" error. I know in the other posts it is typically because it is a syntax error in the javascript however it only just seems to have started happening and it doesn't happen on all pcs. ie. in our client's environment if I remote onto their web server and view the uat website I get the javascript error. If I remote onto their sql server and view the uat website I don't get the javascript error. If it was a syntax error then I would always get the error wouldn't I? both browsers are the same version of IE6 (yeah I know...) :) I have tried deleting temporary internet files - including viewing the files and deleting them myself - but no joy. client uses citrix.. and they're all getting the error :( Any ideas would be appreciated - Thanks! :) Update - Sorry I haven't posted specific code as there is too much to post (and I'm not sure where the error is occurring). The "button" launches a new window which in turn opens up a couple of aspx pages and calls lots of javascript. So the window opens ok, and there's a function that gets called to resize the window - but before it calls the resizing of the window/content it throws the invalid argument error. Am busy trying to get alerts to trigger to see if I can see where it's falling over but so far no luck. Again not sure why this error doesn't occur when I use a particular PC (same browser version)

    Read the article

  • Can you do this with Hudson?

    - by damian
    I want to create a hudson job, that takes an id as a parameter. And use that id to calculate the svn-repo path. Where I work you have a svn path for every issue that you resolve. And then all the issues are joined into a single svn-path. What I want to do is to run static code analysis on the partial issues. So I think maybe having an Ant build.xml that I use for every issue, then, parametrize the job with the issue id. I have tried to achieve that but the svn path doesn't replace the parameter. I have tried with #issueId, %issueId%, ${issueId} and ${env.issueId} without success. Jump error like: Location 'http://svn-path:8181/svn/devSet/issues/${env.chuid}' does not exist Checking out a fresh workspace because C:\Documents and Settings\dnoseda\.hudson\jobs\test\workspace\${env.chuid} doesn't exist Checking out http://svn-path:8181/svn/devSet/issues/${env.chuid} ERROR: Failed to check out http://svn-path:8181/svn/devSet/issues/${env.chuid} org.tmatesoft.svn.core.SVNException: svn: '/svn/!svn/bc/46190/devSet/issues/$%7Benv.chuid%7D' path not found: 404 Not Found (http://svn-path:8181) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51) at I am think that I can not do what I want. Do you know how I can setup the correct configuration to achieve this matter? Thanks for any help. Edit The section of the configurate job that I want to put this parameter is this: <scm class="hudson.scm.SubversionSCM"> <locations> <hudson.scm.SubversionSCM_-ModuleLocation> <remote>http://svn-path:8181/svn/devSet/issues/${env.issueid}</remote> </hudson.scm.SubversionSCM_-ModuleLocation> </locations>

    Read the article

  • Cakephp 1.3, Weird behavior on firefox when using $this->Html->link ...

    - by ion
    Greetings, I am getting a very weird and unpredictable result in firefox when using the following syntax: $this->Html->link($this->Html->div('p-cpt',$project['Project']['name']) . $this->Html->div('p-img',$this->Html->image('/img/projects/'.$project['Project']['slug'].'/project.thumb.jpg', array('alt'=>$project['Project']['name'],'width'=>100,'height'=>380))),array('controller' => 'projects', 'action' => 'view', $project['Project']['slug']),array('title' => $project['Project']['name'], 'escape' => false),false); OK I know it is big but bear with me. The point is to get the following output: <a href="x" title="x"> <div class="p-ctp">Name</div> <div class="p-img"><img src="z width="y" height="a" alt="d" /></div> </a> I'm not sure if this validates correctly both on cakephp and html but it works everywhere else apart from firefox. You can actually see the result here: http://www.gnomonconstructions.com/projects/browser To reproduce the result use the form with different categories and press search. At some point it will happen!! Although most of the time it renders the way it should, sometimes it produces an invalid output like that: <a href="x" title="x"></a> <div class="p-cpt"> <a href="x" title="x">name</a> </div> <div class="p-img"> <a href="x" title="x"><img src="x" width="x" height="x" alt="x" /></a> </div> Looks like it repeats the link inside each element. To be honest the only reason I used this syntax was because cakephp encourages it. Any help will be much appreciated :)

    Read the article

  • Best practice for debug Asserts during Unit testing

    - by Steve Steiner
    Does heavy use of unit tests discourage the use of debug asserts? It seems like a debug assert firing in the code under test implies the unit test shouldn't exist or the debug assert shouldn't exist. "There can be only one" seems like a reasonable principle. Is this the common practice? Or do you disable your debug asserts when unit testing, so they can be around for integration testing? Edit: I updated 'Assert' to debug assert to distinguish an assert in the code under test from the lines in the unit test that check state after the test has run. Also here is an example that I believe shows the dilema: A unit test passes invalid inputs for a protected function that asserts it's inputs are valid. Should the unit test not exist? It's not a public function. Perhaps checking the inputs would kill perf? Or should the assert not exist? The function is protected not private so it should be checking it's inputs for safety.

    Read the article

  • Powershell: splatting after passing hashtable by reference

    - by user1815871
    Powershell newbie ... I recently learned about splatting — very useful. I ran into a snag when I passed a hash table by reference to a function for splatting purposes. (For brevity's sake — a silly example.) Function AllMyChildren { param ( [ref]$ReferenceToHash } get-childitem @ReferenceToHash.Value # etc.etc. } $MyHash = @{ 'path' = '*' 'include' = '*.ps1' 'name' = $null } AllMyChildren ([ref]$MyHash) Result: an error ("Splatted variables cannot be used as part of a property or array expression. Assign the result of the expression to a temporary variable then splat the temporary variable instead."). Tried this afterward: $newVariable = $ReferenceToHash.Value get-childitem @NewVariable That did work and seemed right per the error message. But: is it the preferred syntax in a case like this? (An oh, look, it actually worked solution isn't always a best practice. My approach here strikes me as "Perl-minded" and perhaps in Powershell passing by value is better, though I don't yet know the syntax for it w.r.t. a hash table.)

    Read the article

  • "Invalid assignment" error from == operator

    - by Tom
    I was trying to write a simple method: boolean validate(MyObject o) { // propertyA && propertyB are not primitive types. return o.getPropertyA() == null && o.getPropertyB() == null; } And got a strange error on the == null part: Syntax error on token ==. Invalid assignment operator. Maybe my Java is rusty after a season in PLSQL. So I tried a simpler example: Integer i = 4; i == null; // compile error: Syntax error on token ==. Invalid assignment operator. Integer i2 = 4; if (i == null); //No problem How can this be? I'm using jdk160_05. To clarify: I'm not trying to assign anything, just do an && operation between two boolean values. I don't want to do this: if (o.propertyA() == null && o.propertyB() == null) { return true; } else { return false; }

    Read the article

  • Problem in displaying image in FireFox

    - by Param-Ganak
    Hello friends, I have a JSP page on which I have a div tag in which there is a a IMG tag. Using this IMG tag I want to show an image in it. Here the source path of an image is comes from database so I assigned a JSP variable using JSP scriplet. This JSP variable have the source path of an image. This path of image may be of different machine or of same machine i.e. images are stored on different machine or on same machine i.e. on local machine on different drive. The problem is that how to give path of image stored on different machine as well as on same machine. I have tried different ways like by giving ip address of that machine. Here is the path that of local machine where the image is stored img src= file:\localhost\D:\ScannedSheets\testproj/batch1/IMG001.jpg style="z-index:1; position:absolute; top:0; left:0; width:850; height:1099" With this syntax the image is visible in Internet Explorer but With the same syntax Its not visible in FireFox, Google Chrome etc. Please Guide me in friends. Also tell me that how to give path of the image stored on different machine which works In Internet Explorer, FireFox, Google chrome etc.

    Read the article

  • NVelocity (or Velocity) as a stand-alone formula evaluator

    - by dana
    I am using NVelocity in my application to generate html emails. My application has an event-driven model, where saving and/or updating of objects causes these emails to be sent out. Each event can trigger zero, one or multiple multiple emails. I want to be able to configure which emails get sent out at run-time without having to modify code. I was thinking I could leverage the NVelocity #if() directive to do this. Here is my idea... Step 1) Prior to email sending, the administrator must configure a formula for NVelocity to evaluate. For example: $User.FirstName == "Jack" Step 2) When an object is saved or created, build an NVelocity template in memory based on the input formula. For example: String formula = GetFormulaFromDB(); // $User.FirstName == "Jack" String templ = "#if( " + formula + ") 1 #else 0 #end"; Step 3) Execute the NVelocity engine in memory against the template. Check the results to see if we have to send the email: String result = VelocityMerge(templ); // utility function if( result.Trim() == "1" ) { SendEmail(); } I know this is not exactly what NVelocity was intended to do, but I think it just might work :) One of the benefits of doing things this way is that the same syntax can be used for the formula as is used inside the template. Does anybody have any words of caution or suggestions? Is there a way to execute the #if() directive without jumping through hoops like I have above? Is there a recommended way to validate the formula syntax ahead of time? Thanks.

    Read the article

  • getClientRects javascript method supported on iPhone?

    - by genericdan
    Trying to find the top-most visible element in a UIWebView. I am using a JS method to do this, which works great in Safari, but never executes past the getClientRects method when executed from a UIWebView. The elements I'm interested are all of class="h". Here's the javascript which is called from [webView stringByEvaluatingJavaScriptFromString:@"findTopElement()"]; Javascript: function findTopElement() { var pars = document.getElementsByClassName("h"); alert("findingTopElement: num pars:" + pars.length); for (var i = 0; i < pars.length; i++) { var para = pars[i]; alert("checking par " + para.id); var rects = para.getClientRects(); alert("checking rects " + rects.length); for (var j = 0; j < rects.length; j++) { var r = rects[j]; if (r.top > 0 && r.bottom > 0) { alert("success: " + para.id); return para.id; } } } return -1; } Is it possible element getClientRects function is not supported in a UIWebView?

    Read the article

  • C++ class derivation and superconstructor confusion

    - by LukeN
    Hey, in a tutorial C++ code, I found this particular piece of confusion: PlasmaTutorial1::PlasmaTutorial1(QObject *parent, const QVariantList &args) : Plasma::Applet(parent, args), // <- Okay, Plasma = namespace, Applet = class m_svg(this), // <- A member function of class "Applet"? m_icon("document") // <- ditto? { m_svg.setImagePath("widgets/background"); // this will get us the standard applet background, for free! setBackgroundHints(DefaultBackground); resize(200, 200); } I'm not new to object oriented programming, so class derivation and super-classes are nothing complicated, but this syntax here got me confused. The header file defines the class like this: class PlasmaTutorial1 : public Plasma::Applet { Similar to above, namespace Plasma and class Applet. But what's the public doing there? I fear that I already know the concept but don't grasp the C++ syntax/way of doing it. In this question I picked up that these are called "superconstructors", at least that's what stuck in my memory, but I don't get this to the full extend. If we glance back at the first snippet, we see Constructor::Class(...) : NS::SuperClass(...), all fine 'till here. But what are m_svg(this), m_icon("document") doing there? Is this some kind of method to make these particular functions known to the derivated class? Is this part of C++ basics or more immediate? While I'm not completly lost in C++, I feel much more at home in C :) Most of the OOP I have done so far was done in D, Ruby or Python. For example in D I would just define class MyClass : MySuperClass, override what I needed to and call the super class' constructor if I'd need to.

    Read the article

  • IIS6 throws error for jquery.

    - by user309557
    Hi, on my master page, I have referenced jquery file. I am doing simple hover function. When mouse hover, I change the css and when hover out, change the css back to originial. Nothing fancy. but my page throws jquery error when I run in IIS6 on server 2003. When I run on IIS5.1 on local xp machine, it works perfectly fine. Any idea? I access both pages from my machine so IE settings is not the problem. I opened the both js file and the error line is nothing but the end of the file ( i.e last line of the js file) Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3) Timestamp: Mon, 5 Apr 2010 21:59:18 UTC Message: Syntax error Line: 4377 Char: 2 Code: 0 URI: server-test/myapplication/Scripts/jquery-1.3.2.js (removed the link because stackoverflow does not allow me to put more than one link) Message: Syntax error Line: 6183 Char: 2 Code: 0 URI: server-test/myapplication/Scripts/jquery-1.3.2-vsdoc.js (removed the link because stackoverflow does not allow me to put more than one link) Message: Object expected Line: 189 Char: 9 Code: 0 URI: http://server-test/myapplication/

    Read the article

  • How do I use the Enum value from a class in another part of code?

    - by ChiggenWingz
    Coming from a C# background from a night course at a local college, I've sort of started my way in C++. Having a lot pain getting use to the syntax. I'm also still very green when it comes to coding techniques. From my WinMain function, I want to be able to access a variable which is using an enum I declared in another class. (inside core.h) class Core { public: enum GAME_MODE { INIT, MENUS, GAMEPLAY }; GAME_MODE gameMode; Core(); ~Core(); ...OtherFunctions(); }; (inside main.cpp) Core core; int WINAPI WinMain(...) { ... startup code here... core.gameMode = Core.GAME_MODE.INIT; ...etc... } Basically I want to set that gameMode to the enum value of Init or something like that from my WinMain function. I want to also be able to read it from other areas. I get the error... expected primary-expression before '.' token If I try to use core.gameMode = Core::GAME_MODE.INIT;, then I get the same error. I'm not fussed about best practices, as I'm just trying to get the basic understanding of passing around variables in C++ between files. I'll be making sure variables are protected and neatly tucked away later on once I am use to the flexibility of the syntax. If I remember correctly, C# allowed me to use Enums from other classes, and all I had to do was something like Core.ENUMNAME.ENUMVALUE. I hope what I'm wanting to do is clear :\ As I have no idea what a lot of the correct terminology is.

    Read the article

  • SQL query error while trying to put a file in the database

    - by DaGhostman Dimitrov
    Hey Guys I have a big problem that I have no Idea why.. I have few forms that upload files to the database, all of them work fine except one.. I use the same query in all(simple insert). I think that it has something to do with the files i am trying to upload but I am not sure. Here is the code: if ($_POST['action'] == 'hndlDocs') { $ref = $_POST['reference']; // Numeric value of $doc = file_get_contents($_FILES['doc']['tmp_name']); $link = mysqli_connect('localhost','XXXXX','XXXXX','documents'); mysqli_query($link,"SET autocommit = 0"); $query = "INSERT INTO documents ({$ref}, '{$doc}', '{$_FILES['doc']['type']}') ;"; mysqli_query($link,$query); if (mysqli_error($link)) { var_dump(mysqli_error($link)); mysqli_rollback($link); } else { print("<script> window.history.back(); </script>"); mysqli_commit($link); } } The database has only these fields: DATABASE documents ( reference INT(5) NOT NULL, //it is unsigned zerofill doc LONGBLOB NOT NULL, //this should contain the binary data mime_type TEXT NOT NULL // the mime type of the file php allows only application/pdf and image/jpeg ); And the error I get is : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '00001, '????' at line 1 I will appreciate every help. Cheers!

    Read the article

  • HELP A NEWB (AGAIN) PLZ

    - by Ken
    Okay, I must be an idiot, because this is my 3rd question for today. Here's my code: date_default_timezone_set("America/Los_Angeles"); include("mainmenu.php"); $con = mysql_connect("localhost", "root", "********"); if(!$con){ die(mysql_error()); } $usrname = $_POST['usrname']; $fname = $_POST['fname']; $lname = $_POST['lname']; $password = $_POST['password']; $email = $_POST['email']; mysql_select_db("`users`, $con) or die(mysql_error()"); $query = ("INSERT INTO `users`.`data` (`id`, `usrname`, `fname`, `lname`, `email`, `password`) VALUES (NULL, '$usrname', '$fname', '$lname', '$email', 'password'))"); mysql_query('$query') or die(mysql_error()); mysql_close($con); echo("Thank you for registering!"); I always get the error returned as: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$query' at line 1. Help a newbie. I'm about to stab my monitor.

    Read the article

  • Should I learn two (or more) programming languages in parallel?

    - by c_maker
    I found entries on this site about learning a new programming language, however, I have not come across anything that talks about the advantages and disadvantages of learning two languages at the same time. Let's say my goal is to learn two new languages in a year. I understand that the definition of learning a new language is different for everyone and you can probably never know everything about a language. I believe in most cases the following things are enough to include the language in your resume and say that you are proficient in it (list is not in any particular order): Know its syntax so you can write a simple program in it Compare its underlying concepts with concepts of other languages Know best practices Know what libraries are available Know in what situations to use it Understand the flow of a more complex program At least know most of what you do not know I would probably look for a good book and pick an open source project for both of these languages to start with. My questions: Is it best to spend 5 months learning language#1 then 5 months learning language#2, or should you mix the two. Mixing them I mean you work on them in parallel. Should you pick two languages that are similar or different? Are there any advantages/disadvantages of let's say learning Lisp in tandem with Ruby? Is it a good idea to pick two languages with similar syntax or would it be too confusing? Please tell me what your experiences are regarding this. Does it make a difference if you are a beginner or a senior programmer?

    Read the article

  • In SQL, why is "select *, count(*) from sentGifts group by whenSent;" ok, but when "*" and "count(*)

    - by Jian Lin
    In SQL, using the table: mysql> select * from sentGifts; +--------+------------+--------+------+---------------------+--------+ | sentID | whenSent | fromID | toID | trytryWhen | giftID | +--------+------------+--------+------+---------------------+--------+ | 1 | 2010-04-24 | 123 | 456 | 2010-04-24 01:52:20 | 100 | | 2 | 2010-04-24 | 123 | 4568 | 2010-04-24 01:56:04 | 100 | | 3 | 2010-04-24 | 123 | NULL | NULL | 1 | | 4 | 2010-04-24 | NULL | 111 | 2010-04-24 03:10:42 | 2 | | 5 | 2010-03-03 | 11 | 22 | 2010-03-03 00:00:00 | 6 | | 6 | 2010-04-24 | 11 | 222 | 2010-04-24 03:54:49 | 6 | | 7 | 2010-04-24 | 1 | 2 | 2010-04-24 03:58:45 | 6 | +--------+------------+--------+------+---------------------+--------+ 7 rows in set (0.00 sec) The following is OK: mysql> select *, count(*) from sentGifts group by whenSent; +--------+------------+--------+------+---------------------+--------+----------+ | sentID | whenSent | fromID | toID | trytryWhen | giftID | count(*) | +--------+------------+--------+------+---------------------+--------+----------+ | 5 | 2010-03-03 | 11 | 22 | 2010-03-03 00:00:00 | 6 | 1 | | 1 | 2010-04-24 | 123 | 456 | 2010-04-24 01:52:20 | 100 | 6 | +--------+------------+--------+------+---------------------+--------+----------+ 2 rows in set (0.00 sec) But suppose we want the count(*) to appear as the first column: mysql> select count(*), * from sentGifts group by whenSent; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* from sentGifts group by whenSent' at line 1 it gave an error. Why is it so and what is a way to fix it? I realized that this is ok: mysql> select count(*), whenSent from sentGifts group by whenSent; +----------+------------+ | count(*) | whenSent | +----------+------------+ | 1 | 2010-03-03 | | 6 | 2010-04-24 | +----------+------------+ 2 rows in set (0.00 sec) but what about the one above that gave an error? thanks.

    Read the article

  • How to check data in a column separated by a colon (:)

    - by tonsils
    Hi, I have an Oracle database column, say col1, that has the following values: Col1 (A:B:C) I now need to come along and add to this Col1, only if it doesn’t exist, additional values but unsure how to go about checking to see if Col1 already contains these values. Scenario might be as follows: 1) Need to add B => Outcome=> check Col1 – B exists, do not add. 2) Need to add A:C => Outcome=> check Col1 – A and C exists, do not add. 3) Need to add C:D => Outcome=> check Col1 – C exists but D doesn’t, do not add C but need to add D 4) Need to add G => Outcome=> check Col1 – G doesn’t, need to add G Using Oracle sql or pl/sql I am unsure how to go about processing the above to ensure whether items exist or don’t exist and whether to add or not to add to Col1 Hoping someone can assist with a means of checking the data based on the above. Thanks

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >