macros,key-valueRelated issues-Collection of common programming errors
program-o-steve
java macros jni codeblocks
JNIEXPORT jint JNICALL JNI_Func(….) {…. }I get unsatisfied link error when i try to run the java program with macros (JNIEXPORT and JNICALL) in the native code. But when i remove the macros,i get no exception. Is it that the IDE Code::Blocks doesn’t support JNI macros ? If it supports what should i do to enable them ?Note : I don’t get a error or warning related to the macros defined . It just fails the run,as it gives me the unsatisfied link error.EDIT :Stacktrace :Exception in thread “main
Xeo
c++ c macros preprocessor tilde
Seen on this site, the code shows macro invocations using a tilde in parentheses:HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~)) // ^^^What does it mean / do? I suspect it to just be an empty argument, but I’m not sure. Is it maybe specific to C(99) like the __VA_ARGS__ is specific to C99 and existent in C++?
user1562021
c++ windows visual-c++ macros porting
I am new to C++ and facing one easy problem mention below. in visual C++ 2008, i am trying to #define something like #define fromThis* toThisPtr #define fromThis toThisObjI am porting some code that is written in linux and need to port in accordance to winapi. The error which i am getting something like this.error C2008: ‘*’ : unexpected in macro definitionwarning C4005: ‘fromThis’ : macro redefinitionsee previous definition of ‘fromThis’I need to redefine fromThis* and fromThis during prepr
erutan
excel vba excel-vba macros
I have an Excel sheet with values, and I want to automatically copy only the values that are highlighted (formatted with background color) to another sheet. I don’t mind using a macro, or if possible a function in the second sheet cells.I’ve tried to put a few suggestions together and created a function to return the cell color and this following macro to filter by the color value:Sub Sample()Dim ws As WorksheetDim strSearch As StringDim lRow As LongSet ws = Sheets(“Sheet1”)With wslRow = .Range(
molnardenes
excel vba macros duplicate-removal
Is it possible to use a function in Excel 2003 to delete an entire row if it’s the same as the previous one? For example:apple apple plum vinegar apple banana banana banana appleI want to delete #2, 7# and #8, but I don’t want #5 and #9 to be deleted. I want to delete a duplicated entry ONLY IF it’s the next one. I hope I managed to keep it clear to you. If there isn’t a function, how can I do that in VBA? Thanks in advance!
pssp
c macros concatenation
Consider the following code:1. #define SUFFIX 5-5 2. #define XFUNC_0( x ) (100 * x) 3. #define XFUNC_1( x ) (101 * x) 4. #define XFUNC_2( x ) (102 * x) 5. #define CATX( x, y ) x##y 6. #define CAT( x, y ) CATX( x, y ) 7. #define XFUNC CAT( XFUNC_, SUFFIX ) 8. #if XFUNC(2) == 200 …… etc N. #endifThis code does not seem very useful, this is because it is just a part of my real code, simplified. The question is: – how can I convince the preprocessor to perform first 5-5 (just a
Flexo
c macros define
I was wondering if there was a way in C language to define #define like this:#define something #define something a 42 something b 42
murftown
vim macros special-characters vimscript macvim
I have been playing around with vim macros lately (in MacVim at the moment), and sometimes I like to explicitly assign a macro into a register using e.g. :let @a='(macro keystrokes)’. This is generally working fine, but I found a weird behavior in which anytime I assign a string value that ends in Carriage Return / ^M, vim automatically adds a Linefeed / ^J to the end before putting it in the register, which affects the execution of the macro!Example: Let’s say I record a simple macro that get
emmerich
c++ gcc macros cppunit
I have a project which has two base exception classes; both have the same name, only the methods/members differ (one has a method which returns the message, the other has only a string member which can be accessed for info regarding the exception).I’m using CPPUNIT for testing and in the framework there’s the TestAssert.hpp file which contains macros for every assertion (CPPUNIT_ASSERT_NO_THROW, etc.). I’ve modified adding in it another macros which test what exception headers are included in th
Foo Bah
c++ c macros
Using a macro defined to conditionally return a value has a disadvantage where it is not apparent from only looking at the client code might exit at the point of the macro.The use case I am considering is writing a value and error checking, like so:#define WRITE_CHK(file, param)\ if (!write_that_returns_zero_on_fail(file, param)) {\handle_error();\return false;\ }client code:bool myfunc() {…WRITE_CHK(file, param) // function might return here…return true; }I am curious if the benefits of the
Jorge Mendez
ruby gem bundle key-value gemfile
I’m trying to update my gems using a Gemfile but always fails in the same line:Gemfile:group :doc dogem ‘sdoc’, require: false endCommand:$ bundle updateI’m always getting this error:Gemfile syntax error:/Users/GrzegorzFeathers/Documents/Edx/SaaS/rottenpotatoes/Gemfile:32: syntaxerror, unexpected ‘:’, expecting kENDgem ‘sdoc’, require: falseWhen I change that line syntax to this, the problem was solved:gem ‘sdoc’, :require => falseBut why can’t I use the other one?, I checked my ruby version
Dave Rigby
java rest memcached key-value couchbase
I am trying to retrieve a value from a memcached Couchbase bucket using the Java SDK without success. The value was serialized from .NET Is it possible to do this using the REST API? In couchbase buckets, you just need to send a get request like this:SERVER_IP:8091/couchBase/COUCHBASE_BUCKET_NAME/KEYand the value is returned.I have a memcached value, and even though I have the keys, I cannot extract any values. When in “COUCHBASE_BUCKET” I put the name of the memcached bucket i get 404 not foun
ProgrammerGirl
php mysql string api key-value
I use an API, and feed a DB table based on the expected parameters coming in through that API.However, the API frequently changes, so I have a “catch-all” TEXT column called unexpectedParameters in MySQL for any unexpected items coming from the API (e.g. a new item name and value pair introduced in an update of the API), so that I don’t lose them.How should I store these unexpected key => value pairs so that in the future, if necessary, I can quickly pull the unexpectedParameters column and p
A.Ellett
expl3 key-value
The basic idea that I wanted was to create a key to pass a value that would inform \makebox how the contents of the box should be aligned. Big fail here. The intended contents of the \makebox are not passed as arguments to \makebox and I seem to have random components of my keys ignored or inserted into the text.What’s happening here?\documentclass{article} \usepackage{xparse} \ExplSyntaxOn\tl_new:N \l_aefl_position_tl \tl_set:Nn \l_aefl_position_tl { [l] }\keys_define:nn { aefl }{pos .code
Will
class dynamic properties key-value
In Python I have a flag class that I have found very useful. I’m newbe to c++, and can not seem to replicate this python functionality in c++. Rather than put up c++ code that didn’t work, here’s what I am looking to replicate, and I need some suggestions on where to go, templates, virtual, or ?? The requirement is being able to dynamically alter the members of the class, in python it’s modifying the dict element of the class it’s self that enables this.In python:import sysargs = []… loads up
Wim Ombelets
c# design key-value
So if I have a method of parsing a text file and returning a list of a list of key value pairs, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?The first method that pops into mind is pretty simple, just keep a list of keywords:private const string NAME = “name”; private const string PREFIX = “prefix”;and check against the keys I get for the constants I want, defined above. This is a fairly core piece of the pro
Svend Tveskæg
expansion strings key-value
I am trying to build up a macro that creates other macros depending on kvoptions’ options. But then, the outcoming macros are dependent on the actual state of the options instead of their state at the runtime of the creation macro. Here’s a minimal example:\documentclass[openany]{scrbook} \usepackage{kvoptions}\makeatletter \SetupKeyvalOptions{family = fam, prefix = fam@} \DeclareStringOption[]{prename}\newcommand{\greetingsetup}[3]{%\setkeys{fam}{#3}\expandafter\newcommand\csname greeting#1\end
20 revs, 4 users 98%pts
python database store embedded-database key-value
I need a fast, reliable and memory-efficient key–value database for Linux. My keys are about 128 bytes, and the maximum value size can be 128K or 256K. The database subsystem shouldn’t use more than about 1 MB of RAM. The total database size is 20G (!), but only a small random fraction of the data is accessed at a time. If necessary, I can move some data blobs out of the database (to regular files), so the size gets down to 2 GB maximum. The database must survive a system crash without any loss
Jeff Wolski
iphone objective-c ios nsuserdefaults key-value
Good morning, I made an IBAction method which saves some objects to an array:-(IBAction)saveToFav:(id)sender {NSUserDefaults *newDefaults = [NSUserDefaults standardUserDefaults];favorites = [[NSMutableArray alloc]initWithArray:[newDefaults mutableArrayValueForKey:@”favorites”] copyItems:YES];// check if array already contains an objectif (![favorites containsObject:self.title]){[favorites addObject:self.title];}[newDefaults setObject:favorites forKey:@”favorites”]; }However, when I call this met
nickthedude
objective-c nsmutabledictionary key-value
I know you could add all the keys to an array and add it to one side of the dictionary but I’m curious how you can add or insert a value at a certain point in the dictionary. The way i have it now it I believe it just keeps overwriting the last entries to make room for the new one:NSMutableDictionary *bookmarks = [[NSMutableDictionary alloc] init]; NSString *keyA = @”Stanford University”; NSString *keyB = @”Apple”; NSString *keyC = @”cs193p.com”; NSString *keyD = @”Stanford on iTunes”; NSString
Web site is in building