Posts

Showing posts from June, 2014

Fastest way to read binary into int[] in java? -

in java, fastest way read huge binary file int[] . saw solution fastest way read huge number of int binary file but there 2 solutions, , don't know better. seem give fixed maximum size int[], how can variable size? how can set fit amount of data in binary exactly. there way know how many ints there in file? thanks you have variables calculate time in both solutions, compare two. while (bytesread != -1) { double start = system.currenttimemillis(); while(doingstuff){} double timetaken = system.currenttimemillis() - start; } as array, use arraylist expandable. arraylist<int> binary = new arraylist<int>(); binary.add(stuff);

mysql - iOS and PHP: Timeout error -

it has been 4 years since last wrote php code. trying write web service insert mysql database table. i'm passing data via post. in app using nsurlconnection , initing ok nsurlrequest. getting timeout error. when check db table it's cardinality still 0 know data not being inserted. , not getting hits on nsurlconnection delegate methods. suspicion there wrong php code. take @ , let me know if see odd. i know url correct. know post data being attached request ok. here's ios code: - (bool) submitaccountdata : (nsarray*) arraccounttextfields { bool success = yes; //set url nsurl* accounturl = [nsurl urlwithstring:kaccountservice]; nsmutableurlrequest* accounturlrequest = [nsmutableurlrequest requestwithurl:accounturl]; nsmutabledictionary* dictpostdata = [[nsmutabledictionary alloc] init]; for(kip_textfield* thistextfield in arraccounttextfields) { nsstring* strkey = thistextfield.placeholder; strkey = [strkey stringbytrimming...

avfoundation - Camera frames dropped after changing camera iOS -

my method didoutputsamplebuffer called until switch cameras using function: func switchcameras() { capturesession.beginconfiguration() capturesession.sessionpreset = avcapturesessionpresetmedium var error : nserror? = nil input in capturesession.inputs { capturesession.removeinput(input as! avcaptureinput) } if currentcamera == "back" { currentcamera = "front" if capturesession.canaddinput(avcapturedeviceinput(device: frontcamera, error: &error)) { capturesession.addinput(avcapturedeviceinput(device: frontcamera, error: &error)) } else { print(error) } } else { currentcamera = "back" if capturesession.canaddinput(avcapturedeviceinput(device: backcamera, error: &error)) { capturesession.addinput(avcapturedeviceinput(device: backcamera, error: &error)) } else { } } print("chagned") ...

Windows 10 KMCS Development Testing -

so i've spent day or 2 frustratedly googling how can develop 64 bit kernel-mode drivers in windows 10 (does not apply win8 or earlier), , test in development environment. basically have physical harddrive kernel-mode driver "mounts" virtual drive physical drive , maps win32 createfile api's user mode application routes commands remote network on server (similar vpn custom, flexible). i use install and run programs , store files on remote system needs emulated physical drive (network attached has limitations, , instabilities). - similar san, except in non-corporate network. so question(s) are, else frustrate microsoft blocking out developers kernel mode developing for personal use , when not have economy buy certificate? and options have running driver on my windows 10 computer, without purchased certificates? there doesn't seem ways circumvent new ev certificate system forces buy certificate, if know you're doing , accept risk of making syste...

pear - Can't run phpdoc (bad interpreter error) -

installed phpdocumentor via pear, when try run error: bash: /users/username/pear/bin/phpdoc: /usr/local/cellar/php55/5.5.9/bin/php: bad interpreter: no such file or directory i tried symlink 2 files no success. can run phpdoc ? edit file /users/username/pear/bin/phpdoc , change first line from #!/usr/local/cellar/php55/5.5.9/bin/php to path exists. alternatively, run php /users/username/pear/bin/phpdoc ... you should fix php binary pear uses first verifying it: pear config-get php_bin then changing with pear config-set php_bin /path/to/php after re-installing phpdoc via pear work now.

How do I put adjacent lines in a .txt file on the same line in linux bash? -

so new bash linux , trying fix .txt file. i have .txt file looks this: blueberry, "yummy", 12345, "i love fruit , eating apples" blueberry, "tasty", 4455, "fruit you" blueberry, "yum", 109833, "i go crazy fruit" blueberry, "wooohh", 1347672, "i love fruit , eating apples" blueberry, "yummy yummy", 1023433, "i love fruit more dog" blueberry, "yummy", 12345, "i love fruit , eating apples" blueberry, "something eat", 42, "fruit greatest thing ever" blueberry, "tasty", 4455, "fruit you" blueberry, "yum", 109833, "i go crazy fruit" i want create new .txt file looks this: blueberry, "yummy", 12345, "i love fruit , eating apples" blueberry, "tasty", 4455, "fruit you" blueberry, "yum", 109833, "i go crazy fruit" blueberry, "wooohh", 1...

javascript - Session not working on new server -

i have site changes whenever new location changed. location choices using drop down. , on change calls function: function prod_change_loc() { location_change = document.getelementbyid("prod_sel_loc").value; varurl = "http://" + varserveraddr + "/hourly_ft_wip/production_line/prod_line_loc.php?location_change=" + location_change, load(varurl, "location"); settimeout(function() { location.reload(); }, 100); } prod_line_loc.php contains: session_start(); $_session['hourly_ft_wip']['prod_loc'] = $_request['location_change']; $_session['hourly_ft_wip']['prod_tester'] = 'all'; and returns main page sets location using this: if(!isset($_session['hourly_ft_wip']['prod_loc'])){ $_session['hourly_ft_wip']['prod_loc'] = 'eolphl'; } else{ $_session['hourly_ft_wip']['prod_loc'] =...

javascript - $anchorScroll.yOffset not working for ngIncluded content -

i've got page angular has components can opened , closed. these components included via nginclude . able click on navbar menu item , scroll content within ngincluded divs. works far, $anchorscroll.yoffset value not seem impact way anchorscroll works, means content div s nginclude partially hidden behind navbar. anybody else experience this?

swift - Get data from tableView row data (unexpectedly found nil) -

i populating tableview array can't seem set textlabel property using row's object. here's relevant code: let object = realmatches[indexpath.row] username = object["first_name"] as! string cell.textlabel?.text = username return cell i following error when try set username variable (which later used set cell.textlabel property): unexpectedly found nil while unwrapping optional value my realmatches array returning results know array not nil. think issue don't have "first name" property in matches table. it's located in user table, have pointer value in matches table points corresponding user. i'm using parse backend. i tried using lengthy pfquery object's first_name doesn't seem pull results: var objectuser1 = object["user1"] as! pfuser var objectuser2 = object["user2"] as! pfuser var userquery = pfquery(classname: "user") userquery.wherekey("object...

Unable to bring up swagger-ui from spring-boot application -

i have spring boot application running using embedded tomcat server. partially successful in getting springfox-swagger integrated app. if /v2/api-docs , able see documentation of api's in webapp. however, when trying access same ui, not work. below detailed results. output of - localhost:8080/api/swagger-resources [ { "name" : "default", "location" : "/v2/api-docs", "swaggerversion" : "2.0" } ] output of - localhost:8080/api/v2/api-docs i valid results. can confirm , output large paste here but when try access swagger-ui, not work. below different url's invoked access swagger-ui. http://localhost:8080/swagger-ui.html - ui loading, no documentation of api's present http://localhost:8080/api/swagger-ui.html - 404 not found http://localhost:8080/springfox - 404 not found http://localhost:8080/api/springfox - 404 not found below swaggerconfig.java class package com.vmware.vrack.lcm; import...

asp.net - routing legacy webforms urls to mvc controller/actions? -

we planning convert legacy webforms incrementally on mvc. (and learning mvc along way!) i wondering if routing appropriate way to, ineffect, replace old webforms pages controllers/actions 1 @ time. right have generated when creating mvc area , adding mvc project nuget: public overrides sub registerarea(byval context arearegistrationcontext) context.maproute( "mvc_default", "mvc/{controller}/{action}/{id}", new {.action = "index", .id = urlparameter.optional} ) end sub so controller "foo" action "bar", reference url ".../appname/mvc/foo/bar", while aspx pages accessed urls in ".../appname/pages/pagename". can use additional maproute() calls above, or maybe mappageroute() in routeconfig.vb in app_start, map individual pages corresponding new mvc controller/action? like? this let avoid touching messy code-behind on webforms side constructing our navigation urls. i...

excel - Autofill lines based off cell value -

first time poster here. i've been searching answer question, i'm having trouble finding similar situation answer works me. i'm using excel vba try solve problem work. i'm new vba environment i'm not sure how proceed. or advice appreciated! the problem: i have value in cell b14 on tab1. cell has count formula counts number of values on tab1. number (for example, 14), i'd go tab2 , copy formula in cells a2:h2 down number shown in cell, 14 rows. if b14 shows 27, i'd macro auto fill a2:h2 27 rows , on. i've tried few examples similar questions couldn't work. any advice? since value in b14 determined via formula, you'll need monitor worksheet_calculate event determine when value changes. static variable trick. add following event handler sheet1 : private sub worksheet_calculate() static b14_value long if range("b14") <> b14_value ' save new b14 value... b14_value = range(...

python - Convert a list of words to a list of integers in scikit-learn -

i want convert list of words list of integers in scikit-learn, , corpus consists of list of lists of words. e.g. corpus can bunch of sentences. i can follows using sklearn.feature_extraction.text.countvectorizer , there simpler way? suspect may missing countvectorizer functionalities, it's common pre-processing step in natural language processing. in code first fit countvectorizer, have iterate on each words of each list of words generate list of integers. import sklearn import sklearn.feature_extraction import numpy np def reverse_dictionary(dict): ''' http://stackoverflow.com/questions/483666/python-reverse-inverse-a-mapping ''' return {v: k k, v in dict.items()} vectorizer = sklearn.feature_extraction.text.countvectorizer(min_df=1) corpus = ['this first document.', 'this second second document.', 'and third one.', 'is first document? right.',] x = vectorizer.fit_transform...

c++ - Cannot access class member of a 2d array of object pointers (type***) -

i making conway's game of life. have 2 classes, 1 plane of cells, , cells. cells 2d linked list 4 pointers per cell pointing vertical , horizontal neighbors. when trying access of cell pointers other cells, or alive member program crashes. my code //game.h #ifndef game_h_ #define game_h_ #include <iostream> class cell{ public: bool alive; cell* top; cell* bot; cell* lef; cell* rig; cell(){ alive = false; top = bot = lef = rig = nullptr; } cell* link(char); int alive_neighbors(); void link_right(cell*); void link_down(cell*); void refresh_cell(); }; class field{ public: int size; cell * origin; bool ** new_state; cell *** fi; field(int a); ~field(); }; #endif and //game.cpp #include <iostream> #include "game.h" int cell::alive_neighbors(){ int num = 0; (this->t...

osx - Parse Output of Command into Variable LIVE (Network Traffic Monitoring) -

i writing network monitoring script in bash. base command using ettercap -t -m arp -i en1 // // . pipe egrep --color 'host:|get' it. a sample output getting looks this: get /images/srpr/logo11w.png http/1.1. host: www.google.com. /en-us/us/products http/1.1. host: www.caselogic.com. my desired output this: title: logo11w.png url: www.google.com/images/srpr/logo11w.png http/1.1. title: products - case logic url: www.caselogic.com/en-us/us/products things notice: http/1.1. , . @ end of host gone. formed 1 url , there blank line after each title / url listing. attempted forming them 1 url parsing commands output variable with var=`sudo ettercap -t -m arp -i en1 // // | egrep --color 'host:|get'` | echo $var but doesn't work because input variable command isn't done until user requests stop ( ctrl + c ). to title of html page, use command wget -qo- 'https://url.goes/here' | perl -l -0777 -ne 'print $1 if /<title.*?>\s*(....

objective c - Different standard Aqua space in ios 7 and 8 -

Image
i'm using xcode 7 beta 4, mac osx 10.10. app's deployment target ios 7.0. i know standard aqua space 20 between view , superview. when design storyboard ios 7, must use 8, this: and looks fine (above constraints search bar). when run ios 8 simulator, appears this: so must use right value 20. using 20 cut off subview in ios 7. anyone know if bug or there different between ios 7 , 8? happens simulators , real devices too.

python - How to submit huge number of small jobs using PBS queue system -

i need run huge number of small jobs (runs several minutes) using pbs queue system. these jobs using same script work on different input , take different time. because number of jobs large pbs queue cannot handle well. , because different jobs take different time, using pbsdsh not efficient. so idea solution wrap number of jobs (for example 100 small job) 1 job. 1 job can submitted node 16 cores. on node, 16 processes (corresponding 16 small jobs) run parallel on each core. once 1 process finished on core, new process runs on core. if can this, both reduce number of jobs lot (100 times) , not waste computing time. does 1 have recommendation solution on this? thanks. snakemake might fit in situation. take @ documentation --cluster , -j n options. when run snakemake -j n option submit n number of jobs @ time. each job finishes, start new one. p

hapijs - request.auth.isAuthenticated is false for 'try' or 'optional' auth modes -

referring lib/auth.js if handler uses try or optional strategy isauthenticated false, though user logged in , has active session. this bummer because have onpreresponse handler adds user credentials view context, used template show login or logout link. the onpreresponse code hapi-context-credentials the template looks (snippet): <ul class="nav navbar-nav"> <li>{{#if credentials.username}} <a href="/logout">logout</a> {{else}} <a href="/login">login</a> {{/if}} </li> </ul> edit: adding example source code this example code hapi-context-credentials modified remove auth config 1 of routes. test: navigate http://localhost:4000/hbs , login (john:secret) you greeted hello john! then navigate http://localhost:4000/jade , greeted hello guest! though have logged in inde...

ipmitool - IPMI password authentication -

i don't see option of password authentication @ ipmi channel 1 settings output. tried factory reset. can please let me know how can enable password authentication. $ipmitool lan print 1 auth type support : md2 md5 oem auth type enable : callback : md2 md5 oem : user : md2 md5 oem : operator : md2 md5 oem : admin : md2 md5 oem : oem : your ipmi device not support password authentication. following line in ipmitool output lists of authentication types supported in device: auth type support : md2 md5 oem so authentication types none , password not supported. due security reasons because both of them rather bad choice authentication. nevertheless bmc firmware developer authentication type supported. you can enable / disable authentication types supported device ipmitool: # ipmitool lan set 1 auth user none # ipmitool lan print 1 ...

batch file - Numeric comparison CMD issue -

the if statement here not work.why? mean sid ends 502 , enters first condition 502 greater 1000. -update : seems length problem.the number of digits must equal on both sides of comparison.how force them equal length ? @echo off echo programa de usuarios /f "skip=1" %%a in ('wmic useraccount name') ( if %%a gtr 0 ( /f "tokens=8 delims=-" %%b in ('wmic useraccount name^="%%a" sid') ( echo user accounts: if %%b geq 1000 ( echo name echo %%a wmic useraccount name^="%%a" sid echo %%b ) ) ) ) /f "skip=1" %%a in ('wmic useraccount name') ( if %%a gtr 0 ( /f "tokens=8 delims=-" %%b in ('wmic useraccount name^="%%a" sid') ( echo system accounts: if %%b lss...

php - Displaying Explode data using loop -

Image
i new in php. have code in use foreach loop display data in table of explode function. here have question the data in db here see after aatir there blank space. when use loop print data <?php ini_set('error_reporting', e_all); $servername = "localhost"; $username = "root"; $password = ""; $dbname = "pacra1"; $conn = new mysqli($servername, $username, $password, $dbname); $sql = "select * `pacra_clients` `id` = 50"; $conn->multi_query($sql); $result = $conn->use_result(); echo $conn->error; $row = $result->fetch_assoc(); $liaison_one = $row['liaison_one']; $liaison_one_chunks = explode(",", $liaison_one); echo '<table border="01">'; foreach($liaison_one_chunks $row){ echo '<tr>'; $row = explode(',',$row); foreach($row $cell){ echo '<td>'; echo $cell; ec...

html - POST Method Form doesn't pass variables unless refreshing the page -

i have html form modified purchased theme. the original theme utilizes php file execute form action. however; due client's need, need carry on variables signup page later registration purpose. here's problem. form works, if refresh page. when it's first time visiting website , input information in form, not carry on information after click submit. if refresh page, re-fill form , click submit information carry on no problem. my question is, sound normal problem html form? best way of constructing form pass on variables designated page? here's current code: <div class="contact-form"> <!-- form --> <form id="contact-us" method="get" action="http://example.com/registration/country.asp"> <div class="col-xs-12 animated" data-animation="fadein" data-animation-delay="300"> <!-- first name --> <input type="text" name=...

c# - "System.UnauthorizedAccessException" error when opening second serial port -

i need open second serialport in visual c# program read data arduino. worked fine, in case see below not work.. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.io.ports; using commandspd4i; namespace csharpexample { public partial class csharpexample : form { public commotorcommands motor1; public csharpexample() { initializecomponent(); motor1 = new commotorcommands(); motor1.setsteps(convert.toint32(numericschritte.value)); } serialport arduino; delegate void invokelb(string data); invokelb lbrecieveddelegate; int xpos = 0; private void startbtn_click(object sender, eventargs e) { // set comm settings motor 1 motor1.selectedport = comportbox1.text; motor1.baudrate = convert.toint32(baudratebox1.text); ...

Java Regex to Validate Full Name allow only Spaces and Letters -

i want regex validate letters , spaces. validate full name. ex: mr steve collins or steve collins tried regex. "[a-za-z]+\.?" didnt work. can assist me please p.s. use java. public static boolean validateletters(string txt) { string regx = "[a-za-z]+\\.?"; pattern pattern = pattern.compile(regx,pattern.case_insensitive); matcher matcher = pattern.matcher(txt); return matcher.find(); } what about: peter müller françois hollande patrick o'brian silvana koch-mehrin validating names difficult issue, because valid names not consisting of letters a-z. at least should use unicode property letters , add more special characters. first approach e.g.: string regx = "^[\\p{l} .'-]+$"; \\p{l} unicode character property matches kind of letter language

Facebook Android SDK 4.5.0 get email address -

i'm creating test application test using latest facebook sdk update our existing application problem need email address know depends if user has provided 1 on account. account i'm using test provides 1 sure unknown reason facebook sdk provides user_id , fullname of account , nothing else. i'm confused on since the sdk3 , above provides more information updated sdk4 , i'm lost on how email answers i've seen far doesn't provide email on end. here's code far: login button @onclick(r.id.btn_login) public void loginfacebook(){ loginmanager.getinstance().loginwithreadpermissions(this, arrays.aslist("public_profile", "email")); } loginmanager callback: loginmanager.getinstance().registercallback(callbackmanager, new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { requestuserprofile(loginresult); } @overr...

Serializable and Parcelable in Android -

i not clear distinct use of interface serializable , parcelable in android. if prefer use of parcelable , why on serializable . moreover, if pass data through webservice, can parcelable help? if so, how? so main difference speed, , matters on hand-held device. supposedly less powerful desktop. with serialisable comes goold old java, code this: class mypojo implements serializable { string name; int age; } no methods needed reflection used fields , values. , can me slow or slower ... and use parcelable have write this: class mypojo implements parcelable { string name; int age; mypojo(parcel in) { name = in.readstring(); age = in.readint(); } void writetoparcel(parcel dest, int flags) { dest.writestring(name); dest.writeint(age); } int describecontents() { return 0; } // , here goes creator , not }; according guys @google can much faster, parcelable s is. of course, ...

android - Circular Layout in service -

i want make circular layout image attached below. in service, want open it. have open 3 button set in service on button click want open semi circular layout in service. how can it? like here

jquery - How to call the same datepicker on 2 different input fields -

i'm using bootstrap datepicker , have situation need call datepicker in input field 2 or more times,but problem that,the datepicker opens on first input filed,but on rest won't. tried changing id of input , datepicker script,still won't work. please help. thx in advance code: <div class='form-group'> <div class='row'> <div class="col-xs-12 date"> <label>label1</label> <div class="input-group input-append date" id="daterangepicker"> <input id='input' type="text" value=' <?php echo $var; ?>' class="form-control" name="daterangepicker" required /> <span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span> ...

visual studio 2015 - The "RegisterFormRegions" task failed unexpectedly -

i trying create simple outlook 2013 add-in in visual studio 2015,but build fails following errors: "registerformregions" task failed unexpectedly. system.io.filenotfoundexception: not load file or assembly 'microsoft.visualstudio.tools.office.runtime, version=10.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. i had exact same issue visual studio 2013 , outlook 2010 , found msdn article ( http://msdn.microsoft.com/en-us/library/ms164304.aspx ) states: starting in visual studio 2013 update 3, task has new signature allows specify target framework version file. although doesn't apply vs2012 appears versions of office , targets tied version of visual studio building with. in case had ensure building against vs2013 update 3 when building against microsoft.visualstudio.tools.office.targets version=12.0.0.0 may want try combination if else failing.

php - mysql using max as where condition -

i got 4 fields page_id page_category_id page_sequence page_path for example record 1 page_id = 1 page_category_id = 22 page_sequence = 1 page_path = "1.jpg" record 2 page_id = 1 page_category_id = 22 page_sequence = 2 page_path = "2.jpg" record 3 page_id = 1 page_category_id = 23 page_sequence = 1 page_path = "23_1.jpg" record 4 page_id = 1 page_category_id = 23 page_sequence = 2 page_path = "23_1.jpg" record 5 page_id = 1 page_category_id = 23 page_sequence = 3 page_path = "23_1.jpg" .. , more records i want draw statement that $sql_select = "select page_category_id my_table max(page_sequence) < 3"; it show page_category_id max(page_sequence) less 3. but can't max(page_sequence) condition how can working.. thanks ! sql such fun, since can solve things in several different ways. here's not exists alternative: select distinct page_category_id tablename t1 not exists (select...

php - Unable to create a better database structure -

i want create basic project search buses 1 station another let have 4 stations a,b,c,d , have 4 buses 1,2,3,4 root of buses bus 1 : a->b->c->d bus 2 : a->c->d bus 3 : a->c->b bus 4 : a->b->d how can design database such system i have tried method 1: have created table 2 fields busno , busroute in bus route want store complete route of bus number. think searching in table complex or please suggest me better idea such project my hint is, 3 tables bus id name stops id name route busid stopid position

mysql - Distinct order-number sequence for every customer -

i have table of orders. each customer (identified email field) has own orders. need give different sequence of order numbers each customer. here example: ---------------------------- | email | number | ---------------------------- | test@com.com | 1 | ---------------------------- | example@com.com | 1 | ---------------------------- | test@com.com | 2 | ---------------------------- | test@com.com | 3 | ---------------------------- | client@aaa.com | 1 | ---------------------------- | example@com.com | 2 | ---------------------------- is possible in simple way mysql? if want update data in table after insert, first of need primary key, simple auto-increment column job. after can try elaborate various script fill number column, can see other answer, not "simple way". i suggest assign order number in insert statement, obtaining order number "simpler" query. select coalesce(max(`number`), 0)+1 orders...

c# - Text.Encoding.Default.GetBytes() / Encoding.Default.GetString() / Xamarin -

i have programmed server , client application under xamarin c# (for pc , android phone). now have problem umlauts (äöüÄÖÜ) @ text.encoding.default.getbytes () / encoding.default.getstring (). if server , client running on pc, umlauts converted correctly. when operated smartphone , pc question marks issued on conversion of umlauts. other data converted properly. where problem? private void cbuttonsend_click(object sender, eventargs e) { try { if (caktiveclient == "") toast.maketext(this, "wählen sie einen client aus!", toastlength.long).show(); else { string txt = csendetext.text; byte[] telegramm = new byte[txt.length]; telegramm = system.text.encoding.default.getbytes(txt); foreach (tcpclient c in cserver.clientlist) { if (c.client.remoteendpoint.tostring() == caktiveclient) cserver.send(c, tele...

django - Synchronizing two databases via mappings in Python -

i have live django 1.6 project makes use of postgresql database. i've been developing api project support mobile app - making use of south migrations go along. as result of of this: have new database structure , code-base quite far removed production database although many of fields in production database still present in new one. so sits - have mobile app running off new api , website running off old database. how can go synchronizing data between 2 databases while front-end new website being developed? i.e. when user makes use of app , later goes website, i'd data available , vice-versa. solutions i've tried: i cannot use api update new database because trigger activation emails users have been activated. i've tried use peewee create synchronization script each field in 1 database mapped field in other database. has been effective tables schema similar i've had trouble when comes keeping foreign key relationships in tact.

ios - How to make a closure as function parameter optional -

i have helper display alertview: func showalertboxok(headline:string, message:string, okbuttontext:string, viewcontroller:uiviewcontroller, completionok:() -> void){ let alertcontroller = uialertcontroller(title: headline, message: message, preferredstyle:uialertcontrollerstyle.alert) alertcontroller.addaction(uialertaction(title: okbuttontext, style: uialertactionstyle.default) { action -> void in if completionok() != nil { completionok() } }) viewcontroller.presentviewcontroller(alertcontroller, animated: true, completion: nil) } now make parameter completionok optional. i´ve tried completionok:() -> void? = nil` gives me compiler error. calls should without parameter: showalertboxok("could not retrieve position", "edit ios settings - geolocation denied. sorry. please fix und restart app.", "ok", self) and parameter this: showalertboxok("could not retrieve p...

android - passing values from a receiver to a button -

i have broadcast receiver "intentfilter(bluetoothdevice.action_found)", , registered in onstart , unregistered in onstop. , in layout have a button turn bt on/off , button "btndiscover" when pressed should display information state of discovered devices contained in object "stateextdevice" shown belwo in code of broadcast reciever: broadcast receiver : switch (action) { case bluetoothdevice.action_found: log.d(tag, logand.show("onreceive", "bluetoothdevice.action_found")); int stateextbond = intent.getintextra(bluetoothdevice.extra_bond_state, bluetoothdevice.error); switch(stateextbond) { case bluetoothdevice.bond_bonding: log.d(tag, logand.show("onreceive", "bond_bonding")); break; case bluetoothdevice.bond_bonded: log.d(tag, logand.show("onreceive", "bond...

c - mktime() giving different results for same input in different timezone -

here piece of code converting fri jan 1 00:00:00 ist 1970 epoch memset(&date_st,0,sizeof(struct tm)); date_st.tm_year = 70; date_st.tm_mon = 0; date_st.tm_mday = 1; date_st.tm_hour = 24; date_st.tm_min = 0; date_st.tm_sec = 0; date_st.tm_isdst = 0 ; date_in_seconds = mktime( &date_st ); the code running on 2 servers having different time zones server_1!:user_1 > tue aug 25 11:03:51 idt 2015 server_2!:user_2 > tue aug 25 05:05:03 clt 2015 now code gives different output on different servers same input fri jan 1 00:00:00 ist 1970 server_1 -> 79200 server_2 -> 100800 can suggest why output different? , how can make same {i want same} ? that's timezones about, local time different. you might want try gmtime function instead, if want common reference time.

java - H2 index name uniqueness -

i have small problem uniqueness of index names in h2 database. mysql/mariadb possible define index named "x" table , table b @ same time. h2 database not possible, since name of index should unique per database. it problem me, since have base jpa entity class following property defined: @org.hibernate.annotations.index(name = "x") protected string x; it inherited class , b , index creation fails class b following error: error [main] o.h.tool.hbm2ddl.schemaupdate - hhh000388: unsuccessful: create index x on b(x) error [main] o.h.tool.hbm2ddl.schemaupdate - index "x" exists is possible tell hibernate automatically create index name or somehow create adapter h2 prefix such index names table names? although should have database drive schema evolution , use flywaydb migrate schema versions, can override @index want. i added test on github prove this. the classes this: @entity(name = "base") @table(name="base...

tsql - syntax error on SQL Server -

i'm receiving error: msg 102, level 15, state 1, line 1 incorrect syntax near '90'. when tried compile t-sql: alter database sgct set compatibility_level = 90 does know why? for sql server – 2005 try use: exec sp_dbcmptlevel adventureworks, 80; go more details

search - SOLR WordDelimiterFilterFactory -

i use worddelimiterfilterfactory split words have numbers solr tokens. example word php5 split in 2 tokens "php" , "5" .when searching, request executed solr q="php" , q="5". request finds results "5" only. want find documents "php5" or "php 5" only. if has idea around please. hope clear. thank's. this filter splits tokens @ word delimiters. in case can opt splitonnumerics="0", wont spilt on numbers. splitonnumerics: (integer, default 1) if 0, don't split words on transitions alpha numeric:"fembot3000" -> "fem", "bot3000" the rules determining delimiters determined in below link https://cwiki.apache.org/confluence/display/solr/filter+descriptions#filterdescriptions-worddelimiterfilter

javascript - Angular $resource how to not send param in URL -

function testmodel($resource, $location) { var port = $location.port() == 80 || $location.port() == 443 ? "" : $location.port(); var root = $location.protocol() + '://' + $location.host() + ':' + port + '/api'; return $resource(root + '/configtest/:action/:configurationid', { configurationid: '@configurationid', action: '@action' }, { 'importtests': { method: 'post', params: { html: '@html' } } }); } i have $resource in angularjs, importtests post request parameter html. unfortunately angularjs includes html parameter in request url, though post request. need remove parameter url, since url has max-length , result in error. need modify code above go from http://localhost:58861/api/configtest/importhtml/1?html=%3ctable+border%3d%220%22+cellpadding%3d%220%22+cellspacing%3d%220%22+width%3d%22244%22%3e%0a%09%3ctbody%3e%0a%09%09%3ctr+height%3d%...

Sync Local Database to Virtual Machine SQL Server Database -

i wish upload changes virtual machine's sql server database local machines database. we update local system's database once month @ irregular time. eg. 1st month local database updated in 1st week while in next month updated in 2nd week. now these updates should uploaded azure's virtual machines db , when local systems dbs updated. use sql server 2014 management studio. i have hear replication not sure if should used.

excel - Copy selected cells from one workbook and copy to another -

i trying create database copy selected range of data main workbook , copy separate workbook. the code causing issue below. 2nd workbook opens based on value of "w2". new row should inserted new wb , formatted value of selected cells pasted. 'select data copied activecell.resize(1, 4).copy 'open lessons learned db location = range("w2").value set lessons = workbooks.open(location) set ll = sheets("lessons learned") windows("lessons learned database.xlsm").activate sheets("lessons learned").activate 'insert new row range("5:5").activate activecell.offset(1).entirerow.insert 'enter odd or value range("a7").select oe = activecell.value if oe = 1 range("a6").select activecell.formular1c1 = 0 else range("a6").select activecell.formular1c1 = 1 end if 'hide permanently hidden rows -line below gives error 1004 rows(...