Posts

Showing posts from May, 2015

c# - Auto login for two sites hosted on IIS at two diffrent ports -

i have deployed 2 instance of same website on iis on 2 different ports, 1 testing , other production. when logged in production site , after going logging in testing site (without logging off production site), testing site use same session , not ask me username password. have same users in both sites. can suggest me how can tackle problem.? use in private/incognito browsing testing. or use different domains you can use different web browser. internet explorer testing site , firefox production

php - Prevent htaccess from affecting ajax requests -

i'm trying modify htaccess request, loads files php, removes .php extension. noticed affects ajax requests, cannot post data them. add htaccess prevent specific php(data.php) not being affected extension removal of htaccess? the code of htaccess: rewriteengine on # browser requests php rewritecond %{the_request} ^[a-z]{3,9}\ /([^\ ]+)\.php rewriterule ^/?(.*)\.php$ /$1 [l,r=301] # check see if request php file: rewritecond %{request_filename}\.php -f rewriterule ^/?(.*)$ /$1.php [l] may sending data on post check in htaccess if url data ignore rewrite or use post url in ajax without php extension url/data url: data, //instaed of data.php

asp.net - MVC5: Login form in Layout page -

i'm quite new mvc please me understand how following. know when create new mvc5 project wants use login page separate page when want log in (i.e. _loginpartial view actionlink login controller returns view). what i'm trying accomplish have login form throughout whole site (when user not logged in yet) did following changes: _layout view: @html.partial("_loginpartial") _loginpartial view: using (html.beginform("login", "account", new { returnurl = request.querystring["returlurl"] }, formmethod.post, new { @class = "navbar-form navbar-right form-inline", role = "form" })) { @html.antiforgerytoken() <div class="form-group"> @html.textboxfor(m => m.username, new { @class = "form-control input-sm", placeholder = "username" }) @html.passwordfor(m => m.password, new { @class = "form-control input-sm", placeholder = "password" }...

php - How to make my opencart site as password protected -

this question has answer here: opencart force login 4 answers my opencart website under construction.i want show coming soon(construction) page public , make opencart index.php , other sub pages of site visible password protected users.how can this? how possible show construction index.html page public , other index.php(opencart root folder page)and other pages private. password-protect put .htaccess in root of site 1.generate htpasswd here: http://www.htaccesstools.com/htpasswd-generator/ 2.then put in .htacces: authtype basic authname "password protected area" authuserfile /path/to/.htpasswd require valid-user (you need change “/path/to/.htpasswd” full path .htpasswd.)

c# - How to access HttpRuntime.Cache in another project in the same solution -

i have 2 projects [main project, data access project] in 1 solution [ ldm ]. main project contains pages, scripts, images, etc. data access project contains data base operations. i need access httpruntime.cache in data access project. how can that?? pass httpruntime.cache dal class want access. can pass parameter constructor of method. void somemethodindal(httpruntime.cache httpruntimecache) { } it better pass required information httpruntime.cache dal instead of passing httpruntime.cache

asp.net mvc 4 - Change Default printer not working on IIS -

i trying shift default printer while printing application.this code working on development not working when application hosted on iis 7. managementobjectcollection objmanagementcoll; // class used invoke query specified management collection managementobjectsearcher objmanagementsearch = new managementobjectsearcher("select * win32_printer"); // invokes specified query , returns resulting collection objmanagementcoll = objmanagementsearch.get(); foreach (managementobject objmanage in objmanagementcoll) { if (objmanage["name"].tostring() == "epson bill") // compares name of printers { objmanage.invokemethod("setdefaultprinter", null); // invoke [setdefaultprinter] method break; } }

c - difference between return 1, return 0 and return -1 and exit? -

for example consider following code int main(int argc,char *argv[]) { int *p,*q; p = (int *)malloc(sizeof(int)*10); q = (int *)malloc(sizeof(int)*10); if (p == 0) { printf("error: out of memory\n"); return 1; } if (q == 0) { printf("error: out of memory\n"); exit(0); } return 0; } what return 0,return 1,exit(0) in above program.. exit(0) exit total program , control comes out of loop happens in case of return 0,return 1,return -1. return main() equivalent exit the program terminates execution exit status set value passed return or exit return in inner function (not main ) terminate execution of specific function returning given result calling function. exit anywhere on code terminate execution immediately. status 0 means program succeeded. status different 0 means program exited due error or anomaly. if exit status different 0 you're supposed print error message stderr instead of ...

javascript - D3js data selection -

i trying use fiddle filter out data following thread d3 js data filtering my fiddle fiddle i trying this var svg = d3.select('#reportcontent_reportcontent svg') .data(data).filter(function (v) { return data.product === "lending"; }) .attr("class", "bullet") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")") .call(chart); my data looks var data = [{ "monthyearshortname": "2014-09-13t00:00:00", "product": "fee based", "actual": [1002], "forecast": [1200], "target": [1400] }, { "monthyearshortname": "2014-09-13t00:00:00", "product": "lending",...

python - How to add a new signal handler to gunicorn? -

i need way set number of workers gunicorn master process. so i'm thinking of overriding arbiter , adding new signal handler, read new number of workers file. which signal proper 1 use purpose? from http://gunicorn-docs.readthedocs.org/en/latest/signals.html the signal hup can used reload gunicorn configuration on fly sending hup signal reload configuration, start new worker processes new configuration , gracefully shutdown older workers. you need set workers variable in configuration file appropriate value before signal master process.

c# - Fire RadioButton checked routed event programmatically -

is there anyway raise radiobutton checked routed event code, in order handle in parent control? this situation: var radio = new radiobutton(); radio.ischecked = true; radio.raiseevent(new routedeventargs(radiobutton.checkedevent)); the third line not work. googling, found way based on radiobuttonautomationpeer , had not found way make work. does have hint? thanks in advance. var radio = new radiobutton(); radio.checkedchanged +=new eventhandler(radio_checkedchanged); radio.ischecked = true; private void radio_checkedchanged(object sender, eventargs e) { if (radio.checked) { messagebox.show("true"); } else { messagebox.show("false"); } }

Using composer.json in Symfony 2.0 -

i have symfony 2.0 project; however, i'd switch deps composer.json without going 2.1+. has done this, or there prevent working? here page shows how switch composer symfony 2.0: http://knplabs.com/fr/blog/symfony2-with-composer

How To Set Default Home Page in Node.Js? -

here code able see file content on refresh, not type localhost , port. // include http module, var http = require("http"), // , url module, helpful in parsing request parameters. url = require("url"); var eventemitter = require('events').eventemitter; var fs = require('fs'); var emitter = new eventemitter; var fdata=""; http.createserver(function (request, response) { if(request.url=="/") { response.writehead(200, {'content-type': 'text/html'}); fs.readfile("xhtmljs.xhtml","utf-8" ,function (err, data){ fdata=data; }); response.write(fdata+"<br/>"+request.url); response.end(); } }).listen(1234);

Why does my Java program work in console and not in Eclipse? -

i wanted know why java program work in console when : javac main.java java main ...and not in eclipse, have error : exception in thread "main" java.lang.nullpointerexception @ codepin.main.main(main.java:48) --> char passwordarray[] = console.readpassword("enter pin: "); here's code : package codepin; import java.io.*; import java.util.*; public class main { static public boolean readpinsdata(file datafile, arraylist<integer> data) { boolean err = false; try { scanner scanner = new scanner(datafile); string line; while (scanner.hasnext()) { line = scanner.nextline(); try { data.add(integer.parseint(line)); } catch (numberformatexception e) { e.printstacktrace(); err = true; } } scanner.close(); } catch (fi...

Fancybox showing on click -

i got job offer , site i'm working on uses fancybox when click on photo gallery nothing shows up. url shown redirection nothing happening. site caprice.gr. @renderbody() <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> !window.jquery && document.write(unescape('%3cscript src="/scripts/libs/jquery-1.7.1.min.js"%3e%3c/script%3e'))</script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script> !window.jquery.ui && document.write(unescape('%3cscript src="/scripts/libs/jquery-ui.min.js"%3e%3c/script%3e'))</script> <script src="/scripts/libs/jquery.fancybox.pack.js" type="text/javascript"></script> <script src="/scripts/jquery.mousewheel.js" type="text/javascript"><...

ios - Admobs ad only shows on the simulator -

i've having issues creating admob ad shown on simulator , device. @ moment i't show on simulator. here ad say: publisher test ad. i've searched sometime, cant find solution why wont show on device well? - (void)viewdidload { self.bannerview = [[gadbannerview alloc] initwithframe:cgrectmake(0.0, self.view.frame.size.height-50, gad_size_320x50.width, gad_size_320x50.height)]; self.bannerview.adunitid = myadunitid; self.bannerview.delegate = self; [self.bannerview setrootviewcontroller:self]; [self.view addsubview:self.bannerview]; [self.bannerview loadrequest:[self createrequest]]; [self.navigationcontroller.tabbarcontroller.tabbar sethidden:yes]; } -(gadrequest *)createrequest { gadrequest *request = [gadrequest request]; request.testdevices = [nsarray arraywithobjects:gad_simulator_id, nil]; return request; } -(void)adviewdidreceivead:(gadbannerview *)adview { nslog(@"ad received"); [uiview animatewithduration:1.0 animat...

How to calculate the texture loading time in opengl es? -

for calculating texture loading time, enough measure execution time of glteximage2d()? is there other methods calculate texture loading time in opengl? glteximage2d synchronous (mostly... depends on driver , gpu, perspective is) function, meaning can assume set , ready go when returns. therefore, should have measure execution time of glteximage2d figure out loading time.

dart - Is it allowed to use any type for a @published attribute in a polymer element? -

i have custom polymer element : @customtag('my-game') class gameelement extends polymerelement { @published gamestate state; // ..... } and use : <my-game state="{{ state }}" /> as attributes property on element map<string, string> allowed use type @published attributes? yes works. use assign model classes parent child elements. do have issues it? an issue is, dom doesn't see attribute being added. in unit test tried use mutationobserver notified when attribut set, works when primitive value assigned. see https://code.google.com/p/dart/issues/detail?id=17472

ssrs 2008 - Can We directly Run the Deployed Reports in ReportServer using RS.EXE or using Report Service Script file? -

using rs.exe utility, deployed reports in reportserver successfully. i can run deployed reports in server manually. is there way run deployed reports using rs.exe utility or using rss file? rs.exe can used render ssrs report following in blog post http://sqlblog.com/blogs/roman_rehak/archive/2009/06/12/ssrs-report-rendering-from-command-prompt.aspx

css - HTML Table appears distorted in Outlook Email -

i've created email template , email gets sent outlook 2010 application(oracle ucm).issue workflow history table (code below) gets distorted , moves left when checked on mobile device entire email looks when seen on desktop. <table border="1"cellspacing=0 cellpadding=0 width="95%" align="center"> <tr> <td align="center" colspan="2" style='width:10.0%; background:#a5cef7'> <p><span style='font-size:18.0pt;font-family:"calibri","sans-serif";color:red'>dms</span><span style='font-size:15.0pt;font-family:"calibri","sans-serif";color:red'> - <$xsubdoctype$> document <$xclientname$> pid: <$xproject_id$> in workflow &nbsp;</span></p> </td> </tr> <tr> <td align="left" colspan="2" style='width:10.0%;font-family:...

Multiple versions of JQuery on the same page not working -

actually looking clientside checkbox control + scrollable gridview asp.net project. got article http://gridviewscroll.aspcity.idv.tw/demo/form.aspx#checkboxclient . have posted code given below which, have taken above website. here fixed header scrollable function working checkbox client-side not working. can 1 me? <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> <script type="text/javascript" src="../scripts/gridviewscroll.min.js"></script> <script type="text/javascript"> $(document).ready(function () { gridviewscroll(); }); function gridviewscroll() { $('#<%=gridview1.clientid%>').gridviewscroll({ width: 660, height: 200, freezesize: 3 }); var cbselecteds1 = "cbselecteds1_...

ruby on rails - Error while installing rvm packages -

when trying install 'rvm install 1.9.2' getting following error. ruby-1.9.2-p320 - #removing src/ruby-1.9.2-p320.. searching binary rubies, might take time. no binary rubies available for: ubuntu/12.04/i386/ruby-1.9.2-p320. not possible build movable binaries rubies 1.8-1.9.2, can system only. continuing compilation. please read 'rvm mount' more information on binary rubies. checking requirements ubuntu. requirements installation successful. installing ruby source to: /home/lister/.rvm/rubies/ruby-1.9.2-p320, may take while depending on cpu(s)... ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, may take while depending on connection... ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 /home/lister/.rvm/src/ruby-1.9.2-p320... ruby-1.9.2-p320 - #applying patch /home/lister/.rvm/patches/ruby/gh-488.patch. ruby-1.9.2-p320 - #configuring..................... error running './configure --prefix=/home/lister/.rvm/rubies/ruby-1.9.2-p320 --disable- inst...

c# 4.0 - Unable to Decode HTML in WCF Service -

public string returnstring() { string s = ""; s = httputility.somevaliable; return s; } somevaliable = <dependent><dependentid> but getting string s value &ltdependent&gt&ltdependentid&gt note: have not applied ; after &lt converted < might string not compatible html format. please suggest me datatype have use return htmldecode format. any quick please see this question. the data type looking xelement or xmlelement return type. another easy way can use string return type use system.net.webutility htmlencode before returning in service , htmldecode in client.

c# - Filter HTML Json based grid by Dropdown -

i new @ json, have rendered html templete grid using jason data, have bind drop downs using json , filter grid based on these dropdown values. confuse how can generate joson again each dropdown , after filtering, using asp.net c# code @ end please give me easy , right path. save json in hidden textbox. , every time @ dropdown change event take textbox. is hidden, won't visible also. hope, helps :)

objective c - CCSprite disappears for unknown reason -

-(void)touchbegan:(uitouch*)touch withevent:(uievent*)event { cgpoint touchpoint = [touch locationinnode:self]; [_gameball setposition:cgpointmake(touchpoint.x,self.gameball.position.y)]; } after touch _gameball sprite not visible anymore, reason why happens?i logged , isvisible gameball true , touchpoint within content size of ccnode. #import "gamescene.h" @interface gamescene() @property (nonatomic,strong) ccsprite* gameball; @end @implementation gamescene @synthesize gameball = _gameball; +(gamescene*)gameinstance { return [[self alloc]init]; } -(id)init { self = [super init]; if (self) { //implement //user interaction self.userinteractionenabled = yes; //create ball _gameball = [ccsprite spritewithimagenamed:@"small_blue_ball.png"]; _gameball.position = ccp(0.5f,0.1f); _gameball.positiontype = ccpositiontypenormalized; [self addchild:_gameball]; } retur...

javascript - Auto complete not working it is throwing an error iElement.autocomplete is not a function -

i trying build auto complete on search text box using angularjs. getting error ielement.autocomplete not function. code <body ng-controller='friendcontroller'> <form ng-submit="addfriend()"> <input type="email" auto-complete ui-items="fbfriends" ng-model="friend" autofocus /> </form> <ul ng-repeat="friend in friends"> <li> {{friend.text}} </li> </ul> <script> var addfriendappmodule = angular.module('addfriendapp', []); addfriendappmodule.controller('friendcontroller', function($scope) { var friendarr = []; $scope.fbfriends = [ { value: "manu", email: "sept@gmail.com" }, { value: "manu123", email: "sept123@gmail.com" } ]; $scope.friends = friendarr; $scope.friend = ''; ...

ember.js - ember app within another ember app -

we writing ember app provides basic infrastructure app building. users can use app , build there own ember app utilizing infrastructure provided app. app provides basic utility services authorization, authentication, layout, templates, reusable ui components, consistent , feel, scaffolding, dependency stack etc. question is, how can users build there own ember app utilizing these services , include within parent app, nested app, parent app provides common services. possible include 1 ember app within ember app? child app content should shown in parent content window retaining navigation links , layout. there can situation multiple apps included under parent app , each of these child app can accessed using router in parent app, example, if child1 , child2 apps included under parent app, navigating "/childroute1" of parent should open child1 in parent content window , navigating "childroute2" should open child2 in content window. possible using ember? if not h...

ios - CGContextRef and even-odd fill rule -

i need paint series of path in cgcontext block. these path drawn user can not determine direction. use following code snippet draw path: cgcontextsavegstate(context); uibezierpath *fillpath = [ uibezierpath bezierpath ]; ( uibezierpath *path in arrayofpaths ) { [ fillpath appendpath:path ]; } cgcontextaddpath(context, fillpath.cgpath ); cgcontextsetfillcolorwithcolor( context, [[uicolor greencolor ] colorwithalphacomponent:0.3 ].cgcolor ); cgcontextfillpath(context); however if paths created in reverse directions resulting drawing seems produce drawing overlapping section knocked out, equivalent of setting even-odd rule yes. any suggestions? you surround lines fill each path cgcontextsavegstate / cgcontextrestoregstate instructions. way start "from scratch", ie. clean path stack, on each filling. edit: i've got nice wrapping function this: void cgcontextblock(cgcontextref ctx, void (^block)()) { cgcontextsavegstate(ctx); block(); ...

android - How to get the height and width of ImageView? -

i trying height & width of imageview bot it's returning 0 public class fullscreenimage extends fragmentactivity { imageview full_view; int width; int height; @override protected void oncreate(bundle arg0) { super.oncreate(arg0); setcontentview(r.layout.full_screen); full_view = (imageview)findviewbyid(r.id.full_view); bundle bundle=getintent().getextras(); byte[] image= bundle.getbytearray("image"); width = full_view.getwidth(); height = full_view.getheight(); bitmap theimage = bitmapfactory.decodebytearray(image, 0, image.length); bitmap resized = bitmap.createscaledbitmap(theimage,width , height, true); full_view.setimagebitmap(resized); } } please me, how can it? a common mistake made new android developers use width , height of view inside constructor. when view’s constructor called, android doesn't know yet ho...

Setting the brightness in windows phone 8 -

i need screen brightness , set brightness of windows phone in application automatically read screen brightness phone , set brightness of screen according time during night time brightness should less 50%. how can it? this not possible current sdk.

python - Can't use LFW dataset in sklearn -

it seems fetch_lfw_people function don't work, can't understand why. here test code: in [1]: import numpy np in [2]: sklearn import datasets in [3]: lfw= datasets.fetch_lfw_people() ioerror traceback (most recent call last) <ipython-input-3-1f0795d3f6a9> in <module>() ----> 1 lfw= datasets.fetch_lfw_people() c:\python27\lib\site-packages\sklearn\datasets\lfw.pyc in fetch_lfw_people(data_ home, funneled, resize, min_faces_per_person, color, slice_, download_if_missing ) 270 faces, target, target_names = load_func( 271 data_folder_path, resize=resize, --> 272 min_faces_per_person=min_faces_per_person, color=color, slice_=s lice_) 273 274 # pack results bunch instance c:\python27\lib\site-packages\sklearn\externals\joblib\memory.pyc in __call__(se lf, *args, **kwargs) 169 'directory %s' 170 % (name, argument_hash...

c# - Windows 8 Phone and Windows Azure Management Libraries Error -

i newbie in windows phone 8 , windows azure development. i have started work on windows azure management portal on windows 8 phone. i have google lot , found helpful resource : http://www.bradygaster.com/post/writing-a-windows-phone-8-application-that-uses-the-windows-azure-management-libraries-for-on-the-go-cloud-management after importing project in vs2012 , configured according tutorial have found error when selecting subscription id. the full exception trace below: $exception {microsoft.windowsazure.cloudexception: authenticationfailed: security token exception occured received jwt token. @ microsoft.windowsazure.management.websites.webspaceoperations.<listasync>d__32.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.tas...

java - How to resolve issue with Maven dependencies "Failed to execute goal on project" -

Image
i have got following structure in eclipse of maven projects: mainmavenproject ---myproject ---mproject-client ---mproject-xyz ---mproject-web ... in eclipse, use jboss 7.1 run mproject-web: now, want run jetty project. directory /mainmavenproject/myproject run command mvn -djetty:port=8081 jetty:run it has been finished error: [error] failed execute goal on project myproject: not resolve dependencies project ***.*****.myproject:myproject:war:0.0.1-snapshot: following artifacts not resolved: ***.*****.********:myproject-client:jar:1.0. 1-snapshot, com.*****.********:mproject-xyz:jar:1.0.1-snapshot: failure find ***.*****.********:myproject-client:jar:1.0.1-snapshot in https://*********.*****.com/nexus/content/groups/development cached in local repository, resolutio n not reattempted until update interval of *****-central has elapsed or updates forced -> [help 1] [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x ...

emf - how to load models (ecores) which are referenced in my model programmatically -

i'm working on tool transform model metamodel programmatically, , figure out problem: when load/save model 'a' (xmi) contain eclass supertype referencing others classifier in other ecores 'b', 'c' ( separated ecores files), got null each cross references. how load ecore if model contain cross reference ? use nsuri ?

android - HorizontalScrollView inside ScrollView - disable vertical scroll when horizontal scroll is in progress -

i have parent scrollview, holds horizontalscrollview 1 of it's child views. works perfectly, when triggering vertical scroll, horizontal scroll stops, or jittering. on top of it, there bug in ice cream sandwich not handle vertical movement on horizontalscrollview well, if inside scrollview, content smaller screen (in situation, there no vertical scrolling). jelly bean android handles properly, icecreamsandwich reason detects vertical movement, , stops horizontal scrolling. how go making parent scrollview disable it's vertical scroll, when horizontal scroll being triggered? when scrolling horizontally horizontalscrollview, , while doing it, finger wonders bit on y axis, not want parent scrollview capture vertical motion. any that? just try this horizontalscrollview hv = (horizontalscrollview)findviewbyid(r.id.myhsview); // horizontalscrollview inside scrollview hv.setontouchlistener(new listview.ontouchlistener() { @override public...

jquery - I need to open colorbox on a jqvmap region click -

i need open colorbox on region click on jqvmap http://jqvmap.com/ jquery('#wine-map').vectormap({ map: 'world_en', backgroundcolor: '#000', color: '#ffffff', hoveropacity: 0.7, selectedcolor: '#666666', enablezoom: true, scalecolors: ['#ffffff', '#eeeeee'], normalizefunction: 'polynomial', onregionclick: function(element, code, region){ if (code == 'us') { var message = "wines usa" alert(message); } } }); so instead of alert, require inline content html show via colorbox.. http://www.jacklmoore.com/colorbox/example1/ i have tried jquery('#wine-map').vectormap({ map: 'world_en', backgroundcolor: '#000', color: '#ffffff', hoveropacity: 0.7, selectedcolor: '#666666', ...

ios - Handle UIButton click in a custom cell that is loaded in sections (where number of section is not defined. ie: taken dynamically) -

i having view controller want load sections & count number of section taken dynamically, ie: retrieved database. now, in each section having 8 rows row 2 8 loaded 5 buttons each. want whenever button on cell pressed particular value manipulated & displayed on extreme right of cell. same thing should happen sections. . problem when click particular button on cell of 1 section; other button on cells of other sections selected well. . please help.. you can section index cell index @ button tap method using bellow code:- -(ibaction)actionbttontap:(uibutton*)sender { cgpoint touchpoint = [sender convertpoint:cgpointzero toview:yourtableview]; nsindexpath *indexpath = [tblhistoryyear indexpathforrowatpoint:touchpoint]; nsstring *strsection=[nsstring stringwithformat:@"%d",indexpath.section]; nsstring *strrow=[nsstring stringwithformat:@"%d",indexpath.row]; nslog(@"tag %d indexpath %d section %d",sender.tag,indexpa...

pdf - The method getInstance(byte[]) is undefined for the type Document.. Android -

i generating pdf using droidtext liberary i have following code public void createpdf() { document doc = new document(); try { string path = environment.getexternalstoragedirectory().getabsolutepath() + "/droidtext"; file dir = new file(path); if(!dir.exists()){ system.out.println("directory not exists"); dir.mkdirs(); }else{ system.out.println("directory exirsts"); } system.out.println("path="+path); log.d("pdfcreator", "pdf path: " + path); file file = new file(dir, "sample.pdf"); fileoutputstream fout = new fileoutputstream(file); pdfwriter.getinstance(doc, fout); //open document doc.open(); paragraph p1 = new paragraph("hi! generating first pdf using droidtext...

java - LazyInitialization Exception stack trace getting printed even if it is handled in a catch block -

i have code gives me lazyinitialization exception. have handled on demand i.e. catch block gets executed if exception thrown , necessary action taken. though have handled exception stack trace exception getting printed control enters catch block, on console not expected. (since java exception if handled not printed in log file.) below try catch block: try{ if (tempuser != null) { list<fieldareas> fieldareaslist = tempuser.getfieldareaslist(); (fieldareas fieldarea : fieldareaslist) { fieldarea.getid(); break; } } } catch(lazyinitializationexception exception) { //this catch block written handle lazy initialization exception fetchdetailsformerchant(merchant,defaultpricinginput); tempuser = user.findbyprimarykey(tempuser.getid()); list<fieldareas> fieldareaslist = tempuser.getfieldareaslist(); (fieldareas fieldarea : fieldareaslist) { fieldarea.getid(); break; } }

java - What is the reason for this finally clause containing close() calls -

i'm studying online java course, introduction programming using java . in chapter on i/o code below introduced following statement: by way, @ end of program, you'll find our first useful example of clause in try statement. when computer executes try statement, commands in clause guaranteed executed, no matter what. the program @ end of section 11.2.1 , simple program reads numbers in file , writes them in reverse order. the relevant code in main method (data reader , result writer): try { // read numbers input file, adding them arraylist. while ( data.eof() == false ) { // read until end-of-file. double inputnumber = data.getlndouble(); numbers.add( inputnumber ); } // output numbers in reverse order. (int = numbers.size()-1; >= 0; i--) result.println(numbers.get(i)); system.out.println("done!"); } catch (ioexception e) { // problem reading data input file. system....

javascript - Webpage on a loop - How to add a countdown timer -

so have interactive touchscreen want show off website on loop. i've made code scroll page page on 30 second delay. because it's touch screen, want people able engage it, if click on it, opens can manually scroll (i can make arrows or whatever that) want countdown timer goes loop if it's not touched within lets 2 minutes. does have clue how add bit of code in that? i'm not @ sure start thank help. rich

random - Randomizing Numbers without repeating it in C# -

i want randomize 9 numbers random number in each trail different of number in previous attempt... here code random num1random = new random(); label1.text = num1random.next(1, 9).tostring(); label2.text = num1random.next(1, 9).tostring(); label3.text = num1random.next(1, 9).tostring(); label4.text = num1random.next(1, 9).tostring(); label5.text = num1random.next(1, 9).tostring(); label6.text = num1random.next(1, 9).tostring(); label7.text = num1random.next(1, 9).tostring(); label8.text = num1random.next(1, 9).tostring(); label9.text = num1random.next(1, 9).tostring(); you don't want 9 random numbers, really want numbers 1 9 in random order: random r = new random(); var numbers = enumerable.range(1,9) // create sequence of integers 1 through 9 .orderby(x => r.next()) // randomize order .toarray(); // turn sequence array. // assign numbers labels label1.text = numbers[0]; ...

php - How to check if two fields have same value using msql? -

i having problem using mysql statement in want check whether fan followed , fan following having same value user , username, here code : <? $selectfan = mysql_query("select * amityfans"); $fanrow = mysql_fetch_assoc($selectfan); $fan_following = $fanrow['fan_following']; $fan_followed = $fanrow['fan_followed']; if ($fan_following == "$user" && $fan_followed=="$username") { $addasfan = '<input type="submit" class="button" name="removefriend" value="remove fan">'; } else { $addasfan = '<input type="submit" class="button" name="addfriend" value="add me fan">'; } echo $addasfan; ?> but if 'user' , 'username' have same values not displaying remove fan button. fyi $user username of logged in user , $username username of profile seeing. edit : i having problem in deleting particular row of fan havi...

c++ - Windows Socket unable to bind on VPN IP address -

i trying bind particular ip on vpn network , able ping it, connect , able telnet on particular port windows mfc program gives error code 10049 , not able go further in debugging problem appreciated, running on visual studio 2012 win 7 , remote client running on linux variant. this part of code getting error ip address configurable hardcoding debug. cstardoc *p_doc = (cstardoc*) lpparam; bool fflag = true; const int max_msglen = max(sizeof(disp_info_t ), sizeof(reason_string_t )); char buffer[max_msglen]; disp_info_t *p_disp_info_buffer = (disp_info_t *) buffer; disp_info_t disp_info_combined; //receiving combined butter disp_info_t_1 *p_disp_info_buffer1; //receiving buffer pointer dispinfo1 disp_info_t_2 *p_disp_info_buffer2; //receiving buffer pointer dispinfo2 int msgreceived = 0; // initially, 0. // same msgnumber, when program receives first portion of buffer, set 1...

javascript - Google Apps Script: set note from custom function -

i'm struggling following issue: have spreadsheet responsible tracking stock market investments. calls external service csv current prices. so, there function customfunction() calls urlfetchapp , returns current price of item. i'd add note cell has been called from, containing current datetime. this: function customfunction() { //get price csv var url = "http://sth.com"; var csv = urlfetchapp.fetch(url); var result = utilities.parsecsv(csv); var currentvalue = parsefloat(result[1][6]); //set note spreadsheetapp.getactivesheet().getactivecell().setnote("hey, i'm note datetime"); //return value can set cell value return currentvalue; } i calling function cell e21 (value =customfunction() ). , works planned, except line supposed set note. sure correct cell (tested returning a1notation value). error: error: not have permission call setnote does know if it's possible set note cell calls custom function function? or may...

logstash - Join query in ElasticSearch -

is there way (query) join 2 jsons below in elasticsearch { product_id: "1111", price: "23.56", stock: "100" } { product_id: "1111", category: "iphone case", manufacturer: "belkin" } above 2 jsons processed (input) under 2 different types in logstash, indexes available in different 'type' filed in elasticsearch. what want join 2 jsons on product_id field. it depends intend when join. elasticsearch not regular database supports join between tables. text search engine manages documents within indexes. on other hand can search within same index on multiple types using fields common every type. for example taking data can create index 2 types , data follows: curl -xpost localhost:9200/product -d '{ "settings" : { "number_of_shards" : 5 } }' curl -xpost localhost:9200/product/type1/_mapping -d '{ "type1" : { "propert...

xmppframework - send custom xmpp IQ in ios -

i want send following iq open fire server: <iq type="get"> <regdata xmlns="abc"> <username>cooper</username> <emailid>cooper@hotmail.com</emailid> <password>cooperpass</password> <dob>11-12-1979</dob> <gender>male</gender> </regdata> </iq> what shall command in xcode? i'm using below mentioned script not working. nsxmlelement *regdata = [nsxmlelement elementwithname:@"regdata" xmlns:@"abc"]; nsxmlelement *iq = [nsxmlelement elementwithname:@"iq"]; xmppjid *myjid = self.xmppstream.myjid; [iq addattributewithname:@"type" stringvalue:@"get"]; [iq addattributewithname:@"from" stringvalue:myjid.description]; [iq addattributewithname:@"to" stringvalue:myjid.domain]; [iq addattributewithname:@"username" stringvalue:txtname.text]; [iq addattributewithname:@"emailid" stringvalue:txtemai...

java - Detect when expand/collapse (plus/minus) icon is clicked in JTree -

i'm writing mouselistener replace default clicking behaviour in jtree . how can tell when icon clicked can expand row myself? (i know default behaviour, i'm replacing default mouselistener own mouselistener ). here's code: // custom mouse listener tree mouselistener treemouselistener = new mouseadapter() { public void mousepressed (mouseevent e) { treepath path = cameratree.getpathforlocation(e.getx(), e.gety()); // methods based on clicked ... } }; the treepath returned cameratree.getpathforlocation(e.getx(), e.gety()) null when clicking on +/- icon. how can tell when +/- icon clicked? if using jtree, use treeselectionlistener. more info here: http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html

Where to run node.js -

so thought giving node.js try seeing possibilities has little test chat project (with mysql) i'm doing. but couldn't find out run file , whats common. what have: a freebsd server latest node , php 5.3.x a vhost some tutorials on how start node (which looked through , got exited about) knowledge on how run terminal without having keep terminal open (screen) so far good. what need: some basic information of put (lets say:) chat.js file. most logical port run on so web root (www) runs on user (not root obviously). , webroot has underlying folder put script (away visitors grabby little hands). seems me safe place put seeing nobody can it, want seeing i'm going connect db , don't want db login data out there (i don't know how works yet i'll figure out db connect node later, no answer required). but if file not in webroot, seems me connection cannot made outside. cause webroot configured allow 80 (or ssl on 443) incomming traffic, logical. ...

java - How to read data like those stored in the *.epf file -

i want read data .epf file, , data like: /instance/org.eclipse.wb.core/design.palette.flyout.width=192 i think can use map<string, string> store it, problem how rid of = , , put left part , right part map ? as jarnbjo mentioned, if conforms property file format, can read file using properties class. if want store data in map, can use string function 2 parts of data: // assuming data contains "/instance/org.eclipse.wb.core/design.palette.flyout.width=192" string[] parts = data.split("="); // parts string key = parts[0]; // /instance/org.eclipse.wb.core/design.palette.flyout.width string value = parts[1]; // 192 // or directly use map map.put(parts[0], parts[1]); to test beforehand if string contains an, use string#contains(). if (string.contains("=")) { // split it. } else { throw new illegalargumentexception("string " + string + " not contain ="); }

c# - Inconsistent DateTime to Unix Time conversion and error on 24 hour input -

Image
attached method using takes in list of datetime strings, input format (i.e. yyyy-mm-dd hh:mm:ss ), , offset in form of hours. as culture , "standard", using invariantculture , converting times utc . public int unixformat3(string datetimeinput, string inputformat, int hours) { datetime result; cultureinfo provider = cultureinfo.invariantculture; result = datetime.parseexact(datetimeinput, inputformat, provider); int unixtime = (int32)(result.touniversaltime().addhours(hours).subtract(new datetime(1970, 1, 1, 0, 0, 0, 0, system.datetimekind.utc))).totalseconds; return unixtime; } two issues said method: i using website comparison. if input 2014-03-18 21:00:00 , output, according method, 1395190800 , converts 2014-03-19 01:00:00 . has 4 hour difference. desired output this: if input 2014-03-18 24:00:00 , error: the datetime represented string not supported in calendar system.globalization.gregoriancalen...

c# - Multiple Query Conditions using Sqlite-net -

i'm developing small windows store app , i'm using sqlite-net i got db of persons, each person has name, id, sex etc etc in project there view search inside db. user can insert 1 or multiple information search. so, build search object (operson) , want use reach goal. now made function every property of person "searchbyid" "searchbyname" , on.. @ last combine functions results is possible create unique method using power of sqlite-net, in wich concatenated?also checking of attribute's value if pass object operson id = null name = john age = null sex = male is possible write query reach goal? pseudo-code pers = (from p in db.table<persons>() (if operson.id !=null) p.id==operson.id} , {(if operson.name !=null) p.name.contains(operson.name)} , {(if condition) where-contion} select p).tolist(); i'd recommend building query in several s...

making a foreach loop inside an SQL query or do it dynamically via PHP? -

Image
i have 2 tables in db, polyptychs , illustrations. pk of polyptychs fk in illustrations. want is: select polyptychid polyptychs and subsequently, foreach id returned need illustrations. via php solution this(using pdo sintax): <?php //create connection db $sql = "select polyptychid, polyptych_image polyptychs"; $stmt = $this->dbh->query($sql); $resulttmp = $stmt->fetchall(pdo::fetch_assoc); $final_result = array(); foreach($resulttmp $val){ $id = $val['polyptychid']; $final_result["$id"]["image"] = $val['polyptych_image']; $sql2 = "select * illustrations polyptychid = :polyid"; $stmt2 = $this->dbh->prepare($sql2); $stmt2->execute(array('polyid' => $id)); $resulttmp2 = $stmt2->fetchall(pdo::fetch_assoc); $final_result["$id"]["illustrations"] = $resulttmp2; unset($id); unset($sql2); unset($stmt2); unset($resulttmp2); } ?> now $final_result ...