Posts

Showing posts from August, 2015

c# - Please resolve this error for me -

protected void page_load(object sender, eventargs e) { dataset ds = new dataset(); ds.readxml(server.mappath(@"c:\users\raymond\documents\visual studio 2010\websites\website17\xmlfile.xml")); repeater1.datasource= ds; repeater1.databind(); } i getting error message: c:/users/raymond/documents/visual studio 2010/websites/website17/xmlfile.xml' is physical path, virtual path expected. as exception tells you: passing physical path c:\\ but server.mappath expects virtual path ~/

3d - What is the normal of a face? -

Image
i told normal of face 'a vector perpendicular face' still don't when trying draw 3d shapes. give me clearer explanation, or (even better) diagram? chunk of code confuses me call glnormal3f(x, y, z) . a quick google , can find tutorial , includes following diagram: as can see, normals directional vectors perpendicular face. used in lighting calculations can correct shading displayed when have directional lighting.

spring - how can i Write an ItemWriter for the ItemProcessor? -

hello i m trying write itemwriter itemprocessor problem i m new , luck knowledge. itemprocessor code package sa.com.anb.itg.dev.settlement.batch; import org.springframework.batch.item.itemprocessor; public class processing implements itemprocessor<transactionas, transactionas> { transactionas transactionas = new transactionas(); public transactionas process(transactionas transactionas ){ transactionas.dblamount = transactionas.getamount() * 3.75; transactionas.setamount(transactionas.dblamount); return transactionas; } } please can provide me tips pr code if possible?

Converting pseudocode for array minimum into Java code, using recursion -

i blanking on exam review question, can me started? in findminpos, confused 3 parameters, how access nodes in data array? can use loop though it's recursive method? public class arrayswapmin { public static void swapmin( int[] data, int cur ) { int min = findminpos( data, cur, cur ); ///////////////////////////////////////////////////////////// // swap min position value 1 in cur position //////////////////////////////////////////////////////////////// } /** * check nodes in "data" position "start" end of array. * see if value in part of array less min * value found far (up "cur" position). */ private static int findminpos( int[] data, int cur, int minpossofar ) { ////////////////////////////////////////////////////////////// // compare entry's value (if valid entry) // value in entry "minpossofar". if value less, //

javascript - Document.write brokes page -

i've prepared view loads aync view , replace current document.write (yes, want replace whole page!): $.ajax({ type: "get", url: myurl, data: null, async: true, success: function (result) { document.close(); document.open(); document.write(result); document.close(); }, error: function (req, status, error) { $("#loading-div").html("error"); } }); the content full view own scripts , css styles. when using ie or chrome works fine. when load page within firefox, loaded page via document.write doesn't seems working - scripts (some works, don't). i can't use innerhtml due scripts not evaluated. why doesn't work in firefox (even ie can handle it!)? the specification requires document.open create new global. firefox that. chrome not; can't speak ie. so if you're depending on old global sticking around, script work in chrome not firefox.

java - salience detection in images in android -

Image
hi guys want extract salient part of image. purpose want use salient detector algorithm in java, , want implement on bitmap image. let me tell u thing cant use opencv please me archive these simple algorithms. here kind of thing want.. i have tried sobel filter first doesnt gave me kind of result, way em talking salience part other result should not considered. thanx in advance obviously sobel filter wont give results that. edge detector algorithm , not algorithm saliency detection. salient object in image part of image human attention goes , rest part ignored vision of humans. there different kinds of saliency should study before implementing, "interest points", "class specific saliency" , "generic saliency". in opinion, looking "generic saliency". you can try saliency toolbox itti et. al., invt other saliency detection algorithms include: hz07 , hz08 hou , zhang bits system klein , frintrop aim model bruce , tsotos co

How can i deal with node.js/socket.io memory leak? -

what part of code cause memory leak? i make process listener.it can listen memory's change.so know memory usage growing , never fall.sometimes can growing 800,000k , make computer crash. the number of concurrent connections accepted 100-300. code this: var http = require('http').createserver(), socketio = require('socket.io').listen(http); var fs = require("fs"); var util = require('util'); http.listen(3000); var connectcount = 0; socketio.on("connection",function(socket){ connectcount++; socket.on('chatmessage',function(msg){ delete res; delete res2; //json string return client var res = { channel:msg.channel, clubname:msg.name, dn:msg.dn, . mescontent:msg.messagecontent, dn1:"", dn2:"" } var res2 = { channel:

objective c - enumerateKeysAndObjectsUsingBlock - order of entries in dictionary? -

does know if order of enumeration using enumeratekeysandobjectsusingblock on nsdictionary defined? experiments suggest it's same order stuff added, can't 100% & don't want break... can't find anywhere tells me. the order not defined @ all. how set acts , dictionary quite close sec... to sure order kept have use sortable property , when keys, sort resulting array or use ordereddictionary .... there implementation of floating around on google nsdictionary + nsarray keys being in stable order a 1 cocoa heads https://github.com/davedelong/chdatastructures/blob/master/source/chordereddictionary.h https://github.com/davedelong/chdatastructures/blob/master/source/chordereddictionary.m

php - Paginate while ignoring sub rows, with a Right Join -

i have basic query returns main row of program title(eventdesc) , lists program participants , info multiple sub rows. program 1 email 1, email 2, name, status (first participant) email 1, email 2, name, status (second participant) program 2 email 1, email 2, name, status (first participant) etc... basic query: $query_perpage = "select count(*) camps_events"; $result = mysql_query($query_perpage, $db) or die(mysql_error()); $r = mysql_fetch_row($result); $numrows = $r[0]; $pages = new paginator($query); $pages->items_total = $numrows; $pages->paginate(); $pages->mid_range = 7; $query = mysql_query("select ce.eventcode, ce.eventdesc, ce.date, r.participant_fname, r.participant_lname, r.position, r.dob, r.status, r.email_primary, r.order_number camps_events ce right join registrations r on r.eventcode = ce.eventcode ce.reg_status = 'active' , r.status not in ('incomplete','canceled')".getallowedprograms().&quo

iphone - Cant get new location after stopUpdatingLocation - IOS -

i'm trying users gps coordinates app, works fine, once. when view gets called run code , location - - when view want new coordinates old ones chashed in phone. here code: #import "postpictureviewcontroller.h" @interface postpictureviewcontroller () @end @implementation postpictureviewcontroller { cllocationmanager *locationmanager; } - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; } -(void) viewdidappear:(bool)animated{ locationmanager = [[cllocationmanager alloc] init]; [self getlocation]; } -(void)getlocation{ locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracybest; [locationmanager startupdatinglocation]; } - (void)didreceivememorywarning { [super didrecei

c++ - Why do I have to clear std::stringstream here? -

i wrote short testprogram see if can append string using stringstream repeatedly. in first version got output1 , don't understand why s1 stays empty. found out have ss.clear() , expected result in output2. can explain why doesn't work without clear? have expected that, if repeatedly enter numbers , fetch them string, should number. unsure if number gets appended, beside point example. here: http://www.cplusplus.com/reference/sstream/stringstream/ says can use operation, , there no limitation or requirement reset string, see. don't understand why afterwards output without ss.clear() in between. also i'm bit surprised s0 stays same afterwards. stream doesn't overwrite or reset string if has content? i'm using gcc 3.4.4 cygwin. int main() { std::string s0; std::string s1; int n = 1; std::stringstream ss; ss << n; ss >> s0; cout << "s0:" << s0 << endl; ss.clear(); <-- if re

android - ScrollView not scrolling to the end of inner LinearLayout's bottom margin -

i'm having issues fragment consisting of scrollview containing linearlayout. i'm trying create effect linearlayout has white background , looks piece of paper scrolling on coloured background. way i'm trying achieve having scrollview occupy full space of fragment , linearlayout inside has android:layout_margin="16dp" create space around "paper". this way, scroll bar of scrollview appears in coloured background area, margin @ top scrolls away along content , margin @ bottom scrolls in when 1 reaches end. unfortunately in configuration scrollview won't scroll way end , in fact cuts off small amount of text @ bottom. suspect scrollview isn't taking account child's margins in vertical scrolling distance. solve i've wrapped linearlayout in framelayout solves issue, seems superfluous. pointers on how eliminate unneeded container appreciated. note: setting android:padding="16dp" on scrollview , scrapping margins doesn't

iis 7 - Publishing MVC site with Visual Studio to IIS 7 removes custom response headers from IIS config -

i'm using iis 7 , i've got site setup additional http response header ( x-ua-compatible header). i'm deploying mvc4 project remotely iis using publish feature in visual studio 2010, uses web deploy. problem is, every time publish site, http response header gets removed config in iis - there way can prevent this? i figured out - when set headers @ site level in iis 7, alters web.config file. needed add customheaders element in web.config file deployed: <system.webserver> ... <httpprotocol> <customheaders> <add name="x-ua-compatible" value="ie=edge" /> </customheaders> </httpprotocol> ... </system.webserver>

c++: No instance of overloaded function -

highinterestchecking header: #ifndef h_highinterestchecking #define h_highinterestchecking #include "noservicechargechecking.h" #include <string> class highinterestchecking: public noservicechargechecking { public: highinterestchecking(std::string =" ",int = 0, double = 0.00, double = 0.00, double = 0.00); }; #endif highinterestchecking cpp: #include "highinterestchecking.h" using std::string; highinterestchecking::highinterestchecking(string name, int acct, double bal, int numcheck, double min, double i) { bankaccount::setacctownersname(name); bankaccount::setacctnum(acct); bankaccount::setbalance(bal); checkingaccount::setchecks(numcheck); noservicechargechecking::setminbalance(min); noservicechargechecking::setinterestrate(i); } i have error "no instance of overloaded function." under constructor name highinterestchecking in cpp file not sure causing ive looked @ while can't seem find error.

Out-of-tree build makefile without automake? -

consider following dead-simple makefile: foo: foo.c $(cc) $(cflags) -o $@ $< and following directory structure ~/foo : makefile foo.c how can adjust makefile such can like: /tmp$ make -f ~/foo/makefile cc -o foo /home/me/foo/foo.c i have tried use $(srcdir) , seems automake -specific. there other similar variable? this it: foo: /home/me/foo/foo.c $(cc) $(cflags) -o $@ $< or this: foo: foo.c $(cc) $(cflags) -o $@ $< vpath %.c /home/me/foo or, if don't want hard-code path makefile: foo: foo.c $(cc) $(cflags) -o $@ $< vpath %.c $(dir $(lastword $(makefile_list)))

objective c - Retrieve Values from Dictionary inside NSDictionary in iOS -

how can retrieve values json below? "itemid": 115, "name": "test items receive", "description": "recevive", "itemcode": "aaa-rc-it1", "quantity":9000, "warehouselocationid": 560, "transactiondate": "\/date(-62135596800000+0530)\/", "transactiontime": "pt11h9m0.6074603s", "comment": null, "username": "virtual", "customeritem": { "itemid": 0, "itemcode": null, "description": null, "customerid": 10004 }, i have done till username, not working customeritem. dicionaryname[@"key"][@"key"][@"key"] , on. if supply pretty printed json helpful. parsing use nsjsonserialization class. edit: to item id , dictionaryname[@"customeritem"][@"itemid"] to item code: dictionaryname[@&qu

asp.net - Capturing a Session variable in Session_OnStart - Global.asa -

i'm trying use users session process code in global.asa: sub session_onstart sadmin = session("admin") application("admin") = sadmin the session("admin") not empty, application("admin") comes empty when check it. there reason i'm not able capture users session variable in session_onstart section of global.asa? when application("admin") doesn't come empty, comes hi sub session_onstart application("admin") = "hi" what have capture users session value in global.asa? it appears try set "by reference" assignment application("admin") change when session("admin") changes. fear such thing not possible in classic asp. the elegant way can think of adding helper method included in pages: sub assignadminsession(value) session("admin") = value application("admin") = value end sub then instead of session("admi

orchardcms 1.6 - Russian (Cyrillic) characters not displaying in Orchard 1.6 -

i trying setup multilingual orchard website mysql , localization module. i’ve found cannot create localized pages in russian characters display ??? in title when try save. how can resolve that? thanks andrii issue can resolved adding charset=utf8; @ end of mysql connection string. see answer here .

javascript - SlickGrid V2 column Resize triggers Sort -

this may artifact quite reproducable (ie only) in couple grids i've built since switch slickgrid v2 (never saw in previous version). when user resizes column, resort method fires which, of course, resorts column. i've done (which has no effect): grid.oncolumnsresized.subscribe(function(e, args) { e.stopimmediatepropagation(); e.stoppropagation(); // alert('resized'); return false; }); but, when include alert... works should (no resort). so... i'm thinking it's timing issue. set false, 2 sec timer (does nothing times) , has no effect either (still resorts). can explain what's going on , why alert seems allow work properly. doesn't matter whether use local resort or default slickgrid resort method. thanks basically problem ie triggering click event on column when resize. if there column header underneath cursor when mouseup, column resorted. as why alert box helps, browser events fired in particular order. in ie,

How to embed MySQL (libmysqld.dll) using Delphi ZEOS -

i'm trying use embedded mysql database using libmysqld.dll (mysql 5.1) zeos (7.0.3) in delphi xe put libmysqld.dll in same directory, folder language\errmsg.sys folder data\belajar\biodata.frm,biodata.myd,biodata.myi,db.opt unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, zabstractconnection, zconnection; type tform1 = class(tform) button1: tbutton; zcon: tzconnection; procedure button1click(sender: tobject); private { private declarations } public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.button1click(sender: tobject); begin zcon.protocol := 'mysqld-5'; zcon.database := 'belajar'; zcon.connect; end; end. when run code, click button1 , closed, no error message, application terminated. any help? update: i have solved problem, put wrong name , version of "language

sql - Inset php json encoded array into database -

i need insert elements of php encoded array database , i'm stuck. have first used json encode to grab data database using sql query (which did successfully) need able opposite. if i'd appreciate it. it's second day of work , i'm not doing well. following code: $usercoords_query = "select accuracy, longitude, latitude, timestamp userdetails userid =" . $userid; $usercoords_result = mysql_query($usercoords_query); if (mysql_num_rows($usercoords_result) == 0) { echo "there no users id of ". $userid; } else { $emptyarray=array(); while ($row = mysql_fetch_array($usercoords_result)) { $accuracy=$row['accuracy']; $longitude= $row['longitude']; $latitude=$row['latitude']; $timestamp= $row['timestamp']; $queue= array('accuracy:' => $accuracy, 'latitude' => $latitude, &#

Need to modify several XML files with Perl script in Linux env -

i have several xml files named tc_circle1 , tc_circle2 , `tc_point1, etc in directory , want use script update start , stop dates in each file. start , stop dates inside , tags in each file. i had script worked when using sun machines not working on new hp linux machines. doesn't show errors , doesn't change dates. need getting work in linux. script: #!/usr/local/bin/perl $numargs = @argv; if ($numargs != 2) { print "usage: replace_default_date.pl default_start_date default_stop_date\n"; } @filenames = `ls tc*`; chomp(@filenames); foreach $file (@filenames) { open(regfile, "$file") || die "cannot open |$file|"; @lines = <regfile>; close(regfile); open(writefile), ">$file") || die "cannot open |$file|"; foreach $line (@lines) { if ($line =~ /default_start_date/) { $newline = " " . $argv[0]; print writefile "$newline\n"; } elsif ($line =~ /defaul

java - Ebean - Which find to use for multiple results? -

i using play framework , ebean, need find information inside 'value' column searching 'company_id'. however, there multiple rows same company_id , need find of them , put them in list (doesn't have list, make sense). my table looks this: +----+------------+-----------+-----------+ | id | company_id | parent_id | value | +----+------------+-----------+-----------+ | 1 | 1 | 0 | group1 | | 2 | 1 | 1 | subgroup1 | +----+------------+-----------+-----------+ and code : @entity public class groups extends model { private static final long serialversionuid = 1l; @id public long id; public long company_id; public long parent_id; public string value; public static final finder<long, groups> find = new finder<long,groups>(long.class, groups.class); public static groups findbycompanyid(long id){ return find.where().eq("company_id", id).findunique();

php - Divide a table's column as different rows with mysql -

here's table: table1 id | id_activity | id_elem | text --------------------------------------- 1 | 1 | 11 | text1 | 2 | 1 | 12 | text2 | 3 | 1 | 13 | text3 | 4 | 2 | 11 | text4 | 5 | 2 | 12 | text5 | 6 | 2 | 13 | text6 | 7 | 3 | 11 | text7 | 8 | 3 | 12 | text8 | 9 | 3 | 13 | text9 | 10 | 4 | 11 | text10 | 11 | 4 | 12 | text11 | 12 | 4 | 13 | text12 | 13 | 5 | 11 | text13 | 14 | 5 | 12 | text14 | 15 | 5 | 13 | text15 | 16 | 6 | 11 | text16 | 17 | 6 | 12 | text17 | 18 | 6 | 13 | text18 | i need make result this: id | text_elem_11 | text_elem_12 | text_elem_13 --------------------------------------------------- 1 | text1 | text2

javascript - Stocktwits Symbols filter flag throwing errors -

i'm trying integrate stocktwits symbols multicall api website. using ajax jsonp, can indeed working , throw flags such limit, whenever try use filter flag receive 500 error. strange can use said filter on single symbol call api , works fine. point me in right direction? like said before, can symbols multicall work, it's not authentication, it's filter flag. below working examples followed code not working. running on localhost single call works: stocktwitsjsons = $.ajax({ url: "https://api.stocktwits.com/api/2/streams/symbol/aapl.json?callback=?", datatype: 'json', data:{ limit:8, filter: 'top' }, success: function(data) { if (data) { callback(data, tickerlist, assetids); }} }); multi-call works: stocktwitsjsons = $.ajax({ url: "https://api.stocktwits.com/api/2/streams/symbols.json?callback=?", datatype: 'json', data:

c# - Publish MongoDB in Windows Azure worker role - Always Busy -

i have developed application mongodb , i'm ready live in cloud. i have followed tutorial official mongodb website how deploy in windows azure's worker role. i have tried local deployment in windows azure emulator, work fine. but when tried publish cloud service, result wasn't expectation. mongodb.windowsazure.mongodbrole_in_x (where x instance number) in busy status message .. starting role... unhandledexception:microsoft.windowsazure.storageclient.clouddriveexception i have no clue this. could have suggestion ? thx. ps1. sorry english. ps2. have used latest version of windows azure sdk. in worker role setup, mongodb sets store database on durable drive (basically vhd mounted in blob). since you're getting clouddriveexception , first thing i'd @ storage connection string account being used mounting drives. configuration file still pointing @ local dev storage?

iphone - IOS UIImagePicker in a UIView subview -

i trying display uiimagepicker programatically generated uiview that's added subview of original view controller. image picker comes , camera functionality breaks , nothing navigates properly. how load image picker uiview , not uicontrolview? code breaks: - (void)captureimage:(id)sender { [[[uiactionsheet alloc] initwithtitle:nil delegate:self cancelbuttontitle:@"close" destructivebuttontitle:nil otherbuttontitles:@"take photo", @"camera roll", nil] showinview:self]; } //uiimagepicker specific methods -(void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { switch (buttonindex) { case 0: [self takephoto]; break; case 1: [self fromcameraroll]; break; } } -(void)takephoto { if ([uiimagepickercontroller issourcety

jquery - Track display changes on HTML element with Javascript -

suppose have given html element, such as: <div id="foo">...</div> inside element, lots of things can happen change display configurations of element, height or fixed position. is there anyway can track changes related display of element? there general event gets fired when element changes display variable? simply use such as: mutationobserver = window.mutationobserver || window.webkitmutationobserver; var observer = new mutationobserver(function(mutations, observer) { // fired when mutation occurs console.log(mutations, observer); // use of information here. }); observer.observe(document, { subtree: true, attributes: true //... }); in call mutationobserver can listen events , list of elements changed in variable mutations. in first argument observer.observe can set elements listen. in second argument same method can set want listen. this code works chrome, firefox , safari. others browsers can use events, such 'd

oop - Matlab Class Method: Too many arguments -

i found related questions, didn't find answer in there. i'm writing simple little matlab class in order learn oop syntax in matlab. i'm familiar python, , pulling hair out trying work matlab. here's definition: classdef car < handle properties speed = [0,0] %x,y velocity position = [0,0] running = false end methods function obj = car(pos, spd) obj.position = pos; obj.speed = spd; end function accelerate(obj,x,y) % add speed obj.speed = obj.speed + [x,y] end function position = getposition(obj) position = obj.position end function start(obj) obj.running = true end function stop(obj) obj.running = false end end end this not done, i'm using little script mess object: foo = car([1,1],[0,2]) foo.start foo.accelerate(2,3) instantiation works, method c

scala - Merging a list of Strings using mkString vs foldRight -

i trying out things in scala, trying accustomed functional programming leaning new language again (it's been while since last time). now given list of strings if want merge them 1 long string (e.g. "scala", "is", "fun" => "scalaisfun" ) figured 1 way foldright , apply concatenation on respective elements. way, admittedly simpler, call mkstring . i checked on github couldn't find source code respective functions (any on appreciated), not sure how functions implemented. top of head, think mkstring more flexible feels there might foldright in implementation somewhere. there truth it? otherwise scaladocs mention mkstring calls on tostring each respective element. seeing strings start with, 1 negative point mkstring in particular case. comments on pros , cons of both methods, respect performance, simplicity/elegance etc? simple answer: use mkstring . somestring.tostring returns same object. mkstring implemente

Can't do a git pull -

i'm trying git pull , error message: error: following untracked working tree files overwritten merge: <myfilename> please move or remove them before can merge. so, try remove file using command git rm --cache results in error: fatal: pathspec <myfilename> did not match files at point i'm stuck. can't pull until remove file. but, tells me can't remove file. what can fix this? you have untracked files in way of pull. can't remove them git rm --cached because untracked. don't appear in index. need remove them plain old rm

How to capture output of expect script command with expect_out? -

#!/usr/bin/expect -f spawn telnet ip port expect "escape character '^]'" send loadtime set accum {} expect { -regexp {..*} { append accum "${accum}$expect_out(0,string)" exp_continue } } puts $accum the output of loadtime command looks "load time: 2.45" however, on executing script, $accum displays "loadtime" , not "load time: 2.45" how capture output of loadtime command in variable or local file? you forgot press enter key: send "loadtime\r"

c# 4.0 - How do you determine which row was selected in a Infragistics WebHierarchicalDataGrid when you have a Master Detail table configuration -

i have master table , 2 child detail tables under master. when user selects 1 of detail tables rowselection event fires. need determine table selected. if users selectes second detail table need obtain data specific field. code can put in place make determination. here code have far grab data, need build if statment around code. string uploadindex; if (e.currentselectedrows.count > 0) { gridrecord orow = e.currentselectedrows[0]; uploadindex = orow.items[0].value.tostring(); } tried got controlmain inaccessible due protection level. containergrid orowisland = webhierarchicaldatagrid1.gridview.rows[e.currentselectedrows[0].index].rowislands[0]; if (orow.owner.controlmain.id == '2') { uploadindex = orow.items[0].value.tostring(); } use containergridrecord type instead of gridrecord when d

qt - Sorting a model has no immediate effect -

i implemented sort in qabstracttablemodel subclass. sorting works view doesn't change until hover on table (i.e. not header). how can fix this? @ first thought have emit signal couldn't find appropriate one. i use following code sort model in project: void mymodel::organize() { if (!cache_ || cache_->empty()) return; beginresetmodel(); // (a) std::stable_sort(cache_->begin(), cache_->end(), comparerow); endresetmodel(); // (b) } // end:(mymodel::organize) line (a) tells model i'm going re-organize data, line (b) tells model i'm finished, please refresh associated views. you may emit datachanged(index, index); signal.

javascript - .addClass() not working in JQuery function -

i have numerous websites on "dev" site meaning dummy data , not functionality works. happens have function in document.ready() supposed find html popup box , add class it, gives popup box little blue header bar. function: $("document").ready( function(){ //loadsummary(); not_available_alert = $("#modalmessagealert").dialog( { position: "center", resizable: false, bgiframe: true, autoopen: false, width: 250, height: 200, draggable: false, modal: true, close:function(event,ui){ }, open:function(event,ui){ } }); modifymodalheader("modalmessagealert","demo_dialog_header"); } ); function modifymodalheader(id,classname){ var refs = $("#"+id).prev(); var ref = refs.eq(0); ref.addclass(

perl - Macxchange Script to Change MAC and Hostname in ubuntu 12.04 -

i'm trying adapt script in backtrack work ubuntu. keep getting error on line 14 if [ $? == 0 ]; then line. the script found on http://pctechtips.org/script-to-change-mac-and-hostname-in-backtrack/ the code below: #!/bin/bash #author: jorge l. vazquez #purpose: script change mac address random #and pick random word password.lst in jtr hostname #change variables "interface" , "file" settings #also macchanger needs installed interface=eth0 file=/pentest/passwords/jtr/password.lst word=$(sort -r $file | head -1) #changing mac address random ifconfig $interface down > /dev/null if [ $? == 0 ]; printf "%s\nchanging mac address...\n" macchanger -r $interface else printf "%sscript encounter error, sorry...\n" exit 1 fi #changing hostname random word password.lst printf "%s\nchanging hostname...\n" oldhost=$(hostname) hostname $word if [ $? == 0 ]; printf "%sprevius hostname: $oldhost \n" pr

Powershell Try&Catch Run multiple commands inside try -

hi trying figure out how or way of doing it try { get-adcomputer -identity namedoesnotexist (get-childitem).fullname } catch {$_ | out-file log.log} when running code using name not exist error , catch write logfile (just example) want accomplish error catched try statement continues run get-childitem command , tries too. other simple way of doing this? put 1 line in try..catch give effect try { get-adcomputer -identity namedoesnotexist } catch { $_ | out-file log.log } (get-childitem).fullname but maybe trap looking for trap { $_ | out-file log.log continue # remove if still want see each error } get-adcomputer -identity namedoesnotexist (get-childitem).fullname

jquery - Hook success event MVC validation (per field) -

Image
i'm removing default error messages on form , i'm replacing them tooltips. is there way capture validation event each field? when users starts typing text in "asset name" textbox red background on textbox disappears. remove tooltip well. this how i'm building tooltips: $("#frmasset").submit(function (evt) { var myvalues = new array(); var mynames = new array(); var errors = $(".input-validation-error"); errors.each(function (index) { var name = $(this)[0].id; var value = $('span[for="' + name + '"]')[0].innertext; mynames[index] = name; myvalues[index] = value; }); // build , show tooltop error messages $.each(myvalues, function (index) { tipped.create($("#" + mynames[index]), myvalues[index], { skin: 'red', hideon: test(),

entity framework - The type was not mapped -

im trying run simple program according tutorial find. test code: program.cs: using system; using system.collections.generic; using system.data.entity; using system.linq; using system.text; using system.threading.tasks; namespace ef5withmysqlcodefirst { class program { static void main(string[] args) { using(var context = new databasecontext()) { var defaultforum = new forum { forumid = 1, name = "default", description="default forum test insertion." }; context.forums.add(defaultforum); context.savechanges(); } console.readkey(); } public class forum { public int forumid { get; set; } public string name { get; set; } public string description { get; set; } } public class databasecontext : dbcontext { public dbset<forum> forums { get; set;

javascript - JS function not getting dropdown text -

i have dropdown form have created - need have dropdown either auto-generated text box once selected or have placed in text box once button has been pressed. example "get hex" here dropdown: <fieldset> <legend>logos</legend> <p> <label>choose desired logo</label> <select id = "logo"> <option value = "00">holden</option> <option value = "01">hsv</option> <option value = "02">chevrolet</option> <option value = "02">chevrolet</option> <option value = "04">csv</option> <option value = "05">pontiac</option> </select> <input type="button" value="show hex" onclick="displayselecteditem(val);" /> </p> <p> <input type="text" id="logo" /> </p> </f

mysqli - securing sql queries against malicious intent -

for prototyping, use self-built plugin this $.databasecontents({ url: '/sqliquery.php', data : {query : 'select * members id = 45'} }); the php script execute query , return json-encoded result. in localhost environment don't worry securing server malicious intent. so wonder, best if wanted deploy on live website? i'm not keen on doing lot of unnecessary security engineering - it's not i'm going getting 12,000 hits day. i'd sure don't end having database injected nasty queries. after reading, impression can secure php query variable doing mysql_real_escape_string($_post["query"]); seems not safe - can't directly interact php script , submit data spoofing host or something? i'm not familiar stuff. i thought maybe allowing specific url access good. or can circumvented easily? thanks pointers. so wonder, best if wanted deploy on live website? that's simple quit approach of creating quer

c++ - How do I edit the contents of a Qvector that is within a Qvector -

i'm writing program simulate cache. i'm using qvector structure. have qvector of qvectors of ints. when try edit integers, causes runtime error: *** glibc detected *** ./comporgproject3: free(): invalid next size (fast): 0x00000000010d2550 *** ======= backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fd31b469b96] ./comporgproject3[0x402558] ./comporgproject3[0x402bf3] ./comporgproject3[0x402005] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fd31b40c76d] ./comporgproject3[0x4023c1] ======= memory map: ======== 00400000-00405000 r-xp 00000000 08:01 404625 /home/**/documents/comporgproject3/comporgproject3 00604000-00605000 r--p 00004000 08:01 404625 /home/**/documents/comporgproject3/comporgproject3 00605000-00606000 rw-p 00005000 08:01 404625 /home/**/documents/comporgproject3/comporgproject3 010cb000-010ec000 rw-p 00000000 00:00 0 here cod being run: mai

Onkeypress, javascript is not validating special character -

javascript function avoid special characters. working expected alpha & numbers.only problem is, when need include -,. (k >= 188 && k <= 190) - not working. doing wrong? var k; document.all ? k = e.keycode : k = e.which; return ((k > 64 && k < 91) || (k > 96 && k < 123) || (k >= 188 && k <= 190)|| k == 8 || k == 32 || (k >= 48 && k <= 57)); this latest code,it support browser. function isalphanumeric(evtget) { var browser = navigator.appname; if (browser == "microsoft internet explorer" || browser == "mozilla firefox") { var keyget = evtget.keycode; } else { var keyget = evtget.which; //(window.event) ? evtget.which : evtget.keycode; } alert(keyget); if ((keyget > 47 && keyget < 58) || (keyget > 64 && keyget < 91) || (keyget > 96 && keyget < 123) || (keyget == 9) || (keyget == 32)

node.js - GitHub repo failing Travis CI build because of "console-browserify" -

i have npm project uses jasmine-node running unit tests. my test suite (npm test) runs fine locally, when push commits github travis ci build fails. https://travis-ci.org/arthurakay/lintroller/jobs/7002012 does know happening here? don't think need "console-browserify" reason build believes it's necessary. for reference, see ./hooks/pre-commit bash script see call unit test suite. it issue jshint, corrected in own repo shortly after asked question. https://github.com/jshint/jshint/commit/28cfa2e369b31afb6ccfb44ee1f0d7df71170133 in short, jshint requires console-browserify @ moment ran build repo broken (or in state broke build). having said that, do need test against specific version of each of dependencies.

.htaccess - Whilst forcing www with htaccess unwanted variables of the rewritten url show -

i made change .htaccess , url stopped rewriting properly. looks this: <ifmodule mod_rewrite.c> rewritecond %{https} !=on rewritecond %{http_host} !^www\..+$ [nc] rewriterule ^ http://www.%{http_host}%{request_uri} [r=301,l] </ifmodule> i want make "www" appear, , works, urls like: http://www.e/example/es/1-bienvenidos?lang=es&id=1 instead of http://www.e/example/es/1-bienvenidos this rest of config section: <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewriterule ^(en|es)/([0-9]+)-(.+)/?$ content.php?lang=$1&id=$2 </ifmodule> the redirect rules (force www )is after other rules you need have redirect rules before routing rules. rules route requests through things content.php file negate point of externally redirecting.

zend framework 2 gettext translation using others comments -

i want know if possible use comments created build other comment contain used commend in addition other text. e.g. //en file msgid "user no logged" msgstr "" msgid "#previous commend# participant" msgstr "" //es file msgid "user no logged" msgstr "usuario no logueado" msgid "#previous commend# participant" msgstr "#previous translation# como participante" i want use translation: $this->translate('user no logged participant'); //i want obtain: usuario no logueado como participante is possible change #.....# words anything? thanks in advance. isn't other question about, too? though if understand correctly you're trying do, may this: echo $this->translate(sprintf( '%s participant', $this->translate('user no logged') )); but again in case, me 2 translations in row, like: echo sprintf('%s %s',

osx - Android valgrind build fails -

hello i'm trying build valgrind android-arm. on linux mint 13 fails with: $ make echo "# generated file, composed of following suppression rules:" > default.supp echo "# " exp-sgcheck.supp xfree-3.supp xfree-4.supp glibc-2.x-drd.supp glibc-2.34567-nptl-helgrind.supp glibc-2.x.supp >> default.supp cat exp-sgcheck.supp xfree-3.supp xfree-4.supp glibc-2.x-drd.supp glibc-2.34567-nptl-helgrind.supp glibc-2.x.supp >> default.supp make all-recursive make[1]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1' making in include make[2]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/include' make[2]: nothing done `all'. make[2]: leaving directory `/home/matt/desktop/valgrind/valgrind-3.8.1/include' making in vex make[2]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' make all-am make[3]: entering directory `/home/matt/desktop/valgrind/valgrind-3.8.1/vex' gcc -dhave_config_h

html - Display Table Cell inconsistency. -

hey wondering why happens: http://jsfiddle.net/dsvgf/ the buttons not fill container yet anchors do. fundamentally different between 2 tags stylistically? <div class="table"> <a href="#">a</a> <a href="#">b</a> <a href="#">c</a> </div> <div class="table"> <button href="#">a</button> <button href="#">b</button> <button href="#">c</button> </div> .table { display: table; width: 100%; outline: 1px solid red; } .table > * { display: table-cell; outline: 1px solid lightgreen; } i suppose fundamental difference between these elements <button> treated replaced element (at least browsers), , rendered of non-css browser built-in mechanisms. there several issues in bugzilla rendering limitations of buttons caused (e.g. https://bugzilla.mozilla.org

java - Program does not appear to run and does not flag any errors -

while trying compile 'guess number' program in netbeans programme seems keep on running programme not executing. when user clicks 'play' jbutton playgame method should run nothing seems happen , no exception thrown. code below. ciaran /* * chpter 11 gui programmong questions * 11.15 */ package chapter11gui; import java.awt.borderlayout; import java.awt.flowlayout; import java.awt.event.actionlistener; import java.awt.activeevent; import javax.swing.jbutton; import javax.swing.jpanel; import javax.swing.jtextarea; import java.awt.color; import java.awt.component; import java.awt.event.actionevent; import javax.swing.jlabel; import javax.swing.jtextfield; import javax.swing.jframe; import javax.swing.imageicon; import javax.swing.icon; import javax.swing.swingconstants; import java.util.random; public class guessgame extends jframe { //instance varibles/files private jlabel intro; private jlabel highorlow; private jbutton play; private j