Posts

Showing posts from June, 2014

haskell - How to set undefine function in ghci -

i'm developing program in haskell , debug i've created file functions. few functions declarate how "underfined" , i'd set these function in interpreter (ghci). for example: r :: [string] r = undefined after loading file in ghci (:load experimental.hs), use following command: let r = "example string" but have next exception: "*** exception: prelude.undefined can declarate in ghci function, in source file (.hs) underfined? or maybe exists other solutions? it not possible, because breaks referential transparency: after "setting" function result of other function different. (you might argue undefined raising exception clear enough safe, need way make sure no function proper first definition redefined... it's not worth hassle.) the correct way make undefined value explicit argument of function uses it. can change argument when invoking function interpreter.

python - Applying variable transparency to an image in java -

Image
i'm wondering how apply variable mask image's transparency in java (presumably using buffered image). so, instance, want apply mask such following: to image such following: in order get: it's important transparency changed gradient, not color, because want able to kind of thing: i've found incredibly slow way of achieving going through , setting transparency value of every single pixel manually, said, it's super slow. should looking @ try accomplish this? or should doing in java? i've been getting know python recently, if thinks it's better try sort of thing particular python module, useful information well. thank in advance! here 1 way transparent mask. gradientmask.java: import utilities.*; import javax.swing.*; import javax.imageio.*; import java.awt.*; import java.awt.image.*; import java.io.*; public class gradientmask { public static void main(string[] args) throws exception{ jframe main = new jframe(...

microsoft dynamics - CRM 2011 : Permission denied error on reloading the Parent page from child page -

i trying reload parent page child page on save. using below code refresh it. window.parent.opener.location.reload(true); this code working fine first time save child record. if staying on same child page , modified on page saving record. getting error permission denied. this error coming because, in code "window.parent.opener.location.reload(true)" not able find location value. the location value coming {...}. any appreciable. once opener refreshed child handle void. around need stable none refreshing opener or parent. if parent window has opener or it’s iframe has stable parent can use hold reference first , second level windows. i.e. opener 1 / parent 1 (none refreshing) -> opener 2 (your parent) -> child window (crm form) after each window reloaded / refreshed can go opener 1 re-connect windows.

python - Does the SVM in sklearn support incremental (online) learning? -

i in process of designing recommender system text articles (a binary case of 'interesting' or 'not interesting'). 1 of specifications should continuously update changing trends. from can tell, best way make use of machine learning algorithm supports incremental/ online learning . algorithms perceptron , winnow support online learning not support vector machines. scikit-learn python library support online learning , if so, support vector machine 1 of algorithms can make use of it? i not tied down using support vector machines, go algorithm binary classification due round performance. willing change whatever fits best in end. while online algorithms svms exist, has become important specify if want kernel or linear svms, many efficient algorithms have been developed special case of linear svms. for linear case, if use sgd classifier in scikit-learn hinge loss , l2 regularization svm can updated online/incrementall. can combine feature transforms appro...

apache - Forbidden, no permission on server htaccess -

i put site online when go url error: forbidden you don't have permission access / on server. i think there wrong in htacces file... think has got in file <filesmatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$"> require granted satisfy </filesmatch> is correct or need more info htacces file? # apache server configs v1.1.0 | mit license # https://github.com/h5bp/server-configs-apache # (!) using `.htaccess` files slows down apache, therefore, if have access # main server config file (usually called `httpd.conf`), should add # logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. # ############################################################################## # # cross-origin resource sharing (cors) # # ############################################################################## # ----------------------------------------------------------------------------...

.net - RESTFUL wrapper for Windows Azure Mobile services -

i pretty new windows azure mobile services (wams) , want started once doubts cleared. understand, can build service layer on cloud support data storage, authentication, push notifications etc. service layer , features offers can used multiple mobile platforms including windows phone, windows store, android, ios , on. however, whatever material i've read, in order use service layer, sdk corresponding mobile technology have used. e.g. in order android app use service layer, android sdk wams have used. also, basic logic (excluding server side scripts) perform operations/call methods on wams have written in android. same case other platforms. thus, though have cloud layer, considerable logic still have written in native platforms. better instead have restful service wrapper on wams implementation in .net can consumed platforms without me requiring using individual sdks? wams supposed use when data storage in azure. rest api standard layer talk backend/data. android, ios...

javascript - fixed div overlaps scrollbar -

i have problem fixed div placed in other div scrollbar. overlaps scrollbar. happend under safari , ie 11. when set z- index lower divs scrollbar fixed div under , losses interaction (you cant click links etc).also tried make fake fixed position setting absolute , javascript set "left" "scrollleft" div scrollbar cant use solution because gives strange effects under safari , ie10. here code: html <div id="cont"> <div class="spacer s2"></div> <div id="target" class="box2 blue"> <a href="dfsdfsd">dsfsdf</a> </div> </div> css #cont { width:100%; height:800px; overflow:hidden; overflow-x: scroll; z-index:0 } #target { width:200px; height:800px; position:fixed; overflow:hidden; background-color:red; z-index:0 } .spacer { width:3000px; height:1px; z-index:-1 } and link jsfiddle . please me ive ...

percona - How come I still get deadlocks even after setting wsrep_retry_autocommit really high? -

i have cluster of 3 percona xtradb 5.5.34-55 servers , since writable, deadlock errors under substantial load. increasing wsrep_retry_autocommit variable helped extent, er_lock_deadlock did not disappear completely. i've tried setting wsrep_retry_autocommit 10000 (seems maximum), thinking make queries slow, none of them fail er_lock_deadlock : mysql-shm -ss -e 'show global variables "%wsrep_retry_auto%"' wsrep_retry_autocommit 10000 ------------------------ latest detected deadlock ------------------------ 140414 10:29:23 *** (1) transaction: transaction 72d8, active 0 sec inserting mysql tables in use 1, locked 1 lock wait 2 lock struct(s), heap size 376, 1 row lock(s), undo log entries 1 mysql thread id 34, os thread handle 0x7f11840d4700, query id 982 localhost shm update replace metric(host, name, userid, sampleid, type, priority) values ('localhost','cpu-3/cpu-nice',8,0,0,0),('localhost','cpu-3/cpu-system',8,0,0,0), ...

grails: table not found when using tomcat and jndi -

using datasource.groovy works. when switch using jndi on tomcat war, get: 2014-04-14 12:16:19,244 [localhost-startstop-1] error util.jdbcexceptionreporter - table "report" not found; sql statement: select [...] report this_ this_.name=? [42102-173] this looks connecting db ok, cant see table, bazaar. working config in datasource.groovy (when run without tomcat): development2 { datasource { url = 'jdbc:mysql://localhost/rep' username = "root" password = "" dialect = org.hibernate.dialect.mysql5innodbdialect pooled = true jmxexport = true dbcreate = "update" driverclassname = "com.mysql.jdbc.driver" properties { maxactive = -1 minevictableidletimemillis=1800000 timebetweenevictionrunsmillis=1800000 numtestsperevictionrun=3 testonborrow=true testwhileidle=true t...

Spacing between image in HTML table -

i wasting lot of time doing simple thing: i want show image , want show same image under previous one. i've put 2 image in table, have strange space under image. this simple code: <!doctype html> <html> <head> <link href="style_new.css" rel="stylesheet" type="text/css"> </head> <body> <?php echo "<table class=\"top\">"; echo "<tbody>"; echo "<tr><td class=\"t_top\"><img src=\"try.png\" vspace=\"0px\"/></td></tr>"; echo "<tr><td class=\"t_top\"><img src=\"try.png\" vspace=\"0px\"/></td></tr>"; echo "</tbody>"; echo "</table>"; ?> </body> </html> and relative style sheet: table.top { border-spacing:0px; border:0px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; border-...

c - COM Reference Count -

good day. what proper way initializing com interface reference count ? i see many examples, reference count initilialized 1 , see examples 0 set. what diffirence ? you have set such way when last release() called object takes care of itself. means when create object must have reference count of 1 right before handle object pointer caller asked object. whether initialize reference counter 0 , call addref() (before handle pointer on caller) of initialize 1 , not call addref() you.

Jenkins continuous integration and nightly builds -

i’m new jenkins , (reassurance) how think should setup jobs. the end goal simple. objective 1: when developer commits code mercurial repo jenkins pulls changes, builds project , runs unit tests. happens continuously throughout day developers earliest possible feedback if break something. objective 2: nightly, jenkins pulls last stable build above , runs automated ui tests. if tests pass publishes nightly build somewhere. i have job configured achieves objective 1 i’m struggling objective 2. (not publishing part, idea of seeding job last stable build of objective 1). at moment, i’m planning use branches in hg repo implement this. my branches main >> int >> dev. the job in objective 1 work on tip of dev branch. if build succeeds , tests pass commit int branch. the job in objective 2 work on tip of int branch. is how it’s done? i’ve been looking at/considering: - plugins promoted builds , copy artifacts - parameterised builds - downstream jobs im...

java - Accessing Log4j2 logs within an external .jar -

i'm using java reflection run code that's inside .jar file. however, should not modify contents of file, have use .jar is. debugging tricky (because obfuscated inside it), thought might idea have @ logger. i not find documentation directly relevant case, , honest i'm little confused whether or not possible. here's log4j2.xml within .jar's root: <configuration status="warn" packages="net.minecraft,com.mojang"> <appenders> <console name="sysout" target="system_out"> <patternlayout pattern="[%d{hh:mm:ss}] [%t/%level]: %msg%n" /> </console> <queue name="serverguiconsole"> <patternlayout pattern="[%d{hh:mm:ss} %level]: %msg%n" /> </queue> <rollingrandomaccessfile name="file" filename="logs/latest.log" filepattern="logs/%d{yyyy-mm-dd}-%i.log.gz"> <patternlayout pa...

unix - how to extract rows in a big table based on a list file containing the specific names in linux -

i have big data table (datatable.txt), snapshot below: snpname chr position sample1 sample2 sample3 sample4 ....sample2000 rs1 1 1000 a b b ..... rs2 2 1500 b b ..... b rs3 3 1503 b b a ..... . . . . rs99999 22 999999 a ...... b and have list of snpnames want include in output table (other snpnames not in list excluded). list (list.txt) below: rs4560 rs4780 rs6 rs798 rs2634 rs987 rs1839 rs3948 rs2423 rs232 how can produce new output table contains snpnames listed in list file? please advise, thank you. :) you can use example this: grep -wff list.txt datatable.txt -w matches words. -f gets patterns file list.txt . -f compares strings such, not possible regular expressions. based on sample input, , changing rs3 rs6 have match, get: $ grep -wff list.txt datatable.txt rs6 3 1503 b b a .....

mysql - Join three tables with JOIN and HABTM association -

Image
i have 3 table items, characteristics, item_to_characteristics item_to_characteristics middle table keeps habtm association between 2 tables (items <-> characteristics). item table has id|title|description characteristic table has id|name|pic_path item_to_characteristic has id|item_id|characteristic_id so example: item id 25 want find characteristics. table item_to_characteristics looks this: so see item_to_characteristic hold id of item , characteristics. this query have writen far doesent return want, select item_characteristics.name, item_characteristics.icon_path item_characteristics, item_to_characteristics itch inner join items on items.id=itch.item_id items.id=25; the query should return 5 rows. you have cross joined table item_to_characteristics why getting more rows expecting. instead should inner join item_to_characteristics select ic.name, ic.icon_path item_characteristics ic inner join item_to_characteristics itch ...

android - Link to Nokia X app -

we're porting our android apps nokia x, , link apps have in store. not find resources on linking these apps on google play market://?details or amzn://apps/android on amazon. how can on nokia x? default solution market:// not work. says activity not found exception in emulator (i don't have real nokia x here unfortunately) according tutorial, market:// uri should work. http://developer.nokia.com/community/wiki/deep_linking_to_store_on_nokia_x you should open below: intent intent = new intent(intent.action_view); intent.setdata(uri.parse("market://details?id=com.nokia.app.mixradio.client")); startactivity(intent);

android passing 2000 size array from one activity to another -

i need pass 3 arry size approx 2000 3000 + string each... possible? getting large transaction error i need intent = new intent(getactivity(), test_my_paging_activity.class); i.putextra("string-array", android_img_array); i.putextra("string-array_id", array_id); i.putextra("string-array_thumb", array); // getactivity().finish(); startactivity(i); bundle b = this.getintent().getextras(); array = b.getstringarray("string-array"); array_id = b.getstringarray("string-array_id"); array_thumb = b.getstringarray("string-array_thumb"); i don't know usage of these arrays, but, may implement singleton storage class , , read 3-arrays in second activity.

ios - Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195' from server side -

i'm working on mac app use ios push notifications. want send notification php script on server. code in app works registering remote notification , receive them. use php script send notification , works too: <?php // device token here (without spaces): $devicetoken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // private key's passphrase here: $passphrase = 'myprivatekeypassword'; // alert message here: $message = 'new push notification!'; //badge $badge = 1; $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); // open connection apns server $fp = stream_socket_client( 'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, stream_client_connect|stream_client_persistent, $ctx); if (!$fp) exit("failed connect: $err $errstr" . php_eol); ech...

servlets - Phonegap FileUpload Java Server -

i trying upload image on java server.the file trnsfering android device saving null on server . here server code public uploadmediaserverresponse uploadfileforfunboard(@formdataparam("photopath") inputstream photoinputstream, @formdataparam("photopath") formdatacontentdisposition photofiledetail, @formdataparam("userid") int userid, @formdataparam("mediatype") string mediatype, @formdataparam("title") string title,@formdataparam("funboardid") int funboardid) { mediacontenmodel mediacontenmodel = new mediacontenmodel(); mediacontenmodel.setfunboardid(funboardid); mediacontenmodel.setmediatype(mediatype); mediacontenmodel.setuserid(userid); uploadmediaserverresponse uploadmediaserverresponse = new uploadmediaserverresponse(); boolean ismediaprocessedanduploaded = true; string mediaprocessingerror = ""; if ...

Multiple Count Statements in a single stament on a same table in sql -

how combine these 2 queries single query ? tried various options none of them worked. sql> select count (*) tab_proclog_cso ( to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') ); count(*) ---------- 28328 sql> select count (*) tab_proclog_cso ( to_char(starttime, 'yyyymmddhh24miss') between('20130709010000') , ('20130709020000') ); count(*) ---------- 14997 select sum(case when to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') 1 else 0 end) res1 ,sum(case when to_char(starttime, 'yyyymmddhh24miss') between('20130709000000') , ('20130709010000') 1 else 0 end) res2 tab_proclog_cso

javascript - How to click a button after page load with Angularjs -

im new angular, answer question might straight forward, cant seem find solution. i have angular app firebase backend, general goal have vote card, set angular sync firebase, , populated firebase necessary data. each voting card has 4 options, each option paints card in different color, votes submitted firebase , data consistent (if refresh page can pull votes firebase). what cant make angular click button selected on page load (and painting card on page load if user voted on card) the angular code var myapp = angular.module("myapp", ["firebase"]); function mycontroller($scope, $http, $firebase) { var questionref = new firebase(<my.firebase.link>); $scope.questions = $firebase(questionref); $scope.userid = "dave"; var answerref = questionref.child('responses').child($scope.userid); var userref = new firebase(<another.firebase.link>); $scope.selections = {}; $scope.newquestion = { opt...

c++ - LNK1104 cannot open x.lib -

i keep getting error weird part project comiles , runs fine. can't see problem is, , sure must find library work ok. probally there invalid reference x.lib in project configuration. if it's compiling , working fine, maybe have valid and invalid configuration x.lib .

javascript - How to access filepath in aspx page -

here have declared string variable on top of page below public string path; protected void viewfile(object sender, eventargs e) { path = (sender linkbutton).commandargument; this.page.clientscript.registerstartupscript(this.gettype(),"page_index_script","openpdf();",true); } and want access variable in aspx page inside script tag below <script type="text/javascript"> function openpdf() { var strmessage ='<%= path%>'; var filepath = 'http://localhost:2878/your project name/' + strmessage; window.open(filepath , 'pdf'); return true; } </script> but variable holds file path not including '/' treat filepath string , elinimate '/' path. need not elinimate .how possible? suppose filepath ...

c# - Substring with string, returning values between two words in a string -

i getting telnet buffer string following: "<connected><sending_video_list><start_video_list>test.mp4|test_3.mp4|test_2.mp4|<end_video_list><playing_test.mp4_started>" i want select between 2 indicators <start_video_list> , <end_video_list> in case euqal to: test.mp4|test_3.mp4|test_2.mp4| is there efficient way without manipulating whole string? well, if want, can use regex : <start_video_list>([^<]*)<end_video_list> and first captured group ( \1 ) want.

vb.net - VB how to input string Convert to characters upper and Lower -

in vb how can input string convert characters upper , lower input ' hello' output 'hello' code thiis sub convertcase() dim integer = 0 dim inputval string = textbox1.text dim out string = label1.text while > inputval.length() if inputval.length() mod 2 = 0 out = inputval.substring(0, 1).toupper end if if inputval.length() mod 2 <> 0 out = inputval.substring(1).tolower end if loop label1.text &= out end sub i don't know what's wrong >< you there. needed append out out &= ... and substring wasn't done properly. integer = 0 inputval.length - 1 if (i mod 2) = 0 out &= char.toupper(inputval(i)) else out &= char.tolower(inputval(i)) end if next

Changing the alpha values in R{graphics} while the colour argument is used -

Image
i'm used doing in ggplot2 i'm having hard time figuring out how specify alpha values using r base graphics, while col= argument in plot() used assigning colour type categorical variable. using iris data set (although in context doesn't make sense why need change alpha values) data(iris) library(ggplot2) g <- ggplot(iris, aes(sepal.length, petal.length)) + geom_point(aes(colour=species), alpha=0.5) #desired plot plot(iris$sepal.length, iris$petal.length, col=iris$species) #attempt in base graphics what mapping variable alpha value using {graphics}? example in ggplot2: g2 <- ggplot(iris, aes(sepal.length, petal.length)) + geom_point(aes(colour=species, alpha=petal.width)) any appreciated! adjusting alpha pretty easy adjustcolor function: col <- adjustcolor(c("red", "blue", "darkgreen")[iris$species], alpha.f = 0.5) plot(iris$sepal.length, iris$petal.length, col = col, pch = 19, cex = 1.5) #attempt in base grap...

java - Azure SDK OutofMemoryError -

i trying upload big file (950mb) azure using azure sdk. use sample code avaliable here: http://azure.microsoft.com/en-us/documentation/articles/media-services-java-how-to-use/ unfrotunately, results in outofmemoryerror. presumably because sdk trying load whole file memory. how can avoid this? caused by: java.lang.outofmemoryerror: java heap space @ java.util.arrays.copyof(arrays.java:2271) ~[na:1.7.0_21] @ java.io.bytearrayoutputstream.grow(bytearrayoutputstream.java:113) ~[na:1.7.0_21] @ java.io.bytearrayoutputstream.ensurecapacity(bytearrayoutputstream.java:93) ~[na:1.7.0_21] @ java.io.bytearrayoutputstream.write(bytearrayoutputstream.java:140) ~[na:1.7.0_21] @ sun.net.www.http.posteroutputstream.write(posteroutputstream.java:78) ~[na:1.7.0_21] @ com.sun.jersey.api.client.committingoutputstream.write(committingoutputstream.java:90) ~[jersey-client-1.13.jar:1.13] @ com.sun.jersey.core.util.readerwriter.writeto(readerwriter.java:115) ~[jersey-core-1....