Posts

Showing posts from February, 2014

php - Simple HTML Dom: How to nest foreach loop to correctly echo output -

sorry if title confusing, couldn't find correct words formulate correctly. a little bit of context: i'm trying data 2 classes , echo them 1 line. here's code: foreach ($site->find('.version a') $source) { foreach ($site->find('.version_numb') $pwgetframe) { $pwframe = $pwgetframe->innertext; $geturl = $source->href; $pwversion = $source->plaintext; echo '<div class="linkframe"><a href="'.$geturl.'">'.$pwversion.'</a><div>'.$pwframe.'</p></div>'; } } this code made each linkframe inside previous linkframe making inception. what can make work correctly? although it's not clear understand you're after question, believe you're looking following: $source = $site->find('.version a'); $pwgetframe = $site->find('.version_numb'); ($i=0; $i < sizeof($source); $i++) { $pwframe = $pwgetframe[$i]

debugging - Debug python that wont respect a catch statement -

i trying run avg part of program. program executed automatically, cant see standard output python. when run program calling directly, works perfectly, when run via automation, fails. it in syslog -> "starting scan of: xxx", never says "unexpected error" or "scan results". means, failing, not using catch statement, or reporting error in "out" variable. the offending function: # scan file viruses # fpath -> fullpath, tname -> filename, tpath -> path file def scan(fpath, tname, tpath): syslog("starting scan of: " + tname) command = ["avgscan", "--report=" + tpath + "scan_result-" + tname +".txt", fpath] try: out = subprocess.call(command) syslog("scan results: " + str(out)) except: syslog("unexpected error: " + sys.exc_info()[0]) finally: syslog("finished scan()") both ide

spring mvc - How to work with EasyMock for testing servicelayer in SpringMVC? -

i working on hibernate , spring mvc application,but want test servicelayer using easy mock ,i doing not understanding correct way or not. please check code below , give me suggestions studentdao package com.bhanu.dao; import com.bhanu.entity.studententity; import com.bhanu.modelpojo.student; public interface studentdao { public studententity login(student student); public studententity finduser(string email); } studentservice package com.bhanu.service; import com.bhanu.entity.studententity; import com.bhanu.modelpojo.student; public interface studentservice{ public studententity login(student student); public studententity finduser(string email); } studentserviceimpl @service public class studentserviceimpl implements studentservice { @autowired private basedao basedao; @autowired private javamailsender mailsender; @autowired private studentdao studentdao; public studentserviceimpl() { super(); // todo auto-generated constructor stub } @override public

Installing hadoop issue -

i following joseph adler instructions on how install ( page 555 here - http:// it-e books. info/book/1014/ ) hadoop on lubuntu. i wrote in terminal: wget http://archive.cloudera.com/cdh/3/hadoop-0.20.2-cdh3u4.tar.gz tar xvfz hadoop-0.20.2-cdh3u4.tar.gz and went fine, .tar.gz file downloaded , untarred. but when wrote hadoop version in terminal, there appeared message saying there no command hadoop. does has idea on should use (already) installed (still) somehow invisible hadoop? help! in linux invoking command without prefixing path requires location command resides should present environment variable path. here, executing command got specify either absolute or relative path of command. following can used, replace extracted location. <extract_loc_path>/hadoop-0.20.2-cdh3u4/bin/hadoop version if present working directory /hadoop-0.20.2-cdh3u4/bin/ ./hadoop version sufficient.

php - how to validate input id is equal to input data in html? -

i fresher. can validate data in input form id=entered data. if data wrong should change color of form. out j query, java script, ajax. yes, can use html5 validate data, however recommended use example jquery validation since not browsers support html5 validation. for example use simplified url-validator, <input type="url" name="website" required pattern="https?://.+"> you use html5, jquery, java script etc on client side when want validate something. php on other hand use verify form data on server side, is, when data has been submitted form's action page.

java - Need help to setup google merchant request -

i'm trying develop simple online shop application using java, , got hand of google online payment. signed google merchant, , have got issuer , secret code. i've got question sample provided google, following code sample merchant requests. private string getjwt() throws invalidkeyexception, signatureexception { jsontoken token = null; token = createtoken(); return token.serializeandsign(); } private jsontoken createtoken() throws invalidkeyexception{ //current time , signing algorithm calendar cal = calendar.getinstance(); hmacsha256signer signer = new hmacsha256signer(issuer, null, signing_key.getbytes()); //configure json token jsontoken token = new jsontoken(signer); token.setaudience("google"); token.setparam("typ", "google/payments/inapp/item/v1"); token.setissuedat(new instant(cal.gettimeinmillis())); token.setexpiration(new instant(cal.gettimeinmillis() + 60000l)); //configure request object jsonobject r

java - Breakpoints does not work after reloading classes with springloaded in Intellij -

i'm running java application "application" configuration in intellij , i'm using these vm options using springloaded: -javaagent:.../springloaded-1.2.0.release.jar -noverify the class reloading springloaded works fine. but debugger won't stop more @ breakpoints in reloaded classes. breakpoints in other classes still work. this solution works: start application in run mode (instead of debug mode) remote debug option: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 start remote debug intellij. but perhaps there's better solution?

file - Read comma separated values with stray whitespaces from a textfile in c++ -

i have file contains string,int,int values in multiple lines. delhi,12,13 mumbai,100 , 101 kolkata,11, 12 the values separated commas there can stray whitespaces in between.my current code : #include<cstdio> #include<iostream> #include<string> using namespace std; int main() { file *f = fopen("input.txt","r"); int lines = 0; char c = getc(f); while(c != eof) { if(c == '\n') { lines++; } c = getc(f); } lines++; string arr[lines]; int t1[lines]; int t2[lines]; char s1[100],s2[100],s3[100]; int x,y; fclose(f); f = fopen("input.txt","r"); while (fscanf(f,"%99[^,],%99[^,],%99[^,]", s1, s1, s2)==3) { cout << s1 << s2 << s3 << endl; } } this doesn't seem quite read values , display on screen first of all. how read string , integer values here(which may

networking - multicast packages are there but can not be accessed -

my box runs ubuntu 14.04. old 32bit box 4 ether nics. want achieve multicast routing upstream interface (eth2.8 - dynamic ip) downstream interfcae (eth0.13 - 192.168.40.1). laptop attached above box via eth0.13 can read multicast 40.1 charm. verified running vlc server on 40.1 cvlc -vvv ./pos-movie-927x521.mov --sout udp:239.255.12.42 --ttl 12 and receiving stream on laptop with vlc udp://@239.255.12.42 that works other way round, sending laptop , receiving on serverside. so why not possible access multicast packages via eth2.8? joining works. can verify arriving packages by sudo tcpdump -i eth2.8 -n multicast but seems impossible access these packages without tcpdump! this describes experiencing , alone solution not same. here sysctl parameter: net.ipv4.conf.eth2/8.rp_filter = 1 net.ipv4.conf.eth2/8.mc_forwarding = 1 net.ipv4.conf.eth2/8.forwarding = 1 there no difference between sysctl params of eth2.8 , eth0.13. and yes, happens if firewall down!

javascript - Meteor account-ui: How do I create a user with email and password then ask them to complete a profile once logged in? -

i've installed account-ui package meteor, that's working fine. i've created schema use create form using autoform package , working fine. i ran "meteor reset" clear database. went through process of creating user. entered email address , password clicked "create" , got error saying required field missing. field appears on schema guess understandable displays. i'm happy default form asks email address , password. my question this, how allow user sign email address , password , once logged in complete profile defined in schema? perhaps method helps 1. user inputs email , password 2. if there's activation email sent ( included activation email link complete thier profile) 3. upon signing in first time redirected thier profile page theyay complete thier profile if wished <template name="signup"> <form action="/sign-up" id="signupform"

c# - Check if folder exists does not work as expected -

when attempt check if folder exists, code suggests exists, if doesn't. string folder = @"c:\lwa"; if (!directory.exists(folder)) { messagebox.show("folder exists"); } what's wrong it? your if condition , message don't match. ! directory.exists(blah) will true if directory blah not exist. the ! operator inverts boolean value give it.

python - Send serial value and convert them to float? -

i trying convert serial data float. i send serial data other program need float value, dont know how do. the values send between 0 , 180, , these values received degrees, need values degrees. how do?? while true: while z == true: x = x+1 print x if x == 180: z = false while z == false: x = x-1 print x if x == 0: z = true try: envio=ser.write("x") # write string #print envio except exception, e: print "error en \n\t "+str(e)+"\n" ser.close and x value received in script ser.open() degree = ser.read() x in range(1,400,10): linea = (432,200) linea_len = 100 x = linea[0] + math.cos(math.radians(degree)) * linea_len y = linea[1] + math.sin(math.radians(degree)) * linea_len but x send serial seems binary, , need float. i hope can me you!! ********************edit*********************** tho c

JQuery toggle on li causing other li to bounce -

hi making information dropdown uses jquery toggle. when click on 1 open toggle div beneath it causes other li bounce down pop place. want them remain stationary. i added absolute position removes flow , not push lower divs down when toggle div opens. toggle div covers other divs below it. here jquery: var open = $('.open'), = $('ul').find('a'); console.log(a.hasclass('active')); open.click(function(e){ e.preventdefault(); var $this = $(this), speed = 500; if($this.hasclass('active') === true) { $this.removeclass('active').next('.box').slideup(speed); } else if(a.hasclass('active') == false) { $this.addclass('active').next('.box').slidedown(speed); } else { a.removeclass('active').next('.box').slideup(speed); $this.addclass('active').next('.box').delay(speed).slidedown(speed); } }); })(jquery); and here html: <div class="grid_12 om

Is there a way to add background when using css3 multiple backgrounds images? -

i using css3 multiple backgrounds images. wonder if possible add top layer background pseudo-classes :hover or :active? yes, possible have pseudo-classes work background. users uncomfortable user experience :hover or :active . you can apply css multiple div this: .background1.background2{ background-image: url(background1.png), url(background2.png); background-position: center, center; background-repeat: no-repeat, no-repeat; backgroun-size: 100%, 50% } or can apply css multiple div (depend how want image presented browser: .background1{ background-image: url(background1.png); background-position: center; background-repeat: no-repeat; background-size: 100%; } .background2{ background-image: url(background2.png); background-position: center; background-repeat: no-repeat; background-size: 50%; } if want change background randomly recommend using css3 animation or jquery change on refresh. css3 animation jquery

javascript - Error: No pending request to flush - when unit testing AngularJs service -

i'm newbie angularjs, , i'm in process of writing first unit test; test service wrote test returns single json object. however, everytime run test error stated in title. don't know causing this! tried reading on $apply , $digest , not sure if that's needed in case, , if yes how; simple plunker demo appreciated. here code service var allbookss = []; var filteredbooks = []; /*here define our book model , rest api.*/ var report = $resource('api/books/:id', { id: '@id' }, { query: { method: 'get', isarray: false } }); /*retrive requested book internal book list.*/ var getbook = function(bookid) { var deferred = $q.defer(); if (bookid === undefined) { deferred.reject('error'); } else { var books= $filter('filter')(allbooks, function(book) { return (book.id == bookid); }); if (books.length > 0) {

php - Session or cache for preserving data across pages? -

i'm re-writing small app phalcon in collect information user. essentially, grab firstname, lastname, email, whether or not person married, numbers pertaining person, etc across multiple pages. when user "finally" submits information (after being asked review it), write information db , perform number of calculations generate report, gets emailed out. prior rewrite information stored in session directly, ie "$firstname = $this->session.get('firstname', '');". i'm uncomfortable approach, sessions being used user objects. generate session id, , write information database each time, , retrieve accordingly. however, don't information user, , we've noticed people tend start report process , bail out or go elsewhere. in case, don't know whether or not makes sense write db each time sake of collecting information , flushing @ end. i guess question boils down ideal approach, seeing don't think need hit db much. practic

python 3.x - Assigning int values to each dictionary entry as well as having reference numbers? -

i'm trying create dictionary in python 3 holds 12 different names, first 7 must have value of 8.50, last 5 13.50 possible assign them int values? have tried find answers through google etc either i'm not wording questions right or it's not possible. @ moment i'm using: pizza_dict = {"0: basic cheese $8.50", "1: pepperoni $8.50"} but can not find way give them int values if possible? use {}.fromkeys() : >>> {}.fromkeys(['1','2','3'],8.5) {'1': 8.5, '3': 8.5, '2': 8.5} for example: >>> mydict={} >>> mydict.update({}.fromkeys(['1','2','3'],8.5)) >>> mydict {'1': 8.5, '3': 8.5, '2': 8.5} >>> mydict.update({}.fromkeys(['4', '5', '6'],13.5)) >>> mydict {'1': 8.5, '3': 8.5, '2': 8.5, '5': 13.5, '4': 13.5, '6': 13.5

encryption - How to scan/list encrypted files? -

the infamous cryptowall has encrypted large number of files/folders. while have restored of files backup, looking way scan remaining encrypted files scattered across local , network drives. is there way of generating list of encrypted files ? (by scanninng file header / or verifying file integrity). possible in command line or specific software ? cheers, florian you can try generate list of crypted files http://www.bleepingcomputer.com/download/listcwall/ try use link decrypt files - better nothing https://www.fireeye.com/blog/executive-perspective/2014/08/your-locker-of-information-for-cryptolocker-decryption.html original post taken http://www.bleepingcomputer.com/virus-removal/cryptowall-ransomware-information

amazon ec2 - why doesn't my git post-receive hook seem to work -

i have amazon ec2 instance that's running linux , has git installed. setup git repo following command. git init --bare i cd hooks directory , created post-receive file has following bash script. #!/bin/sh git_work_tree=/var/www/mysite export git_work_tree git checkout -f when push local repo server seems go well. tested adding new file called myfile.html project , pushing server. don't errors. however, when cd /var/www/mysite directory don't see new file added, if clone remote repo new directory locally changes pushed server. my thought changes being tracked git fine when post-receive runs maybe sort of permissions issue keeping files getting moved , applied /var/www/mysite directory ? hoping can shed light on may happening , how trouble shoot this. ======================================== so post-receive file needed following permissions set make executable. chmod +x post-receive after doing have actual permissions issue i'm telling git move f

python - pip says modules "weren't found" to uninstall, but pip list shows them -

with pip list i'm shown listing of installed modules, includes scipy, numpy, , pandas. if pip install -u... of those, checks it, sees up-to-date, , returns prompt. if pip uninstall pandas or of items can see in list, says can't uninstall numpy. no files found uninstall i installed has python through enthought's canopy stack. apparently there care required when installing/package managing canopy - example, devs/staff @ enthought (eg https://support.enthought.com/entries/22914233-using-non-epd-package-installers-such-as-pip ) "the best practice, when wish install epd package source, first uninstall ( enpkg --remove some_package ), install using whatever technique prefer" such ( pip install some_package ) it's worth noting 'sklearn' module letting me import datasets after having used canopy package manager update (33) out-of-date packages. note: these packages pip said up-to-date! to sum up: if installed canopy, use package

epub - Internal links in epublib on Android aren't working -

i'm using epublib android library read existing epub, , can't internal links work. one of chapters has html this <a href="9781484702181.html">click here</a> but when click on it, android webview error: the webpage @ file:///data/data/com.temp.package/library/epub/9_epub_files/9781484702181.xhtml not loaded. i've tried changing url neither works. <a href="./9781484702181.html">click here</a> <a href="oepbs/9781484702181.html">click here</a> is there need in particular internal links work?

c++ - C++11 range-based for loop on derived objects -

if have vector of pointers parent class, , vector initialized instantiating objects derived parent class, appears can't use range-based loop obtain elements derived objects. here's simple example: #include <vector> class parent {}; class derived : public parent {}; int main() { std::vector<parent*> objects { new derived(), new derived() }; (derived* d : objects) { // error // use d } return 0; } is there clean way want (i.e., loop through derived objects)? know can this: for (parent* p : objects) { derived* d = static_cast<derived*>(p); // use d } but cleanest way c++11? other alternatives? the cppreference.com page states range-based loop expression produces code similar following ( __range , __begin , __end exposition only): for ( range_declaration : range_expression ) loop_statement { auto && __range = range_expression ; (auto __begin = begin_expr, __end = end_expr; __

javascript - Unable to collect results HTML5 speech recognition API -

i using speech recognition api unable retrieve results whenever it's done. here piece of code using: var recognition = new webkitspeechrecognition(); recognition.continuous = true; recognition.interimresults = true; recognition.onresult = function(event) { console.log(event) } this outputs (in console): bubbles: false cancelbubble: false cancelable: false clipboarddata: undefined currenttarget: speechrecognition defaultprevented: false emma: null eventphase: 0 interpretation: null path: nodelist[0] resultindex: 0 results: speechrecognitionresultlist returnvalue: true srcelement: speechrecognition target: speechrecognition timestamp: 1408325350996 type: "result" __proto__: speechrecognitionevent i can't wrap head around it. how retrieve results? the result in results list in returned event. can find sample code access here: http://updates

mysql - PHP memory leak from a information schema query -

i have application i'm querying large table of zip code information. table has 41143 rows of information. application built in laravel , i'm using db facade selects. i'm building paging structure wanted able total number of rows can determine how many pages there given number of output rows user wants see. when tried first query, select count(*) zipcodes got php memory error (not ultra surprising). i changed query following: select table_rows information_schema.tables table_schema = "zipcodes" considering table_rows column in information schema 1 number thought wouldn't take time @ pull, same error: php fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 32 bytes) ... why query against information_schema table cause memory leak? i should add that: i tried selecting number of things information_schema table query , got same error when try same querying db facade structure use zipcodes table directly (and

javascript - Calling XSP.partialRefreshPost on tokeninput field -

i'm trying implement jquery tokeninput plugin xpages app using examples mark rodens site. i've been going , forth on couple of problems can't seem over. 1) validation on inputtext2 field called regardless of immediate parameter xsp.partialrefreshpost call 2) value selected not binding source document (in case document1.appname). here's code (forgive mess) <xp:panel id="panel1"> <xp:inputtext id="inputtext1" value="#{document1.appname}"> </xp:inputtext> <xp:scriptblock id="scriptblock3"> <xp:this.value><![cdata[ $(document).ready(function() { $("#[id$=inputtext1]").tokeninput([{ "first_name": "arthur", "last_name": "godfrey", "email": "arthur_godfrey@nccu.edu", "url": "https://si0.twimg.com/sticky/default_profile_images

Square root finding using prolog -

i worked on following coding find square root. didn't work. couldn't find error. finding value of y it's working. square root part not. print('a = '), read(a), print('b = '), read(b), print('c = '), read(c), nl, nl, x 2*a, y (b^2 - 4*a*c), z sqrt(y), r1 (-b+z)/x, r2 (-b-z)/x, print('r1 = '), print(r1), nl, print('r2 = '), print(r2), nl. first, if experimenting in prolog, refrain using read/1 , other side-effectful built-ins. instead, type in values want try out. similarly, not need print results. prolog's toplevel you. ?- = 1, b = 2, c = 1, x 2*a, y (b^2 - 4*a*c), z sqrt(y), r1 (-b+z)/x, r2 (-b-z)/x. = c, c = 1, b = x, x = 2, y = 0, z = 0.0, r1 = r2, r2 = -1.0. the answer looks fine me. let's @ error get: error: sqrt/1: arithmetic: evaluation error: `undefined' what systems says here value computes sqrt/1 not defined. in ?- x sqrt(-1). error: sqrt/1: arithmetic: evaluation error

500 Internal Server Error for a PHP file on LAMP server -

i have simple code generate captcha image : <?php session_start(); $captchanumber = 'abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz'; $captchanumber = substr(str_shuffle($captchanumber), 0, 6); $_session["code"] = $captchanumber; $image = imagecreatefromjpeg("bj.jpg"); $foreground = imagecolorallocate($image, 175, 199, 200); //font color imagestring($image, 5, 15, 15, $captchanumber, $foreground); header('content-type: image/png'); imagepng($image); ?> on localhost image generated , on lamp gives 500 internal error. checked php.ini setting : session.save_handler = files is there other setting need check / change ?

sql - How to create a multi-column IN predicate with ActiveRecord? -

i have following 'distances' table: ╔════╦════════════╦════════════╦═════════════════╦═════════════════╦══════════╗ ║ id ║ origin_lat ║ origin_lng ║ destination_lat ║ destination_lng ║ distance ║ ╠════╬════════════╬════════════╬═════════════════╬═════════════════╬══════════╣ ║ 1 ║ 1.234567 ║ 2.345678 ║ 3.456789 ║ 4.567890 ║ 10 ║ ║ 2 ║ 5.678901 ║ 6.789012 ║ 7.890123 ║ 8.901234 ║ 20 ║ ╚════╩════════════╩════════════╩═════════════════╩═════════════════╩══════════╝ the question is, how can create following sql query (supported postgresql) activerecord, , arel, if necessary: select * distances (origin_lat, origin_lng) in ((1.234567, 2.345678), (5.678901, 6.789012)) , (destination_lat, destination_lng) in ((3.456789, 4.567890), (7.890123, 8.901234)); i tried this, doesn't work: distance.where('(origin_lat, origin_lng) in (?) , (destination_lat, destination_lng) in (?)', [[1.234567, 2.345678], [5.678901,

c# - Dynamic .NET WebAPI 5.2 Controllers based on some an abstract base type -

assuming rest , data access interactions standard, want able create abstract type represent entity objects pass , forth rest client (e.g. javascript in browser) persistence layer without writing/registering/routing bunch of different webapi controllers. how can 1 create 1 controller base type implementation manage persistence of several different entity type rest interactions? i.e. how can make work webapi? using system; using system.collections.generic; using system.diagnostics.contracts; using system.linq; using system.web; using system.web.http; namespace dynamicentityapicontrollers { /// <summary> /// /// </summary> public class entitycontroller<t> : apicontroller t : entityobject { private readonly idaoprovider daoprovider; /// <summary> /// initializes new instance of <see cref="entitycontroller{t}"/> class. /// </summary> /// <param name="daoprovi

dataframe - reshaping data frame into contingency table in R -

i have series of excel files following contain contingency table : cns random h3k 12 682 not_h3k 343 30222 when use 'gdata' library read file using command, gives following table not contingency table anymore: random <- read.xls ("analysis.xlsx", sheet = 1, header = true) x cns random 1 utr 12 682 2 not_utr 343 30222 i want run fisher test on data, how can reshape data.frame data contingency table format? read.xls allows arguments read.table. specifically, can specify number of column contains row names. use random <- read.xls ("analysis.xlsx", sheet = 1, header = true, row.names=1) and proceed test

ibm mobilefirst - No Worklight 6.2 Runtime in Console -

i running strange behaviour wl 6.2. wl console not listing of installed apps/wars (runtimes) in aix environment. have setup worklight 6.2 on 2 different platforms: platform: linux (ubuntu) websphere nd 8.5.5.1 db2 v9.7 platform: aix websphere nd 8.5.5.1 oracle 11g both platforms have global security enabled simple file based registry (using federated repository). both configured using following steps in same way. in ubuntu, can see installed runtime (worklightstarter war). in aix, see horrid message in wl console: "server error. contact server administrator" i used worklightstarter app test ubuntu , aix installations. in specific, used worklightstarter app no js frameworks. imported wl 6.2 studio build war file deployment. then followed simplified installation/configuration steps : created databases manually, a) wladmin b) wrklght c) wlreports. followed instructions listed under "create db2 databases manually" , "create oracle databases

c# - SQL Server query not finding row in Database -

i have row in sql server database : province city locationtext ------------------------------------------------------------------------------- Ä°stanbul Ä°stanbul sabiha gökçen havalimanı Ä°stanbul sabiha gökçen airport and copy & paste city name above test in query below: select * locations city ='Ä°stanbul sabiha gökçen havalimanı' but query returns no result found . missing here? if it's nvarchar column, might have better luck n prefix: select * locations city = n'Ä°stanbul sabiha gökçen havalimanı' here's microsoft support article describing use of n prefix when dealing unicode values.

networking - Confused between ports and sockets -

ok when tried research on ip addresses, ports, , sockets, got out of it: ip addresses used map different devices on network. port numbers used specific application on hosts. sockets combination of two.. what don't understand if ports connect specific application, should have 1 port number per application right? example port 80 used http, if application using port it's listening http requests right? happens if more 1 person tries access it? sockets , ports have me confused lot.. a socket abstraction used in software make easier programmers send , receive data through networks. interface, use in application-level code, access underlying network protocol implementations provided os , language runtime. the tcp protocol, ip protocol, , other popular network protocols not, in of themselves , have concept of "sockets". "sockets" concept implementers of tcp/ip came with. so concept of "socket"? basically, object can write data to,

windows installer - Customizing MSI repair -

i'm using visual studio 2013 , have msi installer works fine , during installation i'm installing software - lets name test sw- using command line , this process process = process.start(path, "/verysilent"); if uninstall test sw manually , how can re-install when repair msi main application ? it should work accident. vs setups have things called install custom actions don't define condition means. files being installed condition $c__ec9efaf2178f433499a4760bee578fa6>2 meaning call ca when component marked install. can open msi file orca, go installexecutesequence table , see if condition has form. test , see if works is. in addition, you'll need know path is, in case current code runs setup install location may not available. plus if it's msi-based setup fail anyway because can't have recursive install operations, if you've done initial install ok presumably isn't problem.

android - How to keep dialog showing on orientation change? -

this question has answer here: dialog box disappears during orientation change in fragment 2 answers i have activity inflates listview. on list item click dialog opened(it handled in corresponding list adapter.) on orientation change showing dialog (if any) disappeared (as expected.) want showing dialog not dismiss on orientation change , don't have idea how cleanly handle it. when rotate phone, activity destroyed , recreated. includes dialog. yes, quite possibly stupidest design decision in history, we're stuck it. there 2 ways fix it: 1) turn off "helpful" functionality. if don't have different layouts landscape , portrait i'd suggest. add android:configchange="orientation|resize" activity in manifest. 2) implement onsaveinstancestate/onrestoreinstancestate , have variable says whether or not need recreate , relaunc

ajax - How read .json file in angular js -

here want read .json file. have read in controller. getting while reading .json file. quiz.json: [ { "data":{ "questions":{ "level":[ { "question":[ { "title":"what sap® stand for?", "answer":[ "services application programming", { "_correct":"1", "__text":"systems, applications, , programs" }, "sino-american peace", "statistical analysis program" ] }, { "title":"what tcode mean?", "answer":[

jquery - codeigniter form validation is not working -

i have tried several times according ci user guide if there empty text fields process works same fields filled. problem how can echo validation errors near individual input fields, here code view <div id="content"> <h2>bank account details.</h2> <?php $this->load->helper('form'); $attributes = array('method'=>'post','name'=>'create_bank','id'=>'create_bank'); echo form_open_multipart('',$attributes);?> <label>account number : </label> <?php echo form_input('accountnumber');?><br/> <br/> <label>bank : </label> <?php echo form_input('bank');?><br/><br/> <?php echo form_hidden('branch',$id);?><br/><br/> <input type="submit" name="submit" value="save"/> <?php echo form_c

How to get the Hello "Newline" and World in powershell using regex? -

how hello “newline” , world in powershell using regex? hello world i have hello world text file. i'm using powershell. this should work $match = get-content -path <path_to_file> | out-string | select-string "hello`r`nworld" if ( $match ) { write-host $match.matches[0].groups[0].value } we load file get-content flatten array single string, in case piping out-string . finally, regex applied embedded crlf. if have powershell 3, believe can use get-content -raw (which returns single string) , pipe straight select-string . my test file: line1 hello world line4 output: hello world

java - Android GCM with product flavors -

i have gcm sample android gradle project. worked well, when add 2 flavors push notification stopped work. compilation manifest (it's taken app\build\intermediates\manifests\ex\debug ) file below: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.flavor.app" <uses-permission android:name="com.flavor.app.permission.c2d_message" /> <permission android:name="com.flavor.app.permission.c2d_message" android:protectionlevel="signature" /> <receiver android:name="com.google.android.gcm.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" />

java - Netty class not found exception while executing JAR -

i've made jar file project made, when try execute it, gives: exception in thread "main" java.lang.noclassdeffounderror: org/jboss/netty/channel/socket/serversocketchannelfactory @ org.ddosdefense.httpfilter.httpinterceptor.main(httpinterceptor.java:66) caused by: java.lang.classnotfoundexception: org.jboss.netty.channel.socket.serversocketchannelfactory @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 1 more inside jar file libraries present. in .classpath file netty jar library present: <classpathentry kind="lib" path="ddos2_lib/netty-3.6.2.final.jar"/> when exe

c# - Async Read Synchronization -

it seems can not find elegant solution synchronization of code below. remember once did similar thing mind blank. i need protect no 2 threads read socket, 1 thread waits on beginread. when use mutex in way, syncronizationerror. class program { tcpclient client = new tcpclient(); public readonly object loker = new object(); public void beginread() { if (!mutex.tryenter(loker)) { return; } client.getstream().beginread(..., read_callback); } private void read_callback(iasyncresult ar) { client.getstream().endread(ar); mutex.exit(loker); beginread(); } static void main(string[] args) { beginread(); } } what need here synchronization method designed asynchronous, rather synchronous, critical sections. want able run code asynchronously after code able take out lock rather making asynchronous method use synchronous locking mechanisms. synchronous mech

improve iteritems performance or a better way to loop through python dictionary -

it takes approx. 190s complete loop below on laptop intel i5, 8gb, windows 7. count = 0 l in xrange(num_room): k in xrange(num_slot): m in xrange(num_activity): count = count+1 dk, [om, ol, ok] in xdict.iteritems(): if dk == (m,l,k): # i did trace , found out total loop 13960 x 19040 ~ 2bils. len(self.xdict): 13960 count: 19040 xdict looks (an example): xdict = {(19, 4, 118): [19, 4, 4], (4, 12, 25): [4, 12, 7], (15, 19, 121): [15, 19, 21], (23, 5, 219): [23, 5, 9], (13, 5, 19): [13, 5, 1]} i trying value of key in dictionary. there anyway improve performance? sorry, think know happen. count = 0 l in xrange(num_room): k in xrange(num_slot): m in xrange(num_activity): count = count+1 val = xdict.get((m,l,k)) if val != none: [om, ol, ok] = val # now takes 1s. don't loop on i

Python Triple Nested for Loop not Fully Iterating -

essentially happens when run code "print block[j]" section of program gets run, test code have afterwards i.e. print block[k] , print "testing code" not reached. i've been staring @ program last half hour , can't figure out why program can reach beyond 2nd nested loop not third. def swapii(str): new_str = "" letter in str: if letter.isupper(): new_str = new_str + letter.lower() else: new_str = new_str + letter.upper() new_list = new_str.split(' ') in new_list: block = i.split() j in range(len(block)): print block[j] k in range(j+1, len(block)): print block[k] if block[j].isdigit() , block[k].isdigit(): lala = block[j] block[j] = block[k] block[k] = lala print "testing code" = ''.join(block) return ' '.join(new_list) # keep function call here # see

php - Node.js crashing automatically by mysql without any operation in it -

i working node.js , facing problem crashing of node . error message shown below. error: connection lost: server closed connection. @ protocol.end (/var/www/versions/project/js/node_modules/mysql/lib/protocol/protocol.js:78:13) @ socket.<anonymous> (/var/www/versions/project/js/node_modules/mysql/lib/connection.js:81:28) @ socket.eventemitter.emit (events.js:117:20) @ _stream_readable.js:919:16 @ process._tickcallback (node.js:419:13) i'm using mysql queries in node server..but @ crashing time not have operation on it... node crashing automatically different period of time. i have found working connection pools grab connection when need best approach. // once var pool = mysql.createpool( opts ); // then, before need connection pool.getconnection(function(err, connection) { if (err) throw err; // use connection // don't forget release connection when done... connection.release(); });

php - How to check user if logged in My_Controller at CodeIgniter -

i new codeigniter. want create new controller checks other controller , methods if user logged in already. using session way. stated here codeigniter - how check session used @ every methods , here . i need create my_controller.php inside application/core folder. <?php class my_controller extends ci_controller { function __construct() { parent::__construct(); } } ?> public_controller.php <?php class public_controller extends my_controller { function __construct() { parent::__construct(); // session stuff here :) } } admin_controller.php <?php class admin_controller extends my_controller { function __construct() { parent::__construct(); // session stuff here :) } } what should add inside 2 new controller can use in controller base.php? or how can implement session checking? sorry, hard me explain. make ur my_controller this: <?php class my_controller extends ci_con