Posts

Showing posts from August, 2015

java - Does jOOQ support linked SQL Servers? -

this seems straight-forward question, can't track down answer without testing it: does jooq support linked sql servers? (sql server 2008 r2). have application running in sql server r2 aws-rds instance , it's running out of space, we're looking @ various options. 1 we're favoring right moving specific set of data onto it's own rds instance (for architectural reasons). we're trying determine impact of doing our application tier. does know if jooq code generator creates objects linked servers? officially, has never been tested explicitly. might work, depending on how sql server exposes linked instances. jooq's code generator runs queries against sql server's information_schema views. i.e. can generate artefacts find in views. note, if jooq cannot generate artefacts linked instance, connect instance directly jooq code generator, , try use codegen-time or runtime schema mapping features , in order generate link prefixes.

Google Calendar API PHP fatal error -

i "connect me" link every time, after clicking , connecting, , refreshing browser. also, error, as suggested in answer below, have made changes, , added them here. has created new error: fatal error: uncaught exception 'google_serviceexception' message 'error calling https://www.googleapis.com/calendar/v3/users/me/calendarlist?key=aizasydxm2epulkfrogluo0dppebknimmvpfkxy : (401) login required' in ####.org/google-api-php-client/src/io/google_rest.php:66 stack trace: #0 ####.org/google-api-php-client/src/io/google_rest.php(36): google_rest::decodehttpresponse(object(google_httprequest)) #1 ####.org/google-api-php-client/src/service/google_serviceresource.php(177): google_rest::execute(object(google_httprequest)) #2 #####/google-api-php-client/src/contrib/google_calendarservice.php(154): google_serviceresource->__call('list', array) #3 ####/avl/index2.php(44): google_calendarlistserviceresource->listcalendarlist() #4 {main} thrown in /#####

c# - Using DateTime for a duration of time e.g. 45:00 -

i'd know if possible use datetime type durations such 45:00 (45 minutes) or 120:00 (120 minutes). these values need stored local sql server db. if possible, possibly hint how done using datetime, or if not let me know way done using different type. thank in advance, jamie you should use timespan structure timespan interval = new timespan(0, 45, 0); console.writeline(interval.tostring()); for database storing part, store property ticks because specific constructor timespan structure allows instantiate new timespan passing ticks value long ticks = gettimespanvaluefromdb(); timespan interval = new timespan(ticks); i wish add need bigint t-sql datatype field store long net datatype

exception handling - Propagating AccessDeniedException in Spring Security -

in web application using spring security , spring mvc. have secured couple of methods @secured annotation , configured spring security in such way when 1 of methods accessed without proper role, user taken login page. however, not want behaviour when offending request comes ajax, implemented custom @exceptionhandler annotated method determine request's context. this exception handler: @exceptionhandler(accessdeniedexception.class) public void handleaccessdeniedexception(accessdeniedexception ex, httpservletrequest request, httpservletresponse response) throws exception { if (isajax(request)) { response.setstatus(httpservletresponse.sc_unauthorized); } else { throw ex; } } this way can both handle exception myself (for example, log attempt of accessing @secured method) , let spring part , redirect user login page rethrowing accessdeniedexception. also, when request comes ajax set response status sc_unauthorized , handle error on client side

c++ - Not Detecting Input Properly -

i've started c++ today, , working on advanced text-based calculator. anyways, i'm working on exponents, when start program, , enter string starts exponent mode, doesn't go expponent mode, regular calculator mode. here code: // // main.cpp // c++ calculator // basic calculator application run through command line. // v.0.02 - second version of calculator, basic text, command line interface, loop. // created johnny carveth on 2013-04-17. // copyright (c) 2013 johnny carveth. rights reserved. // #include <math.h> #include <iostream> int int1, int2, answer; bool bvalue(true); std::string oper; std::string cont; using namespace std; std::string typeofmath; double a; double b; int answerexponent; int main(int argc, const char * argv[]) { // taking user input, first number of calculator, operator, , second number. addition, substraction, multiplication, division cout<<"______________________________________________\n"; cout&

java - How large does a graph need to be to trigger the worst-case complexity of a Fibonacci heap? -

i've been trying trigger worst-case complexity of fibonacci heap using dijkstra's algorithm apparently no luck. have second implementation of dijkstra's using vanilla binary heap, , seems win. told conduct tests using larger datasets, have, shown (copy-pasted straight program): running dijkstra's algorithm 3354 nodes , 8870 links... source node: time using binary heap = 2167698339 ns (2167.70 ms) versus... running dijkstra's algorithm 3354 nodes , 8870 links... source node: time using fibonacci heap = 11863138070 ns (11863.14 ms) 2 seconds, against ~12 seconds. quite difference alright. now, have graph whopping 264,000 nodes , 733,000 edges. haven't had chance test yet, enough theoretical advantage of fibonacci heaps shine? i hope don't need on million nodes. mean it's not biggest issue in world nice see difference in action once. first of question's title not correct. size of input not affect worst case complexity. need size

python - Bug or meant to be: numpy raises "ValueError: too many boolean indices" for repeated boolean indices -

i doing simulations in experimental cosmology, , encountered problem while working numpy arrays. i'm new numpy, not sure if i'm doing wrong or if it's bug. run: enthought python distribution -- www.enthought.com version: 7.3-1 (32-bit) python 2.7.3 |epd 7.3-1 (32-bit)| (default, apr 12 2012, 11:28:34) [gcc 4.0.1 (apple inc. build 5493)] on darwin type "credits", "demo" or "enthought" more information. >>> import numpy np >>> t = np.arange(10) >>> t[t < 8][t < 5] traceback (most recent call last): file "<stdin>", line 1, in <module> valueerror: many boolean indices >>> i expected return: array([0, 1, 2, 3, 4]) since t[t < 8] should presumably treated ndarray? the numpy documentation ( http://docs.scipy.org/doc/numpy/user/basics.indexing.html ) says boolean arrays indices: as index arrays, returned copy of data, not view 1 gets slices. running type(t[t

mysql - Join city_name for users and for an event -

i trying city name event , city name user lives. both have postalcode, corresponds city_name in table cities . my query far: select meetups.meetup_name, meetups.meetup_text, users.username, cities.city_name meetups, users, cities meetups.url_meetup = ? , users.id = meetups.author_id , cities.postalcode = meetups.postalcode what still need city name user. my tables looks follows: meetups => id meetup_url meetup_name meetup_text author_id postalcode users => id username postalcode cities => postalcode city_name select meetups.meetup_name, meetups.url_meetup, meetups.meetup_text, users.username, c1.city_name meetup_city, c2.city_name user_city meetups, users, cities c1, cities c2 url_meetup = ? , users.id = meetups.author_id , c1.postalcode = meetups.postalcode , c2.postalcode = users.postalcode this should u name of user city well.

naming - Case of names of built-in JavaScript types -

in javascript, typeof 0 gives 'number' not 'number' , instanceof 0 number . would accurate canonical names of built-in types capitalized, , lowercase return value of typeof quirk/inconsistency can't changed historical reasons, changed if be? or missing something? no, actually number built-in value type number object. if typeof there's no need temporarily convert 0 object. if use instanceof, temporarily converts 0 object. this similar string: "sometest" => string however, if "sometest".tolowercase() first (temporarily) convert string string-object , call method on object (since value-types can't have methods). in short, lowercase means value-type, uppercase means object

Android: DialogFragment and universal xml -

i trying take control of database in android dialog fragments. mean, example add new record click button , pop-up fragment appears asking me specific fields. click ok fires method in hosting activity. part works. however, want have other operations delete, update, search record ect. is there way have universal code fragment assign different xml according different database operations? looking efficient way around problem. thanks! you can inflate different views on fragment... public class myclass extends fragment { string xmltoload; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstances); bundle data = getarguments(); xmltoload = data.getstring("what set in fragments pager"); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { if(xmltoload.equals("whatever")) { view view = inflater.inflate(r.layout.thisxml, container,false);

c# - INotifyPropertyChanged when binding to object itself instead of a property -

i'm doing binding in windows phone 8's wpf form. i've got list bound object itself: {binding .} that object implements inotifypropertychanged interface. in scenario bind property on object: {binding someproperty} i can call property changed event , list updated. however, in case i'm bound object itself, how can notify list object changed? a short answer is... 1) if want update - , inotify... work - either need reorganize view-models bit - , bind property - of 'parent view model'. 2) or make 1 'temp property' - e.g. public yourobject myself {get{return this;}set{}} 3) or in cases (depends on have) use multibinding {binding .} (this) , other property - 'notified' (the other property). i've described in more details here ( point #4 ) refreshing value converter on inotifypropertychanged

ruby - How to request (GET/POST) routes in RSpec that have a wildcard -

i have (admittedly hideous) route in rails: scope '/software' post '/:software_id/:attachment_id/event/*event' => 'software#post_event', as: 'post_event' end (i change legacy api) and writing rspec test it. rake routes gives me: post_event post /software/:software_id/:attachment_id/event/*event(.:format) api/version1301/software#post_event my test looks this: describe "post_event" "should respond 204" params = { attachment_id: @attachment.uid, software_id: @license.id } post :post_event, params response.code.should eq "204" end end but following routing error: failure/error: post :post_event, params actioncontroller::routingerror: no route matches {:format=>"json", :name_path=>:api, :attachment=>"7b40ab6a-d522-4a86-b0de-dfb8081e4465", :software_id=>"0000001", :attachment_id=>"7b40ab6a

java - calculating average of random integers in an array -

i need generate specified number of random integers between 2 values specified user (example, 12 numbers between 10 , 20), , calculate average of numbers. problem if ask generate 10 numbers, generate 9 (shown in output.) also, if enter max range of 100 , min range of 90, program still generate #'s 147, etc on max range... did mess random number generator? can help? here code have far: public class arrayrandom { static console c; // output console public static void main (string[] args) { c = new console (); decimalformat y = new decimalformat ("###.##"); c.println ("how many integers generate?"); int n = c.readint (); c.println ("what maximum value these numbers?"); int max = c.readint (); c.println ("what minimum value these numbers?"); int min = c.readint (); int numbers[] = new int [n]; int x; double sum = 0; double average = 0; //n = number of random integers

javascript - Chrome Extension full page or Chrome Packaged App in browser -

i know if there's way can create chrome packaged app or extension in can open complex gui in browser (similar if visit settings or extensions pages of chrome, tab that's built browser). know can launch new window packaged app or "popup" chrome extension. want able launch new chrome instance app inside of chrome:// page. possible? i know there have been work arounds mentioned, such using chrome extension open tab communicate background app, seems of hack. there more elegant accomplish this? thanks in advance! you can have temporary page open when app button clicked empty page open new tab app page want using chrome.tabs api chrome.tabs.create({url:'http://www.google.com/'}); of course replace url qualified path desired page using chrome.extension.geturl('relative app path here') then call history.back(); to return new tab page.

google app engine - How do I force all requests to use https on a custom domain in appengine? -

i have certificate set up. http://www.example.com , https://www.example.com both works. however, want route traffic http://www.example.com go https://www.example.com . how can appengine? i'm using python. add app.yaml: handlers: - url: your_url script: your_script secure:

Javascript - how to delete an object? -

i have object: var myobj = new myawsumobj(); now, deleting that: myobj = undefined; but apparently nothing, since object still exists (i can see exceptions being thrown in 'external' javascript file object defined in). how clear stuff up? possible? because seems myobj doing in external javascript file, maybe creating new objects, possible clear mess without refactoring external file? unfortunately, it's not possible. description, object seems creating references itself, adding event handlers, setting timeouts/intervals, ajax callbacks, whatever. if clear references object created yourself, you'd still have clear references creates on own. become inactive, unreferenced, , eligible garbage collection. but source code, maybe object provides "destruct" method take care of mess.

javascript - CSS3 animation begin when hovering over a different element? -

i have navigation bar i'm trying 2 links animate in off-page , end next other links when hover on 1 of links in list. current navigation links: <div class="links"> <ul> <li> <a href="#">link 1</a> </li> <li> <a href="#">link 2</a> </li> <li> <a href="#">link 3</a> </li> </ul> </div> and css .links: .links ul { white-space: nowrap; list-style-type: none; position: fixed; top: 8px; left: 60%; z-index: 4; width: auto; height: 67px; } .links li { white-space: nowrap; display: inline-block; margin-right: 30px; z-index: 4; height: 40px; } and here's relevant css, along animation have works properly: .extralinks { position: fixed; top: 8px; left: 90%; animation-name: slidey; animation-duration: 1s;

c++ - Restore changes in cpp file after close in Visual studio 2012 -

i wrote lot of code in c++ , save. after want try example code find. paste code in project main.cpp file (where had code). try example code , mistake close file. after open main.cpp file, can't undo changes ctrl-z. wanted try example code , wanted undo changes ctrl z, mistake close file. possible undo changes after close file or restore it? your original code gone good. however, perhaps time consider adding version control system tool set, avoid kind of mistake in future, give lot of other benefits. also, not wise idea paste example code on own work in way you've done, reason you've discovered. insert new file project, or create separate project testing example code. have separate visual studio solution purpose. edit: "probably" because can't rule out possibility of recovery based on information you've supplied (e.g. might have kind of scheduled backup caught previous version). also, if code pasted on shorter original code, it's possi

php - Dynamically building horizontal menu -

i have javascript code allows me create horizontal menu sub menus so: <ul id="menu"> <li>menu 1 <ul> <li>sub menu 1</li> </ul> </li> </ul> i can create many sub menus want, problem i'm using php grab links mysql database , don't know how can dynamically build these sub menus without manually checking sub menu on , on again. example in mysql table: fields: menu_id menu_name menu_link menu_parentid so menu id auto increment , menu_parentid allows me assign sub menu name/link parent menu. in order 2 sub menu checks: $query = "select * site_menu menu_parentid = 0"; foreach($query $q) { //run through results $query2 = "select * site_menu menu_parentid = $q['id']"; foreach($query2 $q2) { //run through results } } as can see have query twice first sub menu, if there third sub menu? have run 3 queries? suggestions? perhaps function or do..while loop may in order? proo

powershell - How to mirror files with given pattern (wildcard) -

i've got folder lots of installation files inside. take of these (found given pattern) , mirror them flash drive. source: d:\ccleaner124.exe d:\dfc221.exe d:\abc.exe destination: h:\ccleaner123.exe h:\dfc221.exe pattern: (stored directly in script or @ .txt file) d:\ccleaner*.exe d:\dfc*.exe result: source: unchanged destination: h:\ccleaner124.exe // deleted 123 had lower version number in pattern [a-za-z_-]*([0-9]*) , copied 124 instead h:\dfc221.exe // current, kept same (no copy) i looked copy-item function properties, haven't found "mirror" parameter there. possible power shell? bellow working script (i wrote simmliar sometime ago). put in copy.ps1, modify sourcedir, destdir, , pattern array function removename($txt) { $inputpattern = "^[a-z]+" $txt = [system.text.regularexpressions.regex]::replace($txt, $inputpattern, ""); $inputpattern = "[.][a-z]+" $txt = [system.text.regulare

JIRA REST API performance - OAuth vs HTTP Basic Authentication -

following doco of jira rest api, oauth , http basic 2 recommended authentication. using http basic 1 https, works , safe. is there difference on performance between them? excluding initial token negotiation, oauth still computationally more expensive basic authentication, given larger size of secured payload, , signing requirements. non-exhaustive list of logic needs carried out: request parameter normalization request uri normalization generate nonce request signature calculation reverse entire process on receiving end compared basic authentication requires simple hashing in order calculate single required header - oauth without doubt more expensive authentication. but , important thing realize 2 authentication mechanisms serve entirely different purposes. basic auth authenticating client primary application. oauth authorizing third party access client data primary application. both have place , selecting 1 on other should driven particular use case of implem

php - Facebook manage_groups permission -

is there update on ability manage facebook groups through opengraph api. trying delete members group using api need manage_groups permission. whenever try add api error stating doesn't recognize it. has had success getting work? try using permission "user_groups" , in automatically grant manage_groups permission user_groups permission retrieve groups session user member of. user_managed_groups permission can used read group content group in user admin. permission allows app post user in group if app granted publish_actions permission. https://developers.facebook.com/docs/graph-api/reference/v2.3/group the bad new faceboook request submit review , doesnt allow permission platform. made web app php , when sent review refuse permission following answer: the user_groups permission granted apps building facebook-branded client on platforms facebook not available. example, android , ios apps not approved permission. in addition, web, desktop, in-car , t

c# - how can nested grids for hierarchical data be created using Windows Forms Controls? -

i'm looking way create datagridview has rows when clicked expand reveal datagridview right below them. possible accomplish without creating brand new datagridview-like control or better off displaying nested datagridviews elsewhere? (here's article explains how in asp.net. however, it's not clear whether can done windows forms: http://msdn.microsoft.com/en-us/magazine/cc164077.aspx ) you allways need custom control (free or paid) achive this. tree view columns (free under cpol) devexpress xtragrid (paid) janus gridex (paid)

size - How to use custom video resolution when use AVFoundation and AVCaptureVideoDataOutput on mac -

i need process each frame of captured video frame, although avcapturedevice.formats provided many different dimension of frame sizes, seems avcapturesession support frame sizes defined in presets. i've tried set avcapturedevice.activeformat before avcaptureinputdevice or after, no matter setting set, if set avcapturesessionpresethigh in avcapturesession , give me frame of 1280x720. similar , if set avcapturesessionpreset 640x480, can frame size of 640x480. so, how can set custom video frame size 800x600? using media foundation under windows or v4l2 under linux, it's easy set custom frame size when capture. it seems not possible under mac. set kcvpixelbufferwidthkey , kcvpixelbufferheightkey options on avcapturevideodataoutput object. minimal sample below ( add error check ). _sessionoutput = [[avcapturevideodataoutput alloc] init]; nsdictionary *pixelbufferoptions = [nsdictionary dictionarywithobjectsandkeys: [nsnumbe

Name of Foreign Key record in rails view -

how find record name of foreign key in rails view? for example, have view lists following: <% @cycles.each |cycle| %> <tr> <td><%= cycle.name %></td> <td><%= cycle.program.try(:name) %></td> <td><%= cycle.previous_cycle_id %></td> <td><%= cycle.next_cycle_id %></td> for cycle.previous_cycle_id , instead of printing out 1 example, want print out name of cycle, cycle one. thanks help! unless have name of previous cycle stored in current cycle (or somewhere else in memory), you'll have query database find name. in case <%= cycle.find(cycle.previous_cycle_id).name %>

c# - How to seed Register & Login data using Entity Framework & SimpleMembership -

using simplemembership provider in mvc-4, trying seed registration details few users, below public class contextinitializer : dropcreatedatabasealways<accountscontext> { protected override void seed(accountscontext context) { base.seed(context); context.userprofiles.add(new userprofile { userid = 1, username = "admin" }); context.userprofiles.add(new userprofile { userid = 2, username = "user1" }); } } but unable set password & confirmpassword , since not found in userprofile class. located in registermodel class, not accessed directly accountscontext. can't this? simplemembershipprovider _membership = membership.provider; _membership.createuserandaccount("username", "password");

javascript - Pulling data-caption from image with Elastic Image Slideshow, and display it on the page -

i using elastic image slideshow script, , add data-caption text each image, display text of shown image div, outside of slideshow (basically in different section of page.) i found this script , work jquery cycle, , tried modify work not having luck. ok, found fiddle: http://jsfiddle.net/snfst/6/ , modified down this: $('img').hover(function(){ $('#caption').html($(this).data('caption')) }); question how load without having hover on image, , show data shown image? the page i'm trying make work on might better show i'm trying do: http://diguiseppi.com/brad/andy/portfolio-web-design.html

C++ STL fails to find comparator for nested class -

i expected code work, fails compile gcc. compile if lift inner class out. #include <algorithm> template <typename t> struct outer { struct inner { int x; }; inner vec[3]; }; template <typename t> bool operator <(const typename outer<t>::inner& lhs, const typename outer<t>::inner& rhs) { return lhs.x < rhs.x; } int main() { outer<int> out; outer<int>::inner in; std::lower_bound(out.vec, out.vec + 3, in); } gcc 4.4 has say: ... bits/stl_algo.h:2442: error: no match ‘operator<’ in ‘* __middle < __val’ gcc 4.7 prints lot more stuff, including above, ending this: ... bits/stl_algobase.h:957:4: note: couldn't deduce template parameter ‘t’ i'm willing believe it's not well-formed c++, why not? the problem mentioned compiler couldn't deduce template parameter t . because typename outer::inner nondeduced context context t. when template parameter used in nondeduced c

ruby on rails - PaperTrail and batch versioning -

in rails app, have series of objects can reordered on page (each object saves position relative other objects on page). i'd versioning on how these objects arranged can implement undo/redo buttons. i thought papertrail gem might option saving tree structure of how these objects sorted, issue when user rearranges objects, position of objects might change while others not, , papertrail seems save versions when object has been changed. i'd can save snapshot of state of objects in model. there way force papertrail save version call like @objects.each |object| @object = object.versions.scoped.last @version = version.find(@object) @version.reify.save! end for undoing changes? or there better way accomplish this? for example (i'm sorting 2d arrays): before making changes: name | position | ancestry step 0 | 0 | 0 step 1 | 1 | 371 step 2 | 2 | 371 after making changes: name | position | ancestry step 0 | 0 |

java - How restart bluetooth service in bluecove? -

i have desktop , android applications, connected bluetooth(in desktop side use bluecove 2.1.1 library). desktop application create bluetooth service android application connects it. want add logout functionality both desktop , android sides. example in desktop app user click disconnect, both desktop , android apps reset connections , should able connect again. here bluetoothservice code desktop side: public class bluetoothservice { private static final string servicename = "btspp://localhost:" // + new uuid("0000110100001000800000805f9b34f7", false).tostring() // + new uuid("0000110100001000800000805f9b34f8", false).tostring() + new uuid("0000110100001000800000805f9b34f9", false).tostring() + ";name=servicename"; private streamconnectionnotifier m_service = null; private listenerthread m_listenerthread; private dataoutputstream m_outstream; public bluetoothservic

Webview displaying one HTML file in iPhone sdk -

i have 3 html files in local resources bundle. need display reader. used web view display using following code, - (void)viewdidload { [super viewdidload]; totalarray=[[nsmutablearray alloc]init]; [totalarray addobject:@"file1"]; [totalarray addobject:@"file2"]; [totalarray addobject:@"file3"]; nslog(@"totalarray count:%d",[totalarray count]); (int i=0;i<3;i++) { nslog(@"i count:%d",i); nsstring *bundlepath = [[nsbundle mainbundle] bundlepath]; nsurl *bundlebaseurl = [nsurl fileurlwithpath: bundlepath]; nslog(@"webview %@", bundlepath); nsstring *filepath1= [[nsbundle mainbundle] pathforresource:[totalarray objectatindex:i] oftype:@"html"]; nslog(@"filepath1:%@",filepath1); [htmlview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:filepath1]]]; } } am getting total count 3, current index counts , file path. still disp

In Java, is there a way to set a line in a method to return to at any point later in the method? -

i'm learning program in java , i'm wondering if there simple way set return point in method in case user decides want go back. example, within method, ask user choose between 1 of 3 options: 1) register 2) search 3) other let's user chooses register. choice presents them 2 new options: 1) register user 2) register admin let's choose register admin. prompted enter information, maybe halfway through realize "wait! want register user, not admin!". typing in "back" option, , if so, want able take them menu choose between user , admin, not way beginning. there way this? know use loops, program bit more complicated example, rather not if can around it. i'm looking way similar way can name loops in assembly language, can "go point" , goes without user having re-enter information did before sub menu want to. (i realize in example don't enter info until sub menu. in actual program do.) any ideas? if worse comes worse, i&#

multithreading - How to check if callback is executed in GUI Thread: Android -

this question has answer here: how check if running on ui thread in android? [duplicate] 5 answers i have application in receieve callbacks native layer , based on these callbacks update list ui on screen. how check of callbacks being executed in ui thread or in separate thread? simple way see thread ui on http://docs.oracle.com/javase/6/docs/api/java/lang/thread.html#currentthread() check again later in callback.

Generic function definitions in F# signature files and corresponding implementation file -

i'm trying create abstraction lightweight data storage module using f# signature file. here signature file code, let's it's called repository.fsi namespace datastorage /// <summary>lightweight repository abstraction</summary> module repository = /// <summary> insert data repository </summary> val put: 'a -> unit /// <summary> fetch data repository </summary> val fetch: 'a -> 'b /// <summary> remove data repository </summary> val remove: 'a -> unit here corresponding implementation, let's call repository.fs namespace datastorage module repository = (* put document database collection *) let put entity = () (* select document database collection *) let fetch key = ("key",5) (* remove document database collection *) let remove entity = () in visual studio project file have signature file (repository.fsi) above implementation file (

ios - How to sync music from pc to iphone music library programmatically? -

i have downloaded music website url or pc via sharing application , stored local document directory. want add stored musics local directory device's music library programmatically. so how sync music local directory iphone/ipod/ipad device's music library programmatically without using itunes? in advance. when iphone plugged computer, open itunes automatically , itunes sync music.

image processing - PCA using SVD in OpenCV -

i have matrix m of m*n dimension. m contains n number of data each has m dimension , m very large n. now question is, how compute or steps or procedure find pca of m using svd in opencv keeping eigenvectors containing 99% of total load or energy ? you need first compute covariance matrix c data matrix m. can either use opencv's calccovarmatrix function or compute c = (m - mu)' x (m - mu) assumed data samples stored rows in m , mu mean of data samples , a' matrix transposed. next, perform svd on c usu' = svd(c), u' u transposed. in case v' svd same u' because c symmetric , positive definite (if c full rank) or semidefinite if rank deficient. u contains eigenvectors of c. what want keep k number of eigenvectors i.e. k number of columns(or rows? got check opencv docs whether returns eigenvectors rows or columns) of u corresponding singular values in matrix s corresponds k largest singular values , sum divided sum of singular values &g

Spin buttons to up quantity in javascript -

i have made spin control increments & decrements onclick event problem want restrict never allowed display below value of 1. when shows 1 , hit decrement arrow goes down 0 , there continue -1, -2, -3 etc etc is ther way can add script/function make minimum quantity displayed 1 my function in head tag is: <!---spin buttons quantity---> <script type="text/javascript"> function changeval(n) { document.forms[0].quantity.value = parseint(document.forms[0].quantity.value) + n; } </script> and field in form is: <td ><input name="quantity" type="text" class="quantity" onfocus="this.blur();" value="1" /></td> <td style="width:14px;"> <table cellpadding="0" cellspacing="0"> <td width="28"><img src="siteimages/b

c - ANDing with different bit lengths -

i have following: void calculate(unsigned long num1, unsigned long num2){ int32_t invertednum2 = ~(num2); // yields 4294967040 printf("%d\n", invertednum2); // yields 255 // num1 3232236032 int32_t combine = (int32_t) num1 & num2; printf("%d\n", combine); // yields 0??? } i'm trying , num1 , num2 result be: 000000000000000011111111 i'm not sure if i'm anding correctly 2 different bit lengths or if should cast. any appreciated! thanks you can't , different bit lengths in c, because can't apply binary operator (except shift) on operands of different types. if write code operands different types, c compiler first convert them same type (and same size) before doing operations. there 7 pages in c spec (section 6.3) devoted details of precisely how happens. as result when have: int32_t combine = (int32_t) num1 & num2; and num1 , num2 both unsigned long , 64 bits, happen is

mysql - 2 rows having unique field and recent date -

Image
table : i new query writing. stuck on retrieving 2 rows above table. data date sorted in descending order 2 different topic_id. there won't third different topic_id. so want retrieve 2 rows have different topic_id, 1 data each topic_id having recent date. the result be try sql fiddle http://sqlfiddle.com/#!2/f37963/9 select t1.* temp t1 join (select question_id, max(`date`) `date` temp group topic_id) t2 on t1.question_id= t2.question_id , t1.`date`= t2.`date`; the logic find latest date in each group (subquery) , join table again retrieve other particulars.

Find the count of the words in the text file using python -

this question has answer here: python - find occurrence of word in file 5 answers i had text file named content_data following content a house house must beautiful house , never regrets regrets baloon in baloons. find words must repeated words in file of house , ballons now need read file using python , need find count of each , every word we need implement result in form of dictionary below format {'house':4,'baloon':3,'in':4........}, i mean in format of {word:count} can please let me know how this from collections import counter string import punctuation counter = counter() open('/tmp/content_data') f: line in f: counter.update(word.strip(punctuation) word in line.split()) result = dict(counter) # note: because have # isinstance(counter, dict) # may leave result counter object print result

LDAP password reset but i don't have the old password from Java application -

i want add code helps me reset ldap user password , searched must have old password reset , add new password . how reset password without having old one. i looked link , ended solution contains usage of old password ldap changing user password on active directory final modification _delete_old_modification = new modification(modificationtype.delete, "unicodepwd", ('"' + oldpassword + '"').getbytes("utf-16le")); final modification _add_new_modification = new modification(modificationtype.add, "unicodepwd", ('"' + newpassword + '"').getbytes("utf-16le")); thanks get rid of first line, , change modification type in second replace.

java - Can I set IntelliJ to auto indent the code body? -

Image
question 1: can intellij set indent code body automatically upon making new line? here example of mean: i have method: public static void main(string[] args) { system.out.println("hi there."); } upon hitting return key after typing expression, this: public static void main(string[] args) { system.out.println("hi there."); // new line aligns braces. } i this: public static void main(string[] args) { system.out.println("hi there."); // new line aligns preceding line } i haven't been able locate option anywhere under settings make default behavior. exist , missing or looking unicorn? question 2: there option have code body indented default? if so, can found? example: upon using "reformat code..." command, this: public static void main(string[] args) { system.out.println("hi there

Import Multiple CSV Files to SQL Server from a Folder -

i have folder called "dump." folder consists of variouos .csv files. folder location 'c:\dump' i want import contents of these files sql server. want rough code along proper comments understand it. i have tried few codes found on net. haven't quite worked out me strange reason. the steps have are step 1: copy file names in folder table step 2: iterate through table , copy data files using bulk insert. someone please me out on one. lot in advance :) --bulk insert multiple files folder --a table loop thru filenames drop table allfilenames create table allfilenames(whichpath varchar(255),whichfile varchar(255)) --some variables declare @filename varchar(255), @path varchar(255), @sql varchar(8000), @cmd varchar(1000) --get list of files process: set @path = 'c:\dump\' set @cmd = 'dir ' + @path + '*.csv /b' insert allfil

Is it possible to invalidate azure cdn by delete-ting a file and re-uploading it? -

i having azure storage , using as cdn web application,now want invalidate cdn content every time when upload files storage account. my question when delete file in azure storage container , upload again same name,will cause cdn invalidate file?(i aware appending file version filename cause cdn invalidate file,but in case need monitor old files , remove them not referenced now,which last resort) azure not yet support purge, though rumored under development. deleting object blob storage not cause purge because object still subject ttl. after ttl has expired cdn check see if object still valid, , then remove it . until azure cdn implements purge either need use versioning or manage content expiration .

javascript - building script tags that load in order and accept variables -

in code below instead of using <script src="" ></script i building script up. enable me insert client , calc names - i.e. add variables src calling. leads js errors scripts not loaded in @ right time/ order. here code <script type="text/javascript"> var client = 'test'; var calc = 'loancalculator'; var insertscript = function(src){ var element= document.getelementsbytagname('head')[0]; var script= document.createelement('script'); script.type= 'text/javascript'; script.src= src; element.appendchild(script); } var insertscriptcontent = function(code){ var element= document.getelementsbytagname('body')[0]; var script= document.createelement('script'); script.type= 'text/javascript'; script.innerhtml = code; element.appendchild(script); } insertscript('http://test.com.au/clients/' + client +'/web/'+calc+'/calculator-lib.js&#

mysql - Remove dulpicate rows from table in faster way -

what best way remove dulpicate rows large table(500000+ rows). had code works not fast enough. here code. delete foo foo inner join (select link, min(id) minid foo group link) b on foo.link = b.link , foo.id != b.minid please tell me anyother way faster code. thanks....... query: delete f foo f (select min(f1.id) (select * foo) f1 f1.link = f.link) != f.id query remove duplicate records between in id=50 id=100: delete f foo f (select min(f1.id) (select * foo) f1 f1.link = f.link) != f.id , f.id >= 50 , f.id <= 100

android - Alarm Manager not working -

i trying create new scheduler app runs daily on user defined time.here code below. problem scheduler not running on set time.please suggest how this private void setalarm(string targetcal){ toast.maketext(mainactivity.this,"alarm set", toast.length_long).show(); string[] time=targetcal.split(":"); calendar timeoff = calendar.getinstance(); intent intent = new intent(getbasecontext(), alarmreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(getbasecontext(), rqs_1, intent, 0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(context.alarm_service); //int days = calendar.sunday + (7 - timeoff.get(calendar.day_of_week)); // how many days until sunday timeoff.set(calendar.hour,integer.valueof(time[0].trim())); timeoff.set(calendar.minute,integer.valueof(time[1].trim())); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, timeoff.gettimeinmillis(), alarmmanager.interval_day , pendingintent);

sql - Need help in tuning a query in Oracle11g -

i modifying original question few conditions changed - running following query on oracle11g & takes 27 seconds show results. can please suggest solution improve response time of query? providing relevant details below - select column1 , round(count(column2)/10) se_ca column3 <= 4855 , column4 > 4490 group column1; se_ca table has total 123914265 records. plan_table_output -------------------------------------------------------------------------------- plan hash value: 3324421310 ------------------------------------------------- | id | operation | name | cost (%cpu)| ------------------------------------------------- | 0 | select statement | | 211k (3)| | 1 | hash group | | 211k (3)| |* 2 | table access full| se_ca | 208k (1)| ------------------------------------------------- predicate information (identified operation id): plan_table_output -----------------------------------------------------------------------------

Java 7 ssl handshake fails when on Java 6 it works -

i'm using ability mail server (ams) tool test smtp server network availablilty in variours configurations (smtp, smtp tls, smtp on ssl, etc.). server side written on java , uses subethasmtp library implemetation. ams works , serves testing needs right until decide upgrade server java 6 java 7. since then, i'm unable use utility test smtp on ssl , smtp tls connectivity because every attempt i'm getting: outgoing route: relay localhost:40125 rejected connection my other integration tests writthen on java successful, problem still bugs me. i'm unable find out, can different. my java 6 successful ssl handshake debug output org.subethamail.smtp.server.session-/127.0.0.1:51806, read: tlsv1 handshake, length = 205 org.subethamail.smtp.server.serverthread *:40125, setsotimeout(60000) called *** clienthello, tlsv1 randomcookie: gmt: 1366202273 bytes = { 29, 88, 44, 226, 58, 30, 188, 76, 46, 113, 18, 193, 226, 156, 129, 241, 160, 23, 39, 190, 177, 37, 141, 173, 17