w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
   » Home » IT Questions
Survey database design - conditional questions based on answers from other questions
I'm sure if you ask 10 people you'll get 10 different answers, but I would put the survey logic in an application layer and not in the database. From personal experience, performance is most likely not going to be your biggest challenge. Maintaining the code around business rules is going to be the hardest thing. My recommendation would be to put the rules/logic in the application layer so you can maintain your application well. Putting that kind of logic in the database gets very complex very fast. Evaluating if statements and boolean expressions at runtime won't have an impact on performance. Just make sure you're not looping over sets of data excessively and I'm sure you'll be fine.

Categories : Database

Url rewriting, xyz.com/questions has to redirect to 184.133.111.012/questions, via .htaccess
I presume you need 301 redirection i.e Moved Permanently. Add following line in your .htaccess file under xyz.com root directory: Redirect 301 /questions http://184.133.111.012/questions

Categories : PHP

SQL, questions about join
unfortunately, there's no easy way to do it in SQL Server. Known solutions are: xml trick (see below); using variable to accumulate data (don't work for multiple group rows, only with cursor); custom CLR aggregate; here's xml: select n.name1, stuff( ( select ', ' + p.product from prod as p where p.id_name = n.id for xml path(''), type).value('.', 'nvarchar(max)') , 1, 2, '') as products from name as n sql fiddle demo here's variable: declare @product nvarchar(max), @id int select @id = 1 select @product = isnull(@product + ', ', '') + product from prod where id_name = @id select name1, @product as products from name where id = @id sql fiddle demo

Categories : SQL

Questions about casting
Your ps.get(name) is returning a com.google.gson.internal.LinkedTreeMap object instead of Profile. try to change it to: LinkedTreeMap p = (LinkedTreeMap )ps.get(name); Your code doesn't show you errors because there's no error in compile time, ClassCastException is a runtime exception.

Categories : Java

Some questions about interfaces
Answer to question #1: If SSLSocketFactory is an interface, then TRUSTED_FACTORY is a reference to an object which is an instance of a class (not an interface) that implements the SSLSocketFactory interface. Answer to question #2: This code is creating an instance of an anonymous class (not an interface) which implements the X509TrustManager interface. Java allows you to declare anonymous classes inside another Java class. See http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html. As with all implementations of interfaces, you are required to provide an implementation of all methods in the interface (checkClientTrusted, checkServerTrusted, and getAcceptedIssuers), but could also add new methods if needed.

Categories : Java

.NET Membership - questions
Your invalidpassword error is likely being caused because the password doesn't meet the min password complexity. try setting the minRequiredNonalphanumericCharacters attribute when you declare the membership provider in your web config. (set it to 0 for least complexity). There may be more settings but can't think of any off the top of my head. To Manage your roles use the AspNetSqlRoleProvider : declare it in your web config under <system.web> like : <roleManager enabled="true"> <providers> <clear /> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="DBCon" applicationName="/" /> </providers> </roleManager> Sorry - no matter what i do the above loses its lf.

Categories : Dotnet

Questions about STL containers in C++
All of the associative containers in the C++ standard library are node based, i.e., their elements stay put. However, whether the hash is computed on the object after copying it or on a temporary object passed to the container isn't specified. I would guess, that generally the hash is computed before the object is copied/moved. To distinguish elements with the same hash you need to have an equality function anyway: if the location of the object causes it to be different it would mean that all objects are different and you wouldn't be able to look them up at all. You need to have an equality function for the elements in an unordered container which defines equivalence of keys. For the ordered associative the equivalent class is based on the strict weak ordering, i.e., on an expression like

Categories : C++

Questions about JSONP
From jquery docs http://api.jquery.com/jQuery.ajax/ jsonp Type: String Override the callback function name in a jsonp request. This value will be used instead of callback in the callback=? part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in onJSONPLoad=? passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the ?callback string to the URL or attempting to use =? for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } so the jsonp: '$callback', line is setting the callback query param to a php var $callback the success function is callback. Look for that in your code and retrieve the values there And, yes t

Categories : Jquery

A few php Phar questions
The usual setting of PHP is to treat PHAR files as readonly. In fact, you have to change that setting to allow your local copy of PHP to create these files. I doubt they can be changed, I wouldn't bet on it. The general structure of a PHAR is an initial PHP script part that sets things up, and then a call to __halt_compiler() followed by zipped bytes (after transferring control to a script part already inside the PHAR), so you can do whatever is possible with any PHP script without PHAR, including changing it's name. Note that the bootstrap code of already existing PHAR files might not allow this because of hardcoded filenames, but this is not the general case. It does not really matter. Obfuscation on the code level that leave the PHP code in runnable condition with pure PHP won't affect

Categories : PHP

questions about sink, in R
Question 1: The sink function redirects all text going to the stdout stream to the file handler you give to sink. This means that anything that would normally print out into your interactive R session, will now instead be written to the file in sink, in this case "outfile.txt". When you call sink again without any arguments you are telling it to resume using stdout instead of "outfile.txt". So no, nothing will go wrong if you don't call sink() at the end, but you need to use it if you want to start seeing output again in your R session/ As @Roman has pointed out though, it is better to explicitly tell cat to output to the file. That way you get only what you want, and expect to see in the file, while still getting the rest ouf the output in the R session. Question 2: This also answers qu

Categories : R

creating the ipa some questions
Apple Documentation: Beta Testing Your iOS App This Youtube Video is covering your all questions

Categories : Xcode

Some QLineEdit questions
Pretty much like this: linedit = QtGui.QlineEdit() linedit.setPlaceholderText("My grey text which disappear when I click on it") linedit.setEnabled(False) with Qt minimum version 4.7 and latest PyQt 4.

Categories : Python

Git Workflow Questions
and have both branches as separate repos they are in ONE repo, but on DIFFERENT branches, so check out the specific branch in PHPSTORM you are working on. If your are finisht you only push this branch. So if you work on dev. If you are working now on dev and in 5 minutes on live, then just change branches - that is exaclty what they are for. In your PHPStorm you have on the right buttom a field "git: ", just click there and a submenu opens with the point "local branches". In this you can switch between your local branches. This article explains more about git workflow in detail: http://nvie.com/posts/a-successful-git-branching-model/

Categories : GIT

Two questions about RabbitMQ
The first option is to retrieving individual messages. The noAck paramter is boolean says to auto ack or no. if it set to no, you need to manually ack. See more at: http://www.rabbitmq.com/api-guide.html The second option using the QueueingConsumer. a class used to buffer the messages pushed to us by the server. you also creating the queue in this option: channel.queueDeclare("queuename", true, false, false, null); See more on this option here: http://www.rabbitmq.com/tutorials/tutorial-one-java.html One last thing. if you are familiar with Spring, i suggest you read this as well: http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/ I used it. Its easy and clear.

Categories : Java

Questions regarding Cloudstack
Need immediate feedback on Apache CloudStack? Send your question to the mailing list Need specific features to be added? Talk to support Vendor such as Citrix.

Categories : Misc

Some startBrowsingForNearbyPlayersWithReachableHandler questions
1) Am I right in thinking I can call startBrowsingForNearbyPlayersWithReachableHandler: before authenticating the local player? No. startBrowsingForNearbyPlayersWithReachableHandler works by both advertising the existing player and browsing for other players but, most importantly, the information it uses to identify players is the playerID... which won't be available until the player authenticates. 3) There seem to be conflicting reports on the web over whether GameKit-enabled apps can be tested in the iOS Simulator. General consensus seems not, and it's better to test on iOS hardware GameCenter authentication, achievements, and leaderboards work in the simulator, everything else should be tested on real hardware. I actually recommend the simulator for authentication testing,

Categories : IOS

Questions about Comboboxes
What you referring as "choices the combo-box offer me" is not accurate.. Those are actually what the VS designer offering you. Combo-box offers a lot more, but you will have to use code-behind to get to the flexibility you're looking for. You can manually draw the items area - you can see the MSDN example here. However, there are still limitations, I didn't see any way to draw the arrow down picture in example.. So yes.. it is limited in that sense. If that limitation is acutic to you - you should use WPF. (you can manage every aspect of your control using WPF.) Regarding your 2nd question - This is probably some sort of bug, because when I tested that on my machine it worked as expected - filling the text area with the selected item text.

Categories : Dotnet

Questions about IIS and localhost
How do I test the web application on localhost without opening VS2012? You should install (if none) IIS on your local machine, create a web application and deploy your built application there. Is it possible to access the site using http://:23456/home.aspx if testing through VS? Open web project settings, on tab 'Web' you should select "Use Custom Web server" option. is it possible to access the site using http://:23456/home.aspx when I'm using the same computer and same IP address or does this only work when accessing externally? Configure your router to redirect request on specific port to your machine with IIS installed. If 3. is not possible, would it work through TOR for instance where I'd be routing from another IP address? It should work if point 3 works.

Categories : Windows

Questions about ArrayList
ArrayList is dynamically growable list backed by array. List<List<Integer>> list = new ArrayList<List<>>(10); you can get an element of list by List#get. List<Integer> innerList = list.get(3); Integer integer = innerList.get(4); Update value by List#set - list.get(3).set(4,list.get(3).get(4)++); NOTE : Integer class is immutable.

Categories : Java

some questions about "new" operator
1-why in such object oriented codes we use pointers,I mean what's the advantage(s)? There are none. 2, 3 and 4 With width = new int; heigth = new int; you are always reserving new separate memory locations in each constructor call. Every object has separate memory locations for width and height, so there will be no overwriting. However, there is a situation when two object will share same memory locations - if you copy one object to another, using copy-constructor or assignment operator: CRectangle rect1(3,4); CRectangle rect2 = rect1; CRectangle rect3(4, 5); rect3 = rect1; In this case, width and height get the same values as rect1's, which will make all three objects to point to the same memory locations. In the case of rect2, the default constructor will not

Categories : C++

Questions regarding Google API
The google charts api uses js libraries. You can't use it offline your computer must have live access to http://www.google.com/jsapi in order to use charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included jsapi script, and is called when you invoke the google.load() method. Our terms of service do not allow you to download the google.load or google.visualization code to use offline. (https://developers.google.com/chart/interactive/faq#offline) 3 . The api is completly free (https://developers.google.com/chart/terms?hl=nl#license)

Categories : Javascript

Questions over BigInteger?
How is the div = 7 decided? Probably the author noticed that the number isn't divisible by 2 nor 3 nor 5. To know how the author did this, he/she should have known this rules: Divisibility Rules and Tests The first condition checks whether the number equals 1 or not. From there i am not able to understand the rest of the code. The author is making sure that the number is not BigInteger("1") since it's dividing the number and storing the results in bi in the loop iterations. Note this: bi = bi.divide(new BigInteger(div + "")); new BigInteger(div +""). why do we concatenate + "" here? It uses the BigInteger(String) constructor. The author n̶a̶i̶v̶e̶l̶y̶ makes a new String by adding the int with an empty String.

Categories : Java

Delegate Questions
Not exactly answering your question but just so you are aware, C# also supports Func delegates. in which case you don't need to even declare anything. e.g. This method accepts a delegate with a parameter of type string and output of Int public static void DoSomethingWithDelegate(Func<string, Int32> converstionDelegate) { int x = converstionDelegate("1"); } Read more about it here: http://msdn.microsoft.com/en-us/library/bb549151.aspx

Categories : C#

Select - a few questions
About the timeout: select can use a struct timeval to timeout. If you pass a NULL pointer, select will wait until an event comes. If you pass an address to a struct timeval, select will return even if there's not event (in your code, select will return every second). About the fdmax: Yes you have to find the highest socket, and your snippet is correct. Other: You don't have any FD_SET in your code. Usually, the sockets are setted (via FD_SET so) in the loop which find the highest socket. EDIT: My bad I didn't seen the fd_set temp_list = m_RecvList; in your code. We will need more code in order to analyze your problem with select.

Categories : C++

Some Questions about Flurry
There's no direct way to know the source of ad through the device. Flurry provides the impression reporting for all the ad networks individually for you to keep track. In order to test ad network mediation, you can change the priorities of ad networks, and check whether ads are getting received from the ad networks with the highest priority. Also, note that you can turn off AppCircle backfill on your ad space page (Publishers tab>Inventory>Ad Spaces>AppCircle Network). For details on implementing mediation inside your code, please refer to the integration manual inside the SDK folder, or the Support page . (Full disclosure: I work in the Support team at Flurry)

Categories : Android

Some questions about FASM
Yes, you can link the result COFF object files to any other compatible object file. Although the main power and unique feature of FASM is how good it is able to create directly executable files. If you want to create full assembly application, you simply don't need the link stage. FASM can create itself everything. The only reason for link stage to be used is in order to use object files created by other compilers - C/C++/Pascal, etc. I think UAC is a matter of OS, not the compiler. Especially for Windows, FASM creates standard PE executable files. If you are using linker, then it is responsible for the executable file creation. Where actually you want to arrive following this "step" by "step" tutorial? There is a very full user manual in every FASM package downloaded and there is a Docum

Categories : Assembly

D3 Visualization Questions
The short answer for your first question is that you can't do this automatically with D3. You can try to ensure that this is the case by manually checking the positions of the labels and circles, or by using something like D3's force layout to lay them out automatically without overlap. Either of those options would be quite a bit of work though and in the second case you would have no guarantee that nothing would overlap. Concerning your second question, you determine the size of the window and set the radius accordingly, e.g. something like var radius = Math.sqrt(window.innerWidth * window.innerHeight) / 100;

Categories : Javascript

A few LWJGL Questions
If your drawing textures and quads without textures I think you need to disable textures when not using them, hard to say tho without seeing how you are drawing anything. Id say your right about the alpha for why nothing is rendering without the intro, Im guessing you are still using private static float alpha = 0; but not using your intro to up it to 1 so everything stays at alpha 0. Still not knowing how you are drawing anything makes it hard to say why you are having rendering issues :/

Categories : Java

Some Spring JMS Questions
You would need to show your exact configuration but your speculation #1 is close; the broker delivers the message but does not remove it from the queue until the commit. If your code throws and exception, the framework will execute session.rollback() and the broker will redeliver. If the delivery is successful, the framework will commit the transaction and only then will the message be removed.

Categories : Spring

C some pointer questions
x[y] is equivalent to y[x], which is equivalent to *(x+y) or *(y+x). So *(a+3) is equivalent to a[3] or 3[a].

Categories : C

emacs 24 gud-mi gdb questions
A hack for the second issue: (defadvice gdb-send (before ask activate) (when (and (string-match "^r" string) (null (y-or-n-p "Really run?"))) (setq string "show version"))) The argument string which is overwritten is the string sent to gdb. If run is not confirmed it is replaced with the relatively harmless command show version. Just a bit noisy. I think you get the idea.

Categories : Emacs

IIS logs questions
Question 1 IIS log mystery. what you see as one page access is actually several accesses try and use Fiddler it will show you the connection steps. EX: I want page A -> no you need to authenticate -> no sessionID how can I authenticate -> you need to do this -> no sessionID here is my authentication -> here is page A. -> sessionID is present. Question 2 find out the time spent on page. there is no reliable way of finding this you can approximate by sending some start message on page load and one adder on page leave (but you are depending on client code and you never trust on client code).

Categories : C#

Some questions about iTextSharp
Inorder to make Headers and Cell text to centre just use <RowStyle HorizontalAlign="Center" /> <AlternatingRowStyle HorizontalAlign="Center" /> In your gridview

Categories : C#

Assertion Failed in C++ questions
when we want to disable assertion we have to define NDEBUG but why should we define it before the inclusion of assert header file?? Because assert is defined similarly to the following code fragment: #ifdef NDEBUG #define assert(condition) ((void)0) #else #define assert(condition) /*implementation defined*/ #endif Now the condition will only be true if NDEBUG has been defined beforehand. the second question: what is the point in disabling assertion and using the macro assert? Assertions cost runtime. You still want them to hold in a released product, but you don't want to check them. For example: auto a = b; assert(a == b); If the equality test takes much time it is something you want to avoid in a productive environment. However, while debugging/testing it's good to know

Categories : C++

questions with a while loop that has two pointers
if you are trying to find the duplicate variables in your array and print the duplicates, may be you should start both the indexes from the beginning that is i=0, j=i+1 Arrays.sort(array); //sorts the array elements in ascending order int i,j,lastNum; ArrayList<Integer> list = new ArrayList<Integer>(); for(i=0,j=i+1;i<array.length-1;i++,j++) { if(!list.isEmpty()) { lastNum = list.get(list.size()-1); } else { lastNum = array[i]-1; // so that compiler doesn't warn you about lastNum not being initialized } if(array[i]!=lastNum) { if(array[i]==array[j]) { list.add(array[i]); } } else { continue; } } Iterator<Integer> it = list.iterator(); while(it.hasNext()) { System.out.println(it.next().intValue()); } EDIT: I have edi

Categories : Java

Questions about increment operator
Am assuming you mean an IDENTITY field with an increment of 1. This increases the value by 1 each time a new record is inserted. To quote: If an identity column exists for a table with frequent deletions, gaps can occur between identity values. If this is a concern, do not use the IDENTITY property. However, to ensure that no gaps have been created or to fill an existing gap, evaluate the existing identity values before explicitly entering one with SET IDENTITY_INSERT ON. As alluded to in the comments it's likely this table once had data populated with all the missing values but these were deleted. (As this is quite a big chunk maybe this was done in bulk?)

Categories : SQL

Different type of questions on a form
If you want to develop surveys, questionnaires, quizzes.. Then please try Surveyor Gem. It let you to generate questionaire in your application. Have a look on this : https://github.com/NUBIC/surveyor

Categories : Ruby On Rails

C++ STL Containers- some questions on Types?
I think you don't know what the word "associative" means. Associative types associate one set of data with another. Like names to people, so you can find a person by looking up their name. deque could be called_similar_ to a linked list, which is just a sequence of objects, so it is a sequential container. There's no object association going on. Also keep in mind, the category is based on the interface, not the implementation. I disagree with the use of "Adaptor" as a category, realistically, the adaptors give sequential containers a new interface, so that they no longer behave like containers and instead behave like something else entirely. Namely, a queue, priority queue, or a stack. Again, Adaptors do not fulfill the container interface. (Though they can still be considered cont

Categories : C++

Questions about query several tables through JPA
JPQL does not support unions. You have four options: You can create a View in your DB that would do the unioning, then map to that view Write a native SQL that does the union (since you only need the ID, this is a valid option) If the IDs are distinct, you can run two queries, and concatenate the result list (if not distinct, you could use Sets to filter duplications) If you are using the latest (at least >=2.4) EclipseLink as a JPA provider, you can use UNION See this question here.

Categories : SQL

Questions regarding javascript/jquery
What is the $( "#accordion0" ) called? I know that "#accordion0" refers to the id of the element. It is a jQuery method that selects the DOM elements based on the selector. The DOM elements are wrapped in a jQuery object so you can use chaining. Learn about jQuery to understand how to use it. No one can explain it here on stackoverflow for you. Then on to what I'm actually trying to do: How do I combine the code so I don't have a 4x duplicate of code. Use a common class that all of the elements share. If the common class on the elements is class="accordion", your code would use a class selector like the following. $( ".accordion" ).accordion({ active: false, collapsible: true, heightStyle: "content" }); And a second less related question,

Categories : Javascript



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