Posts

Showing posts from April, 2011

sockets - Issue in executing SSL TLS client server Java programs -

i have started studying ssl tls in java , written simple client , server programs. run server program first, followed client program. on execution, client program gives following exception stack trace :- exception in thread "main" javax.net.ssl.sslhandshakeexception: no cipher suites in common @ sun.security.ssl.alerts.getsslexception(unknown source) @ sun.security.ssl.sslsocketimpl.fatal(unknown source) @ sun.security.ssl.handshaker.fatalse(unknown source) @ sun.security.ssl.handshaker.fatalse(unknown source) @ sun.security.ssl.serverhandshaker.chooseciphersuite(unknown source) @ sun.security.ssl.serverhandshaker.clienthello(unknown source) @ sun.security.ssl.serverhandshaker.processmessage(unknown source) @ sun.security.ssl.handshaker.processloop(unknown source) @ sun.security.ssl.handshaker.process_record(unknown source) @ sun.security.ssl.sslsocketimpl.readrecord(unknown source) @ sun.security.ssl.sslsocketimpl.performinitialhandshake(unknown source) @ sun.security.

php - Show only child categories of current category page -

i having hard time getting children current category page. instance on on page category 4. seems pulling it's siblings right instead of the children. not want siblings in there, children. here code: <?php $this_category = get_the_category(); $child_categories=get_categories( array( 'parent' => $this_category->cat_id,)); foreach($child_categories $category) { $category_url = get_category_link( $category->term_id ); $category_name = $category->cat_name; $category_description = $category->description; ?> <div class="col3"> <img src="<?php echo z_taxonomy_image_url($category->term_id, array(365, 165)); ?>"> <h3><a href="<?php echo $category_url?>"><?php echo $category_name?></a></h3> <p><?php echo $category_description?></p> <a class="view-more" href="<?php echo $catego

Popover en Modal of Bootstrap 3.0.3 -

i have form in modal , when click in "send" must show popover word "thanks you", when click first time, popover not displayed, second time onwards , shows good. my code here $(document).on('submit', 'form#contact',function(event) { $('#submit').popover({ trigger:'click', content: 'gracias por tu opinion', placement: 'left' }); event.preventdefault(); }); jsfiddle : http://jsfiddle.net/gonzalesc/t348e/ something i'm doing wrong, because popover should show first time click thanks what happends is, in first click, or submit, insert popover submit button : $('#submit').popover({ trigger:'click', content: 'gracias por tu opinion', placement: 'left' }); with trigger : 'click' . means, popover shown next time user clicks on submit button. show popover immediately, : $('#submit').popover({ trigger: "manual", content: 'gracias

javascript - Remove TR from Table -

i'm drawning table via php echo, containing data sql query. it's cart script. when customer click remove item cart, want remove tr table. i'll call javascript function 'removefromcart' passing item id , row index. function remove item in cart sql, , row index delete tr table. here how i'm trying do: <?php $uid = mysql_real_escape_string($_session['userlogged']); $query = mysql_query("select id, info cart username = '$uid'"); while($row = mysql_fetch_array($query)) { echo '<tr id="ordertable"> <td> '.htmlspecialchars($row["info"], ent_quotes, 'utf-8').' </td>'; $id = $row['id']; $newquery = mysql_query("select name, date, country, flag, code, med, price products id = '$id'"); while($newrow = mysql_fetch_array($newquery))

random - Actually run a function a certain percentage of the time in PHP -

how can write function in php call given function (anonymous) x% of time? for example: function call_weighted(0.1, function() { echo 'this run approximately 10% of times called'; }); function call_weighted($weight, $function) { if (mt_rand() < $weight * mt_getrandmax()) { $function(); } }

servlets - Reading properties file in Java web application -

i using servletcontextlistener set paths of jsps in web application. paths stored context parameters in web.xml , retrieved listener: @override public void contextinitialized(servletcontextevent sce) { servletcontext sc = sce.getservletcontext(); sc.setattribute("urlofthispage", sc.getinitparameter("urlofthispage")); sc.setattribute("urlofthatpage", sc.getinitparameter("urlofthatpage")); in application servlets, path of particular jsp can retrieved servletcontext . my question relates handling properties file in same way. read lot on other stackoverflow pages 2161045 . am correct in assuming properties file should read listener , stored in servletcontext using property object? if case, how retrieve particular property properties file? at moment using sort of code in servlets value of attribute servletcontext . string url = (string) sc.getattribute("

javascript - jQuery: Group <a> links based on text value -

jquery noob here - needing help. basically, because go's html/template output sucks, i'm forced use more js (which suck at!) i have ordered, not grouped list of links, need grouping "parent folder" links, text value. file/folder tree. the list dynamic, based follows: <div id="files"> <a>file.rb</a> <a>somefile.rb</a> <a>folder</a> <a>folder/level2</a> <a>folder/level2/file.js</a> <a>folder/level2/level3/anotherfile.js</a> </div> so files need grouped parent folder, , folders grouped recursively text in 'a' element. parent 'a' 'folder' , child 'files' within folder. unfortunately, folder , file 'a's can't given separate classes on generation due underlying go script. output expanded directory of folders / files in ordered, not grouped links. re: comment below: example desired output following: http://labs.abea

android - Setting screen time out on the lock screen -

i trying set screen/display timeout on lockscreen programmatically. i.e. time last touch screen off. think may device dependent. able change on 1 phone (jb 4.2.2) settings.system.putint(getcontentresolver(), settings.system.screen_off_timeout, 30000); but isn't working on nexus 5 (kk 4.4.2). no matter do, seems stay @ 10s. any ideas? there separate setting lockscreen? thanks! if app have device admin can set time lock follow this public void setmaximumtimetolock (componentname admin, long timems)

c# - How to modify tiff creation date in .Net -

Image
i writing pdf comparison utility . after some investigation seems best way convert tiff , compare there. i managed ghostscript getting difference in embedded creation date metadata. how use .net modify this? you can use libtiff.net . open source. using library, can use setfield method modify 1 of many tags in tiff file, including tifftag.datetime flag.

java - Bundle getInt only return default value -

i have problem code return default value -1. tried debug, has value don't know why alway return -1. private static final string key_category_id = "category"; bundle bundle = getarguments(); mcategoryid = bundle.getint(key_category_id, -1); this debug value: bundle bundle (id=830037735464) bundle[{category=2}] in activity setarguments in way mfragment = new myfragment(); bundle extras = this.getintent().getextras(); extras.putint("category", 10); mfragment.setarguments(extras); mfragmenttransaction = getsupportfragmentmanager().begintransaction(); mfragmenttransaction.add(r.id.profile_fragment, mfragment); mfragmenttransaction.commit(); in fragment in way bundle bundle = getarguments(); catgory = bundle.getint("category");

javascript - Most efficient way of converting plain text to HTML, Match or Regexp -

i have large text document filled random words, urls, email-addresses etc. example: "word 2014 john@doe.com http://www.example.com/ http://example.com/image.gif ", differently, there linebreaks, multiple spaces, tabs etc. , data fast become huge (it type of bookmarking service data arriving time in form of images, text , hyperlinks). another example of content in text document (the 1 use testing): http://movpod.in/images3/movpod-logo.png https://dt8kf6553cww8.cloudfront.net/static/images/developers/chooser-drawing-vfln1ftk6.png http://xregexp.com/assets/regex_cookbook.gif asd asd ad feaf apa http i want wrap these strings in tags, , able target out images, hyperlinks, emails , strings. have tried different ways unsure best, , also, there regexp not understand. the end result should be: <span>word</span> <span>2014</span> <a class="mail" href="mailto:john@doe">john@doe.com</a> <a class="url"

haskell - Outer Joins with Esqueleto -

i bit confused how outer joins work esqueleto. i have created following query (simplified): select $ $ \(rep `leftouterjoin` event) -> on (rep ^. repatomid ==. event ^. eventatomid ) where_ (rep ^. repatomid ==. val aid) return $ (rep, event ^. eventseconds) as far know, on sql-side, query search reps may have associated event. if not have associated event, event fields (like eventseconds) "null". on haskell side, these should translated maybe seconds (well, ints, idea). so happens when run query , there nothing adjoin rep relation? how deconstruct tuple stick default in? currently, have along lines of: case listtomaybe lrep of ( entityval -> rep , unvalue -> seconds ) -> stuff (note have viewpatterns turned on here). type checks. fails if use (?.) , (frommaybe 3600) . unvalue in pattern analysis. i able fix adding 'just' in right place: select $ $ \(rep `leftouterjoin` eve

jquery - find values in div, compare and color parent container -

i need compare value of .val1 against value .val2. if val1 greater val1 container #benchmark gets background-color red else color green. see done jquery. <div id="benchmark"> score team 1<div id="val1">8</div> score team 2<div id="val2">10</div> </div> correct html <div id="benchmark"> score team 1<div id="val1">8</div> score team 2<div id="val2">10</div> </div> to find value , use $("#val1").text(); //so code : var value1=parseint($("#val1").text()); var value2=parseint($("#val2").text()); if(value1>value2) { $("#benchmark").css('background-color', 'red'); } else { $("#benchmark").css('background-color', 'green'); } demo fiddle

php - Show/hide select values based on previous select choice -

i have 2 select's inside form. second select has 2000 lines in total coming out of mysql table. 1 of column mysql has 1 of values used first select. want able filter on value when selected first select, shows these articles. code now: <div class="rmaform"> <select name="discipline" class="discipline"> <option value="&nbsp;" selected></option> <option value="access">access</option> <option value="inbraak">inbraak</option> <option value="brand">brand</option> <option value="cctv">cctv</option> <option value="airphone">airphone</option> <option value="perimeter">perimeter</option> </select> </div> <div class="rmaform"> <select name="article" class="input-article">

html - PHP contact form giving error -

my basic contact form giving me error "error during sending mail". of course, code below simple , has no protection against spammers or sql injection, main concern @ moment getting message send. thanks in advance given, despite simplicity of question. html: <form action="sendmail.php" method="post"> <table> <tr> <td>name:</td> <td><input type="text" name="name" size="20" maxlength="40" /></td> </tr> <tr> <td>email:</td> <td><input type="text" name="email" size="20" maxlength="60" /></td> </tr> <tr> <td>message:</td> <td><textarea name="message" maxlength="1000" cols="25" rows="6"></texta

javascript - NgSubmit isn't working -

i'm working on web app laravel backend , angularjs frontend. first time in angularjs. here's code login.php <html ng-app="liquor"> <!--head--> <body> <div class="container"> <div class="center-block row"> <div ng-controller="logincontroller"> <form novalidate name="loginform" ng-submit="attempt()"> <div class="form-group"> <input type="text" ng-required="true" ng-model="username" name="username" class="form-control" type="text" placeholder="user name" autofocus="true"/> <input type="password" ng-required="true" name="password" ng-model="password" class="form-control"

spring - What will happen if bean having prototype scope included in bean having singleton scope -

i have class having singleton scope (car) , contain reference of class(steering) having prototype scope.now whenever trying print hashcode of class having singleton scope , class having prototype scope , value of hashcode coming same. car car=(car)ac.getbean("singletonbean"); steering steering=car.getsteering(); system.out.println("singleton obj >"+car.hashcode()); system.out.println("singleton obj >"+steering.hashcode()); car car1=(car)ac.getbean("singletonbean"); steering steering1=car.getsteering(); system.out.println("singleton obj >"+car1.hashcode()); system.out.println("singleton obj >"+steering1.hashcode()); the hashcode of car coming same because same object being returned scope singleton. that's why hashcode of steering coming same because same car object being returned. if steering in prototype scope , hashcode should different ?? thanks what happening reasonable. since there 1 bean

r - Is there a %in% operator across multiple columns -

imagine have 2 data frames df1 <- data.frame(v1 = c(1, 2, 3), v2 = c("a", "b", "c")) df2 <- data.frame(v1 = c(1, 2, 2), v2 = c("b", "b", "c")) here's like, side side: > cbind(df1, df2) v1 v2 v1 v2 1 1 1 b 2 2 b 2 b 3 3 c 2 c you want know observations duplicates, across all variables . this can done pasting cols , using %in%: df1vec <- apply(df1, 1, paste, collapse= "") df2vec <- apply(df2, 1, paste, collapse= "") df2vec %in% df1vec [1] false true false the second observation 1 in df2 , in df1. is there no faster way of generating output - %in%, %in% across multiple variables, or should content apply(paste) solution? i go with interaction(df2) %in% interaction(df1) # [1] false true false you can wrap in binary operator: "%in%" <- function(x, y) interaction(x) %in% interaction(y) then df2 %in% df1 # [1] false true false

c++ - checking if Sign/Encrypt are checked in the Delivery Options of an outgoing email -

i'm writing c++ plugin lotus notes. when user sends email, know whether sign/encrypt options checked in delivery options of outgoing email. i tried use nsfnoteissignedorsealed, supplying handle outgoing note, returns false when sign/encrypt checked. (i guess because email not yet encrypted/signed when plugin called). saw in header file stdnames.h defines item_name_note_forcesign , item_name_note_forceseal, sound promising. how check value of items using handle note? i'm little surprised you're writing notes plugin module without having learned how read text item value document, or @ least without having learned in documentation can go find out how. code below literally cut/paste notes c api users guide, chapter 5-3, reading documents, except i've taken liberty of changing field name constant used in sample code on page match 1 of 2 fields you're looking for. /* sign field within note. */ field_found = nsfitemispresent (note_handle,

java - schedule task with spring mvc -

i want run following method every specific time in spring mvc project works fine , print first output doesn't access database doesn't display list the method public class scheduleservice { @autowired private userdetailservice userdetailservice; public void performservice() throws ioexception { system.out.println("first output"); list<userdetail> list=userdetailservice.getall(); system.out.println(list); } config file <!-- spring's scheduling support --> <task:scheduled-tasks scheduler="taskscheduler"> <task:scheduled ref="scheduleservice" method="performservice" fixed-delay="2000"/> </task:scheduled-tasks> <!-- bean actual work --> <bean id="scheduleservice" class="com.ctbllc.ctb.scheduling.scheduleservice" /> <!-- defines threadpooltaskscheduler instance configurable pool size. --> <task:scheduler id="taskschedu

java - How can I work around this JRE bug in getNetworkPrefixLength()? -

there appears known bug in jre implementation: http://bugs.java.com/view_bug.do?bug_id=6707289 https://bugs.openjdk.java.net/browse/jdk-7107883 but how can fix without updating jre/jdk? need broadcast address, , use getbroadcast() this, returns 0.0.0.0 (because getnetworkprefixlength() returns -1, although real network mask 24).

LocationManager.NETWORK_PROVIDER in API 9 and 10 in Android -

i trying out locationmanager.network_provider api 9 , 10 (2.3 , below 3.0). cannot latitude/longitude values if internet (wireless or data) off? not sure why? it works fine on android 4.0 , more. i using following: locationlistenerfornetwork = new mylocationlistenerfornetwork(); location.requestlocationupdates(locationmanager.network_provider, 0, 0, locationlistenerfornetwork ); private class mylocationlistenerfornetwork implements locationlistener { @override public void onlocationchanged(location loc) { //i required in place.. } } } has had same issue? try making call requestlocationupdates() different parameters. make class implementing locationlistener, googleplayservicesclient.connectioncallbacks , googleplayservicesclient.onconnectionfailedlistener , add methods interfaces ( onconnectionfailed(connectionresult connectionresult) , onconnected() , ondisconnected() ). then, create locationrequest , locationc

ubuntu - Difference between unlink and rm on unix -

whats real different between these 2 commands? why system call delete file called unlink instead of delete ? you need understand bit original unix file system understand important question. unlike other operating systems of era (late 60s, 70s) unix did not store file name actual directory information (of file stored on disks.) instead, unix created separate " inode table " contain directory information, , identify actual file, , allowed separate text files directories of names , inodes. originally, directory files meant manipulated other files straight text files, using same tools ( cat , cut , sed , etc.) shell programmers familiar day. one important consequence of architectural decision single file have more 1 name! each occurrence of inode in particular directory file linking inode, , known. connect file name file's inode (the "actual" file,) "linked" it, , when deleted name directory "unlinked" it. of course, un

Android Studio: Most activity code templates not available -

Image
i have removed , installed android studio 0.5.2, updated jdk's , started scratch after abandoning development while. i have seen there many code templates lot of new videos dealing android studio have; however, don't have them. how them , install them if needed? android studio preview product (not-yet-beta) , under heavy active development. there canary channel releases every week. 0.5.2 released in mid march , other templates see have been added since time. if want switch canary channel , update latest canary build (0.5.9, released last week) can follow directions here so: http://tools.android.com/preview-channel#toc-android-studio-previews

android - How to call onStartCommand multiple times in a test? -

i have following design: public class myservice extends service{ protected logger _log; int _counter; onstartcommand(...){ _log.print (++_counter); } } public class myservicetestwrapper extends myservice{ public void setlog(logger mocklogger){ _logger = mocklogger; } } public class myservicetest extends servicetestclass<myservicetestwrapper>{ public void test_mytest(){ logger fakelogger = mockito.mock(logger.class); // here im not sure how continue... //... //... mockito.verify(fakelogger.write(mockito.any(string.class))).times(3); } } how service instance , make 3 calls onstartcommand? thanks help every time call startservice (even if running), onstartcommand called. so, call 3 times, can write: intent serviceintent = new intent(mainactivity.this, myserivce.class); (int x = 0; x < 3; x++) { startservice(serviceintent); } source: android docs (as shown below) note multiple calls context.startservic

hijri date format to mysql (invalid range) -

here table structure: +-------+----------+------+-----+---------+-------+ | field | type | null | key | default | | +-------+----------+------+-----+---------+-------+ | id | int(11) | no | | null | | | date | datetime | no | | null | | +-------+----------+------+-----+---------+-------+ there query insert date in table: insert tbl_temp set id = 3, date = '1392-01-01'; query run succeeds: here if run query of: insert tbl_temp set id = 3, date = '1392-02-31'; result shows value out of range , how can set column value of date format, here can set column text or varchar data, later need set trigger regarding date need column type date> note: problem , date column has type of date (so in gregorian) take date (0001-01-01) (any) must according date fromat. in application using hijri need insert hijri date (1393-02-31) date not in range of gregorian date) not allow data database. any solution insert date mysql

java - How to create a custom component in JavaFX 8? -

in swing possible create custom components (purely in code) extending jcomponent (or jpanel ), give layout , add components manually , expose invented getters , setters modify set of controls. however unable find how in javafx 8? figure must possible, documentation either doesn't go advanced or comes immediatly fxml, in not interested yet. if helps, want in 1 component: textarea textarea = new textarea(); textfield textfield = new textfield(); borderpane borderpane = new borderpane(); textarea.seteditable(false); borderpane.setcenter(textarea); textfield.addeventhandler(keyevent.key_released, keyevent -> { if (keyevent.getcode() == keycode.enter) { textarea.appendtext(textfield.gettext() + system.lineseparator()); messages.offer(textfield.gettext()); textfield.clear(); } }); borderpane.setbottom(textfield); take @ great video on parleys it shows 3 options: just use custom css if control exists needs different extend la

How can I read png file as binary (0 and 1) in Matlab? -

i can read bmp file binary ( imread('char/c.bmp') => ans=[1 1 0 0 0] ) when comes png files cannot ( imread('char/c.png') => ans=[9 7 7 7 7 2] ) . should convert binary form? use im2bw convert image binary image.

java - Cannot isert data into database - android -

i'm trying insert "favorites" database im getting error in log cat cannot understand. can me solve issue? here code call in activity: private static final string database_create_favorites = "create table " + table_favorites + "(" + category + " text, " + title_en + " text, " + title_fr + " text, " + title_ar + " text," + description_en + "text," + description_fr + "text," + description_ar + "text," + description_ph + "text, primary key (" + category + ", " + title_en + ") );"; public long addfavorite(myobject object) { contentvalues values = new contentvalues(); values.put(category, object.getcategory()); values.put(title_en, object.gettitleen()); values.put(title_fr, object.gettitlefr()); values.put(title_ar, object.gettitlear()); values

vhdl - Split n long bit logic vector to n individual binary values -

i wondering if there method can split n bit long vector example: 10100111 into n individual binary units used later on? i'm trying incorporate method can 8 bit long vector , have 8 led's light depending if n'th value 0 or 1. googling question returns people cutting larger vector smaller ones, if have 16 bits example i'd have make 16 separate variables work using: entity test port ( myvector : in std_logic_vector(16 downto 0); led : out std_logic_vector(16 downto 0) ); end test architecture behavior of test signal led1 : std_logic; ... signal led16 : std_logic; begin led1 <= myvector(0); ... led16 <= myvector(16); led(1) <= '1' when led1 = '1' else '0'; ... led(16) <= '1' when led16 = '1' else '0'; end behavior doesn't seem tidy when needs repeated several times in code. if want declare , assign identifiers different names, have make line each name, since there no loop stat

Notification example on Android's site -

so i'm quite new android , i'm working through of example code off android's site. 1 i'm looking @ called notifying user: http://developer.android.com/training/notify-user/index.html . the example pretty simple, user enters in time in seconds , message, , timer set in background. once time runs out, user notified. so here copy of activity_main.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <textview android:id="@+id/seconds_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margintop="32dp" android:textappeara

java 8 - How do I pass a class to a method in Nashorn? -

one of our scripts has following line, calling method in ant provider: var provider = resource.as(org.apache.tools.ant.types.resources.fileprovider); since updating java 8, fails error: java.lang.classcastexception: cannot cast jdk.internal.dynalink.beans.staticclass java.lang.class @ sun.invoke.util.valueconversions.newclasscastexception(valueconversions.java:461) @ sun.invoke.util.valueconversions.castreference(valueconversions.java:456) @ jdk.nashorn.internal.scripts.script$\^eval\_.getfilehack(<eval>:131) @ jdk.nashorn.internal.scripts.script$\^eval\_.runscript(<eval>:207) i'm trying figure out has changed nashorn docs, isn't particularly clear. following change use see in documented examples gives same error: var provider = resource.as(java.type("org.apache.tools.ant.types.resources.fileprovider")); how convert staticclass java class pass in here? use .class : var provider = resource.as(org.ap

django - how to store registration value in to database? -

i trying store registration value in database getting error. the code below. views.py def car_vw(request): plate = request.post.get("plate_id", ' ') brand = request.post.get("brand_id", ' ') model = request.post.get("model_id", ' ') price = request.post.get("price_id", ' ') condition = request.post.getlist("select_id[]", ' ') queryset1 = car(plate_no=plate, brand=brand, model=model, daily_price=price, condition=condition,) queryset1.save() data = { 'queryset1': queryset1, } return render(request, 'car_registration.html', data) models.py class car(models.model): car_id = models.integerfield(max_length=400, primary_key=true) plate_no = models.integerfield(max_length=400) brand = models.charfield(max_length=400) model = models.charfield(max_length=400) condition = models.charfield(max_length=400) daily_price = mod

java - How can I specify a blanket build config in NetBeans 8? -

Image
as know, in transition between java 7 , java 8. have both java 7 , java 8 jdk installed. in interests of keeping hands-off approach want make java 7 jdk default java build environment. leaving java 8 jdk installed trials, testing, , migration. however @ current time, netbeans 8 insists java 8 is-the default. what i'd set: java 7 default . and specify java 8 on per-project basis until i'm satisfied new build. @ point, imagine change our default java. challenge there's no clear way change default java configuration. this not helped fact "java platform manager"is not part of "options", , lives on tools menu / "java platforms. have been able to ideaj when moving java 6 java 7. using netbeans on project need achieve same end netbeans. clear, i'm comfortable using java 8 netbeans runtime. project builds want specific java 7 target environment. according topic below: in netbeans how change default jdk? , changing netbeans_jd

html - same page anchor Still Not Working on mobile devices -

ok i've been searching answer while , althought there lots of queries along same lines, none of them solving problem. using following code, trying link button section further down page.. <a href="#tour" class="input"><img src="assets/images/seetheapp.png" alt="download app" width="300" height="48" style="margin-bottom: 100px;"></a> calling using.. <a id="tour"></a> works fine on desktop not @ on iphone (even pop options not working) , works on ipad in landscape mode... i'm stumped! it live (pulsatedate.com) need sorted asap. linking existing section/div id rather anchor has been suitable work around in instance. <a href="#page-twitter" class="input"><img src="assets/images/seetheapp.png" alt="download app" width="300" height="48" style="margin-bottom: 100px;"><

Can't write human readable words to file in Python -

i trying build list of words appearing in files in specified directory, , save list file. when try print out of list's positions appears ok (it human readable), after write file see byte-numbers. here code: import os directorylist = ['/users/kuba/desktop/articles/1', '/users/kuba/desktop/articles/2', '/users/kuba/desktop/articles/4'] bigbagofwords = [] directory in directorylist: filename in os.listdir(directory): filename = os.path.join(directory, filename) currentfile = open(filename, 'rt', encoding = 'latin-1') line in currentfile: currentline = line.split(' ') word in currentline: if word.lower() not in bigbagofwords: bigbagofwords.append(word.lower()) currentfile.close() savefile = open('dictionary.txt', 'wt', encoding = 'latin-1') word in bigbagofwords: savefile.write(word) savefile.write('

angularjs - Angular compile template error on local project and jsFiddle, but working fine in Plunker -

i've noticed angular controller growing , have been trying refactor , use directives , services. however, on 1 scenario, trying create directive appears working fine in plunker, seeing following error in local application , in jsfiddle: error: [$compile:tplrt] http://errors.angularjs.org/1.2.8/$compile/tplrt?p0=getemptycells&p1= plunker link: http://plnkr.co/edit/e11za8lkvoptgtqw2hee?p=preview jsfiddle link (error can seen in firebug): http://jsfiddle.net/oampz/8hq3r/14/ directive: app.directive('getemptycells', function () { return { restrict: 'ea', replace: true, template: '<td ng-repeat="emptycell in getemptycells(payments.details.length)" class="empty">no payment</td>', scope: { 'payments' : '=getemptycells' }, link: function (scope, elem, attr) { scope.getemptycells = function (len) { var emptycells = []; (var = 0; < 12 - len; i++)

sql - Django filter multiple columns with a list of tuples -

i have simple model 2 fields: class simple(model) class meta: index_together = true = intfield() b = intfield() i generate sql query tuples of values a,b. e.g. select * simplemodel (a,b) in ((1,1), (4,8), ...) i know how create like: select * simplemodel ((a = 1 , b = 1) or (a = 4 , b = 8)) which logically same, think db has problem when number of possible values big (i using postgresql), query longer it's heavier on network, , harder analyze , read correctly (i.e. use composite index in case). so, question is, can django create query in first form? thanks! yes, only* using where parameter of extra : https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.queryset.extra something should do: simple.objects.extra(where=['(a,b) in %s' % your_list]) *if create custom database type should able define custom operators, so... might able work around it. i'll google bit :)

javascript - PhantomJS Web Server vs Node? -

whats difference here? want create small api queueing jobs, not sure should using. i'm leaning towards using node, understand point of having web server module phantomjs. from phantomjs docs , phantom webserver still experimental , intended manage other phantom scripts , provide interface scripts web. supports 10 concurrent requests. i'd recommend using node if looking general purpose web server.

c# - How to click on all elements with the same class/parametr WatiN -

i using watin dll, have table , in each td have link <a> href =javascript:void(0) </a> ,i case have same href in of them(they dont have class),i need click on them (they open new tr data) ,and save html page,my problem click on of them , can click on first 1 this frame framebody = browser.frame(find.byname("body")); framebody.link(find.by("href", "javascript:void(0)")).click(); but need click on links have "href", "javascript:void(0)" ,i think need use listcollection new in watin , still cant find way this. any ideas how click on links "href", "javascript:void(0)" . you can links inside of frame body below. frame framebody = browser.frame(find.byname("body")); linkcollection links = framebody.link; foreach(link link in links) { if(link.getattributevalue("href").contains("javascript:void(0)")) { link.click(); // todo - add logic here

javascript - IE 11 Full screen issues -

var infullscreen = false; // flag show when full screen var fsclass = document.getelementsbyclassname("imgfullnormal"); (var = 0; < fsclass.length; i++) { fsclass[i].addeventlistener("click", function (evt) { if (infullscreen == false) { makefullscreen(evt.target); // open full screen } else { reset(); } }, false); } function makefullscreen(divobj) { if (divobj.requestfullscreen) { divobj.requestfullscreen(); } else if (divobj.msrequestfullscreen) { divobj.msrequestfullscreen(); } else if (divobj.mozrequestfullscreen) { divobj.mozrequestfullscreen(); } else if (divobj.webkitrequestfullscreen) { divobj.webkitrequestfullscreen(); } infullscreen = true; return; } function reset() { if (document.exitfullscreen) { document.exitfullscreen(); } else if (document.msexitfullscreen) { document.msexitfullscreen();

bash - How to set variables from each line store in file -

i want read file line line , pass first , second fields arguments bash script, iterate next line , same thing. my file pwd.out: /path/dir/name1/date name1 /path/dir/name2/date name2 i have tried following without success: while read line; dir=`awk '{print $1}'`; name=`awk '{print $2}'`; echo "./myprogram $dir somethinghere $name"; done < pwd.out where outputs: ./myprogram /path/dir/name1/date /path/dir/name2/date somethinghere i think somehow $dir getting values lines , $name not being set. what have is: ./myprogram /path/dir/name1/date somethinghere name1 ./myprogram /path/dir/name2/date somethinghere name2 thanks in advance you don't need awk this. read variables in order come, such this: while read dir name ./myprogram $dir somethinghere $name done < pwd.out test see example in echo dir=$dir, name=$name given file: $ while read dir name; echo "dir=$dir, name=$name"; done < pwd.out dir=/pat

html - Date format 'ww' not working in angularjs? -

i trying display week number using 'ww' date formater in angularjs. my code looks this //in directive controller $scope.today = new date(); //in templateurl <span id="weeknumber">week: {{today| date:'ww'}}</span> this doesnt seem work me, can formatter work format types except 'ww' & 'w'. my expected output is: week: 23 instead week: 'ww' am missing here or issue angularjs itself? best regards. i think beneath version 1.3 of angular. 'ww' or 'w' working newest version of angular.

javascript - Canceling an OpenLayers.Map current panTo tween if user begins dragging map -

i've noticed if user drags map before panto function completes, map continue pan in previous pan direction. here's quick jsfiddle high pan duration make effect easy reproduce: http://jsfiddle.net/a8kk4/58/ map.panto( xy ); // code jsfiddle link is there straight forward way cancel current panning event if user begins drag map? i fixed it, though i'm not sure if best way. basically, did put call pantween.stop in map's moveend event, set pantween's callback null, otherwise, loop continues -- see openlayers.tween stop`function here: http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/openlayers/tween.js in summary, added these 3 lines @ end of init function: map.events.register('moveend', map, function(){ this.pantween.callbacks=null; this.pantween.stop(); }); updated fiddle: http://jsfiddle.net/a8kk4/62/

Git- Switched to a new branch but files from other branch still exists Drupal -

cloned git repo server, switched branch in origin. installed bunch of contrib modules committed them new local branch b. wanted work on clean version of origin branch a. created new local branch c origin repo. when try install similar contrib module in fresh local branch c committed in branch b, see module files exist. shouldn't switching branches allow me work on clean fresh copy? also when switch branches origin branch a, still see modules downloaded branch b. since fresh checkout suppose should not see them do? tried reading through various git material not understand whats wrong current setup. any clues? update how installed contrib modules? drush dl how download new modules in drupal. adds new folder current folder structure , related entry in database created new local branches git checkout -b mylocalbranch-b git checkout git checkout -b mylocalbranch why doesn't git remove files when switch branch? summary: files not tracked. solution: swi

Python Regex: Finding files without a certain extension -

i'm trying figure out regular expression use in order search directory , return number of files in directory not have prefix 'abc_'. e.g, in directory files def_notes.txt, abc_notes.txt, ghi_notes.txt, function recognize there 2 files without 'abc_' prefix , return 2. to point, i'm having trouble writing regular expression represent this. i've tried re.compile('^(.(?!(abc_)))*$') found here . however, doesn't seem work. leaving first dot inside parenthesis matches file 'abc_notes.txt'. if remove dot, won't match 'abc_notes.txt', doesn't match 'def_notes.txt'. edit: clarify, i'll use glob or os packages work once figure out expression. i'm using re.compile , search in python shell figure out regex. this code prints out how many files in current directory don't start letter z : import glob, re print len( [path path in glob.glob('*') if not path.startswith

ios - Layout issues with XIB in Xcode 5 (after upgrading app) -

Image
i have worked on application, done 2 years back, using xib's , autosizing . now, i've upgraded app ( in xcode 5 ) & need make changes according iphone 5 (4") , iphone 4, 4s (3.5") i've tried put margin layouts these not making difference. i've created quite few apps before using similar techniques out complication in app, view in iphone4 has black cut @ top , bottom of screen. ![enter image description here][2] this issue not related autosizing . you're missing 640x1136 launch image ( i.e. default-568h@2x.png ). add , app should go full screen. ps : happened me when created ios7 project in xcode 5 , deleted images.xcassets project targets. reference

security - "Harun" Joomla Hack? Please help me securing this website -

one of clients complained cannot log joomla installation anymore. checked database , saw, user names , passwords (md5 value, used rainbowtable check) set "harun". did ever hear that? google doesn't... also: need to (besides changing passwords)? i'm not "big" in web-dev , never faced such problem. any appreciated. clearly have great deal of cleanup do....i hope have database backup! had same kind of thing happen couple of years back, , installed rsfirewall . while attacks still occur, wonderful extension has cut damage 99% us. luck!

symfony - Handling dd/mm/yyyy format in symfon2/Doctrine -

what should happen here this: only dd/mm/yyyy format accepted dob . if different format given " the dob field must have valid format ." message should read on screen but message should coming entity , not form type set ' invalid_message ' attribute. jfyi: can define $dob ' string ' in entity , ' text ' in form type make whole process work not practise. reason don't want varchar field $dob in database, want date field. person entity ( note: place want form validation takes place ): namespace se\hirbundle\entity; use symfony\component\validator\constraints assert; use doctrine\orm\mapping orm; /** * person * * @orm\entity * @orm\table(name="person") * @orm\haslifecyclecallbacks */ class person { /** * @var integer $id * * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @var string $first