Posts

Showing posts from April, 2014

visual c++ - VC++ Dll Not Working On Windows XP Sp3 When Using C++ Builder -

i have created vc++ dll in visual studio 2013. extern "c" int __declspec(dllexport) __cdecl convertimagetotext(char* datapath, char* imagefilepath, char* captchacode) { // return 0; } i'm using in borland c++ builder 6 that. hmodule dllhandle = loadlibrary("captcha.dll"); int (__cdecl *convertimagetotext)(char*,char*,char*); convertimagetotext =(int (__cdecl *)(char*,char*,char*))getprocaddress(dllhandle, "convertimagetotext"); if (convertimagetotext != null ) { convertimagetotext("","",""); }else { showmessage("convertimagetotext pointer not found !"); } it's working in win7/8/8.1.there isn't problem. but can't find pointer of convertimagetotext on windows xp sp3. i have changed vc++ dll project "platform toolset" "visual studio 2013 - windows xp (v120_xp)".nothing not changed. i have checked visual c++ redistributable packages.all i...

c++ - I am stucked with this code of accessing values in 2D array using pointers -

int main() { int a[4][2] = {1,2,3,4,5,6,7,8}; printf("%d\n",*(a[2]+1)); printf("%d\n", *(*(a + 2)+1)); getch(); } two-dimensional array can thought of one-dimensional array. output of program 6 in both printf. question how printf("%d\n", *(*(a + 2)+1)); executing , how precedence of asterik * , + evaluating. let's consider both printf calls. a[2] in cell int[2] = {5,6} a[2] + 1 pointer holds address of number 6 (a[2] implicitly converted pointer), after dereference 6. a , int[4][2] array, converted pointer (after conversion holds pointer first element) a + 2 pointer holds address of pointer number 5 *(a + 2) pointer holds address of number 5 *(a + 2) + 1 pointer holds address of number 6 *(*(a + 2) + 1) number 6 edit: sorry, wrong statements. take account comments , need add in above example lvalue expression of array type implicitly converted pointer first element.

ckeditor does not rise always onSelectionChange event -

i try onselectionchange event ckeditor. when select ckeditor rise correctly event, if select else in same paragraph event not raised. is there way make creditor rise onselectionchange event time select text. ? any advice on solve issue ? thanks the answer in api documentation : fired when selection inside editor has been changed. note event fired when selection's start element (container of selecion start) changes, not on every possible selection change. selectionchange fired less frequently, on every context (the elements path holding selection's start) change. you can observe mouse , keyboard actions though ( jsfiddle ): function logselection() { console.log( this.getselection() ); } ckeditor.replace( 'editor', { on: { contentdom: function() { this.document.on( 'mouseup', logselection, ); this.document.on( 'keyup', logselection, ); } } } );

php - Expiration not specified" according to Gtmetrix -

i have website https://royzez.com,i using .htaccess leverage browser caching mentioned code in gt metrix still getting message (expiration not specified). these images coming cdn. there other configuration in cdn server? how fix issue. code using ` expiresactive on expiresdefault "access plus 1 month" # css expiresbytype text/css "access plus 1 month" # favicon (cannot renamed!) , cursor images expiresbytype image/x-icon "access plus 1 week" # html expiresbytype text/html "access plus 0 seconds" # javascript expiresbytype application/javascript "access plus 1 year" expiresbytype application/x-javascript "access plus 1 year" expiresbytype text/javascript "access plus 1 year" # manifest files expiresbytype ...

Index exceeds matrix dimensions error in matlab -

this question has answer here: index exceeds matrix dimensions when finding max value 3 answers i error index exceeds matrix dimensions when run following in matlab. doing wrong? >> = 1 2 3 4 5 6 7 8 9 >> a(:) ans = 1 4 7 2 5 8 3 6 9 >> sum(a(:)) index exceeds matrix dimensions. >> sum(a(:),1) index exceeds matrix dimensions. >> sum(a(:),2) index exceeds matrix dimensions. you did set variable under name sum a = [1 2 3 ; 4 5 6; 7 8 9] sum = 1; >> sum(a); index exceeds matrix dimensions. clear sum; >> sum(a) ans = 12 15 18

c++ - inconsistent behavior of boost spirit grammar -

this question has answer here: undefined behaviour somewhere in boost::spirit::qi::phrase_parse 1 answer i have little grammar want use work project. minimum executable example is: #pragma gcc diagnostic push #pragma gcc diagnostic ignored "-wunused-local-typedefs" #pragma gcc diagnostic ignored "-wmaybe-uninitialized" #pragma gcc diagnostic ignored "-wunused-variable" #include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/qi_grammar.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/support_istream_iterator.hpp> #pragma gcc diagnostic pop // pops #include <iostream> int main() { typedef unsigned long long ull; std::string curline = "1;2;;3,4;5"; std::cout << "parsing: " << curline << "\n"; nam...

Laravel: ORM retrieving data ordered by related table -

i creating simple messenger laravel 4, fuctionality pretty same facebook messenger. have problem making eloquent query list latest messages threads logged user. consider have following db tables messenger (there users table): +-----------+ +--------------+ +----------------+ +----------------+ +-----+ |threads | |thread_users | |messages | |messages_status | |users| +-----------+ +--------------+ +----------------+ +----------------+ +-----+ |id | |id | |id | |id | |id | |title | |thread_id | |thread_id | |user_id | |name | |created_at | |user_id | |sender_id (user)| |message_id | +-----+ |deleted_at | |created_at | |content | |deleted_at | +-----------+ |deleted_at | |created_at | +----------------+ +--------------+ +----------------+ db explanation: when user writes first message creates thread. users added thread listed in ...

objective c - iOS Calendar Events View representation -

Image
what best approach implement calendar events shown below [ios 8.3]: the underlying view uitableview sure. how can overlap different views have here? possible view overlap between different uitableviewcell ? and touch events on these event views flawless. any suggestions/lead appreciated. this not table view, it's father collection view. collection views more abstracted , require more implementations, using custom flow layout can amazing things. more info in official apple documentation , kind of calendar view there awesome article on objectivec.io

lotus notes - Shared Columns behaving strangely -

i have database dozen shared view columns. when make change column value formula of shared column, changes not appear when preview views contain shared column. here have tried: 1. shift-f9 2. close , reopen database 3. close , reopen notes 4. go bed , check in morning. it appears code changes shared columns being saved views because after saving shared columns "last modified" date on views updated time saved shared column. also, if change shared column value formula "blah" works: views show "blah" every document in column. introduce formula shared column value (for example @text(@documentuniqueid) or field value or other formula) reverts showing me original values in column--as when shared columns saved. it's though columns can't changed whatever formula saved with, unless formula plain text (eg "blah"). does have insight? hope i'm making dumb mistake. i'm close trashing shared columns , building standard columns views...

pass php value to html element without using echo -

i getting value php $_get[], , want pass value of simple html input element. know can this: <? $value = $_get['value']; echo '<input type="text" name="value" value="'.$value.'" />'; ?> but there way separate php html, giving value textbox without echoing it? i create textbox regular html element, , use php in part set value. the answer of iaroel more practical purposes, liked way accepted answer covered many concerns - think more valuable other users. you don't want error when $_get['value'] becomes undefined. <?php $value = isset($_get['value'] ? $_get['value'] : ''); ?> <input type="text" name="value" value="<?php echo $value; ?>"> but be mindful malicious data can inserted in $_get['value'] you've got apply proper sanitation $value with regards " getting $_get['value...

javascript - Socket.io chat server not presenting SSL certificate -

a (simple) chat part of application i've created while back. today i'm switching website http https. therefore have ssl socket.io chat socket, otherwise browsers whine. for reason though chatserver isn't presenting certificate @ all. using openssl on linux confirms this: openssl s_client -connect my.subdomain.tld:1337 -servername my.subdomain.tld -ssl3 returns connected(00000003) 140136057653064:error:1409e0e5:ssl routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:596: --- no peer certificate available --- no client certificate ca names sent --- ssl handshake has read 0 bytes , written 0 bytes --- new, (none), cipher (none) secure renegotiation not supported compression: none expansion: none ssl-session: protocol : sslv3 cipher : 0000 session-id: session-id-ctx: master-key: key-arg : none krb5 principal: none psk identity: none psk identity hint: none start time: 1436357417 timeout : 7200 (sec) verify...

android - Uses_permission ignored in androidmanifest.xml -

i've got strange error when building project in android studio. app uses gps current location of user.so in androidmanifest.xml i've placed line: <uses-permission android:name="android.permission.access_fine_location" /> but when building app,this exception keeps popping up: e/androidruntime﹕ fatal exception: main java.lang.securityexception: provider gps requires access_fine_location permission when using networkprovider lastknownlocation, app works fine (and use permission). edit: permissions tag not within application tag. does recognize error? place outside application tag. <uses-permission android:name="android.permission.access_fine_location"></uses-permission> <application..... make sure uses-permission element not inside application element. android studio not show problem in case.

xcode - C++ std::printf("%u", 5) adds a number after the expected output -

the output of following code 51 instead of expected 5 . use xcode 6.4 llvm compiler on mac os yosemite 10.10.4. #include <iostream> int main(int argc, const char * argv[]) { std::cout << std::printf("%u", 5) << std::endl; return 0; } if have tried supply int , unsigned long , uint32_t , , have swapped %u %d , %lu , same result: strange number being after intended printf output. swapping 5 number results in unexpected number being added output. in fresh project no other code added. overlooking? printf returns int. in case returning 1 number of characters written ( 5 ). cout printing 1 , after printf prints 5 because you're chaining them together. to 5 , say: std::printf("%u\n", 5)

autolayout - How to disable constraint at run time in ios? -

Image
i having view further having text fields. have set aspect ratio of view self & super view. when click text field keyboard appears resizing view & setting y position keyboard not cover textfields. using below code that. - (void)textfielddidbeginediting:(uitextfield *)textfield { /* keyboard visible, move views */ if([textfield isequal:self.txt_twitter] || [textfield isequal:self.txt_linkedin]) { [uiview animatewithduration:0.1f animations:^ { cgrect rect = self.view.frame; // 1. move view's origin text field hidden come above keyboard // 2. increase size of view area behind keyboard covered up. rect.origin.y -= 130; rect.size.height += 130; self.view.frame = rect; }]; } } - (void)textfielddidendediting:(uitextfield *)textfield { /* resign first responder, hide keyboard, move views */ /* keyboard visible, move views */ if([textfiel...

android - analytics make the app crash if no Google Play Services (or gpservices v3) -

i implemented google analytics v4 google play service api v6.5 in android app. @ moment cannot update google play service api last version (7.5). the problem when smartphone has no google account , google play services not up-to-date, app crash without error (no logs, no popup in phone). here code : googleanalytics analytics = googleanalytics.getinstance(this); analytics.enableautoactivityreports(this); analytics.getlogger().setloglevel(logger.loglevel.verbose); googleanalyticshelper.createtracker(googleanalyticshelper.trackername.app_tracker, r.xml.analytics); and public synchronized tracker createtracker(trackername trackerid, int xmlresid) { if (!mtrackers.containskey(trackerid)) { googleanalytics analytics = googleanalytics.getinstance(rootcontext); tracker t = analytics.newtracker(xmlresid); t.set("&tid", resconfig.getinstance().analyticstrackingid()); mtrackers.put(trackerid, t); } ret...

java - IntelliJ Hot Deploy Resources from dependency modules -

i have searched web 8 hours , tried solutions none of them seemed work. the problem have resource files coming dependency module not being hot deployed in jetbrain's intellj idea. have resources such xhtml, css etc. in of them. resources module producing war being hot deployed. i tried manipulate exploded artifact in project settings dialog, deleted module maven-dependencies artifact (they included jar files, that's why contents of module jars don't hot deployed) won't work @ all. is not practice have multi modules provide resources? has figured out how configure artifact correctly both java , resources hot deploy / hot swap? as mentioned, changes in java classes living in subprojects reflected immediately.

vb.net - Printform Dialogbox Appears In PrintPreview -

Image
i created app calculation of hvac equipment. ok ( my last question in app ) i'm facing new problem. when click print button , select printer, print preview dialog shows me printer selection dialog's traces. i tried sleep function @ different rows doesn't work. how can fix app ? here code: private sub button1_click(sender object, e eventargs) handles button1.click button1.visible = false combobox1.visible = false printdialog1.printersettings = printform1.printersettings printdialog1.allowsomepages = true if printdialog1.showdialog = dialogresult.ok thread.sleep(3000) me.printform1 printform1.printersettings = printdialog1.printersettings .printaction = printing.printaction.printtopreview dim mymargins new margins mymargins .left = 40 .right = 40 .top = 40 .bottom = 40 end .printersettings.def...

c++ - Why is typeid behaving differently for references and pointers? -

this question has answer here: typeid polymorphic types 1 answer typeid polymorphic pointers? 2 answers basically wondering why typeid not return typeinfo of derived type if given pointer derived type. example: if having: class base { public: virtual void foo() { std::cout << "this base speaking" << std::endl; } }; class derived : public base { public: void foo() override { std::cout << "this derived speaking" << std::endl; } }; the following: derived obj; base& ref = obj; base* ptr = &obj; std::cout << typeid(obj).name() << std::endl; std::cout << typeid(ref).name() << std::endl; std::cout << typeid(ptr).name() << std::endl; would result in: 7d...

javascript - Hide fixed header on scroll down, show on scroll up and hover version 2 please -

i know question has been asked here before, don't way scripted , looks unstable when running. i following: hide header on scroll down fadeout show header on scroll fadein show header on hover i decided not show of js other examples, because people intend work on those, don't work good. hope can must easy coder. --> fiddle html: <header> <nav> <div class="mob-nav"> <div class="nav-toggle"><i class="nav-icon"></i></div> </div> <ul class="left-nav"> <li class="home"><a href="#">pixelation</a></li> </ul> <ul class="right-nav"> <li><a href="#">work</a></li> <li><a href="#">about</a></li> </ul> </nav> </header> use scroll function in jquery - ...

c++ - undistortPoints, findEssentialMat, recoverPose: What is the relation between their arguments? -

in hope broader audience, repost question here asked on answers.opencv.org well. tl;dr : relation should hold between arguments passed undistortpoints , findessentialmat , recoverpose ? i have code following in program, k , dist_coefficients being camera intrinsics , imgpts. matching feature points 2 images. mat mask; // inlier mask undistortpoints(imgpts1, imgpts1, k, dist_coefficients, noarray(), k); undistortpoints(imgpts2, imgpts2, k, dist_coefficients, noarray(), k); mat e = findessentialmat(imgpts1, imgpts2, 1, point2d(0,0), ransac, 0.999, 3, mask); correctmatches(e, imgpts1, imgpts2, imgpts1, imgpts2); recoverpose(e, imgpts1, imgpts2, r, t, 1.0, point2d(0,0), mask); i undistort points before finding essential matrix. doc states 1 can pass new camera matrix last argument. when omitted, points in normalized coordinates (between -1 , 1). in case, expect pass 1 focal length , (0,0) principal point findessentialmat , points normalize...

java - What's wrong with my builder pattern? -

i have problem in realisation of builder pattern. have 2 classes: package course_2; import java.util.date; public class student { private static int idstart = 0; private final int id = idstart++; private string name; private string surname; private string secondname; private date birthdate; private string address; private string phone; private int course; private int group; public static class builder { // Обязательные параметры private final string name; private final string surname; private final date birthdate; // Необязательные параметры, инициализация по умолчанию private string secondname = ""; private string address = ""; private string phone = ""; private int course = 1; private int group = 1; public builder(string name, string surname, date birthdate) { this.name = name; this.surname...

xml - How to communicate over HTTPS using VFP -

background: asked create 'middle man' web service program written in visual fox pro(vfp) vfp not able communicate on https, http. vfp program must communicate different web service, web service must edit xml file https 'compliant'. i have never worked web services before this, have written few basic web services learn them. need understand have regular xml file make 'compliant' https , not http. apologise if jargon off still finding way around web services. vfp can send https requests using west wind internet & client tools visual foxpro

Hiding "Soft Touch" area in Android Studio -

is possible remove soft touch area @ bottom of android studio's design view? mean 1 has triangle, square, , circle shapes? if talking emulator in layout design views navigation bar... if don't want see navigation bar change avd 480x800 device configuration.

php - Codeigniter form_open 404 -

after searching hours still don't why 404 error when form_submit. my controller looks this: class pages extends ci_controller{ function view($page = 'home'){ $this->load->helper('url'); if(!file_exists('application/views/pages/'.$page.'.php')){ show_404(); } $data['title'] = $page; $this->load->view('templates/view',$data); } public function login_validation(){ } the view page: <?php echo form_open('pages/login_validation'); echo form_input(array( 'name' => 'firstname', 'placeholder' => 'voornaam', 'class' => 'form-control input-lg', 'tapindex' => '1' )); echo form_submit(array( 'name' => 'login_submit', 'value' => 'register', 'class' => 'btn btn-primary' ));?> .htaccess (in root folder): rewriteengine on rewritecond %{request_f...

cordova - phonegap build error - you may not have the required environment -

when ever i'm trying build phonegap project with: $phonegap build an error encountered failing compilation. kindly find error message , testify origin , solution. e:\phonegap projects\myproject>cordova build android running command: cmd "/s /c ""e:\phonegap projects\myproject\platforms\android\cordova\build.bat""" android_home=c:\users\rajan\appdata\local\android\sdk java_home=c:\program files\java\jdk1.8.0_45 cp: copyfilesync: not write dest file (code=eperm):e:\phonegap projects\myproject\platforms\android\gradlew.bat shell.js: internal error error: eperm, operation not permitted 'e:\phonegap projects\myproject\platforms\android\gradle\wrapper\gradle-wrapper.properties' @ error (native) @ object.fs.opensync (fs.js:500:18) @ object.fs.writefilesync (fs.js:1099:15) @ object._sed (e:\phonegap projects\myproject\platforms\android\cordova\node_modules\shelljs\src\sed.js:39:8) @ object.sed (e:\phonegap projects\myproject\platforms...

json - How to get certain data from a page to be recorded into a file using php? -

i using facebook graph api reach of post in webpage and returns page content: { "data": [ { "id":"129788793265_10154069879148266/insights/post_impressions_unique/lifetime", "name": "post_impressions_unique", "period": "lifetime", "values": [ { "value": 1627 } ], "title": "lifetime post total reach", "description": "lifetime: total number of people page post served to. (unique users)" } ], "paging": { "previous": "https://graph.facebook.com/<postid>/insights/post_impressions_unique/lifetime?access_token=xxxx", "next": "https://graph.facebook.com/<postid>/insights/post_impressions_unique/lifetime?access_token=xxxx" } } i want extract "value...

Why does Hexo generation take so long? -

as file count increases, hexo spends more , more time generating static html files using 'hexo g'. why hexo reconstruct every single '.md' file, instead of limiting files modified? my hexo version 3.0.1. it depends on several things, major bottlenecks are: theme not using cache the author introduced fragment cache last year cache static parts (header, footer, sidebar). theme author use speed page generation. try changing other themes , see if there different. highlight.js language detection highlight.js try auto-detect language in code block if no language specified since 3.0, takes considerable time. consider using plain , auto_detect option (#1124) , see if there different. it has been mentioned , not committed, use incremental approach in generating static html. my workflow of using hexo is: - hexo serve preview update modify iteratively in step using hexo-livereload saves actively reloading page - hexo generate / hexo de...

Python passing list into a function and return back to main -

i taking 3 values users. number1, number2 , power, considering number1 , number2 range of list. trying pass list of of numbers function parameter along power value parameter. using pow function calculate powers of each of numbers in list using loop. want store results in same list passed function , return main function , print there. question is, assume trying wrong approach since output not expected. declared list (results) , store power results numbers list it. asigned results list numbers list, copy values in it. when return numbers list , print in main function, still shows same values in numbers list before sent function. though when try print list inside function, gives correct output. how wrong, , how should correct it? def powerlist(numbers, power): print("in function") print(numbers) print("calculating powers") result = [] x in range(len(numbers)): result.append(pow(numbers[x], power)) numbers = result return(numbers) def...

vb.net - For each using linq how to use else -

i have code checking specific files , if condition fulfilled going in stats.matching.... using each linq: each file string in file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) ftpfile.contains(currentreportname) select file1 stats.matchingfiles.add(file) next the question how implement else here. so want fill collection files don't contain word. dim matching = file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) ftpfile.contains(currentreportname) dim mismatching = file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) not ftpfile.contains(currentreportname) each file string in matching stats.matchingfiles.add(file) next each file string in mismatching stats.mismatchingfiles.add(file) next that simple solution, use excep...

ios - When app backgrounded lock screen does not fully animate in -

background when app backgrounded want have lock screen forces user log in again. have implemented in onresignactivation method in appdelegate . functionally works fine, however, when backgrounded lock screen tries slide in doesn't have time complete. when app opens again animation completes. question how can animation complete or not use animation @ when ever app opened again lock screen there , not half way across? solution the solution in fact in implement lock screen logic in didenterbackground instead of onresignactivation in appdelegate . as code running in life cycle getting half animation behaviour. putting in didenterbackground resolves this. these answers helped me arrive @ solution. https://stackoverflow.com/a/12416131/1593273 https://stackoverflow.com/a/25985478/1593273

python - `How to use a chain of callbacks in scrapy -

i trying build crawler using scrapy , selenium webdriver. trying set of urls in parse() , pass callback function parse_url() again gets different set of urls , passes parse_data() the first callback parse_url works second parse_data gives assertionerror i.e if run without parse_data prints list of urls. if include assertion error i have this class myspider(scrapy.spider): name = "myspider" allowed_domains = ["example.com"] start_urls = [ "http://www.example.com/url", ] def parse(self, response): driver = webdriver.firefox() driver.get(response.url) urls = get_urls(driver.page_source) # get_url returns list yield scrapy.request(urls, callback=self.parse_url(urls, driver)) def parse_url(self, url, driver): url_list = [] in urls: driver.get(i) url_list.append( get_urls(driver.pagesource)) # gets more urls yeild scrapy.request(urls, callback=self.parse_data(url...

excel - SendMessage can't get text with WM_GETTEXT -

i trying text of window sendmessage function. however, can length of text can't text. guess type of txt (string) not correct sendmessage. thanks. const wm_settext = &hc const wm_gettext = &hd const wm_gettextlength = &he dim hwnd long dim hwnd_child long dim result long dim txtlen long dim txt string hwnd = findwindow(vbnullstring, "İngilizce türkçe sözlük") hwnd_child = findwindowex(hwnd, 0, "edit", vbnullstring) txtlen = sendmessage(hwnd_child, wm_gettextlength, 0, 0) s = space$(txtlen + 1) result2 = sendmessage(hwnd_child, wm_gettext, byval txtlen, txt) msgbox txt

r - Using optim on a two-variable function -

i having trouble optimizing on function 2 parameters. # creating corresponding mock data set n=2000 x <- rnorm(n,0,1) x <- cumsum(x) n=length(x) k=1 dx = rep(0,n-k) (i in k:(n - 1)){ sumx = 0 (j in 0:k){ sumx = sumx + (-1)^j*choose(k,j)*x[i-j+1] } dx[i-k+1] = sumx } vpk <- matrix(ncol = 1, nrow = 10) (p in seq(from=1, to=10,by=1)) { vpk[p*1] <- sum(abs(dx)^p) } vpk = data.frame(vpk); names(vpk)='v1'; vpk$v2 = 1:10; now minimizing function rab <- function(a,b){ g <- ifelse(a>0 & a<1-1/p & p >=b & b<=2, a*p, ifelse(a>0 & a<1-1/b & p< b & b<=2, -1+(a+1/b), ifelse(a >= 1-1/pmax(p,b) & b<=2,-1+p,na))) } #p=1 suma <- function(a,b){ sume=0 for(p in seq(from=1,to=10, by=1)){ sume = sume + (log(vpk$v1[p])/log(n^(-1))-outer(a,b,rab))^2 } return(sume) } the values minimize on a , b , , values a , b follows: a= seq(0.1,5,by=0....

swift - How do I call a function with an array of strings as a parameter? -

i have array of strings i'm trying use in function var postionrotation:array = ["100,45,0.4","305,45,-0.2","505,45,0.3","705,45,-0.1","905,45,0.2"] func loadsprite(arrayofpositions:[string],nameofsprite:string,spritetexturename:string) { // pass in array positions , rotations of sprites // string spritename // string spritetexturename position in 0...arrayofpositions.count { var tempstring = arrayofpositions[position ]as string//takes string ie: 143,628,0.6 var tempstringarray : [string] = tempstring.componentsseparatedbystring(",") // adds each item seperated , array let xpos = cgfloat((tempstringarray[0] nsstring).floatvalue)// exstracts x cord let ypos = cgfloat((tempstringarray[1] nsstring).floatvalue)//exstracts y cord let rot = cgfloat((tempstringarray[1] nsstring).floatvalue)//exstracts zrotation let spritename = skspritenode(imagenamed: spritetexturename) // add v...

celery.beat: periodic tasks on windows -

i trying running periodic tasks on celery beat. i tried same way described here: http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#beat-entries maybe because not quite sure put files , how import everything.. or maybe it's because of wrong timezone (i tried several things here though). i put in 1 file: from __future__ import absolute_import import time import job_example celery import celery datetime import timedelta celery.schedules import crontab celerybeat_schedule = { 'add-every-30-seconds': { 'task': 'tasks.add', #'schedule': crontab(hour=15, minute=30, day_of_week=1), #'schedule': crontab(), # execute every minute 'schedule': timedelta(seconds=30), 'args': (15, 16), }, } celery_timezone = 'europe/berlin' # celery_timezone = 'utc' app = celery(include=['tasks']) app.conf.update( broker_url='amqp://localhos...

Unlist a list - common lisp -

this question has answer here: how splice list outside of macro in common lisp? 2 answers i have function returns this: '(1 4 2 8) and want apply following type of functions it: (name &rest) for example: (max '(1 4 2 8)) produces error, but: (max 1 4 2 8) does not. have "unlist" list. how may go doing that? the form apply traditional way: (apply 'max '(1 2 3 4)) ; => 4

android - java.lang.ArrayIndexOutOfBoundsException: length=5; index=5 -

i new in android development. working on app using navigation drawer, in have 7 items.i using arraylist them show them on oncreate. navdraweritems = new arraylist<navdraweritem>(); // adding nav drawer items array // home navdraweritems.add(new navdraweritem(navmenutitles[0], navmenuicons.getresourceid(0, -1))); // find people navdraweritems.add(new navdraweritem(navmenutitles[1], navmenuicons.getresourceid(1, -1))); // photos navdraweritems.add(new navdraweritem(navmenutitles[2], navmenuicons.getresourceid(2, -1))); // communities, add counter here navdraweritems.add(new navdraweritem(navmenutitles[3], navmenuicons.getresourceid(3, -1), true, "22")); // pages navdraweritems.add(new navdraweritem(navmenutitles[4], navmenuicons.getresourceid(4, -1))); // what's hot, add counter here navdraweritems.add(new navdraweritem(navmenutitles[5], navmenuicons.getresourceid(5,-1), true, "50+")); navdraw...

.net - Regular Expression validation in ASP.NET for special chars -

i need validate scenario in regex, i'm using regularexpression validation in asp.net. shouldn't start or end space doesn't contain space whole string shouldn't contain 2 special char "@" & "?" valid: "as#d qwe2", "&^%$$(&+_", "12#$.p" invalid: " ", "asd ", " asd#", "ksdhf?kh", "asdf@asd" i'm trying this: <asp:regularexpressionvalidator id="regularexpressionvalidator1" runat="server" controltovalidate="textbox1" errormessage="regularexpressionvalidator" validationexpression="^[^\s]+(\s+[^@?]+)*[^\s]$">error</asp:regularexpressionvalidator> untested regex: ^([^ @?][^@?]*[^ @?]|[^ @?])$

sql server - SQL return max value only -

i have done basic queries using max 1 has little more it. using ssms 2012. need include group or distinct. select statement - select a.year1, a.periodid gpstj..sy40100 a.closed = 0 , a.periodid <> 0 , a.series = 5 this returns following results - year1 periodid 2015 12 2015 12 2016 1 2016 1 2016 2 2016 2 i want return 1 row, maximum value in year column first, , maximum period id - year1 periodid 2016 2 thanks just ordering top (1) select top (1) a.year1, a.periodid gpstj..sy40100 a.closed = 0 , a.periodid <> 0 , a.series = 5 order a.year1 desc, a.periodid desc

apache httpclient 4.x - Handle Circular redirect using Rest Assured -

i trying send request method 1 of our product api. url needs site minder authentication , redirects requested target. i can able response setting circular redirect true using apache http client. code looks this httpclient client = new defaulthttpclient(); httpget = new httpget(url); client.getparams().setparameter(clientpnames.allow_circular_redirects, true); get.setheader("authorization", "basic "+encodedauth ); httpresponse response = c.execute(get); how work rest assured library ? tried below getting caused by: org.apache.http.client.circularredirectexception: circular redirect to code : `//restassuredconfig.config().getredirectconfig().followredirects(true).allowcircularredirects(true);` restassuredconfig.newconfig().gethttpclientconfig().setparam("http.protocol.allow-circular-redirects", true); response r = given().header("authorization", "basic " + encodedauth).get( url); ...

asp.net - How do I share common web resources between web applications in Visual Studio 2013? -

Image
i have 2 different web application in different solution admin.presentation , users.presentation . have common css, , images apply , feel in both application, want make in seperate solution common.presentation , take service reference according use. no have question in condition how share common web resources among 2 different web application. i got stuck in situation,during registration saving user images directory , path of directory saved in database along userid. if admin see daily user registration,userimage become unavailable him want save these images common.presentation . is right approach? plase assist...!!

c# - Get the Key and Value from Dictionary in Silverlight Application -

Image
i need value dictionary(which returned webservice) in silverlight application. i dictionary value in variable val . serviceclient.getmappingcompleted += (obj, val) => { //here need key , value result int key = ? string value = ? } you may access dictionary using val.result . here code: foreach (keyvaluepair<int, string> item in val.result) { int key = item.key; string value = item.value; } if looking first keyvaluepair in dictionary may try (don't forget add using system.linq; first method available) : var key = val.result.first().key; var value = val.result.first().value;

how to determine whether an idea should be treated as table or attribute in relational database? -

i'm database beginner , i'm confused regards entity relationship. don't know when should idea classified attribute (i.e. field) or table (i.e. entity). can please me understand this. thank you. terminology issues can confusing. , it's hard because experts , authors have not been consistent each other since relational model launched in 1970. here's how learned it. at conceptual level, 1 concerned how values stored , managed database relate subject matter. subject matter analyzed entities , relationships among entities (er model). attributes features of entities or relationships can described data values. database values instances of attributes. at logical level, 1 concerned relational model of data. relations in relational data model mathematical relations, relational math can presumed hold. attributes discovered @ conceptual level become (named) attributes of relations. relations sets of tuples common attributes. tuples identified keys , r...

php - Take image from S3. Rotate it and again save rotated image on the S3 server -

i working on rotate image functionality. end users has option rotate images. have given ajax call rotate image. i have image url http://myservername/e8520a11e5809268b920138badc416cf i have tried implementing below steps: $src = http://myservername/e8520a11e5809268b920138badc416cf; $content = pcurl::get($src); $originalfile = tempnam("/tmp", "tempimagecontent"); file_put_contents($originalfile, $content); $source=imagecreatefromjpeg($originalfile); //only jpg file. written switch statmt $rotate = imagerotate($source, 90, 0); $rotatedtmpfile = tempnam('/tmp', 'rotatedthumbnailimage'); imagejpeg($rotate, $rotatedtmpfile ,100); storing on s3. facing below error when s3 returns hash key. , trying see image using http://bucketname/hash_key <code>accessdenied</code><message>access denied</message> please help!!

How can i get current date and time in android and store it into string -

currently using code below: string currentdatetimestring = dateformat.getdatetimeinstance() .format(new date()); from getting output in following format - jun 5, 2015 1:15:29 pm but want output in format below- 2015-06-05 08:10:40 it can in 12 or 24 hour format. i want current date time above datetime format. i have use simpledateformat not able above date time format current date , time so, how can achieve this? use simpledateformat date curdate = new date(); simpledateformat format = new simpledateformat("yyyy-mm-dd hh:mm:ss a"); string datetostr = format.format(curdate); system.out.println(datetostr);

javascript - Getting CallSid from Twilio in ougoing calls using js -

i know if there way retrieve callsid using twiliojs library outgoing call done browser phone. think i'm not able post client server since don't have id of call. i've tried find out parameters of connection object: var connection = twilio.device.connect() but no callsid appears there. know how can parameter, or lets me identify ougoing call i've done js library? thanks :d as seen in https://www.twilio.com/docs/client/connection , connection should twilio.connection object have property named parameters callsid attribute both incoming , outgoing connections. it available after connection made, should use event handler connect event: twilio.device.connect(function(connection) { var callsid = connection.parameters.callsid; });

I can't install libgfortran3 on ubuntu -

i tried install libgfortran3 on ubuntu: sudo apt-get install libgfortran3 but there error not understand: the following packages have unmet dependencies: libgfortran3 : depends: gcc-4.8-base (= 4.8.2-10ubuntu2) 4.8.2-19ubuntu1 installed e: unable correct problems, have held broken packages. how can fix it? suggestion: install "best" gcc available: sudo apt-get install gcc . <= should install "4.8.2-19ubuntu1" then install "libgfortran3" "-force": sudo apt-get -f install libgfortran3 . <= libfortran apparantly "expecting" gcc 4.8.2-10. shouldn't problem... make sure works. please post if have problems or questions.

php - YII2 : Add Dynamic form fields and their validations -

i adding dynamic form fields onchange of dropdown. both types of fields coming different models , go database in different tables. have defined validation rules in models. but validation not working properly. code follows: model : <?php namespace common\models; use yii; /** * model class table "{{%membership_features}}". * * @property integer $id * @property string $title * @property string $type * @property integer $is_new * @property integer $status * @property integer $is_deleted * @property string $created_date * @property string $modified_date * * @property membershipfeaturesvalue[] $membershipfeaturesvalues */ class membershipfeatures extends \yii\db\activerecord { /** * @inheritdoc */ public $value=[]; public static function tablename() { return '{{%membership_features}}'; } /** * @inheritdoc */ public function rules() { return [ [['title', ...