Posts

Showing posts from September, 2015

How to dequeue messages from RabbitMQ in a scheduled time -

i using rabbitmq messaging service send messages. want dequeue messages sent on scheduled basis , stop dequeuing messages after 2 minutes, can dequeue them on next scheduled time. thanks, r. venkatesan looks time-to-live extensions want. setting per-queue ttl 2 minutes dead-letter messages published more 2 minutes ago.

perl - pdf file encryption function error -

for testing encryption function (by default 128 bit encryption) , created pdf file 'apps.pdf' password protected 'abcd' password. source code 1: use pdf::tk; $doc = pdf::tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk' ); $doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' ); getting error: error: unexpected command-line data: owner_pw expecting input pdf filename, operation (e.g. "cat") or "input_pw". exiting. errors encountered. no output created. done. input errors, no output created. pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 @ /usr/lib/perl5/site_perl/5.10.0/pdf/tk.pm line 73. note: created new pdf 'apps.pdf' document open password 'abcd' , permission password 'abcd123'. please let me know how resolve it. replace line "$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abc

c# - Parse float, decimal or double -

i'm in process of rewriting our flat file parser, ungeneric, attribute oriented thingy more modern fluent synstax thingy. have problem coming way deal floating point numbers given dto public class foo { public decimal decimalvalue { get; set; } } and flatfile 1234561234 you configure mapping this mapper.createmap<foo>() .map(f => f.decimalvalue) .decimal(10, 4); //length 10, precision 4 deserialize var result = mapper<foo>.read(flatfile); it result in foo object property value 123456.1234 i have working code this, hardcoded decimal values only. i'm trying find generic way this. 1 problem there no generic constaint floating numbers. the generic map method above example public propertymapresult<ttype, tproperty> map<tproperty>(expression<func<ttype, tproperty>> expression) { var result = new propertymapresult<ttype, tproperty>(this, expression); propertymappers.add(result);

python - kivy syntax error - conditions inside widget_add -

i have got syntax error in kivy application. because can't have conditions inside widget_add? how can make work this? def status(what): object = self.add_widget( label( text='you selected '+object+', please wait...', size_hint=(.3, .1) if object == "car": pos_hint={'center_x': .3, 'center_y': .6} elif object == "tree": color = (1,0,0,1), pos_hint={'center_x': .7, 'center_y': .6} ) ) error: running "python.exe c:\users\somebody\desktop\kivy\test.py" \n file "c:\users\slugma\somebody\kivy\test.py", line 51 if object == "vnc": ^ syntaxerror: invalid syntax you correct, cannot have conditionals inside function's arguments. move if...elif conditional outside (just af

recursion - C++ deep copy a linked list resursively -

i c++ beginner trying write function create deep copy of linked list in c++. function calls until @ last node in source list, copies node. when run segmentation fault or exc_bad_access error. here have far: struct node { int data; node* next; }; void copy_list(const node*& source_ptr, node*& dest_ptr) { if (dest_ptr != nullptr){ clear_list(dest_ptr); } if (source_ptr == nullptr) return; //we cleared dest_ptr if (source_ptr->next == nullptr) // last node { dest_ptr = new node(); //initialize in memory dest_ptr->data = source_ptr->data; //copy last datum dest_ptr->next = nullptr; //since end return; } const node* cursor = source_ptr->next; // happens if source not yet @ end copy_list(cursor, dest_ptr->next); } i know there other questions similar this, haven't helped me. have tried using other methods recursion example while loop looks like: dest_ptr = new node(); dest_ptr->data = source_ptr->data; node* d

java - ExecutorService terminated, but the JVM did not -

Image
i submit tasks executors.newfixedthreadpool(3) , run , complete successfully. call executorservice.shutdown(); executorservice.awaittermination(2000, timeunit.milliseconds); check via executorservice.isshutdown() executorservice.isterminated() and twice true back. main thread exits, jvm stays alive. there's no awt thread or alike, can see 3 pool threads, destroyjavavm , , com.google.inject.internal.util.$finalizer . the finalizer prime suspect, if wasn't deamon thread. suspended 2 threads image actually, i'd expect pool threads long gone, because of isterminated == true . idea waiting for? it seems debug image service not alone it's named pool-2 . might have executorservice still running pool-1 prevents jvm exit.

JavaFX check if it is full screen -

hey want check if application full screen or not use javafx how can it? i have tried getfullscreenexitproperty not work. you can check using isfullscreen available in stage primarystage.isfullscreen()

Read phone number from Android Device in Eclipse -

i wanted read phone number of sim card inserted android phone in eclipse project. have tried telephone manager class since reads device phone number, in of devices unknown , string retrieved using getline1number() of telephonemanager class unknown or null. is there other way or workaround can done in order read phone number sim api or changing phone number in device information in phone menu in android phone.

angularjs - In Angular.js, where are $stateParams set? -

i learning angular.js through mean.io, has articles package example. in articles controller see line articleid: $stateparams.articleid : $scope.findone = function() { articles.get({ articleid: $stateparams.articleid }, function(article) { $scope.article = article; }); }; see full code here . i wondering , how articleid set in $stateparams . , how $stateparams set? update: in useful link provided samitha says: "in state controllers, $stateparams object contain params registered state." so did articleid registered "with state"? finding code helpful. as samitha menthoned, code uses ui-router , right? from document, articleid set url. https://github.com/angular-ui/ui-router/wiki/url-routing#url-parameters https://github.com/linnovate/mean/blob/master/packages/articles/public/routes/articles.js#l50 for example, when access http://<your domain>/articles/1 then $stateparams.articleid => 1

java - Android duplicate class error when including Apache POI -

i've got problem apache poi excel api (xlsx). i'm using android studio , i've added poi libs "libs" folders. error popping reason (see below). how solve it?, please explain how identified issue? xmlbeans-2.6.0, poi-ooxml-schemas-3.10.1-20140818, poi-ooxml-3.10.1-20140818, poi-3.10.1-20140818, log4j-1.2.13, junit-4.11, dom4j-1.6.1, commons-logging-1.1, commons-codec-1.5 thanks! my build.gradle looks following (excluding generic other stuff)... dependencies { compile filetree(include: ['*.jar'], dir: 'libs') } android { packagingoptions { exclude 'meta-inf/license' exclude 'meta-inf/notice' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' } } my app.iml has no duplicate entries either... error error:class org.apache.xmlbeans.xml.stream.location has been added output. please remove duplicate copies. compiler did not

osx - Vala + Gtk doesn't work in mac os x -

i installed vala via homebrew , compiled normal hello world app in osx 10.9.3. error-message report: ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgtk-3.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgtk-3.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgio-2.0.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgio-2.0.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libatk-1.0.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libatk-1.0.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgdk-3.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgdk-3.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgdk_pixbuf-2.0.dylib, file built i386 no

python - Return data to ajax function data shown in below format -

using jsondump in python need send response ajaxpage object format in python shell show in below image how use java server object notation function send response //view output data [<userpost: userpost object>, <userpost: userpost object>] //this django view def load_scroll_posts(request): if request.method == 'post': post_id = request.post['post_id'] loaded_posts = userpost.objects.filter(id__gte = post_id) return httpresponse(json.dumps({'up':loaded_posts})) //this ajax function function load_remain_user_posts() { var post_id = $(".message_box:last").attr("id"); var csrftoken = getcookie('csrftoken'); $.post('/theweber.in/load_m',{ post_id ':post_id,' csrfmiddlewaretoken ':csrftoken}, function(data){ //console.log(data) var obj = json.parse(data); console.log(obj) }); } in console nothing displaying

java - Parse Swift syntax to Android -

i had trouble trying retrieve user based on search distance, , have received great support community. code boiled down following: let userlocation = pfgeopoint(latitude: userlatitude, longitude: userlongitude) query.wherekey("location", neargeopoint:userlocation, withinkilometers: 100) the issue code tailored swift/xcode, , when tried "converting to" android came down to query.wherewithinkilometers("location", parsegeopoint point, 100); i not sure if proper way of writing in java (android), , not sure parsegeopoint point. i have looked https://parse.com/docs/android/api/com/parse/parsegeopoint.html , bit stuck. if need clarification, let me know. thanks update: below how store location point of current user parse @override public void onlocationchanged(location loc) { // todo auto-generated method stub double lati = loc.getlatitude(); double longi = loc.getlongitude(); parseuser c

ipad - How to resize view using UIModalPresentationFormSheet on iOS 8 -

looks old workaround resizing view (from sheet style) doesn't work on ios 8. any other solutions ? for example, below code works on ios 7, not ios 8. uiviewcontroller *viewcontroller = [[uiviewcontroller alloc] init]; uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller]; navigationcontroller.modalpresentationstyle = uimodalpresentationformsheet; navigationcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve; [self presentviewcontroller:navigationcontroller animated:yes completion:nil]; navigationcontroller.view.superview.frame = cgrectmake(0, 0, 800, 544); navigationcontroller.view.superview.center = self.view.center; finally found solution on ios 8, need implement -(cgsize)preferredcontentsize on each view controller.

Is there any difference in HBase performance when a value is used as column name? -

in hbase, there difference in performance or other aspects when store value in column or use value column name? ex: <table>:<column-family>:<column-name>=<value> vs <table>:<column-family>:<column-name>:<value>=1 what's recommended use in scenarios? it depends on data , need extract it! if you're having database list of equipments , associated sensors : id - label - sensors 1 - k200 - 1,2 2 - k300 - 1,2,3 id - label - sensor_1 - sensor_2 - sensor_3 1 - k200 - 1 - 1 - 0 2 - k300 - 1 - 1 - 1 in opinion first design better, don't have store 0 unlike second design, depends on information need extract. if want check equipment integrating sensor type 1 second design better because you're going read column on each row whereas first design you'll have process data ... if you're asking type of sensor available each equipment first design better ... try list need know data

python - My Django form renders always with type='hidden' -

i did https://docs.djangoproject.com/en/1.7/topics/forms/ , after html page rendered, form hidden. , source code html following: <form action = "/blogcore/register/" method = "post"> <input type='hidden' name='csrfmiddlewaretoken' value='0afx5lrzm4qdp5cfhozbqsohgeipkwn4' /> <input type = "submit" value = "next" /> how can make form display? the form not hidden. csrf token hidden, correct.

c# - concurrency Control for inserting records based on previous transaction -

i having situation in have make entries tablea tableb such need counter-balance entries. example: tablea id name 1 2 b 3 c if no entries in tableb of table user,i add entries in tablea user1 as id tablea_id userid 1 1 1 2 2 1 3 3 1 for anther user user2, need check entries of lastuser , find out entry made first. entry made first made @ last next user. as id tablea_id userid 1 1 1 2 2 1 3 3 1 4 2 2 5 3 2 6 1 2 similiar next user enteries 7 3 3 8 1 3 9 2 3 problem here users may request @ same time , need implement locking mechanism handle it. user's request, need find entries last user. table must locked until user makes entries in tableb. in short want control concurrency. please suggest how implement it. better if not effect entries tablec tableb.

c# - get html response from local aspx page -

i have local .aspx page generate html message. when try request page using code html = new webclient().downloadstring("http://localhost/mysite/htmlemail.aspx") it returns html without passed data through session. if tried request page directly browser, displays html page passed data. so why doesn't fill html message data when programmatic request page ? it returns html without passed data through session not if that's request being made, doesn't. session used track data across multiple requests made particular client. (effectively creating server-side "session" client.) if you're requesting 1 page 1 time there's no session state tracked in first place. if you're making other requests (not shown in question) , server-side application isn't tracking session state problem may in server-side application, not in client. if you're making other requests as client that's different session. different cl

Optimizing/Streamlining Excel VBA for Deleting empty columns -

i've been using code below jonhaus.hubpages.com remove empty columns have. 'delete empty columns dim c integer c = activesheet.cells.specialcells(xllastcell).column until c = 0 if worksheetfunction.counta(columns(c)) = 0 columns(c).delete end if c = c - 1 loop however, i've been writing vba, it's gotten kinda bloated , slow... i'm trying optimize , streamline code eliminating loops, copy/pastes, etc. do y'all have suggestions code same thing (deleting entire emtpy columns) without requiring looping "do until/if/end if/loop" statements? references: http://jonhaus.hubpages.com/hub/excel-vba-delete-blank-blank-columns http://www.ozgrid.com/vba/speedingupvbacode.htm expanding on comment above, create range inside loop, delete once. dim c integer dim rngdelete range c = activesheet.cells.specialcells(xllastcell).column until c = 0 if worksheetfunction.counta(columns(c)) = 0 

r - Creating Repeated Start and End Dates -

i have data set many variables. of interest are: id, episode, start, end, assessment date. example data set shown id episode start end assessmentdate 1 1 1/1/2012 12/21/2012 1/1/2012 1 1 1/1/2010 12/21/2012 12/12/2012 1 1 1/1/2010 12/21/2012 12/21/2012 1 2 1/1/2013 . 1/2/2013 1 2 1/1/2013 . 2/2/2013 1 2 1/1/2013 . 3/2/2013 2 1 1/1/2012 . 4/1/2012 2 1 1/1/2010 . 5/12/2012 2 1 1/1/2010 . 6/21/2012 2 2 1/1/2013 . 7/2/2013 2 2 1/1/2013 . 8/2/2013 2 2 1/1/2013 . 9/2/2013 i have start dates everyone, not end dates. want identify end date each episode , each patient, 10,000 patients. want end date last date of assessment per episode number, , want present each row between first , last assessment dates.

php - Get variable isn't written to database -

i've got code $cislonakupu=$_get['cislonakupu']; if($_request['command']=='update'){ $datum = date("j/m/y h:i:s", time()); $user1=mysql_query("select * `register` `username`='$session'"); $mu=mysql_query("select * `velikostiobj` `objednavkac`='$cislonakupu'");$cislonakupu=$_get['cislonakupu']; $customerid=mysql_insert_id(); $date=date('y-m-d'); $orderid=mysql_insert_id(); $max=count($_session['cart']); for($i=0;$i<$max;$i++){ $pid=$_session['cart'][$i]['productid']; $q=$_session['cart'][$i]['qty']; $price=get_price($pid); $cp=$_post['cp']; $velikots=$row['velikost']; $n= date('j/m/y h:i:s', strtotime($date. ' + 14 days')); while ($row=mysql_fetch_array($mu)) { $resultik=

Can I automatically generate Select queries on Visual Studio similar to what SQL server management studio does? -

i had sql server management studio on computer , used explore company's database using it. when building queries easy right click on table , 'select top 1000' rows. take code , modify it. save me time typing field names example. now have ms visual studio , can't install server management express. can explore database , can right click on table , view records. however, not able generate select query automatically. how can create these queries automatically , there way visually design sql query? on visual studio, if go tools -> server explorer , add db connection, can mimic management studio option generate sql db objects...

performance - Can we add multiple attributes to a node in a single LDAP operation -

suppose have node user in ldap , want multiple attributes in 1 ldap operation i.e. single update operation.is possible? any pointers helpful. note : using tds. sure, like: dn: cn=barney fife,ou=people,dc=example,dc=com changetype: modify add: telephonenumber telephonenumber: 555-1212 telephonenumber: 555-6789 - add: manager manager: cn=sally nixon,ou=people,dc=example,dc=com many examples can found google ldif examples. i assume tds tivoli directory server , should work fine. -jim

Approximate Minimal Set Cover Python -

i have list of lists each list contains edge lengths of polygon. example: [[0, 1, 2], [0, 1.1, 2], [0, 1.2, 2], [0, 1.3, 2], [4.5, 1.1], [4.4, 1.1], [5, 1, 2], [5, 1.1, 2], [5, 1.2, 2] [6, 1, 7, 4], [6, 1.1, 7, 4.1]] i able find approx minimum "cover" in sense each element of "cover" of it's values within specified tolerance of elements covering. example, if tolerance .1 given list above get: [[0, 1, 2], [0, 1.2, 2], [4, 1], [4.5, 1.1], [5, 1.1, 2], [6, 1, 7, 4],] i new python use of terminology isn't far off. perhaps helpful explain motivation.i architect trying optimize given surface panelization. because of manufacturing tolerances panels edges lengths differ fixed amount can considered same(in example above edges can differ .1 , still considered same). trying find minimum set of panels produced , still panelize surface. to find optimal solution here computationally quite difficult -- seem asking something, doesn't

c - How to determine integer types that are twice the width as `int` and `unsigned`? -

values of intermediate multiplication typically need twice number of bits inputs. // example int foo(int a, int b, int carry, int rem) { int2x c; // type twice wide @ `int` c = (int2x)a * b + carry; return (int) (c % rem); } considering potential padding, (which appears limit sizeof() usefulness) , non-2`s complement integers (which limits bit dibbling), ... does following create needed type? if not, how code @ least reasonable solution, if not entirely portable? #include <limits.h> #include <stdint.h> #if long_max/2/int_max - 2 == int_max typedef long int2x; typedef unsigned long unsigned2x; #elif llong_max/2/int_max - 2 == int_max typedef long long int2x; typedef unsigned long long unsigned2x; #elif intmax_max/2/int_max - 2 == int_max typedef intmax_t int2x; typedef uintmax_t unsigned2x; #else #error int2x/unsigned2x not available #endif [edit] qualify:"always", if long , long long , intmax_t , not work ok #err

android - Relative Layout with HorizontalScrollView -

i trying set imagebuttons in horizontal scroll view appears under frame layout. below have done far. however, scrolls everything, including frame layout. how avoid that? or in way @ it, i'm trying take navigation drawer , lay down instead of popping out side? maybe there's way replicate that? overall goal looks similar old blackberry scroll menu. <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".dmactivity"> <horizontalscrollview android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent&quo

gruntjs - loadPath in Gulp -

i've got bourbon , neat installed via bower (in /bower-components folder) , wondering if able call them in .scss files so, using gulp. @import 'bourbon'; i've switched on grunt , wondering if gulp had similar loadpath option. i'd use reference bower directory in gruntfile.js, below: sass: { dist: { options: { style: 'expanded', loadpath: '<%= app %>/bower_components/foundation/scss' files: { '<%= app %>/css/app.css': '<%= app %>/scss/app.scss' } } } any appreciated. in advance! i ended using gulp-ruby-sass , while bit slower gulp-sass rich features, such loadpath.

javascript - How do I grow a PaperJS tree without crossed branches, and without it spasming? -

i'm trying use paperjs physics code generate dendrite-y tree shape of 350 nodes sprout out of single "origin" node. i've been able of way there simulating 3 forces: springs between each node , parent tighter springs between each node , origin node, put nodes in concentric circles around origin node. nodes 1 generation 1 unit away origin, nodes 2 generations away 2 units, etc. gentle inverted gravity between nodes spread them out. i add each node click of mouse. works great while, inevitably 2 things happen: a node sprouts such branch crosses branch. need avoid branches crossing. at 50 nodes, origin node starts vibrate. adding more nodes exacerbates condition. whole dendrite spasms violently and, after node or 2 added, disappears. i'm stumped how solve these 2 problems. can advise? code can viewed , run here . click "project index" on top row.

swift - Saving highscores with NSUserDefaults -

i'm trying save highscore of game. i'm trying via nsuserdefaults . code i'm using: //to save highest score var highestscore:int = 20 nsuserdefaults.standarduserdefaults().setobject(highestscore, forkey:"highestscore") nsuserdefaults.standarduserdefaults().synchronize() //to saved score var savedscore: int = nsuserdefaults.standarduserdefaults().objectforkey("highestscore") int println(savedscore) but error nsuserdefaults saying "expected declaration" , can't figure out how implement this. or should using nsarchiver this? , if case how implement this? use nscoding. create swift file "highscore" import foundation class highscore: nsobject { var highscore: int = 0 func encodewithcoder(acoder: nscoder!) { acoder.encodeinteger(highscore, forkey: "highscore") } init(coder adecoder: nscoder!) { highscore = adecoder.decodeintegerforkey("highscore") }

Hide starred items in github -

how can hide starred items other people in github? not interested in sharing starred items followers. checked github preferences not found relevant. you cannot hide you've starred on github. once it's starred, it's out there.

xcode - OSX Installer Packages: How can I give a choice for language of installation in the installer of my app? -

i have used pkgbuild , productbuild create installer app , working correctly. have license files in different languages (english, japanese, french). how can allow users choose read license file of choice? think need specify in distribution.xml file, in "license" tag. can specify multiple files there? i remember utility "packages.app" supports adding language files readme/licence/etc, can try create test product , whatch does. you can here (it's free) : http://s.sudre.free.fr/software/packages/about.html ps: i'm not sure user can "choose" language of installer in os x, think system language determines 1 use

android - How can I slide the layout with action bar? -

how can slide layout action bar ? right navigation drawer list appear below action bar, want overlap action bar onclick of navigation drawer icon; can this? for can use sliding pane layout here link https://github.com/cricklet/android-paneslibrary/tree/master/example you can slide layout action bar have make sliding pane , navigation drawer in 2nd view after implement example , here link navigation drawer http://www.codeofaninja.com/2014/02/android-navigation-drawer-example.html combine these examples can lot!!

excel vba - Copy a line to a DB sheet based on a calculated trigger -

after trying few different approaches stuck. have table line completed every 30 mins or so. user enter 3 numbers in row, next 3 rows calculated. use 1 of calculated rows trigger copy entire row db sheet (sheet2). , repeat when next line added , on. can seem 1st line copy across every time. the sheet used hardcopy batch record have shied away building form. started following, worked line 1 (also calling recorded macro copy in header data) `private sub worksheet_calculate() if isnumeric(range("$h$9")) if range("$h$9").value >= 1 application.run "macro1" end if end if end sub ` macro1 copying of header form data (date/time,machine info etc entered once sheet & row described above). i hope clear, questions please let me know welcome so try using loop below? change upper limit of i want, , maybe use form of row counter cells(rows.count, 1).end(xlup).row private sub worksheet_calculate() dim integer = 1 9000 if

php - How can I show tr with same class in same tbody -

i have: <tbody> <tr class='default'></tr> <tr class='sample'></tr> <tr class='sample'></tr> <tr class='sample'></tr> <tr class='default'></tr> </tbody> all of classes coming foreach loop in same sequence. want display tr default class in separate tbody , tr sample class in different tbody below <tbody> <tr class='default'></tr> <tr class='default'></tr> </tbody> <tbody> <tr class='sample'></tr> <tr class='sample'></tr> <tr class='sample'></tr> </tbody> how can so? you can define styles tbody's , have tr's styled depending on parent: html: <tbody class="default"> <tr></tr> <tr></tr> </tbody> <tbody class="sample"> <tr>

constructor - How to define a ctor for a struct in F# that in turn calls the struct's default ctor -

how define ctor immutable struct in f#, accepts of fields. or, compared c# how zero out struct (like calling this() in c# example below) in f# ? c# struct point { private readonly int _x; private readonly int _y; public point(int x) : this() // 0 struct { _x = x; } public point(int y) : this() // 0 struct { _y = y; } } the point(x) ctor above zeros out struct calling this() , sets single field. after. following example simplified, question how 0 struct , set single field. f# type point = struct val x: float val y: float new(x: float) = ? // how 0 out struct , set x ? end i think f# version of c# code this [<struct>] type point = val mutable x: float val mutable y: float let p = point(x = 1.0) although struct members mutable, p not cannot set members again. // cause compile error p.x <- 2.0

javascript - choose default view with PDF objects -

Image
i using html 5 object tags embed pdfs on pool teams website. on safari, pdf automatically fits width i've assigned div pdf displays in. on chrome, pdf size set fullsized, looks zoomed @ first. here's code <object data="docs/pool schedule.pdf?#view=fith" type="application/pdf" width="660" height="440"> <param name="view" value="fith" /> </object> i have added parm tag appended ?#view=fith in attempts default view. neither seems . i'm wondering if there's way default browsers fit width view (screenshot 2). if want view website, it's kingston8ball.com note: realize both photos chrome, simplicity took second screenshot same browser , desired view rather switching browsers. this isn't answer looking in question, it's alternative solution minimal effort. ended using viewer js . tool copy js source files root of website , add following line html files wan

android - Need to find out, an application has installed already on the same device? -

i need implement trial period on application. once trial period over,if user tries uninstall , install application again, case had write 1 file on sdcard, if user re install application. when open application had shown activation key prompt. if user delete file,they can re install , use application normally. how solve case. there other way hold application install details in android device. note: application offline application.it won't need connect internet.(so there no way register server). take of way. store on phone able edited/removed/added. best approach kind of problems use webservice register device , check it's register date. since application offline there no way foolproof.

php - Can a SQL table have a symbolic link or alias? -

i have table called news , want add tutorials . rather create table called tutorials want use news table since structure exact same. possible rename table "posts", create sort of alias or symbolic link table called "news" can still queried? i'm trying avoid having modify source code have lot of php files , modifying every file contains sql query slow , error prone. i have looked sql aliases seem temporary things require me modify existing sql queries. i running mysql on centos. have root access server. a view solved problem. renamed news table posts created view following query. create view news select * posts this created virtual table called news. content of exact same. added new rows posts , showed when ran query selecting row news.

.net - Static pointer to Dynamic Address not working (x64) -

i dealing dynamic memory address when tried making game trainer in vb.net programming experience. first time using static pointer point dynamic memory address holds value of ammo clip in game. had run several scans find pointer (0x38bb640) or &h38bb640 in vb.net. 64-bit game had make target cpu x64 while compiling software using .net 4.5. otherwise i'd message saying "32-bit application cannot access memory 64-bit application" in code have makes sense me. have no idea why isn't working properly. return value 0 every time. if add pointer manually in ce offsets 0x30 0x0 0x98 works fine. private function findaddress(byval phandle intptr, byval baseaddress intptr, byval staticpointer intptr, byval offsets() intptr) intptr ' create buffer 4 bytes on 32-bit system or 8 bytes on 64-bit system. dim tmp(intptr.size - 1) byte dim address intptr = baseaddress ' must check 32-bit vs 64-bit. if intptr.size = 4 address = new intpt

python - Pygame: Rect Objects Don't Render Properly in For Loops -

i'm using pygame develop game , i've decided i'd group gui objects in dictionary so: gui_objects = { # guiobject parameters define rect (for positioning) , background colour. "healthbar" : guiobject((10, 10, 100, 20), colour.blue), "mini_map" : guiobject((10, 400, 50, 50), colour.white) } the reason i'm grouping gui objects can modify them like: gui_objects.get("mini_map").set_enabled(false) now, when want render gui objects screen, did this: for key, value in gui_objects.iteritems(): value.render(screen) this works, reason, white "mini_map" guiobject gets rendered underneath "healthbar" guiobject. decided put "mini_map" above "healthbar" in dictionary, changed nothing. here's weird part. if render gui objects separately, is, calling render() functions separately, this: gui_objects.get("healthbar").render(screen) gui_objects.get("mini_map" )

Google adds suffix to title -

i wondering why google adds suffix website, don't know why specific word. website talking has sub domain. keep post free of ads, let's domain is: http://sub.my-name.com/ so when search website on google this: "lorem ipsum| specific page title - my_name " original page title: <title>lorem ipsum | specific page title</title> maybe google got word here, why?: at bottom / footer of each website include following code: <div class="container"> <p class="any-class"><b>my_name</b> </p> </div> the main website http://my-name.com/ has following code: <div class="title"> <h1 class="title-text">my_name</h1> <p class="title-sub"><b>this is</b>a subtitle</p> </div> and <title>my_name</title> where , why did google word from? how can change suffix (if possible). thanks

python - joining external threads blender -

the following code supposed create 2 threads. first 1, after other has finished second. import bpy import os import subprocess import texturechange1 import texturechange2 import threading #run texture changes , save files t1 = threading.thread(target = texturechange1) t2 = threading.thread(target = texturechange2) t1.start() t1.join() t2.start() t2.join() texturechange1 and texturechange2 python scripts change texture of given object , save blender file. they each have command bpy.ops.export.sketchfab() , creates separate thread uploading sketchfab. the error that, whereas texturechange1 and texturechange2 change texture , save respective files, texturechange2 is 1 uploaded sketchfab. given error texturechange1 is: please wait till current upload finished is there way of applying join() to threads created other threads?

python - How to create columns header and its labels with QTableView -

Image
the code below creates simple qtableview header , 3 qstandarditem s. question : how make header have 3 columns labeled "column 0", 'column 1" , "column 3"? import os,sys pyqt4 import qtcore, qtgui app=qtgui.qapplication(sys.argv) class window(qtgui.qtableview): def __init__(self): super(window, self).__init__() header=qtgui.qheaderview(qtcore.qt.horizontal, self) self.sethorizontalheader(header) model=qtgui.qstandarditemmodel() in range(3): model.appendrow(qtgui.qstandarditem('item %s'%i)) self.setmodel(model) self.show() window=window() sys.exit(app.exec_()) use model = qtgui.qstandarditemmodel(0,3) # 3 columns model.sethorizontalheaderlabels( [ "column 0", "column 1", "column 3"] )

ios - CPU usage dropping as UIScrollView gets larger? -

experiencing strange phenomenon. app built around vertical uiscrollview (i.e. "the feed") activity timeline facebook's. when user scrolls bottom, feed can load older items in blocks of 20. the first 0-20 items (default load) scroll fast , continues scroll fast when items 20-40 added, performance degrades when items 40-60 added , app becomes unusable when 60-80 added. what's extremely odd cpu usage during entire scenario: 20 feed items (default): cpu 65% 40 feed items: cpu 40%, thread 1 activity down 25% (eyeballing) 60 feed items: cpu 18%, thread 1 down 50% previous 80 feed items: cpu 7%, thread 1 down 50% previous again this leading me believe lack of performance not size of scroll view else causing cpu disengage in strange way. you'd expect cpu utilization increase, not decrease. i thought perhaps inadvertently adding new feed items not on main thread , somehow screwing up, that's not case. any thoughts? fyi (iphone 5 running ios8,

php - ReflectionException Class Larabook\Forms\RegistrationForm does not exist -

Image
unable move on, i'm following laracasts tutorial of larabook cannot move on i'm facing exception screenshot attached, plus i'm pasting code <?php // registrationform.php location larabook\app\forms namespace larabook\forms; use laracasts\validation\formvalidator; class registrationform extends formvalidator{ /* validation rules */ protected $rules = [ 'username'=>'required|unique:users', 'email'=>'required|email|unique:users', 'password'=>'required|confirmed' ]; } <?php // controller use larabook\forms\registrationform; class registrationcontroller extends \basecontroller { /* show form register user */ private $registrationform; function __construct(registrationform $registrationform){ $this->registrationform = $registrationform; } public function create(){

Ftp Polling as service in Spring Integeration -

in application.i need poll files ftp server.but current load less per day 2-3 files.so don't want service run , uses resources. is there in build or little customization can start/stop ftp polling on demand. want ftp polling service in unix. when required stop/start. am using spring integration's int-ftp:inbound-channel-adapter not sure if issue keep object in java heap , don't affect gc... if have such low polling interval can use cron option on <poller> run polling task once-twice day. from other side can, of course, start/stop spring integration endpoint using id , lifecycle start/stop management operations. in addition can expose endpoint jmx , start/stop them there, or rely on control bus in app same.

eclipse - lein ring uberwar command NoClassDefFoundError -

i'm having hard time war generated using eclipse. first, i'm trying deploy clojure app aws via elastic beanstalk. i'm open suggestions on how (ie via lien beanstalk) wanted keep simple , create war upload/deploy elastic beanstalk (on tomcat platform). elastic beanstalk sample app running. i'm using windowsx64, eclipse luna , jre8 counterclockwise 0.27.1 i created project using eclipse , compojure leinengen template. here project clj file: (defproject aws-test "0.1.0-snapshot" :description "fixme: write description" :url "http://example.com/fixme" :dependencies [[org.clojure/clojure "1.6.0"] [compojure "1.1.8"]] :plugins [[lein-ring "0.8.11"]] :ring {:handler aws-test.handler/app} :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring-mock "0.1.5"]]}}) here code in handler.clj file: (ns aws-test.handler

c# - Remove stylecop msbuild integration -

i have solution 80 projects in it. each project has stylecop msbuild integration enabled: <import project="$(msbuildtoolspath)\microsoft.csharp.targets" /> <import project="$(programfiles)\msbuild\microsoft\stylecop\v4.4\microsoft.stylecop.targets" /> i need remove projects. there way short of checking out , hand-editing each , every .csproj file? the stylecop target, defined in microsoft.stylecop.targets conditional on property stylecopenabled . here snippet microsoft.stylecop.targets: <!-- define target: stylecop --> <target name="stylecop" condition="'$(stylecopenabled)' != 'false'"> <message text="forcing full stylecop reanalysis." condition="'$(stylecopforcefullanalysis)' == 'true'" importance="low" /> ... snip ... the quick way disable stylecop pass global setting stylecopenabled . e.g. if building command line, comman

python - Why is my if else statement being ignored -

so i'm writing code searches dictionary user inputed key. so, have user type in desired key, have definition key appended list, , printing list. for odd reason if seracht in dictionary line gets ignored. program jump else, skips if. have removed else verify if work. ideas on why adding else ignores if? import csv def createdictionary(): dictionary = {} found = [] searcht = input("what seraching ") fo = open("texttoenglish2014.csv","r") reader = csv.reader(fo) row in reader: dictionary[row[0]] = row[1] if searcht in dictionary: found.append(dictionary[row[0]]) print(found) elif searcht not in dictionary: = 0 #print("nf") #exit() print(found) return found createdictionary() you should populating dictionary first, start looking things up. fortunately, trivial in case: def create_dictionary(): open("t

c# - Entity Framework - Unit Of Work - Sharing the context -

i'm developing asp.net mvc application using latest entity framework version , have strange behaviour. i share context through different repositories, way can call savechanges anywhere in project, , changes on repositories being changed. public unitofwork(idbcontext context) : base(context) { versioningrepository = new repository<versioning>(context, this); settingrepository = new repository<setting>(context, this); siterepository = new versionedrepository<site, int>(context, this); pagerepository = new versionedrepository<page, int>(context, this); layoutrepository = new versionedrepository<layout, int>(context, this); assemblyrepository = new versionedrepository<assembly, int>(context, this); logrepository = new repository<log>(context, this); } now, when i'm starting application , fire multiple tabs requesting same page @ same time following error might popup: an exception of type '