Posts

Showing posts from June, 2015

java - Can I output key/value pairs such that one key is specific to one node in Hadoop MapReduce? -

suppose have code matrix multiplication. want such mapper output each node taken 1 reducer, ie. key 1 complete mapper output file same, different key of node. eg. if 1 mapper file outputs key/value pairs key 1, mapper output key/value pairs key 2 , on. understand maybe cannot done example, if output key particular datanode id or something? in, key in output partciluar id given datanode. there way this? basically want output 1 mapper go 1 reducer somehow, , can achieved giving them one key , , want parallelism mapper output distributed through cluster, want key each unique. how assign one key data if input not organized that? (please point out if additional information needed. thank help) if want ensure output 1 mapper ends in same reduce instance, uou can use map task id output key: public class mymapper extends mapper<longwritable, text, intwritable, text> { private intwritable mapid; @override protected void setup(context context) throws ioexc

webforms - How to avoid postback on ItemSelected when using a multiple selection RadComboBox? -

i have following scenario: <%-- uf --%> <tr> <td> <label>uf</label> <br /> <telerik:radcombobox id="rcbuf" runat="server" checkboxes="true" enablecheckallitemscheckbox="true" causesvalidation="false" culture="pt-br" cssclass="lt-width-10" maxheight="250" onitemchecked="rcbuf_itemchecked" autopostback="true"> </telerik:radcombobox> </td> </tr> <%-- rodovia --%> <tr> <td> <label>rodovia</label> <br /> <asp:updatepanel runat="server" id="upprodovia"> <triggers> <asp:asyncpostbacktrigger controlid="rcbuf" /> </triggers> <contenttemplate> <teleri

python - QT Timers not calling function -

i'm using pyqt python3. my qtimer s not calling function they're told connect to. isactive() returning true , , interval() working correctly. code below (works standalone) demonstrates problem: thread started, timer_func() function never called. of code boilerplate pyqt. far can tell, i'm using in accordance docs. it's in thread event loop. ideas? import sys pyqt5 import qtcore, qtwidgets class thread(qtcore.qthread): def __init__(self): qtcore.qthread.__init__(self) def run(self): thread_func() def thread_func(): print("thread works") timer = qtcore.qtimer() timer.timeout.connect(timer_func) timer.start(1000) print(timer.remainingtime()) print(timer.isactive()) def timer_func(): print("timer works") app = qtwidgets.qapplication(sys.argv) thread_instance = thread() thread_instance.start() thread_instance.exec_() sys.exit(app.exec_()) you're calling thread_func withn ru

java - What is wrong with my login system? -

here's code copy , paste error i'm getting in console. package com.bob; import java.awt.flowlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jpasswordfield; import javax.swing.jtextfield; public class boblogin extends jframe implements actionlistener { // declare of component variables. private jbutton login; private jtextfield usernamefield; private jpasswordfield passwordfield; private jlabel username; private jlabel password; private jframe loginframe; private string usernametext = "username:"; private int usernamecolumns = 20; private string passwordtext = "password:"; private int passwordcolumns = 20; //declare of constants. private static final int width = 300; private static final int height = 300; //login password , usern

thunderbird - Can not receive emails on Apache James email server -

i have installed apache james email server on windows machine. using firefox thunderbird email client. i add new domain mydomain.com copying domainlist.xml in conf folder of james server , making default domain. further, add users domain. my problem can send emails tuser1@mydomain.com admin@localhost can't receive mails on tuser1@mydomain.com. i tried copy lines below in host file , restart server, 127.0.0.1 mydomain.com mydomain.com in 127.0.0.1 mydomain.com in mx 10 mydomain.com this not helping. any suggestion on this? thanks, vijay bhore found solution problem. now, using hmailserver email server. i added domain 'mydomain' , few users under it. later referred link: http://csns.calstatela.edu/wiki/content/cysun/course_materials/hmailserver i followed steps 4,5 , 6 in hmailserver administrator. i add users in thunderbird client , send/receive emails. thanks, vijay bhore

java - What method signature is appropiate returning a generic object? -

what should signature of method takes generic object , returns generic object, 1 either same or sub class of original class? is, if method takes generic class a , returned object guaranteed either a or b such b extends a (directly or indirectly)? the code below exemplifies i'm trying do, in function getlist() : package com.company; import java.util.arraylist; public class main { private main(){ list<string> stringlist = new genericmessagelistcreator.getlist(stringgenericmessage.class); } private class genericmessagelistcreator() { public list<genericmessage<t1>> getlist(class<t1 extends genericmessage> clazz) { return new arraylist<t1>(); } } private class genericmessage<t> { public genericmessage(){}; private t internalvalue; public void setvalue(t value) { this.internalvalue = value; } public void echovalue() {

php codeigniter select results from foreach and save into an array -

i have php mysql query results following... array ( [0] => stdclass object ( [id] => 52 [sku] => [name] => stone product 52 ) [1] => stdclass object ( [id] => 53 [sku] => [name] => stone product 53 ) . . . ) array ( [0] => stdclass object ( [id] => 12 [sku] => [name] => stone product 12 ) [1] => stdclass object ( [id] => 13 [sku] => [name] => stone product 13 ) . . . ) and want results below array( [0] => stdclass object ( [id] => 52 [sku] => [name] => stone product 52 ) [1] => stdclass object ( [id] => 53 [sku] => [name] => stone product 53 ) [2

java - How do I programattically create a Tab with EditText in it? -

my app's text editor lets user open , edit files, want open file new tab in tabhost multiple files can open. how add edittext newly created tab? tried in oncreate() tabhost tabhost=(tabhost)findviewbyid(r.id.tabhost); tabhost.setup(); edittext editor = new edittext(this); tabspec spec1=tabhost.newtabspec("tab 1"); spec1.setcontent(editor.getid()); spec1.setindicator("tab 1"); i assume problem `spec1.setcontent(editor.getid()); you try set id (which not defined way) layout id. won't work way. try: tabhost tabhost=(tabhost)findviewbyid(r.id.tabhost); tabhost.setup(); edittext editor = new edittext(this); tabspec spec1=tabhost.newtabspec("tab 1"); spec1.setindicator(editor); if want. can try: tabhost tabhost=(tabhost)findviewbyid(r.id.tabhost); tabhost.setup(); final edittext editor = new edittext(this); tabspec spec1=tab

menu - How to close expanded mobile top bar in Foundation via jQuery? -

i'm wondering if there someway close expanded topbar in foundation on click on 1 of items? guess i'm looking put in center of this: $('#some-menu-item').click(function() { //some function collapse menu }); figured out lifting lines 174-176 of foundation's topbar.js . $('#some-menu-item').click(function() { $('.top-bar, [data-topbar]').css('height', '').removeclass('expanded'); });

asp.net mvc - Entity Framework doesn't create Database, Exceptions in debug -

i got annoying problem. reason ef stopped generating database. used tutorial: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application i setted initializer, connection string , dbcontext written in tutorial. i created breakpoint in global.aspx.cs file at: database.setinitializer<context>(new initializer()); and got these in debug: screen2 i tried anything, restart, reinstalling iis, don't know do. here question has pretty similar problem yours; hope helps!

idl programming language - Call an IDL routine from command line in Windows and prevent (or ignore) popup dialog boxes -

i've written short script (in language, happens python) passes arguments command line follows - ildrt <path/filename.sav> -args p1 p2 --o1 --o2 where p, o positional , optional arguments respectively (obvious). point, script calls idl routine number of times. each time, idl virtual machine loaded, idl routine runs until completion, rinse , repeat. unfortunately if error occurs in idl routine execution dialog box popup , halt program execution until manually clicked. since idea run batch process want ignore dialog boxes, (accepting error), , continue next run. thoughts on preferences or optional commands can run idl prevent popups? in advance. i guess i'm not following. can't pass flag program , check flag before popping dialog in code? if don't have access .pro code, don't think can prevent popups.

php - Uncaught syntax error: Unexpected token in Wordpress button function -

this 1 of functions made in wordpress site button open shortcode pop prompt. saw <p> tags added wordpress inside function, maybe error in. <input id="textarea" name="textarea" type="text" value="" placeholder="place here"> <script> function pol() { var x; var name=prompt("name","name"); if (name!=null) { x = document.getelementbyid("textarea").value; x = "[pol]" + name + "[/pol]"; document.getelementbyid("textarea").value=x; } } </script> <input type="button" value="pol" onclick="pol()"> errors: uncaught syntax error: unexpected token < uncaught referenceerror: pol not defined in wordpress page, on chrome, inspect element shows function this: <input id="textarea" name="textarea" type="text" value="" placeholder="place here">&l

python 2.7 - Django error: invalid syntax (<unknown>, line 1) when iterating queryset -

i've been working django few months now, , simple google search takes care of of problems (usually link so). have come across can't find solution , baffling. general error information: request method: request url: localhost:8000/switch/1 django version: 1.4 exception type: syntaxerror exception value: invalid syntax (, line 1) exception location: /usr/lib/python2.7/ast.py in parse, line 37 python executable: /usr/bin/python python version: 2.7.3 relevant view code interfaces = interface.objects.filter(switch=switch) interfaces = sorted(interfaces, key=lambda x: x.name) interfaces = sorted(interfaces, key=lambda x: len(x.name)) interface_table = interfacetable(interfaces) relevant model code class interface(models.model): class meta: app_label = "network_builder" name = models.charfield(max_length=20) fullname = models.charfield(max_length=30) switch = models.foreignkey("switch", related_name='switch') physical_state

objective c - Testing NSDocument -

i'm getting started unit testing , i'm wondering how correctly test nsdocument subclass? in test setup can init document doesn't reflect how document setup when it's used app, iboutlet connections aren't made , critical messages such - (void)windowcontrollerdidloadnib:(nswindowcontroller *)acontroller aren't called. so what's correct way initialized nsdocument object use in testing? this how can start: #import <cocoa/cocoa.h> #import <xctest/xctest.h> #import "document.h" @interface documenttests : xctestcase { document *document; nswindowcontroller *controller } @end @implementation documenttests - (void)setup { document = [[document alloc] init]; [document makewindowcontrollers]; controller = (nswindowcontroller *)[document windowcontrollers][0]; } - (void)testloadingwindow { xctassertnotnil(controller.window); } - (void)testtextfieldoutletsisconnected { [controller window]; //kick off window lo

java - How to send mail with attachment in GWT? -

i know if there way send email attachment file gwt. managed send simple email without attachment, having problem when try add file. the problem "fileupload" don't give fullpath of file it seems safety reasons impossible retrieve full path of file client. there way keeping logical server in gwt client? my code client side: fileupload upload = new fileupload(); // cannot retrieve full path string fileattachment = upload.getname(); server side: public void sendmail(string sender, string[] recipients, string subject, string message, string fileattachment) { try { ...(init) // part 2 attachment messagebodypart = new mimebodypart(); // => fileattachment need full path datasource source = new filedatasource(fileattachment); messagebodypart.setdatahandler( new datahandler(source)); messagebodypart.setfilename(fi

c++ - OpenCV Neural Network train one iteration at a time -

the way know train multilayer neural network in opencv is: cvann_mlp network; .... network.train(input, output, mat(), mat(), params, flags); but not print out meaningful debug (e.g. iteration count, current error,...), program sit there until finishes training, troublesome if dataset in gigabytes, there's no way can see progress. how train network 1 iteration @ time, or print out debug while training? problem not solved, question solved. answer: it's impossible far current opencv versions concerned.

How does C allocate space for a 2D (3D...) array when using malloc? -

i having problem understanding how c allocates space 2d (or more dimensional) array, when use malloc , like. take program in this question example. a one-dimensional array of pointers first defined, pointers arrays of 1d data (in case strings) put in each 1 of boxes of first 1d array. there no guarantee whole 2d array contiguous (the last cell of previous row followed first cell of next row). each 1d array of data can distant, pointers contiguous. correct or missing something? appreciate if me clarify this. there various ways of doing it, depending on how you're going access it. can ensure main body of array contiguous, or can avoid that. arrays of strings, don't bother making body of array contiguous. 2d (etc) arrays of integers or doubles, make body of array contiguous. in examples, data type of array generic type t , assumed numeric array elements can assigned 0 . examples not error check memory allocations; should in production code. array access co

Java Regex to Match words + spaces -

i trying construct simple regex match words + whitespace in java, got confused trying work out. there lot of similar examples on site, answers give out regex without explaining how constructed. what i'm looking line of thought behind forming regular expression. sample input string: string tweet = "\"whole lotta love\" - led zeppelin"; which when printed is: "whole lotta love" - led zeppelin problem statement: i want find out if string has quotation in it. in above sample string, whole lotta love quotation. what i've tried: my first approach match between 2 double quotes, came following regex: "\"(\\w+\")" , "\"(^\")" but approach works if there no spaces between 2 double quotes, like: "whole" lotta love so tried modify regex match spaces, , got lost. i tried following, don't match "\"(\\w+?\\s+\")" , "\"(\\w+)(\\s+)\"&qu

c# - calling csharp method from javascript -

this question has answer here: call c# method javascript 3 answers i creating validation using javascript validate pagesize between 1 100.. if errorctr = 0 call gotopage() in codebenhind.. thank in advance. <script type="text/javascript" language="javascript"> function validatepagesize() { var pagesize = document.getelementbyid('maincontent_txtpagesize').value; var errorctr = 0; if (pagesize == "") { alert('records per page should valid number'); errorctr++; } if (pagesize < 0 || pagesize > 100) { alert('records per page should between 1 100'); errorctr++; } if (errorctr == 0) { //missing code } } </script> codebehind: void gotopage() { if (txtpagesize.text

eclipse - Welcome page not closing on perspective change -

i have rcp application in have added intro page (welcome page). implemented using iintropart. mine not xml oriented welcome page. problem: when application started welcome page displayed perfectly. when welcome page still opened (visible), if try open perspective in application, welcome page not moving towards right (as in eclipse ide) making space perspective have selected. so after selecting perspective, perspective not shown , welcome page still occupying entire workbench area. please note that, selected perspectve not hiding behind welcome page. selected perspective getting updated in perspective shortcuts! on restart (after clearing metadata) if manually close welcome page , try open perspective, perspective opens fine. it because of welcome page (when visible) selected perspective not opening in workbench. could please me resolve issue? should behave way welcome page behaves in eclipse ide. i.e, when welcome page still opened, if perspective opened, welcome page sho

php - Instantiate Class using namespaces -

i have function file, in put __autodload() function. classes want use namespaces, since i'm learning them. in folder lib/ have db class , test-user class. code of reads follows: db.class.php <?php namespace app\lib; class db { public $db; function __construct($host, $username, $password, $database) { $this->db = new mysqli($host, $username, $password, $database); if (mysqli_connect_error()) { die('connect error'); } } } user.class.php <?php namespace app\lib; class user { private $_db; function __construct($db) { $this->_db = $db; } public function test() { echo '<pre>'; print_r($this->_db); echo '</pre>'; } } at moment, index file looks this: <?php include 'functions.inc.php'; $db = new db('localhost', 'root', '', 'test'); $user = new user($db); $user-&g

sql - fetch all topics from dbpedia -

how can fetch topics dbpedia in format json, spreadsheet or other can process on them later. can sparql console dbpedia: http://dbpedia.org/sparql i not familiar sparql if @ information page , has links sample queries. 1 of those, example, the beatles . @ foot of example query output page links various json versions of data: rdf: http://dbpedia.org/data/the_beatles.json odata: http://dbpedia.org/data/the_beatles.jsod microdata: http://dbpedia.org/sparql?default-graph-uri=http%3a%2f%2fdbpedia.org&query=describe+%3chttp://dbpedia.org/resource/the_beatles%3e&output=application%2fmicrodata%2bjson json-ld: http://dbpedia.org/sparql?default-graph-uri=http%3a%2f%2fdbpedia.org&query=describe+%3chttp://dbpedia.org/resource/the_beatles%3e&output=application%2fld%2bjson

python - Plotting and GroupBy methods -

i learning take advantage of dataframes in pandas , use groupby methods produce plots of following: i have 2 dataframes, 1 x-axis information , 1 y. in each dataframe there 3 versions of data, 'a', 'b', 'c'. need plot of y vs x each of (i.e. 3 lines). example code: df_x <class 'pandas.core.frame.dataframe'> int64index: 100 entries, 0 99 data columns (total 3 columns): 100 non-null values b 100 non-null values c 100 non-null values dtypes: float64(2), object(1) df_y <class 'pandas.core.frame.dataframe'> int64index: 100 entries, 0 99 data columns (total 3 columns): 100 non-null values b 100 non-null values c 100 non-null values dtypes: float64(2), object(1) is there quick way produce desired plot avoiding loops , using pandas methods? i'm thinking of merging both frames , using groupby methods, don't know how go doing exactly. thanks! i think can plot directly using pyplot:

php - Counting my array result -

i making search box, , want count result, try put count nothing happens. $con = mysql_connect("localhost","root",""); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("concatenate", $con); if($_post['lname'] != '' or $_post['fname'] != ''){ $searchq = $_post['lname']; $searchw = $_post['fname']; $result = mysql_query("select * sheet1 lname '%$searchq%' , fname '%$searchw%' "); i hoping count result can't. while($row = mysql_fetch_array($result)) { echo "<tr>" . "<td><b>" . $row['lname'] . "</b></td>" . "<td>" . $row['fname'] . "</td>" . "<td>" . $row['address'] . "</td>" .

ruby - cascade_callbacks not working for embedded doc in mongoid -

i'm using mongoid, , have 1 class (order) "embeds_many" of class (lineitem). specifically, in order, have: embeds_many :line_items, cascade_callbacks: true and in lineitem, have: embedded_in :order everything works should except cascading_callbacks. when make change order object , call "save", expect "after_save" callbacks on of embedded lineitem objects called. not happening. thought point of cascading_callbacks. am incorrect? else required make save-related callbacks fire each embedded document when parent saved , cascade_callbacks set true in relationship? i think, when specify cascade callbacks: true in parent document, callbacks of embedded documents fired when make change in corresponding embedded document. check, change in embedded document , save parent document. in case think callbacks fired

How to add direction indicator in google map v2 in android -

Image
i want add direction indicator in map, coode enable indicator, not displayed yet. uisettings muisettings = mmap.getuisettings(); muisettings.setcompassenabled(true); though enable compass in settings, direction compass visible after change bearing of map default. if have enabled touch gestures, can rotate map fingers changed bearing , start seeing compass

git remote - Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException -

the protocol between local repository , remote repository https instead of ssh,does still need lib of jsch,and if it's true, can tell me how handle in details,thanks much~~ even if isn't used https access, jsch still required jgit. see jgit dependencies . that thread states same thing , when cloning https repo. this blog post deals missing jsch library so: there 2 ways solve problem, depending on setup. 1.) if you're using ant installed on machine, example on c:\apache-ant. place jsch.jar in it's lib folder. 2.) in case using eclipse's ant plugin. open eclipse click window->preference in type filter textbox type "ant" click runtime expand "global entries" add external jar, , locate jsch.jar in system

ruby - How do I wrap a C function and pass it parameters? -

i have wrap c function abc_ntkcreatenodeand using ruby: abc_obj_t * abc_ntkcreatenodeand( abc_ntk_t * pntk, vec_ptr_t * vfanins ) { abc_obj_t * pnode; int i; assert( abc_ntkislogic(pntk) || abc_ntkisnetlist(pntk) ); pnode = abc_ntkcreatenode( pntk ); ( = 0; < vfanins->nsize; i++ ) abc_objaddfanin( pnode, (abc_obj_t *)vfanins->parray[i] ); if ( abc_ntkhassop(pntk) ) pnode->pdata = abc_sopcreateand( (mem_flex_t *)pntk->pmanfunc, vec_ptrsize(vfanins), null ); else if ( abc_ntkhasbdd(pntk) ) pnode->pdata = extra_bddcreateand( (ddmanager *)pntk->pmanfunc, vec_ptrsize(vfanins) ), cudd_ref((ddnode *)pnode->pdata); else if ( abc_ntkhasaig(pntk) ) pnode->pdata = hop_createand( (hop_man_t *)pntk->pmanfunc, vec_ptrsize(vfanins) ); else assert( 0 ); return pnode; } the code wrote is: static value abc_ntkcreatenode_and(value self, value netw ,value vfan_ins) { abc_ntk_t *netw_str; vec_ptr_t *vf

iphone - Filtering an NSDictionary within a dictionary with particular text -

i getting web service repsonse array of dictionary. each dictionary has objects values dictionary.i need implement search within response,like if enter "technology" , go search, should dictionary array has "technology anywhere within dictionary", there solution sort out { key1 = { 0 = { "id" = 608; "b" = "apple-iphone"; }; 1 = { "id" = 609; "b" = "iphone"; }; 2 = { "id" = 610; "b" = "show text"; }; }; key2 = "technology resources"; "key3" = { 0 = { "id" = 1608; "b" = "i love reading"; }; 1 = { "id" = 1609; "b" = "i prefer iphone others"; }; 2 = { "id" = 1610;

javascript - jquery unexpected token on radio click -

here's code // when dom ready $(document).ready(function() { // 'click' because ie likes choke on 'change' $('input[name=passedparameter]').click(function(e) { // prevent normal, boring, tedious form submission e.preventdefault(); // send server out-of-band xhr $.post('http://localhost/topostthepost.php', function() { data: $(this).val(), success: function(resp) { if(resp == '1') { alert('saved successfully'); } else { alert('oops, went wrong!'); } } }); }); }); im new jquery, in javascript, far thought, logically possible , right code, -when open response page, ( http://localhost/topostthepost.php ), went good, -im using php framework, need post " http://localhost/ " got right url, -when run page, wont thing, inspect element

Can i use Google App Engine as a replacement for Google Apps to send email from php-driven webapp? -

righty, i'll use bullets make clear possible! my application lives on server (and doesn't use g.a.e) currently use google apps (paid) mail server in php, it's great but... it's limited ~2000 emails per day, need send more in forthcoming version of web app. . can use gae's emailing via remote api? can view sent/received email in gmail can google apps? am totally barking wrong tree?! yes can send emails gae , in php. need valid gmail or google apps account use sender address. things note: the cost of 1 email $0.0001. the size of sent/received emails add bandwidth cost. there quotas , varying free apps , billable apps. free app limit 100/day, billable app quota 20,000/day. (you need pay first bill in order go beyond free quota limit, if enabled billing). need have premier account go beyond 20,000/day limit (they might approve without premier account if ask them. there technical limits . no, emails sent gae not show in senders outbo

oop - Generic setter function for local properties in PHP -

i'm planning log modifications properties of object. php has magic method __set overload attempts modify (private) properties outside object. however, not apply inside object. is there way in php have generic setter function calls modify local propery of object? example: class thing { private $data; public function editdata() { $this->data = 'edited'; } function __magic($property, $value) { if ($property === 'data') { print 'data being edited!'; } } } i want __magic function called before $data edited. no, inside object properties accesible , don't need magic method. if want asign properties throw function, have slighty modification in code: class thing { private $data; public function editdata() { $this->propertysetter('data', 'edited'); } function propertysetter($property, $value) { if ($property === 'data') { print 'data being

php - Google App Engine Server IP adresses -

i'm migrating our system google app engine. when our pdf generator needs external resource (for example picture) internal http request (where request ip different user ip). starts different session, cannot see if user logged. in order give right permissions, need check if request comes server ip. in previous code checked trough following code: if($_server['remote_addr'] == $_server['server_addr']) { return true; } but since $_server['server_addr'] not available, cannot used. in new code check trough following code: $allowed_ips = array( '127.0.0.1', '8.35.201.100' ); if(in_array($_server['remote_addr'], $allowed_ips)) { return true; } the problem is; not know ip addresses google app engine uses internal request. have found ip address 8.35.201.100 server address, there more ip addresses or maybe ranges. the task queues google app engine issues requests ip address 0.1.0.2 ( https://developers.google.com/appe

How can a C# program use a C++ dll of any version? -

we're creating dll, written in c++, providing access hardware. have c# program uses dll. we're having issue versions. indeed, when running c# program, absolutely wants use exact c++ dll version used when compiling. i.e. if c# program compiled using c++ dll 1.2.3.4, program refuse run c++ dll 1.2.3.5. i'd instruct c# program use c++ dll version 1.2.anything. where can configure in c# project? this question has been superseded that one , more related com. nothing fancy exists in c++. using side-by-side manifest technically permits have known since have typed version number in manifest of c# program. the far more explanation created c++/cli assembly. many programmers confuse c++/cli c++. easy mistake since language permits using native c++ code. gets compiled mixed-mode assembly, assembly contains both il , native code. normal clr version checking occurs such assembly when clr loads it, happy exact version match. strong dll hell counter-measure.

android - Multiple textviews are not shown in Linear layout -

i try develop small android app , use fragments tab feature. here tab3's layout: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff0000" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/european_central_bank" /> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="türk lirası: " /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_he

css3 - media query iPad in landscape mode and above -

my css looks this: /* width 1024px 1600px */ /* main css */ /* width 1601px 1920px */ @media screen , (min-width: 1601px) { /* css */ } /* wider 1920px */ @media screen , (min-width: 1921px) { /* css */ } /* mobile */ @media screen , (max-width: 1023px) { /* css */ } everything works expected except ipad in landscape mode shows mobile version although mobile version targets devices 1023px. want ipad show main css.

javascript - document.body.style.backgroundColor is undefined -

i have javascript function called when user clicks div current background color (white on laptop) of web page: <div id="div1" onclick="checkbkcolor(id, 1)">just testing web page bk color </div> here checkbkcolor() function: <head> <script type="text/javascript"> // nothing commented out: document.body.style.backgroundcolor = "red"; function checkbkcolor(id, val) { // returns nothing color -- alert box // says "the document.body.style.backgroundcolor is: " // , nothing else alert("the document.body.style.backgroundcolor is: " + document.body.style.backgroundcolor); document.body.style.backgroundcolor = "red"; // alert box shows 'red' color name, *and* // web page's background has turned red alert("the document.body.style.backgroundcolor is: " + document.body.style.backgroundcolo

c# - Handling exceptions from a method that could fire multiple exceptions -

i have api class using memorystream , gzipstream classes compress , decompress string byte array. using these 2 classes number of exceptions may throws , wondering best method of handling thrown exception api. in case be better wrap each of exception own custom exception or preferable capture each individual exception in calling code? i suppose question not limited particular use case more general exception handling best practices. /// <summary> /// compress string using sharplibzip gzip compression routines /// </summary> /// <param name="s">string object compress</param> /// <returns>a gzip compressed byte array of passed in string</returns> /// <exception cref="helper.core.compression.stringcompressionexception">throw when compression memory stream fails </exception> /// <exception cref="system.argumentnullexception">throw when string parameter null</exception> /// <exception cr

android - Saving read/unread state in listView -

i'm making app can reserve message php server , append new message in listview, mark point on item show unread,of course disappear when click item, these question: how can save read/unread mark on each item in order when login app next time still can see mark. i have tried using share preference seems not solution.there may key save , it's inconvenient when modify value. is need sqlite ? or have easier solution? need help.

php include variables without including -

can 1 tell me how "include" variable .php file without other content. index.php <?php $info=file('somedir/somefile.php'); $v1=trim($info[2]); $v2=trim($info[3]); $v3=trim($info[4]); ?> the somedir/somefile.php <?php $variable=something; $variable2=someotherting; $variable3=thirdone!; other content there may not runned or showed. ?> can please me?? edit: its dynamic page. <html> <?php include_once 'config.php'; include_once 'includes/mysqlconnect.php'; $url_slash=$_server['request_uri']; $url= rtrim($url_slash, '/'); //$url = basename($url); $info=file('sites/'.$url.'.php'); $title=trim($info[2]); ?> <head> <meta charset="utf-8"> <title>$title</title> <link rel="stylesheet" type="text/css" href="<?php echo $domain;?>themes/reset.css">

How to remove the parent numeric keys of php array -

i've array in php below array ( [0] => array ( [0] => 40173 [1] => 514081 [2] => 363885 [3] => 891382 ), [1] => array ( [0] => 40173 [1] => 5181 [2] => 385 [3] => 891382 ) ) now want remove parents indexes 0,1... , want values (only unique values). thanks. one possible approach using call_user_func_array('array_merge', $arr) idiom flatten array, extracting unique values array_unique() : $new_arr = array_unique( call_user_func_array('array_merge', $old_arr)); demo . obviously, it'll work array of length.

Target an options text area for a product in opencart for javascript code? -

im new opencart , javascript. trying target textarea option associated product in opencart can implement javascript code. @ moment have alert box appears when type in textarea, doesnt seem work. question, possible target these option textareas generated opencart end? below snippet of javascript code seems work on other textareas not on option textareas. <script type="text/javascript"><!-- $(document).ready(function() { $('.options').keyup(function() { alert('test'); }); }); //--></script> append following snippet product.tpl, before last line <?php echo $footer; ?> <script type="text/javascript"><!-- $(document).ready(function() { $(".options textarea").keyup( function() { alert('test'); }); }); //--></script> whenever input characters, there alert coming out. notes: maybe hope 1 whenever mouse up, can bind mouseup event.

PHP explode string -

i have string: 0|dy1497oryosldy932oslcph|1|0|0 and need explode that: 0| dy1497 ory osl dy932 osl cph |1|0|0 $string1 = 'dy1497'; $string2 = 'ory'; $string3 = 'osl'; $string4 = 'dy932'; $string5 = 'osl'; $string6 = 'cph'; i searched, find how explode when text separated / , - , etc. ideas? the best choice regex: if (preg_match('/|(.{6})(.{3})(.{3})(.{5})(.{3})(.{3})|/', $string, $matches)) { echo $matches[1]; echo $matches[2]; echo $matches[3]; echo $matches[4]; echo $matches[5]; echo $matches[6]; } this divides string length in characters. may need modify needed. see http://regular-expressions.info

union - SQL query to find the friends in a table -

i have 2 tables, users , friends . tables like: users | id | name | | 1 | sam | | 2 | harry | | 3 | vivi | | 4 | sabrina | friends | uid | friendid| | 1 | 2 | | 2 | 3 | | 4 | 1 | | 5 | 4 | | 1 | 3 | i need find names of friends sam. tried doing same using union in sql query, couldn't desired output. can possibly required output doing same? declare @answer nvarchar(max)='{' select @answer=@answer+u1.name+',' users u inner join friends f on f.uid=u.id inner join users u1 on u1.id=f.friendid u.id=<what ever want> //1 or 2 or 3 or 4 set @answer=substring(@answer,0,len(@answer)-1)+'}' select @answer

sql - please help me in solving this count query -

i wanted find count of mobile nos table below query select name, count(mobile no) count table count<=5 this query throws me error...please me out on sql server, if have object names contains spaces or other special characters, need put names in square brackets. furthermore, if want apply filter aggregate function, should happen in having part of statement, instead of in where part. means need group name column. try change query this: select name, count([mobile no]) count table group name having count([mobile no])<=5

oracle11g - Iteration on result of a sql -

i having result 1 sql. ex: select * employee. want iterate each record of above sql , update column of employee table differrent values.i using oracle database. code of is: declare cursor cur_schedule_parameter select schedule_parameter_type (parm_typ_cd, parm_operand_1_val, parm_operand_2_val, sched_id, sched_parm_id, void_evnt_id, parm_oper_typ_cd, add_evnt_id) schedule_parameter parm_operand_1_val in ('c|s', 's|c'); v_sched_param_array schedule_parameter_type_tab; begin if cur_schedule_parameter%isopen close cur_schedule_parameter; end if; open cur_schedule_parameter; fetch cur_schedule_parameter bulk collect v_sched_param_array; indx in v_sched_param_array.count loop

ios - Multipeer Connectivity: connectedPeer is not connected? -

i want send resource multipeer connectivity framework, see below. strange thing log says: [self.mysession connectedpeers]: ( "<mcpeerid: 0x10fc9d60 displayname = ipad>" ) error: peer not connected so peer connected, , in next line says not connected. how, why? delegate methods implemented on client side. dispatch_async(dispatch_get_main_queue(), ^{ nslog(@"[self.mysession connectedpeers]: %@", [self.mysession connectedpeers]); [self.mysession sendresourceaturl:u withname:@"apple" topeer:[self.mysession connectedpeers] withcompletionhandler:^(nserror *error) { if (error) { nslog(@"error: %@", [error localizeddescription]); } else{ uialertview *alert = [[uialertview alloc] initwithtitle:@"mcdemo" message:@"file sent."

java - Android application trying to implement login via Google plus shows strange system error -

i trying login via google plus in application, getting strange error , have searched everywhere , regarding same, no luck. below code implementation been done. logcat showing system error of java.lang.illegalargumentexception: googleapiclient parameter required mainactivity.java public class mainactivity extends activity implements com.google.android.gms.common.googleplayservicesclient.connectioncallbacks, com.google.android.gms.common.googleplayservicesclient.onconnectionfailedlistener, onclicklistener, onaccessrevokedlistener{ private static final string tag = "mainactivity"; // magic number use know our sign-in error // resolution activity has completed. private static final int our_request_code = 49404; // core google+ client. private plusclient mplusclient; // flag stop multiple dialogues appearing user. private boolean mresolveonfail; // can store connection result failed connect() // attempt in order make application feel bit more // responsive user. priv