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.
| 1701. |
Solve : Being Computer Scientist !!!? |
|
Answer» I love computers very MUCH and want to become a computer scientist.I know JAVA PROGRAMMING and want to know the prerequisites of being a computer scientist.A degree in Computer Science. And you're one more NONSENSE post away from being BANNED. |
|
| 1702. |
Solve : Undeletable file with READ ONLY rights!? |
|
Answer» I needed to have a "if found pls contact owner ..." file on my desktop |
|
| 1703. |
Solve : Batch Saving? |
|
Answer» I have started creating a batch GAME but I do not know how to save, I am relatively new so can you show me the code then how it works? Thanks a lot!You can append an output to a file such as... 2500,1000,50,100,3 Which equals 2500 hp 1000 armor 50 weapon damage min 100 weapon damage max 3 health bottles Or just Set>save.txt And then load: For %%A in (save.txt) set %%A Quote from: shiverbob on November 05, 2014, 09:24:49 AM Or justBut then you would probably want to have a specific prefix for the variables used in the game. You wouldn't want to take the risk of accidentally changing a system variable that had already been changed after you played the game last and before you play it again. |
|
| 1704. |
Solve : Bat File Back Up????? |
|
Answer» I would like to make a .bat file in notepad to COPY a file in a drive to another drive for example... Thank you how would I include sub folders?You would need to use the XCOPY command then. But without further specifics I would not suggest you attempt that YET. BASED on the information you have given so far it sounds like you want to copy the file named file1.txt in all sub folders to one specific destination directory. That would cause the command to prompt you to overwrite the file every time unless you suppressed prompting for an overwrite. But logically it would not make sense to do what I am INTERPRETING at all. |
|
| 1705. |
Solve : Positioning JS with CSS?? |
|
Answer» Hello |
|
| 1706. |
Solve : JS not passing to php? |
|
Answer» Hi, I'm baffled here; the two following statements from my JS <BR>file displays the correct values but the code to enter them |
|
| 1707. |
Solve : function to validate input?? |
|
Answer» I have the below code: |
|
| 1708. |
Solve : Data Analysis? |
|
Answer» Hi, we are doing a PROJECT USING R. We were given two spreadsheets containing horse RACING results and we were asked to predict the FUTURE outcomes using the spreadsheets. Any ideas or help would be greatly appreciated. |
|
| 1709. |
Solve : goto issues? |
|
Answer» You need to define enter at the top of your code. i defined enter at the top but it is displaying everything like i had said before in the previous replyI didn't see it. Overall, your CH looks good. I still think you will do better in Ch rater than batch. Butch is weird. Give me some time to run over your Ch code. If you are going to program this in another language then please report this post and ask the moderators to move this thread to that forum category.Quote from: Squashman on December 02, 2014, 07:48:58 PM If you are going to program this in another language then please report this post and ask the moderators to move this thread to that forum category.My apology for diverting this thread. I look at the C code the OP had and I see not reason to convert it to batch, other than the fact that distributing it is more work. But Ch and Tiny C are freeware programs and can be made available to anyone. Perhaps the OP will express his preference again. Quote from: Geek-9pm on December 02, 2014, 09:21:36 PM My apology for diverting this thread.i would like to go back to using Ch because it is an ok program to use.. and i can work on it at school because it is installed on the computers.. well one class.. i wish the library would have it so i can work on it there. i could pull out a 32bit pc and download Ch to my flash drive and use it off of it because i have the 64bit that i use on my flash drive already.The 32 bit version works on any Windows computer. After finding the error with enter it runs NORMALLY. Ch can be installed on a flash drive and run on any Windows PC. For all piratical purposes it is a portable program and does not need to alter the system environment. Provided you put your source code in the same directory. Glad to hear you school is using an interpreter to teach programming. After about twenty years the schools are now HELPING students learn TOOLS that are relevant to the current state of the art in the commercial world. MODERATOR. Can the thread be moved into programming? Quote from: Geek-9pm on December 03, 2014, 12:58:39 PM MODERATOR. Can the thread be moved into programming?That is what the Report to Moderator link is for.Quote from: Squashman on December 03, 2014, 01:59:38 PM That is what the Report to Moderator link is for.OK. Did it. Quote from: Geek-9pm on December 03, 2014, 12:58:39 PM The 32 bit version works on any Windows computer. After finding the error with enter it runs normally. Ch can be installed on a flash drive and run on any Windows PC. For all piratical purposes it is a portable program and does not need to alter the system environment. Provided you put your source code in the same directory.the 32 bit version wouldn't work on my 64 bit pc... and there is obviously a problem with the code because it is outputting everything at once after I do 1 and then 1 again...(The OP is now doing his game in Ch, a fast interpreter that conforms to C99 rules. His code now is free of syntax error, but has logical errors.) I will check the the 32 bit version of Ch on my other machine. I think it should work. Here is the revised code from the OP. ( sent it via PM) Code: [Select]/*File: interactive story*/ #include <stdio.h> int main () { int house; int forest; int poster; int knock; int thinking; int enter; printf("you are in an open forest west of a big abandoned house.\n"); printf("you can see that the front door is boarded up one window is open\n"); printf("there is a poster\n"); printf("if you want to look at poster type 1 if you want to pass press 2\n"); scanf("%d", &poster); if (poster == 1); { printf("Welcome to the interactive story of idk!\n"); printf("\n"); printf("you can explore a haunted house or a forest in this chapter\n"); printf("\n"); printf("you are in an open forest west of a big abandoned house.\n"); printf("you can see that the front door is boarded up one window is open\n"); printf("if you want to go into the spooky house press 1\n"); printf("if you want to go to the forest press 2\n"); scanf("%d", &house); scanf("%d", &forest); if (house == 1); { printf("you are walking up to the white house.\n"); printf("you hear a noise inside. do you want to knock or enter? 1 for knock or 2 for enter.\n"); scanf("%d", &knock); if(knock == 1); { printf("a big unknown thing breaks down the door and eats you whole. you are dead!\n"); } if(enter == 2); { printf("you open the door and see this tall boney grey thing sitting\n"); printf("on the floor eating something fleshy.\n"); printf("you see a shotgun leaning up against a rocking chair. you are thinking about\n"); printf("picking up the shotgun and shooting it or try to reason with it. 1 for reason or 2 for shoot\n"); scanf("%d", &thinking); if(thinking == 1); { printf("you say hello and asks what he is doing and it says not a word and rips you in two.\n"); printf("bad ending\n"); } if(thinking == 2); { printf("you run and grab the shotgun. the big grey thing turns and looks at you as you blow its head off."); } } } } } Looks like he has too many left brackets. Anybody? |
|
| 1710. |
Solve : im new to c++? |
|
Answer» trying to figure out how i would start this problem welcome back after 3 years missing ....DaveLembke, Alien abduction? Did you mean the OP? OR Are you refereeing yourself? |
|
| 1711. |
Solve : Microsoft.NET Framework for non-programmers? |
|
Answer» Microsoft.NET Framework is a huge program and the Updates are even worse. Is it really necessary for casual Internet users (browsing, downloading, email, Office, etc.)? I have three old XP loaded machines and one Windows 8 downgraded to 7. The old machines really need the space. Is it safe, and how, to remove it? I generally use Revo Uninstaller but that may be too much if there are parts of .NET to leave..Net is required for specific software applications to function properly. I'd leave the .Net alone and look for other methods to reduce data that is taking up space such as purging the browser cache, dumping cookies, temporary internet files, and uninstalling any unnecessary software from the systems. * Before dumping cached browser data be sure you know your passwords to sites etc, as for I have seen people do this before and then realize they forgot their password that they havent used in AGES because the computer browser had it stored and now its gone from system as well as the users memory. Microsoft.NET Framework is a huge program and the Updates are even worse.All the framework versions are <100 MB each. The largest is 68MB or so. Typically you might only need two for most applications to function properly. I find it unlikely that you are in such a case of needing space that you would have to look to deleting system components to get more- particularly since uninstalling the .NET Framework isn't going to recover very much space. It is usually more reasonable to move or delete user files from C:\Users\. The vast majority of data is going to be found there and in larger installed applications. One useful tool I use to track disk space usage is WinDirStat (website). Very useful. If it is okay with y'all, may we go a little deeper with this discussion? What I mean is, what do some of you very experienced Windows OS folks think about upgrading the .Net Framework on our Windows OS units? One example would be on a Vista machine I have there is in the options for updates an option to install .Net Framework 4.5.1 and I am wondering what some of y'all might think about installing it or not? Or, even better, as the OP put it here: Quote Is it really necessary for casual Internet users (browsing, downloading, email, Office, etc.)? Is 4.5.1 necessary for the casual Internet user?For Windows Updates, the "updates" as I understand, apply to installed Framework versions. Sort of like how you will be shown Office updates if you have Office installed. So if it is showing you "UPDATE for .NET Framework 3.5" than you already have that software installed- and an update is available for it. You should install most such updates as they appear in Windows Update. Sometimes later versions will appear as optional updates. For example, on my Windows Vista Virtual Machine I see updates for 2.0, 3.5, and 4.0 in the "important updates" section. I have these installed. However, 4.5.1 is in the "optional" update section, because I don't have it installed. Regarding "Upgrading"- in terms of the actual Framework versions, they aren't 100% upgrading- that is, 4.5.1 is a new version but cannot run every single thing written against earlier versions. It get's complicated, particularly since some applications written for one framework version may work on another version but another program written against the same version might fail to run on that same version (Different applications can require different parts of the framework). The best approach from a user perspective is to install the framework versions as applications need them. Most programs include installers which will install them. If you are seeing updates in Windows Update for 4.5, for example, and you didn't install it yourself, it is likely that you installed a program which uses it. A common example of this is the Radeon/AMD Front-end Driver software, which will install .NET Framework 4.0. Wow, PC_programmer, You list yourself as a "beginner"? Now I (listed as "familiar") have to go back and relist myself. Is there such a level as "pre-beginner"? In defense of my concern; Microsoft.NET Framework 2.0 shows as occupying 301MB and 3.0 at 244MB in my XP system. If there is not a good reason to keep NET, that's equivalent to a program the size of MS Office.As has been mentioned, the .NET stuff does not take a lot of space. But some third-party applications can take over 500 MB. When those applications n are ported to .NET, the overall use of disk space is more efficient. When a numberr of applications allude the same run-time library, there is less duplication of the same material in other libraries. For example, a good floating point library does not have to be very large. But if users what more features and greater precision, the library grows to be larger. Having one large floating point library is more efficient that have five libraries of many sizes and precision. The above idea could be extended to include other kinds of things that go into libraries. Like SQL resources. Sort routines. Matrix multiplication. http://en.wikipedia.org/wiki/Runtime_library At one time it MADE sense to use compilers with program size options. But nowadays users are buying 64 bit systems with 8 GB of RAM and a terabyte of storage. So you can make an argument either way. It HARDLY even matters. If you don't like updates, don't take them. Quote from: kenaudivw2 on December 16, 2014, 10:02:02 AM Wow, PC_programmer, You list yourself as a "beginner"? Now I (listed as "familiar") have to go back and relist myself. Is there such a level as "pre-beginner"? One possibility is that the algorithm that is used to try to estimate the disk space usage is incorrect, this could be the case for the .NET Framework- particular 2.0, which only uses typically 20 or so MB. On XP, I think that algorithm- as detailed in this blog post for the curious, could be to blame. Quote It goes through all the programs on your Start menu and compares their names with the display name of the uninstallable item. It looks for Start menu items which share at least two words with the words in the DisplayName. So based on that explanation, if for some reason the registration information listing the size is missing (This could be due to things like tune up tools, registry cleaners, etc), Windows will guess the size information by looking for the closest match in Program Files. And given that .NET installs to several folders, and "Microsoft.NET" (The one folder in Program Files that seems directly related) isn't always going to be the best match for ".NET Framework 3.5 Client Profile" it could be getting that size information from the wrong folder- and even if it is the best match, matching that folder will instead list the size of every single framework installed. The differing sizes could be each version matching a different folder. Of course, that is just a theory. I note something curious, though- on my XP VM I see .NET 4.0 Client Profile listed at 117MB. This size is registered as the size in the listed location in that post. However, when I look at the size of the proper install location, I find that the actual size on disk is actually around 300MB. Removing a version of .NET you are using won't break anything terribly- you can just reinstall it again if you find that to be the case. Quote Wow, PC_programmer, You list yourself as a "beginner"? Now I (listed as "familiar") have to go back and relist myself. Is there such a level as "pre-beginner"?At some point the forum software was upgraded and that field was not brought forward. I left it at the default because I no longer felt self evaluations were very trustworthy beyond a certain point and there is no way to not enter something. Arguably the more one learns about, the more one learns how much they haven't learned, because of all the PERIPHERY unlearned concepts you find out about along the way. Also when it comes to things like say Graphics Cards I am far more ignorant of specifics and typically defer to the experience of others about whether one Graphics card is going to run better than another. |
|
| 1712. |
Solve : [Help] C# WPF Dispatcher.Invoke (threading)? |
|
Answer» Im trying to use dispatcher.invoke on an if statement to check if a website can work. I keep getting the thread usage warning. Is there any way to FIX this ? I am Currently not good with background workers or threading with wpf. well you could remove ALL the invokes and surround the body in a single Invoke call.How would i do that ? I really suck at using wpf, i only use it for making nice looking apps.WPF has nothing to do with the threading solution, FWIW. I've used WPF once, but I've used the WebClient extensively. I was going to stick exactly what I mentioned (just coalesce it into one invoke). But then I noticed the repetition, as well as the use of DownloadString(), and separated them out. This version is not tested but should work EXCEPTING minor OVERSIGHTS: Code: [Select]public void CheckOnline() { String[] Websites = new String[]{website_1.Text,website_2.Text,website_3.Text,website_4.Text}; StatusBar[] StatBars = new StatusBar[]{status_1,status_2,status_3,status_4} for(int i=0;i<Websites.Length;i++){ String site = Websites[i]; StatusBar statbar = StatBars[i]; String TempFileUse = Path.GetTempFileName(); WebClient useClient = new WebClient(); useClient.DownloadFileCompleted+=(s,e)=>{ Dispatcher.Invoke(()=>{ if(e.Error!=null){ statbar.Foreground = Elysium.AccentBrushes.Red; statbar.Content = "Not Working"; } else { statbar.Foreground = Elysium.AccendBrushes.Green; statbar.Content = "Working"; } File.Delete(TempFileUse); })}; useClient.DownloadFileAsync(site,TempFileUse); } } Basically it just combines each test, since each one simply uses a different status bar and a different website, those are gathered into corresponding arrays. Then the array is iterated over and with each one a new WebClient is created. the DownloadCompleted event is set to the appropriate code to set the color and text, using the EventArgs passed in to determine if an Error occurred, and then delete the temporary file; the WebClient's DownloadFileAsync is then called. Note that each event handler uses Invoke() with multiple-line arguments (in fact, I use multi-line lambda's more than once). If CheckOnline itself is running in another thread (why?) then the initialization logic for the arrays will need to be within a similar Invoke lambda.need help in creating a batch with below conditions. i have abc.txt file. i want to read this file and load header and TRAILER information in xyz.txt file. and i want to accoplish this using batch file. can you please help me in this |
|
| 1713. |
Solve : trying to pass JS to PHP? |
|
Answer» I need for someone to advise how I'm going wrong with passing my |
|
| 1714. |
Solve : Try an Hour of Code? |
|
Answer» If you already enjoy code, you may FIND this amusing. But the real value of this article is the value it has to introduce computer coding to people who NEVER program. |
|
| 1715. |
Solve : Replace Spaces with Multiple Characters Batch Script? |
|
Answer» I am writing a Windows .BAT file which takes user input and creates a VARIABLE from their response. I need any SPACES within their response to be replaced with the characters %20 and then create a variable from the new string. How can I do this? |
|
| 1716. |
Solve : programming help need?? |
|
Answer» i want to BECOME a programmer.what shoud i do.i m stranger.and DONT know anything>START reading...... |
|
| 1717. |
Solve : File Metadata and java? |
|
Answer» In windows xp when you right clicked a file and then clicked properties you could view a file's metadata. It had date created, modified ect. In another tab there was title, author, comment, etc. In windows xp when you right clicked a file and then clicked properties you could view a file's metadata. It had date created, modified ect. In another tab there was title, author, comment, etc. The properties you MENTION are stored in an alternate data stream on the file itself. Alternate Data streams are effectively files attached to the same filename, but as a sort of "subfile". As luck would have it I fiddled about with this a few years ago. I didn't work on actually parsing the data in the properties, I was mostly interested in Alternate Data Streams (and less on specifically what they contained). So Even once you read the SummaryInformation data stream you would need Programmatically, there are three ways to get the Alternate Data Stream information from the file. From a Java perspective it is important to note that ALL of these methods will involve the Win32 API. I can't remember how that is accessed from Java but I remember it being unpleasant. You can either use ntQueryInformationFile to directly QUERY data from the file itself. This is a low level function. If you cannot do that for whatever reason, you can use BackupRead, and read the file as a Backup program would. Files opened with "Backup Semantics" Basically read in all the data for the file, including any alternate Data streams. The fun PART at that point is actually parsing the data and separating the various alternate data stream headers. Loads of fun because it is naturally not documented. I wrote an implementation using ntQueryInformation File in VB6 here, but I doubt it will be very easy to port to Java. and Here is an implementation in the same language which uses the Backup functions. Thankfully, this magic is only truly needed to see what data streams are present in a file. You can OPEN them without special logic... but, unfortunately, only when directly using the Win32API. Java (And .NET, and most languages) complain that the filename is invalid because it contains a colon. (you can specify alternate streams with a colon, such as "readme.txt:Zone.Identifier" but few programs support this.) |
|
| 1718. |
Solve : VB .NET Code Stops Executing? |
|
Answer» I'm having an issue with my Visual Basic .NET code. I've never seen this before. I don't have any sort of threading, so it's just blowing me away. I'm using .NET Framework 4.5 and this is a WinForms app. My code is below, with comments indicating where I'm having issues with. I'm compiling for x86 architecture. I've tried using a WebBrowser HtmlDocument, a WebKit.DOM.Document object, and now using the HTML Agility pack. The objective of this application is to REPLACE the IMVU Silent Room Observer at http://www.imvu-e.com/products/sro/. I'm using Visual Studio 2012 Express. Please ask if you have a question. Thank you in advance! ..objective of this application is to replace the IMVU Silent Room Observer at http://www.imvu-e.com/products/sro/Do you mean you want to compile a windows program to run on a web server?Regarding the code thing, In order to get anything I could actually test I had to basically guess about things like IMVURoom and Rooms. Looks like I guessed IMVURoom incorrectly (I created a class, when it is a structure in your original) but guessed Rooms right (List of IMVURoom). Luckily I was able to find the Agility pack right in NuGet so I then just had to staple a few controls onto the form and guess what their actual type was, but there were only 2 that I saw at the time. After making the change and replacing my Class version of IMVURoom with the struct and initializing the byte array, it now seems to load the data up fine but crashes at the attempt to clear the Room occupants, since the list is nothing. Fixing that, it crashes at the attempt to get the Element by the ID. looking at the Data result, it's cut off. Was it too short? So I used Response.length and doubled it in both places. Still cut off in the same location. I was able to fix that by replacing that segment with a StreamReader and using it to Read to the End of the Stream. I'm uncertain as to why, specifically, that fixes it, though. The bigger PROBLEM is that all the Elements you retrieve are going to be empty because they are intended to be populated by client-side javascript, which an HTML parser isn't going to run. Here is the changed version of that function anyway. I don't know how you might fix the issue where the links and other information are filled out by Javascript code, though. Code: [Select]Friend Sub FetchRoomMeta(ByVal roomtag As String, Optional ByVal silent As Boolean = False) If Not silent Then : Me.lblGettingRoomData.Visible = True : End If roomtag = roomtag.Replace("http://", "").Replace("https://", "").Replace("www.", "").Replace("imvu.com/rooms/", "") Dim r As New IMVURoom() r.TagName = roomtag r.URL = "http://www.imvu.com/rooms/" & r.TagName Dim req As Net.HttpWebRequest = Net.HttpWebRequest.Create(r.URL) req.UserAgent = "IMVU-SROR/" & My.Application.Info.Version.ToString() Dim res As Net.HttpWebResponse = req.GetResponse() If r.Occupants IsNot Nothing Then r.Occupants = New List(Of String) End If Application.DoEvents() Using sr As New StreamReader(res.GetResponseStream()) Dim httext As String = sr.ReadToEnd() Dim resp As New HtmlAgilityPack.HtmlDocument resp.LoadHtml(httext) r.Occupants.Clear() r.FriendlyName = resp.GetElementbyId("rm_name").InnerHtml r.LaunchURL = resp.GetElementbyId("join_link").Attributes("href").Value r.MaxOccupants = Byte.Parse(resp.GetElementbyId("rm_participants").InnerHtml.Split("/")(1).Trim()) For Each n As HtmlAgilityPack.HtmlNode In resp.GetElementbyId("participant_table").FirstChild.NextSibling.FirstChild.ChildNodes If n.Name = "tr" Then r.Occupants.Add(n.FirstChild.InnerHtml) End If Next n For i As Byte = 0 To Rooms.Count - 1 Step 1 If r.URL = Rooms(i).URL Then Rooms.RemoveAt(i) Rooms.Insert(i, r) End If Next i End Using If Not silent Then : Me.lblGettingRoomData.Visible = False : End If End Sub Upon doing a little more digging, I've discovered the Javascript variable on Line 668 (may vary) called roomInfo. If I can DIRECT the parser to the correct script element, extracting it should be a piece of cake. Thank you for your help! I'm going to mark the issue as solved. |
|
| 1719. |
Solve : Batch file to check the folder size? |
|
Answer» @sun_os: c:\document and setting\administrator: 10,182,572,281 MB Are you sure the 10,182,572,281 represents MB (which is an awful lot) or just bytes (more reasonable) It turns out that 10,182,572,281 bytes is 9710.8577 MB. Imagine that! The file size for both the onscreen display and the csv line are computed the same way. I cannot reproduce the error. Need more info. @nuckinfutz : Please start your own thread. This marathon thread has gone on for 29 posts with no end in sight. Your post is only complicating things. Hi Sidewinder, How can I start the New Thread here? Could you tell me, is that mean send you the personal messages ? I copy your code and run cscript //d check.vbs , check with csv format which is not match the console information Quote from: sun_os on July 20, 2010, 07:37:35 AM How can I start the New Thread here? That was for nuckinfutz who tried to hijack your thread. Quote from: sun_os on July 20, 2010, 07:37:35 AM Could you tell me, is that mean send you the personal messages ? No. I very rarely even check if I have messages much less answer them. I prefer to post solutions that everyone can read. Quote from: sun_os on July 20, 2010, 07:37:35 AM I copy your code and run cscript //d check.vbs , check with csv format which is not match the console information I cannot reproduce your results: Quote C:\Temp>cscript untitled.vbs Unless I'm missing something, the console and the csv file matches. The only difference is the format of the output, but the data is the same. You wanted a csv file (comma separated values). CSV files are useful when you need to input the data into a spreadsheet or database program. They are also easy to parse. Hi I capture the screen shot for your reference C:\temp>cscript check.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Please enter directory name: c:\downloads C:\Downloads: 5,203,235,307 MB C:\temp>type disk* 系統找不到指定的檔案。 C:\temp>type dir* DirSize.csv C:\Documents and Settings\Administrator,9710.8577 C:\Downloads,4962.1919 C:\Downloads,4962.1919 C:\temp> That is output ThanksPlease check your code. I'm not understanding any of this. It appears the line that produces the console output has a problem. The line produces the console output: Quote WScript.Echo f.Path & ": " & FormatNumber((f.Size / 1048576),4,,TriStateTrue) & " MB" This line produces the CSV file output: Quote fs.WriteLine f.Path & "," & Replace(FormatNumber((f.Size / 1048576),4), ",", "") Also check this line: Quote Set fs = fso.OpenTextFile("c:\temp\DirSize.csv", ForAppending, True)The above line shows the path to the CSV file. If you changed it that's fine as long as you know where the CSV file is. If this doesn't turn up anything, please post the script you are using. If you made any changes leave them in. Need to see the actual code that runs. Hi Sidewinder I run the same script on the another workstation, it is no problem on the size checking. I think something wrong on my workstation. Last time, I request to check the directory size, the code is FOCUS on that. If the script can let me check the size of drive or directory folder option. I need to use compond condition if....if.... then....elsif condition Thanks Quote from: sun_os on July 20, 2010, 08:59:56 PM Hi SidewinderGlad to see you got the script working. Not sure what could have caused the error on you other machine. VBScript is very forgiving where objects and variables are destroyed when the script ends. An exception is application objects (Word, Excel, etc) where they must be Quit, otherwise you'll find them in your task list long after the script ends. Quote Last time I have the problem on the script to do the check the size, but I get message from my boss, he needs to check the case is run the script can show all the size of directory at once. Not sure what you're asking. I tweaked the script to display the subfolders. I also added a unit of measure to the CSV file so the numbers make more sense. Be aware that the FileSystemObject recurses the directory tree when computing the size property. Each folder size includes all of it's subfolders. The numbers you see are correct but may appear inflated. It's possible to retrieve the files from a recursive folder search, but the total size of the files will probably not add up to the size of the folder unless the folder has no subfolders. This would be easier in BATCH, however batch arithmetic only deals with integers. This can lead to some wildly inaccurate results. Hey! 700k bytes here, 700k bytes there, and pretty soon you're talking about some serious real estate. Code: [Select]Const ForAppending = 8 Set fso = CreateObject("Scripting.FileSystemObject") Set fs = fso.OpenTextFile("c:\temp\DirSize.csv", ForAppending, True) Do WScript.StdOut.Write "Please enter directory name: " strFolder = WScript.StdIn.ReadLine If fso.FolderExists(strFolder) Then Exit Do Else WScript.StdOut.Write "Invalid Directory ... Try Again" & vbCrLf End If Loop Set f = fso.GetFolder(strFolder) WScript.Echo f.Path & ": " & GetEditSize(f.Size) fs.WriteLine f.Path & "," & Replace(GetEditSize(f.Size), " ", ",") GetThePaths(f) fs.Close Sub GetThePaths(Folder) For Each Subfolder in Folder.SubFolders WScript.Echo SubFolder.Path & ": " & GetEditSize(SubFolder.Size) fs.WriteLine SubFolder.Path & "," & Replace(GetEditSize(SubFolder.Size), " ", ",") GetThePaths Subfolder Next End Sub Function GetEditSize(intSize) If intSize => (1024*1024*1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024*1024)), 4,, TriStateTrue), 2) & " TB" ElseIf intSize => (1024*1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024*1024)), 4,, TriStateTrue), 2) & " GB" ElseIf intSize => (1024*1024) Then GetEditSize = Round(FormatNumber((intSize/(1024*1024)), 4,, TriStateTrue), 2) & " MB" ElseIf intsize => 1024 Then GetEditSize = Round(FormatNumber((intSize/1024), 4,, TriStateTrue), 2) & " KB" Else GetEditSize = intSize & " Bytes" End If End Function I'm sure we'' here from you again. Quote from: Sidewinder on July 21, 2010, 08:21:39 AM batch arithmetic only deals with integers. ... and runs out of steam at 2 G (32-bit signed integer) Hi Sidewinder, Great ! I 'm appreciate your helpful and support the code. I can get the result what I want. Are you programme ? You are specialist for vb script. Except for Microsoft link, what is other link for script which is useful for beiginner. VBscript. Batch , Shell script Thank you very much ! Quote from: sun_os on July 24, 2010, 04:06:43 AM Are you programme ? You are specialist for vb script. I'm retired now after being in IT my entire career from EAM operator to systems administrator. Currently I run a small business in the local village helping some of the small business owners with their software needs and day to day PC operations. For batch CODING I always recommend this site For VBScript check out this tutorial Also do a search on your hard drive for a file named script56.chm. This is a VBScript reference with lots of examples. Never leave home without it. If you can't find it on your hard drive, you can download it from here Good luck. I come from H.K. and work for system engineer. My employment is only for the three months CONTRACT. The IT in H.K. is no long term career, company prefer to recruit the outsource to support the inhouse I.T operation. I have a dream to start the own business but it is a lot of competitor in Hong Kong. The profit margin is not very good in Hong Kong. May I know where are you living ? Enjoy your life and retirement ! |
|
| 1720. |
Solve : Batch move files that are consecutive to the same folder USING NOTEPAD? |
|
Answer» I am trying to batch move consecutive named files with the same extension to a particular folder. The various special features that I'm looking forward to in a file manager are Dual panes, Tabbed interface, Bookmarks, History, Archive handling, Advanced File Search, MultiRename, Folder Size Enumeration, Folder COMPARE and Synchronize, FTP support, File VIEWER, File sorting, File splitter, Filtered view, Keyboard shortcuts, Easy access to system folders and more.He goes on to mention FreeCommander XE Unreal Commander Nomad.NET Multi Commander Master Commander Just saying that it might save you time and bring you a new tool. Now somebody else will show you how in batch. You can use wildcards other than the simple star, dot, extension, (like *.mp3). For example, ASSUMING that your music file names just have these character groups A3_1, B4_1 in one place only you can build a wildcard like this move *A3_1*.mp3 [some folder] move *A4_1*.mp3 [some folder] move *B5_2*.mp3 [some folder] move *C6_41*.mp3 [some folder] etc Or if the only place you have a number followed by an underscore is here: violin_A3_1_forte_arco-normal.mp3 then *3_*.mp3 would find all the 3s in that place. Hi Here is a starting batch file to test, just for searching : Search_MP3_Pattern.bat Code: [Select]@echo off Title Searching mp3 files with special pattern . . . Color 9E & Mode con cols=75 lines=3 set "Master_Folder=C:\users" set "Pattern=*_??_?_*.mp3" set "LogSearch=%~dpn0.txt" echo( echo Please wait ... Searching "%Pattern%" files is in progress ... Where /R "%Master_Folder%" "%Pattern%" /F >"%LogSearch%" 2>&1 start "" "%LogSearch%" |
|
| 1721. |
Solve : Tryting to clone accidentally ruined my computer!? |
|
Answer» I am having a panic attack as I just lost 1 tb of my files. |
|
| 1722. |
Solve : NOTEPAD PROBLEM, PLEASE HELP!!!? |
|
Answer» I want to create a BAT file in Notepad that would automatically create a VBS file ( with command msgbox"blabla" , voice command, etc ) in a folder that i choose, by COPY CON command... copy con hello.vbsDoes just what you asked it to do. Are you using voice recognition software inside of notepad? Please explain.I'm not using ANYTHING...I want to make a bat file that will create vbs file automatically,but the problem is that it runs cmd and stops at COPY CON,WITHOUT making a file...Quote from: AMS on June 28, 2010, 03:30:39 PM it runs cmd and stops at COPY CON,without making a file... That is normal. CON is the keyboard INPUT stream. When the batch "stops" it is WAITING for you to TYPE msgbox.vbs (with your fingers) and then do CTRL-Z then ENTER. You are doing this the wrong way. This is how a batch file would do it: Code: [Select]echo msgbox "Bla!">hello.vbs Tnx, a lot!Just one more question, how can I enter a new line for that vbs? For example,if I want to enter command StrText="thank you" set ObjVoice=CreateObject("SAPI.SpVoice") ObjVoice.Speak StrText > creates/overwrites >> appends echo StrText="thank you">my.vbs set ObjVoice=CreateObject("SAPI.SpVoice")>>my.vbs |
|
| 1723. |
Solve : Using Solver to make combination in excel? |
|
Answer» Hi I'am using solver tool in order to MAKE combination from various payments to reach a GIVEN total of payments by using some of those payments, solver automatically identify which payments should be CONSIDERED to make the combination, However when I take large NUMBER of payment the solver tool is keep running until I kill the task from task manager. Is there any way to solve this issue.? Thanks |
|
| 1724. |
Solve : question on some programs I have loading on start? |
|
Answer» Thank you for your HELP. I have been without my own computer since it crashed Right now on a loaner |
|
| 1725. |
Solve : Java - having my classes send an ActionEvent? |
|
Answer» So I've been working on something. Anyways I was wondering how I can make my class throw its own action event to the class its implemented in: When either the slider or the text FIELD is updated. |
|
| 1726. |
Solve : How do I automatically kill a process that is dead but listening?? |
|
Answer» How to automatically kill a PROCESS who is no longer active in ''ResourceMonitor/Network'' ?but which still exists,when i type TASKLIST i can see the process there,but my ''tool.exe'' is not active anymore.The process can still be SEEN in TASKLIST,does anyone have an idea how to automatically SHUT it down but only when he has no activity anymore!anyone knows a tool or a .BAT who can do something like that? thank you. |
|
| 1727. |
Solve : Word VBA to find x,y cordinates of selected range of text (Start and End)? |
|
Answer» I am LOOKING for help with a MS WORD VBA code that will run in a macro to find the x and y COORDINATES of selected range of TEXT. |
|
| 1728. |
Solve : Micro Controller? |
|
Answer» Hello again. My friend would like to know if there is any programming languages that can be use with the MICRO controller. Like c, c#, c++, java, java script, ruby, python, assembly, html 5? My friend Why can't your friend create an account and ask their question themselves?General reference: http://www.popularmechanics.com/technology/how-to/software/arduino-alternatives-5-microcontrollers-you-should-know#slide-1 Quote Arduino Alternatives: 5 Microcontrollers You Should KnowFor almost all of these, a SIMPLE for of the C language is used. But you have to have the specific library for the target machine. I don't know why he can't but i think he won't. Any way i am sorry for the spamming I was not paying attention. Html was thrown out there because it was just some random language I could think of. Thanks for the replies though.You can program MCU even in C# (.NET Micro Framework) if you want. |
|
| 1729. |
Solve : how i can be a programmer? |
|
Answer» In real world programming C++ is used as part of a project. It is never a full solution to an application. I'm SURE BC will correct me if I wrong, but if i remember right almost of DOS and a good part of the first several windows versions was written in C. DOS was ASM (IIRC), but Windows was and still is mostly C. BUT, that's off-topic. recall, once again- he said development tool. Windows is an Operating SYSTEM, not an Application. the choices for writing Windows were pretty much either C or ASM, simply because of the low-level nature of an Operating system. DRIVERS, kernel mode, etc. Quote from: Geek-9pm on July 04, 2010, 08:35:19 PM The academic community ignores some of the day to day tools used in the real world. Yeah, I've always found that sort of humourous. academic circles play around in Scheme and Smalltalk, and those almost never find their way into use outside of academia.Quote from: rthompson80819 on July 04, 2010, 08:14:24 PM I'm sure BC will correct me if I wrong, but if i remember right almost of DOS and a good part of the first several windows versions was written in C. No. They both were written split-octal cuneiform on clay tablets. Later translated to paper tape. |
|
| 1730. |
Solve : Computer is crashing? |
|
Answer» My computer has been CRASHING since I bought it early this year. I have kept the drivers up to date and have recently been doing whocrashed REPORTS. The crashes occur mainly when I am gaming or have the game tabbed out. This even occurs with games my computer can easily run such as LOL. |
|
| 1731. |
Solve : PERL on Windows with Metacharacter in PathName? |
|
Answer» I have a Windows share of the format \\sharename\directory$\subdir. In PERL, when I try to read the directory, it STOPS right before the $ sign, and truncate the rest of the pathname. I also tried putting a backslash before the $ sign, and still the same issue. Any ideas how to handle this? |
|
| 1732. |
Solve : Bitmap editing vb.net? |
|
Answer» I have a bitmap in runtime. I WANT to ADD about 40 pixels of white on the left. how can i do that without a pictureboxCouldn't you just OPEN it in MSPAINT and do that; then re-import? |
|
| 1733. |
Solve : batch win7 problem copy/rename? |
|
Answer» hello everyone! |
|
| 1734. |
Solve : Writing a Test Plan for Java Programme? |
|
Answer» HEY guys I'm doing an assignment and it's due tomorrow. Anyways, we are finishing the touches here and there but I have no IDEA how to do a 'Test Plan' for our java programme. Does anyone have a clue on how long it has to be and what should be written? Thanks. I manage to find these two document, one is very detailed and the other one is short and simple but I'm not sure if it does/does not match our the standards for a 'Test Plan'. http://cdn2.softwaretestinghelp.com/...estingHelp.pdf http://www.computing.dcu.ie/~davids/...ieee829mtp.pdfHow a PROGRAM is tested depends strongly on what the program does. Neither of your links work, but in general, you want to cover expected and unexpected inputs, which seems sort of obvious. For expected inputs, verify that any result is correct. For unexpected inputs, you want to test corner CASES and extremely large or small values, or values that are the wrong data TYPE (strings being entered for numeric inputs, for example). |
|
| 1735. |
Solve : Schedule Macro Execution - Outlook 2003? |
|
Answer» I'm currently trying to make a tedious task I have to do daily much easier, and I figured I may as WELL attempt to fully automate it. Thank you so much! Cool! Glad I could help Sorry, I know this is a little bit of a sidetrack, but it is still relevant to this scenario. The code works fine, but I created this code: Code: [Select]Dim Item As Object Dim ns As NameSpace Dim Inbox As MAPIFolder Set ns = GetNamespace("MAPI") Set Inbox = ns.GetDefaultFolder(olFolderInbox) For Each Item In Inbox.Items If TypeName(Item) = "MailItem" Then If Item.Subject = "Kill Timer Macro" Then Call DeactivateTimer SendMessage "Macro Process STOPPED", "", Item.SenderEmailAddress Item.UnRead = False Item.Delete Else If Item.Subject = "Timer Running?" Then If TimerID <> 0 Then SendMessage "Is Timer Running?", "Yes, the timer is currently running.", Item.SenderEmailAddress Else SendMessage "Is Timer Running?", "No, the timer is not currently running.", Item.SenderEmailAddress End If Item.UnRead = False Item.Delete Else If Item.Subject = "Reset Timer" Then If TimerID <> 0 Then Call DeactivateTimer Call ActivateTimer(10) SendMessage "Timer Reset", "The timer has been reset to check every 10 minutes", Item.SenderEmailAddress Item.UnRead = False Item.Delete End If End If End If End If Next Item End Sub as a means of controlling the timer remotely (I have the timer set to kick everything off between midnight and 1 AM). However, when I send the message to the email account to deactivate the timer and then I send the message to see if the timer is still running, the macro responds that it is still running. Do you know why this occurs? Thanks. -southpawWhen you ask wether the timer is running, you are testing wether the TimerID value is 0, but when you deactivate it the TimerID is NEVER set to zero. I feel like such an idiot. Thanks again!Would you recommend setting the value to 0, or is there another way I can do it? (sorry about all of this...)Quote from: southpaw63119 on July 21, 2010, 12:15:23 PM Would you recommend setting the value to 0, or is there another way I can do it? I'd recommend setting it to zero in the DeActivateTimer() routine (after the call to KillTimer()). Quote (sorry about all of this...) Don't be silly! you're here for help, honestly I felt bad that I couldn't help as much before and you were just posting all by your LONESOME (I'm not very familiar with the Outlook object model) |
|
| 1736. |
Solve : Batch, Replace file if newer? |
|
Answer» HELLO All, Just like the topic states, I am trying to run a batch that will backup a certain file. However at times when the backup runs, the file to be copied is older than the file it will replace, in this case, I would want it not to replace the newer file with the older one. I have attempted the FC command however that seems to be more trouble than help. If someone could show me an example of how to compare file date (and time if possible) then replace as necessary, I would greatly appreciate it. Thanks in advance.First of all, can you provide a copy of the key part of your batch file? Both the COPY command and the XCOPY command have switches to do just what you asked. Unless I'm mistaken, you can just go to the command prompt and type /? After either of those two commands and get a list of options available. But let me ask you why don't you use a standard utility that does exactly what you want with a simple command structure? And why do it at the command prompt? Certainly, let's hope this doesn't further complicate the problem. My CURRENT CODE: Code: [Select]@ECHO OFF TITLE Borderlands Character Backup ECHO Initializing... XCOPY "C:\Users\YourMother\Documents\My Games\Borderlands\SaveData\*" "F:\BackUp\Borderlands\Saves" /y /f /e ECHO Process Completed. The main ISSUE is that it doesn't compare the files date/time before just copying. If I am supposed to use the /D switch with xcopy, what would be the proper syntax for this case? The reason I run this in a batch is for its simplicity and versatility, I can put it anywhere, its standalone and requires no other apps, besides cmd ofc.This is what is says:Code: [Select]/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. Well, did you try this? Code: [Select]XCOPY "C:\Users\YourMother\Documents\My Games\Borderlands\SaveData\*" "F:\BackUp\Borderlands\Saves" /D /y /f /eWell I certainly tried /d:(date) but it had not occurred to me to leave the COLON and date off entirely. I have since tried that, as per your advice, and it works. Thanks again, the cmd help is misleading at times. You can mark this solved. |
|
| 1737. |
Solve : Is this batch code correct?? |
|
Answer» Code: [Select]SET dd=%date% %Time% SET /A ex1=%today%-1 minuses the current day by 1, making it yesterday. This is not possible when using dates. If the current day is 01 the outcome will be 0 and if the current day is 08 or 09 Set /A will fail because it will 'see' the date as Octal (base eight), in Octal 8 and 9 are invalid. Also, if today is the first day of the month and you want to get yesterday's date, the month and possibly the year must be decremented as well as the day. e.g. (Based on a date format of dd/mm/yyyy) Current date = 01/01/2010 Current date -1 = 31/12/2009 and Current date = 01/03/2010 Current date -1 = 28/02/2010 To manipulate dates and times I suggest you consider VB scripting. Below is a small script combining batch scripting and VB scripting which will reduce the date by one day. Code: [Select]@echo off setlocal cls set vbs=%temp%\vbs.vbs > %vbs% echo WScript.Echo DateAdd("d",-1,Date) for /f "tokens=* delims=" %%a in ('cscript //nologo %vbs%') do ( set newdate=%%a ) del %vbs% echo Newdate=%newdate% exit /b Hope this helps.Ah, wow. I wasn't even thinking I guess. Well, this definitely helps, I don't know a single thing about VB or VBS, but I'll see what I can do. Thanks Dusty. |
|
| 1738. |
Solve : determine file type? |
| Answer» my table CONTAINS both URLS(http://) and email addresses. Using PHP, I WANT to take different actions depending on the current record and dont have a clue. any ADVICE? THANKS | |
| 1739. |
Solve : how to insert new menu when i right click mouse?? |
|
Answer» I got MANY software to send using DOS prompt, for example : copy c:\a.exe lpt1 |
|
| 1740. |
Solve : *TIME SENSITIVE*vba scripting for inexperienced? |
|
Answer» This is a snippet of what i NEED. I need the highlighted cell on "moved" to push to "inventory" SINCE it has n/a meaning its not present currently. Then on the inventory list, i need my f row (LOCATION) to automatically update if it doesnt match with g(move). Then i need "inventory" to automatically delete if row c on "load" and row d on "inventory". Whatever vba you provide me, i need to work for to 5000 rows on each sheet. I will be your best freind if you can HELP me. I do not know anything about vba so if a quick copy paste can be provided id be in your debt |
|
| 1741. |
Solve : C++ output screen as text? |
|
Answer» How we can SAVE TURBO C++ OUTPUT screen (outrut)as text FILE for printing?[color=][/color] |
|
| 1742. |
Solve : Free C/C++ Compilers & Interpreters? |
|
Answer» Yes, you can use an Interpreter for C and C++ for some applications. With this suite, you can develop programs for the desktop and mobile versions of Windows as well as ANDROID. The C++ compiler appears to support most of ISO C++11 and some of C++14 ... Visual Studio is available for both Windows and Apple systems. Looked at the site you LINKED. I do a lot of quick "programming for console" programming in C++ with Bloodshed Dev C++ and saw it listed there... However I had found some interesting bugs using it. I came across Eclipse C++ IDE when playing with C++ with wanting to program for Linux Mint. It also is available for Windows. I havent learned all the features it has, but have done some small programs with it to learn how to use tip of the iceberg of features is has. Trying to get myself away from Bloodshed Dev C++, but after using it for so long its fluid in its use and I like its layout which reminds me of Bordland 5.02 C++ and Microsoft VC++6.0 which is what I ORIGINALLY coded on. https://eclipse.org/cdt/ I have played with Visual Studio since 2008, but not sure what it is about it, but it doesnt keep my focus as an IDE for my programming use. I think it is similar to my DISTASTE for Windows 8.x and newer and liking Windows 7 and older desktop layout and its more of where if I forced myself to like it, maybe I would come to liking it. I have actually only used Visual Studio Express when using the Books with DVD learning C# and tinkering with Visual Basic which I dabbled with since VB6. It still feels foreign to me and so I only with with it when I have to, such as when I am working with someone elses open source code that was built using it and was written specifically for .NET Framework implementation. |
|
| 1743. |
Solve : Random name generator, save names already called and work with probability?? |
|
Answer» Hello, |
|
| 1744. |
Solve : Quick Interview VIA Email for Anybody working in the CS or CIS field Please help? |
|
Answer» Hello! I am currently a student at Ball State UNIVERSITY and have declared my major as CIS. I was wondering if there is anybody with a CS os CIS DEGREE that I could email some questions to RELATING to their work EXPERIENCES. I will try to keep them as simple and quick as possible to not take up too much of your time. I dont have many connections yet in this field and really need somebody to help me with my interview project. Thanks in advance and if you are willing to help PLEASE leave an email below i can reach you at or email me directly at [emailprotected] Thanks again! |
|
| 1745. |
Solve : DVD Player Game Programming? |
|
Answer» The WIKIPEDIA STATES (in 2011) " Programming interfaceA virtual machine implemented by the DVD player runs 'bytecode' contained on the DVD. This is used to control playback and display special effects on the menus. The instruction set is called the Virtual Machine (VM) DVD COMMAND set. There are 16 general parameter REGISTERS (GPRM) to HOLD temporary values and 24 system parameters (SPRM). As a result of a moderately flexible programming interface, DVD players can be used to play games, such as the DVD re- release of Dragon's Lair, along with more SOPHISTICATED and advanced games such as Scene It, all of which can be run on standard DVD players." |
|
| 1746. |
Solve : customizing a command? |
|
Answer» i want to run a program, when i type a command in the cmd prompt. i want to attach my program to echo command ..... MAYBE it's me but I'm not understanding what you're trying to accomplish. Why do you want to attach your program to the echo command? Echo is an internal NT cmd processor command. When a command is entered at the command line, the processor first checks it's list of internal commands, then the current directory, and finally the directories listed on the path environment variable. The search also includes the extensions from the pathext environment variable if the command is external from the processor. As soon as a match is found, the command is run. If no match is found you get an error message. If you CREATE a file named echo.bat, the only way to get it to run would be to use a fully qualified file name which will override the normal NT search sequence. If you create a file named echo with no extension, even with a fully qualified file name, the processor will not find the file (see above) and throw an error. Duplicating Microsoft command or utility names is not considered BEST practice and will produce unpredictable results. i am actually working on alternate data streams, so i want to attach a program that restricts the size of alternate data streams to the commands that are used to create them. thanks for responding to my post how to get the fully qualified names of the commands that i need Quote from: sharath.chandra.v on July 12, 2010, 04:07:33 AM how to get the fully qualified names of the commands that i need Knowing that you are working with alternate data streams is an important piece of information. Why didn't you mention that in your first post? ADS is a tried and true method to hide malicious code. It's very effective because it does not change the file size. It would help to know exactly what you're trying to accomplish. You mentioned the echo command, but the executable instructions, like all NT internal commands are located within the interpreter code itself and there is no external file to execute. The other day I was told I was "an hour late and a dollar short". Maybe I am slow on the uptake, or perhaps just being cautious. thanking you once again i have a program in cpp which can find out the size of the alternate data stream. i want to check the size of alternate data stream, when a command related to ADS creation is used. only if the size is less than 2k, the command should work, else it should show error "size of ADS cant exceed 2k bits" . thus i want to restrict the size of alternate data stream is this implementable if so, what is the way of implementing my logic. Quote i want to check the size of alternate data stream, when a command related to ADS creation is used Not sure what commands are related to ADS creation. You seem to want something that will monitor the size of the ADS in real time. I couldn't find anything on Google, but perhaps you might. It might be possible to monitor a directory, and when a file is created or modified your program would kick in. This would be after the fact and there would be no way to prevent the ADS from exceeding 2K. It could only alert you to the size of the ADS. It is also possible to monitor when a process starts, however NT internal commands run within the cmd shell. It is very easy to create an ADS with the echo command, but Windows only sees the processor program (cmd.exe). Hooking user code into the NT processor is beyond my capabilities. Good luck. Quote from: Sidewinder on July 14, 2010, 06:39:59 AM Not sure what commands are related to ADS creation. You seem to want something that will monitor the size of the ADS in real time. I couldn't find anything on Google, but perhaps you might. Only way to "properly" restrict the size of Alternate data streams would be with a filesystem driver. Even a user-mode program build in FindFirstChangeNotification() or RegisterChangeNotification() functions won't catch everything. writing a driver is not something you do in a weekend to pass the time. At least, not something like this. Secondly, it is stated: Quote else it should show error "size of ADS cant exceed 2k bits"First, it can. second, 2k bits is 256 bytes, which isn't very much data at all. lastly, why would you want to restrict the ADS size in the first place? the moment you right-click on a text file or batch file or nearly any document Explorer writes a DocumentSummaryInformation Stream to the file, and that usually EXCEEDS even 2K. Quote i have a program in cpp which can find out the size of the alternate data stream. you have been saying alternate data stream, as if one, and only one, can exist. a file can have any number of alternate data streams. the size of them can be retrieved using the backupread function and reading the filesystem structures of the file itself. A more security-friendly (backupread requires BACKUP privileges, which is usually only the administrator) method is the ntQueryInformation file the best method is that with Vista and higher you can look at streams as easily as you look at files- there is now a FindFirstStream and FindNextStream set of functions. Whatever the case, as sidewinder mentioned, you aren't going to be able to "hook" the echo command, and even if you did, that is hardly the only way to restrict the size of an alternate data stream. |
|
| 1747. |
Solve : Remote stop service? |
|
Answer» Hi All, |
|
| 1748. |
Solve : I need to determine an unkown encoding of a .XLS file.? |
|
Answer» I am working on writing a python(3) script to take data out of an xls file, and place it in an sqlite database. The xls file is downloaded from the Internet, and encoded in a way I haven't been able to get to work with the xlrd library. Assuming the file is intentionally corrupted (100% reproducible)Where did it come from?The working par t of the script, fills out a couple webforms, and downloads the xls file using beautiful soup. This is the part that does it: Code: [Select]request = browser.session.get(myURL, stream=True) with open(path + os.sep +"test.xls", "wb") as output: output.write(request.content) output.close() Quote Assuming the file is intentionally corrupted (100% reproducible)Sorry for not being clear to what is happening. So the file that my code downloads, matches the file that I can download using Firefox. I know the xls file is generated by some webservice. That xls file I assume is corrupted is some form. To clean up the xls file my current scripted solution is to run this: Code: [Select]from subprocess import call call(["unoconv", "-d", "spreadsheet", "--format=ods", path + os.sep +"test.xls"]) call(["unoconv", "-d", "spreadsheet", "--format=xls", path + os.sep +"test.ods"]) While this solution works, I am not happy with it because it adds dependencies of libreoffice and unoconv. What I would like to do is accomplish the same end result, but without adding nonpython dependencies. Any idea where to start? |
|
| 1749. |
Solve : Get Button Content in RoutedEventHandler c#? |
|
Answer» So i'm making a calculator and would like the same event HANDLER for all the numbers. The reason I don't like to attach the handlers in the xaml code is because when I use ValueChanged events there I get nulreferences, unless you know how to fix that (without changing the order of the Objects) I do not know what you are talking about. Since I have no idea what your code is, I cannot guess why you are getting Exceptions. |
|
| 1750. |
Solve : Batch file to determine size of multiple folders and add the results? |
|
Answer» Hi all... starting this new thread as directed. can you suggest some good sites where i can learn more about VB scripting Anybody who is thinking of learning some VBScript should download and use the Microsoft Scripting help file, script56.chm which you can get here http://www.microsoft.com/downloads/details.aspx?familyid=01592c48-207d-4be1-8a76-1c4099d7bbb9&displaylang=en As for websites, there are MANY but these are some I have found useful: This one is very good Devguru main page http://www.devguru.com/technologies/vbscript/home.asp Devguru index of topics http://www.devguru.com/Technologies/vbscript/quickref/vbscript_list.html Microsoft VBScript reference: http://msdn.microsoft.com/en-us/library/d1wf56tt%28VS.85%29.aspx Another VBS reference: http://www.adminscripteditor.com/syntax.asp?l=v&lim=1 Function reference http://www.w3schools.com/VBscript/vbscript_ref_functions.asp VBScript forum, FAQ etc http://www.tek-tips.com/threadminder.cfm?pid=329 download coreutils if you can. then just simply use the du command Code: [Select]C:\test>du -sh c:\folder the -h OPTION means display the size in human readable format, ie MB, KB.I wrote this yesterday when this thread only had dusty's response, but decided to wait to post it until the OPsaid they could use a VBScript. It's similar in many ways to Salmon Trout's except that the folder names are accepted from the command line rather then hard coded. The "FormatSize" Function is a heavily modified version of the one in my File Library. Also, I had completely forgotten that the Size property of a folder worked to recursively acquire the entire folder's size. I originally had a routine that was doing so MANUALLY, but I have modified it since. Code: [Select]Public Function FormatSize(ByVal Bytes) Dim lookupprefix() ReDim LookupPrefix(8) LookupPrefix(0) = " Bytes" LookupPrefix(1) = "KB" LookupPrefix(2) = "MB" LookupPrefix(3) = "GB" LookupPrefix(4) = "TB" LookupPrefix(5) = "PB" LookupPrefix(6) = "EB" LookupPrefix(7) = "ZB" LookupPrefix(8) = "YB" currval = Bytes Do Until currval < 1024 currval = currval / 1024 countdiv = countdiv + 1 Loop buildstr = Trim(FormatNumber(Round(currval, 2))) buildstr = buildstr + " " + Lookupprefix(countdiv) FormatSize = buildstr End Function Set FSO = CreateObject("Scripting.FileSystemObject") For Each ARGUMENT in WScript.Arguments wpathname = argument WScript.Echo wpathname + ":" + FormatSize(FSO.GetFolder(wpathname).Size) Next |
|