Posts

Showing posts from June, 2013

php - Get the last dimension of each element of an array -

i have array might depth or number of elements: $ra['a'] = 'one'; $ra['b']['two'] = 'b2'; $ra['c']['two']['three'] = 'c23'; $ra['c']['two']['four'] = 'c24'; $ra['c']['five']['a'] = 'c5a'; i want have array of strings, this: array ( 0 => 'one', 1 => 'b2', 2 => 'c23', 3 => 'c24', 4 => 'c5a', ) here recursive function made. seems work. i'm not sure i'm doing right, far declaring static, , when unset static var (in case want use function again, dont want old static array) function lastthinggetter($ra){ static $out; foreach($ra $r){ if(is_array($r)) lastthinggetter($r); else $out[] = $r; } return $out; } how make sure each time call function, $out var fresh, every time? there better way of doing this? ma...

hadoop - HIVE create external table with unicode, shows mess codes -

i'm creating hive external table text file, contains unicode. after created it, when querying data, mess codes shown. this text file 0,阿会喃 1,韦昭 2,伊籍 3,尹赏 5,尹默 6,于禁 7,于诠 8,卫瓘 9,袁遗 10,袁胤 after added hdfs, can show content using fs -cat, shown correctly. but after created hive external table use hql create external table san11.wujiang2(index int, name string) row format delimited fields terminated ',' location '/san11/tables/wujiang2'; and query hql select * san11.wujiang2; mess codes shows , indices null null ?�o�u null null null �-f null null null null null null null null 9\o� null null null 9\Øž anyone can help? thanks

php - Assigning the value to a column from a sql query -

i have 2 tables , need selelct of columns table1 , copy columns in table2. have tried many options nothing working me. beginner in php , mysql field . these things have tried first. `$sql = " update table1 join table2 on table1.primary_key = table2.primary_key set table1.column1= table2.column1 , table1.column2= table2.column2 table1.primary_key = 1 "; and `$sql= "update table1 set table1.column1 = table2.column1 table1 inner join table2 on table1.primary_key = table2.primary_key table2.primary_key= 1 "; and because of reason bothof them not working, tried method: $sql= "select column1,column2from table2 primary_key=1"; $result = mysql_query($sql); $row = mysql_fetch_array($result);` $updatequery ="update table1 set column1=$row[column1] ,column2=$row[column2] primary_key= 1"; mysql_query($updatequery); this throwing error . can 1 t...

openerp - Can't remove custom Odoo snippet -

i created custom snippet on odoo 8. slideshow component uikit want insert content inside .row bootstrap elements, is, inside snippet. below code. however, when try remove slideshow snippet via website builder (not html editor), still appears after saving. way can remove editing html editor. wrong? <openerp> <data> <template id="snippet_blocks" inherit_id="website.snippets" name="snippet blocks"> <!-- create new group called essentials--> <xpath expr="div[1]/ul" position="inside"> <li> <a href="#snippet_essentials" data-toggle="tab">essentials</a> </li> </xpath> <xpath expr="div/div/div[@id='snippet_effect']" position="after"> <div id="snippet_essentials" class="tab-pane...

c++ - How to dereference pointer when pointee value assigned in response -

i want dereference pointer firsm->rootfolder->totalitemsinview takes value, when response arrived. ns1__messagetype* messgt = new ns1__messagetype(); std::vector<ns1__messagetype> v; int count; ews__finditemresponsemessagetype *firsm = new ews__finditemresponsemessagetype(); firsm->rootfolder = new ns1__finditemparenttype(); count = *firsm->rootfolder->totalitemsinview; for(int i=0; < count; i++){ v.push_back(messgt[i]); std::cout << "hello" << std::endl; } totalitemsinview defined in class of ns1__finditemparenttype . class ns1__finditemparenttype { public: int* totalitemsinview ; }; here totalitemsinview have integer value in response of soap request. want use integer value in count run 'for loop' many times. in compilation i've got segmentation fault may because of empty value @ totalitemsinview , in response have value, how can that. i'm new pointers, appreciated. thank you. update:...

Can't keep Screen brightness setting in android 5.0++ -

i use code reduce screen brightness work in android 4.4--. when test in android 5++ work when activity open, after finish/close activity screen brightness return default setting before. how can keep screen brightness setting in android 5.0++ cresolver = getcontentresolver(); window = getwindow(); android.provider.settings.system.putint(cresolver, android.provider.settings.system.screen_brightness,75); windowmanager.layoutparams layoutpars = window.getattributes(); layoutpars.screenbrightness = 75 / (float) 255; window.setattributes(layoutpars); is adaptive brightness enabled on device? mean brightness level falls within user-defined range, rather using single value provide. try disabling before running code posted, , see if makes difference. settings.system.putint(getcontentresolver(), screen_brightness_mode, screen_brightness_mode_manual) also, see this question changing value when adaptive mode enabled.

python - django update view password and ForeignKey -

i use django update/create view , have problems: how can update/create password? - can show old password it doesn't save new 1 django hash algorithm password ignored , user cant log in anymore. class update(updateview): model = user fields = ['username', 'password'] how can update/create foreign key? is there way custom fields? i.e. show them radio/checkbox/password? thx i can show old password doesn't save new 1 django hash algorithm password ignored , user cant log in anymore. that's because security, django doesn't store raw passwords, stores hash of raw password, sufficient tell if user entered correct password to set password use user.set_password() user = request.user # or user source user.set_password('raw password string') so instead of changing field directly, change password above store hash (not raw password), , don't bother "showing old password", secure system won'...

.htaccess - htaccess 301 to dynamic URLs redirect to New dynamic URLs -

i want recirect old dynamic urls new dynamic urls follows : http://example.com/test1/parent_record/requested_record http://example.com/test/detail/requested_record any suggestion how it? you can use generic redirectmatch rule as first rule : redirectmatch 301 ^/test1/[^/]+/(.+)$ /test/detail/$1

Auto join Facebook in PHP -

i want create php script allow me fill group id join facebook group automatically. api not supported. can give me idea? php or js? there no api it, , else not allowed. in other words: it´s not possible.

jsf - Primefaces grid was not updated after executing remote command -

this question has answer here: ajax update doesn't work, when using filter on p:datatable 4 answers i have datatable filters on columns , option delete row. when table in intial state, if delete row, table updated. if apply filter, , delete 1 of shown rows, result of filtering remains, until refresh page or change filter. here code: <h:form id="form"> <p:datatable id="tdatatable" var="tdata" value="#{oemmodel.models}" widgetvar="oemmodelstable" editable="true" editmode="cell" scrollable="true" scrollheight="500" paginator="true" rows="15" emptymessage="no tdatas found given criteria" filteredvalue="#{oemmodel.filteredoemmodels}"> </p:datatable> ...

python 2.7 - IoHub for eye tracking -

can iohub used eye tribe glasses? using iohub, possible detect sacaddic, blinks, , fixations? i have not used eyetribe (and don't use iohub), use psychopy eye tracking. , connect eye tracker using tcp/ip communication python itself. , eyetribe website under api section says: if favor other programming language open api relies on standard tcp/ip protocol. if can open socket , parse strings you’re covered. and can in python, if want use these glasses sure can, require work on part. had undergrad got mirametrix tracker talking python/psychopy , left of experience detailed here: https://brittlab.uwaterloo.ca/research-tips/ but make sure technical specifications (60 hz , 20 ms latency) sufficient needs. find eye trackers pay get. there nice open source option higher speed camera , supportive developmen team @ http://pupil-labs.com/pupil/ good luck, please add comment later on experience if these work, because alot of us, you, looking cheaper tracking options....

c# - windows form app sending strings -

i made tcp/ip chat windows form application , works fine want make application send text automatically don't want user click send button live streaming! and using asynchronous connection. 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.net; using system.net.sockets; namespace chat { public partial class form1 : form { socket sck; endpoint eplocal, epremote; public form1() { initializecomponent(); sck = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); sck.setsocketoption(socketoptionlevel.socket, socketoptionname.reuseaddress, true); textbox1.text = getlocalip();//this application running ip address //textbox5.text = getlocalip(); } private string getl...

c# - Windows Service - Best practice for task scheduler -

i'm looking bit of advice here in terms of best way this. i've never created service application before , i've taken shot @ creating 1 feel if process improved. one key task, yet there couple of tasks run service pulls orders , find should of been delivered haven't been marked delivered. service sends email appropriate account manager. task run timer object ticks every 15 seconds. now upgrade plan change each task has it's own schedule , once it's run services final task calculate next run time , record it, reason being of these tasks don't need run every 15 seconds (the delayed delivery task example needs run daily), yet of them do. the issue thing can think of have timer tick every second looks @ schedules , if 1 due, run it. if not nothing. tidy way of approaching task or can think of better way this?

AngularJS animate element width inside directive -

i have directive changes width of div depending on elements fill div. works fine , looks this: .directive('flexcolumn', ['$window', '$timeout', function ($window, $timeout) { // resize container var resize = function (element, width) { // if our width > 992 if (width > 992) { // resize our element setheight(element); // otherwise } else { // set our element width , height auto element.css('height', 'auto'); element.css('width', 'auto'); } }; // gets height minus off total var getheight = function (element) { // declare our variables var height = 0, children = element.children(), loopchildren = element.hasclass('row'); // loop through element children (var = 0; < children.length; i++) { // child var ...

ios - Create objects dynamically in Swift -

in objective-c had category: @implementation nsobject (entity) + (instancetype)entity{ class cl = self.class; nsobject *obj = [[cl alloc] init]; return obj; } @end let's assume there classes , b: @interface : nsobject @end @interface b : nsobject @end and can use static entity method create objects like: nsobject *o = [nsobject entity]; // type of nsobject *a = [a entity]; // type of b *b = [b entity]; // type of b how can write category in swift? know it's possible create object knowing type let s = nsstring.self; var str = s.init() , here don't know class, should self.self has no sense , doesn't work sure. thanks in advance as mentioned in comment, reason there no base class in swift. can still implementing own base class or subclassing nsobject . class : nsobject {} class b : nsobject {} extension nsobject { class func entity() -> self { return self.init() } } a.entity() b.e...

iphone - iOS :App crash on [[FBSDKLoginManager new] logOut]; -

when logged in fblogin loggedin & on click of logout logout if removed background or rerun project has bloggedin & try logg out app crashes ….same function working without removing background & not working on relaunch function: [[fbsdkloginmanager new] logout]; @abstract logs user out @discussion calls [fbsdkaccesstoken setcurrentaccesstoken:nil] , [fbsdkprofile setcurrentprofile:nil]. - (void)logout also tried logout these 2 method [fbsdkaccesstoken setcurrentaccesstoken:nil] , [fbsdkprofile setcurrentprofile:nil]. there difference between 'new' , 'alloc init'. try following: fbsdkloginmanager *fbmanager = [[fbsdkloginmanager alloc] init]; [fbmanager logout];

javascript - PHP Poll and Values -

i'm new php, , i'm trying create poll. each answer has value (from 0 3) , when press "submit" want different message appear different result. if sum of values 0-4, example, want appear message. if it's 5-9, different message. <label><span class="badge">1</span>do website?</label> <p> <label>no</label> <input type="radio" name="poll" value="0"><br/> <label>maybe</label> <input type="radio" name="poll" value="1"><br/> <label>i don't know</label> <input type="radio" name="poll" value="2"><br/> <label>yes</label> <input type="radio" name="poll" value="3"><br/> </p> <input type="button" class="btn-danger" id="btn" value="submit"> this htm...

python - Constructing borders for rectangles in Game of life -

i started first programming course in python , i'm having trouble understanding what's wrong code game of life. our task create grid game play in can't understand wrong code (see below). def paint(target_window, grid): height = len(grid) width = len(grid[0]) target_window.setcoords(0,height,width,0) row in range(height): col in range(width): rect = rectangle(point(row,col),point(row + 1, col + 1)) rect.draw(target_window) target_window.update() more specific grid supposed "infinite" game isn't restricted. think .setcoords may have what's wrong. in case using this graphics library , indeed call of setcoords wrong. try change this target_window.setcoords(0,0,width,height) the documentation says setcoords(xll, yll, xur, yur) sets coordinate system of window. lower- left corner (xll, yll) , upper-right corner (xur, yur). subsequent drawing done respect altered coordinate system...

clip area shader in Unity3D -

Image
first of all, don't have idea shader programming need game found clip area shader on internet trying modify , add features ! added shader sprite , checked on pc , android devices after i've checked on htc 1 (my friend mobile) weird problem happening ! as see left side not clipping visually. the first shader found had width , length clipping sprite added width left , width right , color tint shader. there code : shader "sprites/clipareawithalpha" { properties { _color ("color tint", color) = (1,1,1,1) _maintex ("base (rgb), alpha (a)", 2d) = "white" {} _length ("length", range(0.0, 1.0)) = 1.0 _widthr("width right", range(0.0, 1.0)) = 1.0 _widthl ("width left", range(0.0, 1.0)) = 0.0 } subshader { lod 200 tags { "queue" = "transparent" "ignoreprojector" = ...

wpf - Display authentication page on app built-in c# WebBrowser component when try to get UserCredential -

i used following code snippet retrieve usercredential before. usercredential credential = googlewebauthorizationbroker.authorizeasync(...); it launch default browser , display authentication page when first authentication. now want add webbrowser component in wpf application, , show authentication page on built-in webbrowser component, can't find way implement it. any appreciated. this not supported google .net client library @ time. googlewebauthorizationbroker.authorizeasync opens new browser there no way auth uri embed in own webbrowser component. there example of windows phone usercontrol here have not tested though. might help <usercontrol x:class="google.apis.auth.oauth2.webauthenticationbrokerusercontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x...

Is Category in Objective C and Default Methods in Java 8 equivalent? -

similar question asked here doesn't discuss default methods. in objective c category lets extend existing class adding behaviour (even if don't have original implementation source code) , makes available instances of original class. in java 8 default methods introduced enabled add new functionality interfaces of libraries. equivalent each other? if not, how different?

variables - SQL Server : Conditional where clause (Equal) OR (LessThan or Equal) -

where [date] <= case when @param = 1 convert(date, getdate()) when @param = 2 dateadd(dd, 1, getdate()) the example above passes in variable @param intended filter for: @param = 1 (all days less or inclduing today) . @param = 2 (all days less or inclduing today , tomorrow) . @param = 3 (today only) . requires change expression. question in sql server, how create conditional where clause evaluates different equality? where [date] <= [date] = or put way: how can add filter today? try: where ([date] <= convert(date,getdate()) , @param = 1) or ([date] <= dateadd(dd, 1, getdate()) , @param = 2) or ([date] = getdate() , @param = 3)

java - Swagger 2.0 + Jackson: @JsonIdentityInfo doesn't work -

we attempting have swagger 2.0. basically, it's great except ignoring @jsonidentityinfo , @jsonidentityreference annotations. public class source { @id @generatedvalue(strategy = generationtype.identity) private long id; @manytoone @jsonidentityreference(alwaysasid=true) @jsonidentityinfo(generator = objectidgenerators.propertygenerator.class, property = "name") @jsonproperty("sourcedefinitionname") private sourcedefinition sourcedefinition; ... getters , setters } resulting in swagger schema output: { "id": 0, "sourcedefinitionname": { "configuration": {}, "driver": "string", "id": "string", "name": "string", "sourcetype": "query", "title": "string" } } you can see indeed reads @jsonproperty annotation renamin...

It's possible to run an apk from RAM in android for higher performance? -

i'm developing apk android (java, ionic, angular js,...) running on development board (udoo quad) i'm having problems of performance when scrolling screens high quality images or data updated in "real time". i suspect problem apk running sd card slow device. have major questions, first 1 personal knowledge , second 1 main question of post. 1.- when apk started, how work, apk copied ram, timings? 2.- i've search around internet method copying @ apk start data ram increase performance, haven't found procedure this. does know way this? thanks, guillermo when installed application runs, it's loaded ram, always. that's purpose of ram after all. but if load external data application, high quality images in case, might expect loading time sure, things being perfected on coding level. as questions: as stated before, when app process running, it's code converted compiled native code, runs in working memory. if want understand c...

amazon web services - Domain name setup without A Records -

Image
i hosting content on aws , want configure dns settings both @ record , www record point @ elastic load balancer. example.com (@ record) www.example.com (www record) aws recommends setting domains using cnames ip addresses can change. all documentation have seen on cname deal subdomains not primary domain ( http://example.com ). primary domain requires record , therefore must require ip address. i not want use record point traffic elastic load balancer ip address may change. any idea how can around issue? i using linode manage dns. you can use special record type in route 53 called "alias". q. can point zone apex (example.com versus www.example.com) @ elastic load balancer? yes. amazon route 53 offers special type of record called ‘alias’ record lets map zone apex (example.com) dns name elb dns name (i.e. elb1234.elb.amazonaws.com). ip addresses associated amazon elastic load balancers can change @ time due scaling up, scaling ...

c# - WPF DataGrid: How to prevent auto change row on enter key pressed? -

i'm using mvvm pattern in wpf project, i'm facing problem title mentioned. found suggestions use keyeventargs.handled = true; this: private void previewkeydown(object sender, keyeventargs e) { if ((e.key.equals(key.enter)) || (e.key.equals(key.return))) { e.handled = true; } } but want write in viewmodel not code-behind of view. example shows way handle key event mvvm pattern don't know how pass keyeventargs parameter use. can can me? best way that? any recommendation or suggestion appreciated. thanks in advance.

Get a specific recurring value from JSON array using PHP foreach loop -

i have following json array: {"key1":"example1","key2":"example2","key3":"example3","key4":"example4","key1":"example5","key2":"example6","key3":"example7","key4":"example8","key1":"example9","key2":"example10","key3":"example11","key4":"example12"} using php possible display specific recurring value, example if wanted display "key1" in foreach loop return following: example1 example5 example9 appreciate tips on use this, thanks. you aren't going able using json_encode because it's not valid json. (keyspace collision) you going need assemble object manually. you might consider creating individual items, using implode(). can prepend , append { , }. <?php $jsonobject='{"key1":"example1...

bash - Shell script to send email before password expires -

i need notify unix box users when there password going expires in number of days have used below script. #!/bin/sh rcvr1=test1@testvm.localdomain.com rcvr2=test2@testvm.localdomain.com in babinlonston lonston babin # convert current date seconds currentdate=`date +%s` # find expiration date of user userexp=`chage -l $i |grep 'password expires' | cut -d: -f2` # convert expiration date seconds passexp=`date -d “$userexp” +%s` # find remaining days expiry exp=`expr \( $passexp – $currentdate \)` # convert remaining days sec days expday=`expr \( $exp / 86400 \)` if [ $expday -le 10 ]; echo “please necessary action” | mailx -s “password $i expire in $expday day/s” $rcvr3,$rcvr2 fi done when ever run script below error. [root@testvm ~]# sh script.sh date: operand `23,' try `date --help' more information. expr: syntax error expr: syntax error script.sh: line 20: [: -le: unary operator expected date: operand `+%s' try `date --help' more information. expr:...

Wpf treeview prevent selection on expander click -

i stuck on following problem: i have custom treeviewitemstyle , when click on expander node selcted in addition expander expanding/collapsing. there way prevent selection on expanding/collapsing? <togglebutton x:name="expander" clickmode="press" ischecked="{binding isexpanded, mode=twoway, relativesource={relativesource templatedparent}}"> <togglebutton.style> <style targettype="{x:type togglebutton}"> <setter property="focusable" value="false"/> <setter property="width" value="16"/> <setter property="height" value="16"/> <setter property="template"> <setter.value> <controltemplate targettype="{x:type togglebutton}"> <border background=...

java - How to set some values of list as optional in Spring mapping? -

i want make values of following list optional, following mapping done read columns excel sheet , store them db. columns may not come every time in excel sheet, want make columns remark12 , remarks13 optional: <property name="remarkcolumns"> <list> <value>remarks1</value> <value>remarks2</value> <value>remarks3</value> <value>remarks4</value> <value>remarks5</value> <value>remarks6</value> </list> </property> please solution. either use map rather list, key: string column name, value: boolean optional. use sort of holder object 2 values (tuple2 or pair) - string , boolean. 1 should column name , other whether or not optional. (worst option, imho). use prefix on column name indicate optionality , parse name string in own code.

css rules doesn't work properly on iOS9 -

Image
i have problem ios9 site's css. css rules works fine on android , ios8. on ios9, site messed up. difference ios8 , ios9. what possible problem , how can fix this? help. css: section.destinations { float: left; width: 82.5%; display: inline-block; position: relative; overflow: hidden; margin: 0 auto; font-weight: 300; font-size: 1.25em; } .content-wrap { position: relative; border-radius: 5px; } .content-wrap section { margin: 0 auto; max-width: 1200px; text-align: center; padding: 10px; border-radius: 5px; background-color: white; display: block; } .destinations .promo { position: relative; background: #fff; webkit-box-shadow: 0 0 2px rgba(0,0,0,1); -moz-box-shadow: 0 0 2px rgba(0,0,0,1); box-shadow: 0 0 2px rgba(0,0,0,1); float: left; width: 23%; margin: 0 2.6% 20px 0; font-size: 10px; text-align: left; display: block; } @media screen , (max-width: 600px){ ...

asp.net mvc - Not able to access my MVC 5 web application after adding MS Identity -

i created app using template. after managed connect existing database. tried add identity able authorise , authenticate users of application. tried following instructions of "shyamal parikh" in post adding asp.net mvc5 identity authentication existing project my problem 401 error unless got solution explorer (in vs) , disable windows authentication. when users have unrestricted access whole application. i assume problem has solution performed cant comment directly there. can give me hint might doing wrong? do have windows authentication installed on computer? maybe adding might help. here instructions- https://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/providers/add also @ event viewer, might have hints there.

c# - Linq let not available in groupby -

this query: // stores of types interested in. var desiredtypes = new[] { dbstoerungglobalmanager.enumstoerart.kommunikation, dbstoerungglobalmanager.enumstoerart.kaelte }; list<faultstatisticmodel> data2 = (from in data let statistictype = (dbstoerungglobalmanager.enumstoerart)a.fart // cast , store statistic type desiredtypes.contains(statistictype) // filter collection of desired types group a.fdatum.tostring(groupby) mg join b in dtlist on mg.key equals b.tostring(groupby) select new faultstatisticmodel { date = mg.key, // make sure correct property receives result kommunikationvalue = statistictype == dbstoerungglobalmanage...

Typekit dosent work on Localhost -

Image
i did add localhost on kit settings dosen't still work. works on domain not on localhost. i tried everything. install easyphp or wamp. results still same. have added localhost typekit kit itself?

spring - equivalent of template.createRelationBetween in SDN4 -

Image
my project use spring-data-neo4j 3.3.0 , i'm trying use new 4.0.0.release version. in code have following code : neo4jtemplate.createrelationshipbetween(eltorrel, attribute, valueclass, graphrelationtype.has_att_value, true) what equivalent of code (which use this method in api in new version of sdk please ? more don't know how create relation of given type specific class. how can write such creation in cypher please ? @luanne here little example of problem. class element : @nodeentity public class element { @graphid private long id; private int age; private string uuid; @relationship(type = "has_att_value") private set<hasattvalue> values = new hashset<hasattvalue>(); ... class attribute : @nodeentity public class attribute { @graphid private long id; private string attname; and class hasattvalue : @relationshipentity(type = "has_att_value") public class hasattvalue { @graphid private long id; @startnode element ...

excel - Get cell to equal value from cell above -

i trying cell g in active row equal value of validation list row above. here's code: range("g" & activecell.row).value = range("g" & activecell.row - 1).value the problem copies entire validation list, , don't want that, want value selected in validation list copied cell. please can show me going wrong? it might easier use r1c1 formatting instead of a1. can reference rows r[-1]c6 getting previous row , column g. if don't want column g actual current column, instead of r[-1]c6 , put r[-1]c . the cell referencing style can changed in options menu.

regex - HTML5 pattern for IP address - how to modify pattern to ignore the "_" (underscore) character -

i have found following pattern validating syntax of ip address: pattern="((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$" but need modify ignore _ characters in places. because use input mask (it removes _ after defocusing field bootstrap validator plugin sometime doesn't catch it). so how can modify regex ignore _ characters? example strings should valid: 192.168.88.1__ 192.168.88_.200 192.16_.88_.2__ 192.168.88.2 in order match optional characters (0 or more occurrences), need * quantifier. so, match ip addresses _ after numbers, can add _* after each number: ((^|\.)((25[0-5]_*)|(2[0-4]\d_*)|(1\d\d_*)|([1-9]?\d_*))){4}_*$ see demo although, think can remove anchors safely since html5 pattern attribute anchored default. can change regex match ip more intelligently (without allowing dot before it): (25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)_*(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)_*){3} see another demo

haskell - Specify custom temporary directory for ghc compiler -

i using ghc on web server running ubuntu 14.04 lts. due restrictions, cannot provide write permissions /tmp folder. the ghc compiler throwing error after removing permissions /tmp folder /tmp/ghc12032_0: createdirectory: permission denied (permission denied) is there way provide custom temporary directory ghc? didn't find compiler flag can that. need provide custom directory every time invoke ghc. appreciated. how this? https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/separate-compilation.html#temp-files -tmpdir if have trouble because of running out of space in /tmp (or wherever installation thinks temporary files should go), may use -tmpdir option specify alternate directory. example, -tmpdir . says put temporary files in current working directory. alternatively, use tmpdir environment variable. set name of directory temporary files should put. gcc , other programs honour tmpdir variable well. even better idea: set defau...

c# - Selected image Orientation in canvas in WP8.1 SL -

i selecting image wp device using filepicker , want set image child of canvas. here bmp bitmapimage formed selected storage file. _img.source = bmp; _img.stretch = stretch.uniform; (sender canvas).children.add(_img); what got this, should orientation of selected image can set inside canvas perfectly. i tried setting below, before add child canvas. stream stream = await storagefile.openstreamforreadasync(); bmp.decodepixelheight = 700; bmp.decodepixelwidth = 450; bmp.setsource(stream); storagefile selected file device. this fine, if image portrait. need set decodepixelheight , decodepixelwidth according orientation. i apologize if question dumb!! :) try don't set decodepixelheight , decodepixelwidth. next set image stretch none.

wordpress - woocommerce_order_items table doesn't exist -

please let me know how install table on woocommerce. woocommerce_order_items i deactivated , activated plugin well. wordpress prefix not containing more 6 characters. if have table please post sql query create table manually. wc version: 2.4.6 thank you. try this drop table if exists `wp_woocommerce_order_items`; create table if not exists `wp_woocommerce_order_items` ( `order_item_id` bigint(20) not null auto_increment, `order_item_name` longtext not null, `order_item_type` varchar(200) not null default '', `order_id` bigint(20) not null, primary key (`order_item_id`), key `order_id` (`order_id`) ) engine=myisam auto_increment=236 default charset=utf8;

use case - UML sequence diagram: how do i draw cron job? -

Image
i'm developing application take advantages of restaurants dataset. every 1 week system run cron job synchronize restaurants available on public api database. however how draw sequence diagram cron job? actor? the actor scheduler (or can use cron object if like). target synchronizer object doing fancy web scanning. you can use loop fragment show repetition. simple note :-)

swing - Java - Iterate through an array everytime a button is pressed -

i iterate through list every time button pressed, using jbutton, jtextfield , event's actionlistener. every time "next" button pressed next item in array should displayed in jtextfield. have created getters, setters , constructor, it's literally following piece i'm having trouble with. @override public void actionperformed(actionevent evt){ object source = evt.getsource(); string[] item = getthing(); for(int = 0; < 3; ++){ string currenti = item[i]; } if(source.equals(btnnxt)){ txtdisplayfield.settext(currenti); } } in if statement receive error "cannot find symbol", referring currenti. you're initializing currenti string within for loop's scope. the variable therefore inaccessible outside for loop. move equality check , assignment inside loop. for(int = 0; < 3; ++){ string currenti = item[i]; if(source.equals(btnnxt)){ txtdisplayfield.settex...

c# - Loading Xml into DropDown -

my xml file looks this. <?xml version="1.0" encoding="utf-8" ?> <test1> <product name="test1" value="10"> <catagory> <catagorytype value="20">aaa</catagorytype> <catagorytype value="22">bbb</catagorytype> <catagorytype value="23">ccc</catagorytype> <catagorytype value="25">ddd</catagorytype> </catagory> <type> <typename value="11">111</typename> <typename value="12">222</typename> <typename value="13">333</typename> <typename value="14">444</typename> </type> <location> <area value="0">inside</area> <area value="1">outside</area> <area value="2">nowhere</area> </...

REDIS insert with timestamp using TCP protocol -

is possible insert list/array time stamp? i saw time , tcp massage using redis protocol insert value using first output of time command. i'm looking solutions without rappers using standard protocol. thanks.

Can I get Zurb Foundation to handle dynamic images with data-interchange? -

we're using zurb foundation on site , looking use data-interchange instead of background images. while handles images image extension (jpg, png) chokes whenever try use our cms' dynamically created images. example: <!doctype html> <!--[if ie 9]><html class="lt-ie10" lang="en"> <![endif]--> <html class="no-js" lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>data-interchange test</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/normalize.css"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/foundation.css"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/vendor/modernizr.js...

android - How to store a Bundle in onSavedInstanceState () and retrieve it? -

this question has answer here: saving android activity state using save instance state 24 answers i want store bundle received in activity (say activity1) before next activity (activity2) called , retrieve same bundle when came same activity (to activity1). how do ? try this, public class parclelisttopic implements parcelable{ private list<parcletopic> list; private arraylist<holdlisttopic> listh=new arraylist<holdlisttopic>(); public arraylist<holdlisttopic> getlisttopic() { for(int i=0;i<list.size();i++) { listh.add(list.get(i).gethold()); } return listh; } public void writetoparcel(parcel dest, int flags) { dest.writetypedlist(list); } public parclelisttopic(parcel in) { in.readtypedlist(list,parcletopic.creator); } public ...

CryptoSwift, converting objective-c code to swift -

i need convert objective-c code swift using cryptoswift . i'm not sure how use functions like: bzero , getcstring , malloc in swift. +(nsdata*)encryptdata:(nsdata*)data { static nsstring *key = @"bitcave012345678"; char keyptr[kcckeysizeaes128+1]; bzero(keyptr, sizeof(keyptr)); [key getcstring:keyptr maxlength:sizeof(keyptr) encoding:nsutf8stringencoding]; nsuinteger datalength = [data length]; size_t buffersize = datalength + kccblocksizeaes128; void *buffer = malloc(buffersize); size_t numbytesencrypted = 0; cccryptorstatus cryptstatus = cccrypt(kccencrypt, kccalgorithmaes128, kccoptionecbmode, keyptr,kcckeysizeaes128,null,[data bytes],datalength, buffer, buffersize, &numbytesencrypted); if(cryptstatus == kccsuccess) { return [nsdata datawithbytesnocopy:buffer length:numbytesencrypted]; } free(buffer); retur...

c# - asp hiddenfield get empty value from javascript parameter -

i trying pass value selected parameter in dropdown-menu hidden-field . have traced code see hidden-field value , empty value. also traced javascript code using browser debugger, no errors occurred. whats wrong? javascript $(document).ready(function (e) { $('.search-panel .dropdown-menu').find('a').click(function (e) { e.preventdefault(); var param = $(this).attr("href").replace("#", ""); var concept = $(this).text(); $('.search-panel span#search_concept').text(concept); $('[id$=hdnsearchparam]').val(param); }); }); code-behind protected void btnsearch1_click(object sender, eventargs e) { grid.datasource = u.search(hdnsearchparam.value, txtsearch.text); grid.databind(); } markup <div> <div class="col-xs-8"> <div class="input-group"> <div class="input-group-btn search-panel">...

ios - how to send file from from one app to another app using url scheme? -

summary (ios 8, xcode 6.4) first question:- can share app's documents directory's data other app? if yes, i've seen many questions related this; move data/images between 2 ios apps using custom url handler , http://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629 but found these example send text or urls. tried myself below: nsstring* path = [nsstring stringwithformat:@"my_url_scheme://"]; nsurl* url = [nsurl urlwithstring:path]; if([[uiapplication sharedapplication]canopenurl:url]) { [[uiapplication sharedapplication]openurl:url]; } the above code works open other app. when try below, can't open other app. nsarray* mainpath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *sourcepath = [mainpath objectatindex:0]; nsstring* path = [nsstring stringwithformat:@"my_url_scheme://%@",sourcepath]; nsurl* url = [nsurl fileurlwithpath:path isdirectory:yes]; if([[uiappli...