Posts

Showing posts from May, 2013

java - PDFBOX 1.8.9 Overlay two PDF documents: Layout pages with COSArray currently not supported -

i want use apache pdfbox (1.8.9) library print white/invisible text on existing pdf documents, therefore create new document, add text in color.white , use "overlay" method merge 2 documents together. doing encountered following problem: java.lang.unsupportedoperationexception: layout pages cosarray not supported. @ org.apache.pdfbox.overlay.collectlayoutpages(overlay.java:269) @ org.apache.pdfbox.overlay.overlay(overlay.java:224) @ com.db.jocr.main.overlay(main.java:194) @ com.db.jocr.main.main(main.java:91) the code looks this: realdoc = pddocument.load(pathinputdoc); string pathwatermarkdoc = createwhiteonwhitedoc(text, pagecount, color); watermarkdoc = pddocument.load(pathwatermarkdoc); overlay overlay = new overlay(); overlay.overlay(realdoc,watermarkdoc); line 194 code throws exception "overlay.overlay(doc1, doc2)" command i found similar question on apache mailinglist (from 2009, apparently no answer, https://mail-archives.apache.org/mod_mbox/p...

vba - How can i set the name of a textbox in publisher? -

i want set name of text box can accessed code. e.g i looking editing field similar this thanks there's properties window can accessed each of controls on ui. there may rename controls. (since not seem have vba code yet , want rename control ui) the other alternative. record macro, changes textbox (e.g. resize, change text etc). check programme assigned default name of textbox vba editor. said, can access control via default name , utilizing vba code (as said), rename textbox.

how to convert yii framework project into php -

can 1 me. create yii framework project.how convert php in easiest way.actually know little concept of mvc using in php problem render,redirect,lot of pages create through mvc . how control admin panel . create differt admin panel media person , agent.i dont understand if extends ccontroller in yii how use in php also.. lot of confusion me project. can 1 me easiest way possible.if describe better me. please help. thank in advance. let me clear. php server-side scripting language. the yii framework instrument, supports development process , relieve "programmer" common activities. framework build on php, because of this, there no "converting". my advice you: check requirements given client carefully. after that, have probablary 2 options. coding functionality in php checkout cool framework , spent time learning

visual studio - C++ idioms when declaring template class members and constructors -

although both of following compile (with visual studio 2013), 1 of them more "correct" respect c++ idioms? speak particularly respect explicit template parameters when calling base class constructors , declaring members. standard have view on this? there practical reason prefer 1 on other? template<class t> class bar1 : public base<t> { public: bar1() : base() {} bar1(t value) : base(value) {} bar1(bar1 const & other) : base(other.value) {} void foo(bar1 const & other) { // foo related activity. } }; template<class t> class bar2 : public base<t> { public: bar2() : base<t>() {} bar2(t value) : base<t>(value) {} bar2(bar2<t> const & other) : base<t>(other.value) {} void foo(bar2<t> const & other) { // foo related activity. } }; this question relies on called injected-class-name . [class] a class-name inserted scope i...

c - Console input in 32-bit Protected mode -

i working on os. i've started building since a-day before yesterday. os command-based. this kernel.c(the main file): #include "include/screen.h" #include "include/kb.h" #include "include/string.h" #include "data/userdata.c" kmain() { clearscreen(); print("halcyon os 1.05 beta "); while (1) { print("\nhalcyon@halcyon ~\n$ "); string ch = readstr(); if(streql(ch,"cmd")!=0) { print("\nyou in cmd\n"); } else if(streql(ch,"clear")!=0) { clearscreen(); } else if(streql(ch,"help")!=0) { print("halcyon help."); } else if(streql(ch,"")!=0) { ...

Xcode (interface builder) is changing darkTextColor to calibrated RGB 0,0,0,1. Is this a bug? -

this being bugging me while. when open file in xcode - interface builder. files gets automatically changed. change worthless since changing darktextcolor , grouptableviewbackgroundcolor (and possibly others) absolute values. this time opening file new xcode 6.4 has happened in past too. commit changes, ignore. correct thing here? bug? i worried cases grouptableviewbackgroundcolor , change in future , app adopt latest colour when opened in lastest xcode. not sure if going happen if commit absolute values. diff --git a/companyapp/companyapp/base.lproj/main.storyboard b/companyapp/companyapp/base.lproj/main.storyboard index bf84644..775e1ac 100644 --- a/companyapp/companyapp/base.lproj/main.storyboard +++ b/companyapp/companyapp/base.lproj/main.storyboard @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="no"?> -<document type="com.apple.interfacebuilder3.cocoatouch.storyboard.xib" version="3.0" toolsver...

c++ - Does there exist a static_warning? -

i'm aware of this question mentions boost's "static warning", i'd ask again, specifically, how implement static_warning operates static_assert emits warning @ compile time rather aborting compilation error. i'd similar alexandrescu's proposal static assert in pre-c++11 days somehow managed print useful contextual information part of error. it acceptable require user enable standard compiler warnings in order construction work (perhaps "invalid pointer conversion" or "breaks strict aliasing rules") -- warning should part of normal compilation anyway can used. in short, want static_warning(false, "hello world"); create compiler warning should somehow include string "hello world" in warning message. possible, in gcc , msvc, , how? i'd happily give out small reward bounty particularly clever solution. as bit of explanation: got idea when thinking this question : static warning useful way trace th...

c# - How to add relationship attributes in entity framework model first? -

how can add relationship attribute in many many relationship when using model first approach entity framework? suppose have 2 entities entity_1 , entity_2 has many many association. let's assume association has attribute attr1 . how model in entity designer in visual studio 2013? is there option or isn't there option? you can find on subject. http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx

javascript - Is it possible to change font color based on background slider image name using jQuery? -

i trying change font color of navigation based on color of background image image slider. i'm adding class nav looking @ end of image name "dark.png" or "light.png" change font color don't know how change font color every time slider switches images. if there simpler/better solution out there please let me know. realize i'm mixing pure javascript , jquery in example if has pure jquery solution awesome. here code simplified version troubleshooting. did jsfiddle example. html: <body> <nav> <ul> <li>about</li> </ul> </nav> </body> css: body { background-repeat: no-repeat; background-size:cover; width:300px; height:300px; } .dark { color:#ffffff; } javascript: $(document).ready(function(){ //slideshow: $(function () { var slideshow = $('body'); var backgrounds = ...

c# - why crystal report viewer control toolbar is not working over web browser after report display on web browser -

i able display report on web browser.my problem is, when use toolbar(such export button,print button,find button , on) of crystal report facing parameter missing error on web browser.please me how shut out issue in asp.net platform using c#. in advance. you need store/persist reportdocument object in session variables if (!page.ispostback) { rpt = new reportdocument(); session["report"] = rprt; // store report in session } else { rpt = (reportdocument)session["report"]; } and here explanation http://scn.sap.com/community/crystal-reports-for-visual-studio/blog/2011/04/25/why-should-i-store-reports-object-in-httpsession

How to load a class function outside declaring class in Java Reflections -

i using java reflections api load functions dynamically variable.when calling functions in same class,the function calls working. now trying call functions outside declaring class.this code using. package com.test.controller; try { class cls = class.forname("com.test.actions"); system.out.println("trying method name"); java.lang.reflect.method method=cls.getmethod(action,string.class,httpservletrequest.class); system.out.println("got method name"+method); val=method.invoke(this, instinputtext,request).tostring(); } catch(exception e){e.printstacktrace();} i trying acess different class , functions , following error. java.lang.illegalargumentexception: object not instance of declaring class the exception because of line val=method.invoke(this, instinputtext,request).tostring(); . you passing this instance call, means perform this.method() . instead need create instance of class actions , use...

java - Is there any difference while executing SWF in AWS , in normal AWS project and Maven project? -

while executing swf in maven project getting following error, can u please me how resolve error error execute, failure processing activity task taskid=6, workflowgenerationid=mainworkflowpcompress, activity={name: activity.downloadfroms3,version: 22.0}, activityinstanceid=1 com.amazonaws.services.simpleworkflow.flow.activityfailureexception: com.amazonaws.amazonwebservicerequest.copyprivaterequestparameters()ljava/util/map; : ["java.lang.nosuchmethoderror",{"cause":null,"stacktrace":[{"methodname":"invoke","filename":"amazons3client.java","linenumber":3651,"classname":"com.amazonaws.services.s3.amazons3client","nativemethod":false},{"methodname":"getobject","filename":"amazons3client.java","linenumber":1160,"classname":"com.amazonaws.services.s3.amazons3client","nativemethod":false},{"m...

MATLAB spending an incredible amount of time writing a relatively small matrix -

i have small matlab script (included below) handling data read csv file 2 columns , hundreds of thousands of rows. each entry natural number, zeros occurring in second column. code taking incredible amount of time (hours) run should achievable in @ seconds. profiler identifies approximately 100% of run time spent writing matrix of zeros, size varies depending on input, in usage smaller 1000x1000. the code follows function [data] = datahandler(d) n = size(d,1); s = max(d,1); data = zeros(s,s); = 1:n data(d(i,1),d(i,2)+1) = data(d(i,1),d(i,2)+1) + 1; end it's data = zeros(s,s); line takes around 100% of runtime. can make code run changing out s's in line 1000, sufficient upper bound ensure won't run errors of data i'm looking at. obviously there're better ways this, being bashed code format data wasn't concerned. said, fixed replacing s 1000 purposes, i'm perplexed why writing matrix bog matlab down several hours. new code runs instantaneously...

html - Bootstrap 3 Vertical Alignment Across Multiple Rows and Columns -

Image
i new bootstrap. started project , came across challenge regarding vertical alignment bootstrap's grid system. community of experts able shed light , assist solution. to better illustrate issue, have taken 4 screenshots (links attached @ bottom) each of lg, md, sm, , xs scenarios. hope images make sense you. the problem is, while lg scenario looks great , aligned properly, viewport changes, content of 2 columns start show misalignment. here html markup: <div class="container"> <div class="row row-centered"> <div class="col-sm-6 col-md-6 col-lg-6"> <div class="row row-centered"> <div class="hidden-xs hidden-sm hidden-md hidden-lg"></div> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <h2>header number 1</h2> </div> ...

c# - How do you make buttons programmatically using xamarin? -

i'm trying create buttons programmatically using xamarin ide (c#). code need create button, set size, set text, set background color, , set constraints? there way define button 1/4 of width of screen? in advance. first create button uibutton button = new uibutton(); cgrect screenbounds = uiscreen.mainscreen.bounds; float buttonwidth = (float)screenbounds.x / 4; button.frame = new cgrect (0f, 0f, buttonwidth, 50f); button.settitle ("title", uicontrolstate.normal); button.backgroundcolor = uicolor.green; and add subview active view this.addsubview (button); and add event touchupinside button.touchupinside += (object sender, system.eventargs e) => { debug.writeline( "button clicked!"); };

c - How does `if(!found)` in this function work? -

this function finds first , last occurrence of integer in array. don't understand second if statement if(!found) same saying if(found==0) ? how second statement 'find' first occurrence? lets if there 3 4's in array loop finds last occurrence , sets plast , goes 2nd if statement how know find first occurrence , not 2nd occurrence? find_occurences(const int a[], size_t n, int x, size_t *pfirst, size_t *plast) { size_t i; int found = 0; for(i=0; i<; i++) if (a[i] == x) *plast = i; if (!found) { *pfirst = i; found = 1; } } return found; } in c , 0 means boolean false , , other non zero values treated boolean true . so, if (!found) go true path if found = 0 . if(!found) same saying if(found==0) ? yes is!

for loop variable name use swift -

i have static variable name want create use loop : var imageke1 = "" var imageke2 = "" var imageke3 = "" var imageke4 = "" var imageke5 = "" var imageke6 = "" var imageke7 = "" i try create error expected pattern: for var = 1; < 8; i++ { var "imageke\(i)" = "" } i try conflict same variable name (kucing) : for var = 1; < 8; i++ { var kucing = "imageke\(i)" var kucing = "" } at end create list of string result, , want change loop: var names: [string] = ["\(imageke1)", "\(imageke2)", "\(imageke3)", "\(imageke4)", "\(imageke5)", "\(imageke6)", "\(imageke7)"] how loop variable name (imageke) , var names? var names: [string] = [] index in 1...8 { names.append("imageke\(index)") } println(names) // "[imageke1, imageke2,...

android - Buttons with background image not next to each other? -

i new android. tried fill_parent,match_parent instead of wrap_content. want 2 buttons background image in 1 row. tried using weightsum="2" , each button having layout_weigh="1". not working . please suggest going wrong. xml file below <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:weightsum="2"> <button android:id="@+id/button5" style="?android:attr/borderlessbuttonstyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="4dp" android:layout_marginstart="4dp" android:layout_margintop="4dp" android:layout_weight="1" android:background="@drawable/theatre" android:gravity="bottom|cente...

javascript - Ajax Calls Returning Zero in IE/Firefox -

have been working on 2 days , can't figure out causing fail in ie (v11) , firefox. works fine in chrome. read lot of questions on here covered caching issues multiple ajax calls, particularly ie, don't believe that's issue. code 1 of 2 forms on page. both submitted via jquery, when " submit all " button clicked. disabled first form, though, , second still doesn't function properly. here's js/ajax code faulty form submission: $("body").on( "submit", ".update-guest-email", function(event) { event.preventdefault(); var form = $(this); if( form.find('input[name="email"]').val() == "" ) { return; } if (!formchecker(form)){ return; } var datastring = { action : 'update_guest_party', data : form.serializearray() } $.ajax({ cache: false, type: "post", url: ajaxurl, // wp ajax handler. ...

android - Will the address field store multiple phone numbers when I send a sms to multiple phone numbers at one time? -

Image
when send sms in android mobile phone, can select multiple contact (please see a.png ), , sms 1 record. can sms query using "content://sms/" ? field "address" return multiple phone numbers? thanks! a.png public static list<string> listdeleteold(context mycontext, smsrange msmsrange, int beforedays ) { list<string> mlistsmsid=new arraylist<string>(); uri uri=publicparfun.geturibysmsrange(msmsrange); date beforedate=getcurrentbefore(beforedays); string[] projection = new string[] {"_id","address"}; cursor cur = mycontext.getcontentresolver().query(uri, projection, "date<=" + beforedate.gettime(), null, "date desc"); while(cur.movetonext()){ string s=cur.getstring(cur.getcolumnindex("address")); } cur.close(); return mlistsmsid; } public static uri geturibysmsran...

python - django-allauth Upgrade from 0.17 to 0.21 -

i'm looking @ upgrading allauth on live application version 0.17 0.21. it seems documentation doesn't have detailed instructions on how that. there used on until version 0.17 in readme file, not in later versions. anyone out there that's done it? or maybe missed documented? for reference in case matters, python 2.7.3 , django 1.6 (at point). the readme/documentation has been broken down separate files. upgrade notes listing issues relating backwards compatibility resides in docs/changelog.rst . available online on at: http://django-allauth.readthedocs.org/en/latest/changelog.html

How to use command zip in linux that folder have short path? -

i used command zip in linux (redhat), command: zip -r /home/username/folder/compress/zip.zip /home/username/folder/compressed/* then, open file zip.zip, see architecture path folder compress. i want in folder zip consist list file *.txt because used command in script crontab hence can't use command cd path folder before run command zip please me i skimmed zip man page , have found. there not option archive files relative different directory. closest have found zip -j removes entire path , stores files directly in zip rather sub directories. not know happens in case of file name conflicts such if /home/username/folder/compressed/a.txt , /home/username/folder/compressed/subdir/a.txt both exist. if not problem you, can use option, concerned because did specify -r option indicating expect zip traverse sub folders. i thought of possibility script somehow call zip different working directory, took @ unix stack exchange page , looks options use cd . i have ...

android - Splash Screen synchronized loading -

i have implemented loading screen (splashscreen) want synchronize actual app loading. want app load main page in background when done timed load on loading screen, have main screen pulled in background. relatively new async task , threads since don't apps games use this. thanks canvas load bar movement: public class customrectangle extends view{ float left = 0, right = 500, top = 500, bot = 1000; boolean check = false, finish = false; int screenwidth = 0, screenheight = 0; bitmap image; @targetapi(build.version_codes.honeycomb_mr2) public customrectangle(context context){ super(context); windowmanager wm = (windowmanager) context.getsystemservice(context.window_service); display display = wm.getdefaultdisplay(); point size = new point(); display.getsize(size); this.screenheight = size.y; this.screenwidth = size.x; this.image = bitmapfactory.decoderesource(getresources(), r.drawable.logo); this.image = bitmap.createscaledbitmap(this....

In Atom, with Typescript, what does the underlined "module" supposed to tell me? -

Image
see how 'fs' underlined? when hover on it says "module". confused me because looked error. when hover on it says "module". confused me because looked error. we underline these denote these paths understand. , these paths provide autocomplete for. it looks error because color scheme has text red . in others different based on color scheme strings .

Regex capture group nesting -

Image
i've started learning regex , i've been stuck on this lesson while now. i don't quite understand why below 2 won't work. ^(.+(\d+))$ ^([a-za-z_]+(\d+))$ both work ok, need space before nested group. your regex work if text example: jan1987 . examples in link posted like: jan 1987 try: ^(.+ (\d+))$ ^([a-za-z_]+ (\d+))$

delete lines from file in python -

i have file formated this: #1 0.13297254902 0.324803921569 0.434835294118 ...#many floats in 1 line #2 0 #3 0.377305882353 0.595870588235 0.353215686275 ... #4 1 #0/1 second line #5 .... i want process file blocks second line 0 can deleted , left file as #1 0.377305882353 0.595870588235 0.353215686275 ... #2 1 #3 0.403529411765 0.341654901961 0.379278431373 ... #4 1 #now 1s #5 ..... i tried snippet below, can see 0/1 remove line, want delete line floats above 0/1, not line floats below 0/1. f = open(filepath, "r") lines = f.readlines() f.close() f = open(filepath, "w") line in lines: if "1\n" in line: f.write(line) is there other way can choose line include , not? or maybe there's way process file backwards? we can use next() function next element in file iterable. shutil module allows move new file, overwriting original (thanks @joranbeasley). import shutil open(filepath, 'r') f, open(...

Cloud Bigtable HBase Client not functioning -

after following steps outlined in below link, can hbase shell launching hbase commands throwing;error: npn/alpn extensions not installed https://cloud.google.com/bigtable/docs/installing-hbase-client i have java version of 1.7.0_60-b19 , used alpn 7.1.0.v20141016 what missing? thanks in advance help on doc, hbase_classpath points to"$(pwd)/lib/bigtable/bigtable-hbase-0.1.5.jar" , in comment above under mvn folder , new version searching alpn-boot file there. found issue though. copy past problem while downloading jars. appreciated support

javascript - Count prices inside the Django Inline -

Image
i'm looking way count prices django (dynamic) inline using javascript. i have scenario (inside django admin): and trying that: {% block extrajs %} <script type="text/javascript"> var subtotal = 0.00; $('.field-product_code select').change(function(){ $('.related-widget-wrapper select').each(function(){ product = $(this + 'option:selected').text(); select_val = $(this).val(); var regex = /[+-]?\d+(\.\d+)?/g; var str = product; var floats = str.match(regex).map(function(v) { return parsefloat(v); }); var price = floats[0] * 1; console.log($(this).val()); }); // row_id = $(this).closest('tr').attr('id'); // console.log($(row_id).find('.price_product')); {# if(row_id + ' .price_product'){#} {# ...

oracle - pl/sql How to use for loop with cursor for update operation -

i'm new in pl/sql , on book found example update cursors declare cursor c_grade(i_student_id in enrollment.student_id%type, i_section_id in enrollment.section_id%type ) select final_grade enrollment student_id_id = i_student_id , section_id = i_section_id update; cursor c_enrollment select e.student_id, e.section_id enrollment enr, section sec sec.course_no = 135 , enr.section_id = sec_section_id; begin r_enroll in c_enrollment loop r_grade in c_grade(r_enroll.student_id. r_enroll.section_id) loop update enrollment set final_grade = 90 student_id = r_enroll.student_id , section_id = r_enroll.section_id; end loop; end loop; end; my question why need use update cursor in example? benefit compared this: r_enroll in c_enrollment loop update enrollment set final...