Posts

Showing posts from April, 2012

ios - Is it safe to pass NSManagedObjectID-s between multiple NSPersistentStoreCoordinator-s? -

i have multiple nspersistentstorecoordinator instances have 1 nspersistentstore each, pointing same sqlite file. , in testing passing nsmanagedobjectid objects between them, , calling - (nsmanagedobject *)existingobjectwithid:(nsmanagedobjectid *)objectid error:(nserror **)error on nsmanagedobjectcontext seems work fine, have yet come across documentation apple confirms supposed work fine. so, question is, if knows if supposed work (a link apple documentation confirming awesome!), of if knows not supposed work, , should not doing this, awesome too! it's safe call method. whether returns object story. when using object id different context, you'll non-nil result if object accessible context call method on. implies object exists in persistent store, meaning has been saved on original managed object context. or in other words, you'll non-nil result if you've saved object id, , if you're using object's permanent (post-save) id.

javascript - Backbone model save() method not doing anything -

i'm using backbone rails , trying save new model server. however, calling .save() on model doesn't seem doing anything. looking @ "network" tab in chrome, don't see request being made. here's code: model class myapp.models.chain extends backbone.model defaults: steps: [] id: null urlroot: '/chains' validate: (attrs) -> if $.trim(attrs.steps[@step_number - 1]) == '' return "step can't blank." view class myapp.views.chainsnew extends backbone.view # @template defined conditional inside render() initialize: -> @is_saving = false events: 'click #btn-go': 'add_step' 'click #btn-done': 'save' render: (step_number) -> @model.step_number = step_number @template = if @model.step_number 1 jst['chains/new'] else jst['chains/step'] $(@el).html(@template({pre

Prevent action attribute from running php script with javascript -

this question has answer here: prevent form posting until javascript code satisfied 4 answers is there way can use javascript prevent form runing php script. example this: <form action="somepage.php" method="post> <input type= "text" class= "field" name = "blah"> <input type="submit" value="send" > </form> i know how validate what's in text box using javascript, want prevent somepage.php run if text box empty. haven't tried cause don't know how it. hope guys understand problem. thanks you can attach function submit event of form : document.getelementbyid('form-id').addeventlistener("submit", function(e){ var field1 = getelementbyid('field1').value; if(field1=='' || field1 == null){ e.preventdefaul

Mysql 5.5 database charset issue. Database charset changes from utf8 to latin1 -

i have problem mysql 5.5. when type in console show variables 'char%'; show variables 'collation%'; my output should be character_set_database | utf8 collation_database | utf8_unicode_ci when change database use final; example, character set , collation change latin1. need utf8 because want store data in greek , change entries '?'. do wrong? , when yes, how change in order use time utf8? i create database , tables code below: create database if not exists finalessay character set utf8 collate utf8_unicode_ci; and create table if not exists `department` ( `deptid` int(6) not null , `description` varchar(250) null default null , `schoolid` int(6) null default null , primary key (`deptid`) ) engine = innodb, character set utf8, collate utf8_general_ci; would appreciate if me.

iframe - Embedded Google calendar : how to set range of hours to display? -

given following embedding code: <iframe src="https://www.google.com/calendar/embed? title=2014 plidam international symposium (paris)& dates=20140611/20140615& mode=week&amp; shownav=1&amp; showdate=1&amp; showprint=1&amp; showtabs=1&amp; showcalendars=0&amp; showtz=1; height=600&amp; wkst=2&amp; bgcolor=%23666666&amp; src=vdfmfbp0msroletduigs2qtkoc%40group.calendar.google.com&amp; color=%232952a3&amp; ctz=europe%2fparis" style=" border:solid 1px #777 " width="800" height="600" frameborder="0" scrolling="no"></iframe> is there parameter set hours display/focus_on 09:00 18:00 (6pm), aka working hours ? same days, there someways display/focus_on rights 4 days only. fiddle here there doesn't appear way through api, currently. use javascript/jquery remove elements don't want show in dom after iframe has finished loading. so, delete wedne

javascript - Get local time representation of Date in arbitrary timezone in arbitrary day - considering Daylight Savings Time -

for sure, there lot of questions date objects , timezones many of them converting current time timezone, , others not clear want do. i want display day, hour, minute etc. in arbitrary timezone, in arbitrary day. example, function f(t, s) that: given timestamp 1357041600 (which 2013/1/1 12:00:00 utc) , string "america/los angeles" , satisfy comparison below: f(1357041600, "america/los angeles") == "2013/01/01 04:00:00" given timestamp 1372680000 (2013/07/01 12:00:00 utc), satisfy comparison below: f(1357041600, "america/los angeles") == "2013/07/01 05:00:00" will behave way if timezone in browser is, let "europe/london" or "america/são paulo" . will behave way if time in browser is, let 2014/02/05 19:32, or 2002/08/04 07:12; and as final restriction, not request server side (because i'm doing myself :) ) is possible? given timestamp 1357041600 (which 2013/1/1 12:00:00 utc)

C++, output of one digit after the decimal -

i'm new in c++ , help. don't understand why i'm getting output of 1 digit after decimal on sum below. have tried solve no success. int main() { double alt, t; t = 4.5; // function calculating altitude on time. alt = (-0.12)*pow(t, 4) +(12.0)*pow(t, 3) -(380.0)*pow(t, 2) +(4100.0)*t +220.0; cout << alt << endl; return 0; } the default behaviour of cout print 6 significant digits of floating points. can change with: cout.precision(10); cout << alt << endl; which gives output: 12019.2925 which seems correct solution. you should not try set precision higher 15, because precision limit of double type (typically). can use numeric_limits<double>::digits10 <limits> make sure precision have.

objective c - iOS Add tap Gesture to UIImageView -

i have image inside uiimageview, has gesture zooming, can see code. i want able insert clickable areas of image, not screen, if click image point minimum or maximum zoom zoom return same value. i tell uigesturerecognizer if can do? why can not figure out whether work or not. thanks my code: uitapgesturerecognizer *twofingertap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletwofingertap:)]; [twofingertap setnumberoftouchesrequired:2]; [img addgesturerecognizer:twofingertap]; float minimumscale = 0.4;//this minimum scale, set whatever want. 1.0 = default scroll.maximumzoomscale = 4.0; scroll.minimumzoomscale = minimumscale; scroll.zoomscale = minimumscale; [scroll setcontentmode:uiviewcontentmodescaleaspectfit]; [img sizetofit]; [scroll setcontentsize:cgsizemake(img.frame.size.width, img.frame.size.height)]; [control setselectedsegmentindex:0]; [control addtarget:self action:@selector(action:) forcontrolevents:uicontrolev

css - Setting a fixed whitespace for text -

Image
i'm new css, apologise if question bit simple. i have nav-bar sits in centre of page , has width of 'x' what want create white space <p> text, if drew 2 vertical lines; touch ends of nav bar, text touches the vertical lines - regardless of window size. my current solution makes text move relative window size, whereas want text align nav bar on vertical axis whilst being justified. here's picture of want make clearer: here's current solution works if window size right: html: <p id="body"> blah blah ..... </p> css: #body { margin: 25px 310px 25px 310px; text-align: justify; line-height: 30px; } give same width 'p' , center margin it, nav bar. html <div id='navbar'></div <p id="body"> blah blah ..... </p> css #navbar, p { width: 900px; margin: 10px auto; } p { text-align: justify; line-height: 30px; } noe both 'navbar'

ruby on rails - Why ActiveRecord::StatementInvalid: SQLite3::SQLException: near ")": syntax error: INSERT INTO "user_friendships" () VALUES () -

why why activerecord::statementinvalid: sqlite3::sqlexception: near ")": syntax error: insert "user_friendships" () values () when trying test: $ ruby -i test test/unit/user_friendships_test.rb require 'test_helper' class userfriendshipstest < activesupport::testcase should belong_to (:user) should belong_to (:friend) test "that creating frinedship works without raising exception" assert_nothing_raised userfriendship.create user: users(:a), friend: friends(:b) end end end any idea? update: part of schema.rb create_table "user_friendships", :force => true |t| t.integer "user_id" t.integer "friend_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end add_index "user_friendships", ["user_id", "friend_id"], :name => "index_user_friendships_on_user_id_and_friend_id" create

vb.net - Putting multiple labels in a second form -

hi day guys ask if code putting multiple labels in second form text first form using 1 button? in advance , happy coding all. private sub button3_click(byval sender system.object, byval e system.eventargs) handles button3.click dim lbl label = new label 'create label 'change location.. lbl.location = new point(50, 50) 'set label location lbl.text = textbox1.text 'set label text lbl.forecolor = color.black 'set label forecolor frm2.controls.add(lbl) 'add label return 'change location.. lbl.location = new point(10, 20) 'set label location lbl.text = textbox1.text 'set label text lbl.forecolor = color.black 'set label forecolor frm2.controls.add(lbl) 'add label return end sub it shows first label not show next labels input... form2 codes public class form2 public lbl new label private sub form2_load(byval sender system

ios - One push arrives - but not when sending >1 message at once -

i've problem, can send 1 message @ once. code working quite fine: $fp = stream_socket_client( 'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, stream_client_connect|stream_client_persistent, $ctx); if (!$fp) exit("failed connect: $err $errstr" . php_eol); echo 'connected apns' . php_eol ."<br><br>"; // create payload body $body['aps'] = array( 'alert' => $message, 'sound' => 'default', 'badge' => 1 ); // encode payload json $payload = json_encode($body); // build binary notification $msg = chr(0) . pack('n', 32) . pack('h*', $token[1]) . pack('n', strlen($payload)) . $payload; $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo '<br><div style="color:red">message not delivered' . php_eol.'</div><

innodb - Abnormally high MySQL writes and larger than normal Binary Log files. How can I determine what caused this? -

we have mysql master database replicates mysql slave. experiencing issues mysql showing high number of writes (but not increased number of queries being ran) short period of time (a few hours). trying investigate cause. normally our binary logs 1 gb in file size during period experiencing these issues, log files jumped 8.5 gb. when run mysqlbinlog --short-form binarylog.0000 on 1 of 8.5 gb binary log returns 196 kb of queries , data. when run mysqlbinlog --short-form on normal binary log (1 gb) returns around 8,500 kb worth of queries , database activity. doesn't make sense because has 7 gb more of data yet returns less 1 gb binary log file. i see lots of these statements sequential timestamps, i'm not sure if that's related problem because they're in both normal period when experienced these issues. set timestamp=1391452372/*!*/;commit/*!*/; set timestamp=1391452372/*!*/;begin/*!*/;commit/*!*/; set timestamp=1391452372/*!*/;begin/*!*/;commit/*!*/; se

can't ping avahi alias from windows over LAN but can from other linux VMs -

context: i've set vm server gis testing , dokuwiki on domain root. i'd serve gis web apps on subdomain dokuwiki url renaming never conflict (and feels cleaner). thought had solved avahi-aliases, discovered... problem: can't reach subdomain windows pcs on lan. linux vms connect fine. trying impossible or doing wrong? (i'm dns noob) why linux find subdomain windows not, on same lan?? setup: can't change on corporate routers/servers. vms on different pcs on same corporate lan. vm1 (virtualbox, hosted on windows pc1): mint 13 vm2 (virtualbox headless server, hosted on windows pc2): ubuntu server 12.04, lamp, samba, avahi, avahi-aliases. primary domain: vm2.local subdomain: gis.vm2.local (configured in apache , avahi-alias) what works: can reach vm2.local , gis.vm2.local vm1 (via ping , browser). can reach vm2.local windows pc on lan (via ping browser). what doesn't work: cannot reach gis.vm2.local windows pcs on lan. any ideas or advice a

javascript - Pulling Instagram feed into a nested Div using ID -

i have div that's nested in 2 other divs isn't pulling in instagram feed via id, although when take div out , have on it's own displays. how can change code either in js file or html display when nested here's related part of js file... $(function() { var cmdurl, embedimage, onphotoloaded, param, tag_name, userid, param = { access_token: '******************', // feel free change own access token count: 10 // total number of images }, tag = 'gezza', // user id. can find 1 out looking 1 of pictures uri tag_name = '#photowall', cmdurl = 'https://api.instagram.com/v1/tags/' + tag + '/media/recent?callback=?'; and here's html <div class="col-md-4 col-sm-4 home3block"> <div class="block"> <img src="assets/images/instagram-logo.gif"> <!-- start photowall --> <div id="photowall"> <

objective c - How to Drag&Drop images from browser to Cocoa app -

i need drag images browser mac app. when dragging images img tag, works when there link between img, doesn’t work. nspasteboard receives nsurl link, not img source. drag feedback shows image, think it’s sending image data. i’ve checked propertylistfortype nspasteboard, , contains link href. - (bool)performdragoperation:(id <nsdragginginfo>)sender { if ([sender draggingsource] == nil){ nspasteboard *pboard = [sender draggingpasteboard]; if ([[pboard types] containsobject:nsurlpboardtype]){ nsurl* file = [nsurl urlfrompasteboard: [sender draggingpasteboard]]; //if <img> tag, file src. if <a><img></a>, it’s link href //download image here } } } there should variety of types offered on nspasteboard. first thing whenever i’m writing pasteboard receiving code write debugging code dumps available types , values when drag happens view. pick , choose ones want. as start, jus

css3 - how to resize image in CSS? -

i've got page divided different parts header, footer , body. need set images on background of header , footer. should choose bigger image can re sized according user's system dimension or should keep constant size? how keep image withing section has been decided it? i'd create separate images smaller devices smaller file sizes when loading on tablet or mobile. load in different images using media queries header-bg-desktop.jpg header-bg-tablet.jpg header-bg-mobile.jpg

android - How to move to the left ToggleButton in vertical LinearLayout -

my activity screen created vertical linearlayout. want add togglebutton left side of screen. tried make gravity parameter here: <togglebutton android:id="@+id/togglebutton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="20sp" android:gravity="left"/> however put text on button left , not button itself. how can move button left in vertical linearlayout? considering linearlayout defines android:layout_width="match_parent" ...use this: <togglebutton android:id="@+id/togglebutton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="20sp" android:layout_gravity="left"/> android:layout_gravity == alignment on layout element incl

c# - Trying to get pointers working -

i've never needed use pointers in c# before, however, library i'm using requires method parameters passed pointers. library allows usage of simd instruction sets. to test how use library, i've attempted write method uses simd calculate cosine value of elements of array in 1 go. this i've got: double[] valuestocalculate = new double[max_size]; double[] calculatedcosines = new double[max_size]; long result; result = calculatecosinearray(valuestocalculate, calculatedcosines); public static long calculatecosinearraysimd(double[] array, double[] result) { stopwatch stopwatch = new stopwatch(); stopwatch.start(); (int = 0; < array.length; i++) { yeppp.math.cos_v64f_v64f(*array, result, max_size); } stopwatch.stop(); return stopwatch.elapsedmilliseconds; } however, these errors: the best overloaded method match 'yeppp.math.cos_v64f_v64f(double*, double*, int)' has invalid arguments argument 1: cannot conve

ios - To what extent can I make my C++/OpenGL project work on both iPad and PC? -

i'm developing little game on linux @ moment i'd try making ipad app out of it. i've been looking on tutorials , seems i'll able make core c++ code compile on xcode without modification (it has no dependencies outside standard library), , if use opengl sdl ui bulk of code should portable well. i assume amount of code have different between build processes, i'd minimise that. i've never done xcode development before, can please advise on following: will able make xcode project point core library source tree , compile without dicking around it, inserting project files etc? in other words, can keep xcode-specific files somewhere different? use cmake on linux , like keep out-of-tree build approach. what @ sdl layer have done differently ios build? in other words, if have slave libgraphics library sdl , can paint core state context provided master application, how create context differently on ios compared linux? at moment know nothing particulars of

php - Upload file from form to remote server and still capture other inputs locally? -

i have form few text inputs , file upload field. it's action remote server file uploaded, hidden field contains redirect url posted remote server. redirects url few parameters in url use $_get receive details file uploaded server. i need capture other field values before file uploaded, capture response values sent remote server. i know can use ajax post local php file handle post , use $_post capture input values i'm not able upload file remotely. my uploadfile.php uses curl. posted form fields ajax doesn't work because of ajax security , remote posting. $ch = curl_init(); curl_setopt($ch, curlopt_url,$upload_url."&"); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, 'upload_identifier='.$upload_identifier.'&extra_info='.$extra_info.'&userfile='.$userfile); curl_setopt($ch, curlopt_returntransfer, true); $upload_info = curl_exec ($ch); curl_close ($ch); is there way let form su

android - No such table: while compiling Delete Table ... but I'm not deleting any table -

i'm getting error message no such table ... while compiling delete . here's problem: don't ever delete table! i've tried run through code, , here happens: datasettings.java 1. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); it jumps databasehelper.java super(context, database_name, null, database_version); question: why? why jump databasehelper.java. there in code tells that. it goes datasettings.java. next line is: setcontentview(r.layout.activity_data_settings); name = (edittext) findviewbyid(r.id.name); then crashes. telling have no such table feature_test_table: while compiling delete x. i'm baffled. going on? i've gone through , i've tried erase has word delete in it. still error message. due upgrading kepler? 2 links sample code: http://textuploader.com/1l0s http://textuploader.com/1l0c you calling constructor of sqliteopenhelper in line of databaseh

javascript - How can I call a function after appending an element using jquery? -

i have thumbnails on page. when click on 1 of those, view original photo in jquery dialog. and, set width of dialog box dynamically based on photo width. so, have written following scripts it. however, looks can't access image newly appended div. below function wrote: function showorignalphoto($photo_name){ $('#image_frame img').remove(); //remove previous image $('#image_frame').append('<img src="../image_path/'+$photo_name +'" />'); //append new image $width = $('#image_frame img').width(); //get width of new image alert($width); //return 0!! $( "#dialog" ).dialog( "option", "width", $width); //set width of dialog box $( "#dialog" ).dialog( "open" ); //open dialog } it able newly added element code not run 2 reasons. if dialogbox hidden display:none css , calculation of or children's height or width return 0 display n

ruby - Path to dynamic object? -

i have system_settings table has key , value columns. key looks general.site.something.config , value simple string. i'd have static class which, upon initialization, reads settings , caches values. furthermore, i'd able access settings in oo way, such systemsetting.cache.general.site.something.config in order pull value key. turning rows in table tree. is there easy way in ruby 1.8.7? tl;dr, no. no easy (read 'built-in') way atleast. the syntax want not way things happen in ruby (without over-plumbing, is). have @ over-plumbing i'm referring to, have @ code wrote example demonstrates of desired functionality want. wouldn't suggest using though , that's same reason i'm not posting here.

Python: Having trouble reading in files -

i having trouble reading in files through python 2.7. prompt user load file, , once filename given, program load , print lines in file. filename = raw_input("filename load: ") print load_records(students, filename) def load_records(students, filename): #loads student records file records = [] in_file = open(filename, "r") line in in_file: print line however, if entire file path specified, program throws 'valueerror: mixing iterations , read methods lose data.'

jquery replaceWith for special html character -

on page have star using: <div class="favorite">&#9734 </div> on hover, want replace filled in star. here's jquery code wrote: $(".favorite").hover( function(){ $(this).replacewith("&#9733;"); }, function(){ } ); however, never seems work. way shows me text. removing quotes, breaks. suggestions help! understand png i'd rather not --- 1 less thing need have. thank you! use html() in jquery: $(".favorite").hover( function(){ $(this).html("&#9733;"); }, function(){ $(this).html("&#9734;"); } );

callback - How to make a dynamic body static in Cocos2d v3.0 with Chipmunk -

i’m using cocos2d v3 , want change body dynamic static after colliding body. @ moment i’ve got: -(void)ccphysicscollisionpostsolve:(ccphysicscollisionpair *)pair static:(ccnode *)nodea wildcard:(ccnode *)nodeb { _player.physicsbody.type = ccphysicsbodytypestatic; } or -(bool)ccphysicscollisionpresolve:(ccphysicscollisionpair *)pair static:(ccnode *)nodea wildcard:(ccnode *)nodeb { _player.physicsbody.type = ccphysicsbodytypestatic; return yes; } but neither works. error: aborting due chipmunk error: operation cannot done safely during call cpspacestep() or during query. put these calls post-step callback. failed condition: !space->locked i tried make joint @ point of collision doesn’t work right. is there way change body dynamic collides in v3? can in later versions using box2d. want stop gravity , other forces doesn’t move. want make stuck surface. read little on post-step callbacks i'm unfamiliar how use them. any appreciated. as error m

python - Loop that won't stop? -

i'm new python, , i'm trying write loop find largest integer n n^3 < 12,000. know wrong, don't know what. please help! here's code: working = true n = 12000 while working: n = n - 1 if ((n * n * n) < 12000) , not working: print(n) when found answer, need turn working flag false , this while working: n = n - 1 if ((n * n * n) < 12000): # don't need `and not working:` check print(n) working = false on side note, in python, can find powers of numbers this n ** 3 == n * n * n and turns out that, answer actual question 22 :)

javascript - Set css property without css transition -

i have element need toggle opacity. want transition opacity, , not. there easy way reset property without transition using javascript of time without turning transition off? is there easy way reset property without transition using javascript of time without turning transition off? not know of. transition occurs when property set on changes – how change occurs, not matter. but there easy way of turning off – apply transition via class, , remove class dynamically when want change property value without transition.

unit testing - How to test a function which throws exception, in Dart? -

say have function throws exception: hello() { throw "exception of world"; } i want test it, write test: test("function hello should throw exception", () { expect(()=>hello(), throwsa("exception of world")); }); you can see didn't call hello() directly, instead, use ()=>hello() . it works wonder if there other way write tests it? you can pass hello directly name instead of creating closure calls hello . this unit-test passes: main() { test("function hello should throw exception", () { expect(hello, throwsa(new isinstanceof<string>())); }); }

html - create one submenu larger than the others to include form -

i have verticle nav spry menu, , im trying have last option login, larger (wider , taller) section pop out rather smaller ones other menu anchors. im not quite sure how create css class , give bit of menu class? im pretty new css , stuff sorry if easy. im trying plug in pure css form login info pop out when hover. here css im trying no luck #login { width: 20em; height: 30em; background: #666; position: absolute; right: -20em; top: 0px; display: none; } but here jsfiddle of site: http://jsfiddle.net/5tfph/ thanks in advance helping newbie! i have added css style resolved bug please check link jsfiddle.net/5tfph/5/

3D object rendering in openCV using metaio in Android -

i developing appication, wher i'm using opencv detect shapes in camera image , want display 3d objects rendered metaio on shapes. how can achieved? have tried custom rendering, 'onnewcameraframe' method not being called. i have convert each camera frame in 'onnewcameraframe()' method mat object shape detection logic. it's not being called. have added call 'requestcameraimage()' method of metaio sdk. start hello world example metaio: http://dev.metaio.com/sdk/tutorials/hello-world/ there can see example code how e.g. render figure on marker but metaio , openvc not rendering part, metaio little bit more opencv computer vision part of application. render have write opengl code yourself, or conect tracking of metaio more complex rendering engine jmonkey, libgdx etc.

php - Uploading a file to a different directory on server -

i using php allow users upload photos on web app. i using php function: move_uploaded_file(); and define upload path: define('uploadpath', 'images/'); to place photo in images/ directory now want give users ability same thing, sub domain of website. do do: define('uploadpath', 'http:/mobile.website.com/images/'); if so, how prevent others uploading malicious files server, server? first of second argument of move_uploaded_file() should directory, not url, i mean correct : define('uploadpath', 'mobile/images/'); move_uploaded_file($tmp,uploadpath.$name); but not : define('uploadpath', 'http:/mobile.website.com/images/'); move_uploaded_file($tmp,uploadpath.$name); second of all, preventing others uploading malicious files server, better check extension of file.

javascript - IOS Phonegap hybrid testing automation -

i'm using calabash-cucumber testing automation. it's working ios native pages. i able set accessibility label native elements. eg: button.accessibilitylabel=@"button" . can tell me how set accessibility labels ios phonegap hybrid pages. either in html or javascript. eg: <p> tags

c# - Selecting All records From Kendo Grid -

i'm using kendo grid in visual studio 2010 asp.net & c#. im new platform. have more 100 records in grid.. want select records in array.. using following code.. selects first page records. (pagesize: 5 ).. var entitygrid = $("#grdreport").data("kendogrid"); var d = entitygrid.datasource.data(); for(var = 0; i<d.length; i++) { var currentdataitem = d[i]; a.push(currentdataitem); } appnt = a; appnt has 5 records.. please me in issue... in advance.. :-) happy.. you should use serveroperation of datasource sorce set false if using mvc wrappers. if using regular javascript declaration should set serverpaging of datasource false.

javascript - inline with binding with an observable array -

i have model property defined follows: function field(name, size, type){ this.name = ko.observable(name); this.size = ko.observable(size); this.type = ko.observable(type); this.map = ko.observable(); } i have observable array ( fields ) defined array of above object. on ui interaction map property of field object associated object. header object properties headername , index . i trying bind fields follows: <ul data-bind="foreach: fields"> <li class="form-inline"> <span data-bind="text:name"></span> -> <span data-bind="text: map.headername"></span> </li> </ul> but unsuccessful: http://jsfiddle.net/deostroll/sena8/2/ tried follows: <ul data-bind="foreach: fields"> <li class="form-inline"> <span data-bind="text:name"></span> -> <span data-bind="with: map

java - ASM to search for a String in .class file -

hi want search particular string in /java/lang/string.class file using asm. got know following method that @override public string readutf8(int index, char[] buf) { string value = super.readutf8(index, buf); constantpoolstrings.add(value); return value; } but not sure how use .i posting code, can please tell me how can achived in this. public class democlassreader { public static void main(string[] args) throws ioexception { classvisitor v= new classvisitor(opcodes.asm4) { @override public void visit(int version, int access, string name, string signature, string supername, string[] interfaces) { system.out.println(" class: "+name); super.visit(version, access, name, signature, supername, interfaces); } } ; inputstream in=string.class.getresourceasstream("/java/lang/string.class"); classreader classreader=new clas

java - Could not find dependencies for aspectj-maven-plugin -

i have problem ctw aspects using aspectj-maven-plugin. following error (execution entry being highlighted): multiple annotations found @ line: - execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.5:compile failed: plugin org.codehaus.mojo:aspectj-maven-plugin:1.5 or 1 of dependencies not resolved: not find artifact com.sun:tools:jar:1.7.0_21 @ specified path c:\program files\java\jre7/../lib/tools.jar (org.codehaus.mojo:aspectj-maven- plugin:1.5:compile:default:compile) - execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.5:test-compile failed: plugin org.codehaus.mojo:aspectj-maven-plugin:1.5 or 1 of dependencies not resolved: not find artifact com.sun:tools:jar:1.7.0_21 @ specified path c:\program files\java\jre7/../lib/tools.jar (org.codehaus.mojo:aspectj-maven- plugin:1.5:test-compile:default:test-compile) on configuration: <build> <plugins> <!-- http://mojo.codeha

mysql - How can i display multiple result in a series of textboxs? -

Image
i have problem populating multiple data multiple textboxes. i've attached link project guys can picture. thank in advance! i'm no wiz programmer. :) edit: heres code ` dim con mysqlconnection = new mysqlconnection("data source=localhost; user id=root; password=dctvmainadmin; database=tmsdctv") dim query string = "select * recordedattendance empno = '00111' , dateattended = '2014-02-03 mon'" dim reader mysqldatareader dim result new system.data.datatable con.open() dim cmd_read_name new mysqlcommand(query) cmd_read_name.connection = con result.load(cmd_read_name.executereader) me each dtrow datarow in result.rows .lblempno.text = dtrow(0) .lbldate1.text = dtrow(1) .txttimein1.text = dtrow(2) .txttimeout1.text = dtrow(3) next con.close() end with` try this: specifing textbox lable name like: lblempno1,lblempno2

c# - Overlapping Ranges Check for Overlapping -

i have list of ranges , find out if overlap. i have following code. not seem working. there easier way or way works :) thanks in advance advice. public partial class form1 : form { public form1() { initializecomponent(); } private ilist<range> rangelist; private void form1_load(object sender, eventargs e) { rangelist.add(new range{fromnumber = 0, tonumber = 100}); rangelist.add(new range { fromnumber = 101, tonumber = 200 }); // range should on lap , throw exception rangelist.add(new range { fromnumber = 199, tonumber = 300 }); } private bool rangesoverlap() { var biglist = new list<list<int>>(); foreach (var range in this.rangelist) { biglist.add(new list<int> { range.fromnumber , range.tonumber }); } ienumerable<ienumerable<int>> lists = biglist; return lists .where(c => c != null

mongodb - How to set up mongo db in local and then in remote? -

i have got mongo db commands below link. http://try.mongodb.org/ i have project , able run it. in project use mongodb, angular js, node js , express server. i able create user login page.the users stored in mongo db. know users in database. initially did not install mongodb. how, user , password stored in localhost. hope project having libraries. but later, in order learn mongo, installed mongo pc. started mongo db , running in link http://localhost:28017/. mongodb starting : pid=6300 port=27017 dbpath=\data\db\ 64-bit host=new-pc question 1 i list out users in db, used project. installation of mongo db me in way? if not without starting mongo db, can know user details saved project? question 2 how can set mongo db in remote available in internet? code - creating userschema var userschema = new schema({ name: string, email: { type: string, unique: true }, hashed_password: string, provider: string, salt: string, facebook: {}, twitter: {}, github: {},

android - Error in group by clause in query() method of ContentResolver -

i getting error in using following query. how resolve it? string projection[] = {data.contact_id,data.display_name,phone.number,data.raw_contact_id,email.data,phone.data1,structuredpostal.street,structuredpostal.postcode}; cursor c = getcontentresolver().query( data.content_uri, projection, "(" + data.mimetype + "=? or " + data.mimetype + "=?) group ?", new string[]{email.content_item_type, phone.content_item_type, data.contact_id}, data.contact_id); logcat : 02-06 14:18:01.175: e/androidruntime(6884): fatal exception: intentservice[contactmanagerservice] 02-06 14:18:01.175: e/androidruntime(6884): android.database.sqlite.sqliteexception: near "group": syntax error: , while compiling: select contact_id, display_name, data1, raw_contact_id, data1, data1, data4, data9 view_data data (1) , (((mimetype=? or mimetype=?) group ?)) order contact_id 02-0

ASP.NET: post multiple variable from view to controller through ajax jquery function -

i working on app using asp.net mvc 5. have partial view create new record scheme. partial view displays zones in table user can select single or multiple suppose assign newly created record in razor html.beginform have add id , using id calling ajax function send serialize form controller. problem want send selected zones list ids stored in array controller along submitted form values can update related record in database. array declare global variable in javascript... script <script type="text/javascript"> $(document).ready(function () { $("#newfeeschemeform").submit(function (e) { $.ajax({ type: "post", url: "/qualification/createnewfeescheme", data: { newschemedata: $("#newfeeschemeform").serialize(), feezonelist: selectedzoneslist }, success: function(data) { alert(data); }, error: function (j

objective c - How to forward a call from one iOS device to Other device in iphone sdk -

i want forward call iphone device ipad , viceversa. used phone url scheme not working. can 1 suggest me how doable? no, it's not possible.if there way so, it's through private api, cause app rejected app store. thanks

java - can't find databases folder under data/data/packagename/ using eclipse android emulator -

i'm having problem sqlite android. according examples found internet, databases can found under data/data/packagename/ can't find folder under directory. please tell me what's problem? and provide sqlitehelper class in case if it's necessary . package com.example.waterrefilltest; import static android.provider.basecolumns._id; import android.content.contentvalues; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class data extends sqliteopenhelper{ private static final string database_name = "waterrefill.db"; public data(context ctx){ super(ctx, database_name, null, 4); } public void generatedata(content c){ sqlitedatabase db = this.getwritabledatabase(); contentvalues cv = new contentvalues(); cv.put("lat", c.getlat()); cv.put("long", c.getlng()); cv.put("cat",c.getct()); cv.put("

php - How to make the parent node to appear in the middle of 2 children regardless of pyramide level? -

this markup: <ul> <li> <a href="#">root</a> <ul> <li> <a href="#">root</a> <ul> <li> <a href="#">child 1</a> </li> <li> <a href="#">child 2</a> </li> </ul> </li> </ul> </li> </ul> to this: ________ | | | test1 | |________| ________ ________ | | | | | test2 | | test3 | |________| |________| ________ ________ ________ ________ | | | | | | | | | test4 | | test5 | | test6 | | test7 | |________| |________| |________| |_

linux - what is meaning of export in multiple-line variable -

what meaning of export in multiple-line variable? in example command export foo or not, output 'welcome'. define foo echo welcome endef export foo all: @$(foo) variable values of top-level make can passed sub-make (sub directory makefile) through environment explicit request. these variables defined in sub-make defaults. the special variables shell , makeflags exported (unless unexport them). if want export specific variables sub-make, use export directive, this: export variable if want prevent variable being exported, use unexport directive, this: unexport variable

ios - .ipa file install grayed out on an ipad -

one of tester having issue installing ad-hoc distribution build of ipa file on ipad. said icon stays gray , itune freezes. when clicked, sits there waiting. the udid gave me 1 got itunes (not app gives invalid ffff udid), , double checked through checkipa ( https://github.com/apperian/ios-checkipa ) , indeed udid included. make sure built him new build no luck. know what's going on? thanks in advance! you may have issue bundle id, suggested. otherwise suggest forgoing use of itunes, , use distribution service such testflight or hockyapp , because itunes pain use distributing builds , wouldn't surprise me if user having problems trying itunes cooperate. this won't solve issues provisioning, on air distribution life saver.

android - Service and cordova plugin -

i know best way solve problem. , problem following. i have developed android app using cordova. native android code minimum required. what need is, when app starts, start service it. when app closes service must remain running. service communicates server , downloads if "something" exists. after download event service must notify user start initial app , see results or, better, service start initial app. what best way implement this, taking account don't want discard app in cordova. i've examined plugin creation since code of original app , service code same. is cordova plugin best way implement service ? can cordova plugin service purpose or totally wrong? is possible use javascript code in plugin? do need pass native code in order accomplish need? thank in advance george as far tried out cordova android plugin runs while app running. after closed, stops. but there plugin available brings background serivce support. https://github.com/

utf 8 - how to import in python French written xls file -

i have import in python containt of french written xls file.. managing use xlrd library i'm not able deal accent. know right codec should utf-8, don't know how set in starting xls file.. hint? solved: in end decided export original file in csv, using codec utf-8.

javascript - Error - Cannot find module 'config' -

Image
i have mail configuration code in all.js . now trying import in mail.js service, imported config module follows :- mail.js config = require('config'), all.js mailer: { auth: { user: "xxxxxxx", pass: "abc@123" } } gives me error cannot find module, module exists have checked it. how solve this? i used following code & worked :- config = require('../config/config');

javascript - Which is more efficient, spritesheet or css classes -

i want implement feedback on div when user click on it. div fade color , original color again. my first option use spritesheet, change background position property of div. part of implementation looks this: pos = 0; function fadeaction(el){ if (pos != 100){ pos += 10; $(el).css("background-position","0% "+pos+"%"); settimeout(function(){fadeaction(el);},10); }else pos=0; } my second option change background color according array of colors: colors = ["#ff00ff","#443322", etc]; = 0; function fadeaction(el){ if (pos != 10){ += 1; $(el).css("background-color",colors[i]); settimeout(function(){fadeaction(el);},10); }else i=0; } my third option (which scrapped due device incompatiblity) use jquery.color. function fadeaction(el){ $(el).css("background-color",fadecolor); $(el).animate({ backgroundcolor: "#e9e9e9" }, 150 ); }

javascript - Why does my change button not work? -

Image
i quite new javascript , learning more html5, javascript , ccs3. the task have been given: create chess board use javascript write cells (8x8), , use nth-child change background color in css. as can see have done that, don’t know if have done in way, going add button change sides (black , white side). have tried solve creating var boolean value, if it’s true load 1 function, , if it’s false another. works in loading page, change button not work. have done wrong? html , javascript: <!doctype html> <html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="ccso2.css"> </head> <body> <h1>sjakkbrett</h1> <script> var truefalse = true; function changer(){ if(truefalse === true){ truefalse = false;

database - Mysql stored procedure issue in fetching record -

i have list of id's in array. want fetch details table "user" using id's. i need stored procedure send array of id's , datails of each id in return array result. you can try these ways: a: use additional table, maybe temporary, store id values need in procedure, join table table(s). b: pass id values string argument procedure, build result sql statement, , execute using mysql prepared statements . example (case a ): delimiter $$ create procedure procedure1() begin select * table1 t1 join table_id t2 on t1.id = t2.id; end$$ delimiter ; create table table_id(id int(11)); insert table_id values(1),(2),(3),(4),(5); call procedure1(); example (case b ): delimiter $$ create procedure procedure1(in id_param varchar(255)) begin set @sql = concat('select * table id in (', id_param, ')'); prepare stmt @sql; execute stmt; deallocate prepare stmt; end$$ delimiter ; set @id = '1,2,3,4,5'; call procedure1(@id)

html - CSS Date Picker Icons Missing -

Image
i downloaded "date picker" http://jqueryui.com/datepicker/ , after moved css file project folder, icons gone. web-inf/view/templates/images web-inf/view/templates/datepickercustomer1.css in css: .ui-widget-content { border: 1px solid #8e846b; background: #feeebd url(images/ui-bg_highlight-soft_100_feeebd_1x100.png) 50% top repeat-x; } i have tried background-image: url(images/ui-bg_highlight-soft_100_feeebd_1x100.png) & background-image: url('images/ui-bg_highlight-soft_100_feeebd_1x100.png') quotes none of not working. the output image the correct image get web-inf directory private area of web application, files under web-inf directory cannot accessed directly browser specifying url http://yousite.com/web-inf/images/myimage.jpeg . web container not serve content of directory.

iphone - iOS Camera Overlay Capture Image -

i facing real though issues. have studied couple of tutorial adding overlay in camera using uiimagepickercontroller , avfoundation. working fine me. can add overlay on camera using both. main concern extract part of image under overlay view when user hits scan button. having white view in overlay , button, image under white view should retrieved. -(ibaction)cameraclicked:(id)sender { overlayview *overlay = [[overlayview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; self.imagepickercontroller = [[uiimagepickercontroller alloc] init]; self.imagepickercontroller.delegate = self; if ([uiimagepickercontroller iscameradeviceavailable:uiimagepickercontrollercameradevicerear]) { self.imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypecamera; self.imagepickercontroller.cameracapturemode = uiimagepickercontrollercameracapturemodephoto; } else { self.image

git - Should I commit .gitignore file? -

this question has answer here: should commit .gitignore git repos? 4 answers this seems dumbiest question obvious answer. , me until now. but... after reading proper section of github help got lost. says: this file can committed repository, sharing rule list other users clone repository. up until now, everyone, i've been talking git telling me, .gitingore file must commited or else it's rules won't work ! every git-newbie's question: " why .gitignore rules not applied ?" can answered simple: " did commited it ?". and now, here comes github saying, file can be commited, isn't necessary... yes, can track .gitignore file, not have to. the main reason why people working on project ignoring same files. also see this: should commit .gitignore git repos?

.net - Simple Injector: how to inject HttpContext? -

i have started using simple injector di container (mostly performance reason: if has suggestions, please let me know) of classes wrote use httpcontextbase constructor parameter. have resolved removing constructor , creating property, this: public httpcontextbase httpcontext { { if (null == _httpcontext) _httpcontext = new httpcontextwrapper(system.web.httpcontext.current); return _httpcontext; } set { _httpcontext = value; } } but don't solution... advices? you should favor constructor injection on else. possible. can register httpcontextbase follows: container.register<httpcontextbase>(() => new httpcontextwrapper(httpcontext.current), lifestyle.scoped); this can cause problem when calling verify() , since during application startup httpcontext.current null , , httpcontextwrapper not allow passing null constructor. it's try