Posts

Showing posts from June, 2013

java - Android BOOT_COMPLETE not triggering (Shell does) -

i trying start service when phone boots up, , works shell command "adb shell broadcast -a android.intent.action.boot_completed -n com.example.adrian.wifi/.receiver" when restart phone nothing happens. manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.adrian.wifi" > <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.change_wifi_state" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" > <service android:name=".wifi" android:enabled="true" android:exported="true" > </service> <receiver android:name=".receiver" android:enabled="t

Programmatically search a table with jQuery DataTables -

i using jquery datatables 1.10.9 , jquery 1.8.3. i'm trying programmatically search in that, without success. i tried: function applyfilter(filter) { $("#datatable").filter(filter); } and function applyfilter(filter) { $("#datatable").fnfilter(filter); } use search() api method perform search, see code below: function applyfilter(filter) { $('#datatable').datatable().search(filter).draw(); }

Swift NSURL getResourceValue as NSURLThumbnailDictionaryKey returns nil -

i'm trying thumbnail of several files , should return nsdictionary yet keeps returning nil. instance, works: try aurl.getresourcevalue(&thumbnails, forkey:nsurlnamekey) if let thumbnail = thumbnails as? nsstring { print(thumbnail) } but doesn't (which i'm trying do): try aurl.getresourcevalue(&thumbnails, forkey:nsurlthumbnaildictionarykey) if let thumbnail = thumbnails as? nsdictionary//dictionary<string, nsimage>//doesn't work either { print(thumbnail) } anybody have idea problem here? in advance.

How to use the filter selection as a text header in another cell in Excel -

i trying create header cell based on results of filter applied column. example have filter lists results based on name. trying pull unique list or filter selection , display result in cell: example: column g filter results: (selecting doe, john , smith, jane multiple choices) doe, john doe, john smith, jane doe, john smith, jane what want display unique result in column a1 of: doe, john: smith, jane simply referencing filter selection text literal make sense, have no idea how reference in excel i using excel 2007

javascript - RSA Encryption (softAP setup of microcontroller) in C# -

i'm trying configure wifi credentials particle photon (wifi microcontroller cloud support). there existing methods java / ios / android / javascript. however, need in c# (for desktop , xamarin multiplatform app). i succesfully managed connect device, retreive it's id, retreive public key , nearby wifi access points (using webrequests , deserialized json objects) however, stuck rsa encryption of wifi password need pass through. i'm trying use rsacryptoserviceprovider encrypt need pass xml string , key in different (base64?) format. there seems kind of splicing needs happen. this retreived public key (in hex): 30819f300d06092a864886f70d010101050003818d00308189028181009885dc94e34a23a2942bb9eb6721c4233e9edcc9a967f587cea527e1d447f48319ca6c4178dff739c0ab079e02467dd4d3ad3214416f0983c3967ea71378d7d93a885f1575d71d009990bffc0882fc721f4dc98a0d80b4ccf12e51066d69055e9a3c95e247beb9dc16176a083de7fa93c23449a3870d599da9d507964f7fc4b90203010001000000000000000000000000000

How to Get A Function Name From a Library and Address in Linux C -

i learning how use functions dlopen, dlsym, etc. address of given function within given library, how do opposite? example, if know process @ gtk_main+0xa7 in libgtk-x11-2.0.so.0, how can determine function is? thanks in advance! if know address related object space can use nm . on own libgtk-x11… gives: # nm -d /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 000000000006da20 t gtk_about_dialog_get_artists 000000000006d800 t gtk_about_dialog_get_authors 000000000006d260 t gtk_about_dialog_get_comments … option -d needed dynamic symbols, , should have "t" symbols (which "really" inside object). of course these addresses related object, not address space in program. note starting addresses of entries, if address inside function should have compute nearest address. @ nm manpage other data available. you may find objects mapped given program looking @ /proc/pid/maps, @ least.

bank atm tcp message load blancing and routing using java nio/netty and activemq -

i designing banks atm message processing/routing framework, , need in finalizing technologies , architecture. transactions comes multiple atm's of partner banks, serve 5 6 banks , not more 10 atms per bank. messages come atm via tcp socket , received multithreaded java process called atm controller. runs in blocking mode 1 thread per socket. every bank given unique port atm send messages. message converted iso8583 format sent hardware security module(hsm) decryption via tcp sockets, pin verification done using software module. these standard libraries working fine far. messages sent java program called transaction router, again via tcp sockets. transaction router route message either local system in-channel banks or npci gateway non-channel banks transaction. the current system built using core java , blocking threads has following areas of pain messages gets lost in transit. timeouts happening results in offline reversal of transactions @ our database. need send re

Alternatives to Java Applet running with NPAPI in Chrome -

we have applet used zip files on client machine , stream content our servers. our clients have updated newer versions of chrome no longer able use our applet because chrome not support npapi plugins longer. think have couple of options: to somehow make existing applet work chrome (perhaps using jnlp? ) or other method to find alternative technology altogether the solution has able receive list of folders, sub-folders , file names. has able compress these files, if possible, upload them server. open suggestions. you can read file(s) file api , potentially letting user add them interface via drag , drop (for more convenient selection mechanism boring <input type="file"> :-) ). zip them in javascript using library jszip (though if server has gzip enabled, i'm not sure gain lot doing that; haven't looked deeply, though) send them server either via http post (possibly multiple posts), or using xmlhttprequest2 , or via web sockets . of

objective c - Not saving data for some reason after call to insertRowToIndexPath in iOS -

i have uitableview in app have user add rows table. calling "insertrowatindexpath": - (ibaction)addrow:(id)sender { nsstring *theobjecttoinsert = [nsstring stringwithformat:@"row #: %lu", (unsigned long)[self.tabledata count]]; [self.tabledata addobject:theobjecttoinsert]; nslog(@"what count of collection? %lu", self.tabledata.count-1); nsindexpath *newpath=[nsindexpath indexpathforrow:self.tabledata.count-1 insection:0]; [self.mytable insertrowsatindexpaths:@[newpath] withrowanimation:uitableviewrowanimationautomatic]; [self.mytable scrolltorowatindexpath:newpath atscrollposition:uitableviewscrollpositionbottom animated:yes]; } my problem i've discovered after adding necessary rows, not saving data think should. here method supposed store data: - (void)saveaction { //i iterate through entire uitableview tally data of rows nsmutablearray *cells = [[nsmutablearray alloc] init]; (nsinteger j = 0; j <

.net - C# Pointers of managed types -

depending on parameter in method, change different variables in class , act on them. in c++ super easy, in c# seems more difficult without lot of if/else statements. there better way in c#? in c++ (its been few years since coded in c++ kind): void mymethod(int option) { int* _i; string* _s; myclass* _mc; // created class datagridviewcolumn _col; // managed class if(option == 0) { _i = &m_someint; _s = &m_somestr; _mc = &m_somemc; _col = &m_somecol; } else if(option == 1) { _i = &m_someotherint; _s = &m_someotherstr; _mc = &m_someothermc; _col = &m_someothercol; } // can act on _i, _s, etc , im acting on member variables. _i = 5; _s = "changed string"; ..... } this want do, in c#. solution , messy @ end: void mymethod(int option) { int _i; string _s; myclass _mc; // created class datagridviewcolu

html - Vertically center and left-align a column of flex items -

requirements flexbox vertically middle horizontally left vertically stacked child elements number of child elements can 1 or multiple use old syntax android 4.2 understands sounds difficult describe. pink box in demo want. green box good, don't know how multiple child elements. i think solution may combination of following, cannot make it. align-items: center; flex-direction: column; body { margin: 1em .5em; } article { display: flex; align-items: center; flex-wrap: wrap; } section { height: 18em; background: #ccc; margin: 0 .5em; position: relative; display: flex; align-items: center; } section:after { font-size: smaller; color: blue; position: absolute; bottom: 0; } section.big { width: 20%; height: 5em; } section.small { width: 10%; flex: 1; } section div { outline: 1px dotted green; } section.want { background-color: pink; } section.want:after { content: "1) want this:

write python list of tuples to sqlite -

how write list of tuples sqlite db? e.g. mylist = [(1,2), (3,1), (1,4)] import sqlite3 conn = sqlite3.connect('test.db') c = conn.cursor() c.execute("insert table_name values mylist") try this: c.execute('insert table_name(first_column_name, second_column_name) values(?, ?)',var)

Scan the website link given format Jsoup Java -

i try attempt scan links in web page according selector level.i've given here's statement, have read selectors way fixed, want read more in loop, recursive or me become more flexible command level selector future may greater 2 public static void main(string[] args) { string website = website("http://www.java2s.com/"); system.out.println(website); } private static string website(string url) { string lstlink = ""; try { string level[] = {"div.col-md-9 li a", "div#sidebar ul li a"}; //level 1 document connect = jsoup.connect(url).get(); elements selectlevel1 = connect.select(level[0]); (element level1 : selectlevel1) { lstlink += level1.attr("href") + "\n"; //level2 document connect2 = jsoup.connect(level1.attr("href")).get(); elements selec

PHP glob a directory going wrong in some cases why? -

i have mistery php code going wrong in cases , don't understand why. current code displaying photos related client range. example: pick inside folder pictures 300 310 , display them. example of photos names inside folder: c20_0385, c20_0386, c20_0389, c20_0400... current php code: photos 385 420. $start = 385: $end = 420; $dirname = "smallphotos/$jour_creation - $date_creation/$session/$dossier"; $filenames = glob("$dirname/*{" . implode(",", range($start, $end)) . "}*", glob_brace); foreach ($filenames $filename) { echo "<img class=\"img-responsive\" src=\"$filename\" alt=\"$filename\">"; } that works , if $start = 385; $end = 450; it write errors: warning: glob(): pattern exceeds maximum allowed length of 260 characters warning: invalid argument supplied foreach() if $start = 385; $end = 435; shows whole folder c20_503.jpg it looks small range more or less 40 photos jo

excel - Evaluate sumproduct -

i can't evaluate sumproduct @ end of code. think else working keep getting type mismatch error i've tried sorts of variations of syntax , still can't work. ideas? sub sample() dim ws worksheet dim x long dim lrow long, llrow long dim acell range, bcell range dim rng1 range, rng2 range set ws = thisworkbook.sheets("sheet1") ws set acell = .range("b6:e20").find(cells(14, 9).offset(0, -1).value) if not acell nothing lrow = .range(split(.cells(, acell.column).address, "$")(1) & .rows.count).end(xlup).row if lrow > 1 set rng1 = .range(acell.offset(1), .cells(lrow, acell.column)) end if end if set bcell = .range("b6:e20").find(cells(14, 9).offset(-1, 0).value) if not bcell nothing llrow = .range(split(.cells(, bcell.column).address, "$")(1) & .rows.count).end(xlup).row

java - org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected -

i tried own eyes not find field causing exception. posted give try here xml <?xml version="1.0" encoding="utf-8"?> <wl5g3n0:definitions name="getsubsinfo" targetnamespace="http://www.example.org/getsubsinfo/" xmlns:wl5g3n0="http://schemas.xmlsoap.org/wsdl/" xmlns:wl5g3n1="http://www.example.org/getsubsinfo/" xmlns:wl5g3n2="http://schemas.xmlsoap.org/wsdl/soap/"> <wl5g3n0:types> <xsd:schema targetnamespace="http://www.example.org/getsubsinfo/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/getsubsinfo/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <xsd:element name="getsubsinforequest"> <xsd:complextype> <xsd:sequence> <xsd:element name="eid" type="xsd:stri

fortran - Alignment of multi-dimensional array for omp simd -

if understand aligned clause of omp simd construct, refers alignment of whole array. how used multi-dimensional arrays? assume ni = 131; nj = 137; nk = 127 !allocates arr(1:131,1:137,1:127) aligned 64-bytes call somehow_allocate_aligned(arr, [ni,nj,nk], 64) !$omp parallel collapse(2) k = 1, nk j = 1, nj call some_complicated_subroutine(arr(:,j,k)) !$omp simd aligned(arr:64) = 1, ni arr(i,j,k) = arithmetic expression involving arr(i,j,k) end end end !$omp end parallel is correct way indicate alignment of array although iteration of inner loop starts @ arr(1,j,k) ? how compiler use information infer alignment of inner loop subarray? does matter performance if run-time sizes nicer (say 128, 128, 128)? it explained here, slides 160-165 : http://irpf90.ups-tlse.fr/files/parallel_programming.pdf you should 1) align array 2) use padding force columns aligned : first dimension (specified in allocate statement) should multiple of num

c++ - What kind of function calling is this? -

this question has answer here: default value of function parameter 4 answers i seeing code snippet saw calling of function not understand.it this void recursion(int v,int p=0) //definition { //whatever in body } main() { //something ... recursion(0);// *_* } i taught in school calling , definition should have same number of arguments.but here not understand.it looks numbers of arguments can of different number. that called default argument value. have specified after other arguments without default argument values. then if don't specify argument in function call value used. if have more 1 default argument, say: void f(int first, int second = 0, char* third = ""); you have omit following default values if ommitting preceding one: //you can f(0); f(1, 2); //but not f(1, "three");

java - Case Sensitive include when builing using ndk-build -

i getting strange problem. want build native code of android app in c++. have included includes in android.mk. 1 of include local_c_includes += $(local_path)/borders now have header file pqr/abc.h in borders included file xyz.h this #include "pqr/abc.h" i getting error pqr/abc.h not exist.when change pqr pqr works. problem occurs on machine only. on mac , ndk version r9d. how resolve case sensitive includes? this how case insensitive paths work on windows filesystem. there little can fix relevant #include statements in sources. other people linux or mac thank effort. on other hand, problem in file system, not machine. so, if have windows share somewhere (maybe windows partition on local machine), can put source files there, , build pass.

java - change title of menuItem -

i having problems changing title of menuitem once created. i tried this: menuitem nativeitem = new menuitem(nativetitle); nativeitem.addactionlistener(new actionlistener(){ public void actionperformed(actionevent e) { if(menuitemenable.isselected()){ nativeitem.settitle("enable native hook"); //this not working }else{ nativeitem.settitle("disable native hook"); //this not working } } }); menu.add(nativeitem); thx gla3dr use this setlabel("hello");

How to use css property under a class only -

i have css property this :before, :after { content: ''; display: block; position: absolute; box-sizing: border-box; } it affecting whole page . need affect type of element under 'togglebox' class . how syntax should . you need specify class want apply css rules to, so: .myclass:before, .myclass:after { content: ''; display: block; position: absolute; box-sizing: border-box; } you need class="myclass" within elements want style apply to, in case "togglebox". i'm not 100% sure mean "togglebox", assume read below: <input type="checkbox" name="togglebox" class="myclass"/> update: given comment below, looks want apply style children of "togglebox" - pretty easy modification: .myclass *:before, .myclass *:after { content: ''; display: block; position: absolute; box-sizing: border-box; } this css rule apply (hence * ) element descen

php - PDF Files from database keep getting corrupted -

so storing files in database. don't ask why, know not in control of this. next, able store them hexidecimal representation , spit them display no problem, attach them email using phpmailer , sent right name , all, corrupted. walk through step step below know how being stored, , may me debug issue. (please note code paraphrased save space , show needed) step 1 file grabbed , processed $name = $_files['file_data']['name']; $file = prepareimagedbstring($_files['file_data']['tmp_name']); $mime_type = $_files['file_data']['type']; name, file, , mime_type stored here function prepareimagedbstring() function prepareimagedbstring($filepath){ $out = 'null'; $handle = @fopen($filepath, 'r'); if($handle){ $content = @fread($handle, filesize($filepath)); $content = bin2hex($content); @fclose($handle); $out = $content; } return $out; } step 2 when file being vi

Python Ros - Alternative way to map a sine wave to motor -

currently have motor running in ros correctly maps sine wave can see via "rqt_plot" function in terminal. code desired effect: pub = rospy.publisher("/tilt_controller/command", float64, latch=true) global cmd cmd = 5.0 global count count = 0 global count2 count2=0 def state_callback(msg): #rospy.loginfo(msg) #print msg.current_pos global cmd global count global count2 period = 50 m = 2 count = count +1 if count==10: count = 0 count2 = count2+1 if count2 == period: count2 =0 cmd = m*math.sin(((2*math.pi)/period)*count2) #cmd = cmd*(-1) pub.publish(cmd) #rospy.sleep(2.0) def led_control_demo(): rospy.init_node('led_control_demo') #rospy.subscriber("/motor_states/pan_tilt_port", motorstatelist, motor_callback) rospy.subscriber("/tilt_controller/state", jointstate, state_callback) rospy.spin() if __name__ ==

c# - How to change static variable in partial class when application settings update? -

i have modal form in users can enter database connection strings. , on main form, gets value of string has been entered on modal form. problem is, when change setting within modal form , save it, doesn't update while program running. program has restart before changes take effect. public partial class ebaylisting : form { static string dbserver = properties.settings.default.dbserver; static string dbname = properties.settings.default.dbname; static string uname = properties.settings.default.uname; static string pword = properties.settings.default.pword; static string constring = "server=" + dbserver + ";" + "database=" + dbname + ";" + "uid=" + uname + ";" + "password=" + pword + ";"; mysqlconnection con = new mysqlconnection(constring); mysqlcommand cmd; mysqldataadapter adapter; datatable dt = new datatable(); } i need static strings update each time set

android - Device is not getting detected in eclipse. -

i have mi pad, android version 4.4.4 ktu84p, miui version-6.7.2.0(kfxmich). developing under windows 8. device not getting detected in eclipse android ddms. have tried xioami usb drivers didnt worked me. can appreciate? i use mi pad android development on windows 10. in case works fine. before going further check these things - 1. usb debugging on or not 2. adb devices command displays device in list or not if above 2 things correct should connect correctly.

json - Collapsible tree in R -

Image
i motivated article regarding collapsible tree in r http://bl.ocks.org/mbostock/4339083 i trying reproduce same example using toy dataset this id car bus train feedback_car feedback_bus feedback_train 23433 yes yes yes toyota greyhound amtrak which can represented collapsible tree follows i wondering if can me reproduce concept (collapsible trees) using toy dataset above, example give me idea how different components work, example formatting json data in r etc...and serve starting point. in advance. you can use data.tree package data converted json, or use networkd3 package: dat <- read.table(text="id car bus train feedback_car feedback_bus feedback_train 23433 yes yes yes toyota greyhound amtrak", header=true) ## make edgelist data edges <- rbind(cbind(dat$id, names(dat)[2:4]), cbind(names(dat)[2:4], as.vector(t(dat[5:7])))) library(data.tree) tree <- from

regex - Find words does not end with a letter expression using regexp -

i trying find word ends 'k' letter , must come after these letters 'a,e,o'. regex should find this: 'stack' 'kick' 'kiik' 'kimk' 'gesk' and should not find belows: 'book' 'beak' 'aiok' for gain use reguler expression : (?![aeo]+k)^.*?$ . not work. ^.*(?<![aeo])k$ you can use words ending k .see demo.the lookbehind separate out words having aeo before last k . https://regex101.com/r/cd5jk1/3

javascript - Jquery Function to display Loading icon on whole page -

i have price calculation function calculate price on loading 5 seconds displays price of products.the image path in loadingimg variable. want call on page shows loading image on page after 5 seconds when time finishes displays results usual. please me. thank you function calculateprice() { var req, parameters, datasend, prodlist; loading = setinterval(function () { $('.objprice', prodlist).html(loadingimg); }, 5); var querystring = "?" + basic_para + "&" + getpricecalculationquerystring() + "&filter=" + filter + "&sort=1&filterchange=0&cacheprod=0"; if (page_type < 3) { querystring = querystring + "&dumy=1", datasend = ""; } else { req = { refid: refidlist }; datasend = json.stringify(req); datasend = encodeuricomponent(datasend); } url_querystring = querystring; updatelabels(

javascript - Dc.js - Row Chart with dynamic height -

i created row chart dc.js. i've got dynamic data, i've got multiple kind of data every time. now, problem row chart's height statica , svg compressed , unclear: rowchart = dc.rowchart('#rowchart'); rowchart .width(300) .height(300) .margins({ top: 20, left: 10, right: 10, bottom: 20 }) .group(barchartdimensiongroup) .dimension(barchartdimension) ... and i've got error: error: invalid negative value attribute height="-4.894322420223788" i found solution through @gordon: rowchart = dc.rowchart('#rowchart'); var heightrowchart=0; heightrowchart = rowchartdimensiongroup.all().length; tmprowchart /* dc.rowchart('#day-of-week-chart', 'chartgroup') */ .width(300) .height(heightrowchart*30) ...

sql - Insert different rows between Table A and Table B into Table B -

i have 2 identical tables. table has e.g. 100 rows, table b has 60 rows. want insert "missing" rows table table b. find different rows use: select * tablea language = 4 union select * tableb language = 4 how use code correctly "insert into" statement? idea: insert tableb (select * tablea language = 4 union select * tableb language = 4) best regards union may option cause duplications. prefer minus operation. insert tableb ( select * tablea language=4 minus select * tableb language=4)

java - JUL TO SLF4J on TomEE 1.7.2 with maven plugin -

i use slf4j api log4j2 impl inside tomee maven project. result added inside pom.xml : <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.7.12</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>jul-to-slf4j</artifactid> <version>1.7.12</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-slf4j-impl</artifactid> <version>2.4</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid> <artifactid>log4j-api</artifactid> <version>2.4</version> </dependency> <dependency> <groupid>org.apache.logging.log4j</groupid>

python - Using two dictionary keys (key 1 _and_ 2) to determine value -

i have python script read 2 bytes out of preexisting binary. 1 byte determines device type , next determines sub-device type. both defines overall device. for instance: x41 , x01 = printer x43 , x01 = audio device my code need find both x41 , x01 there printer, instance. i thought doing dictionary, think means 2 keys per value , doesn't quite trivial implement (at least skillset). is dictionary approach? or else better? like said in comments, 2 approachs possible: devices={(0x41,0x01) : 'printer' , (0x43,0x01) : 'audio device', ...} or computerdevices={ 0x41 : 'printer' , 0x43 : 'audio device', ...} kitchendevices={ 0x41 : 'roaster' , 0x26 : 'oven', ...} ... devices = {0x01: computerdevices , 0x02 :kitchendevices, ...} you can concatenate bytes : key =bytes([0x43,0x01]) , use dictionary key.

ruby on rails - link_to block not working -

i'm using series of link_to blocks create buttons in application. i'm finding these links don't end working. mouse-over button, recognizes link, correct url displays in lower left-hand corner in firefox, when click, nothing happens. nothing comes in terminal or development log either. my code follows: <%= link_to new_folder_path do%> <div class="btn btn-default add-button add_fields"><span class="glyphicon glyphicon-plus"></span>add folder</div> <% end %> this renders following html: <li> <a href="/folders/new"> <div class="btn btn-default add-button add_fields"><span class="glyphicon glyphicon-plus"></span>add folder</div> </a> </li> i should note if type standard link in without block, runs fine: <li><%= link_to "test", new_folder_path %></li> any thoughts on appreciated!

javascript - RangError on updating an old document after updating schema in meteorjs ( Yogiben Admin, Simpleschema ) -

im getting following error w20151027-20:28:24.193(5.5)? (stderr) w20151027-20:28:24.195(5.5)? (stderr) /private/var/root/.meteor/packages/meteor-tool/.1.1.4.13atstp++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 w20151027-20:28:24.196(5.5)? (stderr) throw(ex); w20151027-20:28:24.196(5.5)? (stderr) ^ w20151027-20:28:24.196(5.5)? (stderr) rangeerror: maximum call stack size exceeded => exited code: 8 say have simpleschema field "a", , have inserted data using admin panel. after that, have added field "b", , edited existing document in collection using admin panel add value field "b", , throws above error. but if try insert new document, there no error. bit stuck on this. !! idea guys ? unless new field optional in schema, old documents can't validated against anymore, somewhere in process of updating via admin panel.

sql - Laravel where query not working -

i've got table beds id name size room status hotel created_at updated_at i need filter beds belong room. in order so, i've coded lines. public function index() { // $user = jwtauth::parsetoken()->authenticate(); $data = input::get('room'); if( $data ){ $beds = bed::where('room', '=', $data )->get(); }else{ $beds = bed::where('hotel', '=', $user->hostel )->get(); } foreach( $beds $bed) { return $bed->get( array('size','room', 'id') ); } } so, if give room id, should return me room's ones. thing it's returning table entries. any ideas? update fixed relations , tried this: return room::with('beds')->findorfail($data)->beds; now gives me number of items. how can items? update this model's code: class room extends \eloque

encoding - Why are UTF-8 encoded values (in language.properties) misinterpreted in Liferay 6.2? -

Image
in liferay portal 6.2 have created portlet has language.properties file. portlet.xml : <resource-bundle>com.test.portlet.featuretest.content.language</resource-bundle> the language.properties reads: no-customer-were-found=no customer first-name=first name last-name=\u0646\u0627\u0645 \u062e\u0627\u0646\u0648\u0627\u062f\u06af\u06cc in view.jsp there somthing : why utf characters not loaded. (??? ????????) in liferay 6.0.6 true. any suggestions? i believe liferay 6.1 default encoding localization property files changed java standard utf-8 - in other words language files should contain unescaped utf-8 encoded characters rather hard-to-read version you're posting above. just convert them correct encoding, convince ide it's fine have utf-8 encoded property files , you're set.

How to get data from google analytics to MS SQL Server 2008 -

how data google analytics ms sql server 2008? is there api that? thanks! i.e. google analytics api you can use ssis googleanalyticssource a ssis data source component sql server 2012 , sql server 2014 load data google data api. also check google analytics ssis (sql server integration services)

web services - ASP.Net MVC web application Impersonated doesn't react the same way out of the server -

i have developed asp.net mvc 5 web application works impersonation. i'm using impersonation because web app calling navision dynamics web services , don't want users enter credentials. i have deployed web application on windows server 2012 r2 iis 8.5. have changed application pool .net 4.5 classic classic pipeline mode , have activated impersonation authentication. my web application works while navigate form server internet explorer raise me “system.data.services.client.dataserviceclientexception: forbidden” error when try access computer. if stay on server , change localhost myservername in url, don't error don't receive data navision. here system web configuration <system.web> <compilation targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> <authentication mode="windows" /> <authorization> <deny users="?" /> </authorization> &l

javascript - Removing duplicate values from two arrays -

existing ["562fae5a626ca2e032947baa"] new array [ { _id: '562fae5a626ca2e032947baa' }, { _id: '562fae57626ca2e032947ba9' } ] modified [ { _id: '562fae5a626ca2e032947baa' }, { _id: '562fae57626ca2e032947ba9' } ] i have existing array , new array, want compare existing , new array , remove duplicates . var existing = ["562fae5a626ca2e032947baa"]; var newarr = [ { _id: '562fae5a626ca2e032947baa' }, { _id: '562fae57626ca2e032947ba9' } ]; newarr = newarr.filter(function(val){ return existing.indexof(val) == -1; }); console.log(newarr); when try print newarr, still 2 objects? modified [ { _id: '562fae5a626ca2e032947baa' }, { _id: '562fae57626ca2e032947ba9' } ] i want modified array have only. modified [{ _id: '562fae57626ca2e032947ba9' } ] below fiddle. http://jsfiddle.net/ema6upg1/2/ newarr.filter(function(val){ return existing.indexof(val._i

Jira V6.0+ creating a project over REST API -

i've got problem: i'm working on external webinterface company , use atlassians jira project issue , tracking method. trying connect our webinterface on rest api. after short research found out, atlassian never implemented possibility create new jira project on rest api. well, isn't true, they've implemented in actual version (7.0) because migrated other 2 apis 1 rest api. comes problem: unable upgrade version 6.4.4 version 7.0.0. after second search found workaround problem. can find here : the real problem workaround isn't working or i'm doing wrong. i've tried request , given arguments parameters , on normal post method json body in it. what's problem? here more informations: when try on get, receive normal response url (it returns list available templates). when try on post json body (this way normal method normal functions of rest api) http-error 415 unsupported media type. it nice if test workaround 6.0+ version of jira so after

javascript - How to create an enumeration or where should I store it? -

i have been using extjs , find myself doing lot of checking using "magic" strings. use sort of enumeration i.e colors.red, colors.white etc does extjs support this, using version 4.2. also if need create new class or correct place ? i have /app controller store models views etc these don't seem correct location these controllers, views, models, stores .. where advisable place create things don't fit above ? this can done differently, , it's give inspiration. what have done in app creating folder enums in app folder . in folder put enums want use in app. aware use alternateclassname , uppercase make them more enum-like. just enum: ext.define('myapp.enums.orientation', { alternateclassname: ['orientation'], statics: { portraitprimary: 'portrait-primary', // orientation in primary portrait mode. portraitsecondary: 'portrait-secondary', // orientation in se

Pop for request access to contacts not show ios 9 -

i'm fetching contacts address book popup not show ask permission access contacts. automatically denied when try same code in demo run ddi not run in app. have read many articles did not solution. i'm missing in plist or settings. cncontactstore * contactstore = [[cncontactstore alloc]init]; if ([cncontactstore authorizationstatusforentitytype:cnentitytypecontacts] == cnauthorizationstatusnotdetermined) { [contactstore requestaccessforentitytype:cnentitytypecontacts completionhandler:^(bool granted, nserror * __nullable error) { if (granted==yes) { } else { nslog(@"error"); } }]; } or second methods cferrorref error = nil; abaddressbookref addressbook = abaddressbookcreatewithoptions(null, &error); if (abaddressbookgetauthorizationstatus() == kabauthorizationstatusnotdetermined) { abaddressbookrequestaccesswithcompletion(addre

javascript - How to change Google Sign-in button language -

so here's problem: have default google sign-in button in page , need change it's language. i render with: gapi.signin2.render('google-button', { 'scope': 'profile email', 'width': 122, 'height': 39, ... }); i've tried several solutions throughout web. being: inserting lang object in api's script tag: <script src="https://apis.google.com/js/platform.js" async defer > {lang:'pt'} </script> setting ___gcfg: window.___gcfg = { lang: 'pt' }; setting lang attribute in html tag <html lang="pt"> adding parameter api's url <script src="https://apis.google.com/js/platform.js?hl=pt" . . . and place found in google's documentation, redirects page says nothing this. ( https://developers.google.com/identity/sign-in/web/build-button ) i avoid building custom button because of branding guidelines, me? ps: i'm

java - Method that runs in parallel of a KeyListener -

i have keylistener listens keyboard on window. if off mark, please feel free correct me, adequate method called @ event key pressed. now, in infinite loop, have method listens on socket input: while (true) { inputstream.read(); ... } does mean if key ever pressed, keypressed() never called pick up? have start separate thread it? if infinite loop in same thread, keylistener not called, , if called, nothing happen since execution in infinite loop until exit in moment. if plan create infinite loop (first should make sure approach looking for) need separate thread, , design of exact behavior want

regex replace Match to replace ampersand -

This summary is not available. Please click here to view the post.

node.js - build 2 login system (user & admin) using passportjs -

i have built login system using passportjs , works charm. i'm struggling how differentiate login system admin. since use different database model schema in mongoosejs, i'm not sure how that. have searched on stackoverflow , found thread use multiple local strategies in passportjs , however, i'm still can't understand how apply current passport configuration. in code: passport.serializeuser(function(user, done) { if (isuser(user)) { // serialize user } else if (issponsor(user)) { // serialize company } }); what isuser , issponsor function in details? still can't , how apply code. here's passport configuration right now. https://github.com/pepziman/gampangpoll-node-server/blob/master/config/passport.js currently still using same local-login strategy both user , admin login, complete failure since user can access admin page using credentials. have made different login strategies called admin-login, using different mongoose model can't

hibernate - Hyperjaxb3: Create lookup table from enumeration element -

i have xsd file includes element enumeration constraint: <xs:complextype name="request"> <xs:sequence> <xs:element name="commsaddress" type="xs:string" /> <xs:element name="commsaddresstype"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="email"/> <xs:enumeration value="phone"/> </xs:restriction> </xs:simpletype> </xs:element> ... i commsaddresstype field in generated java class generated enum values email , phone . in turn, hibernate automatically generate database schema commsaddresstype table containing 2 rows values email , phone . request table can reference these commsaddresstypeid column. currently, hyperjaxb3 generates request class commsaddresstype field of type string :

c++ - Error when attempting to input strings into dynamically allocated array -

i'm trying code following program read single word per line text document, print same words text document, reason encountering rather large error after adding in: for(int = 0; < num_lines; i++) { getline (myfile_in, line); stringstream(line) >> arr[i]; } im not sure why causing error because copied loop program wrote previously. error goes away once remove stringstream line, far i'm aware, need in order copy contents on array. appreciated :) #include <fstream> #include <string> #include <sstream> #include <assert.h> using namespace std; int main(void) { ifstream myfile_in; myfile_in.open ("words_in.txt"); ofstream myfile_out; myfile_out.open ("words_out.txt"); string line; int num_lines = 0; string *arr; assert (!myfile_in.fail()); myfile_in >> line; while (!myfile_in.eof()) { getline (myfile_in, line); num_lines++; } arr = new string[num_lines]; for(int = 0; < num_lines; i++) {