Posts

Showing posts from June, 2014

wxwidgets - wxStaticText inconsistently displays 'degree' character -

in same application have 2 different instances of wxstatictext. each displays angular value expressed in degrees. i've tested both instances font name , font encoding. same both. i've tested both strings passed setlabel() using same character value, decimal 176. yet 1 displays 'degree' character (small circle, high) expected , other instead displays odd character i'm not familiar with. how can be? there other property of wxstatictext need test? i can't explain you're seeing because 2 identical controls must behave in same way, can tell using decimal 176 not way encode degree sign, unless explicitly use wxconviso8859_1 create corresponding wxstring . it better use wxstring::fromutf8("\xc2\xb0") instead or, preferably, make sure source files utf-8 encoded , use wxstring::fromutf8("°") .

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , returning one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback

c# - Download image from Wikimedia -

i've read documentation , after research im not sure if there easy way this. i using musicbrainz image of artist. produces url https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg i download image ( which have worked out ) dont know how or correct procedure be? i have read few links , seem pretty dated including: download image site in .net/c# which doesnt answer question have way of downloading image. im after in case way of getting image url using above link contains download links. i did read link targeting api again dated , ready pages didnt mention api (so have been third party). i have download image, getting correct url can found on link posted above dont know how extract url? you use html agility pack <a href elements in html page , ones image type extension. var document= new htmlweb().load("https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg"); var allhrefs = document.documentelement.selectnodes(

mysql - PHP comparing two datavalues -

i've been trying compare 2 strings, 1 username user entering, , 2nd 1 data program pulls database. here php code: $sqlcheck = "select username location username ='$usernamebeingreq'" ; $result2 = mysqli_query($con, $sqlcheck); $result2 = mysql_fetch_array($result2); $resultcheck = false; //mysqli_query($con, $sqlcheck); if((strcmp($result2, $usernamebeingreq) == 1)) { $sql="insert pending_req (fromuser, touser) values ('$username', '$usernamebeingreq')"; $resultcheck = true; } $usernamebeingreq equal user enter in, , result should equal when pulls database. i'm not sure why it's not working correctly. you cannot combine mysql_ , mysqli_ this. also, need iterate through result set value , compare then: $result2 = mysqli_query($con, $sqlcheck); while ($row2 = mysqli_fetch_array($result2)) { $username_to_check = $row2['username']; } $resultcheck = false; if((strcmp($username_to_check , $us

Dynamics CRM FetchXML - Birthday is today -

is possible using fetchxml find out contacts who's birthday today? example 4/1/2000, 4/1/2001, 4/1/2002? i don't want write custom code if possible thanks in advance unfortunately that's not possible without additional coding... general approach add 2 fields - day of birth , month of birth, populate during creation/update of record , use mentioned fields after.

c - Understanding GCC generated map files -

i'm trying write script parses .map files generated gcc , me figure out footprints of various libraries in memory. ( github repository of have far ) i'm trying understand following means / how should read : .debug_line 0x00000000 0x67b1 *(.debug_line .debug_line.* .debug_line_end) .debug_line 0x00000000 0x105 /opt/ti/gcc/bin/../lib/gcc/msp430-elf/4.9.1/../../../../msp430-elf/lib/crt0.o .debug_line 0x00000105 0x4b5 cmakefiles/firmware-msp430f5529.elf.dir/main.c.obj .debug_line.text.bc_printf.constprop.1 0x000005ba 0x23 cmakefiles/firmware-msp430f5529.elf.dir/main.c.obj .debug_line.text.deferred_exec 0x000005dd 0x60 cmakefiles/firmware-msp430f5529.elf.dir/main.c.obj .debug_line.text.startup.main 0x0000063d 0xfc cmakefiles/firmware-msp430f5529.elf.dir/main.c.obj .debug_line_end 0x00000739 0x0 cmakefiles/firmware-msp430f5529.elf.dir/main.c.obj i've b

Glitch while Styling Android Overflow Menu -

Image
after several hours of research, try , fail, have managed style , customize toolbar popup menu, i'm having weird glitch. as can see, when click on popup menu, appears styled , all, if press item background gets highlighted text not. why happening? can corrected? or mighty bug of android? thanks

activemq - Active mq fail-over transport produce memory leak -

i using active mq fail-over transport configuration (master only) in spring web based application. version 5.8.0 after period of producing/consuming messages, out-of-memory occurs. transaction mode enabled. session commit or rollback invoked properly. memory analizer shows leak suspect: one instance of "org.apache.activemq.transport.failover.failovertransport" loaded "sun.misc.launcher$appclassloader @ 0xfc0e9a40" occupies 28,711,384 (46.09%) bytes. memory accumulated in 1 instance of "java.util.concurrent.concurrenthashmap$node[]" loaded "". any ideas. in advance

FORTRAN - Correct values are calculated in simple precision, but erroneous solutions in double precision? -

i have following code, regarding newton's method calculating zeros in multivariable vectorial functions: program newton_method_r_n_r_n_1_numeric use inverse_matrices implicit none integer :: i, j !index real (kind = 8) :: x(0:501,3) !vectors in newton method real (kind = 8) :: a(3,3) !jacobi's matrix each vector integer , parameter :: n = 3 !dimension of jacobi's matriz real (kind = 8) :: inv(3,3) !inverse jacobi's matrix real (kind = 8), parameter :: eps = 1d-8 !near-zero value real (kind = 8) :: det !determinant x(0,:) = (/2.d0,2.d0,2.d0/) = 0, 500 = h(x(i,:)) call lu_factorization (n, a) call determinant (n, a, det) if (abs(det)<eps) exit end if call inverse_matrix (n, a, inv) x(i + 1,:) = x(i,:) - matmul(inv,g(x(i,:))) end write(*,*) ' 0 of function is: ', x(i,:) read(*,*) contains fun

linux - how to plot an array directly using plotutils -

i'm trying plot array.. example [1.0,2.0,3.0,4.0] know can plot files, want plot directly like: plot [1.0,2.0,3.0,4.0] is possible , how?? there go.. echo 1 2 3 4 | graph -t ps -a > plot.ps you find in same directory can add arguments color plot , optimize it...

Passenger + Apache + Rails - serve static assets? -

how have rails serve /assets/stylesheets , /assets/javascripts ? don't particularly care rails serves files, , i'm not sure why they're not found when deploy staging. case 1: if assets not inside app the problem might using stylesheets not inside app. in case need tell passenger files..so need first create symlink this: ln -s <path-to-your-hosted-assets>/assets assets usually can check these symlinks here /local/docroot , ll see existing symlinks. case 2: if assets inside app do precompile assets , see if can see assets. hope helps!

recursion - Missing 1 required positional argument - Python -

typeerror: sequence() missing 1 required positional argument: 'n', sequence() apparently when using sequence(n-1) + sequence(n-2) n not using value function, can fix it? memo = {0:0,1:1} def sequence(type, n): if type == "fibonacci": if not n in memo: memo[n] = sequence(n-1) + sequence(n-2) else: return memo[n] try this: sequence(type, n-1) + sequence(type, n-2) the error explicit, function sequence expecting 2 parameters, you're passing one. side note, should remove else , , make sure return memo[n] executed @ end - because function must always return value, otherwise recursion won't work.

jdbc in android, NullPointerException thrown -

public class mainactivity extends actionbaractivity { string id ; string name ; int price; private resultset result; private connection con; string url = "jdbc:mysql://localhost:3306/fyp_restaurant"; string username = "root"; string password = ""; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); try{ class.forname("com.mysql.jdbc.driver").newinstance(); }catch(exception e){ system.err.println("cannot create connection"); } try{ con = drivermanager.getconnection(url, username, password); statement statement = con.createstatement(); string query = "select * product"; result = statement.executequery(query); }catch(exception e){ system.err.println("error"); } try { id = result.getstring("id"); name = res

Calculator HTML form using Javascript -

i have little issue. that's code , don't know have made wrong. try complete simple html form calculate given number in text input html element. function rebate(){ var rebate_a,rebate_b,total,final; var = document.myform.rebatenum.value; if( <= 3000 ) { final = a; } else if ( (a > 3000) && (a <= 10000 ) ) { rebate_a = (a-3000) * 0.02; total = rebate_a; final = - rebate_a; } else if ( (a > 10000) && (a <= 30000 ) ) { rebate_a = (7000 * 0.02) + (a-10000) * 0.03; total = rebate_a; final = - rebate_a; } else if ( (a > 30000) && (a <= 40000 ) ) { rebate_a = (7000 * 0.02) + (20000 * 0.03) + (a-30000) * 0.05; total = rebate_a; final = - rebate_a; } else if( (a >= 40000) && (a < 50000 )) { rebate_a = (7000 * 0.02) + (20000 * 0.03) + (10000 * 0.05) + (a-40000) * 0.06; rebate_b = 25; total = rebate_a +

android - Changing background color of actionbar -

my android app uses minimum sdk version 15. trying change background color of actionbar , want changing style , theme. i've tried many things background remains dark. here styles like: <style name="apptheme" parent="@style/theme.appcompat.light.darkactionbar"> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background">#eeeeee</item> </style> in manifext set application's theme apptheme. by default appcompat support library uses value of colorprimary attribute color of actionbar . <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">#eeeeee</item> </style> but if want make color of actionbar independent primary color of the

java - multiple properties in spring. property in PropertyPlaceholderConfigurer class -

i'm trying create spring project. goal build project jar , war in future. use abc.properties file in classpath contains "conf.path.dir" property. war , jar projects use configuration different locations. , i'm replace abc.properties @ build time , use configure propertyplaceholderconfigurer bean. <bean id="first" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer" autowire-candidate="false"> <property name="ignoreunresolvableplaceholders" value="true"/> <property name="locations"> <list> <value>classpath:abc.properties</value> </list> </property> </bean> <bean id="second" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer" depends-on="first"> <property name="ignoreunresolvableplaceholders" value=&q

python - Convert html table to dictionary without losing structure -

i'm new python (and programming) , using beautifulsoup first time. i'm trying find best way parse contents of table in html , convert dictionary - ideally in least brittle way. here example of html i'm trying parse (i've put key value numbers text i'm trying pick up). <div class="tablename"> <table border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #dddddd; border-collapse: collapse; font-family: arial, helvetica, sans-serif; font-size: 14px; margin: 0; padding: 0; width: 100%"> <thead> <tr> <th colspan="4" style="background-color: #000; border: 1px solid #616161; color: #ffffff; font-size: 14px; font-weight: bold; line-height: 20px; padding: 14px 20px 12px 20px; text-align: left">some text not needed</th> </tr> </thead> <tbody> <tr> <td style="width: 20px"> </td> <td style="borde

java - How to obtain individual strings returned from GetPrivateProfileSection() -

i use java programming. have basic knowledge of c++. using jni call windows api getprivateprofilesection(). i understand have write c++ function this. vaguely familiar how this. problem face returned c++ string getprivateprofilesection(). from microsoft documentation, understand returned string contains name=value pairs each separated null character. last name=value pair ends 2 null characters. what want collect individual name=value strings , put them in array. have absolutely no clue how returned string getprivateprofilesection(). have heard need known pointer arithmetics have no knowledge how this. could me out? thanks! the code reads ini file std::map looks this: lptstr str_settings = new tchar[buffersize]; ::getprivateprofilesection(_t("mysection"), str_settings , buffersize, _t("myini.ini")); std::map<std::string, std::string> settings; // map key -> value ini file std::string sett_string; (;*str_settings; str_settings += set

Simple AngularJS scope issue (newbie) -

i'm trying figure out how user's email passed controller i'm getting undefined $scope.user.email . $scope defined there's no user object in there. there wrong code? html <label class="item item-input"> <span class="input-label">email</span> <input ng-model="user.email" type="text"> </label> <button ng-click="signinclick()" class="button button-full button-positive"> sign in </button> controller .controller('welcomectrl', function($scope) { $scope.signinclick = function() { console.log($scope.user.email); } }) edits the controller linked via js/apps.js , runs when button clicked know it's linked welcomectrl . because $scope.user undefined. .controller('welcomectrl', function($scope) { $scope.user = {}; $scope.signinclick = function() { console.log($scope.user.email); } })

java - How to access parent class integer variable in child class? -

this question has answer here: java cannot make static reference non-static field 3 answers i trying access int a= 10 variable in child class getting error: cannot make static reference non-static field freshjuice.a following code. class freshjuice { enum freshjuicesize{small,medium,large}; freshjuicesize size; int = 10; } public class index extends freshjuice { enum programminglanguage{php,java,dotnet,html}; public static void main(string[] args) { // todo auto-generated method stub system.out.println(freshjuice.freshjuicesize.small); system.out.println(programminglanguage.php); system.out.println(freshjuice.a); //getting error in line } } i want directly access int variable of freshjuice class in child class. how can achieve target? first create instance of freshjuice class: fre

Add command to Grails build process -

i using grails-cdn-asset-pipline plugin . i've gone through installation , configuration steps on github , reach usage section says add command build process (usually before war generation , deployment). // if settings defined in config.groovy grails asset-cdn-push // or grails asset-cdn-push --provider=s3 --directory=my-bucket --gzip=true --storage-path=some-prefix --expires=365 --region=eu-west-1 --access-key=$my_s3_access_key --secret-key=$my_s3_secret_key where in project put command? is can within context of project, or need keep separate in build process , run in environment jenkins? in _events.groovy , tried invoke script in eventcreatewarstart , having no luck there. (code taken this question ) eventcreatewarstart = { warname, stagingdir -> def pluginmanager = pluginmanagerholder.pluginmanager def plugin = pluginmanager.getgrailsplugin("cdn-asset-pipline") def plugindir = plugin.descriptor.file.parentfile map<string, st

networking - what messages could be delivered to socket that is only used for sending -

in our application have udp socket(s) used send packets (these sockets never read, , never bound port). sockets "connected" destination address. there messages icmp etc conceivably directed @ these ports , delivered receive buffers of these sockets? if types of messages occur? (these sockets never read, , never bound port). they bound port when call connect() if not bound. are there messages icmp etc conceivably directed @ these ports yes. icmp unreachable start. and delivered receive buffers of these sockets? no. icmp unreachable cause exception next time use socket. if types of messages occur? none. if getting data in socket send buffer, sending udp datagrams. in fact connect target sending udp datagrams.

delphi - idhttp.get component doesnt download full HTML File -

i working on program should download html file of wikipedia page , convert html pdf. my program far downloads html file, without pictures , page looks incomplete. is there way can bring idhttp.get component indy package download full html file? unit unit3; interface uses windows, messages, sysutils, variants, classes, graphics, controls,forms, dialogs, stdctrls, idbasecomponent, idcomponent, idtcpconnection, idhttp; type tform3 = class(tform) label1: tlabel; button1: tbutton; button2: tbutton; idhttp1: tidhttp; speichered: tedit; savedialog1: tsavedialog; auswahlb: tbutton; nameed: tedit; procedure button1click(sender: tobject); procedure nameedenter(sender: tobject); procedure auswahlbclick(sender: tobject); private { private declarations } public { public declarations } end; var speicherort, form3: tform3; implementation uses unit2, unit1, filectrl; {$r *.dfm} procedure tform3.button1click(sender: tobject); var respo

Can a vector class in C++ be used like a Dictionary class in C#? -

can vector class in c++ used dictionary class in c#? can have vector class store classes of same type. member of class can regarded key , remaining members can thought of data. no, vector class in general won't stay sorted when add members. means can't efficiently find items in it, need linear scan. use std::unordered_map key-value container offer o(1) key lookup.

winapi - How to eat MDIChild Minimize messages -

i have code intercepts , eats wm_exitsizemove messages because want prevent users maximizing mdichild forms. prevent them minimizing mdichild forms can't figure out message intercept, know? i think you're trying lot easier you're making it. change windowstate property on mdichild forms fixedsingle. prevent resizing of form, , rid of max , min buttons. if want resizing without maximizing or minimizing, have go through api. can use enumchildwindows rid of max , min buttons.

R package creation questions -

i want create r package, i'm new in topic, , though i've checked excellent resources hadley wickham's r packages book , i've couple of questions i'd clarify: do need import stats package make use of lm function? how can make use of piping operator %>% in magrittr package since can not write library(magrittr) ? if created function utility purposes shouldn't available end user, how can hide it? any appreciated! do need import stats package make use of lm function? no. it's loaded automatically. need import packages not loaded when r boots (like lattice) how can make use of piping operator %>% in magrittr package since can not write library(magrittr)? i'd import hadley here in dplyr: #' @importfrom magrittr %>% #' @name %>% #' @export #' @rdname chain #' @usage lhs \%>\% rhs null if you're not using roxygen2 document i'd recommend it, if you're reading hadley'

Android - Is it correct to use Event Buses (like Otto) for UI elements communication? -

can (is correct to) use event bus communicate between ui views? exemple, use communicate between fragments instead of implementing listener? can use same instance of bus more 1 operation? thank you yes. otto built reason: communicate fragments , activities aside without need of serializing through intent s. also, instance question: can reuse bus wherever want to. sometimes, though, prefer create different buses separate groups of classes communicating: example, in mvp architecture, have bus each m-v-p group, or in example, bus communicating specific service running, etc. this example on how use library.

java - Quicksort Stack overflow error -

while practicing exam encountered (for me) strange issue quicksort. my implementation: public void quicksort(int l, int r) { if(l<r && l>0 && r<=array.length-1) { int pivot = array[pivot(l, r)]; int = l; int j = r; if(j==i+1) { if(array[i]>array[j]) { system.out.println(array[i]+"<->"+array[j]); int = array[i]; array[i] = array[j]; array[j] = help; } } else{ while(i<=j) { if(array[i]>=pivot && pivot>= array[j]) { system.out.println(array[i]+">="+pivot+">="+array[j]); int = array[i]; array[i] = array[j]; array[j] = help; i++; j--;

What to import to use Facebook Graph API in iOS? -

Image
i need user friends list. understood how login fb app button. can not come across on line: which header file should import use graph api? /* make api call */ [fbrequestconnection startwithgraphpath:@"/{friendlist-id}" completionhandler:^( fbrequestconnection *connection, id result, nserror *error i installed frameworks see below, , included header. can not see graph stuff. #import <fbsdkcorekit/fbsdkcorekit.h> #import <fbsdkcorekit/fbsdkcorekit.h> #import <fbsdkloginkit/fbsdkloginkit.h> try using in way updated in sdk 4.0 [[[fbsdkgraphrequest alloc] initwithgraphpath:@"/me/friends" parameters:nil] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { if (!error) { nslog(@”fetched user:%@”, result); } }]; refer : https://developers.facebook.com/docs/ios/

java - Pattern.split slower than String.split -

there 2 methods: private static void normalsplit(string base){ base.split("\\."); } private static final pattern p = pattern.compile("\\."); private static void patternsplit(string base){ //use static field above p.split(base); } and test them in main method: public static void main(string[] args) throws exception{ long start = system.currenttimemillis(); string longstr = "a.b.c.d.e.f.g.h.i.j";//use long string for(int i=0;i<300000;i++){ normalsplit(longstr);//switch patternsplit see difference } system.out.println((system.currenttimemillis()-start)/1000.0); } intuitively,i think string.split call pattern.compile.split (after lot of work) real thing. can construct pattern object in advance (it thread safe) , speed splitting. but fact is, using pre-constructed pattern much slower calling string.split directly. tried 50-character-long string on them (using myeclipse), direct call consumes half t

ruby - What is correct path in .js file in Rails? -

i have js script plays video on home page , can't correct path video folder in script. works in html static project. assets/javascript/common.js var videobackground = new $.backgroundvideo($('#background-video'), { "path": "/video/" }); assets/javascript/video/ - videos in folder i tried sending root_path variable in application file, doesn't work either. application.html.haml :javascript var root_url = '#{rails.root}'; application.html.haml var videobackground = new $.backgroundvideo($('#background-video'), { "path": root_url + "/app/assets/javascripts/video/" }); i not sure, if want assets, try putting video in app/assets/videos , in config/application.rb config.assets.paths << "#{rails.root}/app/assets/videos" config.assets.enabled = true else put in public/videos then, video_tag "video.mp4" should automatically loaf there

android imageview bottom to top animation / create imageview programmatically -

i have got android app, want add @ button click 1 of 10 images (r.raw.geld1-10) animated before bottom of activity after top. tried numbers of pixels , multiply math.random(), problem pressed button , lagged hard without reason. seemed generation , animation of uithread. besides not avd, modern smartphone (snapdragon). please can me , send me alternative no overhead. that solved me, thank you! http://developer.android.com/guide/topics/graphics/prop-animation.html

junit - How to mock a method which takes Class as parameter -

i can mock method printmyvalue(string value); when(myclass.printmyvalue(anystring())then return "some value"; but how can mock printmyvalue(myclass value); you can use "any" method. can't statically import it. code this: package jtsandbox; import static org.hamcrest.corematchers.is; import static org.hamcrest.matcherassert.assertthat; import static org.mockito.mockito.mock; import static org.mockito.mockito.when; import org.junit.test; import org.mockito.mockito; /** * explains mocking question http://stackoverflow.com/questions/29392623/how-to-mock-a-method-which-takes-class-as-parameter/29393040#29393040 * @author jason w. thompson (https://plus.google.com/+jasonwthompson_softwaredeveloper) */ public class teststuff { /** * tests mocking * @throws exception exception not expected thrown */ @test public void testmethod() throws exception { // given final foo mockfoo = mock(foo.class);

php - Sorting Array of Categories -

i'm attempting sort following array use in foreach loop outputs latest post each of categories of goose-creek, sleepy-creek, , fobr. i want sort array post date, i'm confused on how accomplish this. better add multiple categories wp_query args , remove foreach loop? $feed_sources = array('goose-creek','sleepy-creek','fobr'); foreach ($feed_sources $feed) { $args = array('category_name' => $feed, 'posts_per_page' => 1); $show = new wp_query($args); $show->the_post(); the following code uses associative array , outputs category key , date integer value. arsort() sorts array high low $feed_sources = array('goose-creek','sleepy-creek','fobr'); $dates_array = array(); foreach ($feed_sources $feed) { $args = array('category_name' => $feed, 'posts_per_page' => 1); $show = new wp_query($args); $show->the_post(); $dates_array[$feed] = the_date('ymdhis'

javascript - custom tag containing data in option -

i having list of stuff user can select. way it's made, have integer name, price value need add color. it's not unique cannot use id. example : <option name='6' value="30.95">6 orange(30.95$/month)</option> <option name='6' value="33.95">6 green(33.95$/month)</option> <option name='10' value="32.95">10 orange(32.95$/month)</option> <option name='10' value="35.95">10 green(35.95$/month)</option> i need combine 2 non-unique values , them accessible jquery / javascript i not make 2 selects. know it's straightforward easiest solution if stick single 1 give better results. is safe create custom tag "prodcolor" non-reserved nametag or there smarter way achieve this? many once again. you can use html5 data- attributes, invented purpose. more importantly, values of data- attributes can accessed using js. since want include col

mysql - PHP change variable to corresponding type -

i'm making website in php different config files depending on company thats using @ moment. every company has +/- 15 config files same variables ofcourse, different values. every company has able change settings saving settings in mysql database. database has 3 columns 'company_id', 'setting' , 'value'. when i'm reading config items database, variable type 'string'. ofcourse, if statements "if($setting->value === false)" fails... is there easy way change type of variable corresponding returned value database? if want store arbitrary types in single database column, you'll have serialise them string representation, can unserialise value again. php offers serialize , unserialize purpose, can use language-neutral format json , xml or yaml.

calculate Dynamicaly height of DOM in AngularJS -

i want measure height of dom element in angularjs when dom load complete. myapp.directive('domheight',['$timeout',function($timeout){ return{ restrict:'ea', scope:true, link:function(scope,element,attrs){ $(document).ready(function(){ $('.required-wrapper').load(function(){ console.log( $('.required-wrapper').height()); }) }) } } }]) **above code trigger height before dom load ** i try use $timeout this not tested $('.required-wrapper').load(function(){ $timeout(function() { //as far know there no event notify loaded dom has rendered //so use timeout instead console.log( $('.required-wrapper').height()); }, 100); })

sql server - How to pass a parameter to an SQL script to change argument 2 of DATEADD() in VB.net? -

i trying send parameter drop down box sql server script change argument 2 of dateadd() : select distinct orders.order_id, customers.first_name, orders.order_date, payment_details.card_name, payment_details.card_type, payment_details.customer_id orders inner join customers on orders.customer_id = customers.customer_id inner join payment_details on orders.payment_id = payment_details.payment_id (orders.order_date < convert(varchar(20), dateadd(d, convert(dec, @date), { fn curdate() }))); and in turn populate grid view results: protected sub button1_click(sender object, e system.eventargs) handles button1.click dim orderhistorysearch new allin1idtableadapters.orderstableadapter gridview1.datasource = orderhistorysearch.getdatabyorderhistory(me.dropdownlist1.text) gridview1.databind() end sub end class however getting error stating: failed convert parameter value string dat

Define 2 plotted lines in an image as variables inside a function in Matlab? -

Image
function [yupper, ylower] = segmentation(a) a=imread('g16.bmp'); ar=a(:,:,1); [rows, columns] = size(ar); avgs = mean(ar(50:165,:), 2); avgs2 = mean(ar(165:315,:), 2); [~,ind]= max(abs(diff(avgs))); [~,ind2]= max(abs(diff(avgs2))); figure, image(ar,'cdatamapping','scaled'); colormap('gray'); hold on; yupper=plot([1 size(ar,2)], [ind+50 ind+50], 'r', 'linewidth', 2); ylower=plot([1 size(ar,2)], [ind2+165 ind2+165], 'g', 'linewidth', 2); end above code used segment grey scale images based on large instensity changes,i'm looking declare 2 plotted lines variables can carry out future processing. however, if type in whos , lines appear follows in table; yl 1x1 112 matlab.graphics.chart.primitive.line yu 1x1 112 matlab.graphics.chart.primitive.l

RPM spec missing uninstall section? -

i see no uninstall section in rpm spec documentation. see preun , postun. is there uninstall phase? what happens during uninstall phase? basing on %files section, list of files removed? , that's it? correct. the %install section of rpm spec file not run on rpm package installation (the name misleading in sense). %install section run during package creation install files need packaged such rpmbuild process can package them up. as such, because %files section lists files , directories package contains uninstallation process rpm removal of packaged files. if additional work needs done before or after files removed %preun , %postun scriptlets available in spec file work.

php - How to safely create files based on session id -

here problem: want make html form allow users upload images webserver. when user uploads files, want create directory him files uploaded to. so user can delete files later on, thought should name directory user session id... so here concern: have chrome plugin 'editthiscookie' , can change phpsessid this: '../test' or string want. of course can remove unwanted characters before create directory, new php , wanted know if there best practices on how correctly? update: how right now. ok? if(! preg_match('/^[0-9a-za-z]+$/', session_id())){ session_regenerate_id(); } it's fine use session cookie value this. but people safe session id remote address (ip) of user , validate it, request needs have correct session cookie value , remote address. this way there won't unwanted/unvalidated cookie values written disk , no abuse through cookie manipulation.

angularjs - AngualrJS ElasticUI dependency injection -

i have question regarding dependency injection in angular. i'm using elasticui: https://github.com/yousefed/elasticui the index-name needs set inside tag. <body ng-app="tutorial" eui-index="'index_name'"> is possible set index_name "outside" ? angular.module('tutorial', ['elasticui']). ??? i don't know angular. i'm sorry if stupid question... thanks help! it's passing value directive. in controller: .controller('mycontroller', function($scope) { $scope.indexname = "asdsd"; }) in html: <body ng-app="tutorial" ng-controller="mycontroller" eui-index="indexname">

Python putting r before unicode string variable -

for static strings, putting r in front of string give raw string (e.g. r'some \' string' ). since not possible put r in front of unicode string variable, minimal approach dynamically convert string variable raw form? should manually substitute backslashes double backslashes? str_var = u"some text escapes e.g. \( \' \)" raw_str_var = ??? if need escape string, let's want print newline \n , can use encode method python specific string_escape encoding: >>> s = "hello\nworld" >>> e = s.encode("string_escape") >>> e "hello\\nworld" >>> print s hello world >>> print e hello\nworld you didn't mention unicode, or python version using, if dealing unicode strings should use unicode_escape instead. >>> u = u"föö\nbär" >>> print u föö bär >>> print u.encode('unicode_escape') f\xf6\xf6\nb\xe4r your post had regex tag, m

active directory - ADFS not issuing claims from custom attribute stores to some users -

i'm trying work out why of our users aren't issued claims our custom attribute stores. our main attribute store authentication active directory, using 2 custom attribute stores issue several custom claims users, , perform logging of claims issued. when affected user logs in, authenticated ad, have no more claims added. according logging in our attribute stores, beginexecutequery never called. i can't see link affected users, seem new users, or users have not logged system in long time. restarting adfs clears problem, whether or not seems random. i'm trying understand why attribute store ignored adfs on logon users, when works fine others. if there quick guaranteed temporary fix users' claims issued correctly, useful too! for security reasons, don't have access adfs debug tracing. this solved longs string of calls microsoft's ad fs support team. problem traced piece of our claims rule language using lastlogon , lastlogontimestamp ad att

Gulp-minify-css does not produce output files -

i have set simple gulpfile.js there 2 task - 'sass' , 'minify-js'. these 2 tasks fired task 'watch' when change detected. seems working well: gulp listening changes, *.scss files compiled css, console generates output expected, without errors. however, css files not minified there no output files 'minify-css' task whatsoever. why 'minify-css' not working? missing here? this gulpfile.js: var gulp = require('gulp'); var sass = require('gulp-sass'); var watch = require('gulp-watch'); var minifycss = require('gulp-minify-css'); gulp.task('sass', function() { gulp.src('plugins/sosensational/styles/sass/*.scss') .pipe(sass()) .pipe(gulp.dest('plugins/sosensational/styles/dest/')); }); gulp.task('minify-css', function() { gulp.src('plugins/sosensational/styles/dest/*.css') .pipe(minifycss()) .pipe(gulp.dest('pl

java - Unable to compile jsp on server -

when run jsp @ local host works fine when run @ server show me error. have post error below. please me out. http status 500 - unable compile class jsp: type exception report message unable compile class jsp: description server encountered internal error prevented fulfilling request. exception org.apache.jasper.jasperexception: unable compile class jsp: error occurred @ line: [14] in generated java file: [/var/lib/tomcat7/work/catalina/localhost/uploadfile/org/apache/jsp/jsp/reviewquestions_jsp.java] type can imported. javax.websocket.session resolves package stacktrace: org.apache.jasper.compiler.defaulterrorhandler.javacerror(defaulterrorhandler.java:103) org.apache.jasper.compiler.errordispatcher.javacerror(errordispatcher.java:366) org.apache.jasper.compiler.jdtcompiler.generateclass(jdtcompiler.java:468) org.apache.jasper.compiler.compiler.compile(compiler.java:378) org.apache.jasper.compiler.compiler.compile(compiler.java:353) org.apache.jaspe

Php\Javascript web-app on Windows 8.1 issue -

i have small web-app in php minor javascript wrote on windows 7 using xampp server showing spinner when ajax loading. worked fine on win7. now when i'm setting same environtment on windows 8.1 loading spinner : in case of ie11, running in left-bottom region of page. in case of other browsers it's firstly hidden when run 1 , javascript function pop in left-bottom region , stays there same ie11. anyone point me i'm doing wrong , i'm missing behave normally? here's code: php page element : <div id="ajaxloading">trwa ładowanie, <br/>proszę czekać...</div> javascript: jquery.fn.center = function () { this.css("position","absolute"); this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrolltop() + "px"); this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollleft() + "px"); return this; } $(function() { // pokaż spinner

mysql - compare max value within a range with a specific date using group by -

i want mysql query check if end date's high value greater high within 1 year range end date -1 day symbol. max group , checking correct symbol comparison. how go on this? my table structure is: id symbol date high 1 abc 2015-01-23 45 2 abc 2015-01-22 40 3 abc 2014-01-28 33 4 xyz 2015-01-23 37 5 xyz 2015-01-20 70 6 ano 2015-01-20 170 7 je 2015-01-25 560 8 je 2015-01-23 770 select `symbol`,`high` current_high history h date='2015-01-23' , symbol = 'abc'; select `date`,`symbol`, max(`high`) 1_yrhigh history date between '2014-01-23' , '2015-01-22' , symbol='abc' want results if current_high > 1yr_high so above sample table's query result should 1 abc 2015-01-23 45 8 je 2015-01-23 770 xyz not displayed 37 < max ie 70 ano not displayed no record 2015-01-23 present in order current high each symbol use below query select symbol,max(h

MySQL: Converting VARCHAR to DECIMAL and find between range -

i have data in column h1.1 h1.2 h1.3 h1.10 h50.1 h50.5 h55.5 i want search between #1.10 #50.1. have tried query not getting desired result. select p_code table convert(substring_index(replace(`code`,'h',''), '.', 1),signed integer) between convert(substring_index('1.1', '.', 1),signed integer) , convert(substring_index('1.99', '.', 1),signed integer) , convert(substring_index(replace(`code`,'h',''), '.', 1),signed integer) between convert(substring_index('1.1', '.', -1),signed integer) , convert(substring_index('1.99', '.', -1),signed integer) , convert(substring_index(replace(`code`,'h',''), '.', 1),signed integer)>=convert(substring_index('1.1', '.', 1),signed integer) , convert(substring_index(replace(`code`,'h',''), '.', 1),signed integer)<=convert(substring_index('1.99', '