Posts

Showing posts from March, 2012

html - Clear bootstrap styling for part of a page -

i'm trying setup preview box html editor on 1 of pages. made standard <div id="preview"></div> style container, in drop html source, , works fine enough. the problem is, bootstrap's styles seeping container , 'poisoning' preview. see 2 solutions this: move preview iframe apply kind of clear/reset css element host preview eg: <div id="preview" class="clean-css"> </div> .clean-css { div, p: { border: 0; margin: 0; } /* bunch of reset css stuff here */ } i consider iframe clunky solution , sort of last resort. i'd rather keep stuff on 1 page. started looking various reset css stylesheets. unfortunately, seems of them geared towards equalizing differences between browsers , don't reset styles bare values (for example, blockquote keeps bootstrap styling). i can keep googling better reset-css stylsheet, or can try fill in holes in stylesheet have now. before that,...

c# - Automatic Migration and manual invocation of Update-Database -

do have manually issue update-database command in package manager console though have automatic migrations turned on? i'm running mvc4 , ef6. solution targeted .net 4 (i can't change unfortunately). edit : i'm aware of difference between code migrations require me seed existing tables. question more based towards scenario add table has no relations, think run? edit 2 : table should added automatically ============ new table definition public class inboundfile : entity { [required] public string filepath { get; set; } } ef config file public configuration() { automaticmigrationsenabled = true; automaticmigrationdatalossallowed = true; migrationsdirectory = @"migrations"; } protected override void seed(unifi.context.dbcontext context) { context.inboundfiles.addorupdate( x => x.filepath, new inboundfile { createdate = datetime.now, modifieddate = datetime.now...

Move row from csv file into existing xml file -

i'm looking solution solve problem. i have 2 files, 1 csv file ( products weights ) , 1 xml file ( products - details ). i need move 1 column csv file xml file, xml file looks like: <node> <itemnumber>10448wr</itemnumber> <ean>4014803005885</ean> <name1>equistop b</name1> <name2>equistop b, 6 volt</name2> <baanname>equistop b, 6 volt</baanname> <descriptionshort></descriptionshort> <descriptionlong> </descriptionlong> <category1>electric fencing &gt; horizont energiser &gt; </category1> <price>84.5</price> <picture_url></picture_url> </node> inside node need insert value of each row weights column. how can that? you can use opencsv( http://opencsv.sourceforge.net/ ) read csv file , dom4j( http://dom4j.sourceforge.net/dom4j-1.6.1/guide.html ) modify xml. ...

basecamp - POST /projects/123/star.json returning 400 Bad Request -

brought on git trying add new api urls php basecamp client. stars , delete stars works fine, posting throws 400. request post /1804401/api/v1/projects/234118/star.json http/1.1 response 400 bad request looks work if send project_id argument in payload. request post /1804401/api/v1/projects/234118/star.json http/1.1 request body {"project_id":234118} response http/1.1 201 created i checked our logs , see requests going through successfully. try post again, empty request body? update: aha! see requests receiving 400 response - it's happening before hit basecamp. due malformed request of kind. try reproduce using curl can troubleshoot what's occurring? hard tell url alone.

objective c - Storyboard doesn't push a view when i use "perform segue with identifier " Method -

i using storyboard normal transition between views use "performsegue identifier". there 1 view controller whom push using segues(with correct identifiers),the class associated controlled gets called story board doesn't load view. there 1 warning unbalanced calls begin/end appearance transitions <parsingviewcontroller: 0xa294940>. also when print navigation controller array shows previous view getting called twice(i.e. parsingviewcontroller) navigation array ( "<logincontroller4: 0x8d86830>", "<parsingviewcontroller: 0x8c9e760>", "<parsingviewcontroller: 0xa294940>", "<uiviewcontroller: 0x8ec31f0>" ) i sitting issue hours, not able push view controller using segue. google message , see lots of information on topic. here 1 may help: unbalanced calls begin/end appearance transitions <uitabbarcontroller: 0x197870>

php - non-dev user always has ID 0 -

i have ran serious problem must resolved before continuing development. my boss created app, him works expected - user logged in, data accessible, works. every other user, $facebook->getuser() returns 0, no matter what. obviously, i'm logged facebook, there login link in app, clicking doesn't work, nothing changes. this problem occurs users not in way connected app! i confirmed developer request app few days ago , works account, before did not work, not me, not other user tried, no matter if app public or in dev mode, technically shouldn't matter authentication. we tried many things, existing code shared on internet, code bottom of article: http://www.thegeekstuff.com/2014/03/develop-facebook-app/ (with our own app id , secret, of course) not changed anything, give ready code example. even if deleted below "$user = $facebook->getuser();" , put echo $user; die(); after that, showed user id 0. another thing i've noticed might in solving p...

Node.js Express DELETE route not working -

when trying delete item returns: cannot /posts routes.js app.delete('/posts/:id', function(req, res){ console.log("deleting"); post.findbyid( req.params.id, function ( err, post ){ post.remove( function ( err, post ){ res.render('posts.ejs'); }); }); }); posts.ejs <% posts.foreach( function( post ){ %> <p><%= post._id %></p> <p><%= post.title %></p> <p><%= post.content %></p> <a href="/posts/<%= post._id %>" method='delete'>delete</a> <% }); %> any pointers appreciated :) thanks html a element doesn't have method attribute. check legal attributes list . means links get . if want send delete request using browser option use ajax .

hyperlink - Excel "Don't update links" not working. I specifically tell Excel not to update my links, and it does it anyway, giving me an the #VALUE! error -

i have spreadsheet uses offset function in several cells. it refers date in spreadsheet. when open file, don't want excel update links instead keep values. click "don't update", anyway giving me value! error. same thing happens on different computers. how stop this? thanks! for reason, offset requires workbook open. many offset formulas can changed index function not have same restrictions =offset('c:\...\[main database.xlsx]technical'!$s481, (row(b14) -1)*1,0) would re-written as =index('c:\...\[main database.xlsx]technical'!$s:$s, (row(b14) -1)*1+481) (path removed avoid scroll bars when looking @ solution) the cell changed column reference: $s481 -> $s:$s previous cell row added index: (row(b14) -1)*1 -> (row(b14) -1)*1 + 481 column not needed, have 0 if have 3rd or 4th parameter offset function index not work, add sheet has simple ='c:\...\[main database.xlsx]technical'!a1 (and other cells n...

ios - How to push a new controller from UITableViewCell -

i've got 2 classes. 1 itemcontroller (extends uitableviewcontroller ) , itemcell (extends 'uitableviewcell'). when each cell clicked push new controller within itemcontroller 's didselectrowatindexpath . additionally, in itemcell , i've got couple of small buttons different tag each cell. when of these buttons clicked want push new controller. how can this? self.navigationcontroller.pushviewcontroller itemcell doesn't work since doesn't have navigationcontroller i prefer see solution in rubymotion if not, thats fine :) edit i've read delegate can solution i'm not sure how implement it. i've done itemcontroller: def tableview(table_view, cellforrowatindexpath: index_path) data_row = self.data[index_path.row] cell = table_view.dequeuereusablecellwithidentifier(category_cell_id) || begin rmq.create(itemcell.initwithsomething(self), :category_cell, reuse_identifier: category_cell_id).get end cell.upda...

c++ - Making prefix operator do nothing on certain circumstances -

overloading postfix operator doesn't work here program yesterday after fixed it. having trouble negate prefix operator doing if hours , days set @ zero. numdays numdays::operator--() { --hour; simplify(); return *this; } numdays numdays::operator--(int) { numdays obj1(*this); if(day == 0 && hour > 0) { hour--; } simplify(); return obj1; } if try use if state postfix operator, both of operators not work if day , hours not @ 0. how make prefix operator nothing if day , hour @ 0? first, logic seems incorrect, pointed out wimmel. think want disable operator-- when both day,hour zero. second, prefix operator should return reference. third, may have postfix operator use prefix one, don't duplicate code. all in all: numdays& numdays::operator--() { if (day > 0 || hour > 0) { --hour; simplify(); } return *this; } numdays numdays::operator--(int) { numdays copy(...

android - I Can install apk of my project but cant see it, why? -

i download project.apk mobile, install it, @ end says (done) , (open), (open) unhighlighted, go (done). when run it, cant find it, when go settings >> applications uninstall it, find it! why? :) in androidmanifest.xml check if have inside activity main activity: <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> this piece of xml informs activity considered main activity in android application. if information missing, no launcher set, means no way start activity. that's why don't see icon of application, neither can launch it.

android - Why show error IllegalStateException when setting MediaRecorder? -

my code setting mediarecorder, show error @ row set quality mmediarecorder = new mediarecorder(); // step 1: unlock , set camera mediarecorder mcamera.stoppreview(); mcamera.unlock(); mmediarecorder.setcamera(mcamera); mmediarecorder.setaudiosource(mediarecorder.audiosource.camcorder); mmediarecorder.setvideosource(mediarecorder.videosource.default); mmediarecorder.setoutputformat(mediarecorder.outputformat.mpeg_4); mmediarecorder.setprofile(camcorderprofile .get(camcorderprofile.quality_high)); mmediarecorder.setaudioencoder(mediarecorder.audioencoder.aac); mmediarecorder.setvideoencoder(mediarecorder.videoencoder.mpeg_4_sp); // step 4: set output file mmediarecorder.setoutputfile(getoutputmediafile(media_type_video).tostring()); // step 5: set preview output mmediarecorder.setpreviewdisplay(mpreview.getholder().getsurface()); // step 6: prepare configured mediarecorder try { mmediarecorder.prepare(); log....

c# - When I update a record gives the following error "Binary stream '0 'does not Contain a valid BinaryHeader" -

using system; using system.collections.generic; using system.linq; using system.text; using system.io; using system.runtime.serialization; using system.runtime.serialization.formatters.binary; namespace question { this class [serializable] public class employee { public int32 id { get; set; } public string name { get; set; } public string lastname { get; set; } } this method write record public class write { public void writerecord(employee emp) { if (!file.exists("records.dat")) { filestream savefile = new filestream("records.dat", filemode.openorcreate, fileaccess.write); binaryformatter formatter = new binaryformatter(); formatter.serialize(savefile, emp); savefile.flush(); savefile.close(); savefile.dispose(); formatter = null; } else { filestream savefile = new filestream("records.dat", filemode.append, fileaccess.write); binaryformatter formatter = new binaryforma...

Hartls Tutorial Section 3.4 rails generate controller error -

i'm following hartl's rails tutorial , when issue following command: rails generate controller staticpages home --no-test-framework it throws , error: you should not use match method in router without specifying http method. (runtimeerror) if want expose action both , post, add via: [:get, :post] option. if want expose action get, use get in router: instead of: match "controller#action" do: "controller#action" i using rails 2.1.0 , i'm wondering if creating problem? need change of syntax in route.rb file? you should having route in routes.rb have not specified http method. for example: photoscontroller show action, use: match 'photos', to: 'photos#show', via: [:get, :post] i suggest use latest version of rails 4.x , if doing rails tutorial.

Cannnot Convert int to int. Arrays C -

hello having hard time getting arrays work in functions. keep getting error called c2664 "void rannumperm_10(int)' : cannot convert argument 1 'int [10]' 'int'" don't understand how fix it... function rannumperm_10(int): void rannumperm_10(int bubble_1[]) { int onerandno; int haverand[array_size_1] = { 0 }; (int = 0; < array_size_1; i++) { { onerandno = rand() % array_size_1; } while (haverand[onerandno] == 1); haverand[onerandno] = 1; bubble_1[i] = onerandno; } return; } this program unfinished program use bubble, selection, insertion sort algorithms. can't seem populate arrays yet. trying make function being "random number permutation generator" every number random , no number repeats self. use in getting code work , solving error c2664. full code: #define _crt_secure_no_warnings #define array_size_1 10 #include <stdio.h> #include <std...

Java - Using only .substring procedure to find multiple words within a string -

i'm trying use utilize space " " separate words within string user inputs. example, user input string might "random access memory" or "java development kit." regardless of entered string, space separate each word. in addition this, cannot use .split or array, since common solutions have found far. utilizing .substring allowed. in failed attempts, have been capable of obtaining first inputted word (ex. "random"), cannot separate second , third words (ex. "access memory"). i'm not going publish failed attempts, asking if please provide code separating both second , third words entered? thanks. p.s. know used create acronyms, can part, need identify each substring. import javax.swing.*; public class threeletteracronym { public static void main(string[] args) { string wordsinput, initialinput; string first = ""; string second = ""; string third = "...

operating system - Trouble understanding preemptive kernel -

how preemptive kernel lead race conditions? if process preempted i.e. isn't kicked out of critical section . understanding race condition when several processes try access , manipulate resources concurrently right. have trouble grasping concept a preemptive kernel can start , stop threads @ point. means threads don't coordinate accesses through locks , critical sections end in race conditions. the other form of multithreading cooperative multithreading, threads can stopped @ points explicitly offer yield processor. helps prevent race conditions because threads not interrupted @ random unexpected points in processing. the downside of cooperative multithreading thread written not yield can hog processor, , why modern operating systems use preemptive multithreading rather cooperative multithreading.

printing - How do I print a list of doubles nicely in python? -

so far, i've got: x=[0.0, 1.2135854798749774, 1.0069824713281044, 0.5141246736157659, -0.3396344921640888, -0.33926090064512615, 0.4877599543804152, 0.0] print ' '.join(["%.2f" % s s in x]) which produces: 0.00 1.21 1.01 0.51 -0.34 -0.34 0.49 0.00 the problem being -0.34 1 character longer 0.51, produces ragged left edges when printing several lists. any better ideas? i'd like: 0.00 1.21 1.01 0.51 -0.34 -0.34 0.49 0.00 0.00 1.21 1.01 0.51 0.34 0.34 0.49 0.00 0.00 1.21 -1.01 -0.51 -0.34 -0.34 -0.49 0.00 to turn into: 0.00 1.21 1.01 0.51 -0.34 -0.34 0.49 0.00 0.00 1.21 1.01 0.51 0.34 0.34 0.49 0.00 0.00 1.21 -1.01 -0.51 -0.34 -0.34 -0.49 0.00 and nicer if there built in or standard library way of doing this, since print ' '.join(["%.2f" % s s in x]) quite lot type. simply adjust padding positive , negative numbers accordingly: ''.join([" %.2f" % s if s >= 0 else " %.2f...

io - Go channels and I/O -

first function readf2c takes filename , channel, reads file , inputs in channel. second function writec2f takes 2 channels , filename, takes value of each channel , saves lower value in output file. i'm sure there few syntax errors i'm new go package main import ( "fmt" "bufio" "os" "strconv" ) func main() { fmt.println("hello world!\n\n") cs1 := make (chan int) var nameinput string = "input.txt" readf2c(nameinput,cs1) cs2 := make (chan int) cs3 := make (chan int) cs2 <- 10 cs2 <- 16 cs2 <- 7 cs2 <- 2 cs2 <- 5 cs3 <- 8 cs3 <- 15 cs3 <- 14 cs3 <- 1 cs3 <- 6 var nameoutput string = "output.txt" writec2f (nameoutput,cs2,cs3) } func readf2c (fn string, ch chan int){ f,err := os.open(fn) r := bufio.newreader(f) err != nil { // not end of file fmt.println(r...

ios - Got status code = 11 on APNS notification -

i'm handling error apns send after write notification. according documentation, error code should 1-10 or 255. link: https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/remotenotificationspg/chapters/communicatingwithaps.html however, got package back: 080b00000000 command 8 fits documentation b = 11 not documented encounter before well? thank you! it happens me too. my 'notification identifier' item in frame wasn't formed. the 'item data length' must size of binary version of identifier.

html - Last item hidden with float:left -

i have weird problem, use float left menu (nav items) , last item hidden! <!-- nav --> <nav class="nav myclearfix" ng-controller="navctrl"> <a id="home" class="active" href="#home" ng-click="menu='home'" ng-class="{active: menu=='home'}"> <i class="icon-home fa fa-home"></i> </a> <div class="mysep"></div> <a id="lulu" href="#lulu" ng-click="menu='lulu'" ng-class="{active: menu=='lulu'}"> <img src="img/nav/luluface.png" alt="lulu" class="animatedperso infinite wobble"/> </a> <div class="mysep"></div> <a id="news" href="#news" ng-click="menu='news'" ng-class="{active: menu=='news'}"> <i...

c# - How can I load everything up in nhibernate 2nd level cache? -

i have asp.net-mvc site using nhibernate , sql server, there few pages quite slow because require view need queries join 25 different tables. if don't large join takes while , if multi query still seems take while its pretty ready heavy (light write) db wanted see if there way load entire object graph of database (my server has plenty of memory) 2nd level cache confident hits db. using nhibernate.caches.syscache.syscacheprovider as second level cache (not distributed cache). there flaw in idea , there recommended way of doing this? you caching query results, not entity (those separate caches) caching query's results stores ids; if not caching entities too, query issued load each returned entity (this bad) default table name mydto class mydto, that's it's looking looks query id, shouldn't using loose named query, proper loader . (see 17.4. custom sql loading) once set loader , entity caching, you'll able retrieve objects using session.get...

how to send and receive a variable from php to popup using jquery on same page without load the page -

how receive data php popup menu using jquery? <a href="#?da=<?php echo $fetch['da_ref'] ?>" class="big-link" data-reveal-id="mymodal" data-animation="fade" style="text-decoration: none"><?php echo $fetch['da_ref'];?></a> perhaps can use method of retrieving variable's value within pop-up same way attributes tag. analyse script , see happening data-... attributes. as far can see, should add new attribute tag, similar data-variable="value". a small snippet of code using jquery, following the html: <div> <a href="#" class="big-link" data-reveal-id="mymodal" data-variable="variable value " data-animation="fade">click me</a> </div> the css: a { display: inline-block; padding: 10px; color: #333; text-decoration: none; border: 1px solid #333; } the javascript: $(document).ready(funct...

php - detect tables on which I inserted something -

i know if there easy (i.e. other parse every query run) way keep track of tables on perform insert query. i need i'll able clean tables in tear down phase of tests, can sure i'll have clean database every test. i know truncate every table, looks me real overkill. i working standard php5/mysql setting. any suggestion highly appreciated i know truncate every table, looks me real overkill. for 1 time task apparently not. you'll waste more time trying solve pointless problem, gain solution ever.

c++ - How to pass pointer to template function to another function -

i got pointer function: template<typename t> struct f { typedef bool( *type)( t, t ); }; template <typename t> bool mniejsze (t pierwszy , t drugi){ if( pierwszy < drugi) return true; return false; } then define function minamax template <typename t> t minmax(t a[], int n,bool, bool (*f.type)(t,t)){ return f(a[0],a[1]); } then want pass function minmax f<int>::type f1 = mniejsze<int>; cout<<f1( 3, 4)<<endl;; int t[] = {1,2,3,4,5,6,7,8,9,10}; int n = 10; minmax(t,n,*f1); but get: c:\documents , settings\duke\moje dokumenty\andrzej1\adsadasd\main.cpp|57|error: expected ',' or '...' before '.' token| c:\documents , settings\duke\moje dokumenty\andrzej1\adsadasd\main.cpp||in function 'int main()':| c:\documents , settings\duke\moje dokumenty\andrzej1\adsadasd\main.cpp|72|error: no matching function call 'minmax(int [10], int&, bool (&)(i...

python - Unexpected output when saving/loading dictionary to/from json -

python 2.7.6 on windows 7 code use: import json settings = { "vo" : "direct3d", "ao" : "dsound", "volume" : "100", "priority" : "abovenormal"} json.dump(settings, open('settings.json', 'w')) settings = json.load(open('settings.json', 'r')) print settings in settings.json get: {"volume": "100", "priority": "abovenormal", "ao": "dsound", "vo": "direct3d"} at end console outputs: {u'volume': u'100', u'priority': u'abovenormal', u'ao': u'dsound', u'vo': u'direct3d'} what doing wrong? you doing nothing wrong; that's exact output should expecting. json deals exclusively unicode strings; u'' strings such unicode values. if strings contain characters within ascii range, you'll not...

Activiti + spring + transaction + rollback -

i want test integration of spring , activiti, stuck confusing problem. have workflow 2 service task (using jpa repository saveandflush method update database) , b in service a, actively throw new exception , transaction rollbacks, , flow stops. well, it's okay. however, how can rollback service , flow continue service b? because if service throws exception, flow stopped, , if exception caught ( flow continues), service not rollback. i use jpa repository automatically handle transaction, change manual mode take lot of efforts now. probably need new transaction every service in flow , catch exception.

Java Instant Messenger - Contact List -

i'm building first instant messaging app. using various tutorials (the new boston; head first java) have implemented working client-server can send receive/messages between one-another. i wish add advanced features,such contact list allows me add friends, see when friends online/offline. i'm trying avoid 3rd party apis (e.g. smack), wish learn basics. unfortunately, online tutorials i've read don't go beyond setting basic two-party client-server model. my question this: how implement basic contact list links below server.java , client.java? many help. server.java: import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.date;//timestamp functionality public class server extends jframe{ //inherits jframe //1. instance variables private jtextfield usertext; //where messages typed private jtextarea chatwindow; //where messages displayed private string fulltimestamp = new java...

php - How to insert data into a wordpress table using a custom function -

i have wordpress app hosted on azure, , need insert data wp_posts table, using custom function since i'm running script background job , cannot use wordpress functions since script not on wordpress folder. i've tried: mysql_query("insert wp_posts(post_title, post_content, post_status, post_type, comment_status, page_template), values($title, $sum, 'publish', 'post', 'closed', 'content.php')"); but following error: php warning: mysql_query(): attempt made access socket in way forbidden access permissions. the log file follows: [04/07/2014 09:51:47 > adf9f5: sys info] status changed initializing [04/07/2014 09:51:47 > adf9f5: sys info] run script 'data.php' script host - 'phpscripthost' [04/07/2014 09:51:47 > adf9f5: sys info] status changed running [04/07/2014 09:51:48 > adf9f5: err ] php warning: mysql_query(): attempt made access socket in way forbidden access permissions. [04/07/2014 09:51:...

knockout.js - kendogrid binding with an observable array -

i trying example of binding knockout observable array kendogrid, not successful. below code have created observable array called- allusers , array of user object. define(['kendo'], function (kendo) { function user(userid) { return { userid: ko.observable(userid), }; } var vm = { activate: activate, attached: attached, adduser: adduser, allusers: ko.observablearray([]), userid: ko.observable(), }; return vm; function activate() { return true; } function attached() { $("#grid").kendogrid({ datasource: vm.allusers, groupable: true, sortable: true, height: 250, pageable: true, pagesize: 5, columns: [{ field: 'userid', title: 'user id', width: 200 }, { command...

c++11 - Avoiding self assignment in std::shuffle -

i stumbled upon following problem when using checked implementation of glibcxx: /usr/include/c++/4.8.2/debug/vector:159:error: attempt self move assign. objects involved in operation: sequence "this" @ 0x0x1b3f088 { type = nst7__debug6vectoriisaiieee; } which have reduced minimal example: #include <vector> #include <random> #include <algorithm> struct type { std::vector<int> ints; }; int main() { std::vector<type> intvectors = {{{1}}, {{1, 2}}}; std::shuffle(intvectors.begin(), intvectors.end(), std::mt19937()); } tracing problem found shuffle wants std::swap element itself. type user defined , no specialization std::swap has been given it, default 1 used creates temporary , uses operator=(&&) transfer values: _tp __tmp = _glibcxx_move(__a); __a = _glibcxx_move(__b); __b = _glibcxx_move(__tmp); as type not explicitly give operator=(&&) default implemented "recursively...

.net - How are denormalized floats handled in C#? -

just read fascinating article 20x-200x slowdowns can on intel cpus denormalized floats (floating point numbers close 0). there option sse round these off 0, restoring performance when such floating point values encountered. how c# apps handle this? there option enable/disable _mm_flush_zero ? there no such option. the fpu control word in c# app initialized clr @ startup. changing not option provided framework. if try change pinvoking _control87_2() not going last long; exception cause control word reset again exception handling implementation inside clr. written deal aspect of fpu control word, allows unmasking floating point exceptions. detrimental other managed code not expect global state changed that. having no direct control on hardware implied restriction when run code in virtual machine. not @ easy in native code either, libraries tend misbehave when expect fpu have default initialization. particularly problem exception masking flags, dlls created bo...

python - How to overwrite array inside h5 file using h5py -

i'm trying overwrite numpy array that's small part of pretty complicated h5 file. i'm extracting array, changing values, want re-insert array h5 file. i have no problem extracting array that's nested. f1 = h5py.file(file_name,'r') x1 = f1['meas/frame1/data'].value f1.close() my attempted code looks no success: f1 = h5py.file(file_name,'r+') dset = f1.create_dataset('meas/frame1/data', data=x1) f1.close() as sanity check, executed in matlab using following code, , worked no problems. h5write(file1, '/meas/frame1/data', x1); does have suggestions on how successfully? askewchan's answer describes way (you cannot create dataset under name exists, can of course modify dataset's data). note, however, dataset must have same shape data ( x1 ) writing it. if want replace dataset other dataset of different shape, first have delete it: del f1['meas/frame1/data'] dset = f1.create_dataset(...

javascript - How to combine js and bootstrap -

i'm trying display div tag on click of 1 link here jsfiddle . but wouldn't work, brilliant suggestion please? sorry, couldn't able copy/paste code. doesn't accept long texts. thanks in advance! you can read docs bootstrap modals here: http://getbootstrap.com/javascript/#modals to show modal, need call $('#rpopup').modal('show') you should remove "hidden" attribute modal you need include bootstrap javascript work

java - Skip printing every n-th value on the x-axis for an iText/JFreeChart bar chart? -

i realize question has been asked before, other solutions have not worked out me , i'm hoping others find inconsistencies may lie. i'm using jfreechart in itext , building bar chart using method below: defaultcategorydataset dataset = new defaultcategorydataset(); string rowkey = "score"; for(int = 0; <= 100; i++) { double frequency = collections.frequency(scorelist,i); dataset.setvalue(frequency, rowkey, i+""); } jfreechart chart = chartfactory.createbarchart("", "score distribution (%)", "count", dataset, plotorientation.vertical, false, true, false); it's pretty simple way make chart (although don't know false, true, false means within createbarchart() method). problem there 101 values on x-axis , don't fit onto screen/page. i've tried drawing every 2/3/n-th value, causes graph become different entirely, want labels appear less, not actual values , graph bars themselves. every oth...

Query to count records within time range SQL or Access Query -

i have table looks this: row,timestamp,id 1,2014-01-01 06:01:01,5 2,2014-01-01 06:00:03,5 3,2014-01-01 06:02:00,5 4,2014-01-01 06:02:39,5 what want count number of records each id, don't want count records if subsequent timestamp within 30 seconds. so in above example total count id 5 3, because wouldn't count row 2 because within 30 seconds of last timestamp. i building microsoft access application, , using query, query can either access query or sql query. thank help. i think query below want don't understand expected output. returns count of 4 (all rows in example) believe correct because of records @ least 30 seconds apart. no single timestamp has subsequent timestamp within 30 seconds (in time). row 2 timestamp of '2014-01-01 06:00:03' not within 30 seconds of timestamp coming after. closest row #1 58 seconds later (58 greater 30 don't know why think should excluded (given said wanted in explanation)). rows 1/3/4 of example data not...

Adding large data sets within a for loop in matlab -

i'm attempting make basic gating system, smallest data have single cycle equals 18*100 array. i've attempted plotting hold on/off function , collecting data after h=findobj(gca,'type','line'); . takes forever , requires lot of reshaping. there simpler way either store data or add complete arrays (not sum line line no-no) in loop? h=findobj(gca,'type','line'); %data retrieved orginal figure x=get(h,'xdata'); y=get(h,'ydata'); x=reshape(x,(18),[]); y=reshape(y,(18),[]); hold on i=1:4; xx=x(:,i); yy=y(:,i); gx=cell2mat(xx); gy=cell2mat(yy); plot(gx) % manipulated data orginal figure, plot(gy) % plot required extract loop data end hold off basically want add 4 gx , divide them, have added bulk, not line line 1 cycle of loop equals cycle of system. (also 4 number more 60+, why can't manually). many thanks!

Append array data to a html table column-wise using only javascript -

i have set of array case =[case1, case2,case3] condition = [condition1,condition2,condition3] observation = [obs1,obs2,obs3] how can display in html table below format? case condition , observation headers don't change. number of columns doesn't change rows change. how can using javascript? i new javascript , having difficulty in iteration. +---------------------------------- | case | condition | observation| +---------------------------------+ | case1 | condition1 | obs1 | +---------------------------------+ | case2 | condition2 | obs2 | +---------------------------------+ | case3 | condition3 | obs3 | +---------------------------------+ try following js : case =["case1", "case2","case3"]; condition = ["condition1","condition2","condition3"]; observation = ["obs1","obs2","obs3"]; for(i=0;i<case.length;i++) { document.getelementbyid(tab...

android - My ListView is not showing list of Items i entered? -

i have 2 separate tabs in android project. 1) user enters data 2) displays data list in tab has listview data entry working well.. when change tab see list list not displayed.there no error or exception @ run time . providing code please me. 1st fragment import android.app.activity; import android.app.fragment; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.listview; public class mainactivity extends fragment { adapterdata ad; button send; edittext text; listview names; arrayadapter<string> aa; listsactivity la; int count; public mainactivity() { // todo auto-generated constructor stub } @override public void oncreate(bundle savedinstancest...

Post on Facebook without Share Prompt in PHP -

is there possibility can make button on when click, contents directly shared on facebook without showing our user share prompt dialog box? i referred online , found possible through mobile devices: http://www.mindfiresolutions.com/how-to-post-message-on-your-facebook-wall-without-using-facebook-dialog-box-1419.php the question can make sort of ajax call , done on web apps. we used following code <?php require_once('php-sdk/facebook.php'); $config = array( 'appid' => 'my app id', /*your app id*/ 'secret' => 'my secret id', /*your app secret key*/ 'allowsignedrequest' => false ); $facebook = new facebook($config); $user_id = $facebook->getuser(); if($user_id) { try { $user_profile = $facebook->api('/me','get'); } catch(facebookapiexception $e) { $login_url = $facebook->getloginurl(); echo 'please <a href="' . $login_url . '">lo...

java - How to update session scope-beans properly? -

i building servlet based web application. , looking proper way update session-scoped beans. i have userauthorityholder class stores current user's authority. session scoped , instantiated when user's session created: <bean id="userdetailsholder" class="project.access.userauthorityholder" scope="session"> <aop:scoped-proxy/> </bean> my question is: is there way update 1 or more other session-scoped beans. in situation, update user's authority effective if there way so.

javascript - Pie chart won't transition on enter selection - d3 -

i'm trying transitions working on enter selection of pie chart: d3.select(this).append('path') .attr("fill", function(d, i) { return color(d.data.amount) }) .attr("class", function (d) { return 'slice-' + d.data.label }) .each(function(d) { this._current = d; }) .transition() .duration(9500) .attrtween("d", function(a) { var = d3.interpolate(this._current, a); this._current = i(0); return function(t) { return arc(i(t)); }; }); i'm pretty sure i've got got attrtween() bit correct have transitions working later on in code. can't working on enter selection. missing ? http://jsfiddle.net/euk6h/19/

How to create a multi-series (line) chart with scala-chart -

i came across scala-chart , nice wrapper using jfreechart in scala. has several utility classes generating charts minimal effort. what best way generate line chart multiple series using scala-chart? in scala-chart there several different ways create multi-series line chart. way use depends on how create dataset (including ways work legacy jfreechart code): (for comparison) create single-series line chart: val series = (x <- 1 5) yield (x,x*x) val chart = xylinechart(series) build multi-series line chart entirely scala collections (this way recommend because idiomatic): val names: list[string] = "series a" :: "series b" :: nil val data = { name <- names series = (x <- 1 5) yield (x,util.random.nextint(5)) } yield name -> series val chart = xylinechart(data) from collection of xyseries objects: val names: list[string] = "series a" :: "series b" :: nil def randomseries(name: string): xyseries = list....

c - How to filter alphanumeric characters from char * -

i creating shared object filters alphanumeric characters receive char* buff_in , copy them char *buff_out, right code doing want creates ^@ in between digits. int tratar(char* buff_in, char* buff_out){ int = 0; while(buff_in[i]){ if(!isalpha(buff_in[i])){ buff_out[i] = buff_in[i]; } i++; } printf("%s", buff_out); } if run program looks ok, when @ returned value in editor see: ^@^@^@ ^@^@ 1 ^@^@^^@ ^@ 10 ^@^@^@ 50 ^@^@^@. when should 1 10 50 . thank you you need different index buff_out: int = 0, j = 0; ... buff_out[j++] = buff_in[i]; also, null-terminate buff_out before printf(): buff_out[j] = '\0';

javascript - Undefined error when loading slider -

i loading 2 sliders on page - , of main slider working. have secondary slider working until - see error uncaught typeerror: undefined not function (anonymous function) f.event.handle i.handle.k i know it's hard out of script files here - here call second slider giving error. thoughts? <script type="text/javascript" charset="utf-8"> $(window).load(function() { $('.flexslider').flexslider(); }); </script> updated jquery - , found conflicts found work. <script type="text/javascript">jquery.noconflict();</script> <script src="jquery.flexslider.js"></script> <script type="text/javascript"> jquery.noconflict(); jquery(window).load(function() { jquery('.flexslider').flexslider({ animation: "slide" }); }); </script>