Posts

Showing posts from September, 2013

How to convert HTML file into a hash in Perl? -

is there simple way convert html file perl hash? example working perl modules or something? i search on cpan.org did'nt find can want. wanna this: use example::module; $hashref = example::module->new('/path/to/mydoc.html'); after want refer second div element this: my $second_div = $hashref->{'body'}->{'div'}[1]; # or this: $second_div = $hashref->{'body'}->{'div'}->findbyclass('.myclassname'); # or this: $second_div = $hashref->{'body'}->{'div'}->findbyid('#myid'); is there working solution this? html::treebuilder::xpath gives lot more power simple hash would. from synopsis: use html::treebuilder::xpath; $tree = html::treebuilder::xpath->new; $tree->parse_file( "mypage.html"); $nb=$tree->findvalue('/html/body//p[@class="section_title"]/span[@class="nb"]'); $id=$tree->findvalue('/html/body/...

java - Migrated to logback on weblogic, but is not logging -

i running poc see impact of migrating our j2ee applications logback. spent time on official website , apparently, change beside new jars logback.xml file. unfortunatly doesn't enough, deployment works , log file created well, nothing logged (empty). my code has following statements import org.slf4j.logger; import org.slf4j.loggerfactory; private static final logger log = loggerfactory.getlogger(customerservicebean.class); log.debug("test log - customer id " + input.getcustomerid()); pom.xml has following <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>0.9.18</version> </dependency> logback.xml (created using web utility official website) <configuration> <appender name="file" class="ch.qos.logback.core.rolling.rollingfileappender"> <!--see http://logback.qos.ch/manual/appenders.html#rollingfileappender--> ...

c# - Three layers of culture specific resource files -

i need way use third "layer" of culture specific resource file. can possibly done in way should be, , possibly hacked somehow. , long hack isn't big, it's okay! solution possible (if i'm approaching problem wrong, please tell better solution). normally have default resource file, works fallback. on top of can have culture specific resource language. want 'theme' specific resource. the thing have several sites different themes (horses, cars, rc-units, etc.), , when use string localized resource file if resource isn't translated in specific language yet, it'll fallback english default language. cool! a problem example: have phrase "add horse" , "add car" , might seem same (when comes grammar) in english, yet that's not case in polish or romanian! so i'm thinking should, if possible, having english file "add {0}", polish file equivalent sentence in polish, on top of "car" specific polish tra...

powershell - How to use the index property of the DfsrIdRecordInfo WMI class for pagination of WMI queries -

edit: should have posted on serverfault instead? there not dfs-r category on stackoverflow, thought more of scripting\programming question. let me know if should put on serverfault instead. i attempted use dfsridrecordinfo class retrieve files of large (6000 file) dfsr database , getting wmi quota errors. doubling , tripling wmi quotas on server did not solve this. i found looking here index property of class is: "the run-time index of record. value used partition result of large query." sounded wanted, behavior of property not expected. i found when try paging property not retrieve of records per following example powershell. i tested on dfsr database less 700 files not throw quota error. because small database can files in less second: $dfsrfiles = gwmi ` -namespace root\microsoftdfs ` -computername 'dfsrserver' ` -query "select * dfsridrecordinfo replicatedfolderguid = '$guid'...

python - Getting an invalid syntax error -

apologies in advance know simple problem. i'm total beginner python, have decided use write mapreduce doing sentiment analysis. i have taken python file link: http://www.alex-hanna.com/tworkshops/lesson-6-basic-sentiment-analysis/ give me guidance , trying run it. code particular thing have problems is: … if len(sys.argv) &lt; 2: print "usage: avgnreduce.py " sys.exit(0) … the error is: if len(sys.argv) &lt; 2: ^ syntaxerror: invalid syntax i'm assuming basic problem resolve, despite googling don't know how i'm meant fix this. i've tried using colon instead of semi colon , have ensured ampersand correct copying over. ideas? you're looking < operator there instead of lt . ( lt stands less operator in html, see this thread.) if len(sys.argv) < 2: print "usage: avgnreduce.py " sys.exit(0)

Not able to consume Web Service method when using asp.net forms authentication -

one of asp.net page using web service object data database, working fine locally hosted server if not using forms authentication , when use forms authentication method same page, getting following run-time error, error :the request failed error message: -- <html><head><title>object moved</title></head><body> <h2>object moved <a href="%2flogon.aspx%3freturnurl%3d%252fchocolates.asmx">here</a>.</h2> </body></html> i'm using <sessionstate mode="inproc" cookieless="false" timeout="30" /> in web.config, please me answer problem. thank you. did try exclude "chocolates.asmx" forms authentication? example: <location path="path_to_the_file_or_folder"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>

jquery - Flash error from an ajax request in compoundjs -

i trying use flash('error', 'error text') alert webpage error has occurred via ajax request. ajax request hits action database work involved, , error produced. controller: load('application'); action('index', function() { this.title = 'sample page'; render(); }); action('test', function() { flash('error', 'test error message'); render('index', { title: 'sample page' }); }); sample ajax call: $.ajax({ url: '/test-error', success: function(response) { console.log(response); }, error: function(response) { console.log(response); } }); routes: map.get('test', 'test-error#index'); map.get('test-error', 'test-error#test'); is possible through ajax call? i've tried using flash , followed render('index') shown above , have tried redirect(path_to.test); no success. send(500, 'error messag...

function - Invoke-Command powershell trouble -

friend's i've got trouble function, run on remote server, i've got following output : invoke-command : positional parameter cannot found accepts argument '& c:\testnunit\dll\'. @ d:\test\multithread.ps1:65 char:16 + invoke-command <<<< -computername $serv -scriptblock $command ([scriptblock]::create("& $oneproject")) -credential $cred + categoryinfo : invalidargument: (:) [invoke-command], parameterbindingexception + fullyqualifiederrorid : positionalparameternotfound,microsoft.powershell.commands.invokecommandcommand function nunit { ##parse connection parameters $connection = @{"server" = "..."; "username" = "..."; "password" = "...."} $serv = $connection.get_item("server") $user = $connection.get_item("username") $pass = $connection.get_item("password") $securepassword = convertto-securestring -asplaintex...

nvd3.js - How can I manipulate nvd3 Horizontal Multi-Bar Chart values -

i using nvd3.js , multibarhorizontal http://nvd3.org/ghpages/multibarhorizontal.html want change bars' reference on x-axis value , instance value of 10 should represented 10 out of 50. value ---------- x-axis -------------------------------------------------- don't know start from. if understood question looking @ suppose - chart.xaxis.tickformat(function(d) { return d + '/50' }); hope helps.

jquery - Web API controller named Aux -

this might sound silly tried create controller (web api - mvc 4) public class auxcontroller : apicontroller { [httpget] public user getuser() { ... } } when called api via jquery var options = { url: 'api/aux/getuser', type: 'get', datatype: 'json' }; i error. if refactor controller public class audcontroller : apicontroller and use url option: 'api/aud/getuser' it works nicely. and guessed it, if refactor back, doesn't work. is there reason why happens? machine? certain keywords such aux not allowed in url. believe this answer question.

text - Is there a Trigram functionality like pg_trgm (PostgreSQL) for MySQL? -

i created fuzzy search in c# postgresql database using similarity() function pg_trgm module. want port search mysql database, mysql has no similar trigram functionality. is there way import pg-trgm module postgresql in mysql or there similar implementation of trigrams mysql? unfortunately not able find satisfying implementation yet. i reluctant use external search engine solr due effort of installation, maintenance , becoming acquainted syntax , configuration. i know question old, got here google searching , there bit of new information found. as of mysql 5.7.6, there built in support using ngram in full text searches. mysql team article regarding ngram searches

php - Adding frineds with the use of emails stored in the database -

i have been working on add friend system quiet sometime now, when got 1 won't work , don't know why please appreciated <?php session_start(); include('config.php'); if(isset($_post['submit'])){ $user_id = $_get['user_id']; $email = isset($_post['added_id']); $connect = mysql_connect('localhost', 'root', '') or die('error searching host'); $db = mysql_select_db('9jahivemobile') or die('could not find database'); $query = "select * admin email = '".$email."'"; $numrows = mysql_num_rows($query); if ($numrows ==1){ echo 'found!'; $insert = 'insert connected ("adder_id", "added_id") values ("'.$user_id.'" "'.$email.'")'; echo'hooray request have been sent'; ...

Java Collection: what to convert Collection<List<String>> to ArrayList<List<String>> or List<List<String>>? -

i using multimap<string, list<string>> in 1 of api's. values means list of list used .values() method of multimap. method returning me collection<list<string>> . play on index on collection want convert list<list<string>> or arraylist<list<string>> . how cast or convert without building new arraylist , explicit add list values collections arraylist. you can use appropriate constructor: list<list<string>> yourlist = new arraylist<>(yourcollection); the order of elements in list order of iterator of collection.

python - Extract java script from html document using regular expression -

i trying extract java script google.com using regular expression. program import urllib import re gdoc = urllib.urlopen('http://google.com').read() scriptlis = re.findall(r'<script>(.*?)</script>', gdoc) print scriptlis output: [''] can 1 tell me how extract java script html doc using regular expression only. this works: import urllib import re gdoc = urllib.urlopen('http://google.com').read() scriptlis = re.findall('(?si)<script>(.*?)</script>', gdoc) print scriptlis the key here (?si) . "s" sets "dotall" flag (same re.dotall ), makes regex match on newlines. root of problem. scripts on google.com span multiple lines, regex can't match them unless tell include newlines in (.*?) . the "i" sets "ignorcase" flag (same re.ignorecase ), allows match can javascript. now, isn't entirely necessary because google codes pretty well. but, if had poor ...

session - redirect back to previous page php -

i trying redirect user page he/she after successful login not working right me. the problem instead of redirecting previous page redirects account.php.. edit : have session started on page , including file. the main page... index.php <?php include_once("models/config.php"); $_session['page'] = 'index.php'; ?> and here login php.. if(isset($_session["page"]) && is_object($_session["page"])) //check if session exists { //redirect user previous page header("location:".$_session['page']); } else{header("location:account.php");die();} you need add exit or else continue process rest of script. if(!empty($_session["page"])) //check if session exists { //redirect user previous page header("location:".$_session['page']); exit; } else{header("location:account.php");exit;} as christopher morrissey ...

php - Facebook autopost link opens as map on phone -

i cannot find hint of issue anywhere on google. have android , other developer has iphone. use facebook autopost php script autopost links facebook feeds. when open feed via mobile phones opens map first , have click back. happens on phone random things thought phone issue. not happening other posts click on, ours. when create facebook app there setting enables/disables locations or maps may causing issue? the solution particular problem simple. link correct on facebook. page opened on our website had google map in page footer. once removed page, default map application stopped opening first. double check page content!

node.js - Serving socket.io via https -

i got code: var io = require('socket.io').listen(443); var redis = require('redis'); thinking can load socket.io client via https://<my ip>/socket.io/socket.io.js but error ssl connection error it works fine http , port 80. need working serving https? update: i have managed update code, here share community:i socket.io.js served client cant subscription redis channels working quite yet. so here latest code: var https = require('https'); var fs = require('fs'); var socketio = require('socket.io'); var redis = require('redis'); var nclients=0; var nport = 6800; // port of redis server var nhost = "123.123.123.123"; // host running redis server var spass = "mysecretpassword"; var svrport = 443; // port of service var svroptions = { key: fs.readfilesync('/etc/ssl/private/my.key'), cert: fs.readfilesync('/etc/ssl/private/my.crt'), ca: fs.read...

java - Delete fails due to DB exception in updateForeignKeyFieldBeforeDelete -

i using eclipselink , facing issues in delete. have manytoone join below. public class userentity implements serializable { ... @manytoone @joincolumn(name = "student_cd", nullable=false) private studententity student; } while trying delete userentity , getting below exception. [#|2013-08-07t20:44:52.105+0530|warning|glassfish3.1.2|javax.enterprise.resource.jta.com.sun.enterprise.transaction|_threadid=35;_threadname=thread-2;|dtx5014: caught exception in beforecompletion() callback: local exception stack: exception [eclipselink-4002] (eclipse persistence services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.databaseexception internal exception: java.sql.sqlexception: ora-01407: cannot update ("service"."users"."student_cd") null error code: 1407 call: update service.users set student_cd = ? (user_id = ?) bind => [null, 1] @ org.eclipse.persistence.exceptions.databaseexception.sqlexception(databaseexceptio...

excel - Hide subtotals for one of the values in Pivot Table -

the issue in pivot table on excel 2007. in column have year field, , values sum of amount, , max of date. max of date value doesn't need subtotals of grand totals. there way omit totals on on of value fields, , not other? eg: 2013 2014 date amt date amt grand totals amt comp1 1/1/01 12 1/2/01 10 22 comp2 1/3/02 15 1/3/02 5 20 totals 27 15 a hack: hide date total column , format date grand totals row same colour font highlighting.

vba - Output/Print variable, in code, in if statement -

i trying achieve following: user shown excel spread sheet list of assumption can change. title | value | input01 | 10 | = input02 | 2 | >= input03 | 800 | >= input04 | 4 | >= input05 | 2 | <= there if .. then statement pulls in data if assumption met. if assumption blanc, should not included in if .. then statement. if x = input01value , y >= input02value _ , z >= input03value , >= input04value _ , b <= input05value user ommits input03 if x = input01value , y >= input02value _ , >= input04value , b <= input05value now check see if each value exist, , follow if statement appropriate variables. seems bit redundant. i wondering if following possible: input 01 = "" if input01value != "" input01 = "x = " & input01value 'then use join or similar join of them .. and use input01 direct...

Selenium IDE with XPath to identify cell in table based on other column -

please take @ snippet of html below: <tr class="clickable"> <td id="7b8ee8f9-b66f-4fba-83c1-4cf2827130b5" class="clickable"> <a class="editlink" href="#">single</a> </td> <td class="clickable">£14.00</td> </tr> i'm trying assert value of td[2] when td[1] contains "single". i've tried assorted variants of: //td[2][(contains(text(),'£14.00'))]/../td[1][(contains(text(),'single'))] i've used similar notation elsewhere - no avail here... think it's down td[1] having nested element, not sure. can enlighten i'm getting wrong? :) cheers! what about: //tr[contains(td[1], "single")]/td[2] first select <tr> containing <td> matching text, , select td[2] . then, contains(//tr[contains(td[1], "single")]/td[2], "£14.00") should return true . or, closer expression trie...

android - UI Layout Issues -

first let me attempt layout trying accomplish here. edittext edittext searchbutton listview (search result. there can one, listview adapter , height of wrap_content seems work this, there button add result listview below. once add button clicked listview collapses, after) textview (label objects added) listview (list of objects added, again i'm using adapter list row layout) savebutton i going paste code have there go through. issues having listviews. basically, listview contains objects added end pushing savebutton off of screen. have tried ton of solutions laid out on , many other sites don't seem work right. basically, want savebutton @ bottom , don't want pushed off screen when listview gets big. solution have found "work" explicitly set height of listviews. however, causes problems when going tablet phone (nexus7 & galaxy s3). thought using dip sizes prevent happening apparently not. if has strategy creating type of layout great. ...

c# - If I have multiple users on my site at the same time, how do I keep their sessions separate? -

i have created web application , upload on iis(6.1), i'm facing issue, since uploaded onto iis. in application authentication of user done through ad (active directory) group. when user "a" logs application works fine , home page shows welcome message "welcome user : a", problem occurs when user "b" logs application. when user "b" logs in, , user "a" refreshes page, home page of user "a" shows welcome message "welcome user : b". note both users on physical different machines. can me in issue? here code : when login page loads, following code executes : protected void page_load(object sender, eventargs e) { _txtpassword.focus(); lb_errormsg.visible = false; try { if (!page.ispostback) { loghelper.logger.info("load login page."); loghelper.logger.info("get employee id , domain variables...

jquery - Hide a class if the text in another class contains . . . -

i working form has multiple steps, hide span of text has class .newtest applied if class, .regcurrent contains text "step 1 selection". <ol class="steps"> <li class="regcurrent">step 1 selection</li> <li class="notcurrent">step 2 selection</li> <li class="notcurrent">step 3 selection</li> </ol> <div class="singlecol"> <span class="newtest"> <h1>some text</h1> <p>some more text</p> </span> <p>some text , tables</p> </div> what have tried: <script> $(document).ready(function() { if( $('.regcurrent:contains("step 1 selection")') { $('.newtest').hide(); } }); </script> you have use length selector in condition, other wise wont false jquery object event when selector not return object. missed closing parenthesis of in condition. live demo $(document).rea...

osx - Fork loop installing Ruby 1.9.3 using RVM on OS X 10.7 -

when trying use rvm install ruby 1.9.3 on os 10.7 mbp, infinite loop tries find ruby install: $ rvm system $ rvm install 1.9.3 searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-1.9.3-p448. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p247. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary rubies, might take time. no binary rubies available for: osx/10.7/x86_64/ruby-2.0.0-p247. continuing compilation. please read 'rvm mount' more information on binary rubies. warning! requested ruby installation requires ruby available - installing 1 first. searching binary r...

c# - What algorithm can I use to recursively load an entire directory, starting from a specified path? -

i'm building custom file dialog, , problem taking long load. the dialog begins initialdirectory property, , looking find way load directory tree initialdirectory first, followed rest of directories in background thread. for example, if initialdirectory c:\users\user12345\mydocuments , should load folders in c:\ c:\users c:\user12345 c:\users\user12345\mydocuments then kick off background thread load remaining directories. is there fast , easy way use recursion load first initialdirectory , else, without duplicating items? i'm struggling find high-performing way this, since checking existance of folder code if (!directory.contains(f => f.fullname == folder.fullname)) slows down load quite bit. my current code load full directory looks this: private void loaddirectory() { string root = @"c:\"; var rootnode = new directorymodel() { name = root, fullname = root }; this.directory.add(rootnode); directoryinfo info = new directory...

c - Including a header with code::blocks -

so, i've created c project in code::blocks. in beginning contains main.c file. i've added c++ class (gobject c) dividing project src , include folders, changed extension in cpp file c. when try compile gives me message: fatal error: /home/user/project_name/src/a.h: no such file or directory so, class name a: path header : include/a.h path definition : src/a.c code a.c (i've tried include "/include/a.h" , include "include/a.h" without result) #include "a.h" code a.h #ifndef a_h #define a_h #endif how can solve problem? i've tried include a.h in main.c (without result :( ) when include file in c, c preprocessor default can search in 2 places: 1) #include <stdlib.h> - stdlib.h searched in compiler's include search path 2) #include "mylib.h" - mylib.h searched in current directory (unless traverse directories) you should try doing #include "../include/a.h" inside of src...

functional programming - Why doesn't outer work the way I think it should (in R)? -

prompted @hadley's article on functionals referenced in answer today , decided revisit persistent puzzle how outer function works (or doesn't). why fail: outer(0:5, 0:6, sum) # while outer(0:5, 0:6, "+") succeeds this shows how think outer should handle function sum : outer <- function(x,y,fun) { mat <- matrix(na, length(x), length(y)) (i in seq_along(x)) { (j in seq_along(y)) {mat[i,j] <- fun(x[i],y[j])} } mat} > outer(0:5, 0:6, `+`) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0 1 2 3 4 5 6 [2,] 1 2 3 4 5 6 7 [3,] 2 3 4 5 6 7 8 [4,] 3 4 5 6 7 8 9 [5,] 4 5 6 7 8 9 10 [6,] 5 6 7 8 9 10 11 ok, don't have indices aligned example, wouldn't hard fix. question why function sum should able accept 2 arguments , return (atomic) value suitable matrix element, cannot when passed base::outer functi...

iphone - Keep UIScrollView in correct place after switching from landscape to portrait -

i have uiscrollview contains text field , text view. have code move text fields when keyboard present keyboard not cover text fields. code works great in portrait view: -(bool)textfieldshouldreturn:(uitextfield *)textfield { if(textfield) { [textfield resignfirstresponder]; } return no; } -(void)textfielddidbeginediting:(uitextfield *)textfield { if (textfield == self.namefield) { [uiview beginanimations:nil context:null]; [uiview setanimationdelegate:self]; [uiview setanimationduration:0.3]; [uiview setanimationbeginsfromcurrentstate:yes]; self.view.frame = cgrectmake(self.view.frame.origin.x, (self.view.frame.origin.y - 90), self.view.frame.size.width, self.view.frame.size.height); [uiview commitanimations]; } } -(void)textfielddidendediting:(uitextfield *)textfield { if (textfield == self.namefield) { [uiview beginanimations:nil context:null]; [uiview setanimationdelegate:self];...

knockout.js - Knockoutjs Options Binding with JSON data? -

i trying list options select tag server of knockout options binding. have php page returns json data pushed knockout observable array binded select tag. somehow not working, please refer following code reference: html: <div class="form-group"> <select class="form-control"> <option data-bind="options: country_names, optionstext: 'country_name'"></option> </select> </div> javascript: $(document).ready(function(){ function appmodel(session_info){ /* session info related bindings commented working fine */ var self = this; this.country_names = ko.observablearray(); // bindings related batch processing $(function(){ $.ajax({ url:"../api/master_list.php", type:"get", data:{mastertype: '1'}, cache:false, success:function(country_l...

Phonegap Build facebook Connect Plugin (android) -

i have strange problem using facebook plugin phonegap build. sounds certificate problem can't figure out. i tried sample code found here : github.com/amirudin/pgb-fbconnect i followed instructions in readme.md file. when first start android app , when click on "login" button, works fine , can connect myself facebook app. now, hit logout button. ok again, works. but if hit login button again, have facebook error message : "invalid android_key_parameter. key xxxxxxxxxxxxxx not match allowed key." but xxxxxx key in message not correspond key i've put in facebook app config panel. i have little video of problem here : dropbox video i don't understand why works fine during first login , fail during second 1 .... seems second time, signature change. help!! i created github repo if want test it. have change app_name , app_id in config.xml , app_id in index.html it's frustrating have "almost" works. did succeed in repr...

c# - Handling data between multiple Forms -

i working on program generates pdf file. before final generation of file, want give user option edit portion of file (the title of graph created). want show in new form when user clicks button export pdf. here outline of trying do... private void button4_click(object sender, eventargs e) // test pdf code! { form2 newpdf = new form2(chart3.titles[chart3.titles.indexof("header")].text.tostring().substring(0, chart3.titles[chart3.titles.indexof("header")].text.tostring().length - 4)); newpdf.show(); if (newpdf.selected == true) { // create pdf, open save file dialog, etc } } and here form being opened button click... public partial class form2 : form { public bool selected { get; set; } public string graphname { get; set; } public form2(string filename) { initializecomponent(); textbox1.text = filename; graphname = filename; ...

android - ListView in SlidingUpPanel is not scrollable -

i use library, https://github.com/umano/androidslidinguppanel , , put listview inside, not work, no scrolling, why? not listview, entire layout not roll, nor textview, nor image, nothing. here xml code: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".detalhe_linha" <com.sothree.slidinguppanel.slidinguppanellayout android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:id="@+id/textview1" android:layout_width="wrap...

Convert Excel worksheet coordinates to screen coordinates -

given xy coordinates shape on excel worksheet, relative worksheet, how convert them xy coordinates screen? use window.rangefrompoint method. see here more details. shows xy coordinates shapes. use window.pointstoscreenpixelsx , window.pointstoscreenpixelsy methods.

vba - Checking for condition before continuing on a form -

i using excel 2011 mac. have userform contains 3 combo boxes. data in combo boxes populated information spreadsheet. initialization populates combo boxes. have button initiates processing of data. in first step of process, check user has not inadvertently pressed button: if (cmbstage.text = "") or cmblowdt.value = "" or cmbhighdt.value = "" msgbox "you not ready begin processing!", vbokonly cmbstage.text = "" cmblowdt.value = "" cmbhighdt.value = "" else end if this checks if users hasn't filled in anything. problem if add goto command , have check start again, since called function button click, loop through message again , again. what want check condition, if exists, have user start on if had not pushed button. essential part of process comes after lengthy processing point. if cannot put full screen message says: " complete idiot , should not allowed anywhere near computer balance of n...

c# - How to correctly update entity? -

hello have next code update entity in data base: public async void updateproductfrommodel(producteditmodel model) { var res = await getproduct(model.goodid); mapper.map<producteditmodel, goods>(model, res); updateproduct(res); } public void updateproduct(goods product) { try { using (var dbctx = new smartbags_storeentities()) { dbctx.entry(product).state = entitystate.modified; dbctx.savechanges(); } } catch (exception ex) { throw ex; } } public async task<goods> getproduct(int id) { try { var dbctx = new smartbags_storeentities(); return await dbctx.goods.firstordefaultasync(d => d.goodid == id); } catch (except...

How to resample time vector data matlab -

i have resample following cell array: dates = '2004-09-02 06:00:00' '2004-09-02 07:30:00' '2004-09-02 12:00:00' '2004-09-02 18:00:00' '2004-09-02 19:30:00' '2004-09-03 00:00:00' '2004-09-03 05:30:00' '2004-09-03 06:00:00' following irregular spacing, e.g. between 1st , 2nd rows there 5 readings, while between 2 , 3rd there 10. number of intermediates 'readings' stored in vector 'v'. so, need new vector intermediate dates/times in same format @ dates. edit: there's 1h30min = 90min between first 2 readings in list. 5 intervals b/w them amounts 90 mins / 5 = 18 mins. insert 5 'readings' between (1) , (2), each separated 18mins. need dates. any ideas? thanks! you can interpolate serial dates interp1() : % inputs dates = [ '2004-09-02 06:00:00' '2004-09-02 07:30:00' '2004-09-02 12:00:00' '2004-09-02 18:00:00' '2004-09-02 19:30:00' ...

numpy - Term document matrix and cosine similarity in Python -

i have following situation want address using python (preferably using numpy , scipy ): collection of documents want convert sparse term document matrix. extract sparse vector representation of each document (i.e. row in matrix) , find out top 10 similary documents using cosine similarity within subset of documents (documents labelled categories , want find similar documents within same category). how achieve in python ? know can use scipy.sparse.coo_matrix represent documents sparse vectors , take dot product find cosine similarity, how convert entire corpus large sparse term document matrix (so can extract it's rows scipy.sparse.coo_matrix row vectors)? thanks. may recommend take @ scikit-learn ? regarded library in python community simple consistent api. have implemented cosine similarity metric. example taken here of how in 3 lines of code: >>> sklearn.feature_extraction.text import tfidfvectorizer >>> vect = tfidfvectorizer(min_...

delphi - Registration of different versions of same ActiveX -

i´m struggling best design activex control in regards registration , reference. one part of our software based on activex controls used on internet explorer , referenced guid, , activex control make connection server , data (live images) it. the problem i´m facing everytime update server version have change version of activex controls because there new codes client, so, activex of version 6.3 example not connect 6.4 server , must updated the thing that, best design have different versions of same activex registered on machine? should change guid of activex every new version??? i have searched lot , couldn´t find satisfactory, , can´t use registration-free com because activex control meant used inside internet explorer

ios - UICollectionViewCell with rounded corners AND drop shadow not working -

i want uicollectionviewcells have rounded corners , drop shadows have run problem seems can have 1 or other, not both. to round corners use code in initialization of cell: calayer *layer = [self layer]; [layer setcornerradius:4]; [layer setrasterizationscale:[[uiscreen mainscreen] scale]]; [layer setshouldrasterize:yes]; to add drop shadow use code in initialization of cell: calayer *layer = [self layer]; [layer setmaskstobounds:no]; [layer setrasterizationscale:[[uiscreen mainscreen] scale]]; [layer setshouldrasterize:yes]; [layer setshadowcolor:[[uicolor blackcolor] cgcolor]]; [layer setshadowoffset:cgsizemake(0.0f,0.5f)]; [layer setshadowradius:8.0f]; [layer setshadowopacity:0.2f]; [layer setshadowpath:[[uibezierpath bezierpathwithroundedrect:self.bounds cornerradius:layer.cornerradius] cgpath]]; to try , have rounded corners , drop shadow use code in initialization of cell: calayer *layer = [self layer]; [layer setmaskstobounds:no]; [layer setcornerradius:4]; [layer...

Strange SVN behavior (missing files) when using depth immediates followed by depth infinity -

alright, have strange 1 pick brains about. repository: revision 0: empty revision 1: dir1/f1.txt revision 2: dir1/f1.txt , dir1/f2.txt , dir2/f3.txt your typical, right? now strangeness. svn 1.6.5 , 1.6.13 alike. i'm not going able upgrade try rid of this. i'm running these commands in working copy root. commands svn update -r1 - update revision 1 successful, working copy looks good. svn update --depth immediates - good, dir2 gets created , empty, no other changes. svn update dir1 --set-depth infinity - svn says ok, dir1/f2.txt won't pop in working copy. svn update - cause i'm getting anxious - nothing, dir1/f2.txt still wont pop up. svn update -r1 - error: dir1/f2.txt not under version control (whoa?) svn update - dir1/f2.txt in. if knows why dir1/f2.txt refuses appear when run step 3 , what, if anything, doing wrong, please share. this has been confirmed bug in svn 1.6. resolution upgrade svn 1.7 or svn 1.8. fro...

Rails checkbox validation error -

i'm running validation error on checkbox field ( perishable can't blank ) when check box unchecked. can check logs , see "perishable"=>"0" gets passed when unchecked, , "perishable"=>"1" when checked. "perishable" white-listed in controller, , works when checkbox checked. what's going on here? model: class product < activerecord::base validates_presence_of :perishable end migration: class createproducts < activerecord::migration def change create_table :products |t| t.boolean :perishable, :null => false end end end view: = f.label :perishable = f.check_box :perishable rendered view: <label for="product_perishable">perishable *</label> <input name="product[perishable]" type="hidden" value="0" /> <input id="product_perishable" name="product[perishable]" type="checkbox" value="1...

java - How to include local dependencies in my ant build -

at present have following build.xml: <project name="bccn" default="help" basedir="."> <!-- define properties used build --> <property name="app.name" value="bccn" /> <property name="app.version" value="0.1-dev" /> <property name="tcserver.home" value="/home/abhishek/tomcat" /> <property name="work.home" value="${basedir}/work" /> <property name="dist.home" value="${basedir}/dist" /> <property name="src.home" value="${basedir}/src" /> <property name="web.home" value="${basedir}/web" /> <property name="lib.dir" value="${basedir}/lib" /> <target name="help"> <echo>you can use following targets:</echo> <echo> </echo> <echo> : (default) prints message </echo> <...