Posts

Showing posts from August, 2014

php - TCPDF CodeIgniter Integration won't work -

i want integrate codeigniter download codeigniter official site , place tcpdf folder codeigniter-3.0.6\application\libraries directory. create file named pdf.php in same directory , put these code. require_once dirname(__file__) . '/tcpdf/tcpdf.php'; class pdf extends tcpdf { function __construct() { parent::__construct(); } } after create file named c_test.php , place controller folder these code. class pdfexample extends ci_controller { function __construct() { parent::__construct(); } function index() { $this->load->library('pdf'); $pdf = new pdf('p', 'mm', 'a4', true, 'utf-8', false); $pdf->settitle('pdf example'); $pdf->setheadermargin(30); $pdf->settopmargin(20); $pdf->setfootermargin(20); $pdf->setautopagebreak(true); $pdf->setauthor('author'); $pdf->setd

Android, setting background color of button loses ripple effect -

after adding color android button, loses ripple effect makes user feel there responsive click. how fix this? i've searched through many solutions couldn't find definite 1 wasn't ambiguous. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".clockinoutfragment"> <analogclock android:id="@+id/clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentend="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_torightof="@+id/date_and_time"/> <relativelayout

sql server - SQL query in C#, invalid object name T_Server_Info -

there table named t_server_info in database, when try run code executing sql query in c#, error: invalid object name t_server_info here code: private void add_click(object sender, eventargs e) { string constring = @"data source=inpddba027\ngep;initial catalog=dev_server;integrated security=true"; try { con = new sqlconnection(constring); con.open(); cmd = new sqlcommand(@"insert t_server_info(fs_uid,server_name) values(@fs_uid,@server_name)", con); cmd.parameters.addwithvalue("@fs_uid", uid.text); cmd.parameters.addwithvalue("@server_name", uid.text); cmd.executenonquery(); } catch (exception ex) { messagebox.show(ex.message); } } please help.

javascript - window resize not firing -

i have number of javascript functions. in order stop resize event firing twice, implemented fix, has been working date. function tabsresize() { cleartimeout(timeout); timeout = settimeout(function () { tabsupdate(); }, 200); } $(window).on("resize", tabsresize); however, i've created function, sits slighly lower in food chain same thing. var form = function () { var pub = {}, timeout; function textareaautogrow() { var pad = $(this).outerheight(false) - $(this).innerheight(); this.style.height = "auto"; this.style.height = (this.scrollheight + pad) + "px"; } function textarearesize() { alert("resize"); cleartimeout(timeout); timeout = settimeout(function () { textareaautogrow(); }, 200); } function setupbindings() { $("body").on("input", "textarea", textareaautogrow); $(window).on("resize", textarearesize); } // public fu

jquery - image preview on bootstrap modal -

$(document).ready(function(){ jquery.fn.exists = function(){console.log(this);return this.length>0;} var lisiz=$('ul.imagelist li').size(); $('ul.imagelist li:lt(3)').addclass('active'); $('ul.imagelist li:lt(3)').addclass('active'); var lisiz = $('ul.imagelist li').size(); if(lisiz<1){ $('.loadmore h3').html('no images'); } $('.loadmore').on('click', function() { $('ul.imagelist').find('li.active').last().nextall(':lt(3)').addclass('active'); if (!$('ul.imagelist li').not('.active').length) { $('.loadmore').text('all' + " " + lisiz + ' images showen, no images show'); } }); jquery.fn.exists = function(){return this.length>0;} $('ul.imgmodal li&#

c# - Type.IsEnum Property in Portable Class Library -

i'm trying code in portable class library using asp.net core 1.0 , following instruction: public static void writemessage<t>(t value) { if (typeof(t).isenum) { debug.print("is enum") } else { debug.print("not enum") } } but code not compile because compiler says property isenum non present on type. any suggestions? some functionality type moved typeinfo in .net core. typeof(t).gettypeinfo().isenum

python 2.7 - How to check if .tar.gz archive corrupted after download? -

i use python 2.7.8 , request library download tar.gz archives usgs.gov site. data example: http://dds.cr.usgs.gov/ltaauth//data/standard_l1t/etm/29/30/2016/le70290302016178edc00.tar.gz?id=48aq2ki3sr01iq18pdo8jdmi47&iid=le70290302016178edc00&did=252710635&ver=production sometimes connection interrupted , not files uncompressed archive (but file not corrupted completely). use following code (a part of it) download data: import requests import traceback def download_file(url, file_path): # note stream=true parameter r = requests.get(url, timeout=120, stream=true) open(file_path, 'wb') f: chunk in r.iter_content(chunk_size=1024): if chunk: f.write(chunk) return file_path try: download_file(url, scene_path) except: traceback.print_exc() if os.path.isfile(scene_path): os.remove(scene_path) print u'<= del' how check if *.tar.gz archive corrupted after download

php - How to Retrieve the value from Datetime-local input? -

i experimenting php. creating simple form requests user input their, name, telephone, , appointment time. once user inputs these values, want create calendar event based on these data. (a calendar event in apple ical or google calendar) i decided use third party framework, addevent, me create .ical file can add icalendar or google calendar. however, ran issue. i used datetime-local input type gather appointment time issue. when that, , try echo out, prints out in specific format (2016-06-30t02:02). i want know how can alter format (07/13/2016 16:00). thanks, you can use following: echo strftime('%d/%m/%y %h:%m', strtotime($datetime_loacl_input));

html - CSS-Transition doesn't work on pseudo-element -

the idea kind of underscore appears when hyperlink appears. underscore shall grow it's full size. that's got far: .wrap { margin: 10px auto; width: 600px; } #test { text-decoration: none; } #test:after { width: 0; transition: 3s; } #test:hover:after { content: ''; display: block; width: 100%; border: 3px solid teal; } <div class="wrap"> <a id="test" href="#">some dummy-text testing ...</a> </div> the underscore appears , disappears expected. but without transition. i have seen other websites uses such effects on these browser (ie 11) here. should work. what i'm doing wrong? specifying transition on element-without-hover how shall done. far know ... it's because aren't adding content until :hover state. you should define as possible in initial state , change required properties :hover state. try #test:after { con

seo - Header within a div within an anchor tag -

me , fellow webdeveloper having discussion whether or not seo-friendly. think it's okay have anchor <a> tag wrapped around div. it's perfectly valid in html5 . however, says it's bad seo. <h1> tag lose value in terms of seo. the html: <a href="/link"> <div> <h1>header </h1> <img /> <p>some test</p> <span>span acting link here</span> </div> </a> does <h1> lose value cause of this? want entire div clickable (for user experience) don't want make <h1> lose value in terms of seo. if using html5, they're both same. as html5 allow block-level links. if markup valid, not lose seo value. more important quality of link , text within.

php - Regex - First 6 characters must be digits and be in range (x, y) -

i have little question :) need regex string -- 6 characters, example "112233abc" regex should first 6 characters digits, , in range 100000-200000 (higher 100 000 , lower 200 000) thank you. there isn't question thats 1. 2. try this: ^[1]\d{5} or if want match 200000: (^[1]\d{5}|^200000)

PHP DOMDocument : How to parse custom XML/RSS tag names with COLONS? -

i have below rss parse, like: <?xml version="1.0" encoding="utf-8"?> <rss xmlns:x-wr="http://www.w3.org/2002/12/cal/prod/apple_comp_628d9d8459c556fa#" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:x-example="http://www.example.com/rss/x-example" xmlns:x-microsoft="http://schemas.microsoft.com/x-microsoft" xmlns:xcal="urn:ietf:params:xml:ns:xcal" version="2.0"> <channel> <item> <title>about apples</title> <author>david k. lowie</title> <description>some description apples</description> <xcal:description>this full description apples</xcal:description> </item> <item> <title>about oranges</title> <author>marry l. jones</title>

database - How can i instal Oracle 11g on OSX 10.11.1? -

i want instal oracle 11g on mac machine , don't know how , want develop web apllication jee , want use oracle database. possible run native development environment on osx ? the quickest way install virtualbox , use 1 of images oracle supplies developers: http://www.oracle.com/technetwork/community/developer-vm/index.html

c# - Web app(MVC 5),web api 2, native Android and iOS to use one mode of authentication? -

i need develop application in mvc 5, xamarin android , ios application; these applications have same features, have web api 2 common operations except one! authentication! i want above applications use one authentication framework/architecture either asp.net identity 2.0, web api token based authentication or other suggest. successfully implement asp.net identity 2.0 mvc 5 app, couldn't authenticate web api [authorize] attribute (tried both system.web.http , system.web.mvc). hence did not think of trying mobile apps yet. successfully implement web api token based authentication web api , mvc 5 well, lots of javascript variable storage (which not right). tried authenticate mvc 5 app [authorize] attribute (tried both system.web.http , system.web.mvc) page either shows 401 unauthorized if token not yet granted , once token granted view opens, , doesn't authenticated after token's validity expired, works on when use [system.web.mvc.authorize] attribute. have sample

html - SCRIPT438: Object doesn't support this property or method: 'Document.GetElementsByName' -

i have below code , after debugging i've hit brick wall. whilst debugging throws error script438: object doesn't support property or method: 'document.getelementsbyname' when executing submit button loads spreadsheet because of error doesn't know write able follow through actions. code below <! doctype html> <html> <head> <meta http-equiv="x-ua-compatible" content="ie=9"> <script language="vbscript" type="text/vbscript"> sub divert () dim irow set objexcel = createobject ("excel.application") set objworkbook = objexcel.workbooks.open ("g:\bournemouth\corporateshared\general insurance\gi complaint team\cru diverted\diverted.xlsx") objexcel.application.visible = true objworkbook.windows (1).visible = true set xlsheet =objworkbook.sheets (1) xlsheet.activate irow = 1 objexcel while .cells (irow, 1).value <> ""

multithreading - How does a synchronized method work in Java? -

i need method run once background no matter how many threads call it. found partial solution using code code: public static void async(final int a){ thread th = new thread(new runnable() { @override public void run() { meth(a); } }); th.start(); } public static synchronized void meth(final int a){ try { thread.sleep(1000); system.out.println(a); } catch (interruptedexception ex) { logger.getlogger(simple.class.getname()).log(level.severe, null, ex); } } but when test that: system.out.println("start"); async(11); async(12); async(13); async(14); async(15); async(16); async(17); async(18); async(19); system.out.println("end"); i got results: start end 11 19 18 17 15 16 14 13 12 is there wrong code? why results not in same order call? edited after using thread.join public static object obg = new object(); public static void async(final int a){ thread th = new t

Changing a SQL Server function to work with multiple records -

i have function use compute number of days patient unavailable in order reduce number of days have breached waiting times deadline. the function follows: create function [dbo].[getdaysunavailable] ( @intref int ) returns int begin declare @returnvalue int declare @dtunavailfrom datetime declare @dtunavailto datetime declare @dtrefrcvd datetime select @dtunavailfrom = unavailablefrom referrals referralid = @intref select @dtunavailto = unavailableto referrals referralid = @intref select @dtrefrcvd = referralreceiveddate referrals referralid = @intref if isnull(@dtunavailfrom,'') = '' or isnull(@dtunavailto,'') = '' begin select @returnvalue = 0 end else begin if @dtrefrcvd > @dtunavailfrom begin select @returnvalue = datediff(day,@dtrefrcvd, @dtunavailto) end else begin select @returnvalue = datediff(day,@dtunavailfrom, @dtunavailto) end end return

html - Notification does not showing on particular button -

Image
i have buttons span class, m facing problem show each span class above particular button. image . how can this? .label{ position: absolute; top: 2.5rem; } <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> <script src="https://use.fontawesome.com/f574067864.js"></script> <!doctype html> <html> <head> <title></title> </head> <body> <hr> <div class="container"> <button class="btn btn-default" type="submit">button</button> <span class="label label-success">4</span> <button class="btn btn-default" type="submit">button</button> <span class="label label-success">5</span> <button class="btn btn-default" type="submit">button</button> <span class="

ios - EXC_BAD_ACCESS when I'm trying to delete a UITableView sections -

i have code: // - update data source self.order.persons.removeatindex(index) // - disable user interaction self.tableview.userinteractionenabled = false // - delete needed section table view let sectionindexset = nsindexset(index: self.order.persons.count - 1) self.tableview.beginupdates() self.tableview.deletesections(sectionindexset, withrowanimation: .automatic) self.tableview.endupdates() // - update table view delay update indexes nstimer.scheduledtimerwithtimeinterval(0.3, handler: { self.tableview.userinteractionenabled = true self.tableview.reloaddata() }) so problem: case 1: when on visible zone of table view sections, not 1 want delete, works great. case 2: when on visible zone of table view section want delete, debugger stop @ line: self.tableview.endupdates() and gives errors : thread 1: exc_bad_access (code=1, address=0x0). i don't understand why case 1 working great, c

php - False Positive in Sqlite3 Query Result -

i have server sqlite3 db, , client pc. if send database query via ajax, receive true result on query result, if query has been done. my problem is: if turn off server while doing db queries, can receive false positive, because query done not fixed in hard disk memory! example: via ajax: var testo_query='insert comanda terminale,perc_iva,id,cod_articolo,ordinamento,peso_ums,ultima_portata,numero_conto,nodo,cat_variante,dest_stampa,portata,desc_art,quantita,prezzo_un,categoria,ntav_comanda,operatore,tipo_record,stato_record, prog_inser,posizione) values ("null","22","dav_20160629110600158","151","00","","","1","006","1","51","4","tartufo nocciola","1","5.00", var dbtype='sqlite'; var dbname='provaintellinet.sqlite'; "0",&quo

Get the IP address of the client connecting to a C# .NET WebAPI application -

i tried: private const string httpcontext = "ms_httpcontext"; private const string remoteendpointmessage = "system.servicemodel.channels.remoteendpointmessageproperty"; public static string getclientipaddress(httprequestmessage request) { if (request.properties.containskey(httpcontext)) { dynamic ctx = request.properties[httpcontext]; if (ctx != null) { return ctx.request.userhostaddress; } } if (request.properties.containskey(remoteendpointmessage)) { dynamic remoteendpoint = request.properties[remoteendpointmessage]; if (remoteendpoint != null) { return remoteendpoint.address; } } return null; } according to: retrieving client's ip address in asp.net web api this combined approach should valid self host , webapi host. unfortunately null instead of ip address. i'm trying locally i'd expect 127.0.0.1 or localhost ip addr

android - Call method(ProjectActivity) from another Library Activity -

i want call 1 method library method written in activity of project how can achieve this: activity.java (myproject): public class databasehelper extends sqliteopenhelper { public void favorite(string str[], context cxt) { } } library activity(modules(libraryfile)) public class mupdfactivity extends activity{ //here want call( favorite(string str[], context cxt)) method. } please me issue.

c - Show project files in eclipse as a searchable list (Source insight like) -

Image
is there way make project explorer in eclipse source insight as can see in right panel there listing of files can sorted name , searchable way better eclipse you may better answers providing screenshot example of want achieve. i'll best. as far know, project explorer (by default) sorts files name, folders preceding files. applies tree leaves (files within each directory). don't think possible use display files, despite directory, in alphabetical order. a sort of ugly (in opinion) workaround use ctrl + shift + r keyboard shortcut , search '**'. list file names in open projects within current workspace. default sort name. can see of these files in file tree selecting result , clicking 'show in' drop-down menu @ bottom of dialogue box, , selecting 'navigator'. can open of these files selecting result , clicking 'open with' drop-down menu instead, , selecting appropriate application open with. consider alternative options:

eclipse - spring boot use springloaded no work in gradle -

Image
when use springloaded in project. there similar question in spring boot + spring-loaded (intellij, gradle) according document , build.gradle : buildscript{ ext{ springbootversion = '1.3.5.release' } repositories { mavencentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") classpath 'org.springframework:springloaded:1.2.0.release' } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'spring-boot' //apply plugin: 'application' springboot { backupsource = false mainclass = 'com.zhb.app.portalapplication' } jar { basename = 'springboottest' version = '0.0.1-snapshot' } //applicationdefaultjvmargs = ['-javaagent:e:\\xgsdk\\commonlib\\springloaded-1.2.5.release.jar -noverify'] repositories { mavencentral() } dependencies { compile "org.springframework.boot:spring-boot-starter-web

php - Not able to save data to a new table with composite primary key -

code require_once 'detect/detect.php'; date_default_timezone_set('asia/kuala_lumpur'); $fb_id = $_post['id']; $full_name = $_post['name']; $first_name = $_post['first_name']; $last_name = $_post['last_name']; $email = $_post['email']; $date_time = date('y-m-d h:i:s'); $shared = null; $redeemed = null; $connection = mysqli_connect("server", "username", "password", "db"); $sql = "insert ignore abc_cafe (fb_id, full_name, first_name, last_name, email, date_time, shared, redeemed) values ('$fb_id','$full_name','$first_name','$last_name','$email','$date_time','$shared','$redeemed')"; mysqli_close($connection); my table created no data. primary key (fb_id,date_time) not appearing in structure. try mysqli_query() execute query. try this. $connection = mysqli_connect("server", "u

c# - Dynamically creating JSON objects from reflected methods -

first off, i'm sorry if i'm off on terminology - bare me. i've since getting bunch of so hivemind been able create rest api (c#, mvc) handles dynamic (at least that's want call it) calls through catching string param , finding correct method through using reflection. var mytype = typeof(jaberodc.jaberodc.jaberodc); var method = mytype .getmethods(bindingflags.public | bindingflags.instance | bindingflags.declaredonly) .single(mi =>mi.returntype == typeof(dataset) && string.equals(mi.name, param, stringcomparison.ordinalignorecase)); var subject = activator.createinstance(mytype); var result = method.invoke(subject, new object[] { "", constr, "", 0, 0, null }); dataset ds = (dataset)result; what need sort of advice on how handle various results dynamically. meaning need understanding how either create class handles 0=>n colum

ruby - How can I appropriately mock out a method that returns yield? -

it's common in ruby methods take blocks this: class file def open(path, mode) perform_some_setup yield ensure do_some_teardown end end it's idiomatic method this: def frobnicate file.open('/path/to/something', 'r') |f| f.grep(/foo/).first end end i want write spec doesn't hit filesystem, ensures pulls right word out of file, like: describe 'frobnicate' 'returns first line containing substring foo' file.expects(:open).yields(stringio.new(<<eof)) not line foo bar baz not line either eof expect(frobnicate).to match(/foo bar baz/) end end the problem here that, mocking out call file.open , i've removed return value, means frobnicate return nil . if add file.returns('foo bar baz') chain, however, i'd end test doesn't hit of code i'm interested in; contents of block in frobnicate , test still pass. how might appropriately test frobnicate

c# - I want to import data from CSV file to SQL database using Entity Framework -

i want insert data csv file sql table. here code don't know how go further var readcsv = file.readalltext(filepath); string[] csvfilerecord = readcsv.split('\n'); foreach (var row in csvfilerecord) { if (!string.isnullorempty(row)) { foreach (var cell in row.split(',')) { var cards = new cards { //what here assign data each column }; } } } here csv file data 12345,cvv,18-april,name,country,address,state,city,dob,zipcode,phone,email,10 12345,cvv,18-april,name,country,address,state,city,dob,zipcode,phone,email,10 class definition public string nummber { get; set; } public string cvv { get; set; } public string expdate { get; set; } public string name { get; set; } public string country { get; set; } public string address { get; set; } public string state { get; set; } public string dob { get; set; } var readcsv = file.readalltext(filepath); string[] csvfilerecord

c++ - How to set returned value of log10(0)? -

it prints me -inf . fixed every library/compiler i'll use? code : #include <iostream> #include <math.h> using namespace std; int main () { double result = log10(0.0); cout << result; } or change in different platforms? how manage pole error keeping double ? according cplusplus , depends on library log10(0) . however, in general value of log10(0) not defined (can -inf if like, not real number). usually, should prevent such undefined results (not undefined in c++ sense of undefined behaviour, in mathematical sense) before happen. e.g. double x; x = foo(); if ( x <= 0 ) { /* handle case */ else { y = log10(x); } what value use in case of log10(0) depends on application. however, think easier check 0 before doing calculation instead of relying on log10(0) returning particular value (as might -inf or different).

ios - How to define cache control for AWSS3TransferUtility -

i'm struggling define cache control when uploading images via awss3transferutility (aws-ios-sdk v2.4.x). my simplified usage like: let utility = awss3transferutility.s3transferutilityforkey("key") let data = uiimagejpegrepresentation(image, 0.9)! let expression = awss3transferutilityuploadexpression() expression.progressblock = { (task, progress) in onprogress?(progress: progress.fractioncompleted) } transferutility.uploaddata(data, bucket: globalconfig.awss3defaultbucket, key: "image.jpeg", contenttype: "image/jpeg", expression: expression) { (task, error) in // ... } my current focus on expression, calls expression.setvalue("max-age=3600", forrequestparameter: "cache-control") didn't work.

How to certify Firefox OS 1.4 app? -

i developing firefox os 1.4 app. basic app. fetch file sd card. but problem certified app can have authority. , planing make more such type of apps in future. problem every time app not run because not certified app. now googled lot find how certify firefox os 1.4 app. while searching on site found 1 question similar question . according first answer have mainfest.webapp including "type": "certified" . , zipped files (not folder). have following files: mainfest.webapp index.html myjavascript.js but not know webapps.json file , how add "appstatus": 3 it. i have ordered real firefox os 1.4 phone flipkart (it not yet come) , want run apps on real firefox os 1.4 phone. want certify app can authorized secure tasks. please me , tell me way can certify firefox os 1.4 apps. certified app internal app , comes along device. third party developers cannot create or distribute such apps. think trying develop privileged app. privileged ap

c# - how to avoid in WCF service interface to implementing either synchronous or asynchronous Method -

Image
i have implemented wcf services, have defined synchronize method following; [servicecontract] public interface imarketingcampaigntype { [operationcontract] list<marketingcampaigntypedata> getallcampaigntypes(); [operationcontract] marketingcampaigntypedata getcampaigntypebyid(int campaigntypeid); [operationcontract] marketingcampaigntypedata createnewcampaigntype(); [operationcontract] marketingcampaigntypedata editcampaigntype(); [operationcontract] bool deletecampaigntype(); } now on client side when configure service choosing 'add service reference' in visual studio under project, interface generated under namespace 'app.client.proxies.marketingcampaigntypeserviceref' but when implement interface getting 2 of each methods each implementation 1 synchronous , other asynchronous. know in client choose 1 want implement question can can control 1 allowing or have 1 type of method instead of two? here interface