Posts

Showing posts from March, 2014

eclipse plugin - How to programmatically update the selected resource for link-with-editor functionality? -

my eclipse plugin provides editor contains list of files (as result of dependency search). when user selects file in list, file/resource should highlighted in package/resource explorer. this done using link-with-editor functionality of explorer view if there call like: updateselectedresource(iresource) call within editor explicity set active file. actual call? your editor must become iselectionprovider . in eclipse faq complete example, important line registering selection provider getsite().setselectionprovider(viewer); . afterwards selected file in list automatically told selection listeners, including package explorer. if want big picture selection service (which responsible making views react on selections in other views), there eclipse article describing in detail. and if find wanting interact more existing views, may want have @ iadaptable, described here , not necessary package explorer linking.

sql - Find all but allowed characters in column -

i have query i've been trying make, it's supposed pull rows not contain characters not want. select nid notes note '%[^0-9a-za-z#.;:/^\(\)\@\ \ \\\-]%' that should return rows not contain 0-9 a-z a-z . : ; ^ & @ \ / ( ) # but time add 1 of these below fails $ [ ] ? even trying escape them either \ or [[ doesn't seem work properly. have access stock sql install. it's supposed pull rows do not contain characters not want. to find rows contain x can use like : select * yourtable col '%x%' to find rows do not contain x can use not like : select * yourtable col not '%x%' so query should use not like because want rows don't contain something: select nid notes note not '%[0-9a-za-z#.;:/^\(\)\@\ \ \\\-]%' that should return rows not contain 0-9 a-z a-z . : ; ^ & @ \ / ( ) # no. because of ^ @ start, returns rows don't contain characters except those . characters listed...

php - Mysql server has gone away - MySQL error 2006: -

when trying edit table data in 1 of databases, can't apply change because of error "mysql error 2006: mysql server has gone away"` this problem intermittent. did research on , came across post . (note: i'm not @ knowledgeable on databases , php). see mysql_ping pings server connection or reconnects if there no connection. sounds great. issue how apply mysql_ping? go , it? ok apply or effect things? my server runs off windows 2003, iis , have php 5.3.8. i've had here i'm battling understand it. make subroutine/function includes mysql_ping , , use insted of mysql_query . for example <?php function my_query($sql) { if(!mysql_ping()) { if(!mysql_connect( /* add connection parameters here */ )) { trigger_error("database not avaible: " . mysql_error()); return false; } } return mysql_query($sql); } ?>

for xml - SQL Server 2008: How to remove namespace from the elements, but let it display on root -

i using sql server2008 xml clause generate xml file using bcp. when use below query, result fine: with xmlnamespaces ( 'http://base.google.com/ns/1.0' g, default 'http://www.w3.org/2005/atom' ) select id, name "g:name" paymentmethods xml path ('entry'), root('feed') result: <feed xmlns="http://www.w3.org/2005/atom" xmlns:g="http://base.google.com/ns/1.0"> <entry> <id>1</id> <g:name>bpay</g:name> </entry> <entry> <id>2</id> <g:name>cash</g:name> </entry> </feed> but want add static elements, say, title , date after root. able that, then, namespace tags appear in element don't want. please note, want elements namespace prefix eg, query using is: with xmlnamespaces ( 'http://base.google.com/ns/1.0' g, default 'http://www.w3.org/2005/atom' ) select ...

post - Facebook App stream not always showing -

i created new facebook app. when test it, doesn't show stream post. works, when remove app personal facebook , try again doesn't show stream post again. familiar problem? kind regards, mark when reauthorise app, ask read_stream extended permission? https://developers.facebook.com/docs/authentication/permissions/

extjs - custom picker editor with a grid -

using extjs4, have created custom grid. 1 column editable using picker. if wanted editable text field, define row as: {dataindex: 'valuescore', width: 40 text:'value', field: {xtype: 'textfield'}} so think should able this: {dataindex: 'valuescore', width: 40, text:'value', field: {xtype: 'pickerfield'}} but how define picker fields, etc? right way this? thanks sha pointed me in right direction on this. first of all, turns out wanted combobox (single select), not picker. regardless, did not understand (and not find doc for) ext-js create these selection objects (like combobox), , need pass creation parameters in "field" parameter. example: {dataindex: 'valuescore', width: 40, text:'value', field: {xtype: 'combobox', store: mystore, querymode: 'local', displayfield: 'value', valuefield: 'value'} here ...

How to Rails rake multiple commands with one environment? -

is there way multiple rails 3 rake commands on 1 line, requiring environment initiated once? i know possible: rake db:rollback db:migrate but if options passed, rake db:migrate version=0 db:migrate the second 'db:migrate' won't run. i don't think possible. the quickest solution can think of is: rails_env=test rake db:migrate version=0 && rake db:migrate the reason why believe not possible because version constant, not attribute passed db:migrate option. example, of these commands work: rake db:migrate version=0 rake version=0 db:migrate version=0 rake db:migrate and since can't rewrite constant in same action again, call db:migrate version=0 twice.

elasticsearch - Why do two identical documents score differently? -

i'm figuring out tire gem (i'm new elasticsearch , lucene) , trying things out. need (probably non-trivial) scoring try grip on that. read find on web scoring formula , trying match found explained query. if read figures correctly, documents title "foo foo foo foo" have different score, not intended. guess missing step during or after indexing, not figure out. below code. i'm not going way tire dsl intended because want figure things out -- things may more tire-ish @ time later. require 'tire' require 'pp' class model index = 'myindex' type = 'company' class << self def delete_index tire.index(index) { delete } end def create_mapping tire.index index create mappings: { type => { properties: { title: { type: 'string' } } } } end end def refresh_index tire.index index refres...

c# - Textbox onchange event -

so have text box, add onchange event of markasexception. my javascript - function markasexception(recordid) { //alert("exception"); //mark exception column document.getelementbyid("ctl00_cpmain_lblscrollexception_" + recordid).innertext = "exception"; document.getelementbyid("ctl00_cpmain_lblscrollexception_" + recordid).style.color = "#ff0000"; document.getelementbyid("ctl00_cpmain_tdscrollexception_" + recordid).style.backgroundcolor = "#99ccff"; //enable comments ddl , remove blank (first item) document.getelementbyid("ctl00_cpmain_ddlcommentid_" + recordid).disabled = false; document.getelementbyid("ctl00_cpmain_ddlcommentid_" + recordid).focus(); document.getelementbyid("ctl00_cpmain_ddlcommentid_" + recordid).options[0] = null; } what want is, when user changes value in textbox, mark column "exception", , focus drop down lis...

html - I want to mine this way of making a table element is a good or not good? -

Image
i have condition shown in image it allow use simple html table element solve. i wonder solution best already? http://jsbin.com/exazif/ to code: http://jsbin.com/exazif/edit#javascript,html if must use <table> , method good. should not write colspan="250" . colspan not designed that. if not have use <table> use floated div's. to honest, there big debate better: tables or divs. read more here. this pretty good tutorial on basic tables.

iphone - Calling methods with specific values -

for code example below, use [self fall]; instead of code @ *, need value of i sent fall method well. how do this? - (void)main { (int i=0; <= 100; i++) { [image[i] fall]; * } } - (void)fall { // manipulate image[i]; separately loop } edit: accept oldest answer correct. thanks! you need - - (void)fall:(int)i { // manipulate image[i]; separately loop } and call - - (void)main { (int i=0; <= 100; i++) { [image fall:i]; } } edit - if want pass index- - (void)fall:(int)i { // manipulate image[i]; separately loop } and call - - (void)main { (int i=0; <= 100; i++) { [self fall:i]; // here can either pass index } } if want pass image - - (void)fall:(uiimage)i { // manipulate image[i]; separately loop } and call - - (void)main { (int i=0; <= 100; i++) { [self fall:imagei]; // here need pass image, if image stored in array, fetch array. or need manipulate in way in storing. } }

android - Layout mismatch of device and emulator (phonegap + jquery mobile) -

i have simple application, sort of warm-up starter jquery on phonegap. run on emulator , runs fine. layout looks, good, supposed to. when install .apk on device (which happens galaxy s), html expect see ... off. mean is, on device has no colours, no transitions, plain blue links in white background. javascript files or css files not included properly? im totally newbie on this, please me out. followed http://jquerymobile.com/ 1 supposed drag , drop layout , download html,css, js files , include in project. followed http://docs.phonegap.com/en/1.8.1/guide_getting-started_android_index.md.html#getting%20started%20with%20android started phonegap. my app name 'settling' , java file looks this: package maddy.application; import android.app.activity; import org.apache.cordova.*; import android.os.bundle; public class settlingactivity extends droidgap { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate...

packaging - Problems running java classfile from the folder -

i have 3 source files in folder. want compile them using commandline , execute them. however, i'm having following issue. on windows box: code compiles fine: c:\mycode\src\code>javac source1.java source2.java source3.java does not run folder class files are: c:\mycode\src\deckofcards>java source1 exception in thread "main" java.lang.noclassdeffounderror: source1 (wrong name: code/source1) @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclasscond(unknown source) @ java.lang.classloader.defineclass(unknown source) @ java.security.secureclassloader.defineclass(unknown source) @ java.net.urlclassloader.defineclass(unknown source) @ java.net.urlclassloader.access$000(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java...

Delete a row from a text file with Python -

i have file each line starts number. user can delete row typing in number of row user delete. the issue i'm having setting mode opening it. when use a+ , original content still there. however, tacked onto end of file lines want keep. on other hand, when use w+ , entire file deleted. i'm sure there better way opening w+ mode, deleting everything, , re-opening , appending lines. def deletetodo(self): print "which item want delete?" deleteitem = raw_input(">") #select line number delete print "are sure want delete number" + deleteitem + "(y/n)" verifydelete = str.lower(raw_input(">")) if verifydelete == "y": file = open(todo.filename,"a+") #open file (tried w+ well, entire file deleted) filelines = file.readlines() #read , display lines line in filelines: file.truncate() if line[0:1] != deleteitem: #if number (first character) of...

javascript - URL string parameters passed to MVC controller action arrive as null -

have controller: public class mycontroller : controller { [httpget] public actionresult myaction(int imode, string strsearch) { return view(); } } in view have div id=center i execute following code in javascript url = "/mycontroller/myaction?imode=7&amp;strsearch=as"; $('#center').load(url); when debugger breakpoint in action on first line, imode variable shows proper value of 7, strsearch parameter arrives null. any help/advice welcome. just use ampersand instead of &amp; url = "/mycontroller/myaction?imode=7&strsearch=as";

Entity Framework 5 vs Telerik OpenAccess ORM (specifically) -

i starting new project , want advice on choosing orm. know topic has been brought before, topic specific either entity framework 5 (not 4) or telerik openaccess orm. the project reside on windows azure , use windows azure sql database. migrate .net 4.5 once 4.5 live on azure. i telerik ultimate collection subscriber. does in know have pros/cons scenario? leaning towards telerik openaccess @ moment. thanks first off, comment: "this not answer - may want keep eye on following if intend use openaccess against azure: telerik.com/community/forums/orm/orm-express/… " not reflect correct product. deals free version of openaccess. jayantha specified in question "ultimate collection subscriber". the openaccess orm compatible azure. some reasons choose openaccess orm on entity framework 5: batch operations in visual designer code generation wcf services code generation asp.net web api services dynamic model modifications custom types framew...

wpf - WCF windows service with UI (Server side) + Client Side UI -

i making application client/server (both wpf) @ server side wish make wcf (windows service) communicate client side but want settings of wcf service configurable (paths,ports,credentials bindings etc..) server side gui comes in picture. how make presenration layer of server side configure windows service (including wcf specific attributes)

asp.net mvc 3 - jquery datatables actionlink how to add -

i have been searching last few hours, , unfortunately cannot seem find example of how populate datatable action edit , delete link column using .net , mvc. here have far, how add action link? missing? <script type="text/javascript"> $(document).ready(function () { $('#mydatatable').datatable({ bprocessing: true, sajaxsource: '@url.action("index1", "default1")' }); }); </script> <div id="container"> <div id="demo"> <table id="mydatatable"> <thead> <tr> <th> roleid </th> <th> rolename </th> <th> userid </th> <th> username </th> </tr> <...

multithreading - C# , how reach something in current thread that created in other thread? -

i'm writing chat client/server app c# , have problem threading. wrote simple code showing problem. i used thread_1 showing form show second (maybe thread_1 terminated , closed form , isalive said alive !). thread_2 try reach texbox created on main thread shows me: "cross-thread operation not valid: control 'textbox2' accessed thread other thread created on." i dont know how solve first problem solved second problem backgroundworker thread. there way? public partial class form1 : form { public form1() { initializecomponent(); } thread t1; thread t2; private void button1_click(object sender, eventargs e) { t1 = new thread(dothread1); t1.name = "thread_1"; t2 = new thread(dothread2); t2.name = "thread_2"; t1.start(); t2.start(); messagebox.show(t1.isalive.tostring()); } private void dothread1() { form frm2 = new...

Inserting into Database through Edittext Field in Android -

i new android . not able insert data database. although accepting text through edittext field not saving in database. i want insert data database table using xml button's android:onclick attribute. when click on on save button app crashes immediately //interviewactivity.java import java.util.arraylist; import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.tablelayout; import android.widget.tablerow; import android.widget.textview; import android.widget.remoteviews.actionexception; import android.widget.toast; import android.content.contentvalues; import android.content.intent; import android.database.sqlite.sqlitedatabase; public class interviewactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.we...

ExtJS: How to position SplitButton menu relative to SplitButton -

i have splitbutton @ bottom of page , not visible initially(we need scroll down see bottom). when scroll splitbutton, press arrow button expand splitbutton's menu, menu appears under splitbutton(just planned), , scroll up, the menu remains on screen , , positioned relative window , not containing div. tried initialize menu passing floating: false it's config, in case menu doesn't expands @ all. how can posision splitbutton's menu have always under splitbutton? my extjs version 4.07 i think you're doing wrong. i've tried with: ext.create('ext.panel', { renderto: ext.getbody(), html: 'loooooong panel', height: 1500, dockeditems: [{ xtype: 'toolbar', dock: 'bottom', items: [{ xtype: 'splitbutton', text: 'my button', menu: [{ text: 'menu1' },{ text: 'menu2' ...

Memory error in Python for loops -

i'm trying find largest prime number contained within large number. maxlen = 1024 in range(1023, -1, -1): maxlen -= 1 number = "" k in range(maxlen, -1, -1): number = pi[k] + number if isprime(number) == true: print number isprime() function checks if number prime (pretty standard). works pretty point memoryerror. this not because number checked function large since happens around 6th run of first loop. i've tried gc.enable() , gc.collect() without positive result. does have idea how fix this? edit: definition of pi , isprime() per request: f = open("/root/number", "r") pi = f.read() f.close() where file "number" contains original number in i'd find prime. def isprime(n): n = abs(int(n)) if n < 2: return false if n == 2: return true if not n & 1: return false x in range(3, int(n**0.5)+1, 2): ...

ruby - How do I get the root directory of a Rails app in a Gem -

is possible know rails file system root of application in code of gem included in app? this sample of gem source: module mygem def self.included(base) puts rails.root # return nil end end actioncontroller::base.send :include, mygem thank's , sorry poor english the solution found fix similar problem include module using railtie initializers. so, in /lib/mygem/railtie.rb module mygem class railtie < rails::railtie initializer "include code in controller" activesupport.on_load(:action_controller) include mygem end end end with code, module included after actioncontroller loaded , able use rails.root let me know if works you.

Separate Count for multiple items within a day MySQL -

i trying display status of multiple claims 1 day @ time. example, "date1" has 3 claims. each claim has different status. how can display status count claims within "date1". namely, order results earliest latest date have 3 columns count how many claims day have status. 3 status columns should add total number of claims day. like: (st1 - st3 represent unique statuses) date st1 st2 st3 12-02-12 | 1 | 2 | 3 12-03-12 | 2 | 5 | 3 12-04-12 | 7 | 3 | 8 the query started working looks this, entirely incorrect. select dates, statuses, count(*) st1 table_dates group dates; this attempt count of 1 status. figured had start somewhere. thank you. what can this: select sum(if(statuses = st1,1,0)) st1, sum(if(statuses = st2,1,0)) st2, sum(if(statuses = st3,1,0)) st3 table_dates group dates;

c# - WPF Command CanExecute Not Being Re-Evaluated When DataContext Changes -

i'm having trouble getting canexecute method of command work property. i've bound command button inside of datagrid. i've bound commandparameter button's datacontext, happens record row in datagrid. what expect happen canexecute method re-evaluated when commandparameter binding changes, in case row's datacontext property being set. instead of evaluating canexecute method against row data, looks canexecute method being evaluated before row gets datacontext , never re-evaluated after datacontext has been updated. can tell me how canexecute method of command evaluated against each row's datacontext? i've created sample application demonstrate problem. here's code: the code-behind mainwindow.xaml public partial class mainwindow : window { public observablecollection<logrecord> records { get; private set; } public icommand signoutcommand { get; private set; } public mainwindow() { initializecomponent(); data...

c# - What is needed to convert ASN.1 data to a Public Key? e.g. how do I determine the OID? -

this code relates dkim signature verification used in anti-spam efforts. i have byte[] s1024._domainkey.yahoo.com asn.1 encoded, don't know if alone contains enough information materialize public key. based on this class , appears can convert asn.1 key x509certificate public key, need supply oid , asn.1-encoded parameters. in example have metadata asn1 key is: an rsa encoded key (asn.1 der-encoded [itu-x660-1997] rsapublickey per rfc3447) used either sha1 sha256 hash algorithms uses oid relating following table section a.2 of rfc3447 (though don't know how turn information full oid) /* * 1.2.840.113549.1 * md2 md2withrsaencryption ::= {pkcs-1 2} md5 md5withrsaencryption ::= {pkcs-1 4} sha-1 sha1withrsaencryption ::= {pkcs-1 5} sha-256 sha256withrsaencryption ::= {pkcs-1 11} sha-384 sha384withrsaencryption ::= {pkcs-1 12} sha-512 sha512withrsaencryption ::= {pkcs-1 13} */ code sample string pubkey = "migfma0gcsqg...

objective c - Apps made with new XCode won't run on iPod 2g -

i upgraded latest version of xcode, apps made new version aren't running on old ipod. have target version set 4.0, when ipod 4.2.1. when press run button goes through normal building process, says "running on ipod" says "finished running on ipod". doesn't run , app isn't added screen. if try run project made on , older version of xcode works. how can fix this? you need add armv6 list of valid architectures. go target settings, go "build settings", search "valid" find "valid architectures", , change have 2 values, armv6 , armv7 .

image - Forcing aspect ratio with CSS doesn't work on Safari -

the following code works in firefox , chrome, doesn't in safari (tested on mac , ipad): http://jsfiddle.net/efd87/ . <div id="wrapper"> <div id="content"> <img src="http://farm3.staticflickr.com/2783/4106818782_cc6610db2c.jpg"> </div> </div> #wrapper { position: relative; padding-bottom: 33.33%; /* set ratio here */ height: 0; } #content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: green; text-align: center; } #content img { max-height: 100%; }​ the goal have wrapper div keep fixed aspect ratio ( in web application carousel ), , image inside resize fit in div (and center). on safari image doesn't display because of height: 0 (which give height of 0 img). height: 100% image display doesn't fit div (it overflows). do see solution problem? i've been on hours... this isn't great answer q...

java - Eclipse doesn't recognize listFiles(Filter paramFileFilter) -

Image
how can fix this? eclipse doesn't recognize function: listfiles(filter paramfilefilter) see these screenshots: check type of filefilter ; chances it's not java.io.filefilter

iphone - SplitView Controller Can't Pass From Master to Detail -

i trying convert ipad app using tab bar controller root view using split view controller it. code in appdelegate.h is: @class rootviewipad; @class webviewcontroller2; @interface appdelegate : nsobject <uiapplicationdelegate, uisplitviewcontrollerdelegate> { uiwindow *window; uisplitviewcontroller *splitviewcontroller; } @property (nonatomic, retain) iboutlet uiwindow *window; @property (nonatomic, retain) iboutlet uisplitviewcontroller *splitviewcontroller; @end the .m is: #import "appdelegate.h" #import "webviewcontroller2.h" @implementation appdelegate @synthesize window; @synthesize splitviewcontroller; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window.rootviewcontroller = self.splitviewcontroller; [self.window makekeyandvisible]; return yes; } i use ib set up, , added splitviewcontroller in mainwindow, , connected appdelegate connection splitviewco...

android - change the return key -

Image
i want change name of enter button (the button circled in image ) search so used <edittext android:imeoptions="actionsearch" android:imeactionlabel="search" android:id="@+id/et_patientid" android:layout_width="400dip" android:layout_height="50dip" android:layout_torightof="@id/tv_patientid" android:background="@android:drawable/editbox_background" /> but didn't work add android:imeoptions="actionsearch" , android:inputtype="text" edittext view also add editor action listener edittext.setoneditoractionlistener(new textview.oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { if (actionid == editorinfo.ime_action_search) { performsearch(); return true;...

java - hibernate simple inheritance - OR - xml property import/include -

final goal: have few java objects sharing same base class persisted database while each 1 having own self-contained table own/inherited objects, , simple auto-generated database id . very simple requirement. impossible (?) hibernate! what have far (using mysql, hibernate xml mapping): map.hbm.xml <?xml version="1.0"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping default-access="field" default-lazy="false"> <class name="xyz.url.hibernate.entitybase" abstract="true"> <id name="m_id" column="id"> <generator class="identity" /> </id> <version name="m_version" column="version" type="long" /> <union-subclass name="...

How to pass a mysql record to php and be sure that it is UTF-8 encoded -

i have problem, data defined utf-8 in mysql database. when pass php , format json don't utf-8 signs. i have put in header utf-8 header("content-type: application/json; charset=utf-8"); what can next? what can next? you can replace entire script this <?php header("content-type: application/json; charset=utf-8"); printf('{chr:"%s"}', "\xc6\x94");// Æ” http://www.fileformat.info/info/unicode/char/0194/index.htm and try use it. if works, means either data in db isnt utf8, or way retrieve doesn't preserve utf8.

Comparing strings in C# with OR in an if statement -

i'm newbie c#, can't seem find problem. here's i'm trying do: string teststring = txtbox1.text; string teststring2 = txtbox2.text; if ((teststring == "") || (teststring2 == "")) { messagebox.show("you must enter value both boxes"); return; } basically need check see if either txtbox1 or txtbox2 blank. i'm getting error when running this. what's proper way (or approach wrong)? since want check whether textboxes contains value or not code should job. should more specific error having. can do: if(textbox1.text == string.empty || textbox2.text == string.empty) { messagebox.show("you must enter value both boxes"); } edit 2: based on @jonskeet comments: usage of string.compare not required per op's original unedited post. string.equals should job if 1 wants compare strings, , stringcomparison may used ignore case comparison. string.compare should used order comparison. questio...

unit testing - How do I access private attributes in PHP? -

possible duplicate: best practices test protected methods phpunit class footer { private $_isenabled; public function __construct(){ $this->_isenabled = true; } public function disable(){ $this->_isenabled = false; } } when writing unit test disable function after set _iseanabled false, want assert whether or not false. but how can access $_isenabled ? this test function: public function testdisable(){ $footer = new footer(); $footer->disable(); $this->assertfalse($footer->_isenable); } short answer: you cannot. that's private means... long answer: you can using reflection: http://php.net/manual/en/book.reflection.php it bit complicated, though, , adds layer prone fail not best way testing... i rather prefer create getter function: public function getenabled() { return $this->_isenabled; } but if have not done simple, think not want create it... given alternatives, may reconsider it....

android - Unable to create project from archetype using playn eclipse and maven -

this pretty frustrating. followed gettingstarted instructions on playn page , works fine command line keep getting errors when trying create skeleton playn maven project in eclipse. i'm running on mac os x , eclipse 4.2.0 classic. unable create project archetype [com.googlecode.playn:playn-archetype:1.3.1] under details says: defined artifact not archetype i have come working solution, albeit less pretty. essentially, if create new project maven (not eclipse), import in, won't see error. see this question's answers more information.

Issues when instantiating a pointer to a new object in c++ -

i'm semi new c++. have tried couldn't solve problem. background: i'm using botan library encryption. don't think problem has library, more pointers , objects. when use following code, there no problems. comments after each line explains happens. (the code explanation purposes only) int main(int argc, char** argv) { dh_privatekey *apriv = 0; // apriv points 0x00 memoryvector<unsigned char> *apub = 0; // irrelevant autoseeded_rng rng; // irrelevant object dl_group domain("modp/ietf/3072"); // irrelevant object apriv = new dh_privatekey(rng,domain); // apriv points 0x8079098 the main observation here object instantiated , apriv points object. want happen. problem comes in when try in function pass apriv pointer to. my main code changes following: int main(int argc, char** argv) { dh_privatekey *apriv = 0; memoryvector<unsigned char> *apub = 0; autoseeded_rng rng; dl_group domain("modp/ietf/3072...

java - Printing a member from the object returned by itr.next() -

the following code has compilation issues. compilation error attached. please suggest solution same. code: import java.util.*; class test{ int key; public static void main(string []args){ test obj = new test(); obj.key = 9999; linkedlist al = new linkedlist(); al.add(obj); iterator itr = al.iterator(); while(itr.hasnext()){ test temp = new test(); temp = itr.next(); system.out.println(temp.key); } } } compilation error : test.java:17: error: incompatible types temp = itr.next(); ^ required: test found: object its.next() returns instance of object , not test make follows linkedlist<test> al = new linkedlist<test>(); al.add(obj); iterator<test> itr = al.iterator(); so compiler knows linkedlist a1 can hold test instances while iterating have instances of test ...

sorting - Trigger sort method from an event in Backbone.js -

i have backbone.js project uses comparator function defined in collection. sorts items when page refreshed, trying sort when button clicked instead of on page refresh. here code: var thing = backbone.model.extend({ defaults: { title: 'blank', rank: '' } }); var thingview = backbone.view.extend({ classname: 'thingclass', template: _.template('<b><button id="remove">x</button> <b><button id="edit">edit</button> <%= title %> rank:<%= rank %></b>'), edittemplate: _.template('<input class="name" value="<%= name %>" /><button id="save">save</button>'), events: { "click #remove": "deleteitem", "click #edit": "edititem", "click #save": "saveitem", }, deleteitem: function () ...

left join - Mysql query that includes TWO sums from columns in other tables -

got query running 1 sum different table, works (and obtained forum well): select r.rep_id repid, r.rep_desbrev repdesc, ifnull(sum(rd.repdata_cant), 0) cant repuestos r left join rep_data rd, on rd.repdata_repid = r.rep_id group rd.repdata_repid now, thing i'd add column obtains total inventory (something ifnull(sum(i.inv_cant), 0) inv) table inventario i.inv_repid = r.rep_id this value can obtained means of join, in exact same way got first statement works, have not found way include both sums in 1 query. any ideas? thanks! try query example select t1.id, ifnull(sum(t1.my_column),0) sum1, ifnull(other.sum,0) sum2 table t1 left join (select id , sum(other_table_column) other_table group id) other on t1.id = other.id group t1.id

python - What is the difference between a[:]=b and a=b[:] -

a=[1,2,3] b=[4,5,6] c=[] d=[] whats difference between these 2 statements? c[:]=a d=b[:] but both gives same result. c [1,2,3] , d [4,5,6] and there difference functionality wise? c[:] = a means replace elements of c elements of a >>> l = [1,2,3,4,5] >>> l[::2] = [0, 0, 0] #you can replace particular elements using >>> l [0, 2, 0, 4, 0] >>> k = [1,2,3,4,5] >>> g = ['a','b','c','d'] >>> g[:2] = k[:2] # replace first 2 elements >>> g [1, 2, 'c', 'd'] >>> = [[1,2,3],[4,5,6],[7,8,9]] >>> c[:] = #creates shallow copy >>> a[0].append('foo') #changing mutable object inside changes in c >>> [[1, 2, 3, 'foo'], [4, 5, 6], [7, 8, 9]] >>> c [[1, 2, 3, 'foo'], [4, 5, 6], [7, 8, 9]] d = b[:] means create shallow copy of b , assign d , similar d = list(b) >>> l = [1,2,3,4,5]...

wpf - "Ghost" ContentControl stealing focus -

i have tabbed control using template selector, correct template selected contains webbrowser component, when using keyboard (up/down arrows) keyboardfocus toggels between rest of application , web page. using snoop can webbrowser control behave setting focusable property of containing contentcontrol false, can't figure out where/how set contentcontrol property programmatically! a snippet snoop: part_selectedcontenthost theme (focusable == false) contentcontrol (focusable == **true**) [where come from? it's "content" viewmodel] contentpresenter (focusable == false) [where come from?] webpageview (my created component, focusable == false) ... (focusable == false) wbcontent (focusable == true) i've tried using targeted style resource in contentpresenter of part_selectedcontenthost no luck. anyone ideas? thanks try deriving tab control. override onapplytemplate method , find contentcontrol name. once found change p...

git - Merge two repositories (original project and changed project WITHOUT HISTORY) -

Image
i have 2 repositories: gephi (big open source project) hosted on github project of company based on gephi 7 months ago, when our project started, took snapshot of gephi project on github , save corporate svn => change history loss now decided move our project git repository , merge changes original project i have git repository migrated svn git-svn my files not have change history beyond time when our project started can map initial state of our repository state of original repository? in other words start aplying our changes original repository specific revision. update: today found obstacle. schema first: red branch original project <alpha1> , <alpha2> commits of plugins main project (unrelated code commited in <e' e'' e'''> ) in <e'> <e''> <e'''> added code main project (red) repository <e> (in each commit cca 1 third of project <e> ) i have fetched...

node.js - Mongoose.js: is it possible to change name of ObjectId? -

some question mongo objectid in mongoose 1) can objectid field named not _id? , how that? when in code: myschema = new mongoose.schema({ id : mongoose.schema.objectid }); it changes nothing. 2) if have objectid field called _id possible return request name field (for example "id" - send on in web response); 3) , question understanding: why objectid _id field accessible through "id" property not "_id"? thanks, alex the "_id" element part of mongodb architecture guarantee every document in collection can uniquely identified. important if use sharding allow unique identifier across disparate machine. therefore design choice there no way ride of :) the default value _id generated follows: timestamp hash of machine hostname pid of generating process increment but can use whatever value want long unique. if it's easier think _id of has there, don't care :) leave system auto generate , use own identifie...

mysql - SQL : Count occurences of values in sql table efficiently -

possible duplicate: sql : count number of occurences occuring on output column , calculate percentage based on occurences here url test data / table : http://sqlfiddle.com/#!2/56ffd4/1 my table generates o/p following table : (id, resolution) ('abc-123', 'fail'), ('abc-456', 'pass'), ('abc-789', 'pass'), ('abc-799', 'fail'), ('abc-800', 'pass'), ('abc-900', 'pass'); my script o/p : id resolution ts @prev c res abc-123 fail july, 02 2012 1 1 - abc-456 pass july, 02 2012 2 0 50.00% abc-789 pass july, 02 2012 1 0 100.00% abc-799 fail july, 02 2012 1 1 - abc-800 pass july, 02 2012 2 0 50.00% abc-900 pass july, 02 2012 0 0 100.00% here o/p script: select st.*, @prev:=@counter + 1, @counter:= case...