Posts

Showing posts from February, 2015

jsf - java.lang.NullPointerException in a simple JSP Facelets Page -

i getting error while run project in netbeans ide.. have used jsp-facelets not getting output.. **welcomejsf.jsp** <%@page contenttype="text/html" pageencoding="utf-8"%> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <f:view> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>main page</title> </head> <body> <h1><h:outputtext value="welcome javaserver faces"/></h1> <br> <center> <table border="1" width="30%" cellpadding="3"> <thead&

performance - How to track down slow code in PHP -

i installed open source php project on ubuntu server , got running. however, pages load extremely slow. phpinfo() page , basic test page connecting mysql db load fast. there tons of include files, log files , curl calls in open source code. strategies/tools can use track down source of slowness? you need profile pages, have performance problems. can done php-extension xdebug , kcachegrind . follow steps: install php5-xdebug package on ubuntu server via: sudo apt-get install php5-xdebug . configure xdebug.profiler_enable_trigger parameter. @ official manual . install on local computer kcachegrind package: sudo apt-get install kcachegrind . start slow page get parameter xdebug_profile=1 . see related question . copy generated profile log local comp , open in kcachegrind. some notes: after php5-xdebug package installation you'll need restart http-server (or php-fpm daemon. depends on installed software on server). right place profiling procedure t

Android - Can change button color in listview -

can change button color in listview simplecursoradapter or use object can use color stripe show type , how can use problem. public class coloradapter extends simplecursoradapter { private context context; public coloradapter(context context, int layout, cursor c, string[] from, int[] to) { super(context, layout, c, from, to); this.context = context; } public int getcount() { // todo auto-generated method stub return myarrlist.size(); } public object getitem(int position) { // todo auto-generated method stub return position; } public long getitemid(int position) { // todo auto-generated method stub return position; } public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service);

javascript - Why "this" inside of a function's returning object window -

there 2 type of scope in javascript named function scope global scope now executing code function abc() { alert(this); } abc(); abc call returning me [object window] why?? function makes scope why representing window this , inside function, object on function invoked. in case, not invoking on object. so, default this refer global object, in browser, window object. but in strict mode, if invoke this, this undefined . "use strict"; function abc() { console.log(this); // undefined } abc(); or function abc() { "use strict"; console.log(this); // undefined } abc();

Find and replace all matching dynamic strings using jquery or javascript -

here body of html: <body> <div>_good morning john... _welcometext.</div> <label> _welcometext </label> <a href="">_good</a> </body> here jquery: var custom_obj = {}; custom_obj["_welcometext"] = "welcome in custom"; custom_obj["_good"] = "good in custom"; $.each(custom_obj, function(key, value) { $('body').text(function(index,text){ return text.replace(key,value); }); }); this code works replaces 1st instance of matched pattern. replacing key dynamic value coming foreach loop, not able use /key/g replace instances. please help. i not recommend text based operation that important, costly var custom_obj = {}; custom_obj["_welcometext"] = "welcome in custom"; custom_obj["_good"] = "good in custom"; var $contents = $('body *').addback().contents(); $.each(custom_obj, function (key,

html5 - Integrate Ads in Android Phonegap Build -

i trying integrate ads in phonegap build android application. integrating admob not possible in html5 phonegap build. i tried mobfox ( http://www.mobfox.com/ ) ad networks. but ads not showing , not sure reliability compare admob. please kindly suggest me suitable ad networks phonegap build android apps. i have not been able find way @ this. ended having work local cli version of phonegap , plugin admob: https://github.com/floatinghotpot/cordova-plugin-admob

Git Merge No Fast-forward Flag - Bad Practice? -

i have question regards flag can used merge command in git. apparently, if use --no-ff merge (no fast-forward flag), create new commit object @ point of merge, if merge have been performed via fast-forward. git merge --no-ff afeature i have not found information on flag , nobody seems discuss anywhere. bad practice create such commit object (and avoid losing information historical existence of feature)? or out of date , been replaced something? thanks no - not bad practice. choice have. 1 situation in forcing creation of merge commit useful in code review. if developers push feature branches review , reviewer performs merge when feature accepted merge commit contains information did review along additional comments can useful. how pull-request style workflow used github/gitlab works. when project owners accept pull request, merge commit created if capable of fast-forward merging.

mysql - python still can't insert into database -

i want insert data mysql database still can't, here code: import ue9 d = ue9.ue9() import datetime time import gmtime, strftime import mysqldb timee = "%y-%m-%d %h:%m:%s" noww = strftime(timee, gmtime()) print noww db = mysqldb.connect("localhost","root","root","temperature") cursor = db.cursor() sql = ("insert mydate(datenow) values(%s)",(noww)) try: cursor.execute(sql) db.commit() except: db.rollback() db.close() but still can't connect database can me ? you miss comma in list of values: sql = ("insert mydate(datenow) values(%s)",(noww,))

sql - How to select every row N times in MySql table? -

i have mysql table below. id name surname 1 joe black 2 mary peterson 3 bob marley 4 andy murray ... i want write select command return every row n times. example n = 3. select name, surname blah-blah (3 times ) person name surname joe black joe black joe black mary peterson mary peterson mary peterson bob marley bob marley bob marley andy murray andy murray thank you. you use union all result want, you'd better not such job sql. select * ( select name, surname person union select name, surname person union select name, surname person ) order name

Command to remotely restart another computer on same network, In Windows and Linux? -

what command use remotely restart computer on our network, through command prompt windows? , same command in linux terminal? google should sort u out. here's possibilities assuming wish reboot linux machine (either local or remote): local (as root) /sbin/shutdown -r or $ sudo reboot remote you need access remote machine before can reboot it. so, best bet grabbing ssh or putty (for windows). with ssh, can reboot remote linux machine this: $ ssh root@remote-server.com /sbin/reboot or $ ssh root@remote-server.com /sbin/shutdown -r enjoy! more ideas discussed here

cloud - Cloudstack:KVM:: Snapshot stuck in Creating Status forever.‏ -

i working on cloudstack infrastructure service build our organization framework. purpose, rhel 6.4 (kernel version 2.6.32 ), cloudstack 4.2.1 , kvm (version 0.12.1) being used. i have been working around long figure out below mentioned issue unfortunately not. issue: snapshot gets stuck in state "creating" forever. impact: couldn't snapshot consequently , thus, instance cloudstack's ui not started/stopped. please see below trace management server log think reason behind this. me":"root-13","path":"ec5692cb-7758-4618-b589-09cb71e45dba","size":21474836480,"type":"root","storagepooltype":"networkfilesystem","storagepooluuid":"d41d4103-a11d-3160-8a3b-6469c574a93f","deviceid":0},{"id":19,"name":"data-13","path":"8017ac65-b52b-450b-937f-d92178de2f34","size":21474836480,"type":

php - mysql_real_escape_string(htmlspecialchars) function not working when editing values -

Image
i'm using italy language main language in website when edit details of language characters automatically converting special character. know how fix issue...! here code used edit database value , convert specialchars $title7 = mysql_real_escape_string(htmlspecialchars($_post['title7'])); $description7 = mysql_real_escape_string(htmlspecialchars($_post['description7'])); here full code used edit database values // connect database include('db.php'); if (isset($_post['submit'])) { // confirm 'id' value valid integer before getting form data if (is_numeric($_post['id'])) { // form data, making sure valid $id = $_post['id']; $language = mysql_real_escape_string($_post['txtlanguage']); $pkg_name = mysql_real_escape_string($_post['pkg_name']); $category = mysql_real_escape_string($_post['category']); $title = mysql_real_escape_string($_post['tit

google maps - how to find location from text entered in iOS -

i working on google map in ios. want search location based on text (address) enter. so, how can find location (latitude , longitude) entered text? here code coordinate address - (void)geocodefromaddress:(nsstring *)address { //6 clgeocoder *geocoder = [[clgeocoder alloc] init]; [geocoder geocodeaddressstring:address completionhandler:^(nsarray *placemarks, nserror *error) { if([placemarks count]) { clplacemark *placemark = [placemarks objectatindex:0]; cllocation *location = placemark.location; cllocationcoordinate2d coordinate = location.coordinate; nslog(@"coordinate = (%f, %f)", coordinate.latitude, coordinate.longitude); } else { nslog(@"error"); } }]; }

php - Unable to horizontally center 'm' with GD2 -

Image
my goal draw horizontally centered m . therefore calculate width of letter, substract value total width , divide 2. result should distance left (or equally right). however, 'm' misplaced. noticed fonts may not trigger problematic behavior. note script correctly works other latin characters. arial: bitstream vera sans: <?php $totalwidth = 100; $totalheight = 100; $font = 'arial.ttf'; $img = imagecreatetruecolor($totalwidth, $totalheight); $red = imagecolorallocate($img, 255, 0, 0); $fontsize = 100; $bbox = imagettfbbox($fontsize, 0, $font, 'm'); $width = max($bbox[2], $bbox[4]) - max($bbox[0], $bbox[6]); $centeredx = ($totalwidth - $width) / 2; imagettftext($img, 100, 0, $centeredx, 100, $red, $font, 'm'); imagepng($img, 'testcase.png'); imagedestroy($img); there small space left of each letter, , different each letter. on php.net wrote solution this: http://www.php.net/manual/en/function.imagettfbbox.php#97357 y

android - Handle textview state when fragment orientation changes -

i have in fragment layout textview default visibility state = "gone"; in fragment class add information textview , show it. fragment have setretaininstance = true cursorloader saving. when orientation changes textview hide. think because: public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view = inflater.inflate(r.layout.fragment, null); tvnowusedfiltres = (textview) view.findviewbyid(r.id.tvtextview); it's changes state "gone". cant save instance state, because bundle returns null setretaininstance = true. how can save text view state? the setretaininstance() not work widgets, because widgets wired activity (not fragment). so, need put member boolean value in fragment class, , in oncreateview(), reset visibility parameter of textview after getting it: tvnowusedfiltres = (textview) view.findviewbyid(r.id.tvtextview); if (mynewboolean) { tvnowusedfiltres.setvisibility(view.visible)

c# - how can set a color to a row of gridview when link button is clicked -

i have gridview in page. grid has 1 linkbutton. how can set color row of gridview when linkbutton clicked? <asp:templatefield itemstyle-width="20%" headertext="options" headerstyle-cssclass="headerfont"> <itemtemplate> <div class="headerfontnew"> <asp:checkbox id="checkview" runat="server" checked='<%# bool.parse(eval("rm_rights").tostring() == "1" ? "true": "false") %>' enabled="true" onclick="checkboxcheck(this);"/> <asp:checkbox id="checkinsert" runat="server" checked='<%# bool.parse(eval("rm_rights").tostring() == "2" ? "true": "false") %>' enabled="true" onclick="checkboxcheck(this);" /> <asp:checkbox id="c

disk - How to merge a drive with primary boot partition in windows 8? -

i merge g drive c drive need more space in primary boot partition(c drive).. c , g drives not physically adjacent in computer. have d , e drives in between. have emptied g drive. want merge g drive because free has smaller size. using windows 8. kindly me merge these 2 drives without affecting c drive.. usually partitions must adjacent beeing merged windows tools. there other tools allow this, e.g. partition wizard . partition wizard offers free home edition edition won't allow merging non adjacent partitions. compare features of different editions.

excel - Count rows with specific property -

Image
i have following table: i want count each rows that: k,0,1 i tried =and(countif(a:a;"k");countif(b:b;0);countif(c:c;1)) however gives me boolean value , not count? i appreciate suggestions! countifs extends usefulness of countif function allowing specify 2 127 criteria rather 1 in countif. countifs(a:a;"k";b:b;0;c:c;1) should work fine. , solution stated simoco via comment. let me know, if works.

networking - How to get process or port Network bandwidth usage in linux -

i want network bandwidth usage each process. have found lot of information this, such iftop, nethogs , linux process explorer ... of them process brandwidth usage capture packet(libpcap), test in linux consume lot of cpu(%10-%15) , speed of flow 11mbyte/s. if can flow rate each port can solve questions because hava table process port used. want know there other way port flow without capture packet. as far know linux doesn't offer alternative interface pcap calculating network usage. /proc/<pid>/stat(us) contains various process information nothing network access, total i/o usage including disk access. similarly, know port have read @ least ip header. hence assume not possible speed significantly, because analyzing packets in user space slow. kernel module task seems option.

css - Media Queries conflict using max-device-width and max-width -

i trying understand if there's conflict between using max-device-width specify elements website responsive on devices , using max-width desktops. i've heard forums using device-width in stylesheets gives different layout on devices? will there conflicts in sense of being overwritten? this have far: /* desktops , laptops ----------- */ @media screen , (max-width : 1824px) {...} /* ipads (landscape) ----------- */ @media screen , (max-width : 1224px) {...} /* ipads (portrait) ----------- */ @media screen , (max-width : 1024px) {...} /* smartphones (landscape) ----------- */ @media screen , (max-width : 768px) {...} /* big smartphones (portrait)*/ @media screen , (max-width : 640px) {...} /* big smartphones (portrait)*/ @media screen , (max-width : 480px) {...} /* smartphones (portrait) */ @media screen , (max-width : 321px) {...} /* iphone 4 ----------- */ @media screen , (-webkit-min-device-pixel-ratio : 1.5), screen , (min-device-pixel-ratio : 1.5) { /* sty

One-shot laravel validator -

i have form searches something. based on form, validate if input correct: $validator = validator::make(input::all() , array( 'address' =>'required', )); if($validator->fails()) { return redirect::to('/')->witherrors($validator); } after this, want validate else (that result object isn't empty), unrelated search. in other words, it's not input form. 1) create validator validate this? or 2) there better way check value , spawn object can returned "witherrors"? update this isn't working me: $validator = validator::make( array( 'searches' => sizeof($search) ) , array( 'searches' => 'required|min:1' ) ); if($validator->fails()) { return redirect::to('/')->witherrors($validator); } it's not working because reason it's picking "searches" item should validated "sometimes" you have 2 ways. 1

django - gunicorn + redis: Does not work? -

i run django server redis [in-memory caching filtering duplicate records] integrated celery process [tasks insert data postgresql database asynchronously]. django server integrated redis via django-redis-cache caching enabled. caches = { 'default': { 'backend': 'redis_cache.rediscache', 'location': '/tmp/redis.sock', }, } if use ./manage.py runserver ip:8000 run server , start posting data, there's no problem during get/set attributes in redis single application , app runs smoothly. but now, i'm planning migrate django gunicorn via command: gunicorn myapp:wsgi_app -w 3 -b ip:8000 as creates 3 workers django process, believe trying access same redis-server caching. if start posting data using setup, message, internal server error: /post/data/ file "/path/to/app/views.py", line 94, in savedata value = cache.get(key) file "/usr/local/lib/python2.7/dist-packages/redis_cache/cache.

Get HTML Current Page name alone, followed by ".htm" from URL or Pathname using Jquery & Javascript -

i have scenario like: below, following "menu list" having href value set corresponding ".htm" pages inside "menu.html" click me got pageone.htm click me got pagetwo.htm click me got pagethree.htm click me got pagefour.htm each pages pageone.htm, pagetwo.htm & pagethree.htm etc.. having footer part, in footer must has contain 3 links href values. i require solution: if current page pageone.htm footer should show me shortcuts links pagetwo.htm, pagethree.htm , pagefour.htm , wise verse depending on current page. so require code .htm url pathname. can find() method of jquery after getting url path find(".htm") url. require snippet of code .htm page name alone. including sample case below: what if url >> "http://<10.10.21.26:9080>/mytestaoo/pagethree.htm#detailview" i wish value "pagethree.htm" alone above url, if current page. thanks in advance var lastpartofurl = document.

java - SWT Horizontal line after Text fully expanded -

Image
i'm trying display history in textfield in swt. the history generates new shell has 2 composites. first displays header part contains label "history" , horizontal line underneath. second footer part display actual data. works, horizontal line not expanded (i.e.: "filled") throughout available horizontal space (i.e.: until composite "end"). public void mousedown(final mouseevent e) { findsegmenttext.settext(""); if(0 == lastsegmentids.size()) return; if(disabletooltipsbutton.getselection()) return; // context not desired if(null != popupshell) popupshell.dispose(); popupshell = new shell(display.getdefault(), swt.border | swt.on_top | swt.modeless); //popupshell.setlayoutdata(new griddata(griddata.fill_horizontal)); popupshell.setlayout(createnomarginlayout(1, false)); /* header */ compositesearchsegments1 = new

Addclass to every "ul" and count the "ul" element -

i´ve got 3 lvl navigation , want every "ul" class "levle2" additional class called "count" counter counts "ul´s" , puts number behind class. this how should like <ul class="level1" > <li> <a href="#">more options</a> <ul class="level2 count1"> <li><a href="#">second level link</a></li> <li><a href="#">second level link</a></li> </ul> </li> <li> <a href="#">more options2</a> <ul class="level2 count2"> <li><a href="#">second level link2</a></li> <li><a href="#">second level link2</a></li> </ul> </li> <li

c++ - cv::warpPerspective only shows part of warped image -

im changing image front perspective bids eye view using gethomography , warpperspective. it works in image warps desired perspective crop off. moves warped image largely outside image box. assume reason because operation results in negative coordinates. i have calculated points calculation of translation matrix manually , not using of opencv:s functions doing since i.e. chessboard functions failed detect proper points. i guess can fixed doing additional changes transformation matrix. how done? also, there way make sure transformed image centered along x-axis , let y-axis adjusted desired position? code snippet job now: cv::mat image; // image loaded original image cv::mat warppers; // container resulting image cv::mat h; std::vector<cv::point2f> src; std::vector<cv::point2f> dst; // in reality several more points. src.push_back(cv::point2f(264,301)); src.push_back(cv::point2f(434,301)); src.push_back(cv::point2f(243,356)); src.push_back(cv::point2f(476,356)

Rewrite URL and remove part with .htaccess -

i stuck .htaccess file, , need :). have wordpress installation using testing. in folder , use .htaccess there. rules use far: ######### custom ######### rewriteengine on # ignore folders rewritecond %{request_uri} "/af1wp/" rewriterule (.*) $1 [l] ############### # me # ############### # home (senne tijdeman) rewritecond %{remote_addr} ^###\.###\.###\.###$ rewritecond %{http_host} ^((www.)?([a-z0-9_\-]+).)?alleenf1.nl$ rewritecond %{request_uri} !^/af1wp/$ rewriterule ^(.*)$ /af1wp/$1 [l] this works (with real ip address of course), no problem there. want rewrite exisiting url's new format. old url this: http://alleenf1.nl/nieuws/qogbb/raikkonen-alles-is-mogelijk-in-australi the new url should this: http://alleenf1.nl/raikkonen-alles-is-mogelijk-in-australi the part want remove " nieuws/qogbb/ " not same, have use regex that. tried did not work @ all. i thought simple, apparently not me unfortunately. have 2 questions. what right rewriteru

android - how to return back to previous activity on back pressed? -

i have call activity a state 2 activity a state 1 again call activity a state 3 activity a state 2. how can go activity a state 2 when press on button in android? you can using following code- @override public void onbackpressed() { super.onbackpressed(); = new intent(currentactivity.this, nextactivity.class); i.setflags(intent.flag_activity_clear_top); startactivity(i); finish(); }

C++ multiple inheritance - diamond with templates -

i've got problem when inheriting multiple instances of template. my class bridge tries inherit 2 instances of bridgetemplate, when try call bridgetemplate's 'set' function, compiler rises error ("ambiguous..."). however, works ok if bridge inherits 1 instance. below, piece of code both template , class bridge. in advance template <class datatype, class datawriter> class bridgetemplate : public bridgegeneric { public: void set(datatype a, datawriter b) { std::cout << "a: " << << "; b: " << b << std::endl; } ... }; class bridge : public virtual bridgetemplate<int,float>, public virtual bridgetemplate<float,int> { ... } argument types not matter. the error message applies name lookup, not overload resolution. overloaded functions must come same class or namespace. in order insure that, use pattern: class child : public dad, public

jquery - SagePay Ebizmarts Test Transaction Error -

Image
i've asked on @ ebizmarts support forums... haven't received sort of of yet. i'm going through sagepay set process , i'm @ stage need put through test transaction using sage's provided test card details ( http://www.sagepay.co.uk/support/12/36/test-card-details-for-your-test-transactions ). i'm using ebizmart's free sage extension along mageapps supercheckout. when trying submit transaction, popup saying: payment has failed, please reload checkout page , try again. card has not been charged. the 1 javascript error when inspect: uncaught referenceerror: changecsvclass not defined this error happens after click place order. i using jquery no conflict, taking out didn't fix anything. the dev site @ http://metrofurniture.seolution.co.uk/ any appreciated. sagepay , ebizmarts both have support. think if patient hep bottom of issue. it sagepay misconfiguration looks clash between supercheckout , ebizmarts. can test using stand

Ignore homebrew when using Chef Solo and Berkshelf -

i using chef solo provision vagrant machine , berkshelf install cookbooks. using linux host (ubuntu). i want use mysql cookbook; when add: cookbook 'mysql' berkshelf installs homebrew transitive dependency. chef-solo loads , fails because in linux. is there way ignore homebrew package when installing or loading cookbooks? note: have tried use group :ignore cookbook 'homebrew' end but when run berks install --without ignore returns error: error: berks install called arguments finally problem not homebrew package; error throwed. using vagrant-omnibus update chef latest version removed error , allowed me finish installation correctly.

c# - Should I use JayData in MVC 4 with WebApi and OData -

my manager told me research on jaydata dataservice performing crud operations. exploring jaydata last 2 weeks. my requirement have webapi controllers @ server accept requests performing crud operations. filtering, used odata. in case, webapi provider helpful. thought 'odata' provider wrok requires metadata server , don't have service provide metadata. any example or documentation have seen far not related webapi in jaydata site. use kind of context paradigm not applicable webapi. what should do? advice? should use jaydata in project? this article looking - http://jaydata.org/blog/how-to-use-jaydata-with-asp.net-web-api---i you shouldn't worry metadata can build necessary javascript data model manually.

post - Access denied error message when trying to create a shared link to a folder in Box -

so following on previous question around permissions add collaborators, having further permissions issues when trying create shared link folder in box using api. so confirm, have "manage enterprise" scope enabled on api account. here error message getting back: {"type":"error","status":403,"code":"access_denied_insufficient_permissions","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"access denied - insufficient permission","request_id":"2137493926531843e3c61af"} here post data sending: {"shared_link":{"access":"collaborators"}} here url sending to: https://api.box.com/2.0/folders/1561835651 the folder id folder have created using api, , able add collaborators folder ok, until point, have correct permissions perform these operations. so question is, else should doing? cannot see more options again

javascript - Jquery Slide Toggle : Slide Button with Panel -

i working on jquery slide tab , working fine on button click. want button stitch panel , should slide panel. button fix , panel working expected. here fiddle html <button id="showmenu" type="button" class="feed_btn">feed back</button> <div class="sidebarmenu"> <div class="slide-out-div" style="z-index: 999;"> <form class="generalform bookingform" action="#" method="post"> <div class="row"> <div class="col-sm-12"> <label>name<span>*</span></label> <input type="text" name="name" class="required" /> </div> <div class="col-sm-12 mar_top">

In Hibernate OneToMany mapping -

what have specify in optional element " mappedby ".is table_name of specific model or classname? which correct? this @onetomany(orphanremoval=true,fetch = fetchtype.lazy,mappedby = "adminuser") private list sessions; or this.....? @onetomany(orphanremoval=true,fetch = fetchtype.lazy,mappedby = "admin_user") private list sessions; if relationship bidirectional, mappedby element must used specify relationship field or property of entity owner of relationship.

r - replace "." by NA in a data frame where "." is also used as decimal -

i got data frame "." used both decimal marker , alone na. a b c d 1 . 1.2 6 1 12 . 3 2 14 1.6 4 to work on data frame need obtain: a b c d 1 na 1.2 6 1 12 na 3 2 14 1.6 4 how should deal keep decimals transform alone "." in column c? here data in reproducible format: data <- structure(list(a = c(1l, 1l, 2l), b = c(".", "12", "14"), c = c("1.2", ".", "1.6"), d = c(6l, 3l, 4l)), .names = c("a", "b", "c", "d"), class = "data.frame", row.names = c(na, -3l)) you can use type.convert , specify "." na.string : df <- data ## create copy in case need original form df # b c d # 1 1 . 1.2 6 # 2 1 12 . 3 # 3 2 14 1.6 4 df[] <- lapply(df, function(x) type.convert(as.character(x), na.strings=".")) df # b c d # 1 1 na 1.2 6 # 2 1 12 n

oracle11g - Stored Procedure In Oracle 11g database -

i want insert,update,delete , select statement in 1 stored procedure using oracle 11 g database.if 1 know ,please me this. stored procedure example agent create or replace procedure get_agent (v_cur in out sys_refcursor) begin open v_cur select * agent; end get_employees; insert agent values(:agentid,:agentname) delete agent agentid=:agentid update agent set agentname=:agentname agentid=:agentid update agent set agentname=:agentname,..... rowid=:record_rowid delete agent rowid=:record_rowid

php - Must i any pre encode binary data to send it as base64 on ios? -

i send server video (. mov) devide file chunks. every chunk encode base64 , send in http post. php-server decode base64 string standard decoder. size of chunk before send more big, decoded on server. question: must additionally somehow encode binary data before encode base64? there code: // ... nsfilehandle* file = [nsfilehandle filehandleforreadingatpath:path]; if( file ) { [file seektofileoffset:[[xdrutils tonumber:[obj valueforkey:@"offset"]] longlongvalue]]; nsdata* data = [file readdataoflength:xkchuncksize]; [file closefile]; nsstring* base64 = [data tobase64string]; [post setobject: base64 forkey: @"record_segment_content"]; } // send server // ... // category base64 en @implementation nsdata (xdrbase64) -(nsstring*)tobase64string { nsstring *string; if ([self respondstoselector:@selector(base64encodedstringwithoptions:)]) { string = [self base64encodedstringwithoptions:kniloptions]; // ios

css3 - CSS label lose margin/padding -

i'm unable lose padding and/or margin between 2 of radiobutton's labels. this have far: http://jsbin.com/putoz/6/edit what i've tried far: forcing width of outer div forcing margin-rigth/left , padding-right/left 0px on both labels easiest way make labels block elements , float them: demo label { width: 32px; height: 29px; cursor: pointer; position: relative; display: block; float: left; line-height: 29px; } you'll need adjust line height keep text in vertical centre. or, if that's impractical, remove white space markup: this: <input id="appointment-yes" type="radio" name="set-appointment" value="yes" /> <label class="yes-label" for="appointment-yes"></label> <input id="appoinment-no" type="radio" name="set-appointment" value="no" /> <label class="no-label" for=

multithreading - Java - 4 Threads manipulate within two synchronized methods the same object data -

first of new here, hope things right during questioning. the problem: i have class store attribute int size; in class 2 methods manipulate size attribute. `public synchronized void leave(){ this.size++; }` `public synchronized void enter(){ while(this.size==0){ } this.size--; }` if initialize store object size=2; for example , 4 other objects (the 4 threads) alternately try leave() or enter() the store object endless loop. thought if write synchronized methods, leave method called thread although other thread hang in endless loop. i hope question understandable. thank help. first of new here, hope things right during questioning. your question asked got @ least right :) 4 other objects (the 4 threads) alternately try leave() or enter()the store object endless loop when 1 thread enters synchronized block, declaring no other threads can enter synchronized region of same object until thread has left initial synchronized block. hav

html5 - HTML concatenating text input with link -

i've got following code: <form> comments: <input type="text" name="scomments"><br> </form> <a href='http://translate.google.com/#en/nl/' + scomments target="_blank">translate comment , verify it</a> i trying add text entered in "scomments" text input google translate link , open google translate in new tab. @ moment not able reference text entered tle link. how can concatenate these values? p.s.: that's first html code know that's basic question. thanks in advance, you need javascript - here's fiddle: http://jsfiddle.net/qgs5w/ basically, need add following in head section of page: function clickyclick() { url = 'http://translate.google.com/#en/nl/' + document.getelementbyid("comment").value window.open(url, '_blank'); } and perhaps, simplicity, change link button: <form>comments: <input type="text" n

php - File is not being uploaded properly -

in android app, i've upload file server , read file @ server side. file being uploaded times happen, in folder (at server in file resides) if uploaded file exists, current uploaded file generated previous file data. e.g. if upload file named a server data '1, 2 , 3' there file a.txt under folder @ server side same data, , if upload file named b server data 'a, b , c' file b.txt under folder there previous file data of a.txt . in b.txt , data '1, 2 , 3' . below code. can issue? android side public void uploaduserfriendid(string user_id, string filepath, string filename) { string server_url = "http://addressofserver/folder/myfile.php"; inputstream inputstream; try { inputstream = new fileinputstream(new file(filepath)); byte[] data; try { data = ioutils.tobytearray(inputstream); httpclient httpclient = new defaulthttpclie

ios - How to stop status bar appearing after waking in Guided Access on iOS7? -

we've had issue reported status bar appears overlaid on our app after sleeping , waking ipad. our setup follows: our app landscape (left , right) i've enabled guided access on device i've enabled sleep/wake button in guided access we updated our app , ipads ios7, , did not see issue in ios6 after investigating i've found following when in guided access: with device in landscape, repeatedly sleeping , waking (using power button on device) (~1 in 10) causes status bar appear in landscape orientation , fade sleeping device, rotating portrait, waking, consistently (~8 in 10) causes status bar appear in portrait orientation , stay on screen i tried using following, called applicationdidbecomeactive: [[uiapplication sharedapplication] setstatusbarhidden:yes withanimation:uistatusbaranimationfade]; but had no effect. tried calling after short delay, , continually on loop (both had no effect). tried show status bar , hide, , surprised see 2 status bars -

Git Remote Server connections refused -

i'm getting crazy error, after 2 days didn't find wrong in system, , i'm sure easy fix it. when try connect git server using git functions got message: unable open connection: host not exist fatal: not read remote repository. please make sure have correct access rights , repository exists. i explain little more: if open gitbash (from windows machine) , try connect git server (over debian) using ssh working fine. rsa autentification works fine , logins perfetly for example: ssh mygithost once in, can go /opt/git/myrep.git , can create repositories using git init --bare windows guibash can use scp instructions , again works fine, can clone local repositores , copy gitserver but... when try git action gitbash (clone or push) git clone mygithost:/opt/git/myrep.git persisten error. any idea i'm doing wrong? i'm using putty (plink) in windows machine after same error using openssh , @ git server dind't install gitlab, git, i found issues tal

nsstring - NSRegularExpression (iOS) -

a have little problem parsing html string. have big string , need delete characters between "script" tag. : <script...>some text here</script> so need delete "some text here". think great use nsregularexpression. can me ? lot. while advised not parse html regular expressions (see my all-time favorite s.o. answer ), can approximate like: nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:@"<script.*?>(.*?)</script>" options:nsregularexpressioncaseinsensitive | nsregularexpressiondotmatcheslineseparators error:&error]; [regex enumeratematchesinstring:string options:0 range:nsmakerange(0, [string length]) usingblock:^(nstextcheckingresult *result, nsmatchingflags flags,

javascript - ZF2 jQuery datepickers not working in ajax dialogs -

some actions on zend framework 2 web application open via dialog. use method when processing action called ajax: /** * display content on ajax call. * @param \zend\mvc\mvcevent $e */ public function ondispatch(\zend\mvc\mvcevent $e) { $app = $e->getparam('application'); $layout = $app->getmvcevent()->getviewmodel(); if($app->getrequest()->isxmlhttprequest()) { $controller = $e->gettarget(); $controller->layout('application/ajax/ajax'); $layout->setterminal(true); } } the problem datetime pickers of jquery not seem work. because html gets added dynamically page. i think solution might modify ondispatch method re-includes of js-files. or there better way? thought adding js-files hard-coded ajax.phtml file work. but again, know if there better approach exists, reloading js on page or something. yeah, 1 way add scripts ajax.phtml. something did while ago send required scripts respons

java - Change display name for hyperlink in csv file while opening through Excel -

i have java program has been used generate csv file. have column contains link web pages. want put link on custom display name on it. when write =hyperlink("http://www.google.com","google") on msexcel gives me desired result. wanted same java program. program looks follows: res.setcontenttype("application/csv"); bufferedwriter sbs = new bufferedwriter(res.getwriter()); res.setheader("content-disposition","attachment; filename=\"joblist.csv\""); stringbuffer sb = new stringbuffer(); string link = " http://www.google.com "; string hyperlink = "=hyperlink(\""+link+jo.getid()+"\"\",\"\"google\")"; sb.append(hyperlink); i followed link add hyperlink on csv file. can excel interpret urls in csv hyperlinks? you can try this "=hyperlink(""http://www.google.com"",""google"&q

excel vba - How to update the field of Ojbect in VBA? -

when use vba, want update object's field function, don't know how that. an 1 give me advice? type myobject string b boolean end type 'update function sub update(byval o myobject, key string, value string) o.key = value 'this want do! end sub i don't know vba, possible? you cannot set value of field named key , because such key not exist in definiton of myobject . can this: o.a = key o.b = value edit to specify field want update, can add conditional statement function. if key = "a" o.a = value else o.b = value end if i'm afraid cannot loop through fields in type, because vba not support reflection.

Transfering Data from Multiple HTML Files into Excel -

suppose have number of html documents, each of has same format. while information in these documents not in tables there specific key words give away desired information located. there way set macro excel searches each of these documents specific 'title', returns characters after first white space of title, , stops once reaches 2 white spaces in row? idea place of information 1 column , begin process again 'title'. not sure start such macro. this should close mypath = "path folder containing html files" set fso = createobject("scripting.filesystemobject") set my_files = fso.getfolder(mypath).files each f1 in my_files set txtstream = fso.opentextfile(path_fname, forreading, false, tristateusedefault) my_var = "" while not txtstream.atendofstream my_var = my_var & txtstream.readline loop txtstream.close pos_1 = instr(1, my_var, "your title") pos_2 = instr(pos_1,

ubuntu 12.04 - Block shutdown process from Ruby application -

in ruby application, recording audio , after stopping takes 1 minute secure. during period, if user shuts down system, audio gets corrupted. i want restrict user shutdown system. how can using ruby? i using ruby 1.9.3 , ubuntu 12.04. write in file make run when terminal closed: process.demon(true, true) not sure how prevent os shutdown. not sure if question either.

Oracle SQL pivot translation -

i have table follows: snf sfcm pool quota eng 11 sud 20 b uk aau 30 but displayed follows: snf sfcm eng sud aau 11 20 b uk 30 i have tried use pivot follows select a.* test pivot ( sum(quota) quota pool in ('eng', 'sud', 'aau') ) but can't seem correct output. would able advise me? also, wondering if possible use sql statement instead of 'eng', 'sud', 'aau' . in(select pool test) . thanks. your query should follows: select snf, sfcm, eng_quota, sud_quota, aau_quota nc_so1 pivot ( sum(quota) quota pool in ('eng' eng, 'sud' sud, 'aau' aau) ) also not possible generate dynamic list using sql afaik

mysql - How to set priority for search value -

i've got problem setting priority search value in database. find courses, have phrase (or contain word of phrase) in name course. id addition, course have same name searched phrase in first place in returned data. records course table: +----+------+-------------------+ | id | code | name | +----+------+-------------------+ | 1 | jpa | jpa lorem ipsum | | 2 | jsf | jsf lorem ipsum | | 3 | hib | hib lorem ipsum | | 4 | teb | teb lorem ipsum | | 5 | zrn | in advance | +----+------+-------------------+ my query: select `course`.`id`, `course`.`name` `course` `name` 'teb lorem ipsum' or `name` '%teb%' or `name` '%lorem%' or `name` '%ipsum%' database returns: +----+-----------------+ | id | name | +----+-----------------+ | 1 | jpa lorem ipsum | | 2 | jsf lorem ipsum | | 3 | hib lorem ipsum | | 4 | teb lorem ipsum | +----+-----------------+ i receive: +----+---

java - I need a method to save an arraylist in my app -

im working on app , in made arraylist of strings. searched ways save list next visit did not find one. tried shared preferences didn't manage make work. can please me find way save data in array list , restore in every app visit ? the array want save called here "contactlist". i put code below: public class work_contacts extends activity { public static final int pick_contact = 1; private arraylist<string> contactlist; private arrayadapter<string> arrayadapter; private arraylist<string> contactlist2; private arrayadapter<string> arrayadapter2; @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.activity_work__contacts); button btnpickcontact = (button) findviewbyid(r.id.btnpickcontact); btnpickcontact.setonclicklistener(new view.onclicklistener() { public void onclick(view _view) { intent intent = new intent(intent.action_pick, con

sshd - Is cipher "3des-ctr" supported by openssh? -

is cipher "3des-ctr" supported openssh? it not mentioned in list of supported ciphers in man page of ssh_config : ciphers specifies ciphers allowed protocol version 2 in order of preference. multiple ciphers must comma-separated. supported ciphers ''3des-cbc'', ''aes128-cbc'', ''aes192-cbc'', ''aes256-cbc'', ''aes128-ctr'', ''aes192-ctr'', ''aes256-ctr'', ''arcfour128'', ''arcfour256'', ''arcfour'', ''blowfish-cbc'', , ''cast128-cbc''. default is: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128, aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc, aes256-cbc,arcfour

windows - How to start Oracle SQL Developer 4 using 32 bit JDK on Win 64? -

i need connect database , use wallet file. if try sql developer end "ocijdbc.dll: cant load ia 32bit .dll on amd 64-bit platform." i have both installed jdk 32 bit (in c:prog32bit) , jdk 64 bit (c:prog) development. i tried set javahome in sqldeveloper/bin/sqldeveloper.conf manually setjavahome c:\program files (x86)\java\jdk1.7.0_51 my next step edit %user_home%/sqldeveloper/sqldeveloper.conf , set setjavahome there too, none didn't work. next step was, edited sqldeveloper/bin/sqldeveloper.bat , set: java_home="c:\program files (x86)\java\jdk1.7.0_51" path="c:\program files (x86)\java\jdk1.7.0_51\bin%" java.exe -xmx640m -xms128m -xveri.... my last try use command line (as on linux) , run: d:\sqldeveloper>path="c:\program files (x86)\java\jdk1.7.0_51\bin" d:\sqldeveloper>java -version java version "1.7.0_51" java(tm) se runtime environment (build 1.7.0_51-b13) java hotspot(tm) client vm (build 24.51-b