Posts

Showing posts from August, 2014

jquery plugins - How to remove sorting option from DataTables? -

i'm using datatables plugin . don't want use sorting option (to sort columns in asc or desc order) comes default on each <thead> . how can remove sorting icon? very similar @ravisolanki07 , it's different way achieve this. var otable = $('#example').datatable( { "aocolumndefs": [{ "bsortable": false, "atargets": [ 0, 1, 2, 3 ] }, { "bsearchable": false, "atargets": [ 0, 1, 2, 3 ] } });

ios6 - Wrong orientation when image captured by HTML5 file api on IOS 6.0 -

i using html5 file api on mobile web app image uploading utility. capturing image using camera , upload server. problem if capture portrait image uploaded image automatically converted landscape. you'll need transform image correct orientation. fortunately, image should include exif data can use that. if like, can before image uploaded server: read image's exif data use canvas element transform image appropriate export canvas image image file there's excellent writeup, including code samples, in this blog post.

How to escape to binary data in python -

i'm playing pythonchallenge level8 i try un , pw directly url text = urllib.urlopen('http://www.pythonchallenge.com/pc/def/integrity.html').read() un_pat = re.compile('un: \'(.+)\'') compress_un = un_pat.findall(text)[0] but un should this un = 'bzh91ay&sya\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3m\x07<]\xc9\x14\xe1ba\x06\xbe\x084' is there simple way (except write loop myself) convert compress_un un? python offer library this? thanks >>> compress_un 'bzh91ay&sya\\xaf\\x82\\r\\x00\\x00\\x01\\x01\\x80\\x02\\xc0\\x02\\x00 \\x00!\\x9ah3m\\x07<]\\xc9\\x14\\xe1ba\\x06\\xbe\\x084' >>> compress_un.decode('string_escape') 'bzh91ay&sya\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3m\x07<]\xc9\x14\xe1ba\x06\xbe\x084'

Asp.net MVC 4 Partial Views + Views -

i'm starting construction of features using asp.net mvc, came across following question combination of views + partial views . (example) was created 1 partial view dadosfuncionario (with following fields: "id" name "," id sector "," industry "and" employee search ") in order behave web control, shared different views registration. view on main register of occurrence (typed), use helper@html.action () call action returns me partial view data employee. here question, when main action of view called register case, how values ​​of partial view dadosfuncionario (employee id, sector id)? does have suggestion?

xml - is xsi:schemaLocation actually used? -

i using xmllint tool check xml files against xsd schemas. appear tool invoked as xmllint --noout --schema foo.xsd bar.xml ... , not include option retrieve xsd file xml file's xsi:schemalocation attribute. moreover, in relevant w3.org specs 1 reads: the presence of these hints [i.e. xsi:schemalocation ] not require processor obtain or use cited schema documents, , processor free use other schemas obtained suitable means, or use no schema @ all. so fair in practice xsi:schemalocation attribute amounts (soft) documentation? since not practice allow incoming xml documents tell application how validate them don't see benefit. xsd location hints, schemalocation , nonamespaceschemalocation , used in production environments (i've never seen it), indeed. i see convenience method tooling used during development phases. considered interoperable way indicate xsds should used validation, intellisense, etc. say build bunch of xml files (samples), m

hover - Basic jQuery navigation color change -

i'm struggling find answer arguably 1 of basic jquery questions: i following change 'a' elements background color blue (i expect it's simple syntax issue) [i aware best done in css, trying learn jquery] html: <ul> <li><a href="">make</a></li> <li><a href="">me</a></li> <li><a href="">blue</a></li> </ul> css: ul { list-style:none; } li { float:left; } { display:block; text-decoration:none; background-color:red; height:40px; width:100px; margin-right:1px; text-align:center; line-height:40px; color:white; } jquery: $('a').hover(function() { $('a').css('background-color', 'blue'); }); the jsfiddle here: http://jsfiddle.net/liquidengine/jrm2k/2/ there's nothing in jsfiddle. need @ code , try , understand it's trying do. i

C# HttpClient, getting error Cannot add value because header 'content-type' does not support multiple values -

httpclient serviceclient = new httpclient(); serviceclient.defaultrequestheaders.add("accept", "application/json"); httpcontent content = new stringcontent(text); content.headers.add("content-type", "text/html"); var response = await serviceclient.postasync(new uri(_serviceurl), content); this code. want post, , set content type text/html, when above error. i can set content type seems via content.headers.contenttype don't know how specifcy "text/html" if that. can help? haven't got .net 4.5 ready, according httpcontentheaders.contenttype , mediatypeheadervalue , should this: content.headers.contenttype = new mediatypeheadervalue("text/html");

Android media player error (1, -2147483648) -

this link i'm trying play audio no luck. my code is: mediaplayer player = new mediaplayer(); player.setaudiostreamtype(audiomanager.stream_music); try { player.setdatasource("http://www.nomadicsmart.com/co-notes/files/testsong_20_sec.mp3"); // player .prepare(); player.prepareasync(); player.setonpreparedlistener(new onpreparedlistener() { public void onprepared(mediaplayer mp) { log.d("f","media3"); mp.seekto(0); mp.start(); } }); // player .seekto(0); } catch (illegalargumentexception e1) { e1.printstacktrace(); } catch (securityexception e1) { e1.printstacktrace(); } catch (illegalstateexception e1) { e1.printstacktrace(); } catch (ioexception e1) { e1.printstacktrace(); }

spell checking - Telerik error: Could not load type 'Telerik.WebControls.Dialogs.SpellCheckControl' -

i getting following error while trying build asp.net websie. error 1 not load type 'telerik.webcontrols.dialogs.spellcheckcontrol'. d:\myapp\radcontrols\spell\dialogs\controls\spellcheck.ascx this working fine earlier, developers facing issue, , unable build application. what possible reason? can share of source of spellcheck user control? are getting error server-side? it sounds registration of ajax controls in project has gotten hosed, try re-registering controls project within visual studio running telerik - "radcontrols asp.net ajax" - configure project

How to replace old files with new files in android sqlite database? -

i have build application in getting files , folders server (using .net web services), have class broadcast reciever in want implement method app call services check whether new version there or not , if yes replace new 1 in local sqlite database, have created... question how replace old files new 1 server local sqlite database? edit: replace new files old in phone storage. if understand question correctly, trying update local files on local phone storage new files retrieved web server, right?? to update files locally, gonna assume have 2 arrays of filepaths oldfilepaths , newfilepaths i iterate , delete old ones , put new ones this: foreach(var oldfilepath in foldfilepaths) { var oldfilename = path.getfilename(oldfilepath); // assumes files (old , new ones have same name). // , saving new files in temporary folder. var newfilepath = newfilepaths.tolist().firstordefault(f => path.getfilename(f) == oldfilename); if (newfilepath != null) {

oracle11g - Oracle SQL unsigned integer -

in oracle, equivalent mysql's unsigned? i have following query, doesn't work: create table foo ( id int unsigned not null primary key ); edit: purpose save space, because fields won't using negative values. alternatively, answer question of confirms i'm asking impossible in oracle 11g, or if it's possible, not straightforward (more 3 lines of code per unsigned int). also, it's not int . use smallint , tinyint. if want match restrictions shown here , can use check constraint: sql> create table foo (id number primary key, constraint foo_uint_id check (id between 0 , 4294967295)); table created. sql> insert foo (id) values (-1); insert foo (id) values (-1) * error @ line 1: ora-02290: check constraint (scott.foo_uint) violated sql> insert foo (id) values (0); 1 row created. sql> insert foo (id) values (4294967295); 1 row created. sql> insert foo (id) values (4294967296); insert foo (id) values (4294967296) * err

Handling of C++ Dependencies (Cross Platform) -

i have impression question asked hundred times, never answered. i working on smallish project, @ point should released big 3 pc platforms (windows, mac & gnu/linux), locking technology bad idea. luckily unfortunately, now, during development, target 32-bit windows. on code level, cross platform development relatively easy, if pick right libraries. building software on multiple platforms relatively straight forward, looking using either gyp or cmake. the problem dependencies. build project need: sdl, sdl_image, sdl_ttf, iconv, libxml2, libxmlmm, sigc++, wxwidgets, glew, bullet, openalsoft , maybe more added later. so far have found 3 options: check in sources , build them part of project check in binaries manage dependencies outside of source tree the first seems overkill, since need maintain fork of library , custom build system. the second option sounds thing when target 1 or maybe 2 platforms. if count different targets, including 32/64 bit variants, starts

html - Child elements ignore parents width after applying box-direction property -

fairly simple question, can't seem find fix simple problem. have list of elements need reversed specific reasons, needs done css only, since backend generates normal list. the box-direction property perfectly, after applying it, child elements totally ingore parents width , display next each other, overflowing out of parent box. how can fix this? <div> <p>cat</p> <p>dog</p> <p>horse</p> </div> div { width:50px; height:100px; background-color: red; display:-moz-box; -moz-box-direction:reverse; display:-webkit-box; -webkit-box-direction: reverse; display:box; box-direction:reverse; } p { width: 50px; } example: http://jsfiddle.net/keyqm/2/ there's quite few things going on here. first of all, properties old flexbox module should never used without modern properties go them. old specification incomplete , firefox implementation in particular

hadoop - Restart task tracker and job tracker service (task tracker and job tracker) in CDH4 -

how restart task trackers , job tracker using cdh4 command line? i tried following given script got error [root@adc1210765 bin]# ./stop-mapred.sh /usr/lib/hadoop-0.20-mapreduce/bin/../conf no jobtracker stop cat: /usr/lib/hadoop-0.20-mapreduce/bin/../conf/slaves: no such file or directory i want restart instance of tasktracker running @ cluster nodes you must on each of task trackers sudo service hadoop-0.20-mapreduce-tasktracker restart and on job tracker sudo service hadoop-0.20-mapreduce-jobtracker restart you can use stop , start in place of restart. might have change hadoop version number. http://www.cloudera.com/content/cloudera-content/cloudera-docs/cdh4/latest/cdh4-installation-guide/cdh4ig_topic_11_3.html?scroll=topic_11_3

hadoop - Caching session data -

a project working on requires huge amounts of data cached various services can access , operate on (one service writes cache , multiple services read , operate on it). data valid single session only. keeps changing , has reloaded each session. may naive question. can big data technologies hadoop of use here. take @ redis . provides in-memory data structures lists , sets. furthermore possible let saved keys expire after defined amount of time (in case, session timeout). depending on amount of data hbase or cassandra might option well.

Google Custom Search while in development -

Image
i'm doing redesign client. on new site i'd use google custom search (cse) search engine. while i'm in development can't let google index new site horrible mess of duplication , half-done pages swimming around in googles index. so how test , refine search result google cse on development site before launch? thanks, daniel your sites have added webmaster tools account. once added test sites, able crawl pages site search robots.txt file in index disallows site searching. i able crawl page verify checked url in webmaster tools , says page still hidden main google index. added same url custom search index , if found fine. so allow search test site keep hidden world search.

internet explorer 8 - IE8 Screen Resize Called on jQuery Toggle -

i'm having issues ie8 (imagine that...) when i'm calling function on screen resize. function calling set of responsive tweaks designed make site more usable on mobile devices. call function on page load , after screen has been resized. issue i'm experiencing occurs when use jquery toggle on scree, such search box. according ie8, each time toggle something, triggers screen resize function , then hides stuff toggled. i created gist sample code because pastebin , ie8 don't seem work together. https://gist.github.com/johns996/5501932 simple solution problem, check if resize did resize window: //run tweaks on page resize var x,y; var w=$(window).resize(function() { var newx=w.width(); var newy=w.height(); if(x!=newx || y!=newy){ // run code... } x=newx; y=newy; }); just tested in ie8 , works.

html - Can't get CSS ellipsis to work -

Image
i'm new whole responsive web design , i'm building simple todo app learn angularjs. trouble how can handle text long , breaks layout. here can see how breaks. the html&css : note: wrapped <div class="span12"> <li> <div> <span class="taskshorter">{{t.taskname}}</span> <div class="pull-right"> <span class="label label-info ">{{t.estimatedtime}}</span> <span class="label label-important">{{t.estimatedtimeleft}}</span> <i class="icon-chevron-right"></i> </div> </div> </li> and css .taskshorter { overflow: hidden; white-space: nowrap; -ms-text-overflow: ellipsis; text-overflow: ellipsis; width: 20px; height: 1.2em; } but dosen't seem work. should rather write javascript code clip text or missing can fixed? also i&#

java - Command prompt doesn't open with Runtime.getRuntime().exec -

i've created gui (swing) executes batch file contains command prompt .exe file execution specific parameters. when run batch file manually (by double clicking it), expected. problem is: command prompt window doesn't open show progress, moreover, doesn't start work (only initiated) until exit gui (forking?). when starts work, works somewhere in background , seen in task manager. blank command prompt window opened. from digging little bit around, i've constructed command gives me same result above: runtime.getruntime().exec("cmd.exe /c start \"encoding\" cmd.exe /c start md \"" + gui.outputdirfield.gettext() + "\\encoderoutput\" & cd \"" + gui.outputdirfield.gettext() + "\\encoderoutput\" & \"" + gui._batfile + "\" & pause"); could please assist? sorry if sounds stupid.. this way works me: new thread() { @override public void run() { try { runtime.getrunt

c# - Transform IEnumerable<Task<T>> asynchronously by awaiting each task -

today wondering how transform list of tasks awaiting each of it. consider following example: private static void main(string[] args) { try { run(args); console.readline(); } catch (exception ex) { console.writeline(ex.tostring()); console.readline(); } } static async task run(string[] args) { //version 1: compile, ugly , list<t> overhead var tasks1 = gettasks(); list<string> gainstrings1 = new list<string>(); foreach (task<string> task in tasks1) { gainstrings1.add(await task); } console.writeline(string.join("", gainstrings1)); //version 2: not compile var tasks2 = gettasks(); ienumerable<string> gainstrings2 = tasks2.select(async t => await t); console.writeline(string.join("", gainstrings2)); } static ienumerable<task<string>> gettasks() { string[] messages = n

Nullable datetime to datetime converter automapper -

i have situation dtos require datetime properties pocos use nullable datetimes. avoid having create formember mappings every property condition created itypeconverter<datetime?, datetime> . problem ran when both dto , poco have nullable datetimes converter called. destinationtype datetime though property nullable datetime. idea how make converter run actual nullable datetimes? public class foodto { public datetime? foodate { get; set; } } public class foopoco { public datetime? foodate { get; set; } } class program { static void main(string[] args) { mapper.createmap<foodto, foopoco>(); mapper.createmap<datetime?, datetime>() .convertusing<nullabledatetimeconverter>(); var poco = new foopoco(); mapper.map(new foodto() { foodate = null }, poco); if (poco.foodate.hasvalue) console.writeline( "this should null : {0}", poco.food

html - Why does refreshing a page take longer to load than when directly linking to the page? -

i'm working on optimizing site, , have noticed find peculiar. when refreshing page, load time of ~1 - 1.5 seconds. (i'm using page speed extension google chrome). but, when click link page page, loads in ~0.5 - ~0.8 seconds. causes this?

c++ - Why doesn't default assignment operator call the destructor first? -

so in following example, cause class foo replace *this = foo() . i'm glad tested because turns out in circumstance, destructor of old foo doesn't called. guess that's because default assignment operator uses memcpy ... language design question ... why wouldn't make default assignment operator destroy assigned-to object first prevent accidents? http://codepad.org/9wco6yz5 #include <iostream> using namespace std; class mustbedestroyed //(for reason not shown here) { public: int i; mustbedestroyed(int i) : i(i) {} ~mustbedestroyed() { cout << "destroyed contained class " << << endl; } }; class foo { public: mustbedestroyed x; foo(int y) : x(y) {} void replace_myself(int y) { foo f(y); *this=f; } void print() { cout << "this outer/inner class " << x.i << endl; } ~foo() { cout << "destroyed outer class " << x.i << endl; } }; int main() { foo a(1); a.p

php - Facebook's api- wall updates(photo) with hover state -

i'm not sure if best place ask question how pict.com post photo has hover effect on user's facebook feed? i've been researching 2 days now, know facebook can allow third party app post status updates, photos etc user's wall(with consent of course), how make image have hover effect, have no clue. love build if can nudge in right direction. ref pict.com http://blog.pict.com if image hovering on users actual facebook wall, might browser extension, work facebook api, (which around 1 year ago), impossible due security reasons, code running on users wall, the image have hover effect on app, once posted on wall hover effect disappear, due being controlled different code,

html - How to trigger animation after user scroll to N points - jQuery waypoints with multiple animation .animate() -

i need help! basic idea: want when user scroll 1 point (in middle of pages - let it's 500px top) have animation, of course won't ask how animation stuff, need give me basic idea callback callbacks mean : after 1st animation, 2nd animation, 3rd animation. how approach this? scenario : let have 4 boxes, , have color red, blue, orange , pink. after user scrolled 500px top - want first red box fadein 2 seconds that, want red box fadeout, , blue box fadein. in original idea, need them rotate or other animation - if great :) , please ignore point if think i'm asking much tools : jquery waypoints http://imakewebthings.com/jquery-waypoints/ maybe jquery transit ? http://ricostacruz.com/jquery.transit/ <!doctype html> <html> <head> <title></title> <meta charset="utf-8"> </head> <body> <div id="container"> <div class="red box"></div> <div c

iphone - Take screenshot with Kif -

i want take screenshot in kif. saw here in private class in kif project possible, having hard time trying convert step. can help? this added in kif 3.0.4. see here .

php - Date range selection from form then export CSV from MySQL data with selected range -

i have database csv export working fine, want user able select date range export process. here html part date select (format of date mm/dd/yyyy ): <form action="csv_export_arp.php"> <p>select date range </p><label style="color:#fff;" for="from">from</label> <input type="text" id="from" name="from" value="from" /> <label style="color:#fff;" for="to" >to</label> <input type="text" id="to" name="to" value="to"/> <input name="export" type="submit" value="export pending arp csv" /> </form> my csv export works apart date range= $sql_query = "select ticket_number 'ticket number', first_name 'first name', surname 'last name', email 'email address', product 'product', retailer 'retailer', dop 'date

php - how to properly initialize a new class and pass a value to use for it's methods -

say have following class: class item{ public $itemid; public $itemattribute; function __construct($itemid){ $this->itemid = $itemid; } public function getdata(){ $this->itemattribute = foo($itemid); } } then i'm initiating new object code: $item = new item($itemid); $item->getdata(); var_dump($item); basically trying do, define $itemid when initialize object, , when call $item->getdata , have perform function, using defined $itemid . first class , attempt writing oop scratch, bear me. problem $itemid isnt being passed foo function within getdata . the approach seems right (except need use $this-> access property), but: flavour , have @ how getter , setter normaly used. getter should return something, while setter sets something. if need "something" internal, should use method, or in constructor, etc.. class item{ public $itemid; public $itemattribute; function __construct($itemi

asteriskami - Asterisk AMI - UpdateConfig not working -

we using asterisk (8.1.11)/freepbx (2.10.1.9). trying modify voicemail.conf using ami. the line in voicemail.conf i'm trying modify looks like: 2999 => 1234,hotline,,someemail@company.com,attach=no|saycid=yes|envelope=yes|delete=no i'm trying modify notification email address. using telnet port 5038 enter following: action: login username: username secret: password action: updateconfig srcfilename: voicemail.conf dstfilename: vmtest.conf action-00000: update cat-00000: default var-00000: 2999 value-00000: >1234,hotline,,email@example.com,attach=no|saycid=yes|envelope=yes|delete=no actionid: 123456789 this results in: response: success actionid: 123456789 this has effect of creating file "vmtest.conf", update not occur. i've tried adding new categories, deleting variable, appending new variables - report success, nothing changes. i don't have hair left pull out @ point! suggestions? if exact code, m

ios - Press Button on ViewController which pushes to TabBarController with UINavigation Bar? -

i developing app plan distribute soon, having trouble storyboard configuration. want have view displays 4 buttons on , when 1 button pressed pushes different view @ tabbar installed on it. wanted know how this, app strava has exact same thing want. have programatically , if how, or should in storyboard, , if how? appreciated. thanks

.htaccess - htaccess redirect url with domain as variable to an external site -

i want redirect http://example.com/report?domain=dollarshaveclub.com to http://www.semrush.com/info/dollarshaveclub.com+%28by+organic%29 i've tried: rewriteengine on rewritebase / rewritecond %{query_string} ^?domain=$ rewriterule ^report$ http://www.semrush.com/info/$1+%28by+organic%29 [r=301,l] but i'm not getting anywhere...what try next? you must remove r=301, part. this works me: rewriteengine on rewriterule ^report$ http://www.semrush.com/info/$1+%28by+organic%29 [nc]

asp.net - Twitter Bootstrap Buttons - Server Side code -

i want use twitter bootstrap button , add button click event in asp.net / vb.net in code behind. difference between twitter button is html input , asp:button different. how target twitter bootstrap button in code behind? <button class="btn btn-large btn-primary" type="button">add bookshelf</button></p> use cssclass property sample button mybutton= new button(); mybutton.text = "first"; mybutton.cssclass = "btn btn-large btn-primary"; this.form1.controls.add(mybutton); now button became bootstrap button :p

"Column 'created_date_time' cannot be null" Django -

views.py def when(request): if request.method == 'post': reportform = reportform(data=request.post) if reportform.is_valid(): log.debug("test:%s",reportform) report = reportform.save(commit=false) report.user = request.user report.save() models.py is class report(models.model): user = models.foreignkey(user, null=false) incident_number = models.charfield('incident number', max_length=100) device_id = models.charfield('device id', max_length=100) app_uuid = models.charfield('unique app id', max_length=100) created_date_time = models.datetimefield('created') manual_date_time = models.datetimefield('another time', null=true, blank=true) sent_date_time = models.datetimefield('sent') in above model ,manual_date_time manually enter user.but created_date_time , send_date_time should generated django since function n

c# - Mapping XML to Unrelated Objects -

i'm designing process xml files our client , load them our database, creating order on our side. the snag is, , isn't there one?, client's xml doesn't resemble business objects use load data our database. so have design way format specify our custom objects. i'm considering creating "on fly" custom objects xml , coming "map" translate objects ours. that's head @ right now. essentially don't want write data-load process supports data, want data our format. i know design question i'm throwing out idea see if rings true else. or if has done , has suggestion, i'm open hearing it. thanks! from tag, c# , xml, generate event upon file reception (os level) triggers small app have make. structure wise, go companyname.object1. read on xdocument parsing , not. xelement , attributes. bottom line, looks crm kind of implementation , implementation experience, it's longuest process: parsing of incoming data. you

xslt - Search for a IF-ANY solution that works with <XSL:for-each> -

i searching solution following problem: currently have code: <div class="box"> <div class="header"> <h2>item</h2> </div> </div> <xsl:for-each select="umbraco.library:getxmlnodebyid($source)/* [name() = $documenttypealias , string(umbraconavihide) != '0']"> <xsl:if test="string(experuserid)=$currentpage/experuserid"> <xsl:value-of select="@nodename"/> <xsl:value-of select="subtitel"/> <a href="{umbraco.library:niceurl(@id)}" class="readmore"> lees meer </a> </div> </xsl:if> </xsl:for-each> this code produces result for-each time source(experuserid) equals currentpage/experuserid. the problem when test comes negative , there no experuserid's match currentpage. want make when occures, layout won't show. ne

optimization - Storing tables in java for refrencing -

so question regarding optimization of code. have table retirement date im going list below year of birth full retirement age 1937 or earlier.............................65 1938........................................65 years 2 months 1939........................................65-4 1934.......................................65-6 . . .and list long list what want store table in in list object or can pass in year of birth in method , list object , corresponding retirement age. dont want have lot of if , else statements in code because list damn big , code confusing. what can possible solution problem? in advance try using map instead of list. use year of birth key, can directly associated value map.

android - Sqlite Database Query returns null -

i have database , mthod values every table. however, want table rows route = 5 (for example) this query: cursor cursor = db.query(table_name_routes, new string[] {"id","route","busstop","longitude","latitude"}, "route" + "=" + busroute , null, null, null, null); i've tried tons of different versions of clause, none seem work, list returned size 0, when should size 20. edit: changed line to: cursor cursor = db.query(table_name_routes, new string[] {"id","route","busstop","longitude","latitude"}, "route" + "=`"+ busroute+"`" , null, null, null, null); log logcat 05-02 18:14:23.396: e/sqlitelog(15408): (1) no such column: 5 05-02 18:14:23.396: d/androidruntime(15408): shutting down vm 05-02 18:14:23.396: w/dalvikvm(15408): threadid=1: thread exiting uncaught exception (group=0x40cee300) 05-02 18:14:23.400: e/an

c# - Reading from a file into a string array. Then .Split the code into 3 more arrays -

alright. i'm having problem. have load student data text files, , put them class called students. so far- const string student_file = @"c:users\etc\etc\students.txt"; students students = file.routines.loadstudents(student_file) then class fileroutines uses it's method static public string [] loadstudents(string student_file) to read file line line , create string array each line. (this have far, wasn't given work with.) string[] students = file.readalllines(students_file); the instructions have "read lines in student input file, create student object each line. return students object contains array of students objects. and end of all, array supposed end in students class. i'm supposed .split('\t') on students array , split 3 more arrays. the file i'm working has data set so. 122338 weltzer teresa 123123 wang choo 123131 adams james 123132 binkley joshua 123139 howard tyler 123160 king alma after code

angularjs - Angular - Jasmine can real XHR be executed? -

i not want have $http mocked. main reason writing integration tests want have ajax requests executed. in tests none gets triggered. suggestion more welcomed. the angular mocks provide mocked $httpbackend when using jasmine tests, actual $httpbackend still exists. need tell provider use original when inject service. in test: var original_http_backend = null; angular.module('ng').config(['$httpbackendprovider', function($httpbackendprovider) { original_http_backend = $httpbackendprovider; }]); beforeeach(module(function($provide) { $provide.provider('$httpbackend', original_http_backend) })); it's worth pointing out approach, in general, bad way test front end code. because adds backend dependency, cannot isolate front end behavior. preferred mock out response , test that. i did end using feature though, since our mock responses developed on end testing there, , didn't want repeat objects. method allowed me use them.

java - notifyall() not the last statement -

assume have read/write monitor implementation in java. several readers or 1 writer can access database @ 1 time (not both) class rwmonitor{ private int readers = 0; private boolean writing = false; public synchronized void startread(){ ..} public synchronized void endread(){ notifyall(); readers--; } public synchronized void startwrite(){ ..} public synchronized void endwrite(){ notifyall(); writing = false; } } now, matter if notifyall() not last statement in synchronized method? assume: 1) endread() executes 2) notifyall() notifies waiting threads 3) reduces reader count. when executes notifyall() , more costly since woken threads waiting lock on rwmonitor released? (assuming thread has lock on rwmonitor still @ readers--; ) it not matter if last statement. to quote javadoc notifyall() : the awakened threads not able proceed until current thread relinquishes lock on object.

machine learning - How WEKA compute Sum of Squared-Error Value or SSE? -

i new weka. i know how weka sse value of simple k-means algorithm? my friend , implemented java implemented k-means algorithm, , same dataset, our java implemented algorithm sse value of around 400 while weka around 2000. how possible? my friend said weka uses k-means++. 1 of reasons make them have different result? any idea appreciated. , please correct me if there's wrong. love learn. have normalized data? different normalization cause both different results , different sse values. also try exporting result, , using same implementation compute both sse values.

Rails Fullcalendar set certain events editable -

i'm using fullcalendar in rails. following code event model creates json fullcalendar events. i want event editable: true if event.maxsynch = "n" this code: def as_json(options = {}) { :id => self.id, :title => "#{self.workorder.wonum} #{self.title} #{self.hours}", :description => self.description || "", :start => starts_at.rfc822, :end => ends_at.rfc822, :allday => self.all_day, :recurring => false, :editable => false if self.maxsynch == "n" :true, :url => rails.application.routes.url_helpers.event_path(id), :color => "blue", :backgroundcolor => "blue", :bordercolor => "black", :textcolor => "white" } end the line :editable => false if self.maxsynch == "n" :true, wrong. how can fix it? thanks help!! if understand question correctly, trying use c

sql server - SQL choose first of duplicate results -

hello have query returns computer names corresponding ip adress follows: select distinct top (100) percent dbo.inv_aex_ac_tcpip.[ip address], dbo.inv_aex_ac_tcpip.[host name] dbo.inv_aex_ac_identification inner join dbo.inv_aex_ac_tcpip on dbo.inv_aex_ac_identification._resourceguid = dbo.inv_aex_ac_tcpip._resourceguid this returning results such as: computer: ip: frank's computer 10.0.0.1 frank's computer 10.0.0.3 nick's computer 10.0.1.0 is possible return first "frank's computer" row, , exclude other one? thanks! yes, possible, how depends on dbms of choice. functionality looking group by , puts similar results in same column, need know non-aggregated values, putting them in aggregate function max , min or avg . your results fine this: select min(dbo.inv_aex_ac_tcpip.[ip address]) ip, dbo.inv_aex_ac_tcpip.[host name] name dbo.inv_aex_ac_identification inn

log4net - How to use ExtendedLog4netLogger.cs to set logfile path for appender at runtime? -

i trying figure out how use extendedlog4netlogger.cs change log file path dynamically @ runtime or using loggingfacility? this should similar using log4net directly this: log4net.globalcontext.properties["logname"] = logname; how access extendedlogger if register log4net integration this: container.addfacility<loggingfacility>(f => f.uselog4net()); update: use following code register extended logger container.addfacility<loggingfacility>(loggerimplementation.extendedlog4net).withconfig(configfile).tolog(lo‌gger)); i no runtime exceptions , logger not null instance don't see log file created @ using global properties, set config value appender: <file type="log4net.util.patternstring" value="%property{logname}" /> if set file property in config file full path work. wondering if not working because configuration done before setting global variable. extendedlogger.globalproperties["logname"] =

ListItem not displayed in second activity in android -

i have made simple listview demo in android. want when item list selected should displayed on next activity,i have tried following code: act1.java package com.example.listview; import java.util.arraylist; import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.arrayadapter; import android.widget.listview; import android.widget.simpleadapter; public class mainactivity extends activity { listview ls; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ls=(listview)findviewbyid(r.id.lv); string[] s = {"ahmedabad","baroda","chndigarh","delhi","jharkhand","hariyana","ilahabad","jammu",&

mongodb - How to query a collection that matches the exact fields of objects in array -

how query collection matches exact fields of objects in array? since test case more explicit, here test pass. a = invitation.create(guests: [ guest.new(player: 'bbb'), guest.new(player: 'ccc') ]) b = invitation.create(guests: [ guest.new(player: 'ccc'), guest.new(player: 'bbb') ]) c = invitation.create(guests: [ guest.new(player: 'bbb'), guest.new(player: 'ccc'), guest.new(player: 'ddd') ]) # request find invitation bbb , ccc player_id of guests, regardless order. result = invitation.collection.find(...) assert_equal result, [ a, b ] my use case invitation system same combination of guests can't exist, when new invitation sent, need check if 1 exact same guests (regardless order). note: use array of guest objects since carry additional data. here example data set ( https://gist.github.com/anonymous/5507735 ). based on answer nyde1319; feels hackish, since there's no other answers yet here goes: db.i

pointers - C - Struct maker function causes different errors -

i have function fills pointer struct. fill gtk callback, use global pointer current "nivel" i'm using accesible other functions. i'm afraid may have memory problems. the point is, believe memory being "filled" alright. but, program gets out of function calls function make struct, 1 of several outcomes: 1 - error: glibc detected corrupted double linked list 2 - error: glibc detected 3 - segmentation fault. 4 - no error @ all. the error changes execution execution, tells me it's gotta memory, perhaps i'm not handling scope of struct correctly, can't find solution it. i'm pretty sure struct being made correctly, though. appreciated. code bellow, has parts ins spanish i've commented important bits. help! //struct, consists of 2d array , size info. struct nivel { size_t filas; size_t columnas; int **mapa; }; //global current level pointer, fill call function within function. struct nivel *nivel_actual; //fun

debugging - VB.NET Debug.Print not working, breakpoint disappears -

i have vb.net application run in debug mode. have 3 lines dim svalue$ svalue = "test" debug.print svalue when not running, set breakpoint on lines svalue = "test", , on line debug.print svalue. now when start debugging, breakpoint on line debug.print svalue disappears, , debug.print not performed. however, breakpoint on line svalue = "test" stays there. does know might go wrong here? switching x86 anycpu helped. strange.

c++ - Segmentation fault : Address out of bounds for a pointer in C -

i trying build , run complicated code written else, don't know , can't ask them help. code reads bpf (brain potential file) , converts readable ascii format. has 3 c files, , 2 corresponding header files. got build minor changes, crashes segmentation fault. i narrowed problem down findsectionend() (in readbpfheader.c) , find error occurs when sscanfline() (in file sscanfline.c) called (code both below). ui1 defined unsigned char. si1 defined char. just before returning sscanfline(), address pointed dp 0x7e5191, or similar ending 191. however, on returning findsectionend(), dp points 0x20303035 , says 'address 0x20303035 out of bounds', causes fault @ strstr(). loop in findsectionend() runs without problem 14 iterations before fault occurs. have no idea going wrong. hope information have given here adequate. ui1 *findsectionend(ui1 *dp) { si1 line[256], string[256]; int cnt=0; while (sscanfline(dp, line) != eof){ dp = (ui1 *)strstr(dp,

c - Are the effects of hand-optimization of code consistent across different gcc optimization levels? -

if run gcc -o0 , , hand-optimize code using techniques such ones mentioned here , case optimized code run faster unoptimized code when run gcc -o3 ? that is, if hand-optimize code under particular compiler optimization level, true these optimizations still productive (rather counterproductive) under different (higher or lower) compiler optimization level? it might not same in different compiler. compiler can away hand optimization, mean ignore them. heavily depends implementation , behavior of compiler itself. of optimizations request compiler, can dropped @ time, (mostly without notification)

internet explorer 8 - Google Apps Script Gadget not displaying properly in web browsers -

on www.onsitebac.com/viewmyblows google site i've inserted apps script gadget (by pasting url of apps script published service). apps script gadget allows user enter value (their 'blow number') , view corresponding data (based on api calls google fusion tables). the problem apps script gadget not load expected. not load @ in ie8 , loads 'this application created user, not google' message in chrome , firefox. want application load part of web page (with no messages or errors). please advise...thanks! the google message appear no matter, long user hasn't disabled message in past. not see either, it's policy. as not displaying in ie8. couple things, google doesn't ie, , not older versions. google fond of saying "gas works in modern browser." and, don't count ie 1 of those. but haven't provided code... i'm going take guess due styling. i'd used answer offered in applying dry principle in google apps scr

c++ - Computer precision: when should I have to worry about it? -

in c++ programming, when need worry precision issue? take small example (it might not perfect 1 though), std::vector<double> first (50000, 0.0); std::vector<double> second (first); could possible second[619] = 0.00000000000000000000000000001234 (i mean small value). or sum = second[0]+second[1]+...+second[49999] => 1e-31 ? or sum = second[0]-second[1]-...-second[49999] => -7.987654321e-12 ? my questions: could small disturbances in working double type numbers? what may cause these kind of small disturbances? i.e. rounding errors become large? please list them? how take precautions? if there small disturbance in operations, mean after these operations, using if (sum == 0) dangerous ? 1 should use if (sum < small) instead, small defined small value, such 1e-30 ? lastly, small disturbances result negative value? because if possible, should better use if (abs(sum) < small) instead. any experiences? this reference document floating p

asp.net - Change associated textbox color with jquery on client validation -

i want use jquery select associated element's parent required , change css class. i need add css class "error" parent div of span required field. (this color textbox according css). i have following html markup gets generated aspx page: <div class="control-group"> <label>your name</label> <input name="ctl00$maincontent$txtname" type="text" maxlength="100" id="maincontent_txtname"> <span data-val-controltovalidate="maincontent_txtname" data-val-errormessage="your name required" data-val-display="dynamic" id="maincontent_txtnamerequired" class="error" data-val="true" data-val-evaluationfunction="requiredfieldvalidatorevaluateisvalid" data-val-initialvalue="" style="display:none;">this field required</span> </div> after "client validation" span gets changed to: <s

edit - backbone.js beginner attempting to load data -

attempting post beginner question not making past "quality standards" filter. read through thread on error message. beginner questions basic? understandable might better put in error message. include code , english correct outside of code block. question has not been addressed, or @ least not returned various search patterns. there anyway appeal filter multiple rewrites have not cleared hurdle or solved my, admittedly beginner, problem? in last ditch attempt hack filter i'm pasting original question in bellow few english edits. edit - seems have worked leaving above paragraph in not jinx it. trying load data backbone render function not firing. firebug shows arriving correct data string. have attempted assign "this" variable , fire function still no luck. (function($) { var dobj = backbone.model.extend({ defaults: { dstring: 'dstring again' }, }); var mobs = backbone.collection.extend({ defaults: { model: dobj }

c# - Globally convert UTC DateTimes to user specified local DateTimes -

i storing datetime fields utc time. when user requests web page, take preferred local timezone (and not local timezone of server machine) , automatically display datetime fields in web forms local dates. of course, apply conversion on every datetime.tostring() call in every form or implement helper utility time consuming task, , there 3rd party components tricky configure custom datetime display templates. essentially, make datetime class behave follows: from moment on web request, whenever code calls datetime.tostring(), convert local time using timezone offset given @ beginning of web request, if possible, please keep .net core library datetime.tostring() calls intact (i don't want mess event logging timestamps etc.) is there way it? btw, using asp.net mvc 4, if matters. you can't directly asked for, suggest alternatives. nicholas pointed out, there nothing in http give time zone directly. option 1 first, decide type of time zon