Posts

Showing posts from June, 2011

java - Extra EFBFBD bytes in Hadoop thriftfs reading -

in hadoop-0.20 have thriftfs contrib, allow access hdfs in other programming language. hadoop provides hdfs.py script demonstration. problem located in do_get , do_put methods. if use get download utf-8 text file, it's totally ok, when get file in other encoding, can not original file, downloaded file has many "efbfbd" bytes. guess these java codes on hadoopthriftserver may cause problems. public string read(thrifthandle tout, long offset, int length) throws thriftioexception { try { = now(); hadoopthrifthandler.log.debug("read: " + tout.id + " offset: " + offset + " length: " + length); fsdatainputstream in = (fsdatainputstream)lookup(tout.id); if (in.getpos() != offset) { in.seek(offset); } byte[] tmp = new byte[length]; int numbytes = in.read(offset, tmp, 0, length); hadoopthrifthandler.log.

javascript - Select Picker plugin Bootstrap dropdown not working on mobiles/tablets -

i have select picker plugin bootstrap ( http://silviomoreto.github.io/bootstrap-select/ ) working on website. each dropdown option link different twitter page so: <select class="selectpicker" data-width="100%" name="venue" id="venue" onchange="location = this.options[this.selectedindex].value;"> <option value="none selected">choose twitter profile</option> <option value="https://twitter.com/lvplshooters">liverpool</option> <option value="https://twitter.com/leedsshooters">leeds</option> <option value="https://twitter.com/mancshooters">manchester</option> </select> $('.selectpicker').selectpicker(); it works 100% on laptops , computers. when use tablet or phone links dont work. has got ideas on why doing this? replace location = this.options[this.selectedindex].value; window.location = this.

javafx - JavaFX8 tree table view custom root row -

in tree-table-view have root item contains child items(i have mistakenly called them root items) in turn have child items. need customize mistakenly called root items rows text appearance. there such selector or how else done? thanks. this set pseudo-class on row containing root: final pseudoclass firstrowclass = pseudoclass.getpseudoclass("first-row"); treetableview.setrowfactory(treetable -> { treetablerow<...> row = new treetablerow<>(); row.treeitemproperty().addlistener((ov, oldtreeitem, newtreeitem) -> row.pseudoclassstatechanged(firstrowclass, newtreeitem == treetable.getroot())); return row ; }); now can select row in css with .tree-table-row-cell:first-row { ... } complete example here it sounds want style immediate child nodes of root node. in case, do row.treeitemproperty().addlistener((ov, oldtreeitem, newtreeitem) -> row.pseudoclassstatechanged(firstrowclass, newtreeit

android - removeAllViews not removing view completely -

i having problem removeallviews() method. can see in pictures, still has 2 textviews empty, still creating empty space in layout makes bad. http://jacho981.hol.es/screenshot_2014-04-22-11-55-12.png as can see in next picture, textviews should disappearing in previous picture, used in one. http://jacho981.hol.es/screenshot_2014-04-22-11-55-19.png everytime press "moto" or "coche" butons, first method called removeallviews() on linearlayout holds views. in theory views created if objects contains in string. in case removeallviews working properly, don't understand why it's creating textviews, in if sentence (the removeallviews() method called before sequence of if sentences next one): // cober_title if (listaseguros .get(j) .getseg_cober_title() != null

How to get Max id From Database using c#? -

cmd = new oledbcommand("select max(substr(tr_refno,9,6))as refid echallan dept='" +tmpdept.tostring() + "' , substr(tr_refno,5,2) ='" + tmpmonth + "'", con); maxid = convert.toint16( cmd.executescalar()); error= invalidcastexception unhandled user code before converting check nullity: var value = cmd.executescalar(); int maxi; if(value !=null) maxid = convert.toint32(value); else //......................

linux - Unix command for searching multiple keywords -

need check in error log on unix server multiple sites, ex. lets there 3 sites abc.com, xyz.com , opq.com. want error log server of these sites lies. i tried tail -99999 /apache/log/error_log| grep 'abc | xyz | opq' but not working.. just use egrep: tail -99999 /apache/log/error_log| egrep '(abc|xyz|opq)'

gwt - How to get GXT Pallette in Eclipse Kepler? -

Image
i trying add gxt palete in eclipse.using ext gwt (gxt) eclipse -kepler app engine 1.9.0 gxt 2.3.1 when right click on module file, couldn't see option google web toolkit > configure using ext gwt i added window builder pro please me gxt palette in eclipse. thanks for kepler there no gwt designer. for gwt designer new gwt designer builds include patch available following update sites: http://dl.google.com/eclipse/inst/d2gwt/latest/3.6 http://dl.google.com/eclipse/inst/d2gwt/latest/3.7 http://dl.google.com/eclipse/inst/d2gwt/latest/4.2 http://dl.google.com/eclipse/inst/d2gwt/latest/4.3 use 4.2 update site url 3.8. kepler use 4.3 note these update site urls use eclipse update manager. not direct download links. also gwt desinger support 2.1.x , 2.2.5 (recommended , latest in 2.x.x series) after adding pulgin , gxt jar right-click on project.gwt.xml file google web toolkit > configure using ext gwt (gxt). add gxt.jar classpath ,

php - How to generate unique request in CURL -

i have 1 script fetch data using curl in multiple request @ same time same url. is there configuration in curl each time sending new request ? because second time when ever tried behave fake request using curl. currently using configuration. $ch = curl_init(); curl_setopt ( $ch, curlopt_url, $url ); curl_setopt ( $ch, curlopt_header, true); curl_setopt ( $ch, curlopt_httpauth, curlauth_any); curl_setopt ( $ch, curlopt_ssl_verifypeer, false); curl_setopt ( $ch, curlopt_returntransfer, true); curl_setopt ( $ch, curlopt_binarytransfer, true); curl_setopt ( $ch, curlopt_timeout, 150); curl_setopt ( $ch, curlopt_followlocation, 1 ); curl_setopt ($ch, curlopt_connecttimeout, 30); $data = curl_exec($ch); curl_close($ch); if 1 have suggestion please me. thanks... if want curl request create new curl object again. $ch1 = curl_init(); $ch2 = curl_init(); ... curl_close($ch1); curl_close($ch2);

java - What is best way to create popup menu like in eclipse on Ctrl+F6? -

i want create popup menu same in eclipse on ctrl + f6 . it should have jscrollbar , list of strings each item has small border. i have idea use jdialog how make not display border , close buttons jlist scroll bar? thank you! the easiest , straightforward way use jpopupmenu class. can add jcomponent jpopupmenu , not jmenuitem s. here's button when clicked, shows jlist in popup without close buttons, scroll bar. wherever popup (the jlist ) loses focus, popup automatically closed. final jbutton b = new jbutton("press me"); b.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { final defaultlistmodel<string> model = new defaultlistmodel<>(); (int = 0; < 100; i++) model.addelement(i + "."); final jlist<string> l = new jlist<>(model); final jpopupmenu pm = new jpopupmenu(); final jscrollpane sp = new jscrollpan

c# - Appcrash while running the windows application after installing the setup -

i have developed windows application in visual studio 2012 , deployed application using installshield. when install application in 32-bit system works fine, while install in 64-bit system, installs fine after installing application not opening throwing , error that, problem signature: problem event name: appcrash application name: sappln.exe fault module name: kernalbase.dll , more goes on.. in configuration manager, have specified release -> cpu can give solutions avoid error? thanks in advance!! seems using libaries can't run on x64 platforms. libaries using? also check if program "special" upon startup. this should keep out. good luck!

select - How to sort by three-characters weekday in MYSQL -

i have mysql table column three-characters weekdays like mon, tue, wed, thu.. now want order select query these weekdays (not alphabetically!). when following line, it's doesn't work: select * table order str_to_date(day, '%a') can give me working query? try below code select * `table` order field(`day`, 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');

php - regex that matches the text between the tags like p a, br -

i need regex matches text between tags p a, br: albert einstein, division head, princeton member of executive committee of princeton i have pattern (preg_match_all) $pattern="/<\s*a[^>]++>(.*?)<\s*\/\s*a\s*>/" ; but gives me text inside hrefs, any hints? // heres sample source <p> <a href="file.pdf" target="_blank"><b>albert einstein</b></a><br> division head, princeton<br> member of executive committee of princeton<br> </p> using dom parser can values inside tags want : <?php $html='<p> <a href="file.pdf" target="_blank"><b>albert einstein</b></a><br> division head, princeton<br> member of executive committee of princeton<br> </p>'; $dom = new domdocument; $dom->loadhtml($html); echo "[".$dom->getelementsbytagname('p')-&g

python - Adding or remvoing specific rows or columns in an h5py dataset -

once create h5py dataset , how add or remove specific rows or columns nxm array? my question similar this one , don't want blindly truncate or expand array. when removing, need able specify exact row or column remove. for adding, know have specify maxshape=(none, none) when creating initial dataset, resize method doesn't seem let specify rows or columns truncated if shrink size. h5py isn't designed doing this. pandas might better library use, it's built around concept of tables. having said that, here's how it: in [1]: f = h5py.file('test.h5') in [2]: arr = rand(4,4) in [3]: dset = f.create_dataset('foo',data=arr,maxshape=(2000,2000)) in [4]: dset[:] out[4]: array([[ 0.29732874, 0.59310285, 0.61116263, 0.79950116], [ 0.4194363 , 0.4691813 , 0.95648712, 0.56120731], [ 0.76868585, 0.07556214, 0.39854704, 0.73415885], [ 0.0919063 , 0.0420656 , 0.35082375, 0.62565894]]) in [5]: dset[1:-1,:] = d

How do I get node.js zlib gunzip pipe to work? -

i have large .gz file (roughly 100mb in size), however, when process file using following code, outputted file 256k. var fs = require('fs'), zlib = require('zlib'); var inp1 = fs.createreadstream('feed.xml.gz'); var out1 = fs.createwritestream('feed.xml'); inp1.pipe(zlib.creategunzip()).pipe(out1); the problem seems zlib.creategunzip() pipe. is there way fix this? i'm trying stream direct internet preferably.

sql - MySQL check if between multiple criteria with unique identifier -

i have list of events. | table: events | event_id | event_location | event_date | |----------|----------------|------------| | 10 | denver | 2014-02-01 | * | 11 | chicago | 2014-04-01 | * | 12 | denver | 2014-06-01 | | 13 | seattle | 2014-08-01 | * | 14 | chicago | 2014-10-01 | | 15 | denver | 2014-11-01 | * i have list of location access, dated. | table: allowed | allowed_location | date_begin | date_end | |------------------|------------|------------| | denver | 2014-01-01 | 2014-03-01 | | chicago | 2014-03-01 | 2014-05-01 | | seattle | 2014-07-01 | 2014-09-01 | | denver | 2014-10-01 | 2014-12-01 | what want find of event_id have event_date between 1 of respective allowed_location rows (date_begin , date_end). the results first table meet criteria denoted asterisks above. i able results, not seeking, following query: select event.event_id event l

verilog compiler error: near ";": syntax error, unexpected ';' -

i'm trying write traffic light fsm code green, yellow, red has delay of 20 time units. goes green-yellow-red-yellow- green. code , i'm getting error while using 'repeat' delay. errors: error: c:/users/desktop/design/tlights.v(33): near ";": syntax error, unexpected ';' error: c:/users/desktop/design/tlights.v(37): near ";": syntax error, unexpected ';' error: c:/users/desktop/design/tlights.v(44): near ";": syntax error, unexpected ';' `define delay 20; module tlights(clk, rst, y); input clk, rst; output [1:0]y; reg [1:0]y; reg [1:0] cs,ns; integer p; parameter red = 2'd2; parameter orange = 2'd1; parameter green = 2'd0; parameter s0 = 2'd0; parameter s1 = 2'd1; parameter s2 = 2'd2; always@(posedge clk or negedge rst) begin if(!rst) begin cs<=s0; end else cs<=ns; end always@(cs) begin case(cs) s0: begin repeat (`d

php - Simple MySQL query won't work -

i'm trying run simple php script browser won't work. seems connects database can't complete mysql query. anyway query works fine phpmyadmin. seems problem? <?php // db $db_hostname = "localhost"; $db_username = "********"; $db_password = "********"; $db_database = "vladbl0m_eshop"; // create connection $con=mysqli_connect($db_hostname, $db_username, $db_password, $db_database); // check connection if (mysqli_connect_errno($con)) { echo "failed connect mysql:" . mysqli_connect_error(); } else echo "connected " . $db_database; // mysql query // execute query. $result = $link->query("insert oc_test set text ='12345'") or die("error in consult.." . mysqli_error($link)); ?> there no $link defined anywhere... use $con instead of that. replace $link $con , see doing wrong , since mapped connection wrongly , not able see proper errors.

c# - Overriding Equals and type casting -

in following example third evaluation returns false, good, fourth example returns true.. don't quite understand how works however, default object.equals compares 2 references object equality, , seeing a , b both point unique instance of string, should return false, in third example not in fourth. understand why returns true in 2nd example seeing .equals() method overridden in string class, in fourth example we're casting string object. wouldn't call object.equals in case? static void main() { // create 2 equal distinct strings string = new string(new char[] {'h', 'e', 'l', 'l', 'o'}); string b = new string(new char[] {'h', 'e', 'l', 'l', 'o'}); console.writeline (a == b); // returns true console.writeline (a.equals(b)); // returns true // let's see happens same tests // variables of type object object c = a; object d = b; console.write

javascript - How does the bundle order work in browserify? -

i cannot figure out logic how browserify bundles required files. if this require('./one/one.js'); require('./two/two.js'); require('./three/three.js'); the output this (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new error("cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ var app = "app"; console.log(one); },{}],2:[function(require,module,exports){ require('./one/one.js'); require('./two/two.js'); require('./three/three.js'); //require('./three/three_a/three_a.js'); require('./app.js'); },{&qu

php - SSL decryption failed or bad record mac in NGINX Server with cacert.pem set -

i trying connect secure link using curl. i have set following 2 parameters in curl of php page curl_setopt ($ch, curlopt_ssl_verifypeer, true); curl_setopt ($ch, curlopt_cainfo, "/cacert.pem"); but still getting below error :ssl error. after adding pem file in nginx server getting error below in nginx ssl3_get_record:decryption failed or bad record mac the same pem file works on windows wamp server not working in nginx server. please let me know if else missing. basically curl used include list of accepted cas, not accept longer bundles ca certs. default reject ssl certificates unverifiable. you'll have ca's cert , point curl @ it. more details here

event handling - Why is a MenuItem not responding? -

there contextmenu has 2 options , when second option (item2 in code) pressed right mousebutton want print out text know did activate it. till nothing happens when click on second mousebutton. i haven't had experience yet eventhandlers apologies if made noobish mistake. private void maakcontextmenu() { menu = new contextmenu(); menuitem item = new menuitem("kleur assen"); menuitem item2 = new menuitem("tweede optie"); final lissajouscanvas canvas = this; item.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { new kieskleur(canvas).show(); } }); item2.addeventhandler(mouseevent.mouse_clicked, new eventhandler<mouseevent>(){ @override public void handle(mouseevent t) { system.out.println("in loop"); if(t.getsource()==mousebutton.secondary){ system.out.println("in dee

jsf - Tooltip for h:message is conflicting with the tooltip of the inputfield -

Image
for inputfields have richface tooltip. works fine. when put invalid input in field goes wrong. to customize h:message tooltip if have added there richface tooltip. according following solution: community.jboss.org <h:message id="#{cc.attrs.id}id_tooltip" for="#{inputid}" styleclass="inputfield_error inplace" tooltip="true" showdetail="true" showsummary="true" /> <rich:tooltip id="#{inputid}_err_tt" target="#{cc.attrs.id}id_tooltip" styleclass="tooltip" layout="block"> <rich:message id="#{inputid}_msg_tt" for="#{inputid}" showdetail="true" showsummary="false" styleclass="inp_err_tt" /> </rich:tooltip> the input component: <h:inputtext value="#{cc.attrs.managedbean.formfield(cc.attrs.id).value}" id="#{inputid}"> <a4j:ajax event="c

java - why am i not able to implement a class in a class ,which already extends a class -

this dbinfo class: public class dbinfo stars table static final string stars = "stars"; static final string first_name = "first_name"; static final string last_name = "last_name"; static final string create_star_table = "create table " + stars + "(" + _id + " integer primary key autoincrement, " + first_name + " text not null, " + last_name + " text not null);"; //stars in movies static final string stars_in_movies = "stars_in_movies"; static final string star_id = "star_id"; static final string movie_id = "movie_id"; static final string create_star_in_movie_table = "create table " + stars_in_movies + "(" + star_id + &quo

leiningen - Trouble converting from Clojure application to latest Clojure -

i can't figure out why i'm getting following compile error after upgrading: compiling addr-verify.core exception in thread "main" java.lang.noclassdeffounderror: clojure/lang/ilookuphost, compiling:(core.clj:39:1) @ clojure.lang.compiler$invokeexpr.eval(compiler.java:3463) i using leiningen 2.3.4, , trying upgrade application use clojure 1.5.1 , dependencies. compiled fine old project.clj. want use clojure 1.5.1. i'm confused causing this. these differences between 2 project.clj versions. < (defproject addr-verify "1.0.0-snapshot" > (defproject addr-verify "1.0.1-snapshot" < :dependencies [[org.clojure/clojure "1.2.1"] < [org.clojure/clojure-contrib "1.2.0"] < [clojure-csv/clojure-csv "1.2.4"] < [org.clojure/tools.cli "0.1.0"] < [clj-http "0.1.3"]] < :main addr-verify.core) > :de

javascript - Facebook deleting post -

i'm using faceebok js api, function fb.ui post. whenever click on post no text, post deleted seconds after posted. when enter text, doesn't deleted. function is: function postar(){ fb.ui( { method: 'feed', name: 'x', link: 'x', picture: 'x', caption: 'x', description: 'x' }, function(response) { if (response && response.post_id) { console.log('post published.'); } else { console.log('post not published.'); } } ); does know how can solve it? thanks in advance

java - Determining the element that occurred the most in O(n) time and O(1) space -

let me start off saying not homework question. trying design cache eviction policy depends on entries occurred in cache. in software terms, assume have array different elements , want find element occurred most. example: {1,2,2,5,7,3,2,3} should return 2. since working hardware, naive o(n^2) solution require tremendous hardware overhead. smarter solution of using hash table works software because hash table size can change in hardware, have fixed size hash table, not big, collisions lead wrong decisions. question is, in software, can solve above problem in o(n) time complexity , o(1) space? there can't o(n) time, o(1) space solution, @ least not generic case. as amit points out , solving this, find solution element distinctness problem (determining whether elements of list distinct), has been proven take Θ(n log n) time when not using elements index computer's memory. if use elements index computer's memory, given unbounded range of values, requires @ lea

java - Changing url/ip when asynctask is running repeatedly -

i have call getxmltask service , repeatedly call every 1 seconds data ip address (myip). myservice.java public class myservice extends service { public int onstartcommand(intent intent, int flags, int startid) { if (globalfunctions.isinternetavailable(myservice.this) || globalfunctions.iswifi(myservice.this)) { mytimertask mytask = new mytimertask(); timer mytimer = new timer(); mytimer.schedule(mytask, 1000, 1000); } else { toast.maketext(myservice.this, "no internet connection", 1000).show(); } return service.start_sticky; } class mytimertask extends timertask { public void run() { getxmltask task = new getxmltask(); task.execute(new string[] { myip }); } } } asynctask use in getxmltask.java. public class getxmltask extends asynctask<string, void, string> { @override protected string doinba

html to excel with php. Big numbers converts to exponential -

i'm exporting html table excel php . have problem column big numbers example: 12345678901234567890 excel converts 1.23457e+19 in general format. i want display full number - completely. prepend single quote numbers have length > 10-12. have same problem few part numbers. vba bignumber = "'" & bignumber or php $bignumber = "'" . $bignumber my php rusty, might have escape quote.

Comparing Working and Member Revision in MKS -

i want list of files working revision , member revision different. there command revisioninfo of file (si revisioninfo) working file version not displayed. there command working file version? bottomline: want programatically check if files in project updated, if not show list of files not updated. here nice way list of space separated values name, memberrev , workingrev: si viewsandbox --fields=name,memberrev,workingrev --[no]recurse add additional options command, sandbox-path , filter not see pj-files.

sql server - How to take data from row from an SQL query and show it in column in SSRS -

Image
i have following design view in ssrs: when previewed get: as can see entity name appears twice 'group'. looking if there many entries per entity put them in same row in different column, this: i using table display data. how achieve result looking for? maybe u can use workaround ? first use column named "category". using case function can give new name. after need order by function. example : ,case when database.entityname '%group' 'xx group' when database.entityname '%asx' 'xx asc' end category then use "category" in table , not "entity name". this should make table following example : last name - category - date of last credentialing - credentialing expired same name - xx group - 10/01/2017 - 12/01/2017 same name - xx group - 15/01/2017 - 22/02/2017 same name - xx asc - 12/02/2017 - 05/03/2017 it not make columns in row, grouped if u use order by function

jquery - center large image inside container but keeping aspect ratio -

i'm trying replicate how slider image works on http://www.hmv.com . if shrink down screen size image if zooms out still keeps aspect ratio. understand when shrink screen down. i have container 739px tall , 100% width wise. i have created jsfiddle guys see me code is. //this can add jsfiddle link sizeheaderimg(); but when shrink screen down image doesnt keep nice scale. image size 1920 x 1000 i happy use plugin if there thing point me in right direction code going wrong appreciated thanks you don't need javascript achieve this: img { height: auto; max-width: 100%; } .hero-image { height: 739px; width: 100%; overflow: hidden; position: relative; } .hero-image img { position: absolute; top: 0; bottom: 0; margin: auto; } http://jsfiddle.net/lwj2c/2/

How to handle various view states in Windows 8.1 store app -

Image
i have windows 8.0 code , had handled ui viewstates portrait,landscape, filled , snapped. windows 8.1 viewer can move app size. how handle ui in case. doing this. private void questionpage_sizechanged(object sender, sizechangedeventargs e) { applicationviewstate currentstate = windows.ui.viewmanagement.applicationview.value; if (currentstate.equals(applicationviewstate.snapped)) { visualstatemanager.gotostate(this, "snapped", false); } else if (currentstate.equals(applicationviewstate.fullscreenlandscape)) { visualstatemanager.gotostate(this, "fullscreenlandscape", false); } else if (currentstate.equals(applicationviewstate.filled)) { visualstatemanager.gotostate(this, "filled", false); } else if (currentstate.equals(applicationviewstate.fullscreenportrait)) { visualstatemanager.gotostate(this, "f

ios - Webservice class instance does not persist, unrecognized selecter sent to instance -

i've been looking @ issue having ios app , it's webservice class. seems class gets initialized , assigned instance, when try trigger class starting timer button, seems instance has been removed memory. how initialize (and try instance from) class. + (reflexionsmetawebservice *)getinstance { static reflexionsmetawebservice *instance; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ instance = [[reflexionsmetawebservice alloc] init]; }); return instance; } i've determined button that's calling class working intended cleaning references mentioned in other topics on forum. there maybe cleaner way initialize , maintain our webservice class instance?. hope above information enough. i think assigning instance object gets released memory. don't think have problem webservice class, of it. put log message check class reference , assigned reference before timer kicks in , see problem is.

jquery - {{#each}} in Handlebars and accessing each element created -

i using handlebars create template table, , can't seem able access each individual td created. <tbody> {{#each this}} <tr class='row'> <td class='table-course'>{{name}}</td> <td>{{teacher}}</td> <td>{{department}}</td> </tr> {{/each}} </tbody> i have given first td class of 'table-course' can't seem access these td's in jquery. when try trigger jquery event $('td.table-course) nothing happens. does know best way access these {{#each}} generated td?

sql server - SQL Insert - Only insert on this condition -

i have table 1 : id userstring date ------------------------- 1 krbs 4/25/2014 2 wefg 4/24/2014 and table 2 : id userstring + other user info ---------------------------------- 1 krbs + . . .. . i'm preforming insert table 1 make condition insert if user available in table 2 (only insert row in table 1 if user exist in table2) i'm doing 2 separate sql checks (one if user exist insert) i'm sure there better way best way achieve define foreign key on table. simplest , implicit way it, reference on can found on msdn . means not ever able a) insert entry table if no corresponding fk exists, , b) delete base table if entries foreign key here (in case, delete user if has settings ). like: alter table nameofthetable add constraint fk_somenameforthekey foreign key (nameofcolfromthistable) references nameoftheothertable (nameofthecolumnyouarereferencing);

visual c++ - C++ - error LNK1104: cannot open file '..\Debug\gold-D.lib' -

hello getting error when try build project in c++. the error lnk1104: cannot open file '..\debug\gold-d.lib' the gold-d.lib present @ location still getting error . thanks in advance if there spaces in file path, may need surround file path "". possibility don't have permission directory.

python - Count and Max after values() method on Django query -

i have django model: class action(models.model): id = models.autofield(primary_key=true) game = models.foreignkey(game) step = models.foreignkey(step) from_player = models.foreignkey(player) to_player = models.foreignkey(player) type = models.foreignkey(actiontype) timestamp = models.datetimefield(default=timezone.now) i want following: filter on game, step , type find player/players how has/have obtained highest number of actions to tried: v = action.objects.filter(game=1, step=2) v = v.filter(type=3) v = v.values('to_player').order_by().annotate(count=count('to_player')) v = v.annotate(max=max('count')).filter(count=f('max')) #try select max but last line gives me (because line 3 returns list of dictionaries): cannot compute max('count'): 'count' aggregate i know similar has been answered django values() , aggregate() bit tricky me. right way this? you can highest count using d

Using egit with github and eclipse 3.8.1 on ubuntu 13.10 -

i new eclipse, , can't figure otu how set egit work github. made new local repository, , i've commited changes, want code onto github. should do? can't find solution in eclipse wiki. have github account. here nice demo show step step video what want pulling repository in eclipse window -> show view -> other (then find repository) after did go master branch , configure remote add ssh key under github account. go eclipse git destination remote enter git account url, username, password, repository path. need after hit push.

python - lxml: difference between Element addnext() and insert() in handling tail -

given lxml element xml iterate on of children c[0..n] calling c.getnext() . because need insert children on fly if necessary, , can't using iterator. elements have both text , tail set. let me illustrate different behavior of addnext() , insert() following example. assume simple xml string, parse lxml tree, , then, sanity's sake, inspect it: >>> import lxml.etree >>> s = "<p>this <b>bold</b> , italic text.</p>" # create new lxml element. >>> xml = lxml.etree.fromstring(s) # let's @ element, child, , texts , tails. >>> lxml.etree.tostring(xml) b'<p>this <b>bold</b> , italic text.</p>' >>> xml.text 'this ' >>> xml.tail >>> xml[0].text 'bold' >>> xml[0].tail ' , italic text.' so far good, , have expected (for more on lxml representation see here ). now want wrap word "italic" tags, "bo

IndexError: list index out of range but I have more than enough elements?! Python -

def build_country_dict(lines): '''return dictionary in form of {country: count}, country country code , count number of medals won athletes country''' d = {} #start empty dictionary in range(1, len(lines)): #for ranging 1 length of lines line_list = lines[i].split(',') # split lines[i] list - split on comma country = line_list[6] # country if country not in d: # if country not in dictionary d[country] = 0 # add count of 0 d[country] = d[country] + 1 # add 1 country count return d #return dictionary the error indexerror: list index out of range referring line_list[6] list using has 11 elements in have no idea how correct this. the original file cvs file, using excel checked through whole thing , every single line should turn list containi

php - redirecting pages in yii afterlogin -

this sitecontroller.php im trying redirect user after login static website shows simple hello. i'm having trouble redirecting my aindex.php public function actionlogin() { $model=new loginform; yii::app()->session['username'] = 'seslog'; if(isset($_post['ajax']) && $_post['ajax']==='login-form') { echo cactiveform::validate($model); yii::app()->end(); } if(isset($_post['loginform'])) { $model->attributes=$_post['loginform']; if($model->validate() && $model->login()){ $this->redirect(array('site/aindex'));//i can't redirect } } $this->render('login',array('model'=>$model)); } here aindex.php file <?php echo "hello "; ?> you using 'array' value sending spe

javascript - how to add onclick events to dynamically generated buttons and show /hide the table -

i have many buttons generating dynamically based on end user request $out='<input class="show_hide" type="button" id="'.$platform_name.'" value="'.$platform_name.'"/>'; the same variable name tables coming dynamically $out.='<table id="'.$platform_name.'" > </table> if suppose button <input class="show_hide" type="button" id="button1'" value="button1"/> <table id="button1" > </table> how number of button names/id, , based on button name/id finding table , show/ hide table. please me. fresher in php when comes dynamic binding, go delegates $( "body" ).on( "click", ".show_hide", function() { $( ).next().toggle(); }); or can provide selector in sibling selection $( "body" ).on( "click", ".show_hide", function() { $( )

oracle - SQL Tools Include Rows that has null or value of 0 -

i have been working on practice problem sql class past 30 minutes. having hard time including rows have null values in or numerical value of 0. post question , query have written: "write query display tour name, outing date, , number of registered clients each outing of tour on each date. include outings scheduled occur after october 27, 2013. include tours no outings , outings no registered clients. sort result number of clients in descending order, , outing date in ascending order." select tour_name,out_date,count(distinct client_num) "num clients" tour right join outing using (tour_id) join register using (out_id) to_char(out_date,'yyyy-mm-dd') > '2013-10-27' group tour_name,out_date order "num clients" desc,out_date; i cannot figure out how pull rows empty cells. pulls complete rows. -expected results: --tour_name --out_date --num clients weekend weekday 29-oct-13 26 downtown

Arrow icon missing in navigation using android maps v2 -

i using android map v2 display routes , show location.but not able see arrow icon representing location in google maps.i seeing circle icon out there.is due latest updates android maps?i tried placing arrow icon drawable in case when turn icon not rotating around.(i tried implementing sensor listener). wanted arrow type navigation icon in android map.please in problem.

c++ - Iterator range erase element -

is possible erase elements iterator_range? something (unfortunately code not work): void test_erase(my_it it,my_it end){ boost::iterator_range<my_it> r(it,end); for(; it<end; it++){ if(pred(my_it)){ boost::erase(r,boost::iterator_range<my_it>(it,it)); continue; } } pred checks value of my_it , of (my_it+1) the point rid of constructing objects vector , map or string although remove_if operates on unary predicate not difficult extend on other n arguments predicate. for example remove binary predicate can written way: template<class forwardit, class binarypredicate> forwardit removeif(forwardit first, forwardit last, binarypredicate p) { forwardit result = first; while ( first != last - 1) { if ( !p( *first, *( first + 1))) { *result = *first; ++result; } if( first == last - 1) return result; ++first; } return result; } but have fit needs. dep

Unexpected PHP Parse Error -

i realise answer question going obvious, stumped. i've created class uses jeremy kendall's password validator ( https://github.com/jeremykendall/password-validator ) called hash. however, when class gets called get: parse error: syntax error, unexpected '}' in /home/james/projects/rec/htdocs/classes/hash.class.php on line 24. the code in hash.class.php having issues is: private $validationcallback; public function __construct(){ $this->validationcallback = function($credential, $passwordhash){ if (has('md5', $credential) === $passwordhash) { return true; } return false; } } line 24 final '}'. appreciated. thanks. this should be: private $validationcallback; public function __construct(){ $this->validationcallback = function($credential, $passwordhash) { if (has('md5', $credential) === $passwordhash) { return true; } return false; }; // missing s

error handling - strange issue during magento site transfer to localhost -

i need set-up site on local system live site . site filed lot of extensions , have catalog of more 1lakh. the magento running on local .but when click on category or link shows 404 error. i need manually add index.php url works fine. but if add index.php in core config table hangs system . please suggest me can issue. this due apache web server rewrite module. go admin configuration , set use web server rewrites no in local environment or enable apache web server’s mod_rewrite module .

ios - converting a NSString with JSON to NSDictionary -

i have nsstring looks like: { "name": "anevent", "args": [ { "ct": "un", "someuuid": "d7ec06de-98d3-436f-a657-fb043567fb67", "username": "joe smith", "long": "-139.724302", "lat": "39.402768" } ] } how can inner part { "ct": "un", "someuuid": "d7ec06de-98d3-436f-a657-fb04383cfb67", "username": "joe smith", "long": "-139.724305", "lat": "39.402768" } into nsdictionary ? thanks. try code: nsdictionary *dictobj = [nsjsonserialization jsonobjectwithdata:[yourstring datausingencoding:nsutf8stringencoding] options:nsjsonreadingmutablecontainers e

javascript - Draw 2 lines in Highcharts. JSON malformed? -

i'm trying draw 2 lines on graph highcharts . php server -side file is: require_once('connections/conexion.php'); $sesionuser = $_session['mm_username']; $sesionidgrupo = $_get['idgrupo']; $sesionfechaactual = $_get['fechaactual']; $sesionfechaactualarreglo = date_format(new datetime($sesionfechaactual),"y-m-d"); $query_recordsettabla2 = "select iddispositivo dispositivos idusuario = (select idusuario usuarios username = '$sesionuser') , idgrupo = '$sesionidgrupo'"; $recordsettabla2 = mysql_query($query_recordsettabla2, $conexion) or die(mysql_error()); $totalrows_recordsettabla2 = mysql_num_rows($recordsettabla2); while ($row_recordsettabla2 = mysql_fetch_assoc($recordsettabla2)) { $iddispositivo = $row_recordsettabla2['iddispositivo']; $query_recordsettabla3 = "select * registros idusuario = (select idusuario usuarios username = '$sesionuser') , iddispositivo = '$iddis

One large array from multiple arrays Matlab -

i'v multiple arrays of [1x3] , named them array1 array2 array3 , on. want create 1 array arrays such array=array1(i,1:3) array=array2(i,4:6) , on. how can done looping or suggestions regarding approach, want access multiple arrays dynamic i'm going approach , other suggestions welcomed thought there slow computations , processing speed when array size increases. my code: i=1:10 array(i)=array(:,i:i+3); end the easiest way use cat function: array = cat(2,array_1,array_2,array_3); if want access array_i (i=1,2,3,...) array_i = array((i-1)*3+1:i*3); the j th index (j=1,2,3) of array_i (i=1,2,3,4,...) can accessed: jth_index_of_array_i = array((i-1)*3+j)

c++ - Boilerplate function name -

on projects have been on, have boilerplate code creating local variable function name. fastest/best way? or, there faster/better way it? these functions called frequently, , it's performance-critical project. so, what's best way initialize our function names? some have seen: /*1*/ const static std::string functionname("function1"); /*2*/ const static std::string functionname( __pretty_function__ ); /*3*/ const std::string functionname("function1"); /*4*/ const char functionname [] = "function1"; edit: figured obvious, reason use such declaration can use functionname variable print out debugging information in function. maybe reason it's not obvious because aren't implementing well. love hear other ways implement this. c++11 8.4.1/8: the function-local predefined variable __func__ defined if definition of form static const char __func__[] = "function-name"; had been provided, function-name

matlab - make an exe file from a gui that runs another exe file -

i trying make executable file gui using deploytool. did work , things ok, time , in gui , have line similar this: dos(['runner ' filename]) ; runner exe file. added needed files , runner.exe shared resources files of deploytool. when make exe file gui , run , mentioned line of code not run , runner not run. add additional required file archive file. use -a switch. compile file command line. so command should this: mcc -m (yourfile.m) -a (the_additional_exe_file) you can find more information here: https://www.mathworks.com/help/mps/ml_code/mcc.html

How to make Laravel migrator work with namespaced migrations? -

i namespaced whole package can not namespaced migrations work. in autoload_classmap.php migration classes nicely namespaced, migrator not looking migration classes within namespace. how migrator search migrations within namespace? the migration file <?php namespace atomend\aeuser; use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; use schema, user; class userstable extends migration { public function up() { schema::create("users", function(blueprint $table) { $table ->increments("id"); autoload_classmap.php 'atomend\\aeuser\\userstable' => $basedir . '/src/migrations/2014_04_21_184359_users_table.php', terminal error php fatal error: class 'userstable' not found in this logical since userstable in atomend\aeuser namespace. issuing migration php artisan migrate --bench="atomend/aeuser"` so clear, when losing namespace works fine

javascript - Razor form on a facebook tab page -

i trying execute form inside facebook tab. have tried among many things: it seems request.httpmethod == "post" not working usual. @message prints out on pageload. have tried add alert before return $('form').valid(). not being executed. any ideas of issue or workaround. code: @{ var message = string.empty; if (request.httpmethod == "post") { message = "submitted"; } } <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script> <div class="form"> @if (!string.isnullorempty(message)) { <p class="formfinish"> @message </p> } <div class="row"> <label>name</label> <input type="text" name="name" id="name" class="required" minlength="4" maxlength

php - Optimize connection with Facebook -

i'm using script php posts fan page. code this: require_once("../facebook-sdk/src/facebook.php"); $config = array( 'appid' => '#############', 'secret' => '###############################', 'fileupload' => false ); $facebook = new facebook($config); $facebook->setaccesstoken("###################################"); $pageid = "###############"; $pagefeed = $facebook->api("/" . $pageid . "/feed"); $i = 0; foreach($pagefeed['data'] $post) { if ($post['type'] == 'video' || $post['type'] == 'link' || $post['type'] == 'photo') { // open fb-update div echo "<div class=\"fb-update\">"; // check if post type link if ($post['type'] == 'link') { echo '<a href="' . $post['link'] . '" targe

java - Force static part of class to run without instantiation -

i have class: public class textviewattachedproperties { public static final string namespace = "http://schemas.android.com/apk/lib/com.zworks.mvvmandroid"; private static final handler uihandler = new handler(looper.getmainlooper()); private static final string data_context = "datacontext"; private static final string text = "text"; private static final listener<propertychangedeventargs<string>> textchanged = new listener<propertychangedeventargs<string>>() { @override public void onevent(final propertychangedeventargs<string> args) { final textview element = (textview) args.getsource(); if (element != null && args.getnewvalue() != null) uihandler.post(new runnable() { @override public void run() { element.settext(args.getnewvalue()); }

php - All redirects to infinite loop -

i want redirect request except .html .js .jpg etc... example www.mydomain.com/products should go /index.php?p=cats&s=cars www.mydomain.com/myproduct.html should go www.mydomain.com/index.php?p=prod&s=myprod my redirects works fine there problem. if request without query string it's fall infinitive loop code here. there solution infinitive loop? options +followsymlinks rewriteengine on rewritebase / rewritecond $1 !\. rewriterule ^(.*) index.php?p=cats&s=$1 rewriterule ^(.*).html$ index.php?p=prod-detail&p=$1 use way: options +followsymlinks rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^.]+?)/?$ index.php?p=cats&s=$1 [l,qsa] rewritecond %{request_filename} !-f rewriterule ^(.+?)\.html$ index.php?p=prod-detail&p=$1 [l,qsa]