Search Results

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

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

  • CakePHP Routes: Messing With The MVC

    - by thesunneversets
    So we have a real-estate-related site that has controller/action pairs like "homes/view", "realtors/edit", and so forth. From on high it has been deemed a good idea to refactor the site so that URLS are now in the format "/realtorname/homes/view/id", and perhaps also "/admin/homes/view/id" and/or "/region/..." As a mere CakePHP novice I'm finding it difficult to achieve this in routes.php. I can do the likes of: Router::connect('/:filter/h/:id', array('controller'=>'homes','action'=>'view')); Router::connect('/admin/:controller/:action/:id'); But I'm finding that the id is no longer being passed simply and elegantly to the actions, now that controller and action do not directly follow the domain. Therefore, questions: Is it a stupid idea to play fast and loose with the /controller/action format in this way? Is there a better way of stating these routes so that things don't break egregiously? Would we be better off going back to subdomains (the initial method of achieving this type of functionality, shot down on potentially spurious SEO-related grounds)? Many thanks for any advice! I'm sorry that I'm such a newbie that I don't know whether I'm asking stupid questions or not....

    Read the article

  • adding an uncertain number of fields using javascript

    - by user306472
    I'm new to javascript and a novice programmer, so this might be a really easy question to answer. I would like to loop over the values of x number of fields and add them up to display the sum in a final field. I can perform this function if I explicitly call each field, but I want to abstract this so I can deal with a flexible number of fields. Here's example code I've come up with (that's not working for me). Where am I going wrong? <html> <head> <script type="text/javascript"> function startAdd(){ interval = setInterval("addfields()",1); } function addfields(){ a = document.addition.total.value; b = getElementByTagName("sum").value; for (i=0; i<=b.length; i++){ a+=i; } return a; } function stopAdd(){ clearInterval(interval); } </script> </head> <body> <form name="addition"> <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> + <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> = <input type="text" name ="total"> </form> </body> </html>

    Read the article

  • about c# OBJECTS and the Possibilties it has.

    - by user527825
    As a novice programmer and i always wonder about c# capabilities.i know it is still early to judge that but all i want to know is can c# do complex stuffs or something outside windows OS. 1- I think c# is a proprietary language (i don't know if i said that right) meaning you can't do it outside visual studio or windows. 2-also you cant create your own controller(called object right?) like you are forced to use these available in toolbox and their properties and methods. 3-can c# be used with openGL API or DirectX API . 4-Finally it always bothers me when i think i start doing things in visual studio, i know it sounds arrogant to say but sometimes i feel that i don't like to be forced to use something even if its helpful, like i feel (do i have the right to feel?) that i want to do all things by myself? don't laugh i just feel that this will give me a better understanding. 5- is visual c# is like using MaxScript inside 3ds max in that c# is exclusive to do windows and forms and components that are windows related and maxscript is only for 3d editing and manipulation for various things in the software. If it is too difficult for a beginner i hope you don't answer the fourth question as i don't have enough motivation and i want to keep the little i have. thank you for your time. Note: 1-sorry for my English, i am self taught and never used the language with native speakers so expect so errors. 2-i have a lot of questions regarding many things, what is the daily ratio you think for asking (number of questions) that would not bother the admins of the site and the members here. thank you for your time.

    Read the article

  • Modifying C# dictionary value

    - by minjang
    I'm a C++ expert, but not at all for C#. I created a Dictionary<string, STATS>, where STATS is a simple struct. Once I built the dictionary with initial string and STATS pairs, I want to modify the dictionary's STATS value. In C++, it's very clear: Dictionary<string, STATS*> benchmarks; Initialize it... STATS* stats = benchmarks[item.Key]; // Touch stats directly However, I tried like this in C#: Dictionary<string, STATS> benchmarks = new Dictionary<string, STATS>(); // Initialize benchmarks with a bunch of STATS foreach (var item in _data) benchmarks.Add(item.app_name, item); foreach (KeyValuePair<string, STATS> item in benchmarks) { // I want to modify STATS value inside of benchmarks dictionary. STATS stat_item = benchmarks[item.Key]; ParseOutputFile("foo", ref stat_item); // But, not modified in benchmarks... stat_item is just a copy. } This is a really novice problem, but wasn't easy to find an answer. EDIT: I also tried like the following: STATS stat_item = benchmarks[item.Key]; ParseOutputFile(file_name, ref stat_item); benchmarks[item.Key] = stat_item; However, I got the exception since such action invalidates Dictionary: Unhandled Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext() at helper.Program.Main(String[] args) in D:\dev\\helper\Program.cs:line 75

    Read the article

  • x509 certificate Information

    - by sid
    Certificate: Data: Version: 3 (0x2) Serial Number: 95 (0x5f) Signature Algorithm: sha1WithRSAEncryption Issuer: C=, O=, CN= Validity Not Before: Apr 22 16:42:11 2008 GMT Not After : Apr 22 16:42:11 2009 GMT Subject: C=, O=, CN=, L=, ST= Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit) Modulus (1024 bit): ... ... ... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: critical Code Signing X509v3 Authority Key Identifier: keyid: ... Signature Algorithm: sha1WithRSAEncryption a9:55:56:9b:9e:60:7a:57:fd:7:6b:1e:c0:79:1c:50:62:8f: ... ... -----BEGIN CERTIFICATE----- ... ... ... -----END CERTIFICATE----- In This Certificate, Which is the public key? is Modulus? what does the Signature Algorithm, a9:55:56:... represent (is it message digest)? And what is between -----BEGIN CERTIFICATE----- & -----END CERTIFICATE-----, is That the whole certificate? As I am novice, little bit confusing between the message digest and public key? Thanks in Advance-opensid

    Read the article

  • How to decrypt a string encrypted with HMACSHA1?

    - by Bob
    I'm an encryption novice trying to pass some values back and forth between systems. I can encrypt the value, but can't seem to figure out how to decrypt on the other end. I've created a simple Windows Forms application using VB.NET. Trying to input a value and a key, encrypt and then decrypt to get the original value. Here's my code so far. Any help greatly appreciated. Thanks. Imports System Imports System.IO Imports System.Security.Cryptography Imports System.Text Public Class Form1 Private Sub btnEncode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEncode.Click Dim hmacsha1 As New HMACSHA1(Encoding.ASCII.GetBytes(txtKey.Text)) Dim hashValue As Byte() = hmacsha1.ComputeHash(Encoding.ASCII.GetBytes(txtValue.Text)) txtResult.Text = BytesToHexString(hashValue) hmacsha1.Clear() End Sub Private Sub btnDecode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDecode.Click '??? End Sub Private Function BytesToHexString(ByVal bytes As Byte()) As String Dim output As String = String.Empty Dim i As Integer = 0 Do While i < bytes.Length output += bytes(i).ToString("X2") i += 1 Loop Return output End Function End Class

    Read the article

  • Why does my Jabber bot only work if I'm debugging my Perl script?

    - 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

  • Optimizing T-SQL where an array would be nice

    - by Polatrite
    Alright, first you'll need to grab a barf bag. I've been tasked with optimizing several old stored procedures in our database. This SP does the following: 1) cursor loops through a series of "buildings" 2) cursor loops through a week, Sunday-Saturday 3) has a huge set of IF blocks that are responsible for counting how many Objects of what Types are present in a given building Essentially what you'll see in this code block is that, if there are 5 objects of type #2, it will increment @Type_2_Objects_5 by 1. IF @Number_Type_1_Objects = 0 BEGIN SET @Type_1_Objects_0 = @Type_1_Objects_0 + 1 END IF @Number_Type_1_Objects = 1 BEGIN SET @Type_1_Objects_1 = @Type_1_Objects_1 + 1 END IF @Number_Type_1_Objects = 2 BEGIN SET @Type_1_Objects_2 = @Type_1_Objects_2 + 1 END IF @Number_Type_1_Objects = 3 BEGIN SET @Type_1_Objects_3 = @Type_1_Objects_3 + 1 END [... Objects_4 through Objects_20 for Type_1] IF @Number_Type_2_Objects = 0 BEGIN SET @Type_2_Objects_0 = @Type_2_Objects_0 + 1 END IF @Number_Type_2_Objects = 1 BEGIN SET @Type_2_Objects_1 = @Type_2_Objects_1 + 1 END IF @Number_Type_2_Objects = 2 BEGIN SET @Type_2_Objects_2 = @Type_2_Objects_2 + 1 END IF @Number_Type_2_Objects = 3 BEGIN SET @Type_2_Objects_3 = @Type_2_Objects_3 + 1 END [... Objects_4 through Objects_20 for Type_2] In addition to being extremely hacky (and limited to a quantity of 20 objects), it seems like a terrible way of handling this. In a traditional language, this could easily be solved with a 2-dimensional array... objects[type][quantity] += 1; I'm a T-SQL novice, but since writing stored procedures often uses a lot of temporary tables (which could essentially be a 2-dimensional array) I was wondering if someone could illuminate a better way of handling a situation like this with two dynamic pieces of data to store. Requested in comments: The columns are simply Number_Type_1_Objects, Number_Type_2_Objects, Number_Type_3_Objects, Number_Type_4_Objects, Number_Type_5_Objects, and CurrentDateTime. Each row in the table represents 5 minutes. The expected output is to figure out what percentage of time a given quantity of objects is present throughout each day. Sunday - Object Type 1 0 objects - 69 rows, 5:45, 34.85% 1 object - 85 rows, 7:05, 42.93% 2 objects - 44 rows, 3:40, 22.22% On Sunday, there were 0 objects of type 1 for 34.85% of the day. There was 1 object for 42.93% of the day, and 2 objects for 22.22% of the day. Repeat for each object type.

    Read the article

  • Play Video From Raw Folder

    - by SterAllures
    Evening, I've just started programming with android and made a few programs and everything so I'm still kind of a novice but im trying to understand it all. So here's my problem, I'm trying to play a video, the thing is, I got it working when I Stream it from an URL with VideoView over the internet or when i place in on my sdcard. What I want to do now is play a video I've got in my res/raw folder, but it only plays audio and I don't understand why, it doesn't give any error in my logcat as far as I can see, also couldn't really find a solution with google since most of the answers are about VideoView and just put the video on your SDCard. Now someone told me I had to use setDisplay (SurfaceHolder) and I've also tried that but I still only get the audio. I hope somebody can help me to find a solution to this problem. VideoDemo.java package nl.melvin.videodemo; import android.app.Activity; import android.os.Bundle; import android.media.MediaPlayer; import android.view.SurfaceHolder; import android.view.SurfaceView; public class videodemo extends Activity { public SurfaceHolder holder; public SurfaceView surfaceView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MediaPlayer mp = MediaPlayer.create(this, R.raw.mac); mp.setDisplay(holder); mp.start(); } } XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" > <SurfaceView android:id="@+id/surfaceview" android:layout_width="fill_parent" android:layout_height="fill_parent"> </SurfaceView>> </LinearLayout> I've also tried Uri.parse but it says it can't play the video (.mp4 format).

    Read the article

  • How do I create a simple Windows form to access a SQL Server database?

    - by NoCatharsis
    I believe this is a very novice question, and if I'm using the wrong forum to ask, please advise. I have a basic understanding of databasing with MS SQL Server, and programming with C++ and C#. I'm trying to teach myself more by setting up my own database with MS SQL Server Express 2008 R2 and accessing it via Windows forms created in C# Express 2010. At this point, I just want to keep it to free or Express dev tools (not necessarily Microsoft though). Anyway, I created a database using the instructions provided here and I set the data types appropriately for each column (no errors in setup at least). Now I'm designing the GUI in C# Express but I've kind of hit a wall as far as the database connection. Is there a simple way to access the database I created locally using C# Express? Can anyone suggest a guide that has all this spelled out already? I am a self-learner so I look forward to teaching myself how to use these applications, but any pointers to start me off in the right direction would be greatly appreciated.

    Read the article

  • jQuery - Multiple setInterval Conflict

    - by Chris Bowyer
    I am a jQuery novice and each of the following work fine on their own, but get out of time when working together. What am I doing wrong? Any improvement on the code would be appreciated too... It is to be used to rotate advertising. <!--- Header Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#header").load("header.cfm"); var refreshHeader = setInterval(function() { $("#header").load("header.cfm"); }, 10000); }); </script> <!--- Main Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#main").load("main.cfm"); var refreshMain = setInterval(function() { $("#main").load("main.cfm"); }, 5000); }); </script> <!--- Footer Rotator ---> <script type="text/javascript"> $(document).ready(function() { $("#footer").load("footer.cfm"); var refreshFooter = setInterval(function() { $("#footer").load("footer.cfm"); }, 2000); }); </script>

    Read the article

  • is concatenating the only way to 'import' one JS lib from another?

    - by Nikita
    Disclaimer: JS novice I have a JS widget that depends on JQuery. The widget's going to be embedded in a 3rd party site but I figure out how to avoid declaring dependency on jquery on the widget-hosting page: 3rd party's page: <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script type="text/javascript" src="http://mydomain/mywidget.js"></script> </head> mywidget.js jQuery(document).ready(function() { //do stuff }); I'd rather not include jquery.js in the 3d party page but express the dependency inside mywidget.js (so i can change this dependency or add/remove others w/o having to update the widget-hosting page) I tried adding: var script = document.createElement('script'); script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); to the top of mywidget.js but that didn't work - jquery.js did load on page load but "jQuery" was not recognized. What did work was concatenating jquery.js and mywidget.js into a single .js file. But that seems kind of lame - is there no equivalent to? import com.jquery.*; thanks!

    Read the article

  • How to connect to a third party website in classic asp using javascript for password encryption and yet not giving in the password.

    - by Abbi
    Hi I have to make changes to classic asp website where once a button is clicked it autologins to a third party website with a intermediate page that warns that you are logging in to a third party website. The thirdparty is providing us with a username and password and gave us an examle javascript to encode the password to send to them. Now where do I store the userid and password. I cannot execute the javascript on the serverside. It has to go to the client. If the asp page which has the encryption javascript goes to the client side then the source can be viewed and the username and password is given out. Is there a way that I can have hidden asp page whose only job is to encrypt the password and create a new url and auto redirect it to that new url. So when the user clicks ok on the intermediate warning page I redirect it to this hidden asp page which does the encryption and a creates a url for get method and redirects to that page. I am a novice as far as java script and classic asp is concerned. Any ideas/ advice will be appreciated. Thanks, --Abbi

    Read the article

  • Extracting word from file using grep or sed

    - by Marco
    Hi, I have a file in the format below: File : \\dvtbbnkapp115\nautilus\030db28a-f241-4054-a0e3-9bfa7e002535.dip was processed. Entries Found : 0 Unarchived Documents : 1 File Size : 1 K Error : The following line could not be processed. Bad Document Type. Error : Marketing and Contact preference change update||7000003735||078ef1f3-db6b-46a8-bb0d-c40bb2296ab5.pdf File : \\dvtbbnkapp115\nautilus\078ef1f3-db6b-46a8-bb0d-c40bb2296ab5.dip was processed. Entries Found : 0 Unarchived Documents : 1 File Size : 1 K Error : The following line could not be processed. Bad Document Type. Error : Declined - Bureau Data (process)||7000003723|252204|2f1d71f4-052c-49f1-95cf-9ca9b4268f0c.pdf File : \\dvtbbnkapp115\nautilus\2f1d71f4-052c-49f1-95cf-9ca9b4268f0c.dip was processed. Entries Found : 0 Unarchived Documents : 1 File Size : 1 K Error : The following line could not be processed. Bad Document Type. Error : Unable to call - please contact|40640510016710|7000003180||3e6a792f-c136-4a4b-a654-37f4476ccef8.pdf I require to extract just the pdf file names after the double pipe and write them to a file. I am a novice when it comes to unix/sed/grep commands, i have tried but no luck? any ideas or examples i could use to extract the information above? thanks

    Read the article

  • Slightly different execution times between python2 and python3

    - by user557634
    Hi. Lastly I wrote a simple generator of permutations in python (implementation of "plain changes" algorithm described by Knuth in "The Art... 4"). I was curious about the differences in execution time of it between python2 and python3. Here is my function: def perms(s): s = tuple(s) N = len(s) if N <= 1: yield s[:] raise StopIteration() for x in perms(s[1:]): for i in range(0,N): yield x[:i] + (s[0],) + x[i:] I tested both using timeit module. My tests: $ echo "python2.6:" && ./testing.py && echo "python3:" && ./testing3.py python2.6: args time[ms] 1 0.003811 2 0.008268 3 0.015907 4 0.042646 5 0.166755 6 0.908796 7 6.117996 8 48.346996 9 433.928967 10 4379.904032 python3: args time[ms] 1 0.00246778964996 2 0.00656183719635 3 0.01419159912 4 0.0406293644678 5 0.165960511097 6 0.923101452814 7 6.24257639835 8 53.0099868774 9 454.540967941 10 4585.83498001 As you can see, for number of arguments less than 6, python 3 is faster, but then roles are reversed and python2.6 does better. As I am a novice in python programming, I wonder why is that so? Or maybe my script is more optimized for python2? Thank you in advance for kind answer :)

    Read the article

  • Approaches for animating a C# property over time?

    - by Mario Fritsch
    I'm currently trying to animate a bunch of public properties on certain objects. Usually they are of type float or vectors of floats (the type is known at compile-time). I want to be able to: assign a static value to them (MyObject.Duration = 10f;) or assign a random value to them by specifying a minimum and maximum value and optionally also a weight (MyObject.Duration = new RandomFloat(5f, 20f, 2f);) or "bind" this property to the property of another object (think of a child object binding some of its properties to its parent object, like its color or size or sth.) or assign sort of a keyframe animation to them, specifying a variable number of keyframes with timecode and the property's value at that specific point in time as well as information about how to interpolate between these frames The keyframes should be able to accept random values for each frame, both for the time and the property's value. What would be a practical approach for this kind of system? Currently I'm thinking about polymorphism: implement a base class or interface with a public Value-property and/or GetValue(float time)-method and then creating different sub classes like StaticValue, RandomValue, BindingValue and AnimatedValue implementing this base class or interface. Doesn't seem very elegant, though, and the initialization of even simple objects becomes a bit tedious. Another idea would be to implement these properties just as regular floats or vectors and create special "Modifier"-types binding to these properties. To retrieve the "real" value of the property, I'd first call any Modifier bound to the property, which would in turn update the actual object's property for me to retrieve later on. That would most likely mean using reflection at some point, which could be quite bad for performance as I'll probably have thousands of properties to update dozens of times per second. Any suggestions on this? Being a novice I'm (hopefully) missing some far more elegant and/or practical solution than I'm already playing around with :( Edit: Probably should have mentioned this earlier, but WPF isn't an option - it's not available on all targetted platforms, so I can't rely on it. I'm aware of its powerful databinding and animation capabilities, but I need to roll my own (or find some other lightweight alternative meeting my needs).

    Read the article

  • How to push further as a programmer?

    - by MaXX
    For the last, hmm, 6 months I've been reading into Programming in C, I got myself K&Rv2, BEEJ's socket guide, Expert C programming, Linux Systems Programming, the ISO/IEC 9899:1999 specification (real, and not draft). After receiving them from Amazon, I got Linux installed, and got to it. I'm done with K&R, about halfway through Expert C Programming, but still feel weak as a programmer, I'm sure it takes much more than 6 months of reading to become truly skilled, but my question is this: I've done all the exercises in K&Rv2 (in chapter 1) and some in other chapters, most of which are generally really boring. How do I lift my skills, and become truly great? I've invested money, time and a general lifestyle for something I truly desire, but I'm not sure how exactly to achieve it. Could someone explain to me, perhaps if I need to continuously code, what exactly I'm to code? I'm pretty sure, coding up hello world programs isn't going to teach me any more than I already know about anything. A friend of mine said "read" (with emphasis on read) a man page a day, but reading is all I do, I want to do, but I'm not sure what! I'm interested in security, but I'm not sure as a novice what to code that would be considered enough. Ah, I hope you don't delete this paste :) Thanks

    Read the article

  • Unknown ListView Behavior

    - by st0le
    I'm currently making a SMS Application in Android, the following is a code snippet from Inbox Listactivity, I have requested a cursor from the contentresolver and used a custom adapter to add custom views into the list. Now, in the custom view i've got 2 TextViews (tvFullBody,*tvBody*)... tvFullBody contains the Full SMS Text while tvBody contains a short preview (35 characters) The tvFullBody Visibility is by default set to GONE. My idea is, when the user clicks on a list item, the tvBody should dissappear(GONE) and the tvFullBody should become visible (VISIBLE). On Clicking again, it should revert back to its original state. //isExpanded is a BitSet of the size = no of list items...keeps track of which items are expanded and which are not @Override protected void onListItemClick(ListView l, View v, int position, long id) { if(isExpanded.get(position)) { v.findViewById(R.id.tvFullBody).setVisibility(View.GONE); v.findViewById(R.id.tvBody).setVisibility(View.VISIBLE); }else { v.findViewById(R.id.tvFullBody).setVisibility(View.VISIBLE); v.findViewById(R.id.tvBody).setVisibility(View.GONE); } isExpanded.flip(position); super.onListItemClick(l, v, position, id); } The Code works as it is supposed to :) except for an undesired sideeffect.... Every 10th (or so) List Item also gets "toggled". eg. If i Expand the 1st, then the 11th, 21th list items are also expanded...Although they remain off screen, but on scrolling you get to see the undesired "expansion". By my novice analysis, i'm guessing Listview keeps track of 10 list items that are currently visible, upon scrolling, it "reuses" those same variables, which is causing this problem...(i didn't check the android source code yet.) I'd be gratefull for any suggestion, on how i should tackle this! :) I'm open to alternative methods aswell....Thanks in advance! :)

    Read the article

  • Help me sort programing languages a bit

    - by b-gen-jack-o-neill
    Hi, so I asked here few days ago about C# and its principles. Now, if I may, I have some additional general questions about some languages, becouse for novice like me, it seems a bit confusing. To be exact I want to ask more about language functions capabilities than syntax and so. To be honest, its just these special functions that bothers me and make me so confused. For exmaple, C has its printf(), Pascal has writeln() and so. I know in basic the output in assembler of these funtions would be similiar, every language has more or less its special functions. For console output, for file manipulation, etc. But all these functions are de-facto part of its OS API, so why is for example in C distinguished between C standard library functions and (on Windows) WinAPI functions when even printf() has to use some Windows feature, call some of its function to actually show desired text on console window, becouse the actuall "showing" is done by OS. Where is the line between language functions and system API? Now languages I dont quite understand - Python, Ruby and similiar. To be more specific, I know they are similiar to java and C# in term they are compiled into bytecode. But, I do not unerstand what are its capabilities in term of building GUI applications. I saw tutorial for using Ruby to program GUI applications on Linux and Windows. But isn´t that just some kind of upgrade? I mean fram other tutorials It seemed like these languages was first intended for small scripts than building big applications. I hope you understand why I am confused. If you do, please help me sort it out a bit, I have no one to ask.

    Read the article

  • tomcat wont start up on linux machine

    - by David
    hi, im new to linux but after spending the day i have got linux running. installed java and tomcat. my goal is host my app with this linux box i've just set up. i know it all works fine from my windows based machine but it is my laptop so i'm planning this as my dedicated server. following many many forums i've now got tomcat 7 installed. however i cannot get it to start. changing to the tomcat directory and "./startup.sh" i get output Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local.tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: usr/lib/jvm/java-6-sun/ Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local.tomcat/bin/c\tomcat-juli.jar thats the end of theoutput. however localhost:8080 is not up. and in the tomcat log file is the error "eval: 1: usr/lib/jvm/java-6-sun//bin/java: not found" hopfully there is some expert here who can help me with this problem. please note that im a novice when it comes to linux. thankyou oh and my version of linux is Ubuntu 10.04 LTS - the Lucid Lynx

    Read the article

  • Reading input files in FORTRAN

    - by lollygagger
    Purpose: Create a program that takes two separate files, opens and reads them, assigns their contents to arrays, do some math with those arrays, create a new array with product numbers, print to a new file. Simple enough right? My input files have comment characters at the beginning. One trouble is, they are '#' which are comment characters for most plotting programs, but not FORTRAN. What is a simple way to tell the computer not to look at these characters? Since I have no previous FORTRAN experience, I am plowing through this with two test files. Here is what I have so far: PROGRAM gain IMPLICIT NONE REAL, DIMENSION (1:4, 1:8) :: X, Y, Z OPEN(1, FILE='test.out', & STATUS='OLD', ACTION='READ') ! opens the first file READ(1,*), X OPEN(2, FILE='test2.out', & STATUS='OLD', ACTION='READ') ! opens the second file READ(2,*), Y PRINT*, X, Y Z = X*Y ! PRINT*, Z OPEN(3, FILE='test3.out', STATUS='NEW', ACTION='WRITE') !creates a new file WRITE(3,*), Z CLOSE(1) CLOSE(2) CLOSE(3) END PROGRAM PS. Please do not overwhelm me with a bunch of code monkey gobblety gook. I am a total programming novice. I do not understand all the lingo, that is why I came here instead of searching for help in existing websites. Thanks.

    Read the article

  • Codeigniter: how should I restructure db schema?

    - by Kevin Brown
    I don't even know if that's the right term. May it be known that I'm a major novice! I have three tables: users, profiles, and survey. Each one has user_id as it's first field, (auto-increment for users), and they're all tied by a foreign key constraint, CASCADE on DELETE. Currently, for each user, let's say user_id 1, they have a corresponding db entry in the other tables. For profiles it lists all their information, and the survey table holds all their survey information. Now I must change things...darn scope creep. Users need the ability to have multiple survey results. I imagine that this would be similar to a comment table for a blog... My entire app runs around the idea that a single user is linked to a constraining profile and survey. How should I structure my db? How should I design my app's db so that a user can have multiple tests/profiles for the test? Please assist! Any advice, information and personal-knowledge is appreciated! Right now the only way I know how to accompany my client is to create a pseudo-user for each test (so unnecessary) and list them in a view table (called "your tests")-- these are obtained from the db by saying: where user_id=manager_id

    Read the article

  • Java: Inputting text from a file using split

    - by 00PS
    I am inputting an adjacency list for a graph. There are three columns of data (vertex, destination, edge) separated by a single space. Here is my implementation so far: FileStream in = new FileStream("input1.txt"); Scanner s = new Scanner(in); String buffer; String [] line = null; while (s.hasNext()) { buffer = s.nextLine(); line = buffer.split("\\s+"); g.add(line[0]); System.out.println("Added vertex " + line[0] + "."); g.addEdge(line[0], line[1], Integer.parseInt(line[2])); System.out.println("Added edge from " + line[0] + " to " + line[1] + " with a weight of " + Integer.parseInt(line[2]) + "."); } System.out.println("Size of graph = " + g.size()); Here is the output: Added vertex a. Added edge from a to b with a weight of 9. Exception in thread "main" java.lang.NullPointerException at structure5.GraphListDirected.addEdge(GraphListDirected.java:93) at Driver.main(Driver.java:28) I was under the impression that line = buffer.split("\\s+"); would return a 2 dimensional array of Strings to the variable line. It seemed to work the first time but not the second. Any thoughts? I would also like some feedback on my implementation of this problem. Is there a better way? Anything to help out a novice! :)

    Read the article

  • SFTP in Python? (platform independent)

    - by Mark Wilbur
    I'm working on a simple tool that transfers files to a hard-coded location with the password also hard-coded. I'm a python novice, but thanks to ftplib, it was easy: import ftplib info= ('someuser', 'password') #hard-coded def putfile(file, site, dir, user=(), verbose=True): """ upload a file by ftp to a site/directory login hard-coded, binary transfer """ if verbose: print 'Uploading', file local = open(file, 'rb') remote = ftplib.FTP(site) remote.login(*user) remote.cwd(dir) remote.storbinary('STOR ' + file, local, 1024) remote.quit() local.close() if verbose: print 'Upload done.' if __name__ == '__main__': site = 'somewhere.com' #hard-coded dir = './uploads/' #hard-coded import sys, getpass putfile(sys.argv[1], site, dir, user=info) The problem is that I can't find any library that supports sFTP. What's the normal way to do something like this securely? Edit: Thanks to the answers here, I've gotten it working with Paramiko and this was the syntax. import paramiko host = "THEHOST.com" #hard-coded port = 22 transport = paramiko.Transport((host, port)) password = "THEPASSWORD" #hard-coded username = "THEUSERNAME" #hard-coded transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) import sys path = './THETARGETDIRECTORY/' + sys.argv[1] #hard-coded localpath = sys.argv[1] sftp.put(localpath, path) sftp.close() transport.close() print 'Upload done.' Thanks again!

    Read the article

  • Quick question regarding MVC framework for a java game

    - by Jason
    I have a question regarding the use of the MVC framework for a blackjack game im writing in java. As I understand, my model would be a class that stores the state of the game, and more specifically, each players hand. Within the model class, I would have an array of listeners, which would be notified each time the game state changes (ie a player has drawn a new card). These listeners would be my viewer, which is the class that handles the display of the game. This class would implement the ActionListener interface, and each time the model changes, it would call/"notify" my viewer's actionPerformed method. My question is as follows: I intend to have two JPanels, each devoted to displaying the respective player's hand. As a player draws a new card, a new ImageIcon would be added to the panel. My question is how would the viewer class know what card has been added to the player's hand? I suppose I could store the player's hand before a notify event, and then upon the notification event, compare the new state with the old, to find out what has changed. I'm a complete novice here, so I could be completely wrong, but it seems a bit tedious to do this. Is there a more efficient/common way of detecting what has changed in the model between the before and after state? Another solution would be to redraw the entire panel each time the notification occurs? Would this be a better idea?

    Read the article

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