w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
CodeIgniter + Wordpress integration
I used the following. My goal is to use CodeIgniter for some pages, and leave the other pages in Wordpress untouched. I only have a few steps to do it : Copy CI folder at the Wordpress root Modify the « index.php » of CI to add an include which will add WP functions to CodeIgniter : @require '../wp-load.php'; require_once BASEPATH.'core/CodeIgniter.php'; Once this line added, Wordpress functions will be usable in CodeIgniter ; they will be used mainly for views. Modify the .htaccess of WP to not rewrite CI's URLs : After this line : RewriteRule ^index.php$ - [L] Add this line : RewriteCond %{REQUEST_URI} !^/(codeigniter_folder|codeigniter_folder/.*)$ Then CI views can use WP functions.

Categories : Wordpress

integration phpbb and wordpress
wp-united never made it to an actual release/production state. You should not be using it in a live environment because its going to have problems like this. From what I can tell its been abandoned, at least on phpBB.com

Categories : Wordpress

Active Directory integration with Wordpress and LDAP
Here is a guide / code snippit for authenticating using PHP and active directory. If you are dead set on retrieving ALL users for some reason simply modify the filter, and then remove the break statement in the for loop. http://www.exchangecore.com/blog/how-use-ldap-active-directory-authentication-php/

Categories : PHP

Htaccess Redirect not working in wordpress with WHMCS-WP Integration
A few things: You need to remove the leading slash in your rule's target. It's going to get interpreted as an absolute URL-path and the /test/ URI base won't be used You have to escape (using a backslash) your %'s in the target. Mod_rewrite's going to interpret those as backreferences You need to use the NE flag, so that the %'s don't get encoded: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /test/ RewriteRule ^billing/client-area/$ billing/?whmcsportal\%5Bpage\%5D=whmcs\%3A\%2F\%2Fwww.thesmarttech.com\%2Fclientarea.php [L,NE] </IfModule> Also, make sure those rules are in the htaccess file in the /test/ directory.

Categories : Htaccess

Django Bootstrap Integration
You should try this instead: {% load static %} {% block css %} <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.css ' %}"> {% endblock %} ...and just make sure you have 'django.contrib.staticfiles' in your INSTALLED_APPS. Please see also https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#template-tags (EDIT: fixed typo, I oroginally forgot the "static" keyword) OR this: {% block css %} <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}css/bootstrap.css"> {% endblock %} ..assuming "django.core.context_processors.media" is in your TEMPLATE_CONTEXT_PROCESSORS

Categories : Django

Django and Connector/Python Integration
MySQLdb is the Python interface to MySQL [supported by django]. Version 1.2.1p2 or later is required for full MySQL support in Django. At the time of writing, the latest release of MySQLdb (1.2.4) doesn’t support Python 3. In order to use MySQL under Python 3, you’ll have to install an unofficial fork, such as MySQL-for-Python-3. This port is still in alpha. In particular, it doesn’t support binary data, making it impossible to use django.db.models.BinaryField. Basically your only options to avoid Alpha quality drivers are: Don't use python 3. Don't use MySQL. Hopefully this makes the choice easier: http://grimoire.ca/mysql/choose-something-else REF: https://docs.djangoproject.com/en/dev/ref/databases/#python-3

Categories : Django

Django-allauth 0.8.1 Twitter integration
Best option is to update allauth to 0.8.3 or newer :) After hours of debugging and frustration , i finally had my answer. Twitter updated their API few months ago, so its not compatible with allauth == 0.8.1 anymore. allauth.socialaccount.providers.views.py Line - 17 url = 'https://twitter.com/account/verify_credentials.json' this should be url = 'https://api.twitter.com/1.1/account/verify_credentials.json'

Categories : Misc

Wordpress blog integration not working: Error Establishing a Database Connection
The problem is that the DB_PASSWORD conflicts with one that OpenCart apparently uses this. Changing DB_PASSWORD to DP_WPPASSWD (or a name of your choosing) solves the error. However I now have another error. Fatal error: Call to a member function main() on a non-object in /xxx/wp/wp-includes/functions.php on line 779

Categories : PHP

integration jquery upload file plugins with Django form
You can use a FormData object to upload a file via ajax function display_message(link, form) { var formData = new FormData(form); $.ajax( { url: link, type: 'POST', dataType: 'json', processData: false, contentType: false, data: formData, success: function(result) { //form not valid -> displays errors if (result.form_errors) { //append current errors to the html form errors=result.form_errors for (var key in errors) { $("#"+key+"_errors").html('<ul class="errorlist"><li>'+errors[key]+'</li></ul>'); //~ alert(key+': '+errors[key]); }

Categories : Jquery

django-allauth google integration gives "Social Network Login Failure" error
I've tried to access http://learnbuzz.com/accounts/google/login/callback and it requests http authorization. It is returning a 401 status code. Probably your browser is already logged in and you can't see this request for authentication. This page should be accessible from an anonymous browser windows. After you remove the need for authorization, it will work.

Categories : Django

functional tests=Integration Tests ?in django
You cannot compare these notions. The opposite to integration testing is unit testing. Unit testing - is testing different isolated parts (usually small code blocks) of your system separately - it's very focused, integration testing is testing how these different parts of your system work together - for example, url routing, logic in views, logging, querying your models etc. Functional testing is a type of black box testing that usually checks that some (usually documented) piece of functionality works as expected. You may have all sorts of tests in your django project: unit tests of different library, helper functions view tests (this could be already called integration tests, because it may include dealing with models, logging etc) ui tests (high-level tests, that could be called f

Categories : Django

Integration testing with spring integration
I'm not sure is this you want for integration tests. You can use Spring mvc test framework to test inbound gateway without starting up any server. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { /*omitted*/ }) @WebAppConfiguration public class HttpInboundGatewayIntegrationTests { private MockMvc mockMvc; @Autowired private WebApplicationContext wac; @Before public void setup() throws Exception { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test public void testInboundGateway() throws Exception { // mockMvc.perform(get("/api/searchResult"). param("aParam", aParam). param("anotherParam",anotherParam)). andExpect(status().isForbidden());

Categories : Spring

Django - Integrating django-profiles (and django-registration) with django-facebook
Here's how I suggest you do things. Do away with django-facebook and look into django-allauth. It will handle accounts (registration, logic, connecting social accounts). Also, django-profiles has many issues with 1.5+ for me and I don't bother with it and instead create my own profiles app and UserProfile model with any additional fields that wouldn't be handled by django-allauth. An example from one of my implementations class UserProfile(models.Model): user = models.OneToOneField(User) default_address = models.OneToOneField(Address, blank=True, null=True) default_tshirt_size = models.CharField(blank=True, null=True, choices=constants.tshirt_sizes, max_length=50) default_shoe_size = models.CharField(blank=True, null=True, choices=constants.shoe_sizes, max_length=50) Y

Categories : Python

PHP - Minimal merge that contains both arrays
Algorithm: Copy the smallest array in to the solution array. Iterate through the other array. If a new element is found=> Use this link to count the number of times an element has occurred in the other array Count how often a particular value appears in an array. Add the same. If an element is found that already exists in the resultant array, find the count of the element. If (count in other array >=count in result array) Add(count in other array - count in result array)*element to result array. Else: Do nothing. Here is the working php implementation of the above algorithm: <?php $a1=[1, 4, 7, 3, 3, 3]; $a2=[4, 0, 3, 4, 9, 9]; $size=sizeof($a1); $result=$a1; foreach ($a2 as $value) { if(in_array($value,$result)) { $p=array_count_values($a2)[$value] ; $q=array_count_va

Categories : PHP

Using Xpath in R: Why this (minimal) XML file not recognized?
You need to register the MediaWiki namespace and reference your chosen prefix in your XPath expression. See this other SO question . Something like titles <- xpathSApply(doc, '//mw:page/mw:title', xmlValue, namespaces= c(mw = "http://www.mediawiki.org/xml/export-0.8/")) This also works: titles <- xpathSApply(doc, '//x:page/x:title', xmlValue, namespaces= "x")

Categories : Xml

Soundcloud Minimal Page Oversize
I was looking at it and then refreshed the page and it seems that the code changed so I am figuring that you are playing with it. I'm not sure but before the change, I believe that it seemed like .sc.scrubber div was the issue. Try using max-width: 100% (or 95% I believe was in there) instead of just width: 100%.

Categories : Javascript

How to multiply two quaternions with minimal instructions?
Never mind. If I compile the code with gcc -msse3 -O1 -S instead, I get the following: .text .align 4,0x90 .globl __Z13_mm_cross4_psU8__vectorfS_ __Z13_mm_cross4_psU8__vectorfS_: LFB644: movaps %xmm0, %xmm5 movaps %xmm1, %xmm3 movaps %xmm0, %xmm2 shufps $27, %xmm0, %xmm5 movaps %xmm5, %xmm4 shufps $17, %xmm1, %xmm3 shufps $187, %xmm1, %xmm1 mulps %xmm3, %xmm2 mulps %xmm1, %xmm4 mulps %xmm5, %xmm3 mulps %xmm1, %xmm0 hsubps %xmm4, %xmm2 haddps %xmm3, %xmm0 movaps %xmm2, %xmm1 shufps $177, %xmm0, %xmm1 shufps $228, %xmm2, %xmm0 addsubps %xmm1, %xmm0 shufps $156, %xmm0, %xmm0 ret That's only 18 instructions now. That's what I expected in the beginning. Oops.

Categories : C

GenemuFormBundle select2 minimal configuration
Genemu is no longer maintained. The way I use it is just download the CSS and the JS from the official site and add class="select2" when I want to use it in a form and the autocomplete function does work.

Categories : Jquery

What is the minimal number of blocks of a SecureFile LOB?
Actually, minimum one block per LOB is incorrect. It can be much smaller, depending on the size of your LOB. From the Oracle docs LOB values are stored inline when any of the following conditions apply: When the size of the LOB stored in the given row is small, approximately 4000 bytes or less, and you either explicitly specify ENABLE STORAGE IN ROW or the LOB storage clause when you create the table, or when you do not specify this parameter (which is the default). When the LOB value is NULL (regardless of the LOB storage properties for the column). Using the default LOB storage properties (inline storage) can allow for better database performance; it avoids the overhead of creating and managing out-of-line storage for smaller LOB values. If LOB values

Categories : Oracle

How to resize an image in a stream (using minimal RAM)?
The FileImageInputStream doesn't know anything about specific image formats, it's just convenience for reading ints, shorts, bytes, byte arrays, etc, from a file-backed input. File format support is handled by the various ImageReader implementations. The short answer to your question is: You can't really resize an image without loading it. From the description of djpeg: djpeg decompresses the named JPEG file [...] (Emphasis is mine) However, you can subsample images, wich is really fast (for most formats), and will uses less memory. Have a look at the ImageReadParam.setSourceSubSampling method and the ImageReader.read(int, ImageReadParam) method. This will create a resized image, quite similar to the "nearest neighbour" or "point sampling" algorithms (ie. the results won't necessa

Categories : Java

mysql selfjoin on minimal difference
This is indeed possible. Unfortunately, MySQL is missing features that makes this easy. I would rank the rows, and then join by the rank: select p1.time as time1, p1.lat as lat1, p1.lon as lon1, p1.rank as rank1, p2.time as time2, p2.lat as lat2, p2.lon as lon2, p2.rank as rank2 from ( select position.*, @curRank1 := @curRank1 + 1 AS rank from position , (SELECT @curRank1 := 0) r order by time desc) p1 join ( select position.*, @curRank2 := @curRank2 + 1 AS rank from position , (SELECT @curRank2 := 0) r order by time desc) p2 on p1.rank = p2.rank -1 Here's the fiddle showing it in action: http://sqlfiddle.com/#!2/d777f/8

Categories : Mysql

list manipulation with minimal iteration
Does this work for you def findBiggest(L, val): """ Basically a modified binary search """ if len(L) == 1: return L[0] elif L[len(L)/2] >= val: return biggest(L[:len(L)/2], val) else: return findBiggest(L[len(L)/2:], val) def findOpens(opens, closes): for c in closes: opener = findBiggest(opens, c) opens.remove(opener) if opener == 0: print 'answer =', c return opener

Categories : Python

Minimal number of Increasing Subsequences
This could be done with simple greedy algorithm. Keep sorted array of subsequences found so far. Sorted in decreasing order, by the value of the last integer in each sequence. Initially empty. Get first not-yet-processed element from the sequence and find the subsequence where the last integer is smaller than this element but larger (or equal) than in all such subsequences. Use binary search here to get overall complexity O(N log N). If no such subsequence found, add a new one at the end of the array. Add this element to this subsequence. Repeat while there are not-yet-processed elements in the sequence.

Categories : Algorithm

How to create minimal Akka actor?
Here is a little benchmark that shows how to create actors in a hierarchy. I also get about 20 seconds for ~1000000 actors, but this is on a pretty slow notebook CPU and no tweaking of JVM options like useNUMA that you have in your benchmark. I tried to run your benchmark from github, and it wouldn't even start on my machine since it requires more than the 4GB of memory I have. So it seems that your notebook is way more powerful than mine. Here is what I get when I create actors in a two level hierarchy (1000 groups of 1000 workers each) Created 1001001 actors 20.752500989 s 48235.198279503136 actors per second Here is what I get when I create 1000000 actors directly below the root actor: Created 1000001 actors 56.118988558 s 17819.29834616461 actors per second So clearly there is

Categories : Scala

Jquery minimal execution time
.show and .hide are not animated unless you pass an optional argument as suggested by christian in comments. To use a fading effect you could use .fadeIn and .fadeOut. Which accepts an optional argument for speed (and accepts some constants like slow, fast).

Categories : Jquery

does append() always extend minimal capacity needed?
No, it's not guaranteed in this case. The specifications say: append(s S, x ...T) S // T is the element type of S If the capacity of s is not large enough to fit the additional values, append allocates a new, sufficiently large slice that fits both the existing slice elements and the additional values. Thus, the returned slice may refer to a different underlying array. (Emphasizes mine) In your case, clearly any capacity >= 3 is sufficiently large, so you can rely on cap >= 3, but you cannot rely on cap == 3. Of course you can assume cap in this case will not be, say 1e6 or 1e9 or 1e12. However, the exact enlarging (allocating new backing array) strategy is intentionally not specified in every detail to allow the compiler guys to experiment with some knobs attached to this me

Categories : Go

How to find minimal set of operations to meet requirements
This is a hamiltonian path problem, or maybe a Traveling Salesman Problem(if you modify the problem a little bit). Each job needs a certain amount of tools, and you can determine how many commands are needed to get from one job to the other. You want a path through that graph that minimizes the "distance" in terms of additions/removals and visits all nodes/jobs.

Categories : Java

How can I ensure minimal CPU optimizations will be used for my GNU/C++ program and associated libraries?
Seems like slowing the whole simulation down for the weakest link. You might want to investigate the ifunc function attribute for GCC, that uses a special STT_GNU_IFUNC ELF symbol / section. Essentially, you get function selection based on the processor. A search should come up with some more concrete examples than the GCC manual description.

Categories : C++

Code returns minimal m s.t P(X>m)=1/n^2 for binomial experiment
The following version of your program seems to do what you want. The problem with your version as far as I can tell is that you did not include m=0 into your sum of P, thus 1-P was consistently too large. It's always a good idea to ask the program to spit out numbers and compare to paper-and-pencil calculations. function [m,P] = intpq3(n,varargin); if nargin==2 plt=varargin{1}; else plt = 0; end flag=0; par=1/n^2; m=0; P=0; disp(['1/n^2 = ' num2str(par)]); %Since X is non-neative integer if(n==1) m=-1*Inf; else while m<n & flag==0 P=P+nchoosek(n,m)*(1/n)^m*(1-1/n)^(n-m); disp([' n= ' num2str(n) ' m= ' num2str(m) ' P(X>' num2str(m) ') ' num2str(1-P)]) if(1-P<=par) flag=1; end m=m+1; end end disp

Categories : Matlab

Minimal way to make a cleanable drawing area
Consider: Drawing in a paintComponent(...) override, not a paint(...) override. Save a List<Point> where each Point is normalized, say to a 1000 by 1000 size. Then in the paintComponent method, iterate through each Point in a for loop, scaling it to the current component size, and drawing it. You'll want to scale any image drawn in the component in a ComponentListener, and then call repaint(). Or perhaps even better, scale the image drawn using the Graphics#drawImage(...) overload that takes width and height parameters. e.g., import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.*; public class MyBackground extends JPanel { privat

Categories : Java

defining a minimal bounding circle in matlab
Note: I don't believe that the circle you drew is the smallest possible bounding circle. It should be a little smaller, up and to the right, and should touch at least two points on its perimeter. Approaching the problem We have a set of points, and we want to draw a circle that encompasses all of them. The problem is that you need three bits of information to define a circle: the X and Y coordinates of the circle's center, and the circle's radius. So the problem doesn't seem straightforward. However, there is a related problem that is much easier to solve. Suppose the circle's center is fixed. From that point, we make a circle grow concentrically outwards so that it becomes bigger and bigger. At some point, the circle will encompass one of the points in our set. As it gets bigger

Categories : Matlab

CentOS 6.4 Minimal + how to configure jenkins jobs via xml?
It's a bit impractical to configure Jenkins via XML by hand, because Jenkins' configuration is spread over multiple files, and the format of the configuration files changes between releases. Given that Jenkins is a web application, you should be able to visit port 8080 (Jenkins' default port, assuming you didn't change it) on the server where you installed Jenkins (e.g. http://mycentosserver.example.com:8080), and configure it via the web interface. If you're unable to access the web interface because of a firewall or similar, but you are able to SSH to the server (presumably you can, given that you were able to install stuff on it), you could set up an SSH tunnel to forward a port on your local machine to port 8080 on the server. For example, from your local machine, run the following c

Categories : Maven

Minimal Complete Definition Annotations for Haskell
It looks like this may be in progress. http://ghc.haskell.org/trac/ghc/ticket/7633 (and related: http://ghc.haskell.org/trac/ghc/ticket/6028) It looks like it is set to be integrated in GHC 7.8.1. UPDATE Here's the minimal pragma in GHC 7.8.

Categories : Haskell

Minimal files needed to deploy ASP.NET App to the Web Server
Yes, you can xcopy your web.config, global.asax and all .aspx files to the server, which is essentially what the Publish command in Visual Studio does. There is also the option to create a new Profile when doing a Publish via Visual Studio and have the files published to a directory so you can see what would have been pushed to an actual server before actually doing it. I use this as part of our deployment process to have a copy of the code that gets deployed to each of our testing environments.

Categories : C#

Bootstrap 3 column layout with minimal additional div/row markup
Check if http://www.bootply.com/64966 is close to what you are after. I put each pair of product divs inside nested rows (more about fluid nesting here). Good luck! <div class="container"> <h1></h1> <div class="navbar navbar-inverse"> <div class="navbar-inner nav-collapse" style="height: auto;"> <ul class="nav"> </ul> </div> </div> <div id="content" class="row-fluid"> <div id="main" class="span9"> <h2>Main</h2> <div class="row-fluid"> <!-- start nested row --> <div class="product span6"> <p>Item 1</p> </div> <div class="product span6">

Categories : Twitter

JavaScript/jQuery : One ID, two functions. How can I do this with minimal code duplication?
If you really want something dryer... [this._dropFiles, this._handleFileDrop].forEach(function(fun){ document.getElementById(this.config.dragArea).addEventListener("drop", fun); }); Note that a shim for forEach is required on IE8. You could also more reasonnably simply store document.getElementById(this.config.dragArea) in a variable and reuse it.

Categories : Javascript

Jersey + Embedded Tomcat Minimal Maven Configuration
I would go for webapp-runner to run the web app. It deploys the maven generated war from /target into a built in tomcat container. This is how java applications gets deployed on Heroku. pom plugin configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactIt

Categories : Maven

minimal socket server written in python for openshift
It doesn't look like OpenShift lets you just run an application like that. You can see a howto guide here: https://github.com/giulivo/openshift-hellotornado

Categories : Python

LD_PRELOAD and weak references minimal example doesn't work
As far as I know, external functions are resolved only when you call them. So, your test if (f_weak) will always fail. If you do it the following way, you can see that it works: weakref.c: #include <stdio.h> #include "weakref.h" void f_weak(){ printf("original "); fflush(stdout); } weak2.c: #include <stdio.h> #include "weakref.h" void f_weak(){ printf("overridden "); fflush(stdout); } test_weakref.c: #include <stdio.h> #include "weakref.h" int main(void) { f_weak(); fflush(stdout); return 0; } and then: tmp> gcc weakref.c -shared -fPIC -o libweakref.so tmp> gcc weak2.c -shared -fPIC -o libweak2.so tmp> gcc -o test_weakref test_weakref.c ./libweakref.so tmp> ./test_weakref original tmp> LD_PRELOAD=./libweak2.so !. LD_PRELOAD

Categories : C

granting minimal permissions during facebook "Login Flow for Web"
For reference, since I spent a good amount of time researching an answer to that question, I believe that it is impossible to explicitely not request permission from the user to see his list of friends. The Facebook documentation hints at this by stating that these are the "default" permissions that every application gets.

Categories : Facebook



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