Posts

Showing posts from September, 2015

javascript - Image onload event not firing in firefox -

i'm creating image preloader. works fine in browsers except firefox (testing firefox 10.0). input array of images called image_list . these images appended dynamically body of document , load callback attached, calls function update_progress . code follows: $(image_list).each(function() { var x = $('<img />') .load(function() {update_progress(percent_loaded += step);}) .attr('src', this) .appendto('body') .css('display', 'none'); .each(function() { if(this.complete) update_progress(percent_loaded += step); }); }); in firefox, load callback , update_progress never called. yet exact same code works fine in chrome , other browsers i've tested. there way detect when image has loaded in firefox? i first check see whether image has height, checking height property. if (the_image.height > 0) { // image loaded (possibly cached) } if have cached

objective c - NSMenu update title -

i have created nsmenu dynamically created , lists hdd's attached computer. each of these submenu contains nsmenuitem created title "calculating size...". on thread enumerating through specific folders return string replace title. i have setup correctly if have 1 of these submenu's selected when enumeration finishes doesn't reflect change in title until either highlight item or select different submenu , come back. what correct way of achieving update?

web services - Postgres Java Webservice response issue -

i have webservice use execute postgres queries. problem response anytype{} nothing in it. checked server , seems there no errors in log files. webservice @suppresswarnings("unused") public string getinfo() { connection con = null; preparedstatement st = null; resultset rs = null; string url = "jdbc:postgresql://127.0.0.1:5432/uptondb"; string user = "*******"; string password = "******"; string query = ""; string response = ""; int size = 0; initialcontext cxt = null; try { cxt = new initialcontext(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } datasource ds; try { ds = (datasource) cxt.lookup( "java:comp/env/jdbc/postgres" ); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } try{ try { c

javascript - how to make setTimeout refer to context of object? -

var myobj = { name:"mike", go:function(){ console.log(this.name); } } myobj.go() //logs out mike settimeout(this.myobj.go,200) //logs out (emptystring) define variable reffering object before: var _this = this; settimeout(function() {_this.myobj.go();}, 200);

javascript - Centering DIV Horizontally & Vertically on Page Load -

how can center div both horizontally , vertically when page loads? i using following solution: html: <div class="container"> <div class="visitorselect"> <a href="/visitorlog/boeing"> <div class="tile double icon bg-color-blue"> <div class="tile-content"> <i class="icon-plane"></i> </div> <div class="brand"> <span class="name">employee</span> </div> </div> </a> <a href="/visitorlog/guest"> <div class="tile double icon bg-color-orange"> <div class="tile-content"> <i class="icon-group"></i> </div> <div class="brand"> <span class="name">guest</span> </div> <

ios - AVAssetExportSession ignoring videoComposition rotation & stripping metadata -

i attempting rotate video prior upload on ios device because other platforms (such android) not interpret rotation information in ios-recorded videos and, result, play them improperly rotated. i have looked @ following stack posts have not had success apply of them case: ios rotate every frame of video rotating video w/ avmutablevideocompositionlayerinstruction avmutablevideocomposition rotated video captured in portrait mode ios avfoundation: setting orientation of video i coped apple avsimpleeditor project sample, unfortunately ever happens is, upon creating avassetexportsession , calling exportasynchronouslywithcompletionhandler, no rotation performed, , what's worse, rotation metadata stripped out of resulting file. here code runs export: avassetexportsession *exportsession = [[avassetexportsession alloc] initwithasset:[_mutablecomposition copy] presetname:avassetexportpresetpassthrough]; exportsession.outputurl = outputurl; exportsession.outputfiletype =

java - Scanner not working correctly in Mac OSX terminal -

i have hacky ant command user can run stuff. command prompts user input. in intellij, when testing, works correctly. when run ant target terminal, weird behavior. here code: scanner userin = new scanner(system.in); printwriter writer = new printwriter(system.out); writer.println(error + " if continue load, data may in corrupted state. continue? (y/n): "); writer.flush(); string userresponse = userin.next(); while (!(userresponse.equalsignorecase("y") || userresponse.equalsignorecase("n") || userresponse.equalsignorecase("yes") || userresponse.equalsignorecase("no"))) { writer.println("invalid input. please specify if continue load. (y/n): "); writer.flush(); userresponse = userin.next(); } return userresponse.equalsignorecase("y") || userresponse.equalsignorecase("yes"); when running ant command terminal, error message displayed when use

DART string constant set to timestamp as at compilation -

how can string constant automatically set datestamp @ compile time? something like: const string compile_datestamp = eval_static(datetime.now().tostring()); ... string s = "this program compiled $compile_datestamp"; where s e.g. "this program compiled 1971-02-03 04:05:06" thanks question! there's no required compile step in dart. (we have optional dart-to-javascript compiler, or dart-to-dart processor tree shaking.) dart's vm accepts input text files. similar ruby or python, runs text-based scripts. as others have mentioned, job sort of build step.

if statement - IF function; struggling with format of 3 times greater section -

excel 2002: write if function cell j8 assigns text "ok" if value in cell l9 3 times greater value in cell m6; otherwise, have if function assign text "not ok" cell j8. be: =if(l9*3>m6, "ok", "not ok") that be =if(l9>=m6*3,"ok", "not ok") further examples: a b c formula ------------------------------------------------- 1 2 no ok if(b2 >= a2*3,"ok", "not ok") 2 6 ok if(b3 >= a3*3,"ok", "not ok") 3 8 no ok if(b4 >= a4*3,"ok", "not ok")

ruby - guard/guard-sass not compiling changes -

i'm having problems guard , guard-sass compiling updated .sass files. i've install them both, pointed guard-sass configuration @ input , output directories whenever save changes .css file isn't getting updated. initially thought might permissions things odd thing i've set :all_on_start => true words doubt can that. here guardfile stands: guard 'sass', :input => 'assets/sass', :output => 'static/css', :all_on_start => true i've tried (just incase avoiding long notation made difference): guard 'sass', :all_on_start => true, :output => 'static/css' watch %r{^assets/sass/(.+\.s[ac]ss)$} end here when start guard debug ( guard start -d - incase debug show i'm missing): tavocado:data tavocado$ guard start -d 22:39:49 - debug - command execution: emacsclient --eval '1' 2> /dev/null || echo 'n/a' 22:39:49 - info - guard uses terminaltitle send notifications

c# - How to test a selected item of a ComboBox is equal to my string? -

i started learning c# week ago. have little experience objective c. give me hard time asking such beginner question. well, user able select combo box. created combobox visually in xaml. contents of combo box strings. however, when user selects string of choice, store value int can calculations. errors have been can't convert object string , many other conversation errors. int x; string selvalue = (string)combobox1.selectedvalue; if ((selvalue=="green")||(selvalue=="blue")) { x= 5; } would best create function accepts object , returns int, if please tell ? you should have string green selectedtext , value int 5 selectedvalue, way can drop code & int x = (int)combobox1.selectedvalue, give 5. need google winform combobox databinding, you'll see can bind diferent properties text & value.

check facebook login with javascript -

i created facebook api script: fb.api('/me/likes/112234512170409',function(response) { if( response.data ) { if( !isempty(response.data) ) alert('you fan!'); else alert('not fan!'); } else { alert('error!'); alert("error: " + response.error.message); } }); but error messages: error: active acces token must used to... here full code: http://pastebin.com/zfs6rgpj did wrong? since script in body , not head, , execute code want instead of defining within function call later on, running api request (line #37 of code) on document load, before logged in (hence, no valid token). wrap api call function can call later, e.g. var callmelater = function { fb.api('/me/likes/112234512170409',function(response) { ... }; and call callmelater(); after you've logged in. if haven't checked out, perhaps steps 4 , 5 may helpful in http://devel

How to bind a jQuery event to dynamic content with AngularJS -

basically in controller, i'm doing $http.get() load html set "current view". issue can't figure out how rebind the jquery event new dynamic content. right now, i've resorted somethign this: $http.get('/someurl', {}).success(function(data){ $scope.detailedview = data; // here comes rebinding settimeout(function(){ // use jquery bind new content }, 1500); }); i've been looking solution, , related i've found points using directive. i've looked this, not know how directive used this. note without timeout, bindings run before dynamic content in dom. i've tried finding similar hooking after $apply run have not found similar. first should see if doing jquery can't done using angular. here's simplistic version of directive can used: <div ng-repeat="item in items" my-directive>item {{$index+1}}</div> app.directive('mydirective', function ($timeout) { return function (

r - Defining a distribution for survival::survreg() -

i try fit survreg model using gamma distribution. following ?survreg.distributions defined custom distribution this: gamma <- list(name = 'gamma', parms = c(2,2), init = function(x, weights, ...){ c(median(x), mad(x)) }, density = function(x, parms){ shape <- parms[1] scale <- parms[2] cbind(pgamma(x, shape=shape, scale=scale), 1-pgamma(x, shape=shape, scale=scale), dgamma(x, shape=shape, scale=scale), (shape-1)/x - 1/scale, (shape-1)*(shape-2)/x^2 - 2*(shape-1)/(x*scale) + 1/scale^2) }, quantile = function(p, parms) { qgamma(p, shape=parms[1], scale=parms[2]) }, deviance = function(...) stop('deviance residuals not defined') ) however can't run: require(survival) survreg(surv(log(time), status) ~ ph.ecog + sex, lung, dist=gamma) #error

c# - Finding everywhere an enum is converted to string -

i'm trying find everywhere in solution specific enum converted string, whether or not tostring() explicitly called. (these being replaced conversion using enum descriptions improve obfuscation.) example: i'd find code such string str = "value: " + someenum.somevalue; i've tried replacing enum wrapper class containing implicit conversions enum type , overriding tostring() in wrapper class, when try searching uses of tostring() override gives me list of places in solution tostring() called on (and called explicitly). search done resharper in visual studio. is there way find these enum-to-string conversions? going through entire solution manually doesn't sound fun. the trick in roslyn use semanticmodel.gettypeinfo() , check convertedtype find these sort of implicit conversions. a complete example: using system; using system.collections.generic; using system.linq; using system.text; using roslyn.compilers; using roslyn.compilers.csharp;

clicking link in javascript -

i have anchor tag on pages. <a id='signout' href='//somelocation'>signout</a> and have javascript file available pages. there function called , attached 'click' , 'touch' , 'key press' handler trying click link. like document.addeventlistener('click' function(e){ var signoff = document.getelementbyid('signout'); location = signoff.href; } this should click anchor tag whenever there click event not working. some syntax corrections got working me: document.addeventlistener('click', function(e) { var signoff = document.getelementbyid('signout'); location = signoff.href; }); http://jsfiddle.net/jjgej/

php - Cannot receive any SMS messages when I register/ inquire via SMS Globe Labs API -

i developing sms based registration system , far i'm @ stage of testing system. of sudden, not able receive messages server when tried register via sms must receive confirmation messages. here's did when using php nusoap. register.php <?php // allow user register via sms. error_reporting( e_all ); // load nusoap libraries. these slower built in php5 require_once('nusoap.php'); // create client , define url endpoint $soapclient = new nusoap_client('http://www.mnccyf.info/soap_book.php?wsdl'); // set character encoding, utf-8 standard. $soapclient->soap_defencoding = 'utf-8'; $soapclient->call('sendsms', array( 'uname' => '48dwi5', 'upin' => '159597', 'msisdn' => '09152886810', 'messagestring' => 'registered successfully', 'display' => '1', 'udh' => '', 'mwi' =>

SQL- Subquery with aggregate functions (SQL Server) -

my set thus: have 3 tables- students (studentid, firstname, lastname etc.), studentsemesters(studentid,semid etc.), , semesters(semid, year) my requirement to, details each student last semester. logically implies semester highest year number. cannot seem query right. simplicity 'year' integer (e.g. 2000, 1998). below current query have been stuck @ time: select dbo.student.lastname + ' , ' + dbo.student.firstname student, dbo.student.defence1date, dbo.student.defence2date, count(studentsemesters_1.semid) semestercount, dbo.student.entrysemester + ' - ' + (select dbo.studentsemesters.semid dbo.studentsemesters inner join dbo.listsemesters on dbo.studentsemesters.semid = dbo.listsemesters.semid (dbo.student.studentcode = dbo.studentsemesters.studentcode) group dbo.studentsemesters.semid, dbo.listsemesters.year having (dbo.lists

php URL structure /page.php vs /page -

this question has answer here: how remove file extension website address? 11 answers i have build few sites website. end .php. problem if want view page have type in website.com/page.php instead of website.com/page how make happen of main pages? there quick way of doing or have set forwarding of /pages /page.php? in cases achieved using mvc framework , routing. works in way don't access single .php file single web page show user. every request goes through 1 file , have router define routes , define action controller route invoke, , there choose view file show user. hard explain in few sentances. anyway using mvc nice url-s www.example.com/controller/action/param now if want remove .php extension files can put in .htaccess file: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php

scala - how to set main class in SBT 0.13 project -

could guys please explain me how set main class in sbt project ? i'm trying use version 0.13. my directory structure simple (unlike sbt's documentation). in root folder have build.sbt following content name := "sbt_test" version := "1.0" scalaversion := "2.10.1-local" autoscalalibrary := false scalahome := some(file("/program files (x86)/scala/")) mainclass := some("hi") librarydependencies ++= seq( "org.scalatest" % "scalatest_2.10" % "2.0.m5b" % "test" ) eclipsekeys.withsource := true and have subfolder project single file hi.scala contains following code object hi { def main(args: array[string]) = println("hi!") } i'm able compile calling sbt compile sbt run returns the system cannot find file c:\work\externals\sbt\bin\sbtconfig.txt. [info] loading project definition c:\work\test_projects\sbt_test\project [info] set current project sbt_tes

ios - Serialize JSON string SBJSON vs NSJSONSerialization vs anything else? -

i receiving json string , want know how serialize dictionary can parse managed object. i have looked @ few ways (named in title), , can't seem find simplest, quickest alternative. use nsjsonserialization, i'm not sure made this? code string comes in nsstring *data = [[nsstring alloc]initwithdata:response encoding:nsutf8stringencoding]; nslog(@"string %@",data); nslog message string [{"0":"1","id":"1","1":"re ee","name":"re ee","2":"http:\/\/ree.com\/images\/re.png","backgroundimageurl":"http:\/\/ree.com\/images\/re.png","3":"http:\/\/ree.com\/images\/re.png","logoimageurl":"http:\/\/ree.com\/images\/re.png"}]<br /> thank in advance jsonkit looking for. besides ease of use, it's quicker sbjson, quicker nsjsonserialization. for example, can array this: nsarray* ar

javascript - need to calculate 2 input fields and display in 3rd -

i want multiply quantity price , 'display' in total. total needs named "amount" in order transfer total cost gateway. can see i'm trying create around able use quantity. all information here test purposes isn't personal. <script type="text/javascript"> function totalprice() { var qty = document.getelementbyid("quantity").value; var price = 219999; var total = (qty * price); document.getelementbyid("tot").value = total; } </script> <form action="https://gateway.charityclear.com/hosted/" method="post"> <input type="hidden" name="merchantid" value="0000992"> <input type="hidden" name="countrycode" value="826"> <input type="hidden" name="currencycode" value="826"> <table> <tr> <td>full name </td><td><input type="text" na

video - BIOS int 10h service 0 and EGA mode -

i've spent lot of time trying find out happens when 1 calls bios int 10 , service 0 set video mode. possible perform these actions manually using ega ports? i've found documentation different sources, failed find sets particular mode. i'm starting thing "video mode" not register value, it's bunch of settings in ega. to clear, i'm practicing text modes (0,1,2,3 , 7) under dosbox , qemu. look web tauron vga utilities . code in package sets various video modes (text , graphics) using video registers , not using bios functions. of these modes appear work under dosbox, tried.

.net - Could not load the file or assembly Microsoft.Office.Interop.Excel -

i have deployed website on virtual machine windows server 2008 r2,iis 7 , .net framework 3.5.1 installed. i have been getting following error. ======================================== server error in '/' application. configuration error description: error occurred during processing of configuration file required service request. please review specific error details below , modify configuration file appropriately. parser error message: not load file or assembly 'microsoft.office.interop.excel, version=11.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c' or 1 of dependencies. system cannot find file specified. source error: line 46: <add assembly="stdole, version=7.0.3300.0, culture=neutral , publickeytoken=b03f5f7f11d50a3a"/> line 47: <!--<add assembly="microsoft.office.interop.excel, version=12.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c"/>--> line 48:

while developing window 8 store apps -

i new window store app development, never work in wpf have experience in web development , wcf services. next assignment window 8 store app , need start asap. have wcf restful service need create ui has multiple pages. so need know - 1. mvvm pattern suitable such applications? 2. can find controls of window store apps? 3. can html/javascript can same xaml/c# ? 1. mvvm pattern suitable such applications? yes definitely. mvvm pattern can apply in xaml based development. there's plenty of framework available. using mvvm pattern in windows 8 - laurent bugnion (the mastermind behind mvvm light) mvvm light caliburn micro simple mvvm toolkit julmar mvvm helpers + behaviors kona - prism windows 8 apps catel - application development platform mvvm support 2. can find controls of window store apps? controls list (windows store apps using c#/vb/c++ , xaml) controls list (windows store apps using javascript , html) 3. can html/javascript can same xaml

apply - R - count at each row the number of columns in the "row neighbourhood" that contain only NA -

how create data frame vector gives each row number of columns "na" (or custom value) in row , n rows above , m rows below. so if m = n = 1 (i.e. how many columns in each row na , have na before , after) , dataframe is structure(list(x = 1:8, = c(3l, na, 10l, na, 6l, na, 5l, na ), b = c(6l, na, na, na, 8l, na, 13l, na), c = c(na, 12l, 14l, na, na, na, 9l, na), d = c(na, na, na, na, na, 11l, 7l, na)), .names = c("x", "a", "b", "c", "d"), class = "data.frame", row.names = c(na, -8l)) i.e. t x b c d 1 1 3 6 na na 2 2 na na 12 na 3 3 10 na 14 na 4 4 na na na na 5 5 6 8 na na 6 6 na na na 11 7 7 5 13 9 7 8 8 na na na na i want vector count 0 1 2 1 1 0 0 0 (if first , last entries na 's that's fine). i'm trying mimic countifs function in excel, i.e. countifs(b2:f2,"",b3:f3,"",b4:f4,"") row 3. i think mean. suppose dataframe ca

Delete Query in Mysql using a TOP Clause? -

i having tough time writing query delete top 2 entries repeated in mysql.can please me in this.i have come across how query select statement not delete query.following requirement ;if table contains more or equal 10 values of particular record delete first record(topmost).following code. $result = mysql_query("select * billinfo tableno='10'") or die(mysql_error()); $num_rows = mysql_num_rows($result); echo $num_rows; $query2=''; if($num_rows>10) { $query2 = mysql_query("delete * top billinfo tableno='10')"); } first of all, you're checking if $num_rows less 10, if understand correctly want opposite case. you have not defined mean "top" -- assume largest value of field, , hence i've written xx in query. try like if($num_rows>10) { $query2 = mysql_query("delete billinfo tableno='10' order xx desc limit 1"); } this delete 1 row ( defined in lim

shell - Search for a column by name in awk -

i have file has many columns. let "employee_number" "employee_name" "salary". want display entries in column giving or part of column name. example if input "name" want employee names printed. possible in simple manner using awk? thanks given script getcol.awk follows: begin { colname = argv[1] argv[1] = "" getline (i = 1; <= nf; i++) { if ($i ~ colname) { break; } } if (i > nf) exit } {print $i} ... , input file test.txt : apple banana candy deer elephant b c d e b c d e b c d e b c d e b c d e b c d e b c d e ... command: $ awk -f getcol.awk b <test.txt ... gives following output: b b b b b b b note output text not include first line of test file, treated header.

xamarin.ios - ipad missing overlapped annotations -

while i'm trying draw cross lines on ipad view , erasing overlapped part of previous line. i'm using setneedsdisplayinrect() method refresh drawings. please suggest me overcome issue. i wrote code is i'm using below code draw: context.moveto (penvertices [0].x, penvertices [0].y); (int = 1; < penvertices.count; i++) { context.addlinetopoint (penvertices [i].x, penvertices [i].y); } context.strokepath(); and using below code display line setneedsdisplayinrect(rectanglef.fromltrb(minx - (linewidth/2), miny - (linewidth/2), maxx + (linewidth/2), maxy + (linewidth/2))); hi avoid erasing of previous made annotations @ overlapped place, use paths draw annotations instead of simple context.

winforms - how to bind datasource to a .rdlc report in c# -

friends , have developed simple application using c# , has 2 rdlc reports i used below code bind datasource report viewer this.reportviewer1.localreport.reportpath = @"c:\documents , settings\administrator\my documents\visual studio 2008\projects\reports\reports\report1.rdlc"; reportviewer1.localreport.datasources.clear(); reportviewer1.localreport.datasources.add(new reportdatasource("customer", dt.tables[0])) ; this.reportviewer1.refreshreport(); but when report generated ,it empty report no data displayed , opinion??? when add .rdlc report in project wizard default take dataset name 'dataset1' . if want bind dynamically new dataset name of dataset must 'dataset1' . try change , check table[0] contains data(rows) datatype matched original datatype of dataset1 . if datatype doesn't matches data wont come in reportviewer. try code:- string exefolder = (path.getdirectoryname(application.startuppath)).substring(0, (path.g

html - Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\project\advancebrowsing.php:132) -

this question has answer here: how fix “headers sent” error in php 11 answers i'm doing project school , wrote page reason 2 warnings in end header info sent on line 132 on line 132 have php tag i appreciate if can help, wrote code in 1 hour trying solve problem past 2 hours ... got tired , decided ask it here code <html> <body> <form method="post"> browse author's name starting :<select name="author"> <option value="">--select--</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> <option value="d">d</option> <option value="e">e</option> <option value="f">f</option> <option value="g">g</option>

dynamics crm - How to assign lead to campaigns in crm 2011 -

i have 10 leads , 10 campaigns , how assign leads campaigns in crm 2011 , generate report.. how assignment . thanks in advance. i don't know want, 1 thing can have marketing list can add leads, contacts or accounts. new feature dynamics marketing list updated if criteria entity changed. if don't answer nothing question put more details please. take in tutorials: https://community.dynamics.com/crm/b/crmsoftwareblog/archive/2012/11/13/simplifying-campaigns-in-microsoft-dynamics-crm-2011.aspx http://www.youtube.com/watch?v=kkjzyhuzdbc

iOS count JSON items -

i want count json items obtained jsonobjectwithdata . id jsonobjects = [nsjsonserialization jsonobjectwithdata:receiveddata options:nsjsonreadingmutablecontainers error:nil]; nslog(@"%@",jsonobjects); json return { detail = "\u0e19\u0e31\u0e01\u0e28\u0e36\u0e01\u0e29\u0e32"; email = "krol3ong8gs@gmail.com"; id = 1; name = "\u0e13\u0e23\u0e07\u0e04\u0e4c\u0e0a\u0e31\u0e22 \u0e08\u0e34\u0e19\u0e14\u0e32\u0e1b\u0e23\u0e30\u0e01\u0e32\u0e22"; password = 9670f4c03767a65db8067d2b5cf2e6e4; picture = "thumbnails_2012-10-14_23-56-59.jpg"; username = asskyo001; } use this nsdictionary *jsonobjects = [nsjsonserialization jsonobjectwithdata:receiveddata options:nsjsonreadingmutablecontainers error:nil]; nslog(@"%d", [jsonobjects count]);

exception - Singleton constructor fails c++ - what can be? -

i facing huge problem: have singleton class. program multi-threaded mfc, singleton's constructor can called different threads. surrounded singleton instance-getter function mutex avoid deadlocks , multiple constructions. call of below meant function fails directly @ first time. the function looks (log_msg macro logs given string log file): myclass& myclass::singleton () { log_msg("myclass::singleton -> jump in"); static cmutex oinitmutex; try { csinglelock osinglelock((csyncobject *) &oinitmutex, true); log_msg("!!! singleton lock okay !!!"); static myclass omyclassinstance; log_msg("!!! singleton construction okay !!!"); return omyclassinstance; } catch(...) { cstring excmsg("unexpected exception creating myclass singleton instance!"); log_msg(excmsg); throw excmsg; } } i've figured out, construction of singleton object n

iphone - Array goes empty in DidSelectRowAtIndexPath -

i have in coredatabase entity "day". in method fetch data entity , put in mutuablearray dayobjects. can see code on here. nsmanagedobjectcontext *context = [rkmanagedobjectstore defaultstore].persistentstoremanagedobjectcontext; nsfetchrequest *fetchrequest = [nsfetchrequest fetchrequestwithentityname:@"day"]; nspredicate *predicate = [nspredicate predicatewithformat: @"p_date >= %@ , p_date <= %@",datestring,datestring2]; [fetchrequest setpredicate:predicate]; nssortdescriptor *descriptor = [nssortdescriptor sortdescriptorwithkey:@"p_id" ascending:yes]; fetchrequest.sortdescriptors = @[descriptor]; nsarray *matches = [context executefetchrequest:fetchrequest error:nil]; nslog(@"matches = %@",[matches valueforkey:@"p_date"]); arrdateobjects = [matches mutablecopy]; in cellforrow this day *objday = [arrdateobjects objectatindex:indexpath.row-1];

artificial intelligence - Applying machine learning in predicting games -

i interested in applying machine learning predict next games user should go after he/ has played games. mean, next higher difficulty level game , similar user's interest. i new field of ai , ml. please me suggesting algorithms can use in project. easy implement , demo-able. thanks in advance.

c++ - Type casting issues -

i hava code snippet below: class classa { public: virtual ~ classa() {}; virtual void functiona() {cout << "classa" << endl;} }; class classb { public: virtual void functionb() {}; }; class classc : public classa, public classb { public: void functiona(){cout << "why" << endl;} void functionb(){cout << "class c funb" << endl;} }; classc aobject; classa* pa = &aobject; classb* pb = &aobject; classc* pc = &aobject; int main() { void* pvoid = static_cast<void *> (pb); classa* pa2 = static_cast<classa*>(static_cast<classc*>(pb)); return 0; } is type-cast pvoid , pa2 right? or both of them wrong? (i tried compile it, have not got errors) pvoid "right" in sense gives address of classb subobject of aobject untyped pointer. useful thing can cast classb* . note cast here redundant, since pointer can implicitly converted void* . pa2

scala - Infix method call in IntelliJ IDEA -

whenever trying use infix method call, intellij idea adds parentheses after method name. for example: val xs = list(1,2,3) if type xs contai , press enter, intellij idea completes expression follows: xs contains() but expect without parentheses: xs contains is there option disable adding parentheses infix method call? i use intellij idea 12.1 scala plugin 0.7.213. [updated] the method want call def contains(elem: any): boolean from scala.collection.immutable.list the complete expression xs contains 1 there no such option, , there no plans add in future yet. reason it's not infix call, want, it's postfix call, , after postfix call have use semicolon or line feed. both things pretty ugly, that's why in scala 2.10 warning postfix calls usages.

c# - Converting an XML file to string type -

how can write xml file string variable? here code have,the variable content supposed return xml string: public string getvalues2() { string content = ""; xmltextwriter textwriter = new xmltextwriter(content, null); textwriter.writestartelement("student"); textwriter.writestartelement("r", "record", "urn:record"); textwriter.writestartelement("name", ""); textwriter.writestring("student"); textwriter.writeendelement(); textwriter.close(); return contents; } something this string xmlstring = system.io.file.readalltext(filename); here answer create xmldocument xdocument or xmldocument

c++ cli - Convert Object to Array C++/CLi -

i using vs2010, windows forms application(c++) array<int>^ myarray = gcnew array<int>(10){1,2,3,4,5,6,7,8,9,10}; object^ myobj = myarray; but when try myobj->length error. u may ask why need object? answer is, main goal create dictionary put type value in , able access read, edit etc. dictionary<string^, object^>^ mydic = gcnew dictionary<string^, object^>; array<int>^ myarray = gcnew array<int>(10){1,2,3,4,5,6,7,8,9,10}; mydic["arrayindictionary"] = myarray; mydic["arrayindictionary"]->length;

wpf - C# chart adding data in a for-int loop -

i need one, have created chart in wpf, , in c# have following: ((columnseries)calllogs.series[0]).itemssource = new keyvaluepair<string, int>[]{ for(int i=0; i<counter; i++) { new keyvaluepair<string, int>(callhour[i], callcounter[i]) } }; now above statement doesn't work. the variables callhour , callcounter arrays pull needed data database , work fine, need way of adding data graph amount of values stored in array, if makes sense? in other words instead of using method: ((columnseries)calllogs.series[0]).itemssource = new keyvaluepair<string, int>[]{ new keyvaluepair<string, int>(callhour[0], callcounter[0]), new keyvaluepair<string, int>(callhour[1], callcounter[1]), new keyvaluepair<string, int>(callhour[2], callcounter[2]), new keyvaluepair<string, int>(callhour[3], callcounter[3]), new keyvaluepair<string, int>(callhour[4], callcounter[4]), new keyvaluepair&

iphone - Putting Byte value into NSDictionary [iOS] -

i have post web service, need send image in byte array, , need send post parameters in json format, have created nsdictionary . issue how can assign object key in dictionary byte , tried doing , application crashes while creating nsdictionary . explaining each steps code easy understanding of y question below :- here code converting image byte format :- nsdata *data = [nsdata datawithcontentsoffile:filepath]; nsuinteger len = [data bytes]; byte *bytedata = (byte*)malloc(len); memcpy(bytedata, [data bytes], len); so, have byte contain image in byte array, want assign object nsdictionary . here code, nsdictionary *dictjson = [nsdictionary dictionarywithobjectsandkeys: bytedata, @"photo", nil]; now application crashes in above line creating dictjson object, there way can pass byte nsdictionary ? also, question, how can nslog bytedata ? please me. thanks in advance! if want sent image data json array containing bytes numbers, have create array &quo

node.js - Node website returns “Cannot GET/withTxt” when hosted with xxx.js -

this code: xxx = require('./routes/xxx'); app.get('/mynodepage',routes.exxxtxt); app.post('/mynodepage', function(req,res,nextresult){ xxx.emailhtml(req,res,nextresult); }); and when run "cannot / node page". doing wrong? why getting this?

Automate using SQL Express to export to Excel (not CSV) -

i need export 20 different query results 1 excel file in seperate tabs. i know can use ssis pacakage using express addition not let me save it. running checks every fortnight looking automattion. any suggessions? are looking tool or method ? i know 2 tools can : http://www.r-tag.com/pages/reportmanager.aspx http://www.hybing.com/report-genie.html report genie free personal use , $25 business. r-tag $25, giving 1 free license per company (can requested here: http://www.r-tag.com/pages/freecrystalreportsviewer.aspx ) r-tag has scheduler (not included in free license)

AngularJS pre-render with rails -

is there way can pre render angularjs template in rails , send html client ? i want solve real problem seo, if have alternative way use <noscript> thanks reading i've read in several places using phantomjs render site on server , save result static html. phantomjs server-side rendering

How to get array data to output only intger PHP -

currently on dev site i'm using array output number of players , total players on server. via line $info['players'] = $server_cache_data[1]; it shows 1601.5.1/5empirecraft - factions - pvp!0250 as can see on website here how output in intger (numbers)? i have tried string_resize($server_cache_data[1], 4) down 4 hoping stop no luck. thank time in advanced. note output can see being feed 2 arrays players , total players controlled $info['maxplayers'] = $server_cache_data[2]; you can use php's type juggling functionality: echo intval("1601.5.1/5empirecraft - factions - pvp!0250" + 0); this returns first integer number regardless of how many digits number has. note: works if number first part in string.

Closing tags when extracting HTML from XML -

i transforming mixed html , xml document using xslt stylesheet , extracting html elements. source file: <?xml version="1.0" encoding="utf-8" ?> <html > <head> <title>simplified example form</title> </head> <body> <tla:document xmlns:tla="http://www.tla.com"> <tla:contexts> <tla:context id="id_1" value=""></tla:context> </tla:contexts> <table id="table_logo" style="display:inline"> <tr> <td height="20" align="middle">big title goes here</td> </tr> <tr> <td align="center"> <img src="logo.jpg" border="0"></img> </td> </tr> </table> <tla:page> <tla:question id="q_id_1">

jquery mobile - Programmatically changing page in JQM -

i have jquery mobile 1.3.0 app pages. have page (#menyside) in index.html, have bound event to: $(document).on('pagebeforeshow', '#menyside', function(event){ // check local storage, , times this: $.mobile.changepage("otherpage.html", { transition: "slideup"} ); } }); i check values in local storage, , based on values might want change page programmatically. works when open app first time, not when reopen app (i.e. document loaded in browser, reloaded) am binding wrong event? tried @ events in documentation didn't find better...

iis express - IISExpress 8 Cannot read configuration file redirection.config -

i'm running windows server 2008 r2 (x64) iisexpress8 , when navigating c:\program files (x86)\iis express>iisexpress.exe it says: filename: redirection.config error: cannot read configuration file any ideas start? can't find anything... i had similar issue @myles j renaming %userprofile%\documents\iisexpress\config\applicationhost.config didn't work. had following: close visual studio. rename %userprofile%\documents\iisexpress\config directory . start visual studio again. %userprofile%\documents\iisexpress\config directory recreated default config files. copy original applicationhost.config file on autogenerated one. before asks: permissions on folders identical, read-only flag not set on folder or files, , didn't modify applicationhost.config in way.

c# - what's wrong with this code (.net 2.0) -

i trying latest date using code below, goes infinte loop , displays nothing in console, public static void sortsortymydates() { int = 1; datetime[] dtlist = new datetime[20]; datetime latestdate = dtlist[1]; dtlist[1] = convert.todatetime("28/05/2013 13:00:00"); dtlist[2] = convert.todatetime("23/04/2013 13:00:00"); dtlist[3] = convert.todatetime("25/03/2013 13:00:00"); dtlist[4] = convert.todatetime("08/04/2013 13:00:00"); while(i < dtlist.length) { int result = datetime.compare(latestdate, dtlist[i]); if (result < 0) continue; else latestdate = dtlist[i]; ++i; } console.writeline(latestdate.tostring()); } you have problem loop logic: if (result < 0) continue; if result < 0 don't increment i , , loop doesn't progress.

network programming - Find Neighbour with SNMP LLDP -

i have several switches (hirschmann mach1040, rs40) connected together. want elict mac address/ip address of connected neigbour switch on port x snmp. there lldp mib_value tells me neihbour mac or ip @ specific port on swich?? thanks lot help!!! this code walking lldp oid on devices list contains ip addres , add neighbourships parallel arrays. ex; (each heading arraylist) hostname hostinterface neigbourname neighbourint sw2960 fa0/1 hp-98765 ethernet0/4 package ndmsmain; import java.io.ioexception; import java.util.arraylist; import snmphandler.snmpmanager; import snmphandler.snmpwalk; import topologyhandler.writexmlfile; public class lldpdiscovery { static snmpwalk t1 = new snmpwalk(); public static string lldp_oid = "1.0.8802.1.1.2.1.4.1.1"; public static string snmpcheck = null; //model public static string devicepid = null; //product id public static arraylist<string> topologynodeid = new a