Posts

Showing posts from February, 2012

amazon web services - Mimicking WHM backup rotations with S3 Lifecycle -

i'm setting new managed vps server amazon s3. whm has s3 backup natively implemented now, does not support deletion/rotation . i'd keep set of backups this: 2 daily backups in s3 1 weekly backup in s3 4 weekly backups in glacier 12 monthly backups in glacier yearly backups in glacier after whm backups run, s3 bucket contains file structure: yyyy-mm-dd/ accountname1.tar.gz accountname2.tar.gz accountname3.tar.gz i might want different backup rules different accounts (some more active, less so). given how many whm accounts using s3 backup, surely solved problem? searched stackoverflow , google, i'm not finding info on how use s3 lifecycle other "move files older x." if isn't feasible, feel free recommend different whm backup strategy (though host's custom offsite backup prohibitively expensive, not option). use different folders (s3 path) different file types. create lifecycle rule on path. tim

excel - VBA on change event ruins the ListObjectTable on extending rows -

my code works listobject.table , intended allow editing prices , calculating discounts or vice versa... on entering cell editing turns formula therein value , pastes formula in column. it works charm when user editing cells. if user tries add rows listobject.table, macro ruins table. adds couple of columns , headers replaced. is possible make macro somehow disregard operation of adding new rows or extending range of data.table? here macro, thank friends advice: private olistobj listobject private sub worksheet_beforedoubleclick(byval target range, cancel boolean) set olistobj = worksheets("quotation").listobjects("tblproforma") application.enableevents = true if not intersect(target, olistobj.listcolumns("price").databodyrange) nothing application.enableevents = false application.autocorrect.autofillformulasinlists = false target.formula = target.value application.enableevents = true end if if not intersect(t

DSpace XMLUI Batch-Importer: Import fails (No such file or directory) -

still failing @ trying batch-import simplearchiveformat-zip file via xmlui. error message i'm getting import failed /home/dspace/dspace/imports/import.zip/item_001/dublin_core.xml (no such file or directory) . odd, since creating directories, creating mapfile , unzipping files seems work right (see dspace.log , output monitoring "imports"-dir below). dspace.log 2016-01-07 14:46:55,800 info org.dspace.app.itemimport.itemimport @ created org.dspace.app.batchitemimport.work.dir of: /home/dspace/dspace/imports 2016-01-07 14:46:55,824 info org.dspace.app.xmlui.aspect.administrative.flowbatchimportutils @ attempt uibatchimport collection: fakultätsratsprotokolle der fakultät für geisteswissenschaften, zip: import.zip, map: /home/dspace/dspace/imports/import.zip8386418726670935229.map 2016-01-07 14:46:55,825 error org.dspace.app.itemimport.itemimport @ unable create contents directory: /home/dspace/dspace/imports/import.zip/item_001/ 2016-01-07 14:46:55,825 info org.d

antlr4 - Inheriting from Own class instead from XMLParserRuleContext -

i using 'visitor' pattern generate xml parsed code. on typical context class looks like: public static class on_dtmcontext extends parserrulecontext { public list<fieldcontext> field() { return getrulecontexts(fieldcontext.class); } public terminalnode on() { return gettoken(src_rep_screenparser.on, 0); } public on_dtm_headercontext on_dtm_header() { return getrulecontext(on_dtm_headercontext.class,0); } ..... } and access element in visitors call function using rulecontext's 'gettext' member function. write class inheriting 'parserrulecontext' , overload 'gettext' in order replace characters '<' or '>' xml escape sequences. there way can have code generated , having context classes inheriting class, as: public static class on_dtmcontext extends xmlparserrulecontext { public list<fieldcontext> field() { return getrulecontexts(fieldcontext.class); } pub

Magento Cart Rule BUG - Wrongly applied when "less than" and configurable product -

i found out magento seems have bug since 1.8 relating cart rules. let's have configurable products , want add "discount" specific product if qty less 50. in case surcharge not discount (you can add negative discount it'll surcharge changing 2 files see http://php.quicoto.com/extra-fee-shopping-cart-price-rules-magento/ ). so magento do? 1) checks if rule valid product 2) if not checks if configurable product, takes first simple product, , check rule against that. in case true cause qty less 50 ( cause simple product not in cart.... ) extending rule "less 50 , more 1" didn't worked. $product = $object->getproduct(); if (!($product instanceof mage_catalog_model_product)) { $product = mage::getmodel('catalog/product')->load($object->getproductid()); } // here, everythign correct. $valid false cause item less x times in cart.. $valid = parent::validate($object); // part makes no sense, cause

canvas - Cocos2d ClippingNode and Alphathreshold in Javascript / Browser -

i trying tp use png mask in cocos2d-js so: this.mask=cc.sprite.create(cache.getspriteframe("bar_mask")); this.maskedfill = cc.clippingnode.create(this.mask); this.maskedfill.setalphathreshold(0.5); but not work ... found in other posts, have enable stencil buffer ccsetupdepthformat: @gl_depth24_stencil8_oes but have no idea how / in cocos2d-js can help? thanks! it works me without additional depthformat settings. i'm using single-file engine cocos2d-js-v3.7.js here's minimal code (hope helps): var game = cc.layer.extend({ init:function () { this._super(); backgroundlayer = cc.layercolor.create(new cc.color(40,40,40,255), 320, 480); var target = cc.sprite.create("resources/doge.png"); /*child clip*/ var mask = cc.sprite.create("resources/doge-mask.png"); /*mask*/ var maskedfill = new cc.clippingnode(mask); maskedfill.setalphathreshold(0.9); maskedfill.addchild(target); maskedfill.setpos

c# CSV text file to single string (or array or list ) then add to or alter each string and output to single string variable -

i using c# datagridview multiple rows (which may vary based on user input ) export plain text file result : compname,poweron,thin,storage,acceptlic,verify,ssl,c:\test\myfile.img,root,p@ssw0rd,192.168.1.100 compname,poweron,thin,storage,acceptlic,verify,ssl,c:\test\myfile.img,root,p@ssw0rd,192.168.1.100 compname,poweron,thin,storage,acceptlic,verify,ssl,c:\test\myfile.img,root,p@ssw0rd,192.168.1.100 //...and more lines if user adds more what parse file , load each line single variable append command line executable example: "c:\program files\mytest\mytest tool\mytest.exe" -n=compname --poweron -dmode=convert -volume=storage1 --acceptlicense --noverification --ssl c:\users\me\documents\down\myfile.img system1://root:mypassword@192.168.1.151 so question how done ? i have checked many examples , it's starting rather confusing method use produce required result. (streamreader, stringsplit,stringjoin , more..) i able contents of file build list using : list&l

.net - How I can modify InternalsVisibleTo in assembly using Reflexii? -

i modify internalsvisibleto attribute value in assembly? in reflector see [assembly: internalsvisibleto(assemblyname)] don't see assemblyinfo.cs can modify. if possible i'd change assemblyname in attribute name of native assembly. i think can't it. first value of attribute constant, couldn't changed via reflection. second cant change attributes of assembly.

c# - How to delete or not list my custom nuget package which is installed in my server -

can how delete custom nuget package have installed in nuget server. used following command push nugetpackage server nuget push "test.1.0.0.0.nupkg" -s "server" "pwd" or don't show nuget packages in manage nuget packages in visualstudio. thanks if talking nuget.org, can't. on nuget.org, can delist package, if knows id , version, can still pulled. if talking self hosted nuget server, question has been answere on here: https://stackoverflow.com/a/21933415/1120092

cpu usage - CPU memory access time -

does average data , instruction access time of cpu depends on execution time of instruction? example if miss ratio 0.1, 50% instructions need memory access,l1 access time 3 clock cycles, mis penalty 20 , instructions execute in 1 cycles average memory access time? i'm assume you're talking cisc architecture compute instructions can have memory references. if have sequence of adds access memory, memory requests come more sequence of same number of divs, because divs take longer. won't affect time of memory access -- locality of reference affect average memory access time. if you're talking risc arch, have separate memory access instructions. if memory instructions have miss rate of 10%, average access latency l1 access time (3 cycles hit or miss) plus l1 miss penalty times miss rate (0.1 * 20), totaling average access time of 5 cycles. if half of instructions memory instructions, factor clocks per instruction (cpi), depend on miss rate , dependency

javascript - Regex - match whole word in parsley.js -

how match 2 entire words or(|) operand in parsley.js' data-parsley-pattern attribute? as can see want match words user , moderator . i have tried: data-parsley-pattern="/(user|moderator)/" normal regex , works other standardised regular expression matching regex101.com: https://regex101.com/r/kd7sr1/1 your pattern should work, long using full form /.../ , otherwise pattern anchored. don't need parenthesis won't hurt either. here's working demo uses <input data-parsley-pattern="/user|moderator/" type="text" name="fullname" required>

ruby on rails 4 - ActiveModel::Serializer define attribute attributes? -

i'm trying implement json api rails app. requires attributes field defined. activemodel::serializer has method same name, hence class fooserializer < activemodel::serializer attributes :attributes def attributes { # filled } end end will override original method. ever possible add attributes field somehow? activemodel serializer has support json api out of box. need setup proper adapter. activemodelserializers.config.adapter = :json_api https://github.com/rails-api/active_model_serializers/blob/master/docs/general/adapters.md

memory management - Allocating Physically Contiguous Pages from User Space in Linux -

i need allocate physically contiguous pages user space , physical address. how can so? need physically contiguous because i'm working in-conjunction hardware needs that. get_free_pages understood kernel function , returns virtual address

ssms - SQL Server Management Studio Issues -

i accidentally deleted years of data in sql server management studio table. unfortunately person in position before me didn't up. nor did before tried fix issue. understand cannot retrieved sql have data need in separate file on desktop. anyway data , input table in sql? or there query can run input data again table? i'm not sure if making sense :/ you can used management studio without ssis. right click on database in ms , select tasks -> import data. should able select type of source (flat file) , format. rest of wizard pretty self-explanatory.

mule - Element set-payload is not allowed here -

i have simple configuration file used in functional test case works fine when in anypoint studio when using in intellij (my main ide) set-payload in red , hover test displays "element set-payload not allowed here" when running test following exception org.mule.api.config.configurationexception: line 17 in xml document url [file:/c:/dev/messaging/revenue-mule3-sms/target/test-classes/mule-conf2.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 17; columnnumber: 60; cvc-complex-type.2.4.a: invalid content found starting element 'set-payload' i have following namespaces configured in file xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:test="http://www.mulesoft.org/schema/mule/test&quo

javascript - Female voice in Speak.js -

we using speak.js library text speech purpose. , need implement female voice localization in this. calling speak function mespeak.speak('hello thomas"); not able make it's op in female voice. have observed need pass arg parameter not able pass too. can please guide how can female voice op using speak.js lib ? many in advance supposing you're talking mespeak.js: download latest version @ http://www.masswerk.at/mespeak make copy of voice-file (json) in language of choice , open in editor. the voice-files of following structure: { "voice_id": "<filename>", "dict_id": "<filename>", "dict": "<base64-encoded octet stream>", "voice": "<base64-encoded octet stream>" } first, provide unique "voice_id" (e.g. "en-us-f", ids unix-filenames). the encoded voice data text-file found in espeak's data-directory (se

rest - on POST what if entity exists - what is the correct response -

i have restful api 1 can get nodes , post nodes - basic stuff. my "problem" this: when user posts new node, , node exists. should return 400 bad request 409 conflict 200 , existing node im leaning towards 200 , returning existing node. 409 , letting user correct node seems more "correct" if will. what "best practice" in matter, restful api's? the expected result of post creation of new resource along 201 created status code. returning 200 ok not appropriate because request not success. see rfc: 200 ok the request has succeeded. information returned response dependent on method used in request, example: get entity corresponding requested resource sent in response; head entity-header fields corresponding requested resource sent in response without message-body; post an entity describing or containing result of action ; was there wrong request? no. 400 bad request not appropriate either.

Bash script ignoring command on for loop -

i'm running basic loop bash script logs multiple linux boxes execute script , after script logs out of every box, wait 60 seconds. problem script not applying command within script. #!/bin/bash in `cat test.txt`; ssh -a -t -o userknownhostsfile=/dev/null -o stricthostkeychecking=no -o batchmode=yes -o connecttimeout=5 $i "sudo puppet agent -t & "; sleep 60; done

algorithm - How can I find nearest point in a time series data -

i need calculate nearest datapoint in time series chart specific point in chart i cannot use d=sqrt(x*x+y*y) x axis in time series, hence wont make sense have equation adding distance , time (x,y need have same units). visually may seem right, still depends upon scale of x axis. so best logic can use find nearest point? i can think of using quadratic form of x (i.e. time) final function can ne f(x*x,y), subjective equation. does have better , more logical approach this. if there intuitive logical approach love it. , if there complicated model still know , explore it. thanks edit to give background: polling people predict stock price in april(they have mention exact date when expect price there) ... how measure performance? one intuitive way calculating average absolute change per day. i.e. sum of absolute changes every day previous day / total number of days in series. thereafter can translate each day in terms of prices i.e. average price change per day.

php - Removing portion from scraped array -

currently scraping website , trying remove portion of code don't want included in array. so code have $content['article'] = $html2->find('.hentry-content',0); $content['article'] = $content['article']->plaintext; this returns within .hentry-content class on website gathering content from. now content gets returned looks this. array ( [article] => example filler content please no actual meaning behind random bridge bridge random dog tomorrow http://example.com/our-random-mp3.com ) now @ end of output includes random mp3 there anyway can pull content portion of array without mp3 being included? if link inside of <a> tag should work foreach($content['article']->find('a') $item) { $item->outertext = ''; } echo $content['article']->plaintext;

ios - Make UIPickerView result import text to UILabel -

i want make user's selection uipickerview populate uilabel directly beneath it. more specific, if select 'vitamin a' provide information below in form of text in uilabel . new xcode , swift. have got picker working , connected in uilabel haven't worked out how connect 2 without replicating text in uipickerview. here's code have far: @iboutlet weak var description: uilabel! @iboutlet weak var picker: uipickerview! var pickerdata: [string] = [string]() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. // connect data: self.picker.delegate = self self.picker.datasource = self // input data array: pickerdata = ["pick vitamin", "vitamin a", "vitamin b1", "vitamin b2", "vitamin b3", "vitamin b5", "vitamin b6", "biotin", "folic acid", "vitamin b12", "paba", "choline&

iphone - Change the UITableViewCell layout on selection -

i have tableview cell uses right detail layout . want when user selects cell. should add image cell? any suggestions how should implement this? kind regards you can in -tableview:didselectforrowatindexpath: when user selects can create image view , add

r - ks.test with left truncated weibull -

the distribution accept values follow left truncated weibull distribution. know parameters a, shape , scale of distribution using ptrunc command: require(truncdist); ptrunc(x,"weibull",a=a,scale=b,shape=c) so want ks.test command (see below) use described left truncated weibull distribution instead of "normal weibull". myvalues<-c(37.5, 35.4, 27.1, 32.9, 35.9, 35.1, 34.1, 32.5, 35.5, 31.5, 38.2, 36.1,,29.9, 30.1, 34.7, 38.7 ,32.3, 38.0, 34.9, 44.2, 35.8, 30.8, 39.3, 26.0, 34.2, 40.0, 36.1 ,41.5 ,32.8, 31.9, 41.3 ,30.5, 39.9, 35.0 ,31.2 ,35.0, 30.3, 29.0, 34.4, 35.7, 34.1, 35.4); a<-7; scale<-36.37516; shape<-9.437013; so know, in case not necessary left-side truncation. in others be. ks.test(myvalues,"pweibull",scale=b,shape=c) #for normal weibull but ks.test(myvalues,ptrunc(x,"weibull",a=a,scale=b,shape=c)) # leftruncated gives wrong result. first of all, ptrunc should replaced rtrunc . ptrunc giv

windows - Update per machine instance of application in multiuser enviroment -

how installer/windows/wix handles following situation i.e. assume more 1 user working on machine instance of program installed option per machine. 1 of user proceeds upgrade of applications. how installation proceed , how handled on other user profiles? additional changes in wix project has made allow installer proceed such update? checked instance of program not closed on other user profile , user can still work program. if per-machine product install there 1 instance of installed product, user appropriate privilege can choose upgrade when choose. there may multiple copies of app running different users that's not relevant update because there still 1 product update. person doing update owns current desktop's interactive view, see ui notifications - other users won't. the behavior multiple users depends on msi design , app itself. example, if msi installs 1 template copy of data file app copies , modifies each user profile file location msi upgrade isn'

php - Error when executing the below query -

i trying run query. shows either 1 row or give error query result having more 1 row. select * abc id=(select nameid xyz name '%abc%') help me. executing query name, father name , schoolid table abc. want school name table2 running query in in time shows 1 use in fetch more 1 row: select * abc id in (select nameid xyz name '%abc%'); edit: select a.*, x.school_name abc left join xyz x on a.id = x.nameid name '%abc%';

javascript - d3 tooltip | passing in a variable -

i have webpage 4 d3 charts each of 11 different regions. 1 of charts area chart , code snippet is: for (mm=0; mm<regions.length; mm++) { areas.append("path") .attr("class",function(d,i){ return "area cons ar"+i+" region"+mm;} ) .attr("id", function(d,i) { return "area_"+i+"_"+mm}) .attr("d", function(d,i) { return area(d)} ); var test = d3.selectall("path.region"+mm) .call(d3.helper.tooltip() .attr("class", function(d, i) { return "tooltip"; }) .text(function(d, i){ console.log(mm); return "i "+conssubproducts[i]+', i: '+i;})); } i want add tooltips charts. in area plot, each region has different products. have 7 products, others have 5. need use mm variable @ runtime values (0-10) call correct product array conssubproducts currently. (conssubproducts set different prod

scala - Create a child class's instance in parent class's method -

abstract class parent { def filter(p: parent => boolean): parent = filteracc(p, new child) } class child extends parent { // ... } i working on scala tutorial , wondering how following can possible. there 2 classes parent , child . parent class creates instance of child in method filter . how can parent class refer child class inherits parent class? that no contradiction. if parent , child defined within same compilation unit, parent can refer sub-class, both symbols/types known each other.

python - Iterating over a mongodb collection doesn't return all objects -

i have cron job runs simple script on mongo database: import pymongo db=pymongo.connection().dbase ids=[] obj in db.coll.find(): ids.append(obj['_id']) # log len(ids), db.coll.count() in logs db.coll.count() 651 , len(ids) 651 too, 5,85,71 or other random numbers below 651. can explain why discrepancy happens , how prevent please? the environment is: standalone server multiple clients may update objects in collection concurrently.

hyper v - util-linux 2.25.2 lost credentials -

an employee, left on bad terms, setup linux server need access can't login. it setup on hyper-v vm. when booted loads essential drivers begins bootup visible if press esc key. i honest , know nothing linux, once in i'm going learn. have tried googling , seems grub boot menu either pressing esc or holding left shift not working in case. would appreciate , provide additional info if needed.

r - Creation of a contingency table based on two columns of a binary matrix -

this question has answer here: create two-mode frequency matrix in r 3 answers i have binary matrix: s1 s2 s3 s4 s5 d1 d2 d3 d4 obs1 0 0 0 1 0 0 1 0 0 obs2 0 1 0 0 0 1 0 0 0 obs3 0 0 1 0 0 0 0 1 0 obs4 0 0 0 1 0 0 1 0 0 obs5 0 1 0 0 0 0 1 0 0 obs6 0 0 0 1 0 0 1 0 0 each row of matrix must contain value 1 s group (s1, s2, s3, s4 or s5) , value 1 d group (d1, d2, d3 or d4). how can create contingency table 2 groups based on 2 columns of binary matrix value 1 appears? i.e., have table format: d1 d2 d3 d4 s1 0 0 0 0 s2 1 1 0 0 s3 0 0 1 0 s4 0 3 0 0 s5 0 0 0 0 here, example, value 3 coming obs1, obs4 , obs6, couple (s4,d2) take simultaniously 1 value. a nested apply t(apply(df[2:6], 2, function(x) apply(df[7:10], 2, function(y) sum(x==1 & y ==1)))) d1 d2 d3 d4 s1 0

php - Mustache - isset -

how can check if variable set in mustache? like: <?php if(isset($foo) && isset($bar)): ?> {{#varname}} {{varname}} {{/varname}} see http://mustache.github.com/mustache.5.html , first example

c# - Read an Aspose pdf from stream with IText -

i need read pdf created aspose, using itextsharp. here code : // instantiate pdf object aspose.pdf.generator.pdf pdf = new aspose.pdf.generator.pdf(); // specify character encoding for html file pdf.htmlinfo.charset = "utf-8"; pdf.htmlinfo.charsetapplyinglevelofforce = aspose.pdf.generator.htmlinfo.charsetapplyingforcelevel.usewhenimpossibledetectfromcontent; // bind source html pdf.bindhtml(htmlstring); memorystream stream = new memorystream(); pdf.save(stream); form form = new form(); form.bindpdf(stream); var instream = new memorystream(input.templatefile); var pdfconcat = new pdfconcatenate(instream); var pdfreader = new pdfreader(stream); pdfreader.selectpages(new list<int>() { 0, 1 }); pdfconcat.addpages(pdfreader); pdfreader.close(); pdfconcat.close(); while debugging, got following error on line var pdfreader = new pdfreader(stream); pdf header signature not found what want : - create 1 pdf page html string - append existing pdf any id

.net - complex<double> size error overflow -

this question has answer here: segmentation fault on large array sizes 5 answers long int const qwerty= 500000; double ex[qwerty]; my signal have 500k of sample. need have in complex or double got error 'system.stackoverflowexception' occurred in project1.exe" why ?. when qwerty lower 20k works fine. you creating array of 500k on stack. stack has limited memory. if want create big allocate on heap. edit: or better yet, use std::vector. source

preg replace - PHP preg_split Input by <br>, <br/>, <p> into Separate Paragraphs -

i curling page ill-formed code. there particular snippet of page trying parse paragraphs. input snippet may divided <p> , </p> or separated 1 or more <br> or <br/> tags. in cases there 2 <br> tags after another, don't want 2 separate pargaraphs. my current code i'm trying parse/display is $paragraphs = preg_split('/(<\s*p\s*\/?>)|(<\s*br\s*\/?>)|(\s\s+)|(<\s*\/p\s*\/?>)/', $article, -1, preg_split_no_empty); $paragraphcount = count($paragraphs); for($x = 1; $x <= $paragraphcount; $x++ ) { echo "<p>".$paragraphs[$x-1]."</p>"; } however, not working expected. different inputs/outputs follows: input 1: first part </p> <p> second part </p> <p> third part </p> <p> fourth part <br/> output 1: <p>first part </p><p> </p><p>second part </p><p> </p><p> third part </p>

How to align CheckBox to the top of its description in Android -

Image
i align checkbox "symbol" top of description. what have now: what want have: current xml: <checkbox android:id="@+id/register_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/register_hint"/> i've tried achieve manipulating layout_gravity attributes, doesn't work. android:gravity="top" fix problem: <checkbox android:id="@+id/register_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/register_hint" android:gravity="top"/> note android:gravity different android:layout_gravity .

sql - Create VIEW (count duplicate values in column) -

i have little project sql database has table column. question : how create view in sql server, count how many duplicate values have in column , show number in next column. here below can see result want take. |id|name|count| |1 |tom | | |2 |tom | | |3 |tom | | | | | 3 | |4 |leo | | | | | 1 | a view select statement words create view as before select . allows example, 1 person (dba) maintain (create/alter) complex views, while person (developer) has rights select them. so use @stidgeon's answer (below): create view mycounts select name, count(id) counts table group name and later can query select * mycounts counts > 1 order name or whatever need do. note order by not allowed in views in sql server.

mouseenter - jquery .on method don't work -

i work on script show video, when "onmouseover" on div. because of ie use jquery function call mouseenter, nothing happend. my script: jquery.fn.playmoviehome = function () { alert("something"); var co = $(this).children("a").children("img").attr("src").split('images/')[1].split('.')[0]; var odkaz = $(this).children("a").attr("href"); $(this).children("a").after("<div id='video' style='position:absolute;width:163px;height:123px;top:5px;'><embed type='application/x-shockwave-flash' src='http://pacogames.com/games/videos/" + co + ".swf' width='163' height='123' wmode='transparent'></embed><a href='" + odkaz + "'><img src='http://pacogames.com/images/163x123.gif' style='position:absolute;left:0px;width:163px;height:123px;top:5px;'></a&

dllexport - Qt and using an existing win32 dll -

i want development work using qt. have built several small apps , followed tutorials. all's fine , seems straight forward. the development done involves using existing code contained in win32 dlls. want reuse code minimum fuss , link them qt app. have headers, libs , dlls i'll linking @ compile time not dynamically @ runtime. i have tried qt complains complains link errors similar to: main.obj:-1: error: lnk2019: unresolved external symbol _ imp _add referenced in function _main no matter how tweak .pro file complains. i've spent many hours googling , found snippets of info. not find 1 answer told whole story. i'm after set of steps, tutorial sequence needs followed. there may example in qt installation examples i've been unable find it. here simple 'knock-up' i've been trying work in order move on main development. it's based on ms tutorial dll mathsfunc. the win32 dll: // visual studio 2005 //funcs.h #ifdef mathfuncs_exports #

bash - daemon startup script reporting incorrect status -

i wanting use startup script calls iperf @ boot time can specify chkconfig utility , control iperf command line typical service if choose. here have far: #!/bin/bash # chkconfig: - 50 50 # description: iperf daemon=/usr/bin/iperf service=iperf info=$(pidof /usr/bin/iperf) case "$1" in start) $daemon -s -d ;; stop) pidof $daemon | xargs kill -9 ;; status) if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 )) echo $daemon pid $info running!!! else echo $daemon not running!!! fi ;; restart) $daemon stop $daemon start ;; *) echo "usage: $0 {start|stop|status|restart}" exit 1 ;; esac everything works fine far. can start , stop service using script. can add chkconfig no problems. have no

angularjs - Trouble getting Comment Form to POST - Angular App -

i'm relatively new angular. i'm trying comment form of blog app post comments , not keep them in javascript via api post database , store them there. i'm able comments other blog post information whatever reason can't post. blogservice.js angular.module('blogservice', []) .factory('blogservice', ['$http', function($http) { return { // call blog api : function() { return $http.get('/api/blog'); }, // call blog api via id show : function() { return $http.get('/api/blog/' + id); }, // call post new data using blog api create : function(blogdata) { return $http.post('/api/blog', $scope.formdata); }, // call post comments in blog api createcomment : function(commentdata) { return $http ({ method: 'post', url: '/api/blog/' + id + '/comment

python - Two lines are interpreted as one while reading from file -

i try read bunch of file line line, , extract headers them. for in range(2, 43): file = open('/instances/instance' + repr(i) + '.txt') lines = file.readlines() header = [int(x) x in lines[0].split()] print(repr(i) + ':', header) while of headers extracted fine, of them concatenated line below. output is: 2: [1, 3, 50, 5] 3: [1, 1, 50, 5] 4: [1, 5, 75, 2] 5: [1, 6, 75, 5] 6: [1, 1, 75, 10] 7: [1, 4, 100, 2] 8: [1, 5, 100, 5] 9: [1, 1, 100, 8] 10: [1, 4, 100, 5] 11: [1, 4, 139, 5] 12: [1, 3, 163, 5] 13: [1, 9, 417, 7] 14: [1, 2, 20, 4] 15: [1, 2, 38, 40, 30] 16: [1, 2, 56, 40, 40] 17: [1, 4, 40, 40, 20] 18: [1, 4, 76, 40, 30] 19: [1, 4, 112, 40, 40] 20: [1, 4, 184, 40, 60] 21: [1, 6, 60, 40, 20] 22: [1, 6, 114, 4] 23: [1, 6, 168, 40, 40] 24: [1, 3, 51, 60, 20] 25: [1, 3, 51, 60, 20] 26: [1, 3, 51, 60, 20] 27: [1, 6, 102, 60, 20] 28: [1, 6, 102, 60, 20] 29: [1, 6, 102, 60, 20] 30: [1, 9, 153, 60, 20] 31: [1, 9, 153, 60, 20] 32: [1, 9, 153,

asp.net - How to simulate a button click in C# with timer -

i want know how simulate click of button timer. want button pressed every 12 hours. add below code timer tick event call button click event logic btnsubmit_click(null, null) hoping wouldn't use args or sender inside logic. better way write common method can called button click , timer tick.

java - How to resolve Exception in thread "main" org.apache.solr.client.solrj.SolrServerException -

i want connect solr node using scala , query on existing table. how can use query after resolving error solr query as: select * keyspace.table solr_query = 'id: [1000 2000]'; my code here: object solrtest { def main(args:array[string]) { val url = "https://xx.xx.xx.xxx:8983/solr" val httpclient: defaulthttpclient = new defaulthttpclient() httpclient.getcredentialsprovider().setcredentials(authscope.any, new usernamepasswordcredentials("xxxxx", "123456")) val server: httpsolrserver = new httpsolrserver(url, httpclient) val query = new solrquery() val myquery = query.setquery("*:*") val response: queryresponse = server.query(myquery) println("my response : "+ response) } } it connecting till connecting server. after getting following error: exception in thread "main" org.apache.solr.client.solrj.solrserverexception: ioexception occured when talking server at: https

javascript - Function declared on injected file not recognize from background.js in chrome extension -

Image
i'm trying use https://github.com/povdocs/webvr-starter-kit create chrome pageaction extension. on manifest.json file, i've used content_scripts load jquery.js , inject.js . on inject.js , i've following codes: function initvr() { vr.floor(); vr.box({ color: '#ffffff' }).moveto(0, 1.4, 0).setscale(5,4,0); var text = vr.text({ wrap: 4.1, font: '24pt roboto', textalign: 'left', fillstyle : '#000000', text : 'hello world test' }) .moveto(.1, 1.4, 0); } on background.js file, i've chrome.pageaction.onclicked.addlistener(function(tab) { chrome.tabs.executescript(tab.ib, { file: "src/inject/vr.dev.js" }, function(){ initvr(); //calling function declared on inject.js }); the idea here is, when person clicks on pageaction button, injects vr.dev.js , initialize setup. when implement this, error saying initvr() not defined. doing i

asp.net mvc - signalR tracking connected users -

i need check whether specific user still connected. i have following hashset keeps track of users: public static class userhandler { public static hashset<string> connectedids = new hashset<string>(); } so on disconnected: public override task ondisconnected() { userhandler.connectedids.remove(this.context.connectionid); if (userhandler.connectedids.count == 0) { // stop task -> set cancellation } return base.ondisconnected(); } and on connected: public override task onconnected() { logger.log.file.info("[taskactionstatus hub => onconnected] start"); userhandler.connectedids.add(this.context.connectionid); // start task if @ least 1 listener if (userhandler.connectedids.count < 2) { // start task -> (while loop gets data db every 2 sec) } return base.onconnected(); } now, problem ari

java - Why refreshing JTable doesn't work after deletion -

i have jtable can update , delete rows. problem when want print out records table refreshes when delete/update doesn't. prisonerevent contains data delete in database. there no problem that. here listener: class deleteprisonerlistener implements actionlistener { public void actionperformed(actionevent e) { int row = getselectedrow(); prisonerevent evt = getprisonerevent(); string message = "are sure want delete prisoner?"; int option = joptionpane.showoptiondialog(null, message, "confirm", joptionpane.yes_no_option, joptionpane.question_message, null, null, null); if(option == joptionpane.ok_option) { prisonercontroller.removeprisoner(evt.getid()); } tablepanel.gettablemodel().firetabledatachanged(); } } and here tablemodel public class prisonertablemodel extends abstracttablemodel { private list&l

multithreading - Basic Threads using C++ -

this question has answer here: start thread member function 4 answers i trying create simple thread using c++. getting error: error 14 error c2276: '&' : illegal operation on bound member function expression this code: void peercommunication(peerdata &peerdata, std::string infohash) { peer peer(peerdata.getip(), peerdata.getport(), infohash); peer.createconnection(); peer.haspeace(0); peer.recievepeace(0, 4056211 + 291); } tcppeers(orderedmap<std::string, unsigned short> peers, std::string infohash, bencoding bencoder) { std::vector<std::thread> threads; //std::thread ttt[num_threads]; //std::thread t1(task1, "hello"); (std::size_t = 0; < peers.getsize(); i++) { peerdata pd(peers.getkeybyindex(i), peers.getvaluebyindex(i)); std::thread t(&peercommunication, pd, in

Gradle and AndroidAnnotations -

i have written build.gradle file android app. app uses androidannotations. apply plugin: 'com.android.application' apply plugin: 'android-apt' def aaversion = '3.3.2' buildscript { repositories { jcenter() mavencentral() mavenlocal() } dependencies { classpath 'com.android.tools.build:gradle:1.1.3' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'org.androidannotations:androidannotations:3.3.2' } } configurations { apt } apt { arguments { androidmanifestfile variant.outputs[0].processresources.manifestfile resourcepackagename "de.xxx" } } android { compilesdkversion 'google inc.:google apis:23' buildtoolsversion "22.0.1" defaultconfig { applicationid "de.xxx" minsdkversion 11 targetsdkversion 23 } buildtypes { release {