w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
General questions on C programming
Don't use the leading underscore at all - identifiers that start with an underscore are reserved for file-scope identifiers by the implementation. People still do it a lot in their code, but they probably shouldn't. Standard reference 7.1.3 Reserved Identifiers: — All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces. Yes, that's allowed. Your compiler is too old, or you're not passing it the right flags to compile in C99 or C11 mode. Off-topic for Stack Overflow.

Categories : C

general programming issue on classes
In most languages the concept is the same. As you've observed, you can't have "lists of Movie objects" embedded in Actors and vice versa, so instead keep a list of each and just "reference" the other objects in some way. This might be using some unique reference value (e.g. an incrementing number) that can be used to search the other list or associative container (e.g. use a key/value "std::map" in C++ rather than a linked list), or by keeping a reference or (weak) pointer directly to the logically linked objects....

Categories : Algorithm

How to set "General->TargetName", "Debugging->Command" and "Linker->General->Output File"
Solved: Use dll for creating project with testlib.h and testlib.cp use windows project when you create the new project for main.cpp Executing this creates .exe file. Add .dll file in same folder as .exe file and it will work as per your need!

Categories : C

Is it good programming practice to use shell scripts in systems programming
You're running the shell script from within code in another language? In that case using a shell script is almost certainly unnecessary. Virtually all languages allow you to run an arbitrary command and capture the output. For example, C and friends have popen() and Perl, Ruby and such have backticks (`lpstat -a` returns the output of that command as a string). This kind of approach makes it unnecessary to have an extra shell script or a temporary file.

Categories : Bash

A good programming language is a conceptual universe for thinking about programming
The meaning of this quote is: What we need is not just another programming language but a conceptual universe for thinking about software development, embodied in a kind of language that is new to computer science -- a language that will bridge the gap between programming and software development at large.

Categories : Misc

What is the difference between the C programming language and C programming under linux?
The C language is governed by the ISO approved C standard and it does not take in to account the underlying platform on which you use C. So from the perspective of the language standard there is no difference, and a standard compliant program shall work correctly on both. However in practical usage one needs to do platform specific things for ex: IPC mechanisms, multithreading, file access and so on which are specific to the platform, such functionality will vary from platform to platform because each will provide functionality specific to itself. Note that such functionality is not covered by the C language standard, so using it makes the program non portable across other platforms.

Categories : C

Java Programming : Dynamic Programming on stairs example
why and how she employs the function map here? The book shows a dynamic programming technique called memoization. It is used to avoid calculating the same number again: if the element is not -1, then it has been computed again, and re-calculating it would mean wasting lots of CPU cycles. DP computes the value once, and then returns it every time the value is needed. map here is array right? Correct, map is of an array type. I do not see any line to save an input to the map array but how would it return something? That would be the assignment on the third line from the bottom: map[n] = countDP(n-1, map) + countDP(n-2, map) + countDP(n-3, map); Anybody has an idea of C++ or C version of this code? It is hard to understand this code. Maybe not because of the JAVA gramma

Categories : Java

Natural Language Programming vs. Literate Programming
Natural language programming is a system for expressing instructions to a computer in a form approximating a language humans write or speak. NLP syntax structure usually resembles human-language sentence structure, in a form that might sound stilted to a native speaker, but which tends to read almost like the real language. Many NLP implementations are focused on querying data stores rather than writing programs, but actual programming implementations also exist. Literate programming is a system for simultaneously writing programs and writing about programs. Unlike NLP, the code portions of a literate program are written in traditional programming languages. The classic examples, for which the name was coined, are Donald Knuth's writings on the TeX typesetting system. Published as h

Categories : Misc

How to convert Text-based programming code (stored in DB) into actual programming code?
The hard way is to interpret the code within the database, the easier way is to store c# code and runtime compile it with CodeDOM http://msdn.microsoft.com/en-us/library/y2k85ax6.aspx Or take a look at Iron Python. http://ironpython.net/

Categories : C#

For iOS, what is the difference of the Concurrency Programming Guide and the Threading Programming Guide?
This is written in a warning box inside of the Threading Programming Guide Important: If you are developing a new application, you are encouraged to investigate the alternative OS X technologies for implementing concurrency. This is especially true if you are not already familiar with the design techniques needed to implement a threaded application. These alternative technologies simplify the amount of work you have to do to implement concurrent paths of execution and offer much better performance than traditional threads. For information about these technologies, see Concurrency Programming Guide. So, really the difference is that the Threading Programming Guide is older and discouraged from being used in modern Objective-C. HOWEVER, as noted in the comments, for operations that ne

Categories : IOS

Differences between wpf xaml/programming and metro xaml/programming
The short answer is yes, you will run into various nuance differences it will take some time to get used to. If for example, you're coming from more of a Silverlight background, you may find it a bit easier of a transition than if you've been strictly WPF. However most of the time the concepts will remain the same and the differences will be trivial. Like for example more reliance on VisualStateManager rather than Style Triggers, or newly introduced available controls at your disposal like VariableSizeWrapGrid and newly available gesture functionality targeted more towards the touch enabled devices, etc, etc... Howevever this topic can be found covered in length and in detail with a quick trip to your favorite search engine results, so I wouldn't be surprised if you find your question dow

Categories : Wpf

Good programming etiquette/ good programming practices
Val is a left over Legacy function. I would recommend switching to type specific converters. This also provides protection for values that are not convertible like letters. Remember to convert types. Turn Option Strict On and you will see. Integer.TryParse Dim result As integer = 0 Dim numberA, numberB as Integer If Integer.TryParse(TextBoxNumbA.Text, numberA) Then If Integer.TryParse(TextBoxNumbB.Text, numberB) Then result = numberA + numberB End If End If TextBoxResult.Text = result.ToString("n2")

Categories : Vb.Net

General C program
It checks that two linked lists contain the same values. Obviously, if one list is shorter, they are not identical (point B). Note: I think using here break/return would be a better choice, it makes the code more readable. Note2: as noted on the comments, those should be logical operators. It works as it is, but it's a bit confusing. Note3: You could move the test before the loop inside the loop (while(1)), this would eliminate the need for the test at the end of the loop. This is just an ugly code, it should be about 5 lines of code, not a dozen... bool sameValues (chainCell *x, chainCell *y) { while(1) { if (!x && !y) return true; if (!x || !y) return false; if (x->data != y->data) return false; x = x->next; y = y->next; }

Categories : C

SQL In General / QODBC
try Select CustomerRefFullName from invoice UNOPTIMIZED where refNumber in ('5383', '5408') or Select CustomerRefFullName from invoice NOSYNC where refNumber in ('5383', '5408')

Categories : SQL

General constructor for all JS types
The typeof null is "object" And it's a common mistake that novice js programmers make to assume that undefined and null are the same (they're not).

Categories : Javascript

What's the idiomatic way to do general logging in PHP?
I've been a long time user of Log4PHP, and I can highly recommend it. :) But the question about doing proper logging is rather difficult. I use Log4PHP in an enterprise environment where there are multiple applications that all use the same logging, and they also assume that the logger is correctly configured and ready to use. So it's basically a very easy "I assume the same logging is available everywhere" situation. Developing modules for others to use is a completely different task. You could possibly use your own internal logging, but where do you write those log messages to? It can be considered bad behavior if your module unexpectedly fills the hard drive. It would also be a requirement for your module to log to that target that the rest of the application is logging to. If your m

Categories : PHP

Where to put general language adjustment?
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx When a new application thread is started, its current culture and current UI culture are defined by the current system culture, and not by the current thread culture. Isn't this your case?

Categories : Asp Net

Otsu Threshold in general
Sure, why not? The algorithm doesn't know what the values mean, it just separates the values into two classes. You just have to make sure that the code you're using iterates over the full range of your int values.

Categories : Misc

General SQL Parser , get subquery out of SQL
Here is demo code that they provide... (taken from here): " This demo illustrate how to find out all kinds of SQL statements in a script quickly. Find out all SQL statements inside a PLSQL block/package/procedure/function; Find out nested subquery in a select/delete/update statement; Find out querys in a union select statement; Find out sub-queries in where clause, select list and etc. " using System; using System.Collections.Generic; using System.Text; using System.IO; using gudusoft.gsqlparser; using gudusoft.gsqlparser.Units; namespace findsubquerys { class prg { static void Main(string[] args) { int c = Environment.TickCount; if (args.Length == 0) { Console.WriteLine("{0} scriptfile", "syntaxcheck");

Categories : C#

General terminology put into context
This is largely an opinionated question. But I will attempt to provide the some terms commonly used by the Node community, and roughly the factual differences between them. Module as it pertains to Node is very similar to what you would associate with a Java Library. It provides a wrapper around things that Node users find they do a lot. Frequently providing wrappers around node library functions for doing things everyone wants to do. A simple example would be a recursive file system reader, like wrench. Modules also extend to files you use to modularize your code. For example, modules aren't only installed via NPM, but separate javascript files you write as part of your code base to separate code functionality, under standard OOP practices. require('someNPMINStalledModule') re

Categories : Node Js

General Structure for ASP.NET Enterprise(ish) App
If you want to rid yourself of all the authentication / authorization hassles, absolutely go for claims-based applications, WIF, ADFS etc. That's the Microsoft direction - CMS, SP. Office 365. Windows Azure AD etc. are all now claims-based. Only problem is that ADFS authenticates against AD. Have a look at Identity Server for something DB related. Plus ADFS via ACS provides Facebook, Google etc. logons.

Categories : Asp Net

class inheriting from general

You css should look like this .parent > h2 { font-weight:bold; color:red; } .child h2 { font-weight:normal; color:green; } check it here http://jsfiddle.net/yNFUd/

Categories : CSS

general sql exception logging
Use: AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyExceptionHandler); http://msdn.microsoft.com/es-es/library/system.appdomain.unhandledexception.aspx

Categories : C#

General behaviour of concatenation
You answered your own question. "to run directly and avoid opening a subshell". The >& is a shell syntax which is not interpreted if you're not using a shell to execute that command. The second case works since that's the behaviour when passing a single argument to system() (opening a shell). By the way, take a look on what the page that you linked to says: system() accepts as argument either a scalar or an array. If the argument is a scalar, system() uses a shell to execute the command (/bin/sh -c command); if the argument is an array it executes the command directly,

Categories : Perl

Some general Twitter4J questions
The gardenhose is different from the default sample stream, you would have had to request access from Twitter in order to use it. However, I am not sure if Twitter still allows access to the gardenhose, or even if it still exists. It seems the current mechanism may be to use one of Twitter's preferred data partners: Using the Streaming API? Every Twitter account can connect to a small sampling of the Streaming API. Accounts that need increased access for data gathering or analytical reasons should check out our preferred partners page. (source) It may be different for students or educational instutions and that the gardenhose is still available to you. Previously you would have to either e-mail api-research@twitter.com or you could use the following form, but I have no id

Categories : Twitter

Questions about MVC in Javascript and in general
MVC is just a pattern, guidelines to organize your project and decoupling your code, so the size of the team or the project is not relevant. I've made by myself a very simple website with a list and a couple of web forms using MVC and it was pretty faster to develop than other alternatives. If you have the opportunity to work with a powerful IDE like Visual Studio, you will find that most of the common things to do for building a web page/site are already automated. And I also have worked with 12 people in a bigger project using also an MVC approach without noticing differences. One of the main advantages of using MVC is that you can change the whole front end in the future without having to make changes in your model or controller layer. Also, using MVC doesn't have to slow down your c

Categories : Javascript

Can typedef used for vector in general?
C++11 aliases allows this: #include <vector> template<class T> using Vec = std::vector<T>; Vec<int> v; // same as std::vector<int> v; also see this And in a similar fashion, you can rewrite the typedefs in C++11, as: using container1 = std::vector<int>; using container2 = std::vector<char>; These are exactly same as the typedefs in your question.

Categories : C++

General overview of chess algorithms
Following is an overview of chess engine development. 1. Create a board representation. In an object-oriented language, this will be an object that will represent a chess board in memory. The options at this stage are: Bitboards 0x88 8x8 Bitboards is the recommended way for many reasons. 2. Create an evaluation function. This simply takes a board and side-to-evaluate as agruments and returns a score. The method signature will look something like: int Evaluate(Board boardPosition, int sideToEvaluateFor); This is where you use the weights assigned to each piece. This is also where you would use any heuristics if you so desire. A simple evaluation function would add weights of sideToEvaluateFor's pieces and subtract weights of the opposite side's pieces. Such an evaluation functi

Categories : Algorithm

Using multiple tag files at once in vim / Tag organisation in general
First things first: Vim has never been, is not and will probably never be a proper alternative to an IDE. Whoever made you believe that should be shot and you should be shot too for believing such nonsense. I'm only half-joking. Vim is a very powerful programming-oriented text editor but the simple fact that you need to run a dumb external code indexer to get a dumb "jump to definition" or another code indexer to get another dumb "jump to usage" should be a hint that Vim can't realistically be compared to an IDE. Hint: the I in IDE means "Integrated" and the E means "Environment". Since you can't get proper integration and would be hard-pressed to consider Vim as an environment, there's no IDE, here. Only a text editor with many plugins doing different things in different ways and, above

Categories : C

General rules for when to use which types of memberships in MVC
The following post from Jon Galloway goes into great detail explaining what I think it is you are asking. The article includes a class diagram that shows the relationship between all three classes that you have listed. The relevant take-away quote is this one: SimpleMembershipProvider is an implementaiton of an ExtendedMembershipProvider, which inherits from MembershipProvider and adds some other account / OAuth related things. Be sure to look at the class diagram, it is in the section called How SimpleMembership integrates with ASP.NET Membership Hope that helps.

Categories : C#

Crop general path in Java 2D
Create an Area based on the 1st GeneralPath based on this constructor. I'll call it mainArea. Create a Rectangle2D based on the line, covering the area to the left of it as well. I'll call it lineArea. Call Area.subtract(Area) using mainArea.subtract(lineArea); An example can be seen in this answer.

Categories : Java

General check of missing semicolon
Because semicolons actually mean something in Perl and aren't just there for decoration, it's not possible for any tool (even the Perl interpreter itself) to know in every case whether you actually meant to leave off the semi-colon or not. Thus, there's no general-case answer to your question; you'll just need to go through your code and make sure it's correct. As mentioned in my comments, there are various tricks you can try with your editor to expedite the process of finding potentially-incorrect lines; you must, however, either examine and fix these by hand or risk introducing new problems.

Categories : Perl

Is There Any General XMLSchema that can be used to validate our XML string
Try XmlDocument class LoadXml method. see link This method will throw exception in case the string is not valid xml. You can also use DTD defined in Xml like link

Categories : C#

Setting a general collation in SQL databases?
Check out this for the why and this and this for the how to fix.

Categories : Mysql

Is there a general purpose way to test for the existence of a GIL?
No, the stdlib has no API or flag to test for the GIL. For now you can safely assume that all versions of CPython and PyPy have a GIL while IronPython and Jython don't have a GIL. Python 3.3 and newer have sys.implementation.name. In older versions you can use platform.python_implementation(). >>> import sys >>> sys.implementation.name 'cpython' >>> import platform >>> platform.python_implementation() 'CPython'

Categories : Python

mysql general log cant find file
Mine are set in a custom location with the permissions -rw-rw-rw- and owner and group are set to root. You should also make sure that whatever user you're giving the permissions to has access to every directory above the one you're trying to give it access to. Also, I'd recommend that you don't put your logs inside of public_html. This will allow malicious persons to gain information about your SQL version and such, and even worse, give them a place to see if what they're trying is working.

Categories : Mysql

Cannot hide tab named "General" in crm 2011
The Xrm.Page.ui.tabs.get method accepts the index or the name of the tab, so first you need to check if the name (and not just the label) is General As you can see the default name for the tab General is a GUID. There is also a case when you can't hide a tab, it's when is the only tab left in your form. If for example you have 3 tabs, and you try to hide all 3, the third one will still be visible.

Categories : Javascript

Using the most general typeclass function types
Luqui explained what the problem is: fitness would need to be able to provide any Ord instance the caller might request, when what you really want is some specific one that suits the type best. This is IMO a very nice application for associated type synonyms: {-# LANGUAGE TypeFamilies, FlexibleInstances, FlexibleContexts #-} class (Ord (Fitness a)) => Genetic a where type Fitness a :: * fitness :: a -> Fitness a data DNA = DNA String instance Genetic DNA where type Fitness DNA = Int fitness (DNA s) = length s

Categories : Haskell

clarifying gamma topic (in general)
There's nothing "natural" about linear color values. Your own eyes respond to brightness logarithmically, and the phosphors in televisions and monitors respond exponentially. GIF and JPEG files do not specify a gamma value (JPEG can with extra EXIF data), so it's anybody's guess what their color values really mean. PNG does, but most people ignore it or get it wrong, so they can't be trusted either. If you're displaying images from a file, you'll just have to guess or experiment. A reasonable guess is to use 2.2 unless you know the file came from an Apple device, in which case use 1.0 (Apple devices are generally linear). If you need to store images accurately, Use JPEG from a camera with good EXIF data embedded for photos, and maybe something like TIFF for uncompressed images. And use h

Categories : C

NodeJS (General JS) comparing IP address
If my intuition is correct, you might be doing a bunch of extra work right now: For each IP expression in your config.ips array, your code is parsing and comparing: if (block[0] && block[1] && block[2] && block[3]) { return true; } ^^^ Note that you have already done work to get all 4 blocks in the iterations of calculating this expression 4 times per IP: (curIP[b]===ip[b] || curIP[b]==='*'), so the ANDing above is not preventing the overhead of the work that is already happening regardless. I have 2 ideas for you: Since IP addresses are strings anyways, the * notation lends itself to be suitable for a Regex to do the work, instead of your splitting and comparing? So maybe as a next step you could look into implementing a Regex to do the work, instea

Categories : Javascript



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