w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Build new joomla Component in Legacy or Native classes?
If you are starting Joomla! development right now, my opinion is to start using the legacy classes. From my knowledge, the legacy support will be in the next major release (3.5) as well in the current STS releases (3.1, 3.2). What is going to happen in the future is rather a thing that will be discussed, software is evolving, so is Joomla. You should learn using the legacy classes because: you will find most of the documentation / books / support about them core components are build using them (and understanding how core components work, is a key to your success in developing extensions). Native classes: are rather poorly documented not so many examples (for example just the Joomla installer is using them) not so many use them, so getting support might be rather difficult it good t

Categories : Joomla

orde links by their hosts - from a multi link textarea to a table ordred by host (colomn n = host n contains all links of that host)
According to what you've described , you just need a function that will sort the links by the abc. function just_host($link) { return array_shift( explode( '.', str_replace('www.', '', parse_url($link, PHP_URL_HOST)))); } $multi = $_POST['multi_links']; //$_Post is not right , all upper-case! $links = explode(" ", $multi); $links = array_map($links , 'just_host'); //Call the 'just_host' for every link and update the value in the array. sort($links); //Sort the array foreach($links as $link) //Instead of 'for' , use 'foreach' { echo $link . "<br />"; } Should work , please update me if not and I'll edit it.

Categories : PHP

How could a local user on a host use a buffer overflow attack to get root access to the host?
Usually, it's about exploiting a vulnerability in a process that runs as root: Either a server that accepts connections (sockets, pipes, etc.) or an executable with the SETUID flag. If by "gain root access" you mean take control of a shell running as root, the buffer overflow payload must start a shell and use dup2 to redirect its input and output to something the attacker controls (such as a socket connection to a "command and control" server running on the attacker's machine).

Categories : C

How to transfer a Wordpress site from Bitnami (local host) to a live host online?
I had a similar problem. To get my particular site working, I added the following code to my configuration file: define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com'); After adding the lines, my CSS and uploaded images came back. Don't forget to replace example.com with your site's domain name. I found that code at: http://codex.wordpress.org/Changing_The_Site_URL. Actual user results may vary.

Categories : Wordpress

PHP verify Baidu search engine by host when web host DNS server returns only IP
I was able to use a different DNS server via the host command via shell... $p = trim(trim(explode(' pointer',shell_exec('host -W 2'))[1]),'.');

Categories : PHP

MySQL "Unable to connect to host [host] because access was denied."
Did you issued the flush privileges after granting access to the wildcard user? What happens if you add an entry with user = sadmicrowave and host = [your actual ip] (don't forget to issue the flush privileges command after adding the user) ?

Categories : Mysql

How do I resolve "Missing host to link to! Please provide the :host parameter"? (RoR)
The problem may be that you have not defined default_host for test environment. Define default_host inside config/environments/test.rb like this: config.action_mailer.default_url_options = {:host => "localhost:3000"}

Categories : Ruby On Rails

"Unsatisfied native code filter" when exporting OSGi bundle containing native Android lib
It seems like the target platform defined under 'Window -> Preferences -> Plug-in Development - Target Platform' prevented the export to succeed. I added a new entry copying the settings from my current target platform (chose option 'Current Target'). There, I changed under 'Environment' the 'Architecture' value to 'arm'. As 'arm' was not an option provided by the drop-down list, I typed it manually into the text field. That's it. When using this target configuration, everything works fine now. The bundle is exported successfully and I can use it on my Android device.

Categories : Android

Java - Custom allocator interface for native/non-native routines
The declaration of the memoryPool variable must use the correct type parameter. You don't say what T is; whatever it is it's incompatible with double[][]. DynamicMemoryPool<double[][]> memoryPool = new DynamicMemoryPool<double[][]>(200, false, new JavaAllocator(), size);

Categories : Java

WCF service streaming - Console host vs. IIS host
How do you know its buffered? Check the config file on the client side after proxy generation. Sometimes the proxy generated config file has incorrect transfermode. When you start writing the file on the client, don't any see any chunk wise increase in the size of file? The hosting shouldn't affect the transfermode. The only difference between IIS and Console would be the way activation/deactivation is managed.

Categories : Wcf

Multiple java threads using native interface vs single java thread for multi threaded native
From a design perspective, I would prefer approach #1 because it means that you don't have to manage threads in your JNI code. This adheres to the "single responsibility principle": your native code only needs to change if your algorithm changes. I also think that the facilities (threadpools and futures) that Java provides are easier to use than direct threads. However, if you do this you should pay particular attention to the warning about pinning and unpinning arrays from multiple threads. A better approach IMO is to allocate a direct ByteBuffer, and access it from JNI using GetDirectBufferAddress. This would let you use a Java-side threadpool to manage the work, and would eliminate any native-side concerns about buffer copies.

Categories : Java

Unable to load native-hadoop library for your platform...Snappy native library not loaded
http://hadoop.apache.org/docs/stable/native_libraries.html "The native hadoop library is supported on *nix platforms only. The library does not to work with Cygwin or the Mac OS X platform."

Categories : Java

Hadoop compression : "Loaded native gpl library" but "Failed to load/initialize native-lzo library"
I was having the exact same issue and finally resolved it by randomly choosing a datanode, and checking whether lzop was installed properly. If it wasn't, I did: sudo apt-get install lzop Assuming you are using Debian-based packages.

Categories : Hadoop

Legacy vbscript to c# equivilent
The translation could be something like this: public long PHash (string pValue) { int dValue; double dAccumulator; int lTemp; string sValue; sValue = pValue.Trim().ToUpper(); dAccumulator = 0; for (lTemp = 1; lTemp <= sValue.Length; lTemp ++) { dValue = (int)char.Parse(sValue.Substring(lTemp, 1)); if ((lTemp % 1) == 1) { dAccumulator = Math.Sin(dAccumulator + dValue); } else { dAccumulator = Math.Cos(dAccumulator + dValue); } } dAccumulator = dAccumulator * (long)(10 ^ 9); return (long)(dAccumulator); } The function translated were: Trim: Removes spaces on both the left and the right side of a string. In C#: Trim(). UCase: Converts a specified string to uppe

Categories : C#

WCF, XML WebService, Legacy Techonology
Jump to Answer Personally, I would prefer WCF (the "new" way) over ASMX (the "old" way - ref: the link you provided to the MSDN site)

Categories : Dotnet

How to get string in .NET from legacy StrPtr
You must remember that the address of a pointer is relative to a specific process. So, the pointer you send (which just becomes an integer) means nothing to the receiving process (it'll just be a random address to unrelated memory). You should use WM_COPYDATA instead: http://msdn.microsoft.com/en-us/library/windows/desktop/ms649011%28v=vs.85%29.aspx

Categories : Dotnet

One route to handle new url and legacy url
By default, the routes will not accept anything after the ? as part of the page being routed to since by definition the ? separates the query string from the resource in the URL. One way that might work is routes.MapPageRoute("blog-slug", _ "blog/", _ "~/blogArticles/Default.aspx") But the "financial-literacy-efficacy" value will instead be a key since it is ?x not ?slug=x. However, since that is the legacy url, there might already exist some portion of your code that checks keys in query strings as opposed to values since most dynamic webforms legacy urls look soemthing like blog/?slug=x And then they check Request.Querystring["slug"]. You would need to provide more information in your question if that causes you trouble.

Categories : Asp Net

CakePHP Support Legacy URL
You need to have the server respond with a permanent redirect 301 code to the new address. This will be cached by browsers, and also tell search engines to drop the old content from their indexes. The easiest and fastest approach would be to create a page.php file in your webroot that issues the redirect. <?php if(isset($_GET["hash"])) { $location = "/controller/action/hash:"+$_GET["hash"]; header ('HTTP/1.1 301 Moved Permanently'); header ('Location: '.$location); } else { header('HTTP/1.0 404 Not Found'); } I have no idea where it needs to redirect too, but that was just an example.

Categories : PHP

Adding Ninject to Legacy Project C#
I don't think there's a set best practice, other than use common sense - it's kind of a case by case scenario. A few important questions to ask yourself: How much effort is going to be required to create interfaces for the current classes? How much additional effort is going to be required to write proper unit tests? Will these unit tests add more value than the time spent? How long is this legacy system even going to be maintained? There's nothing worse than doing a huge upgrade (requiring testing not only by the development staff, but by the product user) to replace it in 18 months. Also, how long has this legacy system been in place without issue? There's no reason to invent work if it appears stable and really has low maintenance.

Categories : C#

Receive double value in WndProc from legacy
You could create a structure to store your float/double values and pass the address of that structure in the lParam value. If you are Posting the message rather than Sending it, you will need to get the recipient to free the memory occupied by the structure. #define MYMESSAGECODE (WM_APP + 123 ) typedef struct { float f; double d; } MyDataStruct; MyDataStruct data; data.f = 1.0; data.d = 2.0; pWpfWnd->SendMessage( MYMESSAGECODE, 0, (LPARAM) &data );

Categories : Wpf

Legacy CSS conflicts with Bootstrap - how to resolve?
I think the easiest way is to use a css pre-processor to namespace all of bootstraps css components. If you got to their github repo: https://github.com/twbs/bootstrap/ you will see they have a LESS distrubution of the code. From there, you can namespace all of their styles by wrapping the library in some kind of class, such as millimoose mentioned. From their you can add the bootstrap namespace to certain html elements, and the library will only effect that dom node and its children.

Categories : Twitter

jQuery redefined by requirejs in legacy app
Firstly, you may have an error in the code. The selector "#container .input" refers to a class of input, whereas the other code refers to #input, i.e. the id input. The following jsfiddle example will work as intended. The example doesn't use RequireJS to load jQuery at all. Instead, it defines the jquery module explicitly, after loading jQuery with a regular <script> tag. This will ensure that the global jQuery object and the AMD jquery module value are one and the same thing. Therefore keeping a single jQuery to register events with, etc. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script src="http://requirejs.org/docs/release/2.1.6/comments/require.js"></script> <script>define("jquery", function() { ret

Categories : Jquery

RequireJS and legacy in page code
I'm really wary about what I'm about to suggest, as I think this is an unfortunate problem of things being incorrectly designed originally; you're sort of running against the basic way Javascript works. I'd really prefer to think of this kind of issue as "job security" for the person assigned to re-make this stuff as outside-of-HTML code. But if you want to hear it, I do have a possible solution that uses eval. For that alone, I think I'm going to be downvoted, and not without good reason. I haven't even tested this (except for the 'script with alternate type' and its selection), but seeing this question had two upvotes, no answer, I figure I'll suggest it. So, you're going to have to evaluate it with its potential security risks. Start by replacing in-page scripts with this: <script

Categories : Javascript

LightTable IDE legacy REPL mode?
Light Table uses leining for the project management, so you can very easily keep repl open in another window connected to the same project to get the traditional REPL expierence. This lets you switch between the two quickly. Light Table is evolving rapidly and who knows if standalone repl mode has been added since I last looked or will be added soon.

Categories : Clojure

Using MD5 in symfony2 security.yml for legacy users
Turns out that the md5 in symfony2 uses a salt by default. There may be an easier way, but I just created a custom md5 password encoder interface that ignores salt. Register a service namespace.project.md5password.encoder: class: NamepspaceMyBundleServicesCustomMd5PasswordEncoder Create the encoder service namespace NamespaceMyBundleServices; use SymfonyComponentSecurityCoreEncoderPasswordEncoderInterface; class CustomMd5PasswordEncoder implements PasswordEncoderInterface { public function __construct() { } public function encodePassword($raw, $salt) { return md5($raw); } public function isPasswordValid($encoded, $raw, $salt) { return md5($raw) == $encoded; } } Use the new service in security.yml security: encoders: Namesp

Categories : PHP

AdMob Legacy Publisher ID not showing ads
I got this response from Google AdMob Hello, Thanks for contacting AdMob support. Our engineers have fixed this issue. Ads should now be serving correctly. Your reporting should return to normal within 24 hours. Thanks for your patience, The Google AdMob Team Looks like all is good now...On Aug 8th and 9th they had the problem, but for the past 5 days it has been stable. Check out this fill rate...been >99% for the past five days.

Categories : IOS

Map domain model to legacy database
I suppose that you use JPA annotations to declare your mapping. First problem. Just do not apply @GeneratedValue annotation. public class SomeEntityWithAutogeneratedId { @Id @GeneratedValue // autogeneration private Long id; } public class SomeEntityWithoutAutogeneratedId { @Id private String id; } Second problem. You can prepare a base class to simplify mapping of common fields. Then you can use @PrePersist to apply correct values for all necessary fields before update: public abstract class AbstractEntity { @Column private Date dateLastModified; @PrePersist public void beforePersist() { this.dateLastModified = new Date(); } } public class Entity1 extends AbstractEntity { public class Entity2 extends AbstractEntity { public class En

Categories : Hibernate

Automate a legacy Java application from C#
It is helluva easy to decompile the jar file. Just download the (currently) most widely used java decompiler, click File -> Open and open your jar file. You can then browse the code in the main window, and copy and paste it to actual files.

Categories : C#

VB6 Legacy Code can't "Call Shell"
command.com does not exist on 64 bit windows. Try using C:WindowsSysWOW64cmd.exe instead. C:WindowsSysWOW64 is a folder giving you backwards compatibility stuff for 32 bit. But see the comment below (taken from Euro Micelli). Really you should use %SYSTEMROOTSystem32cmd.exe instead. First, Windows is not always installed in C:Windows; you should let the system figure that out. Second, using System32 is always correct for a 32-bit application: when running on Win32, it is the correct folder; when running on Win64, Windows will map %SYSTEMROOT%System32 to %SYSTEMROOT%SysWOW64

Categories : Shell

Importing legacy database into django
In the documentation on the django website it states "In particular, you’ll need to rearrange models’ order, so that models that refer to other models are ordered properly." What exactly does this mean? In Python in general, in order to refer to any name, it needs to be defined first; because only then is it mapped; so this will result in an error: print(hello) hello = 'world' Similarly, in models.py, when you are referring to another model class in any relationship; you have to make sure the class is declared before it is referred to - or you need to quote the class name. Since the inspection cannot guaratee the order of models being created, you get the warning. It is designed to prevent this scenario, which will result in an error: class A(models.Model): foo =

Categories : Django

How to listen to a jQuery trigger in legacy js
Use dispatchEvent: window.dispatchEvent(new CustomEvent('test')); You could easily create a wrapper: $.fn.nativeTrigger = function(type) { return this.each(function() { this.dispatchEvent( new CustomEvent(type) ); }); } $('body').trigger('test').nativeTrigger('test'); Another way would be to extend the $.fn.trigger but that’s pretty deep water.

Categories : Javascript

Enable Cloud SQL for GAE Legacy Project?
Cloud SQL Instances are not restricted to work only with AppEngine apps in the same project. You can just create a new project at https://cloud.google.com/console (which will have Cloud SQL enabled), and from that project create a new Cloud SQL Database. Just make sure you replace the default authorized AppEngine project with the old one on the Create screen.

Categories : Google App Engine

Legacy collection querying before LINQ
Before LINQ you were just limited to all the built-in List/List<T> methods, and yes Find is one of them (still is). The difference is it expects a Predicate<T> as opposed to a Func<Boolean, T> which you can still do inline e.g. var found = list.Find(delegate(Item item) { return item != null; }); Or as you demonstrated by using a named method.

Categories : C#

Get legacy params[:action] to work in Rails
This will help http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-request_parameters You can get access to parameters using request.request_parameters() or something like that and use them.

Categories : Ruby On Rails

Legacy Installed Application Classpath Fiasco
Did you try prefer-application-packages within the weblogic-application.xml as well? The mechanism that Weblogic calls the Filtering Classloader, here are the links: http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/classloading.html#wp1097187 http://hasamali.blogspot.in/2011/08/weblogic-identifying-class-conflict-and.html http://atheek.wordpress.com/2011/12/20/weblogic-filtering-classloaders/

Categories : Java

Converting from MD5 Legacy Auth System to CakePHP
Figured it out thanks to this answer (albeit lightly modified). Basically, it updates the user behind the scenes to use the new system if the current system doesn't match up with it. /** * Login method */ public function login() { $this->layout = 'homepage'; // If the user is already logged in, redirect to their user page if($this->Auth->user() != null) { $this->redirect(); } else { // If this is being POSTed, check for login information if($this->request->is('post')) { if($this->Auth->login($this->loginHelper($this->request->data))) { // Redirect to origin path, ideally } else { $this->Session->setFlash('Invalid username or password, try again');

Categories : PHP

How can I update a label after a legacy drop-down box value is changed?
The legacy controls are members of the Selection.FormFields collection. The do not have events, the nearest equivalents are the EntryMacro and ExitMacro properties. Sub Macro2() Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown Selection.PreviousField.Select With Selection.FormFields(1) .Name = "Dropdown1" .EntryMacro = "Macro1" .ExitMacro = "Macro2" .Enabled = True .OwnHelp = False .HelpText = "" .OwnStatus = False .StatusText = "" End With Selection.FormFields("Dropdown1").DropDown.ListEntries.Clear End Sub The ExitMacro doesn't run on selecting, or changing, a drop-down item, but when tabbing away from the control. There is some MS information here about these legacy controls

Categories : Vba

MySQL Legacy Code using CURRENT_DATE with inaccuracies
There are a few ways date comparisons can go wrong. None of them have anything to do with CURRENT_DATE, which has standard, well-defined, consistent behavior. First, php usually executes on the web server; CURRENT_DATE executes on the database server. Sometimes the web server and the database server are the same machine, but sometimes they're not. Two different servers might be operating with mismatched clocks. And it's at least theoretically possible for the web server and the database server to be in (or to be set to) two different time zones. I've never seen servers set up that way myself, but it's possible. Second, your PHP expression returns a string (not a date) in the form of a timestamp (not in the form of a date). CURRENT_DATE returns a date. They're not the same data type. Com

Categories : PHP

What Benefit Generics provide over legacy Code:
List<Object>= new List<Object>; list.add("hello"); String s=(String)list.get(0); Should be List<String>= new ArrayList<String>(); // this is now a list of String, not a list of object ^^^^^^ ^^^^^^ list.add("hello"); String s=list.get(0); // no casting needed ^ You parameterize by the type you want. Your example are 2 ways to do the same thing, since you parameterize by the most basic class. The advantage of generics is that you can write classes that are more specific to one class, String here. This gives you better type safety to catch bugs early during compilation. This prevents issues arising from the casting approach.

Categories : Java

Apache .hatccess rewrites not working for legacy URLS
The first thing is the stray RewriteCond %{HTTPS} !=on that you have at the top. It looks like it belongs to the rule under it, as in: RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} !^www..+$ [NC] RewriteCond %{HTTP_HOST} (.+)$ [NC] RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] As far as the rule that you have commented that doesn't work, the ? is a reserved character for regular expressions, and your pattern actually says that the second p in /index.php is "optional". Additionally, you can't match against the query string in a rewrite rule, you need to use a rewrite condition and match against the %{QUERY_STRING} variable: RewriteCond %{QUERY_STRING} ^option=com_chronocontact&Itemid=54$ RewriteRule ^(index.php)?$ /contact/? [R=301,L] is probably more along the lines of what

Categories : Apache

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