[Solved] Making function with brackets [closed]

You’re overthinking it. function my_test($var1, $var2){ global $privileges; $var3 = $var1+$var2; if($var3 != $privileges){ return false }else{ return true; } } if( my_test(‘var1’, ‘var2’) ) { // true – do code } else { //false – don’t } Assuming that that is just example code, because that really just condenses down to: if ( $var1+$var2 … Read more

[Solved] Disable close and minimize option

The ‘print’ window is created by your browser, not by Javascript (Javascript just says ‘hi browser, could you print this for me?). Luckily, browsers do not allow the ‘close’ and ‘minimize’ button to be disabled, as this would create a VERY unfriendly user experience (just imagine sites that ‘force’ you to print a million pages … Read more

[Solved] Calling method inside a method in Interface c#

When you create a method which is named InternfaceName.MethodName it is called Explicit interface implementation. What it means is that that method is accessible only through a reference of the interface type. So… How can you call to that method from within the class? Cast this to the interface type! public void MyBalance() { Console.WriteLine(” … Read more

[Solved] Convert dec to hex number in C [duplicate]

You’re asking about the wrong language. C does not support the dot operator on integers. To do this in C, you need to print it to a string like so. char numstr[10]; sprintf(numstr, “%X”, 255) 3 solved Convert dec to hex number in C [duplicate]

[Solved] Why this code work?

The C++ compiler can’t and won’t catch all the possible way you could write incorrect code. And while running, a C++ program will usually not throw an error the moment you access memory out of bounds. The language was not designed to protect the programmer from doing bad things. So when a program does something … Read more

[Solved] Python 3.3.1 While Loops [duplicate]

You never update the value of GuessedNumber inside the loop. Therefore, if the code enters the loop, it will never leave it because RandomNumber != GuessedNumber will always be true. You need to do something like this: import random RandomNumber=(random.randint(0,100)) GuessedNumber=int(input(“Guess any whole number between 0 and 100! “)) while RandomNumber != GuessedNumber: print(“Unlucky guess … Read more

[Solved] How to get value from another ruby script

If all files are written in Ruby, you can probably require your test case from your test suite (or vice versa) and call the appropriate methods. However, let’s assume that your test cases are arbitrary executables: In my test case script, I have a value which is set true/false (pass/fail) as per the test result. … Read more

[Solved] get image from hexa string

The solution (in collaboration with OP) is: import PIL from binascii import unhexlify import zlib from cStringIO import StringIO sdata = “789C9D953D56C52010856363696D49E90AAC73ECDD4396C25228B210CE711B2CC2CAC622CECC9D0C0321313A27E411123EEEFCC07B7BFF7A9CC45EA9BD507BD6F620F769CAF4FEE3096DB76DDACEAEE9865D4CF79C6DAB34F46D441F7F23F88F6F728E6AD794724EDD5CBB9B790EF53FBF1595D9524C517E93CDEA3A433D984E83440327B318B633BF867A4C12734A5654CE26F24F29AB28704A067685363C665B0582D30ADF0F39A2717F3979C9412A6108A1D731C6992C04BD96252ECB9A2AC4A60F2B07904AA8166C84B51545D172C3C8D02B4CA3D51D841F7584B5CD2E17E2698A5DDE991302AD6240189666558242122D68F1C0F19F99475104D0F7C6216D5A6665AFAED62F8A27730A57E3BC4858669D25716B387BA04E39B41059BCC7E99CEAF4B05F971C75AAB0181AE938111CA9DB9A71C9B5443EA000D4231183A4F8ECEF79E7E5B40E2DEF647BDEA9AB6250EA59F70B6AC90E9FAABFB7D040E43C010107D4F1086A4ADA6D8DA66C8AEDD9C10E3514196A0F060220B59825C843883F5D71A67586809FEDF17FFCD75C4CFC012B43550B” fh = StringIO(zlib.decompress(unhexlify(sdata))) image = PIL.Image.open(fh) PIL is the Python Imaging Library, and using StringIO, I pretend to have a file-like object. 1 solved get image from hexa string

[Solved] How to add parity bits on c# [closed]

This should do it: Console.WriteLine(“Please enter a 7- bit binary number”); string number = Console.ReadLine(); int count = 0; for(int i = 0; i < number.Length; i++) { if(number[i] == ‘1’) { count++; } } Console.WriteLine(“Your number with parity bit is “+ number + (count % 2).ToString()); I’d imagine this is beyond your current level, … Read more