Posts

Showing posts from March, 2010

objective c - How do I format the iOS 7 UIPickerView to display only 3 choices? I.e. One above and one below the active choice? -

i want format ios 7 uipickerview display 3 choices. i.e. 1 above , 1 below selected option. format text smaller default. how achieve this? implementing these delegate methods give picker view 3 rows , let customise font, colour etc... - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview { return 1; } - (uiview *)pickerview:(uipickerview *)pickerview viewforrow:(nsinteger)row forcomponent:(nsinteger)component reusingview:(uiview *)view { uilabel *pickerrowlabel = (uilabel *)view; if (pickerrowlabel == nil) { cgrect frame = //your pickerview frame. height 44 default. pickerrowlabel = [[uilabel alloc] initwithframe:frame]; //format font label pickerrowlabel.backgroundcolor = [uicolor clearcolor]; pickerrowlabel.userinteractionenabled = yes; } pickerrowlabel.text = //your text, array ... ? return pickerrowlabel; } - (nsint...

regex - PHP string with special characters returns wrong answer -

i have these 2 lines in code: $pattern = "/<p class=\"prev [first]*\"><a href=\"\/photography\/photo-of-the-day\/[^\/]+/"; echo $pattern; and output just: / i tried this: $pattern = '/<p class="prev [first]*"><a href="\/photography\/photo-of-the-day\/[^\/]+/'; echo $pattern; but got same output. problem? the problem was seeing output in browser , rendered browser , wasn't able see content. looking @ page source in browser way can see expected output.

jquery - Is Google loader still supported by Google? -

i'd use google loader in project within google loader script, latest version of jquery using version 1.7.1. version came out 3 years ago. https://developers.google.com/loader/ the bottom of page says last updated on "january 8, 2014". still supported? , yes, know how link directly libraries using cdn. have particular use this. thanks. i wanted date version of google loader got original, pretty printed it, added latest versions of jquery , removed cruft (frameworks wasn't using scriptaculous, etc.) , re-minified it. here finished version supports jquery 1.11.0 , 2.1.0 https://github.com/nickfox/custom-google-loader feel free grab if need it. if have questions it, let me know. to use it, install on website , add script this: <script src="custom-google-loader-1.0.0.min.js"></script> and call this: google.load('jquery', '1.11.0'); or maps: google.load('maps', '3', { other_params: ...

android - Unable to start Activity Java RunTime exception -

i launching activity having list view being generated arraylist giving me exception here how launching activity intent myintent = new intent(mainactivity.this, viewinfo.class); mainactivity.this.startactivity(myintent); and here viewinfo activity code public class viewinfo extends activity { arraylist<string> users_list=new arraylist<string>(); string[] lv_arr = {}; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.view_info_activity); readxml(); lv_arr = (string[]) users_list.toarray(); listview list = (listview) findviewbyid(r.id.listview1); list.setadapter(new arrayadapter<string>(viewinfo.this, android.r.layout.simple_list_item_1, lv_arr)); } public void readxml() { -------} } logcat 03-12 12:51:44.456: a/dalvikvm(9202): exception!!! threadid=1: thread exiting uncaught exception (gro...

android : Display image in imageview from another imageview source? -

Image
i have imageview in app, 1 of imageview parent image,the function of parent image display image imageview child if click. if image b1 click source image of imageview b1 show in imageview , imageview b can b1 if clicked, how achieve that? i use code show image in imageview b. private class custominfowindowadapter implements infowindowadapter{ private view view; public custominfowindowadapter() { view = getlayoutinflater().inflate(r.layout.custom_info_window, null); } @override public view getinfocontents(marker marker) { if (mapv2infowindow.this.marker != null && mapv2infowindow.this.marker.isinfowindowshown()) { mapv2infowindow.this.marker.hideinfowindow(); mapv2infowindow.this.marker.showinfowindow(); } return null; } @override public view getinfowindow(final marker marker) { ...

python - Why this statement doesnt work? -

why following list comprehension expression doesnt work? [col1*col2 (col1, col2) in zip(row1, row2) (row1, row2) in zip(m,n)] python says: nameerror: name 'row1' not defined with: m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] n = [[2, 2, 2], [3, 3, 3], [4, 4, 4]] indeed, row1 not defined , row2 . let's simplify you're trying do: for row1, row2 in zip(m, n): col1, col2 in zip(row1, row2): result = col1*col2 print result the above code works fine because first selected row1 , row2 zip(m, n) . , selected col1 , col2 zip(row1, row2) . so if want compress code in 1 single line, will have follow same approach above. code below: [col1*col2 (row1, row2) in zip(m, n) (col1, col2) in zip(row1, row2)]

mysql - Not able to get data by subQueries (multiple subQueries with no direct relation) -

i want data user_login table contains following fields: user_login : id, status, date, user_id in table status can 1 or 2 if status 1 login else logout. i want login , logout both details in 1 row tried query: select login.date, logout.date (select date user_login userid = 1 , status = 1 , date = now()) login, (select date user_login userid = 1 , status = 2 , date = now()) logout. i data when both login , logout has data. want when login has data not logout. please me in solving prob. use left join . this: select login.date, logout.date ( select userid, date user_login userid = 1 , status = 1 , date = now() ) login left join ( select date, userid user_login status = 2 , date = now() ) logout on logout.userid=login.userid or think better solution this: select user_login....

java - Quartz scheduler is running twice -

i have created quartz scheduler running method twice.some of links suggests application context loading twice. unable find out in 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>timesheetmanagementsystems</display-name> <filter> <filter-name>loginfilter</filter-name> <filter-class>com.agranee.timesheet.filter.loginfilter</filter-class> </filter> <filter-mapping> <filter-name>loginfilter</filter-name> ...

python - decorator - Setting a wrapped functions argument names and values -

is possible give wrapped function arg , kwargs names of function wrapping? need because decorators applied later use arg names of underlying function. def wrapper(func): def wrapped(<func args , kwargs names , values>): return func(*args, **kwargs) so if func been passed in foo(x,y=3), returned wrapped function have signature wrapped(x, y=3) instead of usual wrapped(*args, **kwargs). --edit-- just found duplicate of preserving signatures of decorated functions . answers anyway i'm not sure understand question, isn't expect ? >>> def wrapper(func): def wrapped(*args, **kwargs): print args, kwargs return func(*args, **kwargs) return wrapped >>> @wrapper def foo(x, y=3): return x + y >>> foo(3) (3,) {} 6 >>> foo(3, 5) (3, 5) {} 8 >>> foo(3, y=5) (3,) {'y': 5} 8

php - restricting access to zip files from other domains with htaccess -

i running website has number of zip files in single folder. i'd people able access these download links on website (which behind log-in) want make sure can't downloaded typing url of zip files directly. so presume needs done htaccess - , sort of deny rule, exception of domain. correct? right now, file contains (with actual domain replaced "domain"): setenvifnocase referer "^http://domain.com/" locally_linked=1 setenvifnocase referer "^http://domain.com$" locally_linked=1 setenvifnocase referer "^http://domain.com/" locally_linked=1 setenvifnocase referer "^http://domain.com$" locally_linked=1 setenvifnocase referer "^$" locally_linked=1 <filesmatch "\.(zip)$"> order allow,deny allow env=locally_linked </filesmatch> can shed light on why might not working? i'm on shared host (dreamhost) :/ - i'm presuming doesn't make difference. thanks. i have similar usi...

joomla - Change name of component menu -

Image
i'd change name of component menu item. took screenshot, place want different name component. to adding menu item custom component can follow link add custom component menu item. here link: http://docs.joomla.org/j2.5:developing_a_mvc_component/adding_a_menu_type_to_the_site_part in default.xml file <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="com_helloworld_helloworld_view_default_title"> <--the title defined in component language file shown here or can directly put name in title--> <message> <![cdata[com_helloworld_helloworld_view_default_desc]]> </message> </layout> </metadata> hope you.

linux - Running python program after it is terminated via crontab -

i have python webscraping program needs scrapped continuously after program terminated. technique follows crontab -e (settings) * * * * * /home/ahmed/desktop/run.sh run.sh tmp_file=/tmp/i_am_running [ -f $tmp_file ] && exit touch $tmp_file /usr/bin/python /home/ahmed/desktop/python.py rm $tmp_file the bash code must have problem or may command in crontab wrong. program not running. please guide after mark suggestions modified script this #!/bin/bash path=$path:/bin:/usr/bin date +'%h:%m:%s started' >> /home/ahmed/desktop/log.txt tmp_file=/tmp/i_am_running [ -f $tmp_file ] && exit touch $tmp_file date +'%h:%m:%s starting python' >> /home/ahmed/desktop/log.txt /usr/bin/python /home/ahmed/desktop/python.py rm $tmp_file date +'%h:%m:%s ended' >> /home/ahmed/desktop/log.txt the cron command using * * * * * /home/ahmed/desktop/run.sh the log file created this 15:21:01 started 15:21:02 ...

Splitting a dataframe based on rows in R -

i have table in pdf file. converted csv , here csv content. a 23 45 53 34 62 87 94 75 b 120 61 113 41 109 48 90 95 123 113 112 101 i loaded csv r, dataframe not expected. a 23 45 53 34 62 87 94 75 b 120 61 113 41 109 48 90 95 123 113 112 101 how can split rows in dataframe. appreciated. at end, trying acheive like: a1 23 45 53 34 a2 62 87 94 75 b1 120 61 113 41 b2 109 48 90 95 b3 123 113 112 101 thanks lot would work? x <-read.csv("your-file.csv", header=f) h=vector("character",nrow(x)) n=1; p=na (i in 1:nrow(x)) { if (""==x$v1[i]) { n=n+1; z = p} else { n = 1; z = p = x$v1[i] } h[i] = paste0(z,n) } x$v1 <- h probably there better solutions, without for-loop, quickest devise...

Java access files in jar causes java.nio.file.FileSystemNotFoundException -

Image
while trying copy files in jar file temp directory java app, following exception thrown: java.nio.file.filesystemnotfoundexception @ com.sun.nio.zipfs.zipfilesystemprovider.getfilesystem(zipfilesystemprovider.java:171) @ com.sun.nio.zipfs.zipfilesystemprovider.getpath(zipfilesystemprovider.java:157) @ java.nio.file.paths.get(unknown source) @ com.sora.util.walltoggle.pro.webviewpresentation.setuptempfiles(webviewpresentation.java:83) .... and small part of setuptempfiles (with line numbers): 81. uri uri = getclass().getresource("/webviewpresentation").touri(); //prints: uri->jar:file:/c:/users/tom/dropbox/walltogglepro.jar!/webviewpresentation 82. system.out.println("uri->" + uri ); 83. path source = paths.get(uri); the webviewpresentation directory resides in root directory of jar: this problem exits when package app jar, debugging in eclipse has no problems. suspect has bug i'm not sure how correct problem. any hel...

java - JavaFX WebView not working using a untrusted SSL certificate -

i'm developing simple embedded browser using javafx: final webview browser = new webview(); final webengine webengine = browser.getengine(); when use webengine load http website, works fine: webengine.load("http://google.es"); despite this, if try load website untrusted certificate (my own ssl certificate), webengine not work , white screen in browser. is there way (automatically) trust in ssl certificate? finally, solved question. should add code before loading website: // create trust manager not validate certificate chains trustmanager[] trustallcerts = new trustmanager[] { new x509trustmanager() { public java.security.cert.x509certificate[] getacceptedissuers() { return null; } public void checkclienttrusted( java.security.cert.x509certificate[] certs, string authtype) { } public void checkservertrusted( java.security.cert.x509certificate[] certs, ...

ios - custom UICollectionView of UIImages error -

this first time have ever tried make uicollectionview before, have imagearray being read coredata.. of images nsdata reading them uiimage... display uiimage uicollectionview allow user select update preview view. i have added these 3 delegates class. and these delegates have implemented. // add collectionview photocollectionview = [[uicollectionview alloc] initwithframe:cgrectmake(10.0, 50.0, 200.0, 700.0)]; [photocollectionview registerclass:[uicollectionviewcell class] forcellwithreuseidentifier:@"photocell"]; photocollectionview.datasource = self; photocollectionview.delegate = self; [self.view addsubview:photocollectionview]; //.. #pragma mark - collectionview delegates #pragma mark -- uicollectionview datasource - (nsinteger)collectionview:(uicollectionview *)view numberofitemsinsection:(nsinteger)section { return [imagearray count]; } - (nsinteger)numberofsectionsincollectionview: (uicollectionview *)collectionview { return 1; } - ...

css - My dropdown menu hides behind DIV -

i using theme wordpress called velocity. working internally website not online right now. can see live preview of theme here . the problem dropdown menuhided behind div automatically created theme. i've tried using z-index on both elements, did not work. i didn't change code of menu, right must similar live preview on theme. the code assined div (image) one: .title { background-color:#291d1d; width:100%; margin-left:auto; margin-right:auto; background-color:#120404; opacity:0.7; padding:20px; border-radius:5px; opacity:0.7; padding-top:40px !important;} here screenshot: http://i.stack.imgur.com/gb4we.png any ideas on solving this? you can try : position:absolute; z-index:9999999; apply in drop down ul class thanx

c# - MediaElement.play() from within ViewModel -

i'm struggling following issue: i building wp8 application using mvvm patern. have media element on view.xaml , logic control media element (for example, play, stop, pause , volume) in viewmodel.cs. how play sound on media element viewmodel using binding. without destroying purpose , structure of mvvm. (ps: i've seen following post, i'm not sure in how implement it? link post ) you can bind media element directly view model in xaml: <contentcontrol content="{binding mediaelementobject}"/> in viewmodel: private mediaelement _mediaelementobject; public mediaelement mediaelementobject { { return _mediaelementobject; } set { _mediaelementobject = value;raisepropertychanged(); } } and on onnavigatedto override method can create it's new object & can register it's events. mediaelementobject=new mediaelement(); so can thing viewmodel itself.

How to read Chart from Excel sheet using java? -

i have used jxl library read excelsheet , works fine string , numbers want read chart excel sheet. don''t know how read chart using library. can tell me, how do? you can try apache poi . best per experience. able grab information excel2007 charts, few years ago. apache poi should have more , more options now. you may able use xssfchartsheet , xslfchart , ...etc classes. read these well. how chart info excel spreadsheet using apache poi? http://poi.apache.org/spreadsheet/ apache poi limitations

c# - Reference path incorrect after move -

Image
i moved vs 2010 project new machine. the new machine has different directory structure. i have dll need reference , tried deleting in solution explorer adding in. however, when run code error says "directory not found" , pointing old path of dll. i have tried rebuilding solution. how can fix this?

java - How to always show overflow menu (ActionBar) even if phone has hardware menu button? -

following mentioned codes implemented. please suggest me how create "overflow menu" option in action bar if phone have hardware menu button? this current code: mainactivity.java public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.activity_main_actions, menu); return super.oncreateoptionsmenu(menu); } activity_main_actions.xml <?xml version="1.0" encoding ="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <!-- search --> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showasaction="ifroom"/> <!-- email --> <item android:id="@+id/action_email" android:icon="@drawable/ic_action_email" ...

android - Cordova WebView in a Dialog -

can implement cordova webview in customdialog in android? want click button , show me dialog webview. tried in way didn't work. button = (button) findviewbyid(r.id.buttonshowcustomdialog); // add button click listener button.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // custom dialog final dialog dialog = new dialog(context); dialog.setcontentview(r.layout.custom); dialog.settitle("title..."); cwv = (cordovawebview) findviewbyid(r.id.webview); config.init(this); cwv.loadurl("file:///android_asset/www/index.html"); dialog.show(); } }); update2: in fact, extended dialog doesn't event need implement cordovainterface. needs override setcontentview, , that's enough. public class cordovadialog extends dialog { private context currentcontext; public co...

c# - Why does decimal min value not convert to a string? -

the following console app crashes: decimal dec = decimal.minvalue; string str = string.format("{0:d}", dec); console.writeline(str); the error is: format specifier invalid. given i'm formatting decimal decimal, wrong this? from the documentation : this format supported integral types. decimal isn't integral type. the fact format type called "decimal" unfortunate, basically. it's because formats integers in base 10, it's not directly related decimal type . i suspect want f , g or n (or possibly else, based on actual requirements, aren't clear).

How to change cakephp default.ctp layout directory? -

individually able change cakephp default layout using controller.for example have used public function login() { $this->layout="make"; //here have changed layout single action if ($this->request->is('post')) { //some code... } } here have changed layout!! problem layout not default.i want apply layout controller.how can this? in appcontroller public function beforerender() { parent::beforerender(); $this->layout = 'custom'; }

java - Delete file contents using RandomAccessFile -

i have file contains lot of zeros , per requirement zeros in file invalid. using randomaccessfile api locate data in file. there way zeros can removed file using same api. you'll have stream through file , write out content, minus zeros, separate temporary file. can close , delete original , rename new file old file name. that's best alternative particular use case.

ios - Core data save entity issue -

Image
this might primitive question. have list of states belongs different countries. data 1: state - xyz country - data 2 : state - abc country - b data 3: state - ght country - data 2 : state - ase country - b in core data have differnt entities state , country. while saving how put states country object? edit : country state relation assuming data array of dictionary, for (nsdictionary *data in datas) { nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"country" inmanagedobjectcontext:[dbmanager getcurrentcontext]]; [fetchrequest setentity:entity]; nspredicate *predicate = [nspredicate predicatewithformat:@"name = %@", [data valueforkey:@"country"]]; [fetchrequest setpredicate:predicate]; nserror *error; nsarray * fetchedobjects = [managedobjectcontext executefetchrequest:fetchrequest error:...

php - Test that method is called with some parameters, among others -

i'm testing method phpunit , have following scenario: method 'setparameter' called unkown amount of times method 'setparameter' called different kinds of arguments among various arguments method 'setparameter' must called set of arguments. i've tried doing way: $mandatoryparameters = array('param1', 'param2', 'param3'); foreach ($mandatoryparameters $parameter) { $class->expects($this->once()) ->method('setparameter') ->with($parameter); } unfortunately test failed because before method called these parameters called other parameters too. error is: parameter 0 invocation namespace\class::setparameter('random_param', 'random_value') not match expected value. failed asserting 2 strings equal. try using $this->at() method. overwriting mock each time loop. $mandatoryparameters = array('param1', 'param2', 'param3'); $a = 0;...

javascript - Vertical dropdown menu on click -

Image
hello im trying make exact replica of menu right here : http://bmw-spanos.gr/master_en/en/contact_info.asp check picture below: that's code, sorry before. problem dropdown (dotted image) want go down on click , leave big space on image <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <style type="text/css"> body { font-family:arial, helvetica, sans-serif; font-size:0.75em; color:#000;} .dropdown dd, .dropdown dt, .dropdown ul { margin:0px; padding:0px; } .dropdown dd { position:relative; } .dropdown a, .dropdown a:visited { color:#816c5b; text-decoration:none; outline:none;} .dropdown a:hover { color:#5d4617;} .dropdown dt {background:#fff; display:block; padding-right:20px; width:221px;} .dropdown dt span {cursor:pointer; display:block; padding:5px;} .dropdown dd ul { background:#fff none repeat scroll 0 0; color:blue; display:...

c - Debugging signal handlers on Linux -

i've set signal handler sigchld. out of curiosity, i'd try , debug signal handler within gdb. there way that? i tried setting breakpoint on handler , running binary within gdb; dont seem able debug handler instruction instruction. there way go doing that? tried setting hardware breakpoint did not either. code i'm playing around shown below. i'm trying on 64 bit ubuntu machine. #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int val = 0; void handler(int sig) { val=1; } int main(int argc, const char *argv[]) { int pid, status; signal(sigchld, handler); pid = fork(); if ( pid == 0 ) exit(0); wait(&status); printf("returned handler %d\n", val); return 0; } the output printed "returned handler 1" showing sigchld handled process , not gdb; info signal within gdb suggests same. gdb’s handle command ca...

bootstrap sass - ruby on rails tutorial chapter five - styling -

i'm running through michael hartl's tutorial, , having reached styling , layout chapter, seem have got wrong. whereas in tutorial, site links right aligned on single line (like http://railstutorial.org/images/figures/site_with_footer_bootstrap_4_0-full.png ), them right aligned 1 beneath other, , (but not all) other styling elements missing. i've tried updating gems. example code - _header.html.erb <header class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-inner"> <div class="container"> <%= link_to "sample app", '#', id: "logo" %> <nav> <ul class="nav pull-right"> <li><%= link_to "home", '#' %></li> <li><%= link_to "help", '#' %></li> <li><%= link_to "sign in", '#' %></li> </ul> </nav> ...

c# - Local image URL binding to panorama title -

before marking duplicate, please read whole question & efforts. in app first downloading image & saving in local folder not in isolated storage . trying bind local image url ( ms-appdata:///local/53077cab6ed10b742b00000c_cloud.png ) panorama title it's not working. can tell me wrong. given attempts based on past answers. 1: <phone:panorama title="{binding settings.logo.highresolution, converter={staticresource debugconverter}}"> <phone:panorama.titletemplate> <datatemplate> <grid margin="130,80,0,0"> <image height="200"> <image.source> <bitmapimage urisource="{binding converter={staticresource debugconverter}}" /> </image.source> </image> </grid> </datatemplate> </phone:panorama.titletemplate> </phone:panorama...

responsive table with multiple columns in bootstrap -

i trying find answer "nth" amount of columns in table of bootstrap. guys asked before still there has been no solution. so, question how manage responsiveness of columns. let's have 5 colunms own names. | streets' names | victoria | lombard | champs-elysées | chervonoarmeyskaya | (without abbreviation, reader has understand) my solution were: a) playing font-size, making smaller adapt 320px size. succeed 480px (at least readable size). b) removing padding @ ".table thead > tr > th, .table tbody > tr > th," @media (max-width: 480px) more space. c) , last 1 add condition (switching automatically screen size if "320px, 360px" onto "480px, 640px"). i don't know if it's idea? will work correctly on small devices iphone, ipod, samsung ..., nokia ..., sony etc... cross-browser compatibility? if how realize it? here code: <table class="table table-responsive"> <table class="tab...

Layout position change with animation in android -

in application have made chathead i can change position of chathead using windowmanager.updateviewlayout(chathead, params); but not change position animation. how can animation on move i have tried following not work. translateanimation anim = new translateanimation( 0, params.x, 0, params.y); anim.setduration(1000); chathead.startanimation(anim); have checked params.x , params.y value correct or not?

how to handle conflict of two marker in google map using javascript -

i trying create multiple markers on google map using java script, here problem arise when 2 markers have same geo location, if such 2 markers arise other markers occur after marker not display on map, please guide me if has solution. var geocoder; var map; var geocoder = new google.maps.geocoder(); var newlocation =[]; var selectindex =0; var markers =[]; var iconbase = 'https://maps.google.com/mapfiles/kml/shapes/pin.jpg'; var infowindowcontent ; var markerjson = eval('{{$json_data}}'); console.log(markerjson); var markers = []; var i=0; var media; for(var marker in markerjson) { if(markerjson[marker].media_type == '1') { media = '{{$base_url}}add_images/thumb/'+markerjson[marker].image_video_name; } else { media = '{{$base_url}}add_images/thumb/play_back.png'; } markers[i] = ['<div class="info_abstract"><div class="first_show">'+markerjson[marker].title+'</div...

c# - After formatting Month part of the datetime changes to "00" -

i have datetime object in format startdate = 19-03-2014 00:00:00 and trying convert 03/19/2014 . here code that <input type="text" value="<%#convert.todatetime(eval("startdate")).tostring("mm/dd/yyyy") %>"/> but returns string 00-19-2014 i can't understand why happens, can 1 point out going wrong here? mm specifier minutes. prints 00 because minutes of startdate 00 . use mm specifier instead months 01 12 . convert.todatetime(eval("startdate")).tostring("mm/dd/yyyy") for more information, take at; custom date , time format strings datetime has no implicit format, datetime value. can format string . as additional, "/" custom format specifier has special meaning of "replace me current culture's date separator" looks currentculture 's dateseperator - , / replace it. if want output / seperator, can use culture has / dateseperato...

eclipse - Writing Dart build scripts = builder.dart -

this should easy 1 answer. want write dart editor ' build plugin'. the first question documentation or ' how to '? first task consider me deal issue , clean-up old stuff: dart editor equivalent of eclipse clean after idea of how implement build script; want know how find dart build files, caches, etc may need bit of clean-up. in eclipse tell eclipse clean-up, leading me third question. if want add-to or enhance dart editor options menu; can instructions on doing that? currently not possible extend darteditor menues. planned allow add items tools menu far know work on has not yet started (see https://code.google.com/p/dart/issues/detail?id=16921 ). normally don't have clean in dart. far know, pub preferred build tool. pub build writes in build directory. when web built result goes build/web (similar example , test , ...) the build results automatically deleted before new build. therefore should not necessary clean-up. if want...

php - Stop cookie to destroy on browser close -

i implementing stay signed in functionality on log in. when close browser, cookie deleted. how can prevent this? want store cookie permanently. don't delete cookies i don't want destroy php cookies on browser close or on computer shut down. want permanently save cookies i using following code $cookieexpirytime = time() + (10 * 365 * 24 * 60 * 60); setcookie('staysignedinemail',encode_decode($loginqueryres['email'],1),$cookieexpirytime); setcookie('staysignedinpassword',$loginqueryres['password'],$cookieexpirytime); you can set lifetime cookies.. setcookie("testcookie", $value, time()+3600); /* expire in 1 hour */ //<--- increase time limit there the 3600 total number of seconds cookie can exist. can increase limit there. source : php manual edit : the fixed code.. go ! $cookieexpirytime = time() + (10 * 365 * 24 * 60 * 60); setcookie('staysignedinemail',encode_decode($l...

user interface - Android height width of all objest for all screen resolution -

android height width of object screen resolution of android devices : for example: 240px 320px 480px etc.. devices have different resolution. need complete size list object , button , icon, tab-bar, tab-bar-icon, top nav size, etc... any 1 can me ?? thanks first of all: forget px when working views on android. here official documentation describing how support different screen sizes, highly suggest consult document before aiming support different screens. regarding sizes of ui components: here go , detailed description.

java - How do I read a message with an attachment and save the attachment from the content string? -

i using java mail emails gmail attachments, attachment come string in content, how can convert file? thanks this got content : begin 644 myfile.csv m(e-t871u<r(l(e-t87)t(bpb4w1a<g0@9&%t92(l(e-t87)t('1i;64b+")% m;f0b+")%;f0@9&%t92(l(d5n9"!t:6ue(bpb0v%l;&en9r!c=7-t;vue<b(l ................. end object content = message.getcontent(); if (content instanceof string) {//here got attachment system.out.println(content); } else if (content instanceof multipart) { multipart multipart = (multipart) content; procesmultipart(multipart); } looks have single part message uuencoded content. if message formatted content-transfer-encoding header of "uuencode", javamail decode automatically you. looks not. can decode using: inputstream = mimeutility.decode(message.getinputstream(), "uuencode"); then read input stream decoded data, e.g.,...

javascript - Variable does not work with alsoResize: -

i got code, wich works fine, until change '.1' colselect. guess because gets value late , when want use colselect havent registerd. have ideas on how solve this? $(document).ready(function() { var colselect; $('.test2').mousedown( function(){ colselect = '.' + $(this).attr('id'); }); $( '#1' ).resizable( {handles:'e'}, {alsoresize: '.1'} // <- here change '.1' colselect ); }); updated: $(document).ready(function() { var colselect; $('#one').on('mouseover' ,mousedwn); function mousedwn(){ colselect = '.' + $(this).attr('id'); resize(colselect); } $('#one').on('mouseout' ,function(){ $('#one').off('mouseover' ,mousedwn); //prevent memory leaks }); }); function resize(para){ $( '#1' ).resizable( {handles:'e'}, {al...

Generating XML files from SQL Server tables in C# using an XSD -

i'm trying generate xml file dataset across several sql server tables. have xsd definition desired dataset , wondering if it's possible use c#'s data objects point tables, note relationships, extract data , populate xml file going via xsd validate. i'm fine setting tables represent hierarchies in final xml file if helps. many help. you might try following: 1) create c# class files xsd using xsd.exe tool. 2) use orm map database objects c# classes. 3) use xmlserializer class convert c# objects xml document match xsd. see: http://msdn.microsoft.com/en-us/library/943242d1(v=vs.110).aspx

python - pkg_resources: get own distribution? -

i want find distribution of file. file should discovery own distribution. i tried this, not work: import os import pkg_resources dist in pkg_resources.find_distributions(os.path.dirname(__file__)): print dist the file of above installed using pip install -e ... . i not find solution in docs: https://pythonhosted.org/setuptools/pkg_resources.html#distribution-objects the solution should not contain string of package. should generic. the pkg_resources distribution apis need distribution name ; not correlate package name 'current' module operating under. take beautifulsoup project, example. current version uses bs4 package name, distribution name on pypi beautifulsoup4 . a distribution can contain more 1 top-level package or module, too; pkg_resources module part of setuptools distribution example, setuptools package. as such, cannot generalize , use __file__ or __package__ , hope corresponding distribution. if distribution installed...

php - Problems with PDF generation -

i'm developing specific part of website uses sales report user(client) can consult from. generates report ordered date , builds dynamically jquery , php. after enabled options such print , generate pdf. print part done , working i'm having troubles pdf generation part because have give option 2 types of model choosing. first model ok, despite uses several lines on it, still can manage generate pdf using fpdf faster because lines in pattern. mean, it's same, difference number of registers requested. but problem here second model totally variable on columns making hard work fpdf (i have build line per line , unviable) i've tried several classes of converters html pdf like: dompdf, html2pdf, mpdf take long time processing when it's requested big period of time example. so let's jump request: or generate , save in server while user searching specific period of time , when clicks on model 2 (it generated) he'll link folder download directly. any...

javascript - Direct html page access denied -

can 1 tell me how can prevent html page access directly through url want acccess login members page contain image(this page developed on word press) refers html page , page needs access login member only. can 1 suggest javascript code have used following script: if (document.referrer.indexof('flipbook_signup/wp-admin/profile/') == -1) { alert("please login!"); top.location="http://google.com"; } but alerting message in both conditions. other solution? it difficult javascript, there need know or user logged in ... add php code (could different wp) in html page: <?php if ( $user_id ) : // if logged in ?> .... here html code <?php else : // if not logged in go login page $url = 'register'; header("location:$url"); endif; // end if logged in ?> and in .htaccess (allow php code in html): <files *.html> forcetype application/x-httpd-php </files>

xml - Search only childs and specifics grandchildren -

i'm looking expression xapth pass @ 2 level : childs nodes , "specifics grandchildren nodes" : for instance : <nodelevel_1> <nodelevel_1.1 value="a" /> <nodelevel_1.2 value="b" /> <nodelevel_1.3> <nodelevel_1.3.1 value="c" /> </nodelevel_1.3> </nodelevel_1> <nodelevel_2> .... here im trying reach attribute: nodelevel_1.1/@value , nodelevel_1.3.1/@value but without pass nodelevel_1.2/@value . i tried use : descendant::nodelevel1/@value xpath got @value attribute of nodelevel_1.2 , don't want this. is there way manage case xpath ? thanks. you can check tag name not equal nodelevel_1.2 . tested using xmllint : $ cat input.xml <nodelevel_1> <nodelevel_1.1 value="a" /> <nodelevel_1.2 value="b" /> <nodelevel_1.3> <nodelevel_1.3.1 value="c" /> </nodelevel_1.3> </n...

classloader - Java: URLClassLoader keeps loaded classes in Temp dir -

i'm trying load jar file web using urlclassloader , works fine, loaded classes keeps stored in windows temp directory, , can copied deobfuscation until call classloader.close(); in turn cause program classnotfoundexception . can load classes without saving disk? (only memory) solution encrypt jar classes, , write custom classloader decrypt classes, don't find examples. i tried docs or articles on topic, but found nothing :( please tell me whether possible implement , can take material on topic? thanks! you realize access machine you're running code on hold of code custom classloading, right? means decompile class , make write out decrypted classes, rendering whole exercise pointless. true, people won't know how it, possible. my advice obfuscate code, if must so. worrying people getting hold of library won't far, there's little protect being decompiled, unless you're using obfuscating code constructs confuse decompiler (or features ...

javascript - Nodejs create a PNG image with text inside -

i'm trying create new png file serve clients via http (as response type image/png) the new file created concatenating 3 base png files , adding custom text in middle of image. problem is, there no built-in library in nodejs this. spent couple of hours searching , surprise, there no pure js library this. closest thing node-pngjs lacks ability add text. understand text part complicated since it's dependent on os (fonts installed, dlls interface said fonts, etc). there other node modules wrappers around imagemagick ( gm ) , gtk ( canvas ) unfortunately imagemagick 155mb of binaries, , use canvas need compile source, install python , vs 2010 c++ express edition , not work on lastest version of gtk. the best got right write .net assembly , use inside node via edge.js, require both windows os , .net framework on server. again, complicated part here adding text inside image. any suggestion on how working without sh**load of external dependencies? yes corr...

html - Style my server-form properly for all browsers. Without breaking design -

i'm working on integrating template asp.net webforms project. template responsive , bootstrap based, , works fine. problem presents when need wrap <body> content inside <form runat="server"> messes style completely. some examples : the original layout : <body> <section class="vbox"> content.. </section> </body> what need do, in order run aspx site. <body> <form runat="server"> <section class="vbox"> content.. </section> </form> </body> but messes up, if assign vbox <form> <form class="vbox"> works fine in chrome, , ie11 not in firefox, , older ie browsers. the vbox css property contains : .vbox { display: table; border-spacing: 0; position: relative; height: 100%; width: 100%; } is there solution this? can turn off styling form, or make browser ignore style? or need add "fix" ff , older ie b...

php strtotime "2 Sunday ago" -

at date/time of error, is, "3/24/2014 7:08am". normally, running "2 sunday ago" on strtotime() result in going 2 sundays. it'll result in, 3/16. however, landing on 3/23, last sunday. also, running "1 sunday ago" result in future date of 3/30 , not 3/23. i'm assuming kind of settings issue don't know how debug. great. thanks! $start = date( "y-m-d 11:00:00", strtotime("2 sunday ago")); $end = date( "y-m-d 11:00:00", strtotime("last sunday")); echo $start . ' - ' . $end; try $start = date( "y-m-d 11:00:00", strtotime("-2 weeks sunday")); $end = date( "y-m-d 11:00:00", strtotime("-1 weeks sunday")); echo $start . ' - ' . $end;

django - Meteor: About Password Encryption -

i'm thinking migrating 1 of django application meteor. there 1 question i'm trying answer before doing this: how meteor encrypt password? (with account-password package?) in case, used default django password encryption: django provides flexible password storage system , uses pbkdf2 default. password attribute of user object string in format: <algorithm>$<iterations>$<salt>$<hash> so passwords stored this: pbkdf2_sha256$12000$z0rof3eqy1p2$wezcf334ytybm12cpcdlnzlrkwykaqklk4wht5jxgwe= is impossible make meteor adopt same scheme current users can continue use application without resetting password? accounts-password uses srp authenticate users. mentioned in blog post meteor 0.5: support secure remote password protocol. developed @ stanford, srp lets user securely log in server without ever sending server unencrypted password. kind of high-profile security breaches @ linkedin , pandora earlier year impossible srp. instead of a...

R shiny, load data based on input -

i have data each day in server side , want load data based on date input on server side, have this: dateinput("date","enter date:",value = "2014-01-13")) on ui side, library(shiny) library(googlevis) library(rpart.plot) load("data_2014_01_13_new.rdata") #seg , fit data in file shinyserver(function(input, output) { output$values <- rendergvis({ gvistable(seg[seg$rate >= input$test[1] & seg$rate <= input$test[2],]) }) output$plot <- renderplot({ prp(fit,extra=t) }) }) i want put load server function , can load different data date changes. thanks! read these pages in tutorial: http://rstudio.github.io/shiny/tutorial/#scoping http://rstudio.github.io/shiny/tutorial/#reactivity you can put load call inside of shinyserver function in reactive can reference dataset dynamically, , each session can have different data loaded simultaneously. so add function shinyserver functi...

tsql - FullText Index - Searching values from another table -

is possible, in sql server 2008, using full text index syntax, run query such one? select * table_to_search s, table_with_strings_to_search ss contains(s.whole_name,ss.first_name) or contains(s.whole_name,ss.last_name) i need search first_name in table table_to_search, column whole_name has full text index on it. doesn't seem valid query though... there workaround using full text index search? later edit: here business case: each night downloading several websites information "blacklisted" individuals , insert table in format: wholename, lastname, firstname, middlename . data chaotic wholename not contain either last, first or middle name or wholename null while other 3 fields have values, or every of these 4 fields null , on. also, data may repeat 1 blacklisted individual may come 2+ of these websites. need compare data, chaotic is, against our customer data based on our customer's first , last name , give matching score (rank) against files downl...