Search Results

Search found 7380 results on 296 pages for 'scripting languages'.

Page 50/296 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Else statement to show connection successful [closed]

    - by Craig Smith
    I am trying to write a script to test a database connection, at the moment it will only display text if the connection doesn't work, I am stuck with trying to create an else statement to display "Connection Successful" if it works. Here's my code so far. Any help appreciated :) <? $conn = @mysql_connect("localhost", "root", ""); if (!$conn) { die("Connection failed: " .mysql_error()); } ?>

    Read the article

  • Script to fill out time sheet on login

    - by Darren
    Everyday at work when I come in I have to sign into a time-sheet. It's timestamped so I can't just say I came in at whatever time when I didn't. I want to write a script that runs on login (windows 7) and fills out the time I come in and such and another that says the time I'm leaving when I log out. I'm struggling to word this properly and am aware that I have worded it terribly but hopefully you guys know what I'm saying and can help me despite this. thanks in advance folks

    Read the article

  • Unity gizmos vs. referenced game objects

    - by DuckMaestro
    I'm designing a Unity script that I intend to be highly reusable and as easy as possible to setup within the editor. To this end, a number of properties of this script really need some kind of visual representation on screen. It is an unresolved question to me whether the design of the script should require references to placeholder game objects, OR just Vector3's and float's that have associated gizmos drawn for them. Normally a gizmo would be a natural choice, except that Unity gizmos are not directly manipulable (as far as I can tell). Because of this shortcoming I'm having to consider whether depending on references to placeholder game objects is a more designer-friendly approach ultimately, in spite of the extra setup required, and that it might be counter-intuitive when the placeholder game objects disappear at run-time (which my script would do). Is there a community standard or preference here in this case? Can a Unity-experienced game programmer / designer speak to which approach they feel is more intuitive or more convenient to setup, when using a 3rd party script? Or is this just splitting hairs as long as I ship an example prefab with my script?

    Read the article

  • Differentiating between user script input formats

    - by KChaloux
    I have a .NET project at work that provides a couple of (Iron)Python scripts to the customers, to allow them to customize the output of the program. The application generates code for certain machines, and supports a couple of different formats. Until recently, we only provided a script for one format. We're expanding upon that to include support for the others. If the user is using a script, they select their input script before generating the output code. A script designed for Format1 output is going to cause errors if they're trying to generate Format2 output. I need to deal with this. One option would just be to let the customers use common sense, and if they load the wrong script it will just fail, or worse, produce inaccurate data. I'm inclined to provide a little more protection than that. At the moment I'm considering putting a shebang-style comment line at the top of the script, ala: # OUTPUT - Format1 If the user tries to run a Format2 process with a Format1 script, it will warn them. Alternatively I could create different file extensions for the input scripts that vary by type. The file-type comment approach helps prevent the script from actually loading improperly, at the cost of failing to warn the user until they've already selected it, via a dialog box. Using different file extensions would allow me to cut down on visual clutter when providing a File Dialog, but doesn't actually stop them from loading the wrong script. So I'm really not sure if the right approach is to just leave it alone, or provide some safeguards.

    Read the article

  • How to execute a script as super user first checking the user and getting pass from askpass if not super user

    - by pahnin
    thers a similar question out there How can I determine whether a shellscript runs as root or not? I have the same doubt with different result Is it possible to, within the BASH script prior to everything being run, check if the script is being run as superuser, and if not, print a message saying You must be superuser to use this script, then subsequently get pass from the user using askpass or something like tht then execute the saem script as superuser?

    Read the article

  • Syntax error in Maya Python Script [on hold]

    - by Enchanter
    Ok this error is immensly frustrating as it is obviously a simple syntax issue. Basically I've written two lines of maya script in python designed to create a list of the names of all the joints of a model currently selected in the model viewer. Here are the two lines of script: import maya.cmds joints = ls(selection = true, type = 'joint') Upon compiling the code the script editor is saying there is a syntax error in the second line, but I do not see any reason why this code should not execute?

    Read the article

  • How to input data into user defined variables into MySql query

    - by user292791
    Simple Shell script echo "Enter 1 for month of March" echo "Enter 2 for month of April" echo "Enter 3 for month of May" read Month case "$Month" in 1) echo "enter establishment name" read a; mysql -u root -p $a < "March.sql";; 2) echo "enter establishment name" read b; mysql -u root -p $b < "April.sql";; 3) echo "enter establishment name" read c; mysql -u root -p $c < "May.sql";; esac done In this i have three other query files March.sql, April.sql, May.sql. i'm linking this in shell script . Example of .sql file: SELECT DISTINCT substr( a.case_no, 3, 2 ), b.case_type, b.type_name, a.case_no into outfile '/tmp/April.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' FROM Civil_t AS a, Case_type_t AS b, disposal_proc AS c WHERE substr( a.case_no, 3, 2 ) = b.case_type AND a.date_of_decision BETWEEN '2014-04-01' AND '2014-04-30' AND a.case_no = c.case_no AND a.court_no =1; I have to alter the .sql script every time. Is there any method to read the variables from shell script and use it in mysql. For example:- echo "enter date" read a #input date Now i have read a "date" and i want to use it in March.sql query in where clause. Is there is any method of using this variable in .sql query.

    Read the article

  • C/C++ canonicaliser?

    - by A T
    Are there any C/C++ automated canonicallisers? - Something like astyle but which makes your code more concise, rather than formats it? For example, to go from: float foo() { float a; float b; a = 9455.34; b = 3543.8; return a*b; } int main(void) { float b; b = foo(); return 0; } To: float foo(); // Automated prototype creation int main(void) { float b = foo(); return 0; } float foo() { return 9455.34*3543.8; } (this is my coding style FYI: to reduce the lines-of-code without sacrificing readability)

    Read the article

  • Print out the amount of times 2 words appear in the syslog. But also have it tell me how many times for each hour

    - by wolfspinone
    So I'm trying to create a bash script that looks for two words in my syslog file. Then I want the script to print out how many times those two words have appeared. Also I want it to print it out for every hour of the day. So like if the word dog appeared 4 times during the first hour of today, it says Hour one, dog 4. Finally at the end of the script I want it to print out how many times those words appeared all day. The sudo code I have thus far is if 2 > hour find permit find block print both finish if 1 < hour < 2 find permit find block print both finish if 2 < hour < 3 find permit find block print both finish command is grep -o "\WORD\" Syslog.txt * | sort | uniq -c

    Read the article

  • Script or bat that will make shortcuts

    - by user227056
    I want to make bat (windows) file that will move * files from desktop to x folder and then make shortcuts on the desktop (they must be linked to files in x folder). So: the problem is: There is no way to make shortcut using bat. Only using third-party applications... Or/and using scripts. I need the program/script... that will get their adress, link shortcut to every single file (...\x\s.exe, desktop\s.lnk; ...\l.txt, desktop\l.lnk)...

    Read the article

  • What is the standard term for my role?

    - by sigil
    I'm doing work that involves writing code and managing developers in a "special projects" division of a large company. I'd like to define my role better and figure out if there's an industry standard term for what I do, so that it will be easier for me to research best practices and work on a career path What I do all day: A macro that connects an Excel sheet to an Access database is acting funny; I get called in to figure out what's happening and debug it. Someone needs data extracted from a bunch of files on Sharepoint. I figure out a client-side solution because I'm not authorized to do anything server-side and getting IT to do anything would take several months and need a business case. A manager wants a new data entry tool for their team. I interview the manager and team members to work out the functional requirements, then design/develop/test the application. Someone needs a VBA script to crunch some data for their presentation that's due in two hours. I drop everything I'm doing to hack out a quick script and run the analysis, without much in the way of testing. A developer has been hired to build a database for one of the teams, since I'm working on too many different things and don't have time to take this project on in the timeframe required. I direct his work and push him to meet certain deadlines, interview stakeholders to get more info that will help him figure out how to build the necessary forms, and modify the functional requirements of the database to fit in the timeframe. Someone wants to load a set of data into a GIS system and set up an ongoing refresh and reporting of this data set. I facilitate the conversation between the GIS developers and the owners of this data set, and design a demo application as proof of concept. It's kind of an "all-purpose programming and IT management" position, but it's not officially IT because the company has an actual IT department with a rigorously defined system of submitting requests, developing code, and managing projects. What I do, I guess, is more of a handyman job, where stuff falls to me because I'm the geekiest one in the room. Is there a standard term in the software world for what I do?

    Read the article

  • execute a shell script when USB is connected

    - by Null pointer
    I am working on an application which deals with all kinds of USB storage devices(such as taking backup, updating DataLogFile etc) My problem is : I want to write a shell script which is stored in this USB drive(As usb is at center of my project so USB is going to be same but PC's will change) AND this script should be executed as soon as the USB drive is connected to my Linux system.I will not need any kind of "root" or "sudo" permissions for other tasks which I am going to do in this shell script.

    Read the article

  • Phishing attack stuck with jsp loginAction.do page? [closed]

    - by user970533
    I 'm testing a phishing website on a staged replica of an jsp web-application. I'm doing the usual attack which involves changing the post and action field of source code to divert to my own written jsp script capture the logins and redirect the victim to the original website. It looks easy but trust me its has been me more then 2 weeks I cannot write the logins to the text file. I have tested the jsp page on my local wamp server it works fine. In staged when I click on the ok button for user/password field I'm taken to loginAction.do script. I checked this using tamper data add on on firefox. The only way I was able to make my script run was to use burp proxy intercept the request and change action parameter to refer my uploaded script. I want to know what does an loginAction.do? I have googled it - its quite common to see it in jsp application. I have checked the code; there is nothing that tells me why the page always point to the .do script instead of mine. Is there some kind of redirection in tomcat configuration. I like to know. I'm unable to exploit this attack vector? I need the community help

    Read the article

  • Why "./" is used to run ".sh" scripts in Unix? [duplicate]

    - by user283502
    This question already has an answer here: Why do I need to type `./` before executing a program in the current directory? 10 answers I am executing a .sh script today. It is executed with prefix "./.sh,I am a bit confuse because it is also executed without ./.but why this is required to use ./ Could you please explain me that why ./ is used to run .sh scripts?

    Read the article

  • How can I be able to create a folder node on companyhome in Alfresco? [migrated]

    - by bluestella
    I am having a hard time looking for an answer to my question. I am trying to create a folder/space in Alfresco. But I don't have any idea doing it? Can someone help me with this? I'm using Java webscript. All I am at is this: package org.alfresco.module.demoscripts; import java.io.IOException; import org.alfresco.web.scripts.AbstractWebScript; import org.alfresco.web.scripts.WebScriptException; import org.alfresco.web.scripts.WebScriptRequest; import org.alfresco.web.scripts.WebScriptResponse; import org.json.JSONException; import org.json.JSONObject; public class SimpleWebScript extends AbstractWebScript { public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { try { // build a json object JSONObject obj = new JSONObject(); // put some data on it obj.put("field1", "data1"); // build a JSON string and send it back String jsonString = obj.toString(); res.getWriter().write(jsonString); } catch(JSONException e) { throw new WebScriptException("Unable to serialize JSON"); } } }

    Read the article

  • Agile language for 2d game prototypes?

    - by instanceofTom
    Occasionally ( read: when my fiancé allows ) I like to prototype different game or game-like ideas I have. Usually I use Java or C# (not xna yet) because they are the languages I have the most practice with. However I would like to learn something more suited to agile development; a language in which it would be easier to knock out quick prototypes. At my job I have recently been working with looser (weak/dynamically typed) languages, specifically python and groovy, and I think something similar would fit what I am looking for. So, my question is: What languages (and framework/engine) would be good for rapidly developing prototypes of 2d game concepts? A few notes: I don't need blazing fast bitcrunching performance. In this case I would strongly prefer ease of development over performance. I'd like to use a language with a healthy community, which to me means a fair amount of maintained 3rd party, libraries. I'd like the language to be cross-platform friendly, I work on a variety of different operating systems and would like something that is portable with minimum effort. I can't imagine myself using a language with out decent options for debugging and editor syntax highlighting support. Note: If you are aware of a Java or C# library/framework that you think streamlines producing game prototypes I open to learning something new for those languages too

    Read the article

  • Better language or checking tool?

    - by rwallace
    This is primarily aimed at programmers who use unmanaged languages like C and C++ in preference to managed languages, forgoing some forms of error checking to obtain benefits like the ability to work in extremely resource constrained systems or the last increment of performance, though I would also be interested in answers from those who use managed languages. Which of the following would be of most value? A language that would optionally compile to CLR byte code or to machine code via C, and would provide things like optional array bounds checking, more support for memory management in environments where you can't use garbage collection, and faster compile times than typical C++ projects. (Think e.g. Ada or Eiffel with Python syntax.) A tool that would take existing C code and perform static analysis to look for things like potential null pointer dereferences and array overflows. (Think e.g. an open source equivalent to Coverity.) Something else I haven't thought of. Or put another way, when you're using C family languages, is the top of your wish list more expressiveness, better error checking or something else? The reason I'm asking is that I have a design and prototype parser for #1, and an outline design for #2, and I'm wondering which would be the better use of resources to work on after my current project is up and running; but I think the answers may be useful for other tools programmers also. (As usual with questions of this nature, if the answer you would give is already there, please upvote it.)

    Read the article

  • Why don't purely functional languages use reference counting?

    - by Zifre
    In purely functional languages, data is immutable. With reference counting, creating a reference cycle requires changing already created data. It seems like purely functional languages could use reference counting without worrying about the possibility of cycles. Am is right? If so, why don't they? I understand that reference counting is slower than GC in many cases, but at least it reduces pause times. It would be nice to have the option to use reference counting in cases where pause times are bad.

    Read the article

  • Efficient heaps in purely functional languages

    - by Kim
    As an exercise in Haskell, I'm trying to implement heapsort. The heap is usually implemented as an array in imperative languages, but this would be hugely inefficient in purely functional languages. So I've looked at binary heaps, but everything I found so far describes them from an imperative viewpoint and the algorithms presented are hard to translate to a functional setting. How to efficiently implement a heap in a purely functional language such as Haskell? Edit: By efficient I mean it should still be in O(n*log n), but it doesn't have to beat a C program. Also, I'd like to use purely functional programming. What else would be the point of doing it in Haskell?

    Read the article

  • The Definition of Regular Languages

    - by AraK
    Good Day, I have tried, and burned my brain to understand the definition of Regular Languages in Discrete Mathematics and its Applications(Rosen) without reaching the goal of understanding why the definition is like that in this book. On page(789), I am rephrasing the definition: Type 3 grammars are defined as: w1 --> w2 Where w1 is a non-terminal, and w2 is of the form: w2 = aB w2 = a Where B is a non-terminal, and a is a terminal. A special case is when w1 is the starting symbol and w2 is lambda(the empty string): w1 = S S --> lambda Two questions I couldn't find an answer for. First, Why can't w2 be of the form Ba. Second, Why lambda is only allowed for the starting symbol only. The book states that, regular languages are equivalent to Finite State Automaton, and we can easily see that a we can build FSA for both cases. I took a look at other resources, and these restrictions don't exist in these resources. Thanks,

    Read the article

  • Factorial Algorithms in different languages

    - by Brad Gilbert
    I want to see all the different ways you can come up with, for a factorial subroutine, or program. The hope is that anyone can come here and see if they might want to learn a new language. Ideas: Procedural Functional Object Oriented One liners Obfuscated Oddball Bad Code Polyglot Basically I want to see an example, of different ways of writing an algorithm, and what they would look like in different languages. Please limit it to one example per entry. I will allow you to have more than one example per answer, if you are trying to highlight a specific style, language, or just a well thought out idea that lends itself to being in one post. The only real requirement is it must find the factorial of a given argument, in all languages represented. Be Creative! Recommended Guideline: # Language Name: Optional Style type - Optional bullet points Code Goes Here Other informational text goes here I will ocasionally go along and edit any answer that does not have decent formatting.

    Read the article

  • Do You Really Know Your Programming Languages?

    - by Kristopher Johnson
    I am often amazed at how little some of my colleagues know or care about their craft. Something that constantly frustrates me is that people don't want to learn any more than they need to about the programming languages they use every day. Many programmers seem content to learn some pidgin sub-dialect, and stick with that. If they see a keyword or construct that they aren't familiar with, they'll complain that the code is "tricky." What would you think of a civil engineer who shied away from calculus because it had "all those tricky math symbols?" I'm not suggesting that we all need to become "language lawyers." But if you make your living as a programmer, and claim to be a competent user of language X, then I think at a minimum you should know the following: Do you know the keywords of the language and what they do? What are the valid syntactic forms? How are memory, files, and other operating system resources managed? Where is the official language specification and library reference for the language? The last one is the one that really gets me. Many programmers seem to have no idea that there is a "specification" or "standard" for any particular language. I still talk to people who think that Microsoft invented C++, and that if a program doesn't compile under VC6, it's not a valid C++ program. Programmers these days have it easy when it comes to obtaining specs. Newer languages like C#, Java, Python, Ruby, etc. all have their documentation available for free from the vendors' web sites. Older languages and platforms often have standards controlled by standards bodies that demand payment for specs, but even that shouldn't be a deterrent: the C++ standard is available from ISO for $30 (and why am I the only person I know who has a copy?). Programming is hard enough even when you do know the language. If you don't, I don't see how you have a chance. What do the rest of you think? Am I right, or should we all be content with the typical level of programming language expertise? Update: Several great comments here. Thanks. A couple of people hit on something that I didn't think about: What really irks me is not the lack of knowledge, but the lack of curiosity and willingness to learn. It seems some people don't have any time to hone their craft, but they have plenty of time to write lots of bad code. And I don't expect people to be able to recite a list of keywords or EBNF expressions, but I do expect that when they see some code, they should have some inkling of what it does. Few people have complete knowledge of every dark corner of their language or platform, but everyone should at least know enough that when they see something unfamiliar, they will know how to get whatever additional information they need to understand it.

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >