Posts

Showing posts from February, 2010

Player not showing and converting to "Download File" "mediaelement.js" -

i have uploaded recent audio our churches website. when visiting page audio player show brief second switch "download file". if click download file player show again brief second. all of previous uploads still function correctly. i running wordpress 3.8.1

Display transparent image on axes (MATLAB) -

so have transparent image ( http://imgur.com/fyqslax ) want display on axes in matlab transperancy. this, used code below, works other transparent png images have: [a, map, alpha] = imread('fyqslax.png'); h = imshow(a, map) set(h, 'alphadata', alpha); this code however, not seem work image above. im guessing because has image being grayscale , having bitdepth of 1, resulting in map , alpha having nothing in (whereas other png transparent images have, have in map , alpha). if use this: a = imread('fyqslax.png'); h = imshow(a) a black background appears image should transparent. how display http://imgur.com/fyqslax transperancy on axes? edit: horchler's method worked; thanks!! if run imfinfo('fyqslax.png') , you'll see 'transparency' specified 'simple' , 'simpletransparencydata' set 0 ( false ). can't find documentation on this, think may indicate alpha channel has been compressed image data

recursion - Clojure: Write a Clojure function that returns a list of all 2^n bits strings of length n -

i want write clojure function called (nbits n) returns list of 2^n bits strings of length n. my expected output is: user=> (nbits -2) () user=> (nbits 0) () user=> (nbits 1) ((0) (1)) user=> (nbits 2) ((0 0) (0 1) (1 0) (1 1)) user=> (nbits 3) ((0 0 0) (0 0 1) (0 1 0) (0 1 1) (1 0 0) (1 0 1) (1 1 0) (1 1 1)) here try: (defn add0 [seq] (cond (empty? seq) 'nil (and (seq? seq) (> (count seq) 0)) (cons (cons '0 (first seq)) (add0 (rest seq))))) (defn add1 [seq] (cond (empty? seq) 'nil (and (seq? seq) (> (count seq) 0)) (cons (cons '1 (first seq)) (add1 (rest seq))))) (defn nbits [n] (cond (number? n) (cond (< n 1) '() (= n 1) '((0) (1)) (> n 1) (list (add0 (nbits (- n 1))) (add1 (nbits (- n 1))))) :else 'nil)) but output not right. did go wrong? don't know how fix it. you (lazily , iterati

java - Android Music Player save playlist -

hey had created android music player application , going great until noticed every time created playlist , closed application playlist not save because never was. i using hashmap can store song name , index belongs to. have looked around on how store full hasmap or array list couldnt find anything. know shared pref , saving data there possible if can create new file store playlist? if have ideas or might have example code great. thank you look sharedpreferences.editor.putstringset method. can store sets, storing music playlist

asp.net mvc - Login password encryption with active directory -

Image
my mvc5 application usage active directory , unable use default .net provided password encryption ad doesn't support it. my controller is: [httppost] [validateantiforgerytoken] public actionresult login(account user) { if (modelstate.isvalid) { if (membership.validateuser(user.username, user.password)) { var principal = user.getuserprincipal(user.username, user.password, user.domainname); if (principal != null) { formsauthentication.setauthcookie(user.username, user.rememberme); var returnurl = getredirectfromloginurl(); if (url.islocalurl(returnurl)) return redirect(returnurl); else return redirecttoaction("index", "home"); } else modelstate.addmodelerror("", "user principal not created."); } else {

jquery - Why is the form not getting submitted? -

<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.2/jquery.mobile1.4.2.min.css"> <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script src="//code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script> <script> $( "#submit" ).click(function() { $( "#my_form" ).submit(); }); </script> <body> <form id="my_form" action="my_place.jsp" method="post" style="align:center"> <div data-role="page" id="page1"> <div data-role="header"> <h1>parameters:</h1> </div> <div data-role="rangeslider"> <label for="range-1a">support:</label> <input name="range-1a" id="range-1a" min="1" max="21" valu

networking - Why does the number of links not matter in the transmission time of circuit switching? -

i reading book networking, , says that, in circuit switching environment, number of links , switches signal has go through before getting destination not affect overall time takes signal received. on other hand, in packet switching scenario number of links , switches make difference. spent quite bit of time trying figure out, can't seem it. why that? to drastically over-simplify, circuit-switched environment has direct line transmitter transmitted once connection has been established; imagine old-fashioned phone-call going through switchboards. therefore transmission time same regardless of hops (well, ignoring physical time takes signal move on wire, small since it's moving @ speed of light). in packet-switched environment, there no direct connection. packet of data sent transmitter first hop, tries calculate open route destination. passes data onto next hop, again has calculate next available hop, , on. takes time linearly increases number of hops. think sendin

MySQL/SQL Server vs. PHP encryption -

according documentation, most-secured encryption methods are: aes_encrypt() mysql encryptbypassphrase() sql server mc_encrypt() php which 1 should used? recently on many blogs , e-magazines being posted information, pre-encryption php best way, since if my/sql server compromised, attacker can scan logs. example of mcrypt pre-encrypting string before database insertion (vs others): <?php define('encryption_key', '555d6c18e7b8aa109bfda854df942088a9984cccf2a979bd21b99e50aedc1976'); function cryp($action, $string, $key) { $key = pack('h*', $key); if($action == 'en') { $string = serialize($string); $iv = mcrypt_create_iv(mcrypt_get_iv_size(mcrypt_rijndael_256, mcrypt_mode_cbc), mcrypt_dev_urandom); $string = base64_encode(mcrypt_encrypt(mcrypt_rijndael_256, $key, $string . hash_hmac('sha256', $string, substr(bin2hex($key), -32)), mcrypt_mode_cbc, $iv)) . '|' . base64_encode($iv); }

java, determine if circle is inside an area -

hi im new programming , im trying code algorithm in java determine if circle in rectangular area i have radius of circle , point in middle of it(the center) |_____________________________________________________ | | | | circle | | | | |(0,0)________________________________________________ the bottom left corner represent coordinate (0,0) this have far know have error somewhere can't find if (mcenter.getmx() + mradius > width || mcenter.getmy() + mradius > height || mcenter.getmx() - mradius < 0 || mcenter.getmy() - mradius < 0) { return false; //not inside area } else { return true; } in code mcenter point x , y coordinate, mradius circle radius , width , height width/height of area thanks you didn't symptom is, helpful diagram above uses ordinary mathematical coordinate system while posted code uses awt.image.bufferedimage . swing , 2d computer graphics systems use different c

html - How can I use a CSS gradient on both top-left and top-right corners of my page? -

Image
i'm trying figure out how can use this: http://www.colorzilla.com/gradient-editor/ and use 1 in top-left corner of page, top-right. any appreciated. you can either like this (i stripped code out, best viewed in chrome), using 2 wrappers , applying gradient each (provided each ends transparent allow other show through). the gradient code used generate is: #wrapper { width:100%; height:500px; background: -webkit-radial-gradient(top left, ellipse cover, rgba(255,0,0,1) 0%,rgba(255,0,0,0) 50%); border:solid 1px red; } #inner { width:100%; height:500px; background: -webkit-radial-gradient(top right, ellipse cover, rgba(0,0,255,1) 0%,rgba(0,0,255,0) 50%); border:solid 1px blue; } here's demo result: alternately, combine both gradients 1 using colorzilla editor , using multiple color stops.

java ee - Selecting an entity by collection set equality -

i'm trying jpql query or jpa operation following. have element, consist of element collection of strings: @entity(name="request") public class request { @elementcollection private set<string> keywords; ... } i want able select entity whos keywords matches given set of strings. i've looked using in match if 1 keyword exists. how match if keywords exist? the simplest approach can think of 2 count queries: a count of number of keywords in set a count of number of keywords not in set the result of #1 should equal number of keywords in set. result of #2 should equal 0. example: list<request> requests = em.createquery("select r request r " + "where (select count(k1) request r1 " + " join r1.keywords k1 " + " r1 = r , k1 in :keywords) = :numkeywords " + "and (select count(k2) request r2 " +

apache - Bad flag delimiters .htaccess -

im testing out url rewritting im having issues htacces. have rewriteengine on rewritecond %{request_filename} != d rewritecond %{request_filename} != f rewritecond %{request_filename} != l rewriterule ^(.+)$ index.php?url=$1 [qsa,l] and vhost looks like <virtualhost *:80> serveradmin webmaster@sitename.com servername www.mvc.com serveralias my.mvc documentroot /home/user/documents/mymvc <directory /home/user/documents/mymvc> require granted allowoverride </directory> errorlog /home/user/sitelogs/mvc/error.log </virtualhost> with settings im getting /home/user/documents/mymvc/.htaccess: rewritecond: bad flag delimiters im not sure missing. in advance. != not valid option in rewriteconds: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond rewritecond %{request_filename} !-d ^--- "dash", not "eq

Text Categorization in R -

my objective automatically route feedback email respective division. fields fnumber , category , subcategory , description . have last 6 months data in above format - entire email stored in description along category , subcategory . i have analyse description column , find keywords each category/subcategory , when next feedback email enters , should automatically categorize categories , sub categories based on keyword generated history data. i have imported xml file r - text categorization in r , converted xml data frame required fields. have 23017 records particular month - have listed first twenty columns dataframe below. i have more 100 categories , sub categries. new text mining concept - of , tm package - have tried below code: step1 <- structure(list(fnumber = structure(1:20, .label = c(" 20131202-0885 ", "20131202-0886 ", "20131202-0985 ", "20131202-1145 ", "20131202-1227 ", "20131202-1228 ",

android : Error on Shading Language with opengl es2.0 on android 2.2 -

i have problem application. simple application atm using opengl es2.0 running on android 2.2 device htc sense. can running application on 4.0.3 emulator device running android 4.0. when running on android 2.2, have error: > fatal exception: glthread 9 java.lang.runtimeexception: error compiling shader: simpleshader.loadshader(simpleshader.java:87) simpleshader.<init>(simpleshader.java:54) etc i assumed device can run android 2.2 document told links documentation , not sure shader part though. here shader code: string verticesshader = "uniform mat4 uscreen;\n" + "attribute vec2 aposition;\n" + "attribute vec3 acolor;\n" + "attribute vec2 atexpos; \n" + "varying vec2 vtexpos; \n" + "varying vec3 vcolor;\n" + "void main() {\n" + " vtexpos = atexpos; \n" + " gl_position = uscreen * vec4(aposition.xy, 0.0,

windows phone - Select on Map control -

i doing windows phone app displays map , scaled ellipse, , working except cannot select location on map can in standard maptask app. missing something? user select point on map , start navigation point or there way launch maptask app , draw ellipse on that? if windows phone 8 maps using have plenty of examples @ github it: https://github.com/nokia-developer/maps-samples same examples windows phone 7 @ at: http://developer.nokia.com/community/wiki/maps_examples_for_windows_phone basically there no automated way on getting location, thus, if want have geocoordinate location uses selected, you: 1. need catch user click on map (check interaction examples) 2. geocoordinate clicked pixel of map (there pixel geo function implemented maps control) for navigation, if means showing route map, check routing examples. if meant navigation, windows phone 7 not have answers, windows phone 8 there here launchers documented at: http://developer.nokia.com/resources/library/lumia/m

Is it possible to render a List<Element> in Polymer.dart? -

given list<element> elements , possible render elements in template, this? <template repeat="{{element in elements}}"> {{element.something}} </template> i'd want observe list too, add , remove elements list changes. update a ready-to-use element dart polymer 1.0 bwu-bind-html {{}} can't include html. you can use <safe-html> tag (see answer html tags within internationalized strings in polymer.dart ) <template repeat="{{element in elements}}"> <safe-html model="{{element.something}}"></safe-html> </template> but guess have change <self-html> implementation replaces content of model instead of adding model it's content, because ul / ol can't contain <self-html>

ios - UITableViewCell not Display Subtitle when i am set the initwithstyle:UItableviewsubtitle -

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsstring *cellidenti = @"cell"; uitableviewcell *cell = [tableview dequeuereusableheaderfooterviewwithidentifier:cellidenti]; if(cell == nil) { cell= [[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidenti]; } cell.textlabel.text = isactive?searchdata[indexpath.row]:tabledata[indexpath.row]; cell.detailtextlabel.text = isactive?searchnumberdata[indexpath.row]:tablenumberdata[indexpath.row]; return cell; } i not getting perfect view , not using storyboard. two things have observed in code 1) use correct way of cell reusability using dequeuereusablecellwithidentifier (as others suggested). have @ way of reusability of cell here using dequeuereusablecellwithidentifier:forindexpath: . 2) try use nil instead of nil . have @ this thread . - (uitableviewcell *)tableview:(uit

html - jquery animate a scroll but not on exact position where the id is since my nav is fixed at the top -

basically 1 page site fixed header nav on top has height , cover top portion when scrolled down or clicked nav. here jquery script got here well $(document).ready(function() { $('ul.navigation').on('click', 'a', function(e) { e.preventdefault(); $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top }, 2000); }); }); all except when click on nav scrolls on specific id ofcourse element has id, example h1, being covered header since header positioned @ top of page. how can adjust , @ least add 185px, size of fixed header, on scroll animation ids positioned. many thanks! just update script add space... $('html, body').animate({ scrolltop: ($( $.attr(this, 'href') ).offset().top - 185) }, 2000); here's example fiddle related question

WCF Service CallBacks -

on wcf callbacks, 1 doubt still nagging in mind, callback happens when client makes call server. don't have mechanism client registers service, , after while happens @ server , service notifies connected clients. in com generating com exe server , keeping list of connected clients , trigger event whenever com exe server deems necessary , end callback @ client end. are looking messaging implementation msmq? using msmq, can setup client subscriber server's "messages". server in turn publisher , produce effect seem desire. http://msdn.microsoft.com/en-us/library/ms711472(v=vs.85).aspx

java - How to convert date in to String MM/dd/yyyy Format? -

i have date 2014-10-01 00:00:00.0 have convert 10/01.2014 how can i? how one try { string currentdate = "2014-10-01 00:00:00.0"; simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd hh:mm:ss.s"); date tempdate=simpledateformat.parse(currentdate); simpledateformat outputdateformat = new simpledateformat("dd/mm.yyyy"); system.out.println("output date = "+outputdateformat.format(tempdate)); } catch (parseexception ex) { system.out.println("parse exception"); }

c# - Use linq distinct function? -

this question has answer here: linq's distinct() on particular property 17 answers how can use linq distinct operator here remove remove duplicate courses.cours.name, var courseslist = courses in not_subsribe select new selectlistitem { text = courses.cours.name, value = courses.cours.id .tostring() }; you use groupby on anonymous type both properties make them distinct: var courseslist = c in not_subsribe group c new { id = c.cours.id, name = c.cours.name } g order g.key.name select new selectlistitem { text = g.key.name, value = g.key.id }; that works because anonymous type automatically overrides equals + gethashcode needed groupby or distinct . use distinct : var courseslist = not_subsribe .select(c => new { id = c.cours.id, name = c.cours.name }) .distinct() .orde

javascript - TypeError: Cannot read property 'objects' of undefined -

i error typeerror: cannot read property 'objects' of undefined want iterate throw array, find current id. guess can't use $scope inside services ? how can correctly define $scope ? objects getting factory ussing http method. app.service('sharedservice', function (inventory, user, tags) { var allinventories = inventory.query(); var alltags = tags.query(); var allusers = user.query(); return { getinventory: function() { return allinventories; }, setinventory: function(inventoryvalue){ allinventories = inventoryvalue; }, gettags: function() { return alltags; }, settags: function(tagsvalue){ alltags = tagsvalue; }, getuser: function(){ return allusers; }, setuser: function(uservalue){ allusers = uservalue; }, findbyid: function findbyid($scope, id) { for(var = 0; < $scope.info.objects.length; i++){ if($scope.

java - Apache POI Enable excel editing -

i'm using apache poi edit excels in java. after editing poi not able save file because excel protected. if open, show option enable editing. on copying same file new excel work fine. there way enable editing java excel? here sample of code: import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.iterator; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.xssf.usermodel.xssfcell; import org.apache.poi.xssf.usermodel.xssfrow; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class test3 { public static void main(string args[]) { try { fileinputstream file = new fileinputstream(new file( "new microsoft excel worksheet.xlsx")); // document document = jsoup.connect("http://www.google.com&quo

javascript - How to use ajax return value from within a function call? -

i have function shown below , not able return data value place calling function. function checkifrs(){ $.ajax({ url: 'someurl.php', success: function(data) { return data; } }); } any suggestions helpful... well , 1 way use callback function inside ajax success function checkifrs(callback) { $.ajax({ url: 'someurl.php', success: function(data) { callback(data); } }); } and call way, checkifrs(function(data){ //do data });

jsp - Besides Adding jar for JDBC,"java.lang.classnotfoundexception:com.mysql.jdbc.Driver " -

i have added jar file jdbc in build path project, still giving me exception javax.servlet.servletexception: java.lang.classnotfoundexception : com.mysql.jdbc.driver" i've added jar file in project --> proeperties -->java bild path -->libraries -->add external library. <html> <head><title>member details</title></head> <body> <h2>members details...!</h2> <table> <%@ page import="java.util.*" %> <%@ page import="java.sql.sqlexception" %> <%@ page import="javax.sql.*;" %> <% java.sql.connection con; java.sql.statement s; java.sql.resultset rs; java.sql.preparedstatement pst; con=null; s=null; pst=null; rs=null; // remember change next line own environment string url= "jdbc:mysql://localhost:3306/employees"; string id= "root"; string pass = "admin"; try{ class.forname("com.mysql.jdbc.driver"); con =

asp.net - asp button on click is fired on local machine but it does not fire on published server -

i cannot understand why have button inside panel (attached ajax modal popup extender), button onclick gets fired on local machinw not work on uploaded server online. know might causing behaviour? <asp:button id="btnupsertcommodity" runat="server" width="70" text="submit" onclick="btnupsertcommodity_click" validationgroup="commodity"/> try setting causesvalidation property see details button causevalidation

javascript - AutoComplete Controller Action not being called -

i have editbox linked auto-complete handler, when type character controller method not calling , not working also. jquery $("#nameinput").autocomplete({ minchars: 3, delay: 100, cachelength: 25, autofill: true, source: function (request, response) { $.ajax({ url: "/data/getnames", datatype: "json", data: { id: request.term }, success: function (data) { response($.map(data, function (item) { return { label: item.label, value: item.id }; //updated code })); } }); }, select: function (event, ui) { return false; } }); here controller method. c# [requiresrole(roles = "su, da, rv, sp, dg, ap, ua")] [acceptverbs(httpverbs.get)] public string getnames(string term ) { //perform db operations return string.empty; } aspx <input type="text" name="nameinput"

asp.net - Error when upgrading to WebAPI 2.1 XmlDocumentationProvider does not implement interface member GetDocumentation -

i'm following tutorial here: http://www.asp.net/web-api/overview/releases/whats-new-in-aspnet-web-api-21#download i created mvc web api project in visual studio 2012 (.net framework 4.5), , ran command in nuget package manager console install-package microsoft.aspnet.webapi when tried build project, error: 'commonservices.areas.helppage.xmldocumentationprovider' not implement interface member 'system.web.http.description.idocumentationprovider.getdocumentation(system.web.http.controllers.httpcontrollerdescriptor)' c:\users\administrator\documents\visual studio 2012\projects\commonservices\commonservices\areas\helppage\xmldocumentationprovider.cs 'commonservices.areas.helppage.xmldocumentationprovider' not implement interface member 'system.web.http.description.idocumentationprovider.getresponsedocumentation(system.web.http.controllers.httpactiondescriptor)' c:\users\administrator\documents\visual studio 2012\projects\commonserv

vb.net - How does the ProgressBar.PerformStep() function work? -

i'm quite confused progress bar in vb.net, here code private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load progressbar_my.minimum = 0 progressbar_my.maximum = 10 progressbar_my.step = 1 end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click progressbar_my.performstep() threading.thread.sleep(5000) if 1 = 1 progressbar_my.performstep() progressbar_my.performstep() end if 'threading.thread.sleep(2000) end sub for above code, expected after click button1 , progress bar increase progress status 1, pause 5 sec , increase progress status 2 @ once. however, after ran above code, saw after click button1 , progress bar increase 3 continually after 5 sec . can tell me why behaves , how should program code can increase 1, pause 5 sec , increase 2? thanks in advance! i think seeing (or not seeing) fact progress bar take

vhdl - reading the value of input when clk ='1' in the mid way of clk -

i know rising_edge(clk) , when clk'event , clk ='1'. guess detect edge. lets want read input when clk high , in mid way. guess able write want convey how can that? if not correct please explain. thanks in testbench, or synthesisable real hardware? assuming clock has period clk_period, declared like constant clk_period : time := 100 ns; -- 10 mhz clk <= not clk after clk_period/2; you can write testbench code like wait until rising_edge(clk); wait clk_period/4; value <= my_input; however not synthesisable. in real hardware need different approach. fpgas have clock generation modules (plls, dlls, dcms) allow generate phase shifted or inverted clocks, , can use such block accomplish task. more specific suggestions depend on actual fpga using, , whether have faster clocks available. for example, given clk , clk_2x phase aligned (so each clk edge clk_2x rising edge) can use falling edge of clk_2x while clk high. process(clk_2x) begin -- c

visual studio - Is there a way to get local workspaces to work on network shares with VS2013? -

my config here macbook parallels 9 installed. vm running windows 8 , runs visual studio 2013. in visual studio working on ios, wp8 , android projects (xamarin). solution under source control (tfs) , i'm using local workspaces. currently files hosted inside vm. instead have files on mac's file system can access them if vm not running. however seems map solution mac (which network drive), local workspace seems stop working , not track changes anymore. is general limitation local workspaces don't work on network shares or there maybe (hidden) config tweaked? i did this, worked me these steps 1) create local folder on drive , map on network 2) copy folder on drive 3) open new pasted folder , run vs2013 4) pop tfs controll 5) click no , window pops press ok 6) if ever want go tfs right click on solution file , click on add source control i used windows 7 professional edition , worked.

facebook - This API is not allowed for users who have logged in to the app anonymously -

when trying connect facebook app, received error today, there change in facebook api?, scenario has worked since today. error text: (#200) api not allowed users have logged in app anonymously. facebook respond : this fixed now. ill keep assigned confirm being resolved. sorry inconvenience caused guys. thanks!

android - The application may be doing too much work on its main thread (Phonegap) -

when try run application on emulator, returns white screen (it's splash screen think) on eclipse returns notification application may doing work on main thread. mainactivity.java: package com.example.mythesis; import org.apache.cordova.droidgap; import android.os.bundle; public class mainactivity extends droidgap { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); super.loadurl("file:///android_asset/www/index.html"); //setcontentview(r.layout.activity_main); } } and androidmanifest.xml: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mythesis" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="14" android:targetsdkversion="14" /> <application

c# - Download Files Async -

my code this: webclient sz_getconf = new webclient(); #region get_filesinreleasemanifest if (file.exists("release_manifest")) { string[] files = file.readalllines("release_manifest"); foreach (string filename in files) if (file.exists("wowfolder/" + filename)) { file.delete(filename); string itemtodownload = urlpath; itemtodownload += filename; sz_getconf.downloadprogresschanged += new downloadprogresschangedeventhandler(sz_getconf_downloadprogresschanged); sz_getconf.downloadfilecompleted += new system.componentmodel.asynccompletedeventhandler(sz_getconf_downloadfilecompleted); sz_getconf.downloadfileasync(new uri("http://someurl.com/dl/"+filename), filename); } #endregion when try compile receive error: "no

date - Get the last x day from a string in android (e.g. 20140310 , last 2 day , return 20140308) -

how can serve string date , reduce 2 day, after return result string ? just similar title example? thanks this related code seems deduct current date , not output string e.g. 20140308, thanks calendar calendar = calendar.getinstance(); calendar.add(calendar.date, -2); you can use simpledateformat parse string date based on pattern of choice - in case yyyymmdd . then can perform operations on date want re-format string based on pattern. simpledateformat sdf = new simpledateformat("yyyymmdd"); //set simpledateformat per pattern string datestr = "20140310"; // date string calendar cal = calendar.getinstance(); cal.settime(sdf.parse(datestr)); // set date calendar instance cal.add(calendar.date, -2); // perform operation system.out.println(sdf.format(cal.gettime())); //20140308

documents' url & Virtual host - liferay 6.2 -

we have problem links download documents after adding virtual host liferay 6.2 ce ga1. we have created organization , site attached. site, we have added virtual host ("intranet") private pages. we have created private page "documents" "document & media" portlet. for access page, can use default url : localhost:8080/group/my_orga/documents/ url virtual host : intranet:8080/documents/ these 2 urls work well. with default url, download link (localhost:8080/documents/x/y/test.doc/...) works. but if access virtual host, download link (intranet:8080/documents/x/y/test.doc/...) doesn't work , 404 result. how can fix problem ? thanks in advance check reply in below liferay forum. https://www.liferay.com/community/forums/-/message_boards/message/35465626

asp.net - Moving from Castle Windsor to an IoC that runs under Medium Trust -

i've inherited project running on host had set full trust, required castle windsor ioc. new host, however, run in medium trust (as shared hosting providers), need replace windsor ioc. being new ioc, i'm not sure framework(s) best use under medium trust , service locator model. an example of existing registration code follows: iwindsorcontainer container = new windsorcontainer(); controllerbuilder.current.setcontrollerfactory(new windsorcontrollerfactory(container)); container.registercontrollers(typeof(homecontroller).assembly); container.register( component.for(typeof(ientityduplicatechecker)) .implementedby(typeof(entityduplicatechecker)) .named("entityduplicatechecker")); container.register( alltypes .fromassemblynamed("salient.website.data") .pick() .withservice.firstnongenericcoreinterface("salient.website.core")); container.register( alltypes .fromthisassembly() .pi

sql - Return each max count of subgroup using oracle-11g -

i have table create table table1 ( from_id varchar2(10), to_id varchar2(10), b_id varchar2(20) not null, exp_in_date varchar2(20) not null ); sample data: insert table1 (from_id,to_id,b_id,exp_in_date) values ('5','2','20140203056',to_date('20140203', 'yyyymmdd')); insert table1 (from_id,to_id,b_id,exp_in_date) values ('5','2','20140203056',to_date('20140203', 'yyyymmdd')); insert table1 (from_id,to_id,b_id,exp_in_date) values ('5','1','20140203056',to_date('20140203', 'yyyymmdd')); insert table1 (from_id,to_id,b_id,exp_in_date) values ('5','2','20140203057',to_date('20140203', 'yyyymmdd')); insert table1 (from_id,to_id,b_id,exp_in_date) values ('2','5','20140203057',to_date('20140203', 'yyyymmdd')); insert table1 (from_id,to_id,b_id,exp_in_date) values ('5',&

java - Too frequent load of Quartz Scheduler in a Spring application -

Image
i writing spring application , use quart scheduler. i'm running jetty server , ok, app works: i sending http request 1 of services , then, refreshing: and quartz gives log 3 times: here piece of config.xml file: <bean id="simpletrigger" class="org.springframework.scheduling.quartz.simpletriggerbean"> <property name="jobdetail" ref="fileimport" /> <property name="repeatinterval" value="${prop.checkinterval}" /> </bean> <bean class="org.springframework.scheduling.quartz.schedulerfactorybean"> <property name="jobdetails"> <list> <ref bean="fileimport" /> </list> </property> <property name="triggers"> <list> <ref bean="simpletrigger" /> </list> </property> </bean> how can load

oracle - to assign [vehicle_type = all types] when no filter is selected -

i have extract table based on user input, have table named "vehicle_register" vehicle details , users allowed filter data using vehicle type(car, bus, truck...). if no filer selected data should displayed. now have use 2 queries, 1 filter , 2 all, 1. select * vehicle_register vehicle_type = 'car'; 2. select * vehicle_register; can these 2 queries merged, want know how use conditional clause using "case" or "if" statement assign [vehicle_type = types] when no filter selected. try this: select * vehicle_register (vehicle_type = mycar or mycar null); where mycar variable filter (can empty if not set up).

javascript - jquery change event works on form element - undocumented feature? -

if want handle .change event on form elements, sources recommend this: $('#form_id :input').change(...) but realized following works too: $('#form_id').change(...) but really? tried find feature on jquery api - change if correctly, seems undocumented? the change event sent element when value changes. event limited <input> elements, <textarea> boxes , <select> elements.

c# - explorer.exe memory usage is high when deleting files -

i have application running on server. i start off thread goes infinite loop. the 1st thing loop enumerate directories in folder. this folder has many sub-folder receives small image files many clients. my loop looks directories/files older 24hrs today's immediate time /date. if older code deletes files , parent folder. my loop 'sleep' 60 seconds before repeating again. now, have noticed if there large number of files delete or/and app has been running several days explorer.exe memory increases significantly. so, have question code. this code: thread tharchiver = null; private void btnarchiver_click(object sender, eventargs e) { try { if (btnarchiver.text == "start") { btnarchiver.text = "stop"; lvwservices.items[4].subitems[1].text = "started"; tharchiver = new thread(archiveworker); tharchiver.start(); } else { bt

c# - CSV Text file parser with TextFieldParser - MalformedLineException -

Image
i working on csv parser using c# textfieldparser class. my csv data deliminated , , string enclosed " character. however, data row cell can have " appears making parser throw exception. this c# code far: using system; using system.collections.generic; using system.linq; using system.text; using system.io; using microsoft.visualbasic.fileio; namespace csv_parser { class program { static void main(string[] args) { // init string csv_file = "test.csv"; // proceed if file found if (file.exists(csv_file)) { // test parse_csv(csv_file); } // finished console.writeline("press exit ..."); console.readkey(); } static void parse_csv(string filename) { using (textfieldparser parser = new textfieldparser(filename)) { parse

database - How to increase MySQL connections(max_connections)? -

every socket of mysql database have defaults connections 100 looking way increase number of possible connections > 100 socket connection of mysql database. if need increase mysql connections without mysql restart below mysql> show variables 'max_connections'; +-----------------+-------+ | variable_name | value | +-----------------+-------+ | max_connections | 100 | +-----------------+-------+ 1 row in set (0.00 sec) mysql> set global max_connections = 150; query ok, 0 rows affected (0.00 sec) mysql> show variables 'max_connections'; +-----------------+-------+ | variable_name | value | +-----------------+-------+ | max_connections | 150 | +-----------------+-------+ 1 row in set (0.00 sec) these settings change @ mysql restart. for permanent changes add below line in my.cnf , restart mysql max_connections = 150

oracle - Rollback the changes made by a procedure -

i have procedure myprocedure create or replace procedure myprocedure begin --some checking goes here insert table1 values.. --some checking goes here delete table2; end myprocedure; i have called procedure , executed without errors. can rollback changes made procedure? i guess you're looking savepoint. savepoints save transactions states , rollback specified point in time. create or replace procedure myprocedure begin --some checking goes here insert table1 values.. savepoint my_savepoint; --some checking goes here delete table2; exception when dup_val_on_index rollback do_insert; dbms_output.put_line('insert has been rolled back'); end myprocedure; check oracle documentation: example 6-38, "using savepoint rollback" example 6-39, "reusing savepoint rollback"

ajax - DotNet HighChart not working in Update Panel (ASP.NET) -

i have asp.net web application have added multiple dot net highchart in same page.(like dashboard) charts wrapped in update panel. have tried google links possible find ways update each chart interdependently. i using timer refresh them. update panels set conditional update. dose not work @ all. what can do? <div style="" id="asdflick" class="leftsideboxchart" > <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:literal id="ltrweektoatallinechart" runat="server"></asp:literal> </contenttemplate> </asp:updatepanel> <asp:timer id="timer1" runat="server" interval="70000" ontick="timer1_tick"></asp:timer> </div>

mfc - CPack doesn't include mfc100.dll -

i thought directive includes necessary runtime libraries in nsis installer generated cpack: include(installrequiredsystemlibraries) but doesn't. when install application installer on pc, complains mfc100.dll missing - isn't included in installer. trying set mfc linking static leads myriad of errors when compiling, isn't option. can manually figure out path can mfc100.dll , copy install directory in cmake script, included in nsis installer? there other options include it? the trick tell cpack include them: set(cmake_install_mfc_libraries on) include(installrequiredsystemlibraries)

php - Laravel querying many to many records with eager loading conditions -

Image
so app has structure so. payments hasandbelongstomany payers payers belongsto users ( users hasmany payers ) i want query payments (and pivot data) user id. have been using query returns payments, regardless of user_id: $payment_data = payment::with('payers')->get(); now, if want payments payers have user_id of, say, 5 tried this: $payment_data = payment::with(array( 'payers' => function($q){ $q->where('user_id', '=', 5); }))->get(); but returns same result except condition applies payers , not payments i.e. still payments in payments table, not pivot data if user_id condition not fulfilled. can technically use result , filter out ones payers sub-array empty become inefficient large numbers of payments. what's correct way form query? edit here basic representation of db structure: and plain sql query (rdms varies idea): select payments.*, payers_payments.* payments

sql - Insert values from one table to another -

have 2 table. tbl1: col1 col2 col3 alex and tbl2 : id name 1 john 2 nen 3 bob want enter names in tbl2 tbl1 col3, col1 , col2 must former, example want : col1 col2 col3 alex john nen bob i try : insert tbl1(col1,col2,col3) values('a','a',(select name tbl2)) but have error : subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression you can try this... insert tbl1(col1,col2,col3) select 'a','a',name tbl2

java - Android: fill spinner with items in text file -

i want fill spinner items in text file on hosting. text file content separate "\n" character: afghanistan albania algeria andorra angola i write code i've error : 03-10 12:32:07.716: e/androidruntime(7670): fatal exception: thread-69056 03-10 12:32:07.716: e/androidruntime(7670): java.lang.arrayindexoutofboundsexception: length=91; index=91 bo.write(buffer); string s = bo.tostring(); final vector<string> str = new vector<string>(); string[] line = s.split("\n"); int index = 0; while (line[index] != null) { str.add(line[index]); index++; } you need change condition.. this: while (line[index] != null) { str.add(line[index]); index++; } if size of line 10, index++ make 11. line[11] not null rather throw arrayindexoutofboundsexceptio