Posts

Showing posts from April, 2013

security - How do you login, check your user account and execute queries as a specific user in Cassandra? -

once cassandra has user accounts set up, how login 1 of them? alternatively how execute queries specific user? also, how check user account logged in as? i think run console user do: cqlsh -u your_username -p your_password according following video: http://www.youtube.com/watch?v=caqycdsnw-q&list=pl6yjrg6fu0ot4qz3ydbmmqbene02hqnlv&index=71

how to find white space between the string in coldfusion -

i need find white space between string in coldfusion example str="ha ppy" whitespace=4 i need calculate how many white space between str. how that. a simple regex: <cfset str="ha ppy"> <cfset spaces = rereplace(str, "\s+(\s+)\s+", "\1")> <cfoutput> <pre>spaces = [#spaces#]</pre><br> #len(spaces)# </cfoutput>

security - Password processing for public APIs? -

i not understand concepts of storing/processing passwords. for example, our site has public api mobile application(ios, android, etc) provided authentication. no doubdt, must not store raw passwords in database , must not send raw passwords between client , server, use hashes , salt. this way, encrypt passwords on client , send hashes server. but, if "black hat" steals password hash , authenticates server api? should hash passwords on client, send hashes, hash them again on server? what common solution of problem? great in advance. you can use ssl protect communication channel between client , server, , send password unencryped. second approach - store hashed passwords (without salt) in server, , when authenticate - random token server (that expire in minutes), calculate hash client password , use calculated hash encode received token. send encoded token server. server same operation use hash stored in database instead calculating password. approac

C# WPF listView nonSelected Item Edit -

select_listviewupdate ==> complete implementation. nonselect_listviewupdate ==> not selected, not know how item. c# formbase listview.item[2].subitems[3].text = "asdf" c# wpf mainwindows don't know. how to.... be stopped here. using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.imaging; using system.windows.navigation; using system.windows.shapes; using system.threading; namespace ex_wpflistview { /// <summary> /// mainwindow.xaml /// </summary> public partial class mainwindow : window { public mainwindow() { initializecomponent(); thread servicestatusupdatethread = new thread(new threadstart(updatecycle)); servicestatusupdatethread.start();

ios - UIBarButtonItem does not show disabled state titleTextAttributes -

i'm trying set disabled textattributes on uibarbuttonitem in uitoolbar . i create item so: nsdictionary *enabledattrs = @{ nsfontattributename : font, nsforegroundcolorattributename : color }; nsdictionary *disabledattrs = @{ nsfontattributename : font, nsforegroundcolorattributename : [uicolor graycolor] }; [item settitletextattributes:enabledattrs forstate:uicontrolstatenormal]; [item settitletextattributes:disabledattrs forstate:uicontrolstatedisabled]; however, when set item.enabled = no , button disabled (it not fire action) not honor titletextattributes -- still appears in normal state. why? create uibutton , wrap uibarbutton,i think should work. uibutton *uibutton = [[uibutton alloc] init]; [uibutton settitlecolor: color1 forstate: uicontrolstatenormal]; [uibutton settitlecolor: color2 forstate: uicontrolstatedisabled]; uibarbuttonitem *uibarbut

r - Find correspondent numbers in integer intervals -

i correspondent numbers between 2 integers intervals. input that: start1 end1 start2 end2 20 30 25 35 25 35 20 30 100 190 126 226 126 226 100 190 in first , second line, overlap first(1) interval (2 first collumns) second(2) interval (2 last collumns) equal 6 correspondents numbers (25,26,27,28,29 , 30). my expected output that: start1 end1 start2 end2 bp_overlapped 20 30 25 35 6 25 35 20 30 6 100 190 126 226 65 126 226 100 190 65 it matrix in r. thank you. the function searching intersect. can if x first matrix: f <- function(x) length( intersect(seq(x[1],x[2],1), seq(x[3],x[4],1)) ) <- apply(x,1,f) x <- cbind(x,a) the function apply applies function on each row of matrix (if second argument 1) or on each column (if second argum

ios - Can any one please explain what is use of CGRectZero -

i new ios. can 1 please explain use of cgrectzero , used? cgrectzero equals cgrectmake(0,0,0,0). it's used fast-initialize cgrect object. for example: cgrect frame = cgrectzero; frame.size.width = somewidth; frame.size.height = someheight; myview.frame = frame; from apple's doc: /* "zero" rectangle -- equivalent cgrectmake(0, 0, 0, 0). */ cg_extern const cgrect cgrectzero cg_available_starting(__mac_10_0, __iphone_2_0);

moqui - Pass parameters in transition to default-response -

it strange when defining parameters in default-response the parameters defined within default-response not passed target url below: <transition name="editproductfeature"> <path-parameter name="productfeatureid"/> <default-response url="../feature"> <parameter name="productfeatureid" from="productfeatureid"/> <parameter name="action" value="edit"/> </default-response> </transition> it not work either when defining them in parameter-map: <transition name="editproductfeature"> <path-parameter name="productfeatureid"/> <default-response url="../feature" parameter-map="['productfeatureid':productfeatureid, 'action':'edit']"> </default-response> </transition> but work if adding empty actions in transition: <transition name="ed

c# - Store json in variable -

i trying tracking json in response not in correct format. want replace make in correct format. want store returned json data in string variable. note: want store json , dont want deserialize it. there way so? tracking link http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&json_callback=renderexamplethreeresults&lat=30.718263&lon=76.694216 but json in response not in correct format. want replace make in correct format it jsonp , json response remove json_callback=renderexamplethreeresults parameters url. new url is: http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&lat=30.718263&lon=76.694216

python - Unknown predicate values error while rendering mako template in pyramid -

i getting configurationerror('unknown predicate values: %r' % (kw,)) while rendering mako template. below structure of pyramid project. my pyramid project tree. |-- web |-- myweb |-- templates |-- index.mak |-- __init__.py |-- views.py |-- development.ini |-- production.ini web/myweb/views.py class main(object): def __init__(self, request): self.request = request def __call__(self): return {} web/myweb/__ init __.py config.add_route('main', '/', view='myweb.views.main', renderer='index.mako') this getting error such raise configurationerror('unknown predicate values: %r' % (kw,)) pyramid.exceptions.configurationexecutionerror: <class pyramid.exceptions.configurationerror'>: unknown predicate values: {'renderer': 'index.mako', 'view': 'myweb.views.main'} in: line 33 of file /home/user/project/web/myweb/__init__

Perl: How to pass ARGV parameters to another script? -

i wrote perl script launches program , want pass exact argv parameters received launched program. currently use code: my $cmd = "script.sh" $params_str = ""; foreach $param (@argv) { $params_str .= " $param"; } $cmd .= " " . $params_str; system($cmd); but afraid following scenario problematic: >perl script.pl "param spaces" param2 param3 as call $cmd first parameter separated 3 parameters, quotation marks removed: param spaces param2 param3 is there elegant way pass parameters correctly? system() can used list of parameters, system("script.sh", @argv); which preferable way of system usage, , don't have worry "param spaces" .

drawable - android: fit height of DrawableLeft in a textView -

Image
i trying display blue line next block of text, pretty this: here's code: <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableleft="@drawable/blue_line" /> blue_line jpg file. blue rectangle. displays in original size regardless of text in textview. how can adjust height dynamically according height of text? make shorter when theres little amount of text , longer when there's more text.... you can try doing in code setting bounds image textview1.getviewtreeobserver() .addongloballayoutlistener(new ongloballayoutlistener() { @override public void ongloballayout() { drawable img = activityname.this.getcontext().getresources().getdrawable( r.drawable.blue_line); img.setbounds(0, 0, img.getintrinsicwidth() * textview1.getmeasuredhe

c# - Change rank of records in table -

my table consist 2 fields; code (pk), , rank code rank 1 b 2 c 3 d 4 now want reorder rows in own way. have listbox in application listed codes. when move up, or down item in listbox want save new positions in table. best logic that? help? if possible create 3rd column in table called listorder stored reorder database when move them or down.

numbers - dojo empty numbertextbox is displaying NaN , but I dont want either defualt value to it -

i have numbertextbox in datagrid editable. if empty, displaying nan, don't want either default value . should such (blank). please, me. how can achieve in dojo? try setting contraints parameter this: var mynumberbox = new dijit.form.numbertextbox({ constraints: { pattern: "0.####" }, // pattern number displayed or set value: "", // starting value if value isn't set other source required: false, // may want set true if user input required placeholder: "(blank)" // shown when no value present }); whenever value of number box, may want pass through parseint(value) or parsefloat(value) first. check if it's number. var value = parsefloat(mynumberbox.get("value")); if ( isnan(value) ) { // code handle if nan } for more help, go link . i hope helps.

java - Extract String value from a TreeMap -

map 1 treemap , map2 hashmap how extract value (string3[]) in string array treemap (map1) in java. treemap of type map1<string1,map2<string2,string3[]>> i have used treemap.getkey().contains(string2) key of string 2. need extract values of corresponding key i.e. string2 , store them in string array. collection entryset = treemap.entryset(); // obtain iterator entries set iterator = entryset.iterator(); // iterate through treemap entries system.out.println("treemap entries : "); while(it.hasnext()) system.out.println(it.next()); }

python - Convert the unicode to datetime format -

a function returns date , time in unicode format. u'2014-03-06t04:38:51z' i wish convert date , time format , subtract current datetime number of days in between. thanks in advance check string unicode >>> import types >>> type(u'2014-03-06t04:38:51z') types.unicodetype true converting strings datetime : >>> import datetime >>> datetime.datetime.strptime(u'2014-03-06t04:38:51z', '%y-%m-%dt%h:%m:%sz') datetime.datetime(2014, 3, 6, 4, 38, 51) subtract today >>> import datetime >>> today = datetime.datetime.today() >>> yourdate = datetime.datetime.strptime(u'2014-03-06t04:38:51z', '%y-%m-%dt%h:%m:%sz') >>> difference = today - yourdate print str(difference)

javascript - Not able to understand how the domEvent works -

Image
scenario: i have radcombobox , have attached functions of events. 1 event of combobox onclientblur , using check whether value in combo "unassigned" or not. if "unassigned" need cancel onblur event , keep focus on same combo. this javascript has been used cancel event. if (sender.get_text() === "unassigned") { eventargs.get_domevent().preventdefault(); return false; } problem: when user tabs out first time of combobox event gets cancelled , focus stays on same combo box (in case 3rd combo). but when user hits tab button again focus moves next control. when debugged code found when user first hits tab button, following line works eventargs.get_domevent().preventdefault(); i can see preventdefault function, see following snapshot. but when user hits tab button again error , cannot see preventdefault function, see following snapshot i not able understand going wrong here. anyhelp appreciated. your prob

eclipse - How to verify text everytime after posting with Selenium WebDriver using java? -

i have comment page people can write comment in text field , post comment clicking on submit button.like facebook comment.after posting comment, have verified comment.now want add 2nd comment , want verify 2nd comment.so there way verify text/comment every time after posting? in advance. you can try following code: protected boolean istextpresent(string text){ try{ boolean b = driver.getpagesource().contains(text); return b; } catch(exception e){ return false; } } string s[] = {"test comment1", "test comment2"}; for(int =0; i<s.length; i++){ driver.findelement(by.name("comment_body[und][0][value]")).sendkeys(s[i]); driver.findelement(by.xpath("//a[@onclick='commnet_form_submit_handler(); return false;']")).click(); asserttrue(istextpresent(s[i])); }

Dynamically change a css image with jquery -

i need change image in css when button clicked matches slide image. the slide images populated using list, click through lists , relevant image come up. here's css images .hero li:nth-child(1) span { background-image: url('http://image1.jpg'); } .hero li:nth-child(2) span { background-image: url('http://image2.jpg'); } .hero li:nth-child(3) span { background-image: url('http://image3.jpg'); } here's jquery i've got far jquery(document).ready(function($) { $(".trigger-wrapper").click(function () { $("#menu-wrapper-left").stop().animate({width: 'toggle'}); $('#hero-container').css('background-image','url(http://dummyimage.com/600x400/000/fff.jpg)'); return false; }); }); but static image , selects 1st image, need run along side slider, ideas? here's fiddle, slider doesn't work on fiddle moment can see i'm truing achieve. http://jsfiddle.net/h863x/

android - ListView List position is over an EditText -

in xamarin, have edittext object, , listview populated items when text entered edittext object. currently, when type text edittext, listview displayed, on top of edittext, such cannot enter in more data. how can display listview under edittext object? here layout code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:padding="5dip"> <framelayout android:id="@+id/mapwithoverlay" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#ffffff" android:layout_below="@+id/thumbnail" /> <listview android:id="@+id/list" android:layout_width=&qu

clojure - repeat function n times in recursion on input (without loop recur) -

i know can solve problem loop , recur seems such simple (common?) operation wondering if there no single function in clojure or less cluttered approach loop/ recur solve this. searched not able find something. the function looking following. (the-function n input some-function) where n number of time recursivle call some-function on input. a simple example be: (the-function 3 1 (fn [x] (+ x 1))) => 4 is ther in clojure? best regards what want iterate . generate infinite sequence of repeated applications of function seed input. replicate behavior describe here, write: (nth (iterate some-function input) n)

PHPs variable scoping -

this might seem trivial question, since realised after using php 8months, think requires attention. used strongly-typed languages such java, weakly-typed languages well(somehow). ok, question in mind, defining variable within function, within 3rd level foreach loop. for($x =0; $x <= 20; $x++){ for($x =0; $x <= 5; $x++){ foreach($arr $var){ $new_arr = $var; } if(isset($new_arr)){ //code executes here } } } in above example, last if condition return true, though $new var not declared global variable, how accessible outside foreach loop? shouldn't give undefined error ? nb.i have looked @ php doc much javascript, php's variables scoped function level. variable return true isset() in foreach,for or while loop after has been set. php doesn't have concept of loop scoping. it's worth mentioning function scoping little stricter javascript's. without using use () statement closures function d

java - Pdf viewer in browser -

what libraries can used display pdf viewer in browser using java? i have tried using gdocumentviewer(jquery solution) seems work pdf urls. cannot use url pdf in case since pdf file stored in location under c:/tmp/pdffiles , not under webcontent directory. use an iframe . instead of pointing pdf url (that don't have), make pointing action url. from within action, read file , return content inputstream using stream result .

postgresql - Heroku: update database plan, then delete the first one -

i updated db plan on heroku quite time ago, following clear tutorial: https://devcenter.heroku.com/articles/upgrade-heroku-postgres-with-pgbackups so have 2 db running: $ heroku pg:info === heroku_postgresql_navy_url (database_url) plan: crane status: available data size: 26.1 mb tables: 52 pg version: 9.2.6 connections: 8 fork/follow: available rollback: unsupported created: 2013-11-04 09:42 utc region: eu-west-1 maintenance: not required === heroku_postgresql_orange_url plan: dev status: available connections: 0 pg version: 9.2.7 created: 2013-08-13 20:05 utc data size: 11.8 mb tables: 49 rows: 7725/10000 (in compliance, close row limit) - refreshing fork/follow: unsupported rollback: unsupported region: europe i keep receiving mails saying i'm close rate limit on heroku_postgresql_orange_url . i'd rather delete it, i'd make sure i'm not going loose data. heroku not clear it: the or

javascript - RegExp range out of order with complex pattern -

this pattern: var pattern = "/(?:https?:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/"; var matches = $("#search input").val().match(new regexp(pattern)); when use it, gives me error: uncaught syntaxerror: invalid regular expression: //(?:https?://)?(?:www.)?facebook.com/(?:(?:w)*#!/)?(?:pages/)?(?:[w-]*/)*([w-.]*)//: range out of order in character class from reading on similar issues came attention need double escape characters, don't know out of pattern. remove unwanted double quotes regex pattern: var pattern = /(?:https?:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-\.]*)/;

c# - CS1607: Assembly generation -- The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format -

(please excuse me if terms mixed here - java developer, new .net , c#. please add/correct tags on question if need be.) i using msbuild script build project. 1 of tasks write assembly info: <target name="updateassemblyinfo"> <message text="updating assemblies file version $(assemblyversion) ($(assemblyfileversion))" importance="high"/> <assemblyinfo codelanguage="cs" outputfile="sharedassemblyinfo.cs" assemblyversion="$(assemblyversion)" assemblyfileversion="$(assemblyfileversion)" assemblyproduct="svn revision $(build_number)"/> </target> this converts sharedassemblyinfo.cs this: [assembly: system.reflection.assemblyversion("0.0.0")] to this: //------------------------------------------------------------------------------ // <auto-generated> // code generated tool. /

standards - @ sign as url parameter separator? -

while browsing new google maps saw using @ sign instead of ? seperate url-path query parameters, like: https://www.google.com/maps/@38.1158476,-96.2044115,6z the coordinates after @ change navigating around map, without browser refresh. bookmarking works fine this. wikipedia not mention this, rfc3986 shows @ sign possibility username/password authentication. is standardised feature or proprietary browser functionality? feature safe use, , how use correctly? @38.1158476,-96.2044115,6z not query component . it’s still part of path component . the @ character can used in path, without percent-encoding it . so uri standard perspective, there nothing special uri. there have been used other (or no) character instead. i assume google uses @ here because users might read "at", suitable " at <location> ".

How to use Hadoop streaming input parameter for matlab shell script -

actually want execute matlab code in hadoop streaming. doubt how use hadoop streaming input parameter value matlab input. example , this matlab file imreadtest.m (simple coding) rgbimage = imread('/usr/new.jpg'); imwrite(rgbimage,'/usr/ot/testedimage1.jpg'); my shell script #!/bin/sh matlabbg imreadtest.m -nodisplay normally works in ubuntu. (not in hadoop). have stored these 2 files in hdfs using hue. matlab script looks (imrtest.m) rgbimage = imread(stdin); imwrite(rgbimage,stdout); my shell script (imrtest.sh). #!/bin/sh matlabbg imrtest.m -nodisplay i have tried execute in hadoop streaming hadoop@xxx:/usr/local/master/hadoop$ $hadoop_home/bin/hadoop jar $hadoop_home/hadoop-streaming.jar -mapper /usr/ot/imrtest.sh -file /usr/ot/imrtest.sh -input /usr/ot/testedimage.jpg -output /usr/ot/opt but got error this packagejobjar: [/usr/ot/imrtest.sh, /usr/local/master/temp/hadoop- unjar4018041785380098978/] [] /tmp/streamjob7077345699332124679.ja

random forest - R randomForest to PMML class index is wrong -

i'm exporting r randomforest model pmml. resulting pmml has class first element of datadictionary element, not true. is there way fix or @ least increment pmml custom extension elements? way put class index there. i've looked in pmml package documentation, in pmmltransformations packages, couldn't find there me solve issue. by pmml class assume mean model type (classification vs regression) in pmml model attributes? if so, not true model type determined data type of first element of datadictionary....these independent. model type determined model type r thinks is. r random forest object determines type thinks (model$type) , model type exported pmml function. if want model type, make sure let r know that...for example, if using iris data set, if predicted variable sepal.length, r correctly assume regression model. if insist on treating classification model, try using as.factor(sepal.length) instead.

r - How could I speed up the following for loop? -

rm(list = ls()) <- seq(from = 1, = 50000, = 1) b <- seq(from = 1, = 10000, = 2) c <- seq(from = 1, = 10000, = 3) 2 <- rep(na, length(a)) 3 <- rep(na, length(a)) system.time( (i in seq_along(a)) { if (length(tail(which(a[i] > b),1)) != 0 & length(tail(which(a[i] > c),1)) != 0) { two[i] <- tail(which(a[i] > b),1) three[i] <- tail(which(a[i] > c),1) } else { two[i] <- na three[i] <- na } } ) build_b <- b[two] build_c <- c[three] what trying find b , c looked @ time of a . prelocating memory in vectors two , three in attempt save time , can keep track of indexing of occurrences. after loop completed build new vectors according indexing computed. operation takes 10 sec compute. question how can speed operation? thank you! here solution using findinterval : ## assume a, b , c sorted 2 <- findinterval(a-1l, b) 3 <- findinterval(a-1l, c) two[two==0

C# alert when deadline date is approaching -

ok have application stores records , various other functions, able implement way of creating sort of alert system when deadline date (stored record) approaching tell me/user. not sure if possible advice or suggestions great thanks. using system.datetime should able access current date of machine this datetime today = datetime.today; you compare stored time in records @ regular intervall (start of application maybe?) check if deadline approaching.

java - How to follow xhtml to Bean class in eclipse? -

Image
i'm using eclipse-juno & trying follow jsf code xhtml bean class , i'm not able feature in work space. for eg: when i'm using ctrl +mouse pointer in header, it's giving suggested link. but, when come xhtml code i'm not able link bean class. for eg: here i'm using same option, ctrl +mouse pointer. not giving suggestion associated bean. how this? whether have change settings in eclipse? eclipse web tools platform offers this http://www.eclipse.org/webtools/releases/3.0.0/newandnoteworthy/jsf.php hyperlink support in wpe's source tab the source tab of web page editor (wpe) supports hyperlink on managed bean variable, managed bean property , managed bean method referenced in expression language(el) of tag-attribute. users can (ctrl+click) on hyperlink navigate source of managed bean.

simple graphic pipeline in OpenGL -

i reading schaum's outlines computer graphics. book says simple graphic pipeline this: geometric representation --> transformation --> scan conversion (though author has decided teach scan conversion chapter before transformation chapter). wish learn simple pipeline through example in opengl. suppose wish create line end coordinates (150,400) , (700,100) in window of size (750,500). below code works well. asking experts explain 'steps in sequence' when transformation happening , when scan conversion. know may sound stupid need straight. adult beginner learning graphics @ own hobby. guess scan conversion not happening here in program. done opengl automatically between glbegin , glend calls. am right? #include <gl/glut.h> void init(void) { glclearcolor (0.5, 0.2, 0.3, 0.0); glclear (gl_color_buffer_bit); glcolor4f(0.5,0.7,0.3,0.0); gllinewidth(3); } void display(void) { glbegin(gl_lines); glvertex2i(50, 400);

ruby on rails - Doorkeeper authorize also redirect_uri subpath -

i developing oauth 2.0 server using doorkeeper . what need 'customize' implicit flow authorization in order let sub-path of client redirect_uri authorized well. example client ( id: "123", name: "example", redirect_uri: "http://www.foo.com") request : client_id : "123", scope:"-" redirect_uri:"http://www.foo.com" => token request : client_id : "123", scope:"-" redirect_uri:"http://www.foo.com/bar/whatever" => invalid redirect_uri (i want token) any suggestion?

ruby on rails - What to stub, in order to test an ActiveRecord validates_uniqueness_of -

i have simplified model: class site < activerecord::base validates :primary_domain, uniqueness: true end and have test in minitest-spec: describe "primary_domain" "must unique" site.create(primary_domain: "example.com") s = site.new(primary_domain: "example.com") s.wont_be valid? s.errors.messages.keys.must_include :primary_domain end end but requires few roundtrips database, find break concept of unit-test. there can stub exclude entire database-layer? e.g. when using mocha: describe "primary_domain" "must unique" site.stubs(:find_by).with(primary_domain: "example.com").returns([site.new]) s = site.new(primary_domain: "example.com") s.wont_be valid? s.errors.messages.keys.must_include :primary_domain end end apparently uniqueness validator not use find_by, other check. there better candidate stub out here achieve same?

c# - How to add record into the database using MVC -

i trying add record database showing me error: an exception of type 'system.data.entity.infrastructure.dbupdateexception' occurred in entityframework.dll not handled in user code error when run program, not open view in web-browser this model: public class moviemodel { public int id { set; get; } public string firstname { set; get; } public string secondname { set; get; } public datetime dob { set; get; } public string type{ set; get; } } this controller: namespace movie.controllers { public class moviescontroller : controller { private applicationdbcontext db = new applicationdbcontext(); // // get: /movies/ public actionresult addusers(moviemodel model) { if (modelstate.isvalid) { db.movies.add(model); db.savechanges(); } return view(model); } } } second question when up-grading database upgrade-databa

java ee - Couldn't reset my password CRUD -

i have form user can reset password if did forget it. resetform.xhtml <h:form id="newcustomerform" > <fieldset> <legend>rest password</legend> <table border="0" > <tbody > <tr type="text"> <td> <p:outputlabel value="account login :" for="pseudo"/> </td> <p:spacer height="5px" /> <td> <p:inputtext id="pseudo" value="#{accountmb.login}" title="pseudo" required="true" requiredmessage="the pseudo field required."> </p:inputtext>

c++ - error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory -

i use gsl. after compiled .cpp file , run it, faced below error: error while loading shared libraries: libgsl.so.0: cannot open shared object file: no such file or directory i found same problem in: https://groups.google.com/forum/#!topic/cortex_var/6vlux7pp0sk & linux error while loading shared libraries: cannot open shared object file: no such file or directory & http://www.gnu.org/software/gsl/manual/html_node/shared-libraries.html and have done in above links wrote error still remained. can me? to make work following steps start borne shell $ld_library_path= path gsl lib folder inside gsl installation folder $export ld_library_path now run executable it should work fine.

matlab - Create chromosomes with list of rules in genetic algorithm -

i used weka data mining tool creating list of rules , want set rules chromosomes in genetic algorithm don't know how? a sample of rules: srv_serror_rate > 0.51 , dst_host_diff_srv_rate > 0.7 , same_srv_rate <= 0.25: satan you take liberty in genetics interpretation , use floats gene values. in case, have 1 gene representing minimum srv_serror_rate, 1 minimum dst_host_diff_srv_rate , 1 maximum same_srv_rate. genome (chromosome) sample rule above [0.51, 0.7, 0.25], , you'd have mapping between gene positions , role/function in evaluation function. if want strict have have bitstrings encoding each of these values instead of floats, wouldn't bother.

Does WSO2 Application Server's Throttling Function support username integration and multi-domain sharing? -

as studying wsas (wso2 web application server) follwing link ( http://wso2.com/library/articles/wso2-throttling/ , became curious throttling method. i believe understand above link. however, want ask if wsas throttling... 1) supports combination of soap operation + username unit - saw wsas has username/password, want control throttling volume api user unit using username value. 2) operated in multi-domain environment. please check below link. full question - http://wso2-oxygen-tank.10903.n7.nabble.com/issue-wso2-appication-server-distributed-throttling-is-now-working-td93044.html<https://email.accenture.com/owa/redir.aspx?c=0k45fzdvi06vfaqtym8bpj-smfqydneiy5i3dt9gxxreolvtwvoionekbpyapf7sooupayqim8q.&url=http%3a%2f%2fwso2-oxygen-tank.10903.n7.nabble.com%2fissue-wso2-appication-server-distributed-throttling-is-now-working-td93044.html >

Android app shutdown dialog not prevented on some devices -

i using following code prevent shutdown dialog shown on screen. however, did not work devices. works on samsung galaxy s4 mini not on htc . wrong code? @override public void onwindowfocuschanged(boolean hasfocus) { super.onwindowfocuschanged(hasfocus); log.d("focus debug", "focus changed !"); if(!hasfocus) { log.d("focus debug", "lost focus !"); intent closedialog = new intent(intent.action_close_system_dialogs); sendbroadcast(closedialog); } } what wrong code? nothing. samsung galaxy s4 mini apparently has bug, broadcast affects shutdown dialog. shutdown dialog not a temporary system dialog , therefore should not affected broadcast.

internet explorer 11 - jQuery fadeIn and fadeOut not working in IE11 -

since upgrading ie11 have noticed jquery fadein , fadeout methods don't work expected. working fine in ie10. have ideas why might be? the code using is: if($subheader.next('.midcontent').is(':visible')) { $subheader.next('.midcontent').fadeout('slow').attr('aria-hidden', true); $subheader.find('.sectiontype').addclass('closed'); } else { $subheader.next('.midcontent').fadein('slow').attr('aria-hidden', false); $subheader.find('.sectiontype').removeclass('closed'); } make sure .fadein , .fadeout functions being applied <td> , not <tr> elements because apparently ie not support opacity on elements, on td. problem. when created class called .hidden , defined display:none , added class each td, fadein td elements in row fine. see: why can't fade out table row in ie using jquery?

oracle - 00001. 00000 - "unique constraint (%s.%s) violated" -

i have main_table, holds 7 million records. have to keep last 3 months data in main_table archive last 4 12 months data in main_table_archival purge data older 12 months i created stored procedure cursor copy main_table main_table_archival. have composite primary key(constraint "pk_main_table" primary key ("service", "tr_source", "tr_id") while copying getting 00001. 00000 - "unique constraint (%s.%s) violated" error though not inserting duplicate key @ same time records copied main_table_archive. my code (i have around 20 fields i'm not pasting whole code): declare c_id customers.id%type; c_name customers.name%type; c_addr customers.address%type; cursor c_customers select id, name, address customers; begin open c_customers; loop fetch c_customers c_id, c_name, c_addr; exit when c_customers%notfound; dbms_output.put_line(c_id || ' ' || c_name || ' ' || c_addr);

java - Recover the original number from a float -

numbers being stored in database (out of control) floats/doubles etc. when pull them out damaged - example 0.1 come out (when formatted) 0.100000001490116119384765625 . is there reliable way recover these numbers? i have tried new bigdecimal(((number) o).doublevalue()) , bigdecimal.valueof(((number) o).doublevalue()) these not work. still damaged result. i aware make assumptions on number of decimal places , round them break numbers deliberately 0.33333333333 example. is there simple method work rationals? i suppose asking is there simple way of finding minimal rational number within small delta of float number? . you can store numbers in database string , on retrieval parsedouble() them. way number wont damaged, same store there.

d3.js - how to add legend and tool tip in stacked bar chat -

i working on stacked bar chat.but not able add legend(request,served,waiting),title,x-label,y-label , tool tip in below code need more clarity on it.please me out how add these thing on it i have modified code , able add legend not able add tool tip please me out when click bar should show tooltip total request": 10 "serverd": 8 , "wating": 2 edit code here var data = [ { "date": "5/2014", "total request": 10, "serverd": 8, "wating": 2 }, { "date": "6/2014", "total request": 20, "serverd": 12, "wating": 8 }, { "date": "7/2014", "total request": 30, "serverd": 20, "wating": 10 }, { "date": "8/2014", "total request": 40, "serverd": 30, "wating": 10 }, { "date": "9/2014", "total request": 10, "serverd": 5, "wati

c# - Removing generated stylesheet reference -

in page_load of masterpage, i've programmatically added reference styleheet: htmllink css = new htmllink(); css.attributes.add("rel", "stylesheet"); css.attributes.add("type", "text/css"); css.attributes.add("id", "admin_style"); css.href = "style_admin.css"; page.header.controls.add(css); now wish remove reference again, can't seem working. i've tried simple findcontrol on id , .remove(), doesn't seem work. does know how remove reference? htmllink css = new htmllink(); css.attributes.add("rel", "stylesheet"); css.attributes.add("type", "text/css"); css.href = "style_admin.css"; css.id = "admin_style"; page.header.controls.add(css); and remove via foreach (control ctrl in page.header.controls) { var htmllink = ctrl htmllink; if (htmllink != null) { if (htmllink.id == "admin_style")

c# - Unable to fetch built in properties of email along with the extended property -

i working exchange web services managed api. adding single extended property mail items in inbox processed based on condition. thus, not mails extended property attached them. next refetching mails in inbox , if have property attached them, process them again. below simple method getallmailsininbox() , have written refetch mails in inbox: class myclass { private static guid isprocessedpropertysetid; private static extendedpropertydefinition isprocessedpropertydefinition = null; static myclass() { isprocessedpropertysetid = new guid("{20f3c09f-7cad-44c6-bdbf-8fcb324244}"); isprocessedpropertydefinition = new extendedpropertydefinition(isprocessedpropertysetid, "isitemprocessed", mapipropertytype.string); } public list<emailmessage> getallmailsininbox() { list<emailmessage> emails = new list<emailmessage>(); itemview itemview = new itemview(100, 0); finditemsresults<i

hadoop - Select one relations all fields & one or two from other relation on PIG JOIN, how? -

a = load '$input1' using pigstorage() (a,b,c,d,e) b = load '$input2' using pigstorage() (a,b1,c1,d1,e1) c = join a, b a; d = something; 'd' should of format (a,b,c,d,e,b1) how achieve this? d = foreach c generate a::a .. a::e, b::b b1;

objective c - iPhone - Free space left on device reported incorrectly (+- 200 Mb difference) -

i use method free space on disk, extracted code found after researches. float freespace = -1.0f; nserror* error = nil; nsarray* paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsdictionary* dictionary = [[nsfilemanager defaultmanager] attributesoffilesystemforpath:[paths lastobject] error: &error]; if (dictionary) { nsnumber* filesystemsizeinbytes = [dictionary objectforkey:nsfilesystemfreesize]; freespace = [filesystemsizeinbytes floatvalue]; } i wonder why when runing this, gives me free space of 3660062720.000000 bytes give 3,408699035644531 gb (/1024/1024/1024) but looking iphone setting -> general info (and itunes), i'm said iphone has 3.2 gb left. where mistake ? it appears free space reported incorrectly https://discussions.apple.com/thread/2566412?threadid=2566412 edit: tried following code , noticed on device, there ~200mb discrepancy. maybe storage

android - Handler executing faster than expected -

i using handler , postdelayed method execute runnable after every 10 seconds. looks executed every second. here code: final handler handler = new handler(); runnable runnable = new runnable() { @override public void run() { try { if (onetimeexecution && !gcmintentservice.agreedid.equals(null)) { onetimeexecution = false; iterator = jsonavailabeinfos.infoidentification .entryset().iterator(); while (it.hasnext()) { map.entry pairs = (map.entry) it.next(); infoinfo tempinfo = (infoinfo) pairs .getvalue(); if (!tempinfo.getid().equals( gcmintentservice.agreedinfoid)) { marker m = (marker) pairs.getkey(); m.setvisible(false)

javascript - How to Pass the Email Id value after checking Captcha in Asp.Net Mvc4? -

i new 1 asp.net mvc4 entity framework. doing captcha verification forgot password. code, passing email id value controller when clicking submit button captcha code invalid. want pass email id value controller if captcha code correct otherwise should show validation error , new captcha should reloaded. please me fix it. in advance. this java script code generation , validating captcha: var captchastring = ''; function getcaptcha() { var chars = "0aa1bb2cc3dd4ee5ff6gg7hh8ii9jj0kk1ll2mm3nn4oo5pp6qq7rr8ss9tt0uu1vv2ww3xx4yy5zz"; var string_length = 7; captchastring = ''; (var = 0; < string_length; i++) { var rnum = math.floor(math.random() * chars.length); captchastring += chars.substring(rnum, rnum + 1); } document.getelementbyid("randomfield").innerhtml = captchastring; } function validation() { var text

ajax - MVC PartialViewResult contains Attached JavaScript function calls, causing memory leak -

i have mvc view contains html table. in table cells contain onclick events attached check boxes, , onchange events tied input boxes. these tied standard javascript function calls in .js file. <input type="text" id="changeactualtimebox{'0'}" onchange="changestarttime()"> when change occurs in cells call associated jquery ajax function via post method , return partialviewresult containing updated html , new model data. new html table(partialview) contains 10 javascript events per row in td tags. if user pulls different date, memory increases 2mb or more depending on size of table returned, 200 rows of data. i noticed numerous script block functions being stacked each time retrieve new data, these never released memory. instead of attaching onclick , onchange functions way am, there way use jquery , eliminate javascript calls entirely? you can use jquery on() method instead of attach onclick , onchaneg functions example:

actionscript 3 - TypeError: Error #1009: Cannot access a property or method of a null object referenc -

typeerror: error #1009: cannot access property or method of null object reference. @ radioskonto_fla::maintimeline/onenterframe()[radioskonto_fla.maintimeline::frame1:30] there code! http://radosi.lv/2/screen.png please help! it's because, on first call onenterframe, fl_sc has not been defined - fl_sc set s.play() when user clicks play_btn. either check fl_sc has been defined before checking property of it, or change sequence of events there's instance of fl_sc @ first call onenterframe.

crystal reports - How do I make one parameter dependent on another? -

i need 2 parameters in report. know how make them, need 2nd 1 depend on person chose first answer. example, if choose usa country, need second 1 show states in usa. can please show me how that? thanks. you need create dynamic cascading parameters. check video how create them: https://www.youtube.com/watch?v=9fhyoyg9e4q

python - RabbitMQ Message/Topic Receiver Crashing when RabbitMQ is not running -

i using python , pika on linux os environment. message/topic receiver keeps crashing when rabbitmq not running. wondering there way keep message/topic receiver running when rabbitmq not because rabbitmq not on same virtual machine message/topic receiver. this cover if rabbitmq crashes reason message/topic receiver should keep running. saving having start/restart message/topic receiver again. as far understand "message/topic reciever" in case consumer. responsible make application in such way catch exception if trying connect not running rabbitmq. for example: creds = pika.plaincredentials(**creds) params = pika.connectionparameters(credentials=creds, **conn_params) try: connection = pika.blockingconnection(params) log.info("connection rabbit established&quo

c++ - QTabWidget not appearing -

i have difficulties create ui. what need : 1 qtabwidget 3 qwidget tabs. 1 of these widget contains qpushbuttons, qlineedits, , have contain qtabwidget. my problem : where i've sucess on other qtabwidget, 1 not appearing. i've manually put qpushbutton , qlineedit in .ui file. want dynamically create qtabwidget on same page. my page code : namespace ui { class cimageinterface; } class cimageinterface : public qwidget { q_object public: cimageinterface(); ~cimageinterface(); private: ui::cimageinterface* ui; capptabwidget* tabw_application; }; constructor : cimageinterface::cimageinterface() : ui(new ui::cimageinterface) { tabw_application = new capptabwidget(this); ui->setupui(this); } qtabwidget code : class capptabwidget : public qtabwidget { q_object public: explicit capptabwidget(qwidget* parent); ~capptabwidget(); protected: private: ui::capptabwidget* ui; cappinterface* tab_application; int m_nbtab; }; co

javascript - Initialize the jQuery plugin after AJAX content loads -

i'm using popeasy jquery plugin pop modal forms. have working if trigger links , div containing modal form in main document uses $(document).ready(function(){... to initialize plugin. but, need trigger modal content loaded via ajax, happens after main document "ready". i've tried $(document).ajaxcomplete(function(){... but might using ajax in different way method expects? how can initialize plugin after ajax content loads? you can configure in success callback once content retreived $.ajax({ url:"server.aspx", type:"post", success:function(result){ //do here } });

java - JUnit NoClassDefFoundError on org.junit.Assert itself -

Image
i following error when running code: (colormatrix getarray() returns float[]) 74 public void testhueshift() { 75 colormatrix cm1 = new colormatrix(); 76 colormatrix cm2 = hueshift(0f); 77 assertarrayequals(cm1.getarray(), cm2.getarray(), 0f); 78 } the error: ----- begin exception ----- java.lang.noclassdeffounderror: org.junit.assert @ com.common.lib.test.colorfilterfactorytest.testhueshift(colorfilterfactorytest.java:77) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ junit.framework.testcase.runtest(testcase.java:154) @ junit.framework.testcase.runbare(testcase.java:127) @ junit.framework.testresult$1.protect(testresult.java:106) @ junit.framework.testresult.runprotected(testresult.java:124) @ junit.framework.testresult.run(testresult.java:109) @ junit.framework.testcase.run(testcase.java:118) @ android.test.androidtestrunner.runtest(androidtestrunner.java:169)

I changed the TFS 2010 server computer name -

i changed tfs server computer name: after changed connected tfs server visual studio using new name after changing connection string database (i using same server tfs , tfs database). connection succeeded, , retrieved projects project collection, when expand project red x on "documents" , "reports" folder. what need make work. know should run command change computer name in workspaces, not quite sure , how execute it. what bad idea! any moderate complex system has many configuration items, not 1 connection string. give idea tfs composed by: web site/services, window service, sql instance (db , analysis), 1 or more sql server reporting services, not counting other windows services build , test can added architecture. , both tfs , sharepoint have configuration database. in this page can hints of steps should have followed. specifically, "documents" folder error accessing sharepoint , "reports" folder error failure of reporting

Laravel 4: Load External View -

i'm moving codeigniter laravel 4 , haven't been able find decent way load view external application. setup 10-15 apps own laravel installation. these apps unique apps. however, use same template , don't want have 10-15 copies of same file throughout apps. so, i'm trying figure out way share template among these apps. did in codeigniter loading external view , providing path centralized location contained template file. best practice in laravel make happen? edit: i'm not sure if did job explaining i'm trying do. basically, have blade layout file want use template of apps. i'm trying avoid having copy , paste file every installation. of these installations on same server want centralized location store blade layout file , use each app. in laravel can set many paths views in app/conf/views.php : /* |-------------------------------------------------------------------------- | view storage paths |--------------------------------------------------

sql query not giving expected results in sql server -

i using sql server , table structure start end interval 1 3 1 9 12 1 16 20 2 100 120 5 expected result 1 2 3 9 10 11 12 16 18 20 100 105 110 115 120 i tried before posting here select start result,end1,interval table union select result+1,interval,end1,interval table this perfect place use cte . following code should give answer you're looking for: ;with intervalcte ( select [start] value, [end], [interval] t union select [value] + [interval], [end], [interval] intervalcte [value] < [end] ) select value intervalcte order value i've created sql fiddle can at.