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.
| 1601. |
Solve : how to rum binary codes?? |
|
Answer» Hello. |
|
| 1602. |
Solve : Formats in programming. Physics in programming.? |
|
Answer» Hi. yes. If you are inventing your own algorithm or format. But like cameron SAYS, most popular formats are already done by people. So if you are not doing your own invention, then going for ready available libaries/format would be advisable Quote from: m_ilad__ on December 24, 2013, 09:03:25 AM Apart from that Question; you think it is better for a Programmerdepends on what you are trying to do. There is no wrong or right. Are you making some physics software for educational purposes? or are you into Science field ? At this techonologically advanced world we live in now, almost every other stuff we do everyday need some sort of computerization. Even Physics. Take Biology for example. Software libraries have been created to bioinformatics. I am sure in the area of Physics, there are some as well. Quote from: m_ilad__ on December 24, 2013, 09:03:25 AM Will a programming book teach me about physics?yes. It depends on the book right? and how its written.? Programming ties in very closely to how humans think. I suck at Physics but lets take example E=mc(squared). Very FAMOUS equation. that book might just have introduced this equation and show you step by step how to write this function, with the main objective of showing how to pass parameters to this function etc. Probably under Chapter 5. Functions. lol |
|
| 1603. |
Solve : Mobile Operating Systems and the limitation in programming languages.? |
|
Answer» Hi. I'm milAd. Today, My question is that; we know that all programming languages'Translated' is perhaps not an entirely ACCURATE description of compilation. Most Compilers perform optimizations in the compilation far beyond any basic "translation". Usually a high-level language compiler can generate code that has better performance than hand-tuned assembly (expert assembly programmers notwithstanding). Quote Also know, An Operating system is a Software Of collection of softwares.An Operating System is the software that supports the system's basic functions. It is not a collection of software, since by that definition, Office suites are Operating Systems. Quote Big Operating systems Luke windows or mac, might run almost every program written in any languageNo, you don't. You can write Mobile Applications on .NET (for example) and have then run on Android, Windows Phone, and iOS using software such as MonoTouch and Xamarin. Only WIndows Phone supports .NET Applications, neither Android nor iOS do, and you can still have that program run on iOS and Android. The idea that you need to use the language that the Systems UI bindings were designed for is ill-conceived; Windows is written in C and it's API is Mostly C with some COM C++, but that doesn't prevent people from using any number of other programming languages. And there are a myriad of frameworks that provide OS support for many mobile systems on a variety of programming languages. Quote So why is that?! What does "Support" mean 'in here'?It means nothing. If this is from a textbook, it seems like USELESS filler. Quote If you create and operating system, what would you do to make it support EVERY programming language? Operating Systems do not support Programming languages. Programming languages support Operating Systems. For example, let's take Python. Windows has zero built-in support for Python. But you can install Python, and use Python to create Windows Applications. This is because the UI toolkits support windows. or take C#. Windows XP has no built-in support for .NET programs, neither does OSX or Linux, but you can develop, compile, and run C# and Visual Basic .NET Applications on all those platforms.Thank you so much, dear friend. Can you please introduce me some book about creating Operating Systems? I will appreciate that. I'm a one who is Strongly interested in creating Operating system. Im studying C programming language. I love C. And aslo I'm studying Intel assembly language (32-bit). I'm always confused and don't know where to go! I'm one of the BITS here! What kind of OS-book would you introduce me to? I want to know ALL about creating Operating systems. (all in details). Amm....I'm guessing you will tell me keep reading that Assembly language. Well... It's all about CPU so.. Just.. I'm ready for your advice. All my problem is that... I need I want to know everything about computer. But, don't know how do Studies Step-by-Step. Thank you so much.For an Android novice app maker, here is recommended staring point. Building Your First App for Android OR how to make apps for android - videos Using C# for apps can work. But never easy.After some thought, it is apparent that my last post did not do enough to address the goals of the OP. On the assumption that the OP really wants to be productive and not spend too much time in academic pursuit, I would suggest he investigate "Instant Applications for Mobile Devices" as an alternative to learning Eclipse and Java. There are many tools that allow a novice to simply drag and drop objects into a framework. Many good apps out there non built on such foundations. Yes, they may be slow, but they work and are very compact. Videos are the way to learn noways. Forget the nooks. Books REQUIRE high-level skills. We all know low to watch a TV. Being doing it for years. Android Developer Video Hank book is one of many. Look Here: How to make apps for android. This not a joke. People are doing it. |
|
| 1604. |
Solve : Need help..new to command line and batch programming? |
|
Answer» just new to this forum and need help... beginners tutorials in command line and batch programmikng please.... any LINK would be usefulOne of the BEST - syntax and examples: |
|
| 1605. |
Solve : MSDOS Bat File program to Copy the Next Line if Findstr Line is True? |
|
Answer» Quote from: briandams on December 28, 2013, 07:25:26 PM you are using type + for loop? or other methods? how about timing? what are you using to time the script?Windows Resource kit comes with a program called TIMEIT. Works quite well.Quote from: briandams on December 28, 2013, 07:33:52 PM its almost a fact that lower level (in the likes of C/C++ ) and how its coded (algorithm) to read big files play a part in performance. The latter far more so than the former, even in this case. C# is compiled to IL (Intermediate Language) and is subsequently run on the .NET CLR. I Created a 8-million and 1 line file consisting of "this is an example line of text, line #" where was of course the current iteration, starting from 0. The resulting size of the file was 382,888,890 Bytes. A C# Program that simply reads it in and counts lines: Code: [Select] class Program { static void Main(string[] args) { Stopwatch watch = new Stopwatch(); watch.Start(); int linecount = 0; using(StreamReader sw = new StreamReader("D:\\testoutput.txt")) { while (!sw.EndOfStream) { String currentline = sw.ReadLine(); linecount++; } } watch.Stop(); Console.WriteLine("Finished. Total Time:" + watch.Elapsed.ToString() + ", read " + linecount + " Lines."); Console.ReadKey(); } } Output: Code: [Select]Finished. Total Time:00:00:07.8800219, read 8000000 Lines. About 8 seconds to process the entire file. My VBScript is a bit rusty but I came up with this: Code: [Select]DIM FSO Dim TStream Dim StringRead,CurrentLine Dim StartTime,EndTime Set FSO = CreateObject("Scripting.FileSystemObject") Set TStream = FSO.OpenTextFile("D:\testoutput.txt") StartTime = Timer Do While Not TStream.AtEndOfStream StringRead = TStream.ReadLine() CurrentLine = CurrentLine + 1 Loop TStream.Close() EndTime = Timer WScript.echo EndTime-StartTime Which should be functionally similar. It gave me this back: Code: [Select]47.14844 So the first thought would be that this extra time must be because VBScript is interpreted. However, I'm not entirely certain this is the case. And this suspicion is proven on some level by inserting the same code into a Visual Basic 6 project. Visual Basic 6 supports compiling to Native code. Doing so yields a time of 55 seconds- almost 10 seconds slower than VBScript. Interestingly, having it compile to P-code, (an intermediate language of sorts) resulting in the program finishing a few seconds faster (53.2 seconds). For VBScript, all Variables use a 'Variant' Data type. This effectively means that any access or assignment to a variable needs to package and unpackage a OLE_VARIANT structure (internally, of course). Additionally, VBScript is Late-bound, which means that it's access to COM objects (such as the File System Object) are all performed using IDispatch. suffice it to say that this is much slower than an Early Bound call; and pretty much means it has to lookup the method name each time it's used. In this case, that's a problem since there is both Variable access (incrementing the line count) as well as late-bound Method CALLS (both the termination expression as well as the actual ReadLine() method call) being done within the loop body. Within Visual Basic 6, I made two changes- I referenced the Scripting Runtime (allowing Early Bound calls), and made all variables strongly typed. this reduced processing time to 28.6. Still not as fast as C#; but, the thing is that C# is always interpreted at the IL level, and in this case Visual Basic 6 is compiling to Native code, so clearly "lower-level" doesn't translate directly to faster performance. In this case the C# version is faster simply because the Interpreter is able to use new PROCESSOR features and run in Long mode (rather than the 32-bit WoW), and that would end up changing what the native code output by the Jitter contains. Visual Basic 6 has a Native code compiler but it will always optimize for a Pentium. Even enabling all advanced optimizations and the "favour Pentium Pro" option didn't allow it to run faster than about 26 seconds. You might think this is related to Visual Basic itself. This appears partly true. Using Visual Studio 2013 and C++ and the following code, with all optimizations set to full and Release: Code: [Select]#include <string> #include <algorithm> #include <vector> #include <hash_map> #include <iostream> #include <fstream> #include <ctime> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string line; int linecount = 0; ifstream myfile; myfile.open("D:\\testoutput.txt"); cout << "processing..." << ENDL; clock_t startTime = clock(); while (myfile.good()){ getline(myfile, line); linecount++; } cout << double (clock() - startTime)/CLOCKS_PER_SEC << " seconds." << endl; //cout << (double)(clock() – startTime) / (double) CLOCKS_PER_SEC << " seconds." << endl; cout << "Finished." << endl; cout << "processed " << linecount << " lines."; int test; cin >> test; } resulted in this output: Code: [Select]processing... 9.535 seconds. Finished. processed 8000001 lines. (This was with ALL optimizations set to full and for speed (/Ox, /Ot)). The only thing I can think of that ACCOUNTS for the small difference would be that the C# program ran in native 64-bit Mode, whereas the C++ is only compiling to 32-bit (by default), but switching the C++ program to x64 caused it to take about twice as long to complete. My guess as to why it's slower than C# in this case would have to be the ifstream library. Quote from: briandams on December 28, 2013, 07:25:26 PM you are using type + for loop? First batch method @echo off set Tfile="%1" setlocal enabledelayedexpansion set line=1 echo %Tfile% echo %date% %time% for /f "delims=" %%L in ('type "%Tfile%"') do ( set /a line+=1 echo %%L | find "Trigger" >nul && goto found ) :found echo Found previous echo %date% %time% echo Line %line% set /a sk=%line%-1 for /f "skip=%sk% delims=" %%L in ('type %Tfile%') do ( echo %%L goto done ) :done echo %date% %time% Quote or other methods? Second batch method @echo off set Tfile="%1" echo %Tfile% echo FIND start %date% %time% for /f "delims=[] tokens=1*" %%A in ('find /N "Trigger" %Tfile% ^| find "Trigger"') do set triggerlinenumber=%%A echo FIND end %date% %time% echo FOR /F start %date% %time% for /f "skip=%triggerlinenumber% delims=" %%L in ('type %Tfile%') do ( echo %%L goto done ) :done echo FOR /F end %date% %time% VBScript: CONST ForReading = 1 strTextFile = wscript.arguments(0) wscript.echo strTextFile Set objFSO = CreateObject("Scripting.FileSystemObject") start = Timer strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll wscript.echo "Read file " & formatnumber(Timer-start, 4, True) & " secs" start = Timer arrLines = Split(strData,vbCrLf) wscript.echo "Split array " & formatnumber(Timer-start, 4, True) & " secs" start = Timer iArrayIndex=0 Do While iArrayIndex <= Ubound(arrLines) if instr(arrLines(iArrayIndex), "Trigger") > 0 then Exit Do End If iArrayIndex = iArrayIndex + 1 Loop wscript.echo "Find line " & formatnumber(Timer-start, 4, True) & " secs" wscript.Echo "Wanted line " & arrLines(iArrayIndex+1) Quote how about timing? what are you using to time the script? Batch: echo Start %date% %time% [Command] echo End %date% %time% VBScript: start = Timer [Code lines] wscript.echo "Elapsed " & formatnumber(Timer-start, 4, True) & " secs" |
|
| 1606. |
Solve : What is the Best OS for programming C++ and Designing graphics? |
|
Answer» As my windows 8 is corrupted, I dont have a recovery partition, I wanted to move to another Free Operating System like Linux or Unix. I just wanted to take an advice for professionals about the operating system I wanted to install.Windows 7 is well known. Works good Programming is changing. The PC era is coming to an end, and software developers now work with an explosion of devices, job functions, and PROBLEMS that need different approaches from the single machine era. In our age of exploding data, the ability to do some kind of programming is increasingly important to every job, and programming is no longer the sole preserve of an engineering priesthood.You see, it is not me saying this. As for me. I am now a very old dog. If I were 30 years younger, I would drop C++ like a dead toad. Stick to the same OS. ( Windows 8 ) You can use Microsoft Visual Studio for Programming in C++, And for designing, windows 7 or 8 are the best ones.I also agree that why not stick with Windows 8 that the system came with. If this system came with a legal copy of Windows 8, then you can contact the computer manufacturer and purchase replacement system recovery media for usually $35 or less. As for Linux Distros go, my favorite is MINT KDE and MINT Cinnamon, although if you want to play video games that normally run on Windows, you MAY find that some will work with WINE, while others will degrade thru WINE or wont work at all through WINE. As far as a title to this discussion which is kind of offset to the initial post, there are some really cool programs written in C++ that were developed under Linux for Linux, however if developing C++ programs from Windows, you will really want to develope them using Windows as the OS to base them from for testing etc. Especially if you are planning on using .NET which is pretty much explicitly Microsoft OS, however there is the Mono Project that ties .Net to Linux http://www.mono-project.com/Main_Page but of which I have not played with mono yet. |
|
| 1607. |
Solve : How can I run pycharm output in a separate terminal window like cmd in windows? |
|
Answer» Im PRESENTLY using Linux as my OS, I've installed pycharm community software and I want an the output of my code to be in a separate linux terminal.You can just open ANOTHER terminal, MOVE to the directory containing your .py file then type |
|
| 1608. |
Solve : what are the Diffetences between all the Editions Of the C programming language?? |
|
Answer» Quote from: m_ilad__ on January 07, 2014, 04:24:24 PM that "We" couldn't EVEN give the right answer to the main question.Your question made no sense. There are no "editions" of the C Programming language. The "Editions" you refer to are book Editions. Edits and changes made to the books themselves. I would guess some revisions do actually cover other revisions within the C language, however, as mentioned directly in the preface of the second edition, most of the edifications consist of refining examples and fixing errata. The First version covers C as it was in 1978; there wasn't a standard for it so effectively it went with one of the more standard dialects that were available. the Second Edition made revisions and fixed Errata as well as updating the code where applicable to apply to the newly standardized ANSI C standard. The second edition covers C89. There are no other revisions to that book to cover other versions of the language. Some of the other "editions" which are actually separate books might cover them but since you provide no DETAILS that is guesswork. Quote and my not-friend, wouldn't it be better to open a classroom and teach students the things you know?? not sure where this is coming from. I'm not sure if knowing the difference between different books, different editions of the same books, and the versions of the programming language covered by said books can really be covered in a classroom. Seems like that basic categorization skill ought to be acquired through primary school, at the latest. Quote And at the beginning of the class, tell 'em "I know everything and will tell you all even if you wouldn't ASK me or like it" ?This doesn't seem relevant at all. Borderline trolling trying to incite a response with illogical non-sequiters. Quote from: m_ilad__ on January 07, 2014, 04:24:24 PM and my not-friend, wouldn't it be better to open a classroom and teach students the things you know? Oh no, I'm your "Not-Friend" - How can I sleep tonight knowing that! I do actually help a lot of people with programming (and other subjects) and back when I was in school, during free periods I helped out in the first and second year computing classes. I did not teach pure programming in this (In our education system that starts in third year) but I taught them "Scratch" which I believe is a brilliant learning tool as it teaches kids the concepts of programming and the structure of code, but without errors caused by simple typos. I'd also say that having a small game they can then play and show friends is going to engage them a lot more than having a message print out on the screen. These kids at this point have not chosen to study this computing class, it's compulsory so they are not all that interested in raw-code. But during this I saw some amazing stuff, I saw people pick up stuff so quickly I could see straight away that they were going to be a good programmer including one girl who, without any instruction, removed parts of her "code" in order to help herself locate a bug. I do not know everything, nor have I ever claimed that I do - There is loads of stuff I don't know, or only know parts of. Quote that "We" couldn't even give the right answer to the main question.That is true, as I did not know the answer to your original question (Which contradicts your claim that "I know everything"). I did however feel that, as a new programmer you were starting on C with no good reason that you were going down the wrong path as there are many jobs and more practical uses with other languages as compared to C. I thought, as a nice person I would just let you know this so that you could make a decision about what was best. You then came out with your ridiculous claim of "Creating the best Mobile-OS of all time, with the highest security system, and with the thousands of apps." I felt that this claim was unrealistic (and still believe it is). As before I saw this as a regular mistake/belief held by new programmers so I felt I should help guide you onto a path that would be a lot better. Of course you stay stuck in the mindset of "I know best, I won't listen to anyone else, other programmers don't make OSs because they are scared and modern programming languages make programmers stupid" so ignore all this advice given to you. Oh yeah, and you missed a question again: Quote Please, explain why "Hard to read code is better"Quote I do actually help a lot of people with programming (and other subjects) and back when I was in school, during free periods I helped out in the first and second year computing classes. I did not teach pure programming in this (In our education system that starts in third year) but I taught them "Scratch" which I believe is a brilliant learning tool as it teaches kids the concepts of programming and the structure of code, but without errors caused by simple typos. I'd also say that having a small game they can then play and show friends is going to engage them a lot more than having a message print out on the screen. These kids at this point have not chosen to study this computing class, it's compulsory so they are not all that interested in raw-code. But during this I saw some amazing stuff, I saw people pick up stuff so quickly I could see straight away that they were going to be a good programmer including one girl who, without any instruction, removed parts of her "code" in order to help herself locate a bug.Nice work, bud. wish you successful in your life. ahh... i may not have enough money to buy a good computer to USE and.... to use a compiler. the truth is It's months that I haven't used a C compiler. months ago my computer's hard disk terminated! all programs i wrote is in the paper... including the program that converts binary codes into decimal and reverse, or hex to binary and reverse, or hex to decimal and reverse, or hex to octal and reverse or octal to binary or reverse and all... i too wanted show my friends a tiny program like this. but sorry if I dont access to any computer. [/quote]That is true, as I did not know the answer to your original question (Which contradicts your claim that "I know everything"). I did however feel that, as a new programmer you were starting on C with no good reason that you were going down the wrong path as there are many jobs and more practical uses with other languages as compared to C. I thought, as a nice person I would just let you know this so that you could make a decision about what was best. You then came out with your ridiculous claim of "Creating the best Mobile-OS of all time, with the highest security system, and with the thousands of apps." I felt that this claim was unrealistic (and still believe it is). As before I saw this as a regular mistake/belief held by new programmers so I felt I should help guide you onto a path that would be a lot better.[/quote] Thank you a lot. you're right but I'll anyway try what I told. Quote Please, explain why "Hard to read code is better"because writing programs In LLL is more challenging and fun. Quote This doesn't seem relevant at all. Borderline trolling trying to incite a response with illogical non-sequiters.no it does. Quote Your question made no sense. There are no "editions" of the Cthanks a lot.Quote from: BC_Programmer on January 07, 2014, 01:09:40 PM I'm not even sure which compilers would allow Old STYLE C function declaration.-ansi gcc switch?Quote from: m_ilad__ on January 07, 2014, 03:17:52 PM hah.See Reply #8. And that should be your last post that you need to be concerned about. the rest are just not relevant. Please go and do your own stuff.Thank you Geek-9pm, briandams, camerongray, bcprogrammer. Sorry if i made you sad with my Words. i don't really want to make anyone sad by talking about what I like. many biggest projects had been written in C. And this will keep going even Today.Quote from: m_ilad__ on January 08, 2014, 04:21:35 AM Thank you Geek-9pm, briandams, camerongray, bcprogrammer.Well, don't worry about revisions to C. .As has been mentioned. C is not a standard tool and is not going to have any radical changes. It is needed to maintain existing software. Using it for new projects is your choice. |
|
| 1609. |
Solve : What is a class file for?? |
|
Answer» I am going through recovered files and trying to figure out if I need these. I tried USING a Java decomplier which was JD-Gui. I can't make sense of any of the codes. Java decomplier If the Java is not your code that you are decompiling then this is illegal and we cant help. Oh you mean illegal as in computer terms I'm guessing? Well I can see a code and it looks perfectly normal. I just don't know what it is. Quote from: JAJsangel on January 08, 2014, 03:04:21 PM Oh you mean illegal as in computer terms I'm guessing? Well I can see a code and it looks perfectly normal. I just don't know what it is. Illegal in law terms. If a program is open source, you can download the source code directly from its website. If a program does not have this meaning you have to decompile it, it is "closed source" which likely goes against the program's licence agreement. What program is this that you are decompiling?I wasn't decompiling any program, just a bunch of random files from when I took my computer to be recovered to figure out if they were useful but I deleted them because apparently class files are just for DEVELOPERS. I wish someone had told me that earlier. What you say kinda makes sense. I guess I've never really given any thought to Java and what it is.Quote I tried using a Java decomplier which was JD-Gui. then Quote I wasn't decompiling any program, just a bunch of random files from when I took my computer to be recovered to figure out if they were useful but I deleted them because apparently class files are just for developers. I'd throw away that decompiler and save the files on a thumb drive or disc in case you ever need them again to refer back to.Quote from: JAJsangel on January 08, 2014, 02:14:55 PM I am going through recovered files and trying to figure out if I need these. I tried using a Java decomplier which was JD-Gui. I can't make sense of any of the codes. When you compile a Java program, it creates .class files. These get used by websites and games to run the program or applet. If they were part of files that were recovered I would guess they were temporary .class files that were stored by the BROWSER to run applets. The browser will save them and run them from a temporary location, and those will be with your temporary internet files. if I were to guess, I would say this is what those files are for. You seldom find .class files LOOSE in the file system except those that are from your Browser's temporary folder. |
|
| 1610. |
Solve : Python in One Easy Lesson? |
|
Answer» Thanks Allen. The post was about somebody who made a real serious effort to teach Python quickly to programmers that already have some skills. For those of you who don't know what Snake Wrangling is, here is the link to it. Perhaps I'm too pedantic but I'd avoid any source that uses Snake metaphors with Python, because the language was not actually named after the animal, but rather Monty Python's flying Circus. Though in retrospect that's a dumb reason not to use a specific source. I guess it's just liable to make me wonder what else they got wrong. On the other hand I imagine retconning the name temporarily makes it more kid-friendly. One thing nice about Python is that it is actually pretty tricky to make unreadable. You'd have to put effort into it, because readability constraints are part of the syntax (eg. the spacing for control flow). On the other hand, one weird thing is that the self reference has to be specified explicitly (I guess since the methods don't have modifiers, it's the only way to differentiate a class method from an instance method), and "special" methods like __getitem__ have those funky underscores to flag them as a special function, but because those are usually accessed using something else they don't typically appear except at declaration. (And they have to be tagged somehow). Quote second, the OP does not specifically state its only for Python discussion. Title: About Python Reply #1: Python. Reply #2: Python. Reply #3: Python. Reply #4: Python. Reply #5: Perl. Thread subjects are not a game of Duck, Duck, Goose. Quote from: BC_Programmer on January 10, 2014, 10:35:46 AM Perhaps I'm too pedantic but I'd avoid any source that uses Snake metaphors with Python, because the language was not actually named after the animal, but rather Monty Python's flying Circus. Though in retrospect that's a dumb reason not to use a specific source. I guess it's just liable to make me wonder what else they got wrong. On the other hand I imagine retconning the name temporarily makes it more kid-friendly. Page 3 of the book. Quote Apart from being a snake, Python is also a programming language. However,Quote from: Squashman on January 10, 2014, 10:54:07 AM Page 3 of the book. Cool, it was a purposeful/temporary retcon to make it more accessible.Video about Python. From UK, of course. http://www.mirror.co.uk/news/uk-news/monty-python-dance-remix-johnny-2986720Quote from: BC_Programmer on January 10, 2014, 10:35:46 AM One thing nice about Python is that it is actually pretty tricky to make unreadable. You'd have to put effort into it, because readability constraints are part of the syntax (eg. the spacing for control flow).well, because its object oriented, most often times you can write code like this Code: [Select]method1(**args).method2( **args ).somethingelse( **args) still, it depends on programmer. If he chooses to write something like this Code: [Select]f=lambda x="8<:477\02092020162\020\037",y="01001000110100101":reduce(lambda x,y:x+y,map(lambda y,x:chr(ord(y)*2+x),x,map(int,y)));print f(); or this Code: [Select] print ''.join('%(pre)s%(num)s %(bot)s on the wall, %(nul)s %(bot)s,\n%(tak)s\n' % (lambda c,b: {'pre':['','%s %s on the wall.\n\n' % (c,b)][abs(cmp(c,'Ninety-nine'))], 'num':c, 'nul':c.lower(), 'bot':b, 'tak':['Go to the store and buy some more... Ninety-nine %s.' % b,'Take one down, pass it around,'][abs(cmp(x,0))] })((lambda x,o: [(['Twenty','Thirty','Forty','Fifty', 'Sixty','Seventy','Eighty','Ninety'][x/10-2]+'-'+o.lower()).replace('-no more',''), o][int(x<20)])(x, ['No more','One','Two', 'Three','Four','Five','Six','Seven','Eight', 'Nine','Ten','Eleven','Twelve','Thirteen','Fourteen', 'Fifteen','Sixteen','Seventeen','Eighteen','Nineteen'][[x,x%10][int(x>=20)]]),'bottle%s of beer' % ['','s'][abs(cmp(x,1))]) for x in xrange(99,-1,-1)) some of the things that can lead to unread Python code - nested lambdas - redefine functions by assignment - make an single instance of the % operator used for both modulus and STRING formatting - same with +, * for addition, string concatenation, etc. - evade indentation enforcement by writing things in recursive pseudo-functional ways - do something like foo(bar(), baz()) where bar() redefines foo() and baz() - litter the code with numeric and string literals that look like they're doing something (but don't) - cause exceptions solely for the purpose of later extracting obscure data from them Copied from here Python code, can be made unreadable! Its all about the programmer! No one can deny that, not even Quantos. and not to mention, because languages that doesn't have static typing often make it not easy to understand what variables stand for, unless we have good naming convention. eg myvar_int , myvar_str Quote from: BC_Programmer on January 10, 2014, 10:35:46 AM On the other hand, one weird thing is that the self reference has to be specified explicitly (I guess since the methods don't have modifiers, it's the only way to differentiate a class method from an instance method), and "special" methods like __getitem__ have those funky underscores to flag them as a special function, but because those are usually accessed using something else they don't typically appear except at declaration. (And they have to be tagged somehow).all language have their quirks. What matters is, use their syntax correctly and make it do the job. That's more important than ranting. Quote from: BC_Programmer on January 10, 2014, 10:35:46 AM Title: About Pythonwrong. #2 is game. I didn't post any Perl code , or Java code, or Ruby code, or PHP code. Please, if you want to start this, I am game. The thread just merely says "Python in one easy lesson". Thread author didn't say anything else with regards to discusson on other languages. Why are all these assumptions made that only Python can be DISCUSSED. This is a fact. Don't deny it. If you people don't like my comments, then debate it and refute my points like a knowledgable adult, don't keep giving the excuse that "this thread is only for Python" and only Python can be discussed. FYI, this thread is in a Computer programming forum. Its not in a purely Python forum. And this is also a fact. What is so hard to understsand that I merely posted a factual comment, that most languages with good RS232 libraries can also do the job ? So difficult to understand that its a general observable, factual comment and you people have to make it sound like a language war.Quote most languages with good RS232 libraries can also do the jobThat is true. Nowadays a serial library ought also have other serial standards. USB 2.0 ought to be in the library for applications using embedded devices. I was mildly pressurized that good libraries on now available in Python and other popular computer languages. In the days of my youth I had write code at the lowest level and integrate it into a higher language. Quote from: Geek-9pm on January 10, 2014, 07:50:30 PM That is true. Nowadays a serial library ought also have other serial standards. USB 2.0 ought to be in the library for applications using embedded devices. I was mildly pressurized that good libraries on now available in Python and other popular computer languages. In the days of my youth I had write code at the lowest level and integrate it into a higher language. at last, some decent discussion. Last time there was cheeseshop, now they call it pypi , the "CPAN" of Python. |
|
| 1611. |
Solve : How to minimize my program into right-bottom's notification area? |
|
Answer» I wrote a program which can LAUNCH other application programs. I hope my program can minimize into right-bottom's notification area after an application is LAUNCHED automatically. How can I do? Any API I can CALL?Notifications and the Notification Area Thanks. But the codes are all C++. My program is in C#. They can't be applied to my program. The Windows API is C. You can use P/Invoke. If you are using Windows Forms you can simply use the Windows Forms NotifyIcon control. |
|
| 1612. |
Solve : Trying To Get MD5 out of a .bat file? |
|
Answer» Quote from: Salmon Trout on January 15, 2014, 12:31:46 PM 7-zip has AES-256 encryption.Definitely the best option is to use a 3rd party utility. Either zipping or pgp. But we actually have a few threads over on the dostips.com site about AES encryption using pure batch. It is painfully slow but I think the guy just wrote it as a proof of concept.Quote from: camerongray on January 15, 2014, 09:43:57 AM You are new here and have made a really bad first impression.I might be new here, but i am the only one giving TS what he wants. well i don't need anyone having good impression of me, EXCEPT for TS. I am here to solve TS problem only, not yours.Quote from: briandams on January 15, 2014, 04:38:18 PM I might be new here, but i am the only one giving TS what he wants. well i don't need anyone having good impression of me, except for TS. I am here to solve TS problem only, not yours.Brian, please read post 9 of this thread and explain how the TS is going to use MD5SUM to encrypt his text FILE so that nobody can read it and then be able to use md5sum to un-encrypt the file so that it can be readable again. Just read the whole first page of this entire thread. You will see that the TS is confused on what md5sum is versus encryption.Quote from: briandams on January 15, 2014, 04:38:18 PM I might be new here, but i am the only one giving TS what he wants. well i don't need anyone having good impression of me, except for TS. I am here to solve TS problem only, not yours. Few things you need to learn when you are on this forum:
|
|
| 1613. |
Solve : Batch File to Check MS Patch Updates? |
|
Answer» Hi, I'm scratching my HEAD at trying to compare a list of expected PATCH updates (Patch_List.txt) against what actually is installed on a computer. |
|
| 1614. |
Solve : Awk - A nifty little tool for text manipulation and more.? |
|
Answer» Dealing with date and time is more or less a common task when batch scripting. Awk provides simple date and time function for basic time/date manipulation needs. The error is stored within AWK's error variable. It does not pass the error back to the calling batch file or CMD window you have open.Quote from: Squashman on January 16, 2014, 08:49:21 AM The error is stored within AWK's error variable. It does not pass the error back to the calling batch file or CMD window you have open. awk internally doesn't have a mechanism for CHECKING file existence such as -f test for linux. so most of the time if you want to do that then have to make a system call , OR to call getline and check -1. Code: [Select] C:\>awk "BEGIN{ x=getline < \"ddd\" ; print x }" -1 ERRNO is just a string internal for awk. Code: [Select]C:\>awk "BEGIN{ getline < \"ddd\" ; print ERRNO }" No such file or directory so it doesn't get returned to DOS errorlevel. you can capture it though using exit(). Code: [Select]C:\>awk "BEGIN{ x=getline < \"ddd\" ; exit(x) }" C:\>echo %errorlevel% -1 or Code: [Select]C:\> awk "BEGIN{ if ((\"ddd\" | getline) <= 0 ) exit(-1) ; }" 2>nul C:\>echo %errorlevel% -1 Quote from: briandams on January 16, 2014, 09:03:05 AM Then why not use the shells built-in functionality to check for the file existence before running your AWK command. Code: [Select]IF EXIST foo.txt awk.........Quote from: briandams on January 16, 2014, 09:03:05 AM QuoteThe error is stored within AWK's error variable. It does not pass the error back to the calling batch file or CMD window you have open.awk internally doesn't have a mechanism for checking file existence such as -f test for linux. so most of the time if you want to do that then have to make a system call , OR to call getline and check -1. I can see copy-pasting your POSTS from another forum practically verbatim, because they had never really been posted here so could be valuable to some.But when responses like the above are copy-pasted verbatim to rather different questions, that's just a bit weird, I think. Quote from: BC_Programmer on January 16, 2014, 10:42:34 AM copy-pasting your posts from another forum I wondered about that. Quote from: Squashman on January 16, 2014, 09:42:31 AM Then why not use the shells built-in functionality to check for the file existence before running your AWK command.this can be done in awk as well as shown in the examples but if you want to do it in the shell , thats up to individual.Quote from: BC_Programmer on January 16, 2014, 10:42:34 AM But when responses like the above are copy-pasted verbatim to rather different questions, that's just a bit weird, I think. The author for that dostips thread is yours truly . Hence I can copy and paste all I want. I don't have a blog, if not, i would just redirect readers there. That's not a different question. I just felt the response for the question look a bit similar as i had answered it in dostips. hence the copy and paste. Quote from: Salmon Trout on January 16, 2014, 11:12:34 AM I wondered about that. as explained. I am the original author of that dostip thread. Not that hard to start a free blog or free website.Sometimes you may need to filter a file using keywords from another file. say you have file1.txt and file2.txt Code: [Select] C:\>type file1.txt cheese milk sausage C:\>type file2.txt milk cheese popcorn pasta milk sausage cheese melon you want to filter file2.txt with file1.txt such that only those not matching remains. eg Code: [Select]popcorn pasta melon We can do this with awk one liner. Code: [Select]C:\>awk "FNR==NR{ a[$1] ;next} { if ( !($0 in a) ) { print } }" file1.txt file2.txt popcorn pasta melon Explanation: FNR==NR : FNR means the number of records read so FAR. NR means the TOTAL number of records read from all files. Hence, the idiom FNR==NR means to read all the records from the first file and store to array. When awk finish processing the first file, the FNR and NR would be different values, so the 2nd file will be processed. In this case the Code: [Select] if ( !($0 in a) ) { print } statement just says to compare the item inside the array and print the record if not found. Here are some commonly used one liners for file/text parsing 1) Deleting last line of a file 2) Deleting first line of file 3) Print a range of lines 4) Print lines not in a range 5) Concatenating two files 6) Transposing a file 7) Print first and last line 8) Print the line above and below a pattern 9) Print all lines until a matched pattern 10) Print from a matched pattern till the end of file 1) Deleting last line of a file Code: [Select]C:\>type myFile.txt CAT MAT RAT C:\>awk "BEGIN{ RS=\"\0\"} { for(i=1;i<NF;i++) print $i } " myFile.txt CAT MAT 2) Deleting first line of file Code: [Select]C:\> awk "NR>1 { print } " myFile.txt MAT RAT 3) Print a range of lines. eg print line 3 to line 5 Code: [Select]C:\> type myFile.txt CAT MAT RAT BAT TAT DAT PAT C:\> awk "NR==3,NR==5{ print } " myFile.txt RAT BAT TAT 4) Print lines not in a range . eg don't print lines number 3 to 5 Code: [Select]C:\>awk "!(NR>=3 && NR<=5) { print }" myFile.txt CAT MAT DAT PAT 5) Concatenating two files Code: [Select]C:\>awk "{print}" file1 file2 > newFile.txt 6) Transposing a file Code: [Select]C:\> awk "BEGIN{ORS=\" \"}{print}" myFile.txt CAT MAT RAT BAT TAT DAT PAT 7) Print first and last line Code: [Select]C:\> awk "NR==1;END{print}" myFile.txt CAT PAT 8) Print the line above and below a pattern. eg Search for "RAT" and print the lines above and below Code: [Select]C:\> type myFile.txt CAT MAT RAT BAT TAT DAT PAT C:\> awk "/RAT/{print y;print;f=1;next}f{print;f=0}{y=$0}" myFile.txt MAT RAT BAT 9) Print all lines until a matched pattern. eg Print until the word "BAT" is found Code: [Select]C:\> awk "/BAT/{exit}{print}" myFile.txt 10) Print from a matched pattern till the end of file Code: [Select]C:\> awk "/TAT/,0" myFile.txt TAT DAT PAT |
|
| 1615. |
Solve : Homework Help c#? |
|
Answer» Okay, so I havent taken c# in over a year and a half and im really no good at it. Im not really looking for a solution just ideas and some syntax error help. |
|
| 1616. |
Solve : Clip is black on Windows Movie Maker? |
|
Answer» I have a DELL Studio with Vista...I've worked on a few projects before and had no problem with Movie Maker until now. I published a project, uploaded it to youtube, and noticed it goes black with no SOUNDS at the same spot every time and then picks up again after 30 seconds of that. I watched the project file on my computer and, sure enough, it goes black in the same place....I redowloaded the original video clips and attempted to recreate the project in Movie Maker, but now the entire clip that I imported is black! I've already "cleared filters" and updated device DRIVERS and that didn't work. I even downloaded a free trial of a different movie editor but the clip is going black in that one too! The two other imported clips work HOWEVER....if this helps, the clip that's going black is lengthy-25 min. Help please! |
|
| 1617. |
Solve : Deploying SDL application? |
|
Answer» Hi. I am USING Visual STUDIO 2008 Pro and I have recently got into working with SDL for graphics and video. I just got done with making a simple menu-style program using mouse events and I want to deploy it to my own computer. I've read the VS documentation for creating a Setup and Deployment Project for deploying my program, and everything goes ok until I try to run it afterwards. After I open up the application, the SDL window pops up, but with no display, and an error message comes up along with it saying something along the lines of "Something didn't go right, Windows is looking for a solution for the problem" or something like that. My program uses SDL_image.h, and SDL_ttf.h, along with the SDL.h header files. I'm just thinking I didn't go through the setup and deployment PROCESS correctly, like I discluded something I wasn't supposed to. all help is APPRECIATED and thank you for TAKING your time in reading this topic. |
|
| 1618. |
Solve : VBA Macro Help in Excel? |
|
Answer» All, Squashman, could you possibly givea start to it or post your vbscript...like I said I am very inexperienced in VBA and have exhausted my knowledge and google searches.I am very new to vbscript as well and have never done much vba besides just recording a macro. I have some code at work so I will have to get BACK to you on monday. |
|
| 1619. |
Solve : build on debug visual studio 2010 C++ not working anymore? |
|
Answer» Hi, |
|
| 1620. |
Solve : Batch File - Combination of WMIC and NET USE to gather Local User Properties? |
|
Answer» Hello, I am trying to output the local user accounts and their properties by using WMIC QUERIES to get a list of Local accounts and then run the NET USE command against the account name for the properties. However, the LocalAccounts.txt with the user account names in is not been read by the FOR command. |
|
| 1621. |
Solve : Pointer to an array (c programming)? |
|
Answer» Hi folks, |
|
| 1622. |
Solve : GW-Basic without 64k memory limit? |
|
Answer» Was wondering if ANYONE knew if there were any editor/compilers out there that support the old language of GW-Basic but without the original 64k memory limit to work with?Quote from: DaveLembke on August 05, 2010, 03:52:40 PM Was wondering if anyone knew if there were any editor/compilers out there that support the old language of GW-Basic but without the original 64k memory limit to work with? I think freeBASIC can still interpret and run the old Street BASIC dialects from BASICA and GW-BASIC.If your OS will support it, I believe the QBasic interpreter will run GW-BASIC programs but in order to load them they need to be in ASCII FORMAT - that is, saved from GW-BASIC with the ,a option. QBasic allows 64K memory for code PER subroutine and 64K for data. Arrays, fixed-length strings, and user-defined types get 64K each. There is 64K of memory available for CODE per SUBroutine and 64K of memory for DATA. You can also have far arrays of numerics, fixed-length strings, and user- defined types of up to 64K each. You can download QBasic free from Microsoft: http://download.microsoft.com/download/win95upg/tool_s/1.0/w95/en-us/olddos.exe Not very accurate after only 10000 ITERATIONS... Thanks everyone... QBasic would definately do it and I wasnt aware of it being free for download. I figured like GW-Basic on DOS 2.11 that it was only available on a floppy disk of DOS. My floppies are long gone, but its cool that I will be able to run some old programs through a legal downloadable COPY of QBasic. Many Thanks!!!QBasic is on any Windows 95/98/ME install CD. |
|
| 1623. |
Solve : batch programming add partial file name to column in csv? |
|
Answer» Hope someone would help me on BATCH programming please! |
|
| 1624. |
Solve : Database backup script issue? |
|
Answer» Hello everyone, |
|
| 1625. |
Solve : getline doesnt work in c++? |
|
Answer» Hi, |
|
| 1626. |
Solve : how to install Apache,MYSQL & PHP on windows 7 32 bit os?? |
|
Answer» I tried to install AMP but i failed . Please HELP me step by step as i am a BEGINNER . Also help me in configuring them. How to CONFIGURE Apache, MYSQL & PHP.Assuming this is for development use and not production hosting (Which you wouldn't want to do on WINDOWS 7) then the easiest way is to use a BUNDLE such as WampServer http://www.wampserver.com/en/. This is a single installer that will set up everything for you. It would also be a good idea to remove anything you already have installed such as Apache, PHP and MySQL before installing this to prevent issues.Or XAMPP |
|
| 1627. |
Solve : what languge?? |
|
Answer» Hi guys Hi guysWhat you a seeking may be beyond l your skill. Your question implies you do not have a basic training in computer languages and how t hey are used. Making a machine., a computer, read like a human requires a thing called AI. Here is an canticle about that. http://en.wikipedia.org/wiki/Artificial_intelligence Quote Artificial intelligence (AI) is the intelligence exhibited by machines or software, and the branch of computer science that develops machines and software with intelligence. Major AI researchers and textbooks define the field as "the study and design of intelligent agents",[1] where an intelligent agent is a system that perceives its environment and takes actions that maximize its chances of success.[2] John McCarthy, who coined the term in 1955,[3] defines it as "the science and engineering of making intelligent machines".[4]Maybe somebody said that you can do anything with computers. Wello, not really everything. But a lot of advancement has been make. Another thing you want to look at is OCR. Optical character recognition http://en.wikipedia.org/wiki/Optical_character_recognition Quote Optical Character Recognition, usually abbreviated to OCR, is the mechanical or electronic conversion of scanned or photoed images of typewritten or printed text into machine-encoded/computer-readable text. It is widely used as a form of data entry from some sort of original paper data source, whether passport documents, invoices, bank statement, receipts, business card, mail, or any number of printed records. It is a common method of digitizing printed texts so that they can be electronically edited, searched, stored more compactly, displayed on-line, and used in machine processes such as machine translation, text-to-speech, key data extraction and text mining. OCR is a field of research in pattern recognition, artificial intelligence and computer vision.For more, follow the links given above. Are you going to write your own OCR ENGINE? If you are clever enough to do that, you would surely already have a pretty good idea what language would be appropriate. If you are going to use a scripting language to string together various tools e.g. Tesseract, then a lot of people use Python for batch processing of images. You would STILL have the problem of processing a video stream but again there are scriptable solutions. If you are a beginner at programming, then isn't a number plate recognition system a bit ambitious? Good idea! Quote Tesseract is probably the most accurate open source OCR engine available. Combined with the Leptonica Image Processing Library it can read a wide variety of image formats and convert them to text in over 60 languages. It was one of the top 3 engines in the 1995 UNLV Accuracy test. Between 1995 and 2006 it had little work done on it, but since then it has been improved extensively by Google. It is released under the Apache License 2.0.https://code.google.com/p/tesseract-ocr/ As far as I know, Tesseract is mostly for doing OCR on non-skewed, black-on-white printed stuff, like scanned images of printed documents. To recognise a vehicle number/license plate in a video still, you NEED some artificial intelligence to find out which part of the image (if any) is a license plate, and whether that part needs de-skewing and other processing. This is not a trivial task. Usually a team of programmers would work for months on something like that. Right, pastern recognition of skewed image is herd to do. But the police are doing sit. Here is an article from USA today from last year. You can't hide from cops with license-plate scanners Watch your speed! Quote from: Geek-9pm on February 06, 2014, 08:48:41 PM Right, pastern recognition of skewed image is herd to do.Considering speech recognition is a form of pattern recognition I think this provides it's own example.Fonts of his 20. Yes indeed, speech recognition is also a form of pattern recognition. This product I'm using is made by a company called nuance. They also have OCR product for sale. However, I don't believe they have anything as sophisticated as what the police departments are now using in some areas. This version of Dragon NaturallySpeaking is an older version that I bought some time back and it doesn't have all the bells and whistles of the newer VERSIONS. This version is adjusted just for my voice and it has a limited vocabulary. Before I could use it I had to train it and I had a look at all my text files I had created so it could build a vocabulary based on things that I normally write about. However, reading numbers shouldn't be as hard to do if you have only numbers to deal with. But if you include alphanumeric characters, then it becomes much more difficult. For example, the B off looks like the number eight and then this issue about the number one and the letter I and the number zero and the letter O. So yes, speech recognition still has its limitations. And obviously, reading a license plate also would be a serious problem. Quite possibly they might come up with a new font for use on license plates that would make it easier for optical recognition. Okay, I am going to post this without any editing. Have a good laugh. |
|
| 1628. |
Solve : Batch File Needed to Move Folders? |
|
Answer» Hi guy's - I am in deperate need of a batch file that will do the following. |
|
| 1630. |
Solve : Help with simple echo to file command for batch? |
|
Answer» I have a batch file I'm going to use to update a lab's Adobe flash. I would like for the script to add the computers name to a log file after installing just so I know which ones got the update. The below script works just fine when ran from our netlogon share manually (double clicking batch file) but will not run at startup when USED with Group Policy. |
|
| 1631. |
Solve : Automated Driver installation with batch file?? |
|
Answer» I am migrating our "business" to vista from xp and I want to be able to automate driver installation with a batch file. I am a little familiar with batch file and have written some basic one's but this is a bit over my head. I would want to add the file to a specific point in the migration and have it pull NECESSARY drivers from a specified folder. If anyone can think of a better way to ACCOMPLISH this task I am all ears thanks in advance for any help. I am not sure if this is close to what you want but there is a Microsoft DevCon command-line utility you can download and use at http://support.microsoft.com/kb/311272 that is a command-line utility that functions as an alternative to Device Manager. |
|
| 1632. |
Solve : Joining survey form/HRIS, what's needed/how to?? |
|
Answer» This will show what a newbie I am! I work in HR in a non profit and I'm trying to make an electronic personnel action form by using an online survey form like Survey Monkey & our HRIS SYSTEM. Our HRIS runs off of Access but we're considering moving to an online system. Anyways, I don't know if something like Crystal Reports would be needed as well? Not being in IT this is why I'm here. I ned to FIND out what's out next step & how do we get through it spending as little as possible but getting the results? Ideally we'd like a log in set up for supervisors so when they go in they'd have a drop down of just their staff's names and then be led down the path so if they want to say change a pay rate for Jane Smith it'd then say "Jane Smith's rate is curently 20.75 PER hour what do you now want it to be?" ...with numbers drop downs etc. As you've probably figured out by now we want to be as specific as we can with no room for error. Naturally THOUGH we could have a text box at the end where they can type in extra instructions if they deem a situation to be unique etc. Hopfully that won't nullify what comes before it but it's better than the paper version we used to get and now an "unlinmked to HRIS" survey form where the info they're inputing doesn't jive with what we have on record hence the need to specifically say "this is what we have now what do you want to change it to etc.)" Also, our departments change quite often so we need to be able to get in the back end ourselves to change things and not rely on our IT people to do it since the delays would cause supervisors to say "I can't enter this I'll send it to you on paper etc." Like I say I might not have this in the right place and by all means mods, please move this accordingly but hopefully wherever this ends up those that read this can HELP in some way. Looking forward to the replies and thanks for those in advance |
|
| 1633. |
Solve : Help needed with SQL injection project!? |
|
Answer» I'm creating a three layer application with C# and SQL server. Thank you for your reply. I have one more question. It really depends on what you are writing the program in but most languages contain some sort of method to escape strings before they are concatenated into your query, in PHP this is $escaped = mysqli_real_escape_string($string). You would then basically use this on anything you concatenate into your query that has, at some point, come from a user. This is the only safe way to avoid it - I have seen people limiting the input length but it doesn't work - You may not be able to do too much with a short string but only a couple of characters will be enough to let you change the query slightly. Similarly, you can also limit the characters the user can enter but this can annoy users and will only work in cases where the user will never need/want to enter one of those characters. Escaping on the other hand will let you store any characters in strings of any length but it will prevent SQL injection.Quote from: camerongray on January 29, 2014, 03:46:54 AM It really depends on what you are writing the program in but most languages contain some sort of method to escape strings before they are concatenated into your query, in PHP this is $escaped = mysqli_real_escape_string($string). You would then basically use this on anything you concatenate into your query that has, at some point, come from a user. Thank you. What would you suggest me to do at my application created with C# to be protected form injection. Is it a good thought to divide the application in three layers even if those layers communicate with sql statements. Is there a way somehow to apply a HASH function in my statements? Cheers. Cheers. I wouldnt just hash it, but also salt it as well to be most secure.Quote from: dr_iton on February 06, 2014, 03:19:41 AM Thank you. What would you suggest me to do at my application created with C# to be protected form injection. Is it a good thought to divide the application in three layers even if those layers communicate with sql statements. If it's a C# web application you shouldn't have any direct calls to SQL or any database. Instead the de-facto method is to use the Entity Framework or MVC4, which will generate your data layer classes based on the information you give, and will allow you to use any supported Data Source.Quote from: BC_Programmer on February 06, 2014, 08:39:42 PM If it's a C# web application you shouldn't have any direct calls to SQL or any database. Instead the de-facto method is to use the Entity Framework or MVC4, which will generate your data layer classes based on the information you give, and will allow you to use any supported Data Source. Yes, my application is created in C# and has three layers such as BO (Business Objects), BLL (Business Logic Layer) and DAL (Data ACCESS Layer). The layers communicate with each other through classes and objects, but DAL communicates with DB (Data Base) with those kind of query statements such as QUERY, STORED PROCEDURE and TRANSACTION. Another Question: Can I add a HASH function or salted passwords or RSA or what else at my statements to make the communication encrypted in the manner to be protected from SQL injection. Can someone post an example for one table how to make the protection. Once again thank you in advance for your reply and time while reading this topic. Cheers. |
|
| 1634. |
Solve : Problem with %%parameter with script that was just working? |
|
Answer» I feel like I'm going crazy. This script just worked a few minutes ago and now its not. Here is my script, the purpose is to shutdown computers that are named in a list shutdown.bat There you go. So it's as simple as commands can not be the name of the script? No, it does not hurt the command. The command will work But the script or batch must not be the name of any program or built-in command. Example: In the same directory I have: ring.exe ring.bat Preferences is to the EXE.Quote from: indigoataxia on February 13, 2014, 02:04:39 PM So it's as simple as commands can not be the name of the script? You are trying to call shutdown.exe from a script called shutdown.bat. You are not using extensions. Just "shutdown". The command interpreter works like this when running a script - when it finds something that might be a command, it first of all looks in the current directory for a file or script with that name, If there are more than one, extensions take priority in this order listed in the %pathext% system variable, default value: .com; .exe; .bat; .cmd (even in 64 bit Windows .com is first!). If none are found, then the command interpreter looks, in turn, in all the folders listed in the %path% environment variable, using the %pathext% order. So if you don't use extensions, shutdown.bat in the same folder is going to take priority over shutdown.exe on the %path%. Shutdown.bat is going to call itself. The real Shutdown.exe will never get executed. Solution: In your batch, use shutdown.exe or even better C:\Windows\system32\shutdown.exe or better still, don't name your batch the same as a Windows command. It makes life easier. I 100% understand now. It was looping and erroring out because it kept calling itself endlessly. I will rename the script. Thanks a lot guys! |
|
| 1635. |
Solve : execute a batch file only if PDF exists? |
|
Answer» We have a function where our Field personnel send our server a PDF of a customer's invoice and a CSV file that is imported into our main server VIA Google Drive. When our server gets the CSV it then creates a Command line emailer batch file that will E-Mail our customer and Attach the PDF. |
|
| 1636. |
Solve : C program using multiple functions that will calculate the gross pay? |
|
Answer» I am relatively new to C Programming and trying to understand using functions. Please help. Re-read the homework standards ... Ah good old homework... if you supply us with code of what you have so far we may be able to point out problems you have etc. There are many many examples of sample code on google for what you need to accomplish. The problem actually states exactly how it is to process this with arrays etc. But this homework problem is one that is not absolute beginner level programming, you should have already covered the concepts and MASTERED them that are the building blocks of what this homework example requests of you to perform. If confused use your prior chapters in the book and homework examples as a reference for this one. If the book doesnt answer your questions, then POST here and we may be able to clarify that of which is confusing to you. Good Luck and looking forward to looking at your code to help you with it, but I am not willing to do the whole homework problem for you. The only way to learn is to do the coding yourself and exercise the brain. This is a simple program to create once you know what needs to be done and the proper structure etc. Also it appears that you have a good book to work with because when I took programming in high school in the early 90s and more of it in college many home work examples seemed to have assumptions or LEFT out the requirements of how it should be programmed and so you would have a variety of ways that students achieved the same goals with some programs running fractionally faster than others because of better coding while some others who didnt have strengths in the best way to code it would slip by, by making larger programs the achieved the same output, but then later on when the function they were avoiding earlier on is NEEDED ( required ) later to achieve a solution to a problem, they then are totally lost and hit a roadblock. As you continue with programming, anything that is a challenge to comprehend should be exercised both by homework examples in the book as WELL as create problems on your own to maximize your exposure to the functions, structure, and proper syntax. What IDE are you using to code and compile your programs with? ( This is the program you use to create and compile programs if your not sure what an IDE is )#include #include #define STD_HOURS 40.0 #define OT hour>STD_HOURS #define SIZE 5 int main() { int clockNumber[SIZE] = {98401, 526488, 765349, 34645, 127615}; /* employee ID */ float hourlyWage[SIZE] = {10.6, 9.75, 10.5, 12.25, 8.35}; /* hourly wage */ float hour[SIZE],ot[SIZE],otpay[SIZE],gross[SI... int count = 0; /* loop counter */ for(count=0;count{ printf("Enter no. of hours worked: for clock No %d ",clockNumber[count]); scanf("%f", &hour[count]); if(hour[count]>STD_HOURS) { ot[count]=hour[count]-STD_HOURS; otpay[count]=ot[count]*1.5*hourlyWage[c... gross[count]=STD_HOURS*hourlyWage[count... } else gross[count] = hourlyWage[count] * hour[count]; } printf("-------------------------------... printf("%6s","Clock#"); printf("%10s","Wage"); printf("%10s","Hours"); printf("%10s","OT:"); printf("%10s\n","Gross"); printf("-------------------------------... for(count=0;count{ printf("%06d",clockNumber[count]); printf("%10.2f",hourlyWage[count]); printf("%10.1f",hour[count]); printf("%10.2f",ot[count]); printf("%10.2f\n",gross[count]); } return 0; }Unable to compile what you shared due to missing sections of code, .... but is this a copy of your working program or do you need further assistance? Quote otpay[count]=ot[count]*1.5*hourlyWage[c... gross[count]=STD_HOURS*hourlyWage[count... |
|
| 1637. |
Solve : I want to add a parameter entered by user at the end of a particular line start? |
|
Answer» HI Folks I want to add a PARAMETER entered by user at the end of a particular LINE starting with "param_code" string and there are three lines in the text file starting with the string "param _code" using batch programming...like for example there is a file sum.txt which contains below text: ;Logid=INFRASECDEV param_code=DISCOUNT_SALES_CHANNEL, SALES_CHANNEL, MAX_DEP_AMOUNT_SUBAG=0,150,300,500 [PROFILE_SEC_PARAMS] ;Example: ;param_code=code_1,code_2,... ;code_1=value_1_1,value_1_2,... ;... param_code=ACCESS_NTWRK_INTERFACE_SCRNS, ACDN_ACCESS ACCESS_NTWRK_INTERFACE_SCRNS=Y,N and suppose user wants to add "abcd".so "abcd" gets added like this ;Logid=INFRASECDEV param_code=DISCOUNT_SALES_CHANNEL, SALES_CHANNEL, MAX_DEP_AMOUNT_SUBAG=0,150,300,500 [PROFILE_SEC_PARAMS] ;Example: ;param_code=code_1,code_2,... ;code_1=value_1_1,value_1_2,... ;... param_code=ACCESS_NTWRK_INTERFACE_SCRNS, ACDN_ACCESS,abcd ACCESS_NTWRK_INTERFACE_SCRNS=Y,N Please guys help me out in this batch CODE creation as I am new to batch programming. Hoping for help from batch programming experts. How are we suppose to know which param_code to edit?I need to add the user input in the last param_code line param_code=ACCESS_NTWRK_INTERFACE_SCRNS, ACDN_ACCESS one thing can be done I suppose if we search param_code string with "param_code=ACCESS_NTWRK_INTERFACE_SCRNS"Can ANYONE |
|
| 1638. |
Solve : VBA (Access) making functions available accross forms? |
|
Answer» Hiya, By default, a user-defined function is limited in scope to the workbook in which the function resides. In other words, only sheets within the same workbook can call a user-defined function. If you want to call a user- defined function from another workbook, you must first make a reference to the workbook that contains the user-defined function. |
|
| 1639. |
Solve : need word processor for Microsoft Access? |
|
Answer» I am using Microsoft Access 2007 to create a database program for a police department for Incident Reporting. I have included tables such as Incident Information, Subjects involved, Vehicles involved, Evidence involved, Etc. I am new to this and the hardest portion seems to be creating a word processor. I cant believe it took this long for a good answer,Well you posted your question on a Saturday and got some good answers within 24 hours on a FREE forum. I would say that is a pretty quick response time.Each Microsoft Access record should have a filed for 'extra documents' or something like that. That filed would have a macro. The first time the operator clinics on it, a box will if a new document show be made. If yes, it will create a unique file name and pass it as a blank document to MS Word. But once a name has been crated, it does not ask again. It just shows the document. The macro would reside in all cells of one column. BTW: This is a justification for the use of two monitors. Again, I'm not very familiar with Access anymore and never really used anything like this when I used it I did find this. It's for an older version of access (2000) but is likely very similar to what is required in more recent versions. |
|
| 1640. |
Solve : Interesting video tutorial on Machine Learning? |
|
Answer» When I was searching for technology ORIENTED videos such as Machine Learning (ML), I found a VIDEO tutorial offered by “BEYOND” very interesting. In that the author has clearly DEMONSTRATED how, when and where ML is used with EXAMPLES. http://beyond.insofe.edu.in/category/frontiers/machinelearning/ |
|
| 1641. |
Solve : Computer Logics and Digital Design? |
|
Answer» Design and simulate the CIRCUIT for the time based lighting control SYSTEM. The required ...it should include truth tables, k-maps, Boolean algebra, logic gates, etcNo necessary. Requires only a pencil and a sheet of paper. yes it is, is that a problem?Quote from: divaremy on March 31, 2014, 04:41:35 PM yes it is, is that a problem? Yes it is. We do not help here to do people's homework because they can't be bothered doing it themselves - We help people who are EXPERIENCING real issues with their computers and need our help. The whole point of your homework is to teach you the subject, if you get stuck you can do your own research online/in textbooks or ask your teacher/tutor/lecturer/classmates for help. |
|
| 1642. |
Solve : HTML issue with boxes for an FBML box? |
|
Answer» Hello, |
|
| 1643. |
Solve : maplet j2ee framework? |
|
Answer» I USED this code to select from DataBase |
|
| 1644. |
Solve : Command to log in, so I can run it from psexec. Net Use?? |
|
Answer» Is there a command I can run REMOTELY through PSEXEC to log in machines? The scenario is, for testing I need to log 80 computers into a testing account. So my script would be, for rough example |
|
| 1645. |
Solve : excel vba to enter roll no. and get back all the result from the particular site? |
|
Answer» I have a LOT roll no. in a ROW and i WANT to enter the roll no.s in a university result site one by one and have to get back the result in a order of subjects, marks, reg no, and student name for all the students. I want to perform all these tasks automatically using excel vba and if reg no.s is wrong need to MENTION as NA in all column. THANKS in advance. |
|
| 1646. |
Solve : Visual Basic - Trying to fix "End of statement expected"? |
|
Answer» I am trying to make a Visual Basic OS but I get 3 errors on Login.vb that are all "End of statement expected. Warning: 'Public Sub New()' in designer-generated type 'OSVB_0._5.Login' should CALL InitializeComponent method. //FIXED\\Quote from: simplyTechy100 on April 03, 2014, 08:36:45 PM O.O I am actually super confused for Visual Basic.. you are still using conditional compilation. remove the # from your Ifs and End Ifs. Quote from: simplyTechy100 on April 03, 2014, 08:55:00 PM Also, for the Login.vb, now I get 1 error and 1 warning.. I think you misunderstood. That segment was not supposed to be "fixed" code. I suggest you read through the Programmer's Guide on MSDN, which should guide you through the creation of some sample programs.Now you raised the error amount on the browser from 1 to 4...Quote from: simplyTechy100 on April 03, 2014, 09:12:11 PM Now you raised the error amount on the browser from 1 to 4... I didn't state anywhere that your use of conditional compilation was the only problem. Quote If Button1.Click() ThenWhat is this supposed to do? Are you simply guessing about what code you should write?Allow me to say something to the OP. BC programmer is well-qualified to assist you, but you're in making it hard. It appears that you have not really read the documentation for Visual Basic or else you skipped over something and tried to copy an example that was not appropriate. The key word that starts with the #is not really a program word, it is a directive for the compiler. Like BC said, it does not control actual program flow, it only qualifies how the compiler will treat your code. In other words, what you did is wrong. Unless you really wanted to do a compiler directive, and even in that case, you're still wrong. The compiler directive is something that has to be resolved at compile time, not at run-time. Normally it is something that would resolve immediately to a Boolean value or possibly an integer. It would be used either to select between TWO alternate forms of the code, or possibly from a list of other discreet options. Anyway, it does not control the run time code. Please use the notation that is given in the Visual Basic documentation for actual programs, and stop trying to use compiler directives. End of my rant, I am just trying to help. Pay attention to what BC programmer is telling you. He is the best you can find on this forum for Visual Basic. O.O I fixed the error. Well for the browser. Thanks Instructables! I got 1 error on the OS... still. Code: [Select]Public Class Login Public Sub New() InitializeComponent() If TextBox1.Text = "Administrator" Then TextBox2.Text = "AdminSuper32" End If If Button1.Click Then -It errors here Desktop.Show() End If If TextBox1.Text = "Administrator" And TextBox2.Text = "AdminSuper32" Then DeskAdmin.Show() End If End Sub End ClassQuote from: simplyTechy100 on April 04, 2014, 09:53:55 AM I got 1 error on the OS... still.Surely that error has a NAME and description and source line number.Quote 'Public Event Click(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.Line 7, Column 12 Login.vb You need to learn Visual Basic before trying to write software in it. What you are doing there to handle events like a button press is completely wrong - You don't use an if statement, you create methods (subroutines) that are bound to events such as a button being pressed and then when the button is pressed, that method is called. Also, name your controls something useful rather than TextBox1 or Button1 unless you want to get in a mess down the line.Quote from: simplyTechy100 on April 04, 2014, 09:53:55 AM Code: [Select]If Button1.Click Then -It errors hereAt least learn how to write a comment. |
|
| 1647. |
Solve : Need help with regular expression? |
|
Answer» Anyone good with these ? I have tried and FAILED, but I am still looking. |
|
| 1648. |
Solve : Help me on this batch file? |
|
Answer» I am TRYING to increment a folder over a network for example I created BK1 next will be BK2 for backups of files here is the code, the problem is only increment 1 folder but the next it KEEPS saying folder already exist and skipped all my backups, bellow is my code, what am I missing? please help I don't see the %drive1% variable ever get defined anywhere. sorry that should be %desti1% and still doest work... on the %desti1% it should add a folder Backup1 and when I run buckup the next day I will write Backup2 and so on, I will have a backup for every day still not done with the code but I will add to delete backup of X days old but I need to fix this problem first... please help me solve this issueDo you realize that batch does not sort in numeric order. If you have 10 backups and run the dir command your output will look like this. Code: [Select]Backup1 Backup10 Backup2 Backup3 etc......Personally I think you should name your backups by date in a YYYYMMDD format. That way you don't have to screw around with figuring out your last backup number. |
|
| 1649. |
Solve : Batch install script problem? |
|
Answer» Hi All, |
|
| 1650. |
Solve : [Help] Search for sequence of bytes in file.? |
|
Answer» So im using a binaryreader to try and search a file for an array of bytes like so: Code: [Select] /// <summary>Why thank you good sir, while extremely fast, im finding myself sort from what im getting from my second method. There are 2 occurrences that this and my 1st post were not catching towards the end of my file and im not really sure why.Quote from: DaftHacker on April 18, 2014, 02:56:03 AM Why thank you good sir, while extremely fast, im finding myself sort from what im getting from my second method. There are 2 occurrences that this and my 1st post were not catching towards the end of my file and im not really sure why. "Retrieves the first location" The one I wrote only finds the first location of the given byte sequence. You would have to seek in the stream before calling it to change the position that it starts the search from. |
|