w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
what's the prob with this code?
The variable v is vector<char const*> in the statement execvp(subcommand[0].c_str(),v);, while the declaration of evecvp is int execvp(const char*, char* const*).

Categories : C++

code stopped working after upgrading jquery library to version 1.10
.browser() was removed in jQuery 1.9 http://api.jquery.com/jQuery.browser/ You should use the jQuery Migrate plugin to check your scripts when upgrading. http://jquery.com/upgrade-guide/1.9/#jquery-migrate-plugin

Categories : Javascript

Rails caching my code after upgrading to Ruby 2.0 on Mac OS X Mountain Lion
If you also upgraded recently from an older Rails version. If that is the case, note that lib is not autoloaded in Rails 3. You are talking about helper modules and controllers which should still be autoloaded, but lib won't be. You can change it to be autoloaded as noted in this answer, add another autoloaded dir, or move those classes until an existing autoloaded directory (e.g. app/models, if that is appropriate). If you have stuff configured in config.autoload_once_paths then that could be a problem for reloading those, otherwise they should be reloaded per request per the guide (and you can look at the code here if you're curious about what is going on). Also, check to make sure you are really running in development mode and note that you can't add lib to config.eager_load_paths in

Categories : Ruby On Rails

Upgrading a code signed Mono app causes KeyChain to stop access without reboot
We finally managed to get the answer and, as ever with coding, once we fully understood the situation the cause was obvious. Our auto-upgrade process replaces the contents of the OSX .app A .app 'file' is just an archive/directory so it's contents can be replaced in-situ by the auto-upgrade An assets that don't match those signed will cause a signing issue SO, just ensure the contents of the .app file matches the signed version. We had a single app version that contained an old file no longer used. As it wasn't being deleted the contents didn't match the signature.

Categories : Osx

odbcpp32.lib linking error after upgrading code to Visual Studio 2010
It is a KNOWN bug in odbccp.lib included with the PSDK 7.1. Simplest workaround, just add this code to one of your sources: //---------------------------------------------------// #include <stdio.h> #include <wtypes.h> extern "C" int _imp___vsnprintf( char *buffer, size_t count, const char *format, va_list argptr ) { return vsnprintf( buffer, count, format, argptr ); } //---------------------------------------------------// It resolves the missing external, by creating a wrapper with the missing name and redirecting it to the correct statically linked symbol. Worked for me. :-)

Categories : C++

Launching application fails with error code 0xc000007b after upgrading 32-bit project to 64-bit
When using a manifest for enabling visual styles on common controls, you must not forget to upgrade the manifest file for your x64 project. It's easy to oversee this issue, as you probably only create your manifest file once and then never touch it again. Your manifest file might contain a section like this: <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"/> This makes Windows search for a 32-bit version of the common controls. To fix this issue, you will have to replace all occurences of "x86" in the manifest file by "amd64", or simply "*" (to make it work on all platforms). Don't forget to create a separate manifest for the 64-bit ver

Categories : Windows

SaxParser concatenation prob
The characters(char ch[], int start, int length) method does not read full lines, you should store the characters in a StringBuffer and use it in the endElement method. public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equalsIgnoreCase("event")) { System.out.println(sb.toString()); } sb = new StringBuffer(); }

Categories : Java

ListView Refresh Prob
Call notifyDataSetChanged() on your Adapter. Some additional specifics on how/when to call notifyDataSetChanged() can be viewed in this Google I/O video.

Categories : Android

nopCommerce 2.3 source code upgrading to nopCommerce 3.0
Use a source control tool like TFS with your modified 2.3 as one branch and the new 3.0 as another. Merge the two branches and use the SQL update scripts provided by NopCommerce. You'll need one for each version (2.4, 2.5, 2.6, 2.65, etc). If all you changed are controllers and views then you can auto-merge the rest and do just those files "by hand" in the merge tool.

Categories : Asp Net Mvc

i'm trying to work with sqlite, having prob regarding this tutorial
Just place it in your activity somewhere, but I really don't like that tutorial. You don't want to create a database multiple times so you're going to have to check if it is created already. It's extending SQLiteOpenHelper but with an empty implementation for the actual useful parts. If you're doing an actual extension of SQLiteOpenHelper - all you have to do is the first line (DataBaseHelper myDbHelper = new DataBaseHelper(this);) in your activities onCreate(). Check this out.

Categories : Android

glade and pygtk (probably a charset prob?)
 is a backspace character, AFAIR; you should escape the backslash: >>> print "C:lubb.glade" Clubb.glade >>> print "C:\blubb.glade" C:lubb.glade

Categories : Python

parsing xml ... ithink the prob. is about encoding
In your readSta method, instead of using : if (name == "true"){ return true; } use: if (name.equals("true")){ return true; } Try this once.

Categories : Java

Solving knapsack prob in F#: performance
When you naively apply a generic memoizer like this, and use continuation passing, the values in your memoization cache are continuations, not regular "final" results. Thus, when you get a cache hit, you aren't getting back a finalized result, you are getting back some function which promises to compute a result when you invoke it. This invocation might be expensive, might invoke various other continuations, might ultimately hit the memoization cache again itself, etc. Effectively memoizing continuation-passing functions such that a) the caching works to full effect and b) the function remains tail-recursive is quite difficult. Read this discussion and come back when you fully understand it all. ;-) The author of the blog post you linked is using a more sophisticated, less generic memo

Categories : Performance

x86 assembly language homework prob
You're right about the test and jg; it does indeed loop until ecx is zero. lea I'm not very familiar with AT&T syntax, so I'll use Intel syntax (which I find more intuitive) instead. I hope it's still intelligible. (One of the main differences is that Intel syntax puts the destination first.) Some instructions let you load a value from an address: mov eax, [esi] ; load a DWORD from the address in ESI You can change these to add offsets: mov eax, [esi + 4] ; load a DWORD from four bytes after the address in ESI Certain combinations of registers, scales, and offsets are allowed: mov eax, [esi + ecx * 4 + 16] ; load a DWORD from (ECX * 4 + 16) bytes after the ; address in ESI This is rather convenient; you don't need to calculate the effective

Categories : Assembly

The Josephus prob using a circular list in O(n)
I solve this problem with a circular linked list in O(n) time at my blog. That web site also has an O(n) solution using a queue and an O(n^2) solution using a plain (not circular) linked list. With a circular linked list you always move forward, never backward, as you are suggesting with the doubly linked list. As an example, look at your list. You start at 0, count 3, and delete item 3. Then count 3 and delete 0. Then count 3 and delete 4. Then count 3 and delete 2. Then count 3 and delete 5. Finally count 3 and delete 1. The total number of steps taken is kn, where n is the number of nodes and k is the step size. But this is O(n) in the number of nodes, since n is the problem size and k is a constant.

Categories : Algorithm

Assembly strlen input prob
Here is two examples easy to understand on how to use stdin and stdout in assembly : STDIN You were right, the input length is stored in one of the register : ; read a byte from stdin mov eax, 3 ; 3 is recognized by the system as meaning "read" mov ebx, 0 ; read from standard input mov ecx, name ; address to pass to mov edx, 1 ; input length (one byte) int 0x80 ; call the kernel If I remember right, stdin does not take in count the carriage return. But you should test it to be sure. STDOUT Your implementation was correct, but I give you mine with the comment : ; print a byte to stdout mov eax, 4 ; the system interprets 4 as "write" mov ebx, 1 ; standard output (print to terminal) mov ecx, name ; pointer to th

Categories : Assembly

What is the right way of using c++ stl iterators instead of traditional pointers?
What you see is due to the fact that const_iterator's correspond roughly to pointers to const. So you can change the value of the iterator, i.e. make it point somewhere else, but you cannot modify what it points to. This is different from const iterators, which would not allow incrementing or decrementing them. Here is an example: #include <vector> int main() { std::vector<int> v{ 1, 2, 3 }; std::vector<int>::const_iterator i = v.begin(); *i = 10; // ERROR! ++i; // OK std::vector<int>::iterator const ci = v.begin(); *ci = 10; // OK ++ci; // ERROR! }

Categories : C++

Access the Add-on SDK from within a traditional XUL-based add-on?
The following is the way devtools does it, but certain modules will choke (the obvious candidate being self). I think you will have better luck with low-level modules. let {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {}); let loader = new Loader.Loader({ paths: { "": "resource://gre/modules/commonjs/" }, globals: {}, }); let require = Loader.Require(loader, { id: "myaddon" }) // now you can require addon-sdk modules

Categories : Firefox

Very Simple Lambda /Event Parameters Prob
Use it as an additional argument to the sender and the eventargs: PD.PrintPage += (sender, ev) => this.pd_PrintPage(sender, ev, MyReader); //... private void pd_PrintPage(object sender, PrintPageEventArgs ev, StringReader reader) { //... } You specify the arguments PD.PrintPage has (object sender, PrintPageEventArgs ev) in the parentheses, and then the function you want to use after the => operator.

Categories : C#

Assign one NSMutableDictiory to another NSMutableDictionary giving prob
try this NSMutableDictionary *LocalDict=[[[NSMutableDictionary alloc]initWithDictionary:serviceResponse] mutableCopy]; Note: it makes a shallow copy. It isn't going to make immutable objects within your mutable dictionary. hope that helps.

Categories : IOS

Asp.net Dynamic controls dropdownlist and textbox prob
On SelectedIndexChanged on the dropDownList call a function that sets the textbox enabled = true. To access controls that have been dynamically added you can use FindControl as per C#, FindControl

Categories : Asp Net

-bash: sudo: command not found Mac OS X (EC2 CLI prob?)
As stated in the comments the right files to set up your $PATH variable are: ~/.profile or ~/.bash_profile export PATH=/usr/bin:/usr/sbin:/bin:/usr/local/bin:/sbin:/opt/x11/bin:$PATH In this way when you re-enter in the console your PATH will work fine. You can add other directories to your $PATH as you like. If you just copy and past that line in an active console you just set the PATH variable temporary, when you logout and login again you will loose your path, so add it in your ~/.bashrc file.

Categories : Osx

understanding add (Erf prob) to the context of the instance declaration errors
If you look at the documentation for Data.Number.Erf, you see there's class Floating a => Erf a where erf :: a -> a This means that the erf function is part of the Erf class. It's type is erf :: Erf a => a -> a. That means that you need to add Erf a to the context (bit before the =>) of the type of any function that uses it on an a, to make sure that erf is defined for values of type a. In this case, you've already called that type prob, so we need Erf prob. In fact, since Floating is a superclass of Erf, anything that's an instance of Erf must already be an instance of Floating, so you don't need to specify that explicitly. This means you could write instance (Erf prob) => CDF (Normal prob) where ...

Categories : Haskell

MongoDb - Equivalent for traditional update-set-where
In mongo shell there is no such function as multiply element. There are few field update operators, but in your situation you need to run a custom forEach script: db.users.find({ empno: { $in: [1,2,3]} }).forEach(function(e) { e.sal = e.sal * 1.2; db.users.save(e); });

Categories : Mongodb

What PHP would be used to respond to a URL without the traditional folder/file set up?
This can be solved with .htaccess and rewrite rules. See .htaccess rewrite to redirect root URL to subdirectory or http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/ Note that mod_rewrite should be enabled in apache settings

Categories : PHP

what is the traditional way of sorting search results?
You can sort it in Django using the instructions found here: Good ways to sort a queryset? - Django. Instead of using jQuery, I'd recommend that you use underscore.js to sort your array. It depends on where you'd like to sort your array and which framework you're more comfortable with, although I would lean towards the Django solution as it allows you to avoid an import.

Categories : Jquery

Output list of even Fibonacci numbers in Euler prob 2 with Python 2.75
Start with an empty list and as you find them append them on: even_fib = [] for i in a: if i %2 == 0: even_fib.append(i) The result will be a list of all the even elements

Categories : Python

Can ZeroMQ be used to accept traditional socket requests?
You probably have to use zmq's RAW socket type (instead of REP) to connect with and read client data without zmq-specific framing. HTTP Server in C (from Pieter's blog) http://hintjens.com/blog:42 RAW Socket type info https://github.com/hintjens/libzmq/commit/777c38ae32a5d1799b3275d38ff8d587c885dd55

Categories : Sockets

SystemVerilog program block vs. traditional testbench
Check out IEEE Std 1800-2012 § 3.4 & § 24. For full description about program blocks. In a short, incomplete summary, a program block: cannot cannot contain always procedures, primitive instances, module instances, interface instances (virtual interface and port interface is allowed), or other program instances. specifies scheduling in the Reactive region. This prevents race conditions. has an extra system task $exit, which terminates the program instances that calls it. The simulation will terminate when all program instances have exited. is mostly like a module block except as stated above. The idea of a program block is to create a clear separation between test and design. In earlier versions of SystemVerilog (pre IEEE 1800), instantiation of a class was often limit

Categories : Unit Testing

using Linq Skip Take for Traditional SQL Query rather using RowNum
How do i use Linq methods on this SQL query for pagination rather going for ROWNUM You can't. You're issuing direct SQL - LINQ isn't involved here. LINQ will translate a query written in C# into SQL, but you can't start adding bits of LINQ to an existing SQL query. You should decide whether you actually want to write SQL, or whether you want to use LINQ. Then do just one at a time. (You can use both in the same project, sure - but for a single query, you can't mix and match.)

Categories : C#

indirectly quoting macro in traditional mode
Using the cpp that comes with GCC (4.8.1 tested), and the code (example.c): #define foo bar #define quoteme_(x) "x" #define quoteme(x) quoteme_(x) quoteme(foo) The relevant part of the output from cpp -traditional example.c is: "foo" (and you can use single quotes in the replacement for quoteme_(x) similarly to obtain 'foo'). This is what you observed in the question. AFAIK, there isn't a way to get 'bar' or "bar" out of the traditional preprocessor system. The pre-standard (traditional) systems were not standardized, and there were details where different systems behaved differently. However, macro arguments were expanded after replacement, rather than before as in C89 and later, which is what leads to the result you're seeing.

Categories : Misc

How to get NodeJS to evaluate multiple traditional JS files
Yes, Node.JS (like most high level languages) supports dynamic import. If you have a list of files, for example var files = ["student1.js", "student2.js", "student3.js", ...]; then you can simply do files.forEach(function(f) { try { require(f); } catch(e) { console.log("Error in file: "+f); } }); this will automatically import and evaluate these files. Note that it might throw an exception (because of errors in files),so that's why it is wrapped with try{}catch{}. However if you keep scripts in database and in Node.JS you only have them as strings then you could use eval: var scripts = ["var x = 1;", "console.log('test');", ...]; scripts.forEach(function(s) { try { eval(s); } catch(e) { console.log("Error in script: "+s); } })

Categories : Javascript

asp.net mvc ajax post traditional parameter serialization
It seems that I cannot insist to post data. I have to switch method to use urlencoded parameter using jQuery.param treeview.dataSource.transport.options.read.data = { showInactiveItems: $("#ShowInactiveTerritories").find('i').hasClass('icon-eye-close'), selectedTerritoryId: territoryId, selectedTerritoryType: territoryType, }; query = "?" + jQuery.param({ ancestry: ancestry }, true); treeview.dataSource.transport.options.read.url = loadurl + query; treeview.dataSource.read(); Worked!

Categories : Javascript

Android loading resources for Simplified/traditional Chinese
Seems like you're not actually changing the app's Locale configuration. Android seems like it's still using the default locale. see Changing Locale within the app itself

Categories : Android

make org-mode temporarily emulate traditional outlining keybindings?
I don't believe there is any existing minor mode that will do the trick, however one such as this should work: (define-minor-mode zin/org-outline-mode "" nil :lighter " OOut" :keymap (let ((map (make-sparse-keymap))) (define-key map (kbd "<return>") 'org-meta-return) (define-key map (kbd "<tab>") 'org-metaright) (define-key map (kbd "S-<tab>") 'org-metaleft) map))

Categories : Emacs

How to do different actions based on different image's locations (A digital book with traditional look)
Not entirely what you've been expecting but a few cues. Unless you do some OCR to recognize/split your text I don't really see how you'd detect from an image sentences (someone correct me if I'm wrong) and their bounds for highlighting them or providing a visual cue; so I assume you'll use some OCR along with your images. (providing it's good enough to return the regions of chars/sentences so you can provide visual cues and pick the associated translation for that sentence) Here you have some links to OCR libraries that are free to use : Any open source C# OCR library? The best .NET OCR API? When you're done OCR-ing you now have your book as a string and you'd want to split it: MatchCollection matches = Regex.Matches(_text, @"[A-Z].*?."); string[] strings = matches.Cast<Match>(

Categories : C#

Mongo “manual reference” performance compare to traditional DB’s “table joining”
A relational database also performs a JOIN by querying both tables. But it has the advantage that it can do this internally and doesn't have to communicate with the client to do this. It can query the 2nd table immediately. MongoDB first needs to send the results of the first query to the client before the application can formulate and send the 2nd query back to the database. The time lost by this is: Network latency between database server and application server (a couple ms) Interprete the response on the application server and generate a $in-query from it (a couple µs) Network latency between application server and database server (a couple ms) Depending on how well the application server and the database server are interconnected, we are talking about a penalty of a few ms here.

Categories : Mongodb

Converting traditional line breaks to Markdown double-space newlines
change empty lines do you mean this? I used xx to make it easier to see in output: kent$ awk '{$0=$0"xx"}7' f Roses are redxx Violets are bluexx xx Bananas are yellowxx xx Oranges are orangexx so, each "new line" will be replaced with two 'x' with newline. if this is what you are looking for, you could do: awk '{$0=$0" "}7' file without changing empty lines if you want to ignore empty lines (for empty line don't do any substitution): check this out: kent$ awk '$0{$0=$0"xx"}7' f Roses are redxx Violets are bluexx Bananas are yellowxx Oranges are orangexx so you see above the double x didn't show on empty lines. you could use the command: awk '$0{$0=$0" "}7' file EDIT kent$ awk 'NR==1{p=$0;next}{p=p&&$0?p"xx":p; print p;p=$0}END{print $0}' f Roses are redxx Viol

Categories : Osx

Django validation of json POST fails unless jQuery.ajaxSettings.traditional = true;
views.py from django.template.loader import render_to_string from django.utils import simplejson if form.is_valid(): template = "my_template.html" html = render_to_string(template,{"c": {"cellid": 5}, "b": {"cellid": 8}, "e": {"cellid": 3}, "i": {"cellid": 9}, "k": {"cellid": 11}, "j": {"cellid": 10}, "l": {"cellid": 12}, "n": {"cellid": 7}, "q": {"cellid": 1}, "r": {"cellid": 4}, "w": {"cellid": 2}, "v": {"cellid": 6}}) response = simplejson.dumps({'success':'True','html':html}) try it, it should work.

Categories : Jquery

Bind array of complex objects in GET request - jquery.param() traditional flag
You should implement a model to hold this parameters: public class SemanticPartViewModel { public List<SemanticPart> semanticParts { get; set;} public string first { get; set; } public string last { get; set;} } And change the controller to receive this as parameter public ActionResult Handler(SemanticPartViewModel semanticParts) { /*Do stuff*/ } You should use JSON.stringify(mydata) as well to create the data for the $.ajax call This way the default modelbinder will take care about the rest.

Categories : Javascript



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