w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Network Latency: Does it make practical sense to use a cloud based redis/memcached solution
If you're concerned about network overhead with running just redis in the cloud, why not run your entire stack in the cloud, or just mongodb and redis in the cloud? I checked out redis-cloud, and while interesting, I would not use it. The administrative overhead for redis is very low. You can deploy a redis master with multiple read slaves with little effort.

Categories : Caching

How to make ASP.NET Web API web-service available in local network
IIS Express by default does not allow "remote" connections... this post shows you what to do: IIS Express enable external request Once you do that, you should be able to connect from ANY other computer in your network. Also, make sure to open the port in your Firewall. If that does not work, I would create a site using your local IIS and testing your service that way. Hope it helps, Daniel.

Categories : Android

Find machines on local network based on port (network discover) in android
I am assuming you know how to connect to a tcp server. If not, First go through http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/ You can try opening multiple threads with each thread waiting to connect to a specific ip/port ( along with some timeout value ).If the thread produces an exception, that means the connection was unsuccesful. Othewise add that ip address to your Open_Devices list.

Categories : Java

HybridAuth working within local network, but not when accessed outside of my network
I don't think that most of the OAuth2 providers will accept answers that are not coming from configured callback url. So making redirects with the register will most likely fail. Instead, try to configure your callback to look like: http://www.yourdomain.com:openPort/hybridauth-2.1.2/hybridauth/index.php Where openPort is a port number that your ISP will not block. Then in the router you can make port forwarding openPort->80 or you just can start your web server to openPort and make sure the router is not blocking the requests.

Categories : PHP

Sharing local user's profile picture with others in WinRT in local network game
You could directly read the IStorageFile returned by GetAccountPicture: var file = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage); var buffer = await FileIO.ReadBufferAsync(file); var bytes = buffer.ToArray();

Categories : C#

Setting up local ip over wireless network to create a local server on Ubuntu
Just add this to your normal runserver command: python manage.py runserver 0.0.0.0:8000 Then others on your local network can access it through: http://192.168.1.18:8000

Categories : Django

Hosting local maven repository on Local Area Network
Unfortunately just an apache web server is not sufficient to make your repository available over HTTP. You need additional software, a "repository manager". There is a list of them here: http://maven.apache.org/repository-management.html You can make a repository on the local network available over SSH. Here is how to do that. (1) In the build section of your pom: <!-- Make SSH wagon available.--> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh-external</artifactId> </extension> </extensions> (2) In your ${USER_HOME}/.m2/settings.xml (or wherever you configure repository URLs): <repositories> <repository>

Categories : Maven

When does it make sense to use android GCM?
In the case you describe your code/app initiates the request when it require a response from the server. This is the correct way in such situations. Push messaging (in the case of Android: GCM) is the correct approach if the server have events occuring that require some sort of initialization of communications. For direct messaging or e-mail systems where the server acts online at all times on the user/clients behalf - it can send a push message to initiate required communication (deliver message or initiate e-mail fetch).

Categories : Android

Need help to make sense of NDKHelper
Objective-C has an Objective-C++ bridge, that allows you to use C++ code within the context of an Objective-C runtime. However, the vice versa does not exist, if you're building a C++ object you cannot call into the Objective-C runtime so NDKHelper sets up a communication channel to allow it.

Categories : C++

Does it make sense to use std::unordered_map instead of std::map?
The difference between a map<T,K> and an unordered_map<T,K> is that the first implementation relies on a tree while the second relies on an hashmap. This means that complexities for basic operations (get and set) are logarithmic for a map and constant for an unordered_map. There are other aspects in any case: an unordered_map may need a rehash when its load factor is reached (and this requires time and can be unpredictable) while a normal map doesn't involve such problems. In addition the unordered_map implementation could use separated chaining with buckets so if it happens to have many collisions, complexity becomes constant+linear for retrieval of the key. I'd suggest you to benchmark both structures with some data with a pattern similar to the one you need, that will mak

Categories : C++

does this code about arrays make any sense?
Well, if the Fraction class has a method to return a double or a float, it can be very well constructed with int actually. Then the internal logics will take care of processing and returning the correct type. Consider this example: public static void main(String[] args) { System.out.println(new Fraction(1, 6).getFraction()); } static class Fraction { private float fraction; public Fraction(int num, int den) { // TODO check that den != 0, otherwise we're in a world of trouble :D fraction = (float) num/den; } public float getFraction() { return fraction; } } Output: 0.16666667

Categories : Java

script issue that does not make sense
Typically, if you have fields in a database set to be a certain type, such as an "int", your database driver or ORM will honor that and coerce/cast the values to the appropriate type for the language. In Ruby, using Active Record or the MySQL or PostgreSQL drivers/gems or the Sequel ORM, you'll get back Integers. You don't say what you're using to talk to the database, but somewhere it should be coercing the values back to their Ruby equivalents, not returning everything as a character or a string. If it's a tool that was written in-house, well, there's a feature request in waiting. That means, your code needs to compare to integers: if webdb_itm['override_name_and_description'] == 1 as400_itm[product_map['name']] = webdb_itm['name'] as400_itm[product_map['description']] = webdb_itm

Categories : SQL

Does it make sense for a dimension to also be a metric
It seems to me that in both cases you are just running a query on the measure in the fact products with position = 2 for the last month Thinking about the methods for generating this, this can be derived by generating the correct list of products out of the fact table on the fly, then limiting your outer fact query to these products. This is fine if you have a capable analyst running custom SQL but it's a lot more difficult for a non technical analyst to build this in any reporting tool that I've ever used. OR you can 'harden' your position as an attribute into a slowly changing dimension. But for fast changing data this is usually not an option... as your dimension changes so fast it's impractical. If you could tie your required anlysis period down to a month, it might be pract

Categories : Database

Struggling to make sense of an array
Ha, like Justin Ko suggested in his comment above, what you're seeing is the stdout of running the function twice. Since you used print, there's no newline. Use puts instead. This should help you see it more clearly: def length_finder(input_array) puts '*** '+input_array.inspect return 0 end

Categories : Ruby

When does SOAP make more sense than REST?
i'm working in banking area. the one of the biggest bank in Russia. we using soa and we have a lot of webservices. we like that, because: it's simple to decompose one task -> one service it's simple to manage webservices(Service Orchestration vs. Service Choreography) it's pretty simple to localize a bugs because you have to rewrite only one service and you do't need to rewrite all logic(in rest we will rewrite all logic if bug has been found) it's simple to create a map of organisation if we use soap webservices(after we could join webservices together and get another logical unit)

Categories : Rest

Does it make sense to create a branch for every developer?
Git, like most version control systems, is eminently well suited for use by multiple developers. Indeed, it is one of the main points of a version control system. There is no need to create a branch per user. I would even go so far as to say that it would be counter productive. If you are working on the same feature, you will probably want to get each other's changes, by pulling and merging. Creating branches per user is redundant and will complicate things unnecessarily. The commit situation you describe is not problematic. If another user has created a new commit on the same branch as you, you will be stopped if you try to push. Instead you will first have to pull down the other user's commit and merge (or rebase) your work with those changes. This is the standard behavior of git pull

Categories : GIT

Does it make sense to use PHP setters for type safety only?
Well there is no good answer in my opinion for it. If you do it, you can be 100% sure the value returned is of type x. Otherwise you depend on the data layer for the right stuff. I check the values, but that is mostly because I like the defensive programming approuch (everything outside the scope is evil and should not be trusted). The domain object is outside the scope of the mapper, so you are not sure what you get. Next if you make an api of some kind and use the domain objects again out of scope so check the values. conclusion it depends on the code style you like. So you could implement the getters and settets or just direct to the values. Although I recommend use at least getters and setters for the case you need to change how values are handeld (array needs to become object for

Categories : PHP

Is that make sense to construct a learning Model using only one feature?
You can build a model on one feature. I assume, that by "one feature" you mean simply one number in R (otherwise, it would be completely "traditional" usage). However this means, that you are building a classifier in one-dimensional space, and as such - many classifiers will be redundant (as it is really a simple problem). What is more important - checking whether you can correctly classify objects using one particular dimensions does not mean that it is a good/bad feature once you use combination of them. In particular it may be the case that: Many features may "discover" the same phenomena in data, and so - each of them separatly can yield good results, but once combined - they won't be any better then each of them (as they simply capture same information) Features may be useless until

Categories : Machine Learning

Does it make sense to use messaging queues in a non-distributed application
By "message queues" do you mean an external message server? My below answer assumes that is what you were aking about. If you are just asking about the more general architectural approach of having modules communicate partially, or in full, via in-memory-messages instead of method calls--yes sometimes this can be very nice. Classes like guava's EvenBus facilitate a design like this nicely: https://code.google.com/p/guava-libraries/wiki/EventBusExplained On the one hand I generally try to discourage people from using JMS message queues when a simple queue data structure would suffice. Sometimes I feel that JMS is an inter-process communication tool that has one-to-many (topics) and one-to-one communication channels which happen to be named queues. Yes their access pattern is similar t

Categories : Java

Does it make sense to serve web resources directly from an assembly?
I think that storing data as embedded resource helps to load all that with assembly. This will be faster then load all files one by one. Disk operations is expensive. Load files from assembly will be better solution.

Categories : C#

Is there any sense to make std::atomic<> objects with the qualifier - volatile?
Usually, it doesn't make sense. Use atomic to allow the variable to be modified on one thread while other threads may be accessing it without explicit synchronisation. Use volatile to control access to unusual memory locations (such as hardware registers), where every read and write must happen in the order specified by the program. A normal variable, atomic or otherwise, doesn't usually require such control. The two concepts are unrelated to each other. In particular, do not confuse volatile with a keyword used in other languages to make variables atomic. In C++, volatile has nothing to do with thread interactions whatsoever.

Categories : C++

Do existing Javascript frameworks make sense for Typescript?
Some libraries fit better than other and in my experience you often have to do small little tweeks to get things working - but usually it isn't a problem. Also make sure you include the type definitions from the start of the libraries you're planning to use. You'll probably find the type definition for the library you're using as part of the DefinitelyTyped project - there are also a number of NuGet packages with DefinitelyTyped types available.

Categories : Javascript

How to make sense of the "CreationTime" and other times in Ehcache Elements?
Yes the "long" returned by element.getCreationTime() (as well as the other time() methods of the class Element) are the specified number of milliseconds since the standard base time known as "the epoch". Hence "new java.util.Date(element.getCreationTime())" or "new org.joda.time.DateTime(element.getCreationTime())" would work the same. You should be able to test this really easily though... For example, I would have tested and made sure the element.getCreationTime() shows the same when using java.util.Date and org.joda.time.DateTime and printing them both to screen Hope that helped.

Categories : Java

Does it make sense to use static variables in the main function in C?
One difference is, that static variables usually use the program's data segment instead of stack. Maybe that's the reason for declaring buffer as static (especially if CONSOLEBUFFERSIZE is large).

Categories : C

getFailedLoginAttempts() function doesn't make any sense in appfoundation in Vaadin
Why the code AuthenticationUtil.authenticate(username, password). getFailedLoginAttempts() compiles is that the authenticate method returns a User object upon successful authentication and this method can then be accessed. However if an exception is throws then you do not have the User object. In their unit tests then use a FactoryFacade to retrieve the user object and check it that way. I do not know the API well so I can not tell you whether you can get the user some other way. see https://code.google.com/p/vaadin-appfoundation/source/browse/src/org/vaadin/appfoundation/authentication/util/AuthenticationUtil.java

Categories : Java

Does it make any sense that I use multi processes to insert data to MySQL?
Since you have lots of data consider using LOAD DATA. It's the fastest method of importing data from files according to mysql docs. LOAD DATA INFILE The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. Speed of INSERT Statements When loading a table from a text file, use LOAD DATA INFILE. This is usually 20 times faster than using INSERT statements. See Section 13.2.6, “LOAD DATA INFILE Syntax”. ... INSERT is still much slower for loading data than LOAD DATA INFILE, even when using the strategies just outlined. LOAD DATA INFILE '/path/to/your/file.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' LINES TERMINATED BY ' ' -- or ' ' IGNORE 1 LINES; -- use IGNORE if you have a header line in your file

Categories : Mysql

The min/max-width media query doesn't make grammatical sense
Here is a simple example, hopefully it helps.. Say we have a website with the following media queries: /* #1- Large desktop */ @media (min-width: 980px) { ... } /* #2- Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { ... } /* #3- Landscape phone to portrait tablet */ @media (max-width: 767px) { ... } /* #4- Landscape phones and down */ @media (max-width: 480px) { ... } If the screen size of the browser is 1200px, query #1 will be satisfied, as the minimum width of the browser has to be 980px for this query to be displayed. Lets say we resize the browser now, and bring it all the way down to 250px.. query #4 is satisfied as the MAX is 480px.. Here is a simple translation of the queries.. @media (min-width: 980px) { ... } Display if s

Categories : CSS

Does it make sense to clone copies of dependencies (Dependency Injection)?
If doSomething() and doSomethingElse() both does similar things in two functions, then its a bad choice. It this case created a feeder function and feed two different object to this function. But if there are both responsible for two different action requiring a clone of the dependency object, then it is not bad.

Categories : PHP

scala. higher order function calling by name. does it make sense
The argument that you're passing by name is aFun; that's a valid expression, and it does get evaluated both times that takeFunction2 uses it, but since it's just a variable, and you're not doing anything else with it, "evaluating" it is not very meaningful. (It just evaluates to the same value both times.) For pass-by-name to behave differently from pass-by-value, you have to pass in an impure expression (one that has side-effects, or that can evaluate to different values on successive calls, or whatnot).

Categories : Scala

Does it make sense to add secure and httpOnly flags to an expired cookie?
No, assuming there are no holes in your app, the flag doesn't matter on the log out. However, you should do what the pen tester says because there may be other security flaws in your app that can be exploited using this cookie if the flags aren't set. In other words, if your app were otherwise secure then the cookie wouldn't matter, however it probably does matter because there are no guarantees that your app is secure. One example is an app that doesn't properly terminate or close sessions. A logout cookie is sent to the client without the flags, and is therefore compromised in some way such as MitM or Wire Sniffing. The attacker submits the cookie back to the app, along with any other arbitrary data designed to exploit a whole, thus triggering a vulnerability and getting a live sess

Categories : Security

does it make sense to use something like backbone for a single page application created using Raphael?
I would suggest you keep doing what you are doing. The website looks good and responsive. Do not change anything as long as you think the code is easily maintainable and readable. When you see heavy loading and spaghetti code, then you might consider about using some JS structure.

Categories : Javascript

Does it ever make sense to have a caret or dollar sign in the middle of a regular expression?
Those won't match anything. However: /(xyz$|^xyz)/ That would match any line that begins OR ends with xyz. Update: Andy G points out that multi-line mode may find a match for your regex strings. But this only applies if the implementation is configured to support mid-string anchor matching. This is from Regular-Expressions.info (my favorite place for learning & understanding regular expressions): If you have a string consisting of multiple lines, like first line second line (where indicates a line break), it is often desirable to work with lines, rather than the entire string. Therefore, all the regex engines discussed in this tutorial have the option to expand the meaning of both anchors. ^ can then match at the start of the string (before the f in the above stri

Categories : Regex

Does SCOM make sense as an application monitoring tool (used by development group)?
Yeah, what you're asking is somewhat possible. I spent the best part of a day trying to figure this out and so I thought I'd post what I found for you here. it is possible to set up monitoring for any log on any machine. As long as you can see that log in windows with the event log viewer (there are actually many more, but if you can see it here. Assume it can me monitored. Put whatever you are monitoring into it's own group in SCOM and set up it's own management pack. You can even set up mail alerts with the criteria for a subscription matching 'raised by any instance in a specific group' if you want to be mailed about these alerts. Here is an example if you wanted to monitor just the 'application' log on a remote server: Start the Operations Console as a member of the Operations Ma

Categories : Windows

Does it make sense to host movies from a home LAMP server SQL database?
Start by researching how various home media solutions solve this problem. Each has differing upsides and downsides. Some focus on indexing and adding metadata to shared network drives then provide a browsing interface to it. Others wholly encapsulate the media store and provide the media directly--sometimes by faking a file share which in reality is backed by the database.

Categories : Performance

Routes currently require literal id of model attribute, rather than what would make sense given the context
I think what you are looking for is shallow nesting. http://edgeguides.rubyonrails.org/routing.html Look for section 2.7.2 Shallow Nesting

Categories : Ruby On Rails

Does it make sense to include callback and errback when running inside an EM.defer?
Your first implementation looks way more OOP to me. Using lambdas is great and very flexible but if things start to get complicated you'll endup with a bunch of random lambdas and no way to tell what they are actually doing. To answer your question, yes it makes sense to me to create a class to run your blocking code. Also, you'll have a place to put all your private methods related to your blocking actions logic. Finaly, if you name your class carefuly, it won't be hard for any developer to understand the basic idea behind that class. If further informations are needed, he would just have to digg into the code. I think lambdas are a poor design in this case. Pretty sure you'll be thanking yourself for using classes when things will get more complexe (it always does).

Categories : Ruby

IllegalStateException in Google Play Game Service doesn't make sense
I saw traces similar to that when I was developing my app - like you I initially assumed that all was well. However, if you look more closely at the GameHelper code I think you will find that you have not connected any clients and so the IllegalStateException is, in fact, accurate. This is what my trace of a successful connection looks like: 06-16 16:33:00.562: D/ian_(3181): onStart: connecting clients. 06-16 16:33:00.902: D/ian_(3181): Connecting GamesClient. 06-16 16:33:03.282: D/ian_(3181): onConnected: connected! client=1 06-16 16:33:03.292: D/ian_(3181): All clients now connected. Sign-in successful. 06-16 16:33:03.292: D/ian_(3181): All requested clients connected. Sign-in succeeded! 06-16 16:33:03.292: D/ian_(3181): MultiTab1 onSignInSucceeded Hope this helps. Good luck !

Categories : Java

Filling an Empty DataTable gives SQL Exception "Invalid Column Name" -- Which Doesn't make sense?
Your command looks like: SELECT SKUName FROM COM_SKU WHERE SKUStockCode = CODE0001 But it should be like that: SELECT SKUName FROM COM_SKU WHERE SKUStockCode = 'CODE0001' So you have to to encapsulate your input string with ' as below foreach(char ch in containsRelatedProductsStringOnly.Rows[0]["SKURelatedProducts"].ToString()) { if(ch != ' ') { stockCode = stockCode + ch; } else { SqlCommand cmd2 = new SqlCommand("SELECT SKUName FROM COM_SKU WHERE SKUStockCode = '" + stockCode+"'", con); SqlDataAdapter adapter2 = new SqlDataAdapter(cmd2); adapter2.Fill(containsAllRelatedProductData); //Error stockCode = ""; } }

Categories : C#

Error in Heroku does not make sense, application runs fine locally. RecordNotFound
I suppose you have to handle ActiveRecord::RecordNotFound error: def current_cart if session[:cart_id] begin @current_cart ||= Cart.find(session[:cart_id]) session[:cart_id] = nil if @current_cart.purchased_at rescue ActiveRecord::RecordNotFound => e create_cart end else create_cart end @current_cart end def create_cart @current_cart = Cart.create! session[:cart_id] = @current_cart.id end This could be caused by invalid session data.

Categories : Ruby On Rails

Does it make sense to wrap PHP mysqli prepared statements for executing single queries?
To have such a function is actually the only sane way. While using raw API functions right in the application code, so much advertised on this blessed site of Stack Overflow, is one of the worst practices ever. And yes, it makes sense even for the single query execution. As the only prepared statement's purpose is to format your query properly and unconditionally. Though, to create such a function for mysqli using native prepared statements is a durn complex task. One need A LOT of experience and research to accomplish it. Say, only to add an arbitrary number of parameters to a query, you will need a screenful of code: Bind multiple parameters into mysqli query And you will need twice as that to get your results into array! However, for the emulated approach it would be much easier

Categories : PHP



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