Posts

Showing posts from January, 2013

php - Can't update record in mysql -

my query returns me error, please let me know i'm doing wrong $q="update 'id' set 'pass'='$pass1' 'name'='$user1'"; your sql wrong: $q="update 'id' set 'pass'='$pass1' 'name'='$user1'"; it should like: $q="update id set 'pass'='$pass1' 'name'='$user1'";

jquery - disable clipboard data past in text box using javascript -

need php developer want disable auto typing in php website means application are using clipboard data direct paste data in text box, disable copy paste using java script , also disable right click, how disable auto typing using java script? how disable clipboard data paste in my text box ? <input name="q" type="text" id='test' autocomplete="off"/> will turnoff autocomplete in html . no need of jquery or js or if need done javascript , document.getelementbyid("test").autocomplete="off"

r - Sort data by row -

i have data frame like id b c d e f 1 2 9 4 7 6 b 4 5 1 3 6 10 c 1 6 0 3 4 5 i want data frame id c e f d b #for a, c has highest value, e f , on...similarly other rows b f e b d c c b f e d c basically, sorting each row of data frame first , replacing row values respective column names. is there nice way this? use order apply , extracting names in process, this: data.frame( mydf[1], t(apply(mydf[-1], 1, function(x) names(x)[order(x, decreasing = true)]))) # id x1 x2 x3 x4 x5 x6 # 1 c e f d b # 2 b f e b d c # 3 c b f e d c the result of apply needs t ransposed before recombined id column.

ios - uicollectionview cell frame in portrait and landscape -

Image
i stuck in frame of uicollectionview cell frame want is, in landscape mode of ipad want show 3 cells, , in portrait 2 cells. when write code of frame in method - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath not affecting size of frame. i checked applying debugger whether coming in method or not. coming , returning size. by default have launch application in landscape , if required in portrait. here how showing in landscape here how cells looking in portrait here code frame - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath { //return [self.cellsizes[indexpath.item] cgsizevalue]; if (uideviceorientationislandscape([[uiapplication sharedapplication] statusbarorientation])) { return cgsizemake(100, 100); } return cgs...

android - custom list view with section headers -

newbie question i have json file contains multiple categories same name. for example {"long_description":"test", "short_description":"test", "category_name":"work", "id":1}, {"long_description":"test2", "short_description":"test2", "category_name":"work", "id":2}, {"long_description":"test", "short_description":"test", "category_name":"home", "id":3} my question how create list view sections (category name) i'm using custom adapter heres loop try { jsonobject responseobject = new jsonobject(response); jsonobject itemsobject = responseobject.getjsonobject("items"); iterator<?> keysiterator = itemsobject.keys(); while(keysiterator.hasnext()) { string keystring = (string)keysiterator.next(); jsonobject ...

jquery - SignalR MVC 5 Websocket no valid Credentials -

i try use signalr in mvc application. works following error in chrome console websocket connection 'ws://localhost:18245/signalr/connect?transport=websockets&clientprotocol=1.4&connectiontoken=bndglnbsqthqy%2fsjo1bt 8%2fl45xs22bds2vcy8o7hikjddauj4ftic54av%2beljr27ekhuitywgfmfg6o7razwhf fpxavzwq1jvkaxgm5ri%2bwtk7j0g1eqc2aoyp366wmrqlxciyjfsm4ebwx6t8n2aw %3d%3d&connectiondata=%5b%7b%22name%22%3a%22importerhub% 22%7d%5d&tid=9' failed: http authentication failed; no valid credentials available the funny thing jquery method call controller on hub works fine. jquery: $(function () { // initialize connection server var importerhub = $.connection.importerhub; // preparing client side function // called sendmessage called server side importerhub.client.sendmessage = function (message) { showorupdatesuccessmessage(message); }; $.connection.hub.start(); ...

python - Simplest way to get the first n elements of an iterator -

how can first n elements of iterator (generator) in simplest way? there simpler than, e. g. def firstn(iterator, n): in range(n): yield iterator.next() print list(firstn(it, 3)) i can't think of nicer way, maybe there is? maybe functional form? use itertools.islice() : from itertools import islice print list(islice(it, 3)) this'll yield next 3 elements it , stop.

c++ overloading += operator -

i have class: class myclass{ double a; double b; double c; double d; public: myclass(double _a, double _b, double _c, double _d){ = _a; b = _b; c = _c; d = _d; } myclass operator+=(const myclass & rhs){ += rhs.a; b += rhs.b; c += rhs.c; d += rhs.d; return this; } myclass operator+(myclass & rhs){ myclass newone(a+rhs.a,b+rhs.b,c+rhs.c,d+rhs.d); return newone; } } and use this: myclass my1(1., 2., 3., 4.); myclass my2(2., 3., 4., 5.); myclass my3(2., 4., 6., 8.); my2 += my3; my1 += my2; and 1 working, when use this my1 += my2 += my3; i diffrent answer. , how can make count expression in brackets first? example : (my1 + my2) + my3 == my1 + (my2 + my3) it not clear result expecting in statement my1 += my2 += my3; the statement equivalent to my1 += ( my2 += my3 ); according c++ standard (5.17 assignment , compound assignment operators) 1 ...

ios - Retrieve Movie Pricing like in IMDB -

i need know, how can pricing list valid particular movie. in itunes there many movies app, gives pricing website live streaming. how retrieve list of pricing. if understand question correctly, looking itunes store movie metadata , include pricing. can use itunes store search api , returns itunes pricing. https://itunes.apple.com/search?term=ventura&media=movie this api call return json response following data: {"wrappertype":"track", "kind":"feature-movie", "trackid":271495352, "artistname":"steve oedekerk", "trackname":"ace ventura: when nature calls", "trackcensoredname":"ace ventura: when nature calls", "trackviewurl":"https://itunes.apple.com/us/movie/ace-ventura-when-nature-calls/id271495352?uo=4", "previewurl":"http://a1567.v.phobos.apple.com/us/r1000/035/video/39/3b/c3/mzm.idnfqvpl..720w.h264lc.d2.p.m4v", ...

windows - NtQueryObject hangs on object type number 30 with specific access mask -

i have seen ntqueryobject hang duplicated handles these granted access values ( handle.grantedaccess access_mask type): 1179785 (integer) --> 0b100100000000010001001 (binary) 1180063 (integer) --> 0b100100000000110011111 (binary) 1180041 (integer) --> 0b100100000000110001001 (binary) 2032127 (integer) --> 0b111110000000111111111 (binary) ||||||| | | ||||||| | | ||||||| | | ^^^^^^^ ^ ^ possible culprit bits seem 3rd , 7th bit, 9th 15th bit. always, handle.objecttypenumber 30. object type number, , how can list of specific rights of type? experiments have kind of shown must bits 0-15 causing hang on object type number of 30 (integer). handle system_handle type defined as: typedef struct _system_handle { ulong processid; byte objecttypenumber; byte flags; ushort handle; pvoid object; access_mask grantedaccess; } syst...

mysql - Database and Hibernate one-to-one best appraoch -

which general , better approach implement one-to-one relation , mapping db , hibernate bellow assume have customer & contact tables. 1) can keep contact_id in customer table foreign key 2) can keep customer_id in contact table foreign key how implement hibernate mapping both? i have implemented customer , contact tables using 2nd option when i'm tryiing hibernatetemplate.save(customer); i'm getting bellow exception: cannot add or update child row: foreign key constraint fails ( contact_info , constraint contact_info_ibfk_1 foreign key ( customer_id ) references customers ( id )) present mapping is @entity customerentity { ..... @onetoone(cascade = cascadetype.all, fetch = fetchtype.eager) @joincolumn(name="customer_id") private contactinfoentity contactdetails; ..... } @entity contactinfoentity { @column(name="customer_id") private int customerid; } @onetoone difficult , confusing implement. can use @m...

php - Variable as Array Key - Yii Dropdown Selected -

i using yii , have dropdown using following example: $form->dropdownlist($model,'sex',array('1'=>'men','2'=>'women'), array('options' => array('2'=>array('selected'=>true)))); here able choose option selected. if set 2 shown in example above selected option women expected. not able statically set selected option need use variable. have $selectedid equal 2, when doing example: array('options' => array("$selectedid"=>array('selected'=>true)))); or doing this: array('options' => array($selectedid=>array('selected'=>true)))); i getting no errors, dropdown not have expected selected option. possible use variable when defining array key? update true string: chtml::dropdownlist('package','',chtml::listdata(services::model()->findall(array('condition'=>'is_internet = 1','params'=>arr...

html - How to keep buttons from moving when re-sizing the web browser -

this image-button website. http://puu.sh/ck7sf/6309c39cdb.jpg when re-size browser goes on here http://puu.sh/ck7vu/f17dafcc41.jpg here code html <div class="nav"> <div id="buttons"> <a href="/"><div id="home_button"></div></a> css #home_button { background-image: url("home.png"); background-repeat:no-repeat; background-size: 100%; width: 150px; height: 60px; position: absolute; top: 196px; left: 502px; z-index: 10; } keep in mind new css , html, please dont hate you should not use absolute position this. change position: relative; or position: static; absolute positioning causing button shift coordinates (top: 196px; left: 502px;) edge of browser window. i suggest researching float property well, because it's useful in positioning things flow nicely, navigation this .

bluetooth lowenergy - iOS how to reconnect to BLE device in background? -

there many related questions (apparently) no answers. so... my ios app does updates ble device while app in background. if lose touch ble device, in centralmanager:diddisconnectperipheral: call - [cbcentralmanager cancelperipheralconnection:] -- otherwise never reconnect lost peripheral. call [(re)call - [cbcentralmanager scanforperipheralswithservices:options:] . logging shows me diddisconnectperipheral call, , contained calls, both happening while in background . however, reconnect happens when app wakes background. so able communicate connected ble device while in background (yay!) not reconnect. quite important app, , (one think) other apps. suggestions welcome. you don't need cancel connection - disconnected don't need rescan peripheral - have identified peripheral. in diddisconnectperipheral can call [central connectperipheral:peripheral options:nil]; core bluetooth reconnect once peripheral visible again a complete sample here - https://gi...

c++ - Microsoft nmake: Is it possible to define macros from shell command output? -

i trying save svn revision info macro while making code microsoft visual studio's nmake. in gnu make, like: svn_revision=r$(shell svnversion -n) so example: svn_revision=r10001 is possible in microsoft nmake too? thank in advance. using techniques mentioned along recursive call make, can done way: !ifndef make make=nmake !endif !ifndef svn_revision ! if [echo off && /f "usebackq" %i in (`svnrevision -n`) set svn_revision=%i && $(make) /$(makeflags) /nologo /f $(makedir)\makefile && exit /b ] == 0 ! message make completed ! else ! error error in nmake ! endif !else # $(svn_revision) contains string returned command `svnrevision -n` !message svn_revision $(svn_revision) # put parts of makefile depend on svn_revision here !endif # # valid makefile must have rules perform all: @echo;$(svn_revision)

Purpose of 'givens' variables in Theano.function -

i reading code logistic function given @ http://deeplearning.net/tutorial/logreg.html . confused difference between inputs & givens variables function. functions compute mistakes made model on minibatch are: test_model = theano.function(inputs=[index], outputs=classifier.errors(y), givens={ x: test_set_x[index * batch_size: (index + 1) * batch_size], y: test_set_y[index * batch_size: (index + 1) * batch_size]}) validate_model = theano.function(inputs=[index], outputs=classifier.errors(y), givens={ x: valid_set_x[index * batch_size:(index + 1) * batch_size], y: valid_set_y[index * batch_size:(index + 1) * batch_size]}) why couldn't/wouldn't 1 make x& y shared input variables , let them defined when actual model instance created? the givens parameter allows separate description of model , exact definition of inputs variable. consequence of given parameter do: modify graph...

p2p - How could a file be corrupted? -

my understanding hash list in info should protect integrity of downloaded files, files corrupted? taken torrent poisoning a malicious user pollutes file converting format indistinguishable uncorrupted files (e.g. may have similar or same metadata). how file polluted , still pass integrity test? thanks i making assumption here, think confusing terms "data" , "metadata". if file corrupted, data mess, information system uses identify file intact according system. example, present glass full of clear liquid , tell it's water. glance can see entirely possible water, , drink find out vodka. system, , when "used" glass of liquid found out contents not expected. now give glass expert on verifying glasses of clear liquid filled water, , you, "no, not meant be". "expert" checksum comparison tool. checksum generated entire file, not metadata.

python - AsyncResult get() does not return -

i trying use celery chords , trying run following example - @celery.task(ignore_result = false) def add(x, y): return x + y @celery.task(ignore_result = false) def tsum(numbers): return sum(numbers) celery import chord callback = tsum.s() header = [add.s(i, i) in range(5)] result = chord(header)(callback) print result.get() i can see tasks run in celery logs. however, line result.get() not return. have set celery_result_backend = 'amqp://' i new celery chords , trying sample program run first. missing here. following celery config- celery_broker_url = 'amqp://' celery_result_backend = 'amqp://' celery_task_serializer = 'json' celery_accept_content = ['json'] celery_result_serializer = 'json' celery_enable_utc = true edit : adding determining detail! the problem fixed, totally unrelated celery itself. detail the system runs on microsoft azure . i'm adding , accepting answer. i'm rewarding each kind cont...

java - Gradle: How to create two applications for each flavor with different assets folders: -

currently i'm working on application has 5 flavors , part of build.gradle files matters: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.14.0' } } apply plugin: 'com.android.application' repositories { mavencentral() } android { compilesdkversion 20 buildtoolsversion '20.0.0' signingconfigs { release { storefile file("") storepassword "password" keyalias "alias" keypassword "password" } } lintoptions { abortonerror false } defaultconfig { minsdkversion 14 targetsdkversion 20 applicationid 'application.package' signingconfig signingconfigs.release } buildtypes { release { signingconfig signingconfigs.release } } productflavors { f...

java - Why does SpringJUnit4ClassRunner not work with surefire parallel=methods? -

why tests throw random exceptions when use surefire setting parallel=methods ? that's because junit creates 1 runner instance per test class, used multiple threads when using parallel=methods . springjunit4classrunner creates 1 testcontextmanager , stores test instance in instance field, isn't thread safe. when use parallel=classes should fine, because junit creates 1 runner dedicated testcontextmanager per thread. i have filed bug that: https://jira.spring.io/browse/spr-12421

javascript - Describe property defined with Object.defineProperty -

i want add jsdoc documentation property added object.defineproperty . guess might work: /** @constructor */ function myclass() { /** @property {number} rnd */ object.defineproperty(this, 'rnd', { : function () { return math.random(); } }); } but generated jsdoc explanation not have property: $ jsdoc -x test.js [ { "comment": "/** @constructor */", "meta": { "range": [ 20, 167 ], "filename": "test.js", "lineno": 2, "path": "/jsdoctest", ...

Suppress unwanted jumping/scrolling on Word 2013 VBA Script -

when accessing legacy form field values in word 2013 document (getting or setting): ' myfield = activedocument.formfields("myfield").result ' set activedocument.formfields("myfield").result = myvalue the document weirdly jumps/scrolls down , , stops @ complete different position (it seems jump lines referred fields positioned). have @ this screencast or a sample file error can viewed. i have used application.screenupdating = false at beginning of sub and application.screenupdating = true at end of sub unfortunately doesn't help. what have modify in order suppress behaviour? i found clue solution on word mvp site . pointed out, issue when access properties of formfield object, focus set form field. can see behavior when browsing form fields through locals window in vba editor. instead of using formfield object, access result property through bookmark object. change this: myfield = activedocument.formfields(...

spring integration - using gateway for starting transaction -

i have been following previous answers talk inserting gateway / service-activator start new transaction mid way in si processing. have tried below code reason not work, if point error in configuration please. all threads seems waiting happen , sp outbound gateway not invoked, cant figure out what. the idea here process each task produced splitter in thread pool under new transaction. <int:splitter...output-channel="taskchannel"/> <int:channel id="taskchannel"> <int:dispatcher task-executor="taskexecutor"/> </int:channel> <int:gateway id="txgw" service-interface="com.some.test.starttransactionalgateway" default-request-channel="taskchannel" default-reply-channel="individualtask"> </int:gateway> <int:service-activator ref="txgw" input-channel="taskchannel" ...

android - how set emoji by unicode in a textview? -

hi i'd following: ??? unicode = u+1f60a string emoji = getemijobyunicode(unicode) string text = "so happy " textview.settext(text + emoji); to in textview: so happy 😊 how implement 'getemijobyunicode(unicode)'? what should type of 'unicode'? (string/ char/ int??!) please note not want use drawables! found solution: in unicode replaced ' u+ ' ' 0x ' example: replace ' u+1f60a ' ' 0x1f60a ' this way got 'int' like int unicode = 0x1f60a; which can used with public string getemojibyunicode(int unicode){ return new string(character.tochars(unicode)); } so textview displays 😊 without drawable try http://apps.timwhitlock.info/emoji/tables/unicode

cryptography - How to use openssl to decrypt data encrypted by Java using AES -

i generating aes public key , iv (initialization vector) in java encrypt data. need decrypt using openssl command. possible given store aes key , iv on disk? following encryption logic cipher cipher = cipher.getinstance("aes/cbc/pkcs5padding"); cipher.init(cipher.encrypt_mode, key, iv); byte[] stringbytes = pass.getbytes(); byte[] raw = cipher.dofinal(stringbytes); return base64.encodebase64string(raw); generating aes key secretkey secret_key = keygenerator.getinstance("aes").generatekey(); generating iv securerandom random = new securerandom(); ivparameterspec iv = new ivparameterspec(random.generateseed(16)); i saving iv , aes key in file in disk unencrypted. how decrypt data using these 2 parameters using openssl ? save them hexadecimals , use e.g. -k `cat key.hex` -iv `cat iv.hex` so that's using backticks instead of single quotation marks.

python - Pygame - How to stop an image from leaving the edge of the screen? -

a section of jetfighterx leaves screen when mouse hovers on edge of window, causes tarantula explode time time respawns top of window, how can stop happening (without use of classes)? code: import pygame, sys, pygame.mixer pygame.locals import * import random pygame.init() bif = "space.jpg" jf = "spacefightersprite.png" enemy = "tarantulaspacefighter.png" laser = pygame.mixer.sound("laserblast.wav") explosionsound = pygame.mixer.sound("explosion.wav") screen = pygame.display.set_mode((1000,900),0,32) caption = pygame.display.set_caption("jet fighter x") background = pygame.image.load(bif).convert() jetfighterx = pygame.image.load(jf) jetfighterx = pygame.transform.scale(jetfighterx, (400,400)) tarantula = pygame.image.load(enemy) tarantula = pygame.transform.scale(tarantula, (100,100)) laserblast = pygame.image.load("c:\python27\laser.png") explosion=pygame.image.load("c:\python27\explosion.png...

java - Ads for iPhone and Android? -

can explain me how implementing ads works in libgdx, android , iphone? regarding libgdx game: if want release game both android , iphone, can use same ad services or each own? since don't have knowledge how ads work, how can 1 try , make living ads, need register in order create account that'll manage earnings , on... can go through trouble of explaining me? p.s don't have delusions of fb's success, looks learn. i myself use admob. here how works in nutshell and here implementation

java - Eclipse Debugger Goes to Library Classes -

just debugging project using eclipse luna 4.4.0, when using debugger, upon reaching breakpoint, , hence using "step into" button, takes me generic library classes such threads.class etc.. i'm pretty sure it's problem eclipse configuration, working fine on different machine, since switching it's become real pain having step on fair few library classes before can own code. any change extremely helpful, thanks. you can use step filtering skip packages/classes when debugging. if have additional packages in project you'll need add packages step filtering. window -> preferences -> java -> debug -> "add packages" select packages want skip during debugging. use shift select multiple packages. click ok , ensure checked. see this article further clarification.

javascript - Edit Item from Firebase -

this sort of follow-up previous question . i'm trying figure out how edit existing item stored in firebase. items repeated on page, , each of them have "edit" button next them. html <h3>editing {{ editedprovider.title }}</h3> <form> <input ng-model="editedprovider.title"> <button type="submit" ng-click="updateprovider()">submit</button> </form> <div ng-repeat="provider in providers"> <h3>{{ provider.title }}</h3> <button type="button" ng-click="seteditedprovider()">edit</button> </div> </div> this how i'm adding item list: js var rootref = new firebase(fburl); var providersref = rootref.child('providers'); $scope.newprovider = {}; $scope.providers = []; providersref.on('child_added', function(snapshot) { $timeout(function() { var snapshotval = snapshot.val(); console...

bash - Toggleable nconf-like menu from command output -

i'm trying create following kind of nconf-like space -toggleable menu: [*] 1st item [*] 2nd 1 [ ] 3rd 1 [*] 4th 1 the items should created according output of command in script. you want use dialog (or whiptail ; similar) --checklist widget. here's example command: options=$( dialog 2>&1 1>/dev/tty \ --keep-tite \ --checklist "dialog title" 20 120 4 \ tag1 "1st item" on \ tag2 "2nd item" off \ tag3 "3rd item" off \ tag4 "4th item" on ) the end result $options contain list of tag values selected items. taking command apart: dialog uses stdout write terminal , writes own output (the list of selected tags) stderr. that's bit awkward scripting; $(...) construct redirects stdout pipe bash can read from. duplicate pipe stdout stderr ( 2>&1 ) final output captured, , set stdout terminal ( 2>/dev/tty ) dialog 2>&...

cmake - OpenCV compile error Linking CXX shared library ../../lib/libopencv_highgui.so /lib/libbz2.so.1: could not read symbols: File in wrong format -

i'm trying install opencv-2.4.9 on centos 6.4. machine. downloaded source in ~/downloads/opencv-2.4.9. there, did 'mkdir build; cd build'. did cmake -d cmake_build_type=release -d cmake_install_prefix=/usr/local -d with_tbb=on -d build_new_python_support=on -d with_v4l=on -d install_c_examples=on -d install_python_examples=on -d with_qt=on -d with_opengl=on --enable-shared .. and did 'make -j2'. below message got (this result of re-running using 'make') [ 3%] built target libtiff [ 4%] built target opencv_core_pch_dephelp [ 4%] built target pch_generate_opencv_core [ 6%] built target opencv_core [ 6%] built target opencv_ts_pch_dephelp [ 6%] built target pch_generate_opencv_ts [ 6%] built target opencv_imgproc_pch_dephelp [ 7%] built target pch_generate_opencv_imgproc [ 11%] built target opencv_imgproc [ 11%] built target opencv_flann_pch_dephelp [ 11%] built target pch_generate_opencv_flann [ 12%] built target opencv_flann [ 12%] buil...

bash - Sharing variables between shell scripts -

i have shell script (let's call parent.sh) calls shell script (child.sh), passing argument. the child script work , sets value in variable called create_sql . want access create_sql variable parent script invoked it. i calling child script within parent script this: ./child.sh "$dictionary" and straight afterwards have line: echo "the resulting create script is: "$create_sql however, there no value being output, however, in child script doing same thing , variable set. how can work can read variables created child script? succinctly, can't have child script set variable in parent script unless like: . ./child.sh "$dictionary" (or in bash, mimicking c shell, source ./child.sh "$dictionary" ). reads , executes script in environment of current shell, alter other variable in parent.sh script; there no isolation between scripts. otherwise, child process cannot sanely set environment of parent shell. (if want in...

ios - Navigationbar title alignment issue -

Image
i have set custom view navigation bar titleview, when page first view controller title shown correctly in center but when view controller pushed view controller title shifted right code : -(void)setuptwolinenavigationtitle { cgfloat width = 0.95 * self.view.frame.size.width; uiview *contentview = [[uiview alloc] initwithframe:cgrectmake(0, 0, width, 44)]; contentview.backgroundcolor = [uicolor clearcolor]; cgrect titlerect = contentview.frame; titlerect.origin.y = 4; titlerect.size.height = 20; uilabel *titleview = [[uilabel alloc] initwithframe:titlerect]; titleview.backgroundcolor = [uicolor clearcolor]; titleview.font = [uifont systemfontofsize:14.0]; titleview.textalignment = nstextalignmentcenter; titleview.textcolor = [uicolor blackcolor]; titleview.text = @""; [contentview addsubview:titleview]; cgrect subtitlerect = contentview.frame; subtitlerect.origin.y = 24; subtitlerect.size.height =...

linux - Gifs on Sailfish-os -

i came here little problem, can't use local .gif in code. i work on linux qtcreator , sailfish vm make sailfish-os application. i tried first this example , without success. rectangle { width: animation.width height: animation.height animatedimage { id: animation; source: "../images/animatedimageitem.gif"} } the execution return : qml animatedimage: error reading animated image file file:///bla/bla/..... same problem other permissions on gif , other gif. after researches found this page indicate download plugin, qt declare (i wish put link i'm new -_-', see comments) gifs support default. the plugin unobtainable , found sailfish/bin/plugins/imageformats/libqgif.so in directories. so can show gif on damn thing ? the error seeing related filepaths. gif s supported, afaik. instead of coding path way, consider usage of resource file improve portability , platform independence. create new resource file ( file -...

Mule ESB : Which has better performance -- scripts (java script,groovy,ognl etc ) or java code through Java component or transformer -

i had question in mind long time , jotting down now. which best practice or has edge on others while transforming or processing data in mule esb. curious differentiate between following components. java script groovy script other allowed scripts vs java component or java transformer usually esb should provide various options transformations , mule provides lot of ways , methodologies transformation. i curios know better of common situations. for example check scenarios below. calling java component chunk out list object , make list payload vs using ognl in set payload component. ognl being deprecated in mule. regarding javascript vs groovy vs mel (mvel) depends. mel scripts faster start (find here performance benchmarks), followed javascript (mule still not use java 8's nashorn) , followed groovy. however, big tasks initialization doens't matter groovy might still perform faster. anyhow, 100% of cases, java components, on equivalent t...

eclipse - Startup a remote WildFly Server, and deploying to it -

i setup machine deployment machine web project. setup have wildfly on own machine, , start via eclipse (keplar). have existing wildfly server setup, copied, , made changes connect remote machine. i have copied wildfly same directory structure on new machine, , add new server on own machine in eclipse, specifying machine name. says ssl not setup on new machine, ignore that, since tutorial followed says can ( http://www.mastertheboss.com/eclipse/jboss-tools/deploy-applications-to-a-remote-wildfly-server-using-eclipse ). it seems new host machine not setup properly, because cannot see files "browse remote host" option on server behaviour tab. does know how working? thanks.

c# - DateTime losing Milliseconds -

Image
i parsing date file string , converting datetime can compare previous date. losing milliseconds when extremely important missing lines file parsing. example of date file extracting: 2014/11/12 10:47:23.571 m_latestprocessdate after parseexact 12/11/2014 10:47:23 see below line of code using. ideas how around this? datetime m_latestprocessdate = datetime.parseexact(m_currentdatestring, "yyyy/mm/dd hh:mm:ss.fff", cultureinfo.invariantculture); codecaster explained problem, wanna add answer if let's me.. don't worry! milliseconds didn't lost. still there. sounds didn't see them when try represent m_latestprocessdate , that's because string representation of datetime doesn't have milliseconds part. for example, if use datetime.tostring() method without parameter, method uses "g" standard format of currentcult...

Google Analytics Data for Particular page -

i have integrated google analytics. want fetch data particuar page. have got data many pages. not getting data pages need. though, page shown in google analytics reporting area. can suggest reason ? $params = array( 'metrics' => 'ga:visits,ga:socialinteractions,ga:pageviews,ga:bounces,ga:uniquepageviews' , 'dimensions' => 'ga:pagepath' , 'ga:pagepath=@/c14z8', ); $visits = $ga->query($params);

javascript - Adding elements to object for localStorage -

i have dynamic listview displays various offers stores. want user able save these offers when select listview in order produce saved offers feature using localstorage. i have managed reach point can save 1 offer selecting offer in listview. on selection of listview row takes data attributes particular selection , populates array passed localstorage. js var offerobject = ''; $("#offers ul").on("click", ">li", function(event, ui) { var offertitle = $(this).closest('li').attr('data-offer-title'); var offerdesc = $(this).closest('li').attr('data-offer-desc'); ...

How to configure datasource jboss 4.2.3 for a jar library that initialize connection in the default context? -

we have jar library util manage of logic of connection db , store data in memory. well, works fine in tomcat because can configure datasource in $catalina_home/conf/context.xml , work's fine. how can configure datasource in jboss (4.2.3.ga) that's can see war, ear or apps deployed , of course jar util that's it's deployed in $jboss_home/server/< instance >/lib ? thanks :) update: i want do: "2a. shared resource configuration use option if wish define datasource shared across multiple jboss web applications, or if prefer defining datasource in file. this author has not had success here, although others have reported so. clarification appreciated here . <resource name="jdbc/postgres" auth="container" type="javax.sql.datasource" driverclassname="org.postgresql.driver" url="jdbc:postgresql://127.0.0.1:5432/mydb" username="myuser" password="mypassw...

r - Vector literal in JAGS/WinBUGS -

is there way how write vector literal in jags/winbugs? tried these in jags, result in error: pi <- [p*q, p*(1-q)*q, p*pow(1-q,2)*q, p*pow(1-q,3)*q] pi <- (p*q, p*(1-q)*q, p*pow(1-q,2)*q, p*pow(1-q,3)*q) pi <- c(p*q, p*(1-q)*q, p*pow(1-q,2)*q, p*pow(1-q,3)*q) i don't want assign them 1 one. haven't find useful here or in manual.

unix - Track user when connecting with ssh -

i user local username server localserver . have database server dbserver , username connect through ssh dbuser . can connect dbserver through localserver . need login localserver local user , connect dbserver dbuser . there chance admin of dbserver can track local user? dbuser has connect localserver check local user doing or done. since connect dbserver dbuser there no information local user withing dbserver. short answer no.

ascii - Python AES text encryption script -

Image
i working on python script encrypts text using 128-aes algorithm have problem: picture shows script processes. works fine thing in decryption when give wrong key output decimals goes out of range of ascii, program can't show text @ output. expected wrong text! wrong code or should that? that's normal, because aes (and modern cryptosystems) dealing encrypting actual byte values, not ascii values. incorrect key, data won't decrypted correctly, resulting in ranges outside of normal ascii values. if you're looking encrypts/decrypts ascii, of "classic" ciphers: caesar shift, vigenere, etc.

javascript - Dateformat AngularJS in select dropdown -

Image
i receive json data web api. json data consists of series of datetimes. i want able select particular datetime dropdown list. there no problem populating list, formatting incorrect, , don't know how make right. the selected datetime going used afterwards. i'm using angular , don't mind using other 3rdparty tool moment.js currently looks this: edit: i'm populating dropdown in following way: <select class="inputindkald" id="tidspunktdropdown" ng-model="indkald.tidspunkt" ng-options="tidspunkt.datetime tidspunkt in indkaldtidspunkt"><option value="">vælg...</option></select> i hope guys can me out. [..old answer not relevant ...] update: i have never done myself have tried like: <select class="inputindkald" id="tidspunktdropdown" ng-model="indkald.tidspunkt" ng-options="tidspunkt.datetime tidspunkt|date:'...

Counting compares for algorithm analysis -

let's i'm analyzing algorithm , want count compares. assuming structure this: if (a == b){ ... } else if (a == c) { ... } else if (a == d) { ... } else { ... } what's best way count compares? i'm thinking way go: int compare = 0 compares++; //will first compare if (a == b){ ... } else if (a == c) { compares++; //add because got here ... } else if (a == d) { compares += 2; //add 2 because of 1 , previous else if ... } else { compares += 3; //etc ... } is correct? yes, it's correct, can write more succintly , more robustly (assuming c/c++/js) using c omma operator : if (compares++, == b){ ... } else if (compares++, == c) { ... } else if (compares++, == d) { ... } else { ... } also, if you're using c++ (or language has operator overloading), can use custom objects , override comparison operator , count there. way have alter type of variables , not rest of code.

ios - Draw an image once and then draw on it with finger (MonoTouch) -

i can draw picture , draw finger on following code: public override void draw (rectanglef rect) { base.draw (rect); using (cgcontext context = uigraphics.getcurrentcontext()) { // draw image in context context.drawimage (rectangle, imagetodraw.cgimage); // draw finger touch if (this.fingerdraw) { context.setstrokecolor (uicolor.black.cgcolor); context.setlinewidth (5f); context.setlinecap (cglinecap.round); this.drawpath.movetopoint (this.prevtouchlocation); this.drawpath.addlinetopoint (this.touchlocation); context.addpath (this.drawpath); context.drawpath (cgpathdrawingmode.stroke); } } } however brings me performance problems, expensive draw image every time user touches screen. how can draw image once @ beginni...

multithreading - Write with several threads to a list and read it with an other - Python -

hi got problem multithreading. i'm trying getting data http requests. want data 3 webservers. i'm using threading module in python. what want write data array , sort it. thread0 writes data array[0] thread1 writes data array[1] thread2 writes data array[2] this happens when data fetched webserver has changed. thread4 should copy array when has changed , sort , processing on copy afterwards. this plan. how can without blocking other thread's write actions , how can assure data not inconsistant when read it. here how far have gotten idea. here module 1 thread: import threading class http_fetcher(threading.thread): _idx_of_list = [] def set_idx(self,idx) self._idx_of_list = idx def run(self) global my_list #some http fetching stuff old_data = [] if old_data != actual_data: old_data = actual_data my_list[self._idx_of_list] = actual_data and here calling main program ...

javascript - Access $ in a required file using Alloy -

i in controller ( controllera ) , have external file want handle orientation changes. //-- in controllera var gestures = require('gestures'); inside gestures.js need access $ can manipulate elements in controllera inside gestures.js undefined $ i have managed work creating init() function in gestures , can intantiate require like: var gestures = require('gestures').init($); feels hack. what proper way of doing in alloy? edit side note. tried doing ti.include() , same thing...no access $ commenjs modules (included in other controller using require ) must independent off other controllers. it's name "gesture.js" think trying controle orientations changes , shake gestures ... have define module use in other controllers , feature exist. for example suppose have module called animations.js : var animations={}; animations.movetoleft=function(element,newleftvalue){ var animation=ti.ui.createanimation({ left:new...

Convert Json to a java object -

what way generate java object , set methods? http://www.jsonschema2pojo.org/ that link helps generate java object format based on gson feed in. make sure set settings need it. always, it's not idea copy-paste generated code, might of help.

ios - How to get requested image size for iOS8 PhotoKit? -

i using code below fetching image: [[phimagemanager defaultmanager] requestimageforasset:asset targetsize:cgsizemake(800, 600) contentmode:phimagecontentmodeaspectfill options:options resulthandler:^(uiimage *result, nsdictionary *info) { nslog(@"size:%@",nsstringfromcgsize(result.size)); }]; i'm requesting image size of 800 x 600, i'm getting image size of 45 x 60, poor-quality. how can requested image size using photokit ? your (unnati's) self answer work, misses out on number of optimisations apple give in framework images display more quickly. your original code pretty correct, include options object don't need, , may have been causing problems if had set resizemode incorrectly on it. here code should work you, i've removed options object. [[phimagemanager defaultmanager] requestimageforasset:(phasset *)asset targetsize:cgsizemake(800, 600) contentmode:phimagecontentmodeaspectfit options:nil resulth...

vhdl - Snake game using FPGA (NEXYS2) -

i planning make snake game using nexys2 board in vhdl , display on led matrix similar in video http://www.youtube.com/watch?v=niqmnypipw0 still don't know begin. how go implementing in vhdl? beyond designing , wiring hardware (connectors, led matrices , such) , actual design of game (the rules , inputs cause outputs), start breaking down design constraints blocks write vhdl. example, might have display output component takes pixel change events , writes screen state display (or maybe takes whole screen state, , handles interface logic display). might have game logic component, , controller interface component. once decide each block should do, have decide how data flow , control logic, write in vhdl (you need know basic syntax , functionality of vhdl first!). then synthesizer translates rtl description implementation of flip flops , tables, , place&route tool figures out put , connect these units using actual resources of fpga targeting, generating binary conf...

pandas - Efficient way to add to a series without duplicates -

i need add a dataframe (or series if that's more efficient) quite often, while making sure additions don't create duplicates. dataframe grows, seems inefficient, concating calling drop_duplicates, whole dataset needs checked duplicates each addition. the data has 2 columns guessing turning 1 index might speed things up. (or both columns hierarchical index). pandas has way of disallowing duplicate indexes? here sample problem: print accumulating_result c1 c2 0 x1 1 b x2 2 b x3 3 c x4 print new c1 c2 0 b x3 1 c x4 2 c x5 perform addition of new accumulating_result , get: print accumulating_result c1 c2 0 x1 1 b x2 2 b x3 3 c x4 4 c x5 for what's it's worth, every entry in column c2 unique. any ideas? you can use combine_first() : data1 = """ c1 c2 0 x1 1 b x2 2 b x3 3 c x4""" data2 = """ c1 c2 0 x x3 1 y x4 2 z x5""" import io i...

arrays - Formula to get lowest value based on two columns -

Image
i'm looking excel formula determining lowest value based upon data in first 2 columns. have seen questions regarding basing off 1 column, i'm not sure how convert 2 column data range formula. have day , interval , , time columns (a, b, c) , looking find fastest interval each day/interval set. example: day interval time 1/1 100 :55 1/1 100 :52 1/1 100 :54 1/1 200 2:40 1/1 200 2:38 1/5 100 :50 1/5 100 :56 1/5 100 :58 1/5 200 2:39 1/5 200 2:36 1/5 200 2:40 i'm looking formula able determine fastest times each of intervals (100 , 200) , each of days in chart format shown below: interval day 100 200 1/1 :52 2:38 1/5 :50 2:36 i need avoid using vba since version of excel i'm using (mac excel 2008) not have function. there growing number of data points however, number or formatting of columns not change. ideally, i'll reviewing ...

javascript - ngResource remove record from query object with $delete -

fairly new angular. want use angular's $resource library consume our api services. i'm little lost on proper way delete record obtained via query() method. specifically, have endpoint user notifications. want to, on page load, user notifications, use ng-repeat loop on results , display notifications in nav bar. when user clicks remove icon, corresponding notification should deleted. here's stripped down version of code have: js: angular.module('myapp', ['ngresource']).factory('notifications',function($resource){ return $resource('/apiv2/user/notifications/:id', {id:'@id'}); }).controller('navigationcontroller',['$scope','notifications',function($scope, notifications){ $scope.notifications = notifications.query(); $scope.deletenotification = function(notification){ notification.$delete(); }; }]); html: <ul> <li ng-repeat="notification in notifications"...

html - css issue li in same line 50% of width -

http://liveweave.com/bnm1jj i try put both li element in same line occupying 50% of width not them in same line i not want use table structure . unable put both li in same line why ?? ul.primary_nav{ background-color:#494949; } ul.primary_nav li.selected{ background-color:#942f99; color:#494949; float:left; } ul.primary_nav li{ display:inline-block; padding-top:5px;padding-bottom:5px; width:50%; } ul.primary_nav li a{ display:block; height:36px; text-align:center; color:#c5c5c5; font-size:13px; text-shadow:0px 1px 0px #2a2a2a; text-decoration:none; font-weight:bold; } ul.primary_nav li span.icon{ display:block; margin:auto; width:22px; height:22px; } please tell missing make following change: ul.primary_nav li.selected{ background-color:#942f99; color:#494949; float:left; } ul.primary_nav li{ display:inline-block; padding-top:5px;padding-bottom:5px; width:50%; width:50%; float:left; ...