w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
   » Home » puk code
What program/s or application can compile my Java Server Code, Android Client Code and Asynctask code?
I'm not sure what you mean by your ASyncTask code as this would be part of the android code. Anyway, your android code can be run from Eclipse but you would need the Android SDK and ADT plugin for eclipse. Details of which can be found here. There are other IDEs but this is probably the most used and if you are beginner at android Google has all the documentation about eclipse which will make things easier. As for your java server, this can be run in Eclipse, but there are lots of other browsers that can be used, Netbeans is another example.

Categories : Java

Using PHP site to post javascript code and it translates the code, resulting code doesn't work
I've revised your code. This should work <script language="javascript" type="text/javascript"> //<![CDATA[ var counting = 0; var totaltime; var audio; var timeout; function start_playing(a,b){ audio = document.getElementById(b); counting++; audio.play(); if(counting == 2){ document.getElementById(a).value = "No Plays Left"; document.getElementById(a).disabled = true; }else{ document.getElementById(a).value = "Playing"; document.getElementById(a).disabled = true; totaltime = Math.round(audio.duration)*1000; timeout = setTimeout("enable_button('"+a+"')",totaltime); } } function enable_button(a){ document.getElementById(a).value = "Play"; document.getElementById(a).disabled = false; } //]]> </scr

Categories : Javascript

How can I easily convert FORTRAN code to Python code (real code, not wrappers)
edit: added information on numpy Such a tool exists for Fortran to Lisp, or Fortran to C, or even Fortran to Java. But you will never have a Fortran to Python tool, for a simple reason: unlike Fortran, Lisp or C, Python does not have GOTO [1]. And there are many GOTOs in Fortran (especially Fortran IV) code. Even if there is a theorem by Jacopini stating that you can emulate GOTO with structured programming, it's far too cumbersome to implement a real (and efficient) language conversion tool. So not only will you need to translate the code of 1000 routines, but you will also need to understand each algorithm, with all its imbricated gotos, and translate the algorithm into a structured program before writing it in Python. Good luck! Hey, why do you think a wrapper is bad? Windows, OSX an

Categories : Python

Is conversion from OpenCV code to FPGA code is easier than Matlab code or not?
Firstly - why do you want to use an FPGA? Unless you have to for good reasons, avoid it! Good reasons can be things like: cost power size pre-existing hardware which must be re-used personal interest it's an assignment where FPGAs are mandated Bad reasons include "image-processing... that must mean I need an FPGA!" Think FPGA If you want to implement on FPGA you need to think "FPGA" right from the beginning. They have very particular characteristics compared to conventional processors, which means that many "conventional" algorithms are very difficult to implement efficiently on FPGAs. And other algorithms which conventional processing will struggle with can actually be done quite simply on an FPGA. One classic (non-image) example is CRC calculation, which is often implemented

Categories : Matlab

radmenu add click event to fire code behind code from code behind
You have a few options. First, I'll answer the question exactly as you asked. In this case, you need to use AddHandler which is similar to using the += in c# for assigning event handlers. Protected Sub Page_Load() Dim H As RadMenu = DirectCast(myMenu.FindControl("House"), RadMenu) Dim D As RadMenuItem = DirectCast(H.FindControl("door"), RadMenuItem) AddHandler D.Click, AddressOf LoadStuff End Sub Private Sub LoadStuff(sender As Object, e As EventArgs) 'update something in vb.net End Sub However, if you're not creating your menu in code, and it's already built at design time, why not just use the following: Protected Sub Page_Load() End Sub Private Sub door_Click(sender As Object, e As EventArgs) Handles door.Click 'update something in vb.net End Sub

Categories : Vb.Net

Optimizing code to define variables only once, code only works when the vars are in change function and for the code outside change I redefine?
.on('change','load', supposed to be // Remove the comma separator if you want to bind the same handler to // multiple events. .on('change load', And you can remove the one separately written out and enclose it in a function (if multiple instances of the class toggle-bg) or just trigger the change event.(If there is a single instance of a class) This will just run the same functionality when the page loads. var toggle = $('.toggle-bg'); toggle.change(function () { var value = $('input.switch-id-value', this).val(), moon1 = $('#' + value + '1').is(':checked'), moon2 = $('#' + value + '2').is(':checked'), static_slide = $('._moon_staticarea_height'); if (moon1) { toggle.css({ 'background-color': '#46b692' }); stat

Categories : Javascript

Placeholder Code still visible when "view source code", even though placeholder visible property set to false from code behind
You need to have all of your controls within the <form> tag, because ASP.NET depends upon the form to do postbacks, etc. You can only have one <form> tag in your page. Change your code to this: <form id="form1" runat="server" class="busgroup-form"> <asp:PlaceHolder ID="pnlThanks" runat="server" Visible="false"> <p><asp:Literal ID="lblReceipt" runat="server"></asp:Literal></p> </asp:PlaceHolder> <asp:PlaceHolder ID="pnlForm" runat="server" Visible="true"> </asp:PlaceHolder> </form>

Categories : Asp Net

Means for compiling C# run-time code into a .dll in native assembly code (callable from a C++ application)?
Essentially you need an unmanaged wrapper around a managed library, which is the opposite of the more common problem. The basic idea is to create a C++ library that has unmanaged exports (native C-style functions) but internally used managed C++ to interact with your library. Be aware that marshalling unmanaged data across layers may be tricky - hopefully you only need to use very basic types (strings and numbers). Also note that the client will still need to have the appropriate .NET framework installed - wrapping the library will not get around that requirement. Here's a few links that may help: Calling a C# function from unmanaged C++ Using managed code in an unmanaged application

Categories : C#

How can I convince Eclipse CDT that a macro is defined for source code editing and code completion?
Found it: Project -> Properties -> C/C++ General -> Paths and Symbols Choose the Symbols tab and Add... a new Symbol with Name I_WANT_THIS_FEATURE and a Value of 1.

Categories : Eclipse

Code Sign error: code signing is required for product type 'Application' in SDK 'iOS 6.1'
If you're trying to test the app on your device, check everything in that box to code sign with your developer identity. If you're submitting for distribution, then check everything to sign with your distribution profile. If that doesn't do the trick, go into your organizer (Shift + Command + 2), click "provisioning profiles" from the pane in the top left, and make sure that your provisioning profile is in there, and that it says "valid profile" to the right of it. Let me know if you have any questions in the process.

Categories : IOS

Replace near working array code with hash code in ruby to find mode
This seems to fit your requirements: def mode(array) histogram = array.each_with_object(Hash.new(0)) do |element, histogram| histogram[element] += 1 end most_frequent = histogram.delete_if do |element, frequency| frequency < histogram.values.max end most_frequent.keys.reduce(&:+) / most_frequent.size.to_f end It creates a hash of frequencies histogram, where the keys are the elements of the input array and the values are the frequency of that element in the array. Then, it removes all but the most frequent elements. Finally, it averages the remaining keys.

Categories : Ruby

Code in constructor before this or super in generated class file while using code coverage tool
The restriction on super() or this() being allowed only as the first instruction in a constructor is a limitation imposed by Java compilers, not byte-code/object classes. The "generated class file" is either a de-compilation of an object class that will not compile under a regular Java compiler, or is compatible with an altered Java allowing such constructs. In both cases the code looks 99% a Java source file, but it is not.

Categories : Java

Adding JavaScript Code to A Single Page in Joomla (Google Remarketing Code)
You could use a module which allows to run custom code in it. There are several solutions to this in the JED: http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules

Categories : Javascript

Can I refactor the pieces of code which differ by method calls, but coincide in code structure?
I think what you are looking for here, is dependency injection. Assume you have two classes, A & B. public interface Handler { myHandler(int a, int b); } public class AHandler implements Handler {....} public class BHandler implements Handler {....} Then based upon some criteria, you inject the correct handler into the calling code... public class MyCaller { private Handler handler; //have a setter. public void callIt(int a, int b) { handler.myHandler(a, b); } } Obviously you can use the spring framework to do this injection through configurations, but you could also code your own. The second part can simply be accomplished my the object oriented concept of overloading. In the interface you could have: myHandler(int a, int b); myHandler(String a

Categories : Java

AJAX code for calling code-behind method from aspx page doesn't work
try this: in your anchor do this: <a href="javascript:void(0)" id="kontakt">Go to Kontakt</a> and modify your ajax script to this: $('a').click(function (e) { var data = { 'id': $(this).attr("id") }; var dataVal = JSON.stringify(data); $.ajax({ type: "POST", url: "Default.aspx/loadNewPage", contentType: "application/json; charset=utf-8", data: dataVal, dataType: "json", success: function (id) { } }); });

Categories : Javascript

The following code is working in eclipse but when i convert into maven project this code giving error
i check your pom.xml and code this problem will comes only the mismatch the version json-lib-0.9 and json-lib-2.4 or other version of library so you remove all library and try the following way and one more things you have to remove from json-lib from apche-tomacat lib also and then you try this following code and used the json-lib 2.4 version. String user1 = "{'Main':[{'h1':[ {'userId':'userId123'} ],'body':[{'data': [{'userId':'one'}]}] }]}"; JSONObject jsonObj = (JSONObject) JSONSerializer.toJSON(user1); JSONArray snefoCareEnvelopeMain = (jsonObj.getJSONArray("Main")); //main object JSONObject Main = snefoCareEnvelopeMain.getJSONObject(0); // this for reading h1 data JSONArray headerarray = (Main.getJSONArray("h1")); JSONObject

Categories : Java

If I use SSLSocket in Android and hard code the passcode to the truststore in the source code is that insecure?
I haven't tried on Android, but here is how it works in plain Java. You're using your keystore as a truststore here, so (hopefully) it doesn't contain any private key or secret material. In this case, the purpose of the password is to verify the integrity of the store. From the Keystore.load(InputStream, char[]) documentation: A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed. Either you use null as the password (in which case you'll always be able to load the certificates) or you use a non-null char array with the actual password (in which case an incorrect password will fail with some

Categories : Java

Git strategy needed to get an old source code in Git and manage it to have a single point to maintain code
The usual way is to create a repository for each codebase. Putting unrelated code into one big repository dilutes the benefits of source control. Following your comment I think what you should look at are git submodules. It gives you a single repository which you can share with other repositories. Also, if you make a change to the common code in one project you can push this to the master repository where it is the available to other repositories should they wish to use the changes.

Categories : GIT

Exception handling within loop. Why does this code give a not all code paths return a value error?
You are not returning anything after your while loop. Not sure what this method is used for, but I would suggest Int32.TryParse() instead of this implementation.

Categories : C#

How to compile and run C# code at runtime where the compiled code can access the rest of the program
Is it possible to dynamically compile and execute C# code fragments? deals with the same thing. Being able to reference your classes just means that one of the assemblies you want to reference should be the one with Creature in it. E.g. var parameters = new CompilerParameters( new[] { "mscorlib.dll", "System.Core.dll", "MyAssembly.dll" }, "foo.exe", true);

Categories : C#

Deploying code first code migrations based web app to server, but it's not creating the database
Well, one problem you have: you're defining both Integrated Security=True (i.e. Windows authentication) as well as User ID=...;Password=.... (i.e. SQL Server authentication) in your connection string. Choose one or the other - but not both at the same time! If you do have that user myUser specified as a login in your SQL Server, right now, it will not be used, because the Integrated Security=True setting will prevail ... So change your connection string to: <add name="Context" connectionString="Data Source=ServerDbInstance;Initial Catalog=blahblah;User ID=myUser;Password=myPassword" providerName="System.Data.SqlClient" /> and see if now, you're myUser user will be used.

Categories : Sql Server

Android/QR-Code: Is it possible open directly the Google Play Store using a QR Code?
Make a QR code out of the link market://details?id=com.example.your.package A normal http:// URI can be processed by multiple apps. However, the market:// scheme is used by Google Play, and normal browsers will not respond to it

Categories : Android

Entity Framework generated code raises warnings in Code Analysis
You could try using the DbContext templates instead of ObjectContext. More info: DbContext was introduced in EF 4.1 as part of Code First and since EF5 has also become the default generated context for Db/Model-first approaches. It uses POCO entities and simplifies a lot of common tasks, which I find makes my model easier to maintain. It also wraps ObjectContext, so you can still call into that if you need to. Since it generates different code, you'd be avoiding the FxCop warnings you are currently seeing, but of course switching to DbContext would require changes to your application code.

Categories : C#

generate code using form button and then display generated code on page
You can use tag to show HTML entities You need to encode all Your HTML entities like < => < like way. Also you can show a text area in which all those HTML code need to echo, it will not execute your code simply it will print it.

Categories : PHP

Improving MATLAB Matrix Construction Code : Or, code Vectorization for begginers
How to vectorize without knowing how to vectorize: First, I'll only discuss vectorizing the first double loop, you can follow the same logic for the second loop. I tried to show a thought process from scratch, so though the final answer is just 2 lines long, it is worthwhile to see how a beginner can try to obtain it. First, I recommend "massaging" the code in simple cases, to get a feel for it. For example, I've used n=3 and v=1:6 and run the first loop once, this is how B looks like: [N M]=size(B) N = 9 M = 27 imagesc(B); So you can see we get a staircase like matrix, which is pretty regular! All we need is to assign the right matrix index to the right value of v and that's it. There are many ways to achieve that, some more elegant than others. One of the simplest w

Categories : Matlab

Get code of a specific user define function or class from a source code
What you need is basically a parser, so that you can pick out structures of interest. Then you either use the position information such a parser gathers (if it is well designed), to determine the boundaries of the text in your file to extract that structure, or you "prettyprint" the AST of the parsed structure to get your artifact. NikiC describes his search and eventual construction of one such parser in PHP in this SO question. There are other solutions provided there, including mine, but it isn't in PHP. You may have some trouble picking out the exact function you want. Imagine you have a file with two classes C1 and C2, each containing a method named M. Now to select the "right method", you need to have the full path C1::M available, and you need to check that the method M is fou

Categories : PHP

Difference between: Opcode, byte code, mnemonics, machine code and assembly
OPCODE: It is a number interpreted by your machine(virtual or silicon) that represents the operation to perform BYTECODE: Same as machine code, except, its mostly used by a software based interpreter(like Java or CLR) MNEMONIC: English word MNEMONIC means "A device such as a pattern of letters, ideas, or associations that assists in remembering something.". So, its usually used by assembly language programmers to remember the "OPERATIONS" a machine can do, like "ADD" and "MUL" and "MOV" etc. This is assembler specific. MACHINE CODE: It is the sequence of numbers that flip the switches in the computer on and off to perform a certain job of work - such as addition of numbers, branching, multiplication, etc etc. This is purely machine specific and well documented by the implementers of the

Categories : Assembly

How get code coverage on java production code with clojure unit tests?
I heard about this project in a ClojureWest talk, though have not used it my self. perhaps it would be worth looking into for this: https://github.com/dgrnbrg/guzheng "guzheng is a library for doing branch coverage analysis of clojure code." it seems to have a lein plugin to make running it a bit smoother.

Categories : Java

tSQLt - How to do a unit test on code in an error Catch block of code
To do this I would suggest creating a wrapper class around RAISERROR say Utils.GenerateError(@error, @serverity, @state) which in turn calls RAISERROR. That way you can simply use EXEX tSQLt.SpyProcedure 'Utils.GenerateError' to mock out the code that actually raises the error. Note since you are now no longer actually going to throw an error, it would be pointless to call ExpectException in your test. You could check that the correct parameters were passed to the your spy procedure instead. Testing the Utils.GenerateError would be a pretty trivial exercise as well.

Categories : Unit Testing

How to add custom code in mailers ? adding ruby code in @message variable
Move this into mailer template into app/views/email_mailer dir & into YOUR_MAILER_NAME_HERE.html.erb file <%= @message %> <%= link_to 'Home Page!', root_url %>

Categories : Ruby On Rails

How do I code an ajax function to receive a return code passed back from a controller method?
Add the success callback: success: function (data, textStatus, jqXHR) { // process the data }, The data variable coming back will contain the return code (probably in JSON, depending on how you set up your endpoint).

Categories : Jquery

Inheriting Doctrine Models to keep autogenerated code separated from custom code: good idea?
Am I wrong saying that you could use entity repositories for your business logic? http://www.masnun.com/2012/11/12/symfony2-doctrine-custom-entity-repositories.html

Categories : Symfony2

Python - multi-process code returns results to a queue successfully, but the code stops
This code is an infinite loop: l=[] while True: try: l+=outputQueue.get() # Code seems to stick here after about 3-4 iterations except: break The calls to get() are blocking, i.e. it will wait until you send in something. In your case, when the processes end the loop does another call to get() that never returns. Since you know the number of processes you can simply do that number of get()s: l = sum((outputQueue.get() for _ in range(t)), []) If a process can push a variable number of results, then you can send a sentinel value when the worker finishes(e.g. None). The process that collects the output can count how many sentinel it has received, and eventually stop querying the queue.

Categories : Python

Error Code: 1289. The 'SHOW PROCEDURE|FUNCTION CODE' feature is disabled; to have it working
It's by design. SHOW PROCEDURE CODE Syntax This statement is a MySQL extension that is available only for servers that have been built with debugging support. It displays a representation of the internal implementation of the named stored procedure. As the error message explicitly says if you want to be able to use this feature you need to build your MySql with --with-debug option.

Categories : Mysql

Sharing database between android native code and phonegap code
yes...both are using different database ... in this situation i request you to use following plug-in... https://github.com/brodysoft/Cordova-SQLitePlugin

Categories : Android

How to change your xml code if someone presses a button on the xml code in android development?
You can't modify the layout files, in the example you have shared, there are a few ways to do it. Either use a ListView and add a new item (using an adapter) or you can use a LinearLayout and inflate a view and insert it in the LinearLayout. These changes are not permanent in your layout. You'll need to store this data somewhere and recreate your layout. Look at how Building layouts with adapters for example on how to dynamically add content to a view. The use a RelativeLayout to position the button under your ListView however when the list grows to the size of the screen this can be problematic before the list can scroll and it takes up the whole screen so there is no way to see anything that has been pushed beyond the screen. So to solve this problem you can either: Add the button to

Categories : Java

remove empty lines from HTML, except in blocks
Let's assume you have loaded the html as text (HTML): HTML = """ html html html code-start code code code code-end """ new_html = "" is_code = False for line in HTML.split(' '): # disable empty line remover when code starts if line == 'code-start': is_code = True # check for empty line/is_code if is_code or line != '': new_html += line+' ' # enable empty line remover when code ends if line == 'code-end': is_code = False print new_html Of course you have to replace code-start and code-end with valid html tags. This is just a quick and dirty approach but should help you.

Categories : Python

Can I put C# and Java code in the same file to make porting my code easier?
I would say the idea is good, but the code would be hard to read. A mess. Maybe if you have a very simple codebase... but in reality would result BIG CHAOS! You maybe spend a lot of time by looking at wrong code, scrolling up n down and getting more confused. Clean code in the files will have your focus, when you open your java project you know you work with java. And when you do open the c# you know it is C# etc. Do a java branch and a c# branch of your code. It is more easy to maintain and keep it clean. Think of situation where you want to upgrade the environment, why wasting time/money to recompile the Java code while you are about to upgrade only the C# code, etc! Will you port to php, ruby, perl, python etc in same files too ? Just let programmers to open the code they want to

Categories : C#

Will my UI code be can be seen by end users if i have not purchased ext js 4 license or also along with the servlet logic code?
My question is whether the end user can see the UI codings developed by ext js or my servlet codings too? Servlet code runs on the server side. Unless someone has the access to your server, it is not possible to sneak in to your server side. ExtJs is basically javascript and works on client side, hence it may be possible to see the code by a user. From the ExtJS FAQs Ext JS and Ext GWT have commercial and open source versions. You may download and use Ext JS and Ext GWT free of charge under the GNU General Public License version 3 (GPL v3). However, you must comply with the terms of the GPL v3 license. Key terms for applications written and distributed under the GPL v3 license require that you release your source code to your users.

Categories : Java

My JavaScript code is not able to read the JSON generated by my PHP code. What is wrong?
Since you are trying to access results[0].company and results[1].user which are undefined, and since only results[1].company and results[0].user are defined in your object, if you change your PHP as follows your JavaScript should work unless response is just a string: echo json_encode( array( "results" => array( array( "user" => $member['user'], "company" => $member['company'] ) ) )); If response is just a string change your JavaScript code as follows: success: function(response) { response = JSON.parse(response); Or dataType: "json", success: function(response) {

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.