

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
201. |
Solve : Java Classpath problem...? |
Answer» Hi everyone, |
|
202. |
Solve : String stuff c++? |
Answer» 0 >object_p/long1.png< x=0 y=226 1 >object_p/long1.png< x=639 y=226 2 >object_p/long1.png< x=1279 y=226 3 >object_p/p4.png< x=215 y=142 4 >object_p/p5.png< x=457 y=90 5 >object_p/p6.png< x=691 y=61 6 >object_o/box1.png< x=775 y=37 7 >object_o/car5.png< x=618 y=180 8 >object_o/signright.png< x=5 y=195 9 >object_o/signup.png< x=206 y=197 10 >object_o/lamp2.png< x=113 y=113 11 >object_o/lamp2.png< x=545 y=120 12 >object_o/lamp3.png< x=936 y=161 13 >object_o/car5.png< x=1019 y=181 14 >object_o/car6.png< x=832 y=192 15 >object_p/block3.png< x=768 y=175 16 >object_p/block2.png< x=1225 y=177 17 >object_p/p4.png< x=1355 y=71 i have those information above store as a txt file. in c++ How i can retrive only the file path and store it in array string? file path are located between > path < Thank youSo FAR i got to this ifstream levelFile ("levels/lv1/level.txt"); int start, end; if (levelFile.is_open()) { string line; getline(levelFile,line); //this is used to skip the first line while ( levelFile.good() ) { getline(levelFile,line); for (int i = 0; i < line.length(); i++) { char newLine[100]; strcpy_s(newLine, line.c_str()); if (line.at(i) == ">" ) { start = i; } << why cant i do this if (newLine == "<") { end = i; } << why cant i do this } } levelFile.close(); } else cout << "Unable to open file";it doesnt matter now ive DONE it.... SORRY for posting but i was really frustrated but with abit of reading i wont be posting problem againb until i really need help. Solutions ifstream levelFile ("game_resource/lv1.txt"); int start, end; string fPath; char NL[] = ">"; char nt[] = "<"; if (levelFile.is_open()) { string line; getline(levelFile,line); //this is used to skip the first line while ( levelFile.good() ) { getline(levelFile,line); for (int i = 0; i < line.length(); i++) { if (line == nl[0]) { start = i; } <<btw line is suppose to be line(i) if (line == nt[0]) { end = i; } } end = end - start; fPath = line.substr(start, end); } levelFile.close(); } else cout << "Unable to open file"; |
|
203. |
Solve : duplicate : how to remove varible from a list? |
Answer» hey I am doing something like following:
Solve teh problem of by using following : Code: [Select]var1=$(echo $var1 | sed "s/$var//") But STILL How can i select the random varible from the list Question is there. Please suggest.make an array of variable in list , find the index of that array . Do Code: [Select]X=rand()%index to generate the random number and with that random number go to the array element : Code: [Select]array [x] This will give you the random selection for each time. Thanks RGhello i dont know which language you are working on...but from my experience.. are the syntax correct? u declare var1='1 2 3 4 5' then u said for var in $var1 i think you should declare var1 as $var1='1 2 3 4 5' and for $var in $var1 |
|
204. |
Solve : Python Help - Simple (X , Y) coord display? |
Answer» I am trying to create a program that returns an (X , Y) coord that increases or decreases based on INPUT of either X, -X, Y, or -Y. However, when I run it it always returns (0 , 0). What am I doing wrong? Here is my code. |
|
205. |
Solve : java programming language for mobile , need help, plss :(? |
Answer» hi everyone. |
|
206. |
Solve : why does OS shutt down computer during load?? |
Answer» I have a HP Pavilion Entertainment Notebook (dv 1000) |
|
208. |
Solve : bash concatenate? |
Answer» Hi people, set "str1=Hello" What you want to get is e.g.: "I:\Hello" Code: [Select]set str1=Hello echo %str1% set str3= %~dp0%str1% echo %str3% pause But this has nothing to do with my question, it is the same problem in another scripting language... The only difference is that here it works and in bash scripting it does weird stuff (at my pc at least)#!/bin/bash DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PATH="/System/java/" FULL=$DIR$PATH echo $DIR echo $PATH echo $DIR$PATH echo $FULL FULL=${DIR}/System/java/ echo $FULL echo "________________"$DIR$PATH I had to adjust the amount of underscores to see the $DIR$PATH. Hope is helps. I used cygwin btw :-)You just adjusted the number of underscores to the number of signs in DIR/PATh to see them printed next to each other. The point is that I shouldn't neet underscores or whatever "filling signs" to print them next to each other. I have a variable FOO and I want to concatenate it to the variable BAR and store it into a new one FULL. Then when I should print FULL I should see the CONTENTS of FOO at the time of the concatenation and then the contents of BAR at the time of the concatenation. Google says that it should work. All the sites say this: FULL=$FOO$BAR or FULL=$FOO"contents of BAR" or FULL=${FOO}${BAR} EDIT: I found something strange. When I output it to a text file (append > file.txt to the command) it writes the correct output to the file....I think I found it You need to do a dos2unix conversion first. When you MADE your script in (most likely) a windows text editor (like notepad), the text editor puts a cariage return "\r" and another character at the end of each line. You can see these characters in notepad++ by selecting "show all characters" from the "view > non-printable characters" menu. The Bourne again shell does not like these characters. Therfore you need to convert the dos/windows file into a unix file. Cause Unix files have these characters in a different form. What I did: 1. Open cygwin terminal. 2. Type: dos2unix yourfile.sh 3. Hit enter 4. Type: sh yourfile.sh 5. Hit enter No text-overlap in my window Good luckthats nice learning_cmd...your learning very fast....yea i was guessing it was some kind of conversion issue...but didnt know what to do.... nice workThanks that's nice, I didn't think of that immediately! Btw you don't need that dos2unix file, I just used Notepad++ (Edit menu, then Formatting/Format, Unix) Thanks for your time and help you 2 =) If you have a problem, PM me if you want ^^What you said. All CR's gone on the fly Quote from: Bennieboj on January 11, 2012, 09:31:24 AM Thanks that's nice, I didn't think of that immediately!Isn't the point of creating a script so that there is no user intervention?or use tr: Code: [Select]tr -d '\015' < inputfile.txt > result.txt Quote from: Squashman on January 11, 2012, 11:05:20 AM Isn't the point of creating a script so that there is no user intervention? Yes it is, there ain't any user intervention. Why you're quoting my post? I don't see the reference to anything I said and the question. BC: thanks, but I'm not much of a command ninja =) |
|
209. |
Solve : Help with VBScript? |
Answer» Hello, I could probably help you if this was a normal vbs, but I can't figure out how to run it. Can you explain how this works? Should it be in a web page or something? Yes actually, the output displays in a chat window of a web browser. Thank you for TAKING the time whether you do find a solution or not. |
|
210. |
Solve : VBA Timer?? |
Answer» I'm making a puzzle game in PowerPoint in which each level you have to press a button while avoiding obstacles. Most of the general stuff is being programmed in VBA. However, in each level there will be a timer that will silently count down from 60 to 0. Once the level is complete, it will add the amount of seconds left to the score. Think this is what your looking for: http://www.tushar-mehta.com/powerpoint/ppt_timer/index.htmThat doesn't have any support for VBA as FAR as I know. D: Quote from: Linux711 on January 14, 2012, 12:49:17 PM Never heard of making a game in pp though. If you are going to need more functionality, I think you should use a real programming language.VBA is just as much of a programming language as ActionScript; just think of it having a visual interface like Flash does. Are you not understanding? VBA (Visual Basic with an A; I don't know what it stands for ) is a programming language implemented into Microsoft Office programs that can be used for Macros, subroutines that can simplify tasks and do other stuff. In PowerPoint, macros can be run by action buttons, animations, and so forth to do more than just cleaning up empty text boxes. By the way, you can make a game in PowerPoint without macros, but it'll be simple stuff like MAZE games using the mouse and Jeopardy. Also, that thing costs money. VBA stands for Visual Basic for Applications. You could use the SSubTmr from VBAccelerator. download, register DLL, use Tools->References (In the VBA EDITOR)and add it. (VBAccelerator Subclassing and Timer Assistant) Then you can use it, say in a UserForm: Code: [Select]Private WithEvents timerobj As SSubTimer6.CTimer Private StartTime As Date Private Sub timerobj_ThatTime() Label1.Caption = Now()-StartTime End Sub Private Sub UserForm_Initialize() Set timerobj = new CTimer timerobj.Interval=300 StartTime=Now() End Sub It won't work in a code module; would need to either be in it's own class or a UserForm (I believe it will also work in a Slide). Basically you use the timer to periodically update the display of a label, or other element. |
|
211. |
Solve : An error in Vb.net? |
Answer» this is my code: |
|
212. |
Solve : unable to install vb 6.0 in xp? |
Answer» hi, |
|
213. |
Solve : dos batch file to input, search and run a command.? |
Answer» Hi All, |
|
214. |
Solve : Need help coding prank virus in NotePad? |
Answer» Recently, me and my friend have have been having a nerd WAR with our school laptpos. He's found a WAY to remotley shut off my laptop wich is VERY inconvenient. Now i want to STRIKE back by coding a prank virus. Basically the program generates a random number between 1 and 30 and uses that number for a countdown timer. When the timer hits 0 the computer shuts down. Now i want to find a way to make it copy iteslf to his startup folder. Any ideas? I'm using NotePad.We're not going to help you with that type of REQUEST. Thread LOCKED. |
|
215. |
Solve : Want help with simple I/O in C or C++? |
Answer» I have a hard time with tutorials. Can somebody out there give me a code snippet that can do the following: Also, how do I compile it to an executable. I RECOMMEND code blocks. It's free, just google. |
|
216. |
Solve : batch execute after messages in notepad? |
Answer» does ANYBODY know how i can make my batch file execute after a series of MESSAGE boxes in NOTEPAD? Quote from: RIfishman on January 29, 2012, 07:35:15 AM a series of message boxes in notepad? What does this mean? |
|
217. |
Solve : Visual Basic Convert string to integer? |
Answer» Hi, I solved the problem with a much simpler solution, using CodeDOM expression evaluator. Be warned that using the CodeDOM as a expression evaluator will pollute your application namespace since each and every evaluation will create a entirely new assembly and load it into your appdomain. As your application runs and evaluates expressions you will just load more and more assemblies into your appdomain until the system runs out of memory (at which point the app crashes). The solution for that is to explicitly manage the AppDomains and load the new assemblies into them yourself, but the code to do that makes the code many times longer, since you then have to generate an entire MarshalByRef-derived Object in the "new" assembly and refer to that in your main one to prevent the temporary assemblies from LOADING into the main AppDomain when you access it, and managing this can be a gigantic pain. In my experience the things you can do wrong using the codeDOM to evaluate expressions are innumerable. You can (possibly) use the "Expression" class if you are using Framework 4, but I can't find any samples on that personally. I had no idea it could be so hard. Quote from: Geek-9pm on January 28, 2012, 11:10:52 AM I had no idea it could be so hard. It's only hard if you try to take shortcuts |
|
218. |
Solve : Visual basic question?? |
Answer» I have a long script that sits in my richtextbox " CurrentTaskInterval = hours_in_ms(1);", _ Appears to be a value that has a value at the start of the program. The name suggests that it will change, but it must start at 1. But you would like it to sometimes start at 2? Maybe what you want is a way to tell the program to start will a different value if you want. Sorry, I don't have enough experience with Visual Basic to make a useful recommendation. It would seem that what you want is a command line option for the program at run time. http://www.vbexplorer.com/VBExplorer/vb_feature/august2000/command_line_arguments.asp If this has any relevance to what you want, please say so. Or try again to explain what you need in a general way. Maye BC will see this. |
|
219. |
Solve : Adobe Photoshop how-to? |
Answer» alright so I've had ADOBE photoshop 3.0 for about a year. I'm a big photograph freak, and I would love to be ABLE to have COOL effects on photo's but I cannot FIGURE out the software. The specific effect I would love to do is to have a picture black and white and then have some random spash of color like certain objects have color and some don't. |
|
220. |
Solve : Query regarding DLL file? |
Answer» i am unable to find out the exact information regarding the System.Data.DLL file MADE use of in ADO.NET.I appeal u to help me regarding the above query and send me the RELEVANT ANSWER to my mailID. |
|
221. |
Solve : Get return value of Store procedure from batch? |
Answer» HI all, How can I get return value of store procedure from batch file. I can get reuturn value from SQL using EXIT(%query%). But when I use EXIT("exec MyStore"). It cannot ! PLEASE HELP me! Thank you. can post your code?Hi all, I have SOLVED that problem. I ceated a view to store error code (the value that I want to return), and get error code from that view by using normal select. Thank you. |
|
222. |
Solve : Need help writing Applescripts? |
Answer» If anyone can HELP... |
|
223. |
Solve : joomla 2.5 Contacts component problem? |
Answer» Hi guys, I'm a new Joomla 2.5 user |
|
224. |
Solve : C program I build today that calculates sqrt.? |
Answer» Hey EVERYONE, KILLLER programHuh? You post a program that does not work and call it a killer? Is this homework? There is a specific classical algorithm for doing square root. Are you claiming that your program does any root? There are are C libraries for doing logarithms. Using it one can do almost any power or root of any pragmatic real number. Exponents and Logarithms - The GNU C LibraryI compiled it with tcc, maybe that helps. I know that there are basic functions for doing sqrt, but I made this to get into the PROGRAMMING language. No it's not homework OK. It is to improve you skis. Great! Have you EVERY done the classical algorithm on a simple calculator that has not sqrt functions. How to calculate a square root without a calculator The above tells how to do it with pencil and paper, but I like to do it with a small calculator without the sqrt key. Once I calculated the 12™ root of 2. But I forgot to write it down! Once you are very familiar with the logic of the algorithm, it makes it easier to check your work will the C code you have.Looked into that algorithm on how to calculate sqrt on paper. No wonder old people are cranky most of the time Code: [Select]#include <stdio.h> #include <stdlib.h> double absolute(double value) { return value>0?value:-value; } double sqrt(double value) { if (value < 0) return 0; double atolerance = 1E-15; double t = value; while (absolute(t - value/t) > atolerance*t) t = (value/t + t) / 2.0; return t; } int main(char* argv[], int argc) { double enteredvalue; printf("Enter Value:\n"); scanf("%lf", &enteredvalue); printf("sqrt of %5.2f is %5.2f\n",enteredvalue,sqrt(enteredvalue)); } Newtons method ftw. Figured I may as well make a cheap abs() equivalent as well for no reason. Quote from: learning_cmd on January 13, 2012, 05:01:44 PM Looked into that algorithm on how to calculate sqrt on paper. We are mainly cranky with kids who think you can get everything you want just by pressing a button. Quote from: Salmon Trout on January 14, 2012, 01:40:40 AM We are mainly cranky with kids who think you can get everything you want just by pressing a button. You can, if it's this button: Quote from: Rob Pomeroy on January 14, 2012, 08:18:49 AM You can, if it's this button: http://www.85qm.de/up/BigRedButton.swf I hit it twice... What happens if I do three times?It goes on for about 200 presses and then repeats itself.to OP: here are some nice "assignments": http://www.doc.ic.ac.uk/~wjk/C++Intro/RobMillerE5.html learningcmd, Go to www.swboneyard.com and look for the "Calc" program. This is a full featured algebraric parser I wrote in C a while back, does everything you need. Might make for a good example. Bryan Wilcutt |
|
225. |
Solve : Copy the file automatically every the file just closed? |
Answer» I want to make a back-up of a file when it's just CLOSED. In example : I have a .accdb file, work with it, then after i close this file, automatically windows make a new back-up with the same file. |
|
226. |
Solve : Trying to make a Timer VB.net? |
Answer» PUBLIC Class Form1 Dim TimeEnd, TimeStart, TimeStop As New DateTime Dim isStop, isPause As Boolean Dim form02 As New Form2 Dim foo, TimePause, ElapseTime, TotalTimePaused As New TimeSpan Dim h, m, s As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Enabled = False TextBox1.Text = "0" : TextBox2.Text = "0" : TextBox3.Text = "0" Button6.Hide() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If Timer1.Interval <> 100 Then Timer1.Interval = 100 If DateTime.Now > TimeEnd Then TextBox5.Text = "Time End" Timer1.Stop() Else If isStop = False And isPause = False Then foo = TimeEnd - DateTime.Now TextBox5.Text = String.Format("{0:D2}:{1:D2}:{2:D2}", _ foo.Hours, foo.Minutes, foo.Seconds) End If TextBox6.Text = TimeStart.ToString("hh:MM" & " " & "tt") If isStop Then TextBox4.Text = TimeStop.ToString("hh:mm" & " " & "tt") Else TextBox4.Text = TimeEnd.ToString("hh:mm" & " " & "tt") End If TextBox1.Text = "0" : TextBox2.Text = "0" : TextBox3.Text = "0" End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'START Button1.Hide() Timer1.Enabled = True If Not Integer.TryParse(TextBox1.Text, h) OrElse _ Not Integer.TryParse(TextBox2.Text, m) OrElse _ Not Integer.TryParse(TextBox3.Text, s) Then 'bad input data Exit Sub End If TimeEnd = DateTime.Now.AddHours(h).AddMinutes(m).AddSeconds(s) TimeStart = DateTime.Now TimeOfDay = DateTime.Now Timer1.Interval = 1 Timer1.Start() isStop = False End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'STOP isStop = True TimeStop = DateTime.Now ' form02.PressStop = True End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click isPause = True Timer1.Enabled = False Button1.Hide() Button6.Show() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click 'RESUME If isPause = True Then Timer1.Enabled = True isPause = False End If End Sub End Class im working on a stop watch that can set a time then do a countdown, and do a ascending count .im kind of a messy when it comes to this thing hope u understand the code. what im trying to do now is to make a PAUSE and RESUME button for this code. i've tried using on the Pause button timer1.enabled = false and on the RESUME button Pause button timer1.enabled = true. it does pause the time and resumes it,but for example the TIMER is counting down and i pause it at 5:33, and resume it after 7 seconds, the timer then resumes at 5:40, what i want to do is to make it resume from the time that i pause it, in my example i want it to resume from 5:33. hope you can help me. thanks in advanceIs the code all yours? Was part of it copied from another source? How much accuracy do you NEED? Have you already read this? http://www.dotnetperls.com/timer-vbnet OR http://www.ehow.com/how_4590003_program-timer-control-vbnet.html OR http://www.techrepublic.com/forum/questions/101-224643/vbnet-timer-control-woes |
|
227. |
Solve : delphi? |
Answer» When I use the GLYPH property, how do I know which color is TRANSPARENT? Regards, Ezeekart TEAM, Buy Smart Mobile phones online www.ezeekart.com Delphi? Wow... OKAY... diggin in my brain. What I recall is the set back ground color would be set to 0 for transparent, or any number for the specific color pen. Bryan Wilcutt Quote Delphi always assumes that the color of the BOTTOM left-hand corner pixel is the background color and should be displayed as transparent. |
|
228. |
Solve : How to add parity bits to binary numbers c#? |
Answer» Hello. This is my code. I am trying to make a program on c# which the user types in a 7-bit binary number and the program prints the number with an EVEN parity bit added to it on the left. It says some things don't fit in the context. Is there any way you could do a code as I think it is wrong. |
|
229. |
Solve : Funny C code? |
Answer» This is some really funny code (although you have to open it at the COMMAND prompt). CALL the file stop. |
|
230. |
Solve : Macro in Win XP? |
Answer» I have a repeatedly steps when i work with an application. ProsFrom http://www.pcmag.com/article2/0,2817,2358993,00.asp Read over the article well. Key Text is virtual a programming language. Hard to learn, but with nit you can walk on water.Auto-It 3 is free: http://www.autoitscript.com/site/autoit/ AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect. Features: Easy to learn BASIC-like syntax Simulate keystrokes and mouse movements Manipulate windows and processes Interact with all standard windows controls Scripts can be compiled into standalone executables Create Graphical User Interfaces (GUIs) COM support Regular expressions Directly CALL external DLL and Windows API functions Scriptable RunAs functions Detailed helpfile and large community-based support forums Compatible with Windows 2000 / XP / 2003 / Vista / 2008 / Windows 7 / 2008 R2 Unicode and x64 support Digitally signed for peace of mind Works with Windows Vista’s User Account Control (UAC) Quote Window Management Auto-It has a very active forum, with some of the most pro-active moderation I have ever seen - bans are posted on a public board; in the original post which I quote here, the bold parts are links to the offending behaviour (criticising another member). example (user "Alupis"): Quote 3 days posting ban. It is quite AMUSING to read the moderation board http://www.autoitscript.com/forum/forum/28-user-moderation/ One way to get a permanent ban is to ignore the rules about game bots (Don't ask how to write one, don't respond with help to people who do). They are very hot on any KIND of script kiddie ideas that posters may have, and very very quick to spot those to try to hide what they are really asking about. |
|
231. |
Solve : Ask: How to make auto reconnect / restart + remembered id & password use dos bat? |
Answer» Hi there, i'm really noob here LET me EXPLAIN my problem to you first : |
|
232. |
Solve : How to send a HTTP request within a batch file?? |
Answer» Any help would be much appreciated! Get-Web (Another round of wget for PowerShell)Forgot the link. http://huddledmasses.org/get-web-another-round-of-wget-for-powershell/Some sample CODE: Code: [Select]# WebClient object, for querying a web server through a proxy server with POST data $wc = new-Object System.Net.WebClient $proxy = New-Object System.Net.WebProxy('proxy.local', '8080') $proxy.BypassList = 'someserver.local' $wc.proxy = $proxy $post_vars = new-object System.Collections.Specialized.NameValueCollection # Download a PAGE $startpage = $wc.DownloadString("http://wherever.com") $post_vars.Add('variable1','value1') $post_vars.Add('variable2',$value2) $endpage = $wc.UploadValues('http://wherever.com/upload', 'POST', $post_vars) # For debugging: $response = [System.Text.Encoding]::ASCII.GetString($endpage) Write-Host $response |
|
233. |
Solve : Differences between Linux and Windows Server? |
Answer» I have been studying a web site that uses ASP.NET and so it resides on a WINDOWS Server but it also uses some JScript so it is worth studying. Anyway, I am moving it to a Linux server and I have noticed some DIFFERENCES in the way it handles files. First of all, the Windows Server is not case sensitive. But I also noticed something else. It seems that the Windows Server can have file names with spaces in them like this: "Creative%20Design%20vert_S" where the "%20" is a space. But, when I try to upload this directory to the Linux server using FileZilla it does not seem to work. And then when I try to CREATE the directory, I get an error "Forbidden command argument". So is using %20 in a direcory name illegal in Linux? |
|
234. |
Solve : Toshiba Dynabook portege 1601? |
Answer» Hello There, |
|
235. |
Solve : Problem setting up my C# program to display XML results according to what my com? |
Answer» I need to make it so that WHENEVER I have "East" selected under my combobox for example, then only the list of parks with that PARTICULAR location will show up. I also need to do the same for whichever facilities are selected and if the park falls within the opening and closing dates as well. |
|
236. |
Solve : Time Elapsed Help C#? |
Answer» I just started trying to learn c# so bear with me. |
|
237. |
Solve : Need some HTML guidance...? |
Answer» I have this code... |
|
238. |
Solve : Modding C&C 3 and Creating Video games? |
Answer» I have sort of modded before C&C 3 and loved it because it was so simple, but it was only xml UNDERSTANDING as it turns out. So I was wondering, is it possible to create a mod for this game using Python? I hear it's one of the simplest object oriented languages to learn. So any programming language can be used to mod any video game?No. It depends on the game. A Java game- for example, minecraft- would have to be modded using Java. However, a mod could be created, in java, that interfaced with a .NET assembly or something. Most games are written in C++, and compile to machine code, so the only real modding you can do would involve either directly manipulating that machine code, or, more commonly, using whatever tools and configurations the game creator provides. Quote How about Linux/ Ubuntu, any programming language works the same on there as on Windows?Not "Any", No; but any language worth using works on a variety of platforms. Those that don't often have attempts to bring a similar language to it. For example, VB6 usually only works on windows, but there is a program called "Gambas" that RUNS on Linux that provides a similar toolset and language. Quote it's just that I don't know what languages exactly exist, just from reading and searching I hear about these new languages like Python and LispLisp was created in the EARLY 60's, so not really that new. It was one of the earliest hkigh-level languages. Python was around mid-90's, and given the age of computer science, that's still quite a while ago. Quote what language to learn that I can use to make mods for games and also later on make actual games for Ubuntu.There is no "mod language". Each game will expose it's innards to mod developers using a different scripting language. many games use Lua, but some lothers use python. Still others use a custom script language, like "RealScript" for the unreal engine. Some don't expose themselves at all, in which case, if you are lucky, they are written in a language with some sort of introspection capability, such as Java or a .NET language. Minecraft mods, for example, are essentially extra class files and hacked class files that add and replace existing classes in the game, adding new blocks or items or whatever. If the game compiles to machine code- and most do- that means that you would need to understand how to dissassemble the file, as well as how to read uncommented assembly language. As for languages that could be used for making games on Ubuntu. The list of languages that you can't use to make games in Ubuntu(or any OS, for that matter) would be perhaps a dozen, and that is a liberal estimate. |
|
239. |
Solve : Excel Web Query not coming up right? |
Answer» Dear Forum, |
|
240. |
Solve : c# help? |
Answer» in C#
_ApplicationButton
_ApplicationButton
_ApplicationButton
_ApplicationButton
_ApplicationButton
} USING (sr) { for (int x = 0; x < lineCount / 3; x++) { _ApplicationButton
sr.ReadLine(); sr.ReadLine(); } } adding a handler for the click event of the button would be a good start... |
|
241. |
Solve : batch file for ipconfig + ping results? |
Answer» Hi guys!! Are you looking to ping the entire subnet? I was really just looking to ping 2 or 3 IP addresses on the network. Quote from: bwilcutt on February 16, 2012, 04:15:43 PM
I was hoping to stick to the .bat thing because that's the only bit of programming I'm even remotely familiar with, but I'm definitely open to whatever will work best. Quote from: bwilcutt on February 16, 2012, 04:15:43 PM Also... Sorry I think I explained this badly! A lot of my day in the near future will be spent calling clients to determine if their local area network is setup for DHCP or Static IP addresses. If static, I'll have to gather their network's Gateway, Subnet, and DNS #s and find an available IP address that we can assign to a device that we'll be shipping them. What I normally have them do over the phone is open cmd, run ipconfig/all then ping xxx.xxx.xxx.250 (since .250 is usually available on most of these NETWORKS) they read me the results and I have everything I need. Since most of what I do is contained on the cmd prompt, I was thinking it would be much easier to have a .bat script (or something) that I could just email them to open, that would gather all of this info in a text file that they could shoot back to me. The problem I was running into is the fact that some of the IP addresses of different customers are 192.168.1.x, 10.100.1.x, etc... and I wasn't sure how to get the .bat to ping whatever set of numbers was listed previously by ipconfig I'm sure there's a more efficient way of doing this, but I guess that's the best way I know. I really appreciate the help! You can isolate output lines from ipconfig /all using the FIND command. Example: ipconfig /all | find "Default Gateway" Then you can use FOR to parse the line to get an IP address and extract the octets and use the first three plus your selected final one in a ping command. Perhaps if you state which line(es) from the ipconfig /all output contains the IP address(es) you wish to use, a simple script can be written. So more information please. Quote from: CassieXoXo on February 17, 2012, 02:52:10 PM A lot of my day in the near future will be spent calling clients to determine if their local area network is setup for DHCP or Static IP addresses. If static, I'll have to gather their network's Gateway, Subnet, and DNS #s and find an available IP address that we can assign to a device that we'll be shipping them.Do you realize there could be both on the network. That is how most networks are setup in the first place. The DHCP server is setup with a range of IP addresses that it can give out to clients that request an IP address. This is called a POOL. One of the reasons for the pool is to maintain control of the network so that other devices like, routers, switches and servers can be allocated static IP addresses that the DHCP server is not stepping on. If you are doing support for your clients networks I would suggest you get a better handle on how their networks are configured by asking them if they know how the network is configured or if they have documentation on how the network was configured. Better yet it would only take a few seconds to remote into their computer as well. You could just ask them to remote into their computer and do your voodoo and be done. Quote from: Squashman on February 18, 2012, 06:33:06 AM Do you realize there could be both on the network. That is how most networks are setup in the first place. The DHCP server is setup with a range of IP addresses that it can give out to clients that request an IP address. This is called a POOL. One of the reasons for the pool is to maintain control of the network so that other devices like, routers, switches and servers can be allocated static IP addresses that the DHCP server is not stepping on. Yes, I realize that many networks are setup that way. However, with many of the networks I'm dealing with, DHCP is disabled altogether. In the somewhat rare case that DHCP is enabled, their network uses .1-.250. Quote from: Salmon Trout on February 18, 2012, 02:47:26 AM You can isolate output lines from ipconfig /all using the FIND command. Example: I was thinking something like the FOR command would work, but I was having difficulty specifying the variables. As I wrote, Quote Perhaps if you state which line(es) from the ipconfig /all output contains the IP address(es) you wish to use, a simple script can be written. So more information please. |
|
242. |
Solve : Application with roots in GAC can't find a dll in path.? |
Answer» This is kind of branching out from a preivous thread. Here is the scenario:
I am not sure why this dll would be different from the others. They are older C++ 6 and VB6 dlls as well. Here is the code for my simple class (based on conversations from my previous post with BC_Programmer)... Code: [Select] Public Function ComToBytes(objName As String, obj As Object) As Byte() Dim PropBag As PropertyBag Set PropBag = New PropertyBag PropBag.WriteProperty objName, obj ComToBytes = PropBag.Contents End Function Public Function BytesToCOM(objName As String, obj() As Byte) As Object Dim PropBag As PropertyBag Set PropBag = New PropertyBag PropBag.Contents = obj Set ComFromBytes = PropBag.ReadProperty(objName) End Function Any suggestions as to why the application won't find my dll, no matter where it resides? You do have control over the C# application in question, correct? Why can't you reference the COM library via the IDE? At the very least, adding a reference to a COM component will generate a managed wrapper for the component. I believe you can do this manually using tlbimp.exe which is part of the .NET framework SDK. Basically, what you end up with is the managed code which uses the unmanaged COM component. The managed code can be installed in the GAC, but the unmanaged code cannot. The GAC-installed wrapper accesses that unmanaged code, however. And it needs to stay wherever it was when it was registered (via regsvr32) You need a managed wrapper for the COM DLL.If you mean to the solution or projects for the calling application, no I don't. So basically, I build the ActiveX dll (VB6 code) and reference it from the .NET 2.0 C# project. When I do that it builds the interop but the it can't be added to the GAC because it has no assembly manifest. If i try "tlbexp.exe MyClass.dll" to build a type library it fails with an error (expected to contain an assembly manifest). This is actually the same error I get when I try to install it to the GAC. I am KINDA baffled. I don't understand why it won't see the dll and use it unless it is in the GAC. If I could this method working I would gladly accept it... It seems crazy to think that I would have to try and implement IPersist and IPersistStream on every class that requires this serialization. Thanks again.I also tried: Code: [Select] tlbimp.exe MySerializer.dll /keyfile:My_KeyFile.snk /machine:X86 to force it into building an assembly-based dll straight from the COM dll. It didn't complain and it built a dll. I registered it, added it to the project, and could add it to the GAC. When I ran the code it made it PAST the previous error and died where it tried to instantiate a class at the line: Code: [Select] MySerialize.SerializerClass serializer = new MySerialize.SerializerClass(); with the error "Retrieving the COM class factory for component with CLSID {95388FE5-87E8-4164-ADA2-E974FA3803FB} failed due to the following error: 80040154."} Not sure if I would call that progress or not... 80040154: Class Not Registered. If the program in question is 64-bit, than it won't be able to instantiate 32-bit components (such as those created with VB). A .NET program/Library will be 64-bit if it is run on a 64-bit system and was built CPU-agnostic (AnyCPU). If the main application is 64-bit, or compiled with AnyCPU, than it will only be able to access 64-bit COM components; which means you won't be able to use the VB6 wrapper method since VB6 cannot compile 64-bit. additionally, if the COM component you want to use is 32-bit, all bets are off and you won't be able to use it at all. only a 32-bit assembly can use a 32-bit COM component, and only a 32-bit Assembly can use another 32-bit assembly, so if you were to change your project to compile to x86, than the main application might not be able to use your library if it is AnyCPU and run on a 64-bit processor. Not sure if this will help:http://blogs.msdn.com/b/junfeng/archive/2007/04/14/genman32-a-tool-to-generate-sxs-manifest-for-managed-assembly-for-registration-free-com-net-interop.aspx Personally I never touch the GAC, or deal with strong named assemblies or any of that, so I'm just sort of groping around in the dark here, myself. It looks like that page is more for creating assemblies that can be used as COM components, and not vice-versa... But it might be that the Interop Assembly needs a Manifest in it to be dependent on the COM assembly. Assuming the problem isn't essentially intractable (getting a 32-bit COM component to be used by a library that is accessed by a AnyCPU compiled assembly) you might have to fall-back on the IPersistStream method. Basically: -VB6 only compiles 32-bit COM components. -A 64-bit Assembly cannot use 32-bit COM components. A 32-bit Assembly can, but... -a 64-bit Assembly cannot use 32-bit Assemblies -VB6 can only use 32-bit COM components; so evidently the COM component in question is 32-bit. Basically you are building a chain- Main Application->Your Library->VB6 Wrapper->COM Component the VB6 wrapper is 32-bit, so Your Library would to be 32-bit, which means that the main application would as well, but you have no control over that, which is where you have issues. Even if you eliminate the wrapper and try to use IPersistStream on the COM component manually, the COM component is 32-bit so you have the same problem. Bit-ness mismatch is really all I can think of to explain this. I really appreciate all of your input on this topic... The primary application is loaded with Interops, so I don't believe it is a 32bit vs. 64bit issue. I believe it is some kind of issue related to things in the GAC needing other things to be in the GAC to function. This morning I wrote a simple WinForm application with a single button. Code: [Select] private VOID btnCut_Click(object sender, EventArgs e) { string str = "Test"; object theObj= Activator.CreateInstance(Type.GetTypeFromProgID("TheObjectData.TheObject")); MySerializer.SerializerClass myClass = new MySerializer.SerializerClass(); Array arr = myClass.ComToBytes(ref str, ref theObj); } All I did here was make sure the VB6 dll was registered and added a reference to it. When the button is pushed, the VB6 class gets instantiated and a method is called returning a proper array. With the other application, I had some components that would break the code during runtime. Then, it was always a FileNotFoundException. If I added the dlls to the GAC those exceptions would go away. So if I could just get this dll into the GAC properly I think it would work. The problem is I don't know what else to try to get the thing in there. Even though the command: Code: [Select] tlbimp.exe MySerializer.dll /keyfile:My_KeyFile.snk /machine:X86 seems to build a GAC-compatible dll straight from the VB6 dll (instead of a type library), I don't think it is really valid. I've never heard of building an assembly dll like this, I just thought I would try it. Gotta be missing something... I found this: http://www.hanselman.com/blog/GotchasAroundPrimaryInteropAssembliesAndTheGAC.aspx Quote Of course the COM Object that you're referring to has to be registered, but the PIA has to be as well. You'll need to call RegASM.exe to create a key in the registry under HKEY_CLASSES_ROOT\TypeLib\{yourclassid}\PrimaryInteropAssemblyName. The value of this key should be the fully qualified Assembly name like: MYDLL, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Some folks call RegASM, others ship a .REG file or create this key during the installation procedure.OK. We can close this one out. I have built an assembly from the VB6 and stuck it into the GAC. I can instantiate the VB6 class and call one of the two functions from C#. I am going to open another thread for the problem I am having with the second function. In a nutshell, the problem was related to not properly building the assembly. This is basically how this had to go down.
Thanks again. what you end up with is the managed code which uses the unmanaged COM component. |
|
243. |
Solve : User defined type to object in VB6? |
Answer» OK, Let's look at my previous question a different way... |
|
244. |
Solve : VB add char after n chars? |
Answer» Hello guys, |
|
245. |
Solve : Batch file installer fail to launch program at the end of script...? |
Answer» I am having a problem with a batch file that does this: |
|
246. |
Solve : copying text from one site and making it jump to another site and input there? |
Answer» My dad is not familiar with computers at all. I put bookmarks on his desktop for all his favorite places. He can click those and get those places, and little else. And finding keys and inputting text is very hard and tedious for him. He thinks I am a pc wizard by my little knowledge, which I am nowhere near. I asked him what I could do to MAKE working with the computer easier for him and his WORK. He is in real estate; he opens up the bookmarked real estate listing page, and wants me to automate the process of taking an address from that page, and having that information automatically input into Google maps page where it shows the picture of the property, and then from there, have the address input into our local county appraisal district site area where it brings up the property's information on that site. He has such trouble typing and opening up multiple pages, that this process, for him, is causing him much stress and many troubles. I want to make his life easier, but I have no programming skills and do not know the first place to start. My thoughts are that there has to be a program, software, or way I can set it up where once he highlights and copies the property address from the original site, it can be transferred, transported, jumped or told to put that information into the Google maps search bar, and have it enter there. Then he could copy the same property address from there and by the same process shoot it over to the appraisal site address search bar and SUBMIT it there. So I guess I am looking for a way to have copied information, jump to ANOTHER website and inputted into an area and submitted , and then repeated at another site. Any help in leading me into the right direction, or detailed instruction, or advice would be greatly appreciated. I REALLY want to help my dad out, and show him I can do this for him. I thought this would be a great place to ask.My best idea would just be to have Google Maps as a bookmarked site. You can highlight and copy/paste information into Google to pull up a map, and from there highlight and copy/paste to wherever you want that information to go. I don't think there is an actual way to make a program pesonally that will do all you are asking. My best idea would just be to have Google Maps as a bookmarked site. You can highlight and copy/paste information into Google to pull up a map, and from there highlight and copy/paste to wherever you want that information to go. I don't think there is an actual way to make a program pesonally that will do all you are asking.Good advice, Darthgumby. I also doubt there is an actual way to make a program that will do all that's being asked for here. So, your advice is right on target. |
|
247. |
Solve : Dll references between VB6 and .NET? |
Answer» OK, here's one...
Obviously, the two dll versions contain the same information. I can't add the reference as suggested in error 1 because it WOULD just wrap it again. Any ideas on something like this? Thanks! |
|
248. |
Solve : VB6 number formatting? |
Answer» If I run the following code: By definition real numbers do not have exact values. When you count by 0.5 you are not saying exactly 0.5, but a number very close to it. So by that definition 0.5 times 4 is not exactly 2, but a value very close to two, but it can not be two as a integer number. I suppose I know what you're getting at, but this is nonsense. Some non-integer real numbers can be represented exactly in a number base, some cannot. 0.5 is a rational number which can be represented exactly in base 10, but not in BINARY (hence the problem). The OP needs to read a good programming book, with particular reference to data types, binary representation, floating point arithmetic, and rounding errors. Salmon Trout, My remark was in the context of Microsoft basic. The NOTATION "0.5" could indicate a value result of a division of an integer. But it might be a real number. In Microsoft Basic it will be cast as a real number and it no longer sis the result of a division of an integer. Unless the programmer did something to force it to another type. There are formats used in MS Basic the keep numbers in a form that is related to an integer. The currency type is such. It is actually a long integer. But when printed or displayed, it is shown as a decimal fraction. Once a number as been converted to a real floating point number, it loses its virginity forever. It no longer is an exact value. By definition real numbers are not exact values, even if they are. In other words, a real number has a component that is not quantized. If the number is quantized, it could be a fixed-point number in either binary or an hybrid number system. Anyway, he can resolve the issue by user either INT(), which truncates, or ROUND(), which rounds off numbers to a given number of decimal places. Code: [Select]If i = 2 Then MsgBox "bla"Could be rewritten as: Code: [Select]If int(i+0.1) = 2 Then MsgBox "bla"Good night. Quote from: Linux711 on March 18, 2012, 10:07:38 PM If I run the following code: Code: [Select]Dim i As Integer Dim j As Double for i = 0 to 5000 j = CDbl(i) / 1000# if j = 2 Then MsgBox "Blah" Next P.S: it's never exactly 2 in the original because 0.001 cannot be accurately represented using floating point. This version attempts to avoid that problem by not incrementing using a INEXACT floating point number. Instead, each iteration increments using an integral value, and that value is used in a division. This is pretty much a scaled integer approach. The problem you were seeing was because of the accumulated imprecision from adding an inprecise floating point representation to itself. Here's another version that might work, but it will probably be slower, because it uses the Decimal subtype of Variant. (It's not so much slow because of the Variant type but because all the Decimal operations are dealt with through software) Code: [Select]Dim i As Variant i=CDec(0) for i = 0 to 5 step CDec(0.001) If i = 2 Then MsgBox "bla" Next i Quote Once a number as been converted to a real floating point number, it loses its virginity forever. It no longer is an exact value.As Salmon Trout just said, some numbers can be represented perfectly in floating point. Most whole numbers are simple to represent perfectly in floating point, as long as the number doesn't require a exponent to represent. Any number that fits in the mantissa will be a perfect representation of that value. The issue here is not that a single floating point value was inaccurate; the Visual Basic runtime works with this- 0.1*2 will equal 0.2 even though the actual values are not equal, because VB intrinsically uses a tolerance value. The problem is in the use of floating point numbers that cannot be accurately represented as accumulators; 0.001, for example- because this compounds the ERROR to the point where the accumulated error becomes significant. Running my older Expression Evaluator (written in VB6) on the expression SEQ(X,X,1,5,0.01) (which creates a sequence of values from 1 to 5 in steps of 0.01) there is no visible error in the output until 1.6, which is output as 1.69999999998 (or something similar) That is the point at which the floating point error "escapes" the built in tolerances of the floating point library in use. Of course, even so, comparing two floating point numbers for equality is typically not a good idea because you cannot be sure of the processes that generated those numbers. Usually, the test could merely take the difference and assert that it is smaller than a given tolerance: Code: [Select]Const tolerance As Double-0.001 Public Function TestEqual(ByRef Value1 As Double,ByRef Value2 As Double) As Boolean TestEqual = (Abs(Value1-Value2) < tolerance) End Function |
|
249. |
Solve : calculate from values in a text file's first column, ":" delimited, bat, VBs, PS? |
Answer» Please help me program the scenario below: Any Progress? Didn't know we were on the clock. The hard part was retrieving chunks of the file for INDIVIDUAL processing. VBScript was a possible solution as it supports regular expressions, but so does Powershell so I went with the latter. Code: [Select]$file = "c:\myfile.txt" $arrTitles = () $arrEmps = () # Load the Job Titles into Array # (Get-Content -Path $file) -match "^[0-9]{1,3}:[A-Z]{1,}\\[A-Z]{1,}$" | ForEach-Object { $arrTitles += , ( [Convert]::ToDecimal($_.split(":")[0]), $_.split(":")[1] ) } $arrTitles.GetEnumerator() | Sort-Object | Out-Null # Load the Employees into Array # (Get-Content -Path $file) -match "^[0-9]{1,3}:[A-Z]{1,}\s[A-Z]{1,}$" | ForEach-Object { $arrEmps += , ( [Convert]::ToDecimal($_.split(":")[0]), $_.split(":")[1] ) } #Do the LOOKUPS # for($j=0; $j -lt $arrEmps.Count; $j++) { for($i=0; $i -lt $arrTitles.Count - 1; $i++) { if( ($arrEmps[$j][0] -GE $arrTitles[$i][0]) -and ($arrEmps[$j][0] -le $arrTitles[$i+1][0]) ) ` { Write-Host $arrEmps[$j][1], "=", $arrTitles[$i][1] } } } Save the script with a PS1 extension and run from the Powershell command prompt. Powershell does not search the current directory for a script so use the .\ pointer if you need to point to the current directory. The first line of code is the file name. Change as needed. Well done, Sidewinder! Excellent! Thanks you sooo much.I just had to finish it... Save with .vbs extension call with cscript.exe //nologo pass input filename as parameter example cscript //nologo Scriptname.vbs input.txt input.txt... Code: [Select]ServerName: KDB2012\ADUsers --------------------- 2:KALDB\Developers 16:KALDB\ProdDevs 20:KALDB\BADATAREADER 25:KALDB\ZADATAREADER 115:KALDB\AREADER 168:KALDB\PREADER 190:KALDB\PWRITER 192:KALDB\READER 257:KALDB\WRITER 261:KALDB\SWRITER 299:KALDB\ITDataProc 316:KALDB\RDevelopment 340:KALDB\ReadOnly ------------------------- 152:Kalvin Rodger 183:Kalvin Rodger 239:Kalvin Rodger 289:Kalvin Rodger The script... Code: [Select]Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set ReadFile = objFSO.OpenTextFile (wscript.arguments(0), ForReading) strText = ReadFile.ReadAll Readfile.Close arrFileLines = Split(strText, vbCrLf) i=3 L=0 Dim LimitList() Do sline=arrFileLines(i) ReDim Preserve LimitList (l) LimitList (l) = sline l = l + 1 i = i + 1 Loop until Mid(sline,1,10)="----------" Dim LimitValues() Dim OutPutText() For j = 0 To (UBound(LimitList)-1) MyString=LimitList(j) arrTokens = Split (MyString, ":") ReDim Preserve LimitValues(j) LimitValues(j) = arrtokens(0) ReDim Preserve OutPutText(j) OutPutText(j) = arrTokens(1) Next Dim LookupCode() For j = 0 To (UBound(LimitValues)-1) ReDim Preserve LookupCode(j) LookUpCode (j) = "If (numval > " & LimitValues(j) & ") AND (numval < " & LimitValues(j+1) & ") Then wscript.echo nameval & " & Chr(34) & " = " & OutPutText(j) & Chr(34) Next ReDim Preserve LookupCode(j) LookUpCode (j) = "If (numval > " & LimitValues(UBound(LimitValues)) & ") Then wscript.echo nameval & " & Chr(34) & " = " & OutPutText(j) & Chr(34) For j = i To UBound(arrFileLines) MyString = arrfilelines(j) arrTokens = split(MyString,":") numval=arrTokens(0) Nameval=arrTokens(1) For k = 0 To UBound(LookUpCode) ExecuteGlobal LookUpCode(k) Next Next output... Code: [Select]Kalvin Rodger = KALDB\AREADER Kalvin Rodger = KALDB\PREADER Kalvin Rodger = KALDB\READER Kalvin Rodger = KALDB\SWRITERViola great my friend.In the interest of accuracy, I have since discovered that the Powershell solution has a serious logic flaw and an improper use of the Sort-Object cmdlet. The script worked in spite of the flaws, but will produce inaccurate results under certain circumstances. A newer and better version is posted below: Code: [Select]$file = Join-Path -Path $pwd -ChildPath myfile.txt $arrTitles = () $arrEmps = () # Load the Job Titles into Array # (Get-Content -Path $file) -match "^[0-9]{1,3}:[A-Z]{1,}\\[A-Z]{1,}$" | ForEach-Object { $arrTitles += , ( ( [Convert]::ToDouble($_.split(":")[0]) ).ToString("000"), $_.split(":")[1] ) } $arrTitles = $arrTitles | Sort-Object {Expression={$_[0]}; Ascending=$true} # Load the Employees into Array # (Get-Content -Path $file) -match "^[0-9]{1,3}:[A-Z]{1,}\s[A-Z]{1,}$" | ForEach-Object { $arrEmps += , ( ( [Convert]::ToDouble($_.split(":")[0]) ).ToString("000"), $_.split(":")[1] ) } # Do the Lookups # for($j=0; $j -lt $arrEmps.Count; $j++) { for($i=0; $i -lt $arrTitles.Count - 1; $i++) { if( ($arrEmps[$j][0] -eq $arrTitles[$i+1][0]) ) ` { Write-Host $arrEmps[$j][1], "=", $arrTitles[$i+1][1]; break } if( ($arrEmps[$j][0] -ge $arrTitles[$i][0]) -and ($arrEmps[$j][0] -lt $arrTitles[$i+1][0]) ) ` { Write-Host $arrEmps[$j][1], "=", $arrTitles[$i][1] } } } Sorry for any inconvenience. I've been prettying up my effort too... Code: [Select] Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") ' Read whole input file at once into string Set ReadFile = objFSO.OpenTextFile (wscript.arguments(0), ForReading) strText = ReadFile.ReadAll Readfile.Close ' Split string into individual lines arrFileLines = Split(strText, vbCrLf) Dim LimitList() Dim LimitValues() Dim OutPutText() ' Get first part into array ' Parsed stored file up to second dashed line ' Start at 3rd line InputLine=3 LimitLine=0 ' Read file lines one by one Do sline=arrFileLines(InputLine) ReDim Preserve LimitList (LimitLine) LimitList (LimitLine) = sline LimitLine = LimitLine + 1 InputLine = InputLine + 1 Loop until Mid(sline,1,10)="----------" ' InputLine now points to first line after dashes DataStart = InputLine ' Get band limit values ' Read each line of first block For j = 0 To (UBound(LimitList)-1) ' Split line into 2 tokens at : character arrTokens = Split (LimitList(j), ":") ReDim Preserve LimitValues(j) ' First token is numerical value LimitValues(j) = arrtokens(0) ReDim Preserve OutPutText(j) ' Second token is text string for that band OutPutText(j) = arrTokens(1) Next ' Process second part of input file For j = DataStart To UBound(arrFileLines) ' Split line into 2 tokens at : character arrTokens = split(arrfilelines(j),":") numval=Int(arrTokens(0)) Nameval=arrTokens(1) ' For each line in second part For k = 0 To UBound(Limitvalues) LineToWrite = nameval & " = " & OutPutText(k) ' This is lower test value lower = Int(Limitvalues(k)) ' If not last line check if number is above this band lower limit ' and below next band lower limit If k < UBound(Limitvalues) Then ' This Is next band lower limit upper = Int(Limitvalues(k+1)) ' Do test If (numval > lower) AND (numval < upper) Then wscript.echo LineToWrite End If Else ' If this is last line just test if number is above limit If (numval > lower) Then wscript.echo LineToWrite End If End If Next Next Not sure why am I getting this: RESULTS ARE OK, but in old script C:\Kaldb\adu.vbs(42, 4) Microsoft VBScript runtime error: Subscript out of rang e: '[number: 0]' in new script C:\Kaleem\now.vbs(53, 2) Microsoft VBScript runtime error: Subscript out of rang e: '[number: 0]' 53: numval=Int(arrTokens(0)) 54: numval=arrTokens(1) Quote from: kdb2012 on March 26, 2012, 04:04:41 PM Not sure why am I getting this: Possibly there is a line in input file not as your description; best thing is to learn scripting and then you can write and fix scripts yourself. Does Sidewinder's script GIVES error? |
|
250. |
Solve : datetime batch file?? |
Answer» we have 3 client computers with a WINDOWS SERVER ,,these computers have joined with the windows server through networking,some times the time will change on the client computers ,i want create a batch file(notepad) for time ,when i double click on the batch the time will be equal with windows server time ,so how i do it?http://technet.microsoft.com/en-us/library/cc758905(v=ws.10).aspxWell, I don't understand why you don't want to use the exact time, which is a feature in most present windows OS PCs with Internet aces. Geek, I believe he is trying to get the client computers that are joined to the domain to sync with the time of the server.You are RIGHT. I mus read his problem. The link you provided should solve his problem. My bad. Code: [Select]net time \\servername /set |
|