w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Write variables to executable
You would need some form of inter-process communication (IPC) to be able to communicate between the two executables. Your options here will depend on your target system and libraries available, maybe you can provide some more information here? Examples of IPC methods are as follows: File Shared memory Sockets Message queue Semaphore Pipe, Named pipe

Categories : C++

How to get specific currency symbol(rupee symbol in my case) in angular js instead of the default one (dollar $ symbol)
You can use the symbol parameter: Item Price<span style="font-weight:bold;">{{item.price | currency[:symbol]}}</span> Exemple: Item Price<span style="font-weight:bold;">{{item.price | currency:"USD$"}}</span> Please refer to this: http://docs.angularjs.org/api/ng.filter:currency

Categories : Javascript

Unresolved external symbol for variables in namespace
Your #include directives (and therefore your interface definitions) are inside namespace Engine, but it appears your implementations are not. That's giving you the link error. You need to wrap the body of code in each of those .cpp files in namespace Engine also. ie: #include "engine.h" namespace Engine { // implementation goes here }

Categories : C++

How to modify this function to accept the return in three different variables?
You're probably thinking that the function breaks after you yield the objects. It doesn't. So the for-loop will continue, possibly yielding more values. You can put a return after the yield statements so the function breaks, or even just return all the three values at once in a tuple by doing return (items[4], items[1], items[2])

Categories : Python

How to modify a table in a database sent (or ship) in the application without deleting the other tables?
You can handle it internally, I'm not sure what triggers your need to update the table, the initial setup of the app or later in your processing. The process is sort of rudimentary. Let's say table A has data and you want to add 'col_new' to it. DROP TABLE Temp ALTER TABLE A RENAME TO Temp Drop table A Create table A with all the columns Table A has plus the 'col_new'. Query table Temp and insert it into the A table something like this insert into A (name, phonenumber) select name, address from Temp Check that your counts match for both the tables. Set col_new as you may. It's probably not what you wanted to hear, but I hope it helps.

Categories : Android

Creating scatter plot where symbol height/width is controlled by 2 variables
You can achieve it with geom_rect() and using your plus_ and minus_ variables as max and min coordinates (named your data as df). ggplot(df,aes(xmin=minus_age,xmax=plus_age,ymin=minus_error,ymax=plus_error))+ geom_rect(fill="green",color="black")

Categories : R

AngularJS: How do you return variables or modify the $scope from a directive?
Try this: directives.directive('dateRangePicker', ['$window', function ($window) { return { restrict: 'A', scope: { options: '=', onChange: '&change' }, template: "<span></span> <b class='caret'></b>", link: function (scope, element, attr) { $(element).daterangepicker(scope.options, function(start, end){ $(element).find('span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); scope.$apply(function () { scope.onChange({ start: start, end: end }); }); }); $(element).find('span').html($window.moment().format('MMMM D, YYYY') + ' - ' + $window.moment().format('MMMM D, YYYY')); } }; }]); Also, the above assumes moment() is on the window. You can fi

Categories : Angularjs

Non-PIE Binary - The executable '' is not a Position Independent Executable
I believe a Position Independent Executable is a program that can be placed at any memory address and still run. So typically all data is referred to by relative memory addresses. If you tried to refer to a fixed memory address, that memory address might be outside your program entirely if it gets loaded at a different location in memory. I have no idea what the particular ins and outs of PIE are for iOS.

Categories : IOS

gmon.out is not created when executable forks another executable
But gmon.out is not created when I fork another executable It probably does. It simply has the same name as all the other gmon.out files. They just silently overwrite each other. GNU, in all its infinite wisdom, recommends that each child process that you want to profile be executed in its own current directory. Use mkdir and chdir in your code as needed. Since gmon.out is written out as the process finishes, it is only necessary to chdir before calling exit. I also recommend looking at valgrind. Among other nice things, it has its output files named something.somethingelse.$PID.

Categories : C++

Styling Tables - How to use column groups to modify TH tag located in that column
Without using colgroups, you can style the 3rd child of each row: #table-5 th:nth-child(3){ background: blue; } #table-5 tr td:nth-child(3){ background: #C0000E; } http://jsbin.com/ocezon/3 I modified this to make it easier to work with multiple tables and make modifying in the future easier: http://jsbin.com/icasom/1/edit

Categories : CSS

MySQL Join two tables with dynamic variables
You have things all over the place, I haven't tested this but it should work ... SELECT * FROM (SELECT *, MATCH(name) AGAINST('*McDonalds*' IN BOOLEAN MODE) AS `score_name_0`, MATCH(`city`) AGAINST('McDonalds*' IN BOOLEAN MODE) AS `score_city_0`, (3959 * acos(cos( radians(".$lat.")) * cos(radians(pinpoints.lat)) * cos(radians(pinpoints.lng) - radians(".$long.")) + sin( radians(".$lat.")) * sin(radians(pinpoints.lat)))) AS distance FROM `stores` JOIN pinpoints ON stores.id=pinpoints.id WHERE stores.id=pinpoints.id AND (MATCH(name) AGAINST('*McDonalds*' IN BOOLEAN MODE) OR MATCH (`city`) AGAINST('McDonalds*' IN BOOLEAN MODE)) ) AS tmp_tbl WHERE distance < 25 ORDER BY distance ASC, (`score_namn_0` + `score_s

Categories : PHP

PHP mysql Check variables from multiple tables
Here's how it will work: Query: SELECT t3.name,t2.id t2_id,t1.id t1_id FROM table3 t3 LEFT JOIN table2 t2 ON t2.name=t3.name LEFT JOIN table1 t1 ON t1.name=t3.name In code: if(!empty($line['t2_id'])) { echo 'tick'; } else { echo 'cross'; } do the same for table 1 ticks and crosses.

Categories : PHP

Why are temporary tables faster than table variables for joins?
Temp tables are similar to tables but they are store in tempdb when created, which means that optimizer can create statistics on them,while table varaibles as similar to variables and there are no statistics on them.Usualy when comparing tmp tables vs table variables,the temp tables come out on top. The reason is that the query optimizer will sometimes generate poor plans for table vars. This can mostly be seen when there is a lot of data. The biggest point I can make is that table variables are more likely to cause unpredictable execution plans when compared to the plans generated for temp tables. Temp tables on the other hand, will cause more recompilation.

Categories : Sql Server

How to modify parent class' variables from a derived class?
Your example code does work: http://ideone.com/zRvp93 The only major problems in your example are that Child's member functions are private and Parent::nonvirtualfunction and Child::secondfunction are missing their return types.

Categories : C++

Java Class.forName won't compile. Getting "cannot find symbol symbol : method"
If theResponse() belongs to http.response.PublicRoute then it should have been Class c = Class.forName("http.response.PublicRoute"); return ((PublicRoute) c.newInstance()).theResponse("hi"); But, then there's really no need for Class.forName() as you could use constructor as return new PublicRoute().theResponse("hi");

Categories : Java

Can non-static methods modify static variables
No, any non-static method has access to static members. The only way this would be false is if the non-static context did not have access to the static member (ex. the static member is private to a class and the non-static code is not in that class). static variables exist to provide an instance free variable/method, so for example if we have a Game class and a highscore variable, the highscore would be static (accessible without an instance), and after every game (an instance of the Game class) completes we could alter the highscore from our non-static context if our score is greater than the high score.

Categories : Java

Why the symbol defined in the shared library symbol is not used?
Because hello2 is defined in the header, your test program will use that instead of the shared library's version. So if you modify the header, you'll need to recompile the test program. If you want to be able to just recompile the shared library, you'll need to move the definition (i.e. code) of hello2 out of the header and into some other cpp file.

Categories : C++

How to modify the buffer-list using modify-frame-parameters
(frame-parameter 'nil 'buffer-list) returns a list of buffers, not their names; thus you might want to replace (lambda (tab) (buffer-name (tabbar-tab-value tab))) with 'tabbar-tab-value

Categories : Emacs

How do I modify one activity's variables from another activity?
How do I modify First.class' variables if Second.class is entirely separate from First.class and cannot access it? You can't or (more importantly) you should not try to do this. The Android Activity is a "special case" class and should be generally considered as being self-contained. In other words any changes to data in the second Activity which need to be reflected in the first Activity must be either persisted using some form of global storage (SharedPreferences for example) or should be passed using the extras of an Intent or a Bundle. With SharedPreferences simply have the first Activity save your currentValue before starting the second Activity and do the reverse in second Activity before returning to the first. The first Activity then simply needs to check the SharedPreferenc

Categories : Android

Add a symbol at the beginning of a line and add the same symbol at the ending of the line using perl
Simply add it after the line the same way, by including it at the end of the printed string: chomp; # Strip off newline character print NEWFH "-> $_ <- "; # Add newline ay the end As far as longest string and total count: you can use 2 variables to store the current max length and current total, and calculate them with the help of the length function. Keep a third variable for line count.

Categories : Perl

perf can find symbol in the kernel ,but can not find symbol in my program. How to fix it?
Huh, i just tried this and to me it works as it should, afaik. Enviroment is ubuntu 13.04 (with gcc 4.7.3). If it still does not work for you, you might want to check out that the debug symbols are otherwise fine, with say gdb. % gcc test.c -g -o test XXX@YYY % perf record ./test [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.060 MB perf.data (~2620 samples) ] XXX@YYY % perf report --stdio # ======== # captured on: Wed Oct 16 11:58:40 2013 # hostname : sundberg-office-antec # os release : 3.8.0-31-generic # perf version : 3.8.13.8 # arch : x86_64 # nrcpus online : 2 # nrcpus avail : 2 # cpudesc : AMD Phenom(tm) II X2 555 Processor # cpuid : AuthenticAMD,16,4,3 # total memory : 16434276 kB # cmdline : /usr/bin/perf_3.8.0-31 record ./test # event :

Categories : Linux

How to use different currency symbol instead of device local currency symbol?
I use this: NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; [currencyFormatter setCurrencyCode:currencyCode]; where currency code is something like "USD", "CAD", "EUR", "GBP", etc.

Categories : Iphone

Upgrade pre-populated sqlite database tables without removing tables with user input?
The way I plan on distributing the database is via the following method for adding a pre-populated database to an app Using your own SQLite database in Android applications. That code has been out of date for some time. Please consider using something more modern and supported, like SQLiteAssetHelper. I want to completely replace those existing tables with the tables from the new pre-populated tables, yet leave the user populated tables intact SQLiteAssetHelper supports two patterns out of the box: Replace the entire database with the new packaged copy Run your own SQL scripts to update the existing installed database, ignoring the copy packaged with your app Since SQLiteAssetHelper is open source, you can see how Jeff Gilfelt wrote it and try to leverage that for somehow su

Categories : Android

I have the following XML file. I want to create tables dynamically based on testcategory name(in ths case 3 tables) using XSLT
Since the number of rows might vary for each section, one way to account for this problem is to divide up the work according to the hierarchy of the XML document. The Device Details table and Test Summary table should appear side-by-side below the Test Category tables. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd"/> <xsl:variable name="header_style"> <xsl:text>font-size: 14pt; font-weight: bold; margin-bottom: 1em; width: 40%;</xsl:text> </xsl:variable> <xsl:variable

Categories : Xslt

SQL and storing foreign keys on multiple tables vs joining through tables for queries
How much data do you expect to store in your database? If there are relatively small amount of rows in each table for the joins the execution time between a normalized and non-normalized database will be negligible. So instead just go with a design that makes sense to you and you can normalize and de-normalize tables where it makes sense. Here's a good read on the subject:http://www.codinghorror.com/blog/2008/07/maybe-normalizing-isnt-normal.html

Categories : SQL

jinja2 variables naming - Are variables naming restrictions the same as for Python variables?
Jinja's naming convention generally matches your python interpreter's identifiers. So it also depends on your Python version (2.x: like [a-zA-Z_][a-zA-Z0-9_]*) (source: #pocoo on irc.freenode.net)

Categories : Python

JOIN'ing by 3 tables and retrieving field based on content of those tables
That case statement looks a little wonky. You may be returning multiple values. Try this: COALESCE(c.name, h.letting_agent, t.letting_agent, 'Unknown (Not set yet)') as Agent This checks c.name. If it is null, move to the next argument and do the same. Everything else in the query looks fine and this does work in postgresql.

Categories : SQL

Dynamically reposition tables in report to replace invisible tables
Put the tables in Rectangles and set the visibility of the Rectangles the same as the tables. Make sure all the Rectangles are exactly adjacent to each other and that each table is at the top of the Rectangle. When a Rectangle is hidden, it should also hide any whitespace in the Rectangle too, i.e. the next Rectangle (and hence the related table) will appear without gaps.

Categories : Reporting Services

Show tables, describe tables equivalent in redshift
All the information can be found in a PG_TABLE_DEF table, documentation. Listing all tables in a public schema (default) - show tables equivalent: SELECT DISTINCT tablename FROM pg_table_def WHERE schemaname = 'public' ORDER BY tablename; Description of all the columns from a table called table_name - describe table equivalent: SELECT * FROM pg_table_def WHERE tablename = 'table_name' AND schemaname = 'public';

Categories : Amazon

MySQL Inner Join of 2 different tables on 2 different coloumns that are part of both said tables
'SELECT ID, company, title, lastname, fistname, street, city, zipcode, phone, email, category_ID, Hotel_ID FROM customer AS tbl1 INNER JOIN booking AS tbl2 ON tbl1.id=tbl2.id WHERE relevantcolumn='searchterms' GROUP BY tbl1.firstname, tbl1.lastname, tbl2.room, tbl2.date'

Categories : Mysql

Prevent writes to specific tables (read-only tables)
If you're using the "declarative" approach, you can try making the classes themselves "read-only": class MyBase(object): """ This class is a superclass of SA-generated Base class, which in turn is the superclass of all db-aware classes so we can define common functions here """ def __setattr__(self, name, value): """ Raise an exception if attempting to assign to an atribute of a "read-only" object Transient attributes need to be prefixed with "_t_" """ if (getattr(self, '__read_only__', False) and name != "_sa_instance_state" and not name.startswith("_t_")): raise ValueError("Trying to assign to %s of a read-only object %s" % (name, self)) super(MyBase, self).__setattr__(name, value)

Categories : SQL

How can I join 3 tables and total the column from one of the tables in MySql?
You can't use numbers as table aliases. Use a name which starts with a letter. select t1.block_id,sum(t2.noofslabs) as totalslabs,if(t3.status='completed','fullyCompleted','partiallyCompleted') from table1 as t1 left join table2 as t2 on t1.block_id=t2.block_id left join table3 as t3 on t1.block_id=t3.block_id where t1.status='Cut' should work

Categories : Mysql

Limit of performance benefit gained in Python from using local variables instead of global variables?
As I understand it, that performance boost only applies when global variables are moved into a local scope of a function, as it improves their access time. Further breaking your code down into more functions won't provide any similar boost.

Categories : Python

How to save variables to a file so that those variables are loaded the next time the site runs?
You can use local storage or even cookies. local storage is your best bet, although it doesn't work in older browsers. cookies are (more) limited in their capacity (4KB vs 5MB for local storage) and also are sent to the server with each request, which may not be what you want. Alternatively, you can store the state on your server (you'll need some server side scripting as well), and only store a user/gamer id in a cookie.

Categories : Javascript

Time Dummy Variables and Regressing columns of a dataframe as dependent variables
You can create a list of stocks as follows and then use Map function and can avoid R for loop (Not tested since you didn't provide the sample data) Assume your data is mydata with month as 1,2, you use 11 months as dummy if there are 12 months mystock<-list("APP~","INTEL~","MICROSOFT~") # stocks with tilde sign myresi<-Map(function(x) resi(lm(as.formula(paste(x,paste(levels(as.factor(mydata$month))[-1],collapse="+"))),data=mydata),mystock) #-1 means we are using only 11 months excluding first as base month Say your independent var is indep1,indep2, and indep3 and dependent is dep (And assuming that dep and indep are same for each stocks) myestimate<-Map(function(x)lm(dep~indep1+indep2+indep3,data=x),myresi)

Categories : R

Having problems using drop-down menu variables to create a table filled with these variables in PHP
Welcome to SO. $_POST['submit'] is not neccesary. In your PHP script, create the HTML for the table, and then <?php echo $num_1; ?> (or the others) where needed. The HTML must be outside the PHP code.

Categories : PHP

How to creating ctypes variables using python variables instead of hard-coded values?
The field attributes of a Structure are CField descriptor objects. A descriptor is like a Python property or like a __slots__ attribute, if you're familiar with either of those. A CField knows the data type of the field and its offset into the buffer. Each C data type has a associated get/set function that converts to and from Python objects. So generally you can assign a Python object directly to the field. For example: thresholds = [1, 0.9, 0.8, 0.7] c_parameters = Params( var1 = 100, var2 = 4, var3 = 5, var4 = 5000, var5 = "modelname", var6 = 0.5, var7 = 90, var8 = (C.c_double * 4)(*thresholds), var9 = 2, H = Good('H', 0.5, 100, 20), L = Good('L', 0.5, 75, 20), ) If ctypes needs to hold a reference to a Python object to keep it alive,

Categories : Python

How to write a random generator function without using time functions, static variables or global variables?
do #include <time.h> #include <stdlib.h> srand(time(NULL)); int r = rand(); if you want to limit the number use int r = minNum + rand() % maxNum; do not try to create your own random function. it will not end well

Categories : C

Difference between variables inside the function and variables functioning as arguments in C++
You can't tell almost anything about a functions's performance only from its signature. I can write the fastest and the slowest functions you can imagine with either one of these signatures. In the second option you are adding a third parameter to the function. Do you need that parameter? If you need it, use that option. If you don't, use the first one.

Categories : C++

Init values by using (somewhat) global variables vs. static function variables?
I was going to suggest that you wrap your data into an object, until I realized that you are asking for a C solution with a C++ tag... Both of your solutions have their benefits. The second one is the one I'd prefer, assuming we just go by "what it looks like/maintainability". However, there is a drawback if helpMe is called MANY times with initData == 0, because of the extra if, which isn't present in the first case. This may or may not be an issue if doSomethingWith() is long enough a function and/or the compiler has the ability to inline helpMe (and initData is constant). And of course, something in the code will have to call initHelpMe too, so it may turn out to be the same anyway. In summary: Prefer the second one, based on isolation/encapsulation.

Categories : C++



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