Posts

Showing posts from September, 2010

cordova - How to open app chooser when clicking on a phone number? -

in apps when users click on phone number, app chooser pops out: call, skype, whatsapp, viber, list depending on apps installed. the same chooser seen when users click on email address. i can list contact phone numbers , contact id in phonegap. how make such link? made cordova-webintent ?

java - how can i access css and images in spring mvc -

i'm trying access css in jsp while using spring mvc. couldn't. tried adding solutions posted on other forums couldn't work. here web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>project1</display-name> <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servl...

Using Linq to XML using C#, how do I find attribute values? -

i need activities specific claim id = 13 using linq c#, trying below code, it's not working. xdocument doc = xdocument.load(downloadedpath); var activites = (from e in doc.descendants("activity") (string)doc.element("claim").element("id") == 13 below xml <?xml version="1.0" encoding="utf-8"?> <advice> <claim> <id>12</id> <providerid>cl-mc-0012-07</providerid> <activity> <id>20131520320</id> <start>24/07/2013 13:00</start> <type>3</type> </activity> <activity> <id>20131520321</id> <start>24/07/2013 13:00</start> <type>3</type> </activity> </claim> <claim> <id>13</id> <providerid>cl-mc-0012-07</providerid> <activity> <id>20132058590...

SQL Server Return All Sub Categories -

i have 2 tables in sql server 2008 r2: tblcategories cat_id cat_name tblcategoryhierarchy cat_parent_id cat_child_id there can number of levels, , number of sub-categories under each category. changing table structure not possible. what i'm looking do, provide 1 cat_id , return cat_id 's under within hierarchy, no matter how many levels there are. for example ( tblcategoryhierarchy ): cat_parent_id cat_child_id 101 200 101 201 101 202 101 203 202 300 202 301 100 101 200 201 202 300 301 203 102 if provide cat_id 101, need return: 200, 201, 202, 300, 301 , 203. i've attempted vb had lots , lots of queries , slow. i'm looking pure sql solution, i'm hoping fast , not take many server resources. a store procedure sounds me, there way achieve need way..? you can recursive common-table expression (cte). something below should it. here x = 4 a cons...

webrtc - where exactly the iceCandidate generate in AppRtcDemo? -

i working on webrtc peer peer calling , running apprtcdemo available on webrtc site . have gone through code , stuck on few points : 1 : when enter url hit server , got response like : response return server{"meta_viewport":"","pc_constraints":"{\"optional\": [{\"googimprovedwifibwe\": true}]}","opusfec":"true","include_vr_js":"","vsbr":"","audio_receive_codec":"opus\/48000","arbr":"","vrbr":"","vsibr":"","token":"ahrlwroqceuffbws4dljrahxtwho2ldeh_94m_ziprkk7aih3naisffscjb_opz2lwc9xveweqrjkrwqaetsk5sxdjepoc3jp8uqxke23qnsanqobwshom4","initiator":1,"ssr":"","room_key":"95505311","pc_config":"{\"iceservers\": [{\"urls\": \"stun:stun.l.google.com:19302\"}]}","...

spring - Using partitioning to do multi-schema multi-tenancy with dynamic tenants -

i'm writing web application must multi-tenant. i'm using jpa persistence layer , i'm evaluating eclipselink interest. the multi-tenant strategy want use is: 1 schema per customer. hibernate supports such strategy ( http://docs.jboss.org/hibernate/orm/4.2/devguide/en-us/html/ch16.html#d5e4771 ) , i've used success. however, afaik supports when using native hibernate api, while want use jpa. eclipselink, on other hand, supports single-table , multi-table multi-tenancy strategies. however, supports partitioning , simple custom partitioning policy may set 1 partition each customer. the first question might whether using partitioning use case appropriate or not. the main problem, however, customer base may (hopefully) grow on time, have make eclipselink "know" new customers dynamically (i.e.: without restarting webapp). understand, set partitioning in eclipselink have setup persistence unit different "connection pools" (or "nodes"): ...

cordova - get phone or external memory storage path of windows phone in phonegap -

i using phonegap download file server , save in phone or external memory using file plugin , code is cordova.file.documentsdirectory ios and cordova.file.externalrootdirectory android but when deploy app in windows phone shows error. can me storage path of phone or external memory save file windows phone. thanks in advance.

c# - Exporting to excel with carriage returns -

Image
i trying export excel datagrid . datagrid has column put comments in. in column comments put on separate lines. when exports excel exports in multiple rows. here how looks in datagrid : here how looks when export excel: here code using it: public static void createexcelfromclipboard(string worksheetname, string fullfilepath, bool toopen) { //excel application class _application app = new microsoft.office.interop.excel.application(); //get process id int excelprocessid = getapplicationprocessid(app); try { //add workbook workbook theworkbook = app.workbooks.add(xlwbatemplate.xlwbatworksheet); //add worksheet var theworksheet = (worksheet)theworkbook.worksheets.add(type.missing, type.missing, type.missing, type.missing); theworksheet.name = worksheetname; app.sheetsinnewworkb...

uitableview - Explicitly set row height for some rows but use estimatedRowHeight for others -

i have uitableviewcell contains uiwebview subview. web view fills entire cell. using estimatedrowheight calculate row height. however, @ time table view built, cell has no height because web view has not loaded it's content, therefore cell has no content. because of this, estimatedrowheight returns 44 instead of correct height of web view content. does know how can correctly calculate height of row when content not set? there way estimate height of cells , explicitly set heigh of other cells, in same table view? this how using estimatedrowheight : self.tableview.estimatedrowheight = 200; self.tableview.rowheight = uitableviewautomaticdimension; i not using delegate method. have tried it, not change result. cell using has xib uses auto layout constraints. clear, cell appear , web view added cell. problem height of cell not big enough show entire web view. web view loads html embed code audio player. i did fiddling around , found out can use uitableviewautoma...

c# - Xamarin iOS - Simulator View is not refreshing -

i have simple piece of code built in xamarin ios in viewcontroller : void logmessage (string message) { logtext.text += string.format("\n{0}", message)); } where logtext is: [outlet] [generatedcode ("ios designer", "1.0")] uilabel logtext { get; set; } the code being called, text property of logtext being updated properly, in ios simulator see no change @ all. tried replacing uilabel uitextview nothing changes. if trying update ui background thread, not work. force update on ui thread, try this invokeonmainthread (delegate { logtext.text += string.format("\n{0}", message)); });

c++ - Unable to send pdf through binary with UDP -

i having trouble sending pdf file client server reading file in binary. using udp transfer , when send text file client server receive file without errors when send pdf error opening file. heres have both sender , receiver: sender: file = fopen(file_name_char, "rb"); //read in binary here int size_count = (file_size / (buffer_size - 2)) + 1; //amount of times loop (int = 0; < size_count; i++) { memset(szbuffer, 0, buffer_size); fread(szbuffer, sizeof(char), buffer_size - 2, file); //read buffersize -2 (reserve spot bit , \0) strcpy(szbuffer, concat(current_bit, szbuffer)); send_with_select(s, szbuffer, (struct sockaddr*)&sa1, (struct sockaddr*)&sa1, sa1_length, current_bit, "file contents", 0); //send file contents file_size = file_size - buffer_size + 2; //decrease size client_bit = change_bit(client_bit); ...

java - jUnit testing @RequestParam, but my test doesn't give any value to it -

how can test requested parameters coming html spring controller? @requestmapping(value = "foo", method = requestmethod.post) public string foo(@requestparam(value="bar", required=false) string bar{ if(bar==null || bar.length()==0){ return "error"; } return "success"; } i don't understand why isn't working? @test public void testfoo() throws exception { mockmvc.perform(post("/foo") .param("bar", "this not null")) .andexpect(view().name("success")); } i get: java.lang.assertionerror: view name expected:"success" was:"error" so want controller test skips validation part , goes "success", somehow test isn't giving value bar variable. how make work?

javascript - How to overlay one div over another? -

when hover mouse on div id one, dialog box appears, div id 3 moves right. i want dialog box appear on div id 3 without moving right. html page <!doctype html> <html> <head> <style> div{ width:300px; height:300px; border:1px solid #000000; float:left; margin-left:10px; } #one,#three{ position:relative; } #two,#four{ margin:0; padding:0; left:334px; top:100px; background-color:#3b3b3b; border:none; width:200px; height:100px; display:none; position:relative; left:14px; } #triangleone,#triangletwo{ margin:0; padding:0; width: 0; height: 0; border-color:transparent; border-top: 8px solid transparent; border-right: 14px solid #3b3b3b; border-bottom: 8px solid transparent; top:35px; display:none; position:relative; } #dialogboxone,#dialogboxtwo{ margin:0; padding:0; width:214px; display:none; border:none; } </style> <script> var timer; function showdialogbox(idone,idtwo,idthree){ var firstsidebar=document.getelementbyid(idone); var secondsidebar=...

arraylist - Use Java HashMap multiple Type -

i'm using hashmap in-memory cache. basically, have: private static final map<string, object> lookup = new hashmap<string, object>(); public static object get(cachehelper key) { return lookup.get(key.getid()); } public static void store(cachehelper key, object value) { lookup.put(key.getid(), value); } that's fine. every object "get" map, have cast, ugly. want put arraylist , many other different things it. does know other solution typesafe ? (for sure, can create every type getter , setter, solution ? so, there better way create in-memory cache or have idea how wrap hashmap more safe ? one solution problem make cachehelper type generic, cachehelper<t> . create wrapper map: class mycache { private final map<cachehelper<?>, object> backingmap = new hashmap<>(); public <t> void put(cachehelper<t> key, t value) { backingmap.put(key, value); } @suppresswa...

gruntjs - How to copy a sub directory to a root directory using grunt-contrib-copy? -

my structure below. want copy assets folder app directory dist directory? app assets imgs css fonts index.html dist set current working directory app . select subdirs , files of assets . set destination dest . grunt.initconfig({ copy: { dist: { cwd: 'app', src: ['assets/**/*'], dest: 'dist/', expand: true } } }); grunt.loadnpmtasks('grunt-contrib-copy'); grunt.registertask('default', ['copy:dist']);

git - How to resolve Deleted merge conflict in TortoiseGit? -

Image
i novice in git , use tortoisegit git client i have conflict. click edit conflict , see following: can explain happen if click on 1. modified 2. delete 3. abort p.s. want merge local , remote branch a deleted merge conflict occurrs if @ same time file deleted on 1 branch , modified on branch. in case file deleted on active branch , deleted on branch you're trying merge. now have decide how go on: mark file deleted , ignore changes file - or mark file still-important in order kept and, thus, mark modified. so, if click on modified: modified file used (in working tree , index) delete: modified file discarded , file removed in working tree , index abort: dialog closed , conflict won't resolved.

ios - Why is viewDidLoad being called twice -

Image
i have gps app uses google maps handle location based events. app handles location events within app , not switch googles own google maps app. the storyboards can seen in image below. in app have main map view (my map view controller in storyboard) displays users current location list of marked locations around user on map. map contains button take user list of marked points (list of points table view controller). selecting of list points takes them detailed description of point (log point). , clicking "view on map" button on view takes them last view (submit point map view controller) can see point zoomed in on views map. both map views (my map view controller , submit point map view controller) use similar code listed below. however, when run run code , "submit point map view controller", views viewdidload method executed twice have noticed while stepping through code. causes 2 views load, 1 right after other. can see happening in emulator. on emulator f...

javascript - creating dynamic servers in Gulp using connect -

is possible check if server port taken before creating in gulp? i'm doing right now: /** * start livereload server */ gulp.task('connect', function() { var connect = require('connect'), app = connect() .use(require('connect-livereload')({ port: livereloadport })) .use(connect.static('app')) .use(connect.static('.tmp')) .use(connect.directory('app')); require('http').createserver(app) .listen(serverport) .on('listening', function () { console.log('started connect web server on http://localhost:' + serverport); }); }); gulp.task('serve', ['connect', 'styles'], function() { require('opn')('http://localhost:' + serverport); }); i'd able have server port dynamic , check if port in use. possible? thanks @ilanfrumer found solution using this . implemented this: ...

Wordpress posts order by custom field -

i have 2 types of posts - event , news. event category, have custom filed - event_date. news not have field. want order posts according event_date (i want include news though dont have event_date field ). have tried this: $args = array( 'cat' => $categories, 'posts_per_page' => $display_count, 'post_type' => 'post', 'number' => $display_count, 'page' => $page, 'offset' => $offset, 'meta_key' => 'event_date', 'orderby' => 'meta_value_num', 'order' => 'asc' ); $query = new wp_query($args); this query not return of news. because news dont have order field? if so, how can solve problem? thinking of ordering multiple like- 'orderby'=...

javascript - x-area labels on hover -

i need add color xaxis labels when it's hover ( like number 19 in picture ). saw property later lost it. need =) and can set property (z-index) xaxis tick? cause color must white, , can't see color, when z-index less z-index chart's area. for first question, use shared tooltip , point mouseover event change corresponding axis label: plotoptions: { series: { point: { events: { // on mouseover make xaxis label red mouseover: function(){ var xaxis = this.series.chart.xaxis[0]; $(xaxis.ticks[this.x].label.element).css('fill','red'); }, // on mouseout make gray again mouseout: function(){ var xaxis = this.series.chart.xaxis[0]; $(xaxis.ticks[this.x].label.element).css('fill','#606060'); ...

C++ pass by pointer, default declaration -

if in h file, there function: void printdictionary(dict *dic, wordtype type=all){ } and in corresponding cpp file, there function: void printdictionary(dict *dic, wordtype type){ } will there compilation error? or correct corresponding functions? there's error since both have function body; you've defined same function twice, breaking 1 definition rule. declare function in header void printdictionary(dict *dic, wordtype type=all); ^ not {} and define in source file did. the default arguments should go on declaration in header, since needed call function using them. can't go on definition, definition correct is.

ios - UIScrollView missing touches when transparent -

i have zoomable uiscrollview multiple subviews. uiwindow it's within has no backgroundcolor, neither uiscrollview. scroll view not recognize touches don't start on 1 of subviews (so zooming/panning doesn't work unless touch starts on subview). i'd scroll view remain transparent, recognize touches occur on it's transparent parts. jailbreak tweak. if set backgroundcolor either scroll view or uiwindow, scroll view gets touches again, want them both transparent. thanks!

javascript - Fastest way to flatten / un-flatten nested JSON objects -

i threw code flatten , un-flatten complex/nested json objects. works, it's bit slow (triggers 'long script' warning). for flattened names want "." delimiter , [index] arrays. examples: un-flattened | flattened --------------------------- {foo:{bar:false}} => {"foo.bar":false} {a:[{b:["c","d"]}]} => {"a[0].b[0]":"c","a[0].b[1]":"d"} [1,[2,[3,4],5],6] => {"[0]":1,"[1].[0]":2,"[1].[1].[0]":3,"[1].[1].[1]":4,"[1].[2]":5,"[2]":6} i created benchmark ~simulates use case http://jsfiddle.net/wszec/ get nested json object flatten it look through , possibly modify while flattened unflatten it's original nested format shipped away i faster code: clarification, code completes jsfiddle benchmark ( http://jsfiddle.net/wszec/ ) faster (~20%+ nice) in ie 9+, ff 24+, , chrome 29+. here's relevant javascript code: ...

ruby on rails - Rails4 - How to create and the best practices way to create list box for countries? -

i have user model name , email. want add country listbox during user signup. right can list users. want add country column model because want create view later users can search other users based on country. i not using devise gem. i know steps don't know correct way. should store countries in database ? first add column rails generate migration add_country_to_users country:<what_type_?> then migrate bundle exec rake db:migrate then add validations in model app/models/user.rb validates :country, inclusion: %w(full_list?) add list box in registration form app/views/users/new.html.erb <%= f.label :country %> <%= f.f.select :country %> add list box in update form app/views/users/edit.html.erb <%= f.label :country %> <%= f.f.select :country %> add in strong params app/controllers/users_controller.rb def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation, :country) end kindly help. th...

javascript - How do I properly initialize/mock and unit test input data in a directive's externally-defined controller? -

i have custom directive uses external controller , template. user passes in initial data directive, used inside controller. when i'm unit testing mycontroller, this.inputdata undefined. how initialize or mock this.inputdata in unit test can test mycustomfilter called defined value in first parameter? customdirective: 'use strict'; angular.module('mymodule') .directive('mydirectve', function () { return { restrict: 'ea', scope: { inputdata: '=' }, templateurl: 'templates/my-directive-template.html', bindtocontroller: true, controlleras: 'main', controller: 'mymainctrl', link: function () { } }; }); directivecontroller: 'use strict'; angular.module('mymodule') .controller('mymainctrl', function (mycustomfilter) { this.filtereddata ...

jquery - Retrieving POST data from Ajax in ASP Classic -

i'm trying post values ajax/jquery , print out in asp classic. when check network tab in developer tools shows delete_id , tbl posted values dont display in code. <script> $(document).ready(function(){ $('input#del-policy').click(function(){ var element = $(this); var del_id = element.attr("name"); var info = "delete_id=" + del_id + "&tbl=policies"; if(confirm("are sure want delete entry?")) { $.ajax({ type: "post", url: "admin.asp", data: info, success: function(){ } }); $(this).parent().parent().fadeout("slow", function() { $(this).remove(); }); } return false; }); }); </script> <% dim i = request.form("tbl") response.write(i) %> try this: $(document).ready(function(){ $('input#del-policy').click(function(){ var element = $(this); var de...

Websockets and uwsgi - detect broken connections client side? -

i'm using uwsgi's websockets support , far it's looking great, server detects when client disconnects , client when server goes down. i'm concerned not work in every case/browser. in other frameworks, namely sockjs, connection monitored sending regular messages work heartbeats/pings. uwsgi sends ping/pong frames (ie. not regular messages/control frames) according websockets spec , client side have no way know when last ping received server. question this: if connection dropped or blocked proxy browsers reliably (ie. chrome, ie, firefox, opera) detect no ping received server , signal connection down or should implement additional ping/pong system connection detected closed client side? thanks you totally right. there no way client side track or send ping/pongs. if connection drops, server able of detecting condition through ping/pong, client let hung... until tries send , underlying tcp mechanism detect other side not acknowledging packets. therefore...

objective c - Increasing integerValue of UITextField -

the completion code of code animates squareone . when clicked becomes hidden. if index of image squareone uses, same icon , if squareone hidden, animation repeats. (this condition want score increase on). if squareone isn't clicked @ still repeat. completion:^(bool complete) { if (complete) { [self squareonecolour]; [self squareonemover]; if (self.squareone.hidden==yes) { if (a==b) { [self squareonecolour]; [self squareonemover]; //i want score increase here } else if (a!=b) { [self squareonecolour]; [self squareonemover]; nslog(@"square 1 isn't supposed pressed"); }}}}];} //just make more compact when try doing create dozens of nsstring , nsuinteger variable , think way inefficient, , doesn't work... can me integervalue of textfield score increase every time squareone pressed , matches image on icon ?...

c# - Gridview with multiple dropdown list with add row & delete button in asp.net -

iam new asp.net can me on this. want make dynamic grid in asp.net have 5 drop down list binding database , on selection of first dropdownvalue second dropdown bind.and has add row & delete row button. <asp:updatepanel runat="server"><contenttemplate> <asp:gridview id="grvparameterdetail" runat="server" showfooter="true" autogeneratecolumns="false" cellpadding="4" forecolor="#333333" gridlines="none" onrowdeleting="grvparameterdetails_rowdeleting" > <columns> <asp:boundfield datafield="rownumber" headertext="sno" /> <asp:templatefield headertext="company"> <itemtemplate> <asp:dropdownlist datasource='<%# bindcompany1() %>' datatextfield="comp_name" datavaluefield="comp_code" id="drpcompany" runat=...